@ubean/devtools 0.6.1-beta.3 → 0.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -25,7 +25,7 @@
25
25
 
26
26
  `)}new Set(oh);var Bh=mm,Vh={xs:`xs`,sm:`xs`,md:`sm`,lg:`md`,xl:`lg`,"2xl":`xl`};Object.fromEntries(Object.entries(Bh).map(([e,t])=>[e,t/Bh.md]));var Hh=`__VEAN_THEME`,Uh=`vean-theme`,Wh=65536;function Gh(){if(typeof window>`u`)return null;try{return window.localStorage??null}catch{return null}}var Kh=e=>typeof e==`object`&&!!e&&!Array.isArray(e),qh=e=>e===`light`||e===`dark`||e===`auto`,Jh=e=>e===`layered`||e===`flat`,Yh=e=>typeof e==`string`&&e.trim().length>0;function Xh(e){return Kh(e)?[`sans`,`heading`,`mono`,`serif`].every(t=>{let n=e[t];return n===void 0||Yh(n)}):!1}var Zh={surface:`card`,elevated:`popover`,"sidebar-surface":`sidebar`,scrim:`mask`};function Qh(e,t){if(ch(e))return e;if(t>=2)return;let n=Zh[e];return n&&ch(n)?n:void 0}function $h(e,t){if(!Kh(e))return;let n=Object.entries(e).flatMap(([e,n])=>{if(typeof n!=`string`||n.length===0)return[];let r=Qh(e,t);return r?[[r,n]]:[]});return n.length>0?Object.fromEntries(n):void 0}function eg(e,t){if(!Kh(e))return;let n=$h(e.light,t),r=$h(e.dark,t);return n||r?{...n?{light:n}:{},...r?{dark:r}:{}}:void 0}function tg(e,t){if(!Kh(e))return;if(t>=2)return e;let n=Object.entries(e).flatMap(([e,n])=>{if(!Kh(n))return[[e,n]];let r=$h(n.light,t);if(!r)return[];let i=$h(n.dark,t);return[[e,i?{light:r,dark:i}:{light:r}]]});return n.length>0?Object.fromEntries(n):void 0}function ng(e,t=2){if(!Kh(e))return{};let n={},r=(t,r)=>{e[t]!==void 0&&r(e[t])&&(n[t]=e[t])};r(`base`,e=>Mm(e)&&Om.includes(e)),r(`primary`,e=>Mm(e)&&Om.includes(e)),r(`feedback`,e=>typeof e==`string`&&e.length>0),r(`surfaceStyle`,Jh),r(`prefix`,e=>e===!1||typeof e==`string`&&e.length>0),r(`size`,e=>typeof e==`string`&&e.length>0),r(`radius`,e=>typeof e==`string`&&e.length>0),r(`spacing`,e=>Bm(e)||typeof e==`number`&&Number.isFinite(e)&&e>0&&e<=4),r(`font`,Xh),r(`borderOpacity`,e=>typeof e==`number`&&e>=0&&e<=1),r(`format`,e=>e===`hsl`||e===`oklch`),r(`styleTarget`,e=>e===`html`||e===`:root`),r(`darkSelector`,e=>typeof e==`string`&&e.length>0);let i=eg(e.overrides,t);return i&&(n.overrides=i),n}function rg(e){if(!e)return null;let t;try{t=JSON.parse(e)}catch{return null}if(!Kh(t))return null;let n=typeof t.v==`number`&&Number.isInteger(t.v)&&t.v>0?t.v:0;if(n>2)return null;let r={v:2,options:ng(t.options,n)};qh(t.mode)&&(r.mode=t.mode),n>=2&&typeof t.style==`string`&&t.style.length>0&&t.style.length<=Wh&&(r.style=t.style);let i=tg(t.presets,n);return i&&(r.presets=i),typeof t.appliedPreset==`string`&&t.appliedPreset.length>0&&(i===void 0||t.appliedPreset in i)&&(r.appliedPreset=t.appliedPreset),r}function ig(e=Hh){let t=null;try{t=Gh()?.getItem(e)??null}catch{return null}return rg(t)}function ag(e,t=Hh){let n=Gh();if(!n)return!1;let r={v:2,...e};r.style&&r.style.length>Wh&&delete r.style;try{return n.setItem(t,JSON.stringify(r)),!0}catch{return!1}}function og(e={}){let{key:t=Hh,delay:n=250}=e,r=null,i=null,a=()=>{i!==null&&(clearTimeout(i),i=null),r&&=(ag(r,t),null)};return{write:e=>{r=e,i===null&&(i=setTimeout(a,n))},flush:a,cancel:()=>{i!==null&&(clearTimeout(i),i=null),r=null}}}function sg(e,t){return zh(Ph(e),{prefix:e.prefix??Dm.prefix,styleTarget:e.styleTarget,darkSelector:e.darkSelector,format:e.format,...t})}function cg(){let e=nf();return U(()=>{let t=Qd(e?.locale??`en`),n=e?.messages;return n?Gu(n,t):t})}var lg=fl({base:[`inline-flex items-center justify-center font-medium transition-all-150`,`outline-none focus-visible:ring-3 focus-visible:ring-offset-card`,`data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50`],variants:{color:{primary:`focus-visible:ring-primary/30`,destructive:`focus-visible:ring-destructive/30`,success:`focus-visible:ring-success/30`,warning:`focus-visible:ring-warning/30`,info:`focus-visible:ring-info/30`,carbon:`focus-visible:ring-carbon/30`,secondary:`focus-visible:ring-secondary-foreground/20 text-secondary-foreground`,accent:`focus-visible:ring-accent-foreground/10 text-accent-foreground`},variant:{solid:``,pure:`border border-border bg-card text-accent-foreground data-[normal]:hover:bg-accent data-[normal]:active:bg-accent-foreground/10`,plain:`border border-border bg-card text-foreground`,outline:`border bg-card`,dashed:`border border-dashed bg-card`,soft:``,ghost:`bg-transparent`,link:`bg-transparent underline-offset-4 data-[normal]:hover:underline`},size:{xs:`gap-1 text-2xs`,sm:`gap-2 text-xs`,md:`gap-3 text-sm`,lg:`gap-4 text-base`,xl:`gap-5 text-lg`,"2xl":`gap-6 text-xl`},shape:{auto:`rounded-md`,rounded:`rounded-full`,square:`rounded-md`,circle:`rounded-full`},shadow:{none:`shadow-none`,sm:`shadow-sm`,md:`shadow-md`,lg:`shadow-lg`},fitContent:{true:`w-fit h-fit`,false:``}},compoundVariants:[{color:`primary`,variant:`solid`,class:`bg-primary text-primary-foreground data-[normal]:hover:bg-primary/80 data-[normal]:active:bg-primary-600`},{color:`destructive`,variant:`solid`,class:`bg-destructive text-destructive-foreground data-[normal]:hover:bg-destructive/80 data-[normal]:active:bg-destructive-600`},{color:`success`,variant:`solid`,class:`bg-success text-success-foreground data-[normal]:hover:bg-success/80 data-[normal]:active:bg-success-600`},{color:`warning`,variant:`solid`,class:`bg-warning text-warning-foreground data-[normal]:hover:bg-warning/80 data-[normal]:active:bg-warning-600`},{color:`info`,variant:`solid`,class:`bg-info text-info-foreground data-[normal]:hover:bg-info/80 data-[normal]:active:bg-info-600`},{color:`carbon`,variant:`solid`,class:`bg-carbon text-carbon-foreground data-[normal]:hover:bg-carbon/80 data-[normal]:active:bg-carbon`},{color:`secondary`,variant:[`solid`,`soft`],class:`bg-secondary`},{color:`accent`,variant:[`solid`,`soft`],class:`bg-accent`},{color:`primary`,variant:[`outline`,`dashed`,`soft`,`ghost`,`link`],class:`text-primary`},{color:`destructive`,variant:[`outline`,`dashed`,`soft`,`ghost`,`link`],class:`text-destructive`},{color:`success`,variant:[`outline`,`dashed`,`soft`,`ghost`,`link`],class:`text-success`},{color:`warning`,variant:[`outline`,`dashed`,`soft`,`ghost`,`link`],class:`text-warning`},{color:`info`,variant:[`outline`,`dashed`,`soft`,`ghost`,`link`],class:`text-info`},{color:`carbon`,variant:[`outline`,`dashed`,`soft`,`ghost`,`link`],class:`text-carbon`},{color:`primary`,variant:[`outline`,`dashed`,`ghost`],class:`data-[normal]:hover:bg-primary/10 data-[normal]:active:bg-primary/20`},{color:`destructive`,variant:[`outline`,`dashed`,`ghost`],class:`data-[normal]:hover:bg-destructive/10 data-[normal]:active:bg-destructive/20`},{color:`success`,variant:[`outline`,`dashed`,`ghost`],class:`data-[normal]:hover:bg-success/10 data-[normal]:active:bg-success/20`},{color:`warning`,variant:[`outline`,`dashed`,`ghost`],class:`data-[normal]:hover:bg-warning/10 data-[normal]:active:bg-warning/20`},{color:`info`,variant:[`outline`,`dashed`,`ghost`],class:`data-[normal]:hover:bg-info/10 data-[normal]:active:bg-info/20`},{color:`carbon`,variant:[`outline`,`dashed`,`ghost`],class:`data-[normal]:hover:bg-carbon/10 data-[normal]:active:bg-carbon/20`},{color:`secondary`,variant:[`solid`,`outline`,`dashed`,`soft`,`ghost`],class:`data-[normal]:hover:bg-secondary data-[normal]:active:bg-secondary-foreground/20`},{color:`accent`,variant:[`solid`,`outline`,`dashed`,`soft`,`ghost`],class:`data-[normal]:hover:bg-accent data-[normal]:active:bg-accent-foreground/10`},{color:`primary`,variant:`plain`,class:`data-[normal]:hover:border-primary data-[normal]:hover:text-primary`},{color:`destructive`,variant:`plain`,class:`data-[normal]:hover:border-destructive data-[normal]:hover:text-destructive`},{color:`success`,variant:`plain`,class:`data-[normal]:hover:border-success data-[normal]:hover:text-success`},{color:`warning`,variant:`plain`,class:`data-[normal]:hover:border-warning data-[normal]:hover:text-warning`},{color:`info`,variant:`plain`,class:`data-[normal]:hover:border-info data-[normal]:hover:text-info`},{color:`carbon`,variant:`plain`,class:`data-[normal]:hover:border-carbon data-[normal]:hover:text-carbon`},{color:`secondary`,variant:`plain`,class:`data-[normal]:hover:border-secondary-foreground/20`},{color:`accent`,variant:`plain`,class:`data-[normal]:hover:border-accent-foreground/10`},{color:`primary`,variant:[`outline`,`dashed`],class:`border-primary`},{color:`destructive`,variant:[`outline`,`dashed`],class:`border-destructive`},{color:`success`,variant:[`outline`,`dashed`],class:`border-success`},{color:`warning`,variant:[`outline`,`dashed`],class:`border-warning`},{color:`info`,variant:[`outline`,`dashed`],class:`border-info`},{color:`carbon`,variant:[`outline`,`dashed`],class:`border-carbon`},{color:`secondary`,variant:[`outline`,`dashed`],class:`border-secondary-foreground/20`},{color:`accent`,variant:[`outline`,`dashed`],class:`border-accent-foreground/10`},{color:`primary`,variant:`soft`,class:`bg-primary/10 data-[normal]:hover:bg-primary/10 data-[normal]:active:bg-primary/20`},{color:`destructive`,variant:`soft`,class:`bg-destructive/10 data-[normal]:hover:bg-destructive/10 data-[normal]:active:bg-destructive/20`},{color:`success`,variant:`soft`,class:`bg-success/10 data-[normal]:hover:bg-success/10 data-[normal]:active:bg-success/20`},{color:`warning`,variant:`soft`,class:`bg-warning/10 data-[normal]:hover:bg-warning/10 data-[normal]:active:bg-warning/20`},{color:`info`,variant:`soft`,class:`bg-info/10 data-[normal]:hover:bg-info/10 data-[normal]:active:bg-info/20`},{color:`carbon`,variant:`soft`,class:`bg-carbon/10 data-[normal]:hover:bg-carbon/10 data-[normal]:active:bg-carbon/20`},{size:`xs`,fitContent:!0,class:`p-0.75`},{size:`sm`,fitContent:!0,class:`p-0.875`},{size:`md`,fitContent:!0,class:`p-1`},{size:`lg`,fitContent:!0,class:`p-1.25`},{size:`xl`,fitContent:!0,class:`p-1.5`},{size:`2xl`,fitContent:!0,class:`p-1.75`},{size:`xs`,fitContent:!1,class:`h-6 px-1.5`},{size:`sm`,fitContent:!1,class:`h-7 px-2`},{size:`md`,fitContent:!1,class:`h-8 px-4`},{size:`lg`,fitContent:!1,class:`h-9 px-6`},{size:`xl`,fitContent:!1,class:`h-10 px-8`},{size:`2xl`,fitContent:!1,class:`h-12 px-10`},{shape:[`square`,`circle`],fitContent:!1,class:`p-0 gap-0`},{size:`xs`,fitContent:!1,shape:[`square`,`circle`],class:`w-6`},{size:`sm`,fitContent:!1,shape:[`square`,`circle`],class:`w-7`},{size:`md`,fitContent:!1,shape:[`square`,`circle`],class:`w-8`},{size:`lg`,fitContent:!1,shape:[`square`,`circle`],class:`w-9`},{size:`xl`,fitContent:!1,shape:[`square`,`circle`],class:`w-10`},{size:`2xl`,fitContent:!1,shape:[`square`,`circle`],class:`w-12`},{variant:[`ghost`,`link`],shadow:[`sm`,`md`,`lg`],class:`shadow-none`},{variant:`plain`,shadow:`sm`,class:`active:shadow-md`},{variant:`plain`,shadow:`md`,class:`active:shadow-lg`},{variant:`plain`,shadow:`lg`,class:`active:shadow-xl`},{variant:`pure`,shadow:`sm`,class:`active:shadow-sm`},{variant:`pure`,shadow:`md`,class:`active:shadow-md`},{variant:`pure`,shadow:`lg`,class:`active:shadow-lg`}],defaultVariants:{color:`primary`,variant:`solid`,size:`md`,shape:`auto`,shadow:`sm`,fitContent:!1}});fl({base:`[&>*]:relative focus-visible:[&>*]:z-2 not-first:not-last:[&>*]:rounded-0`,variants:{orientation:{horizontal:`inline-flex not-last:[&>*]:border-e-0 focus-visible:[&>*]:border-e first:[&>*]:rounded-e-0 last:[&>*]:rounded-s-0`,vertical:`flex flex-col not-last:[&>*]:border-b-0 focus-visible:[&>*]:border-b first:[&>*]:rounded-b-0 last:[&>*]:rounded-t-0`}},defaultVariants:{orientation:`horizontal`}});var ug=zl(lg,{size:`md`,color:`accent`,variant:`ghost`,shape:`square`,fitContent:!0}),dg=_l(lg,e=>({...e,size:Vh[e.size??`md`]})),fg=_l(ug,e=>({...e,size:Vh[e.size??`md`]})),pg=Nl({extendBase:e=>({close:fg({size:e.size}),cancel:dg({size:e.size,variant:`pure`}),action:dg({size:e.size})}),slots:{toaster:[`fixed z-[--z-index] list-none outline-none transition-transform-400 ease`,`data-[x-position=right]:end-[--offset-right] data-[x-position=left]:start-[--offset-left] data-[x-position=center]:start-1/2 data-[x-position=center]:-translate-x-1/2 [&[dir=rtl]]:data-[x-position=center]:translate-x-1/2`,`data-[y-position=top]:top-[--offset-top] data-[y-position=bottom]:bottom-[--offset-bottom]`,`max-[600px]:w-full max-[600px]:data-[x-position=right]:start-[--mobile-offset-left] max-[600px]:data-[x-position=left]:end-[--mobile-offset-right] max-[600px]:data-[x-position=center]:start-[--mobile-offset-left] max-[600px]:data-[x-position=center]:end-[--mobile-offset-right] max-[600px]:data-[x-position=center]:[transform:none]`,`max-[600px]:data-[y-position=top]:top-[--mobile-offset-top] max-[600px]:data-[y-position=bottom]:bottom-[--mobile-offset-bottom]`],toast:[`group absolute w-full rounded-md bg-popover text-popover-foreground border border-transparent opacity-0 outline-none touch-none`,`z-[--z-index] break-anywhere [--y:translateY(100%)] [--lift:1] [--lift-amount:calc(var(--lift)*var(--gap))] [transform:var(--y)]`,`[transition:transform_400ms,opacity_400ms,height_400ms,box-shadow_200ms] [box-shadow:0_4px_12px_hsl(var(--foreground)/0.1)]`,`focus-visible:[box-shadow:0_4px_12px_hsl(var(--foreground)/0.1),0_0_0_2px_hsl(var(--foreground)/0.2)] [&>*]:[transition:opacity_400ms]`,`data-[y-position=top]:top-0 data-[mounted=false]:data-[y-position=top]:[--y:translateY(-100%)] data-[mounted=true]:[--y:translateY(0)]`,`data-[y-position=bottom]:[--lift:-1] data-[y-position=bottom]:bottom-0`,`data-[x-position=left]:start-0 data-[x-position=right]:end-0`,`data-[swiping=true]:transition-none data-[swiping=true]:[transform:var(--y)_translateY(var(--swipe-amount-y,0px))_translateX(var(--swipe-amount-x,0px))]`,`data-[swiping=true]:before:content-empty data-[swiping=true]:before:absolute data-[swiping=true]:before:[inset-inline:-100%] data-[swiping=true]:before:h-full data-[swiping=true]:before:-z-1`,`data-[y-position=top]:data-[swiping=true]:before:bottom-1/2 data-[y-position=top]:data-[swiping=true]:before:[transform:scaleY(3)_translateY(50%)]`,`data-[y-position=bottom]:data-[swiping=true]:before:top-1/2 data-[y-position=bottom]:data-[swiping=true]:before:[transform:scaleY(3)_translateY(-50%)]`,`data-[swiping=false]:data-[removed=true]:before:content-empty data-[swiping=false]:data-[removed=true]:before:absolute data-[swiping=false]:data-[removed=true]:before:inset-0 data-[swiping=false]:data-[removed=true]:before:[transform:scaleY(2)]`,`data-[expanded=true]:after:content-empty data-[expanded=true]:after:absolute data-[expanded=true]:after:start-0 data-[expanded=true]:after:bottom-full data-[expanded=true]:after:w-full data-[expanded=true]:after:h-[calc(var(--gap)_+_1px)]`,`data-[mounted=true]:opacity-100 data-[visible=false]:pointer-events-none data-[visible=false]:data-[mounted=true]:opacity-0`,`data-[expanded=false]:data-[front=false]:[--scale:var(--toasts-before)*0.05_+_1] data-[expanded=false]:data-[front=false]:[--y:translateY(calc(var(--lift-amount)*var(--toasts-before)))_scale(calc(-1*var(--scale)))] data-[expanded=false]:data-[front=false]:h-[var(--front-toast-height)] [&[data-expanded=false][data-front=false]>*]:opacity-0`,`data-[mounted=true]:data-[expanded=true]:[--y:translateY(calc(var(--lift)*var(--offset)))] data-[mounted=true]:data-[expanded=true]:h-[var(--initial-height)]`,`data-[removed=true]:data-[front=true]:data-[swipe-out=false]:[--y:translateY(calc(var(--lift)*-100%))] data-[removed=true]:data-[front=true]:data-[swipe-out=false]:opacity-0`,`data-[removed=true]:data-[front=false]:data-[swipe-out=false]:data-[expanded=true]:[--y:translateY(calc(var(--lift)*var(--offset)_+_var(--lift)*-100%))] data-[removed=true]:data-[front=false]:data-[swipe-out=false]:data-[expanded=true]:opacity-0`,`data-[removed=true]:data-[front=false]:data-[swipe-out=false]:data-[expanded=false]:[--y:translateY(40%)] data-[removed=true]:data-[front=false]:data-[swipe-out=false]:data-[expanded=false]:opacity-0 data-[removed=true]:data-[front=false]:data-[swipe-out=false]:data-[expanded=false]:[transition:transform_500ms,opacity_200ms]`,`data-[removed=true]:data-[front=false]:before:h-[calc(var(--initial-height)_+_20%)]`,`data-[swiped=true]:select-none`,`data-[swipe-out=true]:data-[y-position=top]:[animation-duration:200ms] data-[swipe-out=true]:data-[y-position=bottom]:[animation-duration:200ms]`,`data-[swipe-out=true]:data-[y-position=top]:[animation-timing-function:ease-out] data-[swipe-out=true]:data-[y-position=bottom]:[animation-timing-function:ease-out]`,`data-[swipe-out=true]:data-[y-position=top]:[animation-fill-mode:forwards] data-[swipe-out=true]:data-[y-position=bottom]:[animation-fill-mode:forwards]`,`data-[swipe-out=true]:data-[swipe-direction=left]:[animation-name:toast-swipe-out-left] data-[swipe-out=true]:data-[swipe-direction=right]:[animation-name:toast-swipe-out-right] data-[swipe-out=true]:data-[swipe-direction=up]:[animation-name:toast-swipe-out-up] data-[swipe-out=true]:data-[swipe-direction=down]:[animation-name:toast-swipe-out-down]`,`data-[rich-color=true]:data-[type=success]:bg-success-100 data-[rich-color=true]:data-[type=success]:border-success`,`data-[rich-color=true]:data-[type=info]:bg-info-100 data-[rich-color=true]:data-[type=info]:border-info`,`data-[rich-color=true]:data-[type=warning]:bg-warning-100 data-[rich-color=true]:data-[type=warning]:border-warning`,`data-[rich-color=true]:data-[type=error]:bg-destructive-100 data-[rich-color=true]:data-[type=error]:border-destructive`,`data-[inverted=true]:bg-carbon data-[inverted=true]:border-carbon data-[inverted=true]:text-carbon-foreground`],wrapper:`flex flex-col items-stretch`,content:``,title:`flex items-center font-semibold`,description:`text-muted-foreground`,icon:[`group-data-[type=info]:text-info group-data-[type=success]:text-success group-data-[type=warning]:text-warning group-data-[type=error]:text-destructive`],footer:`flex justify-end items-center`,action:``,cancel:``,close:[`absolute`,`group-data-[inverted=true]:text-accent group-data-[inverted=true]:hover:bg-accent/15`,`group-data-[rich-color=true]:group-data-[type=success]:hover:bg-success/15`,`group-data-[rich-color=true]:group-data-[type=info]:hover:bg-info/15`,`group-data-[rich-color=true]:group-data-[type=warning]:hover:bg-warning/15`,`group-data-[rich-color=true]:group-data-[type=error]:hover:bg-destructive/15`]},variants:{size:{xs:{toaster:`w-80 text-2xs`,toast:`p-3`,wrapper:`gap-1`,title:`gap-1.25`,footer:`gap-1.25`,close:`top-1 end-1`},sm:{toaster:`w-85 text-xs`,toast:`p-3.5`,wrapper:`gap-1.25`,title:`gap-1.5`,footer:`gap-1.5`,close:`top-1.25 end-1.25`},md:{toaster:`w-90 text-sm`,toast:`p-4`,wrapper:`gap-1.5`,title:`gap-2`,footer:`gap-2`,close:`top-1.5 end-1.5`},lg:{toaster:`w-95 text-base`,toast:`p-4.5`,wrapper:`gap-1.75`,title:`gap-2.5`,footer:`gap-2.5`,close:`top-1.75 end-1.75`},xl:{toaster:`w-100 text-lg`,toast:`p-5`,wrapper:`gap-2`,title:`gap-3`,footer:`gap-3`,close:`top-2 end-2`},"2xl":{toaster:`w-110 text-xl`,toast:`p-6`,wrapper:`gap-2.5`,title:`gap-4`,footer:`gap-4`,close:`top-2.5 end-2.5`}}},defaultVariants:{size:`md`}}),[mg,hg]=Wl(`Toaster`),[gg,_g]=af(`ToastUi`),vg=1,yg=new class{subscribers;toasts;dismissed;constructor(){this.subscribers=[],this.toasts=[],this.dismissed=new Set}subscribe=e=>(this.subscribers.push(e),()=>{let t=this.subscribers.indexOf(e);t>=0&&this.subscribers.splice(t,1)});publish=e=>{this.subscribers.forEach(t=>t(e))};resetDismissed=e=>{this.dismissed.has(e)&&this.dismissed.delete(e)};upsert=e=>{let t=this.toasts.findIndex(t=>t.id===e.id);if(t<0){this.publish(e),this.toasts=[...this.toasts,e];return}let n={...this.toasts[t],...e};this.publish(n),this.toasts=this.toasts.map((e,r)=>r===t?n:e)};create=e=>{let{message:t,dismissible:n=!0,...r}=e,i=Cg(e.id);this.resetDismissed(i);let a={...r,id:i,dismissible:n,title:t};return this.upsert(a),i};dismiss=e=>{if(e!==void 0)return this.dismissed.add(e),requestAnimationFrame(()=>this.publish({id:e,dismiss:!0})),e;this.toasts.forEach(e=>{this.dismissed.add(e.id),this.publish({id:e.id,dismiss:!0})})};message=(e,t)=>this.create({...t,message:e,type:`default`});error=(e,t)=>this.create({...t,message:e,type:`error`});success=(e,t)=>this.create({...t,message:e,type:`success`});info=(e,t)=>this.create({...t,message:e,type:`info`});warning=(e,t)=>this.create({...t,message:e,type:`warning`});loading=(e,t)=>this.create({...t,message:e,type:`loading`});custom=(e,t)=>{let n=Cg(t?.id),r=t?.dismissible??!0;return this.resetDismissed(n),this.upsert({custom:e,dismissible:r,id:n,...t}),n};promise=(e,t)=>{if(!t)return;let n;t.loading!==void 0&&(n=this.create({...t,promise:e,type:`loading`,message:t.loading,description:typeof t.description==`function`?void 0:t.description}));let r=Promise.resolve(typeof e==`function`?e():e),i=n!==void 0,a,o=async(e,t,r,a)=>{i=!1;let{description:o,settings:s}=await wg(t,r,a,n);this.create({id:n,type:e,description:o,...s})},s=r.then(async e=>{if(a=[`resolve`,e],Va(e)){i=!1,this.create({id:n,type:`default`,message:e});return}if(Sg(e)&&!e.ok){await o(`error`,t.error,t.description,`HTTP error! status: ${e.status}`);return}if(e instanceof Error){await o(`error`,t.error,t.description,e);return}t.success!==void 0&&await o(`success`,t.success,t.description,e)}).catch(async e=>{a=[`reject`,e],t.error!==void 0&&await o(`error`,t.error,t.description,e)}).finally(()=>{i&&(this.dismiss(n),n=void 0),t.finally?.()}),c=()=>new Promise((e,t)=>s.then(()=>a[0]===`reject`?t(a[1]):e(a[1])).catch(t));return typeof n!=`string`&&typeof n!=`number`?{unwrap:c}:Object.assign(n,{unwrap:c})};getActives=()=>this.toasts.filter(e=>!this.dismissed.has(e.id))},bg=yg.message,xg=Object.assign(bg,{success:yg.success,info:yg.info,warning:yg.warning,error:yg.error,custom:yg.custom,message:yg.message,promise:yg.promise,dismiss:yg.dismiss,loading:yg.loading},{getHistory:()=>yg.toasts,getToasts:()=>yg.getActives()});function Sg(e){return typeof e==`object`&&!!e&&`ok`in e&&typeof e.ok==`boolean`&&`status`in e&&typeof e.status==`number`}function Cg(e){return typeof e==`number`||typeof e==`string`&&e.length>0?e:vg++}async function wg(e,t,n,r){let[i,a]=await Promise.all([Tg(e,n),Tg(t,n)]);return{description:a,settings:Dg(i,r)}}async function Tg(e,t){return typeof e==`function`?await e(t):e}function Eg(e){return typeof e==`object`&&!!e&&`message`in e}function Dg(e,t){return Eg(e)?e:{id:t??``,message:e??``}}var Og={gap:`--gap`,offsetTop:`--offset-top`,offsetRight:`--offset-right`,offsetBottom:`--offset-bottom`,offsetLeft:`--offset-left`,mobileOffsetTop:`--mobile-offset-top`,mobileOffsetRight:`--mobile-offset-right`,mobileOffsetBottom:`--mobile-offset-bottom`,mobileOffsetLeft:`--mobile-offset-left`,frontHeight:`--front-toast-height`},kg={index:`--index`,offset:`--offset`,beforeIndex:`--toasts-before`,zIndex:`--z-index`,swipeAmountX:`--swipe-amount-x`,swipeAmountY:`--swipe-amount-y`,swipeDirection:`--swipe-direction`,swipeOut:`--swipe-out`,initialHeight:`--initial-height`},Ag=`top-right`,jg=4e3,Mg={info:`lucide:info`,success:`lucide:circle-check`,warning:`lucide:circle-alert`,error:`lucide:circle-x`,close:`lucide:x`,loading:`svg-spinners:270-ring`},Ng=[`top-right`,`top-center`,`top-left`,`bottom-right`,`bottom-center`,`bottom-left`],Pg={left:`left`,right:`right`,top:`up`,bottom:`down`};function Fg(e){let[t,n]=e.split(`-`),r=[];return t&&r.push(Pg[t]),n&&r.push(Pg[n]),r}var Ig=e=>{let t={top:Og.offsetTop,right:Og.offsetRight,bottom:Og.offsetBottom,left:Og.offsetLeft},n={top:Og.mobileOffsetTop,right:Og.mobileOffsetRight,bottom:Og.mobileOffsetBottom,left:Og.mobileOffsetLeft},r={};return Wu(t).forEach(i=>{let a=(typeof e==`number`?e:e[i])??24;r[t[i]]=`${a}px`,r[n[i]]=`calc(${a}px * 0.67)`}),r},Lg=e=>{if(!e)return{x:0,y:0};let t=e.style.getPropertyValue(kg.swipeAmountX),n=e.style.getPropertyValue(kg.swipeAmountY);return{x:Number(t.replace(`px`,``))||0,y:Number(n.replace(`px`,``))||0}},Rg=(e,t)=>{e&&(e.style.setProperty(kg.swipeAmountX,`${t.x}px`),e.style.setProperty(kg.swipeAmountY,`${t.y}px`))},zg=e=>{e&&Rg(e,{x:0,y:0})},Bg=e=>`dismiss`in e&&e.dismiss===!0,Vg=e=>[`altKey`,`ctrlKey`,`metaKey`,`shiftKey`].includes(e),Hg=e=>{let{id:t,position:n}=e,r=on([]),i=on([]),a=U(()=>r.value.filter(e=>N(t)&&e.toasterId===N(t)||!e.toasterId)),o=U(()=>{let e=new Set;return a.value.forEach(t=>{let r=t.position||N(n);e.add(r)}),Ng.forEach(t=>{e.has(t)||e.add(t)}),Array.from(e)});return{toasts:r,filtered:a,heights:i,allPositions:o,positionZIndex:U(()=>{let e={};return o.value.forEach((t,n)=>{e[t]=9999-n}),e}),allToasts:U(()=>{let e=Ng.reduce((e,t)=>(e[t]=[],e),{});return a.value.forEach(t=>{let r=t.position||N(n);e[r].push(t)}),e}),allHeights:U(()=>{let e=Ng.reduce((e,t)=>(e[t]=[],e),{});return i.value.forEach(t=>{e[t.position].push(t)}),e})}},Ug=P({name:`DynamicRender`,inheritAttrs:!1,__name:`dynamic-render`,props:{is:{}},setup(e){let t=xi();return(n,r)=>typeof e.is==`string`?(I(),L(F,{key:0},[V(A(e.is),1)],64)):(I(),R(ci(e.is),ge(Za({key:1},M(t))),null,16))}}),Wg=[`dir`,`data-rich-color`,`data-inverted`,`data-mounted`,`data-promise`,`data-swiped`,`data-removed`,`data-visible`,`data-y-position`,`data-x-position`,`data-index`,`data-front`,`data-swiping`,`data-dismissible`,`data-type`,`data-swipe-out`,`data-swipe-direction`,`data-expanded`,`data-testid`],Gg=P({name:`Toast`,__name:`toast`,props:{index:{},toast:{},position:{}},emits:[`update:height`,`remove`],setup(e,{emit:t}){let n=e,r=t,{dir:i,allToasts:a,allHeights:o,gap:s,duration:c,visibleCounts:l,defaultExpanded:u,swipeDirections:d,interactingPosition:f,expandedPosition:p,showIcon:m,showClose:h,icons:g,toastProps:_,wrapperProps:v,contentProps:y,titleProps:b,descriptionProps:x,iconProps:S,footerProps:C,actionProps:w,cancelProps:ee,closeProps:T}=hg(`Toast`),E=_g(),D=Lr(`toast`),te=Lr(`wrapper`),ne=Mu(),{height:re}=zu(te),ie=Pu(),O=on(null),ae=on(null),oe=on(!1),se=on(!1),ce=on(!1),le=on(!1),ue=on(0),de=on(0),fe=on(n.toast.duration??c.value),pe=on(null),me=on(0),he=on(0),k=on(null),ge=U(()=>n.toast.type),_e=U(()=>{if(m.value){if(n.toast.icon)return n.toast.icon;if(ge.value&&ge.value!=="default")return g.value[ge.value];if(n.toast.promise)return g.value.loading}}),ve=U(()=>n.index===0),ye=U(()=>n.index+1<=l.value),be=U(()=>ge.value===`loading`),xe=U(()=>n.toast.dismissible!==!1),Se=U(()=>Math.max(o.value[n.position].findIndex(e=>e.toastId===n.toast.id),0)),Ce=U(()=>(n.toast.showClose??h.value)&&xe.value&&ge.value!==`loading`),we=U(()=>n.toast.duration??c.value),Te=U(()=>{let[e,t]=n.position.split(`-`);return{x:t,y:e}}),Ee=U(()=>o.value[n.position].reduce((e,t,n)=>n>=Se.value?e:e+t.height,0)),A=U(()=>Se.value*s.value+Ee.value),De=U(()=>p.value===n.position||u.value&&ne.value),Oe=U(()=>({[kg.index]:n.index,[kg.beforeIndex]:n.index,[kg.zIndex]:a.value[n.position].length-n.index,[kg.offset]:`${oe.value?ue.value:A.value}px`,[kg.initialHeight]:u.value?`auto`:`${de.value}px`})),ke=()=>{oe.value=!0,ue.value=A.value,window.setTimeout(()=>{r(`remove`,n.toast)},200)},Ae=()=>{!be.value&&xe.value&&(ke(),n.toast.onDismiss?.(n.toast))},je=e=>{e.button!==2&&!be.value&&xe.value&&(pe.value=new Date,ue.value=A.value,e.target.setPointerCapture(e.pointerId),e.target.tagName!==`BUTTON`&&(se.value=!0,k.value={x:e.clientX,y:e.clientY}))},Me=()=>{if(ce.value||!xe.value)return;k.value=null;let{x:e,y:t}=Lg(D.value),r=Date.now()-(pe.value?.getTime()??Date.now()),i=O.value===`x`?e:t,a=Math.abs(i)/Math.max(r,1);if(Math.abs(i)>=45||a>.11){ue.value=A.value,n.toast.onDismiss?.(n.toast),O.value===`x`?ae.value=e>0?`right`:`left`:ae.value=t>0?`down`:`up`,ke(),ce.value=!0;return}zg(D.value),le.value=!1,se.value=!1,O.value=null},Ne=e=>{if(!k.value||!xe.value||(typeof window<`u`?window.getSelection()?.toString().length??0:0)>0)return;let t=e.clientY-k.value.y,r=e.clientX-k.value.x,i=d.value??Fg(n.position);!O.value&&(Math.abs(r)>1||Math.abs(t)>1)&&(O.value=Math.abs(r)>Math.abs(t)?`x`:`y`);let a={x:0,y:0},o=e=>1/(1.5+Math.abs(e)/20);if(O.value===`y`){if(i.includes(`up`)||i.includes(`down`)){if(i.includes(`up`)&&t<0||i.includes(`down`)&&t>0)a.y=t;else{let e=t*o(t);a.y=Math.abs(e)<Math.abs(t)?e:t}}}else if(O.value===`x`&&(i.includes(`left`)||i.includes(`right`))){if(i.includes(`left`)&&r<0||i.includes(`right`)&&r>0)a.x=r;else{let e=r*o(r);a.x=Math.abs(e)<Math.abs(r)?e:r}}(Math.abs(a.x)>0||Math.abs(a.y)>0)&&(le.value=!0),Rg(D.value,a)},Pe=()=>{se.value=!1,O.value=null,k.value=null},Fe=e=>{n.toast.onAction?.(e),!e.defaultPrevented&&ke()},Ie=e=>{n.toast.onCancel?.(e),xe.value&&ke()};function Le(e){de.value=e,r(`update:height`,{toastId:n.toast.id,height:e,position:n.toast.position??n.position})}function Re(){let e=D.value;if(!e)return;let t=e.style.height;e.style.height=`auto`;let n=e.getBoundingClientRect().height;e.style.height=t,Le(n)}return nr(we,e=>{fe.value=e},{immediate:!0}),nr(re,e=>{ne.value&&e&&Re()},{flush:`post`}),nr(()=>n.toast.delete,e=>{e&&(ke(),n.toast.onDismiss?.(n.toast))}),er(()=>{let e=n.toast;if(e.type===`loading`||e.promise||e.duration===1/0)return;let t;p.value===n.position||f.value===n.position||ie.value===`hidden`?(()=>{if(he.value<me.value){let e=Date.now()-me.value;fe.value-=e}he.value=Date.now()})():fe.value!==1/0&&(me.value=Date.now(),t=setTimeout(()=>{n.toast.onAutoClose?.(n.toast),ke()},fe.value)),xn(()=>{t!==void 0&&clearTimeout(t)})}),(t,n)=>(I(),L(`li`,Za(M(_),{ref:`toast`,"data-vean-toast":``,class:[M(E).toast,e.toast.ui?.toast],dir:M(i),tabindex:`0`,"data-rich-color":e.toast.richColor,"data-inverted":e.toast.inverted,"data-mounted":M(ne),"data-promise":!!e.toast.promise,"data-swiped":le.value,"data-removed":oe.value,"data-visible":ye.value,"data-y-position":Te.value.y,"data-x-position":Te.value.x,"data-index":e.index,"data-front":ve.value,"data-swiping":se.value,"data-dismissible":xe.value,"data-type":ge.value,"data-swipe-out":ce.value,"data-swipe-direction":ae.value,"data-expanded":De.value,"data-testid":e.toast.testId,style:Oe.value,onDragend:Pe,onPointerdown:je,onPointerup:Me,onPointermove:Ne}),[z(`div`,Za({ref:`wrapper`},M(v),{class:[M(E).wrapper,e.toast.ui?.wrapper],"data-vean-toast-wrapper":``}),[e.toast.custom?(I(),R(ci(e.toast.custom),{key:0})):(I(),L(F,{key:1},[z(`h3`,Za(M(b),{class:[M(E).title,e.toast.ui?.title],"data-vean-toast-title":``}),[_e.value?(I(),R(ff,Za({key:0},M(S),{icon:_e.value,class:[M(E).icon,e.toast.ui?.icon]}),null,16,[`icon`,`class`])):H(`v-if`,!0),B(Ug,{is:e.toast.title},null,8,[`is`])],16),e.toast.description?(I(),L(`p`,Za({key:0},M(x),{class:[M(E).description,e.toast.ui?.description],"data-vean-toast-description":``}),[B(Ug,{is:e.toast.description},null,8,[`is`])],16)):H(`v-if`,!0),e.toast.content?(I(),R(ci(e.toast.content),Za({key:1},M(y),{class:[M(E).content,e.toast.ui?.content],"data-vean-toast-content":``}),null,16,[`class`])):H(`v-if`,!0),e.toast.action||e.toast.cancel?(I(),L(`div`,Za({key:2},M(C),{class:[M(E).footer,e.toast.ui?.footer],"data-vean-toast-footer":``}),[e.toast.cancel?(I(),R(sm,Za({key:0},M(ee),{class:[M(E).cancel,e.toast.ui?.cancel],"data-vean-toast-cancel":``,onClick:Ie}),{default:qn(()=>[B(Ug,{is:e.toast.cancel},null,8,[`is`])]),_:1},16,[`class`])):H(`v-if`,!0),e.toast.action?(I(),R(sm,Za({key:1},M(w),{class:[M(E).action,e.toast.ui?.action],"data-vean-toast-action":``,onClick:Fe}),{default:qn(()=>[B(Ug,{is:e.toast.action},null,8,[`is`])]),_:1},16,[`class`])):H(`v-if`,!0)],16)):H(`v-if`,!0)],64))],16),Ce.value&&M(g)?.close?(I(),R(sm,Za({key:0},M(T),{class:[M(E).close,e.toast.ui?.close],"data-vean-toast-close":``,onClick:Ae}),{default:qn(()=>[B(ff,{icon:M(g)?.close},null,8,[`icon`])]),_:1},16,[`class`])):H(`v-if`,!0)],16,Wg))}}),Kg=[`aria-label`],qg=[`dir`,`data-y-position`,`data-x-position`,`onBlur`,`onFocus`,`onMouseenter`,`onMousemove`,`onMouseleave`,`onDragend`,`onPointerdown`,`onPointerup`],Jg=P({name:`Toaster`,inheritAttrs:!1,__name:`toaster`,props:{id:{},dir:{},hotkey:{default:()=>[`altKey`,`KeyT`]},customAriaLabel:{},containerAriaLabel:{default:`Notifications`},position:{default:Ag},defaultExpanded:{type:Boolean},duration:{default:jg},gap:{default:12},offset:{default:24},visibleCounts:{default:3},swipeDirections:{},showIcon:{type:Boolean},showClose:{type:Boolean},icons:{},toastProps:{},wrapperProps:{},contentProps:{},titleProps:{},descriptionProps:{},iconProps:{},footerProps:{},actionProps:{},cancelProps:{},closeProps:{}},setup(e){let t=e,n=xi(),r=_g(),i=rf(()=>t.dir),a=U(()=>t.hotkey.join(`+`).replace(/Key/g,``).replace(/Digit/g,``)),o=U(()=>t.customAriaLabel??`${t.containerAriaLabel} ${a.value}`),s={},c=(e,t)=>{s[e]=mu(t)},{toasts:l,allToasts:u,filtered:d,heights:f,allHeights:p,allPositions:m,positionZIndex:h}=Hg({id:()=>t.id,position:()=>t.position}),g=U(()=>({...Mg,...t.icons})),_=on(null),v=on(null),y=on(null),b=on(null),x=U(()=>({[Og.gap]:`${t.gap}px`,...Ig(t.offset)})),S=e=>{_.value===e&&(_.value=null),v.value===e&&(v.value=null),b.value===e&&(b.value=null)},C=e=>{s[e]?.focus()},w=e=>{if(f.value.findIndex(t=>t.toastId===e.toastId)!==-1){f.value=f.value.map(t=>t.toastId===e.toastId?e:t);return}let t=f.value.findIndex(t=>t.position===e.position);if(t!==-1){f.value=[...f.value.slice(0,t),e,...f.value.slice(t)];return}f.value=[e,...f.value]},ee=e=>{let t=l.value.findIndex(t=>t.id===e.id);if(t!==-1){let n=Object.assign({},l.value[t],e);l.value=[...l.value.slice(0,t),n,...l.value.slice(t+1)];return}l.value=[e,...l.value]},T=e=>{l.value=l.value.filter(t=>t.id!==e.id||(t.delete||yg.dismiss(e.id),!1)),f.value=f.value.filter(t=>t.toastId!==e.id)},E=(e,t)=>{let n=t.currentTarget;b.value===e&&n&&!n.contains(t.relatedTarget)&&(b.value=null,_.value===e&&v.value!==e&&(_.value=null),y.value&&=(y.value.focus({preventScroll:!0}),null))},D=(e,t)=>{t.target.dataset.dismissible!==`false`&&b.value!==e&&(b.value=e,y.value=t.relatedTarget)},te=e=>{_.value=e},ne=e=>{v.value!==e&&b.value!==e&&_.value===e&&(_.value=null)},re=(e,t)=>{t.target.dataset.dismissible!==`false`&&(v.value=e,_.value=e)},ie=e=>{v.value===e&&(v.value=null)};return mg({dir:i,allToasts:u,allHeights:p,interactingPosition:v,expandedPosition:_,icons:g,...hu(t,[`gap`,`duration`,`visibleCounts`,`defaultExpanded`,`swipeDirections`,`showIcon`,`showClose`,`toastProps`,`wrapperProps`,`contentProps`,`titleProps`,`descriptionProps`,`iconProps`,`footerProps`,`actionProps`,`cancelProps`,`closeProps`])}),er(()=>{let e=yg.subscribe(e=>{if(Bg(e)){requestAnimationFrame(()=>{l.value=l.value.map(t=>t.id===e.id?{...t,delete:!0}:t)});return}Fn(()=>{ee(e)})});xn(()=>{e()})},{flush:`post`}),nr(()=>l.value.length,e=>{e===0&&(_.value=null,v.value=null,b.value=null)}),nr(()=>d.value,e=>{let n=new Set(e.map(e=>e.position??t.position));_.value&&!n.has(_.value)&&(_.value=null),v.value&&!n.has(v.value)&&(v.value=null),b.value&&!n.has(b.value)&&(b.value=null)},{deep:!0}),er(()=>{if(!Gl)return;let e=e=>{if(t.hotkey.length>0&&t.hotkey.every(t=>Vg(t)?e[t]:e.code===t)){let e=d.value[0]?.position??t.position??m.value[0];_.value=e,C(e)}let n=Object.values(s).some(e=>e===document.activeElement||e?.contains(document.activeElement));e.code===`Escape`&&n&&(_.value=null,b.value=null)};document.addEventListener(`keydown`,e),xn(()=>{document.removeEventListener(`keydown`,e)})}),ei(()=>{y.value&&(y.value.focus({preventScroll:!0}),y.value=null,b.value=null)}),(e,t)=>(I(),L(F,null,[z(`section`,{"data-vean-toaster-container":``,"aria-label":o.value,tabindex:`-1`,"aria-live":`polite`,"aria-relevant":`additions text`,"aria-atomic":`false`},[(I(!0),L(F,null,di(M(Ng),e=>(I(),L(`ol`,Za({key:e},{ref_for:!0},M(n),{ref_for:!0,ref:t=>c(e,t),class:M(r).toaster,tabindex:`-1`,dir:M(i),"data-vean-toaster":``,"data-y-position":e.split(`-`)[0],"data-x-position":e.split(`-`)[1],style:{"--z-index":M(h)[e],"--front-toast-height":`${M(p)[e][0]?.height??0}px`,...x.value},onBlur:t=>E(e,t),onFocus:t=>D(e,t),onMouseenter:t=>te(e),onMousemove:t=>te(e),onMouseleave:t=>ne(e),onDragend:t=>S(e),onPointerdown:t=>re(e,t),onPointerup:t=>ie(e)}),[(I(!0),L(F,null,di(M(u)[e],(t,n)=>(I(),R(Gg,{key:t.id,index:n,toast:t,position:e,"onUpdate:height":w,onRemove:T},null,8,[`index`,`toast`,`position`]))),128))],16,qg))),128))],8,Kg),pi(e.$slots,`default`)],64))}}),Yg=P({name:`ToastProvider`,__name:`toast-provider`,props:{id:{},dir:{},hotkey:{},customAriaLabel:{},containerAriaLabel:{},position:{},defaultExpanded:{type:Boolean},duration:{},gap:{},offset:{},visibleCounts:{},swipeDirections:{},showIcon:{type:Boolean},showClose:{type:Boolean},icons:{},toastProps:{},wrapperProps:{},contentProps:{},titleProps:{},descriptionProps:{},iconProps:{},footerProps:{},actionProps:{},cancelProps:{},closeProps:{}},setup(e){let t=e;return(e,n)=>(I(),R(Jg,Za({"data-vean-toast-provider":``},t),{default:qn(()=>[pi(e.$slots,`default`)]),_:3},16))}}),Xg=P({name:`SToastProvider`,__name:`toast-provider`,props:{size:{},ui:{},id:{},dir:{},hotkey:{},customAriaLabel:{},containerAriaLabel:{},position:{},defaultExpanded:{type:Boolean},duration:{},gap:{},offset:{},visibleCounts:{},swipeDirections:{},showIcon:{type:Boolean,default:!0},showClose:{type:Boolean,default:!0},icons:{},toastProps:{},wrapperProps:{},contentProps:{},titleProps:{},descriptionProps:{},iconProps:{},footerProps:{},actionProps:{},cancelProps:{},closeProps:{}},setup(e){let t=e,n=Kd(t,[`size`,`ui`]);return gg(U(()=>pg({size:t.size},t.ui))),(e,t)=>(I(),R(M(Yg),ge(Ka(M(n))),{default:qn(()=>[pi(e.$slots,`default`)]),_:3},16))}});function Zg(){return typeof window>`u`}var Qg=Dm.base,$g=Dm.primary,e_=Dm.radius,t_=Dm.size,n_=Dm.spacing,r_=`light`,[i_,a_]=Wl(`UiThemeContext`),o_=e=>e===`media`?null:e===`class`?`dark`:e.replace(/^\./,``),s_=e=>!!e&&`light`in e;function c_(e){let t=e.isServer??Zg(),n=null;e.persistTheme&&(e.themeConfig?n=e.themeConfig:t||(n=ig()));let r=Gt({...n?.options,base:n?.options?.base??Qg,primary:n?.options?.primary??$g,radius:n?.options?.radius??e_,size:n?.options?.size??t_,spacing:n?.options?.spacing??n_,mode:n?.mode??r_}),i=U({get:()=>r.base??Qg,set:e=>{r.base=e}}),a=U({get:()=>r.primary??$g,set:e=>{r.primary=e}}),o=U({get:()=>r.radius??e_,set:e=>{r.radius=e}}),s=U({get:()=>r.size??t_,set:e=>{r.size=e}}),c=U({get:()=>r.spacing??n_,set:e=>{r.spacing=e}}),l=U({get:()=>r.mode??r_,set:e=>{r.mode=e}}),u=j(!1),d;!t&&typeof window<`u`&&typeof window.matchMedia==`function`&&(d=window.matchMedia(`(prefers-color-scheme: dark)`),u.value=d.matches);let f=e=>{u.value=e.matches};d?.addEventListener(`change`,f),ti(()=>{d?.removeEventListener(`change`,f)});let p=U(()=>l.value===`auto`?u.value?`dark`:`light`:l.value);nr(p,t=>{if(typeof document>`u`)return;let n=e.theme?.darkSelector??`class`,r=o_(n);if(document.documentElement.style.colorScheme=Wm(t,n),!r)return;let i=document.createElement(`style`);i.appendChild(document.createTextNode(`*,*::before,*::after{-webkit-transition:none!important;-moz-transition:none!important;-o-transition:none!important;-ms-transition:none!important;transition:none!important}`)),document.head.appendChild(i),document.documentElement.classList.toggle(r,t===`dark`),window.getComputedStyle(i).opacity,document.head.removeChild(i)},{immediate:!0});let m=j(0),h=j(n?.presets??{}),g=j(n?.appliedPreset??null),_=()=>{if(!e.persistTheme||e.themeConfig)return;let t=ig();t&&(Object.assign(r,t.options,{mode:t.mode??r.mode}),h.value=t.presets??{},g.value=t.appliedPreset??null),m.value++},v=e=>{let t={light:{primary:`${a.value}.600`,ring:`${a.value}.500`},dark:{primary:`${a.value}.400`,ring:`${a.value}.300`}};return h.value={...h.value,[e]:t},S(e),!0},y=e=>{if(!(e in h.value))return!1;let t={...h.value};return delete t[e],h.value=t,g.value===e&&S(null),!0},b=e=>{S(e)},x=()=>{S(null)},S=e=>{g.value=e},C=()=>{let n=e.theme?.preset;if(s_(n))return n;let r=n?.name??g.value;if(!r||!e.persistTheme)return;let i=t?e.presetProvider?.(r)??void 0:h.value[r];return!i&&t&&console.warn(`[SConfigProvider] theme preset "${r}" not found, falling back to built-in colors.`),i};return{base:i,primary:a,radius:o,size:s,spacing:c,mode:l,effectiveMode:p,setRadius:e=>{o.value=e},setSize:e=>{s.value=e},setSpacing:e=>{c.value=e},setMode:e=>{l.value=e},customPresets:h,appliedPresetName:g,savePreset:v,removePreset:y,applyPreset:b,resetPreset:x,theme:U(()=>{m.value;let t=e.theme??{},n=C(),i=t.overrides??r.overrides??(n?{light:n.light,...n.dark?{dark:n.dark}:{}}:void 0);return{base:t.base??r.base??Qg,primary:t.primary??r.primary??$g,feedback:t.feedback??r.feedback,overrides:i,size:t.size??r.size??e.size??t_,radius:t.radius??r.radius??e_,spacing:t.spacing??r.spacing,font:t.font??r.font,format:t.format??r.format,surfaceStyle:t.surfaceStyle??r.surfaceStyle,borderOpacity:t.borderOpacity??r.borderOpacity,styleTarget:t.styleTarget??r.styleTarget,darkSelector:t.darkSelector??r.darkSelector}}),setThemeState:e=>{Object.assign(r,e)},refreshThemeConfig:_}}var l_=Symbol.for(`UIConfigProvider`),u_=/^[a-z0-9]+(-[a-z0-9]+)*$/,d_=(e,t,n,r=``)=>{let i=e.split(`:`);if(e.slice(0,1)===`@`){if(i.length<2||i.length>3)return null;r=i.shift().slice(1)}if(i.length>3||!i.length)return null;if(i.length>1){let e=i.pop(),n=i.pop(),a={provider:i.length>0?i[0]:r,prefix:n,name:e};return t&&!f_(a)?null:a}let a=i[0],o=a.split(`-`);if(o.length>1){let e={provider:r,prefix:o.shift(),name:o.join(`-`)};return t&&!f_(e)?null:e}if(n&&r===``){let e={provider:r,prefix:``,name:a};return t&&!f_(e,n)?null:e}return null},f_=(e,t)=>e?!!((t&&e.prefix===``||e.prefix)&&e.name):!1;function p_(e,t){let n=e.icons,r=e.aliases||Object.create(null),i=Object.create(null);function a(e){if(n[e])return i[e]=[];if(!(e in i)){i[e]=null;let t=r[e]&&r[e].parent,n=t&&a(t);n&&(i[e]=[t].concat(n))}return i[e]}return Object.keys(n).concat(Object.keys(r)).forEach(a),i}var m_=Object.freeze({left:0,top:0,width:16,height:16}),h_=Object.freeze({rotate:0,vFlip:!1,hFlip:!1}),g_=Object.freeze({...m_,...h_}),__=Object.freeze({...g_,body:``,hidden:!1});function v_(e,t){let n={};!e.hFlip!=!t.hFlip&&(n.hFlip=!0),!e.vFlip!=!t.vFlip&&(n.vFlip=!0);let r=((e.rotate||0)+(t.rotate||0))%4;return r&&(n.rotate=r),n}function y_(e,t){let n=v_(e,t);for(let r in __)r in h_?r in e&&!(r in n)&&(n[r]=h_[r]):r in t?n[r]=t[r]:r in e&&(n[r]=e[r]);return n}function b_(e,t,n){let r=e.icons,i=e.aliases||Object.create(null),a={};function o(e){a=y_(r[e]||i[e],a)}return o(t),n.forEach(o),y_(e,a)}function x_(e,t){let n=[];if(typeof e!=`object`||typeof e.icons!=`object`)return n;e.not_found instanceof Array&&e.not_found.forEach(e=>{t(e,null),n.push(e)});let r=p_(e);for(let i in r){let a=r[i];a&&(t(i,b_(e,i,a)),n.push(i))}return n}var S_={provider:``,aliases:{},not_found:{},...m_};function C_(e,t){for(let n in t)if(n in e&&typeof e[n]!=typeof t[n])return!1;return!0}function w_(e){if(typeof e!=`object`||!e)return null;let t=e;if(typeof t.prefix!=`string`||!e.icons||typeof e.icons!=`object`||!C_(e,S_))return null;let n=t.icons;for(let e in n){let t=n[e];if(!e||typeof t.body!=`string`||!C_(t,__))return null}let r=t.aliases||Object.create(null);for(let e in r){let t=r[e],i=t.parent;if(!e||typeof i!=`string`||!n[i]&&!r[i]||!C_(t,__))return null}return t}var T_=Object.create(null);function E_(e,t){return{provider:e,prefix:t,icons:Object.create(null),missing:new Set}}function D_(e,t){let n=T_[e]||(T_[e]=Object.create(null));return n[t]||(n[t]=E_(e,t))}function O_(e,t){return w_(t)?x_(t,(t,n)=>{n?e.icons[t]=n:e.missing.add(t)}):[]}function k_(e,t,n){try{if(typeof n.body==`string`)return e.icons[t]={...n},!0}catch{}return!1}var A_=!1;function j_(e){return typeof e==`boolean`&&(A_=e),A_}function M_(e){let t=typeof e==`string`?d_(e,!0,A_):e;if(t){let e=D_(t.provider,t.prefix),n=t.name;return e.icons[n]||(e.missing.has(n)?null:void 0)}}function N_(e,t){let n=d_(e,!0,A_);if(!n)return!1;let r=D_(n.provider,n.prefix);return t?k_(r,n.name,t):(r.missing.add(n.name),!0)}function P_(e,t){if(typeof e!=`object`)return!1;if(typeof t!=`string`&&(t=e.provider||``),A_&&!t&&!e.prefix){let t=!1;return w_(e)&&(e.prefix=``,x_(e,(e,n)=>{N_(e,n)&&(t=!0)})),t}let n=e.prefix;return f_({prefix:n,name:`a`})?!!O_(D_(t,n),e):!1}var F_=Object.freeze({width:null,height:null}),I_=Object.freeze({...F_,...h_}),L_=/(-?[0-9.]*[0-9]+[0-9.]*)/g,R_=/^-?[0-9.]*[0-9]+[0-9.]*$/g;function z_(e,t,n){if(t===1)return e;if(n||=100,typeof e==`number`)return Math.ceil(e*t*n)/n;if(typeof e!=`string`)return e;let r=e.split(L_);if(r===null||!r.length)return e;let i=[],a=r.shift(),o=R_.test(a);for(;;){if(o){let e=parseFloat(a);isNaN(e)?i.push(a):i.push(Math.ceil(e*t*n)/n)}else i.push(a);if(a=r.shift(),a===void 0)return i.join(``);o=!o}}function B_(e,t=`defs`){let n=``,r=e.indexOf(`<`+t);for(;r>=0;){let i=e.indexOf(`>`,r),a=e.indexOf(`</`+t);if(i===-1||a===-1)break;let o=e.indexOf(`>`,a);if(o===-1)break;n+=e.slice(i+1,a).trim(),e=e.slice(0,r).trim()+e.slice(o+1)}return{defs:n,content:e}}function V_(e,t){return e?`<defs>`+e+`</defs>`+t:t}function H_(e,t,n){let r=B_(e);return V_(r.defs,t+r.content+n)}var U_=e=>e===`unset`||e===`undefined`||e===`none`;function W_(e,t){let n={...g_,...e},r={...I_,...t},i={left:n.left,top:n.top,width:n.width,height:n.height},a=n.body;[n,r].forEach(e=>{let t=[],n=e.hFlip,r=e.vFlip,o=e.rotate;n?r?o+=2:(t.push(`translate(`+(i.width+i.left).toString()+` `+(0-i.top).toString()+`)`),t.push(`scale(-1 1)`),i.top=i.left=0):r&&(t.push(`translate(`+(0-i.left).toString()+` `+(i.height+i.top).toString()+`)`),t.push(`scale(1 -1)`),i.top=i.left=0);let s;switch(o<0&&(o-=Math.floor(o/4)*4),o%=4,o){case 1:s=i.height/2+i.top,t.unshift(`rotate(90 `+s.toString()+` `+s.toString()+`)`);break;case 2:t.unshift(`rotate(180 `+(i.width/2+i.left).toString()+` `+(i.height/2+i.top).toString()+`)`);break;case 3:s=i.width/2+i.left,t.unshift(`rotate(-90 `+s.toString()+` `+s.toString()+`)`)}o%2==1&&(i.left!==i.top&&(s=i.left,i.left=i.top,i.top=s),i.width!==i.height&&(s=i.width,i.width=i.height,i.height=s)),t.length&&(a=H_(a,`<g transform="`+t.join(` `)+`">`,`</g>`))});let o=r.width,s=r.height,c=i.width,l=i.height,u,d;o===null?(d=s===null?`1em`:s===`auto`?l:s,u=z_(d,c/l)):(u=o===`auto`?c:o,d=s===null?z_(u,l/c):s===`auto`?l:s);let f={},p=(e,t)=>{U_(t)||(f[e]=t.toString())};p(`width`,u),p(`height`,d);let m=[i.left,i.top,c,l];return f.viewBox=m.join(` `),{attributes:f,viewBox:m,body:a}}var G_=/\sid="(\S+)"/g,K_=new Map;function q_(e){e=e.replace(/[0-9]+$/,``)||`a`;let t=K_.get(e)||0;return K_.set(e,t+1),t?`${e}${t}`:e}function J_(e){let t=[],n;for(;n=G_.exec(e);)t.push(n[1]);if(!t.length)return e;let r=`suffix`+(Math.random()*16777216|Date.now()).toString(16);return t.forEach(t=>{let n=q_(t),i=t.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`);e=e.replace(RegExp(`([#;"])(`+i+`)([")]|\\.[a-z])`,`g`),`$1`+n+r+`$3`)}),e=e.replace(new RegExp(r,`g`),``),e}var Y_=Object.create(null);function X_(e,t){Y_[e]=t}function Z_(e){return Y_[e]||Y_[``]}function Q_(e){let t;if(typeof e.resources==`string`)t=[e.resources];else if(t=e.resources,!(t instanceof Array)||!t.length)return null;return{resources:t,path:e.path||`/`,maxURL:e.maxURL||500,rotate:e.rotate||750,timeout:e.timeout||5e3,random:e.random===!0,index:e.index||0,dataAfterTimeout:e.dataAfterTimeout!==!1}}for(var $_=Object.create(null),ev=[`https://api.simplesvg.com`,`https://api.unisvg.com`],tv=[];ev.length>0;)ev.length===1||Math.random()>.5?tv.push(ev.shift()):tv.push(ev.pop());$_[``]=Q_({resources:[`https://api.iconify.design`].concat(tv)});function nv(e,t){let n=Q_(t);return n!==null&&($_[e]=n,!0)}function rv(e){return $_[e]}var iv=(()=>{let e;try{if(e=fetch,typeof e==`function`)return e}catch{}})();function av(e,t){let n=rv(e);if(!n)return 0;let r;if(!n.maxURL)r=0;else{let e=0;n.resources.forEach(t=>{e=Math.max(e,t.length)});let i=t+`.json?icons=`;r=n.maxURL-e-n.path.length-i.length}return r}function ov(e){return e===404}var sv=(e,t,n)=>{let r=[],i=av(e,t),a=`icons`,o={type:a,provider:e,prefix:t,icons:[]},s=0;return n.forEach((n,c)=>{s+=n.length+1,s>=i&&c>0&&(r.push(o),o={type:a,provider:e,prefix:t,icons:[]},s=n.length),o.icons.push(n)}),r.push(o),r};function cv(e){if(typeof e==`string`){let t=rv(e);if(t)return t.path}return`/`}var lv={prepare:sv,send:(e,t,n)=>{if(!iv){n(`abort`,424);return}let r=cv(t.provider);switch(t.type){case`icons`:{let e=t.prefix,n=t.icons.join(`,`),i=new URLSearchParams({icons:n});r+=e+`.json?`+i.toString();break}case`custom`:{let e=t.uri;r+=e.slice(0,1)===`/`?e.slice(1):e;break}default:n(`abort`,400);return}let i=503;iv(e+r).then(e=>{let t=e.status;if(t!==200){setTimeout(()=>{n(ov(t)?`abort`:`next`,t)});return}return i=501,e.json()}).then(e=>{if(typeof e!=`object`||!e){setTimeout(()=>{e===404?n(`abort`,e):n(`next`,i)});return}setTimeout(()=>{n(`success`,e)})}).catch(()=>{n(`next`,i)})}};function uv(e,t){e.forEach(e=>{let n=e.loaderCallbacks;n&&(e.loaderCallbacks=n.filter(e=>e.id!==t))})}function dv(e){e.pendingCallbacksFlag||(e.pendingCallbacksFlag=!0,setTimeout(()=>{e.pendingCallbacksFlag=!1;let t=e.loaderCallbacks?e.loaderCallbacks.slice(0):[];if(!t.length)return;let n=!1,r=e.provider,i=e.prefix;t.forEach(t=>{let a=t.icons,o=a.pending.length;a.pending=a.pending.filter(t=>{if(t.prefix!==i)return!0;let o=t.name;if(e.icons[o])a.loaded.push({provider:r,prefix:i,name:o});else if(e.missing.has(o))a.missing.push({provider:r,prefix:i,name:o});else return n=!0,!0;return!1}),a.pending.length!==o&&(n||uv([e],t.id),t.callback(a.loaded.slice(0),a.missing.slice(0),a.pending.slice(0),t.abort))})}))}var fv=0;function pv(e,t,n){let r=fv++,i=uv.bind(null,n,r);if(!t.pending.length)return i;let a={id:r,icons:t,callback:e,abort:i};return n.forEach(e=>{(e.loaderCallbacks||=[]).push(a)}),i}function mv(e){let t={loaded:[],missing:[],pending:[]},n=Object.create(null);e.sort((e,t)=>e.provider===t.provider?e.prefix===t.prefix?e.name.localeCompare(t.name):e.prefix.localeCompare(t.prefix):e.provider.localeCompare(t.provider));let r={provider:``,prefix:``,name:``};return e.forEach(e=>{if(r.name===e.name&&r.prefix===e.prefix&&r.provider===e.provider)return;r=e;let i=e.provider,a=e.prefix,o=e.name,s=n[i]||(n[i]=Object.create(null)),c=s[a]||(s[a]=D_(i,a)),l;l=o in c.icons?t.loaded:a===``||c.missing.has(o)?t.missing:t.pending;let u={provider:i,prefix:a,name:o};l.push(u)}),t}function hv(e,t=!0,n=!1){let r=[];return e.forEach(e=>{let i=typeof e==`string`?d_(e,t,n):e;i&&r.push(i)}),r}var gv={resources:[],index:0,timeout:2e3,rotate:750,random:!1,dataAfterTimeout:!1};function _v(e,t,n,r){let i=e.resources.length,a=e.random?Math.floor(Math.random()*i):e.index,o;if(e.random){let t=e.resources.slice(0);for(o=[];t.length>1;){let e=Math.floor(Math.random()*t.length);o.push(t[e]),t=t.slice(0,e).concat(t.slice(e+1))}o=o.concat(t)}else o=e.resources.slice(a).concat(e.resources.slice(0,a));let s=Date.now(),c=`pending`,l=0,u,d=null,f=[],p=[];typeof r==`function`&&p.push(r);function m(){d&&=(clearTimeout(d),null)}function h(){c===`pending`&&(c=`aborted`),m(),f.forEach(e=>{e.status===`pending`&&(e.status=`aborted`)}),f=[]}function g(e,t){t&&(p=[]),typeof e==`function`&&p.push(e)}function _(){return{startTime:s,payload:t,status:c,queriesSent:l,queriesPending:f.length,subscribe:g,abort:h}}function v(){c=`failed`,p.forEach(e=>{e(void 0,u)})}function y(){f.forEach(e=>{e.status===`pending`&&(e.status=`aborted`)}),f=[]}function b(t,n,r){let i=n!==`success`;switch(f=f.filter(e=>e!==t),c){case`pending`:break;case`failed`:if(i||!e.dataAfterTimeout)return;break;default:return}if(n===`abort`){u=r,v();return}if(i){u=r,f.length||(o.length?x():v());return}if(m(),y(),!e.random){let n=e.resources.indexOf(t.resource);n!==-1&&n!==e.index&&(e.index=n)}c=`completed`,p.forEach(e=>{e(r)})}function x(){if(c!==`pending`)return;m();let r=o.shift();if(r===void 0){if(f.length){d=setTimeout(()=>{m(),c===`pending`&&(y(),v())},e.timeout);return}v();return}let i={status:`pending`,resource:r,callback:(e,t)=>{b(i,e,t)}};f.push(i),l++,d=setTimeout(x,e.rotate),n(r,t,i.callback)}return setTimeout(x),_}function vv(e){let t={...gv,...e},n=[];function r(){n=n.filter(e=>e().status===`pending`)}function i(e,i,a){let o=_v(t,e,i,(e,t)=>{r(),a&&a(e,t)});return n.push(o),o}function a(e){return n.find(t=>e(t))||null}return{query:i,find:a,setIndex:e=>{t.index=e},getIndex:()=>t.index,cleanup:r}}function yv(){}var bv=Object.create(null);function xv(e){if(!bv[e]){let t=rv(e);if(!t)return;bv[e]={config:t,redundancy:vv(t)}}return bv[e]}function Sv(e,t,n){let r,i;if(typeof e==`string`){let t=Z_(e);if(!t)return n(void 0,424),yv;i=t.send;let a=xv(e);a&&(r=a.redundancy)}else{let t=Q_(e);if(t){r=vv(t);let n=Z_(e.resources?e.resources[0]:``);n&&(i=n.send)}}return!r||!i?(n(void 0,424),yv):r.query(t,i,n)().abort}function Cv(){}function wv(e){e.iconsLoaderFlag||(e.iconsLoaderFlag=!0,setTimeout(()=>{e.iconsLoaderFlag=!1,dv(e)}))}function Tv(e){let t=[],n=[];return e.forEach(e=>{(e.match(u_)?t:n).push(e)}),{valid:t,invalid:n}}function Ev(e,t,n){function r(){let n=e.pendingIcons;t.forEach(t=>{n&&n.delete(t),e.icons[t]||e.missing.add(t)})}if(n&&typeof n==`object`)try{if(!O_(e,n).length){r();return}}catch(e){console.error(e)}r(),wv(e)}function Dv(e,t){e instanceof Promise?e.then(e=>{t(e)}).catch(()=>{t(null)}):t(e)}function Ov(e,t){e.iconsToLoad=e.iconsToLoad?e.iconsToLoad.concat(t).sort():t,e.iconsQueueFlag||(e.iconsQueueFlag=!0,setTimeout(()=>{e.iconsQueueFlag=!1;let{provider:t,prefix:n}=e,r=e.iconsToLoad;if(delete e.iconsToLoad,!r||!r.length)return;let i=e.loadIcon;if(e.loadIcons&&(r.length>1||!i)){Dv(e.loadIcons(r,n,t),t=>{Ev(e,r,t)});return}if(i){r.forEach(r=>{Dv(i(r,n,t),t=>{Ev(e,[r],t?{prefix:n,icons:{[r]:t}}:null)})});return}let{valid:a,invalid:o}=Tv(r);if(o.length&&Ev(e,o,null),!a.length)return;let s=n.match(u_)?Z_(t):null;if(!s){Ev(e,a,null);return}s.prepare(t,n,a).forEach(n=>{Sv(t,n,t=>{Ev(e,n.icons,t)})})}))}var kv=(e,t)=>{let n=mv(hv(e,!0,j_()));if(!n.pending.length){let e=!0;return t&&setTimeout(()=>{e&&t(n.loaded,n.missing,n.pending,Cv)}),()=>{e=!1}}let r=Object.create(null),i=[],a,o;return n.pending.forEach(e=>{let{provider:t,prefix:n}=e;if(n===o&&t===a)return;a=t,o=n,i.push(D_(t,n));let s=r[t]||(r[t]=Object.create(null));s[n]||(s[n]=[])}),n.pending.forEach(e=>{let{provider:t,prefix:n,name:i}=e,a=D_(t,n),o=a.pendingIcons||=new Set;o.has(i)||(o.add(i),r[t][n].push(i))}),i.forEach(e=>{let t=r[e.provider][e.prefix];t.length&&Ov(e,t)}),t?pv(t,n,i):Cv};function Av(e,t){let n={...e};for(let e in t){let r=t[e],i=typeof r;e in F_?(r===null||r&&(i===`string`||i===`number`))&&(n[e]=r):i===typeof n[e]&&(n[e]=e===`rotate`?r%4:r)}return n}var jv=/[\s,]+/;function Mv(e,t){t.split(jv).forEach(t=>{switch(t.trim()){case`horizontal`:e.hFlip=!0;break;case`vertical`:e.vFlip=!0}})}function Nv(e,t=0){let n=e.replace(/^-?[0-9.]*/,``);function r(e){for(;e<0;)e+=4;return e%4}if(n===``){let t=parseInt(e);return isNaN(t)?0:r(t)}if(n!==e){let t=0;switch(n){case`%`:t=25;break;case`deg`:t=90}if(t){let i=parseFloat(e.slice(0,e.length-n.length));return isNaN(i)?0:(i/=t,i%1==0?r(i):0)}}return t}function Pv(e,t){let n=e.indexOf(`xlink:`)===-1?``:` xmlns:xlink="http://www.w3.org/1999/xlink"`;for(let e in t)n+=` `+e+`="`+t[e]+`"`;return`<svg xmlns="http://www.w3.org/2000/svg"`+n+`>`+e+`</svg>`}function Fv(e){return e.replace(/"/g,`'`).replace(/%/g,`%25`).replace(/#/g,`%23`).replace(/</g,`%3C`).replace(/>/g,`%3E`).replace(/\s+/g,` `).replace(/:/g,`%3A`).replace(/\//g,`%2F`)}function Iv(e){return`data:image/svg+xml,`+Fv(e)}function Lv(e){return`url("`+Iv(e)+`")`}var Rv={...I_,inline:!1},zv={xmlns:`http://www.w3.org/2000/svg`,"xmlns:xlink":`http://www.w3.org/1999/xlink`,"aria-hidden":!0,role:`img`},Bv={display:`inline-block`},Vv={backgroundColor:`currentColor`},Hv={backgroundColor:`transparent`},Uv={Image:`var(--svg)`,Repeat:`no-repeat`,Size:`100% 100%`},Wv={webkitMask:Vv,mask:Vv,background:Hv};for(let e in Wv){let t=Wv[e];for(let n in Uv)t[e+n]=Uv[n]}var Gv={};[`horizontal`,`vertical`].forEach(e=>{let t=e.slice(0,1)+`Flip`;Gv[e+`-flip`]=t,Gv[e.slice(0,1)+`-flip`]=t,Gv[e+`Flip`]=t});function Kv(e){return e+(e.match(/^[-0-9.]+$/)?`px`:``)}var qv=(e,t)=>{let n=Av(Rv,t),r={...zv},i=t.mode||`svg`,a={},o=t.style,s=typeof o==`object`&&!(o instanceof Array)?o:{};for(let e in t){let i=t[e];if(i!==void 0)switch(e){case`icon`:case`style`:case`onLoad`:case`mode`:case`ssr`:case`customise`:break;case`inline`:case`hFlip`:case`vFlip`:n[e]=i===!0||i===`true`||i===1;break;case`flip`:break;case`color`:a.color=i;break;case`rotate`:typeof i==`string`?n[e]=Nv(i):typeof i==`number`&&(n[e]=i);break;case`ariaHidden`:case`aria-hidden`:i!==!0&&i!==`true`&&delete r[`aria-hidden`];break;default:{let t=Gv[e];t?(i===!0||i===`true`||i===1)&&(n[t]=!0):Rv[e]===void 0&&(r[e]=i)}}}typeof t.flip==`string`&&Mv(n,t.flip);let c=W_(e,n),l=c.attributes;if(n.inline&&(a.verticalAlign=`-0.125em`),i===`svg`)return r.style={...a,...s},Object.assign(r,l),r.innerHTML=J_(c.body),bo(`svg`,r);let{body:u,width:d,height:f}=e,p=i===`mask`||i!==`bg`&&u.indexOf(`currentColor`)!==-1,m=Pv(u,{...l,width:d+``,height:f+``});return r.style={...a,"--svg":Lv(m),width:Kv(l.width),height:Kv(l.height),...Bv,...p?Vv:Hv,...s},bo(`span`,r)};if(j_(!0),X_(``,lv),typeof document<`u`&&typeof window<`u`){let e=window;if(e.IconifyPreload!==void 0){let t=e.IconifyPreload,n=`Invalid IconifyPreload syntax.`;typeof t==`object`&&t&&(t instanceof Array?t:[t]).forEach(e=>{try{(typeof e!=`object`||!e||e instanceof Array||typeof e.icons!=`object`||typeof e.prefix!=`string`||!P_(e))&&console.error(n)}catch{console.error(n)}})}if(e.IconifyProviders!==void 0){let t=e.IconifyProviders;if(typeof t==`object`&&t)for(let e in t){let n=`IconifyProviders[`+e+`] is invalid.`;try{let r=t[e];if(typeof r!=`object`||!r||r.resources===void 0)continue;nv(e,r)||console.error(n)}catch{console.error(n)}}}}var Jv={...g_,body:``},Yv=P((e,{emit:t})=>{let n=j(null);function r(){n.value&&=(n.value.abort?.(),null)}let i=j(!!e.ssr),a=j(``),o=on(null);function s(){let i=e.icon;if(typeof i==`object`&&i&&typeof i.body==`string`)return a.value=``,{data:i};let o;if(typeof i!=`string`||(o=d_(i,!1,!0))===null)return null;let s=M_(o);if(!s){let e=n.value;return(!e||e.name!==i)&&(s===null?n.value={name:i}:n.value={name:i,abort:kv([o],c)}),null}r(),a.value!==i&&(a.value=i,Fn(()=>{t(`load`,i)}));let l=e.customise;if(l){s=Object.assign({},s);let e=l(s.body,o.name,o.prefix,o.provider);typeof e==`string`&&(s.body=e)}let u=[`iconify`];return o.prefix!==``&&u.push(`iconify--`+o.prefix),o.provider!==``&&u.push(`iconify--`+o.provider),{data:s,classes:u}}function c(){let e=s();e?e.data!==o.value?.data&&(o.value=e):o.value=null}return i.value?c():Zr(()=>{i.value=!0,c()}),nr(()=>e.icon,c),ti(r),()=>{let t=o.value;if(!t)return qv(Jv,e);let n=e;return t.classes&&(n={...e,class:t.classes.join(` `)}),qv({...g_,...t.data},n)}},{props:{icon:{type:[String,Object],required:!0},mode:{type:String},ssr:{type:Boolean},width:{type:[String,Number]},height:{type:[String,Number]},style:{type:[String,Object]},color:{type:String},inline:{type:Boolean},rotate:{type:[Number,String]},hFlip:{type:Boolean},horizontalFlip:{type:Boolean},vFlip:{type:Boolean},verticalFlip:{type:Boolean},flip:{type:String},id:{type:String},ariaHidden:{type:[Boolean,String],default:void 0},customise:{type:Function},title:{type:String}},emits:[`load`]}),W=P({name:`SIcon`,__name:`icon`,props:{icon:{},ariaHidden:{type:Boolean,default:!0},ariaLabel:{},ariaLabelledby:{},ssr:{type:Boolean},customise:{},id:{},style:{},title:{},mode:{},color:{},flip:{},horizontalFlip:{type:Boolean},verticalFlip:{type:Boolean},rotate:{},hFlip:{type:Boolean},vFlip:{type:Boolean},width:{},height:{},inline:{type:Boolean}},setup(e){let t=e,n=Zn(l_),r=U(()=>{let{width:e,height:r}=t,i=n?.iconify||{};return{width:e||i.width,height:r||i.height}}),i=U(()=>t.ariaLabel||t.ariaLabelledby?!1:t.ariaHidden),a=U(()=>({"aria-hidden":i.value,"aria-label":t.ariaLabel,"aria-labelledby":t.ariaLabelledby})),o=U(()=>s(t.icon)?{...a.value,"data-allow-mismatch":`class,attribute`,...r.value,mode:t.mode,color:t.color,flip:t.flip,horizontalFlip:t.horizontalFlip||void 0,verticalFlip:t.verticalFlip||void 0,rotate:t.rotate,hFlip:t.hFlip||void 0,vFlip:t.vFlip||void 0,inline:t.inline,id:t.id,style:t.style,title:t.title,ssr:t.ssr,customise:t.customise,icon:t.icon}:null);function s(e){return e?typeof e==`string`||typeof e==`object`&&`body`in e:!1}return(t,n)=>o.value?(I(),R(M(Yv),Za({key:0},o.value,{class:`shrink-0`,"data-vean-icon":``}),null,16)):e.icon?(I(),R(ci(e.icon),Za({key:1,class:`shrink-0`,"data-vean-icon":``},a.value,{style:{width:r.value.width,height:r.value.height}}),null,16,[`style`])):H(`v-if`,!0)}}),Xv=P({name:`ConfigProvider`,__name:`config-provider`,props:{dir:{},locale:{default:`en`},nonce:{default:void 0},tooltip:{},iconRender:{},linkComponent:{},messages:{}},setup(e){return tf(Jt(e)),(e,t)=>pi(e.$slots,`default`)}}),[Zv,Qv]=Wl(`DialogRoot`,e=>{let[t,n]=gu(),[r,i]=gu(),[a,o]=gu(),[s,c]=gu(),[l,u]=gu(),{open:d,fullscreen:f}=e,p=e=>{d.value=e},m=()=>{d.value=!d.value},h=e=>{f.value=e},g=()=>{f.value=!f.value},_=U(()=>lf(d.value)),v=on(``),y=`vean-dialog-popup-${Fr()}`,b=()=>{v.value||=y},x=on(``),S=`vean-dialog-title-${Fr()}`,C=()=>{x.value||=S},w=on(``),ee=`vean-dialog-description-${Fr()}`,T=()=>{w.value||=ee},E=async()=>{await Fn(),s.value?.focus({preventScroll:!0})};return{...e,onOpenChange:p,onOpenToggle:m,onFullscreenChange:h,onFullscreenToggle:g,dataState:_,overlayElement:t,setOverlayElement:n,triggerElement:r,setTriggerElement:i,popupElement:a,setPopupElement:o,cancelElement:s,setCancelElement:c,headerElement:l,setHeaderElement:u,popupId:v,initPopupId:b,titleId:x,initTitleId:C,descriptionId:w,initDescriptionId:T,focusCancel:E}}),[$v,ey]=Wl(`DialogProvider`,e=>{let{dialogs:t}=e;return{dialogs:t,getCurrentDialog:e=>t.value.find(t=>String(t.id)===String(e))}}),[ty,ny]=Wl(`DialogCompact`,e=>{let{dialog:t}=e;return{dialog:t}}),[ry,iy]=af(`DialogUi`),ay=(e=>{if(!e)return iy();let t=ny(),n=iy(e);return U(()=>{let r=t?.dialog?.value?.ui?.[e];return[n.value,r].filter(Boolean).join(` `)})}),oy=P({name:`DialogCancel`,__name:`dialog-cancel`,props:{type:{},disabled:{type:Boolean},asChild:{type:Boolean},as:{default:`button`}},emits:[`cancel`],setup(e,{emit:t}){let n=e,r=t,i=ay(`cancel`),{setCancelElement:a,onOpenChange:o}=Qv(`DialogCancel`),s=async e=>{r(`cancel`,e),o(!1)};return(e,t)=>(I(),R(sm,Za({ref:M(a)},n,{"data-vean-dialog-cancel":``,class:M(i),onClick:s}),{default:qn(()=>[pi(e.$slots,`default`)]),_:3},16,[`class`]))}}),sy=P({name:`DialogClose`,__name:`dialog-close`,props:{type:{},disabled:{type:Boolean},asChild:{type:Boolean},as:{default:`button`}},emits:[`close`],setup(e,{emit:t}){let n=e,r=t,i=xi(),a=ay(`close`),{onOpenChange:o}=Qv(`DialogClose`),s=cg(),c=U(()=>i[`aria-label`]??s.value.dialog.close),l=async e=>{r(`close`,e),o(!1)};return(e,t)=>(I(),R(sm,Za(n,{"data-vean-dialog-close":``,"aria-label":c.value,class:M(a),onClick:l}),{default:qn(()=>[pi(e.$slots,`default`,{},()=>[B(ff,{icon:`lucide:x`})])]),_:3},16,[`aria-label`,`class`]))}}),cy=P({name:`DialogConfirm`,__name:`dialog-confirm`,props:{type:{},disabled:{type:Boolean},asChild:{type:Boolean},as:{default:`button`}},emits:[`confirm`],setup(e,{emit:t}){let n=e,r=t,i=ay(`confirm`),{onOpenChange:a}=Qv(`DialogConfirm`),o=async e=>{r(`confirm`,e),a(!1)};return(e,t)=>(I(),R(sm,Za(n,{"data-vean-dialog-confirm":``,class:M(i),onClick:o}),{default:qn(()=>[pi(e.$slots,`default`)]),_:3},16,[`class`]))}}),ly=P({name:`DialogContent`,__name:`dialog-content`,setup(e){let t=ay(`content`);return(e,n)=>(I(),L(`div`,{"data-vean-dialog-content":``,class:k(M(t))},[pi(e.$slots,`default`)],2))}}),uy=[`id`],dy=P({name:`DialogDescription`,__name:`dialog-description`,setup(e){let{descriptionId:t,initDescriptionId:n}=Qv(`DialogDescription`),r=ay(`description`);return n(),(e,n)=>(I(),L(`p`,{id:M(t),"data-vean-dialog-description":``,class:k(M(r))},[pi(e.$slots,`default`)],10,uy))}}),fy=P({name:`DialogFooter`,__name:`dialog-footer`,setup(e){let t=ay(`footer`);return(e,n)=>(I(),L(`div`,{"data-vean-dialog-footer":``,class:k(M(t))},[pi(e.$slots,`default`)],2))}}),py=P({name:`DialogFullscreen`,__name:`dialog-fullscreen`,props:{type:{},disabled:{type:Boolean},asChild:{type:Boolean},as:{default:`button`}},emits:[`fullscreen`],setup(e,{emit:t}){let n=e,r=t,i=ay(`fullscreen`),{fullscreen:a,onFullscreenToggle:o}=Qv(`DialogFullscreen`),s=cg(),c=U(()=>a.value?s.value.dialog.exitFullscreen:s.value.dialog.fullscreen),l=e=>{r(`fullscreen`,e),o()};return(e,t)=>(I(),R(sm,Za(n,{"data-vean-dialog-fullscreen":``,"aria-label":c.value,"aria-pressed":M(a)?`true`:`false`,class:M(i),onClick:l}),{default:qn(()=>[pi(e.$slots,`default`,{},()=>[B(ff,{icon:M(a)?`lucide:minimize`:`lucide:maximize`},null,8,[`icon`])])]),_:3},16,[`aria-label`,`aria-pressed`,`class`]))}}),my=[`data-draggable`],hy=P({name:`DialogHeader`,__name:`dialog-header`,setup(e){let{setHeaderElement:t,draggable:n}=Qv(`DialogHeader`),r=ay(`header`);return(e,i)=>(I(),L(`div`,{ref:M(t),"data-vean-dialog-header":``,"data-draggable":M(n)?``:void 0,class:k(M(r))},[pi(e.$slots,`default`)],10,my))}}),gy=[`data-state`],_y=P({name:`DialogOverlay`,__name:`dialog-overlay`,props:{forceMount:{type:Boolean}},setup(e){let t=e,{overlayElement:n,setOverlayElement:r,open:i,dataState:a}=Qv(`DialogOverlay`),o=ay(`overlay`),s=t.forceMount?on(!0):Wd(n,i);return er(()=>{s.value&&i.value&&xn(nu())}),(e,t)=>M(s)?(I(),L(`div`,{key:0,ref:M(r),"data-vean-dialog-overlay":``,class:k(M(o)),"data-state":M(a),style:{"pointer-events":`auto`}},[pi(e.$slots,`default`)],10,gy)):H(`v-if`,!0)}}),vy=P({name:`DialogPopupImpl`,__name:`dialog-popup-impl`,props:{trapFocus:{type:Boolean},disableOutsidePointerEvents:{type:Boolean},asChild:{type:Boolean},as:{}},emits:[`escapeKeyDown`,`pointerDownOutside`,`focusOutside`,`interactOutside`,`openAutoFocus`,`closeAutoFocus`],setup(e,{emit:t}){let n=e,r=t,{dir:i,modal:a,isAlert:o,alertType:s,draggable:c,fullscreen:l,open:u,onOpenChange:d,setTriggerElement:f,popupElement:p,setPopupElement:m,headerElement:h,popupId:g,initPopupId:_,dataState:v,titleId:y,descriptionId:b,focusCancel:x}=Qv(`DialogPopupImpl`),{pointerEvents:S,onFocusCapture:C,onBlurCapture:w}=rd(p,{disableOutsidePointerEvents:()=>n.disableOutsidePointerEvents,enable:()=>!!u.value,onEscapeKeyDown:e=>{r(`escapeKeyDown`,e)},onPointerDownOutside:e=>{r(`pointerDownOutside`,e)},onFocusOutside:e=>{r(`focusOutside`,e)},onInteractOutside:e=>{r(`interactOutside`,e)},onDismiss:()=>{d(!1)}}),{onKeydown:ee}=Cd(p,{trapped:()=>n.trapFocus,loop:!0,onOpenAutoFocus:e=>{o.value&&x(),r(`openAutoFocus`,e)},onCloseAutoFocus:e=>{r(`closeAutoFocus`,e)}}),T=Kd(n,[`trapFocus`,`disableOutsidePointerEvents`]),E=ay(`popup`),D=on({x:0,y:0}),te=on({x:0,y:0}),ne=on({x:0,y:0}),{isDragging:re}=Lu(p,{handle:h,disabled:U(()=>!c.value||l.value===!0||!h.value),onStart:(e,t)=>{te.value={x:t.clientX,y:t.clientY},ne.value={...D.value}},onMove:(e,t)=>{D.value={x:ne.value.x+t.clientX-te.value.x,y:ne.value.y+t.clientY-te.value.y}}});nr(l,e=>{e&&(D.value={x:0,y:0})});let ie=U(()=>{let{x:e,y:t}=D.value;return{pointerEvents:S.value,translate:e!==0||t!==0?`${e}px ${t}px`:void 0}}),O=()=>{let e=vu();e!==document.body&&f(e)};return ud(),Vd(p,U(()=>a.value===!0)),_(),Zr(()=>{O()}),(e,t)=>(I(),R(M(cf),Za(M(T),{id:M(g),ref:M(m),class:M(E),dir:M(i),"aria-labelledby":M(y),"aria-describedby":M(b),"data-dismissable-layer":``,"data-state":M(v),"data-type":M(o)?M(s):void 0,"data-fullscreen":M(l)?``:void 0,"data-dragging":M(re)?``:void 0,role:M(o)?`alertdialog`:`dialog`,"aria-live":M(o)?M(s)===`error`?`assertive`:`polite`:void 0,tabindex:`-1`,style:ie.value,onFocusCapture:M(C),onBlurCapture:M(w),onKeydown:M(ee)}),{default:qn(()=>[pi(e.$slots,`default`)]),_:3},16,[`id`,`class`,`dir`,`aria-labelledby`,`aria-describedby`,`data-state`,`data-type`,`data-fullscreen`,`data-dragging`,`role`,`aria-live`,`style`,`onFocusCapture`,`onBlurCapture`,`onKeydown`]))}}),yy=P({name:`DialogPopup`,__name:`dialog-popup`,props:{asChild:{type:Boolean},as:{},forceMount:{type:Boolean}},emits:[`escapeKeyDown`,`pointerDownOutside`,`focusOutside`,`interactOutside`,`openAutoFocus`,`closeAutoFocus`],setup(e,{emit:t}){let n=e,r=t,i=Kd(n,[`forceMount`]),a=Td(r),{popupElement:o,open:s,modal:c,isAlert:l,triggerElement:u}=Qv(`DialogPopup`),d=n.forceMount?on(!0):Wd(o,s),f=U(()=>c.value!==!1&&s.value),p=U(()=>c.value===!0),{onFocusOutside:m,onInteractOutside:h,onCloseAutoFocus:g}=Hd({modal:c,triggerElement:u}),_=e=>{if(l.value){e.preventDefault();return}if(c.value===!1)return;let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;(t.button===2||n)&&e.preventDefault()},v=e=>{l.value&&e.preventDefault(),h(e)};return(e,t)=>M(d)?(I(),R(vy,Za({key:0},M(i),{"data-vean-dialog-popup":``,"trap-focus":f.value,"disable-outside-pointer-events":p.value},hi(M(a)),{onPointerDownOutside:_,onFocusOutside:M(m),onInteractOutside:v,onCloseAutoFocus:M(g)}),{default:qn(()=>[pi(e.$slots,`default`)]),_:3},16,[`trap-focus`,`disable-outside-pointer-events`,`onFocusOutside`,`onCloseAutoFocus`])):H(`v-if`,!0)}}),by=P({name:`DialogRoot`,inheritAttrs:!1,__name:`dialog-root`,props:{modal:{type:[Boolean,String],default:!0},dir:{},isAlert:{type:Boolean},alertType:{},draggable:{type:Boolean},fullscreen:{type:Boolean,default:void 0},defaultFullscreen:{type:Boolean},open:{type:Boolean,default:void 0},defaultOpen:{type:Boolean}},emits:[`update:open`,`update:fullscreen`],setup(e,{emit:t}){let n=e,r=t,i=Ju(()=>n.open,e=>{r(`update:open`,e)},n.defaultOpen??!1),a=Ju(()=>n.fullscreen,e=>{r(`update:fullscreen`,e)},n.defaultFullscreen??!1),{onOpenChange:o}=Zv({dir:rf(()=>n.dir),open:i,modal:U(()=>n.isAlert===!0||n.modal),fullscreen:a,...hu(n,[`isAlert`,`alertType`,`draggable`])}),s=()=>{o(!1)};return nr(i,e=>{e&&n.fullscreen===void 0&&(a.value=n.defaultFullscreen??!1)}),(e,t)=>pi(e.$slots,`default`,{open:M(i),close:s})}}),xy=[`id`],Sy=P({name:`DialogTitle`,__name:`dialog-title`,setup(e){let{titleId:t,initTitleId:n}=Qv(`DialogTitle`),r=ay(`title`);return n(),(e,n)=>(I(),L(`h2`,{id:M(t),"data-vean-dialog-title":``,class:k(M(r))},[pi(e.$slots,`default`)],10,xy))}}),Cy=P({name:`DialogTrigger`,__name:`dialog-trigger`,props:{type:{},disabled:{type:Boolean},asChild:{type:Boolean},as:{}},emits:[`click`],setup(e,{emit:t}){let n=e,r=t,{open:i,onOpenToggle:a,dataState:o,popupId:s,setTriggerElement:c}=Qv(`DialogTrigger`),l=e=>{r(`click`,e),a()};return(e,t)=>(I(),R(sm,Za(n,{ref:M(c),"data-vean-dialog-trigger":``,"aria-haspopup":`dialog`,"aria-expanded":M(i)||!1,"aria-controls":M(i)?M(s):void 0,"data-state":M(o),onClick:l}),{default:qn(()=>[pi(e.$slots,`default`)]),_:3},16,[`aria-expanded`,`aria-controls`,`data-state`]))}}),wy=P({name:`DialogCompact`,__name:`dialog-compact`,props:{title:{},description:{},icon:{},showClose:{type:Boolean,default:!0},showFullscreen:{type:Boolean,default:!0},pure:{type:Boolean},showCancel:{type:[String,Boolean],default:`onlyWarning`},cancelText:{},showConfirm:{type:Boolean,default:!0},confirmText:{},triggerProps:{},overlayProps:{},portalProps:{},popupProps:{},headerProps:{},contentProps:{},footerProps:{},titleProps:{},descriptionProps:{},closeProps:{},fullscreenProps:{},cancelProps:{},confirmProps:{},modal:{type:[Boolean,String],default:!0},dir:{},isAlert:{type:Boolean},alertType:{default:`default`},draggable:{type:Boolean},fullscreen:{type:Boolean,default:void 0},defaultFullscreen:{type:Boolean},open:{type:Boolean,default:void 0},defaultOpen:{type:Boolean}},emits:[`update:open`,`update:fullscreen`,`click`,`escapeKeyDown`,`pointerDownOutside`,`focusOutside`,`interactOutside`,`openAutoFocus`,`closeAutoFocus`,`close`,`fullscreen`,`confirm`,`cancel`],setup(e,{emit:t}){let n=e,r=Kd(n,[`title`,`description`,`icon`,`showClose`,`showFullscreen`,`pure`,`showCancel`,`cancelText`,`showConfirm`,`confirmText`,`triggerProps`,`overlayProps`,`portalProps`,`popupProps`,`headerProps`,`contentProps`,`footerProps`,`titleProps`,`descriptionProps`,`closeProps`,`fullscreenProps`,`cancelProps`,`confirmProps`]),i=t,a=bi(),o=xi(),s=Td(i),c=cg(),l=ey(),u=U(()=>l?.getCurrentDialog(o[`data-dialog-id`])),d=U(()=>[ay().value?.icon,u.value?.ui?.icon].filter(Boolean).join(` `)),f=U(()=>({...n.triggerProps,asChild:n.triggerProps?.asChild??!0})),p={default:null,info:`lucide:info`,warning:`lucide:circle-alert`,error:`lucide:circle-x`,success:`lucide:circle-check`},m=U(()=>n.icon?n.icon:n.isAlert&&n.alertType?p[n.alertType]:null),h=U(()=>n.showConfirm??n.isAlert),g=U(()=>typeof n.showCancel==`boolean`?n.showCancel:n.isAlert===!0&&n.alertType===`warning`),_=U(()=>n.pure?!1:a.footer?!0:g.value||h.value),v=U(()=>n.cancelText??c.value.dialog.cancel),y=U(()=>n.confirmText??c.value.dialog.confirm);return ty({dialog:u}),(t,n)=>(I(),R(by,Za(M(r),{"onUpdate:open":n[5]||=e=>i(`update:open`,e),"onUpdate:fullscreen":n[6]||=e=>i(`update:fullscreen`,e)}),{default:qn(r=>[B(Cy,ge(Ka(f.value)),{default:qn(()=>[pi(t.$slots,`trigger`,ge(Ka(r)))]),_:2},1040),B(df,ge(Ka(e.portalProps)),{default:qn(()=>[B(_y,ge(Ka(e.overlayProps)),null,16),B(yy,Za(e.popupProps,hi(M(s))),{default:qn(()=>[e.pure?H(`v-if`,!0):(I(),R(hy,ge(Za({key:0},e.headerProps)),{default:qn(()=>[B(Sy,ge(Ka(e.titleProps)),{default:qn(()=>[m.value?(I(),R(ff,{key:0,icon:m.value,class:k(d.value)},null,8,[`icon`,`class`])):H(`v-if`,!0),pi(t.$slots,`title`,ge(Ka(r)),()=>[z(`span`,null,A(e.title),1)])]),_:2},1040),a.description||e.description?(I(),R(dy,ge(Za({key:0},e.descriptionProps)),{default:qn(()=>[pi(t.$slots,`description`,ge(Ka(r)),()=>[V(A(e.description),1)])]),_:2},1040)):H(`v-if`,!0),!e.isAlert&&e.showFullscreen?(I(),R(py,Za({key:1},e.fullscreenProps,{onFullscreen:n[0]||=e=>i(`fullscreen`,e)}),{default:qn(()=>[pi(t.$slots,`fullscreen`,ge(Ka(r)))]),_:2},1040)):H(`v-if`,!0),!e.isAlert&&e.showClose?(I(),R(sy,{key:2,onClose:n[1]||=e=>i(`close`,e)},{default:qn(()=>[pi(t.$slots,`close`,ge(Ka(r)))]),_:2},1024)):H(`v-if`,!0)]),_:2},1040)),B(ly,ge(Ka(e.contentProps)),{default:qn(()=>[pi(t.$slots,`default`,ge(Ka(r)))]),_:2},1040),e.pure&&!e.isAlert&&e.showClose?(I(),R(sy,{key:1,onClose:n[2]||=e=>i(`close`,e)},{default:qn(()=>[pi(t.$slots,`close`,ge(Ka(r)))]),_:2},1024)):H(`v-if`,!0),_.value?(I(),R(fy,ge(Za({key:2},e.footerProps)),{default:qn(()=>[pi(t.$slots,`footer`,ge(Ka(r)),()=>[g.value?(I(),R(oy,Za({key:0},e.cancelProps,{onCancel:n[3]||=e=>i(`cancel`,e)}),{default:qn(()=>[pi(t.$slots,`cancel`,ge(Ka(r)),()=>[V(A(v.value),1)])]),_:2},1040)):H(`v-if`,!0),h.value?(I(),R(cy,Za({key:1},e.confirmProps,{onConfirm:n[4]||=e=>i(`confirm`,e)}),{default:qn(()=>[pi(t.$slots,`confirm`,ge(Ka(r)),()=>[V(A(y.value),1)])]),_:2},1040)):H(`v-if`,!0)])]),_:2},1040)):H(`v-if`,!0)]),_:2},1040)]),_:2},1040)]),_:3},16))}}),Ty=1,Ey=new class{subscribers;dialogs;dismissed;constructor(){this.subscribers=[],this.dialogs=[],this.dismissed=new Set}subscribe=e=>(this.subscribers.push(e),()=>{let t=this.subscribers.indexOf(e);t>=0&&this.subscribers.splice(t,1)});publish=e=>{this.subscribers.forEach(t=>t(e))};resetDismissed=e=>{this.dismissed.has(e)&&this.dismissed.delete(e)};upsert=e=>{let t=this.dialogs.findIndex(t=>t.id===e.id);if(t<0){this.publish(e),this.dialogs=[...this.dialogs,e];return}let n={...this.dialogs[t],...e};this.publish(n),this.dialogs=this.dialogs.map((e,r)=>r===t?n:e)};create=e=>{let{open:t=!0,...n}=e,r=Oy(e.id),i={...n,id:r,open:t};return this.upsert(i),r};dismiss=e=>{if(e!==void 0)return this.dismissed.add(e),requestAnimationFrame(()=>this.publish({id:e,open:!1})),e;this.dialogs.forEach(e=>{this.dismissed.add(e.id),this.publish({id:e.id,open:!1})})};message=(e,t)=>this.create({...t,title:e,type:`default`});error=(e,t)=>this.create({...t,title:e,type:`error`});success=(e,t)=>this.create({...t,title:e,type:`success`});info=(e,t)=>this.create({...t,title:e,type:`info`});warning=(e,t)=>this.create({...t,title:e,type:`warning`});getDialogs=()=>this.dialogs.filter(e=>!this.dismissed.has(e.id));activeDialogs=()=>(this.dialogs=this.getDialogs(),this.dismissed.clear(),this.dialogs)},Dy=Ey.message;Object.assign(Dy,{success:Ey.success,error:Ey.error,info:Ey.info,warning:Ey.warning,getHistory:()=>Ey.dialogs,getDialogs:()=>Ey.getDialogs()});function Oy(e){return typeof e==`number`||typeof e==`string`&&e.length>0?e:Ty++}var ky=P({name:`DialogProvider`,inheritAttrs:!1,__name:`dialog-provider`,setup(e){let t=on([]),n=e=>{let n=t.value.findIndex(t=>t.id===e.id);if(n!==-1){let r=Object.assign({},t.value[n],e);t.value=[...t.value.slice(0,n),r,...t.value.slice(n+1)];return}t.value=[e,...t.value]},r=e=>{e.onDismiss?.(e),Ey.dismiss(e.id)},i=(e,t)=>{e.onCancel?.(t),!t.defaultPrevented&&r(e)},a=(e,t)=>{e.onConfirm?.(t),!t.defaultPrevented&&r(e)};return $v({dialogs:t}),er(()=>{let e=Ey.subscribe(e=>{Fn(()=>{n(e)}),e.open===!1&&setTimeout(()=>{t.value=Ey.activeDialogs()},500)});xn(()=>{e()})},{flush:`post`}),(e,n)=>(I(),L(F,null,[(I(!0),L(F,null,di(t.value,e=>(I(),R(wy,{key:e.id,open:e.open,"is-alert":``,"alert-type":e.type,"data-dialog-id":e.id,icon:e.icon,onClose:t=>r(e),onCancel:t=>i(e,t),onConfirm:t=>a(e,t)},fi({default:qn(()=>[e.content?(I(),R(ci(e.content),{key:0})):H(`v-if`,!0)]),_:2},[e.title?{name:`title`,fn:qn(()=>[B(Ug,{is:e.title},null,8,[`is`])]),key:`0`}:void 0,e.description?{name:`description`,fn:qn(()=>[B(Ug,{is:e.description},null,8,[`is`])]),key:`1`}:void 0,e.footer?{name:`footer`,fn:qn(()=>[B(Ug,{is:e.footer},null,8,[`is`])]),key:`2`}:void 0,e.cancelText?{name:`cancel`,fn:qn(()=>[B(Ug,{is:e.cancelText},null,8,[`is`])]),key:`3`}:void 0,e.confirmText?{name:`confirm`,fn:qn(()=>[B(Ug,{is:e.confirmText},null,8,[`is`])]),key:`4`}:void 0]),1032,[`open`,`alert-type`,`data-dialog-id`,`icon`,`onClose`,`onCancel`,`onConfirm`]))),128)),pi(e.$slots,`default`)],64))}}),[Ay,jy]=Wl(`ProgressRoot`),[My,Ny]=af(`ProgressUi`),[Py,Fy]=af(`ProgressProviderUi`),Iy={direction:`ltr`,minimum:.08,maximum:1,easing:`linear`,speed:200,trickle:!0,trickleSpeed:200},Ly=class{static options=Iy;static status=null;static pending=[];static isPaused=!1;static trickleTimer;static reset(){return this.status=null,this.isPaused=!1,this.pending=[],this.options=Iy,this.clearTrickleTimer(),this}static configure(e){return this.options=Gu({...e},this.options),this}static isStarted(){return typeof this.status==`number`}static isRendered(){return Gl?document.querySelector(`[data-vean-progress-provider]`)!==null:!1}static set(e){if(!Gl||this.isPaused)return this;let t=this.isStarted();e=uf(e,this.options.minimum,this.options.maximum),this.status=e===this.options.maximum?null:e,this.status===null&&this.clearTrickleTimer();let n=this.render(!t),r=this.options.speed,i=this.options.easing;return n.forEach(e=>e.offsetWidth),this.queue(t=>{n.forEach(t=>{zy(t.querySelector(`[data-vean-progress-bar]`),this.barPositionCSS({n:e,speed:r,ease:i}))}),e===this.options.maximum?(n.forEach(e=>{zy(e,{transition:`none`,opacity:`1`}),e.offsetWidth}),setTimeout(()=>{n.forEach(e=>{zy(e,{transition:`all ${r}ms ${i}`,opacity:`0`})}),setTimeout(()=>{n.forEach(e=>{this.remove(e),zy(e,{transition:`none`,opacity:`1`})}),t()},r)},r)):setTimeout(t,r)}),this}static start(){return Gl?(this.status||this.set(0),this.options.trickle&&this.startTrickling(),this):this}static done(e){return!Gl||!e&&!this.status?this:this.inc(.3+.5*Math.random()).set(1)}static inc(e){if(this.isPaused)return this;let t=this.status;return t?t>1?this:(typeof e!=`number`&&(e=t>=0&&t<.2?.1:t>=.2&&t<.5?.04:t>=.5&&t<.8?.02:t>=.8&&t<.99?.005:0),t=uf(t+e,0,.994),this.set(t)):this.start()}static dec(e){if(this.isPaused)return this;let t=this.status;return typeof t==`number`?(typeof e!=`number`&&(e=t>.8?.1:t>.5?.05:t>.2?.02:.01),t=uf(t-e,0,.994),this.set(t)):this}static trickle(){return this.isPaused?this:this.inc()}static promise(e){let t=typeof e==`function`?e():e;if(!t)return this;if(typeof t.then==`function`)return this.start(),Promise.resolve(t).then(()=>{this.done()},()=>{this.done(!0)}),this;if(typeof t.state!=`function`||typeof t.always!=`function`||t.state()===`resolved`)return this;let n=0,r=0;return this.start(),n++,r++,t.always(()=>{r--,r===0?(n=0,this.done()):this.set((n-r)/n)}),this}static render(e=!1){if(!Gl)return[];let t=Array.from(document.querySelectorAll(`[data-vean-progress-provider]`));return t.forEach(t=>{t.style.display=``;let n=t.querySelector(`[data-vean-progress-bar]`),r=Ry(e?0:this.status||0,this.options.direction);zy(n,this.barPositionCSS({n:this.status||0,speed:this.options.speed,ease:this.options.easing,percent:r})),typeof this.status==`number`?t.setAttribute(`aria-valuenow`,`${this.status}`):t.removeAttribute(`aria-valuenow`)}),t}static remove(e){Gl&&(this.clearTrickleTimer(),e?e.style.display=`none`:document.querySelectorAll(`[data-vean-progress-provider]`).forEach(e=>{let t=e;t.style.display=`none`}))}static pause(){return this.isStarted()?(this.isPaused=!0,this.clearTrickleTimer(),this):this}static resume(){return this.isStarted()?(this.isPaused=!1,this.options.trickle&&this.startTrickling(),this):this}static queue(e){this.pending.push(e),this.pending.length===1&&this.next()}static next(){let e=this.pending.shift();e&&e(this.next.bind(this))}static clearTrickleTimer(){this.trickleTimer&&=(clearTimeout(this.trickleTimer),void 0)}static startTrickling(){if(this.trickleTimer||this.isPaused||!this.isStarted())return;let e=()=>{this.trickleTimer=void 0,!this.isPaused&&this.isStarted()&&(this.trickle(),!this.isPaused&&this.isStarted()&&(this.trickleTimer=setTimeout(e,this.options.trickleSpeed)))};this.trickleTimer=setTimeout(e,this.options.trickleSpeed)}static barPositionCSS({n:e,speed:t,ease:n,percent:r}){return{transform:`translate3d(${r??Ry(e,this.options.direction)}%,0,0)`,transition:`all ${t}ms ${n}`}}};function Ry(e,t){return t===`rtl`?(1-e)*100:(-1+e)*100}function zy(e,t,n){if(typeof t==`string`)n!==void 0&&(e.style[t]=n);else for(let n in t)if(t.hasOwnProperty(n)){let r=t[n];r!==void 0&&(e.style[n]=r)}}var By=[`aria-label`],Vy=P({name:`ProgressProvider`,__name:`progress-provider`,props:{direction:{},minimum:{},maximum:{},easing:{},speed:{},trickle:{type:Boolean},trickleSpeed:{}},setup(e){let t=e,n=Fy(),r=cg();return er(()=>{Ly.configure(t)}),(e,t)=>(I(),L(`div`,{"data-vean-progress-provider":``,"data-allow-mismatch":`style`,class:k(M(n).root),role:`progressbar`,"aria-label":M(r).progress.loading,"aria-valuemin":`0`,"aria-valuemax":`1`,style:{display:`none`}},[z(`div`,{class:k(M(n).indicator),"data-vean-progress-bar":``},null,2)],10,By))}}),Hy=Nl({extendBase:e=>({close:fg({size:e.size}),fullscreen:fg({size:e.size}),cancel:dg({size:e.size,variant:`pure`}),confirm:dg({size:e.size})}),slots:{overlay:[`fixed inset-0 z-base bg-mask`,`data-[state=open]:animate-in data-[state=open]:fade-in-0`,`data-[state=closed]:animate-out data-[state=closed]:fade-out-0`],popup:[`group fixed start-1/2 top-1/2 z-base flex flex-col w-max lt-sm:w-full lt-sm:min-w-auto lt-sm:max-w-full border bg-popover shadow-lg outline-none duration-200 rounded-lg`,`-translate-x-1/2 -translate-y-1/2 [&[dir=rtl]]:translate-x-1/2`,`data-[dragging]:transition-none data-[dragging]:select-none`,`data-[fullscreen]:w-screen data-[fullscreen]:h-screen`,`data-[fullscreen]:max-w-none data-[fullscreen]:rounded-none data-[fullscreen]:shadow-none`,`data-[fullscreen]:data-[state=open]:slide-in-from-top-1/2`,`data-[fullscreen]:data-[state=closed]:slide-out-to-top-1/2`,`data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 data-[state=open]:slide-in-from-left-1/2`,`data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=closed]:slide-out-to-left-1/2`],header:`flex flex-col lt-sm:text-center data-[draggable]:cursor-grab data-[draggable]:touch-none group-data-[dragging]:cursor-grabbing`,title:`flex items-center font-semibold leading-none tracking-tight m-0`,icon:`group-data-[type=info]:text-info group-data-[type=success]:text-success group-data-[type=warning]:text-warning group-data-[type=error]:text-destructive`,description:`text-muted-foreground m-0`,close:`absolute`,fullscreen:`absolute`,content:`grow overflow-auto [overscroll-behavior:contain]`,footer:`flex justify-end lt-sm:flex-col-reverse`,cancel:``,confirm:``},variants:{size:{xs:{popup:`gap-y-1.5 min-w-xs max-w-3xl px-2 py-1.5 text-2xs`,header:`gap-y-1.5`,title:`gap-x-1.5 text-xs`,description:`text-2xs`,close:`end-1.5 top-1.5`,fullscreen:`end-8 top-1.5`,footer:`gap-1.5`},sm:{popup:`gap-y-2 min-w-sm max-w-4xl px-3 py-2 text-xs`,header:`gap-y-2`,title:`gap-x-1.75 text-sm`,description:`text-xs`,close:`end-1.75 top-1.75`,fullscreen:`end-8 top-1.75`,footer:`gap-2`},md:{popup:`gap-y-3 min-w-md max-w-5xl px-4 py-3 text-sm`,header:`gap-y-3`,title:`gap-x-2 text-base`,description:`text-sm`,close:`end-2 top-2`,fullscreen:`end-10 top-2`,footer:`gap-3`},lg:{popup:`gap-y-4 min-w-lg max-w-6xl px-5 py-4 text-base`,header:`gap-y-4`,title:`gap-x-2.5 text-lg`,description:`text-base`,close:`end-2.5 top-2.5`,fullscreen:`end-10 top-2.5`,footer:`gap-4`},xl:{popup:`gap-y-5 min-w-xl max-w-7xl px-6 py-5 text-lg`,header:`gap-y-5`,title:`gap-x-3 text-xl`,description:`text-lg`,close:`end-3 top-3`,fullscreen:`end-12 top-3`,footer:`gap-5`},"2xl":{popup:`gap-y-6 min-w-2xl max-w-7xl px-7 py-6 text-xl`,header:`gap-y-6`,title:`gap-x-3.5 text-2xl`,description:`text-xl`,close:`end-4 top-4`,fullscreen:`end-13 top-4`,footer:`gap-6`}},pure:{true:{popup:`p-0 gap-0 border-none`}}},defaultVariants:{size:`md`}});Nl({slots:{root:`relative w-full overflow-hidden rounded-full bg-muted`,indicator:`h-full w-full flex-1 rounded-full transition-[transform,width] duration-300 transform-gpu will-change-transform data-[state=indeterminate]:w-2/5 data-[state=indeterminate]:opacity-80`,circle:``,track:``,label:``},variants:{color:{primary:{indicator:`bg-primary`},destructive:{indicator:`bg-destructive`},success:{indicator:`bg-success`},warning:{indicator:`bg-warning`},info:{indicator:`bg-info`},carbon:{indicator:`bg-carbon`},secondary:{indicator:`bg-secondary-foreground/20`},accent:{indicator:`bg-accent-foreground/20`}},size:{xs:{root:`h-1.5`},sm:{root:`h-2`},md:{root:`h-2.5`},lg:{root:`h-3`},xl:{root:`h-3.5`},"2xl":{root:`h-4`}}},defaultVariants:{color:`primary`,size:`md`}}),Nl({slots:{root:`relative inline-flex shrink-0 items-center justify-center rounded-full`,indicator:`fill-none stroke-current transition-[stroke-dasharray,stroke-dashoffset] duration-300 ease-in-out`,circle:`size-full`,track:`fill-none stroke-current text-muted`,label:`pointer-events-none absolute inset-0 flex items-center justify-center`},variants:{color:{primary:{indicator:`text-primary`},destructive:{indicator:`text-destructive`},success:{indicator:`text-success`},warning:{indicator:`text-warning`},info:{indicator:`text-info`},carbon:{indicator:`text-carbon`},secondary:{indicator:`text-secondary-foreground/40`},accent:{indicator:`text-accent-foreground/40`}},size:{xs:{root:`h-8 w-8 text-[10px]`},sm:{root:`h-10 w-10 text-xs`},md:{root:`h-12 w-12 text-sm`},lg:{root:`h-16 w-16 text-base`},xl:{root:`h-20 w-20 text-lg`},"2xl":{root:`h-24 w-24 text-xl`}}},defaultVariants:{color:`primary`,size:`md`}});var Uy=Nl({slots:{root:`fixed z-max w-0 h-0 pointer-events-none`,indicator:`fixed top-0 start-0 w-full h-0.75 bg-primary`}}),Wy=P({name:`SProgressProvider`,__name:`progress-provider`,props:{direction:{},minimum:{},maximum:{},easing:{},speed:{},trickle:{type:Boolean},trickleSpeed:{}},setup(e){let t=e;return Py(U(()=>Uy())),(e,n)=>(I(),R(M(Vy),ge(Ka(t)),null,16))}}),Gy=P({name:`SDialogProvider`,__name:`dialog-provider`,setup(e){return ry(U(()=>Hy({size:`md`}))),(e,t)=>(I(),R(M(ky)))}}),[Ky,qy]=Wl({name:`UIConfigProvider`,key:l_});function Jy(e){let t=c_(e);i_(t);let n=U(()=>t.theme.value),r=U(()=>sg(n.value)),i=Yy(),a=()=>{let t=i.current()??i.acquire(e.nonce);t&&(t.textContent=r.value)};Zr(a),nr(r,a);let o=og();nr([r,()=>t.mode.value,t.customPresets,t.appliedPresetName],()=>{e.persistTheme&&typeof document<`u`&&o.write({options:n.value,mode:t.mode.value,style:r.value,presets:t.customPresets.value,...t.appliedPresetName.value?{appliedPreset:t.appliedPresetName.value}:{}})},{immediate:!0}),ti(()=>o.flush());let s=e=>{e.key===`__VEAN_THEME`&&t.refreshThemeConfig()};return Zr(()=>{e.persistTheme&&window.addEventListener(`storage`,s)}),ti(()=>{window.removeEventListener(`storage`,s)}),{themeCss:r,themeOptions:n,commitThemeConfig:e=>{t.setThemeState(e)}}}function Yy(){let e=null;return{current:()=>e,acquire:t=>{if(e||typeof document>`u`)return e;let n=document.getElementById(Uh);return e=n instanceof HTMLStyleElement?n:document.createElement(`style`),n||(e.id=`vean-theme`,document.head.appendChild(e)),t&&!e.getAttribute(`nonce`)&&e.setAttribute(`nonce`,t),e}}}var Xy=P({name:`SConfigProvider`,__name:`config-provider`,props:{theme:{default:()=>({})},size:{default:`md`},iconify:{default:()=>({width:`1.25em`,height:`1.25em`})},progress:{},toast:{},customToast:{type:Boolean},persistTheme:{type:Boolean,default:!1},themeConfig:{},presetProvider:{},isServer:{type:Boolean,default:Zg},dir:{},locale:{},nonce:{},tooltip:{},iconRender:{},linkComponent:{},messages:{}},setup(e,{expose:t}){let n=e,r=Kd(n,[`iconRender`,`theme`,`size`,`iconify`,`progress`,`toast`,`customToast`,`persistTheme`,`themeConfig`,`presetProvider`,`isServer`]),i=n.iconRender??(e=>bo(W,{icon:e,ssr:n.isServer})),{commitThemeConfig:a}=Jy(n);return Ky(Jt(n)),t({commitThemeConfig:a}),(t,n)=>(I(),R(M(Xv),Za(M(r),{"icon-render":M(i)}),{default:qn(()=>[pi(t.$slots,`default`),e.customToast?H(`v-if`,!0):(I(),R(Xg,ge(Za({key:0},e.toast)),null,16)),B(Gy),B(Wy,ge(Ka(e.progress)),null,16)]),_:3},16,[`icon-render`]))}}),Zy=/^[\w+.-]{2,}:\/\//;function Qy(e){return e.endsWith(`/`)?e:`${e}/`}function $y(e){return(e.endsWith(`/`)?e.slice(0,-1):e)||`/`}function eb(e,...t){let n=e;for(let e of t)e&&e!==`/`&&(n=n?Qy(n)+e.replace(/^\.?\//,``):e);return n}function tb(e,t){if(!t||t===`/`||Zy.test(e))return e;let n=$y(t);return e.startsWith(n)?e:eb(n,e)}function nb(e,t){let n=e.match(Zy);return t+(n?e.slice(n[0].length):e)}function rb(e,t){let n=`\x1B[${e}m`,r=`\x1B[${t}m`;return((e,...t)=>{if(Array.isArray(e)&&`raw`in e){let i=e,a=``;for(let e=0;e<i.length;e++)a+=i[e],e<t.length&&(a+=String(t[e]));return`${n}${a}${r}`}return`${n}${String(e)}${r}`})}var ib={blue:rb(34,39),cyan:rb(36,39),gray:rb(90,39),green:rb(32,39),red:rb(31,39),yellow:rb(33,39),bold:rb(1,22),dim:rb(2,22),reset:rb(0,0),underline:rb(4,24)};function ab(e,...t){return typeof e==`function`?e(...t):e}var ob=Error.captureStackTrace,sb=class e extends Error{name;code;docs;fix;sources;data;get why(){return this.message}constructor(t,n=e){super(t.why,{cause:t.cause}),this.code=this.name=t.code,this.fix=t.fix,this.docs=t.docs,this.sources=t.sources,this.data=t.data,ob?.(this,n)}toJSON(){return{name:this.name,why:this.why,fix:this.fix,docs:this.docs,sources:this.sources,cause:this.cause,data:this.data,stack:this.stack}}};function cb(e,t){return typeof e==`string`?`${e}/${t.toLowerCase()}`:e?.(t)}function lb(e){let t=e.reporters??[],n={},{docsBase:r}=e;for(let i of Object.keys(e.codes)){let a=e.codes[i],o=a.docs===!1?void 0:a.docs||cb(r,i),s=(e={},n={})=>{let r=new sb({code:i,why:ab(a.why,e),fix:ab(a.fix,e),docs:o,cause:e.cause,sources:e.sources,data:ab(a.data,e)},s);for(let e of t)e(r,n);return r};n[i]=s}return n}function ub(e){return t=>{let n=`${e.bold(e.red(`[${t.name}]`))} ${t.message}`,r=[];return t.fix&&r.push(`${e.dim(`fix:`)} ${t.fix}`),t.sources?.length&&r.push(`${e.dim(`sources:`)} ${t.sources.join(`, `)}`),t.docs&&r.push(`${e.dim(`see:`)} ${e.cyan(t.docs)}`),r.length===0?n:[n,...r.map((t,n)=>`${e.dim(n<r.length-1?`├▶`:`╰▶`)} ${t}`)].join(`
27
27
  `)}}var db={bus:{agentManifestChanged:`agent:manifest:changed`,agentToolRegistered:`agent:tool:registered`,agentToolUnregistered:`agent:tool:unregistered`,agentResourceRegistered:`agent:resource:registered`,agentResourceUnregistered:`agent:resource:unregistered`},client:{isTrustedUpdated:`rpc:is-trusted:updated`,error:`rpc:error`,connectionStatus:`connection:status`,connectionError:`connection:error`},broadcast:{authRevoked:`devframe:auth:revoked`,clientStateUpdated:`devframe:rpc:client-state:updated`,clientStatePatch:`devframe:rpc:client-state:patch`,streamingChunk:`devframe:streaming:chunk`,streamingEnd:`devframe:streaming:end`,streamingUploadCancel:`devframe:streaming:upload-cancel`},inPageChannel:{panelStateUpdated:`devframe:in-page:panel-state:updated`,panelStatePatch:`devframe:in-page:panel-state:patch`},postMessage:{remoteAssetsError:`devframe:remote-assets-error`,inPageChannel:`devframe:in-page-channel`}},fb=ub(ib);function pb(e,{method:t=`warn`}={}){console[t](fb(e))}function mb(e){return lb({...e,reporters:[pb,...e.reporters??[]]})}function hb(){let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}}var gb=Math.random.bind(Math),_b=`useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict`;function vb(e=21){let t=``,n=e;for(;n--;)t+=_b[gb()*64|0];return t}var yb=6e4,bb=e=>e,xb=bb,{clearTimeout:Sb,setTimeout:Cb}=globalThis;function wb(e,t){let{post:n,on:r,off:i=()=>{},eventNames:a=[],serialize:o=bb,deserialize:s=xb,resolver:c,bind:l=`rpc`,timeout:u=yb,proxify:d=!0}=t,f=!1,p=new Map,m,h;async function g(e,r,i,a){if(f)throw Error(`[birpc] rpc is closed, cannot call "${e}"`);let s={m:e,a:r,t:`q`};a&&(s.o=!0);let c=async e=>n(o(e));if(i){await c(s);return}if(m)try{await m}finally{m=void 0}let{promise:l,resolve:d,reject:g}=hb(),_=vb();s.i=_;let v;async function y(n=s){return u>=0&&(v=Cb(()=>{try{if(t.onTimeoutError?.call(h,e,r)!==!0)throw Error(`[birpc] timeout on calling "${e}"`)}catch(e){g(e)}p.delete(_)},u),typeof v==`object`&&(v=v.unref?.())),p.set(_,{resolve:d,reject:g,timeoutId:v,method:e}),await c(n),l}try{t.onRequest?await t.onRequest.call(h,s,y,d):await y()}catch(e){if(t.onGeneralError?.call(h,e)!==!0)throw e;return}finally{Sb(v),p.delete(_)}return l}let _={$call:(e,...t)=>g(e,t,!1),$callOptional:(e,...t)=>g(e,t,!1,!0),$callEvent:(e,...t)=>g(e,t,!0),$callRaw:e=>g(e.method,e.args,e.event,e.optional),$rejectPendingCalls:y,get $closed(){return f},get $meta(){return t.meta},$close:v,$functions:e};h=d?new Proxy({},{get(t,n){if(Object.hasOwn(_,n))return _[n];if(n===`then`&&!a.includes(`then`)&&!(`then`in e))return;let r=(...e)=>g(n,e,!0);if(a.includes(n))return r.asEvent=r,r;let i=(...e)=>g(n,e,!1);return i.asEvent=r,i}}):_;function v(e){f=!0,p.forEach(({reject:t,method:n})=>{let r=Error(`[birpc] rpc is closed, cannot call "${n}"`);if(e)return e.cause??=r,t(e);t(r)}),p.clear(),i(b)}function y(e){let t=Array.from(p.values()).map(({method:t,reject:n})=>e?e({method:t,reject:n}):n(Error(`[birpc]: rejected pending call "${t}".`)));return p.clear(),t}async function b(r,...i){let a;try{a=s(r)}catch(e){if(t.onGeneralError?.call(h,e)!==!0)throw e;return}if(a.t===`q`){let{m:r,a:s,o:u}=a,d,f,p=await(c?c.call(h,r,e[r]):e[r]);if(u&&(p||=()=>void 0),!p)f=Error(`[birpc] function "${r}" not found`);else try{d=await p.apply(l===`rpc`?h:e,s)}catch(e){f=e}if(a.i){if(f&&t.onFunctionError&&t.onFunctionError.call(h,f,r,s)===!0)return;if(!f)try{await n(o({t:`s`,i:a.i,r:d}),...i);return}catch(e){if(f=e,t.onGeneralError?.call(h,e,r,s)!==!0)throw e}try{await n(o({t:`s`,i:a.i,e:f}),...i)}catch(e){if(t.onGeneralError?.call(h,e,r,s)!==!0)throw e}}}else{let{i:e,r:t,e:n}=a,r=p.get(e);r&&(Sb(r.timeoutId),n?r.reject(n):r.resolve(t)),p.delete(e)}}return m=r(b),h}function Tb(e,t){return t.safety?t.safety:e===`static`||e===`query`||e==null?`read`:`action`}var Eb=Object.freeze({type:`object`,additionalProperties:!0});function Db(e){let t=e[`~standard`];if(t.jsonSchema)try{return t.jsonSchema.input({target:`draft-2020-12`})}catch{return Eb}return Eb}function Ob(e){if(!e||e.length===0)return{type:`object`,properties:{}};let t={},n=[];for(let r=0;r<e.length;r++){let i=`arg${r}`;t[i]=Db(e[r]),n.push(i)}return{type:`object`,properties:t,required:n,additionalProperties:!1}}function kb(e,t){if(Array.isArray(e))return e;if(e==null)return[];if(typeof e!=`object`)return;let n=e;if(t!=null)return Array.from({length:t},(e,t)=>n[`arg${t}`]);if(`arg0`in n){let e=[];for(;`arg${e.length}`in n;)e.push(n[`arg${e.length}`]);return e}return Object.keys(n).length===0?[]:void 0}function Ab(e,t){return kb(e,t)??[e]}function jb(e){return typeof e==`string`?`'${e}'`:new Fb().serialize(e)}var Mb=` _-,;:!?.'"()[]{}@*/\\&#%\`^+<=>|~$0123456789abcdefghijklmnopqrstuvwxyz`,Nb=(function(){let e=new Uint8Array(128);for(let t=0;t<69;t++)e[Mb.charCodeAt(t)]=t+1;for(let t=65;t<=90;t++)e[t]=e[t+32];return e})();function Pb(e,t){if(e===t)return 0;let n=Math.min(e.length,t.length),r=0;for(let i=0;i<n;i++){let n=e.charCodeAt(i),a=t.charCodeAt(i);if(n===a)continue;let o=n<128&&Nb[n]?Nb[n]:n+128,s=a<128&&Nb[a]?Nb[a]:a+128;if(o!==s)return o<s?-1:1;r===0&&(r=n>a?-1:1)}return e.length===t.length?r:e.length<t.length?-1:1}var Fb=(function(){class e{#e=new Map;compare(e,t){let n=typeof e,r=typeof t;return n===`string`&&r===`string`?Pb(e,t):n===`number`&&r===`number`?e-t:Pb(this.serialize(e,!0),this.serialize(t,!0))}serialize(e,t){if(e===null)return`null`;switch(typeof e){case`string`:return t?e:`'${e}'`;case`bigint`:return`${e}n`;case`object`:return this.$object(e);case`function`:return this.$function(e)}return String(e)}serializeObject(e){let t=Object.prototype.toString.call(e);if(t!==`[object Object]`)return this.serializeBuiltInType(t.length<10?`unknown:${t}`:t.slice(8,-1),e);let n=e.constructor,r=n===Object||n===void 0?``:n.name;if(r!==``&&globalThis[r]===n)return this.serializeBuiltInType(r,e);if(`toJSON`in e&&typeof e.toJSON==`function`){let t=e.toJSON();return r+(typeof t==`object`&&t?this.$object(t):`(${this.serialize(t)})`)}let i=Object.keys(e).sort(Pb),a=`${r}{`;for(let t=0;t<i.length;t++){let n=i[t];a+=`${n}:${this.serialize(e[n])}`,t<i.length-1&&(a+=`,`)}return a+`}`}serializeBuiltInType(e,t){let n=this[`$`+e];if(n)return n.call(this,t);if(typeof t.entries==`function`)return this.serializeObjectEntries(e,t.entries());throw Error(`Cannot serialize ${e}`)}serializeObjectEntries(e,t){let n=Array.from(t).sort((e,t)=>this.compare(e[0],t[0])),r=`${e}{`;for(let e=0;e<n.length;e++){let[t,i]=n[e];r+=`${this.serialize(t,!0)}:${this.serialize(i)}`,e<n.length-1&&(r+=`,`)}return r+`}`}$object(e){let t=this.#e.get(e);return t===void 0&&(this.#e.set(e,`#${this.#e.size}`),t=this.serializeObject(e),this.#e.set(e,t)),t}$function(e){let t=Function.prototype.toString.call(e);return t.slice(-15)===`[native code] }`?`${e.name||``}()[native]`:`${e.name}(${e.length})${t.replace(/\s*\n\s*/g,``)}`}$Array(e){let t=`[`;for(let n=0;n<e.length;n++)t+=this.serialize(e[n]),n<e.length-1&&(t+=`,`);return t+`]`}$Date(e){try{return`Date(${e.toISOString()})`}catch{return`Date(null)`}}$ArrayBuffer(e){return`ArrayBuffer[${new Uint8Array(e).join(`,`)}]`}$Set(e){return`Set${this.$Array(Array.from(e).sort((e,t)=>this.compare(e,t)))}`}$Map(e){return this.serializeObjectEntries(`Map`,e.entries())}}for(let t of[`Error`,`RegExp`,`URL`])e.prototype[`$`+t]=function(e){return`${t}(${e})`};for(let t of[`Int8Array`,`Uint8Array`,`Uint8ClampedArray`,`Int16Array`,`Uint16Array`,`Int32Array`,`Uint32Array`,`Float32Array`,`Float64Array`])e.prototype[`$`+t]=function(e){return`${t}[${e.join(`,`)}]`};for(let t of[`BigInt64Array`,`BigUint64Array`])e.prototype[`$`+t]=function(e){return`${t}[${e.join(`n,`)}${e.length>0?`n`:``}]`};return e})(),Ib=[1779033703,-1150833019,1013904242,-1521486534,1359893119,-1694144372,528734635,1541459225],Lb=[1116352408,1899447441,-1245643825,-373957723,961987163,1508970993,-1841331548,-1424204075,-670586216,310598401,607225278,1426881987,1925078388,-2132889090,-1680079193,-1046744716,-459576895,-272742522,264347078,604807628,770255983,1249150122,1555081692,1996064986,-1740746414,-1473132947,-1341970488,-1084653625,-958395405,-710438585,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,-2117940946,-1838011259,-1564481375,-1474664885,-1035236496,-949202525,-778901479,-694614492,-200395387,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,-2067236844,-1933114872,-1866530822,-1538233109,-1090935817,-965641998],Rb=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_`,zb=[],Bb=class{_data=new Vb;_hash=new Vb([...Ib]);_nDataBytes=0;_minBufferSize=0;finalize(e){e&&this._append(e);let t=this._nDataBytes*8,n=this._data.sigBytes*8;return this._data.words[n>>>5]|=128<<24-n%32,this._data.words[(n+64>>>9<<4)+14]=Math.floor(t/4294967296),this._data.words[(n+64>>>9<<4)+15]=t,this._data.sigBytes=this._data.words.length*4,this._process(),this._hash}_doProcessBlock(e,t){let n=this._hash.words,r=n[0],i=n[1],a=n[2],o=n[3],s=n[4],c=n[5],l=n[6],u=n[7];for(let n=0;n<64;n++){if(n<16)zb[n]=e[t+n]|0;else{let e=zb[n-15],t=(e<<25|e>>>7)^(e<<14|e>>>18)^e>>>3,r=zb[n-2],i=(r<<15|r>>>17)^(r<<13|r>>>19)^r>>>10;zb[n]=t+zb[n-7]+i+zb[n-16]}let d=s&c^~s&l,f=r&i^r&a^i&a,p=(r<<30|r>>>2)^(r<<19|r>>>13)^(r<<10|r>>>22),m=(s<<26|s>>>6)^(s<<21|s>>>11)^(s<<7|s>>>25),h=u+m+d+Lb[n]+zb[n],g=p+f;u=l,l=c,c=s,s=o+h|0,o=a,a=i,i=r,r=h+g|0}n[0]=n[0]+r|0,n[1]=n[1]+i|0,n[2]=n[2]+a|0,n[3]=n[3]+o|0,n[4]=n[4]+s|0,n[5]=n[5]+c|0,n[6]=n[6]+l|0,n[7]=n[7]+u|0}_append(e){typeof e==`string`&&(e=Vb.fromUtf8(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes}_process(e){let t,n=this._data.sigBytes/64;n=e?Math.ceil(n):Math.max((n|0)-this._minBufferSize,0);let r=n*16,i=Math.min(r*4,this._data.sigBytes);if(r){for(let e=0;e<r;e+=16)this._doProcessBlock(this._data.words,e);t=this._data.words.splice(0,r),this._data.sigBytes-=i}return new Vb(t,i)}},Vb=class e{words;sigBytes;constructor(e,t){e=this.words=e||[],this.sigBytes=t===void 0?e.length*4:t}static fromUtf8(t){let n=unescape(encodeURIComponent(t)),r=n.length,i=[];for(let e=0;e<r;e++)i[e>>>2]|=(n.charCodeAt(e)&255)<<24-e%4*8;return new e(i,r)}toBase64(){let e=[];for(let t=0;t<this.sigBytes;t+=3){let n=this.words[t>>>2]>>>24-t%4*8&255,r=this.words[t+1>>>2]>>>24-(t+1)%4*8&255,i=this.words[t+2>>>2]>>>24-(t+2)%4*8&255,a=n<<16|r<<8|i;for(let n=0;n<4&&t*8+n*6<this.sigBytes*8;n++)e.push(Rb.charAt(a>>>6*(3-n)&63))}return e.join(``)}concat(e){if(this.words[this.sigBytes>>>2]&=4294967295<<32-this.sigBytes%4*8,this.words.length=Math.ceil(this.sigBytes/4),this.sigBytes%4)for(let t=0;t<e.sigBytes;t++){let n=e.words[t>>>2]>>>24-t%4*8&255;this.words[this.sigBytes+t>>>2]|=n<<24-(this.sigBytes+t)%4*8}else for(let t=0;t<e.sigBytes;t+=4)this.words[this.sigBytes+t>>>2]=e.words[t>>>2];this.sigBytes+=e.sigBytes}};function Hb(e){return new Bb().finalize(e).toBase64()}function Ub(e){return Hb(jb(e))}function Wb(e){return Ub(e)}function Gb(){let e={};function t(t,...n){let r=e[t]||[];for(let e=0,t=r.length;e<t;e++){let t=r[e];t&&t(...n)}}function n(n,...r){t(n,...r),delete e[n]}function r(t,n){return(e[t]||=[]).push(n),()=>{e[t]=e[t]?.filter(e=>n!==e)}}function i(e,t){let n=r(e,((...e)=>(n(),t(...e))));return n}return{_listeners:e,emit:t,emitOnce:n,on:r,once:i}}var Kb=`useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict`;function qb(e=21){let t=``,n=e;for(;n--;)t+=Kb[Math.random()*64|0];return t}var Jb=Symbol.for(`immer-nothing`),Yb=Symbol.for(`immer-draftable`),Xb=Symbol.for(`immer-state`),Zb=[function(e){return`The plugin for '${e}' has not been loaded into Immer. To enable the plugin, import and call \`enable${e}()\` when initializing your application.`},function(e){return`produce can only be called on things that are draftable: plain objects, arrays, Map, Set or classes that are marked with '[immerable]: true'. Got '${e}'`},`This object has been frozen and should not be mutated`,function(e){return`Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? `+e},`An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.`,`Immer forbids circular references`,"The first or second argument to `produce` must be a function","The third argument to `produce` must be a function or undefined","First argument to `createDraft` must be a plain object, an array, or an immerable object","First argument to `finishDraft` must be a draft returned by `createDraft`",function(e){return`'current' expects a draft, got: ${e}`},`Object.defineProperty() cannot be used on an Immer draft`,`Object.setPrototypeOf() cannot be used on an Immer draft`,`Immer only supports deleting array indices`,`Immer only supports setting array indices and the 'length' property`,function(e){return`'original' expects a draft, got: ${e}`}];function Qb(e,...t){{let n=Zb[e],r=Sx(n)?n.apply(null,t):n;throw Error(`[Immer] ${r}`)}}var $b=Object,ex=$b.getPrototypeOf,tx=`constructor`,nx=`prototype`,rx=`configurable`,ix=`enumerable`,ax=`writable`,ox=`value`,sx=e=>!!e&&!!e[Xb];function cx(e){return e?dx(e)||vx(e)||!!e[Yb]||!!e[tx]?.[Yb]||yx(e)||bx(e):!1}var lx=$b[nx][tx].toString(),ux=new WeakMap;function dx(e){if(!e||!xx(e))return!1;let t=ex(e);if(t===null||t===$b[nx])return!0;let n=$b.hasOwnProperty.call(t,tx)&&t[tx];if(n===Object)return!0;if(!Sx(n))return!1;let r=ux.get(n);return r===void 0&&(r=Function.toString.call(n),ux.set(n,r)),r===lx}function fx(e,t,n=!0){px(e)===0?(n?Reflect.ownKeys(e):$b.keys(e)).forEach(n=>{t(n,e[n],e)}):e.forEach((n,r)=>t(r,n,e))}function px(e){let t=e[Xb];return t?t.type_:vx(e)?1:yx(e)?2:bx(e)?3:0}var mx=(e,t,n=px(e))=>n===2?e.has(t):$b[nx].hasOwnProperty.call(e,t),hx=(e,t,n=px(e))=>n===2?e.get(t):e[t],gx=(e,t,n,r=px(e))=>{r===2?e.set(t,n):r===3?e.add(n):e[t]=n};function _x(e,t){return e===t?e!==0||1/e==1/t:e!==e&&t!==t}var vx=Array.isArray,yx=e=>e instanceof Map,bx=e=>e instanceof Set,xx=e=>typeof e==`object`,Sx=e=>typeof e==`function`,Cx=e=>typeof e==`boolean`;function wx(e){let t=+e;return Number.isInteger(t)&&String(t)===e}var Tx=e=>xx(e)?e?.[Xb]:null,Ex=e=>e.copy_||e.base_,Dx=e=>e.modified_?e.copy_:e.base_;function Ox(e,t){if(yx(e))return new Map(e);if(bx(e))return new Set(e);if(vx(e))return Array[nx].slice.call(e);let n=dx(e);if(t===!0||t===`class_only`&&!n){let t=$b.getOwnPropertyDescriptors(e);delete t[Xb];let n=Reflect.ownKeys(t);for(let r=0;r<n.length;r++){let i=n[r],a=t[i];a[ax]===!1&&(a[ax]=!0,a[rx]=!0),(a.get||a.set)&&(t[i]={[rx]:!0,[ax]:!0,[ix]:a[ix],[ox]:e[i]})}return $b.create(ex(e),t)}{let t=ex(e);if(t!==null&&n)return{...e};let r=$b.create(t);return $b.assign(r,e)}}function kx(e,t=!1){return Mx(e)||sx(e)||!cx(e)?e:(px(e)>1&&$b.defineProperties(e,{set:jx,add:jx,clear:jx,delete:jx}),$b.freeze(e),t&&fx(e,(e,t)=>{kx(t,!0)},!1),e)}function Ax(){Qb(2)}var jx={[ox]:Ax};function Mx(e){return e===null||!xx(e)||$b.isFrozen(e)}var Nx=`MapSet`,Px=`Patches`,Fx=`ArrayMethods`,Ix={};function Lx(e){let t=Ix[e];return t||Qb(0,e),t}var Rx=e=>!!Ix[e];function zx(e,t){Ix[e]||(Ix[e]=t)}var Bx,Vx=()=>Bx,Hx=(e,t)=>({drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0,handledSet_:new Set,processedForPatches_:new Set,mapSetPlugin_:Rx(Nx)?Lx(Nx):void 0,arrayMethodsPlugin_:Rx(Fx)?Lx(Fx):void 0});function Ux(e,t){t&&(e.patchPlugin_=Lx(Px),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function Wx(e){Gx(e),e.drafts_.forEach(qx),e.drafts_=null}function Gx(e){e===Bx&&(Bx=e.parent_)}var Kx=e=>Bx=Hx(Bx,e);function qx(e){let t=e[Xb];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function Jx(e,t){t.unfinalizedDrafts_=t.drafts_.length;let n=t.drafts_[0];if(e!==void 0&&e!==n){n[Xb].modified_&&(Wx(t),Qb(4)),cx(e)&&(e=Yx(t,e));let{patchPlugin_:r}=t;r&&r.generateReplacementPatches_(n[Xb].base_,e,t)}else e=Yx(t,n);return Xx(t,e,!0),Wx(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e===Jb?void 0:e}function Yx(e,t){if(Mx(t))return t;let n=t[Xb];if(!n)return iS(t,e.handledSet_,e);if(!Qx(n,e))return t;if(!n.modified_)return n.base_;if(!n.finalized_){let{callbacks_:t}=n;if(t)for(;t.length>0;)t.pop()(e);nS(n,e)}return n.copy_}function Xx(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&kx(t,n)}function Zx(e){e.finalized_=!0,e.scope_.unfinalizedDrafts_--}var Qx=(e,t)=>e.scope_===t,$x=[];function eS(e,t,n,r){let i=Ex(e),a=e.type_;if(r!==void 0&&hx(i,r,a)===t){gx(i,r,n,a);return}if(!e.draftLocations_){let t=e.draftLocations_=new Map;fx(i,(e,n)=>{if(sx(n)){let r=t.get(n)||[];r.push(e),t.set(n,r)}})}let o=e.draftLocations_.get(t)??$x;for(let e of o)gx(i,e,n,a)}function tS(e,t,n){e.callbacks_.push(function(r){let i=t;if(!i||!Qx(i,r))return;r.mapSetPlugin_?.fixSetContents(i);let a=Dx(i);eS(e,i.draft_??i,a,n),nS(i,r)})}function nS(e,t){if(e.modified_&&!e.finalized_&&(e.type_===3||e.type_===1&&e.allIndicesReassigned_||(e.assigned_?.size??0)>0)){let{patchPlugin_:n}=t;if(n){let r=n.getPath(e);r&&n.generatePatches_(e,r,t)}Zx(e)}}function rS(e,t,n){let{scope_:r}=e;if(sx(n)){let i=n[Xb];Qx(i,r)&&i.callbacks_.push(function(){pS(e),eS(e,n,Dx(i),t)})}else cx(n)&&e.callbacks_.push(function(){let i=Ex(e);e.type_===3?i.has(n)&&iS(n,r.handledSet_,r):hx(i,t,e.type_)===n&&r.drafts_.length>1&&(e.assigned_.get(t)??!1)===!0&&e.copy_&&iS(hx(e.copy_,t,e.type_),r.handledSet_,r)})}function iS(e,t,n){return!n.immer_.autoFreeze_&&n.unfinalizedDrafts_<1||sx(e)||t.has(e)||!cx(e)||Mx(e)?e:(t.add(e),fx(e,(r,i)=>{if(sx(i)){let t=i[Xb];Qx(t,n)&&(gx(e,r,Dx(t),e.type_),Zx(t))}else cx(i)&&iS(i,t,n)}),e)}function aS(e,t){let n=vx(e),r={type_:+!!n,scope_:t?t.scope_:Vx(),modified_:!1,finalized_:!1,assigned_:void 0,parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1,callbacks_:void 0},i=r,a=oS;n&&(i=[r],a=sS);let{revoke:o,proxy:s}=Proxy.revocable(i,a);return r.draft_=s,r.revoke_=o,[s,r]}var oS={get(e,t){if(t===Xb)return e;let n=e.scope_.arrayMethodsPlugin_,r=e.type_===1&&typeof t==`string`;if(r&&n?.isArrayOperationMethod(t))return n.createMethodInterceptor(e,t);let i=Ex(e);if(!mx(i,t,e.type_))return uS(e,i,t);let a=i[t];if(e.finalized_||!cx(a)||r&&e.operationMethod&&n?.isMutatingArrayMethod(e.operationMethod)&&wx(t))return a;if(a===cS(e.base_,t)||lS(e,t,a)){pS(e);let n=e.type_===1?+t:t,r=hS(e.scope_,a,e,n);return e.copy_[n]=r}return a},has(e,t){return t in Ex(e)},ownKeys(e){return Reflect.ownKeys(Ex(e))},set(e,t,n){let r=dS(Ex(e),t);if(r?.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){let r=cS(Ex(e),t),i=r?.[Xb];if(i&&i.base_===n)return e.copy_[t]=n,e.assigned_.delete(t),!0;if(_x(n,r)&&(n!==void 0||mx(e.base_,t,e.type_)))return!0;pS(e),fS(e)}return e.copy_[t]===n&&(n!==void 0||mx(e.copy_,t,e.type_))||Number.isNaN(n)&&Number.isNaN(e.copy_[t])?!0:(e.copy_[t]=n,e.assigned_.set(t,!0),rS(e,t,n),!0)},deleteProperty(e,t){return pS(e),cS(e.base_,t)!==void 0||t in e.base_?(e.assigned_.set(t,!1),fS(e)):e.assigned_.delete(t),e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){let n=Ex(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r&&{[ax]:!0,[rx]:e.type_!==1||t!==`length`,[ix]:r[ix],[ox]:n[t]}},defineProperty(){Qb(11)},getPrototypeOf(e){return ex(e.base_)},setPrototypeOf(){Qb(12)}},sS={};for(let e in oS){let t=oS[e];sS[e]=function(){let e=arguments;return e[0]=e[0][0],t.apply(this,e)}}sS.deleteProperty=function(e,t){return isNaN(parseInt(t))&&Qb(13),sS.set.call(this,e,t,void 0)},sS.set=function(e,t,n){return t!==`length`&&isNaN(parseInt(t))&&Qb(14),oS.set.call(this,e[0],t,n,e[0])};function cS(e,t){let n=e[Xb];return(n?Ex(n):e)[t]}function lS(e,t,n){return e.type_!==1||!e.allIndicesReassigned_||e.assigned_?.get(t)||!cx(n)||n[Xb]?!1:e.baseRefs_.has(n)}function uS(e,t,n){let r=dS(t,n);return r?ox in r?r[ox]:r.get?.call(e.draft_):void 0}function dS(e,t){if(!(t in e))return;let n=ex(e);for(;n;){let e=Object.getOwnPropertyDescriptor(n,t);if(e)return e;n=ex(n)}}function fS(e){e.modified_||(e.modified_=!0,e.parent_&&fS(e.parent_))}function pS(e){e.copy_||=(e.assigned_=new Map,Ox(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var mS=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!1,this.produce=(e,t,n)=>{if(Sx(e)&&!Sx(t)){let n=t;t=e;let r=this;return function(e=n,...i){return r.produce(e,e=>t.call(this,e,...i))}}Sx(t)||Qb(6),n!==void 0&&!Sx(n)&&Qb(7);let r;if(cx(e)){let i=Kx(this),a=hS(i,e,void 0),o=!0;try{r=t(a),o=!1}finally{o?Wx(i):Gx(i)}return Ux(i,n),Jx(r,i)}if(!e||!xx(e)){if(r=t(e),r===void 0&&(r=e),r===Jb&&(r=void 0),this.autoFreeze_&&kx(r,!0),n){let t=[],i=[];Lx(Px).generateReplacementPatches_(e,r,{patches_:t,inversePatches_:i}),n(t,i)}return r}Qb(1,e)},this.produceWithPatches=(e,t)=>{if(Sx(e))return(t,...n)=>this.produceWithPatches(t,t=>e(t,...n));let n,r;return[this.produce(e,t,(e,t)=>{n=e,r=t}),n,r]},Cx(e?.autoFreeze)&&this.setAutoFreeze(e.autoFreeze),Cx(e?.useStrictShallowCopy)&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),Cx(e?.useStrictIteration)&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){cx(e)||Qb(8),sx(e)&&(e=gS(e));let t=Kx(this),n=hS(t,e,void 0);return n[Xb].isManual_=!0,Gx(t),n}finishDraft(e,t){let n=e&&e[Xb];(!n||!n.isManual_)&&Qb(9);let{scope_:r}=n;return Ux(r,t),Jx(void 0,r)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}setUseStrictIteration(e){this.useStrictIteration_=e}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(e,t){let n;for(n=t.length-1;n>=0;n--){let r=t[n];if(r.path.length===0&&r.op===`replace`){e=r.value;break}}n>-1&&(t=t.slice(n+1));let r=Lx(Px).applyPatches_;return sx(e)?r(e,t):this.produce(e,e=>r(e,t))}};function hS(e,t,n,r){let[i,a]=yx(t)?Lx(Nx).proxyMap_(t,n):bx(t)?Lx(Nx).proxySet_(t,n):aS(t,n);return(n?.scope_??Vx()).drafts_.push(i),a.callbacks_=n?.callbacks_??[],a.key_=r,n&&r!==void 0?tS(n,a,r):a.callbacks_.push(function(e){e.mapSetPlugin_?.fixSetContents(a);let{patchPlugin_:t}=e;a.modified_&&t&&t.generatePatches_(a,[],e)}),i}function gS(e){return sx(e)||Qb(10,e),_S(e)}function _S(e){if(!cx(e)||Mx(e))return e;let t=e[Xb],n,r=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=Ox(e,t.scope_.immer_.useStrictShallowCopy_),r=t.scope_.immer_.shouldUseStrictIteration()}else n=Ox(e,!0);return fx(n,(e,t)=>{gx(n,e,_S(t))},r),t&&(t.finalized_=!1),n}function vS(){Zb.push(`Sets cannot have "replace" patches.`,function(e){return`Unsupported patch operation: `+e},function(e){return`Cannot apply patch, path doesn't resolve: `+e},`Patching reserved attributes like __proto__, prototype and constructor is not allowed`);function e(n,r=[]){if(n.key_!==void 0){let e=n.parent_.copy_??n.parent_.base_,t=Tx(hx(e,n.key_)),i=hx(e,n.key_);if(i===void 0||i!==n.draft_&&i!==n.base_&&i!==n.copy_||t!=null&&t.base_!==n.base_)return null;let a=n.parent_.type_===3,o;if(a){let e=n.parent_;o=Array.from(e.drafts_.keys()).indexOf(n.key_)}else o=n.key_;if(!(a&&e.size>o||mx(e,o)))return null;r.push(o)}if(n.parent_)return e(n.parent_,r);r.reverse();try{t(n.copy_,r)}catch{return null}return r}function t(e,t){let n=e;for(let e=0;e<t.length-1;e++){let r=t[e];if(n=hx(n,r),!xx(n)||n===null)throw Error(`Cannot resolve path at '${t.join(`/`)}'`)}return n}let n=`replace`,r=`remove`;function i(e,t,n){if(e.scope_.processedForPatches_.has(e))return;e.scope_.processedForPatches_.add(e);let{patches_:r,inversePatches_:i}=n;switch(e.type_){case 0:case 2:return o(e,t,r,i);case 1:return a(e,t,r,i);case 3:return s(e,t,r,i)}}function a(e,t,i,a){let{base_:o,assigned_:s}=e,c=e.copy_;c.length<o.length&&([o,c]=[c,o],[i,a]=[a,i]);let l=e.allIndicesReassigned_===!0;for(let e=0;e<o.length;e++){let r=c[e],u=o[e];if((l||s?.get(e.toString()))&&r!==u){let o=r?.[Xb];if(o&&o.modified_)continue;let s=t.concat([e]);i.push({op:n,path:s,value:d(r)}),a.push({op:n,path:s,value:d(u)})}}for(let e=o.length;e<c.length;e++){let n=t.concat([e]);i.push({op:`add`,path:n,value:d(c[e])})}for(let e=c.length-1;o.length<=e;--e){let n=t.concat([e]);a.push({op:r,path:n})}}function o(e,t,i,a){let{base_:o,copy_:s,type_:c}=e;fx(e.assigned_,(e,l)=>{let u=hx(o,e,c),f=hx(s,e,c),p=l?mx(o,e)?n:`add`:r;if(u===f&&p===n)return;let m=t.concat(e);i.push(p===r?{op:p,path:m}:{op:p,path:m,value:d(f)}),a.push(p===`add`?{op:r,path:m}:p===r?{op:`add`,path:m,value:d(u)}:{op:n,path:m,value:d(u)})})}function s(e,t,n,i){let{base_:a,copy_:o}=e,s=0;a.forEach(e=>{if(!o.has(e)){let a=t.concat([s]);n.push({op:r,path:a,value:e}),i.unshift({op:`add`,path:a,value:e})}s++}),s=0,o.forEach(e=>{if(!a.has(e)){let a=t.concat([s]);n.push({op:`add`,path:a,value:e}),i.unshift({op:r,path:a,value:e})}s++})}function c(e,t,r){let{patches_:i,inversePatches_:a}=r;i.push({op:n,path:[],value:t===Jb?void 0:t}),a.push({op:n,path:[],value:e})}function l(e,t){return t.forEach(t=>{let{path:i,op:a}=t,o=e;for(let e=0;e<i.length-1;e++){let t=px(o),n=i[e];typeof n!=`string`&&typeof n!=`number`&&(n=``+n),(t===0||t===1)&&(n===`__proto__`||n===tx)&&Qb(19),Sx(o)&&n===nx&&Qb(19),o=hx(o,n),(o===null||!xx(o))&&Qb(18,i.join(`/`))}let s=px(o),c=u(t.value),l=i[i.length-1];switch(a){case n:switch(s){case 2:return o.set(l,c);case 3:Qb(16);default:return o[l]=c}case`add`:switch(s){case 1:return l===`-`?o.push(c):o.splice(l,0,c);case 2:return o.set(l,c);case 3:return o.add(c);default:return o[l]=c}case r:switch(s){case 1:return o.splice(l,1);case 2:return o.delete(l);case 3:return o.delete(t.value);default:return delete o[l]}default:Qb(17,a)}}),e}function u(e){if(!cx(e))return e;if(vx(e))return e.map(u);if(yx(e))return new Map(Array.from(e.entries()).map(([e,t])=>[e,u(t)]));if(bx(e))return new Set(Array.from(e).map(u));let t=Object.create(ex(e));for(let n in e)t[n]=u(e[n]);return mx(e,Yb)&&(t[Yb]=e[Yb]),t}function d(e){return sx(e)?u(e):e}zx(Px,{applyPatches_:l,generatePatches_:i,generateReplacementPatches_:c,getPath:e})}globalThis.Iterator?.from;var yS=new mS,bS=yS.produce,xS=yS.produceWithPatches.bind(yS),SS=yS.applyPatches.bind(yS),CS=1e3;function wS(e,t){if(e.add(t),e.size>CS){let t=e.values().next().value;t!==void 0&&e.delete(t)}}function TS(e){let{enablePatches:t=!1}=e;t&&vS();let n=Gb(),r=e.initialValue,i=new Set;return{on:n.on,value:()=>r,patch:(e,t=qb())=>{i.has(t)||(vS(),r=SS(r,e),wS(i,t),n.emit(`updated`,r,void 0,t))},mutate:(e,a=qb())=>{if(!i.has(a)){if(wS(i,a),t){let[t,i]=xS(r,e);if(t===r)return;r=t,n.emit(`updated`,r,i,a)}else{let t=bS(r,e);if(t===r)return;r=t,n.emit(`updated`,r,void 0,a)}}},syncIds:i}}var ES=typeof self==`object`?self:globalThis,DS=new Set([`Error`,`EvalError`,`RangeError`,`ReferenceError`,`SyntaxError`,`TypeError`,`URIError`,`AggregateError`]),OS=new Set([`Boolean`,`Number`,`String`,`Int8Array`,`Uint8Array`,`Uint8ClampedArray`,`Int16Array`,`Uint16Array`,`Int32Array`,`Uint32Array`,`Float16Array`,`Float32Array`,`Float64Array`,`BigInt64Array`,`BigUint64Array`]);function kS(e,t){let n=(t,n)=>(e.set(n,t),t),r=i=>{if(e.has(i))return e.get(i);let[a,o]=t[i];switch(a){case 0:case-1:return n(o,i);case 1:{let e=n([],i);for(let t of o)e.push(r(t));return e}case 2:{let e=n({},i);for(let[t,n]of o)e[r(t)]=r(n);return e}case 3:return n(new Date(o),i);case 4:{let{source:e,flags:t}=o;return n(new RegExp(e,t),i)}case 5:{let e=n(new Map,i);for(let[t,n]of o)e.set(r(t),r(n));return e}case 6:{let e=n(new Set,i);for(let t of o)e.add(r(t));return e}case 7:{let{name:e,message:t}=o,r=DS.has(e)?ES[e]:void 0;return n(new(r??ES.Error)(t),i)}case 8:return n(BigInt(o),i);case`BigInt`:return n(Object(BigInt(o)),i);case`ArrayBuffer`:return n(new Uint8Array(o).buffer,o);case`DataView`:{let{buffer:e}=new Uint8Array(o);return n(new DataView(e),o)}}if(typeof a==`string`&&OS.has(a))return n(new ES[a](o),i);throw TypeError(`unable to deserialize unsafe or unknown type: ${String(a)}`)};return r}function AS(e){return kS(new Map,e)(0)}var jS=``,{toString:MS}={},{keys:NS}=Object;function PS(e){let t=typeof e;if(t!==`object`||!e)return[0,t];let n=MS.call(e).slice(8,-1);switch(n){case`Array`:return[1,jS];case`Object`:return[2,jS];case`Date`:return[3,jS];case`RegExp`:return[4,jS];case`Map`:return[5,jS];case`Set`:return[6,jS];case`DataView`:return[1,n]}return n.includes(`Array`)?[1,n]:n.includes(`Error`)?[7,n]:[2,n]}function FS([e,t]){return e===0&&(t===`function`||t===`symbol`)}function IS(e,t,n,r){let i=(e,t)=>{let i=r.push(e)-1;return n.set(t,i),i},a=r=>{if(n.has(r))return n.get(r);let[o,s]=PS(r);switch(o){case 0:{let t=r;switch(s){case`bigint`:o=8,t=r.toString();break;case`function`:case`symbol`:if(e)throw TypeError(`unable to serialize ${s}`);t=null;break;case`undefined`:return i([-1],r)}return i([o,t],r)}case 1:{if(s){let e=r;return s===`DataView`?e=new Uint8Array(r.buffer):s===`ArrayBuffer`&&(e=new Uint8Array(r)),i([s,[...e]],r)}let e=[],t=i([o,e],r);for(let t of r)e.push(a(t));return t}case 2:{if(s)switch(s){case`BigInt`:return i([s,r.toString()],r);case`Boolean`:case`Number`:case`String`:return i([s,r.valueOf()],r)}if(t&&`toJSON`in r)return a(r.toJSON());let n=[],c=i([o,n],r);for(let t of NS(r))(e||!FS(PS(r[t])))&&n.push([a(t),a(r[t])]);return c}case 3:return i([o,r.toISOString()],r);case 4:{let{source:e,flags:t}=r;return i([o,{source:e,flags:t}],r)}case 5:{let t=[],n=i([o,t],r);for(let[n,i]of r)(e||!(FS(PS(n))||FS(PS(i))))&&t.push([a(n),a(i)]);return n}case 6:{let t=[],n=i([o,t],r);for(let n of r)(e||!FS(PS(n)))&&t.push(a(n));return n}}let{message:c}=r;return i([o,{name:s,message:c}],r)};return a}function LS(e,t={}){let n=[];return IS(!(t.json||t.lossy),!!t.json,new Map,n)(e),n}var{parse:RS,stringify:zS}=JSON,BS={json:!0,lossy:!0};function VS(e){return AS(RS(e))}function HS(e){return zS(LS(e,BS))}function US(e){return AS(e)}function WS(e){return HS(e)}function GS(e){return VS(e)}var KS=256,qS=class extends Error{name=`StreamClosedError`};function JS(e={}){let t=e.id??qb(),n=Math.max(0,e.replayWindow??0),r=Gb(),i=new AbortController,a=[],o=!1,s=0;function c(e){if(o)throw new qS(`Cannot write to a closed stream "${t}"`);s+=1,n>0&&(a.push({seq:s,chunk:e}),a.length>n&&(a.length-n===1?a.shift():a.splice(0,a.length-n))),r.emit(`chunk`,s,e)}function l(e){if(o)return;o=!0;let t=XS(e);i.abort(e),r.emit(`end`,t)}function u(){o||(o=!0,i.signal.aborted||i.abort(`stream closed`),r.emit(`end`,void 0))}function d(e){o||i.signal.aborted||i.abort(e??`aborted`)}let f=new WritableStream({write(e){c(e)},close(){u()},abort(e){l(e)}});return{id:t,signal:i.signal,get closed(){return o},get lastSeq(){return s},write:c,error:l,close:u,abort:d,writable:f,events:r,buffer:a}}function YS(e={}){let t=e.id??qb(),n=Math.max(1,e.highWaterMark??KS),r=[],i=0,a=!1,o=!1,s,c,l,u;function d(){if(c){if(r.length>0){let e=r.shift(),t=c;c=void 0,t.resolve({value:e,done:!1});return}if(a){let e=c;if(c=void 0,s){let t=Error(s.message);t.name=s.name,e.reject(t)}else e.resolve({value:void 0,done:!0})}}}function f(){if(l){for(;r.length>0;){let e=r.shift();try{l.enqueue(e)}catch{break}}if(a&&l){try{if(s){let e=Error(s.message);e.name=s.name,l.error(e)}else l.close()}catch{}l=void 0}}}function p(t,s){if(!(a||o)&&!(t<=i)){if(i=t,r.push(s),r.length>n){let t=r.length-n;r.splice(0,t),e.onOverflow?.(t)}d(),u&&f()}}function m(e){a||(a=!0,s=e,d(),u&&f())}function h(){o||a||(o=!0,e.onCancel?.(),m(void 0))}function g(){return u||(u=new ReadableStream({start(e){l=e,f()},cancel(){h()}}),u)}return{id:t,get cancelled(){return o},get done(){return a},get lastSeenSeq(){return i},get readable(){return g()},cancel:h,_push:p,_end:m,[Symbol.asyncIterator](){return{next(){if(r.length>0)return Promise.resolve({value:r.shift(),done:!1});if(a){if(s){let e=Error(s.message);return e.name=s.name,Promise.reject(e)}return Promise.resolve({value:void 0,done:!0})}return new Promise((e,t)=>{c={resolve:e,reject:t}})},return(){return h(),Promise.resolve({value:void 0,done:!0})}}}}}function XS(e){if(e instanceof Error)return{name:e.name||`Error`,message:e.message};if(typeof e==`string`)return{name:`Error`,message:e};try{return{name:`Error`,message:JSON.stringify(e)}}catch{return{name:`Error`,message:String(e)}}}var ZS=128;function QS(e){return e.replace(/[^\w-]+/g,`_`).slice(0,ZS)}var $S=`modulepreload`,eC=function(e){return`/_devtools/`+e},tC={},nC=function(e){return e.pathname.endsWith(`.css`)},rC=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e,i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?new URL(import.meta.resolve(e)):new URL(e,import.meta.url)}r=o(t.map(t=>{t=eC(t,n);let r=s(t);if(r.href in tC)return;tC[r.href]=!0;let i=nC(r);if(e===void 0){e={all:new Set,styles:new Set};let t=document.getElementsByTagName(`link`);for(let n=t.length-1;n>=0;n--){let r=t[n];e.all.add(r.href),r.rel===`stylesheet`&&e.styles.add(r.href)}}if((i?e.styles:e.all).has(r.href))return;let o=document.createElement(`link`);if(o.rel=i?`stylesheet`:$S,i||(o.as=`script`),o.crossOrigin=``,o.href=r.href,a&&o.setAttribute(`nonce`,a),document.head.appendChild(o),i)return new Promise((e,t)=>{o.addEventListener(`load`,e),o.addEventListener(`error`,()=>t(Error(`Unable to preload CSS for ${r}`)))})}).filter(e=>e!==void 0))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},iC=`__connection.json`,aC=`__DEVFRAME_CONNECTION__`,oC=`x-birpc-session`,sC=`__rpc-dump/index.json`,cC=`devframe:services`,lC=`devframe_otp`,uC=`devframe_auth_token`;db.postMessage.remoteAssetsError;var dC=class{cacheMap=new Map;options;keySerializer;constructor(e){this.options=e,this.keySerializer=e.keySerializer||(e=>Wb(e))}updateOptions(e){this.options={...this.options,...e}}cached(e,t){let n=this.cacheMap.get(e);if(n)return n.get(this.keySerializer(t))}has(e,t){return this.cacheMap.get(e)?.has(this.keySerializer(t))??!1}apply(e,t){let n=this.cacheMap.get(e.m)||new Map;n.set(this.keySerializer(e.a),t),this.cacheMap.set(e.m,n)}validate(e){return this.options.functions.includes(e)}clear(e){e?this.cacheMap.delete(e):this.cacheMap.clear()}},fC=mb({docsBase:`https://devfra.me/errors`,codes:{DF0019:{why:e=>`RPC function "${e.name}" has \`agent\` set but \`jsonSerializable\` is \`false\`; MCP requires JSON-serializable data.`,fix:"Remove `jsonSerializable: false`, or remove `agent` to keep it RPC-only."},DF0020:{why:e=>`RPC function "${e.name}" declares \`jsonSerializable: true\` but the value at "${e.path}" is a ${e.type}.`,fix:"Either drop `jsonSerializable: true` (falls back to structured-clone) or change the value to a JSON-safe shape."},DF0021:{why:e=>`RPC function "${e.name}" is already registered`,fix:"Use the `force` parameter to overwrite an existing registration."},DF0022:{why:e=>`RPC function "${e.name}" is not registered. Use register() to add new functions.`},DF0023:{why:e=>`RPC function "${e.name}" is not registered`},DF0024:{why:e=>`Either handler or setup function must be provided for RPC function "${e.name}"`},DF0025:{why:e=>`Function "${e.name}" not found in dump store`},DF0026:{why:e=>`No dump match for "${e.name}" with args: ${e.args}`},DF0027:{why:e=>`Function "${e.name}" with type "${e.type}" cannot have dump configuration. Only "static" and "query" types support dumps.`},DF0028:{why:e=>`Function "${e.name}" with type "${e.type}" cannot use \`snapshot: true\`. Only "query" functions support this sugar; "static" functions have equivalent default behavior already.`,fix:"Remove `snapshot: true`, or change the function type to `query`."},DF0043:{why:e=>`RPC function "${e.name}" received an invalid argument at position ${e.index}: ${e.issues}`,fix:"Pass a value that satisfies the `args` schema declared for this function."},DF0044:{why:e=>`RPC function "${e.name}" returned a value that failed its \`returns\` schema: ${e.issues}`,fix:"Make the handler return a value that satisfies the `returns` schema, or relax the schema."}}});function pC(e){if(e.agent&&e.jsonSerializable===!1)throw fC.DF0019({name:e.name});e.agent&&!e.jsonSerializable&&(e.jsonSerializable=!0)}async function mC(e,t){let n=e[`~standard`].validate(t);return n instanceof Promise?await n:n}function hC(e){return e.map(e=>{let t=e.path?.map(e=>typeof e==`object`?e.key:e).join(`.`);return t?`${t}: ${e.message}`:e.message}).join(`; `)}async function gC(e,t,n){let r=n.slice();if(!t||t.length===0)return r;for(let r=0;r<t.length;r++){let i=t[r];if(!i)continue;let a=await mC(i,n[r]);if(a.issues)throw fC.DF0043({name:e,index:r,issues:hC(a.issues)})}return r}async function _C(e,t,n){if(!t)return n;let r=await mC(t,n);if(r.issues)throw fC.DF0044({name:e,issues:hC(r.issues)});return n}async function vC(e,t){if(!e.setup)return{};if(typeof t==`object`&&t){e.__cache??=new WeakMap;let n=e.__cache,r=n.get(t);return r||(r=Promise.resolve(e.setup(t)),r.catch(()=>{n.get(t)===r&&n.delete(t)}),n.set(t,r)),await r}if(!e.__promise){let n=Promise.resolve(e.setup(t));n.catch(()=>{e.__promise===n&&(e.__promise=void 0)}),e.__promise=n}return await e.__promise}async function yC(e,t){let n=e.handler;if(!n){let r=await vC(e,t);if(!r.handler)throw fC.DF0024({name:e.name});n=r.handler}let r=e.args,i=e.returns;if(!r&&!i)return n;let a=n;return async(...t)=>{let n=await gC(e.name,r,t),o=await a(...n);return await _C(e.name,i,o)}}var bC=class{context;definitions=new Map;functions;_onChanged=[];constructor(e){this.context=e;let t=this.definitions,n=this;this.functions=new Proxy({},{get(e,r){let i=t.get(r);if(i)return yC(i,n.context)},has(e,n){return t.has(n)},getOwnPropertyDescriptor(e,n){return{value:t.get(n)?.handler,configurable:!0,enumerable:!0}},ownKeys(){return Array.from(t.keys())}})}register(e,t=!1){if(this.definitions.has(e.name)&&!t)throw fC.DF0021({name:e.name});pC(e),this.definitions.set(e.name,e),this._onChanged.forEach(t=>t(e.name))}update(e,t=!1){if(!this.definitions.has(e.name)&&!t)throw fC.DF0022({name:e.name});pC(e),this.definitions.set(e.name,e),this._onChanged.forEach(t=>t(e.name))}onChanged(e){return this._onChanged.push(e),()=>{let t=this._onChanged.indexOf(e);t!==-1&&this._onChanged.splice(t,1)}}async getHandler(e){return await yC(this.definitions.get(e),this.context)}getSchema(e){let t=this.definitions.get(e);if(!t)throw fC.DF0023({name:String(e)});return{args:t.args,returns:t.returns}}has(e){return this.definitions.has(e)}get(e){return this.definitions.get(e)}list(){return Array.from(this.definitions.keys())}};function xC(e,t=``){return JSON.stringify(e,function(e,n){let r=this,i=r==null?n:r[e];if(i===void 0){if(Array.isArray(r))throw CC(t,`undefined`,r,e);return n}return i!==null&&SC(i,r,e,t),n})}function SC(e,t,n,r){if(typeof e==`bigint`)throw CC(r,`BigInt`,t,n);if(typeof e!=`object`)return;if(e instanceof Map)throw CC(r,`Map`,t,n);if(e instanceof Set)throw CC(r,`Set`,t,n);if(e instanceof Date)throw CC(r,`Date`,t,n);if(Array.isArray(e))return;let i=Object.getPrototypeOf(e);if(i!==null&&i!==Object.prototype)throw CC(r,e.constructor?.name??`class instance`,t,n)}function CC(e,t,n,r){let i=wC(n,r);return fC.DF0020({name:e||`<anonymous>`,type:t,path:i})}function wC(e,t){return Array.isArray(e)?`[${t}]`:t===``?`<root>`:t}var TC=`__DEVFRAME_CONNECTION_META__`,EC=`__DEVFRAME_CONNECTION_AUTH_TOKEN__`;function DC(e){let t=[()=>window?.[e],()=>globalThis?.[e],()=>parent.window?.[e]];for(let e of t)try{let t=e();if(t)return t}catch{}}function OC(){return DC(aC)}function kC(){return DC(TC)}function AC(e){if(e)return e;try{let e=localStorage.getItem(EC);if(e)return e}catch{}return DC(EC)}function jC(e){globalThis[aC]=e,globalThis[TC]={...e.connectionMeta,baseUrl:e.metaBaseUrl},e.authToken&&MC(e.authToken)}function MC(e){try{localStorage.setItem(EC,e)}catch{}globalThis[EC]=e;let t=OC();t&&(globalThis[aC]={...t,authToken:e})}function NC(e){let t=tb(iC,e);try{return new URL(t,globalThis.location?.href).href}catch{return t}}function PC(e,t){return t&&t!==e.authToken?{...e,authToken:t}:e}function FC(){let e=OC();if(e)return PC(e,AC()??e.authToken??e.connectionMeta.authToken);let t=kC();if(t)return{connectionMeta:t,metaBaseUrl:t.baseUrl??NC(`./`),authToken:AC(t.authToken)}}async function IC(e={}){if(e.connection){let t=PC(e.connection,AC(e.authToken??e.connection.authToken??e.connection.connectionMeta.authToken));return jC(t),t}let t=Array.isArray(e.baseURL)?e.baseURL:[e.baseURL??`./`];if(e.connectionMeta){let n={connectionMeta:e.connectionMeta,metaBaseUrl:NC(t[0]??`./`),authToken:AC(e.authToken??e.connectionMeta.authToken)};return jC(n),n}let n=FC();if(n){let t=PC(n,AC(e.authToken??n.authToken??n.connectionMeta.authToken));return jC(t),t}let r=[];for(let n of t){let t=tb(iC,n),i=NC(n);try{let n=await fetch(t);if(!n.ok)throw Error(`Failed to fetch connection meta from ${i}: ${n.status}`);let r=await n.json(),a=n.url||i,o={connectionMeta:r,metaBaseUrl:r.baseUrl?new URL(r.baseUrl,a).href:a,authToken:AC(e.authToken??r.authToken)};return jC(o),o}catch(e){r.push(e)}}throw Error(`Failed to get connection meta from ${t.join(`, `)}`,{cause:r})}var LC=class extends Error{name=`DevframeConnectionError`;kind;constructor(e,t,n){super(t,n),this.kind=e}};function RC(e=lC){try{let t=globalThis.location?.hash?.replace(/^#/,``)??``;return new URLSearchParams(t).get(e)||void 0}catch{return}}function zC(e){try{let t=new URL(globalThis.location.href),n=new URLSearchParams(t.hash.replace(/^#/,``));if(!n.has(e))return;n.delete(e),t.hash=n.toString(),globalThis.history?.replaceState(globalThis.history.state,``,t.href)}catch{}}function BC(e=lC){let t=RC(e);return t&&zC(e),t}async function VC(e,t={}){let n=BC(t.param??`devframe_otp`);return n?e.isTrusted?!0:e.requestTrustWithCode(n):!1}function HC(e){let t={},n=new WeakMap,r,i=()=>(r??=e.sharedState.get(cC,{initialValue:{}}).then(e=>(t=e.value(),e.on(`updated`,e=>{t=e}),e)),r);return i(),{state:i,has:e=>e in t,keys:()=>Object.keys(t),get:r=>{let i=t[r];if(!i)return;let a=n.get(i);return a||(a={...i,rpc:e.scope(i.scope).rpc},n.set(i,a)),a}}}function UC(e){let t=new Map,n=new Map,r=new Map,i=new Set,a=e.connectionMeta.backend===`static`;function o(e,t){let n=r.get(e);return n&&typeof n==`object`&&!Array.isArray(n)&&typeof t==`object`&&!Array.isArray(t)?{...n,...t}:t}e.client.register({name:db.broadcast.clientStateUpdated,type:`event`,handler:(e,n,r)=>{let i=t.get(e);i&&!i.syncIds.has(r)&&i.mutate(()=>o(e,n),r)}}),e.client.register({name:db.broadcast.clientStatePatch,type:`event`,handler:(e,n,r)=>{let i=t.get(e);i&&!i.syncIds.has(r)&&i.patch(n,r)}});function s(t,n){let r=[];return r.push(n.on(`updated`,(n,r,i)=>{a||(r?e.callEvent(`devframe:rpc:server-state:patch`,t,r,i):e.callEvent(`devframe:rpc:server-state:set`,t,n,i))})),()=>{for(let e of r)e()}}return{keys:()=>Array.from(t.keys()),onKeyAdded(e){return i.add(e),()=>{i.delete(e)}},delete(e){let i=n.get(e);n.delete(e);let a=t.delete(e);return r.delete(e),i?.(),a},get:async(c,l)=>{if(l?.initialValue!==void 0&&r.set(c,l.initialValue),t.has(c))return t.get(c);let u=TS({initialValue:l?.initialValue,enablePatches:!1});async function d(){if(a||e.callEvent(`devframe:rpc:server-state:subscribe`,c),l?.initialValue!==void 0){t.set(c,u);for(let e of i)e(c);return e.call(`devframe:rpc:server-state:get`,c).then(e=>{e!==void 0&&u.mutate(()=>o(c,e))}).catch(e=>{console.error(`Error getting server state`,e)}),n.set(c,s(c,u)),u}{let r=await e.call(`devframe:rpc:server-state:get`,c);u.mutate(()=>o(c,r)),t.set(c,u);for(let e of i)e(c);return n.set(c,s(c,u)),u}}return new Promise(t=>{if(e.isTrusted)d().then(t);else{t(u);let n=!1;e.events.on(db.client.isTrustedUpdated,e=>{e&&!n&&(n=!0,d())})}})}}}var WC=new Map;function GC(e=WC){let t=new Map;return{serialize:n=>{let r;return n.t===`q`?r=n.m:(r=t.get(n.i),t.delete(n.i)),!(n.t===`s`&&`e`in n)&&r&&e.get(r)?.jsonSerializable===!0?xC(n,r??``):`s:${WS(n)}`},deserialize:e=>{let n=e.startsWith(`s:`)?GS(e.slice(2)):JSON.parse(e);return n.t===`q`&&n.i&&n.m&&t.set(n.i,n.m),n}}}function KC(){}function qC(e){let t=e.search(/\n\n|\r\n\r\n/);if(!(t<0))return{frame:e.slice(0,t),rest:e.slice(t+(e[t]===`\r`?4:2))}}function JC(e){let t=`message`,n=[];for(let r of e.split(/\r?\n/))r.startsWith(`:`)||(r.startsWith(`event:`)?t=r.slice(6).trimStart():r.startsWith(`data:`)&&n.push(r.slice(5).replace(/^ /,``)));return{event:t,data:n}}function YC(e){let{onConnected:t=KC,onError:n=KC,onDisconnected:r=KC,definitions:i,fetch:a=globalThis.fetch.bind(globalThis)}=e,o=e.url;e.authToken&&(o=`${o}${o.includes(`?`)?`&`:`?`}${uC}=${encodeURIComponent(e.authToken)}`);let s=GC(i),c=new AbortController,l=!1,u,d,f,p,m=new Promise((e,t)=>{f=e,p=t});m.catch(()=>{});function h(e){l||(l=!0,p(e),n(e),r())}function g(){l||(l=!0,p(Error(`Devframe SSE stream closed`)),r())}function _(e,n){if(e===`session`){f(n),t();return}u?.(n)}async function v(e){let t=e.getReader();d=t;let n=new TextDecoder,r=``;for(;;){let{done:e,value:i}=await t.read();if(e)break;for(r+=n.decode(i,{stream:!0});;){let e=qC(r);if(!e)break;r=e.rest;let{event:t,data:n}=JC(e.frame);n.length>0&&_(t,n.join(`
28
- `))}}g()}return(async()=>{try{let e=await a(o,{headers:{accept:`text/event-stream`},signal:c.signal});if(!e.ok||!e.body)throw Error(`Devframe SSE stream request failed: ${e.status}`);await v(e.body)}catch(e){if(c.signal.aborted){g();return}h(e instanceof Error?e:Error(String(e)))}})(),{close:()=>{l=!0,c.abort(),d?.cancel().catch(()=>{})},on:e=>{u=e},post:async e=>{let t;try{t=await m}catch{return}if(l){n(Error(`Devframe SSE channel is closed; message dropped`));return}try{let n=await a(o,{method:`POST`,headers:{"content-type":`text/plain; charset=utf-8`,[oC]:t},body:e});if(n.status===200){let e=await n.text();e&&u?.(e);return}if(!n.ok)throw Error(`Devframe SSE POST failed: ${n.status}`)}catch(e){n(e instanceof Error?e:Error(String(e)))}},serialize:s.serialize,deserialize:s.deserialize}}function XC(e,t){let{channel:n,rpcOptions:r={}}=t;return wb(e,{...n,timeout:-1,...r,proxify:!1})}function ZC(e){let{transport:t,authToken:n,connectionMeta:r,events:i,clientRpc:a,rpcOptions:o={},callTimeout:s=0}=e,c=!1,l=`connecting`,u=null,d=Promise.withResolvers();function f(e,t=null){if(t?u=t:e===`connected`&&(u=null),e===l)return;let n=l;l=e,i.emit(db.client.connectionStatus,e,n)}let p=new Set;function m(e){for(let t of[...p])t.reject(e)}function h(){return l===`disconnected`||l===`error`?new LC(`connection`,`[devframe] Not connected to the devframe server`,{cause:u??void 0}):l===`unauthorized`?new LC(`auth`,`[devframe] Not authorized by the devframe server`,{cause:u??void 0}):null}function g(e,t){return new Promise((n,r)=>{let a=!1,o,c={reject(e){a||(l(),i.emit(db.client.error,e,t),r(e))}};function l(){a=!0,p.delete(c),o&&clearTimeout(o)}p.add(c),s>0&&(o=setTimeout(()=>{c.reject(new LC(`timeout`,`[devframe] RPC call "${t}" timed out after ${s}ms`))},s)),e.then(e=>{a||(l(),n(e))},e=>{if(a)return;l();let n=e instanceof Error?e:Error(String(e));i.emit(db.client.error,n,t),r(n)})})}let _=new Map;for(let e of r.jsonSerializableMethods??[])_.set(e,{jsonSerializable:!0});let v=e.createChannel({definitions:_,onError(e){f(`error`,e),i.emit(db.client.connectionError,e),m(new LC(`connection`,`[devframe] Connection to the devframe server failed`,{cause:e}))},onDisconnected(){l!==`error`&&f(`disconnected`),m(new LC(`connection`,`[devframe] Disconnected from the devframe server`,{cause:u??void 0}))}}),y=XC(a.functions,{channel:v,rpcOptions:o});a.register({name:db.broadcast.authRevoked,type:`event`,handler:()=>{c=!1;let e=new LC(`auth`,`[devframe] The devframe server revoked this client's trust`);f(`unauthorized`,e),i.emit(db.client.connectionError,e),m(e),i.emit(db.client.isTrustedUpdated,!1)}});let b=n;async function x(e){b=e;let t=await y.$call(`anonymous:devframe:auth`,{authToken:e,ua:navigator.userAgent,origin:location.origin});if(c=t.isTrusted,c)d.resolve(!0),f(`connected`);else{let e=new LC(`auth`,`[devframe] The devframe server refused this client's credentials`);f(`unauthorized`,e),i.emit(db.client.connectionError,e)}return i.emit(db.client.isTrustedUpdated,c),t.isTrusted}async function S(e){let t=(await y.$call(`anonymous:devframe:auth:exchange`,{code:e,ua:navigator.userAgent,origin:location.origin}))?.authToken??null;return t&&(b=t,c=!0,d.resolve(!0),f(`connected`),i.emit(db.client.isTrustedUpdated,!0)),t}async function C(e={}){await y.$call(`anonymous:devframe:auth:request-code`,{ua:navigator.userAgent,origin:location.origin,...e.reissue?{reissue:!0}:{}})}async function w(){return c?!0:x(b??``)}async function ee(e=6e4){if(c&&d.resolve(!0),e<=0)return d.promise;let t;try{return await Promise.race([d.promise,new Promise((n,r)=>{t=setTimeout(()=>{r(Error(`[devframe] Timeout waiting for rpc to be trusted`))},e)})]),c}finally{clearTimeout(t)}}return{transport:t,get isTrusted(){return c},get status(){return l},get connectionError(){return u},requestTrust:w,requestTrustWithToken:x,requestTrustWithCode:S,requestAuthCode:C,ensureTrusted:ee,call:(...e)=>{let t=String(e[0]),n=h();return n?(i.emit(db.client.error,n,t),Promise.reject(n)):g(y.$call(...e),t)},callEvent:(...e)=>{let t=h();if(t){i.emit(db.client.error,t,String(e[0]));return}return y.$callEvent(...e)},callOptional:(...e)=>{let t=String(e[0]),n=h();return n?(i.emit(db.client.error,n,t),Promise.reject(n)):g(y.$callOptional(...e),t)},close:()=>{v.close()}}}function QC(e,t,n){let r=(()=>{try{return new URL(t,n.href)}catch{return new URL(n.href)}})();if(e&&typeof e==`object`){if(e.host!=null||e.port!=null){let t=e.host??`${r.hostname}:${e.port}`;return new URL(e.path??`/`,`${r.protocol}//${t}`).href}return new URL(e.path??``,r).href}let i=e??``;return/^https?:\/\//i.test(i)?i:new URL(i,r).href}function $C(e){let{authToken:t,connectionMeta:n,metaBaseUrl:r,events:i,clientRpc:a,rpcOptions:o={},sseOptions:s={},callTimeout:c=0}=e,l=QC(n.sse,r??`./`,location);return ZC({transport:`sse`,authToken:t,connectionMeta:n,events:i,clientRpc:a,rpcOptions:o,callTimeout:c,createChannel:e=>YC({url:l,authToken:t,definitions:e.definitions,...s,onConnected(){s.onConnected?.()},onError(t){e.onError(t),s.onError?.(t)},onDisconnected(){e.onDisconnected(),s.onDisconnected?.()}})})}function ew(e){let{name:t,message:n,cause:r,...i}=e,a=r instanceof Error?r:tw(r)?ew(r):r,o=a===void 0?Error(n):Error(n,{cause:a});return o.name=t,Object.assign(o,i),o}function tw(e){return typeof e==`object`&&!!e&&typeof e.message==`string`&&typeof e.name==`string`}function nw(e){return typeof e==`object`&&!!e&&e.type===`static`&&typeof e.path==`string`}function rw(e){return typeof e==`object`&&!!e&&e.type===`query`&&typeof e.records==`object`&&e.records!==null}function iw(e){return typeof e==`object`&&!!e&&(`output`in e||`error`in e)}function aw(e){if(e.error)throw ew(e.error);return e.output}function ow(e){return e.some(e=>e!=null)}function sw(e){return typeof e==`object`&&e&&`serialization`in e&&`data`in e?e.data:e}function cw(e,t){let n=new Map,r=new Map;function i(e,t){return t===`structured-clone`&&Array.isArray(e)?US(e):e}function a(e,t){return i(sw(e),t)}async function o(e){n.has(e.path)||n.set(e.path,t(e.path).then(t=>a(t,e.serialization)));let r=await n.get(e.path);return iw(r)?aw(r):r}async function s(e,n){return r.has(e)||r.set(e,t(e).then(e=>a(e,n))),await r.get(e)}async function c(t,n){if(!(t in e))throw Error(`[devframe-rpc] Function "${t}" not found in dump store`);let r=e[t];if(nw(r)){if(ow(n))throw Error(`[devframe-rpc] No dump match for "${t}" with args: ${JSON.stringify(n)}`);return await o(r)}if(rw(r)){let e=Wb(n),i=r.records[e];if(i)return aw(await s(i,r.serialization));if(r.fallback)return aw(await s(r.fallback,r.serialization));throw Error(`[devframe-rpc] No dump match for "${t}" with args: ${JSON.stringify(n)}`)}if(!ow(n))return r;throw Error(`[devframe-rpc] No dump match for "${t}" with args: ${JSON.stringify(n)}`)}return{call:async(e,t)=>await c(e,t),callOptional:async(t,n)=>{if(t in e)return await c(t,n)},callEvent:async(e,t)=>{}}}async function lw(e){let t=cw(await e.fetchJsonFromBases(sC),e.fetchJsonFromBases);return{transport:`static`,isTrusted:!0,status:`connected`,connectionError:null,requestTrust:async()=>!0,requestTrustWithToken:async()=>!0,requestTrustWithCode:async()=>null,requestAuthCode:async()=>{},ensureTrusted:async()=>!0,call:(...e)=>t.call(e[0],e.slice(1)),callEvent:(...e)=>t.callEvent(e[0],e.slice(1)),callOptional:(...e)=>t.callOptional(e[0],e.slice(1)),close:()=>{}}}var uw=``;function dw(e,t){return`${e}${uw}${t}`}function fw(e){let t=new Map,n=new Map;e.client.register({name:db.broadcast.streamingChunk,type:`event`,handler(e,n,r,i){t.get(dw(e,n))?._push(r,i)}}),e.client.register({name:db.broadcast.streamingEnd,type:`event`,handler(e,n,r){let i=dw(e,n),a=t.get(i);a&&(a._end(r),t.delete(i))}}),e.client.register({name:db.broadcast.streamingUploadCancel,type:`event`,handler(e,t){let r=dw(e,t),i=n.get(r);i&&(i.abort(`server cancelled upload`),n.delete(r))}}),e.events.on(db.client.isTrustedUpdated,n=>{if(n)for(let[n,r]of t){if(r.cancelled||r.done)continue;let t=n.indexOf(uw);if(t<0)continue;let i=n.slice(0,t),a=n.slice(t+1);e.callEvent(`devframe:streaming:subscribe`,i,a,{afterSeq:r.lastSeenSeq})}});function r(n,r,i={}){let a=dw(n,r),o=t.get(a);if(o)return o;let s=YS({id:r,highWaterMark:i.highWaterMark,onOverflow(e){console.warn(`[devframe] DF0029: Stream "${n}#${r}" dropped ${e} chunk(s) after exceeding the client high-water mark.`)},onCancel(){e.callEvent(`devframe:streaming:cancel`,n,r),t.delete(a)}});if(t.set(a,s),e.isTrusted)e.callEvent(`devframe:streaming:subscribe`,n,r,{afterSeq:0});else{let i=e.events.on(db.client.isTrustedUpdated,o=>{o&&(i(),t.has(a)&&!s.cancelled&&!s.done&&e.callEvent(`devframe:streaming:subscribe`,n,r,{afterSeq:s.lastSeenSeq}))})}return s}function i(t,r){let i=dw(t,r),a=n.get(i);if(a)return a;let o=JS({id:r});return o.events.on(`chunk`,(n,i)=>{e.callEvent(`devframe:streaming:upload-chunk`,t,r,n,i)}),o.events.on(`end`,a=>{e.callEvent(`devframe:streaming:upload-end`,t,r,a),n.delete(i)}),n.set(i,o),o}return{subscribe:r,upload:i}}function pw(){}var mw=new Map;function hw(e){let t=e.url;e.authToken&&(t=`${t}?${uC}=${encodeURIComponent(e.authToken)}`);let n=new WebSocket(t),{onConnected:r=pw,onError:i=pw,onDisconnected:a=pw,definitions:o=mw}=e;n.addEventListener(`open`,e=>{r(e)}),n.addEventListener(`error`,e=>{let t=e instanceof Error?e:Error(e.type);i(t)}),n.addEventListener(`close`,e=>{a(e)});let s=GC(o);return{close:()=>{n.close()},on:e=>{n.addEventListener(`message`,t=>{e(t.data)})},post:e=>{if(n.readyState===WebSocket.OPEN){n.send(e);return}if(n.readyState===WebSocket.CONNECTING){let t=()=>{i(),n.readyState===WebSocket.OPEN&&n.send(e)},r=()=>i();function i(){n.removeEventListener(`open`,t),n.removeEventListener(`close`,r)}n.addEventListener(`open`,t),n.addEventListener(`close`,r);return}i(Error(`Devframe WebSocket is not open; message dropped`))},serialize:s.serialize,deserialize:s.deserialize}}function gw(e,t,n){let r=(()=>{try{return new URL(t,n.href)}catch{return new URL(n.href)}})(),i=r.protocol===`https:`?`wss:`:`ws:`;if(e&&typeof e==`object`){if(e.host!=null||e.port!=null){let t=e.host??`${r.hostname}:${e.port}`,n=new URL(e.path??`/`,`${i}//${t}`);return n.protocol=i,n.href}let t=new URL(e.path??``,r);return t.protocol=i,t.href}if(typeof e==`number`)return`${i}//${r.hostname}:${e}`;let a=e??``;if(/^wss?:\/\//i.test(a))return a;if(/^https?:\/\//i.test(a))return nb(a,/^https/i.test(a)?`wss://`:`ws://`);let o=new URL(a,r);return o.protocol=i,o.href}function _w(e){let{authToken:t,connectionMeta:n,metaBaseUrl:r,events:i,clientRpc:a,rpcOptions:o={},wsOptions:s={},callTimeout:c=0}=e,l=gw(n.websocket,r??`./`,location);return ZC({transport:`websocket`,authToken:t,connectionMeta:n,events:i,clientRpc:a,rpcOptions:o,callTimeout:c,createChannel:e=>hw({url:l,authToken:t,definitions:e.definitions,...s,onConnected(e){s.onConnected?.(e)},onError(t){e.onError(t),s.onError?.(t)},onDisconnected(t){e.onDisconnected(),s.onDisconnected?.(t)}})})}function vw(e){return e.includes(`:`)}function yw(e,t){return vw(t)?t:`${e}:${t}`}function bw(e){return{async get(t){return(await e()).value()[t]},async set(t,n){(await e()).mutate(e=>{e[t]=n})},async delete(t){(await e()).mutate(e=>{delete e[t]})},async all(){return(await e()).value()},async onChange(t){return(await e()).on(`updated`,e=>t(e))}}}function xw(e,t,n){let r=`devframe:settings:${n}:${t}`,i;function a(){return i||=e.sharedState.get(r,{initialValue:{}}),i}return bw(a)}function Sw(e,t){return{global:xw(e,t,`global`),project:xw(e,t,`project`)}}function Cw(e,t){return{namespace:t,base:e,rpc:{namespace:t,register(n){if(vw(n.name))throw Error(`[devframe] Scoped client RPC registration for namespace "${t}" received an already-namespaced function name "${n.name}". Pass a bare name without a ":" separator.`);e.client.register({...n,name:`${t}:${n.name}`})},call:((n,...r)=>e.call(yw(t,n),...r)),callEvent:((n,...r)=>e.callEvent(yw(t,n),...r)),callOptional:((n,...r)=>e.callOptional(yw(t,n),...r)),sharedState:((n,r)=>e.sharedState.get(yw(t,n),r)),streaming:{subscribe:(n,r,i)=>e.streaming.subscribe(yw(t,n),r,i),upload:(n,r)=>e.streaming.upload(yw(t,n),r)}},settings:Sw(e,t),scope:e.scope}}function ww(){if(typeof document<`u`){let e=document.modelContext;if(e)return e}if(typeof navigator<`u`){let e=navigator.modelContext;if(e)return e}}function Tw(e,t={}){let n=t.modelContext??ww();if(!n)return()=>{};let r=n,i=new Map,a=new Map;function o(t,n){let o=QS(t.name),s=a.get(o);if(s&&s!==t.name){console.warn(`[devframe] WebMCP tool name "${o}" (from "${t.name}") collides with "${s}"; keeping the first registration.`);return}let c=new AbortController,l=Tb(t.type,n),u=r.registerTool({name:o,description:n.description,inputSchema:Ob(t.args),annotations:{title:n.title??t.name,readOnlyHint:l===`read`,destructiveHint:l===`destructive`},execute:n=>Ew(t,e.context,n)},{signal:c.signal});u&&`then`in u&&u.then(()=>{},()=>{}),a.set(o,t.name),i.set(t.name,()=>{c.abort(),u&&`unregister`in u&&typeof u.unregister==`function`&&u.unregister(),a.delete(o)})}function s(t){let n=t?[t]:[...e.definitions.keys()];for(let t of n){i.get(t)?.(),i.delete(t);let n=e.definitions.get(t),r=n?.agent;n&&r&&o(n,r)}}s();let c=e.onChanged(e=>s(e));return()=>{c();for(let e of i.values())e();i.clear()}}async function Ew(e,t,n){try{let r=Ab(n,e.args?.length);return{content:[{type:`text`,text:Dw(await(await yC(e,t))(...r))}]}}catch(e){return{isError:!0,content:[{type:`text`,text:Ow(e)}]}}}function Dw(e){return e===void 0?`undefined`:typeof e==`string`?e:JSON.stringify(e,null,2)}function Ow(e){if(!(e instanceof Error))return String(e);let t=e.cause instanceof Error?` (cause: ${e.cause.message})`:``;return`${e.name}: ${e.message}${t}`}function kw(e,t){if(t.backend===`static`)return`static`;let n=t.websocket!==void 0,r=t.sse!==void 0;if(e===`websocket`){if(!n)throw Error(`[devframe] transport: 'websocket' was requested, but this server does not advertise a WebSocket endpoint`);return`websocket`}if(e===`sse`){if(!r)throw Error(`[devframe] transport: 'sse' was requested, but this server does not advertise an SSE endpoint`);return`sse`}if(t.backend===`sse`&&r)return`sse`;if(n)return`websocket`;if(r)return`sse`;throw Error(`[devframe] This server advertises no RPC transport (backend "none"), so there is nothing to connect to. Enable the WebSocket or SSE endpoint on the server, or use its static/MCP surfaces instead.`)}async function Aw(e={}){let{baseURL:t=`./`,rpcOptions:n={},cacheOptions:r=!1}=e,i=Gb(),a=Array.isArray(t)?t:[t],o=await IC(e),{connectionMeta:s,metaBaseUrl:c,authToken:l}=o,u=a[0]??`./`;try{u=new URL(`.`,c).href}catch{}let d=new dC({functions:[],...typeof e.cacheOptions==`object`?e.cacheOptions:{}}),f={rpc:void 0},p=new bC(f),m=e.webmcp===!1?void 0:Tw(p),h,g=!1;async function _(e){let t=[u,...a.filter(e=>e!==u)].filter(e=>e!=null),n=[];for(let r of t)try{return await fetch(tb(e,r)).then(t=>{if(!t.ok)throw Error(`Failed to fetch ${e} from ${r}: ${t.status}`);return t.json()})}catch(e){n.push(e)}throw Error(`Failed to load ${e} from ${t.join(`, `)}`,{cause:n})}let v={authToken:l,connectionMeta:s,metaBaseUrl:c,events:i,clientRpc:p,callTimeout:e.callTimeout,rpcOptions:{...n,async onRequest(e,t,i){if(await n.onRequest?.call(this,e,t,i),r&&d?.validate(e.m)){if(d.has(e.m,e.a))return i(d.cached(e.m,e.a));let n=await t(e);d.apply(e,n)}else await t(e)}}},y=kw(e.transport??`auto`,s),b=y===`static`?await lw({fetchJsonFromBases:_}):y===`sse`?$C({...v,sseOptions:e.sseOptions}):_w({...v,wsOptions:e.wsOptions}),x;try{x=new BroadcastChannel(`devframe-auth`)}catch{}let S,C=!1;function w(e){return((...t)=>C||!S?e(...t):S.then(()=>e(...t)))}function ee(){g=!0;try{h?.(),m?.()}finally{try{x?.close()}finally{b.close?.()}}}let T={events:i,get isTrusted(){return b.isTrusted},get status(){return b.status},get connectionError(){return b.connectionError},get transport(){return b.transport??y},get connection(){return o},connectionMeta:s,ensureTrusted:b.ensureTrusted,requestTrust:b.requestTrust,requestTrustWithToken:async e=>(MC(e),o={...o,authToken:e},b.requestTrustWithToken(e)),requestTrustWithCode:async e=>{let t=await b.requestTrustWithCode(e);if(!t)return!1;MC(t),o={...o,authToken:t};try{x?.postMessage({type:`auth-update`,authToken:t})}catch{}return!0},requestAuthCode:e=>b.requestAuthCode(e),call:w(b.call),callEvent:w(b.callEvent),callOptional:w(b.callOptional),client:p,sharedState:void 0,services:void 0,streaming:void 0,cacheManager:d,scope:void 0,close:ee};T.sharedState=UC(T),T.streaming=fw(T),T.services=HC(T);let E=new Map;T.scope=(e=>{if(!e)return T;let t=E.get(e);return t||(t=Cw(T,e),E.set(e,t)),t}),f.rpc=T;function D(){try{return typeof window<`u`&&window.self===window.top}catch{return!1}}async function te(){if(e.simpleAuth!==!1&&D()&&typeof globalThis.prompt==`function`)for(await T.requestAuthCode().catch(()=>{});!T.isTrusted;){let e=globalThis.prompt(`devframe: enter the authentication code shown in your terminal`);if(e==null)return;let t=e.trim();if(t&&await T.requestTrustWithCode(t))return}}async function ne(){let t=await b.requestTrust(),n=e.otpParam??`devframe_otp`,r=n?await VC(T,{param:n}):!1;t||r||T.isTrusted||await te()}return S=ne().then(()=>{C=!0},()=>{C=!0}),s.mcp&&rC(async()=>{let{setupBrowserAgentRpcBridge:e}=await import(`./browser-agent-rpc-BXhoSh1z-y1ovomuM.js`);return{setupBrowserAgentRpcBridge:e}},[]).then(({setupBrowserAgentRpcBridge:e})=>{g||(h=e(T))}).catch(()=>{}),x&&(x.onmessage=e=>{e.data?.type===`auth-update`&&e.data.authToken&&T.requestTrustWithToken(e.data.authToken)}),T}function jw(e={}){return Aw({...e,simpleAuth:!1})}var Mw=`https://api.deepseek.com/v1`,Nw=`deepseek-chat`,Pw=null;function Fw(){if(!Pw){let e=new Promise((e,t)=>setTimeout(()=>t(Error(`DTK connection timeout — open this page via the Vite DevTools dock shell, not directly.`)),5e3));Pw=Promise.race([jw(),e])}return Pw}async function Iw(e,t,n){return e.call(t,...n)}function Lw(e){let t=Math.floor(e/1e3),n=Math.floor(t/60),r=Math.floor(n/60);return r>0?`${r}h ${n%60}m`:n>0?`${n}m ${t%60}s`:`${t}s`}function Rw(e){return new Date(e).toLocaleTimeString()}function zw(e){return e==null?`—`:typeof e==`boolean`?e?`true`:`false`:typeof e==`number`?String(e):typeof e==`string`?e:Array.isArray(e)?`[${e.length} items]`:typeof e==`object`?JSON.stringify(e):String(e)}function Bw(e){return e?e.split(`/`).pop()||e:``}function Vw(e){if(!e)return``;let t=e.split(`/`);return t.length<=5?e:`${t.slice(0,3).join(`/`)}/…/${t.slice(-2).join(`/`)}`}var Hw={GET:`bg-success/12 text-success`,POST:`bg-info/12 text-info`,PUT:`bg-warning/12 text-warning`,DELETE:`bg-destructive/12 text-destructive`,PATCH:`bg-purple-500/12 text-purple-400`};function Uw(e){return Hw[e]||`bg-secondary text-muted-foreground`}function Ww(e={}){let t=e.client??Fw;async function n(e,...n){return Iw(await t(),e,n)}let r=j(!0),i=j(null),a=j(null),o=j({}),s=j(0),c=null,l=null,u=!1,d=!1;function f(e,t){let n={duration:3e3,position:`top-right`};switch(e){case`success`:xg.success(t,n);break;case`error`:xg.error(t,n);break;case`warning`:xg.warning(t,n);break;default:xg(t,n)}}async function p(){if(!(u||d)){u=!0;try{let e=await(await t()).sharedState.get(`ubean:info`);a.value=e.value(),r.value=!1,l=e.on(`updated`,e=>{a.value=e}),o.value=await n(`ubean:get-env`),c=setInterval(()=>{a.value&&(s.value=Date.now()-a.value.startTime)},1e3)}catch(e){i.value=e instanceof Error?e.message:`Failed to connect`,r.value=!1}}}async function m(){try{o.value=await n(`ubean:get-env`),a.value||=await n(`ubean:get-info`)}catch{}}async function h(e,t,r){try{let i=await n(`ubean:crud:create`,{type:e,path:t,...r});return i.success?(f(`success`,`Created ${e}: ${t}`),await m()):i.errors?.length&&f(`error`,i.errors[0]),i}catch(e){let t=e instanceof Error?e.message:`Create failed`;return f(`error`,t),{success:!1,errors:[t]}}}async function g(e,t){try{return await n(`ubean:crud:read`,{type:e,path:t})}catch(e){return{success:!1,error:e instanceof Error?e.message:`Read failed`}}}async function _(e,t){try{let r=await n(`ubean:crud:update`,{type:e,...t});return r.success?(f(`success`,`Updated ${e}`),await m()):r.errors?.length&&f(`error`,r.errors[0]),r}catch(e){let t=e instanceof Error?e.message:`Update failed`;return f(`error`,t),{success:!1,errors:[t]}}}async function v(e,t){try{let r=await n(`ubean:crud:delete`,{type:e,...t});return r.success?(f(`success`,`Deleted ${e}`),await m()):r.errors?.length&&f(`error`,r.errors[0]),r}catch(e){let t=e instanceof Error?e.message:`Delete failed`;return f(`error`,t),{success:!1,errors:[t]}}}async function y(e){try{let t=await n(`ubean:crud:restore`,e);return t.success?(f(`success`,`Restored: ${e}`),await m()):t.errors?.length&&f(`error`,t.errors[0]),t}catch(e){let t=e instanceof Error?e.message:`Restore failed`;return f(`error`,t),{success:!1,errors:[t]}}}async function b(e,t){try{return await n(`ubean:ai:chat`,{messages:e,...t})}catch(e){return{message:{role:`assistant`,content:`Error: ${e instanceof Error?e.message:`AI request failed`}`,timestamp:Date.now()}}}}async function x(){try{return await n(`ubean:ai:tools`)}catch{return[]}}async function S(e,r,i){let a=`stream_${Date.now()}_${Math.random().toString(36).slice(2,8)}`;try{let o=(await(await t()).sharedState.get(`ubean:ai:stream`)).on(`updated`,e=>{e&&e.requestId===a&&i(e)});try{return await n(`ubean:ai:chat-stream`,{messages:e,requestId:a,...r})}finally{o()}}catch(e){return{message:{role:`assistant`,content:`Error: ${e instanceof Error?e.message:`AI stream failed`}`,timestamp:Date.now()}}}}async function C(e){try{return await n(`ubean:terminal:start`,e)}catch(e){return f(`error`,e instanceof Error?e.message:`Terminal start failed`),null}}async function w(e,t){try{return await n(`ubean:terminal:input`,{sessionId:e,data:t})}catch{return!1}}async function ee(e,t,r){try{return await n(`ubean:terminal:resize`,{sessionId:e,cols:t,rows:r})}catch{return!1}}async function T(e){try{return await n(`ubean:terminal:poll`,{sessionId:e})}catch{return{data:``,exited:!0,exitCode:-1}}}async function E(e){try{return await n(`ubean:terminal:kill`,{sessionId:e})}catch{return!1}}function D(){d||(d=!0,l&&=(l(),null),c&&=(clearInterval(c),null))}return ro()&&(Zr(()=>{p()}),ti(D)),{loading:r,error:i,info:a,env:o,uptime:s,fmtUptime:Lw,fmtTime:Rw,fmtVal:zw,fileName:Bw,filePath:Vw,methodClass:Uw,init:p,dispose:D,refresh:m,crudCreate:h,crudRead:g,crudUpdate:_,crudDelete:v,crudRestore:y,aiChat:b,aiChatStream:S,aiGetTools:x,showToast:f,terminalStart:C,terminalInput:w,terminalResize:ee,terminalPoll:T,terminalKill:E}}var Gw={key:0,class:`fixed inset-0 z-50 flex items-center justify-center`},Kw={class:`relative bg-background border border-base rounded-xl shadow-2xl w-full max-w-md mx-4 overflow-hidden animate-scale-in`},qw={class:`flex items-center justify-between px-4 py-3 border-b border-base`},Jw={class:`flex items-center gap-2`},Yw={class:`size-7 rounded-lg bg-primary/15 flex items-center justify-center`},Xw={class:`grid grid-cols-5 gap-1.5`},Zw=[`onClick`],Qw={class:`text-[10px] font-medium`},$w={key:0},eT={class:`flex gap-1.5`},tT=[`onClick`],nT={class:`block text-[11px] font-medium text-muted-foreground mb-1.5 uppercase tracking-wider`},rT=[`placeholder`],iT={key:0,class:`mt-1 text-[10px] text-muted-foreground`},aT={key:1,class:`mt-1 text-[10px] text-muted-foreground`},oT={key:1,class:`flex items-center gap-2 px-3 py-2 rounded-lg bg-destructive/10 text-destructive text-xs border border-destructive/20`},sT={class:`flex items-center justify-end gap-2 pt-1`},cT=[`disabled`],lT=[`disabled`],uT={key:0,class:`size-3 border-2 border-primary-foreground/30 border-t-primary-foreground rounded-full animate-spin`},dT=P({__name:`CreateDialog`,props:{open:{type:Boolean},initialType:{},onCreate:{type:Function}},emits:[`close`],setup(e,{emit:t}){let n=e,r=t,i=j(`page`),a=j(``),o=j(`GET`),s=j(!1),c=j(``),l=[`GET`,`POST`,`PUT`,`DELETE`,`PATCH`],u=[{value:`page`,label:`Page`,icon:`lucide:file-text`,placeholder:`/about`},{value:`api`,label:`API Route`,icon:`lucide:send`,placeholder:`/api/hello`},{value:`middleware`,label:`Middleware`,icon:`lucide:layers`,placeholder:`/auth`},{value:`layout`,label:`Layout`,icon:`lucide:layout`,placeholder:`admin`},{value:`cron`,label:`Cron Job`,icon:`lucide:clock`,placeholder:`daily-cleanup`}],d=U(()=>u.find(e=>e.value===i.value));nr(()=>n.open,e=>{e&&(i.value=n.initialType||`page`,a.value=``,o.value=`GET`,c.value=``)}),nr(i,()=>{c.value=``});function f(){s.value||r(`close`)}async function p(){if(!a.value.trim()){c.value=`Path is required`;return}s.value=!0,c.value=``;try{let e=i.value===`api`?{method:o.value}:void 0,t=await n.onCreate(i.value,a.value.trim(),e);t.success?r(`close`):t.errors?.length&&(c.value=t.errors[0])}catch(e){c.value=e instanceof Error?e.message:`Failed to create resource`}finally{s.value=!1}}return(t,n)=>(I(),R(_r,{to:`body`},[e.open?(I(),L(`div`,Gw,[z(`div`,{class:`absolute inset-0 bg-black/50 backdrop-blur-sm`,onClick:f}),z(`div`,Kw,[z(`div`,qw,[z(`div`,Jw,[z(`div`,Yw,[B(M(W),{icon:d.value?.icon||`lucide:plus`,size:15,class:`text-primary`},null,8,[`icon`])]),n[1]||=z(`div`,null,[z(`div`,{class:`text-sm font-semibold text-foreground`},`Create New`),z(`div`,{class:`text-[11px] text-muted-foreground`},`Add a new resource to your project`)],-1)]),z(`button`,{class:`size-7 flex items-center justify-center rounded-md hover:bg-active text-muted-foreground hover:text-foreground transition-colors cursor-pointer`,onClick:f},[B(M(W),{icon:`lucide:x`,size:14})])]),z(`form`,{class:`p-4 space-y-4`,onSubmit:Ws(p,[`prevent`])},[z(`div`,null,[n[2]||=z(`label`,{class:`block text-[11px] font-medium text-muted-foreground mb-1.5 uppercase tracking-wider`},` Resource Type `,-1),z(`div`,Xw,[(I(),L(F,null,di(u,e=>z(`button`,{key:e.value,type:`button`,class:k([`flex flex-col items-center gap-1 py-2 px-1 rounded-lg border transition-all cursor-pointer`,i.value===e.value?`border-active bg-active text-foreground`:`border-base bg-background text-muted-foreground hover:text-foreground hover:bg-active`]),onClick:t=>i.value=e.value},[B(M(W),{icon:e.icon,size:16},null,8,[`icon`]),z(`span`,Qw,A(e.label),1)],10,Zw)),64))])]),i.value===`api`?(I(),L(`div`,$w,[n[3]||=z(`label`,{class:`block text-[11px] font-medium text-muted-foreground mb-1.5 uppercase tracking-wider`},` HTTP Method `,-1),z(`div`,eT,[(I(),L(F,null,di(l,e=>z(`button`,{key:e,type:`button`,class:k([`px-3 py-1.5 rounded-md text-xs font-mono font-semibold border transition-all cursor-pointer`,o.value===e?`border-active bg-active text-foreground`:`border-base bg-background text-muted-foreground hover:text-foreground hover:bg-active`]),onClick:t=>o.value=e},A(e),11,tT)),64))])])):H(``,!0),z(`div`,null,[z(`label`,nT,A(i.value===`cron`?`Name`:`Path`),1),Jn(z(`input`,{"onUpdate:modelValue":n[0]||=e=>a.value=e,type:`text`,placeholder:d.value?.placeholder,class:`w-full px-3 py-2 bg-background border border-base rounded-lg text-xs text-foreground placeholder:text-muted-foreground outline-none focus:border-active focus:ring-1 focus:ring-primary-500/25 transition-all font-mono`,onKeydown:Ks(p,[`enter`])},null,40,rT),[[Ps,a.value]]),i.value===`layout`?(I(),L(`p`,iT,` Layout name without extension (e.g. "admin" → layouts/admin.vue) `)):i.value===`cron`?(I(),L(`p`,aT,` Cron job file name (e.g. "daily" → server/crons/daily.ts) `)):H(``,!0)]),c.value?(I(),L(`div`,oT,[B(M(W),{icon:`lucide:alert-circle`,size:13,class:`flex-shrink-0`}),V(` `+A(c.value),1)])):H(``,!0),z(`div`,sT,[z(`button`,{type:`button`,class:`px-3 py-1.5 text-xs font-medium text-muted-foreground hover:text-foreground rounded-lg hover:bg-active transition-colors cursor-pointer`,disabled:s.value,onClick:f},` Cancel `,8,cT),z(`button`,{type:`submit`,class:`px-4 py-1.5 text-xs font-medium bg-primary text-primary-foreground rounded-lg hover:bg-primary/90 transition-colors flex items-center gap-1.5 cursor-pointer disabled:opacity-50`,disabled:s.value||!a.value.trim()},[s.value?(I(),L(`div`,uT)):(I(),R(M(W),{key:1,icon:`lucide:plus`,size:12})),V(` `+A(s.value?`Creating...`:`Create`),1)],8,lT)])],32)])])):H(``,!0)]))}}),fT=(e,t)=>{let n=e.__vccOpts||e;for(let[e,r]of t)n[e]=r;return n},pT=fT(dT,[[`__scopeId`,`data-v-d058cb8c`]]),mT=[],hT=[];(()=>{let e=`lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,1n,9,16,o,,x,1i,3,,i,,7,a,2,t,3,1k,,,7,2,2,2,3,9,,a,2,q,,2,3,1k,,,5,4,2,2,3,3,,u,2,3,,b,3,1k,,,8,,3,,3,k,2,m,6,,3,1k,,,7,2,2,2,3,7,3,a,2,u,,1n,5,3,3,,4,9,,14,5,1j,,,7,,3,,4,7,2,b,2,t,3,1k,,,7,,3,,4,7,2,b,2,f,,c,4,1j,2,,7,,3,,4,9,,a,2,t,3,1y,,4,6,,,,8,i,2,1p,,,8,c,8,2q,,,a,b,7,21,2,r,,,,,,4,2,1d,k,,2,5,b,,10,9,,2u,b,,6,n,4,4,3,g,4,d,,,3,6,,f,,jj,3,qa,4,s,3,t,2,u,2,1s,w,9,,19,3,,,39,2,y,,3a,c,4,c,63,5,1l,a,,,,,2,o,2,,1c,1a,2,c,k,5,1b,h,12,9,c,3,u,d,1k,e,1c,k,48,3,,l,4,,6,,2,3,5i,1s,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,n,5,4,,2b,2,1e,i,q,i,d,,12,8,p,d,18,4,1b,e,10,,1v,e,c,,8,2,1a,,1f,,,3,2,2,5,2,,,15,5,5,2,6k,8,,2,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,1t,5,8t,2,25,6,1y,b,1d,4,3e,3,1h,f,15,,2,2,a,4,19,b,7,,1p,3,10,e,g,2,18,,c,3,1c,e,8,4,,2,2k,c,6,,2,,4d,c,l,4,1j,2,,7,2,2,2,3,9,,a,2,2,7,3,5,1v,9,,,2,,,4,,5,,,e,2,2a,i,n,,29,k,6j,7,2,9,r,2,2a,h,2y,d,2t,3,2,a,74,f,6t,6,,2,2,4,,,,2,3x,7,2,7,3,,s,a,14,7,,4,8,,9,b,1a,g,5i,8,5j,8,,8,2a,m,,e,3e,6,3,,,2,,7,,,1u,5,,2,,5,9n,4,9,2,,,1c,7,3,5,n,,44l,,6,f,8ug,i,1xc,5,1n,7,t4,,,1j,7,4,29,,b,2,f57,2,3mp,1a,2,n,f2,5,3,6,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,2s,,4g,7,af,,1p,4,e4,4,72,2,6r,,2,,7,2,5,,d6,7,31,7,240,5`.split(`,`).map(e=>e?parseInt(e,36):1);for(let t=0,n=0;t<e.length;t++)(t%2?hT:mT).push(n+=e[t])})();function gT(e){if(e<768)return!1;for(let t=0,n=mT.length;;){let r=t+n>>1;if(e<mT[r])n=r;else if(e>=hT[r])t=r+1;else return!0;if(t==n)return!1}}function _T(e){return e>=127462&&e<=127487}var vT=8205;function yT(e,t,n=!0,r=!0){return(n?bT:xT)(e,t,r)}function bT(e,t,n){if(t==e.length)return t;t&&CT(e.charCodeAt(t))&&wT(e.charCodeAt(t-1))&&t--;let r=ST(e,t);for(t+=TT(r);t<e.length;){let i=ST(e,t);if(r==vT||i==vT||n&&gT(i))t+=TT(i),r=i;else if(_T(i)){let n=0,r=t-2;for(;r>=0&&_T(ST(e,r));)n++,r-=2;if(n%2==0)break;t+=2}else break}return t}function xT(e,t,n){for(;t>1;){let r=bT(e,t-2,n);if(r<t)return r;t--}return 0}function ST(e,t){let n=e.charCodeAt(t);if(!wT(n)||t+1==e.length)return n;let r=e.charCodeAt(t+1);return CT(r)?(n-55296<<10)+(r-56320)+65536:n}function CT(e){return e>=56320&&e<57344}function wT(e){return e>=55296&&e<56320}function TT(e){return e<65536?1:2}var ET=class e{lineAt(e){if(e<0||e>this.length)throw RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,t,n){[e,t]=IT(this,e,t);let r=[];return this.decompose(0,e,r,2),n.length&&n.decompose(0,n.length,r,3),this.decompose(t,this.length,r,1),OT.from(r,this.length-(t-e)+n.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,t=this.length){[e,t]=IT(this,e,t);let n=[];return this.decompose(e,t,n,0),OT.from(n,t-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let t=this.scanIdentical(e,1),n=this.length-this.scanIdentical(e,-1),r=new MT(this),i=new MT(e);for(let e=t,a=t;;){if(r.next(e),i.next(e),e=0,r.lineBreak!=i.lineBreak||r.done!=i.done||r.value!=i.value)return!1;if(a+=r.value.length,r.done||a>=n)return!0}}iter(e=1){return new MT(this,e)}iterRange(e,t=this.length){return new NT(this,e,t)}iterLines(e,t){let n;if(e==null)n=this.iter();else{t??=this.lines+1;let r=this.line(e).from;n=this.iterRange(r,Math.max(r,t==this.lines+1?this.length:t<=1?0:this.line(t-1).to))}return new PT(n)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(t){if(t.length==0)throw RangeError(`A document must have at least one line`);return t.length==1&&!t[0]?e.empty:t.length<=32?new DT(t):OT.from(DT.split(t,[]))}},DT=class e extends ET{constructor(e,t=kT(e)){super(),this.text=e,this.length=t}get lines(){return this.text.length}get children(){return null}lineInner(e,t,n,r){for(let i=0;;i++){let a=this.text[i],o=r+a.length;if((t?n:o)>=e)return new FT(r,o,n,a);r=o+1,n++}}decompose(t,n,r,i){let a=t<=0&&n>=this.length?this:new e(jT(this.text,t,n),Math.min(n,this.length)-Math.max(0,t));if(i&1){let t=r.pop(),n=AT(a.text,t.text.slice(),0,a.length);if(n.length<=32)r.push(new e(n,t.length+a.length));else{let t=n.length>>1;r.push(new e(n.slice(0,t)),new e(n.slice(t)))}}else r.push(a)}replace(t,n,r){if(!(r instanceof e))return super.replace(t,n,r);[t,n]=IT(this,t,n);let i=AT(this.text,AT(r.text,jT(this.text,0,t)),n),a=this.length+r.length-(n-t);return i.length<=32?new e(i,a):OT.from(e.split(i,[]),a)}sliceString(e,t=this.length,n=`
28
+ `))}}g()}return(async()=>{try{let e=await a(o,{headers:{accept:`text/event-stream`},signal:c.signal});if(!e.ok||!e.body)throw Error(`Devframe SSE stream request failed: ${e.status}`);await v(e.body)}catch(e){if(c.signal.aborted){g();return}h(e instanceof Error?e:Error(String(e)))}})(),{close:()=>{l=!0,c.abort(),d?.cancel().catch(()=>{})},on:e=>{u=e},post:async e=>{let t;try{t=await m}catch{return}if(l){n(Error(`Devframe SSE channel is closed; message dropped`));return}try{let n=await a(o,{method:`POST`,headers:{"content-type":`text/plain; charset=utf-8`,[oC]:t},body:e});if(n.status===200){let e=await n.text();e&&u?.(e);return}if(!n.ok)throw Error(`Devframe SSE POST failed: ${n.status}`)}catch(e){n(e instanceof Error?e:Error(String(e)))}},serialize:s.serialize,deserialize:s.deserialize}}function XC(e,t){let{channel:n,rpcOptions:r={}}=t;return wb(e,{...n,timeout:-1,...r,proxify:!1})}function ZC(e){let{transport:t,authToken:n,connectionMeta:r,events:i,clientRpc:a,rpcOptions:o={},callTimeout:s=0}=e,c=!1,l=`connecting`,u=null,d=Promise.withResolvers();function f(e,t=null){if(t?u=t:e===`connected`&&(u=null),e===l)return;let n=l;l=e,i.emit(db.client.connectionStatus,e,n)}let p=new Set;function m(e){for(let t of[...p])t.reject(e)}function h(){return l===`disconnected`||l===`error`?new LC(`connection`,`[devframe] Not connected to the devframe server`,{cause:u??void 0}):l===`unauthorized`?new LC(`auth`,`[devframe] Not authorized by the devframe server`,{cause:u??void 0}):null}function g(e,t){return new Promise((n,r)=>{let a=!1,o,c={reject(e){a||(l(),i.emit(db.client.error,e,t),r(e))}};function l(){a=!0,p.delete(c),o&&clearTimeout(o)}p.add(c),s>0&&(o=setTimeout(()=>{c.reject(new LC(`timeout`,`[devframe] RPC call "${t}" timed out after ${s}ms`))},s)),e.then(e=>{a||(l(),n(e))},e=>{if(a)return;l();let n=e instanceof Error?e:Error(String(e));i.emit(db.client.error,n,t),r(n)})})}let _=new Map;for(let e of r.jsonSerializableMethods??[])_.set(e,{jsonSerializable:!0});let v=e.createChannel({definitions:_,onError(e){f(`error`,e),i.emit(db.client.connectionError,e),m(new LC(`connection`,`[devframe] Connection to the devframe server failed`,{cause:e}))},onDisconnected(){l!==`error`&&f(`disconnected`),m(new LC(`connection`,`[devframe] Disconnected from the devframe server`,{cause:u??void 0}))}}),y=XC(a.functions,{channel:v,rpcOptions:o});a.register({name:db.broadcast.authRevoked,type:`event`,handler:()=>{c=!1;let e=new LC(`auth`,`[devframe] The devframe server revoked this client's trust`);f(`unauthorized`,e),i.emit(db.client.connectionError,e),m(e),i.emit(db.client.isTrustedUpdated,!1)}});let b=n;async function x(e){b=e;let t=await y.$call(`anonymous:devframe:auth`,{authToken:e,ua:navigator.userAgent,origin:location.origin});if(c=t.isTrusted,c)d.resolve(!0),f(`connected`);else{let e=new LC(`auth`,`[devframe] The devframe server refused this client's credentials`);f(`unauthorized`,e),i.emit(db.client.connectionError,e)}return i.emit(db.client.isTrustedUpdated,c),t.isTrusted}async function S(e){let t=(await y.$call(`anonymous:devframe:auth:exchange`,{code:e,ua:navigator.userAgent,origin:location.origin}))?.authToken??null;return t&&(b=t,c=!0,d.resolve(!0),f(`connected`),i.emit(db.client.isTrustedUpdated,!0)),t}async function C(e={}){await y.$call(`anonymous:devframe:auth:request-code`,{ua:navigator.userAgent,origin:location.origin,...e.reissue?{reissue:!0}:{}})}async function w(){return c?!0:x(b??``)}async function ee(e=6e4){if(c&&d.resolve(!0),e<=0)return d.promise;let t;try{return await Promise.race([d.promise,new Promise((n,r)=>{t=setTimeout(()=>{r(Error(`[devframe] Timeout waiting for rpc to be trusted`))},e)})]),c}finally{clearTimeout(t)}}return{transport:t,get isTrusted(){return c},get status(){return l},get connectionError(){return u},requestTrust:w,requestTrustWithToken:x,requestTrustWithCode:S,requestAuthCode:C,ensureTrusted:ee,call:(...e)=>{let t=String(e[0]),n=h();return n?(i.emit(db.client.error,n,t),Promise.reject(n)):g(y.$call(...e),t)},callEvent:(...e)=>{let t=h();if(t){i.emit(db.client.error,t,String(e[0]));return}return y.$callEvent(...e)},callOptional:(...e)=>{let t=String(e[0]),n=h();return n?(i.emit(db.client.error,n,t),Promise.reject(n)):g(y.$callOptional(...e),t)},close:()=>{v.close()}}}function QC(e,t,n){let r=(()=>{try{return new URL(t,n.href)}catch{return new URL(n.href)}})();if(e&&typeof e==`object`){if(e.host!=null||e.port!=null){let t=e.host??`${r.hostname}:${e.port}`;return new URL(e.path??`/`,`${r.protocol}//${t}`).href}return new URL(e.path??``,r).href}let i=e??``;return/^https?:\/\//i.test(i)?i:new URL(i,r).href}function $C(e){let{authToken:t,connectionMeta:n,metaBaseUrl:r,events:i,clientRpc:a,rpcOptions:o={},sseOptions:s={},callTimeout:c=0}=e,l=QC(n.sse,r??`./`,location);return ZC({transport:`sse`,authToken:t,connectionMeta:n,events:i,clientRpc:a,rpcOptions:o,callTimeout:c,createChannel:e=>YC({url:l,authToken:t,definitions:e.definitions,...s,onConnected(){s.onConnected?.()},onError(t){e.onError(t),s.onError?.(t)},onDisconnected(){e.onDisconnected(),s.onDisconnected?.()}})})}function ew(e){let{name:t,message:n,cause:r,...i}=e,a=r instanceof Error?r:tw(r)?ew(r):r,o=a===void 0?Error(n):Error(n,{cause:a});return o.name=t,Object.assign(o,i),o}function tw(e){return typeof e==`object`&&!!e&&typeof e.message==`string`&&typeof e.name==`string`}function nw(e){return typeof e==`object`&&!!e&&e.type===`static`&&typeof e.path==`string`}function rw(e){return typeof e==`object`&&!!e&&e.type===`query`&&typeof e.records==`object`&&e.records!==null}function iw(e){return typeof e==`object`&&!!e&&(`output`in e||`error`in e)}function aw(e){if(e.error)throw ew(e.error);return e.output}function ow(e){return e.some(e=>e!=null)}function sw(e){return typeof e==`object`&&e&&`serialization`in e&&`data`in e?e.data:e}function cw(e,t){let n=new Map,r=new Map;function i(e,t){return t===`structured-clone`&&Array.isArray(e)?US(e):e}function a(e,t){return i(sw(e),t)}async function o(e){n.has(e.path)||n.set(e.path,t(e.path).then(t=>a(t,e.serialization)));let r=await n.get(e.path);return iw(r)?aw(r):r}async function s(e,n){return r.has(e)||r.set(e,t(e).then(e=>a(e,n))),await r.get(e)}async function c(t,n){if(!(t in e))throw Error(`[devframe-rpc] Function "${t}" not found in dump store`);let r=e[t];if(nw(r)){if(ow(n))throw Error(`[devframe-rpc] No dump match for "${t}" with args: ${JSON.stringify(n)}`);return await o(r)}if(rw(r)){let e=Wb(n),i=r.records[e];if(i)return aw(await s(i,r.serialization));if(r.fallback)return aw(await s(r.fallback,r.serialization));throw Error(`[devframe-rpc] No dump match for "${t}" with args: ${JSON.stringify(n)}`)}if(!ow(n))return r;throw Error(`[devframe-rpc] No dump match for "${t}" with args: ${JSON.stringify(n)}`)}return{call:async(e,t)=>await c(e,t),callOptional:async(t,n)=>{if(t in e)return await c(t,n)},callEvent:async(e,t)=>{}}}async function lw(e){let t=cw(await e.fetchJsonFromBases(sC),e.fetchJsonFromBases);return{transport:`static`,isTrusted:!0,status:`connected`,connectionError:null,requestTrust:async()=>!0,requestTrustWithToken:async()=>!0,requestTrustWithCode:async()=>null,requestAuthCode:async()=>{},ensureTrusted:async()=>!0,call:(...e)=>t.call(e[0],e.slice(1)),callEvent:(...e)=>t.callEvent(e[0],e.slice(1)),callOptional:(...e)=>t.callOptional(e[0],e.slice(1)),close:()=>{}}}var uw=``;function dw(e,t){return`${e}${uw}${t}`}function fw(e){let t=new Map,n=new Map;e.client.register({name:db.broadcast.streamingChunk,type:`event`,handler(e,n,r,i){t.get(dw(e,n))?._push(r,i)}}),e.client.register({name:db.broadcast.streamingEnd,type:`event`,handler(e,n,r){let i=dw(e,n),a=t.get(i);a&&(a._end(r),t.delete(i))}}),e.client.register({name:db.broadcast.streamingUploadCancel,type:`event`,handler(e,t){let r=dw(e,t),i=n.get(r);i&&(i.abort(`server cancelled upload`),n.delete(r))}}),e.events.on(db.client.isTrustedUpdated,n=>{if(n)for(let[n,r]of t){if(r.cancelled||r.done)continue;let t=n.indexOf(uw);if(t<0)continue;let i=n.slice(0,t),a=n.slice(t+1);e.callEvent(`devframe:streaming:subscribe`,i,a,{afterSeq:r.lastSeenSeq})}});function r(n,r,i={}){let a=dw(n,r),o=t.get(a);if(o)return o;let s=YS({id:r,highWaterMark:i.highWaterMark,onOverflow(e){console.warn(`[devframe] DF0029: Stream "${n}#${r}" dropped ${e} chunk(s) after exceeding the client high-water mark.`)},onCancel(){e.callEvent(`devframe:streaming:cancel`,n,r),t.delete(a)}});if(t.set(a,s),e.isTrusted)e.callEvent(`devframe:streaming:subscribe`,n,r,{afterSeq:0});else{let i=e.events.on(db.client.isTrustedUpdated,o=>{o&&(i(),t.has(a)&&!s.cancelled&&!s.done&&e.callEvent(`devframe:streaming:subscribe`,n,r,{afterSeq:s.lastSeenSeq}))})}return s}function i(t,r){let i=dw(t,r),a=n.get(i);if(a)return a;let o=JS({id:r});return o.events.on(`chunk`,(n,i)=>{e.callEvent(`devframe:streaming:upload-chunk`,t,r,n,i)}),o.events.on(`end`,a=>{e.callEvent(`devframe:streaming:upload-end`,t,r,a),n.delete(i)}),n.set(i,o),o}return{subscribe:r,upload:i}}function pw(){}var mw=new Map;function hw(e){let t=e.url;e.authToken&&(t=`${t}?${uC}=${encodeURIComponent(e.authToken)}`);let n=new WebSocket(t),{onConnected:r=pw,onError:i=pw,onDisconnected:a=pw,definitions:o=mw}=e;n.addEventListener(`open`,e=>{r(e)}),n.addEventListener(`error`,e=>{let t=e instanceof Error?e:Error(e.type);i(t)}),n.addEventListener(`close`,e=>{a(e)});let s=GC(o);return{close:()=>{n.close()},on:e=>{n.addEventListener(`message`,t=>{e(t.data)})},post:e=>{if(n.readyState===WebSocket.OPEN){n.send(e);return}if(n.readyState===WebSocket.CONNECTING){let t=()=>{i(),n.readyState===WebSocket.OPEN&&n.send(e)},r=()=>i();function i(){n.removeEventListener(`open`,t),n.removeEventListener(`close`,r)}n.addEventListener(`open`,t),n.addEventListener(`close`,r);return}i(Error(`Devframe WebSocket is not open; message dropped`))},serialize:s.serialize,deserialize:s.deserialize}}function gw(e,t,n){let r=(()=>{try{return new URL(t,n.href)}catch{return new URL(n.href)}})(),i=r.protocol===`https:`?`wss:`:`ws:`;if(e&&typeof e==`object`){if(e.host!=null||e.port!=null){let t=e.host??`${r.hostname}:${e.port}`,n=new URL(e.path??`/`,`${i}//${t}`);return n.protocol=i,n.href}let t=new URL(e.path??``,r);return t.protocol=i,t.href}if(typeof e==`number`)return`${i}//${r.hostname}:${e}`;let a=e??``;if(/^wss?:\/\//i.test(a))return a;if(/^https?:\/\//i.test(a))return nb(a,/^https/i.test(a)?`wss://`:`ws://`);let o=new URL(a,r);return o.protocol=i,o.href}function _w(e){let{authToken:t,connectionMeta:n,metaBaseUrl:r,events:i,clientRpc:a,rpcOptions:o={},wsOptions:s={},callTimeout:c=0}=e,l=gw(n.websocket,r??`./`,location);return ZC({transport:`websocket`,authToken:t,connectionMeta:n,events:i,clientRpc:a,rpcOptions:o,callTimeout:c,createChannel:e=>hw({url:l,authToken:t,definitions:e.definitions,...s,onConnected(e){s.onConnected?.(e)},onError(t){e.onError(t),s.onError?.(t)},onDisconnected(t){e.onDisconnected(),s.onDisconnected?.(t)}})})}function vw(e){return e.includes(`:`)}function yw(e,t){return vw(t)?t:`${e}:${t}`}function bw(e){return{async get(t){return(await e()).value()[t]},async set(t,n){(await e()).mutate(e=>{e[t]=n})},async delete(t){(await e()).mutate(e=>{delete e[t]})},async all(){return(await e()).value()},async onChange(t){return(await e()).on(`updated`,e=>t(e))}}}function xw(e,t,n){let r=`devframe:settings:${n}:${t}`,i;function a(){return i||=e.sharedState.get(r,{initialValue:{}}),i}return bw(a)}function Sw(e,t){return{global:xw(e,t,`global`),project:xw(e,t,`project`)}}function Cw(e,t){return{namespace:t,base:e,rpc:{namespace:t,register(n){if(vw(n.name))throw Error(`[devframe] Scoped client RPC registration for namespace "${t}" received an already-namespaced function name "${n.name}". Pass a bare name without a ":" separator.`);e.client.register({...n,name:`${t}:${n.name}`})},call:((n,...r)=>e.call(yw(t,n),...r)),callEvent:((n,...r)=>e.callEvent(yw(t,n),...r)),callOptional:((n,...r)=>e.callOptional(yw(t,n),...r)),sharedState:((n,r)=>e.sharedState.get(yw(t,n),r)),streaming:{subscribe:(n,r,i)=>e.streaming.subscribe(yw(t,n),r,i),upload:(n,r)=>e.streaming.upload(yw(t,n),r)}},settings:Sw(e,t),scope:e.scope}}function ww(){if(typeof document<`u`){let e=document.modelContext;if(e)return e}if(typeof navigator<`u`){let e=navigator.modelContext;if(e)return e}}function Tw(e,t={}){let n=t.modelContext??ww();if(!n)return()=>{};let r=n,i=new Map,a=new Map;function o(t,n){let o=QS(t.name),s=a.get(o);if(s&&s!==t.name){console.warn(`[devframe] WebMCP tool name "${o}" (from "${t.name}") collides with "${s}"; keeping the first registration.`);return}let c=new AbortController,l=Tb(t.type,n),u=r.registerTool({name:o,description:n.description,inputSchema:Ob(t.args),annotations:{title:n.title??t.name,readOnlyHint:l===`read`,destructiveHint:l===`destructive`},execute:n=>Ew(t,e.context,n)},{signal:c.signal});u&&`then`in u&&u.then(()=>{},()=>{}),a.set(o,t.name),i.set(t.name,()=>{c.abort(),u&&`unregister`in u&&typeof u.unregister==`function`&&u.unregister(),a.delete(o)})}function s(t){let n=t?[t]:[...e.definitions.keys()];for(let t of n){i.get(t)?.(),i.delete(t);let n=e.definitions.get(t),r=n?.agent;n&&r&&o(n,r)}}s();let c=e.onChanged(e=>s(e));return()=>{c();for(let e of i.values())e();i.clear()}}async function Ew(e,t,n){try{let r=Ab(n,e.args?.length);return{content:[{type:`text`,text:Dw(await(await yC(e,t))(...r))}]}}catch(e){return{isError:!0,content:[{type:`text`,text:Ow(e)}]}}}function Dw(e){return e===void 0?`undefined`:typeof e==`string`?e:JSON.stringify(e,null,2)}function Ow(e){if(!(e instanceof Error))return String(e);let t=e.cause instanceof Error?` (cause: ${e.cause.message})`:``;return`${e.name}: ${e.message}${t}`}function kw(e,t){if(t.backend===`static`)return`static`;let n=t.websocket!==void 0,r=t.sse!==void 0;if(e===`websocket`){if(!n)throw Error(`[devframe] transport: 'websocket' was requested, but this server does not advertise a WebSocket endpoint`);return`websocket`}if(e===`sse`){if(!r)throw Error(`[devframe] transport: 'sse' was requested, but this server does not advertise an SSE endpoint`);return`sse`}if(t.backend===`sse`&&r)return`sse`;if(n)return`websocket`;if(r)return`sse`;throw Error(`[devframe] This server advertises no RPC transport (backend "none"), so there is nothing to connect to. Enable the WebSocket or SSE endpoint on the server, or use its static/MCP surfaces instead.`)}async function Aw(e={}){let{baseURL:t=`./`,rpcOptions:n={},cacheOptions:r=!1}=e,i=Gb(),a=Array.isArray(t)?t:[t],o=await IC(e),{connectionMeta:s,metaBaseUrl:c,authToken:l}=o,u=a[0]??`./`;try{u=new URL(`.`,c).href}catch{}let d=new dC({functions:[],...typeof e.cacheOptions==`object`?e.cacheOptions:{}}),f={rpc:void 0},p=new bC(f),m=e.webmcp===!1?void 0:Tw(p),h,g=!1;async function _(e){let t=[u,...a.filter(e=>e!==u)].filter(e=>e!=null),n=[];for(let r of t)try{return await fetch(tb(e,r)).then(t=>{if(!t.ok)throw Error(`Failed to fetch ${e} from ${r}: ${t.status}`);return t.json()})}catch(e){n.push(e)}throw Error(`Failed to load ${e} from ${t.join(`, `)}`,{cause:n})}let v={authToken:l,connectionMeta:s,metaBaseUrl:c,events:i,clientRpc:p,callTimeout:e.callTimeout,rpcOptions:{...n,async onRequest(e,t,i){if(await n.onRequest?.call(this,e,t,i),r&&d?.validate(e.m)){if(d.has(e.m,e.a))return i(d.cached(e.m,e.a));let n=await t(e);d.apply(e,n)}else await t(e)}}},y=kw(e.transport??`auto`,s),b=y===`static`?await lw({fetchJsonFromBases:_}):y===`sse`?$C({...v,sseOptions:e.sseOptions}):_w({...v,wsOptions:e.wsOptions}),x;try{x=new BroadcastChannel(`devframe-auth`)}catch{}let S,C=!1;function w(e){return((...t)=>C||!S?e(...t):S.then(()=>e(...t)))}function ee(){g=!0;try{h?.(),m?.()}finally{try{x?.close()}finally{b.close?.()}}}let T={events:i,get isTrusted(){return b.isTrusted},get status(){return b.status},get connectionError(){return b.connectionError},get transport(){return b.transport??y},get connection(){return o},connectionMeta:s,ensureTrusted:b.ensureTrusted,requestTrust:b.requestTrust,requestTrustWithToken:async e=>(MC(e),o={...o,authToken:e},b.requestTrustWithToken(e)),requestTrustWithCode:async e=>{let t=await b.requestTrustWithCode(e);if(!t)return!1;MC(t),o={...o,authToken:t};try{x?.postMessage({type:`auth-update`,authToken:t})}catch{}return!0},requestAuthCode:e=>b.requestAuthCode(e),call:w(b.call),callEvent:w(b.callEvent),callOptional:w(b.callOptional),client:p,sharedState:void 0,services:void 0,streaming:void 0,cacheManager:d,scope:void 0,close:ee};T.sharedState=UC(T),T.streaming=fw(T),T.services=HC(T);let E=new Map;T.scope=(e=>{if(!e)return T;let t=E.get(e);return t||(t=Cw(T,e),E.set(e,t)),t}),f.rpc=T;function D(){try{return typeof window<`u`&&window.self===window.top}catch{return!1}}async function te(){if(e.simpleAuth!==!1&&D()&&typeof globalThis.prompt==`function`)for(await T.requestAuthCode().catch(()=>{});!T.isTrusted;){let e=globalThis.prompt(`devframe: enter the authentication code shown in your terminal`);if(e==null)return;let t=e.trim();if(t&&await T.requestTrustWithCode(t))return}}async function ne(){let t=await b.requestTrust(),n=e.otpParam??`devframe_otp`,r=n?await VC(T,{param:n}):!1;t||r||T.isTrusted||await te()}return S=ne().then(()=>{C=!0},()=>{C=!0}),s.mcp&&rC(async()=>{let{setupBrowserAgentRpcBridge:e}=await import(`./browser-agent-rpc-BXhoSh1z-BpvIxhz4.js`);return{setupBrowserAgentRpcBridge:e}},[]).then(({setupBrowserAgentRpcBridge:e})=>{g||(h=e(T))}).catch(()=>{}),x&&(x.onmessage=e=>{e.data?.type===`auth-update`&&e.data.authToken&&T.requestTrustWithToken(e.data.authToken)}),T}function jw(e={}){return Aw({...e,simpleAuth:!1})}var Mw=`https://api.deepseek.com/v1`,Nw=`deepseek-chat`,Pw=null;function Fw(){if(!Pw){let e=new Promise((e,t)=>setTimeout(()=>t(Error(`DTK connection timeout — open this page via the Vite DevTools dock shell, not directly.`)),5e3));Pw=Promise.race([jw(),e])}return Pw}async function Iw(e,t,n){return e.call(t,...n)}function Lw(e){let t=Math.floor(e/1e3),n=Math.floor(t/60),r=Math.floor(n/60);return r>0?`${r}h ${n%60}m`:n>0?`${n}m ${t%60}s`:`${t}s`}function Rw(e){return new Date(e).toLocaleTimeString()}function zw(e){return e==null?`—`:typeof e==`boolean`?e?`true`:`false`:typeof e==`number`?String(e):typeof e==`string`?e:Array.isArray(e)?`[${e.length} items]`:typeof e==`object`?JSON.stringify(e):String(e)}function Bw(e){return e?e.split(`/`).pop()||e:``}function Vw(e){if(!e)return``;let t=e.split(`/`);return t.length<=5?e:`${t.slice(0,3).join(`/`)}/…/${t.slice(-2).join(`/`)}`}var Hw={GET:`bg-success/12 text-success`,POST:`bg-info/12 text-info`,PUT:`bg-warning/12 text-warning`,DELETE:`bg-destructive/12 text-destructive`,PATCH:`bg-purple-500/12 text-purple-400`};function Uw(e){return Hw[e]||`bg-secondary text-muted-foreground`}function Ww(e={}){let t=e.client??Fw;async function n(e,...n){return Iw(await t(),e,n)}let r=j(!0),i=j(null),a=j(null),o=j({}),s=j(0),c=null,l=null,u=!1,d=!1;function f(e,t){let n={duration:3e3,position:`top-right`};switch(e){case`success`:xg.success(t,n);break;case`error`:xg.error(t,n);break;case`warning`:xg.warning(t,n);break;default:xg(t,n)}}async function p(){if(!(u||d)){u=!0;try{let e=await(await t()).sharedState.get(`ubean:info`);a.value=e.value(),r.value=!1,l=e.on(`updated`,e=>{a.value=e}),o.value=await n(`ubean:get-env`),c=setInterval(()=>{a.value&&(s.value=Date.now()-a.value.startTime)},1e3)}catch(e){i.value=e instanceof Error?e.message:`Failed to connect`,r.value=!1}}}async function m(){try{o.value=await n(`ubean:get-env`),a.value||=await n(`ubean:get-info`)}catch{}}async function h(e,t,r){try{let i=await n(`ubean:crud:create`,{type:e,path:t,...r});return i.success?(f(`success`,`Created ${e}: ${t}`),await m()):i.errors?.length&&f(`error`,i.errors[0]),i}catch(e){let t=e instanceof Error?e.message:`Create failed`;return f(`error`,t),{success:!1,errors:[t]}}}async function g(e,t){try{return await n(`ubean:crud:read`,{type:e,path:t})}catch(e){return{success:!1,error:e instanceof Error?e.message:`Read failed`}}}async function _(e,t){try{let r=await n(`ubean:crud:update`,{type:e,...t});return r.success?(f(`success`,`Updated ${e}`),await m()):r.errors?.length&&f(`error`,r.errors[0]),r}catch(e){let t=e instanceof Error?e.message:`Update failed`;return f(`error`,t),{success:!1,errors:[t]}}}async function v(e,t){try{let r=await n(`ubean:crud:delete`,{type:e,...t});return r.success?(f(`success`,`Deleted ${e}`),await m()):r.errors?.length&&f(`error`,r.errors[0]),r}catch(e){let t=e instanceof Error?e.message:`Delete failed`;return f(`error`,t),{success:!1,errors:[t]}}}async function y(e){try{let t=await n(`ubean:crud:restore`,e);return t.success?(f(`success`,`Restored: ${e}`),await m()):t.errors?.length&&f(`error`,t.errors[0]),t}catch(e){let t=e instanceof Error?e.message:`Restore failed`;return f(`error`,t),{success:!1,errors:[t]}}}async function b(e,t){try{return await n(`ubean:ai:chat`,{messages:e,...t})}catch(e){return{message:{role:`assistant`,content:`Error: ${e instanceof Error?e.message:`AI request failed`}`,timestamp:Date.now()}}}}async function x(){try{return await n(`ubean:ai:tools`)}catch{return[]}}async function S(e,r,i){let a=`stream_${Date.now()}_${Math.random().toString(36).slice(2,8)}`;try{let o=(await(await t()).sharedState.get(`ubean:ai:stream`)).on(`updated`,e=>{e&&e.requestId===a&&i(e)});try{return await n(`ubean:ai:chat-stream`,{messages:e,requestId:a,...r})}finally{o()}}catch(e){return{message:{role:`assistant`,content:`Error: ${e instanceof Error?e.message:`AI stream failed`}`,timestamp:Date.now()}}}}async function C(e){try{return await n(`ubean:terminal:start`,e)}catch(e){return f(`error`,e instanceof Error?e.message:`Terminal start failed`),null}}async function w(e,t){try{return await n(`ubean:terminal:input`,{sessionId:e,data:t})}catch{return!1}}async function ee(e,t,r){try{return await n(`ubean:terminal:resize`,{sessionId:e,cols:t,rows:r})}catch{return!1}}async function T(e){try{return await n(`ubean:terminal:poll`,{sessionId:e})}catch{return{data:``,exited:!0,exitCode:-1}}}async function E(e){try{return await n(`ubean:terminal:kill`,{sessionId:e})}catch{return!1}}function D(){d||(d=!0,l&&=(l(),null),c&&=(clearInterval(c),null))}return ro()&&(Zr(()=>{p()}),ti(D)),{loading:r,error:i,info:a,env:o,uptime:s,fmtUptime:Lw,fmtTime:Rw,fmtVal:zw,fileName:Bw,filePath:Vw,methodClass:Uw,init:p,dispose:D,refresh:m,crudCreate:h,crudRead:g,crudUpdate:_,crudDelete:v,crudRestore:y,aiChat:b,aiChatStream:S,aiGetTools:x,showToast:f,terminalStart:C,terminalInput:w,terminalResize:ee,terminalPoll:T,terminalKill:E}}var Gw={key:0,class:`fixed inset-0 z-50 flex items-center justify-center`},Kw={class:`relative bg-background border border-base rounded-xl shadow-2xl w-full max-w-md mx-4 overflow-hidden animate-scale-in`},qw={class:`flex items-center justify-between px-4 py-3 border-b border-base`},Jw={class:`flex items-center gap-2`},Yw={class:`size-7 rounded-lg bg-primary/15 flex items-center justify-center`},Xw={class:`grid grid-cols-5 gap-1.5`},Zw=[`onClick`],Qw={class:`text-[10px] font-medium`},$w={key:0},eT={class:`flex gap-1.5`},tT=[`onClick`],nT={class:`block text-[11px] font-medium text-muted-foreground mb-1.5 uppercase tracking-wider`},rT=[`placeholder`],iT={key:0,class:`mt-1 text-[10px] text-muted-foreground`},aT={key:1,class:`mt-1 text-[10px] text-muted-foreground`},oT={key:1,class:`flex items-center gap-2 px-3 py-2 rounded-lg bg-destructive/10 text-destructive text-xs border border-destructive/20`},sT={class:`flex items-center justify-end gap-2 pt-1`},cT=[`disabled`],lT=[`disabled`],uT={key:0,class:`size-3 border-2 border-primary-foreground/30 border-t-primary-foreground rounded-full animate-spin`},dT=P({__name:`CreateDialog`,props:{open:{type:Boolean},initialType:{},onCreate:{type:Function}},emits:[`close`],setup(e,{emit:t}){let n=e,r=t,i=j(`page`),a=j(``),o=j(`GET`),s=j(!1),c=j(``),l=[`GET`,`POST`,`PUT`,`DELETE`,`PATCH`],u=[{value:`page`,label:`Page`,icon:`lucide:file-text`,placeholder:`/about`},{value:`api`,label:`API Route`,icon:`lucide:send`,placeholder:`/api/hello`},{value:`middleware`,label:`Middleware`,icon:`lucide:layers`,placeholder:`/auth`},{value:`layout`,label:`Layout`,icon:`lucide:layout`,placeholder:`admin`},{value:`cron`,label:`Cron Job`,icon:`lucide:clock`,placeholder:`daily-cleanup`}],d=U(()=>u.find(e=>e.value===i.value));nr(()=>n.open,e=>{e&&(i.value=n.initialType||`page`,a.value=``,o.value=`GET`,c.value=``)}),nr(i,()=>{c.value=``});function f(){s.value||r(`close`)}async function p(){if(!a.value.trim()){c.value=`Path is required`;return}s.value=!0,c.value=``;try{let e=i.value===`api`?{method:o.value}:void 0,t=await n.onCreate(i.value,a.value.trim(),e);t.success?r(`close`):t.errors?.length&&(c.value=t.errors[0])}catch(e){c.value=e instanceof Error?e.message:`Failed to create resource`}finally{s.value=!1}}return(t,n)=>(I(),R(_r,{to:`body`},[e.open?(I(),L(`div`,Gw,[z(`div`,{class:`absolute inset-0 bg-black/50 backdrop-blur-sm`,onClick:f}),z(`div`,Kw,[z(`div`,qw,[z(`div`,Jw,[z(`div`,Yw,[B(M(W),{icon:d.value?.icon||`lucide:plus`,size:15,class:`text-primary`},null,8,[`icon`])]),n[1]||=z(`div`,null,[z(`div`,{class:`text-sm font-semibold text-foreground`},`Create New`),z(`div`,{class:`text-[11px] text-muted-foreground`},`Add a new resource to your project`)],-1)]),z(`button`,{class:`size-7 flex items-center justify-center rounded-md hover:bg-active text-muted-foreground hover:text-foreground transition-colors cursor-pointer`,onClick:f},[B(M(W),{icon:`lucide:x`,size:14})])]),z(`form`,{class:`p-4 space-y-4`,onSubmit:Ws(p,[`prevent`])},[z(`div`,null,[n[2]||=z(`label`,{class:`block text-[11px] font-medium text-muted-foreground mb-1.5 uppercase tracking-wider`},` Resource Type `,-1),z(`div`,Xw,[(I(),L(F,null,di(u,e=>z(`button`,{key:e.value,type:`button`,class:k([`flex flex-col items-center gap-1 py-2 px-1 rounded-lg border transition-all cursor-pointer`,i.value===e.value?`border-active bg-active text-foreground`:`border-base bg-background text-muted-foreground hover:text-foreground hover:bg-active`]),onClick:t=>i.value=e.value},[B(M(W),{icon:e.icon,size:16},null,8,[`icon`]),z(`span`,Qw,A(e.label),1)],10,Zw)),64))])]),i.value===`api`?(I(),L(`div`,$w,[n[3]||=z(`label`,{class:`block text-[11px] font-medium text-muted-foreground mb-1.5 uppercase tracking-wider`},` HTTP Method `,-1),z(`div`,eT,[(I(),L(F,null,di(l,e=>z(`button`,{key:e,type:`button`,class:k([`px-3 py-1.5 rounded-md text-xs font-mono font-semibold border transition-all cursor-pointer`,o.value===e?`border-active bg-active text-foreground`:`border-base bg-background text-muted-foreground hover:text-foreground hover:bg-active`]),onClick:t=>o.value=e},A(e),11,tT)),64))])])):H(``,!0),z(`div`,null,[z(`label`,nT,A(i.value===`cron`?`Name`:`Path`),1),Jn(z(`input`,{"onUpdate:modelValue":n[0]||=e=>a.value=e,type:`text`,placeholder:d.value?.placeholder,class:`w-full px-3 py-2 bg-background border border-base rounded-lg text-xs text-foreground placeholder:text-muted-foreground outline-none focus:border-active focus:ring-1 focus:ring-primary-500/25 transition-all font-mono`,onKeydown:Ks(p,[`enter`])},null,40,rT),[[Ps,a.value]]),i.value===`layout`?(I(),L(`p`,iT,` Layout name without extension (e.g. "admin" → layouts/admin.vue) `)):i.value===`cron`?(I(),L(`p`,aT,` Cron job file name (e.g. "daily" → crons/daily.ts) `)):H(``,!0)]),c.value?(I(),L(`div`,oT,[B(M(W),{icon:`lucide:alert-circle`,size:13,class:`flex-shrink-0`}),V(` `+A(c.value),1)])):H(``,!0),z(`div`,sT,[z(`button`,{type:`button`,class:`px-3 py-1.5 text-xs font-medium text-muted-foreground hover:text-foreground rounded-lg hover:bg-active transition-colors cursor-pointer`,disabled:s.value,onClick:f},` Cancel `,8,cT),z(`button`,{type:`submit`,class:`px-4 py-1.5 text-xs font-medium bg-primary text-primary-foreground rounded-lg hover:bg-primary/90 transition-colors flex items-center gap-1.5 cursor-pointer disabled:opacity-50`,disabled:s.value||!a.value.trim()},[s.value?(I(),L(`div`,uT)):(I(),R(M(W),{key:1,icon:`lucide:plus`,size:12})),V(` `+A(s.value?`Creating...`:`Create`),1)],8,lT)])],32)])])):H(``,!0)]))}}),fT=(e,t)=>{let n=e.__vccOpts||e;for(let[e,r]of t)n[e]=r;return n},pT=fT(dT,[[`__scopeId`,`data-v-d0829a41`]]),mT=[],hT=[];(()=>{let e=`lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,1n,9,16,o,,x,1i,3,,i,,7,a,2,t,3,1k,,,7,2,2,2,3,9,,a,2,q,,2,3,1k,,,5,4,2,2,3,3,,u,2,3,,b,3,1k,,,8,,3,,3,k,2,m,6,,3,1k,,,7,2,2,2,3,7,3,a,2,u,,1n,5,3,3,,4,9,,14,5,1j,,,7,,3,,4,7,2,b,2,t,3,1k,,,7,,3,,4,7,2,b,2,f,,c,4,1j,2,,7,,3,,4,9,,a,2,t,3,1y,,4,6,,,,8,i,2,1p,,,8,c,8,2q,,,a,b,7,21,2,r,,,,,,4,2,1d,k,,2,5,b,,10,9,,2u,b,,6,n,4,4,3,g,4,d,,,3,6,,f,,jj,3,qa,4,s,3,t,2,u,2,1s,w,9,,19,3,,,39,2,y,,3a,c,4,c,63,5,1l,a,,,,,2,o,2,,1c,1a,2,c,k,5,1b,h,12,9,c,3,u,d,1k,e,1c,k,48,3,,l,4,,6,,2,3,5i,1s,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,n,5,4,,2b,2,1e,i,q,i,d,,12,8,p,d,18,4,1b,e,10,,1v,e,c,,8,2,1a,,1f,,,3,2,2,5,2,,,15,5,5,2,6k,8,,2,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,1t,5,8t,2,25,6,1y,b,1d,4,3e,3,1h,f,15,,2,2,a,4,19,b,7,,1p,3,10,e,g,2,18,,c,3,1c,e,8,4,,2,2k,c,6,,2,,4d,c,l,4,1j,2,,7,2,2,2,3,9,,a,2,2,7,3,5,1v,9,,,2,,,4,,5,,,e,2,2a,i,n,,29,k,6j,7,2,9,r,2,2a,h,2y,d,2t,3,2,a,74,f,6t,6,,2,2,4,,,,2,3x,7,2,7,3,,s,a,14,7,,4,8,,9,b,1a,g,5i,8,5j,8,,8,2a,m,,e,3e,6,3,,,2,,7,,,1u,5,,2,,5,9n,4,9,2,,,1c,7,3,5,n,,44l,,6,f,8ug,i,1xc,5,1n,7,t4,,,1j,7,4,29,,b,2,f57,2,3mp,1a,2,n,f2,5,3,6,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,2s,,4g,7,af,,1p,4,e4,4,72,2,6r,,2,,7,2,5,,d6,7,31,7,240,5`.split(`,`).map(e=>e?parseInt(e,36):1);for(let t=0,n=0;t<e.length;t++)(t%2?hT:mT).push(n+=e[t])})();function gT(e){if(e<768)return!1;for(let t=0,n=mT.length;;){let r=t+n>>1;if(e<mT[r])n=r;else if(e>=hT[r])t=r+1;else return!0;if(t==n)return!1}}function _T(e){return e>=127462&&e<=127487}var vT=8205;function yT(e,t,n=!0,r=!0){return(n?bT:xT)(e,t,r)}function bT(e,t,n){if(t==e.length)return t;t&&CT(e.charCodeAt(t))&&wT(e.charCodeAt(t-1))&&t--;let r=ST(e,t);for(t+=TT(r);t<e.length;){let i=ST(e,t);if(r==vT||i==vT||n&&gT(i))t+=TT(i),r=i;else if(_T(i)){let n=0,r=t-2;for(;r>=0&&_T(ST(e,r));)n++,r-=2;if(n%2==0)break;t+=2}else break}return t}function xT(e,t,n){for(;t>1;){let r=bT(e,t-2,n);if(r<t)return r;t--}return 0}function ST(e,t){let n=e.charCodeAt(t);if(!wT(n)||t+1==e.length)return n;let r=e.charCodeAt(t+1);return CT(r)?(n-55296<<10)+(r-56320)+65536:n}function CT(e){return e>=56320&&e<57344}function wT(e){return e>=55296&&e<56320}function TT(e){return e<65536?1:2}var ET=class e{lineAt(e){if(e<0||e>this.length)throw RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,t,n){[e,t]=IT(this,e,t);let r=[];return this.decompose(0,e,r,2),n.length&&n.decompose(0,n.length,r,3),this.decompose(t,this.length,r,1),OT.from(r,this.length-(t-e)+n.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,t=this.length){[e,t]=IT(this,e,t);let n=[];return this.decompose(e,t,n,0),OT.from(n,t-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let t=this.scanIdentical(e,1),n=this.length-this.scanIdentical(e,-1),r=new MT(this),i=new MT(e);for(let e=t,a=t;;){if(r.next(e),i.next(e),e=0,r.lineBreak!=i.lineBreak||r.done!=i.done||r.value!=i.value)return!1;if(a+=r.value.length,r.done||a>=n)return!0}}iter(e=1){return new MT(this,e)}iterRange(e,t=this.length){return new NT(this,e,t)}iterLines(e,t){let n;if(e==null)n=this.iter();else{t??=this.lines+1;let r=this.line(e).from;n=this.iterRange(r,Math.max(r,t==this.lines+1?this.length:t<=1?0:this.line(t-1).to))}return new PT(n)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(t){if(t.length==0)throw RangeError(`A document must have at least one line`);return t.length==1&&!t[0]?e.empty:t.length<=32?new DT(t):OT.from(DT.split(t,[]))}},DT=class e extends ET{constructor(e,t=kT(e)){super(),this.text=e,this.length=t}get lines(){return this.text.length}get children(){return null}lineInner(e,t,n,r){for(let i=0;;i++){let a=this.text[i],o=r+a.length;if((t?n:o)>=e)return new FT(r,o,n,a);r=o+1,n++}}decompose(t,n,r,i){let a=t<=0&&n>=this.length?this:new e(jT(this.text,t,n),Math.min(n,this.length)-Math.max(0,t));if(i&1){let t=r.pop(),n=AT(a.text,t.text.slice(),0,a.length);if(n.length<=32)r.push(new e(n,t.length+a.length));else{let t=n.length>>1;r.push(new e(n.slice(0,t)),new e(n.slice(t)))}}else r.push(a)}replace(t,n,r){if(!(r instanceof e))return super.replace(t,n,r);[t,n]=IT(this,t,n);let i=AT(this.text,AT(r.text,jT(this.text,0,t)),n),a=this.length+r.length-(n-t);return i.length<=32?new e(i,a):OT.from(e.split(i,[]),a)}sliceString(e,t=this.length,n=`
29
29
  `){[e,t]=IT(this,e,t);let r=``;for(let i=0,a=0;i<=t&&a<this.text.length;a++){let o=this.text[a],s=i+o.length;i>e&&a&&(r+=n),e<s&&t>i&&(r+=o.slice(Math.max(0,e-i),t-i)),i=s+1}return r}flatten(e){for(let t of this.text)e.push(t)}scanIdentical(){return 0}static split(t,n){let r=[],i=-1;for(let a of t)r.push(a),i+=a.length+1,r.length==32&&(n.push(new e(r,i)),r=[],i=-1);return i>-1&&n.push(new e(r,i)),n}},OT=class e extends ET{constructor(e,t){super(),this.children=e,this.length=t,this.lines=0;for(let t of e)this.lines+=t.lines}lineInner(e,t,n,r){for(let i=0;;i++){let a=this.children[i],o=r+a.length,s=n+a.lines-1;if((t?s:o)>=e)return a.lineInner(e,t,n,r);r=o+1,n=s+1}}decompose(e,t,n,r){for(let i=0,a=0;a<=t&&i<this.children.length;i++){let o=this.children[i],s=a+o.length;if(e<=s&&t>=a){let i=r&(a<=e|(s>=t?2:0));a>=e&&s<=t&&!i?n.push(o):o.decompose(e-a,t-a,n,i)}a=s+1}}replace(t,n,r){if([t,n]=IT(this,t,n),r.lines<this.lines)for(let i=0,a=0;i<this.children.length;i++){let o=this.children[i],s=a+o.length;if(t>=a&&n<=s){let c=o.replace(t-a,n-a,r),l=this.lines-o.lines+c.lines;if(c.lines<l>>4&&c.lines>l>>6){let a=this.children.slice();return a[i]=c,new e(a,this.length-(n-t)+r.length)}return super.replace(a,s,c)}a=s+1}return super.replace(t,n,r)}sliceString(e,t=this.length,n=`
30
30
  `){[e,t]=IT(this,e,t);let r=``;for(let i=0,a=0;i<this.children.length&&a<=t;i++){let o=this.children[i],s=a+o.length;a>e&&i&&(r+=n),e<s&&t>a&&(r+=o.sliceString(e-a,t-a,n)),a=s+1}return r}flatten(e){for(let t of this.children)t.flatten(e)}scanIdentical(t,n){if(!(t instanceof e))return 0;let r=0,[i,a,o,s]=n>0?[0,0,this.children.length,t.children.length]:[this.children.length-1,t.children.length-1,-1,-1];for(;;i+=n,a+=n){if(i==o||a==s)return r;let e=this.children[i],c=t.children[a];if(e!=c)return r+e.scanIdentical(c,n);r+=e.length+1}}static from(t,n=t.reduce((e,t)=>e+t.length+1,-1)){let r=0;for(let e of t)r+=e.lines;if(r<32){let e=[];for(let n of t)n.flatten(e);return new DT(e,n)}let i=Math.max(32,r>>5),a=i<<1,o=i>>1,s=[],c=0,l=-1,u=[];function d(t){let n;if(t.lines>a&&t instanceof e)for(let e of t.children)d(e);else t.lines>o&&(c>o||!c)?(f(),s.push(t)):t instanceof DT&&c&&(n=u[u.length-1])instanceof DT&&t.lines+n.lines<=32?(c+=t.lines,l+=t.length+1,u[u.length-1]=new DT(n.text.concat(t.text),n.length+1+t.length)):(c+t.lines>i&&f(),c+=t.lines,l+=t.length+1,u.push(t))}function f(){c!=0&&(s.push(u.length==1?u[0]:e.from(u,l)),l=-1,c=u.length=0)}for(let e of t)d(e);return f(),s.length==1?s[0]:new e(s,n)}};ET.empty=new DT([``],0);function kT(e){let t=-1;for(let n of e)t+=n.length+1;return t}function AT(e,t,n=0,r=1e9){for(let i=0,a=0,o=!0;a<e.length&&i<=r;a++){let s=e[a],c=i+s.length;c>=n&&(c>r&&(s=s.slice(0,r-i)),i<n&&(s=s.slice(n-i)),o?(t[t.length-1]+=s,o=!1):t.push(s)),i=c+1}return t}function jT(e,t,n){return AT(e,[``],t,n)}var MT=class{constructor(e,t=1){this.dir=t,this.done=!1,this.lineBreak=!1,this.value=``,this.nodes=[e],this.offsets=[t>0?1:(e instanceof DT?e.text.length:e.children.length)<<1]}nextInner(e,t){for(this.done=this.lineBreak=!1;;){let n=this.nodes.length-1,r=this.nodes[n],i=this.offsets[n],a=i>>1,o=r instanceof DT?r.text.length:r.children.length;if(a==(t>0?o:0)){if(n==0)return this.done=!0,this.value=``,this;t>0&&this.offsets[n-1]++,this.nodes.pop(),this.offsets.pop()}else if((i&1)==(t>0?0:1)){if(this.offsets[n]+=t,e==0)return this.lineBreak=!0,this.value=`
31
31
  `,this;e--}else if(r instanceof DT){let i=r.text[a+(t<0?-1:0)];if(this.offsets[n]+=t,i.length>Math.max(0,e))return this.value=e==0?i:t>0?i.slice(e):i.slice(0,i.length-e),this;e-=i.length}else{let i=r.children[a+(t<0?-1:0)];e>i.length?(e-=i.length,this.offsets[n]+=t):(t<0&&this.offsets[n]--,this.nodes.push(i),this.offsets.push(t>0?1:(i instanceof DT?i.text.length:i.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}},NT=class{constructor(e,t,n){this.value=``,this.done=!1,this.cursor=new MT(e,t>n?-1:1),this.pos=t>n?e.length:0,this.from=Math.min(t,n),this.to=Math.max(t,n)}nextInner(e,t){if(t<0?this.pos<=this.from:this.pos>=this.to)return this.value=``,this.done=!0,this;e+=Math.max(0,t<0?this.pos-this.to:this.from-this.pos);let n=t<0?this.pos-this.from:this.to-this.pos;e>n&&(e=n),n-=e;let{value:r}=this.cursor.next(e);return this.pos+=(r.length+e)*t,this.value=r.length<=n?r:t<0?r.slice(r.length-n):r.slice(0,n),this.done=!this.value,this}next(e=0){return e<0?e=Math.max(e,this.from-this.pos):e>0&&(e=Math.min(e,this.to-this.pos)),this.nextInner(e,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&this.value!=``}},PT=class{constructor(e){this.inner=e,this.afterBreak=!0,this.value=``,this.done=!1}next(e=0){let{done:t,lineBreak:n,value:r}=this.inner.next(e);return t&&this.afterBreak?(this.value=``,this.afterBreak=!1):t?(this.done=!0,this.value=``):n?this.afterBreak?this.value=``:(this.afterBreak=!0,this.next()):(this.value=r,this.afterBreak=!1),this}get lineBreak(){return!1}};typeof Symbol<`u`&&(ET.prototype[Symbol.iterator]=function(){return this.iter()},MT.prototype[Symbol.iterator]=NT.prototype[Symbol.iterator]=PT.prototype[Symbol.iterator]=function(){return this});var FT=class{constructor(e,t,n,r){this.from=e,this.to=t,this.number=n,this.text=r}get length(){return this.to-this.from}};function IT(e,t,n){return t=Math.max(0,Math.min(e.length,t)),[t,Math.max(t,Math.min(e.length,n))]}function LT(e,t,n=!0,r=!0){return yT(e,t,n,r)}function RT(e){return e>=56320&&e<57344}function zT(e){return e>=55296&&e<56320}function BT(e,t){let n=e.charCodeAt(t);if(!zT(n)||t+1==e.length)return n;let r=e.charCodeAt(t+1);return RT(r)?(n-55296<<10)+(r-56320)+65536:n}function VT(e){return e<65536?1:2}var HT=/\r\n?|\n/,UT=(function(e){return e[e.Simple=0]=`Simple`,e[e.TrackDel=1]=`TrackDel`,e[e.TrackBefore=2]=`TrackBefore`,e[e.TrackAfter=3]=`TrackAfter`,e})(UT||={}),WT=class e{constructor(e){this.sections=e}get length(){let e=0;for(let t=0;t<this.sections.length;t+=2)e+=this.sections[t];return e}get newLength(){let e=0;for(let t=0;t<this.sections.length;t+=2){let n=this.sections[t+1];e+=n<0?this.sections[t]:n}return e}get empty(){return this.sections.length==0||this.sections.length==2&&this.sections[1]<0}iterGaps(e){for(let t=0,n=0,r=0;t<this.sections.length;){let i=this.sections[t++],a=this.sections[t++];a<0?(e(n,r,i),r+=i):r+=a,n+=i}}iterChangedRanges(e,t=!1){JT(this,e,t)}get invertedDesc(){let t=[];for(let e=0;e<this.sections.length;){let n=this.sections[e++],r=this.sections[e++];r<0?t.push(n,r):t.push(r,n)}return new e(t)}composeDesc(e){return this.empty?e:e.empty?this:XT(this,e)}mapDesc(e,t=!1){return e.empty?this:YT(this,e,t)}mapPos(e,t=-1,n=UT.Simple){let r=0,i=0;for(let a=0;a<this.sections.length;){let o=this.sections[a++],s=this.sections[a++],c=r+o;if(s<0){if(c>e)return i+(e-r);i+=o}else{if(n!=UT.Simple&&c>=e&&(n==UT.TrackDel&&r<e&&c>e||n==UT.TrackBefore&&r<e||n==UT.TrackAfter&&c>e))return null;if(c>e||c==e&&t<0&&!o)return e==r||t<0?i:i+s;i+=s}r=c}if(e>r)throw RangeError(`Position ${e} is out of range for changeset of length ${r}`);return i}touchesRange(e,t=e){for(let n=0,r=0;n<this.sections.length&&r<=t;){let i=this.sections[n++],a=this.sections[n++],o=r+i;if(a>=0&&r<=t&&o>=e)return r<e&&o>t?`cover`:!0;r=o}return!1}toString(){let e=``;for(let t=0;t<this.sections.length;){let n=this.sections[t++],r=this.sections[t++];e+=(e?` `:``)+n+(r>=0?`:`+r:``)}return e}toJSON(){return this.sections}static fromJSON(t){if(!Array.isArray(t)||t.length%2||t.some(e=>typeof e!=`number`))throw RangeError(`Invalid JSON representation of ChangeDesc`);return new e(t)}static create(t){return new e(t)}},GT=class e extends WT{constructor(e,t){super(e),this.inserted=t}apply(e){if(this.length!=e.length)throw RangeError(`Applying change set to a document with the wrong length`);return JT(this,(t,n,r,i,a)=>e=e.replace(r,r+(n-t),a),!1),e}mapDesc(e,t=!1){return YT(this,e,t,!0)}invert(t){let n=this.sections.slice(),r=[];for(let e=0,i=0;e<n.length;e+=2){let a=n[e],o=n[e+1];if(o>=0){n[e]=o,n[e+1]=a;let s=e>>1;for(;r.length<s;)r.push(ET.empty);r.push(a?t.slice(i,i+a):ET.empty)}i+=a}return new e(n,r)}compose(e){return this.empty?e:e.empty?this:XT(this,e,!0)}map(e,t=!1){return e.empty?this:YT(this,e,t,!0)}iterChanges(e,t=!1){JT(this,e,t)}get desc(){return WT.create(this.sections)}filter(t){let n=[],r=[],i=[],a=new ZT(this);done:for(let e=0,o=0;;){let s=e==t.length?1e9:t[e++];for(;o<s||o==s&&a.len==0;){if(a.done)break done;let e=Math.min(a.len,s-o);KT(i,e,-1);let t=a.ins==-1?-1:a.off==0?a.ins:0;KT(n,e,t),t>0&&qT(r,n,a.text),a.forward(e),o+=e}let c=t[e++];for(;o<c;){if(a.done)break done;let e=Math.min(a.len,c-o);KT(n,e,-1),KT(i,e,a.ins==-1?-1:a.off==0?a.ins:0),a.forward(e),o+=e}}return{changes:new e(n,r),filtered:WT.create(i)}}toJSON(){let e=[];for(let t=0;t<this.sections.length;t+=2){let n=this.sections[t],r=this.sections[t+1];r<0?e.push(n):r==0?e.push([n]):e.push([n].concat(this.inserted[t>>1].toJSON()))}return e}static of(t,n,r){let i=[],a=[],o=0,s=null;function c(t=!1){if(!t&&!i.length)return;o<n&&KT(i,n-o,-1);let r=new e(i,a);s=s?s.compose(r.map(s)):r,i=[],a=[],o=0}function l(t){if(Array.isArray(t))for(let e of t)l(e);else if(t instanceof e){if(t.length!=n)throw RangeError(`Mismatched change set length (got ${t.length}, expected ${n})`);c(),s=s?s.compose(t.map(s)):t}else{let{from:e,to:s=e,insert:l}=t;if(e>s||e<0||s>n)throw RangeError(`Invalid change range ${e} to ${s} (in doc of length ${n})`);let u=l?typeof l==`string`?ET.of(l.split(r||HT)):l:ET.empty,d=u.length;if(e==s&&d==0)return;e<o&&c(),e>o&&KT(i,e-o,-1),KT(i,s-e,d),qT(a,i,u),o=s}}return l(t),c(!s),s}static empty(t){return new e(t?[t,-1]:[],[])}static fromJSON(t){if(!Array.isArray(t))throw RangeError(`Invalid JSON representation of ChangeSet`);let n=[],r=[];for(let e=0;e<t.length;e++){let i=t[e];if(typeof i==`number`)n.push(i,-1);else if(!Array.isArray(i)||typeof i[0]!=`number`||i.some((e,t)=>t&&typeof e!=`string`))throw RangeError(`Invalid JSON representation of ChangeSet`);else if(i.length==1)n.push(i[0],0);else{for(;r.length<e;)r.push(ET.empty);r[e]=ET.of(i.slice(1)),n.push(i[0],r[e].length)}}return new e(n,r)}static createSet(t,n){return new e(t,n)}};function KT(e,t,n,r=!1){if(t==0&&n<=0)return;let i=e.length-2;i>=0&&n<=0&&n==e[i+1]?e[i]+=t:i>=0&&t==0&&e[i]==0?e[i+1]+=n:r?(e[i]+=t,e[i+1]+=n):e.push(t,n)}function qT(e,t,n){if(n.length==0)return;let r=t.length-2>>1;if(r<e.length)e[e.length-1]=e[e.length-1].append(n);else{for(;e.length<r;)e.push(ET.empty);e.push(n)}}function JT(e,t,n){let r=e.inserted;for(let i=0,a=0,o=0;o<e.sections.length;){let s=e.sections[o++],c=e.sections[o++];if(c<0)i+=s,a+=s;else{let l=i,u=a,d=ET.empty;for(;l+=s,u+=c,c&&r&&(d=d.append(r[o-2>>1])),!(n||o==e.sections.length||e.sections[o+1]<0);)s=e.sections[o++],c=e.sections[o++];t(i,l,a,u,d),i=l,a=u}}}function YT(e,t,n,r=!1){let i=[],a=r?[]:null,o=new ZT(e),s=new ZT(t);for(let e=-1;;)if(o.done&&s.len||s.done&&o.len)throw Error(`Mismatched change set lengths`);else if(o.ins==-1&&s.ins==-1){let e=Math.min(o.len,s.len);KT(i,e,-1),o.forward(e),s.forward(e)}else if(s.ins>=0&&(o.ins<0||e==o.i||o.off==0&&(s.len<o.len||s.len==o.len&&!n))){let t=s.len;for(KT(i,s.ins,-1);t;){let n=Math.min(o.len,t);o.ins>=0&&e<o.i&&o.len<=n&&(KT(i,0,o.ins),a&&qT(a,i,o.text),e=o.i),o.forward(n),t-=n}s.next()}else if(o.ins>=0){let t=0,n=o.len;for(;n;)if(s.ins==-1){let e=Math.min(n,s.len);t+=e,n-=e,s.forward(e)}else if(s.ins==0&&s.len<n)n-=s.len,s.next();else break;KT(i,t,e<o.i?o.ins:0),a&&e<o.i&&qT(a,i,o.text),e=o.i,o.forward(o.len-n)}else if(o.done&&s.done)return a?GT.createSet(i,a):WT.create(i);else throw Error(`Mismatched change set lengths`)}function XT(e,t,n=!1){let r=[],i=n?[]:null,a=new ZT(e),o=new ZT(t);for(let e=!1;;)if(a.done&&o.done)return i?GT.createSet(r,i):WT.create(r);else if(a.ins==0)KT(r,a.len,0,e),a.next();else if(o.len==0&&!o.done)KT(r,0,o.ins,e),i&&qT(i,r,o.text),o.next();else if(a.done||o.done)throw Error(`Mismatched change set lengths`);else{let t=Math.min(a.len2,o.len),n=r.length;if(a.ins==-1){let n=o.ins==-1?-1:o.off?0:o.ins;KT(r,t,n,e),i&&n&&qT(i,r,o.text)}else o.ins==-1?(KT(r,a.off?0:a.len,t,e),i&&qT(i,r,a.textBit(t))):(KT(r,a.off?0:a.len,o.off?0:o.ins,e),i&&!o.off&&qT(i,r,o.text));e=(a.ins>t||o.ins>=0&&o.len>t)&&(e||r.length>n),a.forward2(t),o.forward(t)}}var ZT=class{constructor(e){this.set=e,this.i=0,this.next()}next(){let{sections:e}=this.set;this.i<e.length?(this.len=e[this.i++],this.ins=e[this.i++]):(this.len=0,this.ins=-2),this.off=0}get done(){return this.ins==-2}get len2(){return this.ins<0?this.len:this.ins}get text(){let{inserted:e}=this.set,t=this.i-2>>1;return t>=e.length?ET.empty:e[t]}textBit(e){let{inserted:t}=this.set,n=this.i-2>>1;return n>=t.length&&!e?ET.empty:t[n].slice(this.off,e==null?void 0:this.off+e)}forward(e){e==this.len?this.next():(this.len-=e,this.off+=e)}forward2(e){this.ins==-1?this.forward(e):e==this.ins?this.next():(this.ins-=e,this.off+=e)}},QT=class e{constructor(e,t,n,r){this.from=e,this.to=t,this.flags=n,this.goalColumn=r}get anchor(){return this.flags&32?this.to:this.from}get head(){return this.flags&32?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return this.flags&8?-1:this.flags&16?1:0}get undirectional(){return(this.flags&64)>0}get bidiLevel(){let e=this.flags&7;return e==7?null:e}map(t,n=-1){let r,i;return this.empty?r=i=t.mapPos(this.from,n):(r=t.mapPos(this.from,1),i=t.mapPos(this.to,-1)),r==this.from&&i==this.to?this:new e(r,i,this.flags,this.goalColumn)}extend(e,t=e,n=0){if(e<=this.anchor&&t>=this.anchor)return G.range(e,t,void 0,void 0,n);let r=Math.abs(e-this.anchor)>Math.abs(t-this.anchor)?e:t;return G.range(this.anchor,r,void 0,void 0,n)}eq(e,t=!1){return this.anchor==e.anchor&&this.head==e.head&&this.goalColumn==e.goalColumn&&(!t||!this.empty||this.assoc==e.assoc)}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(e){if(!e||typeof e.anchor!=`number`||typeof e.head!=`number`)throw RangeError(`Invalid JSON representation for SelectionRange`);return G.range(e.anchor,e.head)}static create(t,n,r,i){return new e(t,n,r,i)}},G=class e{constructor(e,t){this.ranges=e,this.mainIndex=t}map(t,n=-1){return t.empty?this:e.create(this.ranges.map(e=>e.map(t,n)),this.mainIndex)}eq(e,t=!1){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let n=0;n<this.ranges.length;n++)if(!this.ranges[n].eq(e.ranges[n],t))return!1;return!0}get main(){return this.ranges[this.mainIndex]}asSingle(){return this.ranges.length==1?this:new e([this.main],0)}addRange(t,n=!0){return e.create([t].concat(this.ranges),n?0:this.mainIndex+1)}replaceRange(t,n=this.mainIndex){let r=this.ranges.slice();return r[n]=t,e.create(r,this.mainIndex)}toJSON(){return{ranges:this.ranges.map(e=>e.toJSON()),main:this.mainIndex}}static fromJSON(t){if(!t||!Array.isArray(t.ranges)||typeof t.main!=`number`||t.main>=t.ranges.length)throw RangeError(`Invalid JSON representation for EditorSelection`);return new e(t.ranges.map(e=>QT.fromJSON(e)),t.main)}static single(t,n=t){return new e([e.range(t,n)],0)}static create(t,n=0){if(t.length==0)throw RangeError(`A selection needs at least one range`);for(let r=0,i=0;i<t.length;i++){let a=t[i];if(a.empty?a.from<=r:a.from<r)return e.normalized(t.slice(),n);r=a.to}return new e(t,n)}static cursor(e,t=0,n,r){return QT.create(e,e,(t==0?0:t<0?8:16)|(n==null?7:Math.min(6,n)),r)}static range(e,t,n,r,i){let a=r==null?7:Math.min(6,r);return!i&&e!=t&&(i=t<e?1:-1),i&&(a|=i<0?8:16),t<e?QT.create(t,e,a|32,n):QT.create(e,t,a,n)}static undirectionalRange(e,t){return QT.create(e,t,64,void 0)}static normalized(t,n=0){let r=t[n];t.sort((e,t)=>e.from-t.from),n=t.indexOf(r);for(let r=1;r<t.length;r++){let i=t[r],a=t[r-1];if(i.empty?i.from<=a.to:i.from<a.to){let o=a.from,s=Math.max(i.to,a.to);r<=n&&n--,t.splice(--r,2,i.anchor>i.head?e.range(s,o):e.range(o,s))}}return new e(t,n)}};function $T(e,t){for(let n of e.ranges)if(n.to>t)throw RangeError(`Selection points outside of document`)}var eE=0,K=class e{constructor(e,t,n,r,i){this.combine=e,this.compareInput=t,this.compare=n,this.isStatic=r,this.id=eE++,this.default=e([]),this.extensions=typeof i==`function`?i(this):i}get reader(){return this}static define(t={}){return new e(t.combine||(e=>e),t.compareInput||((e,t)=>e===t),t.compare||(t.combine?(e,t)=>e===t:tE),!!t.static,t.enables)}of(e){return new nE([],this,0,e)}compute(e,t){if(this.isStatic)throw Error(`Can't compute a static facet`);return new nE(e,this,1,t)}computeN(e,t){if(this.isStatic)throw Error(`Can't compute a static facet`);return new nE(e,this,2,t)}from(e,t){return t||=e=>e,this.compute([e],n=>t(n.field(e)))}};function tE(e,t){return e==t||e.length==t.length&&e.every((e,n)=>e===t[n])}var nE=class{constructor(e,t,n,r){this.dependencies=e,this.facet=t,this.type=n,this.value=r,this.id=eE++}dynamicSlot(e){let t=this.value,n=this.facet.compareInput,r=this.id,i=e[r]>>1,a=this.type==2,o=!1,s=!1,c=[];for(let t of this.dependencies)t==`doc`?o=!0:t==`selection`?s=!0:(e[t.id]??1)&1||c.push(e[t.id]);return{create(e){return e.values[i]=t(e),1},update(e,r){if(o&&r.docChanged||s&&(r.docChanged||r.selection)||iE(e,c)){let r=t(e);if(a?!rE(r,e.values[i],n):!n(r,e.values[i]))return e.values[i]=r,1}return 0},reconfigure:(e,o)=>{let s,c=o.config.address[r];if(c!=null){let r=_E(o,c);if(this.dependencies.every(t=>t instanceof K?o.facet(t)===e.facet(t):t instanceof sE?o.field(t,!1)==e.field(t,!1):!0)||(a?rE(s=t(e),r,n):n(s=t(e),r)))return e.values[i]=r,0}else s=t(e);return e.values[i]=s,1}}}get extension(){return this}};function rE(e,t,n){if(e.length!=t.length)return!1;for(let r=0;r<e.length;r++)if(!n(e[r],t[r]))return!1;return!0}function iE(e,t){let n=!1;for(let r of t)gE(e,r)&1&&(n=!0);return n}function aE(e,t,n){let r=n.map(t=>e[t.id]),i=n.map(e=>e.type),a=r.filter(e=>!(e&1)),o=e[t.id]>>1;function s(e){let n=[];for(let t=0;t<r.length;t++){let a=_E(e,r[t]);if(i[t]==2)for(let e of a)n.push(e);else n.push(a)}return t.combine(n)}return{create(e){for(let t of r)gE(e,t);return e.values[o]=s(e),1},update(e,n){if(!iE(e,a))return 0;let r=s(e);return t.compare(r,e.values[o])?0:(e.values[o]=r,1)},reconfigure(e,i){let a=iE(e,r),c=i.config.facets[t.id],l=i.facet(t);if(c&&!a&&tE(n,c))return e.values[o]=l,0;let u=s(e);return t.compare(u,l)?(e.values[o]=l,0):(e.values[o]=u,1)}}}var oE=K.define({static:!0}),sE=class e{constructor(e,t,n,r,i){this.id=e,this.createF=t,this.updateF=n,this.compareF=r,this.spec=i,this.provides=void 0}static define(t){let n=new e(eE++,t.create,t.update,t.compare||((e,t)=>e===t),t);return t.provide&&(n.provides=t.provide(n)),n}create(e){return(e.facet(oE).find(e=>e.field==this)?.create||this.createF)(e)}slot(e){let t=e[this.id]>>1;return{create:e=>(e.values[t]=this.create(e),1),update:(e,n)=>{let r=e.values[t],i=this.updateF(r,n);return this.compareF(r,i)?0:(e.values[t]=i,1)},reconfigure:(e,n)=>{let r=e.facet(oE),i=n.facet(oE),a;return(a=r.find(e=>e.field==this))&&a!=i.find(e=>e.field==this)?(e.values[t]=a.create(e),1):n.config.address[this.id]==null?(e.values[t]=this.create(e),1):(e.values[t]=n.field(this),0)}}}init(e){return[this,oE.of({field:this,create:e})]}get extension(){return this}},cE={lowest:4,low:3,default:2,high:1,highest:0};function lE(e){return t=>new dE(t,e)}var uE={highest:lE(cE.highest),high:lE(cE.high),default:lE(cE.default),low:lE(cE.low),lowest:lE(cE.lowest)},dE=class{constructor(e,t){this.inner=e,this.prec=t}get extension(){return this}},fE=class e{of(e){return new pE(this,e)}reconfigure(t){return e.reconfigure.of({compartment:this,extension:t})}get(e){return e.config.compartments.get(this)}},pE=class{constructor(e,t){this.compartment=e,this.inner=t}get extension(){return this}},mE=class e{constructor(e,t,n,r,i,a){for(this.base=e,this.compartments=t,this.dynamicSlots=n,this.address=r,this.staticValues=i,this.facets=a,this.statusTemplate=[];this.statusTemplate.length<n.length;)this.statusTemplate.push(0)}staticFacet(e){let t=this.address[e.id];return t==null?e.default:this.staticValues[t>>1]}static resolve(t,n,r){let i=[],a=Object.create(null),o=new Map;for(let e of hE(t,n,o))e instanceof sE?i.push(e):(a[e.facet.id]||(a[e.facet.id]=[])).push(e);let s=Object.create(null),c=[],l=[];for(let e of i)s[e.id]=l.length<<1,l.push(t=>e.slot(t));let u=r?.config.facets;for(let e in a){let t=a[e],n=t[0].facet,i=u&&u[e]||[];if(t.every(e=>e.type==0)){if(s[n.id]=c.length<<1|1,tE(i,t))c.push(r.facet(n));else{let e=n.combine(t.map(e=>e.value));c.push(r&&n.compare(e,r.facet(n))?r.facet(n):e)}}else{for(let e of t)e.type==0?(s[e.id]=c.length<<1|1,c.push(e.value)):(s[e.id]=l.length<<1,l.push(t=>e.dynamicSlot(t)));s[n.id]=l.length<<1,l.push(e=>aE(e,n,t))}}let d=l.map(e=>e(s));return new e(t,o,d,s,c,a)}};function hE(e,t,n){let r=[[],[],[],[],[]],i=new Map;function a(e,o){let s=i.get(e);if(s!=null){if(s<=o)return;let t=r[s].indexOf(e);t>-1&&r[s].splice(t,1),e instanceof pE&&n.delete(e.compartment)}if(i.set(e,o),Array.isArray(e))for(let t of e)a(t,o);else if(e instanceof pE){if(n.has(e.compartment))throw RangeError(`Duplicate use of compartment in extensions`);let r=t.get(e.compartment)||e.inner;n.set(e.compartment,r),a(r,o)}else if(e instanceof dE)a(e.inner,e.prec);else if(e instanceof sE)r[o].push(e),e.provides&&a(e.provides,o);else if(e instanceof nE)r[o].push(e),e.facet.extensions&&a(e.facet.extensions,cE.default);else{let t=e.extension;if(!t)throw Error(`Unrecognized extension value in extension set (${e}).`);if(t==e)throw Error(`Unrecognized extension value in extension set (${e}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);a(t,o)}}return a(e,cE.default),r.reduce((e,t)=>e.concat(t))}function gE(e,t){if(t&1)return 2;let n=t>>1,r=e.status[n];if(r==4)throw Error(`Cyclic dependency between fields and/or facets`);if(r&2)return r;e.status[n]=4;let i=e.computeSlot(e,e.config.dynamicSlots[n]);return e.status[n]=2|i}function _E(e,t){return t&1?e.config.staticValues[t>>1]:e.values[t>>1]}var vE=K.define(),yE=K.define({combine:e=>e.some(e=>e),static:!0}),bE=K.define({combine:e=>e.length?e[0]:void 0,static:!0}),xE=K.define(),SE=K.define(),CE=K.define(),wE=K.define({combine:e=>e.length?e[0]:!1}),TE=class{constructor(e,t){this.type=e,this.value=t}static define(){return new EE}},EE=class{of(e){return new TE(this,e)}},DE=class{constructor(e){this.map=e}of(e){return new OE(this,e)}},OE=class e{constructor(e,t){this.type=e,this.value=t}map(t){let n=this.type.map(this.value,t);return n===void 0?void 0:n==this.value?this:new e(this.type,n)}is(e){return this.type==e}static define(e={}){return new DE(e.map||(e=>e))}static mapEffects(e,t){if(!e.length)return e;let n=[];for(let r of e){let e=r.map(t);e&&n.push(e)}return n}};OE.reconfigure=OE.define(),OE.appendConfig=OE.define();var kE=class e{constructor(t,n,r,i,a,o){this.startState=t,this.changes=n,this.selection=r,this.effects=i,this.annotations=a,this.scrollIntoView=o,this._doc=null,this._state=null,r&&$T(r,n.newLength),a.some(t=>t.type==e.time)||(this.annotations=a.concat(e.time.of(Date.now())))}static create(t,n,r,i,a,o){return new e(t,n,r,i,a,o)}get newDoc(){return this._doc||=this.changes.apply(this.startState.doc)}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){return this._state||this.startState.applyTransaction(this),this._state}annotation(e){for(let t of this.annotations)if(t.type==e)return t.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(t){let n=this.annotation(e.userEvent);return!!(n&&(n==t||n.length>t.length&&n.slice(0,t.length)==t&&n[t.length]==`.`))}};kE.time=TE.define(),kE.userEvent=TE.define(),kE.addToHistory=TE.define(),kE.remote=TE.define();function AE(e,t){let n=[];for(let r=0,i=0;;){let a,o;if(r<e.length&&(i==t.length||t[i]>=e[r]))a=e[r++],o=e[r++];else if(i<t.length)a=t[i++],o=t[i++];else return n;!n.length||n[n.length-1]<a?n.push(a,o):n[n.length-1]<o&&(n[n.length-1]=o)}}function jE(e,t,n){let r,i,a;return n?(r=t.changes,i=GT.empty(t.changes.length),a=e.changes.compose(t.changes)):(r=t.changes.map(e.changes),i=e.changes.mapDesc(t.changes,!0),a=e.changes.compose(r)),{changes:a,selection:t.selection?t.selection.map(i):e.selection?.map(r),effects:OE.mapEffects(e.effects,r).concat(OE.mapEffects(t.effects,i)),annotations:e.annotations.length?e.annotations.concat(t.annotations):t.annotations,scrollIntoView:e.scrollIntoView||t.scrollIntoView}}function ME(e,t,n){let r=t.selection,i=LE(t.annotations);return t.userEvent&&(i=i.concat(kE.userEvent.of(t.userEvent))),{changes:t.changes instanceof GT?t.changes:GT.of(t.changes||[],n,e.facet(bE)),selection:r&&(r instanceof G?r:G.single(r.anchor,r.head)),effects:LE(t.effects),annotations:i,scrollIntoView:!!t.scrollIntoView}}function NE(e,t,n){let r=ME(e,t.length?t[0]:{},e.doc.length);t.length&&t[0].filter===!1&&(n=!1);for(let i=1;i<t.length;i++){t[i].filter===!1&&(n=!1);let a=!!t[i].sequential;r=jE(r,ME(e,t[i],a?r.changes.newLength:e.doc.length),a)}let i=kE.create(e,r.changes,r.selection,r.effects,r.annotations,r.scrollIntoView);return FE(n?PE(i):i)}function PE(e){let t=e.startState,n=!0;for(let r of t.facet(xE)){let t=r(e);if(t===!1){n=!1;break}Array.isArray(t)&&(n=n===!0?t:AE(n,t))}if(n!==!0){let r,i;if(n===!1)i=e.changes.invertedDesc,r=GT.empty(t.doc.length);else{let t=e.changes.filter(n);r=t.changes,i=t.filtered.mapDesc(t.changes).invertedDesc}e=kE.create(t,r,e.selection&&e.selection.map(i),OE.mapEffects(e.effects,i),e.annotations,e.scrollIntoView)}let r=t.facet(SE);for(let n=r.length-1;n>=0;n--){let i=r[n](e);e=i instanceof kE?i:Array.isArray(i)&&i.length==1&&i[0]instanceof kE?i[0]:NE(t,LE(i),!1)}return e}function FE(e){let t=e.startState,n=t.facet(CE),r=e;for(let i=n.length-1;i>=0;i--){let a=n[i](e);a&&Object.keys(a).length&&(r=jE(r,ME(t,a,e.changes.newLength),!0))}return r==e?e:kE.create(t,e.changes,e.selection,r.effects,r.annotations,r.scrollIntoView)}var IE=[];function LE(e){return e==null?IE:Array.isArray(e)?e:[e]}var RE=(function(e){return e[e.Word=0]=`Word`,e[e.Space=1]=`Space`,e[e.Other=2]=`Other`,e})(RE||={}),zE=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/,BE;try{BE=RegExp(`[\\p{Alphabetic}\\p{Number}_]`,`u`)}catch{}function VE(e){if(BE)return BE.test(e);for(let t=0;t<e.length;t++){let n=e[t];if(/\w/.test(n)||n>`€`&&(n.toUpperCase()!=n.toLowerCase()||zE.test(n)))return!0}return!1}function HE(e){return t=>{if(!/\S/.test(t))return RE.Space;if(VE(t))return RE.Word;for(let n=0;n<e.length;n++)if(t.indexOf(e[n])>-1)return RE.Word;return RE.Other}}var UE=class e{constructor(e,t,n,r,i,a){this.config=e,this.doc=t,this.selection=n,this.values=r,this.status=e.statusTemplate.slice(),this.computeSlot=i,a&&(a._state=this);for(let e=0;e<this.config.dynamicSlots.length;e++)gE(this,e<<1);this.computeSlot=null}field(e,t=!0){let n=this.config.address[e.id];if(n==null){if(t)throw RangeError(`Field is not present in this state`);return}return gE(this,n),_E(this,n)}update(...e){return NE(this,e,!0)}applyTransaction(t){let n=this.config,{base:r,compartments:i}=n;for(let e of t.effects)e.is(fE.reconfigure)?(n&&=(i=new Map,n.compartments.forEach((e,t)=>i.set(t,e)),null),i.set(e.value.compartment,e.value.extension)):e.is(OE.reconfigure)?(n=null,r=e.value):e.is(OE.appendConfig)&&(n=null,r=LE(r).concat(e.value));let a;n?a=t.startState.values.slice():(n=mE.resolve(r,i,this),a=new e(n,this.doc,this.selection,n.dynamicSlots.map(()=>null),(e,t)=>t.reconfigure(e,this),null).values);let o=t.startState.facet(yE)?t.newSelection:t.newSelection.asSingle();new e(n,t.newDoc,o,a,(e,n)=>n.update(e,t),t)}replaceSelection(e){return typeof e==`string`&&(e=this.toText(e)),this.changeByRange(t=>({changes:{from:t.from,to:t.to,insert:e},range:G.cursor(t.from+e.length,-1)}))}changeByRange(e){let t=this.selection,n=e(t.ranges[0]),r=this.changes(n.changes),i=[n.range],a=LE(n.effects);for(let n=1;n<t.ranges.length;n++){let o=e(t.ranges[n]),s=this.changes(o.changes),c=s.map(r);for(let e=0;e<n;e++)i[e]=i[e].map(c);let l=r.mapDesc(s,!0);i.push(o.range.map(l)),r=r.compose(c),a=OE.mapEffects(a,c).concat(OE.mapEffects(LE(o.effects),l))}return{changes:r,selection:G.create(i,t.mainIndex),effects:a}}changes(t=[]){return t instanceof GT?t:GT.of(t,this.doc.length,this.facet(e.lineSeparator))}toText(t){return ET.of(t.split(this.facet(e.lineSeparator)||HT))}sliceDoc(e=0,t=this.doc.length){return this.doc.sliceString(e,t,this.lineBreak)}facet(e){let t=this.config.address[e.id];return t==null?e.default:(gE(this,t),_E(this,t))}toJSON(e){let t={doc:this.sliceDoc(),selection:this.selection.toJSON()};if(e)for(let n in e){let r=e[n];r instanceof sE&&this.config.address[r.id]!=null&&(t[n]=r.spec.toJSON(this.field(e[n]),this))}return t}static fromJSON(t,n={},r){if(!t||typeof t.doc!=`string`)throw RangeError(`Invalid JSON representation for EditorState`);let i=[];if(r){for(let e in r)if(Object.prototype.hasOwnProperty.call(t,e)){let n=r[e],a=t[e];i.push(n.init(e=>n.spec.fromJSON(a,e)))}}return e.create({doc:t.doc,selection:G.fromJSON(t.selection),extensions:n.extensions?i.concat([n.extensions]):i})}static create(t={}){let n=mE.resolve(t.extensions||[],new Map),r=t.doc instanceof ET?t.doc:ET.of((t.doc||``).split(n.staticFacet(e.lineSeparator)||HT)),i=t.selection?t.selection instanceof G?t.selection:G.single(t.selection.anchor,t.selection.head):G.single(0);return $T(i,r.length),n.staticFacet(yE)||(i=i.asSingle()),new e(n,r,i,n.dynamicSlots.map(()=>null),(e,t)=>t.create(e),null)}get tabSize(){return this.facet(e.tabSize)}get lineBreak(){return this.facet(e.lineSeparator)||`
@@ -79,4 +79,4 @@ WARNING: This link could potentially be dangerous`)){let e=window.open();if(e){t
79
79
  `)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(e){this._refreshAnimationFrame||=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh()),MQ&&e&&this.selectionText.length&&this._onLinuxMouseSelection.fire(this.selectionText)}_refresh(){this._refreshAnimationFrame=void 0,this._onRedrawRequest.fire({start:this._model.finalSelectionStart,end:this._model.finalSelectionEnd,columnSelectMode:this._activeSelectionMode===3})}_isClickInSelection(e){let t=this._getMouseBufferCoords(e),n=this._model.finalSelectionStart,r=this._model.finalSelectionEnd;return!n||!r||!t?!1:this._areCoordsInSelection(t,n,r)}isCellInSelection(e,t){let n=this._model.finalSelectionStart,r=this._model.finalSelectionEnd;return!n||!r?!1:this._areCoordsInSelection([e,t],n,r)}_areCoordsInSelection(e,t,n){return e[1]>t[1]&&e[1]<n[1]||t[1]===n[1]&&e[1]===t[1]&&e[0]>=t[0]&&e[0]<n[0]||t[1]<n[1]&&e[1]===n[1]&&e[0]<n[0]||t[1]<n[1]&&e[1]===t[1]&&e[0]>=t[0]}_selectWordAtCursor(e,t){let n=this._linkifier.currentLink?.link?.range;if(n)return this._model.selectionStart=[n.start.x-1,n.start.y-1],this._model.selectionStartLength=t$(n,this._bufferService.cols),this._model.selectionEnd=void 0,!0;let r=this._getMouseBufferCoords(e);return r?(this._selectWordAt(r,t),this._model.selectionEnd=void 0,!0):!1}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(e,t){this._model.clearSelection(),e=Math.max(e,0),t=Math.min(t,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,e],this._model.selectionEnd=[this._bufferService.cols,t],this.refresh(),this._onSelectionChange.fire()}_handleTrim(e){this._model.handleTrim(e)&&this.refresh()}_getMouseBufferCoords(e){let t=this._mouseService.getCoords(e,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(t)return t[0]--,t[1]--,t[1]+=this._bufferService.buffer.ydisp,t}_getMouseEventScrollAmount(e){let t=gQ(this._coreBrowserService.window,e,this._screenElement)[1],n=this._renderService.dimensions.css.canvas.height;return t>=0&&t<=n?0:(t>n&&(t-=n),t=Math.min(Math.max(t,-n$),n$),t/=n$,t/Math.abs(t)+Math.round(t*(r$-1)))}shouldForceSelection(e){return OQ?e.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:e.shiftKey}handleMouseDown(e){if(this._mouseDownTimeStamp=e.timeStamp,!(e.button===2&&this.hasSelection)&&e.button===0){if(!this._enabled){if(!this.shouldForceSelection(e))return;e.stopPropagation()}e.preventDefault(),this._dragScrollAmount=0,this._enabled&&e.shiftKey?this._handleIncrementalClick(e):e.detail===1?this._handleSingleClick(e):e.detail===2?this._handleDoubleClick(e):e.detail===3&&this._handleTripleClick(e),this._addMouseDownListeners(),this.refresh(!0)}}_addMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.addEventListener(`mousemove`,this._mouseMoveListener),this._screenElement.ownerDocument.addEventListener(`mouseup`,this._mouseUpListener)),this._dragScrollIntervalTimer=this._coreBrowserService.window.setInterval(()=>this._dragScroll(),i$)}_removeMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.removeEventListener(`mousemove`,this._mouseMoveListener),this._screenElement.ownerDocument.removeEventListener(`mouseup`,this._mouseUpListener)),this._coreBrowserService.window.clearInterval(this._dragScrollIntervalTimer),this._dragScrollIntervalTimer=void 0}_handleIncrementalClick(e){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(e))}_handleSingleClick(e){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(e)?3:0,this._model.selectionStart=this._getMouseBufferCoords(e),!this._model.selectionStart)return;this._model.selectionEnd=void 0;let t=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);t&&t.length!==this._model.selectionStart[0]&&t.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(e){this._selectWordAtCursor(e,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(e){let t=this._getMouseBufferCoords(e);t&&(this._activeSelectionMode=2,this._selectLineAt(t[1]))}shouldColumnSelect(e){return e.altKey&&!(OQ&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(e){if(e.stopImmediatePropagation(),!this._model.selectionStart)return;let t=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(e),!this._model.selectionEnd){this.refresh(!0);return}this._activeSelectionMode===2?this._model.selectionEnd[1]<this._model.selectionStart[1]?this._model.selectionEnd[0]=0:this._model.selectionEnd[0]=this._bufferService.cols:this._activeSelectionMode===1&&this._selectToWordAt(this._model.selectionEnd),this._dragScrollAmount=this._getMouseEventScrollAmount(e),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));let n=this._bufferService.buffer;if(this._model.selectionEnd[1]<n.lines.length){let e=n.lines.get(this._model.selectionEnd[1]);e&&e.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}(!t||t[0]!==this._model.selectionEnd[0]||t[1]!==this._model.selectionEnd[1])&&this.refresh(!0)}_dragScroll(){if(this._model.selectionEnd&&this._model.selectionStart&&this._dragScrollAmount){this._onRequestScrollLines.fire({amount:this._dragScrollAmount,suppressScrollEvent:!1});let e=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(e.ydisp+this._bufferService.rows,e.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=e.ydisp),this.refresh()}}_handleMouseUp(e){let t=e.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&t<a$&&e.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){let t=this._mouseService.getCoords(e,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(t&&t[0]!==void 0&&t[1]!==void 0){let e=VQ(t[0]-1,t[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(e,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd,n=!!e&&!!t&&(e[0]!==t[0]||e[1]!==t[1]);if(!n){this._oldHasSelection&&this._fireOnSelectionChange(e,t,n);return}!e||!t||(!this._oldSelectionStart||!this._oldSelectionEnd||e[0]!==this._oldSelectionStart[0]||e[1]!==this._oldSelectionStart[1]||t[0]!==this._oldSelectionEnd[0]||t[1]!==this._oldSelectionEnd[1])&&this._fireOnSelectionChange(e,t,n)}_fireOnSelectionChange(e,t,n){this._oldSelectionStart=e,this._oldSelectionEnd=t,this._oldHasSelection=n,this._onSelectionChange.fire()}_handleBufferActivate(e){this.clearSelection(),this._trimListener.dispose(),this._trimListener=e.activeBuffer.lines.onTrim(e=>this._handleTrim(e))}_convertViewportColToCharacterIndex(e,t){let n=t;for(let r=0;t>=r;r++){let i=e.loadCell(r,this._workCell).getChars().length;this._workCell.getWidth()===0?n--:i>1&&t!==r&&(n+=i-1)}return n}setSelection(e,t,n){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[e,t],this._model.selectionStartLength=n,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(e){this._isClickInSelection(e)||(this._selectWordAtCursor(e,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(e,t,n=!0,r=!0){if(e[0]>=this._bufferService.cols)return;let i=this._bufferService.buffer,a=i.lines.get(e[1]);if(!a)return;let o=i.translateBufferLineToString(e[1],!1),s=this._convertViewportColToCharacterIndex(a,e[0]),c=s,l=e[0]-s,u=0,d=0,f=0,p=0;if(o.charAt(s)===` `){for(;s>0&&o.charAt(s-1)===` `;)s--;for(;c<o.length&&o.charAt(c+1)===` `;)c++}else{let t=e[0],n=e[0];a.getWidth(t)===0&&(u++,t--),a.getWidth(n)===2&&(d++,n++);let r=a.getString(n).length;for(r>1&&(p+=r-1,c+=r-1);t>0&&s>0&&!this._isCharWordSeparator(a.loadCell(t-1,this._workCell));){a.loadCell(t-1,this._workCell);let e=this._workCell.getChars().length;this._workCell.getWidth()===0?(u++,t--):e>1&&(f+=e-1,s-=e-1),s--,t--}for(;n<a.length&&c+1<o.length&&!this._isCharWordSeparator(a.loadCell(n+1,this._workCell));){a.loadCell(n+1,this._workCell);let e=this._workCell.getChars().length;this._workCell.getWidth()===2?(d++,n++):e>1&&(p+=e-1,c+=e-1),c++,n++}}c++;let m=s+l-u+f,h=Math.min(this._bufferService.cols,c-s+u+d-f-p);if(t||o.slice(s,c).trim()!==``){if(n&&m===0&&a.getCodePoint(0)!==32){let t=i.lines.get(e[1]-1);if(t&&a.isWrapped&&t.getCodePoint(this._bufferService.cols-1)!==32){let t=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if(t){let e=this._bufferService.cols-t.start;m-=e,h+=e}}}if(r&&m+h===this._bufferService.cols&&a.getCodePoint(this._bufferService.cols-1)!==32){let t=i.lines.get(e[1]+1);if(t?.isWrapped&&t.getCodePoint(0)!==32){let t=this._getWordAt([0,e[1]+1],!1,!1,!0);t&&(h+=t.length)}}return{start:m,length:h}}}_selectWordAt(e,t){let n=this._getWordAt(e,t);if(n){for(;n.start<0;)n.start+=this._bufferService.cols,e[1]--;this._model.selectionStart=[n.start,e[1]],this._model.selectionStartLength=n.length}}_selectToWordAt(e){let t=this._getWordAt(e,!0);if(t){let n=e[1];for(;t.start<0;)t.start+=this._bufferService.cols,n--;if(!this._model.areSelectionValuesReversed())for(;t.start+t.length>this._bufferService.cols;)t.length-=this._bufferService.cols,n++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?t.start:t.start+t.length,n]}}_isCharWordSeparator(e){return e.getWidth()!==0&&this._optionsService.rawOptions.wordSeparator.indexOf(e.getChars())>=0}_selectLineAt(e){let t=this._bufferService.buffer.getWrappedRangeForLine(e),n={start:{x:0,y:t.first},end:{x:this._bufferService.cols-1,y:t.last}};this._model.selectionStart=[0,t.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=t$(n,this._bufferService.cols)}};s$=Tq([Z(3,Qq),Z(4,eJ),Z(5,fJ),Z(6,iJ),Z(7,pJ),Z(8,dJ)],s$);var c$=class{constructor(){this._data={}}set(e,t,n){this._data[e]||(this._data[e]={}),this._data[e][t]=n}get(e,t){return this._data[e]?this._data[e][t]:void 0}clear(){this._data={}}},l$=class{constructor(){this._color=new c$,this._css=new c$}setCss(e,t,n){this._css.set(e,t,n)}getCss(e,t){return this._css.get(e,t)}setColor(e,t,n){this._color.set(e,t,n)}getColor(e,t){return this._color.get(e,t)}clear(){this._color.clear(),this._css.clear()}},u$=Object.freeze((()=>{let e=[RZ.toColor(`#2e3436`),RZ.toColor(`#cc0000`),RZ.toColor(`#4e9a06`),RZ.toColor(`#c4a000`),RZ.toColor(`#3465a4`),RZ.toColor(`#75507b`),RZ.toColor(`#06989a`),RZ.toColor(`#d3d7cf`),RZ.toColor(`#555753`),RZ.toColor(`#ef2929`),RZ.toColor(`#8ae234`),RZ.toColor(`#fce94f`),RZ.toColor(`#729fcf`),RZ.toColor(`#ad7fa8`),RZ.toColor(`#34e2e2`),RZ.toColor(`#eeeeec`)],t=[0,95,135,175,215,255];for(let n=0;n<216;n++){let r=t[n/36%6|0],i=t[n/6%6|0],a=t[n%6];e.push({css:IZ.toCss(r,i,a),rgba:IZ.toRgba(r,i,a)})}for(let t=0;t<24;t++){let n=8+t*10;e.push({css:IZ.toCss(n,n,n),rgba:IZ.toRgba(n,n,n)})}return e})()),d$=RZ.toColor(`#ffffff`),f$=RZ.toColor(`#000000`),p$=RZ.toColor(`#ffffff`),m$=f$,h$={css:`rgba(255, 255, 255, 0.3)`,rgba:4294967117},g$=d$,_$=class extends VJ{constructor(e){super(),this._optionsService=e,this._contrastCache=new l$,this._halfContrastCache=new l$,this._onChangeColors=this._register(new Q),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:d$,background:f$,cursor:p$,cursorAccent:m$,selectionForeground:void 0,selectionBackgroundTransparent:h$,selectionBackgroundOpaque:LZ.blend(f$,h$),selectionInactiveBackgroundTransparent:h$,selectionInactiveBackgroundOpaque:LZ.blend(f$,h$),scrollbarSliderBackground:LZ.opacity(d$,.2),scrollbarSliderHoverBackground:LZ.opacity(d$,.4),scrollbarSliderActiveBackground:LZ.opacity(d$,.5),overviewRulerBorder:d$,ansi:u$.slice(),contrastCache:this._contrastCache,halfContrastCache:this._halfContrastCache},this._updateRestoreColors(),this._setTheme(this._optionsService.rawOptions.theme),this._register(this._optionsService.onSpecificOptionChange(`minimumContrastRatio`,()=>this._contrastCache.clear())),this._register(this._optionsService.onSpecificOptionChange(`theme`,()=>this._setTheme(this._optionsService.rawOptions.theme)))}get colors(){return this._colors}_setTheme(e={}){let t=this._colors;if(t.foreground=v$(e.foreground,d$),t.background=v$(e.background,f$),t.cursor=LZ.blend(t.background,v$(e.cursor,p$)),t.cursorAccent=LZ.blend(t.background,v$(e.cursorAccent,m$)),t.selectionBackgroundTransparent=v$(e.selectionBackground,h$),t.selectionBackgroundOpaque=LZ.blend(t.background,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundTransparent=v$(e.selectionInactiveBackground,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundOpaque=LZ.blend(t.background,t.selectionInactiveBackgroundTransparent),t.selectionForeground=e.selectionForeground?v$(e.selectionForeground,FZ):void 0,t.selectionForeground===FZ&&(t.selectionForeground=void 0),LZ.isOpaque(t.selectionBackgroundTransparent)&&(t.selectionBackgroundTransparent=LZ.opacity(t.selectionBackgroundTransparent,.3)),LZ.isOpaque(t.selectionInactiveBackgroundTransparent)&&(t.selectionInactiveBackgroundTransparent=LZ.opacity(t.selectionInactiveBackgroundTransparent,.3)),t.scrollbarSliderBackground=v$(e.scrollbarSliderBackground,LZ.opacity(t.foreground,.2)),t.scrollbarSliderHoverBackground=v$(e.scrollbarSliderHoverBackground,LZ.opacity(t.foreground,.4)),t.scrollbarSliderActiveBackground=v$(e.scrollbarSliderActiveBackground,LZ.opacity(t.foreground,.5)),t.overviewRulerBorder=v$(e.overviewRulerBorder,g$),t.ansi=u$.slice(),t.ansi[0]=v$(e.black,u$[0]),t.ansi[1]=v$(e.red,u$[1]),t.ansi[2]=v$(e.green,u$[2]),t.ansi[3]=v$(e.yellow,u$[3]),t.ansi[4]=v$(e.blue,u$[4]),t.ansi[5]=v$(e.magenta,u$[5]),t.ansi[6]=v$(e.cyan,u$[6]),t.ansi[7]=v$(e.white,u$[7]),t.ansi[8]=v$(e.brightBlack,u$[8]),t.ansi[9]=v$(e.brightRed,u$[9]),t.ansi[10]=v$(e.brightGreen,u$[10]),t.ansi[11]=v$(e.brightYellow,u$[11]),t.ansi[12]=v$(e.brightBlue,u$[12]),t.ansi[13]=v$(e.brightMagenta,u$[13]),t.ansi[14]=v$(e.brightCyan,u$[14]),t.ansi[15]=v$(e.brightWhite,u$[15]),e.extendedAnsi){let n=Math.min(t.ansi.length-16,e.extendedAnsi.length);for(let r=0;r<n;r++)t.ansi[r+16]=v$(e.extendedAnsi[r],u$[r+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(e){this._restoreColor(e),this._onChangeColors.fire(this.colors)}_restoreColor(e){if(e===void 0){for(let e=0;e<this._restoreColors.ansi.length;++e)this._colors.ansi[e]=this._restoreColors.ansi[e];return}switch(e){case 256:this._colors.foreground=this._restoreColors.foreground;break;case 257:this._colors.background=this._restoreColors.background;break;case 258:this._colors.cursor=this._restoreColors.cursor;break;default:this._colors.ansi[e]=this._restoreColors.ansi[e]}}modifyColors(e){e(this._colors),this._onChangeColors.fire(this.colors)}_updateRestoreColors(){this._restoreColors={foreground:this._colors.foreground,background:this._colors.background,cursor:this._colors.cursor,ansi:this._colors.ansi.slice()}}};_$=Tq([Z(0,iJ)],_$);function v$(e,t){if(e!==void 0)try{return RZ.toColor(e)}catch{}return t}var y$=class{constructor(...e){this._entries=new Map;for(let[t,n]of e)this.set(t,n)}set(e,t){let n=this._entries.get(e);return this._entries.set(e,t),n}forEach(e){for(let[t,n]of this._entries.entries())e(t,n)}has(e){return this._entries.has(e)}get(e){return this._entries.get(e)}},b$=class{constructor(){this._services=new y$,this._services.set(nJ,this)}setService(e,t){this._services.set(e,t)}getService(e){return this._services.get(e)}createInstance(e,...t){let n=Yq(e).sort((e,t)=>e.index-t.index),r=[];for(let t of n){let n=this._services.get(t.id);if(!n)throw Error(`[createInstance] ${e.name} depends on UNKNOWN service ${t.id._id}.`);r.push(n)}let i=n.length>0?n[0].index:t.length;if(t.length!==i)throw Error(`[createInstance] First service dependency of ${e.name} at position ${i+1} conflicts with ${t.length} static arguments`);return new e(...t,...r)}},x$={trace:0,debug:1,info:2,warn:3,error:4,off:5},S$=`xterm.js: `,C$=class extends VJ{constructor(e){super(),this._optionsService=e,this._logLevel=5,this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange(`logLevel`,()=>this._updateLogLevel())),w$=this}get logLevel(){return this._logLevel}_updateLogLevel(){this._logLevel=x$[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let t=0;t<e.length;t++)typeof e[t]==`function`&&(e[t]=e[t]())}_log(e,t,n){this._evalLazyOptionalParams(n),e.call(console,(this._optionsService.options.logger?``:S$)+t,...n)}trace(e,...t){this._logLevel<=0&&this._log(this._optionsService.options.logger?.trace.bind(this._optionsService.options.logger)??console.log,e,t)}debug(e,...t){this._logLevel<=1&&this._log(this._optionsService.options.logger?.debug.bind(this._optionsService.options.logger)??console.log,e,t)}info(e,...t){this._logLevel<=2&&this._log(this._optionsService.options.logger?.info.bind(this._optionsService.options.logger)??console.info,e,t)}warn(e,...t){this._logLevel<=3&&this._log(this._optionsService.options.logger?.warn.bind(this._optionsService.options.logger)??console.warn,e,t)}error(e,...t){this._logLevel<=4&&this._log(this._optionsService.options.logger?.error.bind(this._optionsService.options.logger)??console.error,e,t)}};C$=Tq([Z(0,iJ)],C$);var w$,T$=class extends VJ{constructor(e){super(),this._maxLength=e,this.onDeleteEmitter=this._register(new Q),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this._register(new Q),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this._register(new Q),this.onTrim=this.onTrimEmitter.event,this._array=Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(e){if(this._maxLength===e)return;let t=Array(e);for(let n=0;n<Math.min(e,this.length);n++)t[n]=this._array[this._getCyclicIndex(n)];this._array=t,this._maxLength=e,this._startIndex=0}get length(){return this._length}set length(e){if(e>this._length)for(let t=this._length;t<e;t++)this._array[t]=void 0;this._length=e}get(e){return this._array[this._getCyclicIndex(e)]}set(e,t){this._array[this._getCyclicIndex(e)]=t}push(e){this._array[this._getCyclicIndex(this._length)]=e,this._length===this._maxLength?(this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1)):this._length++}recycle(){if(this._length!==this._maxLength)throw Error(`Can only recycle when the buffer is full`);return this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1),this._array[this._getCyclicIndex(this._length-1)]}get isFull(){return this._length===this._maxLength}pop(){return this._array[this._getCyclicIndex(this._length---1)]}splice(e,t,...n){if(t){for(let n=e;n<this._length-t;n++)this._array[this._getCyclicIndex(n)]=this._array[this._getCyclicIndex(n+t)];this._length-=t,this.onDeleteEmitter.fire({index:e,amount:t})}for(let t=this._length-1;t>=e;t--)this._array[this._getCyclicIndex(t+n.length)]=this._array[this._getCyclicIndex(t)];for(let t=0;t<n.length;t++)this._array[this._getCyclicIndex(e+t)]=n[t];if(n.length&&this.onInsertEmitter.fire({index:e,amount:n.length}),this._length+n.length>this._maxLength){let e=this._length+n.length-this._maxLength;this._startIndex+=e,this._length=this._maxLength,this.onTrimEmitter.fire(e)}else this._length+=n.length}trimStart(e){e>this._length&&(e=this._length),this._startIndex+=e,this._length-=e,this.onTrimEmitter.fire(e)}shiftElements(e,t,n){if(!(t<=0)){if(e<0||e>=this._length)throw Error(`start argument out of range`);if(e+n<0)throw Error(`Cannot shift elements in list beyond index 0`);if(n>0){for(let r=t-1;r>=0;r--)this.set(e+r+n,this.get(e+r));let r=e+t+n-this._length;if(r>0)for(this._length+=r;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let r=0;r<t;r++)this.set(e+r+n,this.get(e+r))}}_getCyclicIndex(e){return(this._startIndex+e)%this._maxLength}},E$=3,D$=Object.freeze(new Uq),O$=0,k$=2,A$=class e{constructor(e,t,n=!1){this.isWrapped=n,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(e*E$);let r=t||Gq.fromCharData([0,Vq,1,0]);for(let t=0;t<e;++t)this.setCell(t,r);this.length=e}get(e){let t=this._data[e*E$+0],n=t&2097151;return[this._data[e*E$+1],t&2097152?this._combined[e]:n?Lq(n):``,t>>22,t&2097152?this._combined[e].charCodeAt(this._combined[e].length-1):n]}set(e,t){this._data[e*E$+1]=t[0],t[1].length>1?(this._combined[e]=t[1],this._data[e*E$+0]=e|2097152|t[2]<<22):this._data[e*E$+0]=t[1].charCodeAt(0)|t[2]<<22}getWidth(e){return this._data[e*E$+0]>>22}hasWidth(e){return this._data[e*E$+0]&12582912}getFg(e){return this._data[e*E$+1]}getBg(e){return this._data[e*E$+2]}hasContent(e){return this._data[e*E$+0]&4194303}getCodePoint(e){let t=this._data[e*E$+0];return t&2097152?this._combined[e].charCodeAt(this._combined[e].length-1):t&2097151}isCombined(e){return this._data[e*E$+0]&2097152}getString(e){let t=this._data[e*E$+0];return t&2097152?this._combined[e]:t&2097151?Lq(t&2097151):``}isProtected(e){return this._data[e*E$+2]&536870912}loadCell(e,t){return O$=e*E$,t.content=this._data[O$+0],t.fg=this._data[O$+1],t.bg=this._data[O$+2],t.content&2097152&&(t.combinedData=this._combined[e]),t.bg&268435456&&(t.extended=this._extendedAttrs[e]),t}setCell(e,t){t.content&2097152&&(this._combined[e]=t.combinedData),t.bg&268435456&&(this._extendedAttrs[e]=t.extended),this._data[e*E$+0]=t.content,this._data[e*E$+1]=t.fg,this._data[e*E$+2]=t.bg}setCellFromCodepoint(e,t,n,r){r.bg&268435456&&(this._extendedAttrs[e]=r.extended),this._data[e*E$+0]=t|n<<22,this._data[e*E$+1]=r.fg,this._data[e*E$+2]=r.bg}addCodepointToCell(e,t,n){let r=this._data[e*E$+0];r&2097152?this._combined[e]+=Lq(t):r&2097151?(this._combined[e]=Lq(r&2097151)+Lq(t),r&=-2097152,r|=2097152):r=t|1<<22,n&&(r&=-12582913,r|=n<<22),this._data[e*E$+0]=r}insertCells(e,t,n){if(e%=this.length,e&&this.getWidth(e-1)===2&&this.setCellFromCodepoint(e-1,0,1,n),t<this.length-e){let r=new Gq;for(let n=this.length-e-t-1;n>=0;--n)this.setCell(e+t+n,this.loadCell(e+n,r));for(let r=0;r<t;++r)this.setCell(e+r,n)}else for(let t=e;t<this.length;++t)this.setCell(t,n);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,n)}deleteCells(e,t,n){if(e%=this.length,t<this.length-e){let r=new Gq;for(let n=0;n<this.length-e-t;++n)this.setCell(e+n,this.loadCell(e+t+n,r));for(let e=this.length-t;e<this.length;++e)this.setCell(e,n)}else for(let t=e;t<this.length;++t)this.setCell(t,n);e&&this.getWidth(e-1)===2&&this.setCellFromCodepoint(e-1,0,1,n),this.getWidth(e)===0&&!this.hasContent(e)&&this.setCellFromCodepoint(e,0,1,n)}replaceCells(e,t,n,r=!1){if(r){for(e&&this.getWidth(e-1)===2&&!this.isProtected(e-1)&&this.setCellFromCodepoint(e-1,0,1,n),t<this.length&&this.getWidth(t-1)===2&&!this.isProtected(t)&&this.setCellFromCodepoint(t,0,1,n);e<t&&e<this.length;)this.isProtected(e)||this.setCell(e,n),e++;return}for(e&&this.getWidth(e-1)===2&&this.setCellFromCodepoint(e-1,0,1,n),t<this.length&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t,0,1,n);e<t&&e<this.length;)this.setCell(e++,n)}resize(e,t){if(e===this.length)return this._data.length*4*k$<this._data.buffer.byteLength;let n=e*E$;if(e>this.length){if(this._data.buffer.byteLength>=n*4)this._data=new Uint32Array(this._data.buffer,0,n);else{let e=new Uint32Array(n);e.set(this._data),this._data=e}for(let n=this.length;n<e;++n)this.setCell(n,t)}else{this._data=this._data.subarray(0,n);let t=Object.keys(this._combined);for(let n=0;n<t.length;n++){let r=parseInt(t[n],10);r>=e&&delete this._combined[r]}let r=Object.keys(this._extendedAttrs);for(let t=0;t<r.length;t++){let n=parseInt(r[t],10);n>=e&&delete this._extendedAttrs[n]}}return this.length=e,n*4*k$<this._data.buffer.byteLength}cleanupMemory(){if(this._data.length*4*k$<this._data.buffer.byteLength){let e=new Uint32Array(this._data.length);return e.set(this._data),this._data=e,1}return 0}fill(e,t=!1){if(t){for(let t=0;t<this.length;++t)this.isProtected(t)||this.setCell(t,e);return}this._combined={},this._extendedAttrs={};for(let t=0;t<this.length;++t)this.setCell(t,e)}copyFrom(e){this.length===e.length?this._data.set(e._data):this._data=new Uint32Array(e._data),this.length=e.length,this._combined={};for(let t in e._combined)this._combined[t]=e._combined[t];this._extendedAttrs={};for(let t in e._extendedAttrs)this._extendedAttrs[t]=e._extendedAttrs[t];this.isWrapped=e.isWrapped}clone(){let t=new e(0);t._data=new Uint32Array(this._data),t.length=this.length;for(let e in this._combined)t._combined[e]=this._combined[e];for(let e in this._extendedAttrs)t._extendedAttrs[e]=this._extendedAttrs[e];return t.isWrapped=this.isWrapped,t}getTrimmedLength(){for(let e=this.length-1;e>=0;--e)if(this._data[e*E$+0]&4194303)return e+(this._data[e*E$+0]>>22);return 0}getNoBgTrimmedLength(){for(let e=this.length-1;e>=0;--e)if(this._data[e*E$+0]&4194303||this._data[e*E$+2]&50331648)return e+(this._data[e*E$+0]>>22);return 0}copyCellsFrom(e,t,n,r,i){let a=e._data;if(i)for(let i=r-1;i>=0;i--){for(let e=0;e<E$;e++)this._data[(n+i)*E$+e]=a[(t+i)*E$+e];a[(t+i)*E$+2]&268435456&&(this._extendedAttrs[n+i]=e._extendedAttrs[t+i])}else for(let i=0;i<r;i++){for(let e=0;e<E$;e++)this._data[(n+i)*E$+e]=a[(t+i)*E$+e];a[(t+i)*E$+2]&268435456&&(this._extendedAttrs[n+i]=e._extendedAttrs[t+i])}let o=Object.keys(e._combined);for(let r=0;r<o.length;r++){let i=parseInt(o[r],10);i>=t&&(this._combined[i-t+n]=e._combined[i])}}translateToString(e,t,n,r){t??=0,n??=this.length,e&&(n=Math.min(n,this.getTrimmedLength())),r&&(r.length=0);let i=``;for(;t<n;){let e=this._data[t*E$+0],n=e&2097151,a=e&2097152?this._combined[t]:n?Lq(n):Hq;if(i+=a,r)for(let e=0;e<a.length;++e)r.push(t);t+=e>>22||1}return r&&r.push(t),i}};function j$(e,t,n,r,i,a){let o=[];for(let s=0;s<e.length-1;s++){let c=s,l=e.get(++c);if(!l.isWrapped)continue;let u=[e.get(s)];for(;c<e.length&&l.isWrapped;)u.push(l),l=e.get(++c);if(!a&&r>=s&&r<c){s+=u.length-1;continue}let d=0,f=F$(u,d,t),p=1,m=0;for(;p<u.length;){let e=F$(u,p,t),r=e-m,a=n-f,o=Math.min(r,a);u[d].copyCellsFrom(u[p],m,f,o,!1),f+=o,f===n&&(d++,f=0),m+=o,m===e&&(p++,m=0),f===0&&d!==0&&u[d-1].getWidth(n-1)===2&&(u[d].copyCellsFrom(u[d-1],n-1,f++,1,!1),u[d-1].setCell(n-1,i))}u[d].replaceCells(f,n,i);let h=0;for(let e=u.length-1;e>0&&(e>d||u[e].getTrimmedLength()===0);e--)h++;h>0&&(o.push(s+u.length-h),o.push(h)),s+=u.length-1}return o}function M$(e,t){let n=[],r=0,i=t[r],a=0;for(let o=0;o<e.length;o++)if(i===o){let n=t[++r];e.onDeleteEmitter.fire({index:o-a,amount:n}),o+=n-1,a+=n,i=t[++r]}else n.push(o);return{layout:n,countRemoved:a}}function N$(e,t){let n=[];for(let r=0;r<t.length;r++)n.push(e.get(t[r]));for(let t=0;t<n.length;t++)e.set(t,n[t]);e.length=t.length}function P$(e,t,n){let r=[],i=e.map((n,r)=>F$(e,r,t)).reduce((e,t)=>e+t),a=0,o=0,s=0;for(;s<i;){if(i-s<n){r.push(i-s);break}a+=n;let c=F$(e,o,t);a>c&&(a-=c,o++);let l=e[o].getWidth(a-1)===2;l&&a--;let u=l?n-1:n;r.push(u),s+=u}return r}function F$(e,t,n){if(t===e.length-1)return e[t].getTrimmedLength();let r=!e[t].hasContent(n-1)&&e[t].getWidth(n-1)===1,i=e[t+1].getWidth(0)===2;return r&&i?n-1:n}var I$=class e{constructor(t){this.line=t,this.isDisposed=!1,this._disposables=[],this._id=e._nextId++,this._onDispose=this.register(new Q),this.onDispose=this._onDispose.event}get id(){return this._id}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),IJ(this._disposables),this._disposables.length=0)}register(e){return this._disposables.push(e),e}};I$._nextId=1;var L$=I$,R$={},z$=R$.B;R$[0]={"`":`◆`,a:`▒`,b:`␉`,c:`␌`,d:`␍`,e:`␊`,f:`°`,g:`±`,h:`␤`,i:`␋`,j:`┘`,k:`┐`,l:`┌`,m:`└`,n:`┼`,o:`⎺`,p:`⎻`,q:`─`,r:`⎼`,s:`⎽`,t:`├`,u:`┤`,v:`┴`,w:`┬`,x:`│`,y:`≤`,z:`≥`,"{":`π`,"|":`≠`,"}":`£`,"~":`·`},R$.A={"#":`£`},R$.B=void 0,R$[4]={"#":`£`,"@":`¾`,"[":`ij`,"\\":`½`,"]":`|`,"{":`¨`,"|":`f`,"}":`¼`,"~":`´`},R$.C=R$[5]={"[":`Ä`,"\\":`Ö`,"]":`Å`,"^":`Ü`,"`":`é`,"{":`ä`,"|":`ö`,"}":`å`,"~":`ü`},R$.R={"#":`£`,"@":`à`,"[":`°`,"\\":`ç`,"]":`§`,"{":`é`,"|":`ù`,"}":`è`,"~":`¨`},R$.Q={"@":`à`,"[":`â`,"\\":`ç`,"]":`ê`,"^":`î`,"`":`ô`,"{":`é`,"|":`ù`,"}":`è`,"~":`û`},R$.K={"@":`§`,"[":`Ä`,"\\":`Ö`,"]":`Ü`,"{":`ä`,"|":`ö`,"}":`ü`,"~":`ß`},R$.Y={"#":`£`,"@":`§`,"[":`°`,"\\":`ç`,"]":`é`,"`":`ù`,"{":`à`,"|":`ò`,"}":`è`,"~":`ì`},R$.E=R$[6]={"@":`Ä`,"[":`Æ`,"\\":`Ø`,"]":`Å`,"^":`Ü`,"`":`ä`,"{":`æ`,"|":`ø`,"}":`å`,"~":`ü`},R$.Z={"#":`£`,"@":`§`,"[":`¡`,"\\":`Ñ`,"]":`¿`,"{":`°`,"|":`ñ`,"}":`ç`},R$.H=R$[7]={"@":`É`,"[":`Ä`,"\\":`Ö`,"]":`Å`,"^":`Ü`,"`":`é`,"{":`ä`,"|":`ö`,"}":`å`,"~":`ü`},R$[`=`]={"#":`ù`,"@":`à`,"[":`é`,"\\":`ç`,"]":`ê`,"^":`î`,_:`è`,"`":`ô`,"{":`ä`,"|":`ö`,"}":`ü`,"~":`û`};var B$=4294967295,V$=class{constructor(e,t,n){this._hasScrollback=e,this._optionsService=t,this._bufferService=n,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=D$.clone(),this.savedCharset=z$,this.markers=[],this._nullCell=Gq.fromCharData([0,Vq,1,0]),this._whitespaceCell=Gq.fromCharData([0,Hq,1,32]),this._isClearing=!1,this._memoryCleanupQueue=new LQ,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new T$(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(e){return e?(this._nullCell.fg=e.fg,this._nullCell.bg=e.bg,this._nullCell.extended=e.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new Wq),this._nullCell}getWhitespaceCell(e){return e?(this._whitespaceCell.fg=e.fg,this._whitespaceCell.bg=e.bg,this._whitespaceCell.extended=e.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new Wq),this._whitespaceCell}getBlankLine(e,t){return new A$(this._bufferService.cols,this.getNullCell(e),t)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){let e=this.ybase+this.y-this.ydisp;return e>=0&&e<this._rows}_getCorrectBufferLength(e){if(!this._hasScrollback)return e;let t=e+this._optionsService.rawOptions.scrollback;return t>B$?B$:t}fillViewportRows(e){if(this.lines.length===0){e===void 0&&(e=D$);let t=this._rows;for(;t--;)this.lines.push(this.getBlankLine(e))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new T$(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(e,t){let n=this.getNullCell(D$),r=0,i=this._getCorrectBufferLength(t);if(i>this.lines.maxLength&&(this.lines.maxLength=i),this.lines.length>0){if(this._cols<e)for(let t=0;t<this.lines.length;t++)r+=+this.lines.get(t).resize(e,n);let a=0;if(this._rows<t)for(let r=this._rows;r<t;r++)this.lines.length<t+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new A$(e,n)):this.ybase>0&&this.lines.length<=this.ybase+this.y+a+1?(this.ybase--,a++,this.ydisp>0&&this.ydisp--):this.lines.push(new A$(e,n)));else for(let e=this._rows;e>t;e--)this.lines.length>t+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(i<this.lines.maxLength){let e=this.lines.length-i;e>0&&(this.lines.trimStart(e),this.ybase=Math.max(this.ybase-e,0),this.ydisp=Math.max(this.ydisp-e,0),this.savedY=Math.max(this.savedY-e,0)),this.lines.maxLength=i}this.x=Math.min(this.x,e-1),this.y=Math.min(this.y,t-1),a&&(this.y+=a),this.savedX=Math.min(this.savedX,e-1),this.scrollTop=0}if(this.scrollBottom=t-1,this._isReflowEnabled&&(this._reflow(e,t),this._cols>e))for(let t=0;t<this.lines.length;t++)r+=+this.lines.get(t).resize(e,n);this._cols=e,this._rows=t,this._memoryCleanupQueue.clear(),r>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue(()=>this._batchedMemoryCleanup()))}_batchedMemoryCleanup(){let e=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,e=!1);let t=0;for(;this._memoryCleanupPosition<this.lines.length;)if(t+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),t>100)return!0;return e}get _isReflowEnabled(){let e=this._optionsService.rawOptions.windowsPty;return e&&e.buildNumber?this._hasScrollback&&e.backend===`conpty`&&e.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(e,t){this._cols!==e&&(e>this._cols?this._reflowLarger(e,t):this._reflowSmaller(e,t))}_reflowLarger(e,t){let n=this._optionsService.rawOptions.reflowCursorLine,r=j$(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(D$),n);if(r.length>0){let n=M$(this.lines,r);N$(this.lines,n.layout),this._reflowLargerAdjustViewport(e,t,n.countRemoved)}}_reflowLargerAdjustViewport(e,t,n){let r=this.getNullCell(D$),i=n;for(;i-->0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<t&&this.lines.push(new A$(e,r))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-n,0)}_reflowSmaller(e,t){let n=this._optionsService.rawOptions.reflowCursorLine,r=this.getNullCell(D$),i=[],a=0;for(let o=this.lines.length-1;o>=0;o--){let s=this.lines.get(o);if(!s||!s.isWrapped&&s.getTrimmedLength()<=e)continue;let c=[s];for(;s.isWrapped&&o>0;)s=this.lines.get(--o),c.unshift(s);if(!n){let e=this.ybase+this.y;if(e>=o&&e<o+c.length)continue}let l=c[c.length-1].getTrimmedLength(),u=P$(c,this._cols,e),d=u.length-c.length,f;f=this.ybase===0&&this.y!==this.lines.length-1?Math.max(0,this.y-this.lines.maxLength+d):Math.max(0,this.lines.length-this.lines.maxLength+d);let p=[];for(let e=0;e<d;e++){let e=this.getBlankLine(D$,!0);p.push(e)}p.length>0&&(i.push({start:o+c.length+a,newLines:p}),a+=p.length),c.push(...p);let m=u.length-1,h=u[m];h===0&&(m--,h=u[m]);let g=c.length-d-1,_=l;for(;g>=0;){let e=Math.min(_,h);if(c[m]===void 0)break;c[m].copyCellsFrom(c[g],_-e,h-e,e,!0),h-=e,h===0&&(m--,h=u[m]),_-=e,_===0&&(g--,_=F$(c,Math.max(g,0),this._cols))}for(let t=0;t<c.length;t++)u[t]<e&&c[t].setCell(u[t],r);let v=d-f;for(;v-->0;)this.ybase===0?this.y<t-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+a)-t&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+d,this.ybase+t-1)}if(i.length>0){let e=[],t=[];for(let e=0;e<this.lines.length;e++)t.push(this.lines.get(e));let n=this.lines.length,r=n-1,o=0,s=i[o];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+a);let c=0;for(let l=Math.min(this.lines.maxLength-1,n+a-1);l>=0;l--)if(s&&s.start>r+c){for(let e=s.newLines.length-1;e>=0;e--)this.lines.set(l--,s.newLines[e]);l++,e.push({index:r+1,amount:s.newLines.length}),c+=s.newLines.length,s=i[++o]}else this.lines.set(l,t[r--]);let l=0;for(let t=e.length-1;t>=0;t--)e[t].index+=l,this.lines.onInsertEmitter.fire(e[t]),l+=e[t].amount;let u=Math.max(0,n+a-this.lines.maxLength);u>0&&this.lines.onTrimEmitter.fire(u)}}translateBufferLineToString(e,t,n=0,r){let i=this.lines.get(e);return i?i.translateToString(t,n,r):``}getWrappedRangeForLine(e){let t=e,n=e;for(;t>0&&this.lines.get(t).isWrapped;)t--;for(;n+1<this.lines.length&&this.lines.get(n+1).isWrapped;)n++;return{first:t,last:n}}setupTabStops(e){for(e==null?(this.tabs={},e=0):this.tabs[e]||(e=this.prevStop(e));e<this._cols;e+=this._optionsService.rawOptions.tabStopWidth)this.tabs[e]=!0}prevStop(e){for(e??=this.x;!this.tabs[--e]&&e>0;);return e>=this._cols?this._cols-1:e<0?0:e}nextStop(e){for(e??=this.x;!this.tabs[++e]&&e<this._cols;);return e>=this._cols?this._cols-1:e<0?0:e}clearMarkers(e){this._isClearing=!0;for(let t=0;t<this.markers.length;t++)this.markers[t].line===e&&(this.markers[t].dispose(),this.markers.splice(t--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let e=0;e<this.markers.length;e++)this.markers[e].dispose();this.markers.length=0,this._isClearing=!1}addMarker(e){let t=new L$(e);return this.markers.push(t),t.register(this.lines.onTrim(e=>{t.line-=e,t.line<0&&t.dispose()})),t.register(this.lines.onInsert(e=>{t.line>=e.index&&(t.line+=e.amount)})),t.register(this.lines.onDelete(e=>{t.line>=e.index&&t.line<e.index+e.amount&&t.dispose(),t.line>e.index&&(t.line-=e.amount)})),t.register(t.onDispose(()=>this._removeMarker(t))),t}_removeMarker(e){this._isClearing||this.markers.splice(this.markers.indexOf(e),1)}},H$=class extends VJ{constructor(e,t){super(),this._optionsService=e,this._bufferService=t,this._onBufferActivate=this._register(new Q),this.onBufferActivate=this._onBufferActivate.event,this.reset(),this._register(this._optionsService.onSpecificOptionChange(`scrollback`,()=>this.resize(this._bufferService.cols,this._bufferService.rows))),this._register(this._optionsService.onSpecificOptionChange(`tabStopWidth`,()=>this.setupTabStops()))}reset(){this._normal=new V$(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new V$(!1,this._optionsService,this._bufferService),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}),this.setupTabStops()}get alt(){return this._alt}get active(){return this._activeBuffer}get normal(){return this._normal}activateNormalBuffer(){this._activeBuffer!==this._normal&&(this._normal.x=this._alt.x,this._normal.y=this._alt.y,this._alt.clearAllMarkers(),this._alt.clear(),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}))}activateAltBuffer(e){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(e),this._alt.x=this._normal.x,this._alt.y=this._normal.y,this._activeBuffer=this._alt,this._onBufferActivate.fire({activeBuffer:this._alt,inactiveBuffer:this._normal}))}resize(e,t){this._normal.resize(e,t),this._alt.resize(e,t),this.setupTabStops(e)}setupTabStops(e){this._normal.setupTabStops(e),this._alt.setupTabStops(e)}},U$=2,W$=1,G$=class extends VJ{constructor(e){super(),this.isUserScrolling=!1,this._onResize=this._register(new Q),this.onResize=this._onResize.event,this._onScroll=this._register(new Q),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,U$),this.rows=Math.max(e.rawOptions.rows||0,W$),this.buffers=this._register(new H$(e,this)),this._register(this.buffers.onBufferActivate(e=>{this._onScroll.fire(e.activeBuffer.ydisp)}))}get buffer(){return this.buffers.active}resize(e,t){let n=this.cols!==e,r=this.rows!==t;this.cols=e,this.rows=t,this.buffers.resize(e,t),this._onResize.fire({cols:e,rows:t,colsChanged:n,rowsChanged:r})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(e,t=!1){let n=this.buffer,r;r=this._cachedBlankLine,(!r||r.length!==this.cols||r.getFg(0)!==e.fg||r.getBg(0)!==e.bg)&&(r=n.getBlankLine(e,t),this._cachedBlankLine=r),r.isWrapped=t;let i=n.ybase+n.scrollTop,a=n.ybase+n.scrollBottom;if(n.scrollTop===0){let e=n.lines.isFull;a===n.lines.length-1?e?n.lines.recycle().copyFrom(r):n.lines.push(r.clone()):n.lines.splice(a+1,0,r.clone()),e?this.isUserScrolling&&(n.ydisp=Math.max(n.ydisp-1,0)):(n.ybase++,this.isUserScrolling||n.ydisp++)}else{let e=a-i+1;n.lines.shiftElements(i+1,e-1,-1),n.lines.set(a,r.clone())}this.isUserScrolling||(n.ydisp=n.ybase),this._onScroll.fire(n.ydisp)}scrollLines(e,t){let n=this.buffer;if(e<0){if(n.ydisp===0)return;this.isUserScrolling=!0}else e+n.ydisp>=n.ybase&&(this.isUserScrolling=!1);let r=n.ydisp;n.ydisp=Math.max(Math.min(n.ydisp+e,n.ybase),0),r!==n.ydisp&&(t||this._onScroll.fire(n.ydisp))}};G$=Tq([Z(0,iJ)],G$);var K$={cols:80,rows:24,cursorBlink:!1,cursorStyle:`block`,cursorWidth:1,cursorInactiveStyle:`outline`,customGlyphs:!0,drawBoldTextInBrightColors:!0,documentOverride:null,fastScrollModifier:`alt`,fastScrollSensitivity:5,fontFamily:`monospace`,fontSize:15,fontWeight:`normal`,fontWeightBold:`bold`,ignoreBracketedPasteMode:!1,lineHeight:1,letterSpacing:0,linkHandler:null,logLevel:`info`,logger:null,scrollback:1e3,scrollOnEraseInDisplay:!1,scrollOnUserInput:!0,scrollSensitivity:1,screenReaderMode:!1,smoothScrollDuration:0,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,disableStdin:!1,allowProposedApi:!1,allowTransparency:!1,tabStopWidth:8,theme:{},reflowCursorLine:!1,rescaleOverlappingGlyphs:!1,rightClickSelectsWord:OQ,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:` ()[]{}',"\``,altClickMovesCursor:!0,convertEol:!1,termName:`xterm`,cancelEvents:!1,overviewRuler:{}},q$=[`normal`,`bold`,`100`,`200`,`300`,`400`,`500`,`600`,`700`,`800`,`900`],J$=class extends VJ{constructor(e){super(),this._onOptionChange=this._register(new Q),this.onOptionChange=this._onOptionChange.event;let t={...K$};for(let n in e)if(n in t)try{let r=e[n];t[n]=this._sanitizeAndValidateOption(n,r)}catch(e){console.error(e)}this.rawOptions=t,this.options={...t},this._setupOptions(),this._register(RJ(()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null}))}onSpecificOptionChange(e,t){return this.onOptionChange(n=>{n===e&&t(this.rawOptions[e])})}onMultipleOptionChange(e,t){return this.onOptionChange(n=>{e.indexOf(n)!==-1&&t()})}_setupOptions(){let e=e=>{if(!(e in K$))throw Error(`No option with key "${e}"`);return this.rawOptions[e]},t=(e,t)=>{if(!(e in K$))throw Error(`No option with key "${e}"`);t=this._sanitizeAndValidateOption(e,t),this.rawOptions[e]!==t&&(this.rawOptions[e]=t,this._onOptionChange.fire(e))};for(let n in this.rawOptions){let r={get:e.bind(this,n),set:t.bind(this,n)};Object.defineProperty(this.options,n,r)}}_sanitizeAndValidateOption(e,t){switch(e){case`cursorStyle`:if(t||=K$[e],!Y$(t))throw Error(`"${t}" is not a valid value for ${e}`);break;case`wordSeparator`:t||=K$[e];break;case`fontWeight`:case`fontWeightBold`:if(typeof t==`number`&&1<=t&&t<=1e3)break;t=q$.includes(t)?t:K$[e];break;case`cursorWidth`:t=Math.floor(t);case`lineHeight`:case`tabStopWidth`:if(t<1)throw Error(`${e} cannot be less than 1, value: ${t}`);break;case`minimumContrastRatio`:t=Math.max(1,Math.min(21,Math.round(t*10)/10));break;case`scrollback`:if(t=Math.min(t,4294967295),t<0)throw Error(`${e} cannot be less than 0, value: ${t}`);break;case`fastScrollSensitivity`:case`scrollSensitivity`:if(t<=0)throw Error(`${e} cannot be less than or equal to 0, value: ${t}`);break;case`rows`:case`cols`:if(!t&&t!==0)throw Error(`${e} must be numeric, value: ${t}`);break;case`windowsPty`:t??={}}return t}};function Y$(e){return e===`block`||e===`underline`||e===`bar`}function X$(e,t=5){if(typeof e!=`object`)return e;let n=Array.isArray(e)?[]:{};for(let r in e)n[r]=t<=1?e[r]:e[r]&&X$(e[r],t-1);return n}var Z$=Object.freeze({insertMode:!1}),Q$=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,wraparound:!0}),$$=class extends VJ{constructor(e,t,n){super(),this._bufferService=e,this._logService=t,this._optionsService=n,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this._register(new Q),this.onData=this._onData.event,this._onUserInput=this._register(new Q),this.onUserInput=this._onUserInput.event,this._onBinary=this._register(new Q),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this._register(new Q),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=X$(Z$),this.decPrivateModes=X$(Q$)}reset(){this.modes=X$(Z$),this.decPrivateModes=X$(Q$)}triggerDataEvent(e,t=!1){if(this._optionsService.rawOptions.disableStdin)return;let n=this._bufferService.buffer;t&&this._optionsService.rawOptions.scrollOnUserInput&&n.ybase!==n.ydisp&&this._onRequestScrollToBottom.fire(),t&&this._onUserInput.fire(),this._logService.debug(`sending data "${e}"`),this._logService.trace(`sending data (codes)`,()=>e.split(``).map(e=>e.charCodeAt(0))),this._onData.fire(e)}triggerBinaryEvent(e){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${e}"`),this._logService.trace(`sending binary (codes)`,()=>e.split(``).map(e=>e.charCodeAt(0))),this._onBinary.fire(e))}};$$=Tq([Z(0,Qq),Z(1,rJ),Z(2,iJ)],$$);var e1={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:e=>e.button===4||e.action!==1?!1:(e.ctrl=!1,e.alt=!1,e.shift=!1,!0)},VT200:{events:19,restrict:e=>e.action!==32},DRAG:{events:23,restrict:e=>e.action!==32||e.button!==3},ANY:{events:31,restrict:e=>!0}};function t1(e,t){let n=(e.ctrl?16:0)|(e.shift?4:0)|(e.alt?8:0);return e.button===4?(n|=64,n|=e.action):(n|=e.button&3,e.button&4&&(n|=64),e.button&8&&(n|=128),e.action===32?n|=32:e.action===0&&!t&&(n|=3)),n}var n1=String.fromCharCode,r1={DEFAULT:e=>{let t=[t1(e,!1)+32,e.col+32,e.row+32];return t[0]>255||t[1]>255||t[2]>255?``:`\x1B[M${n1(t[0])}${n1(t[1])}${n1(t[2])}`},SGR:e=>{let t=e.action===0&&e.button!==4?`m`:`M`;return`\x1B[<${t1(e,!0)};${e.col};${e.row}${t}`},SGR_PIXELS:e=>{let t=e.action===0&&e.button!==4?`m`:`M`;return`\x1B[<${t1(e,!0)};${e.x};${e.y}${t}`}},i1=class extends VJ{constructor(e,t,n){super(),this._bufferService=e,this._coreService=t,this._optionsService=n,this._protocols={},this._encodings={},this._activeProtocol=``,this._activeEncoding=``,this._lastEvent=null,this._wheelPartialScroll=0,this._onProtocolChange=this._register(new Q),this.onProtocolChange=this._onProtocolChange.event;for(let e of Object.keys(e1))this.addProtocol(e,e1[e]);for(let e of Object.keys(r1))this.addEncoding(e,r1[e]);this.reset()}addProtocol(e,t){this._protocols[e]=t}addEncoding(e,t){this._encodings[e]=t}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(e){if(!this._protocols[e])throw Error(`unknown protocol "${e}"`);this._activeProtocol=e,this._onProtocolChange.fire(this._protocols[e].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(e){if(!this._encodings[e])throw Error(`unknown encoding "${e}"`);this._activeEncoding=e}reset(){this.activeProtocol=`NONE`,this.activeEncoding=`DEFAULT`,this._lastEvent=null,this._wheelPartialScroll=0}consumeWheelEvent(e,t,n){if(e.deltaY===0||e.shiftKey||t===void 0||n===void 0)return 0;let r=t/n,i=this._applyScrollModifier(e.deltaY,e);return e.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(i/=r+0,Math.abs(e.deltaY)<50&&(i*=.3),this._wheelPartialScroll+=i,i=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):e.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(i*=this._bufferService.rows),i}_applyScrollModifier(e,t){return t.altKey||t.ctrlKey||t.shiftKey?e*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:e*this._optionsService.rawOptions.scrollSensitivity}triggerMouseEvent(e){if(e.col<0||e.col>=this._bufferService.cols||e.row<0||e.row>=this._bufferService.rows||e.button===4&&e.action===32||e.button===3&&e.action!==32||e.button!==4&&(e.action===2||e.action===3)||(e.col++,e.row++,e.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,e,this._activeEncoding===`SGR_PIXELS`))||!this._protocols[this._activeProtocol].restrict(e))return!1;let t=this._encodings[this._activeEncoding](e);return t&&(this._activeEncoding===`DEFAULT`?this._coreService.triggerBinaryEvent(t):this._coreService.triggerDataEvent(t,!0)),this._lastEvent=e,!0}explainEvents(e){return{down:!!(e&1),up:!!(e&2),drag:!!(e&4),move:!!(e&8),wheel:!!(e&16)}}_equalEvents(e,t,n){if(n){if(e.x!==t.x||e.y!==t.y)return!1}else if(e.col!==t.col||e.row!==t.row)return!1;return e.button===t.button&&e.action===t.action&&e.ctrl===t.ctrl&&e.alt===t.alt&&e.shift===t.shift}};i1=Tq([Z(0,Qq),Z(1,eJ),Z(2,iJ)],i1);var a1=[[768,879],[1155,1158],[1160,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1539],[1552,1557],[1611,1630],[1648,1648],[1750,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2305,2306],[2364,2364],[2369,2376],[2381,2381],[2385,2388],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2672,2673],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2817,2817],[2876,2876],[2879,2879],[2881,2883],[2893,2893],[2902,2902],[2946,2946],[3008,3008],[3021,3021],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3393,3395],[3405,3405],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3769],[3771,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3984,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4146],[4150,4151],[4153,4153],[4184,4185],[4448,4607],[4959,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6157],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7616,7626],[7678,7679],[8203,8207],[8234,8238],[8288,8291],[8298,8303],[8400,8431],[12330,12335],[12441,12442],[43014,43014],[43019,43019],[43045,43046],[64286,64286],[65024,65039],[65056,65059],[65279,65279],[65529,65531]],o1=[[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[917505,917505],[917536,917631],[917760,917999]],s1;function c1(e,t){let n=0,r=t.length-1,i;if(e<t[0][0]||e>t[r][1])return!1;for(;r>=n;)if(i=n+r>>1,e>t[i][1])n=i+1;else if(e<t[i][0])r=i-1;else return!0;return!1}var l1=class{constructor(){if(this.version=`6`,!s1){s1=new Uint8Array(65536),s1.fill(1),s1[0]=0,s1.fill(0,1,32),s1.fill(0,127,160),s1.fill(2,4352,4448),s1[9001]=2,s1[9002]=2,s1.fill(2,11904,42192),s1[12351]=1,s1.fill(2,44032,55204),s1.fill(2,63744,64256),s1.fill(2,65040,65050),s1.fill(2,65072,65136),s1.fill(2,65280,65377),s1.fill(2,65504,65511);for(let e=0;e<a1.length;++e)s1.fill(0,a1[e][0],a1[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?s1[e]:c1(e,o1)?0:e>=131072&&e<=196605||e>=196608&&e<=262141?2:1}charProperties(e,t){let n=this.wcwidth(e),r=n===0&&t!==0;if(r){let e=u1.extractWidth(t);e===0?r=!1:e>n&&(n=e)}return u1.createPropertyValue(0,n,r)}},u1=class e{constructor(){this._providers=Object.create(null),this._active=``,this._onChange=new Q,this.onChange=this._onChange.event;let e=new l1;this.register(e),this._active=e.version,this._activeProvider=e}static extractShouldJoin(e){return!!(e&1)}static extractWidth(e){return e>>1&3}static extractCharKind(e){return e>>3}static createPropertyValue(e,t,n=!1){return(e&16777215)<<3|(t&3)<<1|!!n}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(e){if(!this._providers[e])throw Error(`unknown Unicode version "${e}"`);this._active=e,this._activeProvider=this._providers[e],this._onChange.fire(e)}register(e){this._providers[e.version]=e}wcwidth(e){return this._activeProvider.wcwidth(e)}getStringCellWidth(t){let n=0,r=0,i=t.length;for(let a=0;a<i;++a){let o=t.charCodeAt(a);if(55296<=o&&o<=56319){if(++a>=i)return n+this.wcwidth(o);let e=t.charCodeAt(a);56320<=e&&e<=57343?o=(o-55296)*1024+e-56320+65536:n+=this.wcwidth(e)}let s=this.charProperties(o,r),c=e.extractWidth(s);e.extractShouldJoin(s)&&(c-=e.extractWidth(r)),n+=c,r=s}return n}charProperties(e,t){return this._activeProvider.charProperties(e,t)}},d1=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(e){this.glevel=e,this.charset=this._charsets[e]}setgCharset(e,t){this._charsets[e]=t,this.glevel===e&&(this.charset=t)}};function f1(e){let t=e.buffer.lines.get(e.buffer.ybase+e.buffer.y-1)?.get(e.cols-1),n=e.buffer.lines.get(e.buffer.ybase+e.buffer.y);n&&t&&(n.isWrapped=t[3]!==0&&t[3]!==32)}var p1=2147483647,m1=256,h1=class e{constructor(e=32,t=32){if(this.maxLength=e,this.maxSubParamsLength=t,t>m1)throw Error(`maxSubParamsLength must not be greater than 256`);this.params=new Int32Array(e),this.length=0,this._subParams=new Int32Array(t),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(e),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}static fromArray(t){let n=new e;if(!t.length)return n;for(let e=+!!Array.isArray(t[0]);e<t.length;++e){let r=t[e];if(Array.isArray(r))for(let e=0;e<r.length;++e)n.addSubParam(r[e]);else n.addParam(r)}return n}clone(){let t=new e(this.maxLength,this.maxSubParamsLength);return t.params.set(this.params),t.length=this.length,t._subParams.set(this._subParams),t._subParamsLength=this._subParamsLength,t._subParamsIdx.set(this._subParamsIdx),t._rejectDigits=this._rejectDigits,t._rejectSubDigits=this._rejectSubDigits,t._digitIsSub=this._digitIsSub,t}toArray(){let e=[];for(let t=0;t<this.length;++t){e.push(this.params[t]);let n=this._subParamsIdx[t]>>8,r=this._subParamsIdx[t]&255;r-n>0&&e.push(Array.prototype.slice.call(this._subParams,n,r))}return e}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(e){if(this._digitIsSub=!1,this.length>=this.maxLength){this._rejectDigits=!0;return}if(e<-1)throw Error(`values lesser than -1 are not allowed`);this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=e>p1?p1:e}addSubParam(e){if(this._digitIsSub=!0,this.length){if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength){this._rejectSubDigits=!0;return}if(e<-1)throw Error(`values lesser than -1 are not allowed`);this._subParams[this._subParamsLength++]=e>p1?p1:e,this._subParamsIdx[this.length-1]++}}hasSubParams(e){return(this._subParamsIdx[e]&255)-(this._subParamsIdx[e]>>8)>0}getSubParams(e){let t=this._subParamsIdx[e]>>8,n=this._subParamsIdx[e]&255;return n-t>0?this._subParams.subarray(t,n):null}getSubParamsAll(){let e={};for(let t=0;t<this.length;++t){let n=this._subParamsIdx[t]>>8,r=this._subParamsIdx[t]&255;r-n>0&&(e[t]=this._subParams.slice(n,r))}return e}addDigit(e){let t;if(this._rejectDigits||!(t=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let n=this._digitIsSub?this._subParams:this.params,r=n[t-1];n[t-1]=~r?Math.min(r*10+e,p1):e}},g1=[],_1=class{constructor(){this._state=0,this._active=g1,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let n=this._handlers[e];return n.push(t),{dispose:()=>{let e=n.indexOf(t);e!==-1&&n.splice(e,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=g1}reset(){if(this._state===2)for(let e=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;e>=0;--e)this._active[e].end(!1);this._stack.paused=!1,this._active=g1,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||g1,!this._active.length)this._handlerFb(this._id,`START`);else for(let e=this._active.length-1;e>=0;e--)this._active[e].start()}_put(e,t,n){if(!this._active.length)this._handlerFb(this._id,`PUT`,Rq(e,t,n));else for(let r=this._active.length-1;r>=0;r--)this._active[r].put(e,t,n)}start(){this.reset(),this._state=1}put(e,t,n){if(this._state!==3){if(this._state===1)for(;t<n;){let n=e[t++];if(n===59){this._state=2,this._start();break}if(n<48||57<n){this._state=3;return}this._id===-1&&(this._id=0),this._id=this._id*10+n-48}this._state===2&&n-t>0&&this._put(e,t,n)}}end(e,t=!0){if(this._state!==0){if(this._state!==3){if(this._state===1&&this._start(),!this._active.length)this._handlerFb(this._id,`END`,e);else{let n=!1,r=this._active.length-1,i=!1;if(this._stack.paused&&(r=this._stack.loopPosition-1,n=t,i=this._stack.fallThrough,this._stack.paused=!1),!i&&n===!1){for(;r>=0&&(n=this._active[r].end(e),n!==!0);r--)if(n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!1,n;r--}for(;r>=0;r--)if(n=this._active[r].end(!1),n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!0,n}}this._active=g1,this._id=-1,this._state=0}}},v1=class{constructor(e){this._handler=e,this._data=``,this._hitLimit=!1}start(){this._data=``,this._hitLimit=!1}put(e,t,n){this._hitLimit||(this._data+=Rq(e,t,n),this._data.length>1e7&&(this._data=``,this._hitLimit=!0))}end(e){let t=!1;if(this._hitLimit)t=!1;else if(e&&(t=this._handler(this._data),t instanceof Promise))return t.then(e=>(this._data=``,this._hitLimit=!1,e));return this._data=``,this._hitLimit=!1,t}},y1=[],b1=class{constructor(){this._handlers=Object.create(null),this._active=y1,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=y1}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let n=this._handlers[e];return n.push(t),{dispose:()=>{let e=n.indexOf(t);e!==-1&&n.splice(e,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}reset(){if(this._active.length)for(let e=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;e>=0;--e)this._active[e].unhook(!1);this._stack.paused=!1,this._active=y1,this._ident=0}hook(e,t){if(this.reset(),this._ident=e,this._active=this._handlers[e]||y1,!this._active.length)this._handlerFb(this._ident,`HOOK`,t);else for(let e=this._active.length-1;e>=0;e--)this._active[e].hook(t)}put(e,t,n){if(!this._active.length)this._handlerFb(this._ident,`PUT`,Rq(e,t,n));else for(let r=this._active.length-1;r>=0;r--)this._active[r].put(e,t,n)}unhook(e,t=!0){if(!this._active.length)this._handlerFb(this._ident,`UNHOOK`,e);else{let n=!1,r=this._active.length-1,i=!1;if(this._stack.paused&&(r=this._stack.loopPosition-1,n=t,i=this._stack.fallThrough,this._stack.paused=!1),!i&&n===!1){for(;r>=0&&(n=this._active[r].unhook(e),n!==!0);r--)if(n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!1,n;r--}for(;r>=0;r--)if(n=this._active[r].unhook(!1),n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!0,n}this._active=y1,this._ident=0}},x1=new h1;x1.addParam(0);var S1=class{constructor(e){this._handler=e,this._data=``,this._params=x1,this._hitLimit=!1}hook(e){this._params=e.length>1||e.params[0]?e.clone():x1,this._data=``,this._hitLimit=!1}put(e,t,n){this._hitLimit||(this._data+=Rq(e,t,n),this._data.length>1e7&&(this._data=``,this._hitLimit=!0))}unhook(e){let t=!1;if(this._hitLimit)t=!1;else if(e&&(t=this._handler(this._data,this._params),t instanceof Promise))return t.then(e=>(this._params=x1,this._data=``,this._hitLimit=!1,e));return this._params=x1,this._data=``,this._hitLimit=!1,t}},C1=class{constructor(e){this.table=new Uint8Array(e)}setDefault(e,t){this.table.fill(e<<4|t)}add(e,t,n,r){this.table[t<<8|e]=n<<4|r}addMany(e,t,n,r){for(let i=0;i<e.length;i++)this.table[t<<8|e[i]]=n<<4|r}},w1=160,T1=function(){let e=new C1(4095),t=Array.apply(null,Array(256)).map((e,t)=>t),n=(e,n)=>t.slice(e,n),r=n(32,127),i=n(0,24);i.push(25),i.push.apply(i,n(28,32));let a=n(0,14),o;for(o in e.setDefault(1,0),e.addMany(r,0,2,0),a)e.addMany([24,26,153,154],o,3,0),e.addMany(n(128,144),o,3,0),e.addMany(n(144,152),o,3,0),e.add(156,o,0,0),e.add(27,o,11,1),e.add(157,o,4,8),e.addMany([152,158,159],o,0,7),e.add(155,o,11,3),e.add(144,o,11,9);return e.addMany(i,0,3,0),e.addMany(i,1,3,1),e.add(127,1,0,1),e.addMany(i,8,0,8),e.addMany(i,3,3,3),e.add(127,3,0,3),e.addMany(i,4,3,4),e.add(127,4,0,4),e.addMany(i,6,3,6),e.addMany(i,5,3,5),e.add(127,5,0,5),e.addMany(i,2,3,2),e.add(127,2,0,2),e.add(93,1,4,8),e.addMany(r,8,5,8),e.add(127,8,5,8),e.addMany([156,27,24,26,7],8,6,0),e.addMany(n(28,32),8,0,8),e.addMany([88,94,95],1,0,7),e.addMany(r,7,0,7),e.addMany(i,7,0,7),e.add(156,7,0,0),e.add(127,7,0,7),e.add(91,1,11,3),e.addMany(n(64,127),3,7,0),e.addMany(n(48,60),3,8,4),e.addMany([60,61,62,63],3,9,4),e.addMany(n(48,60),4,8,4),e.addMany(n(64,127),4,7,0),e.addMany([60,61,62,63],4,0,6),e.addMany(n(32,64),6,0,6),e.add(127,6,0,6),e.addMany(n(64,127),6,0,0),e.addMany(n(32,48),3,9,5),e.addMany(n(32,48),5,9,5),e.addMany(n(48,64),5,0,6),e.addMany(n(64,127),5,7,0),e.addMany(n(32,48),4,9,5),e.addMany(n(32,48),1,9,2),e.addMany(n(32,48),2,9,2),e.addMany(n(48,127),2,10,0),e.addMany(n(48,80),1,10,0),e.addMany(n(81,88),1,10,0),e.addMany([89,90,92],1,10,0),e.addMany(n(96,127),1,10,0),e.add(80,1,11,9),e.addMany(i,9,0,9),e.add(127,9,0,9),e.addMany(n(28,32),9,0,9),e.addMany(n(32,48),9,9,12),e.addMany(n(48,60),9,8,10),e.addMany([60,61,62,63],9,9,10),e.addMany(i,11,0,11),e.addMany(n(32,128),11,0,11),e.addMany(n(28,32),11,0,11),e.addMany(i,10,0,10),e.add(127,10,0,10),e.addMany(n(28,32),10,0,10),e.addMany(n(48,60),10,8,10),e.addMany([60,61,62,63],10,0,11),e.addMany(n(32,48),10,9,12),e.addMany(i,12,0,12),e.add(127,12,0,12),e.addMany(n(28,32),12,0,12),e.addMany(n(32,48),12,9,12),e.addMany(n(48,64),12,0,11),e.addMany(n(64,127),12,12,13),e.addMany(n(64,127),10,12,13),e.addMany(n(64,127),9,12,13),e.addMany(i,13,13,13),e.addMany(r,13,13,13),e.add(127,13,0,13),e.addMany([27,156,24,26],13,14,0),e.add(w1,0,2,0),e.add(w1,8,5,8),e.add(w1,6,0,6),e.add(w1,11,0,11),e.add(w1,13,13,13),e}(),E1=class extends VJ{constructor(e=T1){super(),this._transitions=e,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new h1,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(e,t,n)=>{},this._executeHandlerFb=e=>{},this._csiHandlerFb=(e,t)=>{},this._escHandlerFb=e=>{},this._errorHandlerFb=e=>e,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this._register(RJ(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new _1),this._dcsParser=this._register(new b1),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:`\\`},()=>!0)}_identifier(e,t=[64,126]){let n=0;if(e.prefix){if(e.prefix.length>1)throw Error(`only one byte as prefix supported`);if(n=e.prefix.charCodeAt(0),n&&60>n||n>63)throw Error(`prefix must be in range 0x3c .. 0x3f`)}if(e.intermediates){if(e.intermediates.length>2)throw Error(`only two bytes as intermediates are supported`);for(let t=0;t<e.intermediates.length;++t){let r=e.intermediates.charCodeAt(t);if(32>r||r>47)throw Error(`intermediate must be in range 0x20 .. 0x2f`);n<<=8,n|=r}}if(e.final.length!==1)throw Error(`final must be a single byte`);let r=e.final.charCodeAt(0);if(t[0]>r||r>t[1])throw Error(`final must be in range ${t[0]} .. ${t[1]}`);return n<<=8,n|=r,n}identToString(e){let t=[];for(;e;)t.push(String.fromCharCode(e&255)),e>>=8;return t.reverse().join(``)}setPrintHandler(e){this._printHandler=e}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(e,t){let n=this._identifier(e,[48,126]);this._escHandlers[n]===void 0&&(this._escHandlers[n]=[]);let r=this._escHandlers[n];return r.push(t),{dispose:()=>{let e=r.indexOf(t);e!==-1&&r.splice(e,1)}}}clearEscHandler(e){this._escHandlers[this._identifier(e,[48,126])]&&delete this._escHandlers[this._identifier(e,[48,126])]}setEscHandlerFallback(e){this._escHandlerFb=e}setExecuteHandler(e,t){this._executeHandlers[e.charCodeAt(0)]=t}clearExecuteHandler(e){this._executeHandlers[e.charCodeAt(0)]&&delete this._executeHandlers[e.charCodeAt(0)]}setExecuteHandlerFallback(e){this._executeHandlerFb=e}registerCsiHandler(e,t){let n=this._identifier(e);this._csiHandlers[n]===void 0&&(this._csiHandlers[n]=[]);let r=this._csiHandlers[n];return r.push(t),{dispose:()=>{let e=r.indexOf(t);e!==-1&&r.splice(e,1)}}}clearCsiHandler(e){this._csiHandlers[this._identifier(e)]&&delete this._csiHandlers[this._identifier(e)]}setCsiHandlerFallback(e){this._csiHandlerFb=e}registerDcsHandler(e,t){return this._dcsParser.registerHandler(this._identifier(e),t)}clearDcsHandler(e){this._dcsParser.clearHandler(this._identifier(e))}setDcsHandlerFallback(e){this._dcsParser.setHandlerFallback(e)}registerOscHandler(e,t){return this._oscParser.registerHandler(e,t)}clearOscHandler(e){this._oscParser.clearHandler(e)}setOscHandlerFallback(e){this._oscParser.setHandlerFallback(e)}setErrorHandler(e){this._errorHandler=e}clearErrorHandler(){this._errorHandler=this._errorHandlerFb}reset(){this.currentState=this.initialState,this._oscParser.reset(),this._dcsParser.reset(),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._parseStack.state!==0&&(this._parseStack.state=2,this._parseStack.handlers=[])}_preserveStack(e,t,n,r,i){this._parseStack.state=e,this._parseStack.handlers=t,this._parseStack.handlerPos=n,this._parseStack.transition=r,this._parseStack.chunkPos=i}parse(e,t,n){let r=0,i=0,a=0,o;if(this._parseStack.state){if(this._parseStack.state===2)this._parseStack.state=0,a=this._parseStack.chunkPos+1;else{if(n===void 0||this._parseStack.state===1)throw this._parseStack.state=1,Error(`improper continuation due to previous async handler, giving up parsing`);let t=this._parseStack.handlers,i=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(n===!1&&i>-1){for(;i>=0&&(o=t[i](this._params),o!==!0);i--)if(o instanceof Promise)return this._parseStack.handlerPos=i,o}this._parseStack.handlers=[];break;case 4:if(n===!1&&i>-1){for(;i>=0&&(o=t[i](),o!==!0);i--)if(o instanceof Promise)return this._parseStack.handlerPos=i,o}this._parseStack.handlers=[];break;case 6:if(r=e[this._parseStack.chunkPos],o=this._dcsParser.unhook(r!==24&&r!==26,n),o)return o;r===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(r=e[this._parseStack.chunkPos],o=this._oscParser.end(r!==24&&r!==26,n),o)return o;r===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0}this._parseStack.state=0,a=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=this._parseStack.transition&15}}for(let n=a;n<t;++n){switch(r=e[n],i=this._transitions.table[this.currentState<<8|(r<160?r:w1)],i>>4){case 2:for(let i=n+1;;++i){if(i>=t||(r=e[i])<32||r>126&&r<w1){this._printHandler(e,n,i),n=i-1;break}if(++i>=t||(r=e[i])<32||r>126&&r<w1){this._printHandler(e,n,i),n=i-1;break}if(++i>=t||(r=e[i])<32||r>126&&r<w1){this._printHandler(e,n,i),n=i-1;break}if(++i>=t||(r=e[i])<32||r>126&&r<w1){this._printHandler(e,n,i),n=i-1;break}}break;case 3:this._executeHandlers[r]?this._executeHandlers[r]():this._executeHandlerFb(r),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:n,code:r,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let a=this._csiHandlers[this._collect<<8|r],s=a?a.length-1:-1;for(;s>=0&&(o=a[s](this._params),o!==!0);s--)if(o instanceof Promise)return this._preserveStack(3,a,s,i,n),o;s<0&&this._csiHandlerFb(this._collect<<8|r,this._params),this.precedingJoinState=0;break;case 8:do switch(r){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(r-48)}while(++n<t&&(r=e[n])>47&&r<60);n--;break;case 9:this._collect<<=8,this._collect|=r;break;case 10:let c=this._escHandlers[this._collect<<8|r],l=c?c.length-1:-1;for(;l>=0&&(o=c[l](),o!==!0);l--)if(o instanceof Promise)return this._preserveStack(4,c,l,i,n),o;l<0&&this._escHandlerFb(this._collect<<8|r),this.precedingJoinState=0;break;case 11:this._params.reset(),this._params.addParam(0),this._collect=0;break;case 12:this._dcsParser.hook(this._collect<<8|r,this._params);break;case 13:for(let i=n+1;;++i)if(i>=t||(r=e[i])===24||r===26||r===27||r>127&&r<w1){this._dcsParser.put(e,n,i),n=i-1;break}break;case 14:if(o=this._dcsParser.unhook(r!==24&&r!==26),o)return this._preserveStack(6,[],0,i,n),o;r===27&&(i|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break;case 4:this._oscParser.start();break;case 5:for(let i=n+1;;i++)if(i>=t||(r=e[i])<32||r>127&&r<w1){this._oscParser.put(e,n,i),n=i-1;break}break;case 6:if(o=this._oscParser.end(r!==24&&r!==26),o)return this._preserveStack(5,[],0,i,n),o;r===27&&(i|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0}this.currentState=i&15}}},D1=/^([\da-f])\/([\da-f])\/([\da-f])$|^([\da-f]{2})\/([\da-f]{2})\/([\da-f]{2})$|^([\da-f]{3})\/([\da-f]{3})\/([\da-f]{3})$|^([\da-f]{4})\/([\da-f]{4})\/([\da-f]{4})$/,O1=/^[\da-f]+$/;function k1(e){if(!e)return;let t=e.toLowerCase();if(t.indexOf(`rgb:`)===0){t=t.slice(4);let e=D1.exec(t);if(e){let t=e[1]?15:e[4]?255:e[7]?4095:65535;return[Math.round(parseInt(e[1]||e[4]||e[7]||e[10],16)/t*255),Math.round(parseInt(e[2]||e[5]||e[8]||e[11],16)/t*255),Math.round(parseInt(e[3]||e[6]||e[9]||e[12],16)/t*255)]}}else if(t.indexOf(`#`)===0&&(t=t.slice(1),O1.exec(t)&&[3,6,9,12].includes(t.length))){let e=t.length/3,n=[0,0,0];for(let r=0;r<3;++r){let i=parseInt(t.slice(e*r,e*r+e),16);n[r]=e===1?i<<4:e===2?i:e===3?i>>4:i>>8}return n}}function A1(e,t){let n=e.toString(16),r=n.length<2?`0`+n:n;switch(t){case 4:return n[0];case 8:return r;case 12:return(r+r).slice(0,3);default:return r+r}}function j1(e,t=16){let[n,r,i]=e;return`rgb:${A1(n,t)}/${A1(r,t)}/${A1(i,t)}`}var M1={"(":0,")":1,"*":2,"+":3,"-":1,".":2},N1=131072,P1=10;function F1(e,t){if(e>24)return t.setWinLines||!1;switch(e){case 1:return!!t.restoreWin;case 2:return!!t.minimizeWin;case 3:return!!t.setWinPosition;case 4:return!!t.setWinSizePixels;case 5:return!!t.raiseWin;case 6:return!!t.lowerWin;case 7:return!!t.refreshWin;case 8:return!!t.setWinSizeChars;case 9:return!!t.maximizeWin;case 10:return!!t.fullscreenWin;case 11:return!!t.getWinState;case 13:return!!t.getWinPosition;case 14:return!!t.getWinSizePixels;case 15:return!!t.getScreenSizePixels;case 16:return!!t.getCellSizePixels;case 18:return!!t.getWinSizeChars;case 19:return!!t.getScreenSizeChars;case 20:return!!t.getIconTitle;case 21:return!!t.getWinTitle;case 22:return!!t.pushTitle;case 23:return!!t.popTitle;case 24:return!!t.setWinLines}return!1}var I1=5e3,L1=0,R1=class extends VJ{constructor(e,t,n,r,i,a,o,s,c=new E1){super(),this._bufferService=e,this._charsetService=t,this._coreService=n,this._logService=r,this._optionsService=i,this._oscLinkService=a,this._coreMouseService=o,this._unicodeService=s,this._parser=c,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new zq,this._utf8Decoder=new Bq,this._windowTitle=``,this._iconName=``,this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=D$.clone(),this._eraseAttrDataInternal=D$.clone(),this._onRequestBell=this._register(new Q),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this._register(new Q),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this._register(new Q),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this._register(new Q),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this._register(new Q),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this._register(new Q),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this._register(new Q),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this._register(new Q),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this._register(new Q),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this._register(new Q),this.onLineFeed=this._onLineFeed.event,this._onScroll=this._register(new Q),this.onScroll=this._onScroll.event,this._onTitleChange=this._register(new Q),this.onTitleChange=this._onTitleChange.event,this._onColor=this._register(new Q),this.onColor=this._onColor.event,this._parseStack={paused:!1,cursorStartX:0,cursorStartY:0,decodedLength:0,position:0},this._specialColors=[256,257,258],this._register(this._parser),this._dirtyRowTracker=new z1(this._bufferService),this._activeBuffer=this._bufferService.buffer,this._register(this._bufferService.buffers.onBufferActivate(e=>this._activeBuffer=e.activeBuffer)),this._parser.setCsiHandlerFallback((e,t)=>{this._logService.debug(`Unknown CSI code: `,{identifier:this._parser.identToString(e),params:t.toArray()})}),this._parser.setEscHandlerFallback(e=>{this._logService.debug(`Unknown ESC code: `,{identifier:this._parser.identToString(e)})}),this._parser.setExecuteHandlerFallback(e=>{this._logService.debug(`Unknown EXECUTE code: `,{code:e})}),this._parser.setOscHandlerFallback((e,t,n)=>{this._logService.debug(`Unknown OSC code: `,{identifier:e,action:t,data:n})}),this._parser.setDcsHandlerFallback((e,t,n)=>{t===`HOOK`&&(n=n.toArray()),this._logService.debug(`Unknown DCS code: `,{identifier:this._parser.identToString(e),action:t,payload:n})}),this._parser.setPrintHandler((e,t,n)=>this.print(e,t,n)),this._parser.registerCsiHandler({final:`@`},e=>this.insertChars(e)),this._parser.registerCsiHandler({intermediates:` `,final:`@`},e=>this.scrollLeft(e)),this._parser.registerCsiHandler({final:`A`},e=>this.cursorUp(e)),this._parser.registerCsiHandler({intermediates:` `,final:`A`},e=>this.scrollRight(e)),this._parser.registerCsiHandler({final:`B`},e=>this.cursorDown(e)),this._parser.registerCsiHandler({final:`C`},e=>this.cursorForward(e)),this._parser.registerCsiHandler({final:`D`},e=>this.cursorBackward(e)),this._parser.registerCsiHandler({final:`E`},e=>this.cursorNextLine(e)),this._parser.registerCsiHandler({final:`F`},e=>this.cursorPrecedingLine(e)),this._parser.registerCsiHandler({final:`G`},e=>this.cursorCharAbsolute(e)),this._parser.registerCsiHandler({final:`H`},e=>this.cursorPosition(e)),this._parser.registerCsiHandler({final:`I`},e=>this.cursorForwardTab(e)),this._parser.registerCsiHandler({final:`J`},e=>this.eraseInDisplay(e,!1)),this._parser.registerCsiHandler({prefix:`?`,final:`J`},e=>this.eraseInDisplay(e,!0)),this._parser.registerCsiHandler({final:`K`},e=>this.eraseInLine(e,!1)),this._parser.registerCsiHandler({prefix:`?`,final:`K`},e=>this.eraseInLine(e,!0)),this._parser.registerCsiHandler({final:`L`},e=>this.insertLines(e)),this._parser.registerCsiHandler({final:`M`},e=>this.deleteLines(e)),this._parser.registerCsiHandler({final:`P`},e=>this.deleteChars(e)),this._parser.registerCsiHandler({final:`S`},e=>this.scrollUp(e)),this._parser.registerCsiHandler({final:`T`},e=>this.scrollDown(e)),this._parser.registerCsiHandler({final:`X`},e=>this.eraseChars(e)),this._parser.registerCsiHandler({final:`Z`},e=>this.cursorBackwardTab(e)),this._parser.registerCsiHandler({final:"`"},e=>this.charPosAbsolute(e)),this._parser.registerCsiHandler({final:`a`},e=>this.hPositionRelative(e)),this._parser.registerCsiHandler({final:`b`},e=>this.repeatPrecedingCharacter(e)),this._parser.registerCsiHandler({final:`c`},e=>this.sendDeviceAttributesPrimary(e)),this._parser.registerCsiHandler({prefix:`>`,final:`c`},e=>this.sendDeviceAttributesSecondary(e)),this._parser.registerCsiHandler({final:`d`},e=>this.linePosAbsolute(e)),this._parser.registerCsiHandler({final:`e`},e=>this.vPositionRelative(e)),this._parser.registerCsiHandler({final:`f`},e=>this.hVPosition(e)),this._parser.registerCsiHandler({final:`g`},e=>this.tabClear(e)),this._parser.registerCsiHandler({final:`h`},e=>this.setMode(e)),this._parser.registerCsiHandler({prefix:`?`,final:`h`},e=>this.setModePrivate(e)),this._parser.registerCsiHandler({final:`l`},e=>this.resetMode(e)),this._parser.registerCsiHandler({prefix:`?`,final:`l`},e=>this.resetModePrivate(e)),this._parser.registerCsiHandler({final:`m`},e=>this.charAttributes(e)),this._parser.registerCsiHandler({final:`n`},e=>this.deviceStatus(e)),this._parser.registerCsiHandler({prefix:`?`,final:`n`},e=>this.deviceStatusPrivate(e)),this._parser.registerCsiHandler({intermediates:`!`,final:`p`},e=>this.softReset(e)),this._parser.registerCsiHandler({intermediates:` `,final:`q`},e=>this.setCursorStyle(e)),this._parser.registerCsiHandler({final:`r`},e=>this.setScrollRegion(e)),this._parser.registerCsiHandler({final:`s`},e=>this.saveCursor(e)),this._parser.registerCsiHandler({final:`t`},e=>this.windowOptions(e)),this._parser.registerCsiHandler({final:`u`},e=>this.restoreCursor(e)),this._parser.registerCsiHandler({intermediates:`'`,final:`}`},e=>this.insertColumns(e)),this._parser.registerCsiHandler({intermediates:`'`,final:`~`},e=>this.deleteColumns(e)),this._parser.registerCsiHandler({intermediates:`"`,final:`q`},e=>this.selectProtected(e)),this._parser.registerCsiHandler({intermediates:`$`,final:`p`},e=>this.requestMode(e,!0)),this._parser.registerCsiHandler({prefix:`?`,intermediates:`$`,final:`p`},e=>this.requestMode(e,!1)),this._parser.setExecuteHandler($.BEL,()=>this.bell()),this._parser.setExecuteHandler($.LF,()=>this.lineFeed()),this._parser.setExecuteHandler($.VT,()=>this.lineFeed()),this._parser.setExecuteHandler($.FF,()=>this.lineFeed()),this._parser.setExecuteHandler($.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler($.BS,()=>this.backspace()),this._parser.setExecuteHandler($.HT,()=>this.tab()),this._parser.setExecuteHandler($.SO,()=>this.shiftOut()),this._parser.setExecuteHandler($.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(OZ.IND,()=>this.index()),this._parser.setExecuteHandler(OZ.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(OZ.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new v1(e=>(this.setTitle(e),this.setIconName(e),!0))),this._parser.registerOscHandler(1,new v1(e=>this.setIconName(e))),this._parser.registerOscHandler(2,new v1(e=>this.setTitle(e))),this._parser.registerOscHandler(4,new v1(e=>this.setOrReportIndexedColor(e))),this._parser.registerOscHandler(8,new v1(e=>this.setHyperlink(e))),this._parser.registerOscHandler(10,new v1(e=>this.setOrReportFgColor(e))),this._parser.registerOscHandler(11,new v1(e=>this.setOrReportBgColor(e))),this._parser.registerOscHandler(12,new v1(e=>this.setOrReportCursorColor(e))),this._parser.registerOscHandler(104,new v1(e=>this.restoreIndexedColor(e))),this._parser.registerOscHandler(110,new v1(e=>this.restoreFgColor(e))),this._parser.registerOscHandler(111,new v1(e=>this.restoreBgColor(e))),this._parser.registerOscHandler(112,new v1(e=>this.restoreCursorColor(e))),this._parser.registerEscHandler({final:`7`},()=>this.saveCursor()),this._parser.registerEscHandler({final:`8`},()=>this.restoreCursor()),this._parser.registerEscHandler({final:`D`},()=>this.index()),this._parser.registerEscHandler({final:`E`},()=>this.nextLine()),this._parser.registerEscHandler({final:`H`},()=>this.tabSet()),this._parser.registerEscHandler({final:`M`},()=>this.reverseIndex()),this._parser.registerEscHandler({final:`=`},()=>this.keypadApplicationMode()),this._parser.registerEscHandler({final:`>`},()=>this.keypadNumericMode()),this._parser.registerEscHandler({final:`c`},()=>this.fullReset()),this._parser.registerEscHandler({final:`n`},()=>this.setgLevel(2)),this._parser.registerEscHandler({final:`o`},()=>this.setgLevel(3)),this._parser.registerEscHandler({final:`|`},()=>this.setgLevel(3)),this._parser.registerEscHandler({final:`}`},()=>this.setgLevel(2)),this._parser.registerEscHandler({final:`~`},()=>this.setgLevel(1)),this._parser.registerEscHandler({intermediates:`%`,final:`@`},()=>this.selectDefaultCharset()),this._parser.registerEscHandler({intermediates:`%`,final:`G`},()=>this.selectDefaultCharset());for(let e in R$)this._parser.registerEscHandler({intermediates:`(`,final:e},()=>this.selectCharset(`(`+e)),this._parser.registerEscHandler({intermediates:`)`,final:e},()=>this.selectCharset(`)`+e)),this._parser.registerEscHandler({intermediates:`*`,final:e},()=>this.selectCharset(`*`+e)),this._parser.registerEscHandler({intermediates:`+`,final:e},()=>this.selectCharset(`+`+e)),this._parser.registerEscHandler({intermediates:`-`,final:e},()=>this.selectCharset(`-`+e)),this._parser.registerEscHandler({intermediates:`.`,final:e},()=>this.selectCharset(`.`+e)),this._parser.registerEscHandler({intermediates:`/`,final:e},()=>this.selectCharset(`/`+e));this._parser.registerEscHandler({intermediates:`#`,final:`8`},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler(e=>(this._logService.error(`Parsing error: `,e),e)),this._parser.registerDcsHandler({intermediates:`$`,final:`q`},new S1((e,t)=>this.requestStatusString(e,t)))}getAttrData(){return this._curAttrData}_preserveStack(e,t,n,r){this._parseStack.paused=!0,this._parseStack.cursorStartX=e,this._parseStack.cursorStartY=t,this._parseStack.decodedLength=n,this._parseStack.position=r}_logSlowResolvingAsync(e){this._logService.logLevel<=3&&Promise.race([e,new Promise((e,t)=>setTimeout(()=>t(`#SLOW_TIMEOUT`),I1))]).catch(e=>{if(e!==`#SLOW_TIMEOUT`)throw e;console.warn(`async parser handler taking longer than ${I1} ms`)})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(e,t){let n,r=this._activeBuffer.x,i=this._activeBuffer.y,a=0,o=this._parseStack.paused;if(o){if(n=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,t))return this._logSlowResolvingAsync(n),n;r=this._parseStack.cursorStartX,i=this._parseStack.cursorStartY,this._parseStack.paused=!1,e.length>N1&&(a=this._parseStack.position+N1)}if(this._logService.logLevel<=1&&this._logService.debug(`parsing data ${typeof e==`string`?` "${e}"`:` "${Array.prototype.map.call(e,e=>String.fromCharCode(e)).join(``)}"`}`),this._logService.logLevel===0&&this._logService.trace(`parsing data (codes)`,typeof e==`string`?e.split(``).map(e=>e.charCodeAt(0)):e),this._parseBuffer.length<e.length&&this._parseBuffer.length<N1&&(this._parseBuffer=new Uint32Array(Math.min(e.length,N1))),o||this._dirtyRowTracker.clearRange(),e.length>N1)for(let t=a;t<e.length;t+=N1){let a=t+N1<e.length?t+N1:e.length,o=typeof e==`string`?this._stringDecoder.decode(e.substring(t,a),this._parseBuffer):this._utf8Decoder.decode(e.subarray(t,a),this._parseBuffer);if(n=this._parser.parse(this._parseBuffer,o))return this._preserveStack(r,i,o,t),this._logSlowResolvingAsync(n),n}else if(!o){let t=typeof e==`string`?this._stringDecoder.decode(e,this._parseBuffer):this._utf8Decoder.decode(e,this._parseBuffer);if(n=this._parser.parse(this._parseBuffer,t))return this._preserveStack(r,i,t,0),this._logSlowResolvingAsync(n),n}(this._activeBuffer.x!==r||this._activeBuffer.y!==i)&&this._onCursorMove.fire();let s=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),c=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);c<this._bufferService.rows&&this._onRequestRefreshRows.fire({start:Math.min(c,this._bufferService.rows-1),end:Math.min(s,this._bufferService.rows-1)})}print(e,t,n){let r,i,a=this._charsetService.charset,o=this._optionsService.rawOptions.screenReaderMode,s=this._bufferService.cols,c=this._coreService.decPrivateModes.wraparound,l=this._coreService.modes.insertMode,u=this._curAttrData,d=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&n-t>0&&d.getWidth(this._activeBuffer.x-1)===2&&d.setCellFromCodepoint(this._activeBuffer.x-1,0,1,u);let f=this._parser.precedingJoinState;for(let p=t;p<n;++p){if(r=e[p],r<127&&a){let e=a[String.fromCharCode(r)];e&&(r=e.charCodeAt(0))}let t=this._unicodeService.charProperties(r,f);i=u1.extractWidth(t);let n=u1.extractShouldJoin(t),m=n?u1.extractWidth(f):0;if(f=t,o&&this._onA11yChar.fire(Lq(r)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+i-m>s){if(c){let e=d,t=this._activeBuffer.x-m;for(this._activeBuffer.x=m,this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData(),!0)):(this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!0),d=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),m>0&&d instanceof A$&&d.copyCellsFrom(e,t,0,m,!1);t<s;)e.setCellFromCodepoint(t++,0,1,u)}else if(this._activeBuffer.x=s-1,i===2)continue}if(n&&this._activeBuffer.x){let e=d.getWidth(this._activeBuffer.x-1)?1:2;d.addCodepointToCell(this._activeBuffer.x-e,r,i);for(let e=i-m;--e>=0;)d.setCellFromCodepoint(this._activeBuffer.x++,0,0,u);continue}if(l&&(d.insertCells(this._activeBuffer.x,i-m,this._activeBuffer.getNullCell(u)),d.getWidth(s-1)===2&&d.setCellFromCodepoint(s-1,0,1,u)),d.setCellFromCodepoint(this._activeBuffer.x++,r,i,u),i>0)for(;--i;)d.setCellFromCodepoint(this._activeBuffer.x++,0,0,u)}this._parser.precedingJoinState=f,this._activeBuffer.x<s&&n-t>0&&d.getWidth(this._activeBuffer.x)===0&&!d.hasContent(this._activeBuffer.x)&&d.setCellFromCodepoint(this._activeBuffer.x,0,1,u),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(e,t){return e.final===`t`&&!e.prefix&&!e.intermediates?this._parser.registerCsiHandler(e,e=>!F1(e.params[0],this._optionsService.rawOptions.windowOptions)||t(e)):this._parser.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._parser.registerDcsHandler(e,new S1(t))}registerEscHandler(e,t){return this._parser.registerEscHandler(e,t)}registerOscHandler(e,t){return this._parser.registerOscHandler(e,new v1(t))}bell(){return this._onRequestBell.fire(),!0}lineFeed(){return this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._optionsService.rawOptions.convertEol&&(this._activeBuffer.x=0),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows?this._activeBuffer.y=this._bufferService.rows-1:this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.x>=this._bufferService.cols&&this._activeBuffer.x--,this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._onLineFeed.fire(),!0}carriageReturn(){return this._activeBuffer.x=0,!0}backspace(){if(!this._coreService.decPrivateModes.reverseWraparound)return this._restrictCursor(),this._activeBuffer.x>0&&this._activeBuffer.x--,!0;if(this._restrictCursor(this._bufferService.cols),this._activeBuffer.x>0)this._activeBuffer.x--;else if(this._activeBuffer.x===0&&this._activeBuffer.y>this._activeBuffer.scrollTop&&this._activeBuffer.y<=this._activeBuffer.scrollBottom&&this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y)?.isWrapped){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;let e=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);e.hasWidth(this._activeBuffer.x)&&!e.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let e=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-e),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(e=this._bufferService.cols-1){this._activeBuffer.x=Math.min(e,Math.max(0,this._activeBuffer.x)),this._activeBuffer.y=this._coreService.decPrivateModes.origin?Math.min(this._activeBuffer.scrollBottom,Math.max(this._activeBuffer.scrollTop,this._activeBuffer.y)):Math.min(this._bufferService.rows-1,Math.max(0,this._activeBuffer.y)),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_setCursor(e,t){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=e,this._activeBuffer.y=this._activeBuffer.scrollTop+t):(this._activeBuffer.x=e,this._activeBuffer.y=t),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(e,t){this._restrictCursor(),this._setCursor(this._activeBuffer.x+e,this._activeBuffer.y+t)}cursorUp(e){let t=this._activeBuffer.y-this._activeBuffer.scrollTop;return t>=0?this._moveCursor(0,-Math.min(t,e.params[0]||1)):this._moveCursor(0,-(e.params[0]||1)),!0}cursorDown(e){let t=this._activeBuffer.scrollBottom-this._activeBuffer.y;return t>=0?this._moveCursor(0,Math.min(t,e.params[0]||1)):this._moveCursor(0,e.params[0]||1),!0}cursorForward(e){return this._moveCursor(e.params[0]||1,0),!0}cursorBackward(e){return this._moveCursor(-(e.params[0]||1),0),!0}cursorNextLine(e){return this.cursorDown(e),this._activeBuffer.x=0,!0}cursorPrecedingLine(e){return this.cursorUp(e),this._activeBuffer.x=0,!0}cursorCharAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(e){return this._setCursor(e.length>=2?(e.params[1]||1)-1:0,(e.params[0]||1)-1),!0}charPosAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(e){return this._moveCursor(e.params[0]||1,0),!0}linePosAbsolute(e){return this._setCursor(this._activeBuffer.x,(e.params[0]||1)-1),!0}vPositionRelative(e){return this._moveCursor(0,e.params[0]||1),!0}hVPosition(e){return this.cursorPosition(e),!0}tabClear(e){let t=e.params[0];return t===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:t===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(e){let t=e.params[0];return t===1&&(this._curAttrData.bg|=536870912),(t===2||t===0)&&(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(e,t,n,r=!1,i=!1){let a=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);a.replaceCells(t,n,this._activeBuffer.getNullCell(this._eraseAttrData()),i),r&&(a.isWrapped=!1)}_resetBufferLine(e,t=!1){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n&&(n.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),t),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+e),n.isWrapped=!1)}eraseInDisplay(e,t=!1){this._restrictCursor(this._bufferService.cols);let n;switch(e.params[0]){case 0:for(n=this._activeBuffer.y,this._dirtyRowTracker.markDirty(n),this._eraseInBufferLine(n++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);n<this._bufferService.rows;n++)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(n);break;case 1:for(n=this._activeBuffer.y,this._dirtyRowTracker.markDirty(n),this._eraseInBufferLine(n,0,this._activeBuffer.x+1,!0,t),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(n+1).isWrapped=!1);n--;)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(0);break;case 2:if(this._optionsService.rawOptions.scrollOnEraseInDisplay){for(n=this._bufferService.rows,this._dirtyRowTracker.markRangeDirty(0,n-1);n--&&!this._activeBuffer.lines.get(this._activeBuffer.ybase+n)?.getTrimmedLength(););for(;n>=0;n--)this._bufferService.scroll(this._eraseAttrData())}else{for(n=this._bufferService.rows,this._dirtyRowTracker.markDirty(n-1);n--;)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(0)}break;case 3:let e=this._activeBuffer.lines.length-this._bufferService.rows;e>0&&(this._activeBuffer.lines.trimStart(e),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-e,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-e,0),this._onScroll.fire(0))}return!0}eraseInLine(e,t=!1){switch(this._restrictCursor(this._bufferService.cols),e.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,t);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,t)}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(e){this._restrictCursor();let t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let n=this._activeBuffer.ybase+this._activeBuffer.y,r=this._bufferService.rows-1-this._activeBuffer.scrollBottom,i=this._bufferService.rows-1+this._activeBuffer.ybase-r+1;for(;t--;)this._activeBuffer.lines.splice(i-1,1),this._activeBuffer.lines.splice(n,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(e){this._restrictCursor();let t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let n=this._activeBuffer.ybase+this._activeBuffer.y,r;for(r=this._bufferService.rows-1-this._activeBuffer.scrollBottom,r=this._bufferService.rows-1+this._activeBuffer.ybase-r;t--;)this._activeBuffer.lines.splice(n,1),this._activeBuffer.lines.splice(r,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.insertCells(this._activeBuffer.x,e.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.deleteCells(this._activeBuffer.x,e.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(e){let t=e.params[0]||1;for(;t--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollDown(e){let t=e.params[0]||1;for(;t--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,0,this._activeBuffer.getBlankLine(D$));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let e=this._activeBuffer.scrollTop;e<=this._activeBuffer.scrollBottom;++e){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n.deleteCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),n.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let e=this._activeBuffer.scrollTop;e<=this._activeBuffer.scrollBottom;++e){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n.insertCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),n.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let e=this._activeBuffer.scrollTop;e<=this._activeBuffer.scrollBottom;++e){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n.insertCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),n.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let e=this._activeBuffer.scrollTop;e<=this._activeBuffer.scrollBottom;++e){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n.deleteCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),n.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(e.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(e){let t=this._parser.precedingJoinState;if(!t)return!0;let n=e.params[0]||1,r=u1.extractWidth(t),i=this._activeBuffer.x-r,a=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(i),o=new Uint32Array(a.length*n),s=0;for(let e=0;e<a.length;){let t=a.codePointAt(e)||0;o[s++]=t,e+=t>65535?2:1}let c=s;for(let e=1;e<n;++e)o.copyWithin(c,0,s),c+=s;return this.print(o,0,c),!0}sendDeviceAttributesPrimary(e){return e.params[0]>0||(this._is(`xterm`)||this._is(`rxvt-unicode`)||this._is(`screen`)?this._coreService.triggerDataEvent($.ESC+`[?1;2c`):this._is(`linux`)&&this._coreService.triggerDataEvent($.ESC+`[?6c`)),!0}sendDeviceAttributesSecondary(e){return e.params[0]>0||(this._is(`xterm`)?this._coreService.triggerDataEvent($.ESC+`[>0;276;0c`):this._is(`rxvt-unicode`)?this._coreService.triggerDataEvent($.ESC+`[>85;95;0c`):this._is(`linux`)?this._coreService.triggerDataEvent(e.params[0]+`c`):this._is(`screen`)&&this._coreService.triggerDataEvent($.ESC+`[>83;40003;0c`)),!0}_is(e){return(this._optionsService.rawOptions.termName+``).indexOf(e)===0}setMode(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0}return!0}setModePrivate(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,z$),this._charsetService.setgCharset(1,z$),this._charsetService.setgCharset(2,z$),this._charsetService.setgCharset(3,z$);break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(132,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!0,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!0;break;case 12:this._optionsService.options.cursorBlink=!0;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!0;break;case 66:this._logService.debug(`Serial port requested application keypad.`),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire();break;case 9:this._coreMouseService.activeProtocol=`X10`;break;case 1e3:this._coreMouseService.activeProtocol=`VT200`;break;case 1002:this._coreMouseService.activeProtocol=`DRAG`;break;case 1003:this._coreMouseService.activeProtocol=`ANY`;break;case 1004:this._coreService.decPrivateModes.sendFocus=!0,this._onRequestSendFocus.fire();break;case 1005:this._logService.debug(`DECSET 1005 not supported (see #2507)`);break;case 1006:this._coreMouseService.activeEncoding=`SGR`;break;case 1015:this._logService.debug(`DECSET 1015 not supported (see #2507)`);break;case 1016:this._coreMouseService.activeEncoding=`SGR_PIXELS`;break;case 25:this._coreService.isCursorHidden=!1;break;case 1048:this.saveCursor();break;case 1049:this.saveCursor();case 47:case 1047:this._bufferService.buffers.activateAltBuffer(this._eraseAttrData()),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!0;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!0}return!0}resetMode(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1}return!0}resetModePrivate(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!1;break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(80,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!1,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!1;break;case 12:this._optionsService.options.cursorBlink=!1;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!1;break;case 66:this._logService.debug(`Switching back to normal keypad.`),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire();break;case 9:case 1e3:case 1002:case 1003:this._coreMouseService.activeProtocol=`NONE`;break;case 1004:this._coreService.decPrivateModes.sendFocus=!1;break;case 1005:this._logService.debug(`DECRST 1005 not supported (see #2507)`);break;case 1006:this._coreMouseService.activeEncoding=`DEFAULT`;break;case 1015:this._logService.debug(`DECRST 1015 not supported (see #2507)`);break;case 1016:this._coreMouseService.activeEncoding=`DEFAULT`;break;case 25:this._coreService.isCursorHidden=!0;break;case 1048:this.restoreCursor();break;case 1049:case 47:case 1047:this._bufferService.buffers.activateNormalBuffer(),e.params[t]===1049&&this.restoreCursor(),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!1;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!1,this._onRequestRefreshRows.fire(void 0)}return!0}requestMode(e,t){let n;(e=>(e[e.NOT_RECOGNIZED=0]=`NOT_RECOGNIZED`,e[e.SET=1]=`SET`,e[e.RESET=2]=`RESET`,e[e.PERMANENTLY_SET=3]=`PERMANENTLY_SET`,e[e.PERMANENTLY_RESET=4]=`PERMANENTLY_RESET`))(n||={});let r=this._coreService.decPrivateModes,{activeProtocol:i,activeEncoding:a}=this._coreMouseService,o=this._coreService,{buffers:s,cols:c}=this._bufferService,{active:l,alt:u}=s,d=this._optionsService.rawOptions,f=(e,n)=>(o.triggerDataEvent(`${$.ESC}[${t?``:`?`}${e};${n}$y`),!0),p=e=>e?1:2,m=e.params[0];return t?m===2?f(m,4):m===4?f(m,p(o.modes.insertMode)):m===12?f(m,3):m===20?f(m,p(d.convertEol)):f(m,0):m===1?f(m,p(r.applicationCursorKeys)):m===3?f(m,d.windowOptions.setWinLines?c===80?2:+(c===132):0):m===6?f(m,p(r.origin)):m===7?f(m,p(r.wraparound)):m===8?f(m,3):m===9?f(m,p(i===`X10`)):m===12?f(m,p(d.cursorBlink)):m===25?f(m,p(!o.isCursorHidden)):m===45?f(m,p(r.reverseWraparound)):m===66?f(m,p(r.applicationKeypad)):m===67?f(m,4):m===1e3?f(m,p(i===`VT200`)):m===1002?f(m,p(i===`DRAG`)):m===1003?f(m,p(i===`ANY`)):m===1004?f(m,p(r.sendFocus)):m===1005?f(m,4):m===1006?f(m,p(a===`SGR`)):m===1015?f(m,4):m===1016?f(m,p(a===`SGR_PIXELS`)):m===1048?f(m,1):m===47||m===1047||m===1049?f(m,p(l===u)):m===2004?f(m,p(r.bracketedPasteMode)):m===2026?f(m,p(r.synchronizedOutput)):f(m,0)}_updateAttrColor(e,t,n,r,i){return t===2?(e|=50331648,e&=-16777216,e|=Uq.fromColorRGB([n,r,i])):t===5&&(e&=-50331904,e|=33554432|n&255),e}_extractColor(e,t,n){let r=[0,0,-1,0,0,0],i=0,a=0;do{if(r[a+i]=e.params[t+a],e.hasSubParams(t+a)){let n=e.getSubParams(t+a),o=0;do r[1]===5&&(i=1),r[a+o+1+i]=n[o];while(++o<n.length&&o+a+1+i<r.length);break}if(r[1]===5&&a+i>=2||r[1]===2&&a+i>=5)break;r[1]&&(i=1)}while(++a+t<e.length&&a+i<r.length);for(let e=2;e<r.length;++e)r[e]===-1&&(r[e]=0);switch(r[0]){case 38:n.fg=this._updateAttrColor(n.fg,r[1],r[3],r[4],r[5]);break;case 48:n.bg=this._updateAttrColor(n.bg,r[1],r[3],r[4],r[5]);break;case 58:n.extended=n.extended.clone(),n.extended.underlineColor=this._updateAttrColor(n.extended.underlineColor,r[1],r[3],r[4],r[5])}return a}_processUnderline(e,t){t.extended=t.extended.clone(),(!~e||e>5)&&(e=1),t.extended.underlineStyle=e,t.fg|=268435456,e===0&&(t.fg&=-268435457),t.updateExtended()}_processSGR0(e){e.fg=D$.fg,e.bg=D$.bg,e.extended=e.extended.clone(),e.extended.underlineStyle=0,e.extended.underlineColor&=-67108864,e.updateExtended()}charAttributes(e){if(e.length===1&&e.params[0]===0)return this._processSGR0(this._curAttrData),!0;let t=e.length,n,r=this._curAttrData;for(let i=0;i<t;i++)n=e.params[i],n>=30&&n<=37?(r.fg&=-50331904,r.fg|=16777216|n-30):n>=40&&n<=47?(r.bg&=-50331904,r.bg|=16777216|n-40):n>=90&&n<=97?(r.fg&=-50331904,r.fg|=n-90|16777224):n>=100&&n<=107?(r.bg&=-50331904,r.bg|=n-100|16777224):n===0?this._processSGR0(r):n===1?r.fg|=134217728:n===3?r.bg|=67108864:n===4?(r.fg|=268435456,this._processUnderline(e.hasSubParams(i)?e.getSubParams(i)[0]:1,r)):n===5?r.fg|=536870912:n===7?r.fg|=67108864:n===8?r.fg|=1073741824:n===9?r.fg|=2147483648:n===2?r.bg|=134217728:n===21?this._processUnderline(2,r):n===22?(r.fg&=-134217729,r.bg&=-134217729):n===23?r.bg&=-67108865:n===24?(r.fg&=-268435457,this._processUnderline(0,r)):n===25?r.fg&=-536870913:n===27?r.fg&=-67108865:n===28?r.fg&=-1073741825:n===29?r.fg&=2147483647:n===39?(r.fg&=-67108864,r.fg|=D$.fg&16777215):n===49?(r.bg&=-67108864,r.bg|=D$.bg&16777215):n===38||n===48||n===58?i+=this._extractColor(e,i,r):n===53?r.bg|=1073741824:n===55?r.bg&=-1073741825:n===59?(r.extended=r.extended.clone(),r.extended.underlineColor=-1,r.updateExtended()):n===100?(r.fg&=-67108864,r.fg|=D$.fg&16777215,r.bg&=-67108864,r.bg|=D$.bg&16777215):this._logService.debug(`Unknown SGR attribute: %d.`,n);return!0}deviceStatus(e){switch(e.params[0]){case 5:this._coreService.triggerDataEvent(`${$.ESC}[0n`);break;case 6:let e=this._activeBuffer.y+1,t=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${$.ESC}[${e};${t}R`)}return!0}deviceStatusPrivate(e){if(e.params[0]===6){let e=this._activeBuffer.y+1,t=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${$.ESC}[?${e};${t}R`)}return!0}softReset(e){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=D$.clone(),this._coreService.reset(),this._charsetService.reset(),this._activeBuffer.savedX=0,this._activeBuffer.savedY=this._activeBuffer.ybase,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,this._coreService.decPrivateModes.origin=!1,!0}setCursorStyle(e){let t=e.length===0?1:e.params[0];if(t===0)this._coreService.decPrivateModes.cursorStyle=void 0,this._coreService.decPrivateModes.cursorBlink=void 0;else{switch(t){case 1:case 2:this._coreService.decPrivateModes.cursorStyle=`block`;break;case 3:case 4:this._coreService.decPrivateModes.cursorStyle=`underline`;break;case 5:case 6:this._coreService.decPrivateModes.cursorStyle=`bar`}let e=t%2==1;this._coreService.decPrivateModes.cursorBlink=e}return!0}setScrollRegion(e){let t=e.params[0]||1,n;return(e.length<2||(n=e.params[1])>this._bufferService.rows||n===0)&&(n=this._bufferService.rows),n>t&&(this._activeBuffer.scrollTop=t-1,this._activeBuffer.scrollBottom=n-1,this._setCursor(0,0)),!0}windowOptions(e){if(!F1(e.params[0],this._optionsService.rawOptions.windowOptions))return!0;let t=e.length>1?e.params[1]:0;switch(e.params[0]){case 14:t!==2&&this._onRequestWindowsOptionsReport.fire(0);break;case 16:this._onRequestWindowsOptionsReport.fire(1);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${$.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:(t===0||t===2)&&(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>P1&&this._windowTitleStack.shift()),(t===0||t===1)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>P1&&this._iconNameStack.shift());break;case 23:(t===0||t===2)&&this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),(t===0||t===1)&&this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop())}return!0}saveCursor(e){return this._activeBuffer.savedX=this._activeBuffer.x,this._activeBuffer.savedY=this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,!0}restoreCursor(e){return this._activeBuffer.x=this._activeBuffer.savedX||0,this._activeBuffer.y=Math.max(this._activeBuffer.savedY-this._activeBuffer.ybase,0),this._curAttrData.fg=this._activeBuffer.savedCurAttrData.fg,this._curAttrData.bg=this._activeBuffer.savedCurAttrData.bg,this._charsetService.charset=this._savedCharset,this._activeBuffer.savedCharset&&(this._charsetService.charset=this._activeBuffer.savedCharset),this._restrictCursor(),!0}setTitle(e){return this._windowTitle=e,this._onTitleChange.fire(e),!0}setIconName(e){return this._iconName=e,!0}setOrReportIndexedColor(e){let t=[],n=e.split(`;`);for(;n.length>1;){let e=n.shift(),r=n.shift();if(/^\d+$/.exec(e)){let n=parseInt(e);if(B1(n)){if(r===`?`)t.push({type:0,index:n});else{let e=k1(r);e&&t.push({type:1,index:n,color:e})}}}}return t.length&&this._onColor.fire(t),!0}setHyperlink(e){let t=e.indexOf(`;`);if(t===-1)return!0;let n=e.slice(0,t).trim(),r=e.slice(t+1);return r?this._createHyperlink(n,r):!n.trim()&&this._finishHyperlink()}_createHyperlink(e,t){this._getCurrentLinkId()&&this._finishHyperlink();let n=e.split(`:`),r,i=n.findIndex(e=>e.startsWith(`id=`));return i!==-1&&(r=n[i].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:r,uri:t}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(e,t){let n=e.split(`;`);for(let e=0;e<n.length&&!(t>=this._specialColors.length);++e,++t)if(n[e]===`?`)this._onColor.fire([{type:0,index:this._specialColors[t]}]);else{let r=k1(n[e]);r&&this._onColor.fire([{type:1,index:this._specialColors[t],color:r}])}return!0}setOrReportFgColor(e){return this._setOrReportSpecialColor(e,0)}setOrReportBgColor(e){return this._setOrReportSpecialColor(e,1)}setOrReportCursorColor(e){return this._setOrReportSpecialColor(e,2)}restoreIndexedColor(e){if(!e)return this._onColor.fire([{type:2}]),!0;let t=[],n=e.split(`;`);for(let e=0;e<n.length;++e)if(/^\d+$/.exec(n[e])){let r=parseInt(n[e]);B1(r)&&t.push({type:2,index:r})}return t.length&&this._onColor.fire(t),!0}restoreFgColor(e){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(e){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(e){return this._onColor.fire([{type:2,index:258}]),!0}nextLine(){return this._activeBuffer.x=0,this.index(),!0}keypadApplicationMode(){return this._logService.debug(`Serial port requested application keypad.`),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire(),!0}keypadNumericMode(){return this._logService.debug(`Switching back to normal keypad.`),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire(),!0}selectDefaultCharset(){return this._charsetService.setgLevel(0),this._charsetService.setgCharset(0,z$),!0}selectCharset(e){return e.length===2?(e[0]===`/`||this._charsetService.setgCharset(M1[e[0]],R$[e[1]]||z$),!0):(this.selectDefaultCharset(),!0)}index(){return this._restrictCursor(),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._restrictCursor(),!0}tabSet(){return this._activeBuffer.tabs[this._activeBuffer.x]=!0,!0}reverseIndex(){if(this._restrictCursor(),this._activeBuffer.y===this._activeBuffer.scrollTop){let e=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,e,1),this._activeBuffer.lines.set(this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.getBlankLine(this._eraseAttrData())),this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom)}else this._activeBuffer.y--,this._restrictCursor();return!0}fullReset(){return this._parser.reset(),this._onRequestReset.fire(),!0}reset(){this._curAttrData=D$.clone(),this._eraseAttrDataInternal=D$.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=this._curAttrData.bg&67108863,this._eraseAttrDataInternal}setgLevel(e){return this._charsetService.setgLevel(e),!0}screenAlignmentPattern(){let e=new Gq;e.content=4194373,e.fg=this._curAttrData.fg,e.bg=this._curAttrData.bg,this._setCursor(0,0);for(let t=0;t<this._bufferService.rows;++t){let n=this._activeBuffer.ybase+this._activeBuffer.y+t,r=this._activeBuffer.lines.get(n);r&&(r.fill(e),r.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(e,t){let n=e=>(this._coreService.triggerDataEvent(`${$.ESC}${e}${$.ESC}\\`),!0),r=this._bufferService.buffer,i=this._optionsService.rawOptions;return n(e===`"q`?`P1$r${+!!this._curAttrData.isProtected()}"q`:e===`"p`?`P1$r61;1"p`:e===`r`?`P1$r${r.scrollTop+1};${r.scrollBottom+1}r`:e===`m`?`P1$r0m`:e===` q`?`P1$r${{block:2,underline:4,bar:6}[i.cursorStyle]-+!!i.cursorBlink} q`:`P0$r`)}markRangeDirty(e,t){this._dirtyRowTracker.markRangeDirty(e,t)}},z1=class{constructor(e){this._bufferService=e,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(e){e<this.start?this.start=e:e>this.end&&(this.end=e)}markRangeDirty(e,t){e>t&&(L1=e,e=t,t=L1),e<this.start&&(this.start=e),t>this.end&&(this.end=t)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};z1=Tq([Z(0,Qq)],z1);function B1(e){return 0<=e&&e<256}var V1=5e7,H1=12,U1=50,W1=class extends VJ{constructor(e){super(),this._action=e,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this._register(new Q),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(e,t){if(t!==void 0&&this._syncCalls>t){this._syncCalls=0;return}if(this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;this._isSyncWriting=!0;let n;for(;n=this._writeBuffer.shift();){this._action(n);let e=this._callbacks.shift();e&&e()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(e,t){if(this._pendingData>V1)throw Error(`write data discarded, use flow control to avoid losing data`);if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput){this._didUserInput=!1,this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t),this._innerWrite();return}setTimeout(()=>this._innerWrite())}this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t)}_innerWrite(e=0,t=!0){let n=e||performance.now();for(;this._writeBuffer.length>this._bufferOffset;){let e=this._writeBuffer[this._bufferOffset],r=this._action(e,t);if(r){r.catch(e=>(queueMicrotask(()=>{throw e}),Promise.resolve(!1))).then(e=>performance.now()-n>=H1?setTimeout(()=>this._innerWrite(0,e)):this._innerWrite(n,e));return}let i=this._callbacks[this._bufferOffset];if(i&&i(),this._bufferOffset++,this._pendingData-=e.length,performance.now()-n>=H1)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>U1&&(this._writeBuffer=this._writeBuffer.slice(this._bufferOffset),this._callbacks=this._callbacks.slice(this._bufferOffset),this._bufferOffset=0),setTimeout(()=>this._innerWrite())):(this._writeBuffer.length=0,this._callbacks.length=0,this._pendingData=0,this._bufferOffset=0),this._onWriteParsed.fire()}},G1=class{constructor(e){this._bufferService=e,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(e){let t=this._bufferService.buffer;if(e.id===void 0){let n=t.addMarker(t.ybase+t.y),r={data:e,id:this._nextId++,lines:[n]};return n.onDispose(()=>this._removeMarkerFromLink(r,n)),this._dataByLinkId.set(r.id,r),r.id}let n=e,r=this._getEntryIdKey(n),i=this._entriesWithId.get(r);if(i)return this.addLineToLink(i.id,t.ybase+t.y),i.id;let a=t.addMarker(t.ybase+t.y),o={id:this._nextId++,key:this._getEntryIdKey(n),data:n,lines:[a]};return a.onDispose(()=>this._removeMarkerFromLink(o,a)),this._entriesWithId.set(o.key,o),this._dataByLinkId.set(o.id,o),o.id}addLineToLink(e,t){let n=this._dataByLinkId.get(e);if(n&&n.lines.every(e=>e.line!==t)){let e=this._bufferService.buffer.addMarker(t);n.lines.push(e),e.onDispose(()=>this._removeMarkerFromLink(n,e))}}getLinkData(e){return this._dataByLinkId.get(e)?.data}_getEntryIdKey(e){return`${e.id};;${e.uri}`}_removeMarkerFromLink(e,t){let n=e.lines.indexOf(t);n!==-1&&(e.lines.splice(n,1),e.lines.length===0&&(e.data.id!==void 0&&this._entriesWithId.delete(e.key),this._dataByLinkId.delete(e.id)))}};G1=Tq([Z(0,Qq)],G1);var K1=!1,q1=class extends VJ{constructor(e){super(),this._windowsWrappingHeuristics=this._register(new HJ),this._onBinary=this._register(new Q),this.onBinary=this._onBinary.event,this._onData=this._register(new Q),this.onData=this._onData.event,this._onLineFeed=this._register(new Q),this.onLineFeed=this._onLineFeed.event,this._onResize=this._register(new Q),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new Q),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new Q),this._instantiationService=new b$,this.optionsService=this._register(new J$(e)),this._instantiationService.setService(iJ,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance(G$)),this._instantiationService.setService(Qq,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(C$)),this._instantiationService.setService(rJ,this._logService),this.coreService=this._register(this._instantiationService.createInstance($$)),this._instantiationService.setService(eJ,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(i1)),this._instantiationService.setService($q,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(u1)),this._instantiationService.setService(oJ,this.unicodeService),this._charsetService=this._instantiationService.createInstance(d1),this._instantiationService.setService(tJ,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(G1),this._instantiationService.setService(aJ,this._oscLinkService),this._inputHandler=this._register(new R1(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this._register(YJ.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(this._inputHandler),this._register(YJ.forward(this._bufferService.onResize,this._onResize)),this._register(YJ.forward(this.coreService.onData,this._onData)),this._register(YJ.forward(this.coreService.onBinary,this._onBinary)),this._register(this.coreService.onRequestScrollToBottom(()=>this.scrollToBottom(!0))),this._register(this.coreService.onUserInput(()=>this._writeBuffer.handleUserInput())),this._register(this.optionsService.onMultipleOptionChange([`windowsMode`,`windowsPty`],()=>this._handleWindowsPtyOptionChange())),this._register(this._bufferService.onScroll(()=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)})),this._writeBuffer=this._register(new W1((e,t)=>this._inputHandler.parse(e,t))),this._register(YJ.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new Q),this._onScroll.event(e=>{this._onScrollApi?.fire(e.position)})),this._onScrollApi.event}get cols(){return this._bufferService.cols}get rows(){return this._bufferService.rows}get buffers(){return this._bufferService.buffers}get options(){return this.optionsService.options}set options(e){for(let t in e)this.optionsService.options[t]=e[t]}write(e,t){this._writeBuffer.write(e,t)}writeSync(e,t){this._logService.logLevel<=3&&!K1&&(this._logService.warn(`writeSync is unreliable and will be removed soon.`),K1=!0),this._writeBuffer.writeSync(e,t)}input(e,t=!0){this.coreService.triggerDataEvent(e,t)}resize(e,t){isNaN(e)||isNaN(t)||(e=Math.max(e,U$),t=Math.max(t,W$),this._bufferService.resize(e,t))}scroll(e,t=!1){this._bufferService.scroll(e,t)}scrollLines(e,t){this._bufferService.scrollLines(e,t)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(e){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){let t=e-this._bufferService.buffer.ydisp;t!==0&&this.scrollLines(t)}registerEscHandler(e,t){return this._inputHandler.registerEscHandler(e,t)}registerDcsHandler(e,t){return this._inputHandler.registerDcsHandler(e,t)}registerCsiHandler(e,t){return this._inputHandler.registerCsiHandler(e,t)}registerOscHandler(e,t){return this._inputHandler.registerOscHandler(e,t)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let e=!1,t=this.optionsService.rawOptions.windowsPty;t&&t.buildNumber!==void 0&&t.buildNumber!==void 0?e=t.backend===`conpty`&&t.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(e=!0),e?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){let e=[];e.push(this.onLineFeed(f1.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:`H`},()=>(f1(this._bufferService),!1))),this._windowsWrappingHeuristics.value=RJ(()=>{for(let t of e)t.dispose()})}}},J1={48:[`0`,`)`],49:[`1`,`!`],50:[`2`,`@`],51:[`3`,`#`],52:[`4`,`$`],53:[`5`,`%`],54:[`6`,`^`],55:[`7`,`&`],56:[`8`,`*`],57:[`9`,`(`],186:[`;`,`:`],187:[`=`,`+`],188:[`,`,`<`],189:[`-`,`_`],190:[`.`,`>`],191:[`/`,`?`],192:["`",`~`],219:[`[`,`{`],220:[`\\`,`|`],221:[`]`,`}`],222:[`'`,`"`]};function Y1(e,t,n,r){let i={type:0,cancel:!1,key:void 0},a=+!!e.shiftKey|(e.altKey?2:0)|(e.ctrlKey?4:0)|(e.metaKey?8:0);switch(e.keyCode){case 0:e.key===`UIKeyInputUpArrow`?i.key=t?$.ESC+`OA`:$.ESC+`[A`:e.key===`UIKeyInputLeftArrow`?i.key=t?$.ESC+`OD`:$.ESC+`[D`:e.key===`UIKeyInputRightArrow`?i.key=t?$.ESC+`OC`:$.ESC+`[C`:e.key===`UIKeyInputDownArrow`&&(i.key=t?$.ESC+`OB`:$.ESC+`[B`);break;case 8:i.key=e.ctrlKey?`\b`:$.DEL,e.altKey&&(i.key=$.ESC+i.key);break;case 9:if(e.shiftKey){i.key=$.ESC+`[Z`;break}i.key=$.HT,i.cancel=!0;break;case 13:i.key=e.altKey?$.ESC+$.CR:$.CR,i.cancel=!0;break;case 27:i.key=$.ESC,e.altKey&&(i.key=$.ESC+$.ESC),i.cancel=!0;break;case 37:if(e.metaKey)break;i.key=a?$.ESC+`[1;`+(a+1)+`D`:t?$.ESC+`OD`:$.ESC+`[D`;break;case 39:if(e.metaKey)break;i.key=a?$.ESC+`[1;`+(a+1)+`C`:t?$.ESC+`OC`:$.ESC+`[C`;break;case 38:if(e.metaKey)break;i.key=a?$.ESC+`[1;`+(a+1)+`A`:t?$.ESC+`OA`:$.ESC+`[A`;break;case 40:if(e.metaKey)break;i.key=a?$.ESC+`[1;`+(a+1)+`B`:t?$.ESC+`OB`:$.ESC+`[B`;break;case 45:!e.shiftKey&&!e.ctrlKey&&(i.key=$.ESC+`[2~`);break;case 46:i.key=a?$.ESC+`[3;`+(a+1)+`~`:$.ESC+`[3~`;break;case 36:i.key=a?$.ESC+`[1;`+(a+1)+`H`:t?$.ESC+`OH`:$.ESC+`[H`;break;case 35:i.key=a?$.ESC+`[1;`+(a+1)+`F`:t?$.ESC+`OF`:$.ESC+`[F`;break;case 33:e.shiftKey?i.type=2:i.key=e.ctrlKey?$.ESC+`[5;`+(a+1)+`~`:$.ESC+`[5~`;break;case 34:e.shiftKey?i.type=3:i.key=e.ctrlKey?$.ESC+`[6;`+(a+1)+`~`:$.ESC+`[6~`;break;case 112:i.key=a?$.ESC+`[1;`+(a+1)+`P`:$.ESC+`OP`;break;case 113:i.key=a?$.ESC+`[1;`+(a+1)+`Q`:$.ESC+`OQ`;break;case 114:i.key=a?$.ESC+`[1;`+(a+1)+`R`:$.ESC+`OR`;break;case 115:i.key=a?$.ESC+`[1;`+(a+1)+`S`:$.ESC+`OS`;break;case 116:i.key=a?$.ESC+`[15;`+(a+1)+`~`:$.ESC+`[15~`;break;case 117:i.key=a?$.ESC+`[17;`+(a+1)+`~`:$.ESC+`[17~`;break;case 118:i.key=a?$.ESC+`[18;`+(a+1)+`~`:$.ESC+`[18~`;break;case 119:i.key=a?$.ESC+`[19;`+(a+1)+`~`:$.ESC+`[19~`;break;case 120:i.key=a?$.ESC+`[20;`+(a+1)+`~`:$.ESC+`[20~`;break;case 121:i.key=a?$.ESC+`[21;`+(a+1)+`~`:$.ESC+`[21~`;break;case 122:i.key=a?$.ESC+`[23;`+(a+1)+`~`:$.ESC+`[23~`;break;case 123:i.key=a?$.ESC+`[24;`+(a+1)+`~`:$.ESC+`[24~`;break;default:if(e.ctrlKey&&!e.shiftKey&&!e.altKey&&!e.metaKey)e.keyCode>=65&&e.keyCode<=90?i.key=String.fromCharCode(e.keyCode-64):e.keyCode===32?i.key=$.NUL:e.keyCode>=51&&e.keyCode<=55?i.key=String.fromCharCode(e.keyCode-51+27):e.keyCode===56?i.key=$.DEL:e.keyCode===219?i.key=$.ESC:e.keyCode===220?i.key=$.FS:e.keyCode===221&&(i.key=$.GS);else if((!n||r)&&e.altKey&&!e.metaKey){let t=J1[e.keyCode]?.[+!!e.shiftKey];if(t)i.key=$.ESC+t;else if(e.keyCode>=65&&e.keyCode<=90){let t=e.ctrlKey?e.keyCode-64:e.keyCode+32,n=String.fromCharCode(t);e.shiftKey&&(n=n.toUpperCase()),i.key=$.ESC+n}else if(e.keyCode===32)i.key=$.ESC+(e.ctrlKey?$.NUL:` `);else if(e.key===`Dead`&&e.code.startsWith(`Key`)){let t=e.code.slice(3,4);e.shiftKey||(t=t.toLowerCase()),i.key=$.ESC+t,i.cancel=!0}}else n&&!e.altKey&&!e.ctrlKey&&!e.shiftKey&&e.metaKey?e.keyCode===65&&(i.type=1):e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.keyCode>=48&&e.key.length===1?i.key=e.key:e.key&&e.ctrlKey&&(e.key===`_`&&(i.key=$.US),e.key===`@`&&(i.key=$.NUL))}return i}var X1=0,Z1=class{constructor(e){this._getKey=e,this._array=[],this._insertedValues=[],this._flushInsertedTask=new LQ,this._isFlushingInserted=!1,this._deletedIndices=[],this._flushDeletedTask=new LQ,this._isFlushingDeleted=!1}clear(){this._array.length=0,this._insertedValues.length=0,this._flushInsertedTask.clear(),this._isFlushingInserted=!1,this._deletedIndices.length=0,this._flushDeletedTask.clear(),this._isFlushingDeleted=!1}insert(e){this._flushCleanupDeleted(),this._insertedValues.length===0&&this._flushInsertedTask.enqueue(()=>this._flushInserted()),this._insertedValues.push(e)}_flushInserted(){let e=this._insertedValues.sort((e,t)=>this._getKey(e)-this._getKey(t)),t=0,n=0,r=Array(this._array.length+this._insertedValues.length);for(let i=0;i<r.length;i++)n>=this._array.length||this._getKey(e[t])<=this._getKey(this._array[n])?(r[i]=e[t],t++):r[i]=this._array[n++];this._array=r,this._insertedValues.length=0}_flushCleanupInserted(){!this._isFlushingInserted&&this._insertedValues.length>0&&this._flushInsertedTask.flush()}delete(e){if(this._flushCleanupInserted(),this._array.length===0)return!1;let t=this._getKey(e);if(t===void 0||(X1=this._search(t),X1===-1)||this._getKey(this._array[X1])!==t)return!1;do if(this._array[X1]===e)return this._deletedIndices.length===0&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(X1),!0;while(++X1<this._array.length&&this._getKey(this._array[X1])===t);return!1}_flushDeleted(){this._isFlushingDeleted=!0;let e=this._deletedIndices.sort((e,t)=>e-t),t=0,n=Array(this._array.length-e.length),r=0;for(let i=0;i<this._array.length;i++)e[t]===i?t++:n[r++]=this._array[i];this._array=n,this._deletedIndices.length=0,this._isFlushingDeleted=!1}_flushCleanupDeleted(){!this._isFlushingDeleted&&this._deletedIndices.length>0&&this._flushDeletedTask.flush()}*getKeyIterator(e){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(X1=this._search(e),!(X1<0||X1>=this._array.length)&&this._getKey(this._array[X1])===e))do yield this._array[X1];while(++X1<this._array.length&&this._getKey(this._array[X1])===e)}forEachByKey(e,t){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(X1=this._search(e),!(X1<0||X1>=this._array.length)&&this._getKey(this._array[X1])===e))do t(this._array[X1]);while(++X1<this._array.length&&this._getKey(this._array[X1])===e)}values(){return this._flushCleanupInserted(),this._flushCleanupDeleted(),[...this._array].values()}_search(e){let t=0,n=this._array.length-1;for(;n>=t;){let r=t+n>>1,i=this._getKey(this._array[r]);if(i>e)n=r-1;else if(i<e)t=r+1;else{for(;r>0&&this._getKey(this._array[r-1])===e;)r--;return r}}return t}},Q1=0,$1=0,e0=class extends VJ{constructor(){super(),this._decorations=new Z1(e=>e?.marker.line),this._onDecorationRegistered=this._register(new Q),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this._register(new Q),this.onDecorationRemoved=this._onDecorationRemoved.event,this._register(RJ(()=>this.reset()))}get decorations(){return this._decorations.values()}registerDecoration(e){if(e.marker.isDisposed)return;let t=new t0(e);if(t){let e=t.marker.onDispose(()=>t.dispose()),n=t.onDispose(()=>{n.dispose(),t&&(this._decorations.delete(t)&&this._onDecorationRemoved.fire(t),e.dispose())});this._decorations.insert(t),this._onDecorationRegistered.fire(t)}return t}reset(){for(let e of this._decorations.values())e.dispose();this._decorations.clear()}*getDecorationsAtCell(e,t,n){let r=0,i=0;for(let a of this._decorations.getKeyIterator(t))r=a.options.x??0,i=r+(a.options.width??1),e>=r&&e<i&&(!n||(a.options.layer??`bottom`)===n)&&(yield a)}forEachDecorationAtCell(e,t,n,r){this._decorations.forEachByKey(t,t=>{Q1=t.options.x??0,$1=Q1+(t.options.width??1),e>=Q1&&e<$1&&(!n||(t.options.layer??`bottom`)===n)&&r(t)})}},t0=class extends BJ{constructor(e){super(),this.options=e,this.onRenderEmitter=this.add(new Q),this.onRender=this.onRenderEmitter.event,this._onDispose=this.add(new Q),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=e.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position=`full`)}get backgroundColorRGB(){return this._cachedBg===null&&(this._cachedBg=this.options.backgroundColor?RZ.toColor(this.options.backgroundColor):void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this._cachedFg=this.options.foregroundColor?RZ.toColor(this.options.foregroundColor):void 0),this._cachedFg}dispose(){this._onDispose.fire(),super.dispose()}},n0=1e3,r0=class{constructor(e,t=n0){this._renderCallback=e,this._debounceThresholdMS=t,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(e,t,n){this._rowCount=n,e=e===void 0?0:e,t=t===void 0?this._rowCount-1:t,this._rowStart=this._rowStart===void 0?e:Math.min(this._rowStart,e),this._rowEnd=this._rowEnd===void 0?t:Math.max(this._rowEnd,t);let r=performance.now();if(r-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=r,this._innerRefresh();else if(!this._additionalRefreshRequested){let e=r-this._lastRefreshMs,t=this._debounceThresholdMS-e;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=performance.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},t)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;let e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t)}},i0=20,a0=class extends VJ{constructor(e,t,n,r){super(),this._terminal=e,this._coreBrowserService=n,this._renderService=r,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce=``;let i=this._coreBrowserService.mainDocument;this._accessibilityContainer=i.createElement(`div`),this._accessibilityContainer.classList.add(`xterm-accessibility`),this._rowContainer=i.createElement(`div`),this._rowContainer.setAttribute(`role`,`list`),this._rowContainer.classList.add(`xterm-accessibility-tree`),this._rowElements=[];for(let e=0;e<this._terminal.rows;e++)this._rowElements[e]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[e]);if(this._topBoundaryFocusListener=e=>this._handleBoundaryFocus(e,0),this._bottomBoundaryFocusListener=e=>this._handleBoundaryFocus(e,1),this._rowElements[0].addEventListener(`focus`,this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener(`focus`,this._bottomBoundaryFocusListener),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=i.createElement(`div`),this._liveRegion.classList.add(`live-region`),this._liveRegion.setAttribute(`aria-live`,`assertive`),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this._register(new r0(this._renderRows.bind(this))),!this._terminal.element)throw Error(`Cannot enable accessibility before Terminal.open`);this._terminal.element.insertAdjacentElement(`afterbegin`,this._accessibilityContainer),this._register(this._terminal.onResize(e=>this._handleResize(e.rows))),this._register(this._terminal.onRender(e=>this._refreshRows(e.start,e.end))),this._register(this._terminal.onScroll(()=>this._refreshRows())),this._register(this._terminal.onA11yChar(e=>this._handleChar(e))),this._register(this._terminal.onLineFeed(()=>this._handleChar(`
80
80
  `))),this._register(this._terminal.onA11yTab(e=>this._handleTab(e))),this._register(this._terminal.onKey(e=>this._handleKey(e.key))),this._register(this._terminal.onBlur(()=>this._clearLiveRegion())),this._register(this._renderService.onDimensionsChange(()=>this._refreshRowsDimensions())),this._register(jX(i,`selectionchange`,()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register(RJ(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(e){for(let t=0;t<e;t++)this._handleChar(` `)}_handleChar(e){this._liveRegionLineCount<i0+1&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===`
81
81
  `&&(this._liveRegionLineCount++,this._liveRegionLineCount===i0+1&&(this._liveRegion.textContent+=kq.get())))}_clearLiveRegion(){this._liveRegion.textContent=``,this._liveRegionLineCount=0}_handleKey(e){this._clearLiveRegion(),/\p{Control}/u.test(e)||this._charsToConsume.push(e)}_refreshRows(e,t){this._liveRegionDebouncer.refresh(e,t,this._terminal.rows)}_renderRows(e,t){let n=this._terminal.buffer,r=n.lines.length.toString();for(let i=e;i<=t;i++){let e=n.lines.get(n.ydisp+i),t=[],a=e?.translateToString(!0,void 0,void 0,t)||``,o=(n.ydisp+i+1).toString(),s=this._rowElements[i];s&&(a.length===0?(s.textContent=`\xA0`,this._rowColumns.set(s,[0,1])):(s.textContent=a,this._rowColumns.set(s,t)),s.setAttribute(`aria-posinset`,o),s.setAttribute(`aria-setsize`,r),this._alignRowWidth(s))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce=``)}_handleBoundaryFocus(e,t){let n=e.target,r=this._rowElements[t===0?1:this._rowElements.length-2];if(n.getAttribute(`aria-posinset`)===(t===0?`1`:`${this._terminal.buffer.lines.length}`)||e.relatedTarget!==r)return;let i,a;if(t===0?(i=n,a=this._rowElements.pop(),this._rowContainer.removeChild(a)):(i=this._rowElements.shift(),a=n,this._rowContainer.removeChild(i)),i.removeEventListener(`focus`,this._topBoundaryFocusListener),a.removeEventListener(`focus`,this._bottomBoundaryFocusListener),t===0){let e=this._createAccessibilityTreeNode();this._rowElements.unshift(e),this._rowContainer.insertAdjacentElement(`afterbegin`,e)}else{let e=this._createAccessibilityTreeNode();this._rowElements.push(e),this._rowContainer.appendChild(e)}this._rowElements[0].addEventListener(`focus`,this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener(`focus`,this._bottomBoundaryFocusListener),this._terminal.scrollLines(t===0?-1:1),this._rowElements[t===0?1:this._rowElements.length-2].focus(),e.preventDefault(),e.stopImmediatePropagation()}_handleSelectionChange(){if(this._rowElements.length===0)return;let e=this._coreBrowserService.mainDocument.getSelection();if(!e)return;if(e.isCollapsed){this._rowContainer.contains(e.anchorNode)&&this._terminal.clearSelection();return}if(!e.anchorNode||!e.focusNode){console.error(`anchorNode and/or focusNode are null`);return}let t={node:e.anchorNode,offset:e.anchorOffset},n={node:e.focusNode,offset:e.focusOffset};if((t.node.compareDocumentPosition(n.node)&Node.DOCUMENT_POSITION_PRECEDING||t.node===n.node&&t.offset>n.offset)&&([t,n]=[n,t]),t.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(t={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(t.node))return;let r=this._rowElements.slice(-1)[0];if(n.node.compareDocumentPosition(r)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(n={node:r,offset:r.textContent?.length??0}),!this._rowContainer.contains(n.node))return;let i=({node:e,offset:t})=>{let n=e instanceof Text?e.parentNode:e,r=parseInt(n?.getAttribute(`aria-posinset`),10)-1;if(isNaN(r))return console.warn(`row is invalid. Race condition?`),null;let i=this._rowColumns.get(n);if(!i)return console.warn(`columns is null. Race condition?`),null;let a=t<i.length?i[t]:i.slice(-1)[0]+1;return a>=this._terminal.cols&&(++r,a=0),{row:r,column:a}},a=i(t),o=i(n);if(a&&o){if(a.row>o.row||a.row===o.row&&a.column>=o.column)throw Error(`invalid range`);this._terminal.select(a.column,a.row,(o.row-a.row)*this._terminal.cols-a.column+o.column)}}_handleResize(e){this._rowElements[this._rowElements.length-1].removeEventListener(`focus`,this._bottomBoundaryFocusListener);for(let e=this._rowContainer.children.length;e<this._terminal.rows;e++)this._rowElements[e]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[e]);for(;this._rowElements.length>e;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener(`focus`,this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){let e=this._coreBrowserService.mainDocument.createElement(`div`);return e.setAttribute(`role`,`listitem`),e.tabIndex=-1,this._refreshRowDimensions(e),e}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){Object.assign(this._accessibilityContainer.style,{width:`${this._renderService.dimensions.css.canvas.width}px`,fontSize:`${this._terminal.options.fontSize}px`}),this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let e=0;e<this._terminal.rows;e++)this._refreshRowDimensions(this._rowElements[e]),this._alignRowWidth(this._rowElements[e])}}_refreshRowDimensions(e){e.style.height=`${this._renderService.dimensions.css.cell.height}px`}_alignRowWidth(e){e.style.transform=``;let t=e.getBoundingClientRect().width,n=this._rowColumns.get(e)?.slice(-1)?.[0];if(!n)return;let r=n*this._renderService.dimensions.css.cell.width;e.style.transform=`scaleX(${r/t})`}};a0=Tq([Z(1,nJ),Z(2,dJ),Z(3,pJ)],a0);var o0=class extends VJ{constructor(e,t,n,r,i){super(),this._element=e,this._mouseService=t,this._renderService=n,this._bufferService=r,this._linkProviderService=i,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this._register(new Q),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this._register(new Q),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this._register(RJ(()=>{IJ(this._linkCacheDisposables),this._linkCacheDisposables.length=0,this._lastMouseEvent=void 0,this._activeProviderReplies?.clear()})),this._register(this._bufferService.onResize(()=>{this._clearCurrentLink(),this._wasResized=!0})),this._register(jX(this._element,`mouseleave`,()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this._register(jX(this._element,`mousemove`,this._handleMouseMove.bind(this))),this._register(jX(this._element,`mousedown`,this._handleMouseDown.bind(this))),this._register(jX(this._element,`mouseup`,this._handleMouseUp.bind(this)))}get currentLink(){return this._currentLink}_handleMouseMove(e){this._lastMouseEvent=e;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);if(!t)return;this._isMouseOut=!1;let n=e.composedPath();for(let e=0;e<n.length;e++){let t=n[e];if(t.classList.contains(`xterm`))break;if(t.classList.contains(`xterm-hover`))return}(!this._lastBufferCell||t.x!==this._lastBufferCell.x||t.y!==this._lastBufferCell.y)&&(this._handleHover(t),this._lastBufferCell=t)}_handleHover(e){if(this._activeLine!==e.y||this._wasResized){this._clearCurrentLink(),this._askForLink(e,!1),this._wasResized=!1;return}this._currentLink&&this._linkAtPosition(this._currentLink.link,e)||(this._clearCurrentLink(),this._askForLink(e,!0))}_askForLink(e,t){(!this._activeProviderReplies||!t)&&(this._activeProviderReplies?.forEach(e=>{e?.forEach(e=>{e.link.dispose&&e.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=e.y);let n=!1;for(let[r,i]of this._linkProviderService.linkProviders.entries())t?this._activeProviderReplies?.get(r)&&(n=this._checkLinkProviderResult(r,e,n)):i.provideLinks(e.y,t=>{if(this._isMouseOut)return;let i=t?.map(e=>({link:e}));this._activeProviderReplies?.set(r,i),n=this._checkLinkProviderResult(r,e,n),this._activeProviderReplies?.size===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(e.y,this._activeProviderReplies)})}_removeIntersectingLinks(e,t){let n=new Set;for(let r=0;r<t.size;r++){let i=t.get(r);if(i)for(let t=0;t<i.length;t++){let r=i[t],a=r.link.range.start.y<e?0:r.link.range.start.x,o=r.link.range.end.y>e?this._bufferService.cols:r.link.range.end.x;for(let e=a;e<=o;e++){if(n.has(e)){i.splice(t--,1);break}n.add(e)}}}}_checkLinkProviderResult(e,t,n){if(!this._activeProviderReplies)return n;let r=this._activeProviderReplies.get(e),i=!1;for(let t=0;t<e;t++)(!this._activeProviderReplies.has(t)||this._activeProviderReplies.get(t))&&(i=!0);if(!i&&r){let e=r.find(e=>this._linkAtPosition(e.link,t));e&&(n=!0,this._handleNewLink(e))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!n)for(let e=0;e<this._activeProviderReplies.size;e++){let r=this._activeProviderReplies.get(e)?.find(e=>this._linkAtPosition(e.link,t));if(r){n=!0,this._handleNewLink(r);break}}return n}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(e){if(!this._currentLink)return;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);t&&this._mouseDownLink&&s0(this._mouseDownLink.link,this._currentLink.link)&&this._linkAtPosition(this._currentLink.link,t)&&this._currentLink.link.activate(e,this._currentLink.link.text)}_clearCurrentLink(e,t){!this._currentLink||!this._lastMouseEvent||(!e||!t||this._currentLink.link.range.start.y>=e&&this._currentLink.link.range.end.y<=t)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,IJ(this._linkCacheDisposables),this._linkCacheDisposables.length=0)}_handleNewLink(e){if(!this._lastMouseEvent)return;let t=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);t&&this._linkAtPosition(e.link,t)&&(this._currentLink=e,this._currentLink.state={decorations:{underline:e.link.decorations===void 0||e.link.decorations.underline,pointerCursor:e.link.decorations===void 0||e.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,e.link,this._lastMouseEvent),e.link.decorations={},Object.defineProperties(e.link.decorations,{pointerCursor:{get:()=>this._currentLink?.state?.decorations.pointerCursor,set:e=>{this._currentLink?.state&&this._currentLink.state.decorations.pointerCursor!==e&&(this._currentLink.state.decorations.pointerCursor=e,this._currentLink.state.isHovered&&this._element.classList.toggle(`xterm-cursor-pointer`,e))}},underline:{get:()=>this._currentLink?.state?.decorations.underline,set:t=>{this._currentLink?.state&&this._currentLink?.state?.decorations.underline!==t&&(this._currentLink.state.decorations.underline=t,this._currentLink.state.isHovered&&this._fireUnderlineEvent(e.link,t))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(e=>{if(!this._currentLink)return;let t=e.start===0?0:e.start+1+this._bufferService.buffer.ydisp,n=this._bufferService.buffer.ydisp+1+e.end;if(this._currentLink.link.range.start.y>=t&&this._currentLink.link.range.end.y<=n&&(this._clearCurrentLink(t,n),this._lastMouseEvent)){let e=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);e&&this._askForLink(e,!1)}})))}_linkHover(e,t,n){this._currentLink?.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!0),this._currentLink.state.decorations.pointerCursor&&e.classList.add(`xterm-cursor-pointer`)),t.hover&&t.hover(n,t.text)}_fireUnderlineEvent(e,t){let n=e.range,r=this._bufferService.buffer.ydisp,i=this._createLinkUnderlineEvent(n.start.x-1,n.start.y-r-1,n.end.x,n.end.y-r-1,void 0);(t?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(i)}_linkLeave(e,t,n){this._currentLink?.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!1),this._currentLink.state.decorations.pointerCursor&&e.classList.remove(`xterm-cursor-pointer`)),t.leave&&t.leave(n,t.text)}_linkAtPosition(e,t){let n=e.range.start.y*this._bufferService.cols+e.range.start.x,r=e.range.end.y*this._bufferService.cols+e.range.end.x,i=t.y*this._bufferService.cols+t.x;return n<=i&&i<=r}_positionFromMouseEvent(e,t,n){let r=n.getCoords(e,t,this._bufferService.cols,this._bufferService.rows);if(r)return{x:r[0],y:r[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(e,t,n,r,i){return{x1:e,y1:t,x2:n,y2:r,cols:this._bufferService.cols,fg:i}}};o0=Tq([Z(1,fJ),Z(2,pJ),Z(3,Qq),Z(4,_J)],o0);function s0(e,t){return e.text===t.text&&e.range.start.x===t.range.start.x&&e.range.start.y===t.range.start.y&&e.range.end.x===t.range.end.x&&e.range.end.y===t.range.end.y}var c0=class extends q1{constructor(e={}){super(e),this._linkifier=this._register(new HJ),this.browser=bQ,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new HJ),this._onCursorMove=this._register(new Q),this.onCursorMove=this._onCursorMove.event,this._onKey=this._register(new Q),this.onKey=this._onKey.event,this._onRender=this._register(new Q),this.onRender=this._onRender.event,this._onSelectionChange=this._register(new Q),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this._register(new Q),this.onTitleChange=this._onTitleChange.event,this._onBell=this._register(new Q),this.onBell=this._onBell.event,this._onFocus=this._register(new Q),this._onBlur=this._register(new Q),this._onA11yCharEmitter=this._register(new Q),this._onA11yTabEmitter=this._register(new Q),this._onWillOpen=this._register(new Q),this._setup(),this._decorationService=this._instantiationService.createInstance(e0),this._instantiationService.setService(sJ,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(hQ),this._instantiationService.setService(_J,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(cJ)),this._register(this._inputHandler.onRequestBell(()=>this._onBell.fire())),this._register(this._inputHandler.onRequestRefreshRows(e=>this.refresh(e?.start??0,e?.end??this.rows-1))),this._register(this._inputHandler.onRequestSendFocus(()=>this._reportFocus())),this._register(this._inputHandler.onRequestReset(()=>this.reset())),this._register(this._inputHandler.onRequestWindowsOptionsReport(e=>this._reportWindowsOptions(e))),this._register(this._inputHandler.onColor(e=>this._handleColorEvent(e))),this._register(YJ.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register(YJ.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register(YJ.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register(YJ.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize(e=>this._afterResize(e.cols,e.rows))),this._register(RJ(()=>{this._customKeyEventHandler=void 0,this.element?.parentNode?.removeChild(this.element)}))}get linkifier(){return this._linkifier.value}get onFocus(){return this._onFocus.event}get onBlur(){return this._onBlur.event}get onA11yChar(){return this._onA11yCharEmitter.event}get onA11yTab(){return this._onA11yTabEmitter.event}get onWillOpen(){return this._onWillOpen.event}_handleColorEvent(e){if(this._themeService)for(let t of e){let e,n=``;switch(t.index){case 256:e=`foreground`,n=`10`;break;case 257:e=`background`,n=`11`;break;case 258:e=`cursor`,n=`12`;break;default:e=`ansi`,n=`4;`+t.index}switch(t.type){case 0:let r=LZ.toColorRGB(e===`ansi`?this._themeService.colors.ansi[t.index]:this._themeService.colors[e]);this.coreService.triggerDataEvent(`${$.ESC}]${n};${j1(r)}${kZ.ST}`);break;case 1:if(e===`ansi`)this._themeService.modifyColors(e=>e.ansi[t.index]=IZ.toColor(...t.color));else{let n=e;this._themeService.modifyColors(e=>e[n]=IZ.toColor(...t.color))}break;case 2:this._themeService.restoreColor(t.index)}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(e){e?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(a0,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent($.ESC+`[I`),this.element.classList.add(`focus`),this._showCursor(),this._onFocus.fire()}blur(){return this.textarea?.blur()}_handleTextAreaBlur(){this.textarea.value=``,this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent($.ESC+`[O`),this.element.classList.remove(`focus`),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;let e=this.buffer.ybase+this.buffer.y,t=this.buffer.lines.get(e);if(!t)return;let n=Math.min(this.buffer.x,this.cols-1),r=this._renderService.dimensions.css.cell.height,i=t.getWidth(n),a=this._renderService.dimensions.css.cell.width*i,o=this.buffer.y*this._renderService.dimensions.css.cell.height,s=n*this._renderService.dimensions.css.cell.width;this.textarea.style.left=s+`px`,this.textarea.style.top=o+`px`,this.textarea.style.width=a+`px`,this.textarea.style.height=r+`px`,this.textarea.style.lineHeight=r+`px`,this.textarea.style.zIndex=`-5`}_initGlobal(){this._bindKeys(),this._register(jX(this.element,`copy`,e=>{this.hasSelection()&&Mq(e,this._selectionService)}));let e=e=>Nq(e,this.textarea,this.coreService,this.optionsService);this._register(jX(this.textarea,`paste`,e)),this._register(jX(this.element,`paste`,e)),wQ?this._register(jX(this.element,`mousedown`,e=>{e.button===2&&Iq(e,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register(jX(this.element,`contextmenu`,e=>{Iq(e,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),MQ&&this._register(jX(this.element,`auxclick`,e=>{e.button===1&&Fq(e,this.textarea,this.screenElement)}))}_bindKeys(){this._register(jX(this.textarea,`keyup`,e=>this._keyUp(e),!0)),this._register(jX(this.textarea,`keydown`,e=>this._keyDown(e),!0)),this._register(jX(this.textarea,`keypress`,e=>this._keyPress(e),!0)),this._register(jX(this.textarea,`compositionstart`,()=>this._compositionHelper.compositionstart())),this._register(jX(this.textarea,`compositionupdate`,e=>this._compositionHelper.compositionupdate(e))),this._register(jX(this.textarea,`compositionend`,()=>this._compositionHelper.compositionend())),this._register(jX(this.textarea,`input`,e=>this._inputEvent(e),!0)),this._register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(e){if(!e)throw Error(`Terminal requires a parent element.`);if(e.isConnected||this._logService.debug(`Terminal.open was called on an element that was not attached to the DOM`),this.element?.ownerDocument.defaultView&&this._coreBrowserService){this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView);return}this._document=e.ownerDocument,this.options.documentOverride&&this.options.documentOverride instanceof Document&&(this._document=this.optionsService.rawOptions.documentOverride),this.element=this._document.createElement(`div`),this.element.dir=`ltr`,this.element.classList.add(`terminal`),this.element.classList.add(`xterm`),e.appendChild(this.element);let t=this._document.createDocumentFragment();this._viewportElement=this._document.createElement(`div`),this._viewportElement.classList.add(`xterm-viewport`),t.appendChild(this._viewportElement),this.screenElement=this._document.createElement(`div`),this.screenElement.classList.add(`xterm-screen`),this._register(jX(this.screenElement,`mousemove`,e=>this.updateCursorStyle(e))),this._helperContainer=this._document.createElement(`div`),this._helperContainer.classList.add(`xterm-helpers`),this.screenElement.appendChild(this._helperContainer),t.appendChild(this.screenElement);let n=this.textarea=this._document.createElement(`textarea`);this.textarea.classList.add(`xterm-helper-textarea`),this.textarea.setAttribute(`aria-label`,Dq.get()),NQ||this.textarea.setAttribute(`aria-multiline`,`false`),this.textarea.setAttribute(`autocorrect`,`off`),this.textarea.setAttribute(`autocapitalize`,`off`),this.textarea.setAttribute(`spellcheck`,`false`),this.textarea.tabIndex=0,this._register(this.optionsService.onSpecificOptionChange(`disableStdin`,()=>n.readOnly=this.optionsService.rawOptions.disableStdin)),this.textarea.readOnly=this.optionsService.rawOptions.disableStdin,this._coreBrowserService=this._register(this._instantiationService.createInstance(pQ,this.textarea,e.ownerDocument.defaultView??window,this._document??typeof window<`u`?window.document:null)),this._instantiationService.setService(dJ,this._coreBrowserService),this._register(jX(this.textarea,`focus`,e=>this._handleTextAreaFocus(e))),this._register(jX(this.textarea,`blur`,()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(lQ,this._document,this._helperContainer),this._instantiationService.setService(uJ,this._charSizeService),this._themeService=this._instantiationService.createInstance(_$),this._instantiationService.setService(gJ,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(WZ),this._instantiationService.setService(hJ,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(zQ,this.rows,this.screenElement)),this._instantiationService.setService(pJ,this._renderService),this._register(this._renderService.onRenderedViewportChange(e=>this._onRender.fire(e))),this.onResize(e=>this._renderService.resize(e.cols,e.rows)),this._compositionView=this._document.createElement(`div`),this._compositionView.classList.add(`composition-view`),this._compositionHelper=this._instantiationService.createInstance(AZ,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(vQ),this._instantiationService.setService(fJ,this._mouseService);let r=this._linkifier.value=this._register(this._instantiationService.createInstance(o0,this.screenElement));this.element.appendChild(t);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this._register(this.onCursorMove(()=>{this._renderService.handleCursorMove(),this._syncTextArea()})),this._register(this.onResize(()=>this._renderService.handleResize(this.cols,this.rows))),this._register(this.onBlur(()=>this._renderService.handleBlur())),this._register(this.onFocus(()=>this._renderService.handleFocus())),this._viewport=this._register(this._instantiationService.createInstance(xZ,this.element,this.screenElement)),this._register(this._viewport.onRequestScrollLines(e=>{super.scrollLines(e,!1),this.refresh(0,this.rows-1)})),this._selectionService=this._register(this._instantiationService.createInstance(s$,this.element,this.screenElement,r)),this._instantiationService.setService(mJ,this._selectionService),this._register(this._selectionService.onRequestScrollLines(e=>this.scrollLines(e.amount,e.suppressScrollEvent))),this._register(this._selectionService.onSelectionChange(()=>this._onSelectionChange.fire())),this._register(this._selectionService.onRequestRedraw(e=>this._renderService.handleSelectionChanged(e.start,e.end,e.columnSelectMode))),this._register(this._selectionService.onLinuxMouseSelection(e=>{this.textarea.value=e,this.textarea.focus(),this.textarea.select()})),this._register(YJ.any(this._onScroll.event,this._inputHandler.onScroll)(()=>{this._selectionService.refresh(),this._viewport?.queueSync()})),this._register(this._instantiationService.createInstance(SZ,this.screenElement)),this._register(jX(this.element,`mousedown`,e=>this._selectionService.handleMouseDown(e))),this.coreMouseService.areMouseEventsActive?(this._selectionService.disable(),this.element.classList.add(`enable-mouse-events`)):this._selectionService.enable(),this.options.screenReaderMode&&(this._accessibilityManager.value=this._instantiationService.createInstance(a0,this)),this._register(this.optionsService.onSpecificOptionChange(`screenReaderMode`,e=>this._handleScreenReaderModeOptionChange(e))),this.options.overviewRuler.width&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(DZ,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange(`overviewRuler`,e=>{!this._overviewRulerRenderer&&e&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(DZ,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(cQ,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let e=this,t=this.element;function n(t){let n=e._mouseService.getMouseReportCoords(t,e.screenElement);if(!n)return!1;let r,i;switch(t.overrideType||t.type){case`mousemove`:i=32,t.buttons===void 0?(r=3,t.button!==void 0&&(r=t.button<3?t.button:3)):r=t.buttons&1?0:t.buttons&4?1:t.buttons&2?2:3;break;case`mouseup`:i=0,r=t.button<3?t.button:3;break;case`mousedown`:i=1,r=t.button<3?t.button:3;break;case`wheel`:if(e._customWheelEventHandler&&e._customWheelEventHandler(t)===!1)return!1;let n=t.deltaY;if(n===0||e.coreMouseService.consumeWheelEvent(t,e._renderService?.dimensions?.device?.cell?.height,e._coreBrowserService?.dpr)===0)return!1;i=n<0?0:1,r=4;break;default:return!1}return i===void 0||r===void 0||r>4?!1:e.coreMouseService.triggerMouseEvent({col:n.col,row:n.row,x:n.x,y:n.y,button:r,action:i,ctrl:t.ctrlKey,alt:t.altKey,shift:t.shiftKey})}let r={mouseup:null,wheel:null,mousedrag:null,mousemove:null},i={mouseup:e=>(n(e),e.buttons||(this._document.removeEventListener(`mouseup`,r.mouseup),r.mousedrag&&this._document.removeEventListener(`mousemove`,r.mousedrag)),this.cancel(e)),wheel:e=>(n(e),this.cancel(e,!0)),mousedrag:e=>{e.buttons&&n(e)},mousemove:e=>{e.buttons||n(e)}};this._register(this.coreMouseService.onProtocolChange(e=>{e?(this.optionsService.rawOptions.logLevel===`debug`&&this._logService.debug(`Binding to mouse events:`,this.coreMouseService.explainEvents(e)),this.element.classList.add(`enable-mouse-events`),this._selectionService.disable()):(this._logService.debug(`Unbinding from mouse events.`),this.element.classList.remove(`enable-mouse-events`),this._selectionService.enable()),e&8?r.mousemove||=(t.addEventListener(`mousemove`,i.mousemove),i.mousemove):(t.removeEventListener(`mousemove`,r.mousemove),r.mousemove=null),e&16?r.wheel||=(t.addEventListener(`wheel`,i.wheel,{passive:!1}),i.wheel):(t.removeEventListener(`wheel`,r.wheel),r.wheel=null),e&2?r.mouseup||=i.mouseup:(this._document.removeEventListener(`mouseup`,r.mouseup),r.mouseup=null),e&4?r.mousedrag||=i.mousedrag:(this._document.removeEventListener(`mousemove`,r.mousedrag),r.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this._register(jX(t,`mousedown`,e=>{if(e.preventDefault(),this.focus(),this.coreMouseService.areMouseEventsActive&&!this._selectionService.shouldForceSelection(e))return n(e),r.mouseup&&this._document.addEventListener(`mouseup`,r.mouseup),r.mousedrag&&this._document.addEventListener(`mousemove`,r.mousedrag),this.cancel(e)})),this._register(jX(t,`wheel`,t=>{if(!r.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(t)===!1)return!1;if(!this.buffer.hasScrollback){if(t.deltaY===0)return!1;if(e.coreMouseService.consumeWheelEvent(t,e._renderService?.dimensions?.device?.cell?.height,e._coreBrowserService?.dpr)===0)return this.cancel(t,!0);let n=$.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?`O`:`[`)+(t.deltaY<0?`A`:`B`);return this.coreService.triggerDataEvent(n,!0),this.cancel(t,!0)}}},{passive:!1}))}refresh(e,t){this._renderService?.refreshRows(e,t)}updateCursorStyle(e){this._selectionService?.shouldColumnSelect(e)?this.element.classList.add(`column-select`):this.element.classList.remove(`column-select`)}_showCursor(){this.coreService.isCursorInitialized||(this.coreService.isCursorInitialized=!0,this.refresh(this.buffer.y,this.buffer.y))}scrollLines(e,t){this._viewport?this._viewport.scrollLines(e):super.scrollLines(e,t),this.refresh(0,this.rows-1)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(e){e&&this._viewport?this._viewport.scrollToLine(this.buffer.ybase,!0):this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){let t=e-this._bufferService.buffer.ydisp;t!==0&&this.scrollLines(t)}paste(e){Pq(e,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(e){this._customKeyEventHandler=e}attachCustomWheelEventHandler(e){this._customWheelEventHandler=e}registerLinkProvider(e){return this._linkProviderService.registerLinkProvider(e)}registerCharacterJoiner(e){if(!this._characterJoinerService)throw Error(`Terminal must be opened first`);let t=this._characterJoinerService.register(e);return this.refresh(0,this.rows-1),t}deregisterCharacterJoiner(e){if(!this._characterJoinerService)throw Error(`Terminal must be opened first`);this._characterJoinerService.deregister(e)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(e){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+e)}registerDecoration(e){return this._decorationService.registerDecoration(e)}hasSelection(){return this._selectionService?this._selectionService.hasSelection:!1}select(e,t,n){this._selectionService.setSelection(e,t,n)}getSelection(){return this._selectionService?this._selectionService.selectionText:``}getSelectionPosition(){if(this._selectionService&&this._selectionService.hasSelection)return{start:{x:this._selectionService.selectionStart[0],y:this._selectionService.selectionStart[1]},end:{x:this._selectionService.selectionEnd[0],y:this._selectionService.selectionEnd[1]}}}clearSelection(){this._selectionService?.clearSelection()}selectAll(){this._selectionService?.selectAll()}selectLines(e,t){this._selectionService?.selectLines(e,t)}_keyDown(e){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)return!1;let t=this.browser.isMac&&this.options.macOptionIsMeta&&e.altKey;if(!t&&!this._compositionHelper.keydown(e))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(!0),!1;!t&&(e.key===`Dead`||e.key===`AltGraph`)&&(this._unprocessedDeadKey=!0);let n=Y1(e,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(e),n.type===3||n.type===2){let t=this.rows-1;return this.scrollLines(n.type===2?-t:t),this.cancel(e,!0)}if(n.type===1&&this.selectAll(),this._isThirdLevelShift(this.browser,e)||(n.cancel&&this.cancel(e,!0),!n.key)||e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.key.length===1&&e.key.charCodeAt(0)>=65&&e.key.charCodeAt(0)<=90)return!0;if(this._unprocessedDeadKey)return this._unprocessedDeadKey=!1,!0;if((n.key===$.ETX||n.key===$.CR)&&(this.textarea.value=``),this._onKey.fire({key:n.key,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(n.key,!0),!this.optionsService.rawOptions.screenReaderMode||e.altKey||e.ctrlKey)return this.cancel(e,!0);this._keyDownHandled=!0}_isThirdLevelShift(e,t){let n=e.isMac&&!this.options.macOptionIsMeta&&t.altKey&&!t.ctrlKey&&!t.metaKey||e.isWindows&&t.altKey&&t.ctrlKey&&!t.metaKey||e.isWindows&&t.getModifierState(`AltGraph`);return t.type===`keypress`?n:n&&(!t.keyCode||t.keyCode>47)}_keyUp(e){this._keyDownSeen=!1,!(this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)&&(l0(e)||this.focus(),this.updateCursorStyle(e),this._keyPressHandled=!1)}_keyPress(e){let t;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)return!1;if(this.cancel(e),e.charCode)t=e.charCode;else if(e.which===null||e.which===void 0)t=e.keyCode;else if(e.which!==0&&e.charCode!==0)t=e.which;else return!1;return!t||(e.altKey||e.ctrlKey||e.metaKey)&&!this._isThirdLevelShift(this.browser,e)?!1:(t=String.fromCharCode(t),this._onKey.fire({key:t,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(t,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,!0)}_inputEvent(e){if(e.data&&e.inputType===`insertText`&&(!e.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;let t=e.data;return this.coreService.triggerDataEvent(t,!0),this.cancel(e),!0}return!1}resize(e,t){if(e===this.cols&&t===this.rows){this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure();return}super.resize(e,t)}_afterResize(e,t){this._charSizeService?.measure()}clear(){if(this.buffer.ybase!==0||this.buffer.y!==0){this.buffer.clearAllMarkers(),this.buffer.lines.set(0,this.buffer.lines.get(this.buffer.ybase+this.buffer.y)),this.buffer.lines.length=1,this.buffer.ydisp=0,this.buffer.ybase=0,this.buffer.y=0;for(let e=1;e<this.rows;e++)this.buffer.lines.push(this.buffer.getBlankLine(D$));this._onScroll.fire({position:this.buffer.ydisp}),this.refresh(0,this.rows-1)}}reset(){this.options.rows=this.rows,this.options.cols=this.cols;let e=this._customKeyEventHandler;this._setup(),super.reset(),this._selectionService?.reset(),this._decorationService.reset(),this._customKeyEventHandler=e,this.refresh(0,this.rows-1)}clearTextureAtlas(){this._renderService?.clearTextureAtlas()}_reportFocus(){this.element?.classList.contains(`focus`)?this.coreService.triggerDataEvent($.ESC+`[I`):this.coreService.triggerDataEvent($.ESC+`[O`)}_reportWindowsOptions(e){if(this._renderService)switch(e){case 0:let e=this._renderService.dimensions.css.canvas.width.toFixed(0),t=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${$.ESC}[4;${t};${e}t`);break;case 1:let n=this._renderService.dimensions.css.cell.width.toFixed(0),r=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${$.ESC}[6;${r};${n}t`)}}cancel(e,t){if(this.options.cancelEvents||t)return e.preventDefault(),e.stopPropagation(),!1}};function l0(e){return e.keyCode===16||e.keyCode===17||e.keyCode===18}var u0=class{constructor(){this._addons=[]}dispose(){for(let e=this._addons.length-1;e>=0;e--)this._addons[e].instance.dispose()}loadAddon(e,t){let n={instance:t,dispose:t.dispose,isDisposed:!1};this._addons.push(n),t.dispose=()=>this._wrappedAddonDispose(n),t.activate(e)}_wrappedAddonDispose(e){if(e.isDisposed)return;let t=-1;for(let n=0;n<this._addons.length;n++)if(this._addons[n]===e){t=n;break}if(t===-1)throw Error(`Could not dispose an addon that has not been loaded`);e.isDisposed=!0,e.dispose.apply(e.instance),this._addons.splice(t,1)}},d0=class{constructor(e){this._line=e}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(e,t){if(!(e<0||e>=this._line.length))return t?(this._line.loadCell(e,t),t):this._line.loadCell(e,new Gq)}translateToString(e,t,n){return this._line.translateToString(e,t,n)}},f0=class{constructor(e,t){this._buffer=e,this.type=t}init(e){return this._buffer=e,this}get cursorY(){return this._buffer.y}get cursorX(){return this._buffer.x}get viewportY(){return this._buffer.ydisp}get baseY(){return this._buffer.ybase}get length(){return this._buffer.lines.length}getLine(e){let t=this._buffer.lines.get(e);if(t)return new d0(t)}getNullCell(){return new Gq}},p0=class extends VJ{constructor(e){super(),this._core=e,this._onBufferChange=this._register(new Q),this.onBufferChange=this._onBufferChange.event,this._normal=new f0(this._core.buffers.normal,`normal`),this._alternate=new f0(this._core.buffers.alt,`alternate`),this._core.buffers.onBufferActivate(()=>this._onBufferChange.fire(this.active))}get active(){if(this._core.buffers.active===this._core.buffers.normal)return this.normal;if(this._core.buffers.active===this._core.buffers.alt)return this.alternate;throw Error(`Active buffer is neither normal nor alternate`)}get normal(){return this._normal.init(this._core.buffers.normal)}get alternate(){return this._alternate.init(this._core.buffers.alt)}},m0=class{constructor(e){this._core=e}registerCsiHandler(e,t){return this._core.registerCsiHandler(e,e=>t(e.toArray()))}addCsiHandler(e,t){return this.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._core.registerDcsHandler(e,(e,n)=>t(e,n.toArray()))}addDcsHandler(e,t){return this.registerDcsHandler(e,t)}registerEscHandler(e,t){return this._core.registerEscHandler(e,t)}addEscHandler(e,t){return this.registerEscHandler(e,t)}registerOscHandler(e,t){return this._core.registerOscHandler(e,t)}addOscHandler(e,t){return this.registerOscHandler(e,t)}},h0=class{constructor(e){this._core=e}register(e){this._core.unicodeService.register(e)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(e){this._core.unicodeService.activeVersion=e}},g0=[`cols`,`rows`],_0=0,v0=class extends VJ{constructor(e){super(),this._core=this._register(new c0(e)),this._addonManager=this._register(new u0),this._publicOptions={...this._core.options};let t=e=>this._core.options[e],n=(e,t)=>{this._checkReadonlyOptions(e),this._core.options[e]=t};for(let e in this._core.options){let r={get:t.bind(this,e),set:n.bind(this,e)};Object.defineProperty(this._publicOptions,e,r)}}_checkReadonlyOptions(e){if(g0.includes(e))throw Error(`Option "${e}" can only be set in the constructor`)}_checkProposedApi(){if(!this._core.optionsService.rawOptions.allowProposedApi)throw Error(`You must set the allowProposedApi option to true to use proposed API`)}get onBell(){return this._core.onBell}get onBinary(){return this._core.onBinary}get onCursorMove(){return this._core.onCursorMove}get onData(){return this._core.onData}get onKey(){return this._core.onKey}get onLineFeed(){return this._core.onLineFeed}get onRender(){return this._core.onRender}get onResize(){return this._core.onResize}get onScroll(){return this._core.onScroll}get onSelectionChange(){return this._core.onSelectionChange}get onTitleChange(){return this._core.onTitleChange}get onWriteParsed(){return this._core.onWriteParsed}get element(){return this._core.element}get parser(){return this._parser||=new m0(this._core),this._parser}get unicode(){return this._checkProposedApi(),new h0(this._core)}get textarea(){return this._core.textarea}get rows(){return this._core.rows}get cols(){return this._core.cols}get buffer(){return this._buffer||=this._register(new p0(this._core)),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){let e=this._core.coreService.decPrivateModes,t=`none`;switch(this._core.coreMouseService.activeProtocol){case`X10`:t=`x10`;break;case`VT200`:t=`vt200`;break;case`DRAG`:t=`drag`;break;case`ANY`:t=`any`}return{applicationCursorKeysMode:e.applicationCursorKeys,applicationKeypadMode:e.applicationKeypad,bracketedPasteMode:e.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:t,originMode:e.origin,reverseWraparoundMode:e.reverseWraparound,sendFocusMode:e.sendFocus,synchronizedOutputMode:e.synchronizedOutput,wraparoundMode:e.wraparound}}get options(){return this._publicOptions}set options(e){for(let t in e)this._publicOptions[t]=e[t]}blur(){this._core.blur()}focus(){this._core.focus()}input(e,t=!0){this._core.input(e,t)}resize(e,t){this._verifyIntegers(e,t),this._core.resize(e,t)}open(e){this._core.open(e)}attachCustomKeyEventHandler(e){this._core.attachCustomKeyEventHandler(e)}attachCustomWheelEventHandler(e){this._core.attachCustomWheelEventHandler(e)}registerLinkProvider(e){return this._core.registerLinkProvider(e)}registerCharacterJoiner(e){return this._checkProposedApi(),this._core.registerCharacterJoiner(e)}deregisterCharacterJoiner(e){this._checkProposedApi(),this._core.deregisterCharacterJoiner(e)}registerMarker(e=0){return this._verifyIntegers(e),this._core.registerMarker(e)}registerDecoration(e){return this._checkProposedApi(),this._verifyPositiveIntegers(e.x??0,e.width??0,e.height??0),this._core.registerDecoration(e)}hasSelection(){return this._core.hasSelection()}select(e,t,n){this._verifyIntegers(e,t,n),this._core.select(e,t,n)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(e,t){this._verifyIntegers(e,t),this._core.selectLines(e,t)}dispose(){super.dispose()}scrollLines(e){this._verifyIntegers(e),this._core.scrollLines(e)}scrollPages(e){this._verifyIntegers(e),this._core.scrollPages(e)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(e){this._verifyIntegers(e),this._core.scrollToLine(e)}clear(){this._core.clear()}write(e,t){this._core.write(e,t)}writeln(e,t){this._core.write(e),this._core.write(`\r
82
- `,t)}paste(e){this._core.paste(e)}refresh(e,t){this._verifyIntegers(e,t),this._core.refresh(e,t)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(e){this._addonManager.loadAddon(this,e)}static get strings(){return{get promptLabel(){return Dq.get()},set promptLabel(e){Dq.set(e)},get tooMuchOutput(){return kq.get()},set tooMuchOutput(e){kq.set(e)}}}_verifyIntegers(...e){for(_0 of e)if(_0===1/0||isNaN(_0)||_0%1!=0)throw Error(`This API only accepts integers`)}_verifyPositiveIntegers(...e){for(_0 of e)if(_0&&(_0===1/0||isNaN(_0)||_0%1!=0||_0<0))throw Error(`This API only accepts positive integers`)}},y0={class:`flex flex-col h-full`},b0={class:`px-3.5 py-2 border-b border-base bg-background flex items-center gap-2 flex-shrink-0`},x0=[`title`],S0={class:`ml-auto text-2xs text-muted-foreground flex-shrink-0 op-fade`},C0={class:`flex-1 relative overflow-hidden bg-[#0a0a0a]`},w0={key:0,class:`absolute inset-0 flex flex-col items-center justify-center gap-3 text-muted-foreground text-xs bg-[#0a0a0a]`},T0={class:`op-fade`},E0=P({__name:`Terminal`,props:{cwd:{},terminalStart:{type:Function},terminalInput:{type:Function},terminalResize:{type:Function},terminalPoll:{type:Function},terminalKill:{type:Function}},setup(e){let t=e,n=j(null),r=j(`Starting...`),i=j(!1),a=j(!0),o=j(`Initializing terminal...`),s=null,c=null,l=null,u=null,d=null,f=!1,p={background:`#0a0a0a`,foreground:`#e4e4e7`,cursor:`#e4e4e7`,cursorAccent:`#0a0a0a`,selectionBackground:`#264f78`,black:`#000000`,red:`#dc2626`,green:`#16a34a`,yellow:`#ca8a04`,blue:`#2563eb`,magenta:`#9333ea`,cyan:`#0891b2`,white:`#e4e4e7`,brightBlack:`#71717a`,brightRed:`#f87171`,brightGreen:`#4ade80`,brightYellow:`#facc15`,brightBlue:`#60a5fa`,brightMagenta:`#c084fc`,brightCyan:`#22d3ee`,brightWhite:`#ffffff`};async function m(){if(!n.value||f)return;s=new v0({cursorBlink:!0,fontSize:12,lineHeight:1.2,fontFamily:`'DM Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace`,theme:p,allowProposedApi:!0,scrollback:5e3,convertEol:!1}),c=new xq,s.loadAddon(c),s.open(n.value);try{c.fit()}catch{}let e=s.cols,u=s.rows,d=await t.terminalStart({cwd:t.cwd||`.`,cols:e,rows:u});if(!d||f){f||(a.value=!0,o.value=`Failed to start terminal session`,r.value=`Error`);return}l=d.sessionId,a.value=!1,i.value=!1,r.value=`${e}×${u} · ${t.cwd?y(t.cwd):`cwd`}`,s.onData(e=>{l&&!i.value&&t.terminalInput(l,e)}),s.onResize(({cols:e,rows:n})=>{l&&(t.terminalResize(l,e,n),r.value=`${e}×${n} · ${t.cwd?y(t.cwd):`cwd`}`)}),s.focus(),h()}function h(){async function e(){if(!l||f)return;let n;try{n=await t.terminalPoll(l)}catch{f||(u=setTimeout(e,100));return}if(!f){if(n.data&&s&&s.write(n.data),n.exited){i.value=!0,r.value=`Exited (code ${n.exitCode})`;return}u=setTimeout(e,33)}}e()}function g(){s&&s.clear()}async function _(){l&&=(await t.terminalKill(l),null),u&&=(clearTimeout(u),null),s&&=(s.dispose(),null),c=null,i.value=!1,a.value=!0,o.value=`Restarting...`,r.value=`Restarting...`,await Fn(),await m()}function v(){n.value&&(d=new ResizeObserver(()=>{try{c?.fit()}catch{}}),d.observe(n.value))}function y(e){let t=e.split(`/`);return t.length<=2?e:`.../${t.slice(-2).join(`/`)}`}return Zr(async()=>{await m(),f||v()}),ti(()=>{f=!0,u&&=(clearTimeout(u),null),d&&=(d.disconnect(),null),l&&=(t.terminalKill(l),null),s&&=(s.dispose(),null)}),(t,s)=>(I(),L(`div`,y0,[z(`div`,b0,[B(M(W),{icon:`lucide:square-terminal`,size:14,class:`text-primary flex-shrink-0`}),s[0]||=z(`span`,{class:`text-xs font-medium text-foreground flex-shrink-0`},`Terminal`,-1),e.cwd?(I(),L(`span`,{key:0,class:`text-2xs text-muted-foreground font-mono truncate max-w-[280px] op-fade`,title:e.cwd},A(e.cwd),9,x0)):H(``,!0),z(`span`,S0,[z(`span`,{class:k([`inline-block size-1.5 rounded-full mr-1.5`,i.value?`bg-destructive`:`bg-success`])},null,2),V(` `+A(r.value),1)]),z(`button`,{class:`size-6 flex items-center justify-center text-muted-foreground hover:text-foreground hover:bg-active rounded transition-all cursor-pointer flex-shrink-0`,title:`Clear scrollback`,onClick:g},[B(M(W),{icon:`lucide:eraser`,size:12})]),z(`button`,{class:`size-6 flex items-center justify-center text-muted-foreground hover:text-primary hover:bg-primary/10 rounded transition-all cursor-pointer flex-shrink-0`,title:`Restart session`,onClick:_},[B(M(W),{icon:`lucide:rotate-cw`,size:12})])]),z(`div`,C0,[z(`div`,{ref_key:`containerRef`,ref:n,class:`absolute inset-0 px-2 py-1.5`},null,512),a.value?(I(),L(`div`,w0,[s[1]||=z(`div`,{class:`size-7 border-2 border-muted border-t-primary rounded-full animate-spin`},null,-1),z(`span`,T0,A(o.value),1)])):H(``,!0)])]))}}),D0={class:`h-full flex flex-col bg-background text-foreground relative`},O0={key:0,class:`flex flex-col items-center justify-center h-full py-20 px-5 gap-3.5 text-muted-foreground`},k0={key:1,class:`p-3.5 overflow-y-auto h-full`},A0={class:`flex items-start gap-2.5 p-3 rounded-lg text-xs leading-relaxed bg-destructive/10 text-destructive border border-destructive/15`},j0={class:`op-fade`},M0={key:1,class:`h-full overflow-y-auto`},N0={key:3,class:`h-full flex flex-col`},P0={class:`flex gap-0.5 px-2.5 py-1.5 bg-background border-b border-base flex-shrink-0`},F0=[`data-active`],I0=[`data-active`],L0={key:4,class:`h-full flex flex-col`},R0={class:`flex gap-0.5 px-2.5 py-1.5 bg-background border-b border-base flex-shrink-0`},z0=[`data-active`],B0=[`data-active`],V0={key:12,class:`flex items-center justify-center h-full text-muted-foreground text-sm op-fade`};Xs(P({__name:`App`,setup(e){let{loading:t,error:n,info:r,env:i,uptime:a,fmtUptime:o,fmtTime:s,fmtVal:c,filePath:l,methodClass:u,refresh:d,crudCreate:f,crudRead:p,crudUpdate:m,crudDelete:h,aiChatStream:g,terminalStart:_,terminalInput:v,terminalResize:y,terminalPoll:b,terminalKill:x}=Ww(),S=U(()=>window.location.hash.slice(2)||`overview`),C=j(`routes`),w=j(`pages`),ee=j(`GET`),T=j(`/api/`);function E(e){ee.value=e.method,T.value=e.path,C.value=`playground`}let D=U(()=>{switch(S.value){case`overview`:return`Overview`;case`pages`:return w.value===`layouts`?`Layouts`:`Pages`;case`api`:return C.value===`playground`?`API Playground`:`API Routes`;case`middleware`:return`Middlewares`;case`crons`:return`Crons`;case`env`:return`Environment Variables`;case`config`:return`Config`;case`api-docs`:return`API Docs`;case`database`:return`Database`;case`terminal`:return`Terminal`;default:return`DevTools`}}),te=U(()=>r.value?.config.rootDir||``),ne=U(()=>{if(!r.value)return``;let e=r.value;switch(S.value){case`overview`:return`Project has ${e.pages} pages, ${e.apiRoutes} API routes, ${e.middleware} middleware, ${e.layouts} layouts, ${e.crons} cron jobs.`;case`pages`:return w.value===`layouts`?`${e.layouts} layouts available.`:`${e.pages} pages available.`;case`api`:return C.value===`playground`?`${e.apiRoutes} API routes available to test.`:`${e.apiRoutes} API routes available.`;case`middleware`:return`${e.middleware} middleware registered.`;case`crons`:return`${e.crons} cron jobs registered.`;case`env`:return`${Object.keys(i.value).length} environment variables.`;case`config`:return`Preset: ${e.presets.join(`, `)||`default`}`;default:return``}}),re=j(!1),ie=j(`page`),O=j(!1);async function ae(){O.value||(O.value=!0,await d(),setTimeout(()=>{O.value=!1},500))}let oe={P:`page`,A:`api`,M:`middleware`,L:`layout`,C:`cron`};function se(e){ie.value=e,re.value=!0}function ce(e){if(e.target instanceof HTMLInputElement||e.target instanceof HTMLTextAreaElement||re.value)return;let t=e.key.toUpperCase();if(t===`N`&&(e.metaKey||e.ctrlKey)){e.preventDefault(),se(`page`);return}if(t===`R`){ae();return}oe[t]&&se(oe[t])}function le(e){h(`page`,{path:e.path})}function ue(e){e.filePath&&h(`api`,{path:e.filePath})}function de(e){h(`middleware`,{path:e.path})}function fe(e){h(`layout`,{path:e.path})}function pe(e){e.filePath&&h(`cron`,{path:e.filePath})}let me=j(!1),he=j(``),ge=j(`page`),_e=j(``),ve=j(`typescript`);function ye(e,t,n,r){he.value=e,ge.value=t,_e.value=n,ve.value=r||`typescript`,me.value=!0}function be(e){e.filePath&&ye(e.filePath,`page`,`Edit Page: ${e.path}`,`vue`)}function xe(e){e.filePath&&ye(e.filePath,`api`,`Edit Route: ${e.method} ${e.path}`,`typescript`)}function Se(e){e.filePath&&ye(e.filePath,`middleware`,`Edit Middleware: ${e.path}`,`typescript`)}function Ce(e){e.filePath&&ye(e.filePath,`layout`,`Edit Layout: ${e.name}`,`vue`)}function we(e){e.filePath&&ye(e.filePath,`cron`,`Edit Cron: ${e.name}`,`typescript`)}function Te(){ye(`ubean.config.ts`,`config`,`Edit Project Config`,`typescript`)}let Ee=j(!1),De=j(``),Oe=j(``);function ke(e){e.filePath&&(De.value=e.filePath,Oe.value=e.path,Ee.value=!0)}let Ae=j(!1),je=j(``),Me=j(``),Ne=j(!1);function Pe(){Ne.value=!0,je.value=``,Me.value=``,Ae.value=!0}function Fe(e,t){Ne.value=!1,je.value=e,Me.value=t,Ae.value=!0}async function Ie(e,t){return(await m(`env`,{key:e,value:t})).success?(await d(),!0):!1}function Le(e){h(`env`,{key:e})}return Zr(()=>{window.addEventListener(`keydown`,ce)}),ti(()=>{window.removeEventListener(`keydown`,ce)}),(e,h)=>(I(),R(M(Xy),null,{default:qn(()=>[z(`div`,D0,[M(t)?(I(),L(`div`,O0,[...h[13]||=[z(`img`,{src:`https://r2.soybeanjs.tech/soybeanjs/logo-ubean.svg?v=202608211738`,alt:`ubean`,class:`size-10 op-fade`},null,-1),z(`div`,{class:`size-7 border-2 border-muted border-t-primary rounded-full animate-spin`},null,-1),z(`span`,{class:`text-sm op-fade`},`Loading DevTools...`,-1)]])):M(n)?(I(),L(`div`,k0,[z(`div`,A0,[B(M(W),{icon:`lucide:alert-circle`,size:16,class:`flex-shrink-0 mt-0.5`}),z(`div`,null,[h[14]||=z(`strong`,null,`Connection failed`,-1),h[15]||=z(`br`,null,null,-1),z(`span`,j0,A(M(n)),1)])])])):M(r)?(I(),L(F,{key:2},[z(`button`,{class:`fixed bottom-3 right-3 z-40 size-8 flex items-center justify-center rounded-full bg-secondary border border-base text-muted-foreground hover:text-foreground hover:border-active shadow-md transition-all cursor-pointer`,title:`Refresh (R)`,onClick:ae},[B(M(W),{icon:`lucide:refresh-cw`,size:14,class:k([{"animate-spin":O.value},`transition-transform`])},null,8,[`class`])]),S.value===`ai`?H(``,!0):(I(),R(PH,{key:0,"panel-context":D.value,"resource-summary":ne.value,"send-chat-stream":M(g),"on-refresh":M(d),"ai-enabled":M(r).ai?.enabled},null,8,[`panel-context`,`resource-summary`,`send-chat-stream`,`on-refresh`,`ai-enabled`])),S.value===`overview`?(I(),L(`div`,M0,[B(eq,{info:M(r),uptime:M(a),"fmt-uptime":M(o),"fmt-time":M(s),"fmt-val":M(c)},null,8,[`info`,`uptime`,`fmt-uptime`,`fmt-time`,`fmt-val`])])):S.value===`ai`?(I(),R(NU,{key:2,class:`h-full`,info:M(r),"send-chat-stream":M(g),"on-refresh":M(d)},null,8,[`info`,`send-chat-stream`,`on-refresh`])):S.value===`api`?(I(),L(`div`,N0,[z(`div`,P0,[z(`button`,{class:`inline-flex items-center gap-1.5 px-2.5 py-1 bg-transparent border-none rounded-md text-muted-foreground text-xs font-medium cursor-pointer whitespace-nowrap transition-all duration-150 op-fade hover:op100 hover:text-foreground hover:bg-active data-[active=true]:bg-active data-[active=true]:text-foreground data-[active=true]:op100!`,"data-active":C.value===`routes`,onClick:h[0]||=e=>C.value=`routes`},[B(M(W),{icon:`lucide:send`,size:13}),h[16]||=V(` Routes `,-1)],8,F0),z(`button`,{class:`inline-flex items-center gap-1.5 px-3 py-1.5 bg-transparent border-none rounded-md text-muted-foreground text-xs font-medium cursor-pointer whitespace-nowrap transition-all duration-150 hover:text-foreground data-[active=true]:bg-primary/10 data-[active=true]:text-primary`,"data-active":C.value===`playground`,onClick:h[1]||=e=>C.value=`playground`},[B(M(W),{icon:`lucide:play`,size:13}),h[17]||=V(` Playground `,-1)],8,I0)]),Jn(B(tG,{class:`flex-1 overflow-hidden`,routes:M(r).routes||[],"file-path":M(l),"method-class":M(u),onTryRoute:E,onEdit:xe,onDelete:ue,onCreate:h[2]||=e=>se(`api`)},null,8,[`routes`,`file-path`,`method-class`]),[[$o,C.value===`routes`]]),Jn(B(EW,{class:`flex-1 overflow-hidden`,routes:M(r).routes||[],"method-class":M(u),"initial-method":ee.value,"initial-path":T.value},null,8,[`routes`,`method-class`,`initial-method`,`initial-path`]),[[$o,C.value===`playground`]])])):S.value===`pages`?(I(),L(`div`,L0,[z(`div`,R0,[z(`button`,{class:`inline-flex items-center gap-1.5 px-2.5 py-1 bg-transparent border-none rounded-md text-muted-foreground text-xs font-medium cursor-pointer whitespace-nowrap transition-all duration-150 op-fade hover:op100 hover:text-foreground hover:bg-active data-[active=true]:bg-active data-[active=true]:text-foreground data-[active=true]:op100!`,"data-active":w.value===`pages`,onClick:h[3]||=e=>w.value=`pages`},[B(M(W),{icon:`lucide:file-text`,size:13}),h[18]||=V(` Pages `,-1)],8,z0),z(`button`,{class:`inline-flex items-center gap-1.5 px-3 py-1.5 bg-transparent border-none rounded-md text-muted-foreground text-xs font-medium cursor-pointer whitespace-nowrap transition-all duration-150 hover:text-foreground data-[active=true]:bg-primary/10 data-[active=true]:text-primary`,"data-active":w.value===`layouts`,onClick:h[4]||=e=>w.value=`layouts`},[B(M(W),{icon:`lucide:layout`,size:13}),h[19]||=V(` Layouts `,-1)],8,B0)]),Jn(B(vq,{class:`flex-1 overflow-hidden`,pages:M(r).pagesList||[],"file-path":M(l),onEdit:be,onEditMeta:ke,onDelete:le,onCreate:h[5]||=e=>se(`page`)},null,8,[`pages`,`file-path`]),[[$o,w.value===`pages`]]),Jn(B(gK,{class:`flex-1 overflow-hidden`,layouts:M(r).layoutsList||[],"file-path":M(l),onEdit:Ce,onDelete:fe,onCreate:h[6]||=e=>se(`layout`)},null,8,[`layouts`,`file-path`]),[[$o,w.value===`layouts`]])])):S.value===`middleware`?(I(),R(kK,{key:5,class:`h-full`,middlewares:M(r).middlewaresList||[],"file-path":M(l),onEdit:Se,onDelete:de,onCreate:h[7]||=e=>se(`middleware`)},null,8,[`middlewares`,`file-path`])):S.value===`crons`?(I(),R(kG,{key:6,class:`h-full`,crons:M(r).cronsList||[],"file-path":M(l),onEdit:we,onDelete:pe,onCreate:h[8]||=e=>se(`cron`)},null,8,[`crons`,`file-path`])):S.value===`env`?(I(),R(tK,{key:7,class:`h-full`,env:M(i),"on-add":Pe,"on-edit":Fe,"on-delete":Le},null,8,[`env`])):S.value===`config`?(I(),R(hG,{key:8,class:`h-full`,config:M(r).config||{},info:M(r),"fmt-uptime":M(o),"fmt-time":M(s),"fmt-val":M(c),uptime:M(a),onEdit:Te},null,8,[`config`,`info`,`fmt-uptime`,`fmt-time`,`fmt-val`,`uptime`])):S.value===`api-docs`?(I(),R(LU,{key:9,class:`h-full`,enabled:M(r).openAPI?.enabled,"scalar-path":M(r).openAPI?.scalarPath},null,8,[`enabled`,`scalar-path`])):S.value===`database`?(I(),R(IG,{key:10,class:`h-full`,available:M(r).database?.drizzleStudioAvailable,"studio-url":M(r).database?.studioUrl},null,8,[`available`,`studio-url`])):S.value===`terminal`?(I(),R(E0,{key:11,class:`h-full`,cwd:te.value,"terminal-start":M(_),"terminal-input":M(v),"terminal-resize":M(y),"terminal-poll":M(b),"terminal-kill":M(x)},null,8,[`cwd`,`terminal-start`,`terminal-input`,`terminal-resize`,`terminal-poll`,`terminal-kill`])):(I(),L(`div`,V0,` Unknown view: `+A(S.value),1))],64)):H(``,!0),B(pT,{open:re.value,"initial-type":ie.value,"on-create":M(f),onClose:h[9]||=e=>re.value=!1},null,8,[`open`,`initial-type`,`on-create`]),B(KV,{open:me.value,"file-path":he.value,"resource-type":ge.value,title:_e.value,language:ve.value,"on-read":M(p),"on-save":M(m),onClose:h[10]||=e=>me.value=!1,onSaved:M(d)},null,8,[`open`,`file-path`,`resource-type`,`title`,`language`,`on-read`,`on-save`,`onSaved`]),B(lU,{open:Ee.value,"file-path":De.value,"page-path":Oe.value,"on-read":M(p),"on-save":M(m),onClose:h[11]||=e=>Ee.value=!1,onSaved:M(d)},null,8,[`open`,`file-path`,`page-path`,`on-read`,`on-save`,`onSaved`]),B(aH,{open:Ae.value,"is-new":Ne.value,"initial-key":je.value,"initial-value":Me.value,"on-save":Ie,onClose:h[12]||=e=>Ae.value=!1},null,8,[`open`,`is-new`,`initial-key`,`initial-value`])])]),_:1}))}})).mount(`#app`);export{qb as t};
82
+ `,t)}paste(e){this._core.paste(e)}refresh(e,t){this._verifyIntegers(e,t),this._core.refresh(e,t)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(e){this._addonManager.loadAddon(this,e)}static get strings(){return{get promptLabel(){return Dq.get()},set promptLabel(e){Dq.set(e)},get tooMuchOutput(){return kq.get()},set tooMuchOutput(e){kq.set(e)}}}_verifyIntegers(...e){for(_0 of e)if(_0===1/0||isNaN(_0)||_0%1!=0)throw Error(`This API only accepts integers`)}_verifyPositiveIntegers(...e){for(_0 of e)if(_0&&(_0===1/0||isNaN(_0)||_0%1!=0||_0<0))throw Error(`This API only accepts positive integers`)}},y0={class:`flex flex-col h-full`},b0={class:`px-3.5 py-2 border-b border-base bg-background flex items-center gap-2 flex-shrink-0`},x0=[`title`],S0={class:`ml-auto text-2xs text-muted-foreground flex-shrink-0 op-fade`},C0={class:`flex-1 relative overflow-hidden bg-[#0a0a0a]`},w0={key:0,class:`absolute inset-0 flex flex-col items-center justify-center gap-3 text-muted-foreground text-xs bg-[#0a0a0a]`},T0={class:`op-fade`},E0=P({__name:`Terminal`,props:{cwd:{},terminalStart:{type:Function},terminalInput:{type:Function},terminalResize:{type:Function},terminalPoll:{type:Function},terminalKill:{type:Function}},setup(e){let t=e,n=j(null),r=j(`Starting...`),i=j(!1),a=j(!0),o=j(`Initializing terminal...`),s=null,c=null,l=null,u=null,d=null,f=!1,p={background:`#0a0a0a`,foreground:`#e4e4e7`,cursor:`#e4e4e7`,cursorAccent:`#0a0a0a`,selectionBackground:`#264f78`,black:`#000000`,red:`#dc2626`,green:`#16a34a`,yellow:`#ca8a04`,blue:`#2563eb`,magenta:`#9333ea`,cyan:`#0891b2`,white:`#e4e4e7`,brightBlack:`#71717a`,brightRed:`#f87171`,brightGreen:`#4ade80`,brightYellow:`#facc15`,brightBlue:`#60a5fa`,brightMagenta:`#c084fc`,brightCyan:`#22d3ee`,brightWhite:`#ffffff`};async function m(){if(!n.value||f)return;s=new v0({cursorBlink:!0,fontSize:12,lineHeight:1.2,fontFamily:`'DM Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace`,theme:p,allowProposedApi:!0,scrollback:5e3,convertEol:!1}),c=new xq,s.loadAddon(c),s.open(n.value);try{c.fit()}catch{}let e=s.cols,u=s.rows,d=await t.terminalStart({cwd:t.cwd||`.`,cols:e,rows:u});if(!d||f){f||(a.value=!0,o.value=`Failed to start terminal session`,r.value=`Error`);return}l=d.sessionId,a.value=!1,i.value=!1,r.value=`${e}×${u} · ${t.cwd?y(t.cwd):`cwd`}`,s.onData(e=>{l&&!i.value&&t.terminalInput(l,e)}),s.onResize(({cols:e,rows:n})=>{l&&(t.terminalResize(l,e,n),r.value=`${e}×${n} · ${t.cwd?y(t.cwd):`cwd`}`)}),s.focus(),h()}function h(){async function e(){if(!l||f)return;let n;try{n=await t.terminalPoll(l)}catch{f||(u=setTimeout(e,100));return}if(!f){if(n.data&&s&&s.write(n.data),n.exited){i.value=!0,r.value=`Exited (code ${n.exitCode})`;return}u=setTimeout(e,33)}}e()}function g(){s&&s.clear()}async function _(){l&&=(await t.terminalKill(l),null),u&&=(clearTimeout(u),null),s&&=(s.dispose(),null),c=null,i.value=!1,a.value=!0,o.value=`Restarting...`,r.value=`Restarting...`,await Fn(),await m()}function v(){n.value&&(d=new ResizeObserver(()=>{try{c?.fit()}catch{}}),d.observe(n.value))}function y(e){let t=e.split(`/`);return t.length<=2?e:`.../${t.slice(-2).join(`/`)}`}return Zr(async()=>{await m(),f||v()}),ti(()=>{f=!0,u&&=(clearTimeout(u),null),d&&=(d.disconnect(),null),l&&=(t.terminalKill(l),null),s&&=(s.dispose(),null)}),(t,s)=>(I(),L(`div`,y0,[z(`div`,b0,[B(M(W),{icon:`lucide:square-terminal`,size:14,class:`text-primary flex-shrink-0`}),s[0]||=z(`span`,{class:`text-xs font-medium text-foreground flex-shrink-0`},`Terminal`,-1),e.cwd?(I(),L(`span`,{key:0,class:`text-2xs text-muted-foreground font-mono truncate max-w-[280px] op-fade`,title:e.cwd},A(e.cwd),9,x0)):H(``,!0),z(`span`,S0,[z(`span`,{class:k([`inline-block size-1.5 rounded-full mr-1.5`,i.value?`bg-destructive`:`bg-success`])},null,2),V(` `+A(r.value),1)]),z(`button`,{class:`size-6 flex items-center justify-center text-muted-foreground hover:text-foreground hover:bg-active rounded transition-all cursor-pointer flex-shrink-0`,title:`Clear scrollback`,onClick:g},[B(M(W),{icon:`lucide:eraser`,size:12})]),z(`button`,{class:`size-6 flex items-center justify-center text-muted-foreground hover:text-primary hover:bg-primary/10 rounded transition-all cursor-pointer flex-shrink-0`,title:`Restart session`,onClick:_},[B(M(W),{icon:`lucide:rotate-cw`,size:12})])]),z(`div`,C0,[z(`div`,{ref_key:`containerRef`,ref:n,class:`absolute inset-0 px-2 py-1.5`},null,512),a.value?(I(),L(`div`,w0,[s[1]||=z(`div`,{class:`size-7 border-2 border-muted border-t-primary rounded-full animate-spin`},null,-1),z(`span`,T0,A(o.value),1)])):H(``,!0)])]))}}),D0={class:`h-full flex flex-col bg-background text-foreground relative`},O0={key:0,class:`flex flex-col items-center justify-center h-full py-20 px-5 gap-3.5 text-muted-foreground`},k0={key:1,class:`p-3.5 overflow-y-auto h-full`},A0={class:`flex items-start gap-2.5 p-3 rounded-lg text-xs leading-relaxed bg-destructive/10 text-destructive border border-destructive/15`},j0={class:`op-fade`},M0={key:1,class:`h-full overflow-y-auto`},N0={key:3,class:`h-full flex flex-col`},P0={class:`flex gap-0.5 px-2.5 py-1.5 bg-background border-b border-base flex-shrink-0`},F0=[`data-active`],I0=[`data-active`],L0={key:4,class:`h-full flex flex-col`},R0={class:`flex gap-0.5 px-2.5 py-1.5 bg-background border-b border-base flex-shrink-0`},z0=[`data-active`],B0=[`data-active`],V0={key:12,class:`flex items-center justify-center h-full text-muted-foreground text-sm op-fade`};Xs(P({__name:`App`,setup(e){let{loading:t,error:n,info:r,env:i,uptime:a,fmtUptime:o,fmtTime:s,fmtVal:c,filePath:l,methodClass:u,refresh:d,crudCreate:f,crudRead:p,crudUpdate:m,crudDelete:h,aiChatStream:g,terminalStart:_,terminalInput:v,terminalResize:y,terminalPoll:b,terminalKill:x}=Ww(),S=U(()=>window.location.hash.slice(2)||`overview`),C=j(`routes`),w=j(`pages`),ee=j(`GET`),T=j(`/api/`);function E(e){ee.value=e.method,T.value=e.path,C.value=`playground`}let D=U(()=>{switch(S.value){case`overview`:return`Overview`;case`pages`:return w.value===`layouts`?`Layouts`:`Pages`;case`api`:return C.value===`playground`?`API Playground`:`API Routes`;case`middleware`:return`Middlewares`;case`crons`:return`Crons`;case`env`:return`Environment Variables`;case`config`:return`Config`;case`api-docs`:return`API Docs`;case`database`:return`Database`;case`terminal`:return`Terminal`;default:return`DevTools`}}),te=U(()=>r.value?.config.rootDir||``),ne=U(()=>{if(!r.value)return``;let e=r.value;switch(S.value){case`overview`:return`Project has ${e.pages} pages, ${e.apiRoutes} API routes, ${e.middleware} middleware, ${e.layouts} layouts, ${e.crons} cron jobs.`;case`pages`:return w.value===`layouts`?`${e.layouts} layouts available.`:`${e.pages} pages available.`;case`api`:return C.value===`playground`?`${e.apiRoutes} API routes available to test.`:`${e.apiRoutes} API routes available.`;case`middleware`:return`${e.middleware} middleware registered.`;case`crons`:return`${e.crons} cron jobs registered.`;case`env`:return`${Object.keys(i.value).length} environment variables.`;case`config`:return`Preset: ${e.presets.join(`, `)||`default`}`;default:return``}}),re=j(!1),ie=j(`page`),O=j(!1);async function ae(){O.value||(O.value=!0,await d(),setTimeout(()=>{O.value=!1},500))}let oe={P:`page`,A:`api`,M:`middleware`,L:`layout`,C:`cron`};function se(e){ie.value=e,re.value=!0}function ce(e){if(e.target instanceof HTMLInputElement||e.target instanceof HTMLTextAreaElement||re.value)return;let t=e.key.toUpperCase();if(t===`N`&&(e.metaKey||e.ctrlKey)){e.preventDefault(),se(`page`);return}if(t===`R`){ae();return}oe[t]&&se(oe[t])}function le(e){h(`page`,{path:e.path})}function ue(e){e.filePath&&h(`api`,{path:e.filePath})}function de(e){h(`middleware`,{path:e.path})}function fe(e){h(`layout`,{path:e.path})}function pe(e){e.filePath&&h(`cron`,{path:e.filePath})}let me=j(!1),he=j(``),ge=j(`page`),_e=j(``),ve=j(`typescript`);function ye(e,t,n,r){he.value=e,ge.value=t,_e.value=n,ve.value=r||`typescript`,me.value=!0}function be(e){e.filePath&&ye(e.filePath,`page`,`Edit Page: ${e.path}`,`vue`)}function xe(e){e.filePath&&ye(e.filePath,`api`,`Edit Route: ${e.method} ${e.path}`,`typescript`)}function Se(e){e.filePath&&ye(e.filePath,`middleware`,`Edit Middleware: ${e.path}`,`typescript`)}function Ce(e){e.filePath&&ye(e.filePath,`layout`,`Edit Layout: ${e.name}`,`vue`)}function we(e){e.filePath&&ye(e.filePath,`cron`,`Edit Cron: ${e.name}`,`typescript`)}function Te(){ye(`ubean.config.ts`,`config`,`Edit Project Config`,`typescript`)}let Ee=j(!1),De=j(``),Oe=j(``);function ke(e){e.filePath&&(De.value=e.filePath,Oe.value=e.path,Ee.value=!0)}let Ae=j(!1),je=j(``),Me=j(``),Ne=j(!1);function Pe(){Ne.value=!0,je.value=``,Me.value=``,Ae.value=!0}function Fe(e,t){Ne.value=!1,je.value=e,Me.value=t,Ae.value=!0}async function Ie(e,t){return(await m(`env`,{key:e,value:t})).success?(await d(),!0):!1}function Le(e){h(`env`,{key:e})}return Zr(()=>{window.addEventListener(`keydown`,ce)}),ti(()=>{window.removeEventListener(`keydown`,ce)}),(e,h)=>(I(),R(M(Xy),null,{default:qn(()=>[z(`div`,D0,[M(t)?(I(),L(`div`,O0,[...h[13]||=[z(`img`,{src:`https://img.soybeanjs.dev/logo-ubean.svg?v=202608211738`,alt:`ubean`,class:`size-10 op-fade`},null,-1),z(`div`,{class:`size-7 border-2 border-muted border-t-primary rounded-full animate-spin`},null,-1),z(`span`,{class:`text-sm op-fade`},`Loading DevTools...`,-1)]])):M(n)?(I(),L(`div`,k0,[z(`div`,A0,[B(M(W),{icon:`lucide:alert-circle`,size:16,class:`flex-shrink-0 mt-0.5`}),z(`div`,null,[h[14]||=z(`strong`,null,`Connection failed`,-1),h[15]||=z(`br`,null,null,-1),z(`span`,j0,A(M(n)),1)])])])):M(r)?(I(),L(F,{key:2},[z(`button`,{class:`fixed bottom-3 right-3 z-40 size-8 flex items-center justify-center rounded-full bg-secondary border border-base text-muted-foreground hover:text-foreground hover:border-active shadow-md transition-all cursor-pointer`,title:`Refresh (R)`,onClick:ae},[B(M(W),{icon:`lucide:refresh-cw`,size:14,class:k([{"animate-spin":O.value},`transition-transform`])},null,8,[`class`])]),S.value===`ai`?H(``,!0):(I(),R(PH,{key:0,"panel-context":D.value,"resource-summary":ne.value,"send-chat-stream":M(g),"on-refresh":M(d),"ai-enabled":M(r).ai?.enabled},null,8,[`panel-context`,`resource-summary`,`send-chat-stream`,`on-refresh`,`ai-enabled`])),S.value===`overview`?(I(),L(`div`,M0,[B(eq,{info:M(r),uptime:M(a),"fmt-uptime":M(o),"fmt-time":M(s),"fmt-val":M(c)},null,8,[`info`,`uptime`,`fmt-uptime`,`fmt-time`,`fmt-val`])])):S.value===`ai`?(I(),R(NU,{key:2,class:`h-full`,info:M(r),"send-chat-stream":M(g),"on-refresh":M(d)},null,8,[`info`,`send-chat-stream`,`on-refresh`])):S.value===`api`?(I(),L(`div`,N0,[z(`div`,P0,[z(`button`,{class:`inline-flex items-center gap-1.5 px-2.5 py-1 bg-transparent border-none rounded-md text-muted-foreground text-xs font-medium cursor-pointer whitespace-nowrap transition-all duration-150 op-fade hover:op100 hover:text-foreground hover:bg-active data-[active=true]:bg-active data-[active=true]:text-foreground data-[active=true]:op100!`,"data-active":C.value===`routes`,onClick:h[0]||=e=>C.value=`routes`},[B(M(W),{icon:`lucide:send`,size:13}),h[16]||=V(` Routes `,-1)],8,F0),z(`button`,{class:`inline-flex items-center gap-1.5 px-3 py-1.5 bg-transparent border-none rounded-md text-muted-foreground text-xs font-medium cursor-pointer whitespace-nowrap transition-all duration-150 hover:text-foreground data-[active=true]:bg-primary/10 data-[active=true]:text-primary`,"data-active":C.value===`playground`,onClick:h[1]||=e=>C.value=`playground`},[B(M(W),{icon:`lucide:play`,size:13}),h[17]||=V(` Playground `,-1)],8,I0)]),Jn(B(tG,{class:`flex-1 overflow-hidden`,routes:M(r).routes||[],"file-path":M(l),"method-class":M(u),onTryRoute:E,onEdit:xe,onDelete:ue,onCreate:h[2]||=e=>se(`api`)},null,8,[`routes`,`file-path`,`method-class`]),[[$o,C.value===`routes`]]),Jn(B(EW,{class:`flex-1 overflow-hidden`,routes:M(r).routes||[],"method-class":M(u),"initial-method":ee.value,"initial-path":T.value},null,8,[`routes`,`method-class`,`initial-method`,`initial-path`]),[[$o,C.value===`playground`]])])):S.value===`pages`?(I(),L(`div`,L0,[z(`div`,R0,[z(`button`,{class:`inline-flex items-center gap-1.5 px-2.5 py-1 bg-transparent border-none rounded-md text-muted-foreground text-xs font-medium cursor-pointer whitespace-nowrap transition-all duration-150 op-fade hover:op100 hover:text-foreground hover:bg-active data-[active=true]:bg-active data-[active=true]:text-foreground data-[active=true]:op100!`,"data-active":w.value===`pages`,onClick:h[3]||=e=>w.value=`pages`},[B(M(W),{icon:`lucide:file-text`,size:13}),h[18]||=V(` Pages `,-1)],8,z0),z(`button`,{class:`inline-flex items-center gap-1.5 px-3 py-1.5 bg-transparent border-none rounded-md text-muted-foreground text-xs font-medium cursor-pointer whitespace-nowrap transition-all duration-150 hover:text-foreground data-[active=true]:bg-primary/10 data-[active=true]:text-primary`,"data-active":w.value===`layouts`,onClick:h[4]||=e=>w.value=`layouts`},[B(M(W),{icon:`lucide:layout`,size:13}),h[19]||=V(` Layouts `,-1)],8,B0)]),Jn(B(vq,{class:`flex-1 overflow-hidden`,pages:M(r).pagesList||[],"file-path":M(l),onEdit:be,onEditMeta:ke,onDelete:le,onCreate:h[5]||=e=>se(`page`)},null,8,[`pages`,`file-path`]),[[$o,w.value===`pages`]]),Jn(B(gK,{class:`flex-1 overflow-hidden`,layouts:M(r).layoutsList||[],"file-path":M(l),onEdit:Ce,onDelete:fe,onCreate:h[6]||=e=>se(`layout`)},null,8,[`layouts`,`file-path`]),[[$o,w.value===`layouts`]])])):S.value===`middleware`?(I(),R(kK,{key:5,class:`h-full`,middlewares:M(r).middlewaresList||[],"file-path":M(l),onEdit:Se,onDelete:de,onCreate:h[7]||=e=>se(`middleware`)},null,8,[`middlewares`,`file-path`])):S.value===`crons`?(I(),R(kG,{key:6,class:`h-full`,crons:M(r).cronsList||[],"file-path":M(l),onEdit:we,onDelete:pe,onCreate:h[8]||=e=>se(`cron`)},null,8,[`crons`,`file-path`])):S.value===`env`?(I(),R(tK,{key:7,class:`h-full`,env:M(i),"on-add":Pe,"on-edit":Fe,"on-delete":Le},null,8,[`env`])):S.value===`config`?(I(),R(hG,{key:8,class:`h-full`,config:M(r).config||{},info:M(r),"fmt-uptime":M(o),"fmt-time":M(s),"fmt-val":M(c),uptime:M(a),onEdit:Te},null,8,[`config`,`info`,`fmt-uptime`,`fmt-time`,`fmt-val`,`uptime`])):S.value===`api-docs`?(I(),R(LU,{key:9,class:`h-full`,enabled:M(r).openAPI?.enabled,"scalar-path":M(r).openAPI?.scalarPath},null,8,[`enabled`,`scalar-path`])):S.value===`database`?(I(),R(IG,{key:10,class:`h-full`,available:M(r).database?.drizzleStudioAvailable,"studio-url":M(r).database?.studioUrl},null,8,[`available`,`studio-url`])):S.value===`terminal`?(I(),R(E0,{key:11,class:`h-full`,cwd:te.value,"terminal-start":M(_),"terminal-input":M(v),"terminal-resize":M(y),"terminal-poll":M(b),"terminal-kill":M(x)},null,8,[`cwd`,`terminal-start`,`terminal-input`,`terminal-resize`,`terminal-poll`,`terminal-kill`])):(I(),L(`div`,V0,` Unknown view: `+A(S.value),1))],64)):H(``,!0),B(pT,{open:re.value,"initial-type":ie.value,"on-create":M(f),onClose:h[9]||=e=>re.value=!1},null,8,[`open`,`initial-type`,`on-create`]),B(KV,{open:me.value,"file-path":he.value,"resource-type":ge.value,title:_e.value,language:ve.value,"on-read":M(p),"on-save":M(m),onClose:h[10]||=e=>me.value=!1,onSaved:M(d)},null,8,[`open`,`file-path`,`resource-type`,`title`,`language`,`on-read`,`on-save`,`onSaved`]),B(lU,{open:Ee.value,"file-path":De.value,"page-path":Oe.value,"on-read":M(p),"on-save":M(m),onClose:h[11]||=e=>Ee.value=!1,onSaved:M(d)},null,8,[`open`,`file-path`,`page-path`,`on-read`,`on-save`,`onSaved`]),B(aH,{open:Ae.value,"is-new":Ne.value,"initial-key":je.value,"initial-value":Me.value,"on-save":Ie,onClose:h[12]||=e=>Ae.value=!1},null,8,[`open`,`is-new`,`initial-key`,`initial-value`])])]),_:1}))}})).mount(`#app`);export{qb as t};