@cline/cli-windows-x64 3.0.30 → 3.0.31-nightly.1782685864
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/bin/cline.exe +0 -0
- package/cline-hub/webview/assets/Chat-B1-IjjcY.js +197 -0
- package/cline-hub/webview/assets/{extensions-view-Czr1F6UU.js → extensions-view-BxKh4fke.js} +1 -1
- package/cline-hub/webview/assets/{index-COgdQxvL.js → index-BGdYnZ-k.js} +2 -2
- package/cline-hub/webview/assets/{label-CWJcfOco.js → label-Mo02KX88.js} +1 -1
- package/cline-hub/webview/assets/{mermaid.core-bKbkko4L.js → mermaid.core-CiYLsDpO.js} +6 -6
- package/cline-hub/webview/assets/{settings-view-D3YT4VdK.js → settings-view-Dap2DoPb.js} +1 -1
- package/cline-hub/webview/index.html +1 -1
- package/package.json +1 -1
- package/cline-hub/webview/assets/Chat-L1CH__f4.js +0 -201
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./bash-B7CDPTg5.js","./shellscript-CLZ0U2zV.js","./html-BY76lXLH.js","./css-BsVw1vtW.js","./javascript-BgS3c2Ky.js","./mermaid.core-CiYLsDpO.js","./mermaid-parser-kNaey6uv.js","./chunk-O5CBEL6O-BsgSq8yj.js","./src-BOORkYYF.js","./rolldown-runtime-Cyuzqnbw.js","./chunk-5ZQYHXKU-Cl_wv1xY.js","./dist-BWmyBWFf.js","./chunk-CSCIHK7Q-CF15Zetb.js","./mermaid-markup-B0el00jA.js","./chunk-3OPIFGDE-x-ISkqhG.js","./chunk-L5ZTLDWV-pMGqLM5o.js","./chunk-NZK2D7GU-C-cyh3Oz.js","./rough.esm-CSKSodPl.js","./chunk-BSJP7CBP-BS0Fn1lu.js","./chunk-KSCS5N6A-oDwWfb-J.js","./line-CCCfjwrh.js","./path-BWPyau1x.js","./array-BifhSqXX.js","./chunk-LZXEDZCA-CZOmMbjk.js","./chunk-WU5MYG2G-Dy3guuAS.js","./chunk-XPW4576I-_W3lCQaj.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{a as e,i as t,n,r}from"./rolldown-runtime-Cyuzqnbw.js";import{i,r as a}from"./bundle-mjs-CPvDmBTC.js";import{t as o}from"./react-dom-hobdzdVk.js";import{B as s,Bt as c,E as l,L as u,O as d,R as f,S as p,T as m,Vt as h,at as g,b as _,c as v,et as y,j as b,k as x,n as S,t as C,v as w,w as ee,xt as T,y as E,z as D}from"./vscode-DK7ayvks.js";import{F as O,I as k,M as te,N as A,P as ne,_ as re,c as ie,g as j,h as ae,i as oe,j as se,l as ce,m as le,n as ue,o as de,p as fe,r as pe,t as me,v as he,y as ge}from"./label-Mo02KX88.js";import{a as _e,i as ve,r as ye,t as be}from"./switch-O5JzNA9x.js";import{t as M}from"./mermaid-parser-kNaey6uv.js";import{Dt as xe,G as Se,J as Ce,L as we,U as Te,V as Ee,Y as De,ct as Oe,dt as ke,ft as Ae,kt as je,l as Me,lt as Ne,q as Pe,ut as Fe,z as Ie}from"./index-BGdYnZ-k.js";import{n as Le,t as Re}from"./badge-CCf0mJUQ.js";import{_ as ze,c as Be,d as Ve,f as He,g as Ue,h as We,l as Ge,m as Ke,o as qe,p as Je,r as Ye,s as Xe,u as Ze,v as Qe,y as $e}from"./chunk-BO2N2NFS-WeGK2y8v.js";var et=m(`arrow-down`,[[`path`,{d:`M12 5v14`,key:`s699le`}],[`path`,{d:`m19 12-7 7-7-7`,key:`1idqje`}]]),tt=m(`bookmark`,[[`path`,{d:`M17 3a2 2 0 0 1 2 2v15a1 1 0 0 1-1.496.868l-4.512-2.578a2 2 0 0 0-1.984 0l-4.512 2.578A1 1 0 0 1 5 20V5a2 2 0 0 1 2-2z`,key:`oz39mx`}]]),nt=m(`brain`,[[`path`,{d:`M12 18V5`,key:`adv99a`}],[`path`,{d:`M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4`,key:`1e3is1`}],[`path`,{d:`M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5`,key:`1gqd8o`}],[`path`,{d:`M17.997 5.125a4 4 0 0 1 2.526 5.77`,key:`iwvgf7`}],[`path`,{d:`M18 18a4 4 0 0 0 2-7.464`,key:`efp6ie`}],[`path`,{d:`M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517`,key:`1gq6am`}],[`path`,{d:`M6 18a4 4 0 0 1-2-7.464`,key:`k1g0md`}],[`path`,{d:`M6.003 5.125a4 4 0 0 0-2.526 5.77`,key:`q97ue3`}]]),rt=m(`circle-check-big`,[[`path`,{d:`M21.801 10A10 10 0 1 1 17 3.335`,key:`yps3ct`}],[`path`,{d:`m9 11 3 3L22 4`,key:`1pflzl`}]]),it=m(`circle-x`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m15 9-6 6`,key:`1uzhvr`}],[`path`,{d:`m9 9 6 6`,key:`z0biqf`}]]),at=m(`corner-down-left`,[[`path`,{d:`M20 4v7a4 4 0 0 1-4 4H4`,key:`6o5b7l`}],[`path`,{d:`m9 10-5 5 5 5`,key:`1kshq7`}]]),ot=m(`file-code`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 12.5 8 15l2 2.5`,key:`1tg20x`}],[`path`,{d:`m14 12.5 2 2.5-2 2.5`,key:`yinavb`}]]),st=m(`git-branch`,[[`path`,{d:`M15 6a9 9 0 0 0-9 9V3`,key:`1cii5b`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}],[`circle`,{cx:`6`,cy:`18`,r:`3`,key:`fqmcym`}]]),ct=m(`globe`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20`,key:`13o1zl`}],[`path`,{d:`M2 12h20`,key:`9i4pu4`}]]),lt=m(`hat-glasses`,[[`path`,{d:`M14 18a2 2 0 0 0-4 0`,key:`1v8fkw`}],[`path`,{d:`m19 11-2.11-6.657a2 2 0 0 0-2.752-1.148l-1.276.61A2 2 0 0 1 12 4H8.5a2 2 0 0 0-1.925 1.456L5 11`,key:`1fkr7p`}],[`path`,{d:`M2 11h20`,key:`3eubbj`}],[`circle`,{cx:`17`,cy:`18`,r:`3`,key:`82mm0e`}],[`circle`,{cx:`7`,cy:`18`,r:`3`,key:`lvkj7j`}]]),ut=m(`messages-square`,[[`path`,{d:`M16 10a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 14.286V4a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2z`,key:`1n2ejm`}],[`path`,{d:`M20 9a2 2 0 0 1 2 2v10.286a.71.71 0 0 1-1.212.502l-2.202-2.202A2 2 0 0 0 17.172 19H10a2 2 0 0 1-2-2v-1`,key:`1qfcsi`}]]),dt=m(`music-2`,[[`circle`,{cx:`8`,cy:`18`,r:`4`,key:`1fc0mg`}],[`path`,{d:`M12 18V2l7 4`,key:`g04rme`}]]),ft=m(`paperclip`,[[`path`,{d:`m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551`,key:`1miecu`}]]),pt=m(`settings-2`,[[`path`,{d:`M14 17H5`,key:`gfn3mx`}],[`path`,{d:`M19 7h-9`,key:`6i9tg`}],[`circle`,{cx:`17`,cy:`17`,r:`3`,key:`18b49y`}],[`circle`,{cx:`7`,cy:`7`,r:`3`,key:`dfmy0x`}]]),mt=m(`signal-low`,[[`path`,{d:`M2 20h.01`,key:`4haj6o`}],[`path`,{d:`M7 20v-4`,key:`j294jx`}]]),ht=m(`signal-high`,[[`path`,{d:`M2 20h.01`,key:`4haj6o`}],[`path`,{d:`M7 20v-4`,key:`j294jx`}],[`path`,{d:`M12 20v-8`,key:`i3yub9`}],[`path`,{d:`M17 20V8`,key:`1tkaf5`}]]),gt=m(`signal-medium`,[[`path`,{d:`M2 20h.01`,key:`4haj6o`}],[`path`,{d:`M7 20v-4`,key:`j294jx`}],[`path`,{d:`M12 20v-8`,key:`i3yub9`}]]),_t=m(`square`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}]]),vt=m(`terminal`,[[`path`,{d:`M12 19h8`,key:`baeox8`}],[`path`,{d:`m4 17 6-6-6-6`,key:`1yngyt`}]]),yt=m(`users`,[[`path`,{d:`M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2`,key:`1yyitq`}],[`path`,{d:`M16 3.128a4 4 0 0 1 0 7.744`,key:`16gr8j`}],[`path`,{d:`M22 21v-2a4 4 0 0 0-3-3.87`,key:`kshegd`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}]]),bt=m(`video`,[[`path`,{d:`m16 13 5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5`,key:`ftymec`}],[`rect`,{x:`2`,y:`6`,width:`14`,height:`12`,rx:`2`,key:`158x01`}]]),xt=`useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict`,St=(e=21)=>{let t=``,n=crypto.getRandomValues(new Uint8Array(e|=0));for(;e--;)t+=xt[n[e]&63];return t},N=e(i(),1),P=a();function Ct({className:e,orientation:t=`horizontal`,...n}){return(0,P.jsx)(Me,{"data-slot":`separator`,orientation:t,className:l(`shrink-0 bg-border data-horizontal:h-px data-horizontal:w-full data-vertical:w-px data-vertical:self-stretch`,e),...n})}var wt=({className:e,children:t,...n})=>(0,P.jsxs)(`div`,{className:l(`flex items-center gap-0.5 overflow-hidden text-muted-foreground`,e),...n,children:[t,(0,P.jsx)(Ct,{})]}),Tt=({className:e,children:t,...n})=>t??(0,P.jsx)(tt,{className:l(`size-4 shrink-0`,e),...n}),Et=({children:e,variant:t=`ghost`,size:n=`sm`,tooltip:r,...i})=>r?(0,P.jsxs)(Pe,{children:[(0,P.jsx)(De,{render:(0,P.jsx)(E,{size:n,type:`button`,variant:t,...i}),children:e}),(0,P.jsx)(Ce,{align:`start`,side:`bottom`,children:r})]}):(0,P.jsx)(E,{size:n,type:`button`,variant:t,...i,children:e}),Dt={damping:.7,stiffness:.05,mass:1.25},Ot=70,kt=1e3/60,At=350,jt=!1;globalThis.document?.addEventListener(`mousedown`,()=>{jt=!0}),globalThis.document?.addEventListener(`mouseup`,()=>{jt=!1}),globalThis.document?.addEventListener(`click`,()=>{jt=!1});var Mt=(e={})=>{let[t,n]=(0,N.useState)(!1),[r,i]=(0,N.useState)(e.initial!==!1),[a,o]=(0,N.useState)(!1),s=(0,N.useRef)(null);s.current=e;let c=(0,N.useCallback)(()=>{if(!jt)return!1;let e=window.getSelection();if(!e||!e.rangeCount)return!1;let t=e.getRangeAt(0);return t.commonAncestorContainer.contains(g.current)||g.current?.contains(t.commonAncestorContainer)},[]),l=(0,N.useCallback)(e=>{d.isAtBottom=e,i(e)},[]),u=(0,N.useCallback)(e=>{d.escapedFromLock=e,n(e)},[]),d=(0,N.useMemo)(()=>{let n;return{escapedFromLock:t,isAtBottom:r,resizeDifference:0,accumulated:0,velocity:0,listeners:new Set,get scrollTop(){return g.current?.scrollTop??0},set scrollTop(e){if(g.current){let{scrollBehavior:t}=getComputedStyle(g.current);t!==`auto`&&(g.current.style.scrollBehavior=`auto`),g.current.scrollTop=e,d.ignoreScrollToTop=g.current.scrollTop,t!==`auto`&&(g.current.style.scrollBehavior=t)}},get targetScrollTop(){return!g.current||!_.current?0:g.current.scrollHeight-1-g.current.clientHeight},get calculatedTargetScrollTop(){if(!g.current||!_.current)return 0;let{targetScrollTop:t}=this;if(!e.targetScrollTop)return t;if(n?.targetScrollTop===t)return n.calculatedScrollTop;let r=Math.max(Math.min(e.targetScrollTop(t,{scrollElement:g.current,contentElement:_.current}),t),0);return n={targetScrollTop:t,calculatedScrollTop:r},requestAnimationFrame(()=>{n=void 0}),r},get scrollDifference(){return this.calculatedTargetScrollTop-this.scrollTop},get isNearBottom(){return this.scrollDifference<=Ot}}},[]),f=(0,N.useCallback)((e={})=>{typeof e==`string`&&(e={animation:e}),e.preserveScrollPosition||l(!0);let t=Date.now()+(Number(e.wait)||0),n=Ft(s.current,e.animation),{ignoreEscapes:r=!1}=e,i,a=d.calculatedTargetScrollTop;e.duration instanceof Promise?e.duration.finally(()=>{i=Date.now()}):i=t+(e.duration??0);let o=async()=>{let e=new Promise(requestAnimationFrame).then(()=>{if(!d.isAtBottom)return d.animation=void 0,!1;let{scrollTop:l}=d,u=performance.now(),p=(u-(d.lastTick??u))/kt;if(d.animation||={behavior:n,promise:e,ignoreEscapes:r},d.animation.behavior===n&&(d.lastTick=u),c()||t>Date.now())return o();if(l<Math.min(a,d.calculatedTargetScrollTop)){if(d.animation?.behavior===n){if(n===`instant`)return d.scrollTop=d.calculatedTargetScrollTop,o();d.velocity=(n.damping*d.velocity+n.stiffness*d.scrollDifference)/n.mass,d.accumulated+=d.velocity*p,d.scrollTop+=d.accumulated,d.scrollTop!==l&&(d.accumulated=0)}return o()}return i>Date.now()?(a=d.calculatedTargetScrollTop,o()):(d.animation=void 0,d.scrollTop<d.calculatedTargetScrollTop?f({animation:Ft(s.current,s.current.resize),ignoreEscapes:r,duration:Math.max(0,i-Date.now())||void 0}):d.isAtBottom)});return e.then(e=>(requestAnimationFrame(()=>{d.animation||(d.lastTick=void 0,d.velocity=0)}),e))};return e.wait!==!0&&(d.animation=void 0),d.animation?.behavior===n?d.animation.promise:o()},[l,c,d]),p=(0,N.useCallback)(()=>{u(!0),l(!1)},[u,l]),m=(0,N.useCallback)(({target:e})=>{if(e!==g.current)return;let{scrollTop:t,ignoreScrollToTop:n}=d,{lastScrollTop:r=t}=d;d.lastScrollTop=t,d.ignoreScrollToTop=void 0,n&&n>t&&(r=n),o(d.isNearBottom),setTimeout(()=>{if(d.resizeDifference||t===n)return;if(c()){u(!0),l(!1);return}let e=t>r,i=t<r;if(d.animation?.ignoreEscapes){d.scrollTop=r;return}i&&(u(!0),l(!1)),e&&u(!1),!d.escapedFromLock&&d.isNearBottom&&l(!0)},1)},[u,l,c,d]),h=(0,N.useCallback)(({target:e,deltaY:t})=>{let n=e;for(;![`scroll`,`auto`].includes(getComputedStyle(n).overflow);){if(!n.parentElement)return;n=n.parentElement}n===g.current&&t<0&&g.current.scrollHeight>g.current.clientHeight&&!d.animation?.ignoreEscapes&&(u(!0),l(!1))},[u,l,d]),g=Nt(e=>{g.current?.removeEventListener(`scroll`,m),g.current?.removeEventListener(`wheel`,h),e?.addEventListener(`scroll`,m,{passive:!0}),e?.addEventListener(`wheel`,h,{passive:!0})},[]),_=Nt(e=>{if(d.resizeObserver?.disconnect(),d.resizeObserver=void 0,!e)return;let t;d.resizeObserver=new ResizeObserver(([e])=>{let{height:n}=e.contentRect,r=n-(t??n);if(d.resizeDifference=r,d.scrollTop>d.targetScrollTop&&(d.scrollTop=d.targetScrollTop),o(d.isNearBottom),r>=0){let e=Ft(s.current,t?s.current.resize:s.current.initial);f({animation:e,wait:!0,preserveScrollPosition:!0,duration:e===`instant`?void 0:At})}else d.isNearBottom&&(u(!1),l(!0));t=n,requestAnimationFrame(()=>{setTimeout(()=>{d.resizeDifference===r&&(d.resizeDifference=0)},1)})}),d.resizeObserver?.observe(e)},[]);return{contentRef:_,scrollRef:g,scrollToBottom:f,stopScroll:p,isAtBottom:r||a,isNearBottom:a,escapedFromLock:t,state:d}};function Nt(e,t){let n=(0,N.useCallback)(t=>(n.current=t,e(t)),t);return n}var Pt=new Map;function Ft(...e){let t={...Dt},n=!1;for(let r of e){if(r===`instant`){n=!0;continue}typeof r==`object`&&(n=!1,t.damping=r.damping??t.damping,t.stiffness=r.stiffness??t.stiffness,t.mass=r.mass??t.mass)}let r=JSON.stringify(t);return Pt.has(r)||Pt.set(r,Object.freeze(t)),n?`instant`:Pt.get(r)}var It=(0,N.createContext)(null),Lt=typeof window<`u`?N.useLayoutEffect:N.useEffect;function Rt({instance:e,children:t,resize:n,initial:r,mass:i,damping:a,stiffness:o,targetScrollTop:s,contextRef:c,...l}){let u=(0,N.useRef)(null),d=Mt({mass:i,damping:a,stiffness:o,resize:n,initial:r,targetScrollTop:N.useCallback((e,t)=>(y?.targetScrollTop??s)?.(e,t)??e,[s])}),{scrollRef:f,contentRef:p,scrollToBottom:m,stopScroll:h,isAtBottom:g,escapedFromLock:_,state:v}=e??d,y=(0,N.useMemo)(()=>({scrollToBottom:m,stopScroll:h,scrollRef:f,isAtBottom:g,escapedFromLock:_,contentRef:p,state:v,get targetScrollTop(){return u.current},set targetScrollTop(e){u.current=e}}),[m,g,p,f,h,_,v]);return(0,N.useImperativeHandle)(c,()=>y,[y]),Lt(()=>{f.current&&getComputedStyle(f.current).overflow===`visible`&&(f.current.style.overflow=`auto`)},[]),N.createElement(It.Provider,{value:y},N.createElement(`div`,{...l},typeof t==`function`?t(y):t))}(function(e){function t({children:e,scrollClassName:t,...n}){let r=zt();return N.createElement(`div`,{ref:r.scrollRef,style:{height:`100%`,width:`100%`,scrollbarGutter:`stable both-edges`},className:t},N.createElement(`div`,{...n,ref:r.contentRef},typeof e==`function`?e(r):e))}e.Content=t})(Rt||={});function zt(){let e=(0,N.useContext)(It);if(!e)throw Error(`use-stick-to-bottom component context must be used within a StickToBottom component`);return e}var Bt=({className:e,...t})=>(0,P.jsx)(Rt,{className:l(`relative flex-1 overflow-y-hidden`,e),initial:`smooth`,resize:`smooth`,role:`log`,...t}),Vt=({className:e,...t})=>(0,P.jsx)(Rt.Content,{className:l(`flex flex-col gap-8 p-4`,e),...t}),Ht=({className:e,...t})=>{let{isAtBottom:n,scrollToBottom:r}=zt(),i=(0,N.useCallback)(()=>{r()},[r]);return!n&&(0,P.jsx)(E,{className:l(`absolute bottom-4 left-[50%] translate-x-[-50%] rounded-full dark:bg-background dark:hover:bg-muted`,e),onClick:i,size:`icon`,type:`button`,variant:`outline`,...t,children:(0,P.jsx)(et,{className:`size-4`})})};_(`flex w-fit items-stretch *:focus-visible:relative *:focus-visible:z-10 has-[>[data-slot=button-group]]:gap-2 has-[select[aria-hidden=true]:last-child]:[&>[data-slot=select-trigger]:last-of-type]:rounded-r-lg [&>[data-slot=select-trigger]:not([class*='w-'])]:w-fit [&>input]:flex-1`,{variants:{orientation:{horizontal:`*:data-slot:rounded-r-none [&>[data-slot]:not(:has(~[data-slot]))]:rounded-r-lg! [&>[data-slot]~[data-slot]]:rounded-l-none [&>[data-slot]~[data-slot]]:border-l-0`,vertical:`flex-col *:data-slot:rounded-b-none [&>[data-slot]:not(:has(~[data-slot]))]:rounded-b-lg! [&>[data-slot]~[data-slot]]:rounded-t-none [&>[data-slot]~[data-slot]]:border-t-0`}},defaultVariants:{orientation:`horizontal`}});var F={carriageReturn:-5,lineFeed:-4,carriageReturnLineFeed:-3,horizontalTab:-2,virtualSpace:-1,eof:null,nul:0,soh:1,stx:2,etx:3,eot:4,enq:5,ack:6,bel:7,bs:8,ht:9,lf:10,vt:11,ff:12,cr:13,so:14,si:15,dle:16,dc1:17,dc2:18,dc3:19,dc4:20,nak:21,syn:22,etb:23,can:24,em:25,sub:26,esc:27,fs:28,gs:29,rs:30,us:31,space:32,exclamationMark:33,quotationMark:34,numberSign:35,dollarSign:36,percentSign:37,ampersand:38,apostrophe:39,leftParenthesis:40,rightParenthesis:41,asterisk:42,plusSign:43,comma:44,dash:45,dot:46,slash:47,digit0:48,digit1:49,digit2:50,digit3:51,digit4:52,digit5:53,digit6:54,digit7:55,digit8:56,digit9:57,colon:58,semicolon:59,lessThan:60,equalsTo:61,greaterThan:62,questionMark:63,atSign:64,uppercaseA:65,uppercaseB:66,uppercaseC:67,uppercaseD:68,uppercaseE:69,uppercaseF:70,uppercaseG:71,uppercaseH:72,uppercaseI:73,uppercaseJ:74,uppercaseK:75,uppercaseL:76,uppercaseM:77,uppercaseN:78,uppercaseO:79,uppercaseP:80,uppercaseQ:81,uppercaseR:82,uppercaseS:83,uppercaseT:84,uppercaseU:85,uppercaseV:86,uppercaseW:87,uppercaseX:88,uppercaseY:89,uppercaseZ:90,leftSquareBracket:91,backslash:92,rightSquareBracket:93,caret:94,underscore:95,graveAccent:96,lowercaseA:97,lowercaseB:98,lowercaseC:99,lowercaseD:100,lowercaseE:101,lowercaseF:102,lowercaseG:103,lowercaseH:104,lowercaseI:105,lowercaseJ:106,lowercaseK:107,lowercaseL:108,lowercaseM:109,lowercaseN:110,lowercaseO:111,lowercaseP:112,lowercaseQ:113,lowercaseR:114,lowercaseS:115,lowercaseT:116,lowercaseU:117,lowercaseV:118,lowercaseW:119,lowercaseX:120,lowercaseY:121,lowercaseZ:122,leftCurlyBrace:123,verticalBar:124,rightCurlyBrace:125,tilde:126,del:127,byteOrderMarker:65279,replacementCharacter:65533},Ut={attentionSideAfter:2,attentionSideBefore:1,atxHeadingOpeningFenceSizeMax:6,autolinkDomainSizeMax:63,autolinkSchemeSizeMax:32,cdataOpeningString:`CDATA[`,characterGroupPunctuation:2,characterGroupWhitespace:1,characterReferenceDecimalSizeMax:7,characterReferenceHexadecimalSizeMax:6,characterReferenceNamedSizeMax:31,codeFencedSequenceSizeMin:3,contentTypeContent:`content`,contentTypeDocument:`document`,contentTypeFlow:`flow`,contentTypeString:`string`,contentTypeText:`text`,hardBreakPrefixSizeMin:2,htmlBasic:6,htmlCdata:5,htmlComment:2,htmlComplete:7,htmlDeclaration:4,htmlInstruction:3,htmlRawSizeMax:8,htmlRaw:1,linkResourceDestinationBalanceMax:32,linkReferenceSizeMax:999,listItemValueSizeMax:10,numericBaseDecimal:10,numericBaseHexadecimal:16,tabSize:4,thematicBreakMarkerCountMin:3,v8MaxSafeChunkSize:1e4},Wt={data:`data`,whitespace:`whitespace`,lineEnding:`lineEnding`,lineEndingBlank:`lineEndingBlank`,linePrefix:`linePrefix`,lineSuffix:`lineSuffix`,atxHeading:`atxHeading`,atxHeadingSequence:`atxHeadingSequence`,atxHeadingText:`atxHeadingText`,autolink:`autolink`,autolinkEmail:`autolinkEmail`,autolinkMarker:`autolinkMarker`,autolinkProtocol:`autolinkProtocol`,characterEscape:`characterEscape`,characterEscapeValue:`characterEscapeValue`,characterReference:`characterReference`,characterReferenceMarker:`characterReferenceMarker`,characterReferenceMarkerNumeric:`characterReferenceMarkerNumeric`,characterReferenceMarkerHexadecimal:`characterReferenceMarkerHexadecimal`,characterReferenceValue:`characterReferenceValue`,codeFenced:`codeFenced`,codeFencedFence:`codeFencedFence`,codeFencedFenceSequence:`codeFencedFenceSequence`,codeFencedFenceInfo:`codeFencedFenceInfo`,codeFencedFenceMeta:`codeFencedFenceMeta`,codeFlowValue:`codeFlowValue`,codeIndented:`codeIndented`,codeText:`codeText`,codeTextData:`codeTextData`,codeTextPadding:`codeTextPadding`,codeTextSequence:`codeTextSequence`,content:`content`,definition:`definition`,definitionDestination:`definitionDestination`,definitionDestinationLiteral:`definitionDestinationLiteral`,definitionDestinationLiteralMarker:`definitionDestinationLiteralMarker`,definitionDestinationRaw:`definitionDestinationRaw`,definitionDestinationString:`definitionDestinationString`,definitionLabel:`definitionLabel`,definitionLabelMarker:`definitionLabelMarker`,definitionLabelString:`definitionLabelString`,definitionMarker:`definitionMarker`,definitionTitle:`definitionTitle`,definitionTitleMarker:`definitionTitleMarker`,definitionTitleString:`definitionTitleString`,emphasis:`emphasis`,emphasisSequence:`emphasisSequence`,emphasisText:`emphasisText`,escapeMarker:`escapeMarker`,hardBreakEscape:`hardBreakEscape`,hardBreakTrailing:`hardBreakTrailing`,htmlFlow:`htmlFlow`,htmlFlowData:`htmlFlowData`,htmlText:`htmlText`,htmlTextData:`htmlTextData`,image:`image`,label:`label`,labelText:`labelText`,labelLink:`labelLink`,labelImage:`labelImage`,labelMarker:`labelMarker`,labelImageMarker:`labelImageMarker`,labelEnd:`labelEnd`,link:`link`,paragraph:`paragraph`,reference:`reference`,referenceMarker:`referenceMarker`,referenceString:`referenceString`,resource:`resource`,resourceDestination:`resourceDestination`,resourceDestinationLiteral:`resourceDestinationLiteral`,resourceDestinationLiteralMarker:`resourceDestinationLiteralMarker`,resourceDestinationRaw:`resourceDestinationRaw`,resourceDestinationString:`resourceDestinationString`,resourceMarker:`resourceMarker`,resourceTitle:`resourceTitle`,resourceTitleMarker:`resourceTitleMarker`,resourceTitleString:`resourceTitleString`,setextHeading:`setextHeading`,setextHeadingText:`setextHeadingText`,setextHeadingLine:`setextHeadingLine`,setextHeadingLineSequence:`setextHeadingLineSequence`,strong:`strong`,strongSequence:`strongSequence`,strongText:`strongText`,thematicBreak:`thematicBreak`,thematicBreakSequence:`thematicBreakSequence`,blockQuote:`blockQuote`,blockQuotePrefix:`blockQuotePrefix`,blockQuoteMarker:`blockQuoteMarker`,blockQuotePrefixWhitespace:`blockQuotePrefixWhitespace`,listOrdered:`listOrdered`,listUnordered:`listUnordered`,listItemIndent:`listItemIndent`,listItemMarker:`listItemMarker`,listItemPrefix:`listItemPrefix`,listItemPrefixWhitespace:`listItemPrefixWhitespace`,listItemValue:`listItemValue`,chunkDocument:`chunkDocument`,chunkContent:`chunkContent`,chunkFlow:`chunkFlow`,chunkText:`chunkText`,chunkString:`chunkString`},Gt=[161,161,164,164,167,168,170,170,173,174,176,180,182,186,188,191,198,198,208,208,215,216,222,225,230,230,232,234,236,237,240,240,242,243,247,250,252,252,254,254,257,257,273,273,275,275,283,283,294,295,299,299,305,307,312,312,319,322,324,324,328,331,333,333,338,339,358,359,363,363,462,462,464,464,466,466,468,468,470,470,472,472,474,474,476,476,593,593,609,609,708,708,711,711,713,715,717,717,720,720,728,731,733,733,735,735,768,879,913,929,931,937,945,961,963,969,1025,1025,1040,1103,1105,1105,8208,8208,8211,8214,8216,8217,8220,8221,8224,8226,8228,8231,8240,8240,8242,8243,8245,8245,8251,8251,8254,8254,8308,8308,8319,8319,8321,8324,8364,8364,8451,8451,8453,8453,8457,8457,8467,8467,8470,8470,8481,8482,8486,8486,8491,8491,8531,8532,8539,8542,8544,8555,8560,8569,8585,8585,8592,8601,8632,8633,8658,8658,8660,8660,8679,8679,8704,8704,8706,8707,8711,8712,8715,8715,8719,8719,8721,8721,8725,8725,8730,8730,8733,8736,8739,8739,8741,8741,8743,8748,8750,8750,8756,8759,8764,8765,8776,8776,8780,8780,8786,8786,8800,8801,8804,8807,8810,8811,8814,8815,8834,8835,8838,8839,8853,8853,8857,8857,8869,8869,8895,8895,8978,8978,9312,9449,9451,9547,9552,9587,9600,9615,9618,9621,9632,9633,9635,9641,9650,9651,9654,9655,9660,9661,9664,9665,9670,9672,9675,9675,9678,9681,9698,9701,9711,9711,9733,9734,9737,9737,9742,9743,9756,9756,9758,9758,9792,9792,9794,9794,9824,9825,9827,9829,9831,9834,9836,9837,9839,9839,9886,9887,9919,9919,9926,9933,9935,9939,9941,9953,9955,9955,9960,9961,9963,9969,9972,9972,9974,9977,9979,9980,9982,9983,10045,10045,10102,10111,11094,11097,12872,12879,57344,63743,65024,65039,65533,65533,127232,127242,127248,127277,127280,127337,127344,127373,127375,127376,127387,127404,917760,917999,983040,1048573,1048576,1114109],Kt=[12288,12288,65281,65376,65504,65510],qt=[8361,8361,65377,65470,65474,65479,65482,65487,65490,65495,65498,65500,65512,65518],Jt=[32,126,162,163,165,166,172,172,175,175,10214,10221,10629,10630],Yt=[4352,4447,8986,8987,9001,9002,9193,9196,9200,9200,9203,9203,9725,9726,9748,9749,9776,9783,9800,9811,9855,9855,9866,9871,9875,9875,9889,9889,9898,9899,9917,9918,9924,9925,9934,9934,9940,9940,9962,9962,9970,9971,9973,9973,9978,9978,9981,9981,9989,9989,9994,9995,10024,10024,10060,10060,10062,10062,10067,10069,10071,10071,10133,10135,10160,10160,10175,10175,11035,11036,11088,11088,11093,11093,11904,11929,11931,12019,12032,12245,12272,12287,12289,12350,12353,12438,12441,12543,12549,12591,12593,12686,12688,12773,12783,12830,12832,12871,12880,42124,42128,42182,43360,43388,44032,55203,63744,64255,65040,65049,65072,65106,65108,65126,65128,65131,94176,94180,94192,94198,94208,101589,101631,101662,101760,101874,110576,110579,110581,110587,110589,110590,110592,110882,110898,110898,110928,110930,110933,110933,110948,110951,110960,111355,119552,119638,119648,119670,126980,126980,127183,127183,127374,127374,127377,127386,127488,127490,127504,127547,127552,127560,127568,127569,127584,127589,127744,127776,127789,127797,127799,127868,127870,127891,127904,127946,127951,127955,127968,127984,127988,127988,127992,128062,128064,128064,128066,128252,128255,128317,128331,128334,128336,128359,128378,128378,128405,128406,128420,128420,128507,128591,128640,128709,128716,128716,128720,128722,128725,128728,128732,128735,128747,128748,128756,128764,128992,129003,129008,129008,129292,129338,129340,129349,129351,129535,129648,129660,129664,129674,129678,129734,129736,129736,129741,129756,129759,129770,129775,129784,131072,196605,196608,262141],Xt=(e,t)=>{let n=0,r=Math.floor(e.length/2)-1;for(;n<=r;){let i=Math.floor((n+r)/2),a=i*2;if(t<e[a])r=i-1;else if(t>e[a+1])n=i+1;else return!0}return!1},Zt=19968,[Qt,$t]=en(Yt);function en(e){let t=e[0],n=e[1];for(let r=0;r<e.length;r+=2){let i=e[r],a=e[r+1];if(Zt>=i&&Zt<=a)return[i,a];a-i>n-t&&(t=i,n=a)}return[t,n]}var tn=e=>e<161||e>1114109?!1:Xt(Gt,e),nn=e=>e<12288||e>65510?!1:Xt(Kt,e),rn=e=>e<8361||e>65518?!1:Xt(qt,e),an=e=>e<32||e>10630?!1:Xt(Jt,e),on=e=>e>=Qt&&e<=$t?!0:e<4352||e>262141?!1:Xt(Yt,e);function sn(e){return tn(e)?`ambiguous`:nn(e)?`fullwidth`:rn(e)?`halfwidth`:an(e)?`narrow`:on(e)?`wide`:`neutral`}function cn(e){if(!Number.isSafeInteger(e))throw TypeError(`Expected a code point, got \`${typeof e}\`.`)}function ln(e){return cn(e),sn(e)}function un(e){return/^\p{Emoji_Presentation}/u.test(String.fromCodePoint(e))}function dn(e){if(!e||e<4352)return!1;switch(ln(e)){case`fullwidth`:case`halfwidth`:return!0;case`wide`:return!un(e);case`narrow`:return!1;case`ambiguous`:return 917760<=e&&e<=917999?null:!1;case`neutral`:return/^\p{sc=Hangul}/u.test(String.fromCodePoint(e))}}function fn(e,t){return t!==65025||!e||e<8216?!1:e===8216||e===8217||e===8220||e===8221}function pn(e){return e!==null&&e>=65024&&e<=65038}var mn=gn(/\p{P}|\p{S}/u),hn=gn(/\s/);function gn(e){return t;function t(t){return t!==null&&t>-1&&e.test(String.fromCodePoint(t))}}function I(e){return!!(e&Ut.characterGroupWhitespace)}function _n(e){return(e&Cn.cjkPunctuation)===Ut.characterGroupPunctuation}function vn(e){return!!(e&Cn.cjk)}function yn(e){return e===Cn.ivs}function bn(e){return!!(e&Cn.cjkOrIvs)}function xn(e){return e===Cn.nonEmojiGeneralUseVS}function Sn(e){return!!(e&Cn.spaceOrPunctuation)}var Cn;(function(e){e.spaceOrPunctuation=3,e.cjk=4096,e.cjkPunctuation=4098,e.ivs=8192,e.cjkOrIvs=12288,e.nonEmojiGeneralUseVS=16384,e.variationSelector=24576,e.ivsToCjkRightShift=1})(Cn||={});function wn(e){if(e===F.eof||$e(e)||hn(e))return Ut.characterGroupWhitespace;let t=0;if(e>=4352){if(pn(e))return Cn.nonEmojiGeneralUseVS;switch(dn(e)){case null:return Cn.ivs;case!0:t|=Cn.cjk;break}}return mn(e)&&(t|=Ut.characterGroupPunctuation),t}function Tn(e,t,n){if(!xn(e))return e;let r=t(),i=wn(r);return!r||I(i)?e:fn(r,n)?Cn.cjkPunctuation:En(i)}function En(e){return e&~Cn.ivs}function Dn(e){return!!(e&&e>=55296&&e<=56319)}function On(e){return!!(e&&e>=56320&&e<=57343)}function kn(e,t,n){if(t._bufferIndex<2)return e;let r=n({start:{...t,_bufferIndex:t._bufferIndex-2},end:t}).codePointAt(0);return r&&r>=65536?r:e}function An(e,t,n){let r=e>=65536?2:1;if(t._bufferIndex<1+r)return null;let i=t._bufferIndex-r-2,a=n({start:{...t,_bufferIndex:i>=0?i:0},end:{...t,_bufferIndex:t._bufferIndex-r}}),o=a.charCodeAt(a.length-1);if(Number.isNaN(o))return null;if(a.length<2||o<56320||57343<o)return o;let s=a.codePointAt(0);return s&&s>=65536?s:o}var jn=class{cachedValue=void 0;constructor(e,t,n){this.previousCode=e,this.nowPoint=t,this.sliceSerialize=n}value(){return this.cachedValue===void 0&&(this.cachedValue=An(this.previousCode,this.nowPoint,this.sliceSerialize)),this.cachedValue}};function Mn(e,t,n){let r=n({start:t,end:{...t,_bufferIndex:t._bufferIndex+2}}).codePointAt(0);return r&&r>=65536?r:e}var Nn={name:`attention`,resolveAll:Pn,tokenize:Fn};function Pn(e,t){let n=-1,r,i,a,o,s,c,l,u;for(;++n<e.length;)if(e[n][0]===`enter`&&e[n][1].type===`attentionSequence`&&e[n][1]._close){for(r=n;r--;)if(e[r][0]===`exit`&&e[r][1].type===`attentionSequence`&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;c=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;let d={...e[r][1].end},f={...e[n][1].start};In(d,-c),In(f,c),o={type:c>1?Wt.strongSequence:Wt.emphasisSequence,start:d,end:{...e[r][1].end}},s={type:c>1?Wt.strongSequence:Wt.emphasisSequence,start:{...e[n][1].start},end:f},a={type:c>1?Wt.strongText:Wt.emphasisText,start:{...e[r][1].end},end:{...e[n][1].start}},i={type:c>1?Wt.strong:Wt.emphasis,start:{...o.start},end:{...s.end}},e[r][1].end={...o.start},e[n][1].start={...s.end},l=[],e[r][1].end.offset-e[r][1].start.offset&&(l=ze(l,[[`enter`,e[r][1],t],[`exit`,e[r][1],t]])),l=ze(l,[[`enter`,i,t],[`enter`,o,t],[`exit`,o,t],[`enter`,a,t]]),t.parser.constructs.insideSpan.null,l=ze(l,Ue(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),l=ze(l,[[`exit`,a,t],[`enter`,s,t],[`exit`,s,t],[`exit`,i,t]]),e[n][1].end.offset-e[n][1].start.offset?(u=2,l=ze(l,[[`enter`,e[n][1],t],[`exit`,e[n][1],t]])):u=0,Qe(e,r-1,n-r+3,l),n=r+l.length-u-2;break}}for(n=-1;++n<e.length;)e[n][1].type===`attentionSequence`&&(e[n][1].type=`data`);return e}function Fn(e,t){let n=this.parser.constructs.attentionMarkers.null,{now:r,sliceSerialize:i,previous:a}=this,o=On(a)?kn(a,r(),i):a,s=wn(o),c=new jn(o,r(),i),l=Tn(s,c.value.bind(c),o),u;return d;function d(t){return t===F.asterisk||F.underscore,u=t,e.enter(`attentionSequence`),f(t)}function f(a){if(a===u)return e.consume(a),f;let s=e.exit(`attentionSequence`),c=wn(Dn(a)?Mn(a,r(),i):a),d=_n(l),p=d||I(l),m=_n(c),h=m||I(c),g=bn(l),_=!h||m&&(p||g)||n.includes(a),v=!p||d&&(h||vn(c))||n.includes(o);return s._open=!!(u===F.asterisk?_:_&&(Sn(l)||!v)),s._close=!!(u===F.asterisk?v:v&&(Sn(c)||!_)),t(a)}}function In(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}function Ln(){return{text:{[F.asterisk]:Nn,[F.underscore]:Nn},insideSpan:{null:[Nn]}}}function Rn(){let e=this.data();(e.micromarkExtensions||=[]).push(Ln())}var zn=`;`.codePointAt(0)??F.eof,Bn=`&`.codePointAt(0)??F.eof;function Vn(){return{handlers:{emphasis:Hn,strong:Un,text:qn}}}Hn.peek=Wn,Un.peek=Gn;function Hn(e,t,n,r){return Kn(e,t,n,r,Wn(e,t,n),1)}function Un(e,t,n,r){return Kn(e,t,n,r,Gn(e,t,n),2)}function Wn(e,t,n){return n.options.emphasis||`*`}function Gn(e,t,n){return n.options.strong||`*`}function Kn(e,t,n,r,i,a){let o=i.repeat(a),s=n.enter(a===1?`emphasis`:`strong`),c=n.createTracker(r),l=c.move(o),u=c.move(n.containerPhrasing(e,{after:i,before:l,...c.current()})),d=tr(e,t,n,r.before),f=nr(e,t,n,r.after),p=Jn(d,mr(u),i,`open`);p.inside&&u&&(u=dr(u));let m=Jn({current:hr(u),previous:pr(u)},f,i,`close`);m.inside&&u&&(u=fr(u));let h=c.move(o);s();let g=m.outside&&sr(t,n);return n.attentionEncodeSurroundingInfo={after:m.outside&&!g,before:p.outside},cr(n).cjkFriendlyEncodeAfterSupplementaryText=g,l+u+h}function qn(e,t,n,r){let i=cr(n);if(!i.cjkFriendlyEncodeAfterSupplementaryText)return n.safe(e.value,r);i.cjkFriendlyEncodeAfterSupplementaryText=!1;let[a=``]=[...e.value],o=e.value.slice(a.length);return`${ur(a.codePointAt(0)??F.eof)}${n.safe(o,{...r,before:`;`})}`}function Jn(e,t,n,r){let i=er(e),a=wn(t);if(!bn(i)&&!bn(a))return r===`open`?Yn(i,a,n):Yn(a,i,n);let o={inside:!1,outside:!1},s={inside:!0,outside:!1},c={inside:!1,outside:!0},l={inside:!0,outside:!0};for(let i of[o,s,c,l]){let a=r===`open`?i.outside?gr:e:i.inside?gr:e,o=r===`open`?i.inside?_r:t:i.outside?_r:t;if(r===`open`?Xn(n,a,o):Zn(n,a,o))return i}return l}function Yn(e,t,n){return $n(e)?$n(t)?n===`_`?{inside:!0,outside:!0}:{inside:!1,outside:!1}:I(t)?{inside:!0,outside:!0}:{inside:!1,outside:!0}:I(e)?$n(t)?{inside:!1,outside:!1}:I(t)?{inside:!0,outside:!0}:{inside:!1,outside:!1}:I(t)?{inside:!0,outside:!1}:{inside:!1,outside:!1}}function Xn(e,t,n){let r=er(t),{close:i,open:a}=Qn(r,wn(n));return e===`_`?a&&(Sn(r)||!i):a}function Zn(e,t,n){let r=wn(n),{close:i,open:a}=Qn(er(t),r);return e===`_`?i&&(Sn(r)||!a):i}function Qn(e,t){let n=_n(e),r=n||I(e),i=_n(t),a=i||I(t);return{open:!a||i&&(r||bn(e)),close:!r||n&&(a||vn(t))}}function $n(e){return!I(e)&&!_n(e)}function er(e){let t=wn(e.current);return e.current===null||!xn(t)?t:Tn(t,()=>e.previous,e.current)}function tr(e,t,n,r){let i=hr(r),a=pr(r);if(rr(i)||ar(i,a)){let r=or(e,t,n,-1);r&&(i=hr(r),a=pr(r))}return{current:i,previous:a}}function nr(e,t,n,r){let i=mr(r);if(!ir(i))return i;let a=or(e,t,n,1);return a?mr(a):i}function rr(e){return e!==null&&56320<=e&&e<=57343}function ir(e){return e!==null&&55296<=e&&e<=56319}function ar(e,t){return xn(wn(e))&&(t===null||t===F.eof)}function or(e,t,n,r){if(!t)return;let i=n.indexStack.at(-1),a=t.children,o=typeof i==`number`?i:a.indexOf(e);if(o<0)return;let s=a[o+r];return lr(s)||void 0}function sr(e,t){if(!e)return!1;let n=t.indexStack.at(-1);if(typeof n!=`number`)return!1;let r=e.children[n+1];return r?.type===`text`&&(mr(r.value)??0)>65535}function cr(e){return e}function lr(e){return!e||typeof e!=`object`?``:`value`in e&&typeof e.value==`string`?e.value:`alt`in e&&typeof e.alt==`string`?e.alt:`children`in e&&Array.isArray(e.children)?e.children.map(lr).join(``):``}function ur(e){return`&#x${(e??0).toString(16).toUpperCase()};`}function dr(e){let[t=``]=[...e];return ur(t.codePointAt(0)??F.eof)+e.slice(t.length)}function fr(e){let t=[...e],n=t.pop();return`${t.join(``)}${ur(n?.codePointAt(0)??F.eof)}`}function pr(e){let t=[...e];return t.pop(),t.at(-1)?.codePointAt(0)??F.eof}function mr(e){return e.codePointAt(0)??F.eof}function hr(e){return[...e].at(-1)?.codePointAt(0)??F.eof}var gr={current:zn,previous:F.eof},_r=Bn;function vr(){let e=this.data();(e.toMarkdownExtensions||=[]).push(Vn())}function yr(){Rn.call(this),vr.call(this)}var br=yr;function xr(e){let t=(e||{}).singleTilde,n={name:`strikethrough`,tokenize:i,resolveAll:r};return t??=!0,{text:{[F.tilde]:n},insideSpan:{null:[n]},attentionMarkers:{null:[F.tilde]}};function r(e,t){let n=-1;for(;++n<e.length;)if(e[n][0]===`enter`&&e[n][1].type===`strikethroughSequenceTemporary`&&e[n][1]._close){let r=n;for(;r--;)if(e[r][0]===`exit`&&e[r][1].type===`strikethroughSequenceTemporary`&&e[r][1]._open&&e[n][1].end.offset-e[n][1].start.offset===e[r][1].end.offset-e[r][1].start.offset){e[n][1].type=`strikethroughSequence`,e[r][1].type=`strikethroughSequence`;let i={type:`strikethrough`,start:Object.assign({},e[r][1].start),end:Object.assign({},e[n][1].end)},a={type:`strikethroughText`,start:Object.assign({},e[r][1].end),end:Object.assign({},e[n][1].start)},o=[[`enter`,i,t],[`enter`,e[r][1],t],[`exit`,e[r][1],t],[`enter`,a,t]],s=t.parser.constructs.insideSpan.null;s&&Qe(o,o.length,0,Ue(s,e.slice(r+1,n),t)),Qe(o,o.length,0,[[`exit`,a,t],[`enter`,e[n][1],t],[`exit`,e[n][1],t],[`exit`,i,t]]),Qe(e,r-1,n-r+3,o),n=r+o.length-2;break}}for(n=-1;++n<e.length;)e[n][1].type===`strikethroughSequenceTemporary`&&(e[n][1].type=Wt.data);return e}function i(e,n,r){let{now:i,sliceSerialize:a,previous:o}=this,s=On(o)?kn(o,i(),a):o,c=wn(s),l=new jn(s,i(),a),u=Tn(c,l.value.bind(l),s),d=this.events,f=0;return p;function p(t){return F.tilde,s===F.tilde&&d[d.length-1][1].type!==Wt.characterEscape?r(t):(e.enter(`strikethroughSequenceTemporary`),m(t))}function m(o){let c=wn(s);if(o===F.tilde)return f>1?r(o):(e.consume(o),f++,m);if(f<2&&!t)return r(o);let l=e.exit(`strikethroughSequenceTemporary`),d=wn(Dn(o)?Mn(o,i(),a):o),p=_n(u)||I(u),h=_n(d)||I(d),g=vn(u)||yn(c);return l._open=!h||d===Ut.attentionSideAfter&&(p||g),l._close=!p||c===Ut.attentionSideAfter&&(h||vn(d)),n(o)}}}function Sr(e){let t=this.data();(t.micromarkExtensions||=[]).push(xr(e))}var Cr=[`autolink`,`destinationLiteral`,`destinationRaw`,`reference`,`titleQuote`,`titleApostrophe`],wr=`;`.codePointAt(0)??F.eof,Tr=`&`.codePointAt(0)??F.eof;function Er(){return{unsafe:[{character:`~`,inConstruct:`phrasing`,notInConstruct:Cr}],handlers:{delete:Dr,text:Or}}}Dr.peek=kr;function Dr(e,t,n,r){let i=n.enter(`strikethrough`),a=n.createTracker(r),o=a.move(`~~`),s=a.move(n.containerPhrasing(e,{after:`~`,before:o,...a.current()})),c=Lr(e,t,n,r.before),l=Rr(e,t,n,r.after),u=Ar(c,Xr(s),`open`);u.inside&&s&&(s=qr(s));let d=Ar({current:Zr(s),previous:Yr(s)},l,`close`);d.inside&&s&&(s=Jr(s));let f=a.move(`~~`);i();let p=d.outside&&Ur(t,n);return n.attentionEncodeSurroundingInfo={after:d.outside&&!p,before:u.outside},Wr(n).cjkFriendlyEncodeAfterSupplementaryText=p,o+s+f}function Or(e,t,n,r){let i=Wr(n);if(!i.cjkFriendlyEncodeAfterSupplementaryText)return n.safe(e.value,r);i.cjkFriendlyEncodeAfterSupplementaryText=!1;let[a=``]=[...e.value],o=e.value.slice(a.length);return`${Kr(a.codePointAt(0)??F.eof)}${n.safe(o,{...r,before:`;`})}`}function kr(){return`~`}function Ar(e,t,n){let r=Ir(e),i=wn(t);if(!bn(r)&&!bn(i))return n===`open`?jr(r,i):jr(i,r);let a={inside:!1,outside:!1},o={inside:!0,outside:!1},s={inside:!1,outside:!0},c={inside:!0,outside:!0};for(let r of[a,o,s,c]){let i=n===`open`?r.outside?Qr:e:r.inside?Qr:e,a=n===`open`?r.inside?$r:t:r.outside?$r:t;if(n===`open`?Mr(i,a):Nr(i,a))return r}return c}function jr(e,t){return Fr(e)?Fr(t)?{inside:!1,outside:!1}:I(t)?{inside:!0,outside:!0}:{inside:!1,outside:!0}:I(e)?Fr(t)?{inside:!1,outside:!1}:I(t)?{inside:!0,outside:!0}:{inside:!1,outside:!1}:I(t)?{inside:!0,outside:!1}:{inside:!1,outside:!1}}function Mr(e,t){let{open:n}=Pr(Ir(e),wn(t));return n}function Nr(e,t){let n=wn(t),{close:r}=Pr(Ir(e),n);return r}function Pr(e,t){let n=_n(e),r=n||I(e),i=_n(t),a=i||I(t);return{open:!a||i&&(r||bn(e)),close:!r||n&&(a||vn(t))}}function Fr(e){return!I(e)&&!_n(e)}function Ir(e){let t=wn(e.current);return e.current===null||!xn(t)?t:Tn(t,()=>e.previous,e.current)}function Lr(e,t,n,r){let i=Zr(r),a=Yr(r);if(zr(i)||Vr(i,a)){let r=Hr(e,t,n,-1);r&&(i=Zr(r),a=Yr(r))}return{current:i,previous:a}}function Rr(e,t,n,r){let i=Xr(r);if(!Br(i))return i;let a=Hr(e,t,n,1);return a?Xr(a):i}function zr(e){return e!==null&&56320<=e&&e<=57343}function Br(e){return e!==null&&55296<=e&&e<=56319}function Vr(e,t){return xn(wn(e))&&(t===null||t===F.eof)}function Hr(e,t,n,r){if(!t)return;let i=n.indexStack.at(-1),a=t.children,o=typeof i==`number`?i:a.indexOf(e);if(o<0)return;let s=a[o+r];return Gr(s)||void 0}function Ur(e,t){if(!e)return!1;let n=t.indexStack.at(-1);if(typeof n!=`number`)return!1;let r=e.children[n+1];return r?.type===`text`&&(Xr(r.value)??0)>65535}function Wr(e){return e}function Gr(e){return!e||typeof e!=`object`?``:`value`in e&&typeof e.value==`string`?e.value:`alt`in e&&typeof e.alt==`string`?e.alt:`children`in e&&Array.isArray(e.children)?e.children.map(Gr).join(``):``}function Kr(e){return`&#x${(e??0).toString(16).toUpperCase()};`}function qr(e){let[t=``]=[...e];return Kr(t.codePointAt(0)??F.eof)+e.slice(t.length)}function Jr(e){let t=[...e],n=t.pop();return`${t.join(``)}${Kr(n?.codePointAt(0)??F.eof)}`}function Yr(e){let t=[...e];return t.pop(),t.at(-1)?.codePointAt(0)??F.eof}function Xr(e){return e.codePointAt(0)??F.eof}function Zr(e){return[...e].at(-1)?.codePointAt(0)??F.eof}var Qr={current:wr,previous:F.eof},$r=Tr;function ei(){let e=this.data();(e.toMarkdownExtensions||=[]).push(Er())}function ti(e){Sr.call(this,e),ei.call(this)}var ni=ti,ri=new Set([`。`,`.`,`,`,`、`,`?`,`!`,`:`,`;`,`(`,`)`,`【`,`】`,`「`,`」`,`『`,`』`,`〈`,`〉`,`《`,`》`]),ii=/^(https?:\/\/|mailto:|www\.)/i,ai=e=>{if(e.children.length!==1)return!1;let t=e.children[0];return t.type===`text`&&t.value===e.url},oi=e=>{let t=0;for(let n of e){if(ri.has(n))return t;t+=n.length}return null},si=(e,t)=>({...t,url:e,children:[{type:`text`,value:e}]}),ci=e=>({type:`text`,value:e}),li=()=>e=>{We(e,`link`,(e,t,n)=>{if(!n||typeof t!=`number`||!ai(e)||!ii.test(e.url))return;let r=oi(e.url);if(r===null||r===0)return;let i=e.url.slice(0,r),a=e.url.slice(r),o=si(i,e),s=ci(a);return n.children.splice(t,1,o,s),t+1})};function ui(){let e=[br],t=[li,ni];return{name:`cjk`,type:`cjk`,remarkPluginsBefore:e,remarkPluginsAfter:t,remarkPlugins:[...e,...t]}}var di=ui(),L=class extends Error{constructor(e){super(e),this.name=`ShikiError`}};function fi(e){return pi(e)}function pi(e){return Array.isArray(e)?mi(e):e instanceof RegExp?e:typeof e==`object`?hi(e):e}function mi(e){let t=[];for(let n=0,r=e.length;n<r;n++)t[n]=pi(e[n]);return t}function hi(e){let t={};for(let n in e)t[n]=pi(e[n]);return t}function gi(e,...t){return t.forEach(t=>{for(let n in t)e[n]=t[n]}),e}function _i(e){let t=~e.lastIndexOf(`/`)||~e.lastIndexOf(`\\`);return t===0?e:~t===e.length-1?_i(e.substring(0,e.length-1)):e.substr(~t+1)}var vi=/\$(\d+)|\${(\d+):\/(downcase|upcase)}/g,yi=class{static hasCaptures(e){return e===null?!1:(vi.lastIndex=0,vi.test(e))}static replaceCaptures(e,t,n){return e.replace(vi,(e,r,i,a)=>{let o=n[parseInt(r||i,10)];if(o){let e=t.substring(o.start,o.end);for(;e[0]===`.`;)e=e.substring(1);switch(a){case`downcase`:return e.toLowerCase();case`upcase`:return e.toUpperCase();default:return e}}else return e})}};function bi(e,t){return e<t?-1:+(e>t)}function xi(e,t){if(e===null&&t===null)return 0;if(!e)return-1;if(!t)return 1;let n=e.length,r=t.length;if(n===r){for(let r=0;r<n;r++){let n=bi(e[r],t[r]);if(n!==0)return n}return 0}return n-r}function Si(e){return!!(/^#[0-9a-f]{6}$/i.test(e)||/^#[0-9a-f]{8}$/i.test(e)||/^#[0-9a-f]{3}$/i.test(e)||/^#[0-9a-f]{4}$/i.test(e))}function Ci(e){return e.replace(/[\-\\\{\}\*\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,`\\$&`)}var wi=class{constructor(e){this.fn=e}cache=new Map;get(e){if(this.cache.has(e))return this.cache.get(e);let t=this.fn(e);return this.cache.set(e,t),t}},Ti=class{constructor(e,t,n){this._colorMap=e,this._defaults=t,this._root=n}static createFromRawTheme(e,t){return this.createFromParsedTheme(Ai(e),t)}static createFromParsedTheme(e,t){return Mi(e,t)}_cachedMatchRoot=new wi(e=>this._root.match(e));getColorMap(){return this._colorMap.getColorMap()}getDefaults(){return this._defaults}match(e){if(e===null)return this._defaults;let t=e.scopeName,n=this._cachedMatchRoot.get(t).find(t=>Di(e.parent,t.parentScopes));return n?new ki(n.fontStyle,n.foreground,n.background):null}},Ei=class e{constructor(e,t){this.parent=e,this.scopeName=t}static push(t,n){for(let r of n)t=new e(t,r);return t}static from(...t){let n=null;for(let r=0;r<t.length;r++)n=new e(n,t[r]);return n}push(t){return new e(this,t)}getSegments(){let e=this,t=[];for(;e;)t.push(e.scopeName),e=e.parent;return t.reverse(),t}toString(){return this.getSegments().join(` `)}extends(e){return this===e?!0:this.parent===null?!1:this.parent.extends(e)}getExtensionIfDefined(e){let t=[],n=this;for(;n&&n!==e;)t.push(n.scopeName),n=n.parent;return n===e?t.reverse():void 0}};function Di(e,t){if(t.length===0)return!0;for(let n=0;n<t.length;n++){let r=t[n],i=!1;if(r===`>`){if(n===t.length-1)return!1;r=t[++n],i=!0}for(;e&&!Oi(e.scopeName,r);){if(i)return!1;e=e.parent}if(!e)return!1;e=e.parent}return!0}function Oi(e,t){return t===e||e.startsWith(t)&&e[t.length]===`.`}var ki=class{constructor(e,t,n){this.fontStyle=e,this.foregroundId=t,this.backgroundId=n}};function Ai(e){if(!e||!e.settings||!Array.isArray(e.settings))return[];let t=e.settings,n=[],r=0;for(let e=0,i=t.length;e<i;e++){let i=t[e];if(!i.settings)continue;let a;if(typeof i.scope==`string`){let e=i.scope;e=e.replace(/^[,]+/,``),e=e.replace(/[,]+$/,``),a=e.split(`,`)}else a=Array.isArray(i.scope)?i.scope:[``];let o=-1;if(typeof i.settings.fontStyle==`string`){o=0;let e=i.settings.fontStyle.split(` `);for(let t=0,n=e.length;t<n;t++)switch(e[t]){case`italic`:o|=1;break;case`bold`:o|=2;break;case`underline`:o|=4;break;case`strikethrough`:o|=8;break}}let s=null;typeof i.settings.foreground==`string`&&Si(i.settings.foreground)&&(s=i.settings.foreground);let c=null;typeof i.settings.background==`string`&&Si(i.settings.background)&&(c=i.settings.background);for(let t=0,i=a.length;t<i;t++){let i=a[t].trim().split(` `),l=i[i.length-1],u=null;i.length>1&&(u=i.slice(0,i.length-1),u.reverse()),n[r++]=new ji(l,u,e,o,s,c)}}return n}var ji=class{constructor(e,t,n,r,i,a){this.scope=e,this.parentScopes=t,this.index=n,this.fontStyle=r,this.foreground=i,this.background=a}},R=(e=>(e[e.NotSet=-1]=`NotSet`,e[e.None=0]=`None`,e[e.Italic=1]=`Italic`,e[e.Bold=2]=`Bold`,e[e.Underline=4]=`Underline`,e[e.Strikethrough=8]=`Strikethrough`,e))(R||{});function Mi(e,t){e.sort((e,t)=>{let n=bi(e.scope,t.scope);return n!==0||(n=xi(e.parentScopes,t.parentScopes),n!==0)?n:e.index-t.index});let n=0,r=`#000000`,i=`#ffffff`;for(;e.length>=1&&e[0].scope===``;){let t=e.shift();t.fontStyle!==-1&&(n=t.fontStyle),t.foreground!==null&&(r=t.foreground),t.background!==null&&(i=t.background)}let a=new Ni(t),o=new ki(n,a.getId(r),a.getId(i)),s=new Ii(new Fi(0,null,-1,0,0),[]);for(let t=0,n=e.length;t<n;t++){let n=e[t];s.insert(0,n.scope,n.parentScopes,n.fontStyle,a.getId(n.foreground),a.getId(n.background))}return new Ti(a,o,s)}var Ni=class{_isFrozen;_lastColorId;_id2color;_color2id;constructor(e){if(this._lastColorId=0,this._id2color=[],this._color2id=Object.create(null),Array.isArray(e)){this._isFrozen=!0;for(let t=0,n=e.length;t<n;t++)this._color2id[e[t]]=t,this._id2color[t]=e[t]}else this._isFrozen=!1}getId(e){if(e===null)return 0;e=e.toUpperCase();let t=this._color2id[e];if(t)return t;if(this._isFrozen)throw Error(`Missing color in color map - ${e}`);return t=++this._lastColorId,this._color2id[e]=t,this._id2color[t]=e,t}getColorMap(){return this._id2color.slice(0)}},Pi=Object.freeze([]),Fi=class e{scopeDepth;parentScopes;fontStyle;foreground;background;constructor(e,t,n,r,i){this.scopeDepth=e,this.parentScopes=t||Pi,this.fontStyle=n,this.foreground=r,this.background=i}clone(){return new e(this.scopeDepth,this.parentScopes,this.fontStyle,this.foreground,this.background)}static cloneArr(e){let t=[];for(let n=0,r=e.length;n<r;n++)t[n]=e[n].clone();return t}acceptOverwrite(e,t,n,r){this.scopeDepth>e?console.log(`how did this happen?`):this.scopeDepth=e,t!==-1&&(this.fontStyle=t),n!==0&&(this.foreground=n),r!==0&&(this.background=r)}},Ii=class e{constructor(e,t=[],n={}){this._mainRule=e,this._children=n,this._rulesWithParentScopes=t}_rulesWithParentScopes;static _cmpBySpecificity(e,t){if(e.scopeDepth!==t.scopeDepth)return t.scopeDepth-e.scopeDepth;let n=0,r=0;for(;e.parentScopes[n]===`>`&&n++,t.parentScopes[r]===`>`&&r++,!(n>=e.parentScopes.length||r>=t.parentScopes.length);){let i=t.parentScopes[r].length-e.parentScopes[n].length;if(i!==0)return i;n++,r++}return t.parentScopes.length-e.parentScopes.length}match(t){if(t!==``){let e=t.indexOf(`.`),n,r;if(e===-1?(n=t,r=``):(n=t.substring(0,e),r=t.substring(e+1)),this._children.hasOwnProperty(n))return this._children[n].match(r)}let n=this._rulesWithParentScopes.concat(this._mainRule);return n.sort(e._cmpBySpecificity),n}insert(t,n,r,i,a,o){if(n===``){this._doInsertHere(t,r,i,a,o);return}let s=n.indexOf(`.`),c,l;s===-1?(c=n,l=``):(c=n.substring(0,s),l=n.substring(s+1));let u;this._children.hasOwnProperty(c)?u=this._children[c]:(u=new e(this._mainRule.clone(),Fi.cloneArr(this._rulesWithParentScopes)),this._children[c]=u),u.insert(t+1,l,r,i,a,o)}_doInsertHere(e,t,n,r,i){if(t===null){this._mainRule.acceptOverwrite(e,n,r,i);return}for(let a=0,o=this._rulesWithParentScopes.length;a<o;a++){let o=this._rulesWithParentScopes[a];if(xi(o.parentScopes,t)===0){o.acceptOverwrite(e,n,r,i);return}}n===-1&&(n=this._mainRule.fontStyle),r===0&&(r=this._mainRule.foreground),i===0&&(i=this._mainRule.background),this._rulesWithParentScopes.push(new Fi(e,t,n,r,i))}},Li=class e{static toBinaryStr(e){return e.toString(2).padStart(32,`0`)}static print(t){let n=e.getLanguageId(t),r=e.getTokenType(t),i=e.getFontStyle(t),a=e.getForeground(t),o=e.getBackground(t);console.log({languageId:n,tokenType:r,fontStyle:i,foreground:a,background:o})}static getLanguageId(e){return(e&255)>>>0}static getTokenType(e){return(e&768)>>>8}static containsBalancedBrackets(e){return(e&1024)!=0}static getFontStyle(e){return(e&30720)>>>11}static getForeground(e){return(e&16744448)>>>15}static getBackground(e){return(e&4278190080)>>>24}static set(t,n,r,i,a,o,s){let c=e.getLanguageId(t),l=e.getTokenType(t),u=+!!e.containsBalancedBrackets(t),d=e.getFontStyle(t),f=e.getForeground(t),p=e.getBackground(t);return n!==0&&(c=n),r!==8&&(l=zi(r)),i!==null&&(u=+!!i),a!==-1&&(d=a),o!==0&&(f=o),s!==0&&(p=s),(c<<0|l<<8|u<<10|d<<11|f<<15|p<<24)>>>0}};function Ri(e){return e}function zi(e){return e}function Bi(e,t){let n=[],r=Hi(e),i=r.next();for(;i!==null;){let e=0;if(i.length===2&&i.charAt(1)===`:`){switch(i.charAt(0)){case`R`:e=1;break;case`L`:e=-1;break;default:console.log(`Unknown priority ${i} in scope selector`)}i=r.next()}let t=o();if(n.push({matcher:t,priority:e}),i!==`,`)break;i=r.next()}return n;function a(){if(i===`-`){i=r.next();let e=a();return t=>!!e&&!e(t)}if(i===`(`){i=r.next();let e=s();return i===`)`&&(i=r.next()),e}if(Vi(i)){let e=[];do e.push(i),i=r.next();while(Vi(i));return n=>t(e,n)}return null}function o(){let e=[],t=a();for(;t;)e.push(t),t=a();return t=>e.every(e=>e(t))}function s(){let e=[],t=o();for(;t&&(e.push(t),i===`|`||i===`,`);){do i=r.next();while(i===`|`||i===`,`);t=o()}return t=>e.some(e=>e(t))}}function Vi(e){return!!e&&!!e.match(/[\w\.:]+/)}function Hi(e){let t=/([LR]:|[\w\.:][\w\.:\-]*|[\,\|\-\(\)])/g,n=t.exec(e);return{next:()=>{if(!n)return null;let r=n[0];return n=t.exec(e),r}}}function Ui(e){typeof e.dispose==`function`&&e.dispose()}var Wi=class{constructor(e){this.scopeName=e}toKey(){return this.scopeName}},Gi=class{constructor(e,t){this.scopeName=e,this.ruleName=t}toKey(){return`${this.scopeName}#${this.ruleName}`}},Ki=class{_references=[];_seenReferenceKeys=new Set;get references(){return this._references}visitedRule=new Set;add(e){let t=e.toKey();this._seenReferenceKeys.has(t)||(this._seenReferenceKeys.add(t),this._references.push(e))}},qi=class{constructor(e,t){this.repo=e,this.initialScopeName=t,this.seenFullScopeRequests.add(this.initialScopeName),this.Q=[new Wi(this.initialScopeName)]}seenFullScopeRequests=new Set;seenPartialScopeRequests=new Set;Q;processQueue(){let e=this.Q;this.Q=[];let t=new Ki;for(let n of e)Ji(n,this.initialScopeName,this.repo,t);for(let e of t.references)if(e instanceof Wi){if(this.seenFullScopeRequests.has(e.scopeName))continue;this.seenFullScopeRequests.add(e.scopeName),this.Q.push(e)}else{if(this.seenFullScopeRequests.has(e.scopeName)||this.seenPartialScopeRequests.has(e.toKey()))continue;this.seenPartialScopeRequests.add(e.toKey()),this.Q.push(e)}}};function Ji(e,t,n,r){let i=n.lookup(e.scopeName);if(!i){if(e.scopeName===t)throw Error(`No grammar provided for <${t}>`);return}let a=n.lookup(t);e instanceof Wi?Xi({baseGrammar:a,selfGrammar:i},r):Yi(e.ruleName,{baseGrammar:a,selfGrammar:i,repository:i.repository},r);let o=n.injections(e.scopeName);if(o)for(let e of o)r.add(new Wi(e))}function Yi(e,t,n){if(t.repository&&t.repository[e]){let r=t.repository[e];Zi([r],t,n)}}function Xi(e,t){e.selfGrammar.patterns&&Array.isArray(e.selfGrammar.patterns)&&Zi(e.selfGrammar.patterns,{...e,repository:e.selfGrammar.repository},t),e.selfGrammar.injections&&Zi(Object.values(e.selfGrammar.injections),{...e,repository:e.selfGrammar.repository},t)}function Zi(e,t,n){for(let r of e){if(n.visitedRule.has(r))continue;n.visitedRule.add(r);let e=r.repository?gi({},t.repository,r.repository):t.repository;Array.isArray(r.patterns)&&Zi(r.patterns,{...t,repository:e},n);let i=r.include;if(!i)continue;let a=ra(i);switch(a.kind){case 0:Xi({...t,selfGrammar:t.baseGrammar},n);break;case 1:Xi(t,n);break;case 2:Yi(a.ruleName,{...t,repository:e},n);break;case 3:case 4:let r=a.scopeName===t.selfGrammar.scopeName?t.selfGrammar:a.scopeName===t.baseGrammar.scopeName?t.baseGrammar:void 0;if(r){let i={baseGrammar:t.baseGrammar,selfGrammar:r,repository:e};a.kind===4?Yi(a.ruleName,i,n):Xi(i,n)}else a.kind===4?n.add(new Gi(a.scopeName,a.ruleName)):n.add(new Wi(a.scopeName));break}}}var Qi=class{kind=0},$i=class{kind=1},ea=class{constructor(e){this.ruleName=e}kind=2},ta=class{constructor(e){this.scopeName=e}kind=3},na=class{constructor(e,t){this.scopeName=e,this.ruleName=t}kind=4};function ra(e){if(e===`$base`)return new Qi;if(e===`$self`)return new $i;let t=e.indexOf(`#`);return t===-1?new ta(e):t===0?new ea(e.substring(1)):new na(e.substring(0,t),e.substring(t+1))}var ia=/\\(\d+)/,aa=/\\(\d+)/g,oa=-1,sa=-2;function ca(e){return e}function la(e){return e}var ua=class{$location;id;_nameIsCapturing;_name;_contentNameIsCapturing;_contentName;constructor(e,t,n,r){this.$location=e,this.id=t,this._name=n||null,this._nameIsCapturing=yi.hasCaptures(this._name),this._contentName=r||null,this._contentNameIsCapturing=yi.hasCaptures(this._contentName)}get debugName(){let e=this.$location?`${_i(this.$location.filename)}:${this.$location.line}`:`unknown`;return`${this.constructor.name}#${this.id} @ ${e}`}getName(e,t){return!this._nameIsCapturing||this._name===null||e===null||t===null?this._name:yi.replaceCaptures(this._name,e,t)}getContentName(e,t){return!this._contentNameIsCapturing||this._contentName===null?this._contentName:yi.replaceCaptures(this._contentName,e,t)}},da=class extends ua{retokenizeCapturedWithRuleId;constructor(e,t,n,r,i){super(e,t,n,r),this.retokenizeCapturedWithRuleId=i}dispose(){}collectPatterns(e,t){throw Error(`Not supported!`)}compile(e,t){throw Error(`Not supported!`)}compileAG(e,t,n,r){throw Error(`Not supported!`)}},fa=class extends ua{_match;captures;_cachedCompiledPatterns;constructor(e,t,n,r,i){super(e,t,n,null),this._match=new _a(r,this.id),this.captures=i,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&=(this._cachedCompiledPatterns.dispose(),null)}get debugMatchRegExp(){return`${this._match.source}`}collectPatterns(e,t){t.push(this._match)}compile(e,t){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,t,n,r){return this._getCachedCompiledPatterns(e).compileAG(e,n,r)}_getCachedCompiledPatterns(e){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new va,this.collectPatterns(e,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},pa=class extends ua{hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(e,t,n,r,i){super(e,t,n,r),this.patterns=i.patterns,this.hasMissingPatterns=i.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&=(this._cachedCompiledPatterns.dispose(),null)}collectPatterns(e,t){for(let n of this.patterns)e.getRule(n).collectPatterns(e,t)}compile(e,t){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,t,n,r){return this._getCachedCompiledPatterns(e).compileAG(e,n,r)}_getCachedCompiledPatterns(e){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new va,this.collectPatterns(e,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},ma=class extends ua{_begin;beginCaptures;_end;endHasBackReferences;endCaptures;applyEndPatternLast;hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(e,t,n,r,i,a,o,s,c,l){super(e,t,n,r),this._begin=new _a(i,this.id),this.beginCaptures=a,this._end=new _a(o||``,-1),this.endHasBackReferences=this._end.hasBackReferences,this.endCaptures=s,this.applyEndPatternLast=c||!1,this.patterns=l.patterns,this.hasMissingPatterns=l.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&=(this._cachedCompiledPatterns.dispose(),null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugEndRegExp(){return`${this._end.source}`}getEndWithResolvedBackReferences(e,t){return this._end.resolveBackReferences(e,t)}collectPatterns(e,t){t.push(this._begin)}compile(e,t){return this._getCachedCompiledPatterns(e,t).compile(e)}compileAG(e,t,n,r){return this._getCachedCompiledPatterns(e,t).compileAG(e,n,r)}_getCachedCompiledPatterns(e,t){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new va;for(let t of this.patterns)e.getRule(t).collectPatterns(e,this._cachedCompiledPatterns);this.applyEndPatternLast?this._cachedCompiledPatterns.push(this._end.hasBackReferences?this._end.clone():this._end):this._cachedCompiledPatterns.unshift(this._end.hasBackReferences?this._end.clone():this._end)}return this._end.hasBackReferences&&(this.applyEndPatternLast?this._cachedCompiledPatterns.setSource(this._cachedCompiledPatterns.length()-1,t):this._cachedCompiledPatterns.setSource(0,t)),this._cachedCompiledPatterns}},ha=class extends ua{_begin;beginCaptures;whileCaptures;_while;whileHasBackReferences;hasMissingPatterns;patterns;_cachedCompiledPatterns;_cachedCompiledWhilePatterns;constructor(e,t,n,r,i,a,o,s,c){super(e,t,n,r),this._begin=new _a(i,this.id),this.beginCaptures=a,this.whileCaptures=s,this._while=new _a(o,sa),this.whileHasBackReferences=this._while.hasBackReferences,this.patterns=c.patterns,this.hasMissingPatterns=c.hasMissingPatterns,this._cachedCompiledPatterns=null,this._cachedCompiledWhilePatterns=null}dispose(){this._cachedCompiledPatterns&&=(this._cachedCompiledPatterns.dispose(),null),this._cachedCompiledWhilePatterns&&=(this._cachedCompiledWhilePatterns.dispose(),null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugWhileRegExp(){return`${this._while.source}`}getWhileWithResolvedBackReferences(e,t){return this._while.resolveBackReferences(e,t)}collectPatterns(e,t){t.push(this._begin)}compile(e,t){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,t,n,r){return this._getCachedCompiledPatterns(e).compileAG(e,n,r)}_getCachedCompiledPatterns(e){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new va;for(let t of this.patterns)e.getRule(t).collectPatterns(e,this._cachedCompiledPatterns)}return this._cachedCompiledPatterns}compileWhile(e,t){return this._getCachedCompiledWhilePatterns(e,t).compile(e)}compileWhileAG(e,t,n,r){return this._getCachedCompiledWhilePatterns(e,t).compileAG(e,n,r)}_getCachedCompiledWhilePatterns(e,t){return this._cachedCompiledWhilePatterns||(this._cachedCompiledWhilePatterns=new va,this._cachedCompiledWhilePatterns.push(this._while.hasBackReferences?this._while.clone():this._while)),this._while.hasBackReferences&&this._cachedCompiledWhilePatterns.setSource(0,t||``),this._cachedCompiledWhilePatterns}},ga=class e{static createCaptureRule(e,t,n,r,i){return e.registerRule(e=>new da(t,e,n,r,i))}static getCompiledRuleId(t,n,r){return t.id||n.registerRule(i=>{if(t.id=i,t.match)return new fa(t.$vscodeTextmateLocation,t.id,t.name,t.match,e._compileCaptures(t.captures,n,r));if(t.begin===void 0){t.repository&&(r=gi({},r,t.repository));let i=t.patterns;return i===void 0&&t.include&&(i=[{include:t.include}]),new pa(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,e._compilePatterns(i,n,r))}return t.while?new ha(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,t.begin,e._compileCaptures(t.beginCaptures||t.captures,n,r),t.while,e._compileCaptures(t.whileCaptures||t.captures,n,r),e._compilePatterns(t.patterns,n,r)):new ma(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,t.begin,e._compileCaptures(t.beginCaptures||t.captures,n,r),t.end,e._compileCaptures(t.endCaptures||t.captures,n,r),t.applyEndPatternLast,e._compilePatterns(t.patterns,n,r))}),t.id}static _compileCaptures(t,n,r){let i=[];if(t){let a=0;for(let e in t){if(e===`$vscodeTextmateLocation`)continue;let t=parseInt(e,10);t>a&&(a=t)}for(let e=0;e<=a;e++)i[e]=null;for(let a in t){if(a===`$vscodeTextmateLocation`)continue;let o=parseInt(a,10),s=0;t[a].patterns&&(s=e.getCompiledRuleId(t[a],n,r)),i[o]=e.createCaptureRule(n,t[a].$vscodeTextmateLocation,t[a].name,t[a].contentName,s)}}return i}static _compilePatterns(t,n,r){let i=[];if(t)for(let a=0,o=t.length;a<o;a++){let o=t[a],s=-1;if(o.include){let t=ra(o.include);switch(t.kind){case 0:case 1:s=e.getCompiledRuleId(r[o.include],n,r);break;case 2:let i=r[t.ruleName];i&&(s=e.getCompiledRuleId(i,n,r));break;case 3:case 4:let a=t.scopeName,c=t.kind===4?t.ruleName:null,l=n.getExternalGrammar(a,r);if(l)if(c){let t=l.repository[c];t&&(s=e.getCompiledRuleId(t,n,l.repository))}else s=e.getCompiledRuleId(l.repository.$self,n,l.repository);break}}else s=e.getCompiledRuleId(o,n,r);if(s!==-1){let e=n.getRule(s),t=!1;if((e instanceof pa||e instanceof ma||e instanceof ha)&&e.hasMissingPatterns&&e.patterns.length===0&&(t=!0),t)continue;i.push(s)}}return{patterns:i,hasMissingPatterns:(t?t.length:0)!==i.length}}},_a=class e{source;ruleId;hasAnchor;hasBackReferences;_anchorCache;constructor(e,t){if(e&&typeof e==`string`){let t=e.length,n=0,r=[],i=!1;for(let a=0;a<t;a++)if(e.charAt(a)===`\\`&&a+1<t){let t=e.charAt(a+1);t===`z`?(r.push(e.substring(n,a)),r.push(`$(?!\\n)(?<!\\n)`),n=a+2):(t===`A`||t===`G`)&&(i=!0),a++}this.hasAnchor=i,n===0?this.source=e:(r.push(e.substring(n,t)),this.source=r.join(``))}else this.hasAnchor=!1,this.source=e;this.hasAnchor?this._anchorCache=this._buildAnchorCache():this._anchorCache=null,this.ruleId=t,typeof this.source==`string`?this.hasBackReferences=ia.test(this.source):this.hasBackReferences=!1}clone(){return new e(this.source,this.ruleId)}setSource(e){this.source!==e&&(this.source=e,this.hasAnchor&&(this._anchorCache=this._buildAnchorCache()))}resolveBackReferences(e,t){if(typeof this.source!=`string`)throw Error(`This method should only be called if the source is a string`);let n=t.map(t=>e.substring(t.start,t.end));return aa.lastIndex=0,this.source.replace(aa,(e,t)=>Ci(n[parseInt(t,10)]||``))}_buildAnchorCache(){if(typeof this.source!=`string`)throw Error(`This method should only be called if the source is a string`);let e=[],t=[],n=[],r=[],i,a,o,s;for(i=0,a=this.source.length;i<a;i++)o=this.source.charAt(i),e[i]=o,t[i]=o,n[i]=o,r[i]=o,o===`\\`&&i+1<a&&(s=this.source.charAt(i+1),s===`A`?(e[i+1]=``,t[i+1]=``,n[i+1]=`A`,r[i+1]=`A`):s===`G`?(e[i+1]=``,t[i+1]=`G`,n[i+1]=``,r[i+1]=`G`):(e[i+1]=s,t[i+1]=s,n[i+1]=s,r[i+1]=s),i++);return{A0_G0:e.join(``),A0_G1:t.join(``),A1_G0:n.join(``),A1_G1:r.join(``)}}resolveAnchors(e,t){return!this.hasAnchor||!this._anchorCache||typeof this.source!=`string`?this.source:e?t?this._anchorCache.A1_G1:this._anchorCache.A1_G0:t?this._anchorCache.A0_G1:this._anchorCache.A0_G0}},va=class{_items;_hasAnchors;_cached;_anchorCache;constructor(){this._items=[],this._hasAnchors=!1,this._cached=null,this._anchorCache={A0_G0:null,A0_G1:null,A1_G0:null,A1_G1:null}}dispose(){this._disposeCaches()}_disposeCaches(){this._cached&&=(this._cached.dispose(),null),this._anchorCache.A0_G0&&(this._anchorCache.A0_G0.dispose(),this._anchorCache.A0_G0=null),this._anchorCache.A0_G1&&(this._anchorCache.A0_G1.dispose(),this._anchorCache.A0_G1=null),this._anchorCache.A1_G0&&(this._anchorCache.A1_G0.dispose(),this._anchorCache.A1_G0=null),this._anchorCache.A1_G1&&(this._anchorCache.A1_G1.dispose(),this._anchorCache.A1_G1=null)}push(e){this._items.push(e),this._hasAnchors=this._hasAnchors||e.hasAnchor}unshift(e){this._items.unshift(e),this._hasAnchors=this._hasAnchors||e.hasAnchor}length(){return this._items.length}setSource(e,t){this._items[e].source!==t&&(this._disposeCaches(),this._items[e].setSource(t))}compile(e){if(!this._cached){let t=this._items.map(e=>e.source);this._cached=new ya(e,t,this._items.map(e=>e.ruleId))}return this._cached}compileAG(e,t,n){return this._hasAnchors?t?n?(this._anchorCache.A1_G1||(this._anchorCache.A1_G1=this._resolveAnchors(e,t,n)),this._anchorCache.A1_G1):(this._anchorCache.A1_G0||(this._anchorCache.A1_G0=this._resolveAnchors(e,t,n)),this._anchorCache.A1_G0):n?(this._anchorCache.A0_G1||(this._anchorCache.A0_G1=this._resolveAnchors(e,t,n)),this._anchorCache.A0_G1):(this._anchorCache.A0_G0||(this._anchorCache.A0_G0=this._resolveAnchors(e,t,n)),this._anchorCache.A0_G0):this.compile(e)}_resolveAnchors(e,t,n){return new ya(e,this._items.map(e=>e.resolveAnchors(t,n)),this._items.map(e=>e.ruleId))}},ya=class{constructor(e,t,n){this.regExps=t,this.rules=n,this.scanner=e.createOnigScanner(t)}scanner;dispose(){typeof this.scanner.dispose==`function`&&this.scanner.dispose()}toString(){let e=[];for(let t=0,n=this.rules.length;t<n;t++)e.push(` - `+this.rules[t]+`: `+this.regExps[t]);return e.join(`
|
|
3
|
+
`)}findNextMatchSync(e,t,n){let r=this.scanner.findNextMatchSync(e,t,n);return r?{ruleId:this.rules[r.index],captureIndices:r.captureIndices}:null}},ba=class{constructor(e,t){this.languageId=e,this.tokenType=t}},xa=class e{_defaultAttributes;_embeddedLanguagesMatcher;constructor(e,t){this._defaultAttributes=new ba(e,8),this._embeddedLanguagesMatcher=new Sa(Object.entries(t||{}))}getDefaultAttributes(){return this._defaultAttributes}getBasicScopeAttributes(t){return t===null?e._NULL_SCOPE_METADATA:this._getBasicScopeAttributes.get(t)}static _NULL_SCOPE_METADATA=new ba(0,0);_getBasicScopeAttributes=new wi(e=>new ba(this._scopeToLanguage(e),this._toStandardTokenType(e)));_scopeToLanguage(e){return this._embeddedLanguagesMatcher.match(e)||0}_toStandardTokenType(t){let n=t.match(e.STANDARD_TOKEN_TYPE_REGEXP);if(!n)return 8;switch(n[1]){case`comment`:return 1;case`string`:return 2;case`regex`:return 3;case`meta.embedded`:return 0}throw Error(`Unexpected match for standard token type!`)}static STANDARD_TOKEN_TYPE_REGEXP=/\b(comment|string|regex|meta\.embedded)\b/},Sa=class{values;scopesRegExp;constructor(e){if(e.length===0)this.values=null,this.scopesRegExp=null;else{this.values=new Map(e);let t=e.map(([e,t])=>Ci(e));t.sort(),t.reverse(),this.scopesRegExp=RegExp(`^((${t.join(`)|(`)}))($|\\.)`,``)}}match(e){if(!this.scopesRegExp)return;let t=e.match(this.scopesRegExp);if(t)return this.values.get(t[1])}};typeof process<`u`&&{}.VSCODE_TEXTMATE_DEBUG;var Ca=!1,wa=class{constructor(e,t){this.stack=e,this.stoppedEarly=t}};function Ta(e,t,n,r,i,a,o,s){let c=t.content.length,l=!1,u=-1;if(o){let o=Ea(e,t,n,r,i,a);i=o.stack,r=o.linePos,n=o.isFirstLine,u=o.anchorPosition}let d=Date.now();for(;!l;){if(s!==0&&Date.now()-d>s)return new wa(i,!0);f()}return new wa(i,!1);function f(){let o=Da(e,t,n,r,i,u);if(!o){a.produce(i,c),l=!0;return}let s=o.captureIndices,d=o.matchedRuleId,f=s&&s.length>0?s[0].end>r:!1;if(d===oa){let o=i.getRule(e);a.produce(i,s[0].start),i=i.withContentNameScopesList(i.nameScopesList),Na(e,t,n,i,a,o.endCaptures,s),a.produce(i,s[0].end);let d=i;if(i=i.parent,u=d.getAnchorPos(),!f&&d.getEnterPos()===r){i=d,a.produce(i,c),l=!0;return}}else{let o=e.getRule(d);a.produce(i,s[0].start);let p=i,m=o.getName(t.content,s),h=i.contentNameScopesList.pushAttributed(m,e);if(i=i.push(d,r,u,s[0].end===c,null,h,h),o instanceof ma){let r=o;Na(e,t,n,i,a,r.beginCaptures,s),a.produce(i,s[0].end),u=s[0].end;let d=r.getContentName(t.content,s),m=h.pushAttributed(d,e);if(i=i.withContentNameScopesList(m),r.endHasBackReferences&&(i=i.withEndRule(r.getEndWithResolvedBackReferences(t.content,s))),!f&&p.hasSameRuleAs(i)){i=i.pop(),a.produce(i,c),l=!0;return}}else if(o instanceof ha){let r=o;Na(e,t,n,i,a,r.beginCaptures,s),a.produce(i,s[0].end),u=s[0].end;let d=r.getContentName(t.content,s),m=h.pushAttributed(d,e);if(i=i.withContentNameScopesList(m),r.whileHasBackReferences&&(i=i.withEndRule(r.getWhileWithResolvedBackReferences(t.content,s))),!f&&p.hasSameRuleAs(i)){i=i.pop(),a.produce(i,c),l=!0;return}}else if(Na(e,t,n,i,a,o.captures,s),a.produce(i,s[0].end),i=i.pop(),!f){i=i.safePop(),a.produce(i,c),l=!0;return}}s[0].end>r&&(r=s[0].end,n=!1)}}function Ea(e,t,n,r,i,a){let o=i.beginRuleCapturedEOL?0:-1,s=[];for(let t=i;t;t=t.pop()){let n=t.getRule(e);n instanceof ha&&s.push({rule:n,stack:t})}for(let c=s.pop();c;c=s.pop()){let{ruleScanner:s,findOptions:l}=ja(c.rule,e,c.stack.endRule,n,r===o),u=s.findNextMatchSync(t,r,l);if(u){if(u.ruleId!==sa){i=c.stack.pop();break}u.captureIndices&&u.captureIndices.length&&(a.produce(c.stack,u.captureIndices[0].start),Na(e,t,n,c.stack,a,c.rule.whileCaptures,u.captureIndices),a.produce(c.stack,u.captureIndices[0].end),o=u.captureIndices[0].end,u.captureIndices[0].end>r&&(r=u.captureIndices[0].end,n=!1))}else{i=c.stack.pop();break}}return{stack:i,linePos:r,anchorPosition:o,isFirstLine:n}}function Da(e,t,n,r,i,a){let o=Oa(e,t,n,r,i,a),s=e.getInjections();if(s.length===0)return o;let c=ka(s,e,t,n,r,i,a);if(!c)return o;if(!o)return c;let l=o.captureIndices[0].start,u=c.captureIndices[0].start;return u<l||c.priorityMatch&&u===l?c:o}function Oa(e,t,n,r,i,a){let{ruleScanner:o,findOptions:s}=Aa(i.getRule(e),e,i.endRule,n,r===a),c=o.findNextMatchSync(t,r,s);return c?{captureIndices:c.captureIndices,matchedRuleId:c.ruleId}:null}function ka(e,t,n,r,i,a,o){let s=Number.MAX_VALUE,c=null,l,u=0,d=a.contentNameScopesList.getScopeNames();for(let a=0,f=e.length;a<f;a++){let f=e[a];if(!f.matcher(d))continue;let{ruleScanner:p,findOptions:m}=Aa(t.getRule(f.ruleId),t,null,r,i===o),h=p.findNextMatchSync(n,i,m);if(!h)continue;let g=h.captureIndices[0].start;if(!(g>=s)&&(s=g,c=h.captureIndices,l=h.ruleId,u=f.priority,s===i))break}return c?{priorityMatch:u===-1,captureIndices:c,matchedRuleId:l}:null}function Aa(e,t,n,r,i){return Ca?{ruleScanner:e.compile(t,n),findOptions:Ma(r,i)}:{ruleScanner:e.compileAG(t,n,r,i),findOptions:0}}function ja(e,t,n,r,i){return Ca?{ruleScanner:e.compileWhile(t,n),findOptions:Ma(r,i)}:{ruleScanner:e.compileWhileAG(t,n,r,i),findOptions:0}}function Ma(e,t){let n=0;return e||(n|=1),t||(n|=4),n}function Na(e,t,n,r,i,a,o){if(a.length===0)return;let s=t.content,c=Math.min(a.length,o.length),l=[],u=o[0].end;for(let t=0;t<c;t++){let c=a[t];if(c===null)continue;let d=o[t];if(d.length===0)continue;if(d.start>u)break;for(;l.length>0&&l[l.length-1].endPos<=d.start;)i.produceFromScopes(l[l.length-1].scopes,l[l.length-1].endPos),l.pop();if(l.length>0?i.produceFromScopes(l[l.length-1].scopes,d.start):i.produce(r,d.start),c.retokenizeCapturedWithRuleId){let t=c.getName(s,o),a=r.contentNameScopesList.pushAttributed(t,e),l=c.getContentName(s,o),u=a.pushAttributed(l,e),f=r.push(c.retokenizeCapturedWithRuleId,d.start,-1,!1,null,a,u),p=e.createOnigString(s.substring(0,d.end));Ta(e,p,n&&d.start===0,d.start,f,i,!1,0),Ui(p);continue}let f=c.getName(s,o);if(f!==null){let t=(l.length>0?l[l.length-1].scopes:r.contentNameScopesList).pushAttributed(f,e);l.push(new Pa(t,d.end))}}for(;l.length>0;)i.produceFromScopes(l[l.length-1].scopes,l[l.length-1].endPos),l.pop()}var Pa=class{scopes;endPos;constructor(e,t){this.scopes=e,this.endPos=t}};function Fa(e,t,n,r,i,a,o,s){return new za(e,t,n,r,i,a,o,s)}function Ia(e,t,n,r,i){let a=Bi(t,La),o=ga.getCompiledRuleId(n,r,i.repository);for(let n of a)e.push({debugSelector:t,matcher:n.matcher,ruleId:o,grammar:i,priority:n.priority})}function La(e,t){if(t.length<e.length)return!1;let n=0;return e.every(e=>{for(let r=n;r<t.length;r++)if(Ra(t[r],e))return n=r+1,!0;return!1})}function Ra(e,t){if(!e)return!1;if(e===t)return!0;let n=t.length;return e.length>n&&e.substr(0,n)===t&&e[n]===`.`}var za=class{constructor(e,t,n,r,i,a,o,s){if(this._rootScopeName=e,this.balancedBracketSelectors=a,this._onigLib=s,this._basicScopeAttributesProvider=new xa(n,r),this._rootId=-1,this._lastRuleId=0,this._ruleId2desc=[null],this._includedGrammars={},this._grammarRepository=o,this._grammar=Ba(t,null),this._injections=null,this._tokenTypeMatchers=[],i)for(let e of Object.keys(i)){let t=Bi(e,La);for(let n of t)this._tokenTypeMatchers.push({matcher:n.matcher,type:i[e]})}}_rootId;_lastRuleId;_ruleId2desc;_includedGrammars;_grammarRepository;_grammar;_injections;_basicScopeAttributesProvider;_tokenTypeMatchers;get themeProvider(){return this._grammarRepository}dispose(){for(let e of this._ruleId2desc)e&&e.dispose()}createOnigScanner(e){return this._onigLib.createOnigScanner(e)}createOnigString(e){return this._onigLib.createOnigString(e)}getMetadataForScope(e){return this._basicScopeAttributesProvider.getBasicScopeAttributes(e)}_collectInjections(){let e={lookup:e=>e===this._rootScopeName?this._grammar:this.getExternalGrammar(e),injections:e=>this._grammarRepository.injections(e)},t=[],n=this._rootScopeName,r=e.lookup(n);if(r){let e=r.injections;if(e)for(let n in e)Ia(t,n,e[n],this,r);let i=this._grammarRepository.injections(n);i&&i.forEach(e=>{let n=this.getExternalGrammar(e);if(n){let e=n.injectionSelector;e&&Ia(t,e,n,this,n)}})}return t.sort((e,t)=>e.priority-t.priority),t}getInjections(){return this._injections===null&&(this._injections=this._collectInjections()),this._injections}registerRule(e){let t=++this._lastRuleId,n=e(ca(t));return this._ruleId2desc[t]=n,n}getRule(e){return this._ruleId2desc[la(e)]}getExternalGrammar(e,t){if(this._includedGrammars[e])return this._includedGrammars[e];if(this._grammarRepository){let n=this._grammarRepository.lookup(e);if(n)return this._includedGrammars[e]=Ba(n,t&&t.$base),this._includedGrammars[e]}}tokenizeLine(e,t,n=0){let r=this._tokenize(e,t,!1,n);return{tokens:r.lineTokens.getResult(r.ruleStack,r.lineLength),ruleStack:r.ruleStack,stoppedEarly:r.stoppedEarly}}tokenizeLine2(e,t,n=0){let r=this._tokenize(e,t,!0,n);return{tokens:r.lineTokens.getBinaryResult(r.ruleStack,r.lineLength),ruleStack:r.ruleStack,stoppedEarly:r.stoppedEarly}}_tokenize(e,t,n,r){this._rootId===-1&&(this._rootId=ga.getCompiledRuleId(this._grammar.repository.$self,this,this._grammar.repository),this.getInjections());let i;if(!t||t===Ha.NULL){i=!0;let e=this._basicScopeAttributesProvider.getDefaultAttributes(),n=this.themeProvider.getDefaults(),r=Li.set(0,e.languageId,e.tokenType,null,n.fontStyle,n.foregroundId,n.backgroundId),a=this.getRule(this._rootId).getName(null,null),o;o=a?Va.createRootAndLookUpScopeName(a,r,this):Va.createRoot(`unknown`,r),t=new Ha(null,this._rootId,-1,-1,!1,null,o,o)}else i=!1,t.reset();e+=`
|
|
4
|
+
`;let a=this.createOnigString(e),o=a.content.length,s=new Wa(n,e,this._tokenTypeMatchers,this.balancedBracketSelectors),c=Ta(this,a,i,0,t,s,!0,r);return Ui(a),{lineLength:o,lineTokens:s,ruleStack:c.stack,stoppedEarly:c.stoppedEarly}}};function Ba(e,t){return e=fi(e),e.repository=e.repository||{},e.repository.$self={$vscodeTextmateLocation:e.$vscodeTextmateLocation,patterns:e.patterns,name:e.scopeName},e.repository.$base=t||e.repository.$self,e}var Va=class e{constructor(e,t,n){this.parent=e,this.scopePath=t,this.tokenAttributes=n}static fromExtension(t,n){let r=t,i=t?.scopePath??null;for(let t of n)i=Ei.push(i,t.scopeNames),r=new e(r,i,t.encodedTokenAttributes);return r}static createRoot(t,n){return new e(null,new Ei(null,t),n)}static createRootAndLookUpScopeName(t,n,r){let i=r.getMetadataForScope(t),a=new Ei(null,t),o=r.themeProvider.themeMatch(a);return new e(null,a,e.mergeAttributes(n,i,o))}get scopeName(){return this.scopePath.scopeName}toString(){return this.getScopeNames().join(` `)}equals(t){return e.equals(this,t)}static equals(e,t){do{if(e===t||!e&&!t)return!0;if(!e||!t||e.scopeName!==t.scopeName||e.tokenAttributes!==t.tokenAttributes)return!1;e=e.parent,t=t.parent}while(!0)}static mergeAttributes(e,t,n){let r=-1,i=0,a=0;return n!==null&&(r=n.fontStyle,i=n.foregroundId,a=n.backgroundId),Li.set(e,t.languageId,t.tokenType,null,r,i,a)}pushAttributed(t,n){if(t===null)return this;if(t.indexOf(` `)===-1)return e._pushAttributed(this,t,n);let r=t.split(/ /g),i=this;for(let t of r)i=e._pushAttributed(i,t,n);return i}static _pushAttributed(t,n,r){let i=r.getMetadataForScope(n),a=t.scopePath.push(n),o=r.themeProvider.themeMatch(a);return new e(t,a,e.mergeAttributes(t.tokenAttributes,i,o))}getScopeNames(){return this.scopePath.getSegments()}getExtensionIfDefined(e){let t=[],n=this;for(;n&&n!==e;)t.push({encodedTokenAttributes:n.tokenAttributes,scopeNames:n.scopePath.getExtensionIfDefined(n.parent?.scopePath??null)}),n=n.parent;return n===e?t.reverse():void 0}},Ha=class e{constructor(e,t,n,r,i,a,o,s){this.parent=e,this.ruleId=t,this.beginRuleCapturedEOL=i,this.endRule=a,this.nameScopesList=o,this.contentNameScopesList=s,this.depth=this.parent?this.parent.depth+1:1,this._enterPos=n,this._anchorPos=r}_stackElementBrand=void 0;static NULL=new e(null,0,0,0,!1,null,null,null);_enterPos;_anchorPos;depth;equals(t){return t===null?!1:e._equals(this,t)}static _equals(e,t){return e===t?!0:this._structuralEquals(e,t)?Va.equals(e.contentNameScopesList,t.contentNameScopesList):!1}static _structuralEquals(e,t){do{if(e===t||!e&&!t)return!0;if(!e||!t||e.depth!==t.depth||e.ruleId!==t.ruleId||e.endRule!==t.endRule)return!1;e=e.parent,t=t.parent}while(!0)}clone(){return this}static _reset(e){for(;e;)e._enterPos=-1,e._anchorPos=-1,e=e.parent}reset(){e._reset(this)}pop(){return this.parent}safePop(){return this.parent?this.parent:this}push(t,n,r,i,a,o,s){return new e(this,t,n,r,i,a,o,s)}getEnterPos(){return this._enterPos}getAnchorPos(){return this._anchorPos}getRule(e){return e.getRule(this.ruleId)}toString(){let e=[];return this._writeString(e,0),`[`+e.join(`,`)+`]`}_writeString(e,t){return this.parent&&(t=this.parent._writeString(e,t)),e[t++]=`(${this.ruleId}, ${this.nameScopesList?.toString()}, ${this.contentNameScopesList?.toString()})`,t}withContentNameScopesList(e){return this.contentNameScopesList===e?this:this.parent.push(this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,this.endRule,this.nameScopesList,e)}withEndRule(t){return this.endRule===t?this:new e(this.parent,this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,t,this.nameScopesList,this.contentNameScopesList)}hasSameRuleAs(e){let t=this;for(;t&&t._enterPos===e._enterPos;){if(t.ruleId===e.ruleId)return!0;t=t.parent}return!1}toStateStackFrame(){return{ruleId:la(this.ruleId),beginRuleCapturedEOL:this.beginRuleCapturedEOL,endRule:this.endRule,nameScopesList:this.nameScopesList?.getExtensionIfDefined(this.parent?.nameScopesList??null)??[],contentNameScopesList:this.contentNameScopesList?.getExtensionIfDefined(this.nameScopesList)??[]}}static pushFrame(t,n){let r=Va.fromExtension(t?.nameScopesList??null,n.nameScopesList);return new e(t,ca(n.ruleId),n.enterPos??-1,n.anchorPos??-1,n.beginRuleCapturedEOL,n.endRule,r,Va.fromExtension(r,n.contentNameScopesList))}},Ua=class{balancedBracketScopes;unbalancedBracketScopes;allowAny=!1;constructor(e,t){this.balancedBracketScopes=e.flatMap(e=>e===`*`?(this.allowAny=!0,[]):Bi(e,La).map(e=>e.matcher)),this.unbalancedBracketScopes=t.flatMap(e=>Bi(e,La).map(e=>e.matcher))}get matchesAlways(){return this.allowAny&&this.unbalancedBracketScopes.length===0}get matchesNever(){return this.balancedBracketScopes.length===0&&!this.allowAny}match(e){for(let t of this.unbalancedBracketScopes)if(t(e))return!1;for(let t of this.balancedBracketScopes)if(t(e))return!0;return this.allowAny}},Wa=class{constructor(e,t,n,r){this.balancedBracketSelectors=r,this._emitBinaryTokens=e,this._tokenTypeOverrides=n,this._lineText=null,this._tokens=[],this._binaryTokens=[],this._lastTokenEndIndex=0}_emitBinaryTokens;_lineText;_tokens;_binaryTokens;_lastTokenEndIndex;_tokenTypeOverrides;produce(e,t){this.produceFromScopes(e.contentNameScopesList,t)}produceFromScopes(e,t){if(this._lastTokenEndIndex>=t)return;if(this._emitBinaryTokens){let n=e?.tokenAttributes??0,r=!1;if(this.balancedBracketSelectors?.matchesAlways&&(r=!0),this._tokenTypeOverrides.length>0||this.balancedBracketSelectors&&!this.balancedBracketSelectors.matchesAlways&&!this.balancedBracketSelectors.matchesNever){let t=e?.getScopeNames()??[];for(let e of this._tokenTypeOverrides)e.matcher(t)&&(n=Li.set(n,0,Ri(e.type),null,-1,0,0));this.balancedBracketSelectors&&(r=this.balancedBracketSelectors.match(t))}if(r&&(n=Li.set(n,0,8,r,-1,0,0)),this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-1]===n){this._lastTokenEndIndex=t;return}this._binaryTokens.push(this._lastTokenEndIndex),this._binaryTokens.push(n),this._lastTokenEndIndex=t;return}let n=e?.getScopeNames()??[];this._tokens.push({startIndex:this._lastTokenEndIndex,endIndex:t,scopes:n}),this._lastTokenEndIndex=t}getResult(e,t){return this._tokens.length>0&&this._tokens[this._tokens.length-1].startIndex===t-1&&this._tokens.pop(),this._tokens.length===0&&(this._lastTokenEndIndex=-1,this.produce(e,t),this._tokens[this._tokens.length-1].startIndex=0),this._tokens}getBinaryResult(e,t){this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-2]===t-1&&(this._binaryTokens.pop(),this._binaryTokens.pop()),this._binaryTokens.length===0&&(this._lastTokenEndIndex=-1,this.produce(e,t),this._binaryTokens[this._binaryTokens.length-2]=0);let n=new Uint32Array(this._binaryTokens.length);for(let e=0,t=this._binaryTokens.length;e<t;e++)n[e]=this._binaryTokens[e];return n}},Ga=class{constructor(e,t){this._onigLib=t,this._theme=e}_grammars=new Map;_rawGrammars=new Map;_injectionGrammars=new Map;_theme;dispose(){for(let e of this._grammars.values())e.dispose()}setTheme(e){this._theme=e}getColorMap(){return this._theme.getColorMap()}addGrammar(e,t){this._rawGrammars.set(e.scopeName,e),t&&this._injectionGrammars.set(e.scopeName,t)}lookup(e){return this._rawGrammars.get(e)}injections(e){return this._injectionGrammars.get(e)}getDefaults(){return this._theme.getDefaults()}themeMatch(e){return this._theme.match(e)}grammarForScopeName(e,t,n,r,i){if(!this._grammars.has(e)){let a=this._rawGrammars.get(e);if(!a)return null;this._grammars.set(e,Fa(e,a,t,n,r,i,this,this._onigLib))}return this._grammars.get(e)}},Ka=class{_options;_syncRegistry;_ensureGrammarCache;constructor(e){this._options=e,this._syncRegistry=new Ga(Ti.createFromRawTheme(e.theme,e.colorMap),e.onigLib),this._ensureGrammarCache=new Map}dispose(){this._syncRegistry.dispose()}setTheme(e,t){this._syncRegistry.setTheme(Ti.createFromRawTheme(e,t))}getColorMap(){return this._syncRegistry.getColorMap()}loadGrammarWithEmbeddedLanguages(e,t,n){return this.loadGrammarWithConfiguration(e,t,{embeddedLanguages:n})}loadGrammarWithConfiguration(e,t,n){return this._loadGrammar(e,t,n.embeddedLanguages,n.tokenTypes,new Ua(n.balancedBracketSelectors||[],n.unbalancedBracketSelectors||[]))}loadGrammar(e){return this._loadGrammar(e,0,null,null,null)}_loadGrammar(e,t,n,r,i){let a=new qi(this._syncRegistry,e);for(;a.Q.length>0;)a.Q.map(e=>this._loadSingleGrammar(e.scopeName)),a.processQueue();return this._grammarForScopeName(e,t,n,r,i)}_loadSingleGrammar(e){this._ensureGrammarCache.has(e)||(this._doLoadSingleGrammar(e),this._ensureGrammarCache.set(e,!0))}_doLoadSingleGrammar(e){let t=this._options.loadGrammar(e);if(t){let n=typeof this._options.getInjections==`function`?this._options.getInjections(e):void 0;this._syncRegistry.addGrammar(t,n)}}addGrammar(e,t=[],n=0,r=null){return this._syncRegistry.addGrammar(e,t),this._grammarForScopeName(e.scopeName,n,r)}_grammarForScopeName(e,t=0,n=null,r=null,i=null){return this._syncRegistry.grammarForScopeName(e,t,n,r,i)}},qa=Ha.NULL;function Ja(e,t){let n=typeof e==`string`?{}:{...e.colorReplacements},r=typeof e==`string`?e:e.name;for(let[e,i]of Object.entries(t?.colorReplacements||{}))typeof i==`string`?n[e]=i:e===r&&Object.assign(n,i);return n}function Ya(e,t){return e&&(t?.[e?.toLowerCase()]||e)}function Xa(e){return Array.isArray(e)?e:[e]}async function Za(e){return Promise.resolve(typeof e==`function`?e():e).then(e=>e.default||e)}function Qa(e){return!e||[`plaintext`,`txt`,`text`,`plain`].includes(e)}function $a(e){return e===`ansi`||Qa(e)}function eo(e){return e===`none`}function to(e){return eo(e)}var no=/(\r?\n)/g;function ro(e,t=!1){if(e.length===0)return[[``,0]];let n=e.split(no),r=0,i=[];for(let e=0;e<n.length;e+=2){let a=t?n[e]+(n[e+1]||``):n[e];i.push([a,r]),r+=n[e].length,r+=n[e+1]?.length||0}return i}var io={light:`#333333`,dark:`#bbbbbb`},ao={light:`#fffffe`,dark:`#1e1e1e`},oo=`__shiki_resolved`;function so(e){if(e?.[oo])return e;let t={...e};t.tokenColors&&!t.settings&&(t.settings=t.tokenColors,delete t.tokenColors),t.type||=`dark`,t.colorReplacements={...t.colorReplacements},t.settings||=[];let{bg:n,fg:r}=t;if(!n||!r){let e=t.settings?t.settings.find(e=>!e.name&&!e.scope):void 0;e?.settings?.foreground&&(r=e.settings.foreground),e?.settings?.background&&(n=e.settings.background),!r&&t?.colors?.[`editor.foreground`]&&(r=t.colors[`editor.foreground`]),!n&&t?.colors?.[`editor.background`]&&(n=t.colors[`editor.background`]),r||=t.type===`light`?io.light:io.dark,n||=t.type===`light`?ao.light:ao.dark,t.fg=r,t.bg=n}t.settings[0]&&t.settings[0].settings&&!t.settings[0].scope||t.settings.unshift({settings:{foreground:t.fg,background:t.bg}});let i=0,a=new Map;function o(e){if(a.has(e))return a.get(e);i+=1;let n=`#${i.toString(16).padStart(8,`0`).toLowerCase()}`;return t.colorReplacements?.[`#${n}`]?o(e):(a.set(e,n),n)}t.settings=t.settings.map(e=>{let n=e.settings?.foreground&&!e.settings.foreground.startsWith(`#`),r=e.settings?.background&&!e.settings.background.startsWith(`#`);if(!n&&!r)return e;let i={...e,settings:{...e.settings}};if(n){let n=o(e.settings.foreground);t.colorReplacements[n]=e.settings.foreground,i.settings.foreground=n}if(r){let n=o(e.settings.background);t.colorReplacements[n]=e.settings.background,i.settings.background=n}return i});for(let e of Object.keys(t.colors||{}))if((e===`editor.foreground`||e===`editor.background`||e.startsWith(`terminal.ansi`))&&!t.colors[e]?.startsWith(`#`)){let n=o(t.colors[e]);t.colorReplacements[n]=t.colors[e],t.colors[e]=n}return Object.defineProperty(t,oo,{enumerable:!1,writable:!1,value:!0}),t}async function co(e){return[...new Set((await Promise.all(e.filter(e=>!$a(e)).map(async e=>await Za(e).then(e=>Array.isArray(e)?e:[e])))).flat())]}async function lo(e){return(await Promise.all(e.map(async e=>to(e)?null:so(await Za(e))))).filter(e=>!!e)}function uo(e,t){if(!t)return e;if(t[e]){let n=new Set([e]);for(;t[e];){if(e=t[e],n.has(e))throw new L(`Circular alias \`${[...n].join(` -> `)} -> ${e}\``);n.add(e)}}return e}var fo=class extends Ka{_resolver;_themes;_langs;_alias;_resolvedThemes=new Map;_resolvedGrammars=new Map;_langMap=new Map;_langGraph=new Map;_textmateThemeCache=new WeakMap;_loadedThemesCache=null;_loadedLanguagesCache=null;constructor(e,t,n,r={}){super(e),this._resolver=e,this._themes=t,this._langs=n,this._alias=r,this._themes.map(e=>this.loadTheme(e)),this.loadLanguages(this._langs)}getTheme(e){return typeof e==`string`?this._resolvedThemes.get(e):this.loadTheme(e)}loadTheme(e){let t=so(e);return t.name&&(this._resolvedThemes.set(t.name,t),this._loadedThemesCache=null),t}getLoadedThemes(){return this._loadedThemesCache||=[...this._resolvedThemes.keys()],this._loadedThemesCache}setTheme(e){let t=this._textmateThemeCache.get(e);t||(t=Ti.createFromRawTheme(e),this._textmateThemeCache.set(e,t)),this._syncRegistry.setTheme(t)}getGrammar(e){return e=uo(e,this._alias),this._resolvedGrammars.get(e)}loadLanguage(e){if(this.getGrammar(e.name))return;let t=new Set([...this._langMap.values()].filter(t=>t.embeddedLangsLazy?.includes(e.name)));this._resolver.addLanguage(e);let n={balancedBracketSelectors:e.balancedBracketSelectors||[`*`],unbalancedBracketSelectors:e.unbalancedBracketSelectors||[]};this._syncRegistry._rawGrammars.set(e.scopeName,e);let r=this.loadGrammarWithConfiguration(e.scopeName,1,n);if(r.name=e.name,this._resolvedGrammars.set(e.name,r),e.aliases&&e.aliases.forEach(t=>{this._alias[t]=e.name}),this._loadedLanguagesCache=null,t.size)for(let e of t)this._resolvedGrammars.delete(e.name),this._loadedLanguagesCache=null,this._syncRegistry?._injectionGrammars?.delete(e.scopeName),this._syncRegistry?._grammars?.delete(e.scopeName),this.loadLanguage(this._langMap.get(e.name))}dispose(){super.dispose(),this._resolvedThemes.clear(),this._resolvedGrammars.clear(),this._langMap.clear(),this._langGraph.clear(),this._loadedThemesCache=null}loadLanguages(e){for(let t of e)this.resolveEmbeddedLanguages(t);let t=[...this._langGraph.entries()],n=t.filter(([e,t])=>!t);if(n.length){let e=t.filter(([e,t])=>t?(t.embeddedLanguages||t.embeddedLangs)?.some(e=>n.map(([e])=>e).includes(e)):!1).filter(e=>!n.includes(e));throw new L(`Missing languages ${n.map(([e])=>`\`${e}\``).join(`, `)}, required by ${e.map(([e])=>`\`${e}\``).join(`, `)}`)}for(let[e,n]of t)this._resolver.addLanguage(n);for(let[e,n]of t)this.loadLanguage(n)}getLoadedLanguages(){return this._loadedLanguagesCache||=[...new Set([...this._resolvedGrammars.keys(),...Object.keys(this._alias)])],this._loadedLanguagesCache}resolveEmbeddedLanguages(e){this._langMap.set(e.name,e),this._langGraph.set(e.name,e);let t=e.embeddedLanguages??e.embeddedLangs;if(t)for(let e of t)this._langGraph.set(e,this._langMap.get(e))}},po=class{_langs=new Map;_scopeToLang=new Map;_injections=new Map;_onigLib;constructor(e,t){this._onigLib={createOnigScanner:t=>e.createScanner(t),createOnigString:t=>e.createString(t)},t.forEach(e=>this.addLanguage(e))}get onigLib(){return this._onigLib}getLangRegistration(e){return this._langs.get(e)}loadGrammar(e){return this._scopeToLang.get(e)}addLanguage(e){this._langs.set(e.name,e),e.aliases&&e.aliases.forEach(t=>{this._langs.set(t,e)}),this._scopeToLang.set(e.scopeName,e),e.injectTo&&e.injectTo.forEach(t=>{this._injections.get(t)||this._injections.set(t,[]),this._injections.get(t).push(e.scopeName)})}getInjections(e){let t=e.split(`.`),n=[];for(let e=1;e<=t.length;e++){let r=t.slice(0,e).join(`.`);n=[...n,...this._injections.get(r)||[]]}return n}},mo=0;function ho(e){mo+=1,e.warnings!==!1&&mo>=10&&mo%10==0&&console.warn(`[Shiki] ${mo} instances have been created. Shiki is supposed to be used as a singleton, consider refactoring your code to cache your highlighter instance; Or call \`highlighter.dispose()\` to release unused instances.`);let t=!1;if(!e.engine)throw new L("`engine` option is required for synchronous mode");let n=(e.langs||[]).flat(1),r=(e.themes||[]).flat(1).map(so),i=new fo(new po(e.engine,n),r,n,e.langAlias),a;function o(t){return uo(t,e.langAlias)}function s(e){g();let t=i.getGrammar(typeof e==`string`?e:e.name);if(!t)throw new L(`Language \`${e}\` not found, you may need to load it first`);return t}function c(e){if(e===`none`)return{bg:``,fg:``,name:`none`,settings:[],type:`dark`};g();let t=i.getTheme(e);if(!t)throw new L(`Theme \`${e}\` not found, you may need to load it first`);return t}function l(e){g();let t=c(e);return a!==e&&(i.setTheme(t),a=e),{theme:t,colorMap:i.getColorMap()}}function u(){return g(),i.getLoadedThemes()}function d(){return g(),i.getLoadedLanguages()}function f(...e){g(),i.loadLanguages(e.flat(1))}async function p(...e){return f(await co(e))}function m(...e){g();for(let t of e.flat(1))i.loadTheme(t)}async function h(...e){return g(),m(await lo(e))}function g(){if(t)throw new L(`Shiki instance has been disposed`)}function _(){t||(t=!0,i.dispose(),--mo)}return{setTheme:l,getTheme:c,getLanguage:s,getLoadedThemes:u,getLoadedLanguages:d,resolveLangAlias:o,loadLanguage:p,loadLanguageSync:f,loadTheme:h,loadThemeSync:m,dispose:_,[Symbol.dispose]:_}}async function go(e){e.engine||console.warn("`engine` option is required. Use `createOnigurumaEngine` or `createJavaScriptRegexEngine` to create an engine.");let[t,n,r]=await Promise.all([lo(e.themes||[]),co(e.langs||[]),e.engine]);return ho({...e,themes:t,langs:n,engine:r})}var _o=new WeakMap;function vo(e,t){_o.set(e,t)}function yo(e){return _o.get(e)}var bo=class e{_stacks={};lang;get themes(){return Object.keys(this._stacks)}get theme(){return this.themes[0]}get _stack(){return this._stacks[this.theme]}static initial(t,n){return new e(Object.fromEntries(Xa(n).map(e=>[e,qa])),t)}constructor(...e){if(e.length===2){let[t,n]=e;this.lang=n,this._stacks=t}else{let[t,n,r]=e;this.lang=n,this._stacks={[r]:t}}}getInternalStack(e=this.theme){return this._stacks[e]}getScopes(e=this.theme){return xo(this._stacks[e])}toJSON(){return{lang:this.lang,theme:this.theme,themes:this.themes,scopes:this.getScopes()}}};function xo(e){let t=[],n=new Set;function r(e){if(n.has(e))return;n.add(e);let i=e?.nameScopesList?.scopeName;i&&t.push(i),e.parent&&r(e.parent)}return r(e),t}function So(e,t){if(!(e instanceof bo))throw new L(`Invalid grammar state`);return e.getInternalStack(t)}var Co=/,/,wo=/ /;function To(e,t,n={}){let{theme:r=e.getLoadedThemes()[0]}=n;if(Qa(e.resolveLangAlias(n.lang||`text`))||eo(r))return ro(t).map(e=>[{content:e[0],offset:e[1]}]);let{theme:i,colorMap:a}=e.setTheme(r),o=e.getLanguage(n.lang||`text`);if(n.grammarState){if(n.grammarState.lang!==o.name)throw new L(`Grammar state language "${n.grammarState.lang}" does not match highlight language "${o.name}"`);if(!n.grammarState.themes.includes(i.name))throw new L(`Grammar state themes "${n.grammarState.themes}" do not contain highlight theme "${i.name}"`)}return Do(t,o,i,a,n)}function Eo(...e){if(e.length===2)return yo(e[1]);let[t,n,r={}]=e,{lang:i=`text`,theme:a=t.getLoadedThemes()[0]}=r;if(Qa(i)||eo(a))throw new L(`Plain language does not have grammar state`);if(i===`ansi`)throw new L(`ANSI language does not have grammar state`);let{theme:o,colorMap:s}=t.setTheme(a),c=t.getLanguage(i);return new bo(Oo(n,c,o,s,r).stateStack,c.name,o.name)}function Do(e,t,n,r,i){let a=Oo(e,t,n,r,i),o=new bo(a.stateStack,t.name,n.name);return vo(a.tokens,o),a.tokens}function Oo(e,t,n,r,i){let a=Ja(n,i),{tokenizeMaxLineLength:o=0,tokenizeTimeLimit:s=500}=i,c=ro(e),l=i.grammarState?So(i.grammarState,n.name)??qa:i.grammarContextCode==null?qa:Oo(i.grammarContextCode,t,n,r,{...i,grammarState:void 0,grammarContextCode:void 0}).stateStack,u=[],d=[];for(let e=0,f=c.length;e<f;e++){let[f,p]=c[e];if(f===``){u=[],d.push([]);continue}if(o>0&&f.length>=o){u=[],d.push([{content:f,offset:p,color:``,fontStyle:0}]);continue}let m,h,g;i.includeExplanation&&(m=t.tokenizeLine(f,l,s),h=m.tokens,g=0);let _=t.tokenizeLine2(f,l,s),v=_.tokens.length/2;for(let e=0;e<v;e++){let t=_.tokens[2*e],o=e+1<v?_.tokens[2*e+2]:f.length;if(t===o)continue;let s=_.tokens[2*e+1],c=Ya(r[Li.getForeground(s)],a),l=Li.getFontStyle(s),d={content:f.substring(t,o),offset:p+t,color:c,fontStyle:l};if(i.includeExplanation){let e=[];if(i.includeExplanation!==`scopeName`)for(let t of n.settings){let n;switch(typeof t.scope){case`string`:n=t.scope.split(Co).map(e=>e.trim());break;case`object`:n=t.scope;break;default:continue}e.push({settings:t,selectors:n.map(e=>e.split(wo))})}d.explanation=[];let r=0;for(;t+r<o;){let t=h[g],n=f.substring(t.startIndex,t.endIndex);r+=n.length,d.explanation.push({content:n,scopes:i.includeExplanation===`scopeName`?ko(t.scopes):Ao(e,t.scopes)}),g+=1}}u.push(d)}d.push(u),u=[],l=_.ruleStack}return{tokens:d,stateStack:l}}function ko(e){return e.map(e=>({scopeName:e}))}function Ao(e,t){let n=[];for(let r=0,i=t.length;r<i;r++){let i=t[r];n[r]={scopeName:i,themeMatches:No(e,i,t.slice(0,r))}}return n}function jo(e,t){return e===t||t.substring(0,e.length)===e&&t[e.length]===`.`}function Mo(e,t,n){if(!jo(e.at(-1),t))return!1;let r=e.length-2,i=n.length-1;for(;r>=0&&i>=0;)jo(e[r],n[i])&&--r,--i;return r===-1}function No(e,t,n){let r=[];for(let{selectors:i,settings:a}of e)for(let e of i)if(Mo(e,t,n)){r.push(a);break}return r}function Po(e,t,n,r=To){let i=Object.entries(n.themes).filter(e=>e[1]).map(e=>({color:e[0],theme:e[1]})),a=i.map(i=>{let a=r(e,t,{...n,theme:i.theme});return{tokens:a,state:yo(a),theme:typeof i.theme==`string`?i.theme:i.theme.name}}),o=Fo(...a.map(e=>e.tokens)),s=o[0].map((e,t)=>e.map((e,r)=>{let a={content:e.content,variants:{},offset:e.offset};return`includeExplanation`in n&&n.includeExplanation&&(a.explanation=e.explanation),o.forEach((e,n)=>{let{content:o,explanation:s,offset:c,...l}=e[t][r];a.variants[i[n].color]=l}),a})),c=a[0].state?new bo(Object.fromEntries(a.map(e=>[e.theme,e.state?.getInternalStack(e.theme)])),a[0].state.lang):void 0;return c&&vo(s,c),s}function Fo(...e){let t=e.map(()=>[]),n=e.length;for(let r=0;r<e[0].length;r++){let i=e.map(e=>e[r]),a=t.map(()=>[]);t.forEach((e,t)=>e.push(a[t]));let o=i.map(()=>0),s=i.map(e=>e[0]);for(;s.every(e=>e);){let e=Math.min(...s.map(e=>e.content.length));for(let t=0;t<n;t++){let n=s[t];n.content.length===e?(a[t].push(n),o[t]+=1,s[t]=i[t][o[t]]):(a[t].push({...n,content:n.content.slice(0,e)}),s[t]={...n,content:n.content.slice(e),offset:n.offset+e})}}}return t}var Io=/["&'<>`]/g,Lo=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,Ro=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,zo=/[|\\{}()[\]^$+*?.]/g,Bo=new WeakMap;function Vo(e,t){if(e=e.replace(t.subset?Ho(t.subset):Io,r),t.subset||t.escapeOnly)return e;return e.replace(Lo,n).replace(Ro,r);function n(e,n,r){return t.format((e.charCodeAt(0)-55296)*1024+e.charCodeAt(1)-56320+65536,r.charCodeAt(n+2),t)}function r(e,n,r){return t.format(e.charCodeAt(0),r.charCodeAt(n+1),t)}}function Ho(e){let t=Bo.get(e);return t||(t=Uo(e),Bo.set(e,t)),t}function Uo(e){let t=[],n=-1;for(;++n<e.length;)t.push(e[n].replace(zo,`\\$&`));return RegExp(`(?:`+t.join(`|`)+`)`,`g`)}var Wo=/[\dA-Fa-f]/;function Go(e,t,n){let r=`&#x`+e.toString(16).toUpperCase();return n&&t&&!Wo.test(String.fromCharCode(t))?r:r+`;`}var Ko=/\d/;function qo(e,t,n){let r=`&#`+String(e);return n&&t&&!Ko.test(String.fromCharCode(t))?r:r+`;`}var Jo=`AElig.AMP.Aacute.Acirc.Agrave.Aring.Atilde.Auml.COPY.Ccedil.ETH.Eacute.Ecirc.Egrave.Euml.GT.Iacute.Icirc.Igrave.Iuml.LT.Ntilde.Oacute.Ocirc.Ograve.Oslash.Otilde.Ouml.QUOT.REG.THORN.Uacute.Ucirc.Ugrave.Uuml.Yacute.aacute.acirc.acute.aelig.agrave.amp.aring.atilde.auml.brvbar.ccedil.cedil.cent.copy.curren.deg.divide.eacute.ecirc.egrave.eth.euml.frac12.frac14.frac34.gt.iacute.icirc.iexcl.igrave.iquest.iuml.laquo.lt.macr.micro.middot.nbsp.not.ntilde.oacute.ocirc.ograve.ordf.ordm.oslash.otilde.ouml.para.plusmn.pound.quot.raquo.reg.sect.shy.sup1.sup2.sup3.szlig.thorn.times.uacute.ucirc.ugrave.uml.uuml.yacute.yen.yuml`.split(`.`),Yo={nbsp:`\xA0`,iexcl:`¡`,cent:`¢`,pound:`£`,curren:`¤`,yen:`¥`,brvbar:`¦`,sect:`§`,uml:`¨`,copy:`©`,ordf:`ª`,laquo:`«`,not:`¬`,shy:``,reg:`®`,macr:`¯`,deg:`°`,plusmn:`±`,sup2:`²`,sup3:`³`,acute:`´`,micro:`µ`,para:`¶`,middot:`·`,cedil:`¸`,sup1:`¹`,ordm:`º`,raquo:`»`,frac14:`¼`,frac12:`½`,frac34:`¾`,iquest:`¿`,Agrave:`À`,Aacute:`Á`,Acirc:`Â`,Atilde:`Ã`,Auml:`Ä`,Aring:`Å`,AElig:`Æ`,Ccedil:`Ç`,Egrave:`È`,Eacute:`É`,Ecirc:`Ê`,Euml:`Ë`,Igrave:`Ì`,Iacute:`Í`,Icirc:`Î`,Iuml:`Ï`,ETH:`Ð`,Ntilde:`Ñ`,Ograve:`Ò`,Oacute:`Ó`,Ocirc:`Ô`,Otilde:`Õ`,Ouml:`Ö`,times:`×`,Oslash:`Ø`,Ugrave:`Ù`,Uacute:`Ú`,Ucirc:`Û`,Uuml:`Ü`,Yacute:`Ý`,THORN:`Þ`,szlig:`ß`,agrave:`à`,aacute:`á`,acirc:`â`,atilde:`ã`,auml:`ä`,aring:`å`,aelig:`æ`,ccedil:`ç`,egrave:`è`,eacute:`é`,ecirc:`ê`,euml:`ë`,igrave:`ì`,iacute:`í`,icirc:`î`,iuml:`ï`,eth:`ð`,ntilde:`ñ`,ograve:`ò`,oacute:`ó`,ocirc:`ô`,otilde:`õ`,ouml:`ö`,divide:`÷`,oslash:`ø`,ugrave:`ù`,uacute:`ú`,ucirc:`û`,uuml:`ü`,yacute:`ý`,thorn:`þ`,yuml:`ÿ`,fnof:`ƒ`,Alpha:`Α`,Beta:`Β`,Gamma:`Γ`,Delta:`Δ`,Epsilon:`Ε`,Zeta:`Ζ`,Eta:`Η`,Theta:`Θ`,Iota:`Ι`,Kappa:`Κ`,Lambda:`Λ`,Mu:`Μ`,Nu:`Ν`,Xi:`Ξ`,Omicron:`Ο`,Pi:`Π`,Rho:`Ρ`,Sigma:`Σ`,Tau:`Τ`,Upsilon:`Υ`,Phi:`Φ`,Chi:`Χ`,Psi:`Ψ`,Omega:`Ω`,alpha:`α`,beta:`β`,gamma:`γ`,delta:`δ`,epsilon:`ε`,zeta:`ζ`,eta:`η`,theta:`θ`,iota:`ι`,kappa:`κ`,lambda:`λ`,mu:`μ`,nu:`ν`,xi:`ξ`,omicron:`ο`,pi:`π`,rho:`ρ`,sigmaf:`ς`,sigma:`σ`,tau:`τ`,upsilon:`υ`,phi:`φ`,chi:`χ`,psi:`ψ`,omega:`ω`,thetasym:`ϑ`,upsih:`ϒ`,piv:`ϖ`,bull:`•`,hellip:`…`,prime:`′`,Prime:`″`,oline:`‾`,frasl:`⁄`,weierp:`℘`,image:`ℑ`,real:`ℜ`,trade:`™`,alefsym:`ℵ`,larr:`←`,uarr:`↑`,rarr:`→`,darr:`↓`,harr:`↔`,crarr:`↵`,lArr:`⇐`,uArr:`⇑`,rArr:`⇒`,dArr:`⇓`,hArr:`⇔`,forall:`∀`,part:`∂`,exist:`∃`,empty:`∅`,nabla:`∇`,isin:`∈`,notin:`∉`,ni:`∋`,prod:`∏`,sum:`∑`,minus:`−`,lowast:`∗`,radic:`√`,prop:`∝`,infin:`∞`,ang:`∠`,and:`∧`,or:`∨`,cap:`∩`,cup:`∪`,int:`∫`,there4:`∴`,sim:`∼`,cong:`≅`,asymp:`≈`,ne:`≠`,equiv:`≡`,le:`≤`,ge:`≥`,sub:`⊂`,sup:`⊃`,nsub:`⊄`,sube:`⊆`,supe:`⊇`,oplus:`⊕`,otimes:`⊗`,perp:`⊥`,sdot:`⋅`,lceil:`⌈`,rceil:`⌉`,lfloor:`⌊`,rfloor:`⌋`,lang:`〈`,rang:`〉`,loz:`◊`,spades:`♠`,clubs:`♣`,hearts:`♥`,diams:`♦`,quot:`"`,amp:`&`,lt:`<`,gt:`>`,OElig:`Œ`,oelig:`œ`,Scaron:`Š`,scaron:`š`,Yuml:`Ÿ`,circ:`ˆ`,tilde:`˜`,ensp:` `,emsp:` `,thinsp:` `,zwnj:``,zwj:``,lrm:``,rlm:``,ndash:`–`,mdash:`—`,lsquo:`‘`,rsquo:`’`,sbquo:`‚`,ldquo:`“`,rdquo:`”`,bdquo:`„`,dagger:`†`,Dagger:`‡`,permil:`‰`,lsaquo:`‹`,rsaquo:`›`,euro:`€`},Xo=[`cent`,`copy`,`divide`,`gt`,`lt`,`not`,`para`,`times`],Zo={}.hasOwnProperty,Qo={},$o;for($o in Yo)Zo.call(Yo,$o)&&(Qo[Yo[$o]]=$o);var es=/[^\dA-Za-z]/;function ts(e,t,n,r){let i=String.fromCharCode(e);if(Zo.call(Qo,i)){let e=Qo[i],a=`&`+e;return n&&Jo.includes(e)&&!Xo.includes(e)&&(!r||t&&t!==61&&es.test(String.fromCharCode(t)))?a:a+`;`}return``}function ns(e,t,n){let r=Go(e,t,n.omitOptionalSemicolons),i;if((n.useNamedReferences||n.useShortestReferences)&&(i=ts(e,t,n.omitOptionalSemicolons,n.attribute)),(n.useShortestReferences||!i)&&n.useShortestReferences){let i=qo(e,t,n.omitOptionalSemicolons);i.length<r.length&&(r=i)}return i&&(!n.useShortestReferences||i.length<r.length)?i:r}function rs(e,t){return Vo(e,Object.assign({format:ns},t))}var is=/^>|^->|<!--|-->|--!>|<!-$/g,as=[`>`],os=[`<`,`>`];function ss(e,t,n,r){return r.settings.bogusComments?`<?`+rs(e.value,Object.assign({},r.settings.characterReferences,{subset:as}))+`>`:`<!--`+e.value.replace(is,i)+`-->`;function i(e){return rs(e,Object.assign({},r.settings.characterReferences,{subset:os}))}}function cs(e,t,n,r){return`<!`+(r.settings.upperDoctype?`DOCTYPE`:`doctype`)+(r.settings.tightDoctype?``:` `)+`html>`}var z=ds(1),ls=ds(-1),us=[];function ds(e){return t;function t(t,n,r){let i=t?t.children:us,a=(n||0)+e,o=i[a];if(!r)for(;o&&qe(o);)a+=e,o=i[a];return o}}var fs={}.hasOwnProperty;function ps(e){return t;function t(t,n,r){return fs.call(e,t.tagName)&&e[t.tagName](t,n,r)}}var ms=ps({body:_s,caption:hs,colgroup:hs,dd:xs,dt:bs,head:hs,html:gs,li:ys,optgroup:Cs,option:ws,p:vs,rp:Ss,rt:Ss,tbody:Es,td:ks,tfoot:Ds,th:ks,thead:Ts,tr:Os});function hs(e,t,n){let r=z(n,t,!0);return!r||r.type!==`comment`&&!(r.type===`text`&&qe(r.value.charAt(0)))}function gs(e,t,n){let r=z(n,t);return!r||r.type!==`comment`}function _s(e,t,n){let r=z(n,t);return!r||r.type!==`comment`}function vs(e,t,n){let r=z(n,t);return r?r.type===`element`&&(r.tagName===`address`||r.tagName===`article`||r.tagName===`aside`||r.tagName===`blockquote`||r.tagName===`details`||r.tagName===`div`||r.tagName===`dl`||r.tagName===`fieldset`||r.tagName===`figcaption`||r.tagName===`figure`||r.tagName===`footer`||r.tagName===`form`||r.tagName===`h1`||r.tagName===`h2`||r.tagName===`h3`||r.tagName===`h4`||r.tagName===`h5`||r.tagName===`h6`||r.tagName===`header`||r.tagName===`hgroup`||r.tagName===`hr`||r.tagName===`main`||r.tagName===`menu`||r.tagName===`nav`||r.tagName===`ol`||r.tagName===`p`||r.tagName===`pre`||r.tagName===`section`||r.tagName===`table`||r.tagName===`ul`):!n||!(n.type===`element`&&(n.tagName===`a`||n.tagName===`audio`||n.tagName===`del`||n.tagName===`ins`||n.tagName===`map`||n.tagName===`noscript`||n.tagName===`video`))}function ys(e,t,n){let r=z(n,t);return!r||r.type===`element`&&r.tagName===`li`}function bs(e,t,n){let r=z(n,t);return!!(r&&r.type===`element`&&(r.tagName===`dt`||r.tagName===`dd`))}function xs(e,t,n){let r=z(n,t);return!r||r.type===`element`&&(r.tagName===`dt`||r.tagName===`dd`)}function Ss(e,t,n){let r=z(n,t);return!r||r.type===`element`&&(r.tagName===`rp`||r.tagName===`rt`)}function Cs(e,t,n){let r=z(n,t);return!r||r.type===`element`&&r.tagName===`optgroup`}function ws(e,t,n){let r=z(n,t);return!r||r.type===`element`&&(r.tagName===`option`||r.tagName===`optgroup`)}function Ts(e,t,n){let r=z(n,t);return!!(r&&r.type===`element`&&(r.tagName===`tbody`||r.tagName===`tfoot`))}function Es(e,t,n){let r=z(n,t);return!r||r.type===`element`&&(r.tagName===`tbody`||r.tagName===`tfoot`)}function Ds(e,t,n){return!z(n,t)}function Os(e,t,n){let r=z(n,t);return!r||r.type===`element`&&r.tagName===`tr`}function ks(e,t,n){let r=z(n,t);return!r||r.type===`element`&&(r.tagName===`td`||r.tagName===`th`)}var As=ps({body:Ns,colgroup:Ps,head:Ms,html:js,tbody:Fs});function js(e){let t=z(e,-1);return!t||t.type!==`comment`}function Ms(e){let t=new Set;for(let n of e.children)if(n.type===`element`&&(n.tagName===`base`||n.tagName===`title`)){if(t.has(n.tagName))return!1;t.add(n.tagName)}let n=e.children[0];return!n||n.type===`element`}function Ns(e){let t=z(e,-1,!0);return!t||t.type!==`comment`&&!(t.type===`text`&&qe(t.value.charAt(0)))&&!(t.type===`element`&&(t.tagName===`meta`||t.tagName===`link`||t.tagName===`script`||t.tagName===`style`||t.tagName===`template`))}function Ps(e,t,n){let r=ls(n,t),i=z(e,-1,!0);return n&&r&&r.type===`element`&&r.tagName===`colgroup`&&ms(r,n.children.indexOf(r),n)?!1:!!(i&&i.type===`element`&&i.tagName===`col`)}function Fs(e,t,n){let r=ls(n,t),i=z(e,-1);return n&&r&&r.type===`element`&&(r.tagName===`thead`||r.tagName===`tbody`)&&ms(r,n.children.indexOf(r),n)?!1:!!(i&&i.type===`element`&&i.tagName===`tr`)}var Is={name:[[`
|
|
5
|
+
\f\r &/=>`.split(``),`
|
|
6
|
+
\f\r "&'/=>\``.split(``)],[`\0
|
|
7
|
+
\f\r "&'/<=>`.split(``),`\0
|
|
8
|
+
\f\r "&'/<=>\``.split(``)]],unquoted:[[`
|
|
9
|
+
\f\r &>`.split(``),`\0
|
|
10
|
+
\f\r "&'<=>\``.split(``)],[`\0
|
|
11
|
+
\f\r "&'<=>\``.split(``),`\0
|
|
12
|
+
\f\r "&'<=>\``.split(``)]],single:[[`&'`.split(``),`"&'\``.split(``)],[`\0&'`.split(``),`\0"&'\``.split(``)]],double:[[`"&`.split(``),`"&'\``.split(``)],[`\0"&`.split(``),`\0"&'\``.split(``)]]};function Ls(e,t,n,r){let i=r.schema,a=i.space===`svg`?!1:r.settings.omitOptionalTags,o=i.space===`svg`?r.settings.closeEmptyElements:r.settings.voids.includes(e.tagName.toLowerCase()),s=[],c;i.space===`html`&&e.tagName===`svg`&&(r.schema=Je);let l=Rs(r,e.properties),u=r.all(i.space===`html`&&e.tagName===`template`?e.content:e);return r.schema=i,u&&(o=!1),(l||!a||!As(e,t,n))&&(s.push(`<`,e.tagName,l?` `+l:``),o&&(i.space===`svg`||r.settings.closeSelfClosing)&&(c=l.charAt(l.length-1),(!r.settings.tightSelfClosing||c===`/`||c&&c!==`"`&&c!==`'`)&&s.push(` `),s.push(`/`)),s.push(`>`)),s.push(u),!o&&(!a||!ms(e,t,n))&&s.push(`</`+e.tagName+`>`),s.join(``)}function Rs(e,t){let n=[],r=-1,i;if(t){for(i in t)if(t[i]!==null&&t[i]!==void 0){let r=zs(e,i,t[i]);r&&n.push(r)}}for(;++r<n.length;){let t=e.settings.tightAttributes?n[r].charAt(n[r].length-1):void 0;r!==n.length-1&&t!==`"`&&t!==`'`&&(n[r]+=` `)}return n.join(``)}function zs(e,t,n){let r=Ke(e.schema,t),i=e.settings.allowParseErrors&&e.schema.space===`html`?0:1,a=+!e.settings.allowDangerousCharacters,o=e.quote,s;if(r.overloadedBoolean&&(n===r.attribute||n===``)?n=!0:(r.boolean||r.overloadedBoolean)&&(typeof n!=`string`||n===r.attribute||n===``)&&(n=!!n),n==null||n===!1||typeof n==`number`&&Number.isNaN(n))return``;let c=rs(r.attribute,Object.assign({},e.settings.characterReferences,{subset:Is.name[i][a]}));return n===!0||(n=Array.isArray(n)?(r.commaSeparated?Ve:Ze)(n,{padLeft:!e.settings.tightCommaSeparatedLists}):String(n),e.settings.collapseEmptyAttributes&&!n)?c:(e.settings.preferUnquoted&&(s=rs(n,Object.assign({},e.settings.characterReferences,{attribute:!0,subset:Is.unquoted[i][a]}))),s!==n&&(e.settings.quoteSmart&&Xe(n,o)>Xe(n,e.alternative)&&(o=e.alternative),s=o+rs(n,Object.assign({},e.settings.characterReferences,{subset:(o===`'`?Is.single:Is.double)[i][a],attribute:!0}))+o),c+(s&&`=`+s))}var Bs=[`<`,`&`];function Vs(e,t,n,r){return n&&n.type===`element`&&(n.tagName===`script`||n.tagName===`style`)?e.value:rs(e.value,Object.assign({},r.settings.characterReferences,{subset:Bs}))}function Hs(e,t,n,r){return r.settings.allowDangerousHtml?e.value:Vs(e,t,n,r)}function Us(e,t,n,r){return r.all(e)}var Ws=Ge(`type`,{invalid:Gs,unknown:Ks,handlers:{comment:ss,doctype:cs,element:Ls,raw:Hs,root:Us,text:Vs}});function Gs(e){throw Error("Expected node, not `"+e+"`")}function Ks(e){throw Error("Cannot compile unknown node `"+e.type+"`")}var qs={},Js={},Ys=[];function Xs(e,t){let n=t||qs,r=n.quote||`"`,i=r===`"`?`'`:`"`;if(r!==`"`&&r!==`'`)throw Error("Invalid quote `"+r+"`, expected `'` or `\"`");return{one:Zs,all:Qs,settings:{omitOptionalTags:n.omitOptionalTags||!1,allowParseErrors:n.allowParseErrors||!1,allowDangerousCharacters:n.allowDangerousCharacters||!1,quoteSmart:n.quoteSmart||!1,preferUnquoted:n.preferUnquoted||!1,tightAttributes:n.tightAttributes||!1,upperDoctype:n.upperDoctype||!1,tightDoctype:n.tightDoctype||!1,bogusComments:n.bogusComments||!1,tightCommaSeparatedLists:n.tightCommaSeparatedLists||!1,tightSelfClosing:n.tightSelfClosing||!1,collapseEmptyAttributes:n.collapseEmptyAttributes||!1,allowDangerousHtml:n.allowDangerousHtml||!1,voids:n.voids||Be,characterReferences:n.characterReferences||Js,closeSelfClosing:n.closeSelfClosing||!1,closeEmptyElements:n.closeEmptyElements||!1},schema:n.space===`svg`?Je:He,quote:r,alternative:i}.one(Array.isArray(e)?{type:`root`,children:e}:e,void 0,void 0)}function Zs(e,t,n){return Ws(e,t,n,this)}function Qs(e){let t=[],n=e&&e.children||Ys,r=-1;for(;++r<n.length;)t[r]=this.one(n[r],r,e);return t.join(``)}var $s=/\s+/g;function ec(e,t){if(!t)return e;e.properties||={},e.properties.class||=[],typeof e.properties.class==`string`&&(e.properties.class=e.properties.class.split($s)),Array.isArray(e.properties.class)||(e.properties.class=[]);let n=Array.isArray(t)?t:t.split($s);for(let t of n)t&&!e.properties.class.includes(t)&&e.properties.class.push(t);return e}function tc(e){let t=ro(e,!0).map(([e])=>e);function n(n){if(n===e.length)return{line:t.length-1,character:t.at(-1).length};let r=n,i=0;for(let e of t){if(r<e.length)break;r-=e.length,i++}return{line:i,character:r}}function r(e,n){let r=0;for(let n=0;n<e;n++)r+=t[n].length;return r+=n,r}return{lines:t,indexToPos:n,posToIndex:r}}var nc=[`color`,`background-color`];function rc(e,t){let n=0,r=[];for(let i of t)i>n&&r.push({...e,content:e.content.slice(n,i),offset:e.offset+n}),n=i;return n<e.content.length&&r.push({...e,content:e.content.slice(n),offset:e.offset+n}),r}function ic(e,t){let n=[...t instanceof Set?t:new Set(t)].sort((e,t)=>e-t);return n.length?e.map(e=>e.flatMap(e=>{let t=n.filter(t=>e.offset<t&&t<e.offset+e.content.length).map(t=>t-e.offset).sort((e,t)=>e-t);return t.length?rc(e,t):e})):e}function ac(e,t,n,r,i=`css-vars`){let a={content:e.content,explanation:e.explanation,offset:e.offset},o=t.map(t=>oc(e.variants[t])),s=new Set(o.flatMap(e=>Object.keys(e))),c={},l=(e,r)=>{let i=r===`color`?``:r===`background-color`?`-bg`:`-${r}`;return n+t[e]+(r===`color`?``:i)};return o.forEach((e,n)=>{for(let a of s){let s=e[a]||`inherit`;if(n===0&&r&&nc.includes(a))if(r===`light-dark()`&&o.length>1){let e=t.findIndex(e=>e===`light`),r=t.findIndex(e=>e===`dark`);if(e===-1||r===-1)throw new L('When using `defaultColor: "light-dark()"`, you must provide both `light` and `dark` themes');c[a]=`light-dark(${o[e][a]||`inherit`}, ${o[r][a]||`inherit`})`,i===`css-vars`&&(c[l(n,a)]=s)}else c[a]=s;else i===`css-vars`&&(c[l(n,a)]=s)}}),a.htmlStyle=c,a}function oc(e){let t={};if(e.color&&(t.color=e.color),e.bgColor&&(t[`background-color`]=e.bgColor),e.fontStyle){e.fontStyle&R.Italic&&(t[`font-style`]=`italic`),e.fontStyle&R.Bold&&(t[`font-weight`]=`bold`);let n=[];e.fontStyle&R.Underline&&n.push(`underline`),e.fontStyle&R.Strikethrough&&n.push(`line-through`),n.length&&(t[`text-decoration`]=n.join(` `))}return t}function sc(e){return typeof e==`string`?e:Object.entries(e).map(([e,t])=>`${e}:${t}`).join(`;`)}function cc(){let e=new WeakMap;function t(t){if(!e.has(t.meta)){let n=tc(t.source);function r(e){if(typeof e==`number`){if(e<0||e>t.source.length)throw new L(`Invalid decoration offset: ${e}. Code length: ${t.source.length}`);return{...n.indexToPos(e),offset:e}}else{let t=n.lines[e.line];if(t===void 0)throw new L(`Invalid decoration position ${JSON.stringify(e)}. Lines length: ${n.lines.length}`);let r=e.character;if(r<0&&(r=t.length+r),r<0||r>t.length)throw new L(`Invalid decoration position ${JSON.stringify(e)}. Line ${e.line} length: ${t.length}`);return{...e,character:r,offset:n.posToIndex(e.line,r)}}}let i=(t.options.decorations||[]).map(e=>({...e,start:r(e.start),end:r(e.end)}));lc(i),e.set(t.meta,{decorations:i,converter:n,source:t.source})}return e.get(t.meta)}return{name:`shiki:decorations`,tokens(e){if(this.options.decorations?.length)return ic(e,t(this).decorations.flatMap(e=>[e.start.offset,e.end.offset]))},code(e){if(!this.options.decorations?.length)return;let n=t(this),r=[...e.children].filter(e=>e.type===`element`&&e.tagName===`span`);if(r.length!==n.converter.lines.length)throw new L(`Number of lines in code element (${r.length}) does not match the number of lines in the source (${n.converter.lines.length}). Failed to apply decorations.`);function i(e,t,n,i){let a=r[e],s=``,c=-1,l=-1;if(t===0&&(c=0),n===0&&(l=0),n===1/0&&(l=a.children.length),c===-1||l===-1)for(let e=0;e<a.children.length;e++)s+=uc(a.children[e]),c===-1&&s.length===t&&(c=e+1),l===-1&&s.length===n&&(l=e+1);if(c===-1)throw new L(`Failed to find start index for decoration ${JSON.stringify(i.start)}`);if(l===-1)throw new L(`Failed to find end index for decoration ${JSON.stringify(i.end)}`);let u=a.children.slice(c,l);if(!i.alwaysWrap&&u.length===a.children.length)o(a,i,`line`);else if(!i.alwaysWrap&&u.length===1&&u[0].type===`element`)o(u[0],i,`token`);else{let e={type:`element`,tagName:`span`,properties:{},children:u};o(e,i,`wrapper`),a.children.splice(c,u.length,e)}}function a(e,t){r[e]=o(r[e],t,`line`)}function o(e,t,n){let r=t.properties||{},i=t.transform||(e=>e);return e.tagName=t.tagName||`span`,e.properties={...e.properties,...r,class:e.properties.class},t.properties?.class&&ec(e,t.properties.class),e=i(e,n)||e,e}let s=[],c=n.decorations.sort((e,t)=>t.start.offset-e.start.offset||e.end.offset-t.end.offset);for(let e of c){let{start:t,end:n}=e;if(t.line===n.line)i(t.line,t.character,n.character,e);else if(t.line<n.line){i(t.line,t.character,1/0,e);for(let r=t.line+1;r<n.line;r++)s.unshift(()=>a(r,e));i(n.line,0,n.character,e)}}s.forEach(e=>e())}}}function lc(e){for(let t=0;t<e.length;t++){let n=e[t];if(n.start.offset>n.end.offset)throw new L(`Invalid decoration range: ${JSON.stringify(n.start)} - ${JSON.stringify(n.end)}`);for(let r=t+1;r<e.length;r++){let t=e[r],i=n.start.offset<=t.start.offset&&t.start.offset<n.end.offset,a=n.start.offset<t.end.offset&&t.end.offset<=n.end.offset,o=t.start.offset<=n.start.offset&&n.start.offset<t.end.offset,s=t.start.offset<n.end.offset&&n.end.offset<=t.end.offset;if(i||a||o||s){if(i&&a||o&&s||o&&n.start.offset===n.end.offset||a&&t.start.offset===t.end.offset)continue;throw new L(`Decorations ${JSON.stringify(n.start)} and ${JSON.stringify(t.start)} intersect.`)}}}}function uc(e){return e.type===`text`?e.value:e.type===`element`?e.children.map(uc).join(``):``}var dc=[cc()];function fc(e){let t=pc(e.transformers||[]);return[...t.pre,...t.normal,...t.post,...dc]}function pc(e){let t=[],n=[],r=[];for(let i of e)switch(i.enforce){case`pre`:t.push(i);break;case`post`:n.push(i);break;default:r.push(i)}return{pre:t,post:n,normal:r}}var mc=[`black`,`red`,`green`,`yellow`,`blue`,`magenta`,`cyan`,`white`,`brightBlack`,`brightRed`,`brightGreen`,`brightYellow`,`brightBlue`,`brightMagenta`,`brightCyan`,`brightWhite`],hc={1:`bold`,2:`dim`,3:`italic`,4:`underline`,7:`reverse`,8:`hidden`,9:`strikethrough`};function gc(e,t){let n=e.indexOf(`\x1B`,t);if(n!==-1&&e[n+1]===`[`){let t=e.indexOf(`m`,n);if(t!==-1)return{sequence:e.substring(n+2,t).split(`;`),startPosition:n,position:t+1}}return{position:e.length}}function _c(e){let t=e.shift();if(t===`2`){let t=e.splice(0,3).map(e=>Number.parseInt(e));return t.length!==3||t.some(e=>Number.isNaN(e))?void 0:{type:`rgb`,rgb:t}}else if(t===`5`){let t=e.shift();if(t)return{type:`table`,index:Number(t)}}}function vc(e){let t=[];for(;e.length>0;){let n=e.shift();if(!n)continue;let r=Number.parseInt(n);if(!Number.isNaN(r))if(r===0)t.push({type:`resetAll`});else if(r<=9)hc[r]&&t.push({type:`setDecoration`,value:hc[r]});else if(r<=29){let e=hc[r-20];e&&(t.push({type:`resetDecoration`,value:e}),e===`dim`&&t.push({type:`resetDecoration`,value:`bold`}))}else if(r<=37)t.push({type:`setForegroundColor`,value:{type:`named`,name:mc[r-30]}});else if(r===38){let n=_c(e);n&&t.push({type:`setForegroundColor`,value:n})}else if(r===39)t.push({type:`resetForegroundColor`});else if(r<=47)t.push({type:`setBackgroundColor`,value:{type:`named`,name:mc[r-40]}});else if(r===48){let n=_c(e);n&&t.push({type:`setBackgroundColor`,value:n})}else r===49?t.push({type:`resetBackgroundColor`}):r===53?t.push({type:`setDecoration`,value:`overline`}):r===55?t.push({type:`resetDecoration`,value:`overline`}):r>=90&&r<=97?t.push({type:`setForegroundColor`,value:{type:`named`,name:mc[r-90+8]}}):r>=100&&r<=107&&t.push({type:`setBackgroundColor`,value:{type:`named`,name:mc[r-100+8]}})}return t}function yc(){let e=null,t=null,n=new Set;return{parse(r){let i=[],a=0;do{let o=gc(r,a),s=o.sequence?r.substring(a,o.startPosition):r.substring(a);if(s.length>0&&i.push({value:s,foreground:e,background:t,decorations:new Set(n)}),o.sequence){let r=vc(o.sequence);for(let i of r)i.type===`resetAll`?(e=null,t=null,n.clear()):i.type===`resetForegroundColor`?e=null:i.type===`resetBackgroundColor`?t=null:i.type===`resetDecoration`&&n.delete(i.value);for(let i of r)i.type===`setForegroundColor`?e=i.value:i.type===`setBackgroundColor`?t=i.value:i.type===`setDecoration`&&n.add(i.value)}a=o.position}while(a<r.length);return i}}}var bc={black:`#000000`,red:`#bb0000`,green:`#00bb00`,yellow:`#bbbb00`,blue:`#0000bb`,magenta:`#ff00ff`,cyan:`#00bbbb`,white:`#eeeeee`,brightBlack:`#555555`,brightRed:`#ff5555`,brightGreen:`#00ff00`,brightYellow:`#ffff55`,brightBlue:`#5555ff`,brightMagenta:`#ff55ff`,brightCyan:`#55ffff`,brightWhite:`#ffffff`};function xc(e=bc){function t(t){return e[t]}function n(e){return`#${e.map(e=>Math.max(0,Math.min(e,255)).toString(16).padStart(2,`0`)).join(``)}`}let r;function i(){if(r)return r;r=[];for(let e=0;e<mc.length;e++)r.push(t(mc[e]));let e=[0,95,135,175,215,255];for(let t=0;t<6;t++)for(let i=0;i<6;i++)for(let a=0;a<6;a++)r.push(n([e[t],e[i],e[a]]));let i=8;for(let e=0;e<24;e++,i+=10)r.push(n([i,i,i]));return r}function a(e){return i()[e]}function o(e){switch(e.type){case`named`:return t(e.name);case`rgb`:return n(e.rgb);case`table`:return a(e.index)}}return{value:o}}var Sc=/#([0-9a-f]{3,8})/i,Cc=/var\((--[\w-]+-ansi-[\w-]+)\)/,wc={black:`#000000`,red:`#cd3131`,green:`#0DBC79`,yellow:`#E5E510`,blue:`#2472C8`,magenta:`#BC3FBC`,cyan:`#11A8CD`,white:`#E5E5E5`,brightBlack:`#666666`,brightRed:`#F14C4C`,brightGreen:`#23D18B`,brightYellow:`#F5F543`,brightBlue:`#3B8EEA`,brightMagenta:`#D670D6`,brightCyan:`#29B8DB`,brightWhite:`#FFFFFF`};function Tc(e,t,n){let r=Ja(e,n),i=ro(t),a=xc(Object.fromEntries(mc.map(t=>{let n=`terminal.ansi${t[0].toUpperCase()}${t.substring(1)}`;return[t,e.colors?.[n]||wc[t]]}))),o=yc();return i.map(t=>o.parse(t[0]).map(n=>{let i,o;n.decorations.has(`reverse`)?(i=n.background?a.value(n.background):e.bg,o=n.foreground?a.value(n.foreground):e.fg):(i=n.foreground?a.value(n.foreground):e.fg,o=n.background?a.value(n.background):void 0),i=Ya(i,r),o=Ya(o,r),n.decorations.has(`dim`)&&(i=Ec(i));let s=R.None;return n.decorations.has(`bold`)&&(s|=R.Bold),n.decorations.has(`italic`)&&(s|=R.Italic),n.decorations.has(`underline`)&&(s|=R.Underline),n.decorations.has(`strikethrough`)&&(s|=R.Strikethrough),{content:n.value,offset:t[1],color:i,bgColor:o,fontStyle:s}}))}function Ec(e){let t=e.match(Sc);if(t){let e=t[1];if(e.length===8){let t=Math.round(Number.parseInt(e.slice(6,8),16)/2).toString(16).padStart(2,`0`);return`#${e.slice(0,6)}${t}`}else if(e.length===6)return`#${e}80`;else if(e.length===4){let t=e[0],n=e[1],r=e[2],i=e[3];return`#${t}${t}${n}${n}${r}${r}${Math.round(Number.parseInt(`${i}${i}`,16)/2).toString(16).padStart(2,`0`)}`}else if(e.length===3){let t=e[0],n=e[1],r=e[2];return`#${t}${t}${n}${n}${r}${r}80`}}let n=e.match(Cc);return n?`var(${n[1]}-dim)`:e}function Dc(e,t,n={}){let r=e.resolveLangAlias(n.lang||`text`),{theme:i=e.getLoadedThemes()[0]}=n;if(!Qa(r)&&!eo(i)&&r===`ansi`){let{theme:r}=e.setTheme(i);return Tc(r,t,n)}return To(e,t,n)}function Oc(e,t,n){let r,i,a,o,s,c;if(`themes`in n){let{defaultColor:l=`light`,cssVariablePrefix:u=`--shiki-`,colorsRendering:d=`css-vars`}=n,f=Object.entries(n.themes).filter(e=>e[1]).map(e=>({color:e[0],theme:e[1]})).sort((e,t)=>e.color===l?-1:+(t.color===l));if(f.length===0)throw new L("`themes` option must not be empty");let p=Po(e,t,n,Dc);if(c=yo(p),l&&l!==`light-dark()`&&!f.some(e=>e.color===l))throw new L(`\`themes\` option must contain the defaultColor key \`${l}\``);let m=f.map(t=>e.getTheme(t.theme)),h=f.map(e=>e.color);a=p.map(e=>e.map(e=>ac(e,h,u,l,d))),c&&vo(a,c);let g=f.map(e=>Ja(e.theme,n));i=kc(f,m,g,u,l,`fg`,d),r=kc(f,m,g,u,l,`bg`,d),o=`shiki-themes ${m.map(e=>e.name).join(` `)}`,s=l?void 0:[i,r].join(`;`)}else if(`theme`in n){let s=Ja(n.theme,n);a=Dc(e,t,n);let l=e.getTheme(n.theme);r=Ya(l.bg,s),i=Ya(l.fg,s),o=l.name,c=yo(a)}else throw new L("Invalid options, either `theme` or `themes` must be provided");return{tokens:a,fg:i,bg:r,themeName:o,rootStyle:s,grammarState:c}}function kc(e,t,n,r,i,a,o){return e.map((s,c)=>{let l=Ya(t[c][a],n[c])||`inherit`,u=`${r+s.color}${a===`bg`?`-bg`:``}:${l}`;if(c===0&&i){if(i===`light-dark()`&&e.length>1){let r=e.findIndex(e=>e.color===`light`),i=e.findIndex(e=>e.color===`dark`);if(r===-1||i===-1)throw new L('When using `defaultColor: "light-dark()"`, you must provide both `light` and `dark` themes');return`light-dark(${Ya(t[r][a],n[r])||`inherit`}, ${Ya(t[i][a],n[i])||`inherit`});${u}`}return l}return o===`css-vars`?u:null}).filter(e=>!!e).join(`;`)}var Ac=/^\s+$/,jc=/^(\s*)(.*?)(\s*)$/;function Mc(e,t,n,r={meta:{},options:n,codeToHast:(t,n)=>Mc(e,t,n),codeToTokens:(t,n)=>Oc(e,t,n)}){let i=t;for(let e of fc(n))i=e.preprocess?.call(r,i,n)||i;let{tokens:a,fg:o,bg:s,themeName:c,rootStyle:l,grammarState:u}=Oc(e,i,n),{mergeWhitespaces:d=!0,mergeSameStyleTokens:f=!1}=n;d===!0?a=Pc(a):d===`never`&&(a=Fc(a)),f&&(a=Ic(a));let p={...r,get source(){return i}};for(let e of fc(n))a=e.tokens?.call(p,a)||a;return Nc(a,{...n,fg:o,bg:s,themeName:c,rootStyle:n.rootStyle===!1?!1:n.rootStyle??l},p,u)}function Nc(e,t,n,r=yo(e)){let i=fc(t),a=[],o={type:`root`,children:[]},{structure:s=`classic`,tabindex:c=`0`}=t,l={class:`shiki ${t.themeName||``}`};t.rootStyle!==!1&&(t.rootStyle==null?l.style=`background-color:${t.bg};color:${t.fg}`:l.style=t.rootStyle),c!==!1&&c!=null&&(l.tabindex=c.toString());for(let[e,n]of Object.entries(t.meta||{}))e.startsWith(`_`)||(l[e]=n);let u={type:`element`,tagName:`pre`,properties:l,children:[],data:t.data},d={type:`element`,tagName:`code`,properties:{},children:a},f=[],p={...n,structure:s,addClassToHast:ec,get source(){return n.source},get tokens(){return e},get options(){return t},get root(){return o},get pre(){return u},get code(){return d},get lines(){return f}};if(e.forEach((e,t)=>{t&&(s===`inline`?o.children.push({type:`element`,tagName:`br`,properties:{},children:[]}):s===`classic`&&a.push({type:`text`,value:`
|
|
13
|
+
`}));let n={type:`element`,tagName:`span`,properties:{class:`line`},children:[]},r=0;for(let a of e){let e={type:`element`,tagName:`span`,properties:{...a.htmlAttrs},children:[{type:`text`,value:a.content}]},c=sc(a.htmlStyle||oc(a));c&&(e.properties.style=c);for(let o of i)e=o?.span?.call(p,e,t+1,r,n,a)||e;s===`inline`?o.children.push(e):s===`classic`&&n.children.push(e),r+=a.content.length}if(s===`classic`){for(let e of i)n=e?.line?.call(p,n,t+1)||n;f.push(n),a.push(n)}else s===`inline`&&f.push(n)}),s===`classic`){for(let e of i)d=e?.code?.call(p,d)||d;u.children.push(d);for(let e of i)u=e?.pre?.call(p,u)||u;o.children.push(u)}else if(s===`inline`){let e=[],t={type:`element`,tagName:`span`,properties:{class:`line`},children:[]};for(let n of o.children)n.type===`element`&&n.tagName===`br`?(e.push(t),t={type:`element`,tagName:`span`,properties:{class:`line`},children:[]}):(n.type===`element`||n.type===`text`)&&t.children.push(n);e.push(t);let n={type:`element`,tagName:`code`,properties:{},children:e};for(let e of i)n=e?.code?.call(p,n)||n;o.children=[];for(let e=0;e<n.children.length;e++){e>0&&o.children.push({type:`element`,tagName:`br`,properties:{},children:[]});let t=n.children[e];t.type===`element`&&o.children.push(...t.children)}}let m=o;for(let e of i)m=e?.root?.call(p,m)||m;return r&&vo(m,r),m}function Pc(e){return e.map(e=>{let t=[],n=``,r;return e.forEach((i,a)=>{let o=!(i.fontStyle&&(i.fontStyle&R.Underline||i.fontStyle&R.Strikethrough));o&&Ac.test(i.content)&&e[a+1]?(r===void 0&&(r=i.offset),n+=i.content):n?(o?t.push({...i,offset:r,content:n+i.content}):t.push({content:n,offset:r},i),r=void 0,n=``):t.push(i)}),t})}function Fc(e){return e.map(e=>e.flatMap(e=>{if(Ac.test(e.content))return e;let t=e.content.match(jc);if(!t)return e;let[,n,r,i]=t;if(!n&&!i)return e;let a=[{...e,offset:e.offset+n.length,content:r}];return n&&a.unshift({content:n,offset:e.offset}),i&&a.push({content:i,offset:e.offset+n.length+r.length}),a}))}function Ic(e){return e.map(e=>{let t=[];for(let n of e){if(t.length===0){t.push({...n});continue}let e=t.at(-1),r=sc(e.htmlStyle||oc(e)),i=sc(n.htmlStyle||oc(n)),a=e.fontStyle&&(e.fontStyle&R.Underline||e.fontStyle&R.Strikethrough),o=n.fontStyle&&(n.fontStyle&R.Underline||n.fontStyle&R.Strikethrough);!a&&!o&&r===i?e.content+=n.content:t.push({...n})}return t})}var Lc=Xs;function Rc(e,t,n){let r={meta:{},options:n,codeToHast:(t,n)=>Mc(e,t,n),codeToTokens:(t,n)=>Oc(e,t,n)},i=Lc(Mc(e,t,n,r));for(let e of fc(n))i=e.postprocess?.call(r,i,n)||i;return i}async function zc(e){let t=await go(e);return{getLastGrammarState:(...e)=>Eo(t,...e),codeToTokensBase:(e,n)=>Dc(t,e,n),codeToTokensWithThemes:(e,n)=>Po(t,e,n),codeToTokens:(e,n)=>Oc(t,e,n),codeToHast:(e,n)=>Mc(t,e,n),codeToHtml:(e,n)=>Rc(t,e,n),getBundledLanguages:()=>({}),getBundledThemes:()=>({}),...t,getInternalContext:()=>t}}var Bc=4294967295,Vc=class{patterns;options;regexps;constructor(e,t={}){this.patterns=e,this.options=t;let{forgiving:n=!1,cache:r,regexConstructor:i}=t;if(!i)throw Error("Option `regexConstructor` is not provided");this.regexps=e.map(e=>{if(typeof e!=`string`)return e;let t=r?.get(e);if(t){if(t instanceof RegExp)return t;if(n)return null;throw t}try{let t=i(e);return r?.set(e,t),t}catch(t){if(r?.set(e,t),n)return null;throw t}})}findNextMatchSync(e,t,n){let r=typeof e==`string`?e:e.content,i=[];function a(e,t,n=0){return{index:e,captureIndices:t.indices.map(e=>e==null?{start:Bc,end:Bc,length:0}:{start:e[0]+n,end:e[1]+n,length:e[1]-e[0]})}}for(let e=0;e<this.regexps.length;e++){let n=this.regexps[e];if(n)try{n.lastIndex=t;let o=n.exec(r);if(!o)continue;if(o.index===t)return a(e,o,0);i.push([e,o,0])}catch(e){if(this.options.forgiving)continue;throw e}}if(i.length){let e=Math.min(...i.map(e=>e[1].index));for(let[t,n,r]of i)if(n.index===e)return a(t,n,r)}return null}};function Hc(e){if([...e].length!==1)throw Error(`Expected "${e}" to be a single code point`);return e.codePointAt(0)}function Uc(e,t,n){return e.has(t)||e.set(t,n),e.get(t)}var Wc=new Set([`alnum`,`alpha`,`ascii`,`blank`,`cntrl`,`digit`,`graph`,`lower`,`print`,`punct`,`space`,`upper`,`word`,`xdigit`]),B=String.raw;function Gc(e,t){if(e==null)throw Error(t??`Value expected`);return e}var Kc=B`\[\^?`,qc=`c.? | C(?:-.?)?|${B`[pP]\{(?:\^?[-\x20_]*[A-Za-z][-\x20\w]*\})?`}|${B`x[89A-Fa-f]\p{AHex}(?:\\x[89A-Fa-f]\p{AHex})*`}|${B`u(?:\p{AHex}{4})? | x\{[^\}]*\}? | x\p{AHex}{0,2}`}|${B`o\{[^\}]*\}?`}|${B`\d{1,3}`}`,Jc=/[?*+][?+]?|\{(?:\d+(?:,\d*)?|,\d+)\}\??/,Yc=new RegExp(B`
|
|
14
|
+
\\ (?:
|
|
15
|
+
${qc}
|
|
16
|
+
| [gk]<[^>]*>?
|
|
17
|
+
| [gk]'[^']*'?
|
|
18
|
+
| .
|
|
19
|
+
)
|
|
20
|
+
| \( (?:
|
|
21
|
+
\? (?:
|
|
22
|
+
[:=!>({]
|
|
23
|
+
| <[=!]
|
|
24
|
+
| <[^>]*>
|
|
25
|
+
| '[^']*'
|
|
26
|
+
| ~\|?
|
|
27
|
+
| #(?:[^)\\]|\\.?)*
|
|
28
|
+
| [^:)]*[:)]
|
|
29
|
+
)?
|
|
30
|
+
| \*[^\)]*\)?
|
|
31
|
+
)?
|
|
32
|
+
| (?:${Jc.source})+
|
|
33
|
+
| ${Kc}
|
|
34
|
+
| .
|
|
35
|
+
`.replace(/\s+/g,``),`gsu`),Xc=new RegExp(B`
|
|
36
|
+
\\ (?:
|
|
37
|
+
${qc}
|
|
38
|
+
| .
|
|
39
|
+
)
|
|
40
|
+
| \[:(?:\^?\p{Alpha}+|\^):\]
|
|
41
|
+
| ${Kc}
|
|
42
|
+
| &&
|
|
43
|
+
| .
|
|
44
|
+
`.replace(/\s+/g,``),`gsu`);function Zc(e,t={}){let n={flags:``,...t,rules:{captureGroup:!1,singleline:!1,...t.rules}};if(typeof e!=`string`)throw Error(`String expected as pattern`);let r=Dl(n.flags),i=[r.extended],a={captureGroup:n.rules.captureGroup,getCurrentModX(){return i.at(-1)},numOpenGroups:0,popModX(){i.pop()},pushModX(e){i.push(e)},replaceCurrentModX(e){i[i.length-1]=e},singleline:n.rules.singleline},o=[],s;for(Yc.lastIndex=0;s=Yc.exec(e);){let t=Qc(a,e,s[0],Yc.lastIndex);t.tokens?o.push(...t.tokens):t.token&&o.push(t.token),t.lastIndex!==void 0&&(Yc.lastIndex=t.lastIndex)}let c=[],l=0;o.filter(e=>e.type===`GroupOpen`).forEach(e=>{e.kind===`capturing`?e.number=++l:e.raw===`(`&&c.push(e)}),l||c.forEach((e,t)=>{e.kind=`capturing`,e.number=t+1});let u=l||c.length;return{tokens:o.map(e=>e.type===`EscapedNumber`?kl(e,u):e).flat(),flags:r}}function Qc(e,t,n,r){let[i,a]=n;if(n===`[`||n===`[^`){let e=$c(t,n,r);return{tokens:e.tokens,lastIndex:e.lastIndex}}if(i===`\\`){if(`AbBGyYzZ`.includes(a))return{token:rl(n,n)};if(/^\\g[<']/.test(n)){if(!/^\\g(?:<[^>]+>|'[^']+')$/.test(n))throw Error(`Invalid group name "${n}"`);return{token:_l(n)}}if(/^\\k[<']/.test(n)){if(!/^\\k(?:<[^>]+>|'[^']+')$/.test(n))throw Error(`Invalid group name "${n}"`);return{token:il(n)}}if(a===`K`)return{token:dl(`keep`,n)};if(a===`N`||a===`R`)return{token:ul(`newline`,n,{negate:a===`N`})};if(a===`O`)return{token:ul(`any`,n)};if(a===`X`)return{token:ul(`text_segment`,n)};let e=tl(n,{inCharClass:!1});return Array.isArray(e)?{tokens:e}:{token:e}}if(i===`(`){if(a===`*`)return{token:Sl(n)};if(n===`(?{`)throw Error(`Unsupported callout "${n}"`);if(n.startsWith(`(?#`)){if(t[r]!==`)`)throw Error(`Unclosed comment group "(?#"`);return{lastIndex:r+1}}if(/^\(\?[-imx]+[:)]$/.test(n))return{token:xl(n,e)};if(e.pushModX(e.getCurrentModX()),e.numOpenGroups++,n===`(`&&!e.captureGroup||n===`(?:`)return{token:ml(`group`,n)};if(n===`(?>`)return{token:ml(`atomic`,n)};if(n===`(?=`||n===`(?!`||n===`(?<=`||n===`(?<!`)return{token:ml(n[2]===`<`?`lookbehind`:`lookahead`,n,{negate:n.endsWith(`!`)})};if(n===`(`&&e.captureGroup||n.startsWith(`(?<`)&&n.endsWith(`>`)||n.startsWith(`(?'`)&&n.endsWith(`'`))return{token:ml(`capturing`,n,{...n!==`(`&&{name:n.slice(3,-1)}})};if(n.startsWith(`(?~`)){if(n===`(?~|`)throw Error(`Unsupported absence function kind "${n}"`);return{token:ml(`absence_repeater`,n)}}throw Error(n===`(?(`?`Unsupported conditional "${n}"`:`Invalid or unsupported group option "${n}"`)}if(n===`)`){if(e.popModX(),e.numOpenGroups--,e.numOpenGroups<0)throw Error(`Unmatched ")"`);return{token:pl(n)}}if(e.getCurrentModX()){if(n===`#`){let e=t.indexOf(`
|
|
45
|
+
`,r);return{lastIndex:e===-1?t.length:e}}if(/^\s$/.test(n)){let e=/\s+/y;return e.lastIndex=r,{lastIndex:e.exec(t)?e.lastIndex:r}}}return n===`.`?{token:ul(`dot`,n)}:n===`^`||n===`$`?{token:rl(e.singleline?{"^":B`\A`,$:B`\Z`}[n]:n,n)}:n===`|`?{token:nl(n)}:Jc.test(n)?{tokens:Al(n)}:{token:al(Hc(n),n)}}function $c(e,t,n){let r=[ll(t[1]===`^`,t)],i=1,a;for(Xc.lastIndex=n;a=Xc.exec(e);){let e=a[0];if(e[0]===`[`&&e[1]!==`:`)i++,r.push(ll(e[1]===`^`,e));else if(e===`]`){if(r.at(-1).type===`CharacterClassOpen`)r.push(al(93,e));else if(i--,r.push(ol(e)),!i)break}else{let t=el(e);Array.isArray(t)?r.push(...t):r.push(t)}}return{tokens:r,lastIndex:Xc.lastIndex||e.length}}function el(e){if(e[0]===`\\`)return tl(e,{inCharClass:!0});if(e[0]===`[`){let t=/\[:(?<negate>\^?)(?<name>[a-z]+):\]/.exec(e);if(!t||!Wc.has(t.groups.name))throw Error(`Invalid POSIX class "${e}"`);return ul(`posix`,e,{value:t.groups.name,negate:!!t.groups.negate})}return e===`-`?sl(e):e===`&&`?cl(e):al(Hc(e),e)}function tl(e,{inCharClass:t}){let n=e[1];if(n===`c`||n===`C`)return bl(e);if(`dDhHsSwW`.includes(n))return wl(e);if(e.startsWith(B`\o{`))throw Error(`Incomplete, invalid, or unsupported octal code point "${e}"`);if(/^\\[pP]\{/.test(e)){if(e.length===3)throw Error(`Incomplete or invalid Unicode property "${e}"`);return Tl(e)}if(/^\\x[89A-Fa-f]\p{AHex}/u.test(e))try{let t=e.split(/\\x/).slice(1).map(e=>parseInt(e,16)),n=new TextDecoder(`utf-8`,{ignoreBOM:!0,fatal:!0}).decode(new Uint8Array(t)),r=new TextEncoder;return[...n].map(e=>{let t=[...r.encode(e)].map(e=>`\\x${e.toString(16)}`).join(``);return al(Hc(e),t)})}catch{throw Error(`Multibyte code "${e}" incomplete or invalid in Oniguruma`)}if(n===`u`||n===`x`)return al(Ol(e),e);if(yl.has(n))return al(yl.get(n),e);if(/\d/.test(n))return fl(t,e);if(e===`\\`)throw Error(B`Incomplete escape "\"`);if(n===`M`)throw Error(`Unsupported meta "${e}"`);if([...e].length===2)return al(e.codePointAt(1),e);throw Error(`Unexpected escape "${e}"`)}function nl(e){return{type:`Alternator`,raw:e}}function rl(e,t){return{type:`Assertion`,kind:e,raw:t}}function il(e){return{type:`Backreference`,raw:e}}function al(e,t){return{type:`Character`,value:e,raw:t}}function ol(e){return{type:`CharacterClassClose`,raw:e}}function sl(e){return{type:`CharacterClassHyphen`,raw:e}}function cl(e){return{type:`CharacterClassIntersector`,raw:e}}function ll(e,t){return{type:`CharacterClassOpen`,negate:e,raw:t}}function ul(e,t,n={}){return{type:`CharacterSet`,kind:e,...n,raw:t}}function dl(e,t,n={}){return e===`keep`?{type:`Directive`,kind:e,raw:t}:{type:`Directive`,kind:e,flags:Gc(n.flags),raw:t}}function fl(e,t){return{type:`EscapedNumber`,inCharClass:e,raw:t}}function pl(e){return{type:`GroupClose`,raw:e}}function ml(e,t,n={}){return{type:`GroupOpen`,kind:e,...n,raw:t}}function hl(e,t,n,r){return{type:`NamedCallout`,kind:e,tag:t,arguments:n,raw:r}}function gl(e,t,n,r){return{type:`Quantifier`,kind:e,min:t,max:n,raw:r}}function _l(e){return{type:`Subroutine`,raw:e}}var vl=new Set([`COUNT`,`CMP`,`ERROR`,`FAIL`,`MAX`,`MISMATCH`,`SKIP`,`TOTAL_COUNT`]),yl=new Map([[`a`,7],[`b`,8],[`e`,27],[`f`,12],[`n`,10],[`r`,13],[`t`,9],[`v`,11]]);function bl(e){let t=e[1]===`c`?e[2]:e[3];if(!t||!/[A-Za-z]/.test(t))throw Error(`Unsupported control character "${e}"`);return al(Hc(t.toUpperCase())-64,e)}function xl(e,t){let{on:n,off:r}=/^\(\?(?<on>[imx]*)(?:-(?<off>[-imx]*))?/.exec(e).groups;r??=``;let i=(t.getCurrentModX()||n.includes(`x`))&&!r.includes(`x`),a=El(n),o=El(r),s={};if(a&&(s.enable=a),o&&(s.disable=o),e.endsWith(`)`))return t.replaceCurrentModX(i),dl(`flags`,e,{flags:s});if(e.endsWith(`:`))return t.pushModX(i),t.numOpenGroups++,ml(`group`,e,{...(a||o)&&{flags:s}});throw Error(`Unexpected flag modifier "${e}"`)}function Sl(e){let t=/\(\*(?<name>[A-Za-z_]\w*)?(?:\[(?<tag>(?:[A-Za-z_]\w*)?)\])?(?:\{(?<args>[^}]*)\})?\)/.exec(e);if(!t)throw Error(`Incomplete or invalid named callout "${e}"`);let{name:n,tag:r,args:i}=t.groups;if(!n)throw Error(`Invalid named callout "${e}"`);if(r===``)throw Error(`Named callout tag with empty value not allowed "${e}"`);let a=i?i.split(`,`).filter(e=>e!==``).map(e=>/^[+-]?\d+$/.test(e)?+e:e):[],[o,s,c]=a,l=vl.has(n)?n.toLowerCase():`custom`;switch(l){case`fail`:case`mismatch`:case`skip`:if(a.length>0)throw Error(`Named callout arguments not allowed "${a}"`);break;case`error`:if(a.length>1)throw Error(`Named callout allows only one argument "${a}"`);if(typeof o==`string`)throw Error(`Named callout argument must be a number "${o}"`);break;case`max`:if(!a.length||a.length>2)throw Error(`Named callout must have one or two arguments "${a}"`);if(typeof o==`string`&&!/^[A-Za-z_]\w*$/.test(o))throw Error(`Named callout argument one must be a tag or number "${o}"`);if(a.length===2&&(typeof s==`number`||!/^[<>X]$/.test(s)))throw Error(`Named callout optional argument two must be '<', '>', or 'X' "${s}"`);break;case`count`:case`total_count`:if(a.length>1)throw Error(`Named callout allows only one argument "${a}"`);if(a.length===1&&(typeof o==`number`||!/^[<>X]$/.test(o)))throw Error(`Named callout optional argument must be '<', '>', or 'X' "${o}"`);break;case`cmp`:if(a.length!==3)throw Error(`Named callout must have three arguments "${a}"`);if(typeof o==`string`&&!/^[A-Za-z_]\w*$/.test(o))throw Error(`Named callout argument one must be a tag or number "${o}"`);if(typeof s==`number`||!/^(?:[<>!=]=|[<>])$/.test(s))throw Error(`Named callout argument two must be '==', '!=', '>', '<', '>=', or '<=' "${s}"`);if(typeof c==`string`&&!/^[A-Za-z_]\w*$/.test(c))throw Error(`Named callout argument three must be a tag or number "${c}"`);break;case`custom`:throw Error(`Undefined callout name "${n}"`);default:throw Error(`Unexpected named callout kind "${l}"`)}return hl(l,r??null,i?.split(`,`)??null,e)}function Cl(e){let t=null,n,r;if(e[0]===`{`){let{minStr:i,maxStr:a}=/^\{(?<minStr>\d*)(?:,(?<maxStr>\d*))?/.exec(e).groups,o=1e5;if(+i>o||a&&+a>o)throw Error(`Quantifier value unsupported in Oniguruma`);if(n=+i,r=a===void 0?+i:a===``?1/0:+a,n>r&&(t=`possessive`,[n,r]=[r,n]),e.endsWith(`?`)){if(t===`possessive`)throw Error(`Unsupported possessive interval quantifier chain with "?"`);t=`lazy`}else t||=`greedy`}else n=+(e[0]===`+`),r=e[0]===`?`?1:1/0,t=e[1]===`+`?`possessive`:e[1]===`?`?`lazy`:`greedy`;return gl(t,n,r,e)}function wl(e){let t=e[1].toLowerCase();return ul({d:`digit`,h:`hex`,s:`space`,w:`word`}[t],e,{negate:e[1]!==t})}function Tl(e){let{p:t,neg:n,value:r}=/^\\(?<p>[pP])\{(?<neg>\^?)(?<value>[^}]+)/.exec(e).groups;return ul(`property`,e,{value:r,negate:t===`P`&&!n||t===`p`&&!!n})}function El(e){let t={};return e.includes(`i`)&&(t.ignoreCase=!0),e.includes(`m`)&&(t.dotAll=!0),e.includes(`x`)&&(t.extended=!0),Object.keys(t).length?t:null}function Dl(e){let t={ignoreCase:!1,dotAll:!1,extended:!1,digitIsAscii:!1,posixIsAscii:!1,spaceIsAscii:!1,wordIsAscii:!1,textSegmentMode:null};for(let n=0;n<e.length;n++){let r=e[n];if(!`imxDPSWy`.includes(r))throw Error(`Invalid flag "${r}"`);if(r===`y`){if(!/^y{[gw]}/.test(e.slice(n)))throw Error(`Invalid or unspecified flag "y" mode`);t.textSegmentMode=e[n+2]===`g`?`grapheme`:`word`,n+=3;continue}t[{i:`ignoreCase`,m:`dotAll`,x:`extended`,D:`digitIsAscii`,P:`posixIsAscii`,S:`spaceIsAscii`,W:`wordIsAscii`}[r]]=!0}return t}function Ol(e){if(/^(?:\\u(?!\p{AHex}{4})|\\x(?!\p{AHex}{1,2}|\{\p{AHex}{1,8}\}))/u.test(e))throw Error(`Incomplete or invalid escape "${e}"`);let t=e[2]===`{`?/^\\x\{\s*(?<hex>\p{AHex}+)/u.exec(e).groups.hex:e.slice(2);return parseInt(t,16)}function kl(e,t){let{raw:n,inCharClass:r}=e,i=n.slice(1);if(!r&&(i!==`0`&&i.length===1||i[0]!==`0`&&+i<=t))return[il(n)];let a=[],o=i.match(/^[0-7]+|\d/g);for(let e=0;e<o.length;e++){let t=o[e],r;if(e===0&&t!==`8`&&t!==`9`){if(r=parseInt(t,8),r>127)throw Error(B`Octal encoded byte above 177 unsupported "${n}"`)}else r=Hc(t);a.push(al(r,(e===0?`\\`:``)+t))}return a}function Al(e){let t=[],n=new RegExp(Jc,`gy`),r;for(;r=n.exec(e);){let e=r[0];if(e[0]===`{`){let r=/^\{(?<min>\d+),(?<max>\d+)\}\??$/.exec(e);if(r){let{min:i,max:a}=r.groups;if(+i>+a&&e.endsWith(`?`)){n.lastIndex--,t.push(Cl(e.slice(0,-1)));continue}}}t.push(Cl(e))}return t}function jl(e,t){if(!Array.isArray(e.body))throw Error(`Expected node with body array`);if(e.body.length!==1)return!1;let n=e.body[0];return!t||Object.keys(t).every(e=>t[e]===n[e])}function Ml(e){return Nl.has(e.type)}var Nl=new Set([`AbsenceFunction`,`Backreference`,`CapturingGroup`,`Character`,`CharacterClass`,`CharacterSet`,`Group`,`Quantifier`,`Subroutine`]);function Pl(e,t={}){let n={flags:``,normalizeUnknownPropertyNames:!1,skipBackrefValidation:!1,skipLookbehindValidation:!1,skipPropertyNameValidation:!1,unicodePropertyMap:null,...t,rules:{captureGroup:!1,singleline:!1,...t.rules}},r=Zc(e,{flags:n.flags,rules:{captureGroup:n.rules.captureGroup,singleline:n.rules.singleline}}),i=(e,t)=>{let n=r.tokens[a.nextIndex];switch(a.parent=e,a.nextIndex++,n.type){case`Alternator`:return Wl();case`Assertion`:return Fl(n);case`Backreference`:return Il(n,a);case`Character`:return Jl(n.value,{useLastValid:!!t.isCheckingRangeEnd});case`CharacterClassHyphen`:return Ll(n,a,t);case`CharacterClassOpen`:return Rl(n,a,t);case`CharacterSet`:return zl(n,a);case`Directive`:return Ql(n.kind,{flags:n.flags});case`GroupOpen`:return Bl(n,a,t);case`NamedCallout`:return nu(n.kind,n.tag,n.arguments);case`Quantifier`:return Vl(n,a);case`Subroutine`:return Hl(n,a);default:throw Error(`Unexpected token type "${n.type}"`)}},a={capturingGroups:[],hasNumberedRef:!1,namedGroupsByName:new Map,nextIndex:0,normalizeUnknownPropertyNames:n.normalizeUnknownPropertyNames,parent:null,skipBackrefValidation:n.skipBackrefValidation,skipLookbehindValidation:n.skipLookbehindValidation,skipPropertyNameValidation:n.skipPropertyNameValidation,subroutines:[],tokens:r.tokens,unicodePropertyMap:n.unicodePropertyMap,walk:i},o=au($l(r.flags)),s=o.body[0];for(;a.nextIndex<r.tokens.length;){let e=i(s,{});e.type===`Alternative`?(o.body.push(e),s=e):s.body.push(e)}let{capturingGroups:c,hasNumberedRef:l,namedGroupsByName:u,subroutines:d}=a;if(l&&u.size&&!n.rules.captureGroup)throw Error(`Numbered backref/subroutine not allowed when using named capture`);for(let{ref:e}of d)if(typeof e==`number`){if(e>c.length)throw Error(`Subroutine uses a group number that's not defined`);e&&(c[e-1].isSubroutined=!0)}else if(u.has(e)){if(u.get(e).length>1)throw Error(B`Subroutine uses a duplicate group name "\g<${e}>"`);u.get(e)[0].isSubroutined=!0}else throw Error(B`Subroutine uses a group name that's not defined "\g<${e}>"`);return o}function Fl({kind:e}){return Gl(Gc({"^":`line_start`,$:`line_end`,"\\A":`string_start`,"\\b":`word_boundary`,"\\B":`word_boundary`,"\\G":`search_start`,"\\y":`text_segment_boundary`,"\\Y":`text_segment_boundary`,"\\z":`string_end`,"\\Z":`string_end_newline`}[e],`Unexpected assertion kind "${e}"`),{negate:e===B`\B`||e===B`\Y`})}function Il({raw:e},t){let n=/^\\k[<']/.test(e),r=n?e.slice(3,-1):e.slice(1),i=(n,r=!1)=>{let i=t.capturingGroups.length,a=!1;if(n>i)if(t.skipBackrefValidation)a=!0;else throw Error(`Not enough capturing groups defined to the left "${e}"`);return t.hasNumberedRef=!0,Kl(r?i+1-n:n,{orphan:a})};if(n){let n=/^(?<sign>-?)0*(?<num>[1-9]\d*)$/.exec(r);if(n)return i(+n.groups.num,!!n.groups.sign);if(/[-+]/.test(r))throw Error(`Invalid backref name "${e}"`);if(!t.namedGroupsByName.has(r))throw Error(`Group name not defined to the left "${e}"`);return Kl(r)}return i(+r)}function Ll(e,t,n){let{tokens:r,walk:i}=t,a=t.parent,o=a.body.at(-1),s=r[t.nextIndex];if(!n.isCheckingRangeEnd&&o&&o.type!==`CharacterClass`&&o.type!==`CharacterClassRange`&&s&&s.type!==`CharacterClassOpen`&&s.type!==`CharacterClassClose`&&s.type!==`CharacterClassIntersector`){let e=i(a,{...n,isCheckingRangeEnd:!0});if(o.type===`Character`&&e.type===`Character`)return a.body.pop(),Xl(o,e);throw Error(`Invalid character class range`)}return Jl(Hc(`-`))}function Rl({negate:e},t,n){let{tokens:r,walk:i}=t,a=[Yl()],o=r[t.nextIndex],s=gu(o);for(;s.type!==`CharacterClassClose`;){if(s.type===`CharacterClassIntersector`)a.push(Yl()),t.nextIndex++;else{let e=a.at(-1);e.body.push(i(e,n))}s=gu(r[t.nextIndex],o)}let c=Yl({negate:e});return a.length===1?c.body=a[0].body:(c.kind=`intersection`,c.body=a.map(e=>e.body.length===1?e.body[0]:e)),t.nextIndex++,c}function zl({kind:e,negate:t,value:n},r){let{normalizeUnknownPropertyNames:i,skipPropertyNameValidation:a,unicodePropertyMap:o}=r;if(e===`property`){let r=hu(n);if(Wc.has(r)&&!o?.has(r))e=`posix`,n=r;else return su(n,{negate:t,normalizeUnknownPropertyNames:i,skipPropertyNameValidation:a,unicodePropertyMap:o})}return e===`posix`?ru(n,{negate:t}):Zl(e,{negate:t})}function Bl(e,t,n){let{tokens:r,capturingGroups:i,namedGroupsByName:a,skipLookbehindValidation:o,walk:s}=t,c=cu(e),l=c.type===`AbsenceFunction`,u=fu(c),d=u&&c.negate;if(c.type===`CapturingGroup`&&(i.push(c),c.name&&Uc(a,c.name,[]).push(c)),l&&n.isInAbsenceFunction)throw Error(`Nested absence function not supported by Oniguruma`);let f=_u(r[t.nextIndex]);for(;f.type!==`GroupClose`;){if(f.type===`Alternator`)c.body.push(Wl()),t.nextIndex++;else{let e=c.body.at(-1),t=s(e,{...n,isInAbsenceFunction:n.isInAbsenceFunction||l,isInLookbehind:n.isInLookbehind||u,isInNegLookbehind:n.isInNegLookbehind||d});if(e.body.push(t),(u||n.isInLookbehind)&&!o){let e=`Lookbehind includes a pattern not allowed by Oniguruma`;if(d||n.isInNegLookbehind){if(du(t)||t.type===`CapturingGroup`)throw Error(e)}else if(du(t)||fu(t)&&t.negate)throw Error(e)}}f=_u(r[t.nextIndex])}return t.nextIndex++,c}function Vl({kind:e,min:t,max:n},r){let i=r.parent,a=i.body.at(-1);if(!a||!Ml(a))throw Error(`Quantifier requires a repeatable token`);let o=iu(e,t,n,a);return i.body.pop(),o}function Hl({raw:e},t){let{capturingGroups:n,subroutines:r}=t,i=e.slice(3,-1),a=/^(?<sign>[-+]?)0*(?<num>[1-9]\d*)$/.exec(i);if(a){let e=+a.groups.num,r=n.length;if(t.hasNumberedRef=!0,i={"":e,"+":r+e,"-":r+1-e}[a.groups.sign],i<1)throw Error(`Invalid subroutine number`)}else i===`0`&&(i=0);let o=ou(i);return r.push(o),o}function Ul(e,t){if(e!==`repeater`)throw Error(`Unexpected absence function kind "${e}"`);return{type:`AbsenceFunction`,kind:e,body:lu(t?.body)}}function Wl(e){return{type:`Alternative`,body:uu(e?.body)}}function Gl(e,t){let n={type:`Assertion`,kind:e};return(e===`word_boundary`||e===`text_segment_boundary`)&&(n.negate=!!t?.negate),n}function Kl(e,t){let n=!!t?.orphan;return{type:`Backreference`,ref:e,...n&&{orphan:n}}}function ql(e,t){let n={name:void 0,isSubroutined:!1,...t};if(n.name!==void 0&&!pu(n.name))throw Error(`Group name "${n.name}" invalid in Oniguruma`);return{type:`CapturingGroup`,number:e,...n.name&&{name:n.name},...n.isSubroutined&&{isSubroutined:n.isSubroutined},body:lu(t?.body)}}function Jl(e,t){let n={useLastValid:!1,...t};if(e>1114111){let t=e.toString(16);if(n.useLastValid)e=1114111;else throw Error(e>1310719?`Invalid code point out of range "\\x{${t}}"`:`Invalid code point out of range in JS "\\x{${t}}"`)}return{type:`Character`,value:e}}function Yl(e){let t={kind:`union`,negate:!1,...e};return{type:`CharacterClass`,kind:t.kind,negate:t.negate,body:uu(e?.body)}}function Xl(e,t){if(t.value<e.value)throw Error(`Character class range out of order`);return{type:`CharacterClassRange`,min:e,max:t}}function Zl(e,t){let n=!!t?.negate,r={type:`CharacterSet`,kind:e};return(e===`digit`||e===`hex`||e===`newline`||e===`space`||e===`word`)&&(r.negate=n),(e===`text_segment`||e===`newline`&&!n)&&(r.variableLength=!0),r}function Ql(e,t={}){if(e===`keep`)return{type:`Directive`,kind:e};if(e===`flags`)return{type:`Directive`,kind:e,flags:Gc(t.flags)};throw Error(`Unexpected directive kind "${e}"`)}function $l(e){return{type:`Flags`,...e}}function eu(e){let t=e?.atomic,n=e?.flags;if(t&&n)throw Error(`Atomic group cannot have flags`);return{type:`Group`,...t&&{atomic:t},...n&&{flags:n},body:lu(e?.body)}}function tu(e){let t={behind:!1,negate:!1,...e};return{type:`LookaroundAssertion`,kind:t.behind?`lookbehind`:`lookahead`,negate:t.negate,body:lu(e?.body)}}function nu(e,t,n){return{type:`NamedCallout`,kind:e,tag:t,arguments:n}}function ru(e,t){let n=!!t?.negate;if(!Wc.has(e))throw Error(`Invalid POSIX class "${e}"`);return{type:`CharacterSet`,kind:`posix`,value:e,negate:n}}function iu(e,t,n,r){if(t>n)throw Error(`Invalid reversed quantifier range`);return{type:`Quantifier`,kind:e,min:t,max:n,body:r}}function au(e,t){return{type:`Regex`,body:lu(t?.body),flags:e}}function ou(e){return{type:`Subroutine`,ref:e}}function su(e,t){let n={negate:!1,normalizeUnknownPropertyNames:!1,skipPropertyNameValidation:!1,unicodePropertyMap:null,...t},r=n.unicodePropertyMap?.get(hu(e));if(!r){if(n.normalizeUnknownPropertyNames)r=mu(e);else if(n.unicodePropertyMap&&!n.skipPropertyNameValidation)throw Error(B`Invalid Unicode property "\p{${e}}"`)}return{type:`CharacterSet`,kind:`property`,value:r??e,negate:n.negate}}function cu({flags:e,kind:t,name:n,negate:r,number:i}){switch(t){case`absence_repeater`:return Ul(`repeater`);case`atomic`:return eu({atomic:!0});case`capturing`:return ql(i,{name:n});case`group`:return eu({flags:e});case`lookahead`:case`lookbehind`:return tu({behind:t===`lookbehind`,negate:r});default:throw Error(`Unexpected group kind "${t}"`)}}function lu(e){if(e===void 0)e=[Wl()];else if(!Array.isArray(e)||!e.length||!e.every(e=>e.type===`Alternative`))throw Error(`Invalid body; expected array of one or more Alternative nodes`);return e}function uu(e){if(e===void 0)e=[];else if(!Array.isArray(e)||!e.every(e=>!!e.type))throw Error(`Invalid body; expected array of nodes`);return e}function du(e){return e.type===`LookaroundAssertion`&&e.kind===`lookahead`}function fu(e){return e.type===`LookaroundAssertion`&&e.kind===`lookbehind`}function pu(e){return/^[\p{Alpha}\p{Pc}][^)]*$/u.test(e)}function mu(e){return e.trim().replace(/[- _]+/g,`_`).replace(/[A-Z][a-z]+(?=[A-Z])/g,`$&_`).replace(/[A-Za-z]+/g,e=>e[0].toUpperCase()+e.slice(1).toLowerCase())}function hu(e){return e.replace(/[- _]+/g,``).toLowerCase()}function gu(e,t){let n=t;return Gc(e,`Unclosed character class${n?.type===`Character`&&n.value===93&&n.raw===`]`?` (started with "]")`:``}`)}function _u(e){return Gc(e,`Unclosed group`)}function vu(e,t,n=null){function r(e,t){for(let n=0;n<e.length;n++){let r=i(e[n],t,n,e);n=Math.max(-1,n+r)}}function i(a,o=null,s=null,c=null){let l=0,u=!1,d={node:a,parent:o,key:s,container:c,root:e,remove(){yu(c).splice(Math.max(0,bu(s)+l),1),l--,u=!0},removeAllNextSiblings(){return yu(c).splice(bu(s)+1)},removeAllPrevSiblings(){let e=bu(s)+l;return l-=e,yu(c).splice(0,Math.max(0,e))},replaceWith(e,t={}){let n=!!t.traverse;c?c[Math.max(0,bu(s)+l)]=e:Gc(o,`Can't replace root node`)[s]=e,n&&i(e,o,s,c),u=!0},replaceWithMultiple(e,t={}){let n=!!t.traverse;if(yu(c).splice(Math.max(0,bu(s)+l),1,...e),l+=e.length-1,n){let t=0;for(let n=0;n<e.length;n++)t+=i(e[n],o,bu(s)+n+t,c)}u=!0},skip(){u=!0}},{type:f}=a,p=t[`*`],m=t[f],h=typeof p==`function`?p:p?.enter,g=typeof m==`function`?m:m?.enter;if(h?.(d,n),g?.(d,n),!u)switch(f){case`AbsenceFunction`:case`Alternative`:case`CapturingGroup`:case`CharacterClass`:case`Group`:case`LookaroundAssertion`:r(a.body,a);break;case`Assertion`:case`Backreference`:case`Character`:case`CharacterSet`:case`Directive`:case`Flags`:case`NamedCallout`:case`Subroutine`:break;case`CharacterClassRange`:i(a.min,a,`min`),i(a.max,a,`max`);break;case`Quantifier`:i(a.body,a,`body`);break;case`Regex`:r(a.body,a),i(a.flags,a,`flags`);break;default:throw Error(`Unexpected node type "${f}"`)}return m?.exit?.(d,n),p?.exit?.(d,n),l}return i(e),e}function yu(e){if(!Array.isArray(e))throw Error(`Container expected`);return e}function bu(e){if(typeof e!=`number`)throw Error(`Numeric key expected`);return e}var xu=String.raw`\(\?(?:[:=!>A-Za-z\-]|<[=!]|\(DEFINE\))`;function Su(e,t){for(let n=0;n<e.length;n++)e[n]>=t&&e[n]++}function Cu(e,t,n,r){return e.slice(0,t)+r+e.slice(t+n.length)}var wu=Object.freeze({DEFAULT:`DEFAULT`,CHAR_CLASS:`CHAR_CLASS`});function Tu(e,t,n,r){let i=new RegExp(String.raw`${t}|(?<$skip>\[\^?|\\?.)`,`gsu`),a=[!1],o=0,s=``;for(let t of e.matchAll(i)){let{0:e,groups:{$skip:i}}=t;if(!i&&(!r||r===wu.DEFAULT==!o)){n instanceof Function?s+=n(t,{context:o?wu.CHAR_CLASS:wu.DEFAULT,negated:a[a.length-1]}):s+=n;continue}e[0]===`[`?(o++,a.push(e[1]===`^`)):e===`]`&&o&&(o--,a.pop()),s+=e}return s}function Eu(e,t,n,r){Tu(e,t,n,r)}function Du(e,t,n=0,r){if(!new RegExp(t,`su`).test(e))return null;let i=RegExp(`${t}|(?<$skip>\\\\?.)`,`gsu`);i.lastIndex=n;let a=0,o;for(;o=i.exec(e);){let{0:e,groups:{$skip:t}}=o;if(!t&&(!r||r===wu.DEFAULT==!a))return o;e===`[`?a++:e===`]`&&a&&a--,i.lastIndex==o.index&&i.lastIndex++}return null}function Ou(e,t,n){return!!Du(e,t,0,n)}function ku(e,t){let n=/\\?./gsu;n.lastIndex=t;let r=e.length,i=0,a=1,o;for(;o=n.exec(e);){let[e]=o;if(e===`[`)i++;else if(i)e===`]`&&i--;else if(e===`(`)a++;else if(e===`)`&&(a--,!a)){r=o.index;break}}return e.slice(t,r)}var Au=new RegExp(String.raw`(?<noncapturingStart>${xu})|(?<capturingStart>\((?:\?<[^>]+>)?)|\\?.`,`gsu`);function ju(e,t){let n=t?.hiddenCaptures??[],r=t?.captureTransfers??new Map;if(!/\(\?>/.test(e))return{pattern:e,captureTransfers:r,hiddenCaptures:n};let i=[0],a=[],o=0,s=0,c=NaN,l;do{l=!1;let t=0,u=0,d=!1,f;for(Au.lastIndex=Number.isNaN(c)?0:c+7;f=Au.exec(e);){let{0:p,index:m,groups:{capturingStart:h,noncapturingStart:g}}=f;if(p===`[`)t++;else if(t)p===`]`&&t--;else if(p===`(?>`&&!d)c=m,d=!0;else if(d&&g)u++;else if(h)d?u++:(o++,i.push(o+s));else if(p===`)`&&d){if(!u){s++;let t=o+s;if(e=`${e.slice(0,c)}(?:(?=(${e.slice(c+3,m)}))<$$${t}>)${e.slice(m+1)}`,l=!0,a.push(t),Su(n,t),r.size){let e=new Map;r.forEach((n,r)=>{e.set(r>=t?r+1:r,n.map(e=>e>=t?e+1:e))}),r=e}break}u--}}}while(l);return n.push(...a),e=Tu(e,String.raw`\\(?<backrefNum>[1-9]\d*)|<\$\$(?<wrappedBackrefNum>\d+)>`,({0:e,groups:{backrefNum:t,wrappedBackrefNum:n}})=>{if(t){let n=+t;if(n>i.length-1)throw Error(`Backref "${e}" greater than number of captures`);return`\\${i[n]}`}return`\\${n}`},wu.DEFAULT),{pattern:e,captureTransfers:r,hiddenCaptures:n}}var Mu=String.raw`(?:[?*+]|\{\d+(?:,\d*)?\})`,Nu=new RegExp(String.raw`
|
|
46
|
+
\\(?: \d+
|
|
47
|
+
| c[A-Za-z]
|
|
48
|
+
| [gk]<[^>]+>
|
|
49
|
+
| [pPu]\{[^\}]+\}
|
|
50
|
+
| u[A-Fa-f\d]{4}
|
|
51
|
+
| x[A-Fa-f\d]{2}
|
|
52
|
+
)
|
|
53
|
+
| \((?: \? (?: [:=!>]
|
|
54
|
+
| <(?:[=!]|[^>]+>)
|
|
55
|
+
| [A-Za-z\-]+:
|
|
56
|
+
| \(DEFINE\)
|
|
57
|
+
))?
|
|
58
|
+
| (?<qBase>${Mu})(?<qMod>[?+]?)(?<invalidQ>[?*+\{]?)
|
|
59
|
+
| \\?.
|
|
60
|
+
`.replace(/\s+/g,``),`gsu`);function Pu(e){if(!RegExp(`${Mu}\\+`).test(e))return{pattern:e};let t=[],n=null,r=null,i=``,a=0,o;for(Nu.lastIndex=0;o=Nu.exec(e);){let{0:s,index:c,groups:{qBase:l,qMod:u,invalidQ:d}}=o;if(s===`[`)a||(r=c),a++;else if(s===`]`)a?a--:r=null;else if(!a)if(u===`+`&&i&&!i.startsWith(`(`)){if(d)throw Error(`Invalid quantifier "${s}"`);let t=-1;if(/^\{\d+\}$/.test(l))e=Cu(e,c+l.length,u,``);else{if(i===`)`||i===`]`){let t=i===`)`?n:r;if(t===null)throw Error(`Invalid unmatched "${i}"`);e=`${e.slice(0,t)}(?>${e.slice(t,c)}${l})${e.slice(c+s.length)}`}else e=`${e.slice(0,c-i.length)}(?>${i}${l})${e.slice(c+s.length)}`;t+=4}Nu.lastIndex+=t}else s[0]===`(`?t.push(c):s===`)`&&(n=t.length?t.pop():null);i=s}return{pattern:e}}var Fu=String.raw,Iu=Fu`\(\?R=(?<rDepth>[^\)]+)\)|${Fu`\\g<(?<gRNameOrNum>[^>&]+)&R=(?<gRDepth>[^>]+)>`}`,Lu=Fu`\(\?<(?![=!])(?<captureName>[^>]+)>`,Ru=Fu`${Lu}|(?<unnamed>\()(?!\?)`,zu=new RegExp(Fu`${Lu}|${Iu}|\(\?|\\?.`,`gsu`),Bu=`Cannot use multiple overlapping recursions`;function Vu(e,t){let{hiddenCaptures:n,mode:r}={hiddenCaptures:[],mode:`plugin`,...t},i=t?.captureTransfers??new Map;if(!new RegExp(Iu,`su`).test(e))return{pattern:e,captureTransfers:i,hiddenCaptures:n};if(r===`plugin`&&Ou(e,Fu`\(\?\(DEFINE\)`,wu.DEFAULT))throw Error(`DEFINE groups cannot be used with recursion`);let a=[],o=Ou(e,Fu`\\[1-9]`,wu.DEFAULT),s=new Map,c=[],l=!1,u=0,d=0,f;for(zu.lastIndex=0;f=zu.exec(e);){let{0:t,groups:{captureName:p,rDepth:m,gRNameOrNum:h,gRDepth:g}}=f;if(t===`[`)u++;else if(u)t===`]`&&u--;else if(m){if(Hu(m),l)throw Error(Bu);if(o)throw Error(`${r===`external`?`Backrefs`:`Numbered backrefs`} cannot be used with global recursion`);let t=e.slice(0,f.index),s=e.slice(zu.lastIndex);if(Ou(s,Iu,wu.DEFAULT))throw Error(Bu);let c=m-1;e=Uu(t,s,c,!1,n,a,d),i=Ku(i,t,c,a.length,0,d);break}else if(h){Hu(g);let u=!1;for(let e of c)if(e.name===h||e.num===+h){if(u=!0,e.hasRecursedWithin)throw Error(Bu);break}if(!u)throw Error(Fu`Recursive \g cannot be used outside the referenced group "${r===`external`?h:Fu`\g<${h}&R=${g}>`}"`);let p=s.get(h),m=ku(e,p);if(o&&Ou(m,Fu`${Lu}|\((?!\?)`,wu.DEFAULT))throw Error(`${r===`external`?`Backrefs`:`Numbered backrefs`} cannot be used with recursion of capturing groups`);let _=e.slice(p,f.index),v=m.slice(_.length+t.length),y=a.length,b=g-1,x=Uu(_,v,b,!0,n,a,d);i=Ku(i,_,b,a.length-y,y,d),e=`${e.slice(0,p)}${x}${e.slice(p+m.length)}`,zu.lastIndex+=x.length-t.length-_.length-v.length,c.forEach(e=>e.hasRecursedWithin=!0),l=!0}else if(p)d++,s.set(String(d),zu.lastIndex),s.set(p,zu.lastIndex),c.push({num:d,name:p});else if(t[0]===`(`){let e=t===`(`;e&&(d++,s.set(String(d),zu.lastIndex)),c.push(e?{num:d}:{})}else t===`)`&&c.pop()}return n.push(...a),{pattern:e,captureTransfers:i,hiddenCaptures:n}}function Hu(e){let t=`Max depth must be integer between 2 and 100; used ${e}`;if(!/^[1-9]\d*$/.test(e)||(e=+e,e<2||e>100))throw Error(t)}function Uu(e,t,n,r,i,a,o){let s=new Set;r&&Eu(e+t,Lu,({groups:{captureName:e}})=>{s.add(e)},wu.DEFAULT);let c=[n,r?s:null,i,a,o];return`${e}${Wu(`(?:${e}`,`forward`,...c)}(?:)${Wu(`${t})`,`backward`,...c)}${t}`}function Wu(e,t,n,r,i,a,o){let s=e=>t===`forward`?e+2:n-e+2-1,c=``;for(let t=0;t<n;t++){let n=s(t);c+=Tu(e,Fu`${Ru}|\\k<(?<backref>[^>]+)>`,({0:e,groups:{captureName:t,unnamed:s,backref:c}})=>{if(c&&r&&!r.has(c))return e;let l=`_$${n}`;if(s||t){let n=o+a.length+1;return a.push(n),Gu(i,n),s?e:`(?<${t}${l}>`}return Fu`\k<${c}${l}>`},wu.DEFAULT)}return c}function Gu(e,t){for(let n=0;n<e.length;n++)e[n]>=t&&e[n]++}function Ku(e,t,n,r,i,a){if(e.size&&r){let o=0;Eu(t,Ru,()=>o++,wu.DEFAULT);let s=a-o+i,c=new Map;return e.forEach((e,t)=>{let i=(r-o*n)/n,a=o*n,l=t>s+o?t+r:t,u=[];for(let t of e)if(t<=s)u.push(t);else if(t>s+o+i)u.push(t+r);else if(t<=s+o)for(let e=0;e<=n;e++)u.push(t+o*e);else for(let e=0;e<=n;e++)u.push(t+a+i*e);c.set(l,u)}),c}return e}var V=String.fromCodePoint,H=String.raw,qu={},Ju=globalThis.RegExp;qu.flagGroups=(()=>{try{new Ju(`(?i:)`)}catch{return!1}return!0})(),qu.unicodeSets=(()=>{try{new Ju(`[[]]`,`v`)}catch{return!1}return!0})(),qu.bugFlagVLiteralHyphenIsRange=qu.unicodeSets?(()=>{try{new Ju(H`[\d\-a]`,`v`)}catch{return!0}return!1})():!1,qu.bugNestedClassIgnoresNegation=qu.unicodeSets&&new Ju(`[[^a]]`,`v`).test(`a`);function Yu(e,{enable:t,disable:n}){return{dotAll:!n?.dotAll&&!!(t?.dotAll||e.dotAll),ignoreCase:!n?.ignoreCase&&!!(t?.ignoreCase||e.ignoreCase)}}function Xu(e,t,n){return e.has(t)||e.set(t,n),e.get(t)}function Zu(e,t){return $u[e]>=$u[t]}function Qu(e,t){if(e==null)throw Error(t??`Value expected`);return e}var $u={ES2025:2025,ES2024:2024,ES2018:2018},ed={auto:`auto`,ES2025:`ES2025`,ES2024:`ES2024`,ES2018:`ES2018`};function td(e={}){if({}.toString.call(e)!==`[object Object]`)throw Error(`Unexpected options`);if(e.target!==void 0&&!ed[e.target])throw Error(`Unexpected target "${e.target}"`);let t={accuracy:`default`,avoidSubclass:!1,flags:``,global:!1,hasIndices:!1,lazyCompileLength:1/0,target:`auto`,verbose:!1,...e,rules:{allowOrphanBackrefs:!1,asciiWordBoundaries:!1,captureGroup:!1,recursionLimit:20,singleline:!1,...e.rules}};return t.target===`auto`&&(t.target=qu.flagGroups?`ES2025`:qu.unicodeSets?`ES2024`:`ES2018`),t}var nd=`[ -\r ]`,rd=new Set([V(304),V(305)]),id=H`[\p{L}\p{M}\p{N}\p{Pc}]`;function ad(e){if(rd.has(e))return[e];let t=new Set,n=e.toLowerCase(),r=n.toUpperCase(),i=ld.get(n),a=sd.get(n),o=cd.get(n);return[...r].length===1&&t.add(r),o&&t.add(o),i&&t.add(i),t.add(n),a&&t.add(a),[...t]}var od=new Map(`C Other
|
|
61
|
+
Cc Control cntrl
|
|
62
|
+
Cf Format
|
|
63
|
+
Cn Unassigned
|
|
64
|
+
Co Private_Use
|
|
65
|
+
Cs Surrogate
|
|
66
|
+
L Letter
|
|
67
|
+
LC Cased_Letter
|
|
68
|
+
Ll Lowercase_Letter
|
|
69
|
+
Lm Modifier_Letter
|
|
70
|
+
Lo Other_Letter
|
|
71
|
+
Lt Titlecase_Letter
|
|
72
|
+
Lu Uppercase_Letter
|
|
73
|
+
M Mark Combining_Mark
|
|
74
|
+
Mc Spacing_Mark
|
|
75
|
+
Me Enclosing_Mark
|
|
76
|
+
Mn Nonspacing_Mark
|
|
77
|
+
N Number
|
|
78
|
+
Nd Decimal_Number digit
|
|
79
|
+
Nl Letter_Number
|
|
80
|
+
No Other_Number
|
|
81
|
+
P Punctuation punct
|
|
82
|
+
Pc Connector_Punctuation
|
|
83
|
+
Pd Dash_Punctuation
|
|
84
|
+
Pe Close_Punctuation
|
|
85
|
+
Pf Final_Punctuation
|
|
86
|
+
Pi Initial_Punctuation
|
|
87
|
+
Po Other_Punctuation
|
|
88
|
+
Ps Open_Punctuation
|
|
89
|
+
S Symbol
|
|
90
|
+
Sc Currency_Symbol
|
|
91
|
+
Sk Modifier_Symbol
|
|
92
|
+
Sm Math_Symbol
|
|
93
|
+
So Other_Symbol
|
|
94
|
+
Z Separator
|
|
95
|
+
Zl Line_Separator
|
|
96
|
+
Zp Paragraph_Separator
|
|
97
|
+
Zs Space_Separator
|
|
98
|
+
ASCII
|
|
99
|
+
ASCII_Hex_Digit AHex
|
|
100
|
+
Alphabetic Alpha
|
|
101
|
+
Any
|
|
102
|
+
Assigned
|
|
103
|
+
Bidi_Control Bidi_C
|
|
104
|
+
Bidi_Mirrored Bidi_M
|
|
105
|
+
Case_Ignorable CI
|
|
106
|
+
Cased
|
|
107
|
+
Changes_When_Casefolded CWCF
|
|
108
|
+
Changes_When_Casemapped CWCM
|
|
109
|
+
Changes_When_Lowercased CWL
|
|
110
|
+
Changes_When_NFKC_Casefolded CWKCF
|
|
111
|
+
Changes_When_Titlecased CWT
|
|
112
|
+
Changes_When_Uppercased CWU
|
|
113
|
+
Dash
|
|
114
|
+
Default_Ignorable_Code_Point DI
|
|
115
|
+
Deprecated Dep
|
|
116
|
+
Diacritic Dia
|
|
117
|
+
Emoji
|
|
118
|
+
Emoji_Component EComp
|
|
119
|
+
Emoji_Modifier EMod
|
|
120
|
+
Emoji_Modifier_Base EBase
|
|
121
|
+
Emoji_Presentation EPres
|
|
122
|
+
Extended_Pictographic ExtPict
|
|
123
|
+
Extender Ext
|
|
124
|
+
Grapheme_Base Gr_Base
|
|
125
|
+
Grapheme_Extend Gr_Ext
|
|
126
|
+
Hex_Digit Hex
|
|
127
|
+
IDS_Binary_Operator IDSB
|
|
128
|
+
IDS_Trinary_Operator IDST
|
|
129
|
+
ID_Continue IDC
|
|
130
|
+
ID_Start IDS
|
|
131
|
+
Ideographic Ideo
|
|
132
|
+
Join_Control Join_C
|
|
133
|
+
Logical_Order_Exception LOE
|
|
134
|
+
Lowercase Lower
|
|
135
|
+
Math
|
|
136
|
+
Noncharacter_Code_Point NChar
|
|
137
|
+
Pattern_Syntax Pat_Syn
|
|
138
|
+
Pattern_White_Space Pat_WS
|
|
139
|
+
Quotation_Mark QMark
|
|
140
|
+
Radical
|
|
141
|
+
Regional_Indicator RI
|
|
142
|
+
Sentence_Terminal STerm
|
|
143
|
+
Soft_Dotted SD
|
|
144
|
+
Terminal_Punctuation Term
|
|
145
|
+
Unified_Ideograph UIdeo
|
|
146
|
+
Uppercase Upper
|
|
147
|
+
Variation_Selector VS
|
|
148
|
+
White_Space space
|
|
149
|
+
XID_Continue XIDC
|
|
150
|
+
XID_Start XIDS`.split(/\s/).map(e=>[hu(e),e])),sd=new Map([[`s`,V(383)],[V(383),`s`]]),cd=new Map([[V(223),V(7838)],[V(107),V(8490)],[V(229),V(8491)],[V(969),V(8486)]]),ld=new Map([fd(453),fd(456),fd(459),fd(498),...pd(8072,8079),...pd(8088,8095),...pd(8104,8111),fd(8124),fd(8140),fd(8188)]),ud=new Map([[`alnum`,H`[\p{Alpha}\p{Nd}]`],[`alpha`,H`\p{Alpha}`],[`ascii`,H`\p{ASCII}`],[`blank`,H`[\p{Zs}\t]`],[`cntrl`,H`\p{Cc}`],[`digit`,H`\p{Nd}`],[`graph`,H`[\P{space}&&\P{Cc}&&\P{Cn}&&\P{Cs}]`],[`lower`,H`\p{Lower}`],[`print`,H`[[\P{space}&&\P{Cc}&&\P{Cn}&&\P{Cs}]\p{Zs}]`],[`punct`,H`[\p{P}\p{S}]`],[`space`,H`\p{space}`],[`upper`,H`\p{Upper}`],[`word`,H`[\p{Alpha}\p{M}\p{Nd}\p{Pc}]`],[`xdigit`,H`\p{AHex}`]]);function dd(e,t){let n=[];for(let r=e;r<=t;r++)n.push(r);return n}function fd(e){let t=V(e);return[t.toLowerCase(),t]}function pd(e,t){return dd(e,t).map(e=>fd(e))}var md=new Set([`Lower`,`Lowercase`,`Upper`,`Uppercase`,`Ll`,`Lowercase_Letter`,`Lt`,`Titlecase_Letter`,`Lu`,`Uppercase_Letter`]);function hd(e,t){let n={accuracy:`default`,asciiWordBoundaries:!1,avoidSubclass:!1,bestEffortTarget:`ES2025`,...t};yd(e);let r={accuracy:n.accuracy,asciiWordBoundaries:n.asciiWordBoundaries,avoidSubclass:n.avoidSubclass,flagDirectivesByAlt:new Map,jsGroupNameMap:new Map,minTargetEs2024:Zu(n.bestEffortTarget,`ES2024`),passedLookbehind:!1,strategy:null,subroutineRefMap:new Map,supportedGNodes:new Set,digitIsAscii:e.flags.digitIsAscii,spaceIsAscii:e.flags.spaceIsAscii,wordIsAscii:e.flags.wordIsAscii};vu(e,gd,r);let i={dotAll:e.flags.dotAll,ignoreCase:e.flags.ignoreCase},a={currentFlags:i,prevFlags:null,globalFlags:i,groupOriginByCopy:new Map,groupsByName:new Map,multiplexCapturesToLeftByRef:new Map,openRefs:new Map,reffedNodesByReferencer:new Map,subroutineRefMap:r.subroutineRefMap};return vu(e,_d,a),vu(e,vd,{groupsByName:a.groupsByName,highestOrphanBackref:0,numCapturesToLeft:0,reffedNodesByReferencer:a.reffedNodesByReferencer}),e._originMap=a.groupOriginByCopy,e._strategy=r.strategy,e}var gd={AbsenceFunction({node:e,parent:t,replaceWith:n}){let{body:r,kind:i}=e;if(i===`repeater`){let e=eu();e.body[0].body.push(tu({negate:!0,body:r}),su(`Any`));let i=eu();i.body[0].body.push(iu(`greedy`,0,1/0,e)),n(U(i,t),{traverse:!0})}else throw Error(`Unsupported absence function "(?~|"`)},Alternative:{enter({node:e,parent:t,key:n},{flagDirectivesByAlt:r}){let i=e.body.filter(e=>e.kind===`flags`);for(let e=n+1;e<t.body.length;e++){let n=t.body[e];Xu(r,n,[]).push(...i)}},exit({node:e},{flagDirectivesByAlt:t}){if(t.get(e)?.length){let n=Ed(t.get(e));if(n){let t=eu({flags:n});t.body[0].body=e.body,e.body=[U(t,e)]}}}},Assertion({node:e,parent:t,key:n,container:r,root:i,remove:a,replaceWith:o},s){let{kind:c,negate:l}=e,{asciiWordBoundaries:u,avoidSubclass:d,supportedGNodes:f,wordIsAscii:p}=s;if(c===`text_segment_boundary`)throw Error(`Unsupported text segment boundary "\\${l?`Y`:`y`}"`);if(c===`line_end`)o(U(tu({body:[Wl({body:[Gl(`string_end`)]}),Wl({body:[Jl(10)]})]}),t));else if(c===`line_start`)o(U(Fd(H`(?<=\A|\n(?!\z))`,{skipLookbehindValidation:!0}),t));else if(c===`search_start`)if(f.has(e))i.flags.sticky=!0,a();else{let e=r[n-1];if(e&&Md(e))o(U(tu({negate:!0}),t));else if(d)throw Error(H`Uses "\G" in a way that requires a subclass`);else o(Ld(Gl(`string_start`),t)),s.strategy=`clip_search`}else if(!(c===`string_end`||c===`string_start`))if(c===`string_end_newline`)o(U(Fd(H`(?=\n?\z)`),t));else if(c===`word_boundary`){if(!p&&!u){let e=`(?:(?<=${id})(?!${id})|(?<!${id})(?=${id}))`,n=`(?:(?<=${id})(?=${id})|(?<!${id})(?!${id}))`;o(U(Fd(l?n:e),t))}}else throw Error(`Unexpected assertion kind "${c}"`)},Backreference({node:e},{jsGroupNameMap:t}){let{ref:n}=e;typeof n==`string`&&!Pd(n)&&(n=Td(n,t),e.ref=n)},CapturingGroup({node:e},{jsGroupNameMap:t,subroutineRefMap:n}){let{name:r}=e;r&&!Pd(r)&&(r=Td(r,t),e.name=r),n.set(e.number,e),r&&n.set(r,e)},CharacterClassRange({node:e,parent:t,replaceWith:n}){t.kind===`intersection`&&n(U(Yl({body:[e]}),t),{traverse:!0})},CharacterSet({node:e,parent:t,replaceWith:n},{accuracy:r,minTargetEs2024:i,digitIsAscii:a,spaceIsAscii:o,wordIsAscii:s}){let{kind:c,negate:l,value:u}=e;if(a&&(c===`digit`||u===`digit`)){n(Ld(Zl(`digit`,{negate:l}),t));return}if(o&&(c===`space`||u===`space`)){n(U(Id(Fd(nd),l),t));return}if(s&&(c===`word`||u===`word`)){n(Ld(Zl(`word`,{negate:l}),t));return}if(c===`any`)n(Ld(su(`Any`),t));else if(c===`digit`)n(Ld(su(`Nd`,{negate:l}),t));else if(c!==`dot`)if(c===`text_segment`){if(r===`strict`)throw Error(H`Use of "\X" requires non-strict accuracy`);let e=`\\p{Emoji}(?:\\p{EMod}|\\uFE0F\\u20E3?|[\\x{E0020}-\\x{E007E}]+\\x{E007F})?`,a=H`\p{RI}{2}|${e}(?:\u200D${e})*`;n(U(Fd(H`(?>\r\n|${i?H`\p{RGI_Emoji}`:a}|\P{M}\p{M}*)`,{skipPropertyNameValidation:!0}),t))}else if(c===`hex`)n(Ld(su(`AHex`,{negate:l}),t));else if(c===`newline`)n(U(Fd(l?`[^
|
|
151
|
+
]`:`(?>\r
|
|
152
|
+
?|[
|
|
153
|
+
\v\f
\u2028\u2029])`),t));else if(c===`posix`)if(!i&&(u===`graph`||u===`print`)){if(r===`strict`)throw Error(`POSIX class "${u}" requires min target ES2024 or non-strict accuracy`);let e={graph:`!-~`,print:` -~`}[u];l&&(e=`\0-${V(e.codePointAt(0)-1)}${V(e.codePointAt(2)+1)}-\u{10FFFF}`),n(U(Fd(`[${e}]`),t))}else n(U(Id(Fd(ud.get(u)),l),t));else if(c===`property`)od.has(hu(u))||(e.key=`sc`);else if(c===`space`)n(Ld(su(`space`,{negate:l}),t));else if(c===`word`)n(U(Id(Fd(id),l),t));else throw Error(`Unexpected character set kind "${c}"`)},Directive({node:e,parent:t,root:n,remove:r,replaceWith:i,removeAllPrevSiblings:a,removeAllNextSiblings:o}){let{kind:s,flags:c}=e;if(s===`flags`)if(!c.enable&&!c.disable)r();else{let e=eu({flags:c});e.body[0].body=o(),i(U(e,t),{traverse:!0})}else if(s===`keep`){let e=n.body[0],r=n.body.length===1&&jl(e,{type:`Group`})&&e.body[0].body.length===1?e.body[0]:n;if(t.parent!==r||r.body.length>1)throw Error(H`Uses "\K" in a way that's unsupported`);let o=tu({behind:!0});o.body[0].body=a(),i(U(o,t))}else throw Error(`Unexpected directive kind "${s}"`)},Flags({node:e,parent:t}){if(e.posixIsAscii)throw Error(`Unsupported flag "P"`);if(e.textSegmentMode===`word`)throw Error(`Unsupported flag "y{w}"`);[`digitIsAscii`,`extended`,`posixIsAscii`,`spaceIsAscii`,`wordIsAscii`,`textSegmentMode`].forEach(t=>delete e[t]),Object.assign(e,{global:!1,hasIndices:!1,multiline:!1,sticky:e.sticky??!1}),t.options={disable:{x:!0,n:!0},force:{v:!0}}},Group({node:e}){if(!e.flags)return;let{enable:t,disable:n}=e.flags;t?.extended&&delete t.extended,n?.extended&&delete n.extended,t?.dotAll&&n?.dotAll&&delete t.dotAll,t?.ignoreCase&&n?.ignoreCase&&delete t.ignoreCase,t&&!Object.keys(t).length&&delete e.flags.enable,n&&!Object.keys(n).length&&delete e.flags.disable,!e.flags.enable&&!e.flags.disable&&delete e.flags},LookaroundAssertion({node:e},t){let{kind:n}=e;n===`lookbehind`&&(t.passedLookbehind=!0)},NamedCallout({node:e,parent:t,replaceWith:n}){let{kind:r}=e;if(r===`fail`)n(U(tu({negate:!0}),t));else throw Error(`Unsupported named callout "(*${r.toUpperCase()}"`)},Quantifier({node:e}){if(e.body.type===`Quantifier`){let t=eu();t.body[0].body.push(e.body),e.body=U(t,e)}},Regex:{enter({node:e},{supportedGNodes:t}){let n=[],r=!1,i=!1;for(let t of e.body)if(t.body.length===1&&t.body[0].kind===`search_start`)t.body.pop();else{let e=kd(t.body);e?(r=!0,Array.isArray(e)?n.push(...e):n.push(e)):i=!0}r&&!i&&n.forEach(e=>t.add(e))},exit(e,{accuracy:t,passedLookbehind:n,strategy:r}){if(t===`strict`&&n&&r)throw Error(H`Uses "\G" in a way that requires non-strict accuracy`)}},Subroutine({node:e},{jsGroupNameMap:t}){let{ref:n}=e;typeof n==`string`&&!Pd(n)&&(n=Td(n,t),e.ref=n)}},_d={Backreference({node:e},{multiplexCapturesToLeftByRef:t,reffedNodesByReferencer:n}){let{orphan:r,ref:i}=e;r||n.set(e,[...t.get(i).map(({node:e})=>e)])},CapturingGroup:{enter({node:e,parent:t,replaceWith:n,skip:r},{groupOriginByCopy:i,groupsByName:a,multiplexCapturesToLeftByRef:o,openRefs:s,reffedNodesByReferencer:c}){let l=i.get(e);if(l&&s.has(e.number)){let r=Ld(Cd(e.number),t);c.set(r,s.get(e.number)),n(r);return}s.set(e.number,e),o.set(e.number,[]),e.name&&Xu(o,e.name,[]);let u=o.get(e.name??e.number);for(let t=0;t<u.length;t++){let n=u[t];if(l===n.node||l&&l===n.origin||e===n.origin){u.splice(t,1);break}}if(o.get(e.number).push({node:e,origin:l}),e.name&&o.get(e.name).push({node:e,origin:l}),e.name){let t=Xu(a,e.name,new Map),n=!1;if(l)n=!0;else for(let e of t.values())if(!e.hasDuplicateNameToRemove){n=!0;break}a.get(e.name).set(e,{node:e,hasDuplicateNameToRemove:n})}},exit({node:e},{openRefs:t}){t.get(e.number)===e&&t.delete(e.number)}},Group:{enter({node:e},t){t.prevFlags=t.currentFlags,e.flags&&(t.currentFlags=Yu(t.currentFlags,e.flags))},exit(e,t){t.currentFlags=t.prevFlags}},Subroutine({node:e,parent:t,replaceWith:n},r){let{isRecursive:i,ref:a}=e;if(i){let n=t;for(;(n=n.parent)&&!(n.type===`CapturingGroup`&&(n.name===a||n.number===a)););r.reffedNodesByReferencer.set(e,n);return}let o=r.subroutineRefMap.get(a),s=a===0,c=s?Cd(0):Sd(o,r.groupOriginByCopy,null),l=c;if(!s){let e=Ed(wd(o,e=>e.type===`Group`&&!!e.flags)),t=e?Yu(r.globalFlags,e):r.globalFlags;bd(t,r.currentFlags)||(l=eu({flags:Dd(t)}),l.body[0].body.push(c))}n(U(l,t),{traverse:!s})}},vd={Backreference({node:e,parent:t,replaceWith:n},r){if(e.orphan){r.highestOrphanBackref=Math.max(r.highestOrphanBackref,e.ref);return}let i=r.reffedNodesByReferencer.get(e).filter(t=>xd(t,e));i.length?i.length>1?n(U(eu({atomic:!0,body:i.reverse().map(e=>Wl({body:[Kl(e.number)]}))}),t)):e.ref=i[0].number:n(U(tu({negate:!0}),t))},CapturingGroup({node:e},t){e.number=++t.numCapturesToLeft,e.name&&t.groupsByName.get(e.name).get(e).hasDuplicateNameToRemove&&delete e.name},Regex:{exit({node:e},t){let n=Math.max(t.highestOrphanBackref-t.numCapturesToLeft,0);for(let t=0;t<n;t++){let t=ql();e.body.at(-1).body.push(t)}}},Subroutine({node:e},t){!e.isRecursive||e.ref===0||(e.ref=t.reffedNodesByReferencer.get(e).number)}};function yd(e){vu(e,{"*"({node:e,parent:t}){e.parent=t}})}function bd(e,t){return e.dotAll===t.dotAll&&e.ignoreCase===t.ignoreCase}function xd(e,t){let n=t;do{if(n.type===`Regex`)return!1;if(n.type===`Alternative`)continue;if(n===e)return!1;let t=Od(n.parent);for(let r of t){if(r===n)break;if(r===e||Ad(r,e))return!0}}while(n=n.parent);throw Error(`Unexpected path`)}function Sd(e,t,n,r){let i=Array.isArray(e)?[]:{};for(let[a,o]of Object.entries(e))a===`parent`?i.parent=Array.isArray(n)?r:n:o&&typeof o==`object`?i[a]=Sd(o,t,i,n):(a===`type`&&o===`CapturingGroup`&&t.set(i,t.get(e)??e),i[a]=o);return i}function Cd(e){let t=ou(e);return t.isRecursive=!0,t}function wd(e,t){let n=[];for(;e=e.parent;)(!t||t(e))&&n.push(e);return n}function Td(e,t){if(t.has(e))return t.get(e);let n=`$${t.size}_${e.replace(/^[^$_\p{IDS}]|[^$\u200C\u200D\p{IDC}]/gu,`_`)}`;return t.set(e,n),n}function Ed(e){let t=[`dotAll`,`ignoreCase`],n={enable:{},disable:{}};return e.forEach(({flags:e})=>{t.forEach(t=>{e.enable?.[t]&&(delete n.disable[t],n.enable[t]=!0),e.disable?.[t]&&(n.disable[t]=!0)})}),Object.keys(n.enable).length||delete n.enable,Object.keys(n.disable).length||delete n.disable,n.enable||n.disable?n:null}function Dd({dotAll:e,ignoreCase:t}){let n={};return(e||t)&&(n.enable={},e&&(n.enable.dotAll=!0),t&&(n.enable.ignoreCase=!0)),(!e||!t)&&(n.disable={},!e&&(n.disable.dotAll=!0),!t&&(n.disable.ignoreCase=!0)),n}function Od(e){if(!e)throw Error(`Node expected`);let{body:t}=e;return Array.isArray(t)?t:t?[t]:null}function kd(e){let t=e.find(e=>e.kind===`search_start`||Nd(e,{negate:!1})||!jd(e));if(!t)return null;if(t.kind===`search_start`)return t;if(t.type===`LookaroundAssertion`)return t.body[0].body[0];if(t.type===`CapturingGroup`||t.type===`Group`){let e=[];for(let n of t.body){let t=kd(n.body);if(!t)return null;Array.isArray(t)?e.push(...t):e.push(t)}return e}return null}function Ad(e,t){let n=Od(e)??[];for(let e of n)if(e===t||Ad(e,t))return!0;return!1}function jd({type:e}){return e===`Assertion`||e===`Directive`||e===`LookaroundAssertion`}function Md(e){let t=[`Character`,`CharacterClass`,`CharacterSet`];return t.includes(e.type)||e.type===`Quantifier`&&e.min&&t.includes(e.body.type)}function Nd(e,t){let n={negate:null,...t};return e.type===`LookaroundAssertion`&&(n.negate===null||e.negate===n.negate)&&e.body.length===1&&jl(e.body[0],{type:`Assertion`,kind:`search_start`})}function Pd(e){return/^[$_\p{IDS}][$\u200C\u200D\p{IDC}]*$/u.test(e)}function Fd(e,t){let n=Pl(e,{...t,unicodePropertyMap:od}).body;return n.length>1||n[0].body.length>1?eu({body:n}):n[0].body[0]}function Id(e,t){return e.negate=t,e}function Ld(e,t){return e.parent=t,e}function U(e,t){return yd(e),e.parent=t,e}function Rd(e,t){let n=td(t),r=Zu(n.target,`ES2024`),i=Zu(n.target,`ES2025`),a=n.rules.recursionLimit;if(!Number.isInteger(a)||a<2||a>20)throw Error(`Invalid recursionLimit; use 2-20`);let o=null,s=null;if(!i){let t=[e.flags.ignoreCase];vu(e,zd,{getCurrentModI:()=>t.at(-1),popModI(){t.pop()},pushModI(e){t.push(e)},setHasCasedChar(){t.at(-1)?o=!0:s=!0}})}let c={dotAll:e.flags.dotAll,ignoreCase:!!((e.flags.ignoreCase||o)&&!s)},l=e,u={accuracy:n.accuracy,appliedGlobalFlags:c,captureMap:new Map,currentFlags:{dotAll:e.flags.dotAll,ignoreCase:e.flags.ignoreCase},inCharClass:!1,lastNode:l,originMap:e._originMap,recursionLimit:a,useAppliedIgnoreCase:!!(!i&&o&&s),useFlagMods:i,useFlagV:r,verbose:n.verbose};function d(e){return u.lastNode=l,l=e,Qu(Bd[e.type],`Unexpected node type "${e.type}"`)(e,u,d)}let f={pattern:e.body.map(d).join(`|`),flags:d(e.flags),options:{...e.options}};return r||(delete f.options.force.v,f.options.disable.v=!0,f.options.unicodeSetsPlugin=null),f._captureTransfers=new Map,f._hiddenCaptures=[],u.captureMap.forEach((e,t)=>{e.hidden&&f._hiddenCaptures.push(t),e.transferTo&&Xu(f._captureTransfers,e.transferTo,[]).push(t)}),f}var zd={"*":{enter({node:e},t){if(Qd(e)){let n=t.getCurrentModI();t.pushModI(e.flags?Yu({ignoreCase:n},e.flags).ignoreCase:n)}},exit({node:e},t){Qd(e)&&t.popModI()}},Backreference(e,t){t.setHasCasedChar()},Character({node:e},t){Kd(V(e.value))&&t.setHasCasedChar()},CharacterClassRange({node:e,skip:t},n){t(),qd(e,{firstOnly:!0}).length&&n.setHasCasedChar()},CharacterSet({node:e},t){e.kind===`property`&&md.has(e.value)&&t.setHasCasedChar()}},Bd={Alternative({body:e},t,n){return e.map(n).join(``)},Assertion({kind:e,negate:t}){if(e===`string_end`)return`$`;if(e===`string_start`)return`^`;if(e===`word_boundary`)return t?H`\B`:H`\b`;throw Error(`Unexpected assertion kind "${e}"`)},Backreference({ref:e},t){if(typeof e!=`number`)throw Error(`Unexpected named backref in transformed AST`);if(!t.useFlagMods&&t.accuracy===`strict`&&t.currentFlags.ignoreCase&&!t.captureMap.get(e).ignoreCase)throw Error(`Use of case-insensitive backref to case-sensitive group requires target ES2025 or non-strict accuracy`);return`\\`+e},CapturingGroup(e,t,n){let{body:r,name:i,number:a}=e,o={ignoreCase:t.currentFlags.ignoreCase},s=t.originMap.get(e);return s&&(o.hidden=!0,a>s.number&&(o.transferTo=s.number)),t.captureMap.set(a,o),`(${i?`?<${i}>`:``}${r.map(n).join(`|`)})`},Character({value:e},t){let n=V(e),r=Jd(e,{escDigit:t.lastNode.type===`Backreference`,inCharClass:t.inCharClass,useFlagV:t.useFlagV});if(r!==n)return r;if(t.useAppliedIgnoreCase&&t.currentFlags.ignoreCase&&Kd(n)){let e=ad(n);return t.inCharClass?e.join(``):e.length>1?`[${e.join(``)}]`:e[0]}return n},CharacterClass(e,t,n){let{kind:r,negate:i,parent:a}=e,{body:o}=e;if(r===`intersection`&&!t.useFlagV)throw Error(`Use of character class intersection requires min target ES2024`);qu.bugFlagVLiteralHyphenIsRange&&t.useFlagV&&o.some(ef)&&(o=[Jl(45),...o.filter(e=>!ef(e))]);let s=()=>`[${i?`^`:``}${o.map(n).join(r===`intersection`?`&&`:``)}]`;if(!t.inCharClass){if((!t.useFlagV||qu.bugNestedClassIgnoresNegation)&&!i){let t=o.filter(e=>e.type===`CharacterClass`&&e.kind===`union`&&e.negate);if(t.length){let r=eu(),i=r.body[0];return r.parent=a,i.parent=r,o=o.filter(e=>!t.includes(e)),e.body=o,o.length?(e.parent=i,i.body.push(e)):r.body.pop(),t.forEach(e=>{let t=Wl({body:[e]});e.parent=t,t.parent=r,r.body.push(t)}),n(r)}}t.inCharClass=!0;let r=s();return t.inCharClass=!1,r}let c=o[0];if(r===`union`&&!i&&c&&((!t.useFlagV||!t.verbose)&&a.kind===`union`&&!(qu.bugFlagVLiteralHyphenIsRange&&t.useFlagV)||!t.verbose&&a.kind===`intersection`&&o.length===1&&c.type!==`CharacterClassRange`))return o.map(n).join(``);if(!t.useFlagV&&a.type===`CharacterClass`)throw Error(`Uses nested character class in a way that requires min target ES2024`);return s()},CharacterClassRange(e,t){let n=e.min.value,r=e.max.value,i={escDigit:!1,inCharClass:!0,useFlagV:t.useFlagV},a=Jd(n,i),o=Jd(r,i),s=new Set;return t.useAppliedIgnoreCase&&t.currentFlags.ignoreCase&&Yd(qd(e)).forEach(e=>{s.add(Array.isArray(e)?`${Jd(e[0],i)}-${Jd(e[1],i)}`:Jd(e,i))}),`${a}-${o}${[...s].join(``)}`},CharacterSet({kind:e,negate:t,value:n,key:r},i){if(e===`dot`)return i.currentFlags.dotAll?i.appliedGlobalFlags.dotAll||i.useFlagMods?`.`:`[^]`:H`[^\n]`;if(e===`digit`)return t?H`\D`:H`\d`;if(e===`property`){if(i.useAppliedIgnoreCase&&i.currentFlags.ignoreCase&&md.has(n))throw Error(`Unicode property "${n}" can't be case-insensitive when other chars have specific case`);return`${t?H`\P`:H`\p`}{${r?`${r}=`:``}${n}}`}if(e===`word`)return t?H`\W`:H`\w`;throw Error(`Unexpected character set kind "${e}"`)},Flags(e,t){return(t.appliedGlobalFlags.ignoreCase?`i`:``)+(e.dotAll?`s`:``)+(e.sticky?`y`:``)},Group({atomic:e,body:t,flags:n,parent:r},i,a){let o=i.currentFlags;n&&(i.currentFlags=Yu(o,n));let s=t.map(a).join(`|`),c=!i.verbose&&t.length===1&&r.type!==`Quantifier`&&!e&&(!i.useFlagMods||!n)?s:`(?${Xd(e,n,i.useFlagMods)}${s})`;return i.currentFlags=o,c},LookaroundAssertion({body:e,kind:t,negate:n},r,i){return`(?${`${t===`lookahead`?``:`<`}${n?`!`:`=`}`}${e.map(i).join(`|`)})`},Quantifier(e,t,n){return n(e.body)+Zd(e)},Subroutine({isRecursive:e,ref:t},n){if(!e)throw Error(`Unexpected non-recursive subroutine in transformed AST`);let r=n.recursionLimit;return t===0?`(?R=${r})`:H`\g<${t}&R=${r}>`}},Vd=new Set([`$`,`(`,`)`,`*`,`+`,`.`,`?`,`[`,`\\`,`]`,`^`,`{`,`|`,`}`]),Hd=new Set([`-`,`\\`,`]`,`^`,`[`]),Ud=new Set("()-/[\\]^{|}!#$%&*+,.:;<=>?@`~".split(``)),Wd=new Map([[9,H`\t`],[10,H`\n`],[11,H`\v`],[12,H`\f`],[13,H`\r`],[8232,H`\u2028`],[8233,H`\u2029`],[65279,H`\uFEFF`]]),Gd=/^\p{Cased}$/u;function Kd(e){return Gd.test(e)}function qd(e,t){let n=!!t?.firstOnly,r=e.min.value,i=e.max.value,a=[];if(r<65&&(i===65535||i>=131071)||r===65536&&i>=131071)return a;for(let e=r;e<=i;e++){let t=V(e);if(!Kd(t))continue;let o=ad(t).filter(e=>{let t=e.codePointAt(0);return t<r||t>i});if(o.length&&(a.push(...o),n))break}return a}function Jd(e,{escDigit:t,inCharClass:n,useFlagV:r}){if(Wd.has(e))return Wd.get(e);if(e<32||e>126&&e<160||e>262143||t&&$d(e))return e>255?`\\u{${e.toString(16).toUpperCase()}}`:`\\x${e.toString(16).toUpperCase().padStart(2,`0`)}`;let i=n?r?Ud:Hd:Vd,a=V(e);return(i.has(a)?`\\`:``)+a}function Yd(e){let t=e.map(e=>e.codePointAt(0)).sort((e,t)=>e-t),n=[],r=null;for(let e=0;e<t.length;e++)t[e+1]===t[e]+1?r??=t[e]:r===null?n.push(t[e]):(n.push([r,t[e]]),r=null);return n}function Xd(e,t,n){if(e)return`>`;let r=``;if(t&&n){let{enable:e,disable:n}=t;r=(e?.ignoreCase?`i`:``)+(e?.dotAll?`s`:``)+(n?`-`:``)+(n?.ignoreCase?`i`:``)+(n?.dotAll?`s`:``)}return`${r}:`}function Zd({kind:e,max:t,min:n}){let r;return r=!n&&t===1?`?`:!n&&t===1/0?`*`:n===1&&t===1/0?`+`:n===t?`{${n}}`:`{${n},${t===1/0?``:t}}`,r+{greedy:``,lazy:`?`,possessive:`+`}[e]}function Qd({type:e}){return e===`CapturingGroup`||e===`Group`||e===`LookaroundAssertion`}function $d(e){return e>47&&e<58}function ef({type:e,value:t}){return e===`Character`&&t===45}var tf=class e extends RegExp{#e=new Map;#t=null;#n;#r=null;#i=null;rawOptions={};get source(){return this.#n||`(?:)`}constructor(t,n,r){let i=!!r?.lazyCompile;if(t instanceof RegExp){if(r)throw Error(`Cannot provide options when copying a regexp`);let i=t;super(i,n),this.#n=i.source,i instanceof e&&(this.#e=i.#e,this.#r=i.#r,this.#i=i.#i,this.rawOptions=i.rawOptions)}else{let e={hiddenCaptures:[],strategy:null,transfers:[],...r};super(i?``:t,n),this.#n=t,this.#e=rf(e.hiddenCaptures,e.transfers),this.#i=e.strategy,this.rawOptions=r??{}}i||(this.#t=this)}exec(t){if(!this.#t){let{lazyCompile:t,...n}=this.rawOptions;this.#t=new e(this.#n,this.flags,n)}let n=this.global||this.sticky,r=this.lastIndex;if(this.#i===`clip_search`&&n&&r){this.lastIndex=0;let e=this.#a(t.slice(r));return e&&(nf(e,r,t,this.hasIndices),this.lastIndex+=r),e}return this.#a(t)}#a(e){this.#t.lastIndex=this.lastIndex;let t=super.exec.call(this.#t,e);if(this.lastIndex=this.#t.lastIndex,!t||!this.#e.size)return t;let n=[...t];t.length=1;let r;this.hasIndices&&(r=[...t.indices],t.indices.length=1);let i=[0];for(let e=1;e<n.length;e++){let{hidden:a,transferTo:o}=this.#e.get(e)??{};if(a?i.push(null):(i.push(t.length),t.push(n[e]),this.hasIndices&&t.indices.push(r[e])),o&&n[e]!==void 0){let a=i[o];if(!a)throw Error(`Invalid capture transfer to "${a}"`);if(t[a]=n[e],this.hasIndices&&(t.indices[a]=r[e]),t.groups){this.#r||=af(this.source);let i=this.#r.get(o);i&&(t.groups[i]=n[e],this.hasIndices&&(t.indices.groups[i]=r[e]))}}}return t}};function nf(e,t,n,r){if(e.index+=t,e.input=n,r){let n=e.indices;for(let e=0;e<n.length;e++){let r=n[e];r&&(n[e]=[r[0]+t,r[1]+t])}let r=n.groups;r&&Object.keys(r).forEach(e=>{let n=r[e];n&&(r[e]=[n[0]+t,n[1]+t])})}}function rf(e,t){let n=new Map;for(let t of e)n.set(t,{hidden:!0});for(let[e,r]of t)for(let t of r)Xu(n,t,{}).transferTo=e;return n}function af(e){let t=/(?<capture>\((?:\?<(?![=!])(?<name>[^>]+)>|(?!\?)))|\\?./gsu,n=new Map,r=0,i=0,a;for(;a=t.exec(e);){let{0:e,groups:{capture:t,name:o}}=a;e===`[`?r++:r?e===`]`&&r--:t&&(i++,o&&n.set(i,o))}return n}function of(e,t){let n=sf(e,t);return n.options?new tf(n.pattern,n.flags,n.options):new RegExp(n.pattern,n.flags)}function sf(e,t){let n=td(t),r=hd(Pl(e,{flags:n.flags,normalizeUnknownPropertyNames:!0,rules:{captureGroup:n.rules.captureGroup,singleline:n.rules.singleline},skipBackrefValidation:n.rules.allowOrphanBackrefs,unicodePropertyMap:od}),{accuracy:n.accuracy,asciiWordBoundaries:n.rules.asciiWordBoundaries,avoidSubclass:n.avoidSubclass,bestEffortTarget:n.target}),i=Rd(r,n),a=Vu(i.pattern,{captureTransfers:i._captureTransfers,hiddenCaptures:i._hiddenCaptures,mode:`external`}),o=ju(Pu(a.pattern).pattern,{captureTransfers:a.captureTransfers,hiddenCaptures:a.hiddenCaptures}),s={pattern:o.pattern,flags:`${n.hasIndices?`d`:``}${n.global?`g`:``}${i.flags}${i.options.disable.v?`u`:`v`}`};if(n.avoidSubclass){if(n.lazyCompileLength!==1/0)throw Error(`Lazy compilation requires subclass`)}else{let e=o.hiddenCaptures.sort((e,t)=>e-t),t=Array.from(o.captureTransfers),i=r._strategy,a=s.pattern.length>=n.lazyCompileLength;(e.length||t.length||i||a)&&(s.options={...e.length&&{hiddenCaptures:e},...t.length&&{transfers:t},...i&&{strategy:i},...a&&{lazyCompile:a}})}return s}function cf(e,t){return of(e,{global:!0,hasIndices:!0,lazyCompileLength:3e3,rules:{allowOrphanBackrefs:!0,asciiWordBoundaries:!0,captureGroup:!0,recursionLimit:5,singleline:!0},...t})}function lf(e={}){let t={target:`auto`,cache:new Map,...e};return t.regexConstructor||=e=>cf(e,{target:t.target}),{createScanner(e){return new Vc(e,t)},createString(e){return{content:e}}}}var uf=e=>e&&e&1,df=e=>e&&e&2,ff=e=>e&&e&4,pf=new Set([`bash`,`css`,`diff`,`html`,`javascript`,`json`,`jsonc`,`jsx`,`markdown`,`python`,`shellscript`,`tsx`,`typescript`,`yaml`]),mf={bash:()=>M(()=>import(`./bash-B7CDPTg5.js`).then(e=>e.default),__vite__mapDeps([0,1]),import.meta.url),css:()=>M(()=>import(`./css-BsVw1vtW.js`).then(e=>e.default),[],import.meta.url),diff:()=>M(()=>import(`./diff-woXpYk--.js`).then(e=>e.default),[],import.meta.url),html:()=>M(()=>import(`./html-BY76lXLH.js`).then(e=>e.default),__vite__mapDeps([2,3,4]),import.meta.url),javascript:()=>M(()=>import(`./javascript-BgS3c2Ky.js`).then(e=>e.default),[],import.meta.url),json:()=>M(()=>import(`./json-qhed-kSA.js`).then(e=>e.default),[],import.meta.url),jsonc:()=>M(()=>import(`./jsonc-CYpm1nAK.js`).then(e=>e.default),[],import.meta.url),jsx:()=>M(()=>import(`./jsx-Bz0zcwM4.js`).then(e=>e.default),[],import.meta.url),markdown:()=>M(()=>import(`./markdown-BYOwaDjH.js`).then(e=>e.default),[],import.meta.url),python:()=>M(()=>import(`./python-gzcpVVnB.js`).then(e=>e.default),[],import.meta.url),shellscript:()=>M(()=>import(`./shellscript-CLZ0U2zV.js`).then(e=>e.default),[],import.meta.url),tsx:()=>M(()=>import(`./tsx-udAQXfEw.js`).then(e=>e.default),[],import.meta.url),typescript:()=>M(()=>import(`./typescript-bsJCZSQ-.js`).then(e=>e.default),[],import.meta.url),yaml:()=>M(()=>import(`./yaml-rwi0_p6S.js`).then(e=>e.default),[],import.meta.url)},hf={console:`shellscript`,cjs:`javascript`,htm:`html`,js:`javascript`,json5:`jsonc`,md:`markdown`,mjs:`javascript`,py:`python`,sh:`shellscript`,shell:`shellscript`,ts:`typescript`,yml:`yaml`},gf=e=>{let t=e.trim().toLowerCase();if(!t)return`text`;let n=hf[t]??t;return pf.has(n)?n:`text`},_f=e=>e.map((e,t)=>({key:`line-${t}`,tokens:e.map((e,n)=>({key:`line-${t}-${n}`,token:e}))})),vf=({token:e})=>(0,P.jsx)(`span`,{className:`dark:bg-(--shiki-dark-bg)! dark:text-(--shiki-dark)!`,style:{backgroundColor:e.bgColor,color:e.color,fontStyle:uf(e.fontStyle)?`italic`:void 0,fontWeight:df(e.fontStyle)?`bold`:void 0,textDecoration:ff(e.fontStyle)?`underline`:void 0,...e.htmlStyle},children:e.content}),yf=l(`block`,`before:content-[counter(line)]`,`before:inline-block`,`before:[counter-increment:line]`,`before:w-8`,`before:mr-4`,`before:text-right`,`before:text-muted-foreground/50`,`before:font-mono`,`before:select-none`),bf=({keyedLine:e,showLineNumbers:t})=>(0,P.jsx)(`span`,{className:t?yf:`block`,children:e.tokens.length===0?`
|
|
154
|
+
`:e.tokens.map(({token:e,key:t})=>(0,P.jsx)(vf,{token:e},t))}),xf=(0,N.createContext)({code:``}),Sf,Cf,wf=new Map,Tf=new Map,Ef=new Map,Df=(e,t)=>{let n=e.slice(0,100),r=e.length>100?e.slice(-100):``;return`${t}:${e.length}:${n}:${r}`},Of=()=>(Sf||=zc({engine:lf({forgiving:!0})}),Sf),kf=e=>(Cf||=Promise.all([M(()=>import(`./github-light-EUqPIrTm.js`).then(e=>e.default),[],import.meta.url),M(()=>import(`./github-dark-C-LZuMrd.js`).then(e=>e.default),[],import.meta.url)]).then(t=>e.loadTheme(...t)),Cf),Af=(e,t)=>{let n=wf.get(t);if(n)return n;let r=mf[t]().then(t=>e.loadLanguage(...t));return wf.set(t,r),r},jf=e=>({bg:`transparent`,fg:`inherit`,tokens:e.split(`
|
|
155
|
+
`).map(e=>e===``?[]:[{color:`inherit`,content:e}])}),Mf=(e,t,n)=>{let r=gf(t);if(r===`text`)return jf(e);let i=Df(e,r);return Tf.get(i)||(n&&(Ef.has(i)||Ef.set(i,new Set),Ef.get(i)?.add(n)),Of().then(async t=>{await kf(t),await Af(t,r);let n=t.codeToTokens(e,{lang:r,themes:{dark:`github-dark`,light:`github-light`}}),a={bg:n.bg??`transparent`,fg:n.fg??`inherit`,tokens:n.tokens};Tf.set(i,a);let o=Ef.get(i);if(o){for(let e of o)e(a);Ef.delete(i)}}).catch(e=>{console.error(`Failed to highlight code:`,e),Ef.delete(i)}),null)},Nf=(0,N.memo)(({tokenized:e,showLineNumbers:t,className:n})=>{let r=(0,N.useMemo)(()=>({backgroundColor:e.bg,color:e.fg}),[e.bg,e.fg]),i=(0,N.useMemo)(()=>_f(e.tokens),[e.tokens]);return(0,P.jsx)(`pre`,{className:l(`dark:bg-(--shiki-dark-bg)! dark:text-(--shiki-dark)! m-0 p-4 text-sm`,n),style:r,children:(0,P.jsx)(`code`,{className:l(`font-mono text-sm`,t&&`[counter-increment:line_0] [counter-reset:line]`),children:i.map(e=>(0,P.jsx)(bf,{keyedLine:e,showLineNumbers:t},e.key))})})},(e,t)=>e.tokenized===t.tokenized&&e.showLineNumbers===t.showLineNumbers&&e.className===t.className);Nf.displayName=`CodeBlockBody`;var Pf=({className:e,language:t,style:n,...r})=>(0,P.jsx)(`div`,{className:l(`group relative w-full overflow-hidden rounded-sm border bg-background text-foreground`,e),"data-language":t,style:{containIntrinsicSize:`auto 200px`,contentVisibility:`auto`,...n},...r}),Ff=({children:e,className:t,...n})=>(0,P.jsx)(`div`,{className:l(`flex items-center justify-between border-b bg-muted/80 px-3 py-2 text-muted-foreground text-xs`,t),...n,children:e}),If=({children:e,className:t,...n})=>(0,P.jsx)(`div`,{className:l(`flex items-center gap-2`,t),...n,children:e}),Lf=({children:e,className:t,...n})=>(0,P.jsx)(`span`,{className:l(`font-mono`,t),...n,children:e}),Rf=({children:e,className:t,...n})=>(0,P.jsx)(`div`,{className:l(`-my-1 -mr-1 flex items-center gap-2`,t),...n,children:e}),zf=({code:e,language:t,showLineNumbers:n=!1})=>{let r=(0,N.useMemo)(()=>jf(e),[e]),i=(0,N.useMemo)(()=>Mf(e,t)??r,[e,t,r]),a=(0,N.useMemo)(()=>({code:e,language:t}),[e,t]),[o,s]=(0,N.useState)({key:a,tokens:null}),c=o.key===a?o.tokens:null;return(0,N.useEffect)(()=>{let n=!1;return Mf(e,t,e=>{n||s({key:a,tokens:e})}),()=>{n=!0}},[e,t,a]),(0,P.jsx)(`div`,{className:`relative overflow-auto`,children:(0,P.jsx)(Nf,{showLineNumbers:n,tokenized:c??i})})},Bf=({code:e,language:t,showLineNumbers:n=!1,className:r,children:i,...a})=>{let o=(0,N.useMemo)(()=>({code:e}),[e]);return(0,P.jsx)(xf.Provider,{value:o,children:(0,P.jsxs)(Pf,{className:r,language:t,...a,children:[i,(0,P.jsx)(zf,{code:e,language:t,showLineNumbers:n})]})})},Vf=({onCopy:e,onError:t,timeout:n=2e3,children:r,className:i,...a})=>{let[o,s]=(0,N.useState)(!1),c=(0,N.useRef)(0),{code:u}=(0,N.useContext)(xf),d=(0,N.useCallback)(async()=>{if(typeof window>`u`||!navigator?.clipboard?.writeText){t?.(Error(`Clipboard API not available`));return}try{o||(await navigator.clipboard.writeText(u),s(!0),e?.(),c.current=window.setTimeout(()=>s(!1),n))}catch(e){t?.(e)}},[u,e,t,n,o]);(0,N.useEffect)(()=>()=>{window.clearTimeout(c.current)},[]);let f=o?Se:ne;return(0,P.jsx)(E,{className:l(`shrink-0`,i),onClick:d,size:`icon`,variant:`ghost`,...a,children:r??(0,P.jsx)(f,{size:14})})},Hf=/(?:^|\s)language-([^\s]+)/,Uf=/startLine=(\d+)/,Wf=/\bnoLineNumbers\b/;function Gf(e){return typeof e==`string`||typeof e==`number`?String(e):Array.isArray(e)?e.map(Gf).join(``):(0,N.isValidElement)(e)?Gf(e.props.children):``}var Kf={code:({children:e,className:t,node:n,"data-block":r,...i})=>{let a=t?.match(Hf)?.[1]??`text`;if(!r)return(0,P.jsx)(`code`,{className:l(`rounded bg-muted px-1.5 py-0.5 font-mono text-sm`,t),...i,children:e});let o=n?.properties?.metastring,s=o?.match(Uf),c=s?Number.parseInt(s[1],10):1,u=o?!Wf.test(o):!0;return(0,P.jsx)(Bf,{code:Gf(e),"data-start-line":c>1?c:void 0,language:a,showLineNumbers:u,children:(0,P.jsxs)(Ff,{children:[(0,P.jsx)(If,{children:(0,P.jsx)(Lf,{children:a})}),(0,P.jsx)(Rf,{children:(0,P.jsx)(Vf,{})})]})})}},qf={fontFamily:`monospace`,securityLevel:`strict`,startOnLoad:!1,suppressErrorRendering:!0,theme:`default`};function Jf(){let e=qf,t=!1,n={initialize(n){e={...qf,...e,...n},t=!1},async render(n,r){let i=(await M(()=>import(`./mermaid.core-CiYLsDpO.js`),__vite__mapDeps([5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25]),import.meta.url)).default;return t||=(i.initialize(e),!0),i.render(n,r)}};return{getMermaid(e){return e&&n.initialize(e),n},language:`mermaid`,name:`mermaid`,type:`diagram`}}var Yf={cjk:di,mermaid:Jf()},Xf=(0,N.memo)(({className:e,components:t,...n})=>(0,P.jsx)(Ye,{className:e,components:t?{...Kf,...t}:Kf,plugins:Yf,...n}));Xf.displayName=`HubStreamdown`;var Zf=({className:e,from:t,...n})=>(0,P.jsx)(`div`,{className:l(`group flex w-full flex-col gap-2`,t===`user`?`is-user ml-auto justify-end`:`is-assistant`,e),...n}),Qf=({children:e,className:t,...n})=>(0,P.jsx)(`div`,{className:l(`is-user:dark flex w-full flex-col gap-2 overflow-hidden text-sm`,`group-[.is-user]:ml-auto group-[.is-user]:rounded-lg group-[.is-user]:bg-secondary group-[.is-user]:px-4 group-[.is-user]:py-3 group-[.is-user]:text-foreground`,`group-[.is-assistant]:text-foreground`,t),...n,children:e});(0,N.createContext)(null);var $f=(0,N.memo)(({className:e,...t})=>(0,P.jsx)(Xf,{className:l(`size-full [&>*:first-child]:mt-0 [&>*:last-child]:mb-0`,e),...t}));$f.displayName=`MessageResponse`;var ep=1,tp=.9,np=.8,rp=.17,ip=.1,ap=.999,op=.9999,sp=.99,cp=/[\\\/_+.#"@\[\(\{&]/,lp=/[\\\/_+.#"@\[\(\{&]/g,up=/[\s-]/,dp=/[\s-]/g;function fp(e,t,n,r,i,a,o){if(a===t.length)return i===e.length?ep:sp;var s=`${i},${a}`;if(o[s]!==void 0)return o[s];for(var c=r.charAt(a),l=n.indexOf(c,i),u=0,d,f,p,m;l>=0;)d=fp(e,t,n,r,l+1,a+1,o),d>u&&(l===i?d*=ep:cp.test(e.charAt(l-1))?(d*=np,p=e.slice(i,l-1).match(lp),p&&i>0&&(d*=ap**+p.length)):up.test(e.charAt(l-1))?(d*=tp,m=e.slice(i,l-1).match(dp),m&&i>0&&(d*=ap**+m.length)):(d*=rp,i>0&&(d*=ap**+(l-i))),e.charAt(l)!==t.charAt(a)&&(d*=op)),(d<ip&&n.charAt(l-1)===r.charAt(a+1)||r.charAt(a+1)===r.charAt(a)&&n.charAt(l-1)!==r.charAt(a))&&(f=fp(e,t,n,r,l+1,a+2,o),f*ip>d&&(d=f*ip)),d>u&&(u=d),l=n.indexOf(c,l+1);return o[s]=u,u}function pp(e){return e.toLowerCase().replace(dp,` `)}function mp(e,t,n){return e=n&&n.length>0?`${e+` `+n.join(` `)}`:e,fp(e,t,pp(e),pp(t),0,0,{})}typeof window<`u`&&window.document&&window.document.createElement;function hp(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(e?.(r),n===!1||!r.defaultPrevented)return t?.(r)}}function gp(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}function _p(...e){return t=>{let n=!1,r=e.map(e=>{let r=gp(e,t);return!n&&typeof r==`function`&&(n=!0),r});if(n)return()=>{for(let t=0;t<r.length;t++){let n=r[t];typeof n==`function`?n():gp(e[t],null)}}}}function vp(...e){return N.useCallback(_p(...e),e)}function yp(e,t=[]){let n=[];function r(t,r){let i=N.createContext(r);i.displayName=t+`Context`;let a=n.length;n=[...n,r];let o=t=>{let{scope:n,children:r,...o}=t,s=n?.[e]?.[a]||i,c=N.useMemo(()=>o,Object.values(o));return(0,P.jsx)(s.Provider,{value:c,children:r})};o.displayName=t+`Provider`;function s(n,o){let s=o?.[e]?.[a]||i,c=N.useContext(s);if(c)return c;if(r!==void 0)return r;throw Error(`\`${n}\` must be used within \`${t}\``)}return[o,s]}let i=()=>{let t=n.map(e=>N.createContext(e));return function(n){let r=n?.[e]||t;return N.useMemo(()=>({[`__scope${e}`]:{...n,[e]:r}}),[n,r])}};return i.scopeName=e,[r,bp(i,...t)]}function bp(...e){let t=e[0];if(e.length===1)return t;let n=()=>{let n=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){let r=n.reduce((t,{useScope:n,scopeName:r})=>{let i=n(e)[`__scope${r}`];return{...t,...i}},{});return N.useMemo(()=>({[`__scope${t.scopeName}`]:r}),[r])}};return n.scopeName=t.scopeName,n}var xp=globalThis?.document?N.useLayoutEffect:()=>{},Sp=N.useId||(()=>void 0),Cp=0;function wp(e){let[t,n]=N.useState(Sp());return xp(()=>{e||n(e=>e??String(Cp++))},[e]),e||(t?`radix-${t}`:``)}var Tp=N.useInsertionEffect||xp;function Ep({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){let[i,a,o]=Dp({defaultProp:t,onChange:n}),s=e!==void 0,c=s?e:i;{let t=N.useRef(e!==void 0);N.useEffect(()=>{let e=t.current;e!==s&&console.warn(`${r} is changing from ${e?`controlled`:`uncontrolled`} to ${s?`controlled`:`uncontrolled`}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),t.current=s},[s,r])}return[c,N.useCallback(t=>{if(s){let n=Op(t)?t(e):t;n!==e&&o.current?.(n)}else a(t)},[s,e,a,o])]}function Dp({defaultProp:e,onChange:t}){let[n,r]=N.useState(e),i=N.useRef(n),a=N.useRef(t);return Tp(()=>{a.current=t},[t]),N.useEffect(()=>{i.current!==n&&(a.current?.(n),i.current=n)},[n,i]),[n,r,a]}function Op(e){return typeof e==`function`}var kp=e(o(),1);function Ap(e){let t=N.forwardRef((t,n)=>{let{children:r,...i}=t,a=null,o=!1,s=[];Lp(r)&&typeof Vp==`function`&&(r=Vp(r._payload)),N.Children.forEach(r,e=>{if(Fp(e)){o=!0;let t=e,n=`child`in t.props?t.props.child:t.props.children;Lp(n)&&typeof Vp==`function`&&(n=Vp(n._payload)),a=Mp(t,n),s.push(a?.props?.children)}else s.push(e)}),a?a=N.cloneElement(a,void 0,s):!o&&N.Children.count(r)===1&&N.isValidElement(r)&&(a=r);let c=a?Pp(a):void 0,l=vp(n,c);if(!a){if(r||r===0)throw Error(o?Bp(e):zp(e));return r}let u=Np(i,a.props??{});return a.type!==N.Fragment&&(u.ref=n?l:c),N.cloneElement(a,u)});return t.displayName=`${e}.Slot`,t}var jp=Symbol.for(`radix.slottable`),Mp=(e,t)=>{if(`child`in e.props){let t=e.props.child;return N.isValidElement(t)?N.cloneElement(t,void 0,e.props.children(t.props.children)):null}return N.isValidElement(t)?t:null};function Np(e,t){let n={...t};for(let r in t){let i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(n[r]=i):r===`style`?n[r]={...i,...a}:r===`className`&&(n[r]=[i,a].filter(Boolean).join(` `))}return{...e,...n}}function Pp(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)}function Fp(e){return N.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===jp}var Ip=Symbol.for(`react.lazy`);function Lp(e){return typeof e==`object`&&!!e&&`$$typeof`in e&&e.$$typeof===Ip&&`_payload`in e&&Rp(e._payload)}function Rp(e){return typeof e==`object`&&!!e&&`then`in e}var zp=e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,Bp=e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,Vp=N.use,W=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=Ap(`Primitive.${t}`),r=N.forwardRef((e,r)=>{let{asChild:i,...a}=e,o=i?n:t;return typeof window<`u`&&(window[Symbol.for(`radix-ui`)]=!0),(0,P.jsx)(o,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function Hp(e,t){e&&kp.flushSync(()=>e.dispatchEvent(t))}function Up(e){let t=N.useRef(e);return N.useEffect(()=>{t.current=e}),N.useMemo(()=>((...e)=>t.current?.(...e)),[])}function Wp(e,t=globalThis?.document){let n=Up(e);N.useEffect(()=>{let e=e=>{e.key===`Escape`&&n(e)};return t.addEventListener(`keydown`,e,{capture:!0}),()=>t.removeEventListener(`keydown`,e,{capture:!0})},[n,t])}var Gp=`DismissableLayer`,Kp=`dismissableLayer.update`,qp=`dismissableLayer.pointerDownOutside`,Jp=`dismissableLayer.focusOutside`,Yp,Xp=N.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),Zp=N.forwardRef((e,t)=>{let{disableOutsidePointerEvents:n=!1,deferPointerDownOutside:r=!1,onEscapeKeyDown:i,onPointerDownOutside:a,onFocusOutside:o,onInteractOutside:s,onDismiss:c,...l}=e,u=N.useContext(Xp),[d,f]=N.useState(null),p=d?.ownerDocument??globalThis?.document,[,m]=N.useState({}),h=vp(t,e=>f(e)),g=Array.from(u.layers),[_]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),v=g.indexOf(_),y=d?g.indexOf(d):-1,b=u.layersWithOutsidePointerEventsDisabled.size>0,x=y>=v,S=N.useRef(!1),C=tm(e=>{let t=e.target;if(!(t instanceof Node))return;let n=[...u.branches].some(e=>e.contains(t));!x||n||(a?.(e),s?.(e),e.defaultPrevented||c?.())},{ownerDocument:p,deferPointerDownOutside:r,isDeferredPointerDownOutsideRef:S,dismissableSurfaces:u.dismissableSurfaces}),w=nm(e=>{if(r&&S.current)return;let t=e.target;[...u.branches].some(e=>e.contains(t))||(o?.(e),s?.(e),e.defaultPrevented||c?.())},p);return Wp(e=>{y===u.layers.size-1&&(i?.(e),!e.defaultPrevented&&c&&(e.preventDefault(),c()))},p),N.useEffect(()=>{if(d)return n&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(Yp=p.body.style.pointerEvents,p.body.style.pointerEvents=`none`),u.layersWithOutsidePointerEventsDisabled.add(d)),u.layers.add(d),rm(),()=>{n&&(u.layersWithOutsidePointerEventsDisabled.delete(d),u.layersWithOutsidePointerEventsDisabled.size===0&&(p.body.style.pointerEvents=Yp))}},[d,p,n,u]),N.useEffect(()=>()=>{d&&(u.layers.delete(d),u.layersWithOutsidePointerEventsDisabled.delete(d),rm())},[d,u]),N.useEffect(()=>{let e=()=>m({});return document.addEventListener(Kp,e),()=>document.removeEventListener(Kp,e)},[]),(0,P.jsx)(W.div,{...l,ref:h,style:{pointerEvents:b?x?`auto`:`none`:void 0,...e.style},onFocusCapture:hp(e.onFocusCapture,w.onFocusCapture),onBlurCapture:hp(e.onBlurCapture,w.onBlurCapture),onPointerDownCapture:hp(e.onPointerDownCapture,C.onPointerDownCapture)})});Zp.displayName=Gp;var Qp=`DismissableLayerBranch`,$p=N.forwardRef((e,t)=>{let n=N.useContext(Xp),r=N.useRef(null),i=vp(t,r);return N.useEffect(()=>{let e=r.current;if(e)return n.branches.add(e),()=>{n.branches.delete(e)}},[n.branches]),(0,P.jsx)(W.div,{...e,ref:i})});$p.displayName=Qp;function em(){let e=N.useContext(Xp),[t,n]=N.useState(null);return N.useEffect(()=>{if(t)return e.dismissableSurfaces.add(t),()=>{e.dismissableSurfaces.delete(t)}},[t,e.dismissableSurfaces]),n}function tm(e,t){let{ownerDocument:n=globalThis?.document,deferPointerDownOutside:r=!1,isDeferredPointerDownOutsideRef:i,dismissableSurfaces:a}=t,o=Up(e),s=N.useRef(!1),c=N.useRef(!1),l=N.useRef(new Map),u=N.useRef(()=>{});return N.useEffect(()=>{function e(){c.current=!1,i.current=!1,l.current.clear()}function t(){return Array.from(l.current.values()).some(Boolean)}function d(e){if(!c.current)return;let t=e.target;t instanceof Node&&[...a].some(e=>e.contains(t))||l.current.set(e.type,!0),e.type===`click`&&window.setTimeout(()=>{c.current&&u.current()},0)}function f(e){c.current&&l.current.set(e.type,!1)}let p=a=>{if(a.target&&!s.current){let s=function(){n.removeEventListener(`click`,u.current);let r=t();e(),r||im(qp,o,d,{discrete:!0})},d={originalEvent:a};c.current=!0,i.current=r&&a.button===0,l.current.clear(),!r||a.button!==0?s():(n.removeEventListener(`click`,u.current),u.current=s,n.addEventListener(`click`,u.current,{once:!0}))}else n.removeEventListener(`click`,u.current),e();s.current=!1},m=[`pointerup`,`mousedown`,`mouseup`,`touchstart`,`touchend`,`click`];for(let e of m)n.addEventListener(e,d,!0),n.addEventListener(e,f);let h=window.setTimeout(()=>{n.addEventListener(`pointerdown`,p)},0);return()=>{window.clearTimeout(h),n.removeEventListener(`pointerdown`,p),n.removeEventListener(`click`,u.current);for(let e of m)n.removeEventListener(e,d,!0),n.removeEventListener(e,f)}},[n,o,r,i,a]),{onPointerDownCapture:()=>s.current=!0}}function nm(e,t=globalThis?.document){let n=Up(e),r=N.useRef(!1);return N.useEffect(()=>{let e=e=>{e.target&&!r.current&&im(Jp,n,{originalEvent:e},{discrete:!1})};return t.addEventListener(`focusin`,e),()=>t.removeEventListener(`focusin`,e)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function rm(){let e=new CustomEvent(Kp);document.dispatchEvent(e)}function im(e,t,n,{discrete:r}){let i=n.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?Hp(i,a):i.dispatchEvent(a)}var am=`focusScope.autoFocusOnMount`,om=`focusScope.autoFocusOnUnmount`,sm={bubbles:!1,cancelable:!0},cm=`FocusScope`,lm=N.forwardRef((e,t)=>{let{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:a,...o}=e,[s,c]=N.useState(null),l=Up(i),u=Up(a),d=N.useRef(null),f=vp(t,e=>c(e)),p=N.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;N.useEffect(()=>{if(r){let e=function(e){if(p.paused||!s)return;let t=e.target;s.contains(t)?d.current=t:gm(d.current,{select:!0})},t=function(e){if(p.paused||!s)return;let t=e.relatedTarget;t!==null&&(s.contains(t)||gm(d.current,{select:!0}))},n=function(e){if(document.activeElement===document.body)for(let t of e)t.removedNodes.length>0&&gm(s)};document.addEventListener(`focusin`,e),document.addEventListener(`focusout`,t);let r=new MutationObserver(n);return s&&r.observe(s,{childList:!0,subtree:!0}),()=>{document.removeEventListener(`focusin`,e),document.removeEventListener(`focusout`,t),r.disconnect()}}},[r,s,p.paused]),N.useEffect(()=>{if(s){_m.add(p);let e=document.activeElement;if(!s.contains(e)){let t=new CustomEvent(am,sm);s.addEventListener(am,l),s.dispatchEvent(t),t.defaultPrevented||(um(bm(fm(s)),{select:!0}),document.activeElement===e&&gm(s))}return()=>{s.removeEventListener(am,l),setTimeout(()=>{let t=new CustomEvent(om,sm);s.addEventListener(om,u),s.dispatchEvent(t),t.defaultPrevented||gm(e??document.body,{select:!0}),s.removeEventListener(om,u),_m.remove(p)},0)}}},[s,l,u,p]);let m=N.useCallback(e=>{if(!n&&!r||p.paused)return;let t=e.key===`Tab`&&!e.altKey&&!e.ctrlKey&&!e.metaKey,i=document.activeElement;if(t&&i){let t=e.currentTarget,[r,a]=dm(t);r&&a?!e.shiftKey&&i===a?(e.preventDefault(),n&&gm(r,{select:!0})):e.shiftKey&&i===r&&(e.preventDefault(),n&&gm(a,{select:!0})):i===t&&e.preventDefault()}},[n,r,p.paused]);return(0,P.jsx)(W.div,{tabIndex:-1,...o,ref:f,onKeyDown:m})});lm.displayName=cm;function um(e,{select:t=!1}={}){let n=document.activeElement;for(let r of e)if(gm(r,{select:t}),document.activeElement!==n)return}function dm(e){let t=fm(e);return[pm(t,e),pm(t.reverse(),e)]}function fm(e){let t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>{let t=e.tagName===`INPUT`&&e.type===`hidden`;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function pm(e,t){for(let n of e)if(!mm(n,{upTo:t}))return n}function mm(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}function hm(e){return e instanceof HTMLInputElement&&`select`in e}function gm(e,{select:t=!1}={}){if(e&&e.focus){let n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&hm(e)&&t&&e.select()}}var _m=vm();function vm(){let e=[];return{add(t){let n=e[0];t!==n&&n?.pause(),e=ym(e,t),e.unshift(t)},remove(t){e=ym(e,t),e[0]?.resume()}}}function ym(e,t){let n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function bm(e){return e.filter(e=>e.tagName!==`A`)}var xm=`Portal`,Sm=N.forwardRef((e,t)=>{let{container:n,...r}=e,[i,a]=N.useState(!1);xp(()=>a(!0),[]);let o=n||i&&globalThis?.document?.body;return o?kp.createPortal((0,P.jsx)(W.div,{...r,ref:t}),o):null});Sm.displayName=xm;function Cm(e,t){return N.useReducer((e,n)=>t[e][n]??e,e)}var wm=e=>{let{present:t,children:n}=e,r=Tm(t),i=typeof n==`function`?n({present:r.isPresent}):N.Children.only(n),a=Dm(r.ref,km(i));return typeof n==`function`||r.isPresent?N.cloneElement(i,{ref:a}):null};wm.displayName=`Presence`;function Tm(e){let[t,n]=N.useState(),r=N.useRef(null),i=N.useRef(e),a=N.useRef(`none`),[o,s]=Cm(e?`mounted`:`unmounted`,{mounted:{UNMOUNT:`unmounted`,ANIMATION_OUT:`unmountSuspended`},unmountSuspended:{MOUNT:`mounted`,ANIMATION_END:`unmounted`},unmounted:{MOUNT:`mounted`}});return N.useEffect(()=>{let e=Om(r.current);a.current=o===`mounted`?e:`none`},[o]),xp(()=>{let t=r.current,n=i.current;if(n!==e){let r=a.current,o=Om(t);e?s(`MOUNT`):o===`none`||t?.display===`none`?s(`UNMOUNT`):s(n&&r!==o?`ANIMATION_OUT`:`UNMOUNT`),i.current=e}},[e,s]),xp(()=>{if(t){let e,n=t.ownerDocument.defaultView??window,o=a=>{let o=Om(r.current).includes(CSS.escape(a.animationName));if(a.target===t&&o&&(s(`ANIMATION_END`),!i.current)){let r=t.style.animationFillMode;t.style.animationFillMode=`forwards`,e=n.setTimeout(()=>{t.style.animationFillMode===`forwards`&&(t.style.animationFillMode=r)})}},c=e=>{e.target===t&&(a.current=Om(r.current))};return t.addEventListener(`animationstart`,c),t.addEventListener(`animationcancel`,o),t.addEventListener(`animationend`,o),()=>{n.clearTimeout(e),t.removeEventListener(`animationstart`,c),t.removeEventListener(`animationcancel`,o),t.removeEventListener(`animationend`,o)}}else s(`ANIMATION_END`)},[t,s]),{isPresent:[`mounted`,`unmountSuspended`].includes(o),ref:N.useCallback(e=>{r.current=e?getComputedStyle(e):null,n(e)},[])}}function Em(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}function Dm(...e){let t=N.useRef(e);return t.current=e,N.useCallback(e=>{let n=t.current,r=!1,i=n.map(t=>{let n=Em(t,e);return!r&&typeof n==`function`&&(r=!0),n});if(r)return()=>{for(let e=0;e<i.length;e++){let t=i[e];typeof t==`function`?t():Em(n[e],null)}}},[])}function Om(e){return e?.animationName||`none`}function km(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)}var Am=0,jm=null;function Mm(){N.useEffect(()=>{jm||={start:Nm(),end:Nm()};let{start:e,end:t}=jm;return document.body.firstElementChild!==e&&document.body.insertAdjacentElement(`afterbegin`,e),document.body.lastElementChild!==t&&document.body.insertAdjacentElement(`beforeend`,t),Am++,()=>{Am===1&&(jm?.start.remove(),jm?.end.remove(),jm=null),Am=Math.max(0,Am-1)}},[])}function Nm(){let 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}var Pm=function(){return Pm=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n],t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},Pm.apply(this,arguments)};function Fm(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n}function Im(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,a;r<i;r++)(a||!(r in t))&&(a||=Array.prototype.slice.call(t,0,r),a[r]=t[r]);return e.concat(a||Array.prototype.slice.call(t))}var Lm=`right-scroll-bar-position`,Rm=`width-before-scroll-bar`,zm=`with-scroll-bars-hidden`,Bm=`--removed-body-scroll-bar-size`;function Vm(e,t){return typeof e==`function`?e(t):e&&(e.current=t),e}function Hm(e,t){var n=(0,N.useState)(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(e){var t=n.value;t!==e&&(n.value=e,n.callback(e,t))}}}})[0];return n.callback=t,n.facade}var Um=typeof window<`u`?N.useLayoutEffect:N.useEffect,Wm=new WeakMap;function Gm(e,t){var n=Hm(t||null,function(t){return e.forEach(function(e){return Vm(e,t)})});return Um(function(){var t=Wm.get(n);if(t){var r=new Set(t),i=new Set(e),a=n.current;r.forEach(function(e){i.has(e)||Vm(e,null)}),i.forEach(function(e){r.has(e)||Vm(e,a)})}Wm.set(n,e)},[e]),n}function Km(e){return e}function qm(e,t){t===void 0&&(t=Km);var n=[],r=!1;return{read:function(){if(r)throw 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(e){var i=t(e,r);return n.push(i),function(){n=n.filter(function(e){return e!==i})}},assignSyncMedium:function(e){for(r=!0;n.length;){var t=n;n=[],t.forEach(e)}n={push:function(t){return e(t)},filter:function(){return n}}},assignMedium:function(e){r=!0;var t=[];if(n.length){var i=n;n=[],i.forEach(e),t=n}var a=function(){var n=t;t=[],n.forEach(e)},o=function(){return Promise.resolve().then(a)};o(),n={push:function(e){t.push(e),o()},filter:function(e){return t=t.filter(e),n}}}}}function Jm(e){e===void 0&&(e={});var t=qm(null);return t.options=Pm({async:!0,ssr:!1},e),t}var Ym=function(e){var t=e.sideCar,n=Fm(e,[`sideCar`]);if(!t)throw Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw Error(`Sidecar medium not found`);return N.createElement(r,Pm({},n))};Ym.isSideCarExport=!0;function Xm(e,t){return e.useMedium(t),Ym}var Zm=Jm(),Qm=function(){},$m=N.forwardRef(function(e,t){var n=N.useRef(null),r=N.useState({onScrollCapture:Qm,onWheelCapture:Qm,onTouchMoveCapture:Qm}),i=r[0],a=r[1],o=e.forwardProps,s=e.children,c=e.className,l=e.removeScrollBar,u=e.enabled,d=e.shards,f=e.sideCar,p=e.noRelative,m=e.noIsolation,h=e.inert,g=e.allowPinchZoom,_=e.as,v=_===void 0?`div`:_,y=e.gapMode,b=Fm(e,[`forwardProps`,`children`,`className`,`removeScrollBar`,`enabled`,`shards`,`sideCar`,`noRelative`,`noIsolation`,`inert`,`allowPinchZoom`,`as`,`gapMode`]),x=f,S=Gm([n,t]),C=Pm(Pm({},b),i);return N.createElement(N.Fragment,null,u&&N.createElement(x,{sideCar:Zm,removeScrollBar:l,shards:d,noRelative:p,noIsolation:m,inert:h,setCallbacks:a,allowPinchZoom:!!g,lockRef:n,gapMode:y}),o?N.cloneElement(N.Children.only(s),Pm(Pm({},C),{ref:S})):N.createElement(v,Pm({},C,{className:c,ref:S}),s))});$m.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},$m.classNames={fullWidth:Rm,zeroRight:Lm};var eh,th=function(){if(eh)return eh;if(typeof __webpack_nonce__<`u`)return __webpack_nonce__};function nh(){if(!document)return null;var e=document.createElement(`style`);e.type=`text/css`;var t=th();return t&&e.setAttribute(`nonce`,t),e}function rh(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function ih(e){(document.head||document.getElementsByTagName(`head`)[0]).appendChild(e)}var ah=function(){var e=0,t=null;return{add:function(n){e==0&&(t=nh())&&(rh(t,n),ih(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},oh=function(){var e=ah();return function(t,n){N.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},sh=function(){var e=oh();return function(t){var n=t.styles,r=t.dynamic;return e(n,r),null}},ch={left:0,top:0,right:0,gap:0},lh=function(e){return parseInt(e||``,10)||0},uh=function(e){var t=window.getComputedStyle(document.body),n=t[e===`padding`?`paddingLeft`:`marginLeft`],r=t[e===`padding`?`paddingTop`:`marginTop`],i=t[e===`padding`?`paddingRight`:`marginRight`];return[lh(n),lh(r),lh(i)]},dh=function(e){if(e===void 0&&(e=`margin`),typeof window>`u`)return ch;var t=uh(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])}},fh=sh(),ph=`data-scroll-locked`,mh=function(e,t,n,r){var i=e.left,a=e.top,o=e.right,s=e.gap;return n===void 0&&(n=`margin`),`
|
|
156
|
+
.${zm} {
|
|
157
|
+
overflow: hidden ${r};
|
|
158
|
+
padding-right: ${s}px ${r};
|
|
159
|
+
}
|
|
160
|
+
body[${ph}] {
|
|
161
|
+
overflow: hidden ${r};
|
|
162
|
+
overscroll-behavior: contain;
|
|
163
|
+
${[t&&`position: relative ${r};`,n===`margin`&&`
|
|
164
|
+
padding-left: ${i}px;
|
|
165
|
+
padding-top: ${a}px;
|
|
166
|
+
padding-right: ${o}px;
|
|
167
|
+
margin-left:0;
|
|
168
|
+
margin-top:0;
|
|
169
|
+
margin-right: ${s}px ${r};
|
|
170
|
+
`,n===`padding`&&`padding-right: ${s}px ${r};`].filter(Boolean).join(``)}
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
.${Lm} {
|
|
174
|
+
right: ${s}px ${r};
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
.${Rm} {
|
|
178
|
+
margin-right: ${s}px ${r};
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
.${Lm} .${Lm} {
|
|
182
|
+
right: 0 ${r};
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
.${Rm} .${Rm} {
|
|
186
|
+
margin-right: 0 ${r};
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
body[${ph}] {
|
|
190
|
+
${Bm}: ${s}px;
|
|
191
|
+
}
|
|
192
|
+
`},hh=function(){var e=parseInt(document.body.getAttribute(`data-scroll-locked`)||`0`,10);return isFinite(e)?e:0},gh=function(){N.useEffect(function(){return document.body.setAttribute(ph,(hh()+1).toString()),function(){var e=hh()-1;e<=0?document.body.removeAttribute(ph):document.body.setAttribute(ph,e.toString())}},[])},_h=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,i=r===void 0?`margin`:r;gh();var a=N.useMemo(function(){return dh(i)},[i]);return N.createElement(fh,{styles:mh(a,!t,i,n?``:`!important`)})},vh=!1;if(typeof window<`u`)try{var yh=Object.defineProperty({},"passive",{get:function(){return vh=!0,!0}});window.addEventListener(`test`,yh,yh),window.removeEventListener(`test`,yh,yh)}catch{vh=!1}var bh=vh?{passive:!1}:!1,xh=function(e){return e.tagName===`TEXTAREA`},Sh=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!==`hidden`&&!(n.overflowY===n.overflowX&&!xh(e)&&n[t]===`visible`)},Ch=function(e){return Sh(e,`overflowY`)},wh=function(e){return Sh(e,`overflowX`)},Th=function(e,t){var n=t.ownerDocument,r=t;do{if(typeof ShadowRoot<`u`&&r instanceof ShadowRoot&&(r=r.host),Oh(e,r)){var i=kh(e,r);if(i[1]>i[2])return!0}r=r.parentNode}while(r&&r!==n.body);return!1},Eh=function(e){return[e.scrollTop,e.scrollHeight,e.clientHeight]},Dh=function(e){return[e.scrollLeft,e.scrollWidth,e.clientWidth]},Oh=function(e,t){return e===`v`?Ch(t):wh(t)},kh=function(e,t){return e===`v`?Eh(t):Dh(t)},Ah=function(e,t){return e===`h`&&t===`rtl`?-1:1},jh=function(e,t,n,r,i){var a=Ah(e,window.getComputedStyle(t).direction),o=a*r,s=n.target,c=t.contains(s),l=!1,u=o>0,d=0,f=0;do{if(!s)break;var p=kh(e,s),m=p[0],h=p[1]-p[2]-a*m;(m||h)&&Oh(e,s)&&(d+=h,f+=m);var g=s.parentNode;s=g&&g.nodeType===Node.DOCUMENT_FRAGMENT_NODE?g.host:g}while(!c&&s!==document.body||c&&(t.contains(s)||t===s));return(u&&(i&&Math.abs(d)<1||!i&&o>d)||!u&&(i&&Math.abs(f)<1||!i&&-o>f))&&(l=!0),l},Mh=function(e){return`changedTouches`in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},Nh=function(e){return[e.deltaX,e.deltaY]},Ph=function(e){return e&&`current`in e?e.current:e},Fh=function(e,t){return e[0]===t[0]&&e[1]===t[1]},Ih=function(e){return`
|
|
193
|
+
.block-interactivity-${e} {pointer-events: none;}
|
|
194
|
+
.allow-interactivity-${e} {pointer-events: all;}
|
|
195
|
+
`},Lh=0,Rh=[];function zh(e){var t=N.useRef([]),n=N.useRef([0,0]),r=N.useRef(),i=N.useState(Lh++)[0],a=N.useState(sh)[0],o=N.useRef(e);N.useEffect(function(){o.current=e},[e]),N.useEffect(function(){if(e.inert){document.body.classList.add(`block-interactivity-${i}`);var t=Im([e.lockRef.current],(e.shards||[]).map(Ph),!0).filter(Boolean);return t.forEach(function(e){return e.classList.add(`allow-interactivity-${i}`)}),function(){document.body.classList.remove(`block-interactivity-${i}`),t.forEach(function(e){return e.classList.remove(`allow-interactivity-${i}`)})}}},[e.inert,e.lockRef.current,e.shards]);var s=N.useCallback(function(e,t){if(`touches`in e&&e.touches.length===2||e.type===`wheel`&&e.ctrlKey)return!o.current.allowPinchZoom;var i=Mh(e),a=n.current,s=`deltaX`in e?e.deltaX:a[0]-i[0],c=`deltaY`in e?e.deltaY:a[1]-i[1],l,u=e.target,d=Math.abs(s)>Math.abs(c)?`h`:`v`;if(`touches`in e&&d===`h`&&u.type===`range`)return!1;var f=window.getSelection(),p=f&&f.anchorNode;if(p&&(p===u||p.contains(u)))return!1;var m=Th(d,u);if(!m)return!0;if(m?l=d:(l=d===`v`?`h`:`v`,m=Th(d,u)),!m)return!1;if(!r.current&&`changedTouches`in e&&(s||c)&&(r.current=l),!l)return!0;var h=r.current||l;return jh(h,t,e,h===`h`?s:c,!0)},[]),c=N.useCallback(function(e){var n=e;if(!(!Rh.length||Rh[Rh.length-1]!==a)){var r=`deltaY`in n?Nh(n):Mh(n),i=t.current.filter(function(e){return e.name===n.type&&(e.target===n.target||n.target===e.shadowParent)&&Fh(e.delta,r)})[0];if(i&&i.should){n.cancelable&&n.preventDefault();return}if(!i){var c=(o.current.shards||[]).map(Ph).filter(Boolean).filter(function(e){return e.contains(n.target)});(c.length>0?s(n,c[0]):!o.current.noIsolation)&&n.cancelable&&n.preventDefault()}}},[]),l=N.useCallback(function(e,n,r,i){var a={name:e,delta:n,target:r,should:i,shadowParent:Bh(r)};t.current.push(a),setTimeout(function(){t.current=t.current.filter(function(e){return e!==a})},1)},[]),u=N.useCallback(function(e){n.current=Mh(e),r.current=void 0},[]),d=N.useCallback(function(t){l(t.type,Nh(t),t.target,s(t,e.lockRef.current))},[]),f=N.useCallback(function(t){l(t.type,Mh(t),t.target,s(t,e.lockRef.current))},[]);N.useEffect(function(){return Rh.push(a),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener(`wheel`,c,bh),document.addEventListener(`touchmove`,c,bh),document.addEventListener(`touchstart`,u,bh),function(){Rh=Rh.filter(function(e){return e!==a}),document.removeEventListener(`wheel`,c,bh),document.removeEventListener(`touchmove`,c,bh),document.removeEventListener(`touchstart`,u,bh)}},[]);var p=e.removeScrollBar,m=e.inert;return N.createElement(N.Fragment,null,m?N.createElement(a,{styles:Ih(i)}):null,p?N.createElement(_h,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function Bh(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}var Vh=Xm(Zm,zh),Hh=N.forwardRef(function(e,t){return N.createElement($m,Pm({},e,{ref:t,sideCar:Vh}))});Hh.classNames=$m.classNames;var Uh=function(e){return typeof document>`u`?null:(Array.isArray(e)?e[0]:e).ownerDocument.body},Wh=new WeakMap,Gh=new WeakMap,Kh={},qh=0,Jh=function(e){return e&&(e.host||Jh(e.parentNode))},Yh=function(e,t){return t.map(function(t){if(e.contains(t))return t;var n=Jh(t);return n&&e.contains(n)?n:(console.error(`aria-hidden`,t,`in not contained inside`,e,`. Doing nothing`),null)}).filter(function(e){return!!e})},Xh=function(e,t,n,r){var i=Yh(t,Array.isArray(e)?e:[e]);Kh[n]||(Kh[n]=new WeakMap);var a=Kh[n],o=[],s=new Set,c=new Set(i),l=function(e){!e||s.has(e)||(s.add(e),l(e.parentNode))};i.forEach(l);var u=function(e){!e||c.has(e)||Array.prototype.forEach.call(e.children,function(e){if(s.has(e))u(e);else try{var t=e.getAttribute(r),i=t!==null&&t!==`false`,c=(Wh.get(e)||0)+1,l=(a.get(e)||0)+1;Wh.set(e,c),a.set(e,l),o.push(e),c===1&&i&&Gh.set(e,!0),l===1&&e.setAttribute(n,`true`),i||e.setAttribute(r,`true`)}catch(t){console.error(`aria-hidden: cannot operate on `,e,t)}})};return u(t),s.clear(),qh++,function(){o.forEach(function(e){var t=Wh.get(e)-1,i=a.get(e)-1;Wh.set(e,t),a.set(e,i),t||(Gh.has(e)||e.removeAttribute(r),Gh.delete(e)),i||e.removeAttribute(n)}),qh--,qh||(Wh=new WeakMap,Wh=new WeakMap,Gh=new WeakMap,Kh={})}},Zh=function(e,t,n){n===void 0&&(n=`data-aria-hidden`);var r=Array.from(Array.isArray(e)?e:[e]),i=t||Uh(e);return i?(r.push.apply(r,Array.from(i.querySelectorAll(`[aria-live], script`))),Xh(r,i,n,`aria-hidden`)):function(){return null}},Qh=`Dialog`,[$h,eg]=yp(Qh),[tg,ng]=$h(Qh),rg=e=>{let{__scopeDialog:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!0}=e,s=N.useRef(null),c=N.useRef(null),[l,u]=Ep({prop:r,defaultProp:i??!1,onChange:a,caller:Qh});return(0,P.jsx)(tg,{scope:t,triggerRef:s,contentRef:c,contentId:wp(),titleId:wp(),descriptionId:wp(),open:l,onOpenChange:u,onOpenToggle:N.useCallback(()=>u(e=>!e),[u]),modal:o,children:n})};rg.displayName=Qh;var ig=`DialogTrigger`,ag=N.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=ng(ig,n),a=vp(t,i.triggerRef);return(0,P.jsx)(W.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":Tg(i.open),...r,ref:a,onClick:hp(e.onClick,i.onOpenToggle)})});ag.displayName=ig;var og=`DialogPortal`,[sg,cg]=$h(og,{forceMount:void 0}),lg=e=>{let{__scopeDialog:t,forceMount:n,children:r,container:i}=e,a=ng(og,t);return(0,P.jsx)(sg,{scope:t,forceMount:n,children:N.Children.map(r,e=>(0,P.jsx)(wm,{present:n||a.open,children:(0,P.jsx)(Sm,{asChild:!0,container:i,children:e})}))})};lg.displayName=og;var ug=`DialogOverlay`,dg=N.forwardRef((e,t)=>{let n=cg(ug,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=ng(ug,e.__scopeDialog);return a.modal?(0,P.jsx)(wm,{present:r||a.open,children:(0,P.jsx)(pg,{...i,ref:t})}):null});dg.displayName=ug;var fg=Ap(`DialogOverlay.RemoveScroll`),pg=N.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=ng(ug,n),a=vp(t,em());return(0,P.jsx)(Hh,{as:fg,allowPinchZoom:!0,shards:[i.contentRef],children:(0,P.jsx)(W.div,{"data-state":Tg(i.open),...r,ref:a,style:{pointerEvents:`auto`,...r.style}})})}),mg=`DialogContent`,hg=N.forwardRef((e,t)=>{let n=cg(mg,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=ng(mg,e.__scopeDialog);return(0,P.jsx)(wm,{present:r||a.open,children:a.modal?(0,P.jsx)(gg,{...i,ref:t}):(0,P.jsx)(_g,{...i,ref:t})})});hg.displayName=mg;var gg=N.forwardRef((e,t)=>{let n=ng(mg,e.__scopeDialog),r=N.useRef(null),i=vp(t,n.contentRef,r);return N.useEffect(()=>{let e=r.current;if(e)return Zh(e)},[]),(0,P.jsx)(vg,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,onCloseAutoFocus:hp(e.onCloseAutoFocus,e=>{e.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:hp(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;(t.button===2||n)&&e.preventDefault()}),onFocusOutside:hp(e.onFocusOutside,e=>e.preventDefault())})}),_g=N.forwardRef((e,t)=>{let n=ng(mg,e.__scopeDialog),r=N.useRef(!1),i=N.useRef(!1);return(0,P.jsx)(vg,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})}),vg=N.forwardRef((e,t)=>{let{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,...o}=e,s=ng(mg,n);return Mm(),(0,P.jsx)(P.Fragment,{children:(0,P.jsx)(lm,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,P.jsx)(Zp,{role:`dialog`,id:s.contentId,"aria-describedby":s.descriptionId,"aria-labelledby":s.titleId,"data-state":Tg(s.open),...o,ref:t,deferPointerDownOutside:!0,onDismiss:()=>s.onOpenChange(!1)})})})}),yg=`DialogTitle`,bg=N.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=ng(yg,n);return(0,P.jsx)(W.h2,{id:i.titleId,...r,ref:t})});bg.displayName=yg;var xg=`DialogDescription`,Sg=N.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=ng(xg,n);return(0,P.jsx)(W.p,{id:i.descriptionId,...r,ref:t})});Sg.displayName=xg;var Cg=`DialogClose`,wg=N.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=ng(Cg,n);return(0,P.jsx)(W.button,{type:`button`,...r,ref:t,onClick:hp(e.onClick,()=>i.onOpenChange(!1))})});wg.displayName=Cg;function Tg(e){return e?`open`:`closed`}var Eg=`[cmdk-group=""]`,Dg=`[cmdk-group-items=""]`,Og=`[cmdk-group-heading=""]`,kg=`[cmdk-item=""]`,Ag=`${kg}:not([aria-disabled="true"])`,jg=`cmdk-item-select`,Mg=`data-value`,Ng=(e,t,n)=>mp(e,t,n),Pg=N.createContext(void 0),Fg=()=>N.useContext(Pg),Ig=N.createContext(void 0),Lg=()=>N.useContext(Ig),Rg=N.createContext(void 0),zg=N.forwardRef((e,t)=>{let n=$g(()=>({search:``,value:e.value??e.defaultValue??``,selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}})),r=$g(()=>new Set),i=$g(()=>new Map),a=$g(()=>new Map),o=$g(()=>new Set),s=Zg(e),{label:c,children:l,value:u,onValueChange:d,filter:f,shouldFilter:p,loop:m,disablePointerSelection:h=!1,vimBindings:g=!0,..._}=e,v=wp(),y=wp(),b=wp(),x=N.useRef(null),S=n_();Qg(()=>{if(u!==void 0){let e=u.trim();n.current.value=e,C.emit()}},[u]),Qg(()=>{S(6,O)},[]);let C=N.useMemo(()=>({subscribe:e=>(o.current.add(e),()=>o.current.delete(e)),snapshot:()=>n.current,setState:(e,t,r)=>{var i,a,o;if(!Object.is(n.current[e],t)){if(n.current[e]=t,e===`search`)D(),T(),S(1,E);else if(e===`value`){if(document.activeElement.hasAttribute(`cmdk-input`)||document.activeElement.hasAttribute(`cmdk-root`)){let e=document.getElementById(b);e?e.focus():(i=document.getElementById(v))==null||i.focus()}if(S(7,()=>{n.current.selectedItemId=k()?.id,C.emit()}),r||S(5,O),s.current?.value!==void 0){let e=t??``;(o=(a=s.current).onValueChange)==null||o.call(a,e);return}}C.emit()}},emit:()=>{o.current.forEach(e=>e())}}),[]),w=N.useMemo(()=>({value:(e,t,r)=>{t!==a.current.get(e)?.value&&(a.current.set(e,{value:t,keywords:r}),n.current.filtered.items.set(e,ee(t,r)),S(2,()=>{T(),C.emit()}))},item:(e,t)=>(r.current.add(e),t&&(i.current.has(t)?i.current.get(t).add(e):i.current.set(t,new Set([e]))),S(3,()=>{D(),T(),n.current.value||E(),C.emit()}),()=>{a.current.delete(e),r.current.delete(e),n.current.filtered.items.delete(e);let t=k();S(4,()=>{D(),t?.getAttribute(`id`)===e&&E(),C.emit()})}),group:e=>(i.current.has(e)||i.current.set(e,new Set),()=>{a.current.delete(e),i.current.delete(e)}),filter:()=>s.current.shouldFilter,label:c||e[`aria-label`],getDisablePointerSelection:()=>s.current.disablePointerSelection,listId:v,inputId:b,labelId:y,listInnerRef:x}),[]);function ee(e,t){let r=s.current?.filter??Ng;return e?r(e,n.current.search,t):0}function T(){if(!n.current.search||s.current.shouldFilter===!1)return;let e=n.current.filtered.items,t=[];n.current.filtered.groups.forEach(n=>{let r=i.current.get(n),a=0;r.forEach(t=>{let n=e.get(t);a=Math.max(n,a)}),t.push([n,a])});let r=x.current;te().sort((t,n)=>{let r=t.getAttribute(`id`),i=n.getAttribute(`id`);return(e.get(i)??0)-(e.get(r)??0)}).forEach(e=>{let t=e.closest(Dg);t?t.appendChild(e.parentElement===t?e:e.closest(`${Dg} > *`)):r.appendChild(e.parentElement===r?e:e.closest(`${Dg} > *`))}),t.sort((e,t)=>t[1]-e[1]).forEach(e=>{let t=x.current?.querySelector(`${Eg}[${Mg}="${encodeURIComponent(e[0])}"]`);t?.parentElement.appendChild(t)})}function E(){let e=te().find(e=>e.getAttribute(`aria-disabled`)!==`true`)?.getAttribute(Mg);C.setState(`value`,e||void 0)}function D(){if(!n.current.search||s.current.shouldFilter===!1){n.current.filtered.count=r.current.size;return}n.current.filtered.groups=new Set;let e=0;for(let t of r.current){let r=ee(a.current.get(t)?.value??``,a.current.get(t)?.keywords??[]);n.current.filtered.items.set(t,r),r>0&&e++}for(let[e,t]of i.current)for(let r of t)if(n.current.filtered.items.get(r)>0){n.current.filtered.groups.add(e);break}n.current.filtered.count=e}function O(){var e;let t=k();t&&(t.parentElement?.firstChild===t&&((e=t.closest(Eg)?.querySelector(Og))==null||e.scrollIntoView({block:`nearest`})),t.scrollIntoView({block:`nearest`}))}function k(){return x.current?.querySelector(`${kg}[aria-selected="true"]`)}function te(){return Array.from(x.current?.querySelectorAll(Ag)||[])}function A(e){let t=te()[e];t&&C.setState(`value`,t.getAttribute(Mg))}function ne(e){var t;let n=k(),r=te(),i=r.findIndex(e=>e===n),a=r[i+e];(t=s.current)!=null&&t.loop&&(a=i+e<0?r[r.length-1]:i+e===r.length?r[0]:r[i+e]),a&&C.setState(`value`,a.getAttribute(Mg))}function re(e){let t=k()?.closest(Eg),n;for(;t&&!n;)t=e>0?Yg(t,Eg):Xg(t,Eg),n=t?.querySelector(Ag);n?C.setState(`value`,n.getAttribute(Mg)):ne(e)}let ie=()=>A(te().length-1),j=e=>{e.preventDefault(),e.metaKey?ie():e.altKey?re(1):ne(1)},ae=e=>{e.preventDefault(),e.metaKey?A(0):e.altKey?re(-1):ne(-1)};return N.createElement(W.div,{ref:t,tabIndex:-1,..._,"cmdk-root":``,onKeyDown:e=>{var t;(t=_.onKeyDown)==null||t.call(_,e);let n=e.nativeEvent.isComposing||e.keyCode===229;if(!(e.defaultPrevented||n))switch(e.key){case`n`:case`j`:g&&e.ctrlKey&&j(e);break;case`ArrowDown`:j(e);break;case`p`:case`k`:g&&e.ctrlKey&&ae(e);break;case`ArrowUp`:ae(e);break;case`Home`:e.preventDefault(),A(0);break;case`End`:e.preventDefault(),ie();break;case`Enter`:{e.preventDefault();let t=k();if(t){let e=new Event(jg);t.dispatchEvent(e)}}}}},N.createElement(`label`,{"cmdk-label":``,htmlFor:w.inputId,id:w.labelId,style:a_},c),i_(e,e=>N.createElement(Ig.Provider,{value:C},N.createElement(Pg.Provider,{value:w},e))))}),Bg=N.forwardRef((e,t)=>{let n=wp(),r=N.useRef(null),i=N.useContext(Rg),a=Fg(),o=Zg(e),s=o.current?.forceMount??i?.forceMount;Qg(()=>{if(!s)return a.item(n,i?.id)},[s]);let c=t_(n,r,[e.value,e.children,r],e.keywords),l=Lg(),u=e_(e=>e.value&&e.value===c.current),d=e_(e=>s||a.filter()===!1?!0:e.search?e.filtered.items.get(n)>0:!0);N.useEffect(()=>{let t=r.current;if(!(!t||e.disabled))return t.addEventListener(jg,f),()=>t.removeEventListener(jg,f)},[d,e.onSelect,e.disabled]);function f(){var e,t;p(),(t=(e=o.current).onSelect)==null||t.call(e,c.current)}function p(){l.setState(`value`,c.current,!0)}if(!d)return null;let{disabled:m,value:h,onSelect:g,forceMount:_,keywords:v,...y}=e;return N.createElement(W.div,{ref:_p(r,t),...y,id:n,"cmdk-item":``,role:`option`,"aria-disabled":!!m,"aria-selected":!!u,"data-disabled":!!m,"data-selected":!!u,onPointerMove:m||a.getDisablePointerSelection()?void 0:p,onClick:m?void 0:f},e.children)}),Vg=N.forwardRef((e,t)=>{let{heading:n,children:r,forceMount:i,...a}=e,o=wp(),s=N.useRef(null),c=N.useRef(null),l=wp(),u=Fg(),d=e_(e=>i||u.filter()===!1?!0:e.search?e.filtered.groups.has(o):!0);Qg(()=>u.group(o),[]),t_(o,s,[e.value,e.heading,c]);let f=N.useMemo(()=>({id:o,forceMount:i}),[i]);return N.createElement(W.div,{ref:_p(s,t),...a,"cmdk-group":``,role:`presentation`,hidden:d?void 0:!0},n&&N.createElement(`div`,{ref:c,"cmdk-group-heading":``,"aria-hidden":!0,id:l},n),i_(e,e=>N.createElement(`div`,{"cmdk-group-items":``,role:`group`,"aria-labelledby":n?l:void 0},N.createElement(Rg.Provider,{value:f},e))))}),Hg=N.forwardRef((e,t)=>{let{alwaysRender:n,...r}=e,i=N.useRef(null),a=e_(e=>!e.search);return!n&&!a?null:N.createElement(W.div,{ref:_p(i,t),...r,"cmdk-separator":``,role:`separator`})}),Ug=N.forwardRef((e,t)=>{let{onValueChange:n,...r}=e,i=e.value!=null,a=Lg(),o=e_(e=>e.search),s=e_(e=>e.selectedItemId),c=Fg();return N.useEffect(()=>{e.value!=null&&a.setState(`search`,e.value)},[e.value]),N.createElement(W.input,{ref:t,...r,"cmdk-input":``,autoComplete:`off`,autoCorrect:`off`,spellCheck:!1,"aria-autocomplete":`list`,role:`combobox`,"aria-expanded":!0,"aria-controls":c.listId,"aria-labelledby":c.labelId,"aria-activedescendant":s,id:c.inputId,type:`text`,value:i?e.value:o,onChange:e=>{i||a.setState(`search`,e.target.value),n?.(e.target.value)}})}),Wg=N.forwardRef((e,t)=>{let{children:n,label:r=`Suggestions`,...i}=e,a=N.useRef(null),o=N.useRef(null),s=e_(e=>e.selectedItemId),c=Fg();return N.useEffect(()=>{if(o.current&&a.current){let e=o.current,t=a.current,n,r=new ResizeObserver(()=>{n=requestAnimationFrame(()=>{let n=e.offsetHeight;t.style.setProperty(`--cmdk-list-height`,n.toFixed(1)+`px`)})});return r.observe(e),()=>{cancelAnimationFrame(n),r.unobserve(e)}}},[]),N.createElement(W.div,{ref:_p(a,t),...i,"cmdk-list":``,role:`listbox`,tabIndex:-1,"aria-activedescendant":s,"aria-label":r,id:c.listId},i_(e,e=>N.createElement(`div`,{ref:_p(o,c.listInnerRef),"cmdk-list-sizer":``},e)))}),Gg=N.forwardRef((e,t)=>{let{open:n,onOpenChange:r,overlayClassName:i,contentClassName:a,container:o,...s}=e;return N.createElement(rg,{open:n,onOpenChange:r},N.createElement(lg,{container:o},N.createElement(dg,{"cmdk-overlay":``,className:i}),N.createElement(hg,{"aria-label":e.label,"cmdk-dialog":``,className:a},N.createElement(zg,{ref:t,...s}))))}),Kg=N.forwardRef((e,t)=>e_(e=>e.filtered.count===0)?N.createElement(W.div,{ref:t,...e,"cmdk-empty":``,role:`presentation`}):null),qg=N.forwardRef((e,t)=>{let{progress:n,children:r,label:i=`Loading...`,...a}=e;return N.createElement(W.div,{ref:t,...a,"cmdk-loading":``,role:`progressbar`,"aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":i},i_(e,e=>N.createElement(`div`,{"aria-hidden":!0},e)))}),Jg=Object.assign(zg,{List:Wg,Item:Bg,Input:Ug,Group:Vg,Separator:Hg,Dialog:Gg,Empty:Kg,Loading:qg});function Yg(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function Xg(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function Zg(e){let t=N.useRef(e);return Qg(()=>{t.current=e}),t}var Qg=typeof window>`u`?N.useEffect:N.useLayoutEffect;function $g(e){let t=N.useRef();return t.current===void 0&&(t.current=e()),t}function e_(e){let t=Lg(),n=()=>e(t.snapshot());return N.useSyncExternalStore(t.subscribe,n,n)}function t_(e,t,n,r=[]){let i=N.useRef(),a=Fg();return Qg(()=>{var o;let s=(()=>{for(let e of n){if(typeof e==`string`)return e.trim();if(typeof e==`object`&&`current`in e)return e.current?e.current.textContent?.trim():i.current}})(),c=r.map(e=>e.trim());a.value(e,s,c),(o=t.current)==null||o.setAttribute(Mg,s),i.current=s}),i}var n_=()=>{let[e,t]=N.useState(),n=$g(()=>new Map);return Qg(()=>{n.current.forEach(e=>e()),n.current=new Map},[e]),(e,r)=>{n.current.set(e,r),t({})}};function r_(e){let t=e.type;return typeof t==`function`?t(e.props):`render`in t?t.render(e.props):e}function i_({asChild:e,children:t},n){return e&&N.isValidElement(t)?N.cloneElement(r_(t),{ref:t.ref},n(t.props.children)):n(t)}var a_={position:`absolute`,width:`1px`,height:`1px`,padding:`0`,margin:`-1px`,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,borderWidth:`0`};function o_({className:e,...t}){return(0,P.jsx)(Jg,{"data-slot":`command`,className:l(`flex size-full flex-col overflow-hidden rounded-xl! bg-popover p-1 text-popover-foreground`,e),...t})}function s_({className:e,...t}){return(0,P.jsx)(`div`,{"data-slot":`command-input-wrapper`,className:`p-1 pb-0`,children:(0,P.jsxs)(ue,{className:`h-8! rounded-lg! border-input/30 bg-input/30 shadow-none! *:data-[slot=input-group-addon]:pl-2!`,children:[(0,P.jsx)(Jg.Input,{"data-slot":`command-input`,className:l(`w-full text-sm outline-hidden disabled:cursor-not-allowed disabled:opacity-50`,e),...t}),(0,P.jsx)(pe,{children:(0,P.jsx)(ye,{className:`size-4 shrink-0 opacity-50`})})]})})}function c_({className:e,...t}){return(0,P.jsx)(Jg.List,{"data-slot":`command-list`,className:l(`no-scrollbar max-h-72 scroll-py-1 overflow-x-hidden overflow-y-auto outline-none`,e),...t})}function l_({className:e,...t}){return(0,P.jsx)(Jg.Empty,{"data-slot":`command-empty`,className:l(`py-6 text-center text-sm`,e),...t})}function u_({className:e,...t}){return(0,P.jsx)(Jg.Group,{"data-slot":`command-group`,className:l(`overflow-hidden p-1 text-foreground **:[[cmdk-group-heading]]:px-2 **:[[cmdk-group-heading]]:py-1.5 **:[[cmdk-group-heading]]:text-xs **:[[cmdk-group-heading]]:font-medium **:[[cmdk-group-heading]]:text-muted-foreground`,e),...t})}function d_({className:e,children:t,...n}){return(0,P.jsxs)(Jg.Item,{"data-slot":`command-item`,className:l(`group/command-item relative flex cursor-pointer items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none in-data-[slot=dialog-content]:rounded-lg! data-[disabled=true]:pointer-events-none data-[disabled=true]:cursor-not-allowed data-[disabled=true]:opacity-50 data-selected:bg-muted data-selected:text-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 data-selected:*:[svg]:text-foreground`,e),...n,children:[t,(0,P.jsx)(Se,{className:`ml-auto opacity-0 group-has-data-[slot=command-shortcut]/command-item:hidden group-data-[checked=true]/command-item:opacity-100`})]})}var f_=async e=>{try{let t=await(await fetch(e)).blob();return new Promise(e=>{let n=new FileReader;n.onloadend=()=>e(n.result),n.onerror=()=>e(null),n.readAsDataURL(t)})}catch{return null}},p_=async e=>await new Promise(t=>{let n=new FileReader;n.onloadend=()=>t(n.result??null),n.onerror=()=>t(null),n.readAsDataURL(e)}),m_=(0,N.createContext)(null),h_=(0,N.createContext)(null),g_=()=>{let e=(0,N.useContext)(m_);if(!e)throw Error(`Wrap your component inside <PromptInputProvider> to use usePromptInputController().`);return e},__=()=>(0,N.useContext)(m_),v_=()=>(0,N.useContext)(h_),y_=({initialInput:e=``,children:t})=>{let[n,r]=(0,N.useState)(e),i=(0,N.useCallback)(()=>r(``),[]),[a,o]=(0,N.useState)([]),s=(0,N.useRef)(null),c=(0,N.useRef)(()=>{}),l=(0,N.useCallback)(e=>{let t=[...e];t.length!==0&&o(e=>[...e,...t.map(e=>({filename:e.name,id:St(),mediaType:e.type,rawFile:e,type:`file`,url:URL.createObjectURL(e)}))])},[]),u=(0,N.useCallback)(e=>{o(t=>{let n=t.find(t=>t.id===e);return n?.url&&URL.revokeObjectURL(n.url),t.filter(t=>t.id!==e)})},[]),d=(0,N.useCallback)(()=>{o(e=>{for(let t of e)t.url&&URL.revokeObjectURL(t.url);return[]})},[]),f=(0,N.useRef)(a);(0,N.useEffect)(()=>{f.current=a},[a]),(0,N.useEffect)(()=>()=>{for(let e of f.current)e.url&&URL.revokeObjectURL(e.url)},[]);let p=(0,N.useCallback)(()=>{c.current?.()},[]),m=(0,N.useMemo)(()=>({add:l,clear:d,fileInputRef:s,files:a,openFileDialog:p,remove:u}),[a,l,u,d,p]),h=(0,N.useCallback)((e,t)=>{s.current=e.current,c.current=t},[]),g=(0,N.useMemo)(()=>({__registerFileInput:h,attachments:m,textInput:{clear:i,setInput:r,value:n}}),[n,i,m,h]);return(0,P.jsx)(m_.Provider,{value:g,children:(0,P.jsx)(h_.Provider,{value:m,children:t})})},b_=(0,N.createContext)(null),x_=()=>{let e=v_(),t=(0,N.useContext)(b_)??e;if(!t)throw Error(`usePromptInputAttachments must be used within a PromptInput or PromptInputProvider`);return t},S_=(0,N.createContext)(null),C_=({className:e,accept:t,multiple:n,globalDrop:r,syncHiddenInput:i,maxFiles:a,maxFileSize:o,onError:s,onSubmit:c,children:u,...d})=>{let f=__(),p=!!f,m=(0,N.useRef)(null),h=(0,N.useRef)(null),[g,_]=(0,N.useState)([]),v=p?f.attachments.files:g,[y,b]=(0,N.useState)([]),x=(0,N.useRef)(v);(0,N.useEffect)(()=>{x.current=v},[v]);let S=(0,N.useCallback)(()=>{m.current?.click()},[]),C=(0,N.useCallback)(e=>!t||t.trim()===``?!0:t.split(`,`).map(e=>e.trim()).filter(Boolean).some(t=>{if(t.endsWith(`/*`)){let n=t.slice(0,-1);return e.type.startsWith(n)}return e.type===t}),[t]),w=(0,N.useCallback)(e=>{let t=[...e],n=t.filter(e=>C(e));if(t.length&&n.length===0){s?.({code:`accept`,message:`No files match the accepted types.`});return}let r=n.filter(e=>o?e.size<=o:!0);if(n.length>0&&r.length===0){s?.({code:`max_file_size`,message:`All files exceed the maximum size.`});return}_(e=>{let t=typeof a==`number`?Math.max(0,a-e.length):void 0,n=typeof t==`number`?r.slice(0,t):r;typeof t==`number`&&r.length>t&&s?.({code:`max_files`,message:`Too many files. Some were not added.`});let i=[];for(let e of n)i.push({filename:e.name,id:St(),mediaType:e.type,rawFile:e,type:`file`,url:URL.createObjectURL(e)});return[...e,...i]})},[C,a,o,s]),ee=(0,N.useCallback)(e=>_(t=>{let n=t.find(t=>t.id===e);return n?.url&&URL.revokeObjectURL(n.url),t.filter(t=>t.id!==e)}),[]),T=(0,N.useCallback)(e=>{let t=[...e],n=t.filter(e=>C(e));if(t.length&&n.length===0){s?.({code:`accept`,message:`No files match the accepted types.`});return}let r=n.filter(e=>o?e.size<=o:!0);if(n.length>0&&r.length===0){s?.({code:`max_file_size`,message:`All files exceed the maximum size.`});return}let i=v.length,c=typeof a==`number`?Math.max(0,a-i):void 0,l=typeof c==`number`?r.slice(0,c):r;typeof c==`number`&&r.length>c&&s?.({code:`max_files`,message:`Too many files. Some were not added.`}),l.length>0&&f?.attachments.add(l)},[C,o,a,s,v.length,f]),E=(0,N.useCallback)(()=>p?f?.attachments.clear():_(e=>{for(let t of e)t.url&&URL.revokeObjectURL(t.url);return[]}),[p,f]),D=(0,N.useCallback)(()=>b([]),[]),O=p?T:w,k=p?f.attachments.remove:ee,te=p?f.attachments.openFileDialog:S,A=(0,N.useCallback)(()=>{E(),D()},[E,D]);(0,N.useEffect)(()=>{p&&f.__registerFileInput(m,()=>m.current?.click())},[p,f]),(0,N.useEffect)(()=>{i&&m.current&&v.length===0&&(m.current.value=``)},[v,i]),(0,N.useEffect)(()=>{let e=h.current;if(!e||r)return;let t=e=>{e.dataTransfer?.types?.includes(`Files`)&&e.preventDefault()},n=e=>{e.dataTransfer?.types?.includes(`Files`)&&e.preventDefault(),e.dataTransfer?.files&&e.dataTransfer.files.length>0&&O(e.dataTransfer.files)};return e.addEventListener(`dragover`,t),e.addEventListener(`drop`,n),()=>{e.removeEventListener(`dragover`,t),e.removeEventListener(`drop`,n)}},[O,r]),(0,N.useEffect)(()=>{if(!r)return;let e=e=>{e.dataTransfer?.types?.includes(`Files`)&&e.preventDefault()},t=e=>{e.dataTransfer?.types?.includes(`Files`)&&e.preventDefault(),e.dataTransfer?.files&&e.dataTransfer.files.length>0&&O(e.dataTransfer.files)};return document.addEventListener(`dragover`,e),document.addEventListener(`drop`,t),()=>{document.removeEventListener(`dragover`,e),document.removeEventListener(`drop`,t)}},[O,r]),(0,N.useEffect)(()=>()=>{if(!p)for(let e of x.current)e.url&&URL.revokeObjectURL(e.url)},[p]);let ne=(0,N.useCallback)(e=>{e.currentTarget.files&&O(e.currentTarget.files),e.currentTarget.value=``},[O]),re=(0,N.useMemo)(()=>({add:O,clear:E,fileInputRef:m,files:v.map(e=>({...e,id:e.id})),openFileDialog:te,remove:k}),[v,O,k,E,te]),ie=(0,N.useMemo)(()=>({add:e=>{let t=Array.isArray(e)?e:[e];b(e=>[...e,...t.map(e=>({...e,id:St()}))])},clear:D,remove:e=>{b(t=>t.filter(t=>t.id!==e))},sources:y}),[y,D]),j=(0,N.useCallback)(async e=>{e.preventDefault();let t=e.currentTarget,n=p?f.textInput.value:new FormData(t).get(`message`)||``;p||t.reset();try{let t=c({files:await Promise.all(v.map(async({id:e,rawFile:t,...n})=>{if(t){let e=await p_(t);return{...n,url:e??n.url}}if(n.url?.startsWith(`blob:`)){let e=await f_(n.url);return{...n,url:e??n.url}}return n})),text:n},e);if(t instanceof Promise)try{await t,A(),p&&f.textInput.clear()}catch{}else A(),p&&f.textInput.clear()}catch{}},[p,f,v,c,A]),ae=(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(`input`,{accept:t,"aria-label":`Upload files`,className:`hidden`,multiple:n,onChange:ne,ref:m,title:`Upload files`,type:`file`}),(0,P.jsx)(`form`,{className:l(`w-full`,e),onSubmit:j,ref:h,...d,children:(0,P.jsx)(ue,{className:`overflow-hidden`,children:u})})]}),oe=(0,P.jsx)(S_.Provider,{value:ie,children:ae});return(0,P.jsx)(b_.Provider,{value:re,children:oe})},w_=({className:e,...t})=>(0,P.jsx)(`div`,{className:l(`contents`,e),...t}),T_=({onChange:e,onKeyDown:t,className:n,placeholder:r=`How can I help you?`,...i})=>{let a=__(),o=x_(),[s,c]=(0,N.useState)(!1),u=(0,N.useCallback)(e=>{if(t?.(e),!e.defaultPrevented){if(e.key===`Enter`){if(s||e.nativeEvent.isComposing||e.shiftKey)return;e.preventDefault();let{form:t}=e.currentTarget;if(t?.querySelector(`button[type="submit"]`)?.disabled)return;t?.requestSubmit()}if(e.key===`Backspace`&&e.currentTarget.value===``&&o.files.length>0){e.preventDefault();let t=o.files.at(-1);t&&o.remove(t.id)}}},[t,s,o]),d=(0,N.useCallback)(e=>{let t=e.clipboardData?.items;if(!t)return;let n=[];for(let e of t)if(e.kind===`file`){let t=e.getAsFile();t&&n.push(t)}n.length>0&&(e.preventDefault(),o.add(n))},[o]),f=(0,N.useCallback)(()=>c(!1),[]),p=(0,N.useCallback)(()=>c(!0),[]),m=a?{onChange:t=>{a.textInput.setInput(t.currentTarget.value),e?.(t)},value:a.textInput.value}:{onChange:e};return(0,P.jsx)(de,{className:l(`field-sizing-content max-h-48 min-h-16`,n),name:`message`,onCompositionEnd:f,onCompositionStart:p,onKeyDown:u,onPaste:d,placeholder:r,...i,...m})},E_=({className:e,...t})=>(0,P.jsx)(pe,{align:`block-end`,className:l(`order-first flex-wrap gap-1`,e),...t}),D_=({className:e,...t})=>(0,P.jsx)(pe,{align:`block-end`,className:l(`justify-between gap-1`,e),...t}),O_=({className:e,...t})=>(0,P.jsx)(`div`,{className:l(`flex min-w-0 items-center gap-1`,e),...t}),k_=({variant:e=`ghost`,className:t,size:n,tooltip:r,...i})=>{let a=n??(N.Children.count(i.children)>1?`sm`:`icon-sm`),o=(0,P.jsx)(oe,{className:l(t),size:a,type:`button`,variant:e,...i});if(!r)return o;let s=typeof r==`string`?r:r.content,c=typeof r==`string`?void 0:r.shortcut,u=typeof r==`string`?`top`:r.side??`top`;return(0,P.jsxs)(Pe,{children:[(0,P.jsx)(De,{children:o}),(0,P.jsxs)(Ce,{side:u,children:[s,c&&(0,P.jsx)(`span`,{className:`ml-2 text-muted-foreground`,children:c})]})]})},A_=({className:e,variant:t=`default`,size:n=`icon-sm`,status:r,onStop:i,onClick:a,children:o,...s})=>{let c=r===`submitted`||r===`streaming`,u=(0,P.jsx)(at,{className:`size-3`});r===`submitted`?u=(0,P.jsx)(Le,{}):r===`streaming`?u=(0,P.jsx)(_t,{className:`size-3`}):r===`error`&&(u=(0,P.jsx)(se,{className:`size-3`}));let d=(0,N.useCallback)(e=>{if(c&&i){e.preventDefault(),i();return}a?.(e)},[c,i,a]);return(0,P.jsx)(oe,{"aria-label":c?`Stop`:`Submit`,className:l(e),onClick:d,size:n,type:c&&i?`button`:`submit`,variant:t,...s,children:o??u})};function j_(e){let{open:t,defaultOpen:n,onOpenChange:r,disabled:i}=e,[a,o]=w({controlled:t,default:n,name:`Collapsible`,state:`open`}),{mounted:c,setMounted:l,transitionStatus:f}=Ae(a,!0,!0),p=d(),[m,h]=N.useState(),_=m??p,v=u(e=>{let t=!a,n=s(g,e.nativeEvent);r(t,n),!n.isCanceled&&o(t)});return N.useMemo(()=>({disabled:i,handleTrigger:v,mounted:c,open:a,panelId:_,setMounted:l,setOpen:o,setPanelIdState:h,transitionStatus:f}),[i,v,c,a,_,l,o,h,f])}var M_=N.createContext(void 0);function N_(){let e=N.useContext(M_);if(e===void 0)throw Error(c(15));return e}var P_=function(e){return e.open=`data-open`,e.closed=`data-closed`,e[e.startingStyle=Fe.startingStyle]=`startingStyle`,e[e.endingStyle=Fe.endingStyle]=`endingStyle`,e}({}),F_=function(e){return e.panelOpen=`data-panel-open`,e}({}),I_={[P_.open]:``},L_={[P_.closed]:``},R_={open(e){return e?{[F_.panelOpen]:``}:null}},z_={open(e){return e?I_:L_},...ke},B_=N.forwardRef(function(e,t){let{render:n,className:r,defaultOpen:i=!1,disabled:a=!1,onOpenChange:o,open:s,style:c,...l}=e,d=u(o),f=j_({open:s,defaultOpen:i,onOpenChange:d,disabled:a}),p=N.useMemo(()=>({open:f.open,disabled:f.disabled,transitionStatus:f.transitionStatus}),[f.open,f.disabled,f.transitionStatus]),m=N.useMemo(()=>({...f,onOpenChange:d,state:p}),[f,d,p]),h=x(`div`,e,{state:p,ref:t,props:l,stateAttributesMapping:z_});return(0,P.jsx)(M_.Provider,{value:m,children:h})}),V_={...R_,...ke},H_=N.forwardRef(function(e,t){let{panelId:n,open:r,handleTrigger:i,state:a,disabled:o}=N_(),{className:s,disabled:c=o,render:l,nativeButton:u=!0,style:d,...f}=e,{getButtonProps:m,buttonRef:h}=p({disabled:c,focusableWhenDisabled:!0,native:u});return x(`button`,e,{state:a,ref:[t,h],props:[{"aria-controls":r?n:void 0,"aria-expanded":r,onClick:i},f,m],stateAttributesMapping:V_})}),U_={height:void 0,width:void 0};function W_(e){let{externalRef:t,hiddenUntilFound:n,id:r,keepMounted:i,mounted:a,onOpenChange:o,open:c,setMounted:l,setOpen:d,transitionStatus:p}=e,m=N.useRef(null),g=N.useRef(null),[_,v]=N.useState(U_),b=N.useRef(U_),x=N.useRef(!1),S=N.useRef(c),C=N.useRef(!1),[w,ee]=N.useState(!1),T=N.useRef(null),E=f(t,m),O=je({mounted:a,open:c}),k=Ne(m,!1,!1),te=!c&&!a,A=w?`idle`:p,ne=c&&(S.current||C.current),re=!c&&a&&g.current===`css-animation`&&_.height===void 0&&_.width===void 0?b.current:_,ie=n&&te&&g.current!==`css-animation`,j=u((e,t=!0)=>{t&&(b.current=e),v(e)}),ae=u(()=>{T.current?.(),T.current=null}),oe=u(e=>{ae(),T.current=()=>{T.current=null,e()}}),se=u(()=>{c&&a&&g.current===`css-animation`&&(C.current=!0)});h(()=>{!w||p===`starting`||ee(!1)},[w,p]),N.useEffect(()=>()=>{se(),ae()},[se,ae]),h(()=>{let e=m.current;if(!e)return;!c&&T.current&&ae();let t=K_(e,ne);if(g.current=t,c&&p===`idle`&&S.current&&t===`css-animation`){b.current=G_(e);return}if(c&&p===`starting`){let n=x.current;if(x.current=!1,t===`none`){j(G_(e)),ee(!0);return}if(t===`css-transition`){let t=Y_(e);return j(G_(e)),n?(oe(J_(e,`transition-duration`,`0s`)),ee(!0),t):t}if(t===`css-animation`){if(j(G_(e)),!n){J_(e,`animation-name`,`none`)();return}let t=J_(e,`animation-name`,`none`),r=J_(e,`animation-duration`,`0s`);t(),oe(r),ee(!0);return}}if(!c&&a&&(p===`idle`||p===`starting`)){if(S.current=!1,C.current=!1,t===`none`){j(U_,!1),l(!1);return}j(G_(e));return}if(p!==`ending`)return;if(t===`none`){l(!1);return}let n=G_(e);if(!((n.height??0)>0||(n.width??0)>0)){l(!1);return}j(n),t===`css-animation`&&J_(e,`animation-name`,`none`)()},[a,c,ae,j,l,oe,ne,p]),Oe({enabled:c&&a&&A===`idle`,open:!0,ref:m,onComplete(){c&&j(U_,!1)}}),N.useEffect(()=>{if(c||!a||A!==`ending`||!m.current)return;let e=new AbortController,t=-1;function n(){O.current.open||(l(!1),j(U_,!1))}return t=xe.request(()=>{e.signal.aborted||k(n,e.signal)}),()=>{xe.cancel(t),e.abort()}},[O,a,c,A,k,j,l]),h(()=>{let e=m.current;!e||!n||!te||e.setAttribute(`hidden`,`until-found`)},[te,n]),N.useEffect(function(){let e=m.current;if(!e)return;function t(e){let t=s(y,e);o(!0,t),!t.isCanceled&&(x.current=!0,d(!0))}return D(e,`beforematch`,t)},[o,d]);let ce=i||n||a||c;return{height:re.height,props:{...ie?{[P_.startingStyle]:``}:void 0,hidden:te,id:r},ref:E,shouldPreventOpenAnimation:ne,shouldRender:ce,transitionStatus:A,width:re.width}}function G_(e){return{height:e.scrollHeight,width:e.scrollWidth}}function K_(e,t=!1){let n=T(e).getComputedStyle(e),r=(n.animationName.split(`,`).map(e=>e.trim()).some(e=>e!==``&&e!==`none`)||t)&&q_(n.animationDuration),i=q_(n.transitionDuration);return r&&i||i?`css-transition`:r?`css-animation`:`none`}function q_(e){return e.split(`,`).map(e=>e.trim()).some(e=>e!==``&&Number.parseFloat(e)>0)}function J_(e,t,n){let r=e.style.getPropertyValue(t),i=e.style.getPropertyPriority(t);return e.style.setProperty(t,n),()=>{if(r===``){e.style.removeProperty(t);return}e.style.setProperty(t,r,i)}}function Y_(e){let t={"justify-content":e.style.justifyContent,"align-items":e.style.alignItems,"align-content":e.style.alignContent,"justify-items":e.style.justifyItems};Object.keys(t).forEach(t=>{e.style.setProperty(t,`initial`,`important`)});function n(){Object.entries(t).forEach(([t,n])=>{if(n===``){e.style.removeProperty(t);return}e.style.setProperty(t,n)})}let r=xe.request(n);return()=>{xe.cancel(r),n()}}var X_=function(e){return e.collapsiblePanelHeight=`--collapsible-panel-height`,e.collapsiblePanelWidth=`--collapsible-panel-width`,e}({}),Z_=N.forwardRef(function(e,t){let{className:n,hiddenUntilFound:r,keepMounted:i,render:a,id:o,style:s,...c}=e,{mounted:l,onOpenChange:u,open:d,panelId:f,setMounted:p,setPanelIdState:m,setOpen:g,state:_,transitionStatus:v}=N_(),y=r??!1,S=i??!1;h(()=>{if(o)return m(o),()=>{m(void 0)}},[o,m]);let{height:C,props:w,ref:ee,shouldPreventOpenAnimation:T,shouldRender:E,transitionStatus:D,width:O}=W_({externalRef:t,hiddenUntilFound:y,id:f,keepMounted:S,mounted:l,onOpenChange:u,open:d,setMounted:p,setOpen:g,transitionStatus:v}),k={..._,transitionStatus:D},te=b(s,k),A=x(`div`,{...e,style:void 0},{state:k,ref:ee,props:[w,{style:{[X_.collapsiblePanelHeight]:C===void 0?`auto`:`${C}px`,[X_.collapsiblePanelWidth]:O===void 0?`auto`:`${O}px`}},c,te?{style:te}:void 0,T?{style:{animationName:`none`}}:void 0],stateAttributesMapping:z_});return E?A:null});function Q_({...e}){return(0,P.jsx)(B_,{"data-slot":`collapsible`,...e})}function $_({...e}){return(0,P.jsx)(H_,{"data-slot":`collapsible-trigger`,...e})}function ev({...e}){return(0,P.jsx)(Z_,{"data-slot":`collapsible-content`,...e})}var tv=(0,N.createContext)({});function nv(e){let t=(0,N.useRef)(null);return t.current===null&&(t.current=e()),t.current}var rv=typeof window<`u`?N.useLayoutEffect:N.useEffect,iv=(0,N.createContext)(null);function av(e,t){e.indexOf(t)===-1&&e.push(t)}function ov(e,t){let n=e.indexOf(t);n>-1&&e.splice(n,1)}var sv=(e,t,n)=>n>t?t:n<e?e:n,cv={},lv=e=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e),uv=e=>typeof e==`object`&&!!e,dv=e=>/^0[^.\s]+$/u.test(e);function fv(e){let t;return()=>(t===void 0&&(t=e()),t)}var pv=e=>e,mv=(...e)=>e.reduce((e,t)=>n=>t(e(n))),hv=(e,t,n)=>{let r=t-e;return r?(n-e)/r:1},gv=class{constructor(){this.subscriptions=[]}add(e){return av(this.subscriptions,e),()=>ov(this.subscriptions,e)}notify(e,t,n){let r=this.subscriptions.length;if(r)if(r===1)this.subscriptions[0](e,t,n);else for(let i=0;i<r;i++){let r=this.subscriptions[i];r&&r(e,t,n)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}},_v=e=>e*1e3,vv=e=>e/1e3,yv=(e,t)=>t?1e3/t*e:0,bv=(e,t,n)=>(((1-3*n+3*t)*e+(3*n-6*t))*e+3*t)*e,xv=1e-7,Sv=12;function Cv(e,t,n,r,i){let a,o,s=0;do o=t+(n-t)/2,a=bv(o,r,i)-e,a>0?n=o:t=o;while(Math.abs(a)>xv&&++s<Sv);return o}function wv(e,t,n,r){if(e===t&&n===r)return pv;let i=t=>Cv(t,0,1,e,n);return e=>e===0||e===1?e:bv(i(e),t,r)}var Tv=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,Ev=e=>t=>1-e(1-t),Dv=wv(.33,1.53,.69,.99),Ov=Ev(Dv),kv=Tv(Ov),Av=e=>e>=1?1:(e*=2)<1?.5*Ov(e):.5*(2-2**(-10*(e-1))),jv=e=>1-Math.sin(Math.acos(e)),Mv=Ev(jv),Nv=Tv(jv),Pv=wv(.42,0,1,1),Fv=wv(0,0,.58,1),Iv=wv(.42,0,.58,1),Lv=e=>Array.isArray(e)&&typeof e[0]!=`number`,Rv=e=>Array.isArray(e)&&typeof e[0]==`number`,zv={linear:pv,easeIn:Pv,easeInOut:Iv,easeOut:Fv,circIn:jv,circInOut:Nv,circOut:Mv,backIn:Ov,backInOut:kv,backOut:Dv,anticipate:Av},Bv=e=>typeof e==`string`,Vv=e=>{if(Rv(e)){e.length;let[t,n,r,i]=e;return wv(t,n,r,i)}else if(Bv(e))return zv[e],`${e}`,zv[e];return e},Hv=[`setup`,`read`,`resolveKeyframes`,`preUpdate`,`update`,`preRender`,`render`,`postRender`],Uv={value:null,addProjectionMetrics:null};function Wv(e,t){let n=new Set,r=new Set,i=!1,a=!1,o=new WeakSet,s={delta:0,timestamp:0,isProcessing:!1},c=0;function l(t){o.has(t)&&(u.schedule(t),e()),c++,t(s)}let u={schedule:(e,t=!1,a=!1)=>{let s=a&&i?n:r;return t&&o.add(e),s.add(e),e},cancel:e=>{r.delete(e),o.delete(e)},process:e=>{if(s=e,i){a=!0;return}i=!0;let o=n;n=r,r=o,n.forEach(l),t&&Uv.value&&Uv.value.frameloop[t].push(c),c=0,n.clear(),i=!1,a&&(a=!1,u.process(e))}};return u}var Gv=40;function Kv(e,t){let n=!1,r=!0,i={delta:0,timestamp:0,isProcessing:!1},a=()=>n=!0,o=Hv.reduce((e,n)=>(e[n]=Wv(a,t?n:void 0),e),{}),{setup:s,read:c,resolveKeyframes:l,preUpdate:u,update:d,preRender:f,render:p,postRender:m}=o,h=()=>{let a=cv.useManualTiming,o=a?i.timestamp:performance.now();n=!1,a||(i.delta=r?1e3/60:Math.max(Math.min(o-i.timestamp,Gv),1)),i.timestamp=o,i.isProcessing=!0,s.process(i),c.process(i),l.process(i),u.process(i),d.process(i),f.process(i),p.process(i),m.process(i),i.isProcessing=!1,n&&t&&(r=!1,e(h))},g=()=>{n=!0,r=!0,i.isProcessing||e(h)};return{schedule:Hv.reduce((e,t)=>{let r=o[t];return e[t]=(e,t=!1,i=!1)=>(n||g(),r.schedule(e,t,i)),e},{}),cancel:e=>{for(let t=0;t<Hv.length;t++)o[Hv[t]].cancel(e)},state:i,steps:o}}var{schedule:G,cancel:qv,state:K,steps:Jv}=Kv(typeof requestAnimationFrame<`u`?requestAnimationFrame:pv,!0),Yv;function Xv(){Yv=void 0}var Zv={now:()=>(Yv===void 0&&Zv.set(K.isProcessing||cv.useManualTiming?K.timestamp:performance.now()),Yv),set:e=>{Yv=e,queueMicrotask(Xv)}},Qv={layout:0,mainThread:0,waapi:0},$v=e=>t=>typeof t==`string`&&t.startsWith(e),ey=$v(`--`),ty=$v(`var(--`),ny=e=>ty(e)?ry.test(e.split(`/*`)[0].trim()):!1,ry=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function iy(e){return typeof e==`string`?e.split(`/*`)[0].includes(`var(--`):!1}var ay={test:e=>typeof e==`number`,parse:parseFloat,transform:e=>e},oy={...ay,transform:e=>sv(0,1,e)},sy={...ay,default:1},cy=e=>Math.round(e*1e5)/1e5,ly=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function uy(e){return e==null}var dy=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,fy=(e,t)=>n=>!!(typeof n==`string`&&dy.test(n)&&n.startsWith(e)||t&&!uy(n)&&Object.prototype.hasOwnProperty.call(n,t)),py=(e,t,n)=>r=>{if(typeof r!=`string`)return r;let[i,a,o,s]=r.match(ly);return{[e]:parseFloat(i),[t]:parseFloat(a),[n]:parseFloat(o),alpha:s===void 0?1:parseFloat(s)}},my=e=>sv(0,255,e),hy={...ay,transform:e=>Math.round(my(e))},gy={test:fy(`rgb`,`red`),parse:py(`red`,`green`,`blue`),transform:({red:e,green:t,blue:n,alpha:r=1})=>`rgba(`+hy.transform(e)+`, `+hy.transform(t)+`, `+hy.transform(n)+`, `+cy(oy.transform(r))+`)`};function _y(e){let t=``,n=``,r=``,i=``;return e.length>5?(t=e.substring(1,3),n=e.substring(3,5),r=e.substring(5,7),i=e.substring(7,9)):(t=e.substring(1,2),n=e.substring(2,3),r=e.substring(3,4),i=e.substring(4,5),t+=t,n+=n,r+=r,i+=i),{red:parseInt(t,16),green:parseInt(n,16),blue:parseInt(r,16),alpha:i?parseInt(i,16)/255:1}}var vy={test:fy(`#`),parse:_y,transform:gy.transform},yy=e=>({test:t=>typeof t==`string`&&t.endsWith(e)&&t.split(` `).length===1,parse:parseFloat,transform:t=>`${t}${e}`}),by=yy(`deg`),xy=yy(`%`),q=yy(`px`),Sy=yy(`vh`),Cy=yy(`vw`),wy={...xy,parse:e=>xy.parse(e)/100,transform:e=>xy.transform(e*100)},Ty={test:fy(`hsl`,`hue`),parse:py(`hue`,`saturation`,`lightness`),transform:({hue:e,saturation:t,lightness:n,alpha:r=1})=>`hsla(`+Math.round(e)+`, `+xy.transform(cy(t))+`, `+xy.transform(cy(n))+`, `+cy(oy.transform(r))+`)`},J={test:e=>gy.test(e)||vy.test(e)||Ty.test(e),parse:e=>gy.test(e)?gy.parse(e):Ty.test(e)?Ty.parse(e):vy.parse(e),transform:e=>typeof e==`string`?e:e.hasOwnProperty(`red`)?gy.transform(e):Ty.transform(e),getAnimatableNone:e=>{let t=J.parse(e);return t.alpha=0,J.transform(t)}},Ey=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function Dy(e){return isNaN(e)&&typeof e==`string`&&(e.match(ly)?.length||0)+(e.match(Ey)?.length||0)>0}var Oy=`number`,ky=`color`,Ay=`var`,jy=`var(`,My="${}",Ny=/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 Py(e){let t=e.toString(),n=[],r={color:[],number:[],var:[]},i=[],a=0;return{values:n,split:t.replace(Ny,e=>(J.test(e)?(r.color.push(a),i.push(ky),n.push(J.parse(e))):e.startsWith(jy)?(r.var.push(a),i.push(Ay),n.push(e)):(r.number.push(a),i.push(Oy),n.push(parseFloat(e))),++a,My)).split(My),indexes:r,types:i}}function Fy(e){return Py(e).values}function Iy({split:e,types:t}){let n=e.length;return r=>{let i=``;for(let a=0;a<n;a++)if(i+=e[a],r[a]!==void 0){let e=t[a];e===Oy?i+=cy(r[a]):e===ky?i+=J.transform(r[a]):i+=r[a]}return i}}function Ly(e){return Iy(Py(e))}var Ry=e=>typeof e==`number`?0:J.test(e)?J.getAnimatableNone(e):e,zy=(e,t)=>typeof e==`number`?t?.trim().endsWith(`/`)?e:0:Ry(e);function By(e){let t=Py(e);return Iy(t)(t.values.map((e,n)=>zy(e,t.split[n])))}var Vy={test:Dy,parse:Fy,createTransformer:Ly,getAnimatableNone:By};function Hy(e,t,n){return n<0&&(n+=1),n>1&&--n,n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e}function Uy({hue:e,saturation:t,lightness:n,alpha:r}){e/=360,t/=100,n/=100;let i=0,a=0,o=0;if(!t)i=a=o=n;else{let r=n<.5?n*(1+t):n+t-n*t,s=2*n-r;i=Hy(s,r,e+1/3),a=Hy(s,r,e),o=Hy(s,r,e-1/3)}return{red:Math.round(i*255),green:Math.round(a*255),blue:Math.round(o*255),alpha:r}}function Wy(e,t){return n=>n>0?t:e}var Y=(e,t,n)=>e+(t-e)*n,Gy=(e,t,n)=>{let r=e*e,i=n*(t*t-r)+r;return i<0?0:Math.sqrt(i)},Ky=[vy,gy,Ty],qy=e=>Ky.find(t=>t.test(e));function Jy(e){let t=qy(e);if(`${e}`,!t)return!1;let n=t.parse(e);return t===Ty&&(n=Uy(n)),n}var Yy=(e,t)=>{let n=Jy(e),r=Jy(t);if(!n||!r)return Wy(e,t);let i={...n};return e=>(i.red=Gy(n.red,r.red,e),i.green=Gy(n.green,r.green,e),i.blue=Gy(n.blue,r.blue,e),i.alpha=Y(n.alpha,r.alpha,e),gy.transform(i))},Xy=new Set([`none`,`hidden`]);function Zy(e,t){return Xy.has(e)?n=>n<=0?e:t:n=>n>=1?t:e}function Qy(e,t){return n=>Y(e,t,n)}function $y(e){return typeof e==`number`?Qy:typeof e==`string`?ny(e)?Wy:J.test(e)?Yy:rb:Array.isArray(e)?eb:typeof e==`object`?J.test(e)?Yy:tb:Wy}function eb(e,t){let n=[...e],r=n.length,i=e.map((e,n)=>$y(e)(e,t[n]));return e=>{for(let t=0;t<r;t++)n[t]=i[t](e);return n}}function tb(e,t){let n={...e,...t},r={};for(let i in n)e[i]!==void 0&&t[i]!==void 0&&(r[i]=$y(e[i])(e[i],t[i]));return e=>{for(let t in r)n[t]=r[t](e);return n}}function nb(e,t){let n=[],r={color:0,var:0,number:0};for(let i=0;i<t.values.length;i++){let a=t.types[i],o=e.indexes[a][r[a]];n[i]=e.values[o]??0,r[a]++}return n}var rb=(e,t)=>{let n=Vy.createTransformer(t),r=Py(e),i=Py(t);return r.indexes.var.length===i.indexes.var.length&&r.indexes.color.length===i.indexes.color.length&&r.indexes.number.length>=i.indexes.number.length?Xy.has(e)&&!i.values.length||Xy.has(t)&&!r.values.length?Zy(e,t):mv(eb(nb(r,i),i.values),n):(`${e}${t}`,Wy(e,t))};function ib(e,t,n){return typeof e==`number`&&typeof t==`number`&&typeof n==`number`?Y(e,t,n):$y(e)(e,t)}var ab=e=>{let t=({timestamp:t})=>e(t);return{start:(e=!0)=>G.update(t,e),stop:()=>qv(t),now:()=>K.isProcessing?K.timestamp:Zv.now()}},ob=(e,t,n=10)=>{let r=``,i=Math.max(Math.round(t/n),2);for(let t=0;t<i;t++)r+=Math.round(e(t/(i-1))*1e4)/1e4+`, `;return`linear(${r.substring(0,r.length-2)})`},sb=2e4;function cb(e){let t=0,n=e.next(t);for(;!n.done&&t<2e4;)t+=50,n=e.next(t);return t>=2e4?1/0:t}function lb(e,t=100,n){let r=n({...e,keyframes:[0,t]}),i=Math.min(cb(r),sb);return{type:`keyframes`,ease:e=>r.next(i*e).value/t,duration:vv(i)}}var X={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1};function ub(e,t){return e*Math.sqrt(1-t*t)}var db=12;function fb(e,t,n){let r=n;for(let n=1;n<db;n++)r-=e(r)/t(r);return r}var pb=.001;function mb({duration:e=X.duration,bounce:t=X.bounce,velocity:n=X.velocity,mass:r=X.mass}){let i,a;X.maxDuration;let o=1-t;o=sv(X.minDamping,X.maxDamping,o),e=sv(X.minDuration,X.maxDuration,vv(e)),o<1?(i=t=>{let r=t*o,i=r*e,a=r-n,s=ub(t,o),c=Math.exp(-i);return pb-a/s*c},a=t=>{let r=t*o*e,a=r*n+n,s=o**2*t**2*e,c=Math.exp(-r),l=ub(t**2,o);return(-i(t)+pb>0?-1:1)*((a-s)*c)/l}):(i=t=>-.001+Math.exp(-t*e)*((t-n)*e+1),a=t=>Math.exp(-t*e)*((n-t)*(e*e)));let s=5/e,c=fb(i,a,s);if(e=_v(e),isNaN(c))return{stiffness:X.stiffness,damping:X.damping,duration:e};{let t=c**2*r;return{stiffness:t,damping:o*2*Math.sqrt(r*t),duration:e}}}var hb=[`duration`,`bounce`],gb=[`stiffness`,`damping`,`mass`];function _b(e,t){return t.some(t=>e[t]!==void 0)}function vb(e){let t={velocity:X.velocity,stiffness:X.stiffness,damping:X.damping,mass:X.mass,isResolvedFromDuration:!1,...e};if(!_b(e,gb)&&_b(e,hb))if(t.velocity=0,e.visualDuration){let n=e.visualDuration,r=2*Math.PI/(n*1.2),i=r*r,a=2*sv(.05,1,1-(e.bounce||0))*Math.sqrt(i);t={...t,mass:X.mass,stiffness:i,damping:a}}else{let n=mb({...e,velocity:0});t={...t,...n,mass:X.mass},t.isResolvedFromDuration=!0}return t}function yb(e=X.visualDuration,t=X.bounce){let n=typeof e==`object`?e:{visualDuration:e,keyframes:[0,1],bounce:t},{restSpeed:r,restDelta:i}=n,a=n.keyframes[0],o=n.keyframes[n.keyframes.length-1],s={done:!1,value:a},{stiffness:c,damping:l,mass:u,duration:d,velocity:f,isResolvedFromDuration:p}=vb({...n,velocity:-vv(n.velocity||0)}),m=f||0,h=l/(2*Math.sqrt(c*u)),g=o-a,_=vv(Math.sqrt(c/u)),v=Math.abs(g)<5;r||=v?X.restSpeed.granular:X.restSpeed.default,i||=v?X.restDelta.granular:X.restDelta.default;let y,b,x,S,C,w;if(h<1)x=ub(_,h),S=(m+h*_*g)/x,y=e=>o-Math.exp(-h*_*e)*(S*Math.sin(x*e)+g*Math.cos(x*e)),C=h*_*S+g*x,w=h*_*g-S*x,b=e=>Math.exp(-h*_*e)*(C*Math.sin(x*e)+w*Math.cos(x*e));else if(h===1){y=e=>o-Math.exp(-_*e)*(g+(m+_*g)*e);let e=m+_*g;b=t=>Math.exp(-_*t)*(_*e*t-m)}else{let e=_*Math.sqrt(h*h-1);y=t=>{let n=Math.exp(-h*_*t),r=Math.min(e*t,300);return o-n*((m+h*_*g)*Math.sinh(r)+e*g*Math.cosh(r))/e};let t=(m+h*_*g)/e,n=h*_*t-g*e,r=h*_*g-t*e;b=t=>{let i=Math.exp(-h*_*t),a=Math.min(e*t,300);return i*(n*Math.sinh(a)+r*Math.cosh(a))}}let ee={calculatedDuration:p&&d||null,velocity:e=>_v(b(e)),next:e=>{if(!p&&h<1){let t=Math.exp(-h*_*e),n=Math.sin(x*e),a=Math.cos(x*e),c=o-t*(S*n+g*a),l=_v(t*(C*n+w*a));return s.done=Math.abs(l)<=r&&Math.abs(o-c)<=i,s.value=s.done?o:c,s}let t=y(e);if(p)s.done=e>=d;else{let n=_v(b(e));s.done=Math.abs(n)<=r&&Math.abs(o-t)<=i}return s.value=s.done?o:t,s},toString:()=>{let e=Math.min(cb(ee),sb),t=ob(t=>ee.next(e*t).value,e,30);return e+`ms `+t},toTransition:()=>{}};return ee}yb.applyToOptions=e=>{let t=lb(e,100,yb);return e.ease=t.ease,e.duration=_v(t.duration),e.type=`keyframes`,e};var bb=5;function xb(e,t,n){let r=Math.max(t-bb,0);return yv(n-e(r),t-r)}function Sb({keyframes:e,velocity:t=0,power:n=.8,timeConstant:r=325,bounceDamping:i=10,bounceStiffness:a=500,modifyTarget:o,min:s,max:c,restDelta:l=.5,restSpeed:u}){let d=e[0],f={done:!1,value:d},p=e=>s!==void 0&&e<s||c!==void 0&&e>c,m=e=>s===void 0?c:c===void 0||Math.abs(s-e)<Math.abs(c-e)?s:c,h=n*t,g=d+h,_=o===void 0?g:o(g);_!==g&&(h=_-d);let v=e=>-h*Math.exp(-e/r),y=e=>_+v(e),b=e=>{let t=v(e),n=y(e);f.done=Math.abs(t)<=l,f.value=f.done?_:n},x,S,C=e=>{p(f.value)&&(x=e,S=yb({keyframes:[f.value,m(f.value)],velocity:xb(y,e,f.value),damping:i,stiffness:a,restDelta:l,restSpeed:u}))};return C(0),{calculatedDuration:null,next:e=>{let t=!1;return!S&&x===void 0&&(t=!0,b(e),C(e)),x!==void 0&&e>=x?S.next(e-x):(!t&&b(e),f)}}}function Cb(e,t,n){let r=[],i=n||cv.mix||ib,a=e.length-1;for(let n=0;n<a;n++){let a=i(e[n],e[n+1]);t&&(a=mv(Array.isArray(t)?t[n]||pv:t,a)),r.push(a)}return r}function wb(e,t,{clamp:n=!0,ease:r,mixer:i}={}){let a=e.length;if(t.length,a===1)return()=>t[0];if(a===2&&t[0]===t[1])return()=>t[1];let o=e[0]===e[1];e[0]>e[a-1]&&(e=[...e].reverse(),t=[...t].reverse());let s=Cb(t,r,i),c=s.length,l=n=>{if(o&&n<e[0])return t[0];let r=0;if(c>1)for(;r<e.length-2&&!(n<e[r+1]);r++);let i=hv(e[r],e[r+1],n);return s[r](i)};return n?t=>l(sv(e[0],e[a-1],t)):l}function Tb(e,t){let n=e[e.length-1];for(let r=1;r<=t;r++){let i=hv(0,t,r);e.push(Y(n,1,i))}}function Eb(e){let t=[0];return Tb(t,e.length-1),t}function Db(e,t){return e.map(e=>e*t)}function Ob(e,t){return e.map(()=>t||Iv).splice(0,e.length-1)}function kb({duration:e=300,keyframes:t,times:n,ease:r=`easeInOut`}){let i=Lv(r)?r.map(Vv):Vv(r),a={done:!1,value:t[0]},o=wb(Db(n&&n.length===t.length?n:Eb(t),e),t,{ease:Array.isArray(i)?i:Ob(t,i)});return{calculatedDuration:e,next:t=>(a.value=o(t),a.done=t>=e,a)}}var Ab=e=>e!==null;function jb(e,{repeat:t,repeatType:n=`loop`},r,i=1){let a=e.filter(Ab),o=i<0||t&&n!==`loop`&&t%2==1?0:a.length-1;return!o||r===void 0?a[o]:r}var Mb={decay:Sb,inertia:Sb,tween:kb,keyframes:kb,spring:yb};function Nb(e){typeof e.type==`string`&&(e.type=Mb[e.type])}var Pb=class{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(e=>{this.resolve=e})}notifyFinished(){this.resolve()}then(e,t){return this.finished.then(e,t)}},Fb=e=>e/100,Ib=class extends Pb{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=()=>{let{motionValue:e}=this.options;e&&e.updatedAt!==Zv.now()&&this.tick(Zv.now()),this.isStopped=!0,this.state!==`idle`&&(this.teardown(),this.options.onStop?.())},Qv.mainThread++,this.options=e,this.initAnimation(),this.play(),e.autoplay===!1&&this.pause()}initAnimation(){let{options:e}=this;Nb(e);let{type:t=kb,repeat:n=0,repeatDelay:r=0,repeatType:i,velocity:a=0}=e,{keyframes:o}=e,s=t||kb;s!==kb&&typeof o[0]!=`number`&&(this.mixKeyframes=mv(Fb,ib(o[0],o[1])),o=[0,100]);let c=s({...e,keyframes:o});i===`mirror`&&(this.mirroredGenerator=s({...e,keyframes:[...o].reverse(),velocity:-a})),c.calculatedDuration===null&&(c.calculatedDuration=cb(c));let{calculatedDuration:l}=c;this.calculatedDuration=l,this.resolvedDuration=l+r,this.totalDuration=this.resolvedDuration*(n+1)-r,this.generator=c}updateTime(e){let t=Math.round(e-this.startTime)*this.playbackSpeed;this.holdTime===null?this.currentTime=t:this.currentTime=this.holdTime}tick(e,t=!1){let{generator:n,totalDuration:r,mixKeyframes:i,mirroredGenerator:a,resolvedDuration:o,calculatedDuration:s}=this;if(this.startTime===null)return n.next(0);let{delay:c=0,keyframes:l,repeat:u,repeatType:d,repeatDelay:f,type:p,onUpdate:m,finalKeyframe:h}=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);let g=this.currentTime-c*(this.playbackSpeed>=0?1:-1),_=this.playbackSpeed>=0?g<0:g>r;this.currentTime=Math.max(g,0),this.state===`finished`&&this.holdTime===null&&(this.currentTime=r);let v=this.currentTime,y=n;if(u){let e=Math.min(this.currentTime,r)/o,t=Math.floor(e),n=e%1;!n&&e>=1&&(n=1),n===1&&t--,t=Math.min(t,u+1),t%2&&(d===`reverse`?(n=1-n,f&&(n-=f/o)):d===`mirror`&&(y=a)),v=sv(0,1,n)*o}let b;_?(this.delayState.value=l[0],b=this.delayState):b=y.next(v),i&&!_&&(b.value=i(b.value));let{done:x}=b;!_&&s!==null&&(x=this.playbackSpeed>=0?this.currentTime>=r:this.currentTime<=0);let S=this.holdTime===null&&(this.state===`finished`||this.state===`running`&&x);return S&&p!==Sb&&(b.value=jb(l,this.options,h,this.speed)),m&&m(b.value),S&&this.finish(),b}then(e,t){return this.finished.then(e,t)}get duration(){return vv(this.calculatedDuration)}get iterationDuration(){let{delay:e=0}=this.options||{};return this.duration+vv(e)}get time(){return vv(this.currentTime)}set time(e){e=_v(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(){let e=this.currentTime;if(e<=0)return this.options.velocity||0;if(this.generator.velocity)return this.generator.velocity(e);let t=this.generator.next(e).value;return xb(e=>this.generator.next(e).value,e,t)}get speed(){return this.playbackSpeed}set speed(e){let t=this.playbackSpeed!==e;t&&this.driver&&this.updateTime(Zv.now()),this.playbackSpeed=e,t&&this.driver&&(this.time=vv(this.currentTime))}play(){if(this.isStopped)return;let{driver:e=ab,startTime:t}=this.options;this.driver||=e(e=>this.tick(e)),this.options.onPlay?.();let n=this.driver.now();this.state===`finished`?(this.updateFinished(),this.startTime=n):this.holdTime===null?this.startTime||=t??n:this.startTime=n-this.holdTime,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(Zv.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,Qv.mainThread--}stopDriver(){this.driver&&=(this.driver.stop(),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)}};function Lb(e){for(let t=1;t<e.length;t++)e[t]??(e[t]=e[t-1])}var Rb=e=>e*180/Math.PI,zb=e=>Vb(Rb(Math.atan2(e[1],e[0]))),Bb={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:e=>(Math.abs(e[0])+Math.abs(e[3]))/2,rotate:zb,rotateZ:zb,skewX:e=>Rb(Math.atan(e[1])),skewY:e=>Rb(Math.atan(e[2])),skew:e=>(Math.abs(e[1])+Math.abs(e[2]))/2},Vb=e=>(e%=360,e<0&&(e+=360),e),Hb=zb,Ub=e=>Math.sqrt(e[0]*e[0]+e[1]*e[1]),Wb=e=>Math.sqrt(e[4]*e[4]+e[5]*e[5]),Gb={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:Ub,scaleY:Wb,scale:e=>(Ub(e)+Wb(e))/2,rotateX:e=>Vb(Rb(Math.atan2(e[6],e[5]))),rotateY:e=>Vb(Rb(Math.atan2(-e[2],e[0]))),rotateZ:Hb,rotate:Hb,skewX:e=>Rb(Math.atan(e[4])),skewY:e=>Rb(Math.atan(e[1])),skew:e=>(Math.abs(e[1])+Math.abs(e[4]))/2};function Kb(e){return+!!e.includes(`scale`)}function qb(e,t){if(!e||e===`none`)return Kb(t);let n=e.match(/^matrix3d\(([-\d.e\s,]+)\)$/u),r,i;if(n)r=Gb,i=n;else{let t=e.match(/^matrix\(([-\d.e\s,]+)\)$/u);r=Bb,i=t}if(!i)return Kb(t);let a=r[t],o=i[1].split(`,`).map(Yb);return typeof a==`function`?a(o):o[a]}var Jb=(e,t)=>{let{transform:n=`none`}=getComputedStyle(e);return qb(n,t)};function Yb(e){return parseFloat(e.trim())}var Xb=[`transformPerspective`,`x`,`y`,`z`,`translateX`,`translateY`,`translateZ`,`scale`,`scaleX`,`scaleY`,`rotate`,`rotateX`,`rotateY`,`rotateZ`,`skew`,`skewX`,`skewY`],Zb=new Set([...Xb,`pathRotation`]),Qb=e=>e===ay||e===q,$b=new Set([`x`,`y`,`z`]),ex=Xb.filter(e=>!$b.has(e));function tx(e){let t=[];return ex.forEach(n=>{let r=e.getValue(n);r!==void 0&&(t.push([n,r.get()]),r.set(+!!n.startsWith(`scale`)))}),t}var nx={width:({x:e},{paddingLeft:t=`0`,paddingRight:n=`0`,boxSizing:r})=>{let i=e.max-e.min;return r===`border-box`?i:i-parseFloat(t)-parseFloat(n)},height:({y:e},{paddingTop:t=`0`,paddingBottom:n=`0`,boxSizing:r})=>{let i=e.max-e.min;return r===`border-box`?i:i-parseFloat(t)-parseFloat(n)},top:(e,{top:t})=>parseFloat(t),left:(e,{left:t})=>parseFloat(t),bottom:({y:e},{top:t})=>parseFloat(t)+(e.max-e.min),right:({x:e},{left:t})=>parseFloat(t)+(e.max-e.min),x:(e,{transform:t})=>qb(t,`x`),y:(e,{transform:t})=>qb(t,`y`)};nx.translateX=nx.x,nx.translateY=nx.y;var rx=new Set,ix=!1,ax=!1,ox=!1;function sx(){if(ax){let e=Array.from(rx).filter(e=>e.needsMeasurement),t=new Set(e.map(e=>e.element)),n=new Map;t.forEach(e=>{let t=tx(e);t.length&&(n.set(e,t),e.render())}),e.forEach(e=>e.measureInitialState()),t.forEach(e=>{e.render();let t=n.get(e);t&&t.forEach(([t,n])=>{e.getValue(t)?.set(n)})}),e.forEach(e=>e.measureEndState()),e.forEach(e=>{e.suspendedScrollY!==void 0&&window.scrollTo(0,e.suspendedScrollY)})}ax=!1,ix=!1,rx.forEach(e=>e.complete(ox)),rx.clear()}function cx(){rx.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(ax=!0)})}function lx(){ox=!0,cx(),sx(),ox=!1}var ux=class{constructor(e,t,n,r,i,a=!1){this.state=`pending`,this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...e],this.onComplete=t,this.name=n,this.motionValue=r,this.element=i,this.isAsync=a}scheduleResolve(){this.state=`scheduled`,this.isAsync?(rx.add(this),ix||(ix=!0,G.read(cx),G.resolveKeyframes(sx))):(this.readKeyframes(),this.complete())}readKeyframes(){let{unresolvedKeyframes:e,name:t,element:n,motionValue:r}=this;if(e[0]===null){let i=r?.get(),a=e[e.length-1];if(i!==void 0)e[0]=i;else if(n&&t){let r=n.readValue(t,a);r!=null&&(e[0]=r)}e[0]===void 0&&(e[0]=a),r&&i===void 0&&r.set(e[0])}Lb(e)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(e=!1){this.state=`complete`,this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,e),rx.delete(this)}cancel(){this.state===`scheduled`&&(rx.delete(this),this.state=`pending`)}resume(){this.state===`pending`&&this.scheduleResolve()}},dx=e=>e.startsWith(`--`);function fx(e,t,n){dx(t)?e.style.setProperty(t,n):e.style[t]=n}var px={};function mx(e,t){let n=fv(e);return()=>px[t]??n()}var hx=mx(()=>window.ScrollTimeline!==void 0,`scrollTimeline`),gx=mx(()=>{try{document.createElement(`div`).animate({opacity:0},{easing:`linear(0, 1)`})}catch{return!1}return!0},`linearEasing`),_x=([e,t,n,r])=>`cubic-bezier(${e}, ${t}, ${n}, ${r})`,vx={linear:`linear`,ease:`ease`,easeIn:`ease-in`,easeOut:`ease-out`,easeInOut:`ease-in-out`,circIn:_x([0,.65,.55,1]),circOut:_x([.55,0,1,.45]),backIn:_x([.31,.01,.66,-.59]),backOut:_x([.33,1.53,.69,.99])};function yx(e,t){if(e)return typeof e==`function`?gx()?ob(e,t):`ease-out`:Rv(e)?_x(e):Array.isArray(e)?e.map(e=>yx(e,t)||vx.easeOut):vx[e]}function bx(e,t,n,{delay:r=0,duration:i=300,repeat:a=0,repeatType:o=`loop`,ease:s=`easeOut`,times:c}={},l=void 0){let u={[t]:n};c&&(u.offset=c);let d=yx(s,i);Array.isArray(d)&&(u.easing=d),Uv.value&&Qv.waapi++;let f={delay:r,duration:i,easing:Array.isArray(d)?`linear`:d,fill:`both`,iterations:a+1,direction:o===`reverse`?`alternate`:`normal`};l&&(f.pseudoElement=l);let p=e.animate(u,f);return Uv.value&&p.finished.finally(()=>{Qv.waapi--}),p}function xx(e){return typeof e==`function`&&`applyToOptions`in e}function Sx({type:e,...t}){return xx(e)&&gx()?e.applyToOptions(t):(t.duration??=300,t.ease??=`easeOut`,t)}var Cx=class extends Pb{constructor(e){if(super(),this.finishedTime=null,this.isStopped=!1,this.manualStartTime=null,!e)return;let{element:t,name:n,keyframes:r,pseudoElement:i,allowFlatten:a=!1,finalKeyframe:o,onComplete:s}=e;this.isPseudoElement=!!i,this.allowFlatten=a,this.options=e,e.type;let c=Sx(e);this.animation=bx(t,n,r,c,i),c.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!i){let e=jb(r,this.options,o,this.speed);this.updateMotionValue&&this.updateMotionValue(e),fx(t,n,e),this.animation.cancel()}s?.(),this.notifyFinished()}}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;let{state:e}=this;e===`idle`||e===`finished`||(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){let e=this.options?.element;!this.isPseudoElement&&e?.isConnected&&this.animation.commitStyles?.()}get duration(){let e=this.animation.effect?.getComputedTiming?.().duration||0;return vv(Number(e))}get iterationDuration(){let{delay:e=0}=this.options||{};return this.duration+vv(e)}get time(){return vv(Number(this.animation.currentTime)||0)}set time(e){let t=this.finishedTime!==null;this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=_v(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?this.animation.playState:`finished`}get startTime(){return this.manualStartTime??Number(this.animation.startTime)}set startTime(e){this.manualStartTime=this.animation.startTime=e}attachTimeline({timeline:e,rangeStart:t,rangeEnd:n,observe:r}){return this.allowFlatten&&this.animation.effect?.updateTiming({easing:`linear`}),this.animation.onfinish=null,e&&hx()?(this.animation.timeline=e,t&&(this.animation.rangeStart=t),n&&(this.animation.rangeEnd=n),pv):r(this)}},wx={anticipate:Av,backInOut:kv,circInOut:Nv};function Tx(e){return e in wx}function Ex(e){typeof e.ease==`string`&&Tx(e.ease)&&(e.ease=wx[e.ease])}var Dx=10,Ox=class extends Cx{constructor(e){Ex(e),Nb(e),super(e),e.startTime!==void 0&&e.autoplay!==!1&&(this.startTime=e.startTime),this.options=e}updateMotionValue(e){let{motionValue:t,onUpdate:n,onComplete:r,element:i,...a}=this.options;if(!t)return;if(e!==void 0){t.set(e);return}let o=new Ib({...a,autoplay:!1}),s=Math.max(Dx,Zv.now()-this.startTime),c=sv(0,Dx,s-Dx),l=o.sample(s).value,{name:u}=this.options;i&&u&&fx(i,u,l),t.setWithVelocity(o.sample(Math.max(0,s-c)).value,l,c),o.stop()}},kx=(e,t)=>t===`zIndex`?!1:!!(typeof e==`number`||Array.isArray(e)||typeof e==`string`&&(Vy.test(e)||e===`0`)&&!e.startsWith(`url(`));function Ax(e){let t=e[0];if(e.length===1)return!0;for(let n=0;n<e.length;n++)if(e[n]!==t)return!0}function jx(e,t,n,r){let i=e[0];if(i===null)return!1;if(t===`display`||t===`visibility`)return!0;let a=e[e.length-1],o=kx(i,t),s=kx(a,t);return`${t}${i}${a}${o?a:i}`,!o||!s?!1:Ax(e)||(n===`spring`||xx(n))&&r}function Mx(e){e.duration=0,e.type=`keyframes`}var Nx=new Set([`opacity`,`clipPath`,`filter`,`transform`]),Px=/^(?:oklch|oklab|lab|lch|color|color-mix|light-dark)\(/;function Fx(e){for(let t=0;t<e.length;t++)if(typeof e[t]==`string`&&Px.test(e[t]))return!0;return!1}var Ix=new Set([`color`,`backgroundColor`,`outlineColor`,`fill`,`stroke`,`borderColor`,`borderTopColor`,`borderRightColor`,`borderBottomColor`,`borderLeftColor`]),Lx=fv(()=>Object.hasOwnProperty.call(Element.prototype,`animate`));function Rx(e){let{motionValue:t,name:n,repeatDelay:r,repeatType:i,damping:a,type:o,keyframes:s}=e;if(!(t?.owner?.current instanceof HTMLElement))return!1;let{onUpdate:c,transformTemplate:l}=t.owner.getProps();return Lx()&&n&&(Nx.has(n)||Ix.has(n)&&Fx(s))&&(n!==`transform`||!l)&&!c&&!r&&i!==`mirror`&&a!==0&&o!==`inertia`}var zx=40,Bx=class extends Pb{constructor({autoplay:e=!0,delay:t=0,type:n=`keyframes`,repeat:r=0,repeatDelay:i=0,repeatType:a=`loop`,keyframes:o,name:s,motionValue:c,element:l,...u}){super(),this.stop=()=>{this._animation&&(this._animation.stop(),this.stopTimeline?.()),this.keyframeResolver?.cancel()},this.createdAt=Zv.now();let d={autoplay:e,delay:t,type:n,repeat:r,repeatDelay:i,repeatType:a,name:s,motionValue:c,element:l,...u},f=l?.KeyframeResolver||ux;this.keyframeResolver=new f(o,(e,t,n)=>this.onKeyframesResolved(e,t,d,!n),s,c,l),this.keyframeResolver?.scheduleResolve()}onKeyframesResolved(e,t,n,r){this.keyframeResolver=void 0;let{name:i,type:a,velocity:o,delay:s,isHandoff:c,onUpdate:l}=n;this.resolvedAt=Zv.now();let u=!0;jx(e,i,a,o)||(u=!1,(cv.instantAnimations||!s)&&l?.(jb(e,n,t)),e[0]=e[e.length-1],Mx(n),n.repeat=0);let d={startTime:r?this.resolvedAt&&this.resolvedAt-this.createdAt>zx?this.resolvedAt:this.createdAt:void 0,finalKeyframe:t,...n,keyframes:e},f=u&&!c&&Rx(d),p=d.motionValue?.owner?.current,m;if(f)try{m=new Ox({...d,element:p})}catch{m=new Ib(d)}else m=new Ib(d);m.finished.then(()=>{this.notifyFinished()}).catch(pv),this.pendingTimeline&&=(this.stopTimeline=m.attachTimeline(this.pendingTimeline),void 0),this._animation=m}get finished(){return this._animation?this.animation.finished:this._finished}then(e,t){return this.finished.finally(e).then(()=>{})}get animation(){return this._animation||(this.keyframeResolver?.resume(),lx()),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 Vx(e,t,n,r=0,i=1){let a=Array.from(e).sort((e,t)=>e.sortNodePosition(t)).indexOf(t),o=e.size,s=(o-1)*r;return typeof n==`function`?n(a,o):i===1?a*r:s-a*r}var Hx=30,Ux=e=>!isNaN(parseFloat(e)),Wx={current:void 0},Gx=class{constructor(e,t={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=e=>{let t=Zv.now();if(this.updatedAt!==t&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(e),this.current!==this.prev&&(this.events.change?.notify(this.current),this.dependents))for(let e of this.dependents)e.dirty()},this.hasAnimated=!1,this.setCurrent(e),this.owner=t.owner}setCurrent(e){this.current=e,this.updatedAt=Zv.now(),this.canTrackVelocity===null&&e!==void 0&&(this.canTrackVelocity=Ux(this.current))}setPrevFrameValue(e=this.current){this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt}onChange(e){return this.on(`change`,e)}on(e,t){this.events[e]||(this.events[e]=new gv);let n=this.events[e].add(t);return e===`change`?()=>{n(),G.read(()=>{this.events.change.getSize()||this.stop()})}:n}clearListeners(){for(let 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.events.change?.notify(this.current)}addDependent(e){this.dependents||=new Set,this.dependents.add(e)}removeDependent(e){this.dependents&&this.dependents.delete(e)}get(){return Wx.current&&Wx.current.push(this),this.current}getPrevious(){return this.prev}getVelocity(){let e=Zv.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||e-this.updatedAt>Hx)return 0;let t=Math.min(this.updatedAt-this.prevUpdatedAt,Hx);return yv(parseFloat(this.current)-parseFloat(this.prevFrameValue),t)}start(e){return this.stop(),new Promise(t=>{this.hasAnimated=!0,this.animation=e(t),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.dependents?.clear(),this.events.destroy?.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}};function Kx(e,t){return new Gx(e,t)}function qx(e,t){if(e?.inherit&&t){let{inherit:n,...r}=e;return{...t,...r}}return e}function Jx(e,t){let n=e?.[t]??e?.default??e;return n===e?n:qx(n,e)}var Yx={type:`spring`,stiffness:500,damping:25,restSpeed:10},Xx=e=>({type:`spring`,stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),Zx={type:`keyframes`,duration:.8},Qx={type:`keyframes`,ease:[.25,.1,.35,1],duration:.3},$x=(e,{keyframes:t})=>t.length>2?Zx:Zb.has(e)?e.startsWith(`scale`)?Xx(t[1]):Yx:Qx,eS=new Set([`when`,`delay`,`delayChildren`,`staggerChildren`,`staggerDirection`,`repeat`,`repeatType`,`repeatDelay`,`from`,`elapsed`]);function tS(e){for(let t in e)if(!eS.has(t))return!0;return!1}var nS=(e,t,n,r={},i,a)=>o=>{let s=Jx(r,e)||{},c=s.delay||r.delay||0,{elapsed:l=0}=r;l-=_v(c);let u={keyframes:Array.isArray(n)?n:[null,n],ease:`easeOut`,velocity:t.getVelocity(),...s,delay:-l,onUpdate:e=>{t.set(e),s.onUpdate&&s.onUpdate(e)},onComplete:()=>{o(),s.onComplete&&s.onComplete()},name:e,motionValue:t,element:a?void 0:i};tS(s)||Object.assign(u,$x(e,u)),u.duration&&=_v(u.duration),u.repeatDelay&&=_v(u.repeatDelay),u.from!==void 0&&(u.keyframes[0]=u.from);let d=!1;if((u.type===!1||u.duration===0&&!u.repeatDelay)&&(Mx(u),u.delay===0&&(d=!0)),(cv.instantAnimations||cv.skipAnimations||i?.shouldSkipAnimations||s.skipAnimations)&&(d=!0,Mx(u),u.delay=0),u.allowFlatten=!s.type&&!s.ease,d&&!a&&t.get()!==void 0){let e=jb(u.keyframes,s);if(e!==void 0){G.update(()=>{u.onUpdate(e),u.onComplete()});return}}return s.isSync?new Ib(u):new Bx(u)},rS=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function iS(e){let t=rS.exec(e);if(!t)return[,];let[,n,r,i]=t;return[`--${n??r}`,i]}function aS(e,t,n=1){`${e}`;let[r,i]=iS(e);if(!r)return;let a=window.getComputedStyle(t).getPropertyValue(r);if(a){let e=a.trim();return lv(e)?parseFloat(e):e}return ny(i)?aS(i,t,n+1):i}function oS(e){let t=[{},{}];return e?.values.forEach((e,n)=>{t[0][n]=e.get(),t[1][n]=e.getVelocity()}),t}function sS(e,t,n,r){if(typeof t==`function`){let[i,a]=oS(r);t=t(n===void 0?e.custom:n,i,a)}if(typeof t==`string`&&(t=e.variants&&e.variants[t]),typeof t==`function`){let[i,a]=oS(r);t=t(n===void 0?e.custom:n,i,a)}return t}function cS(e,t,n){let r=e.getProps();return sS(r,t,n===void 0?r.custom:n,e)}var lS=new Set([`width`,`height`,`top`,`left`,`right`,`bottom`,...Xb]),uS=e=>Array.isArray(e);function dS(e,t,n){e.hasValue(t)?e.getValue(t).set(n):e.addValue(t,Kx(n))}function fS(e){return uS(e)?e[e.length-1]||0:e}function pS(e,t){let{transitionEnd:n={},transition:r={},...i}=cS(e,t)||{};i={...i,...n};for(let t in i)dS(e,t,fS(i[t]))}var Z=e=>!!(e&&e.getVelocity);function mS(e){return!!(Z(e)&&e.add)}function hS(e,t){let n=e.getValue(`willChange`);if(mS(n))return n.add(t);if(!n&&cv.WillChange){let n=new cv.WillChange(`auto`);e.addValue(`willChange`,n),n.add(t)}}function gS(e){return e.replace(/([A-Z])/g,e=>`-${e.toLowerCase()}`)}var _S=`data-`+gS(`framerAppearId`);function vS(e){return e.props[_S]}function yS({protectedKeys:e,needsAnimating:t},n){let r=e.hasOwnProperty(n)&&t[n]!==!0;return t[n]=!1,r}function bS(e,t,{delay:n=0,transitionOverride:r,type:i}={}){let{transition:a,transitionEnd:o,...s}=t,c=e.getDefaultTransition();a=a?qx(a,c):c;let l=a?.reduceMotion,u=a?.skipAnimations;r&&(a=r);let d=[],f=i&&e.animationState&&e.animationState.getState()[i],p=a?.path;p&&p.animateVisualElement(e,s,a,n,d);for(let t in s){let r=e.getValue(t,e.latestValues[t]??null),i=s[t];if(i===void 0||f&&yS(f,t))continue;let o={delay:n,...Jx(a||{},t)};u&&(o.skipAnimations=!0);let c=r.get();if(c!==void 0&&!r.isAnimating()&&!Array.isArray(i)&&i===c&&!o.velocity){G.update(()=>r.set(i));continue}let p=!1;if(window.MotionHandoffAnimation){let n=vS(e);if(n){let e=window.MotionHandoffAnimation(n,t,G);e!==null&&(o.startTime=e,p=!0)}}hS(e,t);let m=l??e.shouldReduceMotion;r.start(nS(t,r,i,m&&lS.has(t)?{type:!1}:o,e,p));let h=r.animation;h&&d.push(h)}if(o){let t=()=>G.update(()=>{o&&pS(e,o)});d.length?Promise.all(d).then(t):t()}return d}function xS(e,t,n={}){let r=cS(e,t,n.type===`exit`?e.presenceContext?.custom:void 0),{transition:i=e.getDefaultTransition()||{}}=r||{};n.transitionOverride&&(i=n.transitionOverride);let a=r?()=>Promise.all(bS(e,r,n)):()=>Promise.resolve(),o=e.variantChildren&&e.variantChildren.size?(r=0)=>{let{delayChildren:a=0,staggerChildren:o,staggerDirection:s}=i;return SS(e,t,r,a,o,s,n)}:()=>Promise.resolve(),{when:s}=i;if(s){let[e,t]=s===`beforeChildren`?[a,o]:[o,a];return e().then(()=>t())}else return Promise.all([a(),o(n.delay)])}function SS(e,t,n=0,r=0,i=0,a=1,o){let s=[];for(let c of e.variantChildren)c.notify(`AnimationStart`,t),s.push(xS(c,t,{...o,delay:n+(typeof r==`function`?0:r)+Vx(e.variantChildren,c,r,i,a)}).then(()=>c.notify(`AnimationComplete`,t)));return Promise.all(s)}function CS(e,t,n={}){e.notify(`AnimationStart`,t);let r;if(Array.isArray(t)){let i=t.map(t=>xS(e,t,n));r=Promise.all(i)}else if(typeof t==`string`)r=xS(e,t,n);else{let i=typeof t==`function`?cS(e,t,n.custom):t;r=Promise.all(bS(e,i,n))}return r.then(()=>{e.notify(`AnimationComplete`,t)})}var wS={test:e=>e===`auto`,parse:e=>e},TS=e=>t=>t.test(e),ES=[ay,q,xy,by,Cy,Sy,wS],DS=e=>ES.find(TS(e));function OS(e){return typeof e==`number`?e===0:e===null?!0:e===`none`||e===`0`||dv(e)}var kS=new Set([`brightness`,`contrast`,`saturate`,`opacity`]);function AS(e){let[t,n]=e.slice(0,-1).split(`(`);if(t===`drop-shadow`)return e;let[r]=n.match(ly)||[];if(!r)return e;let i=n.replace(r,``),a=+!!kS.has(t);return r!==n&&(a*=100),t+`(`+a+i+`)`}var jS=/\b([a-z-]*)\(.*?\)/gu,MS={...Vy,getAnimatableNone:e=>{let t=e.match(jS);return t?t.map(AS).join(` `):e}},NS={...Vy,getAnimatableNone:e=>{let t=Vy.parse(e);return Vy.createTransformer(e)(t.map(e=>typeof e==`number`?0:typeof e==`object`?{...e,alpha:1}:e))}},PS={...ay,transform:Math.round},FS={borderWidth:q,borderTopWidth:q,borderRightWidth:q,borderBottomWidth:q,borderLeftWidth:q,borderRadius:q,borderTopLeftRadius:q,borderTopRightRadius:q,borderBottomRightRadius:q,borderBottomLeftRadius:q,width:q,maxWidth:q,height:q,maxHeight:q,top:q,right:q,bottom:q,left:q,inset:q,insetBlock:q,insetBlockStart:q,insetBlockEnd:q,insetInline:q,insetInlineStart:q,insetInlineEnd:q,padding:q,paddingTop:q,paddingRight:q,paddingBottom:q,paddingLeft:q,paddingBlock:q,paddingBlockStart:q,paddingBlockEnd:q,paddingInline:q,paddingInlineStart:q,paddingInlineEnd:q,margin:q,marginTop:q,marginRight:q,marginBottom:q,marginLeft:q,marginBlock:q,marginBlockStart:q,marginBlockEnd:q,marginInline:q,marginInlineStart:q,marginInlineEnd:q,fontSize:q,backgroundPositionX:q,backgroundPositionY:q,rotate:by,pathRotation:by,rotateX:by,rotateY:by,rotateZ:by,scale:sy,scaleX:sy,scaleY:sy,scaleZ:sy,skew:by,skewX:by,skewY:by,distance:q,translateX:q,translateY:q,translateZ:q,x:q,y:q,z:q,perspective:q,transformPerspective:q,opacity:oy,originX:wy,originY:wy,originZ:q,zIndex:PS,fillOpacity:oy,strokeOpacity:oy,numOctaves:PS},IS={...FS,color:J,backgroundColor:J,outlineColor:J,fill:J,stroke:J,borderColor:J,borderTopColor:J,borderRightColor:J,borderBottomColor:J,borderLeftColor:J,filter:MS,WebkitFilter:MS,mask:NS,WebkitMask:NS},LS=e=>IS[e],RS=new Set([MS,NS]);function zS(e,t){let n=LS(e);return RS.has(n)||(n=Vy),n.getAnimatableNone?n.getAnimatableNone(t):void 0}var BS=new Set([`auto`,`none`,`0`]);function VS(e,t,n){let r=0,i;for(;r<e.length&&!i;){let t=e[r];typeof t==`string`&&!BS.has(t)&&Py(t).values.length&&(i=e[r]),r++}if(i&&n)for(let r of t)e[r]=zS(n,i)}var HS=class extends ux{constructor(e,t,n,r,i){super(e,t,n,r,i,!0)}readKeyframes(){let{unresolvedKeyframes:e,element:t,name:n}=this;if(!t||!t.current)return;super.readKeyframes();for(let n=0;n<e.length;n++){let r=e[n];if(typeof r==`string`&&(r=r.trim(),ny(r))){let i=aS(r,t.current);i!==void 0&&(e[n]=i),n===e.length-1&&(this.finalKeyframe=r)}}if(this.resolveNoneKeyframes(),!lS.has(n)||e.length!==2)return;let[r,i]=e,a=DS(r),o=DS(i);if(iy(r)!==iy(i)&&nx[n]){this.needsMeasurement=!0;return}if(a!==o)if(Qb(a)&&Qb(o))for(let t=0;t<e.length;t++){let n=e[t];typeof n==`string`&&(e[t]=parseFloat(n))}else nx[n]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){let{unresolvedKeyframes:e,name:t}=this,n=[];for(let t=0;t<e.length;t++)(e[t]===null||OS(e[t]))&&n.push(t);n.length&&VS(e,n,t)}measureInitialState(){let{element:e,unresolvedKeyframes:t,name:n}=this;if(!e||!e.current)return;n===`height`&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=nx[n](e.measureViewportBox(),window.getComputedStyle(e.current)),t[0]=this.measuredOrigin;let r=t[t.length-1];r!==void 0&&e.getValue(n,r).jump(r,!1)}measureEndState(){let{element:e,name:t,unresolvedKeyframes:n}=this;if(!e||!e.current)return;let r=e.getValue(t);r&&r.jump(this.measuredOrigin,!1);let i=n.length-1,a=n[i];n[i]=nx[t](e.measureViewportBox(),window.getComputedStyle(e.current)),a!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=a),this.removedTransforms?.length&&this.removedTransforms.forEach(([t,n])=>{e.getValue(t).set(n)}),this.resolveNoneKeyframes()}};function US(e,t,n){if(e==null)return[];if(e instanceof EventTarget)return[e];if(typeof e==`string`){let r=document;t&&(r=t.current);let i=n?.[e]??r.querySelectorAll(e);return i?Array.from(i):[]}return Array.from(e).filter(e=>e!=null)}var WS=(e,t)=>t&&typeof e==`number`?t.transform(e):e;function GS(e){return uv(e)&&`offsetHeight`in e&&!(`ownerSVGElement`in e)}var{schedule:KS,cancel:qS}=Kv(queueMicrotask,!1),JS={x:!1,y:!1};function YS(){return JS.x||JS.y}function XS(e){return e===`x`||e===`y`?JS[e]?null:(JS[e]=!0,()=>{JS[e]=!1}):JS.x||JS.y?null:(JS.x=JS.y=!0,()=>{JS.x=JS.y=!1})}function ZS(e,t){let n=US(e),r=new AbortController;return[n,{passive:!0,...t,signal:r.signal},()=>r.abort()]}function QS(e){return!(e.pointerType===`touch`||YS())}function $S(e,t,n={}){let[r,i,a]=ZS(e,n);return r.forEach(e=>{let n=!1,r=!1,a,o=()=>{e.removeEventListener(`pointerleave`,u)},s=e=>{a&&=(a(e),void 0),o()},c=e=>{n=!1,window.removeEventListener(`pointerup`,c),window.removeEventListener(`pointercancel`,c),r&&(r=!1,s(e))},l=()=>{n=!0,window.addEventListener(`pointerup`,c,i),window.addEventListener(`pointercancel`,c,i)},u=e=>{if(e.pointerType!==`touch`){if(n){r=!0;return}s(e)}};e.addEventListener(`pointerenter`,n=>{if(!QS(n))return;r=!1;let o=t(e,n);typeof o==`function`&&(a=o,e.addEventListener(`pointerleave`,u,i))},i),e.addEventListener(`pointerdown`,l,i)}),a}var eC=(e,t)=>t?e===t?!0:eC(e,t.parentElement):!1,tC=e=>e.pointerType===`mouse`?typeof e.button!=`number`||e.button<=0:e.isPrimary!==!1,nC=new Set([`BUTTON`,`INPUT`,`SELECT`,`TEXTAREA`,`A`]);function rC(e){return nC.has(e.tagName)||e.isContentEditable===!0}var iC=new Set([`INPUT`,`SELECT`,`TEXTAREA`]);function aC(e){return iC.has(e.tagName)||e.isContentEditable===!0}var oC=new WeakSet;function sC(e){return t=>{t.key===`Enter`&&e(t)}}function cC(e,t){e.dispatchEvent(new PointerEvent(`pointer`+t,{isPrimary:!0,bubbles:!0}))}var lC=(e,t)=>{let n=e.currentTarget;if(!n)return;let r=sC(()=>{if(oC.has(n))return;cC(n,`down`);let e=sC(()=>{cC(n,`up`)});n.addEventListener(`keyup`,e,t),n.addEventListener(`blur`,()=>cC(n,`cancel`),t)});n.addEventListener(`keydown`,r,t),n.addEventListener(`blur`,()=>n.removeEventListener(`keydown`,r),t)};function uC(e){return tC(e)&&!YS()}var dC=new WeakSet;function fC(e,t,n={}){let[r,i,a]=ZS(e,n),o=e=>{let r=e.currentTarget;if(!uC(e)||dC.has(e))return;oC.add(r),n.stopPropagation&&dC.add(e);let a=t(r,e),o=(e,t)=>{window.removeEventListener(`pointerup`,s),window.removeEventListener(`pointercancel`,c),oC.has(r)&&oC.delete(r),uC(e)&&typeof a==`function`&&a(e,{success:t})},s=e=>{o(e,r===window||r===document||n.useGlobalTarget||eC(r,e.target))},c=e=>{o(e,!1)};window.addEventListener(`pointerup`,s,i),window.addEventListener(`pointercancel`,c,i)};return r.forEach(e=>{(n.useGlobalTarget?window:e).addEventListener(`pointerdown`,o,i),GS(e)&&(e.addEventListener(`focus`,e=>lC(e,i)),!rC(e)&&!e.hasAttribute(`tabindex`)&&(e.tabIndex=0))}),a}function pC(e){return uv(e)&&`ownerSVGElement`in e}var mC=new WeakMap,hC,gC=(e,t,n)=>(r,i)=>i&&i[0]?i[0][e+`Size`]:pC(r)&&`getBBox`in r?r.getBBox()[t]:r[n],_C=gC(`inline`,`width`,`offsetWidth`),vC=gC(`block`,`height`,`offsetHeight`);function yC({target:e,borderBoxSize:t}){mC.get(e)?.forEach(n=>{n(e,{get width(){return _C(e,t)},get height(){return vC(e,t)}})})}function bC(e){e.forEach(yC)}function xC(){typeof ResizeObserver>`u`||(hC=new ResizeObserver(bC))}function SC(e,t){hC||xC();let n=US(e);return n.forEach(e=>{let n=mC.get(e);n||(n=new Set,mC.set(e,n)),n.add(t),hC?.observe(e)}),()=>{n.forEach(e=>{let n=mC.get(e);n?.delete(t),n?.size||hC?.unobserve(e)})}}var CC=new Set,wC;function TC(){wC=()=>{let e={get width(){return window.innerWidth},get height(){return window.innerHeight}};CC.forEach(t=>t(e))},window.addEventListener(`resize`,wC)}function EC(e){return CC.add(e),wC||TC(),()=>{CC.delete(e),!CC.size&&typeof wC==`function`&&(window.removeEventListener(`resize`,wC),wC=void 0)}}function DC(e,t){return typeof e==`function`?EC(e):SC(e,t)}function OC(e){return pC(e)&&e.tagName===`svg`}var kC=[...ES,J,Vy],AC=e=>kC.find(TS(e)),jC=()=>({translate:0,scale:1,origin:0,originPoint:0}),MC=()=>({x:jC(),y:jC()}),NC=()=>({min:0,max:0}),Q=()=>({x:NC(),y:NC()}),PC=new WeakMap;function FC(e){return typeof e==`object`&&!!e&&typeof e.start==`function`}function IC(e){return typeof e==`string`||Array.isArray(e)}var LC=[`animate`,`whileInView`,`whileFocus`,`whileHover`,`whileTap`,`whileDrag`,`exit`],RC=[`initial`,...LC];function zC(e){return FC(e.animate)||RC.some(t=>IC(e[t]))}function BC(e){return!!(zC(e)||e.variants)}function VC(e,t,n){for(let r in t){let i=t[r],a=n[r];if(Z(i))e.addValue(r,i);else if(Z(a))e.addValue(r,Kx(i,{owner:e}));else if(a!==i)if(e.hasValue(r)){let t=e.getValue(r);t.liveStyle===!0?t.jump(i):t.hasAnimated||t.set(i)}else{let t=e.getStaticValue(r);e.addValue(r,Kx(t===void 0?i:t,{owner:e}))}}for(let r in n)t[r]===void 0&&e.removeValue(r);return t}var HC={current:null},UC={current:!1},WC=typeof window<`u`;function GC(){if(UC.current=!0,WC)if(window.matchMedia){let e=window.matchMedia(`(prefers-reduced-motion)`),t=()=>HC.current=e.matches;e.addEventListener(`change`,t),t()}else HC.current=!1}var KC=[`AnimationStart`,`AnimationComplete`,`Update`,`BeforeLayoutMeasure`,`LayoutMeasure`,`LayoutAnimationStart`,`LayoutAnimationComplete`],qC={};function JC(e){qC=e}function YC(){return qC}var XC=class{scrapeMotionValuesFromProps(e,t,n){return{}}constructor({parent:e,props:t,presenceContext:n,reducedMotionConfig:r,skipAnimations:i,blockInitialAnimation:a,visualState:o},s={}){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=ux,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=()=>{let e=Zv.now();this.renderScheduledAt<e&&(this.renderScheduledAt=e,G.render(this.render,!1,!0))};let{latestValues:c,renderState:l}=o;this.latestValues=c,this.baseTarget={...c},this.initialValues=t.initial?{...c}:{},this.renderState=l,this.parent=e,this.props=t,this.presenceContext=n,this.depth=e?e.depth+1:0,this.reducedMotionConfig=r,this.skipAnimationsConfig=i,this.options=s,this.blockInitialAnimation=!!a,this.isControllingVariants=zC(t),this.isVariantNode=BC(t),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(e&&e.current);let{willChange:u,...d}=this.scrapeMotionValuesFromProps(t,{},this);for(let e in d){let t=d[e];c[e]!==void 0&&Z(t)&&t.set(c[e])}}mount(e){if(this.hasBeenMounted)for(let e in this.initialValues)this.values.get(e)?.jump(this.initialValues[e]),this.latestValues[e]=this.initialValues[e];this.current=e,PC.set(e,this),this.projection&&!this.projection.instance&&this.projection.mount(e),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((e,t)=>this.bindToMotionValue(t,e)),this.reducedMotionConfig===`never`?this.shouldReduceMotion=!1:this.reducedMotionConfig===`always`?this.shouldReduceMotion=!0:(UC.current||GC(),this.shouldReduceMotion=HC.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(),qv(this.notifyUpdate),qv(this.render),this.valueSubscriptions.forEach(e=>e()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent?.removeChild(this);for(let e in this.events)this.events[e].clear();for(let e in this.features){let t=this.features[e];t&&(t.unmount(),t.isMounted=!1)}this.current=null}addChild(e){this.children.add(e),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&&Nx.has(e)&&this.current instanceof HTMLElement){let{factory:n,keyframes:r,times:i,ease:a,duration:o}=t.accelerate,s=new Cx({element:this.current,name:e,keyframes:r,times:i,ease:a,duration:_v(o)}),c=n(s);this.valueSubscriptions.set(e,()=>{c(),s.cancel()});return}let n=Zb.has(e);n&&this.onBindTransform&&this.onBindTransform();let r=t.on(`change`,t=>{this.latestValues[e]=t,this.props.onUpdate&&G.preRender(this.notifyUpdate),n&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()}),i;typeof window<`u`&&window.MotionCheckAppearSync&&(i=window.MotionCheckAppearSync(this,e,t)),this.valueSubscriptions.set(e,()=>{r(),i&&i()})}sortNodePosition(e){return!this.current||!this.sortInstanceNodePosition||this.type!==e.type?0:this.sortInstanceNodePosition(this.current,e.current)}updateFeatures(){let e=`animation`;for(e in qC){let t=qC[e];if(!t)continue;let{isEnabled:n,Feature:r}=t;if(!this.features[e]&&r&&n(this.props)&&(this.features[e]=new r(this)),this.features[e]){let t=this.features[e];t.isMounted?t.update():(t.mount(),t.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):Q()}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 t=0;t<KC.length;t++){let n=KC[t];this.propEventSubscriptions[n]&&(this.propEventSubscriptions[n](),delete this.propEventSubscriptions[n]);let r=e[`on`+n];r&&(this.propEventSubscriptions[n]=this.on(n,r))}this.prevMotionValues=VC(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}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(e){let t=this.getClosestVariantNode();if(t)return t.variantChildren&&t.variantChildren.add(e),()=>t.variantChildren.delete(e)}addValue(e,t){let n=this.values.get(e);t!==n&&(n&&this.removeValue(e),this.bindToMotionValue(e,t),this.values.set(e,t),this.latestValues[e]=t.get())}removeValue(e){this.values.delete(e);let 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=Kx(t===null?void 0:t,{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`&&(lv(n)||dv(n))?n=parseFloat(n):!AC(n)&&Vy.test(t)&&(n=zS(e,t)),this.setBaseTarget(e,Z(n)?n.get():n)),Z(n)?n.get():n}setBaseTarget(e,t){this.baseTarget[e]=t}getBaseTarget(e){let{initial:t}=this.props,n;if(typeof t==`string`||typeof t==`object`){let r=sS(this.props,t,this.presenceContext?.custom);r&&(n=r[e])}if(t&&n!==void 0)return n;let r=this.getBaseTargetFromProps(this.props,e);return r!==void 0&&!Z(r)?r:this.initialValues[e]!==void 0&&n===void 0?void 0:this.baseTarget[e]}on(e,t){return this.events[e]||(this.events[e]=new gv),this.events[e].add(t)}notify(e,...t){this.events[e]&&this.events[e].notify(...t)}scheduleRenderMicrotask(){KS.render(this.render)}},ZC=class extends XC{constructor(){super(...arguments),this.KeyframeResolver=HS}sortInstanceNodePosition(e,t){return e.compareDocumentPosition(t)&2?1:-1}getBaseTargetFromProps(e,t){let 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);let{children:e}=this.props;Z(e)&&(this.childSubscription=e.on(`change`,e=>{this.current&&(this.current.textContent=`${e}`)}))}},QC=class{constructor(e){this.isMounted=!1,this.node=e}update(){}};function $C({top:e,left:t,right:n,bottom:r}){return{x:{min:t,max:n},y:{min:e,max:r}}}function ew({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}function tw(e,t){if(!t)return e;let 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 nw(e){return e===void 0||e===1}function rw({scale:e,scaleX:t,scaleY:n}){return!nw(e)||!nw(t)||!nw(n)}function iw(e){return rw(e)||aw(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function aw(e){return ow(e.x)||ow(e.y)}function ow(e){return e&&e!==`0%`}function sw(e,t,n){return n+t*(e-n)}function cw(e,t,n,r,i){return i!==void 0&&(e=sw(e,i,r)),sw(e,n,r)+t}function lw(e,t=0,n=1,r,i){e.min=cw(e.min,t,n,r,i),e.max=cw(e.max,t,n,r,i)}function uw(e,{x:t,y:n}){lw(e.x,t.translate,t.scale,t.originPoint),lw(e.y,n.translate,n.scale,n.originPoint)}var dw=.999999999999,fw=1.0000000000001;function pw(e,t,n,r=!1){let i=n.length;if(!i)return;t.x=t.y=1;let a,o;for(let s=0;s<i;s++){a=n[s],o=a.projectionDelta;let{visualElement:i}=a.options;i&&i.props.style&&i.props.style.display===`contents`||(r&&a.options.layoutScroll&&a.scroll&&a!==a.root&&(mw(e.x,-a.scroll.offset.x),mw(e.y,-a.scroll.offset.y)),o&&(t.x*=o.x.scale,t.y*=o.y.scale,uw(e,o)),r&&iw(a.latestValues)&&_w(e,a.latestValues,a.layout?.layoutBox))}t.x<fw&&t.x>dw&&(t.x=1),t.y<fw&&t.y>dw&&(t.y=1)}function mw(e,t){e.min+=t,e.max+=t}function hw(e,t,n,r,i=.5){lw(e,t,n,Y(e.min,e.max,i),r)}function gw(e,t){return typeof e==`string`?parseFloat(e)/100*(t.max-t.min):e}function _w(e,t,n){let r=n??e;hw(e.x,gw(t.x,r.x),t.scaleX,t.scale,t.originX),hw(e.y,gw(t.y,r.y),t.scaleY,t.scale,t.originY)}function vw(e,t){return $C(tw(e.getBoundingClientRect(),t))}function yw(e,t,n){let r=vw(e,n),{scroll:i}=t;return i&&(mw(r.x,i.offset.x),mw(r.y,i.offset.y)),r}var bw={x:`translateX`,y:`translateY`,z:`translateZ`,transformPerspective:`perspective`},xw=Xb.length;function Sw(e,t,n){let r=``,i=!0;for(let a=0;a<xw;a++){let o=Xb[a],s=e[o];if(s===void 0)continue;let c=!0;if(typeof s==`number`)c=s===+!!o.startsWith(`scale`);else{let e=parseFloat(s);c=o.startsWith(`scale`)?e===1:e===0}if(!c||n){let e=WS(s,FS[o]);if(!c){i=!1;let t=bw[o]||o;r+=`${t}(${e}) `}n&&(t[o]=e)}}let a=e.pathRotation;return a&&(i=!1,r+=`rotate(${WS(a,FS.pathRotation)}) `),r=r.trim(),n?r=n(t,i?``:r):i&&(r=`none`),r}function Cw(e,t,n){let{style:r,vars:i,transformOrigin:a}=e,o=!1,s=!1;for(let e in t){let n=t[e];if(Zb.has(e)){o=!0;continue}else if(ey(e)){i[e]=n;continue}else{let t=WS(n,FS[e]);e.startsWith(`origin`)?(s=!0,a[e]=t):r[e]=t}}if(t.transform||(o||n?r.transform=Sw(t,e.transform,n):r.transform&&=`none`),s){let{originX:e=`50%`,originY:t=`50%`,originZ:n=0}=a;r.transformOrigin=`${e} ${t} ${n}`}}function ww(e,{style:t,vars:n},r,i){let a=e.style,o;for(o in t)a[o]=t[o];for(o in i?.applyProjectionStyles(a,r),n)a.setProperty(o,n[o])}function Tw(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}var Ew={correct:(e,t)=>{if(!t.target)return e;if(typeof e==`string`)if(q.test(e))e=parseFloat(e);else return e;return`${Tw(e,t.target.x)}% ${Tw(e,t.target.y)}%`}},Dw={correct:(e,{treeScale:t,projectionDelta:n})=>{let r=e,i=Vy.parse(e);if(i.length>5)return r;let a=Vy.createTransformer(e),o=typeof i[0]==`number`?0:1,s=n.x.scale*t.x,c=n.y.scale*t.y;i[0+o]/=s,i[1+o]/=c;let l=Y(s,c,.5);return typeof i[2+o]==`number`&&(i[2+o]/=l),typeof i[3+o]==`number`&&(i[3+o]/=l),a(i)}},Ow={borderRadius:{...Ew,applyTo:[`borderTopLeftRadius`,`borderTopRightRadius`,`borderBottomLeftRadius`,`borderBottomRightRadius`]},borderTopLeftRadius:Ew,borderTopRightRadius:Ew,borderBottomLeftRadius:Ew,borderBottomRightRadius:Ew,boxShadow:Dw};function kw(e,{layout:t,layoutId:n}){return Zb.has(e)||e.startsWith(`origin`)||(t||n!==void 0)&&(!!Ow[e]||e===`opacity`)}function Aw(e,t,n){let r=e.style,i=t?.style,a={};if(!r)return a;for(let t in r)(Z(r[t])||i&&Z(i[t])||kw(t,e)||n?.getValue(t)?.liveStyle!==void 0)&&(a[t]=r[t]);return a}function jw(e){return window.getComputedStyle(e)}var Mw=class extends ZC{constructor(){super(...arguments),this.type=`html`,this.renderInstance=ww}readValueFromInstance(e,t){if(Zb.has(t))return this.projection?.isProjecting?Kb(t):Jb(e,t);{let n=jw(e),r=(ey(t)?n.getPropertyValue(t):n[t])||0;return typeof r==`string`?r.trim():r}}measureInstanceViewportBox(e,{transformPagePoint:t}){return vw(e,t)}build(e,t,n){Cw(e,t,n.transformTemplate)}scrapeMotionValuesFromProps(e,t,n){return Aw(e,t,n)}},Nw={offset:`stroke-dashoffset`,array:`stroke-dasharray`},Pw={offset:`strokeDashoffset`,array:`strokeDasharray`};function Fw(e,t,n=1,r=0,i=!0){e.pathLength=1;let a=i?Nw:Pw;e[a.offset]=`${-r}`,e[a.array]=`${t} ${n}`}var Iw=[`offsetDistance`,`offsetPath`,`offsetRotate`,`offsetAnchor`];function Lw(e,{attrX:t,attrY:n,attrScale:r,pathLength:i,pathSpacing:a=1,pathOffset:o=0,...s},c,l,u){if(Cw(e,s,l),c){e.style.viewBox&&(e.attrs.viewBox=e.style.viewBox);return}e.attrs=e.style,e.style={};let{attrs:d,style:f}=e;d.transform&&(f.transform=d.transform,delete d.transform),(f.transform||d.transformOrigin)&&(f.transformOrigin=d.transformOrigin??`50% 50%`,delete d.transformOrigin),f.transform&&(f.transformBox=u?.transformBox??`fill-box`,delete d.transformBox);for(let e of Iw)d[e]!==void 0&&(f[e]=d[e],delete d[e]);t!==void 0&&(d.x=t),n!==void 0&&(d.y=n),r!==void 0&&(d.scale=r),i!==void 0&&Fw(d,i,a,o,!1)}var Rw=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`]),zw=e=>typeof e==`string`&&e.toLowerCase()===`svg`;function Bw(e,t,n,r){ww(e,t,void 0,r);for(let n in t.attrs)e.setAttribute(Rw.has(n)?n:gS(n),t.attrs[n])}function Vw(e,t,n){let r=Aw(e,t,n);for(let n in e)if(Z(e[n])||Z(t[n])){let t=Xb.indexOf(n)===-1?n:`attr`+n.charAt(0).toUpperCase()+n.substring(1);r[t]=e[n]}return r}var Hw=class extends ZC{constructor(){super(...arguments),this.type=`svg`,this.isSVGTag=!1,this.measureInstanceViewportBox=Q}getBaseTargetFromProps(e,t){return e[t]}readValueFromInstance(e,t){if(Zb.has(t)){let e=LS(t);return e&&e.default||0}return t=Rw.has(t)?t:gS(t),e.getAttribute(t)}scrapeMotionValuesFromProps(e,t,n){return Vw(e,t,n)}build(e,t,n){Lw(e,t,this.isSVGTag,n.transformTemplate,n.style)}renderInstance(e,t,n,r){Bw(e,t,n,r)}mount(e){this.isSVGTag=zw(e.tagName),super.mount(e)}},Uw=RC.length;function Ww(e){if(!e)return;if(!e.isControllingVariants){let t=e.parent&&Ww(e.parent)||{};return e.props.initial!==void 0&&(t.initial=e.props.initial),t}let t={};for(let n=0;n<Uw;n++){let r=RC[n],i=e.props[r];(IC(i)||i===!1)&&(t[r]=i)}return t}function Gw(e,t){if(!Array.isArray(t))return!1;let 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 Kw=[...LC].reverse(),qw=LC.length;function Jw(e){return t=>Promise.all(t.map(({animation:t,options:n})=>CS(e,t,n)))}function Yw(e){let t=Jw(e),n=Qw(),r=!0,i=!1,a=t=>(n,r)=>{let i=cS(e,r,t===`exit`?e.presenceContext?.custom:void 0);if(i){let{transition:e,transitionEnd:t,...r}=i;n={...n,...r,...t}}return n};function o(n){t=n(e)}function s(o){let{props:s}=e,c=Ww(e.parent)||{},l=[],u=new Set,d={},f=1/0;for(let t=0;t<qw;t++){let p=Kw[t],m=n[p],h=s[p]===void 0?c[p]:s[p],g=IC(h),_=p===o?m.isActive:null;_===!1&&(f=t);let v=h===c[p]&&h!==s[p]&&g;if(v&&(r||i)&&e.manuallyAnimateOnMount&&(v=!1),m.protectedKeys={...d},!m.isActive&&_===null||!h&&!m.prevProp||FC(h)||typeof h==`boolean`)continue;if(p===`exit`&&m.isActive&&_!==!0){m.prevResolvedValues&&(d={...d,...m.prevResolvedValues});continue}let y=Xw(m.prevProp,h),b=y||p===o&&m.isActive&&!v&&g||t>f&&g,x=!1,S=Array.isArray(h)?h:[h],C=S.reduce(a(p),{});_===!1&&(C={});let{prevResolvedValues:w={}}=m,ee={...w,...C},T=t=>{b=!0,u.has(t)&&(x=!0,u.delete(t)),m.needsAnimating[t]=!0;let n=e.getValue(t);n&&(n.liveStyle=!1)};for(let e in ee){let t=C[e],n=w[e];if(d.hasOwnProperty(e))continue;let r=!1;r=uS(t)&&uS(n)?!Gw(t,n)||y:t!==n,r?t==null?u.add(e):T(e):t!==void 0&&u.has(e)?T(e):m.protectedKeys[e]=!0}m.prevProp=h,m.prevResolvedValues=C,m.isActive&&(d={...d,...C}),(r||i)&&e.blockInitialAnimation&&(b=!1);let E=v&&y;b&&(!E||x)&&l.push(...S.map(t=>{let n={type:p};if(typeof t==`string`&&(r||i)&&!E&&e.manuallyAnimateOnMount&&e.parent){let{parent:r}=e,i=cS(r,t);if(r.enteringChildren&&i){let{delayChildren:t}=i.transition||{};n.delay=Vx(r.enteringChildren,e,t)}}return{animation:t,options:n}}))}if(u.size){let t={};if(typeof s.initial!=`boolean`){let n=cS(e,Array.isArray(s.initial)?s.initial[0]:s.initial);n&&n.transition&&(t.transition=n.transition)}u.forEach(n=>{let r=e.getBaseTarget(n),i=e.getValue(n);i&&(i.liveStyle=!0),t[n]=r??null}),l.push({animation:t})}let p=!!l.length;return r&&(s.initial===!1||s.initial===s.animate)&&!e.manuallyAnimateOnMount&&(p=!1),r=!1,i=!1,p?t(l):Promise.resolve()}function c(t,r){if(n[t].isActive===r)return Promise.resolve();e.variantChildren?.forEach(e=>e.animationState?.setActive(t,r)),n[t].isActive=r;let i=s(t);for(let e in n)n[e].protectedKeys={};return i}return{animateChanges:s,setActive:c,setAnimateFunction:o,getState:()=>n,reset:()=>{n=Qw(),i=!0}}}function Xw(e,t){return typeof t==`string`?t!==e:Array.isArray(t)?!Gw(t,e):!1}function Zw(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function Qw(){return{animate:Zw(!0),whileInView:Zw(),whileHover:Zw(),whileTap:Zw(),whileDrag:Zw(),whileFocus:Zw(),exit:Zw()}}function $w(e,t){e.min=t.min,e.max=t.max}function eT(e,t){$w(e.x,t.x),$w(e.y,t.y)}function tT(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}var nT=.9999,rT=1.0001,iT=-.01,aT=.01;function oT(e){return e.max-e.min}function sT(e,t,n){return Math.abs(e-t)<=n}function cT(e,t,n,r=.5){e.origin=r,e.originPoint=Y(t.min,t.max,e.origin),e.scale=oT(n)/oT(t),e.translate=Y(n.min,n.max,e.origin)-e.originPoint,(e.scale>=nT&&e.scale<=rT||isNaN(e.scale))&&(e.scale=1),(e.translate>=iT&&e.translate<=aT||isNaN(e.translate))&&(e.translate=0)}function lT(e,t,n,r){cT(e.x,t.x,n.x,r?r.originX:void 0),cT(e.y,t.y,n.y,r?r.originY:void 0)}function uT(e,t,n,r=0){e.min=(r?Y(n.min,n.max,r):n.min)+t.min,e.max=e.min+oT(t)}function dT(e,t,n,r){uT(e.x,t.x,n.x,r?.x),uT(e.y,t.y,n.y,r?.y)}function fT(e,t,n,r=0){let i=r?Y(n.min,n.max,r):n.min;e.min=t.min-i,e.max=e.min+oT(t)}function pT(e,t,n,r){fT(e.x,t.x,n.x,r?.x),fT(e.y,t.y,n.y,r?.y)}function mT(e,t,n,r,i){return e-=t,e=sw(e,1/n,r),i!==void 0&&(e=sw(e,1/i,r)),e}function hT(e,t=0,n=1,r=.5,i,a=e,o=e){if(xy.test(t)&&(t=parseFloat(t),t=Y(o.min,o.max,t/100)-o.min),typeof t!=`number`)return;let s=Y(a.min,a.max,r);e===a&&(s-=t),e.min=mT(e.min,t,n,s,i),e.max=mT(e.max,t,n,s,i)}function gT(e,t,[n,r,i],a,o){hT(e,t[n],t[r],t[i],t.scale,a,o)}var _T=[`x`,`scaleX`,`originX`],vT=[`y`,`scaleY`,`originY`];function yT(e,t,n,r){gT(e.x,t,_T,n?n.x:void 0,r?r.x:void 0),gT(e.y,t,vT,n?n.y:void 0,r?r.y:void 0)}function bT(e){return e.translate===0&&e.scale===1}function xT(e){return bT(e.x)&&bT(e.y)}function ST(e,t){return e.min===t.min&&e.max===t.max}function CT(e,t){return ST(e.x,t.x)&&ST(e.y,t.y)}function wT(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function TT(e,t){return wT(e.x,t.x)&&wT(e.y,t.y)}function ET(e){return oT(e.x)/oT(e.y)}function DT(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}function OT(e){return[e(`x`),e(`y`)]}function kT(e,t,n){let r=``,i=e.x.translate/t.x,a=e.y.translate/t.y,o=n?.z||0;if((i||a||o)&&(r=`translate3d(${i}px, ${a}px, ${o}px) `),(t.x!==1||t.y!==1)&&(r+=`scale(${1/t.x}, ${1/t.y}) `),n){let{transformPerspective:e,rotate:t,pathRotation:i,rotateX:a,rotateY:o,skewX:s,skewY:c}=n;e&&(r=`perspective(${e}px) ${r}`),t&&(r+=`rotate(${t}deg) `),i&&(r+=`rotate(${i}deg) `),a&&(r+=`rotateX(${a}deg) `),o&&(r+=`rotateY(${o}deg) `),s&&(r+=`skewX(${s}deg) `),c&&(r+=`skewY(${c}deg) `)}let s=e.x.scale*t.x,c=e.y.scale*t.y;return(s!==1||c!==1)&&(r+=`scale(${s}, ${c})`),r||`none`}var AT=[`borderTopLeftRadius`,`borderTopRightRadius`,`borderBottomLeftRadius`,`borderBottomRightRadius`],jT=AT.length,MT=e=>typeof e==`string`?parseFloat(e):e,NT=e=>typeof e==`number`||q.test(e);function PT(e,t,n,r,i,a){i?(e.opacity=Y(0,n.opacity??1,IT(r)),e.opacityExit=Y(t.opacity??1,0,LT(r))):a&&(e.opacity=Y(t.opacity??1,n.opacity??1,r));for(let i=0;i<jT;i++){let a=AT[i],o=FT(t,a),s=FT(n,a);o===void 0&&s===void 0||(o||=0,s||=0,o===0||s===0||NT(o)===NT(s)?(e[a]=Math.max(Y(MT(o),MT(s),r),0),(xy.test(s)||xy.test(o))&&(e[a]+=`%`)):e[a]=s)}(t.rotate||n.rotate)&&(e.rotate=Y(t.rotate||0,n.rotate||0,r))}function FT(e,t){return e[t]===void 0?e.borderRadius:e[t]}var IT=RT(0,.5,Mv),LT=RT(.5,.95,pv);function RT(e,t,n){return r=>r<e?0:r>t?1:n(hv(e,t,r))}function zT(e,t,n){let r=Z(e)?e:Kx(e);return r.start(nS(``,r,t,n)),r.animation}function BT(e,t,n,r={passive:!0}){return e.addEventListener(t,n,r),()=>e.removeEventListener(t,n)}var VT=(e,t)=>e.depth-t.depth,HT=class{constructor(){this.children=[],this.isDirty=!1}add(e){av(this.children,e),this.isDirty=!0}remove(e){ov(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(VT),this.isDirty=!1,this.children.forEach(e)}};function UT(e,t){let n=Zv.now(),r=({timestamp:i})=>{let a=i-n;a>=t&&(qv(r),e(a-t))};return G.setup(r,!0),()=>qv(r)}function WT(e){return Z(e)?e.get():e}var GT=class{constructor(){this.members=[]}add(e){av(this.members,e);for(let t=this.members.length-1;t>=0;t--){let n=this.members[t];if(n===e||n===this.lead||n===this.prevLead)continue;let r=n.instance;(!r||r.isConnected===!1)&&!n.snapshot&&(ov(this.members,n),n.unmount())}e.scheduleRender()}remove(e){if(ov(this.members,e),e===this.prevLead&&(this.prevLead=void 0),e===this.lead){let e=this.members[this.members.length-1];e&&this.promote(e)}}relegate(e){for(let t=this.members.indexOf(e)-1;t>=0;t--){let e=this.members[t];if(e.isPresent!==!1&&e.instance?.isConnected!==!1)return this.promote(e),!0}return!1}promote(e,t){let n=this.lead;if(e!==n&&(this.prevLead=n,this.lead=e,e.show(),n)){n.updateSnapshot(),e.scheduleRender();let{layoutDependency:r}=n.options,{layoutDependency:i}=e.options;(r===void 0||r!==i)&&(e.resumeFrom=n,t&&(n.preserveOpacity=!0),n.snapshot&&(e.snapshot=n.snapshot,e.snapshot.latestValues=n.animationValues||n.latestValues),e.root?.isUpdating&&(e.isLayoutDirty=!0)),e.options.crossfade===!1&&n.hide()}}exitAnimationComplete(){this.members.forEach(e=>{e.options.onExitComplete?.(),e.resumingFrom?.options.onExitComplete?.()})}scheduleRender(){this.members.forEach(e=>e.instance&&e.scheduleRender(!1))}removeLeadSnapshot(){this.lead?.snapshot&&(this.lead.snapshot=void 0)}},KT={hasAnimatedSinceResize:!0,hasEverUpdated:!1},qT={nodes:0,calculatedTargetDeltas:0,calculatedProjections:0},JT=[``,`X`,`Y`,`Z`],YT=1e3,XT=0;function ZT(e,t,n,r){let{latestValues:i}=t;i[e]&&(n[e]=i[e],t.setStaticValue(e,0),r&&(r[e]=0))}function QT(e){if(e.hasCheckedOptimisedAppear=!0,e.root===e)return;let{visualElement:t}=e.options;if(!t)return;let n=vS(t);if(window.MotionHasOptimisedAnimation(n,`transform`)){let{layout:t,layoutId:r}=e.options;window.MotionCancelOptimisedAnimation(n,`transform`,G,!(t||r))}let{parent:r}=e;r&&!r.hasCheckedOptimisedAppear&&QT(r)}function $T({attachResizeListener:e,defaultParent:t,measureScroll:n,checkIsScrollRoot:r,resetTransform:i}){return class{constructor(e={},n=t?.()){this.id=XT++,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.layoutVersion=0,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,Uv.value&&(qT.nodes=qT.calculatedTargetDeltas=qT.calculatedProjections=0),this.nodes.forEach(nE),this.nodes.forEach(dE),this.nodes.forEach(fE),this.nodes.forEach(rE),Uv.addProjectionMetrics&&Uv.addProjectionMetrics(qT)},this.resolvedRelativeTargetAt=0,this.linkedParentVersion=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=e,this.root=n?n.root||n:this,this.path=n?[...n.path,n]:[],this.parent=n,this.depth=n?n.depth+1:0;for(let e=0;e<this.path.length;e++)this.path[e].shouldResetTransform=!0;this.root===this&&(this.nodes=new HT)}addEventListener(e,t){return this.eventHandlers.has(e)||this.eventHandlers.set(e,new gv),this.eventHandlers.get(e).add(t)}notifyListeners(e,...t){let n=this.eventHandlers.get(e);n&&n.notify(...t)}hasListeners(e){return this.eventHandlers.has(e)}mount(t){if(this.instance)return;this.isSVG=pC(t)&&!OC(t),this.instance=t;let{layoutId:n,layout:r,visualElement:i}=this.options;if(i&&!i.current&&i.mount(t),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),this.root.hasTreeAnimated&&(r||n)&&(this.isLayoutDirty=!0),e){let n,r=0,i=()=>this.root.updateBlockedByResize=!1;G.read(()=>{r=window.innerWidth}),e(t,()=>{let e=window.innerWidth;e!==r&&(r=e,this.root.updateBlockedByResize=!0,n&&n(),n=UT(i,250),KT.hasAnimatedSinceResize&&(KT.hasAnimatedSinceResize=!1,this.nodes.forEach(uE)))})}n&&this.root.registerSharedNode(n,this),this.options.animate!==!1&&i&&(n||r)&&this.addEventListener(`didUpdate`,({delta:e,hasLayoutChanged:t,hasRelativeLayoutChanged:n,layout:r})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}let a=this.options.transition||i.getDefaultTransition()||yE,{onLayoutAnimationStart:o,onLayoutAnimationComplete:s}=i.getProps(),c=!this.targetLayout||!TT(this.targetLayout,r),l=!t&&n;if(this.options.layoutRoot||this.resumeFrom||l||t&&(c||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);let t={...Jx(a,`layout`),onPlay:o,onComplete:s};(i.shouldReduceMotion||this.options.layoutRoot)&&(t.delay=0,t.type=!1),this.startAnimation(t),this.setAnimationOrigin(e,l,t.path)}else t||uE(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=r})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);let e=this.getStack();e&&e.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),qv(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(pE),this.animationId++)}getTransformTemplate(){let{visualElement:e}=this.options;return e&&e.getProps().transformTemplate}willUpdate(e=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&QT(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let e=0;e<this.path.length;e++){let t=this.path[e];t.shouldResetTransform=!0,(typeof t.latestValues.x==`string`||typeof t.latestValues.y==`string`)&&(t.isLayoutDirty=!0),t.updateScroll(`snapshot`),t.options.layoutRoot&&t.willUpdate(!1)}let{layoutId:t,layout:n}=this.options;if(t===void 0&&!n)return;let r=this.getTransformTemplate();this.prevTransformTemplateValue=r?r(this.latestValues,``):void 0,this.updateSnapshot(),e&&this.notifyListeners(`willUpdate`)}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){let e=this.updateBlockedByResize;this.unblockUpdate(),this.updateBlockedByResize=!1,this.clearAllSnapshots(),e&&this.nodes.forEach(oE),this.nodes.forEach(aE);return}if(this.animationId<=this.animationCommitId){this.nodes.forEach(sE);return}this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(cE),this.nodes.forEach(lE),this.nodes.forEach(eE),this.nodes.forEach(tE)):this.nodes.forEach(sE),this.clearAllSnapshots();let e=Zv.now();K.delta=sv(0,1e3/60,e-K.timestamp),K.timestamp=e,K.isProcessing=!0,Jv.update.process(K),Jv.preRender.process(K),Jv.render.process(K),K.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,KS.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(iE),this.sharedNodes.forEach(mE)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,G.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){G.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure(),this.snapshot&&!oT(this.snapshot.measuredBox.x)&&!oT(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 e=0;e<this.path.length;e++)this.path[e].updateScroll();let e=this.layout;this.layout=this.measure(!1),this.layoutVersion++,this.layoutCorrected||=Q(),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners(`measure`,this.layout.layoutBox);let{visualElement:t}=this.options;t&&t.notify(`LayoutMeasure`,this.layout.layoutBox,e?e.layoutBox:void 0)}updateScroll(e=`measure`){let t=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===e&&(t=!1),t&&this.instance){let t=r(this.instance);this.scroll={animationId:this.root.animationId,phase:e,isRoot:t,offset:n(this.instance),wasRoot:this.scroll?this.scroll.isRoot:t}}}resetTransform(){if(!i)return;let e=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,t=this.projectionDelta&&!xT(this.projectionDelta),n=this.getTransformTemplate(),r=n?n(this.latestValues,``):void 0,a=r!==this.prevTransformTemplateValue;e&&this.instance&&(t||iw(this.latestValues)||a)&&(i(this.instance,r),this.shouldResetTransform=!1,this.scheduleRender())}measure(e=!0){let t=this.measurePageBox(),n=this.removeElementScroll(t);return e&&(n=this.removeTransform(n)),CE(n),{animationId:this.root.animationId,measuredBox:t,layoutBox:n,latestValues:{},source:this.id}}measurePageBox(){let{visualElement:e}=this.options;if(!e)return Q();let t=e.measureViewportBox();if(!(this.scroll?.wasRoot||this.path.some(TE))){let{scroll:e}=this.root;e&&(mw(t.x,e.offset.x),mw(t.y,e.offset.y))}return t}removeElementScroll(e){let t=Q();if(eT(t,e),this.scroll?.wasRoot)return t;for(let n=0;n<this.path.length;n++){let r=this.path[n],{scroll:i,options:a}=r;r!==this.root&&i&&a.layoutScroll&&(i.wasRoot&&eT(t,e),mw(t.x,i.offset.x),mw(t.y,i.offset.y))}return t}applyTransform(e,t=!1,n){let r=n||Q();eT(r,e);for(let e=0;e<this.path.length;e++){let n=this.path[e];!t&&n.options.layoutScroll&&n.scroll&&n!==n.root&&(mw(r.x,-n.scroll.offset.x),mw(r.y,-n.scroll.offset.y)),iw(n.latestValues)&&_w(r,n.latestValues,n.layout?.layoutBox)}return iw(this.latestValues)&&_w(r,this.latestValues,this.layout?.layoutBox),r}removeTransform(e){let t=Q();eT(t,e);for(let e=0;e<this.path.length;e++){let n=this.path[e];if(!iw(n.latestValues))continue;let r;n.instance&&(rw(n.latestValues)&&n.updateSnapshot(),r=Q(),eT(r,n.measurePageBox())),yT(t,n.latestValues,n.snapshot?.layoutBox,r)}return iw(this.latestValues)&&yT(t,this.latestValues),t}setTargetDelta(e){this.targetDelta=e,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(e){this.options={...this.options,...e,crossfade:e.crossfade===void 0?!0:e.crossfade}}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!==K.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(e=!1){let t=this.getLead();this.isProjectionDirty||=t.isProjectionDirty,this.isTransformDirty||=t.isTransformDirty,this.isSharedProjectionDirty||=t.isSharedProjectionDirty;let n=!!this.resumingFrom||this!==t;if(!(e||n&&this.isSharedProjectionDirty||this.isProjectionDirty||this.parent?.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;let{layout:r,layoutId:i}=this.options;if(!this.layout||!(r||i))return;this.resolvedRelativeTargetAt=K.timestamp;let a=this.getClosestProjectingParent();a&&this.linkedParentVersion!==a.layoutVersion&&!a.options.layoutRoot&&this.removeRelativeTarget(),!this.targetDelta&&!this.relativeTarget&&(this.options.layoutAnchor!==!1&&a&&a.layout?this.createRelativeTarget(a,this.layout.layoutBox,a.layout.layoutBox):this.removeRelativeTarget()),!(!this.relativeTarget&&!this.targetDelta)&&(this.target||(this.target=Q(),this.targetWithTransforms=Q()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),dT(this.target,this.relativeTarget,this.relativeParent.target,this.options.layoutAnchor||void 0)):this.targetDelta?(this.resumingFrom?this.applyTransform(this.layout.layoutBox,!1,this.target):eT(this.target,this.layout.layoutBox),uw(this.target,this.targetDelta)):eT(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget&&(this.attemptToResolveRelativeTarget=!1,this.options.layoutAnchor!==!1&&a&&!!a.resumingFrom==!!this.resumingFrom&&!a.options.layoutScroll&&a.target&&this.animationProgress!==1?this.createRelativeTarget(a,this.target,a.target):this.relativeParent=this.relativeTarget=void 0),Uv.value&&qT.calculatedTargetDeltas++)}getClosestProjectingParent(){if(!(!this.parent||rw(this.parent.latestValues)||aw(this.parent.latestValues)))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}createRelativeTarget(e,t,n){this.relativeParent=e,this.linkedParentVersion=e.layoutVersion,this.forceRelativeParentToResolveTarget(),this.relativeTarget=Q(),this.relativeTargetOrigin=Q(),pT(this.relativeTargetOrigin,t,n,this.options.layoutAnchor||void 0),eT(this.relativeTarget,this.relativeTargetOrigin)}removeRelativeTarget(){this.relativeParent=this.relativeTarget=void 0}calcProjection(){let e=this.getLead(),t=!!this.resumingFrom||this!==e,n=!0;if((this.isProjectionDirty||this.parent?.isProjectionDirty)&&(n=!1),t&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(n=!1),this.resolvedRelativeTargetAt===K.timestamp&&(n=!1),n)return;let{layout:r,layoutId:i}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(r||i))return;eT(this.layoutCorrected,this.layout.layoutBox);let a=this.treeScale.x,o=this.treeScale.y;pw(this.layoutCorrected,this.treeScale,this.path,t),e.layout&&!e.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(e.target=e.layout.layoutBox,e.targetWithTransforms=Q());let{target:s}=e;if(!s){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(tT(this.prevProjectionDelta.x,this.projectionDelta.x),tT(this.prevProjectionDelta.y,this.projectionDelta.y)),lT(this.projectionDelta,this.layoutCorrected,s,this.latestValues),(this.treeScale.x!==a||this.treeScale.y!==o||!DT(this.projectionDelta.x,this.prevProjectionDelta.x)||!DT(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners(`projectionUpdate`,s)),Uv.value&&qT.calculatedProjections++}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(e=!0){if(this.options.visualElement?.scheduleRender(),e){let e=this.getStack();e&&e.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=MC(),this.projectionDelta=MC(),this.projectionDeltaWithTransform=MC()}setAnimationOrigin(e,t=!1,n){let r=this.snapshot,i=r?r.latestValues:{},a={...this.latestValues},o=MC();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!t;let s=Q(),c=(r?r.source:void 0)!==(this.layout?this.layout.source:void 0),l=this.getStack(),u=!l||l.members.length<=1,d=!!(c&&!u&&this.options.crossfade===!0&&!this.path.some(vE));this.animationProgress=0;let f,p=n?.interpolateProjection(e);this.mixTargetDelta=t=>{let n=t/1e3,r=p?.(n);r?(o.x.translate=r.x,o.x.scale=Y(e.x.scale,1,n),o.x.origin=e.x.origin,o.x.originPoint=e.x.originPoint,o.y.translate=r.y,o.y.scale=Y(e.y.scale,1,n),o.y.origin=e.y.origin,o.y.originPoint=e.y.originPoint):(hE(o.x,e.x,n),hE(o.y,e.y,n)),this.setTargetDelta(o),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(pT(s,this.layout.layoutBox,this.relativeParent.layout.layoutBox,this.options.layoutAnchor||void 0),_E(this.relativeTarget,this.relativeTargetOrigin,s,n),f&&CT(this.relativeTarget,f)&&(this.isProjectionDirty=!1),f||=Q(),eT(f,this.relativeTarget)),c&&(this.animationValues=a,PT(a,i,this.latestValues,n,d,u)),r&&r.rotate!==void 0&&(this.animationValues||=a,this.animationValues.pathRotation=r.rotate),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=n},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(e){this.notifyListeners(`animationStart`),this.currentAnimation?.stop(),this.resumingFrom?.currentAnimation?.stop(),this.pendingAnimation&&=(qv(this.pendingAnimation),void 0),this.pendingAnimation=G.update(()=>{KT.hasAnimatedSinceResize=!0,Qv.layout++,this.motionValue||=Kx(0),this.motionValue.jump(0,!1),this.currentAnimation=zT(this.motionValue,[0,1e3],{...e,velocity:0,isSync:!0,onUpdate:t=>{this.mixTargetDelta(t),e.onUpdate&&e.onUpdate(t)},onStop:()=>{Qv.layout--},onComplete:()=>{Qv.layout--,e.onComplete&&e.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);let e=this.getStack();e&&e.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners(`animationComplete`)}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(YT),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){let e=this.getLead(),{targetWithTransforms:t,target:n,layout:r,latestValues:i}=e;if(!(!t||!n||!r)){if(this!==e&&this.layout&&r&&wE(this.options.animationType,this.layout.layoutBox,r.layoutBox)){n=this.target||Q();let t=oT(this.layout.layoutBox.x);n.x.min=e.target.x.min,n.x.max=n.x.min+t;let r=oT(this.layout.layoutBox.y);n.y.min=e.target.y.min,n.y.max=n.y.min+r}eT(t,n),_w(t,i),lT(this.projectionDeltaWithTransform,this.layoutCorrected,t,i)}}registerSharedNode(e,t){this.sharedNodes.has(e)||this.sharedNodes.set(e,new GT),this.sharedNodes.get(e).add(t);let n=t.options.initialPromotionConfig;t.promote({transition:n?n.transition:void 0,preserveFollowOpacity:n&&n.shouldPreserveFollowOpacity?n.shouldPreserveFollowOpacity(t):void 0})}isLead(){let e=this.getStack();return e?e.lead===this:!0}getLead(){let{layoutId:e}=this.options;return e&&this.getStack()?.lead||this}getPrevLead(){let{layoutId:e}=this.options;return e?this.getStack()?.prevLead:void 0}getStack(){let{layoutId:e}=this.options;if(e)return this.root.sharedNodes.get(e)}promote({needsReset:e,transition:t,preserveFollowOpacity:n}={}){let r=this.getStack();r&&r.promote(this,n),e&&(this.projectionDelta=void 0,this.needsReset=!0),t&&this.setOptions({transition:t})}relegate(){let e=this.getStack();return e?e.relegate(this):!1}resetSkewAndRotation(){let{visualElement:e}=this.options;if(!e)return;let t=!1,{latestValues:n}=e;if((n.z||n.rotate||n.rotateX||n.rotateY||n.rotateZ||n.skewX||n.skewY)&&(t=!0),!t)return;let r={};n.z&&ZT(`z`,e,r,this.animationValues);for(let t=0;t<JT.length;t++)ZT(`rotate${JT[t]}`,e,r,this.animationValues),ZT(`skew${JT[t]}`,e,r,this.animationValues);e.render();for(let t in r)e.setStaticValue(t,r[t]),this.animationValues&&(this.animationValues[t]=r[t]);e.scheduleRender()}applyProjectionStyles(e,t){if(!this.instance||this.isSVG)return;if(!this.isVisible){e.visibility=`hidden`;return}let n=this.getTransformTemplate();if(this.needsReset){this.needsReset=!1,e.visibility=``,e.opacity=``,e.pointerEvents=WT(t?.pointerEvents)||``,e.transform=n?n(this.latestValues,``):`none`;return}let r=this.getLead();if(!this.projectionDelta||!this.layout||!r.target){this.options.layoutId&&(e.opacity=this.latestValues.opacity===void 0?1:this.latestValues.opacity,e.pointerEvents=WT(t?.pointerEvents)||``),this.hasProjected&&!iw(this.latestValues)&&(e.transform=n?n({},``):`none`,this.hasProjected=!1);return}e.visibility=``;let i=r.animationValues||r.latestValues;this.applyTransformsToTarget();let a=kT(this.projectionDeltaWithTransform,this.treeScale,i);n&&(a=n(i,a)),e.transform=a;let{x:o,y:s}=this.projectionDelta;e.transformOrigin=`${o.origin*100}% ${s.origin*100}% 0`,r.animationValues?e.opacity=r===this?i.opacity??this.latestValues.opacity??1:this.preserveOpacity?this.latestValues.opacity:i.opacityExit:e.opacity=r===this?i.opacity===void 0?``:i.opacity:i.opacityExit===void 0?0:i.opacityExit;for(let t in Ow){if(i[t]===void 0)continue;let{correct:n,applyTo:o,isCSSVariable:s}=Ow[t],c=a===`none`?i[t]:n(i[t],r);if(o){let t=o.length;for(let n=0;n<t;n++)e[o[n]]=c}else s?this.options.visualElement.renderState.vars[t]=c:e[t]=c}this.options.layoutId&&(e.pointerEvents=r===this?WT(t?.pointerEvents)||``:`none`)}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(e=>e.currentAnimation?.stop()),this.root.nodes.forEach(aE),this.root.sharedNodes.clear()}}}function eE(e){e.updateLayout()}function tE(e){let t=e.resumeFrom?.snapshot||e.snapshot;if(e.isLead()&&e.layout&&t&&e.hasListeners(`didUpdate`)){let{layoutBox:n,measuredBox:r}=e.layout,{animationType:i}=e.options,a=t.source!==e.layout.source;if(i===`size`)OT(e=>{let r=a?t.measuredBox[e]:t.layoutBox[e],i=oT(r);r.min=n[e].min,r.max=r.min+i});else if(i===`x`||i===`y`){let e=i===`x`?`y`:`x`;$w(a?t.measuredBox[e]:t.layoutBox[e],n[e])}else wE(i,t.layoutBox,n)&&OT(r=>{let i=a?t.measuredBox[r]:t.layoutBox[r],o=oT(n[r]);i.max=i.min+o,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[r].max=e.relativeTarget[r].min+o)});let o=MC();lT(o,n,t.layoutBox);let s=MC();a?lT(s,e.applyTransform(r,!0),t.measuredBox):lT(s,n,t.layoutBox);let c=!xT(o),l=!1;if(!e.resumeFrom){let r=e.getClosestProjectingParent();if(r&&!r.resumeFrom){let{snapshot:i,layout:a}=r;if(i&&a){let o=e.options.layoutAnchor||void 0,s=Q();pT(s,t.layoutBox,i.layoutBox,o);let c=Q();pT(c,n,a.layoutBox,o),TT(s,c)||(l=!0),r.options.layoutRoot&&(e.relativeTarget=c,e.relativeTargetOrigin=s,e.relativeParent=r)}}}e.notifyListeners(`didUpdate`,{layout:n,snapshot:t,delta:s,layoutDelta:o,hasLayoutChanged:c,hasRelativeLayoutChanged:l})}else if(e.isLead()){let{onExitComplete:t}=e.options;t&&t()}e.options.transition=void 0}function nE(e){Uv.value&&qT.nodes++,e.parent&&(e.isProjecting()||(e.isProjectionDirty=e.parent.isProjectionDirty),e.isSharedProjectionDirty||=!!(e.isProjectionDirty||e.parent.isProjectionDirty||e.parent.isSharedProjectionDirty),e.isTransformDirty||=e.parent.isTransformDirty)}function rE(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function iE(e){e.clearSnapshot()}function aE(e){e.clearMeasurements()}function oE(e){e.isLayoutDirty=!0,e.updateLayout()}function sE(e){e.isLayoutDirty=!1}function cE(e){e.isAnimationBlocked&&e.layout&&!e.isLayoutDirty&&(e.snapshot=e.layout,e.isLayoutDirty=!0)}function lE(e){let{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify(`BeforeLayoutMeasure`),e.resetTransform()}function uE(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function dE(e){e.resolveTargetDelta()}function fE(e){e.calcProjection()}function pE(e){e.resetSkewAndRotation()}function mE(e){e.removeLeadSnapshot()}function hE(e,t,n){e.translate=Y(t.translate,0,n),e.scale=Y(t.scale,1,n),e.origin=t.origin,e.originPoint=t.originPoint}function gE(e,t,n,r){e.min=Y(t.min,n.min,r),e.max=Y(t.max,n.max,r)}function _E(e,t,n,r){gE(e.x,t.x,n.x,r),gE(e.y,t.y,n.y,r)}function vE(e){return e.animationValues&&e.animationValues.opacityExit!==void 0}var yE={duration:.45,ease:[.4,0,.1,1]},bE=e=>typeof navigator<`u`&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),xE=bE(`applewebkit/`)&&!bE(`chrome/`)?Math.round:pv;function SE(e){e.min=xE(e.min),e.max=xE(e.max)}function CE(e){SE(e.x),SE(e.y)}function wE(e,t,n){return e===`position`||e===`preserve-aspect`&&!sT(ET(t),ET(n),.2)}function TE(e){return e!==e.root&&e.scroll?.wasRoot}var EE=$T({attachResizeListener:(e,t)=>BT(e,`resize`,t),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body?.scrollLeft||0,y:document.documentElement.scrollTop||document.body?.scrollTop||0}),checkIsScrollRoot:()=>!0}),DE={current:void 0},OE=$T({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!DE.current){let e=new EE({});e.mount(window),e.setOptions({layoutScroll:!0}),DE.current=e}return DE.current},resetTransform:(e,t)=>{e.style.transform=t===void 0?`none`:t},checkIsScrollRoot:e=>window.getComputedStyle(e).position===`fixed`}),kE=(0,N.createContext)({transformPagePoint:e=>e,isStatic:!1,reducedMotion:`never`});function AE(e=!0){let t=(0,N.useContext)(iv);if(t===null)return[!0,null];let{isPresent:n,onExitComplete:r,register:i}=t,a=(0,N.useId)();(0,N.useEffect)(()=>{if(e)return i(a)},[e]);let o=(0,N.useCallback)(()=>e&&r&&r(a),[a,r,e]);return!n&&r?[!1,o]:[!0]}var jE=(0,N.createContext)({strict:!1}),ME={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`]},NE=!1;function PE(){if(NE)return;let e={};for(let t in ME)e[t]={isEnabled:e=>ME[t].some(t=>!!e[t])};JC(e),NE=!0}function FE(){return PE(),YC()}function IE(e){let t=FE();for(let n in e)t[n]={...t[n],...e[n]};JC(t)}var LE=new Set(`animate.exit.variants.initial.style.values.variants.transition.transformTemplate.custom.inherit.onBeforeLayoutMeasure.onAnimationStart.onAnimationComplete.onUpdate.onDragStart.onDrag.onDragEnd.onMeasureDragConstraints.onDirectionLock.onDragTransitionEnd._dragX._dragY.onHoverStart.onHoverEnd.onViewportEnter.onViewportLeave.globalTapTarget.propagate.ignoreStrict.viewport`.split(`.`));function RE(e){return e.startsWith(`while`)||e.startsWith(`drag`)&&e!==`draggable`||e.startsWith(`layout`)||e.startsWith(`onTap`)||e.startsWith(`onPan`)||e.startsWith(`onLayout`)||LE.has(e)}function zE(e){var t=Object.create(null);return function(n){return t[n]===void 0&&(t[n]=e(n)),t[n]}}var BE=n((()=>{})),VE=r({default:()=>UE}),HE,UE,WE=n((()=>{BE(),HE=/^((children|dangerouslySetInnerHTML|key|ref|autoFocus|defaultValue|defaultChecked|innerHTML|suppressContentEditableWarning|suppressHydrationWarning|valueLink|abbr|accept|acceptCharset|accessKey|action|allow|allowUserMedia|allowPaymentRequest|allowFullScreen|allowTransparency|alt|async|autoComplete|autoPlay|capture|cellPadding|cellSpacing|challenge|charSet|checked|cite|classID|className|cols|colSpan|content|contentEditable|contextMenu|controls|controlsList|coords|crossOrigin|data|dateTime|decoding|default|defer|dir|disabled|disablePictureInPicture|disableRemotePlayback|download|draggable|encType|enterKeyHint|fetchpriority|fetchPriority|form|formAction|formEncType|formMethod|formNoValidate|formTarget|frameBorder|headers|height|hidden|high|href|hrefLang|htmlFor|httpEquiv|id|inputMode|integrity|is|keyParams|keyType|kind|label|lang|list|loading|loop|low|marginHeight|marginWidth|max|maxLength|media|mediaGroup|method|min|minLength|multiple|muted|name|nonce|noValidate|open|optimum|pattern|placeholder|playsInline|popover|popoverTarget|popoverTargetAction|poster|preload|profile|radioGroup|readOnly|referrerPolicy|rel|required|reversed|role|rows|rowSpan|sandbox|scope|scoped|scrolling|seamless|selected|shape|size|sizes|slot|span|spellCheck|src|srcDoc|srcLang|srcSet|start|step|style|summary|tabIndex|target|title|translate|type|useMap|value|width|wmode|wrap|about|datatype|inlist|prefix|property|resource|typeof|vocab|autoCapitalize|autoCorrect|autoSave|color|incremental|fallback|inert|itemProp|itemScope|itemType|itemID|itemRef|on|option|results|security|unselectable|accentHeight|accumulate|additive|alignmentBaseline|allowReorder|alphabetic|amplitude|arabicForm|ascent|attributeName|attributeType|autoReverse|azimuth|baseFrequency|baselineShift|baseProfile|bbox|begin|bias|by|calcMode|capHeight|clip|clipPathUnits|clipPath|clipRule|colorInterpolation|colorInterpolationFilters|colorProfile|colorRendering|contentScriptType|contentStyleType|cursor|cx|cy|d|decelerate|descent|diffuseConstant|direction|display|divisor|dominantBaseline|dur|dx|dy|edgeMode|elevation|enableBackground|end|exponent|externalResourcesRequired|fill|fillOpacity|fillRule|filter|filterRes|filterUnits|floodColor|floodOpacity|focusable|fontFamily|fontSize|fontSizeAdjust|fontStretch|fontStyle|fontVariant|fontWeight|format|from|fr|fx|fy|g1|g2|glyphName|glyphOrientationHorizontal|glyphOrientationVertical|glyphRef|gradientTransform|gradientUnits|hanging|horizAdvX|horizOriginX|ideographic|imageRendering|in|in2|intercept|k|k1|k2|k3|k4|kernelMatrix|kernelUnitLength|kerning|keyPoints|keySplines|keyTimes|lengthAdjust|letterSpacing|lightingColor|limitingConeAngle|local|markerEnd|markerMid|markerStart|markerHeight|markerUnits|markerWidth|mask|maskContentUnits|maskUnits|mathematical|mode|numOctaves|offset|opacity|operator|order|orient|orientation|origin|overflow|overlinePosition|overlineThickness|panose1|paintOrder|pathLength|patternContentUnits|patternTransform|patternUnits|pointerEvents|points|pointsAtX|pointsAtY|pointsAtZ|preserveAlpha|preserveAspectRatio|primitiveUnits|r|radius|refX|refY|renderingIntent|repeatCount|repeatDur|requiredExtensions|requiredFeatures|restart|result|rotate|rx|ry|scale|seed|shapeRendering|slope|spacing|specularConstant|specularExponent|speed|spreadMethod|startOffset|stdDeviation|stemh|stemv|stitchTiles|stopColor|stopOpacity|strikethroughPosition|strikethroughThickness|string|stroke|strokeDasharray|strokeDashoffset|strokeLinecap|strokeLinejoin|strokeMiterlimit|strokeOpacity|strokeWidth|surfaceScale|systemLanguage|tableValues|targetX|targetY|textAnchor|textDecoration|textRendering|textLength|to|transform|u1|u2|underlinePosition|underlineThickness|unicode|unicodeBidi|unicodeRange|unitsPerEm|vAlphabetic|vHanging|vIdeographic|vMathematical|values|vectorEffect|version|vertAdvY|vertOriginX|vertOriginY|viewBox|viewTarget|visibility|widths|wordSpacing|writingMode|x|xHeight|x1|x2|xChannelSelector|xlinkActuate|xlinkArcrole|xlinkHref|xlinkRole|xlinkShow|xlinkTitle|xlinkType|xmlBase|xmlns|xmlnsXlink|xmlLang|xmlSpace|y|y1|y2|yChannelSelector|z|zoomAndPan|for|class|autofocus)|(([Dd][Aa][Tt][Aa]|[Aa][Rr][Ii][Aa]|x)-.*))$/,UE=zE(function(e){return HE.test(e)||e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&e.charCodeAt(2)<91})})),GE=e=>!RE(e);function KE(e){typeof e==`function`&&(GE=t=>t.startsWith(`on`)?!RE(t):e(t))}try{KE((WE(),t(VE)).default)}catch{}function qE(e,t,n){let r={};for(let i in e)i===`values`&&typeof e.values==`object`||Z(e[i])||(GE(i)||n===!0&&RE(i)||!t&&!RE(i)||e.draggable&&i.startsWith(`onDrag`))&&(r[i]=e[i]);return r}var JE=(0,N.createContext)({});function YE(e,t){if(zC(e)){let{initial:t,animate:n}=e;return{initial:t===!1||IC(t)?t:void 0,animate:IC(n)?n:void 0}}return e.inherit===!1?{}:t}function XE(e){let{initial:t,animate:n}=YE(e,(0,N.useContext)(JE));return(0,N.useMemo)(()=>({initial:t,animate:n}),[ZE(t),ZE(n)])}function ZE(e){return Array.isArray(e)?e.join(` `):e}var QE=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function $E(e,t,n){for(let r in t)!Z(t[r])&&!kw(r,n)&&(e[r]=t[r])}function eD({transformTemplate:e},t){return(0,N.useMemo)(()=>{let n=QE();return Cw(n,t,e),Object.assign({},n.vars,n.style)},[t])}function tD(e,t){let n=e.style||{},r={};return $E(r,n,e),Object.assign(r,eD(e,t)),r}function nD(e,t){let n={},r=tD(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 rD=()=>({...QE(),attrs:{}});function iD(e,t,n,r){let i=(0,N.useMemo)(()=>{let n=rD();return Lw(n,t,zw(r),e.transformTemplate,e.style),{...n.attrs,style:{...n.style}}},[t]);if(e.style){let t={};$E(t,e.style,e),i.style={...t,...i.style}}return i}var aD=[`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 oD(e){return typeof e!=`string`||e.includes(`-`)?!1:!!(aD.indexOf(e)>-1||/[A-Z]/u.test(e))}function sD(e,t,n,{latestValues:r},i,a=!1,o){let s=(o??oD(e)?iD:nD)(t,r,i,e),c=qE(t,typeof e==`string`,a),l=e===N.Fragment?{}:{...c,...s,ref:n},{children:u}=t,d=(0,N.useMemo)(()=>Z(u)?u.get():u,[u]);return(0,N.createElement)(e,{...l,children:d})}function cD({scrapeMotionValuesFromProps:e,createRenderState:t},n,r,i){return{latestValues:lD(n,r,i,e),renderState:t()}}function lD(e,t,n,r){let i={},a=r(e,{});for(let e in a)i[e]=WT(a[e]);let{initial:o,animate:s}=e,c=zC(e),l=BC(e);t&&l&&!c&&e.inherit!==!1&&(o===void 0&&(o=t.initial),s===void 0&&(s=t.animate));let u=n?n.initial===!1:!1;u||=o===!1;let d=u?s:o;if(d&&typeof d!=`boolean`&&!FC(d)){let t=Array.isArray(d)?d:[d];for(let n=0;n<t.length;n++){let r=sS(e,t[n]);if(r){let{transitionEnd:e,transition:t,...n}=r;for(let e in n){let t=n[e];if(Array.isArray(t)){let e=u?t.length-1:0;t=t[e]}t!==null&&(i[e]=t)}for(let t in e)i[t]=e[t]}}}return i}var uD=e=>(t,n)=>{let r=(0,N.useContext)(JE),i=(0,N.useContext)(iv),a=()=>cD(e,t,r,i);return n?a():nv(a)},dD=uD({scrapeMotionValuesFromProps:Aw,createRenderState:QE}),fD=uD({scrapeMotionValuesFromProps:Vw,createRenderState:rD}),pD=Symbol.for(`motionComponentSymbol`);function mD(e,t,n){let r=(0,N.useRef)(n);(0,N.useInsertionEffect)(()=>{r.current=n});let i=(0,N.useRef)(null);return(0,N.useCallback)(n=>{n&&e.onMount?.(n),t&&(n?t.mount(n):t.unmount());let a=r.current;if(typeof a==`function`)if(n){let e=a(n);typeof e==`function`&&(i.current=e)}else i.current?(i.current(),i.current=null):a(n);else a&&(a.current=n)},[t])}var hD=(0,N.createContext)({});function gD(e){return e&&typeof e==`object`&&Object.prototype.hasOwnProperty.call(e,`current`)}function _D(e,t,n,r,i,a){let{visualElement:o}=(0,N.useContext)(JE),s=(0,N.useContext)(jE),c=(0,N.useContext)(iv),l=(0,N.useContext)(kE),u=l.reducedMotion,d=l.skipAnimations,f=(0,N.useRef)(null),p=(0,N.useRef)(!1);r||=s.renderer,!f.current&&r&&(f.current=r(e,{visualState:t,parent:o,props:n,presenceContext:c,blockInitialAnimation:c?c.initial===!1:!1,reducedMotionConfig:u,skipAnimations:d,isSVG:a}),p.current&&f.current&&(f.current.manuallyAnimateOnMount=!0));let m=f.current,h=(0,N.useContext)(hD);m&&!m.projection&&i&&(m.type===`html`||m.type===`svg`)&&vD(f.current,n,i,h);let g=(0,N.useRef)(!1);(0,N.useInsertionEffect)(()=>{m&&g.current&&m.update(n,c)});let _=n[_S],v=(0,N.useRef)(!!_&&typeof window<`u`&&!window.MotionHandoffIsComplete?.(_)&&window.MotionHasOptimisedAnimation?.(_));return rv(()=>{p.current=!0,m&&(g.current=!0,window.MotionIsMounted=!0,m.updateFeatures(),m.scheduleRenderMicrotask(),v.current&&m.animationState&&m.animationState.animateChanges())}),(0,N.useEffect)(()=>{m&&(!v.current&&m.animationState&&m.animationState.animateChanges(),v.current&&=(queueMicrotask(()=>{window.MotionHandoffMarkAsComplete?.(_)}),!1),m.enteringChildren=void 0)}),m}function vD(e,t,n,r){let{layoutId:i,layout:a,drag:o,dragConstraints:s,layoutScroll:c,layoutRoot:l,layoutAnchor:u,layoutCrossfade:d}=t;e.projection=new n(e.latestValues,t[`data-framer-portal-id`]?void 0:yD(e.parent)),e.projection.setOptions({layoutId:i,layout:a,alwaysMeasureLayout:!!o||s&&gD(s),visualElement:e,animationType:typeof a==`string`?a:`both`,initialPromotionConfig:r,crossfade:d,layoutScroll:c,layoutRoot:l,layoutAnchor:u})}function yD(e){if(e)return e.options.allowProjection===!1?yD(e.parent):e.projection}function bD(e,{forwardMotionProps:t=!1,type:n}={},r,i){r&&IE(r);let a=n?n===`svg`:oD(e),o=a?fD:dD;function s(n,s){let c,l={...(0,N.useContext)(kE),...n,layoutId:xD(n)},{isStatic:u}=l,d=XE(n),f=o(n,u);if(!u&&typeof window<`u`){SD(l,r);let t=CD(l);c=t.MeasureLayout,d.visualElement=_D(e,f,l,i,t.ProjectionNode,a)}return(0,P.jsxs)(JE.Provider,{value:d,children:[c&&d.visualElement?(0,P.jsx)(c,{visualElement:d.visualElement,...l}):null,sD(e,n,mD(f,d.visualElement,s),f,u,t,a)]})}s.displayName=`motion.${typeof e==`string`?e:`create(${e.displayName??e.name??``})`}`;let c=(0,N.forwardRef)(s);return c[pD]=e,c}function xD({layoutId:e}){let t=(0,N.useContext)(tv).id;return t&&e!==void 0?t+`-`+e:e}function SD(e,t){(0,N.useContext)(jE).strict}function CD(e){let{drag:t,layout:n}=FE();if(!t&&!n)return{};let r={...t,...n};return{MeasureLayout:t?.isEnabled(e)||n?.isEnabled(e)?r.MeasureLayout:void 0,ProjectionNode:r.ProjectionNode}}function wD(e,t){if(typeof Proxy>`u`)return bD;let n=new Map,r=(n,r)=>bD(n,r,e,t);return new Proxy((e,t)=>r(e,t),{get:(i,a)=>a===`create`?r:(n.has(a)||n.set(a,bD(a,void 0,e,t)),n.get(a))})}var TD=(e,t)=>t.isSVG??oD(e)?new Hw(t):new Mw(t,{allowProjection:e!==N.Fragment}),ED=class extends QC{constructor(e){super(e),e.animationState||=Yw(e)}updateAnimationControlsSubscription(){let{animate:e}=this.node.getProps();FC(e)&&(this.unmountControls=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){let{animate:e}=this.node.getProps(),{animate:t}=this.node.prevProps||{};e!==t&&this.updateAnimationControlsSubscription()}unmount(){this.node.animationState.reset(),this.unmountControls?.()}},DD=0,OD={animation:{Feature:ED},exit:{Feature:class extends QC{constructor(){super(...arguments),this.id=DD++,this.isExitComplete=!1}update(){if(!this.node.presenceContext)return;let{isPresent:e,onExitComplete:t}=this.node.presenceContext,{isPresent:n}=this.node.prevPresenceContext||{};if(!this.node.animationState||e===n)return;if(e&&n===!1){if(this.isExitComplete){let{initial:e,custom:t}=this.node.getProps();if(typeof e==`string`||typeof e==`object`&&e&&!Array.isArray(e)){let n=cS(this.node,e,t);if(n){let{transition:e,transitionEnd:t,...r}=n;for(let e in r)this.node.getValue(e)?.jump(r[e])}}this.node.animationState.reset(),this.node.animationState.animateChanges()}else this.node.animationState.setActive(`exit`,!1);this.isExitComplete=!1;return}let r=this.node.animationState.setActive(`exit`,!e);t&&!e&&r.then(()=>{this.isExitComplete=!0,t(this.id)})}mount(){let{register:e,onExitComplete:t}=this.node.presenceContext||{};t&&t(this.id),e&&(this.unmount=e(this.id))}unmount(){}}}};function kD(e){return{point:{x:e.pageX,y:e.pageY}}}var AD=e=>t=>tC(t)&&e(t,kD(t));function jD(e,t,n,r){return BT(e,t,AD(n),r)}var MD=({current:e})=>e?e.ownerDocument.defaultView:null,ND=(e,t)=>Math.abs(e-t);function PD(e,t){let n=ND(e.x,t.x),r=ND(e.y,t.y);return Math.sqrt(n**2+r**2)}var FD=new Set([`auto`,`scroll`]),ID=class{constructor(e,t,{transformPagePoint:n,contextWindow:r=window,dragSnapToOrigin:i=!1,distanceThreshold:a=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=e=>{this.handleScroll(e.target)},this.onWindowScroll=()=>{this.handleScroll(window)},this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;this.lastRawMoveEventInfo&&(this.lastMoveEventInfo=LD(this.lastRawMoveEventInfo,this.transformPagePoint));let e=zD(this.lastMoveEventInfo,this.history),t=this.startEvent!==null,n=PD(e.offset,{x:0,y:0})>=this.distanceThreshold;if(!t&&!n)return;let{point:r}=e,{timestamp:i}=K;this.history.push({...r,timestamp:i});let{onStart:a,onMove:o}=this.handlers;t||(a&&a(this.lastMoveEvent,e),this.startEvent=this.lastMoveEvent),o&&o(this.lastMoveEvent,e)},this.handlePointerMove=(e,t)=>{this.lastMoveEvent=e,this.lastRawMoveEventInfo=t,this.lastMoveEventInfo=LD(t,this.transformPagePoint),G.update(this.updatePoint,!0)},this.handlePointerUp=(e,t)=>{this.end();let{onEnd:n,onSessionEnd:r,resumeAnimation:i}=this.handlers;if((this.dragSnapToOrigin||!this.startEvent)&&i&&i(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;let a=zD(e.type===`pointercancel`?this.lastMoveEventInfo:LD(t,this.transformPagePoint),this.history);this.startEvent&&n&&n(e,a),r&&r(e,a)},!tC(e))return;this.dragSnapToOrigin=i,this.handlers=t,this.transformPagePoint=n,this.distanceThreshold=a,this.contextWindow=r||window;let s=LD(kD(e),this.transformPagePoint),{point:c}=s,{timestamp:l}=K;this.history=[{...c,timestamp:l}];let{onSessionStart:u}=t;u&&u(e,zD(s,this.history)),this.removeListeners=mv(jD(this.contextWindow,`pointermove`,this.handlePointerMove),jD(this.contextWindow,`pointerup`,this.handlePointerUp),jD(this.contextWindow,`pointercancel`,this.handlePointerUp)),o&&this.startScrollTracking(o)}startScrollTracking(e){let t=e.parentElement;for(;t;){let e=getComputedStyle(t);(FD.has(e.overflowX)||FD.has(e.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){let t=this.scrollPositions.get(e);if(!t)return;let n=e===window,r=n?{x:window.scrollX,y:window.scrollY}:{x:e.scrollLeft,y:e.scrollTop},i={x:r.x-t.x,y:r.y-t.y};i.x===0&&i.y===0||(n?this.lastMoveEventInfo&&(this.lastMoveEventInfo.point.x+=i.x,this.lastMoveEventInfo.point.y+=i.y):this.history.length>0&&(this.history[0].x-=i.x,this.history[0].y-=i.y),this.scrollPositions.set(e,r),G.update(this.updatePoint,!0))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),this.removeScrollListeners&&this.removeScrollListeners(),this.scrollPositions.clear(),qv(this.updatePoint)}};function LD(e,t){return t?{point:t(e.point)}:e}function RD(e,t){return{x:e.x-t.x,y:e.y-t.y}}function zD({point:e},t){return{point:e,delta:RD(e,VD(t)),offset:RD(e,BD(t)),velocity:HD(t,.1)}}function BD(e){return e[0]}function VD(e){return e[e.length-1]}function HD(e,t){if(e.length<2)return{x:0,y:0};let n=e.length-1,r=null,i=VD(e);for(;n>=0&&(r=e[n],!(i.timestamp-r.timestamp>_v(t)));)n--;if(!r)return{x:0,y:0};r===e[0]&&e.length>2&&i.timestamp-r.timestamp>_v(t)*2&&(r=e[1]);let a=vv(i.timestamp-r.timestamp);if(a===0)return{x:0,y:0};let o={x:(i.x-r.x)/a,y:(i.y-r.y)/a};return o.x===1/0&&(o.x=0),o.y===1/0&&(o.y=0),o}function UD(e,{min:t,max:n},r){return t!==void 0&&e<t?e=r?Y(t,e,r.min):Math.max(e,t):n!==void 0&&e>n&&(e=r?Y(n,e,r.max):Math.min(e,n)),e}function WD(e,t,n){return{min:t===void 0?void 0:e.min+t,max:n===void 0?void 0:e.max+n-(e.max-e.min)}}function GD(e,{top:t,left:n,bottom:r,right:i}){return{x:WD(e.x,n,i),y:WD(e.y,t,r)}}function KD(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 qD(e,t){return{x:KD(e.x,t.x),y:KD(e.y,t.y)}}function JD(e,t){let n=.5,r=oT(e),i=oT(t);return i>r?n=hv(t.min,t.max-r,e.min):r>i&&(n=hv(e.min,e.max-i,t.min)),sv(0,1,n)}function YD(e,t){let n={};return t.min!==void 0&&(n.min=t.min-e.min),t.max!==void 0&&(n.max=t.max-e.min),n}var XD=.35;function ZD(e=XD){return e===!1?e=0:e===!0&&(e=XD),{x:QD(e,`left`,`right`),y:QD(e,`top`,`bottom`)}}function QD(e,t,n){return{min:$D(e,t),max:$D(e,n)}}function $D(e,t){return typeof e==`number`?e:e[t]||0}var eO=new WeakMap,tO=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=Q(),this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=e}start(e,{snapToCursor:t=!1,distanceThreshold:n}={}){let{presenceContext:r}=this.visualElement;if(r&&r.isPresent===!1)return;let i=e=>{t&&this.snapToCursor(kD(e).point),this.stopAnimation()},a=(e,t)=>{let{drag:n,dragPropagation:r,onDragStart:i}=this.getProps();if(n&&!r&&(this.openDragLock&&this.openDragLock(),this.openDragLock=XS(n),!this.openDragLock))return;this.latestPointerEvent=e,this.latestPanInfo=t,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),OT(e=>{let t=this.getAxisMotionValue(e).get()||0;if(xy.test(t)){let{projection:n}=this.visualElement;if(n&&n.layout){let r=n.layout.layoutBox[e];r&&(t=oT(r)*(parseFloat(t)/100))}}this.originPoint[e]=t}),i&&G.update(()=>i(e,t),!1,!0),hS(this.visualElement,`transform`);let{animationState:a}=this.visualElement;a&&a.setActive(`whileDrag`,!0)},o=(e,t)=>{this.latestPointerEvent=e,this.latestPanInfo=t;let{dragPropagation:n,dragDirectionLock:r,onDirectionLock:i,onDrag:a}=this.getProps();if(!n&&!this.openDragLock)return;let{offset:o}=t;if(r&&this.currentDirection===null){this.currentDirection=aO(o),this.currentDirection!==null&&i&&i(this.currentDirection);return}this.updateAxis(`x`,t.point,o),this.updateAxis(`y`,t.point,o),this.visualElement.render(),a&&G.update(()=>a(e,t),!1,!0)},s=(e,t)=>{this.latestPointerEvent=e,this.latestPanInfo=t,this.stop(e,t),this.latestPointerEvent=null,this.latestPanInfo=null},c=()=>{let{dragSnapToOrigin:e}=this.getProps();(e||this.constraints)&&this.startAnimation({x:0,y:0})},{dragSnapToOrigin:l}=this.getProps();this.panSession=new ID(e,{onSessionStart:i,onStart:a,onMove:o,onSessionEnd:s,resumeAnimation:c},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:l,distanceThreshold:n,contextWindow:MD(this.visualElement),element:this.visualElement.current})}stop(e,t){let n=e||this.latestPointerEvent,r=t||this.latestPanInfo,i=this.isDragging;if(this.cancel(),!i||!r||!n)return;let{velocity:a}=r;this.startAnimation(a);let{onDragEnd:o}=this.getProps();o&&G.postRender(()=>o(n,r))}cancel(){this.isDragging=!1;let{projection:e,animationState:t}=this.visualElement;e&&(e.isAnimationBlocked=!1),this.endPanSession();let{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){let{drag:r}=this.getProps();if(!n||!iO(e,r,this.currentDirection))return;let i=this.getAxisMotionValue(e),a=this.originPoint[e]+n[e];this.constraints&&this.constraints[e]&&(a=UD(a,this.constraints[e],this.elastic[e])),i.set(a)}resolveConstraints(){let{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&&gD(e)?this.constraints||=this.resolveRefConstraints():e&&n?this.constraints=GD(n.layoutBox,e):this.constraints=!1,this.elastic=ZD(t),r!==this.constraints&&!gD(e)&&n&&this.constraints&&!this.hasMutatedConstraints&&OT(e=>{this.constraints!==!1&&this.getAxisMotionValue(e)&&(this.constraints[e]=YD(n.layoutBox[e],this.constraints[e]))})}resolveRefConstraints(){let{dragConstraints:e,onMeasureDragConstraints:t}=this.getProps();if(!e||!gD(e))return!1;let n=e.current,{projection:r}=this.visualElement;if(!r||!r.layout)return!1;r.root&&(r.root.scroll=void 0,r.root.updateScroll());let i=yw(n,r.root,this.visualElement.getTransformPagePoint()),a=qD(r.layout.layoutBox,i);if(t){let e=t(ew(a));this.hasMutatedConstraints=!!e,e&&(a=$C(e))}return a}startAnimation(e){let{drag:t,dragMomentum:n,dragElastic:r,dragTransition:i,dragSnapToOrigin:a,onDragTransitionEnd:o}=this.getProps(),s=this.constraints||{},c=OT(o=>{if(!iO(o,t,this.currentDirection))return;let c=s&&s[o]||{};(a===!0||a===o)&&(c={min:0,max:0});let l=r?200:1e6,u=r?40:1e7,d={type:`inertia`,velocity:n?e[o]:0,bounceStiffness:l,bounceDamping:u,timeConstant:750,restDelta:1,restSpeed:10,...i,...c};return this.startAxisValueAnimation(o,d)});return Promise.all(c).then(o)}startAxisValueAnimation(e,t){let n=this.getAxisMotionValue(e);return hS(this.visualElement,e),n.start(nS(e,n,0,t,this.visualElement,!1))}stopAnimation(){OT(e=>this.getAxisMotionValue(e).stop())}getAxisMotionValue(e){let t=`_drag${e.toUpperCase()}`;return this.visualElement.getProps()[t]||this.visualElement.getValue(e,this.visualElement.latestValues[e]??0)}snapToCursor(e){OT(t=>{let{drag:n}=this.getProps();if(!iO(t,n,this.currentDirection))return;let{projection:r}=this.visualElement,i=this.getAxisMotionValue(t);if(r&&r.layout){let{min:n,max:a}=r.layout.layoutBox[t],o=i.get()||0;i.set(e[t]-Y(n,a,.5)+o)}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;let{drag:e,dragConstraints:t}=this.getProps(),{projection:n}=this.visualElement;if(!gD(t)||!n||!this.constraints)return;this.stopAnimation();let r={x:0,y:0};OT(e=>{let t=this.getAxisMotionValue(e);if(t&&this.constraints!==!1){let n=t.get();r[e]=JD({min:n,max:n},this.constraints[e])}});let{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(),OT(t=>{if(!iO(t,e,null))return;let n=this.getAxisMotionValue(t),{min:i,max:a}=this.constraints[t];n.set(Y(i,a,r[t]))}),this.visualElement.render()}addListeners(){if(!this.visualElement.current)return;eO.set(this.visualElement,this);let e=this.visualElement.current,t=jD(e,`pointerdown`,t=>{let{drag:n,dragListener:r=!0}=this.getProps(),i=t.target,a=i!==e&&aC(i);n&&r&&!a&&this.start(t)}),n,r=()=>{let{dragConstraints:t}=this.getProps();gD(t)&&t.current&&(this.constraints=this.resolveRefConstraints(),n||=rO(e,t.current,()=>this.scalePositionWithinConstraints()))},{projection:i}=this.visualElement,a=i.addEventListener(`measure`,r);i&&!i.layout&&(i.root&&i.root.updateScroll(),i.updateLayout()),G.read(r);let o=BT(window,`resize`,()=>this.scalePositionWithinConstraints()),s=i.addEventListener(`didUpdate`,(({delta:e,hasLayoutChanged:t})=>{this.isDragging&&t&&(OT(t=>{let n=this.getAxisMotionValue(t);n&&(this.originPoint[t]+=e[t].translate,n.set(n.get()+e[t].translate))}),this.visualElement.render())}));return()=>{o(),t(),a(),s&&s(),n&&n()}}getProps(){let e=this.visualElement.getProps(),{drag:t=!1,dragDirectionLock:n=!1,dragPropagation:r=!1,dragConstraints:i=!1,dragElastic:a=XD,dragMomentum:o=!0}=e;return{...e,drag:t,dragDirectionLock:n,dragPropagation:r,dragConstraints:i,dragElastic:a,dragMomentum:o}}};function nO(e){let t=!0;return()=>{if(t){t=!1;return}e()}}function rO(e,t,n){let r=DC(e,nO(n)),i=DC(t,nO(n));return()=>{r(),i()}}function iO(e,t,n){return(t===!0||t===e)&&(n===null||n===e)}function aO(e,t=10){let n=null;return Math.abs(e.y)>t?n=`y`:Math.abs(e.x)>t&&(n=`x`),n}var oO=class extends QC{constructor(e){super(e),this.removeGroupControls=pv,this.removeListeners=pv,this.controls=new tO(e)}mount(){let{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||pv}update(){let{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()}},sO=e=>(t,n)=>{e&&G.update(()=>e(t,n),!1,!0)},cO=class extends QC{constructor(){super(...arguments),this.removePointerDownListener=pv}onPointerDown(e){this.session=new ID(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:MD(this.node)})}createPanHandlers(){let{onPanSessionStart:e,onPanStart:t,onPan:n,onPanEnd:r}=this.node.getProps();return{onSessionStart:sO(e),onStart:sO(t),onMove:sO(n),onEnd:(e,t)=>{delete this.session,r&&G.postRender(()=>r(e,t))}}}mount(){this.removePointerDownListener=jD(this.node.current,`pointerdown`,e=>this.onPointerDown(e))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}},lO=!1,uO=class extends N.Component{componentDidMount(){let{visualElement:e,layoutGroup:t,switchLayoutGroup:n,layoutId:r}=this.props,{projection:i}=e;i&&(t.group&&t.group.add(i),n&&n.register&&r&&n.register(i),lO&&i.root.didUpdate(),i.addEventListener(`animationComplete`,()=>{this.safeToRemove()}),i.setOptions({...i.options,layoutDependency:this.props.layoutDependency,onExitComplete:()=>this.safeToRemove()})),KT.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){let{layoutDependency:t,visualElement:n,drag:r,isPresent:i}=this.props,{projection:a}=n;return a?(a.isPresent=i,e.layoutDependency!==t&&a.setOptions({...a.options,layoutDependency:t}),lO=!0,r||e.layoutDependency!==t||t===void 0||e.isPresent!==i?a.willUpdate():this.safeToRemove(),e.isPresent!==i&&(i?a.promote():a.relegate()||G.postRender(()=>{let e=a.getStack();(!e||!e.members.length)&&this.safeToRemove()})),null):null}componentDidUpdate(){let{visualElement:e,layoutAnchor:t}=this.props,{projection:n}=e;n&&(n.options.layoutAnchor=t,n.root.didUpdate(),KS.postRender(()=>{!n.currentAnimation&&n.isLead()&&this.safeToRemove()}))}componentWillUnmount(){let{visualElement:e,layoutGroup:t,switchLayoutGroup:n}=this.props,{projection:r}=e;lO=!0,r&&(r.scheduleCheckAfterUnmount(),t&&t.group&&t.group.remove(r),n&&n.deregister&&n.deregister(r))}safeToRemove(){let{safeToRemove:e}=this.props;e&&e()}render(){return null}};function dO(e){let[t,n]=AE(),r=(0,N.useContext)(tv);return(0,P.jsx)(uO,{...e,layoutGroup:r,switchLayoutGroup:(0,N.useContext)(hD),isPresent:t,safeToRemove:n})}var fO={pan:{Feature:cO},drag:{Feature:oO,ProjectionNode:OE,MeasureLayout:dO}};function pO(e,t,n){let{props:r}=e;e.animationState&&r.whileHover&&e.animationState.setActive(`whileHover`,n===`Start`);let i=r[`onHover`+n];i&&G.postRender(()=>i(t,kD(t)))}var mO=class extends QC{mount(){let{current:e}=this.node;e&&(this.unmount=$S(e,(e,t)=>(pO(this.node,t,`Start`),e=>pO(this.node,e,`End`))))}unmount(){}},hO=class extends QC{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=mv(BT(this.node.current,`focus`,()=>this.onFocus()),BT(this.node.current,`blur`,()=>this.onBlur()))}unmount(){}};function gO(e,t,n){let{props:r}=e;if(e.current instanceof HTMLButtonElement&&e.current.disabled)return;e.animationState&&r.whileTap&&e.animationState.setActive(`whileTap`,n===`Start`);let i=r[`onTap`+(n===`End`?``:n)];i&&G.postRender(()=>i(t,kD(t)))}var _O=class extends QC{mount(){let{current:e}=this.node;if(!e)return;let{globalTapTarget:t,propagate:n}=this.node.props;this.unmount=fC(e,(e,t)=>(gO(this.node,t,`Start`),(e,{success:t})=>gO(this.node,e,t?`End`:`Cancel`)),{useGlobalTarget:t,stopPropagation:n?.tap===!1})}unmount(){}},vO=new WeakMap,yO=new WeakMap,bO=e=>{let t=vO.get(e.target);t&&t(e)},xO=e=>{e.forEach(bO)};function SO({root:e,...t}){let n=e||document;yO.has(n)||yO.set(n,{});let r=yO.get(n),i=JSON.stringify(t);return r[i]||(r[i]=new IntersectionObserver(xO,{root:e,...t})),r[i]}function CO(e,t,n){let r=SO(t);return vO.set(e,n),r.observe(e),()=>{vO.delete(e),r.unobserve(e)}}var wO={some:0,all:1},TO=class extends QC{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.stopObserver?.();let{viewport:e={}}=this.node.getProps(),{root:t,margin:n,amount:r=`some`,once:i}=e,a={root:t?t.current:void 0,rootMargin:n,threshold:typeof r==`number`?r:wO[r]},o=e=>{let{isIntersecting:t}=e;if(this.isInView===t||(this.isInView=t,i&&!t&&this.hasEnteredView))return;t&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive(`whileInView`,t);let{onViewportEnter:n,onViewportLeave:r}=this.node.getProps(),a=t?n:r;a&&a(e)};this.stopObserver=CO(this.node.current,a,o)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>`u`)return;let{props:e,prevProps:t}=this.node;[`amount`,`margin`,`root`].some(EO(e,t))&&this.startObserver()}unmount(){this.stopObserver?.(),this.hasEnteredView=!1,this.isInView=!1}};function EO({viewport:e={}},{viewport:t={}}={}){return n=>e[n]!==t[n]}var DO={inView:{Feature:TO},tap:{Feature:_O},focus:{Feature:hO},hover:{Feature:mO}},OO={layout:{ProjectionNode:OE,MeasureLayout:dO}},kO=wD({...OD,...DO,...fO,...OO},TD),AO=new Map,jO=e=>{let t=AO.get(e);return t||(t=kO.create(e),AO.set(e,t)),t},MO=(0,N.memo)(({children:e,as:t=`p`,className:n,duration:r=2,spread:i=2})=>{let a=jO(t),o=(0,N.useMemo)(()=>(e?.length??0)*i,[e,i]);return(0,P.jsx)(a,{animate:{backgroundPosition:`0% center`},className:l(`relative inline-block bg-[length:250%_100%,auto] bg-clip-text text-transparent`,`[--bg:linear-gradient(90deg,#0000_calc(50%-var(--spread)),var(--color-background),#0000_calc(50%+var(--spread)))] [background-repeat:no-repeat,padding-box]`,n),initial:{backgroundPosition:`100% center`},style:{"--spread":`${o}px`,backgroundImage:`var(--bg), linear-gradient(var(--color-muted-foreground), var(--color-muted-foreground))`},transition:{duration:r,ease:`linear`,repeat:1/0},children:e})}),NO=(0,N.createContext)(null),PO=()=>{let e=(0,N.useContext)(NO);if(!e)throw Error(`Reasoning components must be used within Reasoning`);return e},FO=1e3,IO=1e3,LO=(0,N.memo)(({className:e,isStreaming:t=!1,open:n,defaultOpen:r,onOpenChange:i,duration:a,children:o,...s})=>{let c=r??t,u=r===!1,[d,f]=Ep({defaultProp:c,onChange:i,prop:n}),[p,m]=Ep({defaultProp:void 0,prop:a}),h=(0,N.useRef)(t),[g,_]=(0,N.useState)(!1),v=(0,N.useRef)(null);(0,N.useEffect)(()=>{t?(h.current=!0,v.current===null&&(v.current=Date.now())):v.current!==null&&(m(Math.ceil((Date.now()-v.current)/IO)),v.current=null)},[t,m]),(0,N.useEffect)(()=>{t&&!d&&!u&&f(!0)},[t,d,f,u]),(0,N.useEffect)(()=>{if(h.current&&!t&&d&&!g){let e=setTimeout(()=>{f(!1),_(!0)},FO);return()=>clearTimeout(e)}},[t,d,f,g]);let y=(0,N.useCallback)(e=>{f(e)},[f]),b=(0,N.useMemo)(()=>({duration:p,isOpen:d,isStreaming:t,setIsOpen:f}),[p,d,t,f]);return(0,P.jsx)(NO.Provider,{value:b,children:(0,P.jsx)(Q_,{className:l(`not-prose mb-4`,e),onOpenChange:y,open:d,...s,children:o})})}),RO=(e,t)=>e||t===0?(0,P.jsx)(MO,{duration:1,children:`Thinking...`}):t===void 0?(0,P.jsx)(`p`,{children:`Thought for a few seconds`}):(0,P.jsxs)(`p`,{children:[`Thought for `,t,` seconds`]}),zO=(0,N.memo)(({className:e,children:t,getThinkingMessage:n=RO,...r})=>{let{isStreaming:i,isOpen:a,duration:o}=PO();return(0,P.jsx)($_,{className:l(`flex w-full items-center gap-2 text-muted-foreground text-sm transition-colors hover:text-foreground`,e),...r,children:t??(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(nt,{className:`size-4`}),n(i,o),(0,P.jsx)(k,{className:l(`size-4 transition-transform`,a?`rotate-180`:`rotate-0`)})]})})}),BO=(0,N.memo)(({className:e,children:t,...n})=>(0,P.jsx)(ev,{className:l(`mt-4 text-sm`,`data-[state=closed]:fade-out-0 data-[state=closed]:slide-out-to-top-2 data-[state=open]:slide-in-from-top-2 text-muted-foreground outline-none data-[state=closed]:animate-out data-[state=open]:animate-in`,e),...n,children:(0,P.jsx)(Xf,{children:t})}));LO.displayName=`Reasoning`,zO.displayName=`ReasoningTrigger`,BO.displayName=`ReasoningContent`;var VO={"approval-requested":(0,P.jsx)(Te,{className:`size-4 text-yellow-600`}),"approval-responded":(0,P.jsx)(rt,{className:`size-4 text-blue-600`}),"input-available":(0,P.jsx)(Te,{className:`size-4 animate-pulse`}),"input-streaming":(0,P.jsx)(O,{className:`size-4`}),"output-available":(0,P.jsx)(rt,{className:`size-4 text-green-600`}),"output-denied":(0,P.jsx)(it,{className:`size-4 text-orange-600`}),"output-error":(0,P.jsx)(it,{className:`size-4 text-red-600`})};function HO(e){return(0,P.jsx)(Re,{className:`gap-1.5 text-xs`,variant:`secondary`,children:VO[e]})}var UO=({className:e,...t})=>(0,P.jsx)(Q_,{className:l(`group not-prose mb-4 w-full rounded-sm border`,e),...t}),WO={run_commands:(0,P.jsx)(vt,{className:`size-4`}),read_files:(0,P.jsx)(ot,{className:`size-4`}),editor:(0,P.jsx)(Ie,{className:`size-4`}),ask_question:(0,P.jsx)(ut,{className:`size-4`})},GO=e=>(0,P.jsx)(Re,{className:`text-xs`,variant:`ghost`,children:e&&WO[e]||(0,P.jsx)(we,{className:`size-4`})}),KO=({className:e,title:t,type:n,state:r,toolName:i,...a})=>{let o=t?.split(`:`),s=o?.[0]||i,c=o?.[1],u=s||t||n.split(`-`).slice(1).join(`-`);return(0,P.jsx)($_,{className:l(`flex w-full overflow-hidden items-center justify-between gap-4 p-3 cursor-pointer`,e),...a,children:(0,P.jsxs)(`div`,{className:`flex items-center gap-2 shrink-0`,children:[GO(u),(0,P.jsx)(`span`,{className:`font-light text-muted-foreground text-sm truncated wrap-break-word ellipses`,children:c}),HO(r)]})})},qO=({className:e,...t})=>(0,P.jsx)(ev,{className:l(`data-[state=closed]:fade-out-0 data-[state=closed]:slide-out-to-top-2 data-[state=open]:slide-in-from-top-2 space-y-4 p-1 text-popover-foreground outline-none data-[state=closed]:animate-out data-[state=open]:animate-in overflow-hidden font-mono`,e),...t}),JO=({className:e,output:t,errorText:n,...r})=>{if(!(t||n))return null;let i=(0,P.jsx)(`div`,{children:t});return typeof t==`object`&&!(0,N.isValidElement)(t)?i=(0,P.jsx)(Bf,{code:JSON.stringify(t,null,2),language:`json`}):typeof t==`string`&&(i=(0,P.jsx)(Bf,{code:t,language:`json`})),(0,P.jsx)(`div`,{className:l(`space-y-2`,e),...r,children:(0,P.jsxs)(`div`,{className:l(`overflow-auto rounded-md text-xs [&_table]:w-full max-h-20`,n?`bg-destructive/10 text-destructive`:`bg-muted/50 text-foreground`),children:[n&&(0,P.jsx)(`div`,{children:n}),i]})})},YO=({children:e,className:t,...n})=>(0,P.jsx)(`div`,{className:l(`text-muted-foreground text-sm`,t),...n,children:e}),XO=({defaultOpen:e=!0,className:t,...n})=>(0,P.jsx)(Q_,{className:l(t),defaultOpen:e,...n}),ZO=({children:e,className:t,title:n,...r})=>(0,P.jsx)($_,{className:l(`group`,t),...r,children:e??(0,P.jsxs)(`div`,{className:`flex w-full cursor-pointer items-center gap-2 text-muted-foreground text-sm transition-colors hover:text-foreground`,children:[(0,P.jsx)(ye,{className:`size-4`}),(0,P.jsx)(`p`,{className:`text-sm`,children:n}),(0,P.jsx)(k,{className:`size-4 transition-transform group-data-[state=open]:rotate-180`})]})}),QO=({children:e,className:t,...n})=>(0,P.jsx)(ev,{className:l(`data-[state=closed]:fade-out-0 data-[state=closed]:slide-out-to-top-2 data-[state=open]:slide-in-from-top-2 text-popover-foreground outline-none data-[state=closed]:animate-out data-[state=open]:animate-in`,t),...n,children:(0,P.jsx)(`div`,{className:`mt-4 space-y-2 border-muted border-l-2 pl-4`,children:e})});function $O(e){return typeof e==`object`&&e?e:void 0}function $(e){return typeof e==`string`&&e.trim()?e.trim():void 0}function ek(e){return Array.isArray(e)?e.filter(e=>typeof e==`string`):void 0}function tk(e){return e===`output-error`?`Failed`:e===`output-available`?`Done`:`Running`}function nk(e){let t=$O(e.input),n=$O(e.output),r=tk(e.state);switch(e.name){case`team_spawn_teammate`:return`${r} spawn teammate ${$(t?.agentId)??$(n?.agentId)??`agent`}`;case`team_shutdown_teammate`:return`${r} shutdown teammate ${$(t?.agentId)??$(n?.agentId)??`agent`}`;case`team_status`:return`${r} fetch team status`;case`team_task`:{let e=$(t?.action);return e===`create`?`${r} create task ${$(n?.taskId)??``}${$(t?.title)?`: ${$(t?.title)}`:``}`.trim():e===`list`?`${r} list team tasks`:e===`claim`?`${r} claim task ${$(t?.taskId)??$(n?.taskId)??``}`.trim():e===`complete`?`${r} complete task ${$(t?.taskId)??$(n?.taskId)??``}`.trim():e===`block`?`${r} block task ${$(t?.taskId)??$(n?.taskId)??``}`.trim():`${r} update team task`}case`team_run_task`:{let e=$(t?.agentId)??$(n?.agentId)??`agent`,i=$(n?.mode)??$(t?.runMode),a=$(n?.status),o=$(t?.task),s=o?`: ${o}`:``;return`${r} ${i===`async`?`queue`:a===`joined`?`join`:`run`} task with ${e}${a?` (${a})`:``}${s}`}case`team_cancel_run`:return`${r} cancel run ${$(t?.runId)??$(n?.runId)??``}`.trim();case`team_list_runs`:return`${r} list teammate runs`;case`team_await_run`:return`${r} await run ${$(t?.runId)??``}`.trim();case`team_await_all_runs`:return`${r} await all active runs`;case`team_send_message`:return`${r} message ${$(t?.toAgentId)??$(n?.toAgentId)??`agent`}${$(t?.subject)?`: ${$(t?.subject)}`:``}`;case`team_broadcast`:return`${r} broadcast${$(t?.subject)?`: ${$(t?.subject)}`:``}`;case`team_read_mailbox`:return`${r} read mailbox`;case`team_mission_log`:return`${r} log ${$(t?.kind)??`update`}${$(t?.summary)?`: ${$(t?.summary)}`:``}`;case`team_cleanup`:return`${r} clean up team runtime`;case`team_create_outcome`:return`${r} create outcome${$(t?.title)?`: ${$(t?.title)}`:``}`;case`team_attach_outcome_fragment`:return`${r} attach fragment to ${$(t?.section)??`section`}`;case`team_review_outcome_fragment`:return`${r} ${t?.approved===!1?`reject`:`review`} fragment ${$(t?.fragmentId)??``}`.trim();case`team_finalize_outcome`:return`${r} finalize outcome ${$(t?.outcomeId)??$(n?.outcomeId)??``}`.trim();case`team_list_outcomes`:return`${r} list outcomes`;default:return`${r} ${e.name.replace(/^team_/,``).replaceAll(`_`,` `)}`}}function rk(e){if(e.error)return e.error;let t=$O(e.input),n=$O(e.output);switch(e.name){case`team_task`:{let e=$(t?.action);if(e===`create`)return $(t?.description);if(e===`block`)return $(t?.reason);if(e===`list`){let e=Array.isArray(n?.tasks)?n.tasks.length:void 0;return typeof e==`number`?`${e} task${e===1?``:`s`}`:void 0}return}case`team_run_task`:return $(n?.message)??$(n?.runId)??$(n?.text);case`team_send_message`:case`team_broadcast`:return $(t?.body);case`team_mission_log`:return $(t?.nextAction)??$(t?.summary);case`team_attach_outcome_fragment`:return $(t?.content);case`team_status`:{let e=Array.isArray(n?.members)?n.members.length:void 0,t=Array.isArray(n?.tasks)?n.tasks.length:void 0,r=Array.isArray(n?.runs)?n.runs.length:void 0;return[typeof e==`number`?`${e} members`:void 0,typeof t==`number`?`${t} tasks`:void 0,typeof r==`number`?`${r} runs`:void 0].filter(Boolean).join(` • `)||void 0}case`team_list_runs`:{let t=Array.isArray(e.output)?e.output:void 0;return t?.length?`${t.length} run${t.length===1?``:`s`}`:`No runs`}case`team_read_mailbox`:{let t=Array.isArray(e.output)?e.output:void 0;return t?.length?`${t.length} message${t.length===1?``:`s`}`:`No messages`}case`team_create_outcome`:{let e=ek(t?.requiredSections);return e?.length?e.join(`, `):void 0}default:return}}function ik({className:e,defaultOpen:t=!0,events:n,...r}){if(n.length===0)return null;let i=n.length===1?`Team activity`:`Team activity (${n.length})`;return(0,P.jsxs)(XO,{className:e,defaultOpen:t,...r,children:[(0,P.jsx)(ZO,{title:i,children:(0,P.jsxs)(`div`,{className:`flex w-full cursor-pointer items-center gap-2 text-muted-foreground text-sm transition-colors hover:text-foreground`,children:[(0,P.jsx)(yt,{className:`size-4`}),(0,P.jsx)(`p`,{className:`text-sm`,children:i})]})}),(0,P.jsx)(QO,{children:n.map(e=>{let t=rk(e);return(0,P.jsxs)(YO,{className:`space-y-1`,children:[(0,P.jsx)(`div`,{children:nk(e)}),t?(0,P.jsx)(`div`,{className:`line-clamp-3 text-xs text-muted-foreground/90`,children:t}):null]},e.id)})})]})}function ak(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))}Array(12).fill(0);var ok=1,sk=new class{constructor(){this.subscribe=e=>(this.subscribers.push(e),()=>{let 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.create=e=>{let{message:t,...n}=e,r=typeof e?.id==`number`||e.id?.length>0?e.id:ok++,i=this.toasts.find(e=>e.id===r),a=e.dismissible===void 0?!0:e.dismissible;return this.dismissedToasts.has(r)&&this.dismissedToasts.delete(r),i?this.toasts=this.toasts.map(n=>n.id===r?(this.publish({...n,...e,id:r,title:t}),{...n,...e,id:r,dismissible:a,title:t}):n):this.addToast({title:t,...n,dismissible:a,id:r}),r},this.dismiss=e=>(e?(this.dismissedToasts.add(e),requestAnimationFrame(()=>this.subscribers.forEach(t=>t({id:e,dismiss:!0})))):this.toasts.forEach(e=>{this.subscribers.forEach(t=>t({id:e.id,dismiss:!0}))}),e),this.message=(e,t)=>this.create({...t,message:e}),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`?void 0:t.description}));let r=Promise.resolve(e instanceof Function?e():e),i=n!==void 0,a,o=r.then(async e=>{if(a=[`resolve`,e],N.isValidElement(e))i=!1,this.create({id:n,type:`default`,message:e});else if(lk(e)&&!e.ok){i=!1;let r=typeof t.error==`function`?await t.error(`HTTP error! status: ${e.status}`):t.error,a=typeof t.description==`function`?await t.description(`HTTP error! status: ${e.status}`):t.description,o=typeof r==`object`&&!N.isValidElement(r)?r:{message:r};this.create({id:n,type:`error`,description:a,...o})}else if(e instanceof Error){i=!1;let r=typeof t.error==`function`?await t.error(e):t.error,a=typeof t.description==`function`?await t.description(e):t.description,o=typeof r==`object`&&!N.isValidElement(r)?r:{message:r};this.create({id:n,type:`error`,description:a,...o})}else if(t.success!==void 0){i=!1;let r=typeof t.success==`function`?await t.success(e):t.success,a=typeof t.description==`function`?await t.description(e):t.description,o=typeof r==`object`&&!N.isValidElement(r)?r:{message:r};this.create({id:n,type:`success`,description:a,...o})}}).catch(async e=>{if(a=[`reject`,e],t.error!==void 0){i=!1;let r=typeof t.error==`function`?await t.error(e):t.error,a=typeof t.description==`function`?await t.description(e):t.description,o=typeof r==`object`&&!N.isValidElement(r)?r:{message:r};this.create({id:n,type:`error`,description:a,...o})}}).finally(()=>{i&&(this.dismiss(n),n=void 0),t.finally==null||t.finally.call(t)}),s=()=>new Promise((e,t)=>o.then(()=>a[0]===`reject`?t(a[1]):e(a[1])).catch(t));return typeof n!=`string`&&typeof n!=`number`?{unwrap:s}:Object.assign(n,{unwrap:s})},this.custom=(e,t)=>{let n=t?.id||ok++;return this.create({jsx:e(n),id:n,...t}),n},this.getActiveToasts=()=>this.toasts.filter(e=>!this.dismissedToasts.has(e.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}},ck=(e,t)=>{let n=t?.id||ok++;return sk.addToast({title:e,...t,id:n}),n},lk=e=>e&&typeof e==`object`&&`ok`in e&&typeof e.ok==`boolean`&&`status`in e&&typeof e.status==`number`,uk=Object.assign(ck,{success:sk.success,info:sk.info,warning:sk.warning,error:sk.error,custom:sk.custom,message:sk.message,promise:sk.promise,dismiss:sk.dismiss,loading:sk.loading},{getHistory:()=>sk.toasts,getToasts:()=>sk.getActiveToasts()});ak(`[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}[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(--gray12);background:var(--normal-bg);border:1px solid var(--gray4);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]{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%)}`);var dk={audio:dt,document:Ee,image:A,source:ct,unknown:ft,video:bt},fk=e=>{if(e.type===`source-document`)return`source`;let t=e.mediaType??``;return t.startsWith(`image/`)?`image`:t.startsWith(`video/`)?`video`:t.startsWith(`audio/`)?`audio`:t.startsWith(`application/`)||t.startsWith(`text/`)?`document`:`unknown`},pk=(e,t,n)=>n?(0,P.jsx)(`img`,{alt:t||`Image`,className:`size-full object-cover`,height:96,src:e,width:96}):(0,P.jsx)(`img`,{alt:t||`Image`,className:`size-full rounded object-cover`,height:20,src:e,width:20}),mk=(0,N.createContext)(null),hk=(0,N.createContext)(null),gk=()=>(0,N.useContext)(mk)??{variant:`grid`},_k=()=>{let e=(0,N.useContext)(hk);if(!e)throw Error(`Attachment components must be used within <Attachment>`);return e},vk=({variant:e=`grid`,className:t,children:n,...r})=>{let i=(0,N.useMemo)(()=>({variant:e}),[e]);return(0,P.jsx)(mk.Provider,{value:i,children:(0,P.jsx)(`div`,{className:l(`flex items-start`,e===`list`?`flex-col gap-2`:`flex-wrap gap-2`,e===`grid`&&`ml-auto w-fit`,t),...r,children:n})})},yk=({data:e,onRemove:t,className:n,children:r,...i})=>{let{variant:a}=gk(),o=fk(e),s=(0,N.useMemo)(()=>({data:e,mediaCategory:o,onRemove:t,variant:a}),[e,o,t,a]);return(0,P.jsx)(hk.Provider,{value:s,children:(0,P.jsx)(`div`,{className:l(`group relative`,a===`grid`&&`size-24 overflow-hidden rounded-lg`,a===`inline`&&[`flex h-8 cursor-pointer select-none items-center gap-1.5`,`rounded-md border border-border px-1.5`,`font-medium text-sm transition-all`,`hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50`],a===`list`&&[`flex w-full items-center gap-3 rounded-lg border p-3`,`hover:bg-accent/50`],n),...i,children:r})})},bk=({fallbackIcon:e,className:t,...n})=>{let{data:r,mediaCategory:i,variant:a}=_k(),o=a===`inline`?`size-3`:`size-4`,s=e=>(0,P.jsx)(e,{className:l(o,`text-muted-foreground`)}),c=()=>{if(i===`image`&&r.type===`file`&&r.url)return pk(r.url,r.filename,a===`grid`);if(i===`video`&&r.type===`file`&&r.url)return(0,P.jsx)(`video`,{className:`size-full object-cover`,muted:!0,src:r.url});let t=dk[i];return e??s(t)};return(0,P.jsx)(`div`,{className:l(`flex shrink-0 items-center justify-center overflow-hidden`,a===`grid`&&`size-full bg-muted`,a===`inline`&&`size-5 rounded bg-background`,a===`list`&&`size-12 rounded bg-muted`,t),...n,children:c()})},xk=({label:e=`Remove`,className:t,children:n,...r})=>{let{onRemove:i,variant:a}=_k(),o=(0,N.useCallback)(e=>{e.stopPropagation(),i?.()},[i]);return i?(0,P.jsxs)(E,{"aria-label":e,className:l(a===`grid`&&[`absolute top-2 right-2 size-6 rounded-full p-0`,`bg-background/80 backdrop-blur-sm`,`opacity-0 transition-opacity group-hover:opacity-100`,`hover:bg-background`,`[&>svg]:size-3`],a===`inline`&&[`size-5 rounded p-0`,`opacity-0 transition-opacity group-hover:opacity-100`,`[&>svg]:size-2.5`],a===`list`&&[`size-8 shrink-0 rounded p-0`,`[&>svg]:size-4`],t),onClick:o,type:`button`,variant:`ghost`,...r,children:[n??(0,P.jsx)(se,{}),(0,P.jsx)(`span`,{className:`sr-only`,children:e})]}):null},Sk=e=>(0,P.jsx)(ie,{...e}),Ck=e=>(0,P.jsx)(le,{...e}),wk=({className:e,children:t,title:n=`Model Selector`,...r})=>(0,P.jsxs)(ce,{"aria-describedby":void 0,className:l(`outline! border-none! p-0 outline-border! outline-solid!`,e),...r,children:[(0,P.jsx)(fe,{className:`sr-only`,children:n}),(0,P.jsx)(o_,{className:`**:data-[slot=command-input-wrapper]:h-auto`,children:t})]}),Tk=({className:e,...t})=>(0,P.jsx)(s_,{className:l(`h-auto py-3.5`,e),...t}),Ek=e=>(0,P.jsx)(c_,{...e}),Dk=e=>(0,P.jsx)(l_,{...e}),Ok=e=>(0,P.jsx)(u_,{...e}),kk=e=>(0,P.jsx)(d_,{...e}),Ak=({provider:e,className:t,...n})=>(0,P.jsx)(`img`,{...n,alt:`${e} logo`,className:l(`size-3 dark:invert`,t),height:12,src:`https://models.dev/logos/${e}.svg`,width:12}),jk=({className:e,...t})=>(0,P.jsx)(`div`,{className:l(`flex shrink-0 items-center -space-x-1 [&>img]:rounded-full [&>img]:bg-background [&>img]:p-px [&>img]:ring-1 dark:[&>img]:bg-foreground`,e),...t}),Mk=({className:e,...t})=>(0,P.jsx)(`span`,{className:l(`flex-1 truncate text-left`,e),...t});function Nk(){let e=x_();return e.files.length===0?null:(0,P.jsx)(vk,{variant:`inline`,children:e.files.map(t=>(0,P.jsxs)(yk,{data:t,onRemove:()=>e.remove(t.id),children:[(0,P.jsx)(bk,{}),(0,P.jsx)(xk,{})]},t.id))})}function Pk({autoApproveTools:e,enableSpawn:t,enableTeams:n,model:r,modelSelectorOpen:i,models:a,onAutoApproveToolsChange:o,onEnableSpawnChange:s,onEnableTeamsChange:c,onModelChange:l,onModelSelectorOpenChange:u,onProviderChange:d,provider:f,providers:p,workspaceRoot:m}){let h=p.find(e=>e.id===f),g=a.find(e=>e.id===r)??a[0]??void 0;return(0,P.jsxs)(`div`,{className:`grid gap-3 bg-background/70 p-3`,children:[(0,P.jsxs)(`div`,{className:`grid gap-2 md:grid-cols-2`,children:[(0,P.jsxs)(`div`,{className:`grid gap-2`,children:[(0,P.jsx)(me,{className:`text-xs uppercase tracking-[0.16em] text-muted-foreground`,children:`Provider`}),(0,P.jsxs)(ae,{onValueChange:e=>{e&&d(e)},value:f,children:[(0,P.jsx)(he,{className:`w-full`,children:(0,P.jsx)(ge,{placeholder:`Select provider`})}),(0,P.jsx)(j,{children:p.map(e=>(0,P.jsx)(re,{value:e.id,children:(0,P.jsxs)(`div`,{className:`flex items-center gap-2`,children:[Fk(e.id),(0,P.jsx)(`span`,{children:e.name})]})},e.id))})]})]}),(0,P.jsxs)(`div`,{className:`grid gap-2`,children:[(0,P.jsx)(me,{className:`text-xs uppercase tracking-[0.16em] text-muted-foreground`,children:`Model`}),(0,P.jsxs)(Sk,{onOpenChange:u,open:i,children:[(0,P.jsx)(Ck,{children:(0,P.jsx)(E,{className:`w-full justify-between`,variant:`outline`,children:(0,P.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[h&&Fk(h.id),(0,P.jsx)(`span`,{className:`truncate`,children:g?.name||g?.id||`Select model`})]})})}),(0,P.jsxs)(wk,{children:[(0,P.jsx)(Tk,{placeholder:`Search models...`}),(0,P.jsxs)(Ek,{children:[(0,P.jsx)(Dk,{children:`No models found.`}),(0,P.jsx)(Ok,{heading:h?.name||`Models`,children:a.map(e=>(0,P.jsxs)(kk,{onSelect:()=>{l(e.id),u(!1)},value:e.id,children:[h&&Fk(h.id),(0,P.jsx)(Mk,{children:e.name||e.id}),(0,P.jsx)(jk,{children:h&&Fk(h.id)}),r===e.id?(0,P.jsx)(Se,{className:`ml-auto size-4`}):(0,P.jsx)(`div`,{className:`ml-auto size-4`})]},e.id))})]})]})]})]})]}),(0,P.jsx)(`div`,{className:`grid gap-2 md:grid-cols-2`,children:(0,P.jsxs)(`div`,{className:`grid gap-2`,children:[(0,P.jsx)(me,{className:`text-xs uppercase tracking-[0.16em] text-muted-foreground`,htmlFor:`workspace-root`,children:`Workspace`}),(0,P.jsx)(v,{id:`workspace-root`,readOnly:!0,value:m})]})}),(0,P.jsxs)(`div`,{className:`grid gap-2 md:grid-cols-2`,children:[(0,P.jsx)(Ik,{checked:t,label:`Subagents`,onChange:s}),(0,P.jsx)(Ik,{checked:n,label:`Agent Teams`,onChange:c}),(0,P.jsx)(Ik,{checked:e,label:`Auto-approves`,onChange:o})]})]})}function Fk(e){return(0,P.jsx)(Ak,{className:`size-3.5`,provider:e||`openai`})}function Ik({checked:e,label:t,onChange:n,disabled:r}){return(0,P.jsxs)(`div`,{className:`flex items-center justify-between rounded-lg border bg-background/60 px-3 py-2`,children:[(0,P.jsx)(me,{className:`text-sm`,htmlFor:t,children:t}),(0,P.jsx)(be,{checked:e,id:t,onCheckedChange:e=>n(e),disabled:r})]})}var Lk={None:`none`,Low:`low`,Medium:`medium`,High:`high`},Rk=[{value:Lk.None,label:`Thinking Off`,icon:ht},{value:Lk.Low,label:`Low`,icon:mt},{value:Lk.Medium,label:`Medium`,icon:gt},{value:Lk.High,label:`High`,icon:ht}];function zk({autoApproveTools:e,disabled:t=!1,enableSpawn:n,enableTeams:r,enableTools:i,maxIterations:a,model:o,mode:s,modelSelectorOpen:c,models:l,onAbort:u,onAutoApproveToolsChange:d,onEnableSpawnChange:f,onEnableTeamsChange:p,onEnableToolsChange:m,onModeChange:h,onMaxIterationsChange:g,onModelChange:_,onModelSelectorOpenChange:v,onProviderChange:y,onSend:b,onSystemPromptChange:x,onReasonLevelChange:S,provider:C,providers:w,sending:ee,status:T,systemPrompt:D,reasonLevel:O,workspaceRoot:k}){let[te,A]=(0,N.useState)(!1),ne=g_(),re=x_(),ie=l.find(e=>e.id===o)?.supportsThinking===!0,j=ie?O:Lk.None,ae=Math.max(Rk.findIndex(e=>e.value===j),0),oe=Rk[ae].icon;return(0,P.jsx)(`div`,{className:`border-t bg-background`,children:(0,P.jsxs)(C_,{accept:`image/*,.txt,.md,.json,.ts,.tsx,.js,.jsx`,globalDrop:!0,className:`rounded-none [&>[data-slot=input-group]]:border-0! [&>[data-slot=input-group]]:ring-0! [&>[data-slot=input-group]]:has-[[data-slot=input-group-control]:focus-visible]:border-0! [&>[data-slot=input-group]]:has-[[data-slot=input-group-control]:focus-visible]:ring-0!`,maxFiles:8,multiple:!0,onError:e=>uk.error(e.message),onSubmit:async e=>{let t=e.text.trim();if(!t&&!e.files.length)return;let n;if(e.files.length>0){let t=(await Promise.all(e.files.map(e=>Bk(e.url)))).filter(e=>!!e);t.length>0&&(n={userImages:t}),t.length!==e.files.length&&uk.warning(`Only image attachments are currently sent in the VS Code chat runtime.`)}!t&&!n?.userImages?.length||b({prompt:t,attachments:n,attachmentCount:e.files.length})},children:[(0,P.jsx)(E_,{children:(0,P.jsx)(Nk,{})}),(0,P.jsx)(w_,{children:(0,P.jsx)(T_,{disabled:t||T.includes(`Failed`),onChange:e=>ne.textInput.setInput(e.target.value),placeholder:`Type @ for context and / for skills`,value:ne.textInput.value,className:`text-sm outline-none ring-0`})}),(0,P.jsxs)(D_,{className:`flex-col items-stretch gap-1 px-0`,children:[te?(0,P.jsx)(Pk,{autoApproveTools:e,enableSpawn:n,enableTeams:r,enableTools:i,maxIterations:a,model:o,modelSelectorOpen:c,models:l,onAutoApproveToolsChange:d,onEnableSpawnChange:f,onEnableTeamsChange:p,onEnableToolsChange:m,onMaxIterationsChange:g,onModelChange:_,onModelSelectorOpenChange:v,onProviderChange:y,onSystemPromptChange:x,provider:C,providers:w,systemPrompt:D,workspaceRoot:k}):null,(0,P.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,P.jsxs)(O_,{className:`shrink-0`,children:[(0,P.jsx)(k_,{disabled:t,onClick:()=>re.openFileDialog(),type:`button`,variant:`ghost`,children:(0,P.jsx)(ft,{className:`size-3`})}),(0,P.jsxs)(k_,{disabled:t,onClick:()=>A(e=>!e),type:`button`,variant:te?`default`:`ghost`,children:[(0,P.jsx)(pt,{className:`size-3`}),(0,P.jsxs)(`span`,{children:[C,`:`,o]})]}),(0,P.jsx)(k_,{disabled:t||!ie,onClick:()=>{S(Rk[(ae+1)%Rk.length].value)},type:`button`,title:Rk[ae].label,variant:j===Lk.None?`ghost`:`default`,children:(0,P.jsx)(oe,{className:`size-3`})}),(0,P.jsxs)(k_,{disabled:t,onClick:()=>h(s===`act`?`plan`:`act`),type:`button`,variant:s===`plan`?`default`:`ghost`,className:`hidden`,children:[s===`act`?(0,P.jsx)(ve,{className:`size-3`}):(0,P.jsx)(lt,{className:`size-3`}),s]}),(0,P.jsx)(Re,{className:`rounded-sm px-3 py-1 text-xs hidden`,variant:T.includes(`Error`)?`destructive`:`secondary`,children:T})]}),(0,P.jsxs)(`div`,{className:`flex items-center gap-2`,children:[ee?(0,P.jsx)(E,{onClick:u,type:`button`,variant:`destructive`,children:`Abort`}):null,(0,P.jsx)(A_,{disabled:t||T.includes(`Failed`),status:ee?`submitted`:`ready`,variant:`ghost`})]})]})]})]})})}async function Bk(e){if(e){if(e.startsWith(`data:image/`))return e;if(e.startsWith(`blob:`))try{let t=await(await fetch(e)).blob();return t.type.startsWith(`image/`)?await new Promise(e=>{let n=new FileReader;n.onloadend=()=>{e(typeof n.result==`string`?n.result:void 0)},n.onerror=()=>e(void 0),n.readAsDataURL(t)}):void 0}catch{return}}}var Vk={lastProvider:``,lastModelByProvider:{}};function Hk(){try{let e=C()?.getState();if(e?.modelSelection)return e.modelSelection}catch{}return Vk}function Uk(e){try{let t=C();if(!t)return;let n=t.getState()??{};t.setState({...n,modelSelection:e})}catch{}}function Wk(e){let t=Number.parseInt(e,10);return Number.isInteger(t)&&t>0?t:void 0}function Gk(e,t,n){return{id:`${Date.now()}-${Math.random().toString(16).slice(2)}`,role:e,text:t,...n}}function Kk(e,t,n=0){let r=n||(t?.userImages?.length??0);return r===0?e:`${e}${e.length>0?`
|
|
196
|
+
|
|
197
|
+
`:``}[attached ${r} file${r===1?``:`s`}]`}function qk(e){if(typeof e==`string`)return e;try{return JSON.stringify(e??null,null,2)}catch{return String(e)}}function Jk(e,t,n){if(!t)return e;let r=n.current;if(r){let n=e.findIndex(e=>e.id===r);if(n>=0)return e.map((e,r)=>r===n?{...e,text:`${e.text}${t}`,blocks:Yk(e.blocks,t)}:e)}let i=e.at(-1);if(i?.role===`assistant`)return n.current=i.id,[...e.slice(0,-1),{...i,text:`${i.text}${t}`,blocks:Yk(i.blocks,t)}];let a=Gk(`assistant`,t,{blocks:[{id:St(),type:`text`,text:t}]});return n.current=a.id,[...e,a]}function Yk(e,t){let n=e??[];return n.at(-1)?.type===`text`?n.map((e,r)=>r===n.length-1&&e.type===`text`?{...e,text:`${e.text}${t}`}:e):[...n,{id:St(),type:`text`,text:t}]}function Xk(e,t,n){let r=e??[];return r.at(-1)?.type===`reasoning`?r.map((e,i)=>i===r.length-1&&e.type===`reasoning`?{...e,text:`${e.text}${t}`,redacted:e.redacted||n}:e):[...r,{id:St(),type:`reasoning`,text:t,redacted:n}]}function Zk(e,t){let n=e??[],r=n.findIndex(e=>e.type===`tool`&&(e.toolEvent.toolCallId&&t.toolCallId&&e.toolEvent.toolCallId===t.toolCallId||!e.toolEvent.toolCallId&&!t.toolCallId&&e.toolEvent.name===t.name&&e.toolEvent.state===`input-available`&&t.state!==`input-available`));return r===-1?[...n,{id:St(),type:`tool`,toolEvent:t}]:n.map((e,n)=>n===r&&e.type===`tool`?{...e,toolEvent:{...e.toolEvent,...t}}:e)}function Qk(e,t,n,r){let i=t||(n?`[redacted]`:``);if(!i)return e;let a=r.current;if(a){let t=e.findIndex(e=>e.id===a);if(t>=0)return e.map((e,r)=>r===t?{...e,reasoning:`${e.reasoning??``}${i}`,reasoningRedacted:e.reasoningRedacted||n,blocks:Xk(e.blocks,i,n)}:e)}let o=e.at(-1);if(o?.role===`assistant`)return r.current=o.id,[...e.slice(0,-1),{...o,reasoning:`${o.reasoning??``}${i}`,reasoningRedacted:o.reasoningRedacted||n,blocks:Xk(o.blocks,i,n)}];let s=Gk(`assistant`,``,{reasoning:i,reasoningRedacted:n,blocks:[{id:St(),type:`reasoning`,text:i,redacted:n}]});return r.current=s.id,[...e,s]}function $k(e){return Array.isArray(e)&&e.length>0&&typeof e[0]==`object`&&e[0]!==null&&`result`in e[0]}function eA(e){return e==null?``:typeof e==`string`?e:typeof e==`object`?Object.values(e).filter(e=>typeof e==`string`||typeof e==`number`).map(String).join(` `):String(e)}function tA(e,t){return e==null?t:typeof e==`string`?e:JSON.stringify(e,null,2)}function nA(e){if($k(e.output))return e.output.map((t,n)=>{let r=t.query??``,i=r?`${e.name}: ${r}`:e.name,a=t.success===!1?`output-error`:e.state,o=t.result??(t.success===!1?`(failed)`:`(no output)`),s=t.success===!1?t.result??`failed`:void 0;return{id:`${e.id}-${n}`,name:e.name,title:i,state:a,output:o,error:s}});let t=eA(e.input),n=t?`${e.name}: ${t}`:e.name;return[{id:e.id,name:e.name,title:n,state:e.state,output:e.error??tA(e.output,e.text),error:e.error}]}function rA(e){let t=/^Running (.+)\.\.\.$/.exec(e);return t?.[1]?t[1]:/^(.+?) (completed|failed:.*)$/.exec(e)?.[1]??`tool`}function iA(e){return e.includes(`failed:`)?`output-error`:e.endsWith(`completed`)?`output-available`:`input-available`}function aA(e,t){return e?.status===`failed`?`output-error`:e?.status===`completed`?`output-available`:e?.status===`running`?`input-available`:iA(t??``)}function oA(e,t){let n=e.findIndex(e=>e.toolCallId&&t.toolCallId&&e.toolCallId===t.toolCallId||!e.toolCallId&&!t.toolCallId&&e.name===t.name&&e.state===`input-available`&&t.state!==`input-available`);return n===-1?[...e,t]:e.map((e,r)=>r===n?{...e,text:t.text,state:t.state,output:t.output,error:t.error}:e)}function sA(e,t,n,r){let i=r.current,a={id:St(),toolCallId:n?.toolCallId,name:n?.toolName??rA(t),state:aA(n,t),text:t,input:n?.input,output:n?.output,error:n?.error};return i?e.map(e=>e.id===i?{...e,toolEvents:oA(e.toolEvents??[],a),blocks:Zk(e.blocks,a)}:e):[...e,Gk(`meta`,t,{toolEvents:[a],blocks:[{id:St(),type:`tool`,toolEvent:a}]})]}function cA(e,t){if(t.length===0)return e;let n=[...e];for(let e of t){let t=n.at(-1);if(e.role===`assistant`&&t?.role===`assistant`){n[n.length-1]={...t,text:`${t.text}${e.text}`,reasoning:`${t.reasoning??``}${e.reasoning??``}`||void 0,reasoningRedacted:t.reasoningRedacted||e.reasoningRedacted||void 0,toolEvents:[...t.toolEvents??[],...e.toolEvents??[]],blocks:[...t.blocks??[],...e.blocks??[]]};continue}if(e.role===`meta`&&t?.role===`meta`&&(e.toolEvents?.length??0)>0){n[n.length-1]={...t,text:e.text||t.text,toolEvents:[...t.toolEvents??[],...e.toolEvents??[]],blocks:[...t.blocks??[],...e.blocks??[]]};continue}n.push(e)}return n}function lA(e,t){return nA(e).map(e=>(0,P.jsxs)(UO,{className:t,children:[(0,P.jsx)(KO,{state:e.state,title:e.title,type:`dynamic-tool`,toolName:e.name}),(0,P.jsx)(qO,{children:(0,P.jsx)(JO,{errorText:e.error,output:e.output})})]},e.id))}function uA(e){let t=[];for(let n of e.toolEvents??[])t.push({id:`legacy-tool-${n.id}`,type:`tool`,toolEvent:n});return e.reasoning&&t.push({id:`legacy-reasoning-${e.id}`,type:`reasoning`,text:e.reasoning,redacted:e.reasoningRedacted}),e.text&&t.push({id:`legacy-text-${e.id}`,type:`text`,text:e.text}),t}function dA(e,t){return(e.blocks?.length?e.blocks:uA(e)).flatMap(e=>{switch(e.type){case`tool`:return e.toolEvent.name.startsWith(`team_`)?[(0,P.jsx)(ik,{className:t.isMeta?`mt-3 w-full`:`mb-3 w-full`,events:[e.toolEvent]},e.id)]:lA(e.toolEvent,t.isMeta?`mt-3`:`mb-3`);case`reasoning`:return[(0,P.jsxs)(LO,{className:t.isMeta?`mt-3`:`mb-3`,defaultOpen:!1,children:[(0,P.jsx)(zO,{}),(0,P.jsx)(BO,{children:e.text})]},e.id)];case`text`:return t.isMeta?[(0,P.jsx)(`pre`,{className:`whitespace-pre-wrap font-inherit`,children:e.text},e.id)]:[(0,P.jsx)(Qf,{children:(0,P.jsx)($f,{children:e.text})},e.id)]}return[]})}function fA(e,t,n,r){return[...e,Gk(`meta`,`Done (${t}) • iterations=${n} • input=${r?.inputTokens??0} output=${r?.outputTokens??0}`)]}function pA(e){return[e.title?.trim()||e.sessionId.slice(0,12),e.workspaceRoot?.trim()?e.workspaceRoot.trim().split(`/`).pop():void 0].filter(Boolean).join(` • `)}function mA(e){try{return new Intl.DateTimeFormat(void 0,{month:`short`,day:`numeric`,hour:`numeric`,minute:`2-digit`}).format(new Date(e))}catch{return`Checkpoint`}}function hA({initialSessionId:e,onSessionSelected:t}){let[n,r]=(0,N.useState)([]),[i,a]=(0,N.useState)(`Waiting for RPC initialization...`),[o,s]=(0,N.useState)(),[c,u]=(0,N.useState)(),[d,f]=(0,N.useState)(!1),[p,m]=(0,N.useState)([]),[h,g]=(0,N.useState)({}),[_,v]=(0,N.useState)({workspaceRoot:``,cwd:``}),[y,b]=(0,N.useState)([]),[x,C]=(0,N.useState)(``),[w,T]=(0,N.useState)(Hk),[D,O]=(0,N.useState)(()=>w.lastProvider),[k,A]=(0,N.useState)(()=>w.lastModelByProvider[w.lastProvider]??``),[ne,re]=(0,N.useState)(``),[ie,j]=(0,N.useState)(``),[ae,oe]=(0,N.useState)(`act`),[ce,le]=(0,N.useState)(`none`),[ue,de]=(0,N.useState)(!0),[fe,pe]=(0,N.useState)(!1),[me,he]=(0,N.useState)(!0),[ge,ve]=(0,N.useState)(!0),[ye,be]=(0,N.useState)([]),[M,xe]=(0,N.useState)(!1),[Ce,we]=(0,N.useState)(!1),[Te,Ee]=(0,N.useState)(!1),[De,Oe]=(0,N.useState)(null),ke=(0,N.useRef)(void 0),Ae=(0,N.useRef)(void 0),je=(0,N.useRef)(void 0),Me=(0,N.useRef)(void 0),Ne=(0,N.useRef)(t),Pe=(0,N.useRef)(w),Fe=(0,N.useRef)(y),Ie=(0,N.useRef)(_),Le=(0,N.useCallback)(e=>{je.current===e||Me.current===e&&!je.current||(Me.current=e,je.current=e,s(e),u(e),r([]),f(!1),be([]),ke.current=void 0,a(`Loading chat history for ${e}...`),t?.(e),S({type:`attachSession`,sessionId:e}))},[t]);(0,N.useEffect)(()=>{je.current=c},[c]),(0,N.useEffect)(()=>{Me.current=o},[o]),(0,N.useEffect)(()=>{Ne.current=t},[t]),(0,N.useEffect)(()=>{Fe.current=y},[y]),(0,N.useEffect)(()=>{Ie.current=_},[_]),(0,N.useEffect)(()=>{let e=e=>{let t=e.data;if(!(!t||typeof t!=`object`||!(`type`in t)))switch(t.type){case`status`:a(t.text);return;case`error`:a(`Error: ${t.text}`),f(!1),u(void 0),je.current=void 0,ke.current=void 0,r(e=>{if(e.length===0)return e;let n=`Error: ${t.text}`,r=e.at(-1);return r?.role===`error`&&r.text===n?e:[...e,Gk(`error`,n)]});return;case`defaults`:v(t.defaults),t.defaults.provider&&O(t.defaults.provider),t.defaults.model&&A(t.defaults.model);return;case`sessions`:b(t.sessions);return;case`providers`:m(t.providers),O(e=>{let n=e&&t.providers.some(t=>t.id===e)?e:``,r=Hk().lastProvider,i=n||(r&&t.providers.some(e=>e.id===r)?r:``)||t.providers.find(e=>e.enabled)?.id||t.providers[0]?.id||``;return i&&S({type:`loadModels`,providerId:i}),i});return;case`models`:g(e=>({...e,[t.providerId]:t.models})),A(e=>{if(e&&t.models.some(t=>t.id===e))return e;let n=Ie.current;if(n.provider===t.providerId&&n.model&&t.models.some(e=>e.id===n.model))return n.model;let r=Hk().lastModelByProvider[t.providerId];return r&&t.models.some(e=>e.id===r)?r:t.models[0]?.id||``});return;case`session_started`:Me.current=t.sessionId,s(t.sessionId),Ne.current?.(t.sessionId),we(!1),C(``);return;case`session_hydrated`:if(je.current&&je.current!==t.sessionId)return;if(Me.current=t.sessionId,je.current=void 0,s(t.sessionId),u(void 0),f(t.status===`running`),t.providerId&&O(t.providerId),t.providerId&&t.modelId){let e={lastProvider:t.providerId,lastModelByProvider:{...Pe.current.lastModelByProvider,[t.providerId]:t.modelId}};Pe.current=e,T(e),Uk(e),A(t.modelId)}we(!1),C(Fe.current.find(e=>e.sessionId===t.sessionId)?.title?.trim()||``),r(e=>{let n=t.status===`running`?cA(t.messages,e):t.messages;return ke.current=t.status===`running`?[...n].reverse().find(e=>e.role===`assistant`)?.id:void 0,n}),a(t.status===`running`?`Attached to ${t.sessionId} (running)`:`Attached to ${t.sessionId}`);return;case`assistant_delta`:r(e=>Jk(e,t.text,ke));return;case`reasoning_delta`:r(e=>Qk(e,t.text,t.redacted,ke));return;case`tool_event`:r(e=>sA(e,t.text,t.event,ke));return;case`approval_request`:be(e=>{let n=e.findIndex(e=>e.approvalId===t.approvalId),r={...t,responding:!1};return n===-1?[...e,r]:e.map((e,t)=>t===n?r:e)}),a(`Waiting for approval: ${t.toolName}`);return;case`approval_resolved`:be(e=>e.filter(e=>e.approvalId!==t.approvalId));return;case`turn_done`:a(`Done (${t.finishReason})`),f(!1),be([]),ke.current=void 0,r(e=>fA(e,t.finishReason,t.iterations,t.usage));return;case`reset_done`:Me.current=void 0,je.current=void 0,s(void 0),u(void 0),f(!1),be([]),we(!1),C(``),ke.current=void 0,Ne.current?.(void 0),a(`Started a new chat session.`),r([]);return;case`fork_done`:Ee(!1),Oe(null),a(`Forked → new session ${t.newSessionId}`);return;case`fork_error`:Ee(!1),Oe(t.text),a(`Fork failed: ${t.text}`);return}};return window.addEventListener(`message`,e),S({type:`ready`}),()=>{window.removeEventListener(`message`,e)}},[]),(0,N.useEffect)(()=>{!e||Ae.current===e||(Ae.current=e,Le(e))},[Le,e]),(0,N.useEffect)(()=>{D&&S({type:`loadModels`,providerId:D})},[D]),(0,N.useEffect)(()=>{if(!D||!k)return;let e=Pe.current;if(e.lastProvider===D&&e.lastModelByProvider[D]===k)return;let t={lastProvider:D,lastModelByProvider:{...e.lastModelByProvider,[D]:k}};Pe.current=t,T(t),Uk(t)},[D,k]);let Re=h[D]??[],ze=!!c,Be=Re.find(e=>e.id===k)?.supportsThinking===!0?ce:`none`,Ve=(0,N.useMemo)(()=>n.filter(e=>e.role!==`meta`||e.text),[n]),He=o&&typeof y.find(e=>e.sessionId===o)?.title==`string`&&y.find(e=>e.sessionId===o)?.title?.trim()||``,Ue=Ce?x:He,We=()=>{if(!o){we(!1);return}let e=x.replace(/\s+/g,` `).trim();we(!1),e!==He&&(C(e),S({type:`updateSessionMetadata`,sessionId:o,metadata:{title:e}}))},Ge=(e,t)=>{be(t=>t.map(t=>t.approvalId===e?{...t,responding:!0}:t)),S({type:`approval_response`,approvalId:e,approved:t,reason:t?`Approved in Cline Hub.`:`Rejected in Cline Hub.`}),a(t?`Approval sent.`:`Rejection sent.`)};return(0,P.jsx)(y_,{children:(0,P.jsxs)(`div`,{className:`relative flex h-screen flex-col overflow-hidden`,children:[(0,P.jsxs)(`div`,{className:`flex items-center justify-between border-b px-4 py-3`,children:[(0,P.jsxs)(`div`,{className:`min-w-0`,children:[y.length>0?(0,P.jsxs)(`select`,{className:`max-w-48 rounded-md border bg-background px-2 py-1 text-xs`,disabled:ze,onChange:e=>{let t=e.target.value;if(!t){S({type:`reset`}),a(`Resetting session...`),be([]);return}Le(t)},value:o??``,children:[(0,P.jsx)(`option`,{value:``,children:`New session`}),y.map(e=>(0,P.jsx)(`option`,{value:e.sessionId,children:pA(e)},e.sessionId))]}):null,ze?(0,P.jsxs)(`span`,{className:`ml-2 inline-flex items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,P.jsx)(_e,{className:`size-3 animate-spin`}),`Loading history`]}):null,o?(0,P.jsx)(`input`,{className:`min-w-0 max-w-56 rounded-md border bg-muted px-2 py-1 text-xs`,disabled:ze,onBlur:We,onChange:e=>C(e.target.value),onFocus:()=>{we(!0),C(He)},onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),We())},placeholder:`Session title`,value:Ue}):null,o?(0,P.jsxs)(E,{disabled:ze,onClick:()=>{a(`Deleting ${o}...`),S({type:`deleteSession`,sessionId:o})},size:`icon-sm`,type:`button`,variant:`ghost`,children:[(0,P.jsx)(ee,{className:`size-4`}),(0,P.jsx)(`span`,{className:`sr-only`,children:`Delete session`})]}):null]}),(0,P.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,P.jsxs)(E,{disabled:ze,onClick:()=>{S({type:`reset`}),a(`Resetting session...`),be([])},size:`icon-sm`,type:`button`,variant:`ghost`,children:[(0,P.jsx)(te,{className:`size-4`}),(0,P.jsx)(`span`,{className:`sr-only`,children:`New chat`})]})})]}),(0,P.jsxs)(Bt,{className:`min-h-0 flex-1`,children:[(0,P.jsxs)(Vt,{className:`px-4 py-5`,children:[ze?(0,P.jsx)(`div`,{className:`flex h-full items-center justify-center rounded-xl border border-dashed px-6 py-16 text-center text-sm text-muted-foreground`,children:(0,P.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,P.jsx)(_e,{className:`size-4 animate-spin`}),`Loading chat history...`]})}):Ve.length===0?(0,P.jsx)(`div`,{className:`flex h-full items-center align-middle justify-center rounded-xl border border-dashed px-6 py-16 text-center text-sm text-muted-foreground`,children:`How can I help you?`}):null,Ve.map(e=>e.role===`meta`||e.role===`error`?(0,P.jsx)(`div`,{className:l(`w-full rounded-lg border px-4 py-3 text-sm`,e.role===`error`?`border-destructive/40 bg-destructive/10 text-destructive`:`bg-muted/40 text-muted-foreground`),children:dA(e,{isMeta:!0})},e.id):(0,P.jsx)(Zf,{from:e.role,children:(0,P.jsxs)(`div`,{children:[dA(e,{sending:d}),e.role===`user`&&e.checkpoint?(0,P.jsx)(wt,{className:`mt-1 justify-end`,children:(0,P.jsxs)(Et,{className:`h-6 gap-1 px-2 text-[11px] text-muted-foreground hover:text-foreground`,disabled:d,onClick:()=>{e.checkpoint&&S({type:`restore`,checkpointRunCount:e.checkpoint.runCount})},tooltip:`Checkpoint from run ${e.checkpoint.runCount}`,type:`button`,variant:`ghost`,children:[(0,P.jsx)(Tt,{className:`size-3`}),mA(e.checkpoint.createdAt)]})}):null,e.role===`assistant`&&e.text&&!d?(0,P.jsxs)(`div`,{className:`mt-1 flex items-center gap-1`,children:[(0,P.jsxs)(E,{className:`h-6 gap-1 px-2 text-[11px] text-muted-foreground hover:text-foreground`,disabled:Te,onClick:()=>{Ee(!0),Oe(null),S({type:`forkSession`})},size:`sm`,title:`Fork session — copy full message history into a new session`,type:`button`,variant:`ghost`,children:[Te?(0,P.jsx)(_e,{className:`size-3 animate-spin`}):(0,P.jsx)(st,{className:`size-3`}),`Fork`]}),De?(0,P.jsx)(`span`,{className:`text-[11px] text-destructive`,children:De}):null]}):null]})},e.id))]}),(0,P.jsx)(Ht,{})]}),ye.length>0?(0,P.jsx)(`div`,{className:`grid max-h-72 gap-2 overflow-auto border-t bg-background/95 px-4 py-3`,children:ye.map(e=>(0,P.jsxs)(`div`,{className:`grid gap-2 rounded-lg border bg-card p-3 text-sm`,children:[(0,P.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,P.jsxs)(`div`,{className:`min-w-0`,children:[(0,P.jsx)(`p`,{className:`font-semibold`,children:`Approve tool call?`}),(0,P.jsx)(`p`,{className:`break-all text-muted-foreground text-xs`,children:e.toolName})]}),(0,P.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[(0,P.jsxs)(E,{disabled:e.responding,onClick:()=>Ge(e.approvalId,!1),size:`sm`,type:`button`,variant:`destructive`,children:[(0,P.jsx)(se,{className:`size-4`}),`Reject`]}),(0,P.jsxs)(E,{disabled:e.responding,onClick:()=>Ge(e.approvalId,!0),size:`sm`,type:`button`,children:[e.responding?(0,P.jsx)(_e,{className:`size-4 animate-spin`}):(0,P.jsx)(Se,{className:`size-4`}),`Approve`]})]})]}),(0,P.jsx)(`pre`,{className:`max-h-32 overflow-auto rounded-md border bg-background p-2 text-[11px]`,children:qk(e.input)})]},e.approvalId))}):null,(0,P.jsx)(zk,{autoApproveTools:ge,disabled:ze,enableSpawn:fe,enableTeams:me,enableTools:ue,maxIterations:ie,model:k,mode:ae,modelSelectorOpen:M,models:Re,onAbort:()=>{S({type:`abort`}),a(`Abort requested...`)},onAutoApproveToolsChange:ve,onEnableSpawnChange:pe,onEnableTeamsChange:he,onEnableToolsChange:de,onModeChange:oe,onMaxIterationsChange:j,onModelChange:A,onModelSelectorOpenChange:xe,onProviderChange:e=>{O(e);let t=w.lastModelByProvider[e],n=(h[e]??[]).map(e=>e.id);if(t&&n.includes(t)){A(t);return}A(``)},onSend:({prompt:e,attachments:t,attachmentCount:n})=>{if(ze)return;let i=Gk(`assistant`,``);ke.current=i.id,r(r=>[...r,Gk(`user`,Kk(e,t,n)),i]),f(!0),a(`Running...`),S({type:`send`,prompt:e,attachments:t,config:{autoApproveTools:ge,enableSpawn:fe,enableTeams:me,enableTools:ue,maxIterations:Wk(ie),model:k||void 0,mode:ae,provider:D||void 0,reasonLevel:Be,systemPrompt:ne.trim()||void 0}})},onSystemPromptChange:re,onReasonLevelChange:le,provider:D,providers:p,sending:d,status:i,systemPrompt:ne,reasonLevel:Be,workspaceRoot:_.workspaceRoot})]})})}export{hA as default};
|