PageSourceSearch

https://shadcncraft-ai-chat.vercel.app/_next/static/chunks/0mk0jnz…?dpl=dpl_DoZV5vYcph8WcSRSDSg8AooUcFdA

js shadcncraft-ai-chat.vercel.app collected 2026-10-03 07:41:53 UTC 249,681 bytes, 138 lines download raw bytes

1(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,25661,(e,t,r)=>{"use strict";var n=e.r(73576),a="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},i=n.useState,s=n.useEffect,o=n.useLayoutEffect,l=n.useDebugValue;function u(e){var t=e.getSnapshot;e=e.value;try{var r=t();return!a(e,r)}catch(e){return!0}}var c="u"<typeof window||void 0===window.document||void 0===window.document.createElement?function(e,t){return t()}:function(e,t){var r=t(),n=i({inst:{value:r,getSnapshot:t}}),a=n[0].inst,c=n[1];return o(function(){a.value=r,a.getSnapshot=t,u(a)&&c({inst:a})},[e,r,t]),s(function(){return u(a)&&c({inst:a}),e(function(){u(a)&&c({inst:a})})},[e]),l(r),r};r.useSyncExternalStore=void 0!==n.useSyncExternalStore?n.useSyncExternalStore:c},56032,(e,t,r)=>{"use strict";t.exports=e.r(25661)},61030,(e,t,r)=>{t.exports=function(e,t){let r;if("function"!=typeof e)throw TypeError(`Expected the first argument to be a \`function\`, got \`${typeof e}\`.`);let n=0;return function(...a){clearTimeout(r);let i=Date.now(),s=t-(i-n);s<=0?(n=i,e.apply(this,a)):r=setTimeout(()=>{n=Date.now(),e.apply(this,a)},s)}}},11369,e=>{"use strict";var t=e.i(76350),r=e.i(73576),n=e.i(43836),a=e.i(93956),i=e.i(59586),s=e.i(81004),o=e.i(63275),l=e.i(20763),u=e.i(83431),c=e.i(53838),d=Object.defineProperty,p=(e,t)=>d(e,"name",{value:t,configurable:!0}),h="Collapsible",[f,m]=(0,a.createContextScope)(h),[g,b]=f(h),y=r.forwardRef(p(function(e,n){let{__scopeCollapsible:a,open:s,defaultOpen:o,disabled:u,onOpenChange:d,...p}=e,[f,m]=(0,i.useControllableState)({prop:s,defaultProp:o??!1,onChange:d,caller:h});return(0,t.jsx)(g,{scope:a,disabled:u,contentId:(0,c.useId)(),open:f,onOpenToggle:r.useCallback(()=>m(e=>!e),[m]),children:(0,t.jsx)(l.Primitive.div,{"data-state":C(f),"data-disabled":u?"":void 0,...p,ref:n})})},"Collapsible")),v=r.forwardRef(p(function(e,r){let{__scopeCollapsible:a,...i}=e,s=b("CollapsibleTrigger",a);return(0,t.jsx)(l.Primitive.button,{type:"button","aria-controls":s.open?s.contentId:void 0,"aria-expanded":s.open||!1,"data-state":C(s.open),"data-disabled":s.disabled?"":void 0,disabled:s.disabled,...i,ref:r,onClick:(0,n.composeEventHandlers)(e.onClick,s.onOpenToggle)})},"CollapsibleTrigger")),w="CollapsibleContent",k=r.forwardRef(p(function(e,r){let{forceMount:n,...a}=e,i=b(w,e.__scopeCollapsible);return(0,t.jsx)(u.Presence,{present:n||i.open,children:({present:e})=>(0,t.jsx)(x,{...a,ref:r,present:e})})},"CollapsibleContent")),x=r.forwardRef(p(function(e,n){let{__scopeCollapsible:a,present:i,children:u,...c}=e,d=b(w,a),[p,h]=r.useState(i),f=r.useRef(null),m=(0,o.useComposedRefs)(n,f),g=r.useRef(0),y=g.current,v=r.useRef(0),k=v.current,x=d.open||p,A=r.useRef(x),_=r.useRef(void 0);return r.useEffect(()=>{let e=requestAnimationFrame(()=>A.current=!1);return()=>cancelAnimationFrame(e)},[]),(0,s.useLayoutEffect)(()=>{let e=f.current;if(e){_.current=_.current||{transitionDuration:e.style.transitionDuration,animationName:e.style.animationName},e.style.transitionDuration="0s",e.style.animationName="none";let t=e.getBoundingClientRect();g.current=t.height,v.current=t.width,A.current||(e.style.transitionDuration=_.current.transitionDuration,e.style.animationName=_.current.animationName),h(i)}},[d.open,i]),(0,t.jsx)(l.Primitive.div,{"data-state":C(d.open),"data-disabled":d.disabled?"":void 0,id:d.contentId,hidden:!x,...c,ref:m,style:{"--radix-collapsible-content-height":y?`${y}px`:void 0,"--radix-collapsible-content-width":k?`${k}px`:void 0,...e.style},children:x&&u})},"CollapsibleContentImpl"));function C(e){return e?"open":"closed"}p(C,"getState"),e.s(["Collapsible",0,y,"CollapsibleContent",0,k,"CollapsibleTrigger",0,v,"Content",0,k,"Root",0,y,"Trigger",0,v,"createCollapsibleScope",0,m],25020);var A=e.i(25020),A=A;e.s(["Collapsible",0,function({...e}){return(0,t.jsx)(A.Root,{"data-slot":"collapsible",...e})},"CollapsibleContent",0,function({...e}){return(0,t.jsx)(A.CollapsibleContent,{"data-slot":"collapsible-content",...e})},"CollapsibleTrigger",0,function({...e}){return(0,t.jsx)(A.CollapsibleTrigger,{"data-slot":"collapsible-trigger",...e})}],11369)},94267,e=>{"use strict";let t,r,n,a,i;var s,o,l,u,c,d,p,h,f,m,g,b,y,v=e.i(76350),w=e.i(73576);e.i(89092);var k=e.i(82060),x=e.i(56032);e.s(["ERROR_REVALIDATE_EVENT",0,3,"FOCUS_EVENT",0,0,"MUTATE_EVENT",0,2,"RECONNECT_EVENT",0,1],18486);var C=Object.prototype.hasOwnProperty;let A=new WeakMap,_=()=>{},S=_(),N=Object,E=e=>e===S,I=(e,t)=>({...e,...t}),R={},T={},P="undefined",M=typeof window!=P,j=typeof document!=P,L=M&&"Deno"in window,$=(e,t)=>{let r=A.get(e);return[()=>!E(t)&&e.get(t)||R,n=>
1{if(!E(t)){let a=e.get(t);t in T||(T[t]=a),r[5](t,I(a,n),a||R)}},r[6],()=>!E(t)&&t in T?T[t]:!E(t)&&e.get(t)||R]},O=!0,[B,G]=M&&window.addEventListener?[window.addEventListener.bind(window),window.removeEventListener.bind(window)]:[_,_],D={initFocus:e=>(j&&document.addEventListener("visibilitychange",e),B("focus",e),()=>{j&&document.removeEventListener("visibilitychange",e),G("focus",e)}),initReconnect:e=>{let t=()=>{O=!0,e()},r=()=>{O=!1};return B("online",t),B("offline",r),()=>{G("online",t),G("offline",r)}}},F=!w.default.useId,U=!M||L,q=U?w.useEffect:w.useLayoutEffect,W="u">typeof navigator&&navigator.connection,z=!U&&W&&(["slow-2g","2g"].includes(W.effectiveType)||W.saveData),H=new WeakMap,V=(e,t)=>e===`[object ${t}]`,Q=0,X=e=>{let t,r,n=typeof e,a=N.prototype.toString.call(e),i=V(a,"Date"),s=V(a,"RegExp"),o=V(a,"Object");if(N(e)!==e||i||s)t=i?e.toJSON():"symbol"==n?e.toString():"string"==n?JSON.stringify(e):""+e;else{if(t=H.get(e))return t;if(t=++Q+"~",H.set(e,t),Array.isArray(e)){for(r=0,t="@";r<e.length;r++)t+=X(e[r])+",";H.set(e,t)}if(o){t="#";let n=N.keys(e).sort();for(;!E(r=n.pop());)E(e[r])||(t+=r+":"+X(e[r])+",");H.set(e,t)}}return t},K=e=>{if("function"==typeof e)try{e=e()}catch(t){e=""}let t=e;return[e="string"==typeof e?e:(Array.isArray(e)?e.length:e)?X(e):"",t]},J=0,Z=()=>++J;async function Y(...e){let[t,r,n,a]=e,i=I({populateCache:!0,throwOnError:!0},"boolean"==typeof a?{revalidate:a}:a||{}),s=i.populateCache,o=i.rollbackOnError,l=i.optimisticData,u=i.throwOnError;if("function"==typeof r){let e=[];for(let n of t.keys())!/^\$(inf|sub)\$/.test(n)&&r(t.get(n)._k)&&e.push(n);return Promise.all(e.map(c))}return c(r);async function c(r){let a,[c]=K(r);if(!c)return;let[d,p]=$(t,c),[h,f,m,g]=A.get(t),b=()=>{let e=h[c];return("function"==typeof i.revalidate?i.revalidate(d().data,r):!1!==i.revalidate)&&(delete m[c],delete g[c],e&&e[0])?e[0](2).then(()=>d().data):d().data};if(e.length<3)return b();let y=n,v=!1,w=Z();f[c]=[w,0];let k=!E(l),x=d(),C=x.data,_=x._c,N=E(_)?C:_;if(k&&p({data:l="function"==typeof l?l(N,C):l,_c:N}),"function"==typeof y)try{y=y(N)}catch(e){a=e,v=!0}if(y&&"function"==typeof y.then){let e;if(y=await y.catch(e=>{a=e,v=!0}),w!==f[c][0]){if(v)throw a;return y}v&&k&&(e=a,"function"==typeof o?o(e):!1!==o)&&(s=!0,p({data:N,_c:S}))}if(s&&!v&&("function"==typeof s?p({data:s(y,N),error:S,_c:S}):p({data:y,error:S,_c:S})),f[c][1]=Z(),Promise.resolve(b()).then(()=>{p({_c:S})}),v){if(u)throw a;return}return y}}let ee=(e,t)=>{for(let r in e)e[r][0]&&e[r][0](t)},et=(e,t)=>{if(!A.has(e)){let r=I(D,t),n=Object.create(null),a=Y.bind(S,e),i=_,s=Object.create(null),o=(e,t)=>{let r=s[e]||[];return s[e]=r,r.push(t),()=>{let e=r.indexOf(t);e>=0&&(r[e]=r[r.length-1],r.pop())}},l=(t,r,n)=>{e.set(t,r);let a=s[t];if(a)for(let e of a)e(r,n)},u=()=>{if(!A.has(e)&&(A.set(e,[n,Object.create(null),Object.create(null),Object.create(null),a,l,o]),!U)){let t=r.initFocus(setTimeout.bind(S,ee.bind(S,n,0))),a=r.initReconnect(setTimeout.bind(S,ee.bind(S,n,1)));i=()=>{t&&t(),a&&a(),A.delete(e)}}};return u(),[e,a,u,i]}return[e,A.get(e)[4]]},[er,en]=et(new Map),ea=I({onLoadingSlow:_,onSuccess:_,onError:_,onErrorRetry:(e,t,r,n,a)=>{let i=r.errorRetryCount,s=a.retryCount,o=~~((Math.random()+.5)*(1<<(s<8?s:8)))*r.errorRetryInterval;
1(E(i)||!(s>i))&&setTimeout(n,o,a)},onDiscarded:_,revalidateOnFocus:!0,revalidateOnReconnect:!0,revalidateIfStale:!0,shouldRetryOnError:!0,errorRetryInterval:z?1e4:5e3,focusThrottleInterval:5e3,dedupingInterval:2e3,loadingTimeout:z?5e3:3e3,compare:function e(t,r){var n,a;if(t===r)return!0;if(t&&r&&(n=t.constructor)===r.constructor){if(n===Date)return t.getTime()===r.getTime();if(n===RegExp)return t.toString()===r.toString();if(n===Array){if((a=t.length)===r.length)for(;a--&&e(t[a],r[a]););return -1===a}if(!n||"object"==typeof t){for(n in a=0,t)if(C.call(t,n)&&++a&&!C.call(r,n)||!(n in r)||!e(t[n],r[n]))return!1;return Object.keys(r).length===a}}return t!=t&&r!=r},isPaused:()=>!1,cache:er,mutate:en,fallback:{}},{isOnline:()=>O,isVisible:()=>{let e=j&&document.visibilityState;return E(e)||"hidden"!==e}}),ei=(0,w.createContext)({});e.i(18486);let es=M&&window.__SWR_DEVTOOLS_USE__;(es?window.__SWR_DEVTOOLS_USE__:[]).concat(e=>(t,r,n)=>{let a=r&&((...e)=>{let[n]=K(t),[,,,a]=A.get(er);if(n.startsWith("$inf$"))return r(...e);let i=a[n];return E(i)?r(...e):(delete a[n],i)});return e(t,a,n)}),es&&(window.__SWR_DEVTOOLS_REACT__=w.default);let eo=()=>{},el=eo(),eu=(new WeakMap,w.default.use||(e=>{switch(e.status){case"pending":throw e;case"fulfilled":return e.value;case"rejected":throw e.reason;default:throw e.status="pending",e.then(t=>{e.status="fulfilled",e.value=t},t=>{e.status="rejected",e.reason=t}),e}})),ec={dedupe:!0},ed=Promise.resolve(S);ed.status="fulfilled",ed.value=S;N.defineProperty(e=>{let{value:t}=e,r=(0,w.useContext)(ei),n="function"==typeof t,a=(0,w.useMemo)(()=>n?t(r):t,[n,r,t]),i=(0,w.useMemo)(()=>n?a:((e,t)=>{let r=I(e,t);if(t){let{use:n,fallback:a}=e,{use:i,fallback:s}=t;n&&i&&(r.use=n.concat(i)),a&&s&&(r.fallback=I(a,s))}return r})(r,a),[n,r,a]),s=a&&a.provider,o=(0,w.useRef)(S);s&&!o.current&&(o.current=et(s(i.cache||er),a));let l=o.current;return l&&(i.cache=l[0],i.mutate=l[1]),q(()=>{if(l)return l[2]&&l[2](),l[3]},[]),(0,w.createElement)(ei.Provider,I(e,{value:i}))},"defaultValue",{value:ea});var ep=e.i(61030);e.i(41417);var eh=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)},ef=(e,t,r)=>(eh(e,t,"read from private field"),r?r.call(e):t.get(e)),em=(e,t,r)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,r)},eg=(e,t,r,n)=>(eh(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),eb=class{constructor(e=[]){em(this,u,void 0),em(this,c,"ready"),em(this,d,void 0),em(this,p,new Set),em(this,h,new Set),em(this,f,new Set),this.pushMessage=e=>{eg(this,u,ef(this,u).concat(e)),ef(this,m).call(this)},this.popMessage=()=>{eg(this,u,ef(this,u).slice(0,-1)),ef(this,m).call(this)},this.replaceMessage=(e,t)=>{eg(this,u,[...ef(this,u).slice(0,e),this.snapshot(t),...ef(this,u).slice(e+1)]),ef(this,m).call(this)},this.snapshot=e=>structuredClone(e),this["~registerMessagesCallback"]=(e,t)=>{let r=t?null!=t?(0,ep.default)(e,t):e:e;return ef(this,p).add(r),()=>{ef(this,p).delete(r)}},this["~registerStatusCallback"]=e=>(ef(this,h).add(e),()=>{ef(this,h).delete(e)}),this["~registerErrorCallback"]=e=>(ef(this,f).add(e),()=>{ef(this,f).delete(e)}),em(this,m,()=>{ef(this,p).forEach(e=>e())}),em(this,g,()=>{ef(this,h).forEach(e=>e())}),em(this,b,()=>{ef(this,f).forEach(e=>e())}),eg(this,u,e)}get status(){return ef(this,c)}set status(e){eg(this,c,e),ef(this,g).call(this)}get error(){return ef(this,d)}set error(e){eg(this,d,e),ef(this,b).call(this)}get messages(){return ef(this,u)}set messages(e){eg(this,u,[...e]),ef(this,m).call(this)}};u=new WeakMap,c=new WeakMap,d=new WeakMap,p=new WeakMap,h=new WeakMap,f=new WeakMap,m=new WeakMap,g=new WeakMap,b=new WeakMap;var ey=class extends k.AbstractChat{constructor({messages:e,...t}){const r=new eb(e);super({...t,state:r}),em(this,y,void 0),this["~registerMessagesCallback"]=(e,t)=>ef(this,y)["~registerMessagesCallback"](e,t),this["~registerStatusCallback"]=e=>ef(this,y)["~registerStatusCallback"](e),this["~registerErrorCallback"]=e=>ef(this,y)["~registerErrorCallback"](e),eg(this,y,r)}};y=new WeakMap,k.Experimental_AbstractRealtimeSession;var ev=e.i(49877),ew=e.i(60112),ek=e.i(94237),ex=e.i(8574),eC=e.i(47163);let eA=(0,ek.cva)("group/bubble relative flex w-fit max-w-[80%] min-w-0 flex-col gap-1 group-data-[align=end]/message:self-end data-[align=end]:self-end data-[variant=ghost]:max-w-full",{variants:{variant:{default:"*:data-[slot=bubble-content]:bg-primary *:data-[slot=bubble-content]:text-primary-foreground [&>[data-slot=bubble-content]:is(button,a):hover]:bg-primary/80",secondary:"*:data-[slot=bubble-content]:bg-secondary *:data-[slot=bubble-content]:text-secondary-foreground [&>[data-slot=bubble-content]:is(button,a):hover]:bg-[color-mix(in_oklch,var(--secondary),var(--foreground)_5%)]",muted:"*:data-[slot=bubble-content]:bg-muted [&>[data-slot=bubble-content]:is(button,a):hover]:bg-[color-mix(in_oklch,var(--muted),var(--foreground)_5%)]",tinted:"*:data-[slot=bubble-content]:bg-[oklch(from_var(--primary)_0.93_calc(c*0.4)_h)] *:data-[slot=bubble-content]:text-foreground dark:*:data-[slot=bubble-content]:bg-[oklch(from_var(--primary)_0.3_calc(c*0.4)_h)] [&>[data-slot=bubble-content]:is(button,a):hover]:bg-[oklch(from_var(--primary)_0.88_calc(c*0.5)_h)] dark:[&>[data-slot=bubble-content]:is(button,a):hover]:bg-[oklch(from_var(--primary)_0.35_calc(c*0.5)_h)]",outline:"*:data-[slot=bubble-content]:border-border *:data-[slot=bubble-content]:bg-background [&>[data-slot=bubble-content]:is(button,a):hover]:bg-muted [&>[data-slot=bubble-content]:is(button,a):hover]:text-foreground dark:[&>[data-slot=bubble-content]:is(button,a):hover]:bg-input/30",ghost:"border-none *:data-[slot=bubble-content]:rounded-none *:data-[slot=bubble-content]:bg-transparent *:data-[slot=bubble-content]:p-0 [&>[data-slot=bubble-content]:is(button,a):hover]:bg-muted [&>[data-slot=bubble-content]:is(button,a):hover]:text-foreground dark:[&>
1[data-slot=bubble-content]:is(button,a):hover]:bg-muted/50",destructive:"*:data-[slot=bubble-content]:bg-destructive/10 *:data-[slot=bubble-content]:text-destructive dark:*:data-[slot=bubble-content]:bg-destructive/20 [&>[data-slot=bubble-content]:is(button,a):hover]:bg-destructive/20 dark:[&>[data-slot=bubble-content]:is(button,a):hover]:bg-destructive/30"}},defaultVariants:{variant:"default"}});function e_({variant:e="default",align:t="start",className:r,...n}){return(0,v.jsx)("div",{"data-slot":"bubble","data-variant":e,"data-align":t,className:(0,eC.cn)(eA({variant:e}),r),...n})}function eS({asChild:e=!1,className:t,...r}){let n=e?ex.Slot.Root:"div";return(0,v.jsx)(n,{"data-slot":"bubble-content",className:(0,eC.cn)("w-fit max-w-full min-w-0 overflow-hidden rounded-xl border border-transparent px-3 py-2 text-sm leading-relaxed wrap-break-word group-data-[align=end]/bubble:self-end [button]:text-left [button,a]:transition-colors [button,a]:outline-none [button,a]:focus-visible:border-ring [button,a]:focus-visible:ring-3 [button,a]:focus-visible:ring-ring/50",t),...r})}(0,ek.cva)("absolute z-10 flex w-fit shrink-0 items-center justify-center gap-1 rounded-full bg-muted px-1.5 py-0.5 text-sm ring-3 ring-card has-[button]:p-0",{variants:{side:{top:"top-0 -translate-y-3/4",bottom:"bottom-0 translate-y-3/4"},align:{start:"left-3",end:"right-3"}},defaultVariants:{side:"bottom",align:"end"}});var eN=e.i(67881);function eE({className:e,align:t="start",...r}){return(0,v.jsx)("div",{"data-slot":"message","data-align":t,className:(0,eC.cn)("group/message relative flex w-full min-w-0 gap-2 text-sm data-[align=end]:flex-row-reverse",e),...r})}function eI({className:e,...t}){return(0,v.jsx)("div",{"data-slot":"message-content",className:(0,eC.cn)("flex w-full min-w-0 flex-col gap-2.5 wrap-break-word group-data-[align=end]/message:*:data-slot:self-end",e),...t})}function eR({className:e,...t}){return(0,v.jsx)("div",{"data-slot":"message-footer",className:(0,eC.cn)("flex max-w-full min-w-0 items-center px-3 text-xs font-medium text-muted-foreground group-has-data-[variant=ghost]/message:px-0 group-data-[align=end]/message:justify-end",e),...t})}var eT=e.i(51324),eP=e.i(787),eM=e.i(44215),ej=e.i(29634),eL=e.i(85460);let e$=(0,ek.cva)("group/marker relative flex min-h-4 w-full items-center gap-2 text-left text-sm text-muted-foreground [&_svg:not([class*='size-'])]:size-4 [a]:underline [a]:underline-offset-3 [a]:hover:text-foreground",{variants:{variant:{default:"",separator:"before:mr-1 before:h-px before:min-w-0 before:flex-1 before:bg-border after:ml-1 after:h-px after:min-w-0 after:flex-1 after:bg-border",border:"border-b border-border pb-2"}}});function eO({className:e,variant:t="default",asChild:r=!1,...n}){let a=r?ex.Slot.Root:"div";return(0,v.jsx)(a,{"data-slot":"marker","data-variant":t,className:(0,eC.cn)(e$({variant:t,className:e})),...n})}function eB({className:e,...t}){return(0,v.jsx)("span",{"data-slot":"marker-icon","aria-hidden":"true",className:(0,eC.cn)("size-4 shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...t})}function eG({className:e,...t}){return(0,v.jsx)("span",{"data-slot":"marker-content",className:(0,eC.cn)("min-w-0 wrap-break-word group-data-[variant=separator]/marker:flex-none group-data-[variant=separator]/marker:text-center *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground",e),...t})}function eD({defaultTagName:e,props:t,render:r,state:n={},stateAttributesMapping:a}){let i=eF(function(e,t){let r={};for(let n of Object.keys(e)){let a=e[n],i=t?.[n]?.(a);if(i){Object.assign(r,i);continue}if("slot"===n){r["data-slot"]=a;continue}let s=`data-${String(n).replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)}`;"boolean"==typeof a?r[s]=a?"":void 0:null!=a&&(r[s]=String(a))}return r}(n,a),t);if(!r)return w.createElement(e,i);if("function"==typeof r)return r(i,n);if(!w.isValidElement(r))return null;let s=r.props,o={...eF(i,s),ref:eU(i.ref,s.ref)};return w.cloneElement(r,o)}function eF(...e){let t={};for(let n of e)if(n)for(let e of Object.keys(n)){var r;let a=n[e];if(void 0===a)continue;let i=t[e];
1"className"===e?t[e]=[i,a].filter(Boolean).join(" "):"style"===e?t[e]={...i,...a}:"ref"===e?t[e]=eU(i,a):(r=e,/^on[A-Z]/.test(r)&&"function"==typeof i&&"function"==typeof a)?t[e]=function(e,t){return function(r){e(r),r.defaultPrevented||t(r)}}(a,i):t[e]=a}return t}function eU(...e){let t=e.filter(Boolean);if(0!==t.length)return e=>{for(let r of t)"function"==typeof r?r(e):r&&(r.current=e)}}var eq=new Set(["ArrowDown","ArrowUp","End","Home","PageDown","PageUp"," "]),eW={start:!1,end:!1},ez={currentAnchorId:null,visibleMessageIds:[]};function eH(e,t){return Array.from(e.children).filter(e=>e instanceof HTMLElement&&e!==t)}function eV(e,t){let r=e.getBoundingClientRect(),n=t.getBoundingClientRect();return r.top-n.top+t.scrollTop}function eQ(e,t){return e.getBoundingClientRect().top-t.getBoundingClientRect().top}function eX({content:e,spacer:t,viewport:r}){let n=eH(e,t),a=eK(e),i=r.getBoundingClientRect(),s=r.scrollTop,o=a.start+a.end;for(let e of n)o=Math.max(o,e.getBoundingClientRect().bottom-i.top+s+a.end);return o}function eK(e){let t=window.getComputedStyle(e);return{end:eJ(t.paddingBlockEnd||t.paddingBottom),start:eJ(t.paddingBlockStart||t.paddingTop)}}function eJ(e){if(!e)return 0;let t=Number.parseFloat(e);return Number.isFinite(t)?t:0}function eZ(e,t){let r=e,n=new Set;return{getSnapshot:()=>r,hasListeners:()=>n.size>0,setSnapshot:e=>{t(r,e)||(r=e,n.forEach(e=>e()))},subscribe:(e,t,r)=>{let a=0===n.size;return n.add(e),a&&t?.(),()=>{n.delete(e),0===n.size&&r?.()}}}}function eY(e,t){return e.start===t.start&&e.end===t.end}function e0(e,t){return e.currentAnchorId===t.currentAnchorId&&e.visibleMessageIds.length===t.visibleMessageIds.length&&e.visibleMessageIds.every((e,r)=>e===t.visibleMessageIds[r])}function e1(e,t){return w.useCallback(r=>{e.current=r,r&&t()},[e,t])}var e2=w.createContext(null),e5=w.createContext(null);function e3(){let e=w.useContext(e2);if(!e)throw Error("useMessageScroller must be used within a MessageScroller.");return e}var e6=function({autoScroll:e=!1,children:t,defaultScrollPosition:r="end",scrollEdgeThreshold:n,scrollPreviousItemPeek:a,scrollMargin:i}){let{context:s,registerMessage:o}=function({autoScroll:e=!1,defaultScrollPosition:t="end",scrollEdgeThreshold:r=8,scrollPreviousItemPeek:n=64,scrollMargin:a=0}){let i=function({autoScroll:e,scrollEdgeThreshold:t,scrollMargin:r,scrollPreviousItemPeek:n}){let a=w.useRef(e),i=w.useRef(!1),s=w.useRef(null),o=w.useRef(!1),l=w.useRef(t),u=w.useRef(0),c=w.useRef(null),d=w.useRef(0),p=w.useRef(e?"following-bottom":"free-scrolling"),h=w.useRef(new Map),f=w.useRef(null),m=w.useRef(null),g=w.useRef(null),b=w.useRef(n),y=w.useRef(!0),v=w.useRef(null),k=w.useRef(r),x=w.useRef(null),C=w.useRef(0),A=w.useRef(0),_=w.useRef(null),S=w.useRef(null),N=w.useRef(null),E=w.useRef(null),I=w.useRef(null),R=w.useRef(null),T=w.useRef(null),P=w.useRef(null),M=w.useRef(new Set),j=w.useRef(new WeakSet);return null===N.current&&(N.current=eZ(eW,eY)),null===P.current&&(P.current=eZ(ez,e0)),a.current=e,l.current=t,k.current=r,b.current=n,{autoScrollRef:a,autoscrollingRef:i,autoscrollingTimeoutRef:E,streamingTurnRef:g,contentRef:s,defaultScrollPositionAppliedRef:o,firstItemRef:c,itemCountRef:u,lastScrollTopRef:d,messageElementsRef:h,modeRef:p,pendingScrollFrameRef:x,pendingScrollToMessageRef:f,prependRestoreRef:m,preserveScrollOnPrependRef:y,rootRef:v,scrollEdgeThresholdRef:l,scrollMarginRef:k,scrollPreviousItemPeekRef:b,spacerGapRef:C,spacerHeightRef:A,spacerRef:_,stateFrameRef:S,stateStore:N.current,viewportRef:I,visibilityFrameRef:R,visibilityObserverRef:T,visibilityStore:P.current,visibleMessageIdsRef:M,handledScrollAnchorsRef:j}}({autoScroll:e,scrollEdgeThreshold:r,scrollMargin:a,scrollPreviousItemPeek:n}),{streamingTurnRef:s,autoScrollRef:o,autoscrollingRef:l,autoscrollingTimeoutRef:u,contentRef:c,defaultScrollPositionAppliedRef:d,firstItemRef:p,itemCountRef:h,lastScrollTopRef:f,messageElementsRef:m,modeRef:g,pendingScrollFrameRef:b,pendingScrollToMessageRef:y,prependRestoreRef:v,preserveScrollOnPrependRef:k,rootRef:x,scrollEdgeThresholdRef:C,scrollMarginRef:A,scrollPreviousItemPeekRef:_,spacerGapRef:S,spacerHeightRef:N,spacerRef:E,stateFrameRef:I,stateStore:R,viewportRef:T,visibilityFrameRef:P,visibilityObserverRef:M,visibilityStore:j,visibleMessageIdsRef:L,handledScrollAnchorsRef:$}=i,O=w.useRef(t);O.current!==t&&(O.current=t,d.current=!1);let B=w.useCallback(e=>{let t=x.current,r=T.current,n=[e.start&&"start",e.end&&"end"].filter(
1Boolean).join(" "),a=l.current;for(let e of[t,r])e&&(n?e.setAttribute("data-scrollable",n):e.removeAttribute("data-scrollable"),e.toggleAttribute("data-autoscrolling",a))},[]),G=w.useCallback(e=>{let t=T.current?.scrollTop??0,r=t<f.current-.5;f.current=t,o.current&&!e.end&&"settling-jump"!==g.current&&"anchored-to-message"!==g.current?g.current="following-bottom":"following-bottom"===g.current&&e.end&&r&&!l.current&&(g.current="free-scrolling")},[]),D=w.useCallback(()=>{let e=function({content:e,scrollEdgeThreshold:t,spacer:r,viewport:n}){if(!n||!e)return eW;let a=eX({content:e,spacer:r,viewport:n});return{start:n.scrollTop>t,end:a-n.scrollTop-n.clientHeight>t}}({content:c.current,scrollEdgeThreshold:C.current,spacer:E.current,viewport:T.current});G(e);let t="following-bottom"===g.current?{...e,end:!1}:e;B(t),R.setSnapshot(t)},[G,R,B]),F=w.useCallback(()=>{null===I.current&&(I.current=window.requestAnimationFrame(()=>{I.current=null,D()}))},[D]),U=w.useCallback(()=>{j.hasListeners()&&null===P.current&&(P.current=window.requestAnimationFrame(()=>{P.current=null,j.hasListeners()&&j.setSnapshot(function({content:e,scrollMargin:t,scrollPreviousItemPeek:r,spacer:n,viewport:a,visibleMessageIds:i}){if(!e||!a)return ez;let s=a.getBoundingClientRect(),o=s.top+t+r,l=typeof IntersectionObserver>"u",u=[],c=null;for(let t of eH(e,n)){let e=t.dataset.messageId;if(!e)continue;let r="true"===t.dataset.scrollAnchor,n=r||l?t.getBoundingClientRect():null;(l&&n?n.bottom>o&&n.top<s.bottom:i.has(e))&&u.push(e),r&&n&&n.top<=o+.5&&(c=e)}return 0===u.length&&null===c?ez:{currentAnchorId:c,visibleMessageIds:u}}({content:c.current,scrollMargin:A.current,scrollPreviousItemPeek:_.current,spacer:E.current,viewport:T.current,visibleMessageIds:L.current}))}))},[j]),{flushPendingScrollToMessage:q,reanchorToAnchoredMessage:W,scrollToElement:z,scrollToEnd:H,scrollToMessage:V,scrollToStart:Q}=function({refs:e,commitScrollState:t,scheduleStateCommit:r,scheduleVisibilitySync:n}){let{streamingTurnRef:a,autoScrollRef:i,autoscrollingRef:s,autoscrollingTimeoutRef:o,contentRef:l,defaultScrollPositionAppliedRef:u,itemCountRef:c,messageElementsRef:d,modeRef:p,pendingScrollToMessageRef:h,prependRestoreRef:f,scrollMarginRef:m,scrollPreviousItemPeekRef:g,spacerGapRef:b,spacerHeightRef:y,spacerRef:v,viewportRef:k}=e,x=w.useCallback(e=>{null!==o.current&&(window.clearTimeout(o.current),o.current=null),s.current!==e&&(s.current=e,t()),e&&(o.current=window.setTimeout(()=>{o.current=null,s.current=!1,t()},180))},[t]),C=w.useCallback(e=>{let t=v.current;if(!t)return;let r=Math.max(0,Math.ceil(e));y.current!==r&&(y.current=r,t.hidden=0===r,t.style.height=`${r}px`,t.style.marginTop=r>0?`${-b.current}px`:"")},[]),A=w.useCallback((e,{behavior:n="auto",autoscrolling:a=!1}={})=>{let i=k.current;if(!i)return;let s=Math.max(0,e);if(.5>=Math.abs(i.scrollTop-s)){i.scrollTop=s,t();return}a&&x(!0),i.scrollTo({top:s,behavior:n}),r()},[t,r,x]),_=w.useCallback(({behavior:e="auto"}={})=>!!k.current&&(C(0),a.current=null,p.current="free-scrolling",A(0,{behavior:e}),n(),!0),[n,A,C]),S=w.useCallback(({behavior:e="auto"}={})=>{let t=k.current;return!!t&&(C(0),a.current=null,p.current=i.current?"following-bottom":"free-scrolling",A(Math.max(0,t.scrollHeight-t.clientHeight),{autoscrolling:!0,behavior:e}),n(),!0)},[n,A,C]),N=w.useCallback((e,{align:t="start",behavior:r="auto",scrollMargin:i=m.current}={},{keepPreviousPeek:s=!1}={})=>{let o=l.current,u=k.current;if(!o||!u||!o.contains(e))return!1;let c=function({align:e,element:t,scrollMargin:r,spacer:n,viewport:a}){var i;let s,o=eV(t,a),l=t.getBoundingClientRect().height,u=(i=n,(s=i?.parentElement)?eK(s):{end:0,start:0});if("center"===e){let e=Math.max(0,a.clientHeight-u.start-u.end);return o-u.start-(e-l)/2-r}if("end"===e)return o-a.clientHeight+l+u.end+r;if("nearest"===e){let e=o+l,t=a.scrollTop+u.start,n=a.scrollTop+a.clientHeight-u.end;return o>=t&&e<=n?a.scrollTop:o<t?o-u.start-r:e-a.clientHeight+u.end+r}return o-u.start-r}({align:t,element:e,scrollMargin:s?i+g.current:i,spacer:v.current,viewport:u});return C(function({content:e,scrollTop:t,spacer:r,viewport:n}){let a=eX({content:e,spacer:r,viewport:n});return t+n.clientHeight-a}({content:o,scrollTop:c,spacer:v.current,viewport:u})),f.current={element:e,viewportTop:eQ(e,u)},p.current=s?"anchored-to-message":"settling-jump",a.current=s?e:null,A(c,{behavior:r}),n(),!0},[n,A,C]),E=w.useCallback(()=>{let e=a.current;return!!e&&!!e.isConnected&&"anchored-to-message"===p.current&&N(e,{align:"start"},{keepPreviousPeek:!0})},[N]),I=w.useCallback((e,t)=>{let r=d.current.get(e);return r?(u.current=!0,N(r,t)?h.current=null:h.current={messageId:e,options:t},!0):0===c.current&&(h.current={messageId:e,options:t},u.current=!0,!0)},[N]);return{flushPendingScrollToMessage:w.useCallback(()=>{let e=h.current;if(!e)return!1;let t=d.current.get(e.messageId);return!!t&&!!N(t,e.options)&&(h.current=null,u.current=!0,!0)},[N]),reanchorToAnchoredMessage:E,scrollToElement:N,scrollToEnd:S,scrollToMessage:I,scrollToStart:_}}({refs:i,commitScrollState:D,scheduleStateCommit:F,scheduleVisibilitySync:U}),X=w.useCallback(()=>{let e=v.current,t=T.current;if(!e||!t||!e.element.isConnected)return!1;let r=eQ(e.element,t)-e.viewportTop;return!(.5>=Math.abs(r))&&(t.scrollTop+=r,e.viewportTop=eQ(e.element,t),F(),U(),!0)},[F,U]),K=w.useCallback(()=>
1{let e=c.current,t=T.current;if(!e||!t){v.current=null;return}let r=function({content:e,spacer:t,viewport:r}){let n=r.getBoundingClientRect();for(let r of eH(e,t)){if(!r.dataset.messageId)continue;let e=r.getBoundingClientRect();if(e.bottom>n.top&&e.top<n.bottom)return r}return null}({content:e,spacer:E.current,viewport:t});v.current=r?{element:r,viewportTop:eQ(r,t)}:null},[]),J=w.useCallback(()=>{null===b.current&&(b.current=window.requestAnimationFrame(()=>{b.current=null,q()&&K()}))},[K,q]),Z=w.useCallback(()=>{if(!t||d.current||0===h.current)return!1;let e=!1;if("last-anchor"===t){let t=c.current,r=T.current,n=t&&r?function(e){for(let t=e.length-1;t>=0;t--){let r=e[t];if(r?.dataset.scrollAnchor==="true")return r}return null}(eH(t,E.current)):null;if(t&&r&&n){let a=eV(n,r);e=eX({content:t,spacer:E.current,viewport:r})-a<=r.clientHeight?H({behavior:"auto"}):z(n,{align:"start"},{keepPreviousPeek:!0})}else e=H({behavior:"auto"})}else e="end"===t?H({behavior:"auto"}):Q({behavior:"auto"});return!!e&&(d.current=!0,!0)},[t,z,H,Q]),Y=w.useCallback(()=>{let e=c.current;if(!e)return;let t=eH(e,E.current),r=h.current,n=p.current;h.current=t.length,p.current=t[0]??null,(()=>{if(q())return;if(0===r){if(Z()||t.length>0&&o.current&&H({behavior:"auto"}))return;D(),U();return}let e=n?t.indexOf(n):-1;if(k.current&&e>0)return X();if(t.length>r){let e=function(e,t){for(let r=t;r<e.length;r++){let t=e[r];if(t?.dataset.scrollAnchor==="true")return t}return null}(t,r);if(e)return o.current&&"following-bottom"===g.current&&function(e,t){let r=0;for(let n=t;n<e.length;n++)if(e[n]?.dataset.scrollAnchor==="true"&&(r+=1)>1)return!0;return!1}(t,r)?H({behavior:"auto"}):(z(e,{align:"start"},{keepPreviousPeek:!0}),$.current.add(e))}if(t.length===r){let e=function(e,t){for(let r of e)if("true"===r.dataset.scrollAnchor&&!t.has(r))return r;return null}(t,$.current);if(e){z(e,{align:"start"},{keepPreviousPeek:!0}),$.current.add(e);return}}"following-bottom"===g.current&&o.current?H({behavior:"auto"}):(D(),U())})(),K()},[Z,K,D,q,X,U,z,H]),ee=w.useCallback(()=>{if("following-bottom"===g.current&&o.current)return void H({behavior:"auto"});let e=N.current;if(W()){o.current&&e>0&&0===N.current&&H({behavior:"auto"});return}F(),U()},[W,F,U,H]),et=w.useCallback(()=>{let e=T.current;if(!(!e||!j.hasListeners())){if(typeof IntersectionObserver>"u")return void U();M.current||(M.current=new IntersectionObserver(e=>{for(let t of e){let e=t.target.dataset.messageId;e&&(t.isIntersecting?L.current.add(e):L.current.delete(e))}U()},{root:e,rootMargin:`${-(A.current+_.current)}px 0px 0px 0px`,threshold:[0,.01,.5,1]})),m.current.forEach(e=>{M.current?.observe(e)}),U()}},[U,j]),er=w.useCallback(()=>{null!==P.current&&(window.cancelAnimationFrame(P.current),P.current=null),M.current?.disconnect(),M.current=null,L.current.clear(),j.setSnapshot(ez)},[j]),en=w.useCallback((e,t,r)=>{if(t){m.current.set(e,t),M.current?.observe(t),U(),y.current?.messageId===e&&J();return}r&&m.current.get(e)===r&&(m.current.delete(e),L.current.delete(e),M.current?.unobserve(r),U())},[J,U]),ea=w.useCallback(()=>{("following-bottom"===g.current||"anchored-to-message"===g.current||"settling-jump"===g.current)&&(s.current=null,g.current="free-scrolling")},[]),ei=w.useCallback(()=>B(R.getSnapshot()),[R,B]),es=e1(x,ei),eo=e1(T,ei),el=w.useCallback(e=>{c.current=e},[]),eu=w.useCallback(e=>{E.current=e,S.current=function(e){if(!e)return 0;let t=window.getComputedStyle(e);return eJ("normal"===t.rowGap?t.gap:t.rowGap)}(e?.parentElement??null)},[]),ec=w.useCallback(()=>{D(),U(),K()},[K,D,U]),ed=w.useMemo(()=>({handleContentChange:Y,handleResize:ee,observeVisibility:et,preserveScrollOnPrependRef:k,scrollToEnd:H,scrollToMessage:V,scrollToStart:Q,setContentElement:el,setRootElement:es,setSpacerElement:eu,setViewportElement:eo,stateStore:R,syncAfterScroll:ec,unobserveVisibility:er,userScrollIntent:ea,viewportRef:T,visibilityStore:j}),[Y,ee,et,H,V,Q,el,es,eu,eo,R,ec,er,ea,j]);return w.useLayoutEffect(()=>{Z()},[Z]),w.useEffect(()=>()=>{null!==I.current&&(window.cancelAnimationFrame(I.current),I.current=null),null!==P.current&&(window.cancelAnimationFrame(P.current),P.current=null),null!==u.current&&(window.clearTimeout(u.current),u.current=null),null!==b.current&&(window.cancelAnimationFrame(b.current),b.current=null),M.current?.disconnect(),M.current=null},[]),w.useLayoutEffect(()=>{e&&"following-bottom"===g.current&&h.current>0?H({behavior:"auto"}):D()}
1,[e,D,H]),{context:ed,registerMessage:en}}({autoScroll:e,defaultScrollPosition:r,scrollEdgeThreshold:n,scrollPreviousItemPeek:a,scrollMargin:i});return(0,v.jsx)(e2.Provider,{value:s,children:(0,v.jsx)(e5.Provider,{value:o,children:t})})},e8=function({children:e,...t}){let{setRootElement:r}=e3();return(0,v.jsx)("div",{ref:r,...t,children:e})},e4=function({"aria-label":e,children:t,onKeyDown:r,onScroll:n,onTouchMove:a,onWheel:i,preserveScrollOnPrepend:s=!0,ref:o,role:l,tabIndex:u,...c}){let{handleResize:d,preserveScrollOnPrependRef:p,setViewportElement:h,syncAfterScroll:f,userScrollIntent:m,viewportRef:g}=e3();p.current=s;let b=w.useCallback(e=>{h(e),eU(o)?.(e)},[o,h]);return w.useEffect(()=>{let e=g.current;if(!e||typeof ResizeObserver>"u")return;let t=0,r=new ResizeObserver(()=>{window.cancelAnimationFrame(t),t=window.requestAnimationFrame(d)});return r.observe(e),()=>{window.cancelAnimationFrame(t),r.disconnect()}},[d,g]),(0,v.jsx)("div",{ref:b,role:l??"region","aria-label":e??"Messages",tabIndex:u??0,onKeyDown:function(e){eq.has(e.key)&&m(),r?.(e)},onScroll:function(e){f(),n?.(e)},onTouchMove:function(e){m(),a?.(e)},onWheel:function(e){m(),i?.(e)},...c,children:t})},e7=function({"aria-relevant":e,children:t,ref:r,role:n,spacerClassName:a,...i}){let{handleContentChange:s,handleResize:o,setContentElement:l,setSpacerElement:u}=e3(),c=w.useRef(null),d=w.useCallback(e=>{c.current=e,l(e),eU(r)?.(e)},[r,l]);return w.useLayoutEffect(()=>{let e=c.current;if(!e||(s(),typeof MutationObserver>"u"))return;let t=new MutationObserver(()=>{s()});return t.observe(e,{childList:!0}),()=>t.disconnect()},[s]),w.useEffect(()=>{let e=c.current;if(!e||typeof ResizeObserver>"u")return;let t=0,r=new ResizeObserver(()=>{window.cancelAnimationFrame(t),t=window.requestAnimationFrame(o)});return r.observe(e),()=>{window.cancelAnimationFrame(t),r.disconnect()}},[o]),(0,v.jsxs)("div",{ref:d,role:n??"log","aria-relevant":e??"additions",...i,children:[t,(0,v.jsx)("div",{ref:u,"aria-hidden":"true","data-message-scroller-spacer":"",hidden:!0,className:a})]})},e9=function({messageId:e,ref:t,scrollAnchor:r=!1,...n}){let a=function(){let e=w.useContext(e5);if(!e)throw Error("MessageScrollerItem must be used within a MessageScroller.");return e}(),i=w.useRef(null),s=w.useCallback(r=>{let n=i.current;i.current=r,e&&a(e,r,n),eU(t)?.(r)},[e,t,a]);return(0,v.jsx)("div",{ref:s,"data-message-id":e,"data-scroll-anchor":r?"true":"false",...n})},te=function({behavior:e="smooth",children:t,direction:r="end",onClick:n,render:a,tabIndex:i,type:s="button",...o}){let l,{scrollToEnd:u,scrollToStart:c,stateStore:d}=e3(),p=((l=w.useRef(n)).current=n,l),h=w.useCallback(e=>d.subscribe(e),[d]),f=w.useCallback(()=>{let e=d.getSnapshot();return"start"===r?e.start:e.end},[r,d]),m=w.useSyncExternalStore(h,f,f),g=w.useCallback(t=>{m&&(p.current?.(t),t.defaultPrevented||(t.currentTarget.blur(),"start"===r?c({behavior:e}):u({behavior:e})))},[e,r,m,p,u,c]);return eD({defaultTagName:"button",props:eF({type:s,inert:!m,tabIndex:m?i:-1,children:t??(0,v.jsxs)("span",{children:["Scroll to ",r]}),onClick:g},o),render:a,state:{active:m,direction:r},stateAttributesMapping:{active:e=>({"data-active":e?"true":"false"})}})},tt=e.i(16735);let tr=(0,tt.default)("arrow-down",[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]]);function tn(e){return(0,v.jsx)(e6,{...e})}function ta({className:e,...t}){return(0,v.jsx)(e8,{"data-slot":"message-scroller",className:(0,eC.cn)("group/message-scroller relative flex size-full min-h-0 flex-col overflow-hidden",e),...t})}function ti({className:e,...t}){return(0,v.jsx)(e4,{"data-slot":"message-scroller-viewport",className:(0,eC.cn)("size-full min-h-0 min-w-0 scroll-fade-b scrollbar-thin scrollbar-gutter-stable overflow-y-auto overscroll-contain contain-content data-autoscrolling:scrollbar-thumb-transparent data-autoscrolling:scrollbar-track-transparent",e),...t})}function ts({className:e,...t}){return(0,v.jsx)(e7,{"data-slot":"message-scroller-content",className:(0,eC.cn)("flex h-max min-h-full flex-col gap-6",e),...t})}function to({className:e,scrollAnchor:t=!1,...r}){return(0,v.jsx)(e9,{"data-slot":"message-scroller-item",scrollAnchor:t,className:(0,eC.cn)("min-w-0 shrink-0 [contain-intrinsic-size:auto_10rem] [content-visibility:auto]",e),...r})}function tl({direction:e="end",className:t,children:r,render:n,variant:a="secondary",size:i="icon-sm",...s}){return(0,v.jsx)(te,{"data-slot":"message-scroller-button","data-direction":e,"data-variant":a,"data-size":i,direction:e,className:(0,eC.cn)("absolute inset-s-1/2 -translate-x-1/2 border-border bg-background text-foreground transition-[translate,scale,opacity] duration-200 hover:bg-muted hover:text-foreground data-[active=false]:pointer-events-none data-[active=false]:scale-95 data-[active=false]:opacity-0 data-[active=false]:duration-400 data-[active=false]:ease-[cubic-bezier(0.7,0,0.84,0)] data-[active=true]:translate-y-0 data-[active=true]:scale-100 data-[active=true]:opacity-100 data-[active=true]:ease-[cubic-bezier(0.23,1,0.32,1)] data-[direction=end]:bottom-4 data-[direction=end]:data-[active=false]:translate-y-full data-[direction=start]:top-4 data-[direction=start]:data-[active=false]:-translate-y-full rtl:translate-x-1/2 data-[direction=start]:[&_svg]:rotate-180",t),render:n??(0,v.jsx)(eN.Button,{variant:a,size:i}),...s,children:r??(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(tr,{}),(0,v.jsx)("span",{className:"sr-only",children:"end"===e?"Scroll to end":"Scroll to start"})]})})}var tu=e.i(50216);let tc=(0,tt.default)("message-circle",[["path",{d:"M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719",key:"1sd12s"}]]);function td({html:e}){return(0,v.jsx)("script",{type:"text/plain",suppressHydrationWarning:!0,dangerouslySetInnerHTML:{__html:e}})}var tp=e.i(75785);let th=["Why is checkout throwing 500s?","Review our pricing page","Summarise this week's incidents"],tf="chat-greeting",tm=()=>()=>{};function tg(){let e=new Date().getHours();return e<12?"Good morning":e<17?"Good afternoon":"Good evening"}function tb(e,t){try{let r=document.getElementById(e);r&&(r.textContent=t())}catch{}}function ty({userName:e,onSelect:t}){let r=w.useSyncExternalStore(tm,tg,()=>"Hello");return(0,v.jsxs)(tp.Empty,{className:"w-full",children:[(0,v.jsxs)(tp.EmptyHeader,{children:[(0,v.jsx)(tp.EmptyMedia,{variant:"icon",children:(0,v.jsx)(tc,{})}),(0,v.jsxs)(tp.EmptyTitle,{children:[(0,v.jsx)("span",{id:tf,suppressHydrationWarning:!0,children:r}),e?`, ${e}`:""]}),(0,v.jsx)(td,{html:`(${tb.toString()})(${JSON.stringify(tf)},${tg.toString()})`}),(0,v.jsx)(tp.EmptyDescription,{children:"Ask a question, or start from one of these."})]}),(0,v.jsx)(tp.EmptyContent,{children:(0,v.jsx)("div",{className:"flex flex-wrap justify-center gap-2",children:th.map(e=>(0,v.jsx)(eN.Button,{variant:"outline",size:"sm",onClick:()=>t?.(e),children:e},e))})})]})}var tv=e.i(7175),tw=e.i(19740),tw=tw;let tk=(0,tt.default)("refresh-cw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);var tx=e.i(27452),tC=e.i(28231),tA=e.i(8273),tA=tA;function t_({part:e}){let t=e.filename??"Attachment",r=e.mediaType.startsWith("image/")&&!!e.url;return(0,v.jsxs)(tx.Attachment,{className:"w-64",children:[(0,v.jsx)(tx.AttachmentMedia,{variant:r?"image":"icon",children:r?(0,v.jsx)("img",{src:e.url,alt:t}):(0,v.jsx)(tA.default,{})}),(0,v.jsxs)(tx.AttachmentContent,{children:[(0,v.jsx)(tx.AttachmentTitle,{children:t}),(0,v.jsx)(tx.AttachmentDescription,{children:e.mediaType})]})]})}var tS=e.i(90954),tN=w.createContext(null),tE=w.createContext(null),tI=w.createContext(null);function tR(e){let t=w.useContext(tE);if(!t)throw Error(`${e} must be used within a Questionnaire.Root component.`);return t}function tT(e){let t=w.useContext(tN);if(!t)throw Error(`${e} must be used within a Questionnaire.Choice component.`);return t}function tP(e){let t=w.useContext(tI);if(!t)throw Error(`${e} must be used within a Questionnaire.Item component.`);return t}function tM(e){return Array.isArray(e)?e.some(e=>String(e).trim().length>0):null!=e&&String(e).trim().length>0}function tj(e){return"letters"===e?Array.from({length:26},(e,t)=>String.fromCharCode(65+t)):"numbers"===e?Array.from({length:9},(e,t)=>String(t+1)):[]}
1function tL(e,t){return[e,t?"Enter":null].filter(Boolean).join(" ")||void 0}function t$(e){return"choice"===e.type?e.element.checked:e.element.hasAttribute("name")&&tM(e.element.value)}function tO(e){return!!(e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement)||(e instanceof HTMLInputElement?!["button","checkbox","radio","reset","submit"].includes(e.type):e instanceof HTMLElement&&e.isContentEditable)}function tB(e){return e instanceof HTMLInputElement&&"radio"===e.type}function tG(e,t){if(e.element===t.element)return 0;let r=e.element.compareDocumentPosition(t.element);return r&Node.DOCUMENT_POSITION_FOLLOWING?-1:r&Node.DOCUMENT_POSITION_PRECEDING?1:0}function tD(e,t){if(e.element===t.element)return 0;let r=e.element.compareDocumentPosition(t.element);return r&Node.DOCUMENT_POSITION_FOLLOWING?-1:r&Node.DOCUMENT_POSITION_PRECEDING?1:0}function tF(e,t){if(!e)return t??null;let r=t?e.itemByName.get(t):void 0;return r&&!r.disabled?r.name:e.enabledItems[0]?.name??null}function tU({children:e,disabled:t,onClick:r,props:n,render:a,shortcut:i,status:s,tabIndex:o,type:l,visible:u}){let c=u&&!t?i??null:null;return eD({defaultTagName:"button",props:eF({"aria-hidden":!u||void 0,"aria-keyshortcuts":c??void 0,children:e,disabled:t,hidden:!u,inert:!u,onClick:r,tabIndex:u?o:-1,type:l},n),render:a,state:{disabled:t,shortcut:c,status:s,visible:u},stateAttributesMapping:{visible:e=>({"data-hidden":e?void 0:"","data-visible":e?"":void 0})}})}var tq=function({defaultItem:e,item:t,items:r,noValidate:n=!0,onItemChange:a,onReset:i,onSubmit:s,ref:o,shortcuts:l,...u}){let{context:c,rootProps:d,state:p}=function({defaultItem:e,item:t,items:r,noValidate:n,onItemChange:a,onReset:i,onSubmit:s,ref:o,shortcuts:l}){let u=w.useMemo(()=>void 0===r?null:{enabledItems:r.filter(e=>!e.disabled),itemByName:new Map(r.map(e=>[e.name,e])),items:r},[r]),[c,d]=w.useState([]),[p,h]=w.useState(()=>tF(u,e)),[f,m]=w.useState(null),[g,b]=w.useState(0),y=w.useRef(null),v=void 0!==t,k=v?t:p,x=w.useRef(k),C=!1===n,A=l??null;w.useRef(new Set),w.useLayoutEffect(()=>{},[u,e,c,f,A]),w.useLayoutEffect(()=>{if(!f||typeof MutationObserver>"u")return;let e=new MutationObserver(()=>{b(e=>e+1)});return e.observe(f,{childList:!0,subtree:!0}),()=>e.disconnect()},[f]);let _=w.useMemo(()=>c.filter(e=>!e.disabled).sort(tG),[g,c]),S=w.useMemo(()=>new Map(_.map(e=>[e.name,e])),[_]),N=u?.enabledItems??_,E=N.findIndex(e=>e.name===k),I=E<0||!k?null:S.get(k)??null,R=k?u?.itemByName.get(k):void 0,T=E<0?null:R?!!R.required:I?.required??!1,P=E<0?null:I?.status??(k?"unanswered":null),M=w.useMemo(()=>u?u.enabledItems.flatMap(e=>{let t=S.get(e.name);return t?[t]:[]}):_,[u,S,_]),j=N.length,L=E<0?0:E+1,$=j>0&&0===E,O=j>0&&E===j-1,B=w.useCallback((e,t="item")=>{e!==k&&(y.current={name:e,target:t},v||h(e),a?.(e))},[k,v,a]);w.useLayoutEffect(()=>{if(0===j)return;if(E<0)return v||null!==k?void B(N[0].name):void h(N[0].name);let e=y.current,t=x.current!==k;if(x.current=k,!e||e.name!==k){v&&t&&(y.current=null,I?.focus());return}"invalid"===e.target?I?.focusInvalid():I?.focus(),y.current=null},[I,k,v,E,N,B,j]);let G=w.useCallback(e=>(d(t=>[...t.filter(t=>t.element!==e.element&&t.name!==e.name),e]),()=>{d(t=>t.filter(t=>t!==e))}),[]),D=w.useCallback(()=>{E<=0||B(N[E-1].name)},[E,N,B]),F=w.useCallback(()=>{if(!(!I||E>=j-1)){if(!I.validate())return void I.focusInvalid();B(N[E+1].name)}},[I,E,N,B,j]),U=w.useCallback(()=>{if(I){if(!I.validate())return void I.focusInvalid();if(O)return void f?.requestSubmit();B(N[E+1].name)}},[I,E,O,N,f,B]),q=w.useCallback(()=>{if(!(!I||I.required)){if(I.skip(),!O)return void B(N[E+1].name);queueMicrotask(()=>{f?.requestSubmit()})}},[I,E,O,N,f,B]),W={current:L,first:$,last:O,total:j};return{context:w.useMemo(()=>({...W,activeItem:I,activeItemName:k,activeItemRequired:T,activeItemStatus:P,domVersion:g,goNext:F,goPrevious:D,itemDefinitionByName:u?.itemByName??null,nativeValidation:C,registerItem:G,shortcuts:A,skipCurrent:q}),[I,k,T,P,u,L,g,$,F,D,O,C,G,A,q,j]),rootProps:{"data-shortcuts":A??void 0,onKeyDown:function(e){var t;let r;if(e.defaultPrevented||e.nativeEvent.isComposing||229===e.keyCode||!I||!(e.target instanceof Element))return;if("Enter"===e.key&&(e.metaKey||e.ctrlKey)&&!e.altKey&&!e.shiftKey){e.preventDefault(),e.repeat||U();return}if(e.metaKey||e.ctrlKey||e.altKey)return;if(("ArrowUp"===e.key||"ArrowDown"===e.key)&&I.moveAnswerFocus(e.target,"ArrowDown"===e.key?"next":"previous"))return void e.preventDefault();if(("ArrowLeft"===e.key||"ArrowRight"===e.key)&&!tO(e.target)&&!tB(e.target)){if(e.preventDefault(),e.repeat)return;"ArrowLeft"===e.key?D():"unanswered"!==I.status&&F();return}if("Enter"===e.key){let t=I.getAnswerByElement(e.target);if(!t)return;e.preventDefault(),!e.repeat&&t$(t)&&U();return}if(!A||tO(e.target))return;let n=(t=e.key,r="letters"===A?t.toUpperCase():t,tj(A).includes(r)?r:null),a=n?I.getAnswerByShortcut(n):null;a&&(e.preventDefault(),e.repeat||(a.element.focus(),"choice"===a.type&&a.element.click()))},onReset:function(t){if(i?.(t),t.defaultPrevented)return;for(let e of c)e.reset();let r=u?tF(u,e):_.find(t=>t.name===e)?.name??_[0]?.name;r&&B(r)}
1,onSubmit:function(e){let t=M.find(e=>!e.validate());if(t){e.preventDefault(),B(t.name,"invalid"),t.name===k&&(t.focusInvalid(),y.current=null);return}s?.(e)},ref:w.useCallback(e=>{m(e),eU(o)?.(e)},[o])},state:W}}({defaultItem:e,item:t,items:r,noValidate:n,onItemChange:a,onReset:i,onSubmit:s,ref:o,shortcuts:l}),h=eD({defaultTagName:"form",props:eF({...d,noValidate:n},u),state:p});return(0,v.jsx)(tE.Provider,{value:c,children:h})},tW=function({children:e,render:t,...r}){let{current:n,first:a,last:i,total:s}=tR("Questionnaire.Progress"),o=s?`Question ${n} of ${s}`:void 0;return eD({defaultTagName:"div",props:eF({"aria-label":"Questionnaire progress","aria-live":"polite","aria-valuemax":s||void 0,"aria-valuemin":s?1:void 0,"aria-valuenow":s?n:void 0,"aria-valuetext":o,children:e??o,role:"progressbar"},r),render:t,state:{current:n,first:a,last:i,total:s}})},tz=function({"aria-describedby":e,"aria-keyshortcuts":t,children:r,disabled:n=!1,invalid:a=!1,multiple:i=!1,name:s,onStatusChange:o,ref:l,required:u=!1,...c}){let{context:d,itemProps:p,state:h}=function({"aria-describedby":e,"aria-keyshortcuts":t,disabled:r=!1,invalid:n=!1,multiple:a=!1,name:i,onStatusChange:s,ref:o,required:l=!1}){let{activeItemName:u,domVersion:c,first:d,itemDefinitionByName:p,last:h,nativeValidation:f,registerItem:m,shortcuts:g}=tR("Questionnaire.Item"),[b,y]=w.useState(null),[v,k]=w.useState([]),[x,C]=w.useState(!1),[A,_]=w.useState([]),[S,N]=w.useState(!1),[E,I]=w.useState(0),[R,T]=w.useState([]),[P,M]=w.useState([]),j=w.useRef([]),L=w.useRef(a),$=w.useRef(a);L.current=a;let O=!r&&u===i,B=w.useMemo(()=>[...v].sort(tD),[v,c]),G=w.useMemo(()=>B.filter(e=>!e.disabled),[B]),D=G.some(e=>A.includes(e.id)),F=S?"skipped":D?"answered":"unanswered",U="skipped"===F&&!l,q=r||U||!n&&"answered"===F,W=!r&&!U&&(n||x&&!q),z=G.some(e=>"input"===e.type),H=w.useRef(F),V=p?.get(i),Q=w.useMemo(()=>p?function(e,t){let r=new Map;if(!e||!t)return r;let n=tj(t),a=0;for(let t of e.choices??[]){if(t.disabled)continue;let e=n[a];if(!e)break;r.set(t.value,e),a+=1}return r}(V,g):null,[V,p,g]),X=w.useMemo(()=>{if(Q)return new Map;let e=tj(g);return new Map(G.filter(e=>"choice"===e.type).slice(0,e.length).map((t,r)=>[t.id,e[r]]))},[G,Q,g]),K=w.useCallback(e=>(k(t=>[...t.filter(t=>t.element!==e.element&&t.id!==e.id),e]),()=>{k(t=>t.filter(t=>t!==e))}),[]);w.useLayoutEffect(()=>{H.current!==F&&(H.current=F,s?.(F))},[s,F]);let J=w.useCallback((e,t)=>{_(r=>t?a?r.includes(e)?r:[...r,e]:[e]:r.filter(t=>t!==e))},[a]),Z=w.useCallback((e,t)=>{N(!1),J(e,t)},[J]),Y=w.useCallback((e,t)=>{t&&N(!1),J(e,t)},[J]),ee=w.useCallback((e,t)=>(t&&(j.current=[...j.current.filter(t=>t!==e),e],_(t=>L.current?t.includes(e)?t:[...t,e]:t.length?t:[e])),()=>{j.current=j.current.filter(t=>t!==e),_(t=>t.filter(t=>t!==e))}),[]),et=w.useCallback((e,t)=>{if(t){j.current=j.current.includes(e)?j.current:[...j.current,e];return}j.current=j.current.filter(t=>t!==e)},[]),er=w.useCallback(e=>(T(t=>t.includes(e)?t:[...t,e]),()=>{T(t=>t.filter(t=>t!==e))}),[]),en=w.useCallback(e=>(M(t=>t.includes(e)?t:[...t,e]),()=>{M(t=>t.filter(t=>t!==e))}),[]),ea=w.useCallback(()=>{if(C(!0),!q)return!1;if(!f)return!0;let e=G.find(e=>t$(e)&&e.element.willValidate&&!e.element.validity.valid);return!e||(e.element.focus(),e.element.reportValidity(),!1)},[G,f,q]),ei=w.useCallback(()=>{b?.focus()},[b]),es=w.useCallback(()=>{let e=b?.querySelector("input[data-filled][name]:not(:disabled)"),t=b?.querySelector("input:not([type=hidden]):not(:disabled), textarea:not(:disabled)");(e??t??b)?.focus()},[b]),eo=w.useCallback(()=>{C(!1),N(!1),_(a?[...j.current]:j.current.slice(0,1)),I(e=>e+1)},[a]),el=w.useCallback(()=>{l||(_([]),N(!0))},[l]);w.useLayoutEffect(()=>{let e=$.current;$.current=a,!e||a||_(e=>{let t=G.find(t=>e.includes(t.id));return t?[t.id]:[]})},[G,a]);let eu=w.useCallback(e=>G.find(t=>t.element===e)??null,[G]),ec=w.useCallback(e=>{if(Q){let t=Array.from(Q.entries()).find(([,t])=>t===e)?.[0];return G.find(e=>"choice"===e.type&&e.value===t)??null}let t=Array.from(X.entries()).find(([,t])=>t===e)?.[0];return G.find(e=>e.id===t)??null},[G,X,Q]),ed=w.useCallback((e,t)=>{let r=G.findIndex(t=>t.element===e),n=r<0?null:G[r]??null;if(!G.length||tO(e)&&(!(n?.type==="input"&&["email","password","search","tel","text","url"].includes(n.element.type))||tM(n.element.value))||r<0&&e!==b)return!1;let a=r<0?G.find(t$)??("next"===t?G[0]:G[G.length-1]):G[(r+("next"===t?1:-1)+G.length)%G.length];return!(!a||a.element===e||r>=0&&tB(e)&&tB(a.element))&&(a.element.focus(),"choice"===a.type&&tB(a.element)&&a.element.click(),!0)},[G,b]);w.useLayoutEffect(()=>{if(b)return m({choices:B.flatMap(e=>"choice"===e.type?[{disabled:e.ownDisabled,value:e.value}]:[]),disabled:r,element:b,focus:ei,focusInvalid:es,getAnswerByElement:eu,getAnswerByShortcut:ec,moveAnswerFocus:ed,name:i,required:l,reset:eo,skip:el,status:F,validate:ea})},[B,r,b,ei,es,eu,ec,ed,i,m,l,eo,el,F,ea]);let ep=w.useMemo(()=>
1({active:O,disabled:r,hasInputAnswer:z,invalid:W,multiple:a,name:i,registerAnswerControl:K,registerAnswerSelection:ee,registerDescription:er,registerError:en,required:l,resetVersion:E,selectedAnswerIds:A,setAnswerDefault:et,setAnswerSelectionFromInteraction:Z,shortcutByAnswerId:X,shortcutByChoiceValue:Q,shortcuts:g,status:F,syncControlledAnswerSelection:Y}),[O,r,z,W,a,i,K,ee,er,en,l,E,A,et,Z,X,Q,g,F,Y]),eh=w.useCallback(e=>{y(e),eU(o)?.(e)},[o]);return{context:ep,itemProps:{"aria-describedby":[...R,...W?P:[],e].filter(Boolean).join(" ")||void 0,"aria-invalid":W||void 0,"aria-keyshortcuts":[t,O?"Meta+Enter Control+Enter":void 0,O&&G.length?"ArrowUp ArrowDown":void 0,O&&!d?"ArrowLeft":void 0,O&&!h&&"unanswered"!==F?"ArrowRight":void 0].filter(Boolean).join(" ")||void 0,disabled:r,hidden:!O,inert:!O,ref:eh,tabIndex:-1},state:{active:O,disabled:r,invalid:W,multiple:a,required:l,status:F}}}({"aria-describedby":e,"aria-keyshortcuts":t,disabled:n,invalid:a,multiple:i,name:s,onStatusChange:o,ref:l,required:u}),f=eD({defaultTagName:"fieldset",props:eF({...p,children:r},c),state:h,stateAttributesMapping:{active:e=>({"data-active":e?"":void 0})}});return(0,v.jsx)(tI.Provider,{value:d,children:f})},tH=function({render:e,...t}){return tP("Questionnaire.Title"),eD({defaultTagName:"legend",props:t,render:e})},tV=function({id:e,render:t,...r}){let{registerDescription:n}=tP("Questionnaire.Description"),a=w.useId(),i=e??a;return w.useLayoutEffect(()=>n(i),[i,n]),eD({defaultTagName:"p",props:eF({id:i},r),render:t})},tQ=function({render:e,...t}){let{shortcuts:r}=tP("Questionnaire.Choices");return eD({defaultTagName:"div",props:t,render:e,state:{shortcuts:r}})},tX=function({checked:e,children:t,defaultChecked:r=!1,disabled:n=!1,onChange:a,render:i,value:s,...o}){let{inputProps:l,state:u}=function({checked:e,defaultChecked:t=!1,disabled:r=!1,onChange:n,value:a}){let{disabled:i,hasInputAnswer:s,invalid:o,multiple:l,name:u,registerAnswerControl:c,registerAnswerSelection:d,required:p,resetVersion:h,selectedAnswerIds:f,setAnswerDefault:m,setAnswerSelectionFromInteraction:g,shortcutByAnswerId:b,shortcutByChoiceValue:y,status:v,syncControlledAnswerSelection:k}=tP("Questionnaire.Choice"),x=w.useId(),[C,A]=w.useState(null),_=w.useRef(t),S=void 0!==e,N=i||r,E=f.includes(x),I=S?"skipped"!==v&&e:E,R=l?"checkbox":"radio",T=y?.get(a)??b.get(x)??null;return w.useLayoutEffect(()=>d(x,_.current),[x,d]),w.useLayoutEffect(()=>m(x,t),[x,t,m]),w.useLayoutEffect(()=>{if(C)return c({disabled:N,element:C,id:x,ownDisabled:r,type:"choice",value:a})},[x,r,N,C,c,a]),w.useLayoutEffect(()=>{S&&k(x,e)},[x,S,e,h,k]),w.useLayoutEffect(()=>{C&&(C.defaultChecked=S?e:t,h>0&&(C.checked=I))},[I,S,e,t,C,h]),{inputProps:{ref:A,"aria-invalid":o||void 0,"aria-keyshortcuts":tL(T,!N&&I),checked:I,disabled:N,id:x,name:"skipped"===v?void 0:u,onChange:function(t){if(n?.(t),!t.defaultPrevented){if(!S)return void g(x,t.target.checked);"skipped"===v&&e===t.target.checked&&g(x,e)}},required:p&&!l&&!s,type:R,value:a},state:{checked:I,disabled:N,invalid:o,shortcut:T,type:R}}}({checked:e,defaultChecked:r,disabled:n,onChange:a,value:s}),c=eD({defaultTagName:"label",props:eF({children:t},o),render:i,state:u,stateAttributesMapping:{checked:e=>({"data-checked":e?"":void 0,"data-unchecked":e?void 0:""})}});return(0,v.jsx)(tN.Provider,{value:{inputProps:l,state:u},children:c})},tK=function({render:e,...t}){let{inputProps:r,state:n}=tT("Questionnaire.ChoiceInput");return eD({defaultTagName:"input",props:eF(r,t),render:e,state:n,stateAttributesMapping:{checked:e=>({"data-checked":e?"":void 0,"data-unchecked":e?void 0:""})}})},tJ=function({render:e,...t}){return tT("Questionnaire.ChoiceLabel"),eD({defaultTagName:"span",props:t,render:e})},tZ=function({children:e,render:t,...r}){let{state:n}=tT("Questionnaire.ChoiceShortcut"),a={shortcut:n.shortcut};return eD({defaultTagName:"span",props:eF({"aria-hidden":!0,children:e??n.shortcut,hidden:null===n.shortcut},r),render:t,state:a})},tY=function({defaultValue:e,disabled:t=!1,onChange:r,ref:n,render:a,type:i="text",value:s,...o}){let{inputProps:l,state:u}
1=function({defaultValue:e,disabled:t=!1,onChange:r,ref:n,type:a="text",value:i}){let{disabled:s,invalid:o,name:l,registerAnswerControl:u,registerAnswerSelection:c,resetVersion:d,selectedAnswerIds:p,setAnswerDefault:h,setAnswerSelectionFromInteraction:f,syncControlledAnswerSelection:m}=tP("Questionnaire.Input"),g=w.useId(),b=w.useRef(null),y=w.useRef(tM(e)),v=void 0!==i,k=tM(e),x=tM(i),[C,A]=w.useState(k),_=s||t,S=v?x:C,N=p.includes(g);w.useLayoutEffect(()=>c(g,y.current),[g,c]),w.useLayoutEffect(()=>h(g,k),[k,g,h]),w.useLayoutEffect(()=>{let e=b.current;if(e)return u({disabled:_,element:e,id:g,type:"input"})},[_,g,u]),w.useLayoutEffect(()=>{v?m(g,x):d>0&&A(k)},[v,x,i,k,g,d,m]),w.useLayoutEffect(()=>{let e=b.current;e&&v&&(e.defaultValue=String(i))},[v,i]);let E=w.useCallback(e=>{b.current=e,eU(n)?.(e)},[n]);return{inputProps:{"aria-invalid":o||void 0,"aria-keyshortcuts":tL(null,!_&&S&&N),defaultValue:v?void 0:e,disabled:_,form:N?void 0:"",id:g,name:N?l:void 0,onChange:function(e){if(r?.(e),e.defaultPrevented)return;let t=e.target.value.trim().length>0;v||(A(t),f(g,t))},ref:E,type:a,value:v?i:void 0},state:{disabled:_,filled:S,invalid:o}}}({defaultValue:e,disabled:t,onChange:r,ref:n,type:i,value:s});return eD({defaultTagName:"input",props:eF(l,o),render:a,state:u,stateAttributesMapping:{filled:e=>({"data-empty":e?void 0:"","data-filled":e?"":void 0})}})},t0=function({children:e,id:t,render:r,...n}){let{invalid:a,registerError:i,required:s}=tP("Questionnaire.Error"),o=w.useId(),l=t??o;return w.useLayoutEffect(()=>i(l),[l,i]),eD({defaultTagName:"p",props:eF({children:e??(s?"Choose an answer to continue.":"Choose an answer or skip this question."),hidden:!a,id:l,role:a?"alert":void 0},n),render:r,state:{invalid:a}})},t1=function({children:e,disabled:t=!1,onClick:r,render:n,tabIndex:a,type:i="button",...s}){let o=tR("Questionnaire.Previous"),l=o.total>1&&!o.first;return tU({children:e??"Previous",disabled:t,onClick:function(e){r?.(e),e.defaultPrevented||o.goPrevious()},props:s,render:n,status:o.activeItemStatus,tabIndex:a,type:i,visible:l})},t2=function({children:e,disabled:t=!1,onClick:r,render:n,tabIndex:a,type:i="button",...s}){let o=tR("Questionnaire.Skip"),l=!1===o.activeItemRequired;return tU({children:e??"Skip",disabled:t,onClick:function(e){r?.(e),e.defaultPrevented||o.skipCurrent()},props:s,render:n,status:o.activeItemStatus,tabIndex:a,type:i,visible:l})},t5=function({children:e,disabled:t=!1,onClick:r,render:n,tabIndex:a,type:i="button",...s}){let o=tR("Questionnaire.Next"),l=o.total>1&&!o.last;return tU({children:e??"Next",disabled:t,onClick:function(e){r?.(e),e.defaultPrevented||o.goNext()},props:s,render:n,shortcut:"Enter",status:o.activeItemStatus,tabIndex:a,type:i,visible:l})},t3=function({children:e,disabled:t=!1,render:r,tabIndex:n,type:a="submit",...i}){let s=tR("Questionnaire.Submit"),o=s.total>0&&s.last;return tU({children:e??"Submit",disabled:t,props:i,render:r,shortcut:"Enter",status:s.activeItemStatus,tabIndex:n,type:a,visible:o})};function t6({className:e,...t}){return(0,v.jsx)(tq,{"data-slot":"questionnaire",className:(0,eC.cn)("flex w-full min-w-0 flex-col gap-4",e),...t})}function t8({className:e,...t}){return(0,v.jsx)(tW,{"data-slot":"questionnaire-progress",className:(0,eC.cn)("min-h-[1lh] w-fit min-w-[14ch] text-xs font-medium text-muted-foreground tabular-nums",e),...t})}function t4({className:e,...t}){return(0,v.jsx)(tz,{"data-slot":"questionnaire-item",className:(0,eC.cn)("flex min-w-0 flex-col gap-4 border-0 p-0 outline-none",e),...t})}function t7({className:e,...t}){return(0,v.jsx)(tH,{"data-slot":"questionnaire-title",className:(0,eC.cn)("font-heading text-base leading-snug font-medium text-pretty [&:not(:has(~[data-slot=questionnaire-description]))]:mb-4",e),...t})}function t9({className:e,...t}){return(0,v.jsx)(tV,{"data-slot":"questionnaire-description",className:(0,eC.cn)("text-sm text-pretty text-muted-foreground",e),...t})}function re({className:e,...t}){return(0,v.jsx)(tQ,{"data-slot":"questionnaire-choices",className:(0,eC.cn)("group/questionnaire-choices grid min-w-0 gap-2",e),...t})}function rt({children:e,className:t,...r}){return(0,v.jsxs)(tX,{"data-slot":"questionnaire-choice",className:(0,eC.cn)("group/questionnaire-choice relative flex min-h-11 cursor-pointer items-start gap-2.5 rounded-lg border border-input bg-transparent px-3 py-2.5 text-start text-sm transition-colors outline-none select-none hover:bg-muted/50 has-[>input:focus-visible]:border-ring has-[>input:focus-visible]:ring-3 has-[>input:focus-visible]:ring-ring/50 data-invalid:border-destructive dark:bg-input/20 data-checked:border-primary/40 data-checked:bg-muted dark:data-checked:bg-muted","data-disabled:pointer-events-none data-disabled:cursor-not-allowed data-disabled:opacity-50",t),...r,children:[(0,v.jsx)(tK,{"data-slot":"questionnaire-choice-input",className:"absolute inset-0 z-10 size-full cursor-pointer opacity-0"}),(0,v.jsxs)("span",{"aria-hidden":"true","data-slot":"questionnaire-choice-indicator",className:"pointer-events-none relative flex size-4 shrink-0 translate-y-[--spacing(0.45)] items-center justify-center rounded-[4px] border border-input group-has-data-[slot=questionnaire-choice-description]/questionnaire-choice:translate-y-0.5 group-data-[type=radio]/questionnaire-choice:rounded-full group-data-checked/questionnaire-choice:border-primary group-data-checked/questionnaire-choice:bg-primary group-data-checked/questionnaire-choice:text-primary-foreground dark:bg-input/30 dark:group-data-checked/questionnaire-choice:bg-primary",children:[(0,v.jsx)("span",{"data-slot":"questionnaire-choice-indicator-dot",className:"hidden size-2 roun
1ded-full bg-primary-foreground group-data-[type=checkbox]/questionnaire-choice:hidden group-data-checked/questionnaire-choice:block"}),(0,v.jsx)(tv.CheckIcon,{"data-slot":"questionnaire-choice-indicator-check",className:"hidden size-3.5 group-data-[type=radio]/questionnaire-choice:hidden group-data-checked/questionnaire-choice:block"})]}),(0,v.jsx)(tJ,{"data-slot":"questionnaire-choice-label",className:"flex min-w-0 flex-1 flex-col gap-0.5 leading-snug",children:e}),(0,v.jsx)(tZ,{"data-slot":"questionnaire-choice-shortcut",className:"pointer-events-none ms-auto hidden size-5 shrink-0 translate-y-[--spacing(0.45)] items-center justify-center rounded-md border border-input bg-background font-mono text-[0.625rem] leading-none font-medium text-muted-foreground group-has-data-[slot=questionnaire-choice-description]/questionnaire-choice:translate-y-0.5 group-data-[shortcut]/questionnaire-choice:inline-flex"})]})}function rr({className:e,...t}){return(0,v.jsx)("div",{"data-slot":"questionnaire-input-wrapper",className:"group/questionnaire-input relative w-full min-w-0",children:(0,v.jsx)(tY,{"data-slot":"questionnaire-input",className:(0,eC.cn)("h-8 min-h-11 w-full min-w-0 rounded-lg border border-input bg-transparent px-2.5 py-1 text-base transition-[color,box-shadow,background-color] outline-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 sm:min-h-0 md:text-sm dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40","selection:bg-primary selection:text-primary-foreground placeholder:text-muted-foreground",e),...t})})}function rn({className:e,...t}){return(0,v.jsx)(t0,{"data-slot":"questionnaire-error",className:(0,eC.cn)("mt-2 text-sm text-destructive",e),...t})}function ra({className:e,...t}){return(0,v.jsx)("div",{"data-slot":"questionnaire-actions",className:(0,eC.cn)("grid min-h-11 w-full grid-cols-[minmax(0,1fr)_auto_auto] items-center gap-2 sm:min-h-8",e),...t})}function ri({children:e,className:t,size:r="default",variant:n="outline",...a}){return(0,v.jsx)(t1,{"data-slot":"questionnaire-previous","data-size":r,"data-variant":n,className:(0,eC.cn)((0,eN.buttonVariants)({size:r,variant:n}),"col-start-1 row-start-1 min-h-11 justify-self-start sm:min-h-0",t),...a,children:e??"Previous"})}function rs({children:e,className:t,size:r="default",variant:n="outline",...a}){return(0,v.jsx)(t2,{"data-slot":"questionnaire-skip","data-size":r,"data-variant":n,className:(0,eC.cn)((0,eN.buttonVariants)({size:r,variant:n}),"col-start-2 row-start-1 min-h-11 justify-self-end sm:min-h-0",t),...a,children:e??"Skip"})}function ro({children:e,className:t,size:r="default",variant:n="default",...a}){return(0,v.jsx)(t5,{"data-slot":"questionnaire-next","data-size":r,"data-variant":n,className:(0,eC.cn)((0,eN.buttonVariants)({size:r,variant:n}),"col-start-3 row-start-1 min-h-11 justify-self-end sm:min-h-0",t),...a,children:e??"Next"})}function rl({children:e,className:t,size:r="default",variant:n="default",...a}){return(0,v.jsx)(t3,{"data-slot":"questionnaire-submit","data-size":r,"data-variant":n,className:(0,eC.cn)((0,eN.buttonVariants)({size:r,variant:n}),"col-start-3 row-start-1 min-h-11 justify-self-end sm:min-h-0",t),...a,children:e??"Submit"})}var ru=e.i(47408);function rc({part:e,onAnswer:t}){let r=e.input,n=w.useMemo(()=>(r?.questions??[]).map(e=>({name:e.name,required:e.required,choices:e.choices?.map(e=>({value:e.value}))})),[r?.questions]);if("output-available"===e.state){let{answers:t}=e.output;return(0,v.jsx)(e_,{variant:"outline",className:"max-w-full",children:(0,v.jsxs)(eS,{className:"w-full",children:[(0,v.jsxs)(eO,{children:[(0,v.jsx)(eB,{children:(0,v.jsx)(ru.Check,{})}),(0,v.jsx)(eG,{children:"Answers sent"})]}),(0,v.jsx)("dl",{className:"mt-2.5 grid gap-1 text-sm",children:t.map(e=>(0,v.jsxs)("div",{className:"flex gap-1.5",children:[(0,v.jsx)("dt",{className:"shrink-0 text-muted-foreground",children:e.question}),(0,v.jsx)("dd",{className:"min-w-0",children:e.answer})]},e.question))})]})})}return"input-available"===e.state&&r?(0,v.jsx)(e_,{variant:"outline",className:"max-w-full",children:(0,v.jsx)(eS,{className:"w-full",children:(0,v.jsxs)(t6,{items:n,defaultItem:r.questions[0]?.name,shortcuts:"numbers",onSubmit:function(n){n.preventDefault();let a=new FormData(n.currentTarget),i=(r?.questions??[]).map(e=>{let t=a.getAll(e.name).map(String).map(e=>
1e.trim()).filter(Boolean).map(t=>e.choices?.find(e=>e.value===t)?.label??t);return{question:e.label,answer:t.join(", ")||"No preference"}});t?.(e.toolCallId,{answers:i})},children:[(0,v.jsx)(t8,{}),r.questions.map(e=>(0,v.jsxs)(t4,{name:e.name,required:e.required,multiple:e.multiple,children:[(0,v.jsx)(t7,{children:e.title}),e.description?(0,v.jsx)(t9,{children:e.description}):null,(0,v.jsxs)(re,{children:[e.choices?.map(e=>(0,v.jsx)(rt,{value:e.value,children:e.description?(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)("span",{className:"font-medium",children:e.label}),(0,v.jsx)("span",{className:"text-muted-foreground",children:e.description})]}):e.label},e.value)),e.input?(0,v.jsx)(rr,{"aria-label":e.input.label,placeholder:e.input.placeholder}):null]}),(0,v.jsx)(rn,{})]},e.name)),(0,v.jsxs)(ra,{children:[(0,v.jsx)(ri,{}),(0,v.jsx)(rs,{}),(0,v.jsx)(ro,{}),(0,v.jsx)(rl,{children:r.submitLabel??"Send answers"})]})]})})}):null}var rd=e.i(11369);let rp=(0,tt.default)("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"}]]);var rh=e.i(58985),rh=rh;function rf({part:e}){let t="streaming"===e.state;return(0,v.jsxs)(rd.Collapsible,{children:[(0,v.jsx)(eO,{asChild:!0,className:"transition-colors hover:text-foreground",children:(0,v.jsxs)(rd.CollapsibleTrigger,{children:[(0,v.jsx)(eB,{children:t?(0,v.jsx)(tu.Spinner,{}):(0,v.jsx)(rp,{})}),(0,v.jsx)(eG,{className:t?"shimmer":void 0,children:t?"Reasoning...":"Reasoning"}),(0,v.jsx)(eB,{children:(0,v.jsx)(rh.default,{className:"transition-transform group-data-open/marker:rotate-180"})})]})}),(0,v.jsx)(rd.CollapsibleContent,{children:(0,v.jsx)(e_,{variant:"muted",className:"mt-2",children:(0,v.jsx)(eS,{className:"whitespace-pre-wrap text-muted-foreground",children:e.text})})})]})}let rm=(0,tt.default)("book-open",[["path",{d:"M12 5v16",key:"1f6ucr"}],["path",{d:"M20.001 19A2 2 0 0022 17V5a2 2 0 00-1.999-2L16 3.002A5 5 0 0012 5a5 5 0 00-4-2H4a2 2 0 00-2 2v12a2 2 0 001.999 2H8a5 5 0 014 2 5 5 0 014-2z",key:"1fyvmf"}]]);var rh=rh;let rg=(0,tt.default)("link",[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]]);var tA=tA;function rb({sources:e}){let t,r=(t=new Set,e.filter(e=>{let r=e.url??e.id;return!t.has(r)&&(t.add(r),!0)}));return(0,v.jsxs)(rd.Collapsible,{children:[(0,v.jsx)(eO,{asChild:!0,className:"transition-colors hover:text-foreground",children:(0,v.jsxs)(rd.CollapsibleTrigger,{children:[(0,v.jsx)(eB,{children:(0,v.jsx)(rm,{})}),(0,v.jsxs)(eG,{children:[r.length," ",1===r.length?"source":"sources"]}),(0,v.jsx)(eB,{children:(0,v.jsx)(rh.default,{className:"transition-transform group-data-open/marker:rotate-180"})})]})}),(0,v.jsx)(rd.CollapsibleContent,{children:(0,v.jsx)("div",{className:"mt-2 flex flex-col gap-2",children:r.map(e=>{let t=e.url?function(e){try{let{protocol:t}=new URL(e);return"http:"===t||"https:"===t?e:void 0}catch{return}}(e.url):void 0,r=t?function(e){try{return new URL(e).hostname.replace(/^www\./,"")}catch{return}}(t):void 0,n=(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(eB,{children:e.url?(0,v.jsx)(rg,{}):(0,v.jsx)(tA.default,{})}),(0,v.jsxs)(eG,{className:"truncate",children:[e.title??e.url??"Source",r?(0,v.jsx)("span",{className:"ml-1.5 opacity-60",children:r}):null,e.filename?(0,v.jsx)("span",{className:"ml-1 opacity-60",children:e.filename}):null]})]});return t?(0,v.jsx)(eO,{asChild:!0,children:(0,v.jsx)("a",{href:t,target:"_blank",rel:"noreferrer noopener",children:n})},e.id):(0,v.jsx)(eO,{children:n},e.id)})})})]})}let ry=[{id:"abap",name:"ABAP",import:()=>e.A(81107)},{id:"actionscript-3",name:"ActionScript",import:()=>e.A(63750)},{id:"ada",name:"Ada",import:()=>e.A(91813)},{id:"angular-html",name:"Angular HTML",import:()=>e.A(56500)},{id:"angular-ts",name:"Angular TypeScript",import:()=>e.A(16569)},{id:"apache",name:"Apache Conf",import:()=>e.A(34082)},{id:"apex",name:"Apex",import:()=>e.A(96050)},{id:"apl",name:"APL",import:()=>e.A(19847)},{id:"applescript",name:"AppleScript",import:()=>e.A(78893)},{id:"ara",name:"Ara",import:()=>e.A(73785)},{id:"asciidoc",name:"AsciiDoc",aliases:["adoc"],import:()=>e.A(70789)},{id:"asm",name:"Assembly",import:()=>e.A(57041)},{id:"astro",name:"Astro",import:()=>e.A(77155)},{id:"awk",name:"AWK",import:()=>e.A(19686)},{id:"ballerina",name:"Ballerina",import:()=>e.A(4821)},{id:"bat",name:"Batch File",aliases:["batch"],import:()=>e.A(81214)},{id:"beancount",name:"Beancount",import:()=>e.A(7827)},{id:"berry",name:"Berry",aliases:["be"],import:()=>e.A(59139)},{id:"bibtex",name:"BibTeX",import:()=>e.A(75527)},{id:"bicep",name:"Bicep",import:()=>e.A(65206)},{id:"bird2",name:"BIRD2 Configuration",aliases:["bird"],import:()=>e.A(20766)},{id:"blade",name:"Blade",import:()=>e.A(43021)},{id:"bsl",name:"1C (Enterprise)",aliases:["1c"],import:()=>e.A(590)},{id:"c",name:"C",import:()=>e.A(2328)},{id:"c3",name:"C3",import:()=>e.A(853)},{id:"cadence",name:"Cadence",aliases:["cdc"],import:()=>e.A(87209)},{id:"cairo",name:"Cairo",import:()=>e.A(82927)},{id:"clarity",name:"Clarity",import:()=>e.A(52460)},{id:"clojure",name:"Clojure",aliases:["clj"],import:()=>e.A(85623)},{id:"cmake",name:"CMake",import:()=>e.A(85367)},{id:"cobol",name:"COBOL",import:()=>e.A(93874)},{id:"codeowners",name:"CODEOWNERS",import:()=>e.A(81727)},{id:"codeql",name:"CodeQL",aliases:["ql"],import:()=>e.A(52172)},{id:"coffee",name:"CoffeeScript",aliases:["coffeescript"],import:()=>e.A(67432)},{id:"common-lisp",name:"Common Lisp",aliases:["lisp"],import:()=>e.A(92185)},{id:"coq",name:"Coq",import:()=>e.A(83109)},{id:"cpp",name:"C++",aliases:["c++"],import:()=>e.A(63419)},{id:"crystal",name:"Crystal",import:()=>e.A(80210)}
1,{id:"csharp",name:"C#",aliases:["c#","cs"],import:()=>e.A(37160)},{id:"css",name:"CSS",import:()=>e.A(35302)},{id:"csv",name:"CSV",import:()=>e.A(4163)},{id:"cue",name:"CUE",import:()=>e.A(2170)},{id:"cypher",name:"Cypher",aliases:["cql"],import:()=>e.A(59146)},{id:"d",name:"D",import:()=>e.A(53717)},{id:"dart",name:"Dart",import:()=>e.A(40194)},{id:"dax",name:"DAX",import:()=>e.A(96874)},{id:"desktop",name:"Desktop",import:()=>e.A(17925)},{id:"diff",name:"Diff",import:()=>e.A(58196)},{id:"docker",name:"Dockerfile",aliases:["dockerfile"],import:()=>e.A(41274)},{id:"dotenv",name:"dotEnv",import:()=>e.A(169)},{id:"dream-maker",name:"Dream Maker",import:()=>e.A(86068)},{id:"edge",name:"Edge",import:()=>e.A(24716)},{id:"elixir",name:"Elixir",import:()=>e.A(62285)},{id:"elm",name:"Elm",import:()=>e.A(35711)},{id:"emacs-lisp",name:"Emacs Lisp",aliases:["elisp"],import:()=>e.A(70112)},{id:"erb",name:"ERB",import:()=>e.A(19341)},{id:"erlang",name:"Erlang",aliases:["erl"],import:()=>e.A(16686)},{id:"fennel",name:"Fennel",import:()=>e.A(6581)},{id:"fish",name:"Fish",import:()=>e.A(14037)},{id:"fluent",name:"Fluent",aliases:["ftl"],import:()=>e.A(35601)},{id:"fortran-fixed-form",name:"Fortran (Fixed Form)",aliases:["f","for","f77"],import:()=>e.A(83987)},{id:"fortran-free-form",name:"Fortran (Free Form)",aliases:["f90","f95","f03","f08","f18"],import:()=>e.A(6099)},{id:"fsharp",name:"F#",aliases:["f#","fs"],import:()=>e.A(83499)},{id:"gdresource",name:"GDResource",aliases:["tscn","tres"],import:()=>e.A(87861)},{id:"gdscript",name:"GDScript",aliases:["gd"],import:()=>e.A(80083)},{id:"gdshader",name:"GDShader",import:()=>e.A(38264)},{id:"genie",name:"Genie",import:()=>e.A(7204)},{id:"gherkin",name:"Gherkin",import:()=>e.A(13549)},{id:"git-commit",name:"Git Commit Message",import:()=>e.A(97183)},{id:"git-rebase",name:"Git Rebase Message",import:()=>e.A(32046)},{id:"gleam",name:"Gleam",import:()=>e.A(7826)},{id:"glimmer-js",name:"Glimmer JS",aliases:["gjs"],import:()=>e.A(7076)},{id:"glimmer-ts",name:"Glimmer TS",aliases:["gts"],import:()=>e.A(25338)},{id:"glsl",name:"GLSL",import:()=>e.A(20366)},{id:"gn",name:"GN",import:()=>e.A(7005)},{id:"gnuplot",name:"Gnuplot",import:()=>e.A(9742)},{id:"go",name:"Go",import:()=>e.A(32961)},{id:"graphql",name:"GraphQL",aliases:["gql"],import:()=>e.A(28949)},{id:"groovy",name:"Groovy",import:()=>e.A(99953)},{id:"hack",name:"Hack",import:()=>e.A(94818)},{id:"haml",name:"Ruby Haml",import:()=>e.A(45962)},{id:"handlebars",name:"Handlebars",aliases:["hbs"],import:()=>e.A(54989)},{id:"haskell",name:"Haskell",aliases:["hs"],import:()=>e.A(19766)},{id:"haxe",name:"Haxe",import:()=>e.A(36800)},{id:"hcl",name:"HashiCorp HCL",import:()=>e.A(48226)},{id:"hjson",name:"Hjson",import:()=>e.A(82962)},{id:"hlsl",name:"HLSL",import:()=>e.A(44097)},{id:"html",name:"HTML",import:()=>e.A(63665)},{id:"html-derivative",name:"HTML (Derivative)",import:()=>e.A(94224)},{id:"http",name:"HTTP",import:()=>e.A(67513)},{id:"hurl",name:"Hurl",import:()=>e.A(81432)},{id:"hxml",name:"HXML",import:()=>e.A(62205)},{id:"hy",name:"Hy",import:()=>e.A(79622)},{id:"imba",name:"Imba",import:()=>e.A(92033)},{id:"ini",name:"INI",aliases:["properties"],import:()=>e.A(80261)},{id:"java",name:"Java",import:()=>e.A(44410)},{id:"javascript",name:"JavaScript",aliases:["js","cjs","mjs"],import:()=>e.A(91941)},{id:"jinja",name:"Jinja",import:()=>e.A(61819)},{id:"jison",name:"Jison",import:()=>e.A(12957)},{id:"json",name:"JSON",import:()=>e.A(84076)},{id:"json5",name:"JSON5",import:()=>e.A(15864)},{id:"jsonc",name:"JSON with Comments",import:()=>e.A(61453)},{id:"jsonl",name:"JSON Lines",import:()=>e.A(27145)},{id:"jsonnet",name:"Jsonnet",import:()=>e.A(72102)},{id:"jssm",name:"JSSM",aliases:["fsl"],import:()=>e.A(61866)},{id:"jsx",name:"JSX",import:()=>e.A(47375)},{id:"julia",name:"Julia",aliases:["jl"],import:()=>e.A(79483)},{id:"just",name:"Just",import:()=>e.A(27549)},{id:"kdl",name:"KDL",import:()=>e.A(78226)},{id:"kotlin",name:"Kotlin",aliases:["kt","kts"],import:()=>e.A(89992)},{id:"kusto",name:"Kusto",aliases:["kql"],import:()=>e.A(96473)},{id:"latex",name:"LaTeX",import:()=>e.A(39084)},{id:"lean",name:"Lean 4",aliases:["lean4"],import:()=>e.A(87185)},{id:"less",name:"Less",import:()=>e.A(67110)},{id:"liquid",name:"Liquid",import:()=>e.A(77875)},{id:"llvm",name:"LLVM IR",import:()=>e.A(67140)},{id:"log",name:"Log file",import:()=>e.A(92086)},{id:"logo",name:"Logo",import:()=>e.A(42407)},{id:"lua",name:"Lua",import:()=>e.A(19030)}
1,{id:"luau",name:"Luau",import:()=>e.A(56786)},{id:"make",name:"Makefile",aliases:["makefile"],import:()=>e.A(43167)},{id:"markdown",name:"Markdown",aliases:["md"],import:()=>e.A(90015)},{id:"marko",name:"Marko",import:()=>e.A(77121)},{id:"matlab",name:"MATLAB",import:()=>e.A(93408)},{id:"mdc",name:"MDC",import:()=>e.A(81294)},{id:"mdx",name:"MDX",import:()=>e.A(42248)},{id:"mermaid",name:"Mermaid",aliases:["mmd"],import:()=>e.A(18803)},{id:"mipsasm",name:"MIPS Assembly",aliases:["mips"],import:()=>e.A(89643)},{id:"mojo",name:"Mojo",import:()=>e.A(29681)},{id:"moonbit",name:"MoonBit",aliases:["mbt","mbti"],import:()=>e.A(75864)},{id:"move",name:"Move",import:()=>e.A(1566)},{id:"narrat",name:"Narrat Language",aliases:["nar"],import:()=>e.A(17849)},{id:"nextflow",name:"Nextflow",aliases:["nf"],import:()=>e.A(68450)},{id:"nextflow-groovy",name:"nextflow-groovy",import:()=>e.A(44946)},{id:"nginx",name:"Nginx",import:()=>e.A(35471)},{id:"nim",name:"Nim",import:()=>e.A(24230)},{id:"nix",name:"Nix",import:()=>e.A(91052)},{id:"nushell",name:"nushell",aliases:["nu"],import:()=>e.A(40785)},{id:"objective-c",name:"Objective-C",aliases:["objc"],import:()=>e.A(65479)},{id:"objective-cpp",name:"Objective-C++",import:()=>e.A(74546)},{id:"ocaml",name:"OCaml",import:()=>e.A(64834)},{id:"odin",name:"Odin",import:()=>e.A(91473)},{id:"openscad",name:"OpenSCAD",aliases:["scad"],import:()=>e.A(31836)},{id:"pascal",name:"Pascal",import:()=>e.A(86958)},{id:"perl",name:"Perl",import:()=>e.A(98959)},{id:"php",name:"PHP",import:()=>e.A(9246)},{id:"pkl",name:"Pkl",import:()=>e.A(98326)},{id:"plsql",name:"PL/SQL",import:()=>e.A(14547)},{id:"po",name:"Gettext PO",aliases:["pot","potx"],import:()=>e.A(19867)},{id:"polar",name:"Polar",import:()=>e.A(67362)},{id:"postcss",name:"PostCSS",import:()=>e.A(44583)},{id:"powerquery",name:"PowerQuery",import:()=>e.A(65129)},{id:"powershell",name:"PowerShell",aliases:["ps","ps1"],import:()=>e.A(69514)},{id:"prisma",name:"Prisma",import:()=>e.A(43874)},{id:"prolog",name:"Prolog",import:()=>e.A(65557)},{id:"proto",name:"Protocol Buffer 3",aliases:["protobuf"],import:()=>e.A(66244)},{id:"pug",name:"Pug",aliases:["jade"],import:()=>e.A(6098)},{id:"puppet",name:"Puppet",import:()=>e.A(32516)},{id:"purescript",name:"PureScript",import:()=>e.A(58805)},{id:"python",name:"Python",aliases:["py"],import:()=>e.A(86636)},{id:"qml",name:"QML",import:()=>e.A(48377)},{id:"qmldir",name:"QML Directory",import:()=>e.A(28449)},{id:"qss",name:"Qt Style Sheets",import:()=>e.A(80279)},{id:"r",name:"R",import:()=>e.A(74190)},{id:"racket",name:"Racket",import:()=>e.A(22166)},{id:"raku",name:"Raku",aliases:["perl6"],import:()=>e.A(43712)},{id:"razor",name:"ASP.NET Razor",import:()=>e.A(94256)},{id:"reg",name:"Windows Registry Script",import:()=>e.A(10369)},{id:"regexp",name:"RegExp",aliases:["regex"],import:()=>e.A(27379)},{id:"rel",name:"Rel",import:()=>e.A(62502)},{id:"riscv",name:"RISC-V",import:()=>e.A(36578)},{id:"ron",name:"RON",import:()=>e.A(34463)},{id:"rosmsg",name:"ROS Interface",import:()=>e.A(57616)},{id:"rst",name:"reStructuredText",import:()=>e.A(25130)},{id:"ruby",name:"Ruby",aliases:["rb"],import:()=>e.A(70562)},{id:"rust",name:"Rust",aliases:["rs"],import:()=>e.A(20768)},{id:"sas",name:"SAS",import:()=>e.A(93376)},{id:"sass",name:"Sass",import:()=>e.A(84802)},{id:"scala",name:"Scala",import:()=>e.A(87506)},{id:"scheme",name:"Scheme",import:()=>e.A(23504)},{id:"scss",name:"SCSS",import:()=>e.A(4006)},{id:"sdbl",name:"1C (Query)",aliases:["1c-query"],import:()=>e.A(31324)},{id:"shaderlab",name:"ShaderLab",aliases:["shader"],import:()=>e.A(90222)},{id:"shellscript",name:"Shell",aliases:["bash","sh","shell","zsh"],import:()=>e.A(17085)},{id:"shellsession",name:"Shell Session",aliases:["console"],import:()=>e.A(36141)},{id:"smalltalk",name:"Smalltalk",import:()=>e.A(73046)},{id:"solidity",name:"Solidity",import:()=>e.A(37320)},{id:"soy",name:"Closure Templates",aliases:["closure-templates"],import:()=>e.A(12549)},{id:"sparql",name:"SPARQL",import:()=>e.A(55388)},{id:"splunk",name:"Splunk Query Language",aliases:["spl"],import:()=>e.A(71559)},{id:"sql",name:"SQL",import:()=>e.A(62250)},{id:"ssh-config",name:"SSH Config",import:()=>e.A(79140)},{id:"stata",name:"Stata",import:()=>e.A(58405)},{id:"stylus",name:"Stylus",aliases:["styl"],import:()=>e.A(96543)},{id:"surrealql",name:"SurrealQL",aliases:["surql"],import:()=>e.A(13164)},{id:"svelte",name:"Svelte",import:()=>e.A(76180)},{id:"swift",name:"Swift",import:()=>e.A(83238)},{id:"system-verilog",name:"SystemVerilog",import:()=>e.A(20599)},{id:"systemd",name:"Systemd Units",import:()=>e.A(33838)},{id:"talonscript",name:"TalonScript",aliases:["talon"],import:()=>e.A(24411)},{id:"tasl",name:"Tasl",import:()=>e.A(13935)},{id:"tcl",name:"Tcl",import:()=>e.A(20474)}
1,{id:"templ",name:"Templ",import:()=>e.A(53318)},{id:"terraform",name:"Terraform",aliases:["tf","tfvars"],import:()=>e.A(79228)},{id:"tex",name:"TeX",import:()=>e.A(40618)},{id:"toml",name:"TOML",import:()=>e.A(5470)},{id:"ts-tags",name:"TypeScript with Tags",aliases:["lit"],import:()=>e.A(30537)},{id:"tsv",name:"TSV",import:()=>e.A(40623)},{id:"tsx",name:"TSX",import:()=>e.A(24096)},{id:"turtle",name:"Turtle",import:()=>e.A(41213)},{id:"twig",name:"Twig",import:()=>e.A(77825)},{id:"typescript",name:"TypeScript",aliases:["ts","cts","mts"],import:()=>e.A(19350)},{id:"typespec",name:"TypeSpec",aliases:["tsp"],import:()=>e.A(86116)},{id:"typst",name:"Typst",aliases:["typ"],import:()=>e.A(72085)},{id:"v",name:"V",import:()=>e.A(56293)},{id:"vala",name:"Vala",import:()=>e.A(3131)},{id:"vb",name:"Visual Basic",aliases:["cmd"],import:()=>e.A(67619)},{id:"verilog",name:"Verilog",import:()=>e.A(86165)},{id:"vhdl",name:"VHDL",import:()=>e.A(35200)},{id:"viml",name:"Vim Script",aliases:["vim","vimscript"],import:()=>e.A(33464)},{id:"vue",name:"Vue",import:()=>e.A(54049)},{id:"vue-html",name:"Vue HTML",import:()=>e.A(499)},{id:"vue-vine",name:"Vue Vine",import:()=>e.A(6993)},{id:"vyper",name:"Vyper",aliases:["vy"],import:()=>e.A(80598)},{id:"wasm",name:"WebAssembly",import:()=>e.A(72318)},{id:"wenyan",name:"Wenyan",aliases:["文言"],import:()=>e.A(84860)},{id:"wgsl",name:"WGSL",import:()=>e.A(46196)},{id:"wikitext",name:"Wikitext",aliases:["mediawiki","wiki"],import:()=>e.A(19331)},{id:"wit",name:"WebAssembly Interface Types",import:()=>e.A(25277)},{id:"wolfram",name:"Wolfram",aliases:["wl"],import:()=>e.A(68013)},{id:"xml",name:"XML",import:()=>e.A(64046)},{id:"xsl",name:"XSL",import:()=>e.A(7544)},{id:"yaml",name:"YAML",aliases:["yml"],import:()=>e.A(18299)},{id:"zenscript",name:"ZenScript",import:()=>e.A(36493)},{id:"zig",name:"Zig",import:()=>e.A(76720)}],rv=Object.fromEntries(ry.map(e=>[e.id,e.import])),rw=Object.fromEntries(ry.flatMap(e=>e.aliases?.map(t=>[t,e.import])||[])),rk={...rv,...rw};class rx extends Error{constructor(e){super(e),this.name="ShikiError"}}function rC(e,...t){return t.forEach(t=>{for(let r in t)e[r]=t[r]}),e}var rA=/\$(\d+)|\${(\d+):\/(downcase|upcase)}/g,r_=class{static hasCaptures(e){return null!==e&&(rA.lastIndex=0,rA.test(e))}static replaceCaptures(e,t,r){return e.replace(rA,(e,n,a,i)=>{let s=r[parseInt(n||a,10)];if(!s)return e;{let e=t.substring(s.start,s.end);for(;"."===e[0];)e=e.substring(1);switch(i){case"downcase":return e.toLowerCase();case"upcase":return e.toUpperCase();default:return e}}})}};function rS(e,t){if(null===e&&null===t)return 0;if(!e)return -1;if(!t)return 1;let r=e.length,n=t.length;if(r===n){for(let n=0;n<r;n++){var a,i;let r=(a=e[n],a<(i=t[n])?-1:+(a>i));if(0!==r)return r}return 0}return r-n}function rN(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 rE(e){return e.replace(/[\-\\\{\}\*\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,"\\$&")}var rI=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}},rR=class{constructor(e,t,r){this._colorMap=e,this._defaults=t,this._root=r}static createFromRawTheme(e,t){return this.createFromParsedTheme(function(e){if(!e||!e.settings||!Array.isArray(e.settings))return[];let t=e.settings,r=[],n=0;for(let e=0,a=t.length;e<a;e++){let a,i=t[e];if(!i.settings)continue;if("string"==typeof i.scope){let e=i.scope;a=(e=(e=e.replace(/^[,]+/,"")).replace(/[,]+$/,"")).split(",")}else a=Array.isArray(i.scope)?i.scope:[""];let s=-1;if("string"==typeof i.settings.fontStyle){s=0;let e=i.settings.fontStyle.split(" ");for(let t=0,r=e.length;t<r;t++)switch(e[t]){case"italic":s|=1;break;case"bold":s|=2;break;case"underline":s|=4;break;case"strikethrough":s|=8}}let o=null;"string"==typeof i.settings.foreground&&rN(i.settings.foreground)&&(o=i.settings.foreground);let l=null;"string"==typeof i.settings.background&&rN(i.settings.background)&&(l=i.settings.background);for(let t=0,i=a.length;t<i;t++){let i=a[t].trim().split(" "),u=i[i.length-1],c=null;i.length>1&&(c=i.slice(0,i.length-1)).reverse(),r[n++]=new rM(u,c,e,s,o,l)}}return r}(e),t)}static createFromParsedTheme(e,t){return function(e,t){e.sort((e,t)=>
1{var r,n;let a=(r=e.scope,r<(n=t.scope)?-1:+(r>n));return 0!==a||0!==(a=rS(e.parentScopes,t.parentScopes))?a:e.index-t.index});let r=0,n="#000000",a="#ffffff";for(;e.length>=1&&""===e[0].scope;){let t=e.shift();-1!==t.fontStyle&&(r=t.fontStyle),null!==t.foreground&&(n=t.foreground),null!==t.background&&(a=t.background)}let i=new rL(t),s=new rP(r,i.getId(n),i.getId(a)),o=new rB(new rO(0,null,-1,0,0),[]);for(let t=0,r=e.length;t<r;t++){let r=e[t];o.insert(0,r.scope,r.parentScopes,r.fontStyle,i.getId(r.foreground),i.getId(r.background))}return new rR(i,s,o)}(e,t)}_cachedMatchRoot=new rI(e=>this._root.match(e));getColorMap(){return this._colorMap.getColorMap()}getDefaults(){return this._defaults}match(e){if(null===e)return this._defaults;let t=e.scopeName,r=this._cachedMatchRoot.get(t).find(t=>(function(e,t){if(0===t.length)return!0;for(let a=0;a<t.length;a++){var r,n;let i=t[a],s=!1;if(">"===i){if(a===t.length-1)return!1;i=t[++a],s=!0}for(;e&&(r=e.scopeName,!((n=i)===r||r.startsWith(n)&&"."===r[n.length]));){if(s)return!1;e=e.parent}if(!e)return!1;e=e.parent}return!0})(e.parent,t.parentScopes));return r?new rP(r.fontStyle,r.foreground,r.background):null}},rT=class e{constructor(e,t){this.parent=e,this.scopeName=t}static push(t,r){for(let n of r)t=new e(t,n);return t}static from(...t){let r=null;for(let n=0;n<t.length;n++)r=new e(r,t[n]);return r}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||null!==this.parent&&this.parent.extends(e)}getExtensionIfDefined(e){let t=[],r=this;for(;r&&r!==e;)t.push(r.scopeName),r=r.parent;return r===e?t.reverse():void 0}},rP=class{constructor(e,t,r){this.fontStyle=e,this.foregroundId=t,this.backgroundId=r}},rM=class{constructor(e,t,r,n,a,i){this.scope=e,this.parentScopes=t,this.index=r,this.fontStyle=n,this.foreground=a,this.background=i}},rj=((s=rj||{})[s.NotSet=-1]="NotSet",s[s.None=0]="None",s[s.Italic=1]="Italic",s[s.Bold=2]="Bold",s[s.Underline=4]="Underline",s[s.Strikethrough=8]="Strikethrough",s),rL=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,r=e.length;t<r;t++)this._color2id[e[t]]=t,this._id2color[t]=e[t]}else this._isFrozen=!1}getId(e){if(null===e)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)}},r$=Object.freeze([]),rO=class e{scopeDepth;parentScopes;fontStyle;foreground;background;constructor(e,t,r,n,a){this.scopeDepth=e,this.parentScopes=t||r$,this.fontStyle=r,this.foreground=n,this.background=a}clone(){return new e(this.scopeDepth,this.parentScopes,this.fontStyle,this.foreground,this.background)}static cloneArr(e){let t=[];for(let r=0,n=e.length;r<n;r++)t[r]=e[r].clone();return t}acceptOverwrite(e,t,r,n){this.scopeDepth>e?console.log("how did this happen?"):this.scopeDepth=e,-1!==t&&(this.fontStyle=t),0!==r&&(this.foreground=r),0!==n&&(this.background=n)}},rB=class e{constructor(e,t=[],r={}){this._mainRule=e,this._children=r,this._rulesWithParentScopes=t}_rulesWithParentScopes;static _cmpBySpecificity(e,t){if(e.scopeDepth!==t.scopeDepth)return t.scopeDepth-e.scopeDepth;let r=0,n=0;for(;">"===e.parentScopes[r]&&r++,">"===t.parentScopes[n]&&n++,!(r>=e.parentScopes.length)&&!(n>=t.parentScopes.length);){let a=t.parentScopes[n].length-e.parentScopes[r].length;if(0!==a)return a;r++,n++}return t.parentScopes.length-e.parentScopes.length}match(t){if(""!==t){let e,r,n=t.indexOf(".");if(-1===n?(e=t,r=""):(e=t.substring(0,n),r=t.substring(n+1)),this._children.hasOwnProperty(e))return this._children[e].match(r)}let r=this._rulesWithParentScopes.concat(this._mainRule);return r.sort(e._cmpBySpecificity),r}insert(t,r,n,a,i,s){let o,l,u;if(""===r)return void this._doInsertHere(t,n,a,i,s);let c=r.indexOf(".");-1===c?(o=r,l=""):(o=r.substring(0,c),l=r.substring(c+1)),this._children.hasOwnProperty(o)?u=this._children[o]:(u=new e(this._mainRule.clone(),rO.cloneArr(this._rulesWithParentScopes)),this._children[o]=u),u.insert(t+1,l,n,a,i,s)}_doInsertHere(e,t,r,n,a){if(null===t)return void this._mainRule.acceptOverwrite(e,r,n,a);for(let i=0,s=this._rulesWithParentScopes.length;i<s;i++){let s=this._rulesWithParentScopes[i];if(0===rS(s.parentScopes,t))return void s.acceptOverwrite(e,r,n,a)}-1===r&&(r=this._mainRule.fontStyle),0===n&&(n=this._mainRule.foreground),0===a&&(a=this._mainRule.background),this._rulesWithParentScopes.push(new rO(e,t,r,n,a))}},rG=class e{static toBinaryStr(e){return e.toString(2).padStart(32,"0")}
1static print(t){let r=e.getLanguageId(t),n=e.getTokenType(t),a=e.getFontStyle(t);console.log({languageId:r,tokenType:n,fontStyle:a,foreground:e.getForeground(t),background:e.getBackground(t)})}static getLanguageId(e){return(255&e)>>>0}static getTokenType(e){return(768&e)>>>8}static containsBalancedBrackets(e){return(1024&e)!=0}static getFontStyle(e){return(30720&e)>>>11}static getForeground(e){return(0xff8000&e)>>>15}static getBackground(e){return(0xff000000&e)>>>24}static set(t,r,n,a,i,s,o){let l=e.getLanguageId(t),u=e.getTokenType(t),c=+!!e.containsBalancedBrackets(t),d=e.getFontStyle(t),p=e.getForeground(t),h=e.getBackground(t);return 0!==r&&(l=r),8!==n&&(u=n),null!==a&&(c=+!!a),-1!==i&&(d=i),0!==s&&(p=s),0!==o&&(h=o),(l|u<<8|c<<10|d<<11|p<<15|h<<24)>>>0}};function rD(e,t){var r;let n,a,i=[],s=(r=e,a=(n=/([LR]:|[\w\.:][\w\.:\-]*|[\,\|\-\(\)])/g).exec(r),{next:()=>{if(!a)return null;let e=a[0];return a=n.exec(r),e}}),o=s.next();for(;null!==o;){let e=0;if(2===o.length&&":"===o.charAt(1)){switch(o.charAt(0)){case"R":e=1;break;case"L":e=-1;break;default:console.log(`Unknown priority ${o} in scope selector`)}o=s.next()}let t=u();if(i.push({matcher:t,priority:e}),","!==o)break;o=s.next()}return i;function l(){if("-"===o){o=s.next();let e=l();return t=>!!e&&!e(t)}if("("===o){o=s.next();let e=function(){let e=[],t=u();for(;t&&(e.push(t),"|"===o||","===o);){do o=s.next();while("|"===o||","===o)t=u()}return t=>e.some(e=>e(t))}();return")"===o&&(o=s.next()),e}if(rF(o)){let e=[];do e.push(o),o=s.next();while(rF(o))return r=>t(e,r)}return null}function u(){let e=[],t=l();for(;t;)e.push(t),t=l();return t=>e.every(e=>e(t))}}function rF(e){return!!e&&!!e.match(/[\w\.:]+/)}var rU=((o=rU||{})[o.None=0]="None",o[o.NotBeginString=1]="NotBeginString",o[o.NotEndString=2]="NotEndString",o[o.NotBeginPosition=4]="NotBeginPosition",o[o.DebugCall=8]="DebugCall",o);function rq(e){"function"==typeof e.dispose&&e.dispose()}var rW=class{constructor(e){this.scopeName=e}toKey(){return this.scopeName}},rz=class{constructor(e,t){this.scopeName=e,this.ruleName=t}toKey(){return`${this.scopeName}#${this.ruleName}`}},rH=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))}},rV=class{constructor(e,t){this.repo=e,this.initialScopeName=t,this.seenFullScopeRequests.add(this.initialScopeName),this.Q=[new rW(this.initialScopeName)]}seenFullScopeRequests=new Set;seenPartialScopeRequests=new Set;Q;processQueue(){let e=this.Q;this.Q=[];let t=new rH;for(let r of e)!function(e,t,r,n){let a=r.lookup(e.scopeName);if(!a){if(e.scopeName===t)throw Error(`No grammar provided for <${t}>`);return}let i=r.lookup(t);e instanceof rW?rX({baseGrammar:i,selfGrammar:a},n):rQ(e.ruleName,{baseGrammar:i,selfGrammar:a,repository:a.repository},n);let s=r.injections(e.scopeName);if(s)for(let e of s)n.add(new rW(e))}(r,this.initialScopeName,this.repo,t);for(let e of t.references)if(e instanceof rW){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 rQ(e,t,r){t.repository&&t.repository[e]&&rK([t.repository[e]],t,r)}function rX(e,t){e.selfGrammar.patterns&&Array.isArray(e.selfGrammar.patterns)&&rK(e.selfGrammar.patterns,{...e,repository:e.selfGrammar.repository},t),e.selfGrammar.injections&&rK(Object.values(e.selfGrammar.injections),{...e,repository:e.selfGrammar.repository},t)}function rK(e,t,r){for(let n of e){if(r.visitedRule.has(n))continue;r.visitedRule.add(n);let e=n.repository?rC({},t.repository,n.repository):t.repository;Array.isArray(n.patterns)&&rK(n.patterns,{...t,repository:e},r);let a=n.include;if(!a)continue;let i=r2(a);switch(i.kind){case 0:rX({...t,selfGrammar:t.baseGrammar},r);break;case 1:rX(t,r);break;case 2:rQ(i.ruleName,{...t,repository:e},r);break;case 3:case 4:let s=i.scopeName===t.selfGrammar.scopeName?t.selfGrammar:i.scopeName===t.baseGrammar.scopeName?t.baseGrammar:void 0;if(s){let n={baseGrammar:t.baseGrammar,selfGrammar:s,repository:e};4===i.kind?rQ(i.ruleName,n,r):rX(n,r)}else 4===i.kind?r.add(new rz(i.scopeName,i.ruleName)):r.add(new rW(i.scopeName))}}}var rJ=class{kind=0},rZ=class{kind=1},rY=class{constructor(e){this.ruleName=e}kind=2},r0=class{constructor(e){this.scopeName=e}kind=3},r1=class{constructor(e,t){this.scopeName=e,this.ruleName=t}kind=4};
1function r2(e){if("$base"===e)return new rJ;if("$self"===e)return new rZ;let t=e.indexOf("#");return -1===t?new r0(e):0===t?new rY(e.substring(1)):new r1(e.substring(0,t),e.substring(t+1))}var r5=/\\(\d+)/,r3=/\\(\d+)/g;Symbol("RuleId");var r6=class{$location;id;_nameIsCapturing;_name;_contentNameIsCapturing;_contentName;constructor(e,t,r,n){this.$location=e,this.id=t,this._name=r||null,this._nameIsCapturing=r_.hasCaptures(this._name),this._contentName=n||null,this._contentNameIsCapturing=r_.hasCaptures(this._contentName)}get debugName(){let e=this.$location?`${function e(t){let r=~t.lastIndexOf("/")||~t.lastIndexOf("\\");return 0===r?t:~r==t.length-1?e(t.substring(0,t.length-1)):t.substr(~r+1)}(this.$location.filename)}:${this.$location.line}`:"unknown";return`${this.constructor.name}#${this.id} @ ${e}`}getName(e,t){return this._nameIsCapturing&&null!==this._name&&null!==e&&null!==t?r_.replaceCaptures(this._name,e,t):this._name}getContentName(e,t){return this._contentNameIsCapturing&&null!==this._contentName?r_.replaceCaptures(this._contentName,e,t):this._contentName}},r8=class extends r6{retokenizeCapturedWithRuleId;constructor(e,t,r,n,a){super(e,t,r,n),this.retokenizeCapturedWithRuleId=a}dispose(){}collectPatterns(e,t){throw Error("Not supported!")}compile(e,t){throw Error("Not supported!")}compileAG(e,t,r,n){throw Error("Not supported!")}},r4=class extends r6{_match;captures;_cachedCompiledPatterns;constructor(e,t,r,n,a){super(e,t,r,null),this._match=new nr(n,this.id),this.captures=a,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=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,r,n){return this._getCachedCompiledPatterns(e).compileAG(e,r,n)}_getCachedCompiledPatterns(e){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new nn,this.collectPatterns(e,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},r7=class extends r6{hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(e,t,r,n,a){super(e,t,r,n),this.patterns=a.patterns,this.hasMissingPatterns=a.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}collectPatterns(e,t){for(let r of this.patterns)e.getRule(r).collectPatterns(e,t)}compile(e,t){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,t,r,n){return this._getCachedCompiledPatterns(e).compileAG(e,r,n)}_getCachedCompiledPatterns(e){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new nn,this.collectPatterns(e,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},r9=class extends r6{_begin;beginCaptures;_end;endHasBackReferences;endCaptures;applyEndPatternLast;hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(e,t,r,n,a,i,s,o,l,u){super(e,t,r,n),this._begin=new nr(a,this.id),this.beginCaptures=i,this._end=new nr(s||"ï¿¿",-1),this.endHasBackReferences=this._end.hasBackReferences,this.endCaptures=o,this.applyEndPatternLast=l||!1,this.patterns=u.patterns,this.hasMissingPatterns=u.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=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,r,n){return this._getCachedCompiledPatterns(e,t).compileAG(e,r,n)}_getCachedCompiledPatterns(e,t){if(!this._cachedCompiledPatterns){for(let t of(this._cachedCompiledPatterns=new nn,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}},ne=class extends r6{_begin;beginCaptures;whileCaptures;_while;whileHasBackReferences;hasMissingPatterns;patterns;_cachedCompiledPatterns;_cachedCompiledWhilePatterns;constructor(e,t,r,n,a,i,s,o,l){super(e,t,r,n),this._begin=new nr(a,this.id),this.beginCaptures=i,this.whileCaptures=o,this._while=ne
1w nr(s,-2),this.whileHasBackReferences=this._while.hasBackReferences,this.patterns=l.patterns,this.hasMissingPatterns=l.hasMissingPatterns,this._cachedCompiledPatterns=null,this._cachedCompiledWhilePatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null),this._cachedCompiledWhilePatterns&&(this._cachedCompiledWhilePatterns.dispose(),this._cachedCompiledWhilePatterns=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,r,n){return this._getCachedCompiledPatterns(e).compileAG(e,r,n)}_getCachedCompiledPatterns(e){if(!this._cachedCompiledPatterns)for(let t of(this._cachedCompiledPatterns=new nn,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,r,n){return this._getCachedCompiledWhilePatterns(e,t).compileAG(e,r,n)}_getCachedCompiledWhilePatterns(e,t){return this._cachedCompiledWhilePatterns||(this._cachedCompiledWhilePatterns=new nn,this._cachedCompiledWhilePatterns.push(this._while.hasBackReferences?this._while.clone():this._while)),this._while.hasBackReferences&&this._cachedCompiledWhilePatterns.setSource(0,t||"ï¿¿"),this._cachedCompiledWhilePatterns}
1},nt=class e{static createCaptureRule(e,t,r,n,a){return e.registerRule(e=>new r8(t,e,r,n,a))}static getCompiledRuleId(t,r,n){return t.id||r.registerRule(a=>{if(t.id=a,t.match)return new r4(t.$vscodeTextmateLocation,t.id,t.name,t.match,e._compileCaptures(t.captures,r,n));if(void 0===t.begin){t.repository&&(n=rC({},n,t.repository));let a=t.patterns;return void 0===a&&t.include&&(a=[{include:t.include}]),new r7(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,e._compilePatterns(a,r,n))}return t.while?new ne(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,t.begin,e._compileCaptures(t.beginCaptures||t.captures,r,n),t.while,e._compileCaptures(t.whileCaptures||t.captures,r,n),e._compilePatterns(t.patterns,r,n)):new r9(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,t.begin,e._compileCaptures(t.beginCaptures||t.captures,r,n),t.end,e._compileCaptures(t.endCaptures||t.captures,r,n),t.applyEndPatternLast,e._compilePatterns(t.patterns,r,n))}),t.id}static _compileCaptures(t,r,n){let a=[];if(t){let i=0;for(let e in t){if("$vscodeTextmateLocation"===e)continue;let t=parseInt(e,10);t>i&&(i=t)}for(let e=0;e<=i;e++)a[e]=null;for(let i in t){if("$vscodeTextmateLocation"===i)continue;let s=parseInt(i,10),o=0;t[i].patterns&&(o=e.getCompiledRuleId(t[i],r,n)),a[s]=e.createCaptureRule(r,t[i].$vscodeTextmateLocation,t[i].name,t[i].contentName,o)}}return a}static _compilePatterns(t,r,n){let a=[];if(t)for(let i=0,s=t.length;i<s;i++){let s=t[i],o=-1;if(s.include){let t=r2(s.include);switch(t.kind){case 0:case 1:o=e.getCompiledRuleId(n[s.include],r,n);break;case 2:let a=n[t.ruleName];a&&(o=e.getCompiledRuleId(a,r,n));break;case 3:case 4:let i=t.scopeName,l=4===t.kind?t.ruleName:null,u=r.getExternalGrammar(i,n);if(u)if(l){let t=u.repository[l];t&&(o=e.getCompiledRuleId(t,r,u.repository))}else o=e.getCompiledRuleId(u.repository.$self,r,u.repository)}}else o=e.getCompiledRuleId(s,r,n);if(-1!==o){let e=r.getRule(o),t=!1;if((e instanceof r7||e instanceof r9||e instanceof ne)&&e.hasMissingPatterns&&0===e.patterns.length&&(t=!0),t)continue;a.push(o)}}return{patterns:a,hasMissingPatterns:(t?t.length:0)!==a.length}}},nr=class e{source;ruleId;hasAnchor;hasBackReferences;_anchorCache;constructor(e,t){if(e&&"string"==typeof e){const t=e.length;let r=0,n=[],a=!1;for(let i=0;i<t;i++)if("\\"===e.charAt(i)&&i+1<t){const t=e.charAt(i+1);"z"===t?(n.push(e.substring(r,i)),n.push("$(?!\\n)(?<!\\n)"),r=i+2):("A"===t||"G"===t)&&(a=!0),i++}this.hasAnchor=a,0===r?this.source=e:(n.push(e.substring(r,t)),this.source=n.join(""))}else this.hasAnchor=!1,this.source=e;this.hasAnchor?this._anchorCache=this._buildAnchorCache():this._anchorCache=null,this.ruleId=t,"string"==typeof this.source?this.hasBackReferences=r5.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("string"!=typeof this.source)throw Error("This method should only be called if the source is a string");let r=t.map(t=>e.substring(t.start,t.end));return r3.lastIndex=0,this.source.replace(r3,(e,t)=>rE(r[parseInt(t,10)]||""))}_buildAnchorCache(){let e,t,r,n;if("string"!=typeof this.source)throw Error("This method should only be called if the source is a string");let a=[],i=[],s=[],o=[];for(e=0,t=this.source.length;e<t;e++)r=this.source.charAt(e),a[e]=r,i[e]=r,s[e]=r,o[e]=r,"\\"===r&&e+1<t&&("A"===(n=this.source.charAt(e+1))?(a[e+1]="ï¿¿",i[e+1]="ï¿¿",s[e+1]="A",o[e+1]="A"):"G"===n?(a[e+1]="ï¿¿",i[e+1]="G",s[e+1]="ï¿¿",o[e+1]="G"):(a[e+1]=n,i[e+1]=n,s[e+1]=n,o[e+1]=n),e
1++);return{A0_G0:a.join(""),A0_G1:i.join(""),A1_G0:s.join(""),A1_G1:o.join("")}}resolveAnchors(e,t){if(!this.hasAnchor||!this._anchorCache||"string"!=typeof this.source)return this.source;if(e)if(t)return this._anchorCache.A1_G1;else return this._anchorCache.A1_G0;return t?this._anchorCache.A0_G1:this._anchorCache.A0_G0}},nn=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(),this._cached=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 na(e,t,this._items.map(e=>e.ruleId))}return this._cached}compileAG(e,t,r){if(!this._hasAnchors)return this.compile(e);if(t)if(r)return this._anchorCache.A1_G1||(this._anchorCache.A1_G1=this._resolveAnchors(e,t,r)),this._anchorCache.A1_G1;else return this._anchorCache.A1_G0||(this._anchorCache.A1_G0=this._resolveAnchors(e,t,r)),this._anchorCache.A1_G0;return r?(this._anchorCache.A0_G1||(this._anchorCache.A0_G1=this._resolveAnchors(e,t,r)),this._anchorCache.A0_G1):(this._anchorCache.A0_G0||(this._anchorCache.A0_G0=this._resolveAnchors(e,t,r)),this._anchorCache.A0_G0)}_resolveAnchors(e,t,r){return new na(e,this._items.map(e=>e.resolveAnchors(t,r)),this._items.map(e=>e.ruleId))}},na=class{constructor(e,t,r){this.regExps=t,this.rules=r,this.scanner=e.createOnigScanner(t)}scanner;dispose(){"function"==typeof this.scanner.dispose&&this.scanner.dispose()}toString(){let e=[];for(let t=0,r=this.rules.length;t<r;t++)e.push("   - "+this.rules[t]+": "+this.regExps[t]);return e.join("\n")}findNextMatchSync(e,t,r){let n=this.scanner.findNextMatchSync(e,t,r);return n?{ruleId:this.rules[n.index],captureIndices:n.captureIndices}:null}},ni=class{constructor(e,t){this.languageId=e,this.tokenType=t}},ns=class e{_defaultAttributes;_embeddedLanguagesMatcher;constructor(e,t){this._defaultAttributes=new ni(e,8),this._embeddedLanguagesMatcher=new no(Object.entries(t||{}))}getDefaultAttributes(){return this._defaultAttributes}getBasicScopeAttributes(t){return null===t?e._NULL_SCOPE_METADATA:this._getBasicScopeAttributes.get(t)}static _NULL_SCOPE_METADATA=new ni(0,0);_getBasicScopeAttributes=new rI(e=>new ni(this._scopeToLanguage(e),this._toStandardTokenType(e)));_scopeToLanguage(e){return this._embeddedLanguagesMatcher.match(e)||0}_toStandardTokenType(t){let r=t.match(e.STANDARD_TOKEN_TYPE_REGEXP);if(!r)return 8;switch(r[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/},no=class{values;scopesRegExp;constructor(e){if(0===e.length)this.values=null,this.scopesRegExp=null;else{this.values=new Map(e);const t=e.map(([e,t])=>rE(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])}};void 0!==tS.default&&tS.default.env.VSCODE_TEXTMATE_DEBUG;var nl=class{constructor(e,t){this.stack=e,this.stoppedEarly=t}};function nu(e,t,r,n,a,i,s,o){let l=t.content.length,u=!1,c=-1;if(s){let s=function(e,t,r,n,a,i){let s=a.beginRuleCapturedEOL?0:-1,o=[];for(let t=a;t;t=t.pop()){let r=t.getRule(e);r instanceof ne&&o.push({rule:r,stack:t})}for(let h=o.pop();h;h=o.pop()){var l,u,c,d,p;let{ruleScanner:o,findOptions:f}=(l=h.rule,u=e,c=h.stack.endRule,d=r,p=n===s,{ruleScanner:l.compileWhileAG(u,c,d,p),findOptions:0}),m=o.findNextMatchSync(t,n,f);if(m){if(-2!==m.ruleId){a=h.stack.pop();break}m.captureIndices&&m.captureIndices.length&&(i.produce(h.stack,m.captureIndices[0].start),nd(e,t,r,h.stack,i,h.rule.whileCaptures,m.captureIndices),i.produce(h.stack,m.captureIndices[0].end),s=m.captureIndices[0].end,m.captureIndices[0].end>n&&(n=m.captureIndices[0].end,r=!1))}else{a=h.stack.pop();break}}
1return{stack:a,linePos:n,anchorPosition:s,isFirstLine:r}}(e,t,r,n,a,i);a=s.stack,n=s.linePos,r=s.isFirstLine,c=s.anchorPosition}let d=Date.now();for(;!u;){if(0!==o&&Date.now()-d>o)return new nl(a,!0);!function(){let s=function(e,t,r,n,a,i){let s=function(e,t,r,n,a,i){let{ruleScanner:s,findOptions:o}=nc(a.getRule(e),e,a.endRule,r,n===i),l=s.findNextMatchSync(t,n,o);return l?{captureIndices:l.captureIndices,matchedRuleId:l.ruleId}:null}(e,t,r,n,a,i),o=e.getInjections();if(0===o.length)return s;let l=function(e,t,r,n,a,i,s){let o,l=Number.MAX_VALUE,u=null,c=0,d=i.contentNameScopesList.getScopeNames();for(let i=0,p=e.length;i<p;i++){let p=e[i];if(!p.matcher(d))continue;let{ruleScanner:h,findOptions:f}=nc(t.getRule(p.ruleId),t,null,n,a===s),m=h.findNextMatchSync(r,a,f);if(!m)continue;let g=m.captureIndices[0].start;if(!(g>=l)&&(l=g,u=m.captureIndices,o=m.ruleId,c=p.priority,l===a))break}return u?{priorityMatch:-1===c,captureIndices:u,matchedRuleId:o}:null}(o,e,t,r,n,a,i);if(!l)return s;if(!s)return l;let u=s.captureIndices[0].start,c=l.captureIndices[0].start;return c<u||l.priorityMatch&&c===u?l:s}(e,t,r,n,a,c);if(!s){i.produce(a,l),u=!0;return}let o=s.captureIndices,d=s.matchedRuleId,p=!!o&&o.length>0&&o[0].end>n;if(-1===d){let s=a.getRule(e);i.produce(a,o[0].start),a=a.withContentNameScopesList(a.nameScopesList),nd(e,t,r,a,i,s.endCaptures,o),i.produce(a,o[0].end);let d=a;if(a=a.parent,c=d.getAnchorPos(),!p&&d.getEnterPos()===n){a=d,i.produce(a,l),u=!0;return}}else{let s=e.getRule(d);i.produce(a,o[0].start);let h=a,f=s.getName(t.content,o),m=a.contentNameScopesList.pushAttributed(f,e);if(a=a.push(d,n,c,o[0].end===l,null,m,m),s instanceof r9){nd(e,t,r,a,i,s.beginCaptures,o),i.produce(a,o[0].end),c=o[0].end;let n=s.getContentName(t.content,o),d=m.pushAttributed(n,e);if(a=a.withContentNameScopesList(d),s.endHasBackReferences&&(a=a.withEndRule(s.getEndWithResolvedBackReferences(t.content,o))),!p&&h.hasSameRuleAs(a)){a=a.pop(),i.produce(a,l),u=!0;return}}else if(s instanceof ne){nd(e,t,r,a,i,s.beginCaptures,o),i.produce(a,o[0].end),c=o[0].end;let n=s.getContentName(t.content,o),d=m.pushAttributed(n,e);if(a=a.withContentNameScopesList(d),s.whileHasBackReferences&&(a=a.withEndRule(s.getWhileWithResolvedBackReferences(t.content,o))),!p&&h.hasSameRuleAs(a)){a=a.pop(),i.produce(a,l),u=!0;return}}else if(nd(e,t,r,a,i,s.captures,o),i.produce(a,o[0].end),a=a.pop(),!p){a=a.safePop(),i.produce(a,l),u=!0;return}}o[0].end>n&&(n=o[0].end,r=!1)}()}return new nl(a,!1)}function nc(e,t,r,n,a){return{ruleScanner:e.compileAG(t,r,n,a),findOptions:0}}function nd(e,t,r,n,a,i,s){if(0===i.length)return;let o=t.content,l=Math.min(i.length,s.length),u=[],c=s[0].end;for(let t=0;t<l;t++){let l=i[t];if(null===l)continue;let d=s[t];if(0===d.length)continue;if(d.start>c)break;for(;u.length>0&&u[u.length-1].endPos<=d.start;)a.produceFromScopes(u[u.length-1].scopes,u[u.length-1].endPos),u.pop();if(u.length>0?a.produceFromScopes(u[u.length-1].scopes,d.start):a.produce(n,d.start),l.retokenizeCapturedWithRuleId){let t=l.getName(o,s),i=n.contentNameScopesList.pushAttributed(t,e),u=l.getContentName(o,s),c=i.pushAttributed(u,e),p=n.push(l.retokenizeCapturedWithRuleId,d.start,-1,!1,null,i,c),h=e.createOnigString(o.substring(0,d.end));nu(e,h,r&&0===d.start,d.start,p,a,!1,0),rq(h);continue}let p=l.getName(o,s);if(null!==p){let t=(u.length>0?u[u.length-1].scopes:n.contentNameScopesList).pushAttributed(p,e);u.push(new np(t,d.end))}}for(;u.length>0;)a.produceFromScopes(u[u.length-1].scopes,u[u.length-1].endPos),u.pop()}var np=class{scopes;endPos;constructor(e,t){this.scopes=e,this.endPos=t}};function nh(e,t,r,n,a){let i=rD(t,nf),s=nt.getCompiledRuleId(r,n,a.repository);for(let r of i)e.push({debugSelector:t,matcher:r.matcher,ruleId:s,grammar:a,priority:r.priority})}function nf(e,t){if(t.length<e.length)return!1;let r=0;return e.every(e=>{for(let n=r;n<t.length;n++)if(function(e,t){if(!e)return!1;if(e===t)return!0;let r=t.length;return e.length>r&&e.substr(0,r)===t&&"."===e[r]}(t[n],e))return r=n+1,!0;return!1})}var nm=class{constructor(e,t,r,n,a,i,s,o){if(this._rootScopeName=e,this.balancedBracketSelectors=i,this._onigLib=o,this._basicScopeAttributesProvider=new ns(r,n),this._rootId=-1,this._lastRuleId=0,this._ruleId2desc=[null],this._includedGrammars={},this._grammarRepository=s,this._grammar=ng(t,null),this._injections=null,this._tokenTypeMatchers=[],a)for(const e of Object.keys(a))for(const t of rD(e,nf))this._tokenTypeMatchers.push({matcher:t.matcher,type:a[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=[],t=this._rootScopeName,r=({lookup:e=>e===this._rootScopeName?this._grammar:this.getExternalGrammar(e),injections:e=>this._grammarRepository.injections(e)}).lookup(t);
1if(r){let n=r.injections;if(n)for(let t in n)nh(e,t,n[t],this,r);let a=this._grammarRepository.injections(t);a&&a.forEach(t=>{let r=this.getExternalGrammar(t);if(r){let t=r.injectionSelector;t&&nh(e,t,r,this,r)}})}return e.sort((e,t)=>e.priority-t.priority),e}getInjections(){return null===this._injections&&(this._injections=this._collectInjections()),this._injections}registerRule(e){let t=++this._lastRuleId,r=e(t);return this._ruleId2desc[t]=r,r}getRule(e){return this._ruleId2desc[e]}getExternalGrammar(e,t){if(this._includedGrammars[e])return this._includedGrammars[e];if(this._grammarRepository){let r=this._grammarRepository.lookup(e);if(r)return this._includedGrammars[e]=ng(r,t&&t.$base),this._includedGrammars[e]}}tokenizeLine(e,t,r=0){let n=this._tokenize(e,t,!1,r);return{tokens:n.lineTokens.getResult(n.ruleStack,n.lineLength),ruleStack:n.ruleStack,stoppedEarly:n.stoppedEarly}}tokenizeLine2(e,t,r=0){let n=this._tokenize(e,t,!0,r);return{tokens:n.lineTokens.getBinaryResult(n.ruleStack,n.lineLength),ruleStack:n.ruleStack,stoppedEarly:n.stoppedEarly}}_tokenize(e,t,r,n){let a;if(-1===this._rootId&&(this._rootId=nt.getCompiledRuleId(this._grammar.repository.$self,this,this._grammar.repository),this.getInjections()),t&&t!==ny.NULL)a=!1,t.reset();else{let e;a=!0;let r=this._basicScopeAttributesProvider.getDefaultAttributes(),n=this.themeProvider.getDefaults(),i=rG.set(0,r.languageId,r.tokenType,null,n.fontStyle,n.foregroundId,n.backgroundId),s=this.getRule(this._rootId).getName(null,null);e=s?nb.createRootAndLookUpScopeName(s,i,this):nb.createRoot("unknown",i),t=new ny(null,this._rootId,-1,-1,!1,null,e,e)}e+="\n";let i=this.createOnigString(e),s=i.content.length,o=new nw(r,e,this._tokenTypeMatchers,this.balancedBracketSelectors),l=nu(this,i,a,0,t,o,!0,n);return rq(i),{lineLength:s,lineTokens:o,ruleStack:l.stack,stoppedEarly:l.stoppedEarly}}};function ng(e,t){return(e=function e(t){return Array.isArray(t)?function(t){let r=[];for(let n=0,a=t.length;n<a;n++)r[n]=e(t[n]);return r}(t):t instanceof RegExp?t:"object"==typeof t?function(t){let r={};for(let n in t)r[n]=e(t[n]);return r}(t):t}(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 nb=class e{constructor(e,t,r){this.parent=e,this.scopePath=t,this.tokenAttributes=r}static fromExtension(t,r){let n=t,a=t?.scopePath??null;for(let t of r)n=new e(n,a=rT.push(a,t.scopeNames),t.encodedTokenAttributes);return n}static createRoot(t,r){return new e(null,new rT(null,t),r)}static createRootAndLookUpScopeName(t,r,n){let a=n.getMetadataForScope(t),i=new rT(null,t),s=n.themeProvider.themeMatch(i),o=e.mergeAttributes(r,a,s);return new e(null,i,o)}get scopeName(){return this.scopePath.scopeName}toString(){return this.getScopeNames().join(" ")}equals(t){return e.equals(this,t)}static equals(e,t){for(;;){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}}static mergeAttributes(e,t,r){let n=-1,a=0,i=0;return null!==r&&(n=r.fontStyle,a=r.foregroundId,i=r.backgroundId),rG.set(e,t.languageId,t.tokenType,null,n,a,i)}pushAttributed(t,r){if(null===t)return this;if(-1===t.indexOf(" "))return e._pushAttributed(this,t,r);let n=t.split(/ /g),a=this;for(let t of n)a=e._pushAttributed(a,t,r);return a}static _pushAttributed(t,r,n){let a=n.getMetadataForScope(r),i=t.scopePath.push(r),s=n.themeProvider.themeMatch(i),o=e.mergeAttributes(t.tokenAttributes,a,s);return new e(t,i,o)}getScopeNames(){return this.scopePath.getSegments()}getExtensionIfDefined(e){let t=[],r=this;for(;r&&r!==e;)t.push({encodedTokenAttributes:r.tokenAttributes,scopeNames:r.scopePath.getExtensionIfDefined(r.parent?.scopePath??null)}),r=r.parent;return r===e?t.reverse():void 0}},ny=class e{constructor(e,t,r,n,a,i,s,o){this.parent=e,this.ruleId=t,this.beginRuleCapturedEOL=a,this.endRule=i,this.nameScopesList=s,this.contentNameScopesList=o,this.depth=this.parent?this.parent.depth+1:1,this._enterPos=r,this._anchorPos=n}_stackElementBrand=void 0;static NULL=new e(null,0,0,0,!1,null,null,null);_enterPos;_anchorPos;depth;equals(t){return null!==t&&e._equals(this,t)}static _equals(e,t){return e===t||!!this._structuralEquals(e,t)&&nb.equals(e.contentNameScopesList,t.contentNameScopesList)}static _structuralEquals(e,t){for(;;){if(e===t||!e&&!t)return!0;
1if(!e||!t||e.depth!==t.depth||e.ruleId!==t.ruleId||e.endRule!==t.endRule)return!1;e=e.parent,t=t.parent}}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,r,n,a,i,s,o){return new e(this,t,r,n,a,i,s,o)}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: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,r){let n=nb.fromExtension(t?.nameScopesList??null,r.nameScopesList);return new e(t,r.ruleId,r.enterPos??-1,r.anchorPos??-1,r.beginRuleCapturedEOL,r.endRule,n,nb.fromExtension(n,r.contentNameScopesList))}},nv=class{balancedBracketScopes;unbalancedBracketScopes;allowAny=!1;constructor(e,t){this.balancedBracketScopes=e.flatMap(e=>"*"===e?(this.allowAny=!0,[]):rD(e,nf).map(e=>e.matcher)),this.unbalancedBracketScopes=t.flatMap(e=>rD(e,nf).map(e=>e.matcher))}get matchesAlways(){return this.allowAny&&0===this.unbalancedBracketScopes.length}get matchesNever(){return 0===this.balancedBracketScopes.length&&!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}},nw=class{constructor(e,t,r,n){this.balancedBracketSelectors=n,this._emitBinaryTokens=e,this._tokenTypeOverrides=r,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 r=e?.tokenAttributes??0,n=!1;if(this.balancedBracketSelectors?.matchesAlways&&(n=!0),this._tokenTypeOverrides.length>
10||this.balancedBracketSelectors&&!this.balancedBracketSelectors.matchesAlways&&!this.balancedBracketSelectors.matchesNever){let t=e?.getScopeNames()??[];for(let e of this._tokenTypeOverrides)e.matcher(t)&&(r=rG.set(r,0,e.type,null,-1,0,0));this.balancedBracketSelectors&&(n=this.balancedBracketSelectors.match(t))}if(n&&(r=rG.set(r,0,8,n,-1,0,0)),this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-1]===r){this._lastTokenEndIndex=t;return}this._binaryTokens.push(this._lastTokenEndIndex),this._binaryTokens.push(r),this._lastTokenEndIndex=t;return}let r=e?.getScopeNames()??[];this._tokens.push({startIndex:this._lastTokenEndIndex,endIndex:t,scopes:r}),this._lastTokenEndIndex=t}getResult(e,t){return this._tokens.length>0&&this._tokens[this._tokens.length-1].startIndex===t-1&&this._tokens.pop(),0===this._tokens.length&&(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()),0===this._binaryTokens.length&&(this._lastTokenEndIndex=-1,this.produce(e,t),this._binaryTokens[this._binaryTokens.length-2]=0);let r=new Uint32Array(this._binaryTokens.length);for(let e=0,t=this._binaryTokens.length;e<t;e++)r[e]=this._binaryTokens[e];return r}},nk=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,r,n,a){if(!this._grammars.has(e)){let i=this._rawGrammars.get(e);if(!i)return null;this._grammars.set(e,new nm(e,i,t,r,n,a,this,this._onigLib))}return this._grammars.get(e)}},nx=class{_options;_syncRegistry;_ensureGrammarCache;constructor(e){this._options=e,this._syncRegistry=new nk(rR.createFromRawTheme(e.theme,e.colorMap),e.onigLib),this._ensureGrammarCache=new Map}dispose(){this._syncRegistry.dispose()}setTheme(e,t){this._syncRegistry.setTheme(rR.createFromRawTheme(e,t))}getColorMap(){return this._syncRegistry.getColorMap()}loadGrammarWithEmbeddedLanguages(e,t,r){return this.loadGrammarWithConfiguration(e,t,{embeddedLanguages:r})}loadGrammarWithConfiguration(e,t,r){return this._loadGrammar(e,t,r.embeddedLanguages,r.tokenTypes,new nv(r.balancedBracketSelectors||[],r.unbalancedBracketSelectors||[]))}loadGrammar(e){return this._loadGrammar(e,0,null,null,null)}_loadGrammar(e,t,r,n,a){let i=new rV(this._syncRegistry,e);for(;i.Q.length>0;)i.Q.map(e=>this._loadSingleGrammar(e.scopeName)),i.processQueue();return this._grammarForScopeName(e,t,r,n,a)}_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 r="function"==typeof this._options.getInjections?this._options.getInjections(e):void 0;this._syncRegistry.addGrammar(t,r)}}addGrammar(e,t=[],r=0,n=null){return this._syncRegistry.addGrammar(e,t),this._grammarForScopeName(e.scopeName,r,n)}_grammarForScopeName(e,t=0,r=null,n=null,a=null){return this._syncRegistry.grammarForScopeName(e,t,r,n,a)}},nC=ny.NULL,nA=e.i(577),n_=e.i(13800),nS=e.i(79694);let nN=/["&'<>`]/g,nE=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,nI=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,nR=/[|\\{}()[\]^$+*?.]/g,nT=new WeakMap,nP=/[\dA-Fa-f]/,nM=/\d/,nj=["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","oslas
1h","otilde","ouml","para","plusmn","pound","quot","raquo","reg","sect","shy","sup1","sup2","sup3","szlig","thorn","times","uacute","ucirc","ugrave","uml","uuml","yacute","yen","yuml"],nL={nbsp:" ",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
1:"⊄",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:"€"},n$=["cent","copy","divide","gt","lt","not","para","times"],nO={}.hasOwnProperty,nB={};for(t in nL)nO.call(nL,t)&&(nB[nL[t]]=t);let nG=/[^\dA-Za-z]/;function nD(e,t,r){var n,a;let i,s,o=(n=r.omitOptionalSemicolons,i="&#x"+e.toString(16).toUpperCase(),n&&t&&!nP.test(String.fromCharCode(t))?i:i+";");if((r.useNamedReferences||r.useShortestReferences)&&(s=function(e,t,r,n){let a=String.fromCharCode(e);if(nO.call(nB,a)){let e=nB[a],i="&"+e;return r&&nj.includes(e)&&!n$.includes(e)&&(!n||t&&61!==t&&nG.test(String.fromCharCode(t)))?i:i+";"}return""}(e,t,r.omitOptionalSemicolons,r.attribute)),(r.useShortestReferences||!s)&&r.useShortestReferences){let n,i=(a=r.omitOptionalSemicolons,n="&#"+String(e),a&&t&&!nM.test(String.fromCharCode(t))?n:n+";");i.length<o.length&&(o=i)}return s&&(!r.useShortestReferences||s.length<o.length)?s:o}function nF(e,t){let r;var n,a=e,i=Object.assign({format:nD},t);
1if(a=a.replace(i.subset?(n=i.subset,(r=nT.get(n))||(r=function(e){let t=[],r=-1;for(;++r<e.length;)t.push(e[r].replace(nR,"\\$&"));return RegExp("(?:"+t.join("|")+")","g")}(n),nT.set(n,r)),r):nN,s),i.subset||i.escapeOnly)return a;return a.replace(nE,function(e,t,r){return i.format((e.charCodeAt(0)-55296)*1024+e.charCodeAt(1)-56320+65536,r.charCodeAt(t+2),i)}).replace(nI,s);function s(e,t,r){return i.format(e.charCodeAt(0),r.charCodeAt(t+1),i)}}let nU=/^>|^->|<!--|-->|--!>|<!-$/g,nq=[">"],nW=["<",">"];var nz=e.i(70284),nH=e.i(16220),nV=e.i(73138),nQ=e.i(22365),nX=e.i(58206);let nK=nY(1),nJ=nY(-1),nZ=[];function nY(e){return function(t,r,n){let a=t?t.children:nZ,i=(r||0)+e,s=a[i];if(!n)for(;s&&(0,nX.whitespace)(s);)i+=e,s=a[i];return s}}let n0={}.hasOwnProperty;function n1(e){return function(t,r,n){return n0.call(e,t.tagName)&&e[t.tagName](t,r,n)}}let n2=n1({body:function(e,t,r){let n=nK(r,t);return!n||"comment"!==n.type},caption:n5,colgroup:n5,dd:function(e,t,r){let n=nK(r,t);return!n||"element"===n.type&&("dt"===n.tagName||"dd"===n.tagName)},dt:function(e,t,r){let n=nK(r,t);return!!(n&&"element"===n.type&&("dt"===n.tagName||"dd"===n.tagName))},head:n5,html:function(e,t,r){let n=nK(r,t);return!n||"comment"!==n.type},li:function(e,t,r){let n=nK(r,t);return!n||"element"===n.type&&"li"===n.tagName},optgroup:function(e,t,r){let n=nK(r,t);return!n||"element"===n.type&&"optgroup"===n.tagName},option:function(e,t,r){let n=nK(r,t);return!n||"element"===n.type&&("option"===n.tagName||"optgroup"===n.tagName)},p:function(e,t,r){let n=nK(r,t);return n?"element"===n.type&&("address"===n.tagName||"article"===n.tagName||"aside"===n.tagName||"blockquote"===n.tagName||"details"===n.tagName||"div"===n.tagName||"dl"===n.tagName||"fieldset"===n.tagName||"figcaption"===n.tagName||"figure"===n.tagName||"footer"===n.tagName||"form"===n.tagName||"h1"===n.tagName||"h2"===n.tagName||"h3"===n.tagName||"h4"===n.tagName||"h5"===n.tagName||"h6"===n.tagName||"header"===n.tagName||"hgroup"===n.tagName||"hr"===n.tagName||"main"===n.tagName||"menu"===n.tagName||"nav"===n.tagName||"ol"===n.tagName||"p"===n.tagName||"pre"===n.tagName||"section"===n.tagName||"table"===n.tagName||"ul"===n.tagName):!r||"element"!==r.type||"a"!==r.tagName&&"audio"!==r.tagName&&"del"!==r.tagName&&"ins"!==r.tagName&&"map"!==r.tagName&&"noscript"!==r.tagName&&"video"!==r.tagName},rp:n3,rt:n3,tbody:function(e,t,r){let n=nK(r,t);return!n||"element"===n.type&&("tbody"===n.tagName||"tfoot"===n.tagName)},td:n6,tfoot:function(e,t,r){return!nK(r,t)},th:n6,thead:function(e,t,r){let n=nK(r,t);return!!(n&&"element"===n.type&&("tbody"===n.tagName||"tfoot"===n.tagName))},tr:function(e,t,r){let n=nK(r,t);return!n||"element"===n.type&&"tr"===n.tagName}});function n5(e,t,r){let n=nK(r,t,!0);return!n||"comment"!==n.type&&!("text"===n.type&&(0,nX.whitespace)(n.value.charAt(0)))}function n3(e,t,r){let n=nK(r,t);return!n||"element"===n.type&&("rp"===n.tagName||"rt"===n.tagName)}function n6(e,t,r){let n=nK(r,t);return!n||"element"===n.type&&("td"===n.tagName||"th"===n.tagName)}let n8=n1({body:function(e){let t=nK(e,-1,!0);return!t||"comment"!==t.type&&!("text"===t.type&&(0,nX.whitespace)(t.value.charAt(0)))&&("element"!==t.type||"meta"!==t.tagName&&"link"!==t.tagName&&"script"!==t.tagName&&"style"!==t.tagName&&"template"!==t.tagName)},colgroup:function(e,t,r){let n=nJ(r,t),a=nK(e,-1,!0);return!(r&&n&&"element"===n.type&&"colgroup"===n.tagName&&n2(n,r.children.indexOf(n),r))&&!!(a&&"element"===a.type&&"col"===a.tagName)},head:function(e){let t=new Set;for(let r of e.children)if("element"===r.type&&("base"===r.tagName||"title"===r.tagName)){if(t.has(r.tagName))return!1;t.add(r.tagName)}let r=e.children[0];return!r||"element"===r.type},html:function(e){let t=nK(e,-1);return!t||"comment"!==t.type},tbody:function(e,t,r){let n=nJ(r,t),a=nK(e,-1);return!(r&&n&&"element"===n.type&&("thead"===n.tagName||"tbody"===n.tagName)&&n2(n,r.children.indexOf(n),r))&&!!(a&&"element"===a.type&&"tr"===a.tagName)}}),n4={name:[["	\n\f\r &/=>".split(""),"	\n\f\r \"&'/=>`".split("")],["\0	\n\f\r \"&'/<=>".split(""),"\0	\n\f\r \"&'/<=>
1`".split("")]],unquoted:[["	\n\f\r &>".split(""),"\0	\n\f\r \"&'<=>`".split("")],["\0	\n\f\r \"&'<=>`".split(""),"\0	\n\f\r \"&'<=>`".split("")]],single:[["&'".split(""),"\"&'`".split("")],["\0&'".split(""),"\0\"&'`".split("")]],double:[['"&'.split(""),"\"&'`".split("")],['\0"&'.split(""),"\0\"&'`".split("")]]},n7=["<","&"];function n9(e,t,r,n){return r&&"element"===r.type&&("script"===r.tagName||"style"===r.tagName)?e.value:nF(e.value,Object.assign({},n.settings.characterReferences,{subset:n7}))}let ae=(0,nS.zwitch)("type",{invalid:function(e){throw Error("Expected node, not `"+e+"`")},unknown:function(e){throw Error("Cannot compile unknown node `"+e.type+"`")},handlers:{comment:function(e,t,r,n){return n.settings.bogusComments?"<?"+nF(e.value,Object.assign({},n.settings.characterReferences,{subset:nq}))+">":"<!--"+e.value.replace(nU,function(e){return nF(e,Object.assign({},n.settings.characterReferences,{subset:nW}))})+"-->"},doctype:function(e,t,r,n){return"<!"+(n.settings.upperDoctype?"DOCTYPE":"doctype")+(n.settings.tightDoctype?"":" ")+"html>"},element:function(e,t,r,n){let a,i=n.schema,s="svg"!==i.space&&n.settings.omitOptionalTags,o="svg"===i.space?n.settings.closeEmptyElements:n.settings.voids.includes(e.tagName.toLowerCase()),l=[];"html"===i.space&&"svg"===e.tagName&&(n.schema=n_.svg);let u=function(e,t){let r,n=[],a=-1;if(t){for(r in t)if(null!==t[r]&&void 0!==t[r]){let a=function(e,t,r){let n,a=(0,nV.find)(e.schema,t),i=e.settings.allowParseErrors&&"html"===e.schema.space?0:1,s=+!e.settings.allowDangerousCharacters,o=e.quote;if(a.overloadedBoolean&&(r===a.attribute||""===r)?r=!0:(a.boolean||a.overloadedBoolean)&&("string"!=typeof r||r===a.attribute||""===r)&&(r=!!r),null==r||!1===r||"number"==typeof r&&Number.isNaN(r))return"";let l=nF(a.attribute,Object.assign({},e.settings.characterReferences,{subset:n4.name[i][s]}));return!0===r||(r=Array.isArray(r)?(a.commaSeparated?nH.stringify:nQ.stringify)(r,{padLeft:!e.settings.tightCommaSeparatedLists}):String(r),e.settings.collapseEmptyAttributes&&!r)?l:(e.settings.preferUnquoted&&(n=nF(r,Object.assign({},e.settings.characterReferences,{attribute:!0,subset:n4.unquoted[i][s]}))),n!==r&&(e.settings.quoteSmart&&(0,nz.ccount)(r,o)>(0,nz.ccount)(r,e.alternative)&&(o=e.alternative),n=o+nF(r,Object.assign({},e.settings.characterReferences,{subset:("'"===o?n4.single:n4.double)[i][s],attribute:!0}))+o),l+(n?"="+n:n))}(e,r,t[r]);a&&n.push(a)}}for(;++a<n.length;){let t=e.settings.tightAttributes?n[a].charAt(n[a].length-1):void 0;a!==n.length-1&&'"'!==t&&"'"!==t&&(n[a]+=" ")}return n.join("")}(n,e.properties),c=n.all("html"===i.space&&"template"===e.tagName?e.content:e);return n.schema=i,c&&(o=!1),!u&&s&&n8(e,t,r)||(l.push("<",e.tagName,u?" "+u:""),o&&("svg"===i.space||n.settings.closeSelfClosing)&&(a=u.charAt(u.length-1),(!n.settings.tightSelfClosing||"/"===a||a&&'"'!==a&&"'"!==a)&&l.push(" "),l.push("/")),l.push(">")),l.push(c),o||s&&n2(e,t,r)||l.push("</"+e.tagName+">"),l.join("")},raw:function(e,t,r,n){return n.settings.allowDangerousHtml?e.value:n9(e,t,r,n)},root:function(e,t,r,n){return n.all(e)},text:n9}}),at={},ar={},an=[];function aa(e,t,r){return ae(e,t,r,this)}function ai(e){let t=[],r=e&&e.children||an,n=-1;for(;++n<r.length;)t[n]=this.one(r[n],n,e);return t.join("")}function as(e,t){let r="string"==typeof e?{}:{...e.colorReplacements},n="string"==typeof e?e:e.name;for(let[e,a]of Object.entries(t?.colorReplacements||{}))"string"==typeof a?r[e]=a:e===n&&Object.assign(r,a);return r}function ao(e,t){return e&&t?.[e?.toLowerCase()]||e}async function al(e){return Promise.resolve("function"==typeof e?e():e).then(e=>e.default||e)}function au(e){return!e||["plaintext","txt","text","plain"].includes(e)}function ac(e){return"ansi"===e||au(e)}function ad(e){return"none"===e}function ap(e,t){if(!t)return e;for(let r of(e.properties||={},e.properties.class||=[],"string"==typeof e.properties.class&&(e.properties.class=e.properties.class.split(/\s+/g)),Array.isArray(e.properties.class)||(e.properties.class=[]),Array.isArray(t)?t:t.split(/\s+/g)))r&&!e.properties.class.includes(r)&&e.properties.class.push(r);return e}function ah(e,t=!1){if(0===e.length)return[["",0]];let r=e.split(/(\r?\n)/g),n=0,a=[];for(let e=0;e<r.length;e+=2){let i=t?r[e]+(r[e+1]||""):r[e];a.push([i,n]),n+=r[e].length,n+=r[e+1]?.length||0}return a}let af="light-dark()",am=["color","background-color"];function ag(e){let t={};if(e.color&&(t.color=e.color),e.bgColor&&(t["background-color"]=e.bgColor),e.fontStyle){e.fontStyle&rj.Italic&&(t["font-style"]="italic"),e.fontStyle&rj.Bold&&(t["font-weight"]="bold");let r=[];e.fontStyle&rj.Underline&&r.push("underline"),e.fontStyle&rj.Strikethrough&&r.push("line-through"),r.length&&(t["text-decoration"]=r.join(" "))}return t}function ab(e){return"string"==typeof e?e:Object.entries(e).map(([e,t])=>`${e}:${t}`).join(";")}let ay=new WeakMap;function av(e,t){ay.set(e,t)}function aw(e){return ay.get(e)}class ak{_stacks={};lang;get themes(){return Object.keys(this._stacks)}get theme(){return this.themes[0]}get _stack(){return this._stacks[this.theme]}static initial(e,t){return new ak(Object.fromEntries((Array.isArray(t)?t:[t]).map(e=>[e,nC])),e)}constructor(...e){if(2===e.length){const[t,r]=e;this.lang=r,this._stacks=t}else{const[t,r,n]=e;this.lang=r,this._stacks={[n]:t}}}getInternalStack(e=this.theme){return this._stacks[e]}getScopes(e=this.theme){var t;let r,n;return t=this._stacks[e],r=[],n=new Set,!function e(t){if(n.has(t))return;n.add(t);let a=t?.nameScopesList?.scopeName;a&&r.push(a),t.parent&&e(t.parent)}(t),r}toJSON(){return{lang:this.lang,theme:this.theme,themes:this.themes,scopes:this.getScopes()}}}let ax=[function(){let e=new WeakMap;function t(t){if(!e.has(t.meta)){var r;let n,a=function(e){if("number"==typeof e){if(e<0||e>t.source.length)throw new rx(`Invalid decoration offset: ${e}. Code length: ${t.source.length}`);return{...i.indexToPos(e),offset:e}}{let t=i.lines[e.line];if(void 0===t)throw new rx(`Invalid decoration position ${JSON.stringify(e)}. Lines length: ${i.lines.length}`);let r=e.character;if(r<0&&(r=t.length+r),r<0||r>t.length)throw new rx(`Invalid decoration position ${JSON.stringify(e)}. Line ${e.line} length: ${t.length}`);return{...e,character:r,offset:i.posToIndex(e.line,r)}}},i={lines:n=ah(r=t.source,!0).map(([e])=>e),indexToPos:function(e){if(e===r.length)return{line:n.length-1,character:n[n.length-1].length};let t=e,a=0;for(let e of n){if(t<e.length)break;t-=e.length,a++}return{line:a,character:t}},posToIndex:function(e,t){let r=0;for(let t=0;t<e;t++)r+=n[t].length;return r+t}},s=(t.options.decorations||[]).map(e=>({...e,start:a(e.start),end:a(e.end)}));(function(e){for(let t=0;t<e.length;t++){let r=e[t];if(r.start.offset>r.end.offset)throw new rx(`Invalid decoration range: ${JSON.stringify(r.start)}
1 - ${JSON.stringify(r.end)}`);for(let n=t+1;n<e.length;n++){let t=e[n],a=r.start.offset<=t.start.offset&&t.start.offset<r.end.offset,i=r.start.offset<t.end.offset&&t.end.offset<=r.end.offset,s=t.start.offset<=r.start.offset&&r.start.offset<t.end.offset,o=t.start.offset<r.end.offset&&r.end.offset<=t.end.offset;if(a||i||s||o){if(a&&i||s&&o||s&&r.start.offset===r.end.offset||i&&t.start.offset===t.end.offset)continue;throw new rx(`Decorations ${JSON.stringify(r.start)} and ${JSON.stringify(t.start)} intersect.`)}}}})(s),e.set(t.meta,{decorations:s,converter:i,source:t.source})}return e.get(t.meta)}return{name:"shiki:decorations",tokens(e){let r;if(!this.options.decorations?.length)return;let n=t(this).decorations.flatMap(e=>[e.start.offset,e.end.offset]);return(r=Array.from(n instanceof Set?n:new Set(n)).sort((e,t)=>e-t)).length?e.map(e=>e.flatMap(e=>{let t=r.filter(t=>e.offset<t&&t<e.offset+e.content.length).map(t=>t-e.offset).sort((e,t)=>e-t);if(!t.length)return e;let n=0,a=[];for(let r of t)r>n&&a.push({...e,content:e.content.slice(n,r),offset:e.offset+n}),n=r;return n<e.content.length&&a.push({...e,content:e.content.slice(n),offset:e.offset+n}),a})):e},code(e){if(!this.options.decorations?.length)return;let r=t(this),n=Array.from(e.children).filter(e=>"element"===e.type&&"span"===e.tagName);if(n.length!==r.converter.lines.length)throw new rx(`Number of lines in code element (${n.length}) does not match the number of lines in the source (${r.converter.lines.length}). Failed to apply decorations.`);function a(e,t,r,a){let s=n[e],o="",l=-1,u=-1;if(0===t&&(l=0),0===r&&(u=0),r===1/0&&(u=s.children.length),-1===l||-1===u)for(let e=0;e<s.children.length;e++)o+=function e(t){return"text"===t.type?t.value:"element"===t.type?t.children.map(e).join(""):""}(s.children[e]),-1===l&&o.length===t&&(l=e+1),-1===u&&o.length===r&&(u=e+1);if(-1===l)throw new rx(`Failed to find start index for decoration ${JSON.stringify(a.start)}`);if(-1===u)throw new rx(`Failed to find end index for decoration ${JSON.stringify(a.end)}`);let c=s.children.slice(l,u);if(a.alwaysWrap||c.length!==s.children.length)if(a.alwaysWrap||1!==c.length||"element"!==c[0].type){let e={type:"element",tagName:"span",properties:{},children:c};i(e,a,"wrapper"),s.children.splice(l,c.length,e)}else i(c[0],a,"token");else i(s,a,"line")}function i(e,t,r){let n=t.properties||{},a=t.transform||(e=>e);return e.tagName=t.tagName||"span",e.properties={...e.properties,...n,class:e.properties.class},t.properties?.class&&ap(e,t.properties.class),e=a(e,r)||e}let s=[];for(let e of r.decorations.sort((e,t)=>t.start.offset-e.start.offset||e.end.offset-t.end.offset)){let{start:t,end:r}=e;if(t.line===r.line)a(t.line,t.character,r.character,e);else if(t.line<r.line){a(t.line,t.character,1/0,e);for(let a=t.line+1;a<r.line;a++)s.unshift(()=>{var t;n[t=a]=i(n[t],e,"line")});a(r.line,0,r.character,e)}}s.forEach(e=>e())}}}()];function aC(e){let t=function(e){let t=[],r=[],n=[];for(let a of e)switch(a.enforce){case"pre":t.push(a);break;case"post":r.push(a);break;default:n.push(a)}return{pre:t,post:r,normal:n}}(e.transformers||[]);return[...t.pre,...t.normal,...t.post,...ax]}var aA=["black","red","green","yellow","blue","magenta","cyan","white","brightBlack","brightRed","brightGreen","brightYellow","brightBlue","brightMagenta","brightCyan","brightWhite"],a_={1:"bold",2:"dim",3:"italic",4:"underline",7:"reverse",8:"hidden",9:"strikethrough"};function aS(e){let t=e.shift();if("2"===t){let t=e.splice(0,3).map(e=>Number.parseInt(e));if(3!==t.length||t.some(e=>Number.isNaN(e)))return;return{type:"rgb",rgb:t}}if("5"===t){let t=e.shift();if(t)return{type:"table",index:Number(t)}}}var aN={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"};let aE={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 aI(e,t,r={}){var n,a;let i,s,{theme:o=e.getLoadedThemes()[0]}=r,l=e.resolveLangAlias(r.lang||"text");if(au(l)||ad(o))return ah(t).map(e=>[{content:e[0],offset:e[1]}]);let{theme:u,colorMap:c}=e.setTheme(o);if("ansi"===l){let e,n,a,i,s,o,l;return e=as(u,r),n=ah(t),a=function(e=aN){let t;function r(e){return`#${e.map(e=>Math.max(0,Math.min(e,255)).toString(16).padStart(2,"0")).join("")}`}return{value:function(n){switch(n.type){case"named":return e[n.name];case"rgb":return r(n.rgb);case"table":var a;return a=n.index,function(){if(t)return t;t=[];for(let r=0;r<aA.length;r++)t.push(e[aA[r]]);let n=[0,95,135,175,215,255];for(let e=0;e<6;e++)for(let a=0;a<6;a++)for(let i=0;i<6;i++)t.push(r([n[e],n[a],n[i]]));let a=8;for(let e=0;e<24;e++,a+=10)t.push(r([a,a,a]));return t}()[a]}}}}(Object.fromEntries(aA.map(e=>{let t=`terminal.ansi${e[0].toUpperCase()}${e.substring(1)}`;return[e,u.colors?.[t]||aE[e]]}))),i=null,s=null,o=new Set,l={parse(e){let t=[],r=0;do{let n=function(e,t){let r=e.indexOf("\x1b",t);if(-1!==r&&"["===e[r+1]){let t=e.indexOf("m",r);if(-1!==t)return{sequence:e.substring(r+2,t).split(";"),startPosition:r,position:t+1}}return{position:e.length}}(e,r),a=n.sequence?e.substring(r,n.startPosition):e.substring(r);if(a.length>0&&t.push({value:a,foreground:i,background:s,decorations:new Set(o)}),n.sequence){let e=function(e){let t=[];for(;e.length>0;){let r=e.shift();if(!r)continue;let n=Number.parseInt(r);if(!Number.isNaN(n))if(0===n)t.push({type:"resetAll"});else if(n<=9)a_[n]&&t.push({type:"setDecoration",value:a_[n]});else if(n<=29){let e=a_[n-20];e&&(t.push({type:"resetDecoration",value:e}),"dim"===e&&t.push({type:"resetDecoration",value:"bold"}))}else if(n<=37)t.push({type:"setForegroundColor",value:{type:"named",name:aA[n-30]}});else if(38===n){let r=aS(e);r&&t.push({type:"setForegroundColor",value:r})}else if(39===n)t.push({type:"resetForegroundColor"});
1else if(n<=47)t.push({type:"setBackgroundColor",value:{type:"named",name:aA[n-40]}});else if(48===n){let r=aS(e);r&&t.push({type:"setBackgroundColor",value:r})}else 49===n?t.push({type:"resetBackgroundColor"}):53===n?t.push({type:"setDecoration",value:"overline"}):55===n?t.push({type:"resetDecoration",value:"overline"}):n>=90&&n<=97?t.push({type:"setForegroundColor",value:{type:"named",name:aA[n-90+8]}}):n>=100&&n<=107&&t.push({type:"setBackgroundColor",value:{type:"named",name:aA[n-100+8]}})}return t}(n.sequence);for(let t of e)"resetAll"===t.type?(i=null,s=null,o.clear()):"resetForegroundColor"===t.type?i=null:"resetBackgroundColor"===t.type?s=null:"resetDecoration"===t.type&&o.delete(t.value);for(let t of e)"setForegroundColor"===t.type?i=t.value:"setBackgroundColor"===t.type?s=t.value:"setDecoration"===t.type&&o.add(t.value)}r=n.position}while(r<e.length)return t}},n.map(t=>l.parse(t[0]).map(r=>{let n,i;r.decorations.has("reverse")?(n=r.background?a.value(r.background):u.bg,i=r.foreground?a.value(r.foreground):u.fg):(n=r.foreground?a.value(r.foreground):u.fg,i=r.background?a.value(r.background):void 0),n=ao(n,e),i=ao(i,e),r.decorations.has("dim")&&(n=function(e){let t=e.match(/#([0-9a-f]{3,8})/i);if(t){let e=t[1];if(8===e.length){let t=Math.round(Number.parseInt(e.slice(6,8),16)/2).toString(16).padStart(2,"0");return`#${e.slice(0,6)}${t}`}if(6===e.length)return`#${e}80`;if(4===e.length){let t=e[0],r=e[1],n=e[2],a=e[3],i=Math.round(Number.parseInt(`${a}${a}`,16)/2).toString(16).padStart(2,"0");return`#${t}${t}${r}${r}${n}${n}${i}`}else if(3===e.length){let t=e[0],r=e[1],n=e[2];return`#${t}${t}${r}${r}${n}${n}80`}}let r=e.match(/var\((--[\w-]+-ansi-[\w-]+)\)/);return r?`var(${r[1]}-dim)`:e}(n));let s=rj.None;return r.decorations.has("bold")&&(s|=rj.Bold),r.decorations.has("italic")&&(s|=rj.Italic),r.decorations.has("underline")&&(s|=rj.Underline),r.decorations.has("strikethrough")&&(s|=rj.Strikethrough),{content:r.value,offset:t[1],color:n,bgColor:i,fontStyle:s}}))}let d=e.getLanguage(r.lang||"text");if(r.grammarState){if(r.grammarState.lang!==d.name)throw new rx(`Grammar state language "${r.grammarState.lang}" does not match highlight language "${d.name}"`);if(!r.grammarState.themes.includes(u.name))throw new rx(`Grammar state themes "${r.grammarState.themes}" do not contain highlight theme "${u.name}"`)}return s=new ak((i=aR(t,n=d,a=u,c,r)).stateStack,n.name,a.name),av(i.tokens,s),i.tokens}function aR(e,t,r,n,a){let i=as(r,a),{tokenizeMaxLineLength:s=0,tokenizeTimeLimit:o=500}=a,l=ah(e),u=a.grammarState?function(e,t){if(!(e instanceof ak))throw new rx("Invalid grammar state");return e.getInternalStack(t)}(a.grammarState,r.name)??nC:null!=a.grammarContextCode?aR(a.grammarContextCode,t,r,n,{...a,grammarState:void 0,grammarContextCode:void 0}).stateStack:nC,c=[],d=[];for(let e=0,p=l.length;e<p;e++){let p,h,[f,m]=l[e];if(""===f){c=[],d.push([]);continue}if(s>0&&f.length>=s){c=[],d.push([{content:f,offset:m,color:"",fontStyle:0}]);continue}a.includeExplanation&&(p=t.tokenizeLine(f,u,o).tokens,h=0);let g=t.tokenizeLine2(f,u,o),b=g.tokens.length/2;for(let e=0;e<b;e++){let t=g.tokens[2*e],s=e+1<b?g.tokens[2*e+2]:f.length;if(t===s)continue;let o=g.tokens[2*e+1],l=ao(n[rG.getForeground(o)],i),u=rG.getFontStyle(o),d={content:f.substring(t,s),offset:m+t,color:l,fontStyle:u};if(a.includeExplanation){let e=[];
1if("scopeName"!==a.includeExplanation)for(let t of r.settings){let r;switch(typeof t.scope){case"string":r=t.scope.split(/,/).map(e=>e.trim());break;case"object":r=t.scope;break;default:continue}e.push({settings:t,selectors:r.map(e=>e.split(/ /))})}d.explanation=[];let n=0;for(;t+n<s;){let t=p[h],r=f.substring(t.startIndex,t.endIndex);n+=r.length,d.explanation.push({content:r,scopes:"scopeName"===a.includeExplanation?t.scopes.map(e=>({scopeName:e})):function(e,t){let r=[];for(let n=0,a=t.length;n<a;n++){let a=t[n];r[n]={scopeName:a,themeMatches:function(e,t,r){let n=[];for(let{selectors:a,settings:i}of e)for(let e of a)if(function(e,t,r){if(!aT(e[e.length-1],t))return!1;let n=e.length-2,a=r.length-1;for(;n>=0&&a>=0;)aT(e[n],r[a])&&(n-=1),a-=1;return -1===n}(e,t,r)){n.push(i);break}return n}(e,a,t.slice(0,n))}}return r}(e,t.scopes)}),h+=1}}c.push(d)}d.push(c),c=[],u=g.ruleStack}return{tokens:d,stateStack:u}}function aT(e,t){return e===t||t.substring(0,e.length)===e&&"."===t[e.length]}function aP(e,t,r){let n=Object.entries(r.themes).filter(e=>e[1]).map(e=>({color:e[0],theme:e[1]})),a=n.map(n=>{let a=aI(e,t,{...r,theme:n.theme}),i=aw(a);return{tokens:a,state:i,theme:"string"==typeof n.theme?n.theme:n.theme.name}}),i=function(...e){let t=e.map(()=>[]),r=e.length;for(let n=0;n<e[0].length;n++){let a=e.map(e=>e[n]),i=t.map(()=>[]);t.forEach((e,t)=>e.push(i[t]));let s=a.map(()=>0),o=a.map(e=>e[0]);for(;o.every(e=>e);){let e=Math.min(...o.map(e=>e.content.length));for(let t=0;t<r;t++){let r=o[t];r.content.length===e?(i[t].push(r),s[t]+=1,o[t]=a[t][s[t]]):(i[t].push({...r,content:r.content.slice(0,e)}),o[t]={...r,content:r.content.slice(e),offset:r.offset+e})}}}return t}(...a.map(e=>e.tokens)),s=i[0].map((e,t)=>e.map((e,a)=>{let s={content:e.content,variants:{},offset:e.offset};return"includeExplanation"in r&&r.includeExplanation&&(s.explanation=e.explanation),i.forEach((e,r)=>{let{content:i,explanation:o,offset:l,...u}=e[t][a];s.variants[n[r].color]=u}),s})),o=a[0].state?new ak(Object.fromEntries(a.map(e=>[e.theme,e.state?.getInternalStack(e.theme)])),a[0].state.lang):void 0;return o&&av(s,o),s}function aM(e,t,r){let n,a,i,s,o,l;if("themes"in r){let{defaultColor:u="light",cssVariablePrefix:c="--shiki-",colorsRendering:d="css-vars"}=r,p=Object.entries(r.themes).filter(e=>e[1]).map(e=>({color:e[0],theme:e[1]})).sort((e,t)=>e.color===u?-1:+(t.color===u));if(0===p.length)throw new rx("`themes` option must not be empty");let h=aP(e,t,r);if(l=aw(h),u&&af!==u&&!p.find(e=>e.color===u))throw new rx(`\`themes\` option must contain the defaultColor key \`${u}\``);let f=p.map(t=>e.getTheme(t.theme)),m=p.map(e=>e.color);i=h.map(e=>e.map(e=>(function(e,t,r,n,a="css-vars"){let i={content:e.content,explanation:e.explanation,offset:e.offset},s=t.map(t=>ag(e.variants[t])),o=new Set(s.flatMap(e=>Object.keys(e))),l={},u=(e,n)=>{let a="color"===n?"":"background-color"===n?"-bg":`-${n}`;return r+t[e]+("color"===n?"":a)};return s.forEach((e,r)=>{for(let i of o){let o=e[i]||"inherit";if(0===r&&n&&am.includes(i))if(n===af&&s.length>1){let e=t.findIndex(e=>"light"===e),n=t.findIndex(e=>"dark"===e);if(-1===e||-1===n)throw new rx('When using `defaultColor: "light-dark()"`, you must provide both `light` and `dark` themes');let c=s[e][i]||"inherit",d=s[n][i]||"inherit";l[i]=`light-dark(${c}, ${d})`,"css-vars"===a&&(l[u(r,i)]=o)}else l[i]=o;else"css-vars"===a&&(l[u(r,i)]=o)}}),i.htmlStyle=l,i})(e,m,c,u,d))),l&&av(i,l);let g=p.map(e=>as(e.theme,r));a=aj(p,f,g,c,u,"fg",d),n=aj(p,f,g,c,u,"bg",d),s=`shiki-themes ${f.map(e=>e.name).join(" ")}`,o=u?void 0:[a,n].join(";")}else if("theme"in r){let o=as(r.theme,r);i=aI(e,t,r);let u=e.getTheme(r.theme);n=ao(u.bg,o),a=ao(u.fg,o),s=u.name,l=aw(i)}else throw new rx("Invalid options, either `theme` or `themes` must be provided");return{tokens:i,fg:a,bg:n,themeName:s,rootStyle:o,grammarState:l}}function aj(e,t,r,n,a,i,s){return e.map((o,l)=>{let u=ao(t[l][i],r[l])||"inherit",c=`${n+o.color}${"bg"===i?"-bg":""}:${u}`;if(0===l&&a){if(a===af&&e.length>1){let n=e.findIndex(e=>"light"===e.color),a=e.findIndex(e=>"dark"===e.color);if(-1===n||-1===a)throw new rx('When using `defaultColor: "light-dark()"`, you must provide both `light` and `dark` themes');
1let s=ao(t[n][i],r[n])||"inherit",o=ao(t[a][i],r[a])||"inherit";return`light-dark(${s}, ${o});${c}`}return u}return"css-vars"===s?c:null}).filter(e=>!!e).join(";")}function aL(e,t,r,n={meta:{},options:r,codeToHast:(t,r)=>aL(e,t,r),codeToTokens:(t,r)=>aM(e,t,r)}){let a=t;for(let e of aC(r))a=e.preprocess?.call(n,a,r)||a;let{tokens:i,fg:s,bg:o,themeName:l,rootStyle:u,grammarState:c}=aM(e,a,r),{mergeWhitespaces:d=!0,mergeSameStyleTokens:p=!1}=r;!0===d?i=i.map(e=>{let t,r=[],n="";return e.forEach((a,i)=>{let s=!(a.fontStyle&&(a.fontStyle&rj.Underline||a.fontStyle&rj.Strikethrough));s&&a.content.match(/^\s+$/)&&e[i+1]?(void 0===t&&(t=a.offset),n+=a.content):n?(s?r.push({...a,offset:t,content:n+a.content}):r.push({content:n,offset:t},a),t=void 0,n=""):r.push(a)}),r}):"never"===d&&(i=i.map(e=>e.flatMap(e=>{if(e.content.match(/^\s+$/))return e;let t=e.content.match(/^(\s*)(.*?)(\s*)$/);if(!t)return e;let[,r,n,a]=t;if(!r&&!a)return e;let i=[{...e,offset:e.offset+r.length,content:n}];return r&&i.unshift({content:r,offset:e.offset}),a&&i.push({content:a,offset:e.offset+r.length+n.length}),i}))),p&&(i=i.map(e=>{let t=[];for(let r of e){if(0===t.length){t.push({...r});continue}let e=t[t.length-1],n=ab(e.htmlStyle||ag(e)),a=ab(r.htmlStyle||ag(r)),i=e.fontStyle&&(e.fontStyle&rj.Underline||e.fontStyle&rj.Strikethrough),s=r.fontStyle&&(r.fontStyle&rj.Underline||r.fontStyle&rj.Strikethrough);i||s||n!==a?t.push({...r}):e.content+=r.content}return t}));let h={...n,get source(){return a}};for(let e of aC(r))i=e.tokens?.call(h,i)||i;return function(e,t,r,n=aw(e)){let a=aC(t),i=[],s={type:"root",children:[]},{structure:o="classic",tabindex:l="0"}=t,u={class:`shiki ${t.themeName||""}`};for(let[e,r]of(!1!==t.rootStyle&&(null!=t.rootStyle?u.style=t.rootStyle:u.style=`background-color:${t.bg};color:${t.fg}`),!1!==l&&null!=l&&(u.tabindex=l.toString()),Object.entries(t.meta||{})))e.startsWith("_")||(u[e]=r);let c={type:"element",tagName:"pre",properties:u,children:[],data:t.data},d={type:"element",tagName:"code",properties:{},children:i},p=[],h={...r,structure:o,addClassToHast:ap,get source(){return r.source},get tokens(){return e},get options(){return t},get root(){return s},get pre(){return c},get code(){return d},get lines(){return p}};if(e.forEach((e,t)=>{t&&("inline"===o?s.children.push({type:"element",tagName:"br",properties:{},children:[]}):"classic"===o&&i.push({type:"text",value:"\n"}));let r={type:"element",tagName:"span",properties:{class:"line"},children:[]},n=0;for(let i of e){let e={type:"element",tagName:"span",properties:{...i.htmlAttrs},children:[{type:"text",value:i.content}]},l=ab(i.htmlStyle||ag(i));for(let s of(l&&(e.properties.style=l),a))e=s?.span?.call(h,e,t+1,n,r,i)||e;"inline"===o?s.children.push(e):"classic"===o&&r.children.push(e),n+=i.content.length}if("classic"===o){for(let e of a)r=e?.line?.call(h,r,t+1)||r;p.push(r),i.push(r)}else"inline"===o&&p.push(r)}),"classic"===o){for(let e of a)d=e?.code?.call(h,d)||d;for(let e of(c.children.push(d),a))c=e?.pre?.call(h,c)||c;s.children.push(c)}else if("inline"===o){let e=[],t={type:"element",tagName:"span",properties:{class:"line"},children:[]};for(let r of s.children)"element"===r.type&&"br"===r.tagName?(e.push(t),t={type:"element",tagName:"span",properties:{class:"line"},children:[]}):("element"===r.type||"text"===r.type)&&t.children.push(r);e.push(t);let r={type:"element",tagName:"code",properties:{},children:e};for(let e of a)r=e?.code?.call(h,r)||r;s.children=[];for(let e=0;e<r.children.length;e++){e>0&&s.children.push({type:"element",tagName:"br",properties:{},children:[]});let t=r.children[e];"element"===t.type&&s.children.push(...t.children)}}let f=s;for(let e of a)f=e?.root?.call(h,f)||f;return n&&av(f,n),f}(i,{...r,fg:s,bg:o,themeName:l,rootStyle:!1!==r.rootStyle&&(r.rootStyle??u)},h,c)}let a$=function(e,t){let r=t||at,n=r.quote||'"';if('"'!==n&&"'"!==n)throw Error("Invalid quote `"+n+"`, expected `'` or `\"`");return({one:aa,all:ai,settings:{omitOptionalTags:r.omitOptionalTags||!1,allowParseErrors:r.allowParseErrors||!1,allowDangerousCharacters:r.allowDangerousCharacters||!1,quoteSmart:r.quoteSmart||!1,preferUnquoted:r.preferUnquoted||!1,tightAttributes:r.tightAttributes||!1,upperDoctype:r.upperDoctype||!1,tightDoctype:r.tightDoctype||!1,bogusComments:r.bogusComments||!1,tightCommaSeparatedLists:r.tightCommaSeparatedLists||!1,tightSelfClosing:r.tightSelfClosing||!1,collapseEmptyAttributes:r.collapseEmptyAttributes||!1,allowDangerousHtml:r.allowDangerousHtml||!1,voids:r.voids||nA.htmlVoidElements,characterReferences:r.characterReferences||ar,closeSelfClosing:r.closeSelfClosing||!1,closeEmptyElements:r.closeEmptyElements||!1},schema:"svg"===r.space?n_.svg:n_.html,quote:n,alternative:'"'===n?"'":'"'}).one(Array.isArray(e)?{type:"root",children:e}:e,void 0,void 0)},aO="__shiki_resolved";function aB(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:r,fg:n}=t;if(!r||!n){let e=t.settings?t.settings.find(e=>!e.name&&!e.scope):void 0;e?.settings?.foreground&&(n=e.settings.foreground),e?.settings?.background&&(r=e.settings.background),!n&&t?.colors?.["editor.foreground"]&&(n=t.colors["editor.foreground"]),!r&&t?.colors?.["editor.background"]&&(r=t.colors["editor.background"]),n||(n="light"===t.type?"#333333":"#bbbbbb"),r||(r="light"===t.type?"#fffffe":"#1e1e1e"),t.fg=n,t.bg=r}t.settings[0]&&t.settings[0].settings&&!t.settings[0].scope||t.settings.unshift({settings:{foreground:t.fg,background:t.bg}});let a=0,i=new Map;function s(e){if(i.has(e))return i.get(e);a+=1;let r=`#${a.toString(16).padStart(8,"0").toLowerCase()}`;return t.colorReplacements?.[`#${r}`]?s(e):(i.set(e,r),r)}for(let e of(t.settings=t.settings.map(e=>{let r=e.settings?.foreground&&!e.settings.foreground.startsWith("#"),n=e.settings?.background&&!e.settings.background.startsWith("#");if(!r&&!n)return e;let a={...e,settings:{...e.settings}};if(r){let r=s(e.settings.foreground);t.colorReplacements[r]=e.settings.foreground,a.settings.foreground=r}if(n){let r=s(e.settings.background);t.colorReplacements[r]=e.settings.background,a.settings.background=r}return a}),Object.keys(t.colors||{})))if(("editor.foreground"===e||"editor.background"===e||e.startsWith("terminal.ansi"))&&!t.colors[e]?.startsWith("#")){let r=s(t.colors[e]);t.colorReplacements[r]=t.colors[e],t.colors[e]=r}return Object.defineProperty(t,aO,{enumerable:!1,writable:!1,value:!0}),t}async function aG(e){return Array.from(new Set((await Promise.all(e.filter(e=>!ac(e)).map(async e=>await al(e).then(e=>Array.isArray(e)?e:[e])))).flat()))}async function aD(e){return(await Promise.all(e.map(async e=>ad(e)?null:aB(await al(e))))).filter(e=>!!e)}
1class aF extends Error{constructor(e){super(e),this.name="ShikiError"}}function aU(e,t){if(!t)return e;if(t[e]){let r=new Set([e]);for(;t[e];){if(e=t[e],r.has(e))throw new aF(`Circular alias \`${Array.from(r).join(" -> ")} -> ${e}\``);r.add(e)}}return e}class aq extends nx{constructor(e,t,r,n={}){super(e),this._resolver=e,this._themes=t,this._langs=r,this._alias=n,this._themes.map(e=>this.loadTheme(e)),this.loadLanguages(this._langs)}_resolvedThemes=new Map;_resolvedGrammars=new Map;_langMap=new Map;_langGraph=new Map;_textmateThemeCache=new WeakMap;_loadedThemesCache=null;_loadedLanguagesCache=null;getTheme(e){return"string"==typeof e?this._resolvedThemes.get(e):this.loadTheme(e)}loadTheme(e){let t=aB(e);return t.name&&(this._resolvedThemes.set(t.name,t),this._loadedThemesCache=null),t}getLoadedThemes(){return this._loadedThemesCache||(this._loadedThemesCache=[...this._resolvedThemes.keys()]),this._loadedThemesCache}setTheme(e){let t=this._textmateThemeCache.get(e);t||(t=rR.createFromRawTheme(e),this._textmateThemeCache.set(e,t)),this._syncRegistry.setTheme(t)}getGrammar(e){return e=aU(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 r={balancedBracketSelectors:e.balancedBracketSelectors||["*"],unbalancedBracketSelectors:e.unbalancedBracketSelectors||[]};this._syncRegistry._rawGrammars.set(e.scopeName,e);let n=this.loadGrammarWithConfiguration(e.scopeName,1,r);if(n.name=e.name,this._resolvedGrammars.set(e.name,n),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=Array.from(this._langGraph.entries()),r=t.filter(([e,t])=>!t);if(r.length){let e=t.filter(([e,t])=>{if(!t)return!1;let n=t.embeddedLanguages||t.embeddedLangs;return n?.some(e=>r.map(([e])=>e).includes(e))}).filter(e=>!r.includes(e));throw new aF(`Missing languages ${r.map(([e])=>`\`${e}\``).join(", ")}, required by ${e.map(([e])=>`\`${e}\``).join(", ")}`)}for(let[e,r]of t)this._resolver.addLanguage(r);for(let[e,r]of t)this.loadLanguage(r)}getLoadedLanguages(){return this._loadedLanguagesCache||(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))}}class aW{_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("."),r=[];for(let e=1;e<=t.length;e++){let n=t.slice(0,e).join(".");r=[...r,...this._injections.get(n)||[]]}return r}}let az=0;async function aH(e){e.engine||function(e,t=3){if(!(t>3))if(1)console.trace(`[SHIKI DEPRECATE]: ${e}`);else throw Error(`[SHIKI DEPRECATE]: ${e}`)}("`engine` option is required. Use `createOnigurumaEngine` or `createJavaScriptRegexEngine` to create an engine.");let[t,r,n]=await Promise.all([aD(e.themes||[]),aG(e.langs||[]),e.engine]);return function(e){let t;az+=1,!1!==e.warnings&&az>=10&&az%10==0&&console.warn(`[Shiki] ${az} instances have been created. Shiki is supposed to be used as a singleton, c
1onsider refactoring your code to cache your highlighter instance; Or call \`highlighter.dispose()\` to release unused instances.`);let r=!1;if(!e.engine)throw new aF("`engine` option is required for synchronous mode");let n=(e.langs||[]).flat(1),a=(e.themes||[]).flat(1).map(aB),i=new aq(new aW(e.engine,n),a,n,e.langAlias);function s(e){if("none"===e)return{bg:"",fg:"",name:"none",settings:[],type:"dark"};u();let t=i.getTheme(e);if(!t)throw new aF(`Theme \`${e}\` not found, you may need to load it first`);return t}function o(...e){u(),i.loadLanguages(e.flat(1))}function l(...e){for(let t of(u(),e.flat(1)))i.loadTheme(t)}function u(){if(r)throw new aF("Shiki instance has been disposed")}function c(){r||(r=!0,i.dispose(),az-=1)}return{setTheme:function(e){u();let r=s(e);return t!==e&&(i.setTheme(r),t=e),{theme:r,colorMap:i.getColorMap()}},getTheme:s,getLanguage:function(e){u();let t=i.getGrammar("string"==typeof e?e:e.name);if(!t)throw new aF(`Language \`${e}\` not found, you may need to load it first`);return t},getLoadedThemes:function(){return u(),i.getLoadedThemes()},getLoadedLanguages:function(){return u(),i.getLoadedLanguages()},resolveLangAlias:function(t){return aU(t,e.langAlias)},loadLanguage:async function(...e){return o(await aG(e))},loadLanguageSync:o,loadTheme:async function(...e){return u(),l(await aD(e))},loadThemeSync:l,dispose:c,[Symbol.dispose]:c}}({...e,themes:t,langs:r,engine:n})}async function aV(e){let t=await aH(e);return{getLastGrammarState:(...e)=>(function(...e){if(2===e.length)return aw(e[1]);let[t,r,n={}]=e,{lang:a="text",theme:i=t.getLoadedThemes()[0]}=n;if(au(a)||ad(i))throw new rx("Plain language does not have grammar state");if("ansi"===a)throw new rx("ANSI language does not have grammar state");let{theme:s,colorMap:o}=t.setTheme(i),l=t.getLanguage(a);return new ak(aR(r,l,s,o,n).stateStack,l.name,s.name)})(t,...e),codeToTokensBase:(e,r)=>aI(t,e,r),codeToTokensWithThemes:(e,r)=>aP(t,e,r),codeToTokens:(e,r)=>aM(t,e,r),codeToHast:(e,r)=>aL(t,e,r),codeToHtml:(e,r)=>(function(e,t,r){let n={meta:{},options:r,codeToHast:(t,r)=>aL(e,t,r),codeToTokens:(t,r)=>aM(e,t,r)},a=a$(aL(e,t,r,n));for(let e of aC(r))a=e.postprocess?.call(n,a,r)||a;return a})(t,e,r),getBundledLanguages:()=>({}),getBundledThemes:()=>({}),...t,getInternalContext:()=>t}}let aQ=Object.fromEntries([{id:"andromeeda",displayName:"Andromeeda",type:"dark",import:()=>e.A(71233)},{id:"aurora-x",displayName:"Aurora X",type:"dark",import:()=>e.A(69905)},{id:"ayu-dark",displayName:"Ayu Dark",type:"dark",import:()=>e.A(21579)},{id:"ayu-light",displayName:"Ayu Light",type:"light",import:()=>e.A(17347)},{id:"ayu-mirage",displayName:"Ayu Mirage",type:"dark",import:()=>e.A(79579)},{id:"catppuccin-frappe",displayName:"Catppuccin Frappé",type:"dark",import:()=>e.A(17235)},{id:"catppuccin-latte",displayName:"Catppuccin Latte",type:"light",import:()=>e.A(82774)},{id:"catppuccin-macchiato",displayName:"Catppuccin Macchiato",type:"dark",import:()=>e.A(52161)},{id:"catppuccin-mocha",displayName:"Catppuccin Mocha",type:"dark",import:()=>e.A(10803)},{id:"dark-plus",displayName:"Dark Plus",type:"dark",import:()=>e.A(60897)},{id:"dracula",displayName:"Dracula Theme",type:"dark",import:()=>e.A(88958)},{id:"dracula-soft",displayName:"Dracula Theme Soft",type:"dark",import:()=>e.A(24347)},{id:"everforest-dark",displayName:"Everforest Dark",type:"dark",import:()=>e.A(39415)},{id:"everforest-light",displayName:"Everforest Light",type:"light",import:()=>e.A(12625)},{id:"github-dark",displayName:"GitHub Dark",type:"dark",import:()=>e.A(88984)},{id:"github-dark-default",displayName:"GitHub Dark Default",type:"dark",import:()=>e.A(99547)},{id:"github-dark-dimmed",displayName:"GitHub Dark Dimmed",type:"dark",import:()=>e.A(26878)},{id:"github-dark-high-contrast",displayName:"GitHub Dark High Contrast",type:"dark",import:()=>e.A(97301)},{id:"github-light",displayName:"GitHub Light",type:"light",import:()=>e.A(4877)},{id:"github-light-default",displayName:"GitHub Light Default",type:"light",import:()=>e.A(36193)},{id:"github-light-high-contrast",displayName:"GitHub Light High Contrast",type:"light",import:()=>e.A(40608)},{id:"gruvbox-dark-hard",displayName:"Gruvbox Dark Hard",type:"dark",import:()=>e.A(96394)},{id:"gruvbox-dark-medium",displayName:"Gruvbox Dark Medium",type:"dark",import:()=>e.A(21243)},{id:"gruvbox-dark-soft",displayName:"Gruvbox Dark Soft",type:"dark",import:()=>e.A(10707)},{id:"gruvbox-light-hard",displayName:"Gruvbox Light Hard",type:"light",import:()=>e.A(17644)},{id:"gruvbox-light-medium",displayName:"Gruvbox Light Medium",type:"light",import:()=>e.A(5583)},{id:"gruvbox-light-soft",displayName:"Gruvbox Light Soft",type:"light",import:()=>e.A(17669)},{id:"horizon",displayName:"Horizon",type:"dark",import:()=>e.A(63824)},{id:"horizon-bright",displayName:"Horizon Bright",type:"dark",import:()=>e.A(86278)},{id:"houston",displayName:"Houston",type:"dark",import:()=>e.A(27289)},{id:"kanagawa-dragon",displayName:"Kanagawa Dragon",type:"dark",import:()=>e.A(88348)},{id:"kanagawa-lotus",displayName:"Kanagawa Lotus",type:"light",import:()=>e.A(44132)},{id:"kanagawa-wave",displayName:"Kanagawa Wave",type:"dark",import:()=>e.A(14230)},{id:"laserwave",displayName:"LaserWave",type:"dark",import:()=>e.A(71202)},{id:"light-plus",displayName:"Light Plus",type:"light",import:()=>e.A(25402)},{id:"material-theme",displayName:"Material Theme",type:"dark",import:()=>e.A(14117)},{id:"material-theme-darker",displayName:"Material Theme Darker",type:"dark",import:()=>e.A(45165)},{id:"material-theme-lighter",displayName:"Material Theme Lighter",type:"light",import:()=>e.A(32896)},{id:"material-theme-ocean",displayName:"Material Theme Ocean",type:"dark",import:()=>e.A(26230)},{id:"material-theme-palenight",displayName:"Material Theme Palenight",type:"dark",import:()=>e.A(16100)},{id:"min-dark",displayName:"Min Dark",type:"dark",import:()=>e.A(47952)},{id:"min-light",displayName:"Min Light",type:"light",import:()=>e.A(28043)},{id:"monokai",displayName:"Monokai",type:"dark",import:()=>
1e.A(17390)},{id:"night-owl",displayName:"Night Owl",type:"dark",import:()=>e.A(67165)},{id:"night-owl-light",displayName:"Night Owl Light",type:"light",import:()=>e.A(34685)},{id:"nord",displayName:"Nord",type:"dark",import:()=>e.A(87e3)},{id:"one-dark-pro",displayName:"One Dark Pro",type:"dark",import:()=>e.A(93697)},{id:"one-light",displayName:"One Light",type:"light",import:()=>e.A(52159)},{id:"plastic",displayName:"Plastic",type:"dark",import:()=>e.A(71284)},{id:"poimandres",displayName:"Poimandres",type:"dark",import:()=>e.A(1663)},{id:"red",displayName:"Red",type:"dark",import:()=>e.A(20216)},{id:"rose-pine",displayName:"Rosé Pine",type:"dark",import:()=>e.A(55440)},{id:"rose-pine-dawn",displayName:"Rosé Pine Dawn",type:"light",import:()=>e.A(78800)},{id:"rose-pine-moon",displayName:"Rosé Pine Moon",type:"dark",import:()=>e.A(23257)},{id:"slack-dark",displayName:"Slack Dark",type:"dark",import:()=>e.A(55807)},{id:"slack-ochin",displayName:"Slack Ochin",type:"light",import:()=>e.A(95487)},{id:"snazzy-light",displayName:"Snazzy Light",type:"light",import:()=>e.A(36490)},{id:"solarized-dark",displayName:"Solarized Dark",type:"dark",import:()=>e.A(48663)},{id:"solarized-light",displayName:"Solarized Light",type:"light",import:()=>e.A(15839)},{id:"synthwave-84",displayName:"Synthwave '84",type:"dark",import:()=>e.A(35719)},{id:"tokyo-night",displayName:"Tokyo Night",type:"dark",import:()=>e.A(39152)},{id:"vesper",displayName:"Vesper",type:"dark",import:()=>e.A(2271)},{id:"vitesse-black",displayName:"Vitesse Black",type:"dark",import:()=>e.A(13655)},{id:"vitesse-dark",displayName:"Vitesse Dark",type:"dark",import:()=>e.A(61619)},{id:"vitesse-light",displayName:"Vitesse Light",type:"light",import:()=>e.A(55196)}].map(e=>[e.id,e.import]));var aX=e.i(52526);class aK extends Error{constructor(e){super(e),this.name="ShikiError"}}function aJ(){return"u">typeof performance?performance.now():Date.now()}let aZ=(e,t)=>e+(t-e%t)%t;async function aY(e){let t,r,n={};function a(e){r=e,n.HEAPU8=new Uint8Array(e),n.HEAPU32=new Uint32Array(e)}let i="u">typeof TextDecoder?new TextDecoder("utf8"):void 0;function s(e,t){return e?function(e,t,r=1024){let n=t+r,a=t;for(;e[a]&&!(a>=n);)++a;if(a-t>16&&e.buffer&&i)return i.decode(e.subarray(t,a));let s="";for(;t<a;){let r=e[t++];if(!(128&r)){s+=String.fromCharCode(r);continue}let n=63&e[t++];if((224&r)==192){s+=String.fromCharCode((31&r)<<6|n);continue}let a=63&e[t++];if((r=(240&r)==224?(15&r)<<12|n<<6|a:(7&r)<<18|n<<12|a<<6|63&e[t++])<65536)s+=String.fromCharCode(r);else{let e=r-65536;s+=String.fromCharCode(55296|e>>10,56320|1023&e)}}return s}(n.HEAPU8,e,t):""}let o={emscripten_get_now:aJ,emscripten_memcpy_big:function(e,t,r){n.HEAPU8.copyWithin(e,t,t+r)},emscripten_resize_heap:function(e){let i=n.HEAPU8.length;if((e>>>=0)>0x80000000)return!1;for(let n=1;n<=4;n*=2){let s=i*(1+.2/n);if(s=Math.min(s,e+0x6000000),function(e){try{return t.grow(e-r.byteLength+65535>>>16),a(t.buffer),1}catch{}}(Math.min(0x80000000,aZ(Math.max(e,s),65536))))return!0}return!1},fd_write:()=>0};async function l(){let r=await e({env:o,wasi_snapshot_preview1:o});a((t=r.memory).buffer),Object.assign(n,r),n.UTF8ToString=s}return await l(),n}var a0=Object.defineProperty,a1=(e,t,r)=>{let n;return(n="symbol"!=typeof t?t+"":t)in e?a0(e,n,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[n]=r};let a2=null;class a5{constructor(e){a1(this,"utf16Length"),a1(this,"utf8Length"),a1(this,"utf16Value"),a1(this,"utf8Value"),a1(this,"utf16OffsetToUtf8"),a1(this,"utf8OffsetToUtf16");const t=e.length,r=a5._utf8ByteLength(e),n=r!==t,a=n?new Uint32Array(t+1):null;n&&(a[t]=r);const i=n?new Uint32Array(r+1):null;n&&(i[r]=t);const s=new Uint8Array(r);let o=0;for(let r=0;r<t;r++){const l=e.charCodeAt(r);let u=l,c=!1;if(l>=55296&&l<=56319&&r+1<t){const t=e.charCodeAt(r+1);t>=56320&&t<=57343&&(u=(l-55296<<10)+65536|t-56320,c=!0)}n&&(a[r]=o,c&&(a[r+1]=o),u<=127?i[o+0]=r:u<=2047?(i[o+0]=r,i[o+1]=r):u<=65535?(i[o+0]=r,i[o+1]=r,i[o+2]=r):(i[o+0]=r,i[o+1]=r,i[o+2]=r,i[o+3]=r)),u<=127?s[o++]=u:(u<=2047?s[o++]=192|(1984&u)>>>6:(u<=65535?s[o++]=224|(61440&u)>>>12:(s[o++]=240|(1835008&u)>>>18,s[o++]=128|(258048&u)>>>12),s[o++]=128|(4032&u)>>>6),s[o++]=128|(63&u)>>>0),c&&r++}this.utf16Length=t,this.utf8Length=r,this.utf16Value=e,this.utf8Value=s,this.utf16OffsetToUtf8=a,this.utf8OffsetToUtf16=i}static _utf8ByteLength(e){let t=0;for(let r=0,n=e.length;r<n;r++){let a=e.charCodeAt(r),i=a,s=!1;if(a>=55296&&a<=56319&&r+1<n){let t=e.charCodeAt(r+1);t>=56320&&t<=57343&&(i=(a-55296<<10)+65536|t-56320,s=!0)}i<=127?t+=1:i<=2047?t+=2:i<=65535?t+=3:t+=4,s&&r++}return t}createString(e){let t=e.omalloc(this.utf8Length);return e.HEAPU8.set(this.utf8Value,t),t}}let a3=class e{constructor(t){if(a1(this,"id",++e.LAST_ID),a1(this,"_onigBinding"),a1(this,"content"),a1(this,"utf16Length"),a1(this,"utf8Length"),a1(this,"utf16OffsetToUtf8"),a1(this,"utf8Off
1setToUtf16"),a1(this,"ptr"),!a2)throw new aK("Must invoke loadWasm first.");this._onigBinding=a2,this.content=t;const r=new a5(t);this.utf16Length=r.utf16Length,this.utf8Length=r.utf8Length,this.utf16OffsetToUtf8=r.utf16OffsetToUtf8,this.utf8OffsetToUtf16=r.utf8OffsetToUtf16,this.utf8Length<1e4&&!e._sharedPtrInUse?(e._sharedPtr||(e._sharedPtr=a2.omalloc(1e4)),e._sharedPtrInUse=!0,a2.HEAPU8.set(r.utf8Value,e._sharedPtr),this.ptr=e._sharedPtr):this.ptr=r.createString(a2)}convertUtf8OffsetToUtf16(e){return this.utf8OffsetToUtf16?e<0?0:e>this.utf8Length?this.utf16Length:this.utf8OffsetToUtf16[e]:e}convertUtf16OffsetToUtf8(e){return this.utf16OffsetToUtf8?e<0?0:e>this.utf16Length?this.utf8Length:this.utf16OffsetToUtf8[e]:e}dispose(){this.ptr===e._sharedPtr?e._sharedPtrInUse=!1:this._onigBinding.ofree(this.ptr)}};a1(a3,"LAST_ID",0),a1(a3,"_sharedPtr",0),a1(a3,"_sharedPtrInUse",!1);class a6{constructor(e){if(a1(this,"_onigBinding"),a1(this,"_ptr"),!a2)throw new aK("Must invoke loadWasm first.");const t=[],r=[];for(let n=0,a=e.length;n<a;n++){const a=new a5(e[n]);t[n]=a.createString(a2),r[n]=a.utf8Length}const n=a2.omalloc(4*e.length);a2.HEAPU32.set(t,n/4);const a=a2.omalloc(4*e.length);a2.HEAPU32.set(r,a/4);const i=a2.createOnigScanner(n,a,e.length);for(let r=0,n=e.length;r<n;r++)a2.ofree(t[r]);a2.ofree(a),a2.ofree(n),0===i&&function(e){throw new aK(e.UTF8ToString(e.getLastO
1nigError()))}(a2),this._onigBinding=a2,this._ptr=i}dispose(){this._onigBinding.freeOnigScanner(this._ptr)}findNextMatchSync(e,t,r){let n=0;if("number"==typeof r&&(n=r),"string"==typeof e){e=new a3(e);let r=this._findNextMatchSync(e,t,!1,n);return e.dispose(),r}return this._findNextMatchSync(e,t,!1,n)}_findNextMatchSync(e,t,r,n){let a=this._onigBinding,i=a.findNextOnigScannerMatch(this._ptr,e.id,e.ptr,e.utf8Length,e.convertUtf16OffsetToUtf8(t),n);if(0===i)return null;let s=a.HEAPU32,o=i/4,l=s[o++],u=s[o++],c=[];for(let t=0;t<u;t++){let r=e.convertUtf8OffsetToUtf16(s[o++]),n=e.convertUtf8OffsetToUtf16(s[o++]);c[t]={start:r,end:n,length:n-r}}return{index:l,captureIndices:c}}}function a8(e){return t=>WebAssembly.instantiate(e,t)}async function a4(e){return e&&await (r||(r=async function(){a2=await aY(async t=>{let r=e;if("function"==typeof(r=await r)&&(r=await r(t)),"function"==typeof r&&(r=await r(t)),"function"==typeof r.instantiator)r=await r.instantiator(t);else if("function"==typeof r.default)r=await r.default(t);else{var n,a,i,s;if(void 0!==r.data&&(r=r.data),n=r,"u">typeof Response&&n instanceof Response){r="function"==typeof WebAssembly.instantiateStreaming?await (i=r,e=>WebAssembly.instantiateStreaming(i,e))(t):await (s=r,async e=>{let t=await s.arrayBuffer();return WebAssembly.instantiate(t,e)})(t)}else(a=r,"u">typeof ArrayBuffer&&(a instanceof ArrayBuffer||ArrayBuffer.isView(a))||void 0!==aX.Buffer&&aX.Buffer.isBuffer?.(a)||"u">typeof SharedArrayBuffer&&a instanceof SharedArrayBuffer||"u">typeof Uint32Array&&a instanceof Uint32Array||r instanceof WebAssembly.Module)?r=await a8(r)(t):"default"in r&&r.default instanceof WebAssembly.Module&&(r=await a8(r.default)(t))}return"instance"in r&&(r=r.instance),"exports"in r&&(r=r.exports),r})}())),{createScanner:e=>new a6(e.map(e=>"string"==typeof e?e:e.source)),createString:e=>new a3(e)}}let a7=(n=(l={langs:rk,themes:aQ,engine:()=>a4(e.A(62631))}).langs,a=l.themes,i=l.engine,async function(e){function t(t){if("string"==typeof t){if(ac(t=e.langAlias?.[t]||t))return[];let r=n[t];if(!r)throw new rx(`Language \`${t}\` is not included in this bundle. You may want to load it from external source.`);return r}return t}function r(e){if(ad(e))return"none";if("string"==typeof e){let t=a[e];if(!t)throw new rx(`Theme \`${e}\` is not included in this bundle. You may want to load it from external source.`);return t}return e}let s=(e.themes??[]).map(e=>r(e)),o=(e.langs??[]).map(e=>t(e)),l=await aV({engine:e.engine??i(),...e,themes:s,langs:o});return{...l,loadLanguage:(...e)=>l.loadLanguage(...e.map(t)),loadTheme:(...e)=>l.loadTheme(...e.map(r)),getBundledLanguages:()=>n,getBundledThemes:()=>a}});function a9(e){if(1!=[...e].length)throw Error(`Expected "${e}" to be a single code point`);return e.codePointAt(0)}let ie=new Set(["alnum","alpha","ascii","blank","cntrl","digit","graph","lower","print","punct","space","upper","word","xdigit"]),it=String.raw;function ir(e,t){if(null==e)throw Error(t??"Value expected");return e}let ia=it`\[\^?`,ii=`c.? | C(?:-.?)?|${it`[pP]\{(?:\^?[-\x20_]*[A-Za-z][-\x20\w]*\})?`}|${it`x[89A-Fa-f]\p{AHex}(?:\\x[89A-Fa-f]\p{AHex})*`}|${it`u(?:\p{AHex}{4})? | x\{[^\}]*\}? | x\p{AHex}{0,2}`}|${it`o\{[^\}]*\}?`}|${it`\d{1,3}`}`,is=/[?*+][?+]?|\{(?:\d+(?:,\d*)?|,\d+)\}\??/,io=RegExp(it`
2  \\ (?:
3    ${ii}
4    | [gk]<[^>]*>?
5    | [gk]'[^']*'?
6    | .
7  )
8  | \( (?:
9    \? (?:
10      [:=!>({]
11      | <[=!]
12      | <[^>]*>
13      | '[^']*'
14      | ~\|?
15      | #(?:[^)\\]|\\.?)*
16      | [^:)]*[:)]
17    )?
18    | \*[^\)]*\)?
19  )?
20  | (?:${is.source})+
21  | ${ia}
22  | .
23`.replace(/\s+/g,""),"gsu"),il=RegExp(it`
24  \\ (?:
25    ${ii}
26    | .
27  )
28  | \[:(?:\^?\p{Alpha}+|\^):\]
29  | ${ia}
30  | &&
31  | .
32`.replace(/\s+/g,""),"gsu");function iu(e,{inCharClass:t}){let r=e[1];if("c"===r||"C"===r){var n,a=e;let t="c"===a[1]?a[2]:a[3];if(!t||!/[A-Za-z]/.test(t))throw Error(`Unsupported control character "${a}"`);return ip(a9(t.toUpperCase())-64,a)}if("dDhHsSwW".includes(r)){let t;return im({d:"digit",h:"hex",s:"space",w:"word"}[t=(n=e)[1].toLowerCase()],n,{negate:n[1]!==t})}if(e.startsWith(it`\o{`))throw Error(`Incomplete, invalid, or unsupported octal code point "${e}"`);
32if(/^\\[pP]\{/.test(e)){if(3===e.length)throw Error(`Incomplete or invalid Unicode property "${e}"`);return function(e){let{p:t,neg:r,value:n}=/^\\(?<p>[pP])\{(?<neg>\^?)(?<value>[^}]+)/.exec(e).groups;return im("property",e,{value:n,negate:"P"===t&&!r||"p"===t&&!!r})}(e)}if(/^\\x[89A-Fa-f]\p{AHex}/u.test(e))try{let t=e.split(/\\x/).slice(1).map(e=>parseInt(e,16)),r=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}).decode(new Uint8Array(t)),n=new TextEncoder;return[...r].map(e=>{let t=[...n.encode(e)].map(e=>`\\x${e.toString(16)}`).join("");return ip(a9(e),t)})}catch{throw Error(`Multibyte code "${e}" incomplete or invalid in Oniguruma`)}if("u"===r||"x"===r)return ip(function(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}"`);return parseInt("{"===e[2]?/^\\x\{\s*(?<hex>\p{AHex}+)/u.exec(e).groups.hex:e.slice(2),16)}(e),e);if(iv.has(r))return ip(iv.get(r),e);if(/\d/.test(r))return{type:"EscapedNumber",inCharClass:t,raw:e};if("\\"===e)throw Error(it`Incomplete escape "\"`);if("M"===r)throw Error(`Unsupported meta "${e}"`);if(2==[...e].length)return ip(e.codePointAt(1),e);throw Error(`Unexpected escape "${e}"`)}function ic(e,t){return{type:"Assertion",kind:e,raw:t}}function id(e){return{type:"Backreference",raw:e}}function ip(e,t){return{type:"Character",value:e,raw:t}}function ih(e,t){return{type:"CharacterClassOpen",negate:e,raw:t}}function im(e,t,r={}){return{type:"CharacterSet",kind:e,...r,raw:t}}function ig(e,t,r={}){return"keep"===e?{type:"Directive",kind:e,raw:t}:{type:"Directive",kind:e,flags:ir(r.flags),raw:t}}function ib(e,t,r={}){return{type:"GroupOpen",kind:e,...r,raw:t}}let iy=new Set(["COUNT","CMP","ERROR","FAIL","MAX","MISMATCH","SKIP","TOTAL_COUNT"]),iv=new Map([["a",7],["b",8],["e",27],["f",12],["n",10],["r",13],["t",9],["v",11]]);function iw(e){let t=null,r,n;if("{"===e[0]){let{minStr:a,maxStr:i}=/^\{(?<minStr>\d*)(?:,(?<maxStr>\d*))?/.exec(e).groups;if(+a>1e5||i&&+i>1e5)throw Error("Quantifier value unsupported in Oniguruma");if((r=+a)>(n=void 0===i?+a:""===i?1/0:+i)&&(t="possessive",[r,n]=[n,r]),e.endsWith("?")){if("possessive"===t)throw Error('Unsupported possessive interval quantifier chain with "?"');t="lazy"}else t||(t="greedy")}else r=+("+"===e[0]),n="?"===e[0]?1:1/0,t="+"===e[1]?"possessive":"?"===e[1]?"lazy":"greedy";return{type:"Quantifier",kind:t,min:r,max:n,raw:e}}function ik(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 ix(e,t){if(!Array.isArray(e.body))throw Error("Expected node with body array");if(1!==e.body.length)return!1;let r=e.body[0];return!t||Object.keys(t).every(e=>t[e]===r[e])}let iC=new Set(["AbsenceFunction","Backreference","CapturingGroup","Character","CharacterClass","CharacterSet","Group","Quantifier","Subroutine"]);function iA(e,t={}){var r;let n={flags:"",normalizeUnknownPropertyNames:!1,skipBackrefValidation:!1,skipLookbehindValidation:!1,skipPropertyNameValidation:!1,unicodePropertyMap:null,...t,rules:{captureGroup:!1,singleline:!1,...t.rules}},a=function(e,t={}){let r={flags:"",...t,rules:{captureGroup:!1,singleline:!1,...t.rules}};if("string"!=typeof e)throw Error("String expected as pattern");let n=function(e){let t={ignoreCase:!1,dotAll:!1,extended:!1,digitIsAscii:!1,posixIsAscii:!1,spaceIsAscii:!1,wordIsAscii:!1,textSegmentMode:null};for(let r=0;r<e.length;r++){let n=e[r];if(!"imxDPSWy".includes(n))throw Error(`Invalid flag "${n}"`);if("y"===n){if(!/^y{[gw]}/.test(e.slice(r)))throw Error('Invalid or unspecified flag "y" mode');t.textSegmentMode="g"===e[r+2]?"grapheme":"word",r+=3;continue}t[({i:"ignoreCase",m:"dotAll",x:"extended",D:"digitIsAscii",P:"posixIsAscii",S:"spaceIsAscii",W:"wordIsAscii"})[n]]=!0}return t}(r.flags),a=[n.extended],i={captureGroup:r.rules.captureGroup,getCurrentModX:()=>a.at(-1),numOpenGroups:0,popModX(){a.pop()},pushModX(e){a.push(e)},replaceCurrentModX(e){a[a.length-1]=e},singleline:r.rules.singleline},s=[],o;for(io.lastIndex=0;o=io.exec(e);){let t=function(e,t,r,n){let[a,i]=r;if("["===r||"[^"===r){let e=function(e,t,r){let n=[ih("^"===t[1],t)],a=1,i;for(il.lastIndex=r;i=il.exec(e);){let e=i[0];if("["===e[0]&&":"!==e[1])a++,n.push(ih("^"===e[1],e));else if("]"===e){if("CharacterClassOpen"===n.at(-1).type)n.push(ip(93,e));else if(a--,n.push({type:"CharacterClassClose",raw:e}),!a)break}else{let t=function(e){if("\\"===e[0])return iu(e,{inCharClass:!0});if("["===e[0]){let t=/\[:(?<negate>\^?)(?<name>[a-z]+):\]/.exec(e);if(!t||!ie.has(t.groups.name))throw Error(`Invalid POSIX class "${e}"`);return im("posix",e,{value:t.groups.name,negate:!!t.groups.negate})}return"-"===e?{type:"CharacterClassHyphen",raw:e}:"&&"===e?{type:"CharacterClassIntersector",raw:e}:ip(a9(e),e)}(e);Array.isArray(t)?n.push(...t):n.push(t)}}return{tokens:n,lastIndex:il.lastIndex||e.length}}(t,r,n);return{tokens:e.tokens,lastIndex:e.lastIndex}}if("\\"===a){if("AbBGyYzZ".includes(i))return{token:ic(r,r)};if(/^\\g[<']/.test(r)){if(!/^\\g(?:<[^>]+>|'[^']+')$/.test(r))throw Error(`Invalid group name "${r}"`);return{token:{type:"Subroutine",raw:r}}}if(/^\\k[<']/.test(r)){if(!/^\\k(?:<[^>]+>|'[^']+')$/.test(r))throw Error(`Invalid group name "${r}"`);return{token:id(r)}}if("K"===i)return{token:ig("keep",r)};if("N"===i||"R"===i)return{token:im("newline",r,{negate:"N"===i})};if("O"===i)return{token:im("any",r)};if("X"===i)return{token:im("text_segment",r)};let e=iu(r,{inCharClass:!1}
32);return Array.isArray(e)?{tokens:e}:{token:e}}if("("===a){if("*"===i)return{token:function(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:r,tag:n,args:a}=t.groups;if(!r)throw Error(`Invalid named callout "${e}"`);if(""===n)throw Error(`Named callout tag with empty value not allowed "${e}"`);let i=a?a.split(",").filter(e=>""!==e).map(e=>/^[+-]?\d+$/.test(e)?+e:e):[],[s,o,l]=i,u=iy.has(r)?r.toLowerCase():"custom";switch(u){case"fail":case"mismatch":case"skip":if(i.length>0)throw Error(`Named callout arguments not allowed "${i}"`);break;case"error":if(i.length>1)throw Error(`Named callout allows only one argument "${i}"`);if("string"==typeof s)throw Error(`Named callout argument must be a number "${s}"`);break;case"max":if(!i.length||i.length>2)throw Error(`Named callout must have one or two arguments "${i}"`);if("string"==typeof s&&!/^[A-Za-z_]\w*$/.test(s))throw Error(`Named callout argument one must be a tag or number "${s}"`);if(2===i.length&&("number"==typeof o||!/^[<>X]$/.test(o)))throw Error(`Named callout optional argument two must be '<', '>', or 'X' "${o}"`);break;case"count":case"total_count":if(i.length>1)throw Error(`Named callout allows only one argument "${i}"`);if(1===i.length&&("number"==typeof s||!/^[<>X]$/.test(s)))throw Error(`Named callout optional argument must be '<', '>', or 'X' "${s}"`);break;case"cmp":if(3!==i.length)throw Error(`Named callout must have three arguments "${i}"`);if("string"==typeof s&&!/^[A-Za-z_]\w*$/.test(s))throw Error(`Named callout argument one must be a tag or number "${s}"`);if("number"==typeof o||!/^(?:[<>!=]=|[<>])$/.test(o))throw Error(`Named callout argument two must be '==', '!=', '>', '<', '>=', or '<=' "${o}"`);if("string"==typeof l&&!/^[A-Za-z_]\w*$/.test(l))throw Error(`Named callout argument three must be a tag or number "${l}"`);break;case"custom":throw Error(`Undefined callout name "${r}"`);default:throw Error(`Unexpected named callout kind "${u}"`)}return{type:"NamedCallout",kind:u,tag:n??null,arguments:a?.split(",")??null,raw:e}}(r)};if("(?{"===r)throw Error(`Unsupported callout "${r}"`);if(r.startsWith("(?#")){if(")"!==t[n])throw Error('Unclosed comment group "(?#"');return{lastIndex:n+1}}if(/^\(\?[-imx]+[:)]$/.test(r))return{token:function(e,t){let{on:r,off:n}=/^\(\?(?<on>[imx]*)(?:-(?<off>[-imx]*))?/.exec(e).groups;n??="";let a=(t.getCurrentModX()||r.includes("x"))&&!n.includes("x"),i=ik(r),s=ik(n),o={};if(i&&(o.enable=i),s&&(o.disable=s),e.endsWith(")"))return t.replaceCurrentModX(a),ig("flags",e,{flags:o});if(e.endsWith(":"))return t.pushModX(a),t.numOpenGroups++,ib("group",e,{...(i||s)&&{flags:o}});throw Error(`Unexpected flag modifier "${e}"`)}(r,e)};if(e.pushModX(e.getCurrentModX()),e.numOpenGroups++,"("===r&&!e.captureGroup||"(?:"===r)return{token:ib("group",r)};if("(?>"===r)return{token:ib("atomic",r)};if("(?="===r||"(?!"===r||"(?<="===r||"(?<!"===r)return{token:ib("<"===r[2]?"lookbehind":"lookahead",r,{negate:r.endsWith("!")})};if("("===r&&e.captureGroup||r.startsWith("(?<")&&r.endsWith(">")||r.startsWith("(?'")&&r.endsWith("'"))return{token:ib("capturing",r,{..."("!==r&&{name:r.slice(3,-1)}})};if(r.startsWith("(?~")){if("(?~|"===r)throw Error(`Unsupported absence function kind "${r}"`);return{token:ib("absence_repeater",r)}}throw"(?("===r?Error(`Unsupported conditional "${r}"`):Error(`Invalid or unsupported group option "${r}"`)}if(")"===r){if(e.popModX(),e.numOpenGroups--,e.numOpenGroups<0)throw Error('Unmatched ")"');return{token:{type:"GroupClose",raw:r}}}if(e.getCurrentModX()){if("#"===r){let e=t.indexOf(`
33`,n);return{lastIndex:-1===e?t.length:e}}if(/^\s$/.test(r)){let e=/\s+/y;return e.lastIndex=n,{lastIndex:e.exec(t)?e.lastIndex:n}}}return"."===r?{token:im("dot",r)}:"^"===r||"$"===r?{token:ic(e.singleline?({"^":it`\A`,$:it`\Z`})[r]:r,r)}:"|"===r?{token:{type:"Alternator",raw:r}}:is.test(r)?{tokens:function(e){let t,r=[],n=RegExp(is,"gy");for(;t=n.exec(e);){let e=t[0];if("{"===e[0]){let t=/^\{(?<min>\d+),(?<max>\d+)\}\??$/.exec(e);if(t){let{min:a,max:i}=t.groups;if(+a>+i&&e.endsWith("?")){n.lastIndex--,r.push(iw(e.slice(0,-1)));continue}}}r.push(iw(e))}return r}(r)}:{token:ip(a9(r),r)}}(i,e,o[0],io.lastIndex);t.tokens?s.push(...t.tokens):t.token&&s.push(t.token),void 0!==t.lastIndex&&(io.lastIndex=t.lastIndex)}let l=[],u=0;s.filter(e=>
33"GroupOpen"===e.type).forEach(e=>{"capturing"===e.kind?e.number=++u:"("===e.raw&&l.push(e)}),u||l.forEach((e,t)=>{e.kind="capturing",e.number=t+1});let c=u||l.length;return{tokens:s.map(e=>"EscapedNumber"===e.type?function(e,t){let{raw:r,inCharClass:n}=e,a=r.slice(1);if(!n&&("0"!==a&&1===a.length||"0"!==a[0]&&+a<=t))return[id(r)];let i=[],s=a.match(/^[0-7]+|\d/g);for(let e=0;e<s.length;e++){let t,n=s[e];if(0===e&&"8"!==n&&"9"!==n){if((t=parseInt(n,8))>127)throw Error(it`Octal encoded byte above 177 unsupported "${r}"`)}else t=a9(n);i.push(ip(t,(0===e?"\\":"")+n))}return i}(e,c):e).flat(),flags:n}}(e,{flags:n.flags,rules:{captureGroup:n.rules.captureGroup,singleline:n.rules.singleline}}),i=(e,t)=>{let r=a.tokens[s.nextIndex];switch(s.parent=e,s.nextIndex++,r.type){case"Alternator":return i_();case"Assertion":return function({kind:e}){return iS(ir({"^":"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===it`\B`||e===it`\Y`})}(r);case"Backreference":return function({raw:e},t){let r=/^\\k[<']/.test(e),n=r?e.slice(3,-1):e.slice(1),a=(r,n=!1)=>{let a=t.capturingGroups.length,i=!1;if(r>a)if(t.skipBackrefValidation)i=!0;else throw Error(`Not enough capturing groups defined to the left "${e}"`);return t.hasNumberedRef=!0,iN(n?a+1-r:r,{orphan:i})};if(r){let r=/^(?<sign>-?)0*(?<num>[1-9]\d*)$/.exec(n);if(r)return a(+r.groups.num,!!r.groups.sign);if(/[-+]/.test(n))throw Error(`Invalid backref name "${e}"`);
33if(!t.namedGroupsByName.has(n))throw Error(`Group name not defined to the left "${e}"`);return iN(n)}return a(+n)}(r,s);case"Character":return iI(r.value,{useLastValid:!!t.isCheckingRangeEnd});case"CharacterClassHyphen":return function(e,t){let{tokens:r,walk:n}=e,a=e.parent,i=a.body.at(-1),s=r[e.nextIndex];if(!t.isCheckingRangeEnd&&i&&"CharacterClass"!==i.type&&"CharacterClassRange"!==i.type&&s&&"CharacterClassOpen"!==s.type&&"CharacterClassClose"!==s.type&&"CharacterClassIntersector"!==s.type){let e=n(a,{...t,isCheckingRangeEnd:!0});if("Character"===i.type&&"Character"===e.type)return a.body.pop(),function(e,t){if(t.value<e.value)throw Error("Character class range out of order");return{type:"CharacterClassRange",min:e,max:t}}(i,e);throw Error("Invalid character class range")}return iI(a9("-"))}(s,t);case"CharacterClassOpen":return function({negate:e},t,r){let{tokens:n,walk:a}=t,i=[iR()],s=n[t.nextIndex],o=iU(s);for(;"CharacterClassClose"!==o.type;){if("CharacterClassIntersector"===o.type)i.push(iR()),t.nextIndex++;else{let e=i.at(-1);e.body.push(a(e,r))}o=iU(n[t.nextIndex],s)}let l=iR({negate:e});return 1===i.length?l.body=i[0].body:(l.kind="intersection",l.body=i.map(e=>1===e.body.length?e.body[0]:e)),t.nextIndex++,l}(r,s,t);case"CharacterSet":return function({kind:e,negate:t,value:r},n){let{normalizeUnknownPropertyNames:a,skipPropertyNameValidation:i,unicodePropertyMap:s}=n;if("property"===e){let n=iF(r);if(!ie.has(n)||s?.has(n))return i$(r,{negate:t,normalizeUnknownPropertyNames:a,skipPropertyNameValidation:i,unicodePropertyMap:s});e="posix",r=n}return"posix"===e?function(e,t){let r=!!t?.negate;if(!ie.has(e))throw Error(`Invalid POSIX class "${e}"`);return{type:"CharacterSet",kind:"posix",value:e,negate:r}}(r,{negate:t}):iT(e,{negate:t})}(r,s);case"Directive":return function(e,t={}){if("keep"===e)return{type:"Directive",kind:e};if("flags"===e)return{type:"Directive",kind:e,flags:ir(t.flags)};throw Error(`Unexpected directive kind "${e}"`)}(r.kind,{flags:r.flags});case"GroupOpen":return function(e,t,r){var n,a;let{tokens:i,capturingGroups:s,namedGroupsByName:o,skipLookbehindValidation:l,walk:u}=t,c=function({flags:e,kind:t,name:r,negate:n,number:a}){switch(t){case"absence_repeater":var i="repeater";!1;return{type:"AbsenceFunction",kind:i,body:iO(void 0)};case"atomic":return iP({atomic:!0});case"capturing":return iE(a,{name:r});case"group":return iP({flags:e});case"lookahead":case"lookbehind":return iM({behind:"lookbehind"===t,negate:n});default:throw Error(`Unexpected group kind "${t}"`)}}(e),d="AbsenceFunction"===c.type,p=iD(c),h=p&&c.negate;if("CapturingGroup"===c.type&&(s.push(c),c.name&&(n=c.name,a=[],o.has(n)||o.set(n,a),o.get(n)).push(c)),d&&r.isInAbsenceFunction)throw Error("Nested absence function not supported by Oniguruma");let f=iq(i[t.nextIndex]);for(;"GroupClose"!==f.type;){if("Alternator"===f.type)c.body.push(i_()),t.nextIndex++;else{let e=c.body.at(-1),t=u(e,{...r,isInAbsenceFunction:r.isInAbsenceFunction||d,isInLookbehind:r.isInLookbehind||p,isInNegLookbehind:r.isInNegLookbehind||h});if(e.body.push(t),(p||r.isInLookbehind)&&!l){let e="Lookbehind includes a pattern not allowed by Oniguruma";if(h||r.isInNegLookbehind){if(iG(t)||"CapturingGroup"===t.type)throw Error(e)}else if(iG(t)||iD(t)&&t.negate)throw Error(e)}}f=iq(i[t.nextIndex])}return t.nextIndex++,c}(r,s,t);case"NamedCallout":var n,i;return n=r.kind,i=r.tag,{type:"NamedCallout",kind:n,tag:i,arguments:r.arguments};case"Quantifier":return function({kind:e,min:t,max:r},n){let a=n.parent,i=a.body.at(-1);if(!i||!iC.has(i.type))throw Error("Quantifier requires a repeatable token");let s=ij(e,t,r,i);return a.body.pop(),s}(r,s);
33case"Subroutine":return function({raw:e},t){let{capturingGroups:r,subroutines:n}=t,a=e.slice(3,-1),i=/^(?<sign>[-+]?)0*(?<num>[1-9]\d*)$/.exec(a);if(i){let e=+i.groups.num,n=r.length;if(t.hasNumberedRef=!0,(a=({"":e,"+":n+e,"-":n+1-e})[i.groups.sign])<1)throw Error("Invalid subroutine number")}else"0"===a&&(a=0);let s=iL(a);return n.push(s),s}(r,s);default:throw Error(`Unexpected token type "${r.type}"`)}},s={capturingGroups:[],hasNumberedRef:!1,namedGroupsByName:new Map,nextIndex:0,normalizeUnknownPropertyNames:n.normalizeUnknownPropertyNames,parent:null,skipBackrefValidation:n.skipBackrefValidation,skipLookbehindValidation:n.skipLookbehindValidation,skipPropertyNameValidation:n.skipPropertyNameValidation,subroutines:[],tokens:a.tokens,unicodePropertyMap:n.unicodePropertyMap,walk:i},o=(r={type:"Flags",...a.flags},{type:"Regex",body:iO(void 0),flags:r}),l=o.body[0];for(;s.nextIndex<a.tokens.length;){let e=i(l,{});"Alternative"===e.type?(o.body.push(e),l=e):l.body.push(e)}let{capturingGroups:u,hasNumberedRef:c,namedGroupsByName:d,subroutines:p}=s;if(c&&d.size&&!n.rules.captureGroup)throw Error("Numbered backref/subroutine not allowed when using named capture");for(let{ref:e}of p)if("number"==typeof e){if(e>u.length)throw Error("Subroutine uses a group number that's not defined");e&&(u[e-1].isSubroutined=!0)}else if(d.has(e)){if(d.get(e).length>1)throw Error(it`Subroutine uses a duplicate group name "\g<${e}>"`);d.get(e)[0].isSubroutined=!0}else throw Error(it`Subroutine uses a group name that's not defined "\g<${e}>"`);return o}function i_(e){return{type:"Alternative",body:iB(e?.body)}}function iS(e,t){let r={type:"Assertion",kind:e};return("word_boundary"===e||"text_segment_boundary"===e)&&(r.negate=!!t?.negate),r}function iN(e,t){let r=!!t?.orphan;return{type:"Backreference",ref:e,...r&&{orphan:r}}}function iE(e,t){var r;let n={name:void 0,isSubroutined:!1,...t};if(void 0!==n.name&&(r=n.name,!/^[\p{Alpha}\p{Pc}][^)]*$/u.test(r)))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:iO(t?.body)}}function iI(e,t){let r={useLastValid:!1,...t};if(e>1114111){let t=e.toString(16);if(r.useLastValid)e=1114111;else throw e>1310719?Error(`Invalid code point out of range "\\x{${t}}"`):Error(`Invalid code point out of range in JS "\\x{${t}}"`)}return{type:"Character",value:e}}function iR(e){let t={kind:"union",negate:!1,...e};return{type:"CharacterClass",kind:t.kind,negate:t.negate,body:iB(e?.body)}}function iT(e,t){let r=!!t?.negate,n={type:"CharacterSet",kind:e};return("digit"===e||"hex"===e||"newline"===e||"space"===e||"word"===e)&&(n.negate=r),"text_segment"!==e&&("newline"!==e||r)||(n.variableLength=!0),n}function iP(e){let t=e?.atomic,r=e?.flags;if(t&&r)throw Error("Atomic group cannot have flags");return{type:"Group",...t&&{atomic:t},...r&&{flags:r},body:iO(e?.body)}}function iM(e){let t={behind:!1,negate:!1,...e};return{type:"LookaroundAssertion",kind:t.behind?"lookbehind":"lookahead",negate:t.negate,body:iO(e?.body)}}function ij(e,t,r,n){if(t>r)throw Error("Invalid reversed quantifier range");return{type:"Quantifier",kind:e,min:t,max:r,body:n}}function iL(e){return{type:"Subroutine",ref:e}}function i$(e,t){let r={negate:!1,normalizeUnknownPropertyNames:!1,skipPropertyNameValidation:!1,unicodePropertyMap:null,...t},n=r.unicodePropertyMap?.get(iF(e));if(!n){if(r.normalizeUnknownPropertyNames)n=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());else if(r.unicodePropertyMap&&!r.skipPropertyNameValidation)throw Error(it`Invalid Unicode property "\p{${e}}"`)}return{type:"CharacterSet",kind:"property",value:n??e,negate:r.negate}}function iO(e){if(void 0===e)e=[i_()];else if(!Array.isArray(e)||!e.length||!e.every(e=>"Alternative"===e.type))throw Error("Invalid body; expected array of one or more Alternative nodes");return e}function iB(e){if(void 0===e)e=[];else if(!Array.isArray(e)||!e.every(e=>!!e.type))throw Error("Invalid body; expected array of nodes");return e}function iG(e){return"LookaroundAssertion"===e.type&&"lookahead"===e.kind}function iD(e){return"LookaroundAssertion"===e.type&&"lookbehind"===e.kind}function iF(e){return e.replace(/[- _]+/g,"").toLowerCase()}function iU(e,t){return ir(e,`Unclosed character class${t?.type==="Character"&&93===t.value&&"]"===t.raw?' (started with "]")':""}`)}function iq(e){return ir(e,"Unclosed group")}function iW(e,t,r=null){function n(e,t){for(let r=0;r<e.length;r++){let n=a(e[r],t,r,e);r=Math.max(-1,r+n)}}function a(i,s=null,o=null,l=null){let u=0,c=!1,d={node:i,parent:s,key:o,container:l,root:e,remove(){iz(l).splice(Math.max(0,iH(o)+u),1),u--,c=!0},removeAllNextSiblings:()=>iz(l).splice(iH(o)+1),removeAllPrevSiblings(){let e=iH(o)+u;return u-=e,iz(l).splice(0,Math.max(0,e))},replaceWith(e,t={}){let r=!!t.traverse;l?l[Math.max(0,iH(o)+u)]=e:ir(s,"Can't replace root node")[o]=e,r&&a(e,s,o,l),c=!0},replaceWithMultiple(e,t={}){let r=!!t.traverse;if(iz(l).splice(Math.max(0,iH(o)+u),1,...e),u+=e.length-1,r){let t=0;for(let r=0;r<e.length;r++)t+=a(e[r],s,iH(o)+r+t,l)}c=!0},skip(){c=!0}},{type:p}=i,h=t["*"],f=t[p],m="function"==typeof h?h:h?.enter,g="function"==typeof f?f:f?.enter;if(m?.(d,r),g?.(d,r),!c)switch(p){case"AbsenceFunction":case"Alternative":case"CapturingGroup":case"CharacterClass":case"Group":case"LookaroundAssertion":n(i.body,i);break;case"Assertion":case"Backreference":case"Character":case"CharacterSet":case"Directive":case"Flags":case"NamedCallout":case"Subrout
33ine":break;case"CharacterClassRange":a(i.min,i,"min"),a(i.max,i,"max");break;case"Quantifier":a(i.body,i,"body");break;case"Regex":n(i.body,i),a(i.flags,i,"flags");break;default:throw Error(`Unexpected node type "${p}"`)}return f?.exit?.(d,r),h?.exit?.(d,r),u}return a(e),e}function iz(e){if(!Array.isArray(e))throw Error("Container expected");return e}function iH(e){if("number"!=typeof e)throw Error("Numeric key expected");return e}let iV=String.raw`\(\?(?:[:=!>A-Za-z\-]|<[=!]|\(DEFINE\))`,iQ=Object.freeze({DEFAULT:"DEFAULT",CHAR_CLASS:"CHAR_CLASS"});function iX(e,t,r,n){let a=RegExp(String.raw`${t}|(?<$skip>\[\^?|\\?.)`,"gsu"),i=[!1],s=0,o="";for(let t of e.matchAll(a)){let{0:e,groups:{$skip:a}}=t;if(!a&&(!n||n===iQ.DEFAULT==!s)){r instanceof Function?o+=r(t,{context:s?iQ.CHAR_CLASS:iQ.DEFAULT,negated:i[i.length-1]}):o+=r;continue}"["===e[0]?(s++,i.push("^"===e[1])):"]"===e&&s&&(s--,i.pop()),o+=e}return o}function iK(e,t,r){return!!function(e,t,r=0,n){let a;if(!RegExp(t,"su").test(e))return null;let i=RegExp(`${t}|(?<$skip>\\\\?.)`,"gsu");i.lastIndex=r;let s=0;for(;a=i.exec(e);){let{0:e,groups:{$skip:t}}=a;if(!t&&(!n||n===iQ.DEFAULT==!s))return a;"["===e?s++:"]"===e&&s&&s--,i.lastIndex==a.index&&i.lastIndex++}return null}(e,t,0,r)}let iJ=RegExp(String.raw`(?<noncapturingStart>${iV})|(?<capturingStart>\((?:\?<[^>]+>)?)|\\?.`,"gsu"),iZ=String.raw`(?:[?*+]|\{\d+(?:,\d*)?\})`,iY=RegExp(String.raw`
34\\(?: \d+
35  | c[A-Za-z]
36  | [gk]<[^>]+>
37  | [pPu]\{[^\}]+\}
38  | u[A-Fa-f\d]{4}
39  | x[A-Fa-f\d]{2}
40  )
41| \((?: \? (?: [:=!>]
42  | <(?:[=!]|[^>]+>)
43  | [A-Za-z\-]+:
44  | \(DEFINE\)
45  ))?
46| (?<qBase>${iZ})(?<qMod>[?+]?)(?<invalidQ>[?*+\{]?)
47| \\?.
48`.replace(/\s+/g,""),"gsu"),i0=String.raw,i1=i0`\\g<(?<gRNameOrNum>[^>&]+)&R=(?<gRDepth>[^>]+)>`,i2=i0`\(\?R=(?<rDepth>[^\)]+)\)|${i1}`,i5=i0`\(\?<(?![=!])(?<captureName>[^>]+)>`,i3=i0`${i5}|(?<unnamed>\()(?!\?)`,i6=RegExp(i0`${i5}|${i2}|\(\?|\\?.`,"gsu"),i8="Cannot use multiple overlapping recursions";function i4(e){let t=`Max depth must be integer between 2 and 100; used ${e}`;if(!/^[1-9]\d*$/.test(e)||(e*=1)<2||e>100)throw Error(t)}function i7(e,t,r,n,a,i,s){let o=new Set;n&&iX(e+t,i5,({groups:{captureName:e}})=>{o.add(e)},iQ.DEFAULT);let l=[r,n?o:null,a,i,s];return`${e}${i9(`(?:${e}`,"forward",...l)}(?:)${i9(`${t})`,"backward",...l)}${t}`}function i9(e,t,r,n,a,i,s){let o=e=>"forward"===t?e+2:r-e+2-1,l="";for(let t=0;t<r;t++){let r=o(t);l+=iX(e,i0`${i3}|\\k<(?<backref>[^>]+)>`,({0:e,groups:{captureName:t,unnamed:o,backref:l}})=>{if(l&&n&&!n.has(l))return e;let u=`_$${r}`;if(o||t){let r=s+i.length+1;return i.push(r),function(e,t){for(let r=0;r<e.length;r++)e[r]>=t&&e[r]++}(a,r),o?e:`(?<${t}${u}>`}return i0`\k<${l}${u}>`},iQ.DEFAULT)}return l}function se(e,t,r,n,a,i){if(e.size&&n){let s=0;iX(t,i3,()=>s++,iQ.DEFAULT);let o=i-s+a,l=new Map;return e.forEach((e,t)=>{let a=(n-s*r)/r,i=s*r,u=t>o+s?t+n:t,c=[];for(let t of e)if(t<=o)c.push(t);else if(t>o+s+a)c.push(t+n);else if(t<=o+s)for(let e=0;e<=r;e++)c.push(t+s*e);else for(let e=0;e<=r;e++)c.push(t+i+a*e);l.set(u,c)}),l}return e}var st=String.fromCodePoint,sr=String.raw,sn={},sa=globalThis.RegExp;function si(e,{enable:t,disable:r}){return{dotAll:!r?.dotAll&&!!(t?.dotAll||e.dotAll),ignoreCase:!r?.ignoreCase&&!!(t?.ignoreCase||e.ignoreCase)}}function ss(e,t,r){return e.has(t)||e.set(t,r),e.get(t)}sn.flagGroups=(()=>{try{new sa("(?i:)")}catch{return!1}return!0})(),sn.unicodeSets=(()=>{try{new sa("[[]]","v")}catch{return!1}return!0})(),sn.bugFlagVLiteralHyphenIsRange=!!sn.unicodeSets&&(()=>{try{new sa(sr`[\d\-a]`,"v")}catch{return!0}return!1})(),sn.bugNestedClassIgnoresNegation=sn.unicodeSets&&new sa("[[^a]]","v").test("a");var so={ES2025:2025,ES2024:2024,ES2018:2018},sl={auto:"auto",ES2025:"ES2025",ES2024:"ES2024",ES2018:"ES2018"};function su(e={}){if("[object Object]"!==({}).toString.call(e))throw Error("Unexpected options");
48if(void 0!==e.target&&!sl[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"auto"===t.target&&(t.target=sn.flagGroups?"ES2025":sn.unicodeSets?"ES2024":"ES2018"),t}var sc=new Set([st(304),st(305)]),sd=sr`[\p{L}\p{M}\p{N}\p{Pc}]`;function sp(e){if(sc.has(e))return[e];let t=new Set,r=e.toLowerCase(),n=r.toUpperCase(),a=sg.get(r),i=sf.get(r),s=sm.get(r);return 1==[...n].length&&t.add(n),s&&t.add(s),a&&t.add(a),t.add(r),i&&t.add(i),[...t]}var sh=new Map(`C Other
49Cc Control cntrl
50Cf Format
51Cn Unassigned
52Co Private_Use
53Cs Surrogate
54L Letter
55LC Cased_Letter
56Ll Lowercase_Letter
57Lm Modifier_Letter
58Lo Other_Letter
59Lt Titlecase_Letter
60Lu Uppercase_Letter
61M Mark Combining_Mark
62Mc Spacing_Mark
63Me Enclosing_Mark
64Mn Nonspacing_Mark
65N Number
66Nd Decimal_Number digit
67Nl Letter_Number
68No Other_Number
69P Punctuation punct
70Pc Connector_Punctuation
71Pd Dash_Punctuation
72Pe Close_Punctuation
73Pf Final_Punctuation
74Pi Initial_Punctuation
75Po Other_Punctuation
76Ps Open_Punctuation
77S Symbol
78Sc Currency_Symbol
79Sk Modifier_Symbol
80Sm Math_Symbol
81So Other_Symbol
82Z Separator
83Zl Line_Separator
84Zp Paragraph_Separator
85Zs Space_Separator
86ASCII
87ASCII_Hex_Digit AHex
88Alphabetic Alpha
89Any
90Assigned
91Bidi_Control Bidi_C
92Bidi_Mirrored Bidi_M
93Case_Ignorable CI
94Cased
95Changes_When_Casefolded CWCF
96Changes_When_Casemapped CWCM
97Changes_When_Lowercased CWL
98Changes_When_NFKC_Casefolded CWKCF
99Changes_When_Titlecased CWT
100Changes_When_Uppercased CWU
101Dash
102Default_Ignorable_Code_Point DI
103Deprecated Dep
104Diacritic Dia
105Emoji
106Emoji_Component EComp
107Emoji_Modifier EMod
108Emoji_Modifier_Base EBase
109Emoji_Presentation EPres
110Extended_Pictographic ExtPict
111Extender Ext
112Grapheme_Base Gr_Base
113Grapheme_Extend Gr_Ext
114Hex_Digit Hex
115IDS_Binary_Operator IDSB
116IDS_Trinary_Operator IDST
117ID_Continue IDC
118ID_Start IDS
119Ideographic Ideo
120Join_Control Join_C
121Logical_Order_Exception LOE
122Lowercase Lower
123Math
124Noncharacter_Code_Point NChar
125Pattern_Syntax Pat_Syn
126Pattern_White_Space Pat_WS
127Quotation_Mark QMark
128Radical
129Regional_Indicator RI
130Sentence_Terminal STerm
131Soft_Dotted SD
132Terminal_Punctuation Term
133Unified_Ideograph UIdeo
134Uppercase Upper
135Variation_Selector VS
136White_Space space
137XID_Continue XIDC
138XID_Start XIDS`.split(/\s/).map(e=>[iF(e),e])),sf=new Map([["s",st(383)],[st(383),"s"]]),sm=new Map([[st(223),st(7838)],[st(107),st(8490)],[st(229),st(8491)],[st(969),st(8486)]]),sg=new Map([sy(453),sy(456),sy(459),sy(498),...sv(8072,8079),...sv(8088,8095),...sv(8104,8111),sy(8124),sy(8140),sy(8188)]),sb=new Map([["alnum",sr`[\p{Alpha}\p{Nd}]`],["alpha",sr`\p{Alpha}`],["ascii",sr`\p{ASCII}`],["blank",sr`[\p{Zs}\t]`],["cntrl",sr`\p{Cc}`],["digit",sr`\p{Nd}`],["graph",sr`[\P{space}&&\P{Cc}&&\P{Cn}&&\P{Cs}]`],["lower",sr`\p{Lower}`],["print",sr`[[\P{space}&&\P{Cc}&&\P{Cn}&&\P{Cs}]\p{Zs}]`],["punct",sr`[\p{P}\p{S}]`],["space",sr`\p{space}`],["upper",sr`\p{Upper}`],["word",sr`[\p{Alpha}\p{M}\p{Nd}\p{Pc}]`],["xdigit",sr`\p{AHex}`]]);function sy(e){let t=st(e);return[t.toLowerCase(),t]}function sv(e,t){return(function(e,t){let r=[];for(let n=e;n<=t;n++)r.push(n);return r})(e,t).map(e=>sy(e))}var sw=new Set(["Lower","Lowercase","Upper","Uppercase","Ll","Lowercase_Letter","Lt","Titlecase_Letter","Lu","Uppercase_Letter"]),sk={AbsenceFunction({node:e,parent:t,replaceWith:r}){let{body:n,kind:a}=e;if("repeater"===a){let e=iP();e.body[0].body.push(iM({negate:!0,body:n}),i$("Any"));let a=iP();a.body[0].body.push(ij("greedy",0,1/0,e)),r(sM(a,t),{traverse:!0})}else throw Error('Unsupported absence function "(?~|"')},Alternative:{enter({node:e,parent:t,key:r},{flagDirectivesByAlt:n}){let a=e.body.filter(e=>"flags"===e.kind);for(let e=r+1;e<t.body.length;e++)ss(n,t.body[e],[]).push(...a)},exit({node:e},{flagDirectivesByAlt:t}){if(t.get(e)?.length){let r=sN(t.get(e));if(r){let t=iP({flags:r});t.body[0].body=e.body,e.body=[sM(t,e)]}}}},Assertion({node:e,parent:t,key:r,container:n,root:a,remove:i,replaceWith:s},o){let{kind:l,negate:u}=e,{asciiWordBoundaries:c,avoidSubclass:d,supportedGNodes:p,wordIsAscii:h}=o;if("text_segment_boundary"===l)throw Error(`Unsupported text segment boundary "\\${u?"Y":"y"}"`);if("line_end"===l)s(sM(iM({body:[i_({body:[iS("string_end")]}),i_({body:[iI(10)]})]}),t));else if("line_start"===l)s(sM(sR(sr`(?<=\A|\n(?!\z))`,{skipLookbehindValidation:!0}),t));else if("search_start"===l)if(p.has(e))a.flags.sticky=!0,i();else{var f;let e,a=n[r-1];if(a&&((e=["Character","CharacterClass","CharacterSet"]).includes((f=a).type)||"Quantifier"===f.type&&f.min&&e.includes(f.body.type)))s(sM(iM({negate:!0}),t));else if(d)throw Error(sr`Uses "\G" in a way that requires a subclass`);else s(sP(iS("string_start"),t)),o.strategy="clip_search"}else if("string_end"===l||"string_start"===l);else if("string_end_newline"===l)s(sM(sR(sr`(?=\n?\z)`),t));else if("word_boundary"===l){if(!h&&!c){let e=`(?:(?<=${sd})(?!${sd})|(?<!${sd})(?=${sd}))`,r=`(?:(?<=${sd})(?=${sd})|(?<!${sd})(?!${sd}))`;s(sM(sR(u?r:e),t))}}else throw Error(`Unexpected assertion kind "${l}"`)},Backreference({node:e},{jsGroupNameMap:t}){let{ref:r}=e;"string"!=typeof r||sI(r)||(e.ref=r=sS(r,t))},CapturingGroup({node:e},{jsGroupNameMap:t,subroutineRefMap:r}){let{name:n}=e;n&&!sI(n)&&(e.name=n=sS(n,t)),r.set(e.number,e),n&&r.set(n,e)},CharacterClassRange({node:e,parent:t,replaceWith:r}){"intersection"===t.kind&&r(sM(iR({body:[e]}),t),{traverse:!0})},CharacterSet({node:e,parent:t,replaceWith:r},{accuracy:n,minTargetEs2024:a,digitIsAscii:i,spaceIsAscii:s,wordIsAscii:o}){let{kind:l,negate:u,value:c}=e;if(i&&("digit"===l||"digit"===c))return void r(sP(iT("digit",{negate:u}),t));if(s&&("space"===l||"space"===c))return void r(sM(sT(sR("[	-\r ]"),u),t));if(o&&("word"===l||"word"===c))return void r(sP(iT("word",{negate:u}),t));if("any"===l)r(sP(i$("Any"),t));else if("digit"===l)r(sP(i$("Nd",{negate:u}),t));else if("dot"===l);else if("text_segment"===l){if("strict"===n)throw Error(sr`Use of "\X" requires non-strict accuracy`);let e="\\p{Emoji}(?:\\p{EMod}|\\uFE0F\\u20E3?|[\\x{E0020}-\\x{E007E}]+\\x{E007F})?",i=sr`\p{RI}{2}|${e}(?:\u200D${e})*`;r(sM(sR(sr`(?>\r\n|${a?sr`\p{RGI_Emoji}`:i}|\P{M}\p{M}*)`,{skipPropertyNameValidation:!0}),t))}else if("hex"===l)r(sP(i$("AHex",{negate:u}),t));else if("newline"===l)r(sM(sR(u?"[^\n]":"(?>\r\n?|[\n\v\f…\u2028\u2029])"),t));else if("posix"===l)if(a||"graph"!==c&&"print"!==c)r(sM(sT(sR(sb.get(c)),u),t));else{if("strict"===n)throw Error(`POSIX class "${c}" requires min target ES2024 or non-strict accuracy`);let e={graph:"!-~",print:" -~"}[c];u&&(e=`\0-${st(e.codePointAt(0)-1)}${st(e.codePointAt(2)+1)}-\u{10FFFF}`),r(sM(sR(`[${e}]`),t))}else if("property"===l)sh.has(iF(c))||(e.key="sc");
138else if("space"===l)r(sP(i$("space",{negate:u}),t));else if("word"===l)r(sM(sT(sR(sd),u),t));else throw Error(`Unexpected character set kind "${l}"`)},Directive({node:e,parent:t,root:r,remove:n,replaceWith:a,removeAllPrevSiblings:i,removeAllNextSiblings:s}){let{kind:o,flags:l}=e;if("flags"===o)if(l.enable||l.disable){let e=iP({flags:l});e.body[0].body=s(),a(sM(e,t),{traverse:!0})}else n();else if("keep"===o){let e=r.body[0],n=1===r.body.length&&ix(e,{type:"Group"})&&1===e.body[0].body.length?e.body[0]:r;if(t.parent!==n||n.body.length>1)throw Error(sr`Uses "\K" in a way that's unsupported`);let s=iM({behind:!0});s.body[0].body=i(),a(sM(s,t))}else throw Error(`Unexpected directive kind "${o}"`)},Flags({node:e,parent:t}){if(e.posixIsAscii)throw Error('Unsupported flag "P"');if("word"===e.textSegmentMode)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:r}=e.flags;t?.extended&&delete t.extended,r?.extended&&delete r.extended,t?.dotAll&&r?.dotAll&&delete t.dotAll,t?.ignoreCase&&r?.ignoreCase&&delete t.ignoreCase,t&&!Object.keys(t).length&&delete e.flags.enable,r&&!Object.keys(r).length&&delete e.flags.disable,e.flags.enable||e.flags.disable||delete e.flags},LookaroundAssertion({node:e},t){let{kind:r}=e;"lookbehind"===r&&(t.passedLookbehind=!0)},NamedCallout({node:e,parent:t,replaceWith:r}){let{kind:n}=e;if("fail"===n)r(sM(iM({negate:!0}),t));else throw Error(`Unsupported named callout "(*${n.toUpperCase()}"`)},Quantifier({node:e}){if("Quantifier"===e.body.type){let t=iP();t.body[0].body.push(e.body),e.body=sM(t,e)}},Regex:{enter({node:e},{supportedGNodes:t}){let r=[],n=!1,a=!1;for(let t of e.body)if(1===t.body.length&&"search_start"===t.body[0].kind)t.body.pop();else{let e=function e(t){let r=t.find(e=>"search_start"===e.kind||function(e,t){let r={negate:null,...t};return"LookaroundAssertion"===e.type&&(null===r.negate||e.negate===r.negate)&&1===e.body.length&&ix(e.body[0],{type:"Assertion",kind:"search_start"})}(e,{negate:!1})||!function({type:e}){return"Assertion"===e||"Directive"===e||"LookaroundAssertion"===e}(e));if(!r)return null;if("search_start"===r.kind)return r;if("LookaroundAssertion"===r.type)return r.body[0].body[0];if("CapturingGroup"===r.type||"Group"===r.type){let t=[];for(let n of r.body){let r=e(n.body);if(!r)return null;Array.isArray(r)?t.push(...r):t.push(r)}return t}return null}(t.body);e?(n=!0,Array.isArray(e)?r.push(...e):r.push(e)):a=!0}n&&!a&&r.forEach(e=>t.add(e))},exit(e,{accuracy:t,passedLookbehind:r,strategy:n}){if("strict"===t&&r&&n)throw Error(sr`Uses "\G" in a way that requires non-strict accuracy`)}},Subroutine({node:e},{jsGroupNameMap:t}){let{ref:r}=e;"string"!=typeof r||sI(r)||(e.ref=r=sS(r,t))}},sx={Backreference({node:e},{multiplexCapturesToLeftByRef:t,reffedNodesByReferencer:r}){let{orphan:n,ref:a}=e;n||r.set(e,[...t.get(a).map(({node:e})=>e)])},CapturingGroup:{enter({node:e,parent:t,replaceWith:r,skip:n},{groupOriginByCopy:a,groupsByName:i,multiplexCapturesToLeftByRef:s,openRefs:o,reffedNodesByReferencer:l}){let u=a.get(e);if(u&&o.has(e.number)){let n=sP(s_(e.number),t);l.set(n,o.get(e.number)),r(n);return}o.set(e.number,e),s.set(e.number,[]),e.name&&ss(s,e.name,[]);let c=s.get(e.name??e.number);for(let t=0;t<c.length;t++){let r=c[t];if(u===r.node||u&&u===r.origin||e===r.origin){c.splice(t,1);break}}if(s.get(e.number).push({node:e,origin:u}),e.name&&s.get(e.name).push({node:e,origin:u}),e.name){let t=ss(i,e.name,new Map),r=!1;if(u)r=!0;else for(let e of t.values())if(!e.hasDuplicateNameToRemove){r=!0;break}i.get(e.name).set(e,{node:e,hasDuplicateNameToRemove:r})}},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=si(t.currentFlags,e.flags))},exit(e,t){t.currentFlags=t.prevFlags}},Subroutine({node:e,parent:t,replaceWith:r},n){let{isRecursive:a,ref:i}=e;if(a){let r=t;for(;(r=r.parent)&&("CapturingGroup"!==r.type||r.name!==i&&r.number!==i););n.reffedNodesByReferencer.set(e,r);return}let s=n.subroutineRefMap.get(i),o=0===i,l=o?s_(0):function e(t,r,n,a){let i=Array.isArray(t)?[]:{};for(let[s,o]of Object.entries(t))"parent"===s?i.parent=Array.isArray(n)?a:n:o&&"object"==typeof o?i[s]=e(o,r,i,n):("type"===s&&"CapturingGroup"===o&&r.set(i,r.get(t)??t),i[s]=o);return i}(s,n.groupOriginByCopy,null),u=l;if(!o){var c,d;let e=sN(function(e,t){let r=[];for(;e=e.parent;)(!t||t(e))&&r.push(e);return r}(s,e=>"Group"===e.type&&!!e.flags)),t=e?si(n.globalFlags,e):n.globalFlags;c=t,d=n.currentFlags,(c.dotAll!==d.dotAll||c.ignoreCase!==d.ignoreCase)&&(u=iP({flags:function({dotAll:e,ignoreCase:t}){let r={};return(e||t)&&(r.enable={}
138,e&&(r.enable.dotAll=!0),t&&(r.enable.ignoreCase=!0)),e&&t||(r.disable={},e||(r.disable.dotAll=!0),t||(r.disable.ignoreCase=!0)),r}(t)})).body[0].body.push(l)}r(sM(u,t),{traverse:!o})}},sC={Backreference({node:e,parent:t,replaceWith:r},n){if(e.orphan){n.highestOrphanBackref=Math.max(n.highestOrphanBackref,e.ref);return}let a=n.reffedNodesByReferencer.get(e).filter(t=>(function(e,t){let r=t;do{if("Regex"===r.type)return!1;if("Alternative"===r.type)continue;if(r===e)return!1;for(let t of sE(r.parent)){if(t===r)break;if(t===e||function e(t,r){for(let n of sE(t)??[])if(n===r||e(n,r))return!0;return!1}(t,e))return!0}}while(r=r.parent)throw Error("Unexpected path")})(t,e));a.length?a.length>1?r(sM(iP({atomic:!0,body:a.reverse().map(e=>i_({body:[iN(e.number)]}))}),t)):e.ref=a[0].number:r(sM(iM({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 r=Math.max(t.highestOrphanBackref-t.numCapturesToLeft,0);for(let t=0;t<r;t++){let t=iE();e.body.at(-1).body.push(t)}}},Subroutine({node:e},t){e.isRecursive&&0!==e.ref&&(e.ref=t.reffedNodesByReferencer.get(e).number)}};function sA(e){iW(e,{"*"({node:e,parent:t}){e.parent=t}})}function s_(e){let t=iL(e);return t.isRecursive=!0,t}function sS(e,t){if(t.has(e))return t.get(e);let r=`$${t.size}_${e.replace(/^[^$_\p{IDS}]|[^$\u200C\u200D\p{IDC}]/ug,"_")}`;return t.set(e,r),r}function sN(e){let t=["dotAll","ignoreCase"],r={enable:{},disable:{}};return(e.forEach(({flags:e})=>{t.forEach(t=>{e.enable?.[t]&&(delete r.disable[t],r.enable[t]=!0),e.disable?.[t]&&(r.disable[t]=!0)})}),Object.keys(r.enable).length||delete r.enable,Object.keys(r.disable).length||delete r.disable,r.enable||r.disable)?r:null}function sE(e){if(!e)throw Error("Node expected");let{body:t}=e;return Array.isArray(t)?t:t?[t]:null}function sI(e){return/^[$_\p{IDS}][$\u200C\u200D\p{IDC}]*$/u.test(e)}function sR(e,t){let r=iA(e,{...t,unicodePropertyMap:sh}).body;return r.length>1||r[0].body.length>1?iP({body:r}):r[0].body[0]}function sT(e,t){return e.negate=t,e}function sP(e,t){return e.parent=t,e}function sM(e,t){return sA(e),e.parent=t,e}var sj={"*":{enter({node:e},t){if(sW(e)){let r=t.getCurrentModI();t.pushModI(e.flags?si({ignoreCase:r},e.flags).ignoreCase:r)}},exit({node:e},t){sW(e)&&t.popModI()}}
138,Backreference(e,t){t.setHasCasedChar()},Character({node:e},t){sF(st(e.value))&&t.setHasCasedChar()},CharacterClassRange({node:e,skip:t},r){t(),sU(e,{firstOnly:!0}).length&&r.setHasCasedChar()},CharacterSet({node:e},t){"property"===e.kind&&sw.has(e.value)&&t.setHasCasedChar()}},sL={Alternative:({body:e},t,r)=>e.map(r).join(""),Assertion({kind:e,negate:t}){if("string_end"===e)return"$";if("string_start"===e)return"^";if("word_boundary"===e)return t?sr`\B`:sr`\b`;throw Error(`Unexpected assertion kind "${e}"`)},Backreference({ref:e},t){if("number"!=typeof e)throw Error("Unexpected named backref in transformed AST");if(!t.useFlagMods&&"strict"===t.accuracy&&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,r){let{body:n,name:a,number:i}=e,s={ignoreCase:t.currentFlags.ignoreCase},o=t.originMap.get(e);return o&&(s.hidden=!0,i>o.number&&(s.transferTo=o.number)),t.captureMap.set(i,s),`(${a?`?<${a}>`:""}${n.map(r).join("|")})`},Character({value:e},t){let r=st(e),n=sq(e,{escDigit:"Backreference"===t.lastNode.type,inCharClass:t.inCharClass,useFlagV:t.useFlagV});if(n!==r)return n;if(t.useAppliedIgnoreCase&&t.currentFlags.ignoreCase&&sF(r)){let e=sp(r);return t.inCharClass?e.join(""):e.length>1?`[${e.join("")}]`:e[0]}return r},CharacterClass(e,t,r){let{kind:n,negate:a,parent:i}=e,{body:s}=e;if("intersection"===n&&!t.useFlagV)throw Error("Use of character class intersection requires min target ES2024");sn.bugFlagVLiteralHyphenIsRange&&t.useFlagV&&s.some(sz)&&(s=[iI(45),...s.filter(e=>!sz(e))]);let o=()=>`[${a?"^":""}${s.map(r).join("intersection"===n?"&&":"")}]`;if(!t.inCharClass){if((!t.useFlagV||sn.bugNestedClassIgnoresNegation)&&!a){let t=s.filter(e=>"CharacterClass"===e.type&&"union"===e.kind&&e.negate);if(t.length){let n=iP(),a=n.body[0];return n.parent=i,a.parent=n,e.body=s=s.filter(e=>!t.includes(e)),s.length?(e.parent=a,a.body.push(e)):n.body.pop(),t.forEach(e=>{let t=i_({body:[e]});e.parent=t,t.parent=n,n.body.push(t)}),r(n)}}t.inCharClass=!0;let n=o();return t.inCharClass=!1,n}let l=s[0];if("union"===n&&!a&&l&&((!t.useFlagV||!t.verbose)&&"union"===i.kind&&!(sn.bugFlagVLiteralHyphenIsRange&&t.useFlagV)||!t.verbose&&"intersection"===i.kind&&1===s.length&&"CharacterClassRange"!==l.type))return s.map(r).join("");if(!t.useFlagV&&"CharacterClass"===i.type)throw Error("Uses nested character class in a way that requires min target ES2024");return o()},CharacterClassRange(e,t){let r=e.min.value,n=e.max.value,a={escDigit:!1,inCharClass:!0,useFlagV:t.useFlagV},i=sq(r,a),s=sq(n,a),o=new Set;return t.useAppliedIgnoreCase&&t.currentFlags.ignoreCase&&(function(e){let t=e.map(e=>e.codePointAt(0)).sort((e,t)=>e-t),r=[],n=null;for(let e=0;e<t.length;e++)t[e+1]===t[e]+1?n??=t[e]:null===n?r.push(t[e]):(r.push([n,t[e]]),n=null);return r})(sU(e)).forEach(e=>{o.add(Array.isArray(e)?`${sq(e[0],a)}-${sq(e[1],a)}`:sq(e,a))}),`${i}-${s}${[...o].join("")}`},CharacterSet({kind:e,negate:t,value:r,key:n},a){if("dot"===e)return a.currentFlags.dotAll?a.appliedGlobalFlags.dotAll||a.useFlagMods?".":"[^]":sr`[^\n]`;if("digit"===e)return t?sr`\D`:sr`\d`;if("property"===e){if(a.useAppliedIgnoreCase&&a.currentFlags.ignoreCase&&sw.has(r))throw Error(`Unicode property "${r}" can't be case-insensitive when other chars have specific case`);return`${t?sr`\P`:sr`\p`}{${n?`${n}=`:""}${r}}`}if("word"===e)return t?sr`\W`:sr`\w`;throw Error(`Unexpected character set kind "${e}"`)},Flags:(e,t)=>(t.appliedGlobalFlags.ignoreCase?"i":"")+(e.dotAll?"s":"")+(e.sticky?"y":""),Group({atomic:e,body:t,flags:r,parent:n},a,i){let s=a.currentFlags;r&&(a.currentFlags=si(s,r));let o=t.map(i).join("|"),l=a.verbose||1!==t.length||"Quantifier"===n.type||e||a.useFlagMods&&r?`(?${function(e,t,r){if(e)return">";let n="";if(t&&r){let{enable:e,disable:r}=t;n=(e?.ignoreCase?"i":"")+(e?.dotAll?"s":"")+(r?"-":"")+(r?.ignoreCase?"i":"")+(r?.dotAll?"s":"")}return`${n}:`}(e,r,a.useFlagMods)}${o})`:o;return a.currentFlags=s,l},LookaroundAssertion({body:e,kind:t,negate:r},n,a){let i=`${"lookahead"===t?"":"<"}${r?"!":"="}`;return`(?${i}${e.map(a).join("|")})`},Quantifier:(e,t,r)=>r(e.body)+function({kind:e,max:t,min:r}){return(r||1!==t?r||t!==1/0?1===r&&t===1/0?"+":r===t?`{${r}}`:`{${r},${t===1/0?"":t}}`:"*":"?")+({greedy:"",lazy:"?",possessive:"+"})[e]}(e),Subroutine({isRecursive:e,ref:t},r){if(!e)throw Error("Unexpected non-recursive subroutine in transformed AST");let n=r.recursionLimit;return 0===t?`(?R=${n})`:sr`\g<${t}&R=${n}>`}},s$=new Set(["$","(",")","*","+",".","?","[","\\","]","^","{","|","}"]),sO=new Set(["-","\\","]","^","["]),sB=new Set(["(",")","-","/","[","\\","]","^","{","|","}","!","#","$","%","&","*","+",",",".",":",";","<","=",">","?","@","`","~"]),sG=new Map([[9,sr`\t`],[10,sr`\n`],[11,sr`\v`],[12,sr`\f`],[13,sr`\r`],[8232,sr`\u2028`],[8233,sr`\u2029`],[65279,sr`\uFEFF`]]),sD=/^\p{Cased}$/u;function sF(e){return sD.test(e)}function sU(e,t){let r=!!t?.firstOnly,n=e.min.value,a=e.max.value,i=[];if(n<65&&(65535===a||a>=131071)||65536===n&&a>=131071)return i;for(let e=n;e<=a;e++){let t=st(e);if(!sF(t))continue;let s=sp(t).filter(e=>{let t=e.codePointAt(0);return t<n||t>a});if(s.length&&(i.push(...s),r))break}return i}function sq(e,{escDigit:t,inCharClass:r,useFlagV:n}){var a;if(sG.has(e))return sG.get(e);if(e<32||e>126&&e<160||e>262143||t&&(a=e)>47&&a<58)return e>255?`\\u{${e.toString(16).toUpperCase()}}`:`\\x${e.toString(16).toUpperCase().padStart(2,"0")}`;let i=st(e);return((r?n?sB:sO:s$).has(i)?"\\":"")+i}function sW({type:e}){return"CapturingGroup"===e||"Group"===e||"LookaroundAssertion"===e}function sz({type:e,value:t}){return"Character"===e&&45===t}var sH=class e extends RegExp{#e=new Map;#t=null;#r;#n=null;#a=null;rawOptions={};get source(){return this.#r||"(?:)"}constructor(t,r,n){const a=!!n?.lazyCompile;
138if(t instanceof RegExp){if(n)throw Error("Cannot provide options when copying a regexp");super(t,r),this.#r=t.source,t instanceof e&&(this.#e=t.#e,this.#n=t.#n,this.#a=t.#a,this.rawOptions=t.rawOptions)}else{const e={hiddenCaptures:[],strategy:null,transfers:[],...n};super(a?"":t,r),this.#r=t,this.#e=function(e,t){let r=new Map;for(let t of e)r.set(t,{hidden:!0});for(let[e,n]of t)for(let t of n)ss(r,t,{}).transferTo=e;return r}(e.hiddenCaptures,e.transfers),this.#a=e.strategy,this.rawOptions=n??{}}a||(this.#t=this)}exec(t){if(!this.#t){let{lazyCompile:t,...r}=this.rawOptions;this.#t=new e(this.#r,this.flags,r)}let r=this.global||this.sticky,n=this.lastIndex;if("clip_search"===this.#a&&r&&n){this.lastIndex=0;let e=this.#i(t.slice(n));return e&&(function(e,t,r,n){if(e.index+=t,e.input=r,n){let r=e.indices;for(let e=0;e<r.length;e++){let n=r[e];n&&(r[e]=[n[0]+t,n[1]+t])}let n=r.groups;n&&Object.keys(n).forEach(e=>{let r=n[e];r&&(n[e]=[r[0]+t,r[1]+t])})}}(e,n,t,this.hasIndices),this.lastIndex+=n),e}return this.#i(t)}#i(e){let t;this.#t.lastIndex=this.lastIndex;let r=super.exec.call(this.#t,e);if(this.lastIndex=this.#t.lastIndex,!r||!this.#e.size)return r;let n=[...r];r.length=1,this.hasIndices&&(t=[...r.indices],r.indices.length=1);let a=[0];for(let e=1;e<n.length;e++){let{hidden:i,transferTo:s}=this.#e.get(e)??{};if(i?a.push(null):(a.push(r.length),r.push(n[e]),this.hasIndices&&r.indices.push(t[e])),s&&void 0!==n[e]){let i=a[s];if(!i)throw Error(`Invalid capture transfer to "${i}"`);if(r[i]=n[e],this.hasIndices&&(r.indices[i]=t[e]),r.groups){this.#n||(this.#n=function(e){let t,r=/(?<capture>\((?:\?<(?![=!])(?<name>[^>]+)>|(?!\?)))|\\?./gsu,n=new Map,a=0,i=0;for(;t=r.exec(e);){let{0:e,groups:{capture:r,name:s}}=t;"["===e?a++:a?"]"===e&&a--:r&&(i++,s&&n.set(i,s))}return n}(this.source));let a=this.#n.get(s);a&&(r.groups[a]=n[e],this.hasIndices&&(r.indices.groups[a]=t[e]))}}}return r}};class sV{constructor(e,t={}){this.patterns=e,this.options=t;const{forgiving:r=!1,cache:n,regexConstructor:a}=t;if(!a)throw Error("Option `regexConstructor` is not provided");this.regexps=e.map(e=>{if("string"!=typeof e)return e;let t=n?.get(e);if(t){if(t instanceof RegExp)return t;if(r)return null;throw t}try{let t=a(e);return n?.set(e,t),t}catch(t){if(n?.set(e,t),r)return null;throw t}})}regexps;findNextMatchSync(e,t,r){let n="string"==typeof e?e:e.content,a=[];function i(e,t,r=0){return{index:e,captureIndices:t.indices.map(e=>null==e?{start:0xffffffff,end:0xffffffff,length:0}:{start:e[0]+r,end:e[1]+r,length:e[1]-e[0]})}}for(let e=0;e<this.regexps.length;e++){let r=this.regexps[e];if(r)try{r.lastIndex=t;let s=r.exec(n);if(!s)continue;if(s.index===t)return i(e,s,0);a.push([e,s,0])}catch(e){if(this.options.forgiving)continue;throw e}}if(a.length){let e=Math.min(...a.map(e=>e[1].index));for(let[t,r,n]of a)if(r.index===e)return i(t,r,n)}return null}}var sQ=function(e={}){let t=Object.assign({target:"auto",cache:new Map},e);return t.regexConstructor||=e=>{let r;return(r=function(e,t){var r;let n,a,i,s,o=su(t),l=(r=iA(e,{flags:o.flags,normalizeUnknownPropertyNames:!0,rules:{captureGroup:o.rules.captureGroup,singleline:o.rules.singleline},skipBackrefValidation:o.rules.allowOrphanBackrefs,unicodePropertyMap:sh}),n={accuracy:"default",asciiWordBoundaries:!1,avoidSubclass:!1,bestEffortTarget:"ES2025",...{accuracy:o.accuracy,asciiWordBoundaries:o.rules.asciiWordBoundaries,avoidSubclass:o.avoidSubclass,bestEffortTarget:o.target}},sA(r),a={accuracy:n.accuracy,asciiWordBoundaries:n.asciiWordBoundaries,avoidSubclass:n.avoidSubclass,flagDirectivesByAlt:new Map,jsGroupNameMap:new Map,minTargetEs2024:so[n.bestEffortTarget]>=so.ES2024,passedLookbehind:!1,strategy:null,subroutineRefMap:new Map,supportedGNodes:new Set,digitIsAscii:r.flags.digitIsAscii,spaceIsAscii:r.flags.spaceIsAscii,wordIsAscii:r.flags.wordIsAscii},iW(r,sk,a),s={currentFlags:i={dotAll:r.flags.dotAll,ignoreCase:r.flags.ignoreCase},prevFlags:null,globalFlags:i,groupOriginByCopy:new Map,groupsByName:new Map,multiplexCapturesToLeftByRef:new Map,openRefs:new Map,reffedNodesByReferencer:new Map,subroutineRefMap:a.subroutineRefMap},iW(r,sx,s),iW(r,sC,{groupsByName:s.groupsByName,highestOrphanBackref:0,numCapturesToLeft:0,reffedNodesByReferencer:s.reffedNodesByReferencer}),r._originMap=s.groupOriginByCopy,r._strategy=a.strategy,r),u=function(e,t){let r=su(t),n=so[r.target]>=so.ES2024,a=so[r.target]>=so.ES2025,i=r.rules.recursionLimit;if(!Number.isInteger(i)||i<2||i>20)throw Error("Invalid recursionLimit; use 2-20");let s=null,o=null;if(!a){let t=[e.flags.ignoreCase];iW(e,sj,{getCurrentModI:()=>
138t.at(-1),popModI(){t.pop()},pushModI(e){t.push(e)},setHasCasedChar(){t.at(-1)?s=!0:o=!0}})}let l={dotAll:e.flags.dotAll,ignoreCase:!!((e.flags.ignoreCase||s)&&!o)},u=e,c={accuracy:r.accuracy,appliedGlobalFlags:l,captureMap:new Map,currentFlags:{dotAll:e.flags.dotAll,ignoreCase:e.flags.ignoreCase},inCharClass:!1,lastNode:u,originMap:e._originMap,recursionLimit:i,useAppliedIgnoreCase:!!(!a&&s&&o),useFlagMods:a,useFlagV:n,verbose:r.verbose};function d(e){return c.lastNode=u,u=e,(function(e,t){if(null==e)throw Error(t??"Value expected");return e})(sL[e.type],`Unexpected node type "${e.type}"`)(e,c,d)}let p={pattern:e.body.map(d).join("|"),flags:d(e.flags),options:{...e.options}};return n||(delete p.options.force.v,p.options.disable.v=!0,p.options.unicodeSetsPlugin=null),p._captureTransfers=new Map,p._hiddenCaptures=[],c.captureMap.forEach((e,t)=>{e.hidden&&p._hiddenCaptures.push(t),e.transferTo&&ss(p._captureTransfers,e.transferTo,[]).push(t)}),p}(l,o),c=function(e,t){let r,{hiddenCaptures:n,mode:a}={hiddenCaptures:[],mode:"plugin",...t},i=t?.captureTransfers??new Map;if(!RegExp(i2,"su").test(e))return{pattern:e,captureTransfers:i,hiddenCaptures:n};if("plugin"===a&&iK(e,i0`\(\?\(DEFINE\)`,iQ.DEFAULT))throw Error("DEFINE groups cannot be used with recursion");let s=[],o=iK(e,i0`\\[1-9]`,iQ.DEFAULT),l=new Map,u=[],c=!1,d=0,p=0;for(i6.lastIndex=0;r=i6.exec(e);){let{0:t,groups:{captureName:h,rDepth:f,gRNameOrNum:m,gRDepth:g}}=r;if("["===t)d++;else if(d)"]"===t&&d--;else if(f){if(i4(f),c)throw Error(i8);if(o)throw Error(`${"external"===a?"Backrefs":"Numbered backrefs"} cannot be used with global recursion`);let t=e.slice(0,r.index),l=e.slice(i6.lastIndex);if(iK(l,i2,iQ.DEFAULT))throw Error(i8);let u=f-1;e=i7(t,l,u,!1,n,s,p),i=se(i,t,u,s.length,0,p);break}else if(m){i4(g);let d=!1;for(let e of u)if(e.name===m||e.num===+m){if(d=!0,e.hasRecursedWithin)throw Error(i8);break}if(!d)throw Error(i0`Recursive \g cannot be used outside the referenced group "${"external"===a?m:i0`\g<${m}&R=${g}>`}"`);let h=l.get(m),f=function(e,t){let r,n=/\\?./gsu;n.lastIndex=t;let a=e.length,i=0,s=1;for(;r=n.exec(e);){let[e]=r;if("["===e)i++;else if(i)"]"===e&&i--;else if("("===e)s++;else if(")"===e&&!--s){a=r.index;break}}return e.slice(t,a)}(e,h);if(o&&iK(f,i0`${i5}|\((?!\?)`,iQ.DEFAULT))throw Error(`${"external"===a?"Backrefs":"Numbered backrefs"} cannot be used with recursion of capturing groups`);let b=e.slice(h,r.index),y=f.slice(b.length+t.length),v=s.length,w=g-1,k=i7(b,y,w,!0,n,s,p);i=se(i,b,w,s.length-v,v,p);let x=e.slice(0,h),C=e.slice(h+f.length);e=`${x}${k}${C}`,i6.lastIndex+=k.length-t.length-b.length-y.length,u.forEach(e=>e.hasRecursedWithin=!0),c=!0}else if(h)p++,l.set(String(p),i6.lastIndex),l.set(h,i6.lastIndex),u.push({num:p,name:h});else if("("===t[0]){let e="("===t;e&&(p++,l.set(String(p),i6.lastIndex)),u.push(e?{num:p}:{})}else")"===t&&u.pop()}return n.push(...s),{pattern:e,captureTransfers:i,hiddenCaptures:n}}(u.pattern,{captureTransfers:u._captureTransfers,hiddenCaptures:u._hiddenCaptures,mode:"external"}),d=function(e,t){let r,n=t?.hiddenCaptures??[],a=t?.captureTransfers??new Map;if(!/\(\?>/.test(e))return{pattern:e,captureTransfers:a,hiddenCaptures:n};let i="(?:(?=(",s=[0],o=[],l=0,u=0,c=NaN;do{let t;r=!1;let d=0,p=0,h=!1;for(iJ.lastIndex=Number.isNaN(c)?0:c+i.length;t=iJ.exec(e);){let{0:f,index:m,groups:{capturingStart:g,noncapturingStart:b}}=t;if("["===f)d++;else if(d)"]"===f&&d--;else if("(?>"!==f||h){if(h&&b)p++;else if(g)h?p++:(l++,s.push(l+u));else if(")"===f&&h){if(!p){let t=l+ ++u;e=`${e.slice(0,c)}${i}${e.slice(c+3,m)}))<$$${t}>)${e.slice(m+1)}`,r=!0,o.push(t);for(let e=0;e<n.length;e++)n[e]>=t&&n[e]++;if(a.size){let e=new Map;a.forEach((r,n)=>{e.set(n>=t?n+1:n,r.map(e=>e>=t?e+1:e))}),a=e}break}p--}}else c=m,h=!0}}while(r)return n.push(...o),{pattern:e=iX(e,String.raw`\\(?<backrefNum>[1-9]\d*)|<\$\$(?<wrappedBackrefNum>\d+)>`,({0:e,groups:{backrefNum:t,wrappedBackrefNum:r}})=>{if(t){let r=+t;if(r>s.length-1)throw Error(`Backref "${e}" greater than number of captures`);return`\\${s[r]}`}return`\\${r}`},iQ.DEFAULT),captureTransfers:a,hiddenCaptures:n}}(function(e){let t;if(!RegExp(`${iZ}\\+`).test(e))return{pattern:e};let r=[],n=null,a=null,i="",s=0;for(iY.lastIndex=0;t=iY.exec(e);){let{0:u,index:c,groups:{qBase:d,qMod:p,invalidQ:h}}=t;if("["===u)s||(a=c),s++;else if("]"===u)s?s--:a=null;else if(!s)if("+"===p&&i&&!i.startsWith("(")){if(h)throw Error(`Invalid quantifier "${u}"`);let t=-1;
138if(/^\{\d+\}$/.test(d)){var o,l;o=e,l=c+d.length,e=o.slice(0,l)+""+o.slice(l+p.length)}else{if(")"===i||"]"===i){let t=")"===i?n:a;if(null===t)throw Error(`Invalid unmatched "${i}"`);e=`${e.slice(0,t)}(?>${e.slice(t,c)}${d})${e.slice(c+u.length)}`}else e=`${e.slice(0,c-i.length)}(?>${i}${d})${e.slice(c+u.length)}`;t+=4}iY.lastIndex+=t}else"("===u[0]?r.push(c):")"===u&&(n=r.length?r.pop():null);i=u}return{pattern:e}}(c.pattern).pattern,{captureTransfers:c.captureTransfers,hiddenCaptures:c.hiddenCaptures}),p={pattern:d.pattern,flags:`${o.hasIndices?"d":""}${o.global?"g":""}${u.flags}${u.options.disable.v?"u":"v"}`};if(o.avoidSubclass){if(o.lazyCompileLength!==1/0)throw Error("Lazy compilation requires subclass")}else{let e=d.hiddenCaptures.sort((e,t)=>e-t),t=Array.from(d.captureTransfers),r=l._strategy,n=p.pattern.length>=o.lazyCompileLength;(e.length||t.length||r||n)&&(p.options={...e.length&&{hiddenCaptures:e},...t.length&&{transfers:t},...r&&{strategy:r},...n&&{lazyCompile:n}})}return p}(e,{global:!0,hasIndices:!0,lazyCompileLength:3e3,rules:{allowOrphanBackrefs:!0,asciiWordBoundaries:!0,captureGroup:!0,recursionLimit:5,singleline:!0},...{target:t.target}})).options?new sH(r.pattern,r.flags,r.options):new RegExp(r.pattern,r.flags)},{createScanner:e=>new sV(e,t),createString:e=>({content:e})}}({forgiving:!0}),sX=Object.fromEntries(ry.flatMap(e=>{var t;return(null!=(t=e.aliases)?t:[]).map(t=>[t,e.id])})),sK=new Set(Object.keys(rk)),sJ=e=>{let t=e.trim().toLowerCase();return sX[t]||(sK.has(t),t)},sZ=new Map,sY=new Map,s0=new Map,s1=e=>{var t;return"string"==typeof e?e:null!=(t=e.name)?t:"custom"},s2=function(e={}){var t;let r=null!=(t=e.themes)?t:["github-light","github-dark"];return{name:"shiki",type:"code-highlighter",supportsLanguage(e){let t=sJ(e);return sK.has(t)},getSupportedLanguages:()=>Array.from(sK),getThemes:()=>r,highlight({code:e,language:t,themes:r},n){let a,i,s=sJ(t),o=[s1(r[0]),s1(r[1])],l=(a=e.slice(0,100),i=e.length>100?e.slice(-100):"",`${s}:${o[0]}:${o[1]}:${e.length}:${a}:${i}`);return sY.has(l)?sY.get(l):(n&&(s0.has(l)||s0.set(l,new Set),s0.get(l).add(n)),((e,t)=>{let r=`${e}-${s1(t[0])}-${s1(t[1])}`;if(sZ.has(r))return sZ.get(r);let n=a7({themes:t,langs:[e],engine:sQ});return sZ.set(r,n),n})(sK.has(s)?s:"text",r).then(t=>{let r=t.getLoadedLanguages().includes(s)?s:"text",n=t.codeToTokens(e,{lang:r,themes:{light:o[0],dark:o[1]}});sY.set(l,n);let a=s0.get(l);if(a){for(let e of a)e(n);s0.delete(l)}}).catch(e=>{console.error("[Streamdown Code] Failed to highlight code:",e),s0.delete(l)}),null)}}}(),s5=e.i(90216);function s3({part:e,isUser:t}){return t?(0,v.jsx)(e_,{variant:"default",children:(0,v.jsx)(eS,{className:"whitespace-pre-wrap",children:e.text})}):(0,v.jsx)(e_,{variant:"ghost",children:(0,v.jsx)(eS,{children:(0,v.jsx)(s5.C,{plugins:{code:s2},isAnimating:"streaming"===e.state,lineNumbers:!1,children:e.text})})})}var s6=e.i(56103),s8=e.i(85831),s8=s8;let s4=(0,tt.default)("shield-x",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m14.5 9.5-5 5",key:"17q4r4"}],["path",{d:"m9.5 9.5 5 5",key:"18nt4w"}]]);var rh=rh;function s7({part:e}){let t="output-error"===e.state,r="output-denied"===e.state,n="input-streaming"===e.state||"input-available"===e.state,a=JSON.stringify(t?{error:e.errorText}:r?{deniedInput:e.input,reason:e.approval?.reason}:e.output??e.input,null,2);return(0,v.jsxs)(rd.Collapsible,{children:[(0,v.jsx)(eO,{asChild:!0,className:(0,eC.cn)("transition-colors hover:text-foreground",{"text-destructive hover:text-destructive/80":t,"text-warning hover:text-warning/80":r}),children:(0,v.jsxs)(rd.CollapsibleTrigger,{children:[(0,v.jsx)(eB,{children:n?(0,v.jsx)(tu.Spinner,{}):t?(0,v.jsx)(s8.default,{}):r?(0,v.jsx)(s4,{}):(0,v.jsx)(ru.Check,{})}),(0,v.jsxs)(eG,{className:n?"shimmer":void 0,children:[e.title??(0,k.getToolName)(e),t?" · failed":r?" · denied":null]}),(0,v.jsx)(eB,{children:(0,v.jsx)(rh.default,{className:"transition-transform group-data-open/marker:rotate-180"})})]})}),(0,v.jsx)(rd.CollapsibleContent,{children:(0,v.jsx)(e_,{variant:"ghost",className:"mt-2",children:(0,v.jsx)(eS,{children:(0,v.jsxs)(s6.CodeSnippet2,{children:[(0,v.jsxs)(s6.CodeSnippet2Header,{children:[(0,v.jsx)(s6.CodeSnippet2Filename,{children:(0,k.getToolName)(e)}),(0,v.jsx)(s6.CodeSnippet2Copy,{value:a})]}),(0,v.jsx)(s6.CodeSnippet2Body,{children:(0,v.jsx)(s6.CodeSnippet2Code,{children:a})})]})})})})]})}var s8=s8,s9=e.i(59332),s9=s9;function oe({part:e}){let t=e.input&&"object"==typeof e.input&&"objective"in e.input?String(e.input.objective):void 0;if("output-error"===e.state)return(0,v.jsxs)(eO,{children:[(0,v.jsx)(eB,{children:(0,v.jsx)(s8.default,{})}),(0,v.jsx)(eG,{children:"Web search failed"})]});let r="input-streaming"===e.state||"input-available"===e.state;return(0,v.jsxs)(eO,{children:[(0,v.jsx)(eB,{children:r?(0,v.jsx)(tu.Spinner,{}):(0,v.jsx)(s9.default,{})}),(0,v.jsxs)(eG,{className:r?"shimmer truncate":"truncate",title:t,children:[r?"Searching the web":"Searched the web",t?` for ${t}`:null]})]})}let ot="web_search",or={};function on({message:e,actions:t="hover",onRegenerate:r,onAnswer:n}){let a="user"===e.role,i=e.parts.filter(k.isFileUIPart),s=e.parts.flatMap(e=>"source-url"===e.type||"source-document"===e.type?["source-url"===e.type?{id:e.sourceId,title:e.title,url:e.url}:{id:e.sourceId,title:e.title,filename:e.filename}]:(0,k.isToolUIPart)(e)&&(0,k.getToolName)(e)===ot?function(e){if("output-available"!==e.state)return[];let t=e.output?.results;return Array.isArray(t)?t.map((t,r)=>({id:`${e.toolCallId}-${r}`,url:"string"==typeof t.url?t.url:void 0,title:"string"==typeof t.title?t.title:void 0})).filter(e=>e.url):[]}(e):[]);return(0,v.jsx)(eE,{align:a?"end":"start",children:(0,v.jsxs)(eI,{children:[i.length>0?(0,v.jsx)(tx.AttachmentGroup,{children:i.map((t,r)=>(0,v.jsx)(t_,{part:t}
138,`${e.id}-file-${r}`))}):null,e.parts.map((t,r)=>{let i=`${e.id}-part-${r}`;if((0,k.isReasoningUIPart)(t))return(0,v.jsx)(rf,{part:t},i);if((0,k.isToolUIPart)(t)){let e=(0,k.getToolName)(t);return e===ot?(0,v.jsx)(oe,{part:t},i):e===eP.QUESTIONNAIRE_TOOL?(0,v.jsx)(rc,{part:t,onAnswer:n},i):(0,v.jsx)(s7,{part:t},i)}return(0,k.isTextUIPart)(t)?(0,v.jsx)(s3,{part:t,isUser:a},i):(0,k.isDataUIPart)(t)?(0,v.jsx)(w.Fragment,{children:or[t.type]?.(t.data)},i):null}),s.length>0?(0,v.jsx)(rb,{sources:s}):null,"none"===t?null:(0,v.jsx)(oa,{message:e,pinned:"always"===t,onRegenerate:r})]})})}function oa({message:e,pinned:t=!1,onRegenerate:r}){let[n,a]=w.useState(!1);async function i(){let t=e.parts.filter(k.isTextUIPart).map(e=>e.text).join("\n\n");await navigator.clipboard.writeText(t),a(!0)}return w.useEffect(()=>{if(!n)return;let e=window.setTimeout(()=>a(!1),2e3);return()=>window.clearTimeout(e)},[n]),(0,v.jsxs)(eR,{className:(0,eC.cn)("gap-0.5",!t&&"opacity-0 transition-opacity group-focus-within/message:opacity-100 group-hover/message:opacity-100 pointer-coarse:opacity-100"),children:[(0,v.jsxs)(tC.Tooltip,{children:[(0,v.jsx)(tC.TooltipTrigger,{asChild:!0,children:(0,v.jsxs)(eN.Button,{variant:"ghost",size:"icon-sm",type:"button",onClick:i,children:[n?(0,v.jsx)(tv.CheckIcon,{}):(0,v.jsx)(tw.default,{}),(0,v.jsx)("span",{className:"sr-only",children:"Copy message"})]})}),(0,v.jsx)(tC.TooltipContent,{children:n?"Copied":"Copy"})]}),r?(0,v.jsxs)(tC.Tooltip,{children:[(0,v.jsx)(tC.TooltipTrigger,{asChild:!0,children:(0,v.jsxs)(eN.Button,{variant:"ghost",size:"icon-sm",type:"button",onClick:r,children:[(0,v.jsx)(tk,{}),(0,v.jsx)("span",{className:"sr-only",children:"Regenerate response"})]})}),(0,v.jsx)(tC.TooltipContent,{children:"Regenerate"})]}):null]})}function oi({messages:e,status:t,userName:r,onSuggestionSelect:n,onRegenerate:a,onAnswer:i}){let s="submitted"===t||"streaming"===t,o=e.findLast(e=>"assistant"===e.role)?.id;return(0,v.jsx)(tn,{autoScroll:!0,defaultScrollPosition:"last-anchor",children:(0,v.jsxs)(ta,{className:"-mb-8",children:[(0,v.jsx)(ti,{className:"scroll-fade-b-20 focus-visible:outline-none",children:(0,v.jsxs)(ts,{"aria-busy":s,className:"mx-auto w-full max-w-3xl px-4 pb-12",children:[0===e.length?(0,v.jsx)(to,{className:"flex flex-1 items-center",children:(0,v.jsx)(ty,{userName:r,onSelect:n})}):(0,v.jsx)(to,{children:(0,v.jsx)(eO,{variant:"separator",children:(0,v.jsx)(eG,{children:"Today"})})}),e.map((r,n)=>{let l=r.id===o,u="submitted"===t&&n===e.length-1;return(0,v.jsxs)(to,{messageId:r.id,scrollAnchor:"user"===r.role,children:[(0,v.jsx)(on,{message:r,actions:l&&"streaming"===t?"none":l?"always":"hover",onRegenerate:!s&&l?a:void 0,onAnswer:i}),u?(0,v.jsxs)(eO,{role:"status",className:"mt-6",children:[(0,v.jsx)(eB,{children:(0,v.jsx)(tu.Spinner,{})}),(0,v.jsx)(eG,{className:"shimmer",children:"Thinking..."})]}):null]},r.id)})]})}),(0,v.jsx)(tl,{className:"data-[direction=end]:bottom-12"})]})})}e.s(["Content",0,function({threadId:e,initialMessages:t,createThread:r}){let n=(0,eL.useChatStore)(),{preferences:a}=(0,eT.useChatPreferences)(),i=w.useMemo(()=>new k.DefaultChatTransport({api:"/api/chat"}),[]),s=w.useRef(new Set),{messages:o,sendMessage:l,addToolOutput:u,status:c,stop:d,error:p,regenerate:h,clearError:f}=function({throttle:e,experimental_throttle:t,resume:r=!1,...n}={}){let a,i=null!=e?e:t,s=(0,w.useRef)({});"chat"in n||(s.current={onToolCall:n.onToolCall,onData:n.onData,onFinish:n.onFinish,onError:n.onError,sendAutomaticallyWhen:n.sendAutomaticallyWhen,transport:n.transport});let o=()=>{var e;return null!=(e=s.current.transport)?e:null!=a?a:a=new k.DefaultChatTransport},l={...n,transport:{sendMessages:e=>o().sendMessages(e),reconnectToStream:e=>o().reconnectToStream(e)},onToolCall:e=>{var t,r;return null==(r=(t=s.current).onToolCall)?void 0:r.call(t,e)},onData:e=>{var t,r;return null==(r=(t=s.current).onData)?void 0:r.call(t,e)},onFinish:e=>{var t,r;return null==(r=(t=s.current).onFinish)?void 0:r.call(t,e)},onError:e=>{var t,r;return null==(r=(t=s.current).onError)?void 0:r.call(t,e)},sendAutomaticallyWhen:e=>{var t,r,n;return null!=(n=null==(r=(t=s.current).sendAutomaticallyWhen)?void 0:r.call(t,e))&&n}},u=(0,w.useRef)("chat"in n?n.chat:new ey(l));("chat"in n&&n.chat!==u.current||"id"in n&&null!=n.id&&u.current.id!==n.id
138)&&(u.current="chat"in n?n.chat:new ey(l));let c=u.current,d=(0,w.useRef)({chat:c,messages:c.messages});d.current.chat!==c&&(d.current={chat:c,messages:c.messages});let p=(0,w.useCallback)(e=>{let t=!0,r=c["~registerMessagesCallback"](()=>{t&&d.current.chat===c&&(d.current={chat:c,messages:c.messages},e())},i);return d.current={chat:c,messages:c.messages},()=>{t=!1,r()}},[c,i]),h=(0,w.useCallback)(()=>d.current.messages,[]),f=(0,w.useSyncExternalStore)(p,h,h),m=(0,w.useCallback)(e=>c["~registerStatusCallback"](()=>{d.current.chat===c&&(("ready"===c.status||"error"===c.status)&&(d.current={chat:c,messages:c.messages}),e())}),[c]),g=(0,w.useCallback)(()=>c.status,[c]),b=(0,w.useSyncExternalStore)(m,g,g),y=(0,w.useSyncExternalStore)(u.current["~registerErrorCallback"],()=>u.current.error,()=>u.current.error),v=(0,w.useCallback)(e=>{"function"==typeof e&&(e=e(u.current.messages)),u.current.messages=e},[u]);return(0,w.useEffect)(()=>{r&&u.current.resumeStream()},[r,u]),{id:u.current.id,messages:f,setMessages:v,sendMessage:u.current.sendMessage,regenerate:u.current.regenerate,clearError:u.current.clearError,stop:u.current.stop,error:y,resumeStream:u.current.resumeStream,status:b,addToolResult:u.current.addToolOutput,addToolOutput:u.current.addToolOutput,addToolApprovalResponse:u.current.addToolApprovalResponse}}({id:e,messages:t,transport:i,sendAutomaticallyWhen:({messages:e})=>{let t=(0,eP.pendingQuestionnaireReply)(e);return!(!t||s.current.has(t))&&(s.current.add(t),!0)}}),[m,g]=w.useState(r?null:e),b="submitted"===c||"streaming"===c,y=w.useMemo(()=>({...a.model,tools:a.tools,connectors:a.connectors}),[a]),x=w.useRef(new Map(t.map(e=>[e.id,JSON.stringify(e)])));w.useEffect(()=>{if(!m)return;let e="ready"===c||"error"===c,t=(e?o:o.filter(e=>"user"===e.role&&!x.current.has(e.id))).map(e=>({message:e,signature:JSON.stringify(e)})).filter(e=>x.current.get(e.message.id)!==e.signature),r=new Set(o.map(e=>e.id)),a=e?[...x.current.keys()].filter(e=>!r.has(e)):[];(0!==t.length||0!==a.length)&&(t.forEach(e=>x.current.set(e.message.id,e.signature)),a.forEach(e=>x.current.delete(e)),Promise.all([...t.map(e=>n.saveMessage(m,e.message)),...a.map(e=>n.deleteMessage(m,e))]).catch(()=>{t.forEach(e=>x.current.delete(e.message.id)),ew.toast.error("This chat could not be saved.")}))},[o,c,m,n]);let[C]=w.useState(()=>(0,eP.pendingQuestionnaireReply)(t)),[A]=w.useState(()=>null!==C||t.at(-1)?.role==="user"),_=w.useRef(!1);async function S(e,t=[]){if(!m&&r)try{g(await r(e))}catch{ew.toast.error("This chat could not be started.");return}l(t.length?{text:e,files:t}:{text:e},{body:y})}return w.useEffect(()=>{A&&!_.current&&"ready"===c&&(_.current=!0,C&&s.current.add(C),l(void 0,{body:y}))},[A,C,c,l,y]),(0,v.jsxs)("div",{className:"flex h-full w-full min-w-0 flex-col",children:[(0,v.jsx)(oi,{messages:o,status:c,userName:eM.CURRENT_USER.name,onSuggestionSelect:e=>void S(e),onAnswer:(e,t)=>u({tool:eP.QUESTIONNAIRE_TOOL,toolCallId:e,output:t,options:{body:y}}),onRegenerate:()=>void h({body:y})}),p?(0,v.jsx)("div",{role:"alert",className:"relative z-10 mx-auto w-full max-w-3xl px-4 pb-3",children:(0,v.jsx)(eE,{children:(0,v.jsxs)(eI,{children:[(0,v.jsx)(e_,{variant:"destructive",children:(0,v.jsx)(eS,{children:"Couldn't generate a response."})}),(0,v.jsx)(eR,{children:(0,v.jsxs)(eN.Button,{variant:"ghost",size:"sm",type:"button",onClick:()=>{f(),h({body:y})},children:[(0,v.jsx)(ev.RotateCcwIcon,{"data-icon":"inline-start"}),"Try again"]})})]})})}):null,(0,v.jsx)(ej.ChatComposer,{className:"mx-auto max-w-3xl shrink-0 px-4",draftKey:m??e,isBusy:b,onStop:d,onSubmit:({text:e,files:t})=>void S(e,t)}),(0,v.jsx)("p",{className:"shrink-0 px-4 py-2.5 text-center text-xs text-balance text-muted-foreground",children:"AI can make mistakes. Verify important information."})]})}],94267)}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.