@cline/cli-windows-x64 3.0.30 → 3.0.31
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
|
@@ -1,201 +0,0 @@
|
|
|
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-bKbkko4L.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 A,N as j,P as te,_ as ne,c as re,g as M,h as ie,i as ae,j as oe,l as se,m as ce,n as le,o as ue,p as de,r as fe,t as pe,v as me,y as he}from"./label-CWJcfOco.js";import{a as ge,i as _e,r as ve,t as ye}from"./switch-O5JzNA9x.js";import{t as N}from"./mermaid-parser-kNaey6uv.js";import{Dt as be,G as xe,J as Se,L as Ce,U as we,V as Te,Y as Ee,ct as De,dt as Oe,ft as ke,kt as Ae,l as je,lt as Me,q as Ne,ut as Pe,z as Fe}from"./index-COgdQxvL.js";import{n as Ie,t as Le}from"./badge-CCf0mJUQ.js";import{_ as Re,c as ze,d as Be,f as Ve,g as He,h as Ue,l as We,m as Ge,o as Ke,p as qe,r as Je,s as Ye,u as Xe,v as Ze,y as Qe}from"./chunk-BO2N2NFS-WeGK2y8v.js";var $e=m(`arrow-down`,[[`path`,{d:`M12 5v14`,key:`s699le`}],[`path`,{d:`m19 12-7 7-7-7`,key:`1idqje`}]]),et=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`}]]),tt=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`}]]),nt=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`}]]),rt=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`}]]),it=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`}]]),at=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`}]]),ot=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`}]]),st=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`}]]),ct=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`}]]),lt=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`}]]),ut=m(`music-2`,[[`circle`,{cx:`8`,cy:`18`,r:`4`,key:`1fc0mg`}],[`path`,{d:`M12 18V2l7 4`,key:`g04rme`}]]),dt=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`}]]),ft=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`}]]),pt=m(`signal-low`,[[`path`,{d:`M2 20h.01`,key:`4haj6o`}],[`path`,{d:`M7 20v-4`,key:`j294jx`}]]),mt=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`}]]),ht=m(`signal-medium`,[[`path`,{d:`M2 20h.01`,key:`4haj6o`}],[`path`,{d:`M7 20v-4`,key:`j294jx`}],[`path`,{d:`M12 20v-8`,key:`i3yub9`}]]),gt=m(`square`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}]]),_t=m(`terminal`,[[`path`,{d:`M12 19h8`,key:`baeox8`}],[`path`,{d:`m4 17 6-6-6-6`,key:`1yngyt`}]]),vt=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`}]]),yt=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`}]]),bt=`useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict`,xt=(e=21)=>{let t=``,n=crypto.getRandomValues(new Uint8Array(e|=0));for(;e--;)t+=bt[n[e]&63];return t},P=e(i(),1),F=a();function St({className:e,orientation:t=`horizontal`,...n}){return(0,F.jsx)(je,{"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 Ct=({className:e,children:t,...n})=>(0,F.jsxs)(`div`,{className:l(`flex items-center gap-0.5 overflow-hidden text-muted-foreground`,e),...n,children:[t,(0,F.jsx)(St,{})]}),wt=({className:e,children:t,...n})=>t??(0,F.jsx)(et,{className:l(`size-4 shrink-0`,e),...n}),Tt=({children:e,variant:t=`ghost`,size:n=`sm`,tooltip:r,...i})=>r?(0,F.jsxs)(Ne,{children:[(0,F.jsx)(Ee,{render:(0,F.jsx)(E,{size:n,type:`button`,variant:t,...i}),children:e}),(0,F.jsx)(Se,{align:`start`,side:`bottom`,children:r})]}):(0,F.jsx)(E,{size:n,type:`button`,variant:t,...i,children:e}),Et={damping:.7,stiffness:.05,mass:1.25},Dt=70,Ot=1e3/60,kt=350,At=!1;globalThis.document?.addEventListener(`mousedown`,()=>{At=!0}),globalThis.document?.addEventListener(`mouseup`,()=>{At=!1}),globalThis.document?.addEventListener(`click`,()=>{At=!1});var jt=(e={})=>{let[t,n]=(0,P.useState)(!1),[r,i]=(0,P.useState)(e.initial!==!1),[a,o]=(0,P.useState)(!1),s=(0,P.useRef)(null);s.current=e;let c=(0,P.useCallback)(()=>{if(!At)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,P.useCallback)(e=>{d.isAtBottom=e,i(e)},[]),u=(0,P.useCallback)(e=>{d.escapedFromLock=e,n(e)},[]),d=(0,P.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<=Dt}}},[]),f=(0,P.useCallback)((e={})=>{typeof e==`string`&&(e={animation:e}),e.preserveScrollPosition||l(!0);let t=Date.now()+(Number(e.wait)||0),n=Pt(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))/Ot;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:Pt(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,P.useCallback)(()=>{u(!0),l(!1)},[u,l]),m=(0,P.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,P.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=Mt(e=>{g.current?.removeEventListener(`scroll`,m),g.current?.removeEventListener(`wheel`,h),e?.addEventListener(`scroll`,m,{passive:!0}),e?.addEventListener(`wheel`,h,{passive:!0})},[]),_=Mt(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=Pt(s.current,t?s.current.resize:s.current.initial);f({animation:e,wait:!0,preserveScrollPosition:!0,duration:e===`instant`?void 0:kt})}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 Mt(e,t){let n=(0,P.useCallback)(t=>(n.current=t,e(t)),t);return n}var Nt=new Map;function Pt(...e){let t={...Et},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 Nt.has(r)||Nt.set(r,Object.freeze(t)),n?`instant`:Nt.get(r)}var Ft=(0,P.createContext)(null),It=typeof window<`u`?P.useLayoutEffect:P.useEffect;function Lt({instance:e,children:t,resize:n,initial:r,mass:i,damping:a,stiffness:o,targetScrollTop:s,contextRef:c,...l}){let u=(0,P.useRef)(null),d=jt({mass:i,damping:a,stiffness:o,resize:n,initial:r,targetScrollTop:P.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,P.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,P.useImperativeHandle)(c,()=>y,[y]),It(()=>{f.current&&getComputedStyle(f.current).overflow===`visible`&&(f.current.style.overflow=`auto`)},[]),P.createElement(Ft.Provider,{value:y},P.createElement(`div`,{...l},typeof t==`function`?t(y):t))}(function(e){function t({children:e,scrollClassName:t,...n}){let r=Rt();return P.createElement(`div`,{ref:r.scrollRef,style:{height:`100%`,width:`100%`,scrollbarGutter:`stable both-edges`},className:t},P.createElement(`div`,{...n,ref:r.contentRef},typeof e==`function`?e(r):e))}e.Content=t})(Lt||={});function Rt(){let e=(0,P.useContext)(Ft);if(!e)throw Error(`use-stick-to-bottom component context must be used within a StickToBottom component`);return e}var zt=({className:e,...t})=>(0,F.jsx)(Lt,{className:l(`relative flex-1 overflow-y-hidden`,e),initial:`smooth`,resize:`smooth`,role:`log`,...t}),Bt=({className:e,...t})=>(0,F.jsx)(Lt.Content,{className:l(`flex flex-col gap-8 p-4`,e),...t}),Vt=({className:e,...t})=>{let{isAtBottom:n,scrollToBottom:r}=Rt(),i=(0,P.useCallback)(()=>{r()},[r]);return!n&&(0,F.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,F.jsx)($e,{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 I={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},Ht={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},Ut={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`},Wt=[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],Gt=[12288,12288,65281,65376,65504,65510],Kt=[8361,8361,65377,65470,65474,65479,65482,65487,65490,65495,65498,65500,65512,65518],qt=[32,126,162,163,165,166,172,172,175,175,10214,10221,10629,10630],Jt=[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],Yt=(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},Xt=19968,[Zt,Qt]=$t(Jt);function $t(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(Xt>=i&&Xt<=a)return[i,a];a-i>n-t&&(t=i,n=a)}return[t,n]}var en=e=>e<161||e>1114109?!1:Yt(Wt,e),tn=e=>e<12288||e>65510?!1:Yt(Gt,e),nn=e=>e<8361||e>65518?!1:Yt(Kt,e),rn=e=>e<32||e>10630?!1:Yt(qt,e),an=e=>e>=Zt&&e<=Qt?!0:e<4352||e>262141?!1:Yt(Jt,e);function on(e){return en(e)?`ambiguous`:tn(e)?`fullwidth`:nn(e)?`halfwidth`:rn(e)?`narrow`:an(e)?`wide`:`neutral`}function sn(e){if(!Number.isSafeInteger(e))throw TypeError(`Expected a code point, got \`${typeof e}\`.`)}function cn(e){return sn(e),on(e)}function ln(e){return/^\p{Emoji_Presentation}/u.test(String.fromCodePoint(e))}function un(e){if(!e||e<4352)return!1;switch(cn(e)){case`fullwidth`:case`halfwidth`:return!0;case`wide`:return!ln(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 dn(e,t){return t!==65025||!e||e<8216?!1:e===8216||e===8217||e===8220||e===8221}function fn(e){return e!==null&&e>=65024&&e<=65038}var pn=hn(/\p{P}|\p{S}/u),mn=hn(/\s/);function hn(e){return t;function t(t){return t!==null&&t>-1&&e.test(String.fromCodePoint(t))}}function L(e){return!!(e&Ht.characterGroupWhitespace)}function gn(e){return(e&Sn.cjkPunctuation)===Ht.characterGroupPunctuation}function _n(e){return!!(e&Sn.cjk)}function vn(e){return e===Sn.ivs}function yn(e){return!!(e&Sn.cjkOrIvs)}function bn(e){return e===Sn.nonEmojiGeneralUseVS}function xn(e){return!!(e&Sn.spaceOrPunctuation)}var Sn;(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})(Sn||={});function R(e){if(e===I.eof||Qe(e)||mn(e))return Ht.characterGroupWhitespace;let t=0;if(e>=4352){if(fn(e))return Sn.nonEmojiGeneralUseVS;switch(un(e)){case null:return Sn.ivs;case!0:t|=Sn.cjk;break}}return pn(e)&&(t|=Ht.characterGroupPunctuation),t}function Cn(e,t,n){if(!bn(e))return e;let r=t(),i=R(r);return!r||L(i)?e:dn(r,n)?Sn.cjkPunctuation:wn(i)}function wn(e){return e&~Sn.ivs}function Tn(e){return!!(e&&e>=55296&&e<=56319)}function En(e){return!!(e&&e>=56320&&e<=57343)}function Dn(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 On(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 kn=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=On(this.previousCode,this.nowPoint,this.sliceSerialize)),this.cachedValue}};function An(e,t,n){let r=n({start:t,end:{...t,_bufferIndex:t._bufferIndex+2}}).codePointAt(0);return r&&r>=65536?r:e}var jn={name:`attention`,resolveAll:Mn,tokenize:Nn};function Mn(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};Pn(d,-c),Pn(f,c),o={type:c>1?Ut.strongSequence:Ut.emphasisSequence,start:d,end:{...e[r][1].end}},s={type:c>1?Ut.strongSequence:Ut.emphasisSequence,start:{...e[n][1].start},end:f},a={type:c>1?Ut.strongText:Ut.emphasisText,start:{...e[r][1].end},end:{...e[n][1].start}},i={type:c>1?Ut.strong:Ut.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=Re(l,[[`enter`,e[r][1],t],[`exit`,e[r][1],t]])),l=Re(l,[[`enter`,i,t],[`enter`,o,t],[`exit`,o,t],[`enter`,a,t]]),t.parser.constructs.insideSpan.null,l=Re(l,He(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),l=Re(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=Re(l,[[`enter`,e[n][1],t],[`exit`,e[n][1],t]])):u=0,Ze(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 Nn(e,t){let n=this.parser.constructs.attentionMarkers.null,{now:r,sliceSerialize:i,previous:a}=this,o=En(a)?Dn(a,r(),i):a,s=R(o),c=new kn(o,r(),i),l=Cn(s,c.value.bind(c),o),u;return d;function d(t){return t===I.asterisk||I.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=R(Tn(a)?An(a,r(),i):a),d=gn(l),p=d||L(l),m=gn(c),h=m||L(c),g=yn(l),_=!h||m&&(p||g)||n.includes(a),v=!p||d&&(h||_n(c))||n.includes(o);return s._open=!!(u===I.asterisk?_:_&&(xn(l)||!v)),s._close=!!(u===I.asterisk?v:v&&(xn(c)||!_)),t(a)}}function Pn(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}function Fn(){return{text:{[I.asterisk]:jn,[I.underscore]:jn},insideSpan:{null:[jn]}}}function In(){let e=this.data();(e.micromarkExtensions||=[]).push(Fn())}var Ln=`;`.codePointAt(0)??I.eof,Rn=`&`.codePointAt(0)??I.eof;function zn(){return{handlers:{emphasis:Bn,strong:Vn,text:Gn}}}Bn.peek=Hn,Vn.peek=Un;function Bn(e,t,n,r){return Wn(e,t,n,r,Hn(e,t,n),1)}function Vn(e,t,n,r){return Wn(e,t,n,r,Un(e,t,n),2)}function Hn(e,t,n){return n.options.emphasis||`*`}function Un(e,t,n){return n.options.strong||`*`}function Wn(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=$n(e,t,n,r.before),f=er(e,t,n,r.after),p=Kn(d,fr(u),i,`open`);p.inside&&u&&(u=lr(u));let m=Kn({current:pr(u),previous:dr(u)},f,i,`close`);m.inside&&u&&(u=ur(u));let h=c.move(o);s();let g=m.outside&&ar(t,n);return n.attentionEncodeSurroundingInfo={after:m.outside&&!g,before:p.outside},or(n).cjkFriendlyEncodeAfterSupplementaryText=g,l+u+h}function Gn(e,t,n,r){let i=or(n);if(!i.cjkFriendlyEncodeAfterSupplementaryText)return n.safe(e.value,r);i.cjkFriendlyEncodeAfterSupplementaryText=!1;let[a=``]=[...e.value],o=e.value.slice(a.length);return`${cr(a.codePointAt(0)??I.eof)}${n.safe(o,{...r,before:`;`})}`}function Kn(e,t,n,r){let i=Qn(e),a=R(t);if(!yn(i)&&!yn(a))return r===`open`?qn(i,a,n):qn(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?mr:e:i.inside?mr:e,o=r===`open`?i.inside?hr:t:i.outside?hr:t;if(r===`open`?Jn(n,a,o):Yn(n,a,o))return i}return l}function qn(e,t,n){return Zn(e)?Zn(t)?n===`_`?{inside:!0,outside:!0}:{inside:!1,outside:!1}:L(t)?{inside:!0,outside:!0}:{inside:!1,outside:!0}:L(e)?Zn(t)?{inside:!1,outside:!1}:L(t)?{inside:!0,outside:!0}:{inside:!1,outside:!1}:L(t)?{inside:!0,outside:!1}:{inside:!1,outside:!1}}function Jn(e,t,n){let r=Qn(t),{close:i,open:a}=Xn(r,R(n));return e===`_`?a&&(xn(r)||!i):a}function Yn(e,t,n){let r=R(n),{close:i,open:a}=Xn(Qn(t),r);return e===`_`?i&&(xn(r)||!a):i}function Xn(e,t){let n=gn(e),r=n||L(e),i=gn(t),a=i||L(t);return{open:!a||i&&(r||yn(e)),close:!r||n&&(a||_n(t))}}function Zn(e){return!L(e)&&!gn(e)}function Qn(e){let t=R(e.current);return e.current===null||!bn(t)?t:Cn(t,()=>e.previous,e.current)}function $n(e,t,n,r){let i=pr(r),a=dr(r);if(tr(i)||rr(i,a)){let r=ir(e,t,n,-1);r&&(i=pr(r),a=dr(r))}return{current:i,previous:a}}function er(e,t,n,r){let i=fr(r);if(!nr(i))return i;let a=ir(e,t,n,1);return a?fr(a):i}function tr(e){return e!==null&&56320<=e&&e<=57343}function nr(e){return e!==null&&55296<=e&&e<=56319}function rr(e,t){return bn(R(e))&&(t===null||t===I.eof)}function ir(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 sr(s)||void 0}function ar(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`&&(fr(r.value)??0)>65535}function or(e){return e}function sr(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(sr).join(``):``}function cr(e){return`&#x${(e??0).toString(16).toUpperCase()};`}function lr(e){let[t=``]=[...e];return cr(t.codePointAt(0)??I.eof)+e.slice(t.length)}function ur(e){let t=[...e],n=t.pop();return`${t.join(``)}${cr(n?.codePointAt(0)??I.eof)}`}function dr(e){let t=[...e];return t.pop(),t.at(-1)?.codePointAt(0)??I.eof}function fr(e){return e.codePointAt(0)??I.eof}function pr(e){return[...e].at(-1)?.codePointAt(0)??I.eof}var mr={current:Ln,previous:I.eof},hr=Rn;function gr(){let e=this.data();(e.toMarkdownExtensions||=[]).push(zn())}function _r(){In.call(this),gr.call(this)}var vr=_r;function yr(e){let t=(e||{}).singleTilde,n={name:`strikethrough`,tokenize:i,resolveAll:r};return t??=!0,{text:{[I.tilde]:n},insideSpan:{null:[n]},attentionMarkers:{null:[I.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&&Ze(o,o.length,0,He(s,e.slice(r+1,n),t)),Ze(o,o.length,0,[[`exit`,a,t],[`enter`,e[n][1],t],[`exit`,e[n][1],t],[`exit`,i,t]]),Ze(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=Ut.data);return e}function i(e,n,r){let{now:i,sliceSerialize:a,previous:o}=this,s=En(o)?Dn(o,i(),a):o,c=R(s),l=new kn(s,i(),a),u=Cn(c,l.value.bind(l),s),d=this.events,f=0;return p;function p(t){return I.tilde,s===I.tilde&&d[d.length-1][1].type!==Ut.characterEscape?r(t):(e.enter(`strikethroughSequenceTemporary`),m(t))}function m(o){let c=R(s);if(o===I.tilde)return f>1?r(o):(e.consume(o),f++,m);if(f<2&&!t)return r(o);let l=e.exit(`strikethroughSequenceTemporary`),d=R(Tn(o)?An(o,i(),a):o),p=gn(u)||L(u),h=gn(d)||L(d),g=_n(u)||vn(c);return l._open=!h||d===Ht.attentionSideAfter&&(p||g),l._close=!p||c===Ht.attentionSideAfter&&(h||_n(d)),n(o)}}}function br(e){let t=this.data();(t.micromarkExtensions||=[]).push(yr(e))}var xr=[`autolink`,`destinationLiteral`,`destinationRaw`,`reference`,`titleQuote`,`titleApostrophe`],Sr=`;`.codePointAt(0)??I.eof,Cr=`&`.codePointAt(0)??I.eof;function wr(){return{unsafe:[{character:`~`,inConstruct:`phrasing`,notInConstruct:xr}],handlers:{delete:Tr,text:Er}}}Tr.peek=Dr;function Tr(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=Fr(e,t,n,r.before),l=Ir(e,t,n,r.after),u=Or(c,Jr(s),`open`);u.inside&&s&&(s=Gr(s));let d=Or({current:Yr(s),previous:qr(s)},l,`close`);d.inside&&s&&(s=Kr(s));let f=a.move(`~~`);i();let p=d.outside&&Vr(t,n);return n.attentionEncodeSurroundingInfo={after:d.outside&&!p,before:u.outside},Hr(n).cjkFriendlyEncodeAfterSupplementaryText=p,o+s+f}function Er(e,t,n,r){let i=Hr(n);if(!i.cjkFriendlyEncodeAfterSupplementaryText)return n.safe(e.value,r);i.cjkFriendlyEncodeAfterSupplementaryText=!1;let[a=``]=[...e.value],o=e.value.slice(a.length);return`${Wr(a.codePointAt(0)??I.eof)}${n.safe(o,{...r,before:`;`})}`}function Dr(){return`~`}function Or(e,t,n){let r=Pr(e),i=R(t);if(!yn(r)&&!yn(i))return n===`open`?kr(r,i):kr(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?Xr:e:r.inside?Xr:e,a=n===`open`?r.inside?Zr:t:r.outside?Zr:t;if(n===`open`?Ar(i,a):jr(i,a))return r}return c}function kr(e,t){return Nr(e)?Nr(t)?{inside:!1,outside:!1}:L(t)?{inside:!0,outside:!0}:{inside:!1,outside:!0}:L(e)?Nr(t)?{inside:!1,outside:!1}:L(t)?{inside:!0,outside:!0}:{inside:!1,outside:!1}:L(t)?{inside:!0,outside:!1}:{inside:!1,outside:!1}}function Ar(e,t){let{open:n}=Mr(Pr(e),R(t));return n}function jr(e,t){let n=R(t),{close:r}=Mr(Pr(e),n);return r}function Mr(e,t){let n=gn(e),r=n||L(e),i=gn(t),a=i||L(t);return{open:!a||i&&(r||yn(e)),close:!r||n&&(a||_n(t))}}function Nr(e){return!L(e)&&!gn(e)}function Pr(e){let t=R(e.current);return e.current===null||!bn(t)?t:Cn(t,()=>e.previous,e.current)}function Fr(e,t,n,r){let i=Yr(r),a=qr(r);if(Lr(i)||zr(i,a)){let r=Br(e,t,n,-1);r&&(i=Yr(r),a=qr(r))}return{current:i,previous:a}}function Ir(e,t,n,r){let i=Jr(r);if(!Rr(i))return i;let a=Br(e,t,n,1);return a?Jr(a):i}function Lr(e){return e!==null&&56320<=e&&e<=57343}function Rr(e){return e!==null&&55296<=e&&e<=56319}function zr(e,t){return bn(R(e))&&(t===null||t===I.eof)}function Br(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 Ur(s)||void 0}function Vr(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`&&(Jr(r.value)??0)>65535}function Hr(e){return e}function Ur(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(Ur).join(``):``}function Wr(e){return`&#x${(e??0).toString(16).toUpperCase()};`}function Gr(e){let[t=``]=[...e];return Wr(t.codePointAt(0)??I.eof)+e.slice(t.length)}function Kr(e){let t=[...e],n=t.pop();return`${t.join(``)}${Wr(n?.codePointAt(0)??I.eof)}`}function qr(e){let t=[...e];return t.pop(),t.at(-1)?.codePointAt(0)??I.eof}function Jr(e){return e.codePointAt(0)??I.eof}function Yr(e){return[...e].at(-1)?.codePointAt(0)??I.eof}var Xr={current:Sr,previous:I.eof},Zr=Cr;function Qr(){let e=this.data();(e.toMarkdownExtensions||=[]).push(wr())}function $r(e){br.call(this,e),Qr.call(this)}var ei=$r,ti=new Set([`。`,`.`,`,`,`、`,`?`,`!`,`:`,`;`,`(`,`)`,`【`,`】`,`「`,`」`,`『`,`』`,`〈`,`〉`,`《`,`》`]),ni=/^(https?:\/\/|mailto:|www\.)/i,ri=e=>{if(e.children.length!==1)return!1;let t=e.children[0];return t.type===`text`&&t.value===e.url},ii=e=>{let t=0;for(let n of e){if(ti.has(n))return t;t+=n.length}return null},ai=(e,t)=>({...t,url:e,children:[{type:`text`,value:e}]}),oi=e=>({type:`text`,value:e}),si=()=>e=>{Ue(e,`link`,(e,t,n)=>{if(!n||typeof t!=`number`||!ri(e)||!ni.test(e.url))return;let r=ii(e.url);if(r===null||r===0)return;let i=e.url.slice(0,r),a=e.url.slice(r),o=ai(i,e),s=oi(a);return n.children.splice(t,1,o,s),t+1})};function ci(){let e=[vr],t=[si,ei];return{name:`cjk`,type:`cjk`,remarkPluginsBefore:e,remarkPluginsAfter:t,remarkPlugins:[...e,...t]}}var li=ci(),z=class extends Error{constructor(e){super(e),this.name=`ShikiError`}};function ui(e){return di(e)}function di(e){return Array.isArray(e)?fi(e):e instanceof RegExp?e:typeof e==`object`?pi(e):e}function fi(e){let t=[];for(let n=0,r=e.length;n<r;n++)t[n]=di(e[n]);return t}function pi(e){let t={};for(let n in e)t[n]=di(e[n]);return t}function mi(e,...t){return t.forEach(t=>{for(let n in t)e[n]=t[n]}),e}function hi(e){let t=~e.lastIndexOf(`/`)||~e.lastIndexOf(`\\`);return t===0?e:~t===e.length-1?hi(e.substring(0,e.length-1)):e.substr(~t+1)}var gi=/\$(\d+)|\${(\d+):\/(downcase|upcase)}/g,_i=class{static hasCaptures(e){return e===null?!1:(gi.lastIndex=0,gi.test(e))}static replaceCaptures(e,t,n){return e.replace(gi,(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 vi(e,t){return e<t?-1:+(e>t)}function yi(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=vi(e[r],t[r]);if(n!==0)return n}return 0}return n-r}function bi(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 xi(e){return e.replace(/[\-\\\{\}\*\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,`\\$&`)}var Si=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}},Ci=class{constructor(e,t,n){this._colorMap=e,this._defaults=t,this._root=n}static createFromRawTheme(e,t){return this.createFromParsedTheme(Oi(e),t)}static createFromParsedTheme(e,t){return ji(e,t)}_cachedMatchRoot=new Si(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=>Ti(e.parent,t.parentScopes));return n?new Di(n.fontStyle,n.foreground,n.background):null}},wi=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 Ti(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&&!Ei(e.scopeName,r);){if(i)return!1;e=e.parent}if(!e)return!1;e=e.parent}return!0}function Ei(e,t){return t===e||e.startsWith(t)&&e[t.length]===`.`}var Di=class{constructor(e,t,n){this.fontStyle=e,this.foregroundId=t,this.backgroundId=n}};function Oi(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`&&bi(i.settings.foreground)&&(s=i.settings.foreground);let c=null;typeof i.settings.background==`string`&&bi(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 ki(l,u,e,o,s,c)}}return n}var ki=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}},Ai=(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))(Ai||{});function ji(e,t){e.sort((e,t)=>{let n=vi(e.scope,t.scope);return n!==0||(n=yi(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 Mi(t),o=new Di(n,a.getId(r),a.getId(i)),s=new Fi(new Pi(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 Ci(a,o,s)}var Mi=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)}},Ni=Object.freeze([]),Pi=class e{scopeDepth;parentScopes;fontStyle;foreground;background;constructor(e,t,n,r,i){this.scopeDepth=e,this.parentScopes=t||Ni,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)}},Fi=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(),Pi.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(yi(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 Pi(e,t,n,r,i))}},Ii=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=Ri(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 Li(e){return e}function Ri(e){return e}function zi(e,t){let n=[],r=Vi(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(Bi(i)){let e=[];do e.push(i),i=r.next();while(Bi(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 Bi(e){return!!e&&!!e.match(/[\w\.:]+/)}function Vi(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 Hi(e){typeof e.dispose==`function`&&e.dispose()}var Ui=class{constructor(e){this.scopeName=e}toKey(){return this.scopeName}},Wi=class{constructor(e,t){this.scopeName=e,this.ruleName=t}toKey(){return`${this.scopeName}#${this.ruleName}`}},Gi=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))}},Ki=class{constructor(e,t){this.repo=e,this.initialScopeName=t,this.seenFullScopeRequests.add(this.initialScopeName),this.Q=[new Ui(this.initialScopeName)]}seenFullScopeRequests=new Set;seenPartialScopeRequests=new Set;Q;processQueue(){let e=this.Q;this.Q=[];let t=new Gi;for(let n of e)qi(n,this.initialScopeName,this.repo,t);for(let e of t.references)if(e instanceof Ui){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 qi(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 Ui?Yi({baseGrammar:a,selfGrammar:i},r):Ji(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 Ui(e))}function Ji(e,t,n){if(t.repository&&t.repository[e]){let r=t.repository[e];Xi([r],t,n)}}function Yi(e,t){e.selfGrammar.patterns&&Array.isArray(e.selfGrammar.patterns)&&Xi(e.selfGrammar.patterns,{...e,repository:e.selfGrammar.repository},t),e.selfGrammar.injections&&Xi(Object.values(e.selfGrammar.injections),{...e,repository:e.selfGrammar.repository},t)}function Xi(e,t,n){for(let r of e){if(n.visitedRule.has(r))continue;n.visitedRule.add(r);let e=r.repository?mi({},t.repository,r.repository):t.repository;Array.isArray(r.patterns)&&Xi(r.patterns,{...t,repository:e},n);let i=r.include;if(!i)continue;let a=na(i);switch(a.kind){case 0:Yi({...t,selfGrammar:t.baseGrammar},n);break;case 1:Yi(t,n);break;case 2:Ji(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?Ji(a.ruleName,i,n):Yi(i,n)}else a.kind===4?n.add(new Wi(a.scopeName,a.ruleName)):n.add(new Ui(a.scopeName));break}}}var Zi=class{kind=0},Qi=class{kind=1},$i=class{constructor(e){this.ruleName=e}kind=2},ea=class{constructor(e){this.scopeName=e}kind=3},ta=class{constructor(e,t){this.scopeName=e,this.ruleName=t}kind=4};function na(e){if(e===`$base`)return new Zi;if(e===`$self`)return new Qi;let t=e.indexOf(`#`);return t===-1?new ea(e):t===0?new $i(e.substring(1)):new ta(e.substring(0,t),e.substring(t+1))}var ra=/\\(\d+)/,ia=/\\(\d+)/g,aa=-1,oa=-2;function sa(e){return e}function ca(e){return e}var la=class{$location;id;_nameIsCapturing;_name;_contentNameIsCapturing;_contentName;constructor(e,t,n,r){this.$location=e,this.id=t,this._name=n||null,this._nameIsCapturing=_i.hasCaptures(this._name),this._contentName=r||null,this._contentNameIsCapturing=_i.hasCaptures(this._contentName)}get debugName(){let e=this.$location?`${hi(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:_i.replaceCaptures(this._name,e,t)}getContentName(e,t){return!this._contentNameIsCapturing||this._contentName===null?this._contentName:_i.replaceCaptures(this._contentName,e,t)}},ua=class extends la{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!`)}},da=class extends la{_match;captures;_cachedCompiledPatterns;constructor(e,t,n,r,i){super(e,t,n,null),this._match=new ga(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 _a,this.collectPatterns(e,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},fa=class extends la{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 _a,this.collectPatterns(e,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},pa=class extends la{_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 ga(i,this.id),this.beginCaptures=a,this._end=new ga(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 _a;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}},ma=class extends la{_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 ga(i,this.id),this.beginCaptures=a,this.whileCaptures=s,this._while=new ga(o,oa),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 _a;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 _a,this._cachedCompiledWhilePatterns.push(this._while.hasBackReferences?this._while.clone():this._while)),this._while.hasBackReferences&&this._cachedCompiledWhilePatterns.setSource(0,t||``),this._cachedCompiledWhilePatterns}},ha=class e{static createCaptureRule(e,t,n,r,i){return e.registerRule(e=>new ua(t,e,n,r,i))}static getCompiledRuleId(t,n,r){return t.id||n.registerRule(i=>{if(t.id=i,t.match)return new da(t.$vscodeTextmateLocation,t.id,t.name,t.match,e._compileCaptures(t.captures,n,r));if(t.begin===void 0){t.repository&&(r=mi({},r,t.repository));let i=t.patterns;return i===void 0&&t.include&&(i=[{include:t.include}]),new fa(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,e._compilePatterns(i,n,r))}return t.while?new ma(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 pa(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=na(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 fa||e instanceof pa||e instanceof ma)&&e.hasMissingPatterns&&e.patterns.length===0&&(t=!0),t)continue;i.push(s)}}return{patterns:i,hasMissingPatterns:(t?t.length:0)!==i.length}}},ga=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=ra.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 ia.lastIndex=0,this.source.replace(ia,(e,t)=>xi(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}},_a=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 va(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 va(e,this._items.map(e=>e.resolveAnchors(t,n)),this._items.map(e=>e.ruleId))}},va=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}},ya=class{constructor(e,t){this.languageId=e,this.tokenType=t}},ba=class e{_defaultAttributes;_embeddedLanguagesMatcher;constructor(e,t){this._defaultAttributes=new ya(e,8),this._embeddedLanguagesMatcher=new xa(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 ya(0,0);_getBasicScopeAttributes=new Si(e=>new ya(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/},xa=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])=>xi(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 Sa=!1,Ca=class{constructor(e,t){this.stack=e,this.stoppedEarly=t}};function wa(e,t,n,r,i,a,o,s){let c=t.content.length,l=!1,u=-1;if(o){let o=Ta(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 Ca(i,!0);f()}return new Ca(i,!1);function f(){let o=Ea(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===aa){let o=i.getRule(e);a.produce(i,s[0].start),i=i.withContentNameScopesList(i.nameScopesList),Ma(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 pa){let r=o;Ma(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 ma){let r=o;Ma(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(Ma(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 Ta(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 ma&&s.push({rule:n,stack:t})}for(let c=s.pop();c;c=s.pop()){let{ruleScanner:s,findOptions:l}=Aa(c.rule,e,c.stack.endRule,n,r===o),u=s.findNextMatchSync(t,r,l);if(u){if(u.ruleId!==oa){i=c.stack.pop();break}u.captureIndices&&u.captureIndices.length&&(a.produce(c.stack,u.captureIndices[0].start),Ma(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 Ea(e,t,n,r,i,a){let o=Da(e,t,n,r,i,a),s=e.getInjections();if(s.length===0)return o;let c=Oa(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 Da(e,t,n,r,i,a){let{ruleScanner:o,findOptions:s}=ka(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 Oa(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}=ka(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 ka(e,t,n,r,i){return Sa?{ruleScanner:e.compile(t,n),findOptions:ja(r,i)}:{ruleScanner:e.compileAG(t,n,r,i),findOptions:0}}function Aa(e,t,n,r,i){return Sa?{ruleScanner:e.compileWhile(t,n),findOptions:ja(r,i)}:{ruleScanner:e.compileWhileAG(t,n,r,i),findOptions:0}}function ja(e,t){let n=0;return e||(n|=1),t||(n|=4),n}function Ma(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));wa(e,p,n&&d.start===0,d.start,f,i,!1,0),Hi(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 Na(t,d.end))}}for(;l.length>0;)i.produceFromScopes(l[l.length-1].scopes,l[l.length-1].endPos),l.pop()}var Na=class{scopes;endPos;constructor(e,t){this.scopes=e,this.endPos=t}};function Pa(e,t,n,r,i,a,o,s){return new Ra(e,t,n,r,i,a,o,s)}function Fa(e,t,n,r,i){let a=zi(t,Ia),o=ha.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 Ia(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(La(t[r],e))return n=r+1,!0;return!1})}function La(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 Ra=class{constructor(e,t,n,r,i,a,o,s){if(this._rootScopeName=e,this.balancedBracketSelectors=a,this._onigLib=s,this._basicScopeAttributesProvider=new ba(n,r),this._rootId=-1,this._lastRuleId=0,this._ruleId2desc=[null],this._includedGrammars={},this._grammarRepository=o,this._grammar=za(t,null),this._injections=null,this._tokenTypeMatchers=[],i)for(let e of Object.keys(i)){let t=zi(e,Ia);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)Fa(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&&Fa(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(sa(t));return this._ruleId2desc[t]=n,n}getRule(e){return this._ruleId2desc[ca(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]=za(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=ha.getCompiledRuleId(this._grammar.repository.$self,this,this._grammar.repository),this.getInjections());let i;if(!t||t===Va.NULL){i=!0;let e=this._basicScopeAttributesProvider.getDefaultAttributes(),n=this.themeProvider.getDefaults(),r=Ii.set(0,e.languageId,e.tokenType,null,n.fontStyle,n.foregroundId,n.backgroundId),a=this.getRule(this._rootId).getName(null,null),o;o=a?Ba.createRootAndLookUpScopeName(a,r,this):Ba.createRoot(`unknown`,r),t=new Va(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 Ua(n,e,this._tokenTypeMatchers,this.balancedBracketSelectors),c=wa(this,a,i,0,t,s,!0,r);return Hi(a),{lineLength:o,lineTokens:s,ruleStack:c.stack,stoppedEarly:c.stoppedEarly}}};function za(e,t){return e=ui(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 Ba=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=wi.push(i,t.scopeNames),r=new e(r,i,t.encodedTokenAttributes);return r}static createRoot(t,n){return new e(null,new wi(null,t),n)}static createRootAndLookUpScopeName(t,n,r){let i=r.getMetadataForScope(t),a=new wi(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),Ii.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}},Va=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)?Ba.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:ca(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=Ba.fromExtension(t?.nameScopesList??null,n.nameScopesList);return new e(t,sa(n.ruleId),n.enterPos??-1,n.anchorPos??-1,n.beginRuleCapturedEOL,n.endRule,r,Ba.fromExtension(r,n.contentNameScopesList))}},Ha=class{balancedBracketScopes;unbalancedBracketScopes;allowAny=!1;constructor(e,t){this.balancedBracketScopes=e.flatMap(e=>e===`*`?(this.allowAny=!0,[]):zi(e,Ia).map(e=>e.matcher)),this.unbalancedBracketScopes=t.flatMap(e=>zi(e,Ia).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}},Ua=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=Ii.set(n,0,Li(e.type),null,-1,0,0));this.balancedBracketSelectors&&(r=this.balancedBracketSelectors.match(t))}if(r&&(n=Ii.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}},Wa=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,Pa(e,a,t,n,r,i,this,this._onigLib))}return this._grammars.get(e)}},Ga=class{_options;_syncRegistry;_ensureGrammarCache;constructor(e){this._options=e,this._syncRegistry=new Wa(Ci.createFromRawTheme(e.theme,e.colorMap),e.onigLib),this._ensureGrammarCache=new Map}dispose(){this._syncRegistry.dispose()}setTheme(e,t){this._syncRegistry.setTheme(Ci.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 Ha(n.balancedBracketSelectors||[],n.unbalancedBracketSelectors||[]))}loadGrammar(e){return this._loadGrammar(e,0,null,null,null)}_loadGrammar(e,t,n,r,i){let a=new Ki(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)}},Ka=Va.NULL;function qa(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 Ja(e,t){return e&&(t?.[e?.toLowerCase()]||e)}function Ya(e){return Array.isArray(e)?e:[e]}async function Xa(e){return Promise.resolve(typeof e==`function`?e():e).then(e=>e.default||e)}function Za(e){return!e||[`plaintext`,`txt`,`text`,`plain`].includes(e)}function Qa(e){return e===`ansi`||Za(e)}function $a(e){return e===`none`}function eo(e){return $a(e)}var to=/(\r?\n)/g;function no(e,t=!1){if(e.length===0)return[[``,0]];let n=e.split(to),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 ro={light:`#333333`,dark:`#bbbbbb`},io={light:`#fffffe`,dark:`#1e1e1e`},ao=`__shiki_resolved`;function oo(e){if(e?.[ao])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`?ro.light:ro.dark,n||=t.type===`light`?io.light:io.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,ao,{enumerable:!1,writable:!1,value:!0}),t}async function so(e){return[...new Set((await Promise.all(e.filter(e=>!Qa(e)).map(async e=>await Xa(e).then(e=>Array.isArray(e)?e:[e])))).flat())]}async function co(e){return(await Promise.all(e.map(async e=>eo(e)?null:oo(await Xa(e))))).filter(e=>!!e)}function lo(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 z(`Circular alias \`${[...n].join(` -> `)} -> ${e}\``);n.add(e)}}return e}var uo=class extends Ga{_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=oo(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=Ci.createFromRawTheme(e),this._textmateThemeCache.set(e,t)),this._syncRegistry.setTheme(t)}getGrammar(e){return e=lo(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 z(`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))}},fo=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}},po=0;function mo(e){po+=1,e.warnings!==!1&&po>=10&&po%10==0&&console.warn(`[Shiki] ${po} 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 z("`engine` option is required for synchronous mode");let n=(e.langs||[]).flat(1),r=(e.themes||[]).flat(1).map(oo),i=new uo(new fo(e.engine,n),r,n,e.langAlias),a;function o(t){return lo(t,e.langAlias)}function s(e){g();let t=i.getGrammar(typeof e==`string`?e:e.name);if(!t)throw new z(`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 z(`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 so(e))}function m(...e){g();for(let t of e.flat(1))i.loadTheme(t)}async function h(...e){return g(),m(await co(e))}function g(){if(t)throw new z(`Shiki instance has been disposed`)}function _(){t||(t=!0,i.dispose(),--po)}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 ho(e){e.engine||console.warn("`engine` option is required. Use `createOnigurumaEngine` or `createJavaScriptRegexEngine` to create an engine.");let[t,n,r]=await Promise.all([co(e.themes||[]),so(e.langs||[]),e.engine]);return mo({...e,themes:t,langs:n,engine:r})}var go=new WeakMap;function _o(e,t){go.set(e,t)}function vo(e){return go.get(e)}var yo=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(Ya(n).map(e=>[e,Ka])),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 bo(this._stacks[e])}toJSON(){return{lang:this.lang,theme:this.theme,themes:this.themes,scopes:this.getScopes()}}};function bo(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 xo(e,t){if(!(e instanceof yo))throw new z(`Invalid grammar state`);return e.getInternalStack(t)}var So=/,/,Co=/ /;function wo(e,t,n={}){let{theme:r=e.getLoadedThemes()[0]}=n;if(Za(e.resolveLangAlias(n.lang||`text`))||$a(r))return no(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 z(`Grammar state language "${n.grammarState.lang}" does not match highlight language "${o.name}"`);if(!n.grammarState.themes.includes(i.name))throw new z(`Grammar state themes "${n.grammarState.themes}" do not contain highlight theme "${i.name}"`)}return Eo(t,o,i,a,n)}function To(...e){if(e.length===2)return vo(e[1]);let[t,n,r={}]=e,{lang:i=`text`,theme:a=t.getLoadedThemes()[0]}=r;if(Za(i)||$a(a))throw new z(`Plain language does not have grammar state`);if(i===`ansi`)throw new z(`ANSI language does not have grammar state`);let{theme:o,colorMap:s}=t.setTheme(a),c=t.getLanguage(i);return new yo(Do(n,c,o,s,r).stateStack,c.name,o.name)}function Eo(e,t,n,r,i){let a=Do(e,t,n,r,i),o=new yo(a.stateStack,t.name,n.name);return _o(a.tokens,o),a.tokens}function Do(e,t,n,r,i){let a=qa(n,i),{tokenizeMaxLineLength:o=0,tokenizeTimeLimit:s=500}=i,c=no(e),l=i.grammarState?xo(i.grammarState,n.name)??Ka:i.grammarContextCode==null?Ka:Do(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=Ja(r[Ii.getForeground(s)],a),l=Ii.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(So).map(e=>e.trim());break;case`object`:n=t.scope;break;default:continue}e.push({settings:t,selectors:n.map(e=>e.split(Co))})}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`?Oo(t.scopes):ko(e,t.scopes)}),g+=1}}u.push(d)}d.push(u),u=[],l=_.ruleStack}return{tokens:d,stateStack:l}}function Oo(e){return e.map(e=>({scopeName:e}))}function ko(e,t){let n=[];for(let r=0,i=t.length;r<i;r++){let i=t[r];n[r]={scopeName:i,themeMatches:Mo(e,i,t.slice(0,r))}}return n}function Ao(e,t){return e===t||t.substring(0,e.length)===e&&t[e.length]===`.`}function jo(e,t,n){if(!Ao(e.at(-1),t))return!1;let r=e.length-2,i=n.length-1;for(;r>=0&&i>=0;)Ao(e[r],n[i])&&--r,--i;return r===-1}function Mo(e,t,n){let r=[];for(let{selectors:i,settings:a}of e)for(let e of i)if(jo(e,t,n)){r.push(a);break}return r}function No(e,t,n,r=wo){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:vo(a),theme:typeof i.theme==`string`?i.theme:i.theme.name}}),o=Po(...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 yo(Object.fromEntries(a.map(e=>[e.theme,e.state?.getInternalStack(e.theme)])),a[0].state.lang):void 0;return c&&_o(s,c),s}function Po(...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 Fo=/["&'<>`]/g,Io=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,Lo=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,Ro=/[|\\{}()[\]^$+*?.]/g,zo=new WeakMap;function Bo(e,t){if(e=e.replace(t.subset?Vo(t.subset):Fo,r),t.subset||t.escapeOnly)return e;return e.replace(Io,n).replace(Lo,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 Vo(e){let t=zo.get(e);return t||(t=Ho(e),zo.set(e,t)),t}function Ho(e){let t=[],n=-1;for(;++n<e.length;)t.push(e[n].replace(Ro,`\\$&`));return RegExp(`(?:`+t.join(`|`)+`)`,`g`)}var Uo=/[\dA-Fa-f]/;function Wo(e,t,n){let r=`&#x`+e.toString(16).toUpperCase();return n&&t&&!Uo.test(String.fromCharCode(t))?r:r+`;`}var Go=/\d/;function Ko(e,t,n){let r=`&#`+String(e);return n&&t&&!Go.test(String.fromCharCode(t))?r:r+`;`}var qo=`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(`.`),Jo={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:`€`},Yo=[`cent`,`copy`,`divide`,`gt`,`lt`,`not`,`para`,`times`],Xo={}.hasOwnProperty,Zo={},Qo;for(Qo in Jo)Xo.call(Jo,Qo)&&(Zo[Jo[Qo]]=Qo);var $o=/[^\dA-Za-z]/;function es(e,t,n,r){let i=String.fromCharCode(e);if(Xo.call(Zo,i)){let e=Zo[i],a=`&`+e;return n&&qo.includes(e)&&!Yo.includes(e)&&(!r||t&&t!==61&&$o.test(String.fromCharCode(t)))?a:a+`;`}return``}function ts(e,t,n){let r=Wo(e,t,n.omitOptionalSemicolons),i;if((n.useNamedReferences||n.useShortestReferences)&&(i=es(e,t,n.omitOptionalSemicolons,n.attribute)),(n.useShortestReferences||!i)&&n.useShortestReferences){let i=Ko(e,t,n.omitOptionalSemicolons);i.length<r.length&&(r=i)}return i&&(!n.useShortestReferences||i.length<r.length)?i:r}function ns(e,t){return Bo(e,Object.assign({format:ts},t))}var rs=/^>|^->|<!--|-->|--!>|<!-$/g,is=[`>`],as=[`<`,`>`];function os(e,t,n,r){return r.settings.bogusComments?`<?`+ns(e.value,Object.assign({},r.settings.characterReferences,{subset:is}))+`>`:`<!--`+e.value.replace(rs,i)+`-->`;function i(e){return ns(e,Object.assign({},r.settings.characterReferences,{subset:as}))}}function ss(e,t,n,r){return`<!`+(r.settings.upperDoctype?`DOCTYPE`:`doctype`)+(r.settings.tightDoctype?``:` `)+`html>`}var B=us(1),cs=us(-1),ls=[];function us(e){return t;function t(t,n,r){let i=t?t.children:ls,a=(n||0)+e,o=i[a];if(!r)for(;o&&Ke(o);)a+=e,o=i[a];return o}}var ds={}.hasOwnProperty;function fs(e){return t;function t(t,n,r){return ds.call(e,t.tagName)&&e[t.tagName](t,n,r)}}var ps=fs({body:gs,caption:ms,colgroup:ms,dd:bs,dt:ys,head:ms,html:hs,li:vs,optgroup:Ss,option:Cs,p:_s,rp:xs,rt:xs,tbody:Ts,td:Os,tfoot:Es,th:Os,thead:ws,tr:Ds});function ms(e,t,n){let r=B(n,t,!0);return!r||r.type!==`comment`&&!(r.type===`text`&&Ke(r.value.charAt(0)))}function hs(e,t,n){let r=B(n,t);return!r||r.type!==`comment`}function gs(e,t,n){let r=B(n,t);return!r||r.type!==`comment`}function _s(e,t,n){let r=B(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 vs(e,t,n){let r=B(n,t);return!r||r.type===`element`&&r.tagName===`li`}function ys(e,t,n){let r=B(n,t);return!!(r&&r.type===`element`&&(r.tagName===`dt`||r.tagName===`dd`))}function bs(e,t,n){let r=B(n,t);return!r||r.type===`element`&&(r.tagName===`dt`||r.tagName===`dd`)}function xs(e,t,n){let r=B(n,t);return!r||r.type===`element`&&(r.tagName===`rp`||r.tagName===`rt`)}function Ss(e,t,n){let r=B(n,t);return!r||r.type===`element`&&r.tagName===`optgroup`}function Cs(e,t,n){let r=B(n,t);return!r||r.type===`element`&&(r.tagName===`option`||r.tagName===`optgroup`)}function ws(e,t,n){let r=B(n,t);return!!(r&&r.type===`element`&&(r.tagName===`tbody`||r.tagName===`tfoot`))}function Ts(e,t,n){let r=B(n,t);return!r||r.type===`element`&&(r.tagName===`tbody`||r.tagName===`tfoot`)}function Es(e,t,n){return!B(n,t)}function Ds(e,t,n){let r=B(n,t);return!r||r.type===`element`&&r.tagName===`tr`}function Os(e,t,n){let r=B(n,t);return!r||r.type===`element`&&(r.tagName===`td`||r.tagName===`th`)}var ks=fs({body:Ms,colgroup:Ns,head:js,html:As,tbody:Ps});function As(e){let t=B(e,-1);return!t||t.type!==`comment`}function js(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 Ms(e){let t=B(e,-1,!0);return!t||t.type!==`comment`&&!(t.type===`text`&&Ke(t.value.charAt(0)))&&!(t.type===`element`&&(t.tagName===`meta`||t.tagName===`link`||t.tagName===`script`||t.tagName===`style`||t.tagName===`template`))}function Ns(e,t,n){let r=cs(n,t),i=B(e,-1,!0);return n&&r&&r.type===`element`&&r.tagName===`colgroup`&&ps(r,n.children.indexOf(r),n)?!1:!!(i&&i.type===`element`&&i.tagName===`col`)}function Ps(e,t,n){let r=cs(n,t),i=B(e,-1);return n&&r&&r.type===`element`&&(r.tagName===`thead`||r.tagName===`tbody`)&&ps(r,n.children.indexOf(r),n)?!1:!!(i&&i.type===`element`&&i.tagName===`tr`)}var Fs={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 Is(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=qe);let l=Ls(r,e.properties),u=r.all(i.space===`html`&&e.tagName===`template`?e.content:e);return r.schema=i,u&&(o=!1),(l||!a||!ks(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||!ps(e,t,n))&&s.push(`</`+e.tagName+`>`),s.join(``)}function Ls(e,t){let n=[],r=-1,i;if(t){for(i in t)if(t[i]!==null&&t[i]!==void 0){let r=Rs(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 Rs(e,t,n){let r=Ge(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=ns(r.attribute,Object.assign({},e.settings.characterReferences,{subset:Fs.name[i][a]}));return n===!0||(n=Array.isArray(n)?(r.commaSeparated?Be:Xe)(n,{padLeft:!e.settings.tightCommaSeparatedLists}):String(n),e.settings.collapseEmptyAttributes&&!n)?c:(e.settings.preferUnquoted&&(s=ns(n,Object.assign({},e.settings.characterReferences,{attribute:!0,subset:Fs.unquoted[i][a]}))),s!==n&&(e.settings.quoteSmart&&Ye(n,o)>Ye(n,e.alternative)&&(o=e.alternative),s=o+ns(n,Object.assign({},e.settings.characterReferences,{subset:(o===`'`?Fs.single:Fs.double)[i][a],attribute:!0}))+o),c+(s&&`=`+s))}var zs=[`<`,`&`];function Bs(e,t,n,r){return n&&n.type===`element`&&(n.tagName===`script`||n.tagName===`style`)?e.value:ns(e.value,Object.assign({},r.settings.characterReferences,{subset:zs}))}function Vs(e,t,n,r){return r.settings.allowDangerousHtml?e.value:Bs(e,t,n,r)}function Hs(e,t,n,r){return r.all(e)}var Us=We(`type`,{invalid:Ws,unknown:Gs,handlers:{comment:os,doctype:ss,element:Is,raw:Vs,root:Hs,text:Bs}});function Ws(e){throw Error("Expected node, not `"+e+"`")}function Gs(e){throw Error("Cannot compile unknown node `"+e.type+"`")}var Ks={},qs={},Js=[];function Ys(e,t){let n=t||Ks,r=n.quote||`"`,i=r===`"`?`'`:`"`;if(r!==`"`&&r!==`'`)throw Error("Invalid quote `"+r+"`, expected `'` or `\"`");return{one:Xs,all:Zs,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||ze,characterReferences:n.characterReferences||qs,closeSelfClosing:n.closeSelfClosing||!1,closeEmptyElements:n.closeEmptyElements||!1},schema:n.space===`svg`?qe:Ve,quote:r,alternative:i}.one(Array.isArray(e)?{type:`root`,children:e}:e,void 0,void 0)}function Xs(e,t,n){return Us(e,t,n,this)}function Zs(e){let t=[],n=e&&e.children||Js,r=-1;for(;++r<n.length;)t[r]=this.one(n[r],r,e);return t.join(``)}var Qs=/\s+/g;function $s(e,t){if(!t)return e;e.properties||={},e.properties.class||=[],typeof e.properties.class==`string`&&(e.properties.class=e.properties.class.split(Qs)),Array.isArray(e.properties.class)||(e.properties.class=[]);let n=Array.isArray(t)?t:t.split(Qs);for(let t of n)t&&!e.properties.class.includes(t)&&e.properties.class.push(t);return e}function ec(e){let t=no(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 tc=[`color`,`background-color`];function nc(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 rc(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?nc(e,t):e})):e}function ic(e,t,n,r,i=`css-vars`){let a={content:e.content,explanation:e.explanation,offset:e.offset},o=t.map(t=>ac(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&&tc.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 z('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 ac(e){let t={};if(e.color&&(t.color=e.color),e.bgColor&&(t[`background-color`]=e.bgColor),e.fontStyle){e.fontStyle&Ai.Italic&&(t[`font-style`]=`italic`),e.fontStyle&Ai.Bold&&(t[`font-weight`]=`bold`);let n=[];e.fontStyle&Ai.Underline&&n.push(`underline`),e.fontStyle&Ai.Strikethrough&&n.push(`line-through`),n.length&&(t[`text-decoration`]=n.join(` `))}return t}function oc(e){return typeof e==`string`?e:Object.entries(e).map(([e,t])=>`${e}:${t}`).join(`;`)}function sc(){let e=new WeakMap;function t(t){if(!e.has(t.meta)){let n=ec(t.source);function r(e){if(typeof e==`number`){if(e<0||e>t.source.length)throw new z(`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 z(`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 z(`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)}));cc(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 rc(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 z(`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+=lc(a.children[e]),c===-1&&s.length===t&&(c=e+1),l===-1&&s.length===n&&(l=e+1);if(c===-1)throw new z(`Failed to find start index for decoration ${JSON.stringify(i.start)}`);if(l===-1)throw new z(`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&&$s(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 cc(e){for(let t=0;t<e.length;t++){let n=e[t];if(n.start.offset>n.end.offset)throw new z(`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 z(`Decorations ${JSON.stringify(n.start)} and ${JSON.stringify(t.start)} intersect.`)}}}}function lc(e){return e.type===`text`?e.value:e.type===`element`?e.children.map(lc).join(``):``}var uc=[sc()];function dc(e){let t=fc(e.transformers||[]);return[...t.pre,...t.normal,...t.post,...uc]}function fc(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 pc=[`black`,`red`,`green`,`yellow`,`blue`,`magenta`,`cyan`,`white`,`brightBlack`,`brightRed`,`brightGreen`,`brightYellow`,`brightBlue`,`brightMagenta`,`brightCyan`,`brightWhite`],mc={1:`bold`,2:`dim`,3:`italic`,4:`underline`,7:`reverse`,8:`hidden`,9:`strikethrough`};function hc(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 gc(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 _c(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)mc[r]&&t.push({type:`setDecoration`,value:mc[r]});else if(r<=29){let e=mc[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:pc[r-30]}});else if(r===38){let n=gc(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:pc[r-40]}});else if(r===48){let n=gc(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:pc[r-90+8]}}):r>=100&&r<=107&&t.push({type:`setBackgroundColor`,value:{type:`named`,name:pc[r-100+8]}})}return t}function vc(){let e=null,t=null,n=new Set;return{parse(r){let i=[],a=0;do{let o=hc(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=_c(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 yc={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 bc(e=yc){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<pc.length;e++)r.push(t(pc[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 xc=/#([0-9a-f]{3,8})/i,Sc=/var\((--[\w-]+-ansi-[\w-]+)\)/,Cc={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 wc(e,t,n){let r=qa(e,n),i=no(t),a=bc(Object.fromEntries(pc.map(t=>{let n=`terminal.ansi${t[0].toUpperCase()}${t.substring(1)}`;return[t,e.colors?.[n]||Cc[t]]}))),o=vc();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=Ja(i,r),o=Ja(o,r),n.decorations.has(`dim`)&&(i=Tc(i));let s=Ai.None;return n.decorations.has(`bold`)&&(s|=Ai.Bold),n.decorations.has(`italic`)&&(s|=Ai.Italic),n.decorations.has(`underline`)&&(s|=Ai.Underline),n.decorations.has(`strikethrough`)&&(s|=Ai.Strikethrough),{content:n.value,offset:t[1],color:i,bgColor:o,fontStyle:s}}))}function Tc(e){let t=e.match(xc);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(Sc);return n?`var(${n[1]}-dim)`:e}function Ec(e,t,n={}){let r=e.resolveLangAlias(n.lang||`text`),{theme:i=e.getLoadedThemes()[0]}=n;if(!Za(r)&&!$a(i)&&r===`ansi`){let{theme:r}=e.setTheme(i);return wc(r,t,n)}return wo(e,t,n)}function Dc(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 z("`themes` option must not be empty");let p=No(e,t,n,Ec);if(c=vo(p),l&&l!==`light-dark()`&&!f.some(e=>e.color===l))throw new z(`\`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=>ic(e,h,u,l,d))),c&&_o(a,c);let g=f.map(e=>qa(e.theme,n));i=Oc(f,m,g,u,l,`fg`,d),r=Oc(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=qa(n.theme,n);a=Ec(e,t,n);let l=e.getTheme(n.theme);r=Ja(l.bg,s),i=Ja(l.fg,s),o=l.name,c=vo(a)}else throw new z("Invalid options, either `theme` or `themes` must be provided");return{tokens:a,fg:i,bg:r,themeName:o,rootStyle:s,grammarState:c}}function Oc(e,t,n,r,i,a,o){return e.map((s,c)=>{let l=Ja(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 z('When using `defaultColor: "light-dark()"`, you must provide both `light` and `dark` themes');return`light-dark(${Ja(t[r][a],n[r])||`inherit`}, ${Ja(t[i][a],n[i])||`inherit`});${u}`}return l}return o===`css-vars`?u:null}).filter(e=>!!e).join(`;`)}var kc=/^\s+$/,Ac=/^(\s*)(.*?)(\s*)$/;function jc(e,t,n,r={meta:{},options:n,codeToHast:(t,n)=>jc(e,t,n),codeToTokens:(t,n)=>Dc(e,t,n)}){let i=t;for(let e of dc(n))i=e.preprocess?.call(r,i,n)||i;let{tokens:a,fg:o,bg:s,themeName:c,rootStyle:l,grammarState:u}=Dc(e,i,n),{mergeWhitespaces:d=!0,mergeSameStyleTokens:f=!1}=n;d===!0?a=Nc(a):d===`never`&&(a=Pc(a)),f&&(a=Fc(a));let p={...r,get source(){return i}};for(let e of dc(n))a=e.tokens?.call(p,a)||a;return Mc(a,{...n,fg:o,bg:s,themeName:c,rootStyle:n.rootStyle===!1?!1:n.rootStyle??l},p,u)}function Mc(e,t,n,r=vo(e)){let i=dc(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:$s,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=oc(a.htmlStyle||ac(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&&_o(m,r),m}function Nc(e){return e.map(e=>{let t=[],n=``,r;return e.forEach((i,a)=>{let o=!(i.fontStyle&&(i.fontStyle&Ai.Underline||i.fontStyle&Ai.Strikethrough));o&&kc.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 Pc(e){return e.map(e=>e.flatMap(e=>{if(kc.test(e.content))return e;let t=e.content.match(Ac);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 Fc(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=oc(e.htmlStyle||ac(e)),i=oc(n.htmlStyle||ac(n)),a=e.fontStyle&&(e.fontStyle&Ai.Underline||e.fontStyle&Ai.Strikethrough),o=n.fontStyle&&(n.fontStyle&Ai.Underline||n.fontStyle&Ai.Strikethrough);!a&&!o&&r===i?e.content+=n.content:t.push({...n})}return t})}var Ic=Ys;function Lc(e,t,n){let r={meta:{},options:n,codeToHast:(t,n)=>jc(e,t,n),codeToTokens:(t,n)=>Dc(e,t,n)},i=Ic(jc(e,t,n,r));for(let e of dc(n))i=e.postprocess?.call(r,i,n)||i;return i}async function Rc(e){let t=await ho(e);return{getLastGrammarState:(...e)=>To(t,...e),codeToTokensBase:(e,n)=>Ec(t,e,n),codeToTokensWithThemes:(e,n)=>No(t,e,n),codeToTokens:(e,n)=>Dc(t,e,n),codeToHast:(e,n)=>jc(t,e,n),codeToHtml:(e,n)=>Lc(t,e,n),getBundledLanguages:()=>({}),getBundledThemes:()=>({}),...t,getInternalContext:()=>t}}var zc=4294967295,Bc=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:zc,end:zc,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 Vc(e){if([...e].length!==1)throw Error(`Expected "${e}" to be a single code point`);return e.codePointAt(0)}function Hc(e,t,n){return e.has(t)||e.set(t,n),e.get(t)}var Uc=new Set([`alnum`,`alpha`,`ascii`,`blank`,`cntrl`,`digit`,`graph`,`lower`,`print`,`punct`,`space`,`upper`,`word`,`xdigit`]),V=String.raw;function Wc(e,t){if(e==null)throw Error(t??`Value expected`);return e}var Gc=V`\[\^?`,Kc=`c.? | C(?:-.?)?|${V`[pP]\{(?:\^?[-\x20_]*[A-Za-z][-\x20\w]*\})?`}|${V`x[89A-Fa-f]\p{AHex}(?:\\x[89A-Fa-f]\p{AHex})*`}|${V`u(?:\p{AHex}{4})? | x\{[^\}]*\}? | x\p{AHex}{0,2}`}|${V`o\{[^\}]*\}?`}|${V`\d{1,3}`}`,qc=/[?*+][?+]?|\{(?:\d+(?:,\d*)?|,\d+)\}\??/,Jc=new RegExp(V`
|
|
14
|
-
\\ (?:
|
|
15
|
-
${Kc}
|
|
16
|
-
| [gk]<[^>]*>?
|
|
17
|
-
| [gk]'[^']*'?
|
|
18
|
-
| .
|
|
19
|
-
)
|
|
20
|
-
| \( (?:
|
|
21
|
-
\? (?:
|
|
22
|
-
[:=!>({]
|
|
23
|
-
| <[=!]
|
|
24
|
-
| <[^>]*>
|
|
25
|
-
| '[^']*'
|
|
26
|
-
| ~\|?
|
|
27
|
-
| #(?:[^)\\]|\\.?)*
|
|
28
|
-
| [^:)]*[:)]
|
|
29
|
-
)?
|
|
30
|
-
| \*[^\)]*\)?
|
|
31
|
-
)?
|
|
32
|
-
| (?:${qc.source})+
|
|
33
|
-
| ${Gc}
|
|
34
|
-
| .
|
|
35
|
-
`.replace(/\s+/g,``),`gsu`),Yc=new RegExp(V`
|
|
36
|
-
\\ (?:
|
|
37
|
-
${Kc}
|
|
38
|
-
| .
|
|
39
|
-
)
|
|
40
|
-
| \[:(?:\^?\p{Alpha}+|\^):\]
|
|
41
|
-
| ${Gc}
|
|
42
|
-
| &&
|
|
43
|
-
| .
|
|
44
|
-
`.replace(/\s+/g,``),`gsu`);function Xc(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=El(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(Jc.lastIndex=0;s=Jc.exec(e);){let t=Zc(a,e,s[0],Jc.lastIndex);t.tokens?o.push(...t.tokens):t.token&&o.push(t.token),t.lastIndex!==void 0&&(Jc.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`?Ol(e,u):e).flat(),flags:r}}function Zc(e,t,n,r){let[i,a]=n;if(n===`[`||n===`[^`){let e=Qc(t,n,r);return{tokens:e.tokens,lastIndex:e.lastIndex}}if(i===`\\`){if(`AbBGyYzZ`.includes(a))return{token:nl(n,n)};if(/^\\g[<']/.test(n)){if(!/^\\g(?:<[^>]+>|'[^']+')$/.test(n))throw Error(`Invalid group name "${n}"`);return{token:gl(n)}}if(/^\\k[<']/.test(n)){if(!/^\\k(?:<[^>]+>|'[^']+')$/.test(n))throw Error(`Invalid group name "${n}"`);return{token:rl(n)}}if(a===`K`)return{token:ul(`keep`,n)};if(a===`N`||a===`R`)return{token:ll(`newline`,n,{negate:a===`N`})};if(a===`O`)return{token:ll(`any`,n)};if(a===`X`)return{token:ll(`text_segment`,n)};let e=el(n,{inCharClass:!1});return Array.isArray(e)?{tokens:e}:{token:e}}if(i===`(`){if(a===`*`)return{token:xl(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:bl(n,e)};if(e.pushModX(e.getCurrentModX()),e.numOpenGroups++,n===`(`&&!e.captureGroup||n===`(?:`)return{token:pl(`group`,n)};if(n===`(?>`)return{token:pl(`atomic`,n)};if(n===`(?=`||n===`(?!`||n===`(?<=`||n===`(?<!`)return{token:pl(n[2]===`<`?`lookbehind`:`lookahead`,n,{negate:n.endsWith(`!`)})};if(n===`(`&&e.captureGroup||n.startsWith(`(?<`)&&n.endsWith(`>`)||n.startsWith(`(?'`)&&n.endsWith(`'`))return{token:pl(`capturing`,n,{...n!==`(`&&{name:n.slice(3,-1)}})};if(n.startsWith(`(?~`)){if(n===`(?~|`)throw Error(`Unsupported absence function kind "${n}"`);return{token:pl(`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:fl(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:ll(`dot`,n)}:n===`^`||n===`$`?{token:nl(e.singleline?{"^":V`\A`,$:V`\Z`}[n]:n,n)}:n===`|`?{token:tl(n)}:qc.test(n)?{tokens:kl(n)}:{token:il(Vc(n),n)}}function Qc(e,t,n){let r=[cl(t[1]===`^`,t)],i=1,a;for(Yc.lastIndex=n;a=Yc.exec(e);){let e=a[0];if(e[0]===`[`&&e[1]!==`:`)i++,r.push(cl(e[1]===`^`,e));else if(e===`]`){if(r.at(-1).type===`CharacterClassOpen`)r.push(il(93,e));else if(i--,r.push(al(e)),!i)break}else{let t=$c(e);Array.isArray(t)?r.push(...t):r.push(t)}}return{tokens:r,lastIndex:Yc.lastIndex||e.length}}function $c(e){if(e[0]===`\\`)return el(e,{inCharClass:!0});if(e[0]===`[`){let t=/\[:(?<negate>\^?)(?<name>[a-z]+):\]/.exec(e);if(!t||!Uc.has(t.groups.name))throw Error(`Invalid POSIX class "${e}"`);return ll(`posix`,e,{value:t.groups.name,negate:!!t.groups.negate})}return e===`-`?ol(e):e===`&&`?sl(e):il(Vc(e),e)}function el(e,{inCharClass:t}){let n=e[1];if(n===`c`||n===`C`)return yl(e);if(`dDhHsSwW`.includes(n))return Cl(e);if(e.startsWith(V`\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 wl(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 il(Vc(e),t)})}catch{throw Error(`Multibyte code "${e}" incomplete or invalid in Oniguruma`)}if(n===`u`||n===`x`)return il(Dl(e),e);if(vl.has(n))return il(vl.get(n),e);if(/\d/.test(n))return dl(t,e);if(e===`\\`)throw Error(V`Incomplete escape "\"`);if(n===`M`)throw Error(`Unsupported meta "${e}"`);if([...e].length===2)return il(e.codePointAt(1),e);throw Error(`Unexpected escape "${e}"`)}function tl(e){return{type:`Alternator`,raw:e}}function nl(e,t){return{type:`Assertion`,kind:e,raw:t}}function rl(e){return{type:`Backreference`,raw:e}}function il(e,t){return{type:`Character`,value:e,raw:t}}function al(e){return{type:`CharacterClassClose`,raw:e}}function ol(e){return{type:`CharacterClassHyphen`,raw:e}}function sl(e){return{type:`CharacterClassIntersector`,raw:e}}function cl(e,t){return{type:`CharacterClassOpen`,negate:e,raw:t}}function ll(e,t,n={}){return{type:`CharacterSet`,kind:e,...n,raw:t}}function ul(e,t,n={}){return e===`keep`?{type:`Directive`,kind:e,raw:t}:{type:`Directive`,kind:e,flags:Wc(n.flags),raw:t}}function dl(e,t){return{type:`EscapedNumber`,inCharClass:e,raw:t}}function fl(e){return{type:`GroupClose`,raw:e}}function pl(e,t,n={}){return{type:`GroupOpen`,kind:e,...n,raw:t}}function ml(e,t,n,r){return{type:`NamedCallout`,kind:e,tag:t,arguments:n,raw:r}}function hl(e,t,n,r){return{type:`Quantifier`,kind:e,min:t,max:n,raw:r}}function gl(e){return{type:`Subroutine`,raw:e}}var _l=new Set([`COUNT`,`CMP`,`ERROR`,`FAIL`,`MAX`,`MISMATCH`,`SKIP`,`TOTAL_COUNT`]),vl=new Map([[`a`,7],[`b`,8],[`e`,27],[`f`,12],[`n`,10],[`r`,13],[`t`,9],[`v`,11]]);function yl(e){let t=e[1]===`c`?e[2]:e[3];if(!t||!/[A-Za-z]/.test(t))throw Error(`Unsupported control character "${e}"`);return il(Vc(t.toUpperCase())-64,e)}function bl(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=Tl(n),o=Tl(r),s={};if(a&&(s.enable=a),o&&(s.disable=o),e.endsWith(`)`))return t.replaceCurrentModX(i),ul(`flags`,e,{flags:s});if(e.endsWith(`:`))return t.pushModX(i),t.numOpenGroups++,pl(`group`,e,{...(a||o)&&{flags:s}});throw Error(`Unexpected flag modifier "${e}"`)}function xl(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=_l.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 ml(l,r??null,i?.split(`,`)??null,e)}function Sl(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 hl(t,n,r,e)}function Cl(e){let t=e[1].toLowerCase();return ll({d:`digit`,h:`hex`,s:`space`,w:`word`}[t],e,{negate:e[1]!==t})}function wl(e){let{p:t,neg:n,value:r}=/^\\(?<p>[pP])\{(?<neg>\^?)(?<value>[^}]+)/.exec(e).groups;return ll(`property`,e,{value:r,negate:t===`P`&&!n||t===`p`&&!!n})}function Tl(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 El(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 Dl(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 Ol(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[rl(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(V`Octal encoded byte above 177 unsupported "${n}"`)}else r=Vc(t);a.push(il(r,(e===0?`\\`:``)+t))}return a}function kl(e){let t=[],n=new RegExp(qc,`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(Sl(e.slice(0,-1)));continue}}}t.push(Sl(e))}return t}function Al(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 jl(e){return Ml.has(e.type)}var Ml=new Set([`AbsenceFunction`,`Backreference`,`CapturingGroup`,`Character`,`CharacterClass`,`CharacterSet`,`Group`,`Quantifier`,`Subroutine`]);function Nl(e,t={}){let n={flags:``,normalizeUnknownPropertyNames:!1,skipBackrefValidation:!1,skipLookbehindValidation:!1,skipPropertyNameValidation:!1,unicodePropertyMap:null,...t,rules:{captureGroup:!1,singleline:!1,...t.rules}},r=Xc(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 Ul();case`Assertion`:return Pl(n);case`Backreference`:return Fl(n,a);case`Character`:return ql(n.value,{useLastValid:!!t.isCheckingRangeEnd});case`CharacterClassHyphen`:return Il(n,a,t);case`CharacterClassOpen`:return Ll(n,a,t);case`CharacterSet`:return Rl(n,a);case`Directive`:return Zl(n.kind,{flags:n.flags});case`GroupOpen`:return zl(n,a,t);case`NamedCallout`:return tu(n.kind,n.tag,n.arguments);case`Quantifier`:return Bl(n,a);case`Subroutine`:return Vl(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=iu(Ql(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(V`Subroutine uses a duplicate group name "\g<${e}>"`);u.get(e)[0].isSubroutined=!0}else throw Error(V`Subroutine uses a group name that's not defined "\g<${e}>"`);return o}function Pl({kind:e}){return Wl(Wc({"^":`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===V`\B`||e===V`\Y`})}function Fl({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,Gl(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 Gl(r)}return i(+r)}function Il(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(),Yl(o,e);throw Error(`Invalid character class range`)}return ql(Vc(`-`))}function Ll({negate:e},t,n){let{tokens:r,walk:i}=t,a=[Jl()],o=r[t.nextIndex],s=hu(o);for(;s.type!==`CharacterClassClose`;){if(s.type===`CharacterClassIntersector`)a.push(Jl()),t.nextIndex++;else{let e=a.at(-1);e.body.push(i(e,n))}s=hu(r[t.nextIndex],o)}let c=Jl({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 Rl({kind:e,negate:t,value:n},r){let{normalizeUnknownPropertyNames:i,skipPropertyNameValidation:a,unicodePropertyMap:o}=r;if(e===`property`){let r=mu(n);if(Uc.has(r)&&!o?.has(r))e=`posix`,n=r;else return ou(n,{negate:t,normalizeUnknownPropertyNames:i,skipPropertyNameValidation:a,unicodePropertyMap:o})}return e===`posix`?nu(n,{negate:t}):Xl(e,{negate:t})}function zl(e,t,n){let{tokens:r,capturingGroups:i,namedGroupsByName:a,skipLookbehindValidation:o,walk:s}=t,c=su(e),l=c.type===`AbsenceFunction`,u=du(c),d=u&&c.negate;if(c.type===`CapturingGroup`&&(i.push(c),c.name&&Hc(a,c.name,[]).push(c)),l&&n.isInAbsenceFunction)throw Error(`Nested absence function not supported by Oniguruma`);let f=gu(r[t.nextIndex]);for(;f.type!==`GroupClose`;){if(f.type===`Alternator`)c.body.push(Ul()),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(uu(t)||t.type===`CapturingGroup`)throw Error(e)}else if(uu(t)||du(t)&&t.negate)throw Error(e)}}f=gu(r[t.nextIndex])}return t.nextIndex++,c}function Bl({kind:e,min:t,max:n},r){let i=r.parent,a=i.body.at(-1);if(!a||!jl(a))throw Error(`Quantifier requires a repeatable token`);let o=ru(e,t,n,a);return i.body.pop(),o}function Vl({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=au(i);return r.push(o),o}function Hl(e,t){if(e!==`repeater`)throw Error(`Unexpected absence function kind "${e}"`);return{type:`AbsenceFunction`,kind:e,body:cu(t?.body)}}function Ul(e){return{type:`Alternative`,body:lu(e?.body)}}function Wl(e,t){let n={type:`Assertion`,kind:e};return(e===`word_boundary`||e===`text_segment_boundary`)&&(n.negate=!!t?.negate),n}function Gl(e,t){let n=!!t?.orphan;return{type:`Backreference`,ref:e,...n&&{orphan:n}}}function Kl(e,t){let n={name:void 0,isSubroutined:!1,...t};if(n.name!==void 0&&!fu(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:cu(t?.body)}}function ql(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 Jl(e){let t={kind:`union`,negate:!1,...e};return{type:`CharacterClass`,kind:t.kind,negate:t.negate,body:lu(e?.body)}}function Yl(e,t){if(t.value<e.value)throw Error(`Character class range out of order`);return{type:`CharacterClassRange`,min:e,max:t}}function Xl(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 Zl(e,t={}){if(e===`keep`)return{type:`Directive`,kind:e};if(e===`flags`)return{type:`Directive`,kind:e,flags:Wc(t.flags)};throw Error(`Unexpected directive kind "${e}"`)}function Ql(e){return{type:`Flags`,...e}}function $l(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:cu(e?.body)}}function eu(e){let t={behind:!1,negate:!1,...e};return{type:`LookaroundAssertion`,kind:t.behind?`lookbehind`:`lookahead`,negate:t.negate,body:cu(e?.body)}}function tu(e,t,n){return{type:`NamedCallout`,kind:e,tag:t,arguments:n}}function nu(e,t){let n=!!t?.negate;if(!Uc.has(e))throw Error(`Invalid POSIX class "${e}"`);return{type:`CharacterSet`,kind:`posix`,value:e,negate:n}}function ru(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 iu(e,t){return{type:`Regex`,body:cu(t?.body),flags:e}}function au(e){return{type:`Subroutine`,ref:e}}function ou(e,t){let n={negate:!1,normalizeUnknownPropertyNames:!1,skipPropertyNameValidation:!1,unicodePropertyMap:null,...t},r=n.unicodePropertyMap?.get(mu(e));if(!r){if(n.normalizeUnknownPropertyNames)r=pu(e);else if(n.unicodePropertyMap&&!n.skipPropertyNameValidation)throw Error(V`Invalid Unicode property "\p{${e}}"`)}return{type:`CharacterSet`,kind:`property`,value:r??e,negate:n.negate}}function su({flags:e,kind:t,name:n,negate:r,number:i}){switch(t){case`absence_repeater`:return Hl(`repeater`);case`atomic`:return $l({atomic:!0});case`capturing`:return Kl(i,{name:n});case`group`:return $l({flags:e});case`lookahead`:case`lookbehind`:return eu({behind:t===`lookbehind`,negate:r});default:throw Error(`Unexpected group kind "${t}"`)}}function cu(e){if(e===void 0)e=[Ul()];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 lu(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 uu(e){return e.type===`LookaroundAssertion`&&e.kind===`lookahead`}function du(e){return e.type===`LookaroundAssertion`&&e.kind===`lookbehind`}function fu(e){return/^[\p{Alpha}\p{Pc}][^)]*$/u.test(e)}function pu(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 mu(e){return e.replace(/[- _]+/g,``).toLowerCase()}function hu(e,t){let n=t;return Wc(e,`Unclosed character class${n?.type===`Character`&&n.value===93&&n.raw===`]`?` (started with "]")`:``}`)}function gu(e){return Wc(e,`Unclosed group`)}function _u(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(){vu(c).splice(Math.max(0,yu(s)+l),1),l--,u=!0},removeAllNextSiblings(){return vu(c).splice(yu(s)+1)},removeAllPrevSiblings(){let e=yu(s)+l;return l-=e,vu(c).splice(0,Math.max(0,e))},replaceWith(e,t={}){let n=!!t.traverse;c?c[Math.max(0,yu(s)+l)]=e:Wc(o,`Can't replace root node`)[s]=e,n&&i(e,o,s,c),u=!0},replaceWithMultiple(e,t={}){let n=!!t.traverse;if(vu(c).splice(Math.max(0,yu(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,yu(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 vu(e){if(!Array.isArray(e))throw Error(`Container expected`);return e}function yu(e){if(typeof e!=`number`)throw Error(`Numeric key expected`);return e}var bu=String.raw`\(\?(?:[:=!>A-Za-z\-]|<[=!]|\(DEFINE\))`;function xu(e,t){for(let n=0;n<e.length;n++)e[n]>=t&&e[n]++}function Su(e,t,n,r){return e.slice(0,t)+r+e.slice(t+n.length)}var Cu=Object.freeze({DEFAULT:`DEFAULT`,CHAR_CLASS:`CHAR_CLASS`});function wu(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===Cu.DEFAULT==!o)){n instanceof Function?s+=n(t,{context:o?Cu.CHAR_CLASS:Cu.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 Tu(e,t,n,r){wu(e,t,n,r)}function Eu(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===Cu.DEFAULT==!a))return o;e===`[`?a++:e===`]`&&a&&a--,i.lastIndex==o.index&&i.lastIndex++}return null}function Du(e,t,n){return!!Eu(e,t,0,n)}function Ou(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 ku=new RegExp(String.raw`(?<noncapturingStart>${bu})|(?<capturingStart>\((?:\?<[^>]+>)?)|\\?.`,`gsu`);function Au(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(ku.lastIndex=Number.isNaN(c)?0:c+7;f=ku.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),xu(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=wu(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}`},Cu.DEFAULT),{pattern:e,captureTransfers:r,hiddenCaptures:n}}var ju=String.raw`(?:[?*+]|\{\d+(?:,\d*)?\})`,Mu=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>${ju})(?<qMod>[?+]?)(?<invalidQ>[?*+\{]?)
|
|
59
|
-
| \\?.
|
|
60
|
-
`.replace(/\s+/g,``),`gsu`);function Nu(e){if(!RegExp(`${ju}\\+`).test(e))return{pattern:e};let t=[],n=null,r=null,i=``,a=0,o;for(Mu.lastIndex=0;o=Mu.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=Su(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}Mu.lastIndex+=t}else s[0]===`(`?t.push(c):s===`)`&&(n=t.length?t.pop():null);i=s}return{pattern:e}}var Pu=String.raw,Fu=Pu`\(\?R=(?<rDepth>[^\)]+)\)|${Pu`\\g<(?<gRNameOrNum>[^>&]+)&R=(?<gRDepth>[^>]+)>`}`,Iu=Pu`\(\?<(?![=!])(?<captureName>[^>]+)>`,Lu=Pu`${Iu}|(?<unnamed>\()(?!\?)`,Ru=new RegExp(Pu`${Iu}|${Fu}|\(\?|\\?.`,`gsu`),zu=`Cannot use multiple overlapping recursions`;function Bu(e,t){let{hiddenCaptures:n,mode:r}={hiddenCaptures:[],mode:`plugin`,...t},i=t?.captureTransfers??new Map;if(!new RegExp(Fu,`su`).test(e))return{pattern:e,captureTransfers:i,hiddenCaptures:n};if(r===`plugin`&&Du(e,Pu`\(\?\(DEFINE\)`,Cu.DEFAULT))throw Error(`DEFINE groups cannot be used with recursion`);let a=[],o=Du(e,Pu`\\[1-9]`,Cu.DEFAULT),s=new Map,c=[],l=!1,u=0,d=0,f;for(Ru.lastIndex=0;f=Ru.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(Vu(m),l)throw Error(zu);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(Ru.lastIndex);if(Du(s,Fu,Cu.DEFAULT))throw Error(zu);let c=m-1;e=Hu(t,s,c,!1,n,a,d),i=Gu(i,t,c,a.length,0,d);break}else if(h){Vu(g);let u=!1;for(let e of c)if(e.name===h||e.num===+h){if(u=!0,e.hasRecursedWithin)throw Error(zu);break}if(!u)throw Error(Pu`Recursive \g cannot be used outside the referenced group "${r===`external`?h:Pu`\g<${h}&R=${g}>`}"`);let p=s.get(h),m=Ou(e,p);if(o&&Du(m,Pu`${Iu}|\((?!\?)`,Cu.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=Hu(_,v,b,!0,n,a,d);i=Gu(i,_,b,a.length-y,y,d),e=`${e.slice(0,p)}${x}${e.slice(p+m.length)}`,Ru.lastIndex+=x.length-t.length-_.length-v.length,c.forEach(e=>e.hasRecursedWithin=!0),l=!0}else if(p)d++,s.set(String(d),Ru.lastIndex),s.set(p,Ru.lastIndex),c.push({num:d,name:p});else if(t[0]===`(`){let e=t===`(`;e&&(d++,s.set(String(d),Ru.lastIndex)),c.push(e?{num:d}:{})}else t===`)`&&c.pop()}return n.push(...a),{pattern:e,captureTransfers:i,hiddenCaptures:n}}function Vu(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 Hu(e,t,n,r,i,a,o){let s=new Set;r&&Tu(e+t,Iu,({groups:{captureName:e}})=>{s.add(e)},Cu.DEFAULT);let c=[n,r?s:null,i,a,o];return`${e}${Uu(`(?:${e}`,`forward`,...c)}(?:)${Uu(`${t})`,`backward`,...c)}${t}`}function Uu(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+=wu(e,Pu`${Lu}|\\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),Wu(i,n),s?e:`(?<${t}${l}>`}return Pu`\k<${c}${l}>`},Cu.DEFAULT)}return c}function Wu(e,t){for(let n=0;n<e.length;n++)e[n]>=t&&e[n]++}function Gu(e,t,n,r,i,a){if(e.size&&r){let o=0;Tu(t,Lu,()=>o++,Cu.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 H=String.fromCodePoint,U=String.raw,Ku={},qu=globalThis.RegExp;Ku.flagGroups=(()=>{try{new qu(`(?i:)`)}catch{return!1}return!0})(),Ku.unicodeSets=(()=>{try{new qu(`[[]]`,`v`)}catch{return!1}return!0})(),Ku.bugFlagVLiteralHyphenIsRange=Ku.unicodeSets?(()=>{try{new qu(U`[\d\-a]`,`v`)}catch{return!0}return!1})():!1,Ku.bugNestedClassIgnoresNegation=Ku.unicodeSets&&new qu(`[[^a]]`,`v`).test(`a`);function Ju(e,{enable:t,disable:n}){return{dotAll:!n?.dotAll&&!!(t?.dotAll||e.dotAll),ignoreCase:!n?.ignoreCase&&!!(t?.ignoreCase||e.ignoreCase)}}function Yu(e,t,n){return e.has(t)||e.set(t,n),e.get(t)}function Xu(e,t){return Qu[e]>=Qu[t]}function Zu(e,t){if(e==null)throw Error(t??`Value expected`);return e}var Qu={ES2025:2025,ES2024:2024,ES2018:2018},$u={auto:`auto`,ES2025:`ES2025`,ES2024:`ES2024`,ES2018:`ES2018`};function ed(e={}){if({}.toString.call(e)!==`[object Object]`)throw Error(`Unexpected options`);if(e.target!==void 0&&!$u[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=Ku.flagGroups?`ES2025`:Ku.unicodeSets?`ES2024`:`ES2018`),t}var td=`[ -\r ]`,nd=new Set([H(304),H(305)]),rd=U`[\p{L}\p{M}\p{N}\p{Pc}]`;function id(e){if(nd.has(e))return[e];let t=new Set,n=e.toLowerCase(),r=n.toUpperCase(),i=cd.get(n),a=od.get(n),o=sd.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 ad=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=>[mu(e),e])),od=new Map([[`s`,H(383)],[H(383),`s`]]),sd=new Map([[H(223),H(7838)],[H(107),H(8490)],[H(229),H(8491)],[H(969),H(8486)]]),cd=new Map([dd(453),dd(456),dd(459),dd(498),...fd(8072,8079),...fd(8088,8095),...fd(8104,8111),dd(8124),dd(8140),dd(8188)]),ld=new Map([[`alnum`,U`[\p{Alpha}\p{Nd}]`],[`alpha`,U`\p{Alpha}`],[`ascii`,U`\p{ASCII}`],[`blank`,U`[\p{Zs}\t]`],[`cntrl`,U`\p{Cc}`],[`digit`,U`\p{Nd}`],[`graph`,U`[\P{space}&&\P{Cc}&&\P{Cn}&&\P{Cs}]`],[`lower`,U`\p{Lower}`],[`print`,U`[[\P{space}&&\P{Cc}&&\P{Cn}&&\P{Cs}]\p{Zs}]`],[`punct`,U`[\p{P}\p{S}]`],[`space`,U`\p{space}`],[`upper`,U`\p{Upper}`],[`word`,U`[\p{Alpha}\p{M}\p{Nd}\p{Pc}]`],[`xdigit`,U`\p{AHex}`]]);function ud(e,t){let n=[];for(let r=e;r<=t;r++)n.push(r);return n}function dd(e){let t=H(e);return[t.toLowerCase(),t]}function fd(e,t){return ud(e,t).map(e=>dd(e))}var pd=new Set([`Lower`,`Lowercase`,`Upper`,`Uppercase`,`Ll`,`Lowercase_Letter`,`Lt`,`Titlecase_Letter`,`Lu`,`Uppercase_Letter`]);function md(e,t){let n={accuracy:`default`,asciiWordBoundaries:!1,avoidSubclass:!1,bestEffortTarget:`ES2025`,...t};vd(e);let r={accuracy:n.accuracy,asciiWordBoundaries:n.asciiWordBoundaries,avoidSubclass:n.avoidSubclass,flagDirectivesByAlt:new Map,jsGroupNameMap:new Map,minTargetEs2024:Xu(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};_u(e,hd,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 _u(e,gd,a),_u(e,_d,{groupsByName:a.groupsByName,highestOrphanBackref:0,numCapturesToLeft:0,reffedNodesByReferencer:a.reffedNodesByReferencer}),e._originMap=a.groupOriginByCopy,e._strategy=r.strategy,e}var hd={AbsenceFunction({node:e,parent:t,replaceWith:n}){let{body:r,kind:i}=e;if(i===`repeater`){let e=$l();e.body[0].body.push(eu({negate:!0,body:r}),ou(`Any`));let i=$l();i.body[0].body.push(ru(`greedy`,0,1/0,e)),n(W(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];Yu(r,n,[]).push(...i)}},exit({node:e},{flagDirectivesByAlt:t}){if(t.get(e)?.length){let n=Td(t.get(e));if(n){let t=$l({flags:n});t.body[0].body=e.body,e.body=[W(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(W(eu({body:[Ul({body:[Wl(`string_end`)]}),Ul({body:[ql(10)]})]}),t));else if(c===`line_start`)o(W(Pd(U`(?<=\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&&jd(e))o(W(eu({negate:!0}),t));else if(d)throw Error(U`Uses "\G" in a way that requires a subclass`);else o(Id(Wl(`string_start`),t)),s.strategy=`clip_search`}else if(!(c===`string_end`||c===`string_start`))if(c===`string_end_newline`)o(W(Pd(U`(?=\n?\z)`),t));else if(c===`word_boundary`){if(!p&&!u){let e=`(?:(?<=${rd})(?!${rd})|(?<!${rd})(?=${rd}))`,n=`(?:(?<=${rd})(?=${rd})|(?<!${rd})(?!${rd}))`;o(W(Pd(l?n:e),t))}}else throw Error(`Unexpected assertion kind "${c}"`)},Backreference({node:e},{jsGroupNameMap:t}){let{ref:n}=e;typeof n==`string`&&!Nd(n)&&(n=wd(n,t),e.ref=n)},CapturingGroup({node:e},{jsGroupNameMap:t,subroutineRefMap:n}){let{name:r}=e;r&&!Nd(r)&&(r=wd(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(W(Jl({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(Id(Xl(`digit`,{negate:l}),t));return}if(o&&(c===`space`||u===`space`)){n(W(Fd(Pd(td),l),t));return}if(s&&(c===`word`||u===`word`)){n(Id(Xl(`word`,{negate:l}),t));return}if(c===`any`)n(Id(ou(`Any`),t));else if(c===`digit`)n(Id(ou(`Nd`,{negate:l}),t));else if(c!==`dot`)if(c===`text_segment`){if(r===`strict`)throw Error(U`Use of "\X" requires non-strict accuracy`);let e=`\\p{Emoji}(?:\\p{EMod}|\\uFE0F\\u20E3?|[\\x{E0020}-\\x{E007E}]+\\x{E007F})?`,a=U`\p{RI}{2}|${e}(?:\u200D${e})*`;n(W(Pd(U`(?>\r\n|${i?U`\p{RGI_Emoji}`:a}|\P{M}\p{M}*)`,{skipPropertyNameValidation:!0}),t))}else if(c===`hex`)n(Id(ou(`AHex`,{negate:l}),t));else if(c===`newline`)n(W(Pd(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-${H(e.codePointAt(0)-1)}${H(e.codePointAt(2)+1)}-\u{10FFFF}`),n(W(Pd(`[${e}]`),t))}else n(W(Fd(Pd(ld.get(u)),l),t));else if(c===`property`)ad.has(mu(u))||(e.key=`sc`);else if(c===`space`)n(Id(ou(`space`,{negate:l}),t));else if(c===`word`)n(W(Fd(Pd(rd),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=$l({flags:c});e.body[0].body=o(),i(W(e,t),{traverse:!0})}else if(s===`keep`){let e=n.body[0],r=n.body.length===1&&Al(e,{type:`Group`})&&e.body[0].body.length===1?e.body[0]:n;if(t.parent!==r||r.body.length>1)throw Error(U`Uses "\K" in a way that's unsupported`);let o=eu({behind:!0});o.body[0].body=a(),i(W(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(W(eu({negate:!0}),t));else throw Error(`Unsupported named callout "(*${r.toUpperCase()}"`)},Quantifier({node:e}){if(e.body.type===`Quantifier`){let t=$l();t.body[0].body.push(e.body),e.body=W(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=Od(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(U`Uses "\G" in a way that requires non-strict accuracy`)}},Subroutine({node:e},{jsGroupNameMap:t}){let{ref:n}=e;typeof n==`string`&&!Nd(n)&&(n=wd(n,t),e.ref=n)}},gd={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=Id(Sd(e.number),t);c.set(r,s.get(e.number)),n(r);return}s.set(e.number,e),o.set(e.number,[]),e.name&&Yu(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=Yu(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=Ju(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?Sd(0):xd(o,r.groupOriginByCopy,null),l=c;if(!s){let e=Td(Cd(o,e=>e.type===`Group`&&!!e.flags)),t=e?Ju(r.globalFlags,e):r.globalFlags;yd(t,r.currentFlags)||(l=$l({flags:Ed(t)}),l.body[0].body.push(c))}n(W(l,t),{traverse:!s})}},_d={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=>bd(t,e));i.length?i.length>1?n(W($l({atomic:!0,body:i.reverse().map(e=>Ul({body:[Gl(e.number)]}))}),t)):e.ref=i[0].number:n(W(eu({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=Kl();e.body.at(-1).body.push(t)}}},Subroutine({node:e},t){!e.isRecursive||e.ref===0||(e.ref=t.reffedNodesByReferencer.get(e).number)}};function vd(e){_u(e,{"*"({node:e,parent:t}){e.parent=t}})}function yd(e,t){return e.dotAll===t.dotAll&&e.ignoreCase===t.ignoreCase}function bd(e,t){let n=t;do{if(n.type===`Regex`)return!1;if(n.type===`Alternative`)continue;if(n===e)return!1;let t=Dd(n.parent);for(let r of t){if(r===n)break;if(r===e||kd(r,e))return!0}}while(n=n.parent);throw Error(`Unexpected path`)}function xd(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]=xd(o,t,i,n):(a===`type`&&o===`CapturingGroup`&&t.set(i,t.get(e)??e),i[a]=o);return i}function Sd(e){let t=au(e);return t.isRecursive=!0,t}function Cd(e,t){let n=[];for(;e=e.parent;)(!t||t(e))&&n.push(e);return n}function wd(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 Td(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 Ed({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 Dd(e){if(!e)throw Error(`Node expected`);let{body:t}=e;return Array.isArray(t)?t:t?[t]:null}function Od(e){let t=e.find(e=>e.kind===`search_start`||Md(e,{negate:!1})||!Ad(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=Od(n.body);if(!t)return null;Array.isArray(t)?e.push(...t):e.push(t)}return e}return null}function kd(e,t){let n=Dd(e)??[];for(let e of n)if(e===t||kd(e,t))return!0;return!1}function Ad({type:e}){return e===`Assertion`||e===`Directive`||e===`LookaroundAssertion`}function jd(e){let t=[`Character`,`CharacterClass`,`CharacterSet`];return t.includes(e.type)||e.type===`Quantifier`&&e.min&&t.includes(e.body.type)}function Md(e,t){let n={negate:null,...t};return e.type===`LookaroundAssertion`&&(n.negate===null||e.negate===n.negate)&&e.body.length===1&&Al(e.body[0],{type:`Assertion`,kind:`search_start`})}function Nd(e){return/^[$_\p{IDS}][$\u200C\u200D\p{IDC}]*$/u.test(e)}function Pd(e,t){let n=Nl(e,{...t,unicodePropertyMap:ad}).body;return n.length>1||n[0].body.length>1?$l({body:n}):n[0].body[0]}function Fd(e,t){return e.negate=t,e}function Id(e,t){return e.parent=t,e}function W(e,t){return vd(e),e.parent=t,e}function Ld(e,t){let n=ed(t),r=Xu(n.target,`ES2024`),i=Xu(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];_u(e,Rd,{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,Zu(zd[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&&Yu(f._captureTransfers,e.transferTo,[]).push(t)}),f}var Rd={"*":{enter({node:e},t){if(Zd(e)){let n=t.getCurrentModI();t.pushModI(e.flags?Ju({ignoreCase:n},e.flags).ignoreCase:n)}},exit({node:e},t){Zd(e)&&t.popModI()}},Backreference(e,t){t.setHasCasedChar()},Character({node:e},t){Gd(H(e.value))&&t.setHasCasedChar()},CharacterClassRange({node:e,skip:t},n){t(),Kd(e,{firstOnly:!0}).length&&n.setHasCasedChar()},CharacterSet({node:e},t){e.kind===`property`&&pd.has(e.value)&&t.setHasCasedChar()}},zd={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?U`\B`:U`\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=H(e),r=qd(e,{escDigit:t.lastNode.type===`Backreference`,inCharClass:t.inCharClass,useFlagV:t.useFlagV});if(r!==n)return r;if(t.useAppliedIgnoreCase&&t.currentFlags.ignoreCase&&Gd(n)){let e=id(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`);Ku.bugFlagVLiteralHyphenIsRange&&t.useFlagV&&o.some($d)&&(o=[ql(45),...o.filter(e=>!$d(e))]);let s=()=>`[${i?`^`:``}${o.map(n).join(r===`intersection`?`&&`:``)}]`;if(!t.inCharClass){if((!t.useFlagV||Ku.bugNestedClassIgnoresNegation)&&!i){let t=o.filter(e=>e.type===`CharacterClass`&&e.kind===`union`&&e.negate);if(t.length){let r=$l(),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=Ul({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`&&!(Ku.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=qd(n,i),o=qd(r,i),s=new Set;return t.useAppliedIgnoreCase&&t.currentFlags.ignoreCase&&Jd(Kd(e)).forEach(e=>{s.add(Array.isArray(e)?`${qd(e[0],i)}-${qd(e[1],i)}`:qd(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?`.`:`[^]`:U`[^\n]`;if(e===`digit`)return t?U`\D`:U`\d`;if(e===`property`){if(i.useAppliedIgnoreCase&&i.currentFlags.ignoreCase&&pd.has(n))throw Error(`Unicode property "${n}" can't be case-insensitive when other chars have specific case`);return`${t?U`\P`:U`\p`}{${r?`${r}=`:``}${n}}`}if(e===`word`)return t?U`\W`:U`\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=Ju(o,n));let s=t.map(a).join(`|`),c=!i.verbose&&t.length===1&&r.type!==`Quantifier`&&!e&&(!i.useFlagMods||!n)?s:`(?${Yd(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)+Xd(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})`:U`\g<${t}&R=${r}>`}},Bd=new Set([`$`,`(`,`)`,`*`,`+`,`.`,`?`,`[`,`\\`,`]`,`^`,`{`,`|`,`}`]),Vd=new Set([`-`,`\\`,`]`,`^`,`[`]),Hd=new Set("()-/[\\]^{|}!#$%&*+,.:;<=>?@`~".split(``)),Ud=new Map([[9,U`\t`],[10,U`\n`],[11,U`\v`],[12,U`\f`],[13,U`\r`],[8232,U`\u2028`],[8233,U`\u2029`],[65279,U`\uFEFF`]]),Wd=/^\p{Cased}$/u;function Gd(e){return Wd.test(e)}function Kd(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=H(e);if(!Gd(t))continue;let o=id(t).filter(e=>{let t=e.codePointAt(0);return t<r||t>i});if(o.length&&(a.push(...o),n))break}return a}function qd(e,{escDigit:t,inCharClass:n,useFlagV:r}){if(Ud.has(e))return Ud.get(e);if(e<32||e>126&&e<160||e>262143||t&&Qd(e))return e>255?`\\u{${e.toString(16).toUpperCase()}}`:`\\x${e.toString(16).toUpperCase().padStart(2,`0`)}`;let i=n?r?Hd:Vd:Bd,a=H(e);return(i.has(a)?`\\`:``)+a}function Jd(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 Yd(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 Xd({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 Zd({type:e}){return e===`CapturingGroup`||e===`Group`||e===`LookaroundAssertion`}function Qd(e){return e>47&&e<58}function $d({type:e,value:t}){return e===`Character`&&t===45}var ef=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=nf(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&&(tf(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||=rf(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 tf(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 nf(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)Yu(n,t,{}).transferTo=e;return n}function rf(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 af(e,t){let n=of(e,t);return n.options?new ef(n.pattern,n.flags,n.options):new RegExp(n.pattern,n.flags)}function of(e,t){let n=ed(t),r=md(Nl(e,{flags:n.flags,normalizeUnknownPropertyNames:!0,rules:{captureGroup:n.rules.captureGroup,singleline:n.rules.singleline},skipBackrefValidation:n.rules.allowOrphanBackrefs,unicodePropertyMap:ad}),{accuracy:n.accuracy,asciiWordBoundaries:n.rules.asciiWordBoundaries,avoidSubclass:n.avoidSubclass,bestEffortTarget:n.target}),i=Ld(r,n),a=Bu(i.pattern,{captureTransfers:i._captureTransfers,hiddenCaptures:i._hiddenCaptures,mode:`external`}),o=Au(Nu(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 sf(e,t){return af(e,{global:!0,hasIndices:!0,lazyCompileLength:3e3,rules:{allowOrphanBackrefs:!0,asciiWordBoundaries:!0,captureGroup:!0,recursionLimit:5,singleline:!0},...t})}function cf(e={}){let t={target:`auto`,cache:new Map,...e};return t.regexConstructor||=e=>sf(e,{target:t.target}),{createScanner(e){return new Bc(e,t)},createString(e){return{content:e}}}}var lf=e=>e&&e&1,uf=e=>e&&e&2,df=e=>e&&e&4,ff=new Set([`bash`,`css`,`diff`,`html`,`javascript`,`json`,`jsonc`,`jsx`,`markdown`,`python`,`shellscript`,`tsx`,`typescript`,`yaml`]),pf={bash:()=>N(()=>import(`./bash-B7CDPTg5.js`).then(e=>e.default),__vite__mapDeps([0,1]),import.meta.url),css:()=>N(()=>import(`./css-BsVw1vtW.js`).then(e=>e.default),[],import.meta.url),diff:()=>N(()=>import(`./diff-woXpYk--.js`).then(e=>e.default),[],import.meta.url),html:()=>N(()=>import(`./html-BY76lXLH.js`).then(e=>e.default),__vite__mapDeps([2,3,4]),import.meta.url),javascript:()=>N(()=>import(`./javascript-BgS3c2Ky.js`).then(e=>e.default),[],import.meta.url),json:()=>N(()=>import(`./json-qhed-kSA.js`).then(e=>e.default),[],import.meta.url),jsonc:()=>N(()=>import(`./jsonc-CYpm1nAK.js`).then(e=>e.default),[],import.meta.url),jsx:()=>N(()=>import(`./jsx-Bz0zcwM4.js`).then(e=>e.default),[],import.meta.url),markdown:()=>N(()=>import(`./markdown-BYOwaDjH.js`).then(e=>e.default),[],import.meta.url),python:()=>N(()=>import(`./python-gzcpVVnB.js`).then(e=>e.default),[],import.meta.url),shellscript:()=>N(()=>import(`./shellscript-CLZ0U2zV.js`).then(e=>e.default),[],import.meta.url),tsx:()=>N(()=>import(`./tsx-udAQXfEw.js`).then(e=>e.default),[],import.meta.url),typescript:()=>N(()=>import(`./typescript-bsJCZSQ-.js`).then(e=>e.default),[],import.meta.url),yaml:()=>N(()=>import(`./yaml-rwi0_p6S.js`).then(e=>e.default),[],import.meta.url)},mf={console:`shellscript`,cjs:`javascript`,htm:`html`,js:`javascript`,json5:`jsonc`,md:`markdown`,mjs:`javascript`,py:`python`,sh:`shellscript`,shell:`shellscript`,ts:`typescript`,yml:`yaml`},hf=e=>{let t=e.trim().toLowerCase();if(!t)return`text`;let n=mf[t]??t;return ff.has(n)?n:`text`},gf=e=>e.map((e,t)=>({key:`line-${t}`,tokens:e.map((e,n)=>({key:`line-${t}-${n}`,token:e}))})),_f=({token:e})=>(0,F.jsx)(`span`,{className:`dark:bg-(--shiki-dark-bg)! dark:text-(--shiki-dark)!`,style:{backgroundColor:e.bgColor,color:e.color,fontStyle:lf(e.fontStyle)?`italic`:void 0,fontWeight:uf(e.fontStyle)?`bold`:void 0,textDecoration:df(e.fontStyle)?`underline`:void 0,...e.htmlStyle},children:e.content}),vf=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`),yf=({keyedLine:e,showLineNumbers:t})=>(0,F.jsx)(`span`,{className:t?vf:`block`,children:e.tokens.length===0?`
|
|
154
|
-
`:e.tokens.map(({token:e,key:t})=>(0,F.jsx)(_f,{token:e},t))}),bf=(0,P.createContext)({code:``}),xf,Sf,Cf=new Map,wf=new Map,Tf=new Map,Ef=(e,t)=>{let n=e.slice(0,100),r=e.length>100?e.slice(-100):``;return`${t}:${e.length}:${n}:${r}`},Df=()=>(xf||=Rc({engine:cf({forgiving:!0})}),xf),Of=e=>(Sf||=Promise.all([N(()=>import(`./github-light-EUqPIrTm.js`).then(e=>e.default),[],import.meta.url),N(()=>import(`./github-dark-C-LZuMrd.js`).then(e=>e.default),[],import.meta.url)]).then(t=>e.loadTheme(...t)),Sf),kf=(e,t)=>{let n=Cf.get(t);if(n)return n;let r=pf[t]().then(t=>e.loadLanguage(...t));return Cf.set(t,r),r},Af=e=>({bg:`transparent`,fg:`inherit`,tokens:e.split(`
|
|
155
|
-
`).map(e=>e===``?[]:[{color:`inherit`,content:e}])}),jf=(e,t,n)=>{let r=hf(t);if(r===`text`)return Af(e);let i=Ef(e,r);return wf.get(i)||(n&&(Tf.has(i)||Tf.set(i,new Set),Tf.get(i)?.add(n)),Df().then(async t=>{await Of(t),await kf(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};wf.set(i,a);let o=Tf.get(i);if(o){for(let e of o)e(a);Tf.delete(i)}}).catch(e=>{console.error(`Failed to highlight code:`,e),Tf.delete(i)}),null)},Mf=(0,P.memo)(({tokenized:e,showLineNumbers:t,className:n})=>{let r=(0,P.useMemo)(()=>({backgroundColor:e.bg,color:e.fg}),[e.bg,e.fg]),i=(0,P.useMemo)(()=>gf(e.tokens),[e.tokens]);return(0,F.jsx)(`pre`,{className:l(`dark:bg-(--shiki-dark-bg)! dark:text-(--shiki-dark)! m-0 p-4 text-sm`,n),style:r,children:(0,F.jsx)(`code`,{className:l(`font-mono text-sm`,t&&`[counter-increment:line_0] [counter-reset:line]`),children:i.map(e=>(0,F.jsx)(yf,{keyedLine:e,showLineNumbers:t},e.key))})})},(e,t)=>e.tokenized===t.tokenized&&e.showLineNumbers===t.showLineNumbers&&e.className===t.className);Mf.displayName=`CodeBlockBody`;var Nf=({className:e,language:t,style:n,...r})=>(0,F.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}),Pf=({children:e,className:t,...n})=>(0,F.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}),Ff=({children:e,className:t,...n})=>(0,F.jsx)(`div`,{className:l(`flex items-center gap-2`,t),...n,children:e}),If=({children:e,className:t,...n})=>(0,F.jsx)(`span`,{className:l(`font-mono`,t),...n,children:e}),Lf=({children:e,className:t,...n})=>(0,F.jsx)(`div`,{className:l(`-my-1 -mr-1 flex items-center gap-2`,t),...n,children:e}),Rf=({code:e,language:t,showLineNumbers:n=!1})=>{let r=(0,P.useMemo)(()=>Af(e),[e]),i=(0,P.useMemo)(()=>jf(e,t)??r,[e,t,r]),a=(0,P.useMemo)(()=>({code:e,language:t}),[e,t]),[o,s]=(0,P.useState)({key:a,tokens:null}),c=o.key===a?o.tokens:null;return(0,P.useEffect)(()=>{let n=!1;return jf(e,t,e=>{n||s({key:a,tokens:e})}),()=>{n=!0}},[e,t,a]),(0,F.jsx)(`div`,{className:`relative overflow-auto`,children:(0,F.jsx)(Mf,{showLineNumbers:n,tokenized:c??i})})},zf=({code:e,language:t,showLineNumbers:n=!1,className:r,children:i,...a})=>{let o=(0,P.useMemo)(()=>({code:e}),[e]);return(0,F.jsx)(bf.Provider,{value:o,children:(0,F.jsxs)(Nf,{className:r,language:t,...a,children:[i,(0,F.jsx)(Rf,{code:e,language:t,showLineNumbers:n})]})})},Bf=({onCopy:e,onError:t,timeout:n=2e3,children:r,className:i,...a})=>{let[o,s]=(0,P.useState)(!1),c=(0,P.useRef)(0),{code:u}=(0,P.useContext)(bf),d=(0,P.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,P.useEffect)(()=>()=>{window.clearTimeout(c.current)},[]);let f=o?xe:te;return(0,F.jsx)(E,{className:l(`shrink-0`,i),onClick:d,size:`icon`,variant:`ghost`,...a,children:r??(0,F.jsx)(f,{size:14})})},Vf=/(?:^|\s)language-([^\s]+)/,Hf=/startLine=(\d+)/,Uf=/\bnoLineNumbers\b/;function Wf(e){return typeof e==`string`||typeof e==`number`?String(e):Array.isArray(e)?e.map(Wf).join(``):(0,P.isValidElement)(e)?Wf(e.props.children):``}var Gf={code:({children:e,className:t,node:n,"data-block":r,...i})=>{let a=t?.match(Vf)?.[1]??`text`;if(!r)return(0,F.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(Hf),c=s?Number.parseInt(s[1],10):1,u=o?!Uf.test(o):!0;return(0,F.jsx)(zf,{code:Wf(e),"data-start-line":c>1?c:void 0,language:a,showLineNumbers:u,children:(0,F.jsxs)(Pf,{children:[(0,F.jsx)(Ff,{children:(0,F.jsx)(If,{children:a})}),(0,F.jsx)(Lf,{children:(0,F.jsx)(Bf,{})})]})})}},Kf={fontFamily:`monospace`,securityLevel:`strict`,startOnLoad:!1,suppressErrorRendering:!0,theme:`default`};function qf(){let e=Kf,t=!1,n={initialize(n){e={...Kf,...e,...n},t=!1},async render(n,r){let i=(await N(()=>import(`./mermaid.core-bKbkko4L.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 Jf={cjk:li,mermaid:qf()},Yf=(0,P.memo)(({className:e,components:t,...n})=>(0,F.jsx)(Je,{className:e,components:t?{...Gf,...t}:Gf,plugins:Jf,...n}));Yf.displayName=`HubStreamdown`;var Xf=({className:e,from:t,...n})=>(0,F.jsx)(`div`,{className:l(`group flex w-full flex-col gap-2`,t===`user`?`is-user ml-auto justify-end`:`is-assistant`,e),...n}),Zf=({children:e,className:t,...n})=>(0,F.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,P.createContext)(null);var Qf=(0,P.memo)(({className:e,...t})=>(0,F.jsx)(Yf,{className:l(`size-full [&>*:first-child]:mt-0 [&>*:last-child]:mb-0`,e),...t}));Qf.displayName=`MessageResponse`;var $f=1,ep=.9,tp=.8,np=.17,rp=.1,ip=.999,ap=.9999,op=.99,sp=/[\\\/_+.#"@\[\(\{&]/,cp=/[\\\/_+.#"@\[\(\{&]/g,lp=/[\s-]/,up=/[\s-]/g;function dp(e,t,n,r,i,a,o){if(a===t.length)return i===e.length?$f:op;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=dp(e,t,n,r,l+1,a+1,o),d>u&&(l===i?d*=$f:sp.test(e.charAt(l-1))?(d*=tp,p=e.slice(i,l-1).match(cp),p&&i>0&&(d*=ip**+p.length)):lp.test(e.charAt(l-1))?(d*=ep,m=e.slice(i,l-1).match(up),m&&i>0&&(d*=ip**+m.length)):(d*=np,i>0&&(d*=ip**+(l-i))),e.charAt(l)!==t.charAt(a)&&(d*=ap)),(d<rp&&n.charAt(l-1)===r.charAt(a+1)||r.charAt(a+1)===r.charAt(a)&&n.charAt(l-1)!==r.charAt(a))&&(f=dp(e,t,n,r,l+1,a+2,o),f*rp>d&&(d=f*rp)),d>u&&(u=d),l=n.indexOf(c,l+1);return o[s]=u,u}function fp(e){return e.toLowerCase().replace(up,` `)}function pp(e,t,n){return e=n&&n.length>0?`${e+` `+n.join(` `)}`:e,dp(e,t,fp(e),fp(t),0,0,{})}typeof window<`u`&&window.document&&window.document.createElement;function mp(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(e?.(r),n===!1||!r.defaultPrevented)return t?.(r)}}function hp(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}function gp(...e){return t=>{let n=!1,r=e.map(e=>{let r=hp(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():hp(e[t],null)}}}}function _p(...e){return P.useCallback(gp(...e),e)}function vp(e,t){let n=P.createContext(t),r=e=>{let{children:t,...r}=e,i=P.useMemo(()=>r,Object.values(r));return(0,F.jsx)(n.Provider,{value:i,children:t})};r.displayName=e+`Provider`;function i(r){let i=P.useContext(n);if(i)return i;if(t!==void 0)return t;throw Error(`\`${r}\` must be used within \`${e}\``)}return[r,i]}function yp(e,t=[]){let n=[];function r(t,r){let i=P.createContext(r),a=n.length;n=[...n,r];let o=t=>{let{scope:n,children:r,...o}=t,s=n?.[e]?.[a]||i,c=P.useMemo(()=>o,Object.values(o));return(0,F.jsx)(s.Provider,{value:c,children:r})};o.displayName=t+`Provider`;function s(n,o){let s=o?.[e]?.[a]||i,c=P.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=>P.createContext(e));return function(n){let r=n?.[e]||t;return P.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 P.useMemo(()=>({[`__scope${t.scopeName}`]:r}),[r])}};return n.scopeName=t.scopeName,n}var xp=globalThis?.document?P.useLayoutEffect:()=>{},Sp=P.useId||(()=>void 0),Cp=0;function wp(e){let[t,n]=P.useState(Sp());return xp(()=>{e||n(e=>e??String(Cp++))},[e]),e||(t?`radix-${t}`:``)}var Tp=P.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=P.useRef(e!==void 0);P.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,P.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]=P.useState(e),i=P.useRef(n),a=P.useRef(t);return Tp(()=>{a.current=t},[t]),P.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=jp(e),n=P.forwardRef((e,n)=>{let{children:r,...i}=e,a=P.Children.toArray(r),o=a.find(Np);if(o){let e=o.props.children,r=a.map(t=>t===o?P.Children.count(e)>1?P.Children.only(null):P.isValidElement(e)?e.props.children:null:t);return(0,F.jsx)(t,{...i,ref:n,children:P.isValidElement(e)?P.cloneElement(e,void 0,r):null})}return(0,F.jsx)(t,{...i,ref:n,children:r})});return n.displayName=`${e}.Slot`,n}function jp(e){let t=P.forwardRef((e,t)=>{let{children:n,...r}=e;if(P.isValidElement(n)){let e=Fp(n),i=Pp(r,n.props);return n.type!==P.Fragment&&(i.ref=t?gp(t,e):e),P.cloneElement(n,i)}return P.Children.count(n)>1?P.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Mp=Symbol(`radix.slottable`);function Np(e){return P.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===Mp}function Pp(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 Fp(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 Ip=[`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=P.forwardRef((e,r)=>{let{asChild:i,...a}=e,o=i?n:t;return typeof window<`u`&&(window[Symbol.for(`radix-ui`)]=!0),(0,F.jsx)(o,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function Lp(e,t){e&&kp.flushSync(()=>e.dispatchEvent(t))}function Rp(e){let t=P.useRef(e);return P.useEffect(()=>{t.current=e}),P.useMemo(()=>(...e)=>t.current?.(...e),[])}function zp(e,t=globalThis?.document){let n=Rp(e);P.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 Bp=`DismissableLayer`,Vp=`dismissableLayer.update`,Hp=`dismissableLayer.pointerDownOutside`,Up=`dismissableLayer.focusOutside`,Wp,Gp=P.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Kp=P.forwardRef((e,t)=>{let{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:i,onFocusOutside:a,onInteractOutside:o,onDismiss:s,...c}=e,l=P.useContext(Gp),[u,d]=P.useState(null),f=u?.ownerDocument??globalThis?.document,[,p]=P.useState({}),m=_p(t,e=>d(e)),h=Array.from(l.layers),[g]=[...l.layersWithOutsidePointerEventsDisabled].slice(-1),_=h.indexOf(g),v=u?h.indexOf(u):-1,y=l.layersWithOutsidePointerEventsDisabled.size>0,b=v>=_,x=Yp(e=>{let t=e.target,n=[...l.branches].some(e=>e.contains(t));!b||n||(i?.(e),o?.(e),e.defaultPrevented||s?.())},f),S=Xp(e=>{let t=e.target;[...l.branches].some(e=>e.contains(t))||(a?.(e),o?.(e),e.defaultPrevented||s?.())},f);return zp(e=>{v===l.layers.size-1&&(r?.(e),!e.defaultPrevented&&s&&(e.preventDefault(),s()))},f),P.useEffect(()=>{if(u)return n&&(l.layersWithOutsidePointerEventsDisabled.size===0&&(Wp=f.body.style.pointerEvents,f.body.style.pointerEvents=`none`),l.layersWithOutsidePointerEventsDisabled.add(u)),l.layers.add(u),Zp(),()=>{n&&l.layersWithOutsidePointerEventsDisabled.size===1&&(f.body.style.pointerEvents=Wp)}},[u,f,n,l]),P.useEffect(()=>()=>{u&&(l.layers.delete(u),l.layersWithOutsidePointerEventsDisabled.delete(u),Zp())},[u,l]),P.useEffect(()=>{let e=()=>p({});return document.addEventListener(Vp,e),()=>document.removeEventListener(Vp,e)},[]),(0,F.jsx)(Ip.div,{...c,ref:m,style:{pointerEvents:y?b?`auto`:`none`:void 0,...e.style},onFocusCapture:mp(e.onFocusCapture,S.onFocusCapture),onBlurCapture:mp(e.onBlurCapture,S.onBlurCapture),onPointerDownCapture:mp(e.onPointerDownCapture,x.onPointerDownCapture)})});Kp.displayName=Bp;var qp=`DismissableLayerBranch`,Jp=P.forwardRef((e,t)=>{let n=P.useContext(Gp),r=P.useRef(null),i=_p(t,r);return P.useEffect(()=>{let e=r.current;if(e)return n.branches.add(e),()=>{n.branches.delete(e)}},[n.branches]),(0,F.jsx)(Ip.div,{...e,ref:i})});Jp.displayName=qp;function Yp(e,t=globalThis?.document){let n=Rp(e),r=P.useRef(!1),i=P.useRef(()=>{});return P.useEffect(()=>{let e=e=>{if(e.target&&!r.current){let r=function(){Qp(Hp,n,a,{discrete:!0})},a={originalEvent:e};e.pointerType===`touch`?(t.removeEventListener(`click`,i.current),i.current=r,t.addEventListener(`click`,i.current,{once:!0})):r()}else t.removeEventListener(`click`,i.current);r.current=!1},a=window.setTimeout(()=>{t.addEventListener(`pointerdown`,e)},0);return()=>{window.clearTimeout(a),t.removeEventListener(`pointerdown`,e),t.removeEventListener(`click`,i.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function Xp(e,t=globalThis?.document){let n=Rp(e),r=P.useRef(!1);return P.useEffect(()=>{let e=e=>{e.target&&!r.current&&Qp(Up,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 Zp(){let e=new CustomEvent(Vp);document.dispatchEvent(e)}function Qp(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?Lp(i,a):i.dispatchEvent(a)}var $p=`focusScope.autoFocusOnMount`,em=`focusScope.autoFocusOnUnmount`,tm={bubbles:!1,cancelable:!0},nm=`FocusScope`,rm=P.forwardRef((e,t)=>{let{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:a,...o}=e,[s,c]=P.useState(null),l=Rp(i),u=Rp(a),d=P.useRef(null),f=_p(t,e=>c(e)),p=P.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;P.useEffect(()=>{if(r){let e=function(e){if(p.paused||!s)return;let t=e.target;s.contains(t)?d.current=t:um(d.current,{select:!0})},t=function(e){if(p.paused||!s)return;let t=e.relatedTarget;t!==null&&(s.contains(t)||um(d.current,{select:!0}))},n=function(e){if(document.activeElement===document.body)for(let t of e)t.removedNodes.length>0&&um(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]),P.useEffect(()=>{if(s){dm.add(p);let e=document.activeElement;if(!s.contains(e)){let t=new CustomEvent($p,tm);s.addEventListener($p,l),s.dispatchEvent(t),t.defaultPrevented||(im(mm(om(s)),{select:!0}),document.activeElement===e&&um(s))}return()=>{s.removeEventListener($p,l),setTimeout(()=>{let t=new CustomEvent(em,tm);s.addEventListener(em,u),s.dispatchEvent(t),t.defaultPrevented||um(e??document.body,{select:!0}),s.removeEventListener(em,u),dm.remove(p)},0)}}},[s,l,u,p]);let m=P.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]=am(t);r&&a?!e.shiftKey&&i===a?(e.preventDefault(),n&&um(r,{select:!0})):e.shiftKey&&i===r&&(e.preventDefault(),n&&um(a,{select:!0})):i===t&&e.preventDefault()}},[n,r,p.paused]);return(0,F.jsx)(Ip.div,{tabIndex:-1,...o,ref:f,onKeyDown:m})});rm.displayName=nm;function im(e,{select:t=!1}={}){let n=document.activeElement;for(let r of e)if(um(r,{select:t}),document.activeElement!==n)return}function am(e){let t=om(e);return[sm(t,e),sm(t.reverse(),e)]}function om(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 sm(e,t){for(let n of e)if(!cm(n,{upTo:t}))return n}function cm(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 lm(e){return e instanceof HTMLInputElement&&`select`in e}function um(e,{select:t=!1}={}){if(e&&e.focus){let n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&lm(e)&&t&&e.select()}}var dm=fm();function fm(){let e=[];return{add(t){let n=e[0];t!==n&&n?.pause(),e=pm(e,t),e.unshift(t)},remove(t){e=pm(e,t),e[0]?.resume()}}}function pm(e,t){let n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function mm(e){return e.filter(e=>e.tagName!==`A`)}var hm=`Portal`,gm=P.forwardRef((e,t)=>{let{container:n,...r}=e,[i,a]=P.useState(!1);xp(()=>a(!0),[]);let o=n||i&&globalThis?.document?.body;return o?kp.createPortal((0,F.jsx)(Ip.div,{...r,ref:t}),o):null});gm.displayName=hm;function _m(e,t){return P.useReducer((e,n)=>t[e][n]??e,e)}var vm=e=>{let{present:t,children:n}=e,r=ym(t),i=typeof n==`function`?n({present:r.isPresent}):P.Children.only(n),a=_p(r.ref,xm(i));return typeof n==`function`||r.isPresent?P.cloneElement(i,{ref:a}):null};vm.displayName=`Presence`;function ym(e){let[t,n]=P.useState(),r=P.useRef(null),i=P.useRef(e),a=P.useRef(`none`),[o,s]=_m(e?`mounted`:`unmounted`,{mounted:{UNMOUNT:`unmounted`,ANIMATION_OUT:`unmountSuspended`},unmountSuspended:{MOUNT:`mounted`,ANIMATION_END:`unmounted`},unmounted:{MOUNT:`mounted`}});return P.useEffect(()=>{let e=bm(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=bm(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=bm(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=bm(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:P.useCallback(e=>{r.current=e?getComputedStyle(e):null,n(e)},[])}}function bm(e){return e?.animationName||`none`}function xm(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 Sm=0;function Cm(){P.useEffect(()=>{let e=document.querySelectorAll(`[data-radix-focus-guard]`);return document.body.insertAdjacentElement(`afterbegin`,e[0]??wm()),document.body.insertAdjacentElement(`beforeend`,e[1]??wm()),Sm++,()=>{Sm===1&&document.querySelectorAll(`[data-radix-focus-guard]`).forEach(e=>e.remove()),Sm--}},[])}function wm(){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 Tm=function(){return Tm=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},Tm.apply(this,arguments)};function Em(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 Dm(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 Om=`right-scroll-bar-position`,km=`width-before-scroll-bar`,Am=`with-scroll-bars-hidden`,jm=`--removed-body-scroll-bar-size`;function Mm(e,t){return typeof e==`function`?e(t):e&&(e.current=t),e}function Nm(e,t){var n=(0,P.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 Pm=typeof window<`u`?P.useLayoutEffect:P.useEffect,Fm=new WeakMap;function Im(e,t){var n=Nm(t||null,function(t){return e.forEach(function(e){return Mm(e,t)})});return Pm(function(){var t=Fm.get(n);if(t){var r=new Set(t),i=new Set(e),a=n.current;r.forEach(function(e){i.has(e)||Mm(e,null)}),i.forEach(function(e){r.has(e)||Mm(e,a)})}Fm.set(n,e)},[e]),n}function Lm(e){return e}function Rm(e,t){t===void 0&&(t=Lm);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 zm(e){e===void 0&&(e={});var t=Rm(null);return t.options=Tm({async:!0,ssr:!1},e),t}var Bm=function(e){var t=e.sideCar,n=Em(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 P.createElement(r,Tm({},n))};Bm.isSideCarExport=!0;function Vm(e,t){return e.useMedium(t),Bm}var Hm=zm(),Um=function(){},Wm=P.forwardRef(function(e,t){var n=P.useRef(null),r=P.useState({onScrollCapture:Um,onWheelCapture:Um,onTouchMoveCapture:Um}),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=Em(e,[`forwardProps`,`children`,`className`,`removeScrollBar`,`enabled`,`shards`,`sideCar`,`noRelative`,`noIsolation`,`inert`,`allowPinchZoom`,`as`,`gapMode`]),x=f,S=Im([n,t]),C=Tm(Tm({},b),i);return P.createElement(P.Fragment,null,u&&P.createElement(x,{sideCar:Hm,removeScrollBar:l,shards:d,noRelative:p,noIsolation:m,inert:h,setCallbacks:a,allowPinchZoom:!!g,lockRef:n,gapMode:y}),o?P.cloneElement(P.Children.only(s),Tm(Tm({},C),{ref:S})):P.createElement(v,Tm({},C,{className:c,ref:S}),s))});Wm.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},Wm.classNames={fullWidth:km,zeroRight:Om};var Gm,Km=function(){if(Gm)return Gm;if(typeof __webpack_nonce__<`u`)return __webpack_nonce__};function qm(){if(!document)return null;var e=document.createElement(`style`);e.type=`text/css`;var t=Km();return t&&e.setAttribute(`nonce`,t),e}function Jm(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function Ym(e){(document.head||document.getElementsByTagName(`head`)[0]).appendChild(e)}var Xm=function(){var e=0,t=null;return{add:function(n){e==0&&(t=qm())&&(Jm(t,n),Ym(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},Zm=function(){var e=Xm();return function(t,n){P.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},Qm=function(){var e=Zm();return function(t){var n=t.styles,r=t.dynamic;return e(n,r),null}},$m={left:0,top:0,right:0,gap:0},eh=function(e){return parseInt(e||``,10)||0},th=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[eh(n),eh(r),eh(i)]},nh=function(e){if(e===void 0&&(e=`margin`),typeof window>`u`)return $m;var t=th(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])}},rh=Qm(),ih=`data-scroll-locked`,ah=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
|
-
.${Am} {
|
|
157
|
-
overflow: hidden ${r};
|
|
158
|
-
padding-right: ${s}px ${r};
|
|
159
|
-
}
|
|
160
|
-
body[${ih}] {
|
|
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
|
-
.${Om} {
|
|
174
|
-
right: ${s}px ${r};
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
.${km} {
|
|
178
|
-
margin-right: ${s}px ${r};
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
.${Om} .${Om} {
|
|
182
|
-
right: 0 ${r};
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
.${km} .${km} {
|
|
186
|
-
margin-right: 0 ${r};
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
body[${ih}] {
|
|
190
|
-
${jm}: ${s}px;
|
|
191
|
-
}
|
|
192
|
-
`},oh=function(){var e=parseInt(document.body.getAttribute(`data-scroll-locked`)||`0`,10);return isFinite(e)?e:0},sh=function(){P.useEffect(function(){return document.body.setAttribute(ih,(oh()+1).toString()),function(){var e=oh()-1;e<=0?document.body.removeAttribute(ih):document.body.setAttribute(ih,e.toString())}},[])},ch=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,i=r===void 0?`margin`:r;sh();var a=P.useMemo(function(){return nh(i)},[i]);return P.createElement(rh,{styles:ah(a,!t,i,n?``:`!important`)})},lh=!1;if(typeof window<`u`)try{var uh=Object.defineProperty({},"passive",{get:function(){return lh=!0,!0}});window.addEventListener(`test`,uh,uh),window.removeEventListener(`test`,uh,uh)}catch{lh=!1}var dh=lh?{passive:!1}:!1,fh=function(e){return e.tagName===`TEXTAREA`},ph=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!==`hidden`&&!(n.overflowY===n.overflowX&&!fh(e)&&n[t]===`visible`)},mh=function(e){return ph(e,`overflowY`)},hh=function(e){return ph(e,`overflowX`)},gh=function(e,t){var n=t.ownerDocument,r=t;do{if(typeof ShadowRoot<`u`&&r instanceof ShadowRoot&&(r=r.host),yh(e,r)){var i=bh(e,r);if(i[1]>i[2])return!0}r=r.parentNode}while(r&&r!==n.body);return!1},_h=function(e){return[e.scrollTop,e.scrollHeight,e.clientHeight]},vh=function(e){return[e.scrollLeft,e.scrollWidth,e.clientWidth]},yh=function(e,t){return e===`v`?mh(t):hh(t)},bh=function(e,t){return e===`v`?_h(t):vh(t)},xh=function(e,t){return e===`h`&&t===`rtl`?-1:1},Sh=function(e,t,n,r,i){var a=xh(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=bh(e,s),m=p[0],h=p[1]-p[2]-a*m;(m||h)&&yh(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},Ch=function(e){return`changedTouches`in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},wh=function(e){return[e.deltaX,e.deltaY]},Th=function(e){return e&&`current`in e?e.current:e},Eh=function(e,t){return e[0]===t[0]&&e[1]===t[1]},Dh=function(e){return`
|
|
193
|
-
.block-interactivity-${e} {pointer-events: none;}
|
|
194
|
-
.allow-interactivity-${e} {pointer-events: all;}
|
|
195
|
-
`},Oh=0,kh=[];function Ah(e){var t=P.useRef([]),n=P.useRef([0,0]),r=P.useRef(),i=P.useState(Oh++)[0],a=P.useState(Qm)[0],o=P.useRef(e);P.useEffect(function(){o.current=e},[e]),P.useEffect(function(){if(e.inert){document.body.classList.add(`block-interactivity-${i}`);var t=Dm([e.lockRef.current],(e.shards||[]).map(Th),!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=P.useCallback(function(e,t){if(`touches`in e&&e.touches.length===2||e.type===`wheel`&&e.ctrlKey)return!o.current.allowPinchZoom;var i=Ch(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=gh(d,u);if(!m)return!0;if(m?l=d:(l=d===`v`?`h`:`v`,m=gh(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 Sh(h,t,e,h===`h`?s:c,!0)},[]),c=P.useCallback(function(e){var n=e;if(!(!kh.length||kh[kh.length-1]!==a)){var r=`deltaY`in n?wh(n):Ch(n),i=t.current.filter(function(e){return e.name===n.type&&(e.target===n.target||n.target===e.shadowParent)&&Eh(e.delta,r)})[0];if(i&&i.should){n.cancelable&&n.preventDefault();return}if(!i){var c=(o.current.shards||[]).map(Th).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=P.useCallback(function(e,n,r,i){var a={name:e,delta:n,target:r,should:i,shadowParent:jh(r)};t.current.push(a),setTimeout(function(){t.current=t.current.filter(function(e){return e!==a})},1)},[]),u=P.useCallback(function(e){n.current=Ch(e),r.current=void 0},[]),d=P.useCallback(function(t){l(t.type,wh(t),t.target,s(t,e.lockRef.current))},[]),f=P.useCallback(function(t){l(t.type,Ch(t),t.target,s(t,e.lockRef.current))},[]);P.useEffect(function(){return kh.push(a),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener(`wheel`,c,dh),document.addEventListener(`touchmove`,c,dh),document.addEventListener(`touchstart`,u,dh),function(){kh=kh.filter(function(e){return e!==a}),document.removeEventListener(`wheel`,c,dh),document.removeEventListener(`touchmove`,c,dh),document.removeEventListener(`touchstart`,u,dh)}},[]);var p=e.removeScrollBar,m=e.inert;return P.createElement(P.Fragment,null,m?P.createElement(a,{styles:Dh(i)}):null,p?P.createElement(ch,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function jh(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}var Mh=Vm(Hm,Ah),Nh=P.forwardRef(function(e,t){return P.createElement(Wm,Tm({},e,{ref:t,sideCar:Mh}))});Nh.classNames=Wm.classNames;var Ph=function(e){return typeof document>`u`?null:(Array.isArray(e)?e[0]:e).ownerDocument.body},Fh=new WeakMap,Ih=new WeakMap,Lh={},Rh=0,zh=function(e){return e&&(e.host||zh(e.parentNode))},Bh=function(e,t){return t.map(function(t){if(e.contains(t))return t;var n=zh(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})},Vh=function(e,t,n,r){var i=Bh(t,Array.isArray(e)?e:[e]);Lh[n]||(Lh[n]=new WeakMap);var a=Lh[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=(Fh.get(e)||0)+1,l=(a.get(e)||0)+1;Fh.set(e,c),a.set(e,l),o.push(e),c===1&&i&&Ih.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(),Rh++,function(){o.forEach(function(e){var t=Fh.get(e)-1,i=a.get(e)-1;Fh.set(e,t),a.set(e,i),t||(Ih.has(e)||e.removeAttribute(r),Ih.delete(e)),i||e.removeAttribute(n)}),Rh--,Rh||(Fh=new WeakMap,Fh=new WeakMap,Ih=new WeakMap,Lh={})}},Hh=function(e,t,n){n===void 0&&(n=`data-aria-hidden`);var r=Array.from(Array.isArray(e)?e:[e]),i=t||Ph(e);return i?(r.push.apply(r,Array.from(i.querySelectorAll(`[aria-live], script`))),Vh(r,i,n,`aria-hidden`)):function(){return null}},Uh=`Dialog`,[Wh,Gh]=yp(Uh),[Kh,qh]=Wh(Uh),Jh=e=>{let{__scopeDialog:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!0}=e,s=P.useRef(null),c=P.useRef(null),[l,u]=Ep({prop:r,defaultProp:i??!1,onChange:a,caller:Uh});return(0,F.jsx)(Kh,{scope:t,triggerRef:s,contentRef:c,contentId:wp(),titleId:wp(),descriptionId:wp(),open:l,onOpenChange:u,onOpenToggle:P.useCallback(()=>u(e=>!e),[u]),modal:o,children:n})};Jh.displayName=Uh;var Yh=`DialogTrigger`,Xh=P.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=qh(Yh,n),a=_p(t,i.triggerRef);return(0,F.jsx)(Ip.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.contentId,"data-state":gg(i.open),...r,ref:a,onClick:mp(e.onClick,i.onOpenToggle)})});Xh.displayName=Yh;var Zh=`DialogPortal`,[Qh,$h]=Wh(Zh,{forceMount:void 0}),eg=e=>{let{__scopeDialog:t,forceMount:n,children:r,container:i}=e,a=qh(Zh,t);return(0,F.jsx)(Qh,{scope:t,forceMount:n,children:P.Children.map(r,e=>(0,F.jsx)(vm,{present:n||a.open,children:(0,F.jsx)(gm,{asChild:!0,container:i,children:e})}))})};eg.displayName=Zh;var tg=`DialogOverlay`,ng=P.forwardRef((e,t)=>{let n=$h(tg,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=qh(tg,e.__scopeDialog);return a.modal?(0,F.jsx)(vm,{present:r||a.open,children:(0,F.jsx)(ig,{...i,ref:t})}):null});ng.displayName=tg;var rg=Ap(`DialogOverlay.RemoveScroll`),ig=P.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=qh(tg,n);return(0,F.jsx)(Nh,{as:rg,allowPinchZoom:!0,shards:[i.contentRef],children:(0,F.jsx)(Ip.div,{"data-state":gg(i.open),...r,ref:t,style:{pointerEvents:`auto`,...r.style}})})}),ag=`DialogContent`,og=P.forwardRef((e,t)=>{let n=$h(ag,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=qh(ag,e.__scopeDialog);return(0,F.jsx)(vm,{present:r||a.open,children:a.modal?(0,F.jsx)(sg,{...i,ref:t}):(0,F.jsx)(cg,{...i,ref:t})})});og.displayName=ag;var sg=P.forwardRef((e,t)=>{let n=qh(ag,e.__scopeDialog),r=P.useRef(null),i=_p(t,n.contentRef,r);return P.useEffect(()=>{let e=r.current;if(e)return Hh(e)},[]),(0,F.jsx)(lg,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:mp(e.onCloseAutoFocus,e=>{e.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:mp(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;(t.button===2||n)&&e.preventDefault()}),onFocusOutside:mp(e.onFocusOutside,e=>e.preventDefault())})}),cg=P.forwardRef((e,t)=>{let n=qh(ag,e.__scopeDialog),r=P.useRef(!1),i=P.useRef(!1);return(0,F.jsx)(lg,{...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()}})}),lg=P.forwardRef((e,t)=>{let{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,...o}=e,s=qh(ag,n),c=P.useRef(null),l=_p(t,c);return Cm(),(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(rm,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,F.jsx)(Kp,{role:`dialog`,id:s.contentId,"aria-describedby":s.descriptionId,"aria-labelledby":s.titleId,"data-state":gg(s.open),...o,ref:l,onDismiss:()=>s.onOpenChange(!1)})}),(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(bg,{titleId:s.titleId}),(0,F.jsx)(Sg,{contentRef:c,descriptionId:s.descriptionId})]})]})}),ug=`DialogTitle`,dg=P.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=qh(ug,n);return(0,F.jsx)(Ip.h2,{id:i.titleId,...r,ref:t})});dg.displayName=ug;var fg=`DialogDescription`,pg=P.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=qh(fg,n);return(0,F.jsx)(Ip.p,{id:i.descriptionId,...r,ref:t})});pg.displayName=fg;var mg=`DialogClose`,hg=P.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=qh(mg,n);return(0,F.jsx)(Ip.button,{type:`button`,...r,ref:t,onClick:mp(e.onClick,()=>i.onOpenChange(!1))})});hg.displayName=mg;function gg(e){return e?`open`:`closed`}var _g=`DialogTitleWarning`,[vg,yg]=vp(_g,{contentName:ag,titleName:ug,docsSlug:`dialog`}),bg=({titleId:e})=>{let t=yg(_g),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
|
|
196
|
-
|
|
197
|
-
If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
|
|
198
|
-
|
|
199
|
-
For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return P.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},xg=`DialogDescriptionWarning`,Sg=({contentRef:e,descriptionId:t})=>{let n=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${yg(xg).contentName}}.`;return P.useEffect(()=>{let r=e.current?.getAttribute(`aria-describedby`);t&&r&&(document.getElementById(t)||console.warn(n))},[n,e,t]),null},Cg=Jh,wg=eg,Tg=ng,Eg=og,Dg=Symbol.for(`react.lazy`),Og=P.use;function kg(e){return typeof e==`object`&&!!e&&`then`in e}function Ag(e){return typeof e==`object`&&!!e&&`$$typeof`in e&&e.$$typeof===Dg&&`_payload`in e&&kg(e._payload)}function jg(e){let t=Mg(e),n=P.forwardRef((e,n)=>{let{children:r,...i}=e;Ag(r)&&typeof Og==`function`&&(r=Og(r._payload));let a=P.Children.toArray(r),o=a.find(Pg);if(o){let e=o.props.children,r=a.map(t=>t===o?P.Children.count(e)>1?P.Children.only(null):P.isValidElement(e)?e.props.children:null:t);return(0,F.jsx)(t,{...i,ref:n,children:P.isValidElement(e)?P.cloneElement(e,void 0,r):null})}return(0,F.jsx)(t,{...i,ref:n,children:r})});return n.displayName=`${e}.Slot`,n}function Mg(e){let t=P.forwardRef((e,t)=>{let{children:n,...r}=e;if(Ag(n)&&typeof Og==`function`&&(n=Og(n._payload)),P.isValidElement(n)){let e=Ig(n),i=Fg(r,n.props);return n.type!==P.Fragment&&(i.ref=t?gp(t,e):e),P.cloneElement(n,i)}return P.Children.count(n)>1?P.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Ng=Symbol(`radix.slottable`);function Pg(e){return P.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===Ng}function Fg(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 Ig(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 Lg=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=jg(`Primitive.${t}`),r=P.forwardRef((e,r)=>{let{asChild:i,...a}=e,o=i?n:t;return typeof window<`u`&&(window[Symbol.for(`radix-ui`)]=!0),(0,F.jsx)(o,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),Rg=`[cmdk-group=""]`,zg=`[cmdk-group-items=""]`,Bg=`[cmdk-group-heading=""]`,Vg=`[cmdk-item=""]`,Hg=`${Vg}:not([aria-disabled="true"])`,Ug=`cmdk-item-select`,Wg=`data-value`,Gg=(e,t,n)=>pp(e,t,n),Kg=P.createContext(void 0),qg=()=>P.useContext(Kg),Jg=P.createContext(void 0),Yg=()=>P.useContext(Jg),Xg=P.createContext(void 0),Zg=P.forwardRef((e,t)=>{let n=d_(()=>({search:``,value:e.value??e.defaultValue??``,selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}})),r=d_(()=>new Set),i=d_(()=>new Map),a=d_(()=>new Map),o=d_(()=>new Set),s=l_(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=P.useRef(null),S=m_();u_(()=>{if(u!==void 0){let e=u.trim();n.current.value=e,C.emit()}},[u]),u_(()=>{S(6,O)},[]);let C=P.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=P.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??Gg;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;A().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(zg);t?t.appendChild(e.parentElement===t?e:e.closest(`${zg} > *`)):r.appendChild(e.parentElement===r?e:e.closest(`${zg} > *`))}),t.sort((e,t)=>t[1]-e[1]).forEach(e=>{let t=x.current?.querySelector(`${Rg}[${Wg}="${encodeURIComponent(e[0])}"]`);t?.parentElement.appendChild(t)})}function E(){let e=A().find(e=>e.getAttribute(`aria-disabled`)!==`true`)?.getAttribute(Wg);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(Rg)?.querySelector(Bg))==null||e.scrollIntoView({block:`nearest`})),t.scrollIntoView({block:`nearest`}))}function k(){return x.current?.querySelector(`${Vg}[aria-selected="true"]`)}function A(){return Array.from(x.current?.querySelectorAll(Hg)||[])}function j(e){let t=A()[e];t&&C.setState(`value`,t.getAttribute(Wg))}function te(e){var t;let n=k(),r=A(),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(Wg))}function ne(e){let t=k()?.closest(Rg),n;for(;t&&!n;)t=e>0?s_(t,Rg):c_(t,Rg),n=t?.querySelector(Hg);n?C.setState(`value`,n.getAttribute(Wg)):te(e)}let re=()=>j(A().length-1),M=e=>{e.preventDefault(),e.metaKey?re():e.altKey?ne(1):te(1)},ie=e=>{e.preventDefault(),e.metaKey?j(0):e.altKey?ne(-1):te(-1)};return P.createElement(Lg.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&&M(e);break;case`ArrowDown`:M(e);break;case`p`:case`k`:g&&e.ctrlKey&&ie(e);break;case`ArrowUp`:ie(e);break;case`Home`:e.preventDefault(),j(0);break;case`End`:e.preventDefault(),re();break;case`Enter`:{e.preventDefault();let t=k();if(t){let e=new Event(Ug);t.dispatchEvent(e)}}}}},P.createElement(`label`,{"cmdk-label":``,htmlFor:w.inputId,id:w.labelId,style:__},c),g_(e,e=>P.createElement(Jg.Provider,{value:C},P.createElement(Kg.Provider,{value:w},e))))}),Qg=P.forwardRef((e,t)=>{let n=wp(),r=P.useRef(null),i=P.useContext(Xg),a=qg(),o=l_(e),s=o.current?.forceMount??i?.forceMount;u_(()=>{if(!s)return a.item(n,i?.id)},[s]);let c=p_(n,r,[e.value,e.children,r],e.keywords),l=Yg(),u=f_(e=>e.value&&e.value===c.current),d=f_(e=>s||a.filter()===!1?!0:e.search?e.filtered.items.get(n)>0:!0);P.useEffect(()=>{let t=r.current;if(!(!t||e.disabled))return t.addEventListener(Ug,f),()=>t.removeEventListener(Ug,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 P.createElement(Lg.div,{ref:gp(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)}),$g=P.forwardRef((e,t)=>{let{heading:n,children:r,forceMount:i,...a}=e,o=wp(),s=P.useRef(null),c=P.useRef(null),l=wp(),u=qg(),d=f_(e=>i||u.filter()===!1?!0:e.search?e.filtered.groups.has(o):!0);u_(()=>u.group(o),[]),p_(o,s,[e.value,e.heading,c]);let f=P.useMemo(()=>({id:o,forceMount:i}),[i]);return P.createElement(Lg.div,{ref:gp(s,t),...a,"cmdk-group":``,role:`presentation`,hidden:d?void 0:!0},n&&P.createElement(`div`,{ref:c,"cmdk-group-heading":``,"aria-hidden":!0,id:l},n),g_(e,e=>P.createElement(`div`,{"cmdk-group-items":``,role:`group`,"aria-labelledby":n?l:void 0},P.createElement(Xg.Provider,{value:f},e))))}),e_=P.forwardRef((e,t)=>{let{alwaysRender:n,...r}=e,i=P.useRef(null),a=f_(e=>!e.search);return!n&&!a?null:P.createElement(Lg.div,{ref:gp(i,t),...r,"cmdk-separator":``,role:`separator`})}),t_=P.forwardRef((e,t)=>{let{onValueChange:n,...r}=e,i=e.value!=null,a=Yg(),o=f_(e=>e.search),s=f_(e=>e.selectedItemId),c=qg();return P.useEffect(()=>{e.value!=null&&a.setState(`search`,e.value)},[e.value]),P.createElement(Lg.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)}})}),n_=P.forwardRef((e,t)=>{let{children:n,label:r=`Suggestions`,...i}=e,a=P.useRef(null),o=P.useRef(null),s=f_(e=>e.selectedItemId),c=qg();return P.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)}}},[]),P.createElement(Lg.div,{ref:gp(a,t),...i,"cmdk-list":``,role:`listbox`,tabIndex:-1,"aria-activedescendant":s,"aria-label":r,id:c.listId},g_(e,e=>P.createElement(`div`,{ref:gp(o,c.listInnerRef),"cmdk-list-sizer":``},e)))}),r_=P.forwardRef((e,t)=>{let{open:n,onOpenChange:r,overlayClassName:i,contentClassName:a,container:o,...s}=e;return P.createElement(Cg,{open:n,onOpenChange:r},P.createElement(wg,{container:o},P.createElement(Tg,{"cmdk-overlay":``,className:i}),P.createElement(Eg,{"aria-label":e.label,"cmdk-dialog":``,className:a},P.createElement(Zg,{ref:t,...s}))))}),i_=P.forwardRef((e,t)=>f_(e=>e.filtered.count===0)?P.createElement(Lg.div,{ref:t,...e,"cmdk-empty":``,role:`presentation`}):null),a_=P.forwardRef((e,t)=>{let{progress:n,children:r,label:i=`Loading...`,...a}=e;return P.createElement(Lg.div,{ref:t,...a,"cmdk-loading":``,role:`progressbar`,"aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":i},g_(e,e=>P.createElement(`div`,{"aria-hidden":!0},e)))}),o_=Object.assign(Zg,{List:n_,Item:Qg,Input:t_,Group:$g,Separator:e_,Dialog:r_,Empty:i_,Loading:a_});function s_(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function c_(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function l_(e){let t=P.useRef(e);return u_(()=>{t.current=e}),t}var u_=typeof window>`u`?P.useEffect:P.useLayoutEffect;function d_(e){let t=P.useRef();return t.current===void 0&&(t.current=e()),t}function f_(e){let t=Yg(),n=()=>e(t.snapshot());return P.useSyncExternalStore(t.subscribe,n,n)}function p_(e,t,n,r=[]){let i=P.useRef(),a=qg();return u_(()=>{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(Wg,s),i.current=s}),i}var m_=()=>{let[e,t]=P.useState(),n=d_(()=>new Map);return u_(()=>{n.current.forEach(e=>e()),n.current=new Map},[e]),(e,r)=>{n.current.set(e,r),t({})}};function h_(e){let t=e.type;return typeof t==`function`?t(e.props):`render`in t?t.render(e.props):e}function g_({asChild:e,children:t},n){return e&&P.isValidElement(t)?P.cloneElement(h_(t),{ref:t.ref},n(t.props.children)):n(t)}var __={position:`absolute`,width:`1px`,height:`1px`,padding:`0`,margin:`-1px`,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,borderWidth:`0`};function v_({className:e,...t}){return(0,F.jsx)(o_,{"data-slot":`command`,className:l(`flex size-full flex-col overflow-hidden rounded-xl! bg-popover p-1 text-popover-foreground`,e),...t})}function y_({className:e,...t}){return(0,F.jsx)(`div`,{"data-slot":`command-input-wrapper`,className:`p-1 pb-0`,children:(0,F.jsxs)(le,{className:`h-8! rounded-lg! border-input/30 bg-input/30 shadow-none! *:data-[slot=input-group-addon]:pl-2!`,children:[(0,F.jsx)(o_.Input,{"data-slot":`command-input`,className:l(`w-full text-sm outline-hidden disabled:cursor-not-allowed disabled:opacity-50`,e),...t}),(0,F.jsx)(fe,{children:(0,F.jsx)(ve,{className:`size-4 shrink-0 opacity-50`})})]})})}function b_({className:e,...t}){return(0,F.jsx)(o_.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 x_({className:e,...t}){return(0,F.jsx)(o_.Empty,{"data-slot":`command-empty`,className:l(`py-6 text-center text-sm`,e),...t})}function S_({className:e,...t}){return(0,F.jsx)(o_.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 C_({className:e,children:t,...n}){return(0,F.jsxs)(o_.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,F.jsx)(xe,{className:`ml-auto opacity-0 group-has-data-[slot=command-shortcut]/command-item:hidden group-data-[checked=true]/command-item:opacity-100`})]})}var w_=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}},T_=async e=>await new Promise(t=>{let n=new FileReader;n.onloadend=()=>t(n.result??null),n.onerror=()=>t(null),n.readAsDataURL(e)}),E_=(0,P.createContext)(null),D_=(0,P.createContext)(null),O_=()=>{let e=(0,P.useContext)(E_);if(!e)throw Error(`Wrap your component inside <PromptInputProvider> to use usePromptInputController().`);return e},k_=()=>(0,P.useContext)(E_),A_=()=>(0,P.useContext)(D_),j_=({initialInput:e=``,children:t})=>{let[n,r]=(0,P.useState)(e),i=(0,P.useCallback)(()=>r(``),[]),[a,o]=(0,P.useState)([]),s=(0,P.useRef)(null),c=(0,P.useRef)(()=>{}),l=(0,P.useCallback)(e=>{let t=[...e];t.length!==0&&o(e=>[...e,...t.map(e=>({filename:e.name,id:xt(),mediaType:e.type,rawFile:e,type:`file`,url:URL.createObjectURL(e)}))])},[]),u=(0,P.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,P.useCallback)(()=>{o(e=>{for(let t of e)t.url&&URL.revokeObjectURL(t.url);return[]})},[]),f=(0,P.useRef)(a);(0,P.useEffect)(()=>{f.current=a},[a]),(0,P.useEffect)(()=>()=>{for(let e of f.current)e.url&&URL.revokeObjectURL(e.url)},[]);let p=(0,P.useCallback)(()=>{c.current?.()},[]),m=(0,P.useMemo)(()=>({add:l,clear:d,fileInputRef:s,files:a,openFileDialog:p,remove:u}),[a,l,u,d,p]),h=(0,P.useCallback)((e,t)=>{s.current=e.current,c.current=t},[]),g=(0,P.useMemo)(()=>({__registerFileInput:h,attachments:m,textInput:{clear:i,setInput:r,value:n}}),[n,i,m,h]);return(0,F.jsx)(E_.Provider,{value:g,children:(0,F.jsx)(D_.Provider,{value:m,children:t})})},M_=(0,P.createContext)(null),N_=()=>{let e=A_(),t=(0,P.useContext)(M_)??e;if(!t)throw Error(`usePromptInputAttachments must be used within a PromptInput or PromptInputProvider`);return t},P_=(0,P.createContext)(null),F_=({className:e,accept:t,multiple:n,globalDrop:r,syncHiddenInput:i,maxFiles:a,maxFileSize:o,onError:s,onSubmit:c,children:u,...d})=>{let f=k_(),p=!!f,m=(0,P.useRef)(null),h=(0,P.useRef)(null),[g,_]=(0,P.useState)([]),v=p?f.attachments.files:g,[y,b]=(0,P.useState)([]),x=(0,P.useRef)(v);(0,P.useEffect)(()=>{x.current=v},[v]);let S=(0,P.useCallback)(()=>{m.current?.click()},[]),C=(0,P.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,P.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:xt(),mediaType:e.type,rawFile:e,type:`file`,url:URL.createObjectURL(e)});return[...e,...i]})},[C,a,o,s]),ee=(0,P.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,P.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,P.useCallback)(()=>p?f?.attachments.clear():_(e=>{for(let t of e)t.url&&URL.revokeObjectURL(t.url);return[]}),[p,f]),D=(0,P.useCallback)(()=>b([]),[]),O=p?T:w,k=p?f.attachments.remove:ee,A=p?f.attachments.openFileDialog:S,j=(0,P.useCallback)(()=>{E(),D()},[E,D]);(0,P.useEffect)(()=>{p&&f.__registerFileInput(m,()=>m.current?.click())},[p,f]),(0,P.useEffect)(()=>{i&&m.current&&v.length===0&&(m.current.value=``)},[v,i]),(0,P.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,P.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,P.useEffect)(()=>()=>{if(!p)for(let e of x.current)e.url&&URL.revokeObjectURL(e.url)},[p]);let te=(0,P.useCallback)(e=>{e.currentTarget.files&&O(e.currentTarget.files),e.currentTarget.value=``},[O]),ne=(0,P.useMemo)(()=>({add:O,clear:E,fileInputRef:m,files:v.map(e=>({...e,id:e.id})),openFileDialog:A,remove:k}),[v,O,k,E,A]),re=(0,P.useMemo)(()=>({add:e=>{let t=Array.isArray(e)?e:[e];b(e=>[...e,...t.map(e=>({...e,id:xt()}))])},clear:D,remove:e=>{b(t=>t.filter(t=>t.id!==e))},sources:y}),[y,D]),M=(0,P.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 T_(t);return{...n,url:e??n.url}}if(n.url?.startsWith(`blob:`)){let e=await w_(n.url);return{...n,url:e??n.url}}return n})),text:n},e);if(t instanceof Promise)try{await t,j(),p&&f.textInput.clear()}catch{}else j(),p&&f.textInput.clear()}catch{}},[p,f,v,c,j]),ie=(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`input`,{accept:t,"aria-label":`Upload files`,className:`hidden`,multiple:n,onChange:te,ref:m,title:`Upload files`,type:`file`}),(0,F.jsx)(`form`,{className:l(`w-full`,e),onSubmit:M,ref:h,...d,children:(0,F.jsx)(le,{className:`overflow-hidden`,children:u})})]}),ae=(0,F.jsx)(P_.Provider,{value:re,children:ie});return(0,F.jsx)(M_.Provider,{value:ne,children:ae})},I_=({className:e,...t})=>(0,F.jsx)(`div`,{className:l(`contents`,e),...t}),L_=({onChange:e,onKeyDown:t,className:n,placeholder:r=`How can I help you?`,...i})=>{let a=k_(),o=N_(),[s,c]=(0,P.useState)(!1),u=(0,P.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,P.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,P.useCallback)(()=>c(!1),[]),p=(0,P.useCallback)(()=>c(!0),[]),m=a?{onChange:t=>{a.textInput.setInput(t.currentTarget.value),e?.(t)},value:a.textInput.value}:{onChange:e};return(0,F.jsx)(ue,{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})},R_=({className:e,...t})=>(0,F.jsx)(fe,{align:`block-end`,className:l(`order-first flex-wrap gap-1`,e),...t}),z_=({className:e,...t})=>(0,F.jsx)(fe,{align:`block-end`,className:l(`justify-between gap-1`,e),...t}),B_=({className:e,...t})=>(0,F.jsx)(`div`,{className:l(`flex min-w-0 items-center gap-1`,e),...t}),V_=({variant:e=`ghost`,className:t,size:n,tooltip:r,...i})=>{let a=n??(P.Children.count(i.children)>1?`sm`:`icon-sm`),o=(0,F.jsx)(ae,{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,F.jsxs)(Ne,{children:[(0,F.jsx)(Ee,{children:o}),(0,F.jsxs)(Se,{side:u,children:[s,c&&(0,F.jsx)(`span`,{className:`ml-2 text-muted-foreground`,children:c})]})]})},H_=({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,F.jsx)(it,{className:`size-3`});r===`submitted`?u=(0,F.jsx)(Ie,{}):r===`streaming`?u=(0,F.jsx)(gt,{className:`size-3`}):r===`error`&&(u=(0,F.jsx)(oe,{className:`size-3`}));let d=(0,P.useCallback)(e=>{if(c&&i){e.preventDefault(),i();return}a?.(e)},[c,i,a]);return(0,F.jsx)(ae,{"aria-label":c?`Stop`:`Submit`,className:l(e),onClick:d,size:n,type:c&&i?`button`:`submit`,variant:t,...s,children:o??u})},U_=globalThis?.document?P.useLayoutEffect:()=>{},W_=P.useInsertionEffect||U_;function G_({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){let[i,a,o]=K_({defaultProp:t,onChange:n}),s=e!==void 0,c=s?e:i;{let t=P.useRef(e!==void 0);P.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,P.useCallback(t=>{if(s){let n=q_(t)?t(e):t;n!==e&&o.current?.(n)}else a(t)},[s,e,a,o])]}function K_({defaultProp:e,onChange:t}){let[n,r]=P.useState(e),i=P.useRef(n),a=P.useRef(t);return W_(()=>{a.current=t},[t]),P.useEffect(()=>{i.current!==n&&(a.current?.(n),i.current=n)},[n,i]),[n,r,a]}function q_(e){return typeof e==`function`}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}=ke(a,!0,!0),p=d(),[m,h]=P.useState(),_=m??p,v=u(e=>{let t=!a,n=s(g,e.nativeEvent);r(t,n),!n.isCanceled&&o(t)});return P.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 Y_=P.createContext(void 0);function X_(){let e=P.useContext(Y_);if(e===void 0)throw Error(c(15));return e}var Z_=function(e){return e.open=`data-open`,e.closed=`data-closed`,e[e.startingStyle=Pe.startingStyle]=`startingStyle`,e[e.endingStyle=Pe.endingStyle]=`endingStyle`,e}({}),Q_=function(e){return e.panelOpen=`data-panel-open`,e}({}),$_={[Z_.open]:``},ev={[Z_.closed]:``},tv={open(e){return e?{[Q_.panelOpen]:``}:null}},nv={open(e){return e?$_:ev},...Oe},rv=P.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=P.useMemo(()=>({open:f.open,disabled:f.disabled,transitionStatus:f.transitionStatus}),[f.open,f.disabled,f.transitionStatus]),m=P.useMemo(()=>({...f,onOpenChange:d,state:p}),[f,d,p]),h=x(`div`,e,{state:p,ref:t,props:l,stateAttributesMapping:nv});return(0,F.jsx)(Y_.Provider,{value:m,children:h})}),iv={...tv,...Oe},av=P.forwardRef(function(e,t){let{panelId:n,open:r,handleTrigger:i,state:a,disabled:o}=X_(),{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:iv})}),ov={height:void 0,width:void 0};function sv(e){let{externalRef:t,hiddenUntilFound:n,id:r,keepMounted:i,mounted:a,onOpenChange:o,open:c,setMounted:l,setOpen:d,transitionStatus:p}=e,m=P.useRef(null),g=P.useRef(null),[_,v]=P.useState(ov),b=P.useRef(ov),x=P.useRef(!1),S=P.useRef(c),C=P.useRef(!1),[w,ee]=P.useState(!1),T=P.useRef(null),E=f(t,m),O=Ae({mounted:a,open:c}),k=Me(m,!1,!1),A=!c&&!a,j=w?`idle`:p,te=c&&(S.current||C.current),ne=!c&&a&&g.current===`css-animation`&&_.height===void 0&&_.width===void 0?b.current:_,re=n&&A&&g.current!==`css-animation`,M=u((e,t=!0)=>{t&&(b.current=e),v(e)}),ie=u(()=>{T.current?.(),T.current=null}),ae=u(e=>{ie(),T.current=()=>{T.current=null,e()}}),oe=u(()=>{c&&a&&g.current===`css-animation`&&(C.current=!0)});h(()=>{!w||p===`starting`||ee(!1)},[w,p]),P.useEffect(()=>()=>{oe(),ie()},[oe,ie]),h(()=>{let e=m.current;if(!e)return;!c&&T.current&&ie();let t=lv(e,te);if(g.current=t,c&&p===`idle`&&S.current&&t===`css-animation`){b.current=cv(e);return}if(c&&p===`starting`){let n=x.current;if(x.current=!1,t===`none`){M(cv(e)),ee(!0);return}if(t===`css-transition`){let t=fv(e);return M(cv(e)),n?(ae(dv(e,`transition-duration`,`0s`)),ee(!0),t):t}if(t===`css-animation`){if(M(cv(e)),!n){dv(e,`animation-name`,`none`)();return}let t=dv(e,`animation-name`,`none`),r=dv(e,`animation-duration`,`0s`);t(),ae(r),ee(!0);return}}if(!c&&a&&(p===`idle`||p===`starting`)){if(S.current=!1,C.current=!1,t===`none`){M(ov,!1),l(!1);return}M(cv(e));return}if(p!==`ending`)return;if(t===`none`){l(!1);return}let n=cv(e);if(!((n.height??0)>0||(n.width??0)>0)){l(!1);return}M(n),t===`css-animation`&&dv(e,`animation-name`,`none`)()},[a,c,ie,M,l,ae,te,p]),De({enabled:c&&a&&j===`idle`,open:!0,ref:m,onComplete(){c&&M(ov,!1)}}),P.useEffect(()=>{if(c||!a||j!==`ending`||!m.current)return;let e=new AbortController,t=-1;function n(){O.current.open||(l(!1),M(ov,!1))}return t=be.request(()=>{e.signal.aborted||k(n,e.signal)}),()=>{be.cancel(t),e.abort()}},[O,a,c,j,k,M,l]),h(()=>{let e=m.current;!e||!n||!A||e.setAttribute(`hidden`,`until-found`)},[A,n]),P.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 se=i||n||a||c;return{height:ne.height,props:{...re?{[Z_.startingStyle]:``}:void 0,hidden:A,id:r},ref:E,shouldPreventOpenAnimation:te,shouldRender:se,transitionStatus:j,width:ne.width}}function cv(e){return{height:e.scrollHeight,width:e.scrollWidth}}function lv(e,t=!1){let n=T(e).getComputedStyle(e),r=(n.animationName.split(`,`).map(e=>e.trim()).some(e=>e!==``&&e!==`none`)||t)&&uv(n.animationDuration),i=uv(n.transitionDuration);return r&&i||i?`css-transition`:r?`css-animation`:`none`}function uv(e){return e.split(`,`).map(e=>e.trim()).some(e=>e!==``&&Number.parseFloat(e)>0)}function dv(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 fv(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=be.request(n);return()=>{be.cancel(r),n()}}var pv=function(e){return e.collapsiblePanelHeight=`--collapsible-panel-height`,e.collapsiblePanelWidth=`--collapsible-panel-width`,e}({}),mv=P.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}=X_(),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}=sv({externalRef:t,hiddenUntilFound:y,id:f,keepMounted:S,mounted:l,onOpenChange:u,open:d,setMounted:p,setOpen:g,transitionStatus:v}),k={..._,transitionStatus:D},A=b(s,k),j=x(`div`,{...e,style:void 0},{state:k,ref:ee,props:[w,{style:{[pv.collapsiblePanelHeight]:C===void 0?`auto`:`${C}px`,[pv.collapsiblePanelWidth]:O===void 0?`auto`:`${O}px`}},c,A?{style:A}:void 0,T?{style:{animationName:`none`}}:void 0],stateAttributesMapping:nv});return E?j:null});function hv({...e}){return(0,F.jsx)(rv,{"data-slot":`collapsible`,...e})}function gv({...e}){return(0,F.jsx)(av,{"data-slot":`collapsible-trigger`,...e})}function _v({...e}){return(0,F.jsx)(mv,{"data-slot":`collapsible-content`,...e})}var vv=(0,P.createContext)({});function yv(e){let t=(0,P.useRef)(null);return t.current===null&&(t.current=e()),t.current}var bv=typeof window<`u`?P.useLayoutEffect:P.useEffect,xv=(0,P.createContext)(null);function Sv(e,t){e.indexOf(t)===-1&&e.push(t)}function Cv(e,t){let n=e.indexOf(t);n>-1&&e.splice(n,1)}var wv=(e,t,n)=>n>t?t:n<e?e:n,Tv={},Ev=e=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e),Dv=e=>typeof e==`object`&&!!e,Ov=e=>/^0[^.\s]+$/u.test(e);function kv(e){let t;return()=>(t===void 0&&(t=e()),t)}var Av=e=>e,jv=(...e)=>e.reduce((e,t)=>n=>t(e(n))),Mv=(e,t,n)=>{let r=t-e;return r?(n-e)/r:1},Nv=class{constructor(){this.subscriptions=[]}add(e){return Sv(this.subscriptions,e),()=>Cv(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}},Pv=e=>e*1e3,Fv=e=>e/1e3,Iv=(e,t)=>t?1e3/t*e:0,Lv=(e,t,n)=>(((1-3*n+3*t)*e+(3*n-6*t))*e+3*t)*e,Rv=1e-7,zv=12;function Bv(e,t,n,r,i){let a,o,s=0;do o=t+(n-t)/2,a=Lv(o,r,i)-e,a>0?n=o:t=o;while(Math.abs(a)>Rv&&++s<zv);return o}function Vv(e,t,n,r){if(e===t&&n===r)return Av;let i=t=>Bv(t,0,1,e,n);return e=>e===0||e===1?e:Lv(i(e),t,r)}var Hv=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,Uv=e=>t=>1-e(1-t),Wv=Vv(.33,1.53,.69,.99),Gv=Uv(Wv),Kv=Hv(Gv),qv=e=>e>=1?1:(e*=2)<1?.5*Gv(e):.5*(2-2**(-10*(e-1))),Jv=e=>1-Math.sin(Math.acos(e)),Yv=Uv(Jv),Xv=Hv(Jv),Zv=Vv(.42,0,1,1),Qv=Vv(0,0,.58,1),$v=Vv(.42,0,.58,1),ey=e=>Array.isArray(e)&&typeof e[0]!=`number`,ty=e=>Array.isArray(e)&&typeof e[0]==`number`,ny={linear:Av,easeIn:Zv,easeInOut:$v,easeOut:Qv,circIn:Jv,circInOut:Xv,circOut:Yv,backIn:Gv,backInOut:Kv,backOut:Wv,anticipate:qv},ry=e=>typeof e==`string`,iy=e=>{if(ty(e)){e.length;let[t,n,r,i]=e;return Vv(t,n,r,i)}else if(ry(e))return ny[e],`${e}`,ny[e];return e},ay=[`setup`,`read`,`resolveKeyframes`,`preUpdate`,`update`,`preRender`,`render`,`postRender`],oy={value:null,addProjectionMetrics:null};function sy(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&&oy.value&&oy.value.frameloop[t].push(c),c=0,n.clear(),i=!1,a&&(a=!1,u.process(e))}};return u}var cy=40;function ly(e,t){let n=!1,r=!0,i={delta:0,timestamp:0,isProcessing:!1},a=()=>n=!0,o=ay.reduce((e,n)=>(e[n]=sy(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=Tv.useManualTiming,o=a?i.timestamp:performance.now();n=!1,a||(i.delta=r?1e3/60:Math.max(Math.min(o-i.timestamp,cy),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:ay.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<ay.length;t++)o[ay[t]].cancel(e)},state:i,steps:o}}var{schedule:G,cancel:uy,state:K,steps:dy}=ly(typeof requestAnimationFrame<`u`?requestAnimationFrame:Av,!0),fy;function py(){fy=void 0}var my={now:()=>(fy===void 0&&my.set(K.isProcessing||Tv.useManualTiming?K.timestamp:performance.now()),fy),set:e=>{fy=e,queueMicrotask(py)}},hy={layout:0,mainThread:0,waapi:0},gy=e=>t=>typeof t==`string`&&t.startsWith(e),_y=gy(`--`),vy=gy(`var(--`),yy=e=>vy(e)?by.test(e.split(`/*`)[0].trim()):!1,by=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function xy(e){return typeof e==`string`?e.split(`/*`)[0].includes(`var(--`):!1}var Sy={test:e=>typeof e==`number`,parse:parseFloat,transform:e=>e},Cy={...Sy,transform:e=>wv(0,1,e)},wy={...Sy,default:1},Ty=e=>Math.round(e*1e5)/1e5,Ey=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function Dy(e){return e==null}var Oy=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,ky=(e,t)=>n=>!!(typeof n==`string`&&Oy.test(n)&&n.startsWith(e)||t&&!Dy(n)&&Object.prototype.hasOwnProperty.call(n,t)),Ay=(e,t,n)=>r=>{if(typeof r!=`string`)return r;let[i,a,o,s]=r.match(Ey);return{[e]:parseFloat(i),[t]:parseFloat(a),[n]:parseFloat(o),alpha:s===void 0?1:parseFloat(s)}},jy=e=>wv(0,255,e),My={...Sy,transform:e=>Math.round(jy(e))},Ny={test:ky(`rgb`,`red`),parse:Ay(`red`,`green`,`blue`),transform:({red:e,green:t,blue:n,alpha:r=1})=>`rgba(`+My.transform(e)+`, `+My.transform(t)+`, `+My.transform(n)+`, `+Ty(Cy.transform(r))+`)`};function Py(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 Fy={test:ky(`#`),parse:Py,transform:Ny.transform},Iy=e=>({test:t=>typeof t==`string`&&t.endsWith(e)&&t.split(` `).length===1,parse:parseFloat,transform:t=>`${t}${e}`}),Ly=Iy(`deg`),Ry=Iy(`%`),q=Iy(`px`),zy=Iy(`vh`),By=Iy(`vw`),Vy={...Ry,parse:e=>Ry.parse(e)/100,transform:e=>Ry.transform(e*100)},Hy={test:ky(`hsl`,`hue`),parse:Ay(`hue`,`saturation`,`lightness`),transform:({hue:e,saturation:t,lightness:n,alpha:r=1})=>`hsla(`+Math.round(e)+`, `+Ry.transform(Ty(t))+`, `+Ry.transform(Ty(n))+`, `+Ty(Cy.transform(r))+`)`},J={test:e=>Ny.test(e)||Fy.test(e)||Hy.test(e),parse:e=>Ny.test(e)?Ny.parse(e):Hy.test(e)?Hy.parse(e):Fy.parse(e),transform:e=>typeof e==`string`?e:e.hasOwnProperty(`red`)?Ny.transform(e):Hy.transform(e),getAnimatableNone:e=>{let t=J.parse(e);return t.alpha=0,J.transform(t)}},Uy=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function Wy(e){return isNaN(e)&&typeof e==`string`&&(e.match(Ey)?.length||0)+(e.match(Uy)?.length||0)>0}var Gy=`number`,Ky=`color`,qy=`var`,Jy=`var(`,Yy="${}",Xy=/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 Zy(e){let t=e.toString(),n=[],r={color:[],number:[],var:[]},i=[],a=0;return{values:n,split:t.replace(Xy,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(qy),n.push(e)):(r.number.push(a),i.push(Gy),n.push(parseFloat(e))),++a,Yy)).split(Yy),indexes:r,types:i}}function Qy(e){return Zy(e).values}function $y({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===Gy?i+=Ty(r[a]):e===Ky?i+=J.transform(r[a]):i+=r[a]}return i}}function eb(e){return $y(Zy(e))}var tb=e=>typeof e==`number`?0:J.test(e)?J.getAnimatableNone(e):e,nb=(e,t)=>typeof e==`number`?t?.trim().endsWith(`/`)?e:0:tb(e);function rb(e){let t=Zy(e);return $y(t)(t.values.map((e,n)=>nb(e,t.split[n])))}var ib={test:Wy,parse:Qy,createTransformer:eb,getAnimatableNone:rb};function ab(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 ob({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=ab(s,r,e+1/3),a=ab(s,r,e),o=ab(s,r,e-1/3)}return{red:Math.round(i*255),green:Math.round(a*255),blue:Math.round(o*255),alpha:r}}function sb(e,t){return n=>n>0?t:e}var Y=(e,t,n)=>e+(t-e)*n,cb=(e,t,n)=>{let r=e*e,i=n*(t*t-r)+r;return i<0?0:Math.sqrt(i)},lb=[Fy,Ny,Hy],ub=e=>lb.find(t=>t.test(e));function db(e){let t=ub(e);if(`${e}`,!t)return!1;let n=t.parse(e);return t===Hy&&(n=ob(n)),n}var fb=(e,t)=>{let n=db(e),r=db(t);if(!n||!r)return sb(e,t);let i={...n};return e=>(i.red=cb(n.red,r.red,e),i.green=cb(n.green,r.green,e),i.blue=cb(n.blue,r.blue,e),i.alpha=Y(n.alpha,r.alpha,e),Ny.transform(i))},pb=new Set([`none`,`hidden`]);function mb(e,t){return pb.has(e)?n=>n<=0?e:t:n=>n>=1?t:e}function hb(e,t){return n=>Y(e,t,n)}function gb(e){return typeof e==`number`?hb:typeof e==`string`?yy(e)?sb:J.test(e)?fb:bb:Array.isArray(e)?_b:typeof e==`object`?J.test(e)?fb:vb:sb}function _b(e,t){let n=[...e],r=n.length,i=e.map((e,n)=>gb(e)(e,t[n]));return e=>{for(let t=0;t<r;t++)n[t]=i[t](e);return n}}function vb(e,t){let n={...e,...t},r={};for(let i in n)e[i]!==void 0&&t[i]!==void 0&&(r[i]=gb(e[i])(e[i],t[i]));return e=>{for(let t in r)n[t]=r[t](e);return n}}function yb(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 bb=(e,t)=>{let n=ib.createTransformer(t),r=Zy(e),i=Zy(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?pb.has(e)&&!i.values.length||pb.has(t)&&!r.values.length?mb(e,t):jv(_b(yb(r,i),i.values),n):(`${e}${t}`,sb(e,t))};function xb(e,t,n){return typeof e==`number`&&typeof t==`number`&&typeof n==`number`?Y(e,t,n):gb(e)(e,t)}var Sb=e=>{let t=({timestamp:t})=>e(t);return{start:(e=!0)=>G.update(t,e),stop:()=>uy(t),now:()=>K.isProcessing?K.timestamp:my.now()}},Cb=(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)})`},wb=2e4;function Tb(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 Eb(e,t=100,n){let r=n({...e,keyframes:[0,t]}),i=Math.min(Tb(r),wb);return{type:`keyframes`,ease:e=>r.next(i*e).value/t,duration:Fv(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 Db(e,t){return e*Math.sqrt(1-t*t)}var Ob=12;function kb(e,t,n){let r=n;for(let n=1;n<Ob;n++)r-=e(r)/t(r);return r}var Ab=.001;function jb({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=wv(X.minDamping,X.maxDamping,o),e=wv(X.minDuration,X.maxDuration,Fv(e)),o<1?(i=t=>{let r=t*o,i=r*e,a=r-n,s=Db(t,o),c=Math.exp(-i);return Ab-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=Db(t**2,o);return(-i(t)+Ab>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=kb(i,a,s);if(e=Pv(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 Mb=[`duration`,`bounce`],Nb=[`stiffness`,`damping`,`mass`];function Pb(e,t){return t.some(t=>e[t]!==void 0)}function Fb(e){let t={velocity:X.velocity,stiffness:X.stiffness,damping:X.damping,mass:X.mass,isResolvedFromDuration:!1,...e};if(!Pb(e,Nb)&&Pb(e,Mb))if(t.velocity=0,e.visualDuration){let n=e.visualDuration,r=2*Math.PI/(n*1.2),i=r*r,a=2*wv(.05,1,1-(e.bounce||0))*Math.sqrt(i);t={...t,mass:X.mass,stiffness:i,damping:a}}else{let n=jb({...e,velocity:0});t={...t,...n,mass:X.mass},t.isResolvedFromDuration=!0}return t}function Ib(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}=Fb({...n,velocity:-Fv(n.velocity||0)}),m=f||0,h=l/(2*Math.sqrt(c*u)),g=o-a,_=Fv(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=Db(_,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=>Pv(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=Pv(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=Pv(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(Tb(ee),wb),t=Cb(t=>ee.next(e*t).value,e,30);return e+`ms `+t},toTransition:()=>{}};return ee}Ib.applyToOptions=e=>{let t=Eb(e,100,Ib);return e.ease=t.ease,e.duration=Pv(t.duration),e.type=`keyframes`,e};var Lb=5;function Rb(e,t,n){let r=Math.max(t-Lb,0);return Iv(n-e(r),t-r)}function zb({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=Ib({keyframes:[f.value,m(f.value)],velocity:Rb(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 Bb(e,t,n){let r=[],i=n||Tv.mix||xb,a=e.length-1;for(let n=0;n<a;n++){let a=i(e[n],e[n+1]);t&&(a=jv(Array.isArray(t)?t[n]||Av:t,a)),r.push(a)}return r}function Vb(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=Bb(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=Mv(e[r],e[r+1],n);return s[r](i)};return n?t=>l(wv(e[0],e[a-1],t)):l}function Hb(e,t){let n=e[e.length-1];for(let r=1;r<=t;r++){let i=Mv(0,t,r);e.push(Y(n,1,i))}}function Ub(e){let t=[0];return Hb(t,e.length-1),t}function Wb(e,t){return e.map(e=>e*t)}function Gb(e,t){return e.map(()=>t||$v).splice(0,e.length-1)}function Kb({duration:e=300,keyframes:t,times:n,ease:r=`easeInOut`}){let i=ey(r)?r.map(iy):iy(r),a={done:!1,value:t[0]},o=Vb(Wb(n&&n.length===t.length?n:Ub(t),e),t,{ease:Array.isArray(i)?i:Gb(t,i)});return{calculatedDuration:e,next:t=>(a.value=o(t),a.done=t>=e,a)}}var qb=e=>e!==null;function Jb(e,{repeat:t,repeatType:n=`loop`},r,i=1){let a=e.filter(qb),o=i<0||t&&n!==`loop`&&t%2==1?0:a.length-1;return!o||r===void 0?a[o]:r}var Yb={decay:zb,inertia:zb,tween:Kb,keyframes:Kb,spring:Ib};function Xb(e){typeof e.type==`string`&&(e.type=Yb[e.type])}var Zb=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)}},Qb=e=>e/100,$b=class extends Zb{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!==my.now()&&this.tick(my.now()),this.isStopped=!0,this.state!==`idle`&&(this.teardown(),this.options.onStop?.())},hy.mainThread++,this.options=e,this.initAnimation(),this.play(),e.autoplay===!1&&this.pause()}initAnimation(){let{options:e}=this;Xb(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=jv(Qb,xb(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=Tb(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=wv(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!==zb&&(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 Fv(this.calculatedDuration)}get iterationDuration(){let{delay:e=0}=this.options||{};return this.duration+Fv(e)}get time(){return Fv(this.currentTime)}set time(e){e=Pv(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 Rb(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(my.now()),this.playbackSpeed=e,t&&this.driver&&(this.time=Fv(this.currentTime))}play(){if(this.isStopped)return;let{driver:e=Sb,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(my.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,hy.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 ex(e){for(let t=1;t<e.length;t++)e[t]??(e[t]=e[t-1])}var tx=e=>e*180/Math.PI,nx=e=>ix(tx(Math.atan2(e[1],e[0]))),rx={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:e=>(Math.abs(e[0])+Math.abs(e[3]))/2,rotate:nx,rotateZ:nx,skewX:e=>tx(Math.atan(e[1])),skewY:e=>tx(Math.atan(e[2])),skew:e=>(Math.abs(e[1])+Math.abs(e[2]))/2},ix=e=>(e%=360,e<0&&(e+=360),e),ax=nx,ox=e=>Math.sqrt(e[0]*e[0]+e[1]*e[1]),sx=e=>Math.sqrt(e[4]*e[4]+e[5]*e[5]),cx={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:ox,scaleY:sx,scale:e=>(ox(e)+sx(e))/2,rotateX:e=>ix(tx(Math.atan2(e[6],e[5]))),rotateY:e=>ix(tx(Math.atan2(-e[2],e[0]))),rotateZ:ax,rotate:ax,skewX:e=>tx(Math.atan(e[4])),skewY:e=>tx(Math.atan(e[1])),skew:e=>(Math.abs(e[1])+Math.abs(e[4]))/2};function lx(e){return+!!e.includes(`scale`)}function ux(e,t){if(!e||e===`none`)return lx(t);let n=e.match(/^matrix3d\(([-\d.e\s,]+)\)$/u),r,i;if(n)r=cx,i=n;else{let t=e.match(/^matrix\(([-\d.e\s,]+)\)$/u);r=rx,i=t}if(!i)return lx(t);let a=r[t],o=i[1].split(`,`).map(fx);return typeof a==`function`?a(o):o[a]}var dx=(e,t)=>{let{transform:n=`none`}=getComputedStyle(e);return ux(n,t)};function fx(e){return parseFloat(e.trim())}var px=[`transformPerspective`,`x`,`y`,`z`,`translateX`,`translateY`,`translateZ`,`scale`,`scaleX`,`scaleY`,`rotate`,`rotateX`,`rotateY`,`rotateZ`,`skew`,`skewX`,`skewY`],mx=new Set([...px,`pathRotation`]),hx=e=>e===Sy||e===q,gx=new Set([`x`,`y`,`z`]),_x=px.filter(e=>!gx.has(e));function vx(e){let t=[];return _x.forEach(n=>{let r=e.getValue(n);r!==void 0&&(t.push([n,r.get()]),r.set(+!!n.startsWith(`scale`)))}),t}var yx={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})=>ux(t,`x`),y:(e,{transform:t})=>ux(t,`y`)};yx.translateX=yx.x,yx.translateY=yx.y;var bx=new Set,xx=!1,Sx=!1,Cx=!1;function wx(){if(Sx){let e=Array.from(bx).filter(e=>e.needsMeasurement),t=new Set(e.map(e=>e.element)),n=new Map;t.forEach(e=>{let t=vx(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)})}Sx=!1,xx=!1,bx.forEach(e=>e.complete(Cx)),bx.clear()}function Tx(){bx.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(Sx=!0)})}function Ex(){Cx=!0,Tx(),wx(),Cx=!1}var Dx=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?(bx.add(this),xx||(xx=!0,G.read(Tx),G.resolveKeyframes(wx))):(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])}ex(e)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(e=!1){this.state=`complete`,this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,e),bx.delete(this)}cancel(){this.state===`scheduled`&&(bx.delete(this),this.state=`pending`)}resume(){this.state===`pending`&&this.scheduleResolve()}},Ox=e=>e.startsWith(`--`);function kx(e,t,n){Ox(t)?e.style.setProperty(t,n):e.style[t]=n}var Ax={};function jx(e,t){let n=kv(e);return()=>Ax[t]??n()}var Mx=jx(()=>window.ScrollTimeline!==void 0,`scrollTimeline`),Nx=jx(()=>{try{document.createElement(`div`).animate({opacity:0},{easing:`linear(0, 1)`})}catch{return!1}return!0},`linearEasing`),Px=([e,t,n,r])=>`cubic-bezier(${e}, ${t}, ${n}, ${r})`,Fx={linear:`linear`,ease:`ease`,easeIn:`ease-in`,easeOut:`ease-out`,easeInOut:`ease-in-out`,circIn:Px([0,.65,.55,1]),circOut:Px([.55,0,1,.45]),backIn:Px([.31,.01,.66,-.59]),backOut:Px([.33,1.53,.69,.99])};function Ix(e,t){if(e)return typeof e==`function`?Nx()?Cb(e,t):`ease-out`:ty(e)?Px(e):Array.isArray(e)?e.map(e=>Ix(e,t)||Fx.easeOut):Fx[e]}function Lx(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=Ix(s,i);Array.isArray(d)&&(u.easing=d),oy.value&&hy.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 oy.value&&p.finished.finally(()=>{hy.waapi--}),p}function Rx(e){return typeof e==`function`&&`applyToOptions`in e}function zx({type:e,...t}){return Rx(e)&&Nx()?e.applyToOptions(t):(t.duration??=300,t.ease??=`easeOut`,t)}var Bx=class extends Zb{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=zx(e);this.animation=Lx(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),kx(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 Fv(Number(e))}get iterationDuration(){let{delay:e=0}=this.options||{};return this.duration+Fv(e)}get time(){return Fv(Number(this.animation.currentTime)||0)}set time(e){let t=this.finishedTime!==null;this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=Pv(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&&Mx()?(this.animation.timeline=e,t&&(this.animation.rangeStart=t),n&&(this.animation.rangeEnd=n),Av):r(this)}},Vx={anticipate:qv,backInOut:Kv,circInOut:Xv};function Hx(e){return e in Vx}function Ux(e){typeof e.ease==`string`&&Hx(e.ease)&&(e.ease=Vx[e.ease])}var Wx=10,Gx=class extends Bx{constructor(e){Ux(e),Xb(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 $b({...a,autoplay:!1}),s=Math.max(Wx,my.now()-this.startTime),c=wv(0,Wx,s-Wx),l=o.sample(s).value,{name:u}=this.options;i&&u&&kx(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`&&(ib.test(e)||e===`0`)&&!e.startsWith(`url(`));function qx(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:qx(e)||(n===`spring`||Rx(n))&&r}function Yx(e){e.duration=0,e.type=`keyframes`}var Xx=new Set([`opacity`,`clipPath`,`filter`,`transform`]),Zx=/^(?:oklch|oklab|lab|lch|color|color-mix|light-dark)\(/;function Qx(e){for(let t=0;t<e.length;t++)if(typeof e[t]==`string`&&Zx.test(e[t]))return!0;return!1}var $x=new Set([`color`,`backgroundColor`,`outlineColor`,`fill`,`stroke`,`borderColor`,`borderTopColor`,`borderRightColor`,`borderBottomColor`,`borderLeftColor`]),eS=kv(()=>Object.hasOwnProperty.call(Element.prototype,`animate`));function tS(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 eS()&&n&&(Xx.has(n)||$x.has(n)&&Qx(s))&&(n!==`transform`||!l)&&!c&&!r&&i!==`mirror`&&a!==0&&o!==`inertia`}var nS=40,rS=class extends Zb{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=my.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||Dx;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=my.now();let u=!0;Jx(e,i,a,o)||(u=!1,(Tv.instantAnimations||!s)&&l?.(Jb(e,n,t)),e[0]=e[e.length-1],Yx(n),n.repeat=0);let d={startTime:r?this.resolvedAt&&this.resolvedAt-this.createdAt>nS?this.resolvedAt:this.createdAt:void 0,finalKeyframe:t,...n,keyframes:e},f=u&&!c&&tS(d),p=d.motionValue?.owner?.current,m;if(f)try{m=new Gx({...d,element:p})}catch{m=new $b(d)}else m=new $b(d);m.finished.then(()=>{this.notifyFinished()}).catch(Av),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(),Ex()),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 iS(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 aS=30,oS=e=>!isNaN(parseFloat(e)),sS={current:void 0},cS=class{constructor(e,t={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=e=>{let t=my.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=my.now(),this.canTrackVelocity===null&&e!==void 0&&(this.canTrackVelocity=oS(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 Nv);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 sS.current&&sS.current.push(this),this.current}getPrevious(){return this.prev}getVelocity(){let e=my.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||e-this.updatedAt>aS)return 0;let t=Math.min(this.updatedAt-this.prevUpdatedAt,aS);return Iv(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 lS(e,t){return new cS(e,t)}function uS(e,t){if(e?.inherit&&t){let{inherit:n,...r}=e;return{...t,...r}}return e}function dS(e,t){let n=e?.[t]??e?.default??e;return n===e?n:uS(n,e)}var fS={type:`spring`,stiffness:500,damping:25,restSpeed:10},pS=e=>({type:`spring`,stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),mS={type:`keyframes`,duration:.8},hS={type:`keyframes`,ease:[.25,.1,.35,1],duration:.3},gS=(e,{keyframes:t})=>t.length>2?mS:mx.has(e)?e.startsWith(`scale`)?pS(t[1]):fS:hS,_S=new Set([`when`,`delay`,`delayChildren`,`staggerChildren`,`staggerDirection`,`repeat`,`repeatType`,`repeatDelay`,`from`,`elapsed`]);function vS(e){for(let t in e)if(!_S.has(t))return!0;return!1}var yS=(e,t,n,r={},i,a)=>o=>{let s=dS(r,e)||{},c=s.delay||r.delay||0,{elapsed:l=0}=r;l-=Pv(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};vS(s)||Object.assign(u,gS(e,u)),u.duration&&=Pv(u.duration),u.repeatDelay&&=Pv(u.repeatDelay),u.from!==void 0&&(u.keyframes[0]=u.from);let d=!1;if((u.type===!1||u.duration===0&&!u.repeatDelay)&&(Yx(u),u.delay===0&&(d=!0)),(Tv.instantAnimations||Tv.skipAnimations||i?.shouldSkipAnimations||s.skipAnimations)&&(d=!0,Yx(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 $b(u):new rS(u)},bS=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function xS(e){let t=bS.exec(e);if(!t)return[,];let[,n,r,i]=t;return[`--${n??r}`,i]}function SS(e,t,n=1){`${e}`;let[r,i]=xS(e);if(!r)return;let a=window.getComputedStyle(t).getPropertyValue(r);if(a){let e=a.trim();return Ev(e)?parseFloat(e):e}return yy(i)?SS(i,t,n+1):i}function CS(e){let t=[{},{}];return e?.values.forEach((e,n)=>{t[0][n]=e.get(),t[1][n]=e.getVelocity()}),t}function wS(e,t,n,r){if(typeof t==`function`){let[i,a]=CS(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]=CS(r);t=t(n===void 0?e.custom:n,i,a)}return t}function TS(e,t,n){let r=e.getProps();return wS(r,t,n===void 0?r.custom:n,e)}var ES=new Set([`width`,`height`,`top`,`left`,`right`,`bottom`,...px]),DS=e=>Array.isArray(e);function OS(e,t,n){e.hasValue(t)?e.getValue(t).set(n):e.addValue(t,lS(n))}function kS(e){return DS(e)?e[e.length-1]||0:e}function AS(e,t){let{transitionEnd:n={},transition:r={},...i}=TS(e,t)||{};i={...i,...n};for(let t in i)OS(e,t,kS(i[t]))}var Z=e=>!!(e&&e.getVelocity);function jS(e){return!!(Z(e)&&e.add)}function MS(e,t){let n=e.getValue(`willChange`);if(jS(n))return n.add(t);if(!n&&Tv.WillChange){let n=new Tv.WillChange(`auto`);e.addValue(`willChange`,n),n.add(t)}}function NS(e){return e.replace(/([A-Z])/g,e=>`-${e.toLowerCase()}`)}var PS=`data-`+NS(`framerAppearId`);function FS(e){return e.props[PS]}function IS({protectedKeys:e,needsAnimating:t},n){let r=e.hasOwnProperty(n)&&t[n]!==!0;return t[n]=!1,r}function LS(e,t,{delay:n=0,transitionOverride:r,type:i}={}){let{transition:a,transitionEnd:o,...s}=t,c=e.getDefaultTransition();a=a?uS(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&&IS(f,t))continue;let o={delay:n,...dS(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=FS(e);if(n){let e=window.MotionHandoffAnimation(n,t,G);e!==null&&(o.startTime=e,p=!0)}}MS(e,t);let m=l??e.shouldReduceMotion;r.start(yS(t,r,i,m&&ES.has(t)?{type:!1}:o,e,p));let h=r.animation;h&&d.push(h)}if(o){let t=()=>G.update(()=>{o&&AS(e,o)});d.length?Promise.all(d).then(t):t()}return d}function RS(e,t,n={}){let r=TS(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(LS(e,r,n)):()=>Promise.resolve(),o=e.variantChildren&&e.variantChildren.size?(r=0)=>{let{delayChildren:a=0,staggerChildren:o,staggerDirection:s}=i;return zS(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 zS(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(RS(c,t,{...o,delay:n+(typeof r==`function`?0:r)+iS(e.variantChildren,c,r,i,a)}).then(()=>c.notify(`AnimationComplete`,t)));return Promise.all(s)}function BS(e,t,n={}){e.notify(`AnimationStart`,t);let r;if(Array.isArray(t)){let i=t.map(t=>RS(e,t,n));r=Promise.all(i)}else if(typeof t==`string`)r=RS(e,t,n);else{let i=typeof t==`function`?TS(e,t,n.custom):t;r=Promise.all(LS(e,i,n))}return r.then(()=>{e.notify(`AnimationComplete`,t)})}var VS={test:e=>e===`auto`,parse:e=>e},HS=e=>t=>t.test(e),US=[Sy,q,Ry,Ly,By,zy,VS],WS=e=>US.find(HS(e));function GS(e){return typeof e==`number`?e===0:e===null?!0:e===`none`||e===`0`||Ov(e)}var KS=new Set([`brightness`,`contrast`,`saturate`,`opacity`]);function qS(e){let[t,n]=e.slice(0,-1).split(`(`);if(t===`drop-shadow`)return e;let[r]=n.match(Ey)||[];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,YS={...ib,getAnimatableNone:e=>{let t=e.match(JS);return t?t.map(qS).join(` `):e}},XS={...ib,getAnimatableNone:e=>{let t=ib.parse(e);return ib.createTransformer(e)(t.map(e=>typeof e==`number`?0:typeof e==`object`?{...e,alpha:1}:e))}},ZS={...Sy,transform:Math.round},QS={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:Ly,pathRotation:Ly,rotateX:Ly,rotateY:Ly,rotateZ:Ly,scale:wy,scaleX:wy,scaleY:wy,scaleZ:wy,skew:Ly,skewX:Ly,skewY:Ly,distance:q,translateX:q,translateY:q,translateZ:q,x:q,y:q,z:q,perspective:q,transformPerspective:q,opacity:Cy,originX:Vy,originY:Vy,originZ:q,zIndex:ZS,fillOpacity:Cy,strokeOpacity:Cy,numOctaves:ZS},$S={...QS,color:J,backgroundColor:J,outlineColor:J,fill:J,stroke:J,borderColor:J,borderTopColor:J,borderRightColor:J,borderBottomColor:J,borderLeftColor:J,filter:YS,WebkitFilter:YS,mask:XS,WebkitMask:XS},eC=e=>$S[e],tC=new Set([YS,XS]);function nC(e,t){let n=eC(e);return tC.has(n)||(n=ib),n.getAnimatableNone?n.getAnimatableNone(t):void 0}var rC=new Set([`auto`,`none`,`0`]);function iC(e,t,n){let r=0,i;for(;r<e.length&&!i;){let t=e[r];typeof t==`string`&&!rC.has(t)&&Zy(t).values.length&&(i=e[r]),r++}if(i&&n)for(let r of t)e[r]=nC(n,i)}var aC=class extends Dx{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(),yy(r))){let i=SS(r,t.current);i!==void 0&&(e[n]=i),n===e.length-1&&(this.finalKeyframe=r)}}if(this.resolveNoneKeyframes(),!ES.has(n)||e.length!==2)return;let[r,i]=e,a=WS(r),o=WS(i);if(xy(r)!==xy(i)&&yx[n]){this.needsMeasurement=!0;return}if(a!==o)if(hx(a)&&hx(o))for(let t=0;t<e.length;t++){let n=e[t];typeof n==`string`&&(e[t]=parseFloat(n))}else yx[n]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){let{unresolvedKeyframes:e,name:t}=this,n=[];for(let t=0;t<e.length;t++)(e[t]===null||GS(e[t]))&&n.push(t);n.length&&iC(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=yx[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]=yx[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 oC(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 sC=(e,t)=>t&&typeof e==`number`?t.transform(e):e;function cC(e){return Dv(e)&&`offsetHeight`in e&&!(`ownerSVGElement`in e)}var{schedule:lC,cancel:uC}=ly(queueMicrotask,!1),dC={x:!1,y:!1};function fC(){return dC.x||dC.y}function pC(e){return e===`x`||e===`y`?dC[e]?null:(dC[e]=!0,()=>{dC[e]=!1}):dC.x||dC.y?null:(dC.x=dC.y=!0,()=>{dC.x=dC.y=!1})}function mC(e,t){let n=oC(e),r=new AbortController;return[n,{passive:!0,...t,signal:r.signal},()=>r.abort()]}function hC(e){return!(e.pointerType===`touch`||fC())}function gC(e,t,n={}){let[r,i,a]=mC(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(!hC(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 _C=(e,t)=>t?e===t?!0:_C(e,t.parentElement):!1,vC=e=>e.pointerType===`mouse`?typeof e.button!=`number`||e.button<=0:e.isPrimary!==!1,yC=new Set([`BUTTON`,`INPUT`,`SELECT`,`TEXTAREA`,`A`]);function bC(e){return yC.has(e.tagName)||e.isContentEditable===!0}var xC=new Set([`INPUT`,`SELECT`,`TEXTAREA`]);function SC(e){return xC.has(e.tagName)||e.isContentEditable===!0}var CC=new WeakSet;function wC(e){return t=>{t.key===`Enter`&&e(t)}}function TC(e,t){e.dispatchEvent(new PointerEvent(`pointer`+t,{isPrimary:!0,bubbles:!0}))}var EC=(e,t)=>{let n=e.currentTarget;if(!n)return;let r=wC(()=>{if(CC.has(n))return;TC(n,`down`);let e=wC(()=>{TC(n,`up`)});n.addEventListener(`keyup`,e,t),n.addEventListener(`blur`,()=>TC(n,`cancel`),t)});n.addEventListener(`keydown`,r,t),n.addEventListener(`blur`,()=>n.removeEventListener(`keydown`,r),t)};function DC(e){return vC(e)&&!fC()}var OC=new WeakSet;function kC(e,t,n={}){let[r,i,a]=mC(e,n),o=e=>{let r=e.currentTarget;if(!DC(e)||OC.has(e))return;CC.add(r),n.stopPropagation&&OC.add(e);let a=t(r,e),o=(e,t)=>{window.removeEventListener(`pointerup`,s),window.removeEventListener(`pointercancel`,c),CC.has(r)&&CC.delete(r),DC(e)&&typeof a==`function`&&a(e,{success:t})},s=e=>{o(e,r===window||r===document||n.useGlobalTarget||_C(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),cC(e)&&(e.addEventListener(`focus`,e=>EC(e,i)),!bC(e)&&!e.hasAttribute(`tabindex`)&&(e.tabIndex=0))}),a}function AC(e){return Dv(e)&&`ownerSVGElement`in e}var jC=new WeakMap,MC,NC=(e,t,n)=>(r,i)=>i&&i[0]?i[0][e+`Size`]:AC(r)&&`getBBox`in r?r.getBBox()[t]:r[n],PC=NC(`inline`,`width`,`offsetWidth`),FC=NC(`block`,`height`,`offsetHeight`);function IC({target:e,borderBoxSize:t}){jC.get(e)?.forEach(n=>{n(e,{get width(){return PC(e,t)},get height(){return FC(e,t)}})})}function LC(e){e.forEach(IC)}function RC(){typeof ResizeObserver>`u`||(MC=new ResizeObserver(LC))}function zC(e,t){MC||RC();let n=oC(e);return n.forEach(e=>{let n=jC.get(e);n||(n=new Set,jC.set(e,n)),n.add(t),MC?.observe(e)}),()=>{n.forEach(e=>{let n=jC.get(e);n?.delete(t),n?.size||MC?.unobserve(e)})}}var BC=new Set,VC;function HC(){VC=()=>{let e={get width(){return window.innerWidth},get height(){return window.innerHeight}};BC.forEach(t=>t(e))},window.addEventListener(`resize`,VC)}function UC(e){return BC.add(e),VC||HC(),()=>{BC.delete(e),!BC.size&&typeof VC==`function`&&(window.removeEventListener(`resize`,VC),VC=void 0)}}function WC(e,t){return typeof e==`function`?UC(e):zC(e,t)}function GC(e){return AC(e)&&e.tagName===`svg`}var KC=[...US,J,ib],qC=e=>KC.find(HS(e)),JC=()=>({translate:0,scale:1,origin:0,originPoint:0}),YC=()=>({x:JC(),y:JC()}),XC=()=>({min:0,max:0}),Q=()=>({x:XC(),y:XC()}),ZC=new WeakMap;function QC(e){return typeof e==`object`&&!!e&&typeof e.start==`function`}function $C(e){return typeof e==`string`||Array.isArray(e)}var ew=[`animate`,`whileInView`,`whileFocus`,`whileHover`,`whileTap`,`whileDrag`,`exit`],tw=[`initial`,...ew];function nw(e){return QC(e.animate)||tw.some(t=>$C(e[t]))}function rw(e){return!!(nw(e)||e.variants)}function iw(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,lS(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,lS(t===void 0?i:t,{owner:e}))}}for(let r in n)t[r]===void 0&&e.removeValue(r);return t}var aw={current:null},ow={current:!1},sw=typeof window<`u`;function cw(){if(ow.current=!0,sw)if(window.matchMedia){let e=window.matchMedia(`(prefers-reduced-motion)`),t=()=>aw.current=e.matches;e.addEventListener(`change`,t),t()}else aw.current=!1}var lw=[`AnimationStart`,`AnimationComplete`,`Update`,`BeforeLayoutMeasure`,`LayoutMeasure`,`LayoutAnimationStart`,`LayoutAnimationComplete`],uw={};function dw(e){uw=e}function fw(){return uw}var pw=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=Dx,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=my.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=nw(t),this.isVariantNode=rw(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,ZC.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:(ow.current||cw(),this.shouldReduceMotion=aw.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(),uy(this.notifyUpdate),uy(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&&Xx.has(e)&&this.current instanceof HTMLElement){let{factory:n,keyframes:r,times:i,ease:a,duration:o}=t.accelerate,s=new Bx({element:this.current,name:e,keyframes:r,times:i,ease:a,duration:Pv(o)}),c=n(s);this.valueSubscriptions.set(e,()=>{c(),s.cancel()});return}let n=mx.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 uw){let t=uw[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<lw.length;t++){let n=lw[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=iw(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=lS(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`&&(Ev(n)||Ov(n))?n=parseFloat(n):!qC(n)&&ib.test(t)&&(n=nC(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=wS(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 Nv),this.events[e].add(t)}notify(e,...t){this.events[e]&&this.events[e].notify(...t)}scheduleRenderMicrotask(){lC.render(this.render)}},mw=class extends pw{constructor(){super(...arguments),this.KeyframeResolver=aC}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}`)}))}},hw=class{constructor(e){this.isMounted=!1,this.node=e}update(){}};function gw({top:e,left:t,right:n,bottom:r}){return{x:{min:t,max:n},y:{min:e,max:r}}}function _w({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}function vw(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 yw(e){return e===void 0||e===1}function bw({scale:e,scaleX:t,scaleY:n}){return!yw(e)||!yw(t)||!yw(n)}function xw(e){return bw(e)||Sw(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function Sw(e){return Cw(e.x)||Cw(e.y)}function Cw(e){return e&&e!==`0%`}function ww(e,t,n){return n+t*(e-n)}function Tw(e,t,n,r,i){return i!==void 0&&(e=ww(e,i,r)),ww(e,n,r)+t}function Ew(e,t=0,n=1,r,i){e.min=Tw(e.min,t,n,r,i),e.max=Tw(e.max,t,n,r,i)}function Dw(e,{x:t,y:n}){Ew(e.x,t.translate,t.scale,t.originPoint),Ew(e.y,n.translate,n.scale,n.originPoint)}var Ow=.999999999999,kw=1.0000000000001;function Aw(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&&(jw(e.x,-a.scroll.offset.x),jw(e.y,-a.scroll.offset.y)),o&&(t.x*=o.x.scale,t.y*=o.y.scale,Dw(e,o)),r&&xw(a.latestValues)&&Pw(e,a.latestValues,a.layout?.layoutBox))}t.x<kw&&t.x>Ow&&(t.x=1),t.y<kw&&t.y>Ow&&(t.y=1)}function jw(e,t){e.min+=t,e.max+=t}function Mw(e,t,n,r,i=.5){Ew(e,t,n,Y(e.min,e.max,i),r)}function Nw(e,t){return typeof e==`string`?parseFloat(e)/100*(t.max-t.min):e}function Pw(e,t,n){let r=n??e;Mw(e.x,Nw(t.x,r.x),t.scaleX,t.scale,t.originX),Mw(e.y,Nw(t.y,r.y),t.scaleY,t.scale,t.originY)}function Fw(e,t){return gw(vw(e.getBoundingClientRect(),t))}function Iw(e,t,n){let r=Fw(e,n),{scroll:i}=t;return i&&(jw(r.x,i.offset.x),jw(r.y,i.offset.y)),r}var Lw={x:`translateX`,y:`translateY`,z:`translateZ`,transformPerspective:`perspective`},Rw=px.length;function zw(e,t,n){let r=``,i=!0;for(let a=0;a<Rw;a++){let o=px[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=sC(s,QS[o]);if(!c){i=!1;let t=Lw[o]||o;r+=`${t}(${e}) `}n&&(t[o]=e)}}let a=e.pathRotation;return a&&(i=!1,r+=`rotate(${sC(a,QS.pathRotation)}) `),r=r.trim(),n?r=n(t,i?``:r):i&&(r=`none`),r}function Bw(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(mx.has(e)){o=!0;continue}else if(_y(e)){i[e]=n;continue}else{let t=sC(n,QS[e]);e.startsWith(`origin`)?(s=!0,a[e]=t):r[e]=t}}if(t.transform||(o||n?r.transform=zw(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 Vw(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 Hw(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}var Uw={correct:(e,t)=>{if(!t.target)return e;if(typeof e==`string`)if(q.test(e))e=parseFloat(e);else return e;return`${Hw(e,t.target.x)}% ${Hw(e,t.target.y)}%`}},Ww={correct:(e,{treeScale:t,projectionDelta:n})=>{let r=e,i=ib.parse(e);if(i.length>5)return r;let a=ib.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)}},Gw={borderRadius:{...Uw,applyTo:[`borderTopLeftRadius`,`borderTopRightRadius`,`borderBottomLeftRadius`,`borderBottomRightRadius`]},borderTopLeftRadius:Uw,borderTopRightRadius:Uw,borderBottomLeftRadius:Uw,borderBottomRightRadius:Uw,boxShadow:Ww};function Kw(e,{layout:t,layoutId:n}){return mx.has(e)||e.startsWith(`origin`)||(t||n!==void 0)&&(!!Gw[e]||e===`opacity`)}function qw(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 Yw=class extends mw{constructor(){super(...arguments),this.type=`html`,this.renderInstance=Vw}readValueFromInstance(e,t){if(mx.has(t))return this.projection?.isProjecting?lx(t):dx(e,t);{let n=Jw(e),r=(_y(t)?n.getPropertyValue(t):n[t])||0;return typeof r==`string`?r.trim():r}}measureInstanceViewportBox(e,{transformPagePoint:t}){return Fw(e,t)}build(e,t,n){Bw(e,t,n.transformTemplate)}scrapeMotionValuesFromProps(e,t,n){return qw(e,t,n)}},Xw={offset:`stroke-dashoffset`,array:`stroke-dasharray`},Zw={offset:`strokeDashoffset`,array:`strokeDasharray`};function Qw(e,t,n=1,r=0,i=!0){e.pathLength=1;let a=i?Xw:Zw;e[a.offset]=`${-r}`,e[a.array]=`${t} ${n}`}var $w=[`offsetDistance`,`offsetPath`,`offsetRotate`,`offsetAnchor`];function eT(e,{attrX:t,attrY:n,attrScale:r,pathLength:i,pathSpacing:a=1,pathOffset:o=0,...s},c,l,u){if(Bw(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 $w)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&&Qw(d,i,a,o,!1)}var tT=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`]),nT=e=>typeof e==`string`&&e.toLowerCase()===`svg`;function rT(e,t,n,r){Vw(e,t,void 0,r);for(let n in t.attrs)e.setAttribute(tT.has(n)?n:NS(n),t.attrs[n])}function iT(e,t,n){let r=qw(e,t,n);for(let n in e)if(Z(e[n])||Z(t[n])){let t=px.indexOf(n)===-1?n:`attr`+n.charAt(0).toUpperCase()+n.substring(1);r[t]=e[n]}return r}var aT=class extends mw{constructor(){super(...arguments),this.type=`svg`,this.isSVGTag=!1,this.measureInstanceViewportBox=Q}getBaseTargetFromProps(e,t){return e[t]}readValueFromInstance(e,t){if(mx.has(t)){let e=eC(t);return e&&e.default||0}return t=tT.has(t)?t:NS(t),e.getAttribute(t)}scrapeMotionValuesFromProps(e,t,n){return iT(e,t,n)}build(e,t,n){eT(e,t,this.isSVGTag,n.transformTemplate,n.style)}renderInstance(e,t,n,r){rT(e,t,n,r)}mount(e){this.isSVGTag=nT(e.tagName),super.mount(e)}},oT=tw.length;function sT(e){if(!e)return;if(!e.isControllingVariants){let t=e.parent&&sT(e.parent)||{};return e.props.initial!==void 0&&(t.initial=e.props.initial),t}let t={};for(let n=0;n<oT;n++){let r=tw[n],i=e.props[r];($C(i)||i===!1)&&(t[r]=i)}return t}function cT(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 lT=[...ew].reverse(),uT=ew.length;function dT(e){return t=>Promise.all(t.map(({animation:t,options:n})=>BS(e,t,n)))}function fT(e){let t=dT(e),n=hT(),r=!0,i=!1,a=t=>(n,r)=>{let i=TS(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=sT(e.parent)||{},l=[],u=new Set,d={},f=1/0;for(let t=0;t<uT;t++){let p=lT[t],m=n[p],h=s[p]===void 0?c[p]:s[p],g=$C(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||QC(h)||typeof h==`boolean`)continue;if(p===`exit`&&m.isActive&&_!==!0){m.prevResolvedValues&&(d={...d,...m.prevResolvedValues});continue}let y=pT(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=DS(t)&&DS(n)?!cT(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=TS(r,t);if(r.enteringChildren&&i){let{delayChildren:t}=i.transition||{};n.delay=iS(r.enteringChildren,e,t)}}return{animation:t,options:n}}))}if(u.size){let t={};if(typeof s.initial!=`boolean`){let n=TS(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=hT(),i=!0}}}function pT(e,t){return typeof t==`string`?t!==e:Array.isArray(t)?!cT(t,e):!1}function mT(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function hT(){return{animate:mT(!0),whileInView:mT(),whileHover:mT(),whileTap:mT(),whileDrag:mT(),whileFocus:mT(),exit:mT()}}function gT(e,t){e.min=t.min,e.max=t.max}function _T(e,t){gT(e.x,t.x),gT(e.y,t.y)}function vT(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}var yT=.9999,bT=1.0001,xT=-.01,ST=.01;function CT(e){return e.max-e.min}function wT(e,t,n){return Math.abs(e-t)<=n}function TT(e,t,n,r=.5){e.origin=r,e.originPoint=Y(t.min,t.max,e.origin),e.scale=CT(n)/CT(t),e.translate=Y(n.min,n.max,e.origin)-e.originPoint,(e.scale>=yT&&e.scale<=bT||isNaN(e.scale))&&(e.scale=1),(e.translate>=xT&&e.translate<=ST||isNaN(e.translate))&&(e.translate=0)}function ET(e,t,n,r){TT(e.x,t.x,n.x,r?r.originX:void 0),TT(e.y,t.y,n.y,r?r.originY:void 0)}function DT(e,t,n,r=0){e.min=(r?Y(n.min,n.max,r):n.min)+t.min,e.max=e.min+CT(t)}function OT(e,t,n,r){DT(e.x,t.x,n.x,r?.x),DT(e.y,t.y,n.y,r?.y)}function kT(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+CT(t)}function AT(e,t,n,r){kT(e.x,t.x,n.x,r?.x),kT(e.y,t.y,n.y,r?.y)}function jT(e,t,n,r,i){return e-=t,e=ww(e,1/n,r),i!==void 0&&(e=ww(e,1/i,r)),e}function MT(e,t=0,n=1,r=.5,i,a=e,o=e){if(Ry.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=jT(e.min,t,n,s,i),e.max=jT(e.max,t,n,s,i)}function NT(e,t,[n,r,i],a,o){MT(e,t[n],t[r],t[i],t.scale,a,o)}var PT=[`x`,`scaleX`,`originX`],FT=[`y`,`scaleY`,`originY`];function IT(e,t,n,r){NT(e.x,t,PT,n?n.x:void 0,r?r.x:void 0),NT(e.y,t,FT,n?n.y:void 0,r?r.y:void 0)}function LT(e){return e.translate===0&&e.scale===1}function RT(e){return LT(e.x)&<(e.y)}function zT(e,t){return e.min===t.min&&e.max===t.max}function BT(e,t){return zT(e.x,t.x)&&zT(e.y,t.y)}function VT(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function HT(e,t){return VT(e.x,t.x)&&VT(e.y,t.y)}function UT(e){return CT(e.x)/CT(e.y)}function WT(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}function GT(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 qT=[`borderTopLeftRadius`,`borderTopRightRadius`,`borderBottomLeftRadius`,`borderBottomRightRadius`],JT=qT.length,YT=e=>typeof e==`string`?parseFloat(e):e,XT=e=>typeof e==`number`||q.test(e);function ZT(e,t,n,r,i,a){i?(e.opacity=Y(0,n.opacity??1,$T(r)),e.opacityExit=Y(t.opacity??1,0,eE(r))):a&&(e.opacity=Y(t.opacity??1,n.opacity??1,r));for(let i=0;i<JT;i++){let a=qT[i],o=QT(t,a),s=QT(n,a);o===void 0&&s===void 0||(o||=0,s||=0,o===0||s===0||XT(o)===XT(s)?(e[a]=Math.max(Y(YT(o),YT(s),r),0),(Ry.test(s)||Ry.test(o))&&(e[a]+=`%`)):e[a]=s)}(t.rotate||n.rotate)&&(e.rotate=Y(t.rotate||0,n.rotate||0,r))}function QT(e,t){return e[t]===void 0?e.borderRadius:e[t]}var $T=tE(0,.5,Yv),eE=tE(.5,.95,Av);function tE(e,t,n){return r=>r<e?0:r>t?1:n(Mv(e,t,r))}function nE(e,t,n){let r=Z(e)?e:lS(e);return r.start(yS(``,r,t,n)),r.animation}function rE(e,t,n,r={passive:!0}){return e.addEventListener(t,n,r),()=>e.removeEventListener(t,n)}var iE=(e,t)=>e.depth-t.depth,aE=class{constructor(){this.children=[],this.isDirty=!1}add(e){Sv(this.children,e),this.isDirty=!0}remove(e){Cv(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(iE),this.isDirty=!1,this.children.forEach(e)}};function oE(e,t){let n=my.now(),r=({timestamp:i})=>{let a=i-n;a>=t&&(uy(r),e(a-t))};return G.setup(r,!0),()=>uy(r)}function sE(e){return Z(e)?e.get():e}var cE=class{constructor(){this.members=[]}add(e){Sv(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&&(Cv(this.members,n),n.unmount())}e.scheduleRender()}remove(e){if(Cv(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)}},lE={hasAnimatedSinceResize:!0,hasEverUpdated:!1},uE={nodes:0,calculatedTargetDeltas:0,calculatedProjections:0},dE=[``,`X`,`Y`,`Z`],fE=1e3,pE=0;function mE(e,t,n,r){let{latestValues:i}=t;i[e]&&(n[e]=i[e],t.setStaticValue(e,0),r&&(r[e]=0))}function hE(e){if(e.hasCheckedOptimisedAppear=!0,e.root===e)return;let{visualElement:t}=e.options;if(!t)return;let n=FS(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&&hE(r)}function gE({attachResizeListener:e,defaultParent:t,measureScroll:n,checkIsScrollRoot:r,resetTransform:i}){return class{constructor(e={},n=t?.()){this.id=pE++,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,oy.value&&(uE.nodes=uE.calculatedTargetDeltas=uE.calculatedProjections=0),this.nodes.forEach(yE),this.nodes.forEach(OE),this.nodes.forEach(kE),this.nodes.forEach(bE),oy.addProjectionMetrics&&oy.addProjectionMetrics(uE)},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 aE)}addEventListener(e,t){return this.eventHandlers.has(e)||this.eventHandlers.set(e,new Nv),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=AC(t)&&!GC(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=oE(i,250),lE.hasAnimatedSinceResize&&(lE.hasAnimatedSinceResize=!1,this.nodes.forEach(DE)))})}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()||IE,{onLayoutAnimationStart:o,onLayoutAnimationComplete:s}=i.getProps(),c=!this.targetLayout||!HT(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={...dS(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||DE(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(),uy(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(AE),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&&hE(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(CE),this.nodes.forEach(SE);return}if(this.animationId<=this.animationCommitId){this.nodes.forEach(wE);return}this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(TE),this.nodes.forEach(EE),this.nodes.forEach(_E),this.nodes.forEach(vE)):this.nodes.forEach(wE),this.clearAllSnapshots();let e=my.now();K.delta=wv(0,1e3/60,e-K.timestamp),K.timestamp=e,K.isProcessing=!0,dy.update.process(K),dy.preRender.process(K),dy.render.process(K),K.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,lC.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(xE),this.sharedNodes.forEach(jE)}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&&!CT(this.snapshot.measuredBox.x)&&!CT(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&&!RT(this.projectionDelta),n=this.getTransformTemplate(),r=n?n(this.latestValues,``):void 0,a=r!==this.prevTransformTemplateValue;e&&this.instance&&(t||xw(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)),BE(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(HE))){let{scroll:e}=this.root;e&&(jw(t.x,e.offset.x),jw(t.y,e.offset.y))}return t}removeElementScroll(e){let t=Q();if(_T(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&&_T(t,e),jw(t.x,i.offset.x),jw(t.y,i.offset.y))}return t}applyTransform(e,t=!1,n){let r=n||Q();_T(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&&(jw(r.x,-n.scroll.offset.x),jw(r.y,-n.scroll.offset.y)),xw(n.latestValues)&&Pw(r,n.latestValues,n.layout?.layoutBox)}return xw(this.latestValues)&&Pw(r,this.latestValues,this.layout?.layoutBox),r}removeTransform(e){let t=Q();_T(t,e);for(let e=0;e<this.path.length;e++){let n=this.path[e];if(!xw(n.latestValues))continue;let r;n.instance&&(bw(n.latestValues)&&n.updateSnapshot(),r=Q(),_T(r,n.measurePageBox())),IT(t,n.latestValues,n.snapshot?.layoutBox,r)}return xw(this.latestValues)&&IT(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(),OT(this.target,this.relativeTarget,this.relativeParent.target,this.options.layoutAnchor||void 0)):this.targetDelta?(this.resumingFrom?this.applyTransform(this.layout.layoutBox,!1,this.target):_T(this.target,this.layout.layoutBox),Dw(this.target,this.targetDelta)):_T(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),oy.value&&uE.calculatedTargetDeltas++)}getClosestProjectingParent(){if(!(!this.parent||bw(this.parent.latestValues)||Sw(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(),AT(this.relativeTargetOrigin,t,n,this.options.layoutAnchor||void 0),_T(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;_T(this.layoutCorrected,this.layout.layoutBox);let a=this.treeScale.x,o=this.treeScale.y;Aw(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():(vT(this.prevProjectionDelta.x,this.projectionDelta.x),vT(this.prevProjectionDelta.y,this.projectionDelta.y)),ET(this.projectionDelta,this.layoutCorrected,s,this.latestValues),(this.treeScale.x!==a||this.treeScale.y!==o||!WT(this.projectionDelta.x,this.prevProjectionDelta.x)||!WT(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners(`projectionUpdate`,s)),oy.value&&uE.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=YC(),this.projectionDelta=YC(),this.projectionDeltaWithTransform=YC()}setAnimationOrigin(e,t=!1,n){let r=this.snapshot,i=r?r.latestValues:{},a={...this.latestValues},o=YC();(!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(FE));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):(ME(o.x,e.x,n),ME(o.y,e.y,n)),this.setTargetDelta(o),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(AT(s,this.layout.layoutBox,this.relativeParent.layout.layoutBox,this.options.layoutAnchor||void 0),PE(this.relativeTarget,this.relativeTargetOrigin,s,n),f&&BT(this.relativeTarget,f)&&(this.isProjectionDirty=!1),f||=Q(),_T(f,this.relativeTarget)),c&&(this.animationValues=a,ZT(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&&=(uy(this.pendingAnimation),void 0),this.pendingAnimation=G.update(()=>{lE.hasAnimatedSinceResize=!0,hy.layout++,this.motionValue||=lS(0),this.motionValue.jump(0,!1),this.currentAnimation=nE(this.motionValue,[0,1e3],{...e,velocity:0,isSync:!0,onUpdate:t=>{this.mixTargetDelta(t),e.onUpdate&&e.onUpdate(t)},onStop:()=>{hy.layout--},onComplete:()=>{hy.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(fE),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&&VE(this.options.animationType,this.layout.layoutBox,r.layoutBox)){n=this.target||Q();let t=CT(this.layout.layoutBox.x);n.x.min=e.target.x.min,n.x.max=n.x.min+t;let r=CT(this.layout.layoutBox.y);n.y.min=e.target.y.min,n.y.max=n.y.min+r}_T(t,n),Pw(t,i),ET(this.projectionDeltaWithTransform,this.layoutCorrected,t,i)}}registerSharedNode(e,t){this.sharedNodes.has(e)||this.sharedNodes.set(e,new cE),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&&mE(`z`,e,r,this.animationValues);for(let t=0;t<dE.length;t++)mE(`rotate${dE[t]}`,e,r,this.animationValues),mE(`skew${dE[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=sE(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=sE(t?.pointerEvents)||``),this.hasProjected&&!xw(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 Gw){if(i[t]===void 0)continue;let{correct:n,applyTo:o,isCSSVariable:s}=Gw[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?sE(t?.pointerEvents)||``:`none`)}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(e=>e.currentAnimation?.stop()),this.root.nodes.forEach(SE),this.root.sharedNodes.clear()}}}function _E(e){e.updateLayout()}function vE(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`)GT(e=>{let r=a?t.measuredBox[e]:t.layoutBox[e],i=CT(r);r.min=n[e].min,r.max=r.min+i});else if(i===`x`||i===`y`){let e=i===`x`?`y`:`x`;gT(a?t.measuredBox[e]:t.layoutBox[e],n[e])}else VE(i,t.layoutBox,n)&>(r=>{let i=a?t.measuredBox[r]:t.layoutBox[r],o=CT(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=YC();ET(o,n,t.layoutBox);let s=YC();a?ET(s,e.applyTransform(r,!0),t.measuredBox):ET(s,n,t.layoutBox);let c=!RT(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();AT(s,t.layoutBox,i.layoutBox,o);let c=Q();AT(c,n,a.layoutBox,o),HT(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 yE(e){oy.value&&uE.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 bE(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function xE(e){e.clearSnapshot()}function SE(e){e.clearMeasurements()}function CE(e){e.isLayoutDirty=!0,e.updateLayout()}function wE(e){e.isLayoutDirty=!1}function TE(e){e.isAnimationBlocked&&e.layout&&!e.isLayoutDirty&&(e.snapshot=e.layout,e.isLayoutDirty=!0)}function EE(e){let{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify(`BeforeLayoutMeasure`),e.resetTransform()}function DE(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function OE(e){e.resolveTargetDelta()}function kE(e){e.calcProjection()}function AE(e){e.resetSkewAndRotation()}function jE(e){e.removeLeadSnapshot()}function ME(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 NE(e,t,n,r){e.min=Y(t.min,n.min,r),e.max=Y(t.max,n.max,r)}function PE(e,t,n,r){NE(e.x,t.x,n.x,r),NE(e.y,t.y,n.y,r)}function FE(e){return e.animationValues&&e.animationValues.opacityExit!==void 0}var IE={duration:.45,ease:[.4,0,.1,1]},LE=e=>typeof navigator<`u`&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),RE=LE(`applewebkit/`)&&!LE(`chrome/`)?Math.round:Av;function zE(e){e.min=RE(e.min),e.max=RE(e.max)}function BE(e){zE(e.x),zE(e.y)}function VE(e,t,n){return e===`position`||e===`preserve-aspect`&&!wT(UT(t),UT(n),.2)}function HE(e){return e!==e.root&&e.scroll?.wasRoot}var UE=gE({attachResizeListener:(e,t)=>rE(e,`resize`,t),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body?.scrollLeft||0,y:document.documentElement.scrollTop||document.body?.scrollTop||0}),checkIsScrollRoot:()=>!0}),WE={current:void 0},GE=gE({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!WE.current){let e=new UE({});e.mount(window),e.setOptions({layoutScroll:!0}),WE.current=e}return WE.current},resetTransform:(e,t)=>{e.style.transform=t===void 0?`none`:t},checkIsScrollRoot:e=>window.getComputedStyle(e).position===`fixed`}),KE=(0,P.createContext)({transformPagePoint:e=>e,isStatic:!1,reducedMotion:`never`});function qE(e=!0){let t=(0,P.useContext)(xv);if(t===null)return[!0,null];let{isPresent:n,onExitComplete:r,register:i}=t,a=(0,P.useId)();(0,P.useEffect)(()=>{if(e)return i(a)},[e]);let o=(0,P.useCallback)(()=>e&&r&&r(a),[a,r,e]);return!n&&r?[!1,o]:[!0]}var JE=(0,P.createContext)({strict:!1}),YE={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`]},XE=!1;function ZE(){if(XE)return;let e={};for(let t in YE)e[t]={isEnabled:e=>YE[t].some(t=>!!e[t])};dw(e),XE=!0}function QE(){return ZE(),fw()}function $E(e){let t=QE();for(let n in e)t[n]={...t[n],...e[n]};dw(t)}var eD=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 tD(e){return e.startsWith(`while`)||e.startsWith(`drag`)&&e!==`draggable`||e.startsWith(`layout`)||e.startsWith(`onTap`)||e.startsWith(`onPan`)||e.startsWith(`onLayout`)||eD.has(e)}function nD(e){var t=Object.create(null);return function(n){return t[n]===void 0&&(t[n]=e(n)),t[n]}}var rD=n((()=>{})),iD=r({default:()=>oD}),aD,oD,sD=n((()=>{rD(),aD=/^((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)-.*))$/,oD=nD(function(e){return aD.test(e)||e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&e.charCodeAt(2)<91})})),cD=e=>!tD(e);function lD(e){typeof e==`function`&&(cD=t=>t.startsWith(`on`)?!tD(t):e(t))}try{lD((sD(),t(iD)).default)}catch{}function uD(e,t,n){let r={};for(let i in e)i===`values`&&typeof e.values==`object`||Z(e[i])||(cD(i)||n===!0&&tD(i)||!t&&!tD(i)||e.draggable&&i.startsWith(`onDrag`))&&(r[i]=e[i]);return r}var dD=(0,P.createContext)({});function fD(e,t){if(nw(e)){let{initial:t,animate:n}=e;return{initial:t===!1||$C(t)?t:void 0,animate:$C(n)?n:void 0}}return e.inherit===!1?{}:t}function pD(e){let{initial:t,animate:n}=fD(e,(0,P.useContext)(dD));return(0,P.useMemo)(()=>({initial:t,animate:n}),[mD(t),mD(n)])}function mD(e){return Array.isArray(e)?e.join(` `):e}var hD=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function gD(e,t,n){for(let r in t)!Z(t[r])&&!Kw(r,n)&&(e[r]=t[r])}function _D({transformTemplate:e},t){return(0,P.useMemo)(()=>{let n=hD();return Bw(n,t,e),Object.assign({},n.vars,n.style)},[t])}function vD(e,t){let n=e.style||{},r={};return gD(r,n,e),Object.assign(r,_D(e,t)),r}function yD(e,t){let n={},r=vD(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 bD=()=>({...hD(),attrs:{}});function xD(e,t,n,r){let i=(0,P.useMemo)(()=>{let n=bD();return eT(n,t,nT(r),e.transformTemplate,e.style),{...n.attrs,style:{...n.style}}},[t]);if(e.style){let t={};gD(t,e.style,e),i.style={...t,...i.style}}return i}var SD=[`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 CD(e){return typeof e!=`string`||e.includes(`-`)?!1:!!(SD.indexOf(e)>-1||/[A-Z]/u.test(e))}function wD(e,t,n,{latestValues:r},i,a=!1,o){let s=(o??CD(e)?xD:yD)(t,r,i,e),c=uD(t,typeof e==`string`,a),l=e===P.Fragment?{}:{...c,...s,ref:n},{children:u}=t,d=(0,P.useMemo)(()=>Z(u)?u.get():u,[u]);return(0,P.createElement)(e,{...l,children:d})}function TD({scrapeMotionValuesFromProps:e,createRenderState:t},n,r,i){return{latestValues:ED(n,r,i,e),renderState:t()}}function ED(e,t,n,r){let i={},a=r(e,{});for(let e in a)i[e]=sE(a[e]);let{initial:o,animate:s}=e,c=nw(e),l=rw(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`&&!QC(d)){let t=Array.isArray(d)?d:[d];for(let n=0;n<t.length;n++){let r=wS(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 DD=e=>(t,n)=>{let r=(0,P.useContext)(dD),i=(0,P.useContext)(xv),a=()=>TD(e,t,r,i);return n?a():yv(a)},OD=DD({scrapeMotionValuesFromProps:qw,createRenderState:hD}),kD=DD({scrapeMotionValuesFromProps:iT,createRenderState:bD}),AD=Symbol.for(`motionComponentSymbol`);function jD(e,t,n){let r=(0,P.useRef)(n);(0,P.useInsertionEffect)(()=>{r.current=n});let i=(0,P.useRef)(null);return(0,P.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 MD=(0,P.createContext)({});function ND(e){return e&&typeof e==`object`&&Object.prototype.hasOwnProperty.call(e,`current`)}function PD(e,t,n,r,i,a){let{visualElement:o}=(0,P.useContext)(dD),s=(0,P.useContext)(JE),c=(0,P.useContext)(xv),l=(0,P.useContext)(KE),u=l.reducedMotion,d=l.skipAnimations,f=(0,P.useRef)(null),p=(0,P.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,P.useContext)(MD);m&&!m.projection&&i&&(m.type===`html`||m.type===`svg`)&&FD(f.current,n,i,h);let g=(0,P.useRef)(!1);(0,P.useInsertionEffect)(()=>{m&&g.current&&m.update(n,c)});let _=n[PS],v=(0,P.useRef)(!!_&&typeof window<`u`&&!window.MotionHandoffIsComplete?.(_)&&window.MotionHasOptimisedAnimation?.(_));return bv(()=>{p.current=!0,m&&(g.current=!0,window.MotionIsMounted=!0,m.updateFeatures(),m.scheduleRenderMicrotask(),v.current&&m.animationState&&m.animationState.animateChanges())}),(0,P.useEffect)(()=>{m&&(!v.current&&m.animationState&&m.animationState.animateChanges(),v.current&&=(queueMicrotask(()=>{window.MotionHandoffMarkAsComplete?.(_)}),!1),m.enteringChildren=void 0)}),m}function FD(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:ID(e.parent)),e.projection.setOptions({layoutId:i,layout:a,alwaysMeasureLayout:!!o||s&&ND(s),visualElement:e,animationType:typeof a==`string`?a:`both`,initialPromotionConfig:r,crossfade:d,layoutScroll:c,layoutRoot:l,layoutAnchor:u})}function ID(e){if(e)return e.options.allowProjection===!1?ID(e.parent):e.projection}function LD(e,{forwardMotionProps:t=!1,type:n}={},r,i){r&&$E(r);let a=n?n===`svg`:CD(e),o=a?kD:OD;function s(n,s){let c,l={...(0,P.useContext)(KE),...n,layoutId:RD(n)},{isStatic:u}=l,d=pD(n),f=o(n,u);if(!u&&typeof window<`u`){zD(l,r);let t=BD(l);c=t.MeasureLayout,d.visualElement=PD(e,f,l,i,t.ProjectionNode,a)}return(0,F.jsxs)(dD.Provider,{value:d,children:[c&&d.visualElement?(0,F.jsx)(c,{visualElement:d.visualElement,...l}):null,wD(e,n,jD(f,d.visualElement,s),f,u,t,a)]})}s.displayName=`motion.${typeof e==`string`?e:`create(${e.displayName??e.name??``})`}`;let c=(0,P.forwardRef)(s);return c[AD]=e,c}function RD({layoutId:e}){let t=(0,P.useContext)(vv).id;return t&&e!==void 0?t+`-`+e:e}function zD(e,t){(0,P.useContext)(JE).strict}function BD(e){let{drag:t,layout:n}=QE();if(!t&&!n)return{};let r={...t,...n};return{MeasureLayout:t?.isEnabled(e)||n?.isEnabled(e)?r.MeasureLayout:void 0,ProjectionNode:r.ProjectionNode}}function VD(e,t){if(typeof Proxy>`u`)return LD;let n=new Map,r=(n,r)=>LD(n,r,e,t);return new Proxy((e,t)=>r(e,t),{get:(i,a)=>a===`create`?r:(n.has(a)||n.set(a,LD(a,void 0,e,t)),n.get(a))})}var HD=(e,t)=>t.isSVG??CD(e)?new aT(t):new Yw(t,{allowProjection:e!==P.Fragment}),UD=class extends hw{constructor(e){super(e),e.animationState||=fT(e)}updateAnimationControlsSubscription(){let{animate:e}=this.node.getProps();QC(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?.()}},WD=0,GD={animation:{Feature:UD},exit:{Feature:class extends hw{constructor(){super(...arguments),this.id=WD++,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=TS(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 qD=e=>t=>vC(t)&&e(t,KD(t));function JD(e,t,n,r){return rE(e,t,qD(n),r)}var YD=({current:e})=>e?e.ownerDocument.defaultView:null,XD=(e,t)=>Math.abs(e-t);function ZD(e,t){let n=XD(e.x,t.x),r=XD(e.y,t.y);return Math.sqrt(n**2+r**2)}var QD=new Set([`auto`,`scroll`]),$D=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=eO(this.lastRawMoveEventInfo,this.transformPagePoint));let e=nO(this.lastMoveEventInfo,this.history),t=this.startEvent!==null,n=ZD(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=eO(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=nO(e.type===`pointercancel`?this.lastMoveEventInfo:eO(t,this.transformPagePoint),this.history);this.startEvent&&n&&n(e,a),r&&r(e,a)},!vC(e))return;this.dragSnapToOrigin=i,this.handlers=t,this.transformPagePoint=n,this.distanceThreshold=a,this.contextWindow=r||window;let s=eO(KD(e),this.transformPagePoint),{point:c}=s,{timestamp:l}=K;this.history=[{...c,timestamp:l}];let{onSessionStart:u}=t;u&&u(e,nO(s,this.history)),this.removeListeners=jv(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);(QD.has(e.overflowX)||QD.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(),uy(this.updatePoint)}};function eO(e,t){return t?{point:t(e.point)}:e}function tO(e,t){return{x:e.x-t.x,y:e.y-t.y}}function nO({point:e},t){return{point:e,delta:tO(e,iO(t)),offset:tO(e,rO(t)),velocity:aO(t,.1)}}function rO(e){return e[0]}function iO(e){return e[e.length-1]}function aO(e,t){if(e.length<2)return{x:0,y:0};let n=e.length-1,r=null,i=iO(e);for(;n>=0&&(r=e[n],!(i.timestamp-r.timestamp>Pv(t)));)n--;if(!r)return{x:0,y:0};r===e[0]&&e.length>2&&i.timestamp-r.timestamp>Pv(t)*2&&(r=e[1]);let a=Fv(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 oO(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 sO(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 cO(e,{top:t,left:n,bottom:r,right:i}){return{x:sO(e.x,n,i),y:sO(e.y,t,r)}}function lO(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 uO(e,t){return{x:lO(e.x,t.x),y:lO(e.y,t.y)}}function dO(e,t){let n=.5,r=CT(e),i=CT(t);return i>r?n=Mv(t.min,t.max-r,e.min):r>i&&(n=Mv(e.min,e.max-i,t.min)),wv(0,1,n)}function fO(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 pO=.35;function mO(e=pO){return e===!1?e=0:e===!0&&(e=pO),{x:hO(e,`left`,`right`),y:hO(e,`top`,`bottom`)}}function hO(e,t,n){return{min:gO(e,t),max:gO(e,n)}}function gO(e,t){return typeof e==`number`?e:e[t]||0}var _O=new WeakMap,vO=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=pC(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),GT(e=>{let t=this.getAxisMotionValue(e).get()||0;if(Ry.test(t)){let{projection:n}=this.visualElement;if(n&&n.layout){let r=n.layout.layoutBox[e];r&&(t=CT(r)*(parseFloat(t)/100))}}this.originPoint[e]=t}),i&&G.update(()=>i(e,t),!1,!0),MS(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=SO(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 $D(e,{onSessionStart:i,onStart:a,onMove:o,onSessionEnd:s,resumeAnimation:c},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:l,distanceThreshold:n,contextWindow:YD(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||!xO(e,r,this.currentDirection))return;let i=this.getAxisMotionValue(e),a=this.originPoint[e]+n[e];this.constraints&&this.constraints[e]&&(a=oO(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&&ND(e)?this.constraints||=this.resolveRefConstraints():e&&n?this.constraints=cO(n.layoutBox,e):this.constraints=!1,this.elastic=mO(t),r!==this.constraints&&!ND(e)&&n&&this.constraints&&!this.hasMutatedConstraints&>(e=>{this.constraints!==!1&&this.getAxisMotionValue(e)&&(this.constraints[e]=fO(n.layoutBox[e],this.constraints[e]))})}resolveRefConstraints(){let{dragConstraints:e,onMeasureDragConstraints:t}=this.getProps();if(!e||!ND(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=Iw(n,r.root,this.visualElement.getTransformPagePoint()),a=uO(r.layout.layoutBox,i);if(t){let e=t(_w(a));this.hasMutatedConstraints=!!e,e&&(a=gw(e))}return a}startAnimation(e){let{drag:t,dragMomentum:n,dragElastic:r,dragTransition:i,dragSnapToOrigin:a,onDragTransitionEnd:o}=this.getProps(),s=this.constraints||{},c=GT(o=>{if(!xO(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 MS(this.visualElement,e),n.start(yS(e,n,0,t,this.visualElement,!1))}stopAnimation(){GT(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){GT(t=>{let{drag:n}=this.getProps();if(!xO(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(!ND(t)||!n||!this.constraints)return;this.stopAnimation();let r={x:0,y:0};GT(e=>{let t=this.getAxisMotionValue(e);if(t&&this.constraints!==!1){let n=t.get();r[e]=dO({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(),GT(t=>{if(!xO(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;_O.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&&SC(i);n&&r&&!a&&this.start(t)}),n,r=()=>{let{dragConstraints:t}=this.getProps();ND(t)&&t.current&&(this.constraints=this.resolveRefConstraints(),n||=bO(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=rE(window,`resize`,()=>this.scalePositionWithinConstraints()),s=i.addEventListener(`didUpdate`,(({delta:e,hasLayoutChanged:t})=>{this.isDragging&&t&&(GT(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=pO,dragMomentum:o=!0}=e;return{...e,drag:t,dragDirectionLock:n,dragPropagation:r,dragConstraints:i,dragElastic:a,dragMomentum:o}}};function yO(e){let t=!0;return()=>{if(t){t=!1;return}e()}}function bO(e,t,n){let r=WC(e,yO(n)),i=WC(t,yO(n));return()=>{r(),i()}}function xO(e,t,n){return(t===!0||t===e)&&(n===null||n===e)}function SO(e,t=10){let n=null;return Math.abs(e.y)>t?n=`y`:Math.abs(e.x)>t&&(n=`x`),n}var CO=class extends hw{constructor(e){super(e),this.removeGroupControls=Av,this.removeListeners=Av,this.controls=new vO(e)}mount(){let{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||Av}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()}},wO=e=>(t,n)=>{e&&G.update(()=>e(t,n),!1,!0)},TO=class extends hw{constructor(){super(...arguments),this.removePointerDownListener=Av}onPointerDown(e){this.session=new $D(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:YD(this.node)})}createPanHandlers(){let{onPanSessionStart:e,onPanStart:t,onPan:n,onPanEnd:r}=this.node.getProps();return{onSessionStart:wO(e),onStart:wO(t),onMove:wO(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()}},EO=!1,DO=class extends P.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),EO&&i.root.didUpdate(),i.addEventListener(`animationComplete`,()=>{this.safeToRemove()}),i.setOptions({...i.options,layoutDependency:this.props.layoutDependency,onExitComplete:()=>this.safeToRemove()})),lE.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}),EO=!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(),lC.postRender(()=>{!n.currentAnimation&&n.isLead()&&this.safeToRemove()}))}componentWillUnmount(){let{visualElement:e,layoutGroup:t,switchLayoutGroup:n}=this.props,{projection:r}=e;EO=!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 OO(e){let[t,n]=qE(),r=(0,P.useContext)(vv);return(0,F.jsx)(DO,{...e,layoutGroup:r,switchLayoutGroup:(0,P.useContext)(MD),isPresent:t,safeToRemove:n})}var kO={pan:{Feature:TO},drag:{Feature:CO,ProjectionNode:GE,MeasureLayout:OO}};function AO(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 jO=class extends hw{mount(){let{current:e}=this.node;e&&(this.unmount=gC(e,(e,t)=>(AO(this.node,t,`Start`),e=>AO(this.node,e,`End`))))}unmount(){}},MO=class extends hw{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=jv(rE(this.node.current,`focus`,()=>this.onFocus()),rE(this.node.current,`blur`,()=>this.onBlur()))}unmount(){}};function NO(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 PO=class extends hw{mount(){let{current:e}=this.node;if(!e)return;let{globalTapTarget:t,propagate:n}=this.node.props;this.unmount=kC(e,(e,t)=>(NO(this.node,t,`Start`),(e,{success:t})=>NO(this.node,e,t?`End`:`Cancel`)),{useGlobalTarget:t,stopPropagation:n?.tap===!1})}unmount(){}},FO=new WeakMap,IO=new WeakMap,LO=e=>{let t=FO.get(e.target);t&&t(e)},RO=e=>{e.forEach(LO)};function zO({root:e,...t}){let n=e||document;IO.has(n)||IO.set(n,{});let r=IO.get(n),i=JSON.stringify(t);return r[i]||(r[i]=new IntersectionObserver(RO,{root:e,...t})),r[i]}function BO(e,t,n){let r=zO(t);return FO.set(e,n),r.observe(e),()=>{FO.delete(e),r.unobserve(e)}}var VO={some:0,all:1},HO=class extends hw{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:VO[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=BO(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(UO(e,t))&&this.startObserver()}unmount(){this.stopObserver?.(),this.hasEnteredView=!1,this.isInView=!1}};function UO({viewport:e={}},{viewport:t={}}={}){return n=>e[n]!==t[n]}var WO={inView:{Feature:HO},tap:{Feature:PO},focus:{Feature:MO},hover:{Feature:jO}},GO={layout:{ProjectionNode:GE,MeasureLayout:OO}},KO=VD({...GD,...WO,...kO,...GO},HD),qO=new Map,JO=e=>{let t=qO.get(e);return t||(t=KO.create(e),qO.set(e,t)),t},YO=(0,P.memo)(({children:e,as:t=`p`,className:n,duration:r=2,spread:i=2})=>{let a=JO(t),o=(0,P.useMemo)(()=>(e?.length??0)*i,[e,i]);return(0,F.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})}),XO=(0,P.createContext)(null),ZO=()=>{let e=(0,P.useContext)(XO);if(!e)throw Error(`Reasoning components must be used within Reasoning`);return e},QO=1e3,$O=1e3,ek=(0,P.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]=G_({defaultProp:c,onChange:i,prop:n}),[p,m]=G_({defaultProp:void 0,prop:a}),h=(0,P.useRef)(t),[g,_]=(0,P.useState)(!1),v=(0,P.useRef)(null);(0,P.useEffect)(()=>{t?(h.current=!0,v.current===null&&(v.current=Date.now())):v.current!==null&&(m(Math.ceil((Date.now()-v.current)/$O)),v.current=null)},[t,m]),(0,P.useEffect)(()=>{t&&!d&&!u&&f(!0)},[t,d,f,u]),(0,P.useEffect)(()=>{if(h.current&&!t&&d&&!g){let e=setTimeout(()=>{f(!1),_(!0)},QO);return()=>clearTimeout(e)}},[t,d,f,g]);let y=(0,P.useCallback)(e=>{f(e)},[f]),b=(0,P.useMemo)(()=>({duration:p,isOpen:d,isStreaming:t,setIsOpen:f}),[p,d,t,f]);return(0,F.jsx)(XO.Provider,{value:b,children:(0,F.jsx)(hv,{className:l(`not-prose mb-4`,e),onOpenChange:y,open:d,...s,children:o})})}),tk=(e,t)=>e||t===0?(0,F.jsx)(YO,{duration:1,children:`Thinking...`}):t===void 0?(0,F.jsx)(`p`,{children:`Thought for a few seconds`}):(0,F.jsxs)(`p`,{children:[`Thought for `,t,` seconds`]}),nk=(0,P.memo)(({className:e,children:t,getThinkingMessage:n=tk,...r})=>{let{isStreaming:i,isOpen:a,duration:o}=ZO();return(0,F.jsx)(gv,{className:l(`flex w-full items-center gap-2 text-muted-foreground text-sm transition-colors hover:text-foreground`,e),...r,children:t??(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(tt,{className:`size-4`}),n(i,o),(0,F.jsx)(k,{className:l(`size-4 transition-transform`,a?`rotate-180`:`rotate-0`)})]})})}),rk=(0,P.memo)(({className:e,children:t,...n})=>(0,F.jsx)(_v,{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,F.jsx)(Yf,{children:t})}));ek.displayName=`Reasoning`,nk.displayName=`ReasoningTrigger`,rk.displayName=`ReasoningContent`;var ik={"approval-requested":(0,F.jsx)(we,{className:`size-4 text-yellow-600`}),"approval-responded":(0,F.jsx)(nt,{className:`size-4 text-blue-600`}),"input-available":(0,F.jsx)(we,{className:`size-4 animate-pulse`}),"input-streaming":(0,F.jsx)(O,{className:`size-4`}),"output-available":(0,F.jsx)(nt,{className:`size-4 text-green-600`}),"output-denied":(0,F.jsx)(rt,{className:`size-4 text-orange-600`}),"output-error":(0,F.jsx)(rt,{className:`size-4 text-red-600`})};function ak(e){return(0,F.jsx)(Le,{className:`gap-1.5 text-xs`,variant:`secondary`,children:ik[e]})}var ok=({className:e,...t})=>(0,F.jsx)(hv,{className:l(`group not-prose mb-4 w-full rounded-sm border`,e),...t}),sk={run_commands:(0,F.jsx)(_t,{className:`size-4`}),read_files:(0,F.jsx)(at,{className:`size-4`}),editor:(0,F.jsx)(Fe,{className:`size-4`}),ask_question:(0,F.jsx)(lt,{className:`size-4`})},ck=e=>(0,F.jsx)(Le,{className:`text-xs`,variant:`ghost`,children:e&&sk[e]||(0,F.jsx)(Ce,{className:`size-4`})}),lk=({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,F.jsx)(gv,{className:l(`flex w-full overflow-hidden items-center justify-between gap-4 p-3 cursor-pointer`,e),...a,children:(0,F.jsxs)(`div`,{className:`flex items-center gap-2 shrink-0`,children:[ck(u),(0,F.jsx)(`span`,{className:`font-light text-muted-foreground text-sm truncated wrap-break-word ellipses`,children:c}),ak(r)]})})},uk=({className:e,...t})=>(0,F.jsx)(_v,{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}),dk=({className:e,output:t,errorText:n,...r})=>{if(!(t||n))return null;let i=(0,F.jsx)(`div`,{children:t});return typeof t==`object`&&!(0,P.isValidElement)(t)?i=(0,F.jsx)(zf,{code:JSON.stringify(t,null,2),language:`json`}):typeof t==`string`&&(i=(0,F.jsx)(zf,{code:t,language:`json`})),(0,F.jsx)(`div`,{className:l(`space-y-2`,e),...r,children:(0,F.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,F.jsx)(`div`,{children:n}),i]})})},fk=({children:e,className:t,...n})=>(0,F.jsx)(`div`,{className:l(`text-muted-foreground text-sm`,t),...n,children:e}),pk=({defaultOpen:e=!0,className:t,...n})=>(0,F.jsx)(hv,{className:l(t),defaultOpen:e,...n}),mk=({children:e,className:t,title:n,...r})=>(0,F.jsx)(gv,{className:l(`group`,t),...r,children:e??(0,F.jsxs)(`div`,{className:`flex w-full cursor-pointer items-center gap-2 text-muted-foreground text-sm transition-colors hover:text-foreground`,children:[(0,F.jsx)(ve,{className:`size-4`}),(0,F.jsx)(`p`,{className:`text-sm`,children:n}),(0,F.jsx)(k,{className:`size-4 transition-transform group-data-[state=open]:rotate-180`})]})}),hk=({children:e,className:t,...n})=>(0,F.jsx)(_v,{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,F.jsx)(`div`,{className:`mt-4 space-y-2 border-muted border-l-2 pl-4`,children:e})});function gk(e){return typeof e==`object`&&e?e:void 0}function $(e){return typeof e==`string`&&e.trim()?e.trim():void 0}function _k(e){return Array.isArray(e)?e.filter(e=>typeof e==`string`):void 0}function vk(e){return e===`output-error`?`Failed`:e===`output-available`?`Done`:`Running`}function yk(e){let t=gk(e.input),n=gk(e.output),r=vk(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 bk(e){if(e.error)return e.error;let t=gk(e.input),n=gk(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=_k(t?.requiredSections);return e?.length?e.join(`, `):void 0}default:return}}function xk({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,F.jsxs)(pk,{className:e,defaultOpen:t,...r,children:[(0,F.jsx)(mk,{title:i,children:(0,F.jsxs)(`div`,{className:`flex w-full cursor-pointer items-center gap-2 text-muted-foreground text-sm transition-colors hover:text-foreground`,children:[(0,F.jsx)(vt,{className:`size-4`}),(0,F.jsx)(`p`,{className:`text-sm`,children:i})]})}),(0,F.jsx)(hk,{children:n.map(e=>{let t=bk(e);return(0,F.jsxs)(fk,{className:`space-y-1`,children:[(0,F.jsx)(`div`,{children:yk(e)}),t?(0,F.jsx)(`div`,{className:`line-clamp-3 text-xs text-muted-foreground/90`,children:t}):null]},e.id)})})]})}function Sk(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 Ck=1,wk=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:Ck++,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],P.isValidElement(e))i=!1,this.create({id:n,type:`default`,message:e});else if(Ek(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`&&!P.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`&&!P.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`&&!P.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`&&!P.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||Ck++;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}},Tk=(e,t)=>{let n=t?.id||Ck++;return wk.addToast({title:e,...t,id:n}),n},Ek=e=>e&&typeof e==`object`&&`ok`in e&&typeof e.ok==`boolean`&&`status`in e&&typeof e.status==`number`,Dk=Object.assign(Tk,{success:wk.success,info:wk.info,warning:wk.warning,error:wk.error,custom:wk.custom,message:wk.message,promise:wk.promise,dismiss:wk.dismiss,loading:wk.loading},{getHistory:()=>wk.toasts,getToasts:()=>wk.getActiveToasts()});Sk(`[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 Ok={audio:ut,document:Te,image:j,source:st,unknown:dt,video:yt},kk=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`},Ak=(e,t,n)=>n?(0,F.jsx)(`img`,{alt:t||`Image`,className:`size-full object-cover`,height:96,src:e,width:96}):(0,F.jsx)(`img`,{alt:t||`Image`,className:`size-full rounded object-cover`,height:20,src:e,width:20}),jk=(0,P.createContext)(null),Mk=(0,P.createContext)(null),Nk=()=>(0,P.useContext)(jk)??{variant:`grid`},Pk=()=>{let e=(0,P.useContext)(Mk);if(!e)throw Error(`Attachment components must be used within <Attachment>`);return e},Fk=({variant:e=`grid`,className:t,children:n,...r})=>{let i=(0,P.useMemo)(()=>({variant:e}),[e]);return(0,F.jsx)(jk.Provider,{value:i,children:(0,F.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})})},Ik=({data:e,onRemove:t,className:n,children:r,...i})=>{let{variant:a}=Nk(),o=kk(e),s=(0,P.useMemo)(()=>({data:e,mediaCategory:o,onRemove:t,variant:a}),[e,o,t,a]);return(0,F.jsx)(Mk.Provider,{value:s,children:(0,F.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})})},Lk=({fallbackIcon:e,className:t,...n})=>{let{data:r,mediaCategory:i,variant:a}=Pk(),o=a===`inline`?`size-3`:`size-4`,s=e=>(0,F.jsx)(e,{className:l(o,`text-muted-foreground`)}),c=()=>{if(i===`image`&&r.type===`file`&&r.url)return Ak(r.url,r.filename,a===`grid`);if(i===`video`&&r.type===`file`&&r.url)return(0,F.jsx)(`video`,{className:`size-full object-cover`,muted:!0,src:r.url});let t=Ok[i];return e??s(t)};return(0,F.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()})},Rk=({label:e=`Remove`,className:t,children:n,...r})=>{let{onRemove:i,variant:a}=Pk(),o=(0,P.useCallback)(e=>{e.stopPropagation(),i?.()},[i]);return i?(0,F.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,F.jsx)(oe,{}),(0,F.jsx)(`span`,{className:`sr-only`,children:e})]}):null},zk=e=>(0,F.jsx)(re,{...e}),Bk=e=>(0,F.jsx)(ce,{...e}),Vk=({className:e,children:t,title:n=`Model Selector`,...r})=>(0,F.jsxs)(se,{"aria-describedby":void 0,className:l(`outline! border-none! p-0 outline-border! outline-solid!`,e),...r,children:[(0,F.jsx)(de,{className:`sr-only`,children:n}),(0,F.jsx)(v_,{className:`**:data-[slot=command-input-wrapper]:h-auto`,children:t})]}),Hk=({className:e,...t})=>(0,F.jsx)(y_,{className:l(`h-auto py-3.5`,e),...t}),Uk=e=>(0,F.jsx)(b_,{...e}),Wk=e=>(0,F.jsx)(x_,{...e}),Gk=e=>(0,F.jsx)(S_,{...e}),Kk=e=>(0,F.jsx)(C_,{...e}),qk=({provider:e,className:t,...n})=>(0,F.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,F.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}),Yk=({className:e,...t})=>(0,F.jsx)(`span`,{className:l(`flex-1 truncate text-left`,e),...t});function Xk(){let e=N_();return e.files.length===0?null:(0,F.jsx)(Fk,{variant:`inline`,children:e.files.map(t=>(0,F.jsxs)(Ik,{data:t,onRemove:()=>e.remove(t.id),children:[(0,F.jsx)(Lk,{}),(0,F.jsx)(Rk,{})]},t.id))})}function Zk({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,F.jsxs)(`div`,{className:`grid gap-3 bg-background/70 p-3`,children:[(0,F.jsxs)(`div`,{className:`grid gap-2 md:grid-cols-2`,children:[(0,F.jsxs)(`div`,{className:`grid gap-2`,children:[(0,F.jsx)(pe,{className:`text-xs uppercase tracking-[0.16em] text-muted-foreground`,children:`Provider`}),(0,F.jsxs)(ie,{onValueChange:e=>{e&&d(e)},value:f,children:[(0,F.jsx)(me,{className:`w-full`,children:(0,F.jsx)(he,{placeholder:`Select provider`})}),(0,F.jsx)(M,{children:p.map(e=>(0,F.jsx)(ne,{value:e.id,children:(0,F.jsxs)(`div`,{className:`flex items-center gap-2`,children:[Qk(e.id),(0,F.jsx)(`span`,{children:e.name})]})},e.id))})]})]}),(0,F.jsxs)(`div`,{className:`grid gap-2`,children:[(0,F.jsx)(pe,{className:`text-xs uppercase tracking-[0.16em] text-muted-foreground`,children:`Model`}),(0,F.jsxs)(zk,{onOpenChange:u,open:i,children:[(0,F.jsx)(Bk,{children:(0,F.jsx)(E,{className:`w-full justify-between`,variant:`outline`,children:(0,F.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[h&&Qk(h.id),(0,F.jsx)(`span`,{className:`truncate`,children:g?.name||g?.id||`Select model`})]})})}),(0,F.jsxs)(Vk,{children:[(0,F.jsx)(Hk,{placeholder:`Search models...`}),(0,F.jsxs)(Uk,{children:[(0,F.jsx)(Wk,{children:`No models found.`}),(0,F.jsx)(Gk,{heading:h?.name||`Models`,children:a.map(e=>(0,F.jsxs)(Kk,{onSelect:()=>{l(e.id),u(!1)},value:e.id,children:[h&&Qk(h.id),(0,F.jsx)(Yk,{children:e.name||e.id}),(0,F.jsx)(Jk,{children:h&&Qk(h.id)}),r===e.id?(0,F.jsx)(xe,{className:`ml-auto size-4`}):(0,F.jsx)(`div`,{className:`ml-auto size-4`})]},e.id))})]})]})]})]})]}),(0,F.jsx)(`div`,{className:`grid gap-2 md:grid-cols-2`,children:(0,F.jsxs)(`div`,{className:`grid gap-2`,children:[(0,F.jsx)(pe,{className:`text-xs uppercase tracking-[0.16em] text-muted-foreground`,htmlFor:`workspace-root`,children:`Workspace`}),(0,F.jsx)(v,{id:`workspace-root`,readOnly:!0,value:m})]})}),(0,F.jsxs)(`div`,{className:`grid gap-2 md:grid-cols-2`,children:[(0,F.jsx)($k,{checked:t,label:`Subagents`,onChange:s}),(0,F.jsx)($k,{checked:n,label:`Agent Teams`,onChange:c}),(0,F.jsx)($k,{checked:e,label:`Auto-approves`,onChange:o})]})]})}function Qk(e){return(0,F.jsx)(qk,{className:`size-3.5`,provider:e||`openai`})}function $k({checked:e,label:t,onChange:n,disabled:r}){return(0,F.jsxs)(`div`,{className:`flex items-center justify-between rounded-lg border bg-background/60 px-3 py-2`,children:[(0,F.jsx)(pe,{className:`text-sm`,htmlFor:t,children:t}),(0,F.jsx)(ye,{checked:e,id:t,onCheckedChange:e=>n(e),disabled:r})]})}var eA={None:`none`,Low:`low`,Medium:`medium`,High:`high`},tA=[{value:eA.None,label:`Thinking Off`,icon:mt},{value:eA.Low,label:`Low`,icon:pt},{value:eA.Medium,label:`Medium`,icon:ht},{value:eA.High,label:`High`,icon:mt}];function nA({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[A,j]=(0,P.useState)(!1),te=O_(),ne=N_(),re=l.find(e=>e.id===o)?.supportsThinking===!0,M=re?O:eA.None,ie=Math.max(tA.findIndex(e=>e.value===M),0),ae=tA[ie].icon;return(0,F.jsx)(`div`,{className:`border-t bg-background`,children:(0,F.jsxs)(F_,{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=>Dk.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=>rA(e.url)))).filter(e=>!!e);t.length>0&&(n={userImages:t}),t.length!==e.files.length&&Dk.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,F.jsx)(R_,{children:(0,F.jsx)(Xk,{})}),(0,F.jsx)(I_,{children:(0,F.jsx)(L_,{disabled:t||T.includes(`Failed`),onChange:e=>te.textInput.setInput(e.target.value),placeholder:`Type @ for context and / for skills`,value:te.textInput.value,className:`text-sm outline-none ring-0`})}),(0,F.jsxs)(z_,{className:`flex-col items-stretch gap-1 px-0`,children:[A?(0,F.jsx)(Zk,{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,F.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,F.jsxs)(B_,{className:`shrink-0`,children:[(0,F.jsx)(V_,{disabled:t,onClick:()=>ne.openFileDialog(),type:`button`,variant:`ghost`,children:(0,F.jsx)(dt,{className:`size-3`})}),(0,F.jsxs)(V_,{disabled:t,onClick:()=>j(e=>!e),type:`button`,variant:A?`default`:`ghost`,children:[(0,F.jsx)(ft,{className:`size-3`}),(0,F.jsxs)(`span`,{children:[C,`:`,o]})]}),(0,F.jsx)(V_,{disabled:t||!re,onClick:()=>{S(tA[(ie+1)%tA.length].value)},type:`button`,title:tA[ie].label,variant:M===eA.None?`ghost`:`default`,children:(0,F.jsx)(ae,{className:`size-3`})}),(0,F.jsxs)(V_,{disabled:t,onClick:()=>h(s===`act`?`plan`:`act`),type:`button`,variant:s===`plan`?`default`:`ghost`,className:`hidden`,children:[s===`act`?(0,F.jsx)(_e,{className:`size-3`}):(0,F.jsx)(ct,{className:`size-3`}),s]}),(0,F.jsx)(Le,{className:`rounded-sm px-3 py-1 text-xs hidden`,variant:T.includes(`Error`)?`destructive`:`secondary`,children:T})]}),(0,F.jsxs)(`div`,{className:`flex items-center gap-2`,children:[ee?(0,F.jsx)(E,{onClick:u,type:`button`,variant:`destructive`,children:`Abort`}):null,(0,F.jsx)(H_,{disabled:t||T.includes(`Failed`),status:ee?`submitted`:`ready`,variant:`ghost`})]})]})]})]})})}async function rA(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 iA={lastProvider:``,lastModelByProvider:{}};function aA(){try{let e=C()?.getState();if(e?.modelSelection)return e.modelSelection}catch{}return iA}function oA(e){try{let t=C();if(!t)return;let n=t.getState()??{};t.setState({...n,modelSelection:e})}catch{}}function sA(e){let t=Number.parseInt(e,10);return Number.isInteger(t)&&t>0?t:void 0}function cA(e,t,n){return{id:`${Date.now()}-${Math.random().toString(16).slice(2)}`,role:e,text:t,...n}}function lA(e,t,n=0){let r=n||(t?.userImages?.length??0);return r===0?e:`${e}${e.length>0?`
|
|
200
|
-
|
|
201
|
-
`:``}[attached ${r} file${r===1?``:`s`}]`}function uA(e){if(typeof e==`string`)return e;try{return JSON.stringify(e??null,null,2)}catch{return String(e)}}function dA(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:fA(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:fA(i.blocks,t)}];let a=cA(`assistant`,t,{blocks:[{id:xt(),type:`text`,text:t}]});return n.current=a.id,[...e,a]}function fA(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:xt(),type:`text`,text:t}]}function pA(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:xt(),type:`reasoning`,text:t,redacted:n}]}function mA(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:xt(),type:`tool`,toolEvent:t}]:n.map((e,n)=>n===r&&e.type===`tool`?{...e,toolEvent:{...e.toolEvent,...t}}:e)}function hA(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:pA(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:pA(o.blocks,i,n)}];let s=cA(`assistant`,``,{reasoning:i,reasoningRedacted:n,blocks:[{id:xt(),type:`reasoning`,text:i,redacted:n}]});return r.current=s.id,[...e,s]}function gA(e){return Array.isArray(e)&&e.length>0&&typeof e[0]==`object`&&e[0]!==null&&`result`in e[0]}function _A(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 vA(e,t){return e==null?t:typeof e==`string`?e:JSON.stringify(e,null,2)}function yA(e){if(gA(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=_A(e.input),n=t?`${e.name}: ${t}`:e.name;return[{id:e.id,name:e.name,title:n,state:e.state,output:e.error??vA(e.output,e.text),error:e.error}]}function bA(e){let t=/^Running (.+)\.\.\.$/.exec(e);return t?.[1]?t[1]:/^(.+?) (completed|failed:.*)$/.exec(e)?.[1]??`tool`}function xA(e){return e.includes(`failed:`)?`output-error`:e.endsWith(`completed`)?`output-available`:`input-available`}function SA(e,t){return e?.status===`failed`?`output-error`:e?.status===`completed`?`output-available`:e?.status===`running`?`input-available`:xA(t??``)}function CA(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 wA(e,t,n,r){let i=r.current,a={id:xt(),toolCallId:n?.toolCallId,name:n?.toolName??bA(t),state:SA(n,t),text:t,input:n?.input,output:n?.output,error:n?.error};return i?e.map(e=>e.id===i?{...e,toolEvents:CA(e.toolEvents??[],a),blocks:mA(e.blocks,a)}:e):[...e,cA(`meta`,t,{toolEvents:[a],blocks:[{id:xt(),type:`tool`,toolEvent:a}]})]}function TA(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 EA(e,t){return yA(e).map(e=>(0,F.jsxs)(ok,{className:t,children:[(0,F.jsx)(lk,{state:e.state,title:e.title,type:`dynamic-tool`,toolName:e.name}),(0,F.jsx)(uk,{children:(0,F.jsx)(dk,{errorText:e.error,output:e.output})})]},e.id))}function DA(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 OA(e,t){return(e.blocks?.length?e.blocks:DA(e)).flatMap(e=>{switch(e.type){case`tool`:return e.toolEvent.name.startsWith(`team_`)?[(0,F.jsx)(xk,{className:t.isMeta?`mt-3 w-full`:`mb-3 w-full`,events:[e.toolEvent]},e.id)]:EA(e.toolEvent,t.isMeta?`mt-3`:`mb-3`);case`reasoning`:return[(0,F.jsxs)(ek,{className:t.isMeta?`mt-3`:`mb-3`,defaultOpen:!1,children:[(0,F.jsx)(nk,{}),(0,F.jsx)(rk,{children:e.text})]},e.id)];case`text`:return t.isMeta?[(0,F.jsx)(`pre`,{className:`whitespace-pre-wrap font-inherit`,children:e.text},e.id)]:[(0,F.jsx)(Zf,{children:(0,F.jsx)(Qf,{children:e.text})},e.id)]}return[]})}function kA(e,t,n,r){return[...e,cA(`meta`,`Done (${t}) • iterations=${n} • input=${r?.inputTokens??0} output=${r?.outputTokens??0}`)]}function AA(e){return[e.title?.trim()||e.sessionId.slice(0,12),e.workspaceRoot?.trim()?e.workspaceRoot.trim().split(`/`).pop():void 0].filter(Boolean).join(` • `)}function jA(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 MA({initialSessionId:e,onSessionSelected:t}){let[n,r]=(0,P.useState)([]),[i,a]=(0,P.useState)(`Waiting for RPC initialization...`),[o,s]=(0,P.useState)(),[c,u]=(0,P.useState)(),[d,f]=(0,P.useState)(!1),[p,m]=(0,P.useState)([]),[h,g]=(0,P.useState)({}),[_,v]=(0,P.useState)({workspaceRoot:``,cwd:``}),[y,b]=(0,P.useState)([]),[x,C]=(0,P.useState)(``),[w,T]=(0,P.useState)(aA),[D,O]=(0,P.useState)(()=>w.lastProvider),[k,j]=(0,P.useState)(()=>w.lastModelByProvider[w.lastProvider]??``),[te,ne]=(0,P.useState)(``),[re,M]=(0,P.useState)(``),[ie,ae]=(0,P.useState)(`act`),[se,ce]=(0,P.useState)(`none`),[le,ue]=(0,P.useState)(!0),[de,fe]=(0,P.useState)(!1),[pe,me]=(0,P.useState)(!0),[he,_e]=(0,P.useState)(!0),[ve,ye]=(0,P.useState)([]),[N,be]=(0,P.useState)(!1),[Se,Ce]=(0,P.useState)(!1),[we,Te]=(0,P.useState)(!1),[Ee,De]=(0,P.useState)(null),Oe=(0,P.useRef)(void 0),ke=(0,P.useRef)(void 0),Ae=(0,P.useRef)(void 0),je=(0,P.useRef)(void 0),Me=(0,P.useRef)(t),Ne=(0,P.useRef)(w),Pe=(0,P.useRef)(y),Fe=(0,P.useRef)(_),Ie=(0,P.useCallback)(e=>{Ae.current===e||je.current===e&&!Ae.current||(je.current=e,Ae.current=e,s(e),u(e),r([]),f(!1),ye([]),Oe.current=void 0,a(`Loading chat history for ${e}...`),t?.(e),S({type:`attachSession`,sessionId:e}))},[t]);(0,P.useEffect)(()=>{Ae.current=c},[c]),(0,P.useEffect)(()=>{je.current=o},[o]),(0,P.useEffect)(()=>{Me.current=t},[t]),(0,P.useEffect)(()=>{Pe.current=y},[y]),(0,P.useEffect)(()=>{Fe.current=_},[_]),(0,P.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),Ae.current=void 0,Oe.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,cA(`error`,n)]});return;case`defaults`:v(t.defaults),t.defaults.provider&&O(t.defaults.provider),t.defaults.model&&j(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=aA().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})),j(e=>{if(e&&t.models.some(t=>t.id===e))return e;let n=Fe.current;if(n.provider===t.providerId&&n.model&&t.models.some(e=>e.id===n.model))return n.model;let r=aA().lastModelByProvider[t.providerId];return r&&t.models.some(e=>e.id===r)?r:t.models[0]?.id||``});return;case`session_started`:je.current=t.sessionId,s(t.sessionId),Me.current?.(t.sessionId),Ce(!1),C(``);return;case`session_hydrated`:if(Ae.current&&Ae.current!==t.sessionId)return;if(je.current=t.sessionId,Ae.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:{...Ne.current.lastModelByProvider,[t.providerId]:t.modelId}};Ne.current=e,T(e),oA(e),j(t.modelId)}Ce(!1),C(Pe.current.find(e=>e.sessionId===t.sessionId)?.title?.trim()||``),r(e=>{let n=t.status===`running`?TA(t.messages,e):t.messages;return Oe.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=>dA(e,t.text,Oe));return;case`reasoning_delta`:r(e=>hA(e,t.text,t.redacted,Oe));return;case`tool_event`:r(e=>wA(e,t.text,t.event,Oe));return;case`approval_request`:ye(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`:ye(e=>e.filter(e=>e.approvalId!==t.approvalId));return;case`turn_done`:a(`Done (${t.finishReason})`),f(!1),ye([]),Oe.current=void 0,r(e=>kA(e,t.finishReason,t.iterations,t.usage));return;case`reset_done`:je.current=void 0,Ae.current=void 0,s(void 0),u(void 0),f(!1),ye([]),Ce(!1),C(``),Oe.current=void 0,Me.current?.(void 0),a(`Started a new chat session.`),r([]);return;case`fork_done`:Te(!1),De(null),a(`Forked → new session ${t.newSessionId}`);return;case`fork_error`:Te(!1),De(t.text),a(`Fork failed: ${t.text}`);return}};return window.addEventListener(`message`,e),S({type:`ready`}),()=>{window.removeEventListener(`message`,e)}},[]),(0,P.useEffect)(()=>{!e||ke.current===e||(ke.current=e,Ie(e))},[Ie,e]),(0,P.useEffect)(()=>{D&&S({type:`loadModels`,providerId:D})},[D]),(0,P.useEffect)(()=>{if(!D||!k)return;let e=Ne.current;if(e.lastProvider===D&&e.lastModelByProvider[D]===k)return;let t={lastProvider:D,lastModelByProvider:{...e.lastModelByProvider,[D]:k}};Ne.current=t,T(t),oA(t)},[D,k]);let Le=h[D]??[],Re=!!c,ze=Le.find(e=>e.id===k)?.supportsThinking===!0?se:`none`,Be=(0,P.useMemo)(()=>n.filter(e=>e.role!==`meta`||e.text),[n]),Ve=o&&typeof y.find(e=>e.sessionId===o)?.title==`string`&&y.find(e=>e.sessionId===o)?.title?.trim()||``,He=Se?x:Ve,Ue=()=>{if(!o){Ce(!1);return}let e=x.replace(/\s+/g,` `).trim();Ce(!1),e!==Ve&&(C(e),S({type:`updateSessionMetadata`,sessionId:o,metadata:{title:e}}))},We=(e,t)=>{ye(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,F.jsx)(j_,{children:(0,F.jsxs)(`div`,{className:`relative flex h-screen flex-col overflow-hidden`,children:[(0,F.jsxs)(`div`,{className:`flex items-center justify-between border-b px-4 py-3`,children:[(0,F.jsxs)(`div`,{className:`min-w-0`,children:[y.length>0?(0,F.jsxs)(`select`,{className:`max-w-48 rounded-md border bg-background px-2 py-1 text-xs`,disabled:Re,onChange:e=>{let t=e.target.value;if(!t){S({type:`reset`}),a(`Resetting session...`),ye([]);return}Ie(t)},value:o??``,children:[(0,F.jsx)(`option`,{value:``,children:`New session`}),y.map(e=>(0,F.jsx)(`option`,{value:e.sessionId,children:AA(e)},e.sessionId))]}):null,Re?(0,F.jsxs)(`span`,{className:`ml-2 inline-flex items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,F.jsx)(ge,{className:`size-3 animate-spin`}),`Loading history`]}):null,o?(0,F.jsx)(`input`,{className:`min-w-0 max-w-56 rounded-md border bg-muted px-2 py-1 text-xs`,disabled:Re,onBlur:Ue,onChange:e=>C(e.target.value),onFocus:()=>{Ce(!0),C(Ve)},onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),Ue())},placeholder:`Session title`,value:He}):null,o?(0,F.jsxs)(E,{disabled:Re,onClick:()=>{a(`Deleting ${o}...`),S({type:`deleteSession`,sessionId:o})},size:`icon-sm`,type:`button`,variant:`ghost`,children:[(0,F.jsx)(ee,{className:`size-4`}),(0,F.jsx)(`span`,{className:`sr-only`,children:`Delete session`})]}):null]}),(0,F.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,F.jsxs)(E,{disabled:Re,onClick:()=>{S({type:`reset`}),a(`Resetting session...`),ye([])},size:`icon-sm`,type:`button`,variant:`ghost`,children:[(0,F.jsx)(A,{className:`size-4`}),(0,F.jsx)(`span`,{className:`sr-only`,children:`New chat`})]})})]}),(0,F.jsxs)(zt,{className:`min-h-0 flex-1`,children:[(0,F.jsxs)(Bt,{className:`px-4 py-5`,children:[Re?(0,F.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,F.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,F.jsx)(ge,{className:`size-4 animate-spin`}),`Loading chat history...`]})}):Be.length===0?(0,F.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,Be.map(e=>e.role===`meta`||e.role===`error`?(0,F.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:OA(e,{isMeta:!0})},e.id):(0,F.jsx)(Xf,{from:e.role,children:(0,F.jsxs)(`div`,{children:[OA(e,{sending:d}),e.role===`user`&&e.checkpoint?(0,F.jsx)(Ct,{className:`mt-1 justify-end`,children:(0,F.jsxs)(Tt,{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,F.jsx)(wt,{className:`size-3`}),jA(e.checkpoint.createdAt)]})}):null,e.role===`assistant`&&e.text&&!d?(0,F.jsxs)(`div`,{className:`mt-1 flex items-center gap-1`,children:[(0,F.jsxs)(E,{className:`h-6 gap-1 px-2 text-[11px] text-muted-foreground hover:text-foreground`,disabled:we,onClick:()=>{Te(!0),De(null),S({type:`forkSession`})},size:`sm`,title:`Fork session — copy full message history into a new session`,type:`button`,variant:`ghost`,children:[we?(0,F.jsx)(ge,{className:`size-3 animate-spin`}):(0,F.jsx)(ot,{className:`size-3`}),`Fork`]}),Ee?(0,F.jsx)(`span`,{className:`text-[11px] text-destructive`,children:Ee}):null]}):null]})},e.id))]}),(0,F.jsx)(Vt,{})]}),ve.length>0?(0,F.jsx)(`div`,{className:`grid max-h-72 gap-2 overflow-auto border-t bg-background/95 px-4 py-3`,children:ve.map(e=>(0,F.jsxs)(`div`,{className:`grid gap-2 rounded-lg border bg-card p-3 text-sm`,children:[(0,F.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,F.jsxs)(`div`,{className:`min-w-0`,children:[(0,F.jsx)(`p`,{className:`font-semibold`,children:`Approve tool call?`}),(0,F.jsx)(`p`,{className:`break-all text-muted-foreground text-xs`,children:e.toolName})]}),(0,F.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[(0,F.jsxs)(E,{disabled:e.responding,onClick:()=>We(e.approvalId,!1),size:`sm`,type:`button`,variant:`destructive`,children:[(0,F.jsx)(oe,{className:`size-4`}),`Reject`]}),(0,F.jsxs)(E,{disabled:e.responding,onClick:()=>We(e.approvalId,!0),size:`sm`,type:`button`,children:[e.responding?(0,F.jsx)(ge,{className:`size-4 animate-spin`}):(0,F.jsx)(xe,{className:`size-4`}),`Approve`]})]})]}),(0,F.jsx)(`pre`,{className:`max-h-32 overflow-auto rounded-md border bg-background p-2 text-[11px]`,children:uA(e.input)})]},e.approvalId))}):null,(0,F.jsx)(nA,{autoApproveTools:he,disabled:Re,enableSpawn:de,enableTeams:pe,enableTools:le,maxIterations:re,model:k,mode:ie,modelSelectorOpen:N,models:Le,onAbort:()=>{S({type:`abort`}),a(`Abort requested...`)},onAutoApproveToolsChange:_e,onEnableSpawnChange:fe,onEnableTeamsChange:me,onEnableToolsChange:ue,onModeChange:ae,onMaxIterationsChange:M,onModelChange:j,onModelSelectorOpenChange:be,onProviderChange:e=>{O(e);let t=w.lastModelByProvider[e],n=(h[e]??[]).map(e=>e.id);if(t&&n.includes(t)){j(t);return}j(``)},onSend:({prompt:e,attachments:t,attachmentCount:n})=>{if(Re)return;let i=cA(`assistant`,``);Oe.current=i.id,r(r=>[...r,cA(`user`,lA(e,t,n)),i]),f(!0),a(`Running...`),S({type:`send`,prompt:e,attachments:t,config:{autoApproveTools:he,enableSpawn:de,enableTeams:pe,enableTools:le,maxIterations:sA(re),model:k||void 0,mode:ie,provider:D||void 0,reasonLevel:ze,systemPrompt:te.trim()||void 0}})},onSystemPromptChange:ne,onReasonLevelChange:ce,provider:D,providers:p,sending:d,status:i,systemPrompt:te,reasonLevel:ze,workspaceRoot:_.workspaceRoot})]})})}export{MA as default};
|