cognova 0.2.26 → 0.2.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.output/nitro.json +1 -1
- package/.output/public/_nuxt/{C4Ii8cYC.js → 2Eo3qwxj.js} +1 -1
- package/.output/public/_nuxt/{lfg-J79K.js → 2ixlK8td.js} +1 -1
- package/.output/public/_nuxt/{D57E8FC4.js → 2nDmPuey.js} +1 -1
- package/.output/public/_nuxt/{rVZcJ6Pz.js → 6f0CtDWh.js} +1 -1
- package/.output/public/_nuxt/{46eRQaVv.js → 7VIfpS3K.js} +1 -1
- package/.output/public/_nuxt/{BD07a6OS.js → 8T7bItPs.js} +3 -3
- package/.output/public/_nuxt/{Dc_VwXJs.js → B2ejvp4F.js} +1 -1
- package/.output/public/_nuxt/{bHsFNLQP.js → B3EVQLy0.js} +1 -1
- package/.output/public/_nuxt/{D_1GDAlv.js → B3WWnSJo.js} +1 -1
- package/.output/public/_nuxt/{CtNN2F57.js → B6kGLfxE.js} +1 -1
- package/.output/public/_nuxt/{BHAaeL5L.js → B8E4nRtc.js} +1 -1
- package/.output/public/_nuxt/{CIDjuJ7I.js → BF1GoXYw.js} +1 -1
- package/.output/public/_nuxt/{DEmzTuCa.js → BFhzL-L6.js} +1 -1
- package/.output/public/_nuxt/{CruI_TS3.js → BH_Lonko.js} +1 -1
- package/.output/public/_nuxt/{DEBOaUgW.js → BIRrab0B.js} +1 -1
- package/.output/public/_nuxt/{swgNRlWy.js → BIRvCR2S.js} +1 -1
- package/.output/public/_nuxt/{B8fLdQfp.js → BISpLSKY.js} +1 -1
- package/.output/public/_nuxt/{qI8JV5dU.js → BIhmDjJ8.js} +1 -1
- package/.output/public/_nuxt/BMsNdiuj.js +1 -0
- package/.output/public/_nuxt/{Bxs6RCfp.js → BP60VAOa.js} +1 -1
- package/.output/public/_nuxt/{D4wS6gzr.js → BRHBOpyl.js} +1 -1
- package/.output/public/_nuxt/{FGRiZ9J1.js → BSHWLnRg.js} +1 -1
- package/.output/public/_nuxt/BUa1DKMp.js +1 -0
- package/.output/public/_nuxt/{CIMG8oEU.js → BWgA6Icb.js} +1 -1
- package/.output/public/_nuxt/{Cwdn7ZtG.js → BY7b-3vi.js} +1 -1
- package/.output/public/_nuxt/{VRRYjCaC.js → BYRCVlFB.js} +1 -1
- package/.output/public/_nuxt/{C1wI_STa.js → B_IIr5Dj.js} +2 -2
- package/.output/public/_nuxt/{DFPu4h4a.js → BcGMY6mI.js} +1 -1
- package/.output/public/_nuxt/{CZvTOsiz.js → Bes0SO2V.js} +1 -1
- package/.output/public/_nuxt/{DmGbOc_e.js → Bf_52ujb.js} +1 -1
- package/.output/public/_nuxt/BgQoNHMg.js +1 -0
- package/.output/public/_nuxt/{BVkPh7-9.js → BiDXeTfW.js} +1 -1
- package/.output/public/_nuxt/{iTZxBLAr.js → BiIuqBpS.js} +3 -3
- package/.output/public/_nuxt/{9vdFTPZC.js → BiQQLbjx.js} +1 -1
- package/.output/public/_nuxt/{FmfogFAR.js → BivpMuR_.js} +1 -1
- package/.output/public/_nuxt/{CZQeFnOf.js → Bl7M4LXt.js} +1 -1
- package/.output/public/_nuxt/{zvDhkxQS.js → Bo6WXrLP.js} +1 -1
- package/.output/public/_nuxt/{rY0W1r76.js → BpN402qF.js} +2 -2
- package/.output/public/_nuxt/{DM9s28TO.js → BpyMs36w.js} +1 -1
- package/.output/public/_nuxt/{Brmj91Ns.js → Bq9rkJSd.js} +1 -1
- package/.output/public/_nuxt/{C3dJrgZH.js → BqSmw12h.js} +1 -1
- package/.output/public/_nuxt/{Dkpxacka.js → BrN_ntKk.js} +1 -1
- package/.output/public/_nuxt/{ChIzYvpz.js → Bx3A9QLd.js} +1 -1
- package/.output/public/_nuxt/{D5AjrkGO.js → Bzkzi9GX.js} +1 -1
- package/.output/public/_nuxt/{CCmSsj4q.js → C1pt3HyX.js} +1 -1
- package/.output/public/_nuxt/{B0_Iu2zi.js → C4XDZQVz.js} +1 -1
- package/.output/public/_nuxt/{BZjMzGZM.js → C4zN4OGX.js} +1 -1
- package/.output/public/_nuxt/{w3RSHXA6.js → C5IBUVPW.js} +1 -1
- package/.output/public/_nuxt/{wSCSxjgr.js → C6IV65Gy.js} +1 -1
- package/.output/public/_nuxt/{3AgfIirx.js → C6M-e7pT.js} +1 -1
- package/.output/public/_nuxt/{B1ea1Zc2.js → CAANELnI.js} +1 -1
- package/.output/public/_nuxt/{C7Wu2u5C.js → CAaAX5yO.js} +1 -1
- package/.output/public/_nuxt/{BGV4_re9.js → CAdrgifl.js} +1 -1
- package/.output/public/_nuxt/{BTImkTzA.js → CDX3o-x3.js} +1 -1
- package/.output/public/_nuxt/{CD6r4z4e.js → CJAiAVnY.js} +1 -1
- package/.output/public/_nuxt/{CjkXqgrT.js → CJa5E6Hb.js} +1 -1
- package/.output/public/_nuxt/{BHcVB9Fo.js → CKcctj3r.js} +1 -1
- package/.output/public/_nuxt/{Co86ycpI.js → CLk-ZoD9.js} +1 -1
- package/.output/public/_nuxt/{P3qGksT8.js → CSQciH0m.js} +1 -1
- package/.output/public/_nuxt/{BqyI8nU4.js → CSZw5eEq.js} +1 -1
- package/.output/public/_nuxt/{CrHLmWKE.js → CSu09NYz.js} +1 -1
- package/.output/public/_nuxt/{CZ5B974o.js → CSwU6kaw.js} +1 -1
- package/.output/public/_nuxt/{v-LIF5tR.js → CU58Jr3-.js} +1 -1
- package/.output/public/_nuxt/{DIMnGgEU.js → CXWZZrP6.js} +1 -1
- package/.output/public/_nuxt/{CGgHmnnS.js → CZT64TBr.js} +3 -3
- package/.output/public/_nuxt/{CLmiWiqr.js → CZZl10o-.js} +1 -1
- package/.output/public/_nuxt/{BwLYFg9w.js → CbLDrSEX.js} +1 -1
- package/.output/public/_nuxt/{DfAWgXhg.js → CfTBjUgE.js} +1 -1
- package/.output/public/_nuxt/{6k0gxaWW.js → CfiM4f33.js} +1 -1
- package/.output/public/_nuxt/{3hFj0Mf_.js → Cj2M_iYP.js} +1 -1
- package/.output/public/_nuxt/{BigIAhcT.js → CjPpmwck.js} +1 -1
- package/.output/public/_nuxt/{n5X4vNX9.js → CjhuD2Kg.js} +2 -2
- package/.output/public/_nuxt/{UQIfAAmf.js → CnLzT6v5.js} +1 -1
- package/.output/public/_nuxt/{DwEfItxe.js → CnViW7-O.js} +1 -1
- package/.output/public/_nuxt/{NNQizITf.js → Ctt1B8Lg.js} +1 -1
- package/.output/public/_nuxt/{m9zGH_2s.js → CuzrMna6.js} +1 -1
- package/.output/public/_nuxt/{B02JOKtW.js → Cv0TenvS.js} +1 -1
- package/.output/public/_nuxt/{BhtKu4xV.js → CzSXUP4q.js} +1 -1
- package/.output/public/_nuxt/{Dfi2mj_-.js → CzYLEcMN.js} +1 -1
- package/.output/public/_nuxt/{Cj3gDP-y.js → D-ysM-Cd.js} +1 -1
- package/.output/public/_nuxt/{CD_jDSWh.js → D2A5WweU.js} +1 -1
- package/.output/public/_nuxt/{Ehiy7Wkv.js → D5dMt776.js} +1 -1
- package/.output/public/_nuxt/{lA6pb86B.js → D5ut0FcJ.js} +1 -1
- package/.output/public/_nuxt/{CPb6IrVT.js → D7PJ9LEZ.js} +1 -1
- package/.output/public/_nuxt/{DmHn_Ae8.js → DA0qOQ-H.js} +1 -1
- package/.output/public/_nuxt/{BW0bq0Nu.js → DCKH9QC5.js} +1 -1
- package/.output/public/_nuxt/{DMCE1Up6.js → DCj0VKbE.js} +1 -1
- package/.output/public/_nuxt/{pFPRVtL-.js → DD864DXc.js} +1 -1
- package/.output/public/_nuxt/{CjVBL0o-.js → DEZB2UVM.js} +1 -1
- package/.output/public/_nuxt/{B27NM422.js → DGMjiZpH.js} +1 -1
- package/.output/public/_nuxt/{BMTKvzsm.js → DH9moCuc.js} +1 -1
- package/.output/public/_nuxt/{DuH9QzIG.js → DHmoYAOF.js} +1 -1
- package/.output/public/_nuxt/{QmdcFt0E.js → DKFnR3f3.js} +1 -1
- package/.output/public/_nuxt/{81-iumfM.js → DM2gKi5N.js} +1 -1
- package/.output/public/_nuxt/{d85YwuyC.js → DMar0qcv.js} +1 -1
- package/.output/public/_nuxt/{7msxmF5v.js → DNNOQPuJ.js} +1 -1
- package/.output/public/_nuxt/{CbLvLXmb.js → DSNEk90K.js} +1 -1
- package/.output/public/_nuxt/{B38X0n2w.js → DTb_yOmO.js} +1 -1
- package/.output/public/_nuxt/{QNqSZCYh.js → DWJ2tQkX.js} +1 -1
- package/.output/public/_nuxt/{uCsI7fpg.js → DbARsMbj.js} +1 -1
- package/.output/public/_nuxt/{Irw5CrIe.js → DbpzXcer.js} +1 -1
- package/.output/public/_nuxt/{6DKJrPTD.js → DcC8s2L0.js} +1 -1
- package/.output/public/_nuxt/{CxNJcty6.js → DcU1vVta.js} +1 -1
- package/.output/public/_nuxt/{BTs0cu3F.js → De4iE8YV.js} +1 -1
- package/.output/public/_nuxt/{B3TXSB_R.js → De94RhMH.js} +1 -1
- package/.output/public/_nuxt/{B8na0pik.js → DfIQdSBL.js} +1 -1
- package/.output/public/_nuxt/{pJF5jz72.js → DfLpZE5I.js} +1 -1
- package/.output/public/_nuxt/{DOs_ozN6.js → DhGDBmGP.js} +1 -1
- package/.output/public/_nuxt/{mLs_Q7_U.js → Dhf7T8TT.js} +1 -1
- package/.output/public/_nuxt/{CVTUqEcr.js → DjY2CmhB.js} +1 -1
- package/.output/public/_nuxt/{DfP6jcEM.js → Dj__3Bye.js} +1 -1
- package/.output/public/_nuxt/{iVfmia7K.js → DlOqPmYc.js} +1 -1
- package/.output/public/_nuxt/{Dbv2gAYq.js → Dm4dqn9Q.js} +1 -1
- package/.output/public/_nuxt/{BW-7wimi.js → Dn0NJtvh.js} +1 -1
- package/.output/public/_nuxt/{CDKJK4wW.js → DuDOxoNd.js} +1 -1
- package/.output/public/_nuxt/{CcJ0pNID.js → DwIL_HsX.js} +1 -1
- package/.output/public/_nuxt/DwbYPACo.js +1 -0
- package/.output/public/_nuxt/{Cfce_cVw.js → Dzjd35Uu.js} +1 -1
- package/.output/public/_nuxt/{BGa5KqPj.js → FOQllft2.js} +1 -1
- package/.output/public/_nuxt/{DoGLYOlq.js → FZ4DGVUC.js} +1 -1
- package/.output/public/_nuxt/{ByXbV9Xa.js → IwZpKn7a.js} +1 -1
- package/.output/public/_nuxt/{By5L5Smf.js → J00SROjJ.js} +1 -1
- package/.output/public/_nuxt/{1_nO5SO6.js → KEgU3jLl.js} +1 -1
- package/.output/public/_nuxt/{eB60bVen.js → KtLDewau.js} +1 -1
- package/.output/public/_nuxt/{IIvTjJqa.js → LFbgE4QY.js} +1 -1
- package/.output/public/_nuxt/{BtVAOj3K.js → MwLHW_S3.js} +1 -1
- package/.output/public/_nuxt/{Bn175bDC.js → SbeB_1mT.js} +1 -1
- package/.output/public/_nuxt/{Bk_mzzQ3.js → T9m6PG7Q.js} +1 -1
- package/.output/public/_nuxt/{DLfV22bF.js → UPUPLBes.js} +1 -1
- package/.output/public/_nuxt/{BaHB7JKe.js → UmRz2svG.js} +1 -1
- package/.output/public/_nuxt/{DB0uzc_1.js → UvHHDzTl.js} +1 -1
- package/.output/public/_nuxt/{C-tfM08H.js → YJeqx4Ll.js} +1 -1
- package/.output/public/_nuxt/{CSyssKl8.js → _fMejg0f.js} +1 -1
- package/.output/public/_nuxt/{DOTIy97K.js → aIIZqPga.js} +1 -1
- package/.output/public/_nuxt/{DXAD_aZW.js → awkGRsuS.js} +1 -1
- package/.output/public/_nuxt/builds/latest.json +1 -1
- package/.output/public/_nuxt/builds/meta/61420747-850d-4496-817a-d86f57e0fb7d.json +1 -0
- package/.output/public/_nuxt/{AMPsjNHJ.js → dGa7RyJ8.js} +1 -1
- package/.output/public/_nuxt/{gTGPvkTX.js → eTB2hbQs.js} +1 -1
- package/.output/public/_nuxt/{n_Arasow.js → iGKcFJAp.js} +1 -1
- package/.output/public/_nuxt/{D45gWhSU.js → k5H4Okf8.js} +1 -1
- package/.output/public/_nuxt/{DN5cHXGS.js → kbSxj5Sa.js} +1 -1
- package/.output/public/_nuxt/{CBJQYyqD.js → l0zNTVMN.js} +1 -1
- package/.output/public/_nuxt/{C_hl3kCw.js → lheR7PB2.js} +1 -1
- package/.output/public/_nuxt/{BVcLiEDk.js → p1xXbtMk.js} +1 -1
- package/.output/public/_nuxt/{B5oEzB-M.js → qBDqAV_3.js} +1 -1
- package/.output/public/_nuxt/{CJLlvuDm.js → qEwYRBS3.js} +1 -1
- package/.output/public/_nuxt/{RIAd5Wd1.js → tHI-osWJ.js} +1 -1
- package/.output/public/_nuxt/{DoSrePUc.js → tIRQIyWk.js} +1 -1
- package/.output/public/_nuxt/{D5IKvGig.js → uP6kBJyw.js} +1 -1
- package/.output/public/_nuxt/{By6urPVf.js → yyeTZy_R.js} +1 -1
- package/.output/server/chunks/build/client.precomputed.mjs +1 -1
- package/.output/server/chunks/build/styles.mjs +2 -2
- package/.output/server/chunks/nitro/nitro.mjs +900 -891
- package/.output/server/chunks/routes/{terminal.mjs → _ws/terminal.mjs} +39 -28
- package/.output/server/chunks/routes/_ws/terminal.mjs.map +1 -0
- package/.output/server/chunks/routes/notifications.mjs +1 -1
- package/.output/server/package.json +1 -1
- package/app/composables/useTerminal.ts +1 -1
- package/package.json +1 -1
- package/server/routes/_ws/terminal.ts +111 -0
- package/server/utils/pty-manager.ts +12 -3
- package/.output/public/_nuxt/CNB4wNeh.js +0 -1
- package/.output/public/_nuxt/CnB-ybCZ.js +0 -1
- package/.output/public/_nuxt/DAjV9Cip.js +0 -1
- package/.output/public/_nuxt/Suor9Vto.js +0 -1
- package/.output/public/_nuxt/builds/meta/d37c41da-8cec-4479-a3ac-3097aa4fb2e0.json +0 -1
- package/.output/server/chunks/routes/terminal.mjs.map +0 -1
- package/server/routes/terminal.ts +0 -98
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{d as Le,c as z,o as B,w as A,r as j,m as Y,a as v,P as st,aQ as qn,aS as aa,e as X,u as ct,a4 as gi,aR as la,a3 as Kn,h as Z,F as br,c4 as ha,Z as P,T as Kt,bm as Un,bF as ca,aA as ui,c5 as ua,bg as yr,a8 as zr,bV as Vn,bB as Wi,aa as W,C as es,M as U,al as Ce,aF as da,a6 as fa,f as ke,B as Ut,O as jn,aK as _a,aq as Yt,X as qi,Y as pa,aD as et,aZ as kt,U as ts,W as Nt,ap as Oe,a0 as xt,a_ as Yn,b9 as is,ac as te,$ as F,am as Ue,ba as Ki,aG as bt,aH as yt,aB as It,aC as ga,aE as va,b8 as ma,az as wr,_ as me,a1 as Pe,ab as tt,af as Be,aY as Ci,ao as Sa,aw as Ai,bb as Ti,bc as Wt,aU as Ui,aV as di,ah as Gn,S as ba,j as ot,c6 as ya,aO as Xn,bW as wa,b0 as Ca,V as ka,c7 as xa,bh as Ea,aj as Ba,ak as vi,a5 as Jn,bJ as us,c8 as ds,c9 as La,ad as Da,n as Ma}from"./CGgHmnnS.js";import{c as Vt,g as Ra,h as Aa}from"./pFPRVtL-.js";import{u as Zn,a as Ta,b as Ia,_ as Pa,p as Oa}from"./CZ5B974o.js";import{_ as Cr,u as Na}from"./ByXbV9Xa.js";import{_ as Qn}from"./D_1GDAlv.js";import{a as eo,_ as za}from"./B8na0pik.js";import{b as Fr,A as Fa,c as Ha,d as Hr}from"./pJF5jz72.js";import{u as $a}from"./Cj3gDP-y.js";import{u as to}from"./Suor9Vto.js";import{u as io}from"./C6Y-ieo6.js";import{_ as Wa}from"./NNQizITf.js";import{H as qa,P as Ka}from"./C4Ii8cYC.js";import{_ as Ua}from"./BGa5KqPj.js";import{_ as Va}from"./B8fLdQfp.js";import{_ as ja}from"./Dc_VwXJs.js";import{_ as kr}from"./CCmSsj4q.js";import{_ as Ya}from"./C_hl3kCw.js";import{i as Ga,L as Xa,a as Ja,b as Za,c as Qa,d as el,e as tl,f as il,_ as sl}from"./CJLlvuDm.js";import{g as rl}from"./By5L5Smf.js";import{_ as nl}from"./Ehiy7Wkv.js";import{a as ol}from"./B6lDOV4_.js";import{_ as al}from"./eB60bVen.js";import{u as so,b as ll,_ as hl,a as cl}from"./BHcVB9Fo.js";import{u as ss}from"./CIMG8oEU.js";import{s as ul}from"./CnB-ybCZ.js";import{u as dl}from"./B5oEzB-M.js";import{u as fl}from"./CcJ0pNID.js";import"./CD6r4z4e.js";import"./DIMnGgEU.js";import"./RIAd5Wd1.js";import"./3AgfIirx.js";import"./CZQeFnOf.js";import"./B02JOKtW.js";import"./DEmzTuCa.js";import"./6k0gxaWW.js";import"./d85YwuyC.js";import"./D57E8FC4.js";import"./rVZcJ6Pz.js";import"./B1ea1Zc2.js";import"./CNB4wNeh.js";import"./P3qGksT8.js";import"./iVfmia7K.js";import"./Bk_mzzQ3.js";import"./Cwdn7ZtG.js";import"./n5X4vNX9.js";import"./88opOQSr.js";import"./iik6CYzq.js";import"./AMPsjNHJ.js";import"./1_nO5SO6.js";import"./Vcq4gwWv.js";var _l=Le({__name:"ListboxGroupLabel",props:{for:{type:String,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:"div"}},setup(e){const t=e,i=Ga({id:""});return(s,r)=>(B(),z(v(st),Y(t,{id:v(i).id}),{default:A(()=>[j(s.$slots,"default")]),_:3},16,["id"]))}}),pl=_l;const[zt,gl]=qn(["NavigationMenuRoot","NavigationMenuSub"],"NavigationMenuContext");var vl=Le({__name:"NavigationMenuRoot",props:{modelValue:{type:String,required:!1,default:void 0},defaultValue:{type:String,required:!1},dir:{type:String,required:!1},orientation:{type:String,required:!1,default:"horizontal"},delayDuration:{type:Number,required:!1,default:200},skipDelayDuration:{type:Number,required:!1,default:300},disableClickTrigger:{type:Boolean,required:!1,default:!1},disableHoverTrigger:{type:Boolean,required:!1,default:!1},disablePointerLeaveClose:{type:Boolean,required:!1},unmountOnHide:{type:Boolean,required:!1,default:!0},asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:"nav"}},emits:["update:modelValue"],setup(e,{emit:t}){const i=e,r=aa(i,"modelValue",t,{defaultValue:i.defaultValue??"",passive:i.modelValue===void 0}),n=X(""),{forwardRef:o,currentElement:a}=ct(),h=X(),l=X(),f=X(),{getItems:d,CollectionSlot:u}=gi({key:"NavigationMenu",isProvider:!0}),{delayDuration:c,skipDelayDuration:p,dir:_,disableClickTrigger:S,disableHoverTrigger:w,unmountOnHide:y}=la(i),k=$a(_),g=Kn(!1,p),C=Z(()=>r.value!==""||g.value?150:c.value),L=ha(x=>{typeof x=="string"&&(n.value=r.value,r.value=x)},C);return br(()=>{if(!r.value)return;const x=d().map($=>$.ref);f.value=x.find($=>$.id.includes(r.value))}),gl({isRootMenu:!0,modelValue:r,previousValue:n,baseId:to(void 0,"reka-navigation-menu"),disableClickTrigger:S,disableHoverTrigger:w,dir:k,unmountOnHide:y,orientation:i.orientation,rootNavigationMenu:a,indicatorTrack:h,activeTrigger:f,onIndicatorTrackChange:x=>{h.value=x},viewport:l,onViewportChange:x=>{l.value=x},onTriggerEnter:x=>{L(x)},onTriggerLeave:()=>{g.value=!0,L("")},onContentEnter:()=>{L()},onContentLeave:()=>{i.disablePointerLeaveClose||L("")},onItemSelect:x=>{n.value=r.value,r.value=x},onItemDismiss:()=>{n.value=r.value,r.value=""}}),(x,$)=>(B(),z(v(u),null,{default:A(()=>[P(v(st),{ref:v(o),"aria-label":"Main",as:x.as,"as-child":x.asChild,"data-orientation":x.orientation,dir:v(k),"data-reka-navigation-menu":""},{default:A(()=>[j(x.$slots,"default",{modelValue:v(r)})]),_:3},8,["as","as-child","data-orientation","dir"])]),_:3}))}}),ml=vl;function rs(e){return e?"open":"closed"}function ro(e,t){return`${e}-trigger-${t}`}function xr(e,t){return`${e}-content-${t}`}const Sl="navigationMenu.linkSelect",Ii="navigationMenu.rootContentDismiss";function Ds(e){const t=[],i=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:s=>{const r=s.tagName==="INPUT"&&s.type==="hidden";return s.disabled||s.hidden||r?NodeFilter.FILTER_SKIP:s.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;i.nextNode();)t.push(i.currentNode);return t}function no(e){const t=Kt();return e.some(i=>i===t?!0:(i.focus(),Kt()!==t))}function bl(e){return e.forEach(t=>{t.dataset.tabindex=t.getAttribute("tabindex")||"",t.setAttribute("tabindex","-1")}),()=>{e.forEach(t=>{const i=t.dataset.tabindex;t.setAttribute("tabindex",i)})}}function oo(e){return t=>t.pointerType==="mouse"?e(t):void 0}const[Er,yl]=qn("NavigationMenuItem");var wl=Le({__name:"NavigationMenuItem",props:{value:{type:String,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:"li"}},setup(e){const t=e;ct();const{getItems:i}=gi({key:"NavigationMenu"}),s=zt(),r=to(t.value),n=X(),o=X(),a=xr(s.baseId,r);let h=()=>({});const l=X(!1);async function f(p="start"){const _=document.getElementById(a);if(_){h();const S=Ds(_);S.length&&no(p==="start"?S:S.reverse())}}function d(){const p=document.getElementById(a);if(p){const _=Ds(p);_.length&&(h=bl(_))}}yl({value:r,contentId:a,triggerRef:n,focusProxyRef:o,wasEscapeCloseRef:l,onEntryKeyDown:f,onFocusProxyEnter:f,onContentFocusOutside:d,onRootContentClose:d});function u(){s.onItemDismiss(),n.value?.focus()}function c(p){const _=Kt();if(p.keyCode===32||p.key==="Enter")if(s.modelValue.value===r){u(),p.preventDefault();return}else{p.target.click(),p.preventDefault();return}const S=i().filter(y=>y.ref.parentElement?.hasAttribute("data-menu-item")).map(y=>y.ref);if(!S.includes(_))return;const w=io(p,_,void 0,{itemsArray:S,loop:!1});w&&w?.focus(),p.preventDefault(),p.stopPropagation()}return(p,_)=>(B(),z(v(st),{"as-child":p.asChild,as:p.as,"data-menu-item":"",onKeydown:Un(c,["up","down","left","right","home","end","space"])},{default:A(()=>[j(p.$slots,"default")]),_:3},8,["as-child","as"]))}}),Cl=wl,kl=Le({__name:"NavigationMenuContentImpl",props:{disableOutsidePointerEvents:{type:Boolean,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},emits:["escapeKeyDown","pointerDownOutside","focusOutside","interactOutside"],setup(e,{emit:t}){const i=e,s=t,{getItems:r}=gi({key:"NavigationMenu"}),{forwardRef:n,currentElement:o}=ct(),a=zt(),h=Er(),l=ro(a.baseId,h.value),f=xr(a.baseId,h.value),d=X(null),u=Z(()=>{const y=r().map($=>$.ref.id.split("trigger-")[1]);a.dir.value==="rtl"&&y.reverse();const k=y.indexOf(a.modelValue.value),g=y.indexOf(a.previousValue.value),C=h.value===a.modelValue.value,L=g===y.indexOf(h.value);if(!C&&!L)return d.value;const x=(()=>{if(k!==g){if(C&&g!==-1)return k>g?"from-end":"from-start";if(L&&k!==-1)return k>g?"to-start":"to-end"}return null})();return d.value=x,x});function c(y){if(s("focusOutside",y),s("interactOutside",y),y.detail.originalEvent.target.hasAttribute("data-navigation-menu-trigger")&&y.preventDefault(),!y.defaultPrevented){h.onContentFocusOutside();const g=y.target;a.rootNavigationMenu?.value?.contains(g)&&y.preventDefault()}}function p(y){if(s("pointerDownOutside",y),!y.defaultPrevented){const k=y.target,g=r().some(L=>L.ref.contains(k)),C=a.isRootMenu&&a.viewport.value?.contains(k);(g||C||!a.isRootMenu)&&y.preventDefault()}}br(y=>{const k=o.value;if(a.isRootMenu&&k){const g=()=>{a.onItemDismiss(),h.onRootContentClose(),k.contains(Kt())&&h.triggerRef.value?.focus()};k.addEventListener(Ii,g),y(()=>k.removeEventListener(Ii,g))}});function _(y){s("escapeKeyDown",y),y.defaultPrevented||(a.onItemDismiss(),h.triggerRef?.value?.focus(),h.wasEscapeCloseRef.value=!0)}function S(y){if(y.target.closest("[data-reka-navigation-menu]")!==a.rootNavigationMenu.value)return;const k=y.altKey||y.ctrlKey||y.metaKey,g=y.key==="Tab"&&!k,C=Ds(y.currentTarget);if(g){const x=Kt(),$=C.findIndex(V=>V===x),G=y.shiftKey?C.slice(0,$).reverse():C.slice($+1,C.length);if(no(G))y.preventDefault();else{h.focusProxyRef.value?.focus();return}}io(y,Kt(),void 0,{itemsArray:C,loop:!1,enableIgnoredElement:!0})?.focus()}function w(){const y=new Event(Ii,{bubbles:!0,cancelable:!0});o.value?.dispatchEvent(y)}return(y,k)=>(B(),z(v(ca),Y({id:v(f),ref:v(n),"aria-labelledby":v(l),"data-motion":u.value,"data-state":v(rs)(v(a).modelValue.value===v(h).value),"data-orientation":v(a).orientation},i,{onKeydown:S,onEscapeKeyDown:_,onPointerDownOutside:p,onFocusOutside:c,onDismiss:w}),{default:A(()=>[j(y.$slots,"default")]),_:3},16,["id","aria-labelledby","data-motion","data-state","data-orientation"]))}}),xl=kl,El=Le({inheritAttrs:!1,__name:"NavigationMenuContent",props:{forceMount:{type:Boolean,required:!1},disableOutsidePointerEvents:{type:Boolean,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},emits:["escapeKeyDown","pointerDownOutside","focusOutside","interactOutside"],setup(e,{emit:t}){const i=e,s=t,r=ui(ua(i,"forceMount"),s),{forwardRef:n}=ct(),o=zt(),a=Er(),h=Z(()=>a.value===o.modelValue.value),l=Z(()=>o.viewport.value&&!o.modelValue.value&&o.previousValue.value?o.previousValue.value===a.value:!1);return(f,d)=>(B(),z(Vn,{to:v(zr)&&v(o).viewport.value?v(o).viewport.value:"body",disabled:v(zr)&&v(o).viewport.value?!v(o).viewport.value:!0},[P(v(yr),{present:f.forceMount||h.value||l.value,"force-mount":!v(o).unmountOnHide.value},{default:A(({present:u})=>[P(xl,Y({ref:v(n),"data-state":v(rs)(h.value),style:{pointerEvents:!h.value&&v(o).isRootMenu?"none":void 0}},{...f.$attrs,...v(r)},{hidden:!u,onPointerenter:d[0]||(d[0]=c=>v(o).onContentEnter(v(a).value)),onPointerleave:d[1]||(d[1]=c=>v(oo)(()=>v(o).onContentLeave())(c)),onPointerDownOutside:d[2]||(d[2]=c=>s("pointerDownOutside",c)),onFocusOutside:d[3]||(d[3]=c=>s("focusOutside",c)),onInteractOutside:d[4]||(d[4]=c=>s("interactOutside",c))}),{default:A(()=>[j(f.$slots,"default")]),_:2},1040,["data-state","style","hidden"])]),_:3},8,["present","force-mount"])],8,["to","disabled"]))}}),Bl=El,Ll=Le({inheritAttrs:!1,__name:"NavigationMenuIndicator",props:{forceMount:{type:Boolean,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},setup(e){const t=e,{forwardRef:i}=ct(),s=zt(),r=X(),n=Z(()=>s.orientation==="horizontal"),o=Z(()=>!!s.modelValue.value),{activeTrigger:a}=s;function h(){a.value&&(r.value={size:n.value?a.value.offsetWidth:a.value.offsetHeight,position:n.value?a.value.offsetLeft:a.value.offsetTop})}return br(()=>{s.modelValue.value&&h()}),Wi(a,h),Wi(s.indicatorTrack,h),(l,f)=>v(s).indicatorTrack.value?(B(),z(Vn,{key:0,to:v(s).indicatorTrack.value},[P(v(yr),{present:l.forceMount||o.value},{default:A(()=>[P(v(st),Y({ref:v(i),"aria-hidden":"true","data-state":o.value?"visible":"hidden","data-orientation":v(s).orientation,"as-child":t.asChild,as:l.as,style:{...r.value?{"--reka-navigation-menu-indicator-size":`${r.value.size}px`,"--reka-navigation-menu-indicator-position":`${r.value.position}px`}:{}}},l.$attrs),{default:A(()=>[j(l.$slots,"default")]),_:3},16,["data-state","data-orientation","as-child","as","style"])]),_:3},8,["present"])],8,["to"])):W("v-if",!0)}}),Dl=Ll,Ml=Le({__name:"NavigationMenuLink",props:{active:{type:Boolean,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:"a"}},emits:["select"],setup(e,{emit:t}){const i=e,s=t,{CollectionItem:r}=gi({key:"NavigationMenu"});ct();async function n(o){const a=new CustomEvent(Sl,{bubbles:!0,cancelable:!0,detail:{originalEvent:o}});if(s("select",a),!a.defaultPrevented&&!o.metaKey){const h=new CustomEvent(Ii,{bubbles:!0,cancelable:!0});o.target?.dispatchEvent(h)}}return(o,a)=>(B(),z(v(r),null,{default:A(()=>[P(v(st),{as:o.as,"data-active":o.active?"":void 0,"aria-current":o.active?"page":void 0,"as-child":i.asChild,onClick:n},{default:A(()=>[j(o.$slots,"default")]),_:3},8,["as","data-active","aria-current","as-child"])]),_:3}))}}),fs=Ml,Rl=Le({inheritAttrs:!1,__name:"NavigationMenuList",props:{asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:"ul"}},setup(e){const t=e,i=zt(),{forwardRef:s,currentElement:r}=ct();return es(()=>{i.onIndicatorTrackChange(r.value)}),(n,o)=>(B(),z(v(st),{ref:v(s),style:{position:"relative"}},{default:A(()=>[P(v(st),Y(n.$attrs,{"as-child":t.asChild,as:n.as,"data-orientation":v(i).orientation}),{default:A(()=>[j(n.$slots,"default")]),_:3},16,["as-child","as","data-orientation"])]),_:3},512))}}),Al=Rl;const Tl=["aria-owns"];var Il=Le({inheritAttrs:!1,__name:"NavigationMenuTrigger",props:{disabled:{type:Boolean,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:"button"}},setup(e){const t=e,i=zt(),s=Er(),{CollectionItem:r}=gi({key:"NavigationMenu"}),{forwardRef:n,currentElement:o}=ct(),a=X(""),h=X(""),l=Kn(!1,300),f=X(!1),d=Z(()=>s.value===i.modelValue.value);es(()=>{s.triggerRef=o,a.value=ro(i.baseId,s.value),h.value=xr(i.baseId,s.value)});function u(){i.disableHoverTrigger.value||(f.value=!1,s.wasEscapeCloseRef.value=!1)}function c(k){if(!i.disableHoverTrigger.value&&k.pointerType==="mouse"){if(t.disabled||f.value||s.wasEscapeCloseRef.value||l.value)return;i.onTriggerEnter(s.value),l.value=!0}}function p(k){if(!i.disableHoverTrigger.value&&k.pointerType==="mouse"){if(t.disabled)return;i.onTriggerLeave(),l.value=!1}}function _(k){(!("pointerType"in k)||k.pointerType==="mouse")&&i.disableClickTrigger.value||l.value||(d.value?i.onItemSelect(""):i.onItemSelect(s.value),f.value=d.value)}function S(k){const C={horizontal:"ArrowDown",vertical:i.dir.value==="rtl"?"ArrowLeft":"ArrowRight"}[i.orientation];d.value&&k.key===C&&(s.onEntryKeyDown(),k.preventDefault(),k.stopPropagation())}function w(k){s.focusProxyRef.value=fa(k)}function y(k){const g=document.getElementById(s.contentId),C=k.relatedTarget,L=C===o.value,x=g?.contains(C);(L||!x)&&s.onFocusProxyEnter(L?"start":"end")}return(k,g)=>(B(),U(Ce,null,[P(v(r),null,{default:A(()=>[P(v(st),Y({id:a.value,ref:v(n),disabled:k.disabled,"data-disabled":k.disabled?"":void 0,"data-state":v(rs)(d.value),"data-navigation-menu-trigger":"","aria-expanded":d.value,"aria-controls":h.value,"as-child":t.asChild,as:k.as},k.$attrs,{onPointerenter:u,onPointermove:c,onPointerleave:p,onClick:_,onKeydown:S}),{default:A(()=>[j(k.$slots,"default")]),_:3},16,["id","disabled","data-disabled","data-state","aria-expanded","aria-controls","as-child","as"])]),_:3}),d.value?(B(),U(Ce,{key:0},[P(v(da),{ref:w,"aria-hidden":"true",tabindex:0,onFocus:y}),v(i).viewport?(B(),U("span",{key:0,"aria-owns":h.value},null,8,Tl)):W("v-if",!0)],64)):W("v-if",!0)],64))}}),Pl=Il,Ol=Le({inheritAttrs:!1,__name:"NavigationMenuViewport",props:{forceMount:{type:Boolean,required:!1},align:{type:String,required:!1,default:"center"},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},setup(e){const t=e,{forwardRef:i,currentElement:s}=ct(),r=zt(),{activeTrigger:n,rootNavigationMenu:o,modelValue:a}=r,h=X(),l=X(),f=Z(()=>!!r.modelValue.value);ke(s,()=>{r.onViewportChange(s.value)});const d=X();ke([a,f],()=>{Ut(()=>{s.value&&requestAnimationFrame(()=>{const c=s.value?.querySelector("[data-state=open]");d.value=c})})},{immediate:!0});function u(){if(d.value&&n.value&&o.value){const c=document.documentElement.offsetWidth,p=document.documentElement.offsetHeight,_=o.value.getBoundingClientRect(),S=n.value.getBoundingClientRect(),{offsetWidth:w,offsetHeight:y}=d.value,k=S.left-_.left,g=S.top-_.top;let C=null,L=null;switch(t.align){case"start":C=k,L=g;break;case"end":C=k-w+S.width,L=g-y+S.height;break;default:C=k-w/2+S.width/2,L=g-y/2+S.height/2}const x=10;C+_.left<x&&(C=x-_.left);const $=C+_.left+w;$>c-x&&(C-=$-c+x,C<x-_.left&&(C=x-_.left)),L+_.top<x&&(L=x-_.top);const H=L+_.top+y;H>p-x&&(L-=H-p+x,L<x-_.top&&(L=x-_.top)),C=Math.round(C),L=Math.round(L),l.value={left:C,top:L}}}return Wi(d,()=>{d.value&&(h.value={width:d.value.offsetWidth,height:d.value.offsetHeight},u())}),Wi([globalThis.document?.body,o],()=>{u()}),(c,p)=>(B(),z(v(yr),{present:c.forceMount||f.value,"force-mount":!v(r).unmountOnHide.value,onAfterLeave:p[2]||(p[2]=()=>{h.value=void 0,l.value=void 0})},{default:A(({present:_})=>[P(v(st),Y(c.$attrs,{ref:v(i),as:c.as,"as-child":c.asChild,"data-state":v(rs)(f.value),"data-orientation":v(r).orientation,style:{pointerEvents:!f.value&&v(r).isRootMenu?"none":void 0,"--reka-navigation-menu-viewport-width":h.value?`${h.value?.width}px`:void 0,"--reka-navigation-menu-viewport-height":h.value?`${h.value?.height}px`:void 0,"--reka-navigation-menu-viewport-left":l.value?`${l.value?.left}px`:void 0,"--reka-navigation-menu-viewport-top":l.value?`${l.value?.top}px`:void 0},hidden:!_,onPointerenter:p[0]||(p[0]=S=>v(r).onContentEnter(v(r).modelValue.value)),onPointerleave:p[1]||(p[1]=S=>v(oo)(()=>v(r).onContentLeave())(S))}),{default:A(()=>[j(c.$slots,"default")]),_:2},1040,["as","as-child","data-state","data-orientation","style","hidden"])]),_:3},8,["present","force-mount"]))}}),Nl=Ol;function Ms(e,t){const s=jn().hook(e,t);_a(s)}const zl={slots:{base:"",label:"",trailing:"hidden lg:flex items-center gap-0.5 ms-auto"},variants:{collapsed:{true:{label:"hidden",trailing:"lg:hidden"}}}},Fl=Object.assign({inheritAttrs:!1},{__name:"UDashboardSearchButton",props:{icon:{type:null,required:!1},label:{type:String,required:!1},color:{type:null,required:!1,default:"neutral"},variant:{type:null,required:!1},collapsed:{type:Boolean,required:!1,default:!1},tooltip:{type:[Boolean,Object],required:!1,default:!1},kbds:{type:Array,required:!1,default:()=>["meta","k"]},ui:{type:void 0,required:!1},class:{type:null,required:!1},activeColor:{type:null,required:!1},activeVariant:{type:null,required:!1},size:{type:null,required:!1},square:{type:Boolean,required:!1},block:{type:Boolean,required:!1},loadingAuto:{type:Boolean,required:!1},onClick:{type:[Function,Array],required:!1},avatar:{type:Object,required:!1},leading:{type:Boolean,required:!1},leadingIcon:{type:null,required:!1},trailing:{type:Boolean,required:!1},trailingIcon:{type:null,required:!1},loading:{type:Boolean,required:!1},loadingIcon:{type:null,required:!1},as:{type:null,required:!1},type:{type:null,required:!1},disabled:{type:Boolean,required:!1},exactActiveClass:{type:String,required:!1},viewTransition:{type:Boolean,required:!1}},setup(e){const t=e,i=Yt(),[s,r]=Vt(),n=()=>Ki(i,["trailing"]),o=qi(pa(t,"icon","label","variant","collapsed","tooltip","kbds","class","ui")),a=et(()=>kt(typeof t.tooltip=="boolean"?{}:t.tooltip,{delayDuration:0,content:{side:"right"}})),{t:h}=ts(),l=Nt(),{toggleSearch:f}=Zn({toggleSearch:()=>{}}),d=Z(()=>Oe({extend:Oe(zl),...l.ui?.dashboardSearchButton||{}})({collapsed:t.collapsed}));return(u,c)=>(B(),U(Ce,null,[P(v(s),null,{default:A(()=>[P(xt,Y({icon:e.icon||v(l).ui.icons.search,label:e.label||v(h)("dashboardSearchButton.label"),variant:e.variant||(e.collapsed?"ghost":"outline")},{...v(o),...e.collapsed?{square:!0,"aria-label":e.label||v(h)("dashboardSearchButton.label")}:{},...u.$attrs},{class:d.value.base({class:[t.ui?.base,t.class]}),ui:v(Yn)(d.value,t.ui),onClick:v(f)}),is({trailing:A(({ui:p})=>[te("div",{"data-slot":"trailing",class:F(d.value.trailing({class:t.ui?.trailing}))},[j(u.$slots,"trailing",{ui:p},()=>[e.kbds?.length?(B(!0),U(Ce,{key:0},Ue(e.kbds,(_,S)=>(B(),z(Cr,Y({key:S,variant:"subtle"},{ref_for:!0},typeof _=="string"?{value:_}:_),null,16))),128)):W("",!0)])],2)]),_:2},[Ue(n(),(p,_)=>({name:_,fn:A(S=>[j(u.$slots,_,bt(yt(S)))])}))]),1040,["icon","label","variant","class","ui","onClick"])]),_:3}),e.collapsed&&e.tooltip?(B(),z(Qn,Y({key:0,text:e.label||v(h)("dashboardSearchButton.label")},a.value),{default:A(()=>[P(v(r))]),_:1},16,["text"])):(B(),z(v(r),{key:1}))],64))}}),Hl={slots:{content:"bg-default shadow-lg rounded-md ring ring-default data-[state=open]:animate-[scale-in_100ms_ease-out] data-[state=closed]:animate-[scale-out_100ms_ease-in] origin-(--reka-popover-content-transform-origin) focus:outline-none pointer-events-auto",arrow:"fill-default"}},$l={__name:"UPopover",props:{mode:{type:null,required:!1,default:"click"},content:{type:Object,required:!1},arrow:{type:[Boolean,Object],required:!1},portal:{type:[Boolean,String],required:!1,skipCheck:!0,default:!0},reference:{type:null,required:!1},dismissible:{type:Boolean,required:!1,default:!0},class:{type:null,required:!1},ui:{type:null,required:!1},defaultOpen:{type:Boolean,required:!1},open:{type:Boolean,required:!1},modal:{type:Boolean,required:!1},openDelay:{type:Number,required:!1,default:0},closeDelay:{type:Number,required:!1,default:0}},emits:["close:prevent","update:open"],setup(e,{emit:t}){const i=e,s=t,r=Yt(),n=Nt(),o=i.mode==="hover"?It(i,"defaultOpen","open","openDelay","closeDelay"):It(i,"defaultOpen","open","modal"),a=ui(o,s),h=ga(et(()=>i.portal)),l=et(()=>kt(i.content,{side:"bottom",sideOffset:8,collisionPadding:8})),f=Z(()=>i.dismissible?{}:["pointerDownOutside","interactOutside","escapeKeyDown"].reduce((_,S)=>(_[S]=w=>{w.preventDefault(),s("close:prevent")},_),{})),d=et(()=>i.arrow),u=Z(()=>Oe({extend:Oe(Hl),...n.ui?.popover||{}})({side:l.value.side})),c=Z(()=>i.mode==="hover"?qa:Ka);return(p,_)=>(B(),z(v(c).Root,bt(yt(v(a))),{default:A(({open:S,close:w})=>[r.default||e.reference?(B(),z(v(c).Trigger,{key:0,"as-child":"",reference:e.reference,class:F(i.class)},{default:A(()=>[j(p.$slots,"default",{open:S})]),_:2},1032,["reference","class"])):W("",!0),"Anchor"in c.value&&r.anchor?(B(),z(v(c).Anchor,{key:1,"as-child":""},{default:A(()=>[j(p.$slots,"anchor",bt(yt(w?{close:w}:{})))]),_:2},1024)):W("",!0),P(v(c).Portal,bt(yt(v(h))),{default:A(()=>[P(v(c).Content,Y(l.value,{"data-slot":"content",class:u.value.content({class:[!r.default&&i.class,i.ui?.content]})},va(f.value)),{default:A(()=>[j(p.$slots,"content",bt(yt(w?{close:w}:{}))),e.arrow?(B(),z(v(c).Arrow,Y({key:0},d.value,{"data-slot":"arrow",class:u.value.arrow({class:i.ui?.arrow})}),null,16,["class"])):W("",!0)]),_:2},1040,["class"])]),_:2},1040)]),_:3},16))}},Wl={slots:{root:"relative flex gap-1.5 [&>div]:min-w-0",list:"isolate min-w-0",label:"w-full flex items-center gap-1.5 font-semibold text-xs/5 text-highlighted px-2.5 py-1.5",item:"min-w-0",link:"group relative w-full flex items-center gap-1.5 font-medium text-sm before:absolute before:z-[-1] before:rounded-md focus:outline-none focus-visible:outline-none dark:focus-visible:outline-none focus-visible:before:ring-inset focus-visible:before:ring-2",linkLeadingIcon:"shrink-0 size-5",linkLeadingAvatar:"shrink-0",linkLeadingAvatarSize:"2xs",linkTrailing:"group ms-auto inline-flex gap-1.5 items-center",linkTrailingBadge:"shrink-0",linkTrailingBadgeSize:"sm",linkTrailingIcon:"size-5 transform shrink-0 group-data-[state=open]:rotate-180 transition-transform duration-200",linkLabel:"truncate",linkLabelExternalIcon:"inline-block size-3 align-top text-dimmed",childList:"isolate",childLabel:"text-xs text-highlighted",childItem:"",childLink:"group relative size-full flex items-start text-start text-sm before:absolute before:z-[-1] before:rounded-md focus:outline-none focus-visible:outline-none dark:focus-visible:outline-none focus-visible:before:ring-inset focus-visible:before:ring-2",childLinkWrapper:"min-w-0",childLinkIcon:"size-5 shrink-0",childLinkLabel:"truncate",childLinkLabelExternalIcon:"inline-block size-3 align-top text-dimmed",childLinkDescription:"text-muted",separator:"px-2 h-px bg-border",viewportWrapper:"absolute top-full left-0 flex w-full",viewport:"relative overflow-hidden bg-default shadow-lg rounded-md ring ring-default h-(--reka-navigation-menu-viewport-height) w-full transition-[width,height,left] duration-200 origin-[top_center] data-[state=open]:animate-[scale-in_100ms_ease-out] data-[state=closed]:animate-[scale-out_100ms_ease-in] z-[1]",content:"",indicator:"absolute data-[state=visible]:animate-[fade-in_100ms_ease-out] data-[state=hidden]:animate-[fade-out_100ms_ease-in] data-[state=hidden]:opacity-0 bottom-0 z-[2] w-(--reka-navigation-menu-indicator-size) translate-x-(--reka-navigation-menu-indicator-position) flex h-2.5 items-end justify-center overflow-hidden transition-[translate,width] duration-200",arrow:"relative top-[50%] size-2.5 rotate-45 border border-default bg-default z-[1] rounded-xs"},variants:{color:{primary:{link:"focus-visible:before:ring-primary",childLink:"focus-visible:before:ring-primary"},secondary:{link:"focus-visible:before:ring-secondary",childLink:"focus-visible:before:ring-secondary"},success:{link:"focus-visible:before:ring-success",childLink:"focus-visible:before:ring-success"},info:{link:"focus-visible:before:ring-info",childLink:"focus-visible:before:ring-info"},warning:{link:"focus-visible:before:ring-warning",childLink:"focus-visible:before:ring-warning"},error:{link:"focus-visible:before:ring-error",childLink:"focus-visible:before:ring-error"},neutral:{link:"focus-visible:before:ring-inverted",childLink:"focus-visible:before:ring-inverted"}},highlightColor:{primary:"",secondary:"",success:"",info:"",warning:"",error:"",neutral:""},variant:{pill:"",link:""},orientation:{horizontal:{root:"items-center justify-between",list:"flex items-center",item:"py-2",link:"px-2.5 py-1.5 before:inset-x-px before:inset-y-0",childList:"grid p-2",childLink:"px-3 py-2 gap-2 before:inset-x-px before:inset-y-0",childLinkLabel:"font-medium",content:"absolute top-0 left-0 w-full max-h-[70vh] overflow-y-auto"},vertical:{root:"flex-col",link:"flex-row px-2.5 py-1.5 before:inset-y-px before:inset-x-0",childLabel:"px-1.5 py-0.5",childLink:"p-1.5 gap-1.5 before:inset-y-px before:inset-x-0"}},contentOrientation:{horizontal:{viewportWrapper:"justify-center",content:"data-[motion=from-start]:animate-[enter-from-left_200ms_ease] data-[motion=from-end]:animate-[enter-from-right_200ms_ease] data-[motion=to-start]:animate-[exit-to-left_200ms_ease] data-[motion=to-end]:animate-[exit-to-right_200ms_ease]"},vertical:{viewport:"sm:w-(--reka-navigation-menu-viewport-width) left-(--reka-navigation-menu-viewport-left)"}},active:{true:{childLink:"before:bg-elevated text-highlighted",childLinkIcon:"text-default"},false:{link:"text-muted",linkLeadingIcon:"text-dimmed",childLink:["hover:before:bg-elevated/50 text-default hover:text-highlighted","transition-colors before:transition-colors"],childLinkIcon:["text-dimmed group-hover:text-default","transition-colors"]}},disabled:{true:{link:"cursor-not-allowed opacity-75"}},highlight:{true:""},level:{true:""},collapsed:{true:""}},compoundVariants:[{orientation:"horizontal",contentOrientation:"horizontal",class:{childList:"grid-cols-2 gap-2"}},{orientation:"horizontal",contentOrientation:"vertical",class:{childList:"gap-1",content:"w-60"}},{orientation:"vertical",collapsed:!1,class:{childList:"ms-5 border-s border-default",childItem:"ps-1.5 -ms-px",content:"data-[state=open]:animate-[collapsible-down_200ms_ease-out] data-[state=closed]:animate-[collapsible-up_200ms_ease-out] overflow-hidden"}},{orientation:"vertical",collapsed:!0,class:{link:"px-1.5",linkLabel:"hidden",linkTrailing:"hidden",content:"shadow-sm rounded-sm min-h-6 p-1"}},{orientation:"horizontal",highlight:!0,class:{link:["after:absolute after:-bottom-2 after:inset-x-2.5 after:block after:h-px after:rounded-full","after:transition-colors"]}},{orientation:"vertical",highlight:!0,level:!0,class:{link:["after:absolute after:-start-1.5 after:inset-y-0.5 after:block after:w-px after:rounded-full","after:transition-colors"]}},{disabled:!1,active:!1,variant:"pill",class:{link:["hover:text-highlighted hover:before:bg-elevated/50","transition-colors before:transition-colors"],linkLeadingIcon:["group-hover:text-default","transition-colors"]}},{disabled:!1,active:!1,variant:"pill",orientation:"horizontal",class:{link:"data-[state=open]:text-highlighted",linkLeadingIcon:"group-data-[state=open]:text-default"}},{disabled:!1,variant:"pill",highlight:!0,orientation:"horizontal",class:{link:"data-[state=open]:before:bg-elevated/50"}},{disabled:!1,variant:"pill",highlight:!1,active:!1,orientation:"horizontal",class:{link:"data-[state=open]:before:bg-elevated/50"}},{color:"primary",variant:"pill",active:!0,class:{link:"text-primary",linkLeadingIcon:"text-primary group-data-[state=open]:text-primary"}},{color:"secondary",variant:"pill",active:!0,class:{link:"text-secondary",linkLeadingIcon:"text-secondary group-data-[state=open]:text-secondary"}},{color:"success",variant:"pill",active:!0,class:{link:"text-success",linkLeadingIcon:"text-success group-data-[state=open]:text-success"}},{color:"info",variant:"pill",active:!0,class:{link:"text-info",linkLeadingIcon:"text-info group-data-[state=open]:text-info"}},{color:"warning",variant:"pill",active:!0,class:{link:"text-warning",linkLeadingIcon:"text-warning group-data-[state=open]:text-warning"}},{color:"error",variant:"pill",active:!0,class:{link:"text-error",linkLeadingIcon:"text-error group-data-[state=open]:text-error"}},{color:"neutral",variant:"pill",active:!0,class:{link:"text-highlighted",linkLeadingIcon:"text-highlighted group-data-[state=open]:text-highlighted"}},{variant:"pill",active:!0,highlight:!1,class:{link:"before:bg-elevated"}},{variant:"pill",active:!0,highlight:!0,disabled:!1,class:{link:["hover:before:bg-elevated/50","before:transition-colors"]}},{disabled:!1,active:!1,variant:"link",class:{link:["hover:text-highlighted","transition-colors"],linkLeadingIcon:["group-hover:text-default","transition-colors"]}},{disabled:!1,active:!1,variant:"link",orientation:"horizontal",class:{link:"data-[state=open]:text-highlighted",linkLeadingIcon:"group-data-[state=open]:text-default"}},{color:"primary",variant:"link",active:!0,class:{link:"text-primary",linkLeadingIcon:"text-primary group-data-[state=open]:text-primary"}},{color:"secondary",variant:"link",active:!0,class:{link:"text-secondary",linkLeadingIcon:"text-secondary group-data-[state=open]:text-secondary"}},{color:"success",variant:"link",active:!0,class:{link:"text-success",linkLeadingIcon:"text-success group-data-[state=open]:text-success"}},{color:"info",variant:"link",active:!0,class:{link:"text-info",linkLeadingIcon:"text-info group-data-[state=open]:text-info"}},{color:"warning",variant:"link",active:!0,class:{link:"text-warning",linkLeadingIcon:"text-warning group-data-[state=open]:text-warning"}},{color:"error",variant:"link",active:!0,class:{link:"text-error",linkLeadingIcon:"text-error group-data-[state=open]:text-error"}},{color:"neutral",variant:"link",active:!0,class:{link:"text-highlighted",linkLeadingIcon:"text-highlighted group-data-[state=open]:text-highlighted"}},{highlightColor:"primary",highlight:!0,level:!0,active:!0,class:{link:"after:bg-primary"}},{highlightColor:"secondary",highlight:!0,level:!0,active:!0,class:{link:"after:bg-secondary"}},{highlightColor:"success",highlight:!0,level:!0,active:!0,class:{link:"after:bg-success"}},{highlightColor:"info",highlight:!0,level:!0,active:!0,class:{link:"after:bg-info"}},{highlightColor:"warning",highlight:!0,level:!0,active:!0,class:{link:"after:bg-warning"}},{highlightColor:"error",highlight:!0,level:!0,active:!0,class:{link:"after:bg-error"}},{highlightColor:"neutral",highlight:!0,level:!0,active:!0,class:{link:"after:bg-inverted"}}],defaultVariants:{color:"primary",highlightColor:"primary",variant:"pill"}},ql=Object.assign({inheritAttrs:!1},{__name:"UNavigationMenu",props:{as:{type:null,required:!1},type:{type:null,required:!1,default:"multiple"},modelValue:{type:null,required:!1},defaultValue:{type:null,required:!1},trailingIcon:{type:null,required:!1},externalIcon:{type:[Boolean,String],required:!1,skipCheck:!0,default:!0},items:{type:null,required:!1},color:{type:null,required:!1},variant:{type:null,required:!1},orientation:{type:null,required:!1,default:"horizontal"},collapsed:{type:Boolean,required:!1},tooltip:{type:[Boolean,Object],required:!1},popover:{type:[Boolean,Object],required:!1},highlight:{type:Boolean,required:!1},highlightColor:{type:null,required:!1},content:{type:Object,required:!1},contentOrientation:{type:null,required:!1,default:"horizontal"},arrow:{type:Boolean,required:!1},labelKey:{type:null,required:!1,default:"label"},class:{type:null,required:!1},ui:{type:null,required:!1},delayDuration:{type:Number,required:!1,default:0},disableClickTrigger:{type:Boolean,required:!1},disableHoverTrigger:{type:Boolean,required:!1},skipDelayDuration:{type:Number,required:!1},disablePointerLeaveClose:{type:Boolean,required:!1},unmountOnHide:{type:Boolean,required:!1,default:!0},disabled:{type:Boolean,required:!1},collapsible:{type:Boolean,required:!1,default:!0}},emits:["update:modelValue"],setup(e,{emit:t}){const i=e,s=t,r=Yt(),n=Nt(),o=ui(Z(()=>({as:i.as,delayDuration:i.delayDuration,skipDelayDuration:i.skipDelayDuration,orientation:i.orientation,disableClickTrigger:i.disableClickTrigger,disableHoverTrigger:i.disableHoverTrigger,disablePointerLeaveClose:i.disablePointerLeaveClose,unmountOnHide:i.unmountOnHide})),s),a=ui(It(i,"collapsible","disabled","type","unmountOnHide"),s),h=et(()=>i.content),l=et(()=>kt(typeof i.tooltip=="boolean"?{}:i.tooltip,{delayDuration:0,content:{side:"right"}})),f=et(()=>kt(typeof i.popover=="boolean"?{}:i.popover,{mode:"hover",content:{side:"right",align:"start",alignOffset:2}})),[d,u]=Vt(),[c,p]=Vt({props:{item:Object,index:Number,level:Number}}),_=Z(()=>Oe({extend:Oe(Wl),...n.ui?.navigationMenu||{}})({orientation:i.orientation,contentOrientation:i.orientation==="vertical"?void 0:i.contentOrientation,collapsed:i.collapsed,color:i.color,variant:i.variant,highlight:i.highlight,highlightColor:i.highlightColor||i.color})),S=Z(()=>i.items?.length?ma(i.items)?i.items:[i.items]:[]);function w(y,k=0){const g=y.reduce((C,L,x)=>((L.defaultOpen||L.open)&&C.push(L.value||(k>0?`item-${k}-${x}`:`item-${x}`)),C),[]);return i.type==="single"?g[0]:g}return(y,k)=>(B(),U(Ce,null,[P(v(d),null,{default:A(({item:g,active:C,index:L})=>[j(y.$slots,g.slot||"item",{item:g,index:L,active:C,ui:_.value},()=>[j(y.$slots,g.slot?`${g.slot}-leading`:"item-leading",{item:g,active:C,index:L,ui:_.value},()=>[g.avatar?(B(),z(wr,Y({key:0,size:g.ui?.linkLeadingAvatarSize||i.ui?.linkLeadingAvatarSize||_.value.linkLeadingAvatarSize()},g.avatar,{"data-slot":"linkLeadingAvatar",class:_.value.linkLeadingAvatar({class:[i.ui?.linkLeadingAvatar,g.ui?.linkLeadingAvatar],active:C,disabled:!!g.disabled})}),null,16,["size","class"])):g.icon?(B(),z(me,{key:1,name:g.icon,"data-slot":"linkLeadingIcon",class:F(_.value.linkLeadingIcon({class:[i.ui?.linkLeadingIcon,g.ui?.linkLeadingIcon],active:C,disabled:!!g.disabled}))},null,8,["name","class"])):W("",!0)]),v(Pe)(g,i.labelKey)||r[g.slot?`${g.slot}-label`:"item-label"]?(B(),U("span",{key:0,"data-slot":"linkLabel",class:F(_.value.linkLabel({class:[i.ui?.linkLabel,g.ui?.linkLabel]}))},[j(y.$slots,g.slot?`${g.slot}-label`:"item-label",{item:g,active:C,index:L},()=>[tt(Be(v(Pe)(g,i.labelKey)),1)]),g.target==="_blank"&&e.externalIcon!==!1?(B(),z(me,{key:0,name:typeof e.externalIcon=="string"?e.externalIcon:v(n).ui.icons.external,"data-slot":"linkLabelExternalIcon",class:F(_.value.linkLabelExternalIcon({class:[i.ui?.linkLabelExternalIcon,g.ui?.linkLabelExternalIcon],active:C}))},null,8,["name","class"])):W("",!0)],2)):W("",!0),g.badge||g.badge===0||e.orientation==="horizontal"&&(g.children?.length||r[g.slot?`${g.slot}-content`:"item-content"])||e.orientation==="vertical"&&g.children?.length||g.trailingIcon||r[g.slot?`${g.slot}-trailing`:"item-trailing"]?(B(),z(Ci(e.orientation==="vertical"&&g.children?.length&&!e.collapsed?v(Fr):"span"),{key:1,as:"span","data-slot":"linkTrailing",class:F(_.value.linkTrailing({class:[i.ui?.linkTrailing,g.ui?.linkTrailing]})),onClick:k[0]||(k[0]=Sa(()=>{},["stop","prevent"]))},{default:A(()=>[j(y.$slots,g.slot?`${g.slot}-trailing`:"item-trailing",{item:g,active:C,index:L,ui:_.value},()=>[g.badge||g.badge===0?(B(),z(Wa,Y({key:0,color:"neutral",variant:"outline",size:g.ui?.linkTrailingBadgeSize||i.ui?.linkTrailingBadgeSize||_.value.linkTrailingBadgeSize()},typeof g.badge=="string"||typeof g.badge=="number"?{label:g.badge}:g.badge,{"data-slot":"linkTrailingBadge",class:_.value.linkTrailingBadge({class:[i.ui?.linkTrailingBadge,g.ui?.linkTrailingBadge]})}),null,16,["size","class"])):W("",!0),e.orientation==="horizontal"&&(g.children?.length||r[g.slot?`${g.slot}-content`:"item-content"])||e.orientation==="vertical"&&g.children?.length?(B(),z(me,{key:1,name:g.trailingIcon||e.trailingIcon||v(n).ui.icons.chevronDown,"data-slot":"linkTrailingIcon",class:F(_.value.linkTrailingIcon({class:[i.ui?.linkTrailingIcon,g.ui?.linkTrailingIcon],active:C}))},null,8,["name","class"])):g.trailingIcon?(B(),z(me,{key:2,name:g.trailingIcon,"data-slot":"linkTrailingIcon",class:F(_.value.linkTrailingIcon({class:[i.ui?.linkTrailingIcon,g.ui?.linkTrailingIcon],active:C}))},null,8,["name","class"])):W("",!0)])]),_:2},1032,["class"])):W("",!0)])]),_:3}),P(v(c),null,{default:A(({item:g,index:C,level:L=0})=>[(B(),z(Ci(e.orientation==="vertical"&&!e.collapsed?v(Fa):v(Cl)),{as:"li",value:g.value||(L>0?`item-${L}-${C}`:`item-${C}`)},{default:A(()=>[e.orientation==="vertical"&&g.type==="label"&&!e.collapsed?(B(),U("div",{key:0,"data-slot":"label",class:F(_.value.label({class:[i.ui?.label,g.ui?.label,g.class]}))},[P(v(u),{item:g,index:C},null,8,["item","index"])],2)):g.type!=="label"?(B(),z(Ai,Y({key:1},e.orientation==="vertical"&&g.children?.length&&!e.collapsed&&g.type==="trigger"?{}:v(Ti)(g),{custom:""}),{default:A(({active:x,...$})=>[(B(),z(Ci(e.orientation==="horizontal"&&(g.children?.length||r[g.slot?`${g.slot}-content`:"item-content"])?v(Pl):e.orientation==="vertical"&&g.children?.length&&!e.collapsed&&!$.href?v(Fr):v(fs)),{"as-child":"",active:x||g.active,disabled:g.disabled,onSelect:g.onSelect},{default:A(()=>[e.orientation==="vertical"&&e.collapsed&&g.children?.length&&(i.popover||g.popover)?(B(),z($l,Y({key:0},{...f.value,...typeof g.popover=="boolean"?{}:g.popover||{}},{ui:{content:_.value.content({class:[i.ui?.content,g.ui?.content]})}}),{content:A(({close:H})=>[j(y.$slots,g.slot?`${g.slot}-content`:"item-content",{item:g,active:x||g.active,index:C,ui:_.value,close:H},()=>[te("ul",{"data-slot":"childList",class:F(_.value.childList({class:[i.ui?.childList,g.ui?.childList]}))},[te("li",{"data-slot":"childLabel",class:F(_.value.childLabel({class:[i.ui?.childLabel,g.ui?.childLabel]}))},Be(v(Pe)(g,i.labelKey)),3),(B(!0),U(Ce,null,Ue(g.children,(G,V)=>(B(),U("li",{key:V,"data-slot":"childItem",class:F(_.value.childItem({class:[i.ui?.childItem,g.ui?.childItem]}))},[P(Ai,Y({ref_for:!0},v(Ti)(G),{custom:""}),{default:A(({active:I,...b})=>[P(v(fs),{"as-child":"",active:I,onSelect:G.onSelect},{default:A(()=>[P(Wt,Y({ref_for:!0},b,{"data-slot":"childLink",class:_.value.childLink({class:[i.ui?.childLink,g.ui?.childLink,G.class],active:I})}),{default:A(()=>[G.icon?(B(),z(me,{key:0,name:G.icon,"data-slot":"childLinkIcon",class:F(_.value.childLinkIcon({class:[i.ui?.childLinkIcon,g.ui?.childLinkIcon],active:I}))},null,8,["name","class"])):W("",!0),te("span",{"data-slot":"childLinkLabel",class:F(_.value.childLinkLabel({class:[i.ui?.childLinkLabel,g.ui?.childLinkLabel],active:I}))},[tt(Be(v(Pe)(G,i.labelKey))+" ",1),G.target==="_blank"&&e.externalIcon!==!1?(B(),z(me,{key:0,name:typeof e.externalIcon=="string"?e.externalIcon:v(n).ui.icons.external,"data-slot":"childLinkLabelExternalIcon",class:F(_.value.childLinkLabelExternalIcon({class:[i.ui?.childLinkLabelExternalIcon,g.ui?.childLinkLabelExternalIcon],active:I}))},null,8,["name","class"])):W("",!0)],2)]),_:2},1040,["class"])]),_:2},1032,["active","onSelect"])]),_:2},1040)],2))),128))],2)])]),default:A(()=>[P(Wt,Y($,{"data-slot":"link",class:_.value.link({class:[i.ui?.link,g.ui?.link,g.class],active:x||g.active,disabled:!!g.disabled,level:L>0})}),{default:A(()=>[P(v(u),{item:g,active:x||g.active,index:C},null,8,["item","active","index"])]),_:2},1040,["class"])]),_:2},1040,["ui"])):e.orientation==="vertical"&&e.collapsed&&(i.tooltip||g.tooltip)?(B(),z(Qn,Y({key:1,text:v(Pe)(g,i.labelKey)},{...l.value,...typeof g.tooltip=="boolean"?{}:g.tooltip||{}}),{default:A(()=>[P(Wt,Y($,{"data-slot":"link",class:_.value.link({class:[i.ui?.link,g.ui?.link,g.class],active:x||g.active,disabled:!!g.disabled,level:L>0})}),{default:A(()=>[P(v(u),{item:g,active:x||g.active,index:C},null,8,["item","active","index"])]),_:2},1040,["class"])]),_:2},1040,["text"])):(B(),z(Wt,Y({key:2},$,{"data-slot":"link",class:_.value.link({class:[i.ui?.link,g.ui?.link,g.class],active:x||g.active,disabled:!!g.disabled,level:e.orientation==="horizontal"||L>0})}),{default:A(()=>[P(v(u),{item:g,active:x||g.active,index:C},null,8,["item","active","index"])]),_:2},1040,["class"]))]),_:2},1064,["active","disabled","onSelect"])),e.orientation==="horizontal"&&(g.children?.length||r[g.slot?`${g.slot}-content`:"item-content"])?(B(),z(v(Bl),Y({key:0},h.value,{"data-slot":"content",class:_.value.content({class:[i.ui?.content,g.ui?.content]})}),{default:A(()=>[j(y.$slots,g.slot?`${g.slot}-content`:"item-content",{item:g,active:x||g.active,index:C,ui:_.value},()=>[te("ul",{"data-slot":"childList",class:F(_.value.childList({class:[i.ui?.childList,g.ui?.childList]}))},[(B(!0),U(Ce,null,Ue(g.children,(H,G)=>(B(),U("li",{key:G,"data-slot":"childItem",class:F(_.value.childItem({class:[i.ui?.childItem,g.ui?.childItem]}))},[P(Ai,Y({ref_for:!0},v(Ti)(H),{custom:""}),{default:A(({active:V,...I})=>[P(v(fs),{"as-child":"",active:V,onSelect:H.onSelect},{default:A(()=>[P(Wt,Y({ref_for:!0},I,{"data-slot":"childLink",class:_.value.childLink({class:[i.ui?.childLink,g.ui?.childLink,H.class],active:V})}),{default:A(()=>[H.icon?(B(),z(me,{key:0,name:H.icon,"data-slot":"childLinkIcon",class:F(_.value.childLinkIcon({class:[i.ui?.childLinkIcon,g.ui?.childLinkIcon],active:V}))},null,8,["name","class"])):W("",!0),te("div",{"data-slot":"childLinkWrapper",class:F(_.value.childLinkWrapper({class:[i.ui?.childLinkWrapper,g.ui?.childLinkWrapper]}))},[te("p",{"data-slot":"childLinkLabel",class:F(_.value.childLinkLabel({class:[i.ui?.childLinkLabel,g.ui?.childLinkLabel],active:V}))},[tt(Be(v(Pe)(H,i.labelKey))+" ",1),H.target==="_blank"&&e.externalIcon!==!1?(B(),z(me,{key:0,name:typeof e.externalIcon=="string"?e.externalIcon:v(n).ui.icons.external,"data-slot":"childLinkLabelExternalIcon",class:F(_.value.childLinkLabelExternalIcon({class:[i.ui?.childLinkLabelExternalIcon,g.ui?.childLinkLabelExternalIcon],active:V}))},null,8,["name","class"])):W("",!0)],2),H.description?(B(),U("p",{key:0,"data-slot":"childLinkDescription",class:F(_.value.childLinkDescription({class:[i.ui?.childLinkDescription,g.ui?.childLinkDescription],active:V}))},Be(H.description),3)):W("",!0)],2)]),_:2},1040,["class"])]),_:2},1032,["active","onSelect"])]),_:2},1040)],2))),128))],2)])]),_:2},1040,["class"])):W("",!0)]),_:2},1040)):W("",!0),e.orientation==="vertical"&&g.children?.length&&!e.collapsed?(B(),z(v(Ha),{key:2,"data-slot":"content",class:F(_.value.content({class:[i.ui?.content,g.ui?.content]}))},{default:A(()=>[P(v(Hr),Y({...v(a),defaultValue:w(g.children,L+1)},{as:"ul","data-slot":"childList",class:_.value.childList({class:i.ui?.childList})}),{default:A(()=>[(B(!0),U(Ce,null,Ue(g.children,(x,$)=>(B(),z(v(p),{key:$,item:x,index:$,level:L+1,"data-slot":"childItem",class:F(_.value.childItem({class:[i.ui?.childItem,x.ui?.childItem]}))},null,8,["item","index","level","class"]))),128))]),_:2},1040,["class"])]),_:2},1032,["class"])):W("",!0)]),_:2},1032,["value"]))]),_:3}),P(v(ml),Y({...v(o),...e.orientation==="horizontal"?{modelValue:e.modelValue,defaultValue:e.defaultValue}:{},...y.$attrs},{"data-collapsed":e.collapsed,"data-slot":"root",class:_.value.root({class:[i.ui?.root,i.class]})}),{default:A(()=>[j(y.$slots,"list-leading"),(B(!0),U(Ce,null,Ue(S.value,(g,C)=>(B(),U(Ce,{key:`list-${C}`},[(B(),z(Ci(e.orientation==="vertical"?v(Hr):v(Al)),Y({ref_for:!0},e.orientation==="vertical"&&!e.collapsed?{...v(a),modelValue:e.modelValue,defaultValue:e.defaultValue??w(g)}:{},{as:"ul","data-slot":"list",class:_.value.list({class:i.ui?.list})}),{default:A(()=>[(B(!0),U(Ce,null,Ue(g,(L,x)=>(B(),z(v(p),{key:`list-${C}-${x}`,item:L,index:x,"data-slot":"item",class:F(_.value.item({class:[i.ui?.item,L.ui?.item]}))},null,8,["item","index","class"]))),128))]),_:2},1040,["class"])),e.orientation==="vertical"&&C<S.value.length-1?(B(),U("div",{key:0,"data-slot":"separator",class:F(_.value.separator({class:i.ui?.separator}))},null,2)):W("",!0)],64))),128)),j(y.$slots,"list-trailing"),e.orientation==="horizontal"?(B(),U("div",{key:0,"data-slot":"viewportWrapper",class:F(_.value.viewportWrapper({class:i.ui?.viewportWrapper}))},[e.arrow?(B(),z(v(Dl),{key:0,"data-slot":"indicator",class:F(_.value.indicator({class:i.ui?.indicator}))},{default:A(()=>[te("div",{"data-slot":"arrow",class:F(_.value.arrow({class:i.ui?.arrow}))},null,2)]),_:1},8,["class"])):W("",!0),P(v(Nl),{"data-slot":"viewport",class:F(_.value.viewport({class:i.ui?.viewport}))},null,8,["class"])],2)):W("",!0)]),_:3},16,["data-collapsed","class"])],64))}}),Kl={slots:{root:"relative hidden lg:flex flex-col min-h-svh min-w-16 w-(--width) shrink-0",header:"h-(--ui-header-height) shrink-0 flex items-center gap-1.5 px-4",body:"flex flex-col gap-4 flex-1 overflow-y-auto px-4 py-2",footer:"shrink-0 flex items-center gap-1.5 px-4 py-2",toggle:"",handle:"",content:"lg:hidden",overlay:"lg:hidden"},variants:{menu:{true:{header:"sm:px-6",body:"sm:px-6",footer:"sm:px-6"}},side:{left:{root:"border-e border-default"},right:{root:""}},toggleSide:{left:{toggle:""},right:{toggle:"ms-auto"}}}},Ul=["data-collapsed","data-dragging"],Vl=Object.assign({inheritAttrs:!1},{__name:"UDashboardSidebar",props:Ui({mode:{type:null,required:!1,default:"slideover"},menu:{type:null,required:!1},toggle:{type:[Boolean,Object],required:!1,default:!0},toggleSide:{type:String,required:!1,default:"left"},class:{type:null,required:!1},ui:{type:null,required:!1},id:{type:String,required:!1},side:{type:String,required:!1,default:"left"},minSize:{type:Number,required:!1,default:10},maxSize:{type:Number,required:!1,default:20},defaultSize:{type:Number,required:!1,default:15},resizable:{type:Boolean,required:!1,default:!1},collapsible:{type:Boolean,required:!1,default:!1},collapsedSize:{type:Number,required:!1,default:0}},{open:{type:Boolean,default:!1},openModifiers:{},collapsed:{type:Boolean,default:!1},collapsedModifiers:{}}),emits:["update:open","update:collapsed"],setup(e){const t=e,i=Yt(),s=di(e,"open",{type:Boolean,default:!1}),r=di(e,"collapsed",{type:Boolean,default:!1}),n=Gn(),{t:o}=ts(),a=Nt(),h=Zn({storageKey:"dashboard",unit:"%",sidebarOpen:X(!1),sidebarCollapsed:X(!1)}),l=`${h.storageKey}-sidebar-${t.id||ba()}`,{el:f,size:d,collapse:u,isCollapsed:c,isDragging:p,onMouseDown:_,onTouchStart:S,onDoubleClick:w}=Ta(l,et(()=>({...h,...t})),{collapsed:r}),[y,k]=Vt(),[g,C]=Vt();Ms("dashboard:sidebar:toggle",()=>{s.value=!s.value}),Ms("dashboard:sidebar:collapse",G=>{c.value=G}),ke(s,()=>h.sidebarOpen.value=s.value,{immediate:!0}),ke(c,()=>h.sidebarCollapsed.value=c.value,{immediate:!0}),ke(()=>n.fullPath,()=>{s.value=!1});const L=Z(()=>Oe({extend:Oe(Kl),...a.ui?.dashboardSidebar||{}})({side:t.side})),x=Z(()=>({slideover:ja,modal:kr,drawer:Ya})[t.mode]),$=et(()=>kt(t.menu,{content:{onOpenAutoFocus:G=>G.preventDefault()}},t.mode==="modal"?{fullscreen:!0,transition:!1}:t.mode==="slideover"?{side:"left"}:{}));function H(){s.value=!s.value}return(G,V)=>(B(),U(Ce,null,[P(v(y),null,{default:A(()=>[j(G.$slots,"toggle",{open:s.value,toggle:H,ui:L.value},()=>[e.toggle?(B(),z(Ia,Y({key:0},typeof e.toggle=="object"?e.toggle:{},{side:e.toggleSide,"data-slot":"toggle",class:L.value.toggle({class:t.ui?.toggle,toggleSide:e.toggleSide})}),null,16,["side","class"])):W("",!0)])]),_:3}),P(v(g),null,{default:A(()=>[j(G.$slots,"resize-handle",{onMouseDown:v(_),onTouchStart:v(S),onDoubleClick:v(w),ui:L.value},()=>[e.resizable?(B(),z(Pa,{key:0,"aria-controls":l,"data-slot":"handle",class:F(L.value.handle({class:t.ui?.handle})),onMousedown:v(_),onTouchstart:v(S),onDblclick:v(w)},null,8,["class","onMousedown","onTouchstart","onDblclick"])):W("",!0)])]),_:3}),e.side==="right"?(B(),z(v(C),{key:0})):W("",!0),te("div",Y({id:l,ref_key:"el",ref:f},G.$attrs,{"data-collapsed":v(c),"data-dragging":v(p),"data-slot":"root",class:L.value.root({class:[t.ui?.root,t.class]}),style:{"--width":`${v(d)||0}${v(h).unit}`}}),[i.header?(B(),U("div",{key:0,"data-slot":"header",class:F(L.value.header({class:t.ui?.header}))},[j(G.$slots,"header",{collapsed:v(c),collapse:v(u)})],2)):W("",!0),te("div",{"data-slot":"body",class:F(L.value.body({class:t.ui?.body}))},[j(G.$slots,"default",{collapsed:v(c),collapse:v(u)})],2),i.footer?(B(),U("div",{key:1,"data-slot":"footer",class:F(L.value.footer({class:t.ui?.footer}))},[j(G.$slots,"footer",{collapsed:v(c),collapse:v(u)})],2)):W("",!0)],16,Ul),e.side==="left"?(B(),z(v(C),{key:1})):W("",!0),P(v(x),Y({open:s.value,"onUpdate:open":V[0]||(V[0]=I=>s.value=I),title:v(o)("dashboardSidebar.title"),description:v(o)("dashboardSidebar.description")},$.value,{ui:{overlay:L.value.overlay({class:t.ui?.overlay}),content:L.value.content({class:t.ui?.content})}}),{content:A(I=>[j(G.$slots,"content",bt(yt(I)),()=>[i.header||e.mode!=="drawer"?(B(),U("div",{key:0,"data-slot":"header",class:F(L.value.header({class:t.ui?.header,menu:!0}))},[e.mode!=="drawer"&&e.toggleSide==="left"?(B(),z(v(k),{key:0})):W("",!0),j(G.$slots,"header"),e.mode!=="drawer"&&e.toggleSide==="right"?(B(),z(v(k),{key:1})):W("",!0)],2)):W("",!0),te("div",{"data-slot":"body",class:F(L.value.body({class:t.ui?.body,menu:!0}))},[j(G.$slots,"default")],2),i.footer?(B(),U("div",{key:1,"data-slot":"footer",class:F(L.value.footer({class:t.ui?.footer,menu:!0}))},[j(G.$slots,"footer")],2)):W("",!0)])]),_:3},16,["open","title","description","ui"])],64))}});function ht(e){return Array.isArray?Array.isArray(e):ho(e)==="[object Array]"}function jl(e){if(typeof e=="string")return e;let t=e+"";return t=="0"&&1/e==-1/0?"-0":t}function Yl(e){return e==null?"":jl(e)}function Ze(e){return typeof e=="string"}function ao(e){return typeof e=="number"}function Gl(e){return e===!0||e===!1||Xl(e)&&ho(e)=="[object Boolean]"}function lo(e){return typeof e=="object"}function Xl(e){return lo(e)&&e!==null}function He(e){return e!=null}function _s(e){return!e.trim().length}function ho(e){return e==null?e===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(e)}const Jl="Incorrect 'index' type",Zl=e=>`Invalid value for key ${e}`,Ql=e=>`Pattern length exceeds max of ${e}.`,eh=e=>`Missing ${e} property in key`,th=e=>`Property 'weight' in key '${e}' must be a positive integer`,$r=Object.prototype.hasOwnProperty;class ih{constructor(t){this._keys=[],this._keyMap={};let i=0;t.forEach(s=>{let r=co(s);this._keys.push(r),this._keyMap[r.id]=r,i+=r.weight}),this._keys.forEach(s=>{s.weight/=i})}get(t){return this._keyMap[t]}keys(){return this._keys}toJSON(){return JSON.stringify(this._keys)}}function co(e){let t=null,i=null,s=null,r=1,n=null;if(Ze(e)||ht(e))s=e,t=Wr(e),i=Rs(e);else{if(!$r.call(e,"name"))throw new Error(eh("name"));const o=e.name;if(s=o,$r.call(e,"weight")&&(r=e.weight,r<=0))throw new Error(th(o));t=Wr(o),i=Rs(o),n=e.getFn}return{path:t,id:i,weight:r,src:s,getFn:n}}function Wr(e){return ht(e)?e:e.split(".")}function Rs(e){return ht(e)?e.join("."):e}function sh(e,t){let i=[],s=!1;const r=(n,o,a)=>{if(He(n))if(!o[a])i.push(n);else{let h=o[a];const l=n[h];if(!He(l))return;if(a===o.length-1&&(Ze(l)||ao(l)||Gl(l)))i.push(Yl(l));else if(ht(l)){s=!0;for(let f=0,d=l.length;f<d;f+=1)r(l[f],o,a+1)}else o.length&&r(l,o,a+1)}};return r(e,Ze(t)?t.split("."):t,0),s?i:i[0]}const rh={includeMatches:!1,findAllMatches:!1,minMatchCharLength:1},nh={isCaseSensitive:!1,ignoreDiacritics:!1,includeScore:!1,keys:[],shouldSort:!0,sortFn:(e,t)=>e.score===t.score?e.idx<t.idx?-1:1:e.score<t.score?-1:1},oh={location:0,threshold:.6,distance:100},ah={useExtendedSearch:!1,getFn:sh,ignoreLocation:!1,ignoreFieldNorm:!1,fieldNormWeight:1};var q={...nh,...rh,...oh,...ah};const lh=/[^ ]+/g;function hh(e=1,t=3){const i=new Map,s=Math.pow(10,t);return{get(r){const n=r.match(lh).length;if(i.has(n))return i.get(n);const o=1/Math.pow(n,.5*e),a=parseFloat(Math.round(o*s)/s);return i.set(n,a),a},clear(){i.clear()}}}class Br{constructor({getFn:t=q.getFn,fieldNormWeight:i=q.fieldNormWeight}={}){this.norm=hh(i,3),this.getFn=t,this.isCreated=!1,this.setIndexRecords()}setSources(t=[]){this.docs=t}setIndexRecords(t=[]){this.records=t}setKeys(t=[]){this.keys=t,this._keysMap={},t.forEach((i,s)=>{this._keysMap[i.id]=s})}create(){this.isCreated||!this.docs.length||(this.isCreated=!0,Ze(this.docs[0])?this.docs.forEach((t,i)=>{this._addString(t,i)}):this.docs.forEach((t,i)=>{this._addObject(t,i)}),this.norm.clear())}add(t){const i=this.size();Ze(t)?this._addString(t,i):this._addObject(t,i)}removeAt(t){this.records.splice(t,1);for(let i=t,s=this.size();i<s;i+=1)this.records[i].i-=1}getValueForItemAtKeyId(t,i){return t[this._keysMap[i]]}size(){return this.records.length}_addString(t,i){if(!He(t)||_s(t))return;let s={v:t,i,n:this.norm.get(t)};this.records.push(s)}_addObject(t,i){let s={i,$:{}};this.keys.forEach((r,n)=>{let o=r.getFn?r.getFn(t):this.getFn(t,r.path);if(He(o)){if(ht(o)){let a=[];const h=[{nestedArrIndex:-1,value:o}];for(;h.length;){const{nestedArrIndex:l,value:f}=h.pop();if(He(f))if(Ze(f)&&!_s(f)){let d={v:f,i:l,n:this.norm.get(f)};a.push(d)}else ht(f)&&f.forEach((d,u)=>{h.push({nestedArrIndex:u,value:d})})}s.$[n]=a}else if(Ze(o)&&!_s(o)){let a={v:o,n:this.norm.get(o)};s.$[n]=a}}}),this.records.push(s)}toJSON(){return{keys:this.keys,records:this.records}}}function uo(e,t,{getFn:i=q.getFn,fieldNormWeight:s=q.fieldNormWeight}={}){const r=new Br({getFn:i,fieldNormWeight:s});return r.setKeys(e.map(co)),r.setSources(t),r.create(),r}function ch(e,{getFn:t=q.getFn,fieldNormWeight:i=q.fieldNormWeight}={}){const{keys:s,records:r}=e,n=new Br({getFn:t,fieldNormWeight:i});return n.setKeys(s),n.setIndexRecords(r),n}function ki(e,{errors:t=0,currentLocation:i=0,expectedLocation:s=0,distance:r=q.distance,ignoreLocation:n=q.ignoreLocation}={}){const o=t/e.length;if(n)return o;const a=Math.abs(s-i);return r?o+a/r:a?1:o}function uh(e=[],t=q.minMatchCharLength){let i=[],s=-1,r=-1,n=0;for(let o=e.length;n<o;n+=1){let a=e[n];a&&s===-1?s=n:!a&&s!==-1&&(r=n-1,r-s+1>=t&&i.push([s,r]),s=-1)}return e[n-1]&&n-s>=t&&i.push([s,n-1]),i}const Rt=32;function dh(e,t,i,{location:s=q.location,distance:r=q.distance,threshold:n=q.threshold,findAllMatches:o=q.findAllMatches,minMatchCharLength:a=q.minMatchCharLength,includeMatches:h=q.includeMatches,ignoreLocation:l=q.ignoreLocation}={}){if(t.length>Rt)throw new Error(Ql(Rt));const f=t.length,d=e.length,u=Math.max(0,Math.min(s,d));let c=n,p=u;const _=a>1||h,S=_?Array(d):[];let w;for(;(w=e.indexOf(t,p))>-1;){let x=ki(t,{currentLocation:w,expectedLocation:u,distance:r,ignoreLocation:l});if(c=Math.min(x,c),p=w+f,_){let $=0;for(;$<f;)S[w+$]=1,$+=1}}p=-1;let y=[],k=1,g=f+d;const C=1<<f-1;for(let x=0;x<f;x+=1){let $=0,H=g;for(;$<H;)ki(t,{errors:x,currentLocation:u+H,expectedLocation:u,distance:r,ignoreLocation:l})<=c?$=H:g=H,H=Math.floor((g-$)/2+$);g=H;let G=Math.max(1,u-H+1),V=o?d:Math.min(u+H,d)+f,I=Array(V+2);I[V+1]=(1<<x)-1;for(let R=V;R>=G;R-=1){let m=R-1,O=i[e.charAt(m)];if(_&&(S[m]=+!!O),I[R]=(I[R+1]<<1|1)&O,x&&(I[R]|=(y[R+1]|y[R])<<1|1|y[R+1]),I[R]&C&&(k=ki(t,{errors:x,currentLocation:m,expectedLocation:u,distance:r,ignoreLocation:l}),k<=c)){if(c=k,p=m,p<=u)break;G=Math.max(1,2*u-p)}}if(ki(t,{errors:x+1,currentLocation:u,expectedLocation:u,distance:r,ignoreLocation:l})>c)break;y=I}const L={isMatch:p>=0,score:Math.max(.001,k)};if(_){const x=uh(S,a);x.length?h&&(L.indices=x):L.isMatch=!1}return L}function fh(e){let t={};for(let i=0,s=e.length;i<s;i+=1){const r=e.charAt(i);t[r]=(t[r]||0)|1<<s-i-1}return t}const Vi=String.prototype.normalize?(e=>e.normalize("NFD").replace(/[\u0300-\u036F\u0483-\u0489\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u08D3-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u09FE\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0AFA-\u0AFF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B62\u0B63\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0C00-\u0C04\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0D00-\u0D03\u0D3B\u0D3C\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D82\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EB9\u0EBB\u0EBC\u0EC8-\u0ECD\u0F18\u0F19\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F\u109A-\u109D\u135D-\u135F\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u180B-\u180D\u1885\u1886\u18A9\u1920-\u192B\u1930-\u193B\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F\u1AB0-\u1ABE\u1B00-\u1B04\u1B34-\u1B44\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BE6-\u1BF3\u1C24-\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF2-\u1CF4\u1CF7-\u1CF9\u1DC0-\u1DF9\u1DFB-\u1DFF\u20D0-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA66F-\uA672\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA880\uA881\uA8B4-\uA8C5\uA8E0-\uA8F1\uA8FF\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9E5\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F]/g,"")):(e=>e);class fo{constructor(t,{location:i=q.location,threshold:s=q.threshold,distance:r=q.distance,includeMatches:n=q.includeMatches,findAllMatches:o=q.findAllMatches,minMatchCharLength:a=q.minMatchCharLength,isCaseSensitive:h=q.isCaseSensitive,ignoreDiacritics:l=q.ignoreDiacritics,ignoreLocation:f=q.ignoreLocation}={}){if(this.options={location:i,threshold:s,distance:r,includeMatches:n,findAllMatches:o,minMatchCharLength:a,isCaseSensitive:h,ignoreDiacritics:l,ignoreLocation:f},t=h?t:t.toLowerCase(),t=l?Vi(t):t,this.pattern=t,this.chunks=[],!this.pattern.length)return;const d=(c,p)=>{this.chunks.push({pattern:c,alphabet:fh(c),startIndex:p})},u=this.pattern.length;if(u>Rt){let c=0;const p=u%Rt,_=u-p;for(;c<_;)d(this.pattern.substr(c,Rt),c),c+=Rt;if(p){const S=u-Rt;d(this.pattern.substr(S),S)}}else d(this.pattern,0)}searchIn(t){const{isCaseSensitive:i,ignoreDiacritics:s,includeMatches:r}=this.options;if(t=i?t:t.toLowerCase(),t=s?Vi(t):t,this.pattern===t){let _={isMatch:!0,score:0};return r&&(_.indices=[[0,t.length-1]]),_}const{location:n,distance:o,threshold:a,findAllMatches:h,minMatchCharLength:l,ignoreLocation:f}=this.options;let d=[],u=0,c=!1;this.chunks.forEach(({pattern:_,alphabet:S,startIndex:w})=>{const{isMatch:y,score:k,indices:g}=dh(t,_,S,{location:n+w,distance:o,threshold:a,findAllMatches:h,minMatchCharLength:l,includeMatches:r,ignoreLocation:f});y&&(c=!0),u+=k,y&&g&&(d=[...d,...g])});let p={isMatch:c,score:c?u/this.chunks.length:1};return c&&r&&(p.indices=d),p}}class Et{constructor(t){this.pattern=t}static isMultiMatch(t){return qr(t,this.multiRegex)}static isSingleMatch(t){return qr(t,this.singleRegex)}search(){}}function qr(e,t){const i=e.match(t);return i?i[1]:null}class _h extends Et{constructor(t){super(t)}static get type(){return"exact"}static get multiRegex(){return/^="(.*)"$/}static get singleRegex(){return/^=(.*)$/}search(t){const i=t===this.pattern;return{isMatch:i,score:i?0:1,indices:[0,this.pattern.length-1]}}}class ph extends Et{constructor(t){super(t)}static get type(){return"inverse-exact"}static get multiRegex(){return/^!"(.*)"$/}static get singleRegex(){return/^!(.*)$/}search(t){const s=t.indexOf(this.pattern)===-1;return{isMatch:s,score:s?0:1,indices:[0,t.length-1]}}}class gh extends Et{constructor(t){super(t)}static get type(){return"prefix-exact"}static get multiRegex(){return/^\^"(.*)"$/}static get singleRegex(){return/^\^(.*)$/}search(t){const i=t.startsWith(this.pattern);return{isMatch:i,score:i?0:1,indices:[0,this.pattern.length-1]}}}class vh extends Et{constructor(t){super(t)}static get type(){return"inverse-prefix-exact"}static get multiRegex(){return/^!\^"(.*)"$/}static get singleRegex(){return/^!\^(.*)$/}search(t){const i=!t.startsWith(this.pattern);return{isMatch:i,score:i?0:1,indices:[0,t.length-1]}}}class mh extends Et{constructor(t){super(t)}static get type(){return"suffix-exact"}static get multiRegex(){return/^"(.*)"\$$/}static get singleRegex(){return/^(.*)\$$/}search(t){const i=t.endsWith(this.pattern);return{isMatch:i,score:i?0:1,indices:[t.length-this.pattern.length,t.length-1]}}}class Sh extends Et{constructor(t){super(t)}static get type(){return"inverse-suffix-exact"}static get multiRegex(){return/^!"(.*)"\$$/}static get singleRegex(){return/^!(.*)\$$/}search(t){const i=!t.endsWith(this.pattern);return{isMatch:i,score:i?0:1,indices:[0,t.length-1]}}}class _o extends Et{constructor(t,{location:i=q.location,threshold:s=q.threshold,distance:r=q.distance,includeMatches:n=q.includeMatches,findAllMatches:o=q.findAllMatches,minMatchCharLength:a=q.minMatchCharLength,isCaseSensitive:h=q.isCaseSensitive,ignoreDiacritics:l=q.ignoreDiacritics,ignoreLocation:f=q.ignoreLocation}={}){super(t),this._bitapSearch=new fo(t,{location:i,threshold:s,distance:r,includeMatches:n,findAllMatches:o,minMatchCharLength:a,isCaseSensitive:h,ignoreDiacritics:l,ignoreLocation:f})}static get type(){return"fuzzy"}static get multiRegex(){return/^"(.*)"$/}static get singleRegex(){return/^(.*)$/}search(t){return this._bitapSearch.searchIn(t)}}class po extends Et{constructor(t){super(t)}static get type(){return"include"}static get multiRegex(){return/^'"(.*)"$/}static get singleRegex(){return/^'(.*)$/}search(t){let i=0,s;const r=[],n=this.pattern.length;for(;(s=t.indexOf(this.pattern,i))>-1;)i=s+n,r.push([s,i-1]);const o=!!r.length;return{isMatch:o,score:o?0:1,indices:r}}}const As=[_h,po,gh,vh,Sh,mh,ph,_o],Kr=As.length,bh=/ +(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/,yh="|";function wh(e,t={}){return e.split(yh).map(i=>{let s=i.trim().split(bh).filter(n=>n&&!!n.trim()),r=[];for(let n=0,o=s.length;n<o;n+=1){const a=s[n];let h=!1,l=-1;for(;!h&&++l<Kr;){const f=As[l];let d=f.isMultiMatch(a);d&&(r.push(new f(d,t)),h=!0)}if(!h)for(l=-1;++l<Kr;){const f=As[l];let d=f.isSingleMatch(a);if(d){r.push(new f(d,t));break}}}return r})}const Ch=new Set([_o.type,po.type]);class kh{constructor(t,{isCaseSensitive:i=q.isCaseSensitive,ignoreDiacritics:s=q.ignoreDiacritics,includeMatches:r=q.includeMatches,minMatchCharLength:n=q.minMatchCharLength,ignoreLocation:o=q.ignoreLocation,findAllMatches:a=q.findAllMatches,location:h=q.location,threshold:l=q.threshold,distance:f=q.distance}={}){this.query=null,this.options={isCaseSensitive:i,ignoreDiacritics:s,includeMatches:r,minMatchCharLength:n,findAllMatches:a,ignoreLocation:o,location:h,threshold:l,distance:f},t=i?t:t.toLowerCase(),t=s?Vi(t):t,this.pattern=t,this.query=wh(this.pattern,this.options)}static condition(t,i){return i.useExtendedSearch}searchIn(t){const i=this.query;if(!i)return{isMatch:!1,score:1};const{includeMatches:s,isCaseSensitive:r,ignoreDiacritics:n}=this.options;t=r?t:t.toLowerCase(),t=n?Vi(t):t;let o=0,a=[],h=0;for(let l=0,f=i.length;l<f;l+=1){const d=i[l];a.length=0,o=0;for(let u=0,c=d.length;u<c;u+=1){const p=d[u],{isMatch:_,indices:S,score:w}=p.search(t);if(_){if(o+=1,h+=w,s){const y=p.constructor.type;Ch.has(y)?a=[...a,...S]:a.push(S)}}else{h=0,o=0,a.length=0;break}}if(o){let u={isMatch:!0,score:h/o};return s&&(u.indices=a),u}}return{isMatch:!1,score:1}}}const Ts=[];function xh(...e){Ts.push(...e)}function Is(e,t){for(let i=0,s=Ts.length;i<s;i+=1){let r=Ts[i];if(r.condition(e,t))return new r(e,t)}return new fo(e,t)}const ji={AND:"$and",OR:"$or"},Ps={PATH:"$path",PATTERN:"$val"},Os=e=>!!(e[ji.AND]||e[ji.OR]),Eh=e=>!!e[Ps.PATH],Bh=e=>!ht(e)&&lo(e)&&!Os(e),Ur=e=>({[ji.AND]:Object.keys(e).map(t=>({[t]:e[t]}))});function go(e,t,{auto:i=!0}={}){const s=r=>{let n=Object.keys(r);const o=Eh(r);if(!o&&n.length>1&&!Os(r))return s(Ur(r));if(Bh(r)){const h=o?r[Ps.PATH]:n[0],l=o?r[Ps.PATTERN]:r[h];if(!Ze(l))throw new Error(Zl(h));const f={keyId:Rs(h),pattern:l};return i&&(f.searcher=Is(l,t)),f}let a={children:[],operator:n[0]};return n.forEach(h=>{const l=r[h];ht(l)&&l.forEach(f=>{a.children.push(s(f))})}),a};return Os(e)||(e=Ur(e)),s(e)}function Lh(e,{ignoreFieldNorm:t=q.ignoreFieldNorm}){e.forEach(i=>{let s=1;i.matches.forEach(({key:r,norm:n,score:o})=>{const a=r?r.weight:null;s*=Math.pow(o===0&&a?Number.EPSILON:o,(a||1)*(t?1:n))}),i.score=s})}function Dh(e,t){const i=e.matches;t.matches=[],He(i)&&i.forEach(s=>{if(!He(s.indices)||!s.indices.length)return;const{indices:r,value:n}=s;let o={indices:r,value:n};s.key&&(o.key=s.key.src),s.idx>-1&&(o.refIndex=s.idx),t.matches.push(o)})}function Mh(e,t){t.score=e.score}function Rh(e,t,{includeMatches:i=q.includeMatches,includeScore:s=q.includeScore}={}){const r=[];return i&&r.push(Dh),s&&r.push(Mh),e.map(n=>{const{idx:o}=n,a={item:t[o],refIndex:o};return r.length&&r.forEach(h=>{h(n,a)}),a})}class Gt{constructor(t,i={},s){this.options={...q,...i},this.options.useExtendedSearch,this._keyStore=new ih(this.options.keys),this.setCollection(t,s)}setCollection(t,i){if(this._docs=t,i&&!(i instanceof Br))throw new Error(Jl);this._myIndex=i||uo(this.options.keys,this._docs,{getFn:this.options.getFn,fieldNormWeight:this.options.fieldNormWeight})}add(t){He(t)&&(this._docs.push(t),this._myIndex.add(t))}remove(t=()=>!1){const i=[];for(let s=0,r=this._docs.length;s<r;s+=1){const n=this._docs[s];t(n,s)&&(this.removeAt(s),s-=1,r-=1,i.push(n))}return i}removeAt(t){this._docs.splice(t,1),this._myIndex.removeAt(t)}getIndex(){return this._myIndex}search(t,{limit:i=-1}={}){const{includeMatches:s,includeScore:r,shouldSort:n,sortFn:o,ignoreFieldNorm:a}=this.options;let h=Ze(t)?Ze(this._docs[0])?this._searchStringList(t):this._searchObjectList(t):this._searchLogical(t);return Lh(h,{ignoreFieldNorm:a}),n&&h.sort(o),ao(i)&&i>-1&&(h=h.slice(0,i)),Rh(h,this._docs,{includeMatches:s,includeScore:r})}_searchStringList(t){const i=Is(t,this.options),{records:s}=this._myIndex,r=[];return s.forEach(({v:n,i:o,n:a})=>{if(!He(n))return;const{isMatch:h,score:l,indices:f}=i.searchIn(n);h&&r.push({item:n,idx:o,matches:[{score:l,value:n,norm:a,indices:f}]})}),r}_searchLogical(t){const i=go(t,this.options),s=(a,h,l)=>{if(!a.children){const{keyId:d,searcher:u}=a,c=this._findMatches({key:this._keyStore.get(d),value:this._myIndex.getValueForItemAtKeyId(h,d),searcher:u});return c&&c.length?[{idx:l,item:h,matches:c}]:[]}const f=[];for(let d=0,u=a.children.length;d<u;d+=1){const c=a.children[d],p=s(c,h,l);if(p.length)f.push(...p);else if(a.operator===ji.AND)return[]}return f},r=this._myIndex.records,n={},o=[];return r.forEach(({$:a,i:h})=>{if(He(a)){let l=s(i,a,h);l.length&&(n[h]||(n[h]={idx:h,item:a,matches:[]},o.push(n[h])),l.forEach(({matches:f})=>{n[h].matches.push(...f)}))}}),o}_searchObjectList(t){const i=Is(t,this.options),{keys:s,records:r}=this._myIndex,n=[];return r.forEach(({$:o,i:a})=>{if(!He(o))return;let h=[];s.forEach((l,f)=>{h.push(...this._findMatches({key:l,value:o[f],searcher:i}))}),h.length&&n.push({idx:a,item:o,matches:h})}),n}_findMatches({key:t,value:i,searcher:s}){if(!He(i))return[];let r=[];if(ht(i))i.forEach(({v:n,i:o,n:a})=>{if(!He(n))return;const{isMatch:h,score:l,indices:f}=s.searchIn(n);h&&r.push({score:l,key:t,value:n,idx:o,norm:a,indices:f})});else{const{v:n,n:o}=i,{isMatch:a,score:h,indices:l}=s.searchIn(n);a&&r.push({score:h,key:t,value:n,norm:o,indices:l})}return r}}Gt.version="7.1.0";Gt.createIndex=uo;Gt.parseIndex=ch;Gt.config=q;Gt.parseQuery=go;xh(kh);function Ah(e,t,i){const s=()=>{var n,o;return new Gt((n=ot(t))!==null&&n!==void 0?n:[],(o=ot(i))===null||o===void 0?void 0:o.fuseOptions)},r=X(s());return ke(()=>{var n;return(n=ot(i))===null||n===void 0?void 0:n.fuseOptions},()=>{r.value=s()},{deep:!0}),ke(()=>ot(t),n=>{r.value.setCollection(n)},{deep:!0}),{fuse:r,results:Z(()=>{const n=ot(i);if(n?.matchAllWhenSearchEmpty&&!ot(e))return ot(t).map((a,h)=>({item:a,refIndex:h}));const o=n?.resultLimit;return r.value.search(ot(e),o?{limit:o}:void 0)})}}function Th(e,t){let i="",s=0,r=!1;for(let n=e.length-1;n>=0;n--){if(e[n]===">")r=!0;else if(e[n]==="<"){r=!1,i=e[n]+i;continue}if(r||s++,s<=t)i=e[n]+i;else{i="..."+i;break}}return i}function Vr(e,t,i,s){function r(n,o=[]){n=n||"";let a="",h=0;o.forEach(f=>{if(f.length===2&&f[0]===f[1])return;const d=f[1]+1,u=d-f[0]>=t.length;a+=[n.substring(h,f[0]),u&&"<mark>",n.substring(f[0],d),u&&"</mark>"].filter(Boolean).join(""),h=d}),a+=n.substring(h);const l=a.indexOf("<mark>");return l!==-1&&(a=Th(a,a.length-l)),a}if(e.matches?.length){for(const n of e.matches)if(!(i&&n.key!==i)&&!s?.includes(n.key))return r(n.value,n.indices)}}const Ih={slots:{root:"flex flex-col min-h-0 min-w-0 divide-y divide-default",input:"[&>input]:h-12",close:"",back:"p-0",content:"relative overflow-hidden flex flex-col",footer:"p-1",viewport:"relative scroll-py-1 overflow-y-auto flex-1 focus:outline-none",group:"p-1 isolate",empty:"py-6 text-center text-sm text-muted",label:"p-1.5 text-xs font-semibold text-highlighted",item:"group relative w-full flex items-start gap-1.5 p-1.5 text-sm select-none outline-none before:absolute before:z-[-1] before:inset-px before:rounded-md data-disabled:cursor-not-allowed data-disabled:opacity-75",itemLeadingIcon:"shrink-0 size-5",itemLeadingAvatar:"shrink-0",itemLeadingAvatarSize:"2xs",itemLeadingChip:"shrink-0 size-5",itemLeadingChipSize:"md",itemTrailing:"ms-auto inline-flex gap-1.5 items-center",itemTrailingIcon:"shrink-0 size-5",itemTrailingHighlightedIcon:"shrink-0 size-5 text-dimmed hidden group-data-highlighted:inline-flex",itemTrailingKbds:"hidden lg:inline-flex items-center shrink-0 gap-0.5",itemTrailingKbdsSize:"md",itemWrapper:"flex-1 flex flex-col text-start min-w-0",itemLabel:"truncate space-x-1 text-dimmed",itemDescription:"truncate text-muted",itemLabelBase:"text-highlighted [&>mark]:text-inverted [&>mark]:bg-primary",itemLabelPrefix:"text-default",itemLabelSuffix:"text-dimmed [&>mark]:text-inverted [&>mark]:bg-primary"},variants:{virtualize:{true:{viewport:"p-1 isolate"},false:{viewport:"divide-y divide-default"}},active:{true:{item:"text-highlighted before:bg-elevated",itemLeadingIcon:"text-default"},false:{item:["text-default data-highlighted:not-data-disabled:text-highlighted data-highlighted:not-data-disabled:before:bg-elevated/50","transition-colors before:transition-colors"],itemLeadingIcon:["text-dimmed group-data-highlighted:not-group-data-disabled:text-default","transition-colors"]}},loading:{true:{itemLeadingIcon:"animate-spin"}}}},Ph=["innerHTML"],Oh=["innerHTML"],Nh=Object.assign({inheritAttrs:!1},{__name:"UCommandPalette",props:Ui({as:{type:null,required:!1},icon:{type:null,required:!1},trailingIcon:{type:null,required:!1},selectedIcon:{type:null,required:!1},childrenIcon:{type:null,required:!1},placeholder:{type:String,required:!1},autofocus:{type:Boolean,required:!1,default:!0},close:{type:[Boolean,Object],required:!1},closeIcon:{type:null,required:!1},back:{type:[Boolean,Object],required:!1,default:!0},backIcon:{type:null,required:!1},groups:{type:Array,required:!1},fuse:{type:Object,required:!1},virtualize:{type:[Boolean,Object],required:!1,default:!1},labelKey:{type:null,required:!1,default:"label"},descriptionKey:{type:null,required:!1,default:"description"},preserveGroupOrder:{type:Boolean,required:!1,default:!1},class:{type:null,required:!1},ui:{type:null,required:!1},multiple:{type:Boolean,required:!1},disabled:{type:Boolean,required:!1},modelValue:{type:null,required:!1,default:""},defaultValue:{type:null,required:!1},highlightOnHover:{type:Boolean,required:!1,default:!0},selectionBehavior:{type:String,required:!1},loading:{type:Boolean,required:!1},loadingIcon:{type:null,required:!1}},{searchTerm:{type:String,default:""},searchTermModifiers:{}}),emits:Ui(["update:modelValue","highlight","entryFocus","leave","update:open"],["update:searchTerm"]),setup(e,{emit:t}){const i=e,s=t,r=Yt(),n=di(e,"searchTerm",{type:String,default:""}),{t:o}=ts(),a=Nt(),h=ui(It(i,"as","disabled","multiple","modelValue","defaultValue","highlightOnHover"),s),l=qi(It(i,"loading")),f=et(()=>i.virtualize?kt(typeof i.virtualize=="boolean"?{}:i.virtualize,{estimateSize:rl(x.value,"md",i.descriptionKey)}):!1),[d,u]=Vt({props:{item:{type:Object,required:!0},group:{type:Object,required:!1},index:{type:Number,required:!1}}}),c=Z(()=>Oe({extend:Oe(Ih),...a.ui?.commandPalette||{}})({virtualize:!!i.virtualize})),p=Z(()=>kt({},i.fuse,{fuseOptions:{ignoreLocation:!0,threshold:.1,keys:[i.labelKey,"suffix"]},resultLimit:12,matchAllWhenSearchEmpty:!0})),_=X([]),S=Z(()=>_.value[_.value.length-1]?.placeholder||i.placeholder||o("commandPalette.placeholder")),w=Z(()=>_.value?.length?[_.value[_.value.length-1]]:i.groups),y=Z(()=>w.value?.filter(b=>b.id?!b.ignoreFilter:(console.warn("[@nuxt/ui] CommandPalette group is missing an `id` property"),!1))?.flatMap(b=>b.items?.map(R=>({...R,group:b.id}))||[])||[]),{results:k}=Ah(n,y,p),g=ya(k,16,!0);function C(b,R){let m=R;return b?.postFilter&&typeof b.postFilter=="function"&&(m=b.postFilter(n.value,m)),{...b,items:m.slice(0,p.value.resultLimit).map(O=>({...O,labelHtml:Vr(O,n.value,i.labelKey),suffixHtml:Vr(O,n.value,void 0,[i.labelKey])}))}}const L=Z(()=>{const b=w.value,R=g.value.reduce((M,D)=>{const{item:ee,matches:ie}=D;return ee.group&&(M[ee.group]||=[],M[ee.group]?.push({...ee,matches:ie})),M},{});if(i.preserveGroupOrder){const M=[];for(const D of b||[]){if(!D.items?.length)continue;const ee=D.ignoreFilter?D.items:R[D.id];if(!ee?.length)continue;const ie=C(D,ee);ie.items?.length&&M.push(ie)}return M}const m=Object.entries(R).map(([M,D])=>{const ee=b?.find(Ae=>Ae.id===M);if(!ee)return;const ie=C(ee,D);return ie.items?.length?ie:void 0}).filter(M=>!!M);return(b?.map((M,D)=>({...M,index:D}))?.filter(M=>M.ignoreFilter&&M.items?.length)?.map(M=>({...C(M,M.items||[]),index:M.index}))?.filter(M=>M.items?.length)||[]).reduce((M,D)=>(M.splice(D.index,0,D),M),[...m])}),x=Z(()=>L.value.flatMap(b=>b.items||[])),$=Xn("rootRef");function H(b){b.children?.length&&(_.value.push({id:`history-${_.value.length}`,label:b.label,slot:b.slot,placeholder:b.placeholder,items:b.children}),n.value="",$.value?.highlightFirstItem())}function G(){_.value.length&&(_.value.pop(),n.value="",$.value?.highlightFirstItem())}function V(){n.value||G()}function I(b,R){R.children?.length?(b.preventDefault(),H(R)):R.onSelect?.(b)}return(b,R)=>(B(),U(Ce,null,[P(v(d),null,{default:A(({item:m,index:O,group:M})=>[P(v(Xa),{value:v(Ki)(m,["matches","group","onSelect","labelHtml","suffixHtml","children"]),disabled:m.disabled,"as-child":"",onSelect:D=>I(D,m)},{default:A(()=>[P(Ai,Y(v(Ti)(m),{custom:""}),{default:A(({active:D,...ee})=>[P(Wt,Y(ee,{"data-slot":"item",class:c.value.item({class:[i.ui?.item,m.ui?.item,m.class],active:D||m.active})}),{default:A(()=>[j(b.$slots,m.slot||M?.slot||"item",{item:m,index:O,ui:c.value},()=>[j(b.$slots,m.slot?`${m.slot}-leading`:M?.slot?`${M.slot}-leading`:"item-leading",{item:m,index:O,ui:c.value},()=>[m.loading?(B(),z(me,{key:0,name:e.loadingIcon||v(a).ui.icons.loading,"data-slot":"itemLeadingIcon",class:F(c.value.itemLeadingIcon({class:[i.ui?.itemLeadingIcon,m.ui?.itemLeadingIcon],loading:!0}))},null,8,["name","class"])):m.icon?(B(),z(me,{key:1,name:m.icon,"data-slot":"itemLeadingIcon",class:F(c.value.itemLeadingIcon({class:[i.ui?.itemLeadingIcon,m.ui?.itemLeadingIcon],active:D||m.active}))},null,8,["name","class"])):m.avatar?(B(),z(wr,Y({key:2,size:m.ui?.itemLeadingAvatarSize||i.ui?.itemLeadingAvatarSize||c.value.itemLeadingAvatarSize()},m.avatar,{"data-slot":"itemLeadingAvatar",class:c.value.itemLeadingAvatar({class:[i.ui?.itemLeadingAvatar,m.ui?.itemLeadingAvatar],active:D||m.active})}),null,16,["size","class"])):m.chip?(B(),z(wa,Y({key:3,size:m.ui?.itemLeadingChipSize||i.ui?.itemLeadingChipSize||c.value.itemLeadingChipSize(),inset:"",standalone:""},m.chip,{"data-slot":"itemLeadingChip",class:c.value.itemLeadingChip({class:[i.ui?.itemLeadingChip,m.ui?.itemLeadingChip],active:D||m.active})}),null,16,["size","class"])):W("",!0)]),m.prefix||m.labelHtml||v(Pe)(m,i.labelKey)||m.suffixHtml||m.suffix||r[m.slot?`${m.slot}-label`:M?.slot?`${M.slot}-label`:"item-label"]||v(Pe)(m,i.descriptionKey)||r[m.slot?`${m.slot}-description`:M?.slot?`${M.slot}-description`:"item-description"]?(B(),U("span",{key:0,"data-slot":"itemWrapper",class:F(c.value.itemWrapper({class:[i.ui?.itemWrapper,m.ui?.itemWrapper]}))},[te("span",{"data-slot":"itemLabel",class:F(c.value.itemLabel({class:[i.ui?.itemLabel,m.ui?.itemLabel],active:D||m.active}))},[j(b.$slots,m.slot?`${m.slot}-label`:M?.slot?`${M.slot}-label`:"item-label",{item:m,index:O,ui:c.value},()=>[m.prefix?(B(),U("span",{key:0,"data-slot":"itemLabelPrefix",class:F(c.value.itemLabelPrefix({class:[i.ui?.itemLabelPrefix,m.ui?.itemLabelPrefix]}))},Be(m.prefix),3)):W("",!0),m.labelHtml?(B(),U("span",{key:1,"data-slot":"itemLabelBase",class:F(c.value.itemLabelBase({class:[i.ui?.itemLabelBase,m.ui?.itemLabelBase],active:D||m.active})),innerHTML:m.labelHtml},null,10,Ph)):(B(),U("span",{key:2,"data-slot":"itemLabelBase",class:F(c.value.itemLabelBase({class:[i.ui?.itemLabelBase,m.ui?.itemLabelBase],active:D||m.active}))},Be(v(Pe)(m,i.labelKey)),3)),m.suffixHtml?(B(),U("span",{key:3,"data-slot":"itemLabelSuffix",class:F(c.value.itemLabelSuffix({class:[i.ui?.itemLabelSuffix,m.ui?.itemLabelSuffix],active:D||m.active})),innerHTML:m.suffixHtml},null,10,Oh)):m.suffix?(B(),U("span",{key:4,"data-slot":"itemLabelSuffix",class:F(c.value.itemLabelSuffix({class:[i.ui?.itemLabelSuffix,m.ui?.itemLabelSuffix],active:D||m.active}))},Be(m.suffix),3)):W("",!0)])],2),v(Pe)(m,i.descriptionKey)?(B(),U("span",{key:0,"data-slot":"itemDescription",class:F(c.value.itemDescription({class:[i.ui?.itemDescription,m.ui?.itemDescription]}))},[j(b.$slots,m.slot?`${m.slot}-description`:M?.slot?`${M.slot}-description`:"item-description",{item:m,index:O,ui:c.value},()=>[tt(Be(v(Pe)(m,i.descriptionKey)),1)])],2)):W("",!0)],2)):W("",!0),te("span",{"data-slot":"itemTrailing",class:F(c.value.itemTrailing({class:[i.ui?.itemTrailing,m.ui?.itemTrailing]}))},[j(b.$slots,m.slot?`${m.slot}-trailing`:M?.slot?`${M.slot}-trailing`:"item-trailing",{item:m,index:O,ui:c.value},()=>[m.children&&m.children.length>0?(B(),z(me,{key:0,name:e.childrenIcon||v(a).ui.icons.chevronRight,"data-slot":"itemTrailingIcon",class:F(c.value.itemTrailingIcon({class:[i.ui?.itemTrailingIcon,m.ui?.itemTrailingIcon]}))},null,8,["name","class"])):m.kbds?.length?(B(),U("span",{key:1,"data-slot":"itemTrailingKbds",class:F(c.value.itemTrailingKbds({class:[i.ui?.itemTrailingKbds,m.ui?.itemTrailingKbds]}))},[(B(!0),U(Ce,null,Ue(m.kbds,(ie,Ae)=>(B(),z(Cr,Y({key:Ae,size:m.ui?.itemTrailingKbdsSize||i.ui?.itemTrailingKbdsSize||c.value.itemTrailingKbdsSize()},{ref_for:!0},typeof ie=="string"?{value:ie}:ie),null,16,["size"]))),128))],2)):M?.highlightedIcon?(B(),z(me,{key:2,name:M.highlightedIcon,"data-slot":"itemTrailingHighlightedIcon",class:F(c.value.itemTrailingHighlightedIcon({class:[i.ui?.itemTrailingHighlightedIcon,m.ui?.itemTrailingHighlightedIcon]}))},null,8,["name","class"])):W("",!0)]),m.children?.length?W("",!0):(B(),z(v(Ja),{key:0,"as-child":""},{default:A(()=>[P(me,{name:e.selectedIcon||v(a).ui.icons.check,"data-slot":"itemTrailingIcon",class:F(c.value.itemTrailingIcon({class:[i.ui?.itemTrailingIcon,m.ui?.itemTrailingIcon]}))},null,8,["name","class"])]),_:2},1024))],2)])]),_:2},1040,["class"])]),_:2},1040)]),_:2},1032,["value","disabled","onSelect"])]),_:3}),P(v(il),Y({...v(h),...b.$attrs},{ref_key:"rootRef",ref:$,"selection-behavior":e.selectionBehavior,"data-slot":"root",class:c.value.root({class:[i.ui?.root,i.class]})}),{default:A(()=>[P(v(Za),{modelValue:n.value,"onUpdate:modelValue":R[1]||(R[1]=m=>n.value=m),"as-child":""},{default:A(()=>[P(nl,Y({placeholder:S.value,variant:"none",autofocus:e.autofocus},v(l),{"loading-icon":e.loadingIcon,"trailing-icon":e.trailingIcon,icon:e.icon||v(a).ui.icons.search,"data-slot":"input",class:c.value.input({class:i.ui?.input}),onKeydown:Un(V,["backspace"])}),is({_:2},[_.value?.length&&(e.back||r.back)?{name:"leading",fn:A(()=>[j(b.$slots,"back",{ui:c.value},()=>[P(xt,Y({icon:e.backIcon||v(a).ui.icons.arrowLeft,color:"neutral",variant:"link","aria-label":v(o)("commandPalette.back")},typeof e.back=="object"?e.back:{},{"data-slot":"back",class:c.value.back({class:i.ui?.back}),onClick:G}),null,16,["icon","aria-label","class"])])]),key:"0"}:void 0,e.close||r.close?{name:"trailing",fn:A(()=>[j(b.$slots,"close",{ui:c.value},()=>[e.close?(B(),z(xt,Y({key:0,icon:e.closeIcon||v(a).ui.icons.close,color:"neutral",variant:"ghost","aria-label":v(o)("commandPalette.close")},typeof e.close=="object"?e.close:{},{"data-slot":"close",class:c.value.close({class:i.ui?.close}),onClick:R[0]||(R[0]=m=>s("update:open",!1))}),null,16,["icon","aria-label","class"])):W("",!0)])]),key:"1"}:void 0]),1040,["placeholder","autofocus","loading-icon","trailing-icon","icon","class"])]),_:3},8,["modelValue"]),P(v(Qa),{"data-slot":"content",class:F(c.value.content({class:i.ui?.content}))},{default:A(()=>[L.value?.length?(B(),U("div",{key:0,role:"presentation","data-slot":"viewport",class:F(c.value.viewport({class:i.ui?.viewport}))},[e.virtualize?(B(),z(v(el),Y({key:0,options:x.value,"text-content":m=>v(Pe)(m,i.labelKey)},f.value),{default:A(({option:m,virtualItem:O})=>[P(v(u),{item:m,index:O.index},null,8,["item","index"])]),_:1},16,["options","text-content"])):(B(!0),U(Ce,{key:1},Ue(L.value,m=>(B(),z(v(tl),{key:`group-${m.id}`,"data-slot":"group",class:F(c.value.group({class:i.ui?.group}))},{default:A(()=>[v(Pe)(m,i.labelKey)?(B(),z(v(pl),{key:0,"data-slot":"label",class:F(c.value.label({class:i.ui?.label}))},{default:A(()=>[tt(Be(v(Pe)(m,i.labelKey)),1)]),_:2},1032,["class"])):W("",!0),(B(!0),U(Ce,null,Ue(m.items,(O,M)=>(B(),z(v(u),{key:`group-${m.id}-${M}`,item:O,index:M,group:m},null,8,["item","index","group"]))),128))]),_:2},1032,["class"]))),128))],2)):(B(),U("div",{key:1,"data-slot":"empty",class:F(c.value.empty({class:i.ui?.empty}))},[j(b.$slots,"empty",{searchTerm:n.value},()=>[tt(Be(n.value?v(o)("commandPalette.noMatch",{searchTerm:n.value}):v(o)("commandPalette.noData")),1)])],2))]),_:3},8,["class"]),r.footer?(B(),U("div",{key:0,"data-slot":"footer",class:F(c.value.footer({class:i.ui?.footer}))},[j(b.$slots,"footer",{ui:c.value})],2)):W("",!0)]),_:3},16,["selection-behavior","class"])],64))}}),zh={slots:{modal:"",input:"[&>input]:text-base/5"},variants:{fullscreen:{false:{modal:"sm:max-w-3xl h-full sm:h-[28rem]"}}}},Fh=/^[^-]+.*-.*[^-]+$/,Hh=/^[^_]+.*_.*[^_]+$/,jr=["arrowleft","arrowright","arrowup","arrowright","tab","escape","enter","backspace"];function ps(e){return/^[a-z]$/i.test(e)?`Key${e.toUpperCase()}`:/^\d$/.test(e)?`Digit${e}`:/^f\d+$/i.test(e)?e.toUpperCase():{space:"Space",enter:"Enter",escape:"Escape",tab:"Tab",backspace:"Backspace",delete:"Delete",arrowup:"ArrowUp",arrowdown:"ArrowDown",arrowleft:"ArrowLeft",arrowright:"ArrowRight"}[e.toLowerCase()]||e}function $h(e,t={}){const i=X([]),s=()=>{i.value.splice(0,i.value.length)},r=Ca(s,t.chainDelay??800),{macOS:n}=Na(),o=Ra(),a=t.layoutIndependent??!1,h=jr.map(u=>ps(u)),l=u=>{if(!u.key)return;const c=a?/^Key[A-Z]$/i.test(u.code):/^[a-z]{1}$/i.test(u.key),p=a?h.includes(u.code):jr.includes(u.key.toLowerCase());let _;if(i.value.push(a?u.code:u.key),i.value.length>=2){_=i.value.slice(-2).join("-");for(const S of d.value.filter(w=>w.chained))if(S.key===_){S.enabled&&(u.preventDefault(),S.handler(u)),s();return}}for(const S of d.value.filter(w=>!w.chained)){if(a){if(u.code!==S.key)continue}else if(u.key.toLowerCase()!==S.key)continue;if(u.metaKey===S.metaKey&&u.ctrlKey===S.ctrlKey&&!((c||p)&&u.shiftKey!==S.shiftKey)){S.enabled&&(u.preventDefault(),S.handler(u)),s();return}}r()},f=Z(()=>{const u=o.value?.tagName,c=o.value?.contentEditable;return u==="INPUT"||u==="TEXTAREA"||c==="true"||c==="plaintext-only"?o.value?.name||!0:!1}),d=Z(()=>Object.entries(ot(e)).map(([u,c])=>{if(!c)return null;let p;u.includes("-")&&u!=="-"&&!u.includes("_")&&!u.match(Fh)?.length&&console.trace(`[Shortcut] Invalid key: "${u}"`),u.includes("_")&&u!=="_"&&!u.match(Hh)?.length&&console.trace(`[Shortcut] Invalid key: "${u}"`);const _=u.includes("-")&&u!=="-"&&!u.includes("_");if(_)a?p={key:u.split("-").map(y=>ps(y)).join("-"),metaKey:!1,ctrlKey:!1,shiftKey:!1,altKey:!1}:p={key:u.toLowerCase(),metaKey:!1,ctrlKey:!1,shiftKey:!1,altKey:!1};else{const w=u.toLowerCase().split("_").map(k=>k);let y=w.filter(k=>!["meta","command","ctrl","shift","alt","option"].includes(k)).join("_");a&&(y=ps(y)),p={key:y,metaKey:w.includes("meta")||w.includes("command"),ctrlKey:w.includes("ctrl"),shiftKey:w.includes("shift"),altKey:w.includes("alt")||w.includes("option")}}if(p.chained=_,!n.value&&p.metaKey&&!p.ctrlKey&&(p.metaKey=!1,p.ctrlKey=!0),typeof c=="function"?p.handler=c:typeof c=="object"&&(p={...p,handler:c.handler}),!p.handler)return console.trace("[Shortcut] Invalid value"),null;let S=!0;return c.usingInput?typeof c.usingInput=="string"&&(S=f.value===c.usingInput):S=!f.value,p.enabled=S,p}).filter(Boolean));return Aa("keydown",l)}const Wh={__name:"UDashboardSearch",props:Ui({icon:{type:null,required:!1},placeholder:{type:String,required:!1},autofocus:{type:Boolean,required:!1},loading:{type:Boolean,required:!1},loadingIcon:{type:null,required:!1},close:{type:[Boolean,Object],required:!1,default:!0},closeIcon:{type:null,required:!1},shortcut:{type:String,required:!1,default:"meta_k"},groups:{type:Array,required:!1},fuse:{type:Object,required:!1},colorMode:{type:Boolean,required:!1,default:!0},class:{type:null,required:!1},ui:{type:void 0,required:!1},title:{type:String,required:!1},description:{type:String,required:!1},overlay:{type:Boolean,required:!1},transition:{type:Boolean,required:!1},content:{type:Object,required:!1},dismissible:{type:Boolean,required:!1},fullscreen:{type:Boolean,required:!1,default:!1},modal:{type:Boolean,required:!1},portal:{type:[Boolean,String],required:!1,skipCheck:!0}},{open:{type:Boolean,default:!1},openModifiers:{},searchTerm:{type:String,default:""},searchTermModifiers:{}}),emits:["update:open","update:searchTerm"],setup(e,{expose:t}){const i=e,s=Yt(),r=di(e,"open",{type:Boolean,default:!1}),n=di(e,"searchTerm",{type:String,default:""});Ms("dashboard:search:toggle",()=>{r.value=!r.value});const{t:o}=ts(),a=ka(),h=Nt(),l=qi(It(i,"icon","placeholder","autofocus","loading","loadingIcon","close","closeIcon")),f=qi(It(i,"overlay","transition","content","dismissible","fullscreen","modal","portal")),d=()=>Ki(s,["content"]),u=Z(()=>kt({},i.fuse,{fuseOptions:{}})),c=Z(()=>Oe({extend:Oe(zh),...h.ui?.dashboardSearch||{}})({fullscreen:i.fullscreen})),p=Z(()=>{const w=[];return w.push(...i.groups||[]),i.colorMode&&!a?.forced&&w.push({id:"theme",label:o("dashboardSearch.theme"),items:[{label:o("colorMode.system"),icon:h.ui.icons.system,active:a.preference==="system",onSelect:()=>{a.preference="system"}},{label:o("colorMode.light"),icon:h.ui.icons.light,active:a.preference==="light",onSelect:()=>{a.preference="light"}},{label:o("colorMode.dark"),icon:h.ui.icons.dark,active:a.preference==="dark",onSelect:()=>{a.preference="dark"}}]}),w}),_=Xn("commandPaletteRef");function S(w){w.disabled||(r.value=!1,n.value="")}return $h({[i.shortcut]:{usingInput:!0,handler:()=>r.value=!r.value}}),t({commandPaletteRef:_}),(w,y)=>(B(),z(kr,Y({open:r.value,"onUpdate:open":y[2]||(y[2]=k=>r.value=k),title:e.title||v(o)("dashboardSearch.title"),description:e.description||v(o)("dashboardSearch.description")},v(f),{"data-slot":"modal",class:c.value.modal({class:[i.ui?.modal,i.class]})}),{content:A(k=>[j(w.$slots,"content",bt(yt(k)),()=>[P(Nh,Y({ref_key:"commandPaletteRef",ref:_,"search-term":n.value,"onUpdate:searchTerm":y[0]||(y[0]=g=>n.value=g)},v(l),{groups:p.value,fuse:u.value,ui:v(Yn)(v(Ki)(c.value,["modal"]),i.ui),"onUpdate:modelValue":S,"onUpdate:open":y[1]||(y[1]=g=>r.value=g)}),is({_:2},[Ue(d(),(g,C)=>({name:C,fn:A(L=>[j(w.$slots,C,bt(yt(L)))])}))]),1040,["search-term","groups","fuse","ui"])])]),_:3},16,["open","title","description","class"]))}},xi={tasks:[],documents:[],agents:[],conversations:[]};function qh(){const e=X(""),t=xa(e,300),i=X(!1),s=X({...xi});ke(t,async n=>{if(!n||n.length<2){s.value={...xi};return}i.value=!0;try{const[o,a,h,l]=await Promise.all([$fetch("/api/tasks",{query:{search:n}}),$fetch("/api/documents",{query:{search:n}}),$fetch("/api/agents",{query:{search:n}}),$fetch("/api/conversations",{query:{search:n}})]);s.value={tasks:o.data.slice(0,5),documents:a.data.slice(0,5),agents:h.data.slice(0,5),conversations:l.data.slice(0,5)}}catch{s.value={...xi}}finally{i.value=!1}});function r(){e.value="",s.value={...xi}}return{searchTerm:e,loading:i,results:s,reset:r}}const Kh=Le({__name:"DashboardSearch",setup(e){const t=Ea(),i=Ba(),{searchTerm:s,loading:r,results:n,reset:o}=qh(),a={todo:"i-lucide-circle",in_progress:"i-lucide-clock",done:"i-lucide-check-circle",blocked:"i-lucide-alert-circle"},h={1:"Low",2:"Medium",3:"High"},l=[{label:"Dashboard",icon:"i-lucide-layout-dashboard",to:"/dashboard",kbds:["G","D"]},{label:"Tasks",icon:"i-lucide-check-square",to:"/tasks",kbds:["G","T"]},{label:"Docs",icon:"i-lucide-file-text",to:"/docs",kbds:["G","O"]},{label:"Settings",icon:"i-lucide-settings",to:"/settings",kbds:["G","S"]}],f=[{label:"Create new document",icon:"i-lucide-file-plus",onSelect:()=>{t.push("/docs"),i.add({title:"Create a document",description:"Right-click in the file tree to create a new file",icon:"i-lucide-info"}),o()}},{label:"Add new task",icon:"i-lucide-plus-square",onSelect:()=>{t.push("/tasks?action=new"),o()}}],d=Z(()=>{const u=[];return n.value.tasks.length&&u.push({id:"tasks",label:"Tasks",ignoreFilter:!0,items:n.value.tasks.map(c=>({label:c.title,icon:a[c.status]||"i-lucide-circle",suffix:c.project?.name||h[c.priority]||"",onSelect:()=>{t.push(`/tasks?selected=${c.id}`),o()}}))}),n.value.documents.length&&u.push({id:"documents",label:"Documents",ignoreFilter:!0,items:n.value.documents.map(c=>({label:c.title,icon:"i-lucide-file-text",suffix:c.path,onSelect:()=>{t.push(`/docs?path=${encodeURIComponent(c.path)}`),o()}}))}),n.value.agents.length&&u.push({id:"agents",label:"Agents",ignoreFilter:!0,items:n.value.agents.map(c=>({label:c.name,icon:c.enabled?"i-lucide-bot":"i-lucide-bot-off",suffix:c.schedule,onSelect:()=>{t.push(`/agents/${c.id}`),o()}}))}),n.value.conversations.length&&u.push({id:"conversations",label:"Conversations",ignoreFilter:!0,items:n.value.conversations.map(c=>({label:c.title||"Untitled chat",icon:"i-lucide-message-square",suffix:ol(c.startedAt),onSelect:()=>{t.push({path:"/chat",query:{conversation:c.id}}),o()}}))}),u.push({id:"navigation",label:"Navigation",items:l}),u.push({id:"actions",label:"Actions",items:f,postFilter:(c,p)=>{if(!c)return p;const _=c.toLowerCase();return["new","create","add"].some(S=>_.includes(S))?p:[]}}),u});return(u,c)=>{const p=Wh;return B(),z(p,{"search-term":v(s),"onUpdate:searchTerm":c[0]||(c[0]=_=>vi(s)?s.value=_:null),groups:v(d),loading:v(r),placeholder:"Search tasks, docs, agents, chats...",fuse:{resultLimit:10}},null,8,["search-term","groups","loading"])}}}),Uh=Object.assign(Kh,{__name:"SearchDashboardSearch"}),Vh={class:"flex flex-col flex-1 min-h-0"},jh={class:"flex items-center gap-2 px-3 py-2 border-b border-default"},Yh={key:0,class:"absolute inset-0 flex items-center justify-center bg-elevated/80 z-10"},Gh={key:1,class:"flex flex-col items-center justify-center h-full text-dimmed"},Xh=Le({__name:"AssistantChat",props:{active:{type:Boolean}},setup(e,{expose:t}){const i=e,{assistantLastConversationId:s}=ss(),{connectionStatus:r,sessionStatus:n,activeConversationId:o,messages:a,conversations:h,streamingText:l,streamingToolCalls:f,loading:d,connect:u,sendMessage:c,interrupt:p,startNewConversation:_,loadConversation:S,loadConversations:w}=so(),y=X(null),k=Z(()=>h.value.map(H=>({label:H.title||`Chat ${new Date(H.startedAt).toLocaleDateString()}`,value:H.id}))),g=X(s.value??void 0);ke(g,H=>{s.value=H??null,H&&H!==o.value&&S(H)}),ke(o,H=>{H&&(g.value=H)});function C(H){c(H),Ut(x)}function L(){_(),g.value=void 0}function x(){y.value&&(y.value.scrollTop=y.value.scrollHeight)}ke(l,()=>Ut(x)),ke(()=>a.value.length,()=>Ut(x));function $(){u(),w(),s.value&&!o.value&&S(s.value)}return ke(()=>i.active,H=>{H&&$()},{immediate:!0}),t({connectionStatus:r}),(H,G)=>{const V=sl,I=xt,b=me,R=hl,m=cl,O=ll;return B(),U("div",Vh,[te("div",jh,[P(V,{modelValue:v(g),"onUpdate:modelValue":G[0]||(G[0]=M=>vi(g)?g.value=M:null),items:v(k),"value-key":"value",placeholder:"New conversation",size:"xs",class:"flex-1",icon:"i-lucide-messages-square"},null,8,["modelValue","items"]),P(I,{icon:"i-lucide-plus",size:"xs",color:"primary",variant:"soft",onClick:L})]),te("div",{ref_key:"messagesContainer",ref:y,class:"relative flex-1 overflow-y-auto p-3 space-y-3"},[v(d)?(B(),U("div",Yh,[P(b,{name:"i-lucide-loader-2",class:"size-6 animate-spin text-primary"})])):W("",!0),v(a).length===0&&v(n)!=="streaming"&&!v(d)?(B(),U("div",Gh,[P(b,{name:"i-lucide-message-square",class:"size-8 mb-2"}),G[1]||(G[1]=te("p",{class:"text-sm"}," Send a message to start chatting ",-1))])):W("",!0),(B(!0),U(Ce,null,Ue(v(a),M=>(B(),z(R,{key:M.id,message:M},null,8,["message"]))),128)),v(n)==="streaming"?(B(),z(m,{key:2,text:v(l),"tool-calls":v(f)},null,8,["text","tool-calls"])):W("",!0)],512),P(O,{"session-status":v(n),"connection-status":v(r),onSend:C,onInterrupt:v(p)},null,8,["session-status","connection-status","onInterrupt"])])}}}),Jh=Object.assign(Xh,{__name:"AssistantChat"});var vo=Object.defineProperty,Zh=Object.getOwnPropertyDescriptor,Qh=(e,t)=>{for(var i in t)vo(e,i,{get:t[i],enumerable:!0})},ce=(e,t,i,s)=>{for(var r=s>1?void 0:s?Zh(t,i):t,n=e.length-1,o;n>=0;n--)(o=e[n])&&(r=(s?o(t,i,r):o(r))||r);return s&&r&&vo(t,i,r),r},N=(e,t)=>(i,s)=>t(i,s,e),Yr="Terminal input",Ns={get:()=>Yr,set:e=>Yr=e},Gr="Too much output to announce, navigate to rows manually to read",zs={get:()=>Gr,set:e=>Gr=e};function ec(e){return e.replace(/\r?\n/g,"\r")}function tc(e,t){return t?"\x1B[200~"+e+"\x1B[201~":e}function ic(e,t){e.clipboardData&&e.clipboardData.setData("text/plain",t.selectionText),e.preventDefault()}function sc(e,t,i,s){if(e.stopPropagation(),e.clipboardData){let r=e.clipboardData.getData("text/plain");mo(r,t,i,s)}}function mo(e,t,i,s){e=ec(e),e=tc(e,i.decPrivateModes.bracketedPasteMode&&s.rawOptions.ignoreBracketedPasteMode!==!0),i.triggerDataEvent(e,!0),t.value=""}function So(e,t,i){let s=i.getBoundingClientRect(),r=e.clientX-s.left-10,n=e.clientY-s.top-10;t.style.width="20px",t.style.height="20px",t.style.left=`${r}px`,t.style.top=`${n}px`,t.style.zIndex="1000",t.focus()}function Xr(e,t,i,s,r){So(e,t,i),r&&s.rightClickSelect(e),t.value=s.selectionText,t.select()}function St(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function ns(e,t=0,i=e.length){let s="";for(let r=t;r<i;++r){let n=e[r];n>65535?(n-=65536,s+=String.fromCharCode((n>>10)+55296)+String.fromCharCode(n%1024+56320)):s+=String.fromCharCode(n)}return s}var rc=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){let i=e.length;if(!i)return 0;let s=0,r=0;if(this._interim){let n=e.charCodeAt(r++);56320<=n&&n<=57343?t[s++]=(this._interim-55296)*1024+n-56320+65536:(t[s++]=this._interim,t[s++]=n),this._interim=0}for(let n=r;n<i;++n){let o=e.charCodeAt(n);if(55296<=o&&o<=56319){if(++n>=i)return this._interim=o,s;let a=e.charCodeAt(n);56320<=a&&a<=57343?t[s++]=(o-55296)*1024+a-56320+65536:(t[s++]=o,t[s++]=a);continue}o!==65279&&(t[s++]=o)}return s}},nc=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){let i=e.length;if(!i)return 0;let s=0,r,n,o,a,h=0,l=0;if(this.interim[0]){let u=!1,c=this.interim[0];c&=(c&224)===192?31:(c&240)===224?15:7;let p=0,_;for(;(_=this.interim[++p]&63)&&p<4;)c<<=6,c|=_;let S=(this.interim[0]&224)===192?2:(this.interim[0]&240)===224?3:4,w=S-p;for(;l<w;){if(l>=i)return 0;if(_=e[l++],(_&192)!==128){l--,u=!0;break}else this.interim[p++]=_,c<<=6,c|=_&63}u||(S===2?c<128?l--:t[s++]=c:S===3?c<2048||c>=55296&&c<=57343||c===65279||(t[s++]=c):c<65536||c>1114111||(t[s++]=c)),this.interim.fill(0)}let f=i-4,d=l;for(;d<i;){for(;d<f&&!((r=e[d])&128)&&!((n=e[d+1])&128)&&!((o=e[d+2])&128)&&!((a=e[d+3])&128);)t[s++]=r,t[s++]=n,t[s++]=o,t[s++]=a,d+=4;if(r=e[d++],r<128)t[s++]=r;else if((r&224)===192){if(d>=i)return this.interim[0]=r,s;if(n=e[d++],(n&192)!==128){d--;continue}if(h=(r&31)<<6|n&63,h<128){d--;continue}t[s++]=h}else if((r&240)===224){if(d>=i)return this.interim[0]=r,s;if(n=e[d++],(n&192)!==128){d--;continue}if(d>=i)return this.interim[0]=r,this.interim[1]=n,s;if(o=e[d++],(o&192)!==128){d--;continue}if(h=(r&15)<<12|(n&63)<<6|o&63,h<2048||h>=55296&&h<=57343||h===65279)continue;t[s++]=h}else if((r&248)===240){if(d>=i)return this.interim[0]=r,s;if(n=e[d++],(n&192)!==128){d--;continue}if(d>=i)return this.interim[0]=r,this.interim[1]=n,s;if(o=e[d++],(o&192)!==128){d--;continue}if(d>=i)return this.interim[0]=r,this.interim[1]=n,this.interim[2]=o,s;if(a=e[d++],(a&192)!==128){d--;continue}if(h=(r&7)<<18|(n&63)<<12|(o&63)<<6|a&63,h<65536||h>1114111)continue;t[s++]=h}}return s}},bo="",wt=" ",mi=class yo{constructor(){this.fg=0,this.bg=0,this.extended=new Yi}static toColorRGB(t){return[t>>>16&255,t>>>8&255,t&255]}static fromColorRGB(t){return(t[0]&255)<<16|(t[1]&255)<<8|t[2]&255}clone(){let t=new yo;return t.fg=this.fg,t.bg=this.bg,t.extended=this.extended.clone(),t}isInverse(){return this.fg&67108864}isBold(){return this.fg&134217728}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:this.fg&268435456}isBlink(){return this.fg&536870912}isInvisible(){return this.fg&1073741824}isItalic(){return this.bg&67108864}isDim(){return this.bg&134217728}isStrikethrough(){return this.fg&2147483648}isProtected(){return this.bg&536870912}isOverline(){return this.bg&1073741824}getFgColorMode(){return this.fg&50331648}getBgColorMode(){return this.bg&50331648}isFgRGB(){return(this.fg&50331648)===50331648}isBgRGB(){return(this.bg&50331648)===50331648}isFgPalette(){return(this.fg&50331648)===16777216||(this.fg&50331648)===33554432}isBgPalette(){return(this.bg&50331648)===16777216||(this.bg&50331648)===33554432}isFgDefault(){return(this.fg&50331648)===0}isBgDefault(){return(this.bg&50331648)===0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(this.fg&50331648){case 16777216:case 33554432:return this.fg&255;case 50331648:return this.fg&16777215;default:return-1}}getBgColor(){switch(this.bg&50331648){case 16777216:case 33554432:return this.bg&255;case 50331648:return this.bg&16777215;default:return-1}}hasExtendedAttrs(){return this.bg&268435456}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(this.bg&268435456&&~this.extended.underlineColor)switch(this.extended.underlineColor&50331648){case 16777216:case 33554432:return this.extended.underlineColor&255;case 50331648:return this.extended.underlineColor&16777215;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return this.bg&268435456&&~this.extended.underlineColor?this.extended.underlineColor&50331648:this.getFgColorMode()}isUnderlineColorRGB(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===50331648:this.isFgRGB()}isUnderlineColorPalette(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===16777216||(this.extended.underlineColor&50331648)===33554432:this.isFgPalette()}isUnderlineColorDefault(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===0:this.isFgDefault()}getUnderlineStyle(){return this.fg&268435456?this.bg&268435456?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},Yi=class wo{constructor(t=0,i=0){this._ext=0,this._urlId=0,this._ext=t,this._urlId=i}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(t){this._ext=t}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(t){this._ext&=-469762049,this._ext|=t<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(t){this._ext&=-67108864,this._ext|=t&67108863}get urlId(){return this._urlId}set urlId(t){this._urlId=t}get underlineVariantOffset(){let t=(this._ext&3758096384)>>29;return t<0?t^4294967288:t}set underlineVariantOffset(t){this._ext&=536870911,this._ext|=t<<29&3758096384}clone(){return new wo(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},Ve=class Co extends mi{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new Yi,this.combinedData=""}static fromCharData(t){let i=new Co;return i.setFromCharData(t),i}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?St(this.content&2097151):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(t){this.fg=t[0],this.bg=0;let i=!1;if(t[1].length>2)i=!0;else if(t[1].length===2){let s=t[1].charCodeAt(0);if(55296<=s&&s<=56319){let r=t[1].charCodeAt(1);56320<=r&&r<=57343?this.content=(s-55296)*1024+r-56320+65536|t[2]<<22:i=!0}else i=!0}else this.content=t[1].charCodeAt(0)|t[2]<<22;i&&(this.combinedData=t[1],this.content=2097152|t[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},Jr="di$target",Fs="di$dependencies",gs=new Map;function oc(e){return e[Fs]||[]}function we(e){if(gs.has(e))return gs.get(e);let t=function(i,s,r){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");ac(t,i,r)};return t._id=e,gs.set(e,t),t}function ac(e,t,i){t[Jr]===t?t[Fs].push({id:e,index:i}):(t[Fs]=[{id:e,index:i}],t[Jr]=t)}var Me=we("BufferService"),ko=we("CoreMouseService"),Ft=we("CoreService"),lc=we("CharsetService"),Lr=we("InstantiationService"),xo=we("LogService"),Re=we("OptionsService"),Eo=we("OscLinkService"),hc=we("UnicodeService"),Si=we("DecorationService"),Hs=class{constructor(e,t,i){this._bufferService=e,this._optionsService=t,this._oscLinkService=i}provideLinks(e,t){let i=this._bufferService.buffer.lines.get(e-1);if(!i){t(void 0);return}let s=[],r=this._optionsService.rawOptions.linkHandler,n=new Ve,o=i.getTrimmedLength(),a=-1,h=-1,l=!1;for(let f=0;f<o;f++)if(!(h===-1&&!i.hasContent(f))){if(i.loadCell(f,n),n.hasExtendedAttrs()&&n.extended.urlId)if(h===-1){h=f,a=n.extended.urlId;continue}else l=n.extended.urlId!==a;else h!==-1&&(l=!0);if(l||h!==-1&&f===o-1){let d=this._oscLinkService.getLinkData(a)?.uri;if(d){let u={start:{x:h+1,y:e},end:{x:f+(!l&&f===o-1?1:0),y:e}},c=!1;if(!r?.allowNonHttpProtocols)try{let p=new URL(d);["http:","https:"].includes(p.protocol)||(c=!0)}catch{c=!0}c||s.push({text:d,range:u,activate:(p,_)=>r?r.activate(p,_,u):cc(p,_),hover:(p,_)=>r?.hover?.(p,_,u),leave:(p,_)=>r?.leave?.(p,_,u)})}l=!1,n.hasExtendedAttrs()&&n.extended.urlId?(h=f,a=n.extended.urlId):(h=-1,a=-1)}}t(s)}};Hs=ce([N(0,Me),N(1,Re),N(2,Eo)],Hs);function cc(e,t){if(confirm(`Do you want to navigate to ${t}?
|
|
1
|
+
import{d as Le,c as z,o as B,w as A,r as j,m as Y,a as v,P as st,aQ as qn,aS as aa,e as X,u as ct,a4 as gi,aR as la,a3 as Kn,h as Z,F as br,c4 as ha,Z as P,T as Kt,bm as Un,bF as ca,aA as ui,c5 as ua,bg as yr,a8 as zr,bV as Vn,bB as Wi,aa as W,C as es,M as U,al as Ce,aF as da,a6 as fa,f as ke,B as Ut,O as jn,aK as _a,aq as Yt,X as qi,Y as pa,aD as et,aZ as kt,U as ts,W as Nt,ap as Oe,a0 as xt,a_ as Yn,b9 as is,ac as te,$ as F,am as Ue,ba as Ki,aG as bt,aH as yt,aB as It,aC as ga,aE as va,b8 as ma,az as wr,_ as me,a1 as Pe,ab as tt,af as Be,aY as Ci,ao as Sa,aw as Ai,bb as Ti,bc as Wt,aU as Ui,aV as di,ah as Gn,S as ba,j as ot,c6 as ya,aO as Xn,bW as wa,b0 as Ca,V as ka,c7 as xa,bh as Ea,aj as Ba,ak as vi,a5 as Jn,bJ as us,c8 as ds,c9 as La,ad as Da,n as Ma}from"./CZT64TBr.js";import{c as Vt,g as Ra,h as Aa}from"./DD864DXc.js";import{u as Zn,a as Ta,b as Ia,_ as Pa,p as Oa}from"./CSwU6kaw.js";import{_ as Cr,u as Na}from"./IwZpKn7a.js";import{_ as Qn}from"./B3WWnSJo.js";import{a as eo,_ as za}from"./DfIQdSBL.js";import{b as Fr,A as Fa,c as Ha,d as Hr}from"./DfLpZE5I.js";import{u as $a}from"./D-ysM-Cd.js";import{u as to}from"./DwbYPACo.js";import{u as io}from"./C6Y-ieo6.js";import{_ as Wa}from"./Ctt1B8Lg.js";import{H as qa,P as Ka}from"./2Eo3qwxj.js";import{_ as Ua}from"./FOQllft2.js";import{_ as Va}from"./BISpLSKY.js";import{_ as ja}from"./B2ejvp4F.js";import{_ as kr}from"./C1pt3HyX.js";import{_ as Ya}from"./lheR7PB2.js";import{i as Ga,L as Xa,a as Ja,b as Za,c as Qa,d as el,e as tl,f as il,_ as sl}from"./qEwYRBS3.js";import{g as rl}from"./J00SROjJ.js";import{_ as nl}from"./D5dMt776.js";import{a as ol}from"./B6lDOV4_.js";import{_ as al}from"./KtLDewau.js";import{u as so,b as ll,_ as hl,a as cl}from"./CKcctj3r.js";import{u as ss}from"./BWgA6Icb.js";import{s as ul}from"./BMsNdiuj.js";import{u as dl}from"./qBDqAV_3.js";import{u as fl}from"./DwIL_HsX.js";import"./CJAiAVnY.js";import"./CXWZZrP6.js";import"./tHI-osWJ.js";import"./C6M-e7pT.js";import"./Bl7M4LXt.js";import"./Cv0TenvS.js";import"./BFhzL-L6.js";import"./CfiM4f33.js";import"./DMar0qcv.js";import"./2nDmPuey.js";import"./6f0CtDWh.js";import"./CAANELnI.js";import"./BUa1DKMp.js";import"./CSQciH0m.js";import"./DlOqPmYc.js";import"./T9m6PG7Q.js";import"./BY7b-3vi.js";import"./CjhuD2Kg.js";import"./88opOQSr.js";import"./iik6CYzq.js";import"./dGa7RyJ8.js";import"./KEgU3jLl.js";import"./Vcq4gwWv.js";var _l=Le({__name:"ListboxGroupLabel",props:{for:{type:String,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:"div"}},setup(e){const t=e,i=Ga({id:""});return(s,r)=>(B(),z(v(st),Y(t,{id:v(i).id}),{default:A(()=>[j(s.$slots,"default")]),_:3},16,["id"]))}}),pl=_l;const[zt,gl]=qn(["NavigationMenuRoot","NavigationMenuSub"],"NavigationMenuContext");var vl=Le({__name:"NavigationMenuRoot",props:{modelValue:{type:String,required:!1,default:void 0},defaultValue:{type:String,required:!1},dir:{type:String,required:!1},orientation:{type:String,required:!1,default:"horizontal"},delayDuration:{type:Number,required:!1,default:200},skipDelayDuration:{type:Number,required:!1,default:300},disableClickTrigger:{type:Boolean,required:!1,default:!1},disableHoverTrigger:{type:Boolean,required:!1,default:!1},disablePointerLeaveClose:{type:Boolean,required:!1},unmountOnHide:{type:Boolean,required:!1,default:!0},asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:"nav"}},emits:["update:modelValue"],setup(e,{emit:t}){const i=e,r=aa(i,"modelValue",t,{defaultValue:i.defaultValue??"",passive:i.modelValue===void 0}),n=X(""),{forwardRef:o,currentElement:a}=ct(),h=X(),l=X(),f=X(),{getItems:d,CollectionSlot:u}=gi({key:"NavigationMenu",isProvider:!0}),{delayDuration:c,skipDelayDuration:p,dir:_,disableClickTrigger:S,disableHoverTrigger:w,unmountOnHide:y}=la(i),k=$a(_),g=Kn(!1,p),C=Z(()=>r.value!==""||g.value?150:c.value),L=ha(x=>{typeof x=="string"&&(n.value=r.value,r.value=x)},C);return br(()=>{if(!r.value)return;const x=d().map($=>$.ref);f.value=x.find($=>$.id.includes(r.value))}),gl({isRootMenu:!0,modelValue:r,previousValue:n,baseId:to(void 0,"reka-navigation-menu"),disableClickTrigger:S,disableHoverTrigger:w,dir:k,unmountOnHide:y,orientation:i.orientation,rootNavigationMenu:a,indicatorTrack:h,activeTrigger:f,onIndicatorTrackChange:x=>{h.value=x},viewport:l,onViewportChange:x=>{l.value=x},onTriggerEnter:x=>{L(x)},onTriggerLeave:()=>{g.value=!0,L("")},onContentEnter:()=>{L()},onContentLeave:()=>{i.disablePointerLeaveClose||L("")},onItemSelect:x=>{n.value=r.value,r.value=x},onItemDismiss:()=>{n.value=r.value,r.value=""}}),(x,$)=>(B(),z(v(u),null,{default:A(()=>[P(v(st),{ref:v(o),"aria-label":"Main",as:x.as,"as-child":x.asChild,"data-orientation":x.orientation,dir:v(k),"data-reka-navigation-menu":""},{default:A(()=>[j(x.$slots,"default",{modelValue:v(r)})]),_:3},8,["as","as-child","data-orientation","dir"])]),_:3}))}}),ml=vl;function rs(e){return e?"open":"closed"}function ro(e,t){return`${e}-trigger-${t}`}function xr(e,t){return`${e}-content-${t}`}const Sl="navigationMenu.linkSelect",Ii="navigationMenu.rootContentDismiss";function Ds(e){const t=[],i=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:s=>{const r=s.tagName==="INPUT"&&s.type==="hidden";return s.disabled||s.hidden||r?NodeFilter.FILTER_SKIP:s.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;i.nextNode();)t.push(i.currentNode);return t}function no(e){const t=Kt();return e.some(i=>i===t?!0:(i.focus(),Kt()!==t))}function bl(e){return e.forEach(t=>{t.dataset.tabindex=t.getAttribute("tabindex")||"",t.setAttribute("tabindex","-1")}),()=>{e.forEach(t=>{const i=t.dataset.tabindex;t.setAttribute("tabindex",i)})}}function oo(e){return t=>t.pointerType==="mouse"?e(t):void 0}const[Er,yl]=qn("NavigationMenuItem");var wl=Le({__name:"NavigationMenuItem",props:{value:{type:String,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:"li"}},setup(e){const t=e;ct();const{getItems:i}=gi({key:"NavigationMenu"}),s=zt(),r=to(t.value),n=X(),o=X(),a=xr(s.baseId,r);let h=()=>({});const l=X(!1);async function f(p="start"){const _=document.getElementById(a);if(_){h();const S=Ds(_);S.length&&no(p==="start"?S:S.reverse())}}function d(){const p=document.getElementById(a);if(p){const _=Ds(p);_.length&&(h=bl(_))}}yl({value:r,contentId:a,triggerRef:n,focusProxyRef:o,wasEscapeCloseRef:l,onEntryKeyDown:f,onFocusProxyEnter:f,onContentFocusOutside:d,onRootContentClose:d});function u(){s.onItemDismiss(),n.value?.focus()}function c(p){const _=Kt();if(p.keyCode===32||p.key==="Enter")if(s.modelValue.value===r){u(),p.preventDefault();return}else{p.target.click(),p.preventDefault();return}const S=i().filter(y=>y.ref.parentElement?.hasAttribute("data-menu-item")).map(y=>y.ref);if(!S.includes(_))return;const w=io(p,_,void 0,{itemsArray:S,loop:!1});w&&w?.focus(),p.preventDefault(),p.stopPropagation()}return(p,_)=>(B(),z(v(st),{"as-child":p.asChild,as:p.as,"data-menu-item":"",onKeydown:Un(c,["up","down","left","right","home","end","space"])},{default:A(()=>[j(p.$slots,"default")]),_:3},8,["as-child","as"]))}}),Cl=wl,kl=Le({__name:"NavigationMenuContentImpl",props:{disableOutsidePointerEvents:{type:Boolean,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},emits:["escapeKeyDown","pointerDownOutside","focusOutside","interactOutside"],setup(e,{emit:t}){const i=e,s=t,{getItems:r}=gi({key:"NavigationMenu"}),{forwardRef:n,currentElement:o}=ct(),a=zt(),h=Er(),l=ro(a.baseId,h.value),f=xr(a.baseId,h.value),d=X(null),u=Z(()=>{const y=r().map($=>$.ref.id.split("trigger-")[1]);a.dir.value==="rtl"&&y.reverse();const k=y.indexOf(a.modelValue.value),g=y.indexOf(a.previousValue.value),C=h.value===a.modelValue.value,L=g===y.indexOf(h.value);if(!C&&!L)return d.value;const x=(()=>{if(k!==g){if(C&&g!==-1)return k>g?"from-end":"from-start";if(L&&k!==-1)return k>g?"to-start":"to-end"}return null})();return d.value=x,x});function c(y){if(s("focusOutside",y),s("interactOutside",y),y.detail.originalEvent.target.hasAttribute("data-navigation-menu-trigger")&&y.preventDefault(),!y.defaultPrevented){h.onContentFocusOutside();const g=y.target;a.rootNavigationMenu?.value?.contains(g)&&y.preventDefault()}}function p(y){if(s("pointerDownOutside",y),!y.defaultPrevented){const k=y.target,g=r().some(L=>L.ref.contains(k)),C=a.isRootMenu&&a.viewport.value?.contains(k);(g||C||!a.isRootMenu)&&y.preventDefault()}}br(y=>{const k=o.value;if(a.isRootMenu&&k){const g=()=>{a.onItemDismiss(),h.onRootContentClose(),k.contains(Kt())&&h.triggerRef.value?.focus()};k.addEventListener(Ii,g),y(()=>k.removeEventListener(Ii,g))}});function _(y){s("escapeKeyDown",y),y.defaultPrevented||(a.onItemDismiss(),h.triggerRef?.value?.focus(),h.wasEscapeCloseRef.value=!0)}function S(y){if(y.target.closest("[data-reka-navigation-menu]")!==a.rootNavigationMenu.value)return;const k=y.altKey||y.ctrlKey||y.metaKey,g=y.key==="Tab"&&!k,C=Ds(y.currentTarget);if(g){const x=Kt(),$=C.findIndex(V=>V===x),G=y.shiftKey?C.slice(0,$).reverse():C.slice($+1,C.length);if(no(G))y.preventDefault();else{h.focusProxyRef.value?.focus();return}}io(y,Kt(),void 0,{itemsArray:C,loop:!1,enableIgnoredElement:!0})?.focus()}function w(){const y=new Event(Ii,{bubbles:!0,cancelable:!0});o.value?.dispatchEvent(y)}return(y,k)=>(B(),z(v(ca),Y({id:v(f),ref:v(n),"aria-labelledby":v(l),"data-motion":u.value,"data-state":v(rs)(v(a).modelValue.value===v(h).value),"data-orientation":v(a).orientation},i,{onKeydown:S,onEscapeKeyDown:_,onPointerDownOutside:p,onFocusOutside:c,onDismiss:w}),{default:A(()=>[j(y.$slots,"default")]),_:3},16,["id","aria-labelledby","data-motion","data-state","data-orientation"]))}}),xl=kl,El=Le({inheritAttrs:!1,__name:"NavigationMenuContent",props:{forceMount:{type:Boolean,required:!1},disableOutsidePointerEvents:{type:Boolean,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},emits:["escapeKeyDown","pointerDownOutside","focusOutside","interactOutside"],setup(e,{emit:t}){const i=e,s=t,r=ui(ua(i,"forceMount"),s),{forwardRef:n}=ct(),o=zt(),a=Er(),h=Z(()=>a.value===o.modelValue.value),l=Z(()=>o.viewport.value&&!o.modelValue.value&&o.previousValue.value?o.previousValue.value===a.value:!1);return(f,d)=>(B(),z(Vn,{to:v(zr)&&v(o).viewport.value?v(o).viewport.value:"body",disabled:v(zr)&&v(o).viewport.value?!v(o).viewport.value:!0},[P(v(yr),{present:f.forceMount||h.value||l.value,"force-mount":!v(o).unmountOnHide.value},{default:A(({present:u})=>[P(xl,Y({ref:v(n),"data-state":v(rs)(h.value),style:{pointerEvents:!h.value&&v(o).isRootMenu?"none":void 0}},{...f.$attrs,...v(r)},{hidden:!u,onPointerenter:d[0]||(d[0]=c=>v(o).onContentEnter(v(a).value)),onPointerleave:d[1]||(d[1]=c=>v(oo)(()=>v(o).onContentLeave())(c)),onPointerDownOutside:d[2]||(d[2]=c=>s("pointerDownOutside",c)),onFocusOutside:d[3]||(d[3]=c=>s("focusOutside",c)),onInteractOutside:d[4]||(d[4]=c=>s("interactOutside",c))}),{default:A(()=>[j(f.$slots,"default")]),_:2},1040,["data-state","style","hidden"])]),_:3},8,["present","force-mount"])],8,["to","disabled"]))}}),Bl=El,Ll=Le({inheritAttrs:!1,__name:"NavigationMenuIndicator",props:{forceMount:{type:Boolean,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},setup(e){const t=e,{forwardRef:i}=ct(),s=zt(),r=X(),n=Z(()=>s.orientation==="horizontal"),o=Z(()=>!!s.modelValue.value),{activeTrigger:a}=s;function h(){a.value&&(r.value={size:n.value?a.value.offsetWidth:a.value.offsetHeight,position:n.value?a.value.offsetLeft:a.value.offsetTop})}return br(()=>{s.modelValue.value&&h()}),Wi(a,h),Wi(s.indicatorTrack,h),(l,f)=>v(s).indicatorTrack.value?(B(),z(Vn,{key:0,to:v(s).indicatorTrack.value},[P(v(yr),{present:l.forceMount||o.value},{default:A(()=>[P(v(st),Y({ref:v(i),"aria-hidden":"true","data-state":o.value?"visible":"hidden","data-orientation":v(s).orientation,"as-child":t.asChild,as:l.as,style:{...r.value?{"--reka-navigation-menu-indicator-size":`${r.value.size}px`,"--reka-navigation-menu-indicator-position":`${r.value.position}px`}:{}}},l.$attrs),{default:A(()=>[j(l.$slots,"default")]),_:3},16,["data-state","data-orientation","as-child","as","style"])]),_:3},8,["present"])],8,["to"])):W("v-if",!0)}}),Dl=Ll,Ml=Le({__name:"NavigationMenuLink",props:{active:{type:Boolean,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:"a"}},emits:["select"],setup(e,{emit:t}){const i=e,s=t,{CollectionItem:r}=gi({key:"NavigationMenu"});ct();async function n(o){const a=new CustomEvent(Sl,{bubbles:!0,cancelable:!0,detail:{originalEvent:o}});if(s("select",a),!a.defaultPrevented&&!o.metaKey){const h=new CustomEvent(Ii,{bubbles:!0,cancelable:!0});o.target?.dispatchEvent(h)}}return(o,a)=>(B(),z(v(r),null,{default:A(()=>[P(v(st),{as:o.as,"data-active":o.active?"":void 0,"aria-current":o.active?"page":void 0,"as-child":i.asChild,onClick:n},{default:A(()=>[j(o.$slots,"default")]),_:3},8,["as","data-active","aria-current","as-child"])]),_:3}))}}),fs=Ml,Rl=Le({inheritAttrs:!1,__name:"NavigationMenuList",props:{asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:"ul"}},setup(e){const t=e,i=zt(),{forwardRef:s,currentElement:r}=ct();return es(()=>{i.onIndicatorTrackChange(r.value)}),(n,o)=>(B(),z(v(st),{ref:v(s),style:{position:"relative"}},{default:A(()=>[P(v(st),Y(n.$attrs,{"as-child":t.asChild,as:n.as,"data-orientation":v(i).orientation}),{default:A(()=>[j(n.$slots,"default")]),_:3},16,["as-child","as","data-orientation"])]),_:3},512))}}),Al=Rl;const Tl=["aria-owns"];var Il=Le({inheritAttrs:!1,__name:"NavigationMenuTrigger",props:{disabled:{type:Boolean,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:"button"}},setup(e){const t=e,i=zt(),s=Er(),{CollectionItem:r}=gi({key:"NavigationMenu"}),{forwardRef:n,currentElement:o}=ct(),a=X(""),h=X(""),l=Kn(!1,300),f=X(!1),d=Z(()=>s.value===i.modelValue.value);es(()=>{s.triggerRef=o,a.value=ro(i.baseId,s.value),h.value=xr(i.baseId,s.value)});function u(){i.disableHoverTrigger.value||(f.value=!1,s.wasEscapeCloseRef.value=!1)}function c(k){if(!i.disableHoverTrigger.value&&k.pointerType==="mouse"){if(t.disabled||f.value||s.wasEscapeCloseRef.value||l.value)return;i.onTriggerEnter(s.value),l.value=!0}}function p(k){if(!i.disableHoverTrigger.value&&k.pointerType==="mouse"){if(t.disabled)return;i.onTriggerLeave(),l.value=!1}}function _(k){(!("pointerType"in k)||k.pointerType==="mouse")&&i.disableClickTrigger.value||l.value||(d.value?i.onItemSelect(""):i.onItemSelect(s.value),f.value=d.value)}function S(k){const C={horizontal:"ArrowDown",vertical:i.dir.value==="rtl"?"ArrowLeft":"ArrowRight"}[i.orientation];d.value&&k.key===C&&(s.onEntryKeyDown(),k.preventDefault(),k.stopPropagation())}function w(k){s.focusProxyRef.value=fa(k)}function y(k){const g=document.getElementById(s.contentId),C=k.relatedTarget,L=C===o.value,x=g?.contains(C);(L||!x)&&s.onFocusProxyEnter(L?"start":"end")}return(k,g)=>(B(),U(Ce,null,[P(v(r),null,{default:A(()=>[P(v(st),Y({id:a.value,ref:v(n),disabled:k.disabled,"data-disabled":k.disabled?"":void 0,"data-state":v(rs)(d.value),"data-navigation-menu-trigger":"","aria-expanded":d.value,"aria-controls":h.value,"as-child":t.asChild,as:k.as},k.$attrs,{onPointerenter:u,onPointermove:c,onPointerleave:p,onClick:_,onKeydown:S}),{default:A(()=>[j(k.$slots,"default")]),_:3},16,["id","disabled","data-disabled","data-state","aria-expanded","aria-controls","as-child","as"])]),_:3}),d.value?(B(),U(Ce,{key:0},[P(v(da),{ref:w,"aria-hidden":"true",tabindex:0,onFocus:y}),v(i).viewport?(B(),U("span",{key:0,"aria-owns":h.value},null,8,Tl)):W("v-if",!0)],64)):W("v-if",!0)],64))}}),Pl=Il,Ol=Le({inheritAttrs:!1,__name:"NavigationMenuViewport",props:{forceMount:{type:Boolean,required:!1},align:{type:String,required:!1,default:"center"},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},setup(e){const t=e,{forwardRef:i,currentElement:s}=ct(),r=zt(),{activeTrigger:n,rootNavigationMenu:o,modelValue:a}=r,h=X(),l=X(),f=Z(()=>!!r.modelValue.value);ke(s,()=>{r.onViewportChange(s.value)});const d=X();ke([a,f],()=>{Ut(()=>{s.value&&requestAnimationFrame(()=>{const c=s.value?.querySelector("[data-state=open]");d.value=c})})},{immediate:!0});function u(){if(d.value&&n.value&&o.value){const c=document.documentElement.offsetWidth,p=document.documentElement.offsetHeight,_=o.value.getBoundingClientRect(),S=n.value.getBoundingClientRect(),{offsetWidth:w,offsetHeight:y}=d.value,k=S.left-_.left,g=S.top-_.top;let C=null,L=null;switch(t.align){case"start":C=k,L=g;break;case"end":C=k-w+S.width,L=g-y+S.height;break;default:C=k-w/2+S.width/2,L=g-y/2+S.height/2}const x=10;C+_.left<x&&(C=x-_.left);const $=C+_.left+w;$>c-x&&(C-=$-c+x,C<x-_.left&&(C=x-_.left)),L+_.top<x&&(L=x-_.top);const H=L+_.top+y;H>p-x&&(L-=H-p+x,L<x-_.top&&(L=x-_.top)),C=Math.round(C),L=Math.round(L),l.value={left:C,top:L}}}return Wi(d,()=>{d.value&&(h.value={width:d.value.offsetWidth,height:d.value.offsetHeight},u())}),Wi([globalThis.document?.body,o],()=>{u()}),(c,p)=>(B(),z(v(yr),{present:c.forceMount||f.value,"force-mount":!v(r).unmountOnHide.value,onAfterLeave:p[2]||(p[2]=()=>{h.value=void 0,l.value=void 0})},{default:A(({present:_})=>[P(v(st),Y(c.$attrs,{ref:v(i),as:c.as,"as-child":c.asChild,"data-state":v(rs)(f.value),"data-orientation":v(r).orientation,style:{pointerEvents:!f.value&&v(r).isRootMenu?"none":void 0,"--reka-navigation-menu-viewport-width":h.value?`${h.value?.width}px`:void 0,"--reka-navigation-menu-viewport-height":h.value?`${h.value?.height}px`:void 0,"--reka-navigation-menu-viewport-left":l.value?`${l.value?.left}px`:void 0,"--reka-navigation-menu-viewport-top":l.value?`${l.value?.top}px`:void 0},hidden:!_,onPointerenter:p[0]||(p[0]=S=>v(r).onContentEnter(v(r).modelValue.value)),onPointerleave:p[1]||(p[1]=S=>v(oo)(()=>v(r).onContentLeave())(S))}),{default:A(()=>[j(c.$slots,"default")]),_:2},1040,["as","as-child","data-state","data-orientation","style","hidden"])]),_:3},8,["present","force-mount"]))}}),Nl=Ol;function Ms(e,t){const s=jn().hook(e,t);_a(s)}const zl={slots:{base:"",label:"",trailing:"hidden lg:flex items-center gap-0.5 ms-auto"},variants:{collapsed:{true:{label:"hidden",trailing:"lg:hidden"}}}},Fl=Object.assign({inheritAttrs:!1},{__name:"UDashboardSearchButton",props:{icon:{type:null,required:!1},label:{type:String,required:!1},color:{type:null,required:!1,default:"neutral"},variant:{type:null,required:!1},collapsed:{type:Boolean,required:!1,default:!1},tooltip:{type:[Boolean,Object],required:!1,default:!1},kbds:{type:Array,required:!1,default:()=>["meta","k"]},ui:{type:void 0,required:!1},class:{type:null,required:!1},activeColor:{type:null,required:!1},activeVariant:{type:null,required:!1},size:{type:null,required:!1},square:{type:Boolean,required:!1},block:{type:Boolean,required:!1},loadingAuto:{type:Boolean,required:!1},onClick:{type:[Function,Array],required:!1},avatar:{type:Object,required:!1},leading:{type:Boolean,required:!1},leadingIcon:{type:null,required:!1},trailing:{type:Boolean,required:!1},trailingIcon:{type:null,required:!1},loading:{type:Boolean,required:!1},loadingIcon:{type:null,required:!1},as:{type:null,required:!1},type:{type:null,required:!1},disabled:{type:Boolean,required:!1},exactActiveClass:{type:String,required:!1},viewTransition:{type:Boolean,required:!1}},setup(e){const t=e,i=Yt(),[s,r]=Vt(),n=()=>Ki(i,["trailing"]),o=qi(pa(t,"icon","label","variant","collapsed","tooltip","kbds","class","ui")),a=et(()=>kt(typeof t.tooltip=="boolean"?{}:t.tooltip,{delayDuration:0,content:{side:"right"}})),{t:h}=ts(),l=Nt(),{toggleSearch:f}=Zn({toggleSearch:()=>{}}),d=Z(()=>Oe({extend:Oe(zl),...l.ui?.dashboardSearchButton||{}})({collapsed:t.collapsed}));return(u,c)=>(B(),U(Ce,null,[P(v(s),null,{default:A(()=>[P(xt,Y({icon:e.icon||v(l).ui.icons.search,label:e.label||v(h)("dashboardSearchButton.label"),variant:e.variant||(e.collapsed?"ghost":"outline")},{...v(o),...e.collapsed?{square:!0,"aria-label":e.label||v(h)("dashboardSearchButton.label")}:{},...u.$attrs},{class:d.value.base({class:[t.ui?.base,t.class]}),ui:v(Yn)(d.value,t.ui),onClick:v(f)}),is({trailing:A(({ui:p})=>[te("div",{"data-slot":"trailing",class:F(d.value.trailing({class:t.ui?.trailing}))},[j(u.$slots,"trailing",{ui:p},()=>[e.kbds?.length?(B(!0),U(Ce,{key:0},Ue(e.kbds,(_,S)=>(B(),z(Cr,Y({key:S,variant:"subtle"},{ref_for:!0},typeof _=="string"?{value:_}:_),null,16))),128)):W("",!0)])],2)]),_:2},[Ue(n(),(p,_)=>({name:_,fn:A(S=>[j(u.$slots,_,bt(yt(S)))])}))]),1040,["icon","label","variant","class","ui","onClick"])]),_:3}),e.collapsed&&e.tooltip?(B(),z(Qn,Y({key:0,text:e.label||v(h)("dashboardSearchButton.label")},a.value),{default:A(()=>[P(v(r))]),_:1},16,["text"])):(B(),z(v(r),{key:1}))],64))}}),Hl={slots:{content:"bg-default shadow-lg rounded-md ring ring-default data-[state=open]:animate-[scale-in_100ms_ease-out] data-[state=closed]:animate-[scale-out_100ms_ease-in] origin-(--reka-popover-content-transform-origin) focus:outline-none pointer-events-auto",arrow:"fill-default"}},$l={__name:"UPopover",props:{mode:{type:null,required:!1,default:"click"},content:{type:Object,required:!1},arrow:{type:[Boolean,Object],required:!1},portal:{type:[Boolean,String],required:!1,skipCheck:!0,default:!0},reference:{type:null,required:!1},dismissible:{type:Boolean,required:!1,default:!0},class:{type:null,required:!1},ui:{type:null,required:!1},defaultOpen:{type:Boolean,required:!1},open:{type:Boolean,required:!1},modal:{type:Boolean,required:!1},openDelay:{type:Number,required:!1,default:0},closeDelay:{type:Number,required:!1,default:0}},emits:["close:prevent","update:open"],setup(e,{emit:t}){const i=e,s=t,r=Yt(),n=Nt(),o=i.mode==="hover"?It(i,"defaultOpen","open","openDelay","closeDelay"):It(i,"defaultOpen","open","modal"),a=ui(o,s),h=ga(et(()=>i.portal)),l=et(()=>kt(i.content,{side:"bottom",sideOffset:8,collisionPadding:8})),f=Z(()=>i.dismissible?{}:["pointerDownOutside","interactOutside","escapeKeyDown"].reduce((_,S)=>(_[S]=w=>{w.preventDefault(),s("close:prevent")},_),{})),d=et(()=>i.arrow),u=Z(()=>Oe({extend:Oe(Hl),...n.ui?.popover||{}})({side:l.value.side})),c=Z(()=>i.mode==="hover"?qa:Ka);return(p,_)=>(B(),z(v(c).Root,bt(yt(v(a))),{default:A(({open:S,close:w})=>[r.default||e.reference?(B(),z(v(c).Trigger,{key:0,"as-child":"",reference:e.reference,class:F(i.class)},{default:A(()=>[j(p.$slots,"default",{open:S})]),_:2},1032,["reference","class"])):W("",!0),"Anchor"in c.value&&r.anchor?(B(),z(v(c).Anchor,{key:1,"as-child":""},{default:A(()=>[j(p.$slots,"anchor",bt(yt(w?{close:w}:{})))]),_:2},1024)):W("",!0),P(v(c).Portal,bt(yt(v(h))),{default:A(()=>[P(v(c).Content,Y(l.value,{"data-slot":"content",class:u.value.content({class:[!r.default&&i.class,i.ui?.content]})},va(f.value)),{default:A(()=>[j(p.$slots,"content",bt(yt(w?{close:w}:{}))),e.arrow?(B(),z(v(c).Arrow,Y({key:0},d.value,{"data-slot":"arrow",class:u.value.arrow({class:i.ui?.arrow})}),null,16,["class"])):W("",!0)]),_:2},1040,["class"])]),_:2},1040)]),_:3},16))}},Wl={slots:{root:"relative flex gap-1.5 [&>div]:min-w-0",list:"isolate min-w-0",label:"w-full flex items-center gap-1.5 font-semibold text-xs/5 text-highlighted px-2.5 py-1.5",item:"min-w-0",link:"group relative w-full flex items-center gap-1.5 font-medium text-sm before:absolute before:z-[-1] before:rounded-md focus:outline-none focus-visible:outline-none dark:focus-visible:outline-none focus-visible:before:ring-inset focus-visible:before:ring-2",linkLeadingIcon:"shrink-0 size-5",linkLeadingAvatar:"shrink-0",linkLeadingAvatarSize:"2xs",linkTrailing:"group ms-auto inline-flex gap-1.5 items-center",linkTrailingBadge:"shrink-0",linkTrailingBadgeSize:"sm",linkTrailingIcon:"size-5 transform shrink-0 group-data-[state=open]:rotate-180 transition-transform duration-200",linkLabel:"truncate",linkLabelExternalIcon:"inline-block size-3 align-top text-dimmed",childList:"isolate",childLabel:"text-xs text-highlighted",childItem:"",childLink:"group relative size-full flex items-start text-start text-sm before:absolute before:z-[-1] before:rounded-md focus:outline-none focus-visible:outline-none dark:focus-visible:outline-none focus-visible:before:ring-inset focus-visible:before:ring-2",childLinkWrapper:"min-w-0",childLinkIcon:"size-5 shrink-0",childLinkLabel:"truncate",childLinkLabelExternalIcon:"inline-block size-3 align-top text-dimmed",childLinkDescription:"text-muted",separator:"px-2 h-px bg-border",viewportWrapper:"absolute top-full left-0 flex w-full",viewport:"relative overflow-hidden bg-default shadow-lg rounded-md ring ring-default h-(--reka-navigation-menu-viewport-height) w-full transition-[width,height,left] duration-200 origin-[top_center] data-[state=open]:animate-[scale-in_100ms_ease-out] data-[state=closed]:animate-[scale-out_100ms_ease-in] z-[1]",content:"",indicator:"absolute data-[state=visible]:animate-[fade-in_100ms_ease-out] data-[state=hidden]:animate-[fade-out_100ms_ease-in] data-[state=hidden]:opacity-0 bottom-0 z-[2] w-(--reka-navigation-menu-indicator-size) translate-x-(--reka-navigation-menu-indicator-position) flex h-2.5 items-end justify-center overflow-hidden transition-[translate,width] duration-200",arrow:"relative top-[50%] size-2.5 rotate-45 border border-default bg-default z-[1] rounded-xs"},variants:{color:{primary:{link:"focus-visible:before:ring-primary",childLink:"focus-visible:before:ring-primary"},secondary:{link:"focus-visible:before:ring-secondary",childLink:"focus-visible:before:ring-secondary"},success:{link:"focus-visible:before:ring-success",childLink:"focus-visible:before:ring-success"},info:{link:"focus-visible:before:ring-info",childLink:"focus-visible:before:ring-info"},warning:{link:"focus-visible:before:ring-warning",childLink:"focus-visible:before:ring-warning"},error:{link:"focus-visible:before:ring-error",childLink:"focus-visible:before:ring-error"},neutral:{link:"focus-visible:before:ring-inverted",childLink:"focus-visible:before:ring-inverted"}},highlightColor:{primary:"",secondary:"",success:"",info:"",warning:"",error:"",neutral:""},variant:{pill:"",link:""},orientation:{horizontal:{root:"items-center justify-between",list:"flex items-center",item:"py-2",link:"px-2.5 py-1.5 before:inset-x-px before:inset-y-0",childList:"grid p-2",childLink:"px-3 py-2 gap-2 before:inset-x-px before:inset-y-0",childLinkLabel:"font-medium",content:"absolute top-0 left-0 w-full max-h-[70vh] overflow-y-auto"},vertical:{root:"flex-col",link:"flex-row px-2.5 py-1.5 before:inset-y-px before:inset-x-0",childLabel:"px-1.5 py-0.5",childLink:"p-1.5 gap-1.5 before:inset-y-px before:inset-x-0"}},contentOrientation:{horizontal:{viewportWrapper:"justify-center",content:"data-[motion=from-start]:animate-[enter-from-left_200ms_ease] data-[motion=from-end]:animate-[enter-from-right_200ms_ease] data-[motion=to-start]:animate-[exit-to-left_200ms_ease] data-[motion=to-end]:animate-[exit-to-right_200ms_ease]"},vertical:{viewport:"sm:w-(--reka-navigation-menu-viewport-width) left-(--reka-navigation-menu-viewport-left)"}},active:{true:{childLink:"before:bg-elevated text-highlighted",childLinkIcon:"text-default"},false:{link:"text-muted",linkLeadingIcon:"text-dimmed",childLink:["hover:before:bg-elevated/50 text-default hover:text-highlighted","transition-colors before:transition-colors"],childLinkIcon:["text-dimmed group-hover:text-default","transition-colors"]}},disabled:{true:{link:"cursor-not-allowed opacity-75"}},highlight:{true:""},level:{true:""},collapsed:{true:""}},compoundVariants:[{orientation:"horizontal",contentOrientation:"horizontal",class:{childList:"grid-cols-2 gap-2"}},{orientation:"horizontal",contentOrientation:"vertical",class:{childList:"gap-1",content:"w-60"}},{orientation:"vertical",collapsed:!1,class:{childList:"ms-5 border-s border-default",childItem:"ps-1.5 -ms-px",content:"data-[state=open]:animate-[collapsible-down_200ms_ease-out] data-[state=closed]:animate-[collapsible-up_200ms_ease-out] overflow-hidden"}},{orientation:"vertical",collapsed:!0,class:{link:"px-1.5",linkLabel:"hidden",linkTrailing:"hidden",content:"shadow-sm rounded-sm min-h-6 p-1"}},{orientation:"horizontal",highlight:!0,class:{link:["after:absolute after:-bottom-2 after:inset-x-2.5 after:block after:h-px after:rounded-full","after:transition-colors"]}},{orientation:"vertical",highlight:!0,level:!0,class:{link:["after:absolute after:-start-1.5 after:inset-y-0.5 after:block after:w-px after:rounded-full","after:transition-colors"]}},{disabled:!1,active:!1,variant:"pill",class:{link:["hover:text-highlighted hover:before:bg-elevated/50","transition-colors before:transition-colors"],linkLeadingIcon:["group-hover:text-default","transition-colors"]}},{disabled:!1,active:!1,variant:"pill",orientation:"horizontal",class:{link:"data-[state=open]:text-highlighted",linkLeadingIcon:"group-data-[state=open]:text-default"}},{disabled:!1,variant:"pill",highlight:!0,orientation:"horizontal",class:{link:"data-[state=open]:before:bg-elevated/50"}},{disabled:!1,variant:"pill",highlight:!1,active:!1,orientation:"horizontal",class:{link:"data-[state=open]:before:bg-elevated/50"}},{color:"primary",variant:"pill",active:!0,class:{link:"text-primary",linkLeadingIcon:"text-primary group-data-[state=open]:text-primary"}},{color:"secondary",variant:"pill",active:!0,class:{link:"text-secondary",linkLeadingIcon:"text-secondary group-data-[state=open]:text-secondary"}},{color:"success",variant:"pill",active:!0,class:{link:"text-success",linkLeadingIcon:"text-success group-data-[state=open]:text-success"}},{color:"info",variant:"pill",active:!0,class:{link:"text-info",linkLeadingIcon:"text-info group-data-[state=open]:text-info"}},{color:"warning",variant:"pill",active:!0,class:{link:"text-warning",linkLeadingIcon:"text-warning group-data-[state=open]:text-warning"}},{color:"error",variant:"pill",active:!0,class:{link:"text-error",linkLeadingIcon:"text-error group-data-[state=open]:text-error"}},{color:"neutral",variant:"pill",active:!0,class:{link:"text-highlighted",linkLeadingIcon:"text-highlighted group-data-[state=open]:text-highlighted"}},{variant:"pill",active:!0,highlight:!1,class:{link:"before:bg-elevated"}},{variant:"pill",active:!0,highlight:!0,disabled:!1,class:{link:["hover:before:bg-elevated/50","before:transition-colors"]}},{disabled:!1,active:!1,variant:"link",class:{link:["hover:text-highlighted","transition-colors"],linkLeadingIcon:["group-hover:text-default","transition-colors"]}},{disabled:!1,active:!1,variant:"link",orientation:"horizontal",class:{link:"data-[state=open]:text-highlighted",linkLeadingIcon:"group-data-[state=open]:text-default"}},{color:"primary",variant:"link",active:!0,class:{link:"text-primary",linkLeadingIcon:"text-primary group-data-[state=open]:text-primary"}},{color:"secondary",variant:"link",active:!0,class:{link:"text-secondary",linkLeadingIcon:"text-secondary group-data-[state=open]:text-secondary"}},{color:"success",variant:"link",active:!0,class:{link:"text-success",linkLeadingIcon:"text-success group-data-[state=open]:text-success"}},{color:"info",variant:"link",active:!0,class:{link:"text-info",linkLeadingIcon:"text-info group-data-[state=open]:text-info"}},{color:"warning",variant:"link",active:!0,class:{link:"text-warning",linkLeadingIcon:"text-warning group-data-[state=open]:text-warning"}},{color:"error",variant:"link",active:!0,class:{link:"text-error",linkLeadingIcon:"text-error group-data-[state=open]:text-error"}},{color:"neutral",variant:"link",active:!0,class:{link:"text-highlighted",linkLeadingIcon:"text-highlighted group-data-[state=open]:text-highlighted"}},{highlightColor:"primary",highlight:!0,level:!0,active:!0,class:{link:"after:bg-primary"}},{highlightColor:"secondary",highlight:!0,level:!0,active:!0,class:{link:"after:bg-secondary"}},{highlightColor:"success",highlight:!0,level:!0,active:!0,class:{link:"after:bg-success"}},{highlightColor:"info",highlight:!0,level:!0,active:!0,class:{link:"after:bg-info"}},{highlightColor:"warning",highlight:!0,level:!0,active:!0,class:{link:"after:bg-warning"}},{highlightColor:"error",highlight:!0,level:!0,active:!0,class:{link:"after:bg-error"}},{highlightColor:"neutral",highlight:!0,level:!0,active:!0,class:{link:"after:bg-inverted"}}],defaultVariants:{color:"primary",highlightColor:"primary",variant:"pill"}},ql=Object.assign({inheritAttrs:!1},{__name:"UNavigationMenu",props:{as:{type:null,required:!1},type:{type:null,required:!1,default:"multiple"},modelValue:{type:null,required:!1},defaultValue:{type:null,required:!1},trailingIcon:{type:null,required:!1},externalIcon:{type:[Boolean,String],required:!1,skipCheck:!0,default:!0},items:{type:null,required:!1},color:{type:null,required:!1},variant:{type:null,required:!1},orientation:{type:null,required:!1,default:"horizontal"},collapsed:{type:Boolean,required:!1},tooltip:{type:[Boolean,Object],required:!1},popover:{type:[Boolean,Object],required:!1},highlight:{type:Boolean,required:!1},highlightColor:{type:null,required:!1},content:{type:Object,required:!1},contentOrientation:{type:null,required:!1,default:"horizontal"},arrow:{type:Boolean,required:!1},labelKey:{type:null,required:!1,default:"label"},class:{type:null,required:!1},ui:{type:null,required:!1},delayDuration:{type:Number,required:!1,default:0},disableClickTrigger:{type:Boolean,required:!1},disableHoverTrigger:{type:Boolean,required:!1},skipDelayDuration:{type:Number,required:!1},disablePointerLeaveClose:{type:Boolean,required:!1},unmountOnHide:{type:Boolean,required:!1,default:!0},disabled:{type:Boolean,required:!1},collapsible:{type:Boolean,required:!1,default:!0}},emits:["update:modelValue"],setup(e,{emit:t}){const i=e,s=t,r=Yt(),n=Nt(),o=ui(Z(()=>({as:i.as,delayDuration:i.delayDuration,skipDelayDuration:i.skipDelayDuration,orientation:i.orientation,disableClickTrigger:i.disableClickTrigger,disableHoverTrigger:i.disableHoverTrigger,disablePointerLeaveClose:i.disablePointerLeaveClose,unmountOnHide:i.unmountOnHide})),s),a=ui(It(i,"collapsible","disabled","type","unmountOnHide"),s),h=et(()=>i.content),l=et(()=>kt(typeof i.tooltip=="boolean"?{}:i.tooltip,{delayDuration:0,content:{side:"right"}})),f=et(()=>kt(typeof i.popover=="boolean"?{}:i.popover,{mode:"hover",content:{side:"right",align:"start",alignOffset:2}})),[d,u]=Vt(),[c,p]=Vt({props:{item:Object,index:Number,level:Number}}),_=Z(()=>Oe({extend:Oe(Wl),...n.ui?.navigationMenu||{}})({orientation:i.orientation,contentOrientation:i.orientation==="vertical"?void 0:i.contentOrientation,collapsed:i.collapsed,color:i.color,variant:i.variant,highlight:i.highlight,highlightColor:i.highlightColor||i.color})),S=Z(()=>i.items?.length?ma(i.items)?i.items:[i.items]:[]);function w(y,k=0){const g=y.reduce((C,L,x)=>((L.defaultOpen||L.open)&&C.push(L.value||(k>0?`item-${k}-${x}`:`item-${x}`)),C),[]);return i.type==="single"?g[0]:g}return(y,k)=>(B(),U(Ce,null,[P(v(d),null,{default:A(({item:g,active:C,index:L})=>[j(y.$slots,g.slot||"item",{item:g,index:L,active:C,ui:_.value},()=>[j(y.$slots,g.slot?`${g.slot}-leading`:"item-leading",{item:g,active:C,index:L,ui:_.value},()=>[g.avatar?(B(),z(wr,Y({key:0,size:g.ui?.linkLeadingAvatarSize||i.ui?.linkLeadingAvatarSize||_.value.linkLeadingAvatarSize()},g.avatar,{"data-slot":"linkLeadingAvatar",class:_.value.linkLeadingAvatar({class:[i.ui?.linkLeadingAvatar,g.ui?.linkLeadingAvatar],active:C,disabled:!!g.disabled})}),null,16,["size","class"])):g.icon?(B(),z(me,{key:1,name:g.icon,"data-slot":"linkLeadingIcon",class:F(_.value.linkLeadingIcon({class:[i.ui?.linkLeadingIcon,g.ui?.linkLeadingIcon],active:C,disabled:!!g.disabled}))},null,8,["name","class"])):W("",!0)]),v(Pe)(g,i.labelKey)||r[g.slot?`${g.slot}-label`:"item-label"]?(B(),U("span",{key:0,"data-slot":"linkLabel",class:F(_.value.linkLabel({class:[i.ui?.linkLabel,g.ui?.linkLabel]}))},[j(y.$slots,g.slot?`${g.slot}-label`:"item-label",{item:g,active:C,index:L},()=>[tt(Be(v(Pe)(g,i.labelKey)),1)]),g.target==="_blank"&&e.externalIcon!==!1?(B(),z(me,{key:0,name:typeof e.externalIcon=="string"?e.externalIcon:v(n).ui.icons.external,"data-slot":"linkLabelExternalIcon",class:F(_.value.linkLabelExternalIcon({class:[i.ui?.linkLabelExternalIcon,g.ui?.linkLabelExternalIcon],active:C}))},null,8,["name","class"])):W("",!0)],2)):W("",!0),g.badge||g.badge===0||e.orientation==="horizontal"&&(g.children?.length||r[g.slot?`${g.slot}-content`:"item-content"])||e.orientation==="vertical"&&g.children?.length||g.trailingIcon||r[g.slot?`${g.slot}-trailing`:"item-trailing"]?(B(),z(Ci(e.orientation==="vertical"&&g.children?.length&&!e.collapsed?v(Fr):"span"),{key:1,as:"span","data-slot":"linkTrailing",class:F(_.value.linkTrailing({class:[i.ui?.linkTrailing,g.ui?.linkTrailing]})),onClick:k[0]||(k[0]=Sa(()=>{},["stop","prevent"]))},{default:A(()=>[j(y.$slots,g.slot?`${g.slot}-trailing`:"item-trailing",{item:g,active:C,index:L,ui:_.value},()=>[g.badge||g.badge===0?(B(),z(Wa,Y({key:0,color:"neutral",variant:"outline",size:g.ui?.linkTrailingBadgeSize||i.ui?.linkTrailingBadgeSize||_.value.linkTrailingBadgeSize()},typeof g.badge=="string"||typeof g.badge=="number"?{label:g.badge}:g.badge,{"data-slot":"linkTrailingBadge",class:_.value.linkTrailingBadge({class:[i.ui?.linkTrailingBadge,g.ui?.linkTrailingBadge]})}),null,16,["size","class"])):W("",!0),e.orientation==="horizontal"&&(g.children?.length||r[g.slot?`${g.slot}-content`:"item-content"])||e.orientation==="vertical"&&g.children?.length?(B(),z(me,{key:1,name:g.trailingIcon||e.trailingIcon||v(n).ui.icons.chevronDown,"data-slot":"linkTrailingIcon",class:F(_.value.linkTrailingIcon({class:[i.ui?.linkTrailingIcon,g.ui?.linkTrailingIcon],active:C}))},null,8,["name","class"])):g.trailingIcon?(B(),z(me,{key:2,name:g.trailingIcon,"data-slot":"linkTrailingIcon",class:F(_.value.linkTrailingIcon({class:[i.ui?.linkTrailingIcon,g.ui?.linkTrailingIcon],active:C}))},null,8,["name","class"])):W("",!0)])]),_:2},1032,["class"])):W("",!0)])]),_:3}),P(v(c),null,{default:A(({item:g,index:C,level:L=0})=>[(B(),z(Ci(e.orientation==="vertical"&&!e.collapsed?v(Fa):v(Cl)),{as:"li",value:g.value||(L>0?`item-${L}-${C}`:`item-${C}`)},{default:A(()=>[e.orientation==="vertical"&&g.type==="label"&&!e.collapsed?(B(),U("div",{key:0,"data-slot":"label",class:F(_.value.label({class:[i.ui?.label,g.ui?.label,g.class]}))},[P(v(u),{item:g,index:C},null,8,["item","index"])],2)):g.type!=="label"?(B(),z(Ai,Y({key:1},e.orientation==="vertical"&&g.children?.length&&!e.collapsed&&g.type==="trigger"?{}:v(Ti)(g),{custom:""}),{default:A(({active:x,...$})=>[(B(),z(Ci(e.orientation==="horizontal"&&(g.children?.length||r[g.slot?`${g.slot}-content`:"item-content"])?v(Pl):e.orientation==="vertical"&&g.children?.length&&!e.collapsed&&!$.href?v(Fr):v(fs)),{"as-child":"",active:x||g.active,disabled:g.disabled,onSelect:g.onSelect},{default:A(()=>[e.orientation==="vertical"&&e.collapsed&&g.children?.length&&(i.popover||g.popover)?(B(),z($l,Y({key:0},{...f.value,...typeof g.popover=="boolean"?{}:g.popover||{}},{ui:{content:_.value.content({class:[i.ui?.content,g.ui?.content]})}}),{content:A(({close:H})=>[j(y.$slots,g.slot?`${g.slot}-content`:"item-content",{item:g,active:x||g.active,index:C,ui:_.value,close:H},()=>[te("ul",{"data-slot":"childList",class:F(_.value.childList({class:[i.ui?.childList,g.ui?.childList]}))},[te("li",{"data-slot":"childLabel",class:F(_.value.childLabel({class:[i.ui?.childLabel,g.ui?.childLabel]}))},Be(v(Pe)(g,i.labelKey)),3),(B(!0),U(Ce,null,Ue(g.children,(G,V)=>(B(),U("li",{key:V,"data-slot":"childItem",class:F(_.value.childItem({class:[i.ui?.childItem,g.ui?.childItem]}))},[P(Ai,Y({ref_for:!0},v(Ti)(G),{custom:""}),{default:A(({active:I,...b})=>[P(v(fs),{"as-child":"",active:I,onSelect:G.onSelect},{default:A(()=>[P(Wt,Y({ref_for:!0},b,{"data-slot":"childLink",class:_.value.childLink({class:[i.ui?.childLink,g.ui?.childLink,G.class],active:I})}),{default:A(()=>[G.icon?(B(),z(me,{key:0,name:G.icon,"data-slot":"childLinkIcon",class:F(_.value.childLinkIcon({class:[i.ui?.childLinkIcon,g.ui?.childLinkIcon],active:I}))},null,8,["name","class"])):W("",!0),te("span",{"data-slot":"childLinkLabel",class:F(_.value.childLinkLabel({class:[i.ui?.childLinkLabel,g.ui?.childLinkLabel],active:I}))},[tt(Be(v(Pe)(G,i.labelKey))+" ",1),G.target==="_blank"&&e.externalIcon!==!1?(B(),z(me,{key:0,name:typeof e.externalIcon=="string"?e.externalIcon:v(n).ui.icons.external,"data-slot":"childLinkLabelExternalIcon",class:F(_.value.childLinkLabelExternalIcon({class:[i.ui?.childLinkLabelExternalIcon,g.ui?.childLinkLabelExternalIcon],active:I}))},null,8,["name","class"])):W("",!0)],2)]),_:2},1040,["class"])]),_:2},1032,["active","onSelect"])]),_:2},1040)],2))),128))],2)])]),default:A(()=>[P(Wt,Y($,{"data-slot":"link",class:_.value.link({class:[i.ui?.link,g.ui?.link,g.class],active:x||g.active,disabled:!!g.disabled,level:L>0})}),{default:A(()=>[P(v(u),{item:g,active:x||g.active,index:C},null,8,["item","active","index"])]),_:2},1040,["class"])]),_:2},1040,["ui"])):e.orientation==="vertical"&&e.collapsed&&(i.tooltip||g.tooltip)?(B(),z(Qn,Y({key:1,text:v(Pe)(g,i.labelKey)},{...l.value,...typeof g.tooltip=="boolean"?{}:g.tooltip||{}}),{default:A(()=>[P(Wt,Y($,{"data-slot":"link",class:_.value.link({class:[i.ui?.link,g.ui?.link,g.class],active:x||g.active,disabled:!!g.disabled,level:L>0})}),{default:A(()=>[P(v(u),{item:g,active:x||g.active,index:C},null,8,["item","active","index"])]),_:2},1040,["class"])]),_:2},1040,["text"])):(B(),z(Wt,Y({key:2},$,{"data-slot":"link",class:_.value.link({class:[i.ui?.link,g.ui?.link,g.class],active:x||g.active,disabled:!!g.disabled,level:e.orientation==="horizontal"||L>0})}),{default:A(()=>[P(v(u),{item:g,active:x||g.active,index:C},null,8,["item","active","index"])]),_:2},1040,["class"]))]),_:2},1064,["active","disabled","onSelect"])),e.orientation==="horizontal"&&(g.children?.length||r[g.slot?`${g.slot}-content`:"item-content"])?(B(),z(v(Bl),Y({key:0},h.value,{"data-slot":"content",class:_.value.content({class:[i.ui?.content,g.ui?.content]})}),{default:A(()=>[j(y.$slots,g.slot?`${g.slot}-content`:"item-content",{item:g,active:x||g.active,index:C,ui:_.value},()=>[te("ul",{"data-slot":"childList",class:F(_.value.childList({class:[i.ui?.childList,g.ui?.childList]}))},[(B(!0),U(Ce,null,Ue(g.children,(H,G)=>(B(),U("li",{key:G,"data-slot":"childItem",class:F(_.value.childItem({class:[i.ui?.childItem,g.ui?.childItem]}))},[P(Ai,Y({ref_for:!0},v(Ti)(H),{custom:""}),{default:A(({active:V,...I})=>[P(v(fs),{"as-child":"",active:V,onSelect:H.onSelect},{default:A(()=>[P(Wt,Y({ref_for:!0},I,{"data-slot":"childLink",class:_.value.childLink({class:[i.ui?.childLink,g.ui?.childLink,H.class],active:V})}),{default:A(()=>[H.icon?(B(),z(me,{key:0,name:H.icon,"data-slot":"childLinkIcon",class:F(_.value.childLinkIcon({class:[i.ui?.childLinkIcon,g.ui?.childLinkIcon],active:V}))},null,8,["name","class"])):W("",!0),te("div",{"data-slot":"childLinkWrapper",class:F(_.value.childLinkWrapper({class:[i.ui?.childLinkWrapper,g.ui?.childLinkWrapper]}))},[te("p",{"data-slot":"childLinkLabel",class:F(_.value.childLinkLabel({class:[i.ui?.childLinkLabel,g.ui?.childLinkLabel],active:V}))},[tt(Be(v(Pe)(H,i.labelKey))+" ",1),H.target==="_blank"&&e.externalIcon!==!1?(B(),z(me,{key:0,name:typeof e.externalIcon=="string"?e.externalIcon:v(n).ui.icons.external,"data-slot":"childLinkLabelExternalIcon",class:F(_.value.childLinkLabelExternalIcon({class:[i.ui?.childLinkLabelExternalIcon,g.ui?.childLinkLabelExternalIcon],active:V}))},null,8,["name","class"])):W("",!0)],2),H.description?(B(),U("p",{key:0,"data-slot":"childLinkDescription",class:F(_.value.childLinkDescription({class:[i.ui?.childLinkDescription,g.ui?.childLinkDescription],active:V}))},Be(H.description),3)):W("",!0)],2)]),_:2},1040,["class"])]),_:2},1032,["active","onSelect"])]),_:2},1040)],2))),128))],2)])]),_:2},1040,["class"])):W("",!0)]),_:2},1040)):W("",!0),e.orientation==="vertical"&&g.children?.length&&!e.collapsed?(B(),z(v(Ha),{key:2,"data-slot":"content",class:F(_.value.content({class:[i.ui?.content,g.ui?.content]}))},{default:A(()=>[P(v(Hr),Y({...v(a),defaultValue:w(g.children,L+1)},{as:"ul","data-slot":"childList",class:_.value.childList({class:i.ui?.childList})}),{default:A(()=>[(B(!0),U(Ce,null,Ue(g.children,(x,$)=>(B(),z(v(p),{key:$,item:x,index:$,level:L+1,"data-slot":"childItem",class:F(_.value.childItem({class:[i.ui?.childItem,x.ui?.childItem]}))},null,8,["item","index","level","class"]))),128))]),_:2},1040,["class"])]),_:2},1032,["class"])):W("",!0)]),_:2},1032,["value"]))]),_:3}),P(v(ml),Y({...v(o),...e.orientation==="horizontal"?{modelValue:e.modelValue,defaultValue:e.defaultValue}:{},...y.$attrs},{"data-collapsed":e.collapsed,"data-slot":"root",class:_.value.root({class:[i.ui?.root,i.class]})}),{default:A(()=>[j(y.$slots,"list-leading"),(B(!0),U(Ce,null,Ue(S.value,(g,C)=>(B(),U(Ce,{key:`list-${C}`},[(B(),z(Ci(e.orientation==="vertical"?v(Hr):v(Al)),Y({ref_for:!0},e.orientation==="vertical"&&!e.collapsed?{...v(a),modelValue:e.modelValue,defaultValue:e.defaultValue??w(g)}:{},{as:"ul","data-slot":"list",class:_.value.list({class:i.ui?.list})}),{default:A(()=>[(B(!0),U(Ce,null,Ue(g,(L,x)=>(B(),z(v(p),{key:`list-${C}-${x}`,item:L,index:x,"data-slot":"item",class:F(_.value.item({class:[i.ui?.item,L.ui?.item]}))},null,8,["item","index","class"]))),128))]),_:2},1040,["class"])),e.orientation==="vertical"&&C<S.value.length-1?(B(),U("div",{key:0,"data-slot":"separator",class:F(_.value.separator({class:i.ui?.separator}))},null,2)):W("",!0)],64))),128)),j(y.$slots,"list-trailing"),e.orientation==="horizontal"?(B(),U("div",{key:0,"data-slot":"viewportWrapper",class:F(_.value.viewportWrapper({class:i.ui?.viewportWrapper}))},[e.arrow?(B(),z(v(Dl),{key:0,"data-slot":"indicator",class:F(_.value.indicator({class:i.ui?.indicator}))},{default:A(()=>[te("div",{"data-slot":"arrow",class:F(_.value.arrow({class:i.ui?.arrow}))},null,2)]),_:1},8,["class"])):W("",!0),P(v(Nl),{"data-slot":"viewport",class:F(_.value.viewport({class:i.ui?.viewport}))},null,8,["class"])],2)):W("",!0)]),_:3},16,["data-collapsed","class"])],64))}}),Kl={slots:{root:"relative hidden lg:flex flex-col min-h-svh min-w-16 w-(--width) shrink-0",header:"h-(--ui-header-height) shrink-0 flex items-center gap-1.5 px-4",body:"flex flex-col gap-4 flex-1 overflow-y-auto px-4 py-2",footer:"shrink-0 flex items-center gap-1.5 px-4 py-2",toggle:"",handle:"",content:"lg:hidden",overlay:"lg:hidden"},variants:{menu:{true:{header:"sm:px-6",body:"sm:px-6",footer:"sm:px-6"}},side:{left:{root:"border-e border-default"},right:{root:""}},toggleSide:{left:{toggle:""},right:{toggle:"ms-auto"}}}},Ul=["data-collapsed","data-dragging"],Vl=Object.assign({inheritAttrs:!1},{__name:"UDashboardSidebar",props:Ui({mode:{type:null,required:!1,default:"slideover"},menu:{type:null,required:!1},toggle:{type:[Boolean,Object],required:!1,default:!0},toggleSide:{type:String,required:!1,default:"left"},class:{type:null,required:!1},ui:{type:null,required:!1},id:{type:String,required:!1},side:{type:String,required:!1,default:"left"},minSize:{type:Number,required:!1,default:10},maxSize:{type:Number,required:!1,default:20},defaultSize:{type:Number,required:!1,default:15},resizable:{type:Boolean,required:!1,default:!1},collapsible:{type:Boolean,required:!1,default:!1},collapsedSize:{type:Number,required:!1,default:0}},{open:{type:Boolean,default:!1},openModifiers:{},collapsed:{type:Boolean,default:!1},collapsedModifiers:{}}),emits:["update:open","update:collapsed"],setup(e){const t=e,i=Yt(),s=di(e,"open",{type:Boolean,default:!1}),r=di(e,"collapsed",{type:Boolean,default:!1}),n=Gn(),{t:o}=ts(),a=Nt(),h=Zn({storageKey:"dashboard",unit:"%",sidebarOpen:X(!1),sidebarCollapsed:X(!1)}),l=`${h.storageKey}-sidebar-${t.id||ba()}`,{el:f,size:d,collapse:u,isCollapsed:c,isDragging:p,onMouseDown:_,onTouchStart:S,onDoubleClick:w}=Ta(l,et(()=>({...h,...t})),{collapsed:r}),[y,k]=Vt(),[g,C]=Vt();Ms("dashboard:sidebar:toggle",()=>{s.value=!s.value}),Ms("dashboard:sidebar:collapse",G=>{c.value=G}),ke(s,()=>h.sidebarOpen.value=s.value,{immediate:!0}),ke(c,()=>h.sidebarCollapsed.value=c.value,{immediate:!0}),ke(()=>n.fullPath,()=>{s.value=!1});const L=Z(()=>Oe({extend:Oe(Kl),...a.ui?.dashboardSidebar||{}})({side:t.side})),x=Z(()=>({slideover:ja,modal:kr,drawer:Ya})[t.mode]),$=et(()=>kt(t.menu,{content:{onOpenAutoFocus:G=>G.preventDefault()}},t.mode==="modal"?{fullscreen:!0,transition:!1}:t.mode==="slideover"?{side:"left"}:{}));function H(){s.value=!s.value}return(G,V)=>(B(),U(Ce,null,[P(v(y),null,{default:A(()=>[j(G.$slots,"toggle",{open:s.value,toggle:H,ui:L.value},()=>[e.toggle?(B(),z(Ia,Y({key:0},typeof e.toggle=="object"?e.toggle:{},{side:e.toggleSide,"data-slot":"toggle",class:L.value.toggle({class:t.ui?.toggle,toggleSide:e.toggleSide})}),null,16,["side","class"])):W("",!0)])]),_:3}),P(v(g),null,{default:A(()=>[j(G.$slots,"resize-handle",{onMouseDown:v(_),onTouchStart:v(S),onDoubleClick:v(w),ui:L.value},()=>[e.resizable?(B(),z(Pa,{key:0,"aria-controls":l,"data-slot":"handle",class:F(L.value.handle({class:t.ui?.handle})),onMousedown:v(_),onTouchstart:v(S),onDblclick:v(w)},null,8,["class","onMousedown","onTouchstart","onDblclick"])):W("",!0)])]),_:3}),e.side==="right"?(B(),z(v(C),{key:0})):W("",!0),te("div",Y({id:l,ref_key:"el",ref:f},G.$attrs,{"data-collapsed":v(c),"data-dragging":v(p),"data-slot":"root",class:L.value.root({class:[t.ui?.root,t.class]}),style:{"--width":`${v(d)||0}${v(h).unit}`}}),[i.header?(B(),U("div",{key:0,"data-slot":"header",class:F(L.value.header({class:t.ui?.header}))},[j(G.$slots,"header",{collapsed:v(c),collapse:v(u)})],2)):W("",!0),te("div",{"data-slot":"body",class:F(L.value.body({class:t.ui?.body}))},[j(G.$slots,"default",{collapsed:v(c),collapse:v(u)})],2),i.footer?(B(),U("div",{key:1,"data-slot":"footer",class:F(L.value.footer({class:t.ui?.footer}))},[j(G.$slots,"footer",{collapsed:v(c),collapse:v(u)})],2)):W("",!0)],16,Ul),e.side==="left"?(B(),z(v(C),{key:1})):W("",!0),P(v(x),Y({open:s.value,"onUpdate:open":V[0]||(V[0]=I=>s.value=I),title:v(o)("dashboardSidebar.title"),description:v(o)("dashboardSidebar.description")},$.value,{ui:{overlay:L.value.overlay({class:t.ui?.overlay}),content:L.value.content({class:t.ui?.content})}}),{content:A(I=>[j(G.$slots,"content",bt(yt(I)),()=>[i.header||e.mode!=="drawer"?(B(),U("div",{key:0,"data-slot":"header",class:F(L.value.header({class:t.ui?.header,menu:!0}))},[e.mode!=="drawer"&&e.toggleSide==="left"?(B(),z(v(k),{key:0})):W("",!0),j(G.$slots,"header"),e.mode!=="drawer"&&e.toggleSide==="right"?(B(),z(v(k),{key:1})):W("",!0)],2)):W("",!0),te("div",{"data-slot":"body",class:F(L.value.body({class:t.ui?.body,menu:!0}))},[j(G.$slots,"default")],2),i.footer?(B(),U("div",{key:1,"data-slot":"footer",class:F(L.value.footer({class:t.ui?.footer,menu:!0}))},[j(G.$slots,"footer")],2)):W("",!0)])]),_:3},16,["open","title","description","ui"])],64))}});function ht(e){return Array.isArray?Array.isArray(e):ho(e)==="[object Array]"}function jl(e){if(typeof e=="string")return e;let t=e+"";return t=="0"&&1/e==-1/0?"-0":t}function Yl(e){return e==null?"":jl(e)}function Ze(e){return typeof e=="string"}function ao(e){return typeof e=="number"}function Gl(e){return e===!0||e===!1||Xl(e)&&ho(e)=="[object Boolean]"}function lo(e){return typeof e=="object"}function Xl(e){return lo(e)&&e!==null}function He(e){return e!=null}function _s(e){return!e.trim().length}function ho(e){return e==null?e===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(e)}const Jl="Incorrect 'index' type",Zl=e=>`Invalid value for key ${e}`,Ql=e=>`Pattern length exceeds max of ${e}.`,eh=e=>`Missing ${e} property in key`,th=e=>`Property 'weight' in key '${e}' must be a positive integer`,$r=Object.prototype.hasOwnProperty;class ih{constructor(t){this._keys=[],this._keyMap={};let i=0;t.forEach(s=>{let r=co(s);this._keys.push(r),this._keyMap[r.id]=r,i+=r.weight}),this._keys.forEach(s=>{s.weight/=i})}get(t){return this._keyMap[t]}keys(){return this._keys}toJSON(){return JSON.stringify(this._keys)}}function co(e){let t=null,i=null,s=null,r=1,n=null;if(Ze(e)||ht(e))s=e,t=Wr(e),i=Rs(e);else{if(!$r.call(e,"name"))throw new Error(eh("name"));const o=e.name;if(s=o,$r.call(e,"weight")&&(r=e.weight,r<=0))throw new Error(th(o));t=Wr(o),i=Rs(o),n=e.getFn}return{path:t,id:i,weight:r,src:s,getFn:n}}function Wr(e){return ht(e)?e:e.split(".")}function Rs(e){return ht(e)?e.join("."):e}function sh(e,t){let i=[],s=!1;const r=(n,o,a)=>{if(He(n))if(!o[a])i.push(n);else{let h=o[a];const l=n[h];if(!He(l))return;if(a===o.length-1&&(Ze(l)||ao(l)||Gl(l)))i.push(Yl(l));else if(ht(l)){s=!0;for(let f=0,d=l.length;f<d;f+=1)r(l[f],o,a+1)}else o.length&&r(l,o,a+1)}};return r(e,Ze(t)?t.split("."):t,0),s?i:i[0]}const rh={includeMatches:!1,findAllMatches:!1,minMatchCharLength:1},nh={isCaseSensitive:!1,ignoreDiacritics:!1,includeScore:!1,keys:[],shouldSort:!0,sortFn:(e,t)=>e.score===t.score?e.idx<t.idx?-1:1:e.score<t.score?-1:1},oh={location:0,threshold:.6,distance:100},ah={useExtendedSearch:!1,getFn:sh,ignoreLocation:!1,ignoreFieldNorm:!1,fieldNormWeight:1};var q={...nh,...rh,...oh,...ah};const lh=/[^ ]+/g;function hh(e=1,t=3){const i=new Map,s=Math.pow(10,t);return{get(r){const n=r.match(lh).length;if(i.has(n))return i.get(n);const o=1/Math.pow(n,.5*e),a=parseFloat(Math.round(o*s)/s);return i.set(n,a),a},clear(){i.clear()}}}class Br{constructor({getFn:t=q.getFn,fieldNormWeight:i=q.fieldNormWeight}={}){this.norm=hh(i,3),this.getFn=t,this.isCreated=!1,this.setIndexRecords()}setSources(t=[]){this.docs=t}setIndexRecords(t=[]){this.records=t}setKeys(t=[]){this.keys=t,this._keysMap={},t.forEach((i,s)=>{this._keysMap[i.id]=s})}create(){this.isCreated||!this.docs.length||(this.isCreated=!0,Ze(this.docs[0])?this.docs.forEach((t,i)=>{this._addString(t,i)}):this.docs.forEach((t,i)=>{this._addObject(t,i)}),this.norm.clear())}add(t){const i=this.size();Ze(t)?this._addString(t,i):this._addObject(t,i)}removeAt(t){this.records.splice(t,1);for(let i=t,s=this.size();i<s;i+=1)this.records[i].i-=1}getValueForItemAtKeyId(t,i){return t[this._keysMap[i]]}size(){return this.records.length}_addString(t,i){if(!He(t)||_s(t))return;let s={v:t,i,n:this.norm.get(t)};this.records.push(s)}_addObject(t,i){let s={i,$:{}};this.keys.forEach((r,n)=>{let o=r.getFn?r.getFn(t):this.getFn(t,r.path);if(He(o)){if(ht(o)){let a=[];const h=[{nestedArrIndex:-1,value:o}];for(;h.length;){const{nestedArrIndex:l,value:f}=h.pop();if(He(f))if(Ze(f)&&!_s(f)){let d={v:f,i:l,n:this.norm.get(f)};a.push(d)}else ht(f)&&f.forEach((d,u)=>{h.push({nestedArrIndex:u,value:d})})}s.$[n]=a}else if(Ze(o)&&!_s(o)){let a={v:o,n:this.norm.get(o)};s.$[n]=a}}}),this.records.push(s)}toJSON(){return{keys:this.keys,records:this.records}}}function uo(e,t,{getFn:i=q.getFn,fieldNormWeight:s=q.fieldNormWeight}={}){const r=new Br({getFn:i,fieldNormWeight:s});return r.setKeys(e.map(co)),r.setSources(t),r.create(),r}function ch(e,{getFn:t=q.getFn,fieldNormWeight:i=q.fieldNormWeight}={}){const{keys:s,records:r}=e,n=new Br({getFn:t,fieldNormWeight:i});return n.setKeys(s),n.setIndexRecords(r),n}function ki(e,{errors:t=0,currentLocation:i=0,expectedLocation:s=0,distance:r=q.distance,ignoreLocation:n=q.ignoreLocation}={}){const o=t/e.length;if(n)return o;const a=Math.abs(s-i);return r?o+a/r:a?1:o}function uh(e=[],t=q.minMatchCharLength){let i=[],s=-1,r=-1,n=0;for(let o=e.length;n<o;n+=1){let a=e[n];a&&s===-1?s=n:!a&&s!==-1&&(r=n-1,r-s+1>=t&&i.push([s,r]),s=-1)}return e[n-1]&&n-s>=t&&i.push([s,n-1]),i}const Rt=32;function dh(e,t,i,{location:s=q.location,distance:r=q.distance,threshold:n=q.threshold,findAllMatches:o=q.findAllMatches,minMatchCharLength:a=q.minMatchCharLength,includeMatches:h=q.includeMatches,ignoreLocation:l=q.ignoreLocation}={}){if(t.length>Rt)throw new Error(Ql(Rt));const f=t.length,d=e.length,u=Math.max(0,Math.min(s,d));let c=n,p=u;const _=a>1||h,S=_?Array(d):[];let w;for(;(w=e.indexOf(t,p))>-1;){let x=ki(t,{currentLocation:w,expectedLocation:u,distance:r,ignoreLocation:l});if(c=Math.min(x,c),p=w+f,_){let $=0;for(;$<f;)S[w+$]=1,$+=1}}p=-1;let y=[],k=1,g=f+d;const C=1<<f-1;for(let x=0;x<f;x+=1){let $=0,H=g;for(;$<H;)ki(t,{errors:x,currentLocation:u+H,expectedLocation:u,distance:r,ignoreLocation:l})<=c?$=H:g=H,H=Math.floor((g-$)/2+$);g=H;let G=Math.max(1,u-H+1),V=o?d:Math.min(u+H,d)+f,I=Array(V+2);I[V+1]=(1<<x)-1;for(let R=V;R>=G;R-=1){let m=R-1,O=i[e.charAt(m)];if(_&&(S[m]=+!!O),I[R]=(I[R+1]<<1|1)&O,x&&(I[R]|=(y[R+1]|y[R])<<1|1|y[R+1]),I[R]&C&&(k=ki(t,{errors:x,currentLocation:m,expectedLocation:u,distance:r,ignoreLocation:l}),k<=c)){if(c=k,p=m,p<=u)break;G=Math.max(1,2*u-p)}}if(ki(t,{errors:x+1,currentLocation:u,expectedLocation:u,distance:r,ignoreLocation:l})>c)break;y=I}const L={isMatch:p>=0,score:Math.max(.001,k)};if(_){const x=uh(S,a);x.length?h&&(L.indices=x):L.isMatch=!1}return L}function fh(e){let t={};for(let i=0,s=e.length;i<s;i+=1){const r=e.charAt(i);t[r]=(t[r]||0)|1<<s-i-1}return t}const Vi=String.prototype.normalize?(e=>e.normalize("NFD").replace(/[\u0300-\u036F\u0483-\u0489\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u08D3-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u09FE\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0AFA-\u0AFF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B62\u0B63\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0C00-\u0C04\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0D00-\u0D03\u0D3B\u0D3C\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D82\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EB9\u0EBB\u0EBC\u0EC8-\u0ECD\u0F18\u0F19\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F\u109A-\u109D\u135D-\u135F\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u180B-\u180D\u1885\u1886\u18A9\u1920-\u192B\u1930-\u193B\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F\u1AB0-\u1ABE\u1B00-\u1B04\u1B34-\u1B44\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BE6-\u1BF3\u1C24-\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF2-\u1CF4\u1CF7-\u1CF9\u1DC0-\u1DF9\u1DFB-\u1DFF\u20D0-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA66F-\uA672\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA880\uA881\uA8B4-\uA8C5\uA8E0-\uA8F1\uA8FF\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9E5\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F]/g,"")):(e=>e);class fo{constructor(t,{location:i=q.location,threshold:s=q.threshold,distance:r=q.distance,includeMatches:n=q.includeMatches,findAllMatches:o=q.findAllMatches,minMatchCharLength:a=q.minMatchCharLength,isCaseSensitive:h=q.isCaseSensitive,ignoreDiacritics:l=q.ignoreDiacritics,ignoreLocation:f=q.ignoreLocation}={}){if(this.options={location:i,threshold:s,distance:r,includeMatches:n,findAllMatches:o,minMatchCharLength:a,isCaseSensitive:h,ignoreDiacritics:l,ignoreLocation:f},t=h?t:t.toLowerCase(),t=l?Vi(t):t,this.pattern=t,this.chunks=[],!this.pattern.length)return;const d=(c,p)=>{this.chunks.push({pattern:c,alphabet:fh(c),startIndex:p})},u=this.pattern.length;if(u>Rt){let c=0;const p=u%Rt,_=u-p;for(;c<_;)d(this.pattern.substr(c,Rt),c),c+=Rt;if(p){const S=u-Rt;d(this.pattern.substr(S),S)}}else d(this.pattern,0)}searchIn(t){const{isCaseSensitive:i,ignoreDiacritics:s,includeMatches:r}=this.options;if(t=i?t:t.toLowerCase(),t=s?Vi(t):t,this.pattern===t){let _={isMatch:!0,score:0};return r&&(_.indices=[[0,t.length-1]]),_}const{location:n,distance:o,threshold:a,findAllMatches:h,minMatchCharLength:l,ignoreLocation:f}=this.options;let d=[],u=0,c=!1;this.chunks.forEach(({pattern:_,alphabet:S,startIndex:w})=>{const{isMatch:y,score:k,indices:g}=dh(t,_,S,{location:n+w,distance:o,threshold:a,findAllMatches:h,minMatchCharLength:l,includeMatches:r,ignoreLocation:f});y&&(c=!0),u+=k,y&&g&&(d=[...d,...g])});let p={isMatch:c,score:c?u/this.chunks.length:1};return c&&r&&(p.indices=d),p}}class Et{constructor(t){this.pattern=t}static isMultiMatch(t){return qr(t,this.multiRegex)}static isSingleMatch(t){return qr(t,this.singleRegex)}search(){}}function qr(e,t){const i=e.match(t);return i?i[1]:null}class _h extends Et{constructor(t){super(t)}static get type(){return"exact"}static get multiRegex(){return/^="(.*)"$/}static get singleRegex(){return/^=(.*)$/}search(t){const i=t===this.pattern;return{isMatch:i,score:i?0:1,indices:[0,this.pattern.length-1]}}}class ph extends Et{constructor(t){super(t)}static get type(){return"inverse-exact"}static get multiRegex(){return/^!"(.*)"$/}static get singleRegex(){return/^!(.*)$/}search(t){const s=t.indexOf(this.pattern)===-1;return{isMatch:s,score:s?0:1,indices:[0,t.length-1]}}}class gh extends Et{constructor(t){super(t)}static get type(){return"prefix-exact"}static get multiRegex(){return/^\^"(.*)"$/}static get singleRegex(){return/^\^(.*)$/}search(t){const i=t.startsWith(this.pattern);return{isMatch:i,score:i?0:1,indices:[0,this.pattern.length-1]}}}class vh extends Et{constructor(t){super(t)}static get type(){return"inverse-prefix-exact"}static get multiRegex(){return/^!\^"(.*)"$/}static get singleRegex(){return/^!\^(.*)$/}search(t){const i=!t.startsWith(this.pattern);return{isMatch:i,score:i?0:1,indices:[0,t.length-1]}}}class mh extends Et{constructor(t){super(t)}static get type(){return"suffix-exact"}static get multiRegex(){return/^"(.*)"\$$/}static get singleRegex(){return/^(.*)\$$/}search(t){const i=t.endsWith(this.pattern);return{isMatch:i,score:i?0:1,indices:[t.length-this.pattern.length,t.length-1]}}}class Sh extends Et{constructor(t){super(t)}static get type(){return"inverse-suffix-exact"}static get multiRegex(){return/^!"(.*)"\$$/}static get singleRegex(){return/^!(.*)\$$/}search(t){const i=!t.endsWith(this.pattern);return{isMatch:i,score:i?0:1,indices:[0,t.length-1]}}}class _o extends Et{constructor(t,{location:i=q.location,threshold:s=q.threshold,distance:r=q.distance,includeMatches:n=q.includeMatches,findAllMatches:o=q.findAllMatches,minMatchCharLength:a=q.minMatchCharLength,isCaseSensitive:h=q.isCaseSensitive,ignoreDiacritics:l=q.ignoreDiacritics,ignoreLocation:f=q.ignoreLocation}={}){super(t),this._bitapSearch=new fo(t,{location:i,threshold:s,distance:r,includeMatches:n,findAllMatches:o,minMatchCharLength:a,isCaseSensitive:h,ignoreDiacritics:l,ignoreLocation:f})}static get type(){return"fuzzy"}static get multiRegex(){return/^"(.*)"$/}static get singleRegex(){return/^(.*)$/}search(t){return this._bitapSearch.searchIn(t)}}class po extends Et{constructor(t){super(t)}static get type(){return"include"}static get multiRegex(){return/^'"(.*)"$/}static get singleRegex(){return/^'(.*)$/}search(t){let i=0,s;const r=[],n=this.pattern.length;for(;(s=t.indexOf(this.pattern,i))>-1;)i=s+n,r.push([s,i-1]);const o=!!r.length;return{isMatch:o,score:o?0:1,indices:r}}}const As=[_h,po,gh,vh,Sh,mh,ph,_o],Kr=As.length,bh=/ +(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/,yh="|";function wh(e,t={}){return e.split(yh).map(i=>{let s=i.trim().split(bh).filter(n=>n&&!!n.trim()),r=[];for(let n=0,o=s.length;n<o;n+=1){const a=s[n];let h=!1,l=-1;for(;!h&&++l<Kr;){const f=As[l];let d=f.isMultiMatch(a);d&&(r.push(new f(d,t)),h=!0)}if(!h)for(l=-1;++l<Kr;){const f=As[l];let d=f.isSingleMatch(a);if(d){r.push(new f(d,t));break}}}return r})}const Ch=new Set([_o.type,po.type]);class kh{constructor(t,{isCaseSensitive:i=q.isCaseSensitive,ignoreDiacritics:s=q.ignoreDiacritics,includeMatches:r=q.includeMatches,minMatchCharLength:n=q.minMatchCharLength,ignoreLocation:o=q.ignoreLocation,findAllMatches:a=q.findAllMatches,location:h=q.location,threshold:l=q.threshold,distance:f=q.distance}={}){this.query=null,this.options={isCaseSensitive:i,ignoreDiacritics:s,includeMatches:r,minMatchCharLength:n,findAllMatches:a,ignoreLocation:o,location:h,threshold:l,distance:f},t=i?t:t.toLowerCase(),t=s?Vi(t):t,this.pattern=t,this.query=wh(this.pattern,this.options)}static condition(t,i){return i.useExtendedSearch}searchIn(t){const i=this.query;if(!i)return{isMatch:!1,score:1};const{includeMatches:s,isCaseSensitive:r,ignoreDiacritics:n}=this.options;t=r?t:t.toLowerCase(),t=n?Vi(t):t;let o=0,a=[],h=0;for(let l=0,f=i.length;l<f;l+=1){const d=i[l];a.length=0,o=0;for(let u=0,c=d.length;u<c;u+=1){const p=d[u],{isMatch:_,indices:S,score:w}=p.search(t);if(_){if(o+=1,h+=w,s){const y=p.constructor.type;Ch.has(y)?a=[...a,...S]:a.push(S)}}else{h=0,o=0,a.length=0;break}}if(o){let u={isMatch:!0,score:h/o};return s&&(u.indices=a),u}}return{isMatch:!1,score:1}}}const Ts=[];function xh(...e){Ts.push(...e)}function Is(e,t){for(let i=0,s=Ts.length;i<s;i+=1){let r=Ts[i];if(r.condition(e,t))return new r(e,t)}return new fo(e,t)}const ji={AND:"$and",OR:"$or"},Ps={PATH:"$path",PATTERN:"$val"},Os=e=>!!(e[ji.AND]||e[ji.OR]),Eh=e=>!!e[Ps.PATH],Bh=e=>!ht(e)&&lo(e)&&!Os(e),Ur=e=>({[ji.AND]:Object.keys(e).map(t=>({[t]:e[t]}))});function go(e,t,{auto:i=!0}={}){const s=r=>{let n=Object.keys(r);const o=Eh(r);if(!o&&n.length>1&&!Os(r))return s(Ur(r));if(Bh(r)){const h=o?r[Ps.PATH]:n[0],l=o?r[Ps.PATTERN]:r[h];if(!Ze(l))throw new Error(Zl(h));const f={keyId:Rs(h),pattern:l};return i&&(f.searcher=Is(l,t)),f}let a={children:[],operator:n[0]};return n.forEach(h=>{const l=r[h];ht(l)&&l.forEach(f=>{a.children.push(s(f))})}),a};return Os(e)||(e=Ur(e)),s(e)}function Lh(e,{ignoreFieldNorm:t=q.ignoreFieldNorm}){e.forEach(i=>{let s=1;i.matches.forEach(({key:r,norm:n,score:o})=>{const a=r?r.weight:null;s*=Math.pow(o===0&&a?Number.EPSILON:o,(a||1)*(t?1:n))}),i.score=s})}function Dh(e,t){const i=e.matches;t.matches=[],He(i)&&i.forEach(s=>{if(!He(s.indices)||!s.indices.length)return;const{indices:r,value:n}=s;let o={indices:r,value:n};s.key&&(o.key=s.key.src),s.idx>-1&&(o.refIndex=s.idx),t.matches.push(o)})}function Mh(e,t){t.score=e.score}function Rh(e,t,{includeMatches:i=q.includeMatches,includeScore:s=q.includeScore}={}){const r=[];return i&&r.push(Dh),s&&r.push(Mh),e.map(n=>{const{idx:o}=n,a={item:t[o],refIndex:o};return r.length&&r.forEach(h=>{h(n,a)}),a})}class Gt{constructor(t,i={},s){this.options={...q,...i},this.options.useExtendedSearch,this._keyStore=new ih(this.options.keys),this.setCollection(t,s)}setCollection(t,i){if(this._docs=t,i&&!(i instanceof Br))throw new Error(Jl);this._myIndex=i||uo(this.options.keys,this._docs,{getFn:this.options.getFn,fieldNormWeight:this.options.fieldNormWeight})}add(t){He(t)&&(this._docs.push(t),this._myIndex.add(t))}remove(t=()=>!1){const i=[];for(let s=0,r=this._docs.length;s<r;s+=1){const n=this._docs[s];t(n,s)&&(this.removeAt(s),s-=1,r-=1,i.push(n))}return i}removeAt(t){this._docs.splice(t,1),this._myIndex.removeAt(t)}getIndex(){return this._myIndex}search(t,{limit:i=-1}={}){const{includeMatches:s,includeScore:r,shouldSort:n,sortFn:o,ignoreFieldNorm:a}=this.options;let h=Ze(t)?Ze(this._docs[0])?this._searchStringList(t):this._searchObjectList(t):this._searchLogical(t);return Lh(h,{ignoreFieldNorm:a}),n&&h.sort(o),ao(i)&&i>-1&&(h=h.slice(0,i)),Rh(h,this._docs,{includeMatches:s,includeScore:r})}_searchStringList(t){const i=Is(t,this.options),{records:s}=this._myIndex,r=[];return s.forEach(({v:n,i:o,n:a})=>{if(!He(n))return;const{isMatch:h,score:l,indices:f}=i.searchIn(n);h&&r.push({item:n,idx:o,matches:[{score:l,value:n,norm:a,indices:f}]})}),r}_searchLogical(t){const i=go(t,this.options),s=(a,h,l)=>{if(!a.children){const{keyId:d,searcher:u}=a,c=this._findMatches({key:this._keyStore.get(d),value:this._myIndex.getValueForItemAtKeyId(h,d),searcher:u});return c&&c.length?[{idx:l,item:h,matches:c}]:[]}const f=[];for(let d=0,u=a.children.length;d<u;d+=1){const c=a.children[d],p=s(c,h,l);if(p.length)f.push(...p);else if(a.operator===ji.AND)return[]}return f},r=this._myIndex.records,n={},o=[];return r.forEach(({$:a,i:h})=>{if(He(a)){let l=s(i,a,h);l.length&&(n[h]||(n[h]={idx:h,item:a,matches:[]},o.push(n[h])),l.forEach(({matches:f})=>{n[h].matches.push(...f)}))}}),o}_searchObjectList(t){const i=Is(t,this.options),{keys:s,records:r}=this._myIndex,n=[];return r.forEach(({$:o,i:a})=>{if(!He(o))return;let h=[];s.forEach((l,f)=>{h.push(...this._findMatches({key:l,value:o[f],searcher:i}))}),h.length&&n.push({idx:a,item:o,matches:h})}),n}_findMatches({key:t,value:i,searcher:s}){if(!He(i))return[];let r=[];if(ht(i))i.forEach(({v:n,i:o,n:a})=>{if(!He(n))return;const{isMatch:h,score:l,indices:f}=s.searchIn(n);h&&r.push({score:l,key:t,value:n,idx:o,norm:a,indices:f})});else{const{v:n,n:o}=i,{isMatch:a,score:h,indices:l}=s.searchIn(n);a&&r.push({score:h,key:t,value:n,norm:o,indices:l})}return r}}Gt.version="7.1.0";Gt.createIndex=uo;Gt.parseIndex=ch;Gt.config=q;Gt.parseQuery=go;xh(kh);function Ah(e,t,i){const s=()=>{var n,o;return new Gt((n=ot(t))!==null&&n!==void 0?n:[],(o=ot(i))===null||o===void 0?void 0:o.fuseOptions)},r=X(s());return ke(()=>{var n;return(n=ot(i))===null||n===void 0?void 0:n.fuseOptions},()=>{r.value=s()},{deep:!0}),ke(()=>ot(t),n=>{r.value.setCollection(n)},{deep:!0}),{fuse:r,results:Z(()=>{const n=ot(i);if(n?.matchAllWhenSearchEmpty&&!ot(e))return ot(t).map((a,h)=>({item:a,refIndex:h}));const o=n?.resultLimit;return r.value.search(ot(e),o?{limit:o}:void 0)})}}function Th(e,t){let i="",s=0,r=!1;for(let n=e.length-1;n>=0;n--){if(e[n]===">")r=!0;else if(e[n]==="<"){r=!1,i=e[n]+i;continue}if(r||s++,s<=t)i=e[n]+i;else{i="..."+i;break}}return i}function Vr(e,t,i,s){function r(n,o=[]){n=n||"";let a="",h=0;o.forEach(f=>{if(f.length===2&&f[0]===f[1])return;const d=f[1]+1,u=d-f[0]>=t.length;a+=[n.substring(h,f[0]),u&&"<mark>",n.substring(f[0],d),u&&"</mark>"].filter(Boolean).join(""),h=d}),a+=n.substring(h);const l=a.indexOf("<mark>");return l!==-1&&(a=Th(a,a.length-l)),a}if(e.matches?.length){for(const n of e.matches)if(!(i&&n.key!==i)&&!s?.includes(n.key))return r(n.value,n.indices)}}const Ih={slots:{root:"flex flex-col min-h-0 min-w-0 divide-y divide-default",input:"[&>input]:h-12",close:"",back:"p-0",content:"relative overflow-hidden flex flex-col",footer:"p-1",viewport:"relative scroll-py-1 overflow-y-auto flex-1 focus:outline-none",group:"p-1 isolate",empty:"py-6 text-center text-sm text-muted",label:"p-1.5 text-xs font-semibold text-highlighted",item:"group relative w-full flex items-start gap-1.5 p-1.5 text-sm select-none outline-none before:absolute before:z-[-1] before:inset-px before:rounded-md data-disabled:cursor-not-allowed data-disabled:opacity-75",itemLeadingIcon:"shrink-0 size-5",itemLeadingAvatar:"shrink-0",itemLeadingAvatarSize:"2xs",itemLeadingChip:"shrink-0 size-5",itemLeadingChipSize:"md",itemTrailing:"ms-auto inline-flex gap-1.5 items-center",itemTrailingIcon:"shrink-0 size-5",itemTrailingHighlightedIcon:"shrink-0 size-5 text-dimmed hidden group-data-highlighted:inline-flex",itemTrailingKbds:"hidden lg:inline-flex items-center shrink-0 gap-0.5",itemTrailingKbdsSize:"md",itemWrapper:"flex-1 flex flex-col text-start min-w-0",itemLabel:"truncate space-x-1 text-dimmed",itemDescription:"truncate text-muted",itemLabelBase:"text-highlighted [&>mark]:text-inverted [&>mark]:bg-primary",itemLabelPrefix:"text-default",itemLabelSuffix:"text-dimmed [&>mark]:text-inverted [&>mark]:bg-primary"},variants:{virtualize:{true:{viewport:"p-1 isolate"},false:{viewport:"divide-y divide-default"}},active:{true:{item:"text-highlighted before:bg-elevated",itemLeadingIcon:"text-default"},false:{item:["text-default data-highlighted:not-data-disabled:text-highlighted data-highlighted:not-data-disabled:before:bg-elevated/50","transition-colors before:transition-colors"],itemLeadingIcon:["text-dimmed group-data-highlighted:not-group-data-disabled:text-default","transition-colors"]}},loading:{true:{itemLeadingIcon:"animate-spin"}}}},Ph=["innerHTML"],Oh=["innerHTML"],Nh=Object.assign({inheritAttrs:!1},{__name:"UCommandPalette",props:Ui({as:{type:null,required:!1},icon:{type:null,required:!1},trailingIcon:{type:null,required:!1},selectedIcon:{type:null,required:!1},childrenIcon:{type:null,required:!1},placeholder:{type:String,required:!1},autofocus:{type:Boolean,required:!1,default:!0},close:{type:[Boolean,Object],required:!1},closeIcon:{type:null,required:!1},back:{type:[Boolean,Object],required:!1,default:!0},backIcon:{type:null,required:!1},groups:{type:Array,required:!1},fuse:{type:Object,required:!1},virtualize:{type:[Boolean,Object],required:!1,default:!1},labelKey:{type:null,required:!1,default:"label"},descriptionKey:{type:null,required:!1,default:"description"},preserveGroupOrder:{type:Boolean,required:!1,default:!1},class:{type:null,required:!1},ui:{type:null,required:!1},multiple:{type:Boolean,required:!1},disabled:{type:Boolean,required:!1},modelValue:{type:null,required:!1,default:""},defaultValue:{type:null,required:!1},highlightOnHover:{type:Boolean,required:!1,default:!0},selectionBehavior:{type:String,required:!1},loading:{type:Boolean,required:!1},loadingIcon:{type:null,required:!1}},{searchTerm:{type:String,default:""},searchTermModifiers:{}}),emits:Ui(["update:modelValue","highlight","entryFocus","leave","update:open"],["update:searchTerm"]),setup(e,{emit:t}){const i=e,s=t,r=Yt(),n=di(e,"searchTerm",{type:String,default:""}),{t:o}=ts(),a=Nt(),h=ui(It(i,"as","disabled","multiple","modelValue","defaultValue","highlightOnHover"),s),l=qi(It(i,"loading")),f=et(()=>i.virtualize?kt(typeof i.virtualize=="boolean"?{}:i.virtualize,{estimateSize:rl(x.value,"md",i.descriptionKey)}):!1),[d,u]=Vt({props:{item:{type:Object,required:!0},group:{type:Object,required:!1},index:{type:Number,required:!1}}}),c=Z(()=>Oe({extend:Oe(Ih),...a.ui?.commandPalette||{}})({virtualize:!!i.virtualize})),p=Z(()=>kt({},i.fuse,{fuseOptions:{ignoreLocation:!0,threshold:.1,keys:[i.labelKey,"suffix"]},resultLimit:12,matchAllWhenSearchEmpty:!0})),_=X([]),S=Z(()=>_.value[_.value.length-1]?.placeholder||i.placeholder||o("commandPalette.placeholder")),w=Z(()=>_.value?.length?[_.value[_.value.length-1]]:i.groups),y=Z(()=>w.value?.filter(b=>b.id?!b.ignoreFilter:(console.warn("[@nuxt/ui] CommandPalette group is missing an `id` property"),!1))?.flatMap(b=>b.items?.map(R=>({...R,group:b.id}))||[])||[]),{results:k}=Ah(n,y,p),g=ya(k,16,!0);function C(b,R){let m=R;return b?.postFilter&&typeof b.postFilter=="function"&&(m=b.postFilter(n.value,m)),{...b,items:m.slice(0,p.value.resultLimit).map(O=>({...O,labelHtml:Vr(O,n.value,i.labelKey),suffixHtml:Vr(O,n.value,void 0,[i.labelKey])}))}}const L=Z(()=>{const b=w.value,R=g.value.reduce((M,D)=>{const{item:ee,matches:ie}=D;return ee.group&&(M[ee.group]||=[],M[ee.group]?.push({...ee,matches:ie})),M},{});if(i.preserveGroupOrder){const M=[];for(const D of b||[]){if(!D.items?.length)continue;const ee=D.ignoreFilter?D.items:R[D.id];if(!ee?.length)continue;const ie=C(D,ee);ie.items?.length&&M.push(ie)}return M}const m=Object.entries(R).map(([M,D])=>{const ee=b?.find(Ae=>Ae.id===M);if(!ee)return;const ie=C(ee,D);return ie.items?.length?ie:void 0}).filter(M=>!!M);return(b?.map((M,D)=>({...M,index:D}))?.filter(M=>M.ignoreFilter&&M.items?.length)?.map(M=>({...C(M,M.items||[]),index:M.index}))?.filter(M=>M.items?.length)||[]).reduce((M,D)=>(M.splice(D.index,0,D),M),[...m])}),x=Z(()=>L.value.flatMap(b=>b.items||[])),$=Xn("rootRef");function H(b){b.children?.length&&(_.value.push({id:`history-${_.value.length}`,label:b.label,slot:b.slot,placeholder:b.placeholder,items:b.children}),n.value="",$.value?.highlightFirstItem())}function G(){_.value.length&&(_.value.pop(),n.value="",$.value?.highlightFirstItem())}function V(){n.value||G()}function I(b,R){R.children?.length?(b.preventDefault(),H(R)):R.onSelect?.(b)}return(b,R)=>(B(),U(Ce,null,[P(v(d),null,{default:A(({item:m,index:O,group:M})=>[P(v(Xa),{value:v(Ki)(m,["matches","group","onSelect","labelHtml","suffixHtml","children"]),disabled:m.disabled,"as-child":"",onSelect:D=>I(D,m)},{default:A(()=>[P(Ai,Y(v(Ti)(m),{custom:""}),{default:A(({active:D,...ee})=>[P(Wt,Y(ee,{"data-slot":"item",class:c.value.item({class:[i.ui?.item,m.ui?.item,m.class],active:D||m.active})}),{default:A(()=>[j(b.$slots,m.slot||M?.slot||"item",{item:m,index:O,ui:c.value},()=>[j(b.$slots,m.slot?`${m.slot}-leading`:M?.slot?`${M.slot}-leading`:"item-leading",{item:m,index:O,ui:c.value},()=>[m.loading?(B(),z(me,{key:0,name:e.loadingIcon||v(a).ui.icons.loading,"data-slot":"itemLeadingIcon",class:F(c.value.itemLeadingIcon({class:[i.ui?.itemLeadingIcon,m.ui?.itemLeadingIcon],loading:!0}))},null,8,["name","class"])):m.icon?(B(),z(me,{key:1,name:m.icon,"data-slot":"itemLeadingIcon",class:F(c.value.itemLeadingIcon({class:[i.ui?.itemLeadingIcon,m.ui?.itemLeadingIcon],active:D||m.active}))},null,8,["name","class"])):m.avatar?(B(),z(wr,Y({key:2,size:m.ui?.itemLeadingAvatarSize||i.ui?.itemLeadingAvatarSize||c.value.itemLeadingAvatarSize()},m.avatar,{"data-slot":"itemLeadingAvatar",class:c.value.itemLeadingAvatar({class:[i.ui?.itemLeadingAvatar,m.ui?.itemLeadingAvatar],active:D||m.active})}),null,16,["size","class"])):m.chip?(B(),z(wa,Y({key:3,size:m.ui?.itemLeadingChipSize||i.ui?.itemLeadingChipSize||c.value.itemLeadingChipSize(),inset:"",standalone:""},m.chip,{"data-slot":"itemLeadingChip",class:c.value.itemLeadingChip({class:[i.ui?.itemLeadingChip,m.ui?.itemLeadingChip],active:D||m.active})}),null,16,["size","class"])):W("",!0)]),m.prefix||m.labelHtml||v(Pe)(m,i.labelKey)||m.suffixHtml||m.suffix||r[m.slot?`${m.slot}-label`:M?.slot?`${M.slot}-label`:"item-label"]||v(Pe)(m,i.descriptionKey)||r[m.slot?`${m.slot}-description`:M?.slot?`${M.slot}-description`:"item-description"]?(B(),U("span",{key:0,"data-slot":"itemWrapper",class:F(c.value.itemWrapper({class:[i.ui?.itemWrapper,m.ui?.itemWrapper]}))},[te("span",{"data-slot":"itemLabel",class:F(c.value.itemLabel({class:[i.ui?.itemLabel,m.ui?.itemLabel],active:D||m.active}))},[j(b.$slots,m.slot?`${m.slot}-label`:M?.slot?`${M.slot}-label`:"item-label",{item:m,index:O,ui:c.value},()=>[m.prefix?(B(),U("span",{key:0,"data-slot":"itemLabelPrefix",class:F(c.value.itemLabelPrefix({class:[i.ui?.itemLabelPrefix,m.ui?.itemLabelPrefix]}))},Be(m.prefix),3)):W("",!0),m.labelHtml?(B(),U("span",{key:1,"data-slot":"itemLabelBase",class:F(c.value.itemLabelBase({class:[i.ui?.itemLabelBase,m.ui?.itemLabelBase],active:D||m.active})),innerHTML:m.labelHtml},null,10,Ph)):(B(),U("span",{key:2,"data-slot":"itemLabelBase",class:F(c.value.itemLabelBase({class:[i.ui?.itemLabelBase,m.ui?.itemLabelBase],active:D||m.active}))},Be(v(Pe)(m,i.labelKey)),3)),m.suffixHtml?(B(),U("span",{key:3,"data-slot":"itemLabelSuffix",class:F(c.value.itemLabelSuffix({class:[i.ui?.itemLabelSuffix,m.ui?.itemLabelSuffix],active:D||m.active})),innerHTML:m.suffixHtml},null,10,Oh)):m.suffix?(B(),U("span",{key:4,"data-slot":"itemLabelSuffix",class:F(c.value.itemLabelSuffix({class:[i.ui?.itemLabelSuffix,m.ui?.itemLabelSuffix],active:D||m.active}))},Be(m.suffix),3)):W("",!0)])],2),v(Pe)(m,i.descriptionKey)?(B(),U("span",{key:0,"data-slot":"itemDescription",class:F(c.value.itemDescription({class:[i.ui?.itemDescription,m.ui?.itemDescription]}))},[j(b.$slots,m.slot?`${m.slot}-description`:M?.slot?`${M.slot}-description`:"item-description",{item:m,index:O,ui:c.value},()=>[tt(Be(v(Pe)(m,i.descriptionKey)),1)])],2)):W("",!0)],2)):W("",!0),te("span",{"data-slot":"itemTrailing",class:F(c.value.itemTrailing({class:[i.ui?.itemTrailing,m.ui?.itemTrailing]}))},[j(b.$slots,m.slot?`${m.slot}-trailing`:M?.slot?`${M.slot}-trailing`:"item-trailing",{item:m,index:O,ui:c.value},()=>[m.children&&m.children.length>0?(B(),z(me,{key:0,name:e.childrenIcon||v(a).ui.icons.chevronRight,"data-slot":"itemTrailingIcon",class:F(c.value.itemTrailingIcon({class:[i.ui?.itemTrailingIcon,m.ui?.itemTrailingIcon]}))},null,8,["name","class"])):m.kbds?.length?(B(),U("span",{key:1,"data-slot":"itemTrailingKbds",class:F(c.value.itemTrailingKbds({class:[i.ui?.itemTrailingKbds,m.ui?.itemTrailingKbds]}))},[(B(!0),U(Ce,null,Ue(m.kbds,(ie,Ae)=>(B(),z(Cr,Y({key:Ae,size:m.ui?.itemTrailingKbdsSize||i.ui?.itemTrailingKbdsSize||c.value.itemTrailingKbdsSize()},{ref_for:!0},typeof ie=="string"?{value:ie}:ie),null,16,["size"]))),128))],2)):M?.highlightedIcon?(B(),z(me,{key:2,name:M.highlightedIcon,"data-slot":"itemTrailingHighlightedIcon",class:F(c.value.itemTrailingHighlightedIcon({class:[i.ui?.itemTrailingHighlightedIcon,m.ui?.itemTrailingHighlightedIcon]}))},null,8,["name","class"])):W("",!0)]),m.children?.length?W("",!0):(B(),z(v(Ja),{key:0,"as-child":""},{default:A(()=>[P(me,{name:e.selectedIcon||v(a).ui.icons.check,"data-slot":"itemTrailingIcon",class:F(c.value.itemTrailingIcon({class:[i.ui?.itemTrailingIcon,m.ui?.itemTrailingIcon]}))},null,8,["name","class"])]),_:2},1024))],2)])]),_:2},1040,["class"])]),_:2},1040)]),_:2},1032,["value","disabled","onSelect"])]),_:3}),P(v(il),Y({...v(h),...b.$attrs},{ref_key:"rootRef",ref:$,"selection-behavior":e.selectionBehavior,"data-slot":"root",class:c.value.root({class:[i.ui?.root,i.class]})}),{default:A(()=>[P(v(Za),{modelValue:n.value,"onUpdate:modelValue":R[1]||(R[1]=m=>n.value=m),"as-child":""},{default:A(()=>[P(nl,Y({placeholder:S.value,variant:"none",autofocus:e.autofocus},v(l),{"loading-icon":e.loadingIcon,"trailing-icon":e.trailingIcon,icon:e.icon||v(a).ui.icons.search,"data-slot":"input",class:c.value.input({class:i.ui?.input}),onKeydown:Un(V,["backspace"])}),is({_:2},[_.value?.length&&(e.back||r.back)?{name:"leading",fn:A(()=>[j(b.$slots,"back",{ui:c.value},()=>[P(xt,Y({icon:e.backIcon||v(a).ui.icons.arrowLeft,color:"neutral",variant:"link","aria-label":v(o)("commandPalette.back")},typeof e.back=="object"?e.back:{},{"data-slot":"back",class:c.value.back({class:i.ui?.back}),onClick:G}),null,16,["icon","aria-label","class"])])]),key:"0"}:void 0,e.close||r.close?{name:"trailing",fn:A(()=>[j(b.$slots,"close",{ui:c.value},()=>[e.close?(B(),z(xt,Y({key:0,icon:e.closeIcon||v(a).ui.icons.close,color:"neutral",variant:"ghost","aria-label":v(o)("commandPalette.close")},typeof e.close=="object"?e.close:{},{"data-slot":"close",class:c.value.close({class:i.ui?.close}),onClick:R[0]||(R[0]=m=>s("update:open",!1))}),null,16,["icon","aria-label","class"])):W("",!0)])]),key:"1"}:void 0]),1040,["placeholder","autofocus","loading-icon","trailing-icon","icon","class"])]),_:3},8,["modelValue"]),P(v(Qa),{"data-slot":"content",class:F(c.value.content({class:i.ui?.content}))},{default:A(()=>[L.value?.length?(B(),U("div",{key:0,role:"presentation","data-slot":"viewport",class:F(c.value.viewport({class:i.ui?.viewport}))},[e.virtualize?(B(),z(v(el),Y({key:0,options:x.value,"text-content":m=>v(Pe)(m,i.labelKey)},f.value),{default:A(({option:m,virtualItem:O})=>[P(v(u),{item:m,index:O.index},null,8,["item","index"])]),_:1},16,["options","text-content"])):(B(!0),U(Ce,{key:1},Ue(L.value,m=>(B(),z(v(tl),{key:`group-${m.id}`,"data-slot":"group",class:F(c.value.group({class:i.ui?.group}))},{default:A(()=>[v(Pe)(m,i.labelKey)?(B(),z(v(pl),{key:0,"data-slot":"label",class:F(c.value.label({class:i.ui?.label}))},{default:A(()=>[tt(Be(v(Pe)(m,i.labelKey)),1)]),_:2},1032,["class"])):W("",!0),(B(!0),U(Ce,null,Ue(m.items,(O,M)=>(B(),z(v(u),{key:`group-${m.id}-${M}`,item:O,index:M,group:m},null,8,["item","index","group"]))),128))]),_:2},1032,["class"]))),128))],2)):(B(),U("div",{key:1,"data-slot":"empty",class:F(c.value.empty({class:i.ui?.empty}))},[j(b.$slots,"empty",{searchTerm:n.value},()=>[tt(Be(n.value?v(o)("commandPalette.noMatch",{searchTerm:n.value}):v(o)("commandPalette.noData")),1)])],2))]),_:3},8,["class"]),r.footer?(B(),U("div",{key:0,"data-slot":"footer",class:F(c.value.footer({class:i.ui?.footer}))},[j(b.$slots,"footer",{ui:c.value})],2)):W("",!0)]),_:3},16,["selection-behavior","class"])],64))}}),zh={slots:{modal:"",input:"[&>input]:text-base/5"},variants:{fullscreen:{false:{modal:"sm:max-w-3xl h-full sm:h-[28rem]"}}}},Fh=/^[^-]+.*-.*[^-]+$/,Hh=/^[^_]+.*_.*[^_]+$/,jr=["arrowleft","arrowright","arrowup","arrowright","tab","escape","enter","backspace"];function ps(e){return/^[a-z]$/i.test(e)?`Key${e.toUpperCase()}`:/^\d$/.test(e)?`Digit${e}`:/^f\d+$/i.test(e)?e.toUpperCase():{space:"Space",enter:"Enter",escape:"Escape",tab:"Tab",backspace:"Backspace",delete:"Delete",arrowup:"ArrowUp",arrowdown:"ArrowDown",arrowleft:"ArrowLeft",arrowright:"ArrowRight"}[e.toLowerCase()]||e}function $h(e,t={}){const i=X([]),s=()=>{i.value.splice(0,i.value.length)},r=Ca(s,t.chainDelay??800),{macOS:n}=Na(),o=Ra(),a=t.layoutIndependent??!1,h=jr.map(u=>ps(u)),l=u=>{if(!u.key)return;const c=a?/^Key[A-Z]$/i.test(u.code):/^[a-z]{1}$/i.test(u.key),p=a?h.includes(u.code):jr.includes(u.key.toLowerCase());let _;if(i.value.push(a?u.code:u.key),i.value.length>=2){_=i.value.slice(-2).join("-");for(const S of d.value.filter(w=>w.chained))if(S.key===_){S.enabled&&(u.preventDefault(),S.handler(u)),s();return}}for(const S of d.value.filter(w=>!w.chained)){if(a){if(u.code!==S.key)continue}else if(u.key.toLowerCase()!==S.key)continue;if(u.metaKey===S.metaKey&&u.ctrlKey===S.ctrlKey&&!((c||p)&&u.shiftKey!==S.shiftKey)){S.enabled&&(u.preventDefault(),S.handler(u)),s();return}}r()},f=Z(()=>{const u=o.value?.tagName,c=o.value?.contentEditable;return u==="INPUT"||u==="TEXTAREA"||c==="true"||c==="plaintext-only"?o.value?.name||!0:!1}),d=Z(()=>Object.entries(ot(e)).map(([u,c])=>{if(!c)return null;let p;u.includes("-")&&u!=="-"&&!u.includes("_")&&!u.match(Fh)?.length&&console.trace(`[Shortcut] Invalid key: "${u}"`),u.includes("_")&&u!=="_"&&!u.match(Hh)?.length&&console.trace(`[Shortcut] Invalid key: "${u}"`);const _=u.includes("-")&&u!=="-"&&!u.includes("_");if(_)a?p={key:u.split("-").map(y=>ps(y)).join("-"),metaKey:!1,ctrlKey:!1,shiftKey:!1,altKey:!1}:p={key:u.toLowerCase(),metaKey:!1,ctrlKey:!1,shiftKey:!1,altKey:!1};else{const w=u.toLowerCase().split("_").map(k=>k);let y=w.filter(k=>!["meta","command","ctrl","shift","alt","option"].includes(k)).join("_");a&&(y=ps(y)),p={key:y,metaKey:w.includes("meta")||w.includes("command"),ctrlKey:w.includes("ctrl"),shiftKey:w.includes("shift"),altKey:w.includes("alt")||w.includes("option")}}if(p.chained=_,!n.value&&p.metaKey&&!p.ctrlKey&&(p.metaKey=!1,p.ctrlKey=!0),typeof c=="function"?p.handler=c:typeof c=="object"&&(p={...p,handler:c.handler}),!p.handler)return console.trace("[Shortcut] Invalid value"),null;let S=!0;return c.usingInput?typeof c.usingInput=="string"&&(S=f.value===c.usingInput):S=!f.value,p.enabled=S,p}).filter(Boolean));return Aa("keydown",l)}const Wh={__name:"UDashboardSearch",props:Ui({icon:{type:null,required:!1},placeholder:{type:String,required:!1},autofocus:{type:Boolean,required:!1},loading:{type:Boolean,required:!1},loadingIcon:{type:null,required:!1},close:{type:[Boolean,Object],required:!1,default:!0},closeIcon:{type:null,required:!1},shortcut:{type:String,required:!1,default:"meta_k"},groups:{type:Array,required:!1},fuse:{type:Object,required:!1},colorMode:{type:Boolean,required:!1,default:!0},class:{type:null,required:!1},ui:{type:void 0,required:!1},title:{type:String,required:!1},description:{type:String,required:!1},overlay:{type:Boolean,required:!1},transition:{type:Boolean,required:!1},content:{type:Object,required:!1},dismissible:{type:Boolean,required:!1},fullscreen:{type:Boolean,required:!1,default:!1},modal:{type:Boolean,required:!1},portal:{type:[Boolean,String],required:!1,skipCheck:!0}},{open:{type:Boolean,default:!1},openModifiers:{},searchTerm:{type:String,default:""},searchTermModifiers:{}}),emits:["update:open","update:searchTerm"],setup(e,{expose:t}){const i=e,s=Yt(),r=di(e,"open",{type:Boolean,default:!1}),n=di(e,"searchTerm",{type:String,default:""});Ms("dashboard:search:toggle",()=>{r.value=!r.value});const{t:o}=ts(),a=ka(),h=Nt(),l=qi(It(i,"icon","placeholder","autofocus","loading","loadingIcon","close","closeIcon")),f=qi(It(i,"overlay","transition","content","dismissible","fullscreen","modal","portal")),d=()=>Ki(s,["content"]),u=Z(()=>kt({},i.fuse,{fuseOptions:{}})),c=Z(()=>Oe({extend:Oe(zh),...h.ui?.dashboardSearch||{}})({fullscreen:i.fullscreen})),p=Z(()=>{const w=[];return w.push(...i.groups||[]),i.colorMode&&!a?.forced&&w.push({id:"theme",label:o("dashboardSearch.theme"),items:[{label:o("colorMode.system"),icon:h.ui.icons.system,active:a.preference==="system",onSelect:()=>{a.preference="system"}},{label:o("colorMode.light"),icon:h.ui.icons.light,active:a.preference==="light",onSelect:()=>{a.preference="light"}},{label:o("colorMode.dark"),icon:h.ui.icons.dark,active:a.preference==="dark",onSelect:()=>{a.preference="dark"}}]}),w}),_=Xn("commandPaletteRef");function S(w){w.disabled||(r.value=!1,n.value="")}return $h({[i.shortcut]:{usingInput:!0,handler:()=>r.value=!r.value}}),t({commandPaletteRef:_}),(w,y)=>(B(),z(kr,Y({open:r.value,"onUpdate:open":y[2]||(y[2]=k=>r.value=k),title:e.title||v(o)("dashboardSearch.title"),description:e.description||v(o)("dashboardSearch.description")},v(f),{"data-slot":"modal",class:c.value.modal({class:[i.ui?.modal,i.class]})}),{content:A(k=>[j(w.$slots,"content",bt(yt(k)),()=>[P(Nh,Y({ref_key:"commandPaletteRef",ref:_,"search-term":n.value,"onUpdate:searchTerm":y[0]||(y[0]=g=>n.value=g)},v(l),{groups:p.value,fuse:u.value,ui:v(Yn)(v(Ki)(c.value,["modal"]),i.ui),"onUpdate:modelValue":S,"onUpdate:open":y[1]||(y[1]=g=>r.value=g)}),is({_:2},[Ue(d(),(g,C)=>({name:C,fn:A(L=>[j(w.$slots,C,bt(yt(L)))])}))]),1040,["search-term","groups","fuse","ui"])])]),_:3},16,["open","title","description","class"]))}},xi={tasks:[],documents:[],agents:[],conversations:[]};function qh(){const e=X(""),t=xa(e,300),i=X(!1),s=X({...xi});ke(t,async n=>{if(!n||n.length<2){s.value={...xi};return}i.value=!0;try{const[o,a,h,l]=await Promise.all([$fetch("/api/tasks",{query:{search:n}}),$fetch("/api/documents",{query:{search:n}}),$fetch("/api/agents",{query:{search:n}}),$fetch("/api/conversations",{query:{search:n}})]);s.value={tasks:o.data.slice(0,5),documents:a.data.slice(0,5),agents:h.data.slice(0,5),conversations:l.data.slice(0,5)}}catch{s.value={...xi}}finally{i.value=!1}});function r(){e.value="",s.value={...xi}}return{searchTerm:e,loading:i,results:s,reset:r}}const Kh=Le({__name:"DashboardSearch",setup(e){const t=Ea(),i=Ba(),{searchTerm:s,loading:r,results:n,reset:o}=qh(),a={todo:"i-lucide-circle",in_progress:"i-lucide-clock",done:"i-lucide-check-circle",blocked:"i-lucide-alert-circle"},h={1:"Low",2:"Medium",3:"High"},l=[{label:"Dashboard",icon:"i-lucide-layout-dashboard",to:"/dashboard",kbds:["G","D"]},{label:"Tasks",icon:"i-lucide-check-square",to:"/tasks",kbds:["G","T"]},{label:"Docs",icon:"i-lucide-file-text",to:"/docs",kbds:["G","O"]},{label:"Settings",icon:"i-lucide-settings",to:"/settings",kbds:["G","S"]}],f=[{label:"Create new document",icon:"i-lucide-file-plus",onSelect:()=>{t.push("/docs"),i.add({title:"Create a document",description:"Right-click in the file tree to create a new file",icon:"i-lucide-info"}),o()}},{label:"Add new task",icon:"i-lucide-plus-square",onSelect:()=>{t.push("/tasks?action=new"),o()}}],d=Z(()=>{const u=[];return n.value.tasks.length&&u.push({id:"tasks",label:"Tasks",ignoreFilter:!0,items:n.value.tasks.map(c=>({label:c.title,icon:a[c.status]||"i-lucide-circle",suffix:c.project?.name||h[c.priority]||"",onSelect:()=>{t.push(`/tasks?selected=${c.id}`),o()}}))}),n.value.documents.length&&u.push({id:"documents",label:"Documents",ignoreFilter:!0,items:n.value.documents.map(c=>({label:c.title,icon:"i-lucide-file-text",suffix:c.path,onSelect:()=>{t.push(`/docs?path=${encodeURIComponent(c.path)}`),o()}}))}),n.value.agents.length&&u.push({id:"agents",label:"Agents",ignoreFilter:!0,items:n.value.agents.map(c=>({label:c.name,icon:c.enabled?"i-lucide-bot":"i-lucide-bot-off",suffix:c.schedule,onSelect:()=>{t.push(`/agents/${c.id}`),o()}}))}),n.value.conversations.length&&u.push({id:"conversations",label:"Conversations",ignoreFilter:!0,items:n.value.conversations.map(c=>({label:c.title||"Untitled chat",icon:"i-lucide-message-square",suffix:ol(c.startedAt),onSelect:()=>{t.push({path:"/chat",query:{conversation:c.id}}),o()}}))}),u.push({id:"navigation",label:"Navigation",items:l}),u.push({id:"actions",label:"Actions",items:f,postFilter:(c,p)=>{if(!c)return p;const _=c.toLowerCase();return["new","create","add"].some(S=>_.includes(S))?p:[]}}),u});return(u,c)=>{const p=Wh;return B(),z(p,{"search-term":v(s),"onUpdate:searchTerm":c[0]||(c[0]=_=>vi(s)?s.value=_:null),groups:v(d),loading:v(r),placeholder:"Search tasks, docs, agents, chats...",fuse:{resultLimit:10}},null,8,["search-term","groups","loading"])}}}),Uh=Object.assign(Kh,{__name:"SearchDashboardSearch"}),Vh={class:"flex flex-col flex-1 min-h-0"},jh={class:"flex items-center gap-2 px-3 py-2 border-b border-default"},Yh={key:0,class:"absolute inset-0 flex items-center justify-center bg-elevated/80 z-10"},Gh={key:1,class:"flex flex-col items-center justify-center h-full text-dimmed"},Xh=Le({__name:"AssistantChat",props:{active:{type:Boolean}},setup(e,{expose:t}){const i=e,{assistantLastConversationId:s}=ss(),{connectionStatus:r,sessionStatus:n,activeConversationId:o,messages:a,conversations:h,streamingText:l,streamingToolCalls:f,loading:d,connect:u,sendMessage:c,interrupt:p,startNewConversation:_,loadConversation:S,loadConversations:w}=so(),y=X(null),k=Z(()=>h.value.map(H=>({label:H.title||`Chat ${new Date(H.startedAt).toLocaleDateString()}`,value:H.id}))),g=X(s.value??void 0);ke(g,H=>{s.value=H??null,H&&H!==o.value&&S(H)}),ke(o,H=>{H&&(g.value=H)});function C(H){c(H),Ut(x)}function L(){_(),g.value=void 0}function x(){y.value&&(y.value.scrollTop=y.value.scrollHeight)}ke(l,()=>Ut(x)),ke(()=>a.value.length,()=>Ut(x));function $(){u(),w(),s.value&&!o.value&&S(s.value)}return ke(()=>i.active,H=>{H&&$()},{immediate:!0}),t({connectionStatus:r}),(H,G)=>{const V=sl,I=xt,b=me,R=hl,m=cl,O=ll;return B(),U("div",Vh,[te("div",jh,[P(V,{modelValue:v(g),"onUpdate:modelValue":G[0]||(G[0]=M=>vi(g)?g.value=M:null),items:v(k),"value-key":"value",placeholder:"New conversation",size:"xs",class:"flex-1",icon:"i-lucide-messages-square"},null,8,["modelValue","items"]),P(I,{icon:"i-lucide-plus",size:"xs",color:"primary",variant:"soft",onClick:L})]),te("div",{ref_key:"messagesContainer",ref:y,class:"relative flex-1 overflow-y-auto p-3 space-y-3"},[v(d)?(B(),U("div",Yh,[P(b,{name:"i-lucide-loader-2",class:"size-6 animate-spin text-primary"})])):W("",!0),v(a).length===0&&v(n)!=="streaming"&&!v(d)?(B(),U("div",Gh,[P(b,{name:"i-lucide-message-square",class:"size-8 mb-2"}),G[1]||(G[1]=te("p",{class:"text-sm"}," Send a message to start chatting ",-1))])):W("",!0),(B(!0),U(Ce,null,Ue(v(a),M=>(B(),z(R,{key:M.id,message:M},null,8,["message"]))),128)),v(n)==="streaming"?(B(),z(m,{key:2,text:v(l),"tool-calls":v(f)},null,8,["text","tool-calls"])):W("",!0)],512),P(O,{"session-status":v(n),"connection-status":v(r),onSend:C,onInterrupt:v(p)},null,8,["session-status","connection-status","onInterrupt"])])}}}),Jh=Object.assign(Xh,{__name:"AssistantChat"});var vo=Object.defineProperty,Zh=Object.getOwnPropertyDescriptor,Qh=(e,t)=>{for(var i in t)vo(e,i,{get:t[i],enumerable:!0})},ce=(e,t,i,s)=>{for(var r=s>1?void 0:s?Zh(t,i):t,n=e.length-1,o;n>=0;n--)(o=e[n])&&(r=(s?o(t,i,r):o(r))||r);return s&&r&&vo(t,i,r),r},N=(e,t)=>(i,s)=>t(i,s,e),Yr="Terminal input",Ns={get:()=>Yr,set:e=>Yr=e},Gr="Too much output to announce, navigate to rows manually to read",zs={get:()=>Gr,set:e=>Gr=e};function ec(e){return e.replace(/\r?\n/g,"\r")}function tc(e,t){return t?"\x1B[200~"+e+"\x1B[201~":e}function ic(e,t){e.clipboardData&&e.clipboardData.setData("text/plain",t.selectionText),e.preventDefault()}function sc(e,t,i,s){if(e.stopPropagation(),e.clipboardData){let r=e.clipboardData.getData("text/plain");mo(r,t,i,s)}}function mo(e,t,i,s){e=ec(e),e=tc(e,i.decPrivateModes.bracketedPasteMode&&s.rawOptions.ignoreBracketedPasteMode!==!0),i.triggerDataEvent(e,!0),t.value=""}function So(e,t,i){let s=i.getBoundingClientRect(),r=e.clientX-s.left-10,n=e.clientY-s.top-10;t.style.width="20px",t.style.height="20px",t.style.left=`${r}px`,t.style.top=`${n}px`,t.style.zIndex="1000",t.focus()}function Xr(e,t,i,s,r){So(e,t,i),r&&s.rightClickSelect(e),t.value=s.selectionText,t.select()}function St(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function ns(e,t=0,i=e.length){let s="";for(let r=t;r<i;++r){let n=e[r];n>65535?(n-=65536,s+=String.fromCharCode((n>>10)+55296)+String.fromCharCode(n%1024+56320)):s+=String.fromCharCode(n)}return s}var rc=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){let i=e.length;if(!i)return 0;let s=0,r=0;if(this._interim){let n=e.charCodeAt(r++);56320<=n&&n<=57343?t[s++]=(this._interim-55296)*1024+n-56320+65536:(t[s++]=this._interim,t[s++]=n),this._interim=0}for(let n=r;n<i;++n){let o=e.charCodeAt(n);if(55296<=o&&o<=56319){if(++n>=i)return this._interim=o,s;let a=e.charCodeAt(n);56320<=a&&a<=57343?t[s++]=(o-55296)*1024+a-56320+65536:(t[s++]=o,t[s++]=a);continue}o!==65279&&(t[s++]=o)}return s}},nc=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){let i=e.length;if(!i)return 0;let s=0,r,n,o,a,h=0,l=0;if(this.interim[0]){let u=!1,c=this.interim[0];c&=(c&224)===192?31:(c&240)===224?15:7;let p=0,_;for(;(_=this.interim[++p]&63)&&p<4;)c<<=6,c|=_;let S=(this.interim[0]&224)===192?2:(this.interim[0]&240)===224?3:4,w=S-p;for(;l<w;){if(l>=i)return 0;if(_=e[l++],(_&192)!==128){l--,u=!0;break}else this.interim[p++]=_,c<<=6,c|=_&63}u||(S===2?c<128?l--:t[s++]=c:S===3?c<2048||c>=55296&&c<=57343||c===65279||(t[s++]=c):c<65536||c>1114111||(t[s++]=c)),this.interim.fill(0)}let f=i-4,d=l;for(;d<i;){for(;d<f&&!((r=e[d])&128)&&!((n=e[d+1])&128)&&!((o=e[d+2])&128)&&!((a=e[d+3])&128);)t[s++]=r,t[s++]=n,t[s++]=o,t[s++]=a,d+=4;if(r=e[d++],r<128)t[s++]=r;else if((r&224)===192){if(d>=i)return this.interim[0]=r,s;if(n=e[d++],(n&192)!==128){d--;continue}if(h=(r&31)<<6|n&63,h<128){d--;continue}t[s++]=h}else if((r&240)===224){if(d>=i)return this.interim[0]=r,s;if(n=e[d++],(n&192)!==128){d--;continue}if(d>=i)return this.interim[0]=r,this.interim[1]=n,s;if(o=e[d++],(o&192)!==128){d--;continue}if(h=(r&15)<<12|(n&63)<<6|o&63,h<2048||h>=55296&&h<=57343||h===65279)continue;t[s++]=h}else if((r&248)===240){if(d>=i)return this.interim[0]=r,s;if(n=e[d++],(n&192)!==128){d--;continue}if(d>=i)return this.interim[0]=r,this.interim[1]=n,s;if(o=e[d++],(o&192)!==128){d--;continue}if(d>=i)return this.interim[0]=r,this.interim[1]=n,this.interim[2]=o,s;if(a=e[d++],(a&192)!==128){d--;continue}if(h=(r&7)<<18|(n&63)<<12|(o&63)<<6|a&63,h<65536||h>1114111)continue;t[s++]=h}}return s}},bo="",wt=" ",mi=class yo{constructor(){this.fg=0,this.bg=0,this.extended=new Yi}static toColorRGB(t){return[t>>>16&255,t>>>8&255,t&255]}static fromColorRGB(t){return(t[0]&255)<<16|(t[1]&255)<<8|t[2]&255}clone(){let t=new yo;return t.fg=this.fg,t.bg=this.bg,t.extended=this.extended.clone(),t}isInverse(){return this.fg&67108864}isBold(){return this.fg&134217728}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:this.fg&268435456}isBlink(){return this.fg&536870912}isInvisible(){return this.fg&1073741824}isItalic(){return this.bg&67108864}isDim(){return this.bg&134217728}isStrikethrough(){return this.fg&2147483648}isProtected(){return this.bg&536870912}isOverline(){return this.bg&1073741824}getFgColorMode(){return this.fg&50331648}getBgColorMode(){return this.bg&50331648}isFgRGB(){return(this.fg&50331648)===50331648}isBgRGB(){return(this.bg&50331648)===50331648}isFgPalette(){return(this.fg&50331648)===16777216||(this.fg&50331648)===33554432}isBgPalette(){return(this.bg&50331648)===16777216||(this.bg&50331648)===33554432}isFgDefault(){return(this.fg&50331648)===0}isBgDefault(){return(this.bg&50331648)===0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(this.fg&50331648){case 16777216:case 33554432:return this.fg&255;case 50331648:return this.fg&16777215;default:return-1}}getBgColor(){switch(this.bg&50331648){case 16777216:case 33554432:return this.bg&255;case 50331648:return this.bg&16777215;default:return-1}}hasExtendedAttrs(){return this.bg&268435456}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(this.bg&268435456&&~this.extended.underlineColor)switch(this.extended.underlineColor&50331648){case 16777216:case 33554432:return this.extended.underlineColor&255;case 50331648:return this.extended.underlineColor&16777215;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return this.bg&268435456&&~this.extended.underlineColor?this.extended.underlineColor&50331648:this.getFgColorMode()}isUnderlineColorRGB(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===50331648:this.isFgRGB()}isUnderlineColorPalette(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===16777216||(this.extended.underlineColor&50331648)===33554432:this.isFgPalette()}isUnderlineColorDefault(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===0:this.isFgDefault()}getUnderlineStyle(){return this.fg&268435456?this.bg&268435456?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},Yi=class wo{constructor(t=0,i=0){this._ext=0,this._urlId=0,this._ext=t,this._urlId=i}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(t){this._ext=t}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(t){this._ext&=-469762049,this._ext|=t<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(t){this._ext&=-67108864,this._ext|=t&67108863}get urlId(){return this._urlId}set urlId(t){this._urlId=t}get underlineVariantOffset(){let t=(this._ext&3758096384)>>29;return t<0?t^4294967288:t}set underlineVariantOffset(t){this._ext&=536870911,this._ext|=t<<29&3758096384}clone(){return new wo(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},Ve=class Co extends mi{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new Yi,this.combinedData=""}static fromCharData(t){let i=new Co;return i.setFromCharData(t),i}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?St(this.content&2097151):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(t){this.fg=t[0],this.bg=0;let i=!1;if(t[1].length>2)i=!0;else if(t[1].length===2){let s=t[1].charCodeAt(0);if(55296<=s&&s<=56319){let r=t[1].charCodeAt(1);56320<=r&&r<=57343?this.content=(s-55296)*1024+r-56320+65536|t[2]<<22:i=!0}else i=!0}else this.content=t[1].charCodeAt(0)|t[2]<<22;i&&(this.combinedData=t[1],this.content=2097152|t[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},Jr="di$target",Fs="di$dependencies",gs=new Map;function oc(e){return e[Fs]||[]}function we(e){if(gs.has(e))return gs.get(e);let t=function(i,s,r){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");ac(t,i,r)};return t._id=e,gs.set(e,t),t}function ac(e,t,i){t[Jr]===t?t[Fs].push({id:e,index:i}):(t[Fs]=[{id:e,index:i}],t[Jr]=t)}var Me=we("BufferService"),ko=we("CoreMouseService"),Ft=we("CoreService"),lc=we("CharsetService"),Lr=we("InstantiationService"),xo=we("LogService"),Re=we("OptionsService"),Eo=we("OscLinkService"),hc=we("UnicodeService"),Si=we("DecorationService"),Hs=class{constructor(e,t,i){this._bufferService=e,this._optionsService=t,this._oscLinkService=i}provideLinks(e,t){let i=this._bufferService.buffer.lines.get(e-1);if(!i){t(void 0);return}let s=[],r=this._optionsService.rawOptions.linkHandler,n=new Ve,o=i.getTrimmedLength(),a=-1,h=-1,l=!1;for(let f=0;f<o;f++)if(!(h===-1&&!i.hasContent(f))){if(i.loadCell(f,n),n.hasExtendedAttrs()&&n.extended.urlId)if(h===-1){h=f,a=n.extended.urlId;continue}else l=n.extended.urlId!==a;else h!==-1&&(l=!0);if(l||h!==-1&&f===o-1){let d=this._oscLinkService.getLinkData(a)?.uri;if(d){let u={start:{x:h+1,y:e},end:{x:f+(!l&&f===o-1?1:0),y:e}},c=!1;if(!r?.allowNonHttpProtocols)try{let p=new URL(d);["http:","https:"].includes(p.protocol)||(c=!0)}catch{c=!0}c||s.push({text:d,range:u,activate:(p,_)=>r?r.activate(p,_,u):cc(p,_),hover:(p,_)=>r?.hover?.(p,_,u),leave:(p,_)=>r?.leave?.(p,_,u)})}l=!1,n.hasExtendedAttrs()&&n.extended.urlId?(h=f,a=n.extended.urlId):(h=-1,a=-1)}}t(s)}};Hs=ce([N(0,Me),N(1,Re),N(2,Eo)],Hs);function cc(e,t){if(confirm(`Do you want to navigate to ${t}?
|
|
2
2
|
|
|
3
3
|
WARNING: This link could potentially be dangerous`)){let i=window.open();if(i){try{i.opener=null}catch{}i.location.href=t}else console.warn("Opening link blocked as opener could not be cleared")}}var os=we("CharSizeService"),ut=we("CoreBrowserService"),Dr=we("MouseService"),dt=we("RenderService"),uc=we("SelectionService"),Bo=we("CharacterJoinerService"),Xt=we("ThemeService"),Lo=we("LinkProviderService"),dc=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?Zr.isErrorNoTelemetry(e)?new Zr(e.message+`
|
|
4
4
|
|
|
@@ -13,4 +13,4 @@ WARNING: This link could potentially be dangerous`)){let i=window.open();if(i){t
|
|
|
13
13
|
`)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(e){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh())),Nr&&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),i=this._model.finalSelectionStart,s=this._model.finalSelectionEnd;return!i||!s||!t?!1:this._areCoordsInSelection(t,i,s)}isCellInSelection(e,t){let i=this._model.finalSelectionStart,s=this._model.finalSelectionEnd;return!i||!s?!1:this._areCoordsInSelection([e,t],i,s)}_areCoordsInSelection(e,t,i){return e[1]>t[1]&&e[1]<i[1]||t[1]===i[1]&&e[1]===t[1]&&e[0]>=t[0]&&e[0]<i[0]||t[1]<i[1]&&e[1]===i[1]&&e[0]<i[0]||t[1]<i[1]&&e[1]===t[1]&&e[0]>=t[0]}_selectWordAtCursor(e,t){let i=this._linkifier.currentLink?.link?.range;if(i)return this._model.selectionStart=[i.start.x-1,i.start.y-1],this._model.selectionStartLength=mn(i,this._bufferService.cols),this._model.selectionEnd=void 0,!0;let s=this._getMouseBufferCoords(e);return s?(this._selectWordAt(s,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=Or(this._coreBrowserService.window,e,this._screenElement)[1],i=this._renderService.dimensions.css.canvas.height;return t>=0&&t<=i?0:(t>i&&(t-=i),t=Math.min(Math.max(t,-ws),ws),t/=ws,t/Math.abs(t)+Math.round(t*(od-1)))}shouldForceSelection(e){return Ji?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(),ad)}_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&&!(Ji&&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 i=this._bufferService.buffer;if(this._model.selectionEnd[1]<i.lines.length){let s=i.lines.get(this._model.selectionEnd[1]);s&&s.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<ld&&e.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){let i=this._mouseService.getCoords(e,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(i&&i[0]!==void 0&&i[1]!==void 0){let s=Zu(i[0]-1,i[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(s,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd,i=!!e&&!!t&&(e[0]!==t[0]||e[1]!==t[1]);if(!i){this._oldHasSelection&&this._fireOnSelectionChange(e,t,i);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,i)}_fireOnSelectionChange(e,t,i){this._oldSelectionStart=e,this._oldSelectionEnd=t,this._oldHasSelection=i,this._onSelectionChange.fire()}_handleBufferActivate(e){this.clearSelection(),this._trimListener.dispose(),this._trimListener=e.activeBuffer.lines.onTrim(t=>this._handleTrim(t))}_convertViewportColToCharacterIndex(e,t){let i=t;for(let s=0;t>=s;s++){let r=e.loadCell(s,this._workCell).getChars().length;this._workCell.getWidth()===0?i--:r>1&&t!==s&&(i+=r-1)}return i}setSelection(e,t,i){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[e,t],this._model.selectionStartLength=i,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(e){this._isClickInSelection(e)||(this._selectWordAtCursor(e,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(e,t,i=!0,s=!0){if(e[0]>=this._bufferService.cols)return;let r=this._bufferService.buffer,n=r.lines.get(e[1]);if(!n)return;let o=r.translateBufferLineToString(e[1],!1),a=this._convertViewportColToCharacterIndex(n,e[0]),h=a,l=e[0]-a,f=0,d=0,u=0,c=0;if(o.charAt(a)===" "){for(;a>0&&o.charAt(a-1)===" ";)a--;for(;h<o.length&&o.charAt(h+1)===" ";)h++}else{let S=e[0],w=e[0];n.getWidth(S)===0&&(f++,S--),n.getWidth(w)===2&&(d++,w++);let y=n.getString(w).length;for(y>1&&(c+=y-1,h+=y-1);S>0&&a>0&&!this._isCharWordSeparator(n.loadCell(S-1,this._workCell));){n.loadCell(S-1,this._workCell);let k=this._workCell.getChars().length;this._workCell.getWidth()===0?(f++,S--):k>1&&(u+=k-1,a-=k-1),a--,S--}for(;w<n.length&&h+1<o.length&&!this._isCharWordSeparator(n.loadCell(w+1,this._workCell));){n.loadCell(w+1,this._workCell);let k=this._workCell.getChars().length;this._workCell.getWidth()===2?(d++,w++):k>1&&(c+=k-1,h+=k-1),h++,w++}}h++;let p=a+l-f+u,_=Math.min(this._bufferService.cols,h-a+f+d-u-c);if(!(!t&&o.slice(a,h).trim()==="")){if(i&&p===0&&n.getCodePoint(0)!==32){let S=r.lines.get(e[1]-1);if(S&&n.isWrapped&&S.getCodePoint(this._bufferService.cols-1)!==32){let w=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if(w){let y=this._bufferService.cols-w.start;p-=y,_+=y}}}if(s&&p+_===this._bufferService.cols&&n.getCodePoint(this._bufferService.cols-1)!==32){let S=r.lines.get(e[1]+1);if(S?.isWrapped&&S.getCodePoint(0)!==32){let w=this._getWordAt([0,e[1]+1],!1,!1,!0);w&&(_+=w.length)}}return{start:p,length:_}}}_selectWordAt(e,t){let i=this._getWordAt(e,t);if(i){for(;i.start<0;)i.start+=this._bufferService.cols,e[1]--;this._model.selectionStart=[i.start,e[1]],this._model.selectionStartLength=i.length}}_selectToWordAt(e){let t=this._getWordAt(e,!0);if(t){let i=e[1];for(;t.start<0;)t.start+=this._bufferService.cols,i--;if(!this._model.areSelectionValuesReversed())for(;t.start+t.length>this._bufferService.cols;)t.length-=this._bufferService.cols,i++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?t.start:t.start+t.length,i]}}_isCharWordSeparator(e){return e.getWidth()===0?!1:this._optionsService.rawOptions.wordSeparator.indexOf(e.getChars())>=0}_selectLineAt(e){let t=this._bufferService.buffer.getWrappedRangeForLine(e),i={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=mn(i,this._bufferService.cols)}};cr=ce([N(3,Me),N(4,Ft),N(5,Dr),N(6,Re),N(7,dt),N(8,ut)],cr);var Sn=class{constructor(){this._data={}}set(e,t,i){this._data[e]||(this._data[e]={}),this._data[e][t]=i}get(e,t){return this._data[e]?this._data[e][t]:void 0}clear(){this._data={}}},bn=class{constructor(){this._color=new Sn,this._css=new Sn}setCss(e,t,i){this._css.set(e,t,i)}getCss(e,t){return this._css.get(e,t)}setColor(e,t,i){this._color.set(e,t,i)}getColor(e,t){return this._color.get(e,t)}clear(){this._color.clear(),this._css.clear()}},_e=Object.freeze((()=>{let e=[le.toColor("#2e3436"),le.toColor("#cc0000"),le.toColor("#4e9a06"),le.toColor("#c4a000"),le.toColor("#3465a4"),le.toColor("#75507b"),le.toColor("#06989a"),le.toColor("#d3d7cf"),le.toColor("#555753"),le.toColor("#ef2929"),le.toColor("#8ae234"),le.toColor("#fce94f"),le.toColor("#729fcf"),le.toColor("#ad7fa8"),le.toColor("#34e2e2"),le.toColor("#eeeeec")],t=[0,95,135,175,215,255];for(let i=0;i<216;i++){let s=t[i/36%6|0],r=t[i/6%6|0],n=t[i%6];e.push({css:fe.toCss(s,r,n),rgba:fe.toRgba(s,r,n)})}for(let i=0;i<24;i++){let s=8+i*10;e.push({css:fe.toCss(s,s,s),rgba:fe.toRgba(s,s,s)})}return e})()),Dt=le.toColor("#ffffff"),oi=le.toColor("#000000"),yn=le.toColor("#ffffff"),wn=oi,ti={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117},ud=Dt,ur=class extends Q{constructor(e){super(),this._optionsService=e,this._contrastCache=new bn,this._halfContrastCache=new bn,this._onChangeColors=this._register(new T),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:Dt,background:oi,cursor:yn,cursorAccent:wn,selectionForeground:void 0,selectionBackgroundTransparent:ti,selectionBackgroundOpaque:ne.blend(oi,ti),selectionInactiveBackgroundTransparent:ti,selectionInactiveBackgroundOpaque:ne.blend(oi,ti),scrollbarSliderBackground:ne.opacity(Dt,.2),scrollbarSliderHoverBackground:ne.opacity(Dt,.4),scrollbarSliderActiveBackground:ne.opacity(Dt,.5),overviewRulerBorder:Dt,ansi:_e.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=re(e.foreground,Dt),t.background=re(e.background,oi),t.cursor=ne.blend(t.background,re(e.cursor,yn)),t.cursorAccent=ne.blend(t.background,re(e.cursorAccent,wn)),t.selectionBackgroundTransparent=re(e.selectionBackground,ti),t.selectionBackgroundOpaque=ne.blend(t.background,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundTransparent=re(e.selectionInactiveBackground,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundOpaque=ne.blend(t.background,t.selectionInactiveBackgroundTransparent),t.selectionForeground=e.selectionForeground?re(e.selectionForeground,pn):void 0,t.selectionForeground===pn&&(t.selectionForeground=void 0),ne.isOpaque(t.selectionBackgroundTransparent)&&(t.selectionBackgroundTransparent=ne.opacity(t.selectionBackgroundTransparent,.3)),ne.isOpaque(t.selectionInactiveBackgroundTransparent)&&(t.selectionInactiveBackgroundTransparent=ne.opacity(t.selectionInactiveBackgroundTransparent,.3)),t.scrollbarSliderBackground=re(e.scrollbarSliderBackground,ne.opacity(t.foreground,.2)),t.scrollbarSliderHoverBackground=re(e.scrollbarSliderHoverBackground,ne.opacity(t.foreground,.4)),t.scrollbarSliderActiveBackground=re(e.scrollbarSliderActiveBackground,ne.opacity(t.foreground,.5)),t.overviewRulerBorder=re(e.overviewRulerBorder,ud),t.ansi=_e.slice(),t.ansi[0]=re(e.black,_e[0]),t.ansi[1]=re(e.red,_e[1]),t.ansi[2]=re(e.green,_e[2]),t.ansi[3]=re(e.yellow,_e[3]),t.ansi[4]=re(e.blue,_e[4]),t.ansi[5]=re(e.magenta,_e[5]),t.ansi[6]=re(e.cyan,_e[6]),t.ansi[7]=re(e.white,_e[7]),t.ansi[8]=re(e.brightBlack,_e[8]),t.ansi[9]=re(e.brightRed,_e[9]),t.ansi[10]=re(e.brightGreen,_e[10]),t.ansi[11]=re(e.brightYellow,_e[11]),t.ansi[12]=re(e.brightBlue,_e[12]),t.ansi[13]=re(e.brightMagenta,_e[13]),t.ansi[14]=re(e.brightCyan,_e[14]),t.ansi[15]=re(e.brightWhite,_e[15]),e.extendedAnsi){let i=Math.min(t.ansi.length-16,e.extendedAnsi.length);for(let s=0;s<i;s++)t.ansi[s+16]=re(e.extendedAnsi[s],_e[s+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 t=0;t<this._restoreColors.ansi.length;++t)this._colors.ansi[t]=this._restoreColors.ansi[t];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()}}};ur=ce([N(0,Re)],ur);function re(e,t){if(e!==void 0)try{return le.toColor(e)}catch{}return t}var dd=class{constructor(...e){this._entries=new Map;for(let[t,i]of e)this.set(t,i)}set(e,t){let i=this._entries.get(e);return this._entries.set(e,t),i}forEach(e){for(let[t,i]of this._entries.entries())e(t,i)}has(e){return this._entries.has(e)}get(e){return this._entries.get(e)}},fd=class{constructor(){this._services=new dd,this._services.set(Lr,this)}setService(e,t){this._services.set(e,t)}getService(e){return this._services.get(e)}createInstance(e,...t){let i=oc(e).sort((n,o)=>n.index-o.index),s=[];for(let n of i){let o=this._services.get(n.id);if(!o)throw new Error(`[createInstance] ${e.name} depends on UNKNOWN service ${n.id._id}.`);s.push(o)}let r=i.length>0?i[0].index:t.length;if(t.length!==r)throw new Error(`[createInstance] First service dependency of ${e.name} at position ${r+1} conflicts with ${t.length} static arguments`);return new e(...t,...s)}},_d={trace:0,debug:1,info:2,warn:3,error:4,off:5},pd="xterm.js: ",dr=class extends Q{constructor(e){super(),this._optionsService=e,this._logLevel=5,this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel()))}get logLevel(){return this._logLevel}_updateLogLevel(){this._logLevel=_d[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,i){this._evalLazyOptionalParams(i),e.call(console,(this._optionsService.options.logger?"":pd)+t,...i)}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)}};dr=ce([N(0,Re)],dr);var Cn=class extends Q{constructor(e){super(),this._maxLength=e,this.onDeleteEmitter=this._register(new T),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this._register(new T),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this._register(new T),this.onTrim=this.onTrimEmitter.event,this._array=new Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(e){if(this._maxLength===e)return;let t=new Array(e);for(let i=0;i<Math.min(e,this.length);i++)t[i]=this._array[this._getCyclicIndex(i)];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 new 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,...i){if(t){for(let s=e;s<this._length-t;s++)this._array[this._getCyclicIndex(s)]=this._array[this._getCyclicIndex(s+t)];this._length-=t,this.onDeleteEmitter.fire({index:e,amount:t})}for(let s=this._length-1;s>=e;s--)this._array[this._getCyclicIndex(s+i.length)]=this._array[this._getCyclicIndex(s)];for(let s=0;s<i.length;s++)this._array[this._getCyclicIndex(e+s)]=i[s];if(i.length&&this.onInsertEmitter.fire({index:e,amount:i.length}),this._length+i.length>this._maxLength){let s=this._length+i.length-this._maxLength;this._startIndex+=s,this._length=this._maxLength,this.onTrimEmitter.fire(s)}else this._length+=i.length}trimStart(e){e>this._length&&(e=this._length),this._startIndex+=e,this._length-=e,this.onTrimEmitter.fire(e)}shiftElements(e,t,i){if(!(t<=0)){if(e<0||e>=this._length)throw new Error("start argument out of range");if(e+i<0)throw new Error("Cannot shift elements in list beyond index 0");if(i>0){for(let r=t-1;r>=0;r--)this.set(e+r+i,this.get(e+r));let s=e+t+i-this._length;if(s>0)for(this._length+=s;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let s=0;s<t;s++)this.set(e+s+i,this.get(e+s))}}_getCyclicIndex(e){return(this._startIndex+e)%this._maxLength}},J=3,de=Object.freeze(new mi),Ri=0,Cs=2,ai=class ta{constructor(t,i,s=!1){this.isWrapped=s,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(t*J);let r=i||Ve.fromCharData([0,bo,1,0]);for(let n=0;n<t;++n)this.setCell(n,r);this.length=t}get(t){let i=this._data[t*J+0],s=i&2097151;return[this._data[t*J+1],i&2097152?this._combined[t]:s?St(s):"",i>>22,i&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):s]}set(t,i){this._data[t*J+1]=i[0],i[1].length>1?(this._combined[t]=i[1],this._data[t*J+0]=t|2097152|i[2]<<22):this._data[t*J+0]=i[1].charCodeAt(0)|i[2]<<22}getWidth(t){return this._data[t*J+0]>>22}hasWidth(t){return this._data[t*J+0]&12582912}getFg(t){return this._data[t*J+1]}getBg(t){return this._data[t*J+2]}hasContent(t){return this._data[t*J+0]&4194303}getCodePoint(t){let i=this._data[t*J+0];return i&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):i&2097151}isCombined(t){return this._data[t*J+0]&2097152}getString(t){let i=this._data[t*J+0];return i&2097152?this._combined[t]:i&2097151?St(i&2097151):""}isProtected(t){return this._data[t*J+2]&536870912}loadCell(t,i){return Ri=t*J,i.content=this._data[Ri+0],i.fg=this._data[Ri+1],i.bg=this._data[Ri+2],i.content&2097152&&(i.combinedData=this._combined[t]),i.bg&268435456&&(i.extended=this._extendedAttrs[t]),i}setCell(t,i){i.content&2097152&&(this._combined[t]=i.combinedData),i.bg&268435456&&(this._extendedAttrs[t]=i.extended),this._data[t*J+0]=i.content,this._data[t*J+1]=i.fg,this._data[t*J+2]=i.bg}setCellFromCodepoint(t,i,s,r){r.bg&268435456&&(this._extendedAttrs[t]=r.extended),this._data[t*J+0]=i|s<<22,this._data[t*J+1]=r.fg,this._data[t*J+2]=r.bg}addCodepointToCell(t,i,s){let r=this._data[t*J+0];r&2097152?this._combined[t]+=St(i):r&2097151?(this._combined[t]=St(r&2097151)+St(i),r&=-2097152,r|=2097152):r=i|1<<22,s&&(r&=-12582913,r|=s<<22),this._data[t*J+0]=r}insertCells(t,i,s){if(t%=this.length,t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,s),i<this.length-t){let r=new Ve;for(let n=this.length-t-i-1;n>=0;--n)this.setCell(t+i+n,this.loadCell(t+n,r));for(let n=0;n<i;++n)this.setCell(t+n,s)}else for(let r=t;r<this.length;++r)this.setCell(r,s);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,s)}deleteCells(t,i,s){if(t%=this.length,i<this.length-t){let r=new Ve;for(let n=0;n<this.length-t-i;++n)this.setCell(t+n,this.loadCell(t+i+n,r));for(let n=this.length-i;n<this.length;++n)this.setCell(n,s)}else for(let r=t;r<this.length;++r)this.setCell(r,s);t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,s),this.getWidth(t)===0&&!this.hasContent(t)&&this.setCellFromCodepoint(t,0,1,s)}replaceCells(t,i,s,r=!1){if(r){for(t&&this.getWidth(t-1)===2&&!this.isProtected(t-1)&&this.setCellFromCodepoint(t-1,0,1,s),i<this.length&&this.getWidth(i-1)===2&&!this.isProtected(i)&&this.setCellFromCodepoint(i,0,1,s);t<i&&t<this.length;)this.isProtected(t)||this.setCell(t,s),t++;return}for(t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,s),i<this.length&&this.getWidth(i-1)===2&&this.setCellFromCodepoint(i,0,1,s);t<i&&t<this.length;)this.setCell(t++,s)}resize(t,i){if(t===this.length)return this._data.length*4*Cs<this._data.buffer.byteLength;let s=t*J;if(t>this.length){if(this._data.buffer.byteLength>=s*4)this._data=new Uint32Array(this._data.buffer,0,s);else{let r=new Uint32Array(s);r.set(this._data),this._data=r}for(let r=this.length;r<t;++r)this.setCell(r,i)}else{this._data=this._data.subarray(0,s);let r=Object.keys(this._combined);for(let o=0;o<r.length;o++){let a=parseInt(r[o],10);a>=t&&delete this._combined[a]}let n=Object.keys(this._extendedAttrs);for(let o=0;o<n.length;o++){let a=parseInt(n[o],10);a>=t&&delete this._extendedAttrs[a]}}return this.length=t,s*4*Cs<this._data.buffer.byteLength}cleanupMemory(){if(this._data.length*4*Cs<this._data.buffer.byteLength){let t=new Uint32Array(this._data.length);return t.set(this._data),this._data=t,1}return 0}fill(t,i=!1){if(i){for(let s=0;s<this.length;++s)this.isProtected(s)||this.setCell(s,t);return}this._combined={},this._extendedAttrs={};for(let s=0;s<this.length;++s)this.setCell(s,t)}copyFrom(t){this.length!==t.length?this._data=new Uint32Array(t._data):this._data.set(t._data),this.length=t.length,this._combined={};for(let i in t._combined)this._combined[i]=t._combined[i];this._extendedAttrs={};for(let i in t._extendedAttrs)this._extendedAttrs[i]=t._extendedAttrs[i];this.isWrapped=t.isWrapped}clone(){let t=new ta(0);t._data=new Uint32Array(this._data),t.length=this.length;for(let i in this._combined)t._combined[i]=this._combined[i];for(let i in this._extendedAttrs)t._extendedAttrs[i]=this._extendedAttrs[i];return t.isWrapped=this.isWrapped,t}getTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*J+0]&4194303)return t+(this._data[t*J+0]>>22);return 0}getNoBgTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*J+0]&4194303||this._data[t*J+2]&50331648)return t+(this._data[t*J+0]>>22);return 0}copyCellsFrom(t,i,s,r,n){let o=t._data;if(n)for(let h=r-1;h>=0;h--){for(let l=0;l<J;l++)this._data[(s+h)*J+l]=o[(i+h)*J+l];o[(i+h)*J+2]&268435456&&(this._extendedAttrs[s+h]=t._extendedAttrs[i+h])}else for(let h=0;h<r;h++){for(let l=0;l<J;l++)this._data[(s+h)*J+l]=o[(i+h)*J+l];o[(i+h)*J+2]&268435456&&(this._extendedAttrs[s+h]=t._extendedAttrs[i+h])}let a=Object.keys(t._combined);for(let h=0;h<a.length;h++){let l=parseInt(a[h],10);l>=i&&(this._combined[l-i+s]=t._combined[l])}}translateToString(t,i,s,r){i=i??0,s=s??this.length,t&&(s=Math.min(s,this.getTrimmedLength())),r&&(r.length=0);let n="";for(;i<s;){let o=this._data[i*J+0],a=o&2097151,h=o&2097152?this._combined[i]:a?St(a):wt;if(n+=h,r)for(let l=0;l<h.length;++l)r.push(i);i+=o>>22||1}return r&&r.push(i),n}};function gd(e,t,i,s,r,n){let o=[];for(let a=0;a<e.length-1;a++){let h=a,l=e.get(++h);if(!l.isWrapped)continue;let f=[e.get(a)];for(;h<e.length&&l.isWrapped;)f.push(l),l=e.get(++h);if(!n&&s>=a&&s<h){a+=f.length-1;continue}let d=0,u=pi(f,d,t),c=1,p=0;for(;c<f.length;){let S=pi(f,c,t),w=S-p,y=i-u,k=Math.min(w,y);f[d].copyCellsFrom(f[c],p,u,k,!1),u+=k,u===i&&(d++,u=0),p+=k,p===S&&(c++,p=0),u===0&&d!==0&&f[d-1].getWidth(i-1)===2&&(f[d].copyCellsFrom(f[d-1],i-1,u++,1,!1),f[d-1].setCell(i-1,r))}f[d].replaceCells(u,i,r);let _=0;for(let S=f.length-1;S>0&&(S>d||f[S].getTrimmedLength()===0);S--)_++;_>0&&(o.push(a+f.length-_),o.push(_)),a+=f.length-1}return o}function vd(e,t){let i=[],s=0,r=t[s],n=0;for(let o=0;o<e.length;o++)if(r===o){let a=t[++s];e.onDeleteEmitter.fire({index:o-n,amount:a}),o+=a-1,n+=a,r=t[++s]}else i.push(o);return{layout:i,countRemoved:n}}function md(e,t){let i=[];for(let s=0;s<t.length;s++)i.push(e.get(t[s]));for(let s=0;s<i.length;s++)e.set(s,i[s]);e.length=t.length}function Sd(e,t,i){let s=[],r=e.map((h,l)=>pi(e,l,t)).reduce((h,l)=>h+l),n=0,o=0,a=0;for(;a<r;){if(r-a<i){s.push(r-a);break}n+=i;let h=pi(e,o,t);n>h&&(n-=h,o++);let l=e[o].getWidth(n-1)===2;l&&n--;let f=l?i-1:i;s.push(f),a+=f}return s}function pi(e,t,i){if(t===e.length-1)return e[t].getTrimmedLength();let s=!e[t].hasContent(i-1)&&e[t].getWidth(i-1)===1,r=e[t+1].getWidth(0)===2;return s&&r?i-1:i}var ia=class sa{constructor(t){this.line=t,this.isDisposed=!1,this._disposables=[],this._id=sa._nextId++,this._onDispose=this.register(new T),this.onDispose=this._onDispose.event}get id(){return this._id}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),Pt(this._disposables),this._disposables.length=0)}register(t){return this._disposables.push(t),t}};ia._nextId=1;var bd=ia,ge={},Mt=ge.B;ge[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:"≥","{":"π","|":"≠","}":"£","~":"·"};ge.A={"#":"£"};ge.B=void 0;ge[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"};ge.C=ge[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};ge.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"};ge.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"};ge.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"};ge.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"};ge.E=ge[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"};ge.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"};ge.H=ge[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};ge["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"};var kn=4294967295,xn=class{constructor(e,t,i){this._hasScrollback=e,this._optionsService=t,this._bufferService=i,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=de.clone(),this.savedCharset=Mt,this.markers=[],this._nullCell=Ve.fromCharData([0,bo,1,0]),this._whitespaceCell=Ve.fromCharData([0,wt,1,32]),this._isClearing=!1,this._memoryCleanupQueue=new Zi,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new Cn(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 Yi),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 Yi),this._whitespaceCell}getBlankLine(e,t){return new ai(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>kn?kn:t}fillViewportRows(e){if(this.lines.length===0){e===void 0&&(e=de);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 Cn(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(e,t){let i=this.getNullCell(de),s=0,r=this._getCorrectBufferLength(t);if(r>this.lines.maxLength&&(this.lines.maxLength=r),this.lines.length>0){if(this._cols<e)for(let o=0;o<this.lines.length;o++)s+=+this.lines.get(o).resize(e,i);let n=0;if(this._rows<t)for(let o=this._rows;o<t;o++)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 ai(e,i)):this.ybase>0&&this.lines.length<=this.ybase+this.y+n+1?(this.ybase--,n++,this.ydisp>0&&this.ydisp--):this.lines.push(new ai(e,i)));else for(let o=this._rows;o>t;o--)this.lines.length>t+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(r<this.lines.maxLength){let o=this.lines.length-r;o>0&&(this.lines.trimStart(o),this.ybase=Math.max(this.ybase-o,0),this.ydisp=Math.max(this.ydisp-o,0),this.savedY=Math.max(this.savedY-o,0)),this.lines.maxLength=r}this.x=Math.min(this.x,e-1),this.y=Math.min(this.y,t-1),n&&(this.y+=n),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 n=0;n<this.lines.length;n++)s+=+this.lines.get(n).resize(e,i);this._cols=e,this._rows=t,this._memoryCleanupQueue.clear(),s>.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 i=this._optionsService.rawOptions.reflowCursorLine,s=gd(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(de),i);if(s.length>0){let r=vd(this.lines,s);md(this.lines,r.layout),this._reflowLargerAdjustViewport(e,t,r.countRemoved)}}_reflowLargerAdjustViewport(e,t,i){let s=this.getNullCell(de),r=i;for(;r-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<t&&this.lines.push(new ai(e,s))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-i,0)}_reflowSmaller(e,t){let i=this._optionsService.rawOptions.reflowCursorLine,s=this.getNullCell(de),r=[],n=0;for(let o=this.lines.length-1;o>=0;o--){let a=this.lines.get(o);if(!a||!a.isWrapped&&a.getTrimmedLength()<=e)continue;let h=[a];for(;a.isWrapped&&o>0;)a=this.lines.get(--o),h.unshift(a);if(!i){let k=this.ybase+this.y;if(k>=o&&k<o+h.length)continue}let l=h[h.length-1].getTrimmedLength(),f=Sd(h,this._cols,e),d=f.length-h.length,u;this.ybase===0&&this.y!==this.lines.length-1?u=Math.max(0,this.y-this.lines.maxLength+d):u=Math.max(0,this.lines.length-this.lines.maxLength+d);let c=[];for(let k=0;k<d;k++){let g=this.getBlankLine(de,!0);c.push(g)}c.length>0&&(r.push({start:o+h.length+n,newLines:c}),n+=c.length),h.push(...c);let p=f.length-1,_=f[p];_===0&&(p--,_=f[p]);let S=h.length-d-1,w=l;for(;S>=0;){let k=Math.min(w,_);if(h[p]===void 0)break;if(h[p].copyCellsFrom(h[S],w-k,_-k,k,!0),_-=k,_===0&&(p--,_=f[p]),w-=k,w===0){S--;let g=Math.max(S,0);w=pi(h,g,this._cols)}}for(let k=0;k<h.length;k++)f[k]<e&&h[k].setCell(f[k],s);let y=d-u;for(;y-- >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+n)-t&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+d,this.ybase+t-1)}if(r.length>0){let o=[],a=[];for(let _=0;_<this.lines.length;_++)a.push(this.lines.get(_));let h=this.lines.length,l=h-1,f=0,d=r[f];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+n);let u=0;for(let _=Math.min(this.lines.maxLength-1,h+n-1);_>=0;_--)if(d&&d.start>l+u){for(let S=d.newLines.length-1;S>=0;S--)this.lines.set(_--,d.newLines[S]);_++,o.push({index:l+1,amount:d.newLines.length}),u+=d.newLines.length,d=r[++f]}else this.lines.set(_,a[l--]);let c=0;for(let _=o.length-1;_>=0;_--)o[_].index+=c,this.lines.onInsertEmitter.fire(o[_]),c+=o[_].amount;let p=Math.max(0,h+n-this.lines.maxLength);p>0&&this.lines.onTrimEmitter.fire(p)}}translateBufferLineToString(e,t,i=0,s){let r=this.lines.get(e);return r?r.translateToString(t,i,s):""}getWrappedRangeForLine(e){let t=e,i=e;for(;t>0&&this.lines.get(t).isWrapped;)t--;for(;i+1<this.lines.length&&this.lines.get(i+1).isWrapped;)i++;return{first:t,last:i}}setupTabStops(e){for(e!=null?this.tabs[e]||(e=this.prevStop(e)):(this.tabs={},e=0);e<this._cols;e+=this._optionsService.rawOptions.tabStopWidth)this.tabs[e]=!0}prevStop(e){for(e==null&&(e=this.x);!this.tabs[--e]&&e>0;);return e>=this._cols?this._cols-1:e<0?0:e}nextStop(e){for(e==null&&(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 bd(e);return this.markers.push(t),t.register(this.lines.onTrim(i=>{t.line-=i,t.line<0&&t.dispose()})),t.register(this.lines.onInsert(i=>{t.line>=i.index&&(t.line+=i.amount)})),t.register(this.lines.onDelete(i=>{t.line>=i.index&&t.line<i.index+i.amount&&t.dispose(),t.line>i.index&&(t.line-=i.amount)})),t.register(t.onDispose(()=>this._removeMarker(t))),t}_removeMarker(e){this._isClearing||this.markers.splice(this.markers.indexOf(e),1)}},yd=class extends Q{constructor(e,t){super(),this._optionsService=e,this._bufferService=t,this._onBufferActivate=this._register(new T),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 xn(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new xn(!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)}},ra=2,na=1,fr=class extends Q{constructor(e){super(),this.isUserScrolling=!1,this._onResize=this._register(new T),this.onResize=this._onResize.event,this._onScroll=this._register(new T),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,ra),this.rows=Math.max(e.rawOptions.rows||0,na),this.buffers=this._register(new yd(e,this)),this._register(this.buffers.onBufferActivate(t=>{this._onScroll.fire(t.activeBuffer.ydisp)}))}get buffer(){return this.buffers.active}resize(e,t){let i=this.cols!==e,s=this.rows!==t;this.cols=e,this.rows=t,this.buffers.resize(e,t),this._onResize.fire({cols:e,rows:t,colsChanged:i,rowsChanged:s})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(e,t=!1){let i=this.buffer,s;s=this._cachedBlankLine,(!s||s.length!==this.cols||s.getFg(0)!==e.fg||s.getBg(0)!==e.bg)&&(s=i.getBlankLine(e,t),this._cachedBlankLine=s),s.isWrapped=t;let r=i.ybase+i.scrollTop,n=i.ybase+i.scrollBottom;if(i.scrollTop===0){let o=i.lines.isFull;n===i.lines.length-1?o?i.lines.recycle().copyFrom(s):i.lines.push(s.clone()):i.lines.splice(n+1,0,s.clone()),o?this.isUserScrolling&&(i.ydisp=Math.max(i.ydisp-1,0)):(i.ybase++,this.isUserScrolling||i.ydisp++)}else{let o=n-r+1;i.lines.shiftElements(r+1,o-1,-1),i.lines.set(n,s.clone())}this.isUserScrolling||(i.ydisp=i.ybase),this._onScroll.fire(i.ydisp)}scrollLines(e,t){let i=this.buffer;if(e<0){if(i.ydisp===0)return;this.isUserScrolling=!0}else e+i.ydisp>=i.ybase&&(this.isUserScrolling=!1);let s=i.ydisp;i.ydisp=Math.max(Math.min(i.ydisp+e,i.ybase),0),s!==i.ydisp&&(t||this._onScroll.fire(i.ydisp))}};fr=ce([N(0,Re)],fr);var $t={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:Ji,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRuler:{}},wd=["normal","bold","100","200","300","400","500","600","700","800","900"],Cd=class extends Q{constructor(e){super(),this._onOptionChange=this._register(new T),this.onOptionChange=this._onOptionChange.event;let t={...$t};for(let i in e)if(i in t)try{let s=e[i];t[i]=this._sanitizeAndValidateOption(i,s)}catch(s){console.error(s)}this.rawOptions=t,this.options={...t},this._setupOptions(),this._register(oe(()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null}))}onSpecificOptionChange(e,t){return this.onOptionChange(i=>{i===e&&t(this.rawOptions[e])})}onMultipleOptionChange(e,t){return this.onOptionChange(i=>{e.indexOf(i)!==-1&&t()})}_setupOptions(){let e=i=>{if(!(i in $t))throw new Error(`No option with key "${i}"`);return this.rawOptions[i]},t=(i,s)=>{if(!(i in $t))throw new Error(`No option with key "${i}"`);s=this._sanitizeAndValidateOption(i,s),this.rawOptions[i]!==s&&(this.rawOptions[i]=s,this._onOptionChange.fire(i))};for(let i in this.rawOptions){let s={get:e.bind(this,i),set:t.bind(this,i)};Object.defineProperty(this.options,i,s)}}_sanitizeAndValidateOption(e,t){switch(e){case"cursorStyle":if(t||(t=$t[e]),!kd(t))throw new Error(`"${t}" is not a valid value for ${e}`);break;case"wordSeparator":t||(t=$t[e]);break;case"fontWeight":case"fontWeightBold":if(typeof t=="number"&&1<=t&&t<=1e3)break;t=wd.includes(t)?t:$t[e];break;case"cursorWidth":t=Math.floor(t);case"lineHeight":case"tabStopWidth":if(t<1)throw new 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 new Error(`${e} cannot be less than 0, value: ${t}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(t<=0)throw new Error(`${e} cannot be less than or equal to 0, value: ${t}`);break;case"rows":case"cols":if(!t&&t!==0)throw new Error(`${e} must be numeric, value: ${t}`);break;case"windowsPty":t=t??{};break}return t}};function kd(e){return e==="block"||e==="underline"||e==="bar"}function li(e,t=5){if(typeof e!="object")return e;let i=Array.isArray(e)?[]:{};for(let s in e)i[s]=t<=1?e[s]:e[s]&&li(e[s],t-1);return i}var En=Object.freeze({insertMode:!1}),Bn=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,wraparound:!0}),_r=class extends Q{constructor(e,t,i){super(),this._bufferService=e,this._logService=t,this._optionsService=i,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this._register(new T),this.onData=this._onData.event,this._onUserInput=this._register(new T),this.onUserInput=this._onUserInput.event,this._onBinary=this._register(new T),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this._register(new T),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=li(En),this.decPrivateModes=li(Bn)}reset(){this.modes=li(En),this.decPrivateModes=li(Bn)}triggerDataEvent(e,t=!1){if(this._optionsService.rawOptions.disableStdin)return;let i=this._bufferService.buffer;t&&this._optionsService.rawOptions.scrollOnUserInput&&i.ybase!==i.ydisp&&this._onRequestScrollToBottom.fire(),t&&this._onUserInput.fire(),this._logService.debug(`sending data "${e}"`),this._logService.trace("sending data (codes)",()=>e.split("").map(s=>s.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(t=>t.charCodeAt(0))),this._onBinary.fire(e))}};_r=ce([N(0,Me),N(1,xo),N(2,Re)],_r);var Ln={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 ks(e,t){let i=(e.ctrl?16:0)|(e.shift?4:0)|(e.alt?8:0);return e.button===4?(i|=64,i|=e.action):(i|=e.button&3,e.button&4&&(i|=64),e.button&8&&(i|=128),e.action===32?i|=32:e.action===0&&!t&&(i|=3)),i}var xs=String.fromCharCode,Dn={DEFAULT:e=>{let t=[ks(e,!1)+32,e.col+32,e.row+32];return t[0]>255||t[1]>255||t[2]>255?"":`\x1B[M${xs(t[0])}${xs(t[1])}${xs(t[2])}`},SGR:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${ks(e,!0)};${e.col};${e.row}${t}`},SGR_PIXELS:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${ks(e,!0)};${e.x};${e.y}${t}`}},pr=class extends Q{constructor(e,t,i){super(),this._bufferService=e,this._coreService=t,this._optionsService=i,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._wheelPartialScroll=0,this._onProtocolChange=this._register(new T),this.onProtocolChange=this._onProtocolChange.event;for(let s of Object.keys(Ln))this.addProtocol(s,Ln[s]);for(let s of Object.keys(Dn))this.addEncoding(s,Dn[s]);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 new 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 new Error(`unknown encoding "${e}"`);this._activeEncoding=e}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null,this._wheelPartialScroll=0}consumeWheelEvent(e,t,i){if(e.deltaY===0||e.shiftKey||t===void 0||i===void 0)return 0;let s=t/i,r=this._applyScrollModifier(e.deltaY,e);return e.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(r/=s+0,Math.abs(e.deltaY)<50&&(r*=.3),this._wheelPartialScroll+=r,r=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):e.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(r*=this._bufferService.rows),r}_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,i){if(i){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)}};pr=ce([N(0,Me),N(1,Ft),N(2,Re)],pr);var Es=[[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]],xd=[[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]],pe;function Ed(e,t){let i=0,s=t.length-1,r;if(e<t[0][0]||e>t[s][1])return!1;for(;s>=i;)if(r=i+s>>1,e>t[r][1])i=r+1;else if(e<t[r][0])s=r-1;else return!0;return!1}var Bd=class{constructor(){if(this.version="6",!pe){pe=new Uint8Array(65536),pe.fill(1),pe[0]=0,pe.fill(0,1,32),pe.fill(0,127,160),pe.fill(2,4352,4448),pe[9001]=2,pe[9002]=2,pe.fill(2,11904,42192),pe[12351]=1,pe.fill(2,44032,55204),pe.fill(2,63744,64256),pe.fill(2,65040,65050),pe.fill(2,65072,65136),pe.fill(2,65280,65377),pe.fill(2,65504,65511);for(let e=0;e<Es.length;++e)pe.fill(0,Es[e][0],Es[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?pe[e]:Ed(e,xd)?0:e>=131072&&e<=196605||e>=196608&&e<=262141?2:1}charProperties(e,t){let i=this.wcwidth(e),s=i===0&&t!==0;if(s){let r=At.extractWidth(t);r===0?s=!1:r>i&&(i=r)}return At.createPropertyValue(0,i,s)}},At=class Hi{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new T,this.onChange=this._onChange.event;let t=new Bd;this.register(t),this._active=t.version,this._activeProvider=t}static extractShouldJoin(t){return(t&1)!==0}static extractWidth(t){return t>>1&3}static extractCharKind(t){return t>>3}static createPropertyValue(t,i,s=!1){return(t&16777215)<<3|(i&3)<<1|(s?1:0)}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(t){if(!this._providers[t])throw new Error(`unknown Unicode version "${t}"`);this._active=t,this._activeProvider=this._providers[t],this._onChange.fire(t)}register(t){this._providers[t.version]=t}wcwidth(t){return this._activeProvider.wcwidth(t)}getStringCellWidth(t){let i=0,s=0,r=t.length;for(let n=0;n<r;++n){let o=t.charCodeAt(n);if(55296<=o&&o<=56319){if(++n>=r)return i+this.wcwidth(o);let l=t.charCodeAt(n);56320<=l&&l<=57343?o=(o-55296)*1024+l-56320+65536:i+=this.wcwidth(l)}let a=this.charProperties(o,s),h=Hi.extractWidth(a);Hi.extractShouldJoin(a)&&(h-=Hi.extractWidth(s)),i+=h,s=a}return i}charProperties(t,i){return this._activeProvider.charProperties(t,i)}},Ld=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 Mn(e){let t=e.buffer.lines.get(e.buffer.ybase+e.buffer.y-1)?.get(e.cols-1),i=e.buffer.lines.get(e.buffer.ybase+e.buffer.y);i&&t&&(i.isWrapped=t[3]!==0&&t[3]!==32)}var ii=2147483647,Dd=256,oa=class gr{constructor(t=32,i=32){if(this.maxLength=t,this.maxSubParamsLength=i,i>Dd)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(t),this.length=0,this._subParams=new Int32Array(i),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(t),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}static fromArray(t){let i=new gr;if(!t.length)return i;for(let s=Array.isArray(t[0])?1:0;s<t.length;++s){let r=t[s];if(Array.isArray(r))for(let n=0;n<r.length;++n)i.addSubParam(r[n]);else i.addParam(r)}return i}clone(){let t=new gr(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 t=[];for(let i=0;i<this.length;++i){t.push(this.params[i]);let s=this._subParamsIdx[i]>>8,r=this._subParamsIdx[i]&255;r-s>0&&t.push(Array.prototype.slice.call(this._subParams,s,r))}return t}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(t){if(this._digitIsSub=!1,this.length>=this.maxLength){this._rejectDigits=!0;return}if(t<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=t>ii?ii:t}addSubParam(t){if(this._digitIsSub=!0,!!this.length){if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength){this._rejectSubDigits=!0;return}if(t<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=t>ii?ii:t,this._subParamsIdx[this.length-1]++}}hasSubParams(t){return(this._subParamsIdx[t]&255)-(this._subParamsIdx[t]>>8)>0}getSubParams(t){let i=this._subParamsIdx[t]>>8,s=this._subParamsIdx[t]&255;return s-i>0?this._subParams.subarray(i,s):null}getSubParamsAll(){let t={};for(let i=0;i<this.length;++i){let s=this._subParamsIdx[i]>>8,r=this._subParamsIdx[i]&255;r-s>0&&(t[i]=this._subParams.slice(s,r))}return t}addDigit(t){let i;if(this._rejectDigits||!(i=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let s=this._digitIsSub?this._subParams:this.params,r=s[i-1];s[i-1]=~r?Math.min(r*10+t,ii):t}},si=[],Md=class{constructor(){this._state=0,this._active=si,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 i=this._handlers[e];return i.push(t),{dispose:()=>{let s=i.indexOf(t);s!==-1&&i.splice(s,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=si}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=si,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||si,!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,i){if(!this._active.length)this._handlerFb(this._id,"PUT",ns(e,t,i));else for(let s=this._active.length-1;s>=0;s--)this._active[s].put(e,t,i)}start(){this.reset(),this._state=1}put(e,t,i){if(this._state!==3){if(this._state===1)for(;t<i;){let s=e[t++];if(s===59){this._state=2,this._start();break}if(s<48||57<s){this._state=3;return}this._id===-1&&(this._id=0),this._id=this._id*10+s-48}this._state===2&&i-t>0&&this._put(e,t,i)}}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 i=!1,s=this._active.length-1,r=!1;if(this._stack.paused&&(s=this._stack.loopPosition-1,i=t,r=this._stack.fallThrough,this._stack.paused=!1),!r&&i===!1){for(;s>=0&&(i=this._active[s].end(e),i!==!0);s--)if(i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=s,this._stack.fallThrough=!1,i;s--}for(;s>=0;s--)if(i=this._active[s].end(!1),i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=s,this._stack.fallThrough=!0,i}this._active=si,this._id=-1,this._state=0}}},ze=class{constructor(e){this._handler=e,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(e,t,i){this._hitLimit||(this._data+=ns(e,t,i),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(i=>(this._data="",this._hitLimit=!1,i));return this._data="",this._hitLimit=!1,t}},ri=[],Rd=class{constructor(){this._handlers=Object.create(null),this._active=ri,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=ri}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let i=this._handlers[e];return i.push(t),{dispose:()=>{let s=i.indexOf(t);s!==-1&&i.splice(s,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=ri,this._ident=0}hook(e,t){if(this.reset(),this._ident=e,this._active=this._handlers[e]||ri,!this._active.length)this._handlerFb(this._ident,"HOOK",t);else for(let i=this._active.length-1;i>=0;i--)this._active[i].hook(t)}put(e,t,i){if(!this._active.length)this._handlerFb(this._ident,"PUT",ns(e,t,i));else for(let s=this._active.length-1;s>=0;s--)this._active[s].put(e,t,i)}unhook(e,t=!0){if(!this._active.length)this._handlerFb(this._ident,"UNHOOK",e);else{let i=!1,s=this._active.length-1,r=!1;if(this._stack.paused&&(s=this._stack.loopPosition-1,i=t,r=this._stack.fallThrough,this._stack.paused=!1),!r&&i===!1){for(;s>=0&&(i=this._active[s].unhook(e),i!==!0);s--)if(i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=s,this._stack.fallThrough=!1,i;s--}for(;s>=0;s--)if(i=this._active[s].unhook(!1),i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=s,this._stack.fallThrough=!0,i}this._active=ri,this._ident=0}},hi=new oa;hi.addParam(0);var Rn=class{constructor(e){this._handler=e,this._data="",this._params=hi,this._hitLimit=!1}hook(e){this._params=e.length>1||e.params[0]?e.clone():hi,this._data="",this._hitLimit=!1}put(e,t,i){this._hitLimit||(this._data+=ns(e,t,i),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(i=>(this._params=hi,this._data="",this._hitLimit=!1,i));return this._params=hi,this._data="",this._hitLimit=!1,t}},Ad=class{constructor(e){this.table=new Uint8Array(e)}setDefault(e,t){this.table.fill(e<<4|t)}add(e,t,i,s){this.table[t<<8|e]=i<<4|s}addMany(e,t,i,s){for(let r=0;r<e.length;r++)this.table[t<<8|e[r]]=i<<4|s}},Ke=160,Td=(function(){let e=new Ad(4095),t=Array.apply(null,Array(256)).map((a,h)=>h),i=(a,h)=>t.slice(a,h),s=i(32,127),r=i(0,24);r.push(25),r.push.apply(r,i(28,32));let n=i(0,14),o;e.setDefault(1,0),e.addMany(s,0,2,0);for(o in n)e.addMany([24,26,153,154],o,3,0),e.addMany(i(128,144),o,3,0),e.addMany(i(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(r,0,3,0),e.addMany(r,1,3,1),e.add(127,1,0,1),e.addMany(r,8,0,8),e.addMany(r,3,3,3),e.add(127,3,0,3),e.addMany(r,4,3,4),e.add(127,4,0,4),e.addMany(r,6,3,6),e.addMany(r,5,3,5),e.add(127,5,0,5),e.addMany(r,2,3,2),e.add(127,2,0,2),e.add(93,1,4,8),e.addMany(s,8,5,8),e.add(127,8,5,8),e.addMany([156,27,24,26,7],8,6,0),e.addMany(i(28,32),8,0,8),e.addMany([88,94,95],1,0,7),e.addMany(s,7,0,7),e.addMany(r,7,0,7),e.add(156,7,0,0),e.add(127,7,0,7),e.add(91,1,11,3),e.addMany(i(64,127),3,7,0),e.addMany(i(48,60),3,8,4),e.addMany([60,61,62,63],3,9,4),e.addMany(i(48,60),4,8,4),e.addMany(i(64,127),4,7,0),e.addMany([60,61,62,63],4,0,6),e.addMany(i(32,64),6,0,6),e.add(127,6,0,6),e.addMany(i(64,127),6,0,0),e.addMany(i(32,48),3,9,5),e.addMany(i(32,48),5,9,5),e.addMany(i(48,64),5,0,6),e.addMany(i(64,127),5,7,0),e.addMany(i(32,48),4,9,5),e.addMany(i(32,48),1,9,2),e.addMany(i(32,48),2,9,2),e.addMany(i(48,127),2,10,0),e.addMany(i(48,80),1,10,0),e.addMany(i(81,88),1,10,0),e.addMany([89,90,92],1,10,0),e.addMany(i(96,127),1,10,0),e.add(80,1,11,9),e.addMany(r,9,0,9),e.add(127,9,0,9),e.addMany(i(28,32),9,0,9),e.addMany(i(32,48),9,9,12),e.addMany(i(48,60),9,8,10),e.addMany([60,61,62,63],9,9,10),e.addMany(r,11,0,11),e.addMany(i(32,128),11,0,11),e.addMany(i(28,32),11,0,11),e.addMany(r,10,0,10),e.add(127,10,0,10),e.addMany(i(28,32),10,0,10),e.addMany(i(48,60),10,8,10),e.addMany([60,61,62,63],10,0,11),e.addMany(i(32,48),10,9,12),e.addMany(r,12,0,12),e.add(127,12,0,12),e.addMany(i(28,32),12,0,12),e.addMany(i(32,48),12,9,12),e.addMany(i(48,64),12,0,11),e.addMany(i(64,127),12,12,13),e.addMany(i(64,127),10,12,13),e.addMany(i(64,127),9,12,13),e.addMany(r,13,13,13),e.addMany(s,13,13,13),e.add(127,13,0,13),e.addMany([27,156,24,26],13,14,0),e.add(Ke,0,2,0),e.add(Ke,8,5,8),e.add(Ke,6,0,6),e.add(Ke,11,0,11),e.add(Ke,13,13,13),e})(),Id=class extends Q{constructor(e=Td){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 oa,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(t,i,s)=>{},this._executeHandlerFb=t=>{},this._csiHandlerFb=(t,i)=>{},this._escHandlerFb=t=>{},this._errorHandlerFb=t=>t,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this._register(oe(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new Md),this._dcsParser=this._register(new Rd),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},()=>!0)}_identifier(e,t=[64,126]){let i=0;if(e.prefix){if(e.prefix.length>1)throw new Error("only one byte as prefix supported");if(i=e.prefix.charCodeAt(0),i&&60>i||i>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(e.intermediates){if(e.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let r=0;r<e.intermediates.length;++r){let n=e.intermediates.charCodeAt(r);if(32>n||n>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");i<<=8,i|=n}}if(e.final.length!==1)throw new Error("final must be a single byte");let s=e.final.charCodeAt(0);if(t[0]>s||s>t[1])throw new Error(`final must be in range ${t[0]} .. ${t[1]}`);return i<<=8,i|=s,i}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 i=this._identifier(e,[48,126]);this._escHandlers[i]===void 0&&(this._escHandlers[i]=[]);let s=this._escHandlers[i];return s.push(t),{dispose:()=>{let r=s.indexOf(t);r!==-1&&s.splice(r,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 i=this._identifier(e);this._csiHandlers[i]===void 0&&(this._csiHandlers[i]=[]);let s=this._csiHandlers[i];return s.push(t),{dispose:()=>{let r=s.indexOf(t);r!==-1&&s.splice(r,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,i,s,r){this._parseStack.state=e,this._parseStack.handlers=t,this._parseStack.handlerPos=i,this._parseStack.transition=s,this._parseStack.chunkPos=r}parse(e,t,i){let s=0,r=0,n=0,o;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,n=this._parseStack.chunkPos+1;else{if(i===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");let a=this._parseStack.handlers,h=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(i===!1&&h>-1){for(;h>=0&&(o=a[h](this._params),o!==!0);h--)if(o instanceof Promise)return this._parseStack.handlerPos=h,o}this._parseStack.handlers=[];break;case 4:if(i===!1&&h>-1){for(;h>=0&&(o=a[h](),o!==!0);h--)if(o instanceof Promise)return this._parseStack.handlerPos=h,o}this._parseStack.handlers=[];break;case 6:if(s=e[this._parseStack.chunkPos],o=this._dcsParser.unhook(s!==24&&s!==26,i),o)return o;s===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(s=e[this._parseStack.chunkPos],o=this._oscParser.end(s!==24&&s!==26,i),o)return o;s===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break}this._parseStack.state=0,n=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=this._parseStack.transition&15}for(let a=n;a<t;++a){switch(s=e[a],r=this._transitions.table[this.currentState<<8|(s<160?s:Ke)],r>>4){case 2:for(let u=a+1;;++u){if(u>=t||(s=e[u])<32||s>126&&s<Ke){this._printHandler(e,a,u),a=u-1;break}if(++u>=t||(s=e[u])<32||s>126&&s<Ke){this._printHandler(e,a,u),a=u-1;break}if(++u>=t||(s=e[u])<32||s>126&&s<Ke){this._printHandler(e,a,u),a=u-1;break}if(++u>=t||(s=e[u])<32||s>126&&s<Ke){this._printHandler(e,a,u),a=u-1;break}}break;case 3:this._executeHandlers[s]?this._executeHandlers[s]():this._executeHandlerFb(s),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:a,code:s,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let h=this._csiHandlers[this._collect<<8|s],l=h?h.length-1:-1;for(;l>=0&&(o=h[l](this._params),o!==!0);l--)if(o instanceof Promise)return this._preserveStack(3,h,l,r,a),o;l<0&&this._csiHandlerFb(this._collect<<8|s,this._params),this.precedingJoinState=0;break;case 8:do switch(s){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(s-48)}while(++a<t&&(s=e[a])>47&&s<60);a--;break;case 9:this._collect<<=8,this._collect|=s;break;case 10:let f=this._escHandlers[this._collect<<8|s],d=f?f.length-1:-1;for(;d>=0&&(o=f[d](),o!==!0);d--)if(o instanceof Promise)return this._preserveStack(4,f,d,r,a),o;d<0&&this._escHandlerFb(this._collect<<8|s),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|s,this._params);break;case 13:for(let u=a+1;;++u)if(u>=t||(s=e[u])===24||s===26||s===27||s>127&&s<Ke){this._dcsParser.put(e,a,u),a=u-1;break}break;case 14:if(o=this._dcsParser.unhook(s!==24&&s!==26),o)return this._preserveStack(6,[],0,r,a),o;s===27&&(r|=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 u=a+1;;u++)if(u>=t||(s=e[u])<32||s>127&&s<Ke){this._oscParser.put(e,a,u),a=u-1;break}break;case 6:if(o=this._oscParser.end(s!==24&&s!==26),o)return this._preserveStack(5,[],0,r,a),o;s===27&&(r|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break}this.currentState=r&15}}},Pd=/^([\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})$/,Od=/^[\da-f]+$/;function An(e){if(!e)return;let t=e.toLowerCase();if(t.indexOf("rgb:")===0){t=t.slice(4);let i=Pd.exec(t);if(i){let s=i[1]?15:i[4]?255:i[7]?4095:65535;return[Math.round(parseInt(i[1]||i[4]||i[7]||i[10],16)/s*255),Math.round(parseInt(i[2]||i[5]||i[8]||i[11],16)/s*255),Math.round(parseInt(i[3]||i[6]||i[9]||i[12],16)/s*255)]}}else if(t.indexOf("#")===0&&(t=t.slice(1),Od.exec(t)&&[3,6,9,12].includes(t.length))){let i=t.length/3,s=[0,0,0];for(let r=0;r<3;++r){let n=parseInt(t.slice(i*r,i*r+i),16);s[r]=i===1?n<<4:i===2?n:i===3?n>>4:n>>8}return s}}function Bs(e,t){let i=e.toString(16),s=i.length<2?"0"+i:i;switch(t){case 4:return i[0];case 8:return s;case 12:return(s+s).slice(0,3);default:return s+s}}function Nd(e,t=16){let[i,s,r]=e;return`rgb:${Bs(i,t)}/${Bs(s,t)}/${Bs(r,t)}`}var zd={"(":0,")":1,"*":2,"+":3,"-":1,".":2},mt=131072,Tn=10;function In(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 Pn=5e3,On=0,Fd=class extends Q{constructor(e,t,i,s,r,n,o,a,h=new Id){super(),this._bufferService=e,this._charsetService=t,this._coreService=i,this._logService=s,this._optionsService=r,this._oscLinkService=n,this._coreMouseService=o,this._unicodeService=a,this._parser=h,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new rc,this._utf8Decoder=new nc,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=de.clone(),this._eraseAttrDataInternal=de.clone(),this._onRequestBell=this._register(new T),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this._register(new T),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this._register(new T),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this._register(new T),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this._register(new T),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this._register(new T),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this._register(new T),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this._register(new T),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this._register(new T),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this._register(new T),this.onLineFeed=this._onLineFeed.event,this._onScroll=this._register(new T),this.onScroll=this._onScroll.event,this._onTitleChange=this._register(new T),this.onTitleChange=this._onTitleChange.event,this._onColor=this._register(new T),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 vr(this._bufferService),this._activeBuffer=this._bufferService.buffer,this._register(this._bufferService.buffers.onBufferActivate(l=>this._activeBuffer=l.activeBuffer)),this._parser.setCsiHandlerFallback((l,f)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(l),params:f.toArray()})}),this._parser.setEscHandlerFallback(l=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(l)})}),this._parser.setExecuteHandlerFallback(l=>{this._logService.debug("Unknown EXECUTE code: ",{code:l})}),this._parser.setOscHandlerFallback((l,f,d)=>{this._logService.debug("Unknown OSC code: ",{identifier:l,action:f,data:d})}),this._parser.setDcsHandlerFallback((l,f,d)=>{f==="HOOK"&&(d=d.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(l),action:f,payload:d})}),this._parser.setPrintHandler((l,f,d)=>this.print(l,f,d)),this._parser.registerCsiHandler({final:"@"},l=>this.insertChars(l)),this._parser.registerCsiHandler({intermediates:" ",final:"@"},l=>this.scrollLeft(l)),this._parser.registerCsiHandler({final:"A"},l=>this.cursorUp(l)),this._parser.registerCsiHandler({intermediates:" ",final:"A"},l=>this.scrollRight(l)),this._parser.registerCsiHandler({final:"B"},l=>this.cursorDown(l)),this._parser.registerCsiHandler({final:"C"},l=>this.cursorForward(l)),this._parser.registerCsiHandler({final:"D"},l=>this.cursorBackward(l)),this._parser.registerCsiHandler({final:"E"},l=>this.cursorNextLine(l)),this._parser.registerCsiHandler({final:"F"},l=>this.cursorPrecedingLine(l)),this._parser.registerCsiHandler({final:"G"},l=>this.cursorCharAbsolute(l)),this._parser.registerCsiHandler({final:"H"},l=>this.cursorPosition(l)),this._parser.registerCsiHandler({final:"I"},l=>this.cursorForwardTab(l)),this._parser.registerCsiHandler({final:"J"},l=>this.eraseInDisplay(l,!1)),this._parser.registerCsiHandler({prefix:"?",final:"J"},l=>this.eraseInDisplay(l,!0)),this._parser.registerCsiHandler({final:"K"},l=>this.eraseInLine(l,!1)),this._parser.registerCsiHandler({prefix:"?",final:"K"},l=>this.eraseInLine(l,!0)),this._parser.registerCsiHandler({final:"L"},l=>this.insertLines(l)),this._parser.registerCsiHandler({final:"M"},l=>this.deleteLines(l)),this._parser.registerCsiHandler({final:"P"},l=>this.deleteChars(l)),this._parser.registerCsiHandler({final:"S"},l=>this.scrollUp(l)),this._parser.registerCsiHandler({final:"T"},l=>this.scrollDown(l)),this._parser.registerCsiHandler({final:"X"},l=>this.eraseChars(l)),this._parser.registerCsiHandler({final:"Z"},l=>this.cursorBackwardTab(l)),this._parser.registerCsiHandler({final:"`"},l=>this.charPosAbsolute(l)),this._parser.registerCsiHandler({final:"a"},l=>this.hPositionRelative(l)),this._parser.registerCsiHandler({final:"b"},l=>this.repeatPrecedingCharacter(l)),this._parser.registerCsiHandler({final:"c"},l=>this.sendDeviceAttributesPrimary(l)),this._parser.registerCsiHandler({prefix:">",final:"c"},l=>this.sendDeviceAttributesSecondary(l)),this._parser.registerCsiHandler({final:"d"},l=>this.linePosAbsolute(l)),this._parser.registerCsiHandler({final:"e"},l=>this.vPositionRelative(l)),this._parser.registerCsiHandler({final:"f"},l=>this.hVPosition(l)),this._parser.registerCsiHandler({final:"g"},l=>this.tabClear(l)),this._parser.registerCsiHandler({final:"h"},l=>this.setMode(l)),this._parser.registerCsiHandler({prefix:"?",final:"h"},l=>this.setModePrivate(l)),this._parser.registerCsiHandler({final:"l"},l=>this.resetMode(l)),this._parser.registerCsiHandler({prefix:"?",final:"l"},l=>this.resetModePrivate(l)),this._parser.registerCsiHandler({final:"m"},l=>this.charAttributes(l)),this._parser.registerCsiHandler({final:"n"},l=>this.deviceStatus(l)),this._parser.registerCsiHandler({prefix:"?",final:"n"},l=>this.deviceStatusPrivate(l)),this._parser.registerCsiHandler({intermediates:"!",final:"p"},l=>this.softReset(l)),this._parser.registerCsiHandler({intermediates:" ",final:"q"},l=>this.setCursorStyle(l)),this._parser.registerCsiHandler({final:"r"},l=>this.setScrollRegion(l)),this._parser.registerCsiHandler({final:"s"},l=>this.saveCursor(l)),this._parser.registerCsiHandler({final:"t"},l=>this.windowOptions(l)),this._parser.registerCsiHandler({final:"u"},l=>this.restoreCursor(l)),this._parser.registerCsiHandler({intermediates:"'",final:"}"},l=>this.insertColumns(l)),this._parser.registerCsiHandler({intermediates:"'",final:"~"},l=>this.deleteColumns(l)),this._parser.registerCsiHandler({intermediates:'"',final:"q"},l=>this.selectProtected(l)),this._parser.registerCsiHandler({intermediates:"$",final:"p"},l=>this.requestMode(l,!0)),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},l=>this.requestMode(l,!1)),this._parser.setExecuteHandler(E.BEL,()=>this.bell()),this._parser.setExecuteHandler(E.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(E.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(E.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(E.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(E.BS,()=>this.backspace()),this._parser.setExecuteHandler(E.HT,()=>this.tab()),this._parser.setExecuteHandler(E.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(E.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(zi.IND,()=>this.index()),this._parser.setExecuteHandler(zi.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(zi.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new ze(l=>(this.setTitle(l),this.setIconName(l),!0))),this._parser.registerOscHandler(1,new ze(l=>this.setIconName(l))),this._parser.registerOscHandler(2,new ze(l=>this.setTitle(l))),this._parser.registerOscHandler(4,new ze(l=>this.setOrReportIndexedColor(l))),this._parser.registerOscHandler(8,new ze(l=>this.setHyperlink(l))),this._parser.registerOscHandler(10,new ze(l=>this.setOrReportFgColor(l))),this._parser.registerOscHandler(11,new ze(l=>this.setOrReportBgColor(l))),this._parser.registerOscHandler(12,new ze(l=>this.setOrReportCursorColor(l))),this._parser.registerOscHandler(104,new ze(l=>this.restoreIndexedColor(l))),this._parser.registerOscHandler(110,new ze(l=>this.restoreFgColor(l))),this._parser.registerOscHandler(111,new ze(l=>this.restoreBgColor(l))),this._parser.registerOscHandler(112,new ze(l=>this.restoreCursorColor(l))),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 l in ge)this._parser.registerEscHandler({intermediates:"(",final:l},()=>this.selectCharset("("+l)),this._parser.registerEscHandler({intermediates:")",final:l},()=>this.selectCharset(")"+l)),this._parser.registerEscHandler({intermediates:"*",final:l},()=>this.selectCharset("*"+l)),this._parser.registerEscHandler({intermediates:"+",final:l},()=>this.selectCharset("+"+l)),this._parser.registerEscHandler({intermediates:"-",final:l},()=>this.selectCharset("-"+l)),this._parser.registerEscHandler({intermediates:".",final:l},()=>this.selectCharset("."+l)),this._parser.registerEscHandler({intermediates:"/",final:l},()=>this.selectCharset("/"+l));this._parser.registerEscHandler({intermediates:"#",final:"8"},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler(l=>(this._logService.error("Parsing error: ",l),l)),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new Rn((l,f)=>this.requestStatusString(l,f)))}getAttrData(){return this._curAttrData}_preserveStack(e,t,i,s){this._parseStack.paused=!0,this._parseStack.cursorStartX=e,this._parseStack.cursorStartY=t,this._parseStack.decodedLength=i,this._parseStack.position=s}_logSlowResolvingAsync(e){this._logService.logLevel<=3&&Promise.race([e,new Promise((t,i)=>setTimeout(()=>i("#SLOW_TIMEOUT"),Pn))]).catch(t=>{if(t!=="#SLOW_TIMEOUT")throw t;console.warn(`async parser handler taking longer than ${Pn} ms`)})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(e,t){let i,s=this._activeBuffer.x,r=this._activeBuffer.y,n=0,o=this._parseStack.paused;if(o){if(i=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,t))return this._logSlowResolvingAsync(i),i;s=this._parseStack.cursorStartX,r=this._parseStack.cursorStartY,this._parseStack.paused=!1,e.length>mt&&(n=this._parseStack.position+mt)}if(this._logService.logLevel<=1&&this._logService.debug(`parsing data ${typeof e=="string"?` "${e}"`:` "${Array.prototype.map.call(e,l=>String.fromCharCode(l)).join("")}"`}`),this._logService.logLevel===0&&this._logService.trace("parsing data (codes)",typeof e=="string"?e.split("").map(l=>l.charCodeAt(0)):e),this._parseBuffer.length<e.length&&this._parseBuffer.length<mt&&(this._parseBuffer=new Uint32Array(Math.min(e.length,mt))),o||this._dirtyRowTracker.clearRange(),e.length>mt)for(let l=n;l<e.length;l+=mt){let f=l+mt<e.length?l+mt:e.length,d=typeof e=="string"?this._stringDecoder.decode(e.substring(l,f),this._parseBuffer):this._utf8Decoder.decode(e.subarray(l,f),this._parseBuffer);if(i=this._parser.parse(this._parseBuffer,d))return this._preserveStack(s,r,d,l),this._logSlowResolvingAsync(i),i}else if(!o){let l=typeof e=="string"?this._stringDecoder.decode(e,this._parseBuffer):this._utf8Decoder.decode(e,this._parseBuffer);if(i=this._parser.parse(this._parseBuffer,l))return this._preserveStack(s,r,l,0),this._logSlowResolvingAsync(i),i}(this._activeBuffer.x!==s||this._activeBuffer.y!==r)&&this._onCursorMove.fire();let a=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),h=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);h<this._bufferService.rows&&this._onRequestRefreshRows.fire({start:Math.min(h,this._bufferService.rows-1),end:Math.min(a,this._bufferService.rows-1)})}print(e,t,i){let s,r,n=this._charsetService.charset,o=this._optionsService.rawOptions.screenReaderMode,a=this._bufferService.cols,h=this._coreService.decPrivateModes.wraparound,l=this._coreService.modes.insertMode,f=this._curAttrData,d=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&i-t>0&&d.getWidth(this._activeBuffer.x-1)===2&&d.setCellFromCodepoint(this._activeBuffer.x-1,0,1,f);let u=this._parser.precedingJoinState;for(let c=t;c<i;++c){if(s=e[c],s<127&&n){let w=n[String.fromCharCode(s)];w&&(s=w.charCodeAt(0))}let p=this._unicodeService.charProperties(s,u);r=At.extractWidth(p);let _=At.extractShouldJoin(p),S=_?At.extractWidth(u):0;if(u=p,o&&this._onA11yChar.fire(St(s)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+r-S>a){if(h){let w=d,y=this._activeBuffer.x-S;for(this._activeBuffer.x=S,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),S>0&&d instanceof ai&&d.copyCellsFrom(w,y,0,S,!1);y<a;)w.setCellFromCodepoint(y++,0,1,f)}else if(this._activeBuffer.x=a-1,r===2)continue}if(_&&this._activeBuffer.x){let w=d.getWidth(this._activeBuffer.x-1)?1:2;d.addCodepointToCell(this._activeBuffer.x-w,s,r);for(let y=r-S;--y>=0;)d.setCellFromCodepoint(this._activeBuffer.x++,0,0,f);continue}if(l&&(d.insertCells(this._activeBuffer.x,r-S,this._activeBuffer.getNullCell(f)),d.getWidth(a-1)===2&&d.setCellFromCodepoint(a-1,0,1,f)),d.setCellFromCodepoint(this._activeBuffer.x++,s,r,f),r>0)for(;--r;)d.setCellFromCodepoint(this._activeBuffer.x++,0,0,f)}this._parser.precedingJoinState=u,this._activeBuffer.x<a&&i-t>0&&d.getWidth(this._activeBuffer.x)===0&&!d.hasContent(this._activeBuffer.x)&&d.setCellFromCodepoint(this._activeBuffer.x,0,1,f),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(e,t){return e.final==="t"&&!e.prefix&&!e.intermediates?this._parser.registerCsiHandler(e,i=>In(i.params[0],this._optionsService.rawOptions.windowOptions)?t(i):!0):this._parser.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._parser.registerDcsHandler(e,new Rn(t))}registerEscHandler(e,t){return this._parser.registerEscHandler(e,t)}registerOscHandler(e,t){return this._parser.registerOscHandler(e,new ze(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,i,s=!1,r=!1){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n.replaceCells(t,i,this._activeBuffer.getNullCell(this._eraseAttrData()),r),s&&(n.isWrapped=!1)}_resetBufferLine(e,t=!1){let i=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);i&&(i.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),t),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+e),i.isWrapped=!1)}eraseInDisplay(e,t=!1){this._restrictCursor(this._bufferService.cols);let i;switch(e.params[0]){case 0:for(i=this._activeBuffer.y,this._dirtyRowTracker.markDirty(i),this._eraseInBufferLine(i++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);i<this._bufferService.rows;i++)this._resetBufferLine(i,t);this._dirtyRowTracker.markDirty(i);break;case 1:for(i=this._activeBuffer.y,this._dirtyRowTracker.markDirty(i),this._eraseInBufferLine(i,0,this._activeBuffer.x+1,!0,t),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(i+1).isWrapped=!1);i--;)this._resetBufferLine(i,t);this._dirtyRowTracker.markDirty(0);break;case 2:if(this._optionsService.rawOptions.scrollOnEraseInDisplay){for(i=this._bufferService.rows,this._dirtyRowTracker.markRangeDirty(0,i-1);i--&&!this._activeBuffer.lines.get(this._activeBuffer.ybase+i)?.getTrimmedLength(););for(;i>=0;i--)this._bufferService.scroll(this._eraseAttrData())}else{for(i=this._bufferService.rows,this._dirtyRowTracker.markDirty(i-1);i--;)this._resetBufferLine(i,t);this._dirtyRowTracker.markDirty(0)}break;case 3:let s=this._activeBuffer.lines.length-this._bufferService.rows;s>0&&(this._activeBuffer.lines.trimStart(s),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-s,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-s,0),this._onScroll.fire(0));break}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);break}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 i=this._activeBuffer.ybase+this._activeBuffer.y,s=this._bufferService.rows-1-this._activeBuffer.scrollBottom,r=this._bufferService.rows-1+this._activeBuffer.ybase-s+1;for(;t--;)this._activeBuffer.lines.splice(r-1,1),this._activeBuffer.lines.splice(i,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 i=this._activeBuffer.ybase+this._activeBuffer.y,s;for(s=this._bufferService.rows-1-this._activeBuffer.scrollBottom,s=this._bufferService.rows-1+this._activeBuffer.ybase-s;t--;)this._activeBuffer.lines.splice(i,1),this._activeBuffer.lines.splice(s,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(de));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 i=this._activeBuffer.scrollTop;i<=this._activeBuffer.scrollBottom;++i){let s=this._activeBuffer.lines.get(this._activeBuffer.ybase+i);s.deleteCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),s.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 i=this._activeBuffer.scrollTop;i<=this._activeBuffer.scrollBottom;++i){let s=this._activeBuffer.lines.get(this._activeBuffer.ybase+i);s.insertCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),s.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 i=this._activeBuffer.scrollTop;i<=this._activeBuffer.scrollBottom;++i){let s=this._activeBuffer.lines.get(this._activeBuffer.ybase+i);s.insertCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),s.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 i=this._activeBuffer.scrollTop;i<=this._activeBuffer.scrollBottom;++i){let s=this._activeBuffer.lines.get(this._activeBuffer.ybase+i);s.deleteCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),s.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 i=e.params[0]||1,s=At.extractWidth(t),r=this._activeBuffer.x-s,n=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(r),o=new Uint32Array(n.length*i),a=0;for(let l=0;l<n.length;){let f=n.codePointAt(l)||0;o[a++]=f,l+=f>65535?2:1}let h=a;for(let l=1;l<i;++l)o.copyWithin(h,0,a),h+=a;return this.print(o,0,h),!0}sendDeviceAttributesPrimary(e){return e.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(E.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(E.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(e){return e.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(E.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(E.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(e.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(E.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;break}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,Mt),this._charsetService.setgCharset(1,Mt),this._charsetService.setgCharset(2,Mt),this._charsetService.setgCharset(3,Mt);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;break}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;break}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);break}return!0}requestMode(e,t){let i;(_=>(_[_.NOT_RECOGNIZED=0]="NOT_RECOGNIZED",_[_.SET=1]="SET",_[_.RESET=2]="RESET",_[_.PERMANENTLY_SET=3]="PERMANENTLY_SET",_[_.PERMANENTLY_RESET=4]="PERMANENTLY_RESET"))(i||={});let s=this._coreService.decPrivateModes,{activeProtocol:r,activeEncoding:n}=this._coreMouseService,o=this._coreService,{buffers:a,cols:h}=this._bufferService,{active:l,alt:f}=a,d=this._optionsService.rawOptions,u=(_,S)=>(o.triggerDataEvent(`${E.ESC}[${t?"":"?"}${_};${S}$y`),!0),c=_=>_?1:2,p=e.params[0];return t?p===2?u(p,4):p===4?u(p,c(o.modes.insertMode)):p===12?u(p,3):p===20?u(p,c(d.convertEol)):u(p,0):p===1?u(p,c(s.applicationCursorKeys)):p===3?u(p,d.windowOptions.setWinLines?h===80?2:h===132?1:0:0):p===6?u(p,c(s.origin)):p===7?u(p,c(s.wraparound)):p===8?u(p,3):p===9?u(p,c(r==="X10")):p===12?u(p,c(d.cursorBlink)):p===25?u(p,c(!o.isCursorHidden)):p===45?u(p,c(s.reverseWraparound)):p===66?u(p,c(s.applicationKeypad)):p===67?u(p,4):p===1e3?u(p,c(r==="VT200")):p===1002?u(p,c(r==="DRAG")):p===1003?u(p,c(r==="ANY")):p===1004?u(p,c(s.sendFocus)):p===1005?u(p,4):p===1006?u(p,c(n==="SGR")):p===1015?u(p,4):p===1016?u(p,c(n==="SGR_PIXELS")):p===1048?u(p,1):p===47||p===1047||p===1049?u(p,c(l===f)):p===2004?u(p,c(s.bracketedPasteMode)):p===2026?u(p,c(s.synchronizedOutput)):u(p,0)}_updateAttrColor(e,t,i,s,r){return t===2?(e|=50331648,e&=-16777216,e|=mi.fromColorRGB([i,s,r])):t===5&&(e&=-50331904,e|=33554432|i&255),e}_extractColor(e,t,i){let s=[0,0,-1,0,0,0],r=0,n=0;do{if(s[n+r]=e.params[t+n],e.hasSubParams(t+n)){let o=e.getSubParams(t+n),a=0;do s[1]===5&&(r=1),s[n+a+1+r]=o[a];while(++a<o.length&&a+n+1+r<s.length);break}if(s[1]===5&&n+r>=2||s[1]===2&&n+r>=5)break;s[1]&&(r=1)}while(++n+t<e.length&&n+r<s.length);for(let o=2;o<s.length;++o)s[o]===-1&&(s[o]=0);switch(s[0]){case 38:i.fg=this._updateAttrColor(i.fg,s[1],s[3],s[4],s[5]);break;case 48:i.bg=this._updateAttrColor(i.bg,s[1],s[3],s[4],s[5]);break;case 58:i.extended=i.extended.clone(),i.extended.underlineColor=this._updateAttrColor(i.extended.underlineColor,s[1],s[3],s[4],s[5])}return n}_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=de.fg,e.bg=de.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,i,s=this._curAttrData;for(let r=0;r<t;r++)i=e.params[r],i>=30&&i<=37?(s.fg&=-50331904,s.fg|=16777216|i-30):i>=40&&i<=47?(s.bg&=-50331904,s.bg|=16777216|i-40):i>=90&&i<=97?(s.fg&=-50331904,s.fg|=16777216|i-90|8):i>=100&&i<=107?(s.bg&=-50331904,s.bg|=16777216|i-100|8):i===0?this._processSGR0(s):i===1?s.fg|=134217728:i===3?s.bg|=67108864:i===4?(s.fg|=268435456,this._processUnderline(e.hasSubParams(r)?e.getSubParams(r)[0]:1,s)):i===5?s.fg|=536870912:i===7?s.fg|=67108864:i===8?s.fg|=1073741824:i===9?s.fg|=2147483648:i===2?s.bg|=134217728:i===21?this._processUnderline(2,s):i===22?(s.fg&=-134217729,s.bg&=-134217729):i===23?s.bg&=-67108865:i===24?(s.fg&=-268435457,this._processUnderline(0,s)):i===25?s.fg&=-536870913:i===27?s.fg&=-67108865:i===28?s.fg&=-1073741825:i===29?s.fg&=2147483647:i===39?(s.fg&=-67108864,s.fg|=de.fg&16777215):i===49?(s.bg&=-67108864,s.bg|=de.bg&16777215):i===38||i===48||i===58?r+=this._extractColor(e,r,s):i===53?s.bg|=1073741824:i===55?s.bg&=-1073741825:i===59?(s.extended=s.extended.clone(),s.extended.underlineColor=-1,s.updateExtended()):i===100?(s.fg&=-67108864,s.fg|=de.fg&16777215,s.bg&=-67108864,s.bg|=de.bg&16777215):this._logService.debug("Unknown SGR attribute: %d.",i);return!0}deviceStatus(e){switch(e.params[0]){case 5:this._coreService.triggerDataEvent(`${E.ESC}[0n`);break;case 6:let t=this._activeBuffer.y+1,i=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${E.ESC}[${t};${i}R`);break}return!0}deviceStatusPrivate(e){if(e.params[0]===6){let t=this._activeBuffer.y+1,i=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${E.ESC}[?${t};${i}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=de.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";break}let i=t%2===1;this._coreService.decPrivateModes.cursorBlink=i}return!0}setScrollRegion(e){let t=e.params[0]||1,i;return(e.length<2||(i=e.params[1])>this._bufferService.rows||i===0)&&(i=this._bufferService.rows),i>t&&(this._activeBuffer.scrollTop=t-1,this._activeBuffer.scrollBottom=i-1,this._setCursor(0,0)),!0}windowOptions(e){if(!In(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(`${E.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:(t===0||t===2)&&(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>Tn&&this._windowTitleStack.shift()),(t===0||t===1)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>Tn&&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());break}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=[],i=e.split(";");for(;i.length>1;){let s=i.shift(),r=i.shift();if(/^\d+$/.exec(s)){let n=parseInt(s);if(Nn(n))if(r==="?")t.push({type:0,index:n});else{let o=An(r);o&&t.push({type:1,index:n,color:o})}}}return t.length&&this._onColor.fire(t),!0}setHyperlink(e){let t=e.indexOf(";");if(t===-1)return!0;let i=e.slice(0,t).trim(),s=e.slice(t+1);return s?this._createHyperlink(i,s):i.trim()?!1:this._finishHyperlink()}_createHyperlink(e,t){this._getCurrentLinkId()&&this._finishHyperlink();let i=e.split(":"),s,r=i.findIndex(n=>n.startsWith("id="));return r!==-1&&(s=i[r].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:s,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 i=e.split(";");for(let s=0;s<i.length&&!(t>=this._specialColors.length);++s,++t)if(i[s]==="?")this._onColor.fire([{type:0,index:this._specialColors[t]}]);else{let r=An(i[s]);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=[],i=e.split(";");for(let s=0;s<i.length;++s)if(/^\d+$/.exec(i[s])){let r=parseInt(i[s]);Nn(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,Mt),!0}selectCharset(e){return e.length!==2?(this.selectDefaultCharset(),!0):(e[0]==="/"||this._charsetService.setgCharset(zd[e[0]],ge[e[1]]||Mt),!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=de.clone(),this._eraseAttrDataInternal=de.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 Ve;e.content=1<<22|69,e.fg=this._curAttrData.fg,e.bg=this._curAttrData.bg,this._setCursor(0,0);for(let t=0;t<this._bufferService.rows;++t){let i=this._activeBuffer.ybase+this._activeBuffer.y+t,s=this._activeBuffer.lines.get(i);s&&(s.fill(e),s.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(e,t){let i=o=>(this._coreService.triggerDataEvent(`${E.ESC}${o}${E.ESC}\\`),!0),s=this._bufferService.buffer,r=this._optionsService.rawOptions;return i(e==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:e==='"p'?'P1$r61;1"p':e==="r"?`P1$r${s.scrollTop+1};${s.scrollBottom+1}r`:e==="m"?"P1$r0m":e===" q"?`P1$r${{block:2,underline:4,bar:6}[r.cursorStyle]-(r.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(e,t){this._dirtyRowTracker.markRangeDirty(e,t)}},vr=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&&(On=e,e=t,t=On),e<this.start&&(this.start=e),t>this.end&&(this.end=t)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};vr=ce([N(0,Me)],vr);function Nn(e){return 0<=e&&e<256}var Hd=5e7,zn=12,$d=50,Wd=class extends Q{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 T),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 i;for(;i=this._writeBuffer.shift();){this._action(i);let s=this._callbacks.shift();s&&s()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(e,t){if(this._pendingData>Hd)throw new 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 i=e||performance.now();for(;this._writeBuffer.length>this._bufferOffset;){let s=this._writeBuffer[this._bufferOffset],r=this._action(s,t);if(r){let o=a=>performance.now()-i>=zn?setTimeout(()=>this._innerWrite(0,a)):this._innerWrite(i,a);r.catch(a=>(queueMicrotask(()=>{throw a}),Promise.resolve(!1))).then(o);return}let n=this._callbacks[this._bufferOffset];if(n&&n(),this._bufferOffset++,this._pendingData-=s.length,performance.now()-i>=zn)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>$d&&(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()}},mr=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 a=t.addMarker(t.ybase+t.y),h={data:e,id:this._nextId++,lines:[a]};return a.onDispose(()=>this._removeMarkerFromLink(h,a)),this._dataByLinkId.set(h.id,h),h.id}let i=e,s=this._getEntryIdKey(i),r=this._entriesWithId.get(s);if(r)return this.addLineToLink(r.id,t.ybase+t.y),r.id;let n=t.addMarker(t.ybase+t.y),o={id:this._nextId++,key:this._getEntryIdKey(i),data:i,lines:[n]};return n.onDispose(()=>this._removeMarkerFromLink(o,n)),this._entriesWithId.set(o.key,o),this._dataByLinkId.set(o.id,o),o.id}addLineToLink(e,t){let i=this._dataByLinkId.get(e);if(i&&i.lines.every(s=>s.line!==t)){let s=this._bufferService.buffer.addMarker(t);i.lines.push(s),s.onDispose(()=>this._removeMarkerFromLink(i,s))}}getLinkData(e){return this._dataByLinkId.get(e)?.data}_getEntryIdKey(e){return`${e.id};;${e.uri}`}_removeMarkerFromLink(e,t){let i=e.lines.indexOf(t);i!==-1&&(e.lines.splice(i,1),e.lines.length===0&&(e.data.id!==void 0&&this._entriesWithId.delete(e.key),this._dataByLinkId.delete(e.id)))}};mr=ce([N(0,Me)],mr);var Fn=!1,qd=class extends Q{constructor(e){super(),this._windowsWrappingHeuristics=this._register(new jt),this._onBinary=this._register(new T),this.onBinary=this._onBinary.event,this._onData=this._register(new T),this.onData=this._onData.event,this._onLineFeed=this._register(new T),this.onLineFeed=this._onLineFeed.event,this._onResize=this._register(new T),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new T),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new T),this._instantiationService=new fd,this.optionsService=this._register(new Cd(e)),this._instantiationService.setService(Re,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance(fr)),this._instantiationService.setService(Me,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(dr)),this._instantiationService.setService(xo,this._logService),this.coreService=this._register(this._instantiationService.createInstance(_r)),this._instantiationService.setService(Ft,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(pr)),this._instantiationService.setService(ko,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(At)),this._instantiationService.setService(hc,this.unicodeService),this._charsetService=this._instantiationService.createInstance(Ld),this._instantiationService.setService(lc,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(mr),this._instantiationService.setService(Eo,this._oscLinkService),this._inputHandler=this._register(new Fd(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this._register(xe.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(this._inputHandler),this._register(xe.forward(this._bufferService.onResize,this._onResize)),this._register(xe.forward(this.coreService.onData,this._onData)),this._register(xe.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 Wd((t,i)=>this._inputHandler.parse(t,i))),this._register(xe.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new T),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&&!Fn&&(this._logService.warn("writeSync is unreliable and will be removed soon."),Fn=!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,ra),t=Math.max(t,na),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(Mn.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:"H"},()=>(Mn(this._bufferService),!1))),this._windowsWrappingHeuristics.value=oe(()=>{for(let t of e)t.dispose()})}}},Kd={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 Ud(e,t,i,s){let r={type:0,cancel:!1,key:void 0},n=(e.shiftKey?1:0)|(e.altKey?2:0)|(e.ctrlKey?4:0)|(e.metaKey?8:0);switch(e.keyCode){case 0:e.key==="UIKeyInputUpArrow"?t?r.key=E.ESC+"OA":r.key=E.ESC+"[A":e.key==="UIKeyInputLeftArrow"?t?r.key=E.ESC+"OD":r.key=E.ESC+"[D":e.key==="UIKeyInputRightArrow"?t?r.key=E.ESC+"OC":r.key=E.ESC+"[C":e.key==="UIKeyInputDownArrow"&&(t?r.key=E.ESC+"OB":r.key=E.ESC+"[B");break;case 8:r.key=e.ctrlKey?"\b":E.DEL,e.altKey&&(r.key=E.ESC+r.key);break;case 9:if(e.shiftKey){r.key=E.ESC+"[Z";break}r.key=E.HT,r.cancel=!0;break;case 13:r.key=e.altKey?E.ESC+E.CR:E.CR,r.cancel=!0;break;case 27:r.key=E.ESC,e.altKey&&(r.key=E.ESC+E.ESC),r.cancel=!0;break;case 37:if(e.metaKey)break;n?r.key=E.ESC+"[1;"+(n+1)+"D":t?r.key=E.ESC+"OD":r.key=E.ESC+"[D";break;case 39:if(e.metaKey)break;n?r.key=E.ESC+"[1;"+(n+1)+"C":t?r.key=E.ESC+"OC":r.key=E.ESC+"[C";break;case 38:if(e.metaKey)break;n?r.key=E.ESC+"[1;"+(n+1)+"A":t?r.key=E.ESC+"OA":r.key=E.ESC+"[A";break;case 40:if(e.metaKey)break;n?r.key=E.ESC+"[1;"+(n+1)+"B":t?r.key=E.ESC+"OB":r.key=E.ESC+"[B";break;case 45:!e.shiftKey&&!e.ctrlKey&&(r.key=E.ESC+"[2~");break;case 46:n?r.key=E.ESC+"[3;"+(n+1)+"~":r.key=E.ESC+"[3~";break;case 36:n?r.key=E.ESC+"[1;"+(n+1)+"H":t?r.key=E.ESC+"OH":r.key=E.ESC+"[H";break;case 35:n?r.key=E.ESC+"[1;"+(n+1)+"F":t?r.key=E.ESC+"OF":r.key=E.ESC+"[F";break;case 33:e.shiftKey?r.type=2:e.ctrlKey?r.key=E.ESC+"[5;"+(n+1)+"~":r.key=E.ESC+"[5~";break;case 34:e.shiftKey?r.type=3:e.ctrlKey?r.key=E.ESC+"[6;"+(n+1)+"~":r.key=E.ESC+"[6~";break;case 112:n?r.key=E.ESC+"[1;"+(n+1)+"P":r.key=E.ESC+"OP";break;case 113:n?r.key=E.ESC+"[1;"+(n+1)+"Q":r.key=E.ESC+"OQ";break;case 114:n?r.key=E.ESC+"[1;"+(n+1)+"R":r.key=E.ESC+"OR";break;case 115:n?r.key=E.ESC+"[1;"+(n+1)+"S":r.key=E.ESC+"OS";break;case 116:n?r.key=E.ESC+"[15;"+(n+1)+"~":r.key=E.ESC+"[15~";break;case 117:n?r.key=E.ESC+"[17;"+(n+1)+"~":r.key=E.ESC+"[17~";break;case 118:n?r.key=E.ESC+"[18;"+(n+1)+"~":r.key=E.ESC+"[18~";break;case 119:n?r.key=E.ESC+"[19;"+(n+1)+"~":r.key=E.ESC+"[19~";break;case 120:n?r.key=E.ESC+"[20;"+(n+1)+"~":r.key=E.ESC+"[20~";break;case 121:n?r.key=E.ESC+"[21;"+(n+1)+"~":r.key=E.ESC+"[21~";break;case 122:n?r.key=E.ESC+"[23;"+(n+1)+"~":r.key=E.ESC+"[23~";break;case 123:n?r.key=E.ESC+"[24;"+(n+1)+"~":r.key=E.ESC+"[24~";break;default:if(e.ctrlKey&&!e.shiftKey&&!e.altKey&&!e.metaKey)e.keyCode>=65&&e.keyCode<=90?r.key=String.fromCharCode(e.keyCode-64):e.keyCode===32?r.key=E.NUL:e.keyCode>=51&&e.keyCode<=55?r.key=String.fromCharCode(e.keyCode-51+27):e.keyCode===56?r.key=E.DEL:e.keyCode===219?r.key=E.ESC:e.keyCode===220?r.key=E.FS:e.keyCode===221&&(r.key=E.GS);else if((!i||s)&&e.altKey&&!e.metaKey){let o=Kd[e.keyCode]?.[e.shiftKey?1:0];if(o)r.key=E.ESC+o;else if(e.keyCode>=65&&e.keyCode<=90){let a=e.ctrlKey?e.keyCode-64:e.keyCode+32,h=String.fromCharCode(a);e.shiftKey&&(h=h.toUpperCase()),r.key=E.ESC+h}else if(e.keyCode===32)r.key=E.ESC+(e.ctrlKey?E.NUL:" ");else if(e.key==="Dead"&&e.code.startsWith("Key")){let a=e.code.slice(3,4);e.shiftKey||(a=a.toLowerCase()),r.key=E.ESC+a,r.cancel=!0}}else i&&!e.altKey&&!e.ctrlKey&&!e.shiftKey&&e.metaKey?e.keyCode===65&&(r.type=1):e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.keyCode>=48&&e.key.length===1?r.key=e.key:e.key&&e.ctrlKey&&(e.key==="_"&&(r.key=E.US),e.key==="@"&&(r.key=E.NUL));break}return r}var ue=0,Vd=class{constructor(e){this._getKey=e,this._array=[],this._insertedValues=[],this._flushInsertedTask=new Zi,this._isFlushingInserted=!1,this._deletedIndices=[],this._flushDeletedTask=new Zi,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((r,n)=>this._getKey(r)-this._getKey(n)),t=0,i=0,s=new Array(this._array.length+this._insertedValues.length);for(let r=0;r<s.length;r++)i>=this._array.length||this._getKey(e[t])<=this._getKey(this._array[i])?(s[r]=e[t],t++):s[r]=this._array[i++];this._array=s,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||(ue=this._search(t),ue===-1)||this._getKey(this._array[ue])!==t)return!1;do if(this._array[ue]===e)return this._deletedIndices.length===0&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(ue),!0;while(++ue<this._array.length&&this._getKey(this._array[ue])===t);return!1}_flushDeleted(){this._isFlushingDeleted=!0;let e=this._deletedIndices.sort((r,n)=>r-n),t=0,i=new Array(this._array.length-e.length),s=0;for(let r=0;r<this._array.length;r++)e[t]===r?t++:i[s++]=this._array[r];this._array=i,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&&(ue=this._search(e),!(ue<0||ue>=this._array.length)&&this._getKey(this._array[ue])===e))do yield this._array[ue];while(++ue<this._array.length&&this._getKey(this._array[ue])===e)}forEachByKey(e,t){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(ue=this._search(e),!(ue<0||ue>=this._array.length)&&this._getKey(this._array[ue])===e))do t(this._array[ue]);while(++ue<this._array.length&&this._getKey(this._array[ue])===e)}values(){return this._flushCleanupInserted(),this._flushCleanupDeleted(),[...this._array].values()}_search(e){let t=0,i=this._array.length-1;for(;i>=t;){let s=t+i>>1,r=this._getKey(this._array[s]);if(r>e)i=s-1;else if(r<e)t=s+1;else{for(;s>0&&this._getKey(this._array[s-1])===e;)s--;return s}}return t}},Ls=0,Hn=0,jd=class extends Q{constructor(){super(),this._decorations=new Vd(e=>e?.marker.line),this._onDecorationRegistered=this._register(new T),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this._register(new T),this.onDecorationRemoved=this._onDecorationRemoved.event,this._register(oe(()=>this.reset()))}get decorations(){return this._decorations.values()}registerDecoration(e){if(e.marker.isDisposed)return;let t=new Yd(e);if(t){let i=t.marker.onDispose(()=>t.dispose()),s=t.onDispose(()=>{s.dispose(),t&&(this._decorations.delete(t)&&this._onDecorationRemoved.fire(t),i.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,i){let s=0,r=0;for(let n of this._decorations.getKeyIterator(t))s=n.options.x??0,r=s+(n.options.width??1),e>=s&&e<r&&(!i||(n.options.layer??"bottom")===i)&&(yield n)}forEachDecorationAtCell(e,t,i,s){this._decorations.forEachByKey(t,r=>{Ls=r.options.x??0,Hn=Ls+(r.options.width??1),e>=Ls&&e<Hn&&(!i||(r.options.layer??"bottom")===i)&&s(r)})}},Yd=class extends Ct{constructor(e){super(),this.options=e,this.onRenderEmitter=this.add(new T),this.onRender=this.onRenderEmitter.event,this._onDispose=this.add(new T),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.options.backgroundColor?this._cachedBg=le.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=le.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}dispose(){this._onDispose.fire(),super.dispose()}},Gd=1e3,Xd=class{constructor(e,t=Gd){this._renderCallback=e,this._debounceThresholdMS=t,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(e,t,i){this._rowCount=i,e=e!==void 0?e:0,t=t!==void 0?t:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,e):e,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,t):t;let s=performance.now();if(s-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=s,this._innerRefresh();else if(!this._additionalRefreshRequested){let r=s-this._lastRefreshMs,n=this._debounceThresholdMS-r;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=performance.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},n)}}_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)}},$n=20,Qi=class extends Q{constructor(e,t,i,s){super(),this._terminal=e,this._coreBrowserService=i,this._renderService=s,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="";let r=this._coreBrowserService.mainDocument;this._accessibilityContainer=r.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=r.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let n=0;n<this._terminal.rows;n++)this._rowElements[n]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[n]);if(this._topBoundaryFocusListener=n=>this._handleBoundaryFocus(n,0),this._bottomBoundaryFocusListener=n=>this._handleBoundaryFocus(n,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=r.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this._register(new Xd(this._renderRows.bind(this))),!this._terminal.element)throw new Error("Cannot enable accessibility before Terminal.open");this._terminal.element.insertAdjacentElement("afterbegin",this._accessibilityContainer),this._register(this._terminal.onResize(n=>this._handleResize(n.rows))),this._register(this._terminal.onRender(n=>this._refreshRows(n.start,n.end))),this._register(this._terminal.onScroll(()=>this._refreshRows())),this._register(this._terminal.onA11yChar(n=>this._handleChar(n))),this._register(this._terminal.onLineFeed(()=>this._handleChar(`
|
|
14
14
|
`))),this._register(this._terminal.onA11yTab(n=>this._handleTab(n))),this._register(this._terminal.onKey(n=>this._handleKey(n.key))),this._register(this._terminal.onBlur(()=>this._clearLiveRegion())),this._register(this._renderService.onDimensionsChange(()=>this._refreshRowsDimensions())),this._register(K(r,"selectionchange",()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register(oe(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(e){for(let t=0;t<e;t++)this._handleChar(" ")}_handleChar(e){this._liveRegionLineCount<$n+1&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===`
|
|
15
15
|
`&&(this._liveRegionLineCount++,this._liveRegionLineCount===$n+1&&(this._liveRegion.textContent+=zs.get())))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(e){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(e)||this._charsToConsume.push(e)}_refreshRows(e,t){this._liveRegionDebouncer.refresh(e,t,this._terminal.rows)}_renderRows(e,t){let i=this._terminal.buffer,s=i.lines.length.toString();for(let r=e;r<=t;r++){let n=i.lines.get(i.ydisp+r),o=[],a=n?.translateToString(!0,void 0,void 0,o)||"",h=(i.ydisp+r+1).toString(),l=this._rowElements[r];l&&(a.length===0?(l.textContent=" ",this._rowColumns.set(l,[0,1])):(l.textContent=a,this._rowColumns.set(l,o)),l.setAttribute("aria-posinset",h),l.setAttribute("aria-setsize",s),this._alignRowWidth(l))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(e,t){let i=e.target,s=this._rowElements[t===0?1:this._rowElements.length-2],r=i.getAttribute("aria-posinset"),n=t===0?"1":`${this._terminal.buffer.lines.length}`;if(r===n||e.relatedTarget!==s)return;let o,a;if(t===0?(o=i,a=this._rowElements.pop(),this._rowContainer.removeChild(a)):(o=this._rowElements.shift(),a=i,this._rowContainer.removeChild(o)),o.removeEventListener("focus",this._topBoundaryFocusListener),a.removeEventListener("focus",this._bottomBoundaryFocusListener),t===0){let h=this._createAccessibilityTreeNode();this._rowElements.unshift(h),this._rowContainer.insertAdjacentElement("afterbegin",h)}else{let h=this._createAccessibilityTreeNode();this._rowElements.push(h),this._rowContainer.appendChild(h)}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},i={node:e.focusNode,offset:e.focusOffset};if((t.node.compareDocumentPosition(i.node)&Node.DOCUMENT_POSITION_PRECEDING||t.node===i.node&&t.offset>i.offset)&&([t,i]=[i,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 s=this._rowElements.slice(-1)[0];if(i.node.compareDocumentPosition(s)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(i={node:s,offset:s.textContent?.length??0}),!this._rowContainer.contains(i.node))return;let r=({node:a,offset:h})=>{let l=a instanceof Text?a.parentNode:a,f=parseInt(l?.getAttribute("aria-posinset"),10)-1;if(isNaN(f))return console.warn("row is invalid. Race condition?"),null;let d=this._rowColumns.get(l);if(!d)return console.warn("columns is null. Race condition?"),null;let u=h<d.length?d[h]:d.slice(-1)[0]+1;return u>=this._terminal.cols&&(++f,u=0),{row:f,column:u}},n=r(t),o=r(i);if(!(!n||!o)){if(n.row>o.row||n.row===o.row&&n.column>=o.column)throw new Error("invalid range");this._terminal.select(n.column,n.row,(o.row-n.row)*this._terminal.cols-n.column+o.column)}}_handleResize(e){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let t=this._rowContainer.children.length;t<this._terminal.rows;t++)this._rowElements[t]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[t]);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,i=this._rowColumns.get(e)?.slice(-1)?.[0];if(!i)return;let s=i*this._renderService.dimensions.css.cell.width;e.style.transform=`scaleX(${s/t})`}};Qi=ce([N(1,Lr),N(2,ut),N(3,dt)],Qi);var Sr=class extends Q{constructor(e,t,i,s,r){super(),this._element=e,this._mouseService=t,this._renderService=i,this._bufferService=s,this._linkProviderService=r,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this._register(new T),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this._register(new T),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this._register(oe(()=>{Pt(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(K(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this._register(K(this._element,"mousemove",this._handleMouseMove.bind(this))),this._register(K(this._element,"mousedown",this._handleMouseDown.bind(this))),this._register(K(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 i=e.composedPath();for(let s=0;s<i.length;s++){let r=i[s];if(r.classList.contains("xterm"))break;if(r.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(s=>{s?.forEach(r=>{r.link.dispose&&r.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=e.y);let i=!1;for(let[s,r]of this._linkProviderService.linkProviders.entries())t?this._activeProviderReplies?.get(s)&&(i=this._checkLinkProviderResult(s,e,i)):r.provideLinks(e.y,n=>{if(this._isMouseOut)return;let o=n?.map(a=>({link:a}));this._activeProviderReplies?.set(s,o),i=this._checkLinkProviderResult(s,e,i),this._activeProviderReplies?.size===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(e.y,this._activeProviderReplies)})}_removeIntersectingLinks(e,t){let i=new Set;for(let s=0;s<t.size;s++){let r=t.get(s);if(r)for(let n=0;n<r.length;n++){let o=r[n],a=o.link.range.start.y<e?0:o.link.range.start.x,h=o.link.range.end.y>e?this._bufferService.cols:o.link.range.end.x;for(let l=a;l<=h;l++){if(i.has(l)){r.splice(n--,1);break}i.add(l)}}}}_checkLinkProviderResult(e,t,i){if(!this._activeProviderReplies)return i;let s=this._activeProviderReplies.get(e),r=!1;for(let n=0;n<e;n++)(!this._activeProviderReplies.has(n)||this._activeProviderReplies.get(n))&&(r=!0);if(!r&&s){let n=s.find(o=>this._linkAtPosition(o.link,t));n&&(i=!0,this._handleNewLink(n))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!i)for(let n=0;n<this._activeProviderReplies.size;n++){let o=this._activeProviderReplies.get(n)?.find(a=>this._linkAtPosition(a.link,t));if(o){i=!0,this._handleNewLink(o);break}}return i}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(e){if(!this._currentLink)return;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);t&&this._mouseDownLink&&Jd(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,Pt(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?!0:e.link.decorations.underline,pointerCursor:e.link.decorations===void 0?!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:i=>{this._currentLink?.state&&this._currentLink.state.decorations.pointerCursor!==i&&(this._currentLink.state.decorations.pointerCursor=i,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",i))}},underline:{get:()=>this._currentLink?.state?.decorations.underline,set:i=>{this._currentLink?.state&&this._currentLink?.state?.decorations.underline!==i&&(this._currentLink.state.decorations.underline=i,this._currentLink.state.isHovered&&this._fireUnderlineEvent(e.link,i))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(i=>{if(!this._currentLink)return;let s=i.start===0?0:i.start+1+this._bufferService.buffer.ydisp,r=this._bufferService.buffer.ydisp+1+i.end;if(this._currentLink.link.range.start.y>=s&&this._currentLink.link.range.end.y<=r&&(this._clearCurrentLink(s,r),this._lastMouseEvent)){let n=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);n&&this._askForLink(n,!1)}})))}_linkHover(e,t,i){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(i,t.text)}_fireUnderlineEvent(e,t){let i=e.range,s=this._bufferService.buffer.ydisp,r=this._createLinkUnderlineEvent(i.start.x-1,i.start.y-s-1,i.end.x,i.end.y-s-1,void 0);(t?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(r)}_linkLeave(e,t,i){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(i,t.text)}_linkAtPosition(e,t){let i=e.range.start.y*this._bufferService.cols+e.range.start.x,s=e.range.end.y*this._bufferService.cols+e.range.end.x,r=t.y*this._bufferService.cols+t.x;return i<=r&&r<=s}_positionFromMouseEvent(e,t,i){let s=i.getCoords(e,t,this._bufferService.cols,this._bufferService.rows);if(s)return{x:s[0],y:s[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(e,t,i,s,r){return{x1:e,y1:t,x2:i,y2:s,cols:this._bufferService.cols,fg:r}}};Sr=ce([N(1,Dr),N(2,dt),N(3,Me),N(4,Lo)],Sr);function Jd(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 Zd=class extends qd{constructor(e={}){super(e),this._linkifier=this._register(new jt),this.browser=jo,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new jt),this._onCursorMove=this._register(new T),this.onCursorMove=this._onCursorMove.event,this._onKey=this._register(new T),this.onKey=this._onKey.event,this._onRender=this._register(new T),this.onRender=this._onRender.event,this._onSelectionChange=this._register(new T),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this._register(new T),this.onTitleChange=this._onTitleChange.event,this._onBell=this._register(new T),this.onBell=this._onBell.event,this._onFocus=this._register(new T),this._onBlur=this._register(new T),this._onA11yCharEmitter=this._register(new T),this._onA11yTabEmitter=this._register(new T),this._onWillOpen=this._register(new T),this._setup(),this._decorationService=this._instantiationService.createInstance(jd),this._instantiationService.setService(Si,this._decorationService),this._linkProviderService=this._instantiationService.createInstance($u),this._instantiationService.setService(Lo,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(Hs)),this._register(this._inputHandler.onRequestBell(()=>this._onBell.fire())),this._register(this._inputHandler.onRequestRefreshRows(t=>this.refresh(t?.start??0,t?.end??this.rows-1))),this._register(this._inputHandler.onRequestSendFocus(()=>this._reportFocus())),this._register(this._inputHandler.onRequestReset(()=>this.reset())),this._register(this._inputHandler.onRequestWindowsOptionsReport(t=>this._reportWindowsOptions(t))),this._register(this._inputHandler.onColor(t=>this._handleColorEvent(t))),this._register(xe.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register(xe.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register(xe.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register(xe.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize(t=>this._afterResize(t.cols,t.rows))),this._register(oe(()=>{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 i,s="";switch(t.index){case 256:i="foreground",s="10";break;case 257:i="background",s="11";break;case 258:i="cursor",s="12";break;default:i="ansi",s="4;"+t.index}switch(t.type){case 0:let r=ne.toColorRGB(i==="ansi"?this._themeService.colors.ansi[t.index]:this._themeService.colors[i]);this.coreService.triggerDataEvent(`${E.ESC}]${s};${Nd(r)}${Uo.ST}`);break;case 1:if(i==="ansi")this._themeService.modifyColors(n=>n.ansi[t.index]=fe.toColor(...t.color));else{let n=i;this._themeService.modifyColors(o=>o[n]=fe.toColor(...t.color))}break;case 2:this._themeService.restoreColor(t.index);break}}}_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(Qi,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(E.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(E.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 i=Math.min(this.buffer.x,this.cols-1),s=this._renderService.dimensions.css.cell.height,r=t.getWidth(i),n=this._renderService.dimensions.css.cell.width*r,o=this.buffer.y*this._renderService.dimensions.css.cell.height,a=i*this._renderService.dimensions.css.cell.width;this.textarea.style.left=a+"px",this.textarea.style.top=o+"px",this.textarea.style.width=n+"px",this.textarea.style.height=s+"px",this.textarea.style.lineHeight=s+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this._register(K(this.element,"copy",t=>{this.hasSelection()&&ic(t,this._selectionService)}));let e=t=>sc(t,this.textarea,this.coreService,this.optionsService);this._register(K(this.textarea,"paste",e)),this._register(K(this.element,"paste",e)),Yo?this._register(K(this.element,"mousedown",t=>{t.button===2&&Xr(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register(K(this.element,"contextmenu",t=>{Xr(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),Nr&&this._register(K(this.element,"auxclick",t=>{t.button===1&&So(t,this.textarea,this.screenElement)}))}_bindKeys(){this._register(K(this.textarea,"keyup",e=>this._keyUp(e),!0)),this._register(K(this.textarea,"keydown",e=>this._keyDown(e),!0)),this._register(K(this.textarea,"keypress",e=>this._keyPress(e),!0)),this._register(K(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this._register(K(this.textarea,"compositionupdate",e=>this._compositionHelper.compositionupdate(e))),this._register(K(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this._register(K(this.textarea,"input",e=>this._inputEvent(e),!0)),this._register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(e){if(!e)throw new 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(K(this.screenElement,"mousemove",r=>this.updateCursorStyle(r))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),t.appendChild(this.screenElement);let i=this.textarea=this._document.createElement("textarea");this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",Ns.get()),Jo||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",()=>i.readOnly=this.optionsService.rawOptions.disableStdin)),this.textarea.readOnly=this.optionsService.rawOptions.disableStdin,this._coreBrowserService=this._register(this._instantiationService.createInstance(Fu,this.textarea,e.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(ut,this._coreBrowserService),this._register(K(this.textarea,"focus",r=>this._handleTextAreaFocus(r))),this._register(K(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(ar,this._document,this._helperContainer),this._instantiationService.setService(os,this._charSizeService),this._themeService=this._instantiationService.createInstance(ur),this._instantiationService.setService(Xt,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(Xi),this._instantiationService.setService(Bo,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(hr,this.rows,this.screenElement)),this._instantiationService.setService(dt,this._renderService),this._register(this._renderService.onRenderedViewportChange(r=>this._onRender.fire(r))),this.onResize(r=>this._renderService.resize(r.cols,r.rows)),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(rr,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(lr),this._instantiationService.setService(Dr,this._mouseService);let s=this._linkifier.value=this._register(this._instantiationService.createInstance(Sr,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(ir,this.element,this.screenElement)),this._register(this._viewport.onRequestScrollLines(r=>{super.scrollLines(r,!1),this.refresh(0,this.rows-1)})),this._selectionService=this._register(this._instantiationService.createInstance(cr,this.element,this.screenElement,s)),this._instantiationService.setService(uc,this._selectionService),this._register(this._selectionService.onRequestScrollLines(r=>this.scrollLines(r.amount,r.suppressScrollEvent))),this._register(this._selectionService.onSelectionChange(()=>this._onSelectionChange.fire())),this._register(this._selectionService.onRequestRedraw(r=>this._renderService.handleSelectionChanged(r.start,r.end,r.columnSelectMode))),this._register(this._selectionService.onLinuxMouseSelection(r=>{this.textarea.value=r,this.textarea.focus(),this.textarea.select()})),this._register(xe.any(this._onScroll.event,this._inputHandler.onScroll)(()=>{this._selectionService.refresh(),this._viewport?.queueSync()})),this._register(this._instantiationService.createInstance(sr,this.screenElement)),this._register(K(this.element,"mousedown",r=>this._selectionService.handleMouseDown(r))),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(Qi,this)),this._register(this.optionsService.onSpecificOptionChange("screenReaderMode",r=>this._handleScreenReaderModeOptionChange(r))),this.options.overviewRuler.width&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(Gi,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRuler",r=>{!this._overviewRulerRenderer&&r&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(Gi,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(or,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let e=this,t=this.element;function i(n){let o=e._mouseService.getMouseReportCoords(n,e.screenElement);if(!o)return!1;let a,h;switch(n.overrideType||n.type){case"mousemove":h=32,n.buttons===void 0?(a=3,n.button!==void 0&&(a=n.button<3?n.button:3)):a=n.buttons&1?0:n.buttons&4?1:n.buttons&2?2:3;break;case"mouseup":h=0,a=n.button<3?n.button:3;break;case"mousedown":h=1,a=n.button<3?n.button:3;break;case"wheel":if(e._customWheelEventHandler&&e._customWheelEventHandler(n)===!1)return!1;let l=n.deltaY;if(l===0||e.coreMouseService.consumeWheelEvent(n,e._renderService?.dimensions?.device?.cell?.height,e._coreBrowserService?.dpr)===0)return!1;h=l<0?0:1,a=4;break;default:return!1}return h===void 0||a===void 0||a>4?!1:e.coreMouseService.triggerMouseEvent({col:o.col,row:o.row,x:o.x,y:o.y,button:a,action:h,ctrl:n.ctrlKey,alt:n.altKey,shift:n.shiftKey})}let s={mouseup:null,wheel:null,mousedrag:null,mousemove:null},r={mouseup:n=>(i(n),n.buttons||(this._document.removeEventListener("mouseup",s.mouseup),s.mousedrag&&this._document.removeEventListener("mousemove",s.mousedrag)),this.cancel(n)),wheel:n=>(i(n),this.cancel(n,!0)),mousedrag:n=>{n.buttons&&i(n)},mousemove:n=>{n.buttons||i(n)}};this._register(this.coreMouseService.onProtocolChange(n=>{n?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(n)),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()),n&8?s.mousemove||(t.addEventListener("mousemove",r.mousemove),s.mousemove=r.mousemove):(t.removeEventListener("mousemove",s.mousemove),s.mousemove=null),n&16?s.wheel||(t.addEventListener("wheel",r.wheel,{passive:!1}),s.wheel=r.wheel):(t.removeEventListener("wheel",s.wheel),s.wheel=null),n&2?s.mouseup||(s.mouseup=r.mouseup):(this._document.removeEventListener("mouseup",s.mouseup),s.mouseup=null),n&4?s.mousedrag||(s.mousedrag=r.mousedrag):(this._document.removeEventListener("mousemove",s.mousedrag),s.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this._register(K(t,"mousedown",n=>{if(n.preventDefault(),this.focus(),!(!this.coreMouseService.areMouseEventsActive||this._selectionService.shouldForceSelection(n)))return i(n),s.mouseup&&this._document.addEventListener("mouseup",s.mouseup),s.mousedrag&&this._document.addEventListener("mousemove",s.mousedrag),this.cancel(n)})),this._register(K(t,"wheel",n=>{if(!s.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(n)===!1)return!1;if(!this.buffer.hasScrollback){if(n.deltaY===0)return!1;if(e.coreMouseService.consumeWheelEvent(n,e._renderService?.dimensions?.device?.cell?.height,e._coreBrowserService?.dpr)===0)return this.cancel(n,!0);let o=E.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(n.deltaY<0?"A":"B");return this.coreService.triggerDataEvent(o,!0),this.cancel(n,!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){mo(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 new 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 new 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,i){this._selectionService.setSelection(e,t,i)}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 i=Ud(e,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(e),i.type===3||i.type===2){let s=this.rows-1;return this.scrollLines(i.type===2?-s:s),this.cancel(e,!0)}if(i.type===1&&this.selectAll(),this._isThirdLevelShift(this.browser,e)||(i.cancel&&this.cancel(e,!0),!i.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((i.key===E.ETX||i.key===E.CR)&&(this.textarea.value=""),this._onKey.fire({key:i.key,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(i.key,!0),!this.optionsService.rawOptions.screenReaderMode||e.altKey||e.ctrlKey)return this.cancel(e,!0);this._keyDownHandled=!0}_isThirdLevelShift(e,t){let i=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"?i:i&&(!t.keyCode||t.keyCode>47)}_keyUp(e){this._keyDownSeen=!1,!(this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)&&(Qd(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(de));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(E.ESC+"[I"):this.coreService.triggerDataEvent(E.ESC+"[O")}_reportWindowsOptions(e){if(this._renderService)switch(e){case 0:let t=this._renderService.dimensions.css.canvas.width.toFixed(0),i=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${E.ESC}[4;${i};${t}t`);break;case 1:let s=this._renderService.dimensions.css.cell.width.toFixed(0),r=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${E.ESC}[6;${r};${s}t`);break}}cancel(e,t){if(!(!this.options.cancelEvents&&!t))return e.preventDefault(),e.stopPropagation(),!1}};function Qd(e){return e.keyCode===16||e.keyCode===17||e.keyCode===18}var ef=class{constructor(){this._addons=[]}dispose(){for(let e=this._addons.length-1;e>=0;e--)this._addons[e].instance.dispose()}loadAddon(e,t){let i={instance:t,dispose:t.dispose,isDisposed:!1};this._addons.push(i),t.dispose=()=>this._wrappedAddonDispose(i),t.activate(e)}_wrappedAddonDispose(e){if(e.isDisposed)return;let t=-1;for(let i=0;i<this._addons.length;i++)if(this._addons[i]===e){t=i;break}if(t===-1)throw new Error("Could not dispose an addon that has not been loaded");e.isDisposed=!0,e.dispose.apply(e.instance),this._addons.splice(t,1)}},tf=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 Ve)}translateToString(e,t,i){return this._line.translateToString(e,t,i)}},Wn=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 tf(t)}getNullCell(){return new Ve}},sf=class extends Q{constructor(e){super(),this._core=e,this._onBufferChange=this._register(new T),this.onBufferChange=this._onBufferChange.event,this._normal=new Wn(this._core.buffers.normal,"normal"),this._alternate=new Wn(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 new 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)}},rf=class{constructor(e){this._core=e}registerCsiHandler(e,t){return this._core.registerCsiHandler(e,i=>t(i.toArray()))}addCsiHandler(e,t){return this.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._core.registerDcsHandler(e,(i,s)=>t(i,s.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)}},nf=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}},of=["cols","rows"],Xe=0,af=class extends Q{constructor(e){super(),this._core=this._register(new Zd(e)),this._addonManager=this._register(new ef),this._publicOptions={...this._core.options};let t=s=>this._core.options[s],i=(s,r)=>{this._checkReadonlyOptions(s),this._core.options[s]=r};for(let s in this._core.options){let r={get:t.bind(this,s),set:i.bind(this,s)};Object.defineProperty(this._publicOptions,s,r)}}_checkReadonlyOptions(e){if(of.includes(e))throw new Error(`Option "${e}" can only be set in the constructor`)}_checkProposedApi(){if(!this._core.optionsService.rawOptions.allowProposedApi)throw new 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||(this._parser=new rf(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new nf(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._buffer=this._register(new sf(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";break}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,i){this._verifyIntegers(e,t,i),this._core.select(e,t,i)}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
|
|
16
|
-
`,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 Ns.get()},set promptLabel(e){Ns.set(e)},get tooMuchOutput(){return zs.get()},set tooMuchOutput(e){zs.set(e)}}}_verifyIntegers(...e){for(Xe of e)if(Xe===1/0||isNaN(Xe)||Xe%1!==0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...e){for(Xe of e)if(Xe&&(Xe===1/0||isNaN(Xe)||Xe%1!==0||Xe<0))throw new Error("This API only accepts positive integers")}};var lf=2,hf=1,cf=class{activate(e){this._terminal=e}dispose(){}fit(){let e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;let t=this._terminal._core;(this._terminal.rows!==e.rows||this._terminal.cols!==e.cols)&&(t._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let e=this._terminal._core._renderService.dimensions;if(e.css.cell.width===0||e.css.cell.height===0)return;let t=this._terminal.options.scrollback===0?0:this._terminal.options.overviewRuler?.width||14,i=window.getComputedStyle(this._terminal.element.parentElement),s=parseInt(i.getPropertyValue("height")),r=Math.max(0,parseInt(i.getPropertyValue("width"))),n=window.getComputedStyle(this._terminal.element),o={top:parseInt(n.getPropertyValue("padding-top")),bottom:parseInt(n.getPropertyValue("padding-bottom")),right:parseInt(n.getPropertyValue("padding-right")),left:parseInt(n.getPropertyValue("padding-left"))},a=o.top+o.bottom,h=o.right+o.left,l=s-a,f=r-h-t;return{cols:Math.max(lf,Math.floor(f/e.css.cell.width)),rows:Math.max(hf,Math.floor(l/e.css.cell.height))}}};var uf=class{constructor(e,t,i,s={}){this._terminal=e,this._regex=t,this._handler=i,this._options=s}provideLinks(e,t){let i=ff.computeLink(e,this._regex,this._terminal,this._handler);t(this._addCallbacks(i))}_addCallbacks(e){return e.map(t=>(t.leave=this._options.leave,t.hover=(i,s)=>{if(this._options.hover){let{range:r}=t;this._options.hover(i,s,r)}},t))}};function df(e){try{let t=new URL(e),i=t.password&&t.username?`${t.protocol}//${t.username}:${t.password}@${t.host}`:t.username?`${t.protocol}//${t.username}@${t.host}`:`${t.protocol}//${t.host}`;return e.toLocaleLowerCase().startsWith(i.toLocaleLowerCase())}catch{return!1}}var ff=class $i{static computeLink(t,i,s,r){let n=new RegExp(i.source,(i.flags||"")+"g"),[o,a]=$i._getWindowedLineStrings(t-1,s),h=o.join(""),l,f=[];for(;l=n.exec(h);){let d=l[0];if(!df(d))continue;let[u,c]=$i._mapStrIdx(s,a,0,l.index),[p,_]=$i._mapStrIdx(s,u,c,d.length);if(u===-1||c===-1||p===-1||_===-1)continue;let S={start:{x:c+1,y:u+1},end:{x:_,y:p+1}};f.push({range:S,text:d,activate:r})}return f}static _getWindowedLineStrings(t,i){let s,r=t,n=t,o=0,a="",h=[];if(s=i.buffer.active.getLine(t)){let l=s.translateToString(!0);if(s.isWrapped&&l[0]!==" "){for(o=0;(s=i.buffer.active.getLine(--r))&&o<2048&&(a=s.translateToString(!0),o+=a.length,h.push(a),!(!s.isWrapped||a.indexOf(" ")!==-1)););h.reverse()}for(h.push(l),o=0;(s=i.buffer.active.getLine(++n))&&s.isWrapped&&o<2048&&(a=s.translateToString(!0),o+=a.length,h.push(a),a.indexOf(" ")===-1););}return[h,r]}static _mapStrIdx(t,i,s,r){let n=t.buffer.active,o=n.getNullCell(),a=s;for(;r;){let h=n.getLine(i);if(!h)return[-1,-1];for(let l=a;l<h.length;++l){h.getCell(l,o);let f=o.getChars();if(o.getWidth()&&(r-=f.length||1,l===h.length-1&&f==="")){let d=n.getLine(i+1);d&&d.isWrapped&&(d.getCell(0,o),o.getWidth()===2&&(r+=1))}if(r<0)return[i,l]}i++,a=0}return[i,a]}},_f=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function pf(e,t){let i=window.open();if(i){try{i.opener=null}catch{}i.location.href=t}else console.warn("Opening link blocked as opener could not be cleared")}var gf=class{constructor(e=pf,t={}){this._handler=e,this._options=t}activate(e){this._terminal=e;let t=this._options,i=t.urlRegex||_f;this._linkProvider=this._terminal.registerLinkProvider(new uf(this._terminal,i,this._handler,t))}dispose(){this._linkProvider?.dispose()}};function vf(){const e=X("disconnected"),t=X(null),i=X(null),s=X(0),r=5,n=2e3;function o(){return`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/terminal`}function a(_){t.value=_,e.value="connecting";const S=new WebSocket(o());i.value=S,S.onopen=()=>{e.value="connected",s.value=0,f(_.cols,_.rows)},S.onmessage=w=>{try{const y=JSON.parse(w.data);y.type==="output"&&y.data?_.write(y.data):y.type==="error"&&y.data&&(e.value="error",_.write(`\x1B[31m${y.data}\x1B[0m`))}catch{_.write(w.data)}},S.onclose=()=>{e.value="disconnected",s.value<r&&(s.value++,setTimeout(()=>{t.value&&a(t.value)},n))},S.onerror=()=>{e.value="error"}}function h(){i.value&&(i.value.close(),i.value=null),e.value="disconnected"}function l(_){i.value?.readyState===WebSocket.OPEN&&i.value.send(JSON.stringify({type:"input",data:_}))}function f(_,S){i.value?.readyState===WebSocket.OPEN&&i.value.send(JSON.stringify({type:"resize",cols:_,rows:S}))}function d(){i.value?.readyState===WebSocket.OPEN&&i.value.send(JSON.stringify({type:"ping"}))}let u=null;function c(){u&&clearInterval(u),u=ul(d,3e4)}function p(){u&&(clearInterval(u),u=null)}return Jn(()=>{p(),h()}),{status:e,connect:a,disconnect:h,sendInput:l,sendResize:f,startPingInterval:c,stopPingInterval:p}}const mf={class:"flex flex-col flex-1 min-h-0"},Sf={class:"flex items-center justify-between px-3 py-1.5 border-b border-default text-sm bg-muted/50"},bf={class:"flex items-center gap-2 text-muted text-xs"},yf=Le({__name:"AssistantTerminal.client",props:{active:{type:Boolean}},setup(e,{expose:t}){const i=e,s=X(null),r=X(null),n=X(null),o=X(!1),{status:a,connect:h,disconnect:l,sendInput:f,sendResize:d,startPingInterval:u,stopPingInterval:c}=vf(),p=Z(()=>{switch(a.value){case"connected":return"i-lucide-wifi";case"connecting":return"i-lucide-loader-2";default:return"i-lucide-wifi-off"}});function _(C){return[C==="connecting"&&"animate-spin",C==="connected"&&"text-success",(C==="error"||C==="disconnected")&&"text-muted"]}function S(){if(!s.value||o.value)return;const C=new af({cursorBlink:!0,fontSize:14,fontFamily:"ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace",theme:{background:"#1a1a1a",foreground:"#e5e5e5",cursor:"#e5e5e5",cursorAccent:"#1a1a1a",selectionBackground:"#3b3b3b",black:"#1a1a1a",red:"#ff5555",green:"#50fa7b",yellow:"#f1fa8c",blue:"#6272a4",magenta:"#ff79c6",cyan:"#8be9fd",white:"#e5e5e5",brightBlack:"#4d4d4d",brightRed:"#ff6e6e",brightGreen:"#69ff94",brightYellow:"#ffffa5",brightBlue:"#d6acff",brightMagenta:"#ff92df",brightCyan:"#a4ffff",brightWhite:"#ffffff"}}),L=new cf;n.value=L,C.loadAddon(L),C.loadAddon(new gf),C.open(s.value),L.fit(),r.value=C,o.value=!0,C.onData(x=>{f(x)}),C.onResize(({cols:x,rows:$})=>{d(x,$)}),h(C),u()}function w(){n.value&&r.value&&n.value.fit()}function y(){if(a.value!=="connecting"){if(!o.value){Ut(S);return}r.value&&h(r.value)}}let k=null;function g(){o.value?(w(),r.value?.focus()):(S(),s.value&&(k=new ResizeObserver(()=>w()),k.observe(s.value)))}return ke(()=>i.active,C=>{C&&Ut(g)},{immediate:!0}),Jn(()=>{c(),l(),k&&k.disconnect(),r.value&&r.value.dispose()}),t({status:a}),(C,L)=>{const x=me,$=xt;return B(),U("div",mf,[te("div",Sf,[te("div",bf,[P(x,{name:v(p),class:F(["size-3.5",..._(v(a))])},null,8,["name","class"]),te("span",null,Be(v(a)==="connected"?"Connected":v(a)==="connecting"?"Connecting...":v(a)==="error"?"Connection error":"Disconnected"),1)]),v(a)==="disconnected"||v(a)==="error"?(B(),z($,{key:0,size:"xs",color:"neutral",variant:"ghost",icon:"i-lucide-refresh-cw",onClick:y},{default:A(()=>[...L[0]||(L[0]=[tt(" Reconnect ",-1)])]),_:1})):W("",!0)]),te("div",{ref_key:"terminalRef",ref:s,class:"flex-1 p-1 bg-[#1a1a1a]"},null,512)])}}}),wf=Object.assign(yf,{__name:"AssistantTerminal"}),Cf=eo(wf),kf={key:0,class:"fixed bottom-4 right-4 z-50"},xf={class:"assistant-panel absolute bottom-14 right-0 flex flex-col bg-default border-2 rounded-lg overflow-hidden shadow-lg border-default resize"},Ef={class:"flex items-center justify-between border-b border-default bg-muted/50"},Bf={class:"flex items-center gap-1 px-2"},Lf=Le({__name:"AssistantPanel.client",setup(e){const t=Gn(),i=Z(()=>t.path==="/chat"),{assistantPanelOpen:s,assistantPanelTab:r}=ss(),n=X(s.value);ke(n,p=>{s.value=p});const o=X(r.value);ke(o,p=>{r.value=p});const a=[{label:"Chat",icon:"i-lucide-message-square",value:"chat"},{label:"Terminal",icon:"i-lucide-terminal",value:"terminal"}],h=X(null),{connectionStatus:l}=so(),f=Z(()=>h.value?.status??"disconnected"),d=Z(()=>{switch(l.value){case"connected":return"i-lucide-wifi";case"connecting":return"i-lucide-loader-2";default:return"i-lucide-wifi-off"}}),u=Z(()=>{switch(f.value){case"connected":return"i-lucide-wifi";case"connecting":return"i-lucide-loader-2";default:return"i-lucide-wifi-off"}});function c(p){return[p==="connecting"&&"animate-spin",p==="connected"&&"text-success",(p==="error"||p==="disconnected")&&"text-muted"]}return(p,_)=>{const S=xt,w=al,y=me,k=Jh,g=Cf;return v(i)?W("",!0):(B(),U("div",kf,[P(S,{icon:v(n)?"i-lucide-x":"i-lucide-message-square",size:"lg",color:"primary",class:"rounded-full!",onClick:_[0]||(_[0]=C=>n.value=!v(n))},null,8,["icon"]),P(La,{"enter-active-class":"transition-all duration-200 ease-out","enter-from-class":"opacity-0 translate-y-2 scale-95","enter-to-class":"opacity-100 translate-y-0 scale-100","leave-active-class":"transition-all duration-150 ease-in","leave-from-class":"opacity-100 translate-y-0 scale-100","leave-to-class":"opacity-0 translate-y-2 scale-95"},{default:A(()=>[us(te("div",xf,[te("div",Ef,[P(w,{modelValue:v(o),"onUpdate:modelValue":_[1]||(_[1]=C=>vi(o)?o.value=C:null),items:a,variant:"link",size:"sm",content:!1,class:"flex-1"},null,8,["modelValue"]),te("div",Bf,[P(y,{name:v(o)==="chat"?v(d):v(u),class:F(["size-3.5",...c(v(o)==="chat"?v(l):v(f))])},null,8,["name","class"]),P(S,{size:"xs",color:"neutral",variant:"ghost",icon:"i-lucide-x",onClick:_[2]||(_[2]=C=>n.value=!1)})])]),us(P(k,{active:v(n)&&v(o)==="chat"},null,8,["active"]),[[ds,v(o)==="chat"]]),us(P(g,{ref_key:"terminalRef",ref:h,active:v(n)&&v(o)==="terminal"},null,8,["active"]),[[ds,v(o)==="terminal"]])],512),[[ds,v(n)]])]),_:1})]))}}}),Df=Object.assign(Lf,{__name:"AssistantPanel"}),Mf={class:"p-8 text-center"},Rf={class:"mx-auto mb-6 flex size-16 items-center justify-center rounded-full bg-primary/10"},Af={class:"text-2xl font-bold text-default"},Tf={class:"mt-4 text-sm leading-relaxed text-muted"},If={class:"mt-8 flex flex-col gap-3 sm:flex-row sm:justify-center"},Pf=Le({__name:"WelcomeModal",setup(e){const{onboardingDismissed:t}=ss(),{public:{agentName:i,agentTone:s}}=Da(),r=X(!1),n=X(!0),o={formal:{greeting:`Good day. I am ${i}.`,body:"It is a pleasure to make your acquaintance. I am your personal knowledge management assistant, here to help you organize documents, track tasks, and retain important information across sessions. To serve you most effectively, I would like to learn a bit about you — your work, your projects, and how you prefer to operate. Shall we have a brief introductory conversation?",cta:"Begin Introduction"},casual:{greeting:`Hey there! I'm ${i}!`,body:"Super excited to meet you! I'm your personal assistant — I'll help you keep your notes organized, track your tasks, and remember the important stuff so you never have to repeat yourself. But first, let's have a quick chat so I can get to know you a little. What you do, what kind of projects you work on, that sort of thing. It'll only take a minute!",cta:"Let's Chat!"},concise:{greeting:`Hi, I'm ${i}.`,body:"I'm your knowledge management assistant. I handle documents, tasks, and memory across sessions. A quick intro chat will help me understand your work and preferences so I can be more useful from the start.",cta:"Start Chat"}},a=Z(()=>o[s]??o.casual);es(async()=>{if(t.value){n.value=!1;return}try{(await $fetch("/api/memory/search",{query:{limit:"1"}})).data?.length||(r.value=!0)}catch{}finally{n.value=!1}});function h(){t.value=!0,r.value=!1,Ma("/chat?onboarding=true")}function l(){t.value=!0,r.value=!1}return(f,d)=>{const u=me,c=xt,p=kr;return B(),z(p,{open:v(r),"onUpdate:open":d[0]||(d[0]=_=>vi(r)?r.value=_:null),class:"sm:max-w-lg"},{content:A(()=>[te("div",Mf,[te("div",Rf,[P(u,{name:"i-lucide-sparkles",class:"size-8 text-primary"})]),te("h2",Af,Be(v(a).greeting),1),te("p",Tf,Be(v(a).body),1),te("div",If,[P(c,{size:"lg",icon:"i-lucide-message-square",onClick:h},{default:A(()=>[tt(Be(v(a).cta),1)]),_:1}),P(c,{size:"lg",color:"neutral",variant:"ghost",onClick:l},{default:A(()=>[...d[1]||(d[1]=[tt(" Maybe Later ",-1)])]),_:1})])])]),_:1},8,["open"])}}}),Of=Object.assign(Pf,{__name:"WelcomeModal"}),Nf={base:"fixed inset-0 flex overflow-hidden"},zf={__name:"UDashboardGroup",props:{as:{type:null,required:!1},class:{type:null,required:!1},storage:{type:String,required:!1,default:"cookie"},storageKey:{type:String,required:!1,default:"dashboard"},persistent:{type:Boolean,required:!1,default:!0},unit:{type:String,required:!1,default:"%"}},setup(e){const t=e,i=jn(),s=Nt(),r=Z(()=>Oe({extend:Oe(Nf),...s.ui?.dashboardGroup||{}})),n=X(!1),o=X(!1);return Oa({storage:t.storage,storageKey:t.storageKey,persistent:t.persistent,unit:t.unit,sidebarOpen:n,toggleSidebar:()=>{i.hooks.callHook("dashboard:sidebar:toggle")},sidebarCollapsed:o,collapseSidebar:a=>{i.hooks.callHook("dashboard:sidebar:collapse",a)},toggleSearch:()=>{i.hooks.callHook("dashboard:search:toggle")}}),(a,h)=>(B(),z(v(st),{as:e.as,class:F(r.value({class:t.class}))},{default:A(()=>[j(a.$slots,"default")]),_:3},8,["as","class"]))}},Ff=eo(Df),Hf={class:"flex items-center gap-2 px-2 py-1.5"},$f={key:0,class:"font-semibold text-lg"},Wf={key:0,class:"text-sm truncate"},W_=Le({__name:"dashboard",setup(e){const{user:t,logout:i}=dl(),{sidebarOpen:s}=ss(),r=X(s.value);ke(r,a=>s.value=a);const{connect:n}=fl();es(()=>{n()});const o=[[{label:"Dashboard",icon:"i-lucide-home",to:"/dashboard",onSelect:()=>{r.value=!1}},{label:"Docs",icon:"i-lucide-file-text",to:"/docs",onSelect:()=>{r.value=!1}},{label:"Tasks",icon:"i-lucide-check-square",to:"/tasks",onSelect:()=>{r.value=!1}},{label:"Agents",icon:"i-lucide-bot",to:"/agents",onSelect:()=>{r.value=!1}},{label:"Hooks",icon:"i-lucide-webhook",to:"/hooks",onSelect:()=>{r.value=!1}},{label:"Skills",icon:"i-lucide-puzzle",to:"/skills",onSelect:()=>{r.value=!1}},{label:"Memories",icon:"i-lucide-brain",to:"/memories",onSelect:()=>{r.value=!1}},{label:"Usage",icon:"i-lucide-bar-chart-3",to:"/usage",onSelect:()=>{r.value=!1}},{label:"Chat",icon:"i-lucide-message-square",to:"/chat",onSelect:()=>{r.value=!1}},{label:"Settings",icon:"i-lucide-settings",to:"/settings/account",onSelect:()=>{r.value=!1}}]];return(a,h)=>{const l=me,f=Fl,d=Cr,u=xt,c=za,p=ql,_=wr,S=Ua,w=Va,y=Vl,k=Uh,g=Ff,C=Of,L=zf;return B(),z(L,{unit:"rem"},{default:A(()=>[P(y,{id:"main",open:v(r),"onUpdate:open":h[0]||(h[0]=x=>vi(r)?r.value=x:null),collapsible:"",resizable:"",class:"bg-elevated/25",ui:{footer:"lg:border-t lg:border-default"}},{header:A(({collapsed:x})=>[te("div",Hf,[P(l,{name:"i-lucide-brain",class:"size-6 text-primary shrink-0"}),x?W("",!0):(B(),U("span",$f,"Cognova"))])]),default:A(({collapsed:x})=>[P(c,null,{fallback:A(()=>[P(u,{label:x?void 0:"Search...",icon:"i-lucide-search",color:"neutral",variant:"ghost",class:"w-full justify-start",ui:{trailingIcon:"ms-auto"}},is({_:2},[x?void 0:{name:"trailing",fn:A(()=>[P(d,null,{default:A(()=>[...h[1]||(h[1]=[tt("⌘K",-1)])]),_:1})]),key:"0"}]),1032,["label"])]),default:A(()=>[P(f,{collapsed:x},null,8,["collapsed"])]),_:2},1024),P(p,{collapsed:x,items:o[0],orientation:"vertical",tooltip:"",popover:""},null,8,["collapsed","items"])]),footer:A(({collapsed:x})=>[P(c,null,{fallback:A(()=>[P(u,{variant:"ghost",class:"w-full justify-start",ui:{leadingIcon:"size-5"}},{default:A(()=>[P(w,{class:"size-5 rounded-full"}),x?W("",!0):(B(),z(w,{key:0,class:"h-4 w-20"}))]),_:2},1024)]),default:A(()=>[P(S,{items:[[{label:"Sign out",icon:"i-lucide-log-out",onSelect:v(i)}]]},{default:A(()=>[P(u,{variant:"ghost",class:"w-full justify-start",ui:{leadingIcon:"size-5"}},{default:A(()=>[P(_,{alt:v(t)?.name||"User",size:"2xs"},null,8,["alt"]),x?W("",!0):(B(),U("span",Wf,Be(v(t)?.name||v(t)?.email||"User"),1))]),_:2},1024)]),_:2},1032,["items"])]),_:2},1024)]),_:1},8,["open"]),P(c,null,{fallback:A(()=>[...h[2]||(h[2]=[te("span",null,null,-1)])]),default:A(()=>[P(k)]),_:1}),j(a.$slots,"default"),P(c,null,{fallback:A(()=>[...h[3]||(h[3]=[te("span",null,null,-1)])]),default:A(()=>[P(g)]),_:1}),P(c,null,{default:A(()=>[P(C)]),_:1})]),_:3})}}});export{W_ as default};
|
|
16
|
+
`,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 Ns.get()},set promptLabel(e){Ns.set(e)},get tooMuchOutput(){return zs.get()},set tooMuchOutput(e){zs.set(e)}}}_verifyIntegers(...e){for(Xe of e)if(Xe===1/0||isNaN(Xe)||Xe%1!==0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...e){for(Xe of e)if(Xe&&(Xe===1/0||isNaN(Xe)||Xe%1!==0||Xe<0))throw new Error("This API only accepts positive integers")}};var lf=2,hf=1,cf=class{activate(e){this._terminal=e}dispose(){}fit(){let e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;let t=this._terminal._core;(this._terminal.rows!==e.rows||this._terminal.cols!==e.cols)&&(t._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let e=this._terminal._core._renderService.dimensions;if(e.css.cell.width===0||e.css.cell.height===0)return;let t=this._terminal.options.scrollback===0?0:this._terminal.options.overviewRuler?.width||14,i=window.getComputedStyle(this._terminal.element.parentElement),s=parseInt(i.getPropertyValue("height")),r=Math.max(0,parseInt(i.getPropertyValue("width"))),n=window.getComputedStyle(this._terminal.element),o={top:parseInt(n.getPropertyValue("padding-top")),bottom:parseInt(n.getPropertyValue("padding-bottom")),right:parseInt(n.getPropertyValue("padding-right")),left:parseInt(n.getPropertyValue("padding-left"))},a=o.top+o.bottom,h=o.right+o.left,l=s-a,f=r-h-t;return{cols:Math.max(lf,Math.floor(f/e.css.cell.width)),rows:Math.max(hf,Math.floor(l/e.css.cell.height))}}};var uf=class{constructor(e,t,i,s={}){this._terminal=e,this._regex=t,this._handler=i,this._options=s}provideLinks(e,t){let i=ff.computeLink(e,this._regex,this._terminal,this._handler);t(this._addCallbacks(i))}_addCallbacks(e){return e.map(t=>(t.leave=this._options.leave,t.hover=(i,s)=>{if(this._options.hover){let{range:r}=t;this._options.hover(i,s,r)}},t))}};function df(e){try{let t=new URL(e),i=t.password&&t.username?`${t.protocol}//${t.username}:${t.password}@${t.host}`:t.username?`${t.protocol}//${t.username}@${t.host}`:`${t.protocol}//${t.host}`;return e.toLocaleLowerCase().startsWith(i.toLocaleLowerCase())}catch{return!1}}var ff=class $i{static computeLink(t,i,s,r){let n=new RegExp(i.source,(i.flags||"")+"g"),[o,a]=$i._getWindowedLineStrings(t-1,s),h=o.join(""),l,f=[];for(;l=n.exec(h);){let d=l[0];if(!df(d))continue;let[u,c]=$i._mapStrIdx(s,a,0,l.index),[p,_]=$i._mapStrIdx(s,u,c,d.length);if(u===-1||c===-1||p===-1||_===-1)continue;let S={start:{x:c+1,y:u+1},end:{x:_,y:p+1}};f.push({range:S,text:d,activate:r})}return f}static _getWindowedLineStrings(t,i){let s,r=t,n=t,o=0,a="",h=[];if(s=i.buffer.active.getLine(t)){let l=s.translateToString(!0);if(s.isWrapped&&l[0]!==" "){for(o=0;(s=i.buffer.active.getLine(--r))&&o<2048&&(a=s.translateToString(!0),o+=a.length,h.push(a),!(!s.isWrapped||a.indexOf(" ")!==-1)););h.reverse()}for(h.push(l),o=0;(s=i.buffer.active.getLine(++n))&&s.isWrapped&&o<2048&&(a=s.translateToString(!0),o+=a.length,h.push(a),a.indexOf(" ")===-1););}return[h,r]}static _mapStrIdx(t,i,s,r){let n=t.buffer.active,o=n.getNullCell(),a=s;for(;r;){let h=n.getLine(i);if(!h)return[-1,-1];for(let l=a;l<h.length;++l){h.getCell(l,o);let f=o.getChars();if(o.getWidth()&&(r-=f.length||1,l===h.length-1&&f==="")){let d=n.getLine(i+1);d&&d.isWrapped&&(d.getCell(0,o),o.getWidth()===2&&(r+=1))}if(r<0)return[i,l]}i++,a=0}return[i,a]}},_f=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function pf(e,t){let i=window.open();if(i){try{i.opener=null}catch{}i.location.href=t}else console.warn("Opening link blocked as opener could not be cleared")}var gf=class{constructor(e=pf,t={}){this._handler=e,this._options=t}activate(e){this._terminal=e;let t=this._options,i=t.urlRegex||_f;this._linkProvider=this._terminal.registerLinkProvider(new uf(this._terminal,i,this._handler,t))}dispose(){this._linkProvider?.dispose()}};function vf(){const e=X("disconnected"),t=X(null),i=X(null),s=X(0),r=5,n=2e3;function o(){return`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/_ws/terminal`}function a(_){t.value=_,e.value="connecting";const S=new WebSocket(o());i.value=S,S.onopen=()=>{e.value="connected",s.value=0,f(_.cols,_.rows)},S.onmessage=w=>{try{const y=JSON.parse(w.data);y.type==="output"&&y.data?_.write(y.data):y.type==="error"&&y.data&&(e.value="error",_.write(`\x1B[31m${y.data}\x1B[0m`))}catch{_.write(w.data)}},S.onclose=()=>{e.value="disconnected",s.value<r&&(s.value++,setTimeout(()=>{t.value&&a(t.value)},n))},S.onerror=()=>{e.value="error"}}function h(){i.value&&(i.value.close(),i.value=null),e.value="disconnected"}function l(_){i.value?.readyState===WebSocket.OPEN&&i.value.send(JSON.stringify({type:"input",data:_}))}function f(_,S){i.value?.readyState===WebSocket.OPEN&&i.value.send(JSON.stringify({type:"resize",cols:_,rows:S}))}function d(){i.value?.readyState===WebSocket.OPEN&&i.value.send(JSON.stringify({type:"ping"}))}let u=null;function c(){u&&clearInterval(u),u=ul(d,3e4)}function p(){u&&(clearInterval(u),u=null)}return Jn(()=>{p(),h()}),{status:e,connect:a,disconnect:h,sendInput:l,sendResize:f,startPingInterval:c,stopPingInterval:p}}const mf={class:"flex flex-col flex-1 min-h-0"},Sf={class:"flex items-center justify-between px-3 py-1.5 border-b border-default text-sm bg-muted/50"},bf={class:"flex items-center gap-2 text-muted text-xs"},yf=Le({__name:"AssistantTerminal.client",props:{active:{type:Boolean}},setup(e,{expose:t}){const i=e,s=X(null),r=X(null),n=X(null),o=X(!1),{status:a,connect:h,disconnect:l,sendInput:f,sendResize:d,startPingInterval:u,stopPingInterval:c}=vf(),p=Z(()=>{switch(a.value){case"connected":return"i-lucide-wifi";case"connecting":return"i-lucide-loader-2";default:return"i-lucide-wifi-off"}});function _(C){return[C==="connecting"&&"animate-spin",C==="connected"&&"text-success",(C==="error"||C==="disconnected")&&"text-muted"]}function S(){if(!s.value||o.value)return;const C=new af({cursorBlink:!0,fontSize:14,fontFamily:"ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace",theme:{background:"#1a1a1a",foreground:"#e5e5e5",cursor:"#e5e5e5",cursorAccent:"#1a1a1a",selectionBackground:"#3b3b3b",black:"#1a1a1a",red:"#ff5555",green:"#50fa7b",yellow:"#f1fa8c",blue:"#6272a4",magenta:"#ff79c6",cyan:"#8be9fd",white:"#e5e5e5",brightBlack:"#4d4d4d",brightRed:"#ff6e6e",brightGreen:"#69ff94",brightYellow:"#ffffa5",brightBlue:"#d6acff",brightMagenta:"#ff92df",brightCyan:"#a4ffff",brightWhite:"#ffffff"}}),L=new cf;n.value=L,C.loadAddon(L),C.loadAddon(new gf),C.open(s.value),L.fit(),r.value=C,o.value=!0,C.onData(x=>{f(x)}),C.onResize(({cols:x,rows:$})=>{d(x,$)}),h(C),u()}function w(){n.value&&r.value&&n.value.fit()}function y(){if(a.value!=="connecting"){if(!o.value){Ut(S);return}r.value&&h(r.value)}}let k=null;function g(){o.value?(w(),r.value?.focus()):(S(),s.value&&(k=new ResizeObserver(()=>w()),k.observe(s.value)))}return ke(()=>i.active,C=>{C&&Ut(g)},{immediate:!0}),Jn(()=>{c(),l(),k&&k.disconnect(),r.value&&r.value.dispose()}),t({status:a}),(C,L)=>{const x=me,$=xt;return B(),U("div",mf,[te("div",Sf,[te("div",bf,[P(x,{name:v(p),class:F(["size-3.5",..._(v(a))])},null,8,["name","class"]),te("span",null,Be(v(a)==="connected"?"Connected":v(a)==="connecting"?"Connecting...":v(a)==="error"?"Connection error":"Disconnected"),1)]),v(a)==="disconnected"||v(a)==="error"?(B(),z($,{key:0,size:"xs",color:"neutral",variant:"ghost",icon:"i-lucide-refresh-cw",onClick:y},{default:A(()=>[...L[0]||(L[0]=[tt(" Reconnect ",-1)])]),_:1})):W("",!0)]),te("div",{ref_key:"terminalRef",ref:s,class:"flex-1 p-1 bg-[#1a1a1a]"},null,512)])}}}),wf=Object.assign(yf,{__name:"AssistantTerminal"}),Cf=eo(wf),kf={key:0,class:"fixed bottom-4 right-4 z-50"},xf={class:"assistant-panel absolute bottom-14 right-0 flex flex-col bg-default border-2 rounded-lg overflow-hidden shadow-lg border-default resize"},Ef={class:"flex items-center justify-between border-b border-default bg-muted/50"},Bf={class:"flex items-center gap-1 px-2"},Lf=Le({__name:"AssistantPanel.client",setup(e){const t=Gn(),i=Z(()=>t.path==="/chat"),{assistantPanelOpen:s,assistantPanelTab:r}=ss(),n=X(s.value);ke(n,p=>{s.value=p});const o=X(r.value);ke(o,p=>{r.value=p});const a=[{label:"Chat",icon:"i-lucide-message-square",value:"chat"},{label:"Terminal",icon:"i-lucide-terminal",value:"terminal"}],h=X(null),{connectionStatus:l}=so(),f=Z(()=>h.value?.status??"disconnected"),d=Z(()=>{switch(l.value){case"connected":return"i-lucide-wifi";case"connecting":return"i-lucide-loader-2";default:return"i-lucide-wifi-off"}}),u=Z(()=>{switch(f.value){case"connected":return"i-lucide-wifi";case"connecting":return"i-lucide-loader-2";default:return"i-lucide-wifi-off"}});function c(p){return[p==="connecting"&&"animate-spin",p==="connected"&&"text-success",(p==="error"||p==="disconnected")&&"text-muted"]}return(p,_)=>{const S=xt,w=al,y=me,k=Jh,g=Cf;return v(i)?W("",!0):(B(),U("div",kf,[P(S,{icon:v(n)?"i-lucide-x":"i-lucide-message-square",size:"lg",color:"primary",class:"rounded-full!",onClick:_[0]||(_[0]=C=>n.value=!v(n))},null,8,["icon"]),P(La,{"enter-active-class":"transition-all duration-200 ease-out","enter-from-class":"opacity-0 translate-y-2 scale-95","enter-to-class":"opacity-100 translate-y-0 scale-100","leave-active-class":"transition-all duration-150 ease-in","leave-from-class":"opacity-100 translate-y-0 scale-100","leave-to-class":"opacity-0 translate-y-2 scale-95"},{default:A(()=>[us(te("div",xf,[te("div",Ef,[P(w,{modelValue:v(o),"onUpdate:modelValue":_[1]||(_[1]=C=>vi(o)?o.value=C:null),items:a,variant:"link",size:"sm",content:!1,class:"flex-1"},null,8,["modelValue"]),te("div",Bf,[P(y,{name:v(o)==="chat"?v(d):v(u),class:F(["size-3.5",...c(v(o)==="chat"?v(l):v(f))])},null,8,["name","class"]),P(S,{size:"xs",color:"neutral",variant:"ghost",icon:"i-lucide-x",onClick:_[2]||(_[2]=C=>n.value=!1)})])]),us(P(k,{active:v(n)&&v(o)==="chat"},null,8,["active"]),[[ds,v(o)==="chat"]]),us(P(g,{ref_key:"terminalRef",ref:h,active:v(n)&&v(o)==="terminal"},null,8,["active"]),[[ds,v(o)==="terminal"]])],512),[[ds,v(n)]])]),_:1})]))}}}),Df=Object.assign(Lf,{__name:"AssistantPanel"}),Mf={class:"p-8 text-center"},Rf={class:"mx-auto mb-6 flex size-16 items-center justify-center rounded-full bg-primary/10"},Af={class:"text-2xl font-bold text-default"},Tf={class:"mt-4 text-sm leading-relaxed text-muted"},If={class:"mt-8 flex flex-col gap-3 sm:flex-row sm:justify-center"},Pf=Le({__name:"WelcomeModal",setup(e){const{onboardingDismissed:t}=ss(),{public:{agentName:i,agentTone:s}}=Da(),r=X(!1),n=X(!0),o={formal:{greeting:`Good day. I am ${i}.`,body:"It is a pleasure to make your acquaintance. I am your personal knowledge management assistant, here to help you organize documents, track tasks, and retain important information across sessions. To serve you most effectively, I would like to learn a bit about you — your work, your projects, and how you prefer to operate. Shall we have a brief introductory conversation?",cta:"Begin Introduction"},casual:{greeting:`Hey there! I'm ${i}!`,body:"Super excited to meet you! I'm your personal assistant — I'll help you keep your notes organized, track your tasks, and remember the important stuff so you never have to repeat yourself. But first, let's have a quick chat so I can get to know you a little. What you do, what kind of projects you work on, that sort of thing. It'll only take a minute!",cta:"Let's Chat!"},concise:{greeting:`Hi, I'm ${i}.`,body:"I'm your knowledge management assistant. I handle documents, tasks, and memory across sessions. A quick intro chat will help me understand your work and preferences so I can be more useful from the start.",cta:"Start Chat"}},a=Z(()=>o[s]??o.casual);es(async()=>{if(t.value){n.value=!1;return}try{(await $fetch("/api/memory/search",{query:{limit:"1"}})).data?.length||(r.value=!0)}catch{}finally{n.value=!1}});function h(){t.value=!0,r.value=!1,Ma("/chat?onboarding=true")}function l(){t.value=!0,r.value=!1}return(f,d)=>{const u=me,c=xt,p=kr;return B(),z(p,{open:v(r),"onUpdate:open":d[0]||(d[0]=_=>vi(r)?r.value=_:null),class:"sm:max-w-lg"},{content:A(()=>[te("div",Mf,[te("div",Rf,[P(u,{name:"i-lucide-sparkles",class:"size-8 text-primary"})]),te("h2",Af,Be(v(a).greeting),1),te("p",Tf,Be(v(a).body),1),te("div",If,[P(c,{size:"lg",icon:"i-lucide-message-square",onClick:h},{default:A(()=>[tt(Be(v(a).cta),1)]),_:1}),P(c,{size:"lg",color:"neutral",variant:"ghost",onClick:l},{default:A(()=>[...d[1]||(d[1]=[tt(" Maybe Later ",-1)])]),_:1})])])]),_:1},8,["open"])}}}),Of=Object.assign(Pf,{__name:"WelcomeModal"}),Nf={base:"fixed inset-0 flex overflow-hidden"},zf={__name:"UDashboardGroup",props:{as:{type:null,required:!1},class:{type:null,required:!1},storage:{type:String,required:!1,default:"cookie"},storageKey:{type:String,required:!1,default:"dashboard"},persistent:{type:Boolean,required:!1,default:!0},unit:{type:String,required:!1,default:"%"}},setup(e){const t=e,i=jn(),s=Nt(),r=Z(()=>Oe({extend:Oe(Nf),...s.ui?.dashboardGroup||{}})),n=X(!1),o=X(!1);return Oa({storage:t.storage,storageKey:t.storageKey,persistent:t.persistent,unit:t.unit,sidebarOpen:n,toggleSidebar:()=>{i.hooks.callHook("dashboard:sidebar:toggle")},sidebarCollapsed:o,collapseSidebar:a=>{i.hooks.callHook("dashboard:sidebar:collapse",a)},toggleSearch:()=>{i.hooks.callHook("dashboard:search:toggle")}}),(a,h)=>(B(),z(v(st),{as:e.as,class:F(r.value({class:t.class}))},{default:A(()=>[j(a.$slots,"default")]),_:3},8,["as","class"]))}},Ff=eo(Df),Hf={class:"flex items-center gap-2 px-2 py-1.5"},$f={key:0,class:"font-semibold text-lg"},Wf={key:0,class:"text-sm truncate"},W_=Le({__name:"dashboard",setup(e){const{user:t,logout:i}=dl(),{sidebarOpen:s}=ss(),r=X(s.value);ke(r,a=>s.value=a);const{connect:n}=fl();es(()=>{n()});const o=[[{label:"Dashboard",icon:"i-lucide-home",to:"/dashboard",onSelect:()=>{r.value=!1}},{label:"Docs",icon:"i-lucide-file-text",to:"/docs",onSelect:()=>{r.value=!1}},{label:"Tasks",icon:"i-lucide-check-square",to:"/tasks",onSelect:()=>{r.value=!1}},{label:"Agents",icon:"i-lucide-bot",to:"/agents",onSelect:()=>{r.value=!1}},{label:"Hooks",icon:"i-lucide-webhook",to:"/hooks",onSelect:()=>{r.value=!1}},{label:"Skills",icon:"i-lucide-puzzle",to:"/skills",onSelect:()=>{r.value=!1}},{label:"Memories",icon:"i-lucide-brain",to:"/memories",onSelect:()=>{r.value=!1}},{label:"Usage",icon:"i-lucide-bar-chart-3",to:"/usage",onSelect:()=>{r.value=!1}},{label:"Chat",icon:"i-lucide-message-square",to:"/chat",onSelect:()=>{r.value=!1}},{label:"Settings",icon:"i-lucide-settings",to:"/settings/account",onSelect:()=>{r.value=!1}}]];return(a,h)=>{const l=me,f=Fl,d=Cr,u=xt,c=za,p=ql,_=wr,S=Ua,w=Va,y=Vl,k=Uh,g=Ff,C=Of,L=zf;return B(),z(L,{unit:"rem"},{default:A(()=>[P(y,{id:"main",open:v(r),"onUpdate:open":h[0]||(h[0]=x=>vi(r)?r.value=x:null),collapsible:"",resizable:"",class:"bg-elevated/25",ui:{footer:"lg:border-t lg:border-default"}},{header:A(({collapsed:x})=>[te("div",Hf,[P(l,{name:"i-lucide-brain",class:"size-6 text-primary shrink-0"}),x?W("",!0):(B(),U("span",$f,"Cognova"))])]),default:A(({collapsed:x})=>[P(c,null,{fallback:A(()=>[P(u,{label:x?void 0:"Search...",icon:"i-lucide-search",color:"neutral",variant:"ghost",class:"w-full justify-start",ui:{trailingIcon:"ms-auto"}},is({_:2},[x?void 0:{name:"trailing",fn:A(()=>[P(d,null,{default:A(()=>[...h[1]||(h[1]=[tt("⌘K",-1)])]),_:1})]),key:"0"}]),1032,["label"])]),default:A(()=>[P(f,{collapsed:x},null,8,["collapsed"])]),_:2},1024),P(p,{collapsed:x,items:o[0],orientation:"vertical",tooltip:"",popover:""},null,8,["collapsed","items"])]),footer:A(({collapsed:x})=>[P(c,null,{fallback:A(()=>[P(u,{variant:"ghost",class:"w-full justify-start",ui:{leadingIcon:"size-5"}},{default:A(()=>[P(w,{class:"size-5 rounded-full"}),x?W("",!0):(B(),z(w,{key:0,class:"h-4 w-20"}))]),_:2},1024)]),default:A(()=>[P(S,{items:[[{label:"Sign out",icon:"i-lucide-log-out",onSelect:v(i)}]]},{default:A(()=>[P(u,{variant:"ghost",class:"w-full justify-start",ui:{leadingIcon:"size-5"}},{default:A(()=>[P(_,{alt:v(t)?.name||"User",size:"2xs"},null,8,["alt"]),x?W("",!0):(B(),U("span",Wf,Be(v(t)?.name||v(t)?.email||"User"),1))]),_:2},1024)]),_:2},1032,["items"])]),_:2},1024)]),_:1},8,["open"]),P(c,null,{fallback:A(()=>[...h[2]||(h[2]=[te("span",null,null,-1)])]),default:A(()=>[P(k)]),_:1}),j(a.$slots,"default"),P(c,null,{fallback:A(()=>[...h[3]||(h[3]=[te("span",null,null,-1)])]),default:A(()=>[P(g)]),_:1}),P(c,null,{default:A(()=>[P(C)]),_:1})]),_:3})}}});export{W_ as default};
|