@mcpjam/inspector 3.25.3 → 3.26.1
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.
- package/dist/client/assets/app-bootstrap-BTQE7bOL.css +1 -0
- package/dist/client/assets/{app-bootstrap-D8p1xxJL.js → app-bootstrap-DJVdECiP.js} +508 -401
- package/dist/client/assets/app-navigation-C1fmIwWx.js +1903 -0
- package/dist/client/assets/caniuse-instrument-sans-BbzFLZTg.woff2 +0 -0
- package/dist/client/assets/{chunk-D32TOXHM-_lcmAHBS.js → chunk-D32TOXHM-BuwUbJde.js} +5 -5
- package/dist/client/assets/{dead-clicks-autocapture--Cc80oY_.js → dead-clicks-autocapture-BfVQ5VOW.js} +2 -2
- package/dist/client/assets/{error-reporting-B4cQ3ELy.js → error-reporting-63LRZi7K.js} +1 -1
- package/dist/client/assets/{error-reporting-D-VMAV0k.js → error-reporting-BhRc6Gma.js} +47 -47
- package/dist/client/assets/{exception-autocapture-DginYM1x.js → exception-autocapture-BIWlGpLs.js} +2 -2
- package/dist/client/assets/first-run-oauth-return-CQwiwOKd.css +2 -0
- package/dist/client/assets/first-run-oauth-return-__GiXMoC.js +11 -0
- package/dist/client/assets/{highlighted-body-KQOG7T2V-CXee3ser.js → highlighted-body-KQOG7T2V-DOSL8MJM.js} +2 -2
- package/dist/client/assets/index-CeytPr1a.js +4 -0
- package/dist/client/assets/{jszip.min-DVVdSEhZ.js → jszip.min-DncqjL0Q.js} +2 -2
- package/dist/client/assets/{mermaid-MCJ5UELQ-DrjPVbUm.js → mermaid-MCJ5UELQ-wD11QKLw.js} +1 -1
- package/dist/client/assets/{posthog-recorder-DNy5bFB1.js → posthog-recorder-BKC9Osof.js} +2 -2
- package/dist/client/assets/{preload-helper-BYOM8wou.js → preload-helper-CEUuZLTj.js} +2 -2
- package/dist/client/assets/{project-route-CshTCVmQ.js → project-route-DNrtuUI8.js} +3 -3
- package/dist/client/assets/{react-dom-y0CFBu2J.js → react-dom-3ylgkoRI.js} +2 -2
- package/dist/client/assets/{rolldown-runtime-Ck0AUAe_.js → rolldown-runtime-CNhBNX9h.js} +1 -1
- package/dist/client/assets/{surveys-P23Cz34L.js → surveys-BJQBUJJI.js} +2 -2
- package/dist/client/assets/telemetry-files-c167c4e2b38f8ea7.js +1 -0
- package/dist/client/assets/{trace-timeline-CWdGYeWw.js → trace-timeline-CYO2Iirq.js} +1 -1
- package/dist/client/assets/trace-timeline-Dn4BLNrQ.js +93 -0
- package/dist/client/assets/{web-vitals-DgeVvuPL.js → web-vitals-DHv25aJU.js} +2 -2
- package/dist/client/caniuse-instrument-sans-OFL.txt +93 -0
- package/dist/client/caniuse-jar.webp +0 -0
- package/dist/client/caniuse-share-icons.svg +8 -0
- package/dist/client/index.html +9 -9
- package/dist/lib/launcher/index.js +10 -10
- package/dist/lib/vite/index.js +10 -10
- package/dist/server/harness-install-cli.js +322 -56
- package/dist/server/index.js +2 -2
- package/package.json +2 -2
- package/dist/client/assets/app-bootstrap-wXhyegHd.css +0 -1
- package/dist/client/assets/first-run-oauth-return-DZl0Ds5X.css +0 -2
- package/dist/client/assets/first-run-oauth-return-rF56NddK.js +0 -1872
- package/dist/client/assets/index-82wefelr.js +0 -4
- package/dist/client/assets/telemetry-files-2454aee542431dd3.js +0 -1
- package/dist/client/assets/trace-timeline-mjuETy67.js +0 -73
- package/dist/client/assets/use-reduced-motion-_Ge9sKbc.js +0 -42
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import{o as mx,r as uN}from"./rolldown-runtime-CNhBNX9h.js";import{Dt as oe,Ft as dN,Gt as Hn,Ht as ls,It as M,Kt as Ln,Lt as w,Nt as L,St as Ql,Tt as K,Ut as b,Vt as nr,bt as V,ft as Qd,jt as gx,kt as ft,mt as hN,vt as fN,wt as Cx}from"./project-route-DNrtuUI8.js";import{E as BN,Gt as ld,Jt as pN,Kt as Wr,Ot as mN,Q as Sg,Qi as gN,T as $v,Ut as LB,Wt as Pr,Yt as CN,_s as vx,as as vN,b as yN,d as bN,gs as yx,hs as SN,is as EN,kt as xN,l as wN,ms as DN,qt as TN,rs as AN,st as Wv,t as IN,tt as kN,ys as ts}from"./error-reporting-BhRc6Gma.js";import{Br as RN,Cr as kn,Dr as ON,Er as MN,Lr as NN,N as PN,Or as Ro,Pr as bx,Sr as Ve,Tr as he,Tt as LN,V as _N,br as FN,fn as HN,hn as jN,jr as Ze,jt as Sx,kr as GN,mn as VN,pn as UN,wt as zN,xr as $N,zr as Eg}from"./app-navigation-C1fmIwWx.js";import{n as WN,t as qN}from"./react-dom-3ylgkoRI.js";import{i as KN}from"./preload-helper-CEUuZLTj.js";import{a as JN,c as QN,n as YN,o as XN}from"./chunk-D32TOXHM-BuwUbJde.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.26.1"};var t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="68d7de6b-097b-4e03-bf2a-a4ab31834c52",e._sentryDebugIdIdentifier="sentry-dbid-68d7de6b-097b-4e03-bf2a-a4ab31834c52")}catch{}})();var p=mx(WN(),1),Yo=mx(qN(),1),m=KN(),ZN=Object.defineProperty,eP=(e,t)=>ZN(e,"name",{value:t,configurable:!0}),gt=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((e,t)=>{const n=Ro(`Primitive.${t}`),r=p.forwardRef((s,i)=>{const{asChild:o,...a}=s,l=o?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,m.jsx)(l,{...a,ref:i})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function xg(e,t){e&&Yo.flushSync(()=>e.dispatchEvent(t))}eP(xg,"dispatchDiscreteCustomEvent");var tP=Object.defineProperty,nP=(e,t)=>tP(e,"name",{value:t,configurable:!0}),rP=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"}),sP=p.forwardRef(nP(function(t,n){return(0,m.jsx)(gt.span,{...t,ref:n,style:{...rP,...t.style}})},"VisuallyHidden")),iP=sP,oP=Object.defineProperty,Rn=(e,t)=>oP(e,"name",{value:t,configurable:!0});function aP(e,t){const n=p.createContext(t);n.displayName=e+"Context";const r=Rn(i=>{const{children:o,...a}=i,l=p.useMemo(()=>a,Object.values(a));return(0,m.jsx)(n.Provider,{value:l,children:o})},"Provider");r.displayName=e+"Provider";function s(i,o={}){const{optional:a=!1}=o,l=p.useContext(n);if(l)return l;if(t!==void 0)return t;if(!a)throw new Error(`\`${i}\` must be used within \`${e}\``)}return Rn(s,"useContext"),[r,s]}Rn(aP,"createContext");function fs(e,t=[]){let n=[];function r(i,o){const a=p.createContext(o);a.displayName=i+"Context";const l=n.length;n=[...n,o];const c=Rn(d=>{const{scope:h,children:f,...B}=d,g=h?.[e]?.[l]||a,C=p.useMemo(()=>B,Object.values(B));return(0,m.jsx)(g.Provider,{value:C,children:f})},"Provider");c.displayName=i+"Provider";function u(d,h,f={}){const{optional:B=!1}=f,g=h?.[e]?.[l]||a,C=p.useContext(g);if(C)return C;if(o!==void 0)return o;if(!B)throw new Error(`\`${d}\` must be used within \`${i}\``)}return Rn(u,"useContext"),[c,u]}Rn(r,"createContext");const s=Rn(()=>{const i=n.map(o=>p.createContext(o));return Rn(function(a){const l=a?.[e]||i;return p.useMemo(()=>({[`__scope${e}`]:{...a,[e]:l}}),[a,l])},"useScope")},"createScope");return s.scopeName=e,[r,Ex(s,...t)]}Rn(fs,"createContextScope");function Ex(...e){const t=e[0];if(e.length===1)return t;const n=Rn(()=>{const r=e.map(s=>({useScope:s(),scopeName:s.scopeName}));return Rn(function(i){const o=r.reduce((a,{useScope:l,scopeName:c})=>{const u=l(i)[`__scope${c}`];return{...a,...u}},{});return p.useMemo(()=>({[`__scope${t.scopeName}`]:o}),[o])},"useComposedScopes")},"createScope");return n.scopeName=t.scopeName,n}Rn(Ex,"composeContextScopes");var lP=Object.defineProperty,Ot=(e,t)=>lP(e,"name",{value:t,configurable:!0});function wg(e){const t=e+"CollectionProvider",[n,r]=fs(t),[s,i]=n(t,{collectionRef:{current:null},itemMap:new Map}),o=Ot(g=>{const{scope:C,children:v}=g,y=p.useRef(null),S=p.useRef(new Map).current;return(0,m.jsx)(s,{scope:C,itemMap:S,collectionRef:y,children:v})},"CollectionProvider");o.displayName=t;const a=e+"CollectionSlot",l=Ro(a),c=p.forwardRef((g,C)=>{const{scope:v,children:y}=g,S=i(a,v),E=Ze(C,S.collectionRef);return(0,m.jsx)(l,{ref:E,children:y})});c.displayName=a;const u=e+"CollectionItemSlot",d="data-radix-collection-item",h=Ro(u),f=p.forwardRef((g,C)=>{const{scope:v,children:y,...S}=g,E=p.useRef(null),D=Ze(C,E),A=i(u,v);return p.useEffect(()=>(A.itemMap.set(E,{ref:E,...S}),()=>{A.itemMap.delete(E)})),(0,m.jsx)(h,{[d]:"",ref:D,children:y})});f.displayName=u;function B(g){const C=i(e+"CollectionConsumer",g);return p.useCallback(()=>{const v=C.collectionRef.current;if(!v)return[];const y=Array.from(v.querySelectorAll(`[${d}]`));return Array.from(C.itemMap.values()).sort((S,E)=>y.indexOf(S.ref.current)-y.indexOf(E.ref.current))},[C.collectionRef,C.itemMap])}return Ot(B,"useCollection"),[{Provider:o,Slot:c,ItemSlot:f},B,r]}Ot(wg,"createCollection");var qv=new WeakMap,lf=class bs extends Map{static{Ot(this,"OrderedDict")}#e;constructor(t){super(t),this.#e=[...super.keys()],qv.set(this,!0)}set(t,n){return qv.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 s=this.has(n),i=this.#e.length,o=Dg(t);let a=o>=0?o:i+o;const l=a<0||a>=i?-1:a;if(l===this.size||s&&l===this.size-1||l===-1)return this.set(n,r),this;const c=this.size+(s?0:1);o<0&&a++;const u=[...this.#e];let d,h=!1;for(let f=a;f<c;f++)if(a===f){let B=u[f];u[f]===n&&(B=u[f+1]),s&&this.delete(n),d=this.get(B),this.set(n,r)}else{!h&&u[f-1]===n&&(h=!0);const B=u[h?f:f-1],g=d;d=this.get(B),this.delete(B),this.set(B,g)}return this}with(t,n,r){const s=new bs(this);return s.insert(t,n,r),s}before(t){const n=this.#e.indexOf(t)-1;if(!(n<0))return this.entryAt(n)}setBefore(t,n,r){const s=this.#e.indexOf(t);return s===-1?this:this.insert(s,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 s=this.#e.indexOf(t);return s===-1?this:this.insert(s+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=bu(this.#e,t);if(n!==void 0)return this.get(n)}entryAt(t){const n=bu(this.#e,t);if(n!==void 0)return[n,this.get(n)]}indexOf(t){return this.#e.indexOf(t)}keyAt(t){return bu(this.#e,t)}from(t,n){const r=this.indexOf(t);if(r===-1)return;let s=r+n;return s<0&&(s=0),s>=this.size&&(s=this.size-1),this.at(s)}keyFrom(t,n){const r=this.indexOf(t);if(r===-1)return;let s=r+n;return s<0&&(s=0),s>=this.size&&(s=this.size-1),this.keyAt(s)}find(t,n){let r=0;for(const s of this){if(Reflect.apply(t,n,[s,r,this]))return s;r++}}findIndex(t,n){let r=0;for(const s of this){if(Reflect.apply(t,n,[s,r,this]))return r;r++}return-1}filter(t,n){const r=[];let s=0;for(const i of this)Reflect.apply(t,n,[i,s,this])&&r.push(i),s++;return new bs(r)}map(t,n){const r=[];let s=0;for(const i of this)r.push([i[0],Reflect.apply(t,n,[i,s,this])]),s++;return new bs(r)}reduce(...t){const[n,r]=t;let s=0,i=r??this.at(0);for(const o of this)s===0&&t.length===1?i=o:i=Reflect.apply(n,this,[i,o,s,this]),s++;return i}reduceRight(...t){const[n,r]=t;let s=r??this.at(-1);for(let i=this.size-1;i>=0;i--){const o=this.at(i);i===this.size-1&&t.length===1?s=o:s=Reflect.apply(n,this,[s,o,i,this])}return s}toSorted(t){const n=[...this.entries()].sort(t);return new bs(n)}toReversed(){const t=new bs;for(let n=this.size-1;n>=0;n--){const r=this.keyAt(n),s=this.get(r);t.set(r,s)}return t}toSpliced(...t){const n=[...this.entries()];return n.splice(...t),new bs(n)}slice(t,n){const r=new bs;let s=this.size-1;if(t===void 0)return r;t<0&&(t=t+this.size),n!==void 0&&n>0&&(s=n-1);for(let i=t;i<=s;i++){const o=this.keyAt(i),a=this.get(o);r.set(o,a)}return r}every(t,n){let r=0;for(const s of this){if(!Reflect.apply(t,n,[s,r,this]))return!1;r++}return!0}some(t,n){let r=0;for(const s of this){if(Reflect.apply(t,n,[s,r,this]))return!0;r++}return!1}};function bu(e,t){if("at"in Array.prototype)return Array.prototype.at.call(e,t);const n=xx(e,t);return n===-1?void 0:e[n]}Ot(bu,"at");function xx(e,t){const n=e.length,r=Dg(t),s=r>=0?r:n+r;return s<0||s>=n?-1:s}Ot(xx,"toSafeIndex");function Dg(e){return e!==e||e===0?0:Math.trunc(e)}Ot(Dg,"toSafeInteger");function cP(e){const t=e+"CollectionProvider",[n,r]=fs(t),[s,i]=n(t,{collectionElement:null,collectionRef:{current:null},collectionRefObject:{current:null},itemMap:new lf,setItemMap:Ot(()=>{},"setItemMap")}),o=Ot(({state:y,...S})=>y?(0,m.jsx)(l,{...S,state:y}):(0,m.jsx)(a,{...S}),"CollectionProvider");o.displayName=t;const a=Ot(y=>{const S=C();return(0,m.jsx)(l,{...y,state:S})},"CollectionInit");a.displayName=t+"Init";const l=Ot(y=>{const{scope:S,children:E,state:D}=y,A=p.useRef(null),[x,O]=p.useState(null),R=Ze(A,O),[P,_]=D;return p.useEffect(()=>{if(!x)return;const N=Tx(()=>{});return N.observe(x,{childList:!0,subtree:!0}),()=>{N.disconnect()}},[x]),(0,m.jsx)(s,{scope:S,itemMap:P,setItemMap:_,collectionRef:R,collectionRefObject:A,collectionElement:x,children:E})},"CollectionProviderImpl");l.displayName=t+"Impl";const c=e+"CollectionSlot",u=Ro(c),d=p.forwardRef((y,S)=>{const{scope:E,children:D}=y,A=i(c,E),x=Ze(S,A.collectionRef);return(0,m.jsx)(u,{ref:x,children:D})});d.displayName=c;const h=e+"CollectionItemSlot",f="data-radix-collection-item",B=Ro(h),g=p.forwardRef((y,S)=>{const{scope:E,children:D,...A}=y,x=p.useRef(null),[O,R]=p.useState(null),P=Ze(S,x,R),{setItemMap:_}=i(h,E),N=p.useRef(A);wx(N.current,A)||(N.current=A);const W=N.current;return p.useEffect(()=>{const q=W;return _(F=>O?F.has(O)?F.set(O,{...q,element:O}).toSorted(_B):(F.set(O,{...q,element:O}),F.toSorted(_B)):F),()=>{_(F=>!O||!F.has(O)?F:(F.delete(O),new lf(F)))}},[O,W,_]),(0,m.jsx)(B,{[f]:"",ref:P,children:D})});g.displayName=h;function C(){return p.useState(new lf)}Ot(C,"useInitCollection");function v(y){const{itemMap:S}=i(e+"CollectionConsumer",y);return S}return Ot(v,"useCollection"),[{Provider:o,Slot:d,ItemSlot:g},{createCollectionScope:r,useCollection:v,useInitCollection:C}]}Ot(cP,"createCollection");function wx(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 s of n)if(!Object.prototype.hasOwnProperty.call(t,s)||e[s]!==t[s])return!1;return!0}Ot(wx,"shallowEqual");function Dx(e,t){return!!(t.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_PRECEDING)}Ot(Dx,"isElementPreceding");function _B(e,t){return!e[1].element||!t[1].element?0:Dx(e[1].element,t[1].element)?-1:1}Ot(_B,"sortByDocumentPosition");function Tx(e){return new MutationObserver(t=>{for(const n of t)if(n.type==="childList"){e();return}})}Ot(Tx,"getChildListObserver");var uP=Object.defineProperty,Xo=(e,t)=>uP(e,"name",{value:t,configurable:!0}),Ax=!!(typeof window<"u"&&window.document&&window.document.createElement);function Se(e,t,{checkForDefaultPrevented:n=!0}={}){return Xo(function(s){if(e?.(s),n===!1||!s||!s.defaultPrevented)return t?.(s)},"handleEvent")}Xo(Se,"composeEventHandlers");function dP(e){if(!Ax)throw new Error("Cannot access window outside of the DOM");return e?.ownerDocument?.defaultView??window}Xo(dP,"getOwnerWindow");function FB(e){if(!Ax)throw new Error("Cannot access document outside of the DOM");return e?.ownerDocument??document}Xo(FB,"getOwnerDocument");function Ix(e,t=!1){const{activeElement:n}=FB(e);if(!n?.nodeName)return null;if(kx(n)&&n.contentDocument)return Ix(n.contentDocument.body,t);if(t){const r=n.getAttribute("aria-activedescendant");if(r){const s=FB(n).getElementById(r);if(s)return s}}return n}Xo(Ix,"getActiveElement");function kx(e){return e.tagName==="IFRAME"}Xo(kx,"isFrame");var wn=globalThis?.document?p.useLayoutEffect:()=>{},hP=Object.defineProperty,fP=(e,t)=>hP(e,"name",{value:t,configurable:!0}),Kv=p[" useEffectEvent ".trim().toString()],Jv=p[" useInsertionEffect ".trim().toString()];function Rx(e){if(typeof Kv=="function")return Kv(e);const t=p.useRef(()=>{throw new Error("Cannot call an event handler while rendering.")});return typeof Jv=="function"?Jv(()=>{t.current=e}):wn(()=>{t.current=e}),p.useMemo(()=>((...n)=>t.current?.(...n)),[])}fP(Rx,"useEffectEvent");var BP=Object.defineProperty,Yl=(e,t)=>BP(e,"name",{value:t,configurable:!0}),pP=p[" useInsertionEffect ".trim().toString()]||wn;function Xl({prop:e,defaultProp:t,onChange:n=Yl(()=>{},"onChange"),caller:r}){const[s,i,o]=Ox({defaultProp:t,onChange:n}),a=e!==void 0;return[a?e:s,p.useCallback(c=>{if(a){const u=Mx(c)?c(e):c;u!==e&&o.current?.(u)}else i(c)},[a,e,i,o])]}Yl(Xl,"useControllableState");function Ox({defaultProp:e,onChange:t}){const[n,r]=p.useState(e),s=p.useRef(n),i=p.useRef(t);return pP(()=>{i.current=t},[t]),p.useEffect(()=>{s.current!==n&&(i.current?.(n),s.current=n)},[n,s]),[n,r,i]}Yl(Ox,"useUncontrolledState");function Mx(e){return typeof e=="function"}Yl(Mx,"isFunction");var Qv=Symbol("RADIX:SYNC_STATE");function mP(e,t,n,r){const{prop:s,defaultProp:i,onChange:o,caller:a}=t,l=s!==void 0,c=Rx(o),u=[{...n,state:i}];r&&u.push(r);const[d,h]=p.useReducer((C,v)=>{if(v.type===Qv)return{...C,state:v.state};const y=e(C,v);return l&&!Object.is(y.state,C.state)&&c(y.state),y},...u),f=d.state,B=p.useRef(f);p.useEffect(()=>{B.current!==f&&(B.current=f,l||c(f))},[f,B,l]);const g=p.useMemo(()=>s!==void 0?{...d,state:s}:d,[d,s]);return p.useEffect(()=>{l&&!Object.is(s,d.state)&&h({type:Qv,state:s})},[s,d.state,l]),[g,h]}Yl(mP,"useControllableStateReducer");var gP=Object.defineProperty,cs=(e,t)=>gP(e,"name",{value:t,configurable:!0});function Nx(e,t){return p.useReducer((n,r)=>t[n][r]??n,e)}cs(Nx,"useStateMachine");var Hr=cs(e=>{const{present:t,children:n}=e,r=Px(t),s=typeof n=="function"?n({present:r.isPresent}):p.Children.only(n),i=Lx(r.ref,_x(s));return typeof n=="function"||r.isPresent?p.cloneElement(s,{ref:i}):null},"Presence");function Px(e){const[t,n]=p.useState(),r=p.useRef(null),s=p.useRef(e),i=p.useRef("none"),o=p.useRef(void 0),[a,l]=Nx(e?"mounted":"unmounted",{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return p.useEffect(()=>{a==="mounted"?(i.current=o.current??eo(r.current),o.current=void 0):i.current="none"},[a]),wn(()=>{const c=r.current,u=s.current;if(u!==e){const d=i.current,h=eo(c);e?(o.current=h,l("MOUNT")):h==="none"||c?.display==="none"?l("UNMOUNT"):l(u&&d!==h?"ANIMATION_OUT":"UNMOUNT"),s.current=e}},[e,l]),wn(()=>{if(t){let c;const u=t.ownerDocument.defaultView??window,d=cs(f=>{const B=eo(r.current).includes(CSS.escape(f.animationName));if(f.target===t&&B&&(l("ANIMATION_END"),!s.current)){const g=t.style.animationFillMode;t.style.animationFillMode="forwards",c=u.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=g)})}},"handleAnimationEnd"),h=cs(f=>{f.target===t&&(i.current=eo(r.current))},"handleAnimationStart");return t.addEventListener("animationstart",h),t.addEventListener("animationcancel",d),t.addEventListener("animationend",d),()=>{u.clearTimeout(c),t.removeEventListener("animationstart",h),t.removeEventListener("animationcancel",d),t.removeEventListener("animationend",d)}}else l("ANIMATION_END")},[t,l]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:p.useCallback(c=>{if(c){const u=getComputedStyle(c);r.current=u,o.current=eo(u)}else r.current=null;n(c)},[])}}cs(Px,"usePresence");function HB(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}cs(HB,"setRef");function Lx(...e){const t=p.useRef(e);return t.current=e,p.useCallback(n=>{const r=t.current;let s=!1;const i=r.map(o=>{const a=HB(o,n);return!s&&typeof a=="function"&&(s=!0),a});if(s)return()=>{for(let o=0;o<i.length;o++){const a=i[o];typeof a=="function"?a():HB(r[o],null)}}},[])}cs(Lx,"useStableComposedRefs");function eo(e){return e?.animationName||"none"}cs(eo,"getAnimationName");function _x(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)}cs(_x,"getElementRef");var CP=Object.defineProperty,vP=(e,t)=>CP(e,"name",{value:t,configurable:!0}),yP=p[" useId ".trim().toString()]||(()=>{}),bP=0;function Ii(e){const[t,n]=p.useState(yP());return wn(()=>{e||n(r=>r??String(bP++))},[e]),e||(t?`radix-${t}`:"")}vP(Ii,"useId");var SP=Object.defineProperty,EP=(e,t)=>SP(e,"name",{value:t,configurable:!0}),xP=p.createContext(void 0);function Yd(e){const t=p.useContext(xP);return e||t||"ltr"}EP(Yd,"useDirection");var wP=Object.defineProperty,DP=(e,t)=>wP(e,"name",{value:t,configurable:!0});function Nt(e){const t=p.useRef(e);return p.useEffect(()=>{t.current=e}),p.useMemo(()=>((...n)=>t.current?.(...n)),[])}DP(Nt,"useCallbackRef");var TP=Object.defineProperty,Rt=(e,t)=>TP(e,"name",{value:t,configurable:!0}),jB="dismissableLayer.update",AP="dismissableLayer.pointerDownOutside",IP="dismissableLayer.focusOutside",Yv,Fx=p.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),Hx=p.forwardRef(Rt(function(t,n){const{disableOutsidePointerEvents:r=!1,deferPointerDownOutside:s=!1,onEscapeKeyDown:i,onPointerDownOutside:o,onFocusOutside:a,onInteractOutside:l,onDismiss:c,...u}=t,d=p.useContext(Fx),[h,f]=p.useState(null),B=h?.ownerDocument??globalThis?.document,[,g]=p.useState({}),C=Ze(n,f),v=Array.from(d.layers),[y]=[...d.layersWithOutsidePointerEventsDisabled].slice(-1),S=y?v.indexOf(y):-1,E=h?v.indexOf(h):-1,D=d.layersWithOutsidePointerEventsDisabled.size>0,A=E>=S,x=p.useRef(!1),O=jx(N=>{o?.(N),l?.(N),N.defaultPrevented||c?.()},{ownerDocument:B,deferPointerDownOutside:s,isDeferredPointerDownOutsideRef:x,dismissableSurfaces:d.dismissableSurfaces,shouldHandlePointerDownOutside:p.useCallback(N=>{if(!(N instanceof Node))return!1;const W=[...d.branches].some(q=>q.contains(N));return A&&!W},[d.branches,A])}),R=Gx(N=>{if(s&&x.current)return;const W=N.target;[...d.branches].some(q=>q.contains(W))||(a?.(N),l?.(N),N.defaultPrevented||c?.())},B),P=h?E===v.length-1:!1,_=Nt(N=>{N.key==="Escape"&&(i?.(N),!N.defaultPrevented&&c&&(N.preventDefault(),c()))});return p.useEffect(()=>{if(P)return B.addEventListener("keydown",_,{capture:!0}),()=>B.removeEventListener("keydown",_,{capture:!0})},[B,P,_]),p.useEffect(()=>{if(h)return r&&(d.layersWithOutsidePointerEventsDisabled.size===0&&(Yv=B.body.style.pointerEvents,B.body.style.pointerEvents="none"),d.layersWithOutsidePointerEventsDisabled.add(h)),d.layers.add(h),GB(),()=>{r&&(d.layersWithOutsidePointerEventsDisabled.delete(h),d.layersWithOutsidePointerEventsDisabled.size===0&&(B.body.style.pointerEvents=Yv))}},[h,B,r,d]),p.useEffect(()=>()=>{h&&(d.layers.delete(h),d.layersWithOutsidePointerEventsDisabled.delete(h),GB())},[h,d]),p.useEffect(()=>{const N=Rt(()=>g({}),"handleUpdate");return document.addEventListener(jB,N),()=>document.removeEventListener(jB,N)},[]),(0,m.jsx)(gt.div,{...u,ref:C,style:{pointerEvents:D?A?"auto":"none":void 0,...t.style},onFocusCapture:Se(t.onFocusCapture,R.onFocusCapture),onBlurCapture:Se(t.onBlurCapture,R.onBlurCapture),onPointerDownCapture:Se(t.onPointerDownCapture,O.onPointerDownCapture)})},"DismissableLayer"));function kP(){const e=p.useContext(Fx),[t,n]=p.useState(null);return p.useEffect(()=>{if(t)return e.dismissableSurfaces.add(t),()=>{e.dismissableSurfaces.delete(t)}},[t,e.dismissableSurfaces]),n}Rt(kP,"useDismissableLayerSurface");var RP=Rt(()=>!0,"IS_TRUE");function jx(e,t){const{ownerDocument:n=globalThis?.document,deferPointerDownOutside:r=!1,isDeferredPointerDownOutsideRef:s,dismissableSurfaces:i,shouldHandlePointerDownOutside:o=RP}=t,a=Nt(e),l=p.useRef(!1),c=p.useRef(!1),u=p.useRef(new Map),d=p.useRef(()=>{});return p.useEffect(()=>{function h(){c.current=!1,s.current=!1,u.current.clear()}Rt(h,"resetOutsideInteraction");function f(){return Array.from(u.current.values()).some(Boolean)}Rt(f,"isOutsideInteractionIntercepted");function B(S){if(!c.current)return;const E=S.target;E instanceof Node&&[...i].some(D=>D.contains(E))||u.current.set(S.type,!0),S.type==="click"&&window.setTimeout(()=>{c.current&&d.current()},0)}Rt(B,"handleInteractionCapture");function g(S){c.current&&u.current.set(S.type,!1)}Rt(g,"handleInteractionBubble");const C=Rt(S=>{if(S.target&&!l.current){let E=function(){n.removeEventListener("click",d.current);const A=f();h(),A||Tg(AP,a,D,{discrete:!0})};if(Rt(E,"handleAndDispatchPointerDownOutsideEvent"),!o(S.target)){n.removeEventListener("click",d.current),h(),l.current=!1;return}const D={originalEvent:S};c.current=!0,s.current=r&&S.button===0,u.current.clear(),!r||S.button!==0?E():(n.removeEventListener("click",d.current),d.current=E,n.addEventListener("click",d.current,{once:!0}))}else n.removeEventListener("click",d.current),h();l.current=!1},"handlePointerDown"),v=["pointerup","mousedown","mouseup","touchstart","touchend","click"];for(const S of v)n.addEventListener(S,B,!0),n.addEventListener(S,g);const y=window.setTimeout(()=>{n.addEventListener("pointerdown",C)},0);return()=>{window.clearTimeout(y),n.removeEventListener("pointerdown",C),n.removeEventListener("click",d.current);for(const S of v)n.removeEventListener(S,B,!0),n.removeEventListener(S,g)}},[n,a,r,s,i,o]),{onPointerDownCapture:Rt(()=>l.current=!0,"onPointerDownCapture")}}Rt(jx,"usePointerDownOutside");function Gx(e,t=globalThis?.document){const n=Nt(e),r=p.useRef(!1);return p.useEffect(()=>{const s=Rt(i=>{i.target&&!r.current&&Tg(IP,n,{originalEvent:i},{discrete:!1})},"handleFocus");return t.addEventListener("focusin",s),()=>t.removeEventListener("focusin",s)},[t,n]),{onFocusCapture:Rt(()=>r.current=!0,"onFocusCapture"),onBlurCapture:Rt(()=>r.current=!1,"onBlurCapture")}}Rt(Gx,"useFocusOutside");function GB(){const e=new CustomEvent(jB);document.dispatchEvent(e)}Rt(GB,"dispatchUpdate");function Tg(e,t,n,{discrete:r}){const s=n.originalEvent.target,i=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&s.addEventListener(e,t,{once:!0}),r?xg(s,i):s.dispatchEvent(i)}Rt(Tg,"handleAndDispatchCustomEvent");var OP=Object.defineProperty,Zt=(e,t)=>OP(e,"name",{value:t,configurable:!0}),cf="focusScope.autoFocusOnMount",uf="focusScope.autoFocusOnUnmount",Xv={bubbles:!1,cancelable:!0},MP=p.forwardRef(Zt(function(t,n){const{loop:r=!1,trapped:s=!1,onMountAutoFocus:i,onUnmountAutoFocus:o,...a}=t,[l,c]=p.useState(null),u=Nt(i),d=Nt(o),h=p.useRef(null),f=Ze(n,c),B=p.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;p.useEffect(()=>{if(s){let C=function(E){if(B.paused||!l)return;const D=E.target;l.contains(D)?h.current=D:$r(h.current,{select:!0})},v=function(E){if(B.paused||!l)return;const D=E.relatedTarget;D!==null&&(l.contains(D)||$r(h.current,{select:!0}))},y=function(E){if(document.activeElement===document.body)for(const D of E)D.removedNodes.length>0&&$r(l)};Zt(C,"handleFocusIn"),Zt(v,"handleFocusOut"),Zt(y,"handleMutations"),document.addEventListener("focusin",C),document.addEventListener("focusout",v);const S=new MutationObserver(y);return l&&S.observe(l,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",C),document.removeEventListener("focusout",v),S.disconnect()}}},[s,l,B.paused]),p.useEffect(()=>{if(l){Zv.add(B);const C=document.activeElement;if(!l.contains(C)){const v=new CustomEvent(cf,Xv);l.addEventListener(cf,u),l.dispatchEvent(v),v.defaultPrevented||(Vx(qx(Ag(l)),{select:!0}),document.activeElement===C&&$r(l))}return()=>{l.removeEventListener(cf,u),setTimeout(()=>{const v=new CustomEvent(uf,Xv);l.addEventListener(uf,d),l.dispatchEvent(v),v.defaultPrevented||$r(C??document.body,{select:!0}),l.removeEventListener(uf,d),Zv.remove(B)},0)}}},[l,u,d,B]);const g=p.useCallback(C=>{if(!r&&!s||B.paused)return;const v=C.key==="Tab"&&!C.altKey&&!C.ctrlKey&&!C.metaKey,y=document.activeElement;if(v&&y){const S=C.currentTarget,[E,D]=Ux(S);E&&D?!C.shiftKey&&y===D?(C.preventDefault(),r&&$r(E,{select:!0})):C.shiftKey&&y===E&&(C.preventDefault(),r&&$r(D,{select:!0})):y===S&&C.preventDefault()}},[r,s,B.paused]);return(0,m.jsx)(gt.div,{tabIndex:-1,...a,ref:f,onKeyDown:g})},"FocusScope"));function Vx(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if($r(r,{select:t}),document.activeElement!==n)return}Zt(Vx,"focusFirst");function Ux(e){const t=Ag(e);return[VB(t,e),VB(t.reverse(),e)]}Zt(Ux,"getTabbableEdges");function Ag(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:Zt(r=>{const s=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||s?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP},"acceptNode")});for(;n.nextNode();)t.push(n.currentNode);return t}Zt(Ag,"getTabbableCandidates");function VB(e,t){const n=typeof t.checkVisibility=="function"&&t.checkVisibility({checkVisibilityCSS:!0});for(const r of e)if(!(n?!r.checkVisibility({checkVisibilityCSS:!0}):zx(r,{upTo:t})))return r}Zt(VB,"findVisible");function zx(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}Zt(zx,"isHidden");function $x(e){return e instanceof HTMLInputElement&&"select"in e}Zt($x,"isSelectableInput");function $r(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&$x(e)&&t&&e.select()}}Zt($r,"focus");var Zv=Wx();function Wx(){let e=[];return{add(t){const n=e[0];t!==n&&n?.pause(),e=UB(e,t),e.unshift(t)},remove(t){e=UB(e,t),e[0]?.resume()}}}Zt(Wx,"createFocusScopesStack");function UB(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}Zt(UB,"arrayRemove");function qx(e){return e.filter(t=>t.tagName!=="A")}Zt(qx,"removeLinks");var NP=Object.defineProperty,PP=(e,t)=>NP(e,"name",{value:t,configurable:!0}),Kx=p.forwardRef(PP(function(t,n){const{container:r,...s}=t,[i,o]=p.useState(!1);wn(()=>o(!0),[]);const a=r||i&&globalThis?.document?.body;return a?Yo.createPortal((0,m.jsx)(gt.div,{...s,ref:n}),a):null},"Portal")),LP=Object.defineProperty,Ig=(e,t)=>LP(e,"name",{value:t,configurable:!0}),Tc=0,zi=null;function _P(e){return kg(),e.children}Ig(_P,"FocusGuards");function kg(){p.useEffect(()=>{zi||(zi={start:zB(),end:zB()});const{start:e,end:t}=zi;return document.body.firstElementChild!==e&&document.body.insertAdjacentElement("afterbegin",e),document.body.lastElementChild!==t&&document.body.insertAdjacentElement("beforeend",t),Tc++,()=>{Tc===1&&(zi?.start.remove(),zi?.end.remove(),zi=null),Tc=Math.max(0,Tc-1)}},[])}Ig(kg,"useFocusGuards");function zB(){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}Ig(zB,"createFocusGuard");var Tr=function(){return Tr=Object.assign||function(t){for(var n,r=1,s=arguments.length;r<s;r++){n=arguments[r];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},Tr.apply(this,arguments)};function Jx(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 s=0,r=Object.getOwnPropertySymbols(e);s<r.length;s++)t.indexOf(r[s])<0&&Object.prototype.propertyIsEnumerable.call(e,r[s])&&(n[r[s]]=e[r[s]]);return n}function FP(e,t,n){if(n||arguments.length===2)for(var r=0,s=t.length,i;r<s;r++)(i||!(r in t))&&(i||(i=Array.prototype.slice.call(t,0,r)),i[r]=t[r]);return e.concat(i||Array.prototype.slice.call(t))}var Su="right-scroll-bar-position",Eu="width-before-scroll-bar",HP="with-scroll-bars-hidden",jP="--removed-body-scroll-bar-size";function df(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function GP(e,t){var n=(0,p.useState)(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(r){var s=n.value;s!==r&&(n.value=r,n.callback(r,s))}}}})[0];return n.callback=t,n.facade}var VP=typeof window<"u"?p.useLayoutEffect:p.useEffect,e0=new WeakMap;function UP(e,t){var n=GP(t||null,function(r){return e.forEach(function(s){return df(s,r)})});return VP(function(){var r=e0.get(n);if(r){var s=new Set(r),i=new Set(e),o=n.current;s.forEach(function(a){i.has(a)||df(a,null)}),i.forEach(function(a){s.has(a)||df(a,o)})}e0.set(n,e)},[e]),n}function zP(e){return e}function $P(e,t){t===void 0&&(t=zP);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(s){var i=t(s,r);return n.push(i),function(){n=n.filter(function(o){return o!==i})}},assignSyncMedium:function(s){for(r=!0;n.length;){var i=n;n=[],i.forEach(s)}n={push:function(o){return s(o)},filter:function(){return n}}},assignMedium:function(s){r=!0;var i=[];if(n.length){var o=n;n=[],o.forEach(s),i=n}var a=function(){var c=i;i=[],c.forEach(s)},l=function(){return Promise.resolve().then(a)};l(),n={push:function(c){i.push(c),l()},filter:function(c){return i=i.filter(c),n}}}}}function WP(e){e===void 0&&(e={});var t=$P(null);return t.options=Tr({async:!0,ssr:!1},e),t}var Qx=function(e){var t=e.sideCar,n=Jx(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 p.createElement(r,Tr({},n))};Qx.isSideCarExport=!0;function qP(e,t){return e.useMedium(t),Qx}var Yx=WP(),hf=function(){},Xd=p.forwardRef(function(e,t){var n=p.useRef(null),r=p.useState({onScrollCapture:hf,onWheelCapture:hf,onTouchMoveCapture:hf}),s=r[0],i=r[1],o=e.forwardProps,a=e.children,l=e.className,c=e.removeScrollBar,u=e.enabled,d=e.shards,h=e.sideCar,f=e.noRelative,B=e.noIsolation,g=e.inert,C=e.allowPinchZoom,v=e.as,y=v===void 0?"div":v,S=e.gapMode,E=Jx(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),D=h,A=UP([n,t]),x=Tr(Tr({},E),s);return p.createElement(p.Fragment,null,u&&p.createElement(D,{sideCar:Yx,removeScrollBar:c,shards:d,noRelative:f,noIsolation:B,inert:g,setCallbacks:i,allowPinchZoom:!!C,lockRef:n,gapMode:S}),o?p.cloneElement(p.Children.only(a),Tr(Tr({},x),{ref:A})):p.createElement(y,Tr({},x,{className:l,ref:A}),a))});Xd.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Xd.classNames={fullWidth:Eu,zeroRight:Su};var t0,KP=function(){if(t0)return t0;if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function JP(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=KP();return t&&e.setAttribute("nonce",t),e}function QP(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function YP(e){(document.head||document.getElementsByTagName("head")[0]).appendChild(e)}var XP=function(){var e=0,t=null;return{add:function(n){e==0&&(t=JP())&&(QP(t,n),YP(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},ZP=function(){var e=XP();return function(t,n){p.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},Xx=function(){var e=ZP(),t=function(n){var r=n.styles,s=n.dynamic;return e(r,s),null};return t},eL={left:0,top:0,right:0,gap:0},ff=function(e){return parseInt(e||"",10)||0},tL=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],r=t[e==="padding"?"paddingTop":"marginTop"],s=t[e==="padding"?"paddingRight":"marginRight"];return[ff(n),ff(r),ff(s)]},nL=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return eL;var t=tL(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])}},rL=Xx(),za="data-scroll-locked",sL=function(e,t,n,r){var s=e.left,i=e.top,o=e.right,a=e.gap;return n===void 0&&(n="margin"),`
|
|
2
|
+
.`.concat(HP,` {
|
|
3
|
+
overflow: hidden `).concat(r,`;
|
|
4
|
+
padding-right: `).concat(a,"px ").concat(r,`;
|
|
5
|
+
}
|
|
6
|
+
body[`).concat(za,`] {
|
|
7
|
+
overflow: hidden `).concat(r,`;
|
|
8
|
+
overscroll-behavior: contain;
|
|
9
|
+
`).concat([t&&"position: relative ".concat(r,";"),n==="margin"&&`
|
|
10
|
+
padding-left: `.concat(s,`px;
|
|
11
|
+
padding-top: `).concat(i,`px;
|
|
12
|
+
padding-right: `).concat(o,`px;
|
|
13
|
+
margin-left:0;
|
|
14
|
+
margin-top:0;
|
|
15
|
+
margin-right: `).concat(a,"px ").concat(r,`;
|
|
16
|
+
`),n==="padding"&&"padding-right: ".concat(a,"px ").concat(r,";")].filter(Boolean).join(""),`
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.`).concat(Su,` {
|
|
20
|
+
right: `).concat(a,"px ").concat(r,`;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.`).concat(Eu,` {
|
|
24
|
+
margin-right: `).concat(a,"px ").concat(r,`;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.`).concat(Su," .").concat(Su,` {
|
|
28
|
+
right: 0 `).concat(r,`;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.`).concat(Eu," .").concat(Eu,` {
|
|
32
|
+
margin-right: 0 `).concat(r,`;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
body[`).concat(za,`] {
|
|
36
|
+
`).concat(jP,": ").concat(a,`px;
|
|
37
|
+
}
|
|
38
|
+
`)},n0=function(){var e=parseInt(document.body.getAttribute("data-scroll-locked")||"0",10);return isFinite(e)?e:0},iL=function(){p.useEffect(function(){return document.body.setAttribute(za,(n0()+1).toString()),function(){var e=n0()-1;e<=0?document.body.removeAttribute(za):document.body.setAttribute(za,e.toString())}},[])},oL=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,s=r===void 0?"margin":r;iL();var i=p.useMemo(function(){return nL(s)},[s]);return p.createElement(rL,{styles:sL(i,!t,s,n?"":"!important")})},$B=!1;if(typeof window<"u")try{var Ac=Object.defineProperty({},"passive",{get:function(){return $B=!0,!0}});window.addEventListener("test",Ac,Ac),window.removeEventListener("test",Ac,Ac)}catch{$B=!1}var $i=$B?{passive:!1}:!1,aL=function(e){return e.tagName==="TEXTAREA"},Zx=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!aL(e)&&n[t]==="visible")},lL=function(e){return Zx(e,"overflowY")},cL=function(e){return Zx(e,"overflowX")},r0=function(e,t){var n=t.ownerDocument,r=t;do{if(typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host),ew(e,r)){var s=tw(e,r);if(s[1]>s[2])return!0}r=r.parentNode}while(r&&r!==n.body);return!1},uL=function(e){return[e.scrollTop,e.scrollHeight,e.clientHeight]},dL=function(e){return[e.scrollLeft,e.scrollWidth,e.clientWidth]},ew=function(e,t){return e==="v"?lL(t):cL(t)},tw=function(e,t){return e==="v"?uL(t):dL(t)},hL=function(e,t){return e==="h"&&t==="rtl"?-1:1},fL=function(e,t,n,r,s){var i=hL(e,window.getComputedStyle(t).direction),o=i*r,a=n.target,l=t.contains(a),c=!1,u=o>0,d=0,h=0;do{if(!a)break;var f=tw(e,a),B=f[0],g=f[1]-f[2]-i*B;(B||g)&&ew(e,a)&&(d+=g,h+=B);var C=a.parentNode;a=C&&C.nodeType===Node.DOCUMENT_FRAGMENT_NODE?C.host:C}while(!l&&a!==document.body||l&&(t.contains(a)||t===a));return(u&&(s&&Math.abs(d)<1||!s&&o>d)||!u&&(s&&Math.abs(h)<1||!s&&-o>h))&&(c=!0),c},Ic=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},s0=function(e){return[e.deltaX,e.deltaY]},i0=function(e){return e&&"current"in e?e.current:e},BL=function(e,t){return e[0]===t[0]&&e[1]===t[1]},pL=function(e){return`
|
|
39
|
+
.block-interactivity-`.concat(e,` {pointer-events: none;}
|
|
40
|
+
.allow-interactivity-`).concat(e,` {pointer-events: all;}
|
|
41
|
+
`)},mL=0,Wi=[];function gL(e){var t=p.useRef([]),n=p.useRef([0,0]),r=p.useRef(),s=p.useState(mL++)[0],i=p.useState(Xx)[0],o=p.useRef(e);p.useEffect(function(){o.current=e},[e]),p.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(s));var g=FP([e.lockRef.current],(e.shards||[]).map(i0),!0).filter(Boolean);return g.forEach(function(C){return C.classList.add("allow-interactivity-".concat(s))}),function(){document.body.classList.remove("block-interactivity-".concat(s)),g.forEach(function(C){return C.classList.remove("allow-interactivity-".concat(s))})}}},[e.inert,e.lockRef.current,e.shards]);var a=p.useCallback(function(g,C){if("touches"in g&&g.touches.length===2||g.type==="wheel"&&g.ctrlKey)return!o.current.allowPinchZoom;var v=Ic(g),y=n.current,S="deltaX"in g?g.deltaX:y[0]-v[0],E="deltaY"in g?g.deltaY:y[1]-v[1],D,A=g.target,x=Math.abs(S)>Math.abs(E)?"h":"v";if("touches"in g&&x==="h"&&A.type==="range")return!1;var O=window.getSelection(),R=O&&O.anchorNode;if(R&&(R===A||R.contains(A)))return!1;var P=r0(x,A);if(!P)return!0;if(P?D=x:(D=x==="v"?"h":"v",P=r0(x,A)),!P)return!1;if(!r.current&&"changedTouches"in g&&(S||E)&&(r.current=D),!D)return!0;var _=r.current||D;return fL(_,C,g,_==="h"?S:E,!0)},[]),l=p.useCallback(function(g){var C=g;if(!(!Wi.length||Wi[Wi.length-1]!==i)){var v="deltaY"in C?s0(C):Ic(C),y=t.current.filter(function(E){return E.name===C.type&&(E.target===C.target||C.target===E.shadowParent)&&BL(E.delta,v)})[0];if(y&&y.should){C.cancelable&&C.preventDefault();return}if(!y){var S=(o.current.shards||[]).map(i0).filter(Boolean).filter(function(E){return E.contains(C.target)});(S.length>0?a(C,S[0]):!o.current.noIsolation)&&C.cancelable&&C.preventDefault()}}},[]),c=p.useCallback(function(g,C,v,y){var S={name:g,delta:C,target:v,should:y,shadowParent:CL(v)};t.current.push(S),setTimeout(function(){t.current=t.current.filter(function(E){return E!==S})},1)},[]),u=p.useCallback(function(g){n.current=Ic(g),r.current=void 0},[]),d=p.useCallback(function(g){c(g.type,s0(g),g.target,a(g,e.lockRef.current))},[]),h=p.useCallback(function(g){c(g.type,Ic(g),g.target,a(g,e.lockRef.current))},[]);p.useEffect(function(){return Wi.push(i),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:h}),document.addEventListener("wheel",l,$i),document.addEventListener("touchmove",l,$i),document.addEventListener("touchstart",u,$i),function(){Wi=Wi.filter(function(g){return g!==i}),document.removeEventListener("wheel",l,$i),document.removeEventListener("touchmove",l,$i),document.removeEventListener("touchstart",u,$i)}},[]);var f=e.removeScrollBar,B=e.inert;return p.createElement(p.Fragment,null,B?p.createElement(i,{styles:pL(s)}):null,f?p.createElement(oL,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function CL(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}var vL=qP(Yx,gL),nw=p.forwardRef(function(e,t){return p.createElement(Xd,Tr({},e,{ref:t,sideCar:vL}))});nw.classNames=Xd.classNames;var yL=function(e){return typeof document>"u"?null:(Array.isArray(e)?e[0]:e).ownerDocument.body},qi=new WeakMap,kc=new WeakMap,Rc={},Bf=0,rw=function(e){return e&&(e.host||rw(e.parentNode))},bL=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=rw(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})},SL=function(e,t,n,r){var s=bL(t,Array.isArray(e)?e:[e]);Rc[n]||(Rc[n]=new WeakMap);var i=Rc[n],o=[],a=new Set,l=new Set(s),c=function(d){!d||a.has(d)||(a.add(d),c(d.parentNode))};s.forEach(c);var u=function(d){!d||l.has(d)||Array.prototype.forEach.call(d.children,function(h){if(a.has(h))u(h);else try{var f=h.getAttribute(r),B=f!==null&&f!=="false",g=(qi.get(h)||0)+1,C=(i.get(h)||0)+1;qi.set(h,g),i.set(h,C),o.push(h),g===1&&B&&kc.set(h,!0),C===1&&h.setAttribute(n,"true"),B||h.setAttribute(r,"true")}catch(v){console.error("aria-hidden: cannot operate on ",h,v)}})};return u(t),a.clear(),Bf++,function(){o.forEach(function(d){var h=qi.get(d)-1,f=i.get(d)-1;qi.set(d,h),i.set(d,f),h||(kc.has(d)||d.removeAttribute(r),kc.delete(d)),f||d.removeAttribute(n)}),Bf--,Bf||(qi=new WeakMap,qi=new WeakMap,kc=new WeakMap,Rc={})}},EL=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),s=t||yL(e);return s?(r.push.apply(r,Array.from(s.querySelectorAll("[aria-live], script"))),SL(r,s,n,"aria-hidden")):function(){return null}},xL=Object.defineProperty,wL=(e,t)=>xL(e,"name",{value:t,configurable:!0});function sw(e){const[t,n]=p.useState(void 0);return wn(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(s=>{if(!Array.isArray(s)||!s.length)return;const i=s[0];let o,a;if("borderBoxSize"in i){const l=i.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}wL(sw,"useSize");var DL=["top","right","bottom","left"],js=Math.min,ss=Math.max,cd=Math.round,Oc=Math.floor,is=e=>({x:e,y:e}),TL={left:"right",right:"left",bottom:"top",top:"bottom"};function iw(e,t,n){return ss(e,js(t,n))}function us(e,t){return typeof e=="function"?e(t):e}function Gs(e){return e.split("-")[0]}function Zo(e){return e.split("-")[1]}function Rg(e){return e==="x"?"y":"x"}function Og(e){return e==="y"?"height":"width"}function Ir(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function Mg(e){return Rg(Ir(e))}function AL(e,t,n){n===void 0&&(n=!1);const r=Zo(e),s=Mg(e),i=Og(s);let o=s==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(o=ud(o)),[o,ud(o)]}function IL(e){const t=ud(e);return[WB(e),t,WB(t)]}function WB(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}var o0=["left","right"],a0=["right","left"],kL=["top","bottom"],RL=["bottom","top"];function OL(e,t,n){switch(e){case"top":case"bottom":return n?t?a0:o0:t?o0:a0;case"left":case"right":return t?kL:RL;default:return[]}}function ML(e,t,n,r){const s=Zo(e);let i=OL(Gs(e),n==="start",r);return s&&(i=i.map(o=>o+"-"+s),t&&(i=i.concat(i.map(WB)))),i}function ud(e){const t=Gs(e);return TL[t]+e.slice(t.length)}function NL(e){var t,n,r,s;return{top:(t=e.top)!=null?t:0,right:(n=e.right)!=null?n:0,bottom:(r=e.bottom)!=null?r:0,left:(s=e.left)!=null?s:0}}function ow(e){return typeof e!="number"?NL(e):{top:e,right:e,bottom:e,left:e}}function dd(e){const{x:t,y:n,width:r,height:s}=e;return{width:r,height:s,top:n,left:t,right:t+r,bottom:n+s,x:t,y:n}}function l0(e,t,n){let{reference:r,floating:s}=e;const i=Ir(t),o=Mg(t),a=Og(o),l=Gs(t),c=i==="y",u=r.x+r.width/2-s.width/2,d=r.y+r.height/2-s.height/2,h=r[a]/2-s[a]/2;let f;switch(l){case"top":f={x:u,y:r.y-s.height};break;case"bottom":f={x:u,y:r.y+r.height};break;case"right":f={x:r.x+r.width,y:d};break;case"left":f={x:r.x-s.width,y:d};break;default:f={x:r.x,y:r.y}}const B=Zo(t);return B&&(f[o]+=h*(B==="end"?1:-1)*(n&&c?-1:1)),f}async function PL(e,t){var n;t===void 0&&(t={});const{x:r,y:s,platform:i,rects:o,elements:a,strategy:l}=e,{boundary:c="clippingAncestors",rootBoundary:u="viewport",elementContext:d="floating",altBoundary:h=!1,padding:f=0}=us(t,e),B=ow(f),g=a[h?d==="floating"?"reference":"floating":d],C=dd(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(g)))==null||n?g:g.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(a.floating)),boundary:c,rootBoundary:u,strategy:l})),v=d==="floating"?{x:r,y:s,width:o.floating.width,height:o.floating.height}:o.reference,y=await(i.getOffsetParent==null?void 0:i.getOffsetParent(a.floating)),S=await(i.isElement==null?void 0:i.isElement(y))&&await(i.getScale==null?void 0:i.getScale(y))||{x:1,y:1},E=dd(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:v,offsetParent:y,strategy:l}):v);return{top:(C.top-E.top+B.top)/S.y,bottom:(E.bottom-C.bottom+B.bottom)/S.y,left:(C.left-E.left+B.left)/S.x,right:(E.right-C.right+B.right)/S.x}}var LL=50,_L=async(e,t,n)=>{const{placement:r="bottom",strategy:s="absolute",middleware:i=[],platform:o}=n,a=o.detectOverflow?o:{...o,detectOverflow:PL},l=await(o.isRTL==null?void 0:o.isRTL(t));let c=await o.getElementRects({reference:e,floating:t,strategy:s}),{x:u,y:d}=l0(c,r,l),h=r,f=0;const B={};for(let g=0;g<i.length;g++){const C=i[g];if(!C)continue;const{name:v,fn:y}=C,{x:S,y:E,data:D,reset:A}=await y({x:u,y:d,initialPlacement:r,placement:h,strategy:s,middlewareData:B,rects:c,platform:a,elements:{reference:e,floating:t}});u=S??u,d=E??d,B[v]={...B[v],...D},A&&f<LL&&(f++,typeof A=="object"&&(A.placement&&(h=A.placement),A.rects&&(c=A.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:s}):A.rects),{x:u,y:d}=l0(c,h,l)),g=-1)}return{x:u,y:d,placement:h,strategy:s,middlewareData:B}},FL=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:s,rects:i,platform:o,elements:a,middlewareData:l}=t,{element:c,padding:u=0}=us(e,t)||{};if(c==null)return{};const d=ow(u),h={x:n,y:r},f=Mg(s),B=Og(f),g=await o.getDimensions(c),C=f==="y",v=C?"top":"left",y=C?"bottom":"right",S=C?"clientHeight":"clientWidth",E=i.reference[B]+i.reference[f]-h[f]-i.floating[B],D=h[f]-i.reference[f],A=await(o.getOffsetParent==null?void 0:o.getOffsetParent(c));let x=A?A[S]:0;(!x||!await(o.isElement==null?void 0:o.isElement(A)))&&(x=a.floating[S]||i.floating[B]);const O=E/2-D/2,R=x/2-g[B]/2-1,P=js(d[v],R),_=js(d[y],R),N=x-g[B]-_,W=x/2-g[B]/2+O,q=iw(P,W,N),F=!l.arrow&&Zo(s)!=null&&W!==q&&i.reference[B]/2-(W<P?P:_)-g[B]/2<0,z=F?W<P?W-P:W-N:0;return{[f]:h[f]+z,data:{[f]:q,centerOffset:W-q-z,...F&&{alignmentOffset:z}},reset:F}}}),HL=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:s,middlewareData:i,rects:o,initialPlacement:a,platform:l,elements:c}=t,{mainAxis:u=!0,crossAxis:d=!0,fallbackPlacements:h,fallbackStrategy:f="bestFit",fallbackAxisSideDirection:B="none",flipAlignment:g=!0,...C}=us(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const v=Gs(s),y=Ir(a),S=Gs(a)===a,E=await(l.isRTL==null?void 0:l.isRTL(c.floating)),D=h||(S||!g?[ud(a)]:IL(a)),A=B!=="none";!h&&A&&D.push(...ML(a,g,B,E));const x=[a,...D],O=await l.detectOverflow(t,C),R=[];let P=((r=i.flip)==null?void 0:r.overflows)||[];if(u&&R.push(O[v]),d){const q=AL(s,o,E);R.push(O[q[0]],O[q[1]])}if(P=[...P,{placement:s,overflows:R}],!R.every(q=>q<=0)){var _,N;const q=(((_=i.flip)==null?void 0:_.index)||0)+1,F=x[q];if(F&&(!(d==="alignment"&&y!==Ir(F))||P.every(J=>Ir(J.placement)===y?J.overflows[0]>0:!0)))return{data:{index:q,overflows:P},reset:{placement:F}};let z=(N=P.filter(J=>J.overflows[0]<=0).sort((J,Z)=>J.overflows[1]-Z.overflows[1])[0])==null?void 0:N.placement;if(!z)switch(f){case"bestFit":{var W;const J=(W=P.filter(Z=>{if(A){const Q=Ir(Z.placement);return Q===y||Q==="y"}return!0}).map(Z=>[Z.placement,Z.overflows.filter(Q=>Q>0).reduce((Q,G)=>Q+G,0)]).sort((Z,Q)=>Z[1]-Q[1])[0])==null?void 0:W[0];J&&(z=J);break}case"initialPlacement":z=a}if(s!==z)return{reset:{placement:z}}}return{}}}};function c0(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function u0(e){return DL.some(t=>e[t]>=0)}var jL=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:r}=t,{strategy:s="referenceHidden",...i}=us(e,t);switch(s){case"referenceHidden":{const o=c0(await r.detectOverflow(t,{...i,elementContext:"reference"}),n.reference);return{data:{referenceHiddenOffsets:o,referenceHidden:u0(o)}}}case"escaped":{const o=c0(await r.detectOverflow(t,{...i,altBoundary:!0}),n.floating);return{data:{escapedOffsets:o,escaped:u0(o)}}}default:return{}}}}},aw=new Set(["left","top"]);async function GL(e,t){const{placement:n,platform:r,elements:s}=e,i=await(r.isRTL==null?void 0:r.isRTL(s.floating)),o=Gs(n),a=Zo(n),l=Ir(n)==="y",c=aw.has(o)?-1:1,u=i&&l?-1:1,d=us(t,e);let{mainAxis:h,crossAxis:f,alignmentAxis:B}=typeof d=="number"?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return a&&typeof B=="number"&&(f=a==="end"?B*-1:B),l?{x:f*u,y:h*c}:{x:h*c,y:f*u}}var VL=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:s,y:i,placement:o,middlewareData:a}=t,l=await GL(t,e);return o===((n=a.offset)==null?void 0:n.placement)&&(r=a.arrow)!=null&&r.alignmentOffset?{}:{x:s+l.x,y:i+l.y,data:{...l,placement:o}}}}},UL=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:s,platform:i}=t,{mainAxis:o=!0,crossAxis:a=!1,limiter:l={fn:y=>{let{x:S,y:E}=y;return{x:S,y:E}}},...c}=us(e,t),u={x:n,y:r},d=await i.detectOverflow(t,c),h=Ir(s),f=Rg(h);let B=u[f],g=u[h];const C=(y,S)=>iw(S+d[y==="y"?"top":"left"],S,S-d[y==="y"?"bottom":"right"]);o&&(B=C(f,B)),a&&(g=C(h,g));const v=l.fn({...t,[f]:B,[h]:g});return{...v,data:{x:v.x-n,y:v.y-r,enabled:{[f]:o,[h]:a}}}}}},zL=function(e){return e===void 0&&(e={}),{options:e,fn(t){var n,r;const{x:s,y:i,placement:o,rects:a,middlewareData:l}=t,{offset:c=0,mainAxis:u=!0,crossAxis:d=!0}=us(e,t),h={x:s,y:i},f=Ir(o),B=Rg(f);let g=h[B],C=h[f];const v=us(c,t),y=typeof v=="number"?{mainAxis:v,crossAxis:0}:{mainAxis:(n=v.mainAxis)!=null?n:0,crossAxis:(r=v.crossAxis)!=null?r:0};if(u){const D=B==="y"?"height":"width",A=a.reference[B]-a.floating[D]+y.mainAxis,x=a.reference[B]+a.reference[D]-y.mainAxis;g<A?g=A:g>x&&(g=x)}if(d){var S,E;const D=B==="y"?"width":"height",A=aw.has(Gs(o)),x=a.reference[f]-a.floating[D]+(A&&((S=l.offset)==null?void 0:S[f])||0)+(A?0:y.crossAxis),O=a.reference[f]+a.reference[D]+(A?0:((E=l.offset)==null?void 0:E[f])||0)-(A?y.crossAxis:0);C<x?C=x:C>O&&(C=O)}return{[B]:g,[f]:C}}}},$L=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){const{placement:n,rects:r,platform:s,elements:i}=t,{apply:o=()=>{},...a}=us(e,t),l=await s.detectOverflow(t,a),c=Gs(n),u=Zo(n),d=Ir(n)==="y",{width:h,height:f}=r.floating;let B,g;c==="top"||c==="bottom"?(B=c,g=u===(await(s.isRTL==null?void 0:s.isRTL(i.floating))?"start":"end")?"left":"right"):(g=c,B=u==="end"?"top":"bottom");const C=f-l.top-l.bottom,v=h-l.left-l.right,y=js(f-l[B],C),S=js(h-l[g],v),E=t.middlewareData.shift,D=!E;let A=y,x=S;E!=null&&E.enabled.x&&(x=v),E!=null&&E.enabled.y&&(A=C),D&&!u&&(d?x=h-2*ss(l.left,l.right):A=f-2*ss(l.top,l.bottom)),await o({...t,availableWidth:x,availableHeight:A});const O=await s.getDimensions(i.floating);return h!==O.width||f!==O.height?{reset:{rects:!0}}:{}}}};function Zd(){return typeof window<"u"}function ea(e){return lw(e)?(e.nodeName||"").toLowerCase():"#document"}function dn(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Bs(e){var t;return(t=(lw(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function lw(e){return Zd()?e instanceof Node||e instanceof dn(e).Node:!1}function Lr(e){return Zd()?e instanceof Element||e instanceof dn(e).Element:!1}function Ys(e){return Zd()?e instanceof HTMLElement||e instanceof dn(e).HTMLElement:!1}function d0(e){return!Zd()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof dn(e).ShadowRoot}function eh(e){const{overflow:t,overflowX:n,overflowY:r,display:s}=_r(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&s!=="inline"&&s!=="contents"}function WL(e){return/^(table|td|th)$/.test(ea(e))}function th(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}var qL=/transform|translate|scale|rotate|perspective|filter/,KL=/paint|layout|strict|content/,ri=e=>!!e&&e!=="none",pf;function Ng(e){const t=Lr(e)?_r(e):e;return ri(t.transform)||ri(t.translate)||ri(t.scale)||ri(t.rotate)||ri(t.perspective)||!Pg()&&(ri(t.backdropFilter)||ri(t.filter))||qL.test(t.willChange||"")||KL.test(t.contain||"")}function JL(e){let t=ki(e);for(;Ys(t)&&!dl(t);){if(Ng(t))return t;if(th(t))return null;t=ki(t)}return null}function Pg(){return pf==null&&(pf=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),pf}function dl(e){return/^(html|body|#document)$/.test(ea(e))}function _r(e){return dn(e).getComputedStyle(e)}function nh(e){return Lr(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function ki(e){if(ea(e)==="html")return e;const t=e.assignedSlot||e.parentNode||d0(e)&&e.host||Bs(e);return d0(t)?t.host:t}function cw(e){const t=ki(e);return dl(t)?(e.ownerDocument||e).body:Ys(t)&&eh(t)?t:cw(t)}function hl(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const s=cw(e),i=s===((r=e.ownerDocument)==null?void 0:r.body),o=dn(s);if(i){const a=qB(o);return t.concat(o,o.visualViewport||[],eh(s)?s:[],a&&n?hl(a):[])}else return t.concat(s,hl(s,[],n))}function qB(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function uw(e){const t=_r(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const s=Ys(e),i=s?e.offsetWidth:n,o=s?e.offsetHeight:r,a=cd(n)!==i||cd(r)!==o;return a&&(n=i,r=o),{width:n,height:r,$:a}}function Lg(e){return Lr(e)?e:e.contextElement}function Eo(e){const t=Lg(e);if(!Ys(t))return is(1);const n=t.getBoundingClientRect(),{width:r,height:s,$:i}=uw(t);let o=(i?cd(n.width):n.width)/r,a=(i?cd(n.height):n.height)/s;return(!o||!Number.isFinite(o))&&(o=1),(!a||!Number.isFinite(a))&&(a=1),{x:o,y:a}}var QL=is(0);function dw(e){const t=dn(e);return!Pg()||!t.visualViewport?QL:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function YL(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===dn(e)}function Ri(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const s=e.getBoundingClientRect(),i=Lg(e);let o=is(1);t&&(r?Lr(r)&&(o=Eo(r)):o=Eo(e));const a=YL(i,n,r)?dw(i):is(0);let l=(s.left+a.x)/o.x,c=(s.top+a.y)/o.y,u=s.width/o.x,d=s.height/o.y;if(i&&r){const h=dn(i),f=Lr(r)?dn(r):r;let B=h,g=qB(B);for(;g&&f!==B;){const C=Eo(g),v=g.getBoundingClientRect(),y=_r(g),S=v.left+(g.clientLeft+parseFloat(y.paddingLeft))*C.x,E=v.top+(g.clientTop+parseFloat(y.paddingTop))*C.y;l*=C.x,c*=C.y,u*=C.x,d*=C.y,l+=S,c+=E,B=dn(g),g=qB(B)}}return dd({width:u,height:d,x:l,y:c})}function rh(e,t){const n=nh(e).scrollLeft;return t?t.left+n:Ri(Bs(e)).left+n}function hw(e,t){const n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-rh(e,n),y:n.top+t.scrollTop}}function XL(e){let{elements:t,rect:n,offsetParent:r,strategy:s}=e;const i=s==="fixed",o=Bs(r),a=t?th(t.floating):!1;if(r===o||a&&i)return n;let l={scrollLeft:0,scrollTop:0},c=is(1);const u=is(0),d=Ys(r);if((d||!i)&&((ea(r)!=="body"||eh(o))&&(l=nh(r)),d)){const f=Ri(r);c=Eo(r),u.x=f.x+r.clientLeft,u.y=f.y+r.clientTop}const h=o&&!d&&!i?hw(o,l):is(0);return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-l.scrollLeft*c.x+u.x+h.x,y:n.y*c.y-l.scrollTop*c.y+u.y+h.y}}function ZL(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function e_(e){const t=nh(e),n=e.ownerDocument.body,r=ss(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),s=ss(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight);let i=-t.scrollLeft+rh(e);const o=-t.scrollTop;return _r(n).direction==="rtl"&&(i+=ss(e.clientWidth,n.clientWidth)-r),{width:r,height:s,x:i,y:o}}var t_=25;function n_(e,t,n){n===void 0&&(n="viewport");const r=n==="layoutViewport",s=dn(e),i=Bs(e),o=s.visualViewport;let a=i.clientWidth,l=i.clientHeight,c=0,u=0;if(o){const d=!Pg()||t==="fixed";r?d||(c=-o.offsetLeft,u=-o.offsetTop):(a=o.width,l=o.height,d&&(c=o.offsetLeft,u=o.offsetTop))}if(rh(i)<=0){const d=i.ownerDocument,h=d.body,f=getComputedStyle(h),B=d.compatMode==="CSS1Compat"&&parseFloat(f.marginLeft)+parseFloat(f.marginRight)||0,g=Math.abs(i.clientWidth-h.clientWidth-B),C=getComputedStyle(i).scrollbarGutter==="stable both-edges"?g/2:g;C<=t_&&(a-=C)}return{width:a,height:l,x:c,y:u}}function r_(e,t){const n=Ri(e,!0,t==="fixed"),r=n.top+e.clientTop,s=n.left+e.clientLeft,i=Eo(e);return{width:e.clientWidth*i.x,height:e.clientHeight*i.y,x:s*i.x,y:r*i.y}}function h0(e,t,n){let r;if(t==="viewport"||t==="layoutViewport")r=n_(e,n,t);else if(t==="document")r=e_(Bs(e));else if(Lr(t))r=r_(t,n);else{const s=dw(e);r={x:t.x-s.x,y:t.y-s.y,width:t.width,height:t.height}}return dd(r)}function s_(e,t){const n=t.get(e);if(n)return n;let r=hl(e,[],!1).filter(a=>Lr(a)&&ea(a)!=="body"),s=null;const i=_r(e).position==="fixed";let o=i?ki(e):e;for(;Lr(o)&&!dl(o);){const a=_r(o),l=Ng(o),c=s?s.position:i?"fixed":"";!l&&(c==="fixed"||c==="absolute"&&a.position==="static")?r=r.filter(u=>u!==o):s=a,o=ki(o)}return t.set(e,r),r}function i_(e){let{element:t,boundary:n,rootBoundary:r,strategy:s}=e;const i=[...n==="clippingAncestors"?th(t)?[]:s_(t,this._c):[].concat(n),r],o=h0(t,i[0],s);let a=o.top,l=o.right,c=o.bottom,u=o.left;for(let d=1;d<i.length;d++){const h=h0(t,i[d],s);a=ss(h.top,a),l=js(h.right,l),c=js(h.bottom,c),u=ss(h.left,u)}return{width:l-u,height:c-a,x:u,y:a}}function o_(e){const{width:t,height:n}=uw(e);return{width:t,height:n}}function a_(e,t,n){const r=Ys(t),s=Bs(t),i=n==="fixed",o=Ri(e,!0,i,t);let a={scrollLeft:0,scrollTop:0};const l=is(0);if((r||!i)&&((ea(t)!=="body"||eh(s))&&(a=nh(t)),r)){const u=Ri(t,!0,i,t);l.x=u.x+t.clientLeft,l.y=u.y+t.clientTop}!r&&s&&(l.x=rh(s));const c=s&&!r&&!i?hw(s,a):is(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 mf(e){return _r(e).position==="static"}function f0(e,t){if(!Ys(e)||_r(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Bs(e)===n&&(n=n.ownerDocument.body),n}function fw(e,t){const n=dn(e);if(th(e))return n;if(!Ys(e)){let s=ki(e);for(;s&&!dl(s);){if(Lr(s)&&!mf(s))return s;s=ki(s)}return n}let r=f0(e,t);for(;r&&WL(r)&&mf(r);)r=f0(r,t);return r&&dl(r)&&mf(r)&&!Ng(r)?n:r||JL(e)||n}var l_=async function(e){const t=this.getOffsetParent||fw,n=this.getDimensions,r=await n(e.floating);return{reference:a_(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function c_(e){return _r(e).direction==="rtl"}var u_={convertOffsetParentRelativeRectToViewportRelativeRect:XL,getDocumentElement:Bs,getClippingRect:i_,getOffsetParent:fw,getElementRects:l_,getClientRects:ZL,getDimensions:o_,getScale:Eo,isElement:Lr,isRTL:c_};function Bw(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function d_(e,t,n){let r=null,s;const i=Bs(e);function o(){var u;clearTimeout(s),(u=r)==null||u.disconnect(),r=null}function a(u,d){u===void 0&&(u=!1),d===void 0&&(d=1),o();const h=e.getBoundingClientRect(),{left:f,top:B,width:g,height:C}=h;if(u||t(),!g||!C)return;const v=Oc(B),y=Oc(i.clientWidth-(f+g)),S=Oc(i.clientHeight-(B+C)),E=Oc(f),D={rootMargin:-v+"px "+-y+"px "+-S+"px "+-E+"px",threshold:ss(0,js(1,d))||1};let A=!0;function x(O){const R=O[0].intersectionRatio;if(!Bw(h,e.getBoundingClientRect()))return a();if(R!==d){if(!A)return a();R?a(!1,R):s=setTimeout(()=>{a(!1,1e-7)},1e3)}A=!1}try{r=new IntersectionObserver(x,{...D,root:i.ownerDocument})}catch{r=new IntersectionObserver(x,D)}r.observe(e)}const l=dn(e),c=()=>a(n);return l.addEventListener("resize",c),a(!0),()=>{l.removeEventListener("resize",c),o()}}function h_(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:s=!0,ancestorResize:i=!0,elementResize:o=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:l=!1}=r,c=Lg(e),u=s||i?[...c?hl(c):[],...t?hl(t):[]]:[];u.forEach(v=>{s&&v.addEventListener("scroll",n),i&&v.addEventListener("resize",n)});const d=c&&a?d_(c,n,i):null;let h=-1,f=null;o&&(f=new ResizeObserver(v=>{let[y]=v;y&&y.target===c&&f&&t&&(f.unobserve(t),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{var S;(S=f)==null||S.observe(t)})),n()}),c&&!l&&f.observe(c),t&&f.observe(t));let B,g=l?Ri(e):null;l&&C();function C(){const v=Ri(e);g&&!Bw(g,v)&&n(),g=v,B=requestAnimationFrame(C)}return n(),()=>{var v;u.forEach(y=>{s&&y.removeEventListener("scroll",n),i&&y.removeEventListener("resize",n)}),d?.(),(v=f)==null||v.disconnect(),f=null,l&&cancelAnimationFrame(B)}}var f_=VL,B_=UL,p_=HL,m_=$L,g_=jL,B0=FL,C_=zL,v_=(e,t,n)=>{const r=new Map,s=n??{},i={...u_,...s.platform,_c:r};return _L(e,t,{...s,platform:i})},xu=typeof document<"u"?p.useLayoutEffect:function(){};function hd(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,s;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(!hd(e[r],t[r]))return!1;return!0}if(s=Object.keys(e),n=s.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,s[r]))return!1;for(r=n;r--!==0;){const i=s[r];if(!(i==="_owner"&&e.$$typeof)&&!hd(e[i],t[i]))return!1}return!0}return e!==e&&t!==t}function pw(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function p0(e,t){const n=pw(e);return Math.round(t*n)/n}function gf(e){const t=p.useRef(e);return xu(()=>{t.current=e}),t}function y_(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:s,elements:{reference:i,floating:o}={},transform:a=!0,whileElementsMounted:l,open:c}=e,[u,d]=p.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[h,f]=p.useState(r);hd(h,r)||f(r);const[B,g]=p.useState(null),[C,v]=p.useState(null),y=p.useCallback(Z=>{Z!==A.current&&(A.current=Z,g(Z))},[]),S=p.useCallback(Z=>{Z!==x.current&&(x.current=Z,v(Z))},[]),E=i||B,D=o||C,A=p.useRef(null),x=p.useRef(null),O=p.useRef(u),R=l!=null,P=gf(l),_=gf(s),N=gf(c),W=p.useCallback(()=>{if(!A.current||!x.current)return;const Z={placement:t,strategy:n,middleware:h};_.current&&(Z.platform=_.current),v_(A.current,x.current,Z).then(Q=>{const G={...Q,isPositioned:N.current!==!1};q.current&&!hd(O.current,G)&&(O.current=G,Yo.flushSync(()=>{d(G)}))})},[h,t,n,_,N]);xu(()=>{c===!1&&O.current.isPositioned&&(O.current.isPositioned=!1,d(Z=>({...Z,isPositioned:!1})))},[c]);const q=p.useRef(!1);xu(()=>(q.current=!0,()=>{q.current=!1}),[]),xu(()=>{if(E&&(A.current=E),D&&(x.current=D),E&&D){if(P.current)return P.current(E,D,W);W()}},[E,D,W,P,R]);const F=p.useMemo(()=>({reference:A,floating:x,setReference:y,setFloating:S}),[y,S]),z=p.useMemo(()=>({reference:E,floating:D}),[E,D]),J=p.useMemo(()=>{const Z={position:n,left:0,top:0};if(!z.floating)return Z;const Q=p0(z.floating,u.x),G=p0(z.floating,u.y);return a?{...Z,transform:"translate("+Q+"px, "+G+"px)",...pw(z.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:Q,top:G}},[n,a,z.floating,u.x,u.y]);return p.useMemo(()=>({...u,update:W,refs:F,elements:z,floatingStyles:J}),[u,W,F,z,J])}var b_=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:s}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?B0({element:r.current,padding:s}).fn(n):{}:r?B0({element:r,padding:s}).fn(n):{}}}},S_=(e,t)=>{const n=f_(e);return{name:n.name,fn:n.fn,options:[e,t]}},E_=(e,t)=>{const n=B_(e);return{name:n.name,fn:n.fn,options:[e,t]}},x_=(e,t)=>({fn:C_(e).fn,options:[e,t]}),w_=(e,t)=>{const n=p_(e);return{name:n.name,fn:n.fn,options:[e,t]}},D_=(e,t)=>{const n=m_(e);return{name:n.name,fn:n.fn,options:[e,t]}},T_=(e,t)=>{const n=g_(e);return{name:n.name,fn:n.fn,options:[e,t]}},A_=(e,t)=>{const n=b_(e);return{name:n.name,fn:n.fn,options:[e,t]}},I_=Object.defineProperty,k_=(e,t)=>I_(e,"name",{value:t,configurable:!0}),R_=p.forwardRef(k_(function(t,n){const{children:r,width:s=10,height:i=5,...o}=t;return(0,m.jsx)(gt.svg,{...o,ref:n,width:s,height:i,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:t.asChild?r:(0,m.jsx)("polygon",{points:"0,0 30,0 15,10"})})},"Arrow")),O_=R_,M_=Object.defineProperty,os=(e,t)=>M_(e,"name",{value:t,configurable:!0}),mw="Popper",[gw,sh]=fs(mw),[N_,Cw]=gw(mw),P_=os(e=>{const{__scopePopper:t,children:n}=e,[r,s]=p.useState(null),[i,o]=p.useState(void 0);return(0,m.jsx)(N_,{scope:t,anchor:r,onAnchorChange:s,placementState:i,setPlacementState:o,children:n})},"Popper"),L_="PopperAnchor",__=p.forwardRef(os(function(t,n){const{__scopePopper:r,virtualRef:s,...i}=t,o=Cw(L_,r),a=p.useRef(null),l=o.onAnchorChange,c=p.useCallback(g=>{a.current=g,g&&l(g)},[l]),u=Ze(n,c),d=p.useRef(null);p.useEffect(()=>{if(!s)return;const g=d.current;d.current=s.current,g!==d.current&&l(d.current)});const h=o.placementState&&ih(o.placementState),f=h?.[0],B=h?.[1];return s?null:(0,m.jsx)(gt.div,{"data-radix-popper-side":f,"data-radix-popper-align":B,...i,ref:u})},"PopperAnchor")),vw="PopperContent",[F_,H_]=gw(vw),j_=p.forwardRef(os(function(t,n){const{__scopePopper:r,side:s="bottom",sideOffset:i=0,align:o="center",alignOffset:a=0,arrowPadding:l=0,avoidCollisions:c=!0,collisionBoundary:u=[],collisionPadding:d=0,sticky:h="partial",hideWhenDetached:f=!1,updatePositionStrategy:B="optimized",onPlaced:g,...C}=t,v=Cw(vw,r),[y,S]=p.useState(null),E=Ze(n,S),[D,A]=p.useState(null),x=sw(D),O=x?.width??0,R=x?.height??0,P=s+(o!=="center"?"-"+o:""),_=typeof d=="number"?d:{top:0,right:0,bottom:0,left:0,...d},N=Array.isArray(u)?u:[u],W=N.length>0,q={padding:_,boundary:N.filter(yw),altBoundary:W},{refs:F,floatingStyles:z,placement:J,isPositioned:Z,middlewareData:Q}=y_({strategy:"fixed",placement:P,whileElementsMounted:os((...de)=>h_(...de,{animationFrame:B==="always"}),"whileElementsMounted"),elements:{reference:v.anchor},middleware:[S_({mainAxis:i+R,alignmentAxis:a}),c&&E_({mainAxis:!0,crossAxis:!1,limiter:h==="partial"?x_():void 0,...q}),c&&w_({...q}),D_({...q,apply:os(({elements:de,rects:Re,availableWidth:Ee,availableHeight:st})=>{const{width:at,height:Bt}=Re.reference,tt=de.floating.style;tt.setProperty("--radix-popper-available-width",`${Ee}px`),tt.setProperty("--radix-popper-available-height",`${st}px`),tt.setProperty("--radix-popper-anchor-width",`${at}px`),tt.setProperty("--radix-popper-anchor-height",`${Bt}px`)},"apply")}),D&&A_({element:D,padding:l}),z_({arrowWidth:O,arrowHeight:R}),f&&T_({strategy:"referenceHidden",...q,boundary:W?q.boundary:void 0})]}),G=v.setPlacementState;wn(()=>(G(J),()=>{G(void 0)}),[J,G]);const[be,ve]=ih(J),X=Nt(g);wn(()=>{Z&&X?.()},[Z,X]);const Y=Q.arrow?.x,ie=Q.arrow?.y,ne=Q.arrow?.centerOffset!==0,[ee,Be]=p.useState();return wn(()=>{y&&Be(window.getComputedStyle(y).zIndex)},[y]),(0,m.jsx)("div",{ref:F.setFloating,"data-radix-popper-content-wrapper":"",style:{...z,transform:Z?z.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:ee,"--radix-popper-transform-origin":[Q.transformOrigin?.x,Q.transformOrigin?.y].join(" "),...Q.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:(0,m.jsx)(F_,{scope:r,placedSide:be,placedAlign:ve,onArrowChange:A,arrowX:Y,arrowY:ie,shouldHideArrow:ne,children:(0,m.jsx)(gt.div,{"data-side":be,"data-align":ve,...C,ref:E,style:{...C.style,animation:Z?C.style?.animation:"none"}})})})},"PopperContent")),G_="PopperArrow",V_={top:"bottom",right:"left",bottom:"top",left:"right"},U_=p.forwardRef(os(function(t,n){const{__scopePopper:r,...s}=t,i=H_(G_,r),o=V_[i.placedSide];return(0,m.jsx)("span",{ref:i.onArrowChange,style:{position:"absolute",left:i.arrowX,top:i.arrowY,[o]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[i.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[i.placedSide],visibility:i.shouldHideArrow?"hidden":void 0},children:(0,m.jsx)(O_,{...s,ref:n,style:{...s.style,display:"block"}})})},"PopperArrow"));function yw(e){return e!==null}os(yw,"isNotNull");var z_=os(e=>({name:"transformOrigin",options:e,fn(t){const{placement:n,rects:r,middlewareData:s}=t,i=s.arrow?.centerOffset!==0,o=i?0:e.arrowWidth,a=i?0:e.arrowHeight,[l,c]=ih(n),u={start:"0%",center:"50%",end:"100%"}[c],d=(s.arrow?.x??0)+o/2,h=(s.arrow?.y??0)+a/2;let f="",B="";return l==="bottom"?(f=i?u:`${d}px`,B=`${-a}px`):l==="top"?(f=i?u:`${d}px`,B=`${r.floating.height+a}px`):l==="right"?(f=`${-a}px`,B=i?u:`${h}px`):l==="left"&&(f=`${r.floating.width+a}px`,B=i?u:`${h}px`),{data:{x:f,y:B}}}}),"transformOrigin");function ih(e){const[t,n="center"]=e.split("-");return[t,n]}os(ih,"getSideAndAlignFromPlacement");var _g=P_,bw=__,Sw=j_,$_=U_,W_=Object.defineProperty,Fg=(e,t)=>W_(e,"name",{value:t,configurable:!0}),Cf=!1;function Ew(){const[e,t]=p.useState(Cf);return p.useEffect(()=>{Cf||(Cf=!0,t(!0))},[]),e}Fg(Ew,"useIsHydrated");var xw=p[" useSyncExternalStore ".trim().toString()];function ww(){return()=>{}}Fg(ww,"subscribe");function Dw(){return xw(ww,()=>!0,()=>!1)}Fg(Dw,"useIsHydratedModern");var q_=typeof xw=="function"?Dw:Ew,K_=Object.defineProperty,Hi=(e,t)=>K_(e,"name",{value:t,configurable:!0}),vf="rovingFocusGroup.onEntryFocus",J_={bubbles:!1,cancelable:!0},oh="RovingFocusGroup",[KB,Tw,Q_]=wg(oh),[Y_,Aw]=fs(oh,[Q_]),[X_,Z_]=Y_(oh),eF=p.forwardRef(Hi(function(t,n){return(0,m.jsx)(KB.Provider,{scope:t.__scopeRovingFocusGroup,children:(0,m.jsx)(KB.Slot,{scope:t.__scopeRovingFocusGroup,children:(0,m.jsx)(tF,{...t,ref:n})})})},"RovingFocusGroup")),tF=p.forwardRef(Hi(function(t,n){const{__scopeRovingFocusGroup:r,orientation:s,loop:i=!1,dir:o,currentTabStopId:a,defaultCurrentTabStopId:l,onCurrentTabStopIdChange:c,onEntryFocus:u,preventScrollOnEntryFocus:d=!1,...h}=t,f=p.useRef(null),B=Ze(n,f),g=Yd(o),[C,v]=Xl({prop:a,defaultProp:l??null,onChange:c,caller:oh}),[y,S]=p.useState(!1),E=Nt(u),D=Tw(r),A=p.useRef(!1),[x,O]=p.useState(0);return p.useEffect(()=>{const R=f.current;if(R)return R.addEventListener(vf,E),()=>R.removeEventListener(vf,E)},[E]),(0,m.jsx)(X_,{scope:r,orientation:s,dir:g,loop:i,currentTabStopId:C,onItemFocus:p.useCallback(R=>v(R),[v]),onItemShiftTab:p.useCallback(()=>S(!0),[]),onFocusableItemAdd:p.useCallback(()=>O(R=>R+1),[]),onFocusableItemRemove:p.useCallback(()=>O(R=>R-1),[]),children:(0,m.jsx)(gt.div,{tabIndex:y||x===0?-1:0,"data-orientation":s,...h,ref:B,style:{outline:"none",...t.style},onMouseDown:Se(t.onMouseDown,()=>{A.current=!0}),onFocus:Se(t.onFocus,R=>{const P=!A.current;if(R.target===R.currentTarget&&P&&!y){const _=new CustomEvent(vf,J_);if(R.currentTarget.dispatchEvent(_),!_.defaultPrevented){const N=D().filter(W=>W.focusable);Hg([N.find(W=>W.active),N.find(W=>W.id===C),...N].filter(Boolean).map(W=>W.ref.current),d)}}A.current=!1}),onBlur:Se(t.onBlur,()=>S(!1))})})},"RovingFocusGroupImpl")),nF="RovingFocusGroupItem",rF=p.forwardRef(Hi(function(t,n){const{__scopeRovingFocusGroup:r,focusable:s=!0,active:i=!1,tabStopId:o,children:a,...l}=t,c=Ii(),u=o||c,d=Z_(nF,r),h=d.currentTabStopId===u,f=Tw(r),{onFocusableItemAdd:B,onFocusableItemRemove:g,currentTabStopId:C}=d,v=q_();return wn(()=>{if(!(!v||!s))return B(),()=>g()},[v,s,B,g]),p.useEffect(()=>{if(!(v||!s))return B(),()=>g()},[v,s,B,g]),(0,m.jsx)(KB.ItemSlot,{scope:r,id:u,focusable:s,active:i,children:(0,m.jsx)(gt.span,{tabIndex:h?0:-1,"data-orientation":d.orientation,...l,ref:n,onMouseDown:Se(t.onMouseDown,y=>{s?d.onItemFocus(u):y.preventDefault()}),onFocus:Se(t.onFocus,()=>d.onItemFocus(u)),onKeyDown:Se(t.onKeyDown,y=>{if(y.key==="Tab"&&y.shiftKey){d.onItemShiftTab();return}if(y.target!==y.currentTarget)return;const S=kw(y,d.orientation,d.dir);if(S!==void 0){if(y.metaKey||y.ctrlKey||y.altKey||y.shiftKey)return;y.preventDefault();let E=f().filter(D=>D.focusable).map(D=>D.ref.current);if(S==="last")E.reverse();else if(S==="prev"||S==="next"){S==="prev"&&E.reverse();const D=E.indexOf(y.currentTarget);E=d.loop?Rw(E,D+1):E.slice(D+1)}setTimeout(()=>Hg(E))}}),children:typeof a=="function"?a({isCurrentTabStop:h,hasTabStop:C!=null}):a})})},"RovingFocusGroupItem")),sF={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function Iw(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}Hi(Iw,"getDirectionAwareKey");function kw(e,t,n){const r=Iw(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return sF[r]}Hi(kw,"getFocusIntent");function Hg(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}Hi(Hg,"focusFirst");function Rw(e,t){return e.map((n,r)=>e[(t+r)%e.length])}Hi(Rw,"wrapArray");var iF=eF,oF=rF,aF=Object.defineProperty,Ne=(e,t)=>aF(e,"name",{value:t,configurable:!0}),JB=["Enter"," "],lF=["ArrowDown","PageUp","Home"],Ow=["ArrowUp","PageDown","End"],cF=[...lF,...Ow],uF={ltr:[...JB,"ArrowRight"],rtl:[...JB,"ArrowLeft"]},dF={ltr:["ArrowLeft"],rtl:["ArrowRight"]},ah="Menu",[fl,hF,fF]=wg(ah),[ji,Mw]=fs(ah,[fF,sh,Aw]),lh=sh(),Nw=Aw(),[Pw,Xs]=ji(ah),[BF,Zl]=ji(ah),pF=Ne(e=>{const{__scopeMenu:t,open:n=!1,children:r,dir:s,onOpenChange:i,modal:o=!0}=e,a=lh(t),[l,c]=p.useState(null),u=p.useRef(!1),d=Nt(i),h=Yd(s);return p.useEffect(()=>{const f=Ne(()=>{u.current=!0,document.addEventListener("pointerdown",B,{capture:!0,once:!0}),document.addEventListener("pointermove",B,{capture:!0,once:!0})},"handleKeyDown"),B=Ne(()=>u.current=!1,"handlePointer");return document.addEventListener("keydown",f,{capture:!0}),()=>{document.removeEventListener("keydown",f,{capture:!0}),document.removeEventListener("pointerdown",B,{capture:!0}),document.removeEventListener("pointermove",B,{capture:!0})}},[]),p.useEffect(()=>{if(!n)return;const f=Ne(()=>d(!1),"handleBlur");return window.addEventListener("blur",f),()=>window.removeEventListener("blur",f)},[n,d]),(0,m.jsx)(_g,{...a,children:(0,m.jsx)(Pw,{scope:t,open:n,onOpenChange:d,content:l,onContentChange:c,children:(0,m.jsx)(BF,{scope:t,onClose:p.useCallback(()=>d(!1),[d]),isUsingKeyboardRef:u,dir:h,modal:o,children:r})})})},"Menu"),Lw=p.forwardRef(Ne(function(t,n){const{__scopeMenu:r,...s}=t,i=lh(r);return(0,m.jsx)(bw,{...i,...s,ref:n})},"MenuAnchor")),_w="MenuPortal",[mF,Fw]=ji(_w,{forceMount:void 0}),gF=Ne(e=>{const{__scopeMenu:t,forceMount:n,children:r,container:s}=e,i=Xs(_w,t);return(0,m.jsx)(mF,{scope:t,forceMount:n,children:(0,m.jsx)(Hr,{present:n||i.open,children:(0,m.jsx)(Kx,{asChild:!0,container:s,children:r})})})},"MenuPortal"),rr="MenuContent",[CF,jg]=ji(rr),vF=p.forwardRef(Ne(function(t,n){const r=Fw(rr,t.__scopeMenu),{forceMount:s=r.forceMount,...i}=t,o=Xs(rr,t.__scopeMenu),a=Zl(rr,t.__scopeMenu);return(0,m.jsx)(fl.Provider,{scope:t.__scopeMenu,children:(0,m.jsx)(Hr,{present:s||o.open,children:(0,m.jsx)(fl.Slot,{scope:t.__scopeMenu,children:a.modal?(0,m.jsx)(yF,{...i,ref:n}):(0,m.jsx)(bF,{...i,ref:n})})})})},"MenuContent")),yF=p.forwardRef(Ne(function(t,n){const r=Xs(rr,t.__scopeMenu),s=p.useRef(null),i=Ze(n,s);return p.useEffect(()=>{const o=s.current;if(o)return EL(o)},[]),(0,m.jsx)(Gg,{...t,ref:i,trapFocus:r.open,disableOutsidePointerEvents:r.open,disableOutsideScroll:!0,onFocusOutside:Se(t.onFocusOutside,o=>o.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>r.onOpenChange(!1)})},"MenuRootContentModal")),bF=p.forwardRef(Ne(function(t,n){const r=Xs(rr,t.__scopeMenu);return(0,m.jsx)(Gg,{...t,ref:n,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>r.onOpenChange(!1)})},"MenuRootContentNonModal")),SF=Ro("MenuContent.ScrollLock"),Gg=p.forwardRef(Ne(function(t,n){const{__scopeMenu:r,loop:s=!1,trapFocus:i,onOpenAutoFocus:o,onCloseAutoFocus:a,disableOutsidePointerEvents:l,onEntryFocus:c,onEscapeKeyDown:u,onPointerDownOutside:d,onFocusOutside:h,onInteractOutside:f,onDismiss:B,disableOutsideScroll:g,...C}=t,v=Xs(rr,r),y=Zl(rr,r),S=lh(r),E=Nw(r),D=hF(r),[A,x]=p.useState(null),O=p.useRef(null),R=Ze(n,O,v.onContentChange),P=p.useRef(0),_=p.useRef(""),N=p.useRef(0),W=p.useRef(null),q=p.useRef("right"),F=p.useRef(0),z=g?nw:p.Fragment,J=g?{as:SF,allowPinchZoom:!0}:void 0,Z=Ne(G=>{const be=_.current+G,ve=D().filter(ee=>!ee.disabled),X=document.activeElement,Y=ve.find(ee=>ee.ref.current===X)?.textValue,ie=Ww(ve.map(ee=>ee.textValue),be,Y),ne=ve.find(ee=>ee.textValue===ie)?.ref.current;Ne((function ee(Be){_.current=Be,window.clearTimeout(P.current),Be!==""&&(P.current=window.setTimeout(()=>ee(""),1e3))}),"updateSearch")(be),ne&&setTimeout(()=>ne.focus())},"handleTypeaheadSearch");p.useEffect(()=>()=>window.clearTimeout(P.current),[]),kg();const Q=p.useCallback(G=>q.current===W.current?.side&&Kw(G,W.current?.area),[]);return(0,m.jsx)(CF,{scope:r,searchRef:_,onItemEnter:p.useCallback(G=>{Q(G)&&G.preventDefault()},[Q]),onItemLeave:p.useCallback(G=>{Q(G)||(O.current?.focus(),x(null))},[Q]),onTriggerLeave:p.useCallback(G=>{Q(G)&&G.preventDefault()},[Q]),pointerGraceTimerRef:N,onPointerGraceIntentChange:p.useCallback(G=>{W.current=G},[]),children:(0,m.jsx)(z,{...J,children:(0,m.jsx)(MP,{asChild:!0,trapped:i,onMountAutoFocus:Se(o,G=>{G.preventDefault(),O.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:a,children:(0,m.jsx)(Hx,{asChild:!0,disableOutsidePointerEvents:l,onEscapeKeyDown:u,onPointerDownOutside:d,onFocusOutside:h,onInteractOutside:f,onDismiss:B,children:(0,m.jsx)(iF,{asChild:!0,...E,dir:y.dir,orientation:"vertical",loop:s,currentTabStopId:A,onCurrentTabStopIdChange:x,onEntryFocus:Se(c,G=>{y.isUsingKeyboardRef.current||G.preventDefault()}),preventScrollOnEntryFocus:!0,children:(0,m.jsx)(Sw,{role:"menu","aria-orientation":"vertical","data-state":Ug(v.open),"data-radix-menu-content":"",dir:y.dir,...S,...C,ref:R,style:{outline:"none",...C.style},onKeyDown:Se(C.onKeyDown,G=>{const be=G.target.closest("[data-radix-menu-content]")===G.currentTarget,ve=G.ctrlKey||G.altKey||G.metaKey,X=G.key.length===1;be&&(G.key==="Tab"&&G.preventDefault(),!ve&&X&&Z(G.key));const Y=O.current;if(G.target!==Y||!cF.includes(G.key))return;G.preventDefault();const ie=D().filter(ne=>!ne.disabled).map(ne=>ne.ref.current);Ow.includes(G.key)&&ie.reverse(),zw(ie)}),onBlur:Se(t.onBlur,G=>{G.currentTarget.contains(G.target)||(window.clearTimeout(P.current),_.current="")}),onPointerMove:Se(t.onPointerMove,Oo(G=>{const be=G.target,ve=F.current!==G.clientX;if(G.currentTarget.contains(be)&&ve){const X=G.clientX>F.current?"right":"left";q.current=X,F.current=G.clientX}}))})})})})})})},"MenuContentImpl")),EF=p.forwardRef(Ne(function(t,n){const{__scopeMenu:r,...s}=t;return(0,m.jsx)(gt.div,{role:"group",...s,ref:n})},"MenuGroup")),xF=p.forwardRef(Ne(function(t,n){const{__scopeMenu:r,...s}=t;return(0,m.jsx)(gt.div,{...s,ref:n})},"MenuLabel")),QB="MenuItem",m0="menu.itemSelect",Vg=p.forwardRef(Ne(function(t,n){const{disabled:r=!1,onSelect:s,...i}=t,o=p.useRef(null),a=Zl(QB,t.__scopeMenu),l=jg(QB,t.__scopeMenu),c=Ze(n,o),u=p.useRef(!1),d=Ne(()=>{const h=o.current;if(!r&&h){const f=new CustomEvent(m0,{bubbles:!0,cancelable:!0});h.addEventListener(m0,B=>s?.(B),{once:!0}),xg(h,f),f.defaultPrevented?u.current=!1:a.onClose()}},"handleSelect");return(0,m.jsx)(Hw,{...i,ref:c,disabled:r,onClick:Se(t.onClick,d),onPointerDown:h=>{t.onPointerDown?.(h),u.current=!0},onPointerUp:Se(t.onPointerUp,h=>{u.current||h.currentTarget?.click()}),onKeyDown:Se(t.onKeyDown,h=>{r||h.target!==h.currentTarget||l.searchRef.current!==""&&h.key===" "||JB.includes(h.key)&&(h.currentTarget.click(),h.preventDefault())})})},"MenuItem")),Hw=p.forwardRef(Ne(function(t,n){const{__scopeMenu:r,disabled:s=!1,textValue:i,...o}=t,a=jg(QB,r),l=Nw(r),c=p.useRef(null),u=Ze(n,c),[d,h]=p.useState(!1),[f,B]=p.useState("");return p.useEffect(()=>{const g=c.current;g&&B((g.textContent??"").trim())},[o.children]),(0,m.jsx)(fl.ItemSlot,{scope:r,disabled:s,textValue:i??f,children:(0,m.jsx)(oF,{asChild:!0,...l,focusable:!s,children:(0,m.jsx)(gt.div,{role:"menuitem","data-highlighted":d?"":void 0,"aria-disabled":s||void 0,"data-disabled":s?"":void 0,...o,ref:u,onPointerMove:Se(t.onPointerMove,Oo(g=>{s?a.onItemLeave(g):(a.onItemEnter(g),g.defaultPrevented||g.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:Se(t.onPointerLeave,Oo(g=>a.onItemLeave(g))),onFocus:Se(t.onFocus,()=>h(!0)),onBlur:Se(t.onBlur,()=>h(!1))})})})},"MenuItemImpl")),wF=p.forwardRef(Ne(function(t,n){const{checked:r=!1,onCheckedChange:s,...i}=t;return(0,m.jsx)(Gw,{scope:t.__scopeMenu,checked:r,children:(0,m.jsx)(Vg,{role:"menuitemcheckbox","aria-checked":Bl(r)?"mixed":r,...i,ref:n,"data-state":ch(r),onSelect:Se(i.onSelect,()=>s?.(Bl(r)?!0:!r),{checkForDefaultPrevented:!1})})})},"MenuCheckboxItem")),[DF,TF]=ji("MenuRadioGroup",{value:void 0,onValueChange:Ne(()=>{},"onValueChange")}),AF=p.forwardRef(Ne(function(t,n){const{value:r,onValueChange:s,...i}=t,o=Nt(s);return(0,m.jsx)(DF,{scope:t.__scopeMenu,value:r,onValueChange:o,children:(0,m.jsx)(EF,{...i,ref:n})})},"MenuRadioGroup")),IF="MenuRadioItem",kF=p.forwardRef(Ne(function(t,n){const{value:r,...s}=t,i=TF(IF,t.__scopeMenu),o=r===i.value;return(0,m.jsx)(Gw,{scope:t.__scopeMenu,checked:o,children:(0,m.jsx)(Vg,{role:"menuitemradio","aria-checked":o,...s,ref:n,"data-state":ch(o),onSelect:Se(s.onSelect,()=>i.onValueChange?.(r),{checkForDefaultPrevented:!1})})})},"MenuRadioItem")),jw="MenuItemIndicator",[Gw,RF]=ji(jw,{checked:!1}),OF=p.forwardRef(Ne(function(t,n){const{__scopeMenu:r,forceMount:s,...i}=t,o=RF(jw,r);return(0,m.jsx)(Hr,{present:s||Bl(o.checked)||o.checked===!0,children:(0,m.jsx)(gt.span,{...i,ref:n,"data-state":ch(o.checked)})})},"MenuItemIndicator")),MF=p.forwardRef(Ne(function(t,n){const{__scopeMenu:r,...s}=t;return(0,m.jsx)(gt.div,{role:"separator","aria-orientation":"horizontal",...s,ref:n})},"MenuSeparator")),Vw="MenuSub",[NF,Uw]=ji(Vw),PF=Ne(e=>{const{__scopeMenu:t,children:n,open:r=!1,onOpenChange:s}=e,i=Xs(Vw,t),o=lh(t),[a,l]=p.useState(null),[c,u]=p.useState(null),d=Nt(s);return p.useEffect(()=>(i.open===!1&&d(!1),()=>d(!1)),[i.open,d]),(0,m.jsx)(_g,{...o,children:(0,m.jsx)(Pw,{scope:t,open:r,onOpenChange:d,content:c,onContentChange:u,children:(0,m.jsx)(NF,{scope:t,contentId:Ii(),triggerId:Ii(),trigger:a,onTriggerChange:l,children:n})})})},"MenuSub"),Mc="MenuSubTrigger",LF=p.forwardRef(Ne(function(t,n){const r=Xs(Mc,t.__scopeMenu),s=Zl(Mc,t.__scopeMenu),i=Uw(Mc,t.__scopeMenu),o=jg(Mc,t.__scopeMenu),a=p.useRef(null),{pointerGraceTimerRef:l,onPointerGraceIntentChange:c}=o,u={__scopeMenu:t.__scopeMenu},d=p.useCallback(()=>{a.current&&window.clearTimeout(a.current),a.current=null},[]);p.useEffect(()=>d,[d]),p.useEffect(()=>{const f=l.current;return()=>{window.clearTimeout(f),c(null)}},[l,c]);const h=Ze(n,i.onTriggerChange);return(0,m.jsx)(Lw,{asChild:!0,...u,children:(0,m.jsx)(Hw,{id:i.triggerId,"aria-haspopup":"menu","aria-expanded":r.open,"aria-controls":r.open?i.contentId:void 0,"data-state":Ug(r.open),...t,ref:h,onClick:f=>{t.onClick?.(f),!(t.disabled||f.defaultPrevented)&&(f.currentTarget.focus(),r.open||r.onOpenChange(!0))},onPointerMove:Se(t.onPointerMove,Oo(f=>{o.onItemEnter(f),!f.defaultPrevented&&!t.disabled&&!r.open&&!a.current&&(o.onPointerGraceIntentChange(null),a.current=window.setTimeout(()=>{r.onOpenChange(!0),d()},100))})),onPointerLeave:Se(t.onPointerLeave,Oo(f=>{d();const B=r.content?.getBoundingClientRect();if(B){const g=r.content?.dataset.side,C=g==="right",v=C?-5:5,y=B[C?"left":"right"],S=B[C?"right":"left"];o.onPointerGraceIntentChange({area:[{x:f.clientX+v,y:f.clientY},{x:y,y:B.top},{x:S,y:B.top},{x:S,y:B.bottom},{x:y,y:B.bottom}],side:g}),window.clearTimeout(l.current),l.current=window.setTimeout(()=>o.onPointerGraceIntentChange(null),300)}else{if(o.onTriggerLeave(f),f.defaultPrevented)return;o.onPointerGraceIntentChange(null)}})),onKeyDown:Se(t.onKeyDown,f=>{t.disabled||f.target!==f.currentTarget||o.searchRef.current!==""&&f.key===" "||uF[s.dir].includes(f.key)&&(r.onOpenChange(!0),r.content?.focus(),f.preventDefault())})})})},"MenuSubTrigger")),_F="MenuSubContent",FF=p.forwardRef(Ne(function(t,n){const r=Fw(rr,t.__scopeMenu),{forceMount:s=r.forceMount,align:i="start",...o}=t,a=Xs(rr,t.__scopeMenu),l=Zl(rr,t.__scopeMenu),c=Uw(_F,t.__scopeMenu),u=p.useRef(null),d=Ze(n,u);return(0,m.jsx)(fl.Provider,{scope:t.__scopeMenu,children:(0,m.jsx)(Hr,{present:s||a.open,children:(0,m.jsx)(fl.Slot,{scope:t.__scopeMenu,children:(0,m.jsx)(Gg,{id:c.contentId,"aria-labelledby":c.triggerId,...o,ref:d,align:i,side:l.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:h=>{l.isUsingKeyboardRef.current&&u.current?.focus(),h.preventDefault()},onCloseAutoFocus:h=>h.preventDefault(),onFocusOutside:Se(t.onFocusOutside,h=>{h.target!==c.trigger&&a.onOpenChange(!1)}),onEscapeKeyDown:Se(t.onEscapeKeyDown,h=>{l.onClose(),h.preventDefault()}),onKeyDown:Se(t.onKeyDown,h=>{const f=h.currentTarget.contains(h.target),B=dF[l.dir].includes(h.key);f&&B&&(a.onOpenChange(!1),c.trigger?.focus(),h.preventDefault())})})})})})},"MenuSubContent"));function Ug(e){return e?"open":"closed"}Ne(Ug,"getOpenState");function Bl(e){return e==="indeterminate"}Ne(Bl,"isIndeterminate");function ch(e){return Bl(e)?"indeterminate":e?"checked":"unchecked"}Ne(ch,"getCheckedState");function zw(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}Ne(zw,"focusFirst");function $w(e,t){return e.map((n,r)=>e[(t+r)%e.length])}Ne($w,"wrapArray");function Ww(e,t,n){const r=t.length>1&&Array.from(t).every(a=>a===t[0])?t[0]:t,s=n?e.indexOf(n):-1;let i=$w(e,Math.max(s,0));r.length===1&&(i=i.filter(a=>a!==n));const o=i.find(a=>a.toLowerCase().startsWith(r.toLowerCase()));return o!==n?o:void 0}Ne(Ww,"getNextMatch");function qw(e,t){const{x:n,y:r}=e;let s=!1;for(let i=0,o=t.length-1;i<t.length;o=i++){const a=t[i],l=t[o],c=a.x,u=a.y,d=l.x,h=l.y;u>r!=h>r&&n<(d-c)*(r-u)/(h-u)+c&&(s=!s)}return s}Ne(qw,"isPointInPolygon");function Kw(e,t){return t?qw({x:e.clientX,y:e.clientY},t):!1}Ne(Kw,"isPointerInGraceArea");function Oo(e){return t=>t.pointerType==="mouse"?e(t):void 0}Ne(Oo,"whenMouse");var HF=pF,jF=Lw,GF=gF,VF=vF,UF=xF,zF=Vg,$F=wF,WF=AF,qF=kF,KF=OF,JF=MF,QF=PF,YF=LF,XF=FF,ZF=Object.defineProperty,hn=(e,t)=>ZF(e,"name",{value:t,configurable:!0}),zg="DropdownMenu",[e2,Ere]=fs(zg,[Mw]),fn=Mw(),[t2,Jw]=e2(zg),n2=hn(e=>{const{__scopeDropdownMenu:t,children:n,dir:r,open:s,defaultOpen:i,onOpenChange:o,modal:a=!0}=e,l=fn(t),c=p.useRef(null),[u,d]=Xl({prop:s,defaultProp:i??!1,onChange:o,caller:zg});return(0,m.jsx)(t2,{scope:t,triggerId:Ii(),triggerRef:c,contentId:Ii(),open:u,onOpenChange:d,onOpenToggle:p.useCallback(()=>d(h=>!h),[d]),modal:a,children:(0,m.jsx)(HF,{...l,open:u,onOpenChange:d,dir:r,modal:a,children:n})})},"DropdownMenu"),r2="DropdownMenuTrigger",s2=p.forwardRef(hn(function(t,n){const{__scopeDropdownMenu:r,disabled:s=!1,...i}=t,o=Jw(r2,r),a=fn(r),l=Ze(n,o.triggerRef);return(0,m.jsx)(jF,{asChild:!0,...a,children:(0,m.jsx)(gt.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":s?"":void 0,disabled:s,...i,ref:l,onPointerDown:Se(t.onPointerDown,c=>{!s&&c.button===0&&c.ctrlKey===!1&&(o.onOpenToggle(),o.open||c.preventDefault())}),onKeyDown:Se(t.onKeyDown,c=>{s||(["Enter"," "].includes(c.key)&&o.onOpenToggle(),c.key==="ArrowDown"&&o.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(c.key)&&c.preventDefault())})})})},"DropdownMenuTrigger")),i2=hn(e=>{const{__scopeDropdownMenu:t,...n}=e,r=fn(t);return(0,m.jsx)(GF,{...r,...n})},"DropdownMenuPortal"),o2="DropdownMenuContent",a2=p.forwardRef(hn(function(t,n){const{__scopeDropdownMenu:r,...s}=t,i=Jw(o2,r),o=fn(r),a=p.useRef(!1);return(0,m.jsx)(VF,{id:i.contentId,"aria-labelledby":i.triggerId,...o,...s,ref:n,onCloseAutoFocus:Se(t.onCloseAutoFocus,l=>{a.current||i.triggerRef.current?.focus(),a.current=!1,l.preventDefault()}),onInteractOutside:Se(t.onInteractOutside,l=>{const c=l.detail.originalEvent,u=c.button===0&&c.ctrlKey===!0,d=c.button===2||u;(!i.modal||d)&&(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")),l2=p.forwardRef(hn(function(t,n){const{__scopeDropdownMenu:r,...s}=t,i=fn(r);return(0,m.jsx)(UF,{...i,...s,ref:n})},"DropdownMenuLabel")),c2=p.forwardRef(hn(function(t,n){const{__scopeDropdownMenu:r,...s}=t,i=fn(r);return(0,m.jsx)(zF,{...i,...s,ref:n})},"DropdownMenuItem")),u2=p.forwardRef(hn(function(t,n){const{__scopeDropdownMenu:r,...s}=t,i=fn(r);return(0,m.jsx)($F,{...i,...s,ref:n})},"DropdownMenuCheckboxItem")),d2=p.forwardRef(hn(function(t,n){const{__scopeDropdownMenu:r,...s}=t,i=fn(r);return(0,m.jsx)(WF,{...i,...s,ref:n})},"DropdownMenuRadioGroup")),h2=p.forwardRef(hn(function(t,n){const{__scopeDropdownMenu:r,...s}=t,i=fn(r);return(0,m.jsx)(qF,{...i,...s,ref:n})},"DropdownMenuRadioItem")),f2=p.forwardRef(hn(function(t,n){const{__scopeDropdownMenu:r,...s}=t,i=fn(r);return(0,m.jsx)(KF,{...i,...s,ref:n})},"DropdownMenuItemIndicator")),B2=p.forwardRef(hn(function(t,n){const{__scopeDropdownMenu:r,...s}=t,i=fn(r);return(0,m.jsx)(JF,{...i,...s,ref:n})},"DropdownMenuSeparator")),p2=hn(e=>{const{__scopeDropdownMenu:t,children:n,open:r,onOpenChange:s,defaultOpen:i}=e,o=fn(t),[a,l]=Xl({prop:r,defaultProp:i??!1,onChange:s,caller:"DropdownMenuSub"});return(0,m.jsx)(QF,{...o,open:a,onOpenChange:l,children:n})},"DropdownMenuSub"),m2=p.forwardRef(hn(function(t,n){const{__scopeDropdownMenu:r,...s}=t,i=fn(r);return(0,m.jsx)(YF,{...i,...s,ref:n})},"DropdownMenuSubTrigger")),g2=p.forwardRef(hn(function(t,n){const{__scopeDropdownMenu:r,...s}=t,i=fn(r);return(0,m.jsx)(XF,{...i,...s,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")),C2=n2,v2=s2,y2=i2,b2=a2,S2=l2,E2=c2,x2=u2,w2=d2,D2=h2,Qw=f2,T2=B2,A2=p2,I2=m2,k2=g2,R2=Object.defineProperty,O2=(e,t)=>R2(e,"name",{value:t,configurable:!0});function Yw(e,[t,n]){return Math.min(n,Math.max(t,e))}O2(Yw,"clamp");var M2=Object.defineProperty,Oe=(e,t)=>M2(e,"name",{value:t,configurable:!0});function Xw(e,t){return p.useReducer((n,r)=>t[n][r]??n,e)}Oe(Xw,"useStateMachine");var Zw="ScrollArea",[eD,xre]=fs(Zw),[N2,Gn]=eD(Zw),P2=p.forwardRef(Oe(function(t,n){const{__scopeScrollArea:r,type:s="hover",dir:i,scrollHideDelay:o=600,...a}=t,[l,c]=p.useState(null),[u,d]=p.useState(null),[h,f]=p.useState(null),[B,g]=p.useState(null),[C,v]=p.useState(null),[y,S]=p.useState(0),[E,D]=p.useState(0),[A,x]=p.useState(!1),[O,R]=p.useState(!1),P=Ze(n,c),_=Yd(i);return(0,m.jsx)(N2,{scope:r,type:s,dir:_,scrollHideDelay:o,scrollArea:l,viewport:u,onViewportChange:d,content:h,onContentChange:f,scrollbarX:B,onScrollbarXChange:g,scrollbarXEnabled:A,onScrollbarXEnabledChange:x,scrollbarY:C,onScrollbarYChange:v,scrollbarYEnabled:O,onScrollbarYEnabledChange:R,onCornerWidthChange:S,onCornerHeightChange:D,children:(0,m.jsx)(gt.div,{dir:_,...a,ref:P,style:{position:"relative","--radix-scroll-area-corner-width":y+"px","--radix-scroll-area-corner-height":E+"px",...t.style}})})},"ScrollArea")),L2="ScrollAreaViewport",_2=p.forwardRef(Oe(function(t,n){const{__scopeScrollArea:r,children:s,nonce:i,...o}=t,a=Gn(L2,r),l=p.useRef(null),c=Ze(n,l,a.onViewportChange);return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(F2,{nonce:i}),(0,m.jsx)(gt.div,{"data-radix-scroll-area-viewport":"",...o,ref:c,style:{overflowX:a.scrollbarXEnabled?"scroll":"hidden",overflowY:a.scrollbarYEnabled?"scroll":"hidden",...t.style},children:(0,m.jsx)("div",{ref:a.onContentChange,style:{minWidth:"100%",display:"table"},children:s})})]})},"ScrollAreaViewport")),F2=p.memo(Oe(function({nonce:t}){return(0,m.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),ps="ScrollAreaScrollbar",H2=p.forwardRef(Oe(function(t,n){const{forceMount:r,...s}=t,i=Gn(ps,t.__scopeScrollArea),{onScrollbarXEnabledChange:o,onScrollbarYEnabledChange:a}=i,l=t.orientation==="horizontal";return p.useEffect(()=>(l?o(!0):a(!0),()=>{l?o(!1):a(!1)}),[l,o,a]),i.type==="hover"?(0,m.jsx)(j2,{...s,ref:n,forceMount:r}):i.type==="scroll"?(0,m.jsx)(G2,{...s,ref:n,forceMount:r}):i.type==="auto"?(0,m.jsx)(tD,{...s,ref:n,forceMount:r}):i.type==="always"?(0,m.jsx)($g,{...s,ref:n,"data-state":"visible"}):null},"ScrollAreaScrollbar")),j2=p.forwardRef(Oe(function(t,n){const{forceMount:r,...s}=t,i=Gn(ps,t.__scopeScrollArea),[o,a]=p.useState(!1);return p.useEffect(()=>{const l=i.scrollArea;let c=0;if(l){const u=Oe(()=>{window.clearTimeout(c),a(!0)},"handlePointerEnter"),d=Oe(()=>{c=window.setTimeout(()=>a(!1),i.scrollHideDelay)},"handlePointerLeave");return l.addEventListener("pointerenter",u),l.addEventListener("pointerleave",d),()=>{window.clearTimeout(c),l.removeEventListener("pointerenter",u),l.removeEventListener("pointerleave",d)}}},[i.scrollArea,i.scrollHideDelay]),(0,m.jsx)(Hr,{present:r||o,children:(0,m.jsx)(tD,{"data-state":o?"visible":"hidden",...s,ref:n})})},"ScrollAreaScrollbarHover")),G2=p.forwardRef(Oe(function(t,n){const{forceMount:r,...s}=t,i=Gn(ps,t.__scopeScrollArea),o=t.orientation==="horizontal",a=tc(()=>c("SCROLL_END"),100),[l,c]=Xw("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 p.useEffect(()=>{if(l==="idle"){const u=window.setTimeout(()=>c("HIDE"),i.scrollHideDelay);return()=>window.clearTimeout(u)}},[l,i.scrollHideDelay,c]),p.useEffect(()=>{const u=i.viewport,d=o?"scrollLeft":"scrollTop";if(u){let h=u[d];const f=Oe(()=>{const B=u[d];h!==B&&(c("SCROLL"),a()),h=B},"handleScroll");return u.addEventListener("scroll",f),()=>u.removeEventListener("scroll",f)}},[i.viewport,o,c,a]),(0,m.jsx)(Hr,{present:r||l!=="hidden",children:(0,m.jsx)($g,{"data-state":l==="hidden"?"hidden":"visible",...s,ref:n,onPointerEnter:Se(t.onPointerEnter,()=>c("POINTER_ENTER")),onPointerLeave:Se(t.onPointerLeave,()=>c("POINTER_LEAVE"))})})},"ScrollAreaScrollbarScroll")),tD=p.forwardRef(Oe(function(t,n){const r=Gn(ps,t.__scopeScrollArea),{forceMount:s,...i}=t,[o,a]=p.useState(!1),l=t.orientation==="horizontal",c=tc(()=>{if(r.viewport){const u=r.viewport.offsetWidth<r.viewport.scrollWidth,d=r.viewport.offsetHeight<r.viewport.scrollHeight;a(l?u:d)}},10);return Oi(r.viewport,c),Oi(r.content,c),(0,m.jsx)(Hr,{present:s||o,children:(0,m.jsx)($g,{"data-state":o?"visible":"hidden",...i,ref:n})})},"ScrollAreaScrollbarAuto")),$g=p.forwardRef(Oe(function(t,n){const{orientation:r="vertical",...s}=t,i=Gn(ps,t.__scopeScrollArea),o=p.useRef(null),a=p.useRef(0),[l,c]=p.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),u=Wg(l.viewport,l.content),d={...s,sizes:l,onSizesChange:c,hasThumb:u>0&&u<1,onThumbChange:Oe(f=>o.current=f,"onThumbChange"),onThumbPointerUp:Oe(()=>a.current=0,"onThumbPointerUp"),onThumbPointerDown:Oe(f=>a.current=f,"onThumbPointerDown")};function h(f,B){return iD(f,a.current,l,B)}return Oe(h,"getScrollPosition"),r==="horizontal"?(0,m.jsx)(V2,{...d,ref:n,onThumbPositionChange:()=>{if(i.viewport&&o.current){const f=i.viewport.scrollLeft,B=XB(f,l,i.dir);o.current.style.transform=`translate3d(${B}px, 0, 0)`}},onWheelScroll:f=>{i.viewport&&(i.viewport.scrollLeft=f)},onDragScroll:f=>{i.viewport&&(i.viewport.scrollLeft=h(f,i.dir))}}):r==="vertical"?(0,m.jsx)(U2,{...d,ref:n,onThumbPositionChange:()=>{if(i.viewport&&o.current){const f=i.viewport.scrollTop,B=XB(f,l);o.current.style.transform=`translate3d(0, ${B}px, 0)`}},onWheelScroll:f=>{i.viewport&&(i.viewport.scrollTop=f)},onDragScroll:f=>{i.viewport&&(i.viewport.scrollTop=h(f))}}):null},"ScrollAreaScrollbarVisible")),V2=p.forwardRef(Oe(function(t,n){const{sizes:r,onSizesChange:s,...i}=t,o=Gn(ps,t.__scopeScrollArea),[a,l]=p.useState(),c=p.useRef(null),u=Ze(n,c,o.onScrollbarXChange);return p.useEffect(()=>{c.current&&l(getComputedStyle(c.current))},[c]),(0,m.jsx)(rD,{"data-orientation":"horizontal",...i,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":ec(r)+"px",...t.style},onThumbPointerDown:d=>t.onThumbPointerDown(d.x),onDragScroll:d=>t.onDragScroll(d.x),onWheelScroll:(d,h)=>{if(o.viewport){const f=o.viewport.scrollLeft+d.deltaX;t.onWheelScroll(f),Kg(f,h)&&d.preventDefault()}},onResize:()=>{c.current&&o.viewport&&a&&s({content:o.viewport.scrollWidth,viewport:o.viewport.offsetWidth,scrollbar:{size:c.current.clientWidth,paddingStart:pl(a.paddingLeft),paddingEnd:pl(a.paddingRight)}})}})},"ScrollAreaScrollbarX")),U2=p.forwardRef(Oe(function(t,n){const{sizes:r,onSizesChange:s,...i}=t,o=Gn(ps,t.__scopeScrollArea),[a,l]=p.useState(),c=p.useRef(null),u=Ze(n,c,o.onScrollbarYChange);return p.useEffect(()=>{c.current&&l(getComputedStyle(c.current))},[c]),(0,m.jsx)(rD,{"data-orientation":"vertical",...i,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":ec(r)+"px",...t.style},onThumbPointerDown:d=>t.onThumbPointerDown(d.y),onDragScroll:d=>t.onDragScroll(d.y),onWheelScroll:(d,h)=>{if(o.viewport){const f=o.viewport.scrollTop+d.deltaY;t.onWheelScroll(f),Kg(f,h)&&d.preventDefault()}},onResize:()=>{c.current&&o.viewport&&a&&s({content:o.viewport.scrollHeight,viewport:o.viewport.offsetHeight,scrollbar:{size:c.current.clientHeight,paddingStart:pl(a.paddingTop),paddingEnd:pl(a.paddingBottom)}})}})},"ScrollAreaScrollbarY")),[z2,nD]=eD(ps),rD=p.forwardRef(Oe(function(t,n){const{__scopeScrollArea:r,sizes:s,hasThumb:i,onThumbChange:o,onThumbPointerUp:a,onThumbPointerDown:l,onThumbPositionChange:c,onDragScroll:u,onWheelScroll:d,onResize:h,...f}=t,B=Gn(ps,r),[g,C]=p.useState(null),v=Ze(n,C),y=p.useRef(null),S=p.useRef(""),E=B.viewport,D=s.content-s.viewport,A=Nt(d),x=Nt(c),O=tc(h,10);function R(P){if(y.current){const _=P.clientX-y.current.left,N=P.clientY-y.current.top;u({x:_,y:N})}}return Oe(R,"handleDragScroll"),p.useEffect(()=>{const P=Oe(_=>{const N=_.target;g?.contains(N)&&A(_,D)},"handleWheel");return document.addEventListener("wheel",P,{passive:!1}),()=>document.removeEventListener("wheel",P,{passive:!1})},[E,g,D,A]),p.useEffect(x,[s,x]),Oi(g,O),Oi(B.content,O),(0,m.jsx)(z2,{scope:r,scrollbar:g,hasThumb:i,onThumbChange:Nt(o),onThumbPointerUp:Nt(a),onThumbPositionChange:x,onThumbPointerDown:Nt(l),children:(0,m.jsx)(gt.div,{...f,ref:v,style:{position:"absolute",...f.style},onPointerDown:Se(t.onPointerDown,P=>{P.button===0&&(P.target.setPointerCapture(P.pointerId),y.current=g.getBoundingClientRect(),S.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",B.viewport&&(B.viewport.style.scrollBehavior="auto"),R(P))}),onPointerMove:Se(t.onPointerMove,R),onPointerUp:Se(t.onPointerUp,P=>{const _=P.target;_.hasPointerCapture(P.pointerId)&&_.releasePointerCapture(P.pointerId),document.body.style.webkitUserSelect=S.current,B.viewport&&(B.viewport.style.scrollBehavior=""),y.current=null})})})},"ScrollAreaScrollbarImpl")),YB="ScrollAreaThumb",$2=p.forwardRef(Oe(function(t,n){const{forceMount:r,...s}=t,i=nD(YB,t.__scopeScrollArea);return(0,m.jsx)(Hr,{present:r||i.hasThumb,children:(0,m.jsx)(W2,{ref:n,...s})})},"ScrollAreaThumb")),W2=p.forwardRef(Oe(function(t,n){const{__scopeScrollArea:r,style:s,...i}=t,o=Gn(YB,r),a=nD(YB,r),{onThumbPositionChange:l}=a,c=Ze(n,a.onThumbChange),u=p.useRef(void 0),d=tc(()=>{u.current&&(u.current(),u.current=void 0)},100);return p.useEffect(()=>{const h=o.viewport;if(h){const f=Oe(()=>{if(d(),!u.current){const B=J2(h,l);u.current=B,l()}},"handleScroll");return l(),h.addEventListener("scroll",f),()=>h.removeEventListener("scroll",f)}},[o.viewport,d,l]),(0,m.jsx)(gt.div,{"data-state":a.hasThumb?"visible":"hidden",...i,ref:c,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...s},onPointerDownCapture:Se(t.onPointerDownCapture,h=>{const f=h.target.getBoundingClientRect(),B=h.clientX-f.left,g=h.clientY-f.top;a.onThumbPointerDown({x:B,y:g})}),onPointerUp:Se(t.onPointerUp,a.onThumbPointerUp)})},"ScrollAreaThumbImpl")),sD="ScrollAreaCorner",q2=p.forwardRef(Oe(function(t,n){const r=Gn(sD,t.__scopeScrollArea),s=!!(r.scrollbarX&&r.scrollbarY);return r.type!=="scroll"&&s?(0,m.jsx)(K2,{...t,ref:n}):null},"ScrollAreaCorner")),K2=p.forwardRef(Oe(function(t,n){const{__scopeScrollArea:r,...s}=t,i=Gn(sD,r),[o,a]=p.useState(0),[l,c]=p.useState(0),u=!!(o&&l),{onCornerWidthChange:d,onCornerHeightChange:h}=i;return Oi(i.scrollbarX,()=>{const f=i.scrollbarX?.offsetHeight||0;i.onCornerHeightChange(f),c(f)}),Oi(i.scrollbarY,()=>{const f=i.scrollbarY?.offsetWidth||0;i.onCornerWidthChange(f),a(f)}),p.useEffect(()=>()=>{d(0),h(0)},[d,h]),u?(0,m.jsx)(gt.div,{...s,ref:n,style:{width:o,height:l,position:"absolute",right:i.dir==="ltr"?0:void 0,left:i.dir==="rtl"?0:void 0,bottom:0,...t.style}}):null},"ScrollAreaCornerImpl"));function pl(e){return e?parseInt(e,10):0}Oe(pl,"toInt");function Wg(e,t){const n=e/t;return isNaN(n)?0:n}Oe(Wg,"getThumbRatio");function ec(e){const t=Wg(e.viewport,e.content),n=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,r=(e.scrollbar.size-n)*t;return Math.max(r,18)}Oe(ec,"getThumbSize");function iD(e,t,n,r="ltr"){const s=ec(n),i=s/2,o=t||i,a=s-o,l=n.scrollbar.paddingStart+o,c=n.scrollbar.size-n.scrollbar.paddingEnd-a,u=n.content-n.viewport,d=r==="ltr"?[0,u]:[u*-1,0];return qg([l,c],d)(e)}Oe(iD,"getScrollPositionFromPointer");function XB(e,t,n="ltr"){const r=ec(t),s=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,i=t.scrollbar.size-s,o=t.content-t.viewport,a=i-r,l=n==="ltr"?[0,o]:[o*-1,0],c=Yw(e,l);return qg([0,o],[0,a])(c)}Oe(XB,"getThumbOffsetFromScroll");function qg(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])}}Oe(qg,"linearScale");function Kg(e,t){return e>0&&e<t}Oe(Kg,"isScrollingWithinScrollbarBounds");var J2=Oe((e,t=()=>{})=>{let n={left:e.scrollLeft,top:e.scrollTop},r=0;return Oe((function s(){const i={left:e.scrollLeft,top:e.scrollTop},o=n.left!==i.left,a=n.top!==i.top;(o||a)&&t(),n=i,r=window.requestAnimationFrame(s)}),"loop")(),()=>window.cancelAnimationFrame(r)},"addUnlinkedScrollListener");function tc(e,t){const n=Nt(e),r=p.useRef(0);return p.useEffect(()=>()=>window.clearTimeout(r.current),[]),p.useCallback(()=>{window.clearTimeout(r.current),r.current=window.setTimeout(n,t)},[n,t])}Oe(tc,"useDebounceCallback");function Oi(e,t){const n=Nt(t);wn(()=>{let r=0;if(e){const s=new ResizeObserver(()=>{cancelAnimationFrame(r),r=window.requestAnimationFrame(n)});return s.observe(e),()=>{window.cancelAnimationFrame(r),s.unobserve(e)}}},[e,n])}Oe(Oi,"useResizeObserver");var Q2=P2,Y2=_2,X2=q2,Z2=Object.defineProperty,Dt=(e,t)=>Z2(e,"name",{value:t,configurable:!0}),[Jg,wre]=fs("Tooltip",[sh]),uh=sh(),eH="TooltipProvider",tH=700,ZB="tooltip.open",[nH,Qg]=Jg(eH),rH=Dt(e=>{const{__scopeTooltip:t,delayDuration:n=tH,skipDelayDuration:r=300,disableHoverableContent:s=!1,children:i}=e,o=p.useRef(!0),a=p.useRef(!1),l=p.useRef(0);return p.useEffect(()=>{const c=l.current;return()=>window.clearTimeout(c)},[]),(0,m.jsx)(nH,{scope:t,isOpenDelayedRef:o,delayDuration:n,onOpen:p.useCallback(()=>{r<=0||(window.clearTimeout(l.current),o.current=!1)},[r]),onClose:p.useCallback(()=>{r<=0||(window.clearTimeout(l.current),l.current=window.setTimeout(()=>o.current=!0,r))},[r]),isPointerInTransitRef:a,onPointerInTransitChange:p.useCallback(c=>{a.current=c},[]),disableHoverableContent:s,children:i})},"TooltipProvider"),ep="Tooltip",[sH,nc]=Jg(ep),iH=Dt(e=>{const{__scopeTooltip:t,children:n,open:r,defaultOpen:s,onOpenChange:i,disableHoverableContent:o,delayDuration:a}=e,l=Qg(ep,e.__scopeTooltip),c=uh(t),[u,d]=p.useState(null),[h,f]=p.useState(void 0),B=Ii(),g=p.useRef(0),C=o??l.disableHoverableContent,v=a??l.delayDuration,y=p.useRef(!1),[S,E]=Xl({prop:r,defaultProp:s??!1,onChange:Dt(P=>{P?(l.onOpen(),document.dispatchEvent(new CustomEvent(ZB))):l.onClose(),i?.(P)},"onChange"),caller:ep}),D=p.useMemo(()=>S?y.current?"delayed-open":"instant-open":"closed",[S]),A=p.useCallback(()=>{window.clearTimeout(g.current),g.current=0,y.current=!1,E(!0)},[E]),x=p.useCallback(()=>{window.clearTimeout(g.current),g.current=0,E(!1)},[E]),O=p.useCallback(()=>{window.clearTimeout(g.current),g.current=window.setTimeout(()=>{y.current=!0,E(!0),g.current=0},v)},[v,E]);p.useEffect(()=>()=>{g.current&&(window.clearTimeout(g.current),g.current=0)},[]);const R=h??B;return(0,m.jsx)(_g,{...c,children:(0,m.jsx)(sH,{scope:t,contentId:R,setContentId:f,open:S,stateAttribute:D,trigger:u,onTriggerChange:d,onTriggerEnter:p.useCallback(()=>{l.isOpenDelayedRef.current?O():A()},[l.isOpenDelayedRef,O,A]),onTriggerLeave:p.useCallback(()=>{C?x():(window.clearTimeout(g.current),g.current=0)},[x,C]),onOpen:A,onClose:x,disableHoverableContent:C,children:n})})},"Tooltip"),g0="TooltipTrigger",oH=p.forwardRef(Dt(function(t,n){const{__scopeTooltip:r,...s}=t,i=nc(g0,r),o=Qg(g0,r),a=uh(r),l=p.useRef(null),c=Ze(n,l,i.onTriggerChange),u=p.useRef(!1),d=p.useRef(!1),h=p.useCallback(()=>u.current=!1,[]);return p.useEffect(()=>()=>document.removeEventListener("pointerup",h),[h]),(0,m.jsx)(bw,{asChild:!0,...a,children:(0,m.jsx)(gt.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...s,ref:c,onPointerMove:Se(t.onPointerMove,f=>{f.pointerType!=="touch"&&!d.current&&!o.isPointerInTransitRef.current&&(i.onTriggerEnter(),d.current=!0)}),onPointerLeave:Se(t.onPointerLeave,()=>{i.onTriggerLeave(),d.current=!1}),onPointerDown:Se(t.onPointerDown,()=>{i.open&&i.onClose(),u.current=!0,document.addEventListener("pointerup",h,{once:!0})}),onFocus:Se(t.onFocus,()=>{u.current||i.onOpen()}),onBlur:Se(t.onBlur,i.onClose),onClick:Se(t.onClick,i.onClose)})})},"TooltipTrigger")),oD="TooltipPortal",[aH,lH]=Jg(oD,{forceMount:void 0}),cH=Dt(e=>{const{__scopeTooltip:t,forceMount:n,children:r,container:s}=e,i=nc(oD,t);return(0,m.jsx)(aH,{scope:t,forceMount:n,children:(0,m.jsx)(Hr,{present:n||i.open,children:(0,m.jsx)(Kx,{asChild:!0,container:s,children:r})})})},"TooltipPortal"),ml="TooltipContent",uH=p.forwardRef(Dt(function(t,n){const r=lH(ml,t.__scopeTooltip),{forceMount:s=r.forceMount,side:i="top",...o}=t,a=nc(ml,t.__scopeTooltip);return(0,m.jsx)(Hr,{present:s||a.open,children:a.disableHoverableContent?(0,m.jsx)(aD,{side:i,...o,ref:n}):(0,m.jsx)(dH,{side:i,...o,ref:n})})},"TooltipContent")),dH=p.forwardRef(Dt(function(t,n){const r=nc(ml,t.__scopeTooltip),s=Qg(ml,t.__scopeTooltip),i=p.useRef(null),o=Ze(n,i),[a,l]=p.useState(null),{trigger:c,onClose:u}=r,d=i.current,{onPointerInTransitChange:h}=s,f=p.useCallback(()=>{l(null),h(!1)},[h]),B=p.useCallback((g,C)=>{const v=g.currentTarget,y={x:g.clientX,y:g.clientY},S=cD(y,lD(y,v.getBoundingClientRect())),E=uD(C.getBoundingClientRect()),D=hD([...S,...E]);l(D),h(!0)},[h]);return p.useEffect(()=>()=>f(),[f]),p.useEffect(()=>{if(c&&d){const g=Dt(v=>B(v,d),"handleTriggerLeave"),C=Dt(v=>B(v,c),"handleContentLeave");return c.addEventListener("pointerleave",g),d.addEventListener("pointerleave",C),()=>{c.removeEventListener("pointerleave",g),d.removeEventListener("pointerleave",C)}}},[c,d,B,f]),p.useEffect(()=>{if(a){const g=Dt(C=>{const v=C.target,y={x:C.clientX,y:C.clientY},S=c?.contains(v)||d?.contains(v),E=!dD(y,a);S?f():E&&(f(),u())},"handleTrackPointerGrace");return document.addEventListener("pointermove",g),()=>document.removeEventListener("pointermove",g)}},[c,d,a,u,f]),(0,m.jsx)(aD,{...t,ref:o})},"TooltipContentHoverable")),hH=GN("TooltipContent"),aD=p.forwardRef(Dt(function(t,n){const{__scopeTooltip:r,children:s,"aria-label":i,id:o,onEscapeKeyDown:a,onPointerDownOutside:l,...c}=t,u=nc(ml,r),d=uh(r),{onClose:h}=u;p.useEffect(()=>(document.addEventListener(ZB,h),()=>document.removeEventListener(ZB,h)),[h]),p.useEffect(()=>{if(u.trigger){const B=Dt(g=>{g.target instanceof Node&&g.target.contains(u.trigger)&&h()},"handleScroll");return window.addEventListener("scroll",B,{capture:!0}),()=>window.removeEventListener("scroll",B,{capture:!0})}},[u.trigger,h]);const{setContentId:f}=u;return wn(()=>(f(o),()=>{f(void 0)}),[o,f]),(0,m.jsx)(Hx,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:a,onPointerDownOutside:l,onFocusOutside:B=>B.preventDefault(),onDismiss:h,children:(0,m.jsxs)(Sw,{"data-state":u.stateAttribute,role:i?void 0:"tooltip",id:i?void 0:u.contentId,...d,...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,m.jsx)(hH,{children:s}),i?(0,m.jsx)(iP,{id:u.contentId,role:"tooltip",children:i}):null]})})},"TooltipContentImpl")),fH=p.forwardRef(Dt(function(t,n){const{__scopeTooltip:r,...s}=t,i=uh(r);return(0,m.jsx)($_,{...i,...s,ref:n})},"TooltipArrow"));function lD(e,t){const n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),s=Math.abs(t.right-e.x),i=Math.abs(t.left-e.x);switch(Math.min(n,r,s,i)){case i:return"left";case s:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}Dt(lD,"getExitSideFromRect");function cD(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}Dt(cD,"getPaddedExitPoints");function uD(e){const{top:t,right:n,bottom:r,left:s}=e;return[{x:s,y:t},{x:n,y:t},{x:n,y:r},{x:s,y:r}]}Dt(uD,"getPointsFromRect");function dD(e,t){const{x:n,y:r}=e;let s=!1;for(let i=0,o=t.length-1;i<t.length;o=i++){const a=t[i],l=t[o],c=a.x,u=a.y,d=l.x,h=l.y;u>r!=h>r&&n<(d-c)*(r-u)/(h-u)+c&&(s=!s)}return s}Dt(dD,"isPointInPolygon");function hD(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),fD(t)}Dt(hD,"getHull");function fD(e){if(e.length<=1)return e.slice();const t=[];for(let r=0;r<e.length;r++){const s=e[r];for(;t.length>=2;){const i=t[t.length-1],o=t[t.length-2];if((i.x-o.x)*(s.y-o.y)>=(i.y-o.y)*(s.x-o.x))t.pop();else break}t.push(s)}t.pop();const n=[];for(let r=e.length-1;r>=0;r--){const s=e[r];for(;n.length>=2;){const i=n[n.length-1],o=n[n.length-2];if((i.x-o.x)*(s.y-o.y)>=(i.y-o.y)*(s.x-o.x))n.pop();else break}n.push(s)}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)}Dt(fD,"getHullPresorted");var BH=rH,pH=iH,mH=oH,gH=cH,CH=uH,vH=fH,BD={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"}]]};BD.node;var yH=Ve(BD),pD={name:"check",size:24,node:[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]};pD.node;var Vs=Ve(pD),mD={name:"chevron-down",size:24,node:[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]};mD.node;var gD=Ve(mD),CD={name:"chevron-right",size:24,node:[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]};CD.node;var Mo=Ve(CD),vD={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"]};vD.node;var bH=Ve(vD),yD={name:"clock",size:24,node:[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 6v6l4 2",key:"mmk7yg"}]]};yD.node;var C0=Ve(yD),bD={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"}]]};bD.node;var _s=Ve(bD),SD={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"}]]};SD.node;var SH=Ve(SD),ED={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"}]]};ED.node;var EH=Ve(ED),xD={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"}]]};xD.node;var xH=Ve(xD),wD={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"]};wD.node;var wH=Ve(wD),DD={name:"list-filter",size:24,node:[["path",{d:"M2 5h20",key:"1fs1ex"}],["path",{d:"M6 12h12",key:"8npq4p"}],["path",{d:"M9 19h6",key:"456am0"}]]};DD.node;var DH=Ve(DD),TD={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"}]]};TD.node;var v0=Ve(TD),AD={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"}]]};AD.node;var TH=Ve(AD),ID={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"}]]};ID.node;var AH=Ve(ID),kD={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"}]]};kD.node;var IH=Ve(kD),RD={name:"minus",size:24,node:[["path",{d:"M5 12h14",key:"1ays0h"}]]};RD.node;var kH=Ve(RD),OD={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"}]]};OD.node;var RH=Ve(OD),MD={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"}]]};MD.node;var OH=Ve(MD),ND={name:"plus",size:24,node:[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]};ND.node;var MH=Ve(ND),PD={name:"radio",size:24,node:[["path",{d:"M16.247 7.761a6 6 0 0 1 0 8.478",key:"1fwjs5"}],["path",{d:"M19.075 4.933a10 10 0 0 1 0 14.134",key:"ehdyv1"}],["path",{d:"M4.925 19.067a10 10 0 0 1 0-14.134",key:"1q22gi"}],["path",{d:"M7.753 16.239a6 6 0 0 1 0-8.478",key:"r2q7qm"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]]};PD.node;var NH=Ve(PD),LD={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"}]]};LD.node;var PH=Ve(LD),_D={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"}]]};_D.node;var LH=Ve(_D),FD={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"]};FD.node;var _H=Ve(FD),HD={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"]};HD.node;var dh=Ve(HD),jD={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"}]]};jD.node;var FH=Ve(jD),GD={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"]};GD.node;var HH=Ve(GD),VD={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"}]]};VD.node;var jH=Ve(VD),UD={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"}]]};UD.node;var GH=Ve(UD),Fs=class extends Error{constructor(e){super(e),this.name="CanonicalJsonError"}};function zD(e){if(!Number.isFinite(e))throw new Fs(`Cannot canonicalize non-finite number: ${String(e)}`);return e===0?"0":String(e)}function hh(e){if(e===void 0)throw new Fs("Cannot canonicalize `undefined` at the root");return tp(e,new Set)}function tp(e,t){if(e===null)return"null";switch(typeof e){case"boolean":return e?"true":"false";case"number":return zD(e);case"string":return JSON.stringify(e);case"object":break;default:throw new Fs(`Cannot canonicalize value of type ${typeof e}`)}if(t.has(e))throw new Fs("Cannot canonicalize a circular structure");t.add(e);try{if(Array.isArray(e)){const i=[],o=e.length;for(let a=0;a<o;a+=1){const l=e[a];i.push(l===void 0?"null":tp(l,t))}return`[${i.join(",")}]`}const n=Object.getPrototypeOf(e);if(n!==Object.prototype&&n!==null)throw new Fs("Cannot canonicalize a non-plain object (only plain objects, arrays and JSON primitives are part of the contract)");const r=e,s=[];for(const i of Object.keys(r).sort()){const o=r[i];o!==void 0&&s.push(`${JSON.stringify(i)}:${tp(o,t)}`)}return`{${s.join(",")}}`}finally{t.delete(e)}}var np=Symbol("canonicalJsonBounded.overBudget"),VH=class{constructor(e){this.maxChars=e}parts=[];length=0;remaining(){return this.maxChars-this.length}push(e){if(e.length>this.remaining())throw np;this.parts.push(e),this.length+=e.length}pushString(e,t=""){if(e.length+2+t.length>this.remaining())throw np;this.push(JSON.stringify(e)+t)}toString(){return this.parts.join("")}};function Dre(e,t){if(e===void 0)return{ok:!1,reason:"uncanonical",message:"Cannot canonicalize `undefined` at the root"};const n=new VH(t);try{rp(e,new Set,n)}catch(r){return r===np?{ok:!1,reason:"overBudget"}:{ok:!1,reason:"uncanonical",message:r instanceof Error?r.message:String(r)}}return{ok:!0,json:n.toString()}}function rp(e,t,n){if(e===null){n.push("null");return}switch(typeof e){case"boolean":n.push(e?"true":"false");return;case"number":n.push(zD(e));return;case"string":n.pushString(e);return;case"object":break;default:throw new Fs(`Cannot canonicalize value of type ${typeof e}`)}if(t.has(e))throw new Fs("Cannot canonicalize a circular structure");t.add(e);try{if(Array.isArray(e)){n.push("[");const o=e.length;for(let a=0;a<o;a+=1){a>0&&n.push(",");const l=e[a];l===void 0?n.push("null"):rp(l,t,n)}n.push("]");return}const r=Object.getPrototypeOf(e);if(r!==Object.prototype&&r!==null)throw new Fs("Cannot canonicalize a non-plain object (only plain objects, arrays and JSON primitives are part of the contract)");const s=e;n.push("{");let i=!0;for(const o of Object.keys(s).sort()){const a=s[o];a!==void 0&&(i||n.push(","),i=!1,n.pushString(o,":"),rp(a,t,n))}n.push("}")}finally{t.delete(e)}}function fh(e){return EN(AN(vN(e)))}function Yg(e){return fh(hh(e))}function UH(e){return e&&typeof e=="object"&&!Array.isArray(e)?e:void 0}function zH(e){return typeof e=="number"&&Number.isFinite(e)&&e>=0?e:void 0}function $H(e){const t=Object.entries(e).filter(([,n])=>n!==void 0);return t.length>0?Object.fromEntries(t):void 0}var WH=["uncachedInputTokens","cacheReadTokens","cacheWriteTokens","cacheWrite1hTokens","outputTokens","reasoningTokens","webSearchRequests"];function qH(e){const t=UH(e);if(!t)return;const n={};for(const r of WH){const s=zH(t[r]);s!==void 0&&(n[r]=s)}return $H(n)}var gl=e=>e&&typeof e=="object"&&!Array.isArray(e)?e:void 0,Qr=e=>typeof e=="number"&&Number.isFinite(e)&&e>=0?e:void 0,sp=e=>typeof e=="string"&&e.length>0?e:void 0;function ci(e,t){return t.includes(e)?e:void 0}function Os(e,t,n){const r={};for(const s of t){const i=n(e[s]);i!==void 0&&(r[s]=i)}return r}var y0=["input","output","cacheRead","cacheWrite","cacheWrite1h"];function KH(e){const t=gl(e);if(!t||t.currency!=="USD")return;const n=Os(t,[...y0,"webSearchPerThousand"],Qr);if(n.input===void 0||n.output===void 0)return;const r=(Array.isArray(t.tiers)?t.tiers:[]).map(gl).filter(s=>Qr(s?.aboveInputTokens)!==void 0).map(s=>Os(s,["aboveInputTokens",...y0],Qr));return{...n,currency:"USD",...r.length>0?{tiers:r}:{}}}function JH(e){const t=gl(e),n=ci(t?.source,["list_price","customer_rate"]),r=KH(t?.rates),s=sp(t?.modelId);if(!t||!n||!r||!s)return;const i=Array.isArray(t.assumptions)?t.assumptions.filter(o=>typeof o=="string"):[];return{source:n,rates:r,modelId:s,...Os(t,["provider","versionId"],sp),...Os(t,["effectiveAt","retrievedAt"],Qr),...i.length>0?{assumptions:i}:{}}}function $D(e){const t=gl(e);if(!t||t.currency!=="USD")return;const n=ci(t.completeness,["complete","partial","unavailable"]),r=Qr(t.calculationVersion),s=Qr(t.amountUsd),i=ci(t.source,["provider_reported","list_price","customer_rate","runner_reported"]);if(!n||r===void 0||n==="unavailable"!=(s===void 0)||s!==void 0&&!i)return;const o=Os(gl(t.parts)??{},["input","cacheRead","cacheWrite","output","webSearch"],Qr),a=(Array.isArray(t.missing)?t.missing:[]).filter(f=>ci(f,["usage","input_tokens","output_tokens","rate","cache_read_rate","cache_write_rate","cache_write_1h_rate","web_search_rate"])!==void 0),l=ci(t.reason,["no_usage","no_rate","invalid_rate","unsupported_currency"]),c=ci(t.funding,["mcpjam","customer"]),u=ci(t.usageSource,["provider","runner","interrupted_estimate"]),d=qH(t.usage),h=JH(t.rate);return{calculationVersion:r,currency:"USD",completeness:n,...s!==void 0?{amountUsd:s}:{},...i?{source:i}:{},...Object.keys(o).length>0?{parts:o}:{},...a.length>0?{missing:a}:{},...l?{reason:l}:{},...Os(t,["tierAboveInputTokens"],Qr),...h?{rate:h}:{},...Os(t,["reporter"],sp),...c?{funding:c}:{},...d?{usage:d}:{},...u?{usageSource:u}:{},...Os(t,["recordedAt"],Qr)}}var b0=1000000000000000n,WD=1e15;function QH(e){return BigInt(Math.round(e*WD))}function YH(e){const t=e/b0,n=e%b0;return Number(t)+Number(n)/WD}var XH=["provider_reported","customer_rate","list_price","runner_reported"];function ZH(e){let t=0n,n=0,r=0,s=0;const i=new Set;for(const l of e){if(!l||l.amountUsd===void 0||l.currency!=="USD"){s+=1;continue}t+=QH(l.amountUsd),l.source&&i.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:YH(t),completeness:a,totalCalls:o,completeCalls:n,partialCalls:r,unavailableCalls:s,sources:XH.filter(l=>i.has(l))}}function ui(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 ej=["completed","failed","cancelled","expired"];function Ta(e){return ej.includes(e)}var tj=250,nj=3e5,rj=1e3,sj=6e4;function S0(e){return typeof e=="number"&&Number.isFinite(e)&&e>0?e:0}function Ki(e){return typeof e=="number"&&Number.isFinite(e)&&e>0?e:void 0}function da(e){return{...e,respondedInputKeys:[...e.respondedInputKeys],terminal:Ta(e.status)}}var Tre=class{records=new Map;now;absoluteFloorMs;maximumIntervalMs;backoffBaseMs;backoffMaxMs;userMinimumIntervalMs;callbacks;constructor(e={}){this.now=e.now??(()=>Date.now()),this.absoluteFloorMs=e.absoluteFloorMs??tj,this.maximumIntervalMs=e.maximumIntervalMs??nj,this.backoffBaseMs=e.errorBackoffBaseMs??rj,this.backoffMaxMs=e.errorBackoffMaxMs??sj,this.userMinimumIntervalMs=S0(e.userMinimumIntervalMs),this.callbacks=e.callbacks??{}}setCallbacks(e){this.callbacks=e}setUserMinimumIntervalMs(e){this.userMinimumIntervalMs=S0(e);for(const t of this.records.values()){if(Ta(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=Ki(e.pollIntervalMs)??0,s=e.consecutiveErrors>0?Math.min(this.backoffBaseMs*2**(e.consecutiveErrors-1),this.backoffMaxMs):0,i=e.retryAfterUntil?Math.max(0,e.retryAfterUntil-n):0,o=Math.min(Math.max(this.absoluteFloorMs,this.userMinimumIntervalMs,s),Math.max(this.maximumIntervalMs,this.absoluteFloorMs));return Math.max(o,r,i)}get(e){return this.records.get(ui(e))}getByKey(e){return this.records.get(e)}snapshot(e){const t=this.get(e);return t?da(t):void 0}all(){return[...this.records.values()].map(da)}register(e,t={}){const n=ui(e),r=this.records.get(n);if(r)return r;const s=this.now(),i={key:n,identity:{...e},status:t.status??"unknown",createdAt:t.createdAt,ttlMs:t.ttlMs??null,pollIntervalMs:Ki(t.pollIntervalMs),nextPollAt:typeof t.nextPollAt=="number"&&Number.isFinite(t.nextPollAt)?Math.max(s,t.nextPollAt):s,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,i),t.restored||this.callbacks.onTaskCreated?.(da(i)),i}forget(e){this.records.delete(ui(e))}clear(){this.records.clear()}observe(e,t,n="poll"){const r=this.register(e,{restored:!0}),s=r.status,i=this.now();if(Ta(r.status)&&!r.restored)return r.lastObservedAt=i,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=Ki(t.pollIntervalMs)),r.inputRequests=t.inputRequests,r.result=t.result,r.error=t.error,r.raw=t.raw,r.lastObservedAt=i,n!=="notification"&&(r.consecutiveErrors=0,r.retryAfterUntil=void 0);const o=Ta(r.status);o?r.nextPollAt=Number.POSITIVE_INFINITY:n==="notification"&&r.consecutiveErrors>0?r.nextPollAt=Math.min(r.nextPollAt,i+this.effectiveIntervalMs(r,i)):r.nextPollAt=i+this.effectiveIntervalMs(r,i);const a=da(r);return s!==r.status?(this.callbacks.onState?.(a,s),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 s=Ki(t.retryAfterMs);return s!==void 0&&(n.retryAfterUntil=r+s),n.nextPollAt=r+this.effectiveIntervalMs(n,r),n}applyRetryAfter(e,t){const n=this.register(e,{restored:!0}),r=this.now(),s=Ki(t);s!==void 0&&(n.retryAfterUntil=r+s,n.nextPollAt=Math.max(n.nextPollAt,r+s))}clearErrorBackoff(e){const t=this.records.get(ui(e));if(!t)return;const n=this.now();t.consecutiveErrors=0;const r=Ki(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=da(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 Ta(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(ui(e));return!n||n.pollInFlight?!1:(n.pollInFlight=!0,this.reserve([n],t),!0)}releasePoll(e){const t=this.records.get(ui(e));t&&(t.pollInFlight=!1)}batchIntervalMs(e,t){const n=t??this.now();let r=Math.max(this.absoluteFloorMs,this.userMinimumIntervalMs);for(const s of e)r=Math.max(r,this.effectiveIntervalMs(s,n));return r}},qD=(0,p.createContext)({});function ij(e){const t=(0,p.useRef)(null);return t.current===null&&(t.current=e()),t.current}var oj=typeof window<"u",E0=oj?p.useLayoutEffect:p.useEffect,Bh=(0,p.createContext)(null);function Xg(e,t){e.indexOf(t)===-1&&e.push(t)}function fd(e,t){const n=e.indexOf(t);n>-1&&e.splice(n,1)}var ms=(e,t,n)=>n>t?t:n<e?e:n,ph=()=>{},Mi=()=>{},ds={},Zg=e=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e),KD=e=>typeof e=="object"&&e!==null,eC=e=>/^0[^.\s]+$/u.test(e);function JD(e){let t;return()=>(t===void 0&&(t=e()),t)}var sr=e=>e,rc=(...e)=>e.reduce((t,n)=>r=>n(t(r))),Cl=(e,t,n)=>{const r=t-e;return r?(n-e)/r:1},Bd=class{constructor(){this.subscriptions=[]}add(e){return Xg(this.subscriptions,e),()=>this.remove(e)}remove(e){fd(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 s=0;s<r;s++){const i=this.subscriptions[s];i&&i(e,t,n)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}},Dn=e=>e*1e3,Mn=e=>e/1e3,QD=(e,t)=>t?e*(1e3/t):0,YD=(e,t,n)=>(((1-3*n+3*t)*e+(3*n-6*t))*e+3*t)*e,aj=1e-7,lj=12;function cj(e,t,n,r,s){let i,o,a=0;do o=t+(n-t)/2,i=YD(o,r,s)-e,i>0?n=o:t=o;while(Math.abs(i)>aj&&++a<lj);return o}function sc(e,t,n,r){if(e===t&&n===r)return sr;const s=i=>cj(i,0,1,e,n);return i=>i===0||i===1?i:YD(s(i),t,r)}var XD=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,ZD=e=>t=>1-e(1-t),e1=sc(.33,1.53,.69,.99),tC=ZD(e1),t1=XD(tC),n1=e=>e>=1?1:(e*=2)<1?.5*tC(e):.5*(2-Math.pow(2,-10*(e-1))),nC=e=>1-Math.sin(Math.acos(e)),r1=ZD(nC),s1=XD(nC),uj=sc(.42,0,1,1),dj=sc(0,0,.58,1),rC=sc(.42,0,.58,1),hj=e=>Array.isArray(e)&&typeof e[0]!="number",i1=e=>Array.isArray(e)&&typeof e[0]=="number",x0={linear:sr,easeIn:uj,easeInOut:rC,easeOut:dj,circIn:nC,circInOut:s1,circOut:r1,backIn:tC,backInOut:t1,backOut:e1,anticipate:n1},fj=e=>typeof e=="string",w0=e=>{if(i1(e)){Mi(e.length===4,"Cubic bezier arrays must contain four numerical values.","cubic-bezier-length");const[t,n,r,s]=e;return sc(t,n,r,s)}else if(fj(e))return Mi(x0[e]!==void 0,`Invalid easing type '${e}'`,"invalid-easing-type"),x0[e];return e},xt={delta:0,timestamp:0,isProcessing:!1},wu;function Bj(){wu=void 0}var Ht={now:()=>(wu===void 0&&Ht.set(xt.isProcessing||ds.useManualTiming?xt.timestamp:performance.now()),wu),set:e=>{wu=e,queueMicrotask(Bj)}},xo=e=>Math.round(e*1e5)/1e5,o1=e=>t=>typeof t=="string"&&t.startsWith(e),a1=o1("--"),pj=o1("var(--"),sC=e=>pj(e)?mj.test(e.split("/*")[0].trim()):!1,mj=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function D0(e){return typeof e!="string"?!1:e.split("/*")[0].includes("var(--")}var ta={test:e=>typeof e=="number",parse:parseFloat,transform:e=>e},vl={...ta,transform:e=>ms(0,1,e)},Nc={...ta,default:1},iC=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function gj(e){return e==null}var Cj=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,oC=(e,t)=>n=>!!(typeof n=="string"&&Cj.test(n)&&n.startsWith(e)||t&&!gj(n)&&Object.prototype.hasOwnProperty.call(n,t)),l1=(e,t,n)=>r=>{if(typeof r!="string")return r;const[s,i,o,a]=r.match(iC);return{[e]:parseFloat(s),[t]:parseFloat(i),[n]:parseFloat(o),alpha:a!==void 0?parseFloat(a):1}},vj=e=>ms(0,255,e),yf={...ta,transform:e=>Math.round(vj(e))},gi={test:oC("rgb","red"),parse:l1("red","green","blue"),transform:({red:e,green:t,blue:n,alpha:r=1})=>"rgba("+yf.transform(e)+", "+yf.transform(t)+", "+yf.transform(n)+", "+xo(vl.transform(r))+")"};function yj(e){let t="",n="",r="",s="";return e.length>5?(t=e.substring(1,3),n=e.substring(3,5),r=e.substring(5,7),s=e.substring(7,9)):(t=e.substring(1,2),n=e.substring(2,3),r=e.substring(3,4),s=e.substring(4,5),t+=t,n+=n,r+=r,s+=s),{red:parseInt(t,16),green:parseInt(n,16),blue:parseInt(r,16),alpha:s?parseInt(s,16)/255:1}}var ip={test:oC("#"),parse:yj,transform:gi.transform},ic=e=>({test:t=>typeof t=="string"&&t.endsWith(e)&&t.split(" ").length===1,parse:parseFloat,transform:t=>`${t}${e}`}),Vr=ic("deg"),Nr=ic("%"),fe=ic("px"),bj=ic("vh"),Sj=ic("vw"),T0={...Nr,parse:e=>Nr.parse(e)/100,transform:e=>Nr.transform(e*100)},ho={test:oC("hsl","hue"),parse:l1("hue","saturation","lightness"),transform:({hue:e,saturation:t,lightness:n,alpha:r=1})=>"hsla("+Math.round(e)+", "+Nr.transform(xo(t))+", "+Nr.transform(xo(n))+", "+xo(vl.transform(r))+")"},wt={test:e=>gi.test(e)||ip.test(e)||ho.test(e),parse:e=>gi.test(e)?gi.parse(e):ho.test(e)?ho.parse(e):ip.parse(e),transform:e=>typeof e=="string"?e:e.hasOwnProperty("red")?gi.transform(e):ho.transform(e),getAnimatableNone:e=>{const t=wt.parse(e);return t.alpha=0,wt.transform(t)}},Ej=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu,c1=new RegExp(iC.source),u1=new RegExp(Ej.source,"i");function xj(e){return isNaN(e)&&typeof e=="string"&&(c1.test(e)||u1.test(e))}var d1="number",h1="color",wj="var",Dj="var(",A0="${}",Tj=/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 Aj(e){const t=e.toString();return c1.test(t)||u1.test(t)}function yl(e){const t=e.toString(),n=[],r={color:[],number:[],var:[]},s=[];let i=0;return{values:n,split:t.replace(Tj,o=>(wt.test(o)?(r.color.push(i),s.push(h1),n.push(wt.parse(o))):o.startsWith(Dj)?(r.var.push(i),s.push(wj),n.push(o)):(r.number.push(i),s.push(d1),n.push(parseFloat(o))),++i,A0)).split(A0),indexes:r,types:s}}function Ij(e){return yl(e).values}function f1({split:e,types:t}){const n=e.length;return r=>{let s="";for(let i=0;i<n;i++)if(s+=e[i],r[i]!==void 0){const o=t[i];o===d1?s+=xo(r[i]):o===h1?s+=wt.transform(r[i]):s+=r[i]}return s}}function kj(e){return f1(yl(e))}var Rj=e=>typeof e=="number"?0:wt.test(e)?wt.getAnimatableNone(e):e,Oj=(e,t)=>typeof e=="number"?t?.trim().endsWith("/")?e:0:Rj(e);function Mj(e){const t=yl(e);return f1(t)(t.values.map((n,r)=>Oj(n,t.split[r])))}var Tn={test:xj,parse:Ij,createTransformer:kj,getAnimatableNone:Mj};function bf(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 Nj({hue:e,saturation:t,lightness:n,alpha:r}){e/=360,t/=100,n/=100;let s=0,i=0,o=0;if(!t)s=i=o=n;else{const a=n<.5?n*(1+t):n+t-n*t,l=2*n-a;s=bf(l,a,e+1/3),i=bf(l,a,e),o=bf(l,a,e-1/3)}return{red:Math.round(s*255),green:Math.round(i*255),blue:Math.round(o*255),alpha:r}}function pd(e,t){return n=>n>0?t:e}var Ue=(e,t,n)=>e+(t-e)*n,Sf=(e,t,n)=>{const r=e*e,s=n*(t*t-r)+r;return s<0?0:Math.sqrt(s)},Pj=[ip,gi,ho],Lj=e=>Pj.find(t=>t.test(e));function I0(e){const t=Lj(e);if(!t)return ph(!1,`'${e}' is not an animatable color. Use the equivalent color code instead.`,"color-not-animatable"),!1;let n=t.parse(e);return t===ho&&(n=Nj(n)),n}var k0=(e,t)=>{const n=I0(e),r=I0(t);if(!n||!r)return pd(e,t);const s={...n};return i=>(s.red=Sf(n.red,r.red,i),s.green=Sf(n.green,r.green,i),s.blue=Sf(n.blue,r.blue,i),s.alpha=Ue(n.alpha,r.alpha,i),gi.transform(s))},op=new Set(["none","hidden"]);function _j(e,t){return op.has(e)?n=>n<=0?e:t:n=>n>=1?t:e}function Fj(e,t){return n=>Ue(e,t,n)}function aC(e){return typeof e=="number"?Fj:typeof e=="string"?sC(e)?pd:wt.test(e)?k0:Gj:Array.isArray(e)?B1:typeof e=="object"?wt.test(e)?k0:Hj:pd}function B1(e,t){const n=[...e],r=n.length,s=e.map((i,o)=>aC(i)(i,t[o]));return i=>{for(let o=0;o<r;o++)n[o]=s[o](i);return n}}function Hj(e,t){const n={...e,...t},r={};for(const s in n)e[s]!==void 0&&t[s]!==void 0&&(r[s]=aC(e[s])(e[s],t[s]));return s=>{for(const i in r)n[i]=r[i](s);return n}}function jj(e,t){const n=[],r={color:0,var:0,number:0};for(let s=0;s<t.values.length;s++){const i=t.types[s],o=e.indexes[i][r[i]],a=e.values[o]??0;n[s]=a,r[i]++}return n}var Gj=(e,t)=>{const n=Tn.createTransformer(t),r=yl(e),s=yl(t);return r.indexes.var.length===s.indexes.var.length&&r.indexes.color.length===s.indexes.color.length&&r.indexes.number.length>=s.indexes.number.length?op.has(e)&&!s.values.length||op.has(t)&&!r.values.length?_j(e,t):rc(B1(jj(r,s),s.values),n):(ph(!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"),pd(e,t))},R0=/^(-?(?:\d+(?:\.\d*)?|\.\d+))([a-z%]*)$/iu;function Vj(e,t){const n=R0.exec(e);if(!n)return;const r=R0.exec(t);if(!r||n[2]!==r[2])return;const s=n[2],i=parseFloat(n[1]),o=parseFloat(r[1]);return a=>xo(Ue(i,o,a))+s}function lC(e,t,n){if(typeof e=="number"&&typeof t=="number"&&typeof n=="number")return Ue(e,t,n);if(typeof e=="string"&&typeof t=="string"){const r=Vj(e,t);if(r)return r}return aC(e)(e,t)}var Pc=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];function Uj(e){let t=new Set,n=new Set,r=!1,s=!1;const i=new Set;let o={delta:0,timestamp:0,isProcessing:!1};function a(c){i.has(c)&&(n.add(c),e()),c(o)}const l={schedule:(c,u=!1,d=!1)=>{const h=d&&r?t:n;return u&&i.add(c),h.add(c),c},cancel:c=>{n.delete(c),i.delete(c)},process:c=>{if(o=c,r){s=!0;return}r=!0;const u=t;t=n,n=u,t.forEach(a),t.clear(),r=!1,s&&(s=!1,l.process(c))}};return l}var zj=40;function p1(e,t,n={delta:0,timestamp:0,isProcessing:!1}){let r=!1,s=!0;const i=()=>r=!0,o=Pc.reduce((S,E)=>(S[E]=Uj(i),S),{}),{setup:a,read:l,resolveKeyframes:c,preUpdate:u,update:d,preRender:h,render:f,postRender:B}=o,g=()=>{const S=ds.useManualTiming,E=S?n.timestamp:performance.now();r=!1,S||(n.delta=s?1e3/60:Math.max(Math.min(E-n.timestamp,zj),1)),n.timestamp=E,n.isProcessing=!0,a.process(n),l.process(n),c.process(n),u.process(n),d.process(n),h.process(n),f.process(n),B.process(n),n.isProcessing=!1,r&&t&&(s=!1,e(g))},C=()=>{r=!0,s=!0,n.isProcessing||e(g)};return{schedule:Pc.reduce((S,E)=>{const D=o[E];return S[E]=(A,x=!1,O=!1)=>(r||C(),D.schedule(A,x,O)),S},{}),cancel:S=>{for(let E=0;E<Pc.length;E++)o[Pc[E]].cancel(S)},state:n,steps:o}}var{schedule:qe,cancel:Us,steps:Ef}=p1(typeof requestAnimationFrame<"u"?requestAnimationFrame:sr,!0,xt),$j=e=>{const t=({timestamp:n})=>e(n);return{start:(n=!0)=>qe.update(t,n),stop:()=>Us(t),now:()=>xt.isProcessing?xt.timestamp:Ht.now()}},m1=(e,t,n=10)=>{let r="";const s=Math.max(Math.round(t/n),2);for(let i=0;i<s;i++)r+=Math.round(e(i/(s-1))*1e4)/1e4+", ";return`linear(${r.substring(0,r.length-2)})`},cC=2e4;function uC(e,t=50,n=cC,r){let s=0,i=e.next(s);for(r?.push(i.value);!i.done&&s<n;)s+=t,i=e.next(s),r?.push(i.value);return s>=n?1/0:s}function Wj(e,t=100,n){const r=n({...e,keyframes:[0,t]}),s=Math.min(uC(r),cC);return{type:"keyframes",ease:i=>r.next(s*i).value/t,duration:Mn(s)}}var Mt={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},g1=e=>e<0?1/Math.max(1+e,Mt.minDamping):Math.max(1-e,Mt.minDamping);function C1(e,t){if(!(e>1))return 1;const n=Math.sqrt(e*e-1),r=e-n,s=e+n,i=2*n*Math.exp(-t)*(1+t);return v1(o=>s*Math.exp(-r*o)-r*Math.exp(-s*o)-i,o=>Math.exp(-s*o)-Math.exp(-r*o),t)/t}function ap(e,t){return e*Math.sqrt(1-t*t)}var qj=12;function v1(e,t,n){let r=n;for(let s=1;s<qj;s++)r=r-e(r)/t(r);return r}var O0=.001;function Kj({duration:e=Mt.duration,bounce:t=Mt.bounce}){let n,r;ph(e<=Dn(Mt.maxDuration),"Spring duration must be 10 seconds or less","spring-duration-limit");const s=g1(t);e=ms(Mt.minDuration,Mt.maxDuration,Mn(e)),s<1?(n=c=>{const u=c*s,d=u*e,h=ap(c,s),f=Math.exp(-d);return O0-u/h*f},r=c=>{const u=c*s*e,d=s*s*c*c*e,h=Math.exp(-u),f=ap(c*c,s);return(-n(c)+O0>0?-1:1)*-d*h/f}):(n=c=>-.001+Math.exp(-c*e)*(c*e+1),r=c=>Math.exp(-c*e)*(-c*(e*e)));const i=5/e,o=v1(n,r,i),a=o*C1(s,o*e),l=a*a;return{stiffness:l,damping:s*2*Math.sqrt(l),duration:Dn(e)}}var lp=(e,t)=>(t?e>=0:e>0)&&e<1/0;function xf(e,t){if(lp(e,t))return e}function Jj(e){const t=xf(e.stiffness),n=xf(e.damping,!0),r=xf(e.mass),s={...e,stiffness:t??Mt.stiffness,damping:n??Mt.damping,mass:r??Mt.mass,isResolvedFromDuration:!1,isTimeDefined:(t??n??r)===void 0&&(e.duration!==void 0||e.bounce!==void 0)};if(s.isTimeDefined){if(e.visualDuration){const i=g1(e.bounce||0),o=2*Math.PI/(e.visualDuration*1.2)*C1(i,2*Math.PI/1.2);s.stiffness=o*o,s.damping=2*i*Math.sqrt(s.stiffness)}else Object.assign(s,Kj(s)),s.isResolvedFromDuration=!0;(!lp(s.stiffness)||!lp(s.damping,!0))&&(s.stiffness=Mt.stiffness,s.damping=Mt.damping)}return s}function md(e=Mt.visualDuration,t=Mt.bounce){const n=typeof e!="object"?{visualDuration:e,keyframes:[0,1],bounce:t}:e,r=n.keyframes[0],s=n.keyframes[n.keyframes.length-1],i={done:!1,value:r},{stiffness:o,damping:a,mass:l,duration:c,isResolvedFromDuration:u,isTimeDefined:d}=Jj({...n}),h=x=>d?0:-Mn(x),f=a/(2*Math.sqrt(o*l)),B=Mn(Math.sqrt(o/l)),g=f*B,C={target:s,delta:s-r,velocity:h(n.velocity||0)||0,restSpeed:0,restDelta:0},v=()=>{const x=Math.abs(C.delta)<5;C.restSpeed=n.restSpeed||(x?Mt.restSpeed.granular:Mt.restSpeed.default),C.restDelta=n.restDelta||(x?Mt.restDelta.granular:Mt.restDelta.default)};v();let y,S,E;if(f<1){const x=ap(B,f),O={A:0,sinC:0,cosC:0,t:-1,env:0,sin:0,cos:0};E=()=>{O.A=(C.velocity+g*C.delta)/x,O.sinC=g*O.A+C.delta*x,O.cosC=g*C.delta-O.A*x};const R=P=>{P!==O.t&&(O.t=P,O.env=Math.exp(-g*P),O.sin=Math.sin(x*P),O.cos=Math.cos(x*P))};y=P=>(R(P),C.target-O.env*(O.A*O.sin+C.delta*O.cos)),S=P=>(R(P),O.env*(O.sinC*O.sin+O.cosC*O.cos))}else if(f===1){y=O=>C.target-Math.exp(-B*O)*(C.delta+(C.velocity+B*C.delta)*O);const x={C:0};E=()=>{x.C=C.velocity+B*C.delta},S=O=>Math.exp(-B*O)*(B*x.C*O-C.velocity)}else{const x=B*Math.sqrt(f*f-1),O=g-x,R=g+x,P=d?1/0:300/x,_=(W,q)=>Math.exp(q>P?-W*P-g*(q-P):-W*q),N={S:0,F:0};E=()=>{const W=(C.velocity+g*C.delta)/x;N.S=(C.delta+W)/2,N.F=(C.delta-W)/2},y=W=>C.target-N.S*_(O,W)-N.F*_(R,W),S=W=>O*N.S*_(O,W)+R*N.F*_(R,W)}E();const D=u&&c||null,A={calculatedDuration:D,retarget:(x,O)=>{C.target=x[x.length-1],C.delta=C.target-x[0],C.velocity=h(O),n.restSpeed&&n.restDelta||v(),A.calculatedDuration=D,i.done=!1,E()},velocity:x=>Dn(S(x)),next:x=>{const O=y(x);if(u)i.done=x>=c;else{const R=Dn(S(x));i.done=Math.abs(R)<=C.restSpeed&&Math.abs(C.target-O)<=C.restDelta}return i.value=i.done?C.target:O,i},toString:()=>{const x=Math.min(uC(A),cC),O=m1(R=>A.next(x*R).value,x,30);return x+"ms "+O},toTransition:()=>{}};return A}md.applyToOptions=e=>{const t=Wj(e,100,md);return e.ease=t.ease,e.duration=Dn(t.duration),e.type="keyframes",e};function cp({keyframes:e,velocity:t=0,power:n=.8,timeConstant:r=325,bounceDamping:s=10,bounceStiffness:i=500,modifyTarget:o,min:a,max:l,restDelta:c=.5,restSpeed:u}){const d=e[0],h={done:!1,value:d},f=x=>x<a||x>l,B=x=>a===void 0?l:l===void 0||Math.abs(a-x)<Math.abs(l-x)?a:l;let g=n*t;const C=d+g,v=o===void 0?C:o(C);v!==C&&(g=v-d);const y=x=>-g*Math.exp(-x/r),S=x=>{const O=y(x);h.done=Math.abs(O)<=c,h.value=h.done?v:v+O};let E,D;const A=x=>{f(h.value)&&(E=x,D=md({keyframes:[h.value,B(h.value)],velocity:-y(x)/r*1e3,damping:s,stiffness:i,restDelta:c,restSpeed:u}))};return A(0),{calculatedDuration:null,next:x=>{let O=!1;return!D&&E===void 0&&(O=!0,S(x),A(x)),E!==void 0&&x>=E?D.next(x-E):(!O&&S(x),h)}}}function Qj(e,t,n){const r=[],s=n||ds.mix||lC,i=e.length-1;for(let o=0;o<i;o++){let a=s(e[o],e[o+1]);if(t){const l=Array.isArray(t)?t[o]||sr:t;a=rc(l,a)}r.push(a)}return r}function Yj(e,t,{clamp:n=!0,ease:r,mixer:s}={}){const i=e.length;if(Mi(i===t.length,"Both input and output ranges must be the same length","range-length"),i===1)return()=>t[0];if(i===2&&t[0]===t[1])return()=>t[1];const o=e[0]===e[1];e[0]>e[i-1]&&(e=[...e].reverse(),t=[...t].reverse());const a=Qj(t,r,s),l=a.length,c=u=>{if(o&&u<e[0])return t[0];let d=0;if(l>1)for(;d<e.length-2&&!(u<e[d+1]);d++);const h=Cl(e[d],e[d+1],u);return a[d](h)};return n?u=>c(ms(e[0],e[i-1],u)):c}function Xj(e,t){const n=e[e.length-1];for(let r=1;r<=t;r++){const s=Cl(0,t,r);e.push(Ue(n,1,s))}}function Zj(e){const t=[0];return Xj(t,e.length-1),t}function eG(e,t){return e.map(n=>n*t)}function tG(e,t){return e.map(()=>t||rC).splice(0,e.length-1)}function $a({duration:e=300,keyframes:t,times:n,ease:r="easeInOut"}){const s=hj(r)?r.map(w0):w0(r)||rC,i={done:!1,value:t[0]};if(t.length===2&&!Array.isArray(s)&&(!n||n.length!==2||n[0]===0&&n[1]===1)){const[l,c]=t,u=l===c?void 0:(ds.mix||lC)(l,c);return{calculatedDuration:e,next:d=>(i.value=u?u(s(e>0?ms(0,1,d/e):1)):c,i.done=d>=e,i)}}const o=eG(n&&n.length===t.length?n:Zj(t),e),a=Yj(o,t,{ease:Array.isArray(s)?s:tG(t,s)});return{calculatedDuration:e,next:l=>(i.value=a(l),i.done=l>=e,i)}}var nG=5;function rG(e,t,n){const r=Math.max(t-nG,0);return QD(n-e(r),t-r)}function sG(e,t,n=0){return t<=0?n:e.velocity?e.velocity(t):rG(r=>e.next(r).value,t,e.next(t).value)}var iG=e=>e!==null;function mh(e,{repeat:t,repeatType:n="loop"},r,s=1){const i=e.filter(iG),o=s<0||t&&n!=="loop"&&t%2===1?0:i.length-1;return!o||r===void 0?i[o]:r}var oG={decay:cp,inertia:cp,tween:$a,keyframes:$a,spring:md};function y1(e){typeof e.type=="string"&&(e.type=oG[e.type])}function b1(e,t){return{kind:e,animation:t,timestamp:Ht.now(),frameTimestamp:xt.timestamp,frameIsProcessing:xt.isProcessing}}function S1(e,t,n){const r=globalThis.__MOTION_INSPECT__;if(r)try{r({...b1("animation-start",e),options:n?{...t,...n}:t})}catch{}}function aG(e,t){const n=globalThis.__MOTION_INSPECT__;if(n)try{n({...b1("layout-animation-start",e),node:t})}catch{}}var dC=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)}},lG=e=>e/100,gd=class extends dC{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!==Ht.now()&&this.tick(Ht.now()),this.isStopped=!0,this.state!=="idle"&&(this.teardown(),this.options.onStop?.())},this.options=e,this.initAnimation(),this.play(),e.autoplay===!1&&this.pause(),S1(this,this.options)}initAnimation(){const{options:e}=this;y1(e);const{type:t=$a,repeat:n=0,repeatDelay:r=0,repeatType:s,velocity:i=0}=e;let{keyframes:o}=e;const a=t||$a;a!==$a&&typeof o[0]!="number"&&(this.mixKeyframes=rc(lG,lC(o[0],o[1])),o=[0,100]);const l=a(o===e.keyframes?e:{...e,keyframes:o});s==="mirror"&&(this.mirroredGenerator=a({...e,keyframes:[...o].reverse(),velocity:-i})),l.calculatedDuration===null&&(l.calculatedDuration=uC(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:s,mirroredGenerator:i,resolvedDuration:o,calculatedDuration:a}=this;if(this.startTime===null)return n.next(0);const{delay:l=0,keyframes:c,repeat:u,repeatType:d,repeatDelay:h,type:f,onUpdate:B,finalKeyframe:g}=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 C=this.currentTime-l*(this.playbackSpeed>=0?1:-1),v=this.playbackSpeed>=0?C<0:C>r;this.currentTime=Math.max(C,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=r);let y=this.currentTime,S=n;if(u){const x=Math.min(this.currentTime,r)/o;let O=Math.floor(x),R=x%1;!R&&x>=1&&(R=1),R===1&&O--,O=Math.min(O,u+1),O%2&&(d==="reverse"?(R=1-R,h&&(R-=h/o)):d==="mirror"&&(S=i)),y=ms(0,1,R)*o}let E;v?(this.delayState.value=c[0],E=this.delayState):E=S.next(y),s&&!v&&(E.value=s(E.value));let{done:D}=E;!v&&a!==null&&(D=this.playbackSpeed>=0?this.currentTime>=r:this.currentTime<=0);const A=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&D);return A&&f!==cp&&(E.value=mh(c,this.options,g,this.speed)),B&&B(E.value),A&&this.finish(),E}then(e,t){return this.finished.then(e,t)}get duration(){return Mn(this.calculatedDuration)}get iterationDuration(){const{delay:e=0}=this.options||{};return this.duration+Mn(e)}get time(){return Mn(this.currentTime)}set time(e){e=Dn(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 sG(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(Ht.now()),this.playbackSpeed=e,t&&this.driver&&(this.time=Mn(this.currentTime))}play(){if(this.isStopped)return;const{driver:e=$j,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(Ht.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)}},cG=new Set(["brightness","contrast","saturate","opacity"]);function uG(e){const[t,n]=e.slice(0,-1).split("(");if(t==="drop-shadow")return e;const[r]=n.match(iC)||[];if(!r)return e;const s=n.replace(r,"");let i=cG.has(t)?1:0;return r!==n&&(i*=100),t+"("+i+s+")"}var dG=/\b([a-z-]*)\(.*?\)/gu,up={...Tn,getAnimatableNone:e=>{const t=e.match(dG);return t?t.map(uG).join(" "):e}},dp={...Tn,getAnimatableNone:e=>{const t=Tn.parse(e);return Tn.createTransformer(e)(t.map(n=>typeof n=="number"?0:typeof n=="object"?{...n,alpha:1}:n))}},M0={...ta,transform:Math.round},hG={rotate:Vr,pathRotation:Vr,rotateX:Vr,rotateY:Vr,rotateZ:Vr,scale:Nc,scaleX:Nc,scaleY:Nc,scaleZ:Nc,skew:Vr,skewX:Vr,skewY:Vr,distance:fe,translateX:fe,translateY:fe,translateZ:fe,x:fe,y:fe,z:fe,perspective:fe,transformPerspective:fe,opacity:vl,originX:T0,originY:T0,originZ:fe},Cd={borderWidth:fe,borderTopWidth:fe,borderRightWidth:fe,borderBottomWidth:fe,borderLeftWidth:fe,borderRadius:fe,borderTopLeftRadius:fe,borderTopRightRadius:fe,borderBottomRightRadius:fe,borderBottomLeftRadius:fe,width:fe,maxWidth:fe,height:fe,maxHeight:fe,top:fe,right:fe,bottom:fe,left:fe,inset:fe,insetBlock:fe,insetBlockStart:fe,insetBlockEnd:fe,insetInline:fe,insetInlineStart:fe,insetInlineEnd:fe,padding:fe,paddingTop:fe,paddingRight:fe,paddingBottom:fe,paddingLeft:fe,paddingBlock:fe,paddingBlockStart:fe,paddingBlockEnd:fe,paddingInline:fe,paddingInlineStart:fe,paddingInlineEnd:fe,margin:fe,marginTop:fe,marginRight:fe,marginBottom:fe,marginLeft:fe,marginBlock:fe,marginBlockStart:fe,marginBlockEnd:fe,marginInline:fe,marginInlineStart:fe,marginInlineEnd:fe,fontSize:fe,backgroundPositionX:fe,backgroundPositionY:fe,...hG,zIndex:M0,fillOpacity:vl,strokeOpacity:vl,numOctaves:M0},fG={...Cd,color:wt,backgroundColor:wt,outlineColor:wt,fill:wt,stroke:wt,borderColor:wt,borderTopColor:wt,borderRightColor:wt,borderBottomColor:wt,borderLeftColor:wt,filter:up,WebkitFilter:up,mask:dp,WebkitMask:dp},E1=e=>fG[e],BG=new Set([up,dp]);function hC(e,t){let n=E1(e);return BG.has(n)||(n=Tn),n.getAnimatableNone?n.getAnimatableNone(t):void 0}function pG(e){for(let t=1;t<e.length;t++)e[t]??(e[t]=e[t-1])}var Ci=e=>e*180/Math.PI,hp=e=>{const t=Ci(Math.atan2(e[1],e[0]));return fp(t)},mG={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:e=>(Math.abs(e[0])+Math.abs(e[3]))/2,rotate:hp,rotateZ:hp,skewX:e=>Ci(Math.atan(e[1])),skewY:e=>Ci(Math.atan(e[2])),skew:e=>(Math.abs(e[1])+Math.abs(e[2]))/2},fp=e=>(e=e%360,e<0&&(e+=360),e),N0=hp,P0=e=>Math.sqrt(e[0]*e[0]+e[1]*e[1]),L0=e=>Math.sqrt(e[4]*e[4]+e[5]*e[5]),gG={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:P0,scaleY:L0,scale:e=>(P0(e)+L0(e))/2,rotateX:e=>fp(Ci(Math.atan2(e[6],e[5]))),rotateY:e=>fp(Ci(Math.atan2(-e[2],e[0]))),rotateZ:N0,rotate:N0,skewX:e=>Ci(Math.atan(e[4])),skewY:e=>Ci(Math.atan(e[1])),skew:e=>(Math.abs(e[1])+Math.abs(e[4]))/2};function bl(e){return e.includes("scale")?1:0}function Bp(e,t){if(!e||e==="none")return bl(t);const n=e.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let r,s;if(n)r=gG,s=n;else{const a=e.match(/^matrix\(([-\d.e\s,]+)\)$/u);r=mG,s=a}if(!s)return bl(t);const i=r[t],o=s[1].split(",").map(vG);return typeof i=="function"?i(o):o[i]}var CG=(e,t)=>{const{transform:n="none"}=getComputedStyle(e);return Bp(n,t)};function vG(e){return parseFloat(e.trim())}var na=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],Hs=new Set([...na,"pathRotation"]),_0=e=>e===ta||e===fe,yG=new Set(["x","y","z"]),bG=na.filter(e=>!yG.has(e));function SG(e){const t=[];return bG.forEach(n=>{const r=e.getValue(n);if(r!==void 0){const s=r.get(),i=n.startsWith("scale")?1:0;if(s===i)return;t.push([n,s]),r.set(i)}}),t}var EG=new Set(["bottom","right"]);function F0(e,t,n,r,s,i){const o=parseFloat(e);if(!isNaN(o))return o;const{min:a,max:l}=t()[n],c=l-a;return i==="border-box"?c:c-parseFloat(r)-parseFloat(s)}var bi={width:({width:e,paddingLeft:t="0",paddingRight:n="0",boxSizing:r},s)=>F0(e,s,"x",t,n,r),height:({height:e,paddingTop:t="0",paddingBottom:n="0",boxSizing:r},s)=>F0(e,s,"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})=>Bp(e,"x"),y:({transform:e})=>Bp(e,"y")};bi.translateX=bi.x;bi.translateY=bi.y;var Si=new Set,pp=!1,mp=!1,gp=!1;function x1(){if(mp){const e=[],t=new Set,n=new Set;Si.forEach(s=>{s.needsMeasurement&&(e.push(s),t.add(s.element),EG.has(s.name)&&n.add(s.element))});const r=new Map;n.forEach(s=>{const i=SG(s);i.length&&(r.set(s,i),s.render())}),e.forEach(s=>s.measureInitialState()),t.forEach(s=>{s.render();const i=r.get(s);i&&i.forEach(([o,a])=>{s.getValue(o)?.set(a)})}),e.forEach(s=>s.measureEndState()),e.forEach(s=>{s.suspendedScrollY!==void 0&&window.scrollTo(0,s.suspendedScrollY)})}mp=!1,pp=!1,Si.forEach(e=>e.complete(gp)),Si.clear()}function w1(){Si.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(mp=!0)})}function xG(){gp=!0,w1(),x1(),gp=!1}function wG(e,t,n){if(typeof e=="string"){if(Zg(e)||eC(e))return parseFloat(e);if(!Tn.test(e)&&Tn.test(n))return hC(t,n)}return e??void 0}var fC=class{constructor(e,t,n,r,s,i=!1){this.state="pending",this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...e],this.onComplete=t,this.name=n,this.motionValue=r,this.element=s,this.isAsync=i}scheduleResolve(){this.state="scheduled",this.isAsync?(Si.add(this),pp||(pp=!0,qe.read(w1),qe.resolveKeyframes(x1))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:e,name:t,element:n,motionValue:r}=this;if(e[0]===null){const s=r?.get(),i=e[e.length-1];if(s!==void 0)e[0]=s;else if(n&&t){const o=wG(n.readValue(t,i),t,i);o!==void 0&&(e[0]=o)}e[0]===void 0&&(e[0]=i),r&&s===void 0&&r.set(e[0])}pG(e)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(e=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,e),Si.delete(this)}cancel(){this.state==="scheduled"&&(Si.delete(this),this.state="pending")}resume(){this.state==="pending"&&this.scheduleResolve()}},DG=e=>e.startsWith("--");function D1(e,t,n){DG(t)?e.style.setProperty(t,n):e.style[t]=n}var TG={};function T1(e,t){const n=JD(e);return()=>TG[t]??n()}var AG=T1(()=>window.ScrollTimeline!==void 0,"scrollTimeline"),A1=T1(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),Aa=([e,t,n,r])=>`cubic-bezier(${e}, ${t}, ${n}, ${r})`,H0={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:Aa([0,.65,.55,1]),circOut:Aa([.55,0,1,.45]),backIn:Aa([.31,.01,.66,-.59]),backOut:Aa([.33,1.53,.69,.99])};function I1(e,t){if(e)return typeof e=="function"?A1()?m1(e,t):"ease-out":i1(e)?Aa(e):Array.isArray(e)?e.map(n=>I1(n,t)||H0.easeOut):H0[e]}function IG(e,t,n,{delay:r=0,duration:s=300,repeat:i=0,repeatType:o="loop",ease:a="easeOut",times:l}={},c=void 0){const u={[t]:n};l&&(u.offset=l);const d=I1(a,s);Array.isArray(d)&&(u.easing=d);const h={delay:r,duration:s,easing:Array.isArray(d)?"linear":d,fill:"both",iterations:i+1,direction:o==="reverse"?"alternate":"normal"};return c&&(h.pseudoElement=c),e.animate(u,h)}function k1(e){return typeof e=="function"&&"applyToOptions"in e}function kG({type:e,...t}){return k1(e)&&A1()?e.applyToOptions(t):(t.duration??(t.duration=300),t.ease??(t.ease="easeOut"),t)}var R1=class extends dC{constructor(e){if(super(),this.finishedTime=null,this.isStopped=!1,this.manualStartTime=null,!e)return;const{element:t,name:n,keyframes:r,pseudoElement:s,allowFlatten:i=!1,finalKeyframe:o,onComplete:a}=e;this.isPseudoElement=!!s,this.allowFlatten=i,this.options=e,Mi(typeof e.type!="string",`Mini animate() doesn't support "type" as a string.`,"mini-spring");const l=kG(e);this.animation=IG(t,n,r,l,s),l.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!s){const c=mh(r,this.options,o,this.speed);this.updateMotionValue&&this.updateMotionValue(c),D1(t,n,c),this.animation.cancel()}a?.(),this.notifyFinished()},S1(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 Mn(Number(e))}get iterationDuration(){const{delay:e=0}=this.options||{};return this.duration+Mn(e)}get time(){return Mn(Number(this.animation.currentTime)||0)}set time(e){const t=this.finishedTime!==null;this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=Dn(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&&AG()?(this.animation.timeline=e,Object.assign(this.animation,r),t?.(this.animation),sr):n(this)}},O1={anticipate:n1,backInOut:t1,circInOut:s1};function RG(e){return e in O1}function OG(e){typeof e.ease=="string"&&RG(e.ease)&&(e.ease=O1[e.ease])}var wf=10,MG=class extends R1{constructor(e){OG(e),y1(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:s,...i}=this.options;if(!t)return;if(e!==void 0){t.set(e);return}const o=new gd({...i,autoplay:!1}),a=Math.max(wf,Ht.now()-this.startTime),l=ms(0,wf,a-wf),c=o.sample(a).value,{name:u}=this.options;s&&u&&D1(s,u,c),t.setWithVelocity(o.sample(Math.max(0,a-l)).value,c,l),o.stop()}},j0=(e,t)=>t==="zIndex"?!1:!!(typeof e=="number"||Array.isArray(e)||typeof e=="string"&&(Tn.test(e)||e==="0")&&!e.startsWith("url("));function NG(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 PG(e,t,n,r){const s=e[0];if(s===null)return!1;if(t==="display"||t==="visibility")return!0;const i=e[e.length-1],o=j0(s,t),a=j0(i,t);return!o||!a?(o!==a&&ph(!1,`You are trying to animate ${t} from "${s}" to "${i}". "${o?i:s}" is not an animatable value.`,"value-not-animatable"),!1):NG(e)||(n==="spring"||k1(n))&&r}function Cp(e){e.duration=0,e.type="keyframes"}var vp=new Set(["opacity","clipPath","filter","transform","backgroundColor"]),LG=/^(?:oklch|oklab|lab|lch|color|color-mix|light-dark)\(/;function _G(e){for(let t=0;t<e.length;t++)if(typeof e[t]=="string"&&LG.test(e[t]))return!0;return!1}var G0=new Set(["color","backgroundColor","outlineColor","fill","stroke","borderColor","borderTopColor","borderRightColor","borderBottomColor","borderLeftColor"]),FG=JD(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));function HG(e){const{motionValue:t,name:n,repeatDelay:r,repeatType:s,damping:i,type:o,keyframes:a}=e;if(!n||!(vp.has(n)||G0.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 FG()&&(vp.has(n)||G0.has(n)&&_G(a))&&(n!=="transform"||!u)&&!c&&!r&&s!=="mirror"&&i!==0&&o!=="inertia"}var jG=40,GG=class extends dC{constructor(e){super(),this.stop=()=>{this._animation&&(this._animation.stop(),this.stopTimeline?.()),this.keyframeResolver?.cancel()},this.createdAt=Ht.now();const{keyframes:t,name:n,motionValue:r,element:s}=e,i=e;i.autoplay??(i.autoplay=!0),i.delay??(i.delay=0),i.type??(i.type="keyframes"),i.repeat??(i.repeat=0),i.repeatDelay??(i.repeatDelay=0),i.repeatType??(i.repeatType="loop");const o=s?.KeyframeResolver||fC;this.keyframeResolver=new o(t,(a,l,c)=>this.onKeyframesResolved(a,l,i,!c),n,r,s),this.keyframeResolver?.scheduleResolve()}onKeyframesResolved(e,t,n,r){this.keyframeResolver=void 0;const{name:s,type:i,velocity:o,delay:a,isHandoff:l,onUpdate:c}=n;this.resolvedAt=Ht.now();let u=!0;PG(e,s,i,o)||(u=!1,(ds.instantAnimations||!a)&&c?.(mh(e,n,t)),e[0]=e[e.length-1],Cp(n),n.repeat=0);const d=r?this.resolvedAt?this.resolvedAt-this.createdAt>jG?this.resolvedAt:this.createdAt:this.createdAt:void 0,{onComplete:h}=n;n.startTime??(n.startTime=d),n.finalKeyframe=t,n.keyframes=e,n.onComplete=()=>{h?.(),this.notifyFinished()};const f=u&&!l&&HG(n);let B;if(f){n.element=n.motionValue?.owner?.current;try{B=new MG(n)}catch{B=new gd(n)}}else B=new gd(n);this.pendingTimeline&&(this.stopTimeline=B.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0),this._animation=B}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(),xG()),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 M1(e,t,n,r=0,s=1){const i=Array.from(e).sort((l,c)=>l.sortNodePosition(c)).indexOf(t),o=e.size,a=(o-1)*r;return typeof n=="function"?n(i,o):s===1?i*r:a-i*r}var V0=30,VG=e=>!isNaN(parseFloat(e)),U0={current:void 0},UG=class{constructor(e,t={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=n=>{const r=Ht.now();if(this.updatedAt!==r&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(n),this.current!==this.prev&&(this.notifyChange(),this.dependents))for(const s of this.dependents)s.dirty()},this.hasAnimated=!1,this.setCurrent(e),this.owner=t.owner}setCurrent(e){this.current=e,this.updatedAt=Ht.now(),this.canTrackVelocity===null&&e!==void 0&&(this.canTrackVelocity=VG(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 Bd)).add(t)}onChangeSubscribe(e){const{events:t}=this;return!t.change&&!this.changeSubscriber?this.changeSubscriber=e:(t.change||(t.change=new Bd,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(){qe.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 U0.current&&U0.current.push(this),this.current}getPrevious(){return this.prev}getVelocity(){const e=Ht.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||e-this.updatedAt>V0)return 0;const t=Math.min(this.updatedAt-this.prevUpdatedAt,V0);return QD(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 No(e,t){return new UG(e,t)}function N1(e,t){if(e?.inherit&&t){const{inherit:n,...r}=e;return{...t,...r}}return e}function BC(e,t){const n=e?.[t]??e?.default??e;return n!==e?N1(n,e):n}var zG={type:"spring",stiffness:500,damping:25,restSpeed:10},$G=e=>({type:"spring",stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),WG={type:"keyframes",duration:.8},qG={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},KG=(e,{keyframes:t})=>t.length>2?WG:Hs.has(e)?e.startsWith("scale")?$G(t[1]):zG:qG,JG=new Set(["when","delay","delayChildren","staggerChildren","staggerDirection","repeat","repeatType","repeatDelay","from","elapsed"]);function QG(e){for(const t in e)if(!JG.has(t))return!0;return!1}var pC=(e,t,n,r={},s,i)=>o=>{const a=BC(r,e)||{},l=a.delay||r.delay||0;let{elapsed:c=0}=r;c=c-Dn(l);const u={keyframes:Array.isArray(n)?n:[null,n],ease:"easeOut",velocity:t.getVelocity(),...a,delay:-c,onUpdate:h=>{t.set(h),a.onUpdate&&a.onUpdate(h)},onComplete:()=>{o(),a.onComplete&&a.onComplete()},name:e,motionValue:t,element:i?void 0:s};QG(a)||Object.assign(u,KG(e,u)),u.duration&&(u.duration=Dn(u.duration)),u.repeatDelay&&(u.repeatDelay=Dn(u.repeatDelay)),u.from!==void 0&&(u.keyframes[0]=u.from);let d=!1;if((u.type===!1||u.duration===0&&!u.repeatDelay)&&(Cp(u),u.delay===0&&(d=!0)),(ds.instantAnimations||ds.skipAnimations||s?.shouldSkipAnimations||a.skipAnimations)&&(d=!0,Cp(u),u.delay=0),u.allowFlatten=!a.type&&!a.ease,d&&!i&&t.get()!==void 0){const h=mh(u.keyframes,a);if(h!==void 0){qe.update(()=>{u.onUpdate(h),u.onComplete()});return}}return a.isSync?new gd(u):new GG(u)},YG=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function XG(e){const t=YG.exec(e);if(!t)return[,];const[,n,r,s]=t;return[`--${n??r}`,s]}var ZG=4;function P1(e,t,n=1){Mi(n<=ZG,`Max CSS variable fallback depth detected in property "${e}". This may indicate a circular fallback dependency.`,"max-css-var-depth");const[r,s]=XG(e);if(!r)return;const i=window.getComputedStyle(t).getPropertyValue(r);if(i){const o=i.trim();return Zg(o)?parseFloat(o):o}return sC(s)?P1(s,t,n+1):s}function eV(e){const t=[{},{}];return e?.values.forEach((n,r)=>{t[0][r]=n.get(),t[1][r]=n.getVelocity()}),t}function L1(e,t,n,r){const s=i=>typeof i=="function"?i(n!==void 0?n:e.custom,...eV(r)):i;return t=s(t),typeof t=="string"&&(t=e.variants&&e.variants[t]),s(t)}function Ei(e,t,n){return L1(e.getProps(),t,n,e)}var _1=(e,t)=>t==="exit"?e.presenceContext?.custom:void 0,F1=new Set(["width","height","top","left","right","bottom",...na]),tV=e=>Array.isArray(e);function nV(e,t,n){e.hasValue(t)?e.getValue(t).set(n):e.addValue(t,No(n))}function rV(e){return tV(e)?e[e.length-1]||0:e}function sV(e,t){let{transitionEnd:n={},transition:r={},...s}=Ei(e,t)||{};s={...s,...n};for(const i in s)nV(e,i,rV(s[i]))}var jt=e=>!!(e&&e.getVelocity);function iV(e){return!!(jt(e)&&e.add)}function yp(e,t){const n=e.getValue("willChange");if(iV(n))return n.add(t);if(!n&&ds.WillChange){const r=new ds.WillChange("auto");e.addValue("willChange",r),r.add(t)}}function mC(e){return e.replace(/([A-Z])/g,t=>`-${t.toLowerCase()}`)}var oV="framerAppearId",H1="data-"+mC(oV);function j1(e){return e.props[H1]}var aV=typeof window<"u";function lV({protectedKeys:e,needsAnimating:t},n){const r=n in e&&!t[n];return t[n]=!1,r}function G1(e,t,{delay:n=0,transitionOverride:r,type:s}={}){let{transition:i,transitionEnd:o,...a}=t;const l=e.getDefaultTransition();i=i?N1(i,l):l;const c=i?.reduceMotion,u=i?.skipAnimations;r&&(i=r);const d=[],h=s&&e.animationState?.getState()[s],f=i?.path;f&&f.animateVisualElement(e,a,i,n,d);for(const B in a){const g=e.getValue(B,e.latestValues[B]??null),C=a[B];if(C===void 0||h&&lV(h,B))continue;const v={delay:n,...BC(i||{},B)};u&&(v.skipAnimations=!0);const y=g.get();if(y!==void 0&&!g.isAnimating()&&!Array.isArray(C)&&C===y&&!v.velocity){qe.update(()=>g.set(C));continue}let S=!1;if(aV&&window.MotionHandoffAnimation){const A=j1(e);if(A){const x=window.MotionHandoffAnimation(A,B,qe);x!==null&&(v.startTime=x,S=!0)}}yp(e,B);const E=c??e.shouldReduceMotion;g.start(pC(B,g,C,E&&F1.has(B)?{type:!1}:v,e,S));const D=g.animation;D&&d.push(D)}if(o){const B=()=>qe.update(()=>{o&&sV(e,o)});d.length?Promise.all(d).then(B):B()}return d}function bp(e,t,n={}){const r=Ei(e,t,_1(e,n.type)),s=n.transitionOverride||(r?.transition??(e.getDefaultTransition()||{})),i=()=>Promise.all(r?G1(e,r,n):[]),o=(l=0)=>{const{variantChildren:c}=e,{delayChildren:u=0,staggerChildren:d,staggerDirection:h}=s,f=[];return c?.forEach(B=>{B.notify("AnimationStart",t),f.push(bp(B,t,{...n,delay:l+(typeof u=="function"?0:u)+M1(c,B,u,d,h)}).then(()=>B.notify("AnimationComplete",t)))}),Promise.all(f)},{when:a}=s;return a?a==="beforeChildren"?i().then(()=>o()):o().then(i):Promise.all([i(),o(n.delay)])}function cV(e,t,n={}){return e.notify("AnimationStart",t),(Array.isArray(t)?Promise.all(t.map(r=>bp(e,r,n))):typeof t=="string"?bp(e,t,n):Promise.all(G1(e,Ei(e,t,n.custom),n))).then(()=>{e.notify("AnimationComplete",t)})}var uV={test:e=>e==="auto",parse:e=>e},dV=e=>t=>t.test(e),hV=[ta,fe,Nr,Vr,Sj,bj,uV],z0=e=>hV.find(dV(e));function fV(e){return typeof e=="number"?e===0:e!==null?e==="none"||e==="0"||eC(e):!0}var BV=new Set(["auto","none","0"]);function pV(e,t,n){let r=0,s;for(;r<e.length&&!s;){const i=e[r];typeof i=="string"&&!BV.has(i)&&Aj(i)&&(s=e[r]),r++}if(s&&n)for(const i of t)e[i]!==s&&(e[i]=hC(n,s))}var mV=class extends fC{constructor(e,t,n,r,s){super(e,t,n,r,s,!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(),sC(l))){const c=P1(l,t.current);c!==void 0&&(e[a]=c),a===e.length-1&&(this.finalKeyframe=l)}}if(this.resolveNoneKeyframes(),!F1.has(n)||e.length!==2)return;const[r,s]=e;if(typeof r=="number"&&typeof s=="number")return;const i=z0(r),o=z0(s);if(D0(r)!==D0(s)&&bi[n]){this.needsMeasurement=!0;return}if(i!==o)if(_0(i)&&_0(o))for(let a=0;a<e.length;a++){const l=e[a];typeof l=="string"&&(e[a]=parseFloat(l))}else bi[n]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){const{unresolvedKeyframes:e,name:t}=this,n=[];for(let r=0;r<e.length;r++)(e[r]===null||fV(e[r]))&&n.push(r);n.length&&pV(e,n,t)}measure(){const{element:e,name:t}=this;return bi[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(([s,i])=>{e.getValue(s).set(i)}),this.resolveNoneKeyframes()}},gC=["borderTopLeftRadius","borderTopRightRadius","borderBottomRightRadius","borderBottomLeftRadius"];function gV(e){return KD(e)&&"offsetHeight"in e&&!("ownerSVGElement"in e)}function CC(e){return KD(e)&&"ownerSVGElement"in e}var Sp=(e,t)=>t&&typeof e=="number"?t.transform(e):e;function V1(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 s=n?.[e]??r.querySelectorAll(e);return s?Array.from(s):[]}return Array.from(e).filter(r=>r!=null)}var CV={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},vV=na.length;function yV(e,t,n){let r="",s=!0;for(let o=0;o<vV;o++){const a=na[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=Sp(l,Cd[a]);if(!c){s=!1;const d=CV[a]||a;r+=`${d}(${u}) `}n&&(t[a]=u)}}const i=e.pathRotation;return i&&(s=!1,r+=`rotate(${Sp(i,Cd.pathRotation)}) `),r=r.trim(),n?r=n(t,s?"":r):s&&(r="none"),r}function vC(e,t,n){const{style:r,vars:s,transformOrigin:i}=e;let o=!1,a=!1;for(const l in t){const c=t[l];if(Hs.has(l)){o=!0;continue}else if(a1(l)){s[l]=c;continue}else{const u=Sp(c,Cd[l]);l.startsWith("origin")?(a=!0,i[l]=u):r[l]=u}}if(t.transform||(o||n?r.transform=yV(t,e.transform,n):r.transform&&(r.transform="none")),a){const{originX:l="50%",originY:c="50%",originZ:u=0}=i;r.transformOrigin=`${l} ${c} ${u}`}}var bV={offset:"stroke-dashoffset",array:"stroke-dasharray"},SV={offset:"strokeDashoffset",array:"strokeDasharray"};function EV(e,t,n=1,r=0,s=!0){e.pathLength=1;const i=s?bV:SV;e[i.offset]=`${-r}`,e[i.array]=`${t} ${n}`}var U1=["transform","opacity","offsetDistance","offsetPath","offsetRotate","offsetAnchor"];function z1(e,{attrX:t,attrY:n,attrScale:r,pathLength:s,pathSpacing:i=1,pathOffset:o=0,...a},l,c,u){if(vC(e,a,c),l){e.style.viewBox&&(e.attrs.viewBox=e.style.viewBox);return}e.attrs=e.style,e.style={};const{attrs:d,style:h}=e;for(const f of U1)d[f]!==void 0&&(h[f]=d[f],delete d[f]);(h.transform||d.transformOrigin)&&(h.transformOrigin=d.transformOrigin??"50% 50%",delete d.transformOrigin),h.transform&&(h.transformBox=u?.transformBox??"fill-box",delete d.transformBox),t!==void 0&&(d.x=t),n!==void 0&&(d.y=n),r!==void 0&&(d.scale=r),s!==void 0&&EV(d,s,i,o,!1)}function $1({top:e,left:t,right:n,bottom:r}){return{x:{min:t,max:n},y:{min:e,max:r}}}function xV({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}function wV(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 Df(e){return e===void 0||e===1}function Ep({scale:e,scaleX:t,scaleY:n}){return!Df(e)||!Df(t)||!Df(n)}function di(e){return Ep(e)||W1(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function W1(e){return $0(e.x)||$0(e.y)}function $0(e){return e&&e!=="0%"}function vd(e,t,n){return n+t*(e-n)}function W0(e,t,n,r,s){return s!==void 0&&(e=vd(e,s,r)),vd(e,n,r)+t}function xp(e,t=0,n=1,r,s){e.min=W0(e.min,t,n,r,s),e.max=W0(e.max,t,n,r,s)}function q1(e,{x:t,y:n}){xp(e.x,t.translate,t.scale,t.originPoint),xp(e.y,n.translate,n.scale,n.originPoint)}var q0=.999999999999,K0=1.0000000000001;function DV(e,t,n,r=!1){const s=n.length;if(!s)return;t.x=t.y=1;let i,o;for(let a=0;a<s;a++){i=n[a],o=i.projectionDelta;const{visualElement:l}=i.options;l&&l.props.style&&l.props.style.display==="contents"||(r&&i.options.layoutScroll&&i.scroll&&i!==i.root&&(Dr(e.x,-i.scroll.offset.x),Dr(e.y,-i.scroll.offset.y)),o&&(t.x*=o.x.scale,t.y*=o.y.scale,q1(e,o)),r&&di(i.latestValues)&&Du(e,i.latestValues,i.layout?.layoutBox))}t.x<K0&&t.x>q0&&(t.x=1),t.y<K0&&t.y>q0&&(t.y=1)}function Dr(e,t){e.min+=t,e.max+=t}function J0(e,t,n,r,s=.5){xp(e,t,n,Ue(e.min,e.max,s),r)}function Q0(e,t){return typeof e=="string"?parseFloat(e)/100*(t.max-t.min):e}function Du(e,t,n){const r=n??e;J0(e.x,Q0(t.x,r.x),t.scaleX,t.scale,t.originX),J0(e.y,Q0(t.y,r.y),t.scaleY,t.scale,t.originY)}function K1(e,t){return $1(wV(e.getBoundingClientRect(),t))}function TV(e,t,n){const r=K1(e,n),{scroll:s}=t;return s&&(Dr(r.x,s.offset.x),Dr(r.y,s.offset.y)),r}var{schedule:yC,cancel:Are}=p1(queueMicrotask,!1),Jn={x:!1,y:!1};function J1(){return Jn.x||Jn.y}function AV(e){return e==="x"||e==="y"?Jn[e]?null:(Jn[e]=!0,()=>{Jn[e]=!1}):Jn.x||Jn.y?null:(Jn.x=Jn.y=!0,()=>{Jn.x=Jn.y=!1})}function Q1(e,t){const n=V1(e),r=new AbortController,s={passive:!0,...t,signal:r.signal};return[n,s,()=>r.abort()]}function IV(e){return!(e.pointerType==="touch"||J1())}function kV(e,t,n={}){const[r,s,i]=Q1(e,n);return r.forEach(o=>{let a=!1,l=!1,c;const u=()=>{o.removeEventListener("pointerleave",B)},d=C=>{c&&(c(C),c=void 0),u()},h=C=>{a=!1,window.removeEventListener("pointerup",h),window.removeEventListener("pointercancel",h),l&&(l=!1,d(C))},f=()=>{a=!0,window.addEventListener("pointerup",h,s),window.addEventListener("pointercancel",h,s)},B=C=>{if(C.pointerType!=="touch"){if(a){l=!0;return}d(C)}},g=C=>{if(!IV(C))return;l=!1;const v=t(o,C);typeof v=="function"&&(c=v,o.addEventListener("pointerleave",B,s))};o.addEventListener("pointerenter",g,s),o.addEventListener("pointerdown",f,s)}),i}var Y1=(e,t)=>t?e===t?!0:Y1(e,t.parentElement):!1,bC=e=>e.pointerType==="mouse"?typeof e.button!="number"||e.button<=0:e.isPrimary!==!1,RV=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function OV(e){return RV.has(e.tagName)||e.isContentEditable===!0}var MV=new Set(["INPUT","SELECT","TEXTAREA"]);function NV(e){return MV.has(e.tagName)||e.isContentEditable===!0}var Tu=new WeakSet;function Y0(e){return t=>{t.key==="Enter"&&e(t)}}function Tf(e,t){e.dispatchEvent(new PointerEvent("pointer"+t,{isPrimary:!0,bubbles:!0}))}var PV=(e,t)=>{const n=e.currentTarget;if(!n)return;const r=Y0(()=>{if(Tu.has(n))return;Tf(n,"down");const s=Y0(()=>{Tf(n,"up")}),i=()=>Tf(n,"cancel");n.addEventListener("keyup",s,t),n.addEventListener("blur",i,t)});n.addEventListener("keydown",r,t),n.addEventListener("blur",()=>n.removeEventListener("keydown",r),t)};function X0(e){return bC(e)&&!J1()}var Z0=new WeakSet;function LV(e,t,n={}){const[r,s,i]=Q1(e,n),o=a=>{const l=a.currentTarget;if(!X0(a)||Z0.has(a))return;Tu.add(l),n.stopPropagation&&Z0.add(a);const c=t(l,a),u={...s,capture:!0},d=(B,g)=>{window.removeEventListener("pointerup",h,u),window.removeEventListener("pointercancel",f,u),Tu.has(l)&&Tu.delete(l),X0(B)&&typeof c=="function"&&c(B,{success:g})},h=B=>{d(B,l===window||l===document||n.useGlobalTarget||Y1(l,B.target))},f=B=>{d(B,!1)};window.addEventListener("pointerup",h,u),window.addEventListener("pointercancel",f,u)};return r.forEach(a=>{(n.useGlobalTarget?window:a).addEventListener("pointerdown",o,s),gV(a)&&(a.addEventListener("focus",l=>PV(l,s)),!OV(a)&&!a.hasAttribute("tabindex")&&(a.tabIndex=0))}),i}var Au=new WeakMap,Iu,X1=(e,t,n)=>(r,s)=>s&&s[0]?s[0][e+"Size"]:CC(r)&&"getBBox"in r?r.getBBox()[t]:r[n],_V=X1("inline","width","offsetWidth"),FV=X1("block","height","offsetHeight");function HV({target:e,borderBoxSize:t}){Au.get(e)?.forEach(n=>{n(e,{get width(){return _V(e,t)},get height(){return FV(e,t)}})})}function jV(e){e.forEach(HV)}function GV(){typeof ResizeObserver>"u"||(Iu=new ResizeObserver(jV))}function VV(e,t){Iu||GV();const n=V1(e);return n.forEach(r=>{let s=Au.get(r);s||(s=new Set,Au.set(r,s)),s.add(t),Iu?.observe(r)}),()=>{n.forEach(r=>{const s=Au.get(r);s?.delete(t),s?.size||Iu?.unobserve(r)})}}var ku=new Set,fo;function UV(){fo=()=>{const e={get width(){return window.innerWidth},get height(){return window.innerHeight}};ku.forEach(t=>t(e))},window.addEventListener("resize",fo)}function zV(e){return ku.add(e),fo||UV(),()=>{ku.delete(e),!ku.size&&typeof fo=="function"&&(window.removeEventListener("resize",fo),fo=void 0)}}function ey(e,t){return typeof e=="function"?zV(e):VV(e,t)}var to={value:null,addProjectionMetrics:null};function $V(e){return CC(e)&&e.tagName==="svg"}var ty=e=>typeof e=="number"?e:parseFloat(e),ny=()=>({translate:0,scale:1,origin:0,originPoint:0}),Bo=()=>({x:ny(),y:ny()}),ry=()=>({min:0,max:0}),Et=()=>({x:ry(),y:ry()}),WV=new WeakMap;function gh(e){return e!==null&&typeof e=="object"&&typeof e.start=="function"}function Sl(e){return typeof e=="string"||Array.isArray(e)}var SC=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],sy=["initial",...SC];function Ch(e){if(gh(e.animate))return!0;for(let t=0;t<sy.length;t++)if(Sl(e[sy[t]]))return!0;return!1}function Z1(e){return!!(Ch(e)||e.variants)}function qV(e,t,n){for(const r in t){const s=t[r],i=n[r];if(jt(s))e.addValue(r,s);else if(jt(i))e.addValue(r,No(s,{owner:e}));else if(i!==s)if(e.hasValue(r)){const o=e.getValue(r);o.liveStyle===!0?o.jump(s):o.hasAnimated||o.set(s)}else{const o=e.getStaticValue(r);e.addValue(r,No(o!==void 0?o:s,{owner:e}))}}for(const r in n)t[r]===void 0&&e.removeValue(r);return t}var iy=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"],yd={};function eT(e){yd=e}function KV(){return yd}var JV=class{scrapeMotionValuesFromProps(e,t,n){return{}}constructor({parent:e,props:t,presenceContext:n,reducedMotionConfig:r,skipAnimations:s,blockInitialAnimation:i,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=fC,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 h=Ht.now();this.renderScheduledAt<h&&(this.renderScheduledAt=h,qe.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=s,this.options=a,this.blockInitialAnimation=!!i,this.isControllingVariants=Ch(t),this.isVariantNode=Z1(t),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(e&&e.current);const{willChange:u,...d}=this.scrapeMotionValuesFromProps(t,{},this);for(const h in d){const f=d[h];l[h]!==void 0&&jt(f)&&f.set(l[h])}}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,WV.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:(VN.current||UN(),this.shouldReduceMotion=jN.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(),Us(this.notifyUpdate),Us(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&&vp.has(e)&&this.current instanceof HTMLElement){const{factory:i,keyframes:o,times:a,ease:l,duration:c}=t.accelerate,u=new R1({element:this.current,name:e,keyframes:o,times:a,ease:l,duration:Dn(c)}),d=i(u);this.valueSubscriptions.set(e,()=>{d(),u.cancel()});return}const n=Hs.has(e);n&&this.onBindTransform&&this.onBindTransform();const r=t.on("change",i=>{this.latestValues[e]=i,this.props.onUpdate&&qe.preRender(this.notifyUpdate),n&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()});let s;typeof window<"u"&&window.MotionCheckAppearSync&&(s=window.MotionCheckAppearSync(this,e,t)),this.valueSubscriptions.set(e,()=>{r(),s&&s()})}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 yd){const t=yd[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 s=this.features[e];s.isMounted?s.update():(s.mount(),s.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):Et()}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<iy.length;n++){const r=iy[n];this.propEventSubscriptions[r]&&(this.propEventSubscriptions[r](),delete this.propEventSubscriptions[r]);const s=e["on"+r];s&&(this.propEventSubscriptions[r]=this.on(r,s))}this.prevMotionValues=qV(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=No(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"&&(Zg(n)||eC(n))?n=parseFloat(n):typeof n!="number"&&!Tn.test(n)&&Tn.test(t)&&(n=hC(e,t)),this.setBaseTarget(e,jt(n)?n.get():n)),jt(n)?n.get():n}setBaseTarget(e,t){this.baseTarget[e]=t}on(e,t){return this.events[e]||(this.events[e]=new Bd),this.events[e].add(t)}notify(e,...t){this.events[e]&&this.events[e].notify(...t)}scheduleRenderMicrotask(){yC.render(this.render)}},tT=class extends JV{constructor(){super(...arguments),this.KeyframeResolver=mV}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;jt(e)&&(this.childSubscription=e.on("change",t=>{this.current&&(this.current.textContent=`${t}`)}))}},Zs=class{constructor(e){this.isMounted=!1,this.node=e}update(){}};function nT(e,{style:t,vars:n},r,s){const i=e.style;let o;for(o in t)i[o]=t[o];s?.applyProjectionStyles(i,r);for(o in n)i.setProperty(o,n[o])}var El={};function rT(e,{layout:t,layoutId:n}){return Hs.has(e)||e.startsWith("origin")||(t||n!==void 0)&&(!!El[e]||e==="opacity")}function EC(e,t,n){const r=e.style,s=t?.style,i={};if(!r)return i;for(const o in r)(jt(r[o])||s&&jt(s[o])||rT(o,e)||n?.getValue(o)?.liveStyle!==void 0)&&(i[o]=r[o]);return i}function QV(e){return window.getComputedStyle(e)}var YV=class extends tT{constructor(){super(...arguments),this.type="html",this.renderInstance=nT}mount(e){Mi(!!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(Hs.has(t))return this.projection?.isProjecting?bl(t):CG(e,t);{const n=QV(e),r=(a1(t)?n.getPropertyValue(t):n[t])||0;return typeof r=="string"?r.trim():r}}measureInstanceViewportBox(e,{transformPagePoint:t}){return K1(e,t)}build(e,t,n){vC(e,t,n.transformTemplate)}scrapeMotionValuesFromProps(e,t,n){return EC(e,t,n)}},sT=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"]),iT=e=>typeof e=="string"&&e.toLowerCase()==="svg";function XV(e,t,n,r){nT(e,t,void 0,r);for(const s in t.attrs)e.setAttribute(sT.has(s)?s:mC(s),t.attrs[s])}function oT(e,t,n){const r=EC(e,t,n);for(const s in e)if(jt(e[s])||jt(t[s])){const i=na.indexOf(s)!==-1?"attr"+s.charAt(0).toUpperCase()+s.substring(1):s;r[i]=e[s]}return r}var ZV=class extends tT{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=Et}getBaseTargetFromProps(e,t){return Hs.has(t)?super.getBaseTargetFromProps(e,t)??bl(t):e[t]}getDefaultValue(e){return Hs.has(e)?this.latestValues[e]??bl(e):void 0}readValueFromInstance(e,t){if(Hs.has(t)){const n=E1(t);return n&&n.default||0}if(U1.includes(t)){const n=getComputedStyle(e)[t];if(typeof n=="string"&&n)return n.trim()}return t=sT.has(t)?t:mC(t),e.getAttribute(t)}scrapeMotionValuesFromProps(e,t,n){return oT(e,t,n)}build(e,t,n){z1(e,t,this.isSVGTag,n.transformTemplate,n.style)}renderInstance(e,t,n,r){XV(e,t,n,r)}mount(e){this.isSVGTag=iT(e.tagName),super.mount(e)}};function aT(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 eU=[...SC].reverse();function tU(e){let t=a=>Promise.all(a.map(({animation:l,options:c})=>cV(e,l,c))),n=oy(),r=!0,s=!1;function i(a){const{props:l,parent:c,manuallyAnimateOnMount:u}=e,d=r||s,h=[],f=new Set;let B={},g=1/0,C=e;do C=C.props.inherit!==!1&&C.parent;while(C&&!C.isControllingVariants);if(eU.forEach((y,S)=>{const E=n[y],D=l[y],A=C&&C.props[y],x=D!==void 0?D:Sl(A)||A===!1?A:void 0,O=Sl(x),R=y===a?E.isActive:null;R===!1&&(g=S);const P=O&&D===void 0&&!(d&&u);if(E.protectedKeys={...B},!E.isActive&&R===null||!x&&!E.prevProp||gh(x)||typeof x=="boolean")return;if(y==="exit"&&E.isActive&&R!==!0){B={...B,...E.prevResolvedValues};return}const _=nU(E.prevProp,x);let N=_||O&&(R&&!P||S>g),W=!1;const q=Array.isArray(x)?x:[x];let F={};if(R!==!1)for(const J of q){const{transition:Z,transitionEnd:Q,...G}=Ei(e,J,_1(e,y))||{};F={...F,...G,...Q}}const{prevResolvedValues:z}=E;for(const J in{...z,...F}){if(J in B)continue;const Z=F[J],Q=z[J],G=Array.isArray(Z)&&Array.isArray(Q)?!aT(Z,Q)||_:Z!==Q;if(G&&Z==null)f.add(J);else if(G||Z!==void 0&&f.has(J)){N=!0,f.delete(J)&&(W=!0),E.needsAnimating[J]=!0;const be=e.getValue(J);be&&(be.liveStyle=!1)}else E.protectedKeys[J]=!0}if(E.prevProp=x,E.prevResolvedValues=F,E.isActive&&(B={...B,...F}),N&&(!(P&&_)||W))for(const J of q){const Z={type:y};if(typeof J=="string"&&d&&u&&c?.enteringChildren){const Q=Ei(c,J)?.transition?.delayChildren;Z.delay=M1(c.enteringChildren,e,Q)}h.push({animation:J,options:Z})}}),f.size){const{initial:y}=l,S={},E=typeof y!="boolean"&&Ei(e,Array.isArray(y)?y[0]:y,e.presenceContext?.custom);E&&E.transition&&(S.transition=E.transition),f.forEach(D=>{const A=e.getValue(D);A&&(A.liveStyle=!0);const x=E&&!Array.isArray(y)?E[D]:void 0,O=e.getBaseTargetFromProps(l,D);S[D]=(x!==void 0?x:O!==void 0&&!jt(O)?O:e.initialValues[D]===void 0?e.baseTarget[D]:void 0)??null}),h.push({animation:S})}const v=d&&e.blockInitialAnimation||r&&!u&&(l.initial===!1||l.initial===l.animate);return r=s=!1,!v&&h.length?t(h):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=i(a);for(const u in n)n[u].protectedKeys={};return c}return{animateChanges:i,setActive:o,setAnimateFunction:a=>{t=a(e)},getState:()=>n,reset:()=>{n=oy(),s=!0}}}function nU(e,t){return typeof t=="string"?t!==e:Array.isArray(t)?!aT(t,e):!1}function oy(){const e={};for(const t of SC)e[t]={isActive:t==="animate",protectedKeys:{},needsAnimating:{},prevResolvedValues:{}};return e}function wp(e,t){e.min=t.min,e.max=t.max}function $n(e,t){wp(e.x,t.x),wp(e.y,t.y)}function ay(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}var rU=.9999,sU=1.0001,iU=-.01,oU=.01;function en(e){return e.max-e.min}function aU(e,t,n){return Math.abs(e-t)<=n}function ly(e,t,n,r=.5){e.origin=r,e.originPoint=Ue(t.min,t.max,e.origin),e.scale=en(n)/en(t),e.translate=Ue(n.min,n.max,e.origin)-e.originPoint,(e.scale>=rU&&e.scale<=sU||isNaN(e.scale))&&(e.scale=1),(e.translate>=iU&&e.translate<=oU||isNaN(e.translate))&&(e.translate=0)}function Wa(e,t,n,r){ly(e.x,t.x,n.x,r?r.originX:void 0),ly(e.y,t.y,n.y,r?r.originY:void 0)}function cy(e,t,n,r=0){e.min=(r?Ue(n.min,n.max,r):n.min)+t.min,e.max=e.min+en(t)}function lU(e,t,n,r){cy(e.x,t.x,n.x,r?.x),cy(e.y,t.y,n.y,r?.y)}function uy(e,t,n,r=0){const s=r?Ue(n.min,n.max,r):n.min;e.min=t.min-s,e.max=e.min+en(t)}function bd(e,t,n,r){uy(e.x,t.x,n.x,r?.x),uy(e.y,t.y,n.y,r?.y)}function dy(e,t,n,r,s){return e-=t,e=vd(e,1/n,r),s!==void 0&&(e=vd(e,1/s,r)),e}function cU(e,t=0,n=1,r=.5,s,i=e,o=e){if(Nr.test(t)&&(t=parseFloat(t),t=Ue(o.min,o.max,t/100)-o.min),typeof t!="number")return;let a=Ue(i.min,i.max,r);e===i&&(a-=t),e.min=dy(e.min,t,n,a,s),e.max=dy(e.max,t,n,a,s)}function hy(e,t,[n,r,s],i,o){cU(e,t[n],t[r],t[s],t.scale,i,o)}var uU=["x","scaleX","originX"],dU=["y","scaleY","originY"];function fy(e,t,n,r){hy(e.x,t,uU,n?n.x:void 0,r?r.x:void 0),hy(e.y,t,dU,n?n.y:void 0,r?r.y:void 0)}function By(e){return e.translate===0&&e.scale===1}function lT(e){return By(e.x)&&By(e.y)}function py(e,t){return e.min===t.min&&e.max===t.max}function hU(e,t){return py(e.x,t.x)&&py(e.y,t.y)}function my(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function cT(e,t){return my(e.x,t.x)&&my(e.y,t.y)}function gy(e){return en(e.x)/en(e.y)}function Cy(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}function xr(e){return[e("x"),e("y")]}function vy(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}var ha={correct:(e,t)=>{if(!t.target)return e;if(typeof e=="string")if(fe.test(e))e=parseFloat(e);else return e;return`${vy(e,t.target.x)}% ${vy(e,t.target.y)}%`}},fU={correct:(e,{treeScale:t,projectionDelta:n})=>{const r=e,s=Tn.parse(e);if(s.length>5)return r;const i=Tn.createTransformer(e),o=typeof s[0]!="number"?1:0,a=n.x.scale*t.x,l=n.y.scale*t.y;s[0+o]/=a,s[1+o]/=l;const c=Ue(a,l,.5);return typeof s[2+o]=="number"&&(s[2+o]/=c),typeof s[3+o]=="number"&&(s[3+o]/=c),i(s)}};function BU(e,t,n){let r="";const s=e.x.translate/t.x,i=e.y.translate/t.y,o=n?.z||0;if((s||i||o)&&(r=`translate3d(${s}px, ${i}px, ${o}px) `),(t.x!==1||t.y!==1)&&(r+=`scale(${1/t.x}, ${1/t.y}) `),n){const{transformPerspective:c,rotate:u,pathRotation:d,rotateX:h,rotateY:f,skewX:B,skewY:g}=n;c&&(r=`perspective(${c}px) ${r}`),u&&(r+=`rotate(${u}deg) `),d&&(r+=`rotate(${d}deg) `),h&&(r+=`rotateX(${h}deg) `),f&&(r+=`rotateY(${f}deg) `),B&&(r+=`skewX(${B}deg) `),g&&(r+=`skewY(${g}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 pU=gC.length,yy=e=>typeof e=="number"||fe.test(e);function mU(e,t,n,r,s,i){s?(e.opacity=Ue(0,n.opacity??1,gU(r)),e.opacityExit=Ue(t.opacity??1,0,CU(r))):i&&(e.opacity=Ue(t.opacity??1,n.opacity??1,r));for(let o=0;o<pU;o++){const a=gC[o];let l=by(t,a),c=by(n,a);l===void 0&&c===void 0||(l||(l=0),c||(c=0),l===0||c===0||yy(l)===yy(c)?(e[a]=Math.max(Ue(ty(l),ty(c),r),0),(Nr.test(c)||Nr.test(l))&&(e[a]+="%")):e[a]=c)}(t.rotate||n.rotate)&&(e.rotate=Ue(t.rotate||0,n.rotate||0,r))}function by(e,t){return e[t]!==void 0?e[t]:e.borderRadius}var gU=uT(0,.5,r1),CU=uT(.5,.95,sr);function uT(e,t,n){return r=>r<e?0:r>t?1:n(Cl(e,t,r))}function vU(e,t,n){const r=jt(e)?e:No(e);return r.start(pC("",r,t,n)),r.animation}function xl(e,t,n,r={passive:!0}){return e.addEventListener(t,n,r),()=>e.removeEventListener(t,n,r)}var yU=(e,t)=>e.depth-t.depth,bU=class{constructor(){this.children=[],this.isDirty=!1}add(e){Xg(this.children,e),this.isDirty=!0}remove(e){fd(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(yU),this.isDirty=!1,this.children.forEach(e)}};function SU(e,t){const n=Ht.now(),r=({timestamp:s})=>{const i=s-n;i>=t&&(Us(r),e(i-t))};return qe.setup(r,!0),()=>Us(r)}function Ru(e){return jt(e)?e.get():e}var EU=class{constructor(){this.members=[]}add(e){Xg(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&&(fd(this.members,n),n.unmount())}e.scheduleRender()}remove(e){if(fd(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:s}=e.options;(r===void 0||r!==s)&&(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)}},xU={borderRadius:{...ha,applyTo:[...gC]},borderTopLeftRadius:ha,borderTopRightRadius:ha,borderBottomLeftRadius:ha,borderBottomRightRadius:ha,boxShadow:fU},Ou={hasAnimatedSinceResize:!0,hasEverUpdated:!1};Object.assign(El,{...xU,...El});var hi={nodes:0,calculatedTargetDeltas:0,calculatedProjections:0},Af=["","X","Y","Z"],wU=1e3,DU=0;function If(e,t,n,r){const{latestValues:s}=t;s[e]&&(n[e]=s[e],t.setStaticValue(e,0),r&&(r[e]=0))}function dT(e){if(e.hasCheckedOptimisedAppear=!0,e.root===e)return;const{visualElement:t}=e.options;if(!t)return;const n=j1(t);if(window.MotionHasOptimisedAnimation(n,"transform")){const{layout:s,layoutId:i}=e.options;window.MotionCancelOptimisedAnimation(n,"transform",qe,!(s||i))}const{parent:r}=e;r&&!r.hasCheckedOptimisedAppear&&dT(r)}function hT({attachResizeListener:e,defaultParent:t,measureScroll:n,checkIsScrollRoot:r,resetTransform:s}){return class{constructor(o={},a=t?.()){this.id=DU++,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,to.value&&(hi.nodes=hi.calculatedTargetDeltas=hi.calculatedProjections=0),this.nodes.forEach(IU),this.nodes.forEach(LU),this.nodes.forEach(_U),this.nodes.forEach(kU),to.addProjectionMetrics&&to.addProjectionMetrics(hi)},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 bU)}addEventListener(o,a){return this.eventHandlers.has(o)||this.eventHandlers.set(o,new Bd),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=CC(o)&&!$V(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,d=0;const h=()=>this.root.updateBlockedByResize=!1;qe.read(()=>{d=window.innerWidth}),e(o,()=>{const f=window.innerWidth;f!==d&&(d=f,this.root.updateBlockedByResize=!0,u&&u(),u=SU(h,250),Ou.hasAnimatedSinceResize&&(Ou.hasAnimatedSinceResize=!1,this.nodes.forEach(xy)))})}a&&this.root.registerSharedNode(a,this),this.options.animate!==!1&&c&&(a||l)&&this.addEventListener("didUpdate",({delta:u,hasLayoutChanged:d,hasRelativeLayoutChanged:h,layout:f})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const B=this.options.transition||c.getDefaultTransition()||VU,{onLayoutAnimationStart:g,onLayoutAnimationComplete:C}=c.getProps(),v=!this.targetLayout||!cT(this.targetLayout,f),y=!d&&h;if(this.options.layoutRoot||this.resumeFrom||y||d&&(v||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);const S={...BC(B,"layout"),onPlay:g,onComplete:C};(c.shouldReduceMotion||this.options.layoutRoot)&&(S.delay=0,S.type=!1),this.startAnimation(S),this.setAnimationOrigin(u,y,S.path)}else d||xy(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=f})}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(),Us(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(FU),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&&dT(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let u=0;u<this.path.length;u++){const d=this.path[u];d.shouldResetTransform=!0,(typeof d.latestValues.x=="string"||typeof d.latestValues.y=="string")&&(d.isLayoutDirty=!0),d.updateScroll("snapshot"),d.options.layoutRoot&&d.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(OU),this.nodes.forEach(Sy);return}if(this.animationId<=this.animationCommitId){this.nodes.forEach(Ey);return}this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(MU),this.nodes.forEach(NU),this.nodes.forEach(PU),this.nodes.forEach(TU),this.nodes.forEach(AU)):this.nodes.forEach(Ey),this.clearAllSnapshots();const o=Ht.now();xt.delta=ms(0,1e3/60,o-xt.timestamp),xt.timestamp=o,xt.isProcessing=!0,Ef.update.process(xt),Ef.preRender.process(xt),Ef.render.process(xt),xt.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,yC.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(RU),this.sharedNodes.forEach(HU)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,qe.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){qe.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure(),this.snapshot&&!en(this.snapshot.measuredBox.x)&&!en(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=Et()),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(!s)return;const o=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,a=this.projectionDelta&&!lT(this.projectionDelta),l=this.getTransformTemplate(),c=l?l(this.latestValues,""):void 0,u=c!==this.prevTransformTemplateValue;o&&this.instance&&(a||di(this.latestValues)||u)&&(s(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)),UU(l),{animationId:this.root.animationId,measuredBox:a,layoutBox:l,latestValues:{},source:this.id}}measurePageBox(){const{visualElement:o}=this.options;if(!o)return Et();const a=o.measureViewportBox();if(!(this.scroll?.wasRoot||this.path.some(zU))){const{scroll:l}=this.root;l&&(Dr(a.x,l.offset.x),Dr(a.y,l.offset.y))}return a}removeElementScroll(o){const a=Et();if($n(a,o),this.scroll?.wasRoot)return a;for(let l=0;l<this.path.length;l++){const c=this.path[l],{scroll:u,options:d}=c;c!==this.root&&u&&d.layoutScroll&&(u.wasRoot&&$n(a,o),Dr(a.x,u.offset.x),Dr(a.y,u.offset.y))}return a}applyTransform(o,a=!1,l){const c=l||Et();$n(c,o);for(let u=0;u<this.path.length;u++){const d=this.path[u];!a&&d.options.layoutScroll&&d.scroll&&d!==d.root&&(Dr(c.x,-d.scroll.offset.x),Dr(c.y,-d.scroll.offset.y)),di(d.latestValues)&&Du(c,d.latestValues,d.layout?.layoutBox)}return di(this.latestValues)&&Du(c,this.latestValues,this.layout?.layoutBox),c}removeTransform(o){const a=Et();$n(a,o);for(let l=0;l<this.path.length;l++){const c=this.path[l];if(!di(c.latestValues))continue;let u;c.instance&&(Ep(c.latestValues)&&c.updateSnapshot(),u=Et(),$n(u,c.measurePageBox())),fy(a,c.latestValues,c.snapshot?.layoutBox,u)}return di(this.latestValues)&&fy(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!==xt.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=xt.timestamp;const d=this.getClosestProjectingParent();!this.targetDelta&&!this.relativeTarget&&(this.options.layoutAnchor!==!1&&d&&d.layout?this.createRelativeTarget(d,this.layout.layoutBox,d.layout.layoutBox):this.removeRelativeTarget()),!(!this.relativeTarget&&!this.targetDelta)&&(this.target||(this.target=Et(),this.targetWithTransforms=Et()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),lU(this.target,this.relativeTarget,this.relativeParent.target,this.options.layoutAnchor||void 0)):this.targetDelta?(this.resumingFrom?this.applyTransform(this.layout.layoutBox,!1,this.target):$n(this.target,this.layout.layoutBox),q1(this.target,this.targetDelta)):$n(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget&&(this.attemptToResolveRelativeTarget=!1,this.options.layoutAnchor!==!1&&d&&!!d.resumingFrom==!!this.resumingFrom&&!d.options.layoutScroll&&d.target&&this.animationProgress!==1?this.createRelativeTarget(d,this.target,d.target):this.relativeParent=this.relativeTarget=void 0),to.value&&hi.calculatedTargetDeltas++)}getClosestProjectingParent(){if(!(!this.parent||Ep(this.parent.latestValues)||W1(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=Et(),this.relativeTargetOrigin=Et(),bd(this.relativeTargetOrigin,a,l,this.options.layoutAnchor||void 0),$n(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===xt.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;$n(this.layoutCorrected,this.layout.layoutBox);const d=this.treeScale.x,h=this.treeScale.y;DV(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=Et());const{target:f}=o;if(!f){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(ay(this.prevProjectionDelta.x,this.projectionDelta.x),ay(this.prevProjectionDelta.y,this.projectionDelta.y)),Wa(this.projectionDelta,this.layoutCorrected,f,this.latestValues),(this.treeScale.x!==d||this.treeScale.y!==h||!Cy(this.projectionDelta.x,this.prevProjectionDelta.x)||!Cy(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",f)),to.value&&hi.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=Bo(),this.projectionDelta=Bo(),this.projectionDeltaWithTransform=Bo()}setAnimationOrigin(o,a=!1,l){const c=this.snapshot,u=c?c.latestValues:{},d={...this.latestValues},h=Bo();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!a;const f=Et(),B=(c?c.source:void 0)!==(this.layout?this.layout.source:void 0),g=this.getStack(),C=!g||g.members.length<=1,v=!!(B&&!C&&this.options.crossfade===!0&&!this.path.some(GU));this.animationProgress=0;let y;const S=l?.interpolateProjection(o);this.mixTargetDelta=E=>{const D=E/1e3,A=S?.(D);A?(h.x.translate=A.x,h.x.scale=Ue(o.x.scale,1,D),h.x.origin=o.x.origin,h.x.originPoint=o.x.originPoint,h.y.translate=A.y,h.y.scale=Ue(o.y.scale,1,D),h.y.origin=o.y.origin,h.y.originPoint=o.y.originPoint):(wy(h.x,o.x,D),wy(h.y,o.y,D)),this.setTargetDelta(h),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(bd(f,this.layout.layoutBox,this.relativeParent.layout.layoutBox,this.options.layoutAnchor||void 0),jU(this.relativeTarget,this.relativeTargetOrigin,f,D),y&&hU(this.relativeTarget,y)&&(this.isProjectionDirty=!1),y||(y=Et()),$n(y,this.relativeTarget)),B&&(this.animationValues=d,mU(d,u,this.latestValues,D,v,C)),A&&A.rotate!==void 0&&(this.animationValues||(this.animationValues=d),this.animationValues.pathRotation=A.rotate),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=D},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(o){this.notifyListeners("animationStart"),this.currentAnimation?.stop(),this.resumingFrom?.currentAnimation?.stop(),this.pendingAnimation&&(Us(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=qe.update(()=>{Ou.hasAnimatedSinceResize=!0,this.motionValue||(this.motionValue=No(0)),this.motionValue.jump(0,!1),this.currentAnimation=vU(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()}}),aG(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(wU),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&&fT(this.options.animationType,this.layout.layoutBox,l.layoutBox)){u=this.target||Et();const d=en(this.layout.layoutBox.x);u.x.min=o.target.x.min,u.x.max=u.x.min+d;const h=en(this.layout.layoutBox.y);u.y.min=o.target.y.min,u.y.max=u.y.min+h}$n(a,u),Du(a,c),Wa(this.projectionDeltaWithTransform,this.layoutCorrected,a,c)}}registerSharedNode(o,a){this.sharedNodes.has(o)||this.sharedNodes.set(o,new EU),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&&If("z",o,c,this.animationValues);for(let u=0;u<Af.length;u++)If(`rotate${Af[u]}`,o,c,this.animationValues),If(`skew${Af[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=Ru(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=Ru(a?.pointerEvents)||""),this.hasProjected&&!di(this.latestValues)&&(o.transform=l?l({},""):"none",this.hasProjected=!1);return}o.visibility="";const u=c.animationValues||c.latestValues;this.applyTransformsToTarget();let d=BU(this.projectionDeltaWithTransform,this.treeScale,u);l&&(d=l(u,d)),o.transform=d;const{x:h,y:f}=this.projectionDelta;o.transformOrigin=`${h.origin*100}% ${f.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 B in El){if(u[B]===void 0)continue;const{correct:g,applyTo:C,isCSSVariable:v}=El[B],y=d==="none"?u[B]:g(u[B],c);if(C){const S=C.length;for(let E=0;E<S;E++)o[C[E]]=y}else v?this.options.visualElement.renderState.vars[B]=y:o[B]=y}this.options.layoutId&&(o.pointerEvents=c===this?Ru(a?.pointerEvents)||"":"none")}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(o=>o.currentAnimation?.stop()),this.root.nodes.forEach(Sy),this.root.sharedNodes.clear()}}}function TU(e){e.updateLayout()}function AU(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:s}=e.options,i=t.source!==e.layout.source;if(s==="size")xr(u=>{const d=i?t.measuredBox[u]:t.layoutBox[u],h=en(d);d.min=n[u].min,d.max=d.min+h});else if(s==="x"||s==="y"){const u=s==="x"?"y":"x";wp(i?t.measuredBox[u]:t.layoutBox[u],n[u])}else fT(s,t.layoutBox,n)&&xr(u=>{const d=i?t.measuredBox[u]:t.layoutBox[u],h=en(n[u]);d.max=d.min+h,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[u].max=e.relativeTarget[u].min+h)});const o=Bo();Wa(o,n,t.layoutBox);const a=Bo();i?Wa(a,e.applyTransform(r,!0),t.measuredBox):Wa(a,n,t.layoutBox);const l=!lT(o);let c=!1;if(!e.resumeFrom){const u=e.getClosestProjectingParent();if(u&&!u.resumeFrom){const{snapshot:d,layout:h}=u;if(d&&h){const f=e.options.layoutAnchor||void 0,B=Et();bd(B,t.layoutBox,d.layoutBox,f);const g=Et();bd(g,n,h.layoutBox,f),cT(B,g)||(c=!0),u.options.layoutRoot&&(e.relativeTarget=g,e.relativeTargetOrigin=B,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 IU(e){to.value&&hi.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 kU(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function RU(e){e.clearSnapshot()}function Sy(e){e.clearMeasurements()}function OU(e){e.isLayoutDirty=!0,e.updateLayout()}function Ey(e){e.isLayoutDirty=!1}function MU(e){e.isAnimationBlocked&&e.layout&&!e.isLayoutDirty&&(e.snapshot=e.layout,e.isLayoutDirty=!0)}function NU(e){e.relativeTarget&&e.relativeParent?.isLayoutDirty&&(e.currentAnimation?e.isLayoutDirty=!0:(e.targetDelta=void 0,e.removeRelativeTarget()))}function PU(e){const{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify("BeforeLayoutMeasure"),e.resetTransform()}function xy(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function LU(e){e.resolveTargetDelta()}function _U(e){e.calcProjection()}function FU(e){e.resetSkewAndRotation()}function HU(e){e.removeLeadSnapshot()}function wy(e,t,n){e.translate=Ue(t.translate,0,n),e.scale=Ue(t.scale,1,n),e.origin=t.origin,e.originPoint=t.originPoint}function Dy(e,t,n,r){e.min=Ue(t.min,n.min,r),e.max=Ue(t.max,n.max,r)}function jU(e,t,n,r){Dy(e.x,t.x,n.x,r),Dy(e.y,t.y,n.y,r)}function GU(e){return e.animationValues&&e.animationValues.opacityExit!==void 0}var VU={duration:.45,ease:[.4,0,.1,1]},Ty=e=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),Ay=Ty("applewebkit/")&&!Ty("chrome/")?Math.round:sr;function Iy(e){e.min=Ay(e.min),e.max=Ay(e.max)}function UU(e){Iy(e.x),Iy(e.y)}function fT(e,t,n){return e==="position"||e==="preserve-aspect"&&!aU(gy(t),gy(n),.2)}function zU(e){return e!==e.root&&e.scroll?.wasRoot}var $U=hT({attachResizeListener:(e,t)=>xl(e,"resize",t),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body?.scrollLeft||0,y:document.documentElement.scrollTop||document.body?.scrollTop||0}),checkIsScrollRoot:()=>!0}),kf={current:void 0},BT=hT({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!kf.current){const e=new $U({});e.mount(window),e.setOptions({layoutScroll:!0}),kf.current=e}return kf.current},resetTransform:(e,t)=>{e.style.transform=t!==void 0?t:"none"},checkIsScrollRoot:e=>window.getComputedStyle(e).position==="fixed"}),pT=(0,p.createContext)({transformPagePoint:e=>e,isStatic:!1,reducedMotion:"never"});function WU(e=!0){const t=(0,p.useContext)(Bh);if(t===null)return[!0,null];const{isPresent:n,onExitComplete:r,register:s}=t,i=(0,p.useId)();(0,p.useEffect)(()=>{if(e)return s(i)},[e]);const o=(0,p.useCallback)(()=>e&&r&&r(i),[i,r,e]);return!n&&r?[!1,o]:[!0]}function kre(){return qU((0,p.useContext)(Bh))}function qU(e){return e===null?!0:e.isPresent}var mT=(0,p.createContext)({strict:!1}),ky={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"]},Ry=!1;function KU(){if(Ry)return;const e={};for(const t in ky)e[t]={isEnabled:n=>ky[t].some(r=>!!n[r])};eT(e),Ry=!0}function gT(){return KU(),KV()}function JU(e){const t=gT();for(const n in e)t[n]={...t[n],...e[n]};eT(t)}var vh=(0,p.createContext)({});function QU(e,t){if(Ch(e)){const{initial:n,animate:r}=e;return{initial:n===!1||Sl(n)?n:void 0,animate:Sl(r)?r:void 0}}return e.inherit!==!1?t:{}}function YU(e){const{initial:t,animate:n}=QU(e,(0,p.useContext)(vh));return(0,p.useMemo)(()=>({initial:t,animate:n}),[Oy(t),Oy(n)])}function Oy(e){return Array.isArray(e)?e.join(" "):e}var xC=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function CT(e,t,n){for(const r in t)!jt(t[r])&&!rT(r,n)&&(e[r]=t[r])}function XU({transformTemplate:e},t){return(0,p.useMemo)(()=>{const n=xC();return vC(n,t,e),Object.assign({},n.vars,n.style)},[t])}function ZU(e,t){const n=e.style||{},r={};return CT(r,n,e),Object.assign(r,XU(e,t)),r}function ez(e,t){const n={},r=ZU(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 vT=()=>({...xC(),attrs:{}});function tz(e,t,n,r){const s=(0,p.useMemo)(()=>{const i=vT();return z1(i,t,iT(r),e.transformTemplate,e.style),{...i.attrs,style:{...i.style}}},[t]);if(e.style){const i={};CT(i,e.style,e),s.style={...i,...s.style}}return s}var nz=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 Sd(e){return e.startsWith("while")||e.startsWith("drag")&&e!=="draggable"||e.startsWith("layout")||e.startsWith("onTap")||e.startsWith("onPan")||e.startsWith("onLayout")||nz.has(e)}function rz(e,t){return e.startsWith("on")?!Sd(e):t?.(e)??!Sd(e)}function sz(e,t,n,r){const s={};for(const i in e)i==="values"&&typeof e.values=="object"||jt(e[i])||(rz(i,r)||n===!0&&Sd(i)||!t&&!Sd(i)||e.draggable&&i.startsWith("onDrag"))&&(s[i]=e[i]);return s}var iz=["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 wC(e){return typeof e!="string"||e.includes("-")?!1:!!(iz.indexOf(e)>-1||/[A-Z]/u.test(e))}function oz(e,t,n,{latestValues:r},s,i=!1,o,a){const l=(o??wC(e)?tz:ez)(t,r,s,e),c=sz(t,typeof e=="string",i,a),u=e!==p.Fragment?{...c,...l,ref:n}:{},{children:d}=t,h=(0,p.useMemo)(()=>jt(d)?d.get():d,[d]);return(0,p.createElement)(e,{...u,children:h})}function az({scrapeMotionValuesFromProps:e,createRenderState:t},n,r,s){return{latestValues:lz(n,r,s,e),renderState:t()}}function lz(e,t,n,r){const s={},i=r(e,{});for(const h in i)s[h]=Ru(i[h]);let{initial:o,animate:a}=e;const l=Ch(e),c=Z1(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 d=u?a:o;if(d&&typeof d!="boolean"&&!gh(d)){const h=Array.isArray(d)?d:[d];for(let f=0;f<h.length;f++){const B=L1(e,h[f]);if(B){const{transitionEnd:g,transition:C,...v}=B;for(const y in v){let S=v[y];if(Array.isArray(S)){const E=u?S.length-1:0;S=S[E]}S!==null&&(s[y]=S)}for(const y in g)s[y]=g[y]}}}return s}var yT=e=>(t,n)=>{const r=(0,p.useContext)(vh),s=(0,p.useContext)(Bh),i=()=>az(e,t,r,s);return n?i():ij(i)},cz=yT({scrapeMotionValuesFromProps:EC,createRenderState:xC}),uz=yT({scrapeMotionValuesFromProps:oT,createRenderState:vT}),dz=Symbol.for("motionComponentSymbol");function hz(e,t,n){const r=(0,p.useRef)(n);(0,p.useInsertionEffect)(()=>{r.current=n});const s=(0,p.useRef)(null);return(0,p.useCallback)(i=>{i&&e.onMount?.(i),t&&(i?t.mount(i):t.unmount());const o=r.current;if(typeof o=="function")if(i){const a=o(i);typeof a=="function"&&(s.current=a)}else s.current?(s.current(),s.current=null):o(i);else o&&(o.current=i)},[t])}var bT=(0,p.createContext)({});function no(e){return e&&typeof e=="object"&&Object.prototype.hasOwnProperty.call(e,"current")}function fz(e,t,n,r,s,i){const{visualElement:o}=(0,p.useContext)(vh),a=(0,p.useContext)(mT),l=(0,p.useContext)(Bh),c=(0,p.useContext)(pT),u=c.reducedMotion,d=c.skipAnimations,h=(0,p.useRef)(null),f=(0,p.useRef)(!1);r=r||a.renderer,!h.current&&r&&(h.current=r(e,{visualState:t,parent:o,props:n,presenceContext:l,blockInitialAnimation:l?l.initial===!1:!1,reducedMotionConfig:u,skipAnimations:d,isSVG:i}),f.current&&h.current&&(h.current.manuallyAnimateOnMount=!0));const B=h.current,g=(0,p.useContext)(bT);B&&!B.projection&&s&&(B.type==="html"||B.type==="svg")&&Bz(h.current,n,s,g);const C=(0,p.useRef)(!1);(0,p.useInsertionEffect)(()=>{B&&C.current&&B.update(n,l)});const v=n[H1],y=(0,p.useRef)(!!v&&typeof window<"u"&&!window.MotionHandoffIsComplete?.(v)&&window.MotionHasOptimisedAnimation?.(v));return E0(()=>{!f.current||!B||(B.animationState?.animateChanges(),B.enteringChildren=void 0)},[]),E0(()=>{f.current=!0,B&&(C.current=!0,window.MotionIsMounted=!0,B.updateFeatures(),B.scheduleRenderMicrotask(),y.current&&B.animationState&&B.animationState.animateChanges())}),(0,p.useEffect)(()=>{B&&(!y.current&&B.animationState&&B.animationState.animateChanges(),y.current&&(queueMicrotask(()=>{window.MotionHandoffMarkAsComplete?.(v)}),y.current=!1),B.enteringChildren=void 0)}),B}function Bz(e,t,n,r){const{layoutId:s,layout:i,drag:o,dragConstraints:a,layoutScroll:l,layoutRoot:c,layoutAnchor:u,layoutCrossfade:d}=t;e.projection=new n(e.latestValues,t["data-framer-portal-id"]?void 0:ST(e.parent)),e.projection.setOptions({layoutId:s,layout:i,alwaysMeasureLayout:!!o||a&&no(a),visualElement:e,animationType:typeof i=="string"?i:"both",initialPromotionConfig:r,crossfade:d,layoutScroll:l,layoutRoot:c,layoutAnchor:u})}function ST(e){if(e)return e.options.allowProjection!==!1?e.projection:ST(e.parent)}function Rf(e,{forwardMotionProps:t=!1,type:n}={},r,s){r&&JU(r);const i=n?n==="svg":wC(e),o=i?uz:cz;function a(c,u){let d;const h={...(0,p.useContext)(pT),...c,layoutId:pz(c)},{isStatic:f,isValidProp:B}=h,g=YU(c),C=o(c,f);if(!f&&typeof window<"u"){mz(h,r);const v=gz(h);d=v.MeasureLayout,g.visualElement=fz(e,C,h,s,v.ProjectionNode,i)}return(0,m.jsxs)(vh.Provider,{value:g,children:[d&&g.visualElement?(0,m.jsx)(d,{visualElement:g.visualElement,...h}):null,oz(e,c,hz(C,g.visualElement,u),C,f,t,i,B)]})}a.displayName=`motion.${typeof e=="string"?e:`create(${e.displayName??e.name??""})`}`;const l=(0,p.forwardRef)(a);return l[dz]=e,l}function pz({layoutId:e}){const t=(0,p.useContext)(qD).id;return t&&e!==void 0?t+"-"+e:e}function mz(e,t){(0,p.useContext)(mT).strict}function gz(e){const{drag:t,layout:n}=gT();if(!t&&!n)return{};const r={...t,...n};return{MeasureLayout:t?.isEnabled(e)||n?.isEnabled(e)?r.MeasureLayout:void 0,ProjectionNode:r.ProjectionNode}}function Cz(e,t){if(typeof Proxy>"u")return Rf;const n=new Map,r=(i,o)=>Rf(i,o,e,t),s=(i,o)=>r(i,o);return new Proxy(s,{get:(i,o)=>o==="create"?r:(n.has(o)||n.set(o,Rf(o,void 0,e,t)),n.get(o))})}var vz=(e,t)=>t.isSVG??wC(e)?new ZV(t):new YV(t,{allowProjection:e!==p.Fragment}),yz=class extends Zs{constructor(e){super(e),e.animationState||(e.animationState=tU(e))}updateAnimationControlsSubscription(){const{animate:e}=this.node.getProps();gh(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?.()}},bz=0,Sz=class extends Zs{constructor(){super(...arguments),this.id=bz++}update(){const{presenceContext:e,prevPresenceContext:t,animationState:n}=this.node;if(!e||!n)return;const{isPresent:r,onExitComplete:s}=e,i=t?.isPresent;if(r===i)return;if(r&&i===!1){if(this.exit===!0){const{initial:a}=this.node.getProps();if(a&&!Array.isArray(a)){const{transition:l,transitionEnd:c,...u}=Ei(this.node,a)||{};for(const d in u)this.node.getValue(d)?.jump(u[d])}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);s&&!r&&o.then(()=>{this.exit===o&&(this.exit=!0,s(this.id))})}mount(){const{register:e,onExitComplete:t}=this.node.presenceContext||{};t&&t(this.id),e&&(this.unmount=e(this.id))}unmount(){}},Ez={animation:{Feature:yz},exit:{Feature:Sz}};function yh(e){return{point:{x:e.pageX,y:e.pageY}}}var xz=e=>t=>bC(t)&&e(t,yh(t));function qa(e,t,n,r){return xl(e,t,xz(n),r)}var ET=({current:e})=>e?e.ownerDocument.defaultView:null,My=(e,t)=>Math.abs(e-t);function wz(e,t){const n=My(e.x,t.x),r=My(e.y,t.y);return Math.sqrt(n**2+r**2)}var Ny=new Set(["auto","scroll"]),xT=class{constructor(e,t,{transformPagePoint:n,contextWindow:r=window,dragSnapToOrigin:s=!1,distanceThreshold:i=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=h=>{this.handleScroll(h.target)},this.onWindowScroll=()=>{this.handleScroll(window)},this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;this.hasPendingMove=!1,this.lastRawMoveEventInfo&&(this.lastMoveEventInfo=Lc(this.lastRawMoveEventInfo,this.transformPagePoint));const h=Of(this.lastMoveEventInfo,this.history),f=this.startEvent!==null,B=wz(h.offset,{x:0,y:0})>=this.distanceThreshold;if(!f&&!B)return;const{point:g}=h;this.history.push({...g,timestamp:Ht.now()});const{onStart:C,onMove:v}=this.handlers;f||(C&&C(this.lastMoveEvent,h),this.startEvent=this.lastMoveEvent),v&&v(this.lastMoveEvent,h)},this.handlePointerMove=(h,f)=>{this.lastMoveEvent=h,this.lastRawMoveEventInfo=f,this.lastMoveEventInfo=Lc(f,this.transformPagePoint),this.hasPendingMove=!0,qe.update(this.updatePoint,!0)},this.handlePointerUp=(h,f)=>{this.hasPendingMove&&this.updatePoint(),this.end();const{onEnd:B,onSessionEnd:g,resumeAnimation:C}=this.handlers;if((this.dragSnapToOrigin||!this.startEvent)&&C&&C(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const v=Of(h.type==="pointercancel"?this.lastMoveEventInfo:Lc(f,this.transformPagePoint),this.history);this.startEvent&&B&&B(h,v),g&&g(h,v)},!bC(e))return;this.dragSnapToOrigin=s,this.handlers=t,this.transformPagePoint=n,this.distanceThreshold=i,this.contextWindow=r||window;const a=Lc(yh(e),this.transformPagePoint),{point:l}=a,{timestamp:c}=xt;this.history=[{...l,timestamp:c}];const{onSessionStart:u}=t;u&&u(e,Of(a,this.history));const d={passive:!0,capture:!0};this.removeListeners=rc(qa(this.contextWindow,"pointermove",this.handlePointerMove,d),qa(this.contextWindow,"pointerup",this.handlePointerUp,d),qa(this.contextWindow,"pointercancel",this.handlePointerUp,d)),o&&this.startScrollTracking(o)}startScrollTracking(e){let t=e.parentElement;for(;t;){const n=getComputedStyle(t);(Ny.has(n.overflowX)||Ny.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},s={x:r.x-t.x,y:r.y-t.y};s.x===0&&s.y===0||(n?this.lastMoveEventInfo&&(this.lastMoveEventInfo.point.x+=s.x,this.lastMoveEventInfo.point.y+=s.y):this.history.length>0&&(this.history[0].x-=s.x,this.history[0].y-=s.y),this.scrollPositions.set(e,r),qe.update(this.updatePoint,!0))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),this.removeScrollListeners&&this.removeScrollListeners(),this.scrollPositions.clear(),Us(this.updatePoint)}};function Lc(e,t){return t?{point:t(e.point)}:e}function Py(e,t){return{x:e.x-t.x,y:e.y-t.y}}function Of({point:e},t){return{point:e,delta:Py(e,wT(t)),offset:Py(e,Dz(t)),velocity:Tz(t,.1)}}function Dz(e){return e[0]}function wT(e){return e[e.length-1]}function Tz(e,t){if(e.length<2)return{x:0,y:0};let n=e.length-1,r=null;const s=wT(e);for(;n>=0&&(r=e[n],!(s.timestamp-r.timestamp>Dn(t)));)n--;if(!r)return{x:0,y:0};r===e[0]&&e.length>2&&s.timestamp-r.timestamp>Dn(t)*2&&(r=e[1]);const i=Mn(s.timestamp-r.timestamp);if(i===0)return{x:0,y:0};const o={x:(s.x-r.x)/i,y:(s.y-r.y)/i};return o.x===1/0&&(o.x=0),o.y===1/0&&(o.y=0),o}function Az(e,{min:t,max:n},r){return t!==void 0&&e<t?e=r?Ue(t,e,r.min):Math.max(e,t):n!==void 0&&e>n&&(e=r?Ue(n,e,r.max):Math.min(e,n)),e}function Ly(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 Iz(e,{top:t,left:n,bottom:r,right:s}){return{x:Ly(e.x,n,s),y:Ly(e.y,t,r)}}function _y(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 kz(e,t){return{x:_y(e.x,t.x),y:_y(e.y,t.y)}}function Rz(e,t){let n=.5;const r=en(e),s=en(t);return s>r?n=Cl(t.min,t.max-r,e.min):r>s&&(n=Cl(e.min,e.max-s,t.min)),ms(0,1,n)}function Oz(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 Dp=.35;function Mz(e=Dp){return e===!1?e=0:e===!0&&(e=Dp),{x:Fy(e,"left","right"),y:Fy(e,"top","bottom")}}function Fy(e,t,n){return{min:Hy(e,t),max:Hy(e,n)}}function Hy(e,t){return typeof e=="number"?e:e[t]||0}var Nz=new WeakMap,Pz=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=Et(),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 s=u=>{t&&this.snapToCursor(u),this.stopAnimation()},i=(u,d)=>{const{drag:h,dragPropagation:f,onDragStart:B}=this.getProps();if(h&&!f&&(this.openDragLock&&this.openDragLock(),this.openDragLock=AV(h),!this.openDragLock))return;this.latestPointerEvent=u,this.latestPanInfo=d,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),xr(C=>{let v=this.getAxisMotionValue(C).get()||0;if(Nr.test(v)){const{projection:y}=this.visualElement;if(y&&y.layout){const S=y.layout.layoutBox[C];S&&(v=en(S)*(parseFloat(v)/100))}}this.originPoint[C]=v}),B&&qe.update(()=>B(u,d),!1,!0),yp(this.visualElement,"transform");const{animationState:g}=this.visualElement;g&&g.setActive("whileDrag",!0)},o=(u,d)=>{this.latestPointerEvent=u,this.latestPanInfo=d;const{dragPropagation:h,dragDirectionLock:f,onDirectionLock:B,onDrag:g}=this.getProps();if(!h&&!this.openDragLock)return;const{offset:C}=d;if(f&&this.currentDirection===null){this.currentDirection=_z(C),this.currentDirection!==null&&B&&B(this.currentDirection);return}this.updateAxis("x",d.point,C),this.updateAxis("y",d.point,C),this.visualElement.render(),g&&qe.update(()=>g(u,d),!1,!0)},a=(u,d)=>{this.latestPointerEvent=u,this.latestPanInfo=d,this.stop(u,d),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 xT(e,{onSessionStart:s,onStart:i,onMove:o,onSessionEnd:a,resumeAnimation:l},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:c,distanceThreshold:n,contextWindow:ET(this.visualElement),element:this.visualElement.current})}stop(e,t){const n=e||this.latestPointerEvent,r=t||this.latestPanInfo,s=this.isDragging;if(this.cancel(),!s||!r||!n)return;const{velocity:i}=r;this.startAnimation(i);const{onDragEnd:o}=this.getProps();o&&qe.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||!_c(e,r,this.currentDirection))return;const s=this.getAxisMotionValue(e);let i=this.originPoint[e]+n[e];this.constraints&&this.constraints[e]&&(i=Az(i,this.constraints[e],this.elastic[e])),s.set(i)}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&&no(e)?this.constraints||(this.constraints=this.resolveRefConstraints()):e&&n?this.constraints=Iz(n.layoutBox,e):this.constraints=!1,this.elastic=Mz(t),r!==this.constraints&&!no(e)&&n&&this.constraints&&!this.hasMutatedConstraints&&xr(s=>{this.constraints!==!1&&this.getAxisMotionValue(s)&&(this.constraints[s]=Oz(n.layoutBox[s],this.constraints[s]))})}resolveRefConstraints(){const{dragConstraints:e,onMeasureDragConstraints:t}=this.getProps();if(!e||!no(e))return!1;const n=e.current;Mi(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 s=TV(n,r.root,this.visualElement.getTransformPagePoint());let i=kz(r.layout.layoutBox,s);if(t){const o=t(xV(i));this.hasMutatedConstraints=!!o,o&&(i=$1(o))}return i}startAnimation(e){const{drag:t,dragMomentum:n,dragElastic:r,dragTransition:s,dragSnapToOrigin:i,onDragTransitionEnd:o}=this.getProps(),a=this.constraints||{},l=xr(c=>{if(!_c(c,t,this.currentDirection))return;let u=a&&a[c]||{};(i===!0||i===c)&&(u={min:0,max:0});const d=r?200:1e6,h=r?40:1e7,f={type:"inertia",velocity:n?e[c]:0,bounceStiffness:d,bounceDamping:h,timeConstant:750,restDelta:1,restSpeed:10,...s,...u};return this.startAxisValueAnimation(c,f)});return Promise.all(l).then(o)}startAxisValueAnimation(e,t){const n=this.getAxisMotionValue(e);return yp(this.visualElement,e),n.start(pC(e,n,0,t,this.visualElement,!1))}stopAnimation(){xr(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},s=this.visualElement.getTransformPagePoint()?.(r)||r,i=this.visualElement.measureViewportBox();xr(o=>{if(!_c(o,n,this.currentDirection))return;const a=this.getAxisMotionValue(o),{min:l,max:c}=i[o];a.set((a.get()||0)+s[o]-Ue(l,c,.5))})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:e,dragConstraints:t}=this.getProps(),{projection:n}=this.visualElement;if(!no(t)||!n||!this.constraints)return;this.stopAnimation();const r=this.constraints,s={x:0,y:0};xr(o=>{const a=this.getAxisMotionValue(o).get();s[o]=Rz({min:a,max:a},r[o])});const{transformTemplate:i}=this.visualElement.getProps();this.visualElement.current.style.transform=i?i({},""):"none",n.root&&n.root.updateScroll(),n.updateLayout(),this.constraints=!1,this.resolveConstraints(),xr(o=>{const a=this.getAxisMotionValue(o);if(!_c(o,e,null)||!a.get())return;const{min:l,max:c}=this.constraints[o];a.set(Ue(l,c,s[o]))}),this.visualElement.render()}addListeners(){if(!this.visualElement.current)return;Nz.set(this.visualElement,this);const e=this.visualElement.current,t=qa(e,"pointerdown",l=>{const{drag:c,dragListener:u=!0}=this.getProps(),d=l.target,h=d!==e&&NV(d);c&&u&&!h&&this.start(l)});let n;const r=()=>{const{dragConstraints:l}=this.getProps();no(l)&&l.current&&(this.constraints=this.resolveRefConstraints(),n||(n=Lz(e,l.current,()=>this.scalePositionWithinConstraints())))},{projection:s}=this.visualElement,i=s.addEventListener("measure",r);s&&!s.layout&&(s.root&&s.root.updateScroll(),s.updateLayout()),qe.read(r);const o=xl(window,"resize",()=>this.scalePositionWithinConstraints()),a=s.addEventListener("didUpdate",(({delta:l,hasLayoutChanged:c})=>{this.isDragging&&c&&(xr(u=>{const d=this.getAxisMotionValue(u);d&&(this.originPoint[u]+=l[u].translate,d.set(d.get()+l[u].translate))}),this.visualElement.render())}));return()=>{o(),t(),i(),a&&a(),n&&n()}}getProps(){const e=this.visualElement.getProps(),{drag:t=!1,dragDirectionLock:n=!1,dragPropagation:r=!1,dragConstraints:s=!1,dragElastic:i=Dp,dragMomentum:o=!0}=e;return{...e,drag:t,dragDirectionLock:n,dragPropagation:r,dragConstraints:s,dragElastic:i,dragMomentum:o}}};function jy(e){let t=!0;return()=>{if(t){t=!1;return}e()}}function Lz(e,t,n){const r=ey(e,jy(n)),s=ey(t,jy(n));return()=>{r(),s()}}function _c(e,t,n){return(t===!0||t===e)&&(n===null||n===e)}function _z(e,t=10){let n=null;return Math.abs(e.y)>t?n="y":Math.abs(e.x)>t&&(n="x"),n}var Fz=class extends Zs{constructor(e){super(e),this.removeGroupControls=sr,this.removeListeners=sr,this.controls=new Pz(e)}mount(){const{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||sr}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()}},Mf=e=>(t,n)=>{e&&qe.update(()=>e(t,n),!1,!0)},Hz=class extends Zs{constructor(){super(...arguments),this.removePointerDownListener=sr}onPointerDown(e){this.session=new xT(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:ET(this.node)})}createPanHandlers(){const{onPanSessionStart:e,onPanStart:t,onPan:n,onPanEnd:r}=this.node.getProps();return{onSessionStart:Mf(e),onStart:Mf(t),onMove:Mf(n),onEnd:(s,i)=>{delete this.session,r&&qe.postRender(()=>r(s,i))}}}mount(){this.removePointerDownListener=qa(this.node.current,"pointerdown",e=>this.onPointerDown(e))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}},Nf=!1,jz=class extends p.Component{componentDidMount(){const{visualElement:e,layoutGroup:t,switchLayoutGroup:n,layoutId:r}=this.props,{projection:s}=e;s&&(t.group&&t.group.add(s),n&&n.register&&r&&n.register(s),Nf&&s.root.didUpdate(),s.addEventListener("animationComplete",()=>{this.safeToRemove()}),s.setOptions({...s.options,layoutDependency:this.props.layoutDependency,onExitComplete:()=>this.safeToRemove()})),Ou.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){const{layoutDependency:t,visualElement:n,drag:r,isPresent:s}=this.props,{projection:i}=n;return i&&(i.isPresent=s,e.layoutDependency!==t&&i.setOptions({...i.options,layoutDependency:t}),Nf=!0,r||e.layoutDependency!==t||t===void 0||e.isPresent!==s?i.willUpdate():this.safeToRemove(),e.isPresent!==s&&(s?i.promote():i.relegate()||qe.postRender(()=>{const o=i.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(),yC.postRender(()=>{!n.currentAnimation&&n.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:e,layoutGroup:t,switchLayoutGroup:n}=this.props,{projection:r}=e;Nf=!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 DT(e){const[t,n]=WU(),r=(0,p.useContext)(qD);return(0,m.jsx)(jz,{...e,layoutGroup:r,switchLayoutGroup:(0,p.useContext)(bT),isPresent:t,safeToRemove:n})}var Gz={pan:{Feature:Hz},drag:{Feature:Fz,ProjectionNode:BT,MeasureLayout:DT}};function Gy(e,t,n){const{props:r}=e;e.animationState&&r.whileHover&&e.animationState.setActive("whileHover",n==="Start");const s=r["onHover"+n];s&&qe.postRender(()=>s(t,yh(t)))}var Vz=class extends Zs{mount(){const{current:e}=this.node;e&&(this.unmount=kV(e,(t,n)=>(Gy(this.node,n,"Start"),r=>Gy(this.node,r,"End"))))}unmount(){}},Uz=class extends Zs{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=rc(xl(this.node.current,"focus",()=>this.onFocus()),xl(this.node.current,"blur",()=>this.onBlur()))}unmount(){}};function Vy(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 s=r["onTap"+(n==="End"?"":n)];s&&qe.postRender(()=>s(t,yh(t)))}var zz=class extends Zs{mount(){const{current:e}=this.node;if(!e)return;const{globalTapTarget:t,propagate:n}=this.node.props;this.unmount=LV(e,(r,s)=>(Vy(this.node,s,"Start"),(i,{success:o})=>Vy(this.node,i,o?"End":"Cancel")),{useGlobalTarget:t,stopPropagation:n?.tap===!1})}unmount(){}},Tp=new WeakMap,Pf=new WeakMap,$z=e=>{const t=Tp.get(e.target);t&&t(e)},Wz=e=>{e.forEach($z)};function qz({root:e,...t}){const n=e||document;Pf.has(n)||Pf.set(n,{});const r=Pf.get(n),s=JSON.stringify(t);return r[s]||(r[s]=new IntersectionObserver(Wz,{root:e,...t})),r[s]}function Kz(e,t,n){const r=qz(t);return Tp.set(e,n),r.observe(e),()=>{Tp.delete(e),r.unobserve(e)}}var Jz={some:0,all:1},Qz=class extends Zs{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:s}=e,i={root:t?t.current:void 0,rootMargin:n,threshold:typeof r=="number"?r:Jz[r]},o=a=>{const{isIntersecting:l}=a;if(this.isInView===l||(this.isInView=l,s&&!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(),d=l?c:u;d&&d(a)};this.stopObserver=Kz(this.node.current,i,o)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:e,prevProps:t}=this.node;["amount","margin","root"].some(Yz(e,t))&&this.startObserver()}unmount(){this.stopObserver?.(),this.hasEnteredView=!1,this.isInView=!1}};function Yz({viewport:e={}},{viewport:t={}}={}){return n=>e[n]!==t[n]}var Xz={inView:{Feature:Qz},tap:{Feature:zz},focus:{Feature:Uz},hover:{Feature:Vz}},Zz={layout:{ProjectionNode:BT,MeasureLayout:DT}},e5={...Ez,...Xz,...Gz,...Zz},TT=Cz(e5,vz);function t5(){return document.activeElement?.closest('[role="dialog"],[role="alertdialog"]')??document.body}async function ra(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",t5().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 n5="Project connection defaults are still syncing. Try again in a moment.",Rre="Finishing setup.",r5=1e4,s5={hover:!0,touch:!1},i5={top:0,right:0,bottom:0,left:0},AT=["inline","pip","fullscreen"];function IT(){return{headers:{},requestTimeout:r5}}function Ore(){return{version:1,connectionDefaults:IT(),clientCapabilities:Qd()}}function Mre(e){return{theme:e.theme,displayMode:e.displayMode,availableDisplayModes:AT,locale:e.locale,timeZone:e.timeZone,deviceCapabilities:e.deviceCapabilities,safeAreaInsets:e.safeAreaInsets}}function Nre(e){if(!e||typeof e!="object")return!1;const t=e;return t.version===1&&(t.connectionDefaults===void 0||OT(t.connectionDefaults))&&Po(t.clientCapabilities)&&Po(t.hostContext)}function o5(e,t=Qd()){return Po(e)?e:t}function a5(e,t={}){return Po(e)?e:t}function Pre(e){return{version:1,connectionDefaults:kT(e?.connectionDefaults),clientCapabilities:o5(e?.clientCapabilities)}}function Lre(e,t={}){return a5(e?.hostContext,t)}function kT(e,t=IT()){return OT(e)?{headers:MT(e.headers),requestTimeout:f5(e.requestTimeout,t.requestTimeout)}:t}function _re(e){return kT(e?.connectionDefaults)}function Fre(e,t){return{...MT(e),...h5(t)}}function Hre(e){return l5(e?.clientCapabilities??Qd())}function l5(e){return hN(e)}function c5(e){const t=e?.availableDisplayModes;if(!Array.isArray(t))return AT;const n=t.filter(RT);return n.length>0?n:["inline"]}function u5(e){const t=e?.displayMode;return RT(t)?t:void 0}function jre(e){return d5(u5(e),c5(e))}function Gre(e){const t=e?.theme;return t==="light"||t==="dark"?t:void 0}function Vre(e,t="en-US"){return typeof e?.locale=="string"?e.locale:t}function Ure(e,t="UTC"){return typeof e?.timeZone=="string"?e.timeZone:t}function zre(e,t=s5){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 $re(e,t=i5){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 d5(e,t){return e&&t.includes(e)?e:t[0]??"inline"}function RT(e){return e==="inline"||e==="pip"||e==="fullscreen"}function OT(e){return!Po(e)||e.headers!==void 0&&!Po(e.headers)?!1:e.requestTimeout===void 0||typeof e.requestTimeout=="number"&&Number.isFinite(e.requestTimeout)}function MT(e){return e?Object.fromEntries(Object.entries(e).filter(([t,n])=>t.trim()!==""&&t.toLowerCase()!=="authorization"&&typeof n=="string")):{}}function h5(e){return e?Object.fromEntries(Object.entries(e).filter(([t,n])=>t.trim()!==""&&typeof n=="string")):{}}function f5(e,t){return typeof e!="number"||!Number.isFinite(e)||e<=0?t:e}function Po(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var B5=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}},Ap="mcpjam:task-bookmarks-changed";function p5(){typeof window<"u"&&window.dispatchEvent(new Event(Ap))}function Wre(e){return window.addEventListener(Ap,e),window.addEventListener("storage",e),()=>{window.removeEventListener(Ap,e),window.removeEventListener("storage",e)}}var m5=2e3,g5=6048e5;function qre(e){return e!=="working"&&e!=="input_required"}function Kre(e,t){return Math.max(e,m5,t??0)}function C5(e,t){return e&&t?JSON.stringify(["owned-task-v1",e,t]):void 0}var bh,wl;function v5(e){bh=e??void 0}function y5(){return bh}function b5(e,t){wl=C5(e,t)}function DC(){return wl}function Lo(e){return e.connectionId!==void 0||e.sourceExecutionId!==void 0}function oc(e){return{...e,scope:e.scope??(Lo(e)?wl:bh)}}function NT(e){return Lo(e)?wl!==void 0&&e.scope===wl:e.scope===bh}function Ip(e,t){const n=`${t?.scope??(t?.connectionId!==void 0?DC():y5())??""}\0${e}`;return t?.wire!==void 0||t?.connectionId!==void 0?`${n}\0${t.wire??""}\0${t.connectionId??""}`:n}function sa(e,t){return e.connectionId===t?.connectionId&&(t?.scope===void 0||e.scope===t.scope)&&(t?.wire===void 0||e.wire===t.wire)}var PT="mcp-tracked-tasks",LT="mcp-tracked-tasks-v4",Mu=4,S5=50,_o=1024,_T=100,E5=524288;function _n(e){return ui(e)}function x5(e,t){const n=Date.parse(e.createdAt);return Number.isNaN(n)?!0:t-n<g5}function Wn(e){if(typeof e=="string")return e.length>_o?e.slice(0,_o):e}function Xn(e){if(typeof e=="string")return e.length>_o||e.includes("\0")?void 0:e}function si(e){return typeof e=="number"&&Number.isFinite(e)?e:void 0}function Uy(e){if(typeof e!="object"||e===null||Array.isArray(e))return;const t=e,n=Xn(t.taskId),r=Xn(t.serverId),s=Wn(t.createdAt);if(!n||!r)return;const i=Xn(t.connectionId),o=Xn(t.sourceExecutionId);if(t.connectionId!==void 0&&!i||t.sourceExecutionId!==void 0&&!o)return;const a=Xn(t.scope);if(t.scope!==void 0&&a===void 0||!s||Number.isNaN(Date.parse(s)))return;const l=t.wire==="extension"||t.wire==="legacy"?t.wire:"legacy",c=t.ttlMs===null?null:si(t.ttlMs),u=Array.isArray(t.respondedInputKeys)?t.respondedInputKeys.filter(d=>typeof d=="string").slice(0,_T).map(d=>d.slice(0,_o)):void 0;return{taskId:n,serverId:r,wire:l,createdAt:s,...Wn(t.toolName)?{toolName:Wn(t.toolName)}:{},...t.primitiveType==="tool"||t.primitiveType==="prompt"||t.primitiveType==="resource"?{primitiveType:t.primitiveType}:{},...Wn(t.primitiveName)?{primitiveName:Wn(t.primitiveName)}:{},...t.dismissed===!0?{dismissed:!0}:{},...t.expired===!0?{expired:!0}:{},...a!==void 0?{scope:a}:{},...i!==void 0?{connectionId:i}:{},...o!==void 0?{sourceExecutionId:o}:{},...Wn(t.serverName)?{serverName:Wn(t.serverName)}:{},...Wn(t.lastUpdatedAt)?{lastUpdatedAt:Wn(t.lastUpdatedAt)}:{},...Wn(t.status)?{status:Wn(t.status)}:{},...c!==void 0?{ttlMs:c}:{},...si(t.pollIntervalMs)!==void 0?{pollIntervalMs:si(t.pollIntervalMs)}:{},...si(t.nextPollAt)!==void 0?{nextPollAt:si(t.nextPollAt)}:{},...si(t.lastObservedAt)!==void 0?{lastObservedAt:si(t.lastObservedAt)}:{},...u?.length?{respondedInputKeys:u}:{}}}function w5(e){if(Array.isArray(e))return e.map(Uy).filter(n=>n!==void 0);if(typeof e!="object"||e===null)return[];const t=e;return typeof t.version=="number"&&t.version>Mu?[]:Array.isArray(t.tasks)?t.tasks.map(Uy).filter(n=>n!==void 0):[]}function zy(e){try{const t=localStorage.getItem(e);return t?w5(JSON.parse(t)).filter(n=>x5(n,Date.now())):[]}catch{return[]}}function Sh(){const e=zy(PT).filter(n=>!Lo(n)),t=zy(LT);return[...new Map([...e,...t].map(n=>[_n(n),n])).values()]}function hr(){return Sh().filter(NT)}function ac(e){TC([...e,...Sh().filter(t=>!NT(t))])}function TC(e){try{let t=e,n=JSON.stringify({version:Mu,tasks:t});for(;n.length>E5&&t.length>1;)t=t.slice(0,Math.floor(t.length/2)),n=JSON.stringify({version:Mu,tasks:t});localStorage.setItem(PT,JSON.stringify({version:3,tasks:t.filter(r=>!Lo(r))})),localStorage.setItem(LT,JSON.stringify({version:Mu,tasks:t.filter(Lo)})),p5()}catch{}}function Jre(){return hr()}function Qre(e,t,n,r){return hr().filter(s=>s.serverId===e&&!s.dismissed&&sa(s,{wire:t,connectionId:n,scope:r}))}function Yre(e,t,n){return hr().find(r=>r.taskId===e&&(t===void 0||r.serverId===t)&&sa(r,n))}function Xre(e){const t=oc(e);if(Lo(t)&&t.scope===void 0||Xn(t.taskId)===void 0||Xn(t.serverId)===void 0||t.scope!==void 0&&Xn(t.scope)===void 0||t.connectionId!==void 0&&!Xn(t.connectionId)||t.sourceExecutionId!==void 0&&!Xn(t.sourceExecutionId))return;const n=Sh(),r=_n(t);if(n.some(o=>_n(o)===r))return;const s=o=>(o.scope??void 0)===(t.scope??void 0),i=n.filter(s);i.unshift({...t,dismissed:!1}),TC([...i.slice(0,S5),...n.filter(o=>!s(o))])}function D5(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 Zre(e){if(e.length===0)return;const t=hr(),n=new Map(t.map(s=>[_n(s),s]));let r=!1;for(const{identity:s,observation:i}of e){const o=n.get(_n(oc(s)));o&&(D5(o,i),r=!0)}r&&ac(t)}function ese(e){const t=new Map;if(e.length===0)return t;const n=new Map;for(const r of e)n.set(_n(oc(r)),_n(r));for(const r of hr()){const s=n.get(_n(r));s!==void 0&&t.set(s,{nextPollAt:r.nextPollAt,lastObservedAt:r.lastObservedAt,pollIntervalMs:r.pollIntervalMs,ttlMs:r.ttlMs,status:r.status,respondedInputKeys:r.respondedInputKeys??[]})}return t}function tse(e,t){if(t.length===0)return;const n=_n(oc(e)),r=hr(),s=r.find(i=>_n(i)===n);s&&(s.respondedInputKeys=[...new Set([...s.respondedInputKeys??[],...t])].slice(0,_T).map(i=>i.slice(0,_o)),ac(r))}function nse(e){const t=_n(oc(e));return hr().find(n=>_n(n)===t)?.respondedInputKeys??[]}function rse(e,t,n){const r=hr();for(const s of r)s.taskId===e&&(t===void 0||s.serverId===t)&&sa(s,n)&&(s.expired=!0);ac(r)}function sse(e,t,n){const r=new Set(t),s=hr();for(const i of s)i.serverId===e&&r.has(i.taskId)&&sa(i,n)&&(i.dismissed=!0);ac(s)}var FT="mcp-dismissed-registry-tasks",T5=200;function AC(){try{const e=localStorage.getItem(FT);if(!e)return{};const t=JSON.parse(e);if(typeof t!="object"||t===null||Array.isArray(t))return{};const n={};for(const[r,s]of Object.entries(t))Array.isArray(s)&&(n[r]=s.filter(i=>typeof i=="string"&&i.length>0&&i.length<=_o).slice(0,T5));return n}catch{return{}}}function HT(e){try{localStorage.setItem(FT,JSON.stringify(e))}catch{}}function ise(e,t,n){if(n?.connectionId!==void 0&&n.scope===void 0&&DC()===void 0)return;const r=t.filter(o=>Xn(o)!==void 0);if(r.length===0)return;const s=AC(),i=Ip(e,n);s[i]=[...new Set([...s[i]??[],...r])].slice(-200),HT(s)}function ose(e,t){if(t?.connectionId!==void 0&&t.scope===void 0&&DC()===void 0)return new Set;const n=new Set(hr().filter(i=>i.serverId===e&&i.dismissed&&sa(i,t)).map(i=>i.taskId)),r=AC(),s=[Ip(e,t)];t?.connectionId===void 0&&t?.scope===void 0&&s.push(Ip(e));for(const i of s)for(const o of r[i]??[])n.add(o);return n}function ase(e,t){ac(hr().filter(n=>n.serverId!==e||!sa(n,t)))}function A5(e){const t=e??void 0;TC(Sh().filter(i=>(i.scope??void 0)!==t));const n=AC(),r=`${t??""}\0`;let s=!1;for(const i of Object.keys(n))i.startsWith(r)&&(delete n[i],s=!0);s&&HT(n)}var jT={projectId:null,serverIdsByName:{}},ge=jT,Qn=null,zs=0,kp=new Set,Ia=3e4,I5=3e3,k5=100,Lf=null;function IC(){Qn=null}var R5=1e4;async function O5(){if(po())return null;const e=ge.getAccessToken;if(!e)return null;const t=zs;IC();let n;try{const r=await Promise.race([e({forceRefresh:!0}),new Promise(s=>{n=setTimeout(()=>s(null),R5)})]);return!r||t!==zs?null:(Qn={token:r,expiresAt:Date.now()+Ia,kind:"session"},r)}catch{return null}finally{clearTimeout(n)}}function GT(){zs+=1;for(const e of kp)e()}function lse(e){return kp.add(e),()=>{kp.delete(e)}}function cse(){return zs}var $y=null;function use(e){const t=$y;if(t&&t.revision===zs&&t.serverNameOrId===e)return t.key;const n=ge.clientConfigSyncPending||!P5(e)?null:JSON.stringify([po(),H5(e)]);return $y={revision:zs,serverNameOrId:e,key:n},n}function M5(){throw new Error("Hosted API context is only available in hosted mode")}function kC(){if(ge.clientConfigSyncPending)throw new Error(n5)}function N5(){return!ge.isAuthenticated&&!ge.hasSession}function RC(){return!(ge.isAuthenticated||ge.hasSession)}function po(){return RC()}function dse(e){const t=ge.projectId??void 0,n=e?.projectId??void 0;t&&n&&t!==n&&A5(t),v5(n),b5(n,e?.taskOwnerId),ge=e?{...e,clientCapabilities:e.clientCapabilities??Qd()}:jT,IC(),GT()}function hse(e,t,n){ge.projectId===n&&ge.serverIdsByName[e]!==t&&(ge={...ge,serverIdsByName:{...ge.serverIdsByName,[e]:t}},GT())}function VT(){const e=ge.projectId;if(!e)throw new B5("provisioning-project","hosted projectId is not in the API context yet");return e}function P5(e){const t=ge.projectId;if(!t)return null;const n=ge.serverIdsByName[e];return n?{projectId:t,serverId:n}:Object.values(ge.serverIdsByName).includes(e)?{projectId:t,serverId:e}:null}function L5(e){const t=e.trim();return!(t.length<1||t.length>=20&&/^[a-z0-9]+$/i.test(t))}var _5="Hosted server not found. The server is not in your hosted project, or the server list is still loading.";function UT(e){const t=ge.serverIdsByName[e];if(t)return t;if(Object.values(ge.serverIdsByName).includes(e))return e;throw L5(e)?new Error(`Hosted server not found for "${e}"`):new Error(_5)}function lc(e){return Object.entries(ge.serverIdsByName).find(([,t])=>t===e)?.[0]}function fse(e){return lc(e)}function Bse(e){}function pse(e){M5();const t=new Set,n=[];for(const r of e){if(typeof r!="string")continue;const s=r.trim();if(!s)continue;const i=ge.serverIdsByName[s]!==void 0?s:lc(s)??s,o=i.toLowerCase();t.has(o)||(t.add(o),n.push(i))}return n}function F5(e){const t=new Set,n=[];for(const r of e){const s=UT(r);t.has(s)||(t.add(s),n.push({serverId:s,serverName:ge.serverIdsByName[r]!==void 0?r:lc(s)??r}))}return n}function OC(){return ge.scenarioId}function zT(){return ge.accessVersion}function $T(){return OC()?"chat_v2":void 0}function MC(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 H5(e){kC();const t=VT(),n=UT(e),r=OC(),s=zT(),i=$T();return{projectId:t,serverId:n,serverName:ge.serverIdsByName[e]!==void 0?e:lc(n)??e,...ge.clientCapabilities?{clientCapabilities:ge.clientCapabilities}:{},...ge.clientInfo?{clientInfo:ge.clientInfo}:{},...ge.supportedProtocolVersions?.length?{supportedProtocolVersions:ge.supportedProtocolVersions}:{},...ge.mcpProtocolVersionsByServerId?.[n]?{mcpProtocolVersion:ge.mcpProtocolVersionsByServerId[n]}:{},...MC(ge),...ge.xaaPolicy?{xaaPolicy:ge.xaaPolicy}:{},...i?{accessScope:i}:{},...r?{scenarioId:r}:{},...r&&Number.isFinite(s)?{accessVersion:s}:{}}}function mse(e){kC();const t=VT(),n=F5(e),r=n.map(c=>c.serverId),s=n.map(c=>c.serverName),i=WT(r),o=OC(),a=zT(),l=$T();return{projectId:t,serverIds:r,serverNames:s,...ge.clientCapabilities?{clientCapabilities:ge.clientCapabilities}:{},...ge.clientInfo?{clientInfo:ge.clientInfo}:{},...ge.supportedProtocolVersions?.length?{supportedProtocolVersions:ge.supportedProtocolVersions}:{},...i?{mcpProtocolVersionsByServerId:i}:{},...MC(ge),...ge.xaaPolicy?{xaaPolicy:ge.xaaPolicy}:{},...l?{accessScope:l}:{},...o?{scenarioId:o}:{},...o&&Number.isFinite(a)?{accessVersion:a}:{}}}function WT(e){const t=ge.mcpProtocolVersionsByServerId;if(!t)return;const n={};for(const r of e){const s=t[r];s&&(n[r]=s)}return Object.keys(n).length>0?n:void 0}function gse(e){kC();const t=WT(e.serverIds);return{projectId:e.projectId,serverIds:e.serverIds,serverNames:e.serverNames,...ge.clientCapabilities?{clientCapabilities:ge.clientCapabilities}:{},...ge.clientInfo?{clientInfo:ge.clientInfo}:{},...ge.supportedProtocolVersions?.length?{supportedProtocolVersions:ge.supportedProtocolVersions}:{},...t?{mcpProtocolVersionsByServerId:t}:{},...MC(ge),...ge.xaaPolicy?{xaaPolicy:ge.xaaPolicy}:{},...e.accessScope?{accessScope:e.accessScope}:{},...e.scenarioId?{scenarioId:e.scenarioId}:{},...e.scenarioId&&Number.isFinite(e.accessVersion)?{accessVersion:e.accessVersion}:{}}}function j5(){return Lf??=G5().finally(()=>{Lf=null}),Lf}async function G5(){const e=Date.now()+I5;for(;Date.now()<e;){if(await new Promise(n=>setTimeout(n,k5)),RC())return null;const t=ge.getAccessToken;if(t)try{const n=await t();if(n)return n}catch{}}return null}async function qT(e=1){const t=zs,n=po(),r=()=>zs!==t||po()!==n,s=()=>e>0?qT(e-1):null,i=Date.now();if(Qn&&Qn.expiresAt>i)if(Qn.kind==="guest"&&!po())Qn=null;else return`Bearer ${Qn.token}`;if(po()){const l=await Wv();if(r())return s();if(l)return Qn={token:l,expiresAt:i+Ia,kind:"guest"},`Bearer ${l}`}const o=ge.getAccessToken;if(o)try{const l=await o();if(r())return s();if(l)return Qn={token:l,expiresAt:i+Ia,kind:"session"},`Bearer ${l}`}catch{}if(!RC()){const l=await j5();return r()?s():l?(Qn={token:l,expiresAt:Date.now()+Ia,kind:"session"},`Bearer ${l}`):null}const a=await Wv();return r()?s():a?(Qn={token:a,expiresAt:i+Ia,kind:"guest"},`Bearer ${a}`):null}function V5(){const e=mN();if(e)return e;const t=xN()??"https://rt.mcpjam.com";return t&&typeof t=="string"?t.replace(".convex.cloud",".convex.site"):null}var U5=["billing_","credit_topup_","plan_limit_","plans_upgrade_confirm_","pricing_"];function z5(e){return U5.some(t=>e.startsWith(t))}function $5(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 Ed(e,t={}){const{location:n="unknown",platform:r,environment:s,...i}=t;try{const o=z5(e),a=o?i.organization_id:void 0,l=typeof a=="string"&&a.length>0?a:void 0,c=o?Object.fromEntries(Object.entries(i).filter(([u])=>!$5(u))):i;Sg.capture(e,{...c,...yN(n),...o?{organization_id:null,...l?{$groups:{organization:l}}:{}}:{}})}catch(o){console.warn(`[analytics] Failed to capture ${e}`,o)}}function Cse(e,t,n=$v()){const r=BN();!n||$v()!==n||r.policy.content!=="full"||e.capture("$set",{},{$set:r.policy.identity==="full"?t:{deployment:t.deployment}})}function W5(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 q5(e){if(e.status!==401)return!1;try{return typeof e.clone!="function"?!1:W5(await e.clone().json())}catch{return!1}}var Ka=null,Wy=!1,Rp=!1;function KT(e){try{e()}catch{}}function K5(){Wy||(Wy=!0,Ka?KT(Ka):Rp=!0)}function vse(e){return Ka=e,Rp&&(Rp=!1,KT(e)),()=>{Ka===e&&(Ka=null)}}async function J5(e){const t=e.headers.get("content-type")?.split(";")[0].trim().toLowerCase()||void 0,n=await e.text().catch(()=>""),r=n.trimStart().startsWith("{")?Q5(n):null;return r?{ok:"ok"in r&&r.ok===!0,code:"code"in r&&typeof r.code=="string"?r.code:void 0,contentType:t}:{ok:!1,contentType:t}}function Q5(e){try{const t=JSON.parse(e);return typeof t=="object"?t:null}catch{return null}}var Y5=[/^\/api\/v1\/projects\/[^/]+\/mock-servers(\/[^/]+(\/(versions|forwarding-policy))?)?$/,/^\/api\/v1\/projects\/[^/]+\/mock-forwarding-policy$/],Fo=null,ka=null,NC=class extends Error{status;code;restarted;contentType;constructor(e,{code:t,restarted:n=!1,contentType:r}={}){super(`Failed to get session token: ${e}`),this.name="SessionTokenError",this.status=e,this.code=t,this.restarted=n,this.contentType=r}};function yse(e){return e instanceof NC&&e.status===403&&e.code==="HOST_NOT_ALLOWED"}function X5(e){return e instanceof NC&&e.status===401&&e.code==="ACCESS_LINK_REQUIRED"}var qy={"/api/web/scenarios/bootstrap":"scenario"};function Z5(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 qy[r.pathname]??null}catch{return qy[t]??null}}function e$(...e){const t={};for(const n of e)if(n){if(n instanceof Headers){n.forEach((r,s)=>{t[s]=r});continue}if(Array.isArray(n)){for(const[r,s]of n)t[r]=s;continue}Object.assign(t,n)}return t}function t$(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 Fc(e,t,n){const r=XT(e)?r$():void 0,s=n&&ZT(e)?{Authorization:n}:void 0;return{...t,headers:e$(r,s,t?.headers)}}async function JT(e){const t=await fetch("/api/session-token",{headers:e?{"X-MCP-Session-Auth":`Bearer ${e}`}:{},cache:"no-store"}),n=await J5(t);if(!t.ok||!n.ok||!NN(e))throw new NC(t.status,{code:n.code,restarted:!!e,contentType:n.contentType});return Fo=e,RN(e),e}async function bse(){return Fo||(ka||(ka=JT(Eg()).catch(e=>{throw ka=null,e})),ka)}async function n$(){Fo=null,ka=null;try{return await JT(Eg(!0))}catch(e){return X5(e)&&window.dispatchEvent(new CustomEvent(bx,{detail:{restarted:e.restarted}})),null}}function Eh(){return Fo||(Eg()??"")}function Sse(){return!!Eh()}function r$(){const e=Eh();return e?{"X-MCP-Session-Auth":`Bearer ${e}`}:(console.warn("[Auth] Session token not available"),{})}function QT(e){return e==="localhost"||e==="127.0.0.1"||e==="::1"||e==="[::1]"}function PC(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 YT(e){return QT(e.hostname)?!0:typeof window<"u"&&e.origin===window.location.origin}function XT(e){const t=PC(e);return t?YT(t)&&t.pathname.startsWith("/api/"):typeof e=="string"&&e.startsWith("/api/")}var s$=["/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 i$(e){if(typeof window<"u"&&e.origin===window.location.origin||QT(e.hostname))return!0;const t=V5();if(t)try{const n=new URL(t).hostname;if(e.hostname===n)return!0}catch{}return!1}var o$=[/^\/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$/,...Y5];function Ky(e){return o$.some(t=>t.test(e))?!0:s$.some(t=>t.endsWith("/")?e.startsWith(t):e===t||e.startsWith(`${t}/`))}var a$=["/api/web/apps/plugin-instances/","/api/web/plugin-forms/"];function l$(e){const t=PC(e),n=t?t.pathname:typeof e=="string"?e.split("?")[0]:"";return/^\/api\/(web|mcp)\/(chat-persistence|turn-authorization)\/?$/.test(n)||a$.some(r=>n.startsWith(r))}function c$(e){return e==null||typeof e=="string"||e instanceof FormData||e instanceof URLSearchParams||e instanceof Blob||e instanceof ArrayBuffer||ArrayBuffer.isView(e)}function ZT(e){const t=PC(e);if(t)return i$(t)?Ky(t.pathname):!1;if(typeof e!="string"||!e.startsWith("/"))return!1;const n=e.split("?")[0];return Ky(n)}function u$(e){const t=Eh();if(!t)return console.warn("[Auth] Session token not available for URL"),e;try{const n=new URL(e,window.location.origin);return YT(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 Ese(e,t){const n=Z5(e),r=t$(t?.headers),s=ZT(e),i=s&&!r?await qT():null,o=Fc(e,t,i),a=await fetch(e,o);if(a.status===401&&s&&await q5(a))return K5(),a;if(a.status===401&&s&&!r&&l$(e)&&c$(t?.body)&&a.headers?.get("X-MCP-Auth-Required")!=="oauth"){const u=await O5();if(u)return t?.signal?.throwIfAborted(),fetch(e,Fc(e,t,`Bearer ${u}`))}if(a.status===401&&XT(e)&&a.headers?.get("X-MCPJam-Session")!=null){const u=Eh(),d=await n$();if(d&&d!==u){const h=Fc(e,t,i),f=await fetch(e,h);return f.status===401&&f.headers.get("X-MCPJam-Session")&&window.dispatchEvent(new CustomEvent(bx,{detail:{restarted:!0}})),f}}if(a.status!==401||!s||!N5()||r||a.headers?.get("X-MCP-Auth-Required")==="oauth")return a;IC();const l=await kN();if(!l)return n&&Ed("guest_refresh_failure",{location:"auth_fetch",surface:n,auth_mode:"guest",status:"failure",error_kind:"guest_refresh_unavailable"}),a;n&&Ed("guest_refresh_success",{location:"auth_fetch",surface:n,auth_mode:"guest",status:"success"});const c=Fc(e,t,`Bearer ${l}`);return fetch(e,c)}var Jy="1.46.0",Dl=Symbol.for("functionName"),d$=Symbol.for("toReferencePath");function h$(e){return e[d$]??null}function f$(e){return e.startsWith("function://")}function B$(e){let t;if(typeof e=="string")f$(e)?t={functionHandle:e}:t={name:e};else if(e[Dl])t={name:e[Dl]};else{const n=h$(e);if(!n)throw new Error(`${e} is not a functionReference`);t={reference:n}}return t}function tn(e){const t=B$(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[Dl];if(!n)throw new Error(`${e} is not a functionReference`);return n}function xh(e){return{[Dl]:e}}function eA(e=[]){return new Proxy({},{get(t,n){if(typeof n=="string")return eA([...e,n]);if(n===Dl){if(e.length<2){const i=["api",...e].join(".");throw new Error(`API path is expected to be of the form \`api.moduleName.functionName\`. Found: \`${i}\``)}const r=e.slice(0,-1).join("/"),s=e[e.length-1];return s==="default"?r:r+":"+s}else return n===Symbol.toStringTag?"FunctionReference":void 0}})}var xse=eA(),p$=Object.defineProperty,m$=(e,t,n)=>t in e?p$(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Qy=(e,t,n)=>m$(e,typeof t!="symbol"?t+"":t,n),g$="color:rgb(0, 145, 255)";function tA(e){switch(e){case"query":return"Q";case"mutation":return"M";case"action":return"A";case"any":return"?"}}var nA=class{constructor(e){Qy(this,"_onLogLineFuncs"),Qy(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 rA(e){const t=new nA(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 sA(e){return new nA(e)}function xd(e,t,n,r,s){const i=tA(n);if(typeof s=="object"&&(s=`ConvexError ${JSON.stringify(s.errorData,null,2)}`),t==="info"){const o=s.match(/^\[.*?\] /);if(o===null){e.error(`[CONVEX ${i}(${r})] Could not parse console.log`);return}const a=s.slice(1,o[0].length-2),l=s.slice(o[0].length);e.log(`%c[CONVEX ${i}(${r})] [${a}]`,g$,l)}else e.error(`[CONVEX ${i}(${r})] ${s}`)}function C$(e,t){const n=`[CONVEX FATAL ERROR] ${t}`;return e.error(n),new Error(n)}function mo(e,t,n){return`[CONVEX ${tA(e)}(${t})] ${n.errorMessage}
|
|
42
|
+
Called by client`}function Op(e,t){return t.data=e.errorData,t}function Ni(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 xi(e,t){return JSON.stringify({udfPath:Ni(e),args:Pr(t)})}function Yy(e,t,n){const{initialNumItems:r,id:s}=n;return JSON.stringify({type:"paginated",udfPath:Ni(e),args:Pr(t),options:Pr({initialNumItems:r,id:s})})}var v$=Object.defineProperty,y$=(e,t,n)=>t in e?v$(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,gr=(e,t,n)=>y$(e,typeof t!="symbol"?t+"":t,n),b$=class{constructor(){gr(this,"nextQueryId"),gr(this,"querySetVersion"),gr(this,"querySet"),gr(this,"queryIdToToken"),gr(this,"identityVersion"),gr(this,"auth"),gr(this,"outstandingQueriesOlderThanRestart"),gr(this,"outstandingAuthOlderThanRestart"),gr(this,"paused"),gr(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 s=Ni(e),i=xi(s,t),o=this.querySet.get(i);if(o!==void 0)return o.numSubscribers+=1,{queryToken:i,modification:null,unsubscribe:()=>this.removeSubscriber(i)};{const a=this.nextQueryId++,l={id:a,canonicalizedUdfPath:s,args:t,numSubscribers:1,journal:n,componentPath:r};this.querySet.set(i,l),this.queryIdToToken.set(a,i);const c=this.querySetVersion,u=this.querySetVersion+1,d={type:"Add",queryId:a,udfPath:s,args:[Pr(t)],journal:n,componentPath:r};return this.paused?this.pendingQuerySetModifications.set(a,d):this.querySetVersion=u,{queryToken:i,modification:{type:"ModifyQuerySet",baseVersion:c,newVersion:u,modifications:[d]},unsubscribe:()=>this.removeSubscriber(i)}}}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=Ni(e),r=xi(n,t),s=this.querySet.get(r);return s!==void 0?s.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 s={type:"Add",queryId:r.id,udfPath:r.canonicalizedUdfPath,args:[Pr(r.args)],journal:r.journal,componentPath:r.componentPath};e.push(s),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,s={type:"Remove",queryId:t.id};return this.paused?this.pendingQuerySetModifications.has(t.id)?this.pendingQuerySetModifications.delete(t.id):this.pendingQuerySetModifications.set(t.id,s):this.querySetVersion=r,{type:"ModifyQuerySet",baseVersion:n,newVersion:r,modifications:[s]}}}},S$=Object.defineProperty,E$=(e,t,n)=>t in e?S$(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Hc=(e,t,n)=>E$(e,typeof t!="symbol"?t+"":t,n),x$=class{constructor(e,t){this.logger=e,this.markConnectionStateDirty=t,Hc(this,"inflightRequests"),Hc(this,"requestsOlderThanRestart"),Hc(this,"inflightMutationsCount",0),Hc(this,"inflightActionsCount",0),this.inflightRequests=new Map,this.requestsOlderThanRestart=new Set}request(e,t){const n=new Promise(r=>{const s=t?"Requested":"NotSent";this.inflightRequests.set(e.requestId,{message:e,status:{status:s,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)xd(this.logger,"info",n,r,a);const s=t.status;let i,o;if(e.success)i={success:!0,logLines:e.logLines,value:ld(e.result)},o=()=>s.onResult(i);else{const a=e.result,{errorData:l}=e;xd(this.logger,"error",n,r,a),i={success:!1,errorMessage:a,errorData:l!==void 0?ld(l):void 0,logLines:e.logLines},o=()=>s.onResult(i)}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:i}):(t.status={status:"Completed",result:i,ts:e.ts,onResolve:o},null)}removeCompleted(e){const t=new Map;for(const[n,r]of this.inflightRequests.entries()){const s=r.status;s.status==="Completed"&&s.ts.lessThanOrEqual(e)&&(s.onResolve(),t.set(n,s.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}},w$=Object.defineProperty,D$=(e,t,n)=>t in e?w$(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,wd=(e,t,n)=>D$(e,typeof t!="symbol"?t+"":t,n),Xy=class Mp{constructor(t){wd(this,"queryResults"),wd(this,"modifiedQueries"),this.queryResults=t,this.modifiedQueries=[]}getQuery(t,...n){const r=Wr(n[0]),s=tn(t),i=this.queryResults.get(xi(s,r));if(i!==void 0)return Mp.queryValue(i.result)}getAllQueries(t){const n=[],r=tn(t);for(const s of this.queryResults.values())s.udfPath===Ni(r)&&n.push({args:s.args,value:Mp.queryValue(s.result)});return n}setQuery(t,n,r){const s=Wr(n),i=tn(t),o=xi(i,s);let a;r===void 0?a=void 0:a={success:!0,value:r,logLines:[]};const l={udfPath:i,args:s,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}},T$=class{constructor(){wd(this,"queryResults"),wd(this,"optimisticUpdates"),this.queryResults=new Map,this.optimisticUpdates=[]}ingestQueryResultsFromServer(e,t){this.optimisticUpdates=this.optimisticUpdates.filter(i=>!t.has(i.mutationId));const n=this.queryResults;this.queryResults=new Map(e);const r=new Xy(this.queryResults);for(const i of this.optimisticUpdates)i.update(r);const s=[];for(const[i,o]of this.queryResults){const a=n.get(i);(a===void 0||a.result!==o.result)&&s.push(i)}return s}applyOptimisticUpdate(e,t){this.optimisticUpdates.push({update:e,mutationId:t});const n=new Xy(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?Op(n,new LB(mo("query",t.udfPath,n))):new Error(mo("query",t.udfPath,n))}}hasQueryResult(e){return this.queryResults.get(e)!==void 0}queryLogs(e){return this.queryResults.get(e)?.result?.logLines}},A$=Object.defineProperty,I$=(e,t,n)=>t in e?A$(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,_f=(e,t,n)=>I$(e,typeof t!="symbol"?t+"":t,n),cc=class Ur{constructor(t,n){_f(this,"low"),_f(this,"high"),_f(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 Ur(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?Zy:t>=k$?R$:new Ur(t%Ja|0,t/Ja|0)}toString(){return(BigInt(this.high)*BigInt(Ja)+BigInt(this.low)).toString()}equals(t){return Ur.isLong(t)||(t=Ur.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 Ur.isLong(t)||(t=Ur.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"?Ur.fromNumber(t):new Ur(t.low,t.high)}},Zy=new cc(0,0),eb=65536,Ja=eb*eb,k$=Ja*Ja,R$=new cc(-1,-1),O$=Object.defineProperty,M$=(e,t,n)=>t in e?O$(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,jc=(e,t,n)=>M$(e,typeof t!="symbol"?t+"":t,n),tb=class{constructor(e,t){jc(this,"version"),jc(this,"remoteQuerySet"),jc(this,"queryPath"),jc(this,"logger"),this.version={querySet:0,ts:cc.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 i of n.logLines)xd(this.logger,"info","query",r,i);const s=ld(n.value??null);this.remoteQuerySet.set(n.queryId,{success:!0,value:s,logLines:n.logLines});break}case"QueryFailed":{const r=this.queryPath(n.queryId);if(r)for(const i of n.logLines)xd(this.logger,"info","query",r,i);const{errorData:s}=n;this.remoteQuerySet.set(n.queryId,{success:!1,errorMessage:n.errorMessage,errorData:s!==void 0?ld(s):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 Ff(e){const t=CN(e);return cc.fromBytesLE(Array.from(t))}function N$(e){const t=new Uint8Array(e.toBytesLE());return pN(t)}function nb(e){switch(e.type){case"FatalError":case"AuthError":case"ActionResponse":case"TransitionChunk":case"Ping":return{...e};case"MutationResponse":return e.success?{...e,ts:Ff(e.ts)}:{...e};case"Transition":return{...e,startVersion:{...e.startVersion,ts:Ff(e.startVersion.ts)},endVersion:{...e.endVersion,ts:Ff(e.endVersion.ts)}}}}function P$(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:N$(e.maxObservedTimestamp)}:{...e,maxObservedTimestamp:void 0}}}var L$=Object.defineProperty,_$=(e,t,n)=>t in e?L$(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,vt=(e,t,n)=>_$(e,typeof t!="symbol"?t+"":t,n),F$=1e3,H$=1001,j$=1005,G$=4040,Nu;function ro(){return Nu===void 0&&(Nu=Date.now()),typeof performance>"u"||!performance.now?Date.now():Math.round(Nu+performance.now())}function rb(){return`t=${Math.round((ro()-Nu)/100)/10}s`}var iA={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 V$(e){if(e===void 0)return"Unknown";for(const t of Object.keys(iA))if(e.startsWith(t))return t;return"Unknown"}var U$=class{constructor(e,t,n,r,s,i){this.markConnectionStateDirty=s,this.debug=i,vt(this,"socket"),vt(this,"connectionCount"),vt(this,"_hasEverConnected",!1),vt(this,"lastCloseReason"),vt(this,"transitionChunkBuffer",null),vt(this,"defaultInitialBackoff"),vt(this,"maxBackoff"),vt(this,"retries"),vt(this,"serverInactivityThreshold"),vt(this,"reconnectDueToServerInactivityTimeout"),vt(this,"scheduledReconnect",null),vt(this,"networkOnlineHandler",null),vt(this,"pendingNetworkRecoveryInfo",null),vt(this,"uri"),vt(this,"onOpen"),vt(this,"onResume"),vt(this,"onMessage"),vt(this,"webSocketConstructor"),vt(this,"logger"),vt(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=nb(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:ro()})),this.lastCloseReason!=="InitialConnect"&&(this.lastCloseReason?this.logger.log("WebSocket reconnected at",rb(),"after disconnect due to",this.lastCloseReason):this.logger.log("WebSocket reconnected at",rb())),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=nb(JSON.parse(t.data));if(this._logVerbose(`received ws message with type ${r.type}`),r.type!=="Ping"){if(r.type==="TransitionChunk"){const s=this.assembleTransition(r);if(!s)return;r=s,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!==F$&&t.code!==H$&&t.code!==j$&&t.code!==G$){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=V$(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=P$(e),r=JSON.stringify(n);let s=!1;try{this.socket.ws.send(r),s=!0}catch(i){this.logger.log(`Failed to send message on WebSocket, reconnecting: ${i}`),this.closeAndReconnect("FailedToSendMessage")}return this._logVerbose(`${s?"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=ro(),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=ro()-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:ro()})):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:iA[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=ro()-e.clientClockSkew-e.serverTs/1e6,r=`${Math.round(n)}ms`,s=`${Math.round(t/1e4)/100}MB`,i=t/(n/1e3),o=`${Math.round(i/1e4)/100}MB per second`;this._logVerbose(`received ${s} transition in ${r} at ${o}`),t>2e7?this.logger.log(`received query results totaling more that 20MB (${s}) which will take a long time to download on slower connections`):n>2e4&&this.logger.log(`received query results totaling ${s} which took more than 20s to arrive (${r})`),this.debug&&this.sendMessage({type:"Event",eventType:"ClientReceivedTransition",event:{transitionTransitTime:n,messageLength:t}})}};function z$(){return $$()}function $$(){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 Ra=class extends Error{};Ra.prototype.name="InvalidTokenError";function W$(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 q$(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 W$(t)}catch{return atob(t)}}function oA(e,t){if(typeof e!="string")throw new Ra("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 Ra(`Invalid token specified: missing part #${n+1}`);let s;try{s=q$(r)}catch(i){throw new Ra(`Invalid token specified: invalid base64 for part #${n+1} (${i.message})`)}try{return JSON.parse(s)}catch(i){throw new Ra(`Invalid token specified: invalid json for part #${n+1} (${i.message})`)}}var K$=Object.defineProperty,J$=(e,t,n)=>t in e?K$(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,sn=(e,t,n)=>J$(e,typeof t!="symbol"?t+"":t,n),Q$=1728e6,sb=2,Y$=class{constructor(e,t,n){sn(this,"authState",{state:"noAuth"}),sn(this,"configVersion",0),sn(this,"syncState"),sn(this,"authenticate"),sn(this,"stopSocket"),sn(this,"tryRestartSocket"),sn(this,"pauseSocket"),sn(this,"resumeSocket"),sn(this,"clearAuth"),sn(this,"logger"),sn(this,"refreshTokenLeewaySeconds"),sn(this,"initialAuthTokenReuse"),sn(this,"lastRefreshChange"),sn(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 s={fetchToken:e,onAuthChange:t,onRefreshChange:n};r.value?(this.setAuthState({state:"waitingForServerConfirmationOfCachedToken",config:s,hasRetried:!1}),this.authenticate(r.value)):(this.setAuthState({state:"initialRefetch",config:s}),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>=sb){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, ${sb-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:s}=n;if(!r||!s){this.logger.error("Auth token does not have required fields, cannot refetch the token");return}const i=s-r;if(i<=2){this.logger.error("Auth token does not live long enough, cannot refetch the token");return}let o;t!==void 0?(o=s-(Date.now()-t)/1e3,o<=0&&(o=0)):o=i;let a=Math.min(Q$,(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 oA(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}]`)}},X$=["convexClientConstructed","convexWebSocketOpen","convexFirstMessageReceived"];function Z$(e,t){const n={sessionId:t};typeof performance>"u"||!performance.mark||performance.mark(e,{detail:n})}function e3(e){let t=e.name.slice(6);return t=t.charAt(0).toLowerCase()+t.slice(1),{name:t,startTime:e.startTime}}function t3(e){if(typeof performance>"u"||!performance.getEntriesByName)return[];const t=[];for(const n of X$){const r=performance.getEntriesByName(n).filter(s=>s.entryType==="mark").filter(s=>s.detail.sessionId===e);t.push(...r)}return t.map(e3)}var n3=Object.defineProperty,r3=(e,t,n)=>t in e?n3(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,yt=(e,t,n)=>r3(e,typeof t!="symbol"?t+"":t,n),s3=class{constructor(e,t,n){if(yt(this,"address"),yt(this,"state"),yt(this,"requestManager"),yt(this,"webSocketManager"),yt(this,"authenticationManager"),yt(this,"remoteQuerySet"),yt(this,"optimisticQueryResults"),yt(this,"_transitionHandlerCounter",0),yt(this,"_nextRequestId"),yt(this,"_onTransitionFns",new Map),yt(this,"_sessionId"),yt(this,"firstMessageReceived",!1),yt(this,"debug"),yt(this,"logger"),yt(this,"maxObservedTimestamp"),yt(this,"connectionStateSubscribers",new Map),yt(this,"nextConnectionStateSubscriberId",0),yt(this,"_lastPublishedConnectionState"),yt(this,"markConnectionStateDirty",()=>{Promise.resolve().then(()=>{const h=this.connectionState();if(JSON.stringify(h)!==JSON.stringify(this._lastPublishedConnectionState)){this._lastPublishedConnectionState=h;for(const f of this.connectionStateSubscribers.values())f(h)}})}),yt(this,"mark",h=>{this.debug&&Z$(h,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&&TN(e),n={...n};const r=n.authRefreshTokenLeewaySeconds??10;let s=n.webSocketConstructor;if(!s&&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");s=s||WebSocket,this.debug=n.reportDebugInfoToConvex??!1,this.address=e,this.logger=n.logger===!1?sA({verbose:n.verbose??!1}):n.logger!==!0&&n.logger?n.logger:rA({verbose:n.verbose??!1});const i=e.search("://");if(i===-1)throw new Error("Provided address was not an absolute URL.");const o=e.substring(i+3),a=e.substring(0,i);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/${Jy}/sync`;this.state=new b$,this.remoteQuerySet=new tb(h=>this.state.queryPath(h),this.logger),this.requestManager=new x$(this.logger,this.markConnectionStateDirty);const u=()=>{this.webSocketManager.pause(),this.state.pause()};this.authenticationManager=new Y$(this.state,{authenticate:h=>{const f=this.state.setAuth(h);return this.webSocketManager.sendMessage(f),f.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 T$,this.addOnTransitionHandler(h=>{t(h.queries.map(f=>f.token))}),this._nextRequestId=0,this._sessionId=z$();const{unsavedChangesWarning:d}=n;if(typeof window>"u"||typeof window.addEventListener>"u"){if(d===!0)throw new Error("unsavedChangesWarning requested, but window.addEventListener not found! Remove {unsavedChangesWarning: true} from Convex client options.")}else d!==!1&&window.addEventListener("beforeunload",h=>{if(this.requestManager.hasIncompleteRequests()){h.preventDefault();const f="Are you sure you want to leave? Your changes may not be saved.";return(h||window.event).returnValue=f,f}});this.webSocketManager=new U$(c,{onOpen:h=>{this.mark("convexWebSocketOpen"),this.webSocketManager.sendMessage({...h,type:"Connect",sessionId:this._sessionId,maxObservedTimestamp:this.maxObservedTimestamp}),this.remoteQuerySet=new tb(g=>this.state.queryPath(g),this.logger);const[f,B]=this.state.restart();B&&this.webSocketManager.sendMessage(B),this.webSocketManager.sendMessage(f);for(const g of this.requestManager.restart())this.webSocketManager.sendMessage(g)},onResume:()=>{const[h,f]=this.state.resume();f&&this.webSocketManager.sendMessage(f),h&&this.webSocketManager.sendMessage(h);for(const B of this.requestManager.resume())this.webSocketManager.sendMessage(B)},onMessage:h=>{switch(this.firstMessageReceived||(this.firstMessageReceived=!0,this.mark("convexFirstMessageReceived"),this.reportMarks()),h.type){case"Transition":{this.observedTimestamp(h.endVersion.ts),this.authenticationManager.onTransition(h),this.remoteQuerySet.transition(h),this.state.transition(h);const f=this.requestManager.removeCompleted(this.remoteQuerySet.timestamp());this.notifyOnQueryResultChanges(f);break}case"MutationResponse":{h.success&&this.observedTimestamp(h.ts);const f=this.requestManager.onResponse(h);f!==null&&this.notifyOnQueryResultChanges(new Map([[f.requestId,f.result]]));break}case"ActionResponse":this.requestManager.onResponse(h);break;case"AuthError":this.authenticationManager.onAuthError(h);break;case"FatalError":{const f=C$(this.logger,h.error);throw this.webSocketManager.terminate(),f}}return{hasSyncedPastLastReconnect:this.hasSyncedPastLastReconnect()}},onServerDisconnectError:n.onServerDisconnectError},s,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[s,i]of t){const o=this.state.queryToken(s);if(o!==null){const a={result:i,udfPath:this.state.queryPath(s),args:this.state.queryArgs(s)};n.set(o,a)}}const r=this.optimisticQueryResults.ingestQueryResultsFromServer(n,new Set(e.keys()));this.handleTransition({queries:r.map(s=>({token:s,modification:{kind:"Updated",result:this.optimisticQueryResults.rawQueryResult(s)}})),reflectedMutations:Array.from(e).map(([s,i])=>({requestId:s,result:i})),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?oA(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=Wr(t),{modification:s,queryToken:i,unsubscribe:o}=this.state.subscribe(e,r,n?.journal,n?.componentPath);return s!==null&&this.webSocketManager.sendMessage(s),{queryToken:i,unsubscribe:()=>{const a=o();a&&this.webSocketManager.sendMessage(a)}}}localQueryResult(e,t){const n=Wr(t),r=xi(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=Wr(t),r=xi(e,n);return this.optimisticQueryResults.queryLogs(r)}queryJournal(e,t){const n=Wr(t),r=xi(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?Op(r,new LB(mo("mutation",e,r))):new Error(mo("mutation",e,r));return r.value}async mutationInternal(e,t,n,r){const{mutationPromise:s}=this.enqueueMutation(e,t,n,r);return s}enqueueMutation(e,t,n,r){const s=Wr(t);this.tryReportLongDisconnect();const i=this.nextRequestId;if(this._nextRequestId++,n!==void 0){const l=n.optimisticUpdate;if(l!==void 0){const c=d=>{l(d,s)instanceof Promise&&this.logger.warn("Optimistic update handler returned a Promise. Optimistic updates should be synchronous.")},u=this.optimisticQueryResults.applyOptimisticUpdate(c,i).map(d=>{const h=this.localQueryResultByToken(d);return{token:d,modification:{kind:"Updated",result:h===void 0?void 0:{success:!0,value:h,logLines:[]}}}});this.handleTransition({queries:u,reflectedMutations:[],timestamp:this.remoteQuerySet.timestamp()})}}const o={type:"Mutation",requestId:i,udfPath:e,componentPath:r,args:[Pr(s)]},a=this.webSocketManager.sendMessage(o);return{requestId:i,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?Op(n,new LB(mo("action",e,n))):new Error(mo("action",e,n));return n.value}async actionInternal(e,t,n){const r=Wr(t),s=this.nextRequestId;this._nextRequestId++,this.tryReportLongDisconnect();const i={type:"Action",requestId:s,udfPath:e,componentPath:n,args:[Pr(r)]},o=this.webSocketManager.sendMessage(i);return this.requestManager.request(i,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=t3(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-${Jy}`},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 Hf(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 i3=Object.defineProperty,o3=(e,t,n)=>t in e?i3(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ib=(e,t,n)=>o3(e,typeof t!="symbol"?t+"":t,n),a3=class{constructor(e,t){this.client=e,this.onTransition=t,ib(this,"paginatedQuerySet",new Map),ib(this,"lastTransitionTs"),this.lastTransitionTs=cc.fromNumber(0),this.client.addOnTransitionHandler(n=>this.onBaseTransition(n))}subscribe(e,t,n){const r=Ni(e),s=Yy(r,t,n),i=()=>this.removePaginatedQuerySubscriber(s),o=this.paginatedQuerySet.get(s);return o?(o.numSubscribers+=1,{paginatedQueryToken:s,unsubscribe:i}):(this.paginatedQuerySet.set(s,{token:s,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(s,null,n.initialNumItems),{paginatedQueryToken:s,unsubscribe:i})}localQueryResult(e,t,n){const r=Ni(e),s=Yy(r,t,n);return this.localQueryResultByToken(s)}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=[],s=!1,i=!1;for(const a of n){const l=this.client.localQueryResultByToken(a);if(l===void 0){s=!0,i=!1;continue}const c=Hf(l);r=r.concat(c.page),i=!!c.isDone}let o;return s?o=r.length===0?"LoadingFirstPage":"LoadingMore":i?o="Exhausted":o="CanLoadMore",{results:r,status:o,loadMore:a=>this.loadMoreOfPaginatedQuery(e,a)}}onBaseTransition(e){const t=e.queries.map(i=>i.token),n=this.queriesContainingTokens(t);let r=[];n.length>0&&(this.processPaginatedQuerySplits(n,i=>this.client.localQueryResultByToken(i)),r=n.map(i=>({token:i,modification:{kind:"Updated",result:this.localQueryResultByToken(i)}})));const s={...e,paginatedQueries:r};this.onTransition(s)}loadMoreOfPaginatedQuery(e,t){this.mustGetPaginatedQuery(e);const n=this.queryTokenForLastPageOfPaginatedQuery(e),r=this.client.localQueryResultByToken(n);if(!r)return!1;const s=Hf(r);if(s.isDone)return!1;this.addPageToPaginatedQuery(e,s.continueCursor,t);const i={timestamp:this.lastTransitionTs,reflectedMutations:[],queries:[],paginatedQueries:[{token:e,modification:{kind:"Updated",result:this.localQueryResultByToken(e)}}]};return this.onTransition(i),!0}queriesContainingTokens(e){if(e.length===0)return[];const t=[],n=new Set(e);for(const[r,s]of this.paginatedQuerySet)for(const i of this.allQueryTokens(s))if(n.has(i)){t.push(r);break}return t}processPaginatedQuerySplits(e,t){for(const n of e){const r=this.mustGetPaginatedQuery(n),{ongoingSplits:s,pageKeyToQuery:i,pageKeys:o}=r;for(const[a,[l,c]]of s)t(i.get(l).queryToken)!==void 0&&t(i.get(c).queryToken)!==void 0&&this.completePaginatedQuerySplit(r,a,l,c);for(const a of o){if(s.has(a))continue;const l=i.get(a);if(!l)throw new Error(`No page query for active pageKey ${a}`);const c=t(l.queryToken);if(!c)continue;const u=Hf(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,s){const i=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(i,{...l,cursor:n});const c=this.client.subscribe(e.canonicalizedUdfPath,{...e.args,paginationOpts:{...a,cursor:r,endCursor:s}});e.pageKeyToQuery.set(o,{...c,cursor:r}),e.ongoingSplits.set(t,[i,o])}addPageToPaginatedQuery(e,t,n){const r=this.mustGetPaginatedQuery(e),s=r.nextPageKey++,i={cursor:t,numItems:n,id:r.id},o={...r.args,paginationOpts:i},a=this.client.subscribe(r.canonicalizedUdfPath,o);return r.pageKeys.push(s),r.pageKeyToQuery.set(s,{...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 s=e.pageKeyToQuery.get(t);e.pageKeyToQuery.delete(t);const i=e.pageKeys.indexOf(t);e.pageKeys.splice(i,1,n,r),e.ongoingSplits.delete(t),s.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 l3({getCurrentValue:e,subscribe:t}){const[n,r]=(0,p.useState)(()=>({getCurrentValue:e,subscribe:t,value:e()}));let s=n.value;return(n.getCurrentValue!==e||n.subscribe!==t)&&(s=e(),r({getCurrentValue:e,subscribe:t,value:s})),(0,p.useEffect)(()=>{let i=!1;const o=()=>{i||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(),()=>{i=!0,a()}},[e,t]),s}var c3=Object.defineProperty,u3=(e,t,n)=>t in e?c3(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,jr=(e,t,n)=>u3(e,typeof t!="symbol"?t+"":t,n),d3=5e3;if(typeof p.default>"u")throw new Error("Required dependency 'react' not found");function aA(e,t,n){function r(s){return B3(s),t.mutation(e,s,{optimisticUpdate:n})}return r.withOptimisticUpdate=function(i){if(n!==void 0)throw new Error(`Already specified optimistic update for mutation ${tn(e)}`);return aA(e,t,i)},r}function h3(e,t){return function(n){return t.action(e,n)}}var wse=class{constructor(e,t){if(jr(this,"address"),jr(this,"cachedSync"),jr(this,"cachedPaginatedQueryClient"),jr(this,"listeners"),jr(this,"options"),jr(this,"closed",!1),jr(this,"_logger"),jr(this,"adminAuth"),jr(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?sA({verbose:t?.verbose??!1}):t?.logger!==!0&&t?.logger?t.logger:rA({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 s3(this.address,()=>{},this.options),this.adminAuth&&this.cachedSync.setAdminAuth(this.adminAuth,this.fakeUserIdentity),this.cachedPaginatedQueryClient=new a3(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,s=tn(e);return{onUpdate:i=>{const{queryToken:o,unsubscribe:a}=this.sync.subscribe(s,n,r),l=this.listeners.get(o);return l!==void 0?l.add(i):this.listeners.set(o,new Set([i])),()=>{if(this.closed)return;const c=this.listeners.get(o);c.delete(i),c.size===0&&this.listeners.delete(o),a()}},localQueryResult:()=>{if(this.cachedSync)return this.cachedSync.localQueryResult(s,n)},localQueryLogs:()=>{if(this.cachedSync)return this.cachedSync.localQueryLogs(s,n)},journal:()=>{if(this.cachedSync)return this.cachedSync.queryJournal(s,n)}}}prewarmQuery(e){const t=e.extendSubscriptionFor??d3,n=this.watchQuery(e.query,e.args||{}).onUpdate(()=>{});setTimeout(n,t)}watchPaginatedQuery(e,t,n){const r=tn(e);return{onUpdate:s=>{const{paginatedQueryToken:i,unsubscribe:o}=this.paginatedQueryClient.subscribe(r,t||{},n),a=this.listeners.get(i);return a!==void 0?a.add(s):this.listeners.set(i,new Set([s])),()=>{if(this.closed)return;const l=this.listeners.get(i);l.delete(s),l.size===0&&this.listeners.delete(i),o()}},localQueryResult:()=>this.paginatedQueryClient.localQueryResult(r,t,n)}}mutation(e,...t){const[n,r]=t,s=tn(e);return this.sync.mutation(s,n,r)}action(e,...t){const n=tn(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((s,i)=>{const o=n.onUpdate(()=>{o();try{s(n.localQueryResult())}catch(a){i(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()}}},wh=p.createContext(void 0);function f3(){return(0,p.useContext)(wh)}var Dse=({client:e,children:t})=>p.createElement(wh.Provider,{value:e},t);function lA(e,...t){const n=t[0]==="skip",r=t[0]==="skip"?{}:Wr(t[0]),s=typeof e=="string"?xh(e):e,i=tn(s),o=(0,p.useMemo)(()=>n?{}:{query:{query:s,args:r}},[JSON.stringify(Pr(r)),i,n]),a=C3(o).query;if(a instanceof Error)throw a;return a}function Tse(e){const t=typeof e=="string"?xh(e):e,n=(0,p.useContext)(wh);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,p.useMemo)(()=>aA(t,n),[n,tn(t)])}function Ase(e){const t=(0,p.useContext)(wh),n=typeof e=="string"?xh(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,p.useMemo)(()=>h3(n,t),[t,tn(n)])}function B3(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 p3=Object.defineProperty,m3=(e,t,n)=>t in e?p3(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,jf=(e,t,n)=>m3(e,typeof t!="symbol"?t+"":t,n),g3=class{constructor(e){jf(this,"createWatch"),jf(this,"queries"),jf(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:s}=e[t];if(tn(n),this.queries[t]===void 0)this.addQuery(t,n,r,s?{paginationOptions:s}:{});else{const i=this.queries[t];(tn(n)!==tn(i.query)||JSON.stringify(Pr(r))!==JSON.stringify(Pr(i.args))||JSON.stringify(s)!==JSON.stringify(i.paginationOptions))&&(this.removeQuery(t),this.addQuery(t,n,r,s?{paginationOptions:s}:{}))}}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:s}=e[n],i=e[n].paginationOptions;tn(r);const o=this.createWatch(r,s,i?{paginationOptions:i}:{});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:s,paginationOptions:i}=this.queries[t],o="journal"in s?s.journal():void 0;this.removeQuery(t),this.addQuery(t,n,r,{...o?{journal:o}:[],...i?{paginationOptions:i}:{}})}}destroy(){for(const e of Object.keys(this.queries))this.removeQuery(e);this.listeners=new Set}addQuery(e,t,n,{paginationOptions:r,journal:s}){if(this.queries[e]!==void 0)throw new Error(`Tried to add a new query with identifier ${e} when it already exists.`);const i=this.createWatch(t,n,{...s?{journal:s}:[],...r?{paginationOptions:r}:{}}),o=i.onUpdate(()=>this.notifyListeners());this.queries[e]={query:t,args:n,watch:i,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 C3(e){const t=f3();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 v3(e,(0,p.useMemo)(()=>(n,r,{journal:s,paginationOptions:i})=>i?t.watchPaginatedQuery(n,r,i):t.watchQuery(n,r,s?{journal:s}:{}),[t]))}function v3(e,t){const[n]=(0,p.useState)(()=>new g3(t));n.createWatch!==t&&n.setCreateWatch(t),(0,p.useEffect)(()=>()=>n.destroy(),[n]);const r=(0,p.useMemo)(()=>({getCurrentValue:()=>n.getLocalResults(e),subscribe:s=>(n.setQueries(e),n.subscribe(s))}),[n,e]);return l3(r)}function y3(e){if(!e||typeof document>"u")return;let t=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css",t.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}var b3=e=>{switch(e){case"success":return x3;case"info":return D3;case"warning":return w3;case"error":return T3;default:return null}},S3=Array(12).fill(0),E3=({visible:e,className:t})=>p.createElement("div",{className:["sonner-loading-wrapper",t].filter(Boolean).join(" "),"data-visible":e},p.createElement("div",{className:"sonner-spinner"},S3.map((n,r)=>p.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${r}`})))),x3=p.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20","aria-hidden":"true"},p.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),w3=p.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20","aria-hidden":"true"},p.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),D3=p.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20","aria-hidden":"true"},p.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),T3=p.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20","aria-hidden":"true"},p.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),A3=p.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true"},p.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),p.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),I3=()=>{const[e,t]=p.useState(document.hidden);return p.useEffect(()=>{const n=()=>{t(document.hidden)};return document.addEventListener("visibilitychange",n),()=>document.removeEventListener("visibilitychange",n)},[]),e},k3=1,R3=100,ob=e=>{var t;return typeof e?.id=="number"||(e==null||(t=e.id)==null?void 0:t.length)>0?e.id:k3++},O3=class{constructor(){this.subscribe=e=>(this.subscribers.push(e),this.getActiveToasts().forEach(t=>e(t)),()=>{const t=this.subscribers.indexOf(e);this.subscribers.splice(t,1)}),this.publish=e=>{this.subscribers.forEach(t=>t(e))},this.addToast=e=>{this.publish(e),this.toasts=[...this.toasts,e],this.trimHistory()},this.trimHistory=()=>{let e=this.toasts.length-R3;e<=0||(this.toasts=this.toasts.filter(t=>e>0&&this.dismissedToasts.has(t.id)?(this.dismissedToasts.delete(t.id),e--,!1):!0))},this.create=e=>{const{message:t,...n}=e,r=ob(e),s=this.pendingDismissals.get(r);s!==void 0&&(cancelAnimationFrame(s),this.pendingDismissals.delete(r),this.dismissedToasts.delete(r));const i=this.dismissedToasts.has(r),o=e.dismissible===void 0?!0:e.dismissible;return i&&(this.dismissedToasts.delete(r),this.toasts=this.toasts.filter(a=>a.id!==r)),!i&&this.toasts.find(a=>a.id===r)?this.toasts=this.toasts.map(a=>a.id===r?(this.publish({...a,...e,id:r,title:t}),{...a,...e,id:r,dismissible:o,title:t}):a):this.addToast({title:t,...n,dismissible:o,id:r}),r},this.dismiss=e=>{if(e==null)return this.getActiveToasts().forEach(n=>{this.dismissedToasts.add(n.id),this.subscribers.forEach(r=>r({id:n.id,dismiss:!0}))}),e;this.dismissedToasts.add(e);const t=this.pendingDismissals.get(e);return t!==void 0&&cancelAnimationFrame(t),this.pendingDismissals.set(e,requestAnimationFrame(()=>{this.pendingDismissals.delete(e),this.subscribers.forEach(n=>n({id:e,dismiss:!0}))})),e},this.message=(e,t)=>this.create({...t,message:e,type:void 0}),this.error=(e,t)=>this.create({...t,message:e,type:"error"}),this.success=(e,t)=>this.create({...t,type:"success",message:e}),this.info=(e,t)=>this.create({...t,type:"info",message:e}),this.warning=(e,t)=>this.create({...t,type:"warning",message:e}),this.loading=(e,t)=>this.create({...t,type:"loading",message:e}),this.promise=(e,t)=>{if(!t)return;let n;t.loading!==void 0&&(n=this.create({...t,promise:e,type:"loading",message:t.loading,description:typeof t.description!="function"?t.description:void 0}));const r=Promise.resolve(e instanceof Function?e():e);let s=n!==void 0,i;const o=r.then(async l=>{if(i=["resolve",l],p.isValidElement(l))s=!1,this.create({id:n,type:"default",message:l});else if(N3(l)&&!l.ok){s=!1;const c=typeof t.error=="function"?await t.error(`HTTP error! status: ${l.status}`):t.error,u=typeof t.description=="function"?await t.description(`HTTP error! status: ${l.status}`):t.description,d=typeof c=="object"&&!p.isValidElement(c)?c:{message:c};this.create({id:n,type:"error",description:u,...d})}else if(l instanceof Error){s=!1;const c=typeof t.error=="function"?await t.error(l):t.error,u=typeof t.description=="function"?await t.description(l):t.description,d=typeof c=="object"&&!p.isValidElement(c)?c:{message:c};this.create({id:n,type:"error",description:u,...d})}else if(t.success!==void 0){s=!1;const c=typeof t.success=="function"?await t.success(l):t.success,u=typeof t.description=="function"?await t.description(l):t.description,d=typeof c=="object"&&!p.isValidElement(c)?c:{message:c};this.create({id:n,type:"success",description:u,...d})}}).catch(async l=>{if(i=["reject",l],t.error!==void 0){s=!1;const c=typeof t.error=="function"?await t.error(l):t.error,u=typeof t.description=="function"?await t.description(l):t.description,d=typeof c=="object"&&!p.isValidElement(c)?c:{message:c};this.create({id:n,type:"error",description:u,...d})}}).finally(()=>{s&&(this.dismiss(n),n=void 0),t.finally==null||t.finally.call(t)}),a=()=>new Promise((l,c)=>o.then(()=>i[0]==="reject"?c(i[1]):l(i[1])).catch(c));return typeof n!="string"&&typeof n!="number"?{unwrap:a}:Object.assign(n,{unwrap:a})},this.custom=(e,t)=>{const n=ob(t);return this.create({...t,jsx:e(n),id:n,type:void 0}),n},this.getActiveToasts=()=>this.toasts.filter(e=>!this.dismissedToasts.has(e.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set,this.pendingDismissals=new Map}},ln=new O3,M3=(e,t)=>ln.message(e,t),N3=e=>e&&typeof e=="object"&&"ok"in e&&typeof e.ok=="boolean"&&"status"in e&&typeof e.status=="number",P3=M3,L3=()=>ln.toasts,_3=()=>ln.getActiveToasts(),Np=Object.assign(P3,{success:ln.success,info:ln.info,warning:ln.warning,error:ln.error,custom:ln.custom,message:ln.message,promise:ln.promise,dismiss:ln.dismiss,loading:ln.loading},{getHistory:L3,getToasts:_3});y3("[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px;flex:1;min-width:0}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--normal-text);background:var(--normal-bg);border:1px solid var(--normal-border);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{-webkit-user-select:none;user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}");function Gc(e){return e.label!==void 0}var F3=3,H3="24px",j3="16px",ab=4e3,G3=356,V3=14,U3=45,z3=200;function Cr(...e){return e.filter(Boolean).join(" ")}function $3(e){const[t,n]=e.split("-"),r=[];return t&&r.push(t),n&&r.push(n),r}var W3=e=>{var t,n,r,s,i,o,a,l,c;const{invert:u,toast:d,unstyled:h,interacting:f,setHeights:B,visibleToasts:g,heights:C,index:v,toasts:y,expanded:S,removeToast:E,defaultRichColors:D,closeButton:A,style:x,cancelButtonStyle:O,actionButtonStyle:R,className:P="",descriptionClassName:_="",duration:N,position:W,gap:q,expandByDefault:F,classNames:z,icons:J,closeButtonAriaLabel:Z="Close toast"}=e,[Q,G]=p.useState(null),[be,ve]=p.useState(null),[X,Y]=p.useState(!1),[ie,ne]=p.useState(!1),[ee,Be]=p.useState(!1),[de,Re]=p.useState(!1),[Ee,st]=p.useState(!1),[at,Bt]=p.useState(0),[tt,pt]=p.useState(0),Lt=p.useRef(d.duration||N||ab),mt=p.useRef(null),lt=p.useRef(null),Un=v===0,it=v+1<=g,ae=d.type,je=ae??"default",Le=d.dismissible!==!1,zn=d.className||"",_t=d.descriptionClassName||"",Vt=p.useMemo(()=>C.findIndex(te=>te.toastId===d.id)||0,[C,d.id]),Bn=p.useMemo(()=>{var te;return(te=d.closeButton)!=null?te:A},[d.closeButton,A]),An=p.useMemo(()=>d.duration||N||ab,[d.duration,N]),gs=p.useRef(0),Ge=p.useRef(0),Cs=p.useRef(0),Kt=p.useRef(null),[vs,Qe]=W.split("-"),xc=p.useMemo(()=>C.reduce((te,He,ze)=>ze>=Vt?te:te+He.height,0),[C,Vt]),ti=I3(),pn=p.useMemo(()=>{var te;return(te=e.swipeDirections)!=null?te:$3(W)},[e.swipeDirections,W]),sf=d.invert||u,ni=ae==="loading";Ge.current=p.useMemo(()=>Vt*q+xc,[Vt,xc]),p.useEffect(()=>{Lt.current=An},[An]),p.useEffect(()=>{Y(!0)},[]),p.useEffect(()=>{const te=lt.current;if(te){const He=te.getBoundingClientRect().height;return pt(He),B(ze=>[{toastId:d.id,height:He,position:d.position},...ze]),()=>B(ze=>ze.filter(ct=>ct.toastId!==d.id))}},[B,d.id]),p.useLayoutEffect(()=>{if(!X)return;const te=lt.current,He=te.style.height;te.style.height="auto";const ze=te.getBoundingClientRect().height;te.style.height=He,pt(ze),B(ct=>ct.find(_e=>_e.toastId===d.id)?ct.map(_e=>_e.toastId===d.id?{..._e,height:ze}:_e):[{toastId:d.id,height:ze,position:d.position},...ct])},[X,d.title,d.description,B,d.id,d.jsx,d.action,d.cancel]);const pr=p.useCallback(()=>{ne(!0),Bt(Ge.current),B(te=>te.filter(He=>He.toastId!==d.id)),setTimeout(()=>{E(d)},z3)},[d,E,B,Ge]);p.useEffect(()=>{if(d.promise&&ae==="loading"||d.duration===1/0||d.type==="loading")return;let te;return S||f||ti?(()=>{if(Cs.current<gs.current){const ct=new Date().getTime()-gs.current;Lt.current=Lt.current-ct}Cs.current=new Date().getTime()})():Lt.current!==1/0&&(gs.current=new Date().getTime(),te=setTimeout(()=>{d.onAutoClose==null||d.onAutoClose.call(d,d),pr()},Lt.current)),()=>clearTimeout(te)},[S,f,d,ae,ti,pr]),p.useEffect(()=>{d.delete&&(pr(),d.onDismiss==null||d.onDismiss.call(d,d))},[pr,d.delete]);function j(){var te;if(J?.loading){var He;return p.createElement("div",{className:Cr(z?.loader,d==null||(He=d.classNames)==null?void 0:He.loader,"sonner-loader"),"data-visible":ae==="loading"},J.loading)}return p.createElement(E3,{className:Cr(z?.loader,d==null||(te=d.classNames)==null?void 0:te.loader),visible:ae==="loading"})}const we=d.icon||J?.[ae]||b3(ae);var Ae,Ye;return p.createElement("li",{tabIndex:0,ref:lt,className:Cr(P,zn,z?.toast,d==null||(t=d.classNames)==null?void 0:t.toast,z?.[je],d==null||(n=d.classNames)==null?void 0:n[je]),"data-sonner-toast":"","data-rich-colors":(Ae=d.richColors)!=null?Ae:D,"data-styled":!(d.jsx||d.unstyled||h),"data-mounted":X,"data-promise":!!d.promise,"data-swiped":Ee,"data-removed":ie,"data-visible":it,"data-y-position":vs,"data-x-position":Qe,"data-index":v,"data-front":Un,"data-swiping":ee,"data-dismissible":Le,"data-type":ae,"data-invert":sf,"data-swipe-out":de,"data-swipe-direction":be,"data-expanded":!!(S||F&&X),"data-testid":d.testId,style:{"--index":v,"--toasts-before":v,"--z-index":y.length-v,"--offset":`${ie?at:Ge.current}px`,"--initial-height":F?"auto":`${tt}px`,...x,...d.style},onDragEnd:()=>{Be(!1),G(null),Kt.current=null},onPointerDown:te=>{te.button!==2&&(ni||!Le||(mt.current=new Date,Bt(Ge.current),te.target.setPointerCapture(te.pointerId),te.target.tagName!=="BUTTON"&&(Be(!0),Kt.current={x:te.clientX,y:te.clientY})))},onPointerUp:()=>{var te,He,ze;if(de||!Le)return;Kt.current=null;const ct=Number(((te=lt.current)==null?void 0:te.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),_e=Number(((He=lt.current)==null?void 0:He.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),St=new Date().getTime()-((ze=mt.current)==null?void 0:ze.getTime()),ot=Q==="x"?ct:_e,mr=Math.abs(ot)/St;if((Q==="x"?pn.includes(ct>0?"right":"left"):pn.includes(_e>0?"bottom":"top"))&&(Math.abs(ot)>=U3||mr>.11)){Bt(Ge.current),d.onDismiss==null||d.onDismiss.call(d,d),ve(Q==="x"?ct>0?"right":"left":_e>0?"down":"up"),pr(),Re(!0);return}else{var Ct,ys;(Ct=lt.current)==null||Ct.style.setProperty("--swipe-amount-x","0px"),(ys=lt.current)==null||ys.style.setProperty("--swipe-amount-y","0px")}st(!1),Be(!1),G(null)},onPointerMove:te=>{var He,ze,ct;if(!Kt.current||!Le||((He=window.getSelection())==null?void 0:He.toString().length)>0)return;const _e=te.clientY-Kt.current.y,St=te.clientX-Kt.current.x;!Q&&(Math.abs(St)>1||Math.abs(_e)>1)&&G(Math.abs(St)>Math.abs(_e)?"x":"y");let ot={x:0,y:0};const mr=Ct=>1/(1.5+Math.abs(Ct)/20);if(Q==="y"){if(pn.includes("top")||pn.includes("bottom"))if(pn.includes("top")&&_e<0||pn.includes("bottom")&&_e>0)ot.y=_e;else{const Ct=_e*mr(_e);ot.y=Math.abs(Ct)<Math.abs(_e)?Ct:_e}}else if(Q==="x"&&(pn.includes("left")||pn.includes("right")))if(pn.includes("left")&&St<0||pn.includes("right")&&St>0)ot.x=St;else{const Ct=St*mr(St);ot.x=Math.abs(Ct)<Math.abs(St)?Ct:St}(Math.abs(ot.x)>0||Math.abs(ot.y)>0)&&st(!0),(ze=lt.current)==null||ze.style.setProperty("--swipe-amount-x",`${ot.x}px`),(ct=lt.current)==null||ct.style.setProperty("--swipe-amount-y",`${ot.y}px`)}},Bn&&!d.jsx&&ae!=="loading"?p.createElement("button",{"aria-label":Z,"data-disabled":ni,"data-close-button":!0,onClick:ni||!Le?()=>{}:()=>{pr(),d.onDismiss==null||d.onDismiss.call(d,d)},className:Cr(z?.closeButton,d==null||(r=d.classNames)==null?void 0:r.closeButton)},(Ye=J?.close)!=null?Ye:A3):null,(ae||d.icon||d.promise)&&d.icon!==null&&(J?.[ae]!==null||d.icon)?p.createElement("div",{"data-icon":"",className:Cr(z?.icon,d==null||(s=d.classNames)==null?void 0:s.icon)},ae==="loading"?d.icon||j():d.promise?j():null,ae!=="loading"?we:null):null,p.createElement("div",{"data-content":"",className:Cr(z?.content,d==null||(i=d.classNames)==null?void 0:i.content)},p.createElement("div",{"data-title":"",className:Cr(z?.title,d==null||(o=d.classNames)==null?void 0:o.title)},d.jsx?d.jsx:typeof d.title=="function"?d.title():d.title),d.description?p.createElement("div",{"data-description":"",className:Cr(_,_t,z?.description,d==null||(a=d.classNames)==null?void 0:a.description)},typeof d.description=="function"?d.description():d.description):null),p.isValidElement(d.cancel)?d.cancel:d.cancel&&Gc(d.cancel)?p.createElement("button",{"data-button":!0,"data-cancel":!0,style:d.cancelButtonStyle||O,onClick:te=>{Gc(d.cancel)&&Le&&(d.cancel.onClick==null||d.cancel.onClick.call(d.cancel,te),pr())},className:Cr(z?.cancelButton,d==null||(l=d.classNames)==null?void 0:l.cancelButton)},d.cancel.label):null,p.isValidElement(d.action)?d.action:d.action&&Gc(d.action)?p.createElement("button",{"data-button":!0,"data-action":!0,style:d.actionButtonStyle||R,onClick:te=>{Gc(d.action)&&(d.action.onClick==null||d.action.onClick.call(d.action,te),!te.defaultPrevented&&pr())},className:Cr(z?.actionButton,d==null||(c=d.classNames)==null?void 0:c.actionButton)},d.action.label):null)};function lb(){if(typeof window>"u"||typeof document>"u")return"ltr";const e=document.documentElement.getAttribute("dir");return e==="auto"||!e?window.getComputedStyle(document.documentElement).direction:e}function q3(e,t){const n={};return[e,t].forEach((r,s)=>{const i=s===1,o=i?"--mobile-offset":"--offset",a=i?j3:H3;function l(c){["top","right","bottom","left"].forEach(u=>{n[`${o}-${u}`]=typeof c=="number"?`${c}px`:c})}typeof r=="number"||typeof r=="string"?l(r):typeof r=="object"?["top","right","bottom","left"].forEach(c=>{r[c]===void 0?n[`${o}-${c}`]=a:n[`${o}-${c}`]=typeof r[c]=="number"?`${r[c]}px`:r[c]}):l(a)}),n}var Ise=p.forwardRef(function(t,n){const{id:r,invert:s,position:i="bottom-right",hotkey:o=["altKey","KeyT"],expand:a,closeButton:l,className:c,offset:u,mobileOffset:d,theme:h="light",richColors:f,duration:B,style:g,visibleToasts:C=F3,toastOptions:v,dir:y=lb(),gap:S=V3,icons:E,customAriaLabel:D,containerAriaLabel:A="Notifications"}=t,[x,O]=p.useState([]),R=p.useMemo(()=>r?x.filter(Y=>Y.toasterId===r):x.filter(Y=>!Y.toasterId),[x,r]),P=p.useMemo(()=>Array.from(new Set([i].concat(R.filter(Y=>Y.position).map(Y=>Y.position)))),[R,i]),[_,N]=p.useState([]),[W,q]=p.useState(!1),[F,z]=p.useState(!1),[J,Z]=p.useState(h!=="system"?h:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),Q=p.useRef(null),G=o.join("+").replace(/Key/g,"").replace(/Digit/g,""),be=p.useRef(null),ve=p.useRef(!1),X=p.useCallback(Y=>{O(ie=>{var ne;return(ne=ie.find(ee=>ee.id===Y.id))!=null&&ne.delete||ln.dismiss(Y.id),ie.filter(({id:ee})=>ee!==Y.id)})},[]);return p.useEffect(()=>ln.subscribe(Y=>{if(Y.dismiss){requestAnimationFrame(()=>{O(ie=>ie.map(ne=>ne.id===Y.id?{...ne,delete:!0}:ne))});return}setTimeout(()=>{Yo.flushSync(()=>{O(ie=>{const ne=ie.findIndex(ee=>ee.id===Y.id);return ne!==-1?[...ie.slice(0,ne),{...ie[ne],...Y},...ie.slice(ne+1)]:[Y,...ie]})})})}),[]),p.useEffect(()=>{if(h!=="system"){Z(h);return}if(h==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?Z("dark"):Z("light")),typeof window>"u")return;const Y=window.matchMedia("(prefers-color-scheme: dark)");try{Y.addEventListener("change",({matches:ie})=>{Z(ie?"dark":"light")})}catch{Y.addListener(({matches:ne})=>{try{Z(ne?"dark":"light")}catch(ee){console.error(ee)}})}},[h]),p.useEffect(()=>{x.length<=1&&q(!1)},[x]),p.useEffect(()=>{const Y=ie=>{var ne;if(o.length>0&&o.every(Be=>ie[Be]||ie.code===Be)){var ee;q(!0),(ee=Q.current)==null||ee.focus()}ie.code==="Escape"&&(document.activeElement===Q.current||(ne=Q.current)!=null&&ne.contains(document.activeElement))&&q(!1)};return document.addEventListener("keydown",Y),()=>document.removeEventListener("keydown",Y)},[o]),p.useEffect(()=>{if(Q.current)return()=>{be.current&&(be.current.focus({preventScroll:!0}),be.current=null,ve.current=!1)}},[Q.current]),p.createElement("section",{ref:n,"aria-label":D??`${A} ${G}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0,"data-react-aria-top-layer":!0},P.map((Y,ie)=>{var ne;const[ee,Be]=Y.split("-");return R.length?p.createElement("ol",{key:Y,dir:y==="auto"?lb():y,tabIndex:-1,ref:Q,className:c,"data-sonner-toaster":!0,"data-sonner-theme":J,"data-y-position":ee,"data-x-position":Be,style:{"--front-toast-height":`${((ne=_[0])==null?void 0:ne.height)||0}px`,"--width":`${G3}px`,"--gap":`${S}px`,...g,...q3(u,d)},onBlur:de=>{ve.current&&!de.currentTarget.contains(de.relatedTarget)&&(ve.current=!1,be.current&&(be.current.focus({preventScroll:!0}),be.current=null))},onFocus:de=>{de.target instanceof HTMLElement&&de.target.dataset.dismissible==="false"||ve.current||(ve.current=!0,be.current=de.relatedTarget)},onMouseEnter:()=>q(!0),onMouseMove:()=>q(!0),onMouseLeave:()=>{F||q(!1)},onDragEnd:()=>q(!1),onPointerDown:de=>{de.target instanceof HTMLElement&&de.target.dataset.dismissible==="false"||z(!0)},onPointerUp:()=>z(!1)},R.filter(de=>!de.position&&ie===0||de.position===Y).map((de,Re)=>{var Ee,st;return p.createElement(W3,{key:de.id,icons:E,index:Re,toast:de,defaultRichColors:f,duration:(Ee=v?.duration)!=null?Ee:B,className:v?.className,descriptionClassName:v?.descriptionClassName,invert:s,visibleToasts:C,closeButton:(st=v?.closeButton)!=null?st:l,interacting:F,position:Y,style:v?.style,unstyled:v?.unstyled,classNames:v?.classNames,cancelButtonStyle:v?.cancelButtonStyle,actionButtonStyle:v?.actionButtonStyle,closeButtonAriaLabel:v?.closeButtonAriaLabel,removeToast:X,toasts:R.filter(at=>at.position==de.position),heights:_.filter(at=>at.position==de.position),setHeights:N,expandByDefault:a,gap:S,expanded:W,swipeDirections:t.swipeDirections})})):null}))});function K3(e,t){return e?.slug==="sdk/protocol_version_pin_unsupported"?!0:typeof t=="string"&&J3.test(t)}var J3=/which this client is pinned to/i;function Q3({text:e,copyText:t}){const[n,r]=(0,p.useState)(!1);return(0,p.useEffect)(()=>{if(!n)return;const s=setTimeout(()=>r(!1),1500);return()=>clearTimeout(s)},[n]),(0,m.jsxs)("div",{className:"relative min-h-5 pr-7",children:[(0,m.jsx)("span",{className:"whitespace-pre-wrap break-words",children:e}),(0,m.jsx)("button",{type:"button","aria-label":"Copy error message",title:"Copy error message",onClick:s=>{s.stopPropagation(),ra(t??e).then(i=>{i&&r(!0)})},className:"absolute right-2 top-0 z-10 flex h-5 w-5 items-center justify-center rounded-full border border-border bg-popover text-muted-foreground opacity-0 transition-opacity hover:text-foreground focus-visible:opacity-100 group-hover/toast:opacity-100",children:n?(0,m.jsx)(Vs,{className:"h-3 w-3 text-green-500"}):(0,m.jsx)(_s,{className:"h-3 w-3"})})]})}var Y3=8e3;function X3(e,t){if(!t?.action&&typeof e=="string"&&K3(void 0,e))return{action:{label:"Change protocol version",onClick:()=>{Ed("change_protocol_version_clicked",{location:"toast_fallback",has_host_id:!1}),PN(_N.hosts)}}}}function Z3(e,t){const{text:n,requestId:r}=bN(e),s=t?.description,i=typeof s=="string"&&s.trim()!==""?s:void 0;if(!r)return{title:e,description:i};if(s!=null&&typeof s!="string")return{title:e,description:void 0};const o=`Reference ${r}`;return{title:n||e,description:i?`${i}
|
|
43
|
+
${o}`:o}}var e4=(e,t)=>{const n=typeof e=="string"?Z3(e,t):null;return Np.error(n?(0,m.jsx)(Q3,{text:n.title,copyText:n.description?`${n.title}: ${n.description}`:void 0}):e,{duration:Y3,...t,...n?.description?{description:n.description}:{},...X3(e,t)})},t4=Object.assign((...e)=>Np(...e),Np,{error:e4}),Dd=class extends p.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),IN(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,m.jsx)("div",{className:"flex items-center justify-center min-h-[400px] p-6",children:(0,m.jsxs)("div",{className:"text-center max-w-md",children:[(0,m.jsx)(dh,{className:"h-12 w-12 text-destructive mx-auto mb-4"}),(0,m.jsx)("h2",{className:"text-xl font-semibold mb-2",children:"Something went wrong"}),(0,m.jsx)("p",{className:"text-sm text-muted-foreground mb-4",children:this.state.error?.message||"An unexpected error occurred"}),(0,m.jsx)(kn,{onClick:this.handleReset,variant:"outline",children:"Try again"})]})}):this.props.children}};function Gf(e){return e.trim().toLowerCase()}function n4(e,t){return e.createdAt-t.createdAt||e.hostId.localeCompare(t.hostId)}function kse(e){const t=new Map,n=new Map;for(const i of e){const o=i.name.trim()||"Client",a=Gf(o);n.set(a,n.get(a)??o);const l=t.get(a)??[];l.push(i),t.set(a,l)}const r=new Set(n.keys()),s=new Map;for(const i of t.values()){const o=[...i].sort(n4),a=o[0]?.name.trim()||"Client";let l=2;o.forEach((c,u)=>{if(u===0){s.set(c.hostId,a);return}let d=`${a} #${l}`;for(;r.has(Gf(d));)l+=1,d=`${a} #${l}`;r.add(Gf(d)),s.set(c.hostId,d),l+=1})}return s}function cb(e){return e.displayName??e.name}function LC({...e}){return(0,m.jsx)(C2,{"data-slot":"dropdown-menu",...e})}function _C({...e}){return(0,m.jsx)(v2,{"data-slot":"dropdown-menu-trigger",...e})}function FC({className:e,sideOffset:t=4,...n}){return(0,m.jsx)(y2,{children:(0,m.jsx)(b2,{"data-slot":"dropdown-menu-content",sideOffset:t,className:he("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 Pu({className:e,inset:t,variant:n="default",...r}){return(0,m.jsx)(E2,{"data-slot":"dropdown-menu-item","data-inset":t,"data-variant":n,className:he("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 Rse({className:e,children:t,checked:n,...r}){return(0,m.jsxs)(x2,{"data-slot":"dropdown-menu-checkbox-item",className:he("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,m.jsx)("span",{className:"pointer-events-none absolute left-2 flex size-3.5 items-center justify-center",children:(0,m.jsx)(Qw,{children:(0,m.jsx)(Vs,{className:"size-4"})})}),t]})}function r4({...e}){return(0,m.jsx)(w2,{"data-slot":"dropdown-menu-radio-group",...e})}function s4({className:e,children:t,hideIndicator:n=!1,...r}){return(0,m.jsxs)(D2,{"data-slot":"dropdown-menu-radio-item",className:he("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,m.jsx)("span",{className:"pointer-events-none absolute left-2 flex size-3.5 items-center justify-center",children:(0,m.jsx)(Qw,{children:(0,m.jsx)($N,{className:"size-2 fill-current"})})}),t]})}function i4({className:e,inset:t,...n}){return(0,m.jsx)(S2,{"data-slot":"dropdown-menu-label","data-inset":t,className:he("px-2 py-1.5 text-sm font-medium data-[inset]:pl-8",e),...n})}function Ose({className:e,...t}){return(0,m.jsx)(T2,{"data-slot":"dropdown-menu-separator",className:he("bg-border -mx-1 my-1 h-px",e),...t})}function Mse({...e}){return(0,m.jsx)(A2,{"data-slot":"dropdown-menu-sub",...e})}function Nse({className:e,inset:t,children:n,...r}){return(0,m.jsxs)(I2,{"data-slot":"dropdown-menu-sub-trigger","data-inset":t,className:he("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,m.jsx)(Mo,{className:"ml-auto size-4"})]})}function Pse({className:e,...t}){return(0,m.jsx)(k2,{"data-slot":"dropdown-menu-sub-content",className:he("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})}function o4({delayDuration:e=0,...t}){return(0,m.jsx)(BH,{"data-slot":"tooltip-provider",delayDuration:e,...t})}function xs({...e}){return(0,m.jsx)(o4,{children:(0,m.jsx)(pH,{"data-slot":"tooltip",...e})})}function ws({...e}){return(0,m.jsx)(mH,{"data-slot":"tooltip-trigger",...e})}var cA="rounded-md px-3 py-1.5 text-xs",uA="bg-primary text-primary-foreground",dA="z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]",Lse=`${cA} ${uA}`,a4=`${dA} bg-primary fill-primary`;function Ds({className:e,sideOffset:t=0,children:n,variant:r="default",...s}){const i=r==="muted";return(0,m.jsx)(gH,{children:(0,m.jsxs)(CH,{"data-slot":"tooltip-content",sideOffset:t,className:he("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)",cA,i?"border border-border bg-popover text-popover-foreground shadow-md":uA,e),...s,children:[n,(0,m.jsx)(vH,{className:i?he(dA,"fill-popover"):a4})]})})}function _se({reason:e,fallback:t,children:n,...r}){const s=e||t;return s?(0,m.jsxs)(xs,{children:[(0,m.jsx)(ws,{asChild:!0,children:e?(0,m.jsx)("span",{className:"inline-flex rounded-md outline-none focus-visible:ring-ring/50 focus-visible:ring-[3px]",tabIndex:0,children:n}):n}),(0,m.jsx)(Ds,{...r,children:s})]}):n}var l4=(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,s){r.__proto__=s}||function(r,s){for(var i in s)Object.prototype.hasOwnProperty.call(s,i)&&(r[i]=s[i])},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 c4=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 Vc,ub="__POSTHOG_REACT_SHARED_STATE__",db=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{},Tl;try{Tl=db[ub]=db[ub]||new WeakMap}catch{Tl=new WeakMap}Tl.has(p.createContext)||Tl.set(p.createContext,{});var wi=Tl.get(p.createContext),Pp;function u4(e){(!wi.defaultPostHogInstance||wi.defaultPostHogInstance===Pp)&&(wi.defaultPostHogInstance=e),Pp=e}function Lp(){return Pp}wi.context||(wi.context=(0,p.createContext)({get client(){return Lp()||wi.defaultPostHogInstance},bootstrap:void 0}));var ia=wi.context;function hA(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),s=Object.keys(t);if(r.length!==s.length)return!1;for(var i=0,o=r;i<o.length;i++){var a=o[i];if(!s.includes(a)||!hA(e[a],t[a],n))return!1}return!0}function Fse(e){var t,n,r=e.children,s=e.client,i=e.apiKey,o=e.options,a=(0,p.useRef)(null),l=(0,p.useMemo)(function(){if(s)return i&&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`."),s;var c=Lp();return i||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},[s,i,JSON.stringify(o)]);return(0,p.useEffect)(function(){if(!(s||!i)){var c=Lp(),u=a.current;u?(i!==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&&!hA(o,u.options)&&c.set_config(o),a.current={apiKey:i,options:o??{}}):(c.__loaded&&console.warn("[PostHog.js] `posthog` was already loaded elsewhere. This may cause issues."),c.init(i,o),a.current={apiKey:i,options:o??{}})}},[s,i,JSON.stringify(o)]),p.createElement(ia.Provider,{value:{client:l,bootstrap:(t=o?.bootstrap)!==null&&t!==void 0?t:(n=s?.config)===null||n===void 0?void 0:n.bootstrap}},r)}var Vf=function(e){return typeof e=="function"},_p=function(e){return e===void 0};function d4(e,t){var n,r,s=(0,p.useContext)(ia),i=s.client,o=s.bootstrap,a=(0,p.useState)(function(){return i.isFeatureEnabled(e)}),l=a[0],c=a[1];(0,p.useEffect)(function(){return i.onFeatureFlags(function(){c(i.isFeatureEnabled(e))})},[i,e]);var u=(n=o?.featureFlags)===null||n===void 0?void 0:n[e];return!(!((r=i?.featureFlags)===null||r===void 0)&&r.hasLoadedFlags)&&o?.featureFlags?_p(u)?t:!!u:_p(l)?t:l}function Hse(){var e,t=(0,p.useContext)(ia),n=t.client,r=t.bootstrap,s=(0,p.useState)(function(){return n.featureFlags.getFlags()}),i=s[0],o=s[1];return(0,p.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]}):i}function h4(e){var t,n=(0,p.useContext)(ia),r=n.client,s=n.bootstrap,i=(0,p.useState)(function(){return r.getFeatureFlag(e)}),o=i[0],a=i[1];return(0,p.useEffect)(function(){return r.onFeatureFlags(function(){a(r.getFeatureFlag(e))})},[r,e]),!(!((t=r?.featureFlags)===null||t===void 0)&&t.hasLoadedFlags)&&s?.featureFlags?s.featureFlags[e]:o}var jse=function(){return(0,p.useContext)(ia).client},Lu=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]"},f4=function(e,t){try{Object.defineProperty(e,"name",{value:t,writable:!0,enumerable:!0,configurable:!0})}catch{}},B4=function(e,t){for(var n=new WeakSet,r=e;!n.has(r);){if(n.add(r),!Lu(r.cause)){_p(r.cause)||(t.cause=r.cause),r.cause=t;return}r=r.cause}},p4=function(e,t){if(!t)return e;var n=new Error(Lu(e)?e.message:"Primitive value captured as exception: ".concat(String(e)));return f4(n,"React ErrorBoundary ".concat(Lu(e)?e.name:"Error")),n.stack=t,Lu(e)?(B4(e,n),e):n},hb={componentStack:null,exceptionEvent:null,error:null},m4={INVALID_FALLBACK:"[PostHog.js][PostHogErrorBoundary] Invalid fallback prop, provide a valid React element or a function that returns a valid React element."},Gse=(Vc=(function(e){l4(t,e);function t(n){var r=e.call(this,n)||this;return r._resetError=function(){r.setState(hb)},r.state=hb,r}return t.prototype.componentDidCatch=function(n,r){var s=this.props.additionalProperties,i;Vf(s)?i=s(n,r):typeof s=="object"&&(i=s);var o=this.context.client,a=r.componentStack,l=o.captureException(p4(n,a),i);this.setState({error:n,componentStack:a??null,exceptionEvent:l})},t.prototype.render=function(){var n=this.props,r=n.children,s=n.fallback,i=this.state;if(i.componentStack==null)return Vf(r)?r():r;var o=Vf(s)?p.createElement(s,{error:i.error,componentStack:i.componentStack,exceptionEvent:i.exceptionEvent,resetError:this._resetError}):s;return p.isValidElement(o)?o:(console.warn(m4.INVALID_FALLBACK),p.createElement(p.Fragment,null))},t})(p.Component),c4(Vc,"PostHogErrorBoundary"),(function(){Vc.contextType=ia})(),Vc);u4(Sg);function fA(e){return d4(e)}function Vse(e){return h4(e)}function Use(e,t){return Sg.isFeatureEnabled(e,t)}var g4=8192,C4=8192,Uf=64,v4=new Set(["_truncated","bytes","limitBytes","reason","head"]);function Ms(e,t){let n=0,r=0;for(let s=0;s<e.length&&!(n>t);s++){const i=e.charCodeAt(s);if(i<128){n+=1,i===34||i===92?r+=1:i<32&&(r+=i===8||i===9||i===10||i===12||i===13?1:5);continue}if(i<2048){n+=2;continue}if(i>=55296&&i<=56319){const o=e.charCodeAt(s+1);if(o>=56320&&o<=57343){n+=4,s++;continue}}if(i>=55296&&i<=57343){n+=3,r+=3;continue}n+=3}return{utf8:n,json:n+r+2}}function y4(e){const t=e.charCodeAt(8191);return e.slice(0,t>=55296&&t<=56319?8191:C4)}var b4=8,BA=5e4;function pA(e,t){let n=0,r=0;const s=[e];for(;s.length>0;){if(n>t)return{bytes:n,exceeded:!0};if(++r>BA)return{bytes:n,exceeded:!0};const i=s.pop();if(typeof i=="string"){n+=Ms(i,t-n).json;continue}if(i===null||typeof i!="object"){n+=5;continue}if(Array.isArray(i)){n+=2+i.length;for(const o of i){if(n>t)return{bytes:n,exceeded:!0};s.push(o)}continue}n+=2;for(const o in i)if(Object.hasOwn(i,o)){if(n+=Ms(o,t-n).json+2,n>t)return{bytes:n,exceeded:!0};s.push(i[o])}}return{bytes:n,exceeded:n>t}}function S4(e,t){const n={_truncated:!0,limitBytes:t};if(typeof e!="object"||e===null||Array.isArray(e))return n;let r=0,s=0;const i=new Set,o=d=>d===void 0?{_truncated:!0}:{_truncated:!0,bytes:d},a=(d,h)=>{if(++s>BA)return o();if(typeof d=="string"){const B=Ms(d,t-r);if(d.length<=g4&&r+B.json<=t)return r+=B.json,d;const g=Ms(d,Number.POSITIVE_INFINITY).utf8,C=y4(d);if(C.length<d.length){const v=Ms(C,Number.POSITIVE_INFINITY).json;if(r+v+Uf<=t)return r+=v+Uf,{_truncated:!0,bytes:g,head:C}}return r+=Uf,o(g)}if(d===null||typeof d!="object")return r+=5,d;if(h>=b4||i.has(d))return o();if(i.add(d),Array.isArray(d)){r+=2;const B=[];for(const g of d){if(r+=1,r>t)return i.delete(d),o();B.push(a(g,h+1))}return i.delete(d),B}r+=2;const f={};for(const B in d)if(Object.hasOwn(d,B)){if(r+=Ms(B,t-r).json+2,r>t)return i.delete(d),o();f[B]=a(d[B],h+1)}return i.delete(d),f},l=a(e,0),c={};if(!E4(l)&&typeof l=="object"&&l!==null)for(const[d,h]of Object.entries(l))v4.has(d)||(c[d]=h);const u={...c,...n};return pA(u,t).exceeded?n:u}function E4(e){return typeof e=="object"&&e!==null&&e._truncated===!0}function zf(e){return e<1024?`${e} B`:e<1048576?`${Math.round(e/1024)} KB`:`${(e/1048576).toFixed(1)} MB`}function zse(e){if(e.reason)return`Payload not recorded: ${e.reason}.`;const t=typeof e.limitBytes=="number"?`over the ${zf(e.limitBytes)} log limit`:"over the log size limit",n=typeof e.bytes=="number"?` It was ${zf(e.bytes)}.`:"";return typeof e.head=="string"?`Payload truncated — ${t}.${n} Showing the first ${zf(Ms(e.head,Number.POSITIVE_INFINITY).utf8)}.`:`Payload not recorded — ${t}.${n}`}function mA(e){try{return new URL(e).pathname}catch{return e}}function x4(e){return typeof e=="string"&&e.startsWith("Automatic resolved to ")}var Fp=1e3,$f=1048576,gA=8388608,CA=new WeakMap;function w4(e){const t=e.length>Fp?e.slice(0,Fp):e;let n=0;for(let r=0;r<t.length;r++)if(n+=CA.get(t[r])??0,n>gA&&r>0)return t.slice(0,r);return t}var Ho=DN(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,Fp)}))},addMcpServerLog:t=>{const n={...t,id:t.id??`${t.timestamp}-${Math.random().toString(36).slice(2)}`};CA.set(n,pA(n.payload,gA).bytes),e(r=>({mcpServerItems:w4(r.mcpServerItems.some(s=>s.id===n.id)?r.mcpServerItems.map(s=>s.id===n.id?n:s):[n,...r.mcpServerItems])}))},clear:()=>e({items:[],mcpServerItems:[]})}));function vA(e){return typeof e.eventId=="string"&&e.eventId.length>0?e.eventId:void 0}function $se(e){if(!Array.isArray(e)||e.length===0)return;const t=Ho.getState();e.forEach(n=>{const r=vA(n);t.addMcpServerLog({...r?{id:r}:{},serverId:n.serverId,serverName:n.serverName,direction:n.direction.toUpperCase(),method:vx(n.message),timestamp:n.timestamp,payload:n.message})})}function Wse(e){if(!Array.isArray(e)||e.length===0)return;const t=Ho.getState();e.forEach(n=>{const r=vA(n);t.addMcpServerLog({...r?{id:r}:{},serverId:n.serverId,serverName:n.serverName,direction:"HTTP",method:`${n.exchange.request.method} ${mA(n.exchange.request.url)}`,timestamp:n.timestamp,payload:n.exchange,kind:"http"})})}function qse(e){const{serverId:t,serverName:n,trace:r}=e;if(!r||!Array.isArray(r.steps)||r.steps.length===0)return;const s=Ho.getState();r.steps.forEach(i=>{const o=new Date(i.completedAt??i.startedAt).toISOString();x4(i.message)&&s.addMcpServerLog({id:`oauth:${t}:${r.source}:automatic_resolution:${i.startedAt}`,serverId:t,serverName:n,direction:"OAUTH",method:"Automatic Resolution",timestamp:o,payload:{source:r.source,step:"automatic_resolution",title:"Automatic Resolution",status:i.status,message:i.message,details:i.details,relatedStep:i.step},kind:"oauth",oauthStatus:i.status,oauthSource:r.source,oauthRecovered:i.recovered===!0}),s.addMcpServerLog({id:`oauth:${t}:${r.source}:${i.step}:${i.startedAt}`,serverId:t,serverName:n,direction:"OAUTH",method:i.title,timestamp:o,payload:{source:r.source,step:i.step,title:i.title,status:i.status,message:i.message,error:i.error,details:i.details,recovered:i.recovered,recoveredAt:i.recoveredAt,recoveryMessage:i.recoveryMessage,httpHistory:r.httpHistory.filter(a=>a.step===i.step)},kind:"oauth",oauthStatus:i.status,oauthSource:r.source,oauthRecovered:i.recovered===!0})})}var Gr=null,fa=0;function Kse(){if(fa++,!Gr){const e=new URLSearchParams;e.set("replay","3"),e.set("_t",Date.now().toString()),Gr=new EventSource(u$(`/api/mcp/servers/rpc/stream?${e.toString()}`)),Gr.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;Ho.getState().addMcpServerLog({...r?{id:r}:{},serverId:typeof n.serverId=="string"?n.serverId:"unknown",direction:"HTTP",method:`${l.request.method} ${mA(l.request.url)}`,timestamp:n.timestamp??new Date().toISOString(),payload:l,kind:"http"});return}if(n.type!=="rpc")return;const{serverId:s,direction:i,message:o,timestamp:a}=n;Ho.getState().addMcpServerLog({...r?{id:r}:{},serverId:typeof s=="string"?s:"unknown",direction:typeof i=="string"?i.toUpperCase():"",method:vx(o),timestamp:a??new Date().toISOString(),payload:Ms(t.data,$f).utf8>$f?S4(o,$f):o})}catch{}},Gr.onerror=()=>{Gr?.close(),Gr=null,fa=0}}return()=>{fa--,fa<=0&&Gr&&(Gr.close(),Gr=null,fa=0)}}var D4=MN("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 Al({className:e,variant:t,asChild:n=!1,...r}){const s=n?ON:"span";return(0,m.jsx)(s,{"data-slot":"badge",className:he(D4({variant:t}),e),...r})}var Jse=["role","severity"];function Qse(e){const{role:t,severity:n,evaluator:r,...s}=e;return s}function Yse(e){return e?.role==="advisory"?"advisory":"gating"}function yA(e){return e==="gating"||e==="required"}function T4(e){if(!e||typeof e!="object"||e.role!=="required")return e;const{role:t,...n}=e;return n}function Xse(e){return Array.isArray(e)?e.map(T4):void 0}function Zse(e){return e?.severity==="warn"?"warn":void 0}var _u={toolCallOrder:"ignore",maxExtraToolCalls:null,argumentMatching:"partial"};function eie(e,t,n){const r={..._u};for(const s of[e,t,n])s&&(s.toolCallOrder!==void 0&&(r.toolCallOrder=s.toolCallOrder),s.argumentMatching!==void 0&&(r.argumentMatching=s.argumentMatching),s.maxExtraToolCalls!==void 0?r.maxExtraToolCalls=s.maxExtraToolCalls:s.allowExtraToolCalls!==void 0&&(r.maxExtraToolCalls=s.allowExtraToolCalls?null:0));return A4(r),r}function A4(e){if(e.toolCallOrder!==void 0&&!["ignore","strict","superset"].includes(e.toolCallOrder))throw new Error(`Invalid toolCallOrder: ${String(e.toolCallOrder)}`);if(e.argumentMatching!==void 0&&!["partial","exact","ignore"].includes(e.argumentMatching))throw new Error(`Invalid argumentMatching: ${String(e.argumentMatching)}`);SA(e.maxExtraToolCalls)}function I4(e,t){if(typeof e!="string")return null;switch(e.trim().toLowerCase()){case"any":return t!==void 0;case"string":return typeof t=="string";case"number":return typeof t=="number";case"boolean":return typeof t=="boolean";case"object":return t!==null&&typeof t=="object"&&!Array.isArray(t);case"array":return Array.isArray(t);case"null":return t===null;default:return null}}function Il(e){return e===null||typeof e!="object"?JSON.stringify(e):Array.isArray(e)?`[${e.map(Il).join(",")}]`:`{${Object.keys(e).sort().map(t=>`${JSON.stringify(t)}:${Il(e[t])}`).join(",")}}`}function bA(e,t){return Il(e)===Il(t)}function k4(e){const t=e.map(r=>`${JSON.stringify(r?.toolName)}:${Il(r?.arguments??{})}`),n=[];return e.forEach((r,s)=>{if(r?.failed!==!0)return;const i=t.indexOf(t[s],s+1);i!==-1&&n.push({toolName:r.toolName,arguments:r.arguments??{},actualIndex:s,retriedByIndex:i})}),n}function tie(e,t){const n=new Set;for(const r of t)typeof r?.toolCallId=="string"&&r.toolCallId.length>0&&n.add(r.toolCallId);return n.size===0?[...e]:e.map(r=>typeof r.toolCallId=="string"&&n.has(r.toolCallId)?{...r,failed:!0}:r)}function R4(e,t){for(const[n,r]of Object.entries(e)){const s=I4(r,t[n]);if(s!==null){if(!s)return!1;continue}if(!bA(t[n],r))return!1}return!0}function O4(e,t){return bA(e,t)}function M4(e,t,n){return n==="ignore"?!0:n==="partial"?Object.keys(e).length===0?!0:R4(e,t):O4(e,t)}function Wf(e,t,n){return e.toolName!==t.toolName?!1:M4(e.arguments||{},t.arguments||{},n)}function Fu(e,t){return typeof e=="function"?e(t):e}function N4(e,t,n,r){const s=new Map;if(n==="strict"){const o=Math.min(e.length,t.length);for(let a=0;a<o;a++){const l=Fu(r,a);Wf(e[a],t[a],l)&&s.set(a,a)}return{expectedToActual:s}}if(n==="superset"){let o=0;const a=new Array(e.length);for(let l=0;l<e.length;l++){a[l]=o;const c=Fu(r,l);for(;o<t.length;){if(Wf(e[l],t[o],c)){s.set(l,o),o++;break}o++}if(o>=t.length){for(let u=l+1;u<e.length;u++)a[u]=o;break}}return{expectedToActual:s,supersetCursorByExpected:a}}const i=new Set;for(let o=0;o<e.length;o++){const a=Fu(r,o);for(let l=0;l<t.length;l++)if(!i.has(l)&&Wf(e[o],t[l],a)){s.set(o,l),i.add(l);break}}return{expectedToActual:s}}function P4(e,t,n,r){const{expectedToActual:s,supersetCursorByExpected:i}=N4(e,t,n,r),o=new Set(s.keys()),a=new Set(s.values()),l=[];for(let c=0;c<e.length;c++){if(o.has(c))continue;const u=e[c];let d=0,h=t.length;n==="strict"?(d=c,h=Math.min(c+1,t.length)):n==="superset"&&i&&(d=Math.min(i[c]??0,t.length));for(let f=d;f<h;f++)if(!a.has(f)&&t[f].toolName===u.toolName){o.add(c),a.add(f),s.set(c,f),Fu(r,c)!=="ignore"&&l.push(c);break}}return{expectedToActual:s,argumentMismatchExpected:l}}function SA(e){if(e!=null&&(!Number.isInteger(e)||e<0))throw new Error(`Invalid maxExtraToolCalls: ${e}. Must be null (unlimited) or a non-negative integer.`)}function EA(e,t,n){const r=Array.isArray(e)?e:[],s=Array.isArray(t)?t:[];let i;n?.maxExtraToolCalls!==void 0?i=n.maxExtraToolCalls:n?.allowExtraToolCalls!==void 0?i=n.allowExtraToolCalls?null:0:i=_u.maxExtraToolCalls,SA(i);const o=n?.toolCallOrder??_u.toolCallOrder,a=n?.argumentMatching??_u.argumentMatching;if(n?.isNegativeTest)return{missing:[],extra:s,outOfOrder:[],argumentMismatches:[],retries:[],passed:s.length===0};if(s.length===0)return{missing:r,extra:[],outOfOrder:[],argumentMismatches:[],retries:[],passed:!1};const l=k4(s),c=new Set(l.map(E=>E.actualIndex)),u=c.size===0?s:s.filter((E,D)=>!c.has(D)),{expectedToActual:d,argumentMismatchExpected:h}=P4(r,u,o,a),f=new Set(d.keys()),B=new Set(d.values()),g=h.map(E=>({toolName:r[E].toolName,expectedArgs:r[E].arguments||{},actualArgs:u[d.get(E)].arguments||{}})),C=[],v=r.filter((E,D)=>!f.has(D)),y=u.filter((E,D)=>!B.has(D)),S=i!==null&&y.length>i;return{missing:v,extra:y,outOfOrder:C,argumentMismatches:g,retries:l,passed:v.length===0&&g.length===0&&C.length===0&&!S}}var $=class fi{static FOLD_CASE=1;static LITERAL=2;static CLASS_NL=4;static DOT_NL=8;static ONE_LINE=16;static NON_GREEDY=32;static PERL_X=64;static UNICODE_GROUPS=128;static WAS_DOLLAR=256;static LOOKBEHIND=512;static MATCH_NL=fi.CLASS_NL|fi.DOT_NL;static PERL=fi.CLASS_NL|fi.ONE_LINE|fi.PERL_X|fi.UNICODE_GROUPS;static POSIX=0;static UNANCHORED=0;static ANCHOR_START=1;static ANCHOR_BOTH=2},Yn={CASE_INSENSITIVE:1,DOTALL:2,MULTILINE:4,DISABLE_UNICODE_GROUPS:8,LONGEST_MATCH:16,LOOKBEHINDS:512},kl=128,Hp=new Int32Array(kl),jp=new Int32Array(kl),Uc=65535;for(let e=0;e<kl;e++)e>=97&&e<=122?Hp[e]=e-32:Hp[e]=e,e>=65&&e<=90?jp[e]=e+32:jp[e]=e;var U=class{static CODES=new Map([["\x07",7],["\b",8],[" ",9],[`
|
|
44
|
+
`,10],["\v",11],["\f",12],["\r",13],[" ",32],['"',34],["$",36],["&",38],["'",39],["(",40],[")",41],["*",42],["+",43],["-",45],[".",46],["0",48],["1",49],["2",50],["3",51],["4",52],["5",53],["6",54],["7",55],["8",56],["9",57],[":",58],["<",60],[">",62],["?",63],["A",65],["B",66],["C",67],["F",70],["P",80],["Q",81],["U",85],["Z",90],["[",91],["\\",92],["]",93],["^",94],["_",95],["`",96],["a",97],["b",98],["f",102],["i",105],["m",109],["n",110],["r",114],["s",115],["t",116],["v",118],["x",120],["z",122],["{",123],["|",124],["}",125]]);static toUpperCase(e){if(e<kl)return Hp[e];const t=String.fromCodePoint(e).toUpperCase(),n=t.codePointAt(0)>Uc?2:1;if(t.length>n)return e;const r=String.fromCodePoint(t.codePointAt(0)).toLowerCase(),s=r.codePointAt(0)>Uc?2:1;return r.length>s||r.codePointAt(0)!==e?e:t.codePointAt(0)}static toLowerCase(e){if(e<kl)return jp[e];const t=String.fromCodePoint(e).toLowerCase(),n=t.codePointAt(0)>Uc?2:1;if(t.length>n)return e;const r=String.fromCodePoint(t.codePointAt(0)).toUpperCase(),s=r.codePointAt(0)>Uc?2:1;return r.length>s||r.codePointAt(0)!==e?e:t.codePointAt(0)}},T=class{constructor(e,t=!1){this.data=e,this.isStride1=t,this.SIZE=t?2:3}getLo(e){return this.data[e*this.SIZE]}getHi(e){return this.data[e*this.SIZE+1]}getStride(e){return this.isStride1?1:this.data[e*this.SIZE+2]}get length(){return this.data.length/this.SIZE}},xA=new Uint8Array(256);for(let e=0,t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-";e<64;e++)xA[t.charCodeAt(e)]=e;var wA=e=>{const t=[];let n=0,r=0;for(let s=0;s<e.length;s++){let i=xA[e.charCodeAt(s)];n|=(i&31)<<r,(i&32)===0?(t.push(n),n=0,r=0):r+=5}return t},I=(e,t)=>{const n=wA(e),r=t?n.length/2:n.length/3,s=new Uint32Array(r*3);let i=0,o=0;for(let a=0;a<r;a++)i+=n[o++],s[a*3]=i,i+=n[o++],s[a*3+1]=i,s[a*3+2]=t?1:n[o++];return s},L4=e=>{const t=wA(e),n=new Map;let r=0;for(let s=0;s<t.length;s+=2){r+=t[s];const i=t[s+1],o=i>>>1^-(i&1);n.set(r,r+o)}return n},zc=class{constructor(e){this.initializer=e,this.cache=new Map}has(e){return e in this.initializer}get(e){if(this.cache.has(e))return this.cache.get(e);const t=this.initializer[e],n=t?t():null;return this.cache.set(e,n),n}},an=class{static _CASE_ORBIT=null;static get CASE_ORBIT(){return this._CASE_ORBIT||(this._CASE_ORBIT=L4("rCgCIgCY+rQI4QiCuuBLgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCCgCBgCBgCBgCBgCBgCBgCB+7OB-BB-BB-BB-BB-BBskQB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BC-BB-BB-BB-BB-BB-BB-BByHBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBDCBBBCBBBCBBCCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBCCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBxHBCBBBCBBBCBBB3SBmMBkNBCBBBCBBB8MBCBBB6MB6MBCBBC+EB0MB2MBCBBB6MB+MBiGBmNBiNBCBBBmKBikzCBmNBqNBkIBsNBCBBBCBBBCBBB0NBCBBB0NDCBBB0NBCBBByNByNBCBBBCBBB2NBCBBDCBBCwDFCBCBDBCBCBDBCBCBDBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBB9EBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBCCBCBDBCBBBhGBvDBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBjICCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBH2iVBCBBBlKBwiVB+jVB+jVBCBBBlMBqEBuEBCBBBCBBBCBBBCBBBCBBB+hVB4hVB8hVBjNB7MC5MB5MCzMC1MB+0yCE5MB20yCC9MBu2yCBwyyCBo0yCChNBlNBo0yCBu-UBi0yCDlNC6-UBpNDrNIu+UDzNCm0yCBzNE0yyCBzNBpEBxNBxNBtEG1NLqxyCBkxyCnFoFrBCBBBCBBDCBBEkIBkIBkICoHHsCCqCBqCBqCCgEC+DB+DBmkOBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCC+BBgCBgCBgCBgCBgCBgCBgCBgCBrCBpCBpCBpCBmjOB-BB8BB-BB-BBgEB-BB-BByBBqgOBsDB-BBtwBB-BB-BB-BBsBBgDBCB-BB-BB-BBeB-BB-BB61OB-BB-BB-DB9DB9DBQB7DBmCE9CBrDBPBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBrFB-EBOBnHB3FB-FCCBBBNBCBBCjIBjIBjIBgFBgFBgFBgFBgFBgFBgFBgFBgFBgFBgFBgFBgFBgFBgFBgFBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCB-BB-BB8kMB-BB6kMB-BB-BB-BB-BB-BB-BB-BB-BB-BBokMB-BB-BBkkMBkkMB-BB-BB-BB-BB-BB-BB-BB4jMB-BB-BB-BB-BB-BB-EB-EB-EB-EB-EB-EB-EB-EB-EB-EB-EB-EB-EB-EB-EB-EBCBBBCBoiMBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBJCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBeBCBBBCBBBCBBBCBBBCBBBCBBBCBBBdBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBCgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDL-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-C64CgmOBgmOBgmOBgmOBgmOBgmOBgmOBgmOBgmOBgmOBgmOBgmOBgmOBgmOBgmOBgmOBgmOBgmOBgmOBgmOBgmOBgmOBgmOBgmOBgmOBgmOBgmOBgmOBgmOBgmOBgmOBgmOBgmOBgmOBgmOBgmOBgmOBgmOCgmOGgmODg8FBg8FBg8FBg8FBg8FBg8FBg8FBg8FBg8FBg8FBg8FBg8FBg8FBg8FBg8FBg8FBg8FBg8FBg8FBg8FBg8FBg8FBg8FBg8FBg8FBg8FBg8FBg8FBg8FBg8FBg8FBg8FBg8FBg8FBg8FBg8FBg8FBg8FBg8FBg8FBg8FBg8FBg8FDg8FBg8FBg8FhVg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBg9rCBQBQBQBQBQBQDPBPBPBPBPBPjkC7mMB5mMBnmMBjmMBCBlmMB3lMBpiMBk8kCBCBBG-7FB-7FB-7FB-7FB-7FB-7FB-7FB-7FB-7FB-7FB-7FB-7FB-7FB-7FB-7FB-7FB-7FB-7FB-7FB-7FB-7FB-7FB-7FB-7FB-7FB-7FB-7FB-7FB-7FB-7FB-7FB-7FB-7FB-7FB-7FB-7FB-7FB-7FB-7FB-7FB-7FB-7FB-7FD-7FB-7FB-7F6FoglCEsuHRwjlCyDCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCB0DBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBG1DD97OCCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBQBQBQBQBQBQBQBQBPBPBPBPBPBPBPBPBQBQBQBQBQBQDPBPBPBPBPBPDQBQBQBQBQBQBQBQBPBPBPBPBPBPBPBPBQBQBQBQBQBQBQBQBPBPBPBPBPBPBPBPBQBQBQBQBQBQDPBPBPBPBPBPEQCQCQCQCPCPCPCPBQBQBQBQBQBQBQBQBPBPBPBPBPBPBPBPB0EB0EBsFBsFBsFBsFBoGBoGBgIBgIBgHBgHB8HB8HDQBQBQBQBQBQBQBQBPBPBPBPBPBPBPBPBQBQBQBQBQBQBQBQBPBPBPBPBPBPBPBPBQBQBQBQBQBQBQBQBPBPBPBPBPBPBPBPBQBQCSFPBPBzEBzEBRCxnOFSFrFBrFBrFBrFBREQBQClkOFPBPBnGBnGFQBQCljOCODPBPB-GB-GBNHSF-HB-HB7HB7HBRqJ53OE9tQBrmQH4Bc3BSgBBgBBgBBgBBgBBgBBgBBgBBgBBgBBgBBgBBgBBgBBgBBgBBfBfBfBfBfBfBfBfBfBfBfBfBfBfBfBfECBByZ0BB0BB0BB0BB0BB0BB0BB0BB0BB0BB0BB0BB0BB0BB0BB0BB0BB0BB0BB0BB0BB0BB0BB0BB0BB0BBzBBzBBzBBzBBzBBzBBzBBzBBzBBzBBzBBzBBzBBzBBzBBzBBzBBzBBzBBzBBzBBzBBzBBzBBzBBzB34BgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDBgDB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CB-CBCBBBt-UBruHBt+UB1iVBviVBCBBBCBBBCBBB3hVB5-UB9hVB7hVCCBBCCBBI9jVB9jVBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBICBBBCBBECBBN-lOB-lOB-lOB-lOB-lOB-lOB-lOB-lOB-lOB-lOB-lOB-lOB-lOB-lOB-lOB-lOB-lOB-lOB-lOB-lOB-lOB-lOB-lOB-lOB-lOB-lOB-lOB-lOB-lOB-lOB-lOB-lOB-lOB-lOB-lOB-lOB-lOB-lOC-lOG-lOzoeCBBBCBBBCBBBCBBBCBBBCBl8kCBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBTCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBnECBBBCBBBCBBBCBBBCBBBCBBBCBBDCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBKCBBBCBBBnglCBCBBBCBBBCBBBCBBBCBBECBBBvyyCDCBBBCBBBgDCCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBn0yCB90yCB10yCBh0yCBn0yCCjxyCBzyyCBpxyCBg6BBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBB-CBl0yCBvjlCBCBBBCBBBt2yCBCBBBCBBBCBBBCBBBCBBBCBBBCBBBCBBBhkzCZCBB9a-5Bd-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCB-8rCm6TCBB7gBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCH-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BmlBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvChDwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCBwCFvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvCBvC1DuCBuCBuCBuCBuCBuCBuCBuCBuCBuCBuCCuCBuCBuCBuCBuCBuCBuCBuCBuCBuCBuCBuCBuCBuCBuCCuCBuCBuCBuCBuCBuCBuCCuCBuCCtCBtCBtCBtCBtCBtCBtCBtCBtCBtCBtCCtCBtCBtCBtCBtCBtCBtCBtCBtCBtCBtCBtCBtCBtCBtCCtCBtCBtCBtCBtCBtCBtCCtCBtCk2BgEBgEBgEBgEBgEBgEBgEBgEBgEBgEBgEBgEBgEBgEBgEBgEBgEBgEBgEBgEBgEBgEBgEBgEBgEBgEBgEBgEBgEBgEBgEBgEBgEBgEBgEBgEBgEBgEBgEBgEBgEBgEBgEBgEBgEBgEBgEBgEBgEBgEBgEO-DB-DB-DB-DB-DB-DB-DB-DB-DB-DB-DB-DB-DB-DB-DB-DB-DB-DB-DB-DB-DB-DB-DB-DB-DB-DB-DB-DB-DB-DB-DB-DB-DB-DB-DB-DB-DB-DB-DB-DB-DB-DB-DB-DB-DB-DB-DB-DB-DB-DB-D+CgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCL-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-B74CgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BhrVgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCBgCB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BB-BhB2BB2BB2BB2BB2BB2BB2BB2BB2BB2BB2BB2BB2BB2BB2BB2BB2BB2BB2BB2BB2BB2BB2BB2BB2BD1BB1BB1BB1BB1BB1BB1BB1BB1BB1BB1BB1BB1BB1BB1BB1BB1BB1BB1BB1BB1BB1BB1BB1BB1BtxekCBkCBkCBkCBkCBkCBkCBkCBkCBkCBkCBkCBkCBkCBkCBkCBkCBkCBkCBkCBkCBkCBkCBkCBkCBkCBkCBkCBkCBkCBkCBkCBkCBkCBjCBjCBjCBjCBjCBjCBjCBjCBjCBjCBjCBjCBjCBjCBjCBjCBjCBjCBjCBjCBjCBjCBjCBjCBjCBjCBjCBjCBjCBjCBjCBjCBjCBjC")),this._CASE_ORBIT}static _Print=null;static get Print(){return this._Print||(this._Print=new T(I("hB9CBjBLBCpWBDFBFGBCCCBSBCsMBClBBDxBBDCBC2BBJaBFFBSVBC-FBCvBBD6BBDkDBP6BBDwBBDOBCbBDCCBJBGfBIqCBCgFBCHBDBBDVBCGBCEEBCBDIBDBBDDBJFFBCCBDBDYBDCBCFBFBBDVBCGBCBBCBBCBBDCCBDBFBBDCBEIIBCBCIIBPBLCBCIBCCBCVBCGBCBBCEBDJBCCBCCBDQQBCBDLBIGBCCBCHBDBBDVBCGBCBBCEBDIBDBBDCBICBFBBCEBDRBLBBCFBECBCDBEBBCCCBEEBEEBBBELBFEBECBCDBDHHPUBGMBCCBCWBCPBDIBCCBCDBIBBCCBCBBDDBDJBIVBCCBCWBCJBCEBDIBCCBCDBIBBGCBCDBDJBCCBNMBCCBCyBBCCBCFBFPBDZBCCBCRBEXBCIBCDDBFBEFFBEBCCCBGBHJBDCBN5BBFcBmBBBCCCBDBCXBCCCBVBDEBCCCBFBCJBDDBhBnCBCjBBFmBBCjBBCOBCMBmBlGBCGGD4LBCDBDGBCCCBCBDoBBCDBDgBBCDBDGBCCCBCBDOBC4BBCDBDiCBDfBEZBH1CBDFBD-TBCbBE4CBIVBKXBKTBNMBCCBCBBN9CBDJBHJBHNBCKBH4CBIqBBGlCBLeBCLBFLBFEEBoBBDEBMrBBFZBHKBE9BBDgCBCcBDKBHJBHNBDtBBDLBVsCBClFBJ7BBEOBE9BBGqBBDKBJqBBG1QBDFBDlBBDFBDHBCGCBdBD0BBCOBCNBDFBCSBDCBCIBSXBJuBBSBBDaBCMBEhBBPgBBQrEBF5UBXKBWz4BBD9LBGsBBCGGD3BBIBBPXBKGBCGBCGBCGBCGBCGBCGBCGBC9DBjBZBC4CBN1GBbPBC+BBC1CBDmDBGqBBC9CBC1CBKvBBCszcBE2BBK7KBV3FBJ8GBV7BBEJBH3BBJlCBJLBHzDBMdBEtCBCKBFgBBC2BBKNBDJBDmDBZbBLFBDFBDFBKGBCGBC7BBF9DBDJBHj9KBNWBFwBBloItLBDpDBnBGBNEBGZBCEBCCCBCCBCCBoUBhBpBBHyBBCSBCDBFEBCmEBF9FBEFBDFBDFBDCBEGBCGBOBBDLBCZBCSBCBBCOBDNBjB6DBGCBFsBBE3CBCMBEwBwBBsBBjEcBEwBBQbBFjBBKdBGqBBGdBCkBBFNBrB9EBDJBHjBBFjBBFnBBJzBBMLBCOBCGBCBBCKBCOBCGBCBBEzBBN2JBKVBLHBZFBCpBBCIBmCFBDCCBqBBCBBEDDBVBCnCBJIBxBSBCBBGgBBEaBGaBnB3BBFTBDxBBCBBGHBCCBCcBDCBFJBIIBI-BBhBmBBFLBK1BBEcBDaBGZBIDBNGBxCoCB4ByBBOyBBItBBJJBHlBBEcBJBBxGeBCpBBCCBDBBRFBJIBiBtBBJpBBXZBnBbBVWBKtCBFjBBK9BBCEBOYBIJBH0BBCRBJmBBK-CBCTBMRBCuBB-BGBCCCBCBCOBCKBH6BBGJBHDBCHBDBBDVBCGBCBBCEBCJBDBBDCBDHHGGBDGBEEBMJBCDDClBBCJBCDDCDBCJBCBBJBBe7CBCEBfnCBJJBnF1BBDlBBjBkCBMJBHMBU5BBHJBHTBdaBDOBFWB6F7BBlDyCBNHBDDDBGBCBBCdBCBBDLBKJBnCHBDtBBDKBcnCBJyCBOoCBIJB3CHB5ChBBPJBHIBCsBBCNBLcBEfBDVBCNBqCGBCBBCrBBECCBCCBHBJJBHFBCBBCkBBCBBCFBIJBHrBBFJB3HYBIQBCoBBEcB2CQQBwBBO6cBnDuDBCEBMjGBtyCiDBOvhBBRVBL68DBGmSB61G5BBn2B4RBIeBCJBFwCBCJBHdBDFBLlCBLJBCGBCUBGSBxN5BBnG6CBGYBDYBtBqCBF4BBIQBhCEBMGBK1mHBqBfBiDyDB+vIDBCGBCBBCiJBQeeBBBDPPBCBJrMBloCqDBGMBEIBIJBDDBh7D8HBEzNBHWBQQBQtBBDWBKzDB9B1HBLmBBDpCBJvDBWlCB7DTBNTBN2CBKYBoE0CBCmCBCBBDDDBDDBCBCLBCCCBFBCgCBCDBDHBCGBCbBCDBCEBCEEBFBCzKBDjJBD9VBQEBCOBxiBeBHFB2GGBCQBDGBCBBCEBG9BBiBxDxDBrBBENBDJBFBBhKeBS5BBGxOxOBoBB3GqBBFhGhGBdBCVBJBBhHGBCDBCBBCOBCkGBDPBqBrCBFJBFBByYjCBtC8BBjGDBCaBCBBCDDCJBCDBCCCHFFCECBBBCBBCDDCICBCCDDBCGBCDBCDBCCCBIBCQBGCBCEBCQB1BBBvIrBBFjDBNOBDOBCOBCkBBLtFB5BcBOrBBFIBIBBPFB7E4eBEQBEMBE5GBHLBFQQBKBF3BBJJBHnBBJdBDLBFBBPIBoB3KBJNBDMBEKBE4BBCFFBOBDLBFJBIyEBCmDBmgB-2pBBhB9oEBDt0FBDwpHBQtTBjtC9QBjvBq6EBGppIBnkzVvHB",!1))),this._Print}static CATEGORIES=new zc({C:()=>new T(I("AfBgDgBBOrWrWBHHBCBICCVuMuMnBBBzBBBE4B4BBGBcDBHQBXhGhGxBBB8BBBmDNB8BBByBBBQddBCCMEBhBGBsCiFiFJBBDBBXIICCBFBBKBBDBBFHBCDBDGGBaaBEEHDBDBBXIIDGDBCCGDBDBBECBCGBFCCBFBSJBEKKEXXIDDGBBLIEBCCBNBFBBNGBIEEJBBDBBXIIDGGBKKBDDBEEBFBEDBDGGBTTBIBDHHBBBEFFBBBDCCDCBDCBECBNDBGCBEFFBCCBEBCNBWEBOEEYRRBKKEFFBFBDEEDBBFBBLGBXEEYLLGBBKEEFGBDEBEFFBLLELBOEE0BEEHDBRBBbEETCBZKKCBBICBCDBHCCJFBLBBELB7BDBekBBDCCGZZCYYBGGCIILBBFfBpClBlBBCBoBlBlBQOOBjBBnGCCBDBCBB6LFFBIICFFBqBqBFBBiBFFBIICFFBQQ6BFFBkCkCBhBhBBBBbFB3CBBHBB+UCB6CGBXIBZIBVLBOEEDLB-CBBLFBLFBPMMBEB6CGBsBEBnCJBgBNNBCBNDBCCBrBBBGKBtBDBbFBMCB-BBBiCeeBMMBEBLFBPBBvBBBNTBuCnFnFBGB9BCBQCB-BEBsBBBMHBsBEB3QBBHBBnBBBHBBJGCgBBB2BQQPBBHUUBEEKMMBDBbEByBPBDBBcOOBBBjBNBiBOBtEDB7UVBMUB14BBB-LEBuBCCBDBCBB5BGBDNBZIBI4BI-DhBBb6C6CBKB3GZBxC3C3CBoDoDBDBsB-C-C3CIBxBuzcuzcBBB4BIB9KTB5FHB+GTB9BCBLFB5BHBnCHBNFB1DKBfCBvCMMBCBiB4B4BBHBPBBLBBoDXBdJBHBBHBBHIBIII9BDB-DBBLFBl9KLBYDByBjoIBvLBBrDlBBILBGEBbGGCGDrUfBrBFB0BUUFDBGoEoEBCB-FCBHBBHBBHBBECBIIIBLBDBBNbbUDDQBBPhBB8DEBEDBuBCB5COOBBBCuBBvBhEBeCByBOBdDBlBIBfEBsBEBfmBmBBCBPpBB-EBBLFBlBDBlBDBpBHB1BKBNQQIDDMQQIDDBBB1BLB4JIBXJBJXBHrBrBKkCBHBBCtBtBDCBCBBYpCpCBGBKvBBUDDBDBiBCBcEBclBB5BDBVBBzBDDBDBJEEeBBEDBLGBKGBhCfBoBDBNIB3BCBeBBcEBbGBFLBIvCBqC2BB0BMB0BGBvBHBLFBnBCBeHBDvGBgBrBrBEBBDPBHHBKgBBvBHBrBVBblBBdTBYIBvCDBlBIB-BGGBLBaGBLFB2BTTBGBoBIBhDVVBJBTwBwBB8BBICCFQQMFB8BEBLFBFJJBDDBXXIDDGLLBDDBEEBCCBEBCEBIBBICBGKBLCCBCCnBLLCBBCFFLDDBGBDcB9CGGBcBpCHBLlFB3BBBnBhBBmCKBLFBOSB7BFBLFBVbBcBBQDBY4FB9BjDB0CLBJBBCBBJDDfDDBNNBHBLlCBJBBvBBBMaBpCHB0CMBqCGBL1CBJ3CBjBNBLFBKuBuBPJBeCBhBBBXPPBnCBIDDtBCBCDDKHBLFBHDDmBDDHGBLFBtBDBL1HBaGBSqBqBBBBe0CBCOBzBMB8clDBwDGGBJBlGryCBkDMBxhBPBXJB88DEBoS41GB7Bl2BB6RGBgBLLBCByCLLBEBfBBHJBnCJBLIIWEBUvNB7BlGB8CEBaBBarBBsCDB6BGBS-BBGKBIIB3mHoBBhBgDB0D8vIBFIIDkJkJBNBCcBEBBCNBFHBtMjoCBsDEBOCBKGBLBBF-6DB+HCB1NFBYOBSOBvBBBYIB1D7BB3HJBoBBBrCHBxDUBnC5DBVLBVLB4CIBamEB2CoCoCDBBCBBDBBFNNCIIiCFFBJJIddFGGCCBI1K1KBlJlJB-V-VBNBGQQBuiBBgBFBH0GBISSBIIDGGBDB-BgBBCvDBuBCBPBBLDBD-JBgBQB7BEBCvOBrB1GBsBDBC-FBgBXXBGBD-GBIFFDQQmGBBRoBBtCDBLDBDwYBlCrCB+BhGBFccDCCBCCLFFCCCBEBCDBCECEDDCBBCICDCCBFFIKFCLLSEBEGGSzBBDtIBtBDBlDLBQBBQQQmBJBvF3BBeMBtBDBKGBDNBH5EB6eCBSCBOCB7GFBNDBCOBNDB5BHBLFBpBHBfBBNDBDNBKmBB5KHBPBBOCBMCB6BCCBCBRBBNDBLGB0EoDoDBjgBBh3pBfB-oEBBv0FBBypHOBvThtCB-QhvBBs6EEBrpIlkzVBxHvw-FB",!1)),Cc:()=>new T(I("AfgDgB",!0)),Cf:()=>new T(I("tFzqBzqBBEBXhGhGyBhMhMBxCxCs5D9-B9-BBDBbEByBEBCJBw03B6H6HBBBimEQQj7IPBhjiBDBwmFHBn0rYffB+CB",!1)),Cn:()=>new T(I("4bBBHDBICCVuMuMnBBBzBBBE4B4BBGBcDBHKBvI9B9BBmDmDBMB8BBByBBBQddBCCMEBjBEBuHJJBDDBXXICCBBBFBBKBBDBBFHBCDBDGGBaaBEEHDBDBBXIIDGDBCCGDBDBBECBCGBFCCBFBSJBEKKEXXIDDGBBLIEBCCBNBFBBNGBIEEJBBDBBXIIDGGBKKBDDBEEBFBEDBDGGBTTBIBDHHBBBEFFBBBDCCDCBDCBECBNDBGCBEFFBCCBEBCNBWEBOEEYRRBKKEFFBFBDEEDBBFBBLGBXEEYLLGBBKEEFGBDEBEFFBLLELBOEE0BEEHDBRBBbEETCBZKKCBBICBCDBHCCJFBLBBELB7BDBekBBDCCGZZCYYBGGCIILBBFfBpClBlBBCBoBlBlBQOOBjBBnGCCBDBCBB6LFFBIICFFBqBqBFBBiBFFBIICFFBQQ6BFFBkCkCBhBhBBBBbFB3CBBHBB+UCB6CGBXIBZIBVLBOEEDLB-CBBLFBLFBbFB6CGBsBEBnCJBgBNNBCBNDBCCBrBBBGKBtBDBbFBMCB-BBBiCeeBMMBEBLFBPBBvBBBNTBuCnFnFBGB9BCBQCB-BEBsBBBMHBsBEB3QBBHBBnBBBHBBJGCgBBB2BQQPBBHUUBEEKmDmDNBBcOOBBBjBNBiBOBtEDB7UVBMUB14BBB-LEBuBCCBDBCBB5BGBDNBZIBI4BI-DhBBb6C6CBKB3GZBxC3C3CBoDoDBDBsB-C-C3CIBxBuzcuzcBBB4BIB9KTB5FHB+GTB9BCBLFB5BHBnCHBNFB1DKBfCBvCMMBCBiB4B4BBHBPBBLBBoDXBdJBHBBHBBHIBIII9BDB-DBBLFBl9KLBYDByBDBvzIBBrDlBBILBGEBbGGCGDrUfBrBFB0BUUFDBGoEoEBCC-FCBHBBHBBHBBECBIIIBIBGBBNbbUDDQBBPhBB8DEBEDBuBCB5COOBBBCuBBvBhEBeCByBOBdDBlBIBfEBsBEBfmBmBBCBPpBB-EBBLFBlBDBlBDBpBHB1BKBNQQIDDMQQIDDBBB1BLB4JIBXJBJXBHrBrBKkCBHBBCtBtBDCBCBBYpCpCBGBKvBBUDDBDBiBCBcEBclBB5BDBVBBzBDDBDBJEEeBBEDBLGBKGBhCfBoBDBNIB3BCBeBBcEBbGBFLBIvCBqC2BB0BMB0BGBvBHBLFBnBCBeHBDvGBgBrBrBEBBDPBHHBKgBBvBHBrBVBblBBdTBYIBvCDBlBIBlCJBCBBaGBLFB2BTTBGBoBIBhDVVBJBTwBwBB8BBICCFQQMFB8BEBLFBFJJBDDBXXIDDGLLBDDBEEBCCBEBCEBIBBICBGKBLCCBCCnBLLCBBCFFLDDBGBDcB9CGGBcBpCHBLlFB3BBBnBhBBmCKBLFBOSB7BFBLFBVbBcBBQDBY4FB9BjDB0CLBJBBCBBJDDfDDBNNBHBLlCBJBBvBBBMaBpCHB0CMBqCGBL1CBJ3CBjBNBLFBKuBuBPJBeCBhBBBXPPBnCBIDDtBCBCDDKHBLFBHDDmBDDHGBLFBtBDBL1HBaGBSqBqBBBBe0CBCOBzBMB8clDBwDGGBJBlGryCBkDMB3iBJB88DEBoS41GB7Bl2BB6RGBgBLLBCByCLLBEBfBBHJBnCJBLIIWEBUvNB7BlGB8CEBaBBarBBsCDB6BGBS-BBGKBIIB3mHoBBhBgDB0D8vIBFIIDkJkJBNBCcBEBBCNBFHBtMjoCBsDEBOCBKGBLBBJ76DB+HCB1NFBYOBSOBvBBBYIB1D7BB3HJBoBBBjGUBnC5DBVLBVLB4CIBamEB2CoCoCDBBCBBDBBFNNCIIiCFFBJJIddFGGCCBI1K1KBlJlJB-V-VBNBGQQBuiBBgBFBH0GBISSBIIDGGBDB-BgBBCvDBuBCBPBBLDBD-JBgBQB7BEBCvOBrB1GBsBDBC-FBgBXXBGBD-GBIFFDQQmGBBRoBBtCDBLDBDwYBlCrCB+BhGBFccDCCBCCLFFCCCBEBCDBCECEDDCBBCICDCCBFFIKFCLLSEBEGGSzBBDtIBtBDBlDLBQBBQQQmBJBvF3BBeMBtBDBKGBDNBH5EB6eCBSCBOCB7GFBNDBCOBNDB5BHBLFBpBHBfBBNDBDNBKmBB5KHBPBBOCBMCB6BCCBCBRBBNDBLGB0EoDoDBjgBBh3pBfB-oEBBv0FBBypHOBvThtCB-QhvBBs6EEBrpIm8yVBCdBhD-DBxHvw-BB---BBB---BBB",!1)),Co:()=>new T(I("gg4B-nGh4hc9--BD9--B",!0)),Cs:()=>new T(I("gg2B--B",!0)),L:()=>new T(I("hCZBHZBwBLLFGGBVBCeBCpOBFLBPEBICCiEEBCBBDDBCHHCCBCCCBSBCyCBCqEBJlFBClBBDHHBnBBoCaBFDBuBqBBkBBBCiDBCQQBIIBLLBBBDRRCdBe4CBMZZBfBKBBFGGBUBFKKEYYBXBIKBGXBCGBRpBB7B1BBETTIJBQPBFHBDBBDVBCGBCEEBCBERROBBCCBPBBLJJBEBFBBDVBCGBCBBCBBCBBgBDBCUUBBBRIBCCBCVBCGBCBBCEBETTQBBYMMBGBDBBDVBCGBCBBCEBEffBCCBBBQSSCFBECBCDBEBBCCCBEEBEEBBBELBX1B1BBGBCCBCWBCPBEbbBBBCBBDBBfFFBGBCCBCWBCJBCEBEffBBBCBBQBBSIBCCBCoBBDRRGCBJCBZFBGRBEXBCIBCDDBFB7BvBBCBBNGB7BBBCCCBDBCXBCCCBIBCBBKDDBDBCWWBCBhBgCgCBGBCjBBcEB0DqBBVRRBEBFDBEEEBIIBBBFMBNSSBkBBCGGDqBBCsKBCDBDGBCCCBCBDoBBCDBDgBBCDBDGBCCCBCBDOBC4BBCDBDiCBmBPBR1CBDFBErTBDQBCZBGqCBHHBIRBOSBPRBPMBCCBQzBBkBFFkC4CBIEBDhBBCGGBkCBLeByBdBDEBMrBBFZB3BWBK0BBzC+C+CBtBBSHB3BdBOBBLrBBbjBBqBCBLjBBDKBGqBBDCBqBDBCFBCBBEGGB+FBhC1IBDFBDlBBDFBDHBCGCBdBD0BBCGBCEEBBBCGBEDBDFBFMBGCBCGB1DOORMBmDFFDJBCEEBDBHGCBCBCKBDDBGEBF1B1BB8zC8zCBjHBHDBEBBNlBBCGGD3BBIRRBVBKGBCGBCGBCGBCGBCGBCGBCGBxC2O2OBrBrBBDBGBBF1CBHCBC5CBCDBGqBBC9CBSfBxBPBhQ-tGBhCs0VBkCtBBDsIBEPBLBBVuBBReBDlCByBIBDmDBDxCBVQBCCBCDBCWBezBBPxBB-BFBECCBMMBaBLWBacBIuBBdRRBDBCJBLEBCoBBYCBCHBVWBEEEBwBBCEEBDDBDBDCCZCBDKBICBNFBDFBDFBKGBCGBCqBBCNBHyDBej9KBNWBFwBBloItLBDpDBnBGBNEBGCCBIBCMBCEBCCCBCCBCCBqDBiBqLBT-BBD1BBpBLB1DEBCmEBlBZBHZBM4CBEFBDFBDFBDCBkBLBCZBCSBCBBCOBDNBjB6DBmMcBEwBBwBfBOTBCHBHlBBLdBDjBBFHBxB9EBTjBBFjBBFnBBJzBBNKBCOBCGBCBBCKBCOBCGBCBBEzBBN2JBKVBLHBZFBCpBBCIBmCFBDCCBqBBCBBEDDBVBLWBKeBiCSBCBBLVBLZBHZBnB3BBHBBhCQQBCBCCBCcBrBcBEcBkBHBCbBc1BBLVBLSBORBvDoCB4ByBBOyBBOjBBnBbBKWB7HpBBHBBRFB5BcBLJJBUBrBRBvBUBcWBN0BB6BBBDOOBrBBhBYBbjBBeDDJiBBENNBuBBPDBWCCkBRBCYBUBBgCGBCCCBCBCOBCJBIuBBnBHBDBBDVBCGBCBBCEBETTNEBfJBCDDClBBCaaCtBtBBzBBTDBVCBfvBBVBBC5F5FBtBBqBDBlBvBBV8B8BBpBBOoCoCBZBmBGB6FrBB1D-BBgBHBDDDBGBCBBCXBQCC-CHBDmBBRCCdLLBmBBIWWMtBBUTTBnCBoGgBBgBIBCkBBSyByBBcBxDGBCBBClBBWaaBEBCBBCfBPYYBqBBlISBQCCBLBChBB9DwCwCB4cBnHjGBtyCgDBQvhBBSFBa68DBGmSB61GdBj3B4RBIeBSuCBSdBTvBBRDBgBUBGSBxNsBB0G-BBhBYBDYBtBqCBGjCjCBLBhCBBCPPBNNB0mHBqBfBiDyDB+vIDBCGBCBBCiJBQeeBBBDPPBCBJrMBloCqDBGMBEIBIJBn7F0CBCmCBCBBDDDBDDBCBCLBCCCBFBCgCBCDBDHBCGBCbBCDBCEBCEEBFBCzKBDYBCYBCeBCYBCeBCYBCeBCYBCeBCYBCHB15BeBHFBmI9BBzEsBBLGBRiKiKBcBTrBBlPbBlHdBDwGwGBdBCCBCBBCGBDEBKBBhHGBCDBCBBCOBCkGB8BjCBI1lB1lBBCBCaBCBBCDDCJBCDBCCCHFFCECBBBCBBCDDCICBCCDDBCGBCDBCDBCCCBIBCQBGCBCEBCQBlqE-2pBBhB9oEBDt0FBDwpHBQtTBjtC9QBjvBq6EBGppIB",!1)),LC:()=>new T(I("hCZBHZB7BLLBVBCeBCiGBCDBFvGBDZBhGDBDBBECBCHHCCBCCCBSBCyCBCqEBJlFBClBBKoBB44ClBBCGGDqBBDCBhV1CBDFBjkCKBGqBBDCBhCrBBgCMBChBBmD1IBDFBDlBBDFBDHBCGCBdBD0BBCGBCEEBBBCGBEDBDFBFMBGCBCGBmIFFDJBCEEBDBHGCBCBCFBFDDBCBGEBF1B1BB8zC8zCB6DBDmDBHDBEBBNlBBCGGzoetBBTbBnEtCBCWBEDBCsCBZBBE2Z2ZBpBBGIBIvCBh6TGBNEBqgBZBHZBmlBvCBhDjBBFjBB1DKBCOBCGBCBBCKBCOBCGBCBBk2ByBBOyBB+CVBLVB74C-BBhrV-BBhBYBDYBtpZ0CBCmCBCBBDDDBDDBCBCLBCCCBFBCgCBCDBDHBCGBCbBCDBCEBCEEBFBCzKBDYBCYBCeBCYBCeBCYBCeBCYBCeBCYBCHB15BJBCTBHFB2uCjCB",!1)),Ll:()=>new T(I("hDZB7BqBqBBWBCHBC2BCBQCBuBCDECBBBDCCDEEBFFDEEBBBDDDCCCDCCBCCDEECDDBDDBBBHGDCOCBSCBDDCEEC4BCBFBDDDBCCFICBjCBDZBiGCCEEEBBBTccBhBBCBBECBCWCBDBCGDB0B0BBuBBCgBCK0BCDMCBgDCxBoBBo6CqBBDCB5XFBjkCIBC2D2DBqBBgCMBChBBnD0ECBHBCgDCBHBJFBLHBJHBJFBLHBJHBJNBDHBJHBJHBJEBCBBHEEBBBCBBJDBDBBJHBLCBCBBzIEEBEEcKFDBBJDBF2B2Bs1CvBBCEEBGCFCCBCCBEBGiDCBIICFFNlBBCGG0oesBCUaCoEMCBBBC+BCBGBCCCDICFCCDCCBBBCSCGGGCMCFCCDOCbEE2ZqBBGIBIvCBh6TGBNEBqhBZBumBnBBpEjBB8EKBCOBCGBCBBk4ByBB+DVB75CfBhsVfB8BYBnqZZBbGBCRBbZBbDBCCCBFBCKBbZBbZBbZBbZBbZBbZBbZBbZBbbBdYBCFBbYBCFBbYBCFBbYBCFBbYBCFBC15B15BBIBCTBHFB4vChBB",!1)),Lm:()=>new T(I("wVRBFLBPEBICCmEGG-OnHnHlFBBuIBBFgBgBKEEhFoFoF1mBgEgE2R72B72BsDkTkTxOFBvF+BBOjBjBBjBByVOORMBg-CBByHgGgG2OsBsBBDBGiDiDB+C+CBBB34bjnBjnBBEBvIzDzDdBB6DIBxCYYpDDBEBB2OXXqEtDtDWBBoDDBKngVngVuBBBh-BFBCpBBCIB0sBhBhB2K04D04DnrTDB9PCBpBBBnRMBhCBBCPPB9-P9-PBCBCGBCBByhM9BBqGGBud0Q0QsSAB",!1)),Lo:()=>new T(I("qFQQhIFFBCBxGBB7ZaBFDBuBfBCJBkBBBCiDBCZZBLLBBBDRRCdBe4CBMZZBfBWVBrBYBIKBGXBCGBRoBB8B1BBETTIJBROBFHBDBBDVBCGBCEEBCBERROBBCCBPBBLJJBEBFBBDVBCGBCBBCBBCBBgBDBCUUBBBRIBCCBCVBCGBCBBCEBETTQBBYMMBGBDBBDVBCGBCBBCEBEffBCCBBBQSSCFBECBCDBEBBCCCBEEBEEBBBELBX1B1BBGBCCBCWBCPBEbbBBBCBBDBBfFFBGBCCBCWBCJBCEBEffBBBCBBQBBSIBCCBCoBBDRRGCBJCBZFBGRBEXBCIBCDDBFB7BvBBCBBNFB8BBBCCCBDBCXBCCCBIBCBBKDDBDBYDBhBgCgCBGBCjBBcEB0DqBBVRRBEBFDBEEEBIIBBBFMBNyDyDBnKBCDBDGBCCCBCBDoBBCDBDgBBCDBDGBCCCBCBDOBC4BBCDBDiCBmBPByDrTBDQBCZBGqCBHHBIRBOSBPRBPMBCCBQzBBpBkCkCBhBBC0BBIEBDhBBCGGBkCBLeByBdBDEBMrBBFZB3BWBK0BBxFuBBSHB3BdBOBBLrBBbjBBqBCBLdByDDBCFBCBBE7hB7hBBCB4-C3BBZWBKGBCGBCGBCGBCGBCGBCGBCGBoR2B2BF1CBJCCB4CBFGGBpBBC9CBSfBxBPBhQ-tGBhC0wUBC2jBBkCnBBJrIBFPBLBBjCyByBBkCBqFoDoDEGBCCBCDBCWBezBBPxBB-BFBECCBMMBaBLWBacBIuBBuBEBDIBLEBCoBBYCBCHBVPBCFBEEEBwBBCEEBDDBDBDCCZBBEKBIPPBEBDFBDFBKGBCGByEiBBej9KBNWBFwBBloItLBDpDBkCCCBIBCMBCEBCCCBCCBCCBqDBiBqLBT-BBD1BBpBLB1DEBCmEBqDJBCsBBDeBEFBDFBDFBDCBkBLBCZBCSBCBBCOBDNBjB6DBmMcBEwBBwBfBOTBCHBHlBBLdBDjBBFHBhEtCBjDnBBJzBB9CzBBN2JBKVBLHB5EFBDCCBqBBCBBEDDBVBLWBKeBiCSBCBBLVBLZBHZBnB3BBHBBhCQQBCBCCBCcBrBcBEcBkBHBCbBc1BBLVBLSBORBvDoCB4FjBBnBDBCxJxJBoBBHBBRCBCBB5BcBLJJBUBrBRBvBUBcWBN0BB6BBBDOOBrBBhBYBbjBBeDDJiBBENNBuBBPDBWCCkBRBCYBUBBgCGBCCCBCBCOBCJBIuBBnBHBDBBDVBCGBCBBCEBETTNEBfJBCDDClBBCaaCtBtBBzBBTDBVCBfvBBVBBC5F5FBtBBqBDBlBvBBV8B8BBpBBOoCoCBZBmBGB6FrBB0GHBDDDBGBCBBCXBQCC-CHBDmBBRCCdLLBmBBIWWMtBBUTTBnCBoGgBBgBIBCkBBSyByBBcBxDGBCBBClBBWaaBEBCBBCfBPYYBnBBCBBlISBQCCBLBChBB9DwCwCB4cBnHjGBtyCgDBQvhBBSFBa68DBGmSB61GdBj3B4RBIeBSuCBSdBTvBB0BUBGSB0NnBB2MqCBGwFwFB0mHBqBfBiDyDBuwIiJBQeeBBBDPPBCBJrMBloCqDBGMBEIBIJBxzI2P2PBrBBiBiKiKBcBTrBBlPaBmHdBDwGwGBdBCCBCBBCGBDEBKiHiHBFBCDBCBBCOBCkGB8pBDBCaBCBBCDDCJBCDBCCCHFFCECBBBCBBCDDCICBCCDDBCGBCDBCDBCCCBIBCQBGCBCEBCQBlqE-2pBBhB9oEBDt0FBDwpHBQtTBjtC9QBjvBq6EBGppIB",!1)),Lt:()=>new T(I("lOGDnB2sH2sHBGBJHBJHBNQQwBAB",!1)),Lu:()=>new T(I("hCZBmDWBCGBiB2BCDOCDuBCBECEBBCCCBCCBBBDDBCBBCCBEBBCBBCECBCCDCCBCCBBBCCCBEEIJDCMCDQCDDDCCBC4BCIBBCBBDCCBCBCGCiJCCEJJHCCBBBCCCBCCBPBCIBkBDDBBBEWCGDDCBBDyBBxBgBCK2BCBMCD+CCDlBBq6ClBBCGGzW1CB0kCHHBpBBDCBhK0ECKgDCKHBJFBLHBJHBJFBMGCJHBpCDBNDBNDBNEBMDBnIFFECBDCBDEEBDBHGCBCBDDBLBBG+B+B9zCvBBxBCCBBBDGCBCBCDDJCBCgDCJCCFuqeuqeCqBCUaCoEMCE8BCLECBICFCCDCCEUCBDBCEBCOCBCBCCCBQCZs5Vs5VBYBmmBnBBpEjBB9EKBCOBCGBCBBr3ByBB+EVB75CfBhsVfBhCYBoqZZBbZBbZBbCCBGDBDDBCBCHBbZBbBBCDBDHBCGBcBBCDBCEBCEEBFBcZBbZBbZBbZBbZBbZBfYBiBYBiBYBiBYBiBYBiB2pE2pEBgBB",!1)),M:()=>new T(I("gYvDB0IGBoIsBBCCCBCCBCCpCKBxBUBRmDmDBFBDFBDBBCDBkBffBZB8CKB7BIBKZZBCBCIBCCBCEBsBCB8BIBrBXBCgBB3BCBCRBCGBLBBeCB5BCCBFBDBBDCBKLLBbbDCB5BCCBDBFBBDCBEffBEEMCB5BCCBGBCCBCCBVBBXFBCCB5BCCBFBDBBDCBICBLBBf8B8BBDBECBCDBKpBpBBDB4BCCBFBCCBCDBIBBMBBeCB5BCCBFBCCBCDBIBBMBBQNNBCB4BBBCGBCCBCDBKLLBeeBBBnCFFBEBCCCBGBTBB+BDDBFBNHBjDDDBHBMGBqCBBcECFBByBTBCBBGKBCjBBKlDlDBSBYDBFCBCCBDGBEDBOLBCLLBCBgWCBzdDBdCBeBBfBBhCfBKuBuBBBBC2D2DBjBjB3DLBFLB8GEB6BJBCcBDxBxBBsBBDLBVEBwBQBnBIBNCBfMB5BNBxBTB5ECBCUBFHHDCBnG-BBxWgBB--CCBuEhDhDBeBrRFBqDBB1udDBCJBhBBBxCBBxIEEFYYBDBF0C0CBzBzBBQBbRBOnBnBBGBaMBtBDBwBNBlBkCkCBMBNJJBuBuBBBBzBCCBBBDBBGBBCqBqBBDBGBBtHHBCBBx5TiXiXBOBRPBuejHjH2EEBn0BCBCBBGDBpBCBFmFmFB+R+RBCBiCEB+JBBuCFBnCKByBDB7DCB2BOBqBDDBLLBCBuBKBI+B+BBBBlBNBRBBtBNNBBBxBNBJDBCBB9CLBHDD+ELBWDB4BBBCGBDBBDCBKLLBDDBFBEEBkCIBCDDCDBCEBCPPBzCzCBQBYyCyCBSBsHGBDIBcBBzCQBrDMBmDOBhIOB2HFBCBBDDBCCCBuEuEBFBDGBEddBIBpBGBCDBJKKBJBvBPBnGHBoGHBCHBzCVBCNB7DFBECCBCCBFBCjCjCBDBCBBCEB8KDBKBBCxBxBBFBEEBYmnFmnFHOBpmLRBhuCEB8BGB5gBCCB1BBIDByCMMBslTslTBizEizEBsBBDWB-QEBEFBJHBDGBfDB1ECB89B2BBFxBBJPPXEBCOBxqBGBCQBDGBCBBCEBlDhFhFBFB4L+B+BBCB9PDB-HBB0HDDIBBG7O7OBFBuDGB29lYvHB",!1)),Mc:()=>new T(I("joC4B4BDCBJDBCBBzBBB7BCBHBBDBBLsBsB7BCBjC7B7BBBBJCCB2B2BB7B7BCHHBDDBLLnDBBCBBECBCCBLqBqBBBB+BDB+BBB7BCCBDBDBBCBBKBBdPPB7B7BBBBGCBCCBLrBrBBsCsCBBBHHBTBBrKBBgCsFsFBFFHDDBaaBLLBBBDGBWBBDFBDLLBBB5zBffiEIIBGBCBB7KDBDCBFBBCFBhHBB7BCCKCCBJJBEByExBxBGCCBDBCBB+BffFBBD9B9BDCBCEEBxBxBBGBJBBsFWW35EBB0-dBBD5C5CBzBzBBOBvEBBwBxBxBBFFBDDBBBvDBBDBBZuBuBCuDuDDBBGuHuHBCCBCCBCC0gZCCgEuBuBBBBFBB0DZZB8B8BxBCBKBBO+C+CBBBEBBCrFrFBBBgBBB7BBBCDBDBBDCBKLLB1C1CBBBIDDCDBCBBCmDmDBBBJBBErDrDBBBHCCBCBDuHuHBBBHDBDyDyDBBBJBBCuDuDCBBHoDoDCBBFmImIBBBK4H4HBEBCBBFDDCvEvEBBBJDBF1C1CeBB-BqGqGECCoGPPrDIID2G2GBDBFBBC-K-KBNNxBBBJBBCpvQpvQBBBlxD2BBpDBB0rYBBHFB",!1)),Me:()=>new T(I("okBBB1xF-wB-wBBCBCCBsshBCB",!1)),Mn:()=>new T(I("gYvDB0IEBqIsBBCCCBCCBCCpCKBxBUBRmDmDBFBDFBDBBCDBkBffBZB8CKB7BIBKZZBCBCIBCCBCEBsBCB8BIBrBXBCfB4BCCFHBFEEBFBLBBe7B7BFDBJVVBbbDBB6BFFBFFBDDBBBEffBEEMBB6BFFBDBCBBFVVBXXBEBC7B7BDCCBCBJIIBMMBff+BNNzBEE4BCCBBBGCBCDBIBBMBBe7B7BDHHGBBVBBdBB6BBBFDBJVVBeepCIIBBBC7C7CDGBNHBjDDDBHBMGBqCBBcEC4BNBCEBCBBGKBCjBBKnDnDBCBCFBCBBDBBaBBFCBRDBODDBHHQgWgWBBBzdCBeBBfBBfBBhCBBCGBJDDBJBKuBuBBBBC2D2DBjBjB3DCBFBBKHHBBB8GBBD7B7BCGBCCCDHBHJBDxBxBBMBCeBDLBVDBxBCCBDBCGGpBIBNBBhBDBDBBCCB5BCCBEECCB7BHBDBB5ECBCMBCGBFHHEBBnG-BBxWMBFEEBKB--CCBuEhDhDBeBrRDBsDBB1udFFBIBhBBBxCBBxIEEFaaBGG4EBBbRBOnBnBBGBaKBvBCBxBDDBCBDBBoBkCkCBEBDBBDBBNJJwB0B0BCCBDBBGBBCrBrBBJJvHDDFx5Tx5TiXPBRPBuejHjH2EEBn0BCBCBBGDBpBCBFmFmFB+R+RBCBiCEB+JBBuCFBnCKByBDB8D3B3BBNBqBDDBLLBBByBDBDBBI+B+BBBBlBEBCHB-BNNB1B1BBHBLDBDgDgDBBBDCCBHHD+E+EEHBWBB6BBBEmBmBBFBEEBnCFBOECPBB2CHBDCBCYY1CFBCFFBCCBvHvHBCBHBBCBBcBB2CHBDCCBrDrDCDDBEBCmDmDCDDBCBCEBkIIBCBBhIBBCFFxEDBDBBFhBhBBIBpBFBDDBJKKBEBDCBvBMBCBBnGCCBBBCqGqGBFBCFBCzCzCBUBDGBCBBCBB7DFBECCBCCBFBCpCpCBEEC8K8KBMMB1B1BBDBGCCYmnFmnFHOBpmLLBECBhuCEB8BGB5gBgCgCBCByC5lT5lTBizEizEBsBBDWBhRCBSHBDGBfDB1ECB89B2BBFxBBJPPXEBCOBxqBGBCQBDGBCBBCEBlDhFhFBFB4L+B+BBCB9PDB-HBB0HDDIBBG7O7OBFBuDGB29lYvHB",!1)),N:()=>new T(I("wBJB5DBBGDDBBBitBJBnEJBnGJB9MJB3DJBFFBtDJB3DJB3DJBDFBvDMB0DJBJGBoDJBpDGBISBuDJBhDJB3DJBnCTBtIJBnCJBwWTBybCBwHJBHJBXJBtJJBhEKBmFJBHJB3FJB3CJBnEJBHJB3gBEEBEBHJBnGyBBDEB3W7BBvCVB3TdBqrBqYqYaIBPCB4KDBrEJBfHBCOBhBJBoBOBh7cJB9FJBhKFB7EJBnBJBnGJBXJB3CJB3MJB34UJBuPsBBN4BBSBB2KaBlBDBeJJnEEBrGJBvdHBaGBoBIBsCEBXFBhFBBDPBDtBBhCIB1BBBfCBsCEBpDHBZHBqBGBrKFBxBJBHJB3IeB-EJBrBDBxDGBnEdBhEJB9BJBxEJBITB8HJB3KJB3DJB3LJBnDJBHTBtCLBlNSB+CJB3UJB3CcBkHJBnCJB3BJBnLJBnDUBshBuDBimPJBnpCJB3CJBnEJBCGBvQJBnIWB+KCB6nXJBnuBTBNTBtDYB2iBxBBhqCJBnNJB3PJB4HJBtWIBhEJB4Y6BBCCBCDBtCsBBCOBjeMBk3CJB",!1)),Nd:()=>new T(I("wBJnxBJnEJnGJ9MJ3DJ3DJ3DJ3DJ3DJ3DJ3DJ3DJ3DJhDJ3DJnCJ3IJnCJn6BJnBJtJJhEJnFJHJ3FJ3CJnEJHJnuiBJnVJnBJnGJXJ3CJ3MJ34UJnsBJnkCJHJ9YJhEJ9BJxEJ3IJ3KJ3DJ3LJnDJHTtCJnNJnDJ3UJ3CJ3HJnCJ3BJnLJ3uQJnpCJ3CJnEJ3QJ37XJ12CxBhqCJnNJ3PJ4HJ2aJ30EJ",!0)),Nl:()=>new T(I("u3FCBwzCiBBDDB-zDaaBHBPCBs1dJBxyW0BBtOJJnEEBrhIuDBm8SCB",!1)),No:()=>new T(I("yFBBGDDBBB2pCFB5LFB5DCBmEGB6GGBSIByNJB2hBTB0jBJBhP20B20BEFBHJBnGPBqB3W3WB6BBvCVB3TdBqrB1kB1kBBCBrEJBfHBCOBhBJBoBOBxrdFBymWsBBiCDBSBB2KaBlBDB1pBHBaGBoBIBsCEBXFBhFBBDPBDtBBhCIB1BBBfCBsCEBpDHBZHBqBGBrKFBhLeB-EJBrBDBxDGBnETB8LTBmqBBBvNIBobSB0aUBn8SGB-YWBqhZTBNTBtDYBvqFIBid6BBCCBCDBtCsBBCOBjeMB",!1)),P:()=>new T(I("hBCBCFBCDBLBBEBBbCBCccCkBkBGEELBBEEE-VJJzOFBqBBB0BCCDDDtBBBVBBCBBOCCBBBrCDBnDsBsBBMBqHCB3BOBgBmImIBLLtE5D5D6DnMnMNwLwL7CLLBpFpFBNBCmBmBBCBoCrCrCBDBFBBwDFBsFlTlTBHB4EuTuTtBBBvCCBoCBB+ECBCCBmBKB6JBB5GBBhEGBCFBhFBBLGBdCB9DDB8BEB-BBBhCHBM9Z9ZBWBJTBCMBCLBfBBPBB6TDBeBB+hBNBwCBBgBJB0MVBgCDBhBBB8XDBCBBxDwEwEBtBBCfBDLBkNCBFJBDLBRNNjD7C7CjgdBBuICBkDLL0DFB9LDB3CBBpBCBCyByBBwBwBiDMBRBB9DDB-DBBRBB6HzqUzqUBxGxGBIBXiBBCNBCFFCBB2ECBCFBCDBLBBEBBbCBCccCCCBFB7MCB9UxBxB-MoXoXoGgBgBxIIBnBxDxDBFBjCGB6CDByO-J-JjBlElEBDBtBDB+FGBuDBBCDB-DDBxBBBwCDBFOOCCB5CFBsDrJrJBCCBzDzDBDBLBBCpDpD7HWBqDCBdMBtCjEjEBBB9HpIpIBBB8E9C9CBGB0CCBCEB+CJB4GgDgDBDBrBBBmUBBrCMBwFxjBxjBBDB97CBB8zOBBmEiCiCBDBJpRpRBBBoJDBoK9lT9lTovHEB07C-a-aBAB",!1)),Pc:()=>new T(I("-Cg-Hg-HBUU-u3BBBZCBwHAB",!1)),Pd:()=>new T(I("tB9qB9qB0BiyDiyDmgBqgCqgCBEBiwDDDgBBBFdd-NUUwDxszBxszBBmBmBLqFqFhzD-J-J",!1)),Pe:()=>new T(I("pB0B0BgB+1D+1DC-6B-6BqtC4B4BQ7T7TCff-hBMCxChBhBCGC1MUChCCCiBmhBmhBCECtBGCtNICEGCDBB-ozB6G6GeOCESSCCCrF0B0BgBGD",!1)),Pf:()=>new T(I("7F+6H+6HEddpuDCCFDDQEE",!1)),Pi:()=>new T(I("rFt7Ht7HDBBDaapuDCCFDDQEE",!1)),Po:()=>new T(I("hBCBCCBDECBLLBEEBcclCGGPBBI-V-VJzOzOBEBqB3B3BDDDtBBBVBBCBBOCCBBBrCDBnDsBsBBMBqHCB3BOBgBmImIBLLtE5D5D6DnMnMNwLwL7CLLBpFpFBNBCxDxDrCEBFBBwDFBsFlTlTBHBmY9D9DBBBoCBB+ECBCCBmBFBCDB6JBB5GBBhEGBCFBhFBBLGBdCB9DDB8BEB-BBBhCHBMjajaBJJBGBJIBDDBDCBEKBCCCBIB7kDDBCBBxDwEwEBFFBBBDDDBHBCBBCDDBLLBDBCJBDDBCCCBLBDCBtNCB6B+F+FjgdBBuICBkDLL0DFB9LDB3CBBpBCBCyByBBwBwBiDMBRBB9DDB-DBBRBB6HlxUlxUBFBDXXVBBDDBECBCDBICBHCCB2E2EBBBCCBDECBLLBEEBcclBDDB7M7MBBB9UxBxB-MoXoXoGgBgBxIIBnBxDxDBFBjCGB6CDB0ZlElEBDBtBDB+FGBuDBBCDB-DDBxBBBwCDBFOOCCB5CFBsDrJrJBCCBzDzDBDBLBBCpDpD7HWBqDCBdMBtCjEjEBBB9HpIpIBBB8E9C9CBGB0CCBCEB+CJB4GgDgDBDBrBBBmUBBrCMBwFxjBxjBBDB97CBB8zOBBmEiCiCBDBJpRpRBBBoJDBoK9lT9lTovHEB07C-a-aBAB",!1)),Ps:()=>new T(I("oBzBzBgB-1D-1DC-6B-6B-rCEEnB4B4BQ7T7TCff-hBMCxChBhBCGC1MUChCCCiBmhBmhBCECaTTCECtNICEGCDipzBipzB4GeeCMCESSCCCrFzBzBgBEEDAB",!1)),S:()=>new T(I("kBHHRCBgBCCcCCkBEBCBBDCCBCBDEEfgBgBrODBNNBGGBCCCBPB2DPPBxDxDsErIrIBBB3DCBDDDBvGvGLUUB4H4HIBBpEqLqLBHHB2H2H-DjEjEBGBlEwGwGqBmGmGiGCBQCCBBBDFBVECmEHBCFBCBBGDBmGBBxXJB0WuLuLlL+E+EBgBBiLJBKIBhiBCCBBBMCBOCBOCBOBBmCOOoBCBOCBUhBB-BBBCDBCBBLCCBBBGFBCECFMMBFFBDBGDBC7B7BBFFB2LBFcBD+HBXKByCtCBXnTBtBwBBDeBLyMBX+BBFfBD1LBDpEBmHFBmLBBvBZBC4CBN1GBbPBFOOBNNWBBHBB8CBB0HBBFJBhBlBBKRRBdBMdBJQQBeBLmBBQ-JBhuG-BBx0V2BB6RWBKBBoDBB+EDBLDB+RCBiHPPB+9T+9TpEgBBuLPBhCBB3BHBtBDBjDCCBBBD7E7EHRRBBBgBCCcCCiEGBCGBOBB6JIB6BQBDCBCMBEwBwBBrBB7zBBBwSmWmWBiKiKBGBnjC2kC2kCBbBr6SDBG3qU3qUk7DvHBLCBEzNBHWBQQBgDzDB9B1HBLmBBD7BBGCBXBBIdBF8BBWhCBE7F7FB1CBrbaagBaagBaagBaagBaa9B-PB4BDBzBHBCNBCBBp2BwNwNttCEE+DiOiOBvIvIBqBBFjDBNOBDOBCOBCkBBYgFB5BcBOrBBFIBIBBPFB7E4eBEQBEMBE5GBHLBFQQBKBF3BBJJBHnBBJdBDLBFBBPIBoB3KBJNBDMBEKBE4BBCFFBOBDLBFJBIyEBC7CBLAB",!1)),Sc:()=>new T(I("kB+D+DBCBqnB8D8DzPBBzPBBI2H2HoImSmS8sClmClmCBgBB37hBkuVkuVtD7E7E8GBBEBB3-HDB-4wBxtCxtC",!1)),Sk:()=>new T(I("+CCCoCHHFEEqQDBNNBGGBCCCBPB2DPPBjoBjoB15FCCBBBMCBOCBOCBOBB9kEBBkzdWBKBBoDBBxePPBniUniUBPB8bCCjF4g9B4g9BBDB",!1)),Sm:()=>new T(I("rBRRBBB+BCCuBFFmBgBgB-XwQwQBBB8xGOOoBCBOCBsEoBoBBDBHlClCBDBGBBFGDIgBgBBDDCgBgBBqIBhBBB7CffBXBpBFB2OKK3BHBwDxKxKBDBDeBLPBhIiEBX+BBFfBDhIBxBUBDFB9+zB5Z5ZCCBlFRRBBB+BCCkEHHBCBitDBBhrwBx+Bx+BagBgBagBgBagBgBagBgBat5Ft5FB-uC-uCBHB",!1)),So:()=>new T(I("mFDDFCCyerIrIBgEgEBvGvGLUUB4H4HkQ2L2LjEFBClElEwGqBqBoMCBQCCBBBDFBVECmEHBCFBCBBGDBmGBBxXJB0WzWzW+EhBBiLJBKIBksBBBCDBCBBLCCBHHBEBCECFMMBPPCBBC7B7BBKKBDBDDBCBBCBBCGBCeBDBBCCCBdBtIHBFTBDGBDwCBCdBanBBHnCBXKByCtCBX2FBCIBC1BBJuDBC3HBtBrBBhC-HBhQvBBWBBHmBBDpEBmHFBmLBBvBZBC4CBN1GBbPBFOOBNNWBBHBBxKBBFJBhBlBBKRRBdBMdBJQQBeBLmBBQ-JBhuG-BBx0V2BBibDBLBBC+R+RBBBqqUPBuLPBhCBB3BHBuBCBlPEEFBBOBB6JIB6BQBDCBCMBEwBwBBrBB7zBBBwSpgBpgBBGBnjC2kC2kCBGBFQBr6SDBG3qU3qUk7DvHBLCBEzNBHWBQPBhDzDB9B1HBLmBBD7BBGCBXBBIdBF8BBWhCBE7F7FB1CBqlB-PB4BDBzBHBCNBCBBp2B96C96CiEyWyWBqBBFjDBNOBDOBCOBCkBBYgFB5BcBOrBBFIBIBBPFB7E6HBG4WBEQBEMBE5GBHLBFQQBKBF3BBJJBHnBBJdBDLBFBB-B3KBJNBDMBEKBE4BBCFFBOBDLBFJBIyEBC7CBLAB",!1)),Z:()=>new T(I("gBgEgEgvFgsCgsCBJBeBBGwBwBh9DAB",!1)),Zl:()=>new T(I("ohIA",!0)),Zp:()=>new T(I("phIA",!0)),Zs:()=>new T(I("gBgEgEgvFgsCgsCBJBlBwBwBh9DAB",!1)),ASCII_Hex_Digit:()=>new T(I("wBJIFbF",!0)),Alphabetic:()=>new T(I("hCZBHZBwBLLFGGBVBCeBCpOBFLBPEBICC3CeeBQBCBBDDBCHHCCBCCCBSBCyCBCqEBJlFBClBBDHHBnBBoBNBCCCBCCBCCJaBFDBeKBG3BBCGBPlDBCHBFHBFCBLCBDRRBuBBOkDBZgBBKBBFGGBWBDSBUYBIKBGXBCGBIJJBoBBLLBEGBHrCBCPBCCBFOBOSBCHBDBBDVBCGBCEEBCBEHBDBBDBBCJJFBBCEBNBBLFFBBBCFBFBBDVBCGBCBBCBBCBBFEBFBBDBBFIIBCBCSSBEBMCBCIBCCBCVBCGBCBBCEBEIBCCBCBBEQQBCBWDBFCBCHBDBBDVBCGBCBBCEBEHBDBBDBBKBBFBBCEBORRBCCBEBECBCDBEBBCCCBEEBEEBBBELBFEBECBCCBEHHpBMBCCBCWBCPBEHBCCBCCBJBBCCBCBBDDBdDBCHBCCBCWBCJBCEBEHBCCBCCBJBBGCBCDBOCBNMBCCBCoBBDHBCCBCCBCGGBCBIEBXFBCCBCRBEXBCIBCDDBFBJFBCCCBGBTBBO5BBGGBH0B0BBECBDBCXBCCCBRBCCBDEBCHHPDBhBgCgCBGBCjBBFSBFPBCjBBkC2BBCDDBDBR-BBLDBDlBBCGGDqBBCsKBCDBDGBCCCBCBDoBBCDBDgBBCDBDGBCCCBCBDOBC4BBCDBDiCBmBPBR1CBDFBErTBDQBCZBGqCBEKBITBMUBNTBNMBCCBCBBNzBBDSBPFFkC4CBIqBBGlCBLeBCLBFIBYdBDEBMrBBFZB3BbBF+BBDTBzBYYBMMBBByBzBBCOBCHB0BpBBDDBLrBBCKBP2BBXCBLjBBDKBGqBBDCBqBDBCFBCBBEGGB+FBUhBBM1IBDFBDlBBDFBDHBCGCBdBD0BBCGBCEEBBBCGBEDBDFBFMBGCBCGB1DOORMBmDFFDJBCEEBDBHGCBCBCKBDDBGEBFSSBnBBuZzBB34BkHBHDBEBBNlBBCGGD3BBIRRBVBKGBCGBCGBCGBCGBCGBCGBCGBCfBwB2O2OBBBaIBIEBDEBF1CBHCBC5CBCDBGqBBC9CBSfBxBPBhQ-tGBhCs0VBkCtBBDsIBEPBLBBVuBBGHBEwDBoBIBDmDBDxCBVUBCgBBZzBBNjCBCtBtBBEBECCBBBLgBBGiBBOcBEyBBCLBQRRBOBLEBC2BBKNBTWBEkCBCCCZCBDPBDDBMFBDFBDFBKGBCGBCqBBCNBH6DBWj9KBNWBFwBBloItLBDpDBnBGBNEBGLBCMBCEBCCCBCCBCCBqDBiBqLBT-BBD1BBpBLB1DEBCmEBlBZBHZBM4CBEFBDFBDFBDCBkBLBCZBCSBCBBCOBDNBjB6DBmC0BBsIcBEwBBwBfBOdBGqBBGdBDjBBFHBCEBrB9EBTjBBFjBBFnBBJzBBNKBCOBCGBCBBCKBCOBCGBCBBEzBBN2JBKVBLHBZFBCpBBCIBmCFBDCCBqBBCBBEDDBVBLWBKeBiCSBCBBLVBLZBHZBnB3BBHBBhCDBCBBGHBCCBCcBrBcBEcBkBHBCbBc1BBLVBLSBORBvDoCB4ByBBOyBBOnBBjBbBEGGBVB7HpBBCBBEBBRFBzBCBEcBLJJBUBrBRBvBUBcWBKlCBsBEBL4BBKOOBXBYyBBSDBJiBBEKKB+BBCDBKBBLCCkBRBChBBDHHBCB-BGBCCCBCBCOBCJBI4BBYDBCHBDBBDVBCGBCBBCEBEHBDBBDBBEHHGGBdJBCDDClBBCJBCDDCDBCBBECCtBhCBCCBCDBVCBfhCBDBBC5F5FB0BBDGBaFBjB+BBCEE8B1BBDoCoCBZBDNBWGB6F4BBoD-BBgBHBDDDBGBCBBCdBCBBDBBDDB+CHBDtBBDFBCCCBccBxBBDJBSnCBGTTBnCBoDHB5CgBBgBIBCsBBCGBCyByBBcBDVBCNBqCGBCBBCrBBECCBCCBBBCDDBZZBEBCBBCkBBCBBCDBCYYBqBBlIWBKQBCoBBECBwDwCwCB4cBnDuDBSjGBtyCgDBQvhBBSFBa68DBGmSB61GuBBy2B4RBIeBSuCBSdBTvBBRDBgBUBGSBxNsBB0G-BBhBYBDYBtBqCBF4BBIQBhCBBCNNBFBK1mHBqBfBiDyDB+vIDBCGBCBBCiJBQeeBBBDPPBCBJrMBloCqDBGMBEIBIJBFi7Fi7FBzCBCmCBCBBDDDBDDBCBCLBCCCBFBCgCBCDBDHBCGBCbBCDBCEBCEEBFBCzKBDYBCYBCeBCYBCeBCYBCeBCYBCeBCYBCHB15BeBHFB2GGBCQBDGBCBBCEBG9BBiBxDxDBrBBLGBRiKiKBcBTrBBlPbBlHdBDwGwGBdBCVBJBBhHGBCDBCBBCOBCkGB8BjCBEEE1lBDBCaBCBBCDDCJBCDBCCCHFFCECBBBCBBCDDCICBCCDDBCGBCDBCDBCCCBIBCQBGCBCEBCQB1TZBHZBHZB3zD-2pBBhB9oEBDt0FBDwpHBQtTBjtC9QBjvBq6EBGppIB",!1)),Dash:()=>new T(I("tB9qB9qB0BiyDiyDmgBqgCqgCBEB+BoBoBQnMnMlgDDDgBBBFdd-NUUwDxszBxszBBmBmBLqFqFhzD-J-J",!1)),Emoji:()=>new T(I("jBHHGJBwDFFu8HNN5GXX7CFBQBBwLBBNnFnFaKBFCBoGoHoHBLLK7B7BBCBCEBKGDBDDFDDCBBDIEBJJBBBGCCGLBMBBDCCBCCTDDBTTBEBCCCBEEBGGDBBFBBMBBGBBDGGBECBVVBGGBEBCDBDFFDDDBEBCDDCCCHEEHLLBQQDFFCFFBBBCMMBxBxBBBBKeP1LBBwOCBUBB0BFF7mBNN6SCCrrvDrGrGhFBBNBBPDDBIBsCZBCBBYVVDIBWBBvFhBBDvDBDBBCCBDyCBDCBCmIBC+BBMFBCXBIBBDHBNDDBCBDFFBOOBDDJBBKGGBBBNCBJCBDCCFHHEHHB0CBxBlCBGHBDDBEJBECCBEEDJBkHLBF8I8IBtBBCJBC4FBxDMBEKBE4BBCFFBOBDLBFJB",!1)),Emoji_Component:()=>new T(I("jBHHGJB0+H2G2Gsp3B3+8B3+8BBYB8PEBxtBDBtzhY-CB",!1)),Emoji_Modifier:()=>new T(I("7-8DE",!0)),Emoji_Modifier_Base:()=>new T(I("9wJ8G8GRDB4jzD9B9BBBBDDDBBB2DBBDKBWSBEFFBBBCCBICCZqGqGBFFWFFBvFvFBBBEEB0CRRBBBKMMgSDDJHBHKKBIBDCB5B+B+BBCCBCCSCBCMBmHCBrBIB",!1)),Emoji_Presentation:()=>new T(I("64IBBuGDBEDDqQBBWBBzBLBsBUUOJJBSSBGGBJJGWWIBBCFFDIIFBBdkBkBCFFBBBC+B+BBBBZPP8aBB0BFFvlxDrGrG-FDDBIBsCZBCZZVDDBDBCCBWBBvFgBBNIBClCBCVBNqBBFEBNQBEEEBlCBCCCB5FBD+BBODBCXBTbbBOO3C0CBxBlCBHEEBBBDDBEDBMBBIIBkHLBF8I8IBtBBCJBC4FBxDMBEKBE4BBCFFBOBDLBFJB",!1)),Extended_Pictographic:()=>new T(I("pFFFu8HNN5GXX7CFBQBBwLBBNnFnFaKBFCBoGoHoHBLLK7B7BBCBCEBKGDBDDFDDCBBDIEBJJBBBGCCGLBMBBDCCBCCTDDBTTBEBCCCBEEBGGDBBFBBMBBGBBDGGBECBVVBGGBEBCDBDFFDDDBEBCDDCCCHEEHLLBQQDFFCFFBBBCMMBxBxBBBBKeP1LBBwOCBUBB0BFF7mBNN6SCCrrvDoBoBBCBlDLBQBBQPPBmBmBBIBxDBBNBBPDDBIBU3BBcOBLVVDIBCDBKWBH7FBDvDBDBBCCBDyCBDCBCDBG9HBC+BBMFBCXBIBBDHBNDDBCBDFFBOOBDDJBBKGGBBBNCBJCBDCCFHHEHHB0CBxBlCBGHBDQBECCBEBDMB7GlBBNDB5BHBLFBpBHBfBBNDBDNBKmBBNuBBCJBC4FB5CHBPxEBhI9fB",!1)),Hex_Digit:()=>new T(I("wBJIFbFq1-BJIFbF",!0)),Lowercase:()=>new T(I("hDZBwBLLFlBlBBWBCHBC2BCBQCBuBCDECBBBDCCDEEBFFDEEBBBDDDCCCDCCBCCDEECDDBDDBBBHGDCOCBSCBDDCEEC4BCBFBDDDBCCFICBjCBDiBBIBBfEBhDsBsBCEEDDBTccBhBBCBBECBCWCBDBCGDB0B0BBuBBCgBCK0BCDMCBgDCxBoBBo6CqBBCDB5XFBjkCIBC2D2DB+FBiC0ECBHBCgDCBHBJFBLHBJHBJFBLHBJHBJNBDHBJHBJHBJEBCBBHEEBBBCBBJDBDBBJHBLCBCBB6DOORMBuDEEBEEcKFDBBJDBFiBiBBOBFsasaBYBn6BvBBCEEBGCFCCBCCBGBEiDCBIICFFNlBBCGG0oesBCUaCBBBmEMCBBBC8BCBIBCCCDICFCCDCCBBBCSCGGGCMCFCCDOCWDBCCCBBB2ZqBBCNBHvCBh6TGBNEBqhBZBumBnBBpEjBB8EKBCOBCGBCBBkODDBBBCpBBCIBmoByBB+DVB75CfBhsVfB8BYBnqZZBbGBCRBbZBbDBCCCBFBCKBbZBbZBbZBbZBbZBbZBbZBbZBbbBdYBCFBbYBCFBbYBCFBbYBCFBbYBCFBC15B15BBIBCTBHFBmI9BB1lChBB",!1)),Math:()=>new T(I("rBRRBBBgBeeCuBuBFmBmBgB5W5WBBBDbbBDDBBBwQCBuwGccBBBMEEOPPBCBWEBMEBiCMBFEEBFFBDBTFFDJBCDDBEBHEEBDDBCCBBBCFBENBClClCBWBCFBCBBFBBFfBCHHBPPBqIBJDBVBB7CffBZBCZZMGB+NBBNJBFFBFBBDBBEEBPCCDFBMHBGBB6BCCeDBKCBxK-BBhI-PBxBUBDFB9+zB4Z4ZBEBCjFjFRCBeCCeCCkEHHBCBitDBBhrwBwoBwoBBzCBCmCBCBBDDDBDDBCBCLBCCCBFBCgCBCDBDHBCGBCbBCDBCEBCEEBFBCzKBDjJBDxBBhwFDBCaBCBBCDDCJBCDBCCCHFFCECBBBCBBCDDCICBCCDDBCGBCDBCDBCCCBIBCQBGCBCEBCQB1BBB-uCIB",!1)),Quotation_Mark:()=>new T(I("iBFFkEQQ96HHBaBBowDqOqOBCBOCBixzBDB+FFF7CBB",!1)),Terminal_Punctuation:()=>new T(I("hBLLCMMBEE-ZJJiQ6B6BpCPPCCB1FsBsBBJBCsHsHB3B3BBEBCHBgBmImIB1nB1nBBtFtFFFB4JBB2YHBmY9D9DBBBoCBB+ECBEoBoBBCBDBB7JBBjLDBjFBBLBBCCBeCB8FEB-BBBldYYBKKBBBwlDCBzJOOFLLCBBEBBtNBB8ndBBuICBkHEB-LBB3CBBgD4E4EBBB0ECBgERRB6H6HnxUDDB6B6BBBBCDBqFLLCMMBEEiCDD7hBxBxBnkBoGoG3JBB5EFBlCFB6CDB5dEBtBDB+FGBxDDBgECBiEBBHRRB5C5CBDBtDrJrJB2D2DBBBNBBnLDBEOBqDBB6HCBmQCC8HBB4CBBFBB-MCBuBmUmUBrCrCBspBspBBDB6vRBBmEiCiCBBBLqRqRBoJoJBnwTnwTovHDB",!1)),Uppercase:()=>new T(I("hCZBmDWBCGBiB2BCDOCDuBCBECEBBCCCBCCBBBDDBCBBCCBEBBCBBCECBCCDCCBCCBBBCCCBEEIJDCMCDQCDDDCCBC4BCIBBCBBDCCBCBCGCiJCCEJJHCCBBBCCCBCCBPBCIBkBDDBBBEWCGDDCBBDyBBxBgBCK2BCBMCD+CCDlBBq6ClBBCGGzW1CB0kCHHBpBBDCBhK0ECKgDCKHBJFBLHBJHBJFBMGCJHBpCDBNDBNDBNEBMDBnIFFECBDCBDEEBDBHGCBCBDDBLBBGbbBOBUzZzZBYBx5BvBBxBCCBBBDGCBCBCDDJCBCgDCJCCFuqeuqeCqBCUaCoEMCE8BCLECBICFCCDCCEUCBDBCEBCOCBCBCCCBQCZs5Vs5VBYBmmBnBBpEjBB9EKBCOBCGBCBBr3ByBB+EVB75CfBhsVfBhCYBoqZZBbZBbZBbCCBGDBDDBCBCHBbZBbBBCDBDHBCGBcBBCDBCEBCEEBFBcZBbZBbZBbZBbZBbZBfYBiBYBiBYBiBYBiBYBiB2pE2pEBgBBvgCZBHZBHZB",!1)),White_Space:()=>new T(I("JEBTlDlDbgvFgvFgsCKBeBBGwBwBh9DAB",!1))});static get Upper(){return this.CATEGORIES.get("Lu")}static SCRIPTS=new zc({Adlam:()=>new T(I("go6DrCFJFB",!0)),Ahom:()=>new T(I("g4lCaDOFW",!0)),Anatolian_Hieroglyphs:()=>new T(I("ggxCmS",!0)),Arabic:()=>new T(I("gwBEBCFBCNBCCBCfBCJBMZBCrDBChBBxCvBBxHhBBGqCBCcBxy8BtPBDvEBhBPBxDEBCmEBk7DeBkCFBJIBiBFBh43BDBCaBCBBCDDCJBCDBCCCHFFCECBBBCBBCDDCICBCCDDBCGBCDBCDBCCCBIBCQBGCBCEBCQB1BBB",!1)),Armenian:()=>new T(I("xpBlBDxBDCks9BE",!0)),Avestan:()=>new T(I("g4iC1BEG",!0)),Balinese:()=>new T(I("g4GsCCxB",!0)),Bamum:()=>new T(I("g1pB3CpowB4R",!0)),Bassa_Vah:()=>new T(I("w26CdDF",!0)),Batak:()=>new T(I("g+GzBJD",!0)),Bengali:()=>new T(I("gsCDBCHBDBBDVBCGBCEEBCBDIBDBBDDBJFFBCCBDBDYB",!1)),Beria_Erfe:()=>new T(I("g17CYDY",!0)),Bhaiksuki:()=>new T(I("ggnCICsBCNLc",!0)),Bopomofo:()=>new T(I("qXB6wLqBxDf",!0)),Brahmi:()=>new T(I("ggkCtCFjBKA",!0)),Braille:()=>new T(I("ggK-H",!0)),Buginese:()=>new T(I("gwGbDB",!0)),Buhid:()=>new T(I("g6FT",!0)),Canadian_Aboriginal:()=>new T(I("ggF-TxRlC7tgCP",!0)),Carian:()=>new T(I("g1gCwB",!0)),Caucasian_Albanian:()=>new T(I("wphCzBMA",!0)),Chakma:()=>new T(I("gokC0BCR",!0)),Cham:()=>new T(I("gwqB2BKNDJDD",!0)),Cherokee:()=>new T(I("g9E1CDFz7lBvC",!0)),Chorasmian:()=>new T(I("w9jCb",!0)),Common:()=>new T(I("AgCBbFBbuBBCOBCEBYgBgBiOmBBGEBDTB1DKKHCC+THHPEEhB9E9ElQiEiEB6mB6mB2MDBjJwvBwvBBBBoCBBsGBBCumBumBOIIBCBCFBCCBDmYmYBKBD2CBCKBEKBCOBShBB-BlBBCCBDFBCaBCQBqBCBF5UBXKBW-cBhIzTBDpEBhQ9CBzMUBCCCBXBQHBFDB8CBBE7C7CB0E0EBOBhBlBBKxBxBB+BBgBwCBwB5C5CBmFBhuG-BBhoWhBBnDCBmFJB1HhFhFsMPPBzuUzuUBxGxGBIBXiBBCSBCDB0ECCBeBbFBbKBLuBuBBhChCBFBCGBLEBjICBFsBBEIBxCMB0BsBBlHaBltuBDB96D8HBEzNBHWBQQBgDzDB9B1HBLmBBD9BBEQBJBBIdBF8BB2GTBNTBN2CBKYBoE0CBCmCBCBBDDDBDDBCBCLBCCCBFBCgCBCDBDHBCGBCbBCDBCEBCEEBFBCzKBDjJBDxBByjFjCBtC8BBjWrBBFjDBNOBDOBCOBCkBBLtFB5BZBCBBOrBBFIBIBBPFB7E4eBEQBEMBE5GBHLBFQQBKBF3BBJJBHnBBJdBDLBFBBPIBoB3KBJNBDMBEKBE4BBCFFBOBDLBFJBIyEBCmDBnghYffB+CB",!1)),Coptic:()=>new T(I("ifNxkKzDGG",!0)),Cuneiform:()=>new T(I("ggoC5cnDuDCEMjG",!0)),Cypriot:()=>new T(I("ggiCFBDCCBqBBCBBEDD",!1)),Cypro_Minoan:()=>new T(I("w8rCiD",!0)),Cyrillic:()=>new T(I("ggBkEBDoFBx6FKBhFtCtCojEfBhie-CBv8VBBhw4B9BBiBAB",!1)),Deseret:()=>new T(I("gghCvC",!0)),Devanagari:()=>new T(I("goCwCFODZh7nBfhwcJ",!0)),Dives_Akuru:()=>new T(I("gomCGBDDDBGBCBBCdBCBBDLBKJB",!1)),Dogra:()=>new T(I("ggmC7B",!0)),Duployan:()=>new T(I("ggvDqDGMEIIJDD",!0)),Egyptian_Hieroglyphs:()=>new T(I("ggsC1iBL68D",!0)),Elbasan:()=>new T(I("gohCnB",!0)),Elymaic:()=>new T(I("g-jCW",!0)),Ethiopic:()=>new T(I("gwEoCBCDBDGBCCCBCBDoBBCDBDgBBCDBDGBCCCBCBDOBC4BBCDBDiCBDfBEZBnvGWBKGBCGBCGBCGBCGBCGBCGBCGBjpfFBDFBDFBKGBCGBylvCGBCDBCBBCOB",!1)),Garay:()=>new T(I("gqjClBEcJB",!0)),Georgian:()=>new T(I("glElBBCGGDqBBCDBx8CqBBDCBhiElBBCGG",!1)),Glagolitic:()=>new T(I("ggL-Ch9sDGCQDGCBCE",!0)),Gothic:()=>new T(I("w5gCa",!0)),Grantha:()=>new T(I("g4kCDBCHBDBBDVBCGBCBBCEBDIBDBBDCBDHHGGBDGBEEB",!1)),Greek:()=>new T(I("wbDBCCBDDBCFFCCCBBBCCCBSBC+BBPPBnpGEBzBEBFEB1ChKhKBUBDFBDlBBDFBDHBCGCBdBD0BBCOBCNBDFBCSBDCBCIBoJ-xiB-xiB7uVuCBSgj0Bgj0BBkCB",!1)),Gujarati:()=>new T(I("h0CCBCIBCCBCVBCGBCBBCEBDJBCCBCCBDQQBCBDLBIGB",!1)),Gunjala_Gondi:()=>new T(I("grnCFCBCkBCBCFIJ",!0)),Gurmukhi:()=>new T(I("hwCCBCFBFBBDVBCGBCBBCBBCBBDCCBDBFBBDCBEIIBCBCIIBPB",!1)),Gurung_Khema:()=>new T(I("go4C5B",!0)),Han:()=>new T(I("g0LZBC4CBN1GBwBCCaIBPDBle-tGBhC-vUBhoWtLBDpDBpodBBNGBqgkB-2pBBhB9oEBDt0FBDwpHBQtTBjtC9QBjvBq6EBGppIB",!1)),Hangul:()=>new T(I("goE-HvxHBiI9CyDeiCei3dckUj9KNWFwBl9JeEFDFDFDC",!0)),Hanifi_Rohingya:()=>new T(I("gojCnBJJ",!0)),Hanunoo:()=>new T(I("g5FU",!0)),Hatran:()=>new T(I("gniCSCBGE",!0)),Hebrew:()=>new T(I("xsB2BBJaBFFBpp9BZBCEBCCCBCCBCCBIB",!1)),Hiragana:()=>new T(I("hiM1CBHCBi7-C+IBTeeBBBulQAB",!1)),Imperial_Aramaic:()=>new T(I("giiCVCI",!0)),Inherited:()=>new T(I("gYvDB2IBBlOKBbhXhXBCB8qEtBBDLBlPCBCMBCGBFHHEBBnG-BBtQBBjGgBB65DDBsDBBmrzBPBRNBwejHjH7iEl+uBl+uBBsBBDWBhRCBSHBDGBfDBz6rYvHB",!1)),Inscriptional_Pahlavi:()=>new T(I("g7iCSGH",!0)),Inscriptional_Parthian:()=>new T(I("g6iCVDH",!0)),Javanese:()=>new T(I("gsqBtCDJFB",!0)),Kaithi:()=>new T(I("gkkCiCLA",!0)),Kannada:()=>new T(I("gkDMCCCWCJCEDICCCDIBGCCDDJCC",!0)),Katakana:()=>new T(I("hlM5CBDCBxHPBxGuBBC3CBvgzBJBCsBBzisBDBCGBCBBCgJgJBBBzBPPBCB",!1)),Kawi:()=>new T(I("g4nCQCoBEc",!0)),Kayah_Li:()=>new T(I("goqBtBCA",!0)),Kharoshthi:()=>new T(I("gwiCDCBGHCCCcDCFJII",!0)),Khitan_Small_Script:()=>new T(I("k-7C84G84GB0OBqBAB",!1)),Khmer:()=>new T(I("g8F9CDJHJnPf",!0)),Khojki:()=>new T(I("gwkCRCuB",!0)),Khudawadi:()=>new T(I("w1kC6BGJ",!0)),Kirat_Rai:()=>new T(I("gq7C5B",!0)),Lao:()=>new T(I("h0DBBCCCBDBCXBCCCBVBDEBCCCBFBCJBDDB",!1)),Latin:()=>new T(I("hCZBHZBwBQQGWBCeBCgOBoBEB8wGlBBHwBBGDBGMBClCBiC-HByLOORMBuEBBHccSoBB42CfBj1elDBExCBVOBxZqBBCIBCDB38TGB7gBZBHZBmhCFBCpBBCIBm61BeBHFB",!1)),Lepcha:()=>new T(I("ggH3BEOEC",!0)),Limbu:()=>new T(I("goGeBCLBFLBFEEBKB",!1)),Linear_A:()=>new T(I("gwhC2JKVLH",!0)),Linear_B:()=>new T(I("gggCLCZCSCBCODNjB6D",!0)),Lisu:()=>new T(I("wmpBvBx1eA",!0)),Lycian:()=>new T(I("g0gCc",!0)),Lydian:()=>new T(I("gpiCZGA",!0)),Mahajani:()=>new T(I("wqkCmB",!0)),Makasar:()=>new T(I("g3nCY",!0)),Malayalam:()=>new T(I("goDMCCCyBCCCFFPDZ",!0)),Mandaic:()=>new T(I("giCbDA",!0)),Manichaean:()=>new T(I("g2iCmBFL",!0)),Marchen:()=>new T(I("wjnCfDVCN",!0)),Masaram_Gondi:()=>new T(I("gonCGBCBBCrBBECCBCCBHBJJB",!1)),Medefaidrin:()=>new T(I("gy7C6C",!0)),Meetei_Mayek:()=>new T(I("g3qBWqGtBDJ",!0)),Mende_Kikakui:()=>new T(I("gg6DkGDP",!0)),Meroitic_Cursive:()=>new T(I("gtiCXFTDtB",!0)),Meroitic_Hieroglyphs:()=>new T(I("gsiCf",!0)),Miao:()=>new T(I("g47CqCF4BIQ",!0)),Modi:()=>new T(I("gwlCkCMJ",!0)),Mongolian:()=>new T(I("ggGBBDCCBSBH4CBIqBB2t-BMB",!1)),Mro:()=>new T(I("gy6CeCJFB",!0)),Multani:()=>new T(I("g0kCGBCCCBCBCOBCKB",!1)),Myanmar:()=>new T(I("ggE-EhqmBeiDfxibT",!0)),Nabataean:()=>new T(I("gkiCeJI",!0)),Nag_Mundari:()=>new T(I("wm5DpB",!0)),Nandinagari:()=>new T(I("gtmCHDtBDK",!0)),New_Tai_Lue:()=>new T(I("gsGrBFZHKEB",!0)),Newa:()=>new T(I("gglC7CCE",!0)),Nko:()=>new T(I("g+B6BDC",!0)),Nushu:()=>new T(I("h-7CvsQvsQBqMB",!1)),Nyiakeng_Puachue_Hmong:()=>new T(I("go4DsBENDJFB",!0)),Ogham:()=>new T(I("g0Fc",!0)),Ol_Chiki:()=>new T(I("wiHvB",!0)),Ol_Onal:()=>new T(I("wu5DqBFA",!0)),Old_Hungarian:()=>new T(I("gkjCyBOyBIF",!0)),Old_Italic:()=>new T(I("g4gCjBKC",!0)),Old_North_Arabian:()=>new T(I("g0iCf",!0)),Old_Permic:()=>new T(I("w6gCqB",!0)),Old_Persian:()=>new T(I("g9gCjBFN",!0)),Old_Sogdian:()=>new T(I("g4jCnB",!0)),Old_South_Arabian:()=>new T(I("gziCf",!0)),Old_Turkic:()=>new T(I("ggjCoC",!0)),Old_Uyghur:()=>new T(I("w7jCZ",!0)),Oriya:()=>new T(I("h4CCCHDBDVCGCBCEDIDBDCICFBCEDR",!0)),Osage:()=>new T(I("wlhCjBFjB",!0)),Osmanya:()=>new T(I("gkhCdDJ",!0)),Pahawh_Hmong:()=>new T(I("g46ClCLJCGCUGS",!0)),Palmyrene:()=>new T(I("gjiCf",!0)),Pau_Cin_Hau:()=>new T(I("g2mC4B",!0)),Phags_Pa:()=>new T(I("giqB3B",!0)),Phoenician:()=>new T(I("goiCbEA",!0)),Psalter_Pahlavi:()=>new T(I("g8iCRIDNG",!0)),Rejang:()=>new T(I("wpqBjBMA",!0)),Runic:()=>new T(I("g1FqCEK",!0)),Samaritan:()=>new T(I("ggCtBDO",!0)),Saurashtra:()=>new T(I("gkqBlCJL",!0)),Sharada:()=>new T(I("gskC-ChsCH",!0)),Shavian:()=>new T(I("wihCvB",!0)),Siddham:()=>new T(I("gslC1BDlB",!0)),Sidetic:()=>new T(I("gqiCZ",!0)),SignWriting:()=>new T(I("gg2DrUQECO",!0)),Sinhala:()=>new T(I("hsDCBCRBEXBCIBCDDBFBEFFBEBCCCBGBHJBDCBt-gCTB",!1)),Sogdian:()=>new T(I("w5jCpB",!0)),Sora_Sompeng:()=>new T(I("wmkCYIJ",!0)),Soyombo:()=>new T(I("wymCyC",!0)),Sundanese:()=>new T(I("g8G-BhIH",!0)),Sunuwar:()=>new T(I("g+mChBPJ",!0)),Syloti_Nagri:()=>new T(I("ggqBsB",!0)),Syriac:()=>new T(I("g4BNC7BDCxIK",!0)),Tagalog:()=>new T(I("g4FVKA",!0)),Tagbanwa:()=>new T(I("g7FMCCCB",!0)),Tai_Le:()=>new T(I("wqGdDE",!0)),Tai_Tham:()=>new T(I("gxG+BCcDKHJHN",!0)),Tai_Viet:()=>new T(I("g0qBiCZE",!0)),Tai_Yo:()=>new T(I("g25DeCVJB",!0)),Takri:()=>new T(I("g0lC5BHJ",!0)),Tamil:()=>new T(I("i8CBBCFBECBCDBEBBCCCBEEBEEBBBELBFEBECBCDBDHHPUBm+kCxBBOAB",!1)),Tangsa:()=>new T(I("wz6CuCCJ",!0)),Tangut:()=>new T(I("g-7CgBgBB+3GBhQeBiDyDB",!1)),Telugu:()=>new T(I("ggDMCCCWCPDICCCDIBCCCBDDDJII",!0)),Thaana:()=>new T(I("g8BxB",!0)),Thai:()=>new T(I("hwD5BGb",!0)),Tibetan:()=>new T(I("g4DnCCjBFmBCjBCOCGFB",!0)),Tifinagh:()=>new T(I("wpL3BIBPA",!0)),Tirhuta:()=>new T(I("gklCnCJJ",!0)),Todhri:()=>new T(I("guhCzB",!0)),Tolong_Siki:()=>new T(I("wtnCrBFJ",!0)),Toto:()=>new T(I("w04De",!0)),Tulu_Tigalari:()=>new T(I("g8kCJBCDDClBBCJBCDDCDBCJBCBBJBB",!1)),Ugaritic:()=>new T(I("g8gCdCA",!0)),Unknown:()=>new T(I("4bBBHDBICCVuMuMnBBBzBBBE4B4BBGBcDBHKBvI9B9BBmDmDBMB8BBByBBBQddBCCMEBjBEBuHJJBDDBXXICCBBBFBBKBBDBBFHBCDBDGGBaaBEEHDBDBBXIIDGDBCCGDBDBBECBCGBFCCBFBSJBEKKEXXIDDGBBLIEBCCBNBFBBNGBIEEJBBDBBXIIDGGBKKBDDBEEBFBEDBDGGBTTBIBDHHBBBEFFBBBDCCDCBDCBECBNDBGCBEFFBCCBEBCNBWEBOEEYRRBKKEFFBFBDEEDBBFBBLGBXEEYLLGBBKEEFGBDEBEFFBLLELBOEE0BEEHDBRBBbEETCBZKKCBBICBCDBHCCJFBLBBELB7BDBekBBDCCGZZCYYBGGCIILBBFfBpClBlBBCBoBlBlBQOOBjBBnGCCBDBCBB6LFFBIICFFBqBqBFBBiBFFBIICFFBQQ6BFFBkCkCBhBhBBBBbFB3CBBHBB+UCB6CGBXIBZIBVLBOEEDLB-CBBLFBLFBbFB6CGBsBEBnCJBgBNNBCBNDBCCBrBBBGKBtBDBbFBMCB-BBBiCeeBMMBEBLFBPBBvBBBNTBuCnFnFBGB9BCBQCB-BEBsBBBMHBsBEB3QBBHBBnBBBHBBJGCgBBB2BQQPBBHUUBEEKmDmDNBBcOOBBBjBNBiBOBtEDB7UVBMUB14BBB-LEBuBCCBDBCBB5BGBDNBZIBI4BI-DhBBb6C6CBKB3GZBxC3C3CBoDoDBDBsB-C-C3CIBxBuzcuzcBBB4BIB9KTB5FHB+GTB9BCBLFB5BHBnCHBNFB1DKBfCBvCMMBCBiB4B4BBHBPBBLBBoDXBdJBHBBHBBHIBIII9BDB-DBBLFBl9KLBYDByBjoIBvLBBrDlBBILBGEBbGGCGDrUfBrBFB0BUUFDBGoEoEBCC-FCBHBBHBBHBBECBIIIBIBGBBNbbUDDQBBPhBB8DEBEDBuBCB5COOBBBCuBBvBhEBeCByBOBdDBlBIBfEBsBEBfmBmBBCBPpBB-EBBLFBlBDBlBDBpBHB1BKBNQQIDDMQQIDDBBB1BLB4JIBXJBJXBHrBrBKkCBHBBCtBtBDCBCBBYpCpCBGBKvBBUDDBDBiBCBcEBclBB5BDBVBBzBDDBDBJEEeBBEDBLGBKGBhCfBoBDBNIB3BCBeBBcEBbGBFLBIvCBqC2BB0BMB0BGBvBHBLFBnBCBeHBDvGBgBrBrBEBBDPBHHBKgBBvBHBrBVBblBBdTBYIBvCDBlBIBlCJBCBBaGBLFB2BTTBGBoBIBhDVVBJBTwBwBB8BBICCFQQMFB8BEBLFBFJJBDDBXXIDDGLLBDDBEEBCCBEBCEBIBBICBGKBLCCBCCnBLLCBBCFFLDDBGBDcB9CGGBcBpCHBLlFB3BBBnBhBBmCKBLFBOSB7BFBLFBVbBcBBQDBY4FB9BjDB0CLBJBBCBBJDDfDDBNNBHBLlCBJBBvBBBMaBpCHB0CMBqCGBL1CBJ3CBjBNBLFBKuBuBPJBeCBhBBBXPPBnCBIDDtBCBCDDKHBLFBHDDmBDDHGBLFBtBDBL1HBaGBSqBqBBBBe0CBCOBzBMB8clDBwDGGBJBlGryCBkDMB3iBJB88DEBoS41GB7Bl2BB6RGBgBLLBCByCLLBEBfBBHJBnCJBLIIWEBUvNB7BlGB8CEBaBBarBBsCDB6BGBS-BBGKBIIB3mHoBBhBgDB0D8vIBFIIDkJkJBNBCcBEBBCNBFHBtMjoCBsDEBOCBKGBLBBJ76DB+HCB1NFBYOBSOBvBBBYIB1D7BB3HJBoBBBjGUBnC5DBVLBVLB4CIBamEB2CoCoCDBBCBBDBBFNNCIIiCFFBJJIddFGGCCBI1K1KBlJlJB-V-VBNBGQQBuiBBgBFBH0GBISSBIIDGGBDB-BgBBCvDBuBCBPBBLDBD-JBgBQB7BEBCvOBrB1GBsBDBC-FBgBXXBGBD-GBIFFDQQmGBBRoBBtCDBLDBDwYBlCrCB+BhGBFccDCCBCCLFFCCCBEBCDBCECEDDCBBCICDCCBFFIKFCLLSEBEGGSzBBDtIBtBDBlDLBQBBQQQmBJBvF3BBeMBtBDBKGBDNBH5EB6eCBSCBOCB7GFBNDBCOBNDB5BHBLFBpBHBfBBNDBDNBKmBB5KHBPBBOCBMCB6BCCBCBRBBNDBLGB0EoDoDBjgBBh3pBfB-oEBBv0FBBypHOBvThtCB-QhvBBs6EEBrpIm8yVBCdBhD-DBxHvw-FB",!1)),Vai:()=>new T(I("gopBrJ",!0)),Vithkuqi:()=>new T(I("wrhCKCOCGCBCKCOCGCB",!0)),Wancho:()=>new T(I("g24D5BGA",!0)),Warang_Citi:()=>new T(I("glmCyCNA",!0)),Yezidi:()=>new T(I("g0jCpBCCDB",!0)),Yi:()=>new T(I("ggoBskBE2B",!0)),Zanabazar_Square:()=>new T(I("gwmCnC",!0))});static FOLD_CATEGORIES=new zc({L:()=>new T(I("laA",!0)),LC:()=>new T(I("laA",!0)),Ll:()=>new T(I("hCZBmDWBCGBiBuBCEECDOCDuBCBECEBBCCCBCCBBBDDBCBBCCBEBBCBBCECBCCDCCBCCBBBCCCBEEIBBCBBCBBCOCDQCDBBCCCBBBC4BCIBBCBBDCCBCBCGC3HrBrBCEEJHHCCBCCCBCCBPBCIBkBJJCUCGDDCBBDyBBxBgBCK2BCBMCD+CCDlBBq6ClBBCGGzW1CB0kCHHBpBBDCBhK0ECKgDCKHBJFBLHBJHBJFBMGCJHBZHBJHBJHBJEBMEBMDBNEBMEBqJEEBHHxC9zC9zCBuBBxBCCBBBDGCBCBCDDJCBCgDCJCCFuqeuqeCqBCUaCoEMCE8BCLECBICFCCDCCEUCBDBCEBCOCBCBCCCBQCZs5Vs5VBYBmmBnBBpEjBB9EKBCOBCGBCBBr3ByBB+EVB75CfBhsVfBhCYBoyehBB",!1)),Lt:()=>new T(I("kOCCBCCBCClBCCtsHHBJHBJHBMQQwBAB",!1)),Lu:()=>new T(I("hDZB7BqBqBBWBCHBCuBCEECDOCDsBCDECBBBDCCDEEGDDECBDDDCCCDFFDEECDDECCGBBCBBCBBCOCBSCDBBCEECkBCEQCJDDBCCFICBEBCBBCCCBEEBCCBCBCEBDCCBDDIDDCBBEFBGLLBnFnFsBCCEEEBBBvBDBCdBCBBECBCWCBDBCGD1BvBBCgBCK0BCDMCBgDCyBlBBq6CqBBDCB5XFBjkCIBCvHvHERRzD0ECGGGC8CCBHBJFBLHBJHBJFBMGCJHBJNBzBBBNSSBPPBEEpL2B2Bs1CvBBCEEBGCHDDLiDCJCCFNNBkBBCGG0oesBCUaCoEMCE8BCLCCDICFFFCBBDSCMOCFCCDOCb9a9advCBi8UZBumBnBBpEjBB8EKBCOBCGBCBBk4ByBB+DVB75CfBhsVfB8BYBvyehBB",!1)),M:()=>new T(I("5cgBgBlgHAB",!1)),Mn:()=>new T(I("5cgBgBlgHAB",!1)),Emoji:()=>new T(I("8mJA",!0)),Extended_Pictographic:()=>new T(I("8mJA",!0)),Lowercase:()=>new T(I("hCZBmDWBCGBiBuBCEECDOCDuBCBECEBBCCCBCCBBBDDBCBBCCBEBBCBBCECBCCDCCBCCBBBCCCBEEIBBCBBCBBCOCDQCDBBCCCBBBC4BCIBBCBBDCCBCBCGCiJCCEJJHCCBBBCCCBCCBPBCIBkBJJCUCGDDCBBDyBBxBgBCK2BCBMCD+CCDlBBq6ClBBCGGzW1CB0kCHHBpBBDCBhK0ECKgDCKHBJFBLHBJHBJFBMGCJHBZHBJHBJHBJEBMEBMDBNEBMEBqJEEBHHuBPBUzZzZBYBx5BvBBxBCCBBBDGCBCBCDDJCBCgDCJCCFuqeuqeCqBCUaCoEMCE8BCLECBICFCCDCCEUCBDBCEBCOCBCBCCCBQCZs5Vs5VBYBmmBnBBpEjBB9EKBCOBCGBCBBr3ByBB+EVB75CfBhsVfBhCYBoyehBB",!1)),Math:()=>new T(I("ycGDCHHFMMDDDCHHFAB",!1)),Uppercase:()=>new T(I("hDZB7BqBqBBWBCHBCuBCEECDOCDsBCDECBBBDCCDEEGDDECBDDDCCCDFFDEECDDECCGBBCBBCBBCOCBSCDBBCEECkBCEQCJDDBCCFICBEBCBBCCCBEEBCCBCBCEBDCCBDDIDDCBBEFBGLLBnFnFsBCCEEEBBBvBDBCdBCBBECBCWCBDBCGD1BvBBCgBCK0BCDMCBgDCyBlBBq6CqBBDCB5XFBjkCIBCvHvHERRzD0ECGGGC8CCBHBJFBLHBJHBJFBMGCJHBJNBzBBBNSSBPPBEEpLiBiBBOBFsasaBYBn6BvBBCEEBGCHDDLiDCJCCFNNBkBBCGG0oesBCUaCoEMCE8BCLCCDICFFFCBBDSCMOCFCCDOCb9a9advCBi8UZBumBnBBpEjBB8EKBCOBCGBCBBk4ByBB+DVB75CfBhsVfB8BYBvyehBB",!1))});static FOLD_SCRIPT=new zc({Common:()=>new T(I("8cgBgB",!1)),Greek:()=>new T(I("1FwUwU",!1)),Inherited:()=>new T(I("5cgBgBlgHAB",!1))})},ce=class Jt{static MAX_RUNE=1114111;static RUNE_ERROR=65533;static isUnsearchable(t){return t===Jt.RUNE_ERROR||t>=Jt.MIN_HIGH_SURROGATE&&t<=Jt.MAX_LOW_SURROGATE}static MAX_ASCII=127;static MAX_LATIN1=255;static MAX_BMP=65535;static MIN_FOLD=65;static MAX_FOLD=125251;static MIN_HIGH_SURROGATE=55296;static MAX_HIGH_SURROGATE=56319;static MIN_LOW_SURROGATE=56320;static MAX_LOW_SURROGATE=57343;static MIN_SUPPLEMENTARY_CODE_POINT=65536;static is32(t,n){let r=0,s=t.length;for(;r<s;){const i=r+Math.floor((s-r)/2),o=t.getLo(i),a=t.getHi(i);if(o<=n&&n<=a){const l=t.getStride(i);return(n-o)%l===0}n<o?s=i:r=i+1}return!1}static is(t,n){if(n<=Jt.MAX_LATIN1){for(let r=0;r<t.length;r++){if(n>t.getHi(r))continue;const s=t.getLo(r);if(n<s)return!1;const i=t.getStride(r);return(n-s)%i===0}return!1}return t.length>0&&n>=t.getLo(0)&&Jt.is32(t,n)}static isUpper(t){if(t<=Jt.MAX_LATIN1){const n=String.fromCodePoint(t);return n.toUpperCase()===n&&n.toLowerCase()!==n}return Jt.is(an.Upper,t)}static isPrint(t){return t<=Jt.MAX_LATIN1?t>=32&&t<Jt.MAX_ASCII||t>=161&&t!==173:Jt.is(an.Print,t)}static simpleFold(t){if(an.CASE_ORBIT.has(t))return an.CASE_ORBIT.get(t);const n=U.toLowerCase(t);return n!==t?n:U.toUpperCase(t)}static equalsIgnoreCase(t,n){if(t===n)return!0;if(t<0||n<0)return!1;if(t<=Jt.MAX_ASCII&&n<=Jt.MAX_ASCII)return 65<=t&&t<=90&&(t|=32),65<=n&&n<=90&&(n|=32),t===n;for(let r=Jt.simpleFold(t);r!==t;r=Jt.simpleFold(r))if(r===n)return!0;return!1}},HC=256,DA=new Uint8Array(HC);for(let e=0;e<HC;e++)DA[e]=97<=e&&e<=122||65<=e&&e<=90||48<=e&&e<=57||e===95?1:0;var qf=null,Kf=null,me=class yn{static METACHARACTERS="\\.+*?()|[]{}^$";static EMPTY_BEGIN_LINE=1;static EMPTY_END_LINE=2;static EMPTY_BEGIN_TEXT=4;static EMPTY_END_TEXT=8;static EMPTY_WORD_BOUNDARY=16;static EMPTY_NO_WORD_BOUNDARY=32;static EMPTY_ALL=-1;static emptyInts(){return[]}static isByteArray(t){return Array.isArray(t)||Object.prototype.toString.call(t)==="[object Uint8Array]"}static isalnum(t){return U.CODES.get("0")<=t&&t<=U.CODES.get("9")||U.CODES.get("a")<=t&&t<=U.CODES.get("z")||U.CODES.get("A")<=t&&t<=U.CODES.get("Z")}static unhex(t){return U.CODES.get("0")<=t&&t<=U.CODES.get("9")?t-U.CODES.get("0"):U.CODES.get("a")<=t&&t<=U.CODES.get("f")?t-U.CODES.get("a")+10:U.CODES.get("A")<=t&&t<=U.CODES.get("F")?t-U.CODES.get("A")+10:-1}static escapeRune(t){let n="";if(ce.isPrint(t))yn.METACHARACTERS.indexOf(String.fromCodePoint(t))>=0&&(n+="\\"),n+=String.fromCodePoint(t);else switch(t){case U.CODES.get('"'):n+='\\"';break;case U.CODES.get("\\"):n+="\\\\";break;case U.CODES.get(" "):n+="\\t";break;case U.CODES.get(`
|
|
45
|
+
`):n+="\\n";break;case U.CODES.get("\r"):n+="\\r";break;case U.CODES.get("\b"):n+="\\b";break;case U.CODES.get("\f"):n+="\\f";break;default:{let r=t.toString(16);t<256?(n+="\\x",r.length===1&&(n+="0"),n+=r):n+=`\\x{${r}}`;break}}return n}static stringToRunes(t){const n=String(t),r=[];let s=0;for(;s<n.length;){const i=n.codePointAt(s);r.push(i),s+=i>ce.MAX_BMP?2:1}return new Int32Array(r)}static runeToString(t){return String.fromCodePoint(t)}static isWordRune(t){return t<HC?DA[t]===1:!1}static emptyOpContext(t,n){let r=0;return t<0&&(r|=yn.EMPTY_BEGIN_TEXT|yn.EMPTY_BEGIN_LINE),t===10&&(r|=yn.EMPTY_BEGIN_LINE),n<0&&(r|=yn.EMPTY_END_TEXT|yn.EMPTY_END_LINE),n===10&&(r|=yn.EMPTY_END_LINE),yn.isWordRune(t)!==yn.isWordRune(n)?r|=yn.EMPTY_WORD_BOUNDARY:r|=yn.EMPTY_NO_WORD_BOUNDARY,r}static quoteMeta(t){return t.split("").map(n=>yn.METACHARACTERS.indexOf(n)>=0?`\\${n}`:n).join("")}static charCount(t){return t>ce.MAX_BMP?2:1}static toArray(t){const n=t.length,r=new Array(n);for(let s=0;s<n;s++)r[s]=t[s];return r}static stringToUtf8ByteArray(t){if(globalThis.TextEncoder)return qf||(qf=new TextEncoder),qf.encode(t);{let n=[],r=0;for(let s=0;s<t.length;s++){let i=t.charCodeAt(s);i<128?n[r++]=i:i<2048?(n[r++]=i>>6|192,n[r++]=i&63|128):(i&64512)===ce.MIN_HIGH_SURROGATE&&s+1<t.length&&(t.charCodeAt(s+1)&64512)===ce.MIN_LOW_SURROGATE?(i=ce.MIN_SUPPLEMENTARY_CODE_POINT+((i&1023)<<10)+(t.charCodeAt(++s)&1023),n[r++]=i>>18|240,n[r++]=i>>12&63|128,n[r++]=i>>6&63|128,n[r++]=i&63|128):(n[r++]=i>>12|224,n[r++]=i>>6&63|128,n[r++]=i&63|128)}return n}}static utf8ByteArrayToString(t){if(globalThis.TextDecoder){Kf||(Kf=new TextDecoder("utf-8"));const n=t instanceof Uint8Array?t:new Uint8Array(t);return Kf.decode(n)}else{let n=[],r=0,s=0;for(;r<t.length;){let i=t[r++];if(i<128)n[s++]=String.fromCharCode(i);else if(i>191&&i<224){let o=t[r++];n[s++]=String.fromCharCode((i&31)<<6|o&63)}else if(i>239&&i<365){let o=t[r++],a=t[r++],l=t[r++],c=((i&7)<<18|(o&63)<<12|(a&63)<<6|l&63)-ce.MIN_SUPPLEMENTARY_CODE_POINT;n[s++]=String.fromCharCode(ce.MIN_HIGH_SURROGATE+(c>>10)),n[s++]=String.fromCharCode(ce.MIN_LOW_SURROGATE+(c&1023))}else{let o=t[r++],a=t[r++];n[s++]=String.fromCharCode((i&15)<<12|(o&63)<<6|a&63)}}return n.join("")}}},TA=(e=[],t=0)=>{const n=Object.create(null);for(let r=0;r<e.length;r++){const s=e[r],i=t+r;n[s]=i,n[i]=s}return Object.freeze(n)},Pi=class Gp{static Encoding=TA(["UTF_16","UTF_8"]);getEncoding(){throw Error("not implemented")}asCharSequence(){throw Error("not implemented")}asBytes(){throw Error("not implemented")}length(){throw Error("not implemented")}isUTF8Encoding(){return this.getEncoding()===Gp.Encoding.UTF_8}isUTF16Encoding(){return this.getEncoding()===Gp.Encoding.UTF_16}},fb=class extends Pi{constructor(e=null){super(),this.bytes=e}getEncoding(){return Pi.Encoding.UTF_8}asCharSequence(){return me.utf8ByteArrayToString(this.bytes)}asBytes(){return this.bytes}length(){return this.bytes.length}},_4=class extends Pi{constructor(e=null){super(),this.charSequence=e}getEncoding(){return Pi.Encoding.UTF_16}asCharSequence(){return this.charSequence}asBytes(){return me.stringToUtf8ByteArray(this.charSequence.toString())}length(){return this.charSequence.length}},vi=class{static utf16(e){return new _4(e)}static utf8(e){return me.isByteArray(e)?new fb(e):new fb(me.stringToUtf8ByteArray(e))}},nn=class{static EOF(){return-8}constructor(){this.end=0}canCheckPrefix(){return!0}endPos(){return this.end}hasString(){return!1}hasAnyString(){return!1}prefixLength(){return 0}},F4=class so extends nn{static RUNE_ERROR_STEP=ce.RUNE_ERROR<<3|1;constructor(t,n=0,r=t.length){super(),this.bytes=t,this.start=n,this.end=r}hasString(t,n){const r=t.bytes;if(r.length===0)return!0;const s=this.indexOf(this.bytes,r,this.start+n);return s!==-1&&s<=this.end-r.length}hasAnyString(t,n){return t.automaton8().searchUTF8(this.bytes,this.start+n,this.end)}step(t){if(t+=this.start,t>=this.end)return nn.EOF();const n=this.bytes[t]&255;if(n<128)return n<<3|1;let r,s,i=128,o=191;if(n>=194&&n<=223)r=2,s=n&31;else if(n>=224&&n<=239)r=3,s=n&15,n===224?i=160:n===237&&(o=159);else if(n>=240&&n<=244)r=4,s=n&7,n===240?i=144:n===244&&(o=143);else return so.RUNE_ERROR_STEP;if(t+r>this.end)return so.RUNE_ERROR_STEP;const a=this.bytes[t+1]&255;if(a<i||a>o)return so.RUNE_ERROR_STEP;if(s=s<<6|a&63,r>2){const l=this.bytes[t+2]&255;if((l&192)!==128)return so.RUNE_ERROR_STEP;if(s=s<<6|l&63,r>3){const c=this.bytes[t+3]&255;if((c&192)!==128)return so.RUNE_ERROR_STEP;s=s<<6|c&63}}return s<<3|r}index(t,n){n+=this.start;const r=this.indexOf(this.bytes,t.prefixUTF8,n);return r<0?r:r-n}context(t){t+=this.start;let n=-1;if(t>this.start&&t<=this.end){let s=t-1;if(n=this.bytes[s--],n>=128){let i=t-4;for(i<this.start&&(i=this.start);s>=i&&(this.bytes[s]&192)===128;)s--;s<this.start&&(s=this.start),n=this.step(s-this.start)>>3}}const r=t<this.end?this.step(t-this.start)>>3:-1;return me.emptyOpContext(n,r)}indexOf(t,n,r=0){let s=n.length;if(s===0)return r<=this.end?r:-1;const i=n[0];let o=this.end-s;const a=typeof t.indexOf=="function";let l=r;for(;l<=o;){if(a){if(l=t.indexOf(i,l),l===-1||l>o)return-1}else{for(;l<=o&&t[l]!==i;)l++;if(l>o)return-1}let c=!0;for(let u=1;u<s;u++)if(t[l+u]!==n[u]){c=!1;break}if(c)return l;l++}return-1}prefixLength(t){return t.prefixUTF8.length}},H4=class extends nn{constructor(e,t=0,n=e.length){super(),this.charSequence=e,this.start=t,this.end=n}hasString(e,t){const n=this.charSequence.indexOf(e.str,this.start+t);return n!==-1&&n<=this.end-e.str.length}hasAnyString(e,t){return e.automaton16().searchUTF16(this.charSequence,this.start+t,this.end)}step(e){if(e+=this.start,e>=this.end)return nn.EOF();const t=this.charSequence.charCodeAt(e);if(t<ce.MIN_HIGH_SURROGATE||t>ce.MAX_HIGH_SURROGATE||e+1>=this.end)return t<<3|1;const n=this.charSequence.charCodeAt(e+1);return n>=ce.MIN_LOW_SURROGATE&&n<=ce.MAX_LOW_SURROGATE?(t-ce.MIN_HIGH_SURROGATE)*1024+(n-ce.MIN_LOW_SURROGATE)+ce.MIN_SUPPLEMENTARY_CODE_POINT<<3|2:t<<3|1}index(e,t){t+=this.start;const n=this.charSequence.indexOf(e.prefix,t);return n<0||n>this.end-e.prefix.length?-1:n-t}context(e){e+=this.start;const t=e>this.start&&e<=this.end?this.charSequence.charCodeAt(e-1):-1,n=e<this.end?this.charSequence.charCodeAt(e):-1;return me.emptyOpContext(t,n)}prefixLength(e){return e.prefix.length}},$e=class{static fromUTF8(e,t=0,n=e.length){return new F4(e,t,n)}static fromUTF16(e,t=0,n=e.length){return new H4(e,t,n)}},uc=class extends Error{constructor(e){super(e),this.name="RE2JSException"}},Ke=class extends uc{constructor(e,t=null){let n=`error parsing regexp: ${e}`;t&&(n+=`: \`${t}\``),super(n),this.name="RE2JSSyntaxException",this.message=n,this.error=e,this.input=t}getDescription(){return this.error}getPattern(){return this.input}},Qa=class extends uc{constructor(e){super(e),this.name="RE2JSCompileException"}},on=class extends uc{constructor(e){super(e),this.name="RE2JSGroupException"}},j4=class extends uc{constructor(e){super(e),this.name="RE2JSFlagsException"}},Ya=class extends uc{constructor(e){super(e),this.name="RE2JSInternalException"}},Bb=class AA{static MAX_REPLACER_ARGS=65535;static quoteReplacement(t,n=!1){return n?t.indexOf("\\")<0&&t.indexOf("$")<0?t:t.split("").map(r=>{const s=r.codePointAt(0);return s===U.CODES.get("\\")||s===U.CODES.get("$")?`\\${r}`:r}).join(""):t.indexOf("$")<0?t:t.split("").map(r=>r.codePointAt(0)===U.CODES.get("$")?"$$":r).join("")}constructor(t,n){if(t===null)throw new Error("pattern is null");this.patternInput=t;const r=this.patternInput.re2();this.patternGroupCount=r.numberOfCapturingGroups(),this.groups=[],this.namedGroups=r.namedGroups,this.numberOfInstructions=r.numberOfInstructions(),this.lookbehindState=null,n instanceof Pi?this.resetMatcherInput(n):me.isByteArray(n)?this.resetMatcherInput(vi.utf8(n)):this.resetMatcherInput(vi.utf16(n))}pattern(){return this.patternInput}reset(){return this.matcherInputLength=this.matcherInput.length(),this.appendPos=0,this.hasMatch=!1,this.hasGroups=!1,this.anchorFlag=0,this}resetMatcherInput(t){if(t===null)throw new Error("input is null");return t instanceof Pi||(me.isByteArray(t)?t=vi.utf8(t):t=vi.utf16(t)),this.matcherInput=t,this.lookbehindState!==null?this.lookbehindState.reset():this.lookbehindState=this.patternInput.re2().createLookbehindState(),this.reset(),this}start(t=0){if(typeof t=="string"){const n=this.namedGroups[t];if(!Number.isFinite(n))throw new on(`group '${t}' not found`);t=n}return this.loadGroup(t),this.groups[2*t]}end(t=0){if(typeof t=="string"){const n=this.namedGroups[t];if(!Number.isFinite(n))throw new on(`group '${t}' not found`);t=n}return this.loadGroup(t),this.groups[2*t+1]}programSize(){return this.numberOfInstructions}group(t=0){if(typeof t=="string"){const s=this.namedGroups[t];if(!Number.isFinite(s))throw new on(`group '${t}' not found`);t=s}const n=this.start(t),r=this.end(t);return n<0&&r<0?null:this.substring(n,r)}getNamedGroups(){if(!this.hasMatch)throw new on("perhaps no match attempted");const t=Object.create(null);for(const n of Object.keys(this.namedGroups))t[n]=this.group(n);return t}groupCount(){return this.patternGroupCount}loadGroup(t){if(!Number.isInteger(t)||t<0||t>this.patternGroupCount)throw new on(`Group index out of bounds: ${t}`);if(!this.hasMatch)throw new on("perhaps no match attempted");if(t===0||this.hasGroups)return;const n=this.matcherInputLength,r=this.patternInput.re2().matchMachineInput(this.matcherInput,this.groups[0],n,this.anchorFlag,1+this.patternGroupCount,this.lookbehindState);if(!r[0])throw new on("inconsistency in matching group data");this.groups=r[1],this.hasGroups=!0}matches(){return this.genMatch(0,$.ANCHOR_BOTH)}lookingAt(){return this.genMatch(0,$.ANCHOR_START)}find(t=null){if(t!==null){if(!Number.isInteger(t)||t<0||t>this.matcherInputLength)throw new on(`start index out of bounds: ${t}`);return this.reset(),this.genMatch(t,0)}if(t=0,this.hasMatch&&(t=this.groups[1],this.groups[0]===this.groups[1])){const n=(this.matcherInput.isUTF16Encoding()?$e.fromUTF16(this.matcherInput.asCharSequence(),0,this.matcherInputLength):$e.fromUTF8(this.matcherInput.asBytes(),0,this.matcherInputLength)).step(t);n<0?t++:t+=n&7}return this.genMatch(t,$.UNANCHORED)}genMatch(t,n){const r=this.patternInput.re2().matchMachineInput(this.matcherInput,t,this.matcherInputLength,n,1,this.lookbehindState);return r[0]?(this.groups=r[1],this.hasMatch=!0,this.hasGroups=this.patternGroupCount===0,this.anchorFlag=n,!0):(this.hasMatch=!1,!1)}substring(t,n){return this.matcherInput.isUTF8Encoding()?me.utf8ByteArrayToString(this.matcherInput.asBytes().slice(t,n)):this.matcherInput.asCharSequence().substring(t,n).toString()}inputLength(){return this.matcherInputLength}appendReplacement(t,n=!1){let r="";const s=this.start(),i=this.end();return this.appendPos<s&&(r+=this.substring(this.appendPos,s)),this.appendPos=i,r+=n?this.appendReplacementInternalJava(t):this.appendReplacementInternalJs(t),r}appendReplacementInternalJava(t){let n="",r=0;const s=t.length;let i=0;for(;i<s;){const o=t.codePointAt(i);if(o===U.CODES.get("\\")){if(r<i&&(n+=t.substring(r,i)),i++,i>=s)throw new on("character to be escaped is missing");r=i,i++;continue}if(o===U.CODES.get("$")){if(r<i&&(n+=t.substring(r,i)),i+1>=s)throw new on("Illegal group reference: group index is missing");const a=t.codePointAt(i+1);if(U.CODES.get("0")<=a&&a<=U.CODES.get("9")){let l=a-U.CODES.get("0"),c=i+2;for(;c<s;c++){const d=t.codePointAt(c);if(d<U.CODES.get("0")||d>U.CODES.get("9")||l*10+d-U.CODES.get("0")>this.patternGroupCount)break;l=l*10+d-U.CODES.get("0")}if(l>this.patternGroupCount)throw new on(`n > number of groups: ${l}`);const u=this.group(l);u!==null&&(n+=u),i=c,r=i}else if(a===U.CODES.get("{")){let l=i+2;for(;l<s&&t.codePointAt(l)!==U.CODES.get("}");)l++;if(l>=s)throw new on("named capture group is missing trailing '}'");const c=t.substring(i+2,l),u=this.group(c);u!==null&&(n+=u),i=l+1,r=i}else throw new on("Illegal group reference");continue}i++}return r<s&&(n+=t.substring(r,s)),n}appendReplacementInternalJs(t){let n="",r=0;const s=t.length;for(let i=0;i<s-1;i++)if(t.codePointAt(i)===U.CODES.get("$")){let o=t.codePointAt(i+1);if(U.CODES.get("$")===o){r<i&&(n+=t.substring(r,i)),n+="$",i++,r=i+1;continue}else if(U.CODES.get("&")===o){r<i&&(n+=t.substring(r,i));const a=this.group(0);a!==null?n+=a:n+="$&",i++,r=i+1;continue}else if(U.CODES.get("`")===o){r<i&&(n+=t.substring(r,i)),n+=this.substring(0,this.start(0)),i++,r=i+1;continue}else if(U.CODES.get("'")===o){r<i&&(n+=t.substring(r,i)),n+=this.substring(this.end(0),this.matcherInputLength),i++,r=i+1;continue}else if(U.CODES.get("1")<=o&&o<=U.CODES.get("9")){let a=o-U.CODES.get("0");for(r<i&&(n+=t.substring(r,i)),i+=2;i<s&&(o=t.codePointAt(i),!(o<U.CODES.get("0")||o>U.CODES.get("9")||a*10+o-U.CODES.get("0")>this.patternGroupCount));i++)a=a*10+o-U.CODES.get("0");if(a>this.patternGroupCount){n+=`$${a}`,r=i,i--;continue}const l=this.group(a);l!==null&&(n+=l),r=i,i--;continue}else if(o===U.CODES.get("<")){r<i&&(n+=t.substring(r,i)),i++;let a=i+1;for(;a<t.length&&t.codePointAt(a)!==U.CODES.get(">")&&t.codePointAt(a)!==U.CODES.get(" ");)a++;if(a===t.length||t.codePointAt(a)!==U.CODES.get(">")){n+=t.substring(i-1,a+1),r=a+1,i=a;continue}const l=t.substring(i+1,a);if(Object.prototype.hasOwnProperty.call(this.namedGroups,l)){const c=this.group(l);c!==null&&(n+=c)}else n+=`$<${l}>`;r=a+1,i=a;continue}}return r<s&&(n+=t.substring(r,s)),n}appendTail(){return this.substring(this.appendPos,this.matcherInputLength)}replaceAll(t,n=!1){return this.replace(t,!0,n)}replaceFirst(t,n=!1){return this.replace(t,!1,n)}replace(t,n=!0,r=!1){let s="";this.reset();const i=typeof t=="function",o=Object.keys(this.namedGroups).length>0;let a=null;if(i){if(this.groupCount()>=AA.MAX_REPLACER_ARGS)throw new on("Too many capture groups to safely invoke replacer function");a=this.matcherInput.isUTF8Encoding()?this.matcherInput.asBytes():this.matcherInput.asCharSequence()}for(;this.find()&&(s+=i?this.appendReplacementFunc(t,o,a):this.appendReplacement(t,r),!!n););return s+=this.appendTail(),s}appendReplacementFunc(t,n,r){let s="";const i=this.start(),o=this.end();this.appendPos<i&&(s+=this.substring(this.appendPos,i)),this.appendPos=o;const a=this.buildReplacerArgs(i,n,r);return s+=String(t(...a)),s}buildReplacerArgs(t,n,r){const s=[this.group(0)],i=this.groupCount();for(let o=1;o<=i;o++){const a=this.start(o);a<0?s.push(void 0):s.push(this.substring(a,this.end(o)))}if(s.push(t),s.push(r),n){const o=this.getNamedGroups();for(const a in o)o[a]===null&&(o[a]=void 0);s.push(o)}return s}},H=class It{static ALT=1;static ALT_MATCH=2;static CAPTURE=3;static EMPTY_WIDTH=4;static FAIL=5;static MATCH=6;static NOP=7;static RUNE=8;static RUNE1=9;static RUNE_ANY=10;static RUNE_ANY_NOT_NL=11;static LB_WRITE=12;static LB_CHECK=13;static isRuneOp(t){return It.RUNE<=t&&t<=It.RUNE_ANY_NOT_NL}static escapeRunes(t){let n='"';for(let r of t)n+=me.escapeRune(r);return n+='"',n}constructor(t){this.op=t,this.out=0,this.arg=0,this.runes=new Int32Array(0),this.next=null}matchRune(t){if(this.runes.length===1){const o=this.runes[0];return(this.arg&$.FOLD_CASE)!==0?ce.equalsIgnoreCase(o,t):t===o}const n=this.runes.length;if(n===0)return!1;if(n===2||n===4||n===6||n===8){for(let o=0;o<n;o+=2){if(t<this.runes[o])return!1;if(t<=this.runes[o+1])return!0}return!1}let r=0,s=n>>1;for(;s>1;){const o=s>>1;r+=this.runes[r+o<<1]<=t?o:0,s-=o}r+=this.runes[r<<1]<=t?1:0;const i=r-1;return i>=0&&t<=this.runes[i<<1|1]}matchRunePos(t){if(this.runes.length===1){const o=this.runes[0];return(this.arg&$.FOLD_CASE)!==0?ce.equalsIgnoreCase(o,t)?0:-1:t===o?0:-1}const n=this.runes.length;if(n===0)return-1;if(n===2||n===4||n===6||n===8){for(let o=0;o<n;o+=2){if(t<this.runes[o])return-1;if(t<=this.runes[o+1])return Math.floor(o/2)}return-1}let r=0,s=n>>1;for(;s>1;){const o=s>>1;r+=this.runes[r+o<<1]<=t?o:0,s-=o}r+=this.runes[r<<1]<=t?1:0;const i=r-1;return i>=0&&t<=this.runes[i<<1|1]?i:-1}toString(){switch(this.op){case It.ALT:return`alt -> ${this.out}, ${this.arg}`;case It.ALT_MATCH:return`altmatch -> ${this.out}, ${this.arg}`;case It.CAPTURE:return`cap ${this.arg} -> ${this.out}`;case It.EMPTY_WIDTH:return`empty ${this.arg} -> ${this.out}`;case It.MATCH:return`match${this.arg!==0?` ${this.arg}`:""}`;case It.FAIL:return"fail";case It.NOP:return`nop -> ${this.out}`;case It.LB_WRITE:return`lbwrite ${this.arg} -> ${this.out}`;case It.LB_CHECK:return`lbcheck ${this.arg} -> ${this.out}`;case It.RUNE:return this.runes===null?"rune <null>":["rune ",It.escapeRunes(this.runes),(this.arg&$.FOLD_CASE)!==0?"/i":""," -> ",this.out].join("");case It.RUNE1:return`rune1 ${It.escapeRunes(this.runes)} -> ${this.out}`;case It.RUNE_ANY:return`any -> ${this.out}`;case It.RUNE_ANY_NOT_NL:return`anynotnl -> ${this.out}`;default:throw new Error("unhandled case in Inst.toString")}}},pb=class IA{constructor(t){this.sparse=new Int32Array(t),this.densePcs=new Int32Array(t),this.denseCaps=null,this.size=0,this.ncap=0,this.mainThreads=0}static INITIAL_THREADS=32;init(t){this.ncap=t;const n=Math.min(this.densePcs.length,IA.INITIAL_THREADS)*t;(!this.denseCaps||this.denseCaps.length<n)&&(this.denseCaps=new Int32Array(n))}growCaps(t){const n=this.densePcs.length*this.ncap,r=new Int32Array(Math.min(n,Math.max(t,2*this.denseCaps.length)));r.set(this.denseCaps),this.denseCaps=r}contains(t){const n=this.sparse[t];return n<this.size&&this.densePcs[n]===t}isEmpty(){return this.size===0}add(t){const n=this.size++;return this.sparse[t]=n,this.densePcs[n]=t,n}clear(){this.size=0,this.mainThreads=0}toString(){let t="{";for(let n=0;n<this.size;n++)n!==0&&(t+=", "),t+=this.densePcs[n];return t+="}",t}},G4=class{constructor(e){this.pos=-1,this.pcs=new Int32Array(e.numInst()),this.size=0,this.lbTable=new Int32Array(e.numLb+1)}reset(){this.pos=-1,this.size=0}},kA=class RA{static fromRE2(t){const n=new RA;return n.prog=t.prog,n.re2=t,n.q0=new pb(n.prog.numInst()),n.q1=new pb(n.prog.numInst()),n.addStack=new Int32Array(2*(n.prog.numInst()+1)),n.matched=!1,n.matchcap=new Int32Array(n.prog.numCap<2?2:n.prog.numCap),n.ncap=0,n}constructor(){this.prog=null,this.re2=null,this.q0=null,this.q1=null,this.addStack=null,this.matched=!1,this.matchcap=null,this.ncap=0,this.lbTable=null}init(t){this.ncap=t,t>this.matchcap.length?this.matchcap=new Int32Array(t).fill(-1):this.matchcap.fill(-1),this.q0.init(t),this.q1.init(t),this.prog.numLb>0&&((!this.lbTable||this.lbTable.length<this.prog.numLb+1)&&(this.lbTable=new Int32Array(this.prog.numLb+1)),this.lbTable.fill(-1))}submatches(){return this.ncap===0?me.emptyInts():me.toArray(this.matchcap.subarray(0,this.ncap))}match(t,n,r,s=null){const i=this.re2.cond;if(i===me.EMPTY_ALL||(r===$.ANCHOR_START||r===$.ANCHOR_BOTH)&&n!==0)return!1;this.matched=!1,this.matchcap.fill(-1);const o=this.prog.numLb>0,a=n;let l=n,c=!1;o&&(s!==null&&s.pos>=0&&s.pos<=n?(l=s.pos,c=!0):l=0);let u=o&&s!==null,d=this.q0,h=this.q1,f=t.step(l),B=f>>3,g=f&7,C=-1,v=0;f!==nn.EOF()&&(f=t.step(l+g),C=f>>3,v=f&7);let y;for(l===0?y=me.emptyOpContext(-1,B):y=t.context(l),o&&(c?this.restoreLookbehinds(s,d,y):this.spawnLookbehinds(d,l,y));;){if(d.mainThreads===0){if((i&me.EMPTY_BEGIN_TEXT)!==0&&l!==0||(r===$.ANCHOR_START||r===$.ANCHOR_BOTH)&&l!==0||this.matched)break;if(this.prog.numLb===0&&d.isEmpty()&&this.re2.prefix.length!==0&&C!==this.re2.prefixRune&&t.canCheckPrefix()){const D=t.index(this.re2,l);if(D<0)break;l+=D,f=t.step(l),B=f>>3,g=f&7,f=t.step(l+g),C=f>>3,v=f&7,y=t.context(l)}}l>=a&&(u&&(this.saveLookbehinds(s,d,l),u=!1),!this.matched&&(l===0||r===$.UNANCHORED)&&(this.ncap>0&&(this.matchcap[0]=l),this.add(d,this.prog.start,l,this.matchcap,0,y)));const S=l+g;if(y=t.context(S),this.step(d,h,l,S,B,y,r,l===t.endPos()),g===0||this.ncap===0&&this.matched)break;l+=g,B=C,g=v,B!==-1&&(f=t.step(l+g),C=f>>3,v=f&7);const E=d;d=h,h=E}return d.clear(),h.clear(),this.matched}matchSet(t,n,r){const s=this.re2.cond;if(s===me.EMPTY_ALL)return[];if((r===$.ANCHOR_START||r===$.ANCHOR_BOTH)&&n!==0)return[];let i=this.prog.numLb>0?0:n,o=n,a=this.q0,l=this.q1,c=t.step(i),u=c>>3,d=c&7,h=-1,f=0;c!==nn.EOF()&&(c=t.step(i+d),h=c>>3,f=c&7);let B=i===0?me.emptyOpContext(-1,u):t.context(i);const g=new Set;for(this.prog.numLb>0&&this.spawnLookbehinds(a,i,B);!(a.mainThreads===0&&((s&me.EMPTY_BEGIN_TEXT)!==0&&i!==0||(r===$.ANCHOR_START||r===$.ANCHOR_BOTH)&&i!==0));){(i===0||r===$.UNANCHORED)&&i>=o&&this.add(a,this.prog.start,i,this.matchcap,0,B);const C=i+d;B=t.context(C);for(let y=0;y<a.size;y++){const S=a.densePcs[y],E=this.prog.inst[S],D=y*this.ncap;let A=!1;switch(E.op){case H.MATCH:if(r===$.ANCHOR_BOTH&&i!==t.endPos())break;g.add(E.arg);break;case H.RUNE:A=E.matchRune(u);break;case H.RUNE1:A=u===E.runes[0];break;case H.RUNE_ANY:A=!0;break;case H.RUNE_ANY_NOT_NL:A=u!==10;break;default:continue}A&&this.add(l,E.out,C,a.denseCaps,D,B)}if(a.clear(),d===0)break;i+=d,u=h,d=f,u!==-1&&(c=t.step(i+d),h=c>>3,f=c&7);const v=a;a=l,l=v}return l.clear(),Array.from(g).sort((C,v)=>C-v)}step(t,n,r,s,i,o,a,l){const c=this.re2.longest;for(let u=0;u<t.size;u++){const d=t.densePcs[u],h=u*this.ncap;if(c&&this.matched&&this.ncap>0&&this.matchcap[0]<t.denseCaps[h])continue;const f=this.prog.inst[d];let B=!1;switch(f.op){case H.MATCH:if(a===$.ANCHOR_BOTH&&!l)break;if(this.ncap>0&&(!c||!this.matched||this.matchcap[1]<r)){t.denseCaps[h+1]=r;for(let g=0;g<this.ncap;g++)this.matchcap[g]=t.denseCaps[h+g]}c||(t.size=0),this.matched=!0;break;case H.RUNE:B=f.matchRune(i);break;case H.RUNE1:B=i===f.runes[0];break;case H.RUNE_ANY:B=!0;break;case H.RUNE_ANY_NOT_NL:B=i!==10;break;default:continue}B&&this.add(n,f.out,s,t.denseCaps,h,o)}t.clear()}spawnLookbehinds(t,n,r){for(let s=0;s<this.prog.lbStarts.length;s++)this.add(t,this.prog.lbStarts[s],n,this.matchcap,0,r)}restoreLookbehinds(t,n,r){this.lbTable.set(t.lbTable);for(let s=0;s<t.size;s++)this.add(n,t.pcs[s],t.pos,this.matchcap,0,r)}saveLookbehinds(t,n,r){let s=0;for(let i=0;i<n.size;i++){const o=n.densePcs[i];this.prog.lbInst[o]===1&&H.isRuneOp(this.prog.inst[o].op)&&(t.pcs[s++]=o)}t.size=s,t.pos=r,t.lbTable.set(this.lbTable)}add(t,n,r,s,i,o){const a=this.addStack;let l=0;for(;;){for(;n!==0&&!t.contains(n);){const u=t.add(n),d=this.prog.inst[n];switch(d.op){case H.FAIL:n=0;break;case H.ALT:case H.ALT_MATCH:a[l++]=d.arg,a[l++]=0,n=d.out;break;case H.EMPTY_WIDTH:n=(d.arg&~o)===0?d.out:0;break;case H.NOP:n=d.out;break;case H.CAPTURE:d.arg<this.ncap&&(a[l++]=-d.arg-1,a[l++]=s[i+d.arg],s[i+d.arg]=r),n=d.out;break;case H.LB_WRITE:this.lbTable[Math.abs(d.arg)]=r,n=d.out;break;case H.LB_CHECK:d.arg>0?n=this.lbTable[d.arg]===r?d.out:0:n=this.lbTable[-d.arg]!==r?d.out:0;break;case H.MATCH:case H.RUNE:case H.RUNE1:case H.RUNE_ANY:case H.RUNE_ANY_NOT_NL:if(this.prog.lbInst[n]===0&&t.mainThreads++,this.ncap>0){const h=u*this.ncap;h+this.ncap>t.denseCaps.length&&t.growCaps(h+this.ncap);for(let f=0;f<this.ncap;f++)t.denseCaps[h+f]=s[i+f]}n=0;break;default:throw new Ya("unhandled")}}if(l===0)return;l-=2;const c=a[l];c<0?(s[i-c-1]=a[l+1],n=0):n=c}}},V4=e=>{let t=-2128831035;for(let n=0;n<e.length;n++)t^=e[n],t=Math.imul(t,16777619);return t},U4=(e,t)=>{if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0},z4=class{constructor(e,t,n){this.nfaStates=e,this.isMatch=t,this.matchIDs=n,this.next=null,this.nextAnchored=null}},OA=class Hu{static STATE_OVERHEAD=160;static TABLE_OVERHEAD=16;static PROGRESS_PER_STATE=10;constructor(t,n=8388608){this.prog=t,this.maxMem=n,this.stateCache=new Map,this.stateCount=0,this.startState=null,this.failed=!1;for(let r=0;r<t.numInst();r++){const s=t.getInst(r).op;if(s===H.EMPTY_WIDTH||s===H.LB_WRITE||s===H.LB_CHECK){this.failed=!0;break}}this.computeRuneClasses(),this.stateBudget=n,this.memBudget=n}computeRuneClasses(){const t=new Set,n=s=>{t.add(s),t.add(s+1)};for(let s=0;s<this.prog.numInst();s++){const i=this.prog.getInst(s);switch(i.op){case H.RUNE:case H.RUNE1:if(i.runes.length===1){if(n(i.runes[0]),(i.arg&$.FOLD_CASE)!==0)for(let o=ce.simpleFold(i.runes[0]);o!==i.runes[0];o=ce.simpleFold(o))n(o)}else for(let o=0;o<i.runes.length;o+=2)t.add(i.runes[o]),t.add(i.runes[o+1]+1);break;case H.RUNE_ANY_NOT_NL:n(10)}}t.delete(0),this.classBounds=Int32Array.from(t).sort(),this.numClasses=this.classBounds.length+1;const r=new Int32Array(ce.MAX_LATIN1+1);for(let s=0;s<=ce.MAX_LATIN1;s++)r[s]=this.searchClass(s);this.latin1Class=r}runeClass(t){return t<=ce.MAX_LATIN1?this.latin1Class[t]:this.searchClass(t)}searchClass(t){const n=this.classBounds;let r=0,s=n.length;for(;r<s;){const i=r+s>>1;n[i]<=t?r=i+1:s=i}return r}computeClosure(t){const n=new Set,r=[...t];let s=!1;const i=new Set;for(;r.length>0;){const l=r.pop();if(n.has(l))continue;n.add(l);const c=this.prog.getInst(l);switch(c.op){case H.MATCH:s=!0,i.add(c.arg);break;case H.ALT:case H.ALT_MATCH:r.push(c.out),r.push(c.arg);break;case H.NOP:case H.CAPTURE:r.push(c.out);break;case H.EMPTY_WIDTH:case H.LB_WRITE:case H.LB_CHECK:return null}}const o=Int32Array.from(n).sort(),a=Array.from(i).sort((l,c)=>l-c);return{pcs:o,isMatch:s,matchIDs:a}}getState(t){const n=this.computeClosure(t);if(!n)return null;const r=n.pcs,s=V4(r);let i=this.stateCache.get(s);if(i)for(let l=0;l<i.length;l++){const c=i[l];if(U4(c.nfaStates,r))return c}const o=Hu.STATE_OVERHEAD+4*r.length+8*n.matchIDs.length;if(this.memBudget<o)return null;this.memBudget-=o,i||(i=[],this.stateCache.set(s,i));const a=new z4(r,n.isMatch,n.matchIDs);return i.push(a),this.stateCount++,a}allocTable(t,n){const r=Hu.TABLE_OVERHEAD+8*this.numClasses;if(this.memBudget<r)return null;this.memBudget-=r;const s=new Array(this.numClasses).fill(null);return n===$.UNANCHORED?t.next=s:t.nextAnchored=s,s}clearCache(){this.stateCache.clear(),this.stateCount=0,this.startState=null,this.memBudget=this.stateBudget}resetCache(t){return this.clearCache(),this.getState(t.nfaStates)}step(t,n,r,s){let i=s===$.UNANCHORED?t.next:t.nextAnchored;if(i!==null){const l=i[n];if(l!==null)return l}else if(i=this.allocTable(t,s),i===null)return null;const o=[];for(let l=0;l<t.nfaStates.length;l++){const c=t.nfaStates[l],u=this.prog.getInst(c);H.isRuneOp(u.op)&&u.matchRune(r)&&o.push(u.out)}s===$.UNANCHORED&&o.push(this.prog.start);const a=this.getState(o);return a===null?null:(i[n]=a,a)}start(){return this.startState===null&&(this.startState=this.getState([this.prog.start]),this.startState===null&&!this.failed&&(this.clearCache(),this.startState=this.getState([this.prog.start]))),this.startState}run(t,n,r,s,i,o){const a=t.endPos(),l=this.latin1Class;let c=-1,u=n;for(;u<a;){const d=t.step(u),h=d>>3,f=d&7;if(f===0)break;const B=h<=ce.MAX_LATIN1?l[h]:this.runeClass(h);let g=r===$.UNANCHORED&&s.next!==null?s.next[B]:null;if(g===null&&(g=this.step(s,B,h,r),g===null&&(c>=0&&u-c<Hu.PROGRESS_PER_STATE*this.stateCount||(c=u,s=this.resetCache(s),s===null)||(g=this.step(s,B,h,r),g===null))))return null;s=g,u+=f;const C=i(s,u);if(C!==null)return C;if(s.nfaStates.length===0&&r!==$.UNANCHORED)return o}return o}match(t,n,r){if(this.failed)return null;if((r===$.ANCHOR_START||r===$.ANCHOR_BOTH)&&n!==0)return!1;const s=this.start();if(s===null)return null;const i=t.endPos();return s.isMatch&&(r!==$.ANCHOR_BOTH||n===i)?!0:this.run(t,n,r,s,(o,a)=>o.isMatch&&(r!==$.ANCHOR_BOTH||a===i)?!0:null,!1)}matchSet(t,n,r){if(this.failed)return null;if((r===$.ANCHOR_START||r===$.ANCHOR_BOTH)&&n!==0)return[];const s=this.start();if(s===null)return null;const i=t.endPos(),o=new Set,a=(l,c)=>{if(l.isMatch&&(r!==$.ANCHOR_BOTH||c===i))for(let u=0;u<l.matchIDs.length;u++)o.add(l.matchIDs[u]);return null};return a(s,n),this.run(t,n,r,s,a,!1)===null?null:Array.from(o).sort((l,c)=>l-c)}},$4=32,W4=500,Jf=256,q4=262144,K4=class{constructor(){this.end=0,this.cap=new Int32Array(0),this.matchcap=new Int32Array(0),this.ncap=0,this.jobPc=new Int32Array(Jf),this.jobArg=new Uint8Array(Jf),this.jobPos=new Int32Array(Jf),this.jobLen=0,this.visited=new Uint32Array(0)}reset(e,t,n){this.end=t,this.jobLen=0,this.ncap=n;const r=e.numInst()*(t+1)+$4-1>>>5;this.visited.length<r?this.visited=new Uint32Array(r):this.visited.fill(0,0,r),this.cap.length<n?this.cap=new Int32Array(n).fill(-1):this.cap.fill(-1,0,n),this.matchcap.length<n?this.matchcap=new Int32Array(n).fill(-1):this.matchcap.fill(-1,0,n)}shouldVisit(e,t){const n=e*(this.end+1)+t,r=n>>>5,s=1<<(n&31);return(this.visited[r]&s)!==0?!1:(this.visited[r]|=s,!0)}push(e,t,n,r){if(e.prog.getInst(t).op!==H.FAIL&&(r||this.shouldVisit(t,n))){if(this.jobLen>=this.jobPc.length){const s=this.jobPc.length*2,i=new Int32Array(s);i.set(this.jobPc),this.jobPc=i;const o=new Uint8Array(s);o.set(this.jobArg),this.jobArg=o;const a=new Int32Array(s);a.set(this.jobPos),this.jobPos=a}this.jobPc[this.jobLen]=t,this.jobArg[this.jobLen]=r?1:0,this.jobPos[this.jobLen]=n,this.jobLen++}}tryBacktrack(e,t,n,r,s){const i=e.longest;for(this.push(e,n,r,!1);this.jobLen>0;){this.jobLen--;let o=this.jobPc[this.jobLen],a=this.jobArg[this.jobLen]===1,l=this.jobPos[this.jobLen],c=!0;for(;!(!c&&!this.shouldVisit(o,l));){c=!1;const u=e.prog.getInst(o);switch(u.op){case H.FAIL:throw new Ya("unexpected InstFail");case H.ALT:if(a){a=!1,o=u.arg;continue}else{this.push(e,o,l,!0),o=u.out;continue}case H.ALT_MATCH:{const d=e.prog.getInst(u.out);if(H.isRuneOp(d.op)){this.push(e,u.arg,l,!1),o=u.arg,l=this.end;continue}this.push(e,u.out,this.end,!1),o=u.out;continue}case H.RUNE:{const d=t.step(l);if(d===nn.EOF()||!u.matchRune(d>>3))break;l+=d&7,o=u.out;continue}case H.RUNE1:{const d=t.step(l);if(d===nn.EOF()||d>>3!==u.runes[0])break;l+=d&7,o=u.out;continue}case H.RUNE_ANY_NOT_NL:{const d=t.step(l);if(d===nn.EOF()||d>>3===10)break;l+=d&7,o=u.out;continue}case H.RUNE_ANY:{const d=t.step(l);if(d===nn.EOF())break;l+=d&7,o=u.out;continue}case H.CAPTURE:if(a){this.cap[u.arg]=l;break}else{u.arg<this.ncap&&(this.push(e,o,this.cap[u.arg],!0),this.cap[u.arg]=l),o=u.out;continue}case H.EMPTY_WIDTH:{const d=t.context(l);if((u.arg&~d)!==0)break;o=u.out;continue}case H.NOP:o=u.out;continue;case H.MATCH:{if(s===$.ANCHOR_BOTH&&l!==this.end)break;if(this.ncap===0)return!0;this.ncap>1&&(this.cap[1]=l);const d=this.matchcap[1];if((d===-1||i&&l>0&&l>d)&&this.matchcap.set(this.cap),!i||l===this.end)return!0;break}case H.LB_WRITE:case H.LB_CHECK:throw new Ya("Backtracker cannot evaluate Lookbehind instructions");default:throw new Ya("bad inst")}break}}return i&&this.matchcap.length>1&&this.matchcap[1]>=0}},$c=[],Wc=class MA{static shouldBacktrack(t){return t.numInst()<=W4}static maxBitStateLen(t){return MA.shouldBacktrack(t)?Math.floor(q4/t.numInst()):0}static execute(t,n,r,s,i){const o=t.cond;if(o===me.EMPTY_ALL||(s===$.ANCHOR_START||s===$.ANCHOR_BOTH)&&r!==0||(o&me.EMPTY_BEGIN_TEXT)!==0&&r!==0)return null;const a=$c.length>0?$c.pop():new K4,l=n.endPos();a.reset(t.prog,l,i);let c=!1;if((o&me.EMPTY_BEGIN_TEXT)!==0||s===$.ANCHOR_START||s===$.ANCHOR_BOTH)a.ncap>0&&(a.cap[0]=r),a.tryBacktrack(t,n,t.prog.start,r,s)&&(c=!0);else{let d=-1;for(;r<=l&&d!==0;r+=d){if(t.prefix.length>0){const f=n.index(t,r);if(f<0)break;r+=f}if(a.ncap>0&&(a.cap[0]=r),a.tryBacktrack(t,n,t.prog.start,r,s)){c=!0;break}const h=n.step(r);d=h===nn.EOF()?0:h&7}}if(!c)return $c.push(a),null;const u=i===0?[]:me.toArray(a.matchcap.subarray(0,i));return $c.push(a),u}},mb=class{constructor(e){this.sparse=new Uint32Array(e),this.dense=new Uint32Array(e),this.size=0,this.nextIndex=0}empty(){return this.nextIndex>=this.size}next(){return this.dense[this.nextIndex++]}clear(){this.size=0,this.nextIndex=0}contains(e){return e<this.sparse.length&&this.sparse[e]<this.size&&this.dense[this.sparse[e]]===e}insert(e){this.contains(e)||this.insertNew(e)}insertNew(e){e>=this.sparse.length||(this.sparse[e]=this.size,this.dense[this.size]=e,this.size++)}},J4=(e,t,n,r)=>{const s=e.length,i=t.length;let o=0,a=0;const l=[],c=[];let u=!0,d=-1;const h=f=>{const B=f?e:t,g=f?o:a,C=f?n:r;return d>0&&B[g]<=l[d]?!1:(l.push(B[g],B[g+1]),f?o+=2:a+=2,d+=2,c.push(C),!0)};for(;o<s||a<i;)if(a>=i?u=h(!0):o>=s||t[a]<e[o]?u=h(!1):u=h(!0),!u)return null;return{merged:l,next:c}},Q4=class{constructor(e){this.start=e.start,this.numCap=e.numCap,this.inst=new Array(e.inst.length);for(let t=0;t<e.inst.length;t++){const n=e.inst[t],r=new H(n.op);r.out=n.out,r.arg=n.arg,r.runes=n.runes?new Int32Array(n.runes):new Int32Array(0),r.next=null,this.inst[t]=r}}},Y4=e=>{const t=new Q4(e);for(let n=0;n<t.inst.length;n++){const r=t.inst[n];if(r.op!==H.ALT&&r.op!==H.ALT_MATCH)continue;let s="out",i="arg",o=t.inst[r[i]];if(o.op!==H.ALT&&o.op!==H.ALT_MATCH&&(s="arg",i="out",o=t.inst[r[i]],o.op!==H.ALT&&o.op!==H.ALT_MATCH))continue;const a=t.inst[r[s]];if(a.op===H.ALT||a.op===H.ALT_MATCH)continue;let l="out",c="arg",u=!1;o.out===n?u=!0:o.arg===n&&(u=!0,l="arg",c="out"),u&&(o[l]=r[s]),r[s]===o[l]&&(r[i]=o[c])}return t},X4=e=>{if(e.inst.length>=1e3)return null;const t=new mb(e.inst.length),n=new mb(e.inst.length),r=new Array(e.inst.length),s=new Array(e.inst.length).fill(!1),i=o=>{let a=!0;const l=e.inst[o];if(n.contains(o))return!0;switch(n.insert(o),l.op){case H.ALT:case H.ALT_MATCH:{a=i(l.out)&&i(l.arg);let c=s[l.out],u=s[l.arg];if(c&&u)return!1;if(u){const B=l.out;l.out=l.arg,l.arg=B;const g=c;c=u,u=g}c&&(s[o]=!0,l.op=H.ALT_MATCH);const d=r[l.out]||[],h=r[l.arg]||[],f=J4(d,h,l.out,l.arg);if(!f)return!1;r[o]=new Int32Array(f.merged),l.next=new Uint32Array(f.next);break}case H.CAPTURE:case H.EMPTY_WIDTH:case H.NOP:a=i(l.out),s[o]=s[l.out],r[o]=r[l.out]?new Int32Array(r[l.out]):new Int32Array(0),l.next=new Uint32Array(Math.floor(r[o].length/2)+1).fill(l.out);break;case H.MATCH:case H.FAIL:s[o]=l.op===H.MATCH;break;case H.RUNE:{if(s[o]=!1,l.next&&l.next.length>0)break;if(t.insert(l.out),!l.runes||l.runes.length===0){r[o]=new Int32Array(0),l.next=new Uint32Array([l.out]);break}let c=[];if(l.runes.length===1&&(l.arg&$.FOLD_CASE)!==0){const u=l.runes[0];c.push(u,u);for(let d=ce.simpleFold(u);d!==u;d=ce.simpleFold(d))c.push(d,d);c.sort((d,h)=>d-h)}else for(let u=0;u<l.runes.length;u++)c.push(l.runes[u]);r[o]=new Int32Array(c),l.next=new Uint32Array(Math.floor(c.length/2)+1).fill(l.out),l.op=H.RUNE;break}case H.RUNE1:{if(s[o]=!1,l.next&&l.next.length>0)break;t.insert(l.out);let c=[];if((l.arg&$.FOLD_CASE)!==0){const u=l.runes[0];c.push(u,u);for(let d=ce.simpleFold(u);d!==u;d=ce.simpleFold(d))c.push(d,d);c.sort((d,h)=>d-h)}else c.push(l.runes[0],l.runes[0]);r[o]=new Int32Array(c),l.next=new Uint32Array(Math.floor(c.length/2)+1).fill(l.out),l.op=H.RUNE;break}case H.RUNE_ANY:if(s[o]=!1,l.next&&l.next.length>0)break;t.insert(l.out),r[o]=new Int32Array([0,ce.MAX_RUNE]),l.next=new Uint32Array([l.out]);break;case H.RUNE_ANY_NOT_NL:if(s[o]=!1,l.next&&l.next.length>0)break;t.insert(l.out),r[o]=new Int32Array([0,9,11,ce.MAX_RUNE]),l.next=new Uint32Array(Math.floor(r[o].length/2)+1).fill(l.out)}return a};for(t.clear(),t.insert(e.start);!t.empty();)if(n.clear(),!i(t.next()))return null;for(let o=0;o<e.inst.length;o++)r[o]&&(e.inst[o].runes=r[o]);return e},Z4=(e,t)=>{for(let n=0;n<t.inst.length;n++){const r=t.inst[n];switch(r.op){case H.ALT:case H.ALT_MATCH:case H.RUNE:break;case H.CAPTURE:case H.EMPTY_WIDTH:case H.NOP:case H.MATCH:case H.FAIL:e.inst[n].next=null;break;case H.RUNE1:case H.RUNE_ANY:case H.RUNE_ANY_NOT_NL:e.inst[n].next=null,e.inst[n].op=r.op,e.inst[n].runes=r.runes?new Int32Array(r.runes):new Int32Array(0)}}},gb=class NA{static compile(t){if(t.start===0||t.numLb>0)return null;const n=t.inst[t.start];if(n.op!==H.EMPTY_WIDTH||(n.arg&me.EMPTY_BEGIN_TEXT)===0)return null;let r=!1;for(let i=0;i<t.inst.length;i++)if(t.inst[i].op===H.ALT||t.inst[i].op===H.ALT_MATCH){r=!0;break}for(let i=0;i<t.inst.length;i++){const o=t.inst[i],a=t.inst[o.out].op;switch(o.op){case H.ALT:case H.ALT_MATCH:if(a===H.MATCH||t.inst[o.arg].op===H.MATCH)return null;break;case H.EMPTY_WIDTH:if(a===H.MATCH){if((o.arg&me.EMPTY_END_TEXT)===me.EMPTY_END_TEXT)continue;return null}break;default:if(a===H.MATCH&&r)return null}}let s=Y4(t);return s=X4(s),s!==null&&Z4(s,t),s}static next(t,n){const r=t.matchRunePos(n);return r>=0?t.next[r]:t.op===H.ALT_MATCH?t.out:0}static execute(t,n,r,s,i){const o=t.onepass;if(!o)return null;const a=new Int32Array(i).fill(-1);let l=!1,c=n.step(r),u=c>>3,d=c&7,h=nn.EOF(),f=-1,B=0;c!==nn.EOF()&&(h=n.step(r+d),h!==nn.EOF()&&(f=h>>3,B=h&7));let g=r===0?me.emptyOpContext(-1,u):n.context(r),C=o.start,v;for(;;){switch(v=o.inst[C],C=v.out,v.op){case H.MATCH:return s===$.ANCHOR_BOTH&&r!==n.endPos()?null:(l=!0,a.length>0&&(a[0]=0,a[1]=r),i===0?[]:me.toArray(a));case H.RUNE:if(!v.matchRune(u))return null;break;case H.RUNE1:if(u!==v.runes[0])return null;break;case H.RUNE_ANY:break;case H.RUNE_ANY_NOT_NL:if(u===10)return null;break;case H.ALT:case H.ALT_MATCH:C=NA.next(v,u);continue;case H.FAIL:return null;case H.NOP:continue;case H.EMPTY_WIDTH:if((v.arg&~g)!==0)return null;continue;case H.CAPTURE:v.arg<a.length&&(a[v.arg]=r);continue;default:throw new Ya("bad inst")}if(d===0)break;g=me.emptyOpContext(u,f),r+=d,u=f,d=B,u!==-1&&(h=n.step(r+d),h!==nn.EOF()?(f=h>>3,B=h&7):(f=-1,B=0))}return l?i===0?[]:me.toArray(a):null}},k=class ye{static Op=TA(["NO_MATCH","EMPTY_MATCH","LITERAL","CHAR_CLASS","ANY_CHAR_NOT_NL","ANY_CHAR","BEGIN_LINE","END_LINE","BEGIN_TEXT","END_TEXT","WORD_BOUNDARY","NO_WORD_BOUNDARY","CAPTURE","STAR","PLUS","QUEST","REPEAT","CONCAT","ALTERNATE","PLB","NLB","LEFT_PAREN","VERTICAL_BAR"]);static isPseudoOp(t){return t>=ye.Op.LEFT_PAREN}static emptySubs(){return[]}static quoteIfHyphen(t){return t===U.CODES.get("-")?"\\":""}static fromRegexp(t){const n=new ye(t.op);return n.flags=t.flags,n.subs=t.subs,n.runes=t.runes,n.cap=t.cap,n.min=t.min,n.max=t.max,n.name=t.name,n.namedGroups=t.namedGroups,n.lb=t.lb,n}constructor(t){this.op=t,this.flags=0,this.subs=ye.emptySubs(),this.runes=new Int32Array(0),this.min=0,this.max=0,this.cap=0,this.name=null,this.namedGroups=Object.create(null),this.lb=0}reinit(){this.flags=0,this.subs=ye.emptySubs(),this.runes=new Int32Array(0),this.cap=0,this.min=0,this.max=0,this.name=null,this.namedGroups=Object.create(null),this.lb=0}toString(){return this.appendTo()}appendTo(){let t="";switch(this.op){case ye.Op.NO_MATCH:t+="[^\\x00-\\x{10FFFF}]";break;case ye.Op.EMPTY_MATCH:t+="(?:)";break;case ye.Op.STAR:case ye.Op.PLUS:case ye.Op.QUEST:case ye.Op.REPEAT:{const n=this.subs[0];switch(n.op>ye.Op.CAPTURE||n.op===ye.Op.LITERAL&&n.runes.length>1?t+=`(?:${n.appendTo()})`:t+=n.appendTo(),this.op){case ye.Op.STAR:t+="*";break;case ye.Op.PLUS:t+="+";break;case ye.Op.QUEST:t+="?";break;case ye.Op.REPEAT:t+=`{${this.min}`,this.min!==this.max&&(t+=",",this.max>=0&&(t+=this.max)),t+="}"}(this.flags&$.NON_GREEDY)!==0&&(t+="?");break}case ye.Op.CONCAT:for(let n of this.subs)n.op===ye.Op.ALTERNATE?t+=`(?:${n.appendTo()})`:t+=n.appendTo();break;case ye.Op.ALTERNATE:{let n="";for(let r of this.subs)t+=n,n="|",t+=r.appendTo();break}case ye.Op.LITERAL:(this.flags&$.FOLD_CASE)!==0&&(t+="(?i:");for(let n of this.runes)t+=me.escapeRune(n);(this.flags&$.FOLD_CASE)!==0&&(t+=")");break;case ye.Op.ANY_CHAR_NOT_NL:t+="(?-s:.)";break;case ye.Op.ANY_CHAR:t+="(?s:.)";break;case ye.Op.PLB:t+=`(?<=${this.subs[0].appendTo()})`;break;case ye.Op.NLB:t+=`(?<!${this.subs[0].appendTo()})`;break;case ye.Op.CAPTURE:this.name===null||this.name.length===0?t+="(":t+=`(?P<${this.name}>`,this.subs[0].op!==ye.Op.EMPTY_MATCH&&(t+=this.subs[0].appendTo()),t+=")";break;case ye.Op.BEGIN_TEXT:t+="\\A";break;case ye.Op.END_TEXT:(this.flags&$.WAS_DOLLAR)!==0?t+="(?-m:$)":t+="\\z";break;case ye.Op.BEGIN_LINE:t+="^";break;case ye.Op.END_LINE:t+="$";break;case ye.Op.WORD_BOUNDARY:t+="\\b";break;case ye.Op.NO_WORD_BOUNDARY:t+="\\B";break;case ye.Op.CHAR_CLASS:if(this.runes.length%2!==0){t+="[invalid char class]";break}if(t+="[",this.runes.length===0)t+="^\\x00-\\x{10FFFF}";else if(this.runes[0]===0&&this.runes[this.runes.length-1]===ce.MAX_RUNE){t+="^";for(let n=1;n<this.runes.length-1;n+=2){const r=this.runes[n]+1,s=this.runes[n+1]-1;t+=ye.quoteIfHyphen(r),t+=me.escapeRune(r),r!==s&&(t+="-",t+=ye.quoteIfHyphen(s),t+=me.escapeRune(s))}}else for(let n=0;n<this.runes.length;n+=2){const r=this.runes[n],s=this.runes[n+1];t+=ye.quoteIfHyphen(r),t+=me.escapeRune(r),r!==s&&(t+="-",t+=ye.quoteIfHyphen(s),t+=me.escapeRune(s))}t+="]";break;default:t+=this.op}return t}maxCap(){let t=0;if(this.op===ye.Op.CAPTURE&&(t=this.cap),this.subs!==null)for(let n of this.subs){const r=n.maxCap();t<r&&(t=r)}return t}equals(t){if(!(t!==null&&t instanceof ye)||this.op!==t.op)return!1;switch(this.op){case ye.Op.END_TEXT:if((this.flags&$.WAS_DOLLAR)!==(t.flags&$.WAS_DOLLAR))return!1;break;case ye.Op.LITERAL:case ye.Op.CHAR_CLASS:if(this.runes===null&&t.runes===null)break;if(this.runes===null||t.runes===null||this.runes.length!==t.runes.length)return!1;for(let n=0;n<this.runes.length;n++)if(this.runes[n]!==t.runes[n])return!1;break;case ye.Op.ALTERNATE:case ye.Op.CONCAT:if(this.subs.length!==t.subs.length)return!1;for(let n=0;n<this.subs.length;++n)if(!this.subs[n].equals(t.subs[n]))return!1;break;case ye.Op.STAR:case ye.Op.PLUS:case ye.Op.QUEST:if((this.flags&$.NON_GREEDY)!==(t.flags&$.NON_GREEDY)||!this.subs[0].equals(t.subs[0]))return!1;break;case ye.Op.REPEAT:if((this.flags&$.NON_GREEDY)!==(t.flags&$.NON_GREEDY)||this.min!==t.min||this.max!==t.max||!this.subs[0].equals(t.subs[0]))return!1;break;case ye.Op.CAPTURE:if(this.cap!==t.cap||(this.name===null?t.name!==null:this.name!==t.name)||!this.subs[0].equals(t.subs[0]))return!1;break;case ye.Op.PLB:case ye.Op.NLB:if(this.lb!==t.lb||!this.subs[0].equals(t.subs[0]))return!1}return!0}},jC=class{static walk(e,t){const n=[];let r=e,s;for(;;){if(r.subs.length===0)s=t.leaf(r);else{const i=t.enter(r);if(i.result===void 0){n.push({re:r,state:i,i:0}),r=r.subs[0];continue}s=i.result}for(;;){if(n.length===0)return s;const i=n[n.length-1];if(t.child(i.re,i.state,s,i.i),i.i++,i.state.result===void 0&&i.i<i.re.subs.length){r=i.re.subs[i.i];break}n.pop(),s=i.state.result!==void 0?i.state.result:t.leave(i.re,i.state)}}}},Cb=class{constructor(e,t){const n=new Map,r=[0],s=[0],i=[0],o=[0];for(const B of e){let g=0;for(let C=0;C<B.length;C++){const v=g*t+B[C];let y=n.get(v);y===void 0&&(y=r.length,n.set(v,y),r.push(g),s.push(B[C]),i.push(i[g]+1),o.push(0)),g=y}o[g]=1}const a=r.length,l=new Int32Array(a-1);for(let B=1;B<a;B++)l[B-1]=B;l.sort((B,g)=>r[B]-r[g]||s[B]-s[g]);const c=new Int32Array(a+1);for(let B=1;B<a;B++)c[r[B]+1]++;for(let B=0;B<a;B++)c[B+1]+=c[B];const u=new Int32Array(a-1);for(let B=0;B<l.length;B++)u[B]=s[l[B]];this.childStart=c,this.childUnit=u,this.childNode=l;const d=new Int32Array(a);for(let B=0;B<a;B++)d[B]=B;d.sort((B,g)=>i[B]-i[g]);const h=new Int32Array(a),f=Uint8Array.from(o);for(let B=1;B<a;B++){const g=d[B],C=r[g];if(C!==0){let v=h[C],y=this.next(v,s[g]);for(;y<0&&v!==0;)v=h[v],y=this.next(v,s[g]);h[g]=y>=0?y:0}f[g]|=f[h[g]]}this.fail=h,this.match=f}next(e,t){let n=this.childStart[e],r=this.childStart[e+1];const s=this.childUnit;for(;n<r;){const i=n+r>>1,o=s[i];if(o===t)return this.childNode[i];o<t?n=i+1:r=i}return-1}advance(e,t){for(;;){const n=this.next(e,t);if(n>=0)return n;if(e===0)return 0;e=this.fail[e]}}searchUTF16(e,t,n){let r=0;for(let s=t;s<n;s++)if(r=this.advance(r,e.charCodeAt(s)),this.match[r]===1)return!0;return!1}searchUTF8(e,t,n){let r=0;for(let s=t;s<n;s++)if(r=this.advance(r,e[s]),this.match[r]===1)return!0;return!1}},De=class io{static Type={NONE:0,EXACT:1,AND:2,OR:3};static MAX_SCANS=32;static MAX_AC_UNITS=1<<18;constructor(t){this.type=t,this.subs=[],this.str="",this.bytes=null,this.cost=t===io.Type.EXACT?1:0,this.allExact=!1,this.ac16=null,this.ac8=null}automaton16(){if(this.ac16===null){const t=this.subs.map(n=>{const r=new Array(n.str.length);for(let s=0;s<n.str.length;s++)r[s]=n.str.charCodeAt(s);return r});this.ac16=new Cb(t,65536)}return this.ac16}automaton8(){return this.ac8===null&&(this.ac8=new Cb(this.subs.map(t=>t.bytes),256)),this.ac8}eval(t,n){switch(this.type){case io.Type.NONE:return!0;case io.Type.EXACT:return t.hasString(this,n);case io.Type.AND:for(let r=0;r<this.subs.length;r++)if(!this.subs[r].eval(t,n))return!1;return!0;case io.Type.OR:if(this.allExact)return t.hasAnyString(this,n);for(let r=0;r<this.subs.length;r++)if(this.subs[r].eval(t,n))return!0;return!1;default:return!0}}},eW=class oo{static build(t){return t?jC.walk(t,oo.WALKER):new De(De.Type.NONE)}static WALKER={leaf:t=>oo.leaf(t),enter:t=>oo.enter(t),child:(t,n,r)=>oo.child(t,n,r),leave:(t,n)=>oo.leave(t,n)};static leaf(t){if(t.op!==k.Op.LITERAL)return new De(De.Type.NONE);if(t.runes.length===0||(t.flags&$.FOLD_CASE)!==0)return new De(De.Type.NONE);let n="";for(let s=0;s<t.runes.length;s++){if(ce.isUnsearchable(t.runes[s]))return new De(De.Type.NONE);n+=String.fromCodePoint(t.runes[s])}const r=new De(De.Type.EXACT);return r.str=n,r.bytes=me.stringToUtf8ByteArray(r.str),r}static enter(t){switch(t.op){case k.Op.CAPTURE:case k.Op.PLUS:return{sub:null};case k.Op.REPEAT:return t.min>=1?{sub:null}:{result:new De(De.Type.NONE)};case k.Op.CONCAT:return{pf:new De(De.Type.AND),subs:[]};case k.Op.ALTERNATE:return{pf:new De(De.Type.OR),subs:[]};default:return{result:new De(De.Type.NONE)}}}static child(t,n,r){if(n.subs===void 0){n.sub=r;return}if(n.pf.type===De.Type.AND){if(r.type===De.Type.NONE)return;if(r.type===De.Type.AND){for(let s=0;s<r.subs.length;s++)n.subs.push(r.subs[s]);return}n.subs.push(r);return}if(r.type===De.Type.NONE){n.result=new De(De.Type.NONE);return}if(r.type===De.Type.OR){for(let s=0;s<r.subs.length;s++)n.subs.push(r.subs[s]);return}n.subs.push(r)}static leave(t,n){if(n.subs===void 0)return n.sub;const r=n.pf,s=new Set,i=[];for(const c of n.subs){if(c.type===De.Type.EXACT){if(s.has(c.str))continue;s.add(c.str)}i.push(c)}if(r.type===De.Type.AND){const c=[];let u=0;for(const d of i)u+d.cost>De.MAX_SCANS||(c.push(d),u+=d.cost);return c.length===0?new De(De.Type.NONE):c.length===1?c[0]:(r.subs=c,r.cost=u,r)}if(i.length===0)return new De(De.Type.NONE);if(i.length===1)return i[0];r.subs=i;let o=!0,a=0,l=0;for(const c of i)c.type!==De.Type.EXACT?o=!1:l+=c.bytes.length,a+=c.cost;return o?l>De.MAX_AC_UNITS?new De(De.Type.NONE):(r.allExact=!0,r.cost=1,r):a>De.MAX_SCANS?new De(De.Type.NONE):(r.cost=a,r)}},In=class{constructor(e=0,t=0){this.head=e,this.tail=t}},tW=class{constructor(){this.inst=[],this.start=0,this.numCap=2,this.lbStarts=[],this.numLb=0,this.lbInst=null}getInst(e){return this.inst[e]}numInst(){return this.inst.length}addInst(e){this.inst.push(new H(e))}markLookbehindInsts(){const e=new Uint8Array(this.inst.length),t=this.lbStarts.slice();for(;t.length>0;){const n=t.pop();if(n===0||e[n]===1)continue;e[n]=1;const r=this.inst[n];switch(r.op){case H.ALT:case H.ALT_MATCH:t.push(r.out,r.arg);break;case H.MATCH:case H.FAIL:break;default:t.push(r.out)}}this.lbInst=e}skipNop(e){let t=this.inst[e];for(;t.op===H.NOP||t.op===H.CAPTURE;)t=this.inst[e],e=t.out;return t}prefix(){let e="",t=this.skipNop(this.start);if(!H.isRuneOp(t.op)||t.runes.length!==1)return[t.op===H.MATCH,e];for(;H.isRuneOp(t.op)&&t.runes.length===1&&(t.arg&$.FOLD_CASE)===0&&!ce.isUnsearchable(t.runes[0]);)e+=String.fromCodePoint(t.runes[0]),t=this.skipNop(t.out);return[t.op===H.MATCH,e]}startCond(){let e=0,t=this.start;e:for(;;){const n=this.inst[t];switch(n.op){case H.EMPTY_WIDTH:e|=n.arg;break;case H.FAIL:return-1;case H.CAPTURE:case H.NOP:break;default:break e}t=n.out}return e}patch(e,t){let n=e.head;for(;n!==0;){const r=this.inst[n>>1];(n&1)===0?(n=r.out,r.out=t):(n=r.arg,r.arg=t)}}append(e,t){if(e.head===0)return t;if(t.head===0)return e;const n=this.inst[e.tail>>1];return(e.tail&1)===0?n.out=t.head:n.arg=t.head,new In(e.head,t.tail)}toString(){let e="";for(let t=0;t<this.inst.length;t++){const n=e.length;e+=t,t===this.start&&(e+="*"),e+=" ".substring(e.length-n),e+=this.inst[t],e+=`
|
|
46
|
+
`}return e}},nW=new Int32Array([0,U.CODES.get(`
|
|
47
|
+
`)-1,U.CODES.get(`
|
|
48
|
+
`)+1,ce.MAX_RUNE]),vb=new Int32Array([0,ce.MAX_RUNE]),qc=class{constructor(e=0,t=new In,n=!1){this.i=e,this.out=t,this.nullable=n}},PA=class Vp{static compileRegexp(t){const n=new Vp,r=n.compile(t);return n.prog.patch(r.out,n.newInst(H.MATCH).i),n.prog.start=r.i,n.prog.markLookbehindInsts(),n.prog}static compileSet(t){const n=new Vp;if(t.length===0)return n.prog.start=n.newInst(H.FAIL).i,n.prog.markLookbehindInsts(),n.prog;let r=[];for(let i=0;i<t.length;i++){const o=n.compile(t[i]),a=n.newInst(H.MATCH);n.prog.getInst(a.i).arg=i,n.prog.patch(o.out,a.i),r.push(o.i)}let s=r[0];for(let i=1;i<r.length;i++){const o=n.newInst(H.ALT),a=n.prog.getInst(o.i);a.out=s,a.arg=r[i],s=o.i}return n.prog.start=s,n.prog.markLookbehindInsts(),n.prog}constructor(){this.prog=new tW,this.newInst(H.FAIL),this.runeCache=new Map,this.walker={leaf:t=>this.leaf(t),enter:t=>this.enter(t),child:(t,n,r)=>this.child(t,n,r),leave:(t,n)=>this.leave(t,n)}}newInst(t){return this.prog.addInst(t),new qc(this.prog.numInst()-1,new In,!0)}nop(){const t=this.newInst(H.NOP);return t.out=new In(t.i<<1,t.i<<1),t}fail(){return new qc}cap(t){const n=this.newInst(H.CAPTURE);return n.out=new In(n.i<<1,n.i<<1),this.prog.getInst(n.i).arg=t,this.prog.numCap<t+1&&(this.prog.numCap=t+1),n}cat(t,n){return t.i===0||n.i===0?this.fail():(this.prog.patch(t.out,n.i),new qc(t.i,n.out,t.nullable&&n.nullable))}alt(t,n){if(t.i===0)return n;if(n.i===0)return t;const r=this.newInst(H.ALT),s=this.prog.getInst(r.i);return s.out=t.i,s.arg=n.i,r.out=this.prog.append(t.out,n.out),r.nullable=t.nullable||n.nullable,r}loop(t,n){const r=this.newInst(H.ALT),s=this.prog.getInst(r.i);return n?(s.arg=t.i,r.out=new In(r.i<<1,r.i<<1)):(s.out=t.i,r.out=new In(r.i<<1|1,r.i<<1|1)),this.prog.patch(t.out,r.i),r}quest(t,n){const r=this.newInst(H.ALT),s=this.prog.getInst(r.i);return n?(s.arg=t.i,r.out=new In(r.i<<1,r.i<<1)):(s.out=t.i,r.out=new In(r.i<<1|1,r.i<<1|1)),r.out=this.prog.append(r.out,t.out),r}star(t,n){return t.nullable?this.quest(this.plus(t,n),n):this.loop(t,n)}plus(t,n){return new qc(t.i,this.loop(t,n).out,t.nullable)}empty(t){const n=this.newInst(H.EMPTY_WIDTH);return this.prog.getInst(n.i).arg=t,n.out=new In(n.i<<1,n.i<<1),n}rune(t,n){const r=this.newInst(H.RUNE);r.nullable=!1;const s=this.prog.getInst(r.i);return s.runes=t,n&=$.FOLD_CASE,(t.length!==1||ce.simpleFold(t[0])===t[0])&&(n&=~$.FOLD_CASE),s.arg=n,r.out=new In(r.i<<1,r.i<<1),(n&$.FOLD_CASE)===0&&t.length===1||t.length===2&&t[0]===t[1]?s.op=H.RUNE1:t.length===2&&t[0]===0&&t[1]===ce.MAX_RUNE?s.op=H.RUNE_ANY:t.length===4&&t[0]===0&&t[1]===U.CODES.get(`
|
|
49
|
+
`)-1&&t[2]===U.CODES.get(`
|
|
50
|
+
`)+1&&t[3]===ce.MAX_RUNE&&(s.op=H.RUNE_ANY_NOT_NL),r}lookBehind(t,n){const r=this.newInst(H.LB_WRITE);this.prog.getInst(r.i).arg=n;const s=this.rune(vb,0),i=this.star(s,!0),o=this.cat(i,t);this.prog.patch(o.out,r.i);const a=this.newInst(H.LB_CHECK);return this.prog.getInst(a.i).arg=n,this.prog.lbStarts.push(o.i),Math.abs(n)>this.prog.numLb&&(this.prog.numLb=Math.abs(n)),a.out=new In(a.i<<1,a.i<<1),a}compile(t){return jC.walk(t,this.walker)}leaf(t){switch(t.op){case k.Op.NO_MATCH:return this.fail();case k.Op.EMPTY_MATCH:return this.nop();case k.Op.LITERAL:{if(t.runes.length===0)return this.nop();let n=null;for(let r of t.runes){let s=this.runeCache.get(r);s===void 0&&(s=new Int32Array([r]),this.runeCache.set(r,s));const i=this.rune(s,t.flags);n=n===null?i:this.cat(n,i)}return n}case k.Op.CHAR_CLASS:return this.rune(t.runes,t.flags);case k.Op.ANY_CHAR_NOT_NL:return this.rune(nW,0);case k.Op.ANY_CHAR:return this.rune(vb,0);case k.Op.BEGIN_LINE:return this.empty(me.EMPTY_BEGIN_LINE);case k.Op.END_LINE:return this.empty(me.EMPTY_END_LINE);case k.Op.BEGIN_TEXT:return this.empty(me.EMPTY_BEGIN_TEXT);case k.Op.END_TEXT:return this.empty(me.EMPTY_END_TEXT);case k.Op.WORD_BOUNDARY:return this.empty(me.EMPTY_WORD_BOUNDARY);case k.Op.NO_WORD_BOUNDARY:return this.empty(me.EMPTY_NO_WORD_BOUNDARY);case k.Op.CONCAT:case k.Op.ALTERNATE:return this.nop();default:throw new Qa("regexp: unhandled case in compile")}}enter(t){switch(t.op){case k.Op.PLB:case k.Op.NLB:case k.Op.STAR:case k.Op.PLUS:case k.Op.QUEST:return{sub:null};case k.Op.CAPTURE:return{bra:this.cap(t.cap<<1),sub:null};case k.Op.CONCAT:case k.Op.ALTERNATE:return{f:null};default:throw new Qa("regexp: unhandled case in compile")}}child(t,n,r){t.op===k.Op.CONCAT?n.f=n.f===null?r:this.cat(n.f,r):t.op===k.Op.ALTERNATE?n.f=n.f===null?r:this.alt(n.f,r):n.sub=r}leave(t,n){switch(t.op){case k.Op.PLB:case k.Op.NLB:return this.lookBehind(n.sub,t.lb);case k.Op.CAPTURE:{const r=this.cap(t.cap<<1|1);return this.cat(this.cat(n.bra,n.sub),r)}case k.Op.STAR:return this.star(n.sub,(t.flags&$.NON_GREEDY)!==0);case k.Op.PLUS:return this.plus(n.sub,(t.flags&$.NON_GREEDY)!==0);case k.Op.QUEST:return this.quest(n.sub,(t.flags&$.NON_GREEDY)!==0);case k.Op.CONCAT:case k.Op.ALTERNATE:return n.f;default:throw new Qa("regexp: unhandled case in compile")}}},LA=class Ut{static simplify(t){return t===null?null:jC.walk(t,Ut.WALKER)}static WALKER={leaf:t=>Ut.leaf(t),enter:t=>Ut.enter(t),child:(t,n,r,s)=>Ut.child(t,n,r,s),leave:(t,n)=>Ut.leave(t,n)};static leaf(t){if(t.op===k.Op.CHAR_CLASS){if(t.runes===null)return t;if(t.runes.length===0)return new k(k.Op.NO_MATCH);if(t.runes.length===2&&t.runes[0]===0&&t.runes[1]===ce.MAX_RUNE)return new k(k.Op.ANY_CHAR);if(t.runes.length===4&&t.runes[0]===0&&t.runes[1]===U.CODES.get(`
|
|
51
|
+
`)-1&&t.runes[2]===U.CODES.get(`
|
|
52
|
+
`)+1&&t.runes[3]===ce.MAX_RUNE)return new k(k.Op.ANY_CHAR_NOT_NL)}return t}static enter(t){switch(t.op){case k.Op.PLB:case k.Op.NLB:case k.Op.CAPTURE:case k.Op.STAR:case k.Op.PLUS:case k.Op.QUEST:return{sub:null};case k.Op.CONCAT:case k.Op.ALTERNATE:return{subs:[],changed:!1};case k.Op.REPEAT:return t.min===0&&t.max===0?{result:new k(k.Op.EMPTY_MATCH)}:{sub:null};default:return{result:t}}}static child(t,n,r,s){if(n.subs===void 0){n.sub=r;return}if(r!==t.subs[s]&&(n.changed=!0),t.op===k.Op.CONCAT){if(r.op===k.Op.NO_MATCH){n.result=new k(k.Op.NO_MATCH);return}if(r.op===k.Op.EMPTY_MATCH){n.changed=!0;return}if(r.op===k.Op.CONCAT){n.changed=!0;for(let i=0;i<r.subs.length;i++)n.subs.push(r.subs[i]);return}}else{if(r.op===k.Op.NO_MATCH){n.changed=!0;return}if(r.op===k.Op.ALTERNATE){n.changed=!0;for(let i=0;i<r.subs.length;i++)n.subs.push(r.subs[i]);return}}n.subs.push(r)}static leave(t,n){switch(t.op){case k.Op.PLB:case k.Op.NLB:case k.Op.CAPTURE:{const r=n.sub;if(r!==t.subs[0]){const s=k.fromRegexp(t);return s.runes=new Int32Array(0),s.subs=[r],s}return t}case k.Op.CONCAT:case k.Op.ALTERNATE:if(n.changed){const r=n.subs;if(r.length===0)return new k(t.op===k.Op.CONCAT?k.Op.EMPTY_MATCH:k.Op.NO_MATCH);if(r.length===1)return r[0];const s=k.fromRegexp(t);return s.runes=new Int32Array(0),s.subs=r,s}return t;case k.Op.STAR:case k.Op.PLUS:case k.Op.QUEST:return Ut.simplify1(t.op,t.flags,n.sub,t);case k.Op.REPEAT:return Ut.simplifyRepeat(t,n.sub);default:return t}}static simplifyRepeat(t,n){if(t.max===-1){if(t.min===0)return Ut.simplify1(k.Op.STAR,t.flags,n,null);if(t.min===1)return Ut.simplify1(k.Op.PLUS,t.flags,n,null);const s=[];for(let i=0;i<t.min-1;i++)s.push(n);return s.push(Ut.simplify1(k.Op.PLUS,t.flags,n,null)),Ut.concat(s)}if(t.min===1&&t.max===1)return n;let r=null;if(t.min>0){r=[];for(let s=0;s<t.min;s++)r.push(n)}if(t.max>t.min){let s=Ut.simplify1(k.Op.QUEST,t.flags,n,null);for(let i=t.min+1;i<t.max;i++)s=Ut.simplify1(k.Op.QUEST,t.flags,Ut.concat([n,s]),null);if(r===null)return s;r.push(s)}return r!==null?Ut.concat(r):new k(k.Op.NO_MATCH)}static concat(t){const n=[];for(let s=0;s<t.length;s++){const i=t[s];if(i.op===k.Op.NO_MATCH)return new k(k.Op.NO_MATCH);if(i.op!==k.Op.EMPTY_MATCH){if(i.op===k.Op.CONCAT){for(let o=0;o<i.subs.length;o++)n.push(i.subs[o]);continue}n.push(i)}}if(n.length===0)return new k(k.Op.EMPTY_MATCH);if(n.length===1)return n[0];const r=new k(k.Op.CONCAT);return r.subs=n,r}static simplify1(t,n,r,s){if(r.op===k.Op.EMPTY_MATCH)return r;if(r.op===k.Op.NO_MATCH)return t===k.Op.PLUS?r:new k(k.Op.EMPTY_MATCH);if(t===r.op&&(n&$.NON_GREEDY)===(r.flags&$.NON_GREEDY))return r;if(s!==null&&s.op===t&&(s.flags&$.NON_GREEDY)===(n&$.NON_GREEDY)&&r===s.subs[0])return s;const i=new k(t);return i.flags=n,i.subs=[r],i}},Pe=class{constructor(e,t){this.sign=e,this.cls=t}},yb=[48,57],bb=[9,10,12,13,32,32],Sb=[48,57,65,90,95,95,97,122],Eb=new Map([["\\d",new Pe(1,yb)],["\\D",new Pe(-1,yb)],["\\s",new Pe(1,bb)],["\\S",new Pe(-1,bb)],["\\w",new Pe(1,Sb)],["\\W",new Pe(-1,Sb)]]),xb=[48,57,65,90,97,122],wb=[65,90,97,122],Db=[0,127],Tb=[9,9,32,32],Ab=[0,31,127,127],Ib=[48,57],kb=[33,126],Rb=[97,122],Ob=[32,126],Mb=[33,47,58,64,91,96,123,126],Nb=[9,13,32,32],Pb=[65,90],Lb=[48,57,65,90,95,95,97,122],_b=[48,57,65,70,97,102],Fb=new Map([["[:alnum:]",new Pe(1,xb)],["[:^alnum:]",new Pe(-1,xb)],["[:alpha:]",new Pe(1,wb)],["[:^alpha:]",new Pe(-1,wb)],["[:ascii:]",new Pe(1,Db)],["[:^ascii:]",new Pe(-1,Db)],["[:blank:]",new Pe(1,Tb)],["[:^blank:]",new Pe(-1,Tb)],["[:cntrl:]",new Pe(1,Ab)],["[:^cntrl:]",new Pe(-1,Ab)],["[:digit:]",new Pe(1,Ib)],["[:^digit:]",new Pe(-1,Ib)],["[:graph:]",new Pe(1,kb)],["[:^graph:]",new Pe(-1,kb)],["[:lower:]",new Pe(1,Rb)],["[:^lower:]",new Pe(-1,Rb)],["[:print:]",new Pe(1,Ob)],["[:^print:]",new Pe(-1,Ob)],["[:punct:]",new Pe(1,Mb)],["[:^punct:]",new Pe(-1,Mb)],["[:space:]",new Pe(1,Nb)],["[:^space:]",new Pe(-1,Nb)],["[:upper:]",new Pe(1,Pb)],["[:^upper:]",new Pe(-1,Pb)],["[:word:]",new Pe(1,Lb)],["[:^word:]",new Pe(-1,Lb)],["[:xdigit:]",new Pe(1,_b)],["[:^xdigit:]",new Pe(-1,_b)]]),ii=class ju{static charClassToString(t,n){let r="[";for(let s=0;s<n;s+=2){s>0&&(r+=" ");const i=t[s],o=t[s+1];i===o?r+=`0x${i.toString(16)}`:r+=`0x${i.toString(16)}-0x${o.toString(16)}`}return r+="]",r}static sortRanges(t,n){const r=n>>1,s=new Array(r);for(let o=0;o<r;o++)s[o]=o;s.sort((o,a)=>t[2*o]-t[2*a]||t[2*a+1]-t[2*o+1]);const i=t.slice(0,n);for(let o=0;o<r;o++)t[2*o]=i[2*s[o]],t[2*o+1]=i[2*s[o]+1]}constructor(t=me.emptyInts()){this.r=t,this.len=t.length}toArray(){return this.r instanceof Int32Array?this.len===this.r.length?this.r:this.r.subarray(0,this.len):new Int32Array(this.len===this.r.length?this.r:this.r.slice(0,this.len))}toGrowableArray(){return Array.isArray(this.r)?(this.r.length=this.len,this.r):Array.from(this.r.subarray(0,this.len))}cleanClass(){if(this.len<4)return this;ju.sortRanges(this.r,this.len);let t=2;for(let n=2;n<this.len;n+=2){const r=this.r[n],s=this.r[n+1];if(r<=this.r[t-1]+1){s>this.r[t-1]&&(this.r[t-1]=s);continue}this.r[t]=r,this.r[t+1]=s,t+=2}return this.len=t,this}appendLiteral(t,n){return(n&$.FOLD_CASE)!==0?this.appendFoldedRange(t,t):this.appendRange(t,t)}appendRange(t,n){if(this.len>0){for(let r=2;r<=4;r+=2)if(this.len>=r){const s=this.r[this.len-r],i=this.r[this.len-r+1];if(t<=i+1&&s<=n+1)return t<s&&(this.r[this.len-r]=t),n>i&&(this.r[this.len-r+1]=n),this}}return this.r[this.len++]=t,this.r[this.len++]=n,this}appendFoldedRange(t,n){if(t<=ce.MIN_FOLD&&n>=ce.MAX_FOLD)return this.appendRange(t,n);if(n<ce.MIN_FOLD||t>ce.MAX_FOLD)return this.appendRange(t,n);t<ce.MIN_FOLD&&(this.appendRange(t,ce.MIN_FOLD-1),t=ce.MIN_FOLD),n>ce.MAX_FOLD&&(this.appendRange(ce.MAX_FOLD+1,n),n=ce.MAX_FOLD);for(let r=t;r<=n;r++){this.appendRange(r,r);for(let s=ce.simpleFold(r);s!==r;s=ce.simpleFold(s))this.appendRange(s,s)}return this}appendClass(t){for(let n=0;n<t.length;n+=2)this.appendRange(t[n],t[n+1]);return this}appendFoldedClass(t){for(let n=0;n<t.length;n+=2)this.appendFoldedRange(t[n],t[n+1]);return this}appendNegatedClass(t){let n=0;for(let r=0;r<t.length;r+=2){const s=t[r],i=t[r+1];n<=s-1&&this.appendRange(n,s-1),n=i+1}return n<=ce.MAX_RUNE&&this.appendRange(n,ce.MAX_RUNE),this}appendTable(t){for(let n=0;n<t.length;++n){const r=t.getLo(n),s=t.getHi(n),i=t.getStride(n);if(i===1){this.appendRange(r,s);continue}for(let o=r;o<=s;o+=i)this.appendRange(o,o)}return this}appendNegatedTable(t){let n=0;for(let r=0;r<t.length;++r){const s=t.getLo(r),i=t.getHi(r),o=t.getStride(r);if(o===1){n<=s-1&&this.appendRange(n,s-1),n=i+1;continue}for(let a=s;a<=i;a+=o)n<=a-1&&this.appendRange(n,a-1),n=a+1}return n<=ce.MAX_RUNE&&this.appendRange(n,ce.MAX_RUNE),this}appendTableWithSign(t,n){return n<0?this.appendNegatedTable(t):this.appendTable(t)}negateClass(){let t=0,n=0;for(let r=0;r<this.len;r+=2){const s=this.r[r],i=this.r[r+1];t<=s-1&&(this.r[n]=t,this.r[n+1]=s-1,n+=2),t=i+1}return this.len=n,t<=ce.MAX_RUNE&&(this.r[this.len++]=t,this.r[this.len++]=ce.MAX_RUNE),this}appendClassWithSign(t,n){return n<0?this.appendNegatedClass(t):this.appendClass(t)}appendGroup(t,n){let r=t.cls;return n&&(r=new ju().appendFoldedClass(r).cleanClass().toArray()),this.appendClassWithSign(r,t.sign)}toString(){return ju.charClassToString(this.r,this.len)}},rW=class{constructor(e){this.str=e,this.position=0}pos(){return this.position}rewindTo(e){this.position=e}more(){return this.position<this.str.length}peek(){return this.str.codePointAt(this.position)}skip(e){this.position+=e}skipString(e){this.position+=e.length}pop(){const e=this.str.codePointAt(this.position);return this.position+=me.charCount(e),e}lookingAt(e){return this.str.startsWith(e,this.position)}rest(){return this.str.substring(this.position)}from(e){return this.str.substring(e,this.position)}toString(){return this.rest()}},Oa=class pe{static ERR_INTERNAL_ERROR="regexp/syntax: internal error";static ERR_INVALID_CHAR_RANGE="invalid character class range";static ERR_INVALID_ESCAPE="invalid escape sequence";static ERR_INVALID_NAMED_CAPTURE="invalid named capture";static ERR_INVALID_PERL_OP="invalid or unsupported Perl syntax";static ERR_INVALID_REPEAT_OP="invalid nested repetition operator";static ERR_INVALID_REPEAT_SIZE="invalid repeat count";static ERR_MISSING_BRACKET="missing closing ]";static ERR_MISSING_PAREN="missing closing )";static ERR_MISSING_REPEAT_ARGUMENT="missing argument to repetition operator";static ERR_TRAILING_BACKSLASH="trailing backslash at end of expression";static ERR_DUPLICATE_NAMED_CAPTURE="duplicate capture group name";static ERR_UNEXPECTED_PAREN="unexpected )";static ERR_NESTING_DEPTH="expression nests too deeply";static ERR_LARGE="expression too large";static ERR_INVALID_CAPTURE_IN_LOOKBEHIND="invalid capture in lookbehind";static MAX_HEIGHT=1e3;static MAX_SIZE=1398101;static MAX_RUNES=33554432;static ANY_TABLE=new T(new Uint32Array([0,ce.MAX_RUNE,1]));static ASCII_TABLE=new T(new Uint32Array([0,127,1]));static ASCII_FOLD_TABLE=new T(new Uint32Array([0,127,1,383,383,1,8490,8490,1]));static unicodeTable(t){return t==="Any"?{tab:pe.ANY_TABLE,fold:pe.ANY_TABLE,sign:1}:t==="Ascii"?{tab:pe.ASCII_TABLE,fold:pe.ASCII_FOLD_TABLE,sign:1}:t==="Assigned"?{tab:an.CATEGORIES.get("Cn"),fold:an.CATEGORIES.get("Cn"),sign:-1}:t==="Lc"?{tab:an.CATEGORIES.get("LC"),fold:an.FOLD_CATEGORIES.get("LC"),sign:1}:an.CATEGORIES.has(t)?{tab:an.CATEGORIES.get(t),fold:an.FOLD_CATEGORIES.get(t),sign:1}:an.SCRIPTS.has(t)?{tab:an.SCRIPTS.get(t),fold:an.FOLD_SCRIPT.get(t),sign:1}:null}static minFoldRune(t){if(t<ce.MIN_FOLD||t>ce.MAX_FOLD)return t;let n=t;const r=t;for(t=ce.simpleFold(t);t!==r;t=ce.simpleFold(t))n>t&&(n=t);return n}static leadingRegexp(t){if(t.op===k.Op.EMPTY_MATCH)return null;if(t.op===k.Op.CONCAT&&t.subs.length>0){const n=t.subs[0];return n.op===k.Op.EMPTY_MATCH?null:n}return t}static literalRegexp(t,n){const r=new k(k.Op.LITERAL);return r.flags=n,r.runes=me.stringToRunes(t),r}static parse(t,n){return new pe(t,n).parseInternal()}static parseRepeat(t){const n=t.pos();if(!t.more()||!t.lookingAt("{"))return-1;t.skip(1);const r=pe.parseInt(t);if(r===-1||!t.more())return-1;let s;if(!t.lookingAt(","))s=r;else{if(t.skip(1),!t.more())return-1;if(t.lookingAt("}"))s=-1;else if((s=pe.parseInt(t))===-1)return-1}if(!t.more()||!t.lookingAt("}"))return-1;if(t.skip(1),r<0||r>1e3||s===-2||s>1e3||s>=0&&r>s)throw new Ke(pe.ERR_INVALID_REPEAT_SIZE,t.from(n));return r<<16|s&ce.MAX_BMP}static isValidCaptureName(t){if(t.length===0)return!1;for(let n=0;n<t.length;n++){const r=t.codePointAt(n);if(r!==U.CODES.get("_")&&!me.isalnum(r))return!1}return!0}static parseInt(t){const n=t.pos();for(;t.more()&&t.peek()>=U.CODES.get("0")&&t.peek()<=U.CODES.get("9");)t.skip(1);const r=t.from(n);return r.length===0||r.length>1&&r.codePointAt(0)===U.CODES.get("0")?-1:r.length>8?-2:parseInt(r,10)}static isCharClass(t){return t.op===k.Op.LITERAL&&t.runes.length===1||t.op===k.Op.CHAR_CLASS||t.op===k.Op.ANY_CHAR_NOT_NL||t.op===k.Op.ANY_CHAR}static matchRune(t,n){switch(t.op){case k.Op.LITERAL:return t.runes.length===1&&t.runes[0]===n;case k.Op.CHAR_CLASS:for(let r=0;r<t.runes.length;r+=2)if(t.runes[r]<=n&&n<=t.runes[r+1])return!0;return!1;case k.Op.ANY_CHAR_NOT_NL:return n!==U.CODES.get(`
|
|
53
|
+
`);case k.Op.ANY_CHAR:return!0}return!1}static mergeCharClass(t,n){switch(t.op){case k.Op.ANY_CHAR:break;case k.Op.ANY_CHAR_NOT_NL:pe.matchRune(n,U.CODES.get(`
|
|
54
|
+
`))&&(t.op=k.Op.ANY_CHAR);break;case k.Op.CHAR_CLASS:{const r=new ii(Array.isArray(t.runes)?t.runes:Array.from(t.runes));n.op===k.Op.LITERAL?r.appendLiteral(n.runes[0],n.flags):r.appendClass(n.runes),t.runes=r.toGrowableArray();break}case k.Op.LITERAL:if(n.runes[0]===t.runes[0]&&n.flags===t.flags)break;t.op=k.Op.CHAR_CLASS,t.runes=new ii().appendLiteral(t.runes[0],t.flags).appendLiteral(n.runes[0],n.flags).toGrowableArray()}}static parseEscape(t){const n=t.pos();if(t.skip(1),!t.more())throw new Ke(pe.ERR_TRAILING_BACKSLASH);let r=t.pop();e:switch(r){case U.CODES.get("1"):case U.CODES.get("2"):case U.CODES.get("3"):case U.CODES.get("4"):case U.CODES.get("5"):case U.CODES.get("6"):case U.CODES.get("7"):if(!t.more()||t.peek()<U.CODES.get("0")||t.peek()>U.CODES.get("7"))break;case U.CODES.get("0"):{let s=r-U.CODES.get("0");for(let i=1;i<3&&!(!t.more()||t.peek()<U.CODES.get("0")||t.peek()>U.CODES.get("7"));i++)s=s*8+t.peek()-U.CODES.get("0"),t.skip(1);return s}case U.CODES.get("x"):{if(!t.more())break;if(r=t.pop(),r===U.CODES.get("{")){let o=0,a=0;for(;;){if(!t.more())break e;if(r=t.pop(),r===U.CODES.get("}"))break;const l=me.unhex(r);if(l<0||(a=a*16+l,a>ce.MAX_RUNE))break e;o++}if(o===0)break e;return a}const s=me.unhex(r);if(!t.more())break;r=t.pop();const i=me.unhex(r);if(s<0||i<0)break;return s*16+i}case U.CODES.get("a"):return U.CODES.get("\x07");case U.CODES.get("f"):return U.CODES.get("\f");case U.CODES.get("n"):return U.CODES.get(`
|
|
55
|
+
`);case U.CODES.get("r"):return U.CODES.get("\r");case U.CODES.get("t"):return U.CODES.get(" ");case U.CODES.get("v"):return U.CODES.get("\v");default:if(r<=ce.MAX_ASCII&&!me.isalnum(r))return r}throw new Ke(pe.ERR_INVALID_ESCAPE,t.from(n))}static parseClassChar(t,n){if(!t.more())throw new Ke(pe.ERR_MISSING_BRACKET,t.from(n));return t.lookingAt("\\")?pe.parseEscape(t):t.pop()}static hasCapture(t){if(t===null)return!1;if(t.op===k.Op.CAPTURE)return!0;if(t.subs){for(let n of t.subs)if(pe.hasCapture(n))return!0}return!1}constructor(t,n=0){this.wholeRegexp=t,this.flags=n,this.numCap=0,this.namedGroups=Object.create(null),this.stack=[],this.free=null,this.numRegexp=0,this.numRunes=0,this.repeats=0,this.height=null,this.size=null,this.nlb=0}newRegexp(t){let n=this.free;return n!==null&&n.subs!==null&&n.subs.length>0?(this.free=n.subs[0],n.reinit(),n.op=t):(n=new k(t),this.numRegexp+=1),n}reuse(t){this.height!==null&&this.height.has(t)&&this.height.delete(t),t.subs!==null&&t.subs.length>0&&(t.subs[0]=this.free),this.free=t}checkLimits(t){if(this.numRunes>pe.MAX_RUNES)throw new Ke(pe.ERR_LARGE);this.checkSize(t),this.checkHeight(t)}checkSize(t){if(this.size===null){if(this.repeats===0&&(this.repeats=1),t.op===k.Op.REPEAT){let n=t.max;n===-1&&(n=t.min),n<=0&&(n=1),n>Math.floor(pe.MAX_SIZE/this.repeats)?this.repeats=pe.MAX_SIZE:this.repeats*=n}if(this.numRegexp<Math.floor(pe.MAX_SIZE/this.repeats))return;this.size=new Map;for(let n of this.stack)this.checkSize(n)}if(this.calcSize(t,!0)>pe.MAX_SIZE)throw new Ke(pe.ERR_LARGE)}calcSize(t,n=!1){if(!n&&this.size!==null&&this.size.has(t))return this.size.get(t);let r=0;switch(t.op){case k.Op.LITERAL:r=t.runes.length;break;case k.Op.PLB:case k.Op.NLB:case k.Op.CAPTURE:case k.Op.STAR:r=2+this.calcSize(t.subs[0]);break;case k.Op.PLUS:case k.Op.QUEST:r=1+this.calcSize(t.subs[0]);break;case k.Op.CONCAT:for(let s of t.subs)r=r+this.calcSize(s);break;case k.Op.ALTERNATE:for(let s of t.subs)r=r+this.calcSize(s);t.subs.length>1&&(r=r+t.subs.length-1);break;case k.Op.REPEAT:{let s=this.calcSize(t.subs[0]);if(t.max===-1){t.min===0?r=2+s:r=1+t.min*s;break}r=t.max*s+(t.max-t.min);break}}return r=Math.max(1,r),this.size===null&&(this.size=new Map),this.size.set(t,r),r}checkHeight(t){if(!(this.numRegexp<pe.MAX_HEIGHT)){if(this.height===null){this.height=new Map;for(let n of this.stack)this.checkHeight(n)}if(this.calcHeight(t,!0)>pe.MAX_HEIGHT)throw new Ke(pe.ERR_NESTING_DEPTH)}}calcHeight(t,n=!1){if(!n&&this.height!==null&&this.height.has(t))return this.height.get(t);let r=1;for(let s of t.subs){const i=this.calcHeight(s);r<1+i&&(r=1+i)}return this.height===null&&(this.height=new Map),this.height.set(t,r),r}pop(){return this.stack.pop()}popToPseudo(){const t=this.stack.length;let n=t;for(;n>0&&!k.isPseudoOp(this.stack[n-1].op);)n--;return this.stack.splice(n,t-n)}push(t){if(this.numRunes+=t.runes.length,t.op===k.Op.CHAR_CLASS&&t.runes.length===2&&t.runes[0]===t.runes[1]){if(this.maybeConcat(t.runes[0],this.flags&~$.FOLD_CASE))return null;t.op=k.Op.LITERAL,t.runes=[t.runes[0]],t.flags=this.flags&~$.FOLD_CASE}else if(t.op===k.Op.CHAR_CLASS&&t.runes.length===4&&t.runes[0]===t.runes[1]&&t.runes[2]===t.runes[3]&&ce.simpleFold(t.runes[0])===t.runes[2]&&ce.simpleFold(t.runes[2])===t.runes[0]||t.op===k.Op.CHAR_CLASS&&t.runes.length===2&&t.runes[0]+1===t.runes[1]&&ce.simpleFold(t.runes[0])===t.runes[1]&&ce.simpleFold(t.runes[1])===t.runes[0]){if(this.maybeConcat(t.runes[0],this.flags|$.FOLD_CASE))return null;t.op=k.Op.LITERAL,t.runes=[t.runes[0]],t.flags=this.flags|$.FOLD_CASE}else this.maybeConcat(-1,0);return this.stack.push(t),this.checkLimits(t),t}maybeConcat(t,n){const r=this.stack.length;if(r<2)return!1;const s=this.stack[r-1],i=this.stack[r-2];if(s.op!==k.Op.LITERAL||i.op!==k.Op.LITERAL||(s.flags&$.FOLD_CASE)!==(i.flags&$.FOLD_CASE))return!1;Array.isArray(i.runes)||(i.runes=Array.from(i.runes));for(let o=0;o<s.runes.length;o++)i.runes.push(s.runes[o]);return t>=0?(s.runes=[t],s.flags=n,!0):(this.pop(),this.reuse(s),!1)}newLiteral(t,n){const r=this.newRegexp(k.Op.LITERAL);return r.flags=n,(n&$.FOLD_CASE)!==0&&(t=pe.minFoldRune(t)),r.runes=[t],r}literal(t){this.push(this.newLiteral(t,this.flags))}op(t){const n=this.newRegexp(t);return n.flags=this.flags,this.push(n)}repeat(t,n,r,s,i,o){let a=this.flags;if((a&$.PERL_X)!==0&&(i.more()&&i.lookingAt("?")&&(i.skip(1),a^=$.NON_GREEDY),o!==-1))throw new Ke(pe.ERR_INVALID_REPEAT_OP,i.from(o));const l=this.stack.length;if(l===0)throw new Ke(pe.ERR_MISSING_REPEAT_ARGUMENT,i.from(s));const c=this.stack[l-1];if(k.isPseudoOp(c.op))throw new Ke(pe.ERR_MISSING_REPEAT_ARGUMENT,i.from(s));const u=this.newRegexp(t);if(u.min=n,u.max=r,u.flags=a,u.subs=[c],this.stack[l-1]=u,this.checkLimits(u),t===k.Op.REPEAT&&(n>=2||r>=2)&&!this.repeatIsValid(u,1e3))throw new Ke(pe.ERR_INVALID_REPEAT_SIZE,i.from(s))}repeatIsValid(t,n){if(t.op===k.Op.REPEAT){let r=t.max;if(r===0)return!0;if(r<0&&(r=t.min),r>n)return!1;r>0&&(n=Math.trunc(n/r))}for(let r of t.subs)if(!this.repeatIsValid(r,n))return!1;return!0}concat(){this.maybeConcat(-1,0);const t=this.popToPseudo();return t.length===0?this.push(this.newRegexp(k.Op.EMPTY_MATCH)):this.push(this.collapse(t,k.Op.CONCAT))}alternate(){const t=this.popToPseudo();return t.length>0&&this.cleanAlt(t[t.length-1]),t.length===0?this.push(this.newRegexp(k.Op.NO_MATCH)):this.push(this.collapse(t,k.Op.ALTERNATE))}cleanAlt(t){t.op===k.Op.CHAR_CLASS&&(t.runes=new ii(Array.from(t.runes)).cleanClass().toArray(),t.runes.length===2&&t.runes[0]===0&&t.runes[1]===ce.MAX_RUNE?(t.runes=new Int32Array(0),t.op=k.Op.ANY_CHAR):t.runes.length===4&&t.runes[0]===0&&t.runes[1]===U.CODES.get(`
|
|
56
|
+
`)-1&&t.runes[2]===U.CODES.get(`
|
|
57
|
+
`)+1&&t.runes[3]===ce.MAX_RUNE&&(t.runes=new Int32Array(0),t.op=k.Op.ANY_CHAR_NOT_NL))}collapse(t,n){if(t.length===1)return t[0];let r=0;for(let a of t)r+=a.op===n?a.subs.length:1;let s=new Array(r).fill(null),i=0;for(let a of t)if(a.op===n){for(let l=0;l<a.subs.length;l++)s[i++]=a.subs[l];this.reuse(a)}else s[i++]=a;let o=this.newRegexp(n);if(o.subs=s,n===k.Op.ALTERNATE&&(o.subs=this.factor(o.subs),o.subs.length===1)){const a=o;o=o.subs[0],this.reuse(a)}return o}factor(t){if(t.length<2)return t;let n=0,r=t.length,s=0,i=null,o=0,a=0,l=0;for(let u=0;u<=r;u++){let d=null,h=0,f=0;if(u<r){let B=t[n+u];if(B.op===k.Op.CONCAT&&B.subs.length>0&&(B=B.subs[0]),B.op===k.Op.LITERAL&&(d=B.runes,h=B.runes.length,f=B.flags&$.FOLD_CASE),f===a){let g=0;for(;g<o&&g<h&&i[g]===d[g];)g++;if(g>0){o=g;continue}}}if(u!==l)if(u===l+1)t[s++]=t[n+l];else{const B=this.newRegexp(k.Op.LITERAL);B.flags=a,B.runes=i.slice(0,o);for(let v=l;v<u;v++)t[n+v]=this.removeLeadingString(t[n+v],o),this.checkLimits(t[n+v]);const g=this.collapse(t.slice(n+l,n+u),k.Op.ALTERNATE),C=this.newRegexp(k.Op.CONCAT);C.subs=[B,g],t[s++]=C}l=u,i=d,o=h,a=f}r=s,n=0,l=0,s=0;let c=null;for(let u=0;u<=r;u++){let d=null;if(!(u<r&&(d=pe.leadingRegexp(t[n+u]),c!==null&&c.equals(d)&&(pe.isCharClass(c)||c.op===k.Op.REPEAT&&c.min===c.max&&pe.isCharClass(c.subs[0]))))){if(u!==l)if(u===l+1)t[s++]=t[n+l];else{const h=c;for(let g=l;g<u;g++){const C=g!==l;t[n+g]=this.removeLeadingRegexp(t[n+g],C),this.checkLimits(t[n+g])}const f=this.collapse(t.slice(n+l,n+u),k.Op.ALTERNATE),B=this.newRegexp(k.Op.CONCAT);B.subs=[h,f],t[s++]=B}l=u,c=d}}r=s,n=0,l=0,s=0;for(let u=0;u<=r;u++)if(!(u<r&&pe.isCharClass(t[n+u]))){if(u!==l)if(u===l+1)t[s++]=t[n+l];else{let d=l;for(let f=l+1;f<u;f++){const B=t[n+d],g=t[n+f];(B.op<g.op||B.op===g.op&&(B.runes!==null?B.runes.length:0)<(g.runes!==null?g.runes.length:0))&&(d=f)}const h=t[n+l];t[n+l]=t[n+d],t[n+d]=h;for(let f=l+1;f<u;f++)pe.mergeCharClass(t[n+l],t[n+f]),this.reuse(t[n+f]);this.cleanAlt(t[n+l]),t[s++]=t[n+l]}u<r&&(t[s++]=t[n+u]),l=u+1}r=s,n=0,l=0,s=0;for(let u=0;u<r;++u)u+1<r&&t[n+u].op===k.Op.EMPTY_MATCH&&t[n+u+1].op===k.Op.EMPTY_MATCH||(t[s++]=t[n+u]);return r=s,n=0,t.slice(n,r)}removeLeadingString(t,n){if(t.op===k.Op.CONCAT&&t.subs.length>0){const r=this.removeLeadingString(t.subs[0],n);if(t.subs[0]=r,r.op===k.Op.EMPTY_MATCH)switch(this.reuse(r),t.subs.length){case 0:case 1:t.op=k.Op.EMPTY_MATCH,t.subs=k.emptySubs();break;case 2:{const s=t;t=t.subs[1],this.reuse(s);break}default:t.subs=t.subs.slice(1,t.subs.length)}return t}return t.op===k.Op.LITERAL&&(t.runes=t.runes.slice(n,t.runes.length),t.runes.length===0&&(t.op=k.Op.EMPTY_MATCH)),t}removeLeadingRegexp(t,n){if(t.op===k.Op.CONCAT&&t.subs.length>0){switch(n&&this.reuse(t.subs[0]),t.subs=t.subs.slice(1,t.subs.length),t.subs.length){case 0:t.op=k.Op.EMPTY_MATCH,t.subs=k.emptySubs();break;case 1:{const r=t;t=t.subs[0],this.reuse(r);break}}return t}return n&&this.reuse(t),this.newRegexp(k.Op.EMPTY_MATCH)}parseInternal(){if((this.flags&$.LITERAL)!==0)return pe.literalRegexp(this.wholeRegexp,this.flags);let t=-1,n=-1,r=-1;const s=new rW(this.wholeRegexp);for(;s.more();){let i=-1;e:switch(s.peek()){case U.CODES.get("("):if((this.flags&$.LOOKBEHIND)!==0){if(s.lookingAt("(?<=")){this.parsePosLookBehind(),s.skip(4);break}if(s.lookingAt("(?<!")){this.parseNegLookBehind(),s.skip(4);break}}if((this.flags&$.PERL_X)!==0&&s.lookingAt("(?")){this.parsePerlFlags(s);break}this.op(k.Op.LEFT_PAREN).cap=++this.numCap,s.skip(1);break;case U.CODES.get("|"):this.parseVerticalBar(),s.skip(1);break;case U.CODES.get(")"):this.parseRightParen(),s.skip(1);break;case U.CODES.get("^"):(this.flags&$.ONE_LINE)!==0?this.op(k.Op.BEGIN_TEXT):this.op(k.Op.BEGIN_LINE),s.skip(1);break;case U.CODES.get("$"):(this.flags&$.ONE_LINE)!==0?this.op(k.Op.END_TEXT).flags|=$.WAS_DOLLAR:this.op(k.Op.END_LINE),s.skip(1);break;case U.CODES.get("."):(this.flags&$.DOT_NL)!==0?this.op(k.Op.ANY_CHAR):this.op(k.Op.ANY_CHAR_NOT_NL),s.skip(1);break;case U.CODES.get("["):this.parseClass(s);break;case U.CODES.get("*"):case U.CODES.get("+"):case U.CODES.get("?"):{i=s.pos();let o=null;switch(s.pop()){case U.CODES.get("*"):o=k.Op.STAR;break;case U.CODES.get("+"):o=k.Op.PLUS;break;case U.CODES.get("?"):o=k.Op.QUEST}this.repeat(o,n,r,i,s,t);break}case U.CODES.get("{"):{i=s.pos();const o=pe.parseRepeat(s);if(o<0){s.rewindTo(i),this.literal(s.pop());break}n=o>>16,r=(o&ce.MAX_BMP)<<16>>16,this.repeat(k.Op.REPEAT,n,r,i,s,t);break}case U.CODES.get("\\"):{const o=s.pos();if(s.skip(1),(this.flags&$.PERL_X)!==0&&s.more())switch(s.pop()){case U.CODES.get("A"):this.op(k.Op.BEGIN_TEXT);break e;case U.CODES.get("b"):this.op(k.Op.WORD_BOUNDARY);break e;case U.CODES.get("B"):this.op(k.Op.NO_WORD_BOUNDARY);break e;case U.CODES.get("C"):throw new Ke(pe.ERR_INVALID_ESCAPE,"\\C");case U.CODES.get("Q"):{let c=s.rest();const u=c.indexOf("\\E");u>=0?(c=c.substring(0,u),s.skipString(c),s.skipString("\\E")):s.skipString(c);let d=0;for(;d<c.length;){const h=c.codePointAt(d);this.literal(h),d+=me.charCount(h)}break e}case U.CODES.get("z"):this.op(k.Op.END_TEXT);break e;default:s.rewindTo(o)}else s.rewindTo(o);const a=this.newRegexp(k.Op.CHAR_CLASS);if(a.flags=this.flags,s.lookingAt("\\p")||s.lookingAt("\\P")){const c=new ii;if(this.parseUnicodeClass(s,c)){a.runes=c.toArray(),this.push(a);break e}}const l=new ii;if(this.parsePerlClassEscape(s,l)){a.runes=l.toArray(),this.push(a);break e}s.rewindTo(o),this.reuse(a),this.literal(pe.parseEscape(s));break}default:this.literal(s.pop())}t=i}if(this.concat(),this.swapVerticalBar()&&this.pop(),this.alternate(),this.stack.length!==1)throw new Ke(pe.ERR_MISSING_PAREN,this.wholeRegexp);return this.stack[0].namedGroups=this.namedGroups,this.stack[0]}parsePerlFlags(t){const n=t.pos(),r=t.rest();if(r.startsWith("(?P<")||r.startsWith("(?<")){const a=r.charAt(2)==="P"?4:3,l=r.indexOf(">");if(l<0)throw new Ke(pe.ERR_INVALID_NAMED_CAPTURE,r);const c=r.substring(a,l);if(t.skipString(c),t.skip(a+1),!pe.isValidCaptureName(c))throw new Ke(pe.ERR_INVALID_NAMED_CAPTURE,r.substring(0,l+1));const u=this.op(k.Op.LEFT_PAREN);if(u.cap=++this.numCap,this.namedGroups[c])throw new Ke(pe.ERR_DUPLICATE_NAMED_CAPTURE,c);this.namedGroups[c]=this.numCap,u.name=c;return}t.skip(2);let s=this.flags,i=1,o=!1;e:for(;t.more();){const a=t.pop();switch(a){case U.CODES.get("i"):s|=$.FOLD_CASE,o=!0;break;case U.CODES.get("m"):s&=~$.ONE_LINE,o=!0;break;case U.CODES.get("s"):s|=$.DOT_NL,o=!0;break;case U.CODES.get("U"):s|=$.NON_GREEDY,o=!0;break;case U.CODES.get("-"):if(i<0)break e;i=-1,s=~s,o=!1;break;case U.CODES.get(":"):case U.CODES.get(")"):if(i<0){if(!o)break e;s=~s}a===U.CODES.get(":")&&this.op(k.Op.LEFT_PAREN),this.flags=s;return;default:break e}}throw new Ke(pe.ERR_INVALID_PERL_OP,t.from(n))}parsePosLookBehind(){const t=this.newRegexp(k.Op.LEFT_PAREN);return t.flags=this.flags,t.lb=++this.nlb,this.push(t)}parseNegLookBehind(){const t=this.newRegexp(k.Op.LEFT_PAREN);return t.flags=this.flags,t.lb=-++this.nlb,this.push(t)}parseVerticalBar(){this.concat(),this.swapVerticalBar()||this.op(k.Op.VERTICAL_BAR)}swapVerticalBar(){const t=this.stack.length;if(t>=3&&this.stack[t-2].op===k.Op.VERTICAL_BAR&&pe.isCharClass(this.stack[t-1])&&pe.isCharClass(this.stack[t-3])){let n=this.stack[t-1],r=this.stack[t-3];if(n.op>r.op){const s=r;r=n,n=s,this.stack[t-3]=r}return pe.mergeCharClass(r,n),this.reuse(n),this.pop(),!0}if(t>=2){const n=this.stack[t-1],r=this.stack[t-2];if(r.op===k.Op.VERTICAL_BAR)return t>=3&&this.cleanAlt(this.stack[t-3]),this.stack[t-2]=n,this.stack[t-1]=r,!0}return!1}parseRightParen(){if(this.concat(),this.swapVerticalBar()&&this.pop(),this.alternate(),this.stack.length<2)throw new Ke(pe.ERR_UNEXPECTED_PAREN,this.wholeRegexp);const t=this.pop(),n=this.pop();if(n.op!==k.Op.LEFT_PAREN)throw new Ke(pe.ERR_UNEXPECTED_PAREN,this.wholeRegexp);if(this.flags=n.flags,n.lb!==0){if(pe.hasCapture(t))throw new Ke(pe.ERR_INVALID_CAPTURE_IN_LOOKBEHIND,this.wholeRegexp);n.lb>0?n.op=k.Op.PLB:n.op=k.Op.NLB,n.subs=[t],this.push(n);return}n.cap===0?this.push(t):(n.op=k.Op.CAPTURE,n.subs=[t],this.push(n))}parsePerlClassEscape(t,n){const r=t.pos();if((this.flags&$.PERL_X)===0||!t.more()||t.pop()!==U.CODES.get("\\")||!t.more())return!1;t.pop();const s=t.from(r),i=Eb.has(s)?Eb.get(s):null;return i===null?!1:(n.appendGroup(i,(this.flags&$.FOLD_CASE)!==0),!0)}parseNamedClass(t,n){const r=t.rest(),s=r.indexOf(":]");if(s<0)return!1;const i=r.substring(0,s+2);t.skipString(i);const o=Fb.has(i)?Fb.get(i):null;if(o===null)throw new Ke(pe.ERR_INVALID_CHAR_RANGE,i);return n.appendGroup(o,(this.flags&$.FOLD_CASE)!==0),!0}parseUnicodeClass(t,n){const r=t.pos();if((this.flags&$.UNICODE_GROUPS)===0||!t.lookingAt("\\p")&&!t.lookingAt("\\P"))return!1;t.skip(1);let s=1,i=t.pop();if(i===U.CODES.get("P")&&(s=-1),!t.more())throw t.rewindTo(r),new Ke(pe.ERR_INVALID_CHAR_RANGE,t.rest());i=t.pop();let o;if(i!==U.CODES.get("{"))o=me.runeToString(i);else{const u=t.rest(),d=u.indexOf("}");if(d<0)throw t.rewindTo(r),new Ke(pe.ERR_INVALID_CHAR_RANGE,t.rest());o=u.substring(0,d),t.skipString(o),t.skip(1)}o.length!==0&&o.codePointAt(0)===U.CODES.get("^")&&(s=0-s,o=o.substring(1));const a=pe.unicodeTable(o);if(a===null)throw new Ke(pe.ERR_INVALID_CHAR_RANGE,t.from(r));a.sign<0&&(s=0-s);const l=a.tab,c=a.fold;if((this.flags&$.FOLD_CASE)===0||c===null)n.appendTableWithSign(l,s);else{const u=new ii().appendTable(l).appendTable(c).cleanClass().toArray();n.appendClassWithSign(Array.from(u),s)}return!0}parseClass(t){const n=t.pos();t.skip(1);const r=this.newRegexp(k.Op.CHAR_CLASS);r.flags=this.flags;const s=new ii;let i=1;t.more()&&t.lookingAt("^")&&(i=-1,t.skip(1),(this.flags&$.CLASS_NL)===0&&s.appendRange(U.CODES.get(`
|
|
58
|
+
`),U.CODES.get(`
|
|
59
|
+
`)));let o=!0;for(;!t.more()||t.peek()!==U.CODES.get("]")||o;){if(t.more()&&t.lookingAt("-")&&(this.flags&$.PERL_X)===0&&!o){const u=t.rest();if(u==="-"||!u.startsWith("-]"))throw t.rewindTo(n),new Ke(pe.ERR_INVALID_CHAR_RANGE,t.rest())}o=!1;const a=t.pos();if(t.lookingAt("[:")){if(this.parseNamedClass(t,s))continue;t.rewindTo(a)}if(this.parseUnicodeClass(t,s)||this.parsePerlClassEscape(t,s))continue;t.rewindTo(a);const l=pe.parseClassChar(t,n);let c=l;if(t.more()&&t.lookingAt("-")){if(t.skip(1),t.more()&&t.lookingAt("]"))t.skip(-1);else if(c=pe.parseClassChar(t,n),c<l)throw new Ke(pe.ERR_INVALID_CHAR_RANGE,t.from(a))}(this.flags&$.FOLD_CASE)===0?s.appendRange(l,c):s.appendFoldedRange(l,c)}t.skip(1),s.cleanClass(),i<0&&s.negateClass(),r.runes=s.toArray(),this.push(r)}},sW=class Bi{static initTest(t){const n=Bi.compile(t),r=new Bi(n.expr,n.prog,n.numSubexp,n.longest);return r.cond=n.cond,r.prefix=n.prefix,r.prefixUTF8=n.prefixUTF8,r.prefixComplete=n.prefixComplete,r.prefixRune=n.prefixRune,r.prefilter=n.prefilter,r}static compile(t){return Bi.compileImpl(t,$.PERL,!1)}static compilePOSIX(t){return Bi.compileImpl(t,$.POSIX,!0)}static compileImpl(t,n,r){let s=Oa.parse(t,n);const i=s.maxCap();s=LA.simplify(s);const o=eW.build(s),a=PA.compileRegexp(s),l=new Bi(t,a,i,r);l.prefilter=o.type===De.Type.NONE?null:o;const[c,u]=a.prefix();return l.prefixComplete=c,l.prefix=u,l.prefixUTF8=me.stringToUtf8ByteArray(l.prefix),l.prefix.length>0&&(l.prefixRune=l.prefix.codePointAt(0)),l.namedGroups=s.namedGroups,l}static match(t,n){return Bi.compile(t).match(n)}constructor(t,n,r=0,s=0){this.expr=t,this.prog=n,this.numSubexp=r,this.longest=s,this.cond=n.startCond(),this.prefix=null,this.prefixUTF8=null,this.prefixComplete=!1,this.prefixRune=0,this.machinePool=[],this.dfa=new OA(this.prog),this.onepass=gb.compile(this.prog),this.prefilter=null}matchPrefixComplete(t,n,r,s){if((r===$.ANCHOR_START||r===$.ANCHOR_BOTH)&&n!==0)return null;let i=-1,o=-1;const a=t.prefixLength(this);if(r===$.UNANCHORED){const l=t.index(this,n);if(l<0)return null;i=n+l,o=i+a}else if(r===$.ANCHOR_BOTH){if(t.endPos()!==a||t.index(this,0)!==0)return null;i=0,o=a}else if(r===$.ANCHOR_START){if(t.index(this,0)!==0)return null;i=0,o=a}if(i<0)return null;if(s>0){const l=new Int32Array(s).fill(-1);return l[0]=i,l[1]=o,Array.from(l)}return[]}createLookbehindState(){return this.prog.numLb>0?new G4(this.prog):null}executeEngine(t,n,r,s,i=null){if(this.prefixComplete&&(s===0||this.numSubexp===0))return this.matchPrefixComplete(t,n,r,s);if(this.prefilter!==null&&r===$.UNANCHORED&&!this.prefilter.eval(t,n))return null;if(this.onepass!==null)return gb.execute(this,t,n,r,s);if(s>0)return this.prog.numLb===0&&t.endPos()<=Wc.maxBitStateLen(this.prog)?Wc.execute(this,t,n,r,s):this.doExecuteNFA(t,n,r,s,i);if(this.prog.numLb===0){const o=this.dfa.match(t,n,r);if(o!==null)return o?[]:null;if(t.endPos()<=Wc.maxBitStateLen(this.prog))return Wc.execute(this,t,n,r,s)}return this.doExecuteNFA(t,n,r,s,i)}numberOfCapturingGroups(){return this.numSubexp}numberOfInstructions(){return this.prog.numInst()}get(){return this.machinePool.length>0?this.machinePool.pop():null}reset(){this.machinePool.length=0}put(t){this.machinePool.push(t)}toString(){return this.expr}doExecuteNFA(t,n,r,s,i=null){let o=this.get();o||(o=kA.fromRE2(this)),o.init(s);const a=o.match(t,n,r,i)?o.submatches():null;return this.put(o),a}match(t){return this.executeEngine($e.fromUTF16(t),0,$.UNANCHORED,0)!==null}matchWithGroup(t,n,r,s,i,o=null){return t instanceof Pi||(me.isByteArray(t)?t=vi.utf8(t):t=vi.utf16(t)),this.matchMachineInput(t,n,r,s,i,o)}matchMachineInput(t,n,r,s,i,o=null){if(n>r)return[!1,null];const a=t.isUTF16Encoding()?$e.fromUTF16(t.asCharSequence(),0,r):$e.fromUTF8(t.asBytes(),0,r),l=this.executeEngine(a,n,s,2*i,o);return l===null?[!1,null]:[!0,l]}matchUTF8(t){return this.executeEngine($e.fromUTF8(t),0,$.UNANCHORED,0)!==null}replaceAll(t,n){return this.replaceAllFunc(t,()=>n,2*t.length+1)}replaceFirst(t,n){return this.replaceAllFunc(t,()=>n,1)}replaceAllFunc(t,n,r){let s=0,i=0,o="";const a=$e.fromUTF16(t),l=this.createLookbehindState();let c=0;for(;i<=t.length;){const u=this.executeEngine(a,i,$.UNANCHORED,2,l);if(u===null||u.length===0)break;o+=t.substring(s,u[0]),(u[1]>s||u[0]===0)&&(o+=n(t.substring(u[0],u[1])),c++),s=u[1];const d=a.step(i)&7;if(i+d>u[1]?i+=d:i+1>u[1]?i++:i=u[1],c>=r)break}return o+=t.substring(s),o}pad(t){if(t===null)return null;let n=(1+this.numSubexp)*2;if(t.length<n){let r=new Array(n).fill(-1);for(let s=0;s<t.length;s++)r[s]=t[s];t=r}return t}allMatches(t,n,r=s=>s){let s=[];const i=t.endPos();n<0&&(n=i+1);let o=0,a=0,l=-1;const c=this.createLookbehindState();for(;a<n&&o<=i;){const u=this.executeEngine(t,o,$.UNANCHORED,this.prog.numCap,c);if(u===null||u.length===0)break;let d=!0;if(u[1]===o){u[0]===l&&(d=!1);const h=t.step(o);h<0?o=i+1:o+=h&7}else o=u[1];l=u[1],d&&(s.push(r(this.pad(u))),a++)}return s}findUTF8(t){const n=this.executeEngine($e.fromUTF8(t),0,$.UNANCHORED,2);return n===null?null:t.slice(n[0],n[1])}findUTF8Index(t){const n=this.executeEngine($e.fromUTF8(t),0,$.UNANCHORED,2);return n===null?null:n.slice(0,2)}find(t){const n=this.executeEngine($e.fromUTF16(t),0,$.UNANCHORED,2);return n===null?"":t.substring(n[0],n[1])}findIndex(t){return this.executeEngine($e.fromUTF16(t),0,$.UNANCHORED,2)}findUTF8Submatch(t){const n=this.executeEngine($e.fromUTF8(t),0,$.UNANCHORED,this.prog.numCap);if(n===null)return null;const r=new Array(1+this.numSubexp).fill(null);for(let s=0;s<r.length;s++)2*s<n.length&&n[2*s]>=0&&(r[s]=t.slice(n[2*s],n[2*s+1]));return r}findUTF8SubmatchIndex(t){return this.pad(this.executeEngine($e.fromUTF8(t),0,$.UNANCHORED,this.prog.numCap))}findSubmatch(t){const n=this.executeEngine($e.fromUTF16(t),0,$.UNANCHORED,this.prog.numCap);if(n===null)return null;const r=new Array(1+this.numSubexp).fill(null);for(let s=0;s<r.length;s++)2*s<n.length&&n[2*s]>=0&&(r[s]=t.substring(n[2*s],n[2*s+1]));return r}findSubmatchIndex(t){return this.pad(this.executeEngine($e.fromUTF16(t),0,$.UNANCHORED,this.prog.numCap))}findAllUTF8(t,n){const r=this.allMatches($e.fromUTF8(t),n,s=>t.slice(s[0],s[1]));return r.length===0?null:r}findAllUTF8Index(t,n){const r=this.allMatches($e.fromUTF8(t),n,s=>s.slice(0,2));return r.length===0?null:r}findAll(t,n){const r=this.allMatches($e.fromUTF16(t),n,s=>t.substring(s[0],s[1]));return r.length===0?null:r}findAllIndex(t,n){const r=this.allMatches($e.fromUTF16(t),n,s=>s.slice(0,2));return r.length===0?null:r}findAllUTF8Submatch(t,n){const r=this.allMatches($e.fromUTF8(t),n,s=>{let i=new Array(s.length/2|0).fill(null);for(let o=0;o<i.length;o++)s[2*o]>=0&&(i[o]=t.slice(s[2*o],s[2*o+1]));return i});return r.length===0?null:r}findAllUTF8SubmatchIndex(t,n){const r=this.allMatches($e.fromUTF8(t),n);return r.length===0?null:r}findAllSubmatch(t,n){const r=this.allMatches($e.fromUTF16(t),n,s=>{let i=new Array(s.length/2|0).fill(null);for(let o=0;o<i.length;o++)s[2*o]>=0&&(i[o]=t.substring(s[2*o],s[2*o+1]));return i});return r.length===0?null:r}findAllSubmatchIndex(t,n){const r=this.allMatches($e.fromUTF16(t),n);return r.length===0?null:r}},nie=class Gu{static UNANCHORED=$.UNANCHORED;static ANCHOR_START=$.ANCHOR_START;static ANCHOR_BOTH=$.ANCHOR_BOTH;constructor(t=Gu.UNANCHORED,n=0,r=8388608){this.anchor=t,this.jsFlags=n,this.maxMem=r;let s=$.PERL;(n&Yn.DISABLE_UNICODE_GROUPS)!==0&&(s&=~$.UNICODE_GROUPS),(n&Yn.LOOKBEHINDS)!==0&&(s|=$.LOOKBEHIND),this.re2Flags=s,this.regexps=[],this.prog=null,this.dfa=null,this.dummyRe2=null}add(t){if(this.prog)throw new Qa("Cannot add patterns after compile");let n=t;(this.jsFlags&Yn.CASE_INSENSITIVE)!==0&&(n=`(?i)${n}`),(this.jsFlags&Yn.DOTALL)!==0&&(n=`(?s)${n}`),(this.jsFlags&Yn.MULTILINE)!==0&&(n=`(?m)${n}`);const r=Oa.parse(n,this.re2Flags);return this.regexps.push(LA.simplify(r)),this.regexps.length-1}compile(){if(this.prog)return;const t=PA.compileSet(this.regexps);if(t.numInst()>Oa.MAX_SIZE)throw new Qa(`${Oa.ERR_LARGE}: the set compiles to ${t.numInst()} instructions, more than ${Oa.MAX_SIZE}`);this.prog=t,this.dfa=new OA(this.prog,this.maxMem),this.dummyRe2={prog:this.prog,cond:this.prog.startCond(),prefix:"",prefixRune:0,longest:!1}}match(t){this.prog||this.compile();const n=me.isByteArray(t)?$e.fromUTF8(t):$e.fromUTF16(t);let r=$.UNANCHORED;this.anchor===Gu.ANCHOR_START?r=$.ANCHOR_START:this.anchor===Gu.ANCHOR_BOTH&&(r=$.ANCHOR_BOTH);const s=this.dfa.matchSet(n,0,r);if(s!==null)return s;const i=kA.fromRE2(this.dummyRe2);return i.init(0),i.matchSet(n,0,r)}},iW=class ao{static isHexadecimal(t){return"0"<=t&&t<="9"||"A"<=t&&t<="F"||"a"<=t&&t<="f"}static translate(t){let n="";if(t instanceof RegExp&&(t.ignoreCase&&(n+="i"),t.multiline&&(n+="m"),t.dotAll&&(n+="s"),t=t.source),typeof t!="string")return t;let r="",s=!1,i=t.length;i===0&&(r="(?:)",s=!0);let o=!1,a=0;for(;a<i;){let c=t[a];if(c==="\\"){if(a+1<i)switch(c=t[a+1],c){case"\\":r+="\\\\",a+=2;continue;case"c":if(a+2<i){let h=t[a+2].charCodeAt(0);if(h>=65&&h<=90||h>=97&&h<=122){let f=h%32;r+="\\x",r+=(f>>4).toString(16).toUpperCase(),r+=(f&15).toString(16).toUpperCase(),a+=3,s=!0;continue}}r+="c",a+=2,s=!0;continue;case"u":if(a+2<i){if(t[a+2]==="{"){let h=a+3,f=!1,B=!1;for(;h<i;){const g=t[h];if(g==="}"){B=!0;break}if(!ao.isHexadecimal(g))break;f=!0,h++}if(B&&f){r+="\\x",a+=2,s=!0;continue}}else if(a+5<i){let h=!0;for(let f=0;f<4;f++)if(!ao.isHexadecimal(t[a+2+f])){h=!1;break}if(h){r+="\\x{"+t.substring(a+2,a+6)+"}",a+=6,s=!0;continue}}}r+="u",a+=2,s=!0;continue;case"x":{let h=!1;if(a+2<i&&t[a+2]==="{"){let f=a+3,B=!1,g=!1;for(;f<i;){const C=t[f];if(C==="}"){g=!0;break}if(!ao.isHexadecimal(C))break;B=!0,f++}g&&B&&(h=!0)}else a+3<i&&ao.isHexadecimal(t[a+2])&&ao.isHexadecimal(t[a+3])&&(h=!0);h?(r+="\\x",a+=2):(r+="x",a+=2,s=!0);continue}case"n":case"r":case"t":case"a":case"f":case"v":case"d":case"D":case"s":case"S":case"w":case"W":case"b":case"B":case"p":case"P":case"A":case"z":case"Q":case"E":case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":r+="\\"+c,a+=2;continue;default:{let h=t.codePointAt(a+1);if(h>=48&&h<=57||h>=65&&h<=90||h>=97&&h<=122){let f=me.charCount(h);r+=t.substring(a+1,a+1+f),a+=f+1,s=!0}else{r+="\\";let f=me.charCount(h);r+=t.substring(a+1,a+1+f),a+=f+1}continue}}}else if(c==="/"){r+="\\/",a+=1,s=!0;continue}else if(c==="[")o=!0;else if(c==="]")o=!1;else if(!o&&c==="("&&a+2<i&&t[a+1]==="?"&&t[a+2]==="<"&&a+3<i&&!"=!>)".includes(t[a+3])){r+="(?P<",a+=3,s=!0;continue}let u=t.codePointAt(a),d=me.charCount(u);r+=t.substring(a,a+d),a+=d}const l=s?r:t;return n.length>0?`(?${n})${l}`:l}},Xa=class zt{static CASE_INSENSITIVE=Yn.CASE_INSENSITIVE;static DOTALL=Yn.DOTALL;static MULTILINE=Yn.MULTILINE;static DISABLE_UNICODE_GROUPS=Yn.DISABLE_UNICODE_GROUPS;static LONGEST_MATCH=Yn.LONGEST_MATCH;static LOOKBEHINDS=Yn.LOOKBEHINDS;static quote(t){return me.quoteMeta(t)}static quoteReplacement(t,n=!1){return Bb.quoteReplacement(t,n)}static translateRegExp(t){return iW.translate(t)}static compile(t,n=0){let r=t;if((n&zt.CASE_INSENSITIVE)!==0&&(r=`(?i)${r}`),(n&zt.DOTALL)!==0&&(r=`(?s)${r}`),(n&zt.MULTILINE)!==0&&(r=`(?m)${r}`),(n&~(zt.MULTILINE|zt.DOTALL|zt.CASE_INSENSITIVE|zt.DISABLE_UNICODE_GROUPS|zt.LONGEST_MATCH|zt.LOOKBEHINDS))!==0)throw new j4("Flags should only be a combination of MULTILINE, DOTALL, CASE_INSENSITIVE, DISABLE_UNICODE_GROUPS, LONGEST_MATCH, LOOKBEHINDS");let s=$.PERL;(n&zt.DISABLE_UNICODE_GROUPS)!==0&&(s&=~$.UNICODE_GROUPS),(n&zt.LOOKBEHINDS)!==0&&(s|=$.LOOKBEHIND);const i=new zt(t,n);return i.re2Input=sW.compileImpl(r,s,(n&zt.LONGEST_MATCH)!==0),i}static matches(t,n){return zt.compile(t).testExact(n)}static initTest(t,n,r){if(t==null)throw new Error("pattern is null");if(r==null)throw new Error("re2 is null");const s=new zt(t,n);return s.re2Input=r,s}constructor(t,n){this.patternInput=t,this.flagsInput=n,this.re2Input=null}reset(){this.re2Input.reset()}flags(){return this.flagsInput}pattern(){return this.patternInput}re2(){return this.re2Input}matches(t){return this.testExact(t)}matcher(t){return me.isByteArray(t)&&(t=vi.utf8(t)),new Bb(this,t)}test(t){return me.isByteArray(t)?this.re2Input.matchUTF8(t):this.re2Input.match(t)}testExact(t){const n=me.isByteArray(t)?$e.fromUTF8(t):$e.fromUTF16(t);return this.re2Input.executeEngine(n,0,$.ANCHOR_BOTH,0)!==null}exec(t){const n=this.matcher(t);if(!n.find())return null;const r=[n.group(0)];for(let i=1;i<=n.groupCount();i++){const o=n.group(i);r.push(o===null?void 0:o)}r.index=n.start(0),r.input=t;const s=this.namedGroups();if(Object.keys(s).length>0){const i=n.getNamedGroups();for(const o in i)i[o]===null&&(i[o]=void 0);r.groups=i}else r.groups=void 0;return r}split(t,n=0){const r=this.matcher(t),s=[];let i=0,o=0;for(;r.find();){if(o===0&&r.end()===0){o=r.end();continue}if(n>0&&s.length===n-1)break;if(o===r.start()){if(n===0){i+=1,o=r.end();continue}}else for(;i>0;)s.push(""),i-=1;s.push(r.substring(o,r.start())),o=r.end()}if(n===0&&o!==r.inputLength()){for(;i>0;)s.push(""),i-=1;s.push(r.substring(o,r.inputLength()))}return(n!==0||s.length===0&&!(o===r.inputLength()&&o>0))&&s.push(r.substring(o,r.inputLength())),s}*matchAll(t){const n=this.matcher(t);for(;n.find();){const r=[n.group(0)];for(let i=1;i<=n.groupCount();i++){const o=n.group(i);r.push(o===null?void 0:o)}r.index=n.start(0),r.input=t;const s=this.namedGroups();if(Object.keys(s).length>0){const i=n.getNamedGroups();for(const o in i)i[o]===null&&(i[o]=void 0);r.groups=i}else r.groups=void 0;yield r}}toString(){return this.patternInput}programSize(){return this.re2Input.numberOfInstructions()}groupCount(){return this.re2Input.numberOfCapturingGroups()}namedGroups(){return this.re2Input.namedGroups}equals(t){return this===t?!0:t===null||this.constructor!==t.constructor?!1:this.flagsInput===t.flagsInput&&this.patternInput===t.patternInput}},_A=1e5,oW=4e6,rie={implementationVersion:1,algorithm:"levenshtein-code-points",maxCells:oW,maxInputChars:_A};function aW(e,t){let n=t.caseSensitive?e:e.toLowerCase();return t.normalizeWhitespace&&(n=n.replace(/\s+/gu," ").trim()),n}var FA=/^\/(?:[^/~]|~[01])+$/,HA=1e5,lW=["i","m","s","im","is","ms","ims"],sie={implementationVersion:1,engine:"re2js",encoding:"canonical-json-bounded",maxSubjectChars:HA},iie={implementationVersion:1,engine:"re2js",encoding:"canonical-json-bounded",maxSubjectChars:HA,subject:"text,structuredContent,json",pathSource:"structuredContent,json"};function cW(e){let t=0;return e?.includes("i")&&(t|=Xa.CASE_INSENSITIVE),e?.includes("m")&&(t|=Xa.MULTILINE),e?.includes("s")&&(t|=Xa.DOTALL),t}function uW(e,t){try{return{ok:!0,compiled:Xa.compile(Xa.translateRegExp(e),cW(t))}}catch(n){return{ok:!1,message:n instanceof Error?n.message:String(n)}}}function dW(e,t){const n=uW(e,t);return n.ok?void 0:n.message}function hW(e,t,n){if(e===0&&t===void 0)return{path:"min",message:`min: 0 needs a max; on its own it passes every transcript (use max: 0 for "no ${n} matches")`};if(t!==void 0&&t<(e??1))return{path:"max",message:`max must be at least min (${e??1}${e===void 0?", the default":""})`}}function fW(e){if(typeof e!="string")return"path must be a string";if(e.length===0)return'path "" is the whole value; omit path instead';if(e.length<2||e.length>257)return'path must be 2 to 257 characters: "/" and the key, e.g. "/elements"';if(!e.startsWith("/"))return'path must be a JSON Pointer that starts with "/", e.g. "/elements"';if(e.indexOf("/",1)!==-1)return'path must name exactly one top-level key; nested paths are not supported yet (write a "/" inside a key as ~1)';if(!FA.test(e))return'path has an invalid escape: "~" must be followed by 0 or 1'}function oie(e){const t=fW(e);return t!==void 0?{ok:!1,message:t}:{ok:!0,key:e.slice(1).replace(/~1/g,"/").replace(/~0/g,"~")}}function aie(e){return`/${e.replace(/~/g,"~0").replace(/\//g,"~1")}`}function lie(e,t){const{min:n,max:r}=e;return r===void 0?`at least ${n} matching ${t}(s)`:r===0?`no matching ${t}`:n===r?`exactly ${n} matching ${t}(s)`:n===0?`at most ${r} matching ${t}(s)`:`${n} to ${r} matching ${t}s`}var jA=["toolCalledWith","toolCalledAtLeastOnce","toolNeverCalled","onlyToolsCalled","firstToolWas","responseCloseTo","responseContains","responseMatches","noToolErrors","finalAssistantMessageNonEmpty","widgetRendered","widgetRenderLatencyUnder","widgetNoConsoleErrors","noEndingQuestion","toolCallCountUnder","toolCalledBefore","noRepeatedIdenticalCall","toolInputMatches"];function BW(e){return jA.includes(e)}var GA=["widgetRendered","widgetRenderLatencyUnder","widgetNoConsoleErrors"];function pW(e){return GA.includes(e)}var VA=["noDeprecatedToolExposed","noEndingQuestion","noRepeatedIdenticalCall","noDeprecatedToolCalled","toolErrorNamesInput","fullPageHasContinuation"];function UA(e){return VA.includes(e)}var zA=1e3,Up=16384;function mW(e){try{const t=JSON.stringify(e);return t===void 0?1/0:new TextEncoder().encode(t).length}catch{return 1/0}}var gW=["any","string","number","boolean","object","array","null"],$A=w({args:nr(b(),Ln()),argumentMatching:V(["exact","partial","ignore"]).optional()});var Me={role:V(["gating","advisory","required"]).optional(),severity:L("warn").optional(),evaluator:ls({id:b().min(1).max(64),version:M().int().positive()}).optional()},Za=Hn([L("declared"),nr(b(),Ln()),oe()]),Hb={patterns:K(b().min(1).max(512)).min(1).max(8),flags:V(lW).optional(),path:b().min(2).max(257).regex(FA,{message:'path must be a one-key JSON Pointer such as "/elements" ("~1" writes "/" and "~0" writes "~" inside the key)'}).optional(),min:M().int().nonnegative().optional(),max:M().int().nonnegative().optional()};function jb(e){return(t,n)=>{t.patterns.forEach((s,i)=>{const o=dW(s,t.flags);o!==void 0&&n.addIssue({code:ts.custom,path:["patterns",i],message:`pattern does not compile in re2js: ${o}`})});const r=hW(t.min,t.max,e);r&&n.addIssue({code:ts.custom,path:[r.path],message:r.message})}}var GC=ft("type",[w({type:L("toolDescriptionsPresent"),minLength:M().int().positive().optional(),...Me}),w({type:L("toolAnnotationsPresent"),require:K(V(["readOnlyHint","destructiveHint"])).max(2).refine(e=>new Set(e).size===e.length,"Annotation keys must be unique").optional(),...Me}),w({type:L("toolNamesUnique"),...Me}),w({type:L("noDeprecatedToolExposed"),...Me}),w({type:L("toolInputSchemasWellFormed"),...Me}),w({type:L("toolOutputSchemasPresent"),...Me}),w({type:L("toolCalledWith"),toolName:b().min(1),args:$A,minCount:M().int().positive().optional(),...Me}),w({type:L("toolCalledAtLeastOnce"),toolName:b().min(1),...Me}),w({type:L("toolNeverCalled"),toolName:b().min(1),...Me}),w({type:L("onlyToolsCalled"),toolNames:K(b().min(1)),...Me}),w({type:L("firstToolWas"),toolName:b().min(1),...Me}),w({type:L("responseCloseTo"),reference:b().min(1).max(_A),maxDistance:M().finite().min(0).max(1),caseSensitive:oe().optional(),normalizeWhitespace:oe().optional(),...Me}),w({type:L("responseContains"),needle:b().min(1),caseSensitive:oe().optional(),...Me}),w({type:L("responseMatches"),pattern:b().min(1).refine(e=>{try{return new RegExp(e),!0}catch{return!1}},{message:"Invalid regular expression"}),...Me}),w({type:L("noToolErrors"),...Me}),w({type:L("finalAssistantMessageNonEmpty"),...Me}),w({type:L("tokenBudgetUnder"),tokens:M().int().positive(),...Me}),w({type:L("widgetRendered"),toolName:b().min(1).optional(),...Me}),w({type:L("widgetRenderLatencyUnder"),ms:M().int().positive(),toolName:b().min(1).optional(),...Me}),w({type:L("widgetNoConsoleErrors"),toolName:b().min(1).optional(),...Me}),w({type:L("turnCountUnder"),turns:M().int().positive(),...Me}),w({type:L("noEndingQuestion"),...Me}),w({type:L("toolLatencyUnder"),ms:M().int().positive(),toolName:b().min(1).optional(),...Me}),w({type:L("toolResultContains"),needle:b().min(1).max(zA),caseSensitive:oe().optional(),toolName:b().min(1).optional(),...Me}),w({type:L("toolResultMatchesSchema"),schema:Hn([Za.options[0],Za.options[1],K(Ln()),M(),Za.options[2],Ql()]).refine(e=>mW(e)<=Up,`schema must canonicalize to at most ${Up} bytes`),toolName:b().min(1).optional(),...Me}),w({type:L("toolResultSizeUnder"),maxBytes:M().int().positive(),toolName:b().min(1).optional(),...Me}),w({type:L("argumentsMatchToolSchema"),toolName:b().min(1).optional(),...Me}),w({type:L("toolInputMatches"),toolName:b().min(1),...Hb,...Me}).superRefine(jb("call")),w({type:L("toolResultMatches"),toolName:b().min(1).optional(),...Hb,...Me}).superRefine(jb("result")),w({type:L("noRepeatedIdenticalCall"),toolName:b().min(1).optional(),...Me}),w({type:L("toolCallCountUnder"),count:M().int().positive(),toolName:b().min(1).optional(),...Me}),w({type:L("toolCalledBefore"),toolName:b().min(1),beforeToolName:b().min(1),...Me}),w({type:L("noDeprecatedToolCalled"),...Me}),w({type:L("noDestructiveToolCalled"),...Me}),w({type:L("toolErrorNamesInput"),toolName:b().min(1).optional(),...Me}),w({type:L("fullPageHasContinuation"),toolName:b().min(1).optional(),...Me})]),jo=GC.superRefine((e,t)=>{e.type==="responseCloseTo"&&aW(e.reference,e).length===0&&t.addIssue({code:ts.custom,path:["reference"],message:"reference must remain non-empty after normalization"}),e.severity!==void 0&&e.role!=="advisory"&&t.addIssue({code:ts.custom,path:["severity"],message:'severity requires role: "advisory"'}),UA(e.type)&&e.role!=="advisory"&&t.addIssue({code:ts.custom,path:["role"],message:`"${e.type}" is an observation (a heuristic) and cannot gate; set role: "advisory"`})}),dc=jo.refine(e=>e.type!=="toolResultMatchesSchema"||Za.safeParse(e.schema).success,{path:["schema"],message:'Replace this schema with a JSON Schema object, true, false, or "declared".'}),CW=K(dc),vW=w({mode:V(["inherit","replace","extend"]),list:K(dc)}),hc=w({kind:L("turn"),promptIndex:M().int().nonnegative()}),cie="declared",uie=new RegExp(String.raw`\b(authorization|password|passwd|secret|token|api[_-]?key|access[_-]?key|client[_-]?secret|cookie|credential|private[_-]?key)\b`+String.raw`(\s*[:=]\s*)`+String.raw`(?:bearer\s+)?["']?[\w.\-+/=]{6,}["']?`,"gi"),die=w({id:b().uuid(),order:M().int().nonnegative(),actor:V(["persona","model","scripted"]),surface:L("client"),kind:V(["question","approval"]),outcome:V(["accepted","declined","cancelled","approved","denied","expired","invalid","unavailable","unsupported"]),elapsedMs:M().nonnegative(),startedAt:M().nonnegative(),serverId:b().min(1).max(256).optional(),toolName:b().min(1).max(256).optional(),invocationId:b().min(1).max(256).optional()}),fc=2e3,hie=uN({MAX_EVALUATOR_ID_CHARS:()=>64,MAX_NEEDLE_CHARS:()=>zA,MAX_SCHEMA_BYTES:()=>Up,OBSERVATION_PREDICATE_KINDS:()=>VA,PREDICATE_PLACEHOLDER_STRINGS:()=>gW,RENDER_OBSERVATION_PREDICATE_KINDS:()=>GA,TURN_SCOPABLE_PREDICATE_KINDS:()=>jA,argMatcherSchema:()=>$A,authoredResultSchemaRoot:()=>Za,casePredicatesSchema:()=>vW,isObservationPredicateKind:()=>UA,isTurnScopablePredicateKind:()=>BW,predicateArraySchema:()=>CW,predicateSchema:()=>dc,predicateScopeSchema:()=>hc,predicateUnion:()=>GC,requiresRenderObservations:()=>pW,storedPredicateSchema:()=>jo});function WA(e){const t=yA(e.role)?"fail":"ignore",{onError:n,onSkipped:r,...s}=e;return{...s,onError:n??t,onSkipped:r??t}}function yW(e){return e==="advisory"?"advisory":"gating"}function qA(e){return{scorerId:e.scorerId,idSource:e.idSource,scorerVersion:e.scorerVersion,implementationHash:e.implementationHash,deterministic:e.deterministic,passThreshold:e.passThreshold,role:yW(e.role),onError:e.onError,onSkipped:e.onSkipped,model:e.model,scope:e.scope}}function Dh(e){return fh(hh(qA(e)))}function KA(e){const t=e.map(n=>hh(qA(n))).sort();return fh(`[${t.join(",")}]`)}function fie(e){return fh(hh([...e].sort()))}function Bie(e){const t=e.map(s=>WA(s)),n=new Map,r=[];for(const s of t){const i=Dh(s),o=n.get(s.scorerId);if(o===void 0){n.set(s.scorerId,i),r.push(s);continue}if(o!==i)throw new Error(`Duplicate scorerId "${s.scorerId}" in the evaluation config with different settings. Scorer ids must be unique within a run.`)}return{hash:KA(r),definitions:r}}function bW(e,t){return e>=t}function Bc(e,t){return e.length<=t?e:`${e.slice(0,t-1)}…`}function SW(e){if(!(!e||e.length===0))return e.slice(0,20).map(t=>Bc(String(t),300))}function Th(e){return{scorerId:e.scorerId,scorerVersion:e.scorerVersion,definitionHash:Dh(e),passThreshold:e.passThreshold,deterministic:e.deterministic}}function EW(e){if(e instanceof Error)return e.message||e.name||"unknown error";const t=typeof e=="string"?e:String(e);return t.trim()===""?"unknown error":t}function xW(e,t){return t??e.scope}function VC(e,t){const n=xW(e,t);return{...e.model?{model:e.model}:{},...n?{scope:n}:{}}}function zp(e,t,n){return{...Th(e),status:"error",error:Bc(EW(t),500),...VC(e,n?.scope)}}function JA(e,t,n){return{...Th(e),status:"skipped",...t?{rationale:Bc(t,fc)}:{},...VC(e,n?.scope)}}function QA(e,t,n){return{...Th(e),status:"not_applicable",...t?{rationale:Bc(t,fc)}:{},...VC(e,n?.scope)}}function wW(e,t){if(t.kind==="skipped")return JA(e,t.rationale,{scope:t.scope});if(t.kind==="not_applicable")return QA(e,t.rationale,{scope:t.scope});const{value:n}=t;if(typeof n!="number"||!Number.isFinite(n))return zp(e,`scorer returned a non-numeric value (${String(n)})`,{scope:t.scope});if(n<0||n>1)return zp(e,`scorer returned ${n}, outside the required [0,1] range`,{scope:t.scope});const r=t.model??e.model,s=t.scope??e.scope,i=SW(t.evidence);return{...Th(e),status:"scored",value:n,passed:bW(n,e.passThreshold),...t.rationale?{rationale:Bc(t.rationale,fc)}:{},...i?{evidence:i}:{},...r?{model:r}:{},...t.promptHash?{promptHash:t.promptHash}:{},...t.judgeTemplateVersion!==void 0?{judgeTemplateVersion:t.judgeTemplateVersion}:{},...t.judgeTemplateHash!==void 0?{judgeTemplateHash:t.judgeTemplateHash}:{},...t.evidenceHash!==void 0?{evidenceHash:t.evidenceHash}:{},...t.evidenceManifest!==void 0?{evidenceManifest:t.evidenceManifest}:{},...s?{scope:s}:{}}}function DW(e,t){const n=[],r=[];for(const s of t.definitions){if(!yA(s.role))continue;const i=Dh(s),o=e.filter(u=>u.definitionHash===i),a=o.filter(u=>u.status!=="not_applicable");if(a.length===0){o.length===0&&r.push(s.scorerId);continue}let l=!1,c=!1;for(const u of a){if(u.status==="scored"){u.passed!==!1&&typeof u.value=="number"&&u.value>=s.passThreshold||(l=!0);continue}(u.status==="error"?s.onError:s.onSkipped)==="fail"&&(c=!0)}l?n.push(s.scorerId):c&&r.push(s.scorerId)}return{passed:n.length===0&&r.length===0,disagreeingScorerIds:n,unresolvedScorerIds:r}}var YA=V(["scored","error","skipped","not_applicable"]),UC=V(["gating","advisory","required"]),Td=V(["fail","ignore"]),zC=V(["explicit","generated","platform"]),$p=M().min(0).max(1),XA={scorerId:b().min(1).max(128),idSource:zC,scorerVersion:b().min(1),implementationHash:b().min(1),label:b().min(1).optional(),deterministic:oe(),passThreshold:$p,role:UC,model:b().min(1).optional(),scope:hc.optional()},pie=w({...XA,onError:Td.optional(),onSkipped:Td.optional()}).strict(),ZA=w({...XA,onError:Td,onSkipped:Td}).strict(),eI=w({scorerId:b().min(1).max(128),scorerVersion:b().min(1),definitionHash:b().min(1),status:YA,value:$p.optional(),passThreshold:$p,passed:oe().optional(),rationale:b().max(fc).optional(),evidence:K(b().max(300)).max(20).optional(),deterministic:oe(),model:b().min(1).optional(),promptHash:b().min(1).optional(),error:b().min(1).max(500).optional(),scope:hc.optional()}).strict().superRefine((e,t)=>{if(e.status==="scored"){if(e.value===void 0&&t.addIssue({code:"custom",path:["value"],message:'`value` is required when status is "scored"'}),e.passed===void 0&&t.addIssue({code:"custom",path:["passed"],message:'`passed` is required when status is "scored"'}),e.value!==void 0&&e.passed!==void 0){const n=e.value>=e.passThreshold;e.passed!==n&&t.addIssue({code:"custom",path:["passed"],message:`\`passed\` must equal \`value >= passThreshold\` (${e.value} >= ${e.passThreshold} is ${n}, got ${e.passed})`})}}else e.value!==void 0&&t.addIssue({code:"custom",path:["value"],message:'`value` is only allowed when status is "scored"'}),e.passed!==void 0&&t.addIssue({code:"custom",path:["passed"],message:'`passed` is only allowed when status is "scored"'});e.status==="error"?e.error===void 0&&t.addIssue({code:"custom",path:["error"],message:'`error` is required when status is "error"'}):e.error!==void 0&&t.addIssue({code:"custom",path:["error"],message:'`error` is only allowed when status is "error"'})}),mie=K(eI),gie=w({hash:b().min(1),definitions:K(ZA)}).strict().superRefine((e,t)=>{const n=new Set;e.definitions.forEach((s,i)=>{n.has(s.scorerId)&&t.addIssue({code:"custom",path:["definitions",i,"scorerId"],message:`duplicate scorerId "${s.scorerId}"`}),n.add(s.scorerId)});const r=KA(e.definitions);r!==e.hash&&t.addIssue({code:"custom",path:["hash"],message:`evaluationConfigHash mismatch (declared ${e.hash}, recomputed ${r})`})});var Gi=b().min(1).max(128).regex(/^[A-Za-z0-9_-]+$/,"id must contain only letters, digits, '-' and '_' (no whitespace or punctuation)");var TW="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";function AW(e){const t=globalThis.crypto;if(!t?.getRandomValues)throw new Error("Cannot mint an id: this runtime has no `crypto.getRandomValues`. Pass an explicit id instead.");return t.getRandomValues(new Uint8Array(e))}function IW(e){const t=AW(21);let n=e;for(const r of t)n+=TW[r&63];return n}function Cie(){return IW("c_")}function vie(e){return Gi.safeParse(e).success}var ir=["connection","discovery","selection","call","response","userValue"],Vi=V(ir),$C=["passed","failed","notReached","notMeasured","notApplicable"],tI=V($C),WC=["setup","metadata","selection","arguments","serverData","userValue","evaluator"],qC=V(WC),kW=["pending","running","completed","failed","cancelled","timed_out","setup_failed","skipped"],yie=V(kW),RW=["exact","approximated","unsupported","unresolved"],OW=V(RW),MW=GC.options.map(e=>e.shape.type.value),Rl={toolDescriptionsPresent:"discovery",toolAnnotationsPresent:"discovery",toolNamesUnique:"discovery",noDeprecatedToolExposed:"discovery",toolInputSchemasWellFormed:"discovery",toolOutputSchemasPresent:"discovery",toolCalledWith:"selection",toolCalledAtLeastOnce:"selection",toolNeverCalled:"selection",onlyToolsCalled:"selection",firstToolWas:"selection",toolCallCountUnder:"selection",toolCalledBefore:"selection",noDeprecatedToolCalled:"selection",noDestructiveToolCalled:"selection",argumentsMatchToolSchema:"call",noRepeatedIdenticalCall:"call",toolInputMatches:"call",noToolErrors:"response",toolLatencyUnder:"response",toolResultContains:"response",toolResultMatches:"response",toolResultMatchesSchema:"response",toolResultSizeUnder:"response",toolErrorNamesInput:"response",fullPageHasContinuation:"response",responseCloseTo:"userValue",responseContains:"userValue",responseMatches:"userValue",finalAssistantMessageNonEmpty:"userValue",tokenBudgetUnder:"userValue",turnCountUnder:"userValue",widgetRendered:"userValue",widgetRenderLatencyUnder:"userValue",widgetNoConsoleErrors:"userValue",noEndingQuestion:"userValue"},NW={"toolCalls:match":"selection","toolCalls:arguments":"call","judge:goalCompletion":"userValue","judge:groundedness":"userValue","judge:rubricChecks":"userValue"},PW={tokenBudgetUnder:"budget",turnCountUnder:"budget"},bie=MW,Ah=Rl,Sie=NW,Eie=PW,KC=["noSpanChannel","noEvidenceCaptured","matchVerdictUnavailable","traceAbsent","executorEmitsNoSpans","blockedByPolicy","evaluatorError","providerError","setupAborted","connectFailed","toolsListFailed","egressUnverified","lifecycleStopped","notAuthored","earlierStageFailed","missingToolCall","unexpectedToolCall","argumentMismatch","toolError","protocolError","renderFailed","predicateFailed","observed","impliedByLaterEvidence","judgeObserved","judgePartial","judgeFailed","judgePending","judgeNotRequested"],xie=Object.fromEntries(Object.entries({toolCalledAtLeastOnce:"missingToolCall",firstToolWas:"unexpectedToolCall",toolNeverCalled:"unexpectedToolCall",onlyToolsCalled:"unexpectedToolCall",toolCallCountUnder:"unexpectedToolCall",toolCalledBefore:"unexpectedToolCall",noDeprecatedToolCalled:"unexpectedToolCall",noDestructiveToolCalled:"unexpectedToolCall"}).filter(([e,t])=>t!==void 0&&Ah[e]==="selection")),wie=new Set(Object.entries(Ah).filter(([,e])=>e==="discovery").map(([e])=>e)),Die=new Set(Object.entries(Ah).filter(([,e])=>e==="response").map(([e])=>e)),Tie=new Set(Object.entries(Ah).filter(([,e])=>e==="call").map(([e])=>e)),LW=new Set(["toolCalledAtLeastOnce","firstToolWas"]);function Aie(e){return e!==void 0&&LW.has(e)}var nI=V(KC),rI=w({stage:Vi,state:tI,reason:nI.optional(),evidence:w({spanIds:K(b()).optional(),promptIndexes:K(M()).optional(),predicateReasons:K(b()).optional()}).optional()}),sI=w({stageResults:K(rI),firstFailedStage:Vi.optional(),failureCategory:qC.optional(),stageAnalyzerVersion:M().int().nonnegative()}).superRefine((e,t)=>{if(e.stageResults.length!==ir.length){t.addIssue({code:ts.custom,path:["stageResults"],message:`expected ${ir.length} stage rows, received ${e.stageResults.length}`});return}ir.forEach((r,s)=>{e.stageResults[s]?.stage!==r&&t.addIssue({code:ts.custom,path:["stageResults",s,"stage"],message:`stage rows must be in USER_VALUE_STAGES order; expected "${r}" at index ${s}`})});const n=e.stageResults.find(r=>r.state==="failed");n&&e.firstFailedStage!==n.stage&&t.addIssue({code:ts.custom,path:["firstFailedStage"],message:`firstFailedStage must name the first failed row ("${n.stage}")`}),!n&&e.firstFailedStage!==void 0&&t.addIssue({code:ts.custom,path:["firstFailedStage"],message:"firstFailedStage is set but no stage row failed"})});function Iie(e){if(!e||typeof e!="object")return{};const t=e;if(!("stageResults"in t))return{};const n=sI.safeParse({stageResults:t.stageResults,...t.firstFailedStage!==void 0?{firstFailedStage:t.firstFailedStage}:{},...t.failureCategory!==void 0?{failureCategory:t.failureCategory}:{},stageAnalyzerVersion:t.stageAnalyzerVersion});if(n.success)return{stageResults:n.data.stageResults,...n.data.firstFailedStage?{firstFailedStage:n.data.firstFailedStage}:{},...n.data.failureCategory?{failureCategory:n.data.failureCategory}:{},stageAnalyzerVersion:n.data.stageAnalyzerVersion};const r=t.stageAnalyzerVersion;return{stageResultsUnverified:!0,...typeof r=="number"&&Number.isInteger(r)&&r>=0?{stageAnalyzerVersion:r}:{}}}var _W=["assertion","judge"];function FW(e){return e.deterministic?"assertion":"judge"}function Ih(e){return{schemaVersion:1,evaluatorId:e.scorerId,evaluatorVersion:e.scorerVersion,definitionHash:e.definitionHash,kind:FW(e),status:e.status,...e.value!==void 0?{score:e.value}:{},passThreshold:e.passThreshold,...e.passed!==void 0?{passed:e.passed}:{},...e.rationale!==void 0?{explanation:e.rationale}:{},...e.evidence!==void 0?{evidence:e.evidence}:{},deterministic:e.deterministic,...e.model!==void 0?{model:e.model}:{},...e.promptHash!==void 0?{promptHash:e.promptHash}:{},...e.error!==void 0?{error:e.error}:{},...e.judgeTemplateVersion!==void 0?{judgeTemplateVersion:e.judgeTemplateVersion}:{},...e.judgeTemplateHash!==void 0?{judgeTemplateHash:e.judgeTemplateHash}:{},...e.evidenceHash!==void 0?{evidenceHash:e.evidenceHash}:{},...e.evidenceManifest!==void 0?{evidenceManifest:e.evidenceManifest}:{},...e.scope!==void 0?{scope:e.scope}:{}}}function iI(e){return{scorerId:e.evaluatorId,scorerVersion:e.evaluatorVersion,definitionHash:e.definitionHash,status:e.status,...e.score!==void 0?{value:e.score}:{},passThreshold:e.passThreshold,...e.passed!==void 0?{passed:e.passed}:{},...e.explanation!==void 0?{rationale:e.explanation}:{},...e.evidence!==void 0?{evidence:e.evidence}:{},deterministic:e.deterministic,...e.model!==void 0?{model:e.model}:{},...e.promptHash!==void 0?{promptHash:e.promptHash}:{},...e.error!==void 0?{error:e.error}:{},...e.judgeTemplateVersion!==void 0?{judgeTemplateVersion:e.judgeTemplateVersion}:{},...e.judgeTemplateHash!==void 0?{judgeTemplateHash:e.judgeTemplateHash}:{},...e.evidenceHash!==void 0?{evidenceHash:e.evidenceHash}:{},...e.evidenceManifest!==void 0?{evidenceManifest:e.evidenceManifest}:{},...e.scope!==void 0?{scope:e.scope}:{}}}function HW(e){return e.kind==="scored"?{kind:"scored",value:e.score,...e.explanation!==void 0?{rationale:e.explanation}:{},...e.evidence!==void 0?{evidence:e.evidence}:{},...e.model!==void 0?{model:e.model}:{},...e.promptHash!==void 0?{promptHash:e.promptHash}:{},...e.judgeTemplateVersion!==void 0?{judgeTemplateVersion:e.judgeTemplateVersion}:{},...e.judgeTemplateHash!==void 0?{judgeTemplateHash:e.judgeTemplateHash}:{},...e.evidenceHash!==void 0?{evidenceHash:e.evidenceHash}:{},...e.evidenceManifest!==void 0?{evidenceManifest:e.evidenceManifest}:{},...e.scope!==void 0?{scope:e.scope}:{}}:{kind:e.kind,...e.explanation!==void 0?{rationale:e.explanation}:{},...e.scope!==void 0?{scope:e.scope}:{}}}function kie(e){return WA(e)}function Rie(e){return Dh(e)}function Oie(e,t){return Ih(wW(e,HW(t)))}function Mie(e,t,n){return Ih(zp(e,t,n))}function Nie(e,t,n){return Ih(JA(e,t,n))}function Pie(e,t,n){return Ih(QA(e,t,n))}function Lie(e,t){const n=e.map(r=>"evaluatorId"in r?iI(r):r);return DW(n,t)}var jW=V(_W),GW=V(["scored","error","skipped","not_applicable"]),Gb=M().min(0).max(1),Vb={scorerId:"evaluatorId",scorerVersion:"evaluatorVersion",value:"score",rationale:"explanation"},VW=w({schemaVersion:L(1),evaluatorId:b().min(1).max(128),evaluatorVersion:b().min(1),definitionHash:b().min(1),kind:jW,status:GW,score:Gb.optional(),passThreshold:Gb,passed:oe().optional(),explanation:b().max(fc).optional(),evidence:K(b().max(300)).max(20).optional(),deterministic:oe(),model:b().min(1).optional(),promptHash:b().min(1).optional(),error:b().min(1).max(500).optional(),scope:hc.optional()}).strict(),UW=VW.superRefine((e,t)=>{const n=e.deterministic?"assertion":"judge";e.kind!==n&&t.addIssue({code:"custom",path:["kind"],message:`\`kind\` is derived from \`deterministic\` (${e.deterministic} means "${n}", got "${e.kind}")`});const r=eI.safeParse(iI(e));if(!r.success)for(const s of r.error.issues)t.addIssue({code:"custom",path:s.path.map(i=>typeof i=="string"?Vb[i]??i:i),message:Object.entries(Vb).reduce((i,[o,a])=>i.replace(new RegExp(`\\b${o}\\b`,"g"),a),s.message)})}),_ie=K(UW);var zW="json_chars_div_4",$W=2e5,WW=["snapshotMissing","snapshotPartial","setupNotObserved"],qW=["aggregated_catalog_json","normalized_snapshot"],KW=["spec_required","spec_recommended","quality_signal"],Ub=w({outcome:V(["ok","failed"]),attribution:V(["ours","theirs","unknown"]).optional(),egressVerified:oe().optional(),durationMs:M().int().nonnegative().optional(),basis:L("setup_phase_wall")}).strict(),JW="estimate of a reference window, not measured context consumption",QW=w({toolName:b().min(1),code:b().min(1),class:V(KW),detail:nr(b().regex(/^[A-Za-z0-9_.-]{1,64}$/),M()).optional(),protocolDependent:oe().optional()}).strict(),YW=w({kind:V(["conformance","readiness"]),runId:b().min(1).optional(),createdAt:M().int().nonnegative(),protocolVersion:b().min(1).optional(),serverVersion:b().min(1).optional(),comparability:L("sameServerId")}).strict(),XW=w({bytes:M().int().nonnegative(),basis:V(qW),complete:oe()}).strict(),ZW=w({serverId:b().min(1),capture:V(["complete","failed"]),toolCount:M().int().nonnegative(),payload:XW,estimatedTokens:M().int().nonnegative(),referenceWindowShare:M().min(0),annotations:w({total:M().int().nonnegative(),withReadOnlyHint:M().int().nonnegative(),withDestructiveHint:M().int().nonnegative()}).strict().refine(e=>e.withReadOnlyHint<=e.total&&e.withDestructiveHint<=e.total,{message:"annotation counts cannot exceed the tool total"}),outputSchema:w({total:M().int().nonnegative(),present:M().int().nonnegative()}).strict().refine(e=>e.present<=e.total,{message:"outputSchema.present cannot exceed the tool total"}),prechecks:K(QW).max(500),relatedAssessments:K(YW).max(8)}).strict(),Fie=w({schemaVersion:L(1),sourceVersion:L(1),runId:b().min(1),suiteId:b().min(1),computedAt:M().int().nonnegative(),state:V(["ready","unavailable"]),reason:V(WW).optional(),protocolVersion:b().min(1).optional(),tokenEstimate:w({method:L(zW),referenceWindowTokens:L($W),note:L(JW)}).strict(),setup:w({connection:Ub.optional(),discovery:Ub.optional()}).strict(),servers:K(ZW).max(50)}).strict().refine(e=>e.state==="unavailable"==(e.reason!==void 0),{message:'`reason` is required exactly when `state` is "unavailable"',path:["reason"]});var Hie="Unlabeled",eq=b().min(1).max(64).refine(e=>e.trim()===e,{message:"intent must be trimmed (no leading or trailing whitespace); normalize with normalizeIntent before validating"}),tq=eq.nullable();var oI="evidence_span_union",nq="setup_phase_wall",rq=["reached","notReached","unknown","notApplicable"],sq=V(rq),aI=["selection","call","response"];function iq(e){return aI.includes(e)}var oq=w({unit:L("ms"),basis:L(oI),value:M().finite().min(0)}).strict(),aq=w({stage:Vi,reach:sq,latency:oq.optional()}).strict(),lq=w({schemaVersion:L(1),stageAnalyzerVersion:M().int().min(1),rows:K(aq).length(ir.length)}).strict(),jie=lq.superRefine((e,t)=>{ir.forEach((n,r)=>{const s=e.rows[r];s!==void 0&&(s.stage!==n&&t.addIssue({code:"custom",path:["rows",r,"stage"],message:`rows[${r}] is '${s.stage}' but must be '${n}': the six rows are a funnel in USER_VALUE_STAGES order and position is meaning`}),s.latency!==void 0&&!iq(s.stage)&&t.addIssue({code:"custom",path:["rows",r,"latency"],message:`stage '${s.stage}' may not carry a per-trial latency at schema version 1 (eligible stages: ${aI.join(", ")})`}),s.latency!==void 0&&s.reach!=="reached"&&t.addIssue({code:"custom",path:["rows",r,"latency"],message:`stage '${s.stage}' reports latency but reach is '${s.reach}': a stage that was not reached cannot have taken time`}))})}),cq=2e3,uq=ls({id:b().regex(/^[A-Za-z0-9_-]{1,64}$/),label:b().trim().min(1).max(200),description:b().max(1e3).optional(),required:oe().optional()}),dq=ls({criteria:K(uq).min(1).max(25).optional(),instructions:b().trim().min(1).max(cq).optional().describe("Grading instructions: extra rules applied alongside each case's task and expected outcome. They do not replace the expected outcome.")}).superRefine((e,t)=>{e.criteria===void 0&&e.instructions===void 0&&t.addIssue({code:"custom",message:"Provide grading instructions or criteria; use null to clear.",path:[]});const n=new Set;e.criteria?.forEach((r,s)=>{n.has(r.id)&&t.addIssue({code:"custom",message:"Criterion IDs must be unique.",path:["criteria",s,"id"]}),n.add(r.id)})}),hq=ls({enabled:oe().optional(),model:b().trim().min(1).optional(),autoRun:oe().optional(),threshold:M().min(0).max(1).optional(),role:V(["advisory","gating","required"]).optional(),severity:L("warn").optional(),rubric:dq.nullable().optional()}).refine(e=>e.severity===void 0||e.role===void 0||e.role==="advisory",{message:"Severity is only available for advisory judges.",path:["severity"]}),fq=ls({enabled:oe().optional()});var Wp=65536,lI=262144;var zb="/home/user/";var Bq=/^[A-Za-z0-9_-]{1,64}$/,pq=/^[A-Za-z0-9][A-Za-z0-9._-]{0,99}\.(sh|py|ts|js)$/;function cI(e){return new TextEncoder().encode(e).length}var Ma=b().refine(e=>cI(e)<=Wp,{message:`Scripts can be at most ${Wp.toLocaleString("en-US")} bytes.`});function uI(e){if(e.length>512)return"is longer than 512 characters";if([...e].some(n=>n.charCodeAt(0)<32||n===""))return"has a control character";if(!e.startsWith("/home/user/"))return`must start with ${zb}`;const t=e.slice(11).replace(/\/$/,"");if(!t)return`must name a file or folder inside ${zb}`;for(const n of t.split("/")){if(!n)return'has an empty folder name ("//")';if(n==="..")return'contains ".."';if(n.startsWith("."))return"is inside a hidden folder or names a hidden file"}}var mq=ls({id:b().regex(Bq,{message:'Use 1 to 64 letters, digits, "-" or "_".'}).describe("Stable id; the score row is code:<id>."),name:b().trim().min(1).max(100).optional(),fileName:b().regex(pq,{message:"Use a file name ending in .sh, .py, .ts or .js."}).describe("The extension picks the interpreter."),script:Ma.refine(e=>e.trim().length>0,{message:"The script is empty."}).describe('Reads the iteration from $MCPJAM_ITERATION and writes {"score": 0 to 1, "reason": "..."} to $MCPJAM_RESULT.'),role:V(["required","advisory"]).optional().describe("Required gates the iteration; advisory only reports. Default advisory."),threshold:M().gt(0).max(1).optional().describe("The score an iteration needs to pass. Default 1."),evaluator:ls({id:b().min(1).max(64),version:M().int().min(1)}).optional()}),gq=K(mq).max(10).superRefine((e,t)=>{const n=e.reduce((s,i)=>s+cI(i.script),0);n>262144&&t.addIssue({code:"custom",message:`Code evaluators and scripts can total at most ${lI.toLocaleString("en-US")} bytes. These evaluators total ${n.toLocaleString("en-US")}.`});const r=new Set;e.forEach((s,i)=>{r.has(s.id)&&t.addIssue({code:"custom",message:"Code evaluator ids must be unique.",path:[i,"id"]}),r.add(s.id)})}),Cq=ls({runSetup:Ma.optional(),iterationSetup:Ma.optional(),iterationCleanup:Ma.optional(),runCleanup:Ma.optional()}),vq=ls({files:K(b().superRefine((e,t)=>{const n=uI(e);n&&t.addIssue({code:"custom",message:`The path ${n}.`})})).max(20).optional().describe("Files or folders from the agent's box to copy into the grading box."),network:V(["none","web"]).optional().describe("none (default): evaluators can't reach the network.")}),pc={"discovery.description":"toolDescriptionsPresent","discovery.annotations":"toolAnnotationsPresent","discovery.collisions":"toolNamesUnique","discovery.deprecated":"noDeprecatedToolExposed","call.schema":"toolInputSchemasWellFormed","response.schema":"toolOutputSchemasPresent","selection.hops":"toolCallCountUnder","call.parameters":"argumentsMatchToolSchema","call.repeated":"noRepeatedIdenticalCall","response.performance":"toolLatencyUnder","response.size":"toolResultSizeUnder","response.errors":"noToolErrors","response.recovery":"toolErrorNamesInput","response.pagination":"fullPageHasContinuation","userValue.turns":"turnCountUnder"};function yq(e){return Object.prototype.hasOwnProperty.call(pc,e)}function bq(e){if(e?.length){if(e.length>64||e.some(t=>!yq(t)))throw new Error("Suppression must contain at most 64 known standard assertion check ids");return[...new Set(e)].sort()}}function Sq(e,t){const n=new Set((bq(t)??[]).map(r=>pc[r]));return e.filter(r=>!n.has(r.type))}var dI={"discovery.description":{name:"Description quality",label:"Tool descriptions meet the minimum length",rule:{type:"toolDescriptionsPresent",minLength:20}},"discovery.annotations":{name:"Tool annotations",label:"Every tool declares annotations",rule:{type:"toolAnnotationsPresent"}},"discovery.collisions":{name:"Name collisions",label:"Tool names are unique within each server",rule:{type:"toolNamesUnique"}},"discovery.deprecated":{name:"Deprecated tools exposed",label:"No tool description marks itself deprecated",rule:{type:"noDeprecatedToolExposed",role:"advisory"}},"call.schema":{name:"Input schema quality",label:"Input schemas have an object root and documented parameters",rule:{type:"toolInputSchemasWellFormed"}},"response.schema":{name:"Output schema quality",label:"Every tool declares an output schema",rule:{type:"toolOutputSchemasPresent"}},"selection.hops":{name:"Tool hops before the right tool",label:"Tool call count stays below the configured limit",rule:{type:"toolCallCountUnder",count:4}},"call.parameters":{name:"Parameter validity",label:"Arguments match the tool's input schema",rule:{type:"argumentsMatchToolSchema"}},"call.repeated":{name:"Repeated identical calls",label:"No identical call repeated back-to-back",rule:{type:"noRepeatedIdenticalCall",role:"advisory"}},"response.performance":{name:"Tool latency",label:"Tool latency stays below the configured limit",rule:{type:"toolLatencyUnder",ms:5e3}},"response.size":{name:"Payload size",label:"Tool result size stays below the configured limit",rule:{type:"toolResultSizeUnder",maxBytes:64e3}},"response.errors":{name:"Tool errors (isError)",label:"No tool returns an error",rule:{type:"noToolErrors"}},"response.recovery":{name:"Error messages that help recovery",label:"Tool errors name an input",rule:{type:"toolErrorNamesInput",role:"advisory"}},"response.pagination":{name:"Pagination and truncation clarity",label:"Full pages include a continuation marker",rule:{type:"fullPageHasContinuation",role:"advisory"}},"userValue.turns":{name:"User turns to completion",label:"User turn count stays below the configured limit",rule:{type:"turnCountUnder",turns:6}}},Gie=[{id:"connection.success",name:"Successful connection",stage:"connection",label:"Connection",kind:"runner",measuredBy:"connection"},{id:"discovery.toolsList",name:"Tools listed",stage:"discovery",label:"Tool discovery",kind:"runner",measuredBy:"discovery"},{id:"call.completed",name:"Tool call completed",stage:"call",label:"Tool call",kind:"runner",measuredBy:"call"},{id:"response.returned",name:"Result returned to the model",stage:"response",label:"Response",kind:"runner",measuredBy:"response"},...Object.entries(dI).map(([e,{name:t,label:n,rule:r}])=>{const s=e;return{id:s,name:t,label:n,kind:"assertion",stage:Rl[pc[s]],preset:{...r,role:"advisory",severity:"warn"}}}),{id:"userValue.outcome",name:"Outcome achieved",stage:"userValue",label:"Outcome achieved",kind:"judge"}],Vie=Object.fromEntries(Object.entries(pc).map(([e,t])=>[t,dI[e].name])),hI=K(V(Object.keys(pc))).max(64);var Eq=4e3,xq=Hn([b(),M(),oe(),K(b())]),wq=w({server:b().min(1).max(200).optional(),tool:b().min(1).max(256).optional(),message:b().min(1).max(500).optional(),action:V(["accept","decline","cancel"]),content:nr(b(),xq).optional()}).strict().superRefine((e,t)=>{e.content!==void 0&&e.action!=="accept"&&t.addIssue({code:"custom",path:["content"],message:'A reply with content must have action "accept". Remove the content, or accept.'}),e.content!==void 0&&JSON.stringify(e.content).length>4e3&&t.addIssue({code:"custom",path:["content"],message:`A reply's content may be ${Eq} characters at most. Shorten the values.`})}),Dq=K(wq).max(20),qp=5e3,Tq=3e4,Aq=12e4,$b=1e5,el=w({scope:L("host").optional(),role:w({role:b().min(1),name:b().optional(),exact:oe().optional()}).strict().optional(),text:b().min(1).optional(),css:b().min(1).optional(),testId:b().min(1).optional(),nth:M().int().nonnegative().optional()}).strict().refine(e=>!!(e.role||e.text||e.css||e.testId),{message:"locator must specify at least one of role/text/css/testId"}),Iq=w({id:b(),kind:L("prompt"),prompt:b()}).strict(),kq=nr(b(),Ln()).refine(e=>{try{return JSON.stringify(e).length<=$b}catch{return!1}},{message:`arguments must be ≤ ${$b} characters when serialized`}),Rq=w({id:b(),kind:L("toolCall"),serverId:b().min(1).optional(),serverName:b().min(1),toolName:b().min(1),arguments:kq,approval:V(["approve","deny"]).optional(),expectedQuestions:M().int().min(1).max(20).optional(),renderTimeoutMs:M().int().positive().max(Aq).optional()}).strict(),Oq=ft("kind",[w({kind:L("click"),target:el,clickType:V(["left","double","right"]).optional()}).strict(),w({kind:L("type"),target:el,text:b().max(qp)}).strict(),w({kind:L("key"),key:b().min(1)}).strict(),w({kind:L("scroll"),direction:V(["up","down"]),amount:M().int().positive().optional()}).strict(),w({kind:L("wait"),ms:M().int().positive().max(Tq)}).strict()]),Mq=w({id:b(),kind:L("interact"),toolName:b().min(1),action:Oq}).strict(),fI=ft("kind",[w({kind:L("textVisible"),toolName:b().min(1),text:b().min(1).max(qp)}).strict(),w({kind:L("elementVisible"),toolName:b().min(1),target:el}).strict(),w({kind:L("elementHidden"),toolName:b().min(1),target:el}).strict(),w({kind:L("inputValue"),toolName:b().min(1),target:el,equals:b().max(qp)}).strict(),w({kind:L("widgetToolCalled"),toolName:b().min(1),calledToolName:b().min(1)}).strict()]),BI=w({kind:dN().optional()}).catchall(Ln()),Nq=Hn([fI,gx(dc,BI)]),pI=w({id:b(),kind:L("assert"),assertion:Nq}).strict(),mI=[Iq,Rq,Mq],Pq=ft("kind",[...mI,pI]);var Lq=K(Pq).max(200),_q=K(ft("kind",[...mI,pI.extend({assertion:Hn([fI,gx(jo,BI)])})])).max(200),Uie=e=>e.kind==="prompt",zie=e=>e.kind==="toolCall",$ie=e=>e.kind==="interact",Wie=e=>e.kind==="assert";function qie(e){return typeof e.kind=="string"}var Fq=["1","2"];var Hq=2e3,Ad=M().min(0).max(1),kh=M().int().min(1).max(100);function Kp(e,t,n,r){return s=>{const i=s.input;return typeof i=="string"&&n.includes(i)?`${e} "${i}" is reserved and not accepted in schemaVersion ${r}; the only supported ${e} is "${t}"`:`${e} must be "${t}" in schemaVersion ${r} (received ${JSON.stringify(i)}); "${n.join('", "')}" are reserved for a future version`}}var jq=["serverContract"],Gq=["restricted","summary"],Vq=["metadataOnly","none"],Jp=w({name:b().min(1).max(200),id:Gi.optional()}).strict(),Uq=w({name:b().min(1).max(200),id:Gi.optional(),servers:K(Jp).optional()}).strict(),Wb={hosts:K(Uq).min(1).optional()},zq=Hn([w({servers:K(Jp).min(1),environment:b().min(1).optional(),...Wb}).strict(),w({servers:K(Jp).min(1).optional(),environment:b().min(1),...Wb}).strict()]),JC=w({minEligibleTrials:M().int().min(1).optional(),minCompletionRate:Ad.optional(),maxEvaluatorErrorRate:Ad.optional()}).strict(),$q=w({mode:V(["default","readOnly"]),allow:K(b().min(1)).optional(),deny:K(b().min(1)).optional()}).strict();function gI(e){return{head:{model:b().min(1),provider:b().min(1).optional(),systemPrompt:b().optional(),temperature:M().optional()},tail:{judge:hq.optional(),codeEvaluators:gq.optional(),scripts:Cq.optional(),grading:vq.optional(),passThreshold:Ad,validity:JC,toolPolicy:$q.optional(),captureLevel:L("full",{error:Kp("captureLevel","full",Vq,e)}).optional()}}}var qb=gI("1"),Wq=w({...qb.head,repetitions:kh,...qb.tail}).strict(),Kb=gI("2"),qq=w({...Kb.head,iterations:kh,...Kb.tail}).strict(),Kq=w({sourceHash:b().min(1),sourceFormat:b().min(1),sourceFormatVersion:b().min(1).optional(),converter:b().min(1).optional(),converterVersion:b().min(1).optional(),model:b().min(1).optional(),discoverySnapshotHash:b().min(1).optional(),reportHash:b().min(1),importedAt:fN().optional()}).strict();function Jb(e,t){return e.refine(n=>n.trim().length>0,{message:`import.${t} must not be blank`})}var Jq=w({status:OW,sourceCaseKey:Jb(b().min(1).max(512),"sourceCaseKey").optional(),note:Jb(b().min(1).max(Hq),"note").optional()}).strict().refine(e=>e.status!=="exact"||e.note!==void 0,{message:'import.note is required when status is "exact": an exact claim is converter-asserted, not verified, so it must cite the mapping rule that earns it. Record "approximated" with a note describing the difference when no rule can be cited.',path:["note"]}),CI={id:Gi,title:b().min(1).max(200),intent:tq.optional(),scenario:b().min(1).optional(),kind:V(["capability","regression"]).nullable().optional(),steps:_q.min(1)},vI={judge:fq.optional(),expectedOutput:b().optional(),isNegativeTest:oe().optional(),inputAnswers:Dq.optional(),model:b().min(1).optional()},yI={passThreshold:Ad.optional(),disabled:oe().optional(),import:Jq.optional()},Qq=w({...CI,checks:K(jo).max(50).optional(),suppressedSuiteStandardCheckIds:hI.optional(),assertions:K(jo).max(50).optional(),...vI,repetitions:kh.optional(),...yI}).strict(),Yq=w({...CI,assertions:K(jo).max(50).optional(),suppressedSuiteStandardCheckIds:hI.optional(),...vI,iterations:kh.optional(),...yI}).strict();function bI(e,t,n){return w({schemaVersion:L(e,{error:r=>`schemaVersion ${JSON.stringify(r.input)} is not supported by this validator, which reads schemaVersion "${e}". This file needs a newer CLI/SDK — upgrade @mcpjam/cli or @mcpjam/sdk rather than editing the file.`}),mode:L("agentWorkflow",{error:Kp("mode","agentWorkflow",jq,e)}),reportingMode:L("standard",{error:Kp("reportingMode","standard",Gq,e)}),suite:w({id:Gi,name:b().min(1).max(200),description:b().optional()}).strict(),target:zq,defaults:t,provenance:Kq.optional(),cases:K(n).min(1).max(500)}).strict()}var Xq=bI("1",Wq,Qq),Zq=bI("2",qq,Yq),eK=ft("schemaVersion",[Xq,Zq],{error:e=>{const t=e.input?.schemaVersion;return`schemaVersion ${JSON.stringify(t)} is not supported by this validator, which reads schemaVersion ${Fq.map(n=>`"${n}"`).join(" or ")}. This file needs a newer CLI/SDK — upgrade @mcpjam/cli or @mcpjam/sdk rather than editing the file.`}}),Kie=eK.superRefine((e,t)=>{const n=new Set;e.cases.forEach((r,s)=>{n.has(r.id)&&t.addIssue({code:"custom",path:["cases",s,"id"],message:`duplicate case id "${r.id}"`}),n.add(r.id);const i=new Set;r.steps.forEach((o,a)=>{i.has(o.id)&&t.addIssue({code:"custom",path:["cases",s,"steps",a,"id"],message:`duplicate step id "${o.id}" in case "${r.id}"`}),i.add(o.id)}),r.import&&!e.provenance&&t.addIssue({code:"custom",path:["cases",s,"import"],message:`case "${r.id}" records an import status but the file has no top-level \`provenance\`, so the mapping cannot be audited`})}),e.schemaVersion==="1"&&e.cases.forEach((r,s)=>{r.checks&&r.assertions&&t.addIssue({code:"custom",path:["cases",s,"checks"],message:`case "${r.id}" sets both \`checks\` and its deprecated \`assertions\` alias — set one`})})});var tK=L(2,{error:e=>e.input===void 0?"verdictPolicyVersion is required and must be 2. An absent version is a LEGACY (percent-threshold) row and must not be read as v2.":`verdictPolicyVersion ${JSON.stringify(e.input)} is not supported by this contract, which pins 2.`}),nK=["passed","failed","inconclusive"],SI=V(nK),Fn=M().min(0).max(1),Qt=M().int().min(0),rK=M().int().min(1).max(100),EI=["notTerminal","skipped","setupFailed","cancelled","timedOut","executionFailed","evaluatorError"],Jie=V(EI),Id=w({notTerminal:Qt.optional(),skipped:Qt.optional(),setupFailed:Qt.optional(),cancelled:Qt.optional(),timedOut:Qt.optional(),executionFailed:Qt.optional(),evaluatorError:Qt.optional()}).strict(),Qp=["measured","notMeasured"],Qie=V(Qp),Xt=ft("state",[w({state:L("measured"),value:Fn,numerator:Qt,denominator:M().int().min(1),exclusions:Id}).strict(),w({state:L("notMeasured"),value:Ql(),numerator:L(0),denominator:L(0),exclusions:Id}).strict()]),xI=Xt.superRefine((e,t)=>{if(e.state!=="measured")return;e.numerator>e.denominator&&t.addIssue({code:"custom",path:["numerator"],message:`numerator ${e.numerator} exceeds denominator ${e.denominator}`});const n=e.numerator/e.denominator;e.value!==n&&t.addIssue({code:"custom",path:["value"],message:`value ${e.value} is not ${e.numerator}/${e.denominator} (${n}); a rate must be the quotient of the counts it ships with`})});function tl(e,t,n){const r=xI.safeParse(n);if(!r.success)for(const s of r.error.issues)e.addIssue({code:"custom",path:[...t,...s.path],message:s.message})}var sK=ft("kind",[w({kind:L("allConfiguredTrialsAttempted"),minGradeableTrials:L(1)}).strict(),w({kind:L("minEligibleTrials"),minEligibleTrials:M().int().min(1)}).strict()]),wI=w({coverage:sK,minCompletionRate:Fn,maxEvaluatorErrorRate:Fn}).strict(),DI=["configuredTrialsNotAttempted","noGradeableTrials","eligibleTrialsBelowMinimum","completionRateBelowMinimum","completionRateNotMeasured","evaluatorErrorRateAboveMaximum","evaluatorErrorRateNotMeasured","caseHasNoEligibleTrials"],iK=["casePassRateMetThreshold","casePassRateBelowThreshold","allMeasuredCasesMetThreshold"],Ol=[...DI,...iK],TI=V(Ol).describe("Why the verdict is what it is. The validity reasons are evaluated FIRST and make a run `inconclusive`; the task reasons decide `passed` / `failed` once validity holds. `configuredTrialsNotAttempted` — some configured trial never ran. `noGradeableTrials` — nothing in the suite was gradeable. `eligibleTrialsBelowMinimum` — the explicit `minEligibleTrials` was not reached. `completionRateBelowMinimum` — measured, and under the floor. `completionRateNotMeasured` — nothing was attempted, so the floor is unsatisfiable; a not-measured rate never passes one. `evaluatorErrorRateAboveMaximum` — the grader failed too often for the run to describe the server. `evaluatorErrorRateNotMeasured` — the same unsatisfiable case for the ceiling. `caseHasNoEligibleTrials` — a case graded nothing, which is inconclusive even at `passThreshold: 0`. `casePassRateMetThreshold` — a case's own passing reason. `casePassRateBelowThreshold` — a case failed its threshold, and so therefore did the suite. `allMeasuredCasesMetThreshold` — the suite's only passing reason.");function oK(e){return typeof e=="string"&&DI.includes(e)}var aK=2e3,oa=w({model:b().min(1).max(200),provider:b().min(1).max(200).optional(),selectionKey:b().min(1).max(aK).optional()}).strict();function lK(e){if(!e.executionVariant)return`${e.caseId}\0`;const{model:n,provider:r,selectionKey:s}=e.executionVariant,i=`${e.caseId}\0${r??""}\0${n}`;return s===void 0?i:`${i}\0${s}`}var AI=500*100,II=w({caseId:Gi,executionVariant:oa.optional(),configuredTrials:rK,attemptedTrials:Qt,eligibleTrials:Qt,passedTrials:Qt,failedTrials:Qt,effectivePassThreshold:Fn,passRate:Xt,completionRate:Xt,observedStability:Xt,mixedVerdict:oe(),verdict:SI,reason:TI}).strict(),cK=II.superRefine((e,t)=>{const n=(a,l)=>t.addIssue({code:"custom",path:[a],message:l});tl(t,["passRate"],e.passRate),tl(t,["completionRate"],e.completionRate),tl(t,["observedStability"],e.observedStability),e.attemptedTrials>e.configuredTrials&&n("attemptedTrials",`attempted ${e.attemptedTrials} exceeds configured ${e.configuredTrials}`),e.eligibleTrials>e.attemptedTrials&&n("eligibleTrials",`eligible ${e.eligibleTrials} exceeds attempted ${e.attemptedTrials}`),e.passedTrials+e.failedTrials!==e.eligibleTrials&&n("eligibleTrials",`passed ${e.passedTrials} + failed ${e.failedTrials} must equal eligible ${e.eligibleTrials}: an eligible trial is one with a task verdict, so there is no third bucket`),e.mixedVerdict!==(e.passedTrials>0&&e.failedTrials>0)&&n("mixedVerdict","mixedVerdict must be true exactly when both a pass and a fail were graded"),e.passRate.denominator!==e.eligibleTrials&&n("passRate",`passRate denominator ${e.passRate.denominator} must be eligibleTrials ${e.eligibleTrials}`),e.passRate.numerator!==e.passedTrials&&n("passRate",`passRate numerator ${e.passRate.numerator} must be passedTrials ${e.passedTrials}`),e.completionRate.denominator!==e.attemptedTrials&&n("completionRate",`completionRate denominator ${e.completionRate.denominator} must be attemptedTrials ${e.attemptedTrials}`),e.observedStability.denominator!==e.eligibleTrials&&n("observedStability",`observedStability denominator ${e.observedStability.denominator} must be eligibleTrials ${e.eligibleTrials}`);const r=Math.max(e.passedTrials,e.failedTrials);if(e.observedStability.numerator!==r&&n("observedStability",`observedStability numerator ${e.observedStability.numerator} must be max(passed, failed) = ${r}`),e.eligibleTrials===0){e.verdict!=="inconclusive"&&n("verdict","a case with no eligible trials is inconclusive, whatever its threshold"),e.reason!=="caseHasNoEligibleTrials"&&n("reason",'expected reason "caseHasNoEligibleTrials"');return}if(e.passRate.state!=="measured"){n("passRate","a case with eligible trials has a measured passRate");return}const s=e.passRate.value>=e.effectivePassThreshold,i=s?"passed":"failed";e.verdict!==i&&n("verdict",`passRate ${e.passRate.value} against threshold ${e.effectivePassThreshold} is "${i}"`);const o=s?"casePassRateMetThreshold":"casePassRateBelowThreshold";e.reason!==o&&n("reason",`expected reason "${o}"`)});function Yie(e,t){if(!Number.isFinite(e)||e<=0||!Number.isFinite(t)||t<=0)return 0;const n=Math.floor(e),r=Math.min(1,t);let s=0;for(;s<n&&s/n<r;)s+=1;return s}var uK=w({policy:wI,holds:oe(),configuredTrials:Qt,attemptedTrials:Qt,eligibleTrials:Qt,completionRate:Xt,evaluatorErrorRate:Xt}).strict(),dK=w({verdictPolicyVersion:tK,verdict:SI,reasons:K(TI).min(1).max(Ol.length),validity:uK,cases:K(II).min(1).max(AI)}).strict();function Qb(e,t,n){const r=[...n].sort((s,i)=>Ol.indexOf(s)-Ol.indexOf(i));t.length===r.length&&t.every((s,i)=>s===r[i])||e(["reasons"],`reasons must be exactly [${r.join(", ")}] in that order — the checks this decision's own measurements failed (or, once validity holds, the one its cases produced) — not [${t.join(", ")}]`)}var QC=dK.superRefine((e,t)=>{const n=(y,S)=>t.addIssue({code:"custom",path:y,message:S});for(const[y,S]of e.cases.entries()){const E=cK.safeParse(S);if(!E.success)for(const D of E.error.issues)n(["cases",y,...D.path],D.message)}const r=new Set;e.reasons.forEach((y,S)=>{r.has(y)&&n(["reasons",S],`duplicate reason "${y}"`),r.add(y)});const s=new Set,i=new Set,o=new Set;e.cases.forEach((y,S)=>{const E=lK(y);s.has(E)&&n(["cases",S],`case "${y.caseId}" already has an aggregate for this execution variant; a fan-out run reports ONE row per provider/model pair`),s.add(E),(y.executionVariant?i:o).add(y.caseId)});for(const y of i)o.has(y)&&n(["cases"],`case "${y}" mixes variant-keyed and unkeyed aggregates: an omitted executionVariant means "this run did not fan out", not "any variant", so the two cannot describe the same case`);const a=new Set(e.cases.map(y=>y.caseId)).size;a>500&&n(["cases"],`${a} distinct cases exceeds the portable suite-file maximum of 500`);const l=e.cases.reduce((y,S)=>({configured:y.configured+S.configuredTrials,attempted:y.attempted+S.attemptedTrials,eligible:y.eligible+S.eligibleTrials}),{configured:0,attempted:0,eligible:0}),c=e.validity;c.configuredTrials!==l.configured&&n(["validity","configuredTrials"],`configuredTrials ${c.configuredTrials} must be the sum over cases (${l.configured})`),c.attemptedTrials!==l.attempted&&n(["validity","attemptedTrials"],`attemptedTrials ${c.attemptedTrials} must be the sum over cases (${l.attempted})`),c.eligibleTrials!==l.eligible&&n(["validity","eligibleTrials"],`eligibleTrials ${c.eligibleTrials} must be the sum over cases (${l.eligible})`),c.completionRate.denominator!==c.attemptedTrials&&n(["validity","completionRate"],`completionRate denominator ${c.completionRate.denominator} must be attemptedTrials ${c.attemptedTrials}`),tl(t,["validity","completionRate"],c.completionRate),tl(t,["validity","evaluatorErrorRate"],c.evaluatorErrorRate),c.evaluatorErrorRate.denominator!==c.attemptedTrials&&n(["validity","evaluatorErrorRate"],`evaluatorErrorRate denominator ${c.evaluatorErrorRate.denominator} must be attemptedTrials ${c.attemptedTrials}`);const u=c.policy.coverage.kind==="minEligibleTrials"?c.eligibleTrials>=c.policy.coverage.minEligibleTrials:c.attemptedTrials===c.configuredTrials&&c.eligibleTrials>=c.policy.coverage.minGradeableTrials,d=c.completionRate.state==="measured"&&c.completionRate.value>=c.policy.minCompletionRate,h=c.evaluatorErrorRate.state==="measured"&&c.evaluatorErrorRate.value<=c.policy.maxEvaluatorErrorRate,f=e.cases.every(y=>y.eligibleTrials>0),B=u&&d&&h&&f;if(c.holds!==B&&n(["validity","holds"],`holds must be ${B} for these measurements against this policy`),!B){e.verdict!=="inconclusive"&&n(["verdict"],"validity does not hold, so the verdict is inconclusive — a run that was not measured says nothing about the server");const y=e.reasons.find(E=>!oK(E));y&&n(["reasons"],`"${y}" is a task reason, but validity is evaluated first and did not hold`);const S=[];c.policy.coverage.kind==="allConfiguredTrialsAttempted"?(c.attemptedTrials!==c.configuredTrials&&S.push("configuredTrialsNotAttempted"),c.eligibleTrials<c.policy.coverage.minGradeableTrials&&S.push("noGradeableTrials")):c.eligibleTrials<c.policy.coverage.minEligibleTrials&&S.push("eligibleTrialsBelowMinimum"),c.completionRate.state!=="measured"?S.push("completionRateNotMeasured"):d||S.push("completionRateBelowMinimum"),c.evaluatorErrorRate.state!=="measured"?S.push("evaluatorErrorRateNotMeasured"):h||S.push("evaluatorErrorRateAboveMaximum"),f||S.push("caseHasNoEligibleTrials"),Qb(n,e.reasons,S);return}const g=e.cases.find(y=>y.verdict==="inconclusive"),C=e.cases.find(y=>y.verdict==="failed"),v=g?"inconclusive":C?"failed":"passed";e.verdict!==v&&n(["verdict"],`with validity holding, the cases make this run "${v}"`),Qb(n,e.reasons,[v==="passed"?"allMeasuredCasesMetThreshold":"casePassRateBelowThreshold"])});var Ie=M().int().min(0);var hK=ir.length,fK=["provisional","final"],YC=V(fK),Ml=w({lifecycle:Ie.optional(),integrity:Ie.optional(),version:Ie.optional(),notApplicable:Ie.optional(),reachUnknown:Ie.optional(),notMeasured:Ie.optional()}).strict(),BK=w({notTerminal:Ie.optional(),skipped:Ie.optional(),cancelled:Ie.optional(),setupFailed:Ie.optional(),timedOut:Ie.optional(),executionFailed:Ie.optional(),evaluatorError:Ie.optional(),chainMissing:Ie.optional(),chainUnverified:Ie.optional(),chainVersionAhead:Ie.optional(),measurementsMissing:Ie.optional(),measurementsInvalid:Ie.optional(),measurementsVersionAhead:Ie.optional(),analyzerMismatch:Ie.optional()}).strict(),Xie=ft("state",[w({state:L(Qp[0]),value:Fn,numerator:Ie,denominator:M().int().min(1),exclusions:Ml}).strict(),w({state:L(Qp[1]),value:Ql(),numerator:L(0),denominator:L(0),exclusions:Ml}).strict()]);function XC(e,t,n={}){return!Number.isInteger(e)||!Number.isInteger(t)||t<=0||e<0||e>t?{state:"notMeasured",value:null,numerator:0,denominator:0,exclusions:n}:{state:"measured",value:e/t,numerator:e,denominator:t,exclusions:n}}function kI(e){return w({unit:L("ms"),basis:L(e),sampleCount:M().int().min(1),totalMs:M().finite().min(0),minMs:M().finite().min(0),maxMs:M().finite().min(0)}).strict().superRefine((t,n)=>{t.minMs>t.maxMs&&n.addIssue({code:"custom",path:["minMs"],message:`minMs ${t.minMs} exceeds maxMs ${t.maxMs}`}),t.totalMs<t.minMs*t.sampleCount&&n.addIssue({code:"custom",path:["totalMs"],message:`totalMs ${t.totalMs} is below minMs × sampleCount (${t.minMs} × ${t.sampleCount}); the counts and bounds describe different sample sets`}),t.totalMs>t.maxMs*t.sampleCount&&n.addIssue({code:"custom",path:["totalMs"],message:`totalMs ${t.totalMs} exceeds maxMs × sampleCount (${t.maxMs} × ${t.sampleCount}); the counts and bounds describe different sample sets`})})}var pK=kI(oI),mK=kI(nq);function Zie(e){return e===void 0||e.sampleCount<=0?null:e.totalMs/e.sampleCount}var gK=w({reason:nI,count:M().int().min(1)}).strict(),CK=w({stage:Vi,applicable:Ie,reached:Ie,notReached:Ie,reachUnknown:Ie,measured:Ie,passed:Ie,failed:Ie,notMeasured:Ie,notApplicable:Ie,excluded:Ml,reasons:K(gK).max(KC.length),latency:pK.optional()}).strict().superRefine((e,t)=>{e.passed+e.failed!==e.measured&&t.addIssue({code:"custom",path:["measured"],message:`measured ${e.measured} is not passed + failed (${e.passed} + ${e.failed})`}),e.measured+e.notMeasured!==e.reached&&t.addIssue({code:"custom",path:["reached"],message:`reached ${e.reached} is not measured + notMeasured (${e.measured} + ${e.notMeasured})`}),e.reached+e.notReached+e.reachUnknown!==e.applicable&&t.addIssue({code:"custom",path:["applicable"],message:`applicable ${e.applicable} is not reached + notReached + reachUnknown (${e.reached} + ${e.notReached} + ${e.reachUnknown})`}),e.latency!==void 0&&e.latency.sampleCount>e.reached&&t.addIssue({code:"custom",path:["latency","sampleCount"],message:`latency sampleCount ${e.latency.sampleCount} exceeds reached ${e.reached}; a stage cannot be timed more often than it ran`})}),vK=w({category:qC,count:M().int().min(1)}).strict(),yK=ft("dimension",[w({dimension:L("overall")}).strict(),w({dimension:L("intent"),intent:b().min(1).nullable()}).strict(),w({dimension:L("model"),provider:b().min(1),model:b().min(1)}).strict(),w({dimension:L("host"),hostKey:b().min(1),hostName:b().min(1).optional(),executionEngine:b().min(1).optional()}).strict()]),bK=w({slice:yK,includedTrials:Ie,excludedTrials:Ml,failureCategories:K(vK).max(WC.length),stages:K(CK).length(hK)}).strict().superRefine((e,t)=>{ir.forEach((n,r)=>{const s=e.stages[r];s!==void 0&&s.stage!==n&&t.addIssue({code:"custom",path:["stages",r,"stage"],message:`stages[${r}] is '${s.stage}' but must be '${n}': the six tallies are a funnel and position is meaning`})})}),RI=["connection","discovery"],SK=w({phase:V(RI),uniqueAttempts:Ie,failedAttempts:Ie,serverAttributedFailures:Ie,impactedTrials:Ie,latency:mK.optional()}).strict().superRefine((e,t)=>{e.failedAttempts>e.uniqueAttempts&&t.addIssue({code:"custom",path:["failedAttempts"],message:`failedAttempts ${e.failedAttempts} exceeds uniqueAttempts ${e.uniqueAttempts}`}),e.serverAttributedFailures>e.failedAttempts&&t.addIssue({code:"custom",path:["serverAttributedFailures"],message:`serverAttributedFailures ${e.serverAttributedFailures} exceeds failedAttempts ${e.failedAttempts}`}),e.latency!==void 0&&e.latency.sampleCount>e.uniqueAttempts&&t.addIssue({code:"custom",path:["latency","sampleCount"],message:`latency sampleCount ${e.latency.sampleCount} exceeds uniqueAttempts ${e.uniqueAttempts}; setup latency is sampled once per attempt, never once per copied iteration`})}),EK=w({dimension:V(["intent","model","host"]),distinctValues:M().int().min(1),retained:M().int().min(0)}).strict(),xK=w({schemaVersion:L(1),measurementUnit:L("trial"),runId:b().min(1),suiteId:b().min(1),runGroupId:b().min(1).optional(),configRevision:b().min(1).optional(),caseSetFingerprint:b().min(1).optional(),organizationId:b().min(1).optional(),workspaceId:b().min(1).optional(),projectId:b().min(1).optional(),runCompletedAt:M().int().min(0).optional(),sourceIterationCount:Ie,sourceMaxUpdatedAt:M().int().min(0).optional(),stageAnalyzerVersion:M().int().min(1),sourceStageAnalyzerVersions:K(M().int().min(1)).min(2).optional(),measurementsSchemaVersion:M().int().min(1),sourceMeasurementsSchemaVersions:K(M().int().min(1)).min(2).optional(),materializationState:YC,createdAt:M().int().min(0),updatedAt:M().int().min(0),includedTrials:Ie,excludedTrials:Ml,totalTrials:Ie,excludedTrialDetail:BK,slices:K(bK).max(101),setup:K(SK).max(RI.length),sliceTruncation:K(EK).max(3).optional()}).strict(),eoe=xK.superRefine((e,t)=>{const n=e.slices.filter(i=>i.slice.dimension==="overall"),[r]=n;n.length!==1||r===void 0?t.addIssue({code:"custom",path:["slices"],message:`expected exactly one 'overall' slice, found ${n.length}: the overall funnel is the one slice every reader can rely on`}):r.includedTrials!==e.includedTrials&&t.addIssue({code:"custom",path:["slices"],message:`the overall slice counts ${r.includedTrials} included trials but the row counts ${e.includedTrials}`}),e.includedTrials>e.totalTrials&&t.addIssue({code:"custom",path:["includedTrials"],message:`includedTrials ${e.includedTrials} exceeds totalTrials ${e.totalTrials}`});const s=e.setup.map(i=>i.phase);new Set(s).size!==s.length&&t.addIssue({code:"custom",path:["setup"],message:`duplicate setup phases ${JSON.stringify(s)}: a phase is measured once per run and two rows for one phase means the copies were counted`})});function toe(e){return XC(e.measured,e.reached,{...e.excluded,...e.notMeasured>0?{notMeasured:e.notMeasured}:{}})}function noe(e){return XC(e.passed,e.measured,{...e.excluded,...e.notMeasured>0?{notMeasured:e.notMeasured}:{}})}function roe(e){return XC(e.reached,e.reached+e.notReached,{...e.excluded,...e.reachUnknown>0?{reachUnknown:e.reachUnknown}:{}})}var OI=["iterations","casesIgnoringExecutionVariant"],wK=Hn([L(0),L(1)]),DK=ft("scope",[w({scope:L("perCase"),threshold:Fn}).strict(),w({scope:L("suiteWide"),thresholdPercent:M().min(0).max(100),population:V(OI),emptyPopulationRate:wK}).strict()]),MI=M().int().min(1).max(100);var TK=ft("kind",[w({kind:L("defaultCount"),iterations:MI}).strict(),w({kind:L("caseCountWithFloor"),minimumIterations:M().int().min(1).max(10).nullable()}).strict()]),AK=ft("enforced",[w({enforced:L(!1)}).strict(),w({enforced:L(!0),declared:JC,resolved:wI}).strict()]),IK=w({caseRef:b().min(1).max(200),iterations:MI.optional(),passThreshold:Fn.optional()}).strict(),NI=["suiteFile","hostedPerCase","hostedSuiteWide","runReporting"],kK=w({passCriterion:DK,iterationRule:TK,validity:AK,caseOverrides:K(IK),origin:V(NI)}).strict(),soe=kK.superRefine((e,t)=>{e.passCriterion.scope==="suiteWide"&&e.caseOverrides.forEach((n,r)=>{n.passThreshold!==void 0&&t.addIssue({code:"custom",path:["caseOverrides",r,"passThreshold"],message:`case "${n.caseRef}" carries a per-case passThreshold under a suite-wide criterion, where nothing reads it: the suite-wide rate is measured once over the whole run. Change the criterion scope to perCase, or drop the override.`})})}),RK=["hosted","localFallback"],OK=["iterationsNotRepresentable","minimumIterationsNotRepresentable","validityNotEnforced","readOnlyPolicy"],ioe=w({passThreshold:Fn.optional(),iterations:M().int().min(1).max(100).optional(),minimumIterations:Hn([M().int().min(1).max(10),Ql()]).optional(),validity:JC.optional()}).strict();var Rh=["identifierSurfacedUnused","searchRepeatedAfterIdentifier","identicalRetry","changedRetry","paginationContinuation"],ooe=V(Rh),MK=["identifierSurfacedUnused","searchRepeatedAfterIdentifier"],PI=["noToolCalls","resultsUnavailable","orderingUnknown","evidenceIncomplete","truncated"],LI=V(PI);var _I=["cursor","nextCursor","page","pageToken","offset","after","before","start","limit"],aoe=new Set(_I),or=M().int().min(0),Qf=M().int().min(0),mc=b().min(1),FI=b().min(1),NK=w({kind:L("identifierSurfacedUnused"),informationCallIndex:or,observedAtCallIndex:or,toolName:mc,toolCallId:b().min(1).optional(),identifierKeyPaths:K(FI).max(8),identifierCount:M().int().min(1),laterCallCount:M().int().min(2)}).strict(),PK=w({kind:L("searchRepeatedAfterIdentifier"),informationCallIndex:or,observedAtCallIndex:or,toolName:mc,toolCallId:b().min(1).optional(),repeatCallIndexes:K(or).min(1).max(8),identifierKeyPaths:K(FI).max(8),identifierCount:M().int().min(1)}).strict(),LK=w({kind:L("identicalRetry"),callIndex:or,priorCallIndex:or,toolName:mc,afterError:oe()}).strict(),_K=w({kind:L("changedRetry"),callIndex:or,priorCallIndex:or,toolName:mc,afterError:oe()}).strict(),FK=w({kind:L("paginationContinuation"),callIndex:or,priorCallIndex:or,toolName:mc,paginationKeys:K(V(_I)).min(1).max(4)}).strict(),HK=ft("kind",[NK,PK,LK,_K,FK]),jK=ft("state",[w({state:L("measured")}).strict(),w({state:L("notMeasured"),reason:LI}).strict()]),GK=w({version:L(1),state:V(["measured","notMeasured"]),notMeasuredReason:LI.optional(),callCount:Qf,resultAvailableCount:Qf,timedCallCount:Qf,identifierSignals:jK,signals:K(HK).max(24)}).strict();function VK(e){return e.kind==="identifierSurfacedUnused"||e.kind==="searchRepeatedAfterIdentifier"?e.observedAtCallIndex:e.callIndex}var loe=GK.superRefine((e,t)=>{e.state==="notMeasured"?(e.notMeasuredReason===void 0&&t.addIssue({code:"custom",path:["notMeasuredReason"],message:"a notMeasured document must say why"}),e.signals.length>0&&t.addIssue({code:"custom",path:["signals"],message:"a notMeasured document cannot carry signals"})):e.notMeasuredReason!==void 0&&t.addIssue({code:"custom",path:["notMeasuredReason"],message:"a measured document must not carry a notMeasured reason"}),e.resultAvailableCount>e.callCount&&t.addIssue({code:"custom",path:["resultAvailableCount"],message:`resultAvailableCount ${e.resultAvailableCount} cannot exceed callCount ${e.callCount}`}),e.timedCallCount>e.callCount&&t.addIssue({code:"custom",path:["timedCallCount"],message:`timedCallCount ${e.timedCallCount} cannot exceed callCount ${e.callCount}`});let n=-1;for(const[r,s]of e.signals.entries()){const i=["signals",r];e.identifierSignals.state==="notMeasured"&&MK.includes(s.kind)&&t.addIssue({code:"custom",path:[...i,"kind"],message:"identifier signals are notMeasured, so no identifier-kind signal may be present"});const o=s.kind==="identifierSurfacedUnused"||s.kind==="searchRepeatedAfterIdentifier"?[["informationCallIndex",s.informationCallIndex],["observedAtCallIndex",s.observedAtCallIndex]]:[["priorCallIndex",s.priorCallIndex],["callIndex",s.callIndex]];for(const[l,c]of o)c>=e.callCount&&t.addIssue({code:"custom",path:[...i,l],message:`${l} ${c} must be below callCount ${e.callCount}`});if(s.kind==="identifierSurfacedUnused"||s.kind==="searchRepeatedAfterIdentifier"){if(s.informationCallIndex>=s.observedAtCallIndex&&t.addIssue({code:"custom",path:[...i,"observedAtCallIndex"],message:"observedAtCallIndex must be after informationCallIndex — the pattern cannot become observable before it happened"}),s.kind==="searchRepeatedAfterIdentifier")for(const[l,c]of s.repeatCallIndexes.entries())c>s.observedAtCallIndex&&t.addIssue({code:"custom",path:[...i,"repeatCallIndexes",l],message:"a repeat cannot fall after the observation index"})}else s.priorCallIndex>=s.callIndex&&t.addIssue({code:"custom",path:[...i,"priorCallIndex"],message:"priorCallIndex must be before callIndex"});const a=VK(s);a<n&&t.addIssue({code:"custom",path:i,message:"signals must be ordered by the call that made them observable"}),n=a}}),coe=new Map(Rh.map((e,t)=>[e,t])),HI=["unclear","idBuriedInPayload","idNameCollision","missingQueryEcho","silentTruncation","ambiguousErrorSemantics","missingUnits","responseWasClear","descriptionMisleading"],UK=V(HI),zK=["low","medium","high"],$K=V(zK),WK=["spendBlocked","traceIncomplete","noEvidence","cap"];var qK=w({callIndex:M().int().min(0),toolName:b().min(1),fieldPath:b().min(1).max(120).optional()}).strict(),Yf={gradingKey:b().min(1),signalKind:b().min(1),informationCallIndex:M().int().min(0),observedAtCallIndex:M().int().min(0),judgeTemplateVersion:M().int().min(1),judgeTemplateHash:b().min(1),model:b().min(1),generatedAt:M().int().min(0)},uoe=ft("status",[w({status:L("scored"),condition:UK,confidence:$K,remediation:b().min(1).max(300).optional(),evidence:qK.optional(),...Yf}).strict(),w({status:L("skipped"),reason:V(WK),...Yf}).strict(),w({status:L("error"),...Yf}).strict()]);var KK=["pending","running","succeeded","failed","rate_limited"],JK=["pending","running","ran","broke","limited","withdrawn"],QK=["passed","failed","inconclusive","notEstablished"],YK=["notRequested","queued","running","settled","unavailable"],XK=["canceled","stale_runner","runner_shutdown","run_timeout"],jI={attemptPending:"notEstablished",attemptRunning:"notEstablished",withdrawn:"notEstablished",spendCapReached:"notEstablished",notRun:"notEstablished",executionFailed:"notEstablished",ungraded:"notEstablished",gradingNotClaimed:"notEstablished",criteriaPending:"notEstablished",judgePending:"notEstablished",gatingCriterionFailed:"failed",judgeFailed:"failed",criteriaGradingErrored:"inconclusive",gatingCriterionUnmeasured:"inconclusive",judgeErrored:"inconclusive",gradingUnavailable:"inconclusive",allGatingCriteriaPassed:"passed",judgePassed:"passed",allGradersPassed:"passed"},ZK=Object.keys(jI),e8=V(JK),ZC=V(QK),Yb=V(["advisory","required"]),t8=w({status:V(KK),errorCode:b().nullable().optional()}).strict(),GI=w({state:V(YK),reasonCode:b().min(1).optional()}).strict(),n8=w({criterionId:b().min(1),passed:oe(),status:V(["scored","error"]).optional()}).strict(),doe=w({attempt:t8.nullable(),hasTranscript:oe(),rubric:K(w({id:b().min(1),role:Yb,predicateType:b().min(1).optional()}).strict()),criteria:w({status:V(["pending","completed","failed"]),criterionIds:K(b().min(1)).optional(),results:K(n8).optional()}).strict().nullable(),goalScore:ft("status",[w({status:L("completed"),passed:oe()}).strict(),w({status:L("running")}).strict(),w({status:L("failed")}).strict()]).nullable(),judge:w({automatic:oe(),role:Yb,requested:oe().optional()}).strict(),grading:GI}).strict().superRefine((e,t)=>{const n=new Set(e.rubric.map(s=>s.id));n.size!==e.rubric.length&&t.addIssue({code:"custom",path:["rubric"],message:"Duplicate criterion definition"});for(const[s,i]of[["criterionIds",e.criteria?.criterionIds??[]],["results",e.criteria?.results?.map(o=>o.criterionId)??[]]])(new Set(i).size!==i.length||i.some(o=>!n.has(o)))&&t.addIssue({code:"custom",path:["criteria",s],message:"Criterion IDs must be unique and defined in the snapshot"});const r=e.criteria?.criterionIds;r&&e.criteria?.results?.some(s=>!r.includes(s.criterionId))&&t.addIssue({code:"custom",path:["criteria","results"],message:"Result outside claimed scope"})}),r8=["pending","running","completed","failed","setup_failed","cancelled"],s8=w({status:V(r8),taskVerdict:V(["passed","failed"]).optional(),evaluatorError:L(!0).optional()}).strict().superRefine((e,t)=>{const n=e.taskVerdict!==void 0,r=e.evaluatorError===!0;(e.status==="completed"?n===r:n||r)&&t.addIssue({code:"custom",message:"Only completed trials carry exactly one verdict or evaluator error"})}),i8=w({gating:M().int().nonnegative(),gatingPassed:M().int().nonnegative(),gatingFailed:M().int().nonnegative(),gatingUnmeasured:M().int().nonnegative(),advisoryFailed:M().int().nonnegative()}).strict(),o8=w({contractVersion:L(1),lifecycle:e8,verdict:ZC,reason:V(ZK),verdictSource:V(["goalJudge","requiredAssertions","combined","none"]),grading:GI,graders:w({criteria:V(["notConfigured","notClaimed","pending","scored","errored"]),judge:V(["notConfigured","silent","pending","scored","errored"])}).strict(),counts:i8,trial:s8.nullable()}).strict().superRefine((e,t)=>{const n=i=>t.addIssue({code:"custom",message:i});jI[e.reason]!==e.verdict&&n("Reason contradicts verdict");const r=e.counts;r.gating!==r.gatingPassed+r.gatingFailed+r.gatingUnmeasured&&n("Required measurement counts do not add up");const s=e.trial;s?.status==="completed"&&(e.lifecycle!=="ran"&&n("Only a completed execution can be a completed trial"),s.taskVerdict!==void 0&&s.taskVerdict!==e.verdict&&n("Trial contradicts goal result"),s.evaluatorError&&e.verdict!=="inconclusive"&&n("Evaluator error requires inconclusive grading")),e.lifecycle!=="ran"&&s?.status!=={pending:"pending",running:"running",broke:"failed",limited:"setup_failed",withdrawn:"cancelled"}[e.lifecycle]&&n("Trial must preserve execution lifecycle"),e.lifecycle==="ran"&&s!==null&&s.status!=="completed"&&n("Completed execution must not become skipped or running"),(e.verdict==="passed"||e.verdict==="failed")&&e.verdictSource==="none"&&n("A measured goal verdict needs a source"),e.lifecycle==="ran"&&e.verdict!=="notEstablished"&&s===null&&n("Settled grading on completed execution needs an observation"),e.verdict==="notEstablished"&&e.verdictSource!=="none"&&n("An undecided goal has no verdict source")});function hoe(e,t=!1){return!e||e.status==="pending"?"pending":e.status==="running"?"running":XK.includes(e.errorCode)?"withdrawn":e.status==="rate_limited"&&!t?"limited":e.status==="succeeded"?"ran":"broke"}function foe(e,t){return(e==="broke"||e==="limited"||e==="withdrawn")&&t===0}function Boe(e){return e?e.verdict==="notEstablished"?["queued","running"].includes(e.grading.state)?"Grading":e.reason==="ungraded"?"Not graded":"Not established":a8(e.verdict):"Unknown"}function a8(e){return{passed:"Passed",failed:"Failed",inconclusive:"Inconclusive",notEstablished:"Not established"}[e]}var Yp=["notRun","blockedConnecting","lostFindingTool","blockedCallingTool","blockedByResponse","goalMissed","goalMetWithFriction","goalMet","notMeasured"],VI=["fail","warn","ok","muted"],Xp=["notLaunched","broken","friction","landed","ungraded","unread"],Zp=["sessionScanCapped","budgetExhausted","transcriptMissing","contextTooLarge","extractionRejected","chainUnmeasured","judgeNotRun","sessionsWithdrawn","sessionsRateLimited","partialRead","toolCatalogMissing","mechanismsRejected","analysisUnavailable"],em=["outputTruncated","hallucinatedTool","toolErrored","noToolCalled","turnCapReached"],tm=["session","goal","persona","target","wave"],nm=["verifiedMechanism","sessionReport","populationFact"],l8=["derived","reported","unmeasured"],c8=Object.freeze({notRun:"muted",blockedConnecting:"fail",lostFindingTool:"fail",blockedCallingTool:"fail",blockedByResponse:"fail",goalMissed:"fail",goalMetWithFriction:"warn",goalMet:"ok",notMeasured:"muted"}),Is=e=>e.map(t=>"`"+t+"`").join(", "),kt=M().int().nonnegative(),UI=w({personaRefId:b().nullable(),name:b()}).strict(),zI=V(Yp).describe(Is(Yp)),$I=K(V(Zp).describe(Is(Zp))),Xb=K(b().regex(/^[^/]+\/.+$/)).max(30),WI=e=>e.tone===c8[e.disposition],qI={message:"tone must equal SWARM_FINDING_TONE_OF_DISPOSITION[disposition]",path:["tone"]},u8=w({id:b().min(1),basis:V(nm).describe(Is(nm)),scopeLevel:V(tm).describe(Is(tm)),persona:UI,goal:w({runId:b(),journeyRefId:b(),title:b()}).strict(),target:w({kind:V(["environment","host"]),id:b(),label:b(),modelId:b().nullable()}).strict(),population:w({count:kt,total:kt,unit:L("sessions")}).strict(),sessionIds:K(b()).max(1e3),citations:Xb,verdictSeen:ZC,chainStage:Vi.nullable().describe(Is(ir)),chainStageState:tI.nullable().describe(Is($C)),chainStageBasis:V(l8),disposition:zI,tone:V(VI),coverageNotes:$I,outcomePhrase:b().max(100).regex(/^[^0-9]*$/).refine(e=>e.trim().split(/\s+/).length<=8,"At most eight words").nullable(),mechanismPhrase:b().nullable(),fixPhrase:b().nullable(),reportExcerpt:w({actual:b().max(1800),account:b().max(600).nullable().optional(),citations:Xb}).strict().nullable(),mechanismId:b().nullable(),signal:V(em).describe(Is(em)).nullable().optional()}).strict().refine(WI,qI),poe=w({contractVersion:L(1),generatedAt:kt,sourceRevision:b(),pipelineVersion:kt,extractionVersion:kt,extractionModel:b(),reasoningModel:b(),summaryKind:V(Xp).describe(Is(Xp)),population:w({configured:kt,started:kt,read:kt,unread:kt,withdrawn:kt,limited:kt,graded:kt}).strict(),coverageNotes:$I,disclosure:w({rail:V(["gateway","openrouter"]),evidenceSent:K(b())}).strict(),personas:K(w({persona:UI,disposition:zI,tone:V(VI),goalRunIds:K(b())}).strict().refine(WI,qI)),findings:K(u8).max(200),verification:w({proposed:kt,confirmed:kt,rejected:kt,unverified:kt,omitted:kt}).strict().optional()}).strict(),moe=w({status:V(["pending","completed","failed","skipped"]),errorCode:b().optional(),updatedAt:kt}).strict(),goe=Object.freeze({connection:"Connection",discovery:"Discovery",selection:"Selection",call:"Tool call",response:"Response",userValue:"User value"}),Coe=Object.freeze({connection:"Could the client reach the server and initialize a session?",discovery:"Did the client receive usable primitives and metadata?",selection:"Did the model choose the right tool for the request?",call:"Was the call made with usable arguments?",response:"Did the server return data the model could use?",userValue:"Was the user's actual request satisfied?"}),voe=Object.freeze({connection:"Session connected",discovery:"Tools and resources discovered",selection:"Right tool selected",call:"Valid call made",response:"Usable response returned",userValue:"Request satisfied"}),yoe=Object.freeze({passed:"passed",failed:"failed",notReached:"never ran (an earlier stage failed)",notMeasured:"not measured",notApplicable:"not applicable to this case"}),boe=Object.freeze({setup:"setup",metadata:"tool metadata",selection:"tool selection",arguments:"call arguments",serverData:"server data",userValue:"user value",evaluator:"evaluator"}),Soe=Object.freeze({noSpanChannel:"this run captures no evidence channel for that stage",noEvidenceCaptured:"nothing eligible for that stage was captured",matchVerdictUnavailable:"extra tool calls were captured but the run did not report whether its match options tolerate them",traceAbsent:"the iteration recorded no trace",executorEmitsNoSpans:"the executor emitted no spans",blockedByPolicy:"a policy blocked the run before it could be measured",evaluatorError:"the evaluator itself failed, so the run says nothing about the server",providerError:"the model provider failed the call, so this stage was never measured",setupAborted:"the environment was never prepared, so the test never began",connectFailed:"the configured server was reached and initialize failed there",toolsListFailed:"initialize succeeded and listing tools failed",egressUnverified:"the connection failed with no evidence that our own network egress works",lifecycleStopped:"the run was stopped mid-flight",notAuthored:"the case asserts nothing this stage could decide",earlierStageFailed:"an earlier stage failed",missingToolCall:"an expected tool call was never made",unexpectedToolCall:"a tool call was made that the case did not expect",argumentMismatch:"the call arguments did not match what the case expects",toolError:"the server reported a tool error",protocolError:"the call never produced a result",renderFailed:"the widget did not render",predicateFailed:"an assertion on the result did not hold",observed:"the evidence was inspected and the stage held",impliedByLaterEvidence:"a later stage's success implies it",judgeObserved:"the LLM judge scored at or above the threshold",judgePartial:"the LLM judge scored inside the partial band — at or above the floor, below the threshold",judgeFailed:"the LLM judge scored below the partial floor",judgePending:"an LLM judge verdict is owed and has not arrived",judgeNotRequested:"no LLM judge verdict was ever owed"}),Eoe=Object.freeze({missingToolCall:"if this pull request intentionally renamed or removed the expected tool, update this case's expected tool call in MCPJam so the check matches the server; if the tool should still be chosen for this prompt, review its name and description in the tool catalog, then push again",unexpectedToolCall:"decide which side is right: if the extra call is correct behaviour, widen this case's expected tool calls or its match options in MCPJam; if it is not, review the names and descriptions that made the extra tool look applicable",argumentMismatch:"compare the recorded call against the tool's input schema: if this pull request changed the schema, update the case's expected arguments in MCPJam; otherwise review the parameter descriptions that led the model to fill them this way",toolError:"read the error the server returned on the tool result: fix the handler if the arguments were valid, or tighten the input schema so the model cannot send what the handler rejects",protocolError:"the call failed instead of returning a result: read the recorded failure for that call, and its error code where one was captured, to tell a rejection by the server from a connection that broke between the two sides",renderFailed:"read the recorded render status: it names the step that failed — for example no UI resource on the tool result, a widget that never mounted, or a bridge handshake that never completed",predicateFailed:"read the recorded reasons: either this pull request changed the response, or the case asserts something the server no longer promises",connectFailed:"the server was reached and initialize failed there: check the start command in the run recipe and the port the recipe declares",toolsListFailed:"initialize succeeded and listing tools failed: check the server's tools/list handler",setupAborted:"the environment was never prepared, so nothing here is a statement about the server: check the build and start steps in the run recipe",evaluatorError:"the evaluator itself failed, so this case says nothing about the server: check the suite's evaluator configuration",blockedByPolicy:"a policy stopped this run before it could be measured: check the suite's tool policy and the environment it runs against",lifecycleStopped:"the run was stopped mid-flight, so this case reached no verdict: re-run the check",notAuthored:"this case asserts nothing this stage could decide: add a check in MCPJam if this stage should be measured",judgeFailed:"read the judge's rationale on the run: either the response stopped satisfying the case's goal, or the goal needs rewording to match what the server now returns",judgePartial:"read the judge's rationale on the run: the response was close to the case's goal but under its threshold, so either the server's answer or the threshold needs to move"}),xoe=Object.freeze(["noSpanChannel","noEvidenceCaptured","matchVerdictUnavailable","traceAbsent","executorEmitsNoSpans","providerError","egressUnverified","earlierStageFailed","observed","impliedByLaterEvidence","judgeObserved","judgePending","judgeNotRequested"]),woe=Object.freeze({configuredTrialsNotAttempted:"some configured iteration never ran, so the run does not cover what it was asked to",noGradeableTrials:"nothing in the run produced a gradeable verdict",eligibleTrialsBelowMinimum:"fewer gradeable iterations than the suite's validity floor requires",completionRateBelowMinimum:"too few attempted iterations completed to meet the suite's completion floor",completionRateNotMeasured:"nothing was attempted, so the completion floor cannot be satisfied",evaluatorErrorRateAboveMaximum:"the evaluator failed too often for this run to describe the server",evaluatorErrorRateNotMeasured:"nothing was attempted, so the evaluator-error ceiling cannot be satisfied",caseHasNoEligibleTrials:"a case graded nothing at all",casePassRateMetThreshold:"the case met its pass threshold",casePassRateBelowThreshold:"a case did not meet its pass threshold",allMeasuredCasesMetThreshold:"every measured case met its threshold"}),Doe=Object.freeze({setup:"check the server connection and environment configuration",metadata:"review the tool metadata and descriptions in the server catalog",selection:"review tool selection and the tool catalog",arguments:"review the authored arguments against the tool input schema",serverData:"inspect the tool response returned by the server",userValue:"review whether the response answered the user's goal",evaluator:"check the evaluator configuration; the case was not graded"}),Toe="inspect the case trace; no failure category was recorded",Zb=Object.freeze({notTerminal:"still running, so nothing final to compare",skipped:"deliberately not run",cancelled:"cancelled before it finished",setupFailed:"its environment was never prepared, so the test never began",timedOut:"timed out",executionFailed:"failed to execute",evaluatorError:"the evaluator itself failed, so it says nothing about the server",chainMissing:"no stage chain was ever recorded",chainUnverified:"its stage chain did not validate",chainVersionAhead:"its stage chain was produced by a newer analyzer than this reader knows",measurementsMissing:"no stage measurements were recorded",measurementsInvalid:"its stage measurements did not validate",measurementsVersionAhead:"its stage measurements were produced by a newer schema than this reader knows",analyzerMismatch:"its chain and its measurements were produced by different analyzers"});function Aoe(e){const t=[];for(const n of Object.keys(Zb)){const r=e[n];r!==void 0&&r>0&&t.push({key:n,label:Zb[n],count:r})}return t}var Ioe=Object.freeze({identifierSurfacedUnused:"Identifiers surfaced, none used later",searchRepeatedAfterIdentifier:"Same tool searched again after identifiers",identicalRetry:"Repeated with identical arguments",changedRetry:"Same tool called again with changed arguments",paginationContinuation:"Pagination continued"}),koe=Object.freeze({noToolCalls:"no tool calls to look at",resultsUnavailable:"tool results were not retained",orderingUnknown:"the calls cannot be placed in a causal order",evidenceIncomplete:"the evidence for this iteration has a known hole",truncated:"too many tool calls to measure"}),Roe=Object.freeze({unclear:"could not attribute",idBuriedInPayload:"identifier buried in payload",idNameCollision:"identifier name collision",missingQueryEcho:"response does not echo the query",silentTruncation:"response truncated without saying so",ambiguousErrorSemantics:"error text does not say whether to retry",missingUnits:"value has no stated unit",responseWasClear:"the response was clear",descriptionMisleading:"tool description points the wrong way"}),Ooe=Object.freeze({low:"low confidence",medium:"medium confidence",high:"high confidence"}),Moe=Object.freeze({notRun:"Not run",blockedConnecting:"Stuck",lostFindingTool:"Lost",blockedCallingTool:"Annoyed",blockedByResponse:"Frustrated",goalMissed:"Stalled",goalMetWithFriction:"Uneasy",goalMet:"Relieved",notMeasured:"Unscored"}),Noe=Object.freeze({sessionScanCapped:"Session scan limit reached",budgetExhausted:"Analysis budget exhausted",transcriptMissing:"Transcript unavailable",contextTooLarge:"Transcript exceeds analysis limits",extractionRejected:"Analysis could not be verified",chainUnmeasured:"Journey stages not measured",judgeNotRun:"Judge did not run",sessionsWithdrawn:"Some sessions were withdrawn",sessionsRateLimited:"Some sessions were rate limited",partialRead:"Only part of this wave was read",toolCatalogMissing:"Tool catalog unavailable",mechanismsRejected:"A possible cause was rejected",analysisUnavailable:"Causes could not be analysed"}),Poe=Object.freeze({notLaunched:"Not launched",broken:"Goals blocked",friction:"Goals met with friction",landed:"Goals met",ungraded:"Not graded",unread:"Not fully read"}),Loe=Object.freeze({verifiedMechanism:"Verified explanation",sessionReport:"Session report",populationFact:"Population fact"}),_oe=Object.freeze({outputTruncated:"Reply cut off",hallucinatedTool:"Called a tool that does not exist",toolErrored:"A tool errored",noToolCalled:"No tool used",turnCapReached:"Hit the turn limit"}),Foe=Object.freeze({swarmFindingDispositions:Yp,swarmFindingCoverageNotes:Zp,swarmFindingSummaryKinds:Xp,swarmFindingBases:nm,swarmFindingScopeLevels:tm,swarmFindingSignals:em,stages:ir,stageStates:$C,failureCategories:WC,stageReasons:KC,verdictDecisionReasons:Ol,frictionSignalKinds:Rh,frictionNotMeasuredReasons:PI,suspectedConditions:HI}),Hoe=Object.freeze({perCase:"Per-case pass rate",suiteWide:"Suite accuracy"}),joe=Object.freeze({perCase:"Each case must pass at least this share of its own iterations. A case that falls short fails, whatever the rest of the suite did.",suiteWide:"One rate across the whole run must reach this percentage. Individual cases have no threshold of their own."}),Goe=Object.freeze({perCase:{suffix:"",range:"0–1",noun:"fraction"},suiteWide:{suffix:"%",range:"0–100",noun:"percentage"}}),d8=Object.freeze({iterations:"iterations",casesIgnoringExecutionVariant:"cases, counting all models as one"}),Voe=Object.freeze({iterations:"Every iteration is one unit, so a 3-case suite run 5 times each is measured over 15.",casesIgnoringExecutionVariant:"Every case is one unit however many times or on however many models it ran, so a 3-case suite run 5 times each is measured over 3. A case fails if any of its iterations failed or timed out, and a case with no finished iteration is dropped from the rate entirely."}),Uoe=Object.freeze({0:"a run that measured nothing does not pass",1:"a run that measured nothing passes"}),zoe=Object.freeze({defaultCount:"Iterations per case",caseCountWithFloor:"Minimum iterations per case"}),$oe=Object.freeze({defaultCount:"The suite default. A case that sets its own count uses that instead.",caseCountWithFloor:"A floor, 1–10: a case always runs at least this many times, and a case configured for more keeps its own count. Clearing it removes the floor."}),Woe=Object.freeze({enforced:"Evidence requirements",notEnforced:"No evidence requirements"}),qoe=Object.freeze({enforced:"A run that measured too little is inconclusive rather than passed or failed.",notEnforced:"Runs on this suite are always passed or failed; they are never inconclusive on evidence grounds."}),Koe=Object.freeze({minCompletionRate:"Minimum completion rate",maxEvaluatorErrorRate:"Maximum evaluator error rate",minEligibleTrials:"Minimum gradeable iterations"}),Joe=Object.freeze({minCompletionRate:"Share of attempted iterations that must finish for the run to be decided.",maxEvaluatorErrorRate:"Share of iterations the evaluator may fail on before the run says nothing about the server.",minEligibleTrials:"Leave empty to require every configured iteration attempted and at least one gradeable — the stricter rule. A number relaxes that to a count."}),Qoe=Object.freeze({suiteFile:"from the suite file",hostedPerCase:"from this suite's settings",hostedSuiteWide:"from this suite's settings",runReporting:"recorded on the run"}),Yoe=Object.freeze({hosted:"measured over cases",localFallback:"measured over iterations"}),Xoe=Object.freeze({iterationsNotRepresentable:"This suite sets a minimum iteration count per case, not a suite default. Change the minimum, or set the count on each case.",minimumIterationsNotRepresentable:"This suite sets a default iteration count that each case can override, not a minimum. Change the default, or set the count on the cases that need more.",validityNotEnforced:"Runs on this suite are always passed or failed, so there is nothing for evidence requirements to withhold. They apply only where a run can be inconclusive.",readOnlyPolicy:"This describes how one finished run was decided. It is not a setting, and changing it would not re-decide the run."}),Zoe=Object.freeze({deploymentDoesNotReportPolicy:"This deployment does not report which criterion decides the suite's runs, so its threshold cannot be read or edited from here."});function eae(e){return e.scope==="perCase"?`each case must pass ${e.threshold} of its own iterations`:`${e.thresholdPercent}% of ${d8[e.population]} must pass`}var tae=Object.freeze({passCriterionScopes:["perCase","suiteWide"],suiteWidePopulations:OI,iterationRuleKinds:["defaultCount","caseCountWithFloor"],policyOrigins:NI,runReportingProducers:RK,editRefusals:OK}),h8=["pending","running","grading","completed","failed","cancelled","timed_out"],nae=V(h8),f8=["completed","failed","cancelled","timed_out"];function rae(e){return f8.includes(e)}var B8=["passed","failed","inconclusive","notEstablished"],p8=V(B8),m8=["policyV2","legacy","none"],g8=V(m8),Oh=["caseVariant","trial"],sae=V(Oh),C8=["runNotTerminal","runStatusNotAVerdict","runResultNotAVerdict","verdictSummaryUnavailable"],v8=V(C8),y8=w({reason:v8,detail:b().min(1).optional()}).strict(),Ss=M().int().min(0),b8=ft("measurementUnit",[w({measurementUnit:L("caseVariant"),total:Ss,passed:Ss,failed:Ss,inconclusive:Ss}).strict(),w({measurementUnit:L("trial"),total:Ss.optional(),passed:Ss.optional(),failed:Ss.optional()}).strict()]),S8=ft("status",[w({status:L("verified"),stages:K(rI),firstFailedStage:Vi.optional(),failureCategory:qC.optional(),analyzerVersion:M().int().min(0),analyzerVersionAhead:w({reported:M().int().min(0),known:M().int().min(0)}).strict().optional()}).strict(),w({status:L("unverified"),analyzerVersion:M().int().min(0).optional(),analyzerVersionAhead:w({reported:M().int().min(0),known:M().int().min(0)}).strict().optional()}).strict(),w({status:L("absent")}).strict()]),E8=w({runId:b().min(1),iterationId:b().min(1),stage:Vi.optional(),spanIds:K(b().min(1)).min(1).optional(),promptIndexes:K(M().int().min(0)).min(1).optional(),reasons:K(b().min(1)).min(1).optional(),tracePath:b().min(1)}).strict(),x8=w({iterationId:b().min(1),iterationNumber:M().int().min(0),caseId:Gi.optional(),testCaseId:b().min(1).optional(),title:b().min(1).optional(),status:b().min(1),result:V(["passed","failed"]).optional(),chain:S8,expected:w({toolNames:K(b().min(1)).min(1)}).strict().optional(),observed:w({toolNames:K(b().min(1)).min(1).optional(),failure:b().min(1).optional()}).strict().optional(),evidence:E8,nextAction:b().min(1)}).strict(),w8=w({items:K(x8),complete:oe(),nextCursor:b().min(1).optional(),scannedIterations:Ss}).strict().superRefine((e,t)=>{e.complete&&e.nextCursor!==void 0&&t.addIssue({code:"custom",path:["nextCursor"],message:"a complete diagnostics page has no next cursor: more pages means the set is not complete"}),e.items.length>e.scannedIterations&&t.addIssue({code:"custom",path:["scannedIterations"],message:`scannedIterations ${e.scannedIterations} is fewer than the ${e.items.length} diagnostics drawn from them`})}),D8=w({schemaVersion:L(1),runId:b().min(1),runStatus:b().min(1),verdict:p8,verdictSource:g8,counts:b8.optional(),decision:QC.optional(),undecided:y8.optional(),diagnostics:w8}).strict(),iae=D8.superRefine((e,t)=>{const n=(r,s)=>t.addIssue({code:"custom",path:r,message:s});if(e.verdictSource==="policyV2"){if(e.decision===void 0){n(["decision"],'verdictSource "policyV2" requires the decision it names as the authority');return}e.verdict!==e.decision.verdict&&n(["verdict"],`verdict "${e.verdict}" must be the decision's own verdict "${e.decision.verdict}" — this contract explains a decision, it never re-decides one`),e.undecided!==void 0&&n(["undecided"],"a decided run has no undecided reason");const r=e.counts;if(r===void 0||r.measurementUnit!=="caseVariant"){n(["counts"],`a policy-v2 summary counts case-execution variants, not ${r?.measurementUnit??"nothing"}`);return}const s=T8(e.decision);(r.total!==s.total||r.passed!==s.passed||r.failed!==s.failed||r.inconclusive!==s.inconclusive)&&n(["counts"],`counts must be the tally of decision.cases[].verdict (${s.passed} passed / ${s.failed} failed / ${s.inconclusive} inconclusive of ${s.total})`);return}if(e.decision!==void 0&&n(["decision"],`only a "policyV2" summary carries a decision; this one is "${e.verdictSource}"`),e.verdictSource==="legacy"){e.verdict!=="passed"&&e.verdict!=="failed"&&n(["verdict"],`a legacy run's verdict is its own "passed" or "failed"; "${e.verdict}" is not one a percent-threshold run can reach`),e.undecided!==void 0&&n(["undecided"],"a decided run has no undecided reason"),e.counts!==void 0&&e.counts.measurementUnit!=="trial"&&n(["counts"],`a legacy run's stored summary counts trials, not ${e.counts.measurementUnit}`);return}e.verdict!=="notEstablished"&&n(["verdict"],`with no verdict source the verdict is "notEstablished", not "${e.verdict}"`),e.undecided===void 0&&n(["undecided"],"an undecided run must say which check left it undecided"),e.counts!==void 0&&n(["counts"],"a run with no verdict reports no counts: the numbers it happens to have recorded describe a decision nobody took")});function T8(e){let t=0,n=0,r=0;for(const s of e.cases)s.verdict==="passed"?t+=1:s.verdict==="failed"?n+=1:r+=1;return{total:e.cases.length,passed:t,failed:n,inconclusive:r}}function oae(e){return A8(e)}function A8(e){const t=I8(e.stageAnalyzerVersion),n=t!==void 0&&t>12?{analyzerVersionAhead:{reported:t,known:12}}:{},r=sI.safeParse({stageResults:e.stageResults,...e.firstFailedStage!==void 0?{firstFailedStage:e.firstFailedStage}:{},...e.failureCategory!==void 0?{failureCategory:e.failureCategory}:{},stageAnalyzerVersion:e.stageAnalyzerVersion});return r.success?{status:"verified",stages:r.data.stageResults,...r.data.firstFailedStage?{firstFailedStage:r.data.firstFailedStage}:{},...r.data.failureCategory?{failureCategory:r.data.failureCategory}:{},analyzerVersion:r.data.stageAnalyzerVersion,...n}:e.stageResultsUnverified===!0||e.stageResults!==void 0?{status:"unverified",...t!==void 0?{analyzerVersion:t}:{},...n}:{status:"absent"}}function I8(e){return typeof e=="number"&&Number.isInteger(e)&&e>=0?e:void 0}function aae(e){return e.chain.status==="verified"?e.chain.failureCategory:void 0}function lae(e){return e.chain.status==="verified"?e.chain.firstFailedStage:void 0}var cae=Object.freeze({passed:"passed",failed:"failed",inconclusive:"inconclusive",notEstablished:"no verdict established"}),uae=Object.freeze({policyV2:"per-case grading",legacy:"suite accuracy threshold",none:"no verdict source"}),k8=Object.freeze({caseVariant:{one:"case variant",many:"case variants"},trial:{one:"iteration",many:"iterations"}}),dae=Object.freeze({runNotTerminal:"the run has not finished yet",runStatusNotAVerdict:"the run stopped before it finished, so its recorded counts describe a sample rather than the run",runResultNotAVerdict:"the run finished without recording a verdict",verdictSummaryUnavailable:"the run was decided by per-case grading and its decision could not be read"});function hae(e,t){const n=k8[e];return t===1?n.one:n.many}var At=M().int().min(0);var R8=["noToolCalled","retried","looping"],fae=V(R8),O8=["loaded","notLoaded"],M8=V(O8),N8=["inCatalog","outsideCatalog","catalogNotLoaded"],P8=V(N8),L8=["measured","excludedNegativeTest","notMeasured"],Bae=V(L8),_8=w({pathKey:b().min(1),trials:At,passed:At,failed:At}).strict(),F8=w({distinctPaths:M().int().min(1).optional(),trials:At,passed:At,failed:At}).strict(),H8=w({tool:b().min(1),trials:At}).strict(),j8=w({noToolCalled:Xt,retried:Xt,looping:Xt}).strict(),G8=w({identifierSurfacedUnused:Xt,searchRepeatedAfterIdentifier:Xt,identicalRetry:Xt,changedRetry:Xt,paginationContinuation:Xt}).strict(),V8=w({population:L(Oh[1]),totalTrials:At,includedTrials:At,exclusions:Id,routes:K(_8).max(24),otherRoutes:F8.optional(),tags:j8,loopedOn:K(H8),endedWithQuestion:Xt,frictionSignals:G8.optional(),truncatedTrials:At.optional()}).strict(),U8=w({tool:b().min(1),expectedIn:At,notCalledIn:At,notCalledInFailed:At}).strict(),z8=w({tool:b().min(1),calledIn:At,calledInFailed:At,catalog:P8}).strict(),$8=w({expected:b().min(1),observed:b().min(1),trials:At}).strict(),W8=ft("state",[w({state:L("measured"),gradeableTrials:M().int().min(1),expected:K(U8).max(64),unexpected:K(z8).max(64),substitutions:K($8).max(64),truncated:L(!0).optional()}).strict(),w({state:L("excludedNegativeTest")}).strict(),w({state:L("notMeasured")}).strict()]),q8=w({distinctCases:M().int().min(1),retained:M().int().min(0)}).strict(),K8=w({caseVariantKey:b().min(1),caseKey:b().min(1).optional(),executionVariant:oa.optional(),routes:V8,mismatch:W8}).strict(),J8=w({schemaVersion:L(1),routeFactsVersion:L(1),measurementUnit:L(Oh[1]),runId:b().min(1),suiteId:b().min(1),runGroupId:b().min(1).optional(),configRevision:b().min(1).optional(),runCompletedAt:M().int().min(0).optional(),catalogState:M8,catalogHash:b().min(1).optional(),sourceIterationCount:At,sourceMaxUpdatedAt:M().int().min(0).optional(),materializationState:YC,createdAt:M().int().min(0),updatedAt:M().int().min(0),totalTrials:At,includedTrials:At,exclusions:Id,cases:K(K8).max(AI),caseTruncation:q8.optional()}).strict();function Ba(e,t,n){const r=xI.safeParse(n);if(!r.success)for(const s of r.error.issues)e.addIssue({code:"custom",path:[...t,...s.path],message:s.message})}var pae=J8.superRefine((e,t)=>{e.includedTrials+Xf(e.exclusions)!==e.totalTrials&&t.addIssue({code:"custom",path:["includedTrials"],message:`includedTrials ${e.includedTrials} plus exclusions ${Xf(e.exclusions)} must equal totalTrials ${e.totalTrials}`}),e.sourceIterationCount!==e.totalTrials&&t.addIssue({code:"custom",path:["sourceIterationCount"],message:`sourceIterationCount ${e.sourceIterationCount} must equal totalTrials ${e.totalTrials}`});for(const[n,r]of e.cases.entries()){const s=Xf(r.routes.exclusions);r.routes.includedTrials+s!==r.routes.totalTrials&&t.addIssue({code:"custom",path:["cases",n,"routes","includedTrials"],message:`includedTrials ${r.routes.includedTrials} plus exclusions ${s} must equal totalTrials ${r.routes.totalTrials}`}),r.mismatch.state==="measured"&&r.mismatch.gradeableTrials>r.routes.includedTrials&&t.addIssue({code:"custom",path:["cases",n,"mismatch","gradeableTrials"],message:"gradeableTrials cannot exceed the case's includedTrials"}),Ba(t,["cases",n,"routes","tags","noToolCalled"],r.routes.tags.noToolCalled),Ba(t,["cases",n,"routes","tags","retried"],r.routes.tags.retried),Ba(t,["cases",n,"routes","tags","looping"],r.routes.tags.looping),Ba(t,["cases",n,"routes","endedWithQuestion"],r.routes.endedWithQuestion);const i=r.routes.frictionSignals;if(i)for(const o of Rh)Ba(t,["cases",n,"routes","frictionSignals",o],i[o])}});function Xf(e){let t=0;for(const n of EI)t+=e[n]??0;return t}var un=M().int().min(0),Q8=["original","rewrite"],mae=V(Q8),Y8=["notTerminal","errored","timedOut","negativeTest","overrideNotApplied","unsupportedEngine"],gae=V(Y8),X8=["controlled","reproducible"],Z8=V(X8),e6=["deterministic","judge_gated"],t6=V(e6),n6=["improved","regressed","no_difference","insufficient_data"],r6=V(n6),s6=["passed","failed","non_gateable"],i6=V(s6),o6=["per_trial_sandbox","none"],a6=V(o6),l6=["concurrent_two_run"],c6=V(l6),u6=w({notTerminal:un.optional(),errored:un.optional(),timedOut:un.optional(),negativeTest:un.optional(),overrideNotApplied:un.optional(),unsupportedEngine:un.optional()}).strict(),eS=w({eligible:un,passed:un,failed:un,exclusions:u6}).strict(),d6=w({deltaPoints:M(),lowerPoints:M(),upperPoints:M()}).strict(),KI=w({original:eS,rewrite:eS,interval:d6.nullable(),verdict:r6,minSampleSize:M().int().min(1),minEffectSize:M().min(0).max(1)}).strict(),h6=KI.extend({aggregationKey:b().min(1)}).strict(),f6=KI,B6=w({expectedToolNotCalled:w({original:un,rewrite:un}).strict(),substitutions:K(w({expected:b().min(1),observed:b().min(1),original:un,rewrite:un}).strict()).optional()}).strict(),p6=w({checked:oe(),otherCases:un,regressed:K(b().min(1)),status:i6,reason:b().min(1).optional()}).strict(),m6=["model","engine","hostConfigId","toolSnapshotHash","judgeConfigHash"],g6=V(m6),C6=w({model:K(b().min(1)),engine:b().min(1).optional(),hostConfigId:b().min(1).optional(),toolSnapshotHash:b().min(1).optional(),judgeConfigHash:b().min(1).optional(),environmentReset:a6,equal:oe(),differences:K(g6).min(1).optional()}).strict().superRefine((e,t)=>{e.equal&&e.differences!==void 0&&t.addIssue({code:"custom",path:["differences"],message:"equal arms carry no differences"}),!e.equal&&e.differences===void 0&&t.addIssue({code:"custom",path:["differences"],message:"unequal arms must name what differed"})}),v6=w({method:c6,overlapVerified:oe()}).strict(),y6=w({schemaVersion:L(1),toolName:b().min(1),population:L(Oh[1]),primary:w({outcomeSource:t6,pooled:f6,perCase:K(h6)}).strict(),secondary:B6,regression:p6,frozen:C6,assignment:v6,evidenceLabel:Z8,reportOnly:L(!0)}).strict();function Kc(e,t,n){n.passed+n.failed!==n.eligible&&e.addIssue({code:"custom",path:[...t,"eligible"],message:`eligible ${n.eligible} is not passed ${n.passed} + failed ${n.failed}`})}var Cae=y6.superRefine((e,t)=>{Kc(t,["primary","pooled","original"],e.primary.pooled.original),Kc(t,["primary","pooled","rewrite"],e.primary.pooled.rewrite);for(const[r,s]of e.primary.perCase.entries())Kc(t,["primary","perCase",r,"original"],s.original),Kc(t,["primary","perCase",r,"rewrite"],s.rewrite);const n=[[["primary","pooled"],e.primary.pooled],...e.primary.perCase.map((r,s)=>[["primary","perCase",s],r])];for(const[r,s]of n){const i=s.original.eligible<s.minSampleSize||s.rewrite.eligible<s.minSampleSize;i&&s.interval!==null&&t.addIssue({code:"custom",path:[...r,"interval"],message:"interval must be null when either arm is below minSampleSize"}),i&&s.verdict!=="insufficient_data"&&t.addIssue({code:"custom",path:[...r,"verdict"],message:"verdict must be insufficient_data when either arm is below minSampleSize"})}e.evidenceLabel==="controlled"&&!(e.frozen.environmentReset==="per_trial_sandbox"&&e.assignment.overlapVerified&&e.frozen.equal)&&t.addIssue({code:"custom",path:["evidenceLabel"],message:"controlled requires per-trial sandbox reset, verified overlap, and equal frozen variables"})});function tS(e){const t=e.trim();return t.length===0?[]:t.split(/\s+/)}var b6=25e4;function vae(e,t){const n=tS(e),r=tS(t),s=n.length,i=r.length;if(s*i>b6)return{added:r,removed:n,tokens:[...n.map(u=>({type:"del",text:u})),...r.map(u=>({type:"add",text:u}))]};const o=Array.from({length:s+1},()=>Array.from({length:i+1},()=>0));for(let u=1;u<=s;u+=1)for(let d=1;d<=i;d+=1)o[u][d]=n[u-1]===r[d-1]?(o[u-1][d-1]??0)+1:Math.max(o[u-1][d]??0,o[u][d-1]??0);const a=[];let l=s,c=i;for(;l>0||c>0;)l>0&&c>0&&n[l-1]===r[c-1]?(a.push({type:"eq",text:n[l-1]}),l-=1,c-=1):c>0&&(l===0||(o[l][c-1]??0)>=(o[l-1][c]??0))?(a.push({type:"add",text:r[c-1]}),c-=1):(a.push({type:"del",text:n[l-1]}),l-=1);return a.reverse(),{added:a.filter(u=>u.type==="add").map(u=>u.text),removed:a.filter(u=>u.type==="del").map(u=>u.text),tokens:a}}var S6=L(1);var E6=L(1),JI=ft("kind",[w({kind:L("run"),runId:b().min(1)}).strict(),w({kind:L("commit_sha"),commitSha:b().min(1)}).strict(),w({kind:L("previous_completed")}).strict()]),x6=w({baseline:JI.optional(),maximumPassRateDrop:M().min(0).max(1).optional(),noDeterministicRegressions:oe().optional(),maximumP95LatencyIncreaseMs:M().min(0).optional(),noGatingScoreErrors:oe().optional()}).strict(),w6=["noGatingScoreErrors","maximumPassRateDrop","noDeterministicRegressions","maximumP95LatencyIncreaseMs"],D6=["maximumPassRateDrop","noDeterministicRegressions","maximumP95LatencyIncreaseMs"];Object.freeze(D6);var T6=["POLICY_MALFORMED","PREVIOUS_COMPLETED_UNSUPPORTED","COMPARATIVE_WITHOUT_BASELINE","BASELINE_UNRESOLVED","EVIDENCE_MALFORMED","EVIDENCE_NOT_FINAL","EVIDENCE_LIMIT_REACHED","INCOMPLETE_CAPTURE","INTEGRITY_UNVERIFIED","NO_EVALUATION_CONFIG","EMPTY_COUNTABLE_EVIDENCE","GENERATED_SCORER_ID","SCORER_MISSING","SCORER_ADDED","SCORER_REMOVED","SCORER_CHANGED","POPULATION_INCOMPATIBLE","CONFIGURED_WEIGHTS_MISMATCH","OBSERVED_WEIGHTS_MISMATCH","QUARANTINED","LATENCY_UNMEASURED","SCORE_DELTAS_UNAVAILABLE"],QI=V(T6),A6=w({scorerId:b().min(1),definitionHash:b().min(1),status:YA,passed:oe().optional()}).strict(),I6=w({scorerId:b().min(1),definitionHash:b().min(1),idSource:zC,role:UC,deterministic:oe(),countable:M().int().min(0),passed:M().int().min(0),passRate:M().min(0).max(1).nullable()}).strict(),Jc=w({caseId:b().min(1),executionVariant:oa.optional(),trials:M().int().min(0),quarantined:oe().optional()}).strict(),k6=w({caseKey:b().min(1),scorerId:b().min(1)}).strict(),R6=w({hash:b().min(1).optional(),definitions:K(ZA)}).strict(),YI=w({runId:b().min(1),final:oe(),scoreIntegrity:V(["valid","invalid"]).optional(),evaluationConfig:R6.optional(),scores:K(A6).optional(),scorerSummaries:K(I6).optional(),e2eP95Ms:M().min(0).optional(),captureComplete:oe().optional(),evidenceLimitReached:oe().optional()}).strict(),O6=w({selector:JI,resolved:oe(),run:YI.optional(),caseSetChanged:oe().optional(),scenarioConfigChanged:oe().optional(),evaluationConfigChanged:oe().optional(),iterationWeightingEqual:oe().optional(),configuredWeightsMatch:oe().optional(),observedWeightsMatch:oe().optional(),scoreDeltasAvailable:oe().optional(),deterministicScoreRegressions:K(k6).optional(),configuredWeights:w({subject:K(Jc),baseline:K(Jc)}).strict().optional(),observedWeights:w({subject:K(Jc),baseline:K(Jc)}).strict().optional(),quarantined:oe().optional()}).strict(),yae=w({subject:YI,baseline:O6.optional()}).strict(),M6=["passed","failed","non_gateable"],N6=["passed","failed","non_gateable","not_configured"],P6=w({condition:V(w6),status:V(M6),message:b().min(1),reason:QI.optional(),observed:M().optional(),threshold:M().optional(),scorerId:b().min(1).optional()}).strict(),bae=w({schemaVersion:S6,evaluatorVersion:E6,policy:x6,policyHash:b().min(1),outcome:V(N6),conditions:K(P6),policyError:w({reason:QI,message:b().min(1)}).strict().optional()}).strict();function Sae(e){const t={};return e.baseline!==void 0&&(t.baseline=e.baseline),e.maximumPassRateDrop!==void 0&&(t.maximumPassRateDrop=e.maximumPassRateDrop),e.noDeterministicRegressions===!0&&(t.noDeterministicRegressions=!0),e.maximumP95LatencyIncreaseMs!==void 0&&(t.maximumP95LatencyIncreaseMs=e.maximumP95LatencyIncreaseMs),e.noGatingScoreErrors===!0&&(t.noGatingScoreErrors=!0),t}var L6=L(1);var _6=L(1);var cn=M().int().min(0),F6=M().int().min(1).max(100),H6=w({caseId:b().min(1),executionVariant:oa.optional(),configuredTrials:F6,effectivePassThreshold:Fn}).strict(),j6=w({caseId:b().min(1),executionVariant:oa.optional(),countable:cn,scored:cn,errors:cn,skipped:cn,notApplicable:cn,missing:cn.optional(),quarantined:cn.optional()}).strict(),G6=w({kind:b().min(1),version:b().min(1),configurationDigest:b().min(1)}).strict(),V6=w({executionVariant:oa.optional(),model:b().min(1),provider:b().min(1).optional(),configurationDigest:b().min(1).optional()}).strict(),U6=w({environmentId:b().min(1).optional(),configurationDigest:b().min(1)}).strict(),z6=w({environmentId:b().min(1).optional(),namedHostId:b().min(1).optional(),hostHarness:G6.optional(),effectiveModels:K(V6).optional(),serverEnvironment:U6.optional(),executionOverridesDigest:b().min(1).optional()}).strict(),$6=w({retained:M().int().min(0).max(200),omitted:M().int().min(1),total:M().int().min(1)}).strict(),W6=w({scorerId:b().min(1),definitionHash:b().min(1),idSource:zC,role:UC,deterministic:oe(),passThreshold:Fn,scope:hc.optional(),criterion:b().min(1).optional(),countable:cn,passed:cn,failed:cn,errors:cn,skipped:cn,notApplicable:cn,passRate:Fn.nullable(),meanValue:Fn.nullable(),observedPopulation:K(j6),observedPopulationFingerprint:b().min(1)}).strict(),q6=w({schemaVersion:L6,sourceVersion:_6,suiteId:b().min(1),runId:b().min(1),runGroupId:b().min(1).optional(),configRevision:b().min(1).optional(),caseSetFingerprint:b().min(1).optional(),organizationId:b().min(1).optional(),workspaceId:b().min(1).optional(),projectId:b().min(1).optional(),runCompletedAt:M().int().min(0).optional(),sourceIterationCount:cn,sourceMaxUpdatedAt:M().int().min(0).optional(),generation:M().int().min(0).optional(),materializationState:YC,scoreIntegrity:V(["valid","invalid"]).optional(),configuredTrials:K(H6),configuredTrialFingerprint:b().min(1),execution:z6,executionFingerprint:b().min(1),entries:K(W6).max(200),truncation:$6.optional(),createdAt:M().int().min(0),updatedAt:M().int().min(0)}).strict(),Eae=q6.superRefine((e,t)=>{const n=Y6(e.configuredTrials);e.configuredTrialFingerprint!==n&&t.addIssue({code:"custom",path:["configuredTrialFingerprint"],message:"configuredTrialFingerprint is not the digest of the normalized configuredTrials snapshot"});const r=nJ(e.execution);e.executionFingerprint!==r&&t.addIssue({code:"custom",path:["executionFingerprint"],message:"executionFingerprint is not the digest of the normalized execution snapshot"});const s=new Set;for(const[i,o]of e.entries.entries()){const a=J6(o);s.has(a)&&t.addIssue({code:"custom",path:["entries",i],message:`duplicate scorer entry ${a}: entries are keyed by (scorerId, definitionHash)`}),s.add(a),o.passed+o.failed+o.errors+o.skipped!==o.countable&&t.addIssue({code:"custom",path:["entries",i,"countable"],message:`countable ${o.countable} is not passed ${o.passed} + failed ${o.failed} + errors ${o.errors} + skipped ${o.skipped}`});const l=K6(o);o.passRate!==l&&t.addIssue({code:"custom",path:["entries",i,"passRate"],message:o.countable===0?"passRate must be null when countable is 0 (unmeasured is not 0)":`passRate ${o.passRate} is not ${o.passed}/${o.countable} (${l})`}),o.passed+o.failed===0&&o.meanValue!==null&&t.addIssue({code:"custom",path:["entries",i,"meanValue"],message:"meanValue must be null when no observation was scored (unmeasured is not 0)"});const c=Z6(o.observedPopulation);o.observedPopulationFingerprint!==c&&t.addIssue({code:"custom",path:["entries",i,"observedPopulationFingerprint"],message:"observedPopulationFingerprint is not the digest of the normalized observedPopulation snapshot"})}e.truncation&&(e.truncation.retained!==e.entries.length&&t.addIssue({code:"custom",path:["truncation","retained"],message:`truncation.retained ${e.truncation.retained} does not match ${e.entries.length} stored entries`}),e.truncation.retained+e.truncation.omitted!==e.truncation.total&&t.addIssue({code:"custom",path:["truncation","total"],message:`truncation.total ${e.truncation.total} is not retained ${e.truncation.retained} + omitted ${e.truncation.omitted}`}))});function K6(e){return e.countable===0?null:e.passed/e.countable}function J6(e){return`${e.scorerId}\0${e.definitionHash}`}function go(e,t){return e<t?-1:e>t?1:0}function kd(e){return e?`${e.provider??""}\0${e.model}`:""}function ev(e){if(!e)return;const t={model:e.model};return e.provider!==void 0&&(t.provider=e.provider),t}function XI(e,t){const n=go(e.caseId,t.caseId);return n!==0?n:go(kd(e.executionVariant),kd(t.executionVariant))}function Q6(e){return e.map(t=>{const n={caseId:t.caseId,configuredTrials:t.configuredTrials,effectivePassThreshold:t.effectivePassThreshold},r=ev(t.executionVariant);return r&&(n.executionVariant=r),n}).sort((t,n)=>{const r=XI(t,n);return r!==0?r:t.configuredTrials!==n.configuredTrials?t.configuredTrials-n.configuredTrials:t.effectivePassThreshold-n.effectivePassThreshold})}function Y6(e){return Yg(Q6(e))}function X6(e){return e.map(t=>{const n={caseId:t.caseId,countable:t.countable,scored:t.scored,errors:t.errors,skipped:t.skipped,notApplicable:t.notApplicable},r=ev(t.executionVariant);return r&&(n.executionVariant=r),t.missing!==void 0&&(n.missing=t.missing),t.quarantined!==void 0&&(n.quarantined=t.quarantined),n}).sort((t,n)=>{const r=XI(t,n);if(r!==0)return r;if(t.countable!==n.countable)return t.countable-n.countable;if(t.scored!==n.scored)return t.scored-n.scored;if(t.errors!==n.errors)return t.errors-n.errors;if(t.skipped!==n.skipped)return t.skipped-n.skipped;if(t.notApplicable!==n.notApplicable)return t.notApplicable-n.notApplicable;const s=t.missing??-1,i=n.missing??-1;return s!==i?s-i:(t.quarantined??-1)-(n.quarantined??-1)})}function Z6(e){return Yg(X6(e))}function eJ(e){const t={model:e.model},n=ev(e.executionVariant);return n&&(t.executionVariant=n),e.provider!==void 0&&(t.provider=e.provider),e.configurationDigest!==void 0&&(t.configurationDigest=e.configurationDigest),t}function tJ(e){const t={};if(e.environmentId!==void 0&&(t.environmentId=e.environmentId),e.namedHostId!==void 0&&(t.namedHostId=e.namedHostId),e.hostHarness&&(t.hostHarness={kind:e.hostHarness.kind,version:e.hostHarness.version,configurationDigest:e.hostHarness.configurationDigest}),e.effectiveModels&&(t.effectiveModels=e.effectiveModels.map(eJ).sort((n,r)=>{const s=go(kd(n.executionVariant),kd(r.executionVariant));if(s!==0)return s;const i=go(n.provider??"",r.provider??"");if(i!==0)return i;const o=go(n.model,r.model);return o!==0?o:go(n.configurationDigest??"",r.configurationDigest??"")})),e.serverEnvironment){const n={configurationDigest:e.serverEnvironment.configurationDigest};e.serverEnvironment.environmentId!==void 0&&(n.environmentId=e.serverEnvironment.environmentId),t.serverEnvironment=n}return e.executionOverridesDigest!==void 0&&(t.executionOverridesDigest=e.executionOverridesDigest),t}function nJ(e){return Yg(tJ(e))}var rJ=w({format:V(["markdown","json","csv"]),method:L("ai"),fileName:b().min(1).max(255),fileHash:b().regex(/^[a-f0-9]{64}$/),excerpt:b().min(1).max(102400),startLine:M().int().positive(),endLine:M().int().positive(),extractorVersion:b().min(1).max(100)}).strict().refine(e=>e.endLine>=e.startLine,"Invalid source line range"),En=6e4,Ns=36e5,ZI={turnTimeoutMs:M().int().min(1e4).max(30*En).optional(),toolCallTimeoutMs:M().int().min(1e3).max(10*En).optional(),runTimeoutMs:M().int().min(En).max(12*Ns).optional(),turnRetries:M().int().min(0).max(5).optional()},xae=w({...ZI,iterationTimeoutMs:M().int().min(3e4).max(2*Ns).optional()}).strict(),wae=w({...ZI,sessionTimeoutMs:M().int().min(En).max(2*Ns).optional()}).strict(),Dae=w({turnTimeoutMs:M().int().positive(),toolCallTimeoutMs:M().int().positive().optional(),unitTimeoutMs:M().int().positive(),runTimeoutMs:M().int().positive(),turnRetries:M().int().min(0),sources:w({turnTimeoutMs:V(["authored","default"]),toolCallTimeoutMs:V(["authored","default"]).optional(),unitTimeoutMs:V(["authored","default"]),runTimeoutMs:V(["authored","default"]),turnRetries:V(["authored","default"])}).strict()}).strict(),Tae=Object.freeze({evals:Object.freeze({turnTimeoutMs:6*En,toolCallTimeoutMs:3e4,unitTimeoutMs:10*En,runTimeoutMs:30*En,turnRetries:2}),swarms:Object.freeze({turnTimeoutMs:6*En,toolCallTimeoutMs:12e4,unitTimeoutMs:20*En,runTimeoutMs:2*Ns,turnRetries:2})}),Aae=Object.freeze({evals:Object.freeze({turnTimeoutMs:30*En,toolCallTimeoutMs:10*En,unitTimeoutMs:2*Ns,runTimeoutMs:12*Ns,turnRetries:5}),swarms:Object.freeze({turnTimeoutMs:30*En,toolCallTimeoutMs:10*En,unitTimeoutMs:2*Ns,runTimeoutMs:12*Ns,turnRetries:5})}),sJ=w({toolCallOrder:V(["ignore","strict","superset"]).optional(),argumentMatching:V(["exact","partial","ignore"]).optional(),maxExtraToolCalls:M().int().nonnegative().nullable().optional(),allowExtraToolCalls:oe().optional()}).strict(),iJ=w({matchOptions:sJ.nullable().optional(),assertions:w({mode:V(["replace","extend","inherit"]),list:K(dc).max(25)}).strict()}).strict(),oJ=w({cursor:b().min(1).max(8192),sourceHash:b().min(1).max(256),reservationId:b().min(1).max(256),draftHash:b().min(1).max(256)}).strict(),Iae=iJ.extend({continuation:oJ.optional()});var Xe=M().int().nonnegative(),aJ=ft("status",[w({status:L("pending"),pendingSessions:Xe,updatedAt:Xe}).strict(),w({status:L("decided"),decision:QC,updatedAt:Xe}).strict(),w({status:L("notEstablished"),reason:L("gradingNotConfigured"),updatedAt:Xe}).strict(),w({status:L("integrityFailed"),reason:b().min(1),updatedAt:Xe}).strict()]),ek=w({evaluatorId:b().min(1),predicateType:V(Object.keys(Rl)),role:V(["advisory","required"]),status:V(["passed","failed","pending","unavailable"])}).strict(),lJ=w({id:b().min(1),startEvidence:V(["started","notStarted","unknown"]),verdict:o8,observations:K(ek)}).strict().superRefine((e,t)=>{new Set(e.observations.map(n=>n.evaluatorId)).size!==e.observations.length&&t.addIssue({code:"custom",path:["observations"],message:"Duplicate evaluator in one session"}),e.startEvidence==="notStarted"&&["running","ran"].includes(e.verdict.lifecycle)&&t.addIssue({code:"custom",path:["startEvidence"],message:"Execution contradicts explicit non-start"})}),kae=w({runId:b().min(1),executionComplete:oe(),configuredSessions:Xe,verdictSummary:aJ.nullable(),evaluatorDefinitions:K(ek.omit({status:!0})),sessions:K(lJ)}).strict().superRefine((e,t)=>{e.sessions.length>e.configuredSessions&&t.addIssue({code:"custom",path:["sessions"],message:"Reported sessions exceed configured population"}),new Set(e.sessions.map(r=>r.id)).size!==e.sessions.length&&t.addIssue({code:"custom",path:["sessions"],message:"Duplicate session/attempt identity"});const n=new Map(e.evaluatorDefinitions.map(r=>[r.evaluatorId,r]));n.size!==e.evaluatorDefinitions.length&&t.addIssue({code:"custom",path:["evaluatorDefinitions"],message:"Duplicate evaluator definition"});for(const r of e.sessions)for(const s of r.observations){const i=n.get(s.evaluatorId);(!i||i.role!==s.role||i.predicateType!==s.predicateType)&&t.addIssue({code:"custom",path:["sessions"],message:"Observation contradicts the frozen evaluator definition"})}}),cJ=w({evaluatorId:b().min(1),predicateType:V(Object.keys(Rl)),role:V(["advisory","required"]),stage:V(ir).describe("The stage this observation was read from, and the only stage it is evidence ABOUT. `connection` — the server was reachable and the session initialized. `discovery` — its tools and resources were listed and readable. `selection` — the model chose the right tool for the request. `call` — the call was made with usable arguments. `response` — the server returned data the model could use. `userValue` — the user's actual request was satisfied."),unit:L("sessions"),total:Xe,passed:Xe,failed:Xe,pending:Xe,unavailable:Xe}).strict().superRefine((e,t)=>{e.total!==e.passed+e.failed+e.pending+e.unavailable&&t.addIssue({code:"custom",message:"Observation coverage must partition its population"}),e.stage!==Rl[e.predicateType]&&t.addIssue({code:"custom",message:"Observation stage contradicts the shared evaluator map"})}),Rae=w({contractVersion:L(1),runId:b().min(1),verdict:ZC,verdictSource:V(["policyV2","none"]),decision:QC.optional(),undecidedReason:V(["executionPending","gradingPending","gradingNotConfigured","verdictSummaryUnavailable","integrityFailed"]).optional(),execution:w({unit:L("sessions"),configured:Xe,reported:Xe,started:Xe,notStarted:Xe,unknown:Xe,completed:Xe,interrupted:Xe,neverLaunched:oe()}).strict(),goalGrading:w({unit:L("sessions"),reported:Xe,passed:Xe,failed:Xe,pending:Xe,unavailable:Xe,notRequested:Xe,waitingForDecisiveGrading:Xe}).strict(),observations:K(cJ)}).strict().superRefine((e,t)=>{const n=i=>t.addIssue({code:"custom",message:i});e.verdictSource==="policyV2"?(!e.decision||e.verdict!==e.decision.verdict||e.undecidedReason!==void 0)&&n("Report must copy its authoritative decision"):(e.verdict!=="notEstablished"||e.decision!==void 0||!e.undecidedReason)&&n("Missing authority must have an undecided reason");const r=e.execution;(r.started+r.notStarted+r.unknown!==r.configured||r.reported>r.configured)&&n("Execution evidence does not cover its configured population"),(r.started+r.notStarted>r.reported||r.completed+r.interrupted>r.reported)&&n("Execution counts exceed reported evidence"),r.neverLaunched!==(r.configured>0&&r.reported===r.configured&&r.notStarted===r.configured)&&n("Not run requires explicit evidence for the entire population");const s=e.goalGrading;(s.reported!==r.reported||s.passed+s.failed+s.pending+s.unavailable+s.notRequested!==s.reported||s.waitingForDecisiveGrading>s.reported)&&n("Goal coverage must partition reported sessions"),(new Set(e.observations.map(i=>i.evaluatorId)).size!==e.observations.length||e.observations.some(i=>i.total>r.reported))&&n("Invalid observation population")});function Oae(e){const t=new TextEncoder().encode(e),n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";let r="target_";for(let s=0;s<t.length;s+=3){const i=t[s]<<16|(t[s+1]??0)<<8|(t[s+2]??0);r+=n[i>>>18&63]+n[i>>>12&63],s+1<t.length&&(r+=n[i>>>6&63]),s+2<t.length&&(r+=n[i&63])}return r}var uJ=w({code:V(["missing_expectation","missing_prerequisite","unclear_expectation","unsupported_workflow","unknown_tool","invalid_arguments","missing_evidence"]),message:b().min(1).max(2e3),stepId:b().optional(),blocking:oe().default(!0),origin:V(["model","validation"]).optional(),resolution:b().trim().min(10).max(2e3).optional()}).strict(),dJ=w({id:b().min(1).max(200),path:b().min(1).max(500),explanation:b().min(1).max(2e3)}).strict(),hJ=w({title:b().trim().min(1).max(500),steps:Lq,expectedOutput:b().max(1e4).optional(),isNegativeTest:oe().default(!1),runs:M().int().min(1).max(10).default(5),models:K(w({model:b().min(1),provider:b().min(1)}).strict()).max(20).default([]),scenario:b().max(1e4).optional(),checks:w({mode:V(["inherit","replace","extend"]),list:K(nr(b(),Ln())).max(200)}).strict().optional(),matchOptions:nr(b(),Ln()).optional()}).strict(),Mae=w({version:L(1),draftId:b().min(1),revision:M().int().nonnegative(),case:hJ,source:rJ.optional(),issues:K(uJ).max(100),evidenceNotes:K(b().trim().min(10).max(2e3)).max(100).optional(),additions:K(dJ).max(200),review:V(["required","accepted"])}).strict();function Nae(e){if(!e.title.trim())return"Add a case title.";if(!e.steps.length)return"Add at least one step.";if(new Set(e.steps.map(t=>t.id)).size!==e.steps.length)return"Step ids must be unique.";if(e.steps.some(t=>t.kind==="prompt"&&!t.prompt.trim()))return"Complete each prompt step.";if(e.isNegativeTest)return e.steps.some(t=>t.kind==="assert"&&"type"in t.assertion&&t.assertion.type==="toolCalledWith")?"Negative cases cannot require tool calls.":void 0;if(!e.steps.some(t=>t.kind==="assert")&&!e.expectedOutput?.trim()&&!e.checks?.list.length)return"Add an assertion, expected outcome, or case check."}var Pae=w({apps:K(w({toolCallId:b(),toolName:b(),serverId:b().optional()})),actions:K(w({toolCallId:b(),stepIndex:M().int().nonnegative(),promptIndex:M().int().nonnegative(),elapsedMs:M().nonnegative(),ts:M(),action:b(),actor:V(["persona","model","scripted"]).optional(),ok:oe().optional(),target:w({role:b(),name:b(),scope:L("host").optional()}).optional(),requiresModelFollowUp:oe()})),summary:w({attempted:M().int().nonnegative(),succeeded:M().int().nonnegative(),elapsedMs:M().nonnegative()}),truncated:oe()}),fJ="quickstart";function Lae(e){return e.tags?.includes(fJ)===!0}var _ae={MIN_PASS_RATE:100,RUNS_PER_TEST:5,CHART_HEIGHT:"h-32",MAX_QUERY_DISPLAY_LENGTH:100,BATCH_DELETE_CONFIRMATION_DELAY:0},Nn={PASSED:"passed",FAILED:"failed",CANCELLED:"cancelled",TIMED_OUT:"timed_out",PENDING:"pending"},Fae={passed:"text-success",failed:"text-destructive"},Hae="text-destructive",jae="border-transparent bg-destructive/50 text-foreground shadow-xs hover:bg-destructive/50 hover:brightness-95 focus-visible:ring-destructive/35",Gae="bg-destructive/50",Vae="bg-destructive/50 text-foreground",Uae="bg-success/15 text-success",zae="bg-destructive/15 text-destructive",$ae="bg-warning/15 text-warning",Wae={[Nn.PASSED]:"bg-success/50",[Nn.FAILED]:"bg-destructive/50",[Nn.CANCELLED]:"bg-muted",[Nn.PENDING]:"bg-warning/50"},qae={[Nn.PASSED]:"bg-success/50",[Nn.FAILED]:"bg-destructive/50",[Nn.CANCELLED]:"bg-muted-foreground/50",[Nn.PENDING]:"bg-warning/50",RUNNING:"bg-warning/50",DEFAULT:"bg-muted-foreground/50"},Kae={EVALS_RUN:"/api/mcp/evals/run",EVALS_GENERATE_TESTS:"/api/mcp/evals/generate-tests",EVALS_GENERATE_NEGATIVE_TESTS:"/api/mcp/evals/generate-negative-tests",EVALS_RUN_TEST_CASE:"/api/mcp/evals/run-test-case",LIST_TOOLS:"/api/mcp/list-tools"};function BJ(e){try{Ho.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 nS(e){BJ({code:`workspace/${e.label}`,message:e.message,level:e.level,serverId:e.serverId,...e.serverName?{serverName:e.serverName}:{},...e.detail?{detail:e.detail}:{}})}var rS={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 Jae(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(i=>typeof i=="string"):[];if(typeof t=="string"&&t.trim())return r.length&&!r.every(i=>t.includes(i))?`${t} (${r.join(", ")})`:t;const s=e&&typeof e=="object"&&"code"in e?String(e.code):void 0;return s&&rS[s]?rS[s]:e instanceof Error&&e.message&&!/^[A-Z_]+$/.test(e.message)?e.message:s?`The App couldn't open (${s}).`:"The App couldn't open."}var Mh=(0,p.createContext)(null),Qae=()=>(0,p.useContext)(Mh),tv=(0,p.createContext)(null),pJ=512;function Yae({value:e,children:t}){const n=(0,p.useMemo)(()=>yx(()=>({links:{}})),[e?.api]);return(0,m.jsx)(Mh.Provider,{value:e,children:(0,m.jsx)(tv.Provider,{value:n,children:t})})}function mJ(e,t){const n=(0,p.useContext)(tv),r=JSON.stringify([e,t.map(s=>[s.uri,s.name])]);(0,p.useEffect)(()=>{!n||!e||!t.length||n.setState(s=>{const i={...s.links};for(const a of t)i[a.uri]={serverId:e,name:a.name};const o=Object.keys(i);for(const a of o.slice(0,Math.max(0,o.length-pJ)))delete i[a];return{links:i}})},[n,r])}var gJ={},CJ=yx(()=>({links:gJ}));function vJ(){const e=(0,p.useContext)(tv);return SN(e??CJ,t=>t.links)}function Vu(e,t){return!!e&&e.enabled!==!1&&!!t&&e.serverIds.includes(t.serverId)&&!!t.resourceUri}function yJ(e,t){const[n,r]=(0,p.useState)({state:"closed"}),[s,i]=(0,p.useState)(!1),o=(0,p.useRef)(null),a=JSON.stringify([t?.serverId,t?.resourceUri]),l=(0,p.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&&Vu(l.current.actions,l.current.reference);(0,p.useEffect)(()=>(r({state:"closed"}),i(!1),()=>o.current?.abort()),[a,e?.api]);const u=async h=>{if(!(!Vu(e,t)||!c())){r({state:"closed"}),i(!1);try{await e.open(t.serverId,h)}catch{i(!0)}}};return{menu:n,setMenu:r,failed:s,activate:async()=>{if(!Vu(e,t)||!c())return;o.current?.abort();const h=new AbortController;o.current=h,i(!1),r({state:"loading"});try{const f=await e.api.discoverFile(t.serverId,t.resourceUri,h.signal);if(h.signal.aborted||!c())return;if(f.length===1){await u(f[0]);return}f.length===0&&nS({serverId:t.serverId,label:"file-viewer",level:"info",message:"No file viewer of this server accepts this file's extension."}),r({state:"ready",entries:f})}catch{if(h.signal.aborted||!c())return;r({state:"error"}),nS({serverId:t.serverId,label:"file-viewer",level:"error",message:"Couldn't list the file viewers for this file."})}},open:u}}var bJ={onPointerDown:e=>e.preventDefault(),onKeyDown:e=>{(e.key==="Enter"||e.key===" ")&&e.preventDefault()}};function SJ({menu:e,onOpen:t}){return(0,m.jsxs)(FC,{align:"start",children:[(0,m.jsx)(i4,{className:"text-xs text-muted-foreground",children:"Open with…"}),e.state==="error"&&(0,m.jsx)(Pu,{disabled:!0,children:"Couldn't load viewers"}),e.state==="ready"&&e.entries.length===0&&(0,m.jsx)(Pu,{disabled:!0,children:"No viewer can open this file"}),e.state==="ready"&&e.entries.map(n=>(0,m.jsx)(Pu,{onSelect:()=>t(n),children:n.title},n.toolName))]})}function tk({reference:e,label:t,className:n}){const r=(0,p.useContext)(Mh),s=yJ(r,e);return Vu(r,e)?(0,m.jsxs)(LC,{open:s.menu.state==="ready"||s.menu.state==="error",onOpenChange:i=>{i||s.setMenu({state:"closed"})},children:[(0,m.jsx)(_C,{asChild:!0,...bJ,children:(0,m.jsxs)("button",{type:"button",onClick:i=>{i.stopPropagation(),s.activate()},className:he("inline-flex max-w-full items-center gap-1 text-left text-primary underline-offset-2 hover:underline",n),children:[(0,m.jsx)("span",{className:"truncate",children:t}),s.menu.state==="loading"?(0,m.jsx)(FN,{className:"size-3 shrink-0 animate-spin","aria-hidden":!0}):null]})}),(0,m.jsx)(SJ,{menu:s.menu,onOpen:i=>{s.open(i)}}),s.failed&&(0,m.jsx)("span",{role:"alert",className:"ms-1 text-xs text-destructive",children:"Could not open viewer"})]}):(0,m.jsx)("span",{className:n,children:t})}function Xae({result:e,serverId:t}){const n=(0,p.useContext)(Mh);if(!n||!t||!n.serverIds.includes(t)||!e||typeof e!="object")return null;const r=e,s=r.content??r.value?.content;if(!Array.isArray(s))return null;const i=s.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 i.length?(0,m.jsx)(EJ,{serverId:t,links:i}):null}function EJ({serverId:e,links:t}){return mJ(e,t),(0,m.jsx)("div",{className:"flex flex-wrap gap-2 px-3 pb-2",children:t.map((n,r)=>(0,m.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,m.jsx)(tk,{reference:{serverId:e,resourceUri:n.uri},label:n.name})},`${n.uri}:${r}`))})}var nk=(0,p.createContext)(new Map);function Zae(e){const t=(0,p.useContext)(nk);return e?t.get(e):void 0}function xJ({name:e}){return e?(0,m.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,m.jsx)(HH,{className:"size-2.5 shrink-0","aria-hidden":!0}),(0,m.jsx)("span",{className:"min-w-0 truncate",children:e})]}):null}var wJ=50,Zf="null";function Ji(){return{line:1,column:1}}function DJ(e){if(e===void 0)return Zf;try{return JSON.stringify(e,null,2)??Zf}catch{return Zf}}function Qi(e){try{return{value:JSON.parse(e),error:null}}catch(t){return{value:void 0,error:t instanceof Error?t.message:"Invalid JSON"}}}function Yi(e){try{return JSON.stringify(e)}catch{return null}}function Di(e){if(typeof e=="string"){try{const t=JSON.parse(e);if(typeof t=="object"&&t!==null)return Di(t)}catch{}return e}if(Array.isArray(e))return e.map(Di);if(typeof e=="object"&&e!==null){const t={};for(const[n,r]of Object.entries(e))t[n]=Di(r);return t}return e}function nl(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[s,i]of Object.entries(e))n[s]=s in r?nl(i,r[s]):i;return n}return Array.isArray(e)&&Array.isArray(t)?e.map((n,r)=>r<t.length?nl(n,t[r]):n):e}function Qc(e,t,n){return e!==void 0?e:DJ(n?Di(t):t)}function TJ({initialValue:e,initialContent:t,onChange:n,onRawChange:r,onValidationError:s,expandJsonStrings:i=!1}){const o=(0,p.useRef)(null);if(o.current===null){const F=Qc(t,e,i),z=Qi(F);let J;z.error!==null?J=null:i?J=Yi(nl(z.value,e)):J=Yi(z.value),o.current={content:F,lastEmitted:J,error:z.error}}const[a,l]=(0,p.useState)(o.current.content),c=(0,p.useRef)(e),u=(0,p.useRef)(o.current.content),d=(0,p.useRef)(o.current.content),h=(0,p.useRef)(o.current.lastEmitted),[f,B]=(0,p.useState)(o.current.error),[g,C]=(0,p.useState)(Ji),v=(0,p.useRef)([{content:o.current.content,cursorPosition:Ji()}]),y=(0,p.useRef)(0),S=(0,p.useCallback)(F=>{const z=Qi(F);return B(z.error),s?.(z.error),z},[s]);(0,p.useEffect)(()=>{u.current=a},[a]);const E=(0,p.useRef)({value:e,content:t});if(e!==E.current.value||t!==E.current.content)if(E.current={value:e,content:t},t===void 0&&i){const F=Yi(e);F!==null&&F===h.current?(c.current=e,d.current=u.current):(c.current=e,d.current=Qc(void 0,e,!0))}else c.current=e,d.current=Qc(t,e,i);(0,p.useEffect)(()=>{const F=d.current;if(F===u.current)return;u.current=F,l(F),C(Ji()),v.current=[{content:F,cursorPosition:Ji()}],y.current=0,S(F);const z=Qi(F);if(z.error===null&&i){const J=nl(z.value,e);h.current=Yi(J)}else h.current=z.error===null?Yi(z.value):null},[e,t,S,i]);const D=(0,p.useCallback)((F,z,J)=>{r?.(F);const Z=Q=>{const G=i?nl(Q,c.current):Q,be=Yi(G);if(be===null){n?.(G);return}be!==h.current&&(h.current=be,n?.(G))};if(J===void 0){const Q=Qi(F);Q.error===null&&Z(Q.value);return}J===null&&Z(z)},[n,r,i]),A=(0,p.useCallback)(F=>{if(F===u.current)return;u.current=F,l(F);const{value:z,error:J}=S(F),Z=y.current;let Q=v.current;Z<Q.length-1&&(Q=Q.slice(0,Z+1));const G=Q[Q.length-1];(!G||G.content!==F)&&(Q=[...Q,{content:F,cursorPosition:g}]),Q.length>wJ&&(Q=Q.slice(-50)),v.current=Q,y.current=Q.length-1,D(F,z,J)},[g,D,S]),x=(0,p.useCallback)(F=>{u.current=F.content,l(F.content),C(F.cursorPosition);const{value:z,error:J}=S(F.content);D(F.content,z,J)},[D,S]),O=(0,p.useCallback)(()=>{const F=v.current,z=y.current;if(z>0){y.current=z-1;const J=F[z-1];x(J)}},[x]),R=(0,p.useCallback)(()=>{const F=v.current,z=y.current;if(z<F.length-1){y.current=z+1;const J=F[z+1];x(J)}},[x]),P=(0,p.useCallback)(()=>{const{value:F,error:z}=Qi(a);if(z===null){const J=i?Di(F):F,Z=JSON.stringify(J,null,2);A(Z)}},[a,A,i]),_=(0,p.useCallback)(()=>{c.current=e;const F=Qc(t,e,i);d.current=F,u.current=F,l(F),C(Ji()),v.current=[{content:F,cursorPosition:Ji()}],y.current=0;const{value:z,error:J}=S(F);D(F,z,J)},[e,t,S,D,i]),N=(0,p.useCallback)(()=>{const{value:F,error:z}=Qi(a);return z===null?F:void 0},[a]),W=y.current>0,q=y.current<v.current.length-1;return{content:a,setContent:A,isValid:f===null,validationError:f,cursorPosition:g,setCursorPosition:C,undo:O,redo:R,canUndo:W,canRedo:q,format:P,reset:_,getParsedValue:N,sourceContent:d.current}}function AJ(e){return typeof e=="object"?e.key:e}function IJ(e,t){const n=e.length;return new Proxy(e,{get(r,s,i){if(typeof s=="string"){const o=s.charCodeAt(0);if(o>=48&&o<=57){const a=+s;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(s==="length")return n}return Reflect.get(r,s,i)}})}function Xi(e,t,n){let r=n.initialDeps??[],s,i=!0;function o(){const a=e();return(a.length!==r.length||a.some((l,c)=>r[c]!==l))&&(r=a,s=t(...a),n?.onChange&&!(i&&n.skipInitialOnChange)&&n.onChange(s),i=!1),s}return o.updateDeps=a=>{r=a},o}function sS(e,t){if(e===void 0)throw new Error(`Unexpected undefined${t?`: ${t}`:""}`);return e}var iS=(e,t)=>Math.abs(e-t)<1.01,kJ=(e,t,n)=>{let r;return Object.assign(function(...s){e.clearTimeout(r),r=e.setTimeout(()=>t.apply(this,s),n)},{cancel:()=>{e.clearTimeout(r)}})},pa,eB=()=>{if(pa!==void 0)return pa;if(typeof navigator>"u")return pa=!1;if(/iP(hone|od|ad)/.test(navigator.userAgent))return pa=!0;const e=navigator.maxTouchPoints;return pa=navigator.platform==="MacIntel"&&e!==void 0&&e>0},oS=e=>{const{offsetWidth:t,offsetHeight:n}=e;return{width:t,height:n}},RJ=e=>e,OJ=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 s=0;s<n;s++)r[s]=t+s;return r},MJ=(e,t)=>{const n=e.scrollElement;if(!n)return;const r=e.targetWindow;if(!r)return;const s=o=>{const{width:a,height:l}=o;t({width:Math.round(a),height:Math.round(l)})};if(s(oS(n)),!r.ResizeObserver)return()=>{};const i=new r.ResizeObserver(o=>{const a=()=>{const l=o[0];if(l?.borderBoxSize){const c=l.borderBoxSize[0];if(c){s({width:c.inlineSize,height:c.blockSize});return}}s(oS(n))};e.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(a):a()});return i.observe(n,{box:"border-box"}),()=>{i.unobserve(n)}},Rd={passive:!0},NJ=typeof window>"u"?!0:"onscrollend"in window,PJ=(e,t,n)=>{const r=e.scrollElement;if(!r)return;const s=e.targetWindow;if(!s)return;const i=e.options.useScrollendEvent&&NJ;let o=0;const a=i?null:kJ(s,()=>t(n(r),!1),e.options.isScrollingResetDelay),l=d=>()=>{o=n(r),a?.(),t(o,d)},c=l(!0),u=l(!1);return r.addEventListener("scroll",c,Rd),i&&r.addEventListener("scrollend",u,Rd),()=>{r.removeEventListener("scroll",c),i&&r.removeEventListener("scrollend",u),a?.cancel()}},LJ=(e,t)=>PJ(e,t,n=>{const{horizontal:r,isRtl:s}=e.options;return r?n.scrollLeft*(s&&-1||1):n.scrollTop}),_J=(e,t,n)=>{if(n.options.useCachedMeasurements){const r=n.indexFromElement(e),s=n.options.getItemKey(r);return n.itemSizeCache.get(s)??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),s=n.options.getItemKey(r),i=n.itemSizeCache.get(s);if(i!==void 0)return i}return e[n.options.horizontal?"offsetWidth":"offsetHeight"]},FJ=(e,{adjustments:t=0,behavior:n},r)=>{var s,i;(i=(s=r.scrollElement)==null?void 0:s.scrollTo)==null||i.call(s,{[r.options.horizontal?"left":"top"]:e+t,behavior:n})},HJ=FJ;function jJ(e,t,n,r){if(t===0)return!1;const s=r(0),i=new Set;let o=0;for(;o<e;){const l=n(o);if(l===s)break;i.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(i.has(r(l)))return!1;return!0}var GJ=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(s=>{const i=()=>{const o=s.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,s,this))};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(i):i()})}));return{disconnect:()=>{var r;(r=n())==null||r.disconnect(),t=null},observe:r=>{var s;return(s=n())==null?void 0:s.observe(r,{box:"border-box"})},unobserve:r=>{var s;return(s=n())==null?void 0:s.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:RJ,rangeExtractor:OJ,onChange:()=>{},measureElement:_J,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 d=t[u];d!==void 0&&(r[u]=d)}const s=this.options;let i=null,o=null,a=!1;if(s!==void 0&&s.enabled&&r.enabled&&r.anchorTo==="end"&&this.scrollElement!==null){const u=s.count,d=r.count,h=this.getMeasurements(),f=((n=this._singleLaneMeasurements)==null?void 0:n.items)??h,B=v=>AJ(f[v]),g=u>0?B(0):null,C=u>0?B(u-1):null;if(d!==u||u>0&&d>0&&(r.getItemKey(0)!==g||r.getItemKey(d-1)!==C)){a=!0;const v=u>0?this.getVirtualItemForOffset(this.getScrollOffset())??h[0]:null;v&&(i=[v.key,this.getScrollOffset()-v.start]);const y=r.followOnAppend===!0?"auto":r.followOnAppend||null;y&&d>0&&this.isAtEnd(s.scrollEndThreshold)&&(u===0||r.getItemKey(d-1)!==C)&&(d>u||jJ(u,d,B,r.getItemKey))&&(o=y)}}this.options=r,a&&(this.pendingMin=0,this.itemSizeCacheVersion++);let l=!1,c=0;if(i&&this.scrollOffset!==null){const[u,d]=i,h=this.getMeasurements(),{count:f,getItemKey:B}=this.options;let g=0;for(;g<f&&B(g)!==u;)g++;if(g<f){const C=h[g];if(C){const v=Math.max(0,C.start+d);!o&&v!==this.scrollOffset&&(c=v-this.scrollOffset,this.scrollOffset=v,l=!0)}}}(l||o)&&(this.pendingScrollAnchor=[l?i[0]:null,l?i[1]:0,o,c])},this.notify=t=>{var n,r;(r=(n=this.options).onChange)==null||r.call(n,this,t)},this.maybeNotify=Xi(()=>(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(i=>{this.observer.observe(i)}),this.unsubs.push(this.options.observeElementRect(this,i=>{this.scrollRect=i,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(i,o)=>{if(o&&this._intendedScrollOffset===null&&i===this.scrollOffset)return;this._intendedScrollOffset!==null&&Math.abs(i-this._intendedScrollOffset)<1.5&&(i=this._intendedScrollOffset),this._intendedScrollOffset=null,this._clampedAdjustment!==null&&Math.abs(i-this._clampedAdjustment.maxAtWrite)>=1.5&&(this._clampedAdjustment=null),this.scrollAdjustments=0;const a=this.getScrollOffset();this.scrollDirection=o?a===i?this.scrollDirection:a<i?"forward":"backward":null,this.scrollOffset=i,this.isScrolling=o,this._flushIosDeferredIfReady(),this.scrollState&&this.scheduleScrollReconcile(),this.maybeNotify()})),"addEventListener"in this.scrollElement){const i=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,!(!eB()||this.targetWindow==null)&&(this._iosJustTouchEnded=!0,this._iosTouchEndTimerId=this.targetWindow.setTimeout(()=>{this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._flushIosDeferredIfReady()},150))};i.addEventListener("touchstart",o,Rd),i.addEventListener("touchend",a,Rd),this.unsubs.push(()=>{i.removeEventListener("touchstart",o),i.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 s=this.pendingScrollAnchor;if(this.pendingScrollAnchor=null,s&&this.scrollElement&&this.options.enabled){const[i,o,a,l]=s;i!==null&&!a&&(eB()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded)?l!==0&&(this._iosDeferredAdjustment+=l):((n=this.scrollState)==null?void 0:n.behavior)==="smooth"&&!iS(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=Xi(()=>[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,s,i,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:s,enabled:i,lanes:o,laneAssignmentMode:a,gap:l}),{key:!1}),this.isIndexInRange=t=>t>=0&&t<this.options.count,this.getMeasurements=Xi(()=>[this.getMeasurementOptions(),this.itemSizeCacheVersion],({count:t,paddingStart:n,scrollMargin:r,getItemKey:s,enabled:i,lanes:o,laneAssignmentMode:a,gap:l},c)=>{var u;const d=this.itemSizeCache;if(!i)return this.measurementsCache=[],this._singleLaneMeasurements=null,this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>t)for(const v of this.laneAssignments.keys())v>=t&&this.laneAssignments.delete(v);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(v=>{this.itemSizeCache.set(v.key,v.size)}));const h=this.lanesSettling?0:this.pendingMin??0;if(this.pendingMin=null,this.lanesSettling&&this.measurementsCache.length===t&&(this.lanesSettling=!1),o===1){const v=t*2;let y=(u=this._singleLaneMeasurements)==null?void 0:u.flat;if(!y||y.length<v){const A=new Float64Array(v);y&&h>0&&A.set(y.subarray(0,h*2)),y=A}const S=h===0?new Array(t):this._singleLaneMeasurements.items.slice();let E;if(h===0)E=n+r;else{const A=h-1;E=y[A*2]+y[A*2+1]+l}for(let A=h;A<t;A++){const x=s(A);S[A]=x;const O=d.get(x),R=typeof O=="number"?O:this.options.estimateSize(A);y[A*2]=E,y[A*2+1]=R,E+=R+l}this._singleLaneMeasurements={flat:y,items:S};const D=IJ(S,y);return this.measurementsCache=D,D}const f=this.measurementsCache.slice(0,h),B=new Array(o).fill(void 0),g=new Float64Array(o);let C=0;for(let v=0;v<h;v++){const y=f[v];y&&(B[y.lane]===void 0&&C++,B[y.lane]=v,g[y.lane]=y.end)}for(let v=h;v<t;v++){const y=s(v),S=this.laneAssignments.get(v);let E,D;const A=a==="estimate"||d.has(y);if(S!==void 0&&this.options.lanes>1){E=S;const P=B[E],_=P!==void 0?f[P]:void 0;D=_?_.end+l:n+r}else if(C===o){let P=0,_=g[0],N=B[0];for(let W=1;W<o;W++){const q=g[W];(q<_||q===_&&B[W]<N)&&(P=W,_=q,N=B[W])}E=P,D=_+l,A&&this.laneAssignments.set(v,E)}else E=v%this.options.lanes,D=n+r,A&&this.laneAssignments.set(v,E);const x=d.get(y),O=typeof x=="number"?x:this.options.estimateSize(v),R=D+O;f[v]={index:v,start:D,size:O,end:R,key:y,lane:E},B[E]===void 0&&C++,B[E]=v,g[E]=R}return this.measurementsCache=f,f},{key:!1,debug:()=>this.options.debug}),this.calculateRange=Xi(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(t,n,r,s)=>t.length===0||n===0?(this.range=null,null):(this.range=UJ(t,n,r,s,s===1&&this._singleLaneMeasurements!==null?this._singleLaneMeasurements.flat:null),this.range),{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=Xi(()=>{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,s,i)=>s===null||i===null?[]:t({startIndex:s,endIndex:i,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 s=Math.max(this.options.overscan,Math.ceil((this.range.endIndex-this.range.startIndex)/2)),i=Math.max(0,r-s),o=Math.min(this.options.count-1,r+s);return t>=i&&t<=o}return!0},this.measureElement=t=>{if(!t){this.elementsCache.forEach((i,o)=>{i.isConnected||(this.observer.unobserve(i),this.elementsCache.delete(o))});return}const n=this.indexFromElement(t);if(!this.isIndexInRange(n))return;const r=this.options.getItemKey(n),s=this.elementsCache.get(r);s!==t&&(s&&this.observer.unobserve(s),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,s,i;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 h=this.measurementsCache[t];if(!h)return;l=h.key,a=h.start,o=h.size}const u=this.itemSizeCache.get(l)??o,d=n-u;if(d!==0){const h=this.options.anchorTo==="end"&&((s=this.scrollState)==null?void 0:s.behavior)!=="smooth"&&this.getVirtualDistanceFromEnd()<=this.options.scrollEndThreshold,f=h?this.getTotalSize():0,B=this.getScrollOffset()+this.scrollAdjustments,g=this.itemSizeCache.has(l)?a+u<=B&&this.scrollDirection!=="backward":a<B,C=((i=this.scrollState)==null?void 0:i.behavior)!=="smooth"&&(this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(this.measurementsCache[t]??{index:t,key:l,start:a,size:o,end:a+o,lane:0},d,this):g);(this.pendingMin===null||t<this.pendingMin)&&(this.pendingMin=t),this.itemSizeCache.set(l,n),this.itemSizeCacheVersion++;let v=!1;h?v=this.applyScrollAdjustment(this.getTotalSize()-f):C&&(v=this.applyScrollAdjustment(d)),this.notify(v),this._retryClampedAdjustment()}},this.getVirtualItems=Xi(()=>[this.getVirtualIndexes(),this.getMeasurements()],(t,n)=>{const r=[];for(let s=0,i=t.length;s<i;s++){const o=n[t[s]];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 s=(n=this._singleLaneMeasurements)==null?void 0:n.flat,i=this.options.lanes===1&&s!=null,o=rk(0,r.length-1,i?a=>s[a*2]:a=>sS(r[a]).start,t);return sS(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 s=this.getSize(),i=this.getScrollOffset();n==="auto"&&(n=t>=i+s?"end":"start"),n==="center"?t+=(r-s)/2:n==="end"&&(t-=s);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(),s=this.getScrollOffset(),i=this.measurementsCache[t];if(!i)return;if(n==="auto")if(i.end>=s+r-this.options.scrollPaddingEnd)n="end";else if(i.start<=s+this.options.scrollPaddingStart)n="start";else return[s,n];if(n==="end"&&t===this.options.count-1)return[this.getMaxScrollOffset(),n];const o=n==="end"?i.end+this.options.scrollPaddingEnd:i.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(o,n,i.size),n]},this.scrollToOffset=(t,{align:n="start",behavior:r="auto"}={})=>{this._iosDeferredAdjustment=0;const s=this.getOffsetForAlignment(t,n),i=this.now();this.scrollState={index:null,align:n,behavior:r,startedAt:i,lastTargetOffset:s,stableFrames:0},this._scrollToOffset(s,{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 s=this.getOffsetForIndex(t,n);if(!s)return;const[i,o]=s,a=this.now();this.scrollState={index:t,align:o,behavior:r,startedAt:a,lastTargetOffset:i,stableFrames:0},this._scrollToOffset(i,{adjustments:void 0,behavior:r}),this.scheduleScrollReconcile()},this.scrollBy=(t,{behavior:n="auto"}={})=>{const r=this.getScrollOffset()+t,s=this.now();this.scrollState={index:null,align:"start",behavior:n,startedAt:s,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 s;if(r.length===0)s=this.options.paddingStart;else if(this.options.lanes===1){const i=r.length-1,o=(t=this._singleLaneMeasurements)==null?void 0:t.flat;o!=null?s=o[i*2]+o[i*2+1]:s=((n=r[i])==null?void 0:n.end)??0}else{const i=Array(this.options.lanes).fill(null);let o=r.length-1;for(;o>=0&&i.some(a=>a===null);){const a=r[o];i[a.lane]===null&&(i[a.lane]=a.end),o--}s=Math.max(...i.filter(a=>a!==null))}return Math.max(s-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(eB()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded))return this._iosDeferredAdjustment+=e,!1;{const n=this.getScrollOffset()+this.scrollAdjustments+e,r=this.scrollElement,s=r!==null&&("scrollHeight"in r||"document"in r)?this.getMaxScrollOffset():null;return this._clampedAdjustment=s!==null&&n>s+.5?{target:n,maxAtWrite:s}: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&&iS(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 s=this.getSize()||600,i=Math.abs(t-this.getScrollOffset()),o=this.scrollState.behavior==="smooth"&&i>s;this.scrollState.lastTargetOffset=t,o||(this.scrollState.behavior="auto"),this._scrollToOffset(t,{adjustments:void 0,behavior:o?"smooth":"auto"})}this.scheduleScrollReconcile()}},rk=(e,t,n,r)=>{for(;e<=t;){const s=(e+t)/2|0,i=n(s);if(i<r)e=s+1;else if(i>r)t=s-1;else return s}return e>0?e-1:0};function VJ(e,t,n){let r=0;for(;r<=t;){const s=(r+t)/2|0,i=e[s*2];if(i<n)r=s+1;else if(i>n)t=s-1;else return s}return r>0?r-1:0}function UJ(e,t,n,r,s){const i=e.length-1;if(e.length<=r)return{startIndex:0,endIndex:i};if(r===1&&s!==null){const c=VJ(s,i,n);let u=c;const d=n+t;for(;u<i&&s[u*2]+s[u*2+1]<d;)u++;return{startIndex:c,endIndex:u}}let a=rk(0,i,c=>e[c].start,n),l=a;if(r===1)for(;l<i&&e[l].end<n+t;)l++;else if(r>1){const c=Array(r).fill(0);for(;l<i&&c.some(d=>d<n+t);){const d=e[l];c[d.lane]=d.end,l++}const u=Array(r).fill(n+t);for(;a>=0&&u.some(d=>d>=n);){const d=e[a];u[d.lane]=d.start,a--}a=Math.max(0,a-a%r),l=Math.min(i,l+(r-1-l%r))}return{startIndex:a,endIndex:l}}var tB=typeof document<"u"?p.useLayoutEffect:p.useEffect;function zJ({useFlushSync:e=!0,directDomUpdates:t=!1,directDomUpdatesMode:n="transform",...r}){const s=p.useReducer(d=>d+1,0)[1],i=p.useRef({enabled:t,mode:n,container:null,lastSize:null,lastPositions:new WeakMap,prevRange:null});i.current.enabled=t,i.current.mode=n;const o=p.useRef(!1),a=d=>{const h=i.current;if(!h.enabled||!h.container)return;const f=d.getTotalSize();if(f!==h.lastSize){h.lastSize=f;const B=d.options.horizontal?"width":"height";h.container.style[B]=`${f}px`}},l=d=>{const h=i.current;if(!h.enabled||!h.container)return;a(d);const f=!!d.options.horizontal,B=h.mode==="transform",g=f?"left":"top",C=d.options.scrollMargin,v=d.getVirtualItems();for(const y of v){const S=y.start-C,E=d.elementsCache.get(y.key);E&&h.lastPositions.get(E)!==S&&(h.lastPositions.set(E,S),B?E.style.transform=f?`translate3d(${S}px, 0, 0)`:`translate3d(0, ${S}px, 0)`:E.style[g]=`${S}px`)}},c={...r,onChange:(d,h)=>{var f;const B=i.current;let g=!0;if(B.enabled){l(d);const C=d.range,v=B.prevRange;g=!v||v.isScrolling!==d.isScrolling||v.startIndex!==C?.startIndex||v.endIndex!==C?.endIndex,g&&(B.prevRange=C?{startIndex:C.startIndex,endIndex:C.endIndex,isScrolling:d.isScrolling}:null)}g&&(e&&h&&!o.current?(0,Yo.flushSync)(s):s()),(f=r.onChange)==null||f.call(r,d,h)}},[u]=p.useState(()=>{const d=new GJ(c),h=d.measureElement;return d.measureElement=f=>{o.current=!0;try{h(f)}finally{o.current=!1}},Object.assign(d,{containerRef:f=>{const B=i.current;if(B.container=f,B.lastSize=null,f&&B.enabled){const g=d.getTotalSize();B.lastSize=g;const C=d.options.horizontal?"width":"height";f.style[C]=`${g}px`}}})});return u.setOptions(c),tB(()=>u._didMount(),[]),tB(()=>(a(u),u._willUpdate())),tB(()=>{l(u)}),u}function $J(e){return zJ({observeElementRect:MJ,observeElementOffset:LJ,scrollToFn:HJ,...e})}function WJ(e){return e.map((t,n)=>typeof t=="number"?`[${t}]`:n===0?t:`.${t}`).join("")}function sk(e){const t=[];let n=0;const r=()=>{for(;n<e.length&&/\s/.test(e[n]);)n++},s=()=>{const d=n;for(n++;n<e.length;)if(e[n]==="\\")n+=2;else if(e[n]==='"'){n++;break}else n++;return e.slice(d,n)},i=()=>{const d=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(d,n)},o=()=>{const d=n;for(;n<e.length&&/[a-z]/.test(e[n]);)n++;return e.slice(d,n)},a=[];let l=!1;const c=[];let u=null;for(;n<e.length&&(r(),!(n>=e.length));){const d=e[n],h=n;switch(d){case"{":t.push({type:"punctuation",value:"{",start:h,end:n+1}),a.push("object"),l=!0,u!==null&&(c.push(u),u=null),n++;break;case"}":t.push({type:"punctuation",value:"}",start:h,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:h,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:h,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:h,end:n+1}),l=!1,n++;break;case",":t.push({type:"punctuation",value:",",start:h,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 f=s();if(l&&a.length>0&&a[a.length-1]==="object"){let B;try{B=JSON.parse(f)}catch{B=f.slice(1,-1)}u=B,t.push({type:"key",value:f,start:h,end:n,path:[...c,B],keyName:B})}else{const B=u!==null?[...c,u]:[...c];t.push({type:"string",value:f,start:h,end:n,path:B,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 f=i(),B=u!==null?[...c,u]:[...c];t.push({type:"number",value:f,start:h,end:n,path:B,keyName:u??void 0}),u=null,l=!1;break}case"t":case"f":{const f=o(),B=u!==null?[...c,u]:[...c];f==="true"?t.push({type:"boolean",value:f,start:h,end:n,path:B,keyName:u??void 0}):f==="false"&&t.push({type:"boolean-false",value:f,start:h,end:n,path:B,keyName:u??void 0}),u=null,l=!1;break}case"n":{const f=o();if(f==="null"){const B=u!==null?[...c,u]:[...c];t.push({type:"null",value:f,start:h,end:n,path:B,keyName:u??void 0}),u=null}l=!1;break}default:n++}}return t}function ik(e){const t=sk(e);let n="",r=0;const s=i=>{i&&(n+=`<span class="json-punctuation">${aS(i)}</span>`)};for(const i of t){i.start>r&&s(e.slice(r,i.start));const o=`json-${i.type}`;n+=`<span class="${o}">${aS(i.value)}</span>`,r=i.end}return r<e.length&&s(e.slice(r)),n}function aS(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function ok({value:e,displayValue:t,maxLength:n,onCopy:r,keyName:s,path:i}){const[o,a]=(0,p.useState)(null),[l,c]=(0,p.useState)(!1),[u,d]=(0,p.useState)(!1),h=e.length>n,f=h&&!u?`"${e.slice(0,n)}..."`:t,B=(0,p.useCallback)(async(y,S)=>{await ra(y)&&(a(S),r?.(y),setTimeout(()=>a(null),1500))},[r]),g=(0,p.useCallback)(y=>{h&&(y.stopPropagation(),d(S=>!S))},[h]),C=i&&i.length>0?WJ(i):null,v=[];return v.push({label:"Copy value",value:e,key:"value"}),s&&v.push({label:"Copy key",value:s,key:"key"}),C&&v.push({label:"Copy path",value:C,key:"path"}),v.length===1?(0,m.jsxs)("span",{className:"relative group/copy",onMouseEnter:()=>c(!0),onMouseLeave:()=>c(!1),children:[(0,m.jsx)("span",{onClick:g,className:he("json-string",h&&!u&&"json-string-truncated"),children:f}),(0,m.jsx)("button",{onClick:y=>{y.stopPropagation(),B(v[0].value,v[0].key)},className:he("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,m.jsx)(Vs,{className:"h-3 w-3 text-green-500"}):(0,m.jsx)(_s,{className:"h-3 w-3 text-muted-foreground/60 hover:text-muted-foreground"})})]}):(0,m.jsxs)("span",{className:"relative group/copy",onMouseEnter:()=>c(!0),onMouseLeave:()=>c(!1),children:[(0,m.jsx)("span",{onClick:g,className:he("json-string",h&&!u&&"json-string-truncated"),children:f}),(0,m.jsxs)(LC,{children:[(0,m.jsx)(_C,{asChild:!0,children:(0,m.jsx)("button",{className:he("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:y=>y.stopPropagation(),children:o?(0,m.jsx)(Vs,{className:"h-3 w-3 text-green-500"}):(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(_s,{className:"h-3 w-3 text-muted-foreground/60"}),(0,m.jsx)(gD,{className:"h-2 w-2 text-muted-foreground/60 -ml-0.5"})]})})}),(0,m.jsx)(FC,{align:"start",className:"min-w-[140px]",children:v.map(y=>(0,m.jsxs)(Pu,{onClick:()=>B(y.value,y.key),className:"text-xs",children:[(0,m.jsx)(_s,{className:"h-3 w-3 mr-2"}),y.label]},y.key))})]})]})}function lS(e,t){return t?(0,m.jsx)("span",{className:"json-punctuation",children:t},e):null}function nB({children:e,value:t,onCopy:n}){const[r,s]=(0,p.useState)(!1),[i,o]=(0,p.useState)(!1),a=(0,p.useCallback)(async l=>{await ra(l)&&(s(!0),n?.(l),setTimeout(()=>s(!1),1500))},[n]);return(0,m.jsxs)("span",{className:"relative group/copy",onMouseEnter:()=>o(!0),onMouseLeave:()=>o(!1),children:[e,(0,m.jsx)("button",{onClick:l=>{l.stopPropagation(),a(t)},className:he("inline-flex items-center justify-center ml-1 p-0.5 rounded","transition-all duration-150","hover:bg-muted",i||r?"opacity-100":"opacity-0"),style:{verticalAlign:"middle"},children:r?(0,m.jsx)(Vs,{className:"h-3 w-3 text-green-500"}):(0,m.jsx)(_s,{className:"h-3 w-3 text-muted-foreground/60 hover:text-muted-foreground"})})]})}function cS(e,t){const n=e[t],r=n==="{"?"}":"]";let s=1,i=t+1,o=!1,a=!1;for(;i<e.length&&s>0;){const l=e[i];a?a=!1:l==="\\"?a=!0:l==='"'?o=!o:o||(l===n?s++:l===r&&s--),i++}return e.slice(t,i)}function qJ({content:e,onCopy:t,collapseStringsAfterLength:n}){const r=(0,p.useMemo)(()=>{const s=sk(e),i=[];let o=0,a=null,l=!0;const c=u=>{for(let d=u+1;d<s.length;d++){const h=s[d];if(!(h.type==="punctuation"&&h.value===":"))return h}return null};for(let u=0;u<s.length;u++){const d=s[u];d.start>o&&i.push(lS(`ws-${o}`,e.slice(o,d.start)));const h=`json-${d.type}`;if(d.type==="key"){const g=c(u);g&&g.type==="punctuation"&&(g.value==="{"||g.value==="[")&&(a={start:g.start}),i.push((0,m.jsx)("span",{className:h,children:d.value},`token-${u}`)),o=d.end;continue}if(l&&d.type==="punctuation"&&(d.value==="{"||d.value==="[")){l=!1;const g=cS(e,d.start);i.push((0,m.jsx)(nB,{value:g,onCopy:t,children:(0,m.jsx)("span",{className:h,children:d.value})},`token-${u}`)),o=d.end;continue}if(a&&d.type==="punctuation"&&(d.value==="{"||d.value==="[")&&d.start===a.start){const g=cS(e,d.start);a=null,i.push((0,m.jsx)(nB,{value:g,onCopy:t,children:(0,m.jsx)("span",{className:h,children:d.value})},`token-${u}`)),o=d.end;continue}const f=d.type==="string"||d.type==="number"||d.type==="boolean"||d.type==="boolean-false"||d.type==="null",B=()=>{if(d.type==="string")try{return JSON.parse(d.value)}catch{return d.value.slice(1,-1)}return d.value};if(d.type==="string"&&n!==void 0){const g=B();i.push((0,m.jsx)(ok,{value:g,displayValue:d.value,maxLength:n,onCopy:t,keyName:d.keyName,path:d.path},`token-${u}`))}else f?i.push((0,m.jsx)(nB,{value:B(),onCopy:t,children:(0,m.jsx)("span",{className:h,children:d.value})},`token-${u}`)):i.push((0,m.jsx)("span",{className:h,children:d.value},`token-${u}`));o=d.end}return o<e.length&&i.push(lS("ws-end",e.slice(o))),i},[e,t,n]);return(0,m.jsx)(m.Fragment,{children:r})}var yi=20,uS=30,dS=12,rm=80,KJ=2;function JJ(e){const t=e.value,n=e.selectionStart,r=t.substring(0,n).split(`
|
|
60
|
+
`);return{line:r.length,column:r[r.length-1].length+1}}function QJ(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 rm;const s=Number.parseFloat(t.paddingLeft)||0,i=Number.parseFloat(t.paddingRight)||0,o=e.clientWidth-s-i;return o<=0?rm:Math.max(1,Math.floor(o/r))}function YJ(e,t){const n=e.replace(/\t/g," ".repeat(KJ)).length;return n===0?1:Math.max(1,Math.ceil(n/t))}function XJ(e,t,n){let r=0;return e.map((s,i)=>{const o=t?YJ(s,n)*yi:yi,a=t?r:i*yi;return r+=o,{top:a,height:o}})}function ZJ(e,t,n,r,s){return(0,p.useMemo)(()=>{if(!r)return{highlightedHtml:"",paddingTop:0,paddingBottom:0};const i=e.split(`
|
|
61
|
+
`),o=i.length;if(o===0)return{highlightedHtml:"",paddingTop:0,paddingBottom:0};let a=0,l=o-1;for(;a<=l;){const D=a+l>>>1,A=s[D];!A||A.top+A.height<=t?a=D+1:l=D-1}const c=Math.min(a,o-1),u=t+n;let d=c;for(let D=c;D<o;D++){const A=s[D];if(!A||A.top>=u)break;d=D}const h=Math.max(0,c-uS),f=Math.min(o-1,d+uS),B=i.slice(h,f+1).join(`
|
|
62
|
+
`),g=s[h],C=s[f],v=s[o-1],y=v?v.top+v.height:0,S=g?.top??0,E=Math.max(0,y-(C?C.top+C.height:0));return{highlightedHtml:ik(B),paddingTop:S,paddingBottom:E}},[e,t,n,r,s])}function ak({content:e,onChange:t,onCursorChange:n,onUndo:r,onRedo:s,onEscape:i,isValid:o=!0,readOnly:a=!1,className:l,height:c,maxHeight:u,showLineNumbers:d=!0,collapseStringsAfterLength:h,wrapLongLinesInEdit:f=!1,wrapLongLinesInView:B=!1}){const g=(0,p.useRef)(null),C=(0,p.useRef)(null),v=(0,p.useRef)(null),y=(0,p.useRef)(null),S=(0,p.useRef)(null),[E,D]=(0,p.useState)(!1),[A,x]=(0,p.useState)(1),[O,R]=(0,p.useState)(0),[P,_]=(0,p.useState)(0),[N,W]=(0,p.useState)(400),q=(0,p.useRef)(null),F=(0,p.useRef)(null),z=(0,p.useRef)(0),[J,Z]=(0,p.useState)(rm),Q=a?B:f,G=a&&c==="auto",be=(0,p.useMemo)(()=>e.split(`
|
|
63
|
+
`),[e]),ve=(0,p.useMemo)(()=>XJ(be,Q,J),[J,Q,be]),X=be.length,Y=ve[Math.min(Math.max(A-1,0),X-1)],ie=Y?.top??0,ne=Y?.height??yi,ee=!a,Be=ie-O+dS,de=(0,p.useCallback)(()=>{const ae=a?y.current:g.current;if(!Q||!ae)return;const je=QJ(ae);Z(Le=>Le===je?Le:je)},[Q,a]),Re=$J({count:X,getScrollElement:()=>a?v.current:C.current,estimateSize:ae=>ve[ae]?.height??yi,overscan:20}),{highlightedHtml:Ee,paddingTop:st}=ZJ(e,O,N,ee,ve),at=(0,p.useMemo)(()=>a?"":ee?Ee:ik(e),[e,a,ee,Ee]),Bt=ee?st:0,tt=(0,p.useRef)(0);tt.current=Bt;const pt=(0,p.useRef)(0);pt.current=ie;const Lt=(0,p.useCallback)(()=>{if(g.current){const ae=g.current.scrollTop,je=g.current.scrollLeft;C.current&&(C.current.scrollTop=ae),q.current&&(q.current.style.transform=`translate(${-je}px, ${tt.current-ae}px)`),F.current&&(F.current.style.transform=`translateY(${pt.current-ae+dS}px)`),cancelAnimationFrame(z.current),z.current=requestAnimationFrame(()=>{R(ae),_(je)})}},[]),mt=(0,p.useCallback)(()=>{if(g.current&&n){const ae=JJ(g.current);n(ae),x(ae.line)}},[n]),lt=(0,p.useCallback)(ae=>{const je=ae.currentTarget,{selectionStart:Le,selectionEnd:zn,value:_t}=je;if((ae.ctrlKey||ae.metaKey)&&ae.key==="z"&&!ae.shiftKey){ae.preventDefault(),r?.();return}if((ae.ctrlKey||ae.metaKey)&&ae.shiftKey&&ae.key==="z"||ae.ctrlKey&&ae.key==="y"){ae.preventDefault(),s?.();return}if(ae.key==="Escape"&&i){ae.preventDefault(),i();return}if(ae.key==="Tab"){ae.preventDefault();const Vt=" ";if(ae.shiftKey){const Bn=_t.lastIndexOf(`
|
|
64
|
+
`,Le-1)+1;if(_t.substring(Bn,Le).startsWith(Vt)){const An=_t.substring(0,Bn)+_t.substring(Bn+2);t?.(An),requestAnimationFrame(()=>{je.selectionStart=je.selectionEnd=Le-2})}}else{const Bn=_t.substring(0,Le)+Vt+_t.substring(zn);t?.(Bn),requestAnimationFrame(()=>{je.selectionStart=je.selectionEnd=Le+2})}return}if(ae.key==="Enter"){ae.preventDefault();const Vt=_t.lastIndexOf(`
|
|
65
|
+
`,Le-1)+1,Bn=_t.substring(Vt,Le).match(/^(\s*)/)?.[1]||"",An=_t[Le-1],gs=_t[Le],Ge=An==="{"||An==="[",Cs=gs==="}"||gs==="]";let Kt=`
|
|
66
|
+
`+Bn,vs=Kt.length;Ge&&(Kt=`
|
|
67
|
+
`+Bn+" ",vs=Kt.length,Cs&&(Kt+=`
|
|
68
|
+
`+Bn));const Qe=_t.substring(0,Le)+Kt+_t.substring(zn);t?.(Qe),requestAnimationFrame(()=>{je.selectionStart=je.selectionEnd=Le+vs})}},[t,r,s,i]);(0,p.useEffect)(()=>{a||g.current?.focus()},[a]),(0,p.useEffect)(()=>{const ae=()=>{S.current&&W(S.current.clientHeight)};return ae(),window.addEventListener("resize",ae),()=>window.removeEventListener("resize",ae)},[]),(0,p.useEffect)(()=>()=>cancelAnimationFrame(z.current),[]),(0,p.useEffect)(()=>{A>X&&x(X)},[A,X]),(0,p.useEffect)(()=>{Re.measure()},[ve,Re]),(0,p.useEffect)(()=>{if(!Q)return;de(),window.addEventListener("resize",de);let ae;const je=a?y.current:g.current;return window.ResizeObserver&&je&&(ae=new ResizeObserver(()=>de()),ae.observe(je)),()=>{window.removeEventListener("resize",de),ae?.disconnect()}},[Q,a,de]);const Un={height:c??"auto",maxHeight:u??"none"},it={fontFamily:"var(--font-code)"};return(0,m.jsxs)("div",{ref:S,className:he("group relative flex w-full overflow-hidden bg-muted/30",!o&&"border-destructive",l),style:Un,children:[d&&!a&&(0,m.jsx)("div",{ref:C,className:"flex-shrink-0 h-full overflow-hidden bg-muted/50 text-right select-none border-r border-border/50",style:{width:"3rem"},children:(0,m.jsx)("div",{className:"py-3 pr-2 text-xs text-muted-foreground leading-5 relative",style:{...it,height:`${Re.getTotalSize()}px`},children:Re.getVirtualItems().map(ae=>{const je=ae.index+1,Le=ve[ae.index]?.height??yi;return(0,m.jsx)("div",{className:he("leading-5 transition-colors duration-150 absolute left-0 right-0 pr-2",je===A&&E&&"text-foreground font-medium"),style:{transform:`translateY(${ae.start}px)`,height:`${Le}px`},children:je},ae.index)})})}),(0,m.jsx)("div",{className:he("relative flex-1 min-w-0",G?"overflow-visible":"h-full overflow-hidden"),children:a?(0,m.jsxs)("div",{ref:v,className:he("relative z-10 flex min-w-0 items-start",G?"h-auto overflow-visible":"h-full min-h-0 overflow-auto overscroll-none"),children:[d&&(0,m.jsx)("div",{ref:C,className:he("flex-shrink-0 border-r border-border/50 bg-muted/50 text-right select-none self-stretch",!G&&"sticky left-0 z-20"),style:{width:"3rem"},children:(0,m.jsx)("div",{className:"py-3 pr-2 text-xs text-muted-foreground leading-5 relative",style:{...it,height:`${Re.getTotalSize()}px`},children:Re.getVirtualItems().map(ae=>{const je=ae.index+1,Le=ve[ae.index]?.height??yi;return(0,m.jsx)("div",{className:"leading-5 transition-colors duration-150 absolute left-0 right-0 pr-2",style:{transform:`translateY(${ae.start}px)`,height:`${Le}px`},children:je},ae.index)})})}),(0,m.jsx)("div",{className:he("relative self-start overflow-visible",Q?"flex-1 min-w-0":"w-max min-w-full"),children:(0,m.jsx)("pre",{ref:y,className:he("p-3 text-xs leading-5 m-0 select-text cursor-text",Q?"w-full whitespace-pre-wrap break-words":"w-max min-w-full whitespace-pre"),style:it,children:(0,m.jsx)(qJ,{content:e,collapseStringsAfterLength:h})})})]}):(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)("pre",{ref:y,className:he("absolute inset-0 p-3 text-xs leading-5 overflow-hidden",Q?"whitespace-pre-wrap break-words":"whitespace-pre","pointer-events-none m-0","text-muted-foreground"),style:{...it,scrollbarGutter:"stable"},"aria-hidden":"true",children:(0,m.jsx)("div",{ref:q,style:{transform:`translate(${-P}px, ${Bt-O}px)`,willChange:"transform"},children:(0,m.jsx)("div",{dangerouslySetInnerHTML:{__html:at+`
|
|
69
|
+
`}})})}),E&&(0,m.jsx)("div",{ref:F,className:"absolute left-0 right-0 bg-foreground/[0.03] pointer-events-none",style:{height:`${ne}px`,transform:`translateY(${Be}px)`}}),(0,m.jsx)("textarea",{ref:g,value:e,wrap:Q?"soft":"off",onChange:ae=>t?.(ae.target.value),onScroll:Lt,onSelect:mt,onClick:mt,onKeyDown:lt,onKeyUp:mt,onFocus:()=>D(!0),onBlur:()=>D(!1),spellCheck:!1,className:he("absolute inset-0 z-10 w-full h-full resize-none bg-transparent p-3 text-xs leading-5","focus:outline-none","text-transparent caret-foreground","selection:bg-primary/20",Q?"overflow-auto whitespace-pre-wrap break-words":"overflow-auto whitespace-pre"),style:{...it,tabSize:2,scrollbarGutter:"stable"}})]})})]})}var hS=100;function e9(e){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1}function lk(e,t){const n=Math.min(t,hS),r=[],s=[{value:e,path:"root",depth:0}];for(;s.length>0;){const i=s.pop();if(typeof i.value!="object"||i.value===null)continue;if(i.depth>=hS){i.depth>=n&&e9(i.value)&&r.push(i.path);continue}const o=Object.entries(i.value);if(o.length!==0){i.depth>=n&&r.push(i.path);for(const[a,l]of o)s.push({value:l,path:`${i.path}.${a}`,depth:i.depth+1})}}return r}function t9(e){return lk(e,0)}function n9({value:e,defaultExpandDepth:t,initialCollapsedPaths:n,onCollapseChange:r}={}){const[s]=(0,p.useState)(()=>n!==void 0||t===void 0?null:new Set(lk(e,t))),[i,o]=(0,p.useState)(()=>s??n??new Set),a=(0,p.useCallback)(h=>i.has(h),[i]),l=(0,p.useCallback)(h=>{o(f=>{const B=new Set(f);return B.has(h)?B.delete(h):B.add(h),r?.(B),B})},[r]),c=(0,p.useCallback)(()=>{o(new Set),r?.(new Set)},[r]),u=(0,p.useCallback)(h=>{const f=t9(h),B=new Set(f);o(B),r?.(B)},[r]),d=(0,p.useRef)(!1);return(0,p.useEffect)(()=>{d.current||s===null||(d.current=!0,r?.(s))},[s,r]),(0,p.useEffect)(()=>{n!==void 0&&o(n)},[n]),(0,p.useMemo)(()=>({collapsedPaths:i,isCollapsed:a,toggleCollapse:l,expandAll:c,collapseAll:u}),[i,a,l,c,u])}var Yc=50,r9=100,s9=typeof requestIdleCallback<"u"?requestIdleCallback:(e,t)=>{const n=Date.now();return setTimeout(()=>{e({didTimeout:t?.timeout?Date.now()-n>=t.timeout:!1,timeRemaining:()=>Math.max(0,50-(Date.now()-n))})},1)},i9=typeof cancelIdleCallback<"u"?cancelIdleCallback:clearTimeout;function ck(e,t){const[n,r]=(0,p.useState)(e.length<=Yc?e.length:Yc);return(0,p.useEffect)(()=>{if(!t){r(Math.min(e.length,Yc));return}r(s=>s>e.length?Math.min(e.length,Yc):s)},[e.length,t]),(0,p.useEffect)(()=>{if(!t||n>=e.length)return;const s=s9(()=>{r(i=>Math.min(i+r9,e.length))},{timeout:100});return()=>i9(s)},[e.length,n,t]),e.slice(0,n)}var kr=(0,p.memo)(function({children:t,value:n,onCopy:r,alwaysVisible:s=!1}){const[i,o]=(0,p.useState)(!1),[a,l]=(0,p.useState)(!1),c=(0,p.useCallback)(async u=>{u.stopPropagation();let d;try{d=typeof n=="function"?n():n}catch(h){console.error("Failed to serialize value for copy",h);return}await ra(d)&&(o(!0),r?.(d),setTimeout(()=>o(!1),1500))},[n,r]);return(0,m.jsxs)("span",{className:"relative group/copy",onMouseEnter:()=>l(!0),onMouseLeave:()=>l(!1),children:[t,(0,m.jsx)("button",{onClick:c,className:he("inline-flex items-center justify-center ml-1 p-0.5 rounded","transition-all duration-150","hover:bg-muted",s||a||i?"opacity-100":"opacity-0"),style:{verticalAlign:"middle"},children:i?(0,m.jsx)(Vs,{className:"h-3 w-3 text-green-500"}):(0,m.jsx)(_s,{className:"h-3 w-3 text-muted-foreground/60 hover:text-muted-foreground"})})]})});function o9({value:e,path:t,keyName:n,isLast:r=!0,depth:s=0,isCollapsed:i,toggleCollapse:o,collapseStringsAfterLength:a,onCopy:l}){const c=s*16,u=i(t),d=ck(e,!u),h=(0,p.useCallback)(()=>JSON.stringify(e,null,2),[e]),f=()=>n===void 0?null:(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)("span",{className:"json-key",children:['"',n,'"']}),(0,m.jsx)("span",{className:"json-punctuation",children:": "})]}),B=()=>r?null:(0,m.jsx)("span",{className:"json-punctuation",children:","});if(e.length===0)return(0,m.jsxs)("div",{className:"leading-5",style:{paddingLeft:c},children:[f(),(0,m.jsx)(kr,{value:"[]",onCopy:l,alwaysVisible:!0,children:(0,m.jsx)("span",{className:"json-punctuation",children:"[]"})}),B()]});const g=C=>{C.stopPropagation(),o(t)};return u?(0,m.jsxs)("div",{className:"leading-5",style:{paddingLeft:c},children:[(0,m.jsx)("button",{onClick:g,className:"json-collapse-toggle inline-flex items-center justify-center w-4 h-4 -ml-4 hover:bg-muted rounded","data-state":"closed",children:(0,m.jsx)(Mo,{className:"h-3 w-3"})}),f(),(0,m.jsxs)(kr,{value:h,onCopy:l,alwaysVisible:!0,children:[(0,m.jsx)("span",{className:"json-punctuation",children:"["}),(0,m.jsxs)("span",{className:"text-muted-foreground text-xs px-1",children:[e.length," ",e.length===1?"item":"items"]}),(0,m.jsx)("span",{className:"json-punctuation",children:"]"})]}),B()]}):(0,m.jsxs)(p.Fragment,{children:[(0,m.jsxs)("div",{className:"leading-5",style:{paddingLeft:c},children:[(0,m.jsx)("button",{onClick:g,className:"json-collapse-toggle inline-flex items-center justify-center w-4 h-4 -ml-4 hover:bg-muted rounded","data-state":"open",children:(0,m.jsx)(Mo,{className:"h-3 w-3"})}),f(),(0,m.jsx)(kr,{value:h,onCopy:l,alwaysVisible:!0,children:(0,m.jsx)("span",{className:"json-punctuation",children:"["})})]}),d.map((C,v)=>(0,m.jsx)(nv,{value:C,path:`${t}.${v}`,isLast:v===e.length-1&&d.length===e.length,depth:s+1,isCollapsed:i,toggleCollapse:o,collapseStringsAfterLength:a,onCopy:l},`${t}.${v}`)),d.length<e.length&&(0,m.jsxs)("div",{className:"leading-5 text-muted-foreground text-xs",style:{paddingLeft:(s+1)*16},children:["Loading ",e.length-d.length," more items..."]}),(0,m.jsxs)("div",{className:"leading-5",style:{paddingLeft:c},children:[(0,m.jsx)("span",{className:"json-punctuation",children:"]"}),B()]})]})}function a9({value:e,path:t,keyName:n,isLast:r=!0,depth:s=0,isCollapsed:i,toggleCollapse:o,collapseStringsAfterLength:a,onCopy:l}){const c=s*16,u=i(t),d=Object.entries(e),h=ck(d,!u),f=(0,p.useCallback)(()=>JSON.stringify(e,null,2),[e]),B=()=>n===void 0?null:(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)("span",{className:"json-key",children:['"',n,'"']}),(0,m.jsx)("span",{className:"json-punctuation",children:": "})]}),g=()=>r?null:(0,m.jsx)("span",{className:"json-punctuation",children:","});if(d.length===0)return(0,m.jsxs)("div",{className:"leading-5",style:{paddingLeft:c},children:[B(),(0,m.jsx)(kr,{value:"{}",onCopy:l,alwaysVisible:!0,children:(0,m.jsx)("span",{className:"json-punctuation",children:"{}"})}),g()]});const C=v=>{v.stopPropagation(),o(t)};return u?(0,m.jsxs)("div",{className:"leading-5",style:{paddingLeft:c},children:[(0,m.jsx)("button",{onClick:C,className:"json-collapse-toggle inline-flex items-center justify-center w-4 h-4 -ml-4 hover:bg-muted rounded","data-state":"closed",children:(0,m.jsx)(Mo,{className:"h-3 w-3"})}),B(),(0,m.jsxs)(kr,{value:f,onCopy:l,alwaysVisible:!0,children:[(0,m.jsx)("span",{className:"json-punctuation",children:"{"}),(0,m.jsxs)("span",{className:"text-muted-foreground text-xs px-1",children:[d.length," ",d.length===1?"key":"keys"]}),(0,m.jsx)("span",{className:"json-punctuation",children:"}"})]}),g()]}):(0,m.jsxs)(p.Fragment,{children:[(0,m.jsxs)("div",{className:"leading-5",style:{paddingLeft:c},children:[(0,m.jsx)("button",{onClick:C,className:"json-collapse-toggle inline-flex items-center justify-center w-4 h-4 -ml-4 hover:bg-muted rounded","data-state":"open",children:(0,m.jsx)(Mo,{className:"h-3 w-3"})}),B(),(0,m.jsx)(kr,{value:f,onCopy:l,alwaysVisible:!0,children:(0,m.jsx)("span",{className:"json-punctuation",children:"{"})})]}),h.map(([v,y],S)=>(0,m.jsx)(nv,{value:y,path:`${t}.${v}`,keyName:v,isLast:S===d.length-1&&h.length===d.length,depth:s+1,isCollapsed:i,toggleCollapse:o,collapseStringsAfterLength:a,onCopy:l},`${t}.${v}`)),h.length<d.length&&(0,m.jsxs)("div",{className:"leading-5 text-muted-foreground text-xs",style:{paddingLeft:(s+1)*16},children:["Loading ",d.length-h.length," more keys..."]}),(0,m.jsxs)("div",{className:"leading-5",style:{paddingLeft:c},children:[(0,m.jsx)("span",{className:"json-punctuation",children:"}"}),g()]})]})}function l9({value:e,path:t,keyName:n,isLast:r=!0,depth:s=0,isCollapsed:i,toggleCollapse:o,collapseStringsAfterLength:a,onCopy:l}){const c=s*16,u=()=>{if(e===null)return(0,m.jsx)(kr,{value:"null",onCopy:l,children:(0,m.jsx)("span",{className:"json-null",children:"null"})});if(typeof e=="boolean")return(0,m.jsx)(kr,{value:String(e),onCopy:l,children:(0,m.jsx)("span",{className:e?"json-boolean":"json-boolean-false",children:String(e)})});if(typeof e=="number")return(0,m.jsx)(kr,{value:String(e),onCopy:l,children:(0,m.jsx)("span",{className:"json-number",children:String(e)})});if(typeof e=="string"){const f=JSON.stringify(e);return a!==void 0?(0,m.jsx)(ok,{value:e,displayValue:f,maxLength:a,onCopy:l}):(0,m.jsx)(kr,{value:e,onCopy:l,children:(0,m.jsx)("span",{className:"json-string",children:f})})}return null},d=()=>n===void 0?null:(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)("span",{className:"json-key",children:['"',n,'"']}),(0,m.jsx)("span",{className:"json-punctuation",children:": "})]}),h=()=>r?null:(0,m.jsx)("span",{className:"json-punctuation",children:","});return e===null||typeof e=="boolean"||typeof e=="number"||typeof e=="string"?(0,m.jsxs)("div",{className:"leading-5",style:{paddingLeft:c},children:[d(),u(),h()]}):Array.isArray(e)?(0,m.jsx)(o9,{value:e,path:t,keyName:n,isLast:r,depth:s,isCollapsed:i,toggleCollapse:o,collapseStringsAfterLength:a,onCopy:l}):typeof e=="object"?(0,m.jsx)(a9,{value:e,path:t,keyName:n,isLast:r,depth:s,isCollapsed:i,toggleCollapse:o,collapseStringsAfterLength:a,onCopy:l}):(0,m.jsxs)("div",{className:"leading-5",style:{paddingLeft:c},children:[d(),(0,m.jsx)("span",{className:"text-muted-foreground",children:"undefined"}),h()]})}function c9(e,t){return!(e.value!==t.value||e.path!==t.path||e.keyName!==t.keyName||e.isLast!==t.isLast||e.depth!==t.depth||e.collapseStringsAfterLength!==t.collapseStringsAfterLength||e.isCollapsed!==t.isCollapsed)}var nv=(0,p.memo)(l9,c9);function u9({value:e,className:t,height:n,maxHeight:r,defaultExpandDepth:s,collapsedPaths:i,onCollapseChange:o,collapseStringsAfterLength:a,onCopy:l}){const{isCollapsed:c,toggleCollapse:u}=n9({value:e,defaultExpandDepth:s,initialCollapsedPaths:i,onCollapseChange:o});return(0,m.jsx)("div",{className:he("p-3 text-xs overflow-auto select-text cursor-text",t,"pl-7"),style:{fontFamily:"var(--font-code)",...n!=null?{height:n}:{},...r!=null?{maxHeight:r}:{}},children:(0,m.jsx)(nv,{value:e,path:"root",isCollapsed:c,toggleCollapse:u,collapseStringsAfterLength:a,onCopy:l})})}function sm({value:e,className:t,height:n,maxHeight:r,showLineNumbers:s=!0,collapseStringsAfterLength:i,wrapLongLinesInView:o=!0,collapsible:a=!1,defaultExpandDepth:l,collapsedPaths:c,onCollapseChange:u}){const d=(0,p.useMemo)(()=>{if(e==null)return"null";try{return JSON.stringify(e,null,2)}catch{return String(e)}},[e]);return a?(0,m.jsx)(u9,{value:e,className:t,height:n??"100%",maxHeight:r,defaultExpandDepth:l,collapsedPaths:c,onCollapseChange:u,collapseStringsAfterLength:i}):(0,m.jsx)(ak,{content:d,readOnly:!0,className:t,height:n??"100%",maxHeight:r,showLineNumbers:s,collapseStringsAfterLength:i,wrapLongLinesInView:o})}var uk=1024,d9=0,rB=class{constructor(e,t){this.from=e,this.to=t}},ke=class{constructor(e={}){this.id=d9++,this.perNode=!!e.perNode,this.deserialize=e.deserialize||(()=>{throw new Error("This node type doesn't define a deserialize function")}),this.combine=e.combine||null}add(e){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return typeof e!="function"&&(e=jn.match(e)),t=>{let n=e(t);return n===void 0?null:[this,n]}}};ke.closedBy=new ke({deserialize:e=>e.split(" ")});ke.openedBy=new ke({deserialize:e=>e.split(" ")});ke.group=new ke({deserialize:e=>e.split(" ")});ke.isolate=new ke({deserialize:e=>{if(e&&e!="rtl"&&e!="ltr"&&e!="auto")throw new RangeError("Invalid value for isolate: "+e);return e||"auto"}});ke.contextHash=new ke({perNode:!0});ke.lookAhead=new ke({perNode:!0});ke.mounted=new ke({perNode:!0});var rl=class{constructor(e,t,n,r=!1){this.tree=e,this.overlay=t,this.parser=n,this.bracketed=r}static get(e){return e&&e.props&&e.props[ke.mounted.id]}},h9=Object.create(null),jn=class dk{constructor(t,n,r,s=0){this.name=t,this.props=n,this.id=r,this.flags=s}static define(t){let n=t.props&&t.props.length?Object.create(null):h9,r=(t.top?1:0)|(t.skipped?2:0)|(t.error?4:0)|(t.name==null?8:0),s=new dk(t.name||"",n,t.id,r);if(t.props){for(let i of t.props)if(Array.isArray(i)||(i=i(s)),i){if(i[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");n[i[0].id]=i[1]}}return s}prop(t){return this.props[t.id]}get isTop(){return(this.flags&1)>0}get isSkipped(){return(this.flags&2)>0}get isError(){return(this.flags&4)>0}get isAnonymous(){return(this.flags&8)>0}is(t){if(typeof t=="string"){if(this.name==t)return!0;let n=this.prop(ke.group);return n?n.indexOf(t)>-1:!1}return this.id==t}static match(t){let n=Object.create(null);for(let r in t)for(let s of r.split(" "))n[s]=t[r];return r=>{for(let s=r.prop(ke.group),i=-1;i<(s?s.length:0);i++){let o=n[i<0?r.name:s[i]];if(o)return o}}}};jn.none=new jn("",Object.create(null),0,8);var f9=class hk{constructor(t){this.types=t;for(let n=0;n<t.length;n++)if(t[n].id!=n)throw new RangeError("Node type ids should correspond to array positions when creating a node set")}extend(...t){let n=[];for(let r of this.types){let s=null;for(let i of t){let o=i(r);if(o){s||(s=Object.assign({},r.props));let a=o[1],l=o[0];l.combine&&l.id in s&&(a=l.combine(s[l.id],a)),s[l.id]=a}}n.push(s?new jn(r.name,s,r.id,r.flags):r)}return new hk(n)}},Xc=new WeakMap,fS=new WeakMap,ut;(function(e){e[e.ExcludeBuffers=1]="ExcludeBuffers",e[e.IncludeAnonymous=2]="IncludeAnonymous",e[e.IgnoreMounts=4]="IgnoreMounts",e[e.IgnoreOverlays=8]="IgnoreOverlays",e[e.EnterBracketed=16]="EnterBracketed"})(ut||(ut={}));var Pt=class im{constructor(t,n,r,s,i){if(this.type=t,this.children=n,this.positions=r,this.length=s,this.props=null,i&&i.length){this.props=Object.create(null);for(let[o,a]of i)this.props[typeof o=="number"?o:o.id]=a}}toString(){let t=rl.get(this);if(t&&!t.overlay)return t.tree.toString();let n="";for(let r of this.children){let s=r.toString();s&&(n&&(n+=","),n+=s)}return this.type.name?(/\W/.test(this.type.name)&&!this.type.isError?JSON.stringify(this.type.name):this.type.name)+(n.length?"("+n+")":""):n}cursor(t=0){return new lm(this.topNode,t)}cursorAt(t,n=0,r=0){let s=Xc.get(this)||this.topNode,i=new lm(s);return i.moveTo(t,n),Xc.set(this,i._tree),i}get topNode(){return new $s(this,0,0,null)}resolve(t,n=0){let r=Nl(Xc.get(this)||this.topNode,t,n,!1);return Xc.set(this,r),r}resolveInner(t,n=0){let r=Nl(fS.get(this)||this.topNode,t,n,!0);return fS.set(this,r),r}resolveStack(t,n=0){return g9(this,t,n)}iterate(t){let{enter:n,leave:r,from:s=0,to:i=this.length}=t,o=t.mode||0,a=(o&ut.IncludeAnonymous)>0;for(let l=this.cursor(o|ut.IncludeAnonymous);;){let c=!1;if(l.from<=i&&l.to>=s&&(!a&&l.type.isAnonymous||n(l)!==!1)){if(l.firstChild())continue;c=!0}for(;c&&r&&(a||!l.type.isAnonymous)&&r(l),!l.nextSibling();){if(!l.parent())return;c=!0}}}prop(t){return t.perNode?this.props?this.props[t.id]:void 0:this.type.prop(t)}get propValues(){let t=[];if(this.props)for(let n in this.props)t.push([+n,this.props[n]]);return t}balance(t={}){return this.children.length<=8?this:sv(jn.none,this.children,this.positions,0,this.children.length,0,this.length,(n,r,s)=>new im(this.type,n,r,s,this.propValues),t.makeTree||((n,r,s)=>new im(jn.none,n,r,s)))}static build(t){return C9(t)}};Pt.empty=new Pt(jn.none,[],[],0);var B9=class fk{constructor(t,n){this.buffer=t,this.index=n}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}get pos(){return this.index}next(){this.index-=4}fork(){return new fk(this.buffer,this.index)}},Go=class Bk{constructor(t,n,r){this.buffer=t,this.length=n,this.set=r}get type(){return jn.none}toString(){let t=[];for(let n=0;n<this.buffer.length;)t.push(this.childString(n)),n=this.buffer[n+3];return t.join(",")}childString(t){let n=this.buffer[t],r=this.buffer[t+3],s=this.set.types[n],i=s.name;if(/\W/.test(i)&&!s.isError&&(i=JSON.stringify(i)),t+=4,r==t)return i;let o=[];for(;t<r;)o.push(this.childString(t)),t=this.buffer[t+3];return i+"("+o.join(",")+")"}findChild(t,n,r,s,i){let{buffer:o}=this,a=-1;for(let l=t;l!=n&&!(pk(i,s,o[l+1],o[l+2])&&(a=l,r>0));l=o[l+3]);return a}slice(t,n,r){let s=this.buffer,i=new Uint16Array(n-t),o=0;for(let a=t,l=0;a<n;){i[l++]=s[a++],i[l++]=s[a++]-r;let c=i[l++]=s[a++]-r;i[l++]=s[a++]-t,o=Math.max(o,c)}return new Bk(i,o,this.set)}};function pk(e,t,n,r){switch(e){case-2:return n<t;case-1:return r>=t&&n<t;case 0:return n<t&&r>t;case 1:return n<=t&&r>t;case 2:return r>t;case 4:return!0}}function Nl(e,t,n,r){for(var s;e.from==e.to||(n<1?e.from>=t:e.from>t)||(n>-1?e.to<=t:e.to<t);){let o=!r&&e instanceof $s&&e.index<0?null:e.parent;if(!o)return e;e=o}let i=r?0:ut.IgnoreOverlays;if(r)for(let o=e,a=o.parent;a;o=a,a=o.parent)o instanceof $s&&o.index<0&&((s=a.enter(t,n,i))===null||s===void 0?void 0:s.from)!=o.from&&(e=a);for(;;){let o=e.enter(t,n,i);if(!o)return e;e=o}}var mk=class{cursor(e=0){return new lm(this,e)}getChild(e,t=null,n=null){let r=BS(this,e,t,n);return r.length?r[0]:null}getChildren(e,t=null,n=null){return BS(this,e,t,n)}resolve(e,t=0){return Nl(this,e,t,!1)}resolveInner(e,t=0){return Nl(this,e,t,!0)}matchContext(e){return om(this.parent,e)}enterUnfinishedNodesBefore(e){let t=this.childBefore(e),n=this;for(;t;){let r=t.lastChild;if(!r||r.to!=t.to)break;r.type.isError&&r.from==r.to?(n=t,t=r.prevSibling):t=r}return n}get node(){return this}get next(){return this.parent}},$s=class Uu extends mk{constructor(t,n,r,s){super(),this._tree=t,this.from=n,this.index=r,this._parent=s}get type(){return this._tree.type}get name(){return this._tree.type.name}get to(){return this.from+this._tree.length}nextChild(t,n,r,s,i=0){for(let o=this;;){for(let{children:a,positions:l}=o._tree,c=n>0?a.length:-1;t!=c;t+=n){let u=a[t],d=l[t]+o.from,h;if(!(!(i&ut.EnterBracketed&&u instanceof Pt&&(h=rl.get(u))&&!h.overlay&&h.bracketed&&r>=d&&r<=d+u.length)&&!pk(s,r,d,d+u.length))){if(u instanceof Go){if(i&ut.ExcludeBuffers)continue;let f=u.findChild(0,u.buffer.length,n,r-d,s);if(f>-1)return new am(new p9(o,u,t,d),null,f)}else if(i&ut.IncludeAnonymous||!u.type.isAnonymous||rv(u)){let f;if(!(i&ut.IgnoreMounts)&&(f=rl.get(u))&&!f.overlay)return new Uu(f.tree,d,t,o);let B=new Uu(u,d,t,o);return i&ut.IncludeAnonymous||!B.type.isAnonymous?B:B.nextChild(n<0?u.children.length-1:0,n,r,s,i)}}}if(i&ut.IncludeAnonymous||!o.type.isAnonymous||(o.index>=0?t=o.index+n:t=n<0?-1:o._parent._tree.children.length,o=o._parent,!o))return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(t){return this.nextChild(0,1,t,2)}childBefore(t){return this.nextChild(this._tree.children.length-1,-1,t,-2)}prop(t){return this._tree.prop(t)}enter(t,n,r=0){let s;if(!(r&ut.IgnoreOverlays)&&(s=rl.get(this._tree))&&s.overlay){let i=t-this.from,o=r&ut.EnterBracketed&&s.bracketed;for(let{from:a,to:l}of s.overlay)if((n>0||o?a<=i:a<i)&&(n<0||o?l>=i:l>i))return new Uu(s.tree,s.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,t,n,r)}nextSignificantParent(){let t=this;for(;t.type.isAnonymous&&t._parent;)t=t._parent;return t}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}get tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}};function BS(e,t,n,r){let s=e.cursor(),i=[];if(!s.firstChild())return i;if(n!=null){for(let o=!1;!o;)if(o=s.type.is(n),!s.nextSibling())return i}for(;;){if(r!=null&&s.type.is(r))return i;if(s.type.is(t)&&i.push(s.node),!s.nextSibling())return r==null?i:[]}}function om(e,t,n=t.length-1){for(let r=e;n>=0;r=r.parent){if(!r)return!1;if(!r.type.isAnonymous){if(t[n]&&t[n]!=r.name)return!1;n--}}return!0}var p9=class{constructor(e,t,n,r){this.parent=e,this.buffer=t,this.index=n,this.start=r}},am=class Na extends mk{get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(t,n,r){super(),this.context=t,this._parent=n,this.index=r,this.type=t.buffer.set.types[t.buffer.buffer[r]]}child(t,n,r){let{buffer:s}=this.context,i=s.findChild(this.index+4,s.buffer[this.index+3],t,n-this.context.start,r);return i<0?null:new Na(this.context,this,i)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(t){return this.child(1,t,2)}childBefore(t){return this.child(-1,t,-2)}prop(t){return this.type.prop(t)}enter(t,n,r=0){if(r&ut.ExcludeBuffers)return null;let{buffer:s}=this.context,i=s.findChild(this.index+4,s.buffer[this.index+3],n>0?1:-1,t-this.context.start,n);return i<0?null:new Na(this.context,this,i)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(t){return this._parent?null:this.context.parent.nextChild(this.context.index+t,t,0,4)}get nextSibling(){let{buffer:t}=this.context,n=t.buffer[this.index+3];return n<(this._parent?t.buffer[this._parent.index+3]:t.buffer.length)?new Na(this.context,this._parent,n):this.externalSibling(1)}get prevSibling(){let{buffer:t}=this.context,n=this._parent?this._parent.index+4:0;return this.index==n?this.externalSibling(-1):new Na(this.context,this._parent,t.findChild(n,this.index,-1,0,4))}get tree(){return null}toTree(){let t=[],n=[],{buffer:r}=this.context,s=this.index+4,i=r.buffer[this.index+3];if(i>s){let o=r.buffer[this.index+1];t.push(r.slice(s,i,o)),n.push(0)}return new Pt(this.type,t,n,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}};function gk(e){if(!e.length)return null;let t=0,n=e[0];for(let i=1;i<e.length;i++){let o=e[i];(o.from>n.from||o.to<n.to)&&(n=o,t=i)}let r=n instanceof $s&&n.index<0?null:n.parent,s=e.slice();return r?s[t]=r:s.splice(t,1),new m9(s,n)}var m9=class{constructor(e,t){this.heads=e,this.node=t}get next(){return gk(this.heads)}};function g9(e,t,n){let r=e.resolveInner(t,n),s=null;for(let i=r instanceof $s?r:r.context.parent;i;i=i.parent)if(i.index<0){let o=i.parent;(s||(s=[r])).push(o.resolve(t,n)),i=o}else{let o=rl.get(i.tree);if(o&&o.overlay&&o.overlay[0].from<=t&&o.overlay[o.overlay.length-1].to>=t){let a=new $s(o.tree,o.overlay[0].from+i.from,-1,i);(s||(s=[r])).push(Nl(a,t,n,!1))}}return s?gk(s):r}var lm=class{get name(){return this.type.name}constructor(e,t=0){if(this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,this.mode=t&~ut.EnterBracketed,e instanceof $s)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(let n=e._parent;n;n=n._parent)this.stack.unshift(n.index);this.bufferNode=e,this.yieldBuf(e.index)}}yieldNode(e){return e?(this._tree=e,this.type=e.type,this.from=e.from,this.to=e.to,!0):!1}yieldBuf(e,t){this.index=e;let{start:n,buffer:r}=this.buffer;return this.type=t||r.set.types[r.buffer[e]],this.from=n+r.buffer[e+1],this.to=n+r.buffer[e+2],!0}yield(e){return e?e instanceof $s?(this.buffer=null,this.yieldNode(e)):(this.buffer=e.context,this.yieldBuf(e.index,e.type)):!1}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(e,t,n){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,t,n,this.mode));let{buffer:r}=this.buffer,s=r.findChild(this.index+4,r.buffer[this.index+3],e,t-this.buffer.start,n);return s<0?!1:(this.stack.push(this.index),this.yieldBuf(s))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(e){return this.enterChild(1,e,2)}childBefore(e){return this.enterChild(-1,e,-2)}enter(e,t,n=this.mode){return this.buffer?n&ut.ExcludeBuffers?!1:this.enterChild(1,e,t):this.yield(this._tree.enter(e,t,n))}parent(){if(!this.buffer)return this.yieldNode(this.mode&ut.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&ut.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(e)}sibling(e){if(!this.buffer)return this._tree._parent?this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+e,e,0,4,this.mode)):!1;let{buffer:t}=this.buffer,n=this.stack.length-1;if(e<0){let r=n<0?0:this.stack[n]+4;if(this.index!=r)return this.yieldBuf(t.findChild(r,this.index,-1,0,4))}else{let r=t.buffer[this.index+3];if(r<(n<0?t.buffer.length:t.buffer[this.stack[n]+3]))return this.yieldBuf(r)}return n<0?this.yield(this.buffer.parent.nextChild(this.buffer.index+e,e,0,4,this.mode)):!1}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(e){let t,n,{buffer:r}=this;if(r){if(e>0){if(this.index<r.buffer.buffer.length)return!1}else for(let s=0;s<this.index;s++)if(r.buffer.buffer[s+3]<this.index)return!1;({index:t,parent:n}=r)}else({index:t,_parent:n}=this._tree);for(;n;{index:t,_parent:n}=n)if(t>-1)for(let s=t+e,i=e<0?-1:n._tree.children.length;s!=i;s+=e){let o=n._tree.children[s];if(this.mode&ut.IncludeAnonymous||o instanceof Go||!o.type.isAnonymous||rv(o))return!1}return!0}move(e,t){if(t&&this.enterChild(e,0,4))return!0;for(;;){if(this.sibling(e))return!0;if(this.atLastNode(e)||!this.parent())return!1}}next(e=!0){return this.move(1,e)}prev(e=!0){return this.move(-1,e)}moveTo(e,t=0){for(;(this.from==this.to||(t<1?this.from>=e:this.from>e)||(t>-1?this.to<=e:this.to<e))&&this.parent(););for(;this.enterChild(1,e,t););return this}get node(){if(!this.buffer)return this._tree;let e=this.bufferNode,t=null,n=0;if(e&&e.context==this.buffer)e:for(let r=this.index,s=this.stack.length;s>=0;){for(let i=e;i;i=i._parent)if(i.index==r){if(r==this.index)return i;t=i,n=s+1;break e}r=this.stack[--s]}for(let r=n;r<this.stack.length;r++)t=new am(this.buffer,t,this.stack[r]);return this.bufferNode=new am(this.buffer,t,this.index)}get tree(){return this.buffer?null:this._tree._tree}iterate(e,t){for(let n=0;;){let r=!1;if(this.type.isAnonymous||e(this)!==!1){if(this.firstChild()){n++;continue}this.type.isAnonymous||(r=!0)}for(;;){if(r&&t&&t(this),r=this.type.isAnonymous,!n)return;if(this.nextSibling())break;this.parent(),n--,r=!0}}}matchContext(e){if(!this.buffer)return om(this.node.parent,e);let{buffer:t}=this.buffer,{types:n}=t.set;for(let r=e.length-1,s=this.stack.length-1;r>=0;s--){if(s<0)return om(this._tree,e,r);let i=n[t.buffer[this.stack[s]]];if(!i.isAnonymous){if(e[r]&&e[r]!=i.name)return!1;r--}}return!0}};function rv(e){return e.children.some(t=>t instanceof Go||!t.type.isAnonymous||rv(t))}function C9(e){var t;let{buffer:n,nodeSet:r,maxBufferLength:s=uk,reused:i=[],minRepeatType:o=r.types.length}=e,a=Array.isArray(n)?new B9(n,n.length):n,l=r.types,c=0,u=0;function d(D,A,x,O,R,P){let{id:_,start:N,end:W,size:q}=a,F=u,z=c;if(q<0)if(a.next(),q==-1){let be=i[_];x.push(be),O.push(N-D);return}else if(q==-3){c=_;return}else if(q==-4){u=_;return}else throw new RangeError(`Unrecognized record size: ${q}`);let J=l[_],Z,Q,G=N-D;if(W-N<=s&&(Q=C(a.pos-A,R))){let be=new Uint16Array(Q.size-Q.skip),ve=a.pos-Q.size,X=be.length;for(;a.pos>ve;)X=v(Q.start,be,X);Z=new Go(be,W-Q.start,r),G=Q.start-D}else{let be=a.pos-q;a.next();let ve=[],X=[],Y=_>=o?_:-1,ie=0,ne=W;for(;a.pos>be;)Y>=0&&a.id==Y&&a.size>=0?(a.end<=ne-s&&(B(ve,X,N,ie,a.end,ne,Y,F,z),ie=ve.length,ne=a.end),a.next()):P>2500?h(N,be,ve,X):d(N,be,ve,X,Y,P+1);if(Y>=0&&ie>0&&ie<ve.length&&B(ve,X,N,ie,N,ne,Y,F,z),ve.reverse(),X.reverse(),Y>-1&&ie>0){let ee=f(J,z);Z=sv(J,ve,X,0,ve.length,0,W-N,ee,ee)}else Z=g(J,ve,X,W-N,F-W,z)}x.push(Z),O.push(G)}function h(D,A,x,O){let R=[],P=0,_=-1;for(;a.pos>A;){let{id:N,start:W,end:q,size:F}=a;if(F>4)a.next();else{if(_>-1&&W<_)break;_<0&&(_=q-s),R.push(N,W,q),P++,a.next()}}if(P){let N=new Uint16Array(P*4),W=R[R.length-2];for(let q=R.length-3,F=0;q>=0;q-=3)N[F++]=R[q],N[F++]=R[q+1]-W,N[F++]=R[q+2]-W,N[F++]=F;x.push(new Go(N,R[2]-W,r)),O.push(W-D)}}function f(D,A){return(x,O,R)=>{let P=0,_=x.length-1,N,W;if(_>=0&&(N=x[_])instanceof Pt){if(!_&&N.type==D&&N.length==R)return N;(W=N.prop(ke.lookAhead))&&(P=O[_]+N.length+W)}return g(D,x,O,R,P,A)}}function B(D,A,x,O,R,P,_,N,W){let q=[],F=[];for(;D.length>O;)q.push(D.pop()),F.push(A.pop()+x-R);D.push(g(r.types[_],q,F,P-R,N-P,W)),A.push(R-x)}function g(D,A,x,O,R,P,_){if(P){let N=[ke.contextHash,P];_=_?[N].concat(_):[N]}if(R>25){let N=[ke.lookAhead,R];_=_?[N].concat(_):[N]}return new Pt(D,A,x,O,_)}function C(D,A){let x=a.fork(),O=0,R=0,P=0,_=x.end-s,N={size:0,start:0,skip:0};e:for(let W=x.pos-D;x.pos>W;){let q=x.size;if(x.id==A&&q>=0){N.size=O,N.start=R,N.skip=P,P+=4,O+=4,x.next();continue}let F=x.pos-q;if(q<0||F<W||x.start<_)break;let z=x.id>=o?4:0,J=x.start;for(x.next();x.pos>F;){if(x.size<0)if(x.size==-3||x.size==-4)z+=4;else break e;else x.id>=o&&(z+=4);x.next()}R=J,O+=q,P+=z}return(A<0||O==D)&&(N.size=O,N.start=R,N.skip=P),N.size>4?N:void 0}function v(D,A,x){let{id:O,start:R,end:P,size:_}=a;if(a.next(),_>=0&&O<o){let N=x;if(_>4){let W=a.pos-(_-4);for(;a.pos>W;)x=v(D,A,x)}A[--x]=N,A[--x]=P-D,A[--x]=R-D,A[--x]=O}else _==-3?c=O:_==-4&&(u=O);return x}let y=[],S=[];for(;a.pos>0;)d(e.start||0,e.bufferStart||0,y,S,-1,0);let E=(t=e.length)!==null&&t!==void 0?t:y.length?S[0]+y[0].length:0;return new Pt(l[e.topID],y.reverse(),S.reverse(),E)}var pS=new WeakMap;function zu(e,t){if(!e.isAnonymous||t instanceof Go||t.type!=e)return 1;let n=pS.get(t);if(n==null){n=1;for(let r of t.children){if(r.type!=e||!(r instanceof Pt)){n=1;break}n+=zu(e,r)}pS.set(t,n)}return n}function sv(e,t,n,r,s,i,o,a,l){let c=0;for(let B=r;B<s;B++)c+=zu(e,t[B]);let u=Math.ceil(c*1.5/8),d=[],h=[];function f(B,g,C,v,y){for(let S=C;S<v;){let E=S,D=g[S],A=zu(e,B[S]);for(S++;S<v;S++){let x=zu(e,B[S]);if(A+x>=u)break;A+=x}if(S==E+1){if(A>u){let x=B[E];f(x.children,x.positions,0,x.children.length,g[E]+y);continue}d.push(B[E])}else{let x=g[S-1]+B[S-1].length-D;d.push(sv(e,B,g,E,S,D,x,null,l))}h.push(D+y-i)}}return f(t,n,r,s,0),(a||l)(d,h,o)}var $u=class cm{constructor(t,n,r,s,i=!1,o=!1){this.from=t,this.to=n,this.tree=r,this.offset=s,this.open=(i?1:0)|(o?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(t,n=[],r=!1){let s=[new cm(0,t.length,t,0,!1,r)];for(let i of n)i.to>t.length&&s.push(i);return s}static applyChanges(t,n,r=128){if(!n.length)return t;let s=[],i=1,o=t.length?t[0]:null;for(let a=0,l=0,c=0;;a++){let u=a<n.length?n[a]:null,d=u?u.fromA:1e9;if(d-l>=r)for(;o&&o.from<d;){let h=o;if(l>=h.from||d<=h.to||c){let f=Math.max(h.from,l)-c,B=Math.min(h.to,d)-c;h=f>=B?null:new cm(f,B,h.tree,h.offset+c,a>0,!!u)}if(h&&s.push(h),o.to>d)break;o=i<t.length?t[i++]:null}if(!u)break;l=u.toA,c=u.toA-u.toB}return s}},Ck=class{startParse(e,t,n){return typeof e=="string"&&(e=new v9(e)),n=n?n.length?n.map(r=>new rB(r.from,r.to)):[new rB(0,0)]:[new rB(0,e.length)],this.createParse(e,t||[],n)}parse(e,t,n){let r=this.startParse(e,t,n);for(;;){let s=r.advance();if(s)return s}}},v9=class{constructor(e){this.string=e}get length(){return this.string.length}chunk(e){return this.string.slice(e)}get lineChunks(){return!1}read(e,t){return this.string.slice(e,t)}},ele=new ke({perNode:!0}),y9=class um{constructor(t,n,r,s,i,o,a,l,c,u=0,d){this.p=t,this.stack=n,this.state=r,this.reducePos=s,this.pos=i,this.score=o,this.buffer=a,this.bufferBase=l,this.curContext=c,this.lookAhead=u,this.parent=d}toString(){return`[${this.stack.filter((t,n)=>n%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(t,n,r=0){let s=t.parser.context;return new um(t,[],n,r,r,0,[],0,s?new mS(s,s.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(t,n){this.stack.push(this.state,n,this.bufferBase+this.buffer.length),this.state=t}reduce(t){var n;let r=t>>19,s=t&65535,{parser:i}=this.p,o=this.reducePos<this.pos-25&&this.setLookAhead(this.pos),a=i.dynamicPrecedence(s);if(a&&(this.score+=a),r==0){s<i.minRepeatTerm&&this.reducePos<this.pos&&(this.reducePos=this.pos),this.pushState(i.getGoto(this.state,s,!0),this.reducePos),s<i.minRepeatTerm&&this.storeNode(s,this.reducePos,this.reducePos,o?8:4,!0),this.reduceContext(s,this.reducePos);return}let l=this.stack.length-(r-1)*3-(t&262144?6:0),c=l?this.stack[l-2]:this.p.ranges[0].from;s<i.minRepeatTerm&&c==this.reducePos&&this.reducePos<this.pos&&(this.reducePos=this.pos);let u=this.reducePos-c;u>=2e3&&!(!((n=this.p.parser.nodeSet.types[s])===null||n===void 0)&&n.isAnonymous)&&(c==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=u):this.p.lastBigReductionSize<u&&(this.p.bigReductionCount=1,this.p.lastBigReductionStart=c,this.p.lastBigReductionSize=u));let d=l?this.stack[l-1]:0,h=this.bufferBase+this.buffer.length-d;if(s<i.minRepeatTerm||t&131072){let f=i.stateFlag(this.state,1)?this.pos:this.reducePos;this.storeNode(s,c,f,h+4,!0)}if(t&262144)this.state=this.stack[l];else{let f=this.stack[l-3];this.state=i.getGoto(f,s,!0)}for(;this.stack.length>l;)this.stack.pop();this.reduceContext(s,c)}storeNode(t,n,r,s=4,i=!1){if(t==0&&(!this.stack.length||this.stack[this.stack.length-1]<this.buffer.length+this.bufferBase)){let o=this.buffer.length;if(o>0&&this.buffer[o-4]==0&&this.buffer[o-1]>-1){if(n==r)return;if(this.buffer[o-2]>=n){this.buffer[o-2]=r;return}}}if(!i||this.pos==r)this.buffer.push(t,n,r,s);else{let o=this.buffer.length;if(o>0&&(this.buffer[o-4]!=0||this.buffer[o-1]<0)){let a=!1;for(let l=o;l>0&&this.buffer[l-2]>r;l-=4)if(this.buffer[l-1]>=0){a=!0;break}if(a)for(;o>0&&this.buffer[o-2]>r;)this.buffer[o]=this.buffer[o-4],this.buffer[o+1]=this.buffer[o-3],this.buffer[o+2]=this.buffer[o-2],this.buffer[o+3]=this.buffer[o-1],o-=4,s>4&&(s-=4)}this.buffer[o]=t,this.buffer[o+1]=n,this.buffer[o+2]=r,this.buffer[o+3]=s}}shift(t,n,r,s){if(t&131072)this.pushState(t&65535,this.pos);else if((t&262144)==0){let i=t,{parser:o}=this.p;this.pos=s;let a=o.stateFlag(i,1);!a&&(s>r||n<=o.maxNode)&&(this.reducePos=s),this.pushState(i,a?r:Math.min(r,this.reducePos)),this.shiftContext(n,r),n<=o.maxNode&&this.buffer.push(n,r,s,4)}else this.pos=s,this.shiftContext(n,r),n<=this.p.parser.maxNode&&this.buffer.push(n,r,s,4)}apply(t,n,r,s){t&65536?this.reduce(t):this.shift(t,n,r,s)}useNode(t,n){let r=this.p.reused.length-1;(r<0||this.p.reused[r]!=t)&&(this.p.reused.push(t),r++);let s=this.pos;this.reducePos=this.pos=s+t.length,this.pushState(n,s),this.buffer.push(r,s,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,t,this,this.p.stream.reset(this.pos-t.length)))}split(){let t=this,n=t.buffer.length;for(n&&t.buffer[n-4]==0&&(n-=4);n>0&&t.buffer[n-2]>t.reducePos;)n-=4;let r=t.buffer.slice(n),s=t.bufferBase+n;for(;t&&s==t.bufferBase;)t=t.parent;return new um(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,r,s,this.curContext,this.lookAhead,t)}recoverByDelete(t,n){let r=t<=this.p.parser.maxNode;r&&this.storeNode(t,this.pos,n,4),this.storeNode(0,this.pos,n,r?8:4),this.pos=this.reducePos=n,this.score-=190}canShift(t){for(let n=new b9(this);;){let r=this.p.parser.stateSlot(n.state,4)||this.p.parser.hasAction(n.state,t);if(r==0)return!1;if((r&65536)==0)return!0;n.reduce(r)}}recoverByInsert(t){if(this.stack.length>=300)return[];let n=this.p.parser.nextStates(this.state);if(n.length>8||this.stack.length>=120){let s=[];for(let i=0,o;i<n.length;i+=2)(o=n[i+1])!=this.state&&this.p.parser.hasAction(o,t)&&s.push(n[i],o);if(this.stack.length<120)for(let i=0;s.length<8&&i<n.length;i+=2){let o=n[i+1];s.some((a,l)=>l&1&&a==o)||s.push(n[i],o)}n=s}let r=[];for(let s=0;s<n.length&&r.length<4;s+=2){let i=n[s+1];if(i==this.state)continue;let o=this.split();o.pushState(i,this.pos),o.storeNode(0,o.pos,o.pos,4,!0),o.shiftContext(n[s],this.pos),o.reducePos=this.pos,o.score-=200,r.push(o)}return r}forceReduce(){let{parser:t}=this.p,n=t.stateSlot(this.state,5);if((n&65536)==0)return!1;if(!t.validAction(this.state,n)){let r=n>>19,s=n&65535,i=this.stack.length-r*3;if(i<0||t.getGoto(this.stack[i],s,!1)<0){let o=this.findForcedReduction();if(o==null)return!1;n=o}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(n),!0}findForcedReduction(){let{parser:t}=this.p,n=[],r=(s,i)=>{if(!n.includes(s))return n.push(s),t.allActions(s,o=>{if(!(o&393216))if(o&65536){let a=(o>>19)-i;if(a>1){let l=o&65535,c=this.stack.length-a*3;if(c>=0&&t.getGoto(this.stack[c],l,!1)>=0)return a<<19|65536|l}}else{let a=r(o,i+1);if(a!=null)return a}})};return r(this.state,0)}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(this.stack.length!=3)return!1;let{parser:t}=this.p;return t.data[t.stateSlot(this.state,1)]==65535&&!t.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(t){if(this.state!=t.state||this.stack.length!=t.stack.length)return!1;for(let n=0;n<this.stack.length;n+=3)if(this.stack[n]!=t.stack[n])return!1;return!0}get parser(){return this.p.parser}dialectEnabled(t){return this.p.parser.dialect.flags[t]}shiftContext(t,n){this.curContext&&this.updateContext(this.curContext.tracker.shift(this.curContext.context,t,this,this.p.stream.reset(n)))}reduceContext(t,n){this.curContext&&this.updateContext(this.curContext.tracker.reduce(this.curContext.context,t,this,this.p.stream.reset(n)))}emitContext(){let t=this.buffer.length-1;(t<0||this.buffer[t]!=-3)&&this.buffer.push(this.curContext.hash,this.pos,this.pos,-3)}emitLookAhead(){let t=this.buffer.length-1;(t<0||this.buffer[t]!=-4)&&this.buffer.push(this.lookAhead,this.pos,this.pos,-4)}updateContext(t){if(t!=this.curContext.context){let n=new mS(this.curContext.tracker,t);n.hash!=this.curContext.hash&&this.emitContext(),this.curContext=n}}setLookAhead(t){return t<=this.lookAhead?!1:(this.emitLookAhead(),this.lookAhead=t,!0)}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}},mS=class{constructor(e,t){this.tracker=e,this.context=t,this.hash=e.strict?e.hash(t):0}},b9=class{constructor(e){this.start=e,this.state=e.state,this.stack=e.stack,this.base=this.stack.length}reduce(e){let t=e&65535,n=e>>19;n==0?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=(n-1)*3;let r=this.start.p.parser.getGoto(this.stack[this.base-3],t,!0);this.state=r}},S9=class dm{constructor(t,n,r){this.stack=t,this.pos=n,this.index=r,this.buffer=t.buffer,this.index==0&&this.maybeNext()}static create(t,n=t.bufferBase+t.buffer.length){return new dm(t,n,n-t.bufferBase)}maybeNext(){let t=this.stack.parent;t!=null&&(this.index=this.stack.bufferBase-t.bufferBase,this.stack=t,this.buffer=t.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,this.index==0&&this.maybeNext()}fork(){return new dm(this.stack,this.pos,this.index)}};function Pa(e,t=Uint16Array){if(typeof e!="string")return e;let n=null;for(let r=0,s=0;r<e.length;){let i=0;for(;;){let o=e.charCodeAt(r++),a=!1;if(o==126){i=65535;break}o>=92&&o--,o>=34&&o--;let l=o-32;if(l>=46&&(l-=46,a=!0),i+=l,a)break;i*=46}n?n[s++]=i:n=new t(i)}return n}var Wu=class{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}},gS=new Wu,E9=class{constructor(e,t){this.input=e,this.ranges=t,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=gS,this.rangeIndex=0,this.pos=this.chunkPos=t[0].from,this.range=t[0],this.end=t[t.length-1].to,this.readNext()}resolveOffset(e,t){let n=this.range,r=this.rangeIndex,s=this.pos+e;for(;s<n.from;){if(!r)return null;let i=this.ranges[--r];s-=n.from-i.to,n=i}for(;t<0?s>n.to:s>=n.to;){if(r==this.ranges.length-1)return null;let i=this.ranges[++r];s+=i.from-n.to,n=i}return s}clipPos(e){if(e>=this.range.from&&e<this.range.to)return e;for(let t of this.ranges)if(t.to>e)return Math.max(e,t.from);return this.end}peek(e){let t=this.chunkOff+e,n,r;if(t>=0&&t<this.chunk.length)n=this.pos+e,r=this.chunk.charCodeAt(t);else{let s=this.resolveOffset(e,1);if(s==null)return-1;if(n=s,n>=this.chunk2Pos&&n<this.chunk2Pos+this.chunk2.length)r=this.chunk2.charCodeAt(n-this.chunk2Pos);else{let i=this.rangeIndex,o=this.range;for(;o.to<=n;)o=this.ranges[++i];this.chunk2=this.input.chunk(this.chunk2Pos=n),n+this.chunk2.length>o.to&&(this.chunk2=this.chunk2.slice(0,o.to-n)),r=this.chunk2.charCodeAt(0)}}return n>=this.token.lookAhead&&(this.token.lookAhead=n+1),r}acceptToken(e,t=0){let n=t?this.resolveOffset(t,-1):this.pos;if(n==null||n<this.token.start)throw new RangeError("Token end out of bounds");this.token.value=e,this.token.end=n}acceptTokenTo(e,t){this.token.value=e,this.token.end=t}getChunk(){if(this.pos>=this.chunk2Pos&&this.pos<this.chunk2Pos+this.chunk2.length){let{chunk:e,chunkPos:t}=this;this.chunk=this.chunk2,this.chunkPos=this.chunk2Pos,this.chunk2=e,this.chunk2Pos=t,this.chunkOff=this.pos-this.chunkPos}else{this.chunk2=this.chunk,this.chunk2Pos=this.chunkPos;let e=this.input.chunk(this.pos),t=this.pos+e.length;this.chunk=t>this.range.to?e.slice(0,this.range.to-this.pos):e,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(e=1){for(this.chunkOff+=e;this.pos+e>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();e-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=e,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}reset(e,t){if(t?(this.token=t,t.start=e,t.lookAhead=e+1,t.value=t.extended=-1):this.token=gS,this.pos!=e){if(this.pos=e,e==this.end)return this.setDone(),this;for(;e<this.range.from;)this.range=this.ranges[--this.rangeIndex];for(;e>=this.range.to;)this.range=this.ranges[++this.rangeIndex];e>=this.chunkPos&&e<this.chunkPos+this.chunk.length?this.chunkOff=e-this.chunkPos:(this.chunk="",this.chunkOff=0),this.readNext()}return this}read(e,t){if(e>=this.chunkPos&&t<=this.chunkPos+this.chunk.length)return this.chunk.slice(e-this.chunkPos,t-this.chunkPos);if(e>=this.chunk2Pos&&t<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(e-this.chunk2Pos,t-this.chunk2Pos);if(e>=this.range.from&&t<=this.range.to)return this.input.read(e,t);let n="";for(let r of this.ranges){if(r.from>=t)break;r.to>e&&(n+=this.input.read(Math.max(r.from,e),Math.min(r.to,t)))}return n}},wo=class{constructor(e,t){this.data=e,this.id=t}token(e,t){let{parser:n}=t.p;vk(this.data,e,t,this.id,n.data,n.tokenPrecTable)}};wo.prototype.contextual=wo.prototype.fallback=wo.prototype.extend=!1;var x9=class{constructor(e,t,n){this.precTable=t,this.elseToken=n,this.data=typeof e=="string"?Pa(e):e}token(e,t){let n=e.pos,r=0;for(;;){let s=e.next<0,i=e.resolveOffset(1,1);if(vk(this.data,e,t,0,this.data,this.precTable),e.token.value>-1)break;if(this.elseToken==null)return;if(s||r++,i==null)break;e.reset(i,e.token)}r&&(e.reset(n,e.token),e.acceptToken(this.elseToken,r))}};x9.prototype.contextual=wo.prototype.fallback=wo.prototype.extend=!1;function vk(e,t,n,r,s,i){let o=0,a=1<<r,{dialect:l}=n.p.parser;e:for(;(a&e[o])!=0;){let c=e[o+1];for(let f=o+3;f<c;f+=2)if((e[f+1]&a)>0){let B=e[f];if(l.allows(B)&&(t.token.value==-1||t.token.value==B||w9(B,t.token.value,s,i))){t.acceptToken(B);break}}let u=t.next,d=0,h=e[o+2];if(t.next<0&&h>d&&e[c+h*3-3]==65535){o=e[c+h*3-1];continue e}for(;d<h;){let f=d+h>>1,B=c+f+(f<<1),g=e[B],C=e[B+1]||65536;if(u<g)h=f;else if(u>=C)d=f+1;else{o=e[B+2],t.advance();continue e}}break}}function CS(e,t,n){for(let r=t,s;(s=e[r])!=65535;r++)if(s==n)return r-t;return-1}function w9(e,t,n,r){let s=CS(n,r,t);return s<0||CS(n,r,e)<s}var vn=typeof process<"u"&&/\bparse\b/.test({}.LOG),sB=null;function vS(e,t,n){let r=e.cursor(ut.IncludeAnonymous);for(r.moveTo(t);;)if(!(n<0?r.childBefore(t):r.childAfter(t)))for(;;){if((n<0?r.to<t:r.from>t)&&!r.type.isError)return n<0?Math.max(0,Math.min(r.to-1,t-25)):Math.min(e.length,Math.max(r.from+1,t+25));if(n<0?r.prevSibling():r.nextSibling())break;if(!r.parent())return n<0?0:e.length}}var D9=class{constructor(e,t){this.fragments=e,this.nodeSet=t,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let e=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(e){for(this.safeFrom=e.openStart?vS(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?vS(e.tree,e.to+e.offset,-1)-e.offset:e.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(e.tree),this.start.push(-e.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(e){if(e<this.nextStart)return null;for(;this.fragment&&this.safeTo<=e;)this.nextFragment();if(!this.fragment)return null;for(;;){let t=this.trees.length-1;if(t<0)return this.nextFragment(),null;let n=this.trees[t],r=this.index[t];if(r==n.children.length){this.trees.pop(),this.start.pop(),this.index.pop();continue}let s=n.children[r],i=this.start[t]+n.positions[r];if(i>e)return this.nextStart=i,null;if(s instanceof Pt){if(i==e){if(i<this.safeFrom)return null;let o=i+s.length;if(o<=this.safeTo){let a=s.prop(ke.lookAhead);if(!a||o+a<this.fragment.to)return s}}this.index[t]++,i+s.length>=Math.max(this.safeFrom,e)&&(this.trees.push(s),this.start.push(i),this.index.push(0))}else this.index[t]++,this.nextStart=i+s.length}}},T9=class{constructor(e,t){this.stream=t,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map(n=>new Wu)}getActions(e){let t=0,n=null,{parser:r}=e.p,{tokenizers:s}=r,i=r.stateSlot(e.state,3),o=e.curContext?e.curContext.hash:0,a=0;for(let l=0;l<s.length;l++){if((1<<l&i)==0)continue;let c=s[l],u=this.tokens[l];if(!(n&&!c.fallback)&&((c.contextual||u.start!=e.pos||u.mask!=i||u.context!=o)&&(this.updateCachedToken(u,c,e),u.mask=i,u.context=o),u.lookAhead>u.end+25&&(a=Math.max(u.lookAhead,a)),u.value!=0)){let d=t;if(u.extended>-1&&(t=this.addActions(e,u.extended,u.end,t)),t=this.addActions(e,u.value,u.end,t),!c.extend&&(n=u,t>d))break}}for(;this.actions.length>t;)this.actions.pop();return a&&e.setLookAhead(a),!n&&e.pos==this.stream.end&&(n=new Wu,n.value=e.p.parser.eofTerm,n.start=n.end=e.pos,t=this.addActions(e,n.value,n.end,t)),this.mainToken=n,this.actions}getMainToken(e){if(this.mainToken)return this.mainToken;let t=new Wu,{pos:n,p:r}=e;return t.start=n,t.end=Math.min(n+1,r.stream.end),t.value=n==r.stream.end?r.parser.eofTerm:0,t}updateCachedToken(e,t,n){let r=this.stream.clipPos(n.pos);if(t.token(this.stream.reset(r,e),n),e.value>-1){let{parser:s}=n.p;for(let i=0;i<s.specialized.length;i++)if(s.specialized[i]==e.value){let o=s.specializers[i](this.stream.read(e.start,e.end),n);if(o>=0&&n.p.parser.dialect.allows(o>>1)){(o&1)==0?e.value=o>>1:e.extended=o>>1;break}}}else e.value=0,e.end=this.stream.clipPos(r+1)}putAction(e,t,n,r){for(let s=0;s<r;s+=3)if(this.actions[s]==e)return r;return this.actions[r++]=e,this.actions[r++]=t,this.actions[r++]=n,r}addActions(e,t,n,r){let{state:s}=e,{parser:i}=e.p,{data:o}=i;for(let a=0;a<2;a++)for(let l=i.stateSlot(s,a?2:1);;l+=3){if(o[l]==65535)if(o[l+1]==1)l=qr(o,l+2);else{r==0&&o[l+1]==2&&(r=this.putAction(qr(o,l+2),t,n,r));break}o[l]==t&&(r=this.putAction(qr(o,l+1),t,n,r))}return r}},A9=class{constructor(e,t,n,r){this.parser=e,this.input=t,this.ranges=r,this.recovering=0,this.nextStackID=9812,this.minStackPos=0,this.reused=[],this.stoppedAt=null,this.lastBigReductionStart=-1,this.lastBigReductionSize=0,this.bigReductionCount=0,this.stream=new E9(t,r),this.tokens=new T9(e,this.stream),this.topTerm=e.top[1];let{from:s}=r[0];this.stacks=[y9.start(this,e.top[0],s)],this.fragments=n.length&&this.stream.end-s>e.bufferLength*4?new D9(n,e.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let e=this.stacks,t=this.minStackPos,n=this.stacks=[],r,s;if(this.bigReductionCount>300&&e.length==1){let[i]=e;for(;i.forceReduce()&&i.stack.length&&i.stack[i.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let i=0;i<e.length;i++){let o=e[i];for(;;){if(this.tokens.mainToken=null,o.pos>t)n.push(o);else{if(this.advanceStack(o,n,e))continue;{r||(r=[],s=[]),r.push(o);let a=this.tokens.getMainToken(o);s.push(a.value,a.end)}}break}}if(!n.length){let i=r&&R9(r);if(i)return vn&&console.log("Finish with "+this.stackID(i)),this.stackToTree(i);if(this.parser.strict)throw vn&&r&&console.log("Stuck with token "+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):"none")),new SyntaxError("No parse at "+t);this.recovering||(this.recovering=5)}if(this.recovering&&r){let i=this.stoppedAt!=null&&r[0].pos>this.stoppedAt?r[0]:this.runRecovery(r,s,n);if(i)return vn&&console.log("Force-finish "+this.stackID(i)),this.stackToTree(i.forceAll())}if(this.recovering){let i=this.recovering==1?1:this.recovering*3;if(n.length>i)for(n.sort((o,a)=>a.score-o.score);n.length>i;)n.pop();n.some(o=>o.reducePos>t)&&this.recovering--}else if(n.length>1){e:for(let i=0;i<n.length-1;i++){let o=n[i];for(let a=i+1;a<n.length;a++){let l=n[a];if(o.sameState(l)||o.buffer.length>500&&l.buffer.length>500)if((o.score-l.score||o.buffer.length-l.buffer.length)>0)n.splice(a--,1);else{n.splice(i--,1);continue e}}}n.length>12&&(n.sort((i,o)=>o.score-i.score),n.splice(12,n.length-12))}this.minStackPos=n[0].pos;for(let i=1;i<n.length;i++)n[i].pos<this.minStackPos&&(this.minStackPos=n[i].pos);return null}stopAt(e){if(this.stoppedAt!=null&&this.stoppedAt<e)throw new RangeError("Can't move stoppedAt forward");this.stoppedAt=e}advanceStack(e,t,n){let r=e.pos,{parser:s}=this,i=vn?this.stackID(e)+" -> ":"";if(this.stoppedAt!=null&&r>this.stoppedAt)return e.forceReduce()?e:null;if(this.fragments){let l=e.curContext&&e.curContext.tracker.strict,c=l?e.curContext.hash:0;for(let u=this.fragments.nodeAt(r);u;){let d=this.parser.nodeSet.types[u.type.id]==u.type?s.getGoto(e.state,u.type.id):-1;if(d>-1&&u.length&&(!l||(u.prop(ke.contextHash)||0)==c))return e.useNode(u,d),vn&&console.log(i+this.stackID(e)+` (via reuse of ${s.getName(u.type.id)})`),!0;if(!(u instanceof Pt)||u.children.length==0||u.positions[0]>0)break;let h=u.children[0];if(h instanceof Pt&&u.positions[0]==0)u=h;else break}}let o=s.stateSlot(e.state,4);if(o>0)return e.reduce(o),vn&&console.log(i+this.stackID(e)+` (via always-reduce ${s.getName(o&65535)})`),!0;if(e.stack.length>=8400)for(;e.stack.length>6e3&&e.forceReduce(););let a=this.tokens.getActions(e);for(let l=0;l<a.length;){let c=a[l++],u=a[l++],d=a[l++],h=l==a.length||!n,f=h?e:e.split(),B=this.tokens.mainToken;if(f.apply(c,u,B?B.start:f.pos,d),vn&&console.log(i+this.stackID(f)+` (via ${(c&65536)==0?"shift":`reduce of ${s.getName(c&65535)}`} for ${s.getName(u)} @ ${r}${f==e?"":", split"})`),h)return!0;f.pos>r?t.push(f):n.push(f)}return!1}advanceFully(e,t){let n=e.pos;for(;;){if(!this.advanceStack(e,null,null))return!1;if(e.pos>n)return yS(e,t),!0}}runRecovery(e,t,n){let r=null,s=!1;for(let i=0;i<e.length;i++){let o=e[i],a=t[i<<1],l=t[(i<<1)+1],c=vn?this.stackID(o)+" -> ":"";if(o.deadEnd&&(s||(s=!0,o.restart(),vn&&console.log(c+this.stackID(o)+" (restarted)"),this.advanceFully(o,n))))continue;let u=o.split(),d=c;for(let h=0;h<10&&u.forceReduce()&&(vn&&console.log(d+this.stackID(u)+" (via force-reduce)"),!this.advanceFully(u,n));h++)vn&&(d=this.stackID(u)+" -> ");for(let h of o.recoverByInsert(a))vn&&console.log(c+this.stackID(h)+" (via recover-insert)"),this.advanceFully(h,n);this.stream.end>o.pos?(l==o.pos&&(l++,a=0),o.recoverByDelete(a,l),vn&&console.log(c+this.stackID(o)+` (via recover-delete ${this.parser.getName(a)})`),yS(o,n)):(!r||r.score<u.score)&&(r=u)}return r}stackToTree(e){return e.close(),Pt.build({buffer:S9.create(e),nodeSet:this.parser.nodeSet,topID:this.topTerm,maxBufferLength:this.parser.bufferLength,reused:this.reused,start:this.ranges[0].from,length:e.pos-this.ranges[0].from,minRepeatType:this.parser.minRepeatTerm})}stackID(e){let t=(sB||(sB=new WeakMap)).get(e);return t||sB.set(e,t=String.fromCodePoint(this.nextStackID++)),t+e}};function yS(e,t){for(let n=0;n<t.length;n++){let r=t[n];if(r.pos==e.pos&&r.sameState(e)){t[n].score<e.score&&(t[n]=e);return}}t.push(e)}var I9=class{constructor(e,t,n){this.source=e,this.flags=t,this.disabled=n}allows(e){return!this.disabled||this.disabled[e]==0}},k9=class hm extends Ck{constructor(t){if(super(),this.wrappers=[],t.version!=14)throw new RangeError(`Parser version (${t.version}) doesn't match runtime version (14)`);let n=t.nodeNames.split(" ");this.minRepeatTerm=n.length;for(let a=0;a<t.repeatNodeCount;a++)n.push("");let r=Object.keys(t.topRules).map(a=>t.topRules[a][1]),s=[];for(let a=0;a<n.length;a++)s.push([]);function i(a,l,c){s[a].push([l,l.deserialize(String(c))])}if(t.nodeProps)for(let a of t.nodeProps){let l=a[0];typeof l=="string"&&(l=ke[l]);for(let c=1;c<a.length;){let u=a[c++];if(u>=0)i(u,l,a[c++]);else{let d=a[c+-u];for(let h=-u;h>0;h--)i(a[c++],l,d);c++}}}this.nodeSet=new f9(n.map((a,l)=>jn.define({name:l>=this.minRepeatTerm?void 0:a,id:l,props:s[l],top:r.indexOf(l)>-1,error:l==0,skipped:t.skippedNodes&&t.skippedNodes.indexOf(l)>-1}))),t.propSources&&(this.nodeSet=this.nodeSet.extend(...t.propSources)),this.strict=!1,this.bufferLength=uk;let o=Pa(t.tokenData);this.context=t.context,this.specializerSpecs=t.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let a=0;a<this.specializerSpecs.length;a++)this.specialized[a]=this.specializerSpecs[a].term;this.specializers=this.specializerSpecs.map(bS),this.states=Pa(t.states,Uint32Array),this.data=Pa(t.stateData),this.goto=Pa(t.goto),this.maxTerm=t.maxTerm,this.tokenizers=t.tokenizers.map(a=>typeof a=="number"?new wo(o,a):a),this.topRules=t.topRules,this.dialects=t.dialects||{},this.dynamicPrecedences=t.dynamicPrecedences||null,this.tokenPrecTable=t.tokenPrec,this.termNames=t.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(t,n,r){let s=new A9(this,t,n,r);for(let i of this.wrappers)s=i(s,t,n,r);return s}getGoto(t,n,r=!1){let s=this.goto;if(n>=s[0])return-1;for(let i=s[n+1];;){let o=s[i++],a=o&1,l=s[i++];if(a&&r)return l;for(let c=i+(o>>1);i<c;i++)if(s[i]==t)return l;if(a)return-1}}hasAction(t,n){let r=this.data;for(let s=0;s<2;s++)for(let i=this.stateSlot(t,s?2:1),o;;i+=3){if((o=r[i])==65535)if(r[i+1]==1)o=r[i=qr(r,i+2)];else{if(r[i+1]==2)return qr(r,i+2);break}if(o==n||o==0)return qr(r,i+1)}return 0}stateSlot(t,n){return this.states[t*6+n]}stateFlag(t,n){return(this.stateSlot(t,0)&n)>0}validAction(t,n){return!!this.allActions(t,r=>r==n?!0:null)}allActions(t,n){let r=this.stateSlot(t,4),s=r?n(r):void 0;for(let i=this.stateSlot(t,1);s==null;i+=3){if(this.data[i]==65535)if(this.data[i+1]==1)i=qr(this.data,i+2);else break;s=n(qr(this.data,i+1))}return s}nextStates(t){let n=[];for(let r=this.stateSlot(t,1);;r+=3){if(this.data[r]==65535)if(this.data[r+1]==1)r=qr(this.data,r+2);else break;if((this.data[r+2]&1)==0){let s=this.data[r+1];n.some((i,o)=>o&1&&i==s)||n.push(this.data[r],s)}}return n}configure(t){let n=Object.assign(Object.create(hm.prototype),this);if(t.props&&(n.nodeSet=this.nodeSet.extend(...t.props)),t.top){let r=this.topRules[t.top];if(!r)throw new RangeError(`Invalid top rule name ${t.top}`);n.top=r}return t.tokenizers&&(n.tokenizers=this.tokenizers.map(r=>{let s=t.tokenizers.find(i=>i.from==r);return s?s.to:r})),t.specializers&&(n.specializers=this.specializers.slice(),n.specializerSpecs=this.specializerSpecs.map((r,s)=>{let i=t.specializers.find(a=>a.from==r.external);if(!i)return r;let o=Object.assign(Object.assign({},r),{external:i.to});return n.specializers[s]=bS(o),o})),t.contextTracker&&(n.context=t.contextTracker),t.dialect&&(n.dialect=this.parseDialect(t.dialect)),t.strict!=null&&(n.strict=t.strict),t.wrap&&(n.wrappers=n.wrappers.concat(t.wrap)),t.bufferLength!=null&&(n.bufferLength=t.bufferLength),n}hasWrappers(){return this.wrappers.length>0}getName(t){return this.termNames?this.termNames[t]:String(t<=this.maxNode&&this.nodeSet.types[t].name||t)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(t){let n=this.dynamicPrecedences;return n==null?0:n[t]||0}parseDialect(t){let n=Object.keys(this.dialects),r=n.map(()=>!1);if(t)for(let i of t.split(" ")){let o=n.indexOf(i);o>=0&&(r[o]=!0)}let s=null;for(let i=0;i<n.length;i++)if(!r[i])for(let o=this.dialects[n[i]],a;(a=this.data[o++])!=65535;)(s||(s=new Uint8Array(this.maxTerm+1)))[a]=1;return new I9(t,r,s)}static deserialize(t){return new hm(t)}};function qr(e,t){return e[t]|e[t+1]<<16}function R9(e){let t=null;for(let n of e){let r=n.p.stoppedAt;(n.pos==n.p.stream.end||r!=null&&n.pos>r)&&n.p.parser.stateFlag(n.state,2)&&(!t||t.score<n.score)&&(t=n)}return t}function bS(e){if(e.external){let t=e.extend?1:0;return(n,r)=>e.external(n,r)<<1|t}return e.get}var O9=0,Kr=class fm{constructor(t,n,r,s){this.name=t,this.set=n,this.base=r,this.modified=s,this.id=O9++}toString(){let{name:t}=this;for(let n of this.modified)n.name&&(t=`${n.name}(${t})`);return t}static define(t,n){let r=typeof t=="string"?t:"?";if(t instanceof fm&&(n=t),n?.base)throw new Error("Can not derive from a modified tag");let s=new fm(r,[],null,[]);if(s.set.push(s),n)for(let i of n.set)s.set.push(i);return s}static defineModifier(t){let n=new SS(t);return r=>r.modified.indexOf(n)>-1?r:SS.get(r.base||r,r.modified.concat(n).sort((s,i)=>s.id-i.id))}},M9=0,SS=class yk{constructor(t){this.name=t,this.instances=[],this.id=M9++}static get(t,n){if(!n.length)return t;let r=n[0].instances.find(a=>a.base==t&&N9(n,a.modified));if(r)return r;let s=[],i=new Kr(t.name,s,t,n);for(let a of n)a.instances.push(i);let o=P9(n);for(let a of t.set)if(!a.modified.length)for(let l of o)s.push(yk.get(a,l));return i}};function N9(e,t){return e.length==t.length&&e.every((n,r)=>n==t[r])}function P9(e){let t=[[]];for(let n=0;n<e.length;n++)for(let r=0,s=t.length;r<s;r++)t.push(t[r].concat(e[n]));return t.sort((n,r)=>r.length-n.length)}function bk(e){let t=Object.create(null);for(let n in e){let r=e[n];Array.isArray(r)||(r=[r]);for(let s of n.split(" "))if(s){let i=[],o=2,a=s;for(let u=0;;){if(a=="..."&&u>0&&u+3==s.length){o=1;break}let d=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(a);if(!d)throw new RangeError("Invalid path: "+s);if(i.push(d[0]=="*"?"":d[0][0]=='"'?JSON.parse(d[0]):d[0]),u+=d[0].length,u==s.length)break;let h=s[u++];if(u==s.length&&h=="!"){o=0;break}if(h!="/")throw new RangeError("Invalid path: "+s);a=s.slice(u)}let l=i.length-1,c=i[l];if(!c)throw new RangeError("Invalid path: "+s);t[c]=new Pl(r,o,l>0?i.slice(0,l):null).sort(t[c])}}return Sk.add(t)}var Sk=new ke({combine(e,t){let n,r,s;for(;e||t;){if(!e||t&&e.depth<=t.depth?(s=t,t=t.next):(s=e,e=e.next),n&&n.mode==s.mode&&!s.context&&!n.context)continue;let i=new Pl(s.tags,s.mode,s.context);n?n.next=i:r=i,n=i}return r}}),Pl=class{constructor(e,t,n,r){this.tags=e,this.mode=t,this.context=n,this.next=r}get opaque(){return this.mode==0}get inherit(){return this.mode==1}sort(e){return!e||e.depth<this.depth?(this.next=e,this):(e.next=this.sort(e.next),e)}get depth(){return this.context?this.context.length:0}};Pl.empty=new Pl([],2,null);function Ek(e,t){let n=Object.create(null);for(let i of e)if(!Array.isArray(i.tag))n[i.tag.id]=i.class;else for(let o of i.tag)n[o.id]=i.class;let{scope:r,all:s=null}=t||{};return{style:i=>{let o=s;for(let a of i)for(let l of a.set){let c=n[l.id];if(c){o=o?o+" "+c:c;break}}return o},scope:r}}function L9(e,t){let n=null;for(let r of e){let s=r.style(t);s&&(n=n?n+" "+s:s)}return n}function _9(e,t,n,r=0,s=e.length){let i=new F9(r,Array.isArray(t)?t:[t],n);i.highlightRange(e.cursor(),r,s,"",i.highlighters),i.flush(s)}var F9=class{constructor(e,t,n){this.at=e,this.highlighters=t,this.span=n,this.class=""}startSpan(e,t){t!=this.class&&(this.flush(e),e>this.at&&(this.at=e),this.class=t)}flush(e){e>this.at&&this.class&&this.span(this.at,e,this.class)}highlightRange(e,t,n,r,s){let{type:i,from:o,to:a}=e;if(o>=n||a<=t)return;i.isTop&&(s=this.highlighters.filter(h=>!h.scope||h.scope(i)));let l=r,c=H9(e)||Pl.empty,u=L9(s,c.tags);if(u&&(l&&(l+=" "),l+=u,c.mode==1&&(r+=(r?" ":"")+u)),this.startSpan(Math.max(t,o),l),c.opaque)return;let d=e.tree&&e.tree.prop(ke.mounted);if(d&&d.overlay){let h=e.node.enter(d.overlay[0].from+o,1),f=this.highlighters.filter(g=>!g.scope||g.scope(d.tree.type)),B=e.firstChild();for(let g=0,C=o;;g++){let v=g<d.overlay.length?d.overlay[g]:null,y=v?v.from+o:a,S=Math.max(t,C),E=Math.min(n,y);if(S<E&&B)for(;e.from<E&&(this.highlightRange(e,S,E,r,s),this.startSpan(Math.min(E,e.to),l),!(e.to>=y||!e.nextSibling())););if(!v||y>n)break;C=v.to+o,C>t&&(this.highlightRange(h.cursor(),Math.max(t,v.from+o),Math.min(n,C),"",f),this.startSpan(Math.min(n,C),l))}B&&e.parent()}else if(e.firstChild()){d&&(r="");do if(!(e.to<=t)){if(e.from>=n)break;this.highlightRange(e,t,n,r,s),this.startSpan(Math.min(n,e.to),l)}while(e.nextSibling());e.parent()}}};function H9(e){let t=e.type.prop(Sk);for(;t&&t.context&&!e.matchContext(t.context);)t=t.next;return t||null}var le=Kr.define,Zc=le(),Ts=le(),ES=le(Ts),xS=le(Ts),As=le(),eu=le(As),iB=le(As),Sr=le(),oi=le(Sr),vr=le(),yr=le(),Bm=le(),ma=le(Bm),tu=le(),re={comment:Zc,lineComment:le(Zc),blockComment:le(Zc),docComment:le(Zc),name:Ts,variableName:le(Ts),typeName:ES,tagName:le(ES),propertyName:xS,attributeName:le(xS),className:le(Ts),labelName:le(Ts),namespace:le(Ts),macroName:le(Ts),literal:As,string:eu,docString:le(eu),character:le(eu),attributeValue:le(eu),number:iB,integer:le(iB),float:le(iB),bool:le(As),regexp:le(As),escape:le(As),color:le(As),url:le(As),keyword:vr,self:le(vr),null:le(vr),atom:le(vr),unit:le(vr),modifier:le(vr),operatorKeyword:le(vr),controlKeyword:le(vr),definitionKeyword:le(vr),moduleKeyword:le(vr),operator:yr,derefOperator:le(yr),arithmeticOperator:le(yr),logicOperator:le(yr),bitwiseOperator:le(yr),compareOperator:le(yr),updateOperator:le(yr),definitionOperator:le(yr),typeOperator:le(yr),controlOperator:le(yr),punctuation:Bm,separator:le(Bm),bracket:ma,angleBracket:le(ma),squareBracket:le(ma),paren:le(ma),brace:le(ma),content:Sr,heading:oi,heading1:le(oi),heading2:le(oi),heading3:le(oi),heading4:le(oi),heading5:le(oi),heading6:le(oi),contentSeparator:le(Sr),list:le(Sr),quote:le(Sr),emphasis:le(Sr),strong:le(Sr),link:le(Sr),monospace:le(Sr),strikethrough:le(Sr),inserted:le(),deleted:le(),changed:le(),invalid:le(),meta:tu,documentMeta:le(tu),annotation:le(tu),processingInstruction:le(tu),definition:Kr.defineModifier("definition"),constant:Kr.defineModifier("constant"),function:Kr.defineModifier("function"),standard:Kr.defineModifier("standard"),local:Kr.defineModifier("local"),special:Kr.defineModifier("special")};for(let e in re){let t=re[e];t instanceof Kr&&(t.name=e)}var tle=Ek([{tag:re.link,class:"tok-link"},{tag:re.heading,class:"tok-heading"},{tag:re.emphasis,class:"tok-emphasis"},{tag:re.strong,class:"tok-strong"},{tag:re.keyword,class:"tok-keyword"},{tag:re.atom,class:"tok-atom"},{tag:re.bool,class:"tok-bool"},{tag:re.url,class:"tok-url"},{tag:re.labelName,class:"tok-labelName"},{tag:re.inserted,class:"tok-inserted"},{tag:re.deleted,class:"tok-deleted"},{tag:re.literal,class:"tok-literal"},{tag:re.string,class:"tok-string"},{tag:re.number,class:"tok-number"},{tag:[re.regexp,re.escape,re.special(re.string)],class:"tok-string2"},{tag:re.variableName,class:"tok-variableName"},{tag:re.local(re.variableName),class:"tok-variableName tok-local"},{tag:re.definition(re.variableName),class:"tok-variableName tok-definition"},{tag:re.special(re.variableName),class:"tok-variableName2"},{tag:re.definition(re.propertyName),class:"tok-propertyName tok-definition"},{tag:re.typeName,class:"tok-typeName"},{tag:re.namespace,class:"tok-namespace"},{tag:re.className,class:"tok-className"},{tag:re.macroName,class:"tok-macroName"},{tag:re.propertyName,class:"tok-propertyName"},{tag:re.operator,class:"tok-operator"},{tag:re.comment,class:"tok-comment"},{tag:re.meta,class:"tok-meta"},{tag:re.invalid,class:"tok-invalid"},{tag:re.punctuation,class:"tok-punctuation"}]),j9=bk({String:re.string,Number:re.number,"True False":re.bool,PropertyName:re.propertyName,Null:re.null,", :":re.separator,"[ ]":re.squareBracket,"{ }":re.brace}),G9=k9.deserialize({version:14,states:"$bOVQPOOOOQO'#Cb'#CbOnQPO'#CeOvQPO'#ClOOQO'#Cr'#CrQOQPOOOOQO'#Cg'#CgO}QPO'#CfO!SQPO'#CtOOQO,59P,59PO![QPO,59PO!aQPO'#CuOOQO,59W,59WO!iQPO,59WOVQPO,59QOqQPO'#CmO!nQPO,59`OOQO1G.k1G.kOVQPO'#CnO!vQPO,59aOOQO1G.r1G.rOOQO1G.l1G.lOOQO,59X,59XOOQO-E6k-E6kOOQO,59Y,59YOOQO-E6l-E6l",stateData:"#O~OeOS~OQSORSOSSOTSOWQO_ROgPO~OVXOgUO~O^[O~PVO[^O~O]_OVhX~OVaO~O]bO^iX~O^dO~O]_OVha~O]bO^ia~O",goto:"!kjPPPPPPkPPkqwPPPPk{!RPPP!XP!e!hXSOR^bQWQRf_TVQ_Q`WRg`QcZRicQTOQZRQe^RhbRYQR]R",nodeNames:"⚠ JsonText True False Null Number String } { Object Property PropertyName : , ] [ Array",maxTerm:25,nodeProps:[["isolate",-2,6,11,""],["openedBy",7,"{",14,"["],["closedBy",8,"}",15,"]"]],propSources:[j9],skippedNodes:[0],repeatNodeCount:2,tokenData:"(|~RaXY!WYZ!W]^!Wpq!Wrs!]|}$u}!O$z!Q!R%T!R![&c![!]&t!}#O&y#P#Q'O#Y#Z'T#b#c'r#h#i(Z#o#p(r#q#r(w~!]Oe~~!`Wpq!]qr!]rs!xs#O!]#O#P!}#P;'S!];'S;=`$o<%lO!]~!}Og~~#QXrs!]!P!Q!]#O#P!]#U#V!]#Y#Z!]#b#c!]#f#g!]#h#i!]#i#j#m~#pR!Q![#y!c!i#y#T#Z#y~#|R!Q![$V!c!i$V#T#Z$V~$YR!Q![$c!c!i$c#T#Z$c~$fR!Q![!]!c!i!]#T#Z!]~$rP;=`<%l!]~$zO]~~$}Q!Q!R%T!R![&c~%YRT~!O!P%c!g!h%w#X#Y%w~%fP!Q![%i~%nRT~!Q![%i!g!h%w#X#Y%w~%zR{|&T}!O&T!Q![&Z~&WP!Q![&Z~&`PT~!Q![&Z~&hST~!O!P%c!Q![&c!g!h%w#X#Y%w~&yO[~~'OO_~~'TO^~~'WP#T#U'Z~'^P#`#a'a~'dP#g#h'g~'jP#X#Y'm~'rOR~~'uP#i#j'x~'{P#`#a(O~(RP#`#a(U~(ZOS~~(^P#f#g(a~(dP#i#j(g~(jP#X#Y(m~(rOQ~~(wOW~~(|OV~",tokenizers:[0],topRules:{JsonText:[0,1]},tokenPrec:0}),pm=[],xk=[];(()=>{let e="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map(t=>t?parseInt(t,36):1);for(let t=0,n=0;t<e.length;t++)(t%2?xk:pm).push(n=n+e[t])})();function V9(e){if(e<768)return!1;for(let t=0,n=pm.length;;){let r=t+n>>1;if(e<pm[r])n=r;else if(e>=xk[r])t=r+1;else return!0;if(t==n)return!1}}function wS(e){return e>=127462&&e<=127487}var DS=8205;function U9(e,t,n=!0,r=!0){return(n?wk:z9)(e,t,r)}function wk(e,t,n){if(t==e.length)return t;t&&Dk(e.charCodeAt(t))&&Tk(e.charCodeAt(t-1))&&t--;let r=oB(e,t);for(t+=TS(r);t<e.length;){let s=oB(e,t);if(r==DS||s==DS||n&&V9(s))t+=TS(s),r=s;else if(wS(s)){let i=0,o=t-2;for(;o>=0&&wS(oB(e,o));)i++,o-=2;if(i%2==0)break;t+=2}else break}return t}function z9(e,t,n){for(;t>0;){let r=wk(e,t-2,n);if(r<t)return r;t--}return 0}function oB(e,t){let n=e.charCodeAt(t);if(!Tk(n)||t+1==e.length)return n;let r=e.charCodeAt(t+1);return Dk(r)?(n-55296<<10)+(r-56320)+65536:n}function Dk(e){return e>=56320&&e<57344}function Tk(e){return e>=55296&&e<56320}function TS(e){return e<65536?1:2}var Fe=class Ak{lineAt(t){if(t<0||t>this.length)throw new RangeError(`Invalid position ${t} in document of length ${this.length}`);return this.lineInner(t,!1,1,0)}line(t){if(t<1||t>this.lines)throw new RangeError(`Invalid line number ${t} in ${this.lines}-line document`);return this.lineInner(t,!0,1,0)}replace(t,n,r){[t,n]=Vo(this,t,n);let s=[];return this.decompose(0,t,s,2),r.length&&r.decompose(0,r.length,s,3),this.decompose(n,this.length,s,1),qu.from(s,this.length-(n-t)+r.length)}append(t){return this.replace(this.length,this.length,t)}slice(t,n=this.length){[t,n]=Vo(this,t,n);let r=[];return this.decompose(t,n,r,0),qu.from(r,n-t)}eq(t){if(t==this)return!0;if(t.length!=this.length||t.lines!=this.lines)return!1;let n=this.scanIdentical(t,1),r=this.length-this.scanIdentical(t,-1),s=new sl(this),i=new sl(t);for(let o=n,a=n;;){if(s.next(o),i.next(o),o=0,s.lineBreak!=i.lineBreak||s.done!=i.done||s.value!=i.value)return!1;if(a+=s.value.length,s.done||a>=r)return!0}}iter(t=1){return new sl(this,t)}iterRange(t,n=this.length){return new Ik(this,t,n)}iterLines(t,n){let r;if(t==null)r=this.iter();else{n==null&&(n=this.lines+1);let s=this.line(t).from;r=this.iterRange(s,Math.max(s,n==this.lines+1?this.length:n<=1?0:this.line(n-1).to))}return new kk(r)}toString(){return this.sliceString(0)}toJSON(){let t=[];return this.flatten(t),t}constructor(){}static of(t){if(t.length==0)throw new RangeError("A document must have at least one line");return t.length==1&&!t[0]?Ak.empty:t.length<=32?new Zn(t):qu.from(Zn.split(t,[]))}},Zn=class Er extends Fe{constructor(t,n=$9(t)){super(),this.text=t,this.length=n}get lines(){return this.text.length}get children(){return null}lineInner(t,n,r,s){for(let i=0;;i++){let o=this.text[i],a=s+o.length;if((n?r:a)>=t)return new W9(s,a,r,o);s=a+1,r++}}decompose(t,n,r,s){let i=t<=0&&n>=this.length?this:new Er(AS(this.text,t,n),Math.min(n,this.length)-Math.max(0,t));if(s&1){let o=r.pop(),a=Ku(i.text,o.text.slice(),0,i.length);if(a.length<=32)r.push(new Er(a,o.length+i.length));else{let l=a.length>>1;r.push(new Er(a.slice(0,l)),new Er(a.slice(l)))}}else r.push(i)}replace(t,n,r){if(!(r instanceof Er))return super.replace(t,n,r);[t,n]=Vo(this,t,n);let s=Ku(this.text,Ku(r.text,AS(this.text,0,t)),n),i=this.length+r.length-(n-t);return s.length<=32?new Er(s,i):qu.from(Er.split(s,[]),i)}sliceString(t,n=this.length,r=`
|
|
70
|
+
`){[t,n]=Vo(this,t,n);let s="";for(let i=0,o=0;i<=n&&o<this.text.length;o++){let a=this.text[o],l=i+a.length;i>t&&o&&(s+=r),t<l&&n>i&&(s+=a.slice(Math.max(0,t-i),n-i)),i=l+1}return s}flatten(t){for(let n of this.text)t.push(n)}scanIdentical(){return 0}static split(t,n){let r=[],s=-1;for(let i of t)r.push(i),s+=i.length+1,r.length==32&&(n.push(new Er(r,s)),r=[],s=-1);return s>-1&&n.push(new Er(r,s)),n}},qu=class lo extends Fe{constructor(t,n){super(),this.children=t,this.length=n,this.lines=0;for(let r of t)this.lines+=r.lines}lineInner(t,n,r,s){for(let i=0;;i++){let o=this.children[i],a=s+o.length,l=r+o.lines-1;if((n?l:a)>=t)return o.lineInner(t,n,r,s);s=a+1,r=l+1}}decompose(t,n,r,s){for(let i=0,o=0;o<=n&&i<this.children.length;i++){let a=this.children[i],l=o+a.length;if(t<=l&&n>=o){let c=s&((o<=t?1:0)|(l>=n?2:0));o>=t&&l<=n&&!c?r.push(a):a.decompose(t-o,n-o,r,c)}o=l+1}}replace(t,n,r){if([t,n]=Vo(this,t,n),r.lines<this.lines)for(let s=0,i=0;s<this.children.length;s++){let o=this.children[s],a=i+o.length;if(t>=i&&n<=a){let l=o.replace(t-i,n-i,r),c=this.lines-o.lines+l.lines;if(l.lines<c>>4&&l.lines>c>>6){let u=this.children.slice();return u[s]=l,new lo(u,this.length-(n-t)+r.length)}return super.replace(i,a,l)}i=a+1}return super.replace(t,n,r)}sliceString(t,n=this.length,r=`
|
|
71
|
+
`){[t,n]=Vo(this,t,n);let s="";for(let i=0,o=0;i<this.children.length&&o<=n;i++){let a=this.children[i],l=o+a.length;o>t&&i&&(s+=r),t<l&&n>o&&(s+=a.sliceString(t-o,n-o,r)),o=l+1}return s}flatten(t){for(let n of this.children)n.flatten(t)}scanIdentical(t,n){if(!(t instanceof lo))return 0;let r=0,[s,i,o,a]=n>0?[0,0,this.children.length,t.children.length]:[this.children.length-1,t.children.length-1,-1,-1];for(;;s+=n,i+=n){if(s==o||i==a)return r;let l=this.children[s],c=t.children[i];if(l!=c)return r+l.scanIdentical(c,n);r+=l.length+1}}static from(t,n=t.reduce((r,s)=>r+s.length+1,-1)){let r=0;for(let f of t)r+=f.lines;if(r<32){let f=[];for(let B of t)B.flatten(f);return new Zn(f,n)}let s=Math.max(32,r>>5),i=s<<1,o=s>>1,a=[],l=0,c=-1,u=[];function d(f){let B;if(f.lines>i&&f instanceof lo)for(let g of f.children)d(g);else f.lines>o&&(l>o||!l)?(h(),a.push(f)):f instanceof Zn&&l&&(B=u[u.length-1])instanceof Zn&&f.lines+B.lines<=32?(l+=f.lines,c+=f.length+1,u[u.length-1]=new Zn(B.text.concat(f.text),B.length+1+f.length)):(l+f.lines>s&&h(),l+=f.lines,c+=f.length+1,u.push(f))}function h(){l!=0&&(a.push(u.length==1?u[0]:lo.from(u,c)),c=-1,l=u.length=0)}for(let f of t)d(f);return h(),a.length==1?a[0]:new lo(a,n)}};Fe.empty=new Zn([""],0);function $9(e){let t=-1;for(let n of e)t+=n.length+1;return t}function Ku(e,t,n=0,r=1e9){for(let s=0,i=0,o=!0;i<e.length&&s<=r;i++){let a=e[i],l=s+a.length;l>=n&&(l>r&&(a=a.slice(0,r-s)),s<n&&(a=a.slice(n-s)),o?(t[t.length-1]+=a,o=!1):t.push(a)),s=l+1}return t}function AS(e,t,n){return Ku(e,[""],t,n)}var sl=class{constructor(e,t=1){this.dir=t,this.done=!1,this.lineBreak=!1,this.value="",this.nodes=[e],this.offsets=[t>0?1:(e instanceof Zn?e.text.length:e.children.length)<<1]}nextInner(e,t){for(this.done=this.lineBreak=!1;;){let n=this.nodes.length-1,r=this.nodes[n],s=this.offsets[n],i=s>>1,o=r instanceof Zn?r.text.length:r.children.length;if(i==(t>0?o:0)){if(n==0)return this.done=!0,this.value="",this;t>0&&this.offsets[n-1]++,this.nodes.pop(),this.offsets.pop()}else if((s&1)==(t>0?0:1)){if(this.offsets[n]+=t,e==0)return this.lineBreak=!0,this.value=`
|
|
72
|
+
`,this;e--}else if(r instanceof Zn){let a=r.text[i+(t<0?-1:0)];if(this.offsets[n]+=t,a.length>Math.max(0,e))return this.value=e==0?a:t>0?a.slice(e):a.slice(0,a.length-e),this;e-=a.length}else{let a=r.children[i+(t<0?-1:0)];e>a.length?(e-=a.length,this.offsets[n]+=t):(t<0&&this.offsets[n]--,this.nodes.push(a),this.offsets.push(t>0?1:(a instanceof Zn?a.text.length:a.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}},Ik=class{constructor(e,t,n){this.value="",this.done=!1,this.cursor=new sl(e,t>n?-1:1),this.pos=t>n?e.length:0,this.from=Math.min(t,n),this.to=Math.max(t,n)}nextInner(e,t){if(t<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;e+=Math.max(0,t<0?this.pos-this.to:this.from-this.pos);let n=t<0?this.pos-this.from:this.to-this.pos;e>n&&(e=n),n-=e;let{value:r}=this.cursor.next(e);return this.pos+=(r.length+e)*t,this.value=r.length<=n?r:t<0?r.slice(r.length-n):r.slice(0,n),this.done=!this.value,this}next(e=0){return e<0?e=Math.max(e,this.from-this.pos):e>0&&(e=Math.min(e,this.to-this.pos)),this.nextInner(e,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&this.value!=""}},kk=class{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:t,lineBreak:n,value:r}=this.inner.next(e);return t&&this.afterBreak?(this.value="",this.afterBreak=!1):t?(this.done=!0,this.value=""):n?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=r,this.afterBreak=!1),this}get lineBreak(){return!1}};typeof Symbol<"u"&&(Fe.prototype[Symbol.iterator]=function(){return this.iter()},sl.prototype[Symbol.iterator]=Ik.prototype[Symbol.iterator]=kk.prototype[Symbol.iterator]=function(){return this});var W9=class{constructor(e,t,n,r){this.from=e,this.to=t,this.number=n,this.text=r}get length(){return this.to-this.from}};function Vo(e,t,n){return t=Math.max(0,Math.min(e.length,t)),[t,Math.max(t,Math.min(e.length,n))]}function Wt(e,t,n=!0,r=!0){return U9(e,t,n,r)}function q9(e){return e>=56320&&e<57344}function K9(e){return e>=55296&&e<56320}function J9(e,t){let n=e.charCodeAt(t);if(!K9(n)||t+1==e.length)return n;let r=e.charCodeAt(t+1);return q9(r)?(n-55296<<10)+(r-56320)+65536:n}function Q9(e){return e<65536?1:2}var mm=/\r\n?|\n/,xn=(function(e){return e[e.Simple=0]="Simple",e[e.TrackDel=1]="TrackDel",e[e.TrackBefore=2]="TrackBefore",e[e.TrackAfter=3]="TrackAfter",e})(xn||(xn={})),Do=class Ju{constructor(t){this.sections=t}get length(){let t=0;for(let n=0;n<this.sections.length;n+=2)t+=this.sections[n];return t}get newLength(){let t=0;for(let n=0;n<this.sections.length;n+=2){let r=this.sections[n+1];t+=r<0?this.sections[n]:r}return t}get empty(){return this.sections.length==0||this.sections.length==2&&this.sections[1]<0}iterGaps(t){for(let n=0,r=0,s=0;n<this.sections.length;){let i=this.sections[n++],o=this.sections[n++];o<0?(t(r,s,i),s+=i):s+=o,r+=i}}iterChangedRanges(t,n=!1){gm(this,t,n)}get invertedDesc(){let t=[];for(let n=0;n<this.sections.length;){let r=this.sections[n++],s=this.sections[n++];s<0?t.push(r,s):t.push(s,r)}return new Ju(t)}composeDesc(t){return this.empty?t:t.empty?this:Rk(this,t)}mapDesc(t,n=!1){return t.empty?this:Cm(this,t,n)}mapPos(t,n=-1,r=xn.Simple){let s=0,i=0;for(let o=0;o<this.sections.length;){let a=this.sections[o++],l=this.sections[o++],c=s+a;if(l<0){if(c>t)return i+(t-s);i+=a}else{if(r!=xn.Simple&&c>=t&&(r==xn.TrackDel&&s<t&&c>t||r==xn.TrackBefore&&s<t||r==xn.TrackAfter&&c>t))return null;if(c>t||c==t&&n<0&&!a)return t==s||n<0?i:i+l;i+=l}s=c}if(t>s)throw new RangeError(`Position ${t} is out of range for changeset of length ${s}`);return i}touchesRange(t,n=t){for(let r=0,s=0;r<this.sections.length&&s<=n;){let i=this.sections[r++],o=this.sections[r++],a=s+i;if(o>=0&&s<=n&&a>=t)return s<t&&a>n?"cover":!0;s=a}return!1}toString(){let t="";for(let n=0;n<this.sections.length;){let r=this.sections[n++],s=this.sections[n++];t+=(t?" ":"")+r+(s>=0?":"+s:"")}return t}toJSON(){return this.sections}static fromJSON(t){if(!Array.isArray(t)||t.length%2||t.some(n=>typeof n!="number"))throw new RangeError("Invalid JSON representation of ChangeDesc");return new Ju(t)}static create(t){return new Ju(t)}},ur=class Es extends Do{constructor(t,n){super(t),this.inserted=n}apply(t){if(this.length!=t.length)throw new RangeError("Applying change set to a document with the wrong length");return gm(this,(n,r,s,i,o)=>t=t.replace(s,s+(r-n),o),!1),t}mapDesc(t,n=!1){return Cm(this,t,n,!0)}invert(t){let n=this.sections.slice(),r=[];for(let s=0,i=0;s<n.length;s+=2){let o=n[s],a=n[s+1];if(a>=0){n[s]=a,n[s+1]=o;let l=s>>1;for(;r.length<l;)r.push(Fe.empty);r.push(o?t.slice(i,i+o):Fe.empty)}i+=o}return new Es(n,r)}compose(t){return this.empty?t:t.empty?this:Rk(this,t,!0)}map(t,n=!1){return t.empty?this:Cm(this,t,n,!0)}iterChanges(t,n=!1){gm(this,t,n)}get desc(){return Do.create(this.sections)}filter(t){let n=[],r=[],s=[],i=new Ll(this);e:for(let o=0,a=0;;){let l=o==t.length?1e9:t[o++];for(;a<l||a==l&&i.len==0;){if(i.done)break e;let u=Math.min(i.len,l-a);$t(s,u,-1);let d=i.ins==-1?-1:i.off==0?i.ins:0;$t(n,u,d),d>0&&Ps(r,n,i.text),i.forward(u),a+=u}let c=t[o++];for(;a<c;){if(i.done)break e;let u=Math.min(i.len,c-a);$t(n,u,-1),$t(s,u,i.ins==-1?-1:i.off==0?i.ins:0),i.forward(u),a+=u}}return{changes:new Es(n,r),filtered:Do.create(s)}}toJSON(){let t=[];for(let n=0;n<this.sections.length;n+=2){let r=this.sections[n],s=this.sections[n+1];s<0?t.push(r):s==0?t.push([r]):t.push([r].concat(this.inserted[n>>1].toJSON()))}return t}static of(t,n,r){let s=[],i=[],o=0,a=null;function l(u=!1){if(!u&&!s.length)return;o<n&&$t(s,n-o,-1);let d=new Es(s,i);a=a?a.compose(d.map(a)):d,s=[],i=[],o=0}function c(u){if(Array.isArray(u))for(let d of u)c(d);else if(u instanceof Es){if(u.length!=n)throw new RangeError(`Mismatched change set length (got ${u.length}, expected ${n})`);l(),a=a?a.compose(u.map(a)):u}else{let{from:d,to:h=d,insert:f}=u;if(d>h||d<0||h>n)throw new RangeError(`Invalid change range ${d} to ${h} (in doc of length ${n})`);let B=f?typeof f=="string"?Fe.of(f.split(r||mm)):f:Fe.empty,g=B.length;if(d==h&&g==0)return;d<o&&l(),d>o&&$t(s,d-o,-1),$t(s,h-d,g),Ps(i,s,B),o=h}}return c(t),l(!a),a}static empty(t){return new Es(t?[t,-1]:[],[])}static fromJSON(t){if(!Array.isArray(t))throw new RangeError("Invalid JSON representation of ChangeSet");let n=[],r=[];for(let s=0;s<t.length;s++){let i=t[s];if(typeof i=="number")n.push(i,-1);else{if(!Array.isArray(i)||typeof i[0]!="number"||i.some((o,a)=>a&&typeof o!="string"))throw new RangeError("Invalid JSON representation of ChangeSet");if(i.length==1)n.push(i[0],0);else{for(;r.length<s;)r.push(Fe.empty);r[s]=Fe.of(i.slice(1)),n.push(i[0],r[s].length)}}}return new Es(n,r)}static createSet(t,n){return new Es(t,n)}};function $t(e,t,n,r=!1){if(t==0&&n<=0)return;let s=e.length-2;s>=0&&n<=0&&n==e[s+1]?e[s]+=t:s>=0&&t==0&&e[s]==0?e[s+1]+=n:r?(e[s]+=t,e[s+1]+=n):e.push(t,n)}function Ps(e,t,n){if(n.length==0)return;let r=t.length-2>>1;if(r<e.length)e[e.length-1]=e[e.length-1].append(n);else{for(;e.length<r;)e.push(Fe.empty);e.push(n)}}function gm(e,t,n){let r=e.inserted;for(let s=0,i=0,o=0;o<e.sections.length;){let a=e.sections[o++],l=e.sections[o++];if(l<0)s+=a,i+=a;else{let c=s,u=i,d=Fe.empty;for(;c+=a,u+=l,l&&r&&(d=d.append(r[o-2>>1])),!(n||o==e.sections.length||e.sections[o+1]<0);)a=e.sections[o++],l=e.sections[o++];t(s,c,i,u,d),s=c,i=u}}}function Cm(e,t,n,r=!1){let s=[],i=r?[]:null,o=new Ll(e),a=new Ll(t);for(let l=-1;;){if(o.done&&a.len||a.done&&o.len)throw new Error("Mismatched change set lengths");if(o.ins==-1&&a.ins==-1){let c=Math.min(o.len,a.len);$t(s,c,-1),o.forward(c),a.forward(c)}else if(a.ins>=0&&(o.ins<0||l==o.i||o.off==0&&(a.len<o.len||a.len==o.len&&!n))){let c=a.len;for($t(s,a.ins,-1);c;){let u=Math.min(o.len,c);o.ins>=0&&l<o.i&&o.len<=u&&($t(s,0,o.ins),i&&Ps(i,s,o.text),l=o.i),o.forward(u),c-=u}a.next()}else if(o.ins>=0){let c=0,u=o.len;for(;u;)if(a.ins==-1){let d=Math.min(u,a.len);c+=d,u-=d,a.forward(d)}else if(a.ins==0&&a.len<u)u-=a.len,a.next();else break;$t(s,c,l<o.i?o.ins:0),i&&l<o.i&&Ps(i,s,o.text),l=o.i,o.forward(o.len-u)}else{if(o.done&&a.done)return i?ur.createSet(s,i):Do.create(s);throw new Error("Mismatched change set lengths")}}}function Rk(e,t,n=!1){let r=[],s=n?[]:null,i=new Ll(e),o=new Ll(t);for(let a=!1;;){if(i.done&&o.done)return s?ur.createSet(r,s):Do.create(r);if(i.ins==0)$t(r,i.len,0,a),i.next();else if(o.len==0&&!o.done)$t(r,0,o.ins,a),s&&Ps(s,r,o.text),o.next();else{if(i.done||o.done)throw new Error("Mismatched change set lengths");{let l=Math.min(i.len2,o.len),c=r.length;if(i.ins==-1){let u=o.ins==-1?-1:o.off?0:o.ins;$t(r,l,u,a),s&&u&&Ps(s,r,o.text)}else o.ins==-1?($t(r,i.off?0:i.len,l,a),s&&Ps(s,r,i.textBit(l))):($t(r,i.off?0:i.len,o.off?0:o.ins,a),s&&!o.off&&Ps(s,r,o.text));a=(i.ins>l||o.ins>=0&&o.len>l)&&(a||r.length>c),i.forward2(l),o.forward(l)}}}}var Ll=class{constructor(e){this.set=e,this.i=0,this.next()}next(){let{sections:e}=this.set;this.i<e.length?(this.len=e[this.i++],this.ins=e[this.i++]):(this.len=0,this.ins=-2),this.off=0}get done(){return this.ins==-2}get len2(){return this.ins<0?this.len:this.ins}get text(){let{inserted:e}=this.set,t=this.i-2>>1;return t>=e.length?Fe.empty:e[t]}textBit(e){let{inserted:t}=this.set,n=this.i-2>>1;return n>=t.length&&!e?Fe.empty:t[n].slice(this.off,e==null?void 0:this.off+e)}forward(e){e==this.len?this.next():(this.len-=e,this.off+=e)}forward2(e){this.ins==-1?this.forward(e):e==this.ins?this.next():(this.ins-=e,this.off+=e)}},ga=class vm{constructor(t,n,r,s){this.from=t,this.to=n,this.flags=r,this.goalColumn=s}get anchor(){return this.flags&32?this.to:this.from}get head(){return this.flags&32?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return this.flags&8?-1:this.flags&16?1:0}get undirectional(){return(this.flags&64)>0}get bidiLevel(){let t=this.flags&7;return t==7?null:t}map(t,n=-1){let r,s;return this.empty?r=s=t.mapPos(this.from,n):(r=t.mapPos(this.from,1),s=t.mapPos(this.to,-1)),r==this.from&&s==this.to?this:new vm(r,s,this.flags,this.goalColumn)}extend(t,n=t,r=0){if(t<=this.anchor&&n>=this.anchor)return se.range(t,n,void 0,void 0,r);let s=Math.abs(t-this.anchor)>Math.abs(n-this.anchor)?t:n;return se.range(this.anchor,s,void 0,void 0,r)}eq(t,n=!1){return this.anchor==t.anchor&&this.head==t.head&&this.goalColumn==t.goalColumn&&(!n||!this.empty||this.assoc==t.assoc)}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(t){if(!t||typeof t.anchor!="number"||typeof t.head!="number")throw new RangeError("Invalid JSON representation for SelectionRange");return se.range(t.anchor,t.head)}static create(t,n,r,s){return new vm(t,n,r,s)}},se=class bn{constructor(t,n){this.ranges=t,this.mainIndex=n}map(t,n=-1){return t.empty?this:bn.create(this.ranges.map(r=>r.map(t,n)),this.mainIndex)}eq(t,n=!1){if(this.ranges.length!=t.ranges.length||this.mainIndex!=t.mainIndex)return!1;for(let r=0;r<this.ranges.length;r++)if(!this.ranges[r].eq(t.ranges[r],n))return!1;return!0}get main(){return this.ranges[this.mainIndex]}asSingle(){return this.ranges.length==1?this:new bn([this.main],0)}addRange(t,n=!0){return bn.create([t].concat(this.ranges),n?0:this.mainIndex+1)}replaceRange(t,n=this.mainIndex){let r=this.ranges.slice();return r[n]=t,bn.create(r,this.mainIndex)}toJSON(){return{ranges:this.ranges.map(t=>t.toJSON()),main:this.mainIndex}}static fromJSON(t){if(!t||!Array.isArray(t.ranges)||typeof t.main!="number"||t.main>=t.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new bn(t.ranges.map(n=>ga.fromJSON(n)),t.main)}static single(t,n=t){return new bn([bn.range(t,n)],0)}static create(t,n=0){if(t.length==0)throw new RangeError("A selection needs at least one range");for(let r=0,s=0;s<t.length;s++){let i=t[s];if(i.empty?i.from<=r:i.from<r)return bn.normalized(t.slice(),n);r=i.to}return new bn(t,n)}static cursor(t,n=0,r,s){return ga.create(t,t,(n==0?0:n<0?8:16)|(r==null?7:Math.min(6,r)),s)}static range(t,n,r,s,i){let o=s==null?7:Math.min(6,s);return!i&&t!=n&&(i=n<t?1:-1),i&&(o|=i<0?8:16),n<t?ga.create(n,t,o|32,r):ga.create(t,n,o,r)}static undirectionalRange(t,n){return ga.create(t,n,64,void 0)}static normalized(t,n=0){let r=t[n];t.sort((s,i)=>s.from-i.from),n=t.indexOf(r);for(let s=1;s<t.length;s++){let i=t[s],o=t[s-1];if(i.empty?i.from<=o.to:i.from<o.to){let a=o.from,l=Math.max(i.to,o.to);s<=n&&n--,t.splice(--s,2,i.anchor>i.head?bn.range(l,a):bn.range(a,l))}}return new bn(t,n)}};function Ok(e,t){for(let n of e.ranges)if(n.to>t)throw new RangeError("Selection points outside of document")}var iv=0,Ce=class Mk{constructor(t,n,r,s,i){this.combine=t,this.compareInput=n,this.compare=r,this.isStatic=s,this.id=iv++,this.default=t([]),this.extensions=typeof i=="function"?i(this):i}get reader(){return this}static define(t={}){return new Mk(t.combine||(n=>n),t.compareInput||((n,r)=>n===r),t.compare||(t.combine?(n,r)=>n===r:ov),!!t.static,t.enables)}of(t){return new Qu([],this,0,t)}compute(t,n){if(this.isStatic)throw new Error("Can't compute a static facet");return new Qu(t,this,1,n)}computeN(t,n){if(this.isStatic)throw new Error("Can't compute a static facet");return new Qu(t,this,2,n)}from(t,n){return n||(n=r=>r),this.compute([t],r=>n(r.field(t)))}};function ov(e,t){return e==t||e.length==t.length&&e.every((n,r)=>n===t[r])}var Qu=class{constructor(e,t,n,r){this.dependencies=e,this.facet=t,this.type=n,this.value=r,this.id=iv++}dynamicSlot(e){var t;let n=this.value,r=this.facet.compareInput,s=this.id,i=e[s]>>1,o=this.type==2,a=!1,l=!1,c=[];for(let u of this.dependencies)u=="doc"?a=!0:u=="selection"?l=!0:(((t=e[u.id])!==null&&t!==void 0?t:1)&1)==0&&c.push(e[u.id]);return{create(u){return u.values[i]=n(u),1},update(u,d){if(a&&d.docChanged||l&&(d.docChanged||d.selection)||ym(u,c)){let h=n(u);if(o?!IS(h,u.values[i],r):!r(h,u.values[i]))return u.values[i]=h,1}return 0},reconfigure:(u,d)=>{let h,f=d.config.address[s];if(f!=null){let B=Od(d,f);if(this.dependencies.every(g=>g instanceof Ce?d.facet(g)===u.facet(g):g instanceof gc?d.field(g,!1)==u.field(g,!1):!0)||(o?IS(h=n(u),B,r):r(h=n(u),B)))return u.values[i]=B,0}else h=n(u);return u.values[i]=h,1}}}get extension(){return this}};function IS(e,t,n){if(e.length!=t.length)return!1;for(let r=0;r<e.length;r++)if(!n(e[r],t[r]))return!1;return!0}function ym(e,t){let n=!1;for(let r of t)il(e,r)&1&&(n=!0);return n}function Y9(e,t,n){let r=n.map(l=>e[l.id]),s=n.map(l=>l.type),i=r.filter(l=>!(l&1)),o=e[t.id]>>1;function a(l){let c=[];for(let u=0;u<r.length;u++){let d=Od(l,r[u]);if(s[u]==2)for(let h of d)c.push(h);else c.push(d)}return t.combine(c)}return{create(l){for(let c of r)il(l,c);return l.values[o]=a(l),1},update(l,c){if(!ym(l,i))return 0;let u=a(l);return t.compare(u,l.values[o])?0:(l.values[o]=u,1)},reconfigure(l,c){let u=ym(l,r),d=c.config.facets[t.id],h=c.facet(t);if(d&&!u&&ov(n,d))return l.values[o]=h,0;let f=a(l);return t.compare(f,h)?(l.values[o]=h,0):(l.values[o]=f,1)}}}var nu=Ce.define({static:!0}),gc=class Nk{constructor(t,n,r,s,i){this.id=t,this.createF=n,this.updateF=r,this.compareF=s,this.spec=i,this.provides=void 0}static define(t){let n=new Nk(iv++,t.create,t.update,t.compare||((r,s)=>r===s),t);return t.provide&&(n.provides=t.provide(n)),n}create(t){let n=t.facet(nu).find(r=>r.field==this);return(n?.create||this.createF)(t)}slot(t){let n=t[this.id]>>1;return{create:r=>(r.values[n]=this.create(r),1),update:(r,s)=>{let i=r.values[n],o=this.updateF(i,s);return this.compareF(i,o)?0:(r.values[n]=o,1)},reconfigure:(r,s)=>{let i=r.facet(nu),o=s.facet(nu),a;return(a=i.find(l=>l.field==this))&&a!=o.find(l=>l.field==this)?(r.values[n]=a.create(r),1):s.config.address[this.id]!=null?(r.values[n]=s.field(this),0):(r.values[n]=this.create(r),1)}}}init(t){return[this,nu.of({field:this,create:t})]}get extension(){return this}},mi={lowest:4,low:3,default:2,high:1,highest:0};function Ca(e){return t=>new Pk(t,e)}var Nh={highest:Ca(mi.highest),high:Ca(mi.high),default:Ca(mi.default),low:Ca(mi.low),lowest:Ca(mi.lowest)},Pk=class{constructor(e,t){this.inner=e,this.prec=t}get extension(){return this}},Lk=class _k{of(t){return new bm(this,t)}reconfigure(t){return _k.reconfigure.of({compartment:this,extension:t})}get(t){return t.config.compartments.get(this)}},bm=class{constructor(e,t){this.compartment=e,this.inner=t}get extension(){return this}},kS=class Fk{constructor(t,n,r,s,i,o){for(this.base=t,this.compartments=n,this.dynamicSlots=r,this.address=s,this.staticValues=i,this.facets=o,this.statusTemplate=[];this.statusTemplate.length<r.length;)this.statusTemplate.push(0)}staticFacet(t){let n=this.address[t.id];return n==null?t.default:this.staticValues[n>>1]}static resolve(t,n,r){let s=[],i=Object.create(null),o=new Map;for(let h of X9(t,n,o))h instanceof gc?s.push(h):(i[h.facet.id]||(i[h.facet.id]=[])).push(h);let a=Object.create(null),l=[],c=[];for(let h of s)a[h.id]=c.length<<1,c.push(f=>h.slot(f));let u=r?.config.facets;for(let h in i){let f=i[h],B=f[0].facet,g=u&&u[h]||[];if(f.every(C=>C.type==0))if(a[B.id]=l.length<<1|1,ov(g,f))l.push(r.facet(B));else{let C=B.combine(f.map(v=>v.value));l.push(r&&B.compare(C,r.facet(B))?r.facet(B):C)}else{for(let C of f)C.type==0?(a[C.id]=l.length<<1|1,l.push(C.value)):(a[C.id]=c.length<<1,c.push(v=>C.dynamicSlot(v)));a[B.id]=c.length<<1,c.push(C=>Y9(C,B,f))}}let d=c.map(h=>h(a));return new Fk(t,o,d,a,l,i)}};function X9(e,t,n){let r=[[],[],[],[],[]],s=new Map;function i(o,a){let l=s.get(o);if(l!=null){if(l<=a)return;let c=r[l].indexOf(o);c>-1&&r[l].splice(c,1),o instanceof bm&&n.delete(o.compartment)}if(s.set(o,a),Array.isArray(o))for(let c of o)i(c,a);else if(o instanceof bm){if(n.has(o.compartment))throw new RangeError("Duplicate use of compartment in extensions");let c=t.get(o.compartment)||o.inner;n.set(o.compartment,c),i(c,a)}else if(o instanceof Pk)i(o.inner,o.prec);else if(o instanceof gc)r[a].push(o),o.provides&&i(o.provides,a);else if(o instanceof Qu)r[a].push(o),o.facet.extensions&&i(o.facet.extensions,mi.default);else{let c=o.extension;if(!c)throw new Error(`Unrecognized extension value in extension set (${o}).`);if(c==o)throw new Error(`Unrecognized extension value in extension set (${o}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);i(c,a)}}return i(e,mi.default),r.reduce((o,a)=>o.concat(a))}function il(e,t){if(t&1)return 2;let n=t>>1,r=e.status[n];if(r==4)throw new Error("Cyclic dependency between fields and/or facets");if(r&2)return r;e.status[n]=4;let s=e.computeSlot(e,e.config.dynamicSlots[n]);return e.status[n]=2|s}function Od(e,t){return t&1?e.config.staticValues[t>>1]:e.values[t>>1]}var Hk=Ce.define(),Sm=Ce.define({combine:e=>e.some(t=>t),static:!0}),jk=Ce.define({combine:e=>e.length?e[0]:void 0,static:!0}),Gk=Ce.define(),Vk=Ce.define(),Uk=Ce.define(),zk=Ce.define({combine:e=>e.length?e[0]:!1}),Ui=class{constructor(e,t){this.type=e,this.value=t}static define(){return new Z9}},Z9=class{of(e){return new Ui(this,e)}},eQ=class{constructor(e){this.map=e}of(e){return new Tt(this,e)}},Tt=class $k{constructor(t,n){this.type=t,this.value=n}map(t){let n=this.type.map(this.value,t);return n===void 0?void 0:n==this.value?this:new $k(this.type,n)}is(t){return this.type==t}static define(t={}){return new eQ(t.map||(n=>n))}static mapEffects(t,n){if(!t.length)return t;let r=[];for(let s of t){let i=s.map(n);i&&r.push(i)}return r}};Tt.reconfigure=Tt.define();Tt.appendConfig=Tt.define();var ar=class La{constructor(t,n,r,s,i,o){this.startState=t,this.changes=n,this.selection=r,this.effects=s,this.annotations=i,this.scrollIntoView=o,this._doc=null,this._state=null,r&&Ok(r,n.newLength),i.some(a=>a.type==La.time)||(this.annotations=i.concat(La.time.of(Date.now())))}static create(t,n,r,s,i,o){return new La(t,n,r,s,i,o)}get newDoc(){return this._doc||(this._doc=this.changes.apply(this.startState.doc))}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){return this._state||this.startState.applyTransaction(this),this._state}annotation(t){for(let n of this.annotations)if(n.type==t)return n.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(t){let n=this.annotation(La.userEvent);return!!(n&&(n==t||n.length>t.length&&n.slice(0,t.length)==t&&n[t.length]=="."))}};ar.time=Ui.define();ar.userEvent=Ui.define();ar.addToHistory=Ui.define();ar.remote=Ui.define();function tQ(e,t){let n=[];for(let r=0,s=0;;){let i,o;if(r<e.length&&(s==t.length||t[s]>=e[r]))i=e[r++],o=e[r++];else if(s<t.length)i=t[s++],o=t[s++];else return n;!n.length||n[n.length-1]<i?n.push(i,o):n[n.length-1]<o&&(n[n.length-1]=o)}}function Wk(e,t,n){var r;let s,i,o;return n?(s=t.changes,i=ur.empty(t.changes.length),o=e.changes.compose(t.changes)):(s=t.changes.map(e.changes),i=e.changes.mapDesc(t.changes,!0),o=e.changes.compose(s)),{changes:o,selection:t.selection?t.selection.map(i):(r=e.selection)===null||r===void 0?void 0:r.map(s),effects:Tt.mapEffects(e.effects,s).concat(Tt.mapEffects(t.effects,i)),annotations:e.annotations.length?e.annotations.concat(t.annotations):t.annotations,scrollIntoView:e.scrollIntoView||t.scrollIntoView}}function Em(e,t,n){let r=t.selection,s=To(t.annotations);return t.userEvent&&(s=s.concat(ar.userEvent.of(t.userEvent))),{changes:t.changes instanceof ur?t.changes:ur.of(t.changes||[],n,e.facet(jk)),selection:r&&(r instanceof se?r:se.single(r.anchor,r.head)),effects:To(t.effects),annotations:s,scrollIntoView:!!t.scrollIntoView}}function qk(e,t,n){let r=Em(e,t.length?t[0]:{},e.doc.length);t.length&&t[0].filter===!1&&(n=!1);for(let i=1;i<t.length;i++){t[i].filter===!1&&(n=!1);let o=!!t[i].sequential;r=Wk(r,Em(e,t[i],o?r.changes.newLength:e.doc.length),o)}let s=ar.create(e,r.changes,r.selection,r.effects,r.annotations,r.scrollIntoView);return rQ(n?nQ(s):s)}function nQ(e){let t=e.startState,n=!0;for(let s of t.facet(Gk)){let i=s(e);if(i===!1){n=!1;break}Array.isArray(i)&&(n=n===!0?i:tQ(n,i))}if(n!==!0){let s,i;if(n===!1)i=e.changes.invertedDesc,s=ur.empty(t.doc.length);else{let o=e.changes.filter(n);s=o.changes,i=o.filtered.mapDesc(o.changes).invertedDesc}e=ar.create(t,s,e.selection&&e.selection.map(i),Tt.mapEffects(e.effects,i),e.annotations,e.scrollIntoView)}let r=t.facet(Vk);for(let s=r.length-1;s>=0;s--){let i=r[s](e);i instanceof ar?e=i:Array.isArray(i)&&i.length==1&&i[0]instanceof ar?e=i[0]:e=qk(t,To(i),!1)}return e}function rQ(e){let t=e.startState,n=t.facet(Uk),r=e;for(let s=n.length-1;s>=0;s--){let i=n[s](e);i&&Object.keys(i).length&&(r=Wk(r,Em(t,i,e.changes.newLength),!0))}return r==e?e:ar.create(t,e.changes,e.selection,r.effects,r.annotations,r.scrollIntoView)}var sQ=[];function To(e){return e==null?sQ:Array.isArray(e)?e:[e]}var ns=(function(e){return e[e.Word=0]="Word",e[e.Space=1]="Space",e[e.Other=2]="Other",e})(ns||(ns={})),iQ=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/,xm;try{xm=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function oQ(e){if(xm)return xm.test(e);for(let t=0;t<e.length;t++){let n=e[t];if(/\w/.test(n)||n>""&&(n.toUpperCase()!=n.toLowerCase()||iQ.test(n)))return!0}return!1}function aQ(e){return t=>{if(!/\S/.test(t))return ns.Space;if(oQ(t))return ns.Word;for(let n=0;n<e.length;n++)if(t.indexOf(e[n])>-1)return ns.Word;return ns.Other}}var bt=class qn{constructor(t,n,r,s,i,o){this.config=t,this.doc=n,this.selection=r,this.values=s,this.status=t.statusTemplate.slice(),this.computeSlot=i,o&&(o._state=this);for(let a=0;a<this.config.dynamicSlots.length;a++)il(this,a<<1);this.computeSlot=null}field(t,n=!0){let r=this.config.address[t.id];if(r==null){if(n)throw new RangeError("Field is not present in this state");return}return il(this,r),Od(this,r)}update(...t){return qk(this,t,!0)}applyTransaction(t){let n=this.config,{base:r,compartments:s}=n;for(let a of t.effects)a.is(Lk.reconfigure)?(n&&(s=new Map,n.compartments.forEach((l,c)=>s.set(c,l)),n=null),s.set(a.value.compartment,a.value.extension)):a.is(Tt.reconfigure)?(n=null,r=a.value):a.is(Tt.appendConfig)&&(n=null,r=To(r).concat(a.value));let i;n?i=t.startState.values.slice():(n=kS.resolve(r,s,this),i=new qn(n,this.doc,this.selection,n.dynamicSlots.map(()=>null),(a,l)=>l.reconfigure(a,this),null).values);let o=t.startState.facet(Sm)?t.newSelection:t.newSelection.asSingle();new qn(n,t.newDoc,o,i,(a,l)=>l.update(a,t),t)}replaceSelection(t){return typeof t=="string"&&(t=this.toText(t)),this.changeByRange(n=>({changes:{from:n.from,to:n.to,insert:t},range:se.cursor(n.from+t.length,-1)}))}changeByRange(t){let n=this.selection,r=t(n.ranges[0]),s=this.changes(r.changes),i=[r.range],o=To(r.effects);for(let a=1;a<n.ranges.length;a++){let l=t(n.ranges[a]),c=this.changes(l.changes),u=c.map(s);for(let h=0;h<a;h++)i[h]=i[h].map(u);let d=s.mapDesc(c,!0);i.push(l.range.map(d)),s=s.compose(u),o=Tt.mapEffects(o,u).concat(Tt.mapEffects(To(l.effects),d))}return{changes:s,selection:se.create(i,n.mainIndex),effects:o}}changes(t=[]){return t instanceof ur?t:ur.of(t,this.doc.length,this.facet(qn.lineSeparator))}toText(t){return Fe.of(t.split(this.facet(qn.lineSeparator)||mm))}sliceDoc(t=0,n=this.doc.length){return this.doc.sliceString(t,n,this.lineBreak)}facet(t){let n=this.config.address[t.id];return n==null?t.default:(il(this,n),Od(this,n))}toJSON(t){let n={doc:this.sliceDoc(),selection:this.selection.toJSON()};if(t)for(let r in t){let s=t[r];s instanceof gc&&this.config.address[s.id]!=null&&(n[r]=s.spec.toJSON(this.field(t[r]),this))}return n}static fromJSON(t,n={},r){if(!t||typeof t.doc!="string")throw new RangeError("Invalid JSON representation for EditorState");let s=[];if(r){for(let i in r)if(Object.prototype.hasOwnProperty.call(t,i)){let o=r[i],a=t[i];s.push(o.init(l=>o.spec.fromJSON(a,l)))}}return qn.create({doc:t.doc,selection:se.fromJSON(t.selection),extensions:n.extensions?s.concat([n.extensions]):s})}static create(t={}){let n=kS.resolve(t.extensions||[],new Map),r=t.doc instanceof Fe?t.doc:Fe.of((t.doc||"").split(n.staticFacet(qn.lineSeparator)||mm)),s=t.selection?t.selection instanceof se?t.selection:se.single(t.selection.anchor,t.selection.head):se.single(0);return Ok(s,r.length),n.staticFacet(Sm)||(s=s.asSingle()),new qn(n,r,s,n.dynamicSlots.map(()=>null),(i,o)=>o.create(i),null)}get tabSize(){return this.facet(qn.tabSize)}get lineBreak(){return this.facet(qn.lineSeparator)||`
|
|
73
|
+
`}get readOnly(){return this.facet(zk)}phrase(t,...n){for(let r of this.facet(qn.phrases))if(Object.prototype.hasOwnProperty.call(r,t)){t=r[t];break}return n.length&&(t=t.replace(/\$(\$|\d*)/g,(r,s)=>{if(s=="$")return"$";let i=+(s||1);return!i||i>n.length?r:n[i-1]})),t}languageDataAt(t,n,r=-1){let s=[];for(let i of this.facet(Hk))for(let o of i(this,n,r))Object.prototype.hasOwnProperty.call(o,t)&&s.push(o[t]);return s}charCategorizer(t){let n=this.languageDataAt("wordChars",t);return aQ(n.length?n[0]:"")}wordAt(t){let{text:n,from:r,length:s}=this.doc.lineAt(t),i=this.charCategorizer(t),o=t-r,a=t-r;for(;o>0;){let l=Wt(n,o,!1);if(i(n.slice(l,o))!=ns.Word)break;o=l}for(;a<s;){let l=Wt(n,a);if(i(n.slice(a,l))!=ns.Word)break;a=l}return o==a?null:se.range(o+r,a+r)}};bt.allowMultipleSelections=Sm;bt.tabSize=Ce.define({combine:e=>e.length?e[0]:4});bt.lineSeparator=jk;bt.readOnly=zk;bt.phrases=Ce.define({compare(e,t){let n=Object.keys(e),r=Object.keys(t);return n.length==r.length&&n.every(s=>e[s]==t[s])}});bt.languageData=Hk;bt.changeFilter=Gk;bt.transactionFilter=Vk;bt.transactionExtender=Uk;Lk.reconfigure=Tt.define();function av(e,t,n={}){let r={};for(let s of e)for(let i of Object.keys(s)){let o=s[i],a=r[i];if(a===void 0)r[i]=o;else if(!(a===o||o===void 0))if(Object.hasOwnProperty.call(n,i))r[i]=n[i](a,o);else throw new Error("Config merge conflict for field "+i)}for(let s in t)r[s]===void 0&&(r[s]=t[s]);return r}var Li=class{eq(e){return this==e}range(e,t=e){return wm.create(e,t,this)}};Li.prototype.startSide=Li.prototype.endSide=0;Li.prototype.point=!1;Li.prototype.mapMode=xn.TrackDel;function lv(e,t){return e==t||e.constructor==t.constructor&&e.eq(t)}var wm=class Kk{constructor(t,n,r){this.from=t,this.to=n,this.value=r}static create(t,n,r){return new Kk(t,n,r)}};function Dm(e,t){return e.from-t.from||e.value.startSide-t.value.startSide}var lQ=class Jk{constructor(t,n,r,s){this.from=t,this.to=n,this.value=r,this.maxPoint=s}get length(){return co(this.to)}findIndex(t,n,r,s=0){let i=r?this.to:this.from;for(let o=s,a=i.length;;){if(o==a)return o;let l=o+a>>1,c=i[l]-t||(r?this.value[l].endSide:this.value[l].startSide)-n;if(l==o)return c>=0?o:a;c>=0?a=l:o=l+1}}between(t,n,r,s){for(let i=this.findIndex(n,-1e9,!0),o=this.findIndex(r,1e9,!1,i);i<o;i++)if(s(this.from[i]+t,this.to[i]+t,this.value[i])===!1)return!1}map(t,n,r,s,i){let o=[],a=[],l=[],c=-1,u=-1;e:for(let d=0;d<this.value.length;d++){let h=this.value[d],f=this.from[d]+t,B=this.to[d]+t,g,C;if(f==B){let v=n.mapPos(f,h.startSide,h.mapMode);if(v==null||(g=C=v,h.startSide!=h.endSide&&(C=n.mapPos(f,h.endSide),C<g)))continue}else if(g=n.mapPos(f,h.startSide),C=n.mapPos(B,h.endSide),g>C||g==C&&h.startSide>0&&h.endSide<=0)continue;if(!((C-g||h.endSide-h.startSide)<0))if(c<0&&(c=g),h.point&&(u=Math.max(u,C-g)),(g-r||h.startSide-s)>=0)o.push(h),a.push(g-c),l.push(C-c),r=C,s=h.endSide;else{if(g==C)for(let v=o.length;v>0;v--){if((g-(l[v-1]+c)||h.startSide-o[v-1].endSide)>=0){o.splice(v,0,h),a.splice(v,0,g-c),l.splice(v,0,C-c);continue e}if((g-(a[v-1]+c)||h.endSide-o[v-1].startSide)>0)break}i(g,C,h)}}return{mapped:o.length?new Jk(a,l,o,u):null,pos:c}}},et=class zr{constructor(t,n,r,s){this.chunkPos=t,this.chunk=n,this.nextLayer=r,this.maxPoint=s}static create(t,n,r,s){return new zr(t,n,r,s)}get length(){let t=this.chunk.length-1;return t<0?0:Math.max(this.chunkEnd(t),this.nextLayer.length)}get size(){if(this.isEmpty)return 0;let t=this.nextLayer.size;for(let n of this.chunk)t+=n.value.length;return t}chunkEnd(t){return this.chunkPos[t]+this.chunk[t].length}update(t){let{add:n=[],sort:r=!1,filterFrom:s=0,filterTo:i=this.length}=t,o=t.filter;if(n.length==0&&!o)return this;if(r&&(n=n.slice().sort(Dm)),this.isEmpty)return n.length?zr.of(n):this;let a=new Yk(this,null,-1).goto(0),l=0,c=[],u=new Yu;for(;a.value||l<n.length;)if(l<n.length&&(a.from-n[l].from||a.startSide-n[l].value.startSide)>=0){let d=n[l++];u.addInner(d.from,d.to,d.value,!1)||c.push(d)}else a.rangeIndex==1&&a.chunkIndex<this.chunk.length&&(l==n.length||this.chunkEnd(a.chunkIndex)<n[l].from)&&(!o||s>this.chunkEnd(a.chunkIndex)||i<this.chunkPos[a.chunkIndex])&&u.addChunk(this.chunkPos[a.chunkIndex],this.chunk[a.chunkIndex])?a.nextChunk():((!o||s>a.to||i<a.from||o(a.from,a.to,a.value))&&(u.addInner(a.from,a.to,a.value,!1)||c.push(wm.create(a.from,a.to,a.value))),a.next());return u.finishInner(this.nextLayer.isEmpty&&!c.length?zr.empty:this.nextLayer.update({add:c,filter:o,filterFrom:s,filterTo:i}))}map(t){if(t.empty||this.isEmpty)return this;let n=[],r=[],s=-1,i,o=(l,c,u)=>{i||(i=new Yu),i.addRange(l,c,u,!1)};for(let l=0;l<this.chunk.length;l++){let c=this.chunkPos[l],u=this.chunk[l],d=t.touchesRange(c,c+u.length);if(d===!1)s=Math.max(s,u.maxPoint),n.push(u),r.push(t.mapPos(c));else if(d===!0){let[h,f]=n.length?[co(r)+co(n).length,co(co(n).value).endSide]:[-1,-1],{mapped:B,pos:g}=u.map(c,t,h,f,o);B&&(s=Math.max(s,B.maxPoint),n.push(B),r.push(g))}}let a=this.nextLayer.map(t);return i&&(a=i.finishInner(a)),n.length==0?a:new zr(r,n,a||zr.empty,s)}between(t,n,r){if(!this.isEmpty){for(let s=0;s<this.chunk.length;s++){let i=this.chunkPos[s],o=this.chunk[s];if(n>=i&&t<=i+o.length&&o.between(i,t-i,n-i,r)===!1)return}this.nextLayer.between(t,n,r)}}iter(t=0){return Tm.from([this]).goto(t)}get isEmpty(){return this.nextLayer==this}static iter(t,n=0){return Tm.from(t).goto(n)}static compare(t,n,r,s,i=-1){let o=t.filter(d=>d.maxPoint>0||!d.isEmpty&&d.maxPoint>=i),a=n.filter(d=>d.maxPoint>0||!d.isEmpty&&d.maxPoint>=i),l=RS(o,a,r),c=new va(o,l,i),u=new va(a,l,i);r.iterGaps((d,h,f)=>OS(c,d,u,h,f,s)),r.empty&&r.length==0&&OS(c,0,u,0,0,s)}static eq(t,n,r=0,s){s==null&&(s=999999999);let i=t.filter(u=>!u.isEmpty&&n.indexOf(u)<0),o=n.filter(u=>!u.isEmpty&&t.indexOf(u)<0);if(i.length!=o.length)return!1;if(!i.length)return!0;let a=RS(i,o),l=new va(i,a,0).goto(r),c=new va(o,a,0).goto(r);for(;;){if(l.to!=c.to||!Am(l.active,c.active)||l.point&&(!c.point||!lv(l.point,c.point)))return!1;if(l.to>s)return!0;l.next(),c.next()}}static spans(t,n,r,s,i=-1){let o=new va(t,null,i).goto(n),a=n,l=o.openStart;for(;;){let c=Math.min(o.to,r);if(o.point){let u=o.activeForPoint(o.to),d=o.pointFrom<n?u.length+1:o.point.startSide<0?u.length:Math.min(u.length,l);s.point(a,c,o.point,u,d,o.pointRank),l=Math.min(o.openEnd(c),u.length)}else c>a&&(s.span(a,c,o.active,l),l=o.openEnd(c));if(o.to>r)return l+(o.point&&o.to>r?1:0);a=o.to,o.next()}}static of(t,n=!1){let r=new Yu;for(let s of t instanceof wm?[t]:n?cQ(t):t)r.add(s.from,s.to,s.value);return r.finish()}static join(t){if(!t.length)return zr.empty;let n=co(t);for(let r=t.length-2;r>=0;r--)for(let s=t[r];s!=zr.empty;s=s.nextLayer)n=new zr(s.chunkPos,s.chunk,n,Math.max(s.maxPoint,n.maxPoint));return n}};et.empty=new et([],[],null,-1);function co(e){return e[e.length-1]}function cQ(e){if(e.length>1)for(let t=e[0],n=1;n<e.length;n++){let r=e[n];if(Dm(t,r)>0)return e.slice().sort(Dm);t=r}return e}et.empty.nextLayer=et.empty;var Yu=class Qk{finishChunk(t){this.chunks.push(new lQ(this.from,this.to,this.value,this.maxPoint)),this.chunkPos.push(this.chunkStart),this.chunkStart=-1,this.setMaxPoint=Math.max(this.setMaxPoint,this.maxPoint),this.maxPoint=-1,t&&(this.from=[],this.to=[],this.value=[])}constructor(){this.chunks=[],this.chunkPos=[],this.chunkStart=-1,this.last=null,this.lastFrom=-1e9,this.lastTo=-1e9,this.from=[],this.to=[],this.value=[],this.maxPoint=-1,this.setMaxPoint=-1,this.nextLayer=null}add(t,n,r){this.addRange(t,n,r,!0)}addRange(t,n,r,s){this.addInner(t,n,r,s)||(this.nextLayer||(this.nextLayer=new Qk)).addRange(t,n,r,s)}addInner(t,n,r,s){let i=t-this.lastTo||r.startSide-this.last.endSide;if(s&&i<=0&&(t-this.lastFrom||r.startSide-this.last.startSide)<0)throw new Error("Ranges must be added sorted by `from` position and `startSide`");return i<0?!1:(this.from.length==250&&this.finishChunk(!0),this.chunkStart<0&&(this.chunkStart=t),this.from.push(t-this.chunkStart),this.to.push(n-this.chunkStart),this.last=r,this.lastFrom=t,this.lastTo=n,this.value.push(r),r.point&&(this.maxPoint=Math.max(this.maxPoint,n-t)),!0)}addChunk(t,n){if((t-this.lastTo||n.value[0].startSide-this.last.endSide)<0)return!1;this.from.length&&this.finishChunk(!0),this.setMaxPoint=Math.max(this.setMaxPoint,n.maxPoint),this.chunks.push(n),this.chunkPos.push(t);let r=n.value.length-1;return this.last=n.value[r],this.lastFrom=n.from[r]+t,this.lastTo=n.to[r]+t,!0}finish(){return this.finishInner(et.empty)}finishInner(t){if(this.from.length&&this.finishChunk(!1),this.chunks.length==0)return t;let n=et.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(t):t,this.setMaxPoint);return this.from=null,n}};function RS(e,t,n){let r=new Map;for(let i of e)for(let o=0;o<i.chunk.length;o++)i.chunk[o].maxPoint<=0&&r.set(i.chunk[o],i.chunkPos[o]);let s=new Set;for(let i of t)for(let o=0;o<i.chunk.length;o++){let a=r.get(i.chunk[o]);a!=null&&(n?n.mapPos(a):a)==i.chunkPos[o]&&!n?.touchesRange(a,a+i.chunk[o].length)&&s.add(i.chunk[o])}return s}var Yk=class{constructor(e,t,n,r=0){this.layer=e,this.skip=t,this.minPoint=n,this.rank=r}get startSide(){return this.value?this.value.startSide:0}get endSide(){return this.value?this.value.endSide:0}goto(e,t=-1e9){return this.chunkIndex=this.rangeIndex=0,this.gotoInner(e,t,!1),this}gotoInner(e,t,n){for(;this.chunkIndex<this.layer.chunk.length;){let r=this.layer.chunk[this.chunkIndex];if(!(this.skip&&this.skip.has(r)||this.layer.chunkEnd(this.chunkIndex)<e||r.maxPoint<this.minPoint))break;this.chunkIndex++,n=!1}if(this.chunkIndex<this.layer.chunk.length){let r=this.layer.chunk[this.chunkIndex].findIndex(e-this.layer.chunkPos[this.chunkIndex],t,!0);(!n||this.rangeIndex<r)&&this.setRangeIndex(r)}this.next()}forward(e,t){(this.to-e||this.endSide-t)<0&&this.gotoInner(e,t,!0)}next(){for(;;)if(this.chunkIndex==this.layer.chunk.length){this.from=this.to=1e9,this.value=null;break}else{let e=this.layer.chunkPos[this.chunkIndex],t=this.layer.chunk[this.chunkIndex],n=e+t.from[this.rangeIndex];if(this.from=n,this.to=e+t.to[this.rangeIndex],this.value=t.value[this.rangeIndex],this.setRangeIndex(this.rangeIndex+1),this.minPoint<0||this.value.point&&this.to-this.from>=this.minPoint)break}}setRangeIndex(e){if(e==this.layer.chunk[this.chunkIndex].value.length){if(this.chunkIndex++,this.skip)for(;this.chunkIndex<this.layer.chunk.length&&this.skip.has(this.layer.chunk[this.chunkIndex]);)this.chunkIndex++;this.rangeIndex=0}else this.rangeIndex=e}nextChunk(){this.chunkIndex++,this.rangeIndex=0,this.next()}compare(e){return this.from-e.from||this.startSide-e.startSide||this.rank-e.rank||this.to-e.to||this.endSide-e.endSide}},Tm=class Xk{constructor(t){this.heap=t}static from(t,n=null,r=-1){let s=[];for(let i=0;i<t.length;i++)for(let o=t[i];!o.isEmpty;o=o.nextLayer)o.maxPoint>=r&&s.push(new Yk(o,n,r,i));return s.length==1?s[0]:new Xk(s)}get startSide(){return this.value?this.value.startSide:0}goto(t,n=-1e9){for(let r of this.heap)r.goto(t,n);for(let r=this.heap.length>>1;r>=0;r--)aB(this.heap,r);return this.next(),this}forward(t,n){for(let r of this.heap)r.forward(t,n);for(let r=this.heap.length>>1;r>=0;r--)aB(this.heap,r);(this.to-t||this.value.endSide-n)<0&&this.next()}next(){if(this.heap.length==0)this.from=this.to=1e9,this.value=null,this.rank=-1;else{let t=this.heap[0];this.from=t.from,this.to=t.to,this.value=t.value,this.rank=t.rank,t.value&&t.next(),aB(this.heap,0)}}};function aB(e,t){for(let n=e[t];;){let r=(t<<1)+1;if(r>=e.length)break;let s=e[r];if(r+1<e.length&&s.compare(e[r+1])>=0&&(s=e[r+1],r++),n.compare(s)<0)break;e[r]=n,e[t]=s,t=r}}var va=class{constructor(e,t,n){this.minPoint=n,this.active=[],this.activeTo=[],this.activeRank=[],this.minActive=-1,this.point=null,this.pointFrom=0,this.pointRank=0,this.to=-1e9,this.endSide=0,this.openStart=-1,this.cursor=Tm.from(e,t,n)}goto(e,t=-1e9){return this.cursor.goto(e,t),this.active.length=this.activeTo.length=this.activeRank.length=0,this.minActive=-1,this.to=e,this.endSide=t,this.openStart=-1,this.next(),this}forward(e,t){for(;this.minActive>-1&&(this.activeTo[this.minActive]-e||this.active[this.minActive].endSide-t)<0;)this.removeActive(this.minActive);this.cursor.forward(e,t)}removeActive(e){ru(this.active,e),ru(this.activeTo,e),ru(this.activeRank,e),this.minActive=MS(this.active,this.activeTo)}addActive(e){let t=0,{value:n,to:r,rank:s}=this.cursor;for(;t<this.activeRank.length&&(s-this.activeRank[t]||r-this.activeTo[t])>0;)t++;su(this.active,t,n),su(this.activeTo,t,r),su(this.activeRank,t,s),e&&su(e,t,this.cursor.from),this.minActive=MS(this.active,this.activeTo)}next(){let e=this.to,t=this.point;this.point=null;let n=this.openStart<0?[]:null;for(;;){let r=this.minActive;if(r>-1&&(this.activeTo[r]-this.cursor.from||this.active[r].endSide-this.cursor.startSide)<0){if(this.activeTo[r]>e){this.to=this.activeTo[r],this.endSide=this.active[r].endSide;break}this.removeActive(r),n&&ru(n,r)}else if(this.cursor.value)if(this.cursor.from>e){this.to=this.cursor.from,this.endSide=this.cursor.startSide;break}else{let s=this.cursor.value;if(!s.point)this.addActive(n),this.cursor.next();else if(t&&this.cursor.to==this.to&&this.cursor.from<this.cursor.to)this.cursor.next();else{this.point=s,this.pointFrom=this.cursor.from,this.pointRank=this.cursor.rank,this.to=this.cursor.to,this.endSide=s.endSide,this.cursor.next(),this.forward(this.to,this.endSide);break}}else{this.to=this.endSide=1e9;break}}if(n){this.openStart=0;for(let r=n.length-1;r>=0&&n[r]<e;r--)this.openStart++}}activeForPoint(e){if(!this.active.length)return this.active;let t=[];for(let n=this.active.length-1;n>=0&&!(this.activeRank[n]<this.pointRank);n--)(this.activeTo[n]>e||this.activeTo[n]==e&&this.active[n].endSide>=this.point.endSide)&&t.push(this.active[n]);return t.reverse()}openEnd(e){let t=0;for(let n=this.activeTo.length-1;n>=0&&this.activeTo[n]>e;n--)t++;return t}};function OS(e,t,n,r,s,i){e.goto(t),n.goto(r);let o=r+s,a=r,l=r-t,c=!!i.boundChange;for(let u=!1;;){let d=e.to+l-n.to,h=d||e.endSide-n.endSide,f=h<0?e.to+l:n.to,B=Math.min(f,o);if(e.point||n.point?(e.point&&n.point&&lv(e.point,n.point)&&Am(e.activeForPoint(e.to),n.activeForPoint(n.to))||i.comparePoint(a,B,e.point,n.point),u=!1):(u&&(i.boundChange(a),u=!1),B>a&&!Am(e.active,n.active)&&i.compareRange(a,B,e.active,n.active),c&&B<o&&(d||e.openEnd(f)!=n.openEnd(f))&&(u=!0)),f>o)break;a=f,h<=0&&e.next(),h>=0&&n.next()}}function Am(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!=t[n]&&!lv(e[n],t[n]))return!1;return!0}function ru(e,t){for(let n=t,r=e.length-1;n<r;n++)e[n]=e[n+1];e.pop()}function su(e,t,n){for(let r=e.length-1;r>=t;r--)e[r+1]=e[r];e[t]=n}function MS(e,t){let n=-1,r=1e9;for(let s=0;s<t.length;s++)(t[s]-r||e[s].endSide-e[n].endSide)<0&&(n=s,r=t[s]);return n}function Ph(e,t,n=e.length){let r=0;for(let s=0;s<n&&s<e.length;)e.charCodeAt(s)==9?(r+=t-r%t,s++):(r++,s=Wt(e,s));return r}function uQ(e,t,n,r){for(let s=0,i=0;;){if(i>=t)return s;if(s==e.length)break;i+=e.charCodeAt(s)==9?n-i%n:1,s=Wt(e,s)}return r===!0?-1:e.length}var Zk="ͼ",NS=typeof Symbol>"u"?"__ͼ":Symbol.for(Zk),Im=typeof Symbol>"u"?"__styleSet"+Math.floor(Math.random()*1e8):Symbol("styleSet"),PS=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{},Ws=class{constructor(e,t){this.rules=[];let{finish:n}=t||{};function r(i){return/^@/.test(i)?[i]:i.split(/,\s*/)}function s(i,o,a,l){let c=[],u=/^@(\w+)\b/.exec(i[0]),d=u&&u[1]=="keyframes";if(u&&o==null)return a.push(i[0]+";");for(let h in o){let f=o[h];if(/&/.test(h))s(h.split(/,\s*/).map(B=>i.map(g=>B.replace(/&/,g))).reduce((B,g)=>B.concat(g)),f,a);else if(f&&typeof f=="object"){if(!u)throw new RangeError("The value of a property ("+h+") should be a primitive value.");s(r(h),f,c,d)}else f!=null&&c.push(h.replace(/_.*/,"").replace(/[A-Z]/g,B=>"-"+B.toLowerCase())+": "+f+";")}(c.length||d)&&a.push((n&&!u&&!l?i.map(n):i).join(", ")+" {"+c.join(" ")+"}")}for(let i in e)s(r(i),e[i],this.rules)}getRules(){return this.rules.join(`
|
|
74
|
+
`)}static newName(){let e=PS[NS]||1;return PS[NS]=e+1,Zk+e.toString(36)}static mount(e,t,n){let r=e[Im],s=n&&n.nonce;r?s&&r.setNonce(s):r=new dQ(e,s),r.mount(Array.isArray(t)?t:[t],e)}},LS=new Map,dQ=class{constructor(e,t){let n=e.ownerDocument||e,r=n.defaultView;if(!e.head&&e.adoptedStyleSheets&&r.CSSStyleSheet){let s=LS.get(n);if(s)return e[Im]=s;this.sheet=new r.CSSStyleSheet,LS.set(n,this)}else this.styleTag=n.createElement("style"),t&&this.styleTag.setAttribute("nonce",t);this.modules=[],e[Im]=this}mount(e,t){let n=this.sheet,r=0,s=0;for(let i=0;i<e.length;i++){let o=e[i],a=this.modules.indexOf(o);if(a<s&&a>-1&&(this.modules.splice(a,1),s--,a=-1),a==-1){if(this.modules.splice(s++,0,o),n)for(let l=0;l<o.rules.length;l++)n.insertRule(o.rules[l],r++)}else{for(;s<a;)r+=this.modules[s++].rules.length;r+=o.rules.length,s++}}if(n)t.adoptedStyleSheets.indexOf(this.sheet)<0&&(t.adoptedStyleSheets=[this.sheet,...t.adoptedStyleSheets]);else{let i="";for(let a=0;a<this.modules.length;a++)i+=this.modules[a].getRules()+`
|
|
75
|
+
`;this.styleTag.textContent=i;let o=t.head||t;this.styleTag.parentNode!=o&&o.insertBefore(this.styleTag,o.firstChild)}}setNonce(e){this.styleTag&&this.styleTag.getAttribute("nonce")!=e&&this.styleTag.setAttribute("nonce",e)}},qs={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},_l={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},hQ=typeof navigator<"u"&&/Mac/.test(navigator.platform),fQ=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var Ft=0;Ft<10;Ft++)qs[48+Ft]=qs[96+Ft]=String(Ft);for(var Ft=1;Ft<=24;Ft++)qs[Ft+111]="F"+Ft;for(var Ft=65;Ft<=90;Ft++)qs[Ft]=String.fromCharCode(Ft+32),_l[Ft]=String.fromCharCode(Ft);for(var lB in qs)_l.hasOwnProperty(lB)||(_l[lB]=qs[lB]);function BQ(e){var t=!(hQ&&e.metaKey&&e.shiftKey&&!e.ctrlKey&&!e.altKey||fQ&&e.shiftKey&&e.key&&e.key.length==1||e.key=="Unidentified")&&e.key||(e.shiftKey?_l:qs)[e.keyCode]||e.key||"Unidentified";return t=="Esc"&&(t="Escape"),t=="Del"&&(t="Delete"),t=="Left"&&(t="ArrowLeft"),t=="Up"&&(t="ArrowUp"),t=="Right"&&(t="ArrowRight"),t=="Down"&&(t="ArrowDown"),t}var Yt=typeof navigator<"u"?navigator:{userAgent:"",vendor:"",platform:""},km=typeof document<"u"?document:{documentElement:{style:{}}},Rm=/Edge\/(\d+)/.exec(Yt.userAgent),eR=/MSIE \d/.test(Yt.userAgent),Om=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Yt.userAgent),Lh=!!(eR||Om||Rm),_S=!Lh&&/gecko\/(\d+)/i.test(Yt.userAgent),cB=!Lh&&/Chrome\/(\d+)/.exec(Yt.userAgent),FS="webkitFontSmoothing"in km.documentElement.style,Mm=!Lh&&/Apple Computer/.test(Yt.vendor),HS=Mm&&(/Mobile\/\w+/.test(Yt.userAgent)||Yt.maxTouchPoints>2),ue={mac:HS||/Mac/.test(Yt.platform),windows:/Win/.test(Yt.platform),linux:/Linux|X11/.test(Yt.platform),ie:Lh,ie_version:eR?km.documentMode||6:Om?+Om[1]:Rm?+Rm[1]:0,gecko:_S,gecko_version:_S?+(/Firefox\/(\d+)/.exec(Yt.userAgent)||[0,0])[1]:0,chrome:!!cB,chrome_version:cB?+cB[1]:0,ios:HS,android:/Android\b/.test(Yt.userAgent),webkit:FS,webkit_version:FS?+(/\bAppleWebKit\/(\d+)/.exec(Yt.userAgent)||[0,0])[1]:0,safari:Mm,safari_version:Mm?+(/\bVersion\/(\d+(\.\d+)?)/.exec(Yt.userAgent)||[0,0])[1]:0,tabSize:km.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"};function cv(e,t){for(let n in e)n=="class"&&t.class?t.class+=" "+e.class:n=="style"&&t.style?t.style+=";"+e.style:t[n]=e[n];return t}var Md=Object.create(null);function uv(e,t,n){if(e==t)return!0;e||(e=Md),t||(t=Md);let r=Object.keys(e),s=Object.keys(t);if(r.length-(n&&r.indexOf(n)>-1?1:0)!=s.length-(n&&s.indexOf(n)>-1?1:0))return!1;for(let i of r)if(i!=n&&(s.indexOf(i)==-1||e[i]!==t[i]))return!1;return!0}function pQ(e,t){for(let n=e.attributes.length-1;n>=0;n--){let r=e.attributes[n].name;t[r]==null&&e.removeAttribute(r)}for(let n in t){let r=t[n];n=="style"?e.style.cssText=r:e.getAttribute(n)!=r&&e.setAttribute(n,r)}}function jS(e,t,n){let r=!1;if(t)for(let s in t)n&&s in n||(r=!0,s=="style"?e.style.cssText="":e.removeAttribute(s));if(n)for(let s in n)t&&t[s]==n[s]||(r=!0,s=="style"?e.style.cssText=n[s]:e.setAttribute(s,n[s]));return r}function mQ(e){let t=Object.create(null);for(let n=0;n<e.attributes.length;n++){let r=e.attributes[n];t[r.name]=r.value}return t}var _h=class{eq(e){return!1}updateDOM(e,t,n){return!1}compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}get estimatedHeight(){return-1}get lineBreaks(){return 0}ignoreEvent(e){return!0}coordsAt(e,t,n){return null}get isHidden(){return!1}get editable(){return!1}destroy(e){}},Gt=(function(e){return e[e.Text=0]="Text",e[e.WidgetBefore=1]="WidgetBefore",e[e.WidgetAfter=2]="WidgetAfter",e[e.WidgetRange=3]="WidgetRange",e})(Gt||(Gt={})),rt=class extends Li{constructor(e,t,n,r){super(),this.startSide=e,this.endSide=t,this.widget=n,this.spec=r}get heightRelevant(){return!1}static mark(e){return new dv(e)}static widget(e){let t=Math.max(-1e4,Math.min(1e4,e.side||0)),n=!!e.block;return t+=n&&!e.inlineOrder?t>0?3e8:-4e8:t>0?1e8:-1e8,new Fl(e,t,t,n,e.widget||null,!1)}static replace(e){let t=!!e.block,n,r;if(e.isBlockGap)n=-5e8,r=4e8;else{let{start:s,end:i}=sR(e,t);n=(s?t?-3e8:-1:5e8)-1,r=(i?t?2e8:1:-6e8)+1}return new Fl(e,n,r,t,e.widget||null,!0)}static line(e){return new hv(e)}static set(e,t=!1){return et.of(e,t)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}};rt.none=et.empty;var dv=class tR extends rt{constructor(t){let{start:n,end:r}=sR(t);super(n?-1:5e8,r?1:-6e8,null,t),this.tagName=t.tagName||"span",this.attrs=t.class&&t.attributes?cv(t.attributes,{class:t.class}):t.class?{class:t.class}:t.attributes||Md}eq(t){return this==t||t instanceof tR&&this.tagName==t.tagName&&uv(this.attrs,t.attrs)}range(t,n=t){if(t>=n)throw new RangeError("Mark decorations may not be empty");return super.range(t,n)}};dv.prototype.point=!1;var hv=class nR extends rt{constructor(t){super(-2e8,-2e8,null,t)}eq(t){return t instanceof nR&&this.spec.class==t.spec.class&&uv(this.spec.attributes,t.spec.attributes)}range(t,n=t){if(n!=t)throw new RangeError("Line decoration ranges must be zero-length");return super.range(t,n)}};hv.prototype.mapMode=xn.TrackBefore;hv.prototype.point=!0;var Fl=class rR extends rt{constructor(t,n,r,s,i,o){super(n,r,i,t),this.block=s,this.isReplace=o,this.mapMode=s?n<=0?xn.TrackBefore:xn.TrackAfter:xn.TrackDel}get type(){return this.startSide!=this.endSide?Gt.WidgetRange:this.startSide<=0?Gt.WidgetBefore:Gt.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(t){return t instanceof rR&&gQ(this.widget,t.widget)&&this.block==t.block&&this.startSide==t.startSide&&this.endSide==t.endSide}range(t,n=t){if(this.isReplace&&(t>n||t==n&&this.startSide>0&&this.endSide<=0))throw new RangeError("Invalid range for replacement decoration");if(!this.isReplace&&n!=t)throw new RangeError("Widget decorations can only have zero-length ranges");return super.range(t,n)}};Fl.prototype.point=!0;function sR(e,t=!1){let{inclusiveStart:n,inclusiveEnd:r}=e;return n==null&&(n=e.inclusive),r==null&&(r=e.inclusive),{start:n??t,end:r??t}}function gQ(e,t){return e==t||!!(e&&t&&e.compare(t))}function Ao(e,t,n,r=0){let s=n.length-1;s>=0&&n[s]+r>=e?n[s]=Math.max(n[s],t):n.push(e,t)}var GS=class Nm extends Li{constructor(t,n,r){super(),this.tagName=t,this.attributes=n,this.rank=r}eq(t){return t==this||t instanceof Nm&&this.tagName==t.tagName&&uv(this.attributes,t.attributes)}static create(t){return new Nm(t.tagName,t.attributes||Md,t.rank==null?50:Math.max(0,Math.min(t.rank,100)))}static set(t,n=!1){return et.of(t,n)}};GS.prototype.startSide=GS.prototype.endSide=-1;function Hl(e){let t;return e.nodeType==11?t=e.getSelection?e:e.ownerDocument:t=e,t.getSelection()}function Pm(e,t){return t?e==t||e.contains(t.nodeType!=1?t.parentNode:t):!1}function ol(e,t){if(!t.anchorNode)return!1;try{return Pm(e,t.anchorNode)}catch{return!1}}function Xu(e){return e.nodeType==3?jl(e,0,e.nodeValue.length).getClientRects():e.nodeType==1?e.getClientRects():[]}function al(e,t,n,r){return n?VS(e,t,n,r,-1)||VS(e,t,n,r,1):!1}function Ks(e){for(var t=0;;t++)if(e=e.previousSibling,!e)return t}function Nd(e){return e.nodeType==1&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(e.nodeName)}function VS(e,t,n,r,s){for(;;){if(e==n&&t==r)return!0;if(t==(s<0?0:hs(e))){if(e.nodeName=="DIV")return!1;let i=e.parentNode;if(!i||i.nodeType!=1)return!1;t=Ks(e)+(s<0?0:1),e=i}else if(e.nodeType==1){if(e=e.childNodes[t+(s<0?-1:0)],e.nodeType==1&&e.contentEditable=="false")return!1;t=s<0?hs(e):0}else return!1}}function hs(e){return e.nodeType==3?e.nodeValue.length:e.childNodes.length}function Pd(e,t){let{left:n,right:r}=e;if(n==r)return e;let s=t?n:r;return{left:s,right:s,top:e.top,bottom:e.bottom}}function CQ(e){let t=e.visualViewport;return t?{left:0,right:t.width,top:0,bottom:t.height}:{left:0,right:e.innerWidth,top:0,bottom:e.innerHeight}}function iR(e,t){let n=t.width/e.offsetWidth,r=t.height/e.offsetHeight;return(n>.995&&n<1.005||!isFinite(n)||Math.abs(t.width-e.offsetWidth)<1)&&(n=1),(r>.995&&r<1.005||!isFinite(r)||Math.abs(t.height-e.offsetHeight)<1)&&(r=1),{scaleX:n,scaleY:r}}function vQ(e,t,n,r,s,i,o,a){let l=e.ownerDocument,c=l.defaultView||window;for(let u=e,d=!1;u&&!d;)if(u.nodeType==1){let h,f=u==l.body,B=1,g=1;if(f)h=CQ(c);else{if(/^(fixed|sticky)$/.test(getComputedStyle(u).position)&&(d=!0),u.scrollHeight<=u.clientHeight&&u.scrollWidth<=u.clientWidth){u=u.assignedSlot||u.parentNode;continue}let y=u.getBoundingClientRect();({scaleX:B,scaleY:g}=iR(u,y)),h={left:y.left,right:y.left+u.clientWidth*B,top:y.top,bottom:y.top+u.clientHeight*g}}let C=0,v=0;if(s=="nearest")t.top<h.top+o?(v=t.top-(h.top+o),n>0&&t.bottom>h.bottom+v&&(v=t.bottom-h.bottom+o)):t.bottom>h.bottom-o&&(v=t.bottom-h.bottom+o,n<0&&t.top-v<h.top&&(v=t.top-(h.top+o)));else{let y=t.bottom-t.top,S=h.bottom-h.top;v=(s=="center"&&y<=S?t.top+y/2-S/2:s=="start"||s=="center"&&n<0?t.top-o:t.bottom-S+o)-h.top}if(r=="nearest"?t.left<h.left+i?(C=t.left-(h.left+i),n>0&&t.right>h.right+C&&(C=t.right-h.right+i)):t.right>h.right-i&&(C=t.right-h.right+i,n<0&&t.left<h.left+C&&(C=t.left-(h.left+i))):C=(r=="center"?t.left+(t.right-t.left)/2-(h.right-h.left)/2:r=="start"==a?t.left-i:t.right-(h.right-h.left)+i)-h.left,C||v)if(f)c.scrollBy(C,v);else{let y=0,S=0;if(v){let E=u.scrollTop;u.scrollTop+=v/g,S=(u.scrollTop-E)*g}if(C){let E=u.scrollLeft;u.scrollLeft+=C/B,y=(u.scrollLeft-E)*B}t={left:t.left-y,top:t.top-S,right:t.right-y,bottom:t.bottom-S},y&&Math.abs(y-C)<1&&(r="nearest"),S&&Math.abs(S-v)<1&&(s="nearest")}if(f)break;(t.top<h.top||t.bottom>h.bottom||t.left<h.left||t.right>h.right)&&(t={left:Math.max(t.left,h.left),right:Math.min(t.right,h.right),top:Math.max(t.top,h.top),bottom:Math.min(t.bottom,h.bottom)}),u=u.assignedSlot||u.parentNode}else if(u.nodeType==11)u=u.host;else break}function oR(e,t=!0){let n=e.ownerDocument,r=null,s=null;for(let i=e.parentNode;i&&!(i==n.body||(!t||r)&&s);)if(i.nodeType==1)!s&&i.scrollHeight>i.clientHeight&&(s=i),t&&!r&&i.scrollWidth>i.clientWidth&&(r=i),i=i.assignedSlot||i.parentNode;else if(i.nodeType==11)i=i.host;else break;return{x:r,y:s}}var yQ=class{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}eq(e){return this.anchorNode==e.anchorNode&&this.anchorOffset==e.anchorOffset&&this.focusNode==e.focusNode&&this.focusOffset==e.focusOffset}setRange(e){let{anchorNode:t,focusNode:n}=e;this.set(t,Math.min(e.anchorOffset,t?hs(t):0),n,Math.min(e.focusOffset,n?hs(n):0))}set(e,t,n,r){this.anchorNode=e,this.anchorOffset=t,this.focusNode=n,this.focusOffset=r}};function aR(e){let t=[];for(let n=e;n;n=n.nodeType==11?n.host:n.parentNode)n.nodeType==1&&t.push({node:n,left:n.scrollLeft,top:n.scrollTop});return t}function lR(e,t=!0){for(let{node:n,left:r,top:s}of e)t&&n.scrollTop!=s&&(n.scrollTop=s),n.scrollLeft!=r&&(n.scrollLeft=r)}var pi=null;ue.safari&&ue.safari_version>=26&&(pi=!1);function cR(e){if(e.setActive)return e.setActive();if(pi)return e.focus(pi);let t=aR(e);e.focus(pi==null?{get preventScroll(){return pi={preventScroll:!0},!0}}:void 0),pi||(pi=!1,lR(t))}var US;function jl(e,t,n=t){let r=US||(US=document.createRange());return r.setEnd(e,n),r.setStart(e,t),r}function Io(e,t,n,r){let s={key:t,code:t,keyCode:n,which:n,cancelable:!0};r&&({altKey:s.altKey,ctrlKey:s.ctrlKey,shiftKey:s.shiftKey,metaKey:s.metaKey}=r);let i=new KeyboardEvent("keydown",s);i.synthetic=!0,e.dispatchEvent(i);let o=new KeyboardEvent("keyup",s);return o.synthetic=!0,e.dispatchEvent(o),i.defaultPrevented||o.defaultPrevented}function bQ(e){for(;e;){if(e&&(e.nodeType==9||e.nodeType==11&&e.host))return e;e=e.assignedSlot||e.parentNode}return null}function SQ(e,t){let n=t.focusNode,r=t.focusOffset;if(!n||t.anchorNode!=n||t.anchorOffset!=r)return!1;for(r=Math.min(r,hs(n));;)if(r){if(n.nodeType!=1)return!1;let s=n.childNodes[r-1];s.contentEditable=="false"?r--:(n=s,r=hs(n))}else{if(n==e)return!0;r=Ks(n),n=n.parentNode}}function uR(e){return e instanceof Window?e.pageYOffset>Math.max(0,e.document.documentElement.scrollHeight-e.innerHeight-4):e.scrollTop>Math.max(1,e.scrollHeight-e.clientHeight-4)}function dR(e,t){for(let n=e,r=t;;){if(n.nodeType==3&&r>0)return{node:n,offset:r};if(n.nodeType==1&&r>0){if(n.contentEditable=="false")return null;n=n.childNodes[r-1],r=hs(n)}else if(n.parentNode&&!Nd(n))r=Ks(n),n=n.parentNode;else return null}}function hR(e,t){for(let n=e,r=t;;){if(n.nodeType==3&&r<n.nodeValue.length)return{node:n,offset:r};if(n.nodeType==1&&r<n.childNodes.length){if(n.contentEditable=="false")return null;n=n.childNodes[r],r=0}else if(n.parentNode&&!Nd(n))r=Ks(n)+1,n=n.parentNode;else return null}}var Ls=class Lm{constructor(t,n,r=!0){this.node=t,this.offset=n,this.precise=r}static before(t,n){return new Lm(t.parentNode,Ks(t),n)}static after(t,n){return new Lm(t.parentNode,Ks(t)+1,n)}},nt=(function(e){return e[e.LTR=0]="LTR",e[e.RTL=1]="RTL",e})(nt||(nt={})),_i=nt.LTR,fv=nt.RTL;function fR(e){let t=[];for(let n=0;n<e.length;n++)t.push(1<<+e[n]);return t}var EQ=fR("88888888888888888888888888888888888666888888787833333333337888888000000000000000000000000008888880000000000000000000000000088888888888888888888888888888888888887866668888088888663380888308888800000000000000000000000800000000000000000000000000000008"),xQ=fR("4444448826627288999999999992222222222222222222222222222222222222222222222229999999999999999999994444444444644222822222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999949999999229989999223333333333"),_m=Object.create(null),br=[];for(let e of["()","[]","{}"]){let t=e.charCodeAt(0),n=e.charCodeAt(1);_m[t]=n,_m[n]=-t}function BR(e){return e<=247?EQ[e]:1424<=e&&e<=1524?2:1536<=e&&e<=1785?xQ[e-1536]:1774<=e&&e<=2220?4:8192<=e&&e<=8204?256:64336<=e&&e<=65023?4:1}var wQ=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\ufb50-\ufdff]/,Rr=class{get dir(){return this.level%2?fv:_i}constructor(e,t,n){this.from=e,this.to=t,this.level=n}side(e,t){return this.dir==t==e?this.to:this.from}forward(e,t){return e==(this.dir==t)}static find(e,t,n,r){let s=-1;for(let i=0;i<e.length;i++){let o=e[i];if(o.from<=t&&o.to>=t){if(o.level==n)return i;(s<0||(r!=0?r<0?o.from<t:o.to>t:e[s].level>o.level))&&(s=i)}}if(s<0)throw new RangeError("Index out of range");return s}};function pR(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++){let r=e[n],s=t[n];if(r.from!=s.from||r.to!=s.to||r.direction!=s.direction||!pR(r.inner,s.inner))return!1}return!0}var We=[];function DQ(e,t,n,r,s){for(let i=0;i<=r.length;i++){let o=i?r[i-1].to:t,a=i<r.length?r[i].from:n,l=i?256:s;for(let c=o,u=l,d=l;c<a;c++){let h=BR(e.charCodeAt(c));h==512?h=u:h==8&&d==4&&(h=16),We[c]=h==4?2:h,h&7&&(d=h),u=h}for(let c=o,u=l,d=l;c<a;c++){let h=We[c];if(h==128)c<a-1&&u==We[c+1]&&u&24?h=We[c]=u:We[c]=256;else if(h==64){let f=c+1;for(;f<a&&We[f]==64;)f++;let B=c&&u==8||f<n&&We[f]==8?d==1?1:8:256;for(let g=c;g<f;g++)We[g]=B;c=f-1}else h==8&&d==1&&(We[c]=1);u=h,h&7&&(d=h)}}}function TQ(e,t,n,r,s){let i=s==1?2:1;for(let o=0,a=0,l=0;o<=r.length;o++){let c=o?r[o-1].to:t,u=o<r.length?r[o].from:n;for(let d=c,h,f,B;d<u;d++)if(f=_m[h=e.charCodeAt(d)])if(f<0){for(let g=a-3;g>=0;g-=3)if(br[g+1]==-f){let C=br[g+2],v=C&2?s:C&4?C&1?i:s:0;v&&(We[d]=We[br[g]]=v),a=g;break}}else{if(br.length==189)break;br[a++]=d,br[a++]=h,br[a++]=l}else if((B=We[d])==2||B==1){let g=B==s;l=g?0:1;for(let C=a-3;C>=0;C-=3){let v=br[C+2];if(v&2)break;if(g)br[C+2]|=2;else{if(v&4)break;br[C+2]|=4}}}}}function AQ(e,t,n,r){for(let s=0,i=r;s<=n.length;s++){let o=s?n[s-1].to:e,a=s<n.length?n[s].from:t;for(let l=o;l<a;){let c=We[l];if(c==256){let u=l+1;for(;;)if(u==a){if(s==n.length)break;u=n[s++].to,a=s<n.length?n[s].from:t}else if(We[u]==256)u++;else break;let d=i==1,h=d==((u<t?We[u]:r)==1)?d?1:2:r;for(let f=u,B=s,g=B?n[B-1].to:e;f>l;)f==g&&(f=n[--B].from,g=B?n[B-1].to:e),We[--f]=h;l=u}else i=c,l++}}}function Fm(e,t,n,r,s,i,o){let a=r%2?2:1;if(r%2==s%2)for(let l=t,c=0;l<n;){let u=!0,d=!1;if(c==i.length||l<i[c].from){let g=We[l];g!=a&&(u=!1,d=g==16)}let h=!u&&a==1?[]:null,f=u?r:r+1,B=l;e:for(;;)if(c<i.length&&B==i[c].from){if(d)break e;let g=i[c];if(!u)for(let C=g.to,v=c+1;;){if(C==n)break e;if(v<i.length&&i[v].from==C)C=i[v++].to;else{if(We[C]==a)break e;break}}c++,h?h.push(g):(g.from>l&&o.push(new Rr(l,g.from,f)),Hm(e,g.direction==_i!=!(f%2)?r+1:r,s,g.inner,g.from,g.to,o),l=g.to),B=g.to}else{if(B==n||(u?We[B]!=a:We[B]==a))break;B++}h?Fm(e,l,B,r+1,s,h,o):l<B&&o.push(new Rr(l,B,f)),l=B}else for(let l=n,c=i.length;l>t;){let u=!0,d=!1;if(!c||l>i[c-1].to){let g=We[l-1];g!=a&&(u=!1,d=g==16)}let h=!u&&a==1?[]:null,f=u?r:r+1,B=l;e:for(;;)if(c&&B==i[c-1].to){if(d)break e;let g=i[--c];if(!u)for(let C=g.from,v=c;;){if(C==t)break e;if(v&&i[v-1].to==C)C=i[--v].from;else{if(We[C-1]==a)break e;break}}h?h.push(g):(g.to<l&&o.push(new Rr(g.to,l,f)),Hm(e,g.direction==_i!=!(f%2)?r+1:r,s,g.inner,g.from,g.to,o),l=g.from),B=g.from}else{if(B==t||(u?We[B-1]!=a:We[B-1]==a))break;B--}h?Fm(e,B,l,r+1,s,h,o):B<l&&o.push(new Rr(B,l,f)),l=B}}function Hm(e,t,n,r,s,i,o){let a=t%2?2:1;DQ(e,s,i,r,a),TQ(e,s,i,r,a),AQ(s,i,r,a),Fm(e,s,i,t,n,r,o)}function IQ(e,t,n){if(!e)return[new Rr(0,0,t==fv?1:0)];if(t==_i&&!n.length&&!wQ.test(e))return mR(e.length);if(n.length)for(;e.length>We.length;)We[We.length]=256;let r=[],s=t==_i?0:1;return Hm(e,s,s,n,0,e.length,r),r}function mR(e){return[new Rr(0,e,0)]}var gR="";function kQ(e,t,n,r,s){var i;if(!e.length)return null;let o=r.head-e.from,a;if(r.head==e.from&&r.assoc<0){if(!s)return null;o=t[a=0].side(!1,n)}else if(r.head==e.to&&r.assoc>0){if(s)return null;o=t[a=t.length-1].side(!0,n)}else a=Rr.find(t,o,(i=r.bidiLevel)!==null&&i!==void 0?i:-1,r.assoc);let l=t[a],c=l.side(s,n);if(o==c){let h=a+=s?1:-1;if(h<0||h>=t.length)return null;l=t[a=h],o=l.side(!s,n),c=l.side(s,n)}let u=Wt(e.text,o,l.forward(s,n));(u<l.from||u>l.to)&&(u=c),gR=e.text.slice(Math.min(o,u),Math.max(o,u));let d=a==(s?t.length-1:0)?null:t[a+(s?1:-1)];if(u==c){if(!d)return s?se.cursor(e.to,1):se.cursor(e.from,-1);if(d.level+(s?0:1)<l.level)return se.cursor(d.side(!s,n)+e.from,d.forward(s,n)?1:-1,d.level)}return se.cursor(u+e.from,l.forward(s,n)?-1:1,l.level)}function RQ(e,t,n){for(let r=t;r<n;r++){let s=BR(e.charCodeAt(r));if(s==1)return _i;if(s==2||s==4)return fv}return _i}var CR=Ce.define(),vR=Ce.define(),yR=Ce.define(),bR=Ce.define(),jm=Ce.define(),SR=Ce.define(),ER=Ce.define(),Bv=Ce.define(),pv=Ce.define(),xR=Ce.define({combine:e=>e.some(t=>t)}),wR=Ce.define({combine:e=>e.some(t=>t)}),DR=Ce.define(),uB=class Gm{constructor(t,n,r,s,i,o=!1){this.range=t,this.y=n,this.x=r,this.yMargin=s,this.xMargin=i,this.isSnapshot=o}map(t){return t.empty?this:new Gm(this.range.map(t),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}clip(t){return this.range.to<=t.doc.length?this:new Gm(se.cursor(t.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}},iu=Tt.define({map:(e,t)=>e.map(t)}),TR=Tt.define();function Or(e,t,n){let r=e.facet(bR);r.length?r[0](t):window.onerror&&window.onerror(String(t),n,void 0,void 0,t)||(n?console.error(n+":",t):console.error(t))}var Yr=Ce.define({combine:e=>e.length?e[0]:!0}),OQ=0,Co=Ce.define({combine(e){return e.filter((t,n)=>{for(let r=0;r<n;r++)if(e[r].plugin==t.plugin)return!1;return!0})}}),Js=class Vm{constructor(t,n,r,s,i){this.id=t,this.create=n,this.domEventHandlers=r,this.domEventObservers=s,this.baseExtensions=i(this),this.extension=this.baseExtensions.concat(Co.of({plugin:this,arg:void 0}))}of(t){return this.baseExtensions.concat(Co.of({plugin:this,arg:t}))}static define(t,n){const{eventHandlers:r,eventObservers:s,provide:i,decorations:o}=n||{};return new Vm(OQ++,t,r,s,a=>{let l=[];return o&&l.push(Fh.of(c=>{let u=c.plugin(a);return u?o(u):rt.none})),i&&l.push(i(a)),l})}static fromClass(t,n){return Vm.define((r,s)=>new t(r,s),n)}},dB=class{constructor(e){this.spec=e,this.mustUpdate=null,this.value=null}get plugin(){return this.spec&&this.spec.plugin}update(e){if(this.value){if(this.mustUpdate){let t=this.mustUpdate;if(this.mustUpdate=null,this.value.update)try{this.value.update(t)}catch(n){if(Or(t.state,n,"CodeMirror plugin crashed"),this.value.destroy)try{this.value.destroy()}catch{}this.deactivate()}}}else if(this.spec)try{this.value=this.spec.plugin.create(e,this.spec.arg)}catch(t){Or(e.state,t,"CodeMirror plugin crashed"),this.deactivate()}return this}destroy(e){var t;if(!((t=this.value)===null||t===void 0)&&t.destroy)try{this.value.destroy()}catch(n){Or(e.state,n,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}},AR=Ce.define(),mv=Ce.define(),Fh=Ce.define(),IR=Ce.define(),gv=Ce.define(),Cc=Ce.define(),kR=Ce.define();function zS(e,t){let n=e.state.facet(kR);if(!n.length)return n;let r=n.map(i=>i instanceof Function?i(e):i),s=[];return et.spans(r,t.from,t.to,{point(){},span(i,o,a,l){let c=i-t.from,u=o-t.from,d=s;for(let h=a.length-1;h>=0;h--,l--){let f=a[h].spec.bidiIsolate,B;if(f==null&&(f=RQ(t.text,c,u)),l>0&&d.length&&(B=d[d.length-1]).to==c&&B.direction==f)B.to=u,d=B.inner;else{let g={from:c,to:u,direction:f,inner:[]};d.push(g),d=g.inner}}}}),s}var RR=Ce.define();function OR(e){let t=0,n=0,r=0,s=0;for(let i of e.state.facet(RR)){let o=i(e);o&&(o.left!=null&&(t=Math.max(t,o.left)),o.right!=null&&(n=Math.max(n,o.right)),o.top!=null&&(r=Math.max(r,o.top)),o.bottom!=null&&(s=Math.max(s,o.bottom)))}return{left:t,right:n,top:r,bottom:s}}var _a=Ce.define(),rs=class Um{constructor(t,n,r,s){this.fromA=t,this.toA=n,this.fromB=r,this.toB=s}join(t){return new Um(Math.min(this.fromA,t.fromA),Math.max(this.toA,t.toA),Math.min(this.fromB,t.fromB),Math.max(this.toB,t.toB))}addToSet(t){let n=t.length,r=this;for(;n>0;n--){let s=t[n-1];if(!(s.fromA>r.toA)){if(s.toA<r.fromA)break;r=r.join(s),t.splice(n-1,1)}}return t.splice(n,0,r),t}static extendWithRanges(t,n){if(n.length==0)return t;let r=[];for(let s=0,i=0,o=0;;){let a=s<t.length?t[s].fromB:1e9,l=i<n.length?n[i]:1e9,c=Math.min(a,l);if(c==1e9)break;let u=c+o,d=c,h=u;for(;;)if(i<n.length&&n[i]<=d){let f=n[i+1];i+=2,d=Math.max(d,f);for(let B=s;B<t.length&&t[B].fromB<=d;B++)o=t[B].toA-t[B].toB;h=Math.max(h,f+o)}else if(s<t.length&&t[s].fromB<=d){let f=t[s++];d=Math.max(d,f.toB),h=Math.max(h,f.toA),o=f.toA-f.toB}else break;r.push(new Um(u,h,c,d))}return r}},$S=class MR{constructor(t,n,r){this.view=t,this.state=n,this.transactions=r,this.flags=0,this.startState=t.state,this.changes=ur.empty(this.startState.doc.length);for(let i of r)this.changes=this.changes.compose(i.changes);let s=[];this.changes.iterChangedRanges((i,o,a,l)=>s.push(new rs(i,o,a,l))),this.changedRanges=s}static create(t,n,r){return new MR(t,n,r)}get viewportChanged(){return(this.flags&4)>0}get viewportMoved(){return(this.flags&8)>0}get heightChanged(){return(this.flags&2)>0}get geometryChanged(){return this.docChanged||(this.flags&18)>0}get focusChanged(){return(this.flags&1)>0}get docChanged(){return!this.changes.empty}get selectionSet(){return this.transactions.some(t=>t.selection)}get empty(){return this.flags==0&&this.transactions.length==0}},MQ=[],ht=class{constructor(e,t,n=0){this.dom=e,this.length=t,this.flags=n,this.parent=null,e.cmTile=this}get breakAfter(){return this.flags&1}get children(){return MQ}isWidget(){return!1}get isHidden(){return!1}isComposite(){return!1}isLine(){return!1}isText(){return!1}isBlock(){return!1}get domAttrs(){return null}sync(e){if(this.flags|=2,this.flags&4){this.flags&=-5;let t=this.domAttrs;t&&pQ(this.dom,t)}}toString(){return this.constructor.name+(this.children.length?`(${this.children})`:"")+(this.breakAfter?"#":"")}destroy(){this.parent=null}setDOM(e){this.dom=e,e.cmTile=this}get posAtStart(){return this.parent?this.parent.posBefore(this):0}get posAtEnd(){return this.posAtStart+this.length}posBefore(e,t=this.posAtStart){let n=t;for(let r of this.children){if(r==e)return n;n+=r.length+r.breakAfter}throw new RangeError("Invalid child in posBefore")}posAfter(e){return this.posBefore(e)+e.length}covers(e){return!0}coordsIn(e,t,n){return null}domPosFor(e,t){let n=Ks(this.dom),r=this.length?e>0:t>0;return new Ls(this.parent.dom,n+(r?1:0),e==0||e==this.length)}markDirty(e){this.flags&=-3,e&&(this.flags|=4),this.parent&&this.parent.flags&2&&this.parent.markDirty(!1)}get overrideDOMText(){return null}get root(){for(let e=this;e;e=e.parent)if(e instanceof jh)return e;return null}static get(e){return e.cmTile}},Hh=class extends ht{constructor(e){super(e,0),this._children=[]}isComposite(){return!0}get children(){return this._children}get lastChild(){return this.children.length?this.children[this.children.length-1]:null}append(e){this.children.push(e),e.parent=this}sync(e){if(this.flags&2)return;super.sync(e);let t=this.dom,n=null,r,s=e?.node==t?e:null,i=0;for(let o of this.children){if(o.sync(e),i+=o.length+o.breakAfter,r=n?n.nextSibling:t.firstChild,s&&r!=o.dom&&(s.written=!0),o.dom.parentNode==t)for(;r&&r!=o.dom;)r=WS(r);else t.insertBefore(o.dom,r);n=o.dom}for(r=n?n.nextSibling:t.firstChild,s&&r&&(s.written=!0);r;)r=WS(r);this.length=i}};function WS(e){let t=e.nextSibling;return e.parentNode.removeChild(e),t}var jh=class extends Hh{constructor(e,t){super(t),this.view=e}owns(e){for(;e;e=e.parent)if(e==this)return!0;return!1}isBlock(){return!0}nearest(e){for(;;){if(!e)return null;let t=ht.get(e);if(t&&this.owns(t))return t;e=e.parentNode}}blockTiles(e){for(let t=[],n=this,r=0,s=0;;)if(r==n.children.length){if(!t.length)return;n=n.parent,n.breakAfter&&s++,r=t.pop()}else{let i=n.children[r++];if(i instanceof Ti)t.push(r),n=i,r=0;else{let o=s+i.length,a=e(i,s);if(a!==void 0)return a;s=o+i.breakAfter}}}resolveBlock(e,t){let n,r=-1,s,i=-1;if(this.blockTiles((o,a)=>{let l=a+o.length;if(e>=a&&e<=l){if(o.isWidget()&&t>=-1&&t<=1){if(o.flags&32)return!0;o.flags&16&&(n=void 0)}(a<e||e==l&&(t<-1?o.length:o.covers(1)))&&(!n||!o.isWidget()&&n.isWidget())&&(n=o,r=e-a),(l>e||e==a&&(t>1?o.length:o.covers(-1)))&&(!s||!o.isWidget()&&s.isWidget())&&(s=o,i=e-a)}}),!n&&!s)throw new Error("No tile at position "+e);return n&&t<0||!s?{tile:n,offset:r}:{tile:s,offset:i}}},Ti=class NR extends Hh{constructor(t,n){super(t),this.wrapper=n}isBlock(){return!0}covers(t){return this.children.length?t<0?this.children[0].covers(-1):this.lastChild.covers(1):!1}get domAttrs(){return this.wrapper.attributes}static of(t,n){let r=new NR(n||document.createElement(t.tagName),t);return n||(r.flags|=4),r}},Ld=class PR extends Hh{constructor(t,n){super(t),this.attrs=n}isLine(){return!0}static start(t,n,r){let s=new PR(n||document.createElement("div"),t);return(!n||!r)&&(s.flags|=4),s}get domAttrs(){return this.attrs}resolveInline(t,n,r){let s=null,i=-1,o=null,a=-1;function l(u,d){for(let h=0,f=0;h<u.children.length&&f<=d;h++){let B=u.children[h],g=f+B.length;g>=d&&(B.isComposite()?l(B,d-f):(!o||o.isHidden&&(n>0&&!(o.flags&32)||r&&PQ(o,B)))&&(g>d||B.flags&32&&n<=1)?(o=B,a=d-f):(f<d||B.flags&16&&!B.isHidden&&n>=-1)&&(s=B,i=d-f)),f=g}}l(this,t);let c=(n<0?s:o)||s||o;return c?{tile:c,offset:c==s?i:a}:null}coordsIn(t,n,r){let s=this.resolveInline(t,n,!0);return s?s.tile.coordsIn(Math.max(0,s.offset),n,r):NQ(this)}domIn(t,n){let r=this.resolveInline(t,n);if(r){let{tile:s,offset:i}=r;if(this.dom.contains(s.dom))return s.isText()?new Ls(s.dom,Math.min(s.dom.nodeValue.length,i)):s.domPosFor(i,s.flags&16?1:s.flags&32?-1:n);let o=r.tile.parent,a=!1;for(let l of o.children){if(a)return new Ls(l.dom,0);l==r.tile&&(a=!0)}}return new Ls(this.dom,0)}};function NQ(e){let t=e.dom.lastChild;if(!t)return e.dom.getBoundingClientRect();let n=Xu(t);return n[n.length-1]||null}function PQ(e,t){let n=e.coordsIn(0,1),r=t.coordsIn(0,1);return n&&r&&r.top<n.bottom}var On=class LR extends Hh{constructor(t,n){super(t),this.mark=n}get domAttrs(){return this.mark.attrs}static of(t,n){let r=new LR(n||document.createElement(t.tagName),t);return n||(r.flags|=4),r}},Fa=class _R extends ht{constructor(t,n){super(t,n.length),this.text=n}sync(t){this.flags&2||(super.sync(t),this.dom.nodeValue!=this.text&&(t&&t.node==this.dom&&(t.written=!0),this.dom.nodeValue=this.text))}isText(){return!0}toString(){return JSON.stringify(this.text)}coordsIn(t,n,r){let s=this.dom.nodeValue.length;t>s&&(t=s);let i=t,o=t,a=0;t==0&&n<0||t==s&&n>=0?ue.chrome||ue.gecko||(t?(i--,a=1):o<s&&(o++,a=-1)):n<0?i--:o<s&&o++;let l=jl(this.dom,i,o).getClientRects();if(!l.length)return null;let c=l[(a?a<0:n>=0)?0:l.length-1];return ue.safari&&!a&&c.width==0&&(c=Array.prototype.find.call(l,u=>u.width)||c),r==null?c:Pd(c,(a?a>0:n<0)==r)}static of(t,n){let r=new _R(n||document.createTextNode(t),t);return n||(r.flags|=2),r}},Gl=class FR extends ht{constructor(t,n,r,s){super(t,n,s),this.widget=r}isWidget(){return!0}get isHidden(){return this.widget.isHidden}covers(t){return this.flags&48?!1:(this.flags&(t<0?64:128))>0}coordsIn(t,n){return this.coordsInWidget(t,n,!1)}coordsInWidget(t,n,r){let s=this.widget.coordsAt(this.dom,t,n);if(s)return s;if(r)return Pd(this.dom.getBoundingClientRect(),this.length?t==0:n<=0);{let i=this.dom.getClientRects(),o=null;if(!i.length)return null;let a=this.flags&16?!0:this.flags&32?!1:t>0;for(let l=a?i.length-1:0;o=i[l],!(t>0?l==0:l==i.length-1||o.top<o.bottom);l+=a?-1:1);return Pd(o,!a)}}get overrideDOMText(){if(!this.length)return Fe.empty;let{root:t}=this;if(!t)return Fe.empty;let n=this.posAtStart;return t.view.state.doc.slice(n,n+this.length)}destroy(){super.destroy(),this.widget.destroy(this.dom)}static of(t,n,r,s,i){return i||(i=t.toDOM(n),t.editable||(i.contentEditable="false")),new FR(i,r,t,s)}},_d=class extends ht{constructor(e){let t=document.createElement("img");t.className="cm-widgetBuffer",t.setAttribute("aria-hidden","true"),super(t,0,e)}get isHidden(){return!0}get overrideDOMText(){return Fe.empty}coordsIn(e,t,n){let r=this.dom.getBoundingClientRect();return n==null?r:Pd(r,t>0==n)}},LQ=class{constructor(e){this.index=0,this.beforeBreak=!1,this.parents=[],this.tile=e}advance(e,t,n){let{tile:r,index:s,beforeBreak:i,parents:o}=this;for(;e||t>0;)if(r.isComposite())if(i){if(!e)break;n&&n.break(),e--,i=!1}else if(s==r.children.length){if(!e&&!o.length)break;n&&n.leave(r),i=!!r.breakAfter,{tile:r,index:s}=o.pop(),s++}else{let a=r.children[s],l=a.breakAfter;(t>0?a.length<=e:a.length<e)&&(!n||n.skip(a,0,a.length)!==!1||!a.isComposite)?(i=!!l,s++,e-=a.length):(o.push({tile:r,index:s}),r=a,s=0,n&&a.isComposite()&&n.enter(a))}else{let a=r.length;if(s<a&&e){let l=Math.min(e,a-s);n&&n.skip(r,s,s+l),e-=l,s+=l}if(s==a)i=!!r.breakAfter,{tile:r,index:s}=o.pop(),s++;else if(!e)break}return this.tile=r,this.index=s,this.beforeBreak=i,this}get root(){return this.parents.length?this.parents[0].tile:this.tile}},_Q=class{constructor(e,t,n,r){this.from=e,this.to=t,this.wrapper=n,this.rank=r}},FQ=class{constructor(e,t,n){this.cache=e,this.root=t,this.blockWrappers=n,this.curLine=null,this.lastBlock=null,this.afterWidget=null,this.pos=0,this.wrappers=[],this.wrapperPos=0}addText(e,t,n,r){var s;this.flushBuffer();let i=this.ensureMarks(t,n),o=i.lastChild;if(o&&o.isText()&&!(o.flags&8)&&o.length+e.length<512){this.cache.reused.set(o,2);let a=i.children[i.children.length-1]=new Fa(o.dom,o.text+e);a.parent=i}else i.append(r||Fa.of(e,(s=this.cache.find(Fa))===null||s===void 0?void 0:s.dom));this.pos+=e.length,this.afterWidget=null}addComposition(e,t){let n=this.curLine;n.dom!=t.line.dom&&(n.setDOM(this.cache.reused.has(t.line)?hB(t.line.dom):t.line.dom),this.cache.reused.set(t.line,2));let r=n;for(let o=t.marks.length-1;o>=0;o--){let a=t.marks[o],l=r.lastChild;if(l instanceof On&&l.mark.eq(a.mark))l.dom!=a.dom&&l.setDOM(hB(a.dom)),r=l;else{let{dom:c}=a;this.cache.reused.get(a)&&ht.get(a.dom)&&(c=hB(a.dom));let u=On.of(a.mark,c);r.append(u),r=u}this.cache.reused.set(a,2)}let s=ht.get(e.text);s&&this.cache.reused.set(s,2);let i=new Fa(e.text,e.text.nodeValue);i.flags|=8,this.pos=e.range.toB,r.append(i)}addInlineWidget(e,t,n){let r=this.afterWidget&&e.flags&48&&(this.afterWidget.flags&48)==(e.flags&48);r||this.flushBuffer();let s=this.ensureMarks(t,n);!r&&!(e.flags&16)&&s.append(this.getBuffer(1)),s.append(e),this.pos+=e.length,this.afterWidget=e}addMark(e,t,n){this.flushBuffer(),this.ensureMarks(t,n).append(e),this.pos+=e.length,this.afterWidget=null}addBlockWidget(e){this.getBlockPos().append(e),this.pos+=e.length,this.lastBlock=e,this.endLine()}continueWidget(e){let t=this.afterWidget||this.lastBlock;t.length+=e,this.pos+=e}addLineStart(e,t){var n;e||(e=HR);let r=Ld.start(e,t||((n=this.cache.find(Ld))===null||n===void 0?void 0:n.dom),!!t);this.getBlockPos().append(this.lastBlock=this.curLine=r)}addLine(e){this.getBlockPos().append(e),this.pos+=e.length,this.lastBlock=e,this.endLine()}addBreak(){this.lastBlock.flags|=1,this.endLine(),this.pos++}addLineStartIfNotCovered(e){this.blockPosCovered()||this.addLineStart(e)}ensureLine(e){this.curLine||this.addLineStart(e)}ensureMarks(e,t){var n;let r=this.curLine;for(let s=e.length-1;s>=0;s--){let i=e[s],o;if(t>0&&(o=r.lastChild)&&o instanceof On&&o.mark.eq(i))r=o,t--;else{let a=On.of(i,(n=this.cache.find(On,l=>l.mark.eq(i)))===null||n===void 0?void 0:n.dom);r.append(a),r=a,t=0}}return r}endLine(){if(this.curLine){this.flushBuffer();let e=this.curLine.lastChild;(!e||!qS(this.curLine,!1)||e.dom.nodeName!="BR"&&e.isWidget()&&!(ue.ios&&qS(this.curLine,!0)))&&this.curLine.append(this.cache.findWidget(fB,0,32)||new Gl(fB.toDOM(),0,fB,32)),this.curLine=this.afterWidget=null}}updateBlockWrappers(){this.wrapperPos>this.pos+1e4&&(this.blockWrappers.goto(this.pos),this.wrappers.length=0);for(let e=this.wrappers.length-1;e>=0;e--)this.wrappers[e].to<this.pos&&this.wrappers.splice(e,1);for(let e=this.blockWrappers;e.value&&e.from<=this.pos;e.next())if(e.to>=this.pos){let t=e.rank*102+e.value.rank,n=new _Q(e.from,e.to,e.value,t),r=this.wrappers.length;for(;r>0&&(this.wrappers[r-1].rank-n.rank||this.wrappers[r-1].to-n.to)<0;)r--;this.wrappers.splice(r,0,n)}this.wrapperPos=this.pos}getBlockPos(){var e;this.updateBlockWrappers();let t=this.root;for(let n of this.wrappers){let r=t.lastChild;if(n.from<this.pos&&r instanceof Ti&&r.wrapper.eq(n.wrapper))t=r;else{let s=Ti.of(n.wrapper,(e=this.cache.find(Ti,i=>i.wrapper.eq(n.wrapper)))===null||e===void 0?void 0:e.dom);t.append(s),t=s}}return t}blockPosCovered(){let e=this.lastBlock;return e!=null&&!e.breakAfter&&(!e.isWidget()||(e.flags&160)>0)}getBuffer(e){let t=2|(e<0?16:32),n=this.cache.find(_d,void 0,1);return n&&(n.flags=t),n||new _d(t)}flushBuffer(){this.afterWidget&&!(this.afterWidget.flags&32)&&(this.afterWidget.parent.append(this.getBuffer(-1)),this.afterWidget=null)}},HQ=class{constructor(e){this.skipCount=0,this.text="",this.textOff=0,this.cursor=e.iter()}skip(e){this.textOff+e<=this.text.length?this.textOff+=e:(this.skipCount+=e-(this.text.length-this.textOff),this.text="",this.textOff=0)}next(e){if(this.textOff==this.text.length){let{value:r,lineBreak:s,done:i}=this.cursor.next(this.skipCount);if(this.skipCount=0,i)throw new Error("Ran out of text content when drawing inline views");this.text=r;let o=this.textOff=Math.min(e,r.length);return s?null:r.slice(0,o)}let t=Math.min(this.text.length,this.textOff+e),n=this.text.slice(this.textOff,t);return this.textOff=t,n}},Fd=[Gl,Ld,Fa,On,_d,Ti,jh];for(let e=0;e<Fd.length;e++)Fd[e].bucket=e;var jQ=class{constructor(e){this.view=e,this.buckets=Fd.map(()=>[]),this.index=Fd.map(()=>0),this.reused=new Map}add(e){let t=e.constructor.bucket,n=this.buckets[t];n.length<6?n.push(e):n[this.index[t]=(this.index[t]+1)%6]=e}find(e,t,n=2){let r=e.bucket,s=this.buckets[r],i=this.index[r];for(let o=0;o<s.length;o++){let a=(o+i)%s.length,l=s[a];if((!t||t(l))&&!this.reused.has(l))return s.splice(a,1),a<i&&this.index[r]--,this.reused.set(l,n),l}return null}findWidget(e,t,n){let r=this.buckets[0];if(r.length)for(let s=0,i=0;;s++){if(s==r.length){if(i)return null;i=1,s=0}let o=r[s];if(!this.reused.has(o)&&(i==0?o.widget.compare(e):o.widget.constructor==e.constructor&&e.updateDOM(o.dom,this.view,o.widget)))return r.splice(s,1),s<this.index[0]&&this.index[0]--,o.widget==e&&o.length==t&&(o.flags&497)==n?(this.reused.set(o,1),o):(this.reused.set(o,2),new Gl(o.dom,t,e,o.flags&-498|n))}}reuse(e){return this.reused.set(e,1),e}maybeReuse(e,t=2){if(!this.reused.has(e))return this.reused.set(e,t),e.dom}clear(){for(let e=0;e<this.buckets.length;e++)this.buckets[e].length=this.index[e]=0}},GQ=class{constructor(e,t,n,r,s){this.view=e,this.decorations=r,this.disallowBlockEffectsFor=s,this.openWidget=!1,this.openMarks=0,this.cache=new jQ(e),this.text=new HQ(e.state.doc),this.builder=new FQ(this.cache,new jh(e,e.contentDOM),et.iter(n)),this.cache.reused.set(t,2),this.old=new LQ(t),this.reuseWalker={skip:(i,o,a)=>{if(this.cache.add(i),i.isComposite())return!1},enter:i=>this.cache.add(i),leave:()=>{},break:()=>{}}}run(e,t){let n=t&&this.getCompositionContext(t.text);for(let r=0,s=0,i=0;;){let o=i<e.length?e[i++]:null,a=o?o.fromA:this.old.root.length;if(a>r){let l=a-r;this.preserve(l,!i,!o),r=a,s+=l}if(!o)break;t&&o.fromA<=t.range.fromA&&o.toA>=t.range.toA?(this.forward(o.fromA,t.range.fromA,t.range.fromA<t.range.toA?1:-1),this.emit(s,t.range.fromB),this.builder.flushBuffer(),this.cache.clear(),this.builder.addComposition(t,n),this.text.skip(t.range.toB-t.range.fromB),this.forward(t.range.fromA,o.toA),this.emit(t.range.toB,o.toB)):(this.forward(o.fromA,o.toA),this.emit(s,o.toB)),s=o.toB,r=o.toA}return this.builder.curLine&&this.builder.endLine(),this.builder.root}preserve(e,t,n){let r=zQ(this.old),s=this.openMarks;this.old.advance(e,n?1:-1,{skip:(i,o,a)=>{if(i.isWidget())if(this.openWidget)this.builder.continueWidget(a-o);else{let l=a>0||o<i.length?Gl.of(i.widget,this.view,a-o,i.flags&496,this.cache.maybeReuse(i)):this.cache.reuse(i);l.flags&256?(l.flags&=-2,this.builder.addBlockWidget(l)):(this.builder.ensureLine(null),this.builder.addInlineWidget(l,r,s),s=r.length)}else if(i.isText())this.builder.ensureLine(null),!o&&a==i.length&&!this.cache.reused.has(i)?this.builder.addText(i.text,r,s,this.cache.reuse(i)):(this.cache.add(i),this.builder.addText(i.text.slice(o,a),r,s)),s=r.length;else if(i.isLine())i.flags&=-2,this.cache.reused.set(i,1),this.builder.addLine(i);else if(i instanceof _d)this.cache.add(i);else if(i instanceof On)this.builder.ensureLine(null),this.builder.addMark(i,r,s),this.cache.reused.set(i,1),s=r.length;else return!1;this.openWidget=!1},enter:i=>{i.isLine()?this.builder.addLineStart(i.attrs,this.cache.maybeReuse(i)):(this.cache.add(i),i instanceof On&&r.unshift(i.mark)),this.openWidget=!1},leave:i=>{i.isLine()?r.length&&(r.length=s=0):i instanceof On&&(r.shift(),s=Math.min(s,r.length))},break:()=>{this.builder.addBreak(),this.openWidget=!1}}),this.text.skip(e)}emit(e,t){let n=null,r=this.builder,s=-1,i=et.spans(this.decorations,e,t,{point:(o,a,l,c,u,d)=>{if(l instanceof Fl){if(this.disallowBlockEffectsFor[d]){if(l.block)throw new RangeError("Block decorations may not be specified via plugins");if(a>this.view.state.doc.lineAt(o).to)throw new RangeError("Decorations that replace line breaks may not be specified via plugins")}if(s=c.length,u>c.length)r.continueWidget(a-o);else{let h=l.widget||(l.block?Uo.block:Uo.inline),f=VQ(l),B=this.cache.findWidget(h,a-o,f)||Gl.of(h,this.view,a-o,f);l.block?(l.startSide>0&&r.addLineStartIfNotCovered(n),r.addBlockWidget(B)):(r.ensureLine(n),r.addInlineWidget(B,c,u))}n=null}else n=UQ(n,l);a>o&&this.text.skip(a-o)},span:(o,a,l,c)=>{for(let u=o;u<a;){let d=this.text.next(Math.min(512,a-u));d==null?(r.addLineStartIfNotCovered(n),r.addBreak(),u++):(r.ensureLine(n),r.addText(d,l,u==o?c:l.length),u+=d.length),n=null}s=l.length}});s>-1&&(this.openWidget=i>s),this.openWidget||r.addLineStartIfNotCovered(n),this.openMarks=i}forward(e,t,n=1){t-e<=10?this.old.advance(t-e,n,this.reuseWalker):(this.old.advance(5,-1,this.reuseWalker),this.old.advance(t-e-10,-1),this.old.advance(5,n,this.reuseWalker))}getCompositionContext(e){let t=[],n=null;for(let r=e.parentNode;;r=r.parentNode){let s=ht.get(r);if(r==this.view.contentDOM)break;s instanceof On?t.push(s):s?.isLine()?n=s:s instanceof Ti||(r.nodeName=="DIV"&&!n?n=new Ld(r,HR):n||t.push(On.of(new dv({tagName:r.nodeName.toLowerCase(),attributes:mQ(r)}),r)))}return n?{line:n,marks:t}:null}};function qS(e,t){let n=r=>{for(let s of r.children)if((t?s.isText():s.length)||n(s))return!0;return!1};return n(e)}function VQ(e){let t=e.isReplace?(e.startSide<0?64:0)|(e.endSide>0?128:0):e.startSide>0?32:16;return e.block&&(t|=256),t}var HR={class:"cm-line"};function UQ(e,t){let n=t.spec.attributes,r=t.spec.class;return!n&&!r||(e||(e={class:"cm-line"}),n&&cv(n,e),r&&(e.class+=" "+r)),e}function zQ(e){let t=[];for(let n=e.parents.length;n>1;n--){let r=n==e.parents.length?e.tile:e.parents[n].tile;r instanceof On&&t.push(r.mark)}return t}function hB(e){let t=ht.get(e);return t&&t.setDOM(e.cloneNode()),e}var Uo=class extends _h{constructor(e){super(),this.tag=e}eq(e){return e.tag==this.tag}toDOM(){return document.createElement(this.tag)}updateDOM(e){return e.nodeName.toLowerCase()==this.tag}get isHidden(){return!0}};Uo.inline=new Uo("span");Uo.block=new Uo("div");var fB=new class extends _h{toDOM(){return document.createElement("br")}get isHidden(){return!0}get editable(){return!0}},KS=class{constructor(e){this.view=e,this.decorations=[],this.blockWrappers=[],this.dynamicDecorationMap=[!1],this.domChanged=null,this.hasComposition=null,this.editContextFormatting=rt.none,this.lastCompositionAfterCursor=!1,this.minWidth=0,this.minWidthFrom=0,this.minWidthTo=0,this.impreciseAnchor=null,this.impreciseHead=null,this.forceSelection=!1,this.lastUpdate=Date.now(),this.updateDeco(),this.tile=new jh(e,e.contentDOM),this.updateInner([new rs(0,0,0,e.state.doc.length)],null)}update(e){var t;let n=e.changedRanges;this.minWidth>0&&n.length&&(n.every(({fromA:c,toA:u})=>u<this.minWidthFrom||c>this.minWidthTo)?(this.minWidthFrom=e.changes.mapPos(this.minWidthFrom,1),this.minWidthTo=e.changes.mapPos(this.minWidthTo,1)):this.minWidth=this.minWidthFrom=this.minWidthTo=0),this.updateEditContextFormatting(e);let r=-1;this.view.inputState.composing>=0&&!this.view.observer.editContext&&(!((t=this.domChanged)===null||t===void 0)&&t.newSel?r=this.domChanged.newSel.head:!ZQ(e.changes,this.hasComposition)&&!e.selectionSet&&(r=e.state.selection.main.head));let s=r>-1?WQ(this.view,e.changes,r):null;if(this.domChanged=null,this.hasComposition){let{from:c,to:u}=this.hasComposition;n=new rs(c,u,e.changes.mapPos(c,-1),e.changes.mapPos(u,1)).addToSet(n.slice())}this.hasComposition=s?{from:s.range.fromB,to:s.range.toB}:null,(ue.ie||ue.chrome)&&!s&&e&&e.state.doc.lines!=e.startState.doc.lines&&(this.forceSelection=!0);let i=this.decorations,o=this.blockWrappers;this.updateDeco();let a=JQ(i,this.decorations,e.changes);a.length&&(n=rs.extendWithRanges(n,a));let l=YQ(o,this.blockWrappers,e.changes);return l.length&&(n=rs.extendWithRanges(n,l)),s&&!n.some(c=>c.fromA<=s.range.fromA&&c.toA>=s.range.toA)&&(n=s.range.addToSet(n.slice())),this.tile.flags&2&&n.length==0?!1:(this.updateInner(n,s),e.transactions.length&&(this.lastUpdate=Date.now()),!0)}updateInner(e,t){this.view.viewState.mustMeasureContent=!0;let{observer:n}=this.view;n.ignore(()=>{if(t||e.length){let i=this.tile,o=new GQ(this.view,i,this.blockWrappers,this.decorations,this.dynamicDecorationMap);t&&ht.get(t.text)&&o.cache.reused.set(ht.get(t.text),2),this.tile=o.run(e,t),zm(i,o.cache.reused)}this.tile.dom.style.height=this.view.viewState.contentHeight/this.view.scaleY+"px",this.tile.dom.style.flexBasis=this.minWidth?this.minWidth+"px":"";let s=ue.chrome||ue.ios?{node:n.selectionRange.focusNode,written:!1}:void 0;this.tile.sync(s),s&&(s.written||n.selectionRange.focusNode!=s.node||!this.tile.dom.contains(s.node))&&(this.forceSelection=!0),this.tile.dom.style.height=""});let r=[];if(this.view.viewport.from||this.view.viewport.to<this.view.state.doc.length)for(let s of this.tile.children)s.isWidget()&&s.widget instanceof BB&&r.push(s.dom);n.updateGaps(r)}updateEditContextFormatting(e){this.editContextFormatting=this.editContextFormatting.map(e.changes);for(let t of e.transactions)for(let n of t.effects)n.is(TR)&&(this.editContextFormatting=n.value)}updateSelection(e=!1,t=!1){(e||!this.view.observer.selectionRange.focusNode)&&this.view.observer.readSelectionRange();let{dom:n}=this.tile,r=this.view.root.activeElement,s=r==n,i=!s&&!(this.view.state.facet(Yr)||n.tabIndex>-1)&&ol(n,this.view.observer.selectionRange)&&!(r&&n.contains(r));if(!(s||t||i))return;let o=this.forceSelection;this.forceSelection=!1;let a=this.view.state.selection.main,l,c;if(a.empty?c=l=this.inlineDOMNearPos(a.anchor,a.assoc||1):(c=this.inlineDOMNearPos(a.head,a.head==a.from?1:-1),l=this.inlineDOMNearPos(a.anchor,a.anchor==a.from?1:-1)),ue.gecko&&a.empty&&!this.hasComposition&&$Q(l)){let d=document.createTextNode("");this.view.observer.ignore(()=>l.node.insertBefore(d,l.node.childNodes[l.offset]||null)),l=c=new Ls(d,0),o=!0}let u=this.view.observer.selectionRange;(o||!u.focusNode||(!al(l.node,l.offset,u.anchorNode,u.anchorOffset)||!al(c.node,c.offset,u.focusNode,u.focusOffset))&&!this.suppressWidgetCursorChange(u,a))&&(this.view.observer.ignore(()=>{ue.android&&ue.chrome&&n.contains(u.focusNode)&&XQ(u.focusNode,n)&&(n.blur(),n.focus({preventScroll:!0}));let d=Hl(this.view.root);if(d)if(a.empty){if(ue.gecko){let h=qQ(l.node,l.offset);if(h&&h!=3){let f=(h==1?dR:hR)(l.node,l.offset);f&&(l=new Ls(f.node,f.offset))}}d.collapse(l.node,l.offset),a.bidiLevel!=null&&d.caretBidiLevel!==void 0&&(d.caretBidiLevel=a.bidiLevel)}else if(d.extend){d.collapse(l.node,l.offset);try{d.extend(c.node,c.offset)}catch{}}else{let h=document.createRange();a.anchor>a.head&&([l,c]=[c,l]),h.setEnd(c.node,c.offset),h.setStart(l.node,l.offset),d.removeAllRanges(),d.addRange(h)}i&&this.view.root.activeElement==n&&(n.blur(),r&&r.focus())}),this.view.observer.setSelectionRange(l,c)),this.impreciseAnchor=l.precise?null:new Ls(u.anchorNode,u.anchorOffset),this.impreciseHead=c.precise?null:new Ls(u.focusNode,u.focusOffset)}suppressWidgetCursorChange(e,t){return this.hasComposition&&t.empty&&al(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)&&this.posFromDOM(e.focusNode,e.focusOffset)==t.head}enforceCursorAssoc(){if(this.hasComposition)return;let{view:e}=this,t=e.state.selection.main,n=Hl(e.root),{anchorNode:r,anchorOffset:s}=e.observer.selectionRange;if(!n||!t.empty||!t.assoc||!n.modify)return;let i=this.lineAt(t.head,t.assoc);if(!i)return;let o=i.posAtStart;if(t.head==o||t.head==o+i.length)return;let a=this.coordsAt(t.head,-1),l=this.coordsAt(t.head,1);if(!a||!l||a.bottom>l.top)return;let c=this.domAtPos(t.head+t.assoc,t.assoc);n.collapse(c.node,c.offset),n.modify("move",t.assoc<0?"forward":"backward","lineboundary"),e.observer.readSelectionRange();let u=e.observer.selectionRange;e.docView.posFromDOM(u.anchorNode,u.anchorOffset)!=t.from&&n.collapse(r,s)}posFromDOM(e,t){let n=this.tile.nearest(e);if(!n)return this.tile.dom.compareDocumentPosition(e)&2?0:this.view.state.doc.length;let r=n.posAtStart;if(n.isComposite()){let s;if(e==n.dom)s=n.dom.childNodes[t];else{let i=hs(e)==0?0:t==0?-1:1;for(;;){let o=e.parentNode;if(o==n.dom)break;i==0&&o.firstChild!=o.lastChild&&(e==o.firstChild?i=-1:i=1),e=o}i<0?s=e:s=e.nextSibling}if(s==n.dom.firstChild)return r;for(;s&&!ht.get(s);)s=s.nextSibling;if(!s)return r+n.length;for(let i=0,o=r;;i++){let a=n.children[i];if(a.dom==s)return o;o+=a.length+a.breakAfter}}else return n.isText()?e==n.dom?r+t:r+(t?n.length:0):r}domAtPos(e,t){let{tile:n,offset:r}=this.tile.resolveBlock(e,t);return n.isWidget()?n.domPosFor(r,t):n.domIn(r,t)}inlineDOMNearPos(e,t){let n,r=-1,s=!1,i,o=-1,a=!1;return this.tile.blockTiles((l,c)=>{if(l.isWidget()){if(l.flags&32&&c>=e)return!0;l.flags&16&&(s=!0)}else{let u=c+l.length;if(c<=e&&(n=l,r=e-c,s=u<e),u>=e&&!i&&(i=l,o=e-c,a=c>e),c>e&&i)return!0}}),!n&&!i?this.domAtPos(e,t):(s&&i?n=null:a&&n&&(i=null),n&&t<0||!i?n.domIn(r,t):i.domIn(o,t))}coordsAt(e,t,n){let{tile:r,offset:s}=this.tile.resolveBlock(e,t);return r.isWidget()?r.widget instanceof BB?null:r.coordsInWidget(s,t,!0):r.coordsIn(s,t,n)}lineAt(e,t){let{tile:n}=this.tile.resolveBlock(e,t);return n.isLine()?n:null}coordsForChar(e){let{tile:t,offset:n}=this.tile.resolveBlock(e,1);if(!t.isLine())return null;function r(s,i){if(s.isComposite())for(let o of s.children){if(o.length>=i){let a=r(o,i);if(a)return a}if(i-=o.length,i<0)break}else if(s.isText()&&i<s.length){let o=Wt(s.text,i);if(o==i)return null;let a=jl(s.dom,i,o).getClientRects();for(let l=0;l<a.length;l++){let c=a[l];if(l==a.length-1||c.top<c.bottom&&c.left<c.right)return c}}return null}return r(t,n)}measureVisibleLineHeights(e){let t=[],{from:n,to:r}=e,s=this.view.contentDOM.clientWidth,i=s>Math.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,o=-1,a=this.view.textDirection==nt.LTR,l=0,c=(u,d,h)=>{for(let f=0;f<u.children.length&&!(d>r);f++){let B=u.children[f],g=d+B.length,C=B.dom.getBoundingClientRect(),{height:v}=C;if(h&&!f&&(l+=C.top-h.top),B instanceof Ti)g>n&&c(B,d,C);else if(d>=n&&(l>0&&t.push(-l),t.push(v+l),l=0,i)){let y=B.dom.lastChild,S=y?Xu(y):[];if(S.length){let E=S[S.length-1],D=a?E.right-C.left:C.right-E.left;D>o&&(o=D,this.minWidth=s,this.minWidthFrom=d,this.minWidthTo=g)}}h&&f==u.children.length-1&&(l+=h.bottom-C.bottom),d=g+B.breakAfter}};return c(this.tile,0,null),t}textDirectionAt(e){let{tile:t}=this.tile.resolveBlock(e,1);return getComputedStyle(t.dom).direction=="rtl"?nt.RTL:nt.LTR}measureTextSize(){let e=this.tile.blockTiles(i=>{if(i.isLine()&&i.children.length&&i.length<=20){let o=0,a;for(let l of i.children){if(!l.isText()||/[^ -~]/.test(l.text))return;let c=Xu(l.dom);if(c.length!=1)return;o+=c[0].width,a=c[0].height}if(o)return{lineHeight:i.dom.getBoundingClientRect().height,charWidth:o/i.length,textHeight:a}}});if(e)return e;let t=document.createElement("div"),n,r,s;return t.className="cm-line",t.style.width="99999px",t.style.position="absolute",t.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore(()=>{this.tile.dom.appendChild(t);let i=Xu(t.firstChild)[0];n=t.getBoundingClientRect().height,r=i&&i.width?i.width/27:7,s=i&&i.height?i.height:n,t.remove()}),{lineHeight:n,charWidth:r,textHeight:s}}computeBlockGapDeco(){let e=[],t=this.view.viewState;for(let n=0,r=0;;r++){let s=r==t.viewports.length?null:t.viewports[r],i=s?s.from-1:this.view.state.doc.length;if(i>n){let o=(t.lineBlockAt(i).bottom-t.lineBlockAt(n).top)/this.view.scaleY;e.push(rt.replace({widget:new BB(o),block:!0,inclusive:!0,isBlockGap:!0}).range(n,i))}if(!s)break;n=s.to+1}return rt.set(e)}updateDeco(){let e=1,t=this.view.state.facet(Fh).map(s=>(this.dynamicDecorationMap[e++]=typeof s=="function")?s(this.view):s),n=!1,r=this.view.state.facet(gv).map((s,i)=>{let o=typeof s=="function";return o&&(n=!0),o?s(this.view):s});for(r.length&&(this.dynamicDecorationMap[e++]=n,t.push(et.join(r))),this.decorations=[this.editContextFormatting,...t,this.computeBlockGapDeco(),this.view.viewState.lineGapDeco];e<this.decorations.length;)this.dynamicDecorationMap[e++]=!1;this.blockWrappers=this.view.state.facet(IR).map(s=>typeof s=="function"?s(this.view):s)}scrollIntoView(e){if(e.isSnapshot){let l=this.view.viewState.lineBlockAt(e.range.head);this.view.scrollDOM.scrollTop=l.top-e.yMargin,this.view.scrollDOM.scrollLeft=e.xMargin;return}for(let l of this.view.state.facet(DR))try{if(l(this.view,e.range,e))return!0}catch(c){Or(this.view.state,c,"scroll handler")}let{range:t}=e,n=this.coordsAt(t.head,t.assoc||(t.head>t.anchor?-1:1)),r;if(!n)return;!t.empty&&(r=this.coordsAt(t.anchor,t.anchor>t.head?-1:1))&&(n={left:Math.min(n.left,r.left),top:Math.min(n.top,r.top),right:Math.max(n.right,r.right),bottom:Math.max(n.bottom,r.bottom)});let s=OR(this.view),i={left:n.left-s.left,top:n.top-s.top,right:n.right+s.right,bottom:n.bottom+s.bottom},{offsetWidth:o,offsetHeight:a}=this.view.scrollDOM;if(vQ(this.view.scrollDOM,i,t.head<t.anchor?-1:1,e.x,e.y,Math.max(Math.min(e.xMargin,o),-o),Math.max(Math.min(e.yMargin,a),-a),this.view.textDirection==nt.LTR),window.visualViewport&&window.innerHeight-window.visualViewport.height>1&&(n.top>window.visualViewport.offsetTop+window.visualViewport.height||n.bottom<window.visualViewport.offsetTop)){let l=this.view.docView.lineAt(t.head,1);if(l){let c=aR(l.dom);l.dom.scrollIntoView({block:"nearest"}),lR(c,!1)}}}lineHasWidget(e){let t=n=>n.isWidget()||n.children.some(t);return t(this.tile.resolveBlock(e,1).tile)}destroy(){zm(this.tile)}};function zm(e,t){let n=t?.get(e);if(n!=1){n==null&&e.destroy();for(let r of e.children)zm(r,t)}}function $Q(e){return e.node.nodeType==1&&e.node.firstChild&&(e.offset==0||e.node.childNodes[e.offset-1].contentEditable=="false")&&(e.offset==e.node.childNodes.length||e.node.childNodes[e.offset].contentEditable=="false")}function jR(e,t){let n=e.observer.selectionRange;if(!n.focusNode)return null;let r=dR(n.focusNode,n.focusOffset),s=hR(n.focusNode,n.focusOffset),i=r||s;if(s&&r&&s.node!=r.node){let a=ht.get(s.node);if(!a||a.isText()&&a.text!=s.node.nodeValue)i=s;else if(e.docView.lastCompositionAfterCursor){let l=ht.get(r.node);!l||l.isText()&&l.text!=r.node.nodeValue||(i=s)}}if(e.docView.lastCompositionAfterCursor=i!=r,!i)return null;let o=t-i.offset;return{from:o,to:o+i.node.nodeValue.length,node:i.node}}function WQ(e,t,n){let r=jR(e,n);if(!r)return null;let{node:s,from:i,to:o}=r,a=s.nodeValue;if(/[\n\r]/.test(a)||e.state.doc.sliceString(r.from,r.to)!=a)return null;let l=t.invertedDesc;return{range:new rs(l.mapPos(i),l.mapPos(o),i,o),text:s}}function qQ(e,t){return e.nodeType!=1?0:(t&&e.childNodes[t-1].contentEditable=="false"?1:0)|(t<e.childNodes.length&&e.childNodes[t].contentEditable=="false"?2:0)}var KQ=class{constructor(){this.changes=[]}compareRange(t,n){Ao(t,n,this.changes)}comparePoint(t,n){Ao(t,n,this.changes)}boundChange(t){Ao(t,t,this.changes)}};function JQ(e,t,n){let r=new KQ;return et.compare(e,t,n,r),r.changes}var QQ=class{constructor(){this.changes=[]}compareRange(e,t){Ao(e,t,this.changes)}comparePoint(){}boundChange(e){Ao(e,e,this.changes)}};function YQ(e,t,n){let r=new QQ;return et.compare(e,t,n,r),r.changes}function XQ(e,t){for(let n=e;n&&n!=t;n=n.assignedSlot||n.parentNode)if(n.nodeType==1&&n.contentEditable=="false")return!0;return!1}function ZQ(e,t){let n=!1;return t&&e.iterChangedRanges((r,s)=>{r<t.to&&s>t.from&&(n=!0)}),n}var BB=class extends _h{constructor(e){super(),this.height=e}toDOM(){let e=document.createElement("div");return e.className="cm-gap",this.updateDOM(e),e}eq(e){return e.height==this.height}updateDOM(e){return e.style.height=this.height+"px",!0}get editable(){return!0}get estimatedHeight(){return this.height}ignoreEvent(){return!1}};function eY(e,t,n=1){let r=e.charCategorizer(t),s=e.doc.lineAt(t),i=t-s.from;if(s.length==0)return se.cursor(t);i==0?n=1:i==s.length&&(n=-1);let o=i,a=i;n<0?o=Wt(s.text,i,!1):a=Wt(s.text,i);let l=r(s.text.slice(o,a));for(;o>0;){let c=Wt(s.text,o,!1);if(r(s.text.slice(c,o))!=l)break;o=c}for(;a<s.length;){let c=Wt(s.text,a);if(r(s.text.slice(a,c))!=l)break;a=c}return se.undirectionalRange(o+s.from,a+s.from)}function tY(e,t,n,r,s){let i=Math.round((r-t.left)*e.defaultCharacterWidth);if(e.lineWrapping&&n.height>e.defaultLineHeight*1.5){let a=e.viewState.heightOracle.textHeight,l=Math.floor((s-n.top-(e.defaultLineHeight-a)*.5)/a);i+=l*e.viewState.heightOracle.lineLength}let o=e.state.sliceDoc(n.from,n.to);return n.from+uQ(o,i,e.state.tabSize)}function $m(e,t,n){let r=e.lineBlockAt(t);if(Array.isArray(r.type)){let s;for(let i of r.type){if(i.from>t)break;if(!(i.to<t)){if(i.from<t&&i.to>t)return i;(!s||i.type==Gt.Text&&(s.type!=i.type||(n<0?i.from<t:i.to>t)))&&(s=i)}}return s||r}return r}function nY(e,t,n,r){let s=$m(e,t.head,t.assoc||-1),i=!r||s.type!=Gt.Text||!(e.lineWrapping||s.widgetLineBreaks)?null:e.coordsAtPos(t.assoc<0&&t.head>s.from?t.head-1:t.head);if(i){let o=e.dom.getBoundingClientRect(),a=e.textDirectionAt(s.from),l=e.posAtCoords({x:n==(a==nt.LTR)?o.right-1:o.left+1,y:(i.top+i.bottom)/2});if(l!=null)return se.cursor(l,n?-1:1)}return se.cursor(n?s.to:s.from,n?-1:1)}function JS(e,t,n,r){let s=e.state.doc.lineAt(t.head),i=e.bidiSpans(s),o=e.textDirectionAt(s.from);for(let a=t,l=null;;){let c=kQ(s,i,o,a,n),u=gR;if(!c){if(s.number==(n?e.state.doc.lines:1))return a;u=`
|
|
76
|
+
`,s=e.state.doc.line(s.number+(n?1:-1)),i=e.bidiSpans(s),c=n?se.cursor(s.from,-1):se.cursor(s.to,1)}if(l){if(!l(u))return a}else{if(!r)return c;l=r(u)}a=c}}function rY(e,t,n){let r=e.state.charCategorizer(t),s=r(n);return i=>{let o=r(i);return s==ns.Space&&(s=o),s==o}}function sY(e,t,n,r){let s=t.head,i=n?1:-1;if(s==(n?e.state.doc.length:0))return se.cursor(s,t.assoc);let o=t.goalColumn,a,l=e.contentDOM.getBoundingClientRect(),c=e.coordsAtPos(s,t.assoc||((t.empty?n:t.head==t.from)?1:-1)),u=e.documentTop;if(c)o==null&&(o=c.left-l.left),a=i<0?c.top:c.bottom;else{let B=e.viewState.lineBlockAt(s);o==null&&(o=Math.min(l.right-l.left,e.defaultCharacterWidth*(s-B.from))),a=(i<0?B.top:B.bottom)+u}let d=l.left+o,h=e.viewState.heightOracle.textHeight>>1,f=r??h;for(let B=0;;B+=h){let g=a+(f+B)*i,C=Wm(e,{x:d,y:g},!1,i);if(n?g>l.bottom:g<l.top)return se.cursor(C.pos,C.assoc);let v=e.coordsAtPos(C.pos,C.assoc),y=v?(v.top+v.bottom)/2:0;if(!v||(n?y>a:y<a))return se.cursor(C.pos,C.assoc,void 0,o)}}function ll(e,t,n){for(;;){let r=0;for(let s of e)s.between(t-1,t+1,(i,o,a)=>{if(t>i&&t<o){let l=r||n||(t-i<o-t?-1:1);t=l<0?i:o,r=l}});if(!r)return t}}function GR(e,t){let n=null;for(let r=0;r<t.ranges.length;r++){let s=t.ranges[r],i=null;if(s.empty){let o=ll(e,s.from,0);o!=s.from&&(i=se.cursor(o,-1))}else{let o=ll(e,s.from,-1),a=ll(e,s.to,1);(o!=s.from||a!=s.to)&&(s.undirectional?i=se.undirectionalRange(s.from,s.to):i=se.range(s.from==s.anchor?o:a,s.from==s.head?o:a))}i&&(n||(n=t.ranges.slice()),n[r]=i)}return n?se.create(n,t.mainIndex):t}function pB(e,t,n){let r=ll(e.state.facet(Cc).map(s=>s(e)),n.from,t.head>n.from?-1:1);return r==n.from?n:se.cursor(r,r<n.from?1:-1)}var Ar=class{constructor(e,t){this.pos=e,this.assoc=t}};function Wm(e,t,n,r){let s=e.contentDOM.getBoundingClientRect(),i=s.top+e.viewState.paddingTop,{x:o,y:a}=t,l=a-i,c;for(;;){if(l<0)return new Ar(0,1);if(l>e.viewState.docHeight)return new Ar(e.state.doc.length,-1);if(c=e.elementAtHeight(l),r==null)break;if(c.type==Gt.Text){if(r<0?c.to<e.viewport.from:c.from>e.viewport.to)break;let h=e.docView.coordsAt(r<0?c.from:c.to,r>0?-1:1);if(h&&(r<0?h.top<=l+i:h.bottom>=l+i))break}let d=e.viewState.heightOracle.textHeight/2;l=r>0?c.bottom+d:c.top-d}if(e.viewport.from>=c.to||e.viewport.to<=c.from){if(n)return null;if(c.type==Gt.Text){let d=tY(e,s,c,o,a);return new Ar(d,d==c.from?1:-1)}}if(c.type!=Gt.Text)return l<(c.top+c.bottom)/2?new Ar(c.from,1):new Ar(c.to,-1);let u=e.docView.lineAt(c.from,2);return(!u||u.length!=c.length)&&(u=e.docView.lineAt(c.from,-2)),new iY(e,o,a,e.textDirectionAt(c.from)).scanTile(u,c.from)}var iY=class{constructor(e,t,n,r){this.view=e,this.x=t,this.y=n,this.baseDir=r,this.line=null,this.spans=null}bidiSpansAt(e){return(!this.line||this.line.from>e||this.line.to<e)&&(this.line=this.view.state.doc.lineAt(e),this.spans=this.view.bidiSpans(this.line)),this}baseDirAt(e,t){let{line:n,spans:r}=this.bidiSpansAt(e);return r[Rr.find(r,e-n.from,-1,t)].level==this.baseDir}dirAt(e,t){let{line:n,spans:r}=this.bidiSpansAt(e);return r[Rr.find(r,e-n.from,-1,t)].dir}bidiIn(e,t){let{spans:n,line:r}=this.bidiSpansAt(e);return n.length>1||n.length&&(n[0].level!=this.baseDir||n[0].to+r.from<t)}scan(e,t,n=!1){let r=0,s=e.length-1,i=new Set,o=this.bidiIn(e[0],e[s]),a,l,c=-1,u=1e9,d;e:for(;r<s;){let f=s-r,B=r+s>>1;t:if(i.has(B)){for(let v=1;v<f;v++){let y=B+v;if(y>=s&&(y-=f),!i.has(y)){B=y;break t}}break e}i.add(B);let g=t(B),C=0;if(g)for(let v=0;v<g.length;v++){let y=g[v];if(!(y.width==0&&g.length>1))if(y.bottom<this.y)(!a||a.bottom<y.bottom)&&(a=y),C=1;else if(y.top>this.y)(!l||l.top>y.top)&&(l=y),C=-1;else{let S=y.left>this.x?this.x-y.left:y.right<this.x?this.x-y.right:0,E=Math.abs(S);E<u&&(c=B,u=E,d=y),S&&(C=S<0==(this.baseDir==nt.LTR)?-1:1)}}C==-1&&(!o||this.baseDirAt(e[B],1))?s=B:C==1&&(!o||this.baseDirAt(e[B+1],-1))&&(r=B+1)}if(!d){if(!l&&!a)return{i:0,after:!1};let f=a&&(!l||this.y-a.bottom<l.top-this.y)?a:l;return this.y=(f.top+f.bottom)/2,this.scan(e,t,!0)}if(u&&!n){let{top:f,bottom:B}=d;if(a&&a.bottom>(f+f+B)/3)return this.y=a.bottom-1,this.scan(e,t,!0);if(l&&l.top<(f+B+B)/3)return this.y=l.top+1,this.scan(e,t,!0)}let h=(o?this.dirAt(e[c],1):this.baseDir)==nt.LTR;return{i:c,after:this.x>(d.left+d.right)/2==h}}scanText(e,t){let n=[];for(let s=0;s<e.length;s=Wt(e.text,s))n.push(t+s);n.push(t+e.length);let r=this.scan(n,s=>{let i=n[s]-t,o=n[s+1]-t;return jl(e.dom,i,o).getClientRects()});return r.after?new Ar(n[r.i+1],-1):new Ar(n[r.i],1)}scanTile(e,t){if(!e.length)return new Ar(t,1);if(e.children.length==1){let o=e.children[0];if(o.isText())return this.scanText(o,t);if(o.isComposite())return this.scanTile(o,t)}let n=[t];for(let o=0,a=t;o<e.children.length;o++)n.push(a+=e.children[o].length);let r=this.scan(n,o=>{let a=e.children[o];return a.flags&48?null:(a.dom.nodeType==1?a.dom:jl(a.dom,0,a.length)).getClientRects()}),s=e.children[r.i],i=n[r.i];return s.isText()?this.scanText(s,i):s.isComposite()?this.scanTile(s,i):r.after?new Ar(n[r.i+1],-1):new Ar(i,1)}},Zu="",oY=class{constructor(e,t){this.points=e,this.view=t,this.text="",this.lineSeparator=t.state.facet(bt.lineSeparator)}append(e){this.text+=e}lineBreak(){this.text+=Zu}readRange(e,t){if(!e)return this;let n=e.parentNode;for(let r=e;;){this.findPointBefore(n,r);let s=this.text.length;this.readNode(r);let i=ht.get(r),o=r.nextSibling;if(o==t){i?.breakAfter&&!o&&n!=this.view.contentDOM&&this.lineBreak();break}let a=ht.get(o);(i&&a?i.breakAfter:(i?i.breakAfter:Nd(r))||Nd(o)&&(r.nodeName!="BR"||i?.isWidget())&&this.text.length>s)&&!lY(o,t)&&this.lineBreak(),r=o}return this.findPointBefore(n,t),this}readTextNode(e){let t=e.nodeValue;for(let n of this.points)n.node==e&&(n.pos=this.text.length+Math.min(n.offset,t.length));for(let n=0,r=this.lineSeparator?null:/\r\n?|\n/g;;){let s=-1,i=1,o;if(this.lineSeparator?(s=t.indexOf(this.lineSeparator,n),i=this.lineSeparator.length):(o=r.exec(t))&&(s=o.index,i=o[0].length),this.append(t.slice(n,s<0?t.length:s)),s<0)break;if(this.lineBreak(),i>1)for(let a of this.points)a.node==e&&a.pos>this.text.length&&(a.pos-=i-1);n=s+i}}readNode(e){let t=ht.get(e),n=t&&t.overrideDOMText;if(n!=null){this.findPointInside(e,n.length);for(let r=n.iter();!r.next().done;)r.lineBreak?this.lineBreak():this.append(r.value)}else e.nodeType==3?this.readTextNode(e):e.nodeName=="BR"?e.nextSibling&&this.lineBreak():e.nodeType==1&&this.readRange(e.firstChild,null)}findPointBefore(e,t){for(let n of this.points)n.node==e&&e.childNodes[n.offset]==t&&(n.pos=this.text.length)}findPointInside(e,t){for(let n of this.points)(e.nodeType==3?n.node==e:e.contains(n.node))&&(n.pos=this.text.length+(aY(e,n.node,n.offset)?t:0))}};function aY(e,t,n){for(;;){if(!t||n<hs(t))return!1;if(t==e)return!0;n=Ks(t)+1,t=t.parentNode}}function lY(e,t){let n;for(;!(e==t||!e);e=e.nextSibling){let r=ht.get(e);if(!r?.isWidget())return!1;r&&(n||(n=[])).push(r)}if(n)for(let r of n){let s=r.overrideDOMText;if(s?.length)return!1}return!0}var QS=class{constructor(e,t){this.node=e,this.offset=t,this.pos=-1}},cY=class{constructor(e,t,n,r){this.typeOver=r,this.bounds=null,this.text="",this.domChanged=t>-1;let{impreciseHead:s,impreciseAnchor:i}=e.docView,o=e.state.selection;if(e.state.readOnly&&t>-1)this.newSel=null;else if(t>-1&&(this.bounds=VR(e.docView.tile,t,n,0))){let a=s||i?[]:dY(e),l=new oY(a,e);l.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=l.text,this.newSel=hY(a,this.bounds.from)}else{let a=e.observer.selectionRange,l=s&&s.node==a.focusNode&&s.offset==a.focusOffset||!Pm(e.contentDOM,a.focusNode)?o.main.head:e.docView.posFromDOM(a.focusNode,a.focusOffset),c=i&&i.node==a.anchorNode&&i.offset==a.anchorOffset||!Pm(e.contentDOM,a.anchorNode)?o.main.anchor:e.docView.posFromDOM(a.anchorNode,a.anchorOffset),u=e.viewport;if((ue.ios||ue.chrome)&&l!=c&&Math.min(l,c)<=o.main.from&&Math.max(l,c)>=o.main.to&&(u.from>0||u.to<e.state.doc.length)){let d=Math.min(l,c),h=Math.max(l,c),f=u.from-d,B=u.to-h;(f==0||f==1||d==0)&&(B==0||B==-1||h==e.state.doc.length)&&(l=0,c=e.state.doc.length)}if(e.inputState.composing>-1&&o.ranges.length>1)this.newSel=o.replaceRange(se.range(c,l));else if(e.lineWrapping&&c==l&&!(o.main.empty&&o.main.head==l)&&e.inputState.lastTouchTime>Date.now()-100){let d=e.coordsAtPos(l,-1),h=0;d&&(h=e.inputState.lastTouchY<=d.bottom?-1:1),this.newSel=se.create([se.cursor(l,h)])}else this.newSel=se.single(c,l)}}};function VR(e,t,n,r){if(e.isComposite()){let s=-1,i=-1,o=-1,a=-1;for(let l=0,c=r,u=r;l<e.children.length;l++){let d=e.children[l],h=c+d.length;if(c<t&&h>n)return VR(d,t,n,c);if(h>=t&&s==-1&&(s=l,i=c),c>n&&d.dom.parentNode==e.dom){o=l,a=u;break}u=h,c=h+d.breakAfter}return{from:i,to:a<0?r+e.length:a,startDOM:(s?e.children[s-1].dom.nextSibling:null)||e.dom.firstChild,endDOM:o<e.children.length&&o>=0?e.children[o].dom:null}}else return e.isText()?{from:r,to:r+e.length,startDOM:e.dom,endDOM:e.dom.nextSibling}:null}function UR(e,t){let n,{newSel:r}=t,{state:s}=e,i=s.selection.main,o=e.inputState.lastKeyTime>Date.now()-100?e.inputState.lastKeyCode:-1;if(t.bounds){let{from:a,to:l}=t.bounds,c=i.from,u=null;(o===8||ue.android&&t.text.length<l-a)&&(c=i.to,u="end");let d=s.doc.sliceString(a,l,Zu),h,f;!i.empty&&i.from>=a&&i.to<=l&&(t.typeOver||d!=t.text)&&d.slice(0,i.from-a)==t.text.slice(0,i.from-a)&&d.slice(i.to-a)==t.text.slice(h=t.text.length-(d.length-(i.to-a)))?n={from:i.from,to:i.to,insert:Fe.of(t.text.slice(i.from-a,h).split(Zu))}:(f=zR(d,t.text,c-a,u))&&(ue.chrome&&o==13&&f.toB==f.from+2&&t.text.slice(f.from,f.toB)==""&&f.toB--,n={from:a+f.from,to:a+f.toA,insert:Fe.of(t.text.slice(f.from,f.toB).split(Zu))})}else r&&(!e.hasFocus&&s.facet(Yr)||Hd(r,i))&&(r=null);if(!n&&!r)return!1;if((ue.mac||ue.android)&&n&&n.from==n.to&&n.from==i.head-1&&/^\. ?$/.test(n.insert.toString())&&e.contentDOM.getAttribute("autocorrect")=="off"?(r&&n.insert.length==2&&(r=se.single(r.main.anchor-1,r.main.head-1)),n={from:n.from,to:n.to,insert:Fe.of([n.insert.toString().replace("."," ")])}):s.doc.lineAt(i.from).to<i.to&&e.docView.lineHasWidget(i.to)&&e.inputState.insertingTextAt>Date.now()-50?n={from:i.from,to:i.to,insert:s.toText(e.inputState.insertingText)}:ue.chrome&&n&&n.from==n.to&&n.from==i.head&&n.insert.toString()==`
|
|
77
|
+
`&&e.lineWrapping&&(r&&(r=se.single(r.main.anchor-1,r.main.head-1)),n={from:i.from,to:i.to,insert:Fe.of([" "])}),n)return Cv(e,n,r,o);if(r&&!Hd(r,i)){let a=!1,l="select";return e.inputState.lastSelectionTime>Date.now()-50&&(e.inputState.lastSelectionOrigin=="select"&&(a=!0),l=e.inputState.lastSelectionOrigin,l=="select.pointer"&&(r=GR(s.facet(Cc).map(c=>c(e)),r))),e.dispatch({selection:r,scrollIntoView:a,userEvent:l}),!0}else return!1}function Cv(e,t,n,r=-1){if(ue.ios&&e.inputState.flushIOSKey(t))return!0;let s=e.state.selection.main;if(ue.android&&(t.to==s.to&&(t.from==s.from||t.from==s.from-1&&e.state.sliceDoc(t.from,s.from)==" ")&&t.insert.length==1&&t.insert.lines==2&&Io(e.contentDOM,"Enter",13)||(t.from==s.from-1&&t.to==s.to&&t.insert.length==0||r==8&&t.insert.length<t.to-t.from&&t.to>s.head)&&Io(e.contentDOM,"Backspace",8)||t.from==s.from&&t.to==s.to+1&&t.insert.length==0&&Io(e.contentDOM,"Delete",46)))return!0;let i=t.insert.toString();e.inputState.composing>=0&&e.inputState.composing++;let o,a=()=>o||(o=uY(e,t,n));return e.state.facet(SR).some(l=>l(e,t.from,t.to,i,a))||e.dispatch(a()),!0}function uY(e,t,n){let r,s=e.state,i=s.selection.main,o=-1;if(t.from==t.to&&t.from<i.from||t.from>i.to){let l=t.from<i.from?-1:1,c=l<0?i.from:i.to,u=ll(s.facet(Cc).map(d=>d(e)),c,l);t.from==u&&(o=u)}if(o>-1)r={changes:t,selection:se.cursor(t.from+t.insert.length,-1)};else if(t.from>=i.from&&t.to<=i.to&&t.to-t.from>=(i.to-i.from)/3&&(!n||n.main.empty&&n.main.from==t.from+t.insert.length)&&e.inputState.composing<0){let l=i.from<t.from?s.sliceDoc(i.from,t.from):"",c=i.to>t.to?s.sliceDoc(t.to,i.to):"";r=s.replaceSelection(e.state.toText(l+t.insert.sliceString(0,void 0,e.state.lineBreak)+c))}else{let l=s.changes(t),c=n&&n.main.to<=l.newLength?n.main:void 0;if(s.selection.ranges.length>1&&(e.inputState.composing>=0||e.inputState.compositionPendingChange)&&t.to<=i.to+10&&t.to>=i.to-10){let u=e.state.sliceDoc(t.from,t.to),d,h=n&&jR(e,n.main.head);if(h){let B=t.insert.length-(t.to-t.from);d={from:h.from,to:h.to-B}}else d=e.state.doc.lineAt(i.head);let f=i.to-t.to;r=s.changeByRange(B=>{if(B.from==i.from&&B.to==i.to)return{changes:l,range:c||B.map(l)};let g=B.to-f,C=g-u.length;if(e.state.sliceDoc(C,g)!=u||g>=d.from&&C<=d.to)return{range:B};let v=s.changes({from:C,to:g,insert:t.insert}),y=B.to-i.to;return{changes:v,range:c?se.range(Math.max(0,c.anchor+y),Math.max(0,c.head+y)):B.map(v)}})}else r={changes:l,selection:c&&s.selection.replaceRange(c)}}let a="input.type";return(e.composing||e.inputState.compositionPendingChange&&e.inputState.compositionEndedAt>Date.now()-50)&&(e.inputState.compositionPendingChange=!1,a+=".compose",e.inputState.compositionFirstChange&&(a+=".start",e.inputState.compositionFirstChange=!1)),s.update(r,{userEvent:a,scrollIntoView:!0})}function zR(e,t,n,r){let s=Math.min(e.length,t.length),i=0;for(;i<s&&e.charCodeAt(i)==t.charCodeAt(i);)i++;if(i==s&&e.length==t.length)return null;let o=e.length,a=t.length;for(;o>0&&a>0&&e.charCodeAt(o-1)==t.charCodeAt(a-1);)o--,a--;if(r=="end"){let l=Math.max(0,i-Math.min(o,a));n-=o+l-i}if(o<i&&e.length<t.length){let l=n<=i&&n>=o?i-n:0;i-=l,a=i+(a-o),o=i}else if(a<i){let l=n<=i&&n>=a?i-n:0;i-=l,o=i+(o-a),a=i}return{from:i,toA:o,toB:a}}function dY(e){let t=[];if(e.root.activeElement!=e.contentDOM)return t;let{anchorNode:n,anchorOffset:r,focusNode:s,focusOffset:i}=e.observer.selectionRange;return n&&(t.push(new QS(n,r)),(s!=n||i!=r)&&t.push(new QS(s,i))),t}function hY(e,t){if(e.length==0)return null;let n=e[0].pos,r=e.length==2?e[1].pos:n;return n<0||r<0?null:n==r?se.create([se.cursor(r+t,-1)]):se.single(n+t,r+t)}function Hd(e,t){return t.head==e.main.head&&t.anchor==e.main.anchor}var fY=class{setSelectionOrigin(e){this.lastSelectionOrigin=e,this.lastSelectionTime=Date.now()}constructor(e){this.view=e,this.lastKeyCode=0,this.lastKeyTime=0,this.touchActive=!1,this.lastTouchTime=0,this.lastTouchX=0,this.lastTouchY=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.lastWheelEvent=0,this.pendingIOSKey=void 0,this.lastIOSMomentumScroll=0,this.tabFocusMode=-1,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastContextMenu=0,this.scrollHandlers=[],this.handlers=Object.create(null),this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.compositionPendingKey=!1,this.compositionPendingChange=!1,this.insertingText="",this.insertingTextAt=0,this.mouseSelection=null,this.draggedContent=null,this.handleEvent=this.handleEvent.bind(this),this.notifiedFocused=e.hasFocus,ue.safari&&e.contentDOM.addEventListener("input",()=>null),ue.gecko&&IY(e.contentDOM.ownerDocument)}handleEvent(e){!SY(this.view,e)||this.ignoreDuringComposition(e)||e.type=="keydown"&&this.keydown(e)||(this.view.updateState!=0?Promise.resolve().then(()=>this.runHandlers(e.type,e)):this.runHandlers(e.type,e))}runHandlers(e,t){let n=this.handlers[e];if(n){for(let r of n.observers)r(this.view,t);for(let r of n.handlers){if(t.defaultPrevented)break;if(r(this.view,t)){t.preventDefault();break}}}}ensureHandlers(e){let t=pY(e),n=this.handlers,r=this.view.contentDOM;for(let s in t)if(s!="scroll"){let i=!t[s].handlers.length,o=n[s];o&&i!=!o.handlers.length&&(r.removeEventListener(s,this.handleEvent),o=null),o||r.addEventListener(s,this.handleEvent,{passive:i})}for(let s in n)s!="scroll"&&!t[s]&&r.removeEventListener(s,this.handleEvent);this.handlers=t}keydown(e){if(this.lastKeyCode=e.keyCode,this.lastKeyTime=Date.now(),e.keyCode==9&&this.tabFocusMode>-1&&(!this.tabFocusMode||Date.now()<=this.tabFocusMode))return!0;if(this.tabFocusMode>0&&e.keyCode!=27&&WR.indexOf(e.keyCode)<0&&(this.tabFocusMode=-1),ue.android&&ue.chrome&&!e.synthetic&&(e.keyCode==13||e.keyCode==8))return this.view.observer.delayAndroidKey(e.key,e.keyCode),!0;if(ue.ios&&!e.synthetic&&!e.altKey&&!e.metaKey&&($R.some(t=>t.keyCode==e.keyCode)&&!e.ctrlKey||mY.indexOf(e.key)>-1&&e.ctrlKey)){let t={ctrlKey:e.ctrlKey,altKey:e.altKey,metaKey:e.metaKey,shiftKey:e.shiftKey};t.shiftKey&&ue.ios&&!/^(off|none)$/.test(this.view.contentDOM.autocapitalize)&&BY(this.view.win)&&(t.shiftKey=!1);let n=this.pendingIOSKey={key:e.key,keyCode:e.keyCode,mods:t};return setTimeout(()=>{this.pendingIOSKey==n&&this.flushIOSKey()},50),!0}return e.keyCode!=229&&this.view.observer.forceFlush(),!1}flushIOSKey(e){let t=this.pendingIOSKey;return!t||this.view.observer.pendingRecords().length||t.key=="Enter"&&e&&e.from<e.to&&/^\S+$/.test(e.insert.toString())?!1:(this.pendingIOSKey=void 0,Io(this.view.contentDOM,t.key,t.keyCode,t.mods))}ignoreDuringComposition(e){return!/^key/.test(e.type)||e.synthetic?!1:this.composing>0?!0:ue.safari&&!ue.ios&&this.compositionPendingKey&&Date.now()-this.compositionEndedAt<100?(this.compositionPendingKey=!1,!0):!1}startMouseSelection(e){this.mouseSelection&&this.mouseSelection.destroy(),this.mouseSelection=e}update(e){this.view.observer.update(e),this.mouseSelection&&this.mouseSelection.update(e),this.draggedContent&&e.docChanged&&(this.draggedContent=this.draggedContent.map(e.changes)),e.transactions.length&&(this.lastKeyCode=this.lastSelectionTime=0)}destroy(){this.mouseSelection&&this.mouseSelection.destroy()}};function BY(e){return e.visualViewport?e.visualViewport.height*e.visualViewport.scale/e.document.documentElement.clientHeight<.85:!1}function YS(e,t){return(n,r)=>{try{return t.call(e,r,n)}catch(s){Or(n.state,s)}}}function pY(e){let t=Object.create(null);function n(r){return t[r]||(t[r]={observers:[],handlers:[]})}for(let r of e){let s=r.spec,i=s&&s.plugin.domEventHandlers,o=s&&s.plugin.domEventObservers;if(i)for(let a in i){let l=i[a];l&&n(a).handlers.push(YS(r.value,l))}if(o)for(let a in o){let l=o[a];l&&n(a).observers.push(YS(r.value,l))}}for(let r in dr)n(r).handlers.push(dr[r]);for(let r in rn)n(r).observers.push(rn[r]);return t}var $R=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],mY="dthko",WR=[16,17,18,20,91,92,224,225],ou=6;function au(e){return Math.max(0,e)*.7+8}function gY(e,t){return Math.max(Math.abs(e.clientX-t.clientX),Math.abs(e.clientY-t.clientY))}var CY=class{constructor(e,t,n,r){this.view=e,this.startEvent=t,this.style=n,this.mustSelect=r,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=t,this.scrollParents=oR(e.contentDOM),this.atoms=e.state.facet(Cc).map(i=>i(e));let s=e.contentDOM.ownerDocument;s.addEventListener("mousemove",this.move=this.move.bind(this)),s.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=t.shiftKey,this.multiple=e.state.facet(bt.allowMultipleSelections)&&vY(e,t),this.dragging=bY(e,t)&&JR(t)==1?null:!1}start(e){this.dragging===!1&&this.select(e)}move(e){if(e.buttons==0)return this.destroy();if(this.dragging||this.dragging==null&&gY(this.startEvent,e)<10)return;this.select(this.lastEvent=e);let t=0,n=0,r=0,s=0,i=this.view.win.innerWidth,o=this.view.win.innerHeight;this.scrollParents.x&&({left:r,right:i}=this.scrollParents.x.getBoundingClientRect()),this.scrollParents.y&&({top:s,bottom:o}=this.scrollParents.y.getBoundingClientRect());let a=OR(this.view);e.clientX-a.left<=r+ou?t=-au(r-e.clientX):e.clientX+a.right>=i-ou&&(t=au(e.clientX-i)),e.clientY-a.top<=s+ou?n=-au(s-e.clientY):e.clientY+a.bottom>=o-ou&&(n=au(e.clientY-o)),this.setScrollSpeed(t,n)}up(e){this.dragging==null&&this.select(this.lastEvent),this.dragging||e.preventDefault(),this.destroy()}destroy(){this.setScrollSpeed(0,0);let e=this.view.contentDOM.ownerDocument;e.removeEventListener("mousemove",this.move),e.removeEventListener("mouseup",this.up),this.view.inputState.mouseSelection=this.view.inputState.draggedContent=null}setScrollSpeed(e,t){this.scrollSpeed={x:e,y:t},e||t?this.scrolling<0&&(this.scrolling=setInterval(()=>this.scroll(),50)):this.scrolling>-1&&(clearInterval(this.scrolling),this.scrolling=-1)}scroll(){let{x:e,y:t}=this.scrollSpeed;e&&this.scrollParents.x&&(this.scrollParents.x.scrollLeft+=e,e=0),t&&this.scrollParents.y&&(this.scrollParents.y.scrollTop+=t,t=0),(e||t)&&this.view.win.scrollBy(e,t),this.dragging===!1&&this.select(this.lastEvent)}select(e){let{view:t}=this,n=GR(this.atoms,this.style.get(e,this.extend,this.multiple));(this.mustSelect||!n.eq(t.state.selection,this.dragging===!1))&&this.view.dispatch({selection:n,userEvent:"select.pointer"}),this.mustSelect=!1}update(e){e.transactions.some(t=>t.isUserEvent("input.type"))?this.destroy():this.style.update(e)&&setTimeout(()=>this.select(this.lastEvent),20)}};function vY(e,t){let n=e.state.facet(CR);return n.length?n[0](t):ue.mac?t.metaKey:t.ctrlKey}function yY(e,t){let n=e.state.facet(vR);return n.length?n[0](t):ue.mac?!t.altKey:!t.ctrlKey}function bY(e,t){let{main:n}=e.state.selection;if(n.empty)return!1;let r=Hl(e.root);if(!r||r.rangeCount==0)return!0;let s=r.getRangeAt(0).getClientRects();for(let i=0;i<s.length;i++){let o=s[i];if(o.left<=t.clientX&&o.right>=t.clientX&&o.top<=t.clientY&&o.bottom>=t.clientY)return!0}return!1}function SY(e,t){if(!t.bubbles)return!0;if(t.defaultPrevented)return!1;for(let n=t.target,r;n!=e.contentDOM;n=n.parentNode)if(!n||n.nodeType==11||(r=ht.get(n))&&r.isWidget()&&!r.isHidden&&r.widget.ignoreEvent(t))return!1;return!0}var dr=Object.create(null),rn=Object.create(null),qR=ue.ie&&ue.ie_version<15||ue.ios&&ue.webkit_version<604;function EY(e){let t=e.dom.parentNode;if(!t)return;let n=t.appendChild(document.createElement("textarea"));n.style.cssText="position: fixed; left: -10000px; top: 10px",n.focus(),setTimeout(()=>{e.focus(),n.remove(),KR(e,n.value)},50)}function Gh(e,t,n){for(let r of e.facet(t))n=r(n,e);return n}function KR(e,t){t=Gh(e.state,Bv,t);let{state:n}=e,r,s=1,i=n.toText(t),o=i.lines==n.selection.ranges.length;if(qm!=null&&n.selection.ranges.every(a=>a.empty)&&qm==i.toString()){let a=-1;r=n.changeByRange(l=>{let c=n.doc.lineAt(l.from);if(c.from==a)return{range:l};a=c.from;let u=n.toText((o?i.line(s++).text:t)+n.lineBreak);return{changes:{from:c.from,insert:u},range:se.cursor(l.from+u.length,-1)}})}else o?r=n.changeByRange(a=>{let l=i.line(s++);return{changes:{from:a.from,to:a.to,insert:l.text},range:se.cursor(a.from+l.length,-1)}}):r=n.replaceSelection(i);e.dispatch(r,{userEvent:"input.paste",scrollIntoView:!0})}rn.scroll=e=>{let t=e.inputState;t.lastScrollTop=e.scrollDOM.scrollTop,t.lastScrollLeft=e.scrollDOM.scrollLeft,ue.ios&&!t.touchActive&&(t.lastIOSMomentumScroll=Date.now())};rn.wheel=rn.mousewheel=e=>{e.inputState.lastWheelEvent=Date.now()};dr.keydown=(e,t)=>(e.inputState.setSelectionOrigin("select"),t.keyCode==27&&e.inputState.tabFocusMode!=0&&(e.inputState.tabFocusMode=Date.now()+2e3),!1);rn.touchstart=(e,t)=>{let n=e.inputState,r=t.targetTouches[0];n.touchActive=!0,n.lastTouchTime=Date.now(),r&&(n.lastTouchX=r.clientX,n.lastTouchY=r.clientY),n.setSelectionOrigin("select.pointer")};rn.touchmove=e=>{e.inputState.setSelectionOrigin("select.pointer")};rn.touchend=(e,t)=>{e.inputState.touchActive=!1};dr.mousedown=(e,t)=>{if(e.observer.flush(),e.inputState.lastTouchTime>Date.now()-2e3)return!1;let n=null;for(let r of e.state.facet(yR))if(n=r(e,t),n)break;if(!n&&t.button==0&&(n=wY(e,t)),n){let r=!e.hasFocus;e.inputState.startMouseSelection(new CY(e,t,n,r)),r&&e.observer.ignore(()=>{cR(e.contentDOM);let i=e.root.activeElement;i&&!i.contains(e.contentDOM)&&i.blur()});let s=e.inputState.mouseSelection;if(s)return s.start(t),s.dragging===!1}else e.inputState.setSelectionOrigin("select.pointer");return!1};function XS(e,t,n,r){if(r==1)return se.cursor(t,n);if(r==2)return eY(e.state,t,n);{let s=e.docView.lineAt(t,n),i=e.state.doc.lineAt(s?s.posAtEnd:t),o=s?s.posAtStart:i.from,a=s?s.posAtEnd:i.to;return a<e.state.doc.length&&a==i.to&&a++,se.undirectionalRange(o,a)}}var xY=ue.ie&&ue.ie_version<=11,ZS=null,eE=0,tE=0;function JR(e){if(!xY)return e.detail;let t=ZS,n=tE;return ZS=e,tE=Date.now(),eE=!t||n>Date.now()-400&&Math.abs(t.clientX-e.clientX)<2&&Math.abs(t.clientY-e.clientY)<2?(eE+1)%3:1}function wY(e,t){let n=e.posAndSideAtCoords({x:t.clientX,y:t.clientY},!1),r=JR(t),s=e.state.selection;return{update(i){i.docChanged&&(n.pos=i.changes.mapPos(n.pos),s=s.map(i.changes))},get(i,o,a){let l=e.posAndSideAtCoords({x:i.clientX,y:i.clientY},!1),c,u=XS(e,l.pos,l.assoc,r);if(n.pos!=l.pos&&!o){let d=XS(e,n.pos,n.assoc,r),h=Math.min(d.from,u.from),f=Math.max(d.to,u.to);u=h<u.from?se.range(h,f,u.assoc):se.range(f,h,u.assoc)}return o?s.replaceRange(s.main.extend(u.from,u.to,u.assoc)):a&&r==1&&s.ranges.length>1&&(c=DY(s,l.pos))?c:a?s.addRange(u):se.create([u])}}}function DY(e,t){for(let n=0;n<e.ranges.length;n++){let{from:r,to:s}=e.ranges[n];if(r<=t&&s>=t)return se.create(e.ranges.slice(0,n).concat(e.ranges.slice(n+1)),e.mainIndex==n?0:e.mainIndex-(e.mainIndex>n?1:0))}return null}dr.dragstart=(e,t)=>{let{selection:{main:n}}=e.state;if(t.target.draggable){let s=e.docView.tile.nearest(t.target);if(s&&s.isWidget()){let i=s.posAtStart,o=i+s.length;(i>=n.to||o<=n.from)&&(n=se.undirectionalRange(i,o))}}let{inputState:r}=e;return r.mouseSelection&&(r.mouseSelection.dragging=!0),r.draggedContent=n,t.dataTransfer&&(t.dataTransfer.setData("Text",Gh(e.state,pv,e.state.sliceDoc(n.from,n.to))),t.dataTransfer.effectAllowed="copyMove"),!1};dr.dragend=e=>(e.inputState.draggedContent=null,!1);function nE(e,t,n,r){if(n=Gh(e.state,Bv,n),!n)return;let s=e.posAtCoords({x:t.clientX,y:t.clientY},!1),{draggedContent:i}=e.inputState,o=r&&i&&yY(e,t)?{from:i.from,to:i.to}:null,a={from:s,insert:n},l=e.state.changes(o?[o,a]:a);e.focus(),e.dispatch({changes:l,selection:{anchor:l.mapPos(s,-1),head:l.mapPos(s,1)},userEvent:o?"move.drop":"input.drop"}),e.inputState.draggedContent=null}dr.drop=(e,t)=>{if(!t.dataTransfer)return!1;if(e.state.readOnly)return!0;let n=t.dataTransfer.files;if(n&&n.length){let r=Array(n.length),s=0,i=()=>{++s==n.length&&nE(e,t,r.filter(o=>o!=null).join(e.state.lineBreak),!1)};for(let o=0;o<n.length;o++){let a=new FileReader;a.onerror=i,a.onload=()=>{/[\x00-\x08\x0e-\x1f]{2}/.test(a.result)||(r[o]=a.result),i()},a.readAsText(n[o])}return!0}else{let r=t.dataTransfer.getData("Text");if(r)return nE(e,t,r,!0),!0}return!1};dr.paste=(e,t)=>{if(e.state.readOnly)return!0;e.observer.flush();let n=qR?null:t.clipboardData;return n?(KR(e,n.getData("text/plain")||n.getData("text/uri-list")),!0):(EY(e),!1)};function TY(e,t){let n=e.dom.parentNode;if(!n)return;let r=n.appendChild(document.createElement("textarea"));r.style.cssText="position: fixed; left: -10000px; top: 10px",r.value=t,r.focus(),r.selectionEnd=t.length,r.selectionStart=0,setTimeout(()=>{r.remove(),e.focus()},50)}function AY(e){let t=[],n=[],r=!1;for(let s of e.selection.ranges)s.empty||(t.push(e.sliceDoc(s.from,s.to)),n.push(s));if(!t.length){let s=-1;for(let{from:i}of e.selection.ranges){let o=e.doc.lineAt(i);o.number>s&&(t.push(o.text),n.push({from:o.from,to:Math.min(e.doc.length,o.to+1)})),s=o.number}r=!0}return{text:Gh(e,pv,t.join(e.lineBreak)),ranges:n,linewise:r}}var qm=null;dr.copy=dr.cut=(e,t)=>{if(!ol(e.contentDOM,e.observer.selectionRange))return!1;let{text:n,ranges:r,linewise:s}=AY(e.state);if(!n&&!s)return!1;qm=s?n:null,t.type=="cut"&&!e.state.readOnly&&e.dispatch({changes:r,scrollIntoView:!0,userEvent:"delete.cut"});let i=qR?null:t.clipboardData;return i?(i.clearData(),i.setData("text/plain",n),!0):(TY(e,n),!1)};var QR=Ui.define();function YR(e,t){let n=[];for(let r of e.facet(ER)){let s=r(e,t);s&&n.push(s)}return n.length?e.update({effects:n,annotations:QR.of(!0)}):null}function XR(e){setTimeout(()=>{let t=e.hasFocus;if(t!=e.inputState.notifiedFocused){let n=YR(e.state,t);n?e.dispatch(n):e.update([])}},10)}rn.focus=e=>{e.inputState.lastFocusTime=Date.now(),!e.scrollDOM.scrollTop&&(e.inputState.lastScrollTop||e.inputState.lastScrollLeft)&&(e.scrollDOM.scrollTop=e.inputState.lastScrollTop,e.scrollDOM.scrollLeft=e.inputState.lastScrollLeft),XR(e)};rn.blur=e=>{e.observer.clearSelectionRange(),XR(e)};rn.compositionstart=rn.compositionupdate=e=>{if(!e.observer.editContext&&(e.inputState.compositionFirstChange==null&&(e.inputState.compositionFirstChange=!0),e.inputState.composing<0)){let{main:t}=e.state.selection;!t.empty&&e.lineBlockAt(t.from).from!=e.lineBlockAt(t.to).from&&e.dispatch({changes:e.state.selection.ranges.filter(n=>!n.empty).map(n=>({from:n.from,to:n.to})),userEvent:"input"}),e.inputState.composing=0}};rn.compositionend=e=>{e.observer.editContext||(e.inputState.composing=-1,e.inputState.compositionEndedAt=Date.now(),e.inputState.compositionPendingKey=!0,e.inputState.compositionPendingChange=e.observer.pendingRecords().length>0,e.inputState.compositionFirstChange=null,ue.chrome&&ue.android?e.observer.flushSoon():e.inputState.compositionPendingChange?Promise.resolve().then(()=>e.observer.flush()):setTimeout(()=>{e.inputState.composing<0&&e.docView.hasComposition&&e.update([])},50))};rn.contextmenu=e=>{e.inputState.lastContextMenu=Date.now()};dr.beforeinput=(e,t)=>{var n,r;if((t.inputType=="insertText"||t.inputType=="insertCompositionText")&&(e.inputState.insertingText=t.data,e.inputState.insertingTextAt=Date.now()),t.inputType=="insertReplacementText"&&e.observer.editContext){let i=(n=t.dataTransfer)===null||n===void 0?void 0:n.getData("text/plain"),o=t.getTargetRanges();if(i&&o.length){let a=o[0];return Cv(e,{from:e.posAtDOM(a.startContainer,a.startOffset),to:e.posAtDOM(a.endContainer,a.endOffset),insert:e.state.toText(i)},null),!0}}let s;if(ue.chrome&&ue.android&&(s=$R.find(i=>i.inputType==t.inputType))&&(e.observer.delayAndroidKey(s.key,s.keyCode),s.key=="Backspace"||s.key=="Delete")){let i=((r=window.visualViewport)===null||r===void 0?void 0:r.height)||0;setTimeout(()=>{var o;(((o=window.visualViewport)===null||o===void 0?void 0:o.height)||0)>i+10&&e.hasFocus&&(e.contentDOM.blur(),e.focus())},100)}return ue.ios&&t.inputType=="deleteContentForward"&&e.observer.flushSoon(),ue.safari&&t.inputType=="insertText"&&e.inputState.composing>=0&&setTimeout(()=>rn.compositionend(e,t),20),!1};var rE=new Set;function IY(e){rE.has(e)||(rE.add(e),e.addEventListener("copy",()=>{}),e.addEventListener("cut",()=>{}))}var sE=["pre-wrap","normal","pre-line","break-spaces"],zo=!1;function iE(){zo=!1}var kY=class{constructor(e){this.lineWrapping=e,this.doc=Fe.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30}heightForGap(e,t){let n=this.doc.lineAt(t).number-this.doc.lineAt(e).number+1;return this.lineWrapping&&(n+=Math.max(0,Math.ceil((t-e-n*this.lineLength*.5)/this.lineLength))),this.lineHeight*n}heightForLine(e){return this.lineWrapping?(1+Math.max(0,Math.ceil((e-this.lineLength)/Math.max(1,this.lineLength-5))))*this.lineHeight:this.lineHeight}setDoc(e){return this.doc=e,this}mustRefreshForWrapping(e){return sE.indexOf(e)>-1!=this.lineWrapping}mustRefreshForHeights(e){let t=!1;for(let n=0;n<e.length;n++){let r=e[n];r<0?n++:this.heightSamples[Math.floor(r*10)]||(t=!0,this.heightSamples[Math.floor(r*10)]=!0)}return t}refresh(e,t,n,r,s,i){let o=sE.indexOf(e)>-1,a=Math.abs(t-this.lineHeight)>.3||this.lineWrapping!=o;if(this.lineWrapping=o,this.lineHeight=t,this.charWidth=n,this.textHeight=r,this.lineLength=s,a){this.heightSamples={};for(let l=0;l<i.length;l++){let c=i[l];c<0?l++:this.heightSamples[Math.floor(c*10)]=!0}}return a}},RY=class{constructor(e,t){this.from=e,this.heights=t,this.index=0}get more(){return this.index<this.heights.length}},Xr=class ZR{constructor(t,n,r,s,i){this.from=t,this.length=n,this.top=r,this.height=s,this._content=i}get type(){return typeof this._content=="number"?Gt.Text:Array.isArray(this._content)?this._content:this._content.type}get to(){return this.from+this.length}get bottom(){return this.top+this.height}get widget(){return this._content instanceof Fl?this._content.widget:null}get widgetLineBreaks(){return typeof this._content=="number"?this._content:0}join(t){let n=(Array.isArray(this._content)?this._content:[this]).concat(Array.isArray(t._content)?t._content:[t]);return new ZR(this.from,this.length+t.length,this.top,this.height+t.height,n)}},Je=(function(e){return e[e.ByPos=0]="ByPos",e[e.ByHeight=1]="ByHeight",e[e.ByPosNoHeight=2]="ByPosNoHeight",e})(Je||(Je={})),ed=.001,lr=class td{constructor(t,n,r=2){this.length=t,this.height=n,this.flags=r}get outdated(){return(this.flags&2)>0}set outdated(t){this.flags=(t?2:0)|this.flags&-3}setHeight(t){this.height!=t&&(Math.abs(this.height-t)>ed&&(zo=!0),this.height=t)}replace(t,n,r){return td.of(r)}decomposeLeft(t,n){n.push(this)}decomposeRight(t,n){n.push(this)}applyChanges(t,n,r,s){let i=this,o=r.doc;for(let a=s.length-1;a>=0;a--){let{fromA:l,toA:c,fromB:u,toB:d}=s[a],h=i.lineAt(l,Je.ByPosNoHeight,r.setDoc(n),0,0),f=h.to>=c?h:i.lineAt(c,Je.ByPosNoHeight,r,0,0);for(d+=f.to-c,c=f.to;a>0&&h.from<=s[a-1].toA;)l=s[a-1].fromA,u=s[a-1].fromB,a--,l<h.from&&(h=i.lineAt(l,Je.ByPosNoHeight,r,0,0));u+=h.from-l,l=h.from;let B=PY.build(r.setDoc(o),t,u,d);i=jd(i,i.replace(l,c,B))}return i.updateHeight(r,0)}static empty(){return new wr(0,0,0)}static of(t){if(t.length==1)return t[0];let n=0,r=t.length,s=0,i=0;for(;;)if(n==r)if(s>i*2){let a=t[n-1];a.break?t.splice(--n,1,a.left,null,a.right):t.splice(--n,1,a.left,a.right),r+=1+a.break,s-=a.size}else if(i>s*2){let a=t[r];a.break?t.splice(r,1,a.left,null,a.right):t.splice(r,1,a.left,a.right),r+=2+a.break,i-=a.size}else break;else if(s<i){let a=t[n++];a&&(s+=a.size)}else{let a=t[--r];a&&(i+=a.size)}let o=!1;return t[n-1]==null?(o=!0,n--):t[n]==null&&(o=!0,r++),new MY(td.of(t.slice(0,n)),o,td.of(t.slice(r)))}};function jd(e,t){return e==t?e:(e.constructor!=t.constructor&&(zo=!0),t)}lr.prototype.size=1;var OY=rt.replace({}),eO=class extends lr{constructor(e,t,n){super(e,t),this.deco=n,this.spaceAbove=0}mainBlock(e,t){return new Xr(t,this.length,e+this.spaceAbove,this.height-this.spaceAbove,this.deco||0)}blockAt(e,t,n,r){return this.spaceAbove&&e<n+this.spaceAbove?new Xr(r,0,n,this.spaceAbove,OY):this.mainBlock(n,r)}lineAt(e,t,n,r,s){let i=this.mainBlock(r,s);return this.spaceAbove?this.blockAt(0,n,r,s).join(i):i}forEachLine(e,t,n,r,s,i){e<=s+this.length&&t>=s&&i(this.lineAt(0,Je.ByPos,n,r,s))}setMeasuredHeight(e){let t=e.heights[e.index++];t<0?(this.spaceAbove=-t,t=e.heights[e.index++]):this.spaceAbove=0,this.setHeight(t)}updateHeight(e,t=0,n=!1,r){return r&&r.from<=t&&r.more&&this.setMeasuredHeight(r),this.outdated=!1,this}toString(){return`block(${this.length})`}},wr=class Km extends eO{constructor(t,n,r){super(t,n,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0,this.spaceAbove=r}mainBlock(t,n){return new Xr(n,this.length,t+this.spaceAbove,this.height-this.spaceAbove,this.breaks)}replace(t,n,r){let s=r[0];return r.length==1&&(s instanceof Km||s instanceof ko&&s.flags&4)&&Math.abs(this.length-s.length)<10?(s instanceof ko?s=new Km(s.length,this.height,this.spaceAbove):s.height=this.height,this.outdated||(s.outdated=!1),s):lr.of(r)}updateHeight(t,n=0,r=!1,s){return s&&s.from<=n&&s.more?this.setMeasuredHeight(s):(r||this.outdated)&&(this.spaceAbove=0,this.setHeight(Math.max(this.widgetHeight,t.heightForLine(this.length-this.collapsed))+this.breaks*t.lineHeight)),this.outdated=!1,this}toString(){return`line(${this.length}${this.collapsed?-this.collapsed:""}${this.widgetHeight?":"+this.widgetHeight:""})`}},ko=class Kn extends lr{constructor(t){super(t,0)}heightMetrics(t,n){let r=t.doc.lineAt(n).number,s=t.doc.lineAt(n+this.length).number,i=s-r+1,o,a=0;if(t.lineWrapping){let l=Math.min(this.height,t.lineHeight*i);o=l/i,this.length>i+1&&(a=(this.height-l)/(this.length-i-1))}else o=this.height/i;return{firstLine:r,lastLine:s,perLine:o,perChar:a}}blockAt(t,n,r,s){let{firstLine:i,lastLine:o,perLine:a,perChar:l}=this.heightMetrics(n,s);if(n.lineWrapping){let c=s+(t<n.lineHeight?0:Math.round(Math.max(0,Math.min(1,(t-r)/this.height))*this.length)),u=n.doc.lineAt(c),d=a+u.length*l,h=Math.max(r,t-d/2);return new Xr(u.from,u.length,h,d,0)}else{let c=Math.max(0,Math.min(o-i,Math.floor((t-r)/a))),{from:u,length:d}=n.doc.line(i+c);return new Xr(u,d,r+a*c,a,0)}}lineAt(t,n,r,s,i){if(n==Je.ByHeight)return this.blockAt(t,r,s,i);if(n==Je.ByPosNoHeight){let{from:f,to:B}=r.doc.lineAt(t);return new Xr(f,B-f,0,0,0)}let{firstLine:o,perLine:a,perChar:l}=this.heightMetrics(r,i),c=r.doc.lineAt(t),u=a+c.length*l,d=c.number-o,h=s+a*d+l*(c.from-i-d);return new Xr(c.from,c.length,Math.max(s,Math.min(h,s+this.height-u)),u,0)}forEachLine(t,n,r,s,i,o){t=Math.max(t,i),n=Math.min(n,i+this.length);let{firstLine:a,perLine:l,perChar:c}=this.heightMetrics(r,i);for(let u=t,d=s;u<=n;){let h=r.doc.lineAt(u);if(u==t){let B=h.number-a;d+=l*B+c*(t-i-B)}let f=l+c*h.length;o(new Xr(h.from,h.length,d,f,0)),d+=f,u=h.to+1}}replace(t,n,r){let s=this.length-n;if(s>0){let i=r[r.length-1];i instanceof Kn?r[r.length-1]=new Kn(i.length+s):r.push(null,new Kn(s-1))}if(t>0){let i=r[0];i instanceof Kn?r[0]=new Kn(t+i.length):r.unshift(new Kn(t-1),null)}return lr.of(r)}decomposeLeft(t,n){n.push(new Kn(t-1),null)}decomposeRight(t,n){n.push(null,new Kn(this.length-t-1))}updateHeight(t,n=0,r=!1,s){let i=n+this.length;if(s&&s.from<=n+this.length&&s.more){let o=[],a=Math.max(n,s.from),l=-1;for(s.from>n&&o.push(new Kn(s.from-n-1).updateHeight(t,n));a<=i&&s.more;){let u=t.doc.lineAt(a).length;o.length&&o.push(null);let d=s.heights[s.index++],h=0;d<0&&(h=-d,d=s.heights[s.index++]),l==-1?l=d:Math.abs(d-l)>=ed&&(l=-2);let f=new wr(u,d,h);f.outdated=!1,o.push(f),a+=u+1}a<=i&&o.push(null,new Kn(i-a).updateHeight(t,a));let c=lr.of(o);return(l<0||Math.abs(c.height-this.height)>=ed||Math.abs(l-this.heightMetrics(t,n).perLine)>=ed)&&(zo=!0),jd(this,c)}else(r||this.outdated)&&(this.setHeight(t.heightForGap(n,n+this.length)),this.outdated=!1);return this}toString(){return`gap(${this.length})`}},MY=class extends lr{constructor(e,t,n){super(e.length+(t?1:0)+n.length,e.height+n.height,(t?1:0)|(e.outdated||n.outdated?2:0)),this.left=e,this.right=n,this.size=e.size+n.size}get break(){return this.flags&1}blockAt(e,t,n,r){let s=n+this.left.height;return e<s?this.left.blockAt(e,t,n,r):this.right.blockAt(e,t,s,r+this.left.length+this.break)}lineAt(e,t,n,r,s){let i=r+this.left.height,o=s+this.left.length+this.break,a=t==Je.ByHeight?e<i:e<o,l=a?this.left.lineAt(e,t,n,r,s):this.right.lineAt(e,t,n,i,o);if(this.break||(a?l.to<o:l.from>o))return l;let c=t==Je.ByPosNoHeight?Je.ByPosNoHeight:Je.ByPos;return a?l.join(this.right.lineAt(o,c,n,i,o)):this.left.lineAt(o,c,n,r,s).join(l)}forEachLine(e,t,n,r,s,i){let o=r+this.left.height,a=s+this.left.length+this.break;if(this.break)e<a&&this.left.forEachLine(e,t,n,r,s,i),t>=a&&this.right.forEachLine(e,t,n,o,a,i);else{let l=this.lineAt(a,Je.ByPos,n,r,s);e<l.from&&this.left.forEachLine(e,Math.min(t,l.from-1),n,r,s,i),l.to>=e&&l.from<=t&&i(l),t>l.to&&this.right.forEachLine(Math.max(e,l.to+1),t,n,o,a,i)}}replace(e,t,n){let r=this.left.length+this.break;if(t<r)return this.balanced(this.left.replace(e,t,n),this.right);if(e>this.left.length)return this.balanced(this.left,this.right.replace(e-r,t-r,n));let s=[];e>0&&this.decomposeLeft(e,s);let i=s.length;for(let o of n)s.push(o);if(e>0&&oE(s,i-1),t<this.length){let o=s.length;this.decomposeRight(t,s),oE(s,o)}return lr.of(s)}decomposeLeft(e,t){let n=this.left.length;if(e<=n)return this.left.decomposeLeft(e,t);t.push(this.left),this.break&&(n++,e>=n&&t.push(null)),e>n&&this.right.decomposeLeft(e-n,t)}decomposeRight(e,t){let n=this.left.length,r=n+this.break;if(e>=r)return this.right.decomposeRight(e-r,t);e<n&&this.left.decomposeRight(e,t),this.break&&e<r&&t.push(null),t.push(this.right)}balanced(e,t){return e.size>2*t.size||t.size>2*e.size?lr.of(this.break?[e,null,t]:[e,t]):(this.left=jd(this.left,e),this.right=jd(this.right,t),this.setHeight(e.height+t.height),this.outdated=e.outdated||t.outdated,this.size=e.size+t.size,this.length=e.length+this.break+t.length,this)}updateHeight(e,t=0,n=!1,r){let{left:s,right:i}=this,o=t+s.length+this.break,a=null;return r&&r.from<=t+s.length&&r.more?a=s=s.updateHeight(e,t,n,r):s.updateHeight(e,t,n),r&&r.from<=o+i.length&&r.more?a=i=i.updateHeight(e,o,n,r):i.updateHeight(e,o,n),a?this.balanced(s,i):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?" ":"-")+this.right}};function oE(e,t){let n,r;e[t]==null&&(n=e[t-1])instanceof ko&&(r=e[t+1])instanceof ko&&e.splice(t-1,3,new ko(n.length+1+r.length))}var NY=5,PY=class tO{constructor(t,n){this.pos=t,this.oracle=n,this.nodes=[],this.lineStart=-1,this.lineEnd=-1,this.covering=null,this.writtenTo=t}get isCovered(){return this.covering&&this.nodes[this.nodes.length-1]==this.covering}span(t,n){if(this.lineStart>-1){let r=Math.min(n,this.lineEnd),s=this.nodes[this.nodes.length-1];s instanceof wr?s.length+=r-this.pos:(r>this.pos||!this.isCovered)&&this.nodes.push(new wr(r-this.pos,-1,0)),this.writtenTo=r,n>r&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=n}point(t,n,r){if(t<n||r.heightRelevant){let s=r.widget?r.widget.estimatedHeight:0,i=r.widget?r.widget.lineBreaks:0;s<0&&(s=this.oracle.lineHeight);let o=n-t;r.block?this.addBlock(new eO(o,s,r)):(o||i||s>=NY)&&this.addLineDeco(s,i,o)}else n>t&&this.span(t,n);this.lineEnd>-1&&this.lineEnd<this.pos&&(this.lineEnd=this.oracle.doc.lineAt(this.pos).to)}enterLine(){if(this.lineStart>-1)return;let{from:t,to:n}=this.oracle.doc.lineAt(this.pos);this.lineStart=t,this.lineEnd=n,this.writtenTo<t&&((this.writtenTo<t-1||this.nodes[this.nodes.length-1]==null)&&this.nodes.push(this.blankContent(this.writtenTo,t-1)),this.nodes.push(null)),this.pos>t&&this.nodes.push(new wr(this.pos-t,-1,0)),this.writtenTo=this.pos}blankContent(t,n){let r=new ko(n-t);return this.oracle.doc.lineAt(t).to==n&&(r.flags|=4),r}ensureLine(){this.enterLine();let t=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(t instanceof wr)return t;let n=new wr(0,-1,0);return this.nodes.push(n),n}addBlock(t){this.enterLine();let n=t.deco;n&&n.startSide>0&&!this.isCovered&&this.ensureLine(),this.nodes.push(t),this.writtenTo=this.pos=this.pos+t.length,n&&n.endSide>0&&(this.covering=t)}addLineDeco(t,n,r){let s=this.ensureLine();s.length+=r,s.collapsed+=r,s.widgetHeight=Math.max(s.widgetHeight,t),s.breaks+=n,this.writtenTo=this.pos=this.pos+r}finish(t){let n=this.nodes.length==0?null:this.nodes[this.nodes.length-1];this.lineStart>-1&&!(n instanceof wr)&&!this.isCovered?this.nodes.push(new wr(0,-1,0)):(this.writtenTo<this.pos||n==null)&&this.nodes.push(this.blankContent(this.writtenTo,this.pos));let r=t;for(let s of this.nodes)s instanceof wr&&s.updateHeight(this.oracle,r),r+=s?s.length:1;return this.nodes}static build(t,n,r,s){let i=new tO(r,t);return et.spans(n,r,s,i,0),i.finish(r)}};function LY(e,t,n){let r=new _Y;return et.compare(e,t,n,r,0),r.changes}var _Y=class{constructor(){this.changes=[]}compareRange(){}comparePoint(e,t,n,r){(e<t||n&&n.heightRelevant||r&&r.heightRelevant)&&Ao(e,t,this.changes,5)}};function FY(e,t){let n=e.getBoundingClientRect(),r=e.ownerDocument,s=r.defaultView||window,i=Math.max(0,n.left),o=Math.min(s.innerWidth,n.right),a=Math.max(0,n.top),l=Math.min(s.innerHeight,n.bottom);for(let c=e.parentNode;c&&c!=r.body;)if(c.nodeType==1){let u=c,d=window.getComputedStyle(u);if((u.scrollHeight>u.clientHeight||u.scrollWidth>u.clientWidth)&&d.overflow!="visible"){let h=u.getBoundingClientRect();i=Math.max(i,h.left),o=Math.min(o,h.right),a=Math.max(a,h.top),l=Math.min(c==e.parentNode?s.innerHeight:l,h.bottom)}c=d.position=="absolute"||d.position=="fixed"?u.offsetParent:u.parentNode}else if(c.nodeType==11)c=c.host;else break;return{left:i-n.left,right:Math.max(i,o)-n.left,top:a-(n.top+t),bottom:Math.max(a,l)-(n.top+t)}}function HY(e){let t=e.getBoundingClientRect(),n=e.ownerDocument.defaultView||window;return t.left<n.innerWidth&&t.right>0&&t.top<n.innerHeight&&t.bottom>0}function jY(e,t){let n=e.getBoundingClientRect();return{left:0,right:n.right-n.left,top:t,bottom:n.bottom-(n.top+t)}}var mB=class{constructor(e,t,n,r){this.from=e,this.to=t,this.size=n,this.displaySize=r}static same(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++){let r=e[n],s=t[n];if(r.from!=s.from||r.to!=s.to||r.size!=s.size)return!1}return!0}draw(e,t){return rt.replace({widget:new GY(this.displaySize*(t?e.scaleY:e.scaleX),t)}).range(this.from,this.to)}},GY=class extends _h{constructor(e,t){super(),this.size=e,this.vertical=t}eq(e){return e.size==this.size&&e.vertical==this.vertical}toDOM(){let e=document.createElement("div");return this.vertical?e.style.height=this.size+"px":(e.style.width=this.size+"px",e.style.height="2px",e.style.display="inline-block"),e}get estimatedHeight(){return this.vertical?this.size:-1}},aE=class{constructor(e,t){this.view=e,this.state=t,this.pixelViewport={left:0,right:window.innerWidth,top:0,bottom:0},this.inView=!0,this.paddingTop=0,this.paddingBottom=0,this.contentDOMWidth=0,this.contentDOMHeight=0,this.editorHeight=0,this.editorWidth=0,this.scaleX=1,this.scaleY=1,this.scrollOffset=0,this.scrolledToBottom=!1,this.scrollAnchorPos=0,this.scrollAnchorHeight=-1,this.scaler=lE,this.scrollTarget=null,this.printing=!1,this.mustMeasureContent=!0,this.defaultTextDirection=nt.LTR,this.visibleRanges=[],this.mustEnforceCursorAssoc=!1;let n=t.facet(mv).some(r=>typeof r!="function"&&r.class=="cm-lineWrapping");this.heightOracle=new kY(n),this.stateDeco=cE(t),this.heightMap=lr.empty().applyChanges(this.stateDeco,Fe.empty,this.heightOracle.setDoc(t.doc),[new rs(0,0,0,t.doc.length)]);for(let r=0;r<2&&(this.viewport=this.getViewport(0,null),!!this.updateForViewport());r++);this.updateViewportLines(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=rt.set(this.lineGaps.map(r=>r.draw(this,!1))),this.scrollParent=e.scrollDOM,this.computeVisibleRanges()}updateForViewport(){let e=[this.viewport],{main:t}=this.state.selection;for(let n=0;n<=1;n++){let r=n?t.head:t.anchor;if(!e.some(({from:s,to:i})=>r>=s&&r<=i)){let{from:s,to:i}=this.lineBlockAt(r);e.push(new lu(s,i))}}return this.viewports=e.sort((n,r)=>n.from-r.from),this.updateScaler()}updateScaler(){let e=this.scaler;return this.scaler=this.heightMap.height<=7e6?lE:new zY(this.heightOracle,this.heightMap,this.viewports),e.eq(this.scaler)?0:2}updateViewportLines(){this.viewportLines=[],this.heightMap.forEachLine(this.viewport.from,this.viewport.to,this.heightOracle.setDoc(this.state.doc),0,0,e=>{this.viewportLines.push(Ha(e,this.scaler))})}update(e,t=null){this.state=e.state;let n=this.stateDeco;this.stateDeco=cE(this.state);let r=e.changedRanges,s=rs.extendWithRanges(r,LY(n,this.stateDeco,e?e.changes:ur.empty(this.state.doc.length))),i=this.heightMap.height,o=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollOffset);iE(),this.heightMap=this.heightMap.applyChanges(this.stateDeco,e.startState.doc,this.heightOracle.setDoc(this.state.doc),s),(this.heightMap.height!=i||zo)&&(e.flags|=2),o?(this.scrollAnchorPos=e.changes.mapPos(o.from,-1),this.scrollAnchorHeight=o.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=i);let a=s.length?this.mapViewport(this.viewport,e.changes):this.viewport;(t&&(t.range.head<a.from||t.range.head>a.to)||!this.viewportIsAppropriate(a))&&(a=this.getViewport(0,t));let l=a.from!=this.viewport.from||a.to!=this.viewport.to;this.viewport=a,e.flags|=this.updateForViewport(),(l||!e.changes.empty||e.flags&2)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(this.mapLineGaps(this.lineGaps,e.changes))),e.flags|=this.computeVisibleRanges(e.changes),t&&(this.scrollTarget=t),!this.mustEnforceCursorAssoc&&(e.selectionSet||e.focusChanged)&&e.view.lineWrapping&&e.state.selection.main.empty&&e.state.selection.main.assoc&&!e.state.facet(wR)&&(this.mustEnforceCursorAssoc=!0)}measure(){let{view:e}=this,t=e.contentDOM,n=window.getComputedStyle(t),r=this.heightOracle,s=n.whiteSpace;this.defaultTextDirection=n.direction=="rtl"?nt.RTL:nt.LTR;let i=this.heightOracle.mustRefreshForWrapping(s)||this.mustMeasureContent==="refresh",o=t.getBoundingClientRect(),a=i||this.mustMeasureContent||this.contentDOMHeight!=o.height;this.contentDOMHeight=o.height,this.mustMeasureContent=!1;let l=0,c=0;if(o.width&&o.height){let{scaleX:E,scaleY:D}=iR(t,o);(E>.005&&Math.abs(this.scaleX-E)>.005||D>.005&&Math.abs(this.scaleY-D)>.005)&&(this.scaleX=E,this.scaleY=D,l|=16,i=a=!0)}let u=(parseInt(n.paddingTop)||0)*this.scaleY,d=(parseInt(n.paddingBottom)||0)*this.scaleY;(this.paddingTop!=u||this.paddingBottom!=d)&&(this.paddingTop=u,this.paddingBottom=d,l|=18),this.editorWidth!=e.scrollDOM.clientWidth&&(r.lineWrapping&&(a=!0),this.editorWidth=e.scrollDOM.clientWidth,l|=16);let h=oR(this.view.contentDOM,!1).y;h!=this.scrollParent&&(this.scrollParent=h,this.scrollAnchorHeight=-1,this.scrollOffset=0);let f=this.getScrollOffset();this.scrollOffset!=f&&(this.scrollAnchorHeight=-1,this.scrollOffset=f),this.scrolledToBottom=uR(this.scrollParent||e.win);let B=(this.printing?jY:FY)(t,this.paddingTop),g=B.top-this.pixelViewport.top,C=B.bottom-this.pixelViewport.bottom;this.pixelViewport=B;let v=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(v!=this.inView&&(this.inView=v,v&&(a=!0)),!this.inView&&!this.scrollTarget&&!HY(e.dom))return 0;let y=o.width;if((this.contentDOMWidth!=y||this.editorHeight!=e.scrollDOM.clientHeight)&&(this.contentDOMWidth=o.width,this.editorHeight=e.scrollDOM.clientHeight,l|=16),a){let E=e.docView.measureVisibleLineHeights(this.viewport);if(r.mustRefreshForHeights(E)&&(i=!0),i||r.lineWrapping&&Math.abs(y-this.contentDOMWidth)>r.charWidth){let{lineHeight:D,charWidth:A,textHeight:x}=e.docView.measureTextSize();i=D>0&&r.refresh(s,D,A,x,Math.max(5,y/A),E),i&&(e.docView.minWidth=0,l|=16)}g>0&&C>0?c=Math.max(g,C):g<0&&C<0&&(c=Math.min(g,C)),iE();for(let D of this.viewports){let A=D.from==this.viewport.from?E:e.docView.measureVisibleLineHeights(D);this.heightMap=(i?lr.empty().applyChanges(this.stateDeco,Fe.empty,this.heightOracle,[new rs(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(r,0,i,new RY(D.from,A))}zo&&(l|=2)}let S=!this.viewportIsAppropriate(this.viewport,c)||this.scrollTarget&&(this.scrollTarget.range.head<this.viewport.from||this.scrollTarget.range.head>this.viewport.to);return S&&(l&2&&(l|=this.updateScaler()),this.viewport=this.getViewport(c,this.scrollTarget),l|=this.updateForViewport()),(l&2||S)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(i?[]:this.lineGaps,e)),l|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,e.docView.enforceCursorAssoc()),l}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}getViewport(e,t){let n=.5-Math.max(-.5,Math.min(.5,e/1e3/2)),r=this.heightMap,s=this.heightOracle,{visibleTop:i,visibleBottom:o}=this,a=new lu(r.lineAt(i-n*1e3,Je.ByHeight,s,0,0).from,r.lineAt(o+(1-n)*1e3,Je.ByHeight,s,0,0).to);if(t){let{head:l}=t.range;if(l<a.from||l>a.to){let c=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),u=r.lineAt(l,Je.ByPos,s,0,0),d;t.y=="center"?d=(u.top+u.bottom)/2-c/2:t.y=="start"||t.y=="nearest"&&l<a.from?d=u.top:d=u.bottom-c,a=new lu(r.lineAt(d-500,Je.ByHeight,s,0,0).from,r.lineAt(d+c+500,Je.ByHeight,s,0,0).to)}}return a}mapViewport(e,t){let n=t.mapPos(e.from,-1),r=t.mapPos(e.to,1);return new lu(this.heightMap.lineAt(n,Je.ByPos,this.heightOracle,0,0).from,this.heightMap.lineAt(r,Je.ByPos,this.heightOracle,0,0).to)}viewportIsAppropriate({from:e,to:t},n=0){if(!this.inView)return!0;let{top:r}=this.heightMap.lineAt(e,Je.ByPos,this.heightOracle,0,0),{bottom:s}=this.heightMap.lineAt(t,Je.ByPos,this.heightOracle,0,0),{visibleTop:i,visibleBottom:o}=this;return(e==0||r<=i-Math.max(10,Math.min(-n,250)))&&(t==this.state.doc.length||s>=o+Math.max(10,Math.min(n,250)))&&r>i-2e3&&s<o+2e3}mapLineGaps(e,t){if(!e.length||t.empty)return e;let n=[];for(let r of e)t.touchesRange(r.from,r.to)||n.push(new mB(t.mapPos(r.from),t.mapPos(r.to),r.size,r.displaySize));return n}ensureLineGaps(e,t){let n=this.heightOracle.lineWrapping,r=n?1e4:2e3,s=r>>1,i=r<<1;if(this.defaultTextDirection!=nt.LTR&&!n)return[];let o=[],a=(c,u,d,h)=>{if(u-c<s)return;let f=this.state.selection.main,B=[f.from];f.empty||B.push(f.to);for(let C of B)if(C>c&&C<u){a(c,C-10,d,h),a(C+10,u,d,h);return}let g=UY(e,C=>C.from>=d.from&&C.to<=d.to&&Math.abs(C.from-c)<s&&Math.abs(C.to-u)<s&&!B.some(v=>C.from<v&&C.to>v));if(!g){if(u<d.to&&t&&n&&t.visibleRanges.some(v=>v.from<=u&&v.to>=u)){let v=t.moveToLineBoundary(se.cursor(u),!1,!0).head;v>c&&(u=v)}let C=this.gapSize(d,c,u,h);g=new mB(c,u,C,n||C<2e6?C:2e6)}o.push(g)},l=c=>{if(c.length<i||c.type!=Gt.Text)return;let u=VY(c.from,c.to,this.stateDeco);if(u.total<i)return;let d=this.scrollTarget?this.scrollTarget.range.head:null,h,f;if(n){let B=r/this.heightOracle.lineLength*this.heightOracle.lineHeight,g,C;if(d!=null){let v=uu(u,d),y=((this.visibleBottom-this.visibleTop)/2+B)/c.height;g=v-y,C=v+y}else g=(this.visibleTop-c.top-B)/c.height,C=(this.visibleBottom-c.top+B)/c.height;h=cu(u,g),f=cu(u,C)}else{let B=u.total*this.heightOracle.charWidth,g=r*this.heightOracle.charWidth,C=0;if(B>2e6)for(let D of e)D.from>=c.from&&D.from<c.to&&D.size!=D.displaySize&&D.from*this.heightOracle.charWidth+C<this.pixelViewport.left&&(C=D.size-D.displaySize);let v=this.pixelViewport.left+C,y=this.pixelViewport.right+C,S,E;if(d!=null){let D=uu(u,d),A=((y-v)/2+g)/B;S=D-A,E=D+A}else S=(v-g)/B,E=(y+g)/B;h=cu(u,S),f=cu(u,E)}h>c.from&&a(c.from,h,c,u),f<c.to&&a(f,c.to,c,u)};for(let c of this.viewportLines)Array.isArray(c.type)?c.type.forEach(l):l(c);return o}gapSize(e,t,n,r){let s=uu(r,n)-uu(r,t);return this.heightOracle.lineWrapping?e.height*s:r.total*this.heightOracle.charWidth*s}updateLineGaps(e){mB.same(e,this.lineGaps)||(this.lineGaps=e,this.lineGapDeco=rt.set(e.map(t=>t.draw(this,this.heightOracle.lineWrapping))))}computeVisibleRanges(e){let t=this.stateDeco;this.lineGaps.length&&(t=t.concat(this.lineGapDeco));let n=[];et.spans(t,this.viewport.from,this.viewport.to,{span(s,i){n.push({from:s,to:i})},point(){}},20);let r=0;if(n.length!=this.visibleRanges.length)r=12;else for(let s=0;s<n.length&&!(r&8);s++){let i=this.visibleRanges[s],o=n[s];(i.from!=o.from||i.to!=o.to)&&(r|=4,e&&e.mapPos(i.from,-1)==o.from&&e.mapPos(i.to,1)==o.to||(r|=8))}return this.visibleRanges=n,r}lineBlockAt(e){return e>=this.viewport.from&&e<=this.viewport.to&&this.viewportLines.find(t=>t.from<=e&&t.to>=e)||Ha(this.heightMap.lineAt(e,Je.ByPos,this.heightOracle,0,0),this.scaler)}lineBlockAtHeight(e){return e>=this.viewportLines[0].top&&e<=this.viewportLines[this.viewportLines.length-1].bottom&&this.viewportLines.find(t=>t.top<=e&&t.bottom>=e)||Ha(this.heightMap.lineAt(this.scaler.fromDOM(e),Je.ByHeight,this.heightOracle,0,0),this.scaler)}getScrollOffset(){return this.scrollParent==this.view.scrollDOM?this.scrollParent.scrollTop*this.scaleY:(this.scrollParent?this.scrollParent.getBoundingClientRect().top:0)-this.view.contentDOM.getBoundingClientRect().top}scrollAnchorAt(e){let t=this.lineBlockAtHeight(e+8);return t.from>=this.viewport.from||this.viewportLines[0].top-e>200?t:this.viewportLines[0]}elementAtHeight(e){return Ha(this.heightMap.blockAt(this.scaler.fromDOM(e),this.heightOracle,0,0),this.scaler)}get docHeight(){return this.scaler.toDOM(this.heightMap.height)}get contentHeight(){return this.docHeight+this.paddingTop+this.paddingBottom}},lu=class{constructor(e,t){this.from=e,this.to=t}};function VY(e,t,n){let r=[],s=e,i=0;return et.spans(n,e,t,{span(){},point(o,a){o>s&&(r.push({from:s,to:o}),i+=o-s),s=a}},20),s<t&&(r.push({from:s,to:t}),i+=t-s),{total:i,ranges:r}}function cu({total:e,ranges:t},n){if(n<=0)return t[0].from;if(n>=1)return t[t.length-1].to;let r=Math.floor(e*n);for(let s=0;;s++){let{from:i,to:o}=t[s],a=o-i;if(r<=a)return i+r;r-=a}}function uu(e,t){let n=0;for(let{from:r,to:s}of e.ranges){if(t<=s){n+=t-r;break}n+=s-r}return n/e.total}function UY(e,t){for(let n of e)if(t(n))return n}var lE={toDOM(e){return e},fromDOM(e){return e},scale:1,eq(e){return e==this}};function cE(e){let t=e.facet(Fh).filter(r=>typeof r!="function"),n=e.facet(gv).filter(r=>typeof r!="function");return n.length&&t.push(et.join(n)),t}var zY=class nO{constructor(t,n,r){let s=0,i=0,o=0;this.viewports=r.map(({from:a,to:l})=>{let c=n.lineAt(a,Je.ByPos,t,0,0).top,u=n.lineAt(l,Je.ByPos,t,0,0).bottom;return s+=u-c,{from:a,to:l,top:c,bottom:u,domTop:0,domBottom:0}}),this.scale=(7e6-s)/(n.height-s);for(let a of this.viewports)a.domTop=o+(a.top-i)*this.scale,o=a.domBottom=a.domTop+(a.bottom-a.top),i=a.bottom}toDOM(t){for(let n=0,r=0,s=0;;n++){let i=n<this.viewports.length?this.viewports[n]:null;if(!i||t<i.top)return s+(t-r)*this.scale;if(t<=i.bottom)return i.domTop+(t-i.top);r=i.bottom,s=i.domBottom}}fromDOM(t){for(let n=0,r=0,s=0;;n++){let i=n<this.viewports.length?this.viewports[n]:null;if(!i||t<i.domTop)return r+(t-s)/this.scale;if(t<=i.domBottom)return i.top+(t-i.domTop);r=i.bottom,s=i.domBottom}}eq(t){return t instanceof nO?this.scale==t.scale&&this.viewports.length==t.viewports.length&&this.viewports.every((n,r)=>n.from==t.viewports[r].from&&n.to==t.viewports[r].to):!1}};function Ha(e,t){if(t.scale==1)return e;let n=t.toDOM(e.top),r=t.toDOM(e.bottom);return new Xr(e.from,e.length,n,r-n,Array.isArray(e._content)?e._content.map(s=>Ha(s,t)):e._content)}var du=Ce.define({combine:e=>e.join(" ")}),Jm=Ce.define({combine:e=>e.indexOf(!0)>-1}),Qm=Ws.newName(),rO=Ws.newName(),sO=Ws.newName(),iO={"&light":"."+rO,"&dark":"."+sO};function Ym(e,t,n){return new Ws(t,{finish(r){return/&/.test(r)?r.replace(/&\w*/,s=>{if(s=="&")return e;if(!n||!n[s])throw new RangeError(`Unsupported selector: ${s}`);return n[s]}):e+" "+r}})}var $Y=Ym("."+Qm,{"&":{position:"relative !important",boxSizing:"border-box","&.cm-focused":{outline:"1px dotted #212121"},display:"flex !important",flexDirection:"column"},".cm-scroller":{display:"flex !important",alignItems:"flex-start !important",fontFamily:"monospace",lineHeight:1.4,height:"100%",overflowX:"auto",position:"relative",zIndex:0,overflowAnchor:"none"},".cm-content":{margin:0,flexGrow:2,flexShrink:0,display:"block",whiteSpace:"pre",wordWrap:"normal",boxSizing:"border-box",minHeight:"100%",padding:"4px 0",outline:"none","&[contenteditable=true]":{WebkitUserModify:"read-write-plaintext-only"}},".cm-lineWrapping":{whiteSpace_fallback:"pre-wrap",whiteSpace:"break-spaces",wordBreak:"break-word",overflowWrap:"anywhere",flexShrink:1},"&light .cm-content":{caretColor:"black"},"&dark .cm-content":{caretColor:"white"},".cm-line":{display:"block",padding:"0 2px 0 6px"},".cm-layer":{userSelect:"none",position:"absolute",left:0,top:0,contain:"size style","& > *":{position:"absolute"}},"&light .cm-selectionBackground":{background:"#d9d9d9"},"&dark .cm-selectionBackground":{background:"#222"},"&light.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#d7d4f0"},"&dark.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#233"},".cm-cursorLayer":{pointerEvents:"none"},"&.cm-focused > .cm-scroller > .cm-cursorLayer":{animation:"steps(1) cm-blink 1.2s infinite"},"@keyframes cm-blink":{"0%":{},"50%":{opacity:0},"100%":{}},"@keyframes cm-blink2":{"0%":{},"50%":{opacity:0},"100%":{}},".cm-cursor, .cm-dropCursor":{borderLeft:"1.2px solid black",marginLeft:"-0.6px",pointerEvents:"none"},".cm-cursor":{display:"none"},"&dark .cm-cursor":{borderLeftColor:"#ddd"},".cm-selectionHandle":{backgroundColor:"currentColor",width:"1.5px"},".cm-selectionHandle-start::before, .cm-selectionHandle-end::before":{content:'""',backgroundColor:"inherit",borderRadius:"50%",width:"8px",height:"8px",position:"absolute",left:"-3.25px"},".cm-selectionHandle-start::before":{top:"-8px"},".cm-selectionHandle-end::before":{bottom:"-8px"},".cm-dropCursor":{position:"absolute"},"&.cm-focused > .cm-scroller > .cm-cursorLayer .cm-cursor":{display:"block"},".cm-iso":{unicodeBidi:"isolate"},".cm-announced":{position:"fixed",top:"-10000px"},"@media print":{".cm-announced":{display:"none"}},"&light .cm-activeLine":{backgroundColor:"#cceeff44"},"&dark .cm-activeLine":{backgroundColor:"#99eeff33"},"&light .cm-specialChar":{color:"red"},"&dark .cm-specialChar":{color:"#f78"},".cm-gutters":{flexShrink:0,display:"flex",height:"100%",boxSizing:"border-box",zIndex:200},".cm-gutters-before":{insetInlineStart:0},".cm-gutters-after":{insetInlineEnd:0},"&light .cm-gutters":{backgroundColor:"#f5f5f5",color:"#6c6c6c",border:"0px solid #ddd","&.cm-gutters-before":{borderRightWidth:"1px"},"&.cm-gutters-after":{borderLeftWidth:"1px"}},"&dark .cm-gutters":{backgroundColor:"#333338",color:"#ccc"},".cm-gutter":{display:"flex !important",flexDirection:"column",flexShrink:0,boxSizing:"border-box",minHeight:"100%",overflow:"hidden"},".cm-gutterElement":{boxSizing:"border-box"},".cm-lineNumbers .cm-gutterElement":{padding:"0 3px 0 5px",minWidth:"20px",textAlign:"right",whiteSpace:"nowrap"},"&light .cm-activeLineGutter":{backgroundColor:"#e2f2ff"},"&dark .cm-activeLineGutter":{backgroundColor:"#222227"},".cm-panels":{boxSizing:"border-box",position:"sticky",left:0,right:0,zIndex:300},"&light .cm-panels":{backgroundColor:"#f5f5f5",color:"black"},".cm-panels-top":{top:"0"},".cm-panels-bottom":{bottom:"0"},"&light .cm-panels-top":{borderBottom:"1px solid #ddd"},"&light .cm-panels-bottom":{borderTop:"1px solid #ddd"},"&dark .cm-panels":{backgroundColor:"#333338",color:"white"},".cm-dialog":{padding:"2px 19px 4px 6px",position:"relative","& label":{fontSize:"80%"}},".cm-dialog-close":{position:"absolute",top:"3px",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",fontSize:"14px",padding:"0"},".cm-tab":{display:"inline-block",overflow:"hidden",verticalAlign:"bottom"},".cm-widgetBuffer":{verticalAlign:"text-top",height:"1em",width:0,display:"inline"},".cm-placeholder":{color:"#888",display:"inline-block",verticalAlign:"top",userSelect:"none"},".cm-highlightSpace":{background:"radial-gradient(circle at 50% 55%, #aaa 20%, transparent 0) no-repeat",backgroundSize:".4em",backgroundPosition:"calc(min(50%, 0px)) center"},".cm-highlightTab":{backgroundImage:`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="200" height="20"><path stroke="%23888" stroke-width="1" fill="none" d="M1 10H196L190 5M190 15L196 10M197 4L197 16"/></svg>')`,backgroundSize:"auto 100%",backgroundPosition:"right 90%",backgroundRepeat:"no-repeat"},".cm-trailingSpace":{backgroundColor:"#ff332255"},".cm-button":{verticalAlign:"middle",color:"inherit",fontSize:"70%",padding:".2em 1em",borderRadius:"1px"},"&light .cm-button":{backgroundImage:"linear-gradient(#eff1f5, #d9d9df)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#b4b4b4, #d0d3d6)"}},"&dark .cm-button":{backgroundImage:"linear-gradient(#393939, #111)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#111, #333)"}},".cm-textfield":{verticalAlign:"middle",color:"inherit",fontSize:"70%",border:"1px solid silver",padding:".2em .5em"},"&light .cm-textfield":{backgroundColor:"white"},"&dark .cm-textfield":{border:"1px solid #555",backgroundColor:"inherit"}},iO),WY={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},gB=ue.ie&&ue.ie_version<=11,qY=class{constructor(e){this.view=e,this.active=!1,this.editContext=null,this.selectionRange=new yQ,this.selectionChanged=!1,this.delayedFlush=-1,this.resizeTimeout=-1,this.queue=[],this.delayedAndroidKey=null,this.flushingAndroidKey=-1,this.lastChange=0,this.scrollTargets=[],this.intersection=null,this.resizeScroll=null,this.intersecting=!1,this.gapIntersection=null,this.gaps=[],this.printQuery=null,this.parentCheck=-1,this.dom=e.contentDOM,this.observer=new MutationObserver(t=>{for(let n of t)this.queue.push(n);(ue.ie&&ue.ie_version<=11||ue.ios&&e.composing)&&t.some(n=>n.type=="childList"&&n.removedNodes.length||n.type=="characterData"&&n.oldValue.length>n.target.nodeValue.length)?this.flushSoon():this.flush()}),window.EditContext&&ue.android&&e.constructor.EDIT_CONTEXT!==!1&&!(ue.chrome&&ue.chrome_version<126)&&(this.editContext=new JY(e),e.state.facet(Yr)&&(e.contentDOM.editContext=this.editContext.editContext)),gB&&(this.onCharData=t=>{this.queue.push({target:t.target,type:"characterData",oldValue:t.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),this.onResize=this.onResize.bind(this),this.onPrint=this.onPrint.bind(this),this.onScroll=this.onScroll.bind(this),window.matchMedia&&(this.printQuery=window.matchMedia("print")),typeof ResizeObserver=="function"&&(this.resizeScroll=new ResizeObserver(()=>{var t;((t=this.view.docView)===null||t===void 0?void 0:t.lastUpdate)<Date.now()-75&&this.onResize()}),this.resizeScroll.observe(e.scrollDOM)),this.addWindowListeners(this.win=e.win),this.start(),typeof IntersectionObserver=="function"&&(this.intersection=new IntersectionObserver(t=>{this.parentCheck<0&&(this.parentCheck=setTimeout(this.listenForScroll.bind(this),1e3)),t.length>0&&t[t.length-1].intersectionRatio>0!=this.intersecting&&(this.intersecting=!this.intersecting,this.intersecting!=this.view.inView&&this.onScrollChanged(document.createEvent("Event")))},{threshold:[0,.001]}),this.intersection.observe(this.dom),this.gapIntersection=new IntersectionObserver(t=>{t.length>0&&t[t.length-1].intersectionRatio>0&&this.onScrollChanged(document.createEvent("Event"))},{})),this.listenForScroll(),this.readSelectionRange()}onScrollChanged(e){this.view.inputState.runHandlers("scroll",e),this.intersecting&&this.view.measure()}onScroll(e){this.intersecting&&this.flush(!1),this.editContext&&this.view.requestMeasure(this.editContext.measureReq),this.onScrollChanged(e)}onResize(){this.resizeTimeout<0&&(this.resizeTimeout=setTimeout(()=>{this.resizeTimeout=-1,this.view.requestMeasure()},50))}onPrint(e){(e.type=="change"||!e.type)&&!e.matches||(this.view.viewState.printing=!0,this.view.measure(),setTimeout(()=>{this.view.viewState.printing=!1,this.view.requestMeasure()},500))}updateGaps(e){if(this.gapIntersection&&(e.length!=this.gaps.length||this.gaps.some((t,n)=>t!=e[n]))){this.gapIntersection.disconnect();for(let t of e)this.gapIntersection.observe(t);this.gaps=e}}onSelectionChange(e){let t=this.selectionChanged;if(!this.readSelectionRange()||this.delayedAndroidKey)return;let{view:n}=this,r=this.selectionRange;if(n.state.facet(Yr)?n.root.activeElement!=this.dom:!ol(this.dom,r))return;let s=r.anchorNode&&n.docView.tile.nearest(r.anchorNode);if(s&&s.isWidget()&&s.widget.ignoreEvent(e)){t||(this.selectionChanged=!1);return}(ue.ie&&ue.ie_version<=11||ue.android&&ue.chrome)&&!n.state.selection.main.empty&&r.focusNode&&al(r.focusNode,r.focusOffset,r.anchorNode,r.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:e}=this,t=Hl(e.root);if(!t)return!1;let n=ue.safari&&e.root.nodeType==11&&e.root.activeElement==this.dom&&KY(this.view,t)||t;if(!n||this.selectionRange.eq(n))return!1;let r=ol(this.dom,n);return r&&!this.selectionChanged&&e.inputState.lastFocusTime>Date.now()-200&&e.inputState.lastTouchTime<Date.now()-300&&SQ(this.dom,n)?(this.view.inputState.lastFocusTime=0,e.docView.updateSelection(),!1):(this.selectionRange.setRange(n),r&&(this.selectionChanged=!0),!0)}setSelectionRange(e,t){this.selectionRange.set(e.node,e.offset,t.node,t.offset),this.selectionChanged=!1}clearSelectionRange(){this.selectionRange.set(null,0,null,0)}listenForScroll(){this.parentCheck=-1;let e=0,t=null;for(let n=this.dom;n;)if(n.nodeType==1)!t&&e<this.scrollTargets.length&&this.scrollTargets[e]==n?e++:t||(t=this.scrollTargets.slice(0,e)),t&&t.push(n),n=n.assignedSlot||n.parentNode;else if(n.nodeType==11)n=n.host;else break;if(e<this.scrollTargets.length&&!t&&(t=this.scrollTargets.slice(0,e)),t){for(let n of this.scrollTargets)n.removeEventListener("scroll",this.onScroll);for(let n of this.scrollTargets=t)n.addEventListener("scroll",this.onScroll)}}ignore(e){if(!this.active)return e();try{return this.stop(),e()}finally{this.start(),this.clear()}}start(){this.active||(this.observer.observe(this.dom,WY),gB&&this.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.active=!0)}stop(){this.active&&(this.active=!1,this.observer.disconnect(),gB&&this.dom.removeEventListener("DOMCharacterDataModified",this.onCharData))}clear(){this.processRecords(),this.queue.length=0,this.selectionChanged=!1}delayAndroidKey(e,t){var n;if(!this.delayedAndroidKey){let r=()=>{let s=this.delayedAndroidKey;s&&(this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=s.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&s.force&&Io(this.dom,s.key,s.keyCode))};this.flushingAndroidKey=this.view.win.requestAnimationFrame(r)}(!this.delayedAndroidKey||e=="Enter")&&(this.delayedAndroidKey={key:e,keyCode:t,force:this.lastChange<Date.now()-50||!!(!((n=this.delayedAndroidKey)===null||n===void 0)&&n.force)})}clearDelayedAndroidKey(){this.win.cancelAnimationFrame(this.flushingAndroidKey),this.delayedAndroidKey=null,this.flushingAndroidKey=-1}flushSoon(){this.delayedFlush<0&&(this.delayedFlush=this.view.win.requestAnimationFrame(()=>{this.delayedFlush=-1,this.flush()}))}forceFlush(){this.delayedFlush>=0&&(this.view.win.cancelAnimationFrame(this.delayedFlush),this.delayedFlush=-1),this.flush()}pendingRecords(){for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}processRecords(){let e=this.pendingRecords();e.length&&(this.queue=[]);let t=-1,n=-1,r=!1;for(let s of e){let i=this.readMutation(s);i&&(i.typeOver&&(r=!0),t==-1?{from:t,to:n}=i:(t=Math.min(i.from,t),n=Math.max(i.to,n)))}return{from:t,to:n,typeOver:r}}readChange(){let{from:e,to:t,typeOver:n}=this.processRecords(),r=this.selectionChanged&&ol(this.dom,this.selectionRange);if(e<0&&!r)return null;e>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1;let s=new cY(this.view,e,t,n);return this.view.docView.domChanged={newSel:s.newSel?s.newSel.main:null},s}flush(e=!0){if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;e&&this.readSelectionRange();let t=this.readChange();if(!t)return this.view.requestMeasure(),!1;let n=this.view.state,r=UR(this.view,t);return this.view.state==n&&(t.domChanged||t.newSel&&!Hd(this.view.state.selection,t.newSel.main))&&this.view.update([]),r}readMutation(e){let t=this.view.docView.tile.nearest(e.target);if(!t||t.isWidget())return null;if(t.markDirty(e.type=="attributes"),e.type=="childList"){let n=uE(t,e.previousSibling||e.target.previousSibling,-1),r=uE(t,e.nextSibling||e.target.nextSibling,1);return{from:n?t.posAfter(n):t.posAtStart,to:r?t.posBefore(r):t.posAtEnd,typeOver:!1}}else return e.type=="characterData"?{from:t.posAtStart,to:t.posAtEnd,typeOver:e.target.nodeValue==e.oldValue}:null}setWindow(e){e!=this.win&&(this.removeWindowListeners(this.win),this.win=e,this.addWindowListeners(this.win))}addWindowListeners(e){e.addEventListener("resize",this.onResize),this.printQuery?this.printQuery.addEventListener?this.printQuery.addEventListener("change",this.onPrint):this.printQuery.addListener(this.onPrint):e.addEventListener("beforeprint",this.onPrint),e.addEventListener("scroll",this.onScroll),e.document.addEventListener("selectionchange",this.onSelectionChange)}removeWindowListeners(e){e.removeEventListener("scroll",this.onScroll),e.removeEventListener("resize",this.onResize),this.printQuery?this.printQuery.removeEventListener?this.printQuery.removeEventListener("change",this.onPrint):this.printQuery.removeListener(this.onPrint):e.removeEventListener("beforeprint",this.onPrint),e.document.removeEventListener("selectionchange",this.onSelectionChange)}update(e){this.editContext&&(this.editContext.update(e),e.startState.facet(Yr)!=e.state.facet(Yr)&&(e.view.contentDOM.editContext=e.state.facet(Yr)?this.editContext.editContext:null))}destroy(){var e,t,n;this.stop(),(e=this.intersection)===null||e===void 0||e.disconnect(),(t=this.gapIntersection)===null||t===void 0||t.disconnect(),(n=this.resizeScroll)===null||n===void 0||n.disconnect();for(let r of this.scrollTargets)r.removeEventListener("scroll",this.onScroll);this.removeWindowListeners(this.win),clearTimeout(this.parentCheck),clearTimeout(this.resizeTimeout),this.win.cancelAnimationFrame(this.delayedFlush),this.win.cancelAnimationFrame(this.flushingAndroidKey),this.editContext&&(this.view.contentDOM.editContext=null,this.editContext.destroy())}};function uE(e,t,n){for(;t;){let r=ht.get(t);if(r&&r.parent==e)return r;let s=t.parentNode;t=s!=e.dom?s:n>0?t.nextSibling:t.previousSibling}return null}function dE(e,t){let n=t.startContainer,r=t.startOffset,s=t.endContainer,i=t.endOffset,o=e.docView.domAtPos(e.state.selection.main.anchor,1);return al(o.node,o.offset,s,i)&&([n,r,s,i]=[s,i,n,r]),{anchorNode:n,anchorOffset:r,focusNode:s,focusOffset:i}}function KY(e,t){if(t.getComposedRanges){let s=t.getComposedRanges(e.root)[0];if(s)return dE(e,s)}let n=null;function r(s){s.preventDefault(),s.stopImmediatePropagation(),n=s.getTargetRanges()[0]}return e.contentDOM.addEventListener("beforeinput",r,!0),e.dom.ownerDocument.execCommand("indent"),e.contentDOM.removeEventListener("beforeinput",r,!0),n?dE(e,n):null}var JY=class{constructor(e){this.from=0,this.to=0,this.pendingContextChange=null,this.handlers=Object.create(null),this.composing=null,this.resetRange(e.state);let t=this.editContext=new window.EditContext({text:e.state.doc.sliceString(this.from,this.to),selectionStart:this.toContextPos(Math.max(this.from,Math.min(this.to,e.state.selection.main.anchor))),selectionEnd:this.toContextPos(e.state.selection.main.head)});this.handlers.textupdate=n=>{let r=e.state.selection.main,{anchor:s,head:i}=r,o=this.toEditorPos(n.updateRangeStart),a=this.toEditorPos(n.updateRangeEnd);e.inputState.composing>=0&&!this.composing&&(this.composing={contextBase:n.updateRangeStart,editorBase:o,drifted:!1});let l=a-o>n.text.length;o==this.from&&s<this.from?o=s:a==this.to&&s>this.to&&(a=s);let c=zR(e.state.sliceDoc(o,a),n.text,(l?r.from:r.to)-o,l?"end":null);if(!c){let d=se.single(this.toEditorPos(n.selectionStart),this.toEditorPos(n.selectionEnd));Hd(d,r)||e.dispatch({selection:d,userEvent:"select"});return}let u={from:c.from+o,to:c.toA+o,insert:Fe.of(n.text.slice(c.from,c.toB).split(`
|
|
78
|
+
`))};if((ue.mac||ue.android)&&u.from==i-1&&/^\. ?$/.test(n.text)&&e.contentDOM.getAttribute("autocorrect")=="off"&&(u={from:o,to:a,insert:Fe.of([n.text.replace("."," ")])}),this.pendingContextChange=u,!e.state.readOnly){let d=this.to-this.from+(u.to-u.from+u.insert.length);Cv(e,u,se.single(this.toEditorPos(n.selectionStart,d),this.toEditorPos(n.selectionEnd,d)))}this.pendingContextChange&&(this.revertPending(e.state),this.setSelection(e.state)),u.from<u.to&&!u.insert.length&&e.inputState.composing>=0&&!/[\\p{Alphabetic}\\p{Number}_]/.test(t.text.slice(Math.max(0,n.updateRangeStart-1),Math.min(t.text.length,n.updateRangeStart+1)))&&this.handlers.compositionend(n)},this.handlers.characterboundsupdate=n=>{let r=[],s=null;for(let i=this.toEditorPos(n.rangeStart),o=this.toEditorPos(n.rangeEnd);i<o;i++){let a=e.coordsForChar(i);s=a&&new DOMRect(a.left,a.top,a.right-a.left,a.bottom-a.top)||s||new DOMRect,r.push(s)}t.updateCharacterBounds(n.rangeStart,r)},this.handlers.textformatupdate=n=>{let r=[];for(let s of n.getTextFormats()){let i=s.underlineStyle,o=s.underlineThickness;if(!/none/i.test(i)&&!/none/i.test(o)){let a=this.toEditorPos(s.rangeStart),l=this.toEditorPos(s.rangeEnd);if(a<l){let c=`text-decoration: underline ${/^[a-z]/.test(i)?i+" ":i=="Dashed"?"dashed ":i=="Squiggle"?"wavy ":""}${/thin/i.test(o)?1:2}px`;r.push(rt.mark({attributes:{style:c}}).range(a,l))}}}e.dispatch({effects:TR.of(rt.set(r))})},this.handlers.compositionstart=()=>{e.inputState.composing<0&&(e.inputState.composing=0,e.inputState.compositionFirstChange=!0)},this.handlers.compositionend=()=>{if(e.inputState.composing=-1,e.inputState.compositionFirstChange=null,this.composing){let{drifted:n}=this.composing;this.composing=null,n&&this.reset(e.state)}};for(let n in this.handlers)t.addEventListener(n,this.handlers[n]);this.measureReq={read:n=>{let r=Hl(n.root);r&&r.rangeCount&&this.editContext.updateSelectionBounds(r.getRangeAt(0).getBoundingClientRect())}}}applyEdits(e){let t=0,n=!1,r=this.pendingContextChange;return e.changes.iterChanges((s,i,o,a,l)=>{if(n)return;let c=l.length-(i-s);if(r&&i>=r.to)if(r.from==s&&r.to==i&&r.insert.eq(l)){r=this.pendingContextChange=null,t+=c,this.to+=c;return}else r=null,this.revertPending(e.state);if(s+=t,i+=t,i<=this.from)this.from+=c,this.to+=c;else if(s<this.to){if(s<this.from||i>this.to||this.to-this.from+l.length>3e4){n=!0;return}this.editContext.updateText(this.toContextPos(s),this.toContextPos(i),l.toString()),this.to+=c}t+=c}),r&&!n&&this.revertPending(e.state),!n}update(e){let t=this.pendingContextChange,n=e.startState.selection.main;this.composing&&(this.composing.drifted||!e.changes.touchesRange(n.from,n.to)&&e.transactions.some(r=>!r.isUserEvent("input.type")&&r.changes.touchesRange(this.from,this.to)))?(this.composing.drifted=!0,this.composing.editorBase=e.changes.mapPos(this.composing.editorBase)):!this.applyEdits(e)||!this.rangeIsValid(e.state)?(this.pendingContextChange=null,this.reset(e.state)):(e.docChanged||e.selectionSet||t)&&this.setSelection(e.state),(e.geometryChanged||e.docChanged||e.selectionSet)&&e.view.requestMeasure(this.measureReq)}resetRange(e){let{head:t}=e.selection.main;this.from=Math.max(0,t-1e4),this.to=Math.min(e.doc.length,t+1e4)}reset(e){this.resetRange(e),this.editContext.updateText(0,this.editContext.text.length,e.doc.sliceString(this.from,this.to)),this.setSelection(e)}revertPending(e){let t=this.pendingContextChange;this.pendingContextChange=null,this.editContext.updateText(this.toContextPos(t.from),this.toContextPos(t.from+t.insert.length),e.doc.sliceString(t.from,t.to))}setSelection(e){let{main:t}=e.selection,n=this.toContextPos(Math.max(this.from,Math.min(this.to,t.anchor))),r=this.toContextPos(t.head);(this.editContext.selectionStart!=n||this.editContext.selectionEnd!=r)&&this.editContext.updateSelection(n,r)}rangeIsValid(e){let{head:t}=e.selection.main;return!(this.from>0&&t-this.from<500||this.to<e.doc.length&&this.to-t<500||this.to-this.from>3e4)}toEditorPos(e,t=this.to-this.from){e=Math.min(e,t);let n=this.composing;return n&&n.drifted?n.editorBase+(e-n.contextBase):e+this.from}toContextPos(e){let t=this.composing;return t&&t.drifted?t.contextBase+(e-t.editorBase):e-this.from}destroy(){for(let e in this.handlers)this.editContext.removeEventListener(e,this.handlers[e])}},xe=class nd{get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return!!this.inputState&&this.inputState.composing>0}get compositionStarted(){return!!this.inputState&&this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}constructor(t={}){var n;this.plugins=[],this.pluginMap=new Map,this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],this.destroyed=!1,this.updateState=2,this.measureScheduled=-1,this.measureRequests=[],this.clearAnnouncement=-1,this.contentDOM=document.createElement("div"),this.scrollDOM=document.createElement("div"),this.scrollDOM.tabIndex=-1,this.scrollDOM.className="cm-scroller",this.scrollDOM.appendChild(this.contentDOM),this.announceDOM=document.createElement("div"),this.announceDOM.className="cm-announced",this.announceDOM.setAttribute("aria-live","polite"),this.dom=document.createElement("div"),this.dom.appendChild(this.announceDOM),this.dom.appendChild(this.scrollDOM),t.parent&&t.parent.appendChild(this.dom);let{dispatch:r}=t;this.dispatchTransactions=t.dispatchTransactions||r&&(s=>s.forEach(i=>r(i,this)))||(s=>this.update(s)),this.dispatch=this.dispatch.bind(this),this._root=t.root||bQ(t.parent)||document,this.viewState=new aE(this,t.state||bt.create(t)),t.scrollTo&&t.scrollTo.is(iu)&&(this.viewState.scrollTarget=t.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(Co).map(s=>new dB(s));for(let s of this.plugins)s.update(this);this.observer=new qY(this),this.inputState=new fY(this),this.inputState.ensureHandlers(this.plugins),this.docView=new KS(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),!((n=document.fonts)===null||n===void 0)&&n.ready&&document.fonts.ready.then(()=>{this.viewState.mustMeasureContent="refresh",this.requestMeasure()})}dispatch(...t){let n=t.length==1&&t[0]instanceof ar?t:t.length==1&&Array.isArray(t[0])?t[0]:[this.state.update(...t)];this.dispatchTransactions(n,this)}update(t){if(this.updateState!=0)throw new Error("Calls to EditorView.update are not allowed while an update is in progress");let n=!1,r=!1,s,i=this.state;for(let h of t){if(h.startState!=i)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");i=h.state}if(this.destroyed){this.viewState.state=i;return}let o=this.hasFocus,a=0,l=null;t.some(h=>h.annotation(QR))?(this.inputState.notifiedFocused=o,a=1):o!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=o,l=YR(i,o),l||(a=1));let c=this.observer.delayedAndroidKey,u=null;if(c?(this.observer.clearDelayedAndroidKey(),u=this.observer.readChange(),(u&&!this.state.doc.eq(i.doc)||!this.state.selection.eq(i.selection))&&(u=null)):this.observer.clear(),i.facet(bt.phrases)!=this.state.facet(bt.phrases))return this.setState(i);s=$S.create(this,i,t),s.flags|=a;let d=this.viewState.scrollTarget;try{this.updateState=2;for(let h of t){if(d&&(d=d.map(h.changes)),h.scrollIntoView){let{main:f}=h.state.selection,{x:B,y:g}=this.state.facet(nd.cursorScrollMargin);d=new uB(f.empty?f:se.cursor(f.head,f.head>f.anchor?-1:1),"nearest","nearest",g,B)}for(let f of h.effects)f.is(iu)&&(d=f.value.clip(this.state))}this.viewState.update(s,d),this.bidiCache=fE.update(this.bidiCache,s.changes),s.empty||(this.updatePlugins(s),this.inputState.update(s)),n=this.docView.update(s),this.state.facet(_a)!=this.styleModules&&this.mountStyles(),r=this.updateAttrs(),this.showAnnouncements(t),this.docView.updateSelection(n,t.some(h=>h.isUserEvent("select.pointer")))}finally{this.updateState=0}if(s.startState.facet(du)!=s.state.facet(du)&&(this.viewState.mustMeasureContent=!0),(n||r||d||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),n&&this.docViewUpdate(),!s.empty)for(let h of this.state.facet(jm))try{h(s)}catch(f){Or(this.state,f,"update listener")}(l||u)&&Promise.resolve().then(()=>{l&&this.state==l.startState&&this.dispatch(l),u&&!UR(this,u)&&c.force&&Io(this.contentDOM,c.key,c.keyCode)})}setState(t){if(this.updateState!=0)throw new Error("Calls to EditorView.setState are not allowed while an update is in progress");if(this.destroyed){this.viewState.state=t;return}this.updateState=2;let n=this.hasFocus;try{for(let r of this.plugins)r.destroy(this);this.viewState=new aE(this,t),this.plugins=t.facet(Co).map(r=>new dB(r)),this.pluginMap.clear();for(let r of this.plugins)r.update(this);this.docView.destroy(),this.docView=new KS(this),this.inputState.ensureHandlers(this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}n&&this.focus(),this.requestMeasure()}updatePlugins(t){let n=t.startState.facet(Co),r=t.state.facet(Co);if(n!=r){let s=[];for(let i of r){let o=n.indexOf(i);if(o<0)s.push(new dB(i));else{let a=this.plugins[o];a.mustUpdate=t,s.push(a)}}for(let i of this.plugins)i.mustUpdate!=t&&i.destroy(this);this.plugins=s,this.pluginMap.clear()}else for(let s of this.plugins)s.mustUpdate=t;for(let s=0;s<this.plugins.length;s++)this.plugins[s].update(this);n!=r&&this.inputState.ensureHandlers(this.plugins)}docViewUpdate(){for(let t of this.plugins){let n=t.value;if(n&&n.docViewUpdate)try{n.docViewUpdate(this)}catch(r){Or(this.state,r,"doc view update listener")}}}measure(t=!0){if(this.destroyed)return;if(this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.observer.delayedAndroidKey){this.measureScheduled=-1,this.requestMeasure();return}this.measureScheduled=0,t&&this.observer.forceFlush();let n=null,r=this.viewState.scrollParent,s=this.viewState.getScrollOffset(),{scrollAnchorPos:i,scrollAnchorHeight:o,scaleY:a}=this.viewState;Math.abs(s-this.viewState.scrollOffset)>1&&(o=-1),this.viewState.scrollAnchorHeight=-1;try{for(let l=0;;l++){if(o<0){if(uR(r||this.win))i=-1,o=this.viewState.heightMap.height/this.viewState.scaleY;else{let B=this.viewState.scrollAnchorAt(s);i=B.from,o=B.top}a=this.viewState.scaleY}this.updateState=1;let c=this.viewState.measure();if(!c&&!this.measureRequests.length&&this.viewState.scrollTarget==null)break;if(l>5){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break}let u=[];c&4||([this.measureRequests,u]=[u,this.measureRequests]);let d=u.map(B=>{try{return B.read(this)}catch(g){return Or(this.state,g),hE}}),h=$S.create(this,this.state,[]),f=!1;h.flags|=c,n?n.flags|=c:n=h,this.updateState=2,h.empty||(this.updatePlugins(h),this.inputState.update(h),this.updateAttrs(),f=this.docView.update(h),f&&this.docViewUpdate());for(let B=0;B<u.length;B++)if(d[B]!=hE)try{let g=u[B];g.write&&g.write(d[B],this)}catch(g){Or(this.state,g)}if(f&&this.docView.updateSelection(!0),!h.viewportChanged&&this.measureRequests.length==0){if(this.viewState.editorHeight)if(this.viewState.scrollTarget){this.docView.scrollIntoView(this.viewState.scrollTarget),this.viewState.scrollTarget=null,o=-1;continue}else{let B=(i<0?this.viewState.heightMap.height:this.viewState.lineBlockAt(i).top)/this.viewState.scaleY-o/a;if((B>1||B<-1)&&!(ue.ios&&this.inputState.lastIOSMomentumScroll>Date.now()-100)&&(r==this.scrollDOM||this.hasFocus||Math.max(this.inputState.lastWheelEvent,this.inputState.lastTouchTime)>Date.now()-100)){s=s+B,r?i<0?r.scrollTop=r.scrollHeight:r.scrollTop+=B:this.win.scrollBy(0,B),o=-1;continue}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(n&&!n.empty)for(let l of this.state.facet(jm))l(n)}get themeClasses(){return Qm+" "+(this.state.facet(Jm)?sO:rO)+" "+this.state.facet(du)}updateAttrs(){let t=BE(this,AR,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),n={spellcheck:"false",autocorrect:"off",autocapitalize:"off",writingsuggestions:"false",translate:"no",contenteditable:this.state.facet(Yr)?"true":"false",class:"cm-content",style:`${ue.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(n["aria-readonly"]="true"),BE(this,mv,n);let r=this.observer.ignore(()=>{let s=jS(this.contentDOM,this.contentAttrs,n),i=jS(this.dom,this.editorAttrs,t);return s||i});return this.editorAttrs=t,this.contentAttrs=n,r}showAnnouncements(t){let n=!0;for(let r of t)for(let s of r.effects)if(s.is(nd.announce)){n&&(this.announceDOM.textContent="",this.win.clearTimeout(this.clearAnnouncement),this.clearAnnouncement=this.win.setTimeout(()=>{this.announceDOM.textContent=" "},200),n=!1);let i=this.announceDOM.appendChild(document.createElement("div"));i.textContent=s.value}}mountStyles(){this.styleModules=this.state.facet(_a);let t=this.state.facet(nd.cspNonce);Ws.mount(this.root,this.styleModules.concat($Y).reverse(),t?{nonce:t}:void 0)}readMeasured(){if(this.updateState==2)throw new Error("Reading the editor layout isn't allowed during an update");this.updateState==0&&this.measureScheduled>-1&&this.measure(!1)}requestMeasure(t){if(this.measureScheduled<0&&(this.measureScheduled=this.win.requestAnimationFrame(()=>this.measure())),t){if(this.measureRequests.indexOf(t)>-1)return;if(t.key!=null){for(let n=0;n<this.measureRequests.length;n++)if(this.measureRequests[n].key===t.key){this.measureRequests[n]=t;return}}this.measureRequests.push(t)}}plugin(t){let n=this.pluginMap.get(t);return(n===void 0||n&&n.plugin!=t)&&this.pluginMap.set(t,n=this.plugins.find(r=>r.plugin==t)||null),n&&n.update(this).value}get documentTop(){return this.contentDOM.getBoundingClientRect().top+this.viewState.paddingTop}get documentPadding(){return{top:this.viewState.paddingTop,bottom:this.viewState.paddingBottom}}get scaleX(){return this.viewState.scaleX}get scaleY(){return this.viewState.scaleY}elementAtHeight(t){return this.readMeasured(),this.viewState.elementAtHeight(t)}lineBlockAtHeight(t){return this.readMeasured(),this.viewState.lineBlockAtHeight(t)}get viewportLineBlocks(){return this.viewState.viewportLines}lineBlockAt(t){return this.viewState.lineBlockAt(t)}get contentHeight(){return this.viewState.contentHeight}moveByChar(t,n,r){return pB(this,t,JS(this,t,n,r))}moveByGroup(t,n){return pB(this,t,JS(this,t,n,r=>rY(this,t.head,r)))}visualLineSide(t,n){return n?se.cursor(t.to,1):se.cursor(t.from,-1)}moveToLineBoundary(t,n,r=!0){return nY(this,t,n,r)}moveVertically(t,n,r){return pB(this,t,sY(this,t,n,r))}domAtPos(t,n=1){return this.docView.domAtPos(t,n)}posAtDOM(t,n=0){return this.docView.posFromDOM(t,n)}posAtCoords(t,n=!0){this.readMeasured();let r=Wm(this,t,n);return r&&r.pos}posAndSideAtCoords(t,n=!0){return this.readMeasured(),Wm(this,t,n)}coordsAtPos(t,n=1){this.readMeasured();let r=this.state.doc.lineAt(t),s=this.bidiSpans(r),i=s[Rr.find(s,t-r.from,-1,n)];return r.length&&(t==r.from&&n<0||t==r.to&&n>0)&&i.dir!=this.textDirectionAt(r.from)&&(t==r.to?(t=r.from+i.from,n=1):(t=r.from+i.to,n=-1)),this.docView.coordsAt(t,n,i.dir==nt.RTL)}coordsForChar(t){return this.readMeasured(),this.docView.coordsForChar(t)}get defaultCharacterWidth(){return this.viewState.heightOracle.charWidth}get defaultLineHeight(){return this.viewState.heightOracle.lineHeight}get textDirection(){return this.viewState.defaultTextDirection}textDirectionAt(t){return!this.state.facet(xR)||t<this.viewport.from||t>this.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(t))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(t){if(t.length>QY)return mR(t.length);let n=this.textDirectionAt(t.from),r;for(let i of this.bidiCache)if(i.from==t.from&&i.dir==n&&(i.fresh||pR(i.isolates,r=zS(this,t))))return i.order;r||(r=zS(this,t));let s=IQ(t.text,n,r);return this.bidiCache.push(new fE(t.from,t.to,n,r,!0,s)),s}get hasFocus(){var t;return(this.dom.ownerDocument.hasFocus()||ue.safari&&((t=this.inputState)===null||t===void 0?void 0:t.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{cR(this.contentDOM),this.docView.updateSelection()})}setRoot(t){this._root!=t&&(this._root=t,this.observer.setWindow((t.nodeType==9?t:t.ownerDocument).defaultView||window),this.mountStyles())}destroy(){this.root.activeElement==this.contentDOM&&this.contentDOM.blur();for(let t of this.plugins)t.destroy(this);this.plugins=[],this.inputState.destroy(),this.docView.destroy(),this.dom.remove(),this.observer.destroy(),this.win.clearTimeout(this.clearAnnouncement),this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.destroyed=!0}static scrollIntoView(t,n={}){var r,s,i,o;return iu.of(new uB(typeof t=="number"?se.cursor(t):t,(r=n.y)!==null&&r!==void 0?r:"nearest",(s=n.x)!==null&&s!==void 0?s:"nearest",(i=n.yMargin)!==null&&i!==void 0?i:5,(o=n.xMargin)!==null&&o!==void 0?o:5))}scrollSnapshot(){let{scrollTop:t,scrollLeft:n}=this.scrollDOM,r=this.viewState.scrollAnchorAt(t);return iu.of(new uB(se.cursor(r.from),"start","start",r.top-t,n,!0))}setTabFocusMode(t){t==null?this.inputState.tabFocusMode=this.inputState.tabFocusMode<0?0:-1:typeof t=="boolean"?this.inputState.tabFocusMode=t?0:-1:this.inputState.tabFocusMode!=0&&(this.inputState.tabFocusMode=Date.now()+t)}static domEventHandlers(t){return Js.define(()=>({}),{eventHandlers:t})}static domEventObservers(t){return Js.define(()=>({}),{eventObservers:t})}static theme(t,n){let r=Ws.newName(),s=[du.of(r),_a.of(Ym(`.${r}`,t))];return n&&n.dark&&s.push(Jm.of(!0)),s}static baseTheme(t){return Nh.lowest(_a.of(Ym("."+Qm,t,iO)))}static findFromDOM(t){var n;let r=t.querySelector(".cm-content"),s=r&&ht.get(r)||ht.get(t);return((n=s?.root)===null||n===void 0?void 0:n.view)||null}};xe.styleModule=_a;xe.inputHandler=SR;xe.clipboardInputFilter=Bv;xe.clipboardOutputFilter=pv;xe.scrollHandler=DR;xe.focusChangeEffect=ER;xe.perLineTextDirection=xR;xe.exceptionSink=bR;xe.updateListener=jm;xe.editable=Yr;xe.mouseSelectionStyle=yR;xe.dragMovesSelection=vR;xe.clickAddsSelectionRange=CR;xe.decorations=Fh;xe.blockWrappers=IR;xe.outerDecorations=gv;xe.atomicRanges=Cc;xe.bidiIsolatedRanges=kR;xe.cursorScrollMargin=Ce.define({combine:e=>{let t=5,n=5;for(let r of e)typeof r=="number"?t=n=r:{x:t,y:n}=r;return{x:t,y:n}}});xe.scrollMargins=RR;xe.darkTheme=Jm;xe.cspNonce=Ce.define({combine:e=>e.length?e[0]:""});xe.contentAttributes=mv;xe.editorAttributes=AR;xe.lineWrapping=xe.contentAttributes.of({class:"cm-lineWrapping"});xe.announce=Tt.define();var QY=4096,hE={},fE=class oO{constructor(t,n,r,s,i,o){this.from=t,this.to=n,this.dir=r,this.isolates=s,this.fresh=i,this.order=o}static update(t,n){if(n.empty&&!t.some(i=>i.fresh))return t;let r=[],s=t.length?t[t.length-1].dir:nt.LTR;for(let i=Math.max(0,t.length-10);i<t.length;i++){let o=t[i];o.dir==s&&!n.touchesRange(o.from,o.to)&&r.push(new oO(n.mapPos(o.from,1),n.mapPos(o.to,-1),o.dir,o.isolates,!1,o.order))}return r}};function BE(e,t,n){for(let r=e.state.facet(t),s=r.length-1;s>=0;s--){let i=r[s],o=typeof i=="function"?i(e):i;o&&cv(o,n)}return n}var YY=ue.mac?"mac":ue.windows?"win":ue.linux?"linux":"key";function XY(e,t){const n=e.split(/-(?!$)/);let r=n[n.length-1];r=="Space"&&(r=" ");let s,i,o,a;for(let l=0;l<n.length-1;++l){const c=n[l];if(/^(cmd|meta|m)$/i.test(c))a=!0;else if(/^a(lt)?$/i.test(c))s=!0;else if(/^(c|ctrl|control)$/i.test(c))i=!0;else if(/^s(hift)?$/i.test(c))o=!0;else if(/^mod$/i.test(c))t=="mac"?a=!0:i=!0;else throw new Error("Unrecognized modifier name: "+c)}return s&&(r="Alt-"+r),i&&(r="Ctrl-"+r),a&&(r="Meta-"+r),o&&(r="Shift-"+r),r}function hu(e,t,n){return t.altKey&&(e="Alt-"+e),t.ctrlKey&&(e="Ctrl-"+e),t.metaKey&&(e="Meta-"+e),n!==!1&&t.shiftKey&&(e="Shift-"+e),e}var ZY=Nh.default(xe.domEventHandlers({keydown(e,t){return r7(e7(t.state),e,t,"editor")}})),aO=Ce.define({enables:ZY}),pE=new WeakMap;function e7(e){let t=e.facet(aO),n=pE.get(t);return n||pE.set(t,n=n7(t.reduce((r,s)=>r.concat(s),[]))),n}var ks=null,t7=4e3;function n7(e,t=YY){let n=Object.create(null),r=Object.create(null),s=(o,a)=>{let l=r[o];if(l==null)r[o]=a;else if(l!=a)throw new Error("Key binding "+o+" is used both as a regular binding and as a multi-stroke prefix")},i=(o,a,l,c,u)=>{var d,h;let f=n[o]||(n[o]=Object.create(null)),B=a.split(/ (?!$)/).map(v=>XY(v,t));for(let v=1;v<B.length;v++){let y=B.slice(0,v).join(" ");s(y,!0),f[y]||(f[y]={preventDefault:!0,stopPropagation:!1,run:[S=>{let E=ks={view:S,prefix:y,scope:o};return setTimeout(()=>{ks==E&&(ks=null)},t7),!0}]})}let g=B.join(" ");s(g,!1);let C=f[g]||(f[g]={preventDefault:!1,stopPropagation:!1,run:((h=(d=f._any)===null||d===void 0?void 0:d.run)===null||h===void 0?void 0:h.slice())||[]});l&&C.run.push(l),c&&(C.preventDefault=!0),u&&(C.stopPropagation=!0)};for(let o of e){let a=o.scope?o.scope.split(" "):["editor"];if(o.any)for(let c of a){let u=n[c]||(n[c]=Object.create(null));u._any||(u._any={preventDefault:!1,stopPropagation:!1,run:[]});let{any:d}=o;for(let h in u)u[h].run.push(f=>d(f,Xm))}let l=o[t]||o.key;if(l)for(let c of a)i(c,l,o.run,o.preventDefault,o.stopPropagation),o.shift&&i(c,"Shift-"+l,o.shift,o.preventDefault,o.stopPropagation)}return n}var Xm=null;function r7(e,t,n,r){Xm=t;let s=BQ(t),i=J9(s,0),o=Q9(i)==s.length&&s!=" ",a="",l=!1,c=!1,u=!1;ks&&ks.view==n&&ks.scope==r&&(a=ks.prefix+" ",WR.indexOf(t.keyCode)<0&&(c=!0,ks=null));let d=new Set,h=C=>{if(C){for(let v of C.run)if(!d.has(v)&&(d.add(v),v(n)))return C.stopPropagation&&(u=!0),!0;C.preventDefault&&(C.stopPropagation&&(u=!0),c=!0)}return!1},f=e[r],B,g;return f&&(h(f[a+hu(s,t,!o)])?l=!0:o&&(t.altKey||t.metaKey||t.ctrlKey)&&!(ue.windows&&t.ctrlKey&&t.altKey)&&!(ue.mac&&t.altKey&&!(t.ctrlKey||t.metaKey))&&(B=qs[t.keyCode])&&B!=s?(h(f[a+hu(B,t,!0)])||t.shiftKey&&(g=_l[t.keyCode])!=s&&g!=B&&h(f[a+hu(g,t,!1)]))&&(l=!0):o&&t.shiftKey&&h(f[a+hu(s,t,!0)])&&(l=!0),!l&&h(f._any)&&(l=!0)),c&&(l=!0),l&&u&&t.stopPropagation(),Xm=null,l}var cl=class lO{constructor(t,n,r,s,i){this.className=t,this.left=n,this.top=r,this.width=s,this.height=i}draw(){let t=document.createElement("div");return t.className=this.className,this.adjust(t),t}update(t,n){return n.className!=this.className?!1:(this.adjust(t),!0)}adjust(t){t.style.left=this.left+"px",t.style.top=this.top+"px",this.width!=null&&(t.style.width=this.width+"px"),t.style.height=this.height+"px"}eq(t){return this.left==t.left&&this.top==t.top&&this.width==t.width&&this.height==t.height&&this.className==t.className}static forRange(t,n,r){if(r.empty){let s=t.coordsAtPos(r.head,r.assoc||1);if(!s)return[];let i=cO(t);return[new lO(n,s.left-i.left,s.top-i.top,null,s.bottom-s.top)]}else return s7(t,n,r)}};function cO(e){let t=e.scrollDOM.getBoundingClientRect();return{left:(e.textDirection==nt.LTR?t.left:t.right-e.scrollDOM.clientWidth*e.scaleX)-e.scrollDOM.scrollLeft*e.scaleX,top:t.top-e.scrollDOM.scrollTop*e.scaleY}}function mE(e,t,n,r){let s=e.coordsAtPos(t,n*2);if(!s)return r;let i=e.dom.getBoundingClientRect(),o=(s.top+s.bottom)/2,a=e.posAtCoords({x:i.left+1,y:o}),l=e.posAtCoords({x:i.right-1,y:o});return a==null||l==null?r:{from:Math.max(r.from,Math.min(a,l)),to:Math.min(r.to,Math.max(a,l))}}function s7(e,t,n){if(n.to<=e.viewport.from||n.from>=e.viewport.to)return[];let r=Math.max(n.from,e.viewport.from),s=Math.min(n.to,e.viewport.to),i=e.textDirection==nt.LTR,o=e.contentDOM,a=o.getBoundingClientRect(),l=cO(e),c=o.querySelector(".cm-line"),u=c&&window.getComputedStyle(c),d=a.left+(u?parseInt(u.paddingLeft)+Math.min(0,parseInt(u.textIndent)):0),h=a.right-(u?parseInt(u.paddingRight):0),f=$m(e,r,1),B=$m(e,s,-1),g=f.type==Gt.Text?f:null,C=B.type==Gt.Text?B:null;if(g&&(e.lineWrapping||f.widgetLineBreaks)&&(g=mE(e,r,1,g)),C&&(e.lineWrapping||B.widgetLineBreaks)&&(C=mE(e,s,-1,C)),g&&C&&g.from==C.from&&g.to==C.to)return y(S(n.from,n.to,g));{let D=g?S(n.from,null,g):E(f,!1),A=C?S(null,n.to,C):E(B,!0),x=[];return(g||f).to<(C||B).from-(g&&C?1:0)||f.widgetLineBreaks>1&&D.bottom+e.defaultLineHeight/2<A.top?x.push(v(d,D.bottom,h,A.top)):D.bottom<A.top&&e.elementAtHeight((D.bottom+A.top)/2).type==Gt.Text&&(D.bottom=A.top=(D.bottom+A.top)/2),y(D).concat(x).concat(y(A))}function v(D,A,x,O){return new cl(t,D-l.left,A-l.top,Math.max(0,x-D),O-A)}function y({top:D,bottom:A,horizontal:x}){let O=[];for(let R=0;R<x.length;R+=2)O.push(v(x[R],D,x[R+1],A));return O}function S(D,A,x){let O=1e9,R=-1e9,P=[];function _(q,F,z,J,Z){let Q=e.coordsAtPos(q,q==x.to?-2:2),G=e.coordsAtPos(z,z==x.from?2:-2);!Q||!G||(O=Math.min(Q.top,G.top,O),R=Math.max(Q.bottom,G.bottom,R),Z==nt.LTR?P.push(i&&F?d:Q.left,i&&J?h:G.right):P.push(!i&&J?d:G.left,!i&&F?h:Q.right))}let N=D??x.from,W=A??x.to;for(let q of e.visibleRanges)if(q.to>N&&q.from<W)for(let F=Math.max(q.from,N),z=Math.min(q.to,W);;){let J=e.state.doc.lineAt(F);for(let Z of e.bidiSpans(J)){let Q=Z.from+J.from,G=Z.to+J.from;if(Q>=z)break;G>F&&_(Math.max(Q,F),D==null&&Q<=N,Math.min(G,z),A==null&&G>=W,Z.dir)}if(F=J.to+1,F>=z)break}return P.length==0&&_(N,D==null,W,A==null,e.textDirection),{top:O,bottom:R,horizontal:P}}function E(D,A){let x=a.top+(A?D.top:D.bottom);return{top:x,bottom:x,horizontal:[]}}}function i7(e,t){return e.constructor==t.constructor&&e.eq(t)}var o7=class{constructor(e,t){this.view=e,this.layer=t,this.drawn=[],this.scaleX=1,this.scaleY=1,this.measureReq={read:this.measure.bind(this),write:this.draw.bind(this)},this.dom=e.scrollDOM.appendChild(document.createElement("div")),this.dom.classList.add("cm-layer"),t.above&&this.dom.classList.add("cm-layer-above"),t.class&&this.dom.classList.add(t.class),this.scale(),this.dom.setAttribute("aria-hidden","true"),this.setOrder(e.state),e.requestMeasure(this.measureReq),t.mount&&t.mount(this.dom,e)}update(e){e.startState.facet(rd)!=e.state.facet(rd)&&this.setOrder(e.state),(this.layer.update(e,this.dom)||e.geometryChanged)&&(this.scale(),e.view.requestMeasure(this.measureReq))}docViewUpdate(e){this.layer.updateOnDocViewUpdate!==!1&&e.requestMeasure(this.measureReq)}setOrder(e){let t=0,n=e.facet(rd);for(;t<n.length&&n[t]!=this.layer;)t++;this.dom.style.zIndex=String((this.layer.above?150:-1)-t)}measure(){return this.layer.markers(this.view)}scale(){let{scaleX:e,scaleY:t}=this.view;(e!=this.scaleX||t!=this.scaleY)&&(this.scaleX=e,this.scaleY=t,this.dom.style.transform=`scale(${1/e}, ${1/t})`)}draw(e){if(e.length!=this.drawn.length||e.some((t,n)=>!i7(t,this.drawn[n]))){let t=this.dom.firstChild,n=0;for(let r of e)r.update&&t&&r.constructor&&this.drawn[n].constructor&&r.update(t,this.drawn[n])?(t=t.nextSibling,n++):this.dom.insertBefore(r.draw(),t);for(;t;){let r=t.nextSibling;t.remove(),t=r}this.drawn=e,ue.webkit&&(this.dom.style.display=this.dom.firstChild?"":"none")}}destroy(){this.layer.destroy&&this.layer.destroy(this.dom,this.view),this.dom.remove()}},rd=Ce.define();function uO(e){return[Js.define(t=>new o7(t,e)),rd.of(e)]}var $o=Ce.define({combine(e){return av(e,{cursorBlinkRate:1200,drawRangeCursor:!0,iosSelectionHandles:!0},{cursorBlinkRate:(t,n)=>Math.min(t,n),drawRangeCursor:(t,n)=>t||n})}});function a7(e={}){return[$o.of(e),l7,c7,d7,wR.of(!0)]}function dO(e){return e.startState.facet($o)!=e.state.facet($o)}var l7=uO({above:!0,markers(e){let{state:t}=e,n=t.facet($o),r=[];for(let s of t.selection.ranges){let i=s==t.selection.main;if(s.empty||n.drawRangeCursor&&!(i&&ue.ios&&n.iosSelectionHandles)){let o=i?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",a=s.empty?s:se.cursor(s.head,s.assoc);for(let l of cl.forRange(e,o,a))r.push(l)}}return r},update(e,t){e.transactions.some(r=>r.selection)&&(t.style.animationName=t.style.animationName=="cm-blink"?"cm-blink2":"cm-blink");let n=dO(e);return n&&gE(e.state,t),e.docChanged||e.selectionSet||n},mount(e,t){gE(t.state,e)},class:"cm-cursorLayer"});function gE(e,t){t.style.animationDuration=e.facet($o).cursorBlinkRate+"ms"}var c7=uO({above:!1,markers(e){let t=[],{main:n,ranges:r}=e.state.selection;for(let s of r)if(!s.empty)for(let i of cl.forRange(e,"cm-selectionBackground",s))t.push(i);if(ue.ios&&!n.empty&&e.state.facet($o).iosSelectionHandles){for(let s of cl.forRange(e,"cm-selectionHandle cm-selectionHandle-start",se.cursor(n.from,1)))t.push(s);for(let s of cl.forRange(e,"cm-selectionHandle cm-selectionHandle-end",se.cursor(n.to,1)))t.push(s)}return t},update(e,t){return e.docChanged||e.selectionSet||e.viewportChanged||dO(e)},class:"cm-selectionLayer"}),u7=ue.gecko&&ue.gecko_version==153?"#ffffff01":"transparent",d7=Nh.highest(xe.theme({".cm-line":{"& ::selection, &::selection":{backgroundColor:`${u7} !important`},caretColor:"transparent !important"},".cm-content":{caretColor:"transparent !important","& :focus":{caretColor:"initial !important","&::selection, & ::selection":{backgroundColor:"Highlight !important"}}}})),rle=/x/.unicode!=null?"gu":"g";function h7(){return B7}var f7=rt.line({class:"cm-activeLine"}),B7=Js.fromClass(class{constructor(e){this.decorations=this.getDeco(e)}update(e){(e.docChanged||e.selectionSet)&&(this.decorations=this.getDeco(e.view))}getDeco(e){let t=-1,n=[];for(let r of e.state.selection.ranges){let s=e.lineBlockAt(r.head);s.from>t&&(n.push(f7.range(s.from)),t=s.from)}return rt.set(n)}},{decorations:e=>e.decorations}),Qs=class extends Li{compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}eq(e){return!1}destroy(e){}};Qs.prototype.elementClass="";Qs.prototype.toDOM=void 0;Qs.prototype.mapMode=xn.TrackBefore;Qs.prototype.startSide=Qs.prototype.endSide=-1;Qs.prototype.point=!0;var sd=Ce.define(),p7=Ce.define(),id=Ce.define(),Zm=Ce.define({combine:e=>e.some(t=>t)});function m7(e){let t=[g7];return e&&e.fixed===!1&&t.push(Zm.of(!0)),t}var g7=Js.fromClass(class{constructor(e){this.view=e,this.domAfter=null,this.prevViewport=e.viewport,this.dom=document.createElement("div"),this.dom.className="cm-gutters cm-gutters-before",this.dom.setAttribute("aria-hidden","true"),this.dom.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.gutters=e.state.facet(id).map(t=>new vE(e,t)),this.fixed=!e.state.facet(Zm);for(let t of this.gutters)t.config.side=="after"?this.getDOMAfter().appendChild(t.dom):this.dom.appendChild(t.dom);this.fixed&&(this.dom.style.position="sticky"),this.syncGutters(!1),e.scrollDOM.insertBefore(this.dom,e.contentDOM)}getDOMAfter(){return this.domAfter||(this.domAfter=document.createElement("div"),this.domAfter.className="cm-gutters cm-gutters-after",this.domAfter.setAttribute("aria-hidden","true"),this.domAfter.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.domAfter.style.position=this.fixed?"sticky":"",this.view.scrollDOM.appendChild(this.domAfter)),this.domAfter}update(e){if(this.updateGutters(e)){let t=this.prevViewport,n=e.view.viewport,r=Math.min(t.to,n.to)-Math.max(t.from,n.from);this.syncGutters(r<(n.to-n.from)*.8)}if(e.geometryChanged){let t=this.view.contentHeight/this.view.scaleY+"px";this.dom.style.minHeight=t,this.domAfter&&(this.domAfter.style.minHeight=t)}this.view.state.facet(Zm)!=!this.fixed&&(this.fixed=!this.fixed,this.dom.style.position=this.fixed?"sticky":"",this.domAfter&&(this.domAfter.style.position=this.fixed?"sticky":"")),this.prevViewport=e.view.viewport}syncGutters(e){let t=this.dom.nextSibling;e&&(this.dom.remove(),this.domAfter&&this.domAfter.remove());let n=et.iter(this.view.state.facet(sd),this.view.viewport.from),r=[],s=this.gutters.map(i=>new C7(i,this.view.viewport,-this.view.documentPadding.top));for(let i of this.view.viewportLineBlocks)if(r.length&&(r=[]),Array.isArray(i.type)){let o=!0;for(let a of i.type)if(a.type==Gt.Text&&o){eg(n,r,a.from);for(let l of s)l.line(this.view,a,r);o=!1}else if(a.widget)for(let l of s)l.widget(this.view,a)}else if(i.type==Gt.Text){eg(n,r,i.from);for(let o of s)o.line(this.view,i,r)}else if(i.widget)for(let o of s)o.widget(this.view,i);for(let i of s)i.finish();e&&(this.view.scrollDOM.insertBefore(this.dom,t),this.domAfter&&this.view.scrollDOM.appendChild(this.domAfter))}updateGutters(e){let t=e.startState.facet(id),n=e.state.facet(id),r=e.docChanged||e.heightChanged||e.viewportChanged||!et.eq(e.startState.facet(sd),e.state.facet(sd),e.view.viewport.from,e.view.viewport.to);if(t==n)for(let s of this.gutters)s.update(e)&&(r=!0);else{r=!0;let s=[];for(let i of n){let o=t.indexOf(i);o<0?s.push(new vE(this.view,i)):(this.gutters[o].update(e),s.push(this.gutters[o]))}for(let i of this.gutters)i.dom.remove(),s.indexOf(i)<0&&i.destroy();for(let i of s)i.config.side=="after"?this.getDOMAfter().appendChild(i.dom):this.dom.appendChild(i.dom);this.gutters=s}return r}destroy(){for(let e of this.gutters)e.destroy();this.dom.remove(),this.domAfter&&this.domAfter.remove()}},{provide:e=>xe.scrollMargins.of(t=>{let n=t.plugin(e);if(!n||n.gutters.length==0||!n.fixed)return null;let r=n.dom.offsetWidth*t.scaleX,s=n.domAfter?n.domAfter.offsetWidth*t.scaleX:0;return t.textDirection==nt.LTR?{left:r,right:s}:{right:r,left:s}})});function CE(e){return Array.isArray(e)?e:[e]}function eg(e,t,n){for(;e.value&&e.from<=n;)e.from==n&&t.push(e.value),e.next()}var C7=class{constructor(e,t,n){this.gutter=e,this.height=n,this.i=0,this.cursor=et.iter(e.markers,t.from)}addElement(e,t,n){let{gutter:r}=this,s=(t.top-this.height)/e.scaleY,i=t.height/e.scaleY;if(this.i==r.elements.length){let o=new hO(e,i,s,n);r.elements.push(o),r.dom.appendChild(o.dom)}else r.elements[this.i].update(e,i,s,n);this.height=t.bottom,this.i++}line(e,t,n){let r=[];eg(this.cursor,r,t.from),n.length&&(r=r.concat(n));let s=this.gutter.config.lineMarker(e,t,r);s&&r.unshift(s);let i=this.gutter;r.length==0&&!i.config.renderEmptyElements||this.addElement(e,t,r)}widget(e,t){let n=this.gutter.config.widgetMarker(e,t.widget,t),r=n?[n]:null;for(let s of e.state.facet(p7)){let i=s(e,t.widget,t);i&&(r||(r=[])).push(i)}r&&this.addElement(e,t,r)}finish(){let e=this.gutter;for(;e.elements.length>this.i;){let t=e.elements.pop();e.dom.removeChild(t.dom),t.destroy()}}},vE=class{constructor(e,t){this.view=e,this.config=t,this.elements=[],this.spacer=null,this.dom=document.createElement("div"),this.dom.className="cm-gutter"+(this.config.class?" "+this.config.class:"");for(let n in t.domEventHandlers)this.dom.addEventListener(n,r=>{let s=r.target,i;if(s!=this.dom&&this.dom.contains(s)){for(;s.parentNode!=this.dom;)s=s.parentNode;let a=s.getBoundingClientRect();i=(a.top+a.bottom)/2}else i=r.clientY;let o=e.lineBlockAtHeight(i-e.documentTop);t.domEventHandlers[n](e,o,r)&&r.preventDefault()});this.markers=CE(t.markers(e)),t.initialSpacer&&(this.spacer=new hO(e,0,0,[t.initialSpacer(e)]),this.dom.appendChild(this.spacer.dom),this.spacer.dom.style.cssText+="visibility: hidden; pointer-events: none")}update(e){let t=this.markers;if(this.markers=CE(this.config.markers(e.view)),this.spacer&&this.config.updateSpacer){let r=this.config.updateSpacer(this.spacer.markers[0],e);r!=this.spacer.markers[0]&&this.spacer.update(e.view,0,0,[r])}let n=e.view.viewport;return!et.eq(this.markers,t,n.from,n.to)||(this.config.lineMarkerChange?this.config.lineMarkerChange(e):!1)}destroy(){for(let e of this.elements)e.destroy()}},hO=class{constructor(e,t,n,r){this.height=-1,this.above=0,this.markers=[],this.dom=document.createElement("div"),this.dom.className="cm-gutterElement",this.update(e,t,n,r)}update(e,t,n,r){this.height!=t&&(this.height=t,this.dom.style.height=t+"px"),this.above!=n&&(this.dom.style.marginTop=(this.above=n)?n+"px":""),v7(this.markers,r)||this.setMarkers(e,r)}setMarkers(e,t){let n="cm-gutterElement",r=this.dom.firstChild;for(let s=0,i=0;;){let o=i,a=s<t.length?t[s++]:null,l=!1;if(a){let c=a.elementClass;c&&(n+=" "+c);for(let u=i;u<this.markers.length;u++)if(this.markers[u].compare(a)){o=u,l=!0;break}}else o=this.markers.length;for(;i<o;){let c=this.markers[i++];if(c.toDOM){c.destroy(r);let u=r.nextSibling;r.remove(),r=u}}if(!a)break;a.toDOM&&(l?r=r.nextSibling:this.dom.insertBefore(a.toDOM(e),r)),l&&i++}this.dom.className=n,this.markers=t}destroy(){this.setMarkers(null,[])}};function v7(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].compare(t[n]))return!1;return!0}var y7=Ce.define(),b7=Ce.define(),vo=Ce.define({combine(e){return av(e,{formatNumber:String,domEventHandlers:{}},{domEventHandlers(t,n){let r=Object.assign({},t);for(let s in n){let i=r[s],o=n[s];r[s]=i?(a,l,c)=>i(a,l,c)||o(a,l,c):o}return r}})}}),CB=class extends Qs{constructor(e){super(),this.number=e}eq(e){return this.number==e.number}toDOM(){return document.createTextNode(this.number)}};function vB(e,t){return e.state.facet(vo).formatNumber(t,e.state)}var S7=id.compute([vo],e=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers(t){return t.state.facet(y7)},lineMarker(t,n,r){return r.some(s=>s.toDOM)?null:new CB(vB(t,t.state.doc.lineAt(n.from).number))},widgetMarker:(t,n,r)=>{for(let s of t.state.facet(b7)){let i=s(t,n,r);if(i)return i}return null},lineMarkerChange:t=>t.startState.facet(vo)!=t.state.facet(vo),initialSpacer(t){return new CB(vB(t,yE(t.state.doc.lines)))},updateSpacer(t,n){let r=vB(n.view,yE(n.view.state.doc.lines));return r==t.number?t:new CB(r)},domEventHandlers:e.facet(vo).domEventHandlers,side:"before"}));function E7(e={}){return[vo.of(e),m7(),S7]}function yE(e){let t=9;for(;t<e;)t=t*10+9;return t}var x7=new class extends Qs{constructor(){super(...arguments),this.elementClass="cm-activeLineGutter"}},w7=sd.compute(["selection"],e=>{let t=[],n=-1;for(let r of e.selection.ranges){let s=e.doc.lineAt(r.head).from;s>n&&(n=s,t.push(x7.range(s)))}return et.of(t)});function D7(){return w7}var yB,yo=new ke;function T7(e){return Ce.define({combine:e?t=>t.concat(e):void 0})}var A7=new ke,er=class{constructor(e,t,n=[],r=""){this.data=e,this.name=r,bt.prototype.hasOwnProperty("tree")||Object.defineProperty(bt.prototype,"tree",{get(){return Fr(this)}}),this.parser=t,this.extension=[Wo.of(this),bt.languageData.of((s,i,o)=>{let a=bE(s,i,o),l=a.type.prop(yo);if(!l)return[];let c=s.facet(l),u=a.type.prop(A7);if(u){let d=a.resolve(i-a.from,o);for(let h of u)if(h.test(d,s)){let f=s.facet(h.facet);return h.type=="replace"?f:f.concat(c)}}return c})].concat(n)}isActiveAt(e,t,n=-1){return bE(e,t,n).type.prop(yo)==this.data}findRegions(e){let t=e.facet(Wo);if(t?.data==this.data)return[{from:0,to:e.doc.length}];if(!t||!t.allowsNesting)return[];let n=[],r=(s,i)=>{if(s.prop(yo)==this.data){n.push({from:i,to:i+s.length});return}let o=s.prop(ke.mounted);if(o){if(o.tree.prop(yo)==this.data){if(o.overlay)for(let a of o.overlay)n.push({from:a.from+i,to:a.to+i});else n.push({from:i,to:i+s.length});return}else if(o.overlay){let a=n.length;if(r(o.tree,o.overlay[0].from+i),n.length>a)return}}for(let a=0;a<s.children.length;a++){let l=s.children[a];l instanceof Pt&&r(l,s.positions[a]+i)}};return r(Fr(e),0),n}get allowsNesting(){return!0}};er.setState=Tt.define();function bE(e,t,n){let r=e.facet(Wo),s=Fr(e).topNode;if(!r||r.allowsNesting)for(let i=s;i;i=i.enter(t,n,ut.ExcludeBuffers|ut.EnterBracketed))i.type.isTop&&(s=i);return s}var I7=class tg extends er{constructor(t,n,r){super(t,n,[],r),this.parser=n}static define(t){let n=T7(t.languageData);return new tg(n,t.parser.configure({props:[yo.add(r=>r.isTop?n:void 0)]}),t.name)}configure(t,n){return new tg(this.data,this.parser.configure(t),n||this.name)}get allowsNesting(){return this.parser.hasWrappers()}};function Fr(e){let t=e.field(er.state,!1);return t?t.tree:Pt.empty}var k7=class{constructor(e){this.doc=e,this.cursorPos=0,this.string="",this.cursor=e.iter()}get length(){return this.doc.length}syncTo(e){return this.string=this.cursor.next(e-this.cursorPos).value,this.cursorPos=e+this.string.length,this.cursorPos-this.string.length}chunk(e){return this.syncTo(e),this.string}get lineChunks(){return!0}read(e,t){let n=this.cursorPos-this.string.length;return e<n||t>=this.cursorPos?this.doc.sliceString(e,t):this.string.slice(e-n,t-n)}},ya=null,R7=class ng{constructor(t,n,r=[],s,i,o,a,l){this.parser=t,this.state=n,this.fragments=r,this.tree=s,this.treeLen=i,this.viewport=o,this.skipped=a,this.scheduleOn=l,this.parse=null,this.tempSkipped=[]}static create(t,n,r){return new ng(t,n,[],Pt.empty,0,r,[],null)}startParse(){return this.parser.startParse(new k7(this.state.doc),this.fragments)}work(t,n){return n!=null&&n>=this.state.doc.length&&(n=void 0),this.tree!=Pt.empty&&this.isDone(n??this.state.doc.length)?(this.takeTree(),!0):this.withContext(()=>{var r;if(typeof t=="number"){let s=Date.now()+t;t=()=>Date.now()>s}for(this.parse||(this.parse=this.startParse()),n!=null&&(this.parse.stoppedAt==null||this.parse.stoppedAt>n)&&n<this.state.doc.length&&this.parse.stopAt(n);;){let s=this.parse.advance();if(s)if(this.fragments=this.withoutTempSkipped($u.addTree(s,this.fragments,this.parse.stoppedAt!=null)),this.treeLen=(r=this.parse.stoppedAt)!==null&&r!==void 0?r:this.state.doc.length,this.tree=s,this.parse=null,this.treeLen<(n??this.state.doc.length))this.parse=this.startParse();else return!0;if(t())return!1}})}takeTree(){let t,n;this.parse&&(t=this.parse.parsedPos)>=this.treeLen&&((this.parse.stoppedAt==null||this.parse.stoppedAt>t)&&this.parse.stopAt(t),this.withContext(()=>{for(;!(n=this.parse.advance()););}),this.treeLen=t,this.tree=n,this.fragments=this.withoutTempSkipped($u.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(t){let n=ya;ya=this;try{return t()}finally{ya=n}}withoutTempSkipped(t){for(let n;n=this.tempSkipped.pop();)t=SE(t,n.from,n.to);return t}changes(t,n){let{fragments:r,tree:s,treeLen:i,viewport:o,skipped:a}=this;if(this.takeTree(),!t.empty){let l=[];if(t.iterChangedRanges((c,u,d,h)=>l.push({fromA:c,toA:u,fromB:d,toB:h})),r=$u.applyChanges(r,l),s=Pt.empty,i=0,o={from:t.mapPos(o.from,-1),to:t.mapPos(o.to,1)},this.skipped.length){a=[];for(let c of this.skipped){let u=t.mapPos(c.from,1),d=t.mapPos(c.to,-1);u<d&&a.push({from:u,to:d})}}}return new ng(this.parser,n,r,s,i,o,a,this.scheduleOn)}updateViewport(t){if(this.viewport.from==t.from&&this.viewport.to==t.to)return!1;this.viewport=t;let n=this.skipped.length;for(let r=0;r<this.skipped.length;r++){let{from:s,to:i}=this.skipped[r];s<t.to&&i>t.from&&(this.fragments=SE(this.fragments,s,i),this.skipped.splice(r--,1))}return this.skipped.length>=n?!1:(this.reset(),!0)}reset(){this.parse&&(this.takeTree(),this.parse=null)}skipUntilInView(t,n){this.skipped.push({from:t,to:n})}static getSkippingParser(t){return new class extends Ck{createParse(n,r,s){let i=s[0].from,o=s[s.length-1].to;return{parsedPos:i,advance(){let a=ya;if(a){for(let l of s)a.tempSkipped.push(l);t&&(a.scheduleOn=a.scheduleOn?Promise.all([a.scheduleOn,t]):t)}return this.parsedPos=o,new Pt(jn.none,[],[],o-i)},stoppedAt:null,stopAt(){}}}}}isDone(t){t=Math.min(t,this.state.doc.length);let n=this.fragments;return this.treeLen>=t&&n.length&&n[0].from==0&&n[0].to>=t}static get(){return ya}};function SE(e,t,n){return $u.applyChanges(e,[{fromA:t,toA:n,fromB:t,toB:n}])}var rg=class sg{constructor(t){this.context=t,this.tree=t.tree}apply(t){if(!t.docChanged&&this.tree==this.context.tree)return this;let n=this.context.changes(t.changes,t.state),r=this.context.treeLen==t.startState.doc.length?void 0:Math.max(t.changes.mapPos(this.context.treeLen),n.viewport.to);return n.work(20,r)||n.takeTree(),new sg(n)}static init(t){let n=Math.min(3e3,t.doc.length),r=R7.create(t.facet(Wo).parser,t,{from:0,to:n});return r.work(20,n)||r.takeTree(),new sg(r)}};er.state=gc.define({create:rg.init,update(e,t){for(let n of t.effects)if(n.is(er.setState))return n.value;return t.startState.facet(Wo)!=t.state.facet(Wo)?rg.init(t.state):e.apply(t)}});var fO=e=>{let t=setTimeout(()=>e(),500);return()=>clearTimeout(t)};typeof requestIdleCallback<"u"&&(fO=e=>{let t=-1,n=setTimeout(()=>{t=requestIdleCallback(e,{timeout:400})},100);return()=>t<0?clearTimeout(n):cancelIdleCallback(t)});var bB=typeof navigator<"u"&&(!((yB=navigator.scheduling)===null||yB===void 0)&&yB.isInputPending)?()=>navigator.scheduling.isInputPending():null,O7=Js.fromClass(class{constructor(t){this.view=t,this.working=null,this.workScheduled=0,this.chunkEnd=-1,this.chunkBudget=-1,this.work=this.work.bind(this),this.scheduleWork()}update(t){let n=this.view.state.field(er.state).context;(n.updateViewport(t.view.viewport)||this.view.viewport.to>n.treeLen)&&this.scheduleWork(),(t.docChanged||t.selectionSet)&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(n)}scheduleWork(){if(this.working)return;let{state:t}=this.view,n=t.field(er.state);(n.tree!=n.context.tree||!n.context.isDone(t.doc.length))&&(this.working=fO(this.work))}work(t){this.working=null;let n=Date.now();if(this.chunkEnd<n&&(this.chunkEnd<0||this.view.hasFocus)&&(this.chunkEnd=n+3e4,this.chunkBudget=3e3),this.chunkBudget<=0)return;let{state:r,viewport:{to:s}}=this.view,i=r.field(er.state);if(i.tree==i.context.tree&&i.context.isDone(s+1e5))return;let o=Date.now()+Math.min(this.chunkBudget,100,t&&!bB?Math.max(25,t.timeRemaining()-5):1e9),a=i.context.treeLen<s&&r.doc.length>s+1e3,l=i.context.work(()=>bB&&bB()||Date.now()>o,s+(a?0:1e5));this.chunkBudget-=Date.now()-n,(l||this.chunkBudget<=0)&&(i.context.takeTree(),this.view.dispatch({effects:er.setState.of(new rg(i.context))})),this.chunkBudget>0&&!(l&&!a)&&this.scheduleWork(),this.checkAsyncSchedule(i.context)}checkAsyncSchedule(t){t.scheduleOn&&(this.workScheduled++,t.scheduleOn.then(()=>this.scheduleWork()).catch(n=>Or(this.view.state,n)).then(()=>this.workScheduled--),t.scheduleOn=null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),Wo=Ce.define({combine(e){return e.length?e[0]:null},enables:e=>[er.state,O7,xe.contentAttributes.compute([e],t=>{let n=t.facet(e);return n&&n.name?{"data-language":n.name}:{}})]}),M7=class{constructor(e,t=[]){this.language=e,this.support=t,this.extension=[e,t]}},N7=Ce.define(),vv=Ce.define({combine:e=>{if(!e.length)return" ";let t=e[0];if(!t||/\S/.test(t)||Array.from(t).some(n=>n!=t[0]))throw new Error("Invalid indent unit: "+JSON.stringify(e[0]));return t}});function Gd(e){let t=e.facet(vv);return t.charCodeAt(0)==9?e.tabSize*t.length:t.length}function Vl(e,t){let n="",r=e.tabSize,s=e.facet(vv)[0];if(s==" "){for(;t>=r;)n+=" ",t-=r;s=" "}for(let i=0;i<t;i++)n+=s;return n}function yv(e,t){e instanceof bt&&(e=new Vh(e));for(let r of e.state.facet(N7)){let s=r(e,t);if(s!==void 0)return s}let n=Fr(e.state);return n.length>=t?P7(e,n,t):null}var Vh=class{constructor(e,t={}){this.state=e,this.options=t,this.unit=Gd(e)}lineAt(e,t=1){let n=this.state.doc.lineAt(e),{simulateBreak:r,simulateDoubleBreak:s}=this.options;return r!=null&&r>=n.from&&r<=n.to?s&&r==e?{text:"",from:e}:(t<0?r<e:r<=e)?{text:n.text.slice(r-n.from),from:r}:{text:n.text.slice(0,r-n.from),from:n.from}:n}textAfterPos(e,t=1){if(this.options.simulateDoubleBreak&&e==this.options.simulateBreak)return"";let{text:n,from:r}=this.lineAt(e,t);return n.slice(e-r,Math.min(n.length,e+100-r))}column(e,t=1){let{text:n,from:r}=this.lineAt(e,t),s=this.countColumn(n,e-r),i=this.options.overrideIndentation?this.options.overrideIndentation(r):-1;return i>-1&&(s+=i-this.countColumn(n,n.search(/\S|$/))),s}countColumn(e,t=e.length){return Ph(e,this.state.tabSize,t)}lineIndent(e,t=1){let{text:n,from:r}=this.lineAt(e,t),s=this.options.overrideIndentation;if(s){let i=s(r);if(i>-1)return i}return this.countColumn(n,n.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}},BO=new ke;function P7(e,t,n){let r=t.resolveStack(n),s=t.resolveInner(n,-1).resolve(n,0).enterUnfinishedNodesBefore(n);if(s!=r.node){let i=[];for(let o=s;o&&!(o.from<r.node.from||o.to>r.node.to||o.from==r.node.from&&o.type==r.node.type);o=o.parent)i.push(o);for(let o=i.length-1;o>=0;o--)r={node:i[o],next:r}}return pO(r,e,n)}function pO(e,t,n){for(let r=e;r;r=r.next){let s=_7(r.node);if(s)return s(H7.create(t,n,r))}return 0}function L7(e){return e.pos==e.options.simulateBreak&&e.options.simulateDoubleBreak}function _7(e){let t=e.type.prop(BO);if(t)return t;let n=e.firstChild,r;if(n&&(r=n.type.prop(ke.closedBy))){let s=e.lastChild,i=s&&r.indexOf(s.name)>-1;return o=>V7(o,!0,1,void 0,i&&!L7(o)?s.from:void 0)}return e.parent==null?F7:null}function F7(){return 0}var H7=class mO extends Vh{constructor(t,n,r){super(t.state,t.options),this.base=t,this.pos=n,this.context=r}get node(){return this.context.node}static create(t,n,r){return new mO(t,n,r)}get textAfter(){return this.textAfterPos(this.pos)}get baseIndent(){return this.baseIndentFor(this.node)}baseIndentFor(t){let n=this.state.doc.lineAt(t.from);for(;;){let r=t.resolve(n.from);for(;r.parent&&r.parent.from==r.from;)r=r.parent;if(j7(r,t))break;n=this.state.doc.lineAt(r.from)}return this.lineIndent(n.from)}continue(){return pO(this.context.next,this.base,this.pos)}};function j7(e,t){for(let n=t;n;n=n.parent)if(e==n)return!0;return!1}function G7(e){let t=e.node,n=t.childAfter(t.from),r=t.lastChild;if(!n)return null;let s=e.options.simulateBreak,i=e.state.doc.lineAt(n.from),o=s==null||s<=i.from?i.to:Math.min(i.to,s);for(let a=n.to;;){let l=t.childAfter(a);if(!l||l==r)return null;if(!l.type.isSkipped){if(l.from>=o)return null;let c=/^ */.exec(i.text.slice(n.to-i.from))[0].length;return{from:n.from,to:n.to+c}}a=l.to}}function V7(e,t,n,r,s){let i=e.textAfter,o=i.match(/^\s*/)[0].length,a=r&&i.slice(o,o+r.length)==r||s==e.pos+o,l=t?G7(e):null;return l?a?e.column(l.from):e.column(l.to):e.baseIndent+(a?0:e.unit*n)}function EE({except:e,units:t=1}={}){return n=>{let r=e&&e.test(n.textAfter);return n.baseIndent+(r?0:t*n.unit)}}var U7=200;function z7(){return bt.transactionFilter.of(e=>{if(!e.docChanged||!e.isUserEvent("input.type")&&!e.isUserEvent("input.complete"))return e;let t=e.startState.languageDataAt("indentOnInput",e.startState.selection.main.head);if(!t.length)return e;let n=e.newDoc,{head:r}=e.newSelection.main,s=n.lineAt(r);if(r>s.from+U7)return e;let i=n.sliceString(s.from,r);if(!t.some(c=>c.test(i)))return e;let{state:o}=e,a=-1,l=[];for(let{head:c}of o.selection.ranges){let u=o.doc.lineAt(c);if(u.from==a)continue;a=u.from;let d=yv(o,u.from);if(d==null)continue;let h=/^\s*/.exec(u.text)[0],f=Vl(o,d);h!=f&&l.push({from:u.from,to:u.from+h.length,insert:f})}return l.length?[e,{changes:l,sequential:!0}]:e})}var $7=new ke;function W7(e){let t=e.firstChild,n=e.lastChild;return t&&t.to<n.from?{from:t.to,to:n.type.isError?e.to:n.from}:null}var bv=class gO{constructor(t,n){this.specs=t;let r;function s(a){let l=Ws.newName();return(r||(r=Object.create(null)))["."+l]=a,l}const i=typeof n.all=="string"?n.all:n.all?s(n.all):void 0,o=n.scope;this.scope=o instanceof er?a=>a.prop(yo)==o.data:o?a=>a==o:void 0,this.style=Ek(t.map(a=>({tag:a.tag,class:a.class||s(Object.assign({},a,{tag:null}))})),{all:i}).style,this.module=r?new Ws(r):null,this.themeType=n.themeType}static define(t,n){return new gO(t,n||{})}},ig=Ce.define(),CO=Ce.define({combine(e){return e.length?[e[0]]:null}});function SB(e){let t=e.facet(ig);return t.length?t:e.facet(CO)}function q7(e,t){let n=[J7],r;return e instanceof bv&&(e.module&&n.push(xe.styleModule.of(e.module)),r=e.themeType),t?.fallback?n.push(CO.of(e)):r?n.push(ig.computeN([xe.darkTheme],s=>s.facet(xe.darkTheme)==(r=="dark")?[e]:[])):n.push(ig.of(e)),n}var K7=class{constructor(e){this.markCache=Object.create(null),this.tree=Fr(e.state),this.decorations=this.buildDeco(e,SB(e.state)),this.decoratedTo=e.viewport.to}update(e){let t=Fr(e.state),n=SB(e.state),r=n!=SB(e.startState),{viewport:s}=e.view,i=e.changes.mapPos(this.decoratedTo,1);t.length<s.to&&!r&&t.type==this.tree.type&&i>=s.to?(this.decorations=this.decorations.map(e.changes),this.decoratedTo=i):(t!=this.tree||e.viewportChanged||r)&&(this.tree=t,this.decorations=this.buildDeco(e.view,n),this.decoratedTo=s.to)}buildDeco(e,t){if(!t||!this.tree.length)return rt.none;let n=new Yu;for(let{from:r,to:s}of e.visibleRanges)_9(this.tree,t,(i,o,a)=>{n.add(i,o,this.markCache[a]||(this.markCache[a]=rt.mark({class:a})))},r,s);return n.finish()}},J7=Nh.high(Js.fromClass(K7,{decorations:e=>e.decorations})),ile=bv.define([{tag:re.meta,color:"#404740"},{tag:re.link,textDecoration:"underline"},{tag:re.heading,textDecoration:"underline",fontWeight:"bold"},{tag:re.emphasis,fontStyle:"italic"},{tag:re.strong,fontWeight:"bold"},{tag:re.strikethrough,textDecoration:"line-through"},{tag:re.keyword,color:"#708"},{tag:[re.atom,re.bool,re.url,re.contentSeparator,re.labelName],color:"#219"},{tag:[re.literal,re.inserted],color:"#164"},{tag:[re.string,re.deleted],color:"#a11"},{tag:[re.regexp,re.escape,re.special(re.string)],color:"#e40"},{tag:re.definition(re.variableName),color:"#00f"},{tag:re.local(re.variableName),color:"#30a"},{tag:[re.typeName,re.namespace],color:"#085"},{tag:re.className,color:"#167"},{tag:[re.special(re.variableName),re.macroName],color:"#256"},{tag:re.definition(re.propertyName),color:"#00c"},{tag:re.comment,color:"#940"},{tag:re.invalid,color:"#f00"}]),Q7=xe.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),vO=1e4,yO="()[]{}",bO=Ce.define({combine(e){return av(e,{afterCursor:!0,brackets:yO,maxScanDistance:vO,renderMatch:Z7})}}),Y7=rt.mark({class:"cm-matchingBracket"}),X7=rt.mark({class:"cm-nonmatchingBracket"});function Z7(e){let t=[],n=e.matched?Y7:X7;return t.push(n.range(e.start.from,e.start.to)),e.end&&t.push(n.range(e.end.from,e.end.to)),t}function xE(e){let t=[],n=e.facet(bO);for(let r of e.selection.ranges){if(!r.empty)continue;let s=Mr(e,r.head,-1,n)||r.head>0&&Mr(e,r.head-1,1,n)||n.afterCursor&&(Mr(e,r.head,1,n)||r.head<e.doc.length&&Mr(e,r.head+1,-1,n));s&&(t=t.concat(n.renderMatch(s,e)))}return rt.set(t,!0)}var eX=[Js.fromClass(class{constructor(e){this.paused=!1,this.decorations=xE(e.state)}update(e){(e.docChanged||e.selectionSet||this.paused)&&(e.view.composing?(this.decorations=this.decorations.map(e.changes),this.paused=!0):(this.decorations=xE(e.state),this.paused=!1))}},{decorations:e=>e.decorations}),Q7];function tX(e={}){return[bO.of(e),eX]}var nX=new ke;function og(e,t,n){let r=e.prop(t<0?ke.openedBy:ke.closedBy);if(r)return r;if(e.name.length==1){let s=n.indexOf(e.name);if(s>-1&&s%2==(t<0?1:0))return[n[s+t]]}return null}function ag(e){let t=e.type.prop(nX);return t?t(e.node):e}function Mr(e,t,n,r={}){let s=r.maxScanDistance||vO,i=r.brackets||yO,o=Fr(e),a=o.resolveInner(t,n);for(let l=a;l;l=l.parent){let c=og(l.type,n,i);if(c&&l.from<l.to){let u=ag(l);if(u&&(n>0?t>=u.from&&t<u.to:t>u.from&&t<=u.to))return rX(e,t,n,l,u,c,i)}}return sX(e,t,n,o,a.type,s,i)}function rX(e,t,n,r,s,i,o){let a=r.parent,l={from:s.from,to:s.to},c=0,u=a?.cursor();if(u&&(n<0?u.childBefore(r.from):u.childAfter(r.to)))do if(n<0?u.to<=r.from:u.from>=r.to){if(c==0&&i.indexOf(u.type.name)>-1&&u.from<u.to){let d=ag(u);return{start:l,end:d?{from:d.from,to:d.to}:void 0,matched:!0}}else if(og(u.type,n,o))c++;else if(og(u.type,-n,o)){if(c==0){let d=ag(u);return{start:l,end:d&&d.from<d.to?{from:d.from,to:d.to}:void 0,matched:!1}}c--}}while(n<0?u.prevSibling():u.nextSibling());return{start:l,matched:!1}}function sX(e,t,n,r,s,i,o){if(n<0?!t:t==e.doc.length)return null;let a=n<0?e.sliceDoc(t-1,t):e.sliceDoc(t,t+1),l=o.indexOf(a);if(l<0||l%2==0!=n>0)return null;let c={from:n<0?t-1:t,to:n>0?t+1:t},u=e.doc.iterRange(t,n>0?e.doc.length:0),d=0;for(let h=0;!u.next().done&&h<=i;){let f=u.value;n<0&&(h+=f.length);let B=t+h*n;for(let g=n>0?0:f.length-1,C=n>0?f.length:-1;g!=C;g+=n){let v=o.indexOf(f[g]);if(!(v<0||r.resolveInner(B+g,1).type!=s))if(v%2==0==n>0)d++;else{if(d==1)return{start:c,end:{from:B+g,to:B+g+1},matched:v>>1==l>>1};d--}}n>0&&(h+=f.length)}return u.done?{start:c,matched:!1}:null}var iX=Object.create(null),wE=[jn.none],DE=[],TE=Object.create(null),oX=Object.create(null);for(let[e,t]of[["variable","variableName"],["variable-2","variableName.special"],["string-2","string.special"],["def","variableName.definition"],["tag","tagName"],["attribute","attributeName"],["type","typeName"],["builtin","variableName.standard"],["qualifier","modifier"],["error","invalid"],["header","heading"],["property","propertyName"]])oX[e]=aX(iX,t);function EB(e,t){DE.indexOf(e)>-1||(DE.push(e),console.warn(t))}function aX(e,t){let n=[];for(let a of t.split(" ")){let l=[];for(let c of a.split(".")){let u=e[c]||re[c];u?typeof u=="function"?l.length?l=l.map(u):EB(c,`Modifier ${c} used at start of tag`):l.length?EB(c,`Tag ${c} used as modifier`):l=Array.isArray(u)?u:[u]:EB(c,`Unknown highlighting tag ${c}`)}for(let c of l)n.push(c)}if(!n.length)return 0;let r=t.replace(/ /g,"_"),s=r+" "+n.map(a=>a.id),i=TE[s];if(i)return i.id;let o=TE[s]=jn.define({id:wE.length,name:r,props:[bk({[r]:n})]});return wE.push(o),o.id}var ole={rtl:rt.mark({class:"cm-iso",inclusive:!0,attributes:{dir:"rtl"},bidiIsolate:nt.RTL}),ltr:rt.mark({class:"cm-iso",inclusive:!0,attributes:{dir:"ltr"},bidiIsolate:nt.LTR}),auto:rt.mark({class:"cm-iso",inclusive:!0,attributes:{dir:"auto"},bidiIsolate:null})},lX=I7.define({name:"json",parser:G9.configure({props:[BO.add({Object:EE({except:/^\s*\}/}),Array:EE({except:/^\s*\]/})}),$7.add({"Object Array":W7})]}),languageData:{closeBrackets:{brackets:["[","{",'"']},indentOnInput:/^\s*[\}\]]$/}});function cX(){return new M7(lX)}var uX=e=>{let{state:t}=e,n=t.doc.lineAt(t.selection.main.from),r=Ev(e.state,n.from);return r.line?dX(e):r.block?fX(e):!1};function Sv(e,t){return({state:n,dispatch:r})=>{if(n.readOnly)return!1;let s=e(t,n);return s?(r(n.update(s)),!0):!1}}var dX=Sv(mX,0),hX=Sv(SO,0),fX=Sv((e,t)=>SO(e,t,pX(t)),0);function Ev(e,t){let n=e.languageDataAt("commentTokens",t,1);return n.length?n[0]:{}}var fu=50;function BX(e,{open:t,close:n},r,s){let i=e.sliceDoc(r-fu,r),o=e.sliceDoc(s,s+fu),a=/\s*$/.exec(i)[0].length,l=/^\s*/.exec(o)[0].length,c=i.length-a;if(i.slice(c-t.length,c)==t&&o.slice(l,l+n.length)==n)return{open:{pos:r-a,margin:a&&1},close:{pos:s+l,margin:l&&1}};let u,d;s-r<=100?u=d=e.sliceDoc(r,s):(u=e.sliceDoc(r,r+fu),d=e.sliceDoc(s-fu,s));let h=/^\s*/.exec(u)[0].length,f=/\s*$/.exec(d)[0].length,B=d.length-f-n.length;return u.slice(h,h+t.length)==t&&d.slice(B,B+n.length)==n?{open:{pos:r+h+t.length,margin:/\s/.test(u.charAt(h+t.length))?1:0},close:{pos:s-f-n.length,margin:/\s/.test(d.charAt(B-1))?1:0}}:null}function pX(e){let t=[];for(let n of e.selection.ranges){let r=e.doc.lineAt(n.from),s=n.to<=r.to?r:e.doc.lineAt(n.to);s.from>r.from&&s.from==n.to&&(s=n.to==r.to+1?r:e.doc.lineAt(n.to-1));let i=t.length-1;i>=0&&t[i].to>r.from?t[i].to=s.to:t.push({from:r.from+/^\s*/.exec(r.text)[0].length,to:s.to})}return t}function SO(e,t,n=t.selection.ranges){let r=n.map(i=>Ev(t,i.from).block);if(!r.every(i=>i))return null;let s=n.map((i,o)=>BX(t,r[o],i.from,i.to));if(e!=2&&!s.every(i=>i))return{changes:t.changes(n.map((i,o)=>s[o]?[]:[{from:i.from,insert:r[o].open+" "},{from:i.to,insert:" "+r[o].close}]))};if(e!=1&&s.some(i=>i)){let i=[];for(let o=0,a;o<s.length;o++)if(a=s[o]){let l=r[o],{open:c,close:u}=a;i.push({from:c.pos-l.open.length,to:c.pos+c.margin},{from:u.pos-u.margin,to:u.pos+l.close.length})}return{changes:i}}return null}function mX(e,t,n=t.selection.ranges){let r=[],s=-1;e:for(let{from:i,to:o}of n){let a=r.length,l=1e9,c;for(let u=i;u<=o;){let d=t.doc.lineAt(u);if(c==null&&(c=Ev(t,d.from).line,!c))continue e;if(d.from>s&&(i==o||o>d.from)){s=d.from;let h=/^\s*/.exec(d.text)[0].length,f=h==d.length,B=d.text.slice(h,h+c.length)==c?h:-1;h<d.text.length&&h<l&&(l=h),r.push({line:d,comment:B,token:c,indent:h,empty:f,single:!1})}u=d.to+1}if(l<1e9)for(let u=a;u<r.length;u++)r[u].indent<r[u].line.text.length&&(r[u].indent=l);r.length==a+1&&(r[a].single=!0)}if(e!=2&&r.some(i=>i.comment<0&&(!i.empty||i.single))){let i=[];for(let{line:a,token:l,indent:c,empty:u,single:d}of r)(d||!u)&&i.push({from:a.from+c,insert:l+" "});let o=t.changes(i);return{changes:o,selection:t.selection.map(o,1)}}else if(e!=1&&r.some(i=>i.comment>=0)){let i=[];for(let{line:o,comment:a,token:l}of r)if(a>=0){let c=o.from+a,u=c+l.length;o.text[u-o.from]==" "&&u++,i.push({from:c,to:u})}return{changes:i}}return null}var AE=Ui.define(),gX=Ce.define(),Ul=class ja{constructor(t,n,r,s,i){this.changes=t,this.effects=n,this.mapped=r,this.startSelection=s,this.selectionsAfter=i}setSelAfter(t){return new ja(this.changes,this.effects,this.mapped,this.startSelection,t)}toJSON(){var t,n,r;return{changes:(t=this.changes)===null||t===void 0?void 0:t.toJSON(),mapped:(n=this.mapped)===null||n===void 0?void 0:n.toJSON(),startSelection:(r=this.startSelection)===null||r===void 0?void 0:r.toJSON(),selectionsAfter:this.selectionsAfter.map(s=>s.toJSON())}}static fromJSON(t){return new ja(t.changes&&ur.fromJSON(t.changes),[],t.mapped&&Do.fromJSON(t.mapped),t.startSelection&&se.fromJSON(t.startSelection),t.selectionsAfter.map(se.fromJSON))}static fromTransaction(t,n){let r=Pn;for(let s of t.startState.facet(gX)){let i=s(t);i.length&&(r=r.concat(i))}return!r.length&&t.changes.empty?null:new ja(t.changes.invert(t.startState.doc),r,void 0,n||t.startState.selection,Pn)}static selection(t){return new ja(void 0,Pn,void 0,void 0,t)}};function lg(e,t,n,r){let s=t+1>n+20?t-n-1:0,i=e.slice(s,t);return i.push(r),i}function CX(e,t){let n=[],r=!1;return e.iterChangedRanges((s,i)=>n.push(s,i)),t.iterChangedRanges((s,i,o,a)=>{for(let l=0;l<n.length;){let c=n[l++],u=n[l++];a>=c&&o<=u&&(r=!0)}}),r}function vX(e,t){return e.ranges.length==t.ranges.length&&e.ranges.filter((n,r)=>n.empty!=t.ranges[r].empty).length===0}function EO(e,t){return e.length?t.length?e.concat(t):e:t}var Pn=[],yX=200;function bX(e,t){if(e.length){let n=e[e.length-1],r=n.selectionsAfter.slice(Math.max(0,n.selectionsAfter.length-yX));return r.length&&r[r.length-1].eq(t)?e:(r.push(t),lg(e,e.length-1,1e9,n.setSelAfter(r)))}else return[Ul.selection([t])]}function SX(e){let t=e[e.length-1],n=e.slice();return n[e.length-1]=t.setSelAfter(t.selectionsAfter.slice(0,t.selectionsAfter.length-1)),n}function xB(e,t){if(!e.length)return e;let n=e.length,r=Pn;for(;n;){let s=EX(e[n-1],t,r);if(s.changes&&!s.changes.empty||s.effects.length){let i=e.slice(0,n);return i[n-1]=s,i}else t=s.mapped,n--,r=s.selectionsAfter}return r.length?[Ul.selection(r)]:Pn}function EX(e,t,n){let r=EO(e.selectionsAfter.length?e.selectionsAfter.map(a=>a.map(t)):Pn,n);if(!e.changes)return Ul.selection(r);let s=e.changes.map(t),i=t.mapDesc(e.changes,!0),o=e.mapped?e.mapped.composeDesc(i):i;return new Ul(s,Tt.mapEffects(e.effects,t),o,e.startSelection.map(i),r)}var xX=/^(input\.type|delete)($|\.)/,IE=class Ga{constructor(t,n,r=0,s=void 0){this.done=t,this.undone=n,this.prevTime=r,this.prevUserEvent=s}isolate(){return this.prevTime?new Ga(this.done,this.undone):this}addChanges(t,n,r,s,i){let o=this.done,a=o[o.length-1];return a&&a.changes&&!a.changes.empty&&t.changes&&(!r||xX.test(r))&&(!a.selectionsAfter.length&&n-this.prevTime<s.newGroupDelay&&s.joinToEvent(i,CX(a.changes,t.changes))||r=="input.type.compose")?o=lg(o,o.length-1,s.minDepth,new Ul(t.changes.compose(a.changes),EO(Tt.mapEffects(t.effects,a.changes),a.effects),a.mapped,a.startSelection,Pn)):o=lg(o,o.length,s.minDepth,t),new Ga(o,Pn,n,r)}addSelection(t,n,r,s){let i=this.done.length?this.done[this.done.length-1].selectionsAfter:Pn;return i.length>0&&n-this.prevTime<s&&r==this.prevUserEvent&&r&&/^select($|\.)/.test(r)&&vX(i[i.length-1],t)?this:new Ga(bX(this.done,t),this.undone,n,r)}addMapping(t){return new Ga(xB(this.done,t),xB(this.undone,t),this.prevTime,this.prevUserEvent)}pop(t,n,r){let s=t==0?this.done:this.undone;if(s.length==0)return null;let i=s[s.length-1],o=i.selectionsAfter[0]||(i.startSelection?i.startSelection.map(i.changes.invertedDesc,1):n.selection);if(r&&i.selectionsAfter.length)return n.update({selection:i.selectionsAfter[i.selectionsAfter.length-1],annotations:AE.of({side:t,rest:SX(s),selection:o}),userEvent:t==0?"select.undo":"select.redo",scrollIntoView:!0});if(i.changes){let a=s.length==1?Pn:s.slice(0,s.length-1);return i.mapped&&(a=xB(a,i.mapped)),n.update({changes:i.changes,selection:i.startSelection,effects:i.effects,annotations:AE.of({side:t,rest:a,selection:o}),filter:!1,userEvent:t==0?"undo":"redo",scrollIntoView:!0})}else return null}};IE.empty=new IE(Pn,Pn);function aa(e,t){return se.create(e.ranges.map(t),e.mainIndex)}function fr(e,t){return e.update({selection:t,scrollIntoView:!0,userEvent:"select"})}function Br({state:e,dispatch:t},n){let r=aa(e.selection,n);return r.eq(e.selection,!0)?!1:(t(fr(e,r)),!0)}function Uh(e,t){return se.cursor(t?e.to:e.from)}function xO(e,t){return Br(e,n=>n.empty?e.moveByChar(n,t):Uh(n,t))}function qt(e){return e.textDirectionAt(e.state.selection.main.head)==nt.LTR}var wO=e=>xO(e,!qt(e)),DO=e=>xO(e,qt(e));function TO(e,t){return Br(e,n=>n.empty?e.moveByGroup(n,t):Uh(n,t))}var wX=e=>TO(e,!qt(e)),DX=e=>TO(e,qt(e)),ale=typeof Intl<"u"&&Intl.Segmenter?new Intl.Segmenter(void 0,{granularity:"word"}):null;function TX(e,t,n){if(t.type.prop(n))return!0;let r=t.to-t.from;return r&&(r>2||/[^\s,.;:]/.test(e.sliceDoc(t.from,t.to)))||t.firstChild}function zh(e,t,n){let r=Fr(e).resolveInner(t.head),s=n?ke.closedBy:ke.openedBy;for(let l=t.head;;){let c=n?r.childAfter(l):r.childBefore(l);if(!c)break;TX(e,c,s)?r=c:l=n?c.to:c.from}let i=r.type.prop(s),o,a;return i&&(o=n?Mr(e,r.from,1):Mr(e,r.to,-1))&&o.matched?a=n?o.end.to:o.end.from:a=n?r.to:r.from,se.cursor(a,n?-1:1)}var AX=e=>Br(e,t=>zh(e.state,t,!qt(e))),IX=e=>Br(e,t=>zh(e.state,t,qt(e)));function AO(e,t){return Br(e,n=>{if(!n.empty)return Uh(n,t);let r=e.moveVertically(n,t);return r.head!=n.head?r:e.moveToLineBoundary(n,t)})}var IO=e=>AO(e,!1),kO=e=>AO(e,!0);function RO(e){let t=e.scrollDOM.clientHeight<e.scrollDOM.scrollHeight-2,n=0,r=0,s;if(t){for(let i of e.state.facet(xe.scrollMargins)){let o=i(e);o?.top&&(n=Math.max(o?.top,n)),o?.bottom&&(r=Math.max(o?.bottom,r))}s=e.scrollDOM.clientHeight-n-r}else s=(e.dom.ownerDocument.defaultView||window).innerHeight;return{marginTop:n,marginBottom:r,selfScroll:t,height:Math.max(e.defaultLineHeight,s-5)}}function OO(e,t){let n=RO(e),{state:r}=e,s=aa(r.selection,o=>o.empty?e.moveVertically(o,t,n.height):Uh(o,t));if(s.eq(r.selection))return!1;let i;if(n.selfScroll){let o=e.coordsAtPos(r.selection.main.head),a=e.scrollDOM.getBoundingClientRect(),l=a.top+n.marginTop,c=a.bottom-n.marginBottom;o&&o.top>l&&o.bottom<c&&(i=xe.scrollIntoView(s.main.head,{y:"start",yMargin:o.top-l}))}return e.dispatch(fr(r,s),{effects:i}),!0}var kE=e=>OO(e,!1),cg=e=>OO(e,!0);function ei(e,t,n){let r=e.lineBlockAt(t.head),s=e.moveToLineBoundary(t,n);if(s.head==t.head&&s.head!=(n?r.to:r.from)&&(s=e.moveToLineBoundary(t,n,!1)),!n&&s.head==r.from&&r.length){let i=/^\s*/.exec(e.state.sliceDoc(r.from,Math.min(r.from+100,r.to)))[0].length;i&&t.head!=r.from+i&&(s=se.cursor(r.from+i))}return s}var kX=e=>Br(e,t=>ei(e,t,!0)),RX=e=>Br(e,t=>ei(e,t,!1)),OX=e=>Br(e,t=>ei(e,t,!qt(e))),MX=e=>Br(e,t=>ei(e,t,qt(e))),NX=e=>Br(e,t=>e.moveToLineBoundary(t,!1,!1)),PX=e=>Br(e,t=>e.moveToLineBoundary(t,!0,!1));function LX(e,t,n){let r=!1,s=aa(e.selection,i=>{let o=Mr(e,i.head,-1)||Mr(e,i.head,1)||i.head>0&&Mr(e,i.head-1,1)||i.head<e.doc.length&&Mr(e,i.head+1,-1);if(!o||!o.end)return i;r=!0;let a=o.start.from==i.head?o.end.to:o.end.from;return n?se.range(i.anchor,a):se.cursor(a)});return r?(t(fr(e,s)),!0):!1}var _X=({state:e,dispatch:t})=>LX(e,t,!1);function Vn(e,t,n){let r=aa(e.state.selection,s=>{s.undirectional&&s.head>=s.anchor!=t&&(s=se.range(s.head,s.anchor));let i=n(s);return se.range(s.anchor,i.head,i.goalColumn,i.bidiLevel||void 0,i.assoc)});return r.eq(e.state.selection)?!1:(e.dispatch(fr(e.state,r)),!0)}function MO(e,t){return Vn(e,t,n=>e.moveByChar(n,t))}var NO=e=>MO(e,!qt(e)),PO=e=>MO(e,qt(e));function LO(e,t){return Vn(e,t,n=>e.moveByGroup(n,t))}var FX=e=>LO(e,!qt(e)),HX=e=>LO(e,qt(e)),jX=e=>{let t=!qt(e);return Vn(e,t,n=>zh(e.state,n,t))},GX=e=>{let t=qt(e);return Vn(e,t,n=>zh(e.state,n,t))};function _O(e,t){return Vn(e,t,n=>e.moveVertically(n,t))}var FO=e=>_O(e,!1),HO=e=>_O(e,!0);function jO(e,t){return Vn(e,t,n=>e.moveVertically(n,t,RO(e).height))}var RE=e=>jO(e,!1),OE=e=>jO(e,!0),VX=e=>Vn(e,!0,t=>ei(e,t,!0)),UX=e=>Vn(e,!1,t=>ei(e,t,!1)),zX=e=>{let t=!qt(e);return Vn(e,t,n=>ei(e,n,t))},$X=e=>{let t=qt(e);return Vn(e,t,n=>ei(e,n,t))},WX=e=>Vn(e,!1,t=>se.cursor(e.lineBlockAt(t.head).from)),qX=e=>Vn(e,!0,t=>se.cursor(e.lineBlockAt(t.head).to)),ME=({state:e,dispatch:t})=>(t(fr(e,{anchor:0})),!0),NE=({state:e,dispatch:t})=>(t(fr(e,{anchor:e.doc.length})),!0),PE=({state:e,dispatch:t})=>(t(fr(e,{anchor:e.selection.main.anchor,head:0})),!0),LE=({state:e,dispatch:t})=>(t(fr(e,{anchor:e.selection.main.anchor,head:e.doc.length})),!0),KX=({state:e,dispatch:t})=>(t(e.update({selection:{anchor:0,head:e.doc.length},userEvent:"select"})),!0),JX=({state:e,dispatch:t})=>{let n=$h(e).map(({from:r,to:s})=>se.undirectionalRange(r,Math.min(s+1,e.doc.length)));return t(e.update({selection:se.create(n),userEvent:"select"})),!0},QX=({state:e,dispatch:t})=>{let n=aa(e.selection,r=>{let s=Fr(e),i=s.resolveStack(r.from,1);if(r.empty){let o=s.resolveStack(r.from,-1);o.node.from>=i.node.from&&o.node.to<=i.node.to&&(i=o)}for(let o=i;o;o=o.next){let{node:a}=o;if((a.from<r.from&&a.to>=r.to||a.to>r.to&&a.from<=r.from)&&o.next)return se.undirectionalRange(a.from,a.to)}return r});return n.eq(e.selection)?!1:(t(fr(e,n)),!0)};function GO(e,t){let{state:n}=e,r=n.selection,s=n.selection.ranges.slice();for(let i of n.selection.ranges){let o=n.doc.lineAt(i.head);if(t?o.to<e.state.doc.length:o.from>0)for(let a=i;;){let l=e.moveVertically(a,t);if(l.head<o.from||l.head>o.to){s.some(c=>c.head==l.head)||s.push(l);break}else{if(l.head==a.head)break;a=l}}}return s.length==r.ranges.length?!1:(e.dispatch(fr(n,se.create(s,s.length-1))),!0)}var YX=e=>GO(e,!1),XX=e=>GO(e,!0),ZX=({state:e,dispatch:t})=>{let n=e.selection,r=null;return n.ranges.length>1?r=se.create([n.main]):n.main.empty||(r=se.create([se.cursor(n.main.head)])),r?(t(fr(e,r)),!0):!1};function vc(e,t){if(e.state.readOnly)return!1;let n="delete.selection",{state:r}=e,s=r.changeByRange(i=>{let{from:o,to:a}=i;if(o==a){let l=t(i);l<o?(n="delete.backward",l=Bu(e,l,!1)):l>o&&(n="delete.forward",l=Bu(e,l,!0)),o=Math.min(o,l),a=Math.max(a,l)}else o=Bu(e,o,!1),a=Bu(e,a,!0);return o==a?{range:i}:{changes:{from:o,to:a},range:se.cursor(o,o<i.head?-1:1)}});return s.changes.empty?!1:(e.dispatch(r.update(s,{scrollIntoView:!0,userEvent:n,effects:n=="delete.selection"?xe.announce.of(r.phrase("Selection deleted")):void 0})),!0)}function Bu(e,t,n){if(e instanceof xe)for(let r of e.state.facet(xe.atomicRanges).map(s=>s(e)))r.between(t,t,(s,i)=>{s<t&&i>t&&(t=n?i:s)});return t}var VO=(e,t,n)=>vc(e,r=>{let s=r.from,{state:i}=e,o=i.doc.lineAt(s),a,l;if(n&&!t&&s>o.from&&s<o.from+200&&!/[^ \t]/.test(a=o.text.slice(0,s-o.from))){if(a[a.length-1]==" ")return s-1;let c=Ph(a,i.tabSize)%Gd(i)||Gd(i);for(let u=0;u<c&&a[a.length-1-u]==" ";u++)s--;l=s}else l=Wt(o.text,s-o.from,t,t)+o.from,l==s&&o.number!=(t?i.doc.lines:1)?l+=t?1:-1:!t&&/[\ufe00-\ufe0f]/.test(o.text.slice(l-o.from,s-o.from))&&(l=Wt(o.text,l-o.from,!1,!1)+o.from);return l}),ug=e=>VO(e,!1,!0),UO=e=>VO(e,!0,!1),zO=(e,t)=>vc(e,n=>{let r=n.head,{state:s}=e,i=s.doc.lineAt(r),o=s.charCategorizer(r);for(let a=null;;){if(r==(t?i.to:i.from)){r==n.head&&i.number!=(t?s.doc.lines:1)&&(r+=t?1:-1);break}let l=Wt(i.text,r-i.from,t)+i.from,c=i.text.slice(Math.min(r,l)-i.from,Math.max(r,l)-i.from),u=o(c);if(a!=null&&u!=a)break;(c!=" "||r!=n.head)&&(a=u),r=l}return r}),$O=e=>zO(e,!1),eZ=e=>zO(e,!0),tZ=e=>vc(e,t=>{let n=e.lineBlockAt(t.head).to;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)}),nZ=e=>vc(e,t=>{let n=e.moveToLineBoundary(t,!1).head;return t.head>n?n:Math.max(0,t.head-1)}),rZ=e=>vc(e,t=>{let n=e.moveToLineBoundary(t,!0).head;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)}),sZ=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange(r=>({changes:{from:r.from,to:r.to,insert:Fe.of(["",""])},range:se.cursor(r.from)}));return t(e.update(n,{scrollIntoView:!0,userEvent:"input"})),!0},iZ=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange(r=>{if(!r.empty||r.from==0||r.from==e.doc.length)return{range:r};let s=r.from,i=e.doc.lineAt(s),o=s==i.from?s-1:Wt(i.text,s-i.from,!1)+i.from,a=s==i.to?s+1:Wt(i.text,s-i.from,!0)+i.from;return{changes:{from:o,to:a,insert:e.doc.slice(s,a).append(e.doc.slice(o,s))},range:se.cursor(a)}});return n.changes.empty?!1:(t(e.update(n,{scrollIntoView:!0,userEvent:"move.character"})),!0)};function $h(e){let t=[],n=-1;for(let r of e.selection.ranges){let s=e.doc.lineAt(r.from),i=e.doc.lineAt(r.to);if(!r.empty&&r.to==i.from&&(i=e.doc.lineAt(r.to-1)),n>=s.number){let o=t[t.length-1];o.to=i.to,o.ranges.push(r)}else t.push({from:s.from,to:i.to,ranges:[r]});n=i.number+1}return t}function WO(e,t,n){if(e.readOnly)return!1;let r=[],s=[];for(let i of $h(e)){if(n?i.to==e.doc.length:i.from==0)continue;let o=e.doc.lineAt(n?i.to+1:i.from-1),a=o.length+1;if(n){r.push({from:i.to,to:o.to},{from:i.from,insert:o.text+e.lineBreak});for(let l of i.ranges)s.push(se.range(Math.min(e.doc.length,l.anchor+a),Math.min(e.doc.length,l.head+a)))}else{r.push({from:o.from,to:i.from},{from:i.to,insert:e.lineBreak+o.text});for(let l of i.ranges)s.push(se.range(l.anchor-a,l.head-a))}}return r.length?(t(e.update({changes:r,scrollIntoView:!0,selection:se.create(s,e.selection.mainIndex),userEvent:"move.line"})),!0):!1}var oZ=({state:e,dispatch:t})=>WO(e,t,!1),aZ=({state:e,dispatch:t})=>WO(e,t,!0);function qO(e,t,n){if(e.readOnly)return!1;let r=[];for(let i of $h(e))n?r.push({from:i.from,insert:e.doc.slice(i.from,i.to)+e.lineBreak}):r.push({from:i.to,insert:e.lineBreak+e.doc.slice(i.from,i.to)});let s=e.changes(r);return t(e.update({changes:s,selection:e.selection.map(s,n?1:-1),scrollIntoView:!0,userEvent:"input.copyline"})),!0}var lZ=({state:e,dispatch:t})=>qO(e,t,!1),cZ=({state:e,dispatch:t})=>qO(e,t,!0),uZ=e=>{if(e.state.readOnly)return!1;let{state:t}=e,n=t.changes($h(t).map(({from:s,to:i})=>(s>0?s--:i<t.doc.length&&i++,{from:s,to:i}))),r=aa(t.selection,s=>{let i;if(e.lineWrapping){let o=e.lineBlockAt(s.head),a=e.coordsAtPos(s.head,s.assoc||1);a&&(i=o.bottom+e.documentTop-a.bottom+e.defaultLineHeight/2)}return e.moveVertically(s,!0,i)}).map(n);return e.dispatch({changes:n,selection:r,scrollIntoView:!0,userEvent:"delete.line"}),!0};function dZ(e,t){if(/\(\)|\[\]|\{\}/.test(e.sliceDoc(t-1,t+1)))return{from:t,to:t};let n=Fr(e).resolveInner(t),r=n.childBefore(t),s=n.childAfter(t),i;return r&&s&&r.to<=t&&s.from>=t&&(i=r.type.prop(ke.closedBy))&&i.indexOf(s.name)>-1&&e.doc.lineAt(r.to).from==e.doc.lineAt(s.from).from&&!/\S/.test(e.sliceDoc(r.to,s.from))?{from:r.to,to:s.from}:null}var _E=KO(!1),hZ=KO(!0);function KO(e){return({state:t,dispatch:n})=>{if(t.readOnly)return!1;let r=t.changeByRange(s=>{let{from:i,to:o}=s,a=t.doc.lineAt(i),l=!e&&i==o&&dZ(t,i);e&&(i=o=(o<=a.to?a:t.doc.lineAt(o)).to);let c=new Vh(t,{simulateBreak:i,simulateDoubleBreak:!!l}),u=yv(c,i);for(u==null&&(u=Ph(/^\s*/.exec(t.doc.lineAt(i).text)[0],t.tabSize));o<a.to&&/\s/.test(a.text[o-a.from]);)o++;l?{from:i,to:o}=l:i>a.from&&i<a.from+100&&!/\S/.test(a.text.slice(0,i))&&(i=a.from);let d=["",Vl(t,u)];return l&&d.push(Vl(t,c.lineIndent(a.from,-1))),{changes:{from:i,to:o,insert:Fe.of(d)},range:se.cursor(i+1+d[1].length)}});return n(t.update(r,{scrollIntoView:!0,userEvent:"input"})),!0}}function xv(e,t){let n=-1;return e.changeByRange(r=>{let s=[];for(let o=r.from;o<=r.to;){let a=e.doc.lineAt(o);a.number>n&&(r.empty||r.to>a.from)&&(t(a,s,r),n=a.number),o=a.to+1}let i=e.changes(s);return{changes:s,range:se.range(i.mapPos(r.anchor,1),i.mapPos(r.head,1))}})}var fZ=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=Object.create(null),r=new Vh(e,{overrideIndentation:i=>{let o=n[i];return o??-1}}),s=xv(e,(i,o,a)=>{let l=yv(r,i.from);if(l==null)return;/\S/.test(i.text)||(l=0);let c=/^\s*/.exec(i.text)[0],u=Vl(e,l);(c!=u||a.from<i.from+c.length)&&(n[i.from]=l,o.push({from:i.from,to:i.from+c.length,insert:u}))});return s.changes.empty||t(e.update(s,{userEvent:"indent"})),!0},JO=({state:e,dispatch:t})=>e.readOnly?!1:(t(e.update(xv(e,(n,r)=>{r.push({from:n.from,insert:e.facet(vv)})}),{userEvent:"input.indent"})),!0),QO=({state:e,dispatch:t})=>e.readOnly?!1:(t(e.update(xv(e,(n,r)=>{let s=/^\s*/.exec(n.text)[0];if(!s)return;let i=Ph(s,e.tabSize),o=0,a=Vl(e,Math.max(0,i-Gd(e)));for(;o<s.length&&o<a.length&&s.charCodeAt(o)==a.charCodeAt(o);)o++;r.push({from:n.from+o,to:n.from+s.length,insert:a.slice(o)})}),{userEvent:"delete.dedent"})),!0),BZ=e=>(e.setTabFocusMode(),!0),pZ=[{key:"Ctrl-b",run:wO,shift:NO,preventDefault:!0},{key:"Ctrl-f",run:DO,shift:PO},{key:"Ctrl-p",run:IO,shift:FO},{key:"Ctrl-n",run:kO,shift:HO},{key:"Ctrl-a",run:NX,shift:WX},{key:"Ctrl-e",run:PX,shift:qX},{key:"Ctrl-d",run:UO},{key:"Ctrl-h",run:ug},{key:"Ctrl-k",run:tZ},{key:"Ctrl-Alt-h",run:$O},{key:"Ctrl-o",run:sZ},{key:"Ctrl-t",run:iZ},{key:"Ctrl-v",run:cg}],mZ=[{key:"ArrowLeft",run:wO,shift:NO,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:wX,shift:FX,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:OX,shift:zX,preventDefault:!0},{key:"ArrowRight",run:DO,shift:PO,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:DX,shift:HX,preventDefault:!0},{mac:"Cmd-ArrowRight",run:MX,shift:$X,preventDefault:!0},{key:"ArrowUp",run:IO,shift:FO,preventDefault:!0},{mac:"Cmd-ArrowUp",run:ME,shift:PE},{mac:"Ctrl-ArrowUp",run:kE,shift:RE},{key:"ArrowDown",run:kO,shift:HO,preventDefault:!0},{mac:"Cmd-ArrowDown",run:NE,shift:LE},{mac:"Ctrl-ArrowDown",run:cg,shift:OE},{key:"PageUp",run:kE,shift:RE},{key:"PageDown",run:cg,shift:OE},{key:"Home",run:RX,shift:UX,preventDefault:!0},{key:"Mod-Home",run:ME,shift:PE},{key:"End",run:kX,shift:VX,preventDefault:!0},{key:"Mod-End",run:NE,shift:LE},{key:"Enter",run:_E,shift:_E},{key:"Mod-a",run:KX},{key:"Backspace",run:ug,shift:ug,preventDefault:!0},{key:"Delete",run:UO,preventDefault:!0},{key:"Mod-Backspace",mac:"Alt-Backspace",run:$O,preventDefault:!0},{key:"Mod-Delete",mac:"Alt-Delete",run:eZ,preventDefault:!0},{mac:"Mod-Backspace",run:nZ,preventDefault:!0},{mac:"Mod-Delete",run:rZ,preventDefault:!0}].concat(pZ.map(e=>({mac:e.key,run:e.run,shift:e.shift}))),gZ=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:AX,shift:jX},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:IX,shift:GX},{key:"Alt-ArrowUp",run:oZ},{key:"Shift-Alt-ArrowUp",run:lZ},{key:"Alt-ArrowDown",run:aZ},{key:"Shift-Alt-ArrowDown",run:cZ},{key:"Mod-Alt-ArrowUp",run:YX},{key:"Mod-Alt-ArrowDown",run:XX},{key:"Escape",run:ZX},{key:"Mod-Enter",run:hZ},{key:"Alt-l",mac:"Ctrl-l",run:JX},{key:"Mod-i",run:QX,preventDefault:!0},{key:"Mod-[",run:QO},{key:"Mod-]",run:JO},{key:"Mod-Alt-\\",run:fZ},{key:"Shift-Mod-k",run:uZ},{key:"Shift-Mod-\\",run:_X},{key:"Mod-/",run:uX},{key:"Alt-A",mac:"Ctrl-A",run:hX},{key:"Ctrl-m",mac:"Shift-Alt-m",run:BZ}].concat(mZ),CZ={key:"Tab",run:JO,shift:QO},vZ=xe.theme({"&":{height:"100%",width:"100%",backgroundColor:"transparent",color:"var(--foreground)",fontSize:"12px"},"&.cm-focused":{outline:"none"},".cm-scroller":{height:"100%",overflow:"auto",fontFamily:"var(--font-code)",lineHeight:"20px"},".cm-content":{minHeight:"100%",padding:"12px 0",caretColor:"var(--foreground)"},".cm-line":{padding:"0 12px"},".cm-gutters":{backgroundColor:"color-mix(in oklch, var(--muted) 50%, transparent)",color:"var(--muted-foreground)",borderRight:"1px solid color-mix(in oklch, var(--border) 50%, transparent)",fontFamily:"var(--font-code)",fontSize:"12px",lineHeight:"20px",paddingTop:"12px"},".cm-lineNumbers .cm-gutterElement":{minWidth:"2.5rem",padding:"0 8px 0 0"},".cm-activeLine":{backgroundColor:"color-mix(in oklch, var(--foreground) 3%, transparent)"},".cm-activeLineGutter":{backgroundColor:"color-mix(in oklch, var(--foreground) 3%, transparent)",color:"var(--foreground)",fontWeight:"500"},"&.cm-focused .cm-selectionBackground, .cm-selectionBackground, ::selection":{backgroundColor:"color-mix(in oklch, var(--primary) 20%, transparent)"},"&.cm-focused .cm-cursor":{borderLeftColor:"var(--foreground)"},".cm-matchingBracket":{backgroundColor:"color-mix(in oklch, var(--primary) 14%, transparent)",outline:"1px solid color-mix(in oklch, var(--primary) 35%, transparent)"}}),yZ=bv.define([{tag:re.propertyName,color:"var(--json-key)"},{tag:re.string,color:"var(--json-string)"},{tag:re.number,color:"var(--json-number)"},{tag:re.bool,color:"var(--json-boolean)"},{tag:re.null,color:"var(--json-null)"},{tag:re.punctuation,color:"var(--json-punctuation)"},{tag:re.invalid,color:"var(--destructive)"}]);function FE(e){const t=e.state.selection.main.head,n=e.state.doc.lineAt(t);return{line:n.number,column:t-n.from+1}}function HE(e,t){return typeof e=="number"?`${e}px`:e??t}function bZ({content:e,onChange:t,onCursorChange:n,onUndo:r,onRedo:s,onEscape:i,isValid:o=!0,height:a,maxHeight:l,showLineNumbers:c=!0,wrapLongLines:u=!0,className:d}){const h=(0,p.useRef)(null),f=(0,p.useRef)(null),B=(0,p.useRef)(e),g=(0,p.useRef)({onChange:t,onCursorChange:n,onUndo:r,onRedo:s,onEscape:i});B.current=e,g.current={onChange:t,onCursorChange:n,onUndo:r,onRedo:s,onEscape:i};const C=(0,p.useMemo)(()=>{const v=[vZ,q7(yZ),cX(),a7(),z7(),tX(),h7(),xe.updateListener.of(y=>{y.docChanged&&g.current.onChange?.(y.state.doc.toString()),(y.docChanged||y.selectionSet||y.focusChanged)&&g.current.onCursorChange?.(FE(y.view))}),aO.of([{key:"Mod-z",run:()=>(g.current.onUndo?.(),!0)},{key:"Mod-y",run:()=>(g.current.onRedo?.(),!0)},{key:"Shift-Mod-z",run:()=>(g.current.onRedo?.(),!0)},{key:"Escape",run:()=>(g.current.onEscape?.(),!0)},CZ,...gZ])];return c&&v.push(E7(),D7()),u&&v.push(xe.lineWrapping),v},[c,u]);return(0,p.useEffect)(()=>{if(!h.current)return;const v=new xe({state:bt.create({doc:B.current,extensions:C}),parent:h.current});return f.current=v,g.current.onCursorChange?.(FE(v)),()=>{v.destroy(),f.current=null}},[C]),(0,p.useEffect)(()=>{const v=f.current;if(!v||v.state.doc.toString()===e)return;const y=Math.min(v.state.selection.main.head,e.length);v.dispatch({changes:{from:0,to:v.state.doc.length,insert:e},selection:{anchor:y}})},[e]),(0,m.jsx)("div",{className:he("h-full w-full overflow-hidden bg-muted/30",!o&&"border-destructive",d),style:{height:HE(a,"100%"),maxHeight:HE(l,"none")},children:(0,m.jsx)("div",{ref:h,className:"h-full w-full"})})}function SZ({options:e,value:t,onChange:n,className:r,size:s="sm",disabled:i=!1}){const o=(0,p.useRef)(null),[a,l]=(0,p.useState)({});return(0,p.useEffect)(()=>{const c=o.current;if(!c)return;const u=e.findIndex(h=>h.value===t),d=c.querySelectorAll("button")[u];d&&l({width:d.offsetWidth,transform:`translateX(${d.offsetLeft}px)`})},[t,e,s]),(0,m.jsxs)("div",{ref:o,className:he("relative inline-flex items-center rounded-md bg-muted/50",s==="default"?"p-1":"p-0.5",i&&"opacity-50",r),children:[(0,m.jsx)("div",{className:he("absolute left-0 rounded-md bg-background shadow-sm","transition-all duration-200 ease-out",s==="default"?"top-1 h-[calc(100%-8px)]":"top-0.5 h-[calc(100%-4px)]"),style:a}),e.map(c=>(0,m.jsxs)("button",{type:"button",disabled:i||c.disabled,title:c.title,"aria-pressed":t===c.value,onClick:()=>n(c.value),className:he("relative z-10 flex items-center rounded-md font-medium transition-colors duration-200",s==="default"?"gap-2 px-3.5 py-1.5 text-sm":"gap-1.5 px-2.5 py-1 text-xs",t===c.value?"text-foreground":"text-muted-foreground hover:text-foreground/80",(i||c.disabled)&&"cursor-not-allowed",c.disabled&&!i&&"opacity-50"),children:[c.icon,c.label]},c.value))]})}var EZ=[{value:"view",label:"View",icon:(0,m.jsx)(EH,{className:"h-3 w-3"})},{value:"edit",label:"Edit",icon:(0,m.jsx)(OH,{className:"h-3 w-3"})}];function xZ({mode:e,onModeChange:t,showModeToggle:n=!0,readOnly:r=!1,onFormat:s,onCopy:i,onUndo:o,onRedo:a,canUndo:l=!1,canRedo:c=!1,isMaximized:u=!1,onToggleMaximize:d,allowMaximize:h=!1,isValid:f=!0,className:B,leftContent:g,rightContent:C,error:v}){const[y,S]=(0,p.useState)(!1),E=(0,p.useRef)(null);(0,p.useEffect)(()=>()=>{E.current&&clearTimeout(E.current)},[]);const D=async()=>{let A;try{A=await i?.()}catch{return}A!==!1&&(E.current&&clearTimeout(E.current),S(!0),E.current=setTimeout(()=>S(!1),2e3))};return(0,m.jsxs)("div",{className:he("flex items-center justify-between border-b border-border/50 px-3 py-1.5 bg-muted/50",B),children:[(0,m.jsxs)("div",{className:"flex shrink-0 items-center gap-2",children:[g,n&&!r&&t&&(0,m.jsx)(SZ,{options:EZ,value:e,onChange:t})]}),v?(0,m.jsxs)(xs,{children:[(0,m.jsx)(ws,{asChild:!0,children:(0,m.jsxs)("div",{className:"mx-3 flex min-w-0 flex-1 cursor-default items-center gap-1.5 text-xs text-destructive",children:[(0,m.jsx)(dh,{className:"h-3 w-3 shrink-0"}),(0,m.jsx)("span",{className:"truncate",children:v})]})}),(0,m.jsx)(Ds,{side:"bottom",className:"max-w-[min(40rem,calc(100vw-2rem))] break-words",children:(0,m.jsx)("p",{children:v})})]}):null,(0,m.jsxs)("div",{className:"flex shrink-0 items-center gap-1",children:[e==="edit"&&(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)(xs,{children:[(0,m.jsx)(ws,{asChild:!0,children:(0,m.jsx)(kn,{size:"sm",variant:"ghost",onClick:o,disabled:!l,className:"h-7 w-7 p-0 transition-all duration-200 hover:scale-105",children:(0,m.jsx)(FH,{className:"h-3.5 w-3.5"})})}),(0,m.jsx)(Ds,{side:"bottom",children:(0,m.jsx)("p",{children:"Undo (Ctrl+Z)"})})]}),(0,m.jsxs)(xs,{children:[(0,m.jsx)(ws,{asChild:!0,children:(0,m.jsx)(kn,{size:"sm",variant:"ghost",onClick:a,disabled:!c,className:"h-7 w-7 p-0 transition-all duration-200 hover:scale-105",children:(0,m.jsx)(PH,{className:"h-3.5 w-3.5"})})}),(0,m.jsx)(Ds,{side:"bottom",children:(0,m.jsx)("p",{children:"Redo (Ctrl+Shift+Z)"})})]}),(0,m.jsx)("div",{className:"w-px h-4 bg-border mx-1"}),(0,m.jsxs)(xs,{children:[(0,m.jsx)(ws,{asChild:!0,children:(0,m.jsx)(kn,{size:"sm",variant:"ghost",onClick:s,disabled:!f,className:"h-7 w-7 p-0 transition-all duration-200 hover:scale-105",children:(0,m.jsx)(_H,{className:"h-3.5 w-3.5"})})}),(0,m.jsx)(Ds,{side:"bottom",children:(0,m.jsx)("p",{children:"Format JSON"})})]})]}),(0,m.jsxs)(xs,{children:[(0,m.jsx)(ws,{asChild:!0,children:(0,m.jsx)(kn,{size:"sm",variant:"ghost",onClick:D,className:he("h-7 w-7 p-0 transition-all duration-200 hover:scale-105",y&&"bg-success/10"),children:y?(0,m.jsx)(Vs,{className:"h-3.5 w-3.5 text-success"}):(0,m.jsx)(_s,{className:"h-3.5 w-3.5"})})}),(0,m.jsx)(Ds,{side:"bottom",children:(0,m.jsx)("p",{children:y?"Copied!":"Copy to clipboard"})})]}),h&&(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)("div",{className:"w-px h-4 bg-border mx-1"}),(0,m.jsxs)(xs,{children:[(0,m.jsx)(ws,{asChild:!0,children:(0,m.jsx)(kn,{size:"sm",variant:"ghost",onClick:d,className:"h-7 w-7 p-0 transition-all duration-200 hover:scale-105",children:u?(0,m.jsx)(IH,{className:"h-3.5 w-3.5"}):(0,m.jsx)(TH,{className:"h-3.5 w-3.5"})})}),(0,m.jsx)(Ds,{side:"bottom",children:(0,m.jsx)("p",{children:u?"Exit fullscreen":"Fullscreen"})})]})]}),C&&(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)("div",{className:"w-px h-4 bg-border mx-1"}),C]})]})]})}function wZ({cursorPosition:e,characterCount:t,validationError:n,className:r}){return(0,m.jsxs)("div",{className:he("flex items-center justify-between gap-3 px-3 py-1.5 border-t border-border/50","bg-gradient-to-r from-muted/40 via-muted/30 to-muted/40","text-xs text-muted-foreground tabular-nums transition-colors duration-300",r),style:{fontFamily:"var(--font-code)"},children:[(0,m.jsxs)("div",{className:"flex items-center gap-3",children:[(0,m.jsxs)("span",{className:"transition-colors duration-200",children:["Ln ",e.line,", Col ",e.column]}),(0,m.jsxs)("span",{className:"transition-colors duration-200",children:[t.toLocaleString()," chars"]})]}),n?(0,m.jsxs)(xs,{children:[(0,m.jsx)(ws,{asChild:!0,children:(0,m.jsxs)("div",{className:"flex min-w-0 cursor-default items-center gap-1.5 text-destructive",children:[(0,m.jsx)(dh,{className:"h-3 w-3 shrink-0"}),(0,m.jsx)("span",{className:"truncate",children:n})]})}),(0,m.jsx)(Ds,{side:"top",className:"max-w-[min(40rem,calc(100vw-2rem))] break-words",children:(0,m.jsx)("p",{children:n})})]}):null]})}function DZ(e){if(e===void 0)return"null";try{return JSON.stringify(e,null,2)??"null"}catch{return"null"}}function dg(){return(0,m.jsxs)("div",{className:"flex items-center justify-center p-4 text-sm text-muted-foreground",children:[(0,m.jsx)(dh,{className:"h-4 w-4 mr-2 text-destructive"}),"Failed to render JSON content"]})}function TZ(e){return e.viewOnly&&e.rawContent===void 0?(0,m.jsx)(AZ,{...e}):(0,m.jsx)(IZ,{...e})}function AZ({value:e,expandJsonStrings:t=!1,className:n,height:r,maxHeight:s,collapsible:i=!1,defaultExpandDepth:o,collapsedPaths:a,onCollapseChange:l,showLineNumbers:c=!0,collapseStringsAfterLength:u,wrapLongLinesInView:d=!0}){const h=(0,p.useMemo)(()=>t?Di(e):e,[t,e]);return(0,m.jsx)(Dd,{fallback:(0,m.jsx)(dg,{}),children:(0,m.jsx)(sm,{value:h,className:n,height:r??"100%",maxHeight:s,collapsible:i,defaultExpandDepth:o,collapsedPaths:a,onCollapseChange:l,showLineNumbers:c,collapseStringsAfterLength:u,wrapLongLinesInView:d})})}function IZ({value:e,onChange:t,rawContent:n,onRawChange:r,mode:s,onModeChange:i,readOnly:o=!1,showModeToggle:a=!0,showToolbar:l=!0,allowMaximize:c=!1,height:u,maxHeight:d,className:h,onValidationError:f,collapsible:B=!1,defaultExpandDepth:g,collapsedPaths:C,onCollapseChange:v,collapseStringsAfterLength:y,viewOnly:S=!1,expandJsonStrings:E=!1,autoFormatOnEdit:D=!0,wrapLongLinesInEdit:A=!1,editSurface:x="codemirror",wrapLongLinesInView:O=!0,showLineNumbers:R=!0,toolbarLeftContent:P,toolbarRightContent:_,error:N,showValidationErrorInStatusBar:W=!0}){const q=n!==void 0,[F,z]=(0,p.useState)("view"),J=o?"view":s??F,[Z,Q]=(0,p.useState)(!1),G=TJ({initialValue:q?void 0:e,initialContent:q?n:void 0,onChange:t,onRawChange:q?r:void 0,onValidationError:f,expandJsonStrings:E}),be=q?n??"":G.sourceContent,ve=G.content!==be,X=(0,p.useRef)(J),Y=(0,p.useRef)(!1),ie=(0,p.useMemo)(()=>q?G.getParsedValue():E?Di(e):e,[G.content,E,q,e]);(0,p.useEffect)(()=>{const Ee=X.current,st=!Y.current;Y.current=!0,X.current=J,!(S||o||!D)&&(!(J==="edit"&&(st||Ee!=="edit"))||!G.isValid||G.format())},[J,G.format,G.isValid,D,o,S]);const ne=(0,p.useCallback)(Ee=>{if(!o){if(J==="edit"&&Ee==="view"&&ve&&!G.isValid){if(!window.confirm("The JSON is invalid. Switching to view mode will lose your changes. Continue?"))return;G.reset()}z(Ee),i?.(Ee)}},[J,ve,G,i,o]),ee=(0,p.useCallback)(async()=>{let Ee;return J==="edit"?Ee=G.content:q?Ee=n??"":Ee=DZ(e),ra(Ee)},[J,G.content,e,q,n]),Be=(0,p.useCallback)(()=>{ve&&!window.confirm("You have unsaved changes. Discard them?")||(G.reset(),z("view"),i?.("view"))},[ve,G,i]),de=(0,p.useCallback)(()=>{Q(Ee=>!Ee)},[]);if(S)return(0,m.jsx)(Dd,{fallback:(0,m.jsx)(dg,{}),children:(0,m.jsx)(sm,{value:ie,className:h,height:u??"100%",maxHeight:d,collapsible:B,defaultExpandDepth:g,collapsedPaths:C,onCollapseChange:v,showLineNumbers:R,collapseStringsAfterLength:y,wrapLongLinesInView:O})});const Re=Z?{position:"fixed",top:0,left:0,right:0,bottom:0,zIndex:50}:{height:u??"100%",maxHeight:d??"none"};return(0,m.jsx)(Dd,{fallback:(0,m.jsx)(dg,{}),children:(0,m.jsxs)("div",{className:he("flex flex-col rounded-lg bg-background overflow-hidden",Z&&"rounded-none",h),style:Re,children:[l&&(0,m.jsx)(xZ,{mode:J,onModeChange:ne,showModeToggle:a&&!o,readOnly:o,onFormat:G.format,onCopy:ee,onUndo:G.undo,onRedo:G.redo,canUndo:G.canUndo,canRedo:G.canRedo,isMaximized:Z,onToggleMaximize:de,allowMaximize:c,isValid:G.isValid,leftContent:P,rightContent:_,error:N}),(0,m.jsx)("div",{className:"flex-1 min-h-0 h-full",children:J==="view"?(0,m.jsx)(sm,{value:ie,height:u??"100%",collapsible:B,defaultExpandDepth:g,collapsedPaths:C,onCollapseChange:v,showLineNumbers:R,collapseStringsAfterLength:y,wrapLongLinesInView:O}):x==="codemirror"?(0,m.jsx)(bZ,{content:G.content,onChange:G.setContent,onCursorChange:G.setCursorPosition,onUndo:G.undo,onRedo:G.redo,onEscape:Be,isValid:G.isValid,height:u??"100%",maxHeight:Z?void 0:d,showLineNumbers:R,wrapLongLines:A}):(0,m.jsx)(ak,{content:G.content,onChange:G.setContent,onCursorChange:G.setCursorPosition,onUndo:G.undo,onRedo:G.redo,onEscape:Be,isValid:G.isValid,height:u??"100%",maxHeight:Z?void 0:d,showLineNumbers:R,wrapLongLinesInEdit:A,wrapLongLinesInView:O})}),J==="edit"&&(0,m.jsx)(wZ,{cursorPosition:G.cursorPosition,characterCount:G.content.length,validationError:W?G.validationError:null})]})})}function kZ({value:e,className:t,collapsible:n=!1,defaultExpandDepth:r,collapsedPaths:s,onCollapseChange:i,collapseStringsAfterLength:o,expandJsonStrings:a=!1,wrapLongLinesInView:l=!0,showLineNumbers:c=!0,containerClassName:u}){return(0,m.jsx)("div",{className:he("overflow-auto",u),children:(0,m.jsx)(TZ,{value:e,className:t,collapsible:n,defaultExpandDepth:r,collapsedPaths:s,onCollapseChange:i,collapseStringsAfterLength:o,expandJsonStrings:a,wrapLongLinesInView:l,showLineNumbers:c,height:"auto",viewOnly:!0,showToolbar:!1})})}var RZ=class extends Error{};function lle(e){return typeof e=="string"&&e===e.trim()&&/^[A-Za-z0-9][A-Za-z0-9._~:-]{0,255}$/.test(e)&&!e.startsWith("server-")}function OZ(e){const t=()=>new RZ("PLUGIN_DEEP_LINK_INVALID");if(typeof e!="string"||e.length>8192||/[\s\\#\u0000-\u001f\u007f]/.test(e))throw t();const n=/^(codex|chatgpt):\/\/plugins\/([^/?]+)\/app\/([^/?]+)(?:\?([^#]*))?$/.exec(e),r=/^https:\/\/chatgpt\.com\/plugins\/([^/?]+)\/app\/([^/?]+)(?:\?([^#]*))?$/.exec(e);if(!n&&!r)throw t();const s=n?n[1]:"https",i=n?n[2]:r[1],o=n?n[3]:r[2],a=n?n[4]:r[3],l=i.split("@");if(l.length>2||s==="https"&&l.length!==1)throw t();const c=C=>{let v;try{v=decodeURIComponent(C)}catch{throw t()}if(!v||v.length>256||/[\u0000-\u001f\u007f\\]/.test(v))throw t();return v},u=c(l[0]),d=l[1]===void 0?void 0:c(l[1]),h=c(o);if([u,d,h].some(C=>C==="."||C==="..")||a&&/%(?![\da-f]{2})/i.test(a))throw t();const f=new URLSearchParams(a),B=[...f.entries()];if(B.some(([C])=>C!=="path")||B.length>1)throw t();const g=f.get("path")??"/";if(!g.startsWith("/")||g.startsWith("//")||g.length>4096||/[\u0000-\u001f\u007f\\#]/.test(g)||new TextEncoder().encode(g).byteLength>8192)throw t();return{scheme:s,pluginId:u,...d===void 0?{}:{marketplace:d},toolName:h,url:g}}var YO=(0,p.createContext)(null);function cle({value:e,children:t}){return(0,m.jsx)(YO.Provider,{value:e,children:t})}function jE(e){try{return OZ(e),!0}catch{return!1}}function hg(e){return typeof e=="string"||typeof e=="number"?String(e):Array.isArray(e)?e.map(hg).join(""):(0,p.isValidElement)(e)?hg(e.props.children):""}var MZ=e=>e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),wB=e=>e.replace(/([\\[\]])/g,"\\$1"),XO="#mcpjam-link-",NZ=/(?:codex|chatgpt):\/\/plugins\/[^\s)\]>]+|https:\/\/chatgpt\.com\/plugins\/[^\s)\]>]+/g,PZ=/(`[^`\n]*`)|\[((?:\\.|[^\[\]\\])*)\]\(\s*<?([^\s)>]+)>?(?:\s+"[^"]*")?\s*\)|<([a-z][a-z0-9+.-]*:[^>\s]+)>/gi;function LZ(e,t,n){const r=[],s=d=>!!t[d]||n&&jE(d),i=(d,h)=>(r.push(h),`[${d}](${XO}${r.length-1})`);if(/^\s*(```|~~~)/.test(e))return{content:e,targets:r};const o=Object.keys(t).filter(d=>e.includes(d)).sort((d,h)=>h.length-d.length),a=o.length?new RegExp(o.map(MZ).join("|"),"g"):null,l=d=>{let h=a?d.replace(a,f=>i(wB(t[f]?.name??f),f)):d;return n&&(h=h.replace(NZ,f=>jE(f)?i(wB(f),f):f)),h};let c="",u=0;for(const d of e.matchAll(PZ)){c+=l(e.slice(u,d.index)),u=d.index+d[0].length;const[h,f,B,g,C]=d;f!==void 0?c+=h:g!==void 0?c+=s(g)?i(B,g):h:C!==void 0?c+=s(C)?i(wB(t[C]?.name??C),C):h:c+=h}return{content:c+l(e.slice(u)),targets:r}}function _Z(){const e=vJ(),t=(0,p.useContext)(YO),n=(0,p.useCallback)(r=>{const s=LZ(r,e,!!t);if(!s.targets.length)return null;const i=XN.a,o=a=>{const l=typeof a.href=="string"?a.href:"",c=l.startsWith(XO)?Number(l.slice(13)):NaN,u=Number.isInteger(c)?s.targets[c]:void 0;if(!u)return(0,m.jsx)(i,{...a});const d=e[u];if(d){const h=hg(a.children).trim();return(0,m.jsx)(tk,{reference:{serverId:d.serverId,resourceUri:u},label:!h||h===u?d.name:a.children})}return(0,m.jsx)("button",{type:"button",className:"text-primary underline underline-offset-2",title:u,onClick:()=>t?.open(u),children:a.children})};return{content:s.content,components:{a:o}}},[e,t]);return Object.keys(e).length||t?n:null}var ZO=(0,p.createContext)({linkBase:null,trustLinks:!1});function ule({base:e,trustLinks:t=!1,children:n}){const r=(0,p.useMemo)(()=>({linkBase:e,trustLinks:t}),[e,t]);return(0,m.jsx)(ZO.Provider,{value:r,children:n})}function FZ(e){if(!e)return;const t=e.replace(/\/$/,"");return(n,r,s)=>n.startsWith("/")&&!n.startsWith("//")?t+n:YN(n,r,s)}function HZ(e){const t=QN.lexer(e);return t.length===0?[e]:t.map(n=>n.raw)}var eM=(0,p.memo)(({content:e})=>{const{linkBase:t,trustLinks:n}=(0,p.useContext)(ZO),r=_Z(),s=(0,p.useMemo)(()=>FZ(t),[t]),i=(0,p.useMemo)(()=>n?{enabled:!1}:void 0,[n]),o=(0,p.useMemo)(()=>r?.(e)??null,[r,e]);return(0,m.jsx)(JN,{linkSafety:i,urlTransform:s,...o?{components:o.components}:{},children:o?o.content:e})},(e,t)=>e.content===t.content);eM.displayName="MemoizedMarkdownBlock";var tM=(0,p.memo)(({content:e,className:t})=>(0,p.useMemo)(()=>HZ(e),[e]).map((n,r)=>(0,m.jsx)("div",{className:t,children:(0,m.jsx)(eM,{content:n})},`markdown-block_${r}`)),(e,t)=>!(e.content!==t.content||e.className!==t.className));tM.displayName="MemoizedMarkdown";var nM="/web/artifact",rM=3e4,jZ=15e3,GZ=2e3,VZ=2e4,UZ=new Set([401,403,404,410]),zZ=new Set([404,410]),$Z=1,WZ=6e5;function yc(e){if(!e)return!1;try{const t=new URL(e);return(t.protocol==="https:"||t.protocol==="http:")&&t.pathname.endsWith(nM)&&t.searchParams.has("t")}catch{return!1}}function Wh(e){if(!yc(e))return null;const t=new URL(e).searchParams.get("t")??"",n=t.lastIndexOf(".");if(n<=0)return null;const r=t.slice(0,n).replace(/-/g,"+").replace(/_/g,"/");try{const s=JSON.parse(atob(r+"=".repeat((4-r.length%4)%4)));if(!s||typeof s!="object")return null;const{s:i,k:o,e:a}=s;return typeof i=="string"&&typeof o=="string"&&typeof a=="number"?{s:i,k:o,e:a}:null}catch{return null}}function wv(e,t){return`artifact:${new URL(e).origin}:${t.k}:${t.s}`}function Dv(e){const t=Wh(e);return t?wv(e,t):e}var qo=new Map,sM=0,zl=new Set;function qZ(e){for(const[t,n]of qo)n.expiresAt<=e&&qo.delete(t)}function KZ(e){const t=Wh(e);if(!t)return!1;const n=wv(e,t),r=t.e*1e3,s=qo.get(n);return s&&s.expiresAt>=r?!1:(qo.set(n,{url:e,expiresAt:r}),!0)}function JZ(e){let t=!1,n=VZ;const r=[e];for(;r.length>0&&n>0;){n-=1;const s=r.pop();if(typeof s=="string")s.includes(nM)&&KZ(s)&&(t=!0);else if(Array.isArray(s))for(const i of s)r.push(i);else if(s&&typeof s=="object")for(const i of Object.values(s))r.push(i)}if(t){qo.size>GZ&&qZ(Date.now()),sM+=1;for(const s of zl)s()}}function Vd(e){const t=Wh(e);if(!t)return e;const n=qo.get(wv(e,t));return n&&n.expiresAt>t.e*1e3?n.url:e}function QZ(e){return zl.add(e),()=>{zl.delete(e)}}function GE(){return sM}function YZ(e,t){const n=Vd(e);return n!==e?Promise.resolve(n):new Promise(r=>{const s=()=>{const a=Vd(e);a!==e&&(o(),r(a))},i=setTimeout(()=>{o(),r(null)},t),o=()=>{clearTimeout(i),zl.delete(s)};zl.add(s)})}function Tv(e){return(0,p.useSyncExternalStore)(QZ,GE,GE),typeof e=="string"?Vd(e):e}var fg,Bg=Number.NEGATIVE_INFINITY,pg=new Set,Ud=new Map;function iM(e){return(Ud.get(Dv(e))??0)<$Z}function oM(e){const t=Dv(e);Ud.set(t,(Ud.get(t)??0)+1)}function mg(e){Ud.delete(Dv(e))}function aM(e=Date.now()){if(e-Bg<rM)return!1;Bg=e,fg=Math.max((fg??0)+1,Math.floor(e/6e4));for(const t of pg)t();return!0}function XZ(e){return pg.add(e),()=>{pg.delete(e)}}function VE(){return fg}function ZZ(){return(0,p.useSyncExternalStore)(XZ,VE,VE)}async function eee(e,t){const n=Vd(e),r=t===void 0?await fetch(n):await fetch(n,t);if(!yc(n))return r;if(r.ok)return mg(n),r;if(!UZ.has(r.status))return r;const s=zZ.has(r.status);if(s&&!iM(n))return r;aM()&&s&&oM(n);const i=await YZ(n,jZ);if(!i||t?.signal?.aborted)return r;const o=t===void 0?await fetch(i):await fetch(i,t);return o.ok&&mg(i),o}function lM(e,t=Date.now()){if(!yc(e))return null;const n=Wh(e),r=n!==null&&n.e*1e3-t<=WZ;return!r&&!iM(e)?null:aM(t)?(r||oM(e),0):Bg+rM-t}function cM(e){yc(e)&&mg(e)}function dle(e,t){const n=ZZ(),r=t==="skip"||n===void 0?t:{...t,urlEpoch:n},s=lA(e,r);(0,p.useEffect)(()=>{s!==void 0&&JZ(s)},[s]);const i=t==="skip"?null:JSON.stringify(t),o=(0,p.useRef)(null);if(i!==null)return s!==void 0?(o.current={argsKey:i,value:s},s):o.current?.argsKey===i?o.current.value:void 0}function uM({src:e,alt:t,onError:n,onLoad:r,...s}){const i=Tv(e);return(0,m.jsx)("img",{...s,src:i,alt:t,onError:o=>{lM(i),n?.(o)},onLoad:o=>{cM(i),r?.(o)}})}var tee="eval-account-selection-enabled";function nee(){return fA(tee)===!0}var ree={slot:{button:"flex h-8 w-8 shrink-0 items-center justify-center rounded text-muted-foreground transition-colors hover:bg-muted hover:text-foreground",icon:"h-3.5 w-3.5"},inline:{button:"mt-0.5 flex-shrink-0 cursor-pointer p-1 text-muted-foreground/50 transition-colors hover:text-foreground",icon:"h-3 w-3"}};function see({value:e,subject:t,size:n="slot"}){const[r,s]=(0,p.useState)(!1);(0,p.useEffect)(()=>{if(!r)return;const o=setTimeout(()=>s(!1),1500);return()=>clearTimeout(o)},[r]);const i=ree[n];return(0,m.jsx)("button",{type:"button",onClick:async o=>{o.stopPropagation(),await ra(e)?s(!0):t4.error(`Could not copy the ${t}. Show it and copy it by hand.`)},"aria-label":`Copy ${t}`,title:`Copy ${t}`,className:i.button,children:r?(0,m.jsx)(Vs,{className:`${i.icon} text-success`}):(0,m.jsx)(_s,{className:i.icon})})}var qh=(0,p.createContext)(null);qh.displayName="PanelGroupContext";var dt={group:"data-panel-group",groupDirection:"data-panel-group-direction",groupId:"data-panel-group-id",panel:"data-panel",panelCollapsible:"data-panel-collapsible",panelId:"data-panel-id",panelSize:"data-panel-size",resizeHandle:"data-resize-handle",resizeHandleActive:"data-resize-handle-active",resizeHandleEnabled:"data-panel-resize-handle-enabled",resizeHandleId:"data-panel-resize-handle-id",resizeHandleState:"data-resize-handle-state"},Av=10,Ai=p.useLayoutEffect,UE=p.useId,iee=typeof UE=="function"?UE:()=>null,oee=0;function Iv(e=null){const t=iee(),n=(0,p.useRef)(e||t||null);return n.current===null&&(n.current=""+oee++),e??n.current}function dM({children:e,className:t="",collapsedSize:n,collapsible:r,defaultSize:s,forwardedRef:i,id:o,maxSize:a,minSize:l,onCollapse:c,onExpand:u,onResize:d,order:h,style:f,tagName:B="div",...g}){const C=(0,p.useContext)(qh);if(C===null)throw Error("Panel components must be rendered within a PanelGroup container");const{collapsePanel:v,expandPanel:y,getPanelSize:S,getPanelStyle:E,groupId:D,isPanelCollapsed:A,reevaluatePanelConstraints:x,registerPanel:O,resizePanel:R,unregisterPanel:P}=C,_=Iv(o),N=(0,p.useRef)({callbacks:{onCollapse:c,onExpand:u,onResize:d},constraints:{collapsedSize:n,collapsible:r,defaultSize:s,maxSize:a,minSize:l},id:_,idIsFromProps:o!==void 0,order:h});(0,p.useRef)({didLogMissingDefaultSizeWarning:!1}),Ai(()=>{const{callbacks:q,constraints:F}=N.current,z={...F};N.current.id=_,N.current.idIsFromProps=o!==void 0,N.current.order=h,q.onCollapse=c,q.onExpand=u,q.onResize=d,F.collapsedSize=n,F.collapsible=r,F.defaultSize=s,F.maxSize=a,F.minSize=l,(z.collapsedSize!==F.collapsedSize||z.collapsible!==F.collapsible||z.maxSize!==F.maxSize||z.minSize!==F.minSize)&&x(N.current,z)}),Ai(()=>{const q=N.current;return O(q),()=>{P(q)}},[h,_,O,P]),(0,p.useImperativeHandle)(i,()=>({collapse:()=>{v(N.current)},expand:q=>{y(N.current,q)},getId(){return _},getSize(){return S(N.current)},isCollapsed(){return A(N.current)},isExpanded(){return!A(N.current)},resize:q=>{R(N.current,q)}}),[v,y,S,A,_,R]);const W=E(N.current,s);return(0,p.createElement)(B,{...g,children:e,className:t,id:_,style:{...W,...f},[dt.groupId]:D,[dt.panel]:"",[dt.panelCollapsible]:r||void 0,[dt.panelId]:_,[dt.panelSize]:parseFloat(""+W.flexGrow).toFixed(1)})}var kv=(0,p.forwardRef)((e,t)=>(0,p.createElement)(dM,{...e,forwardedRef:t}));dM.displayName="Panel";kv.displayName="forwardRef(Panel)";var aee;function lee(){return aee}var gg=null,cee=!0,zE=null,od=-1,Jr=null;function uee(e,t,n){const r=(t&mM)!==0,s=(t&gM)!==0,i=(t&CM)!==0,o=(t&vM)!==0;if(zE)return zE({exceedsHorizontalMaximum:s,exceedsHorizontalMinimum:r,exceedsVerticalMaximum:o,exceedsVerticalMinimum:i,intersectsHorizontalDragHandle:e==="horizontal"||e==="intersection",intersectsVerticalDragHandle:e==="vertical"||e==="intersection",isPointerDown:n});if(t){if(r)return i?"se-resize":o?"ne-resize":"e-resize";if(s)return i?"sw-resize":o?"nw-resize":"w-resize";if(i)return"s-resize";if(o)return"n-resize"}switch(e){case"horizontal":return"ew-resize";case"intersection":return"move";case"vertical":return"ns-resize"}}function dee(){Jr!==null&&(document.head.removeChild(Jr),gg=null,Jr=null,od=-1)}function DB(e,t,n){var r,s;if(!cee)return;const i=uee(e,t,n);if(gg!==i){if(gg=i,Jr===null){Jr=document.createElement("style");const a=lee();a&&Jr.setAttribute("nonce",a),document.head.appendChild(Jr)}if(od>=0){var o;(o=Jr.sheet)===null||o===void 0||o.removeRule(od)}od=(r=(s=Jr.sheet)===null||s===void 0?void 0:s.insertRule(`*{cursor: ${i} !important;}`))!==null&&r!==void 0?r:-1}}function hM(e){return e.type==="keydown"}function fM(e){return e.type.startsWith("pointer")}function BM(e){return e.type.startsWith("mouse")}function Kh(e){if(fM(e)){if(e.isPrimary)return{x:e.clientX,y:e.clientY}}else if(BM(e))return{x:e.clientX,y:e.clientY};return{x:1/0,y:1/0}}function hee(){if(typeof matchMedia=="function")return matchMedia("(pointer:coarse)").matches?"coarse":"fine"}function fee(e,t,n){return n?e.x<t.x+t.width&&e.x+e.width>t.x&&e.y<t.y+t.height&&e.y+e.height>t.y:e.x<=t.x+t.width&&e.x+e.width>=t.x&&e.y<=t.y+t.height&&e.y+e.height>=t.y}function Bee(e,t){if(e===t)throw new Error("Cannot compare node with itself");const n={a:qE(e),b:qE(t)};let r;for(;n.a.at(-1)===n.b.at(-1);)e=n.a.pop(),t=n.b.pop(),r=e;Te(r,"Stacking order can only be calculated for elements with a common ancestor");const s={a:WE($E(n.a)),b:WE($E(n.b))};if(s.a===s.b){const i=r.childNodes,o={a:n.a.at(-1),b:n.b.at(-1)};let a=i.length;for(;a--;){const l=i[a];if(l===o.a)return 1;if(l===o.b)return-1}}return Math.sign(s.a-s.b)}var pee=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function mee(e){var t;const n=getComputedStyle((t=pM(e))!==null&&t!==void 0?t:e).display;return n==="flex"||n==="inline-flex"}function gee(e){const t=getComputedStyle(e);return!!(t.position==="fixed"||t.zIndex!=="auto"&&(t.position!=="static"||mee(e))||+t.opacity<1||"transform"in t&&t.transform!=="none"||"webkitTransform"in t&&t.webkitTransform!=="none"||"mixBlendMode"in t&&t.mixBlendMode!=="normal"||"filter"in t&&t.filter!=="none"||"webkitFilter"in t&&t.webkitFilter!=="none"||"isolation"in t&&t.isolation==="isolate"||pee.test(t.willChange)||t.webkitOverflowScrolling==="touch")}function $E(e){let t=e.length;for(;t--;){const n=e[t];if(Te(n,"Missing node"),gee(n))return n}return null}function WE(e){return e&&Number(getComputedStyle(e).zIndex)||0}function qE(e){const t=[];for(;e;)t.push(e),e=pM(e);return t}function pM(e){const{parentNode:t}=e;return t&&t instanceof ShadowRoot?t.host:t}var mM=1,gM=2,CM=4,vM=8,Cee=hee()==="coarse",cr=[],as=!1,Rs=new Map,Jh=new Map,$l=new Set;function vee(e,t,n,r,s){var i;const{ownerDocument:o}=t,a={direction:n,element:t,hitAreaMargins:r,setResizeHandlerState:s},l=(i=Rs.get(o))!==null&&i!==void 0?i:0;return Rs.set(o,l+1),$l.add(a),zd(),function(){var u;Jh.delete(e),$l.delete(a);const d=(u=Rs.get(o))!==null&&u!==void 0?u:1;if(Rs.set(o,d-1),zd(),d===1&&Rs.delete(o),cr.includes(a)){const h=cr.indexOf(a);h>=0&&cr.splice(h,1),Qh(),s("up",!0,null)}}}function yee(e){const{target:t}=e,{x:n,y:r}=Kh(e);as=!0,Rv({target:t,x:n,y:r}),zd(),cr.length>0&&($d("down",e),Qh(),e.preventDefault(),yM(t)||e.stopImmediatePropagation())}function TB(e){const{x:t,y:n}=Kh(e);if(as&&e.type!=="pointerleave"&&e.buttons===0&&(as=!1,$d("up",e)),!as){const{target:r}=e;Rv({target:r,x:t,y:n})}$d("move",e),Qh(),cr.length>0&&e.preventDefault()}function AB(e){const{target:t}=e,{x:n,y:r}=Kh(e);Jh.clear(),as=!1,cr.length>0&&(e.preventDefault(),yM(t)||e.stopImmediatePropagation()),$d("up",e),Rv({target:t,x:n,y:r}),Qh(),zd()}function yM(e){let t=e;for(;t;){if(t.hasAttribute(dt.resizeHandle))return!0;t=t.parentElement}return!1}function Rv({target:e,x:t,y:n}){cr.splice(0);let r=null;(e instanceof HTMLElement||e instanceof SVGElement)&&(r=e),$l.forEach(s=>{const{element:i,hitAreaMargins:o}=s,a=i.getBoundingClientRect(),{bottom:l,left:c,right:u,top:d}=a,h=Cee?o.coarse:o.fine;if(t>=c-h&&t<=u+h&&n>=d-h&&n<=l+h){if(r!==null&&document.contains(r)&&i!==r&&!i.contains(r)&&!r.contains(i)&&Bee(r,i)>0){let f=r,B=!1;for(;f&&!f.contains(i);){if(fee(f.getBoundingClientRect(),a,!0)){B=!0;break}f=f.parentElement}if(B)return}cr.push(s)}})}function IB(e,t){Jh.set(e,t)}function Qh(){let e=!1,t=!1;cr.forEach(r=>{const{direction:s}=r;s==="horizontal"?e=!0:t=!0});let n=0;Jh.forEach(r=>{n|=r}),e&&t?DB("intersection",n,as):e?DB("horizontal",n,as):t?DB("vertical",n,as):dee()}var kB;function zd(){var e;(e=kB)===null||e===void 0||e.abort(),kB=new AbortController;const t={capture:!0,signal:kB.signal};$l.size&&(as?(cr.length>0&&Rs.forEach((n,r)=>{const{body:s}=r;n>0&&(s.addEventListener("contextmenu",AB,t),s.addEventListener("pointerleave",TB,t),s.addEventListener("pointermove",TB,t))}),Rs.forEach((n,r)=>{const{body:s}=r;s.addEventListener("pointerup",AB,t),s.addEventListener("pointercancel",AB,t)})):Rs.forEach((n,r)=>{const{body:s}=r;n>0&&(s.addEventListener("pointerdown",yee,t),s.addEventListener("pointermove",TB,t))}))}function $d(e,t){$l.forEach(n=>{const{setResizeHandlerState:r}=n;r(e,cr.includes(n),t)})}function bee(){const[e,t]=(0,p.useState)(0);return(0,p.useCallback)(()=>t(n=>n+1),[])}function Te(e,t){if(!e)throw console.error(t),Error(t)}function Fi(e,t,n=Av){return e.toFixed(n)===t.toFixed(n)?0:e>t?1:-1}function Zr(e,t,n=Av){return Fi(e,t,n)===0}function Sn(e,t,n){return Fi(e,t,n)===0}function See(e,t,n){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++){const s=e[r],i=t[r];if(!Sn(s,i,n))return!1}return!0}function bo({panelConstraints:e,panelIndex:t,size:n}){const r=e[t];Te(r!=null,`Panel constraints not found for index ${t}`);let{collapsedSize:s=0,collapsible:i,maxSize:o=100,minSize:a=0}=r;if(Fi(n,a)<0)if(i){const l=(s+a)/2;Fi(n,l)<0?n=s:n=a}else n=a;return n=Math.min(o,n),n=parseFloat(n.toFixed(Av)),n}function Va({delta:e,initialLayout:t,panelConstraints:n,pivotIndices:r,prevLayout:s,trigger:i}){if(Sn(e,0))return t;const o=[...t],[a,l]=r;Te(a!=null,"Invalid first pivot index"),Te(l!=null,"Invalid second pivot index");let c=0;if(i==="keyboard"){{const u=e<0?l:a,d=n[u];Te(d,`Panel constraints not found for index ${u}`);const{collapsedSize:h=0,collapsible:f,minSize:B=0}=d;if(f){const g=t[u];if(Te(g!=null,`Previous layout not found for panel index ${u}`),Sn(g,h)){const C=B-g;Fi(C,Math.abs(e))>0&&(e=e<0?0-C:C)}}}{const u=e<0?a:l,d=n[u];Te(d,`No panel constraints found for index ${u}`);const{collapsedSize:h=0,collapsible:f,minSize:B=0}=d;if(f){const g=t[u];if(Te(g!=null,`Previous layout not found for panel index ${u}`),Sn(g,B)){const C=g-h;Fi(C,Math.abs(e))>0&&(e=e<0?0-C:C)}}}}{const u=e<0?1:-1;let d=e<0?l:a,h=0;for(;;){const B=t[d];Te(B!=null,`Previous layout not found for panel index ${d}`);const g=bo({panelConstraints:n,panelIndex:d,size:100})-B;if(h+=g,d+=u,d<0||d>=n.length)break}const f=Math.min(Math.abs(e),Math.abs(h));e=e<0?0-f:f}{let u=e<0?a:l;for(;u>=0&&u<n.length;){const d=Math.abs(e)-Math.abs(c),h=t[u];Te(h!=null,`Previous layout not found for panel index ${u}`);const f=h-d,B=bo({panelConstraints:n,panelIndex:u,size:f});if(!Sn(h,B)&&(c+=h-B,o[u]=B,c.toFixed(3).localeCompare(Math.abs(e).toFixed(3),void 0,{numeric:!0})>=0))break;e<0?u--:u++}}if(See(s,o))return s;{const u=e<0?l:a,d=t[u];Te(d!=null,`Previous layout not found for panel index ${u}`);const h=d+c,f=bo({panelConstraints:n,panelIndex:u,size:h});if(o[u]=f,!Sn(f,h)){let B=h-f,g=e<0?l:a;for(;g>=0&&g<n.length;){const C=o[g];Te(C!=null,`Previous layout not found for panel index ${g}`);const v=C+B,y=bo({panelConstraints:n,panelIndex:g,size:v});if(Sn(C,y)||(B-=y-C,o[g]=y),Sn(B,0))break;e>0?g--:g++}}}return Sn(o.reduce((u,d)=>d+u,0),100)?o:s}function Eee({layout:e,panelsArray:t,pivotIndices:n}){let r=0,s=100,i=0,o=0;const a=n[0];return Te(a!=null,"No pivot index found"),t.forEach((l,c)=>{const{constraints:u}=l,{maxSize:d=100,minSize:h=0}=u;c===a?(r=h,s=d):(i+=h,o+=d)}),{valueMax:Math.min(s,100-i),valueMin:Math.max(r,100-o),valueNow:e[a]}}function Wl(e,t=document){return Array.from(t.querySelectorAll(`[${dt.resizeHandleId}][data-panel-group-id="${e}"]`))}function bM(e,t,n=document){const r=Wl(e,n).findIndex(s=>s.getAttribute(dt.resizeHandleId)===t);return r??null}function SM(e,t,n){const r=bM(e,t,n);return r!=null?[r,r+1]:[-1,-1]}function xee(e){return e instanceof HTMLElement?!0:typeof e=="object"&&e!==null&&"tagName"in e&&"getAttribute"in e}function EM(e,t=document){if(xee(t)&&t.dataset.panelGroupId==e)return t;const n=t.querySelector(`[data-panel-group][data-panel-group-id="${e}"]`);return n||null}function Yh(e,t=document){const n=t.querySelector(`[${dt.resizeHandleId}="${e}"]`);return n||null}function wee(e,t,n,r=document){var s,i,o,a;const l=Yh(t,r),c=Wl(e,r),u=l?c.indexOf(l):-1;return[(s=(i=n[u])===null||i===void 0?void 0:i.id)!==null&&s!==void 0?s:null,(o=(a=n[u+1])===null||a===void 0?void 0:a.id)!==null&&o!==void 0?o:null]}function Dee({committedValuesRef:e,eagerValuesRef:t,groupId:n,layout:r,panelDataArray:s,panelGroupElement:i,setLayout:o}){(0,p.useRef)({didWarnAboutMissingResizeHandle:!1}),Ai(()=>{if(!i)return;const a=Wl(n,i);for(let l=0;l<s.length-1;l++){const{valueMax:c,valueMin:u,valueNow:d}=Eee({layout:r,panelsArray:s,pivotIndices:[l,l+1]}),h=a[l];if(h!=null){const f=s[l];Te(f,`No panel data found for index "${l}"`),h.setAttribute("aria-controls",f.id),h.setAttribute("aria-valuemax",""+Math.round(c)),h.setAttribute("aria-valuemin",""+Math.round(u)),h.setAttribute("aria-valuenow",d!=null?""+Math.round(d):"")}}return()=>{a.forEach((l,c)=>{l.removeAttribute("aria-controls"),l.removeAttribute("aria-valuemax"),l.removeAttribute("aria-valuemin"),l.removeAttribute("aria-valuenow")})}},[n,r,s,i]),(0,p.useEffect)(()=>{if(!i)return;const a=t.current;Te(a,"Eager values not found");const{panelDataArray:l}=a;Te(EM(n,i)!=null,`No group found for id "${n}"`);const c=Wl(n,i);Te(c,`No resize handles found for group id "${n}"`);const u=c.map(d=>{const h=d.getAttribute(dt.resizeHandleId);Te(h,"Resize handle element has no handle id attribute");const[f,B]=wee(n,h,l,i);if(f==null||B==null)return()=>{};const g=C=>{if(!C.defaultPrevented)switch(C.key){case"Enter":{C.preventDefault();const v=l.findIndex(y=>y.id===f);if(v>=0){const y=l[v];Te(y,`No panel data found for index ${v}`);const S=r[v],{collapsedSize:E=0,collapsible:D,minSize:A=0}=y.constraints;if(S!=null&&D){const x=Va({delta:Sn(S,E)?A-E:E-S,initialLayout:r,panelConstraints:l.map(O=>O.constraints),pivotIndices:SM(n,h,i),prevLayout:r,trigger:"keyboard"});r!==x&&o(x)}}break}}};return d.addEventListener("keydown",g),()=>{d.removeEventListener("keydown",g)}});return()=>{u.forEach(d=>d())}},[i,e,t,n,r,s,o])}function KE(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function xM(e,t){const n=e==="horizontal",{x:r,y:s}=Kh(t);return n?r:s}function Tee(e,t,n,r,s){const i=n==="horizontal",o=Yh(t,s);Te(o,`No resize handle element found for id "${t}"`);const a=o.getAttribute(dt.groupId);Te(a,"Resize handle element has no group id attribute");let{initialCursorPosition:l}=r;const c=xM(n,e),u=EM(a,s);Te(u,`No group element found for id "${a}"`);const d=u.getBoundingClientRect(),h=i?d.width:d.height;return(c-l)/h*100}function Aee(e,t,n,r,s,i){if(hM(e)){const o=n==="horizontal";let a=0;e.shiftKey?a=100:s!=null?a=s:a=10;let l=0;switch(e.key){case"ArrowDown":l=o?0:a;break;case"ArrowLeft":l=o?-a:0;break;case"ArrowRight":l=o?a:0;break;case"ArrowUp":l=o?0:-a;break;case"End":l=100;break;case"Home":l=-100}return l}else return r==null?0:Tee(e,t,n,r,i)}function Iee({panelDataArray:e}){const t=Array(e.length),n=e.map(i=>i.constraints);let r=0,s=100;for(let i=0;i<e.length;i++){const o=n[i];Te(o,`Panel constraints not found for index ${i}`);const{defaultSize:a}=o;a!=null&&(r++,t[i]=a,s-=a)}for(let i=0;i<e.length;i++){const o=n[i];Te(o,`Panel constraints not found for index ${i}`);const{defaultSize:a}=o;if(a!=null)continue;const l=e.length-r,c=s/l;r++,t[i]=c,s-=c}return t}function Zi(e,t,n){t.forEach((r,s)=>{const i=e[s];Te(i,`Panel data not found for index ${s}`);const{callbacks:o,constraints:a,id:l}=i,{collapsedSize:c=0,collapsible:u}=a,d=n[l];if(d==null||r!==d){n[l]=r;const{onCollapse:h,onExpand:f,onResize:B}=o;B&&B(r,d),u&&(h||f)&&(f&&(d==null||Zr(d,c))&&!Zr(r,c)&&f(),h&&(d==null||!Zr(d,c))&&Zr(r,c)&&h())}})}function pu(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!=t[n])return!1;return!0}function kee({defaultSize:e,dragState:t,layout:n,panelData:r,panelIndex:s,precision:i=3}){const o=n[s];let a;return o==null?a=e!=null?e.toFixed(i):"1":r.length===1?a="1":a=o.toFixed(i),{flexBasis:0,flexGrow:a,flexShrink:1,overflow:"hidden",pointerEvents:t!==null?"none":void 0}}function Ree(e,t=10){let n=null;return(...s)=>{n!==null&&clearTimeout(n),n=setTimeout(()=>{e(...s)},t)}}function JE(e){try{if(typeof localStorage<"u")e.getItem=t=>localStorage.getItem(t),e.setItem=(t,n)=>{localStorage.setItem(t,n)};else throw new Error("localStorage not supported in this environment")}catch(t){console.error(t),e.getItem=()=>null,e.setItem=()=>{}}}function wM(e){return`react-resizable-panels:${e}`}function DM(e){return e.map(t=>{const{constraints:n,id:r,idIsFromProps:s,order:i}=t;return s?r:i?`${i}:${JSON.stringify(n)}`:JSON.stringify(n)}).sort((t,n)=>t.localeCompare(n)).join(",")}function TM(e,t){try{const n=wM(e),r=t.getItem(n);if(r){const s=JSON.parse(r);if(typeof s=="object"&&s!=null)return s}}catch{}return null}function Oee(e,t,n){var r,s;return(s=((r=TM(e,n))!==null&&r!==void 0?r:{})[DM(t)])!==null&&s!==void 0?s:null}function Mee(e,t,n,r,s){var i;const o=wM(e),a=DM(t),l=(i=TM(e,s))!==null&&i!==void 0?i:{};l[a]={expandToSizes:Object.fromEntries(n.entries()),layout:r};try{s.setItem(o,JSON.stringify(l))}catch(c){console.error(c)}}function QE({layout:e,panelConstraints:t}){const n=[...e],r=n.reduce((i,o)=>i+o,0);if(n.length!==t.length)throw Error(`Invalid ${t.length} panel layout: ${n.map(i=>`${i}%`).join(", ")}`);if(!Sn(r,100)&&n.length>0)for(let i=0;i<t.length;i++){const o=n[i];Te(o!=null,`No layout data found for index ${i}`);const a=100/r*o;n[i]=a}let s=0;for(let i=0;i<t.length;i++){const o=n[i];Te(o!=null,`No layout data found for index ${i}`);const a=bo({panelConstraints:t,panelIndex:i,size:o});o!=a&&(s+=o-a,n[i]=a)}if(!Sn(s,0))for(let i=0;i<t.length;i++){const o=n[i];Te(o!=null,`No layout data found for index ${i}`);const a=o+s,l=bo({panelConstraints:t,panelIndex:i,size:a});if(o!==l&&(s-=l-o,n[i]=l,Sn(s,0)))break}return n}var Nee=100,Ua={getItem:e=>(JE(Ua),Ua.getItem(e)),setItem:(e,t)=>{JE(Ua),Ua.setItem(e,t)}},YE={};function AM({autoSaveId:e=null,children:t,className:n="",direction:r,forwardedRef:s,id:i=null,onLayout:o=null,keyboardResizeBy:a=null,storage:l=Ua,style:c,tagName:u="div",...d}){const h=Iv(i),f=(0,p.useRef)(null),[B,g]=(0,p.useState)(null),[C,v]=(0,p.useState)([]),y=bee(),S=(0,p.useRef)({}),E=(0,p.useRef)(new Map),D=(0,p.useRef)(0),A=(0,p.useRef)({autoSaveId:e,direction:r,dragState:B,id:h,keyboardResizeBy:a,onLayout:o,storage:l}),x=(0,p.useRef)({layout:C,panelDataArray:[],panelDataArrayChanged:!1});(0,p.useRef)({didLogIdAndOrderWarning:!1,didLogPanelConstraintsWarning:!1,prevPanelIds:[]}),(0,p.useImperativeHandle)(s,()=>({getId:()=>A.current.id,getLayout:()=>{const{layout:X}=x.current;return X},setLayout:X=>{const{onLayout:Y}=A.current,{layout:ie,panelDataArray:ne}=x.current,ee=QE({layout:X,panelConstraints:ne.map(Be=>Be.constraints)});KE(ie,ee)||(v(ee),x.current.layout=ee,Y&&Y(ee),Zi(ne,ee,S.current))}}),[]),Ai(()=>{A.current.autoSaveId=e,A.current.direction=r,A.current.dragState=B,A.current.id=h,A.current.onLayout=o,A.current.storage=l}),Dee({committedValuesRef:A,eagerValuesRef:x,groupId:h,layout:C,panelDataArray:x.current.panelDataArray,setLayout:v,panelGroupElement:f.current}),(0,p.useEffect)(()=>{const{panelDataArray:X}=x.current;if(e){if(C.length===0||C.length!==X.length)return;let Y=YE[e];Y==null&&(Y=Ree(Mee,Nee),YE[e]=Y);const ie=[...X],ne=new Map(E.current);Y(e,ie,ne,C,l)}},[e,C,l]),(0,p.useEffect)(()=>{});const O=(0,p.useCallback)(X=>{const{onLayout:Y}=A.current,{layout:ie,panelDataArray:ne}=x.current;if(X.constraints.collapsible){const ee=ne.map(Ee=>Ee.constraints),{collapsedSize:Be=0,panelSize:de,pivotIndices:Re}=ai(ne,X,ie);if(Te(de!=null,`Panel size not found for panel "${X.id}"`),!Zr(de,Be)){E.current.set(X.id,de);const Ee=Va({delta:uo(ne,X)===ne.length-1?de-Be:Be-de,initialLayout:ie,panelConstraints:ee,pivotIndices:Re,prevLayout:ie,trigger:"imperative-api"});pu(ie,Ee)||(v(Ee),x.current.layout=Ee,Y&&Y(Ee),Zi(ne,Ee,S.current))}}},[]),R=(0,p.useCallback)((X,Y)=>{const{onLayout:ie}=A.current,{layout:ne,panelDataArray:ee}=x.current;if(X.constraints.collapsible){const Be=ee.map(Bt=>Bt.constraints),{collapsedSize:de=0,panelSize:Re=0,minSize:Ee=0,pivotIndices:st}=ai(ee,X,ne),at=Y??Ee;if(Zr(Re,de)){const Bt=E.current.get(X.id),tt=Bt!=null&&Bt>=at?Bt:at,pt=Va({delta:uo(ee,X)===ee.length-1?Re-tt:tt-Re,initialLayout:ne,panelConstraints:Be,pivotIndices:st,prevLayout:ne,trigger:"imperative-api"});pu(ne,pt)||(v(pt),x.current.layout=pt,ie&&ie(pt),Zi(ee,pt,S.current))}}},[]),P=(0,p.useCallback)(X=>{const{layout:Y,panelDataArray:ie}=x.current,{panelSize:ne}=ai(ie,X,Y);return Te(ne!=null,`Panel size not found for panel "${X.id}"`),ne},[]),_=(0,p.useCallback)((X,Y)=>{const{panelDataArray:ie}=x.current,ne=uo(ie,X);return kee({defaultSize:Y,dragState:B,layout:C,panelData:ie,panelIndex:ne})},[B,C]),N=(0,p.useCallback)(X=>{const{layout:Y,panelDataArray:ie}=x.current,{collapsedSize:ne=0,collapsible:ee,panelSize:Be}=ai(ie,X,Y);return Te(Be!=null,`Panel size not found for panel "${X.id}"`),ee===!0&&Zr(Be,ne)},[]),W=(0,p.useCallback)(X=>{const{layout:Y,panelDataArray:ie}=x.current,{collapsedSize:ne=0,collapsible:ee,panelSize:Be}=ai(ie,X,Y);return Te(Be!=null,`Panel size not found for panel "${X.id}"`),!ee||Fi(Be,ne)>0},[]),q=(0,p.useCallback)(X=>{const{panelDataArray:Y}=x.current;Y.push(X),Y.sort((ie,ne)=>{const ee=ie.order,Be=ne.order;return ee==null&&Be==null?0:ee==null?-1:Be==null?1:ee-Be}),x.current.panelDataArrayChanged=!0,y()},[y]);Ai(()=>{if(x.current.panelDataArrayChanged){x.current.panelDataArrayChanged=!1;const{autoSaveId:X,onLayout:Y,storage:ie}=A.current,{layout:ne,panelDataArray:ee}=x.current;let Be=null;if(X){const Re=Oee(X,ee,ie);Re&&(E.current=new Map(Object.entries(Re.expandToSizes)),Be=Re.layout)}Be==null&&(Be=Iee({panelDataArray:ee}));const de=QE({layout:Be,panelConstraints:ee.map(Re=>Re.constraints)});KE(ne,de)||(v(de),x.current.layout=de,Y&&Y(de),Zi(ee,de,S.current))}}),Ai(()=>{const X=x.current;return()=>{X.layout=[]}},[]);const F=(0,p.useCallback)(X=>{let Y=!1;const ie=f.current;return ie&&window.getComputedStyle(ie,null).getPropertyValue("direction")==="rtl"&&(Y=!0),function(ee){ee.preventDefault();const Be=f.current;if(!Be)return()=>null;const{direction:de,dragState:Re,id:Ee,keyboardResizeBy:st,onLayout:at}=A.current,{layout:Bt,panelDataArray:tt}=x.current,{initialLayout:pt}=Re??{},Lt=SM(Ee,X,Be);let mt=Aee(ee,X,de,Re,st,Be);const lt=de==="horizontal";lt&&Y&&(mt=-mt);const Un=tt.map(je=>je.constraints),it=Va({delta:mt,initialLayout:pt??Bt,panelConstraints:Un,pivotIndices:Lt,prevLayout:Bt,trigger:hM(ee)?"keyboard":"mouse-or-touch"}),ae=!pu(Bt,it);(fM(ee)||BM(ee))&&D.current!=mt&&(D.current=mt,!ae&&mt!==0?lt?IB(X,mt<0?mM:gM):IB(X,mt<0?CM:vM):IB(X,0)),ae&&(v(it),x.current.layout=it,at&&at(it),Zi(tt,it,S.current))}},[]),z=(0,p.useCallback)((X,Y)=>{const{onLayout:ie}=A.current,{layout:ne,panelDataArray:ee}=x.current,Be=ee.map(st=>st.constraints),{panelSize:de,pivotIndices:Re}=ai(ee,X,ne);Te(de!=null,`Panel size not found for panel "${X.id}"`);const Ee=Va({delta:uo(ee,X)===ee.length-1?de-Y:Y-de,initialLayout:ne,panelConstraints:Be,pivotIndices:Re,prevLayout:ne,trigger:"imperative-api"});pu(ne,Ee)||(v(Ee),x.current.layout=Ee,ie&&ie(Ee),Zi(ee,Ee,S.current))},[]),J=(0,p.useCallback)((X,Y)=>{const{layout:ie,panelDataArray:ne}=x.current,{collapsedSize:ee=0,collapsible:Be}=Y,{collapsedSize:de=0,collapsible:Re,maxSize:Ee=100,minSize:st=0}=X.constraints,{panelSize:at}=ai(ne,X,ie);at!=null&&(Be&&Re&&Zr(at,ee)?Zr(ee,de)||z(X,de):at<st?z(X,st):at>Ee&&z(X,Ee))},[z]),Z=(0,p.useCallback)((X,Y)=>{const{direction:ie}=A.current,{layout:ne}=x.current;if(!f.current)return;const ee=Yh(X,f.current);Te(ee,`Drag handle element not found for id "${X}"`);const Be=xM(ie,Y);g({dragHandleId:X,dragHandleRect:ee.getBoundingClientRect(),initialCursorPosition:Be,initialLayout:ne})},[]),Q=(0,p.useCallback)(()=>{g(null)},[]),G=(0,p.useCallback)(X=>{const{panelDataArray:Y}=x.current,ie=uo(Y,X);ie>=0&&(Y.splice(ie,1),delete S.current[X.id],x.current.panelDataArrayChanged=!0,y())},[y]),be=(0,p.useMemo)(()=>({collapsePanel:O,direction:r,dragState:B,expandPanel:R,getPanelSize:P,getPanelStyle:_,groupId:h,isPanelCollapsed:N,isPanelExpanded:W,reevaluatePanelConstraints:J,registerPanel:q,registerResizeHandle:F,resizePanel:z,startDragging:Z,stopDragging:Q,unregisterPanel:G,panelGroupElement:f.current}),[O,B,r,R,P,_,h,N,W,J,q,F,z,Z,Q,G]),ve={display:"flex",flexDirection:r==="horizontal"?"row":"column",height:"100%",overflow:"hidden",width:"100%"};return(0,p.createElement)(qh.Provider,{value:be},(0,p.createElement)(u,{...d,children:t,className:n,id:i,ref:f,style:{...ve,...c},[dt.group]:"",[dt.groupDirection]:r,[dt.groupId]:h}))}var IM=(0,p.forwardRef)((e,t)=>(0,p.createElement)(AM,{...e,forwardedRef:t}));AM.displayName="PanelGroup";IM.displayName="forwardRef(PanelGroup)";function uo(e,t){return e.findIndex(n=>n===t||n.id===t.id)}function ai(e,t,n){const r=uo(e,t),s=r===e.length-1?[r-1,r]:[r,r+1],i=n[r];return{...t.constraints,panelSize:i,pivotIndices:s}}function Pee({disabled:e,handleId:t,resizeHandler:n,panelGroupElement:r}){(0,p.useEffect)(()=>{if(e||n==null||r==null)return;const s=Yh(t,r);if(s==null)return;const i=o=>{if(!o.defaultPrevented)switch(o.key){case"ArrowDown":case"ArrowLeft":case"ArrowRight":case"ArrowUp":case"End":case"Home":o.preventDefault(),n(o);break;case"F6":{o.preventDefault();const a=s.getAttribute(dt.groupId);Te(a,`No group element found for id "${a}"`);const l=Wl(a,r),c=bM(a,t,r);Te(c!==null,`No resize element found for id "${t}"`),l[o.shiftKey?c>0?c-1:l.length-1:c+1<l.length?c+1:0].focus();break}}};return s.addEventListener("keydown",i),()=>{s.removeEventListener("keydown",i)}},[r,e,t,n])}function kM({children:e=null,className:t="",disabled:n=!1,hitAreaMargins:r,id:s,onBlur:i,onClick:o,onDragging:a,onFocus:l,onPointerDown:c,onPointerUp:u,style:d={},tabIndex:h=0,tagName:f="div",...B}){var g,C;const v=(0,p.useRef)(null),y=(0,p.useRef)({onClick:o,onDragging:a,onPointerDown:c,onPointerUp:u});(0,p.useEffect)(()=>{y.current.onClick=o,y.current.onDragging=a,y.current.onPointerDown=c,y.current.onPointerUp=u});const S=(0,p.useContext)(qh);if(S===null)throw Error("PanelResizeHandle components must be rendered within a PanelGroup container");const{direction:E,groupId:D,registerResizeHandle:A,startDragging:x,stopDragging:O,panelGroupElement:R}=S,P=Iv(s),[_,N]=(0,p.useState)("inactive"),[W,q]=(0,p.useState)(!1),[F,z]=(0,p.useState)(null),J=(0,p.useRef)({state:_});Ai(()=>{J.current.state=_}),(0,p.useEffect)(()=>{if(n)z(null);else{const be=A(P);z(()=>be)}},[n,P,A]);const Z=(g=r?.coarse)!==null&&g!==void 0?g:15,Q=(C=r?.fine)!==null&&C!==void 0?C:5;(0,p.useEffect)(()=>{if(n||F==null)return;const be=v.current;Te(be,"Element ref not attached");let ve=!1;return vee(P,be,E,{coarse:Z,fine:Q},(Y,ie,ne)=>{if(!ie){N("inactive");return}switch(Y){case"down":{N("drag"),ve=!1,Te(ne,'Expected event to be defined for "down" action'),x(P,ne);const{onDragging:ee,onPointerDown:Be}=y.current;ee?.(!0),Be?.();break}case"move":{const{state:ee}=J.current;ve=!0,ee!=="drag"&&N("hover"),Te(ne,'Expected event to be defined for "move" action'),F(ne);break}case"up":{N("hover"),O();const{onClick:ee,onDragging:Be,onPointerUp:de}=y.current;Be?.(!1),de?.(),ve||ee?.();break}}})},[Z,E,n,Q,A,P,F,x,O]),Pee({disabled:n,handleId:P,resizeHandler:F,panelGroupElement:R});const G={touchAction:"none",userSelect:"none"};return(0,p.createElement)(f,{...B,children:e,className:t,id:s,onBlur:()=>{q(!1),i?.()},onFocus:()=>{q(!0),l?.()},ref:v,role:"separator",style:{...G,...d},tabIndex:h,[dt.groupDirection]:E,[dt.groupId]:D,[dt.resizeHandle]:"",[dt.resizeHandleActive]:_==="drag"?"pointer":W?"keyboard":void 0,[dt.resizeHandleEnabled]:!n,[dt.resizeHandleId]:P,[dt.resizeHandleState]:_})}kM.displayName="PanelResizeHandle";function Lee({className:e,...t}){return(0,m.jsx)(IM,{"data-slot":"resizable-panel-group",className:he("flex h-full w-full data-[panel-group-direction=vertical]:flex-col",e),...t})}var Cg=p.forwardRef((e,t)=>(0,m.jsx)(kv,{ref:t,"data-slot":"resizable-panel",...e}));Cg.displayName=kv.displayName;function _ee({withHandle:e,className:t,...n}){return(0,m.jsx)(kM,{"data-slot":"resizable-handle",className:he("bg-border focus-visible:ring-ring relative flex w-px items-center justify-center after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:ring-1 focus-visible:ring-offset-1 focus-visible:outline-hidden data-[panel-group-direction=vertical]:h-px data-[panel-group-direction=vertical]:w-full data-[panel-group-direction=vertical]:after:left-0 data-[panel-group-direction=vertical]:after:h-1 data-[panel-group-direction=vertical]:after:w-full data-[panel-group-direction=vertical]:after:translate-x-0 data-[panel-group-direction=vertical]:after:-translate-y-1/2 [&[data-panel-group-direction=vertical]>div]:rotate-90",t),...n,children:e&&(0,m.jsx)("div",{className:"bg-border z-10 flex h-4 w-3 items-center justify-center rounded-xs border",children:(0,m.jsx)(xH,{className:"size-2.5"})})})}function Wd(e){return Array.isArray(e)?e.map(t=>{if(!t||typeof t!="object")return null;const n=t;return n.type!=="text"||typeof n.text!="string"?null:n.text.trim()?n.text:null}).filter(t=>!!t):[]}function Fee(e){try{const t=JSON.parse(e);if(Array.isArray(t)||t&&typeof t=="object"&&!Array.isArray(t))return t}catch{}return null}function Hee(e){if(typeof e!="string")return null;const t=e.trim();return t||null}function jee(e){return!Array.isArray(e.content)||e.content.length>0||e.structuredContent!==void 0?!1:Object.keys(e).every(t=>["content","_meta","meta","isError"].includes(t))}function ba(e){if(e==null)return null;if(Array.isArray(e))return{kind:"json",value:e};if(typeof e=="string"){const t=Hee(e)?Fee(e.trim()):null;return t?{kind:"json",value:t}:{kind:"text",text:e}}return typeof e=="number"||typeof e=="boolean"?{kind:"text",text:String(e)}:typeof e!="object"?null:{kind:"json",value:e}}function hle(e){if(e==null)return null;if(typeof e!="object"||Array.isArray(e))return ba(e);const t=e;if(jee(t))return null;if(typeof t.text=="string")return ba(t.text);const n=Wd(t.content);if(n.length>0)return ba(n.join(`
|
|
79
|
+
|
|
80
|
+
`));const r=Wd((t.value&&typeof t.value=="object"?t.value:null)?.content);return r.length>0?ba(r.join(`
|
|
81
|
+
|
|
82
|
+
`)):ba(t)}function RB(e){if(!e)return null;if(typeof e=="string")return e.trim()||null;if(typeof e!="object")return null;const t=e;if(typeof t.text=="string"&&t.text.trim())return t.text.trim();const n=Wd(t.content);if(n.length>0)return n.join(`
|
|
83
|
+
|
|
84
|
+
`);const r=Wd((t.value&&typeof t.value=="object"?t.value:null)?.content);return r.length>0?r.join(`
|
|
85
|
+
|
|
86
|
+
`):null}function Gee({className:e,children:t,...n}){return(0,m.jsxs)(Q2,{"data-slot":"scroll-area",className:he("relative",e),...n,children:[(0,m.jsx)(Y2,{"data-slot":"scroll-area-viewport",className:"focus-visible:ring-ring/50 size-full rounded-[inherit] transition-[color,box-shadow] outline-none focus-visible:ring-[3px] focus-visible:outline-1",children:t}),(0,m.jsx)(Vee,{}),(0,m.jsx)(X2,{})]})}function Vee({className:e,orientation:t="vertical",...n}){return(0,m.jsx)(H2,{"data-slot":"scroll-area-scrollbar",orientation:t,className:he("flex touch-none p-px transition-colors select-none",t==="vertical"&&"h-full w-2.5 border-l border-l-transparent",t==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent",e),...n,children:(0,m.jsx)($2,{"data-slot":"scroll-area-thumb",className:"bg-border relative flex-1 rounded-full"})})}var Uee=["listSkills","loadSkill","listSkillFiles","readSkillFile"],zee=new Set(Uee);function fle(e){return zee.has(e)}var Ble=w({toolCallOrder:V(["ignore","strict","superset"]).optional(),maxExtraToolCalls:Hn([M().refine(e=>Number.isInteger(e)&&e>=0,"maxExtraToolCalls must be a non-negative integer or null"),Ql()]).optional(),allowExtraToolCalls:oe().optional(),argumentMatching:V(["exact","partial","ignore"]).optional()}).strict();function ple(e,t,n){const r=EA(e,t,{isNegativeTest:n});return{missing:r.missing,unexpected:r.extra,argumentMismatches:r.argumentMismatches,passed:r.passed}}function XE(e){return e?e.maxExtraToolCalls!==void 0?e.maxExtraToolCalls:e.allowExtraToolCalls===!1?0:null:null}function mle(e,t,n){const r=Sq(e??[],n),s=t?.list??[];let i;if(!t)i=r;else switch(t.mode){case"inherit":i=r;break;case"replace":i=s;break;case"extend":i=[...r,...s];break;default:i=r}return i.length>0?i:void 0}function $ee(e){const t=e.infraError;return!!t&&typeof t=="object"&&typeof t.class=="string"}function Wee(e,t){return e.resultSource==="reported"&&(e.result==="pending"||e.result==="passed"||e.result==="failed"||e.result==="cancelled"||e.result==="timed_out")?e.result:e.status==="pending"||e.status==="running"?"pending":e.status==="cancelled"?"cancelled":e.status==="timed_out"?"timed_out":e.status==="setup_failed"?"setup_failed":e.status==="skipped"?"skipped":qee(e,t)?"passed":"failed"}function RM(e,t){return $ee(e)?"infra_error":Wee(e,t)}function qee(e,t){if(e.result==="passed"||e.result==="failed")return e.result==="passed";if(e.resultSource==="reported")return!1;const n=e.actualToolCalls||[],r=e.testCaseSnapshot?.expectedToolCalls||[],s=e.testCaseSnapshot?.isNegativeTest,i=e.testCaseSnapshot?.matchOptions,o=EA(r,n,{...i,isNegativeTest:s});if(s)return o.passed;if(r.length===0&&n.length>0){const u=XE(i);return u===null||o.extra.length<=u}const a=t?.allowUnexpectedTools?[]:o.missing,l=t?.ignoreArgumentMismatches?[]:o.argumentMismatches;if(a.length>0||l.length>0||o.outOfOrder.length>0)return!1;const c=XE(i);return!(c!==null&&o.extra.length>c)}function gle(e){return e?.length?[...e]:void 0}function Cle(e,t){const n=(r,s)=>r?.length?r.map(i=>{const o=i.name??i.id,a=s?.find(l=>l.id===i.id);return a&&JSON.stringify(a)!==JSON.stringify(i)?`${o} (edited)`:o}).join(", "):"None";return{label:"Code evaluators",before:n(e),after:n(t,e)}}var Xh=[{key:"runSetup",title:"Before the run",note:"Runs once, before the first iteration."},{key:"iterationSetup",title:"Before each iteration",note:"Runs before the agent starts. If it fails, the iteration is left out of the pass rate."},{key:"iterationCleanup",title:"After each iteration",note:"Runs after grading. If it fails, the iteration shows a warning."},{key:"runCleanup",title:"After the run",note:"Runs once, after the last iteration."}];function vle(e){return Xh.find(t=>t.key===e)?.title??e}function OM(e){const t={};for(const{key:n}of Xh){const r=e(n);r&&(t[n]=r)}return Object.keys(t).length?t:void 0}function MM(e){return OM(t=>{const n=e?.[t];return n?.trim()?n:void 0})}function yle(e,t,n){return OM(r=>r===t?n:e?.[r])}function Kee(e){return MM(e)!==void 0}function Ov(e,t){if(!(!e?.length&&!t))return{...e?.length?{files:e}:{},...t?{network:"web"}:{}}}function Mv(e){return Ov((e?.files??[]).map(t=>t.trim()).filter(Boolean),e?.network==="web")}function ble(e,t){return Ov(t?t.split(`
|
|
87
|
+
`):void 0,e?.network==="web")}function Sle(e,t){return Ov(e?.files,t)}function Ele(e){return Mv(e)!==void 0}function xle(e){return{scripts:MM(e.scripts),grading:Mv(e.grading)}}function NM(e){return new TextEncoder().encode(e).length}function qd(e){return`${Math.ceil(e/1024)} KB`}function wle(e){const t=e?NM(e):0;return t>65536?`This script is ${qd(t)}. A script can be at most ${qd(Wp)}.`:void 0}function Dle(e,t){const n=[...Xh.map(({key:r})=>e?.[r]??""),...(t??[]).map(r=>r.script??"")].reduce((r,s)=>r+NM(s),0);return n>262144?`Scripts and code evaluators can total at most ${qd(lI)}. These total ${qd(n)}.`:void 0}function Tle(e){const t=(e??[]).map(r=>r.trim()).filter(Boolean),n=t.flatMap(r=>{const s=uI(r),i=r.length>60?`${r.slice(0,60)}…`:r;return s?[`${i} ${s}.`]:[]});return t.length>20?[`Copy at most 20 paths. This list has ${t.length}.`,...n]:n}function ZE(e,t){const n=Xh.filter(({key:r})=>e?.[r]).map(({key:r,title:s})=>t?.[r]&&t[r]!==e?.[r]?`${s} (edited)`:s);return n.length?n.join(", "):"None"}function ex(e,t){const n=e?.files??[],r=t!==void 0&&n.length>0&&n.length===(t.files?.length??0)&&n.join(`
|
|
88
|
+
`)!==t.files?.join(`
|
|
89
|
+
`),s=[...n.length?[`${n.length} file${n.length===1?"":"s"}${r?" (edited)":""}`]:[],...e?.network==="web"?["web access"]:[]];if(!s.length)return"None";const i=s.join(", ");return i.charAt(0).toUpperCase()+i.slice(1)}function Ale(e,t,n){if(e==="scripts"){const s=t.scripts??void 0;return{label:"Setup and cleanup",before:ZE(s),after:ZE(n.scripts??void 0,s)}}const r=t.grading??void 0;return{label:"Grading",before:ex(r),after:ex(n.grading??void 0,r)}}function Jee(e){return[...Kee(e?.scripts)?["setup and cleanup scripts"]:[],...PM(e)?["Required code evaluators"]:[]]}function Qee(e){const t=e?.scripts;return[...t?.iterationSetup?.trim()||t?.iterationCleanup?.trim()?["iteration setup and cleanup scripts"]:[],...Mv(e?.grading)?.files?["files to copy for grading"]:[],...PM(e)?["Required code evaluators"]:[]]}function PM(e){return(e?.codeEvaluators??[]).some(t=>t.role==="required")}function tx(e){return e.length<2?e[0]??"":`${e.slice(0,-1).join(", ")} and ${e[e.length-1]}`}function Nv(e){if(e.environmentTargets?.length)return Array.from(new Set(e.environmentTargets.flatMap(r=>r.serverNames)));if(e.serverAttachment)return Array.from(new Set(e.serverAttachment.resolvedServerNames??[]));const t=e.environment?.servers??[],n=e.hostAttachments?.flatMap(r=>r.resolvedServerNames??[])??[];return n.length===0?t:Array.from(new Set([...t,...n]))}function LM(e){return{namedHostId:void 0,hostName:null,serverIds:e}}function _M(e,t,n=!0){return{namedHostId:e.namedHostId,hostName:e.hostName??"host",serverIds:n&&e.resolvedServerNames.length>0?e.resolvedServerNames:t}}function Yee(e,t=Nv(e)){const n=t,r=e.hostAttachments??[],s=!e.serverAttachment;return r.length===0?[LM(n)]:r.map(i=>_M(i,n,s))}function Xee(e,t,n){const r=e.environmentIds??[];return r.length>0?r.map(s=>({namedHostId:void 0,hostName:null,serverIds:[],environmentId:s,environmentName:t?.find(i=>i.environmentId===s)?.name??s})):Yee(e,n)}function Ile(e,t,n){return Xee(e,t,n).length}function kle(e,t){const n=Nv(e),r=t?e.hostAttachments?.find(s=>s.namedHostId===t):null;return r?_M(r,n,!e.serverAttachment):LM(n)}function Rle(e){return e?new Date(e).toLocaleString():"—"}function Ole(e){return e.updatedAt??e.startedAt??e.createdAt??0}function Zee(e){if(e<1e3)return`${e}ms`;const t=Math.round(e/1e3);if(t<60)return`${t}s`;const n=Math.floor(t/60),r=t%60;if(n<60)return r?`${n}m ${r}s`:`${n}m`;const s=Math.floor(n/60),i=n%60;return i?`${s}h ${i}m`:`${s}h`}function ete(e){return e.substring(0,8)}function bc(e){return e.configSnapshot?.environmentRef??null}function Zh(e,t){const n=e.client,r=n?.namedHostId??e.namedHostId;if(n){const s=n.hostStyle?.trim();return{name:(n.versionId?n.name.trim():r&&t?.get(r)?.trim())||(n.source==="suite_default"&&Sx(s)?zN(s):n.name.trim())||"Client",hostStyle:s,namedHostId:r,source:n.source,key:r?`host:${r}`:n.source==="sdk"?"sdk":`style:${s||"unknown"}`}}return r?{name:t?.get(r)?.trim()||ete(r),namedHostId:r,key:`host:${r}`,source:"unknown"}:{name:"Suite default",key:"style:unknown",source:"unknown"}}function Mle(e,t){const n=Zh(e).hostStyle;return n&&Sx(n)?LN(n,void 0,t):void 0}function Nle(e){return Array.isArray(e.models)?e.models.filter(t=>!!t.model):e.model?[{model:e.model,provider:e.provider??""}]:[]}function tte(e){const t=bc(e);return t?`environment:${t.environmentId}`:Zh(e).key}function nte(e,t){return!e.client&&!e.namedHostId?null:Zh(e,t).name}function Ple(e,t){const n=bc(e);return n?n.name:nte(e,t)??Zh(e,t).name}function Lle(e){const t=bc(e);return t?`rev ${t.revision}`:null}function _le(e,t){const n=new Map,r=new Map((t??[]).map(s=>[s.hostId,s]));for(const s of t??[])n.set(s.hostId,cb(s));for(const s of e??[]){const i=r.get(s.namedHostId),o=i!==void 0&&s.hostName?.trim().toLowerCase()===i.name.trim().toLowerCase();n.set(s.namedHostId,i&&(s.hostName===null||o)?cb(i):s.hostName??n.get(s.namedHostId)??null)}return n}function Fle(e){const t=new Set,n=[];for(const r of e){const s=tte(r);t.has(s)||(t.add(s),n.push(s))}return n}function Hle(e){return e.some(t=>bc(t)!==null)}function jle(e){const t=e.map(s=>bc(s)?.revision).filter(s=>typeof s=="number");if(t.length===0)return null;const n=Math.min(...t),r=Math.max(...t);return n===r?`rev ${n}`:`rev ${n}–${r}`}function Gle(e){if(e?.code!=="ENVIRONMENT_REVISION_CONFLICT")return null;const t=e instanceof Error?e.message:null;return t&&t.length>0?t:"Environment changed since the suite was configured — retry the run."}function rte(e){const t={runs:e.length,passed:0,failed:0,cancelled:0,pending:0,tokens:0,avgDuration:null};let n=0,r=0;return e.forEach(s=>{s.result==="passed"?t.passed+=1:s.result==="failed"?t.failed+=1:s.result==="cancelled"?t.cancelled+=1:s.status==="timed_out"?t.failed+=1:t.pending+=1,t.tokens+=s.tokensUsed||0;const i=s.startedAt??s.createdAt,o=s.updatedAt??s.createdAt;if(i&&o){const a=Math.max(o-i,0);n+=a,r+=1}}),r>0&&(t.avgDuration=n/r),t}function Vle(e){return e.testTemplateKey?e.testTemplateKey:e._id?`fallback:${e._id}`:`fallback:${e.title}-${e.query}`}function ste(e){return e?.rerunScope==="failed_cases"}function Ule(e){switch(e){case Nn.PASSED:return"border-l-success/50";case Nn.FAILED:return"border-l-destructive/50";case Nn.PENDING:case"running":case"grading":return"border-l-warning/50";case Nn.CANCELLED:return"border-l-muted";case"mixed":case"inconclusive":return"border-l-warning/50";default:return"border-l-muted-foreground/50"}}function ite(e,t){return(e?.source??t)==="sdk"?"sdk":"ui"}function zle(e,t){let n=null,r=-1;for(const s of e){const i=s.completedAt??s.createdAt??0;i>r&&(n=s,r=i)}return ite(n,t)}function $le(e){if(!e)return"No runs yet";const t=Date.now()-e,n=Math.floor(t/6e4);if(n<1)return"Just now";if(n<60)return`${n}m ago`;const r=Math.floor(n/60);if(r<24)return`${r}h ago`;const s=Math.floor(r/24);return s<7?`${s}d ago`:new Date(e).toLocaleDateString()}function Ko(e,t){if(!Array.isArray(e)||e.length===0)return null;const n=[...e].sort((a,l)=>a-l);if(t<=0)return n[0];if(t>=1)return n[n.length-1];const r=(n.length-1)*t,s=Math.floor(r),i=Math.ceil(r);if(s===i)return n[s];const o=r-s;return n[s]*(1-o)+n[i]*o}function FM(e){const t=e.startedAt,n=e.updatedAt;return typeof t!="number"||typeof n!="number"||n<t?null:n-t}function HM(e){return Ko(e.filter(t=>t.status==="completed").map(FM).filter(t=>t!==null),.5)}function jM(e){return Ko(e.filter(t=>t.status==="completed").map(FM).filter(t=>t!==null),.95)}function Wle(e,t){return e.runNumber-t.runNumber||e.createdAt-t.createdAt}function qle(e){const t=e.filter(n=>n.status==="completed"&&!ste(n));return t.length===0?null:t.reduce((n,r)=>r.runNumber>n.runNumber?r:n)}function Kle(e,t){return e.environment?.computerEnvironmentId?!0:(e.environmentIds??[]).some(n=>!!(t??[]).find(r=>r.environmentId===n)?.computerEnvironmentId)}function Jle(e,t,n){const r=n.ephemeralCloudAvailable===!1?Jee(t):[];if(r.length>0)return{rule:"runner_without_sandboxes",message:`This ${e} has ${tx(r)}, but this inspector can't run MCPJam cloud sandboxes. Run it on MCPJam instead.`};const s=n.localRun?Qee(t):[];return s.length>0?{rule:"local_run",message:`This ${e} has ${tx(s)}, which can't run while its agent runs on this machine. Run it on MCPJam instead.`}:null}var nx=1e-4;function ote(e){const t=e<0?"-":"",n=Math.abs(e);if(n>0&&n<nx){const r=`$${nx.toFixed(4)}`;return t==="-"?`>-${r}`:`<${r}`}return n>0&&n<.01?`${t}$${n.toFixed(4)}`:`${t}$${n.toFixed(2)}`}function Qle(e){return typeof e=="number"?ote(e):"—"}function Yle(e){return e.length?e.reduce((t,n)=>t+n,0)/e.length:null}function Xle(e){const t=(n,r)=>`${(e/n).toFixed(1).replace(/\.0$/,"")}${r}`;return e>=1e9?t(1e9,"b"):e>=1e6?t(1e6,"m"):e>=1e3?t(1e3,"k"):Number.isInteger(e)?e.toLocaleString():e.toFixed(1)}function Zle(e,t){if(e?.source==="sdk_runner")return"Reported by your runner — MCPJam did not price this run.";if(typeof t=="number"||e?.status==="estimated")return null;switch(e?.reason){case"no_pricing":return"Not an MCPJam-billed model, so there is no cost to report.";case"harness_mixed_models":return"Harness runs mix models within a turn; their cost arrives with billed attribution.";case"no_tokens":return"This iteration reported no token usage.";default:return"No cost was recorded for this iteration."}}function ate(e){return e?.source==="sdk_runner"}function lte(e){let t=null,n=0,r=!1;for(const s of e){const i=s.usage?.estimatedCostUsd;typeof i=="number"&&(t=(t??0)+i,n+=1,ate(s.usage?.costBasis)&&(r=!0))}return{totalUsd:t,costedIterations:n,totalIterations:e.length,hasRunnerReported:r}}function ece(e){return e.map(t=>t.usage?.estimatedCostUsd).filter(t=>typeof t=="number")}function cte(e){return e.status==="pending"||e.status==="running"||e.status==="grading"}function tce(e){return e.filter(cte).map(t=>t._id)}function Pv(e){return!e.environmentIds?.length||!e.environmentTargets?null:e.environmentTargets.filter(t=>!t.unavailable)}function nce(e){if(e.source==="sdk"&&!e.environmentIds?.length)return!0;if(e.environmentIds?.length){const t=Pv(e);return t===null||t.some(n=>n.serverNames.length>0||n.pluginVersionCount>0)}return Nv(e).length>0}function Lv(e,t){if(!e.environmentIds?.length)return{kind:"legacy"};const n=Pv(e);if(!n)return{kind:"none",reason:"This suite's environments are still loading, or this deployment can't describe them yet."};const r=n.filter(o=>o.serverNames.length>0||o.pluginVersionCount>0);if(r.length===0)return{kind:"none",reason:"None of this suite's environments has servers. Pick a server group in suite settings."};const s=t?r.find(o=>o.environmentId===t):void 0;if(s)return{kind:"environment",environmentId:s.environmentId};const i=r.every(o=>o.pluginVersionCount===0)&&new Set(r.map(o=>o.serverAttachmentId??"")).size===1;return r.length===1||i?{kind:"environment",environmentId:r[0].environmentId}:{kind:"choose",targets:r}}function rce(e){const t=Lv(e);return t.kind==="choose"?t.targets:null}function sce(e,t){const n=Lv(e,t);return n.kind==="environment"?n.environmentId:void 0}function mu(e){return e.name?.trim()?e.name.trim():[e.hostName??"Client",e.modelId].filter(Boolean).join(" · ")}function ice(e){const t=e.pluginVersionCount>0?`${e.pluginVersionCount} plugin${e.pluginVersionCount===1?"":"s"}`:"";return[e.serverNames.join(", "),t].filter(Boolean).join(" + ")||"No servers"}function oce(e,t,n){const r=t?.trim();if(!e.environmentIds?.length)return r?{error:"it does not run environments. Omit 'environment'."}:{};const s=Pv(e)??[],i=s.map(mu).join(", ");let o=n;if(r){const l=r.toLowerCase(),c=s.filter(h=>mu(h).toLowerCase()===l),u=s.find(h=>h.environmentId===r);if(!u&&c.length>1)return{error:`more than one of its environments is named "${r}". Name one by ID: ${c.map(h=>h.environmentId).join(", ")}.`};const d=u??c[0];if(!d)return{error:`it has no environment "${r}". Its environments: ${i||"none"}.`};if(d.serverNames.length===0&&d.pluginVersionCount===0)return{error:`its environment "${mu(d)}" has no servers. Pick a server group for it in suite settings.`};o=d.environmentId}const a=Lv(e,o);return a.kind==="environment"?{environmentId:a.environmentId}:a.kind==="choose"?{error:`its environments connect different servers. Name the one to generate for with 'environment': ${a.targets.map(mu).join(", ")}.`}:a.kind==="none"?{error:a.reason}:{}}var ute=new Set(["pending","running","grading"]);function dte(e){return ute.has(e.status)}function hte(e){return dte(e)||!e.metrics?!0:e.metrics.results.unscored>0}function fte(e){const t=e.startedAt,n=e.updatedAt;return typeof t!="number"||typeof n!="number"||n<t?null:n-t}function Bte(e){const t=e.execution?.effectiveSettings?.reasoningEffort;if(typeof t!="string")return;const n=t.trim();return n.length>0?n:void 0}function pte(e,t){return`${e}::${t??"default"}`}function mte(e){const t={passed:0,failed:0,timedOut:0,cancelled:0,pending:0,setupFailed:0,skipped:0,unscored:0,infraError:0},n=[];let r=0,s=0,i=0,o=0,a=0,l=0,c=!1;const u=new Map;for(const f of e){const B=RM(f),g=B==="timed_out"?"timedOut":B==="setup_failed"?"setupFailed":B==="infra_error"?"infraError":B;if(t[g]+=1,f.status==="completed"){const y=fte(f);y!==null&&n.push(y)}typeof f.tokensUsed=="number"&&Number.isFinite(f.tokensUsed)&&(r+=f.tokensUsed,s+=1),f.actualToolCalls&&(i+=f.actualToolCalls.length,o+=1);const C=f.usage?.estimatedCostUsd;typeof C=="number"&&(a+=C,l+=1,f.usage?.costBasis?.source==="sdk_runner"&&(c=!0));const v=f.testCaseSnapshot?.model?.trim();if(v){const y=Bte(f),S=pte(v,y),E=u.get(S)??{model:v,total:0,passed:0,failed:0,timedOut:0,...y?{reasoningEffort:y}:{}};E.total+=1,B==="passed"?E.passed+=1:B==="failed"?E.failed+=1:B==="timed_out"&&(E.timedOut+=1),typeof C=="number"&&(E.costUsd=(E.costUsd??0)+C,E.costedIterations=(E.costedIterations??0)+1);const D=f.usage?.reasoningTokens;typeof D=="number"&&Number.isFinite(D)&&(E.reasoningTokens=(E.reasoningTokens??0)+D),u.set(S,E)}}const d=HM([...e]),h=jM([...e]);return{version:1,iterationCount:e.length,results:t,completedCount:n.length,...d!==null?{latencyP50Ms:d}:{},...h!==null?{latencyP95Ms:h}:{},...s>0?{tokensTotal:r}:{},tokensMeasuredIterations:s,...o>0?{toolCallsTotal:i}:{},toolCallsMeasuredIterations:o,...l>0?{costUsd:a}:{},costedIterations:l,hasRunnerReportedCost:c,models:[...u.values()],durationsMs:n}}function ace(e,t){return!hte(e)&&e.metrics?e.metrics:t?mte(t):e.metrics??null}function lce(e,t){const n=t?.results.passed??0,r=n+(t?.results.failed??0),s=r>0?n:e.summary?.passed??0,i=r>0?r:e.summary?.total??0;return{effectivePassed:s,effectiveTotal:i,passRate:i>0?Math.round(s/i*100):null}}function gte(e){const t=e.filter(n=>n!=null&&n.completedCount>0);if(t.length===0)return{latencyP50:null,latencyP95:null};if(t.every(n=>n.durationsMs)){const n=t.flatMap(r=>r.durationsMs??[]);return{latencyP50:Ko(n,.5),latencyP95:Ko(n,.95)}}return{latencyP50:rx(t,"latencyP50Ms",.5),latencyP95:rx(t,"latencyP95Ms",.95)}}function rx(e,t,n){const r=e.map(o=>({value:o[t],weight:o.completedCount})).filter(o=>typeof o.value=="number"&&o.weight>0).sort((o,a)=>o.value-a.value);if(r.length===0)return null;const s=r.reduce((o,a)=>o+a.weight,0)*n;let i=0;for(const o of r)if(i+=o.weight,i>=s)return o.value;return r[r.length-1].value}function Cte(e){return e==="passed"?100:e==="partial"?50:0}function vte(e){const t=e.total!=null&&e.total>0,n=t?e.passed??0:e.result==="passed"?1:0,r=t?e.failed??0:e.result==="failed"?1:0,s=t?e.total??1:1;return{passRate:t?Math.round(n/s*100):Cte(e.result),passed:n,total:s,failed:r,latencyP50:e.latencyMs,latencyP95:e.latencyP95Ms??e.latencyMs,tokens:e.tokens??0,toolCalls:e.toolCalls??0,costUsd:null,costedIterations:0,hasRunnerReportedCost:!1}}function yte(e){const t=e.map(r=>r.latencyMs).filter(r=>r!=null),n=e.map(r=>r.latencyP95Ms??r.latencyMs).filter(r=>r!=null);return{latencyP50:Ko(t,.5),latencyP95:Ko(n,.95)}}function cce(e){if(e.length===0)return null;const t=e.map(vte),n=la(t);if(!n)return null;const{latencyP50:r,latencyP95:s}=yte(e);let i=0,o=0,a=0;for(const l of t)i+=l.passed,o+=l.failed,a+=l.total;return{...n,latest:{...n.latest,passed:i,failed:o,total:a,passRate:a>0?Math.round(i/a*100):n.latest.passRate,latencyP50:r,latencyP95:s},runLabels:e.map(l=>`Run ${l.runLabel}`)}}function uce(e){return e>=1e6?`${(e/1e6).toFixed(1).replace(/\.0$/,"")}M`:e>=1e3?`${(e/1e3).toFixed(1).replace(/\.0$/,"")}k`:Number.isInteger(e)?String(e):e.toFixed(1).replace(/\.0$/,"")}function bte(e){return e>=1e3?`${(e/1e3).toFixed(e>=1e4?1:2)}s`:`${Math.round(e)}ms`}function Ste(e){return e.actualToolCalls?.length??0}function Ete(e){return e.reduce((t,n)=>t+Ste(n),0)}function xte(e){return e.length===0?0:e.reduce((t,n)=>t+(n.tokensUsed||0),0)/e.length}function wte(e){let t=0,n=0,r=0;for(const s of e){const i=RM(s);i!=="infra_error"&&(t+=1,i==="passed"?n+=1:i==="failed"&&(r+=1))}return{passed:n,failed:r,total:t}}function _v(e,t){const{passed:n,failed:r,total:s}=t??wte(e);return{passRate:s>0?Math.round(n/s*100):0,passed:n,total:s,failed:r,latencyP50:HM(e),latencyP95:jM(e),tokens:xte(e),toolCalls:Ete(e),...(()=>{const{totalUsd:i,costedIterations:o,hasRunnerReported:a}=lte(e);return{costUsd:i,costedIterations:o,hasRunnerReportedCost:a}})()}}function la(e){if(e.length===0)return null;const t=e[e.length-1],n=e.length>=2?e[e.length-2]:null;return{latest:t,series:e,delta:n?t.passRate-n.passRate:null,showTrend:e.length>=2}}function ef(e){return e.filter(t=>t.result!=="inconclusive")}function dce(e,t,n){const r=ef(e);if(r.length===0)return null;const s=new Map;for(const c of t){if(!c.suiteRunId)continue;const u=s.get(c.suiteRunId);u?u.push(c):s.set(c.suiteRunId,[c])}const i=[...r].sort((c,u)=>c.createdAt-u.createdAt),o=[],a=[];for(const c of i){const u=s.get(c._id);if(!u||u.length===0)continue;const d=n?n(c):c.runNumber?`#${c.runNumber}`:`Run ${c._id.slice(0,8)}`;a.push(`${d} · ${new Date(c.createdAt).toLocaleString()}`);const h=rte(u),f=c.summary?.total??h.runs,B=c.summary?.passed??h.passed,g=c.summary?.failed??h.failed;o.push(_v(u,{total:f,passed:B,failed:g}))}const l=la(o);return l?{...l,runLabels:a}:null}function hce(e,t){const n=ef(e);if(n.length===0)return null;const r=new Set(n.map(c=>c._id)),s=t.filter(c=>c.suiteRunId&&r.has(c.suiteRunId));if(s.length===0)return null;let i=0,o=0,a=0,l=!0;for(const c of n)c.summary?(i+=c.summary.total,o+=c.summary.passed,a+=c.summary.failed):l=!1;return la([_v(s,l?{total:i,passed:o,failed:a}:void 0)])}function GM(e,t){let n=0,r=0,s=0,i=0,o=0,a=null,l=0,c=!1;for(const g of e)n+=g.iterationCount,r+=g.results.passed,s+=g.results.failed,i+=g.tokensTotal??0,o+=g.toolCallsTotal??0,g.costUsd!==void 0&&(a=(a??0)+g.costUsd),l+=g.costedIterations,g.hasRunnerReportedCost&&(c=!0);const{passed:u,failed:d,total:h}=t??{passed:r,failed:s,total:n},{latencyP50:f,latencyP95:B}=gte(e);return{passRate:h>0?Math.round(u/h*100):0,passed:u,total:h,failed:d,latencyP50:f,latencyP95:B,tokens:n>0?i/n:0,toolCalls:o,costUsd:a,costedIterations:l,hasRunnerReportedCost:c}}function fce(e,t,n){const r=ef(e);if(r.length===0)return null;const s=[...r].sort((l,c)=>l.createdAt-c.createdAt),i=[],o=[];for(const l of s){const c=t.get(l._id);if(!c||c.iterationCount===0)continue;const u=n?n(l):l.runNumber?`#${l.runNumber}`:`Run ${l._id.slice(0,8)}`;o.push(`${u} · ${new Date(l.createdAt).toLocaleString()}`),i.push(GM([c],{total:l.summary?.total??c.iterationCount,passed:l.summary?.passed??c.results.passed,failed:l.summary?.failed??c.results.failed+c.results.timedOut}))}const a=la(i);return a?{...a,runLabels:o}:null}function Bce(e,t){const n=ef(e);if(n.length===0)return null;const r=n.map(l=>t.get(l._id)).filter(l=>l!=null&&l.iterationCount>0);if(r.length===0)return null;let s=0,i=0,o=0,a=!0;for(const l of n)l.summary?(s+=l.summary.total,i+=l.summary.passed,o+=l.summary.failed):a=!1;return la([GM(r,a?{total:s,passed:i,failed:o}:void 0)])}function pce(e){return e.length===0?null:la([...e].reverse().map(t=>_v(t.iterations)))}function Kd(e){return e.kind==="xaa"&&e.xaaSubject?.trim()||e.name}function mce(e){const t=new Set;for(const n of e)for(const r of n.accountsAtRun??[])if(t.add(`${r.serverId}\0${Kd(r)}`),t.size>1)return!0;return!1}function gce(e){const t=[];for(const n of e){const r=Kd(n),s=t.find(i=>i.serverId===n.serverId);s?s.names.includes(r)||s.names.push(r):t.push({serverId:n.serverId,names:[r]})}return t}function VM(e,t){if(e.category!=="tool"||!t?.length)return;if(e.connectionId){const r=t.find(s=>s.connectionId===e.connectionId);return r?Kd(r):void 0}const n=e.serverId?t.filter(r=>r.serverId===e.serverId):[];return n.length===1?Kd(n[0]):void 0}function Dte(e,t){const n=new Map;for(const r of e??[]){const s=r.toolCallId?VM(r,t):void 0;r.toolCallId&&s&&n.set(r.toolCallId,s)}return n}var Tte=["opened","selected","shown","hidden","closed","call-started","call-completed","call-denied","call-unknown","call-suspended","call-continued","cancel-requested"],Ate=["model-tool","app-tool","preview-tool","entrypoint","global-entrypoint","thread-entrypoint","settings-entrypoint","quick-action","file-entrypoint","settings-read","settings-update","settings-action","mention-search","model-context","context-removal","file-open","file-read","file-write","file-subscribe","file-unsubscribe","form-mrtr","form-legacy","resource-preview","app-preview","deep-link","message","message-prepare","app-display"],Ite=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,Sa=(e,t=0)=>Number.isSafeInteger(e)&&e>=t;function gu(e,t){return!!e&&typeof e=="object"&&!Array.isArray(e)&&Object.keys(e).every(n=>t.includes(n))}var Cu=e=>typeof e=="string"&&Ite.test(e);function Fv(e){if(!gu(e,["version","runtime","sequence","droppedEvents","activeInstanceId","instances","events"])||e.version!==1&&e.version!==2||!["chatgpt","codex"].includes(e.runtime)||!Sa(e.sequence)||!Sa(e.droppedEvents)||e.droppedEvents>e.sequence||!Array.isArray(e.instances)||e.instances.length>64||!Array.isArray(e.events)||e.events.length>128)throw new Error("PLUGIN_RECORDING_INVALID");const t=new Set;for(const r of e.instances){if(!gu(r,["instanceId","generation","visible"])||!Cu(r.instanceId)||t.has(r.instanceId)||!Sa(r.generation,1)||typeof r.visible!="boolean")throw new Error("PLUGIN_RECORDING_INVALID");t.add(r.instanceId)}if(e.activeInstanceId!==void 0&&(!Cu(e.activeInstanceId)||!e.instances.some(r=>r.instanceId===e.activeInstanceId&&r.visible)))throw new Error("PLUGIN_RECORDING_INVALID");let n=e.droppedEvents;for(const r of e.events){if(!gu(r,["sequence","kind","instanceId","generation","operationId",...e.version===2?["feature","fidelity","outcome","display"]:[]])||!Sa(r.sequence,1)||r.sequence!==n+1||r.sequence>e.sequence||!Tte.includes(r.kind)||!Cu(r.instanceId)||!Sa(r.generation,1))throw new Error("PLUGIN_RECORDING_INVALID");const s=r.kind.startsWith("call-")||r.kind==="cancel-requested";if(s?!Cu(r.operationId):r.operationId!==void 0)throw new Error("PLUGIN_RECORDING_INVALID");if(r.feature===void 0!=(r.fidelity===void 0)||r.feature!==void 0&&(!s||!Ate.includes(r.feature)||!["observed","assumed","degraded"].includes(r.fidelity)))throw new Error("PLUGIN_RECORDING_INVALID");if(r.outcome!==void 0&&(r.feature!=="file-write"||r.kind!=="call-completed"||!["saved","conflict","too-large"].includes(r.outcome)))throw new Error("PLUGIN_RECORDING_INVALID");if(r.display!==void 0){const i=r.display;if(r.feature!=="app-display"||r.kind!=="call-completed"||!gu(i,["availableDisplayModes","displayMode","interactionCursor"])||!Array.isArray(i.availableDisplayModes)||i.availableDisplayModes.length>2||new Set(i.availableDisplayModes).size!==i.availableDisplayModes.length||!i.availableDisplayModes.every(o=>o==="inline"||o==="fullscreen")||(i.availableDisplayModes.length===0?i.displayMode!==void 0:!i.availableDisplayModes.includes(i.displayMode))||!["pointer","default"].includes(i.interactionCursor))throw new Error("PLUGIN_RECORDING_INVALID")}n=r.sequence}if(n!==e.sequence)throw new Error("PLUGIN_RECORDING_INVALID");return JSON.parse(JSON.stringify(e))}function UM(e){if(e.length>Math.ceil(1048576/3)*4||!/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(e))throw new Error("PLUGIN_REPLAY_IMAGE_INVALID");const t=atob(e);if(t.length>1048576)throw new Error("PLUGIN_REPLAY_IMAGE_INVALID");const n=t.startsWith(`PNG\r
|
|
90
|
+
|
|
91
|
+
`),r=t.startsWith("ÿØÿ");if(!n&&!r)throw new Error("PLUGIN_REPLAY_IMAGE_INVALID");return`data:image/${n?"png":"jpeg"};base64,${e}`}function kte(e,t){e!==void 0&&Fv(e);const n=t?UM(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 sx({recording:e,screenshotBase64:t}){let n;try{n=kte(e,t)}catch{return(0,m.jsx)("p",{role:"status",className:"text-xs text-muted-foreground",children:"Unsupported workspace capture."})}return(0,m.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 Rte({recording:e,screenshotUrl:t}){const n=Tv(t??void 0),[r,s]=(0,p.useState)();let i=!1;try{e!==void 0&&Fv(e),i=!0}catch{}return(0,p.useEffect)(()=>{if(!i||!n)return;const o=new AbortController;return(async()=>{try{if(!yc(n))throw new Error("Owned screenshot link unavailable");const a=await eee(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:g,value:C}=await l.read();if(g)break;if(u+=C.byteLength,u>1048576)throw new Error("Screenshot too large");c.push(C)}}finally{await l.cancel().catch(()=>{}),l.releaseLock()}const d=new Uint8Array(u);let h=0;for(const g of c)d.set(g,h),h+=g.length;let f="";for(let g=0;g<d.length;g+=8192)f+=String.fromCharCode(...d.subarray(g,g+8192));const B=btoa(f);UM(B),o.signal.aborted||s({url:n,base64:B})}catch{o.signal.aborted||s({url:n,failed:!0})}})(),()=>o.abort()},[n,i]),i?n&&r?.url!==n?(0,m.jsx)("p",{role:"status",className:"text-xs text-muted-foreground",children:"Loading captured workspace…"}):(0,m.jsxs)("div",{className:"space-y-2",children:[r?.failed?(0,m.jsx)("p",{role:"status",className:"text-xs text-muted-foreground",children:"Captured image unavailable."}):null,(0,m.jsx)(sx,{recording:e,screenshotBase64:n?r?.base64:void 0})]}):(0,m.jsx)(sx,{recording:e})}var Ote=500,Mte={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 zM(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 Jo(e){const t=zM(e.action),n=e.locatorLabel?.trim();return n?`Interact · ${t} ${n}`:`Interact · ${t}`}function Jd(e){return e.assertion?e.assertion.passed?"ok":"error":e.ok===!0?"ok":e.ok===!1?"error":"unknown"}function Ea(e){return`${e.toolCallId}:${e.stepIndex}`}function Nte(e){if(!e)return[];const t=[];return typeof e.durationMs=="number"&&e.durationMs>0&&t.push({key:"duration",label:Pte(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 Pte(e){const t=Math.round(e/1e3),n=t%60,r=Math.floor(t/60)%60,s=Math.floor(t/3600),i=String(r).padStart(s>0?2:1,"0");return s>0?`${s}:${i}:${String(n).padStart(2,"0")}`:`${i}:${String(n).padStart(2,"0")}`}function $M(e){return typeof e=="string"&&e.length>0?e:null}function Cce(e){return(e.widgetRenderObservations?.length??0)>0||(e.browserInteractionSteps?.length??0)>0||$M(e.videoUrl)!==null}function Lte(e){return e==="ok"?"OK":e==="error"?"Failed":"Unknown"}function WM({step:e,leading:t,className:n}){const r=Jd(e),s=e.widgetToolCalls??[],i=e.coordinateX!=null&&e.coordinateY!=null?`(${e.coordinateX}, ${e.coordinateY})`:null;return(0,m.jsxs)("div",{"data-testid":"browser-step-detail",className:he("flex flex-col gap-4",n),children:[(0,m.jsxs)("div",{className:"flex items-center gap-2",children:[t,(0,m.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,m.jsx)("p",{className:"truncate text-sm font-medium text-foreground",children:Jo(e)}),(0,m.jsxs)("p",{className:"text-xs text-muted-foreground",children:["App interaction · ",e.elapsedMs,"ms",i?` · ${i}`:""]})]}),(0,m.jsx)("span",{className:he("inline-flex shrink-0 items-center rounded-full border px-2 py-0.5 text-[11px] font-medium",Mte[r]),children:Lte(r)})]}),e.assertion&&!e.assertion.passed&&e.assertion.reason?(0,m.jsx)("p",{className:"text-xs text-destructive",children:e.assertion.reason}):null,e.pluginWorkspace?(0,m.jsx)(Rte,{recording:e.pluginWorkspace,screenshotUrl:e.screenshotUrl}):e.screenshotUrl?(0,m.jsx)(uM,{src:e.screenshotUrl,alt:Jo(e),className:"max-h-72 w-full rounded-md border border-border/50 object-contain"}):null,s.length>0?(0,m.jsxs)("div",{className:"space-y-1.5",children:[(0,m.jsx)("p",{className:"text-[11px] font-medium uppercase tracking-wide text-muted-foreground",children:"Widget tool calls"}),s.map((o,a)=>(0,m.jsxs)("div",{className:"flex items-center gap-2 rounded-md border border-border/50 px-2.5 py-1.5 text-xs",children:[(0,m.jsx)("span",{className:he("inline-block h-1.5 w-1.5 shrink-0 rounded-full",o.ok?"bg-success":"bg-destructive"),"aria-hidden":!0}),(0,m.jsx)("span",{className:"font-mono text-foreground",children:o.name}),o.error?(0,m.jsx)("span",{className:"truncate text-destructive",children:o.error}):null]},`${o.name}-${a}`))]}):null,e.followUps&&e.followUps.length>0?(0,m.jsxs)("div",{className:"space-y-1.5",children:[(0,m.jsx)("p",{className:"text-[11px] font-medium uppercase tracking-wide text-muted-foreground",children:"Sent message to chat"}),e.followUps.map((o,a)=>(0,m.jsxs)("div",{className:"flex items-center gap-2 rounded-md border border-border/50 px-2.5 py-1.5 text-xs",children:[(0,m.jsx)("span",{"aria-hidden":!0,children:"↳"}),(0,m.jsx)("span",{className:"truncate text-foreground",children:o})]},a))]}):null]})}function _te(e){const t=Math.floor(e/1e3),n=Math.floor(t/60),r=t%60;return`${n}:${String(r).padStart(2,"0")}`}function Fte(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 vce({steps:e,videoUrl:t,videoMeta:n,isRunning:r=!1,className:s}){const i=(0,p.useRef)(null),[o,a]=(0,p.useState)(null),[l,c]=(0,p.useState)(null),u=(0,p.useRef)(null),[d,h]=(0,p.useState)(!1),[f,B]=(0,p.useState)(null),g=Tv($M(t)),C=(0,p.useMemo)(()=>Nte(n),[n]),v=(0,p.useMemo)(()=>[...e].sort((R,P)=>(R.videoOffsetMs??Number.POSITIVE_INFINITY)-(P.videoOffsetMs??Number.POSITIVE_INFINITY)||R.promptIndex-P.promptIndex||R.ts-P.ts),[e]),y=o??l??null,S=(0,p.useMemo)(()=>v.find(R=>Ea(R)===y)??null,[v,y]),E=g!=null&&!d,D=v.some(R=>R.screenshotUrl),A=(0,p.useCallback)(R=>{a(Ea(R));const P=i.current;if(!P||!E||R.videoOffsetMs==null)return;const _=R.videoOffsetMs/1e3;u.current=_,P.currentTime=_},[E]),x=(0,p.useCallback)(()=>{u.current=null},[]),O=(0,p.useCallback)(()=>{const R=i.current;if(!R)return;const P=Fte(v,R.currentTime*1e3);if(c(P?Ea(P):null),u.current==null){if(o!=null){const _=v.find(N=>Ea(N)===o);if(_?.videoOffsetMs!=null){const N=_.videoOffsetMs-R.currentTime*1e3;if(N>0&&N<Ote)return}}a(null)}},[v,o]);return(0,p.useEffect)(()=>{h(!1)},[g]),(0,p.useEffect)(()=>{if(!f||f.url!==g)return;const R=setTimeout(()=>{B(null),h(!1)},f.delayMs);return()=>clearTimeout(R)},[f,g]),v.length===0&&!g?(0,m.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,m.jsxs)("section",{className:he("flex min-w-0 flex-col gap-3",s),"data-testid":"browser-step-filmstrip",children:[(0,m.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,m.jsxs)("h3",{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:["Replay",(0,m.jsx)("span",{className:"ml-1.5 font-normal normal-case text-muted-foreground/70",children:"screen recording of the app interactions in this run"})]}),g&&!d&&(C.length>0||n?.truncated)?(0,m.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:[C.map(R=>(0,m.jsx)("span",{title:R.title,children:R.label},R.key)),n?.truncated?(0,m.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,g&&!d?(0,m.jsx)("video",{ref:i,src:g,controls:!0,preload:"metadata",onTimeUpdate:O,onSeeked:x,onError:()=>{const R=lM(g);h(!0),B(R!==null&&R>0?{url:g,delayMs:R}:null)},onLoadedMetadata:()=>cM(g),className:"w-full rounded-md border border-border/60 bg-black","data-testid":"browser-replay-video"}):(0,m.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.":d?D?"Recording failed to load — screenshots preserved.":"Recording failed to load, and no screenshots were captured.":D?"Video unavailable — screenshots preserved.":"Partial capture — no recording, and no screenshots survived."})]}),v.length>0?(0,m.jsxs)("div",{className:"flex min-w-0 flex-col gap-2",children:[(0,m.jsx)("div",{className:"flex min-w-0 gap-2 overflow-x-auto pb-1","data-testid":"browser-filmstrip-track",children:v.map(R=>{const P=Ea(R),_=Jd(R),N=P===y;return(0,m.jsxs)("button",{type:"button",onClick:()=>A(R),"aria-pressed":N,title:Jo(R),"data-testid":"browser-filmstrip-frame","data-step-key":P,"data-active":N?"true":"false",className:he("flex w-28 shrink-0 flex-col gap-1 rounded-md border p-1 text-left transition-colors",N?"border-primary bg-primary/5":"border-border/50 hover:border-border"),children:[R.pluginWorkspace?(0,m.jsx)("span",{className:"text-xs text-muted-foreground",children:"Workspace capture"}):R.screenshotUrl?(0,m.jsx)(uM,{src:R.screenshotUrl,alt:Jo(R),loading:"lazy",className:"h-16 w-full rounded-sm border border-border/40 bg-background object-cover object-top"}):(0,m.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,m.jsx)("span",{className:"truncate text-[10px] font-medium text-foreground",children:zM(R.action)}),(0,m.jsx)("span",{className:he("truncate text-[10px]",_==="error"?"text-destructive":"text-muted-foreground"),children:R.videoOffsetMs!=null?_te(R.videoOffsetMs):`turn ${R.promptIndex+1}`})]},P)})}),S?(0,m.jsx)(WM,{step:S,className:"rounded-lg bg-muted/5 px-4 py-4"}):(0,m.jsx)("p",{className:"px-1 text-[11px] text-muted-foreground",children:"Select a frame to see the interaction that produced it."})]}):null]})}function Hte(e){const t=[];for(const n of e)n?.event&&t.push({promptIndex:n.promptIndex,...typeof n.startedAtMs=="number"&&Number.isFinite(n.startedAtMs)?{turnStartedAtMs:n.startedAtMs}:{},event:n.event});return t.sort((n,r)=>n.promptIndex-r.promptIndex)}function yce(e,t){if(!e&&!t)return;const n={},r=(e?.inputTokens??0)+(t?.inputTokens??0),s=(e?.outputTokens??0)+(t?.outputTokens??0),i=(e?.totalTokens??0)+(t?.totalTokens??0),o=(e?.reasoningTokens??0)+(t?.reasoningTokens??0),a=(e?.cachedInputTokens??0)+(t?.cachedInputTokens??0);return r>0&&(n.inputTokens=r),s>0&&(n.outputTokens=s),i>0&&(n.totalTokens=i),o>0&&(n.reasoningTokens=o),a>0&&(n.cachedInputTokens=a),Object.keys(n).length>0?n:void 0}function bce(e){return!Array.isArray(e)||e.length===0?0:e.reduce((t,n)=>Math.max(t,n.endMs),0)}function Sce(e,t){return!Array.isArray(e)||e.length===0?[]:e.map(n=>({...n,startMs:n.startMs+t,endMs:n.endMs+t}))}function jte(e){const t=new Map;return e.map(n=>{const r=t.get(n.turnId),s={system:n.inherits?.system?r?.system??"":n.payload.system??"",tools:n.inherits?.tools?r?.tools??{}:n.payload.tools??{},messages:n.payload.messages??[]};t.set(n.turnId,s);const{inherits:i,...o}=n;return{...o,payload:s}})}function Ece(e){if(!e||typeof e!="object"||Array.isArray(e))return[];const t=e;try{const n=t.requestPayloads??(t.requestPayloadsJson?JSON.parse(t.requestPayloadsJson):void 0);return Array.isArray(n)?jte(n):[]}catch{return[]}}function Gte(e){return typeof e=="string"&&e.length>0&&e.length<=200?e:void 0}var Vte={[-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 Ute(e){const t=Vte[e];return t?`${e} · ${t}`:String(e)}var zte=w({id:b(),parentId:b().optional(),name:b(),category:V(["step","llm","tool","error","connection","discovery"]),startMs:M(),endMs:M(),promptIndex:M().optional(),stepIndex:M().optional(),authoredStepId:b().optional(),status:V(["ok","error"]).optional(),toolCallId:b().optional(),toolName:b().optional(),toolOrigin:V(["mcp","native","builtin","unknown"]).optional(),serverId:b().optional(),connectionId:b().optional(),modelId:b().optional(),inputTokens:M().optional(),outputTokens:M().optional(),totalTokens:M().optional(),cost:Ln().transform($D).optional(),callId:Ln().transform(Gte).optional(),messageStartIndex:M().optional(),messageEndIndex:M().optional(),finishReason:b().optional(),provider:b().optional(),responseId:b().optional(),responseTimestamp:b().optional(),ttfcMs:M().optional(),mcpErrorCode:M().optional(),outputSource:Hn([L("narration"),L("evidence"),L("reconstructed")]).optional(),wireCorroborated:oe().optional(),evidenceRequestId:b().optional(),evidenceStatus:Hn([L("complete"),L("incomplete")]).optional()}),li=w({toolName:b(),arguments:nr(b(),Cx())}),$te=w({promptIndex:M(),prompt:b(),expectedToolCalls:K(li),actualToolCalls:K(li),expectedOutput:b().optional(),passed:oe(),missing:K(li),unexpected:K(li),argumentMismatches:K(w({expected:li,actual:li,mismatchedArguments:K(b())})),retries:K(li.extend({actualIndex:M().int().nonnegative(),retriedByIndex:M().int().nonnegative()})).optional()}),Wte=w({toolCallId:b(),toolName:b(),protocol:Hn([L("mcp-apps"),L("openai-apps")]),serverId:b(),resourceUri:b().optional(),toolMetadata:nr(b(),Ln()),widgetCsp:nr(b(),Ln()).nullable().optional(),widgetPermissions:nr(b(),Ln()).nullable().optional(),widgetPermissive:oe().optional(),prefersBorder:oe().optional(),widgetHtmlBlobId:b().optional(),widgetHtmlUrl:b().nullable().optional(),injectedOpenAiCompat:oe().optional(),injectedOpenAiCompatCapabilities:w({callTool:oe().optional(),sendFollowUpMessage:oe().optional(),setWidgetState:oe().optional(),requestDisplayMode:V(["all","fullscreen-only","none"]).optional(),notifyIntrinsicHeight:oe().optional(),openExternal:oe().optional(),setOpenInAppUrl:oe().optional(),requestModal:oe().optional(),uploadFile:oe().optional(),selectFiles:oe().optional(),getFileDownloadUrl:oe().optional(),requestCheckout:oe().optional(),requestClose:oe().optional()}).optional()}),qte=w({source:V(["hosted","widget"]),fps:M().optional(),durationMs:M().optional(),distinctFrames:M().optional(),truncated:oe().optional()}),xce=w({traceVersion:L(1),messages:K(Cx()),widgetSnapshots:K(Wte).optional(),spans:K(zte).optional(),prompts:K($te).optional(),videoBlobId:b().optional(),videoMeta:qte.optional()});function Kte(e,t){const n=[],r=new Map;return t.forEach((s,i)=>{if(s.role==="user"&&n.push(i),!!Array.isArray(s.content))for(const o of s.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(i),r.set(o.toolCallId,a)}}),{userIndices:n,spans:e.map(s=>{const i=n[s.promptIndex??0],o=n[(s.promptIndex??0)+1]??t.length,a=i!==void 0&&s.category==="tool"&&s.toolCallId?r.get(s.toolCallId)?.filter(l=>l>=i&&l<o):void 0;return{...s,messageStartIndex:a?.[0],messageEndIndex:a?.at(-1)}})}}function Jte({recording:e}){let t;try{t=Fv(e)}catch{return null}return(0,m.jsxs)("section",{"aria-label":"Workspace events",className:"mt-4 space-y-2 text-xs",children:[(0,m.jsx)("p",{className:"font-medium",children:"Workspace events"}),t.droppedEvents>0&&(0,m.jsxs)("p",{className:"text-muted-foreground",children:[t.droppedEvents," earlier events omitted."]}),t.events.map(n=>(0,m.jsxs)("div",{className:"flex gap-2 border-b border-border py-2",children:[(0,m.jsx)("span",{className:"tabular-nums text-muted-foreground",children:n.sequence}),(0,m.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))]})}function Qte(e,t){return t?.find(n=>n.parentId===e.id&&n.name.startsWith("Answered by the mock: "))?.name.slice(22)}var Hv=(0,p.createContext)(void 0);function wce({accounts:e,testCaseId:t,children:n}){const r=nee(),s=(0,p.useMemo)(()=>r?e?.filter(i=>!i.cases||i.cases.some(o=>o.testCaseId===t)):void 0,[e,r,t]);return(0,m.jsx)(Hv.Provider,{value:s,children:n})}function qM(){const e=(0,p.useContext)(Hv);return(0,p.useCallback)(t=>VM(t,e),[e])}function Dce({spans:e,children:t}){const n=(0,p.useContext)(Hv),r=(0,p.useMemo)(()=>Dte(e,n),[e,n]);return(0,m.jsx)(nk.Provider,{value:r,children:t})}var Yte=1024;function Xte(e){const[t,n]=(0,p.useState)(null),[r,s]=(0,p.useState)(!1);return(0,p.useLayoutEffect)(()=>{if(e!=="auto"||!t)return;const i=()=>s(t.getBoundingClientRect().width>=Yte);if(i(),typeof ResizeObserver>"u")return;const o=new ResizeObserver(i);return o.observe(t),()=>o.disconnect()},[e,t]),{containerRef:n,direction:e==="auto"&&r?"horizontal":"vertical"}}var Zte=["all","connection","discovery","llm","tool","error"];function OB(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 ene({filter:e,onFilterChange:t,isFullyExpanded:n,expandDisabled:r,onToggleExpandAll:s,zoomControls:i,showBottomBorder:o=!0}){return(0,m.jsxs)("div",{className:he("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,m.jsxs)(LC,{children:[(0,m.jsx)(_C,{asChild:!0,children:(0,m.jsxs)(kn,{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: ${OB(e)}`,children:[(0,m.jsx)(DH,{className:"size-3.5 shrink-0 opacity-80","aria-hidden":!0}),OB(e)]})}),(0,m.jsx)(FC,{align:"start",className:"min-w-[8rem]",children:(0,m.jsx)(r4,{value:e,onValueChange:a=>t(a),children:Zte.map(a=>(0,m.jsx)(s4,{value:a,className:"text-xs",children:OB(a)},a))})})]}),(0,m.jsx)(kn,{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:s,children:n?(0,m.jsx)(LH,{className:"size-3.5",strokeWidth:2,"aria-hidden":!0}):(0,m.jsx)(SH,{className:"size-3.5",strokeWidth:2,"aria-hidden":!0})}),i?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)("span",{className:"bg-border hidden h-3 w-px shrink-0 md:block","aria-hidden":!0}),(0,m.jsx)("div",{className:"flex shrink-0 items-center gap-0.5",children:i})]}):null]})}function KM(e,t=[]){const n=e.filter(r=>r.category==="llm");if(!(!n.some(r=>r.cost)&&t.length===0))return ZH([...n.map(r=>r.cost),...t])}function JM(e,t){if(!e||e.kind==="interaction")return;if(e.kind==="span"){const{span:r}=e;if(r.category!=="llm")return;const s=r.cost??t?.find(({id:i})=>i===r.id)?.cost;return s?{kind:"call",cost:s}:void 0}const n=KM((t??[]).filter(r=>(r.promptIndex??0)===e.promptIndex));return n?{kind:"rollup",rollup:n}:void 0}function tne(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 jv={provider_reported:"Provider-reported",list_price:"Estimated at list price",customer_rate:"Estimated at your rates",runner_reported:"Runner-reported"},QM={partial:"Partial",unavailable:"Cost unavailable"},Gv=e=>e==="list_price"||e==="customer_rate",nne={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."},rne={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"},sne={input:"Input",cacheRead:"Cache read",cacheWrite:"Cache write",output:"Output",webSearch:"Web search"};function ine(e){if(e.length<=1)return e[0]&&jv[e[0]];const t=e.filter(Gv).length;return t===e.length?"Estimated":t>0?"Reported and estimated":"Reported"}function one(e){const t=(e.missing??[]).map(s=>rne[s]),n=e.completeness==="unavailable"?e.reason?nne[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(sne).flatMap(([s,i])=>{const o=e.parts?.[s];return typeof o=="number"?[{label:i,amountUsd:o}]:[]});return{amountUsd:e.amountUsd,estimated:e.source?Gv(e.source):!1,sourceLabel:e.source?jv[e.source]:void 0,completeness:e.completeness,note:n,parts:r}}function ane(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(Gv),sourceLabel:ine(e.sources),completeness:e.completeness,coverage:`${t} of ${e.totalCalls} ${n} priced${r}`,parts:[]}}function YM(e){return e.kind==="call"?one(e.cost):ane(e.rollup)}var xa={name:512,eventId:1024,timestamp:64,subscriptionId:256,triggerId:256},vg=["poll","push","webhook"],lne=["server","simulation","replay"];function ix(e){return e>=55296&&e<=56319}function ox(e){return e>=56320&&e<=57343}function cne(e,t){let n="",r=0;for(;r<e.length;){const s=e.charCodeAt(r);let i;if(ix(s)&&r+1<e.length&&ox(e.charCodeAt(r+1))?i=e.slice(r,r+2):ix(s)||ox(s)?i="�":i=e[r],n.length+i.length>t)break;n+=i,r+=i==="�"?1:i.length}return n}function une(e,t){return typeof e=="string"&&vg.includes(e)?{origin:"server",delivery:e}:e==="simulation"||e==="replay"?typeof t=="string"&&vg.includes(t)?{origin:e,delivery:t}:{origin:e}:{origin:"server"}}function wa(e,t){if(typeof e!="string")return;const n=cne(e,t);return n.length>0?n:void 0}function dne(e){return e>=0&&!Number.isNaN(new Date(e).getTime())}function XM(e){const t=wa(e.name,xa.name);if(!t||!dne(e.receivedAt))return;const{origin:n,delivery:r}=une(e.origin,e.subscriptionMode),s=wa(e.eventId,xa.eventId),i=wa(e.timestamp,xa.timestamp),o=wa(e.subscriptionId,xa.subscriptionId),a=wa(e.triggerId,xa.triggerId);return{name:t,...s?{eventId:s}:{},...i?{timestamp:i}:{},receivedAt:e.receivedAt,...r?{delivery:r}:{},origin:n,...o?{subscriptionId:o}:{},...a?{triggerId:a}:{}}}function Tce(e,t){return XM({name:e.name??"",eventId:e.eventId,timestamp:e.timestamp,receivedAt:e.receivedAt,origin:e.origin,subscriptionMode:t,subscriptionId:e.logicalSubscriptionId})}function hne(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function vu(e){return e==null||typeof e=="string"}function ZM(e){if(!hne(e)||typeof e.name!="string"||typeof e.receivedAt!="number"||typeof e.origin!="string"||!lne.includes(e.origin)||!(e.delivery===void 0||e.delivery===null||typeof e.delivery=="string"&&vg.includes(e.delivery))||!vu(e.eventId)||!vu(e.timestamp)||!vu(e.subscriptionId)||!vu(e.triggerId))return;const t=XM({name:e.name,eventId:e.eventId,timestamp:e.timestamp,receivedAt:e.receivedAt,subscriptionId:e.subscriptionId,triggerId:e.triggerId});if(t)return{...t,...typeof e.delivery=="string"?{delivery:e.delivery}:{},origin:e.origin}}function Ace(e){if(!e||typeof e!="object"||Array.isArray(e))return;const t=e.turnEvents;if(!Array.isArray(t))return;const n=new Map;for(const r of t){if(!r||typeof r!="object")continue;const{promptIndex:s,turnStartedAtMs:i,event:o}=r,a=ZM(o);typeof s!="number"||!a||n.set(s,{promptIndex:s,...eN(i)?{turnStartedAtMs:i}:{},event:a})}return n.size>0?n:void 0}function Ice(e){return Hte((e??[]).map(t=>({promptIndex:t.promptIndex,startedAtMs:t.startedAt,event:ZM(t.eventAtTurn)})))}function fne(e){return`Event: ${e.name}`}function Bne(e){return e.origin==="simulation"}function pne(e,t,n=yne){const r=[];if(e.timestamp!==void 0){const l=Cne(e.timestamp);r.push(l===void 0?{key:"occurred",label:"Occurred",asSent:e.timestamp}:{key:"occurred",label:"Occurred",ms:l})}r.push({key:"received",label:"Received",ms:e.receivedAt}),eN(t)&&r.push({key:"turn-started",label:"Turn started",ms:t});const s=r.map((l,c)=>{const u=r[c-1];if(!u||!("ms"in u)||!("ms"in l))return;const d=l.ms-u.ms;return d>=0?d:void 0}),i=r.map((l,c)=>{const u=s[c];return{key:l.key,label:l.label,..."ms"in l?{value:n(l.ms)}:{value:l.asSent,asSent:!0},...u!==void 0?{waitSincePrevious:ax(u)}:{}}}),[,o,a]=s;return{stops:i,...r.length===3&&o!==void 0&&a!==void 0?{totalWait:ax(o+a)}:{}}}var mne={poll:"Poll",push:"Push",webhook:"Webhook"};function gne(e){const t=[];return e.eventId&&t.push({label:"Event ID",value:e.eventId,copySubject:"event ID"}),e.subscriptionId&&t.push({label:"Subscription",value:e.subscriptionId,copySubject:"subscription ID"}),e.triggerId&&t.push({label:"Trigger",value:e.triggerId,copySubject:"trigger ID"}),e.delivery&&t.push({label:"Delivery",value:mne[e.delivery]}),t}function Cne(e){const t=/(\d{4})-(\d{2})-(\d{2})[T ]\d{2}:\d{2}/.exec(e);if(!t||!vne(Number(t[1]),Number(t[2]),Number(t[3])))return;const n=Date.parse(e);return Number.isFinite(n)?n:void 0}function vne(e,t,n){const r=new Date(0);return r.setUTCFullYear(e,t-1,n),r.getUTCFullYear()===e&&r.getUTCMonth()===t-1&&r.getUTCDate()===n}function yne(e){return new Date(e).toLocaleString()}function ax(e){const t=Math.round(e);return t<6e4?bte(t):Zee(t)}function eN(e){return typeof e=="number"&&Number.isFinite(e)}function tN({event:e}){return!e||!Bne(e)?null:(0,m.jsx)(Al,{variant:"outline","data-testid":"trace-event-test-badge",className:"border-border/60 bg-muted/30 px-1.5 py-0 text-[10px] font-medium text-muted-foreground",title:"A test event, sent from MCPJam",children:"Test"})}function bne({turnEvent:e}){const{event:t}=e,n=pne(t,e.turnStartedAtMs),r=gne(t);return(0,m.jsxs)("section",{"data-testid":"trace-event-section","aria-label":"Event",className:"space-y-3 rounded-md border border-border/50 px-3 py-3 text-xs",children:[(0,m.jsxs)("div",{className:"flex min-w-0 items-center gap-2",children:[(0,m.jsx)(NH,{className:"size-3.5 shrink-0 text-muted-foreground","aria-hidden":!0}),(0,m.jsx)("span",{className:"text-[10px] uppercase tracking-wide text-muted-foreground",children:"Event"}),(0,m.jsx)("span",{className:"min-w-0 truncate font-mono text-xs font-medium text-foreground",title:t.name,children:t.name}),(0,m.jsx)(tN,{event:t})]}),(0,m.jsxs)("div",{"data-testid":"trace-event-timing",children:[n.stops.map((s,i)=>(0,m.jsxs)("div",{children:[i>0?(0,m.jsxs)("div",{className:"flex min-h-4 items-stretch gap-3 text-[11px] tabular-nums text-muted-foreground","data-testid":`trace-event-wait-${s.key}`,children:[(0,m.jsx)("span",{className:"flex w-[11px] shrink-0 justify-center","aria-hidden":!0,children:(0,m.jsx)("span",{className:"w-px bg-border"})}),(0,m.jsx)("span",{className:"w-24 shrink-0","aria-hidden":!0}),(0,m.jsx)("span",{className:"self-center",children:s.waitSincePrevious?`+${s.waitSincePrevious}`:null})]}):null,(0,m.jsx)(MB,{marker:(0,m.jsx)("span",{className:"block size-[11px] rounded-full border border-border bg-background"}),label:s.label,children:(0,m.jsx)("span",{"data-testid":`trace-event-time-${s.key}`,className:s.asSent?"break-all font-mono text-foreground":"tabular-nums text-foreground",children:s.value})})]},s.key)),n.totalWait?(0,m.jsx)("div",{className:"pt-2",children:(0,m.jsx)(MB,{label:"Total wait",children:(0,m.jsx)("span",{"data-testid":"trace-event-total-wait",className:"font-medium tabular-nums text-foreground",children:n.totalWait})})}):null]}),r.length>0?(0,m.jsx)("div",{"data-testid":"trace-event-identifiers",className:"space-y-1 border-t border-border/40 pt-3",children:r.map(s=>(0,m.jsx)(MB,{label:s.label,children:(0,m.jsxs)("span",{className:"flex min-w-0 items-center gap-1",children:[(0,m.jsx)("span",{className:s.copySubject?"min-w-0 truncate font-mono text-foreground":"min-w-0 truncate text-foreground",title:s.value,children:s.value}),s.copySubject?(0,m.jsx)(see,{value:s.value,subject:s.copySubject,size:"inline"}):null]})},s.label))}):null]})}function MB({marker:e,label:t,children:n}){return(0,m.jsxs)("div",{className:"flex min-w-0 items-center gap-3",children:[(0,m.jsx)("span",{className:"flex w-[11px] shrink-0 justify-center","aria-hidden":!0,children:e}),(0,m.jsx)("span",{className:"w-24 shrink-0 text-muted-foreground",children:t}),(0,m.jsx)("span",{className:"min-w-0 flex-1",children:n})]})}var Sne="trace-cost";function Sc(){return fA(Sne)===!0}var nN="evalIterationModelCalls:list",Ene=xh(nN),yu=e=>Number.isInteger(e)&&e>=0;function xne(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)&&yu(t.totalCalls)&&yu(t.completeCalls)&&yu(t.partialCalls)&&yu(t.unavailableCalls)&&Array.isArray(r)&&r.every(s=>typeof s=="string"&&Object.hasOwn(jv,s))?e:void 0}function kce(e,t){const n=xne(e.usage?.costRollup);return{iterationId:e._id,...n?{rollup:n}:{},harness:t?t.startsWith("harness:"):!!gN(e.execution)?.harness}}function wne(e,t){const n=new Set(e.filter(o=>o.category==="llm").map(o=>o.id)),r=new Map,s=[],i=new Set;for(const o of t??[]){if(i.has(o.generationId))continue;i.add(o.generationId);const a=$D(o.cost),l=o.matchedSpanId;l&&n.has(l)&&!r.has(l)?r.set(l,a):s.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:s}}function Dne(e){return wN(e,nN)}var rN=[];function tf(e){const t=Sc();return(0,p.useMemo)(()=>t&&e?YM(e):void 0,[t,e])}function ql({amountUsd:e,estimated:t,slot:n=!1}){return(0,m.jsxs)("span",{className:"whitespace-nowrap tabular-nums",children:[t?(0,m.jsx)("span",{className:"inline-block w-[1ch] text-center",children:"≈"}):n?(0,m.jsx)("span",{"aria-hidden":!0,className:"inline-block w-[1ch]"}):null,tne(e)]})}function sN({view:e}){return(0,m.jsxs)(m.Fragment,{children:[e.sourceLabel?(0,m.jsx)(Al,{variant:"outline",className:"px-1.5 py-0 text-[10px] text-muted-foreground",children:e.sourceLabel}):null,e.completeness!=="complete"?(0,m.jsx)(Al,{variant:"outline",className:he("px-1.5 py-0 text-[10px]",e.completeness==="partial"?"border-warning/50 bg-warning/10 text-foreground":"text-muted-foreground"),children:QM[e.completeness]}):null,e.coverage?(0,m.jsx)("span",{children:e.coverage}):null,e.note?(0,m.jsx)("span",{children:e.note}):null]})}function Tne({cost:e}){const t=tf(e);return t?.amountUsd===void 0?null:(0,m.jsxs)("span",{"data-testid":"trace-cost-inline",children:[" · ",(0,m.jsx)("span",{className:"font-medium text-foreground",children:(0,m.jsx)(ql,{amountUsd:t.amountUsd,estimated:t.estimated})})]})}function Ane({cost:e}){const t=tf(e);return t?(0,m.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,m.jsx)("span",{className:"text-muted-foreground/70",children:"Cost"}),(0,m.jsx)(sN,{view:t})]}):null}function Da({label:e,children:t}){return(0,m.jsxs)("div",{className:"flex min-w-0 items-baseline justify-between gap-3",children:[(0,m.jsx)("span",{className:"shrink-0 text-popover-foreground/70",children:e}),(0,m.jsx)("span",{className:"min-w-0 text-right font-medium text-popover-foreground",children:t})]})}function Ine({cost:e}){const t=tf(e);return t?(0,m.jsxs)("div",{"data-testid":"trace-row-hover-cost",className:"space-y-1.5",children:[(0,m.jsx)("div",{className:"text-[10px] font-semibold uppercase tracking-wide text-popover-foreground/65",children:"Cost"}),(0,m.jsxs)("div",{className:"space-y-1 text-xs",children:[(0,m.jsx)(Da,{label:e?.kind==="rollup"?"Total":"Amount",children:t.amountUsd===void 0?"Unavailable":(0,m.jsx)(ql,{amountUsd:t.amountUsd,estimated:t.estimated,slot:!0})}),t.parts.map(n=>(0,m.jsx)(Da,{label:n.label,children:(0,m.jsx)(ql,{amountUsd:n.amountUsd,estimated:t.estimated,slot:!0})},n.label)),t.sourceLabel?(0,m.jsx)(Da,{label:"Source",children:t.sourceLabel}):null,t.completeness==="partial"?(0,m.jsx)(Da,{label:"Status",children:QM.partial}):null,t.coverage?(0,m.jsx)(Da,{label:"Coverage",children:t.coverage}):null,t.note?(0,m.jsx)("p",{className:"text-popover-foreground/70",children:t.note}):null]})]}):null}function kne(e,t){const n=Sc()&&t?.harness?t.iterationId:void 0,[r,s]=(0,p.useState)(),i=r?.iterationId===n?r?.calls:void 0,o=(0,p.useMemo)(()=>i?wne(e??[],i):void 0,[e,i]),a=(0,p.useCallback)(()=>s(void 0),[]),l=n?(0,m.jsx)(Dd,{name:"trace-cost-model-calls",isExpectedError:Dne,onError:a,fallback:null,children:(0,m.jsx)(Rne,{iterationId:n,onLoad:s})},n):null;return{spans:o?.spans??e,unmatched:o?.unmatched??rN,loader:l}}function Rne({iterationId:e,onLoad:t}){const n=lA(Ene,{iterationId:e});return(0,p.useEffect)(()=>{n&&t({iterationId:e,calls:n})},[n,e,t]),null}function One({spans:e,iteration:t,unmatched:n=rN}){const r=Sc(),s=tf((0,p.useMemo)(()=>{if(!r)return;const i=t?.rollup??KM(e??[],n.map(o=>o.cost));return i&&{kind:"rollup",rollup:i}},[r,e,t?.rollup,n]));return s?(0,m.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,m.jsxs)("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1",children:[(0,m.jsx)("span",{className:"text-[10px] font-semibold uppercase tracking-wide",children:"Trace cost"}),s.amountUsd!==void 0?(0,m.jsx)("span",{className:"text-sm font-semibold text-foreground",children:(0,m.jsx)(ql,{amountUsd:s.amountUsd,estimated:s.estimated})}):null,(0,m.jsx)(sN,{view:s})]}),n.length>0?(0,m.jsx)(Mne,{calls:n}):null]}):null}function Mne({calls:e}){return(0,m.jsxs)("div",{"data-testid":"trace-cost-unmatched-calls",className:"space-y-1",children:[(0,m.jsx)("div",{className:"text-[10px] font-semibold uppercase tracking-wide",children:"Model calls not matched to a step"}),(0,m.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&&YM({kind:"call",cost:t.cost});return(0,m.jsxs)("li",{className:"flex flex-wrap items-baseline gap-x-2",children:[(0,m.jsx)("span",{className:"min-w-0 truncate font-mono text-foreground",children:t.modelId}),(0,m.jsx)("span",{className:"font-medium text-foreground",children:n?.amountUsd!==void 0?(0,m.jsx)(ql,{amountUsd:n.amountUsd,estimated:n.estimated}):"Cost unavailable"}),n?.sourceLabel?(0,m.jsx)("span",{children:n.sourceLabel}):null]},t.generationId)})})]})}var lx=[0,25,50,75,100],Nne=54,Pne=120;function Lne(e){if(!Number.isFinite(e))return[0,100];if(e<=0)return[0,100];const t=Math.max(2,Math.floor(e/Nne));return t>=lx.length?[...lx]:t<=2?[0,100]:t===3?[0,50,100]:[0,25,75,100]}function _ne(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 cx(e){return e<=0?ad(0):`${ad(0)}–${ad(e)}`}function Fne(e){const t=e.filter(l=>l.category==="llm");let n=0,r=0,s=0,i=0,o=0,a=0;for(const l of t)typeof l.inputTokens=="number"&&(n+=l.inputTokens,r++),typeof l.outputTokens=="number"&&(s+=l.outputTokens,i++),typeof l.totalTokens=="number"&&(o+=l.totalTokens,a++);return{...r?{inputTokens:n}:{},...i?{outputTokens:s}:{},...a?{totalTokens:o}:{}}}function nf(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 nf(e,9)}}function Hne(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 jne(e,t){return typeof e!="number"||t<50?null:e/(t/1e3)}function ul(e){return e>=1e3?`${(e/1e3).toFixed(e>=1e4?1:2)}s`:`${Math.round(e)}ms`}function ad(e){return e>=1e3?`${(e/1e3).toFixed(2)}s`:`${Math.round(e)}ms`}function es(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}function Kl(e){const t=e.toolName??e.name;return typeof t=="string"&&t.trim()?t:void 0}function Ec(e){return Array.isArray(e.content)?e.content.filter(t=>es(t)&&typeof t.type=="string"):typeof e.content=="string"?[{type:"text",text:e.content}]:[]}function iN(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(es(e)){const t=Object.keys(e);return t.length>0?`{ ${t.slice(0,4).join(", ")}${t.length>4?", ...":""} }`:"{}"}return String(e)}function Gne(e){const t=Ec(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: ${Kl(r)??"Tool"}`:r.type==="tool-result"?`Tool result: ${Kl(r)??"Tool"}`:typeof r.type=="string"?r.type:"content").join(" | ");return n.length>220?`${n.slice(0,217)}...`:n}function Vne(e){return!es(e)||!("type"in e)||!("value"in e)?e:e.value}function Une(e){return e.result!==void 0?e.result:Vne(e.output)}function zne(e){const t=Une(e);if(typeof e.error=="string"&&e.error.trim())return e.error.trim();if(es(e.error)&&typeof e.error.message=="string")return e.error.message;if(es(e.output)&&e.output.type==="error-text")return typeof e.output.value=="string"?e.output.value:"Tool error";if(es(e.result)&&e.result.isError===!0||es(e.output)&&es(e.output.value)&&e.output.value.isError===!0||e.isError===!0)return RB(t)??"Tool error"}function rf(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 s,i,o;for(const a of e)for(const l of Ec(a)){const c=typeof t=="string"&&l.toolCallId===t,u=!t&&typeof n=="string"&&Kl(l)===n;if(!(!c&&!u)&&(l.type==="tool-call"&&(s=l.input??l.parameters??l.args),l.type==="tool-result")){i=l.result??(es(l.output)&&"value"in l.output?l.output.value:l.output);const d=zne(l);d&&(o=d)}}return{input:s,output:i,errorText:o}}function So(e,t,n=!1){return e.category==="error"||e.status==="error"?!0:e.category==="tool"?!!rf(t,e.toolCallId,e.toolName??e.name,n?e:void 0).errorText:!1}function ca(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 $ne(e){return ca(e.messageStartIndex,e.messageEndIndex)}function Wne(e){return ca(e.span.messageStartIndex,e.span.messageEndIndex)}function oN(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 aN(e,t,n){if(t)for(let r=t.startIndex;r<=t.endIndex;r+=1){const s=e[r];if(s&&n(s))return r}}function Vv(e,t,n){if(!e.length)return;const r=ca(t,n);if(!r){const i=e.findIndex(o=>o.role==="user");return i>=0?i:void 0}const s=aN(e,r,i=>i.role==="user");if(typeof s=="number")return s;if(!(r.startIndex>=e.length)&&r.startIndex>0)for(let i=r.startIndex-1;i>=0;i-=1){const o=e[i];if(o){if(o.role==="user")return i;if(o.role==="assistant")break}}}function qne(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 nf(n,"trace-waterfall-bar-step")}}function Kne(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 nf(e,"text-muted-foreground")}}function Jne(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 nf(n,"border-l-muted-foreground")}}function Qne(e){const t=new Map;for(const n of e){const r=typeof n.promptIndex=="number"?n.promptIndex:0,s=t.get(r);s?s.push(n):t.set(r,[n])}return[...t.entries()].sort(([n],[r])=>n-r).map(([n,r])=>{const s=new Map;r.forEach(c=>{s.set(c.id,{span:c,children:[]})});const i=[];r.forEach(c=>{const u=s.get(c.id),d=typeof c.parentId=="string"?s.get(c.parentId):void 0;if(d){d.children.push(u);return}i.push(u)});const o=c=>{c.sort((u,d)=>Hne(u.span,d.span)),c.forEach(u=>o(u.children))};o(i);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:i,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 dx(e){const t=new Set;function n(r){for(const s of r)s.span.category==="step"&&s.children.length>0&&t.add(s.span.id),n(s.children)}for(const r of e)n(r.roots);return t}function NB(e){return{role:e.role,content:e.content}}function lN(e,t,n){const r=ca(t,n);if(!r)return[];const s=e.slice(r.startIndex,r.endIndex+1);if(s.length===0)return[];let i=-1;for(let a=0;a<s.length;a++)if(s[a].role==="assistant"){i=a;break}if(i<0)return e.slice(0,r.endIndex+1);const o=r.startIndex+i;return o===0?[]:e.slice(0,o)}function Yne(e,t,n){const r=ca(t,n);if(!r)return{input:null,output:null};const s=e.slice(r.startIndex,r.endIndex+1);if(s.length===0)return{input:[],output:null};let i=-1;for(let l=s.length-1;l>=0;l-=1)if(s[l].role==="assistant"){i=l;break}if(i<0)return{input:s.map(NB),output:null};const o=lN(e,t,n),a=s[i];return{input:o.length>0?o.map(NB):null,output:NB(a)}}var Xne=96;function tr(e,t=Xne){const n=e.replace(/\s+/g," ").trim();return n.length<=t?n:`${n.slice(0,t-1)}…`}function Jl(e){return typeof e.content=="string"?e.content.trim():Ec(e).map(t=>t.type==="text"&&typeof t.text=="string"?t.text.trim():"").filter(Boolean).join(" ")}function Zne(e){const t=Ec(e),n=[];for(const r of t)r.type==="tool-call"&&n.push(Kl(r)??"tool");return n}function ere(e,t){if(!e.length)return;const n=lN(e,t.messageStartIndex,t.messageEndIndex);if(n.length!==0){for(let r=n.length-1;r>=0;r--){const s=n[r];if(s.role==="user"){const i=Jl(s);if(i)return tr(i)}}for(const r of n)if(r.role==="system"){const s=Jl(r);if(s)return tr(s)}for(let r=n.length-1;r>=0;r--){const s=n[r];if(s.role==="tool"){const i=Gne(s);if(i&&i!=="No content")return tr(i)}}}}function tre(e,t){if(!e.length)return;const n=ca(t.messageStartIndex,t.messageEndIndex);if(!n)return;const r=e.slice(n.startIndex,n.endIndex+1);for(let s=r.length-1;s>=0;s--){const i=r[s];if(i.role!=="assistant")continue;const o=Jl(i);if(o)return{kind:"text",preview:tr(o)};const a=Zne(i);if(a.length>0)return{kind:"tools",preview:tr(`Calling ${a.join(", ")}`)}}}function nre(e,t,n){const r=Vv(e,t,n);if(typeof r!="number")return;const s=Jl(e[r]);return s?tr(s):void 0}function rre(e,t,n){const r=Vv(e,t,n);if(typeof r=="number")return Jl(e[r])||void 0}function hx(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&&Kl(e)===n)}function sre(e,t,n){if(n)for(let r=n.startIndex;r<=n.endIndex;r+=1){const s=e[r];if(!s)continue;const i=Ec(s);if(i.some(o=>o.type==="tool-call"&&hx(o,t))||i.some(o=>o.type==="tool-result"&&hx(o,t)))return r}}function ire(e,t){const n=Vv(t,e.messageStartIndex,e.messageEndIndex);if(typeof n=="number")return{focusSourceIndex:n,highlightSourceIndices:[n]};const r=oN($ne(e));if(r.length!==0)return{focusSourceIndex:r[0],highlightSourceIndices:r}}function ore(e,t){const n=Wne(e),r=oN(n);if(r.length===0)return;const s=aN(t,n,i=>i.role==="assistant");return{focusSourceIndex:(e.span.category==="tool"?sre(t,e.span,n):void 0)??s??r[0],highlightSourceIndices:r}}function are(e,t,n=!1){const r=rf(e,t.toolCallId,t.toolName??t.name,n?t:void 0);if(r.input==null)return;const s=iN(r.input);if(!(!s||s==="None"))return tr(s)}function Qo({category:e,size:t="sm"}){const n=he(t==="lg"?"h-5 w-5 shrink-0":"h-3.5 w-3.5 shrink-0",Kne(e));switch(e){case"prompt":return(0,m.jsx)(jH,{className:n,"aria-hidden":!0});case"llm":return(0,m.jsx)(yH,{className:n,"aria-hidden":!0});case"tool":return(0,m.jsx)(GH,{className:n,"aria-hidden":!0});case"interaction":return(0,m.jsx)(RH,{className:n,"aria-hidden":!0});case"error":return(0,m.jsx)(bH,{className:n,"aria-hidden":!0});case"connection":case"discovery":case"step":return(0,m.jsx)(v0,{className:n,"aria-hidden":!0});default:return(0,m.jsx)(v0,{className:n,"aria-hidden":!0})}}function lre(e,t){const n=t.promptIndex,r=t.stepIndex;if(typeof n!="number"||typeof r!="number")return{};const s=e.find(i=>i.category==="llm"&&i.promptIndex===n&&i.stepIndex===r);return s?{...typeof s.inputTokens=="number"?{inputTokens:s.inputTokens}:{},...typeof s.outputTokens=="number"?{outputTokens:s.outputTokens}:{},...typeof s.totalTokens=="number"?{totalTokens:s.totalTokens}:{}}:{}}function cre(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=lre(t,e.span);return typeof r.inputTokens=="number"||typeof r.outputTokens=="number"||typeof r.totalTokens=="number"?r:n}function PB(e){return typeof e=="number"?e.toLocaleString():"—"}function fx(e){return typeof e=="number"&&Number.isFinite(e)?new Date(e).toLocaleString():"—"}function ure({traceStartedAtMs:e,traceEndedAtMs:t,traceDurationMs:n}){return typeof e=="number"&&Number.isFinite(e)?e:typeof t=="number"&&Number.isFinite(t)?t-n:null}function yg(e,t,n=!1,r){const{span:s,promptIndex:i}=e,o=s.modelId?.trim()?tr(s.modelId.trim(),56):void 0,a=s.name?.trim()??"";if(s.category==="step"){const l=typeof s.stepIndex=="number"?s.stepIndex+1:void 0,c=typeof l=="number"?`Step ${l}`:a||"Step",u=typeof l=="number"&&(a===`Step ${l}`||a.toLowerCase()===`step ${l}`),d=a&&!u?tr(a,64):c,h=ere(t,s);return h?{title:d,subtitle:h}:o?{title:d,subtitle:o}:{title:d,subtitle:`Prompt ${i+1}`}}if(s.category==="llm"){const l=tre(t,s),c=!a||/^assistant$/i.test(a)||/^llm$/i.test(a)||/^model$/i.test(a)||a==="Model response"||/·\s*response$/i.test(a)?"Agent":tr(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(s.category==="tool"){const l=`Tool · ${(s.toolName??s.name).trim()||"tool"}${r?` · ${r}`:""}`,c=are(t,s,n),u=!c||c==="{}"||c==="None";if(c&&!u)return{title:l,subtitle:c};if(u){const d=rf(t,s.toolCallId,s.toolName??s.name,n?s:void 0);if(d.output!=null){const h=iN(d.output);if(h&&h!=="None"&&h!=="{}")return{title:l,subtitle:tr(h)}}}return typeof s.stepIndex=="number"?{title:l,subtitle:o?`${o} · step ${s.stepIndex+1}`:`step ${s.stepIndex+1}`}:{title:l,subtitle:o}}return{title:s.name,subtitle:typeof s.stepIndex=="number"?o?`${o} · step ${s.stepIndex+1}`:`step ${s.stepIndex+1}`:o}}function bg(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 dre({format:e,onFormatChange:t}){return(0,m.jsx)("div",{className:"flex flex-wrap gap-1",children:["plain","markdown"].map(n=>(0,m.jsx)(kn,{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 Bx({value:e}){const[t,n]=(0,p.useState)("plain");return(0,p.useEffect)(()=>{typeof e=="string"&&n("plain")},[e]),e==null?(0,m.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,m.jsxs)("div",{className:"space-y-2",children:[(0,m.jsx)(dre,{format:t,onFormatChange:n}),t==="markdown"?(0,m.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,m.jsx)(tM,{content:e})}):(0,m.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,m.jsx)(kZ,{value:e,containerClassName:"max-h-56 rounded-md border border-border/60 bg-background"})}function hre({row:e}){return(0,m.jsxs)("div",{"data-testid":"trace-detail-pane",className:"min-h-[280px] rounded-lg bg-muted/5 px-5 py-5",children:[(0,m.jsx)(WM,{step:e.step,leading:(0,m.jsx)(Qo,{category:"interaction",size:"lg"})}),e.step.pluginWorkspace&&(0,m.jsx)(Jte,{recording:e.step.pluginWorkspace})]})}function px(e){return e.split(/[-_\s]+/).filter(Boolean).map(t=>t.charAt(0).toUpperCase()+t.slice(1)).join(" ")}function fre(e){return e.engine==="harness"?e.harness?px(e.harness):"Harness":e.engine==="emulated"?"Emulated":e.harness?px(e.harness):"Unknown"}function Bre({row:e,recordedSpans:t,projectedMessages:n,transcriptMessages:r,onRevealInTranscript:s,turnRuntimeByPromptIndex:i,turnEvent:o}){const a=qM(),l=Sc();if(!e)return(0,m.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,m.jsx)("div",{className:"flex h-14 w-14 items-center justify-center rounded-full border border-border/50 bg-background shadow-sm",children:(0,m.jsx)(wH,{className:"h-7 w-7 text-muted-foreground","aria-hidden":!0})}),(0,m.jsxs)("div",{className:"space-y-1",children:[(0,m.jsx)("p",{className:"text-sm font-medium text-foreground",children:"No span selected"}),(0,m.jsx)("p",{className:"text-xs text-muted-foreground",children:"Click a row or use arrow keys"})]})]});if(e.kind==="interaction")return(0,m.jsx)(hre,{row:e});const c=e.kind==="prompt"?ire(e,r):ore(e,r),u=e.kind==="span"?rf(r,e.span.toolCallId,e.span.toolName??e.span.name,n?e.span:void 0):{},{durationMs:d}=bg(e),h=e.kind==="span"?yg(e,r,n,a(e.span)):null,f=e.kind==="prompt"?e.label:h.title,B=e.kind==="prompt"?e.hasAnyFailure?"error":"ok":So(e.span,r,n)?"error":"ok",g=e.kind==="prompt"?"prompt":e.span.category==="tool"&&So(e.span,r,n)?"error":e.span.category,C=i?.get(e.promptIndex),v=e.kind==="span"&&(e.span.category==="llm"||e.span.category==="step")?Yne(r,e.span.messageStartIndex,e.span.messageEndIndex):{input:null,output:null},y=e.kind==="span"&&e.span.category==="tool"&&(!!e.span.toolCallId||!!(e.span.toolName?.trim()||e.span.name?.trim())),S=e.kind==="prompt"?null:y?u.input:e.kind==="span"&&(e.span.category==="llm"||e.span.category==="step")?v.input:(e.kind==="span"&&e.span.category==="error",null),E=e.kind==="prompt"?null:y?u.output:e.kind==="span"&&(e.span.category==="llm"||e.span.category==="step")?v.output:e.kind==="span"&&e.span.category==="error"?e.span.name:null,D=e.kind==="prompt"?rre(r,e.messageStartIndex,e.messageEndIndex):void 0,A=e.kind==="span"&&(typeof e.span.inputTokens=="number"||typeof e.span.outputTokens=="number"||typeof e.span.totalTokens=="number"),x=e.kind==="prompt"&&(typeof e.aggregatedInputTokens=="number"||typeof e.aggregatedOutputTokens=="number"||typeof e.aggregatedTotalTokens=="number"),O=e.kind==="span"&&u.errorText?u.errorText:null,R=!!(c&&s),P=l?JM(e,t):void 0;return(0,m.jsxs)("div",{"data-testid":"trace-detail-pane",className:"space-y-4 bg-background p-4",children:[(0,m.jsxs)("div",{className:he("border-b border-border/40 pb-3",R?"flex flex-col gap-3 min-[400px]:flex-row min-[400px]:items-start":""),children:[(0,m.jsxs)("div",{className:he("flex gap-3",R?"min-w-0 min-[400px]:flex-1":""),children:[(0,m.jsx)("div",{className:"shrink-0 pt-0.5",children:e.kind==="prompt"?(0,m.jsx)(Qo,{category:"prompt",size:"lg"}):(0,m.jsx)(Qo,{category:g,size:"lg"})}),(0,m.jsxs)("div",{className:"min-w-0 flex-1 space-y-2",children:[(0,m.jsxs)("div",{className:"flex flex-wrap items-center gap-x-2 gap-y-1",children:[(0,m.jsx)("h3",{className:"text-sm font-bold leading-tight text-foreground",children:f}),C?(0,m.jsxs)(Al,{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:C.engine==="harness"?"This turn ran through the harness adapter.":C.engine==="emulated"?"This turn ran through MCPJam's emulated chat engine.":C.harness?"This turn ran through the harness adapter.":"Runtime engine was not recorded for this turn.",children:["Engine: ",fre(C)]}):null,B==="error"?(0,m.jsx)("span",{className:"inline-block h-2 w-2 shrink-0 rounded-full bg-destructive",title:"Error","aria-label":"Error"}):null]}),(0,m.jsxs)("div",{className:"text-xs tabular-nums text-muted-foreground",children:[(0,m.jsx)("span",{className:"font-medium text-foreground",children:ul(d)}),e.kind==="prompt"&&x?(0,m.jsxs)(m.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"&&A?(0,m.jsxs)(m.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,m.jsx)(Tne,{cost:P})]}),(0,m.jsx)(Ane,{cost:P}),e.kind==="span"?(()=>{const _=e.span,N=_.category==="llm"?jne(_.outputTokens,d):null,W=[],q=_.category==="tool"?Qte(_,t):void 0;return q&&W.push({label:"Answered by",value:`the mock: ${q}`}),_.provider&&W.push({label:"Provider",value:_.provider}),_.finishReason&&W.push({label:"Finish",value:_.finishReason}),typeof _.ttfcMs=="number"&&W.push({label:"TTFC",value:ul(_.ttfcMs)}),N!==null&&W.push({label:"Throughput",value:`${N.toFixed(1)} tok/s`}),_.responseId&&W.push({label:"Response ID",value:_.responseId}),W.length===0?null:(0,m.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:W.map(F=>(0,m.jsxs)("span",{className:"truncate",children:[(0,m.jsxs)("span",{className:"text-muted-foreground/70",children:[F.label,":"," "]}),(0,m.jsx)("span",{className:"font-medium text-foreground",children:F.value})]},F.label))})})():null]})]}),R?(0,m.jsx)("div",{className:"flex min-w-0 min-[400px]:flex-1 min-[400px]:justify-end min-[400px]:pt-0.5",children:(0,m.jsxs)(kn,{type:"button",size:"sm",variant:"outline",className:"w-full shrink-0 justify-center whitespace-nowrap min-[400px]:w-auto",onClick:()=>{c&&s&&s(c)},children:[(0,m.jsx)(AH,{className:"h-3.5 w-3.5"}),"Reveal in Chat"]})}):null]}),e.kind==="prompt"&&o?(0,m.jsx)(bne,{turnEvent:o}):null,e.kind==="prompt"&&D?(0,m.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:D}):null,n&&e.kind==="span"&&e.span.messageStartIndex===void 0?(0,m.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,m.jsxs)("div",{className:"space-y-4",children:[(0,m.jsxs)("div",{className:"space-y-2",children:[(0,m.jsx)("div",{className:"text-[10px] uppercase tracking-wide text-muted-foreground",children:"Input"}),(0,m.jsx)(Bx,{value:S??void 0})]}),(0,m.jsxs)("div",{className:he("space-y-2",e.span.category==="error"||O?"rounded-md border border-destructive/50 bg-destructive/50 p-2":""),children:[(0,m.jsx)("div",{className:"text-[10px] uppercase tracking-wide text-muted-foreground",children:"Output"}),(0,m.jsx)(Bx,{value:E??void 0}),O?(0,m.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:O}):null,typeof e.span.mcpErrorCode=="number"?(0,m.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,m.jsx)("span",{className:"text-muted-foreground/70",children:"MCP error: "}),(0,m.jsx)("span",{className:"font-medium text-foreground",children:Ute(e.span.mcpErrorCode)})]}):null]})]}):null]})}function Rce({recordedSpans:e,projectedMessages:t=!1,interactionSteps:n,estimatedDurationMs:r,transcriptMessageCount:s=0,transcriptMessages:i=[],traceStartedAtMs:o=null,traceEndedAtMs:a=null,onRevealInTranscript:l,hideToolbar:c=!1,timelineFilter:u,onTimelineFilterChange:d,expandedPromptIds:h,onExpandedPromptIdsChange:f,expandedStepIds:B,onExpandedStepIdsChange:g,viewportMaxMs:C,turnRuntimeByPromptIndex:v,turnEventByPromptIndex:y,fillContent:S=!1,detailPlacement:E="below",iterationCost:D}){const{containerRef:A,direction:x}=Xte(E),O=x==="horizontal",R=(0,p.useMemo)(()=>t?Kte(e??[],i):void 0,[t,e,i]),P=R?.spans??e,_=kne(P,D),N=_.spans,W=HN(),q=qM(),F=Sc(),z=(0,p.useMemo)(()=>new Set(F?(N??[]).filter(j=>j.cost).map(j=>j.id):[]),[F,N]),J=P&&P.length>0?"recorded":(r??0)>0?"estimated":"none",Z=(0,p.useMemo)(()=>P?.length?Qne(P).map(j=>R?{...j,messageStartIndex:R.userIndices[j.promptIndex]??-1,messageEndIndex:R.userIndices[j.promptIndex]??-1}:j):[],[P,R]),Q=(0,p.useMemo)(()=>{const j=new Map;for(const we of n??[]){const Ae=j.get(we.toolCallId);Ae?Ae.push(we):j.set(we.toolCallId,[we])}for(const we of j.values())we.sort((Ae,Ye)=>Ae.stepIndex-Ye.stepIndex);return j},[n]),G=P?.length?P.reduce((j,we)=>Math.max(j,we.endMs),1):Math.max(r??0,1),be=(0,p.useMemo)(()=>P?.map(j=>`${j.id}:${j.startMs}:${j.endMs}`).join("|")??J,[J,P]),[ve,X]=(0,p.useState)(1);(0,p.useEffect)(()=>{C===void 0&&X(G)},[G,be,C]);const Y=Math.max(1,C!==void 0?C:ve),ie=Math.max(1,Math.round(G/50)),ne=(0,p.useMemo)(()=>ure({traceStartedAtMs:o,traceEndedAtMs:a,traceDurationMs:G}),[G,a,o]),[ee,Be]=(0,p.useState)("all"),de=u!==void 0?u:ee,Re=d??Be,[Ee,st]=(0,p.useState)(new Set),[at,Bt]=(0,p.useState)(new Set),tt=h!==void 0?h:Ee,pt=f??st,Lt=B!==void 0?B:at,mt=g??Bt,[lt,Un]=(0,p.useState)(null),[it,ae]=(0,p.useState)(null),[je,Le]=(0,p.useState)(null),zn=(0,p.useRef)(null),_t=(0,p.useRef)(null),[Vt,Bn]=(0,p.useState)(-1);(0,p.useLayoutEffect)(()=>{const j=_t.current;if(!j)return;const we=()=>{const Ye=j.getBoundingClientRect().width;Bn(Number.isFinite(Ye)?Ye:0)};if(we(),typeof ResizeObserver>"u")return;const Ae=new ResizeObserver(we);return Ae.observe(j),()=>Ae.disconnect()},[x]);const An=(0,p.useMemo)(()=>Lne(Vt),[Vt]),gs=(0,p.useMemo)(()=>An.length!==2?!1:Vt<0||Vt===0?!0:Vt<Pne,[Vt,An]);(0,p.useEffect)(()=>{c||(st(new Set(Z.map(j=>j.key))),Bt(dx(Z)))},[c,Z]);const Ge=(0,p.useMemo)(()=>{if(J!=="recorded")return[];const j=[],we=new Set;function Ae(te){return de==="all"?!0:de==="error"?So(te,i,t):te.category===de}function Ye(te,He,ze){const ct=te.span.category==="step",_e=ct?ze:ze+1,St=te.children.map(mn=>Ye(mn,He,_e)),ot=St.flatMap(mn=>mn.rows),mr=St.some(mn=>mn.hasVisibleContent);if(ct)return{hasVisibleContent:mr||te.children.length>0,rows:ot};if(te.span.category==="llm"&&!z.has(te.span.id)&&typeof te.span.totalTokens!="number"&&typeof te.span.inputTokens!="number"&&typeof te.span.outputTokens!="number"&&te.span.endMs-te.span.startMs<50)return{hasVisibleContent:!1,rows:[]};const Ct=te.span.toolCallId,ys=te.span.category==="tool"&&!!Ct&&!we.has(Ct);ys&&Ct&&we.add(Ct);const wc=ys&&Ct?(Q.get(Ct)??[]).filter(mn=>de==="all"||de==="tool"?!0:de==="error"?Jd(mn)==="error":!1).map((mn,of)=>({kind:"interaction",key:`interaction-${te.span.id}-${mn.stepIndex}-${of}`,promptIndex:He,depth:ze+1,step:mn,startMs:te.span.startMs,endMs:te.span.endMs,status:Jd(mn)})):[];if(!(Ae(te.span)||mr||wc.length>0))return{hasVisibleContent:mr,rows:ot};const ua={kind:"span",key:te.span.id,promptIndex:He,depth:ze,span:te.span,hasChildren:te.children.length>0,isExpanded:Lt.has(te.span.id)};return{hasVisibleContent:!0,rows:[ua,...ua.hasChildren&&ua.isExpanded?ot:[],...wc]}}for(const te of Z){const He=te.roots.map(ot=>Ye(ot,te.promptIndex,0)).flatMap(ot=>ot.rows);if(!(He.length>0||de==="all"&&te.spans.length>0))continue;const ze=te.spans.some(ot=>So(ot,i,t)),ct=nre(i,te.messageStartIndex,te.messageEndIndex),_e=Fne(te.spans),St=y?.get(te.promptIndex);j.push({kind:"prompt",key:te.key,promptIndex:te.promptIndex,label:te.label,conversationLabel:St?fne(St.event):ct?`User: "${ct}"`:void 0,startMs:te.startMs,endMs:te.endMs,messageStartIndex:te.messageStartIndex,messageEndIndex:te.messageEndIndex,counts:te.counts,hasAnyFailure:ze,isExpanded:tt.has(te.key),aggregatedInputTokens:_e.inputTokens,aggregatedOutputTokens:_e.outputTokens,aggregatedTotalTokens:_e.totalTokens}),tt.has(te.key)&&j.push(...He)}return j},[tt,Lt,de,Z,Q,J,i,t,z,y]),Cs=(0,p.useMemo)(()=>dx(Z),[Z]),Kt=(0,p.useMemo)(()=>{if(Z.length===0)return!1;for(const j of Z)if(!tt.has(j.key))return!1;for(const j of Cs)if(!Lt.has(j))return!1;return!0},[Z,tt,Lt,Cs]);(0,p.useEffect)(()=>{if(Ge.length===0){Un(null);return}(!lt||!Ge.some(j=>j.key===lt))&&Un(Ge[0].key)},[Ge,lt]);const vs=Ge.find(j=>j.key===lt),Qe=it?Ge.find(j=>j.key===it):void 0,xc=it?Ge.findIndex(j=>j.key===it):-1;(0,p.useEffect)(()=>{it&&!Ge.some(j=>j.key===it)&&(ae(null),Le(null),zn.current=null)},[it,Ge]);const ti=(0,p.useCallback)(j=>{const we=(j.querySelector('[data-testid="trace-row-glyph"]')??j).getBoundingClientRect();return{anchorX:we.left+we.width/2,anchorY:we.top,anchorBottom:we.bottom}},[]);(0,p.useEffect)(()=>{if(!it)return;const j=()=>{const we=zn.current;we&&Le(ti(we))};return window.addEventListener("scroll",j,!0),window.addEventListener("resize",j),()=>{window.removeEventListener("scroll",j,!0),window.removeEventListener("resize",j)}},[it,ti]);const pn=(0,p.useMemo)(()=>{if(!Qe)return null;const{startMs:j,endMs:we}=bg(Qe),Ae=Qe.kind==="span"&&So(Qe.span,i,t),Ye=Qe.kind==="span"?yg(Qe,i,t,q(Qe.span)):null,te=Qe.kind==="prompt"?Qe.conversationLabel??Qe.label:Qe.kind==="interaction"?Jo(Qe.step):Ye.title,He=cre(Qe,P),ze=Qe.kind==="prompt"?"prompt":Qe.kind==="interaction"?"interaction":Qe.span.category==="tool"&&Ae?"error":Qe.span.category;return{label:te,spanShowsFailure:Ae,tokenStats:He,rowStartTimestamp:ne!==null?ne+j:null,rowEndTimestamp:ne!==null?ne+we:null,glyphCategory:ze,cost:F?JM(Qe,N):void 0}},[Qe,P,N,ne,i,t,q,F]),sf=(0,p.useCallback)(j=>{if(Ge.length===0)return;const we=Ge.findIndex(Ae=>Ae.key===lt);if(j.key==="ArrowDown"){j.preventDefault();const Ae=we<0?0:Math.min(Ge.length-1,we+1);Un(Ge[Ae].key);return}if(j.key==="ArrowUp"){j.preventDefault();const Ae=we<=0?0:we-1;Un(Ge[Ae].key);return}if(j.key==="Enter"&&we>=0){const Ae=Ge[we];if(Ae.kind==="prompt"){j.preventDefault();const Ye=new Set(tt);Ye.has(Ae.key)?Ye.delete(Ae.key):Ye.add(Ae.key),pt(Ye);return}if(Ae.kind==="span"&&Ae.hasChildren){j.preventDefault();const Ye=new Set(Lt);Ye.has(Ae.key)?Ye.delete(Ae.key):Ye.add(Ae.key),mt(Ye)}}},[tt,Lt,Ge,lt,pt,mt]),ni=(0,m.jsxs)(m.Fragment,{children:[_.loader,(0,m.jsx)(One,{spans:N,iteration:D,unmatched:_.unmatched})]});if(J==="none")return(0,m.jsxs)(m.Fragment,{children:[ni,(0,m.jsx)("div",{className:"text-xs text-muted-foreground",children:"No timing data recorded for this iteration."})]});if(J==="estimated")return(0,m.jsxs)("div",{className:"space-y-3",children:[ni,(0,m.jsxs)("div",{className:"flex items-center gap-2",children:[(0,m.jsx)(Al,{className:"border-warning/50 bg-warning/50 text-foreground",children:"Estimated total only"}),(0,m.jsx)("span",{className:"text-xs text-muted-foreground",children:ul(r??0)})]}),(0,m.jsxs)("div",{className:"space-y-1 text-[11px] text-muted-foreground",children:[(0,m.jsx)("p",{children:"Per-step timing was not recorded for this run."}),s>0?(0,m.jsxs)("p",{children:["Conversation detail is in the Chat tab. Open"," ",(0,m.jsx)("span",{className:"font-medium text-foreground/80",children:"Raw"})," to inspect the stored trace and confirm whether a"," ",(0,m.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 pr=C===void 0?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(kn,{type:"button",variant:"outline",size:"icon",className:"h-7 w-7 border-border/50",title:"Zoom in timeline","aria-label":"Zoom in timeline",disabled:ve<=ie,onClick:()=>X(j=>Math.max(ie,Math.round(j*.8))),children:(0,m.jsx)(MH,{className:"size-3.5","aria-hidden":!0})}),(0,m.jsx)(kn,{type:"button",variant:"outline",size:"icon",className:"h-7 w-7 border-border/50",title:"Zoom out timeline","aria-label":"Zoom out timeline",disabled:ve>=G*4,onClick:()=>X(j=>Math.min(G*4,Math.round(j*1.25))),children:(0,m.jsx)(kH,{className:"size-3.5","aria-hidden":!0})})]}):null;return(0,m.jsxs)("div",{className:he("space-y-2",S&&"flex min-h-0 flex-1 flex-col"),children:[c?null:(0,m.jsxs)("div",{className:S?"shrink-0":void 0,children:[(0,m.jsx)(ene,{filter:de,onFilterChange:Re,isFullyExpanded:Kt,expandDisabled:Z.length===0,zoomControls:pr,onToggleExpandAll:()=>{Kt?(pt(new Set),mt(new Set)):(pt(new Set(Z.map(j=>j.key))),mt(new Set(Cs)))}}),(0,m.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:j,cls:we})=>(0,m.jsxs)("span",{className:"flex items-center gap-1.5",children:[(0,m.jsx)("span",{className:he("h-2 w-2.5 rounded-sm",we)}),j]},j))})]}),ni,(0,m.jsx)("div",{ref:A,className:he("@container/trace-timeline min-w-0",S&&"flex min-h-0 flex-1 flex-col"),children:(0,m.jsxs)(Lee,{direction:x,className:he("rounded-lg border border-border/50 bg-background",S?"min-h-0 flex-1 overflow-hidden":"min-h-[min(25rem,calc(100dvh-8rem))]"),style:S?void 0:{height:"auto"},children:[(0,m.jsx)(Cg,{defaultSize:O?62:65,minSize:0,className:"min-h-0 min-w-0 overflow-hidden",children:(0,m.jsx)(Gee,{className:he(S?"h-full min-h-0 overflow-hidden":"max-h-[calc(100vh-8rem)] min-h-0"),children:(0,m.jsx)("div",{tabIndex:0,role:"region","aria-label":"Trace timeline. Use arrow keys to change selection, Enter to expand.",onKeyDown:sf,className:"relative min-h-0 outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",children:(0,m.jsxs)("div",{className:"grid pr-4",style:{gridTemplateColumns:"minmax(140px, 260px) minmax(0, 1fr) minmax(5.25rem, max-content)",gridTemplateRows:`auto repeat(${Ge.length}, minmax(48px, auto))`},children:[(0,m.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,m.jsxs)("div",{className:"flex min-h-6 min-w-0 items-center gap-3",children:[(0,m.jsx)("div",{className:"shrink-0 text-[10px] uppercase tracking-wide text-muted-foreground",children:"Trace"}),(0,m.jsx)("div",{className:"min-h-6 min-w-0 flex-1",children:(0,m.jsx)("div",{ref:_t,className:"relative h-6 min-w-0",children:gs?(0,m.jsx)("div",{className:"flex h-full min-w-0 items-center justify-center",children:(0,m.jsx)("span",{className:"min-w-0 max-w-full truncate text-center text-[10px] tabular-nums text-muted-foreground",title:cx(Y),children:cx(Y)})}):An.map(j=>{const we=j>=100?"100%":`${j}%`;return(0,m.jsx)("div",{className:"pointer-events-none absolute inset-y-0",style:{left:we},children:(0,m.jsx)("div",{className:he("absolute text-[10px] tabular-nums text-muted-foreground",_ne(j)),children:ad(Y*j/100)})},j)})})})]})}),(0,m.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,m.jsxs)("div",{className:"flex h-6 w-full min-w-0 items-center justify-start gap-1.5",children:[(0,m.jsx)(C0,{className:"size-3 shrink-0 text-muted-foreground","aria-hidden":!0}),(0,m.jsx)("span",{className:"text-[10px] font-semibold uppercase tracking-wide text-muted-foreground",children:"Latency"})]})}),Ge.length>0?(0,m.jsx)("div",{className:"pointer-events-none relative z-0 bg-transparent",style:{gridColumn:2,gridRow:`2 / ${Ge.length+2}`},children:An.map(j=>(0,m.jsx)("div",{className:"absolute top-0 bottom-0 w-px bg-border/40",style:{left:j>=100?"100%":`${j}%`}},j))}):null,Ge.map((j,we)=>{const Ae=j.key===lt,{startMs:Ye,endMs:te,durationMs:He}=bg(j),ze=Ye/Y*100,ct=Math.max((te-Ye)/Y*100,.45),_e=j.kind==="span"&&So(j.span,i,t),St=j.kind==="prompt"?"prompt":j.kind==="interaction"?"interaction":j.span.category==="tool"&&_e?"error":j.span.category,ot=j.kind==="interaction"&&j.status==="error",mr=j.kind==="span"?yg(j,i,t):null,Ct=j.kind==="prompt"?j.conversationLabel??j.label:j.kind==="interaction"?Jo(j.step):mr.title,ys=ul(He),wc=j.kind==="prompt"?!0:j.kind==="interaction"?!1:j.hasChildren||j.span.category==="llm",ua=we+2,mn=Jne(j,_e),of=qne(j,_e),Uv=()=>{Ed("trace_span_clicked",{location:"trace_timeline",span_kind:j.kind}),Un(j.key)},af=gn=>{gn.stopPropagation(),Uv()},cN=Ae?he("bg-transparent",mn):"border-l-transparent bg-background group-hover:bg-muted/20 hover:bg-muted/20",zv=Ae?"bg-transparent":"bg-background group-hover:bg-muted/20 hover:bg-muted/20";return(0,m.jsxs)(TT.div,{"data-testid":"trace-row","data-state":Ae?"selected":void 0,onClick:Uv,onMouseEnter:gn=>{ae(j.key);const Cn=gn.currentTarget;zn.current=Cn,Le(ti(Cn))},onMouseLeave:()=>{ae(gn=>gn===j.key?null:gn),Le(null),zn.current=null},onFocus:gn=>{ae(j.key);const Cn=gn.currentTarget;zn.current=Cn,Le(ti(Cn))},onBlur:gn=>{gn.currentTarget.contains(gn.relatedTarget)||(ae(Cn=>Cn===j.key?null:Cn),Le(null),zn.current=null)},initial:W||we>=20?!1:{opacity:0,y:6},animate:{opacity:1,y:0},transition:W||we>=20?{duration:0}:{duration:.15,delay:we*.03+.05,ease:[.16,1,.3,1]},style:{gridColumn:"1 / 4",gridRow:ua,display:"grid",gridTemplateColumns:"subgrid"},className:he("group min-h-0 min-w-0 cursor-pointer items-stretch",Ae&&"trace-waterfall-row-selected ring-1 ring-inset ring-ring/40"),children:[(0,m.jsxs)("div",{className:he("flex items-center gap-2 border-b border-border/40 px-4 py-2 transition-all duration-150 border-l-2",cN),children:[(0,m.jsx)("div",{className:"flex shrink-0 items-center",style:{paddingLeft:j.kind==="prompt"?0:j.depth*16},children:wc?(0,m.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:gn=>{if(gn.stopPropagation(),j.kind==="prompt"){const Dc=new Set(tt);Dc.has(j.key)?Dc.delete(j.key):Dc.add(j.key),pt(Dc);return}const Cn=new Set(Lt);Cn.has(j.key)?Cn.delete(j.key):Cn.add(j.key),mt(Cn)},"aria-label":j.kind==="prompt"?`${j.isExpanded?"Collapse":"Expand"} ${j.label}`:`${"isExpanded"in j&&j.isExpanded?"Collapse":"Expand"} ${Ct}`,children:"isExpanded"in j&&j.isExpanded?(0,m.jsx)(gD,{className:"h-3.5 w-3.5"}):(0,m.jsx)(Mo,{className:"h-3.5 w-3.5"})}):(0,m.jsx)("span",{className:"mr-1 h-5 w-5"})}),(0,m.jsx)("button",{type:"button","data-testid":"trace-row-label-button",className:"min-w-0 flex-1 text-left",onClick:af,children:(0,m.jsxs)("div",{className:"flex min-w-0 items-center gap-2",children:[(0,m.jsx)("span",{"data-testid":"trace-row-glyph",className:"inline-flex shrink-0 items-center",children:j.kind==="prompt"?(0,m.jsx)(Qo,{category:"prompt"}):(0,m.jsx)(Qo,{category:St})}),(0,m.jsx)("span",{className:"min-w-0 flex-1 truncate text-sm font-medium text-foreground",children:Ct}),j.kind==="prompt"?(0,m.jsx)(tN,{event:y?.get(j.promptIndex)?.event}):null,(0,m.jsx)(xJ,{name:j.kind==="span"?q(j.span):void 0}),j.kind==="prompt"&&j.hasAnyFailure?(0,m.jsx)("span",{className:"inline-block h-2 w-2 shrink-0 rounded-full bg-destructive",title:"Contains errors","aria-label":"Contains errors"}):null,j.kind==="span"&&_e||ot?(0,m.jsx)("span",{className:"inline-block h-2 w-2 shrink-0 rounded-full bg-destructive",title:"Error","aria-label":"Error"}):null]})})]}),(0,m.jsx)("button",{type:"button","data-testid":"trace-row-bar-hit","data-state":Ae?"selected":void 0,className:he("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",zv),"aria-label":`Select on timeline (${ul(He)})`,onClick:af,children:(0,m.jsx)("div",{"data-testid":j.kind==="span"&&_e?"trace-row-bar-error":"trace-row-bar",className:he("absolute top-1/2 z-[1] h-4 min-w-0 -translate-y-1/2 rounded-[3px] transition-[left,width] duration-150",of),style:{left:`${ze}%`,width:`max(${ct}%, 3px)`}})}),(0,m.jsxs)("button",{type:"button","data-testid":"trace-row-duration-hit","data-state":Ae?"selected":void 0,className:he("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",zv),"aria-label":`Select row duration (${ys})`,onClick:af,children:[(0,m.jsx)(C0,{className:"size-3 shrink-0 opacity-80","aria-hidden":!0}),ys]})]},j.key)})]})})})}),(0,m.jsx)(_ee,{withHandle:!0}),(0,m.jsx)(Cg,{defaultSize:O?38:35,minSize:O?25:20,className:"min-h-0 min-w-0 overflow-hidden",children:(0,m.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,m.jsx)(Bre,{projectedMessages:t,row:vs,recordedSpans:N,transcriptMessages:i,onRevealInTranscript:l,turnRuntimeByPromptIndex:v,turnEvent:vs?.kind==="prompt"?y?.get(vs.promptIndex):void 0})})})]},x)}),Qe&&pn&&je?(0,m.jsx)(pre,{hoverPos:je,info:pn,placement:xc===0?"bottom":"top",reduceMotion:W??!1,rowKey:Qe.key}):null]})}function pre({hoverPos:e,info:t,placement:n,reduceMotion:r,rowKey:s}){if(typeof document>"u")return null;const i=304,o=12,a=8,l=i/2,c=typeof window<"u"?window.innerWidth:e.anchorX+l+o,u=164,d=Math.max(u,c-l-o),h=Math.min(Math.max(e.anchorX,u),d),f={position:"fixed",top:n==="top"?e.anchorY-a:e.anchorBottom+a,left:h,transform:n==="top"?"translate(-50%, -100%)":"translateX(-50%)",zIndex:9999};return(0,Yo.createPortal)((0,m.jsx)("div",{className:"pointer-events-none",style:f,children:(0,m.jsx)(TT.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,m.jsxs)("div",{"data-testid":"trace-row-hover-card",className:"space-y-3 p-3",children:[(0,m.jsxs)("div",{className:"flex min-w-0 items-center gap-2",children:[(0,m.jsx)(Qo,{category:t.glyphCategory}),(0,m.jsx)("span",{className:"min-w-0 flex-1 truncate text-xs font-semibold text-popover-foreground",children:t.label})]}),(0,m.jsxs)("div",{className:"space-y-1.5",children:[(0,m.jsx)("div",{className:"text-[10px] font-semibold uppercase tracking-wide text-popover-foreground/65",children:"Time"}),(0,m.jsxs)("div",{className:"space-y-1 text-xs",children:[(0,m.jsxs)("div",{className:"flex min-w-0 items-baseline justify-between gap-3",children:[(0,m.jsx)("span",{className:"shrink-0 text-popover-foreground/70",children:"Start"}),(0,m.jsx)("span",{"data-testid":"trace-row-hover-start",className:"min-w-0 text-right font-medium text-popover-foreground tabular-nums",children:fx(t.rowStartTimestamp)})]}),(0,m.jsxs)("div",{className:"flex min-w-0 items-baseline justify-between gap-3",children:[(0,m.jsx)("span",{className:"shrink-0 text-popover-foreground/70",children:"End"}),(0,m.jsx)("span",{"data-testid":"trace-row-hover-end",className:"min-w-0 text-right font-medium text-popover-foreground tabular-nums",children:fx(t.rowEndTimestamp)})]})]})]}),(0,m.jsxs)("div",{className:"space-y-1.5",children:[(0,m.jsx)("div",{className:"text-[10px] font-semibold uppercase tracking-wide text-popover-foreground/65",children:"Tokens"}),(0,m.jsxs)("div",{className:"space-y-1 text-xs",children:[(0,m.jsxs)("div",{className:"flex min-w-0 items-baseline justify-between gap-3",children:[(0,m.jsx)("span",{className:"shrink-0 text-popover-foreground/70",children:"Input"}),(0,m.jsx)("span",{"data-testid":"trace-row-hover-input-tokens",className:"min-w-0 text-right font-medium text-popover-foreground tabular-nums",children:PB(t.tokenStats.inputTokens)})]}),(0,m.jsxs)("div",{className:"flex min-w-0 items-baseline justify-between gap-3",children:[(0,m.jsx)("span",{className:"shrink-0 text-popover-foreground/70",children:"Output"}),(0,m.jsx)("span",{"data-testid":"trace-row-hover-output-tokens",className:"min-w-0 text-right font-medium text-popover-foreground tabular-nums",children:PB(t.tokenStats.outputTokens)})]}),(0,m.jsxs)("div",{className:"flex min-w-0 items-baseline justify-between gap-3",children:[(0,m.jsx)("span",{className:"shrink-0 text-popover-foreground/70",children:"Total"}),(0,m.jsx)("span",{"data-testid":"trace-row-hover-total-tokens",className:"min-w-0 text-right font-medium text-popover-foreground tabular-nums",children:PB(t.tokenStats.totalTokens)})]})]})]}),(0,m.jsx)(Ine,{cost:t.cost})]})},s)}),document.body)}export{tce as $,Ds as $a,Sw as $c,wW as $i,zae as $n,cse as $o,Zie as $r,Nre as $s,Ele as $t,Rte as A,Xse as Aa,OH as Ac,Nie as Ai,Tv as An,lA as Ao,Hoe as Ar,Lo as As,ece as At,uce as B,Ho as Ba,_s as Bc,bie as Bi,qJ as Bn,bse as Bo,Noe as Br,IT as Bs,Ple as Bt,yce as C,Xa as Ca,jH as Cc,Lie as Ci,nee as Cn,Np as Co,rae as Cr,rse as Cs,ite as Ct,zM as D,eie as Da,_H as Dc,iI as Di,JZ as Dn,Ase as Do,$oe as Dr,Xre as Ds,cte as Dt,vce as E,tie as Ea,dh as Ec,Oie as Ei,eee as En,wse as Eo,Woe as Er,_n as Es,Hle as Et,Bce as F,Al as Fa,TH as Fc,KC as Fi,OZ as Fn,Ese as Fo,Ioe as Fr,B5 as Fs,oce as Ft,gte as G,Use as Ga,Vs as Gc,gie as Gi,Qae as Gn,vse as Go,Coe as Gr,u5 as Gs,Nle as Gt,lce as H,E4 as Ha,bH as Hc,ir as Hi,Zae as Hn,yse as Ho,_oe as Hr,d5 as Hs,bc as Ht,pce as I,Wse as Ia,DH as Ic,Aie as Ii,kZ as In,JT as Io,xoe as Ir,n5 as Is,Zh as It,hte as J,Fse as Ja,oF as Jc,DW as Ji,BJ as Jn,V5 as Jo,c8 as Jr,$re as Js,lte as Jt,ace as K,fA as Ka,yH as Kc,eI as Ki,Jae as Kn,Cse as Ko,Aoe as Kr,c5 as Ks,Pv as Kt,cce as L,$se as La,wH as Lc,Iie as Li,TZ as Ln,r$ as Lo,Soe as Lr,r5 as Ls,Mle as Lt,gce as M,Zse as Ma,kH as Mc,HW as Mi,tM as Mn,xh as Mo,Toe as Mr,Kre as Ms,jM as Mt,mce as N,yA as Na,IH as Nc,_W as Ni,cle as Nn,NC as No,woe as Nr,qre as Ns,Ko as Nt,Cce as O,Jse as Oa,NH as Oc,Pie as Oi,dle as On,f3 as Oo,zoe as Or,DC as Os,ate as Ot,hce as P,Qse as Pa,AH as Pc,FW as Pi,lle as Pn,u$ as Po,boe as Pr,Wre as Ps,qle as Pt,Xee as Q,xs as Qa,$_ as Qc,KA as Qi,Vae as Qn,qT as Qo,eoe as Qr,_re as Qs,Tle as Qt,dce as R,qse as Ra,xH as Rc,Eie as Ri,SZ as Rn,Eh as Ro,Eoe as Rr,Rre as Rs,tte as Rt,Hte as S,oie as Sa,GH as Sc,Hie as Si,see as Sn,Ise as So,hae as Sr,Qre as Ss,zle as St,Sce as T,EA as Ta,FH as Tc,Rie as Ti,Dv as Tn,Dse as To,qoe as Tr,Zre as Ts,Vle as Tt,dte as U,pA as Ua,Mo as Uc,vie as Ui,Xae as Un,q5 as Uo,goe as Ur,jre as Us,nte as Ut,bte as V,zse as Va,C0 as Vc,Ah as Vi,xJ as Vn,X5 as Vo,Moe as Vr,Mre as Vs,jle as Vt,Bte as W,S4 as Wa,gD as Wc,Cie as Wi,Yae as Wn,K5 as Wo,voe as Wr,zre as Ws,Lle as Wt,_le as X,jse as Xa,Aw as Xc,Dh as Xi,_ae as Xn,mse as Xo,foe as Xr,Ure as Xs,Cle as Xt,Yle as Y,Hse as Ya,iF as Yc,Bie as Yi,Kae as Yn,gse as Yo,hoe as Yr,Gre as Ys,Xh as Yt,Yee as Z,_se as Za,bw as Zc,zp as Zi,jae as Zn,H5 as Zo,Boe as Zr,Hre as Zs,Ale as Zt,Dce as _,lie as _a,Fs as _c,Vie as _i,wg as _l,hle as _n,kse as _o,uae as _r,ose as _s,sce as _t,ql as a,hie as aa,kre as ac,Aq as ai,kg as al,Dle as an,Rse as ao,fJ as ar,fse as as,mu as at,jte as b,aie as ba,Dre as bc,dq as bi,gt as bl,Cg as bn,t4 as bo,lae as br,ese as bs,Gle as bt,Ace as c,gW as ca,gV as cc,el as ci,Hx as cl,yle as cn,i4 as co,hJ as cr,IC as cs,Ule as ct,ZM as d,BW as da,E0 as dc,Uie as di,Yd as dl,RM as dn,Ose as do,Tae as dr,lse as ds,Qle as dt,yW as ea,Fre as ec,noe as ei,_g as el,Kee as en,o4 as eo,Gae as er,VT as es,Xle as et,QM as f,dc as fa,ij as fc,zie as fi,Ii as fl,fle as fn,Mse as fo,xae as fr,Bse as fs,Zee as ft,wce as g,iie as ga,KH as gc,Gie as gi,Se as gl,Vee as gn,cb as go,dae as gr,sse as gs,rce as gt,ene as h,sie as ha,Ta as hc,Pq as hi,wn as hl,Gee as hn,_C as ho,vae as hr,ise as hs,Rle as ht,Lne as i,JA as ia,TT as ic,$b as ii,nw as il,vle as in,LC as io,$ae as ir,hse as is,Ile as it,Kd as j,Yse as ja,RH as jc,Ih as ji,ule as jn,tn as jo,eae as jr,m5 as js,HM as jt,$M as k,T4 as ka,MH as kc,kie as ki,ZZ as kn,Tse as ko,joe as kr,y5 as ks,ste as kt,Ice as l,jA as la,qe as lc,Wie as li,kP as ll,qee as ln,r4 as lo,Mae as lr,UT as ls,Kle as lt,JM as m,rie as ma,Tre as mc,Lq as mi,Xl as ml,mle as mn,Nse as mo,Cae as mr,ase as ms,ete as mt,Qne as n,WA as na,Lre as nc,roe as ni,sw as nl,xle as nn,a4 as no,Fae as nr,OC as ns,rte as nt,kce as o,fc as oa,WU as oc,qp as oi,Kx as ol,ble as on,FC as oo,Lae as or,pse as os,ice as ot,YM as p,lW as pa,qD as pc,qie as pi,Hr as pl,ple as pn,Pse as po,Sae as pr,P5 as ps,$le as pt,mte as q,Vse as qa,Yw as qc,fie as qi,nS as qn,Ed as qo,Yp as qr,Vre as qs,nce as qt,dx as r,bW as ra,ra as rc,Yie as ri,EL as rl,wle as rn,Lse as ro,Uae as rr,use as rs,Zle as rt,Sc as s,cie as sa,pT as sc,Tq as si,MP as sl,Sle as sn,Pu as so,Nae as sr,O5 as ss,Jle as st,Rce as t,QA as ta,Pre as tc,toe as ti,sh as tl,gle as tn,ws as to,Hae as tr,zT as ts,Wle as tt,Tce as u,UA as ua,Bh as uc,$ie as ui,Nt as ul,Wee as un,s4 as uo,Oae as ur,dse as us,ote as ut,zte as v,hW as va,Yg as vc,Sq as vi,fs as vl,ba as vn,n4 as vo,oae as vr,nse as vs,Lv as vt,Ece as w,_u as wa,HH as wc,Mie as wi,uM as wn,C3 as wo,Koe as wr,tse as ws,kle as wt,bce as x,dW as xa,fh as xc,cq as xi,Lee as xn,K3 as xo,iae as xr,Jre as xs,Ole as xt,qte as y,fW as ya,hh as yc,bq as yi,rP as yl,_ee as yn,Dd as yo,aae as yr,Yre as ys,Nv as yt,fce as z,Kse as za,EH as zc,Sie as zi,XJ as zn,Sse as zo,yoe as zr,Ore as zs,Fle as zt};
|
|
92
|
+
|
|
93
|
+
//# sourceMappingURL=trace-timeline-Dn4BLNrQ.js.map
|