1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-C_rhOuGG.js","assets/index-C7buif2i.js","assets/react-Bfgl-5i7.js","assets/index.esm-BBxi_-Sg.js","assets/useIsMobile-BZ-WTCFO.js","assets/toast-CZdQYOa2.js","assets/api-config-l5W4JZ5M.js","assets/index-DTC1cKbY.js","assets/index-BrGxK1ck.css","assets/useProjectStore-ocMguG-3.js","assets/Input-B6mApQlA.js","assets/useProjectV5Store-BJ1DElDX.js","assets/client-DC1ryK_J.js","assets/middleware-wgFGoAoY.js","assets/sentry-9IRKGGJj.js","assets/search-1Rrpccgh.js","assets/file-code-2-CaVCwGgr.js","assets/x-CVWRX0zc.js","assets/tools-CYp8igg-.js","assets/loader-circle-COvTGh8M.js","assets/chevron-right-D6rOizYS.js","assets/index-Cze1hUpI.js","assets/tooltip-COL0rqCM.js","assets/fullApp-DfbVzAd2.js","assets/useThemeStore-BXwC_QYO.js","assets/external-link-DzqWqxkQ.js","assets/zap-DoOh_ecl.js","assets/chatLanding-Y6wnb5hb.js","assets/index-D_DQ7hEb.js","assets/PrivacyConsentBanner-DSgNK5Dr.js","assets/fullApp-oduubVS5.css","assets/download-DJyBDvQG.js","assets/minimize-2-D6Y3zTbk.js","assets/maximize-2-LmD3wMYl.js","assets/circle-alert-Bg9ve_ic.js","assets/file-BA73JsQv.js","assets/file-image-vRr-QdOI.js","assets/FileIcon-BXOldpba.js","assets/file-code-CL3l0YEu.js","assets/proxy-BaQ3_FzL.js","assets/index-21-aKxev.js","assets/chevron-down-eKbh8w0j.js","assets/thumbs-up-CJUTIfiU.js","assets/button-CeeqtHZk.js","assets/index-CWdhKkkk.js","assets/dialog-DVVROuTH.js","assets/RecordingBars-CHoEyAoV.js","assets/upload-By3jCEsB.js","assets/projectCreateIdentity-Y02tzB0t.js","assets/arrow-right-D62cTh8Z.js","assets/projectCreateIdentity-CbbVrPYh.css","assets/arrow-up-BzEBkYN4.js","assets/account-DzVNkJKg.js","assets/lock-CdJCJGzJ.js","assets/mic-Cv8YERD0.js","assets/hljs-Bj5aCnnH.js","assets/select-0Q-HdOCP.js","assets/chevron-up-wa8qoXSA.js","assets/pin-DnDYYkv7.js","assets/pin-off-Ck3RHJEn.js","assets/code-fl2eQ9j6.js","assets/emailVerification-Sphv24nd.js","assets/index-BNVGEjOv.css","assets/folder-xlVtsC7c.js","assets/ellipsis-BiRauj42.js","assets/label-CCu-dsp8.js","assets/switch-Bpj9FrKA.js","assets/tag-DaRWer7h.js","assets/calendar-mBKQkAyE.js","assets/Footer-JNCkiu7K.js","assets/send-BPNgQinz.js","assets/circle-check-big-BUiTb5a3.js","assets/twitter-C97vMu99.js","assets/mail-DcfjLkP9.js","assets/Footer-BTrndTpA.css","assets/index-BpeFm0S3.js","assets/index-CaeAxJdO.js","assets/index-4RqkrFEn.js","assets/index-lff58jhG.js","assets/index-DnedrNM9.js","assets/index-DiPymrBD.js","assets/index-BXGPTFyy.js","assets/index-DyX-1A8x.js","assets/index-D5lPchXl.js","assets/index-DkOIOMPD.js","assets/index-CFNNpu0b.js","assets/index-BNaFSLSj.js","assets/index-Bx4e_ssU.js","assets/index-CWpiksRe.js","assets/index-V8tQUMg7.js","assets/index-C9839O3b.js","assets/index-K_r3BB7G.js","assets/dockerfile-BAyhnR2b.js","assets/simple-mode-B7Lw_Dig.js","assets/factor-g9Vujknx.js","assets/nsis-BggecUF0.js","assets/pug-JOYBqibs.js","assets/javascript-CVsRgwMr.js","assets/index-BCuauU0J.js","assets/index-CpJCIf-M.js"])))=>i.map(i=>d[i]); 2import{j as h,r as E,R as Fs,e as yo,g as Sf}from"./react-Bfgl-5i7.js";import{a as _f}from"./index.esm-BBxi_-Sg.js";import{P as Pf,j as Af,k as Mf,O as Ef,Q as Df,U as Tf,V as Ad,W as Md,X as Ed,Y as Dd,Z as Td,_ as Nd,$ as Ld,a0 as Id,J as Nf,a1 as Od,a2 as Lf,a3 as Fd,a4 as Rd,a5 as Bd}from"./useIsMobile-BZ-WTCFO.js";import{c as ie,a as If,u as rs}from"./Input-B6mApQlA.js";import{s as ge,ad as Ya,ae as Of,af as zd,g as Ff,ag as ki,ah as Rf,ai as Bf,aj as zf,ak as Vf,e as Wf,c as lo,a2 as Er,i as Ea,l as Ca,h as Hf,t as $f,S as Uf,al as qf}from"./useProjectStore-ocMguG-3.js";import{l as He,F as Kf,c as po,Q as Vd,N as Wd,R as Gf,G as yc,a as Yf}from"./useProjectV5Store-BJ1DElDX.js";import{M as Sn,p as Hd,f as _n,m as $d,s as Xf,a as Jf}from"./index-Cze1hUpI.js";import{_ as G}from"./index-DTC1cKbY.js";import{s as Ci,u as Gt,c as Zf,a as Qf}from"./client-DC1ryK_J.js";import{T as ra,a as Ht,b as $t,c as Ut}from"./tooltip-COL0rqCM.js";import{c as em}from"./middleware-wgFGoAoY.js";import{I as Es,a as Ud,u as tm}from"./toast-CZdQYOa2.js";import{C as Pn}from"./fullApp-DfbVzAd2.js";import{D as Si}from"./download-DJyBDvQG.js";import{M as am}from"./minimize-2-D6Y3zTbk.js";import{M as sm}from"./maximize-2-LmD3wMYl.js";import{L as nr}from"./loader-circle-COvTGh8M.js";import{C as Rs}from"./circle-alert-Bg9ve_ic.js";import{E as ko}from"./external-link-DzqWqxkQ.js";import{F as _i}from"./file-BA73JsQv.js";import{F as qd}from"./file-image-vRr-QdOI.js";import{F as Da,S as om}from"./search-1Rrpccgh.js";import{c as Kd,b as Gd,a as rm,F as Yd,S as im}from"./FileIcon-BXOldpba.js";import{c as Fa,I as nm,a as cm}from"./api-config-l5W4JZ5M.js";import{F as An}from"./file-code-CL3l0YEu.js";import{m as Ze}from"./proxy-BaQ3_FzL.js";
2import{A as Pi}from"./index-21-aKxev.js";import{C as lm}from"./chevron-down-eKbh8w0j.js";import{T as dm,a as pm}from"./thumbs-up-CJUTIfiU.js";import{B as yt}from"./button-CeeqtHZk.js";import{MessageInput as kc}from"./index-CWdhKkkk.js";import{C as Bs}from"./chevron-right-D6rOizYS.js";import{F as Mn}from"./folder-xlVtsC7c.js";import{C as En,X as um}from"./x-CVWRX0zc.js";import{E as hm}from"./ellipsis-BiRauj42.js";import{D as Xd,a as Jd,b as Zd,c as Qd,d as ep,e as fm}from"./dialog-DVVROuTH.js";import{I as tp,L as Cc}from"./label-CCu-dsp8.js";import{B as mm,E as gm}from"./file-code-2-CaVCwGgr.js";import{u as uo}from"./useThemeStore-BXwC_QYO.js";import{L as ap}from"./lock-CdJCJGzJ.js";import{Z as xm}from"./zap-DoOh_ecl.js";import{H as Yr}from"./hljs-Bj5aCnnH.js";import{S as Xr}from"./switch-Bpj9FrKA.js";import{f as bm}from"./select-0Q-HdOCP.js";import{T as vm}from"./tag-DaRWer7h.js";import{C as jm}from"./calendar-mBKQkAyE.js";import{C as wm,a as ym,W as km}from"./tools-CYp8igg-.js";import{Footer as Cm}from"./Footer-JNCkiu7K.js";(function(){try{var a=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};a.SENTRY_RELEASE={id:"codepal-v2-ui@0bfa0029bf1a3b24368a1d4216a637efde99bcf0"};var e=new a.Error().stack;e&&(a._sentryDebugIds=a._sentryDebugIds||{},a._sentryDebugIds[e]="0ef4f6a2-115e-4b86-8cd5-bab8dd61ff0d",a._sentryDebugIdIdentifier="sentry-dbid-0ef4f6a2-115e-4b86-8cd5-bab8dd61ff0d")}catch{}})();/** 3 * @license lucide-react v0.462.0 - ISC 4 * 5 * This source code is licensed under the ISC license. 6 * See the LICENSE file in the root directory of this source tree. 7 */const Sm=Fa("Cog",[["path",{d:"M12 20a8 8 0 1 0 0-16 8 8 0 0 0 0 16Z",key:"sobvz5"}],["path",{d:"M12 14a2 2 0 1 0 0-4 2 2 0 0 0 0 4Z",key:"11i496"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 22v-2",key:"1osdcq"}],["path",{d:"m17 20.66-1-1.73",key:"eq3orb"}],["path",{d:"M11 10.27 7 3.34",key:"16pf9h"}],["path",{d:"m20.66 17-1.73-1",key:"sg0v6f"}],["path",{d:"m3.34 7 1.73 1",key:"1ulond"}],["path",{d:"M14 12h8",key:"4f43i9"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"m20.66 7-1.73 1",key:"1ow05n"}],["path",{d:"m3.34 17 1.73-1",key:"nuk764"}],["path",{d:"m17 3.34-1 1.73",key:"2wel8s"}],["path",{d:"m11 13.73-4 6.93",key:"794ttg"}]]);/** 8 * @license lucide-react v0.462.0 - ISC 9 * 10 * This source code is licensed under the ISC license. 11 * See the LICENSE file in the root directory of this source tree. 12 */const sp=Fa("FileJson",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1",key:"1oajmo"}],["path",{d:"M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1",key:"mpwhp6"}]]);/** 13 * @license lucide-react v0.462.0 - ISC 14 * 15 * This source code is licensed under the ISC license. 16 * See the LICENSE file in the root directory of this source tree. 17 */const _m=Fa("Pen",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]]);/** 18 * @license lucide-react v0.462.0 - ISC 19 * 20 * This source code is licensed under the ISC license. 21 * See the LICENSE file in the root directory of this source tree. 22 */const Pm=Fa("Save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]);/** 23 * @license lucide-react v0.462.0 - ISC 24 * 25 * This source code is licensed under the ISC license. 26 * See the LICENSE file in the root directory of this source tree. 27 */const Am=Fa("Share",[["path",{d:"M4 12v8a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8",key:"1b2hhj"}],["polyline",{points:"16 6 12 2 8 6",key:"m901s6"}],["line",{x1:"12",x2:"12",y1:"2",y2:"15",key:"1p0rca"}]]);/** 28 * @license lucide-react v0.462.0 - ISC 29 * 30 * This source code is licensed under the ISC license. 31 * See the LICENSE file in the root directory of this source tree. 32 */const Mm=Fa("SquareMinus",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M8 12h8",key:"1wcyev"}]]);/** 33 * @license lucide-react v0.462.0 - ISC 34 * 35 * This source code is licensed under the ISC license. 36 * See the LICENSE file in the root directory of this source tree. 37 */const Em=Fa("SquarePlus",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"M12 8v8",key:"napkw2"}]]),Dm=({className:a,...e})=>h.jsx(Af,{className:ie("flex h-full w-full data-[panel-group-direction=vertical]:flex-col",a),...e}),Sc=Pf,Tm=({withHandle:a,className:e,...t})=>h.jsx(Mf,{className:ie("relative flex w-px items-center justify-center bg-border/40 transition-colors duration-150 ease-out focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-offset-1 data-[panel-group-direction=vertical]:h-px data-[panel-group-direction=vertical]:w-full","cursor-col-resize data-[panel-group-direction=vertical]:cursor-row-resize","[&>div]:hidden","after:absolute after:-inset-y-2 after:-inset-x-0.5 after:rounded-full after:bg-transparent after:transition-colors after:duration-150 hover:after:bg-border/80","data-[panel-group-direction=vertical]:after:-inset-x-2 data-[panel-group-direction=vertical]:after:-inset-y-0.5","before:absolute before:inset-0 before:bg-border/30 before:opacity-0 before:transition-opacity before:duration-150 hover:before:opacity-100",e),...t,children:a&&h.jsx("div",{"data-codepal-ve-id":"src-components-ui-resizable-tsx:resizablehandle:div:41:13","data-codepal-binding-id":"src-components-ui-resizable-tsx:resizablehandle:div:41:13","data-codepal-module-id":"src-components-ui-resizable-tsx","data-codepal-component-id":"src-components-ui-resizable-tsx:resizablehandle","data-codepal-source-node
37-id":"src-components-ui-resizable-tsx:resizablehandle:div:41:13","data-codepal-source-file":"src/components/ui/resizable.tsx","data-codepal-source-line":"41","data-codepal-source-column":"13","data-codepal-source-symbol":"ResizableHandle",className:"z-10 flex h-4 w-3 items-center justify-center rounded-sm border bg-border",children:h.jsxs("svg",{"data-codepal-ve-id":"src-components-ui-resizable-tsx:resizablehandle:svg:42:17","data-codepal-binding-id":"src-components-ui-resizable-tsx:resizablehandle:svg:42:17","data-codepal-module-id":"src-components-ui-resizable-tsx","data-codepal-component-id":"src-components-ui-resizable-tsx:resizablehandle","data-codepal-source-node-id":"src-components-ui-resizable-tsx:resizablehandle:svg:42:17","data-codepal-source-file":"src/components/ui/resizable.tsx","data-codepal-source-line":"42","data-codepal-source-column":"17","data-codepal-source-symbol":"ResizableHandle",width:"6",height:"10",viewBox:"0 0 6 10",fill:"currentColor",className:"text-muted-foreground",children:[h.jsx("circle",{"data-codepal-ve-id":"src-components-ui-resizable-tsx:resizablehandle:circle:43:21","data-codepal-binding-id":"src-components-ui-resizable-tsx:resizablehandle:circle:43:21","data-codepal-module-id":"src-components-ui-resizable-tsx","data-codepal-component-id":"src-components-ui-resizable-tsx:resizablehandle","data-codepal-source-node-id":"src-components-ui-resizable-tsx:resizablehandle:circle:43:21","data-codepal-source-file":"src/components/ui/resizable.tsx","data-codepal-source-line":"43","data-codepal-source-column":"21","data-codepal-source-symbol":"ResizableHandle",cx:"1",cy:"1",r:"1"}),h.jsx("circle",{"data-codepal-ve-id":"src-components-ui-resizable-tsx:resizablehandle:circle:44:21","data-codepal-binding-id":"src-components-ui-resizable-tsx:resizablehandle:circle:44:21","data-codepal-module-id":"src-components-ui-resizable-tsx","data-codepal-component-id":"src-components-ui-resizable-tsx:resizablehandle","data-codepal-source-node-id":"src-components-ui-resizable-tsx:resizablehandle:circle:44:21","data-codepal-source-file":"src/components/ui/resizable.tsx","data-codepal-source-line":"44","data-codepal-source-column":"21","data-codepal-source-symbol":"ResizableHandle",cx:"1",cy:"5",r:"1"}),h.jsx("circle",{"data-codepal-ve-id":"src-components-ui-resizable-tsx:resizablehandle:circle:45:21","data-codepal-binding-id":"src-components-ui-resizable-tsx:resizablehandle:circle:45:21","data-codepal-module-id":"src-components-ui-resizable-tsx","data-codepal-component-id":"src-components-ui-resizable-tsx:resizablehandle","data-codepal-source-node-id":"src-components-ui-resizable-tsx:resizablehandle:circle:45:21","data-codepal-source-file":"src/components/ui/resizable.tsx","data-codepal-source-line":"45","data-codepal-source-column":"21","data-codepal-source-symbol":"ResizableHandle",cx:"1",cy:"9",r:"1"}),h.jsx("circle",{"data-codepal-ve-id":"src-components-ui-resizable-tsx:resizablehandle:circle:46:21","data-codepal-binding-id":"src-components-ui-resizable-tsx:resizablehandle:circle:46:21","data-codepal-module-id":"src-components-ui-resizable-tsx","data-codepal-component-id":"src-components-ui-resizable-tsx:resizablehandle","data-codepal-source-node-id":"src-components-ui-resizable-tsx:resizablehandle:circle:46:21","data-codepal-source-file":"src/components/ui/resizable.tsx","data-codepal-source-line":"46","data-codepal-source-column":"21","data-codepal-source-symbol":"ResizableHandle",cx:"5",cy:"1",r:"1"}),h.jsx("circle",{"data-codepal-ve-id":"src-components-ui-resizable-tsx:resizablehandle:circle:47:21","data-codepal-binding-id":"src-components-ui-resizable-tsx:resizablehandle:circle:47:21","data-codepal-module-id":"src-components-ui-resizable-tsx","data-codepal-component-id":"src-components-ui-resizable-tsx:resizablehandle","data-codepal-source-node-id":"src-components-ui-resizable-tsx:resizablehandle:circle:47:21","data-codepal-source-file":"src/components/ui/resizable.tsx","data-codepal-source-line":"47","data-codepal-source-column":"21","data-codepal-source-symbol":"ResizableHandle",cx:"5",cy:"5",r:"1"}),h.jsx("circle",{"data-codepal-ve-id":"src-components-ui-resizable-tsx:resizablehandle:circle:48:21","data-codepal-binding-id":"src-components-ui-resizable-tsx:resizablehandle:circle:48:21","data-codepal-module-id":"src-components-ui-resizable-tsx","data-codepal-component-id":"src-components-ui-resizable-tsx:resizablehandle","data-codepal-source-node
37-id":"src-components-ui-resizable-tsx:resizablehandle:circle:48:21","data-codepal-source-file":"src/components/ui/resizable.tsx","data-codepal-source-line":"48","data-codepal-source-column":"21","data-codepal-source-symbol":"ResizableHandle",cx:"5",cy:"9",r:"1"})]})})});function Dr(a,e,t){function s(u){return u.trim().split(" ",2)[0]===e}function o(u,f,m,g,x){return u[f].nesting===1&&u[f].attrJoin("class",e),x.renderToken(u,f,m,g,x)}t=t||{};const r=3,i=t.marker||":",n=i.charCodeAt(0),c=i.length,l=t.validate||s,d=t.render||o;function p(u,f,m,g){let x,b=!1,y=u.bMarks[f]+u.tShift[f],k=u.eMarks[f];if(n!==u.src.charCodeAt(y))return!1;for(x=y+1;x<=k&&i[(x-y)%c]===u.src[x];x++);const A=Math.floor((x-y)/c);if(A<r)return!1;x-=(x-y)%c;const S=u.src.slice(y,x),N=u.src.slice(x,k);if(!l(N,S))return!1;if(g)return!0;let D=f;for(;D++,!(D>=m||(y=u.bMarks[D]+u.tShift[D],k=u.eMarks[D],y<k&&u.sCount[D]<u.blkIndent));)if(n===u.src.charCodeAt(y)&&!(u.sCount[D]-u.blkIndent>=4)){for(x=y+1;x<=k&&i[(x-y)%c]===u.src[x];x++);if(!(Math.floor((x-y)/c)<A)&&(x-=(x-y)%c,x=u.skipSpaces(x),!(x<k))){b=!0;break}}const L=u.parentType,M=u.lineMax;u.parentType="container",u.lineMax=D;const B=u.push("container_"+e+"_open","div",1);B.markup=S,B.block=!0,B.info=N,B.map=[f,D],u.md.block.tokenize(u,f+1,D);const V=u.push("container_"+e+"_close","div",-1);return V.markup=u.src.slice(y,x),V.block=!0,u.parentType=L,u.lineMax=M,u.line=D+(b?1:0),!0}a.block.ruler.before("fence","container_"+e,p,{alt:["paragraph","reference","blockquote","list"]}),a.renderer.rules["container_"+e+"_open"]=d,a.renderer.rules["container_"+e+"_close"]=d}const Nm=1024;let Lm=0,mt=class{constructor(e,t){this.from=e,this.to=t}};class ye{constructor(e={}){this.id=Lm++,this.perNode=!!e.perNode,this.deserialize=e.deserialize||(()=>{throw new Error("This node type doesn't define a deserialize function")})}add(e){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return typeof e!="function"&&(e=ct.match(e)),t=>{let s=e(t);return s===void 0?null:[this,s]}}}ye.closedBy=new ye({deserialize:a=>a.split(" ")});ye.openedBy=new ye({deserialize:a=>a.split(" ")});ye.group=new ye({deserialize:a=>a.split(" ")});ye.isolate=new ye({deserialize:a=>{if(a&&a!="rtl"&&a!="ltr"&&a!="auto")throw new RangeError("Invalid value for isolate: "+a);return a||"auto"}});ye.contextHash=new ye({perNode:!0});ye.lookAhead=new ye({perNode:!0});ye.mounted=new ye({perNode:!0});class zs{constructor(e,t,s){this.tree=e,this.overlay=t,this.parser=s}static get(e){return e&&e.props&&e.props[ye.mounted.id]}}const Im=Object.create(null);class ct{constructor(e,t,s,o=0){this.name=e,this.props=t,this.id=s,this.flags=o}static define(e){let t=e.props&&e.props.length?Object.create(null):Im,s=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(e.name==null?8:0),o=new ct(e.name||"",t,e.id,s);if(e.props){for(let r of e.props)if(Array.isArray(r)||(r=r(o)),r){if(r[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");t[r[0].id]=r[1]}}return o}prop(e){return this.props[e.id]}get isTop(){return(this.flags&1)>0}get isSkipped(){return(this.flags&2)>0}get isError(){return(this.flags&4)>0}get isAnonymous(){return(this.flags&8)>0}is(e){if(typeof e=="string"){if(this.name==e)return!0;let t=this.prop(ye.group);return t?t.indexOf(e)>-1:!1}return this.id==e}static match(e){let t=Object.create(null);for(let s in e)for(let o of s.split(" "))t[o]=e[s];return s=>{for(let o=s.prop(ye.group),r=-1;r<(o?o.length:0);r++){let i=t[r<0?s.name:o[r]];if(i)return i}}}}ct.none=new ct("",Object.create(null),0,8);class Dn{constructor(e){this.types=e;for(let t=0;t<e.length;t++)if(e[t].id!=t)throw new RangeError("Node type ids should correspond to array positions when creating a node set")}extend(...e){let t=[];for(let s of this.types){let o=null;for(let r of e){let i=r(s);i&&(o||(o=Object.assign({},s.props)),o[i[0].id]=i[1])}t.push(o?new ct(s.name,o,s.id,s.flags):s)}return new Dn(t)}}const Co=new WeakMap,_c=new WeakMap;var Be;(function(a){a[a.ExcludeBuffers=1]="ExcludeBuffers",a[a.IncludeAnonymous=2]="IncludeAnonymous",a[a.IgnoreMounts=4]="IgnoreMounts",a[a.IgnoreOverlays=8]="IgnoreOverlays"})(Be||(Be={}));
vendor: 122,419 bytes, lines 37-43
37class Le{constructor(e,t,s,o,r){if(this.type=e,this.children=t,this.positions=s,this.length=o,this.props=null,r&&r.length){this.props=Object.create(null);for(let[i,n]of r)this.props[typeof i=="number"?i:i.id]=n}}toString(){let e=zs.get(this);if(e&&!e.overlay)return e.tree.toString();let t="";for(let s of this.children){let o=s.toString();o&&(t&&(t+=","),t+=o)}return this.type.name?(/\W/.test(this.type.name)&&!this.type.isError?JSON.stringify(this.type.name):this.type.name)+(t.length?"("+t+")":""):t}cursor(e=0){return new cr(this.topNode,e)}cursorAt(e,t=0,s=0){let o=Co.get(this)||this.topNode,r=new cr(o);return r.moveTo(e,t),Co.set(this,r._tree),r}get topNode(){return new tt(this,0,0,null)}resolve(e,t=0){let s=Vs(Co.get(this)||this.topNode,e,t,!1);return Co.set(this,s),s}resolveInner(e,t=0){let s=Vs(_c.get(this)||this.topNode,e,t,!0);return _c.set(this,s),s}resolveStack(e,t=0){return Rm(this,e,t)}iterate(e){let{enter:t,leave:s,from:o=0,to:r=this.length}=e,i=e.mode||0,n=(i&Be.IncludeAnonymous)>0;for(let c=this.cursor(i|Be.IncludeAnonymous);;){let l=!1;if(c.from<=r&&c.to>=o&&(!n&&c.type.isAnonymous||t(c)!==!1)){if(c.firstChild())continue;l=!0}for(;l&&s&&(n||!c.type.isAnonymous)&&s(c),!c.nextSibling();){if(!c.parent())return;l=!0}}}prop(e){return e.perNode?this.props?this.props[e.id]:void 0:this.type.prop(e)}get propValues(){let e=[];if(this.props)for(let t in this.props)e.push([+t,this.props[t]]);return e}balance(e={}){return this.children.length<=8?this:Ln(ct.none,this.children,this.positions,0,this.children.length,0,this.length,(t,s,o)=>new Le(this.type,t,s,o,this.propValues),e.makeTree||((t,s,o)=>new Le(ct.none,t,s,o)))}static build(e){return Bm(e)}}Le.empty=new Le(ct.none,[],[],0);class Tn{constructor(e,t){this.buffer=e,this.index=t}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}get pos(){return this.index}next(){this.index-=4}fork(){return new Tn(this.buffer,this.index)}}class pa{constructor(e,t,s){this.buffer=e,this.length=t,this.set=s}get type(){return ct.none}toString(){let e=[];for(let t=0;t<this.buffer.length;)e.push(this.childString(t)),t=this.buffer[t+3];return e.join(",")}childString(e){let t=this.buffer[e],s=this.buffer[e+3],o=this.set.types[t],r=o.name;if(/\W/.test(r)&&!o.isError&&(r=JSON.stringify(r)),e+=4,s==e)return r;let i=[];for(;e<s;)i.push(this.childString(e)),e=this.buffer[e+3];return r+"("+i.join(",")+")"}findChild(e,t,s,o,r){let{buffer:i}=this,n=-1;for(let c=e;c!=t&&!(op(r,o,i[c+1],i[c+2])&&(n=c,s>0));c=i[c+3]);return n}slice(e,t,s){let o=this.buffer,r=new Uint16Array(t-e),i=0;for(let n=e,c=0;n<t;){r[c++]=o[n++],r[c++]=o[n++]-s;let l=r[c++]=o[n++]-s;r[c++]=o[n++]-e,i=Math.max(i,l)}return new pa(r,i,this.set)}}function op(a,e,t,s){switch(a){case-2:return t<e;case-1:return s>=e&&t<e;case 0:return t<e&&s>e;case 1:return t<=e&&s>e;case 2:return s>e;case 4:return!0}}function Vs(a,e,t,s){for(var o;a.from==a.to||(t<1?a.from>=e:a.from>e)||(t>-1?a.to<=e:a.to<e);){let i=!s&&a instanceof tt&&a.index<0?null:a.parent;if(!i)return a;a=i}let r=s?0:Be.IgnoreOverlays;if(s)for(let i=a,n=i.parent;n;i=n,n=i.parent)i instanceof tt&&i.index<0&&((o=n.enter(e,t,r))===null||o===void 0?void 0:o.from)!=i.from&&(a=n);for(;;){let i=a.enter(e,t,r);if(!i)return a;a=i}}class rp{cursor(e=0){return new cr(this,e)}getChild(e,t=null,s=null){let o=Pc(this,e,t,s);return o.length?o[0]:null}getChildren(e,t=null,s=null){return Pc(this,e,t,s)}resolve(e,t=0){return Vs(this,e,t,!1)}resolveInner(e,t=0){return Vs(this,e,t,!0)}matchContext(e){return Ai(this.parent,e)}enterUnfinishedNodesBefore(e){let t=this.childBefore(e),s=this;for(;t;){let o=t.lastChild;if(!o||o.to!=t.to)break;o.type.isError&&o.from==o.to?(s=t,t=o.prevSibling):t=o}return s}get node(){return this}get next(){return this.parent}}class tt extends rp{constructor(e,t,s,o){super(),this._tree=e,this.from=t,this.index=s,this._parent=o}get type(){return this._tree.type}get name(){return this._tree.type.name}get to(){return this.from+this._tree.length}nextChild(e,t,s,o,r=0){for(let i=this;;){for(let{children:n,positions:c}=i._tree,l=t>0?n.length:-1;e!=l;e+=t){let d=n[e],p=c[e]+i.from;if(op(o,s,p,p+d.length)){if(d instanceof pa){if(r&Be.ExcludeBuffers)continue;let u=d.findChild(0,d.buffer.length,t,s-p,o);if(u>-1)return new It(new Om(i,d,e,p),null,u)}else if(r&Be.IncludeAnonymous||!d.type.isAnonymous||Nn(d)){let u;if(!(r&Be.IgnoreMounts)&&(u=zs.get(d))&&!u.overlay)return new tt(u.tree,p,e,i);let f=new tt(d,p,e,i);return r&Be.IncludeAnonymous||!f.type.isAnonymous?f:f.nextChild(t<0?d.children.length-1:0,t,s,o)}}}if(r&Be.IncludeAnonymous||!i.type.isAnonymous||(i.index>=0?e=i.index+t:e=t<0?-1:i._parent._tree.children.length,i=i._parent,!i))return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(e){return this.nextChild(0,1,e,2)}childBefore(e){return this.nextChild(this._tree.children.length-1,-1,e,-2)}enter(e,t,s=0){let o;if(!(s&Be.IgnoreOverlays)&&(o=zs.get(this._tree))&&o.overlay){let r=e-this.from;for(let{from:i,to:n}of o.overlay)if((t>0?i<=r:i<r)&&(t<0?n>=r:n>r))return new tt(o.tree,o.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,e,t,s)}nextSignificantParent(){let e=this;for(;e.type.isAnonymous&&e._parent;)e=e._parent;return e}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}get tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}}function Pc(a,e,t,s){let o=a.cursor(),r=[];if(!o.firstChild())return r;if(t!=null){for(let i=!1;!i;)if(i=o.type.is(t),!o.nextSibling())return r}for(;;){if(s!=null&&o.type.is(s))return r;if(o.type.is(e)&&r.push(o.node),!o.nextSibling())return s==null?r:[]}}function Ai(a,e,t=e.length-1){for(let s=a;t>=0;s=s.parent){if(!s)return!1;if(!s.type.isAnonymous){if(e[t]&&e[t]!=s.name)return!1;t--}}return!0}class Om{constructor(e,t,s,o){this.parent=e,this.buffer=t,this.index=s,this.start=o}}class It extends rp{get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(e,t,s){super(),this.context=e,this._parent=t,this.index=s,this.type=e.buffer.set.types[e.buffer.buffer[s]]}child(e,t,s){let{buffer:o}=this.context,r=o.findChild(this.index+4,o.buffer[this.index+3],e,t-this.context.start,s);return r<0?null:new It(this.context,this,r)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(e){return this.child(1,e,2)}childBefore(e){return this.child(-1,e,-2)}enter(e,t,s=0){if(s&Be.ExcludeBuffers)return null;let{buffer:o}=this.context,r=o.findChild(this.index+4,o.buffer[this.index+3],t>0?1:-1,e-this.context.start,t);return r<0?null:new It(this.context,this,r)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(e){return this._parent?null:this.context.parent.nextChild(this.context.index+e,e,0,4)}get nextSibling(){let{buffer:e}=this.context,t=e.buffer[this.index+3];return t<(this._parent?e.buffer[this._parent.index+3]:e.buffer.length)?new It(this.context,this._parent,t):this.externalSibling(1)}get prevSibling(){let{buffer:e}=this.context,t=this._parent?this._parent.index+4:0;return this.index==t?this.externalSibling(-1):new It(this.context,this._parent,e.findChild(t,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],t=[],{buffer:s}=this.context,o=this.index+4,r=s.buffer[this.index+3];if(r>o){let i=s.buffer[this.index+1];e.push(s.slice(o,r,i)),t.push(0)}return new Le(this.type,e,t,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function ip(a){if(!a.length)return null;let e=0,t=a[0];for(let r=1;r<a.length;r++){let i=a[r];(i.from>t.from||i.to<t.to)&&(t=i,e=r)}let s=t instanceof tt&&t.index<0?null:t.parent,o=a.slice();return s?o[e]=s:o.splice(e,1),new Fm(o,t)}class Fm{constructor(e,t){this.heads=e,this.node=t}get next(){return ip(this.heads)}}function Rm(a,e,t){let s=a.resolveInner(e,t),o=null;for(let r=s instanceof tt?s:s.context.parent;r;r=r.parent)if(r.index<0){let i=r.parent;(o||(o=[s])).push(i.resolve(e,t)),r=i}else{let i=zs.get(r.tree);if(i&&i.overlay&&i.overlay[0].from<=e&&i.overlay[i.overlay.length-1].to>=e){let n=new tt(i.tree,i.overlay[0].from+r.from,-1,r);(o||(o=[s])).push(Vs(n,e,t,!1))}}return o?ip(o):s}class cr{get name(){return this.type.name}constructor(e,t=0){if(this.mode=t,this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,e instanceof tt)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(let s=e._parent;s;s=s._parent)this.stack.unshift(s.index);this.bufferNode=e,this.yieldBuf(e.index)}}yieldNode(e){return e?(this._tree=e,this.type=e.type,this.from=e.from,this.to=e.to,!0):!1}yieldBuf(e,t){this.index=e;let{start:s,buffer:o}=this.buffer;return this.type=t||o.set.types[o.buffer[e]],this.from=s+o.buffer[e+1],this.to=s+o.buffer[e+2],!0}yield(e){return e?e instanceof tt?(this.buffer=null,this.yieldNode(e)):(this.buffer=e.context,this.yieldBuf(e.index,e.type)):!1}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(e,t,s){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,t,s,this.mode));let{buffer:o}=this.buffer,r=o.findChild(this.index+4,o.buffer[this.index+3],e,t-this.buffer.start,s);return r<0?!1:(this.stack.push(this.index),this.yieldBuf(r))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(e){return this.enterChild(1,e,2)}childBefore(e){return this.enterChild(-1,e,-2)}enter(e,t,s=this.mode){return this.buffer?s&Be.ExcludeBuffers?!1:this.enterChild(1,e,t):this.yield(this._tree.enter(e,t,s))}parent(){if(!this.buffer)return this.yieldNode(this.mode&Be.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&Be.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(e)}sibling(e){if(!this.buffer)return this._tree._parent?this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+e,e,0,4,this.mode)):!1;let{buffer:t}=this.buffer,s=this.stack.length-1;if(e<0){let o=s<0?0:this.stack[s]+4;if(this.index!=o)return this.yieldBuf(t.findChild(o,this.index,-1,0,4))}else{let o=t.buffer[this.index+3];if(o<(s<0?t.buffer.length:t.buffer[this.stack[s]+3]))return this.yieldBuf(o)}return s<0?this.yield(this.buffer.parent.nextChild(this.buffer.index+e,e,0,4,this.mode)):!1}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(e){let t,s,{buffer:o}=this;if(o){if(e>0){if(this.index<o.buffer.buffer.length)return!1}else for(let r=0;r<this.index;r++)if(o.buffer.buffer[r+3]<this.index)return!1;({index:t,parent:s}=o)}else({index:t,_parent:s}=this._tree);for(;s;{index:t,_parent:s}=s)if(t>-1)for(let r=t+e,i=e<0?-1:s._tree.children.length;r!=i;r+=e){let n=s._tree.children[r];if(this.mode&Be.IncludeAnonymous||n instanceof pa||!n.type.isAnonymous||Nn(n))return!1}return!0}move(e,t){if(t&&this.enterChild(e,0,4))return!0;for(;;){if(this.sibling(e))return!0;if(this.atLastNode(e)||!this.parent())return!1}}next(e=!0){return this.move(1,e)}prev(e=!0){return this.move(-1,e)}moveTo(e,t=0){for(;(this.from==this.to||(t<1?this.from>=e:this.from>e)||(t>-1?this.to<=e:this.to<e))&&this.parent(););for(;this.enterChild(1,e,t););return this}get node(){if(!this.buffer)return this._tree;let e=this.bufferNode,t=null,s=0;if(e&&e.context==this.buffer)e:for(let o=this.index,r=this.stack.length;r>=0;){for(let i=e;i;i=i._parent)if(i.index==o){if(o==this.index)return i;t=i,s=r+1;break e}o=this.stack[--r]}for(let o=s;o<this.stack.length;o++)t=new It(this.buffer,t,this.stack[o]);return this.bufferNode=new It(this.buffer,t,this.index)}get tree(){return this.buffer?null:this._tree._tree}iterate(e,t){for(let s=0;;){let o=!1;if(this.type.isAnonymous||e(this)!==!1){if(this.firstChild()){s++;continue}this.type.isAnonymous||(o=!0)}for(;;){if(o&&t&&t(this),o=this.type.isAnonymous,!s)return;if(this.nextSibling())break;this.parent(),s--,o=!0}}}matchContext(e){if(!this.buffer)return Ai(this.node.parent,e);let{buffer:t}=this.buffer,{types:s}=t.set;for(let o=e.length-1,r=this.stack.length-1;o>=0;r--){if(r<0)return Ai(this._tree,e,o);let i=s[t.buffer[this.stack[r]]];if(!i.isAnonymous){if(e[o]&&e[o]!=i.name)return!1;o--}}return!0}}function Nn(a){return a.children.some(e=>e instanceof pa||!e.type.isAnonymous||Nn(e))}function Bm(a){var e;let{buffer:t,nodeSet:s,maxBufferLength:o=Nm,reused:r=[],minRepeatType:i=s.types.length}=a,n=Array.isArray(t)?new Tn(t,t.length):t,c=s.types,l=0,d=0;function p(S,N,D,L,M,B){let{id:V,start:P,end:F,size:j}=n,z=d,ce=l;for(;j<0;)if(n.next(),j==-1){let T=r[V];D.push(T),L.push(P-S);return}else if(j==-3){l=V;return}else if(j==-4){d=V;return}else throw new RangeError(`Unrecognized record size: ${j}`);let $=c[V],K,I,X=P-S;if(F-P<=o&&(I=x(n.pos-N,M))){let T=new Uint16Array(I.size-I.skip),O=n.pos-I.size,Z=T.length;for(;n.pos>O;)Z=b(I.start,T,Z);K=new pa(T,F-I.start,s),X=I.start-S}else{let T=n.pos-j;n.next();let O=[],Z=[],oe=V>=i?V:-1,se=0,Ae=F;for(;n.pos>T;)oe>=0&&n.id==oe&&n.size>=0?(n.end<=Ae-o&&(m(O,Z,P,se,n.end,Ae,oe,z,ce),se=O.length,Ae=n.end),n.next()):B>2500?u(P,T,O,Z):p(P,T,O,Z,oe,B+1);if(oe>=0&&se>0&&se<O.length&&m(O,Z,P,se,P,Ae,oe,z,ce),O.reverse(),Z.reverse(),oe>-1&&se>0){let Ie=f($,ce);K=Ln($,O,Z,0,O.length,0,F-P,Ie,Ie)}else K=g($,O,Z,F-P,z-F,ce)}D.push(K),L.push(X)}function u(S,N,D,L){let M=[],B=0,V=-1;for(;n.pos>N;){let{id:P,start:F,end:j,size:z}=n;if(z>4)n.next();else{if(V>-1&&F<V)break;V<0&&(V=j-o),M.push(P,F,j),B++,n.next()}}if(B){let P=new Uint16Array(B*4),F=M[M.length-2];for(let j=M.length-3,z=0;j>=0;j-=3)P[z++]=M[j],P[z++]=M[j+1]-F,P[z++]=M[j+2]-F,P[z++]=z;D.push(new pa(P,M[2]-F,s)),L.push(F-S)}}function f(S,N){return(D,L,M)=>{let B=0,V=D.length-1,P,F;if(V>=0&&(P=D[V])instanceof Le){if(!V&&P.type==S&&P.length==M)return P;(F=P.prop(ye.lookAhead))&&(B=L[V]+P.length+F)}return g(S,D,L,M,B,N)}}function m(S,N,D,L,M,B,V,P,F){let j=[],z=[];for(;S.length>L;)j.push(S.pop()),z.push(N.pop()+D-M);S.push(g(s.types[V],j,z,B-M,P-B,F)),N.push(M-D)}function g(S,N,D,L,M,B,V){if(B){let P=[ye.contextHash,B];V=V?[P].concat(V):[P]}if(M>25){let P=[ye.lookAhead,M];V=V?[P].concat(V):[P]}return new Le(S,N,D,L,V)}function x(S,N){let D=n.fork(),L=0,M=0,B=0,V=D.end-o,P={size:0,start:0,skip:0};e:for(let F=D.pos-S;D.pos>F;){let j=D.size;if(D.id==N&&j>=0){P.size=L,P.start=M,P.skip=B,B+=4,L+=4,D.next();continue}let z=D.pos-j;if(j<0||z<F||D.start<V)break;let ce=D.id>=i?4:0,$=D.start;for(D.next();D.pos>z;){if(D.size<0)if(D.size==-3)ce+=4;else break e;else D.id>=i&&(ce+=4);D.next()}M=$,L+=j,B+=ce}return(N<0||L==S)&&(P.size=L,P.start=M,P.skip=B),P.size>4?P:void 0}function b(S,N,D){let{id:L,start:M,end:B,size:V}=n;if(n.next(),V>=0&&L<i){let P=D;if(V>4){let F=n.pos-(V-4);for(;n.pos>F;)D=b(S,N,D)}N[--D]=P,N[--D]=B-S,N[--D]=M-S,N[--D]=L}else V==-3?l=L:V==-4&&(d=L);return D}let y=[],k=[];for(;n.pos>0;)p(a.start||0,a.bufferStart||0,y,k,-1,0);let A=(e=a.length)!==null&&e!==void 0?e:y.length?k[0]+y[0].length:0;return new Le(c[a.topID],y.reverse(),k.reverse(),A)}const Ac=new WeakMap;function Ko(a,e){if(!a.isAnonymous||e instanceof pa||e.type!=a)return 1;let t=Ac.get(e);if(t==null){t=1;for(let s of e.children){if(s.type!=a||!(s instanceof Le)){t=1;break}t+=Ko(a,s)}Ac.set(e,t)}return t}function Ln(a,e,t,s,o,r,i,n,c){let l=0;for(let m=s;m<o;m++)l+=Ko(a,e[m]);let d=Math.ceil(l*1.5/8),p=[],u=[];function f(m,g,x,b,y){for(let k=x;k<b;){let A=k,S=g[k],N=Ko(a,m[k]);for(k++;k<b;k++){let D=Ko(a,m[k]);if(N+D>=d)break;N+=D}if(k==A+1){if(N>d){let D=m[A];f(D.children,D.positions,0,D.children.length,g[A]+y);continue}p.push(m[A])}else{let D=g[k-1]+m[k-1].length-S;p.push(Ln(a,m,g,A,k,S,D,null,c))}u.push(S+y-r)}}return f(e,t,s,o,0),(n||c)(p,u,i)}class w2{constructor(){this.map=new WeakMap}setBuffer(e,t,s){let o=this.map.get(e);o||this.map.set(e,o=new Map),o.set(t,s)}getBuffer(e,t){let s=this.map.get(e);return s&&s.get(t)}set(e,t){e instanceof It?this.setBuffer(e.context.buffer,e.index,t):e instanceof tt&&this.map.set(e.tree,t)}get(e){return e instanceof It?this.getBuffer(e.context.buffer,e.index):e instanceof tt?this.map.get(e.tree):void 0}cursorSet(e,t){e.buffer?this.setBuffer(e.buffer.buffer,e.index,t):this.map.set(e.tree,t)}cursorGet(e){return e.buffer?this.getBuffer(e.buffer.buffer,e.index):this.map.get(e.tree)}}class Yt{constructor(e,t,s,o,r=!1,i=!1){this.from=e,this.to=t,this.tree=s,this.offset=o,this.open=(r?1:0)|(i?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(e,t=[],s=!1){let o=[new Yt(0,e.length,e,0,!1,s)];for(let r of t)r.to>e.length&&o.push(r);return o}static applyChanges(e,t,s=128){if(!t.length)return e;let o=[],r=1,i=e.length?e[0]:null;for(let n=0,c=0,l=0;;n++){let d=n<t.length?t[n]:null,p=d?d.fromA:1e9;if(p-c>=s)for(;i&&i.from<p;){let u=i;if(c>=u.from||p<=u.to||l){let f=Math.max(u.from,c)-l,m=Math.min(u.to,p)-l;u=f>=m?null:new Yt(f,m,u.tree,u.offset+l,n>0,!!d)}if(u&&o.push(u),i.to>p)break;i=r<e.length?e[r++]:null}if(!d)break;c=d.toA,l=d.toA-d.toB}return o}}class np{startParse(e,t,s){return typeof e=="string"&&(e=new zm(e)),s=s?s.length?s.map(o=>new mt(o.from,o.to)):[new mt(0,0)]:[new mt(0,e.length)],this.createParse(e,t||[],s)}parse(e,t,s){let o=this.startParse(e,t,s);for(;;){let r=o.advance();if(r)return r}}}class zm{constructor(e){this.string=e}get length(){return this.string.length}chunk(e){return this.string.slice(e)}get lineChunks(){return!1}read(e,t){return this.string.slice(e,t)}}function y2(a){return(e,t,s,o)=>new Wm(e,a,t,s,o)}class Mc{constructor(e,t,s,o,r){this.parser=e,this.parse=t,this.overlay=s,this.target=o,this.from=r}}function Ec(a){if(!a.length||a.some(e=>e.from>=e.to))throw new RangeError("Invalid inner parse ranges given: "+JSON.stringify(a))}class Vm{constructor(e,t,s,o,r,i,n){this.parser=e,this.predicate=t,this.mounts=s,this.index=o,this.start=r,this.target=i,this.prev=n,this.depth=0,this.ranges=[]}}const Mi=new ye({perNode:!0});class Wm{constructor(e,t,s,o,r){this.nest=t,this.input=s,this.fragments=o,this.ranges=r,this.inner=[],this.innerDone=0,this.baseTree=null,this.stoppedAt=null,this.baseParse=e}advance(){if(this.baseParse){let s=this.baseParse.advance();if(!s)return null;if(this.baseParse=null,this.baseTree=s,this.startInner(),this.stoppedAt!=null)for(let o of this.inner)o.parse.stopAt(this.stoppedAt)}if(this.innerDone==this.inner.length){let s=this.baseTree;return this.stoppedAt!=null&&(s=new Le(s.type,s.children,s.positions,s.length,s.propValues.concat([[Mi,this.stoppedAt]]))),s}let e=this.inner[this.innerDone],t=e.parse.advance();if(t){this.innerDone++;let s=Object.assign(Object.create(null),e.target.props);s[ye.mounted.id]=new zs(t,e.overlay,e.parser),e.target.props=s}return null}get parsedPos(){if(this.baseParse)return 0;let e=this.input.length;for(let t=this.innerDone;t<this.inner.length;t++)this.inner[t].from<e&&(e=Math.min(e,this.inner[t].parse.parsedPos));return e}stopAt(e){if(this.stoppedAt=e,this.baseParse)this.baseParse.stopAt(e);else for(let t=this.innerDone;t<this.inner.length;t++)this.inner[t].parse.stopAt(e)}startInner(){let e=new Um(this.fragments),t=null,s=null,o=new cr(new tt(this.baseTree,this.ranges[0].from,0,null),Be.IncludeAnonymous|Be.IgnoreMounts);e:for(let r,i;;){let n=!0,c;if(this.stoppedAt!=null&&o.from>=this.stoppedAt)n=!1;else if(e.hasNode(o)){if(t){let l=t.mounts.find(d=>d.frag.from<=o.from&&d.frag.to>=o.to&&d.mount.overlay);if(l)for(let d of l.mount.overlay){let p=d.from+l.pos,u=d.to+l.pos;p>=o.from&&u<=o.to&&!t.ranges.some(f=>f.from<u&&f.to>p)&&t.ranges.push({from:p,to:u})}}n=!1}else if(s&&(i=Hm(s.ranges,o.from,o.to)))n=i!=2;else if(!o.type.isAnonymous&&(r=this.nest(o,this.input))&&(o.from<o.to||!r.overlay)){o.tree||$m(o);let l=e.findMounts(o.from,r.parser);if(typeof r.overlay=="function")t=new Vm(r.parser,r.overlay,l,this.inner.length,o.from,o.tree,t);else{let d=Nc(this.ranges,r.overlay||(o.from<o.to?[new mt(o.from,o.to)]:[]));d.length&&Ec(d),(d.length||!r.overlay)&&this.inner.push(new Mc(r.parser,d.length?r.parser.startParse(this.input,Lc(l,d),d):r.parser.startParse(""),r.overlay?r.overlay.map(p=>new mt(p.from-o.from,p.to-o.from)):null,o.tree,d.length?d[0].from:o.from)),r.overlay?d.length&&(s={ranges:d,depth:0,prev:s}):n=!1}}else if(t&&(c=t.predicate(o))&&(c===!0&&(c=new mt(o.from,o.to)),c.from<c.to)){let l=t.ranges.length-1;l>=0&&t.ranges[l].to==c.from?t.ranges[l]={from:t.ranges[l].from,to:c.to}:t.ranges.push(c)}if(n&&o.firstChild())t&&t.depth++,s&&s.depth++;else for(;!o.nextSibling();){if(!o.parent())break e;if(t&&!--t.depth){let l=Nc(this.ranges,t.ranges);l.length&&(Ec(l),this.inner.splice(t.index,0,new Mc(t.parser,t.parser.startParse(this.input,Lc(t.mounts,l),l),t.ranges.map(d=>new mt(d.from-t.start,d.to-t.start)),t.target,l[0].from))),t=t.prev}s&&!--s.depth&&(s=s.prev)}}}}function Hm(a,e,t){for(let s of a){if(s.from>=t)break;if(s.to>e)return s.from<=e&&s.to>=t?2:1}return 0}function Dc(a,e,t,s,o,r){if(e<t){let i=a.buffer[e+1];s.push(a.slice(e,t,i)),o.push(i-r)}}function $m(a){let{node:e}=a,t=[],s=e.context.buffer;do t.push(a.index),a.parent();while(!a.tree);let o=a.tree,r=o.children.indexOf(s),i=o.children[r],n=i.buffer,c=[r];function l(d,p,u,f,m,g){let x=t[g],b=[],y=[];Dc(i,d,x,b,y,f);let k=n[x+1],A=n[x+2];c.push(b.length);let S=g?l(x+4,n[x+3],i.set.types[n[x]],k,A-k,g-1):e.toTree();return b.push(S),y.push(k-f),Dc(i,n[x+3],p,b,y,f),new Le(u,b,y,m)}o.children[r]=l(0,n.length,ct.none,0,i.length,t.length-1);for(let d of c){let p=a.tree.children[d],u=a.tree.positions[d];a.yield(new tt(p,u+a.from,d,a._tree))}}class Tc{constructor(e,t){this.offset=t,this.done=!1,this.cursor=e.cursor(Be.IncludeAnonymous|Be.IgnoreMounts)}moveTo(e){let{cursor:t}=this,s=e-this.offset;for(;!this.done&&t.from<s;)t.to>=e&&t.enter(s,1,Be.IgnoreOverlays|Be.ExcludeBuffers)||t.next(!1)||(this.done=!0)}hasNode(e){if(this.moveTo(e.from),!this.done&&this.cursor.from+this.offset==e.from&&this.cursor.tree)for(let t=this.cursor.tree;;){if(t==e.tree)return!0;if(t.children.length&&t.positions[0]==0&&t.children[0]instanceof Le)t=t.children[0];else break}return!1}}class Um{constructor(e){var t;if(this.fragments=e,this.curTo=0,this.fragI=0,e.length){let s=this.curFrag=e[0];this.curTo=(t=s.tree.prop(Mi))!==null&&t!==void 0?t:s.to,this.inner=new Tc(s.tree,-s.offset)}else this.curFrag=this.inner=null}hasNode(e){for(;this.curFrag&&e.from>=this.curTo;)this.nextFrag();return this.curFrag&&this.curFrag.from<=e.from&&this.curTo>=e.to&&this.inner.hasNode(e)}nextFrag(){var e;if(this.fragI++,this.fragI==this.fragments.length)this.curFrag=this.inner=null;else{let t=this.curFrag=this.fragments[this.fragI];this.curTo=(e=t.tree.prop(Mi))!==null&&e!==void 0?e:t.to,this.inner=new Tc(t.tree,-t.offset)}}findMounts(e,t){var s;let o=[];if(this.inner){this.inner.cursor.moveTo(e,1);for(let r=this.inner.cursor.node;r;r=r.parent){let i=(s=r.tree)===null||s===void 0?void 0:s.prop(ye.mounted);if(i&&i.parser==t)for(let n=this.fragI;n<this.fragments.length;n++){let c=this.fragments[n];if(c.from>=r.to)break;c.tree==this.curFrag.tree&&o.push({frag:c,pos:r.from-c.offset,mount:i})}}}return o}}function Nc(a,e){let t=null,s=e;for(let o=1,r=0;o<a.length;o++){let i=a[o-1].to,n=a[o].from;for(;r<s.length;r++){let c=s[r];if(c.from>=n)break;c.to<=i||(t||(s=t=e.slice()),c.from<i?(t[r]=new mt(c.from,i),c.to>n&&t.splice(r+1,0,new mt(n,c.to))):c.to>n?t[r--]=new mt(n,c.to):t.splice(r--,1))}}return s}function qm(a,e,t,s){let o=0,r=0,i=!1,n=!1,c=-1e9,l=[];for(;;){let d=o==a.length?1e9:i?a[o].to:a[o].from,p=r==e.length?1e9:n?e[r].to:e[r].from;if(i!=n){let u=Math.max(c,t),f=Math.min(d,p,s);u<f&&l.push(new mt(u,f))}if(c=Math.min(d,p),c==1e9)break;d==c&&(i?(i=!1,o++):i=!0),p==c&&(n?(n=!1,r++):n=!0)}return l}function Lc(a,e){let t=[];for(let{pos:s,mount:o,frag:r}of a){let i=s+(o.overlay?o.overlay[0].from:0),n=i+o.tree.length,c=Math.max(r.from,i),l=Math.min(r.to,n);if(o.overlay){let d=o.overlay.map(u=>new mt(u.from+s,u.to+s)),p=qm(e,d,c,l);for(let u=0,f=c;;u++){let m=u==p.length,g=m?l:p[u].from;if(g>f&&t.push(new Yt(f,g,o.tree,-i,r.from>=f||r.openStart,r.to<=g||r.openEnd)),m)break;f=p[u].to}}else t.push(new Yt(c,l,o.tree,-i,r.from>=i||r.openStart,r.to<=n||r.openEnd))}return t}let Ei=[],cp=[];(()=>{let a="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map(e=>e?parseInt(e,36):1);for(let e=0,t=0;e<a.length;e++)(e%2?cp:Ei).push(t=t+a[e])})();function Km(a){if(a<768)return!1;for(let e=0,t=Ei.length;;){let s=e+t>>1;if(a<Ei[s])t=s;else if(a>=cp[s])e=s+1;else return!0;if(e==t)return!1}}function Ic(a){return a>=127462&&a<=127487}const Oc=8205;function Gm(a,e,t=!0,s=!0){return(t?lp:Ym)(a,e,s)}function lp(a,e,t){if(e==a.length)return e;e&&dp(a.charCodeAt(e))&&pp(a.charCodeAt(e-1))&&e--;let s=Jr(a,e);for(e+=Fc(s);e<a.length;){let o=Jr(a,e);if(s==Oc||o==Oc||t&&Km(o))e+=Fc(o),s=o;else if(Ic(o)){let r=0,i=e-2;for(;i>=0&&Ic(Jr(a,i));)r++,i-=2;if(r%2==0)break;e+=2}else break}return e}function Ym(a,e,t){for(;e>0;){let s=lp(a,e-2,t);if(s<e)return s;e--}return 0}function Jr(a,e){let t=a.charCodeAt(e);if(!pp(t)||e+1==a.length)return t;let s=a.charCodeAt(e+1);return dp(s)?(t-55296<<10)+(s-56320)+65536:t}function dp(a){return a>=56320&&a<57344}function pp(a){return a>=55296&&a<56320}function Fc(a){return a<65536?1:2}class Se{lineAt(e){if(e<0||e>this.length)throw new RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw new RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,t,s){[e,t]=Xa(this,e,t);let o=[];return this.decompose(0,e,o,2),s.length&&s.decompose(0,s.length,o,3),this.decompose(t,this.length,o,1),Nt.from(o,this.length-(t-e)+s.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,t=this.length){[e,t]=Xa(this,e,t);let s=[];return this.decompose(e,t,s,0),Nt.from(s,t-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let t=this.scanIdentical(e,1),s=this.length-this.scanIdentical(e,-1),o=new Ds(this),r=new Ds(e);for(let i=t,n=t;;){if(o.next(i),r.next(i),i=0,o.lineBreak!=r.lineBreak||o.done!=r.done||o.value!=r.value)return!1;if(n+=o.value.length,o.done||n>=s)return!0}}iter(e=1){return new Ds(this,e)}iterRange(e,t=this.length){return new up(this,e,t)}iterLines(e,t){let s;if(e==null)s=this.iter();else{t==null&&(t=this.lines+1);let o=this.line(e).from;s=this.iterRange(o,Math.max(o,t==this.lines+1?this.length:t<=1?0:this.line(t-1).to))}return new hp(s)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(e){if(e.length==0)throw new RangeError("A document must have at least one line");return e.length==1&&!e[0]?Se.empty:e.length<=32?new Ve(e):Nt.from(Ve.split(e,[]))}}class Ve extends Se{constructor(e,t=Xm(e)){super(),this.text=e,this.length=t}get lines(){return this.text.length}get children(){return null}lineInner(e,t,s,o){for(let r=0;;r++){let i=this.text[r],n=o+i.length;if((t?s:n)>=e)return new Jm(o,n,s,i);o=n+1,s++}}decompose(e,t,s,o){let r=e<=0&&t>=this.length?this:new Ve(Rc(this.text,e,t),Math.min(t,this.length)-Math.max(0,e));if(o&1){let i=s.pop(),n=Go(r.text,i.text.slice(),0,r.length);if(n.length<=32)s.push(new Ve(n,i.length+r.length));else{let c=n.length>>1;s.push(new Ve(n.slice(0,c)),new Ve(n.slice(c)))}}else s.push(r)}replace(e,t,s){if(!(s instanceof Ve))return super.replace(e,t,s);[e,t]=Xa(this,e,t);let o=Go(this.text,Go(s.text,Rc(this.text,0,e)),t),r=this.length+s.length-(t-e);return o.length<=32?new Ve(o,r):Nt.from(Ve.split(o,[]),r)}sliceString(e,t=this.length,s=` 38`){[e,t]=Xa(this,e,t);let o="";for(let r=0,i=0;r<=t&&i<this.text.length;i++){let n=this.text[i],c=r+n.length;r>e&&i&&(o+=s),e<c&&t>r&&(o+=n.slice(Math.max(0,e-r),t-r)),r=c+1}return o}flatten(e){for(let t of this.text)e.push(t)}scanIdentical(){return 0}static split(e,t){let s=[],o=-1;for(let r of e)s.push(r),o+=r.length+1,s.length==32&&(t.push(new Ve(s,o)),s=[],o=-1);return o>-1&&t.push(new Ve(s,o)),t}}class Nt extends Se{constructor(e,t){super(),this.children=e,this.length=t,this.lines=0;for(let s of e)this.lines+=s.lines}lineInner(e,t,s,o){for(let r=0;;r++){let i=this.children[r],n=o+i.length,c=s+i.lines-1;if((t?c:n)>=e)return i.lineInner(e,t,s,o);o=n+1,s=c+1}}decompose(e,t,s,o){for(let r=0,i=0;i<=t&&r<this.children.length;r++){let n=this.children[r],c=i+n.length;if(e<=c&&t>=i){let l=o&((i<=e?1:0)|(c>=t?2:0));i>=e&&c<=t&&!l?s.push(n):n.decompose(e-i,t-i,s,l)}i=c+1}}replace(e,t,s){if([e,t]=Xa(this,e,t),s.lines<this.lines)for(let o=0,r=0;o<this.children.length;o++){let i=this.children[o],n=r+i.length;if(e>=r&&t<=n){let c=i.replace(e-r,t-r,s),l=this.lines-i.lines+c.lines;if(c.lines<l>>4&&c.lines>l>>6){let d=this.children.slice();return d[o]=c,new Nt(d,this.length-(t-e)+s.length)}return super.replace(r,n,c)}r=n+1}return super.replace(e,t,s)}sliceString(e,t=this.length,s=` 39`){[e,t]=Xa(this,e,t);let o="";for(let r=0,i=0;r<this.children.length&&i<=t;r++){let n=this.children[r],c=i+n.length;i>e&&r&&(o+=s),e<c&&t>i&&(o+=n.sliceString(e-i,t-i,s)),i=c+1}return o}flatten(e){for(let t of this.children)t.flatten(e)}scanIdentical(e,t){if(!(e instanceof Nt))return 0;let s=0,[o,r,i,n]=t>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;o+=t,r+=t){if(o==i||r==n)return s;let c=this.children[o],l=e.children[r];if(c!=l)return s+c.scanIdentical(l,t);s+=c.length+1}}static from(e,t=e.reduce((s,o)=>s+o.length+1,-1)){let s=0;for(let f of e)s+=f.lines;if(s<32){let f=[];for(let m of e)m.flatten(f);return new Ve(f,t)}let o=Math.max(32,s>>5),r=o<<1,i=o>>1,n=[],c=0,l=-1,d=[];function p(f){let m;if(f.lines>r&&f instanceof Nt)for(let g of f.children)p(g);else f.lines>i&&(c>i||!c)?(u(),n.push(f)):f instanceof Ve&&c&&(m=d[d.length-1])instanceof Ve&&f.lines+m.lines<=32?(c+=f.lines,l+=f.length+1,d[d.length-1]=new Ve(m.text.concat(f.text),m.length+1+f.length)):(c+f.lines>o&&u(),c+=f.lines,l+=f.length+1,d.push(f))}function u(){c!=0&&(n.push(d.length==1?d[0]:Nt.from(d,l)),l=-1,c=d.length=0)}for(let f of e)p(f);return u(),n.length==1?n[0]:new Nt(n,t)}}Se.empty=new Ve([""],0);function Xm(a){let e=-1;for(let t of a)e+=t.length+1;return e}function Go(a,e,t=0,s=1e9){for(let o=0,r=0,i=!0;r<a.length&&o<=s;r++){let n=a[r],c=o+n.length;c>=t&&(c>s&&(n=n.slice(0,s-o)),o<t&&(n=n.slice(t-o)),i?(e[e.length-1]+=n,i=!1):e.push(n)),o=c+1}return e}function Rc(a,e,t){return Go(a,[""],e,t)}class Ds{constructor(e,t=1){this.dir=t,this.done=!1,this.lineBreak=!1,this.value="",this.nodes=[e],this.offsets=[t>0?1:(e instanceof Ve?e.text.length:e.children.length)<<1]}nextInner(e,t){for(this.done=this.lineBreak=!1;;){let s=this.nodes.length-1,o=this.nodes[s],r=this.offsets[s],i=r>>1,n=o instanceof Ve?o.text.length:o.children.length;if(i==(t>0?n:0)){if(s==0)return this.done=!0,this.value="",this;t>0&&this.offsets[s-1]++,this.nodes.pop(),this.offsets.pop()}else if((r&1)==(t>0?0:1)){if(this.offsets[s]+=t,e==0)return this.lineBreak=!0,this.value=` 40`,this;e--}else if(o instanceof Ve){let c=o.text[i+(t<0?-1:0)];if(this.offsets[s]+=t,c.length>Math.max(0,e))return this.value=e==0?c:t>0?c.slice(e):c.slice(0,c.length-e),this;e-=c.length}else{let c=o.children[i+(t<0?-1:0)];e>c.length?(e-=c.length,this.offsets[s]+=t):(t<0&&this.offsets[s]--,this.nodes.push(c),this.offsets.push(t>0?1:(c instanceof Ve?c.text.length:c.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}}class up{constructor(e,t,s){this.value="",this.done=!1,this.cursor=new Ds(e,t>s?-1:1),this.pos=t>s?e.length:0,this.from=Math.min(t,s),this.to=Math.max(t,s)}nextInner(e,t){if(t<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;e+=Math.max(0,t<0?this.pos-this.to:this.from-this.pos);let s=t<0?this.pos-this.from:this.to-this.pos;e>s&&(e=s),s-=e;let{value:o}=this.cursor.next(e);return this.pos+=(o.length+e)*t,this.value=o.length<=s?o:t<0?o.slice(o.length-s):o.slice(0,s),this.done=!this.value,this}next(e=0){return e<0?e=Math.max(e,this.from-this.pos):e>0&&(e=Math.min(e,this.to-this.pos)),this.nextInner(e,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&this.value!=""}}class hp{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:t,lineBreak:s,value:o}=this.inner.next(e);return t&&this.afterBreak?(this.value="",this.afterBreak=!1):t?(this.done=!0,this.value=""):s?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=o,this.afterBreak=!1),this}get lineBreak(){return!1}}typeof Symbol<"u"&&(Se.prototype[Symbol.iterator]=function(){return this.iter()},Ds.prototype[Symbol.iterator]=up.prototype[Symbol.iterator]=hp.prototype[Symbol.iterator]=function(){return this});class Jm{constructor(e,t,s,o){this.from=e,this.to=t,this.number=s,this.text=o}get length(){return this.to-this.from}}function Xa(a,e,t){return e=Math.max(0,Math.min(a.length,e)),[e,Math.max(e,Math.min(a.length,t))]}function Xe(a,e,t=!0,s=!0){return Gm(a,e,t,s)}function Zm(a){return a>=56320&&a<57344}function Qm(a){return a>=55296&&a<56320}function Ra(a,e){let t=a.charCodeAt(e);if(!Qm(t)||e+1==a.length)return t;let s=a.charCodeAt(e+1);return Zm(s)?(t-55296<<10)+(s-56320)+65536:t}function fp(a){return a<=65535?String.fromCharCode(a):(a-=65536,String.fromCharCode((a>>10)+55296,(a&1023)+56320))}function ho(a){return a<65536?1:2}const Di=/\r\n?|\n/;var Ye=(function(a){return a[a.Simple=0]="Simple",a[a.TrackDel=1]="TrackDel",a[a.TrackBefore=2]="TrackBefore",a[a.TrackAfter=3]="TrackAfter",a})(Ye||(Ye={}));class Rt{constructor(e){this.sections=e}get length(){let e=0;for(let t=0;t<this.sections.length;t+=2)e+=this.sections[t];return e}get newLength(){let e=0;for(let t=0;t<this.sections.length;t+=2){let s=this.sections[t+1];e+=s<0?this.sections[t]:s}return e}get empty(){return this.sections.length==0||this.sections.length==2&&this.sections[1]<0}iterGaps(e){for(let t=0,s=0,o=0;t<this.sections.length;){let r=this.sections[t++],i=this.sections[t++];i<0?(e(s,o,r),o+=r):o+=i,s+=r}}iterChangedRanges(e,t=!1){Ti(this,e,t)}get invertedDesc(){let e=[];for(let t=0;t<this.sections.length;){let s=this.sections[t++],o=this.sections[t++];o<0?e.push(s,o):e.push(o,s)}return new Rt(e)}composeDesc(e){return this.empty?e:e.empty?this:mp(this,e)}mapDesc(e,t=!1){return e.empty?this:Ni(this,e,t)}mapPos(e,t=-1,s=Ye.Simple){let o=0,r=0;for(let i=0;i<this.sections.length;){let n=this.sections[i++],c=this.sections[i++],l=o+n;if(c<0){if(l>e)return r+(e-o);r+=n}else{if(s!=Ye.Simple&&l>=e&&(s==Ye.TrackDel&&o<e&&l>e||s==Ye.TrackBefore&&o<e||s==Ye.TrackAfter&&l>e))return null;if(l>e||l==e&&t<0&&!n)return e==o||t<0?r:r+c;r+=c}o=l}if(e>o)throw new RangeError(`Position ${e} is out of range for changeset of length ${o}`);return r}touchesRange(e,t=e){for(let s=0,o=0;s<this.sections.length&&o<=t;){let r=this.sections[s++],i=this.sections[s++],n=o+r;if(i>=0&&o<=t&&n>=e)return o<e&&n>t?"cover":!0;o=n}return!1}toString(){let e="";for(let t=0;t<this.sections.length;){let s=this.sections[t++],o=this.sections[t++];e+=(e?" ":"")+s+(o>=0?":"+o:"")}return e}toJSON(){return this.sections}static fromJSON(e){if(!Array.isArray(e)||e.length%2||e.some(t=>typeof t!="number"))throw new RangeError("Invalid JSON representation of ChangeDesc");return new Rt(e)}static create(e){return new Rt(e)}}class Ue extends Rt{constructor(e,t){super(e),this.inserted=t}apply(e){if(this.length!=e.length)throw new RangeError("Applying change set to a document with the wrong length");return Ti(this,(t,s,o,r,i)=>e=e.replace(o,o+(s-t),i),!1),e}mapDesc(e,t=!1){return Ni(this,e,t,!0)}invert(e){let t=this.sections.slice(),s=[];for(let o=0,r=0;o<t.length;o+=2){let i=t[o],n=t[o+1];if(n>=0){t[o]=n,t[o+1]=i;let c=o>>1;for(;s.length<c;)s.push(Se.empty);s.push(i?e.slice(r,r+i):Se.empty)}r+=i}return new Ue(t,s)}compose(e){return this.empty?e:e.empty?this:mp(this,e,!0)}map(e,t=!1){return e.empty?this:Ni(this,e,t,!0)}iterChanges(e,t=!1){Ti(this,e,t)}get desc(){return Rt.create(this.sections)}filter(e){let t=[],s=[],o=[],r=new Ws(this);e:for(let i=0,n=0;;){let c=i==e.length?1e9:e[i++];for(;n<c||n==c&&r.len==0;){if(r.done)break e;let d=Math.min(r.len,c-n);Qe(o,d,-1);let p=r.ins==-1?-1:r.off==0?r.ins:0;Qe(t,d,p),p>0&&na(s,t,r.text),r.forward(d),n+=d}let l=e[i++];for(;n<l;){if(r.done)break e;let d=Math.min(r.len,l-n);Qe(t,d,-1),Qe(o,d,r.ins==-1?-1:r.off==0?r.ins:0),r.forward(d),n+=d}}return{changes:new Ue(t,s),filtered:Rt.create(o)}}toJSON(){let e=[];for(let t=0;t<this.sections.length;t+=2){let s=this.sections[t],o=this.sections[t+1];o<0?e.push(s):o==0?e.push([s]):e.push([s].concat(this.inserted[t>>1].toJSON()))}return e}static of(e,t,s){let o=[],r=[],i=0,n=null;function c(d=!1){if(!d&&!o.length)return;i<t&&Qe(o,t-i,-1);let p=new Ue(o,r);n=n?n.compose(p.map(n)):p,o=[],r=[],i=0}function l(d){if(Array.isArray(d))for(let p of d)l(p);else if(d instanceof Ue){if(d.length!=t)throw new RangeError(`Mismatched change set length (got ${d.length}, expected ${t})`);c(),n=n?n.compose(d.map(n)):d}else{let{from:p,to:u=p,insert:f}=d;if(p>u||p<0||u>t)throw new RangeError(`Invalid change range ${p} to ${u} (in doc of length ${t})`);let m=f?typeof f=="string"?Se.of(f.split(s||Di)):f:Se.empty,g=m.length;if(p==u&&g==0)return;p<i&&c(),p>i&&Qe(o,p-i,-1),Qe(o,u-p,g),na(r,o,m),i=u}}return l(e),c(!n),n}static empty(e){return new Ue(e?[e,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw new RangeError("Invalid JSON representation of ChangeSet");let t=[],s=[];for(let o=0;o<e.length;o++){let r=e[o];if(typeof r=="number")t.push(r,-1);else{if(!Array.isArray(r)||typeof r[0]!="number"||r.some((i,n)=>n&&typeof i!="string"))throw new RangeError("Invalid JSON representation of ChangeSet");if(r.length==1)t.push(r[0],0);else{for(;s.length<o;)s.push(Se.empty);s[o]=Se.of(r.slice(1)),t.push(r[0],s[o].length)}}}return new Ue(t,s)}static createSet(e,t){return new Ue(e,t)}}function Qe(a,e,t,s=!1){if(e==0&&t<=0)return;let o=a.length-2;o>=0&&t<=0&&t==a[o+1]?a[o]+=e:o>=0&&e==0&&a[o]==0?a[o+1]+=t:s?(a[o]+=e,a[o+1]+=t):a.push(e,t)}function na(a,e,t){if(t.length==0)return;let s=e.length-2>>1;if(s<a.length)a[a.length-1]=a[a.length-1].append(t);else{for(;a.length<s;)a.push(Se.empty);a.push(t)}}function Ti(a,e,t){let s=a.inserted;for(let o=0,r=0,i=0;i<a.sections.length;){let n=a.sections[i++],c=a.sections[i++];if(c<0)o+=n,r+=n;else{let l=o,d=r,p=Se.empty;for(;l+=n,d+=c,c&&s&&(p=p.append(s[i-2>>1])),!(t||i==a.sections.length||a.sections[i+1]<0);)n=a.sections[i++],c=a.sections[i++];e(o,l,r,d,p),o=l,r=d}}}function Ni(a,e,t,s=!1){let o=[],r=s?[]:null,i=new Ws(a),n=new Ws(e);for(let c=-1;;){if(i.done&&n.len||n.done&&i.len)throw new Error("Mismatched change set lengths");if(i.ins==-1&&n.ins==-1){let l=Math.min(i.len,n.len);Qe(o,l,-1),i.forward(l),n.forward(l)}else if(n.ins>=0&&(i.ins<0||c==i.i||i.off==0&&(n.len<i.len||n.len==i.len&&!t))){let l=n.len;for(Qe(o,n.ins,-1);l;){let d=Math.min(i.len,l);i.ins>=0&&c<i.i&&i.len<=d&&(Qe(o,0,i.ins),r&&na(r,o,i.text),c=i.i),i.forward(d),l-=d}n.next()}else if(i.ins>=0){let l=0,d=i.len;for(;d;)if(n.ins==-1){let p=Math.min(d,n.len);l+=p,d-=p,n.forward(p)}else if(n.ins==0&&n.len<d)d-=n.len,n.next();else break;Qe(o,l,c<i.i?i.ins:0),r&&c<i.i&&na(r,o,i.text),c=i.i,i.forward(i.len-d)}else{if(i.done&&n.done)return r?Ue.createSet(o,r):Rt.create(o);throw new Error("Mismatched change set lengths")}}}function mp(a,e,t=!1){let s=[],o=t?[]:null,r=new Ws(a),i=new Ws(e);for(let n=!1;;){if(r.done&&i.done)return o?Ue.createSet(s,o):Rt.create(s);if(r.ins==0)Qe(s,r.len,0,n),r.next();else if(i.len==0&&!i.done)Qe(s,0,i.ins,n),o&&na(o,s,i.text),i.next();else{if(r.done||i.done)throw new Error("Mismatched change set lengths");{let c=Math.min(r.len2,i.len),l=s.length;if(r.ins==-1){let d=i.ins==-1?-1:i.off?0:i.ins;Qe(s,c,d,n),o&&d&&na(o,s,i.text)}else i.ins==-1?(Qe(s,r.off?0:r.len,c,n),o&&na(o,s,r.textBit(c))):(Qe(s,r.off?0:r.len,i.off?0:i.ins,n),o&&!i.off&&na(o,s,i.text));n=(r.ins>c||i.ins>=0&&i.len>c)&&(n||s.length>l),r.forward2(c),i.forward(c)}}}}class Ws{constructor(e){this.set=e,this.i=0,this.next()}next(){let{sections:e}=this.set;this.i<e.length?(this.len=e[this.i++],this.ins=e[this.i++]):(this.len=0,this.ins=-2),this.off=0}get done(){return this.ins==-2}get len2(){return this.ins<0?this.len:this.ins}get text(){let{inserted:e}=this.set,t=this.i-2>>1;return t>=e.length?Se.empty:e[t]}textBit(e){let{inserted:t}=this.set,s=this.i-2>>1;return s>=t.length&&!e?Se.empty:t[s].slice(this.off,e==null?void 0:this.off+e)}forward(e){e==this.len?this.next():(this.len-=e,this.off+=e)}forward2(e){this.ins==-1?this.forward(e):e==this.ins?this.next():(this.ins-=e,this.off+=e)}}class Pa{constructor(e,t,s){this.from=e,this.to=t,this.flags=s}get anchor(){return this.flags&32?this.to:this.from}get head(){return this.flags&32?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return this.flags&8?-1:this.flags&16?1:0}get bidiLevel(){let e=this.flags&7;return e==7?null:e}get goalColumn(){let e=this.flags>>6;return e==16777215?void 0:e}map(e,t=-1){let s,o;return this.empty?s=o=e.mapPos(this.from,t):(s=e.mapPos(this.from,1),o=e.mapPos(this.to,-1)),s==this.from&&o==this.to?this:new Pa(s,o,this.flags)}extend(e,t=e){if(e<=this.anchor&&t>=this.anchor)return ae.range(e,t);let s=Math.abs(e-this.anchor)>Math.abs(t-this.anchor)?e:t;return ae.range(this.anchor,s)}eq(e,t=!1){return this.anchor==e.anchor&&this.head==e.head&&(!t||!this.empty||this.assoc==e.assoc)}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(e){if(!e||typeof e.anchor!="number"||typeof e.head!="number")throw new RangeError("Invalid JSON representation for SelectionRange");return ae.range(e.anchor,e.head)}static create(e,t,s){return new Pa(e,t,s)}}class ae{constructor(e,t){this.ranges=e,this.mainIndex=t}map(e,t=-1){return e.empty?this:ae.create(this.ranges.map(s=>s.map(e,t)),this.mainIndex)}eq(e,t=!1){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let s=0;s<this.ranges.length;s++)if(!this.ranges[s].eq(e.ranges[s],t))return!1;return!0}get main(){return this.ranges[this.mainIndex]}asSingle(){return this.ranges.length==1?this:new ae([this.main],0)}addRange(e,t=!0){return ae.create([e].concat(this.ranges),t?0:this.mainIndex+1)}replaceRange(e,t=this.mainIndex){let s=this.ranges.slice();return s[t]=e,ae.create(s,this.mainIndex)}toJSON(){return{ranges:this.ranges.map(e=>e.toJSON()),main:this.mainIndex}}static fromJSON(e){if(!e||!Array.isArray(e.ranges)||typeof e.main!="number"||e.main>=e.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new ae(e.ranges.map(t=>Pa.fromJSON(t)),e.main)}static single(e,t=e){return new ae([ae.range(e,t)],0)}static create(e,t=0){if(e.length==0)throw new RangeError("A selection needs at least one range");for(let s=0,o=0;o<e.length;o++){let r=e[o];if(r.empty?r.from<=s:r.from<s)return ae.normalized(e.slice(),t);s=r.to}return new ae(e,t)}static cursor(e,t=0,s,o){return Pa.create(e,e,(t==0?0:t<0?8:16)|(s==null?7:Math.min(6,s))|(o??16777215)<<6)}static range(e,t,s,o){let r=(s??16777215)<<6|(o==null?7:Math.min(6,o));return t<e?Pa.create(t,e,48|r):Pa.create(e,t,(t>e?8:0)|r)}static normalized(e,t=0){let s=e[t];e.sort((o,r)=>o.from-r.from),t=e.indexOf(s);for(let o=1;o<e.length;o++){let r=e[o],i=e[o-1];if(r.empty?r.from<=i.to:r.from<i.to){let n=i.from,c=Math.max(r.to,i.to);o<=t&&t--,e.splice(--o,2,r.anchor>r.head?ae.range(c,n):ae.range(n,c))}}return new ae(e,t)}}function gp(a,e){for(let t of a.ranges)if(t.to>e)throw new RangeError("Selection points outside of document")}let In=0;class fe{constructor(e,t,s,o,r){this.combine=e,this.compareInput=t,this.compare=s,this.isStatic=o,this.id=In++,this.default=e([]),this.extensions=typeof r=="function"?r(this):r}get reader(){return this}static define(e={}){return new fe(e.combine||(t=>t),e.compareInput||((t,s)=>t===s),e.compare||(e.combine?(t,s)=>t===s:On),!!e.static,e.enables)}of(e){return new Yo([],this,0,e)}compute(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new Yo(e,this,1,t)}computeN(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new Yo(e,this,2,t)}from(e,t){return t||(t=s=>s),this.compute([e],s=>t(s.field(e)))}}function On(a,e){return a==e||a.length==e.length&&a.every((t,s)=>t===e[s])}class Yo{constructor(e,t,s,o){this.dependencies=e,this.facet=t,this.type=s,this.value=o,this.id=In++}dynamicSlot(e){var t;let s=this.value,o=this.facet.compareInput,r=this.id,i=e[r]>>1,n=this.type==2,c=!1,l=!1,d=[];for(let p of this.dependencies)p=="doc"?c=!0:p=="selection"?l=!0:(((t=e[p.id])!==null&&t!==void 0?t:1)&1)==0&&d.push(e[p.id]);return{create(p){return p.values[i]=s(p),1},update(p,u){if(c&&u.docChanged||l&&(u.docChanged||u.selection)||Li(p,d)){let f=s(p);if(n?!Bc(f,p.values[i],o):!o(f,p.values[i]))return p.values[i]=f,1}return 0},reconfigure:(p,u)=>{let f,m=u.config.address[r];if(m!=null){let g=dr(u,m);if(this.dependencies.every(x=>x instanceof fe?u.facet(x)===p.facet(x):x instanceof st?u.field(x,!1)==p.field(x,!1):!0)||(n?Bc(f=s(p),g,o):o(f=s(p),g)))return p.values[i]=g,0}else f=s(p);return p.values[i]=f,1}}}}function Bc(a,e,t){if(a.length!=e.length)return!1;for(let s=0;s<a.length;s++)if(!t(a[s],e[s]))return!1;return!0}function Li(a,e){let t=!1;for(let s of e)Ts(a,s)&1&&(t=!0);return t}function eg(a,e,t){let s=t.map(c=>a[c.id]),o=t.map(c=>c.type),r=s.filter(c=>!(c&1)),i=a[e.id]>>1;function n(c){let l=[];for(let d=0;d<s.length;d++){let p=dr(c,s[d]);if(o[d]==2)for(let u of p)l.push(u);else l.push(p)}return e.combine(l)}return{create(c){for(let l of s)Ts(c,l);return c.values[i]=n(c),1},update(c,l){if(!Li(c,r))return 0;let d=n(c);return e.compare(d,c.values[i])?0:(c.values[i]=d,1)},reconfigure(c,l){let d=Li(c,s),p=l.config.facets[e.id],u=l.facet(e);if(p&&!d&&On(t,p))return c.values[i]=u,0;let f=n(c);return e.compare(f,u)?(c.values[i]=u,0):(c.values[i]=f,1)}}}const So=fe.define({static:!0});class st{constructor(e,t,s,o,r){this.id=e,this.createF=t,this.updateF=s,this.compareF=o,this.spec=r,this.provides=void 0}static define(e){let t=new st(In++,e.create,e.update,e.compare||((s,o)=>s===o),e);return e.provide&&(t.provides=e.provide(t)),t}create(e){let t=e.facet(So).find(s=>s.field==this);return(t?.create||this.createF)(e)}slot(e){let t=e[this.id]>>1;return{create:s=>(s.values[t]=this.create(s),1),update:(s,o)=>{let r=s.values[t],i=this.updateF(r,o);return this.compareF(r,i)?0:(s.values[t]=i,1)},reconfigure:(s,o)=>{let r=s.facet(So),i=o.facet(So),n;return(n=r.find(c=>c.field==this))&&n!=i.find(c=>c.field==this)?(s.values[t]=n.create(s),1):o.config.address[this.id]!=null?(s.values[t]=o.field(this),0):(s.values[t]=this.create(s),1)}}}init(e){return[this,So.of({field:this,create:e})]}get extension(){return this}}const Sa={lowest:4,low:3,default:2,high:1,highest:0};function ms(a){return e=>new xp(e,a)}const is={highest:ms(Sa.highest),high:ms(Sa.high),default:ms(Sa.default),low:ms(Sa.low),lowest:ms(Sa.lowest)};class xp{constructor(e,t){this.inner=e,this.prec=t}}class ns{of(e){return new Ii(this,e)}reconfigure(e){return ns.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class Ii{constructor(e,t){this.compartment=e,this.inner=t}}class lr{constructor(e,t,s,o,r,i){for(this.base=e,this.compartments=t,this.dynamicSlots=s,this.address=o,this.staticValues=r,this.facets=i,this.statusTemplate=[];this.statusTemplate.length<s.length;)this.statusTemplate.push(0)}staticFacet(e){let t=this.address[e.id];return t==null?e.default:this.staticValues[t>>1]}static resolve(e,t,s){let o=[],r=Object.create(null),i=new Map;for(let u of tg(e,t,i))u instanceof st?o.push(u):(r[u.facet.id]||(r[u.facet.id]=[])).push(u);let n=Object.create(null),c=[],l=[];for(let u of o)n[u.id]=l.length<<1,l.push(f=>u.slot(f));let d=s?.config.facets;for(let u in r){let f=r[u],m=f[0].facet,g=d&&d[u]||[];if(f.every(x=>x.type==0))if(n[m.id]=c.length<<1|1,On(g,f))c.push(s.facet(m));else{let x=m.combine(f.map(b=>b.value));c.push(s&&m.compare(x,s.facet(m))?s.facet(m):x)}else{for(let x of f)x.type==0?(n[x.id]=c.length<<1|1,c.push(x.value)):(n[x.id]=l.length<<1,l.push(b=>x.dynamicSlot(b)));n[m.id]=l.length<<1,l.push(x=>eg(x,m,f))}}let p=l.map(u=>u(n));return new lr(e,i,p,n,c,r)}}function tg(a,e,t){let s=[[],[],[],[],[]],o=new Map;function r(i,n){let c=o.get(i);if(c!=null){if(c<=n)return;let l=s[c].indexOf(i);l>-1&&s[c].splice(l,1),i instanceof Ii&&t.delete(i.compartment)}if(o.set(i,n),Array.isArray(i))for(let l of i)r(l,n);else if(i instanceof Ii){if(t.has(i.compartment))throw new RangeError("Duplicate use of compartment in extensions");let l=e.get(i.compartment)||i.inner;t.set(i.compartment,l),r(l,n)}else if(i instanceof xp)r(i.inner,i.prec);else if(i instanceof st)s[n].push(i),i.provides&&r(i.provides,n);else if(i instanceof Yo)s[n].push(i),i.facet.extensions&&r(i.facet.extensions,Sa.default);else{let l=i.extension;if(!l)throw new Error(`Unrecognized extension value in extension set (${i}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);r(l,n)}}return r(a,Sa.default),s.reduce((i,n)=>i.concat(n))}function Ts(a,e){if(e&1)return 2;let t=e>>1,s=a.status[t];if(s==4)throw new Error("Cyclic dependency between fields and/or facets");if(s&2)return s;a.status[t]=4;let o=a.computeSlot(a,a.config.dynamicSlots[t]);return a.status[t]=2|o}function dr(a,e){return e&1?a.config.staticValues[e>>1]:a.values[e>>1]}const bp=fe.define(),Oi=fe.define({combine:a=>a.some(e=>e),static:!0}),vp=fe.define({combine:a=>a.length?a[0]:void 0,static:!0}),jp=fe.define(),wp=fe.define(),yp=fe.define(),kp=fe.define({combine:a=>a.length?a[0]:!1});class Zt{constructor(e,t){this.type=e,this.value=t}static define(){return new ag}}class ag{of(e){return new Zt(this,e)}}class sg{constructor(e){this.map=e}of(e){return new we(this,e)}}class we{constructor(e,t){this.type=e,this.value=t}map(e){let t=this.type.map(this.value,e);return t===void 0?void 0:t==this.value?this:new we(this.type,t)}is(e){return this.type==e}static define(e={}){return new sg(e.map||(t=>t))}static mapEffects(e,t){if(!e.length)return e;let s=[];for(let o of e){let r=o.map(t);r&&s.push(r)}return s}}we.reconfigure=we.define();we.appendConfig=we.define();class $e{constructor(e,t,s,o,r,i){this.startState=e,this.changes=t,this.selection=s,this.effects=o,this.annotations=r,this.scrollIntoView=i,this._doc=null,this._state=null,s&&gp(s,t.newLength),r.some(n=>n.type==$e.time)||(this.annotations=r.concat($e.time.of(Date.now())))}static create(e,t,s,o,r,i){return new $e(e,t,s,o,r,i)}get newDoc(){return this._doc||(this._doc=this.changes.apply(this.startState.doc))}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){return this._state||this.startState.applyTransaction(this),this._state}annotation(e){for(let t of this.annotations)if(t.type==e)return t.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(e){let t=this.annotation($e.userEvent);return!!(t&&(t==e||t.length>e.length&&t.slice(0,e.length)==e&&t[e.length]=="."))}}$e.time=Zt.define();$e.userEvent=Zt.define();$e.addToHistory=Zt.define();$e.remote=Zt.define();function og(a,e){let t=[];for(let s=0,o=0;;){let r,i;if(s<a.length&&(o==e.length||e[o]>=a[s]))r=a[s++],i=a[s++];else if(o<e.length)r=e[o++],i=e[o++];else return t;!t.length||t[t.length-1]<r?t.push(r,i):t[t.length-1]<i&&(t[t.length-1]=i)}}function Cp(a,e,t){var s;let o,r,i;return t?(o=e.changes,r=Ue.empty(e.changes.length),i=a.changes.compose(e.changes)):(o=e.changes.map(a.changes),r=a.changes.mapDesc(e.changes,!0),i=a.changes.compose(o)),{changes:i,selection:e.selection?e.selection.map(r):(s=a.selection)===null||s===void 0?void 0:s.map(o),effects:we.mapEffects(a.effects,o).concat(we.mapEffects(e.effects,r)),annotations:a.annotations.length?a.annotations.concat(e.annotations):e.annotations,scrollIntoView:a.scrollIntoView||e.scrollIntoView}}function Fi(a,e,t){let s=e.selection,o=Ua(e.annotations);return e.userEvent&&(o=o.concat($e.userEvent.of(e.userEvent))),{changes:e.changes instanceof Ue?e.changes:Ue.of(e.changes||[],t,a.facet(vp)),selection:s&&(s instanceof ae?s:ae.single(s.anchor,s.head)),effects:Ua(e.effects),annotations:o,scrollIntoView:!!e.scrollIntoView}}function Sp(a,e,t){let s=Fi(a,e.length?e[0]:{},a.doc.length);e.length&&e[0].filter===!1&&(t=!1);for(let r=1;r<e.length;r++){e[r].filter===!1&&(t=!1);let i=!!e[r].sequential;s=Cp(s,Fi(a,e[r],i?s.changes.newLength:a.doc.length),i)}let o=$e.create(a,s.changes,s.selection,s.effects,s.annotations,s.scrollIntoView);return ig(t?rg(o):o)}function rg(a){let e=a.startState,t=!0;for(let o of e.facet(jp)){let r=o(a);if(r===!1){t=!1;break}Array.isArray(r)&&(t=t===!0?r:og(t,r))}if(t!==!0){let o,r;if(t===!1)r=a.changes.invertedDesc,o=Ue.empty(e.doc.length);else{let i=a.changes.filter(t);o=i.changes,r=i.filtered.mapDesc(i.changes).invertedDesc}a=$e.create(e,o,a.selection&&a.selection.map(r),we.mapEffects(a.effects,r),a.annotations,a.scrollIntoView)}let s=e.facet(wp);for(let o=s.length-1;o>=0;o--){let r=s[o](a);r instanceof $e?a=r:Array.isArray(r)&&r.length==1&&r[0]instanceof $e?a=r[0]:a=Sp(e,Ua(r),!1)}return a}function ig(a){let e=a.startState,t=e.facet(yp),s=a;for(let o=t.length-1;o>=0;o--){let r=t[o](a);r&&Object.keys(r).length&&(s=Cp(s,Fi(e,r,a.changes.newLength),!0))}return s==a?a:$e.create(e,a.changes,a.selection,s.effects,s.annotations,s.scrollIntoView)}const ng=[];function Ua(a){return a==null?ng:Array.isArray(a)?a:[a]}var Fe=(function(a){return a[a.Word=0]="Word",a[a.Space=1]="Space",a[a.Other=2]="Other",a})(Fe||(Fe={}));const cg=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let Ri;try{Ri=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function lg(a){if(Ri)return Ri.test(a);for(let e=0;e<a.length;e++){let t=a[e];if(/\w/.test(t)||t>"Â"&&(t.toUpperCase()!=t.toLowerCase()||cg.test(t)))return!0}return!1}function dg(a){return e=>{if(!/\S/.test(e))return Fe.Space;if(lg(e))return Fe.Word;for(let t=0;t<a.length;t++)if(e.indexOf(a[t])>-1)return Fe.Word;return Fe.Other}}class _e{constructor(e,t,s,o,r,i){this.config=e,this.doc=t,this.selection=s,this.values=o,this.status=e.statusTemplate.slice(),this.computeSlot=r,i&&(i._state=this);for(let n=0;n<this.config.dynamicSlots.length;n++)Ts(this,n<<1);this.computeSlot=null}field(e,t=!0){let s=this.config.address[e.id];if(s==null){if(t)throw new RangeError("Field is not present in this state");return}return Ts(this,s),dr(this,s)}update(...e){return Sp(this,e,!0)}applyTransaction(e){let t=this.config,{base:s,compartments:o}=t;for(let n of e.effects)n.is(ns.reconfigure)?(t&&(o=new Map,t.compartments.forEach((c,l)=>o.set(l,c)),t=null),o.set(n.value.compartment,n.value.extension)):n.is(we.reconfigure)?(t=null,s=n.value):n.is(we.appendConfig)&&(t=null,s=Ua(s).concat(n.value));let r;t?r=e.startState.values.slice():(t=lr.resolve(s,o,this),r=new _e(t,this.doc,this.selection,t.dynamicSlots.map(()=>null),(c,l)=>l.reconfigure(c,this),null).values);let i=e.startState.facet(Oi)?e.newSelection:e.newSelection.asSingle();new _e(t,e.newDoc,i,r,(n,c)=>c.update(n,e),e)}replaceSelection(e){return typeof e=="string"&&(e=this.toText(e)),this.changeByRange(t=>({changes:{from:t.from,to:t.to,insert:e},range:ae.cursor(t.from+e.length)}))}changeByRange(e){let t=this.selection,s=e(t.ranges[0]),o=this.changes(s.changes),r=[s.range],i=Ua(s.effects);for(let n=1;n<t.ranges.length;n++){let c=e(t.ranges[n]),l=this.changes(c.changes),d=l.map(o);for(let u=0;u<n;u++)r[u]=r[u].map(d);let p=o.mapDesc(l,!0);r.push(c.range.map(p)),o=o.compose(d),i=we.mapEffects(i,d).concat(we.mapEffects(Ua(c.effects),p))}return{changes:o,selection:ae.create(r,t.mainIndex),effects:i}}changes(e=[]){return e instanceof Ue?e:Ue.of(e,this.doc.length,this.facet(_e.lineSeparator))}toText(e){return Se.of(e.split(this.facet(_e.lineSeparator)||Di))}sliceDoc(e=0,t=this.doc.length){return this.doc.sliceString(e,t,this.lineBreak)}facet(e){let t=this.config.address[e.id];return t==null?e.default:(Ts(this,t),dr(this,t))}toJSON(e){let t={doc:this.sliceDoc(),selection:this.selection.toJSON()};if(e)for(let s in e){let o=e[s];o instanceof st&&this.config.address[o.id]!=null&&(t[s]=o.spec.toJSON(this.field(e[s]),this))}return t}static fromJSON(e,t={},s){if(!e||typeof e.doc!="string")throw new RangeError("Invalid JSON representation for EditorState");let o=[];if(s){for(let r in s)if(Object.prototype.hasOwnProperty.call(e,r)){let i=s[r],n=e[r];o.push(i.init(c=>i.spec.fromJSON(n,c)))}}return _e.create({doc:e.doc,selection:ae.fromJSON(e.selection),extensions:t.extensions?o.concat([t.extensions]):o})}static create(e={}){let t=lr.resolve(e.extensions||[],new Map),s=e.doc instanceof Se?e.doc:Se.of((e.doc||"").split(t.staticFacet(_e.lineSeparator)||Di)),o=e.selection?e.selection instanceof ae?e.selection:ae.single(e.selection.anchor,e.selection.head):ae.single(0);return gp(o,s.length),t.staticFacet(Oi)||(o=o.asSingle()),new _e(t,s,o,t.dynamicSlots.map(()=>null),(r,i)=>i.create(r),null)}get tabSize(){return this.facet(_e.tabSize)}get lineBreak(){return this.facet(_e.lineSeparator)||` 41`}get readOnly(){return this.facet(kp)}phrase(e,...t){for(let s of this.facet(_e.phrases))if(Object.prototype.hasOwnProperty.call(s,e)){e=s[e];break}return t.length&&(e=e.replace(/\$(\$|\d*)/g,(s,o)=>{if(o=="$")return"$";let r=+(o||1);return!r||r>t.length?s:t[r-1]})),e}languageDataAt(e,t,s=-1){let o=[];for(let r of this.facet(bp))for(let i of r(this,t,s))Object.prototype.hasOwnProperty.call(i,e)&&o.push(i[e]);return o}charCategorizer(e){return dg(this.languageDataAt("wordChars",e).join(""))}wordAt(e){let{text:t,from:s,length:o}=this.doc.lineAt(e),r=this.charCategorizer(e),i=e-s,n=e-s;for(;i>0;){let c=Xe(t,i,!1);if(r(t.slice(c,i))!=Fe.Word)break;i=c}for(;n<o;){let c=Xe(t,n);if(r(t.slice(n,c))!=Fe.Word)break;n=c}return i==n?null:ae.range(i+s,n+s)}}_e.allowMultipleSelections=Oi;_e.tabSize=fe.define({combine:a=>a.length?a[0]:4});_e.lineSeparator=vp;_e.readOnly=kp;_e.phrases=fe.define({compare(a,e){let t=Object.keys(a),s=Object.keys(e);return t.length==s.length&&t.every(o=>a[o]==e[o])}});_e.languageData=bp;_e.changeFilter=jp;_e.transactionFilter=wp;_e.transactionExtender=yp;ns.reconfigure=we.define();function va(a,e,t={}){let s={};for(let o of a)for(let r of Object.keys(o)){let i=o[r],n=s[r];if(n===void 0)s[r]=i;else if(!(n===i||i===void 0))if(Object.hasOwnProperty.call(t,r))s[r]=t[r](n,i);else throw new Error("Config merge conflict for field "+r)}for(let o in e)s[o]===void 0&&(s[o]=e[o]);return s}class Ta{eq(e){return this==e}range(e,t=e){return Hs.create(e,t,this)}}Ta.prototype.startSide=Ta.prototype.endSide=0;Ta.prototype.point=!1;Ta.prototype.mapMode=Ye.TrackDel;class Hs{constructor(e,t,s){this.from=e,this.to=t,this.value=s}static create(e,t,s){return new Hs(e,t,s)}}function Bi(a,e){return a.from-e.from||a.value.startSide-e.value.startSide}class Fn{constructor(e,t,s,o){this.from=e,this.to=t,this.value=s,this.maxPoint=o}get length(){return this.to[this.to.length-1]}findIndex(e,t,s,o=0){let r=s?this.to:this.from;for(let i=o,n=r.length;;){if(i==n)return i;let c=i+n>>1,l=r[c]-e||(s?this.value[c].endSide:this.value[c].startSide)-t;if(c==i)return l>=0?i:n;l>=0?n=c:i=c+1}}between(e,t,s,o){for(let r=this.findIndex(t,-1e9,!0),i=this.findIndex(s,1e9,!1,r);r<i;r++)if(o(this.from[r]+e,this.to[r]+e,this.value[r])===!1)return!1}map(e,t){let s=[],o=[],r=[],i=-1,n=-1;for(let c=0;c<this.value.length;c++){let l=this.value[c],d=this.from[c]+e,p=this.to[c]+e,u,f;if(d==p){let m=t.mapPos(d,l.startSide,l.mapMode);if(m==null||(u=f=m,l.startSide!=l.endSide&&(f=t.mapPos(d,l.endSide),f<u)))continue}else if(u=t.mapPos(d,l.startSide),f=t.mapPos(p,l.endSide),u>f||u==f&&l.startSide>0&&l.endSide<=0)continue;(f-u||l.endSide-l.startSide)<0||(i<0&&(i=u),l.point&&(n=Math.max(n,f-u)),s.push(l),o.push(u-i),r.push(f-i))}return{mapped:s.length?new Fn(o,r,s,n):null,pos:i}}}class Pe{constructor(e,t,s,o){this.chunkPos=e,this.chunk=t,this.nextLayer=s,this.maxPoint=o}static create(e,t,s,o){return new Pe(e,t,s,o)}get length(){let e=this.chunk.length-1;return e<0?0:Math.max(this.chunkEnd(e),this.nextLayer.length)}get size(){if(this.isEmpty)return 0;let e=this.nextLayer.size;for(let t of this.chunk)e+=t.value.length;return e}chunkEnd(e){return this.chunkPos[e]+this.chunk[e].length}update(e){let{add:t=[],sort:s=!1,filterFrom:o=0,filterTo:r=this.length}=e,i=e.filter;if(t.length==0&&!i)return this;if(s&&(t=t.slice().sort(Bi)),this.isEmpty)return t.length?Pe.of(t):this;let n=new _p(this,null,-1).goto(0),c=0,l=[],d=new ua;for(;n.value||c<t.length;)if(c<t.length&&(n.from-t[c].from||n.startSide-t[c].value.startSide)>=0){let p=t[c++];d.addInner(p.from,p.to,p.value)||l.push(p)}else n.rangeIndex==1&&n.chunkIndex<this.chunk.length&&(c==t.length||this.chunkEnd(n.chunkIndex)<t[c].from)&&(!i||o>this.chunkEnd(n.chunkIndex)||r<this.chunkPos[n.chunkIndex])&&d.addChunk(this.chunkPos[n.chunkIndex],this.chunk[n.chunkIndex])?n.nextChunk():((!i||o>n.to||r<n.from||i(n.from,n.to,n.value))&&(d.addInner(n.from,n.to,n.value)||l.push(Hs.create(n.from,n.to,n.value))),n.next());return d.finishInner(this.nextLayer.isEmpty&&!l.length?Pe.empty:this.nextLayer.update({add:l,filter:i,filterFrom:o,filterTo:r}))}map(e){if(e.empty||this.isEmpty)return this;let t=[],s=[],o=-1;for(let i=0;i<this.chunk.length;i++){let n=this.chunkPos[i],c=this.chunk[i],l=e.touchesRange(n,n+c.length);if(l===!1)o=Math.max(o,c.maxPoint),t.push(c),s.push(e.mapPos(n));else if(l===!0){let{mapped:d,pos:p}=c.map(n,e);d&&(o=Math.max(o,d.maxPoint),t.push(d),s.push(p))}}let r=this.nextLayer.map(e);return t.length==0?r:new Pe(s,t,r||Pe.empty,o)}between(e,t,s){if(!this.isEmpty){for(let o=0;o<this.chunk.length;o++){let r=this.chunkPos[o],i=this.chunk[o];if(t>=r&&e<=r+i.length&&i.between(r,e-r,t-r,s)===!1)return}this.nextLayer.between(e,t,s)}}iter(e=0){return $s.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,t=0){return $s.from(e).goto(t)}static compare(e,t,s,o,r=-1){let i=e.filter(p=>p.maxPoint>0||!p.isEmpty&&p.maxPoint>=r),n=t.filter(p=>p.maxPoint>0||!p.isEmpty&&p.maxPoint>=r),c=zc(i,n,s),l=new gs(i,c,r),d=new gs(n,c,r);s.iterGaps((p,u,f)=>Vc(l,p,d,u,f,o)),s.empty&&s.length==0&&Vc(l,0,d,0,0,o)}static eq(e,t,s=0,o){o==null&&(o=999999999);let r=e.filter(d=>!d.isEmpty&&t.indexOf(d)<0),i=t.filter(d=>!d.isEmpty&&e.indexOf(d)<0);if(r.length!=i.length)return!1;if(!r.length)return!0;let n=zc(r,i),c=new gs(r,n,0).goto(s),l=new gs(i,n,0).goto(s);for(;;){if(c.to!=l.to||!zi(c.active,l.active)||c.point&&(!l.point||!c.point.eq(l.point)))return!1;if(c.to>o)return!0;c.next(),l.next()}}static spans(e,t,s,o,r=-1){let i=new gs(e,null,r).goto(t),n=t,c=i.openStart;for(;;){let l=Math.min(i.to,s);if(i.point){let d=i.activeForPoint(i.to),p=i.pointFrom<t?d.length+1:i.point.startSide<0?d.length:Math.min(d.length,c);o.point(n,l,i.point,d,p,i.pointRank),c=Math.min(i.openEnd(l),d.length)}else l>n&&(o.span(n,l,i.active,c),c=i.openEnd(l));if(i.to>s)return c+(i.point&&i.to>s?1:0);n=i.to,i.next()}}static of(e,t=!1){let s=new ua;for(let o of e instanceof Hs?[e]:t?pg(e):e)s.add(o.from,o.to,o.value);return s.finish()}static join(e){if(!e.length)return Pe.empty;let t=e[e.length-1];for(let s=e.length-2;s>=0;s--)for(let o=e[s];o!=Pe.empty;o=o.nextLayer)t=new Pe(o.chunkPos,o.chunk,t,Math.max(o.maxPoint,t.maxPoint));return t}}Pe.empty=new Pe([],[],null,-1);function pg(a){if(a.length>1)for(let e=a[0],t=1;t<a.length;t++){let s=a[t];if(Bi(e,s)>0)return a.slice().sort(Bi);e=s}return a}Pe.empty.nextLayer=Pe.empty;class ua{finishChunk(e){this.chunks.push(new Fn(this.from,this.to,this.value,this.maxPoint)),this.chunkPos.push(this.chunkStart),this.chunkStart=-1,this.setMaxPoint=Math.max(this.setMaxPoint,this.maxPoint),this.maxPoint=-1,e&&(this.from=[],this.to=[],this.value=[])}constructor(){this.chunks=[],this.chunkPos=[],this.chunkStart=-1,this.last=null,this.lastFrom=-1e9,this.lastTo=-1e9,this.from=[],this.to=[],this.value=[],this.maxPoint=-1,this.setMaxPoint=-1,this.nextLayer=null}add(e,t,s){this.addInner(e,t,s)||(this.nextLayer||(this.nextLayer=new ua)).add(e,t,s)}addInner(e,t,s){let o=e-this.lastTo||s.startSide-this.last.endSide;if(o<=0&&(e-this.lastFrom||s.startSide-this.last.startSide)<0)throw new Error("Ranges must be added sorted by `from` position and `startSide`");return o<0?!1:(this.from.length==250&&this.finishChunk(!0),this.chunkStart<0&&(this.chunkStart=e),this.from.push(e-this.chunkStart),this.to.push(t-this.chunkStart),this.last=s,this.lastFrom=e,this.lastTo=t,this.value.push(s),s.point&&(this.maxPoint=Math.max(this.maxPoint,t-e)),!0)}addChunk(e,t){if((e-this.lastTo||t.value[0].startSide-this.last.endSide)<0)return!1;this.from.length&&this.finishChunk(!0),this.setMaxPoint=Math.max(this.setMaxPoint,t.maxPoint),this.chunks.push(t),this.chunkPos.push(e);let s=t.value.length-1;return this.last=t.value[s],this.lastFrom=t.from[s]+e,this.lastTo=t.to[s]+e,!0}finish(){return this.finishInner(Pe.empty)}finishInner(e){if(this.from.length&&this.finishChunk(!1),this.chunks.length==0)return e;let t=Pe.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(e):e,this.setMaxPoint);return this.from=null,t}}function zc(a,e,t){let s=new Map;for(let r of a)for(let i=0;i<r.chunk.length;i++)r.chunk[i].maxPoint<=0&&s.set(r.chunk[i],r.chunkPos[i]);let o=new Set;for(let r of e)for(let i=0;i<r.chunk.length;i++){let n=s.get(r.chunk[i]);n!=null&&(t?t.mapPos(n):n)==r.chunkPos[i]&&!t?.touchesRange(n,n+r.chunk[i].length)&&o.add(r.chunk[i])}return o}class _p{constructor(e,t,s,o=0){this.layer=e,this.skip=t,this.minPoint=s,this.rank=o}get startSide(){return this.value?this.value.startSide:0}get endSide(){return this.value?this.value.endSide:0}goto(e,t=-1e9){return this.chunkIndex=this.rangeIndex=0,this.gotoInner(e,t,!1),this}gotoInner(e,t,s){for(;this.chunkIndex<this.layer.chunk.length;){let o=this.layer.chunk[this.chunkIndex];if(!(this.skip&&this.skip.has(o)||this.layer.chunkEnd(this.chunkIndex)<e||o.maxPoint<this.minPoint))break;this.chunkIndex++,s=!1}if(this.chunkIndex<this.layer.chunk.length){let o=this.layer.chunk[this.chunkIndex].findIndex(e-this.layer.chunkPos[this.chunkIndex],t,!0);(!s||this.rangeIndex<o)&&this.setRangeIndex(o)}this.next()}forward(e,t){(this.to-e||this.endSide-t)<0&&this.gotoInner(e,t,!0)}next(){for(;;)if(this.chunkIndex==this.layer.chunk.length){this.from=this.to=1e9,this.value=null;break}else{let e=this.layer.chunkPos[this.chunkIndex],t=this.layer.chunk[this.chunkIndex],s=e+t.from[this.rangeIndex];if(this.from=s,this.to=e+t.to[this.rangeIndex],this.value=t.value[this.rangeIndex],this.setRangeIndex(this.rangeIndex+1),this.minPoint<0||this.value.point&&this.to-this.from>=this.minPoint)break}}setRangeIndex(e){if(e==this.layer.chunk[this.chunkIndex].value.length){if(this.chunkIndex++,this.skip)for(;this.chunkIndex<this.layer.chunk.length&&this.skip.has(this.layer.chunk[this.chunkIndex]);)this.chunkIndex++;this.rangeIndex=0}else this.rangeIndex=e}nextChunk(){this.chunkIndex++,this.rangeIndex=0,this.next()}compare(e){return this.from-e.from||this.startSide-e.startSide||this.rank-e.rank||this.to-e.to||this.endSide-e.endSide}}class $s{constructor(e){this.heap=e}static from(e,t=null,s=-1){let o=[];for(let r=0;r<e.length;r++)for(let i=e[r];!i.isEmpty;i=i.nextLayer)i.maxPoint>=s&&o.push(new _p(i,t,s,r));return o.length==1?o[0]:new $s(o)}get startSide(){return this.value?this.value.startSide:0}goto(e,t=-1e9){for(let s of this.heap)s.goto(e,t);for(let s=this.heap.length>>1;s>=0;s--)Zr(this.heap,s);return this.next(),this}forward(e,t){for(let s of this.heap)s.forward(e,t);for(let s=this.heap.length>>1;s>=0;s--)Zr(this.heap,s);(this.to-e||this.value.endSide-t)<0&&this.next()}next(){if(this.heap.length==0)this.from=this.to=1e9,this.value=null,this.rank=-1;else{let e=this.heap[0];this.from=e.from,this.to=e.to,this.value=e.value,this.rank=e.rank,e.value&&e.next(),Zr(this.heap,0)}}}function Zr(a,e){for(let t=a[e];;){let s=(e<<1)+1;if(s>=a.length)break;let o=a[s];if(s+1<a.length&&o.compare(a[s+1])>=0&&(o=a[s+1],s++),t.compare(o)<0)break;a[s]=t,a[e]=o,e=s}}class gs{constructor(e,t,s){this.minPoint=s,this.active=[],this.activeTo=[],this.activeRank=[],this.minActive=-1,this.point=null,this.pointFrom=0,this.pointRank=0,this.to=-1e9,this.endSide=0,this.openStart=-1,this.cursor=$s.from(e,t,s)}goto(e,t=-1e9){return this.cursor.goto(e,t),this.active.length=this.activeTo.length=this.activeRank.length=0,this.minActive=-1,this.to=e,this.endSide=t,this.openStart=-1,this.next(),this}forward(e,t){for(;this.minActive>-1&&(this.activeTo[this.minActive]-e||this.active[this.minActive].endSide-t)<0;)this.removeActive(this.minActive);this.cursor.forward(e,t)}removeActive(e){_o(this.active,e),_o(this.activeTo,e),_o(this.activeRank,e),this.minActive=Wc(this.active,this.activeTo)}addActive(e){let t=0,{value:s,to:o,rank:r}=this.cursor;for(;t<this.activeRank.length&&(r-this.activeRank[t]||o-this.activeTo[t])>0;)t++;Po(this.active,t,s),Po(this.activeTo,t,o),Po(this.activeRank,t,r),e&&Po(e,t,this.cursor.from),this.minActive=Wc(this.active,this.activeTo)}next(){let e=this.to,t=this.point;this.point=null;let s=this.openStart<0?[]:null;for(;;){let o=this.minActive;if(o>-1&&(this.activeTo[o]-this.cursor.from||this.active[o].endSide-this.cursor.startSide)<0){if(this.activeTo[o]>e){this.to=this.activeTo[o],this.endSide=this.active[o].endSide;break}this.removeActive(o),s&&_o(s,o)}else if(this.cursor.value)if(this.cursor.from>e){this.to=this.cursor.from,this.endSide=this.cursor.startSide;break}else{let r=this.cursor.value;if(!r.point)this.addActive(s),this.cursor.next();else if(t&&this.cursor.to==this.to&&this.cursor.from<this.cursor.to)this.cursor.next();else{this.point=r,this.pointFrom=this.cursor.from,this.pointRank=this.cursor.rank,this.to=this.cursor.to,this.endSide=r.endSide,this.cursor.next(),this.forward(this.to,this.endSide);break}}else{this.to=this.endSide=1e9;break}}if(s){this.openStart=0;for(let o=s.length-1;o>=0&&s[o]<e;o--)this.openStart++}}activeForPoint(e){if(!this.active.length)return this.active;let t=[];for(let s=this.active.length-1;s>=0&&!(this.activeRank[s]<this.pointRank);s--)(this.activeTo[s]>e||this.activeTo[s]==e&&this.active[s].endSide>=this.point.endSide)&&t.push(this.active[s]);return t.reverse()}openEnd(e){let t=0;for(let s=this.activeTo.length-1;s>=0&&this.activeTo[s]>e;s--)t++;return t}}function Vc(a,e,t,s,o,r){a.goto(e),t.goto(s);let i=s+o,n=s,c=s-e;for(;;){let l=a.to+c-t.to,d=l||a.endSide-t.endSide,p=d<0?a.to+c:t.to,u=Math.min(p,i);if(a.point||t.point?a.point&&t.point&&(a.point==t.point||a.point.eq(t.point))&&zi(a.activeForPoint(a.to),t.activeForPoint(t.to))||r.comparePoint(n,u,a.point,t.point):u>n&&!zi(a.active,t.active)&&r.compareRange(n,u,a.active,t.active),p>i)break;(l||a.openEnd!=t.openEnd)&&r.boundChange&&r.boundChange(p),n=p,d<=0&&a.next(),d>=0&&t.next()}}function zi(a,e){if(a.length!=e.length)return!1;for(let t=0;t<a.length;t++)if(a[t]!=e[t]&&!a[t].eq(e[t]))return!1;return!0}function _o(a,e){for(let t=e,s=a.length-1;t<s;t++)a[t]=a[t+1];a.pop()}function Po(a,e,t){for(let s=a.length-1;s>=e;s--)a[s+1]=a[s];a[e]=t}function Wc(a,e){let t=-1,s=1e9;for(let o=0;o<e.length;o++)(e[o]-s||a[o].endSide-a[t].endSide)<0&&(t=o,s=e[o]);return t}function Tr(a,e,t=a.length){let s=0;for(let o=0;o<t&&o<a.length;)a.charCodeAt(o)==9?(s+=e-s%e,o++):(s++,o=Xe(a,o));return s}function ug(a,e,t,s){for(let o=0,r=0;;){if(r>=e)return o;if(o==a.length)break;r+=a.charCodeAt(o)==9?t-r%t:1,o=Xe(a,o)}return a.length}const Vi="ͼ",Hc=typeof Symbol>"u"?"__"+Vi:Symbol.for(Vi),Wi=typeof Symbol>"u"?"__styleSet"+Math.floor(Math.random()*1e8):Symbol("styleSet"),$c=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};class ha{constructor(e,t){this.rules=[];let{finish:s}=t||{};function o(i){return/^@/.test(i)?[i]:i.split(/,\s*/)}function r(i,n,c,l){let d=[],p=/^@(\w+)\b/.exec(i[0]),u=p&&p[1]=="keyframes";if(p&&n==null)return c.push(i[0]+";");for(let f in n){let m=n[f];if(/&/.test(f))r(f.split(/,\s*/).map(g=>i.map(x=>g.replace(/&/,x))).reduce((g,x)=>g.concat(x)),m,c);else if(m&&typeof m=="object"){if(!p)throw new RangeError("The value of a property ("+f+") should be a primitive value.");r(o(f),m,d,u)}else m!=null&&d.push(f.replace(/_.*/,"").replace(/[A-Z]/g,g=>"-"+g.toLowerCase())+": "+m+";")}(d.length||u)&&c.push((s&&!p&&!l?i.map(s):i).join(", ")+" {"+d.join(" ")+"}")}for(let i in e)r(o(i),e[i],this.rules)}getRules(){return this.rules.join(` 42`)}static newName(){let e=$c[Hc]||1;return $c[Hc]=e+1,Vi+e.toString(36)}static mount(e,t,s){let o=e[Wi],r=s&&s.nonce;o?r&&o.setNonce(r):o=new hg(e,r),o.mount(Array.isArray(t)?t:[t],e)}}let Uc=new Map;class hg{constructor(e,t){let s=e.ownerDocument||e,o=s.defaultView;if(!e.head&&e.adoptedStyleSheets&&o.CSSStyleSheet){let r=Uc.get(s);if(r)return e[Wi]=r;this.sheet=new o.CSSStyleSheet,Uc.set(s,this)}else this.styleTag=s.createElement("style"),t&&this.styleTag.setAttribute("nonce",t);this.modules=[],e[Wi]=this}mount(e,t){let s=this.sheet,o=0,r=0;for(let i=0;i<e.length;i++){let n=e[i],c=this.modules.indexOf(n);if(c<r&&c>-1&&(this.modules.splice(c,1),r--,c=-1),c==-1){if(this.modules.splice(r++,0,n),s)for(let l=0;l<n.rules.length;l++)s.insertRule(n.rules[l],o++)}else{for(;r<c;)o+=this.modules[r++].rules.length;o+=n.rules.length,r++}}if(s)t.adoptedStyleSheets.indexOf(this.sheet)<0&&(t.adoptedStyleSheets=[this.sheet,...t.adoptedStyleSheets]);else{let i="";for(let c=0;c<this.modules.length;c++)i+=this.modules[c].getRules()+` 43`;this.styleTag.textContent=i;let n=t.head||t;this.styleTag.parentNode!=n&&n.insertBefore(this.styleTag,n.firstChild)}}setNonce(e){this.styleTag&&this.styleTag.getAttribute("nonce")!=e&&this.styleTag.setAttribute("nonce",e)}}var fa={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},Us={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},fg=typeof navigator<"u"&&/Mac/.test(navigator.platform),mg=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var Ge=0;Ge<10;Ge++)fa[48+Ge]=fa[96+Ge]=String(Ge);for(var Ge=1;Ge<=24;Ge++)fa[Ge+111]="F"+Ge;for(var Ge=65;Ge<=90;Ge++)fa[Ge]=String.fromCharCode(Ge+32),Us[Ge]=String.fromCharCode(Ge);for(var Qr in fa)Us.hasOwnProperty(Qr)||(Us[Qr]=fa[Qr]);function gg(a){var e=fg&&a.metaKey&&a.shiftKey&&!a.ctrlKey&&!a.altKey||mg&&a.shiftKey&&a.key&&a.key.length==1||a.key=="Unidentified",t=!e&&a.key||(a.shiftKey?Us:fa)[a.keyCode]||a.key||"Unidentified";return t=="Esc"&&(t="Escape"),t=="Del"&&(t="Delete"),t=="Left"&&(t="ArrowLeft"),t=="Up"&&(t="ArrowUp"),t=="Right"&&(t="ArrowRight"),t=="Down"&&(t="ArrowDown"),t}function qs(a){let e;return a.nodeType==11?e=a.getSelection?a:a.ownerDocument:e=a,e.getSelection()}function Hi(a,e){return e?a==e||a.contains(e.nodeType!=1?e.parentNode:e):!1}function Xo(a,e){if(!e.anchorNode)return!1;try{return Hi(a,e.anchorNode)}catch{return!1}}function Ks(a){return a.nodeType==3?La(a,0,a.nodeValue.length).getClientRects():a.nodeType==1?a.getClientRects():[]}function Ns(a,e,t,s){return t?qc(a,e,t,s,-1)||qc(a,e,t,s,1):!1}function Na(a){for(var e=0;;e++)if(a=a.previousSibling,!a)return e}function pr(a){return a.nodeType==1&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(a.nodeName)}function qc(a,e,t,s,o){for(;;){if(a==t&&e==s)return!0;if(e==(o<0?0:Bt(a))){if(a.nodeName=="DIV")return!1;let r=a.parentNode;if(!r||r.nodeType!=1)return!1;e=Na(a)+(o<0?0:1),a=r}else if(a.nodeType==1){if(a=a.childNodes[e+(o<0?-1:0)],a.nodeType==1&&a.contentEditable=="false")return!1;e=o<0?Bt(a):0}else return!1}}function Bt(a){return a.nodeType==3?a.nodeValue.length:a.childNodes.length}function Nr(a,e){let t=e?a.left:a.right;return{left:t,right:t,top:a.top,bottom:a.bottom}}function xg(a){let e=a.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:a.innerWidth,top:0,bottom:a.innerHeight}}function Pp(a,e){let t=e.width/a.offsetWidth,s=e.height/a.offsetHeight;return(t>.995&&t<1.005||!isFinite(t)||Math.abs(e.width-a.offsetWidth)<1)&&(t=1),(s>.995&&s<1.005||!isFinite(s)||Math.abs(e.height-a.offsetHeight)<1)&&(s=1),{scaleX:t,scaleY:s}}function bg(a,e,t,s,o,r,i,n){let c=a.ownerDocument,l=c.defaultView||window;for(let d=a,p=!1;d&&!p;)if(d.nodeType==1){let u,f=d==c.body,m=1,g=1;if(f)u=xg(l);else{if(/^(fixed|sticky)$/.test(getComputedStyle(d).position)&&(p=!0),d.scrollHeight<=d.clientHeight&&d.scrollWidth<=d.clientWidth){d=d.assignedSlot||d.parentNode;continue}let y=d.getBoundingClientRect();({scaleX:m,scaleY:g}=Pp(d,y)),u={left:y.left,right:y.left+d.clientWidth*m,top:y.top,bottom:y.top+d.clientHeight*g}}let x=0,b=0;if(o=="nearest")e.top<u.top?(b=e.top-(u.top+i),t>0&&e.bottom>u.bottom+b&&(b=e.bottom-u.bottom+i)):e.bottom>u.bottom&&(b=e.bottom-u.bottom+i,t<0&&e.top-b<u.top&&(b=e.top-(u.top+i)));else{let y=e.bottom-e.top,k=u.bottom-u.top;b=(o=="center"&&y<=k?e.top+y/2-k/2:o=="start"||o=="center"&&t<0?e.top-i:e.bottom-k+i)-u.top}if(s=="nearest"?e.left<u.left?(x=e.left-(u.left+r),t>0&&e.right>u.right+x&&(x=e.right-u.right+r)):e.right>u.right&&(x=e.right-u.right+r,t<0&&e.left<u.left+x&&(x=e.left-(u.left+r))):x=(s=="center"?e.left+(e.right-e.left)/2-(u.right-u.left)/2:s=="start"==n?e.left-r:e.right-(u.right-u.left)+r)-u.left,x||b)if(f)l.scrollBy(x,b);else{let y=0,k=0;if(b){let A=d.scrollTop;d.scrollTop+=b/g,k=(d.scrollTop-A)*g}if(x){let A=d.scrollLeft;d.scrollLeft+=x/m,y=(d.scrollLeft-A)*m}e={left:e.left-y,top:e.top-k,right:e.right-y,bottom:e.bottom-k},y&&Math.abs(y-x)<1&&(s="nearest"),k&&Math.abs(k-b)<1&&(o="nearest")}if(f)break;(e.top<u.top||e.bottom>u.bottom||e.left<u.left||e.right>u.right)&&(e={left:Math.max(e.left,u.left),right:Math.min(e.right,u.right),top:Math.max(e.top,u.top),bottom:Math.min(e.bottom,u.bottom)}),d=d.assignedSlot||d.parentNode}else if(d.nodeType==11)d=d.host;else break}function vg(a){let e=a.ownerDocument,t,s;for(let o=a.parentNode;o&&!(o==e.body||t&&s);)if(o.nodeType==1)!s&&o.scrollHeight>o.clientHeight&&(s=o),!t&&o.scrollWidth>o.clientWidth&&(t=o),o=o.assignedSlot||o.parentNode;else if(o.nodeType==11)o=o.host;else break;return{x:t,y:s}}class jg{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}eq(e){return this.anchorNode==e.anchorNode&&this.anchorOffset==e.anchorOffset&&this.focusNode==e.focusNode&&this.focusOffset==e.focusOffset}setRange(e){let{anchorNode:t,focusNode:s}=e;this.set(t,Math.min(e.anchorOffset,t?Bt(t):0),s,Math.min(e.focusOffset,s?Bt(s):0))}set(e,t,s,o){this.anchorNode=e,this.anchorOffset=t,this.focusNode=s,this.focusOffset=o}}let za=null;function Ap(a){if(a.setActive)return a.setActive();if(za)return a.focus(za);let e=[];for(let t=a;t&&(e.push(t,t.scrollTop,t.scrollLeft),t!=t.ownerDocument);t=t.parentNode);if(a.focus(za==null?{get preventScroll(){return za={preventScroll:!0},!0}}:void 0),!za){za=!1;for(let t=0;t<e.length;){let s=e[t++],o=e[t++],r=e[t++];s.scrollTop!=o&&(s.scrollTop=o),s.scrollLeft!=r&&(s.scrollLeft=r)}}}let Kc;function La(a,e,t=e){let s=Kc||(Kc=document.createRange());return s.setEnd(a,t),s.setStart(a,e),s}function qa(a,e,t,s){let o={key:e,code:e,keyCode:t,which:t,cancelable:!0};s&&({altKey:o.altKey,ctrlKey:o.ctrlKey,shiftKey:o.shiftKey,metaKey:o.metaKey}=s);let r=new KeyboardEvent("keydown",o);r.synthetic=!0,a.dispatchEvent(r);let i=new KeyboardEvent("keyup",o);return i.synthetic=!0,a.dispatchEvent(i),r.defaultPrevented||i.defaultPrevented}function wg(a){for(;a;){if(a&&(a.nodeType==9||a.nodeType==11&&a.host))return a;a=a.assignedSlot||a.parentNode}return null}function Mp(a){for(;a.attributes.length;)a.removeAttributeNode(a.attributes[0])}function yg(a,e){let t=e.focusNode,s=e.focusOffset;if(!t||e.anchorNode!=t||e.anchorOffset!=s)return!1;for(s=Math.min(s,Bt(t));;)if(s){if(t.nodeType!=1)return!1;let o=t.childNodes[s-1];o.contentEditable=="false"?s--:(t=o,s=Bt(t))}else{if(t==a)return!0;s=Na(t),t=t.parentNode}}function Ep(a){return a.scrollTop>Math.max(1,a.scrollHeight-a.clientHeight-4)}function Dp(a,e){for(let t=a,s=e;;){if(t.nodeType==3&&s>0)return{node:t,offset:s};if(t.nodeType==1&&s>0){if(t.contentEditable=="false")return null;t=t.childNodes[s-1],s=Bt(t)}else if(t.parentNode&&!pr(t))s=Na(t),t=t.parentNode;else return null}}function Tp(a,e){for(let t=a,s=e;;){if(t.nodeType==3&&s<t.nodeValue.length)return{node:t,offset:s};if(t.nodeType==1&&s<t.childNodes.length){if(t.contentEditable=="false")return null;t=t.childNodes[s],s=0}else if(t.parentNode&&!pr(t))s=Na(t)+1,t=t.parentNode;else return null}}class et{constructor(e,t,s=!0){this.node=e,this.offset=t,this.precise=s}static before(e,t){return new et(e.parentNode,Na(e),t)}static after(e,t){return new et(e.parentNode,Na(e)+1,t)}}const Rn=[];class Ne{constructor(){this.parent=null,this.dom=null,this.flags=2}get overrideDOMText(){return null}get posAtStart(){return this.parent?this.parent.posBefore(this):0}get posAtEnd(){return this.posAtStart+this.length}posBefore(e){let t=this.posAtStart;for(let s of this.children){if(s==e)return t;t+=s.length+s.breakAfter}throw new RangeError("Invalid child in posBefore")}posAfter(e){return this.posBefore(e)+e.length}sync(e,t){if(this.flags&2){let s=this.dom,o=null,r;for(let i of this.children){if(i.flags&7){if(!i.dom&&(r=o?o.nextSibling:s.firstChild)){let n=Ne.get(r);(!n||!n.parent&&n.canReuseDOM(i))&&i.reuseDOM(r)}i.sync(e,t),i.flags&=-8}if(r=o?o.nextSibling:s.firstChild,t&&!t.written&&t.node==s&&r!=i.dom&&(t.written=!0),i.dom.parentNode==s)for(;r&&r!=i.dom;)r=Gc(r);else s.insertBefore(i.dom,r);o=i.dom}for(r=o?o.nextSibling:s.firstChild,r&&t&&t.node==s&&(t.written=!0);r;)r=Gc(r)}else if(this.flags&1)for(let s of this.children)s.flags&7&&(s.sync(e,t),s.flags&=-8)}reuseDOM(e){}localPosFromDOM(e,t){let s;if(e==this.dom)s=this.dom.childNodes[t];else{let o=Bt(e)==0?0:t==0?-1:1;for(;;){let r=e.parentNode;if(r==this.dom)break;o==0&&r.firstChild!=r.lastChild&&(e==r.firstChild?o=-1:o=1),e=r}o<0?s=e:s=e.nextSibling}if(s==this.dom.firstChild)return 0;for(;s&&!Ne.get(s);)s=s.nextSibling;if(!s)return this.length;for(let o=0,r=0;;o++){let i=this.children[o];if(i.dom==s)return r;r+=i.length+i.breakAfter}}domBoundsAround(e,t,s=0){let o=-1,r=-1,i=-1,n=-1;for(let c=0,l=s,d=s;c<this.children.length;c++){let p=this.children[c],u=l+p.length;if(l<e&&u>t)return p.domBoundsAround(e,t,l);if(u>=e&&o==-1&&(o=c,r=l),l>t&&p.dom.parentNode==this.dom){i=c,n=d;break}d=u,l=u+p.breakAfter}return{from:r,to:n<0?s+this.length:n,startDOM:(o?this.children[o-1].dom.nextSibling:null)||this.dom.firstChild,endDOM:i<this.children.length&&i>=0?this.children[i].dom:null}}markDirty(e=!1){this.flags|=2,this.markParentsDirty(e)}markParentsDirty(e){for(let t=this.parent;t;t=t.parent){if(e&&(t.flags|=2),t.flags&1)return;t.flags|=1,e=!1}}setParent(e){this.parent!=e&&(this.parent=e,this.flags&7&&this.markParentsDirty(!0))}setDOM(e){this.dom!=e&&(this.dom&&(this.dom.cmView=null),this.dom=e,e.cmView=this)}get rootView(){for(let e=this;;){let t=e.parent;if(!t)return e;e=t}}replaceChildren(e,t,s=Rn){this.markDirty();for(let o=e;o<t;o++){let r=this.children[o];r.parent==this&&s.indexOf(r)<0&&r.destroy()}s.length<250?this.children.splice(e,t-e,...s):this.children=[].concat(this.children.slice(0,e),s,this.children.slice(t));for(let o=0;o<s.length;o++)s[o].setParent(this)}ignoreMutation(e){return!1}ignoreEvent(e){return!1}childCursor(e=this.length){return new Np(this.children,e,this.children.length)}childPos(e,t=1){return this.childCursor().findPos(e,t)}toString(){let e=this.constructor.name.replace("View","");return e+(this.children.length?"("+this.children.join()+")":this.length?"["+(e=="Text"?this.text:this.length)+"]":"")+(this.breakAfter?"#":"")}static get(e){return e.cmView}get isEditable(){return!0}get isWidget(){return!1}get isHidden(){return!1}merge(e,t,s,o,r,i){return!1}become(e){return!1}canReuseDOM(e){return e.constructor==this.constructor&&!((this.flags|e.flags)&8)}getSide(){return 0}destroy(){for(let e of this.children)e.parent==this&&e.destroy();this.parent=null}}Ne.prototype.breakAfter=0;function Gc(a){let e=a.nextSibling;return a.parentNode.removeChild(a),e}class Np{constructor(e,t,s){this.children=e,this.pos=t,this.i=s,this.off=0}findPos(e,t=1){for(;;){if(e>this.pos||e==this.pos&&(t>0||this.i==0||this.children[this.i-1].breakAfter))return this.off=e-this.pos,this;let s=this.children[--this.i];this.pos-=s.length+s.breakAfter}}}function Lp(a,e,t,s,o,r,i,n,c){let{children:l}=a,d=l.length?l[e]:null,p=r.length?r[r.length-1]:null,u=p?p.breakAfter:i;if(!(e==s&&d&&!i&&!u&&r.length<2&&d.merge(t,o,r.length?p:null,t==0,n,c))){if(s<l.length){let f=l[s];f&&(o<f.length||f.breakAfter&&p?.breakAfter)?(e==s&&(f=f.split(o),o=0),!u&&p&&f.merge(0,o,p,!0,0,c)?r[r.length-1]=f:((o||f.children.length&&!f.children[0].length)&&f.merge(0,o,null,!1,0,c),r.push(f))):f?.breakAfter&&(p?p.breakAfter=1:i=1),s++}for(d&&(d.breakAfter=i,t>0&&(!i&&r.length&&d.merge(t,d.length,r[0],!1,n,0)?d.breakAfter=r.shift().breakAfter:(t<d.length||d.children.length&&d.children[d.children.length-1].length==0)&&d.merge(t,d.length,null,!1,n,0),e++));e<s&&r.length;)if(l[s-1].become(r[r.length-1]))s--,r.pop(),c=r.length?0:n;else if(l[e].become(r[0]))e++,r.shift(),n=r.length?0:c;else break;!r.length&&e&&s<l.length&&!l[e-1].breakAfter&&l[s].merge(0,0,l[e-1],!1,n,c)&&e--,(e<s||r.length)&&a.replaceChildren(e,s,r)}}function Ip(a,e,t,s,o,r){let i=a.childCursor(),{i:n,off:c}=i.findPos(t,1),{i:l,off:d}=i.findPos(e,-1),p=e-t;for(let u of s)p+=u.length;a.length+=p,Lp(a,l,d,n,c,s,0,o,r)}let lt=typeof navigator<"u"?navigator:{userAgent:"",vendor:"",platform:""},$i=typeof document<"u"?document:{documentElement:{style:{}}};const Ui=/Edge\/(\d+)/.exec(lt.userAgent),Op=/MSIE \d/.test(lt.userAgent),qi=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(lt.userAgent),Lr=!!(Op||qi||Ui),Yc=!Lr&&/gecko\/(\d+)/i.test(lt.userAgent),ei=!Lr&&/Chrome\/(\d+)/.exec(lt.userAgent),Xc="webkitFontSmoothing"in $i.documentElement.style,Fp=!Lr&&/Apple Computer/.test(lt.vendor),Jc=Fp&&(/Mobile\/\w+/.test(lt.userAgent)||lt.maxTouchPoints>2);var he={mac:Jc||/Mac/.test(lt.platform),windows:/Win/.test(lt.platform),linux:/Linux|X11/.test(lt.platform),ie:Lr,ie_version:Op?$i.documentMode||6:qi?+qi[1]:Ui?+Ui[1]:0,gecko:Yc,gecko_version:Yc?+(/Firefox\/(\d+)/.exec(lt.userAgent)||[0,0])[1]:0,chrome:!!ei,chrome_version:ei?+ei[1]:0,ios:Jc,android:/Android\b/.test(lt.userAgent),webkit:Xc,safari:Fp,webkit_version:Xc?+(/\bAppleWebKit\/(\d+)/.exec(lt.userAgent)||[0,0])[1]:0,tabSize:$i.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"};const kg=256;class Ct extends Ne{constructor(e){super(),this.text=e}get length(){return this.text.length}createDOM(e){this.setDOM(e||document.createTextNode(this.text))}sync(e,t){this.dom||this.createDOM(),this.dom.nodeValue!=this.text&&(t&&t.node==this.dom&&(t.written=!0),this.dom.nodeValue=this.text)}reuseDOM(e){e.nodeType==3&&this.createDOM(e)}merge(e,t,s){return this.flags&8||s&&(!(s instanceof Ct)||this.length-(t-e)+s.length>kg||s.flags&8)?!1:(this.text=this.text.slice(0,e)+(s?s.text:"")+this.text.slice(t),this.markDirty(),!0)}split(e){let t=new Ct(this.text.slice(e));return this.text=this.text.slice(0,e),this.markDirty(),t.flags|=this.flags&8,t}localPosFromDOM(e,t){return e==this.dom?t:t?this.text.length:0}domAtPos(e){return new et(this.dom,e)}domBoundsAround(e,t,s){return{from:s,to:s+this.length,startDOM:this.dom,endDOM:this.dom.nextSibling}}coordsAt(e,t){return Cg(this.dom,e,t)}}class Jt extends Ne{constructor(e,t=[],s=0){super(),this.mark=e,this.children=t,this.length=s;for(let o of t)o.setParent(this)}setAttrs(e){if(Mp(e),this.mark.class&&(e.className=this.mark.class),this.mark.attrs)for(let t in this.mark.attrs)e.setAttribute(t,this.mark.attrs[t]);return e}canReuseDOM(e){return super.canReuseDOM(e)&&!((this.flags|e.flags)&8)}reuseDOM(e){e.nodeName==this.mark.tagName.toUpperCase()&&(this.setDOM(e),this.flags|=6)}sync(e,t){this.dom?this.flags&4&&this.setAttrs(this.dom):this.setDOM(this.setAttrs(document.createElement(this.mark.tagName))),super.sync(e,t)}merge(e,t,s,o,r,i){return s&&(!(s instanceof Jt&&s.mark.eq(this.mark))||e&&r<=0||t<this.length&&i<=0)?!1:(Ip(this,e,t,s?s.children.slice():[],r-1,i-1),this.markDirty(),!0)}split(e){let t=[],s=0,o=-1,r=0;for(let n of this.children){let c=s+n.length;c>e&&t.push(s<e?n.split(e-s):n),o<0&&s>=e&&(o=r),s=c,r++}let i=this.length-e;return this.length=e,o>-1&&(this.children.length=o,this.markDirty()),new Jt(this.mark,t,i)}domAtPos(e){return Rp(this,e)}coordsAt(e,t){return zp(this,e,t)}}function Cg(a,e,t){let s=a.nodeValue.length;e>s&&(e=s);let o=e,r=e,i=0;e==0&&t<0||e==s&&t>=0?he.chrome||he.gecko||(e?(o--,i=1):r<s&&(r++,i=-1)):t<0?o--:r<s&&r++;let n=La(a,o,r).getClientRects();if(!n.length)return null;let c=n[(i?i<0:t>=0)?0:n.length-1];return he.safari&&!i&&c.width==0&&(c=Array.prototype.find.call(n,l=>l.width)||c),i?Nr(c,i<0):c||null}class ca extends Ne{static create(e,t,s){return new ca(e,t,s)}constructor(e,t,s){super(),this.widget=e,this.length=t,this.side=s,this.prevWidget=null}split(e){let t=ca.create(this.widget,this.length-e,this.side);return this.length-=e,t}sync(e){(!this.dom||!this.widget.updateDOM(this.dom,e))&&(this.dom&&this.prevWidget&&this.prevWidget.destroy(this.dom),this.prevWidget=null,this.setDOM(this.widget.toDOM(e)),this.widget.editable||(this.dom.contentEditable="false"))}getSide(){return this.side}merge(e,t,s,o,r,i){return s&&(!(s instanceof ca)||!this.widget.compare(s.widget)||e>0&&r<=0||t<this.length&&i<=0)?!1:(this.length=e+(s?s.length:0)+(this.length-t),!0)}become(e){return e instanceof ca&&e.side==this.side&&this.widget.constructor==e.widget.constructor?(this.widget.compare(e.widget)||this.markDirty(!0),this.dom&&!this.prevWidget&&(this.prevWidget=this.widget),this.widget=e.widget,this.length=e.length,!0):!1}ignoreMutation(){return!0}ignoreEvent(e){return this.widget.ignoreEvent(e)}get overrideDOMText(){if(this.length==0)return Se.empty;let e=this;for(;e.parent;)e=e.parent;let{view:t}=e,s=t&&t.state.doc,o=this.posAtStart;return s?s.slice(o,o+this.length):Se.empty}domAtPos(e){return(this.length?e==0:this.side>0)?et.before(this.dom):et.after(this.dom,e==this.length)}domBoundsAround(){return null}coordsAt(e,t){let s=this.widget.coordsAt(this.dom,e,t);if(s)return s;let o=this.dom.getClientRects(),r=null;if(!o.length)return null;let i=this.side?this.side<0:e>0;for(let n=i?o.length-1:0;r=o[n],!(e>0?n==0:n==o.length-1||r.top<r.bottom);n+=i?-1:1);return Nr(r,!i)}get isEditable(){return!1}get isWidget(){return!0}get isHidden(){return this.widget.isHidden}destroy(){super.destroy(),this.dom&&this.widget.destroy(this.dom)}}class Ja extends Ne{constructor(e){super(),this.side=e}get length(){return 0}merge(){return!1}become(e){return e instanceof Ja&&e.side==this.side}split(){return new Ja(this.side)}sync(){if(!this.dom){let e=document.createElement("img");e.className="cm-widgetBuffer",e.setAttribute("aria-hidden","true"),this.setDOM(e)}}getSide(){return this.side}domAtPos(e){return this.side>0?et.before(this.dom):et.after(this.dom)}localPosFromDOM(){return 0}domBoundsAround(){return null}coordsAt(e){return this.dom.getBoundingClientRect()}get overrideDOMText(){return Se.empty}get isHidden(){return!0}}Ct.prototype.children=ca.prototype.children=Ja.prototype.children=Rn;function Rp(a,e){let t=a.dom,{children:s}=a,o=0;for(let r=0;o<s.length;o++){let i=s[o],n=r+i.length;if(!(n==r&&i.getSide()<=0)){if(e>r&&e<n&&i.dom.parentNode==t)return i.domAtPos(e-r);if(e<=r)break;r=n}}for(let r=o;r>0;r--){let i=s[r-1];if(i.dom.parentNode==t)return i.domAtPos(i.length)}for(let r=o;r<s.length;r++){let i=s[r];if(i.dom.parentNode==t)return i.domAtPos(0)}return new et(t,0)}function Bp(a,e,t){let s,{children:o}=a;t>0&&e instanceof Jt&&o.length&&(s=o[o.length-1])instanceof Jt&&s.mark.eq(e.mark)?Bp(s,e.children[0],t-1):(o.push(e),e.setParent(a)),a.length+=e.length}function zp(a,e,t){let s=null,o=-1,r=null,i=-1;function n(l,d){for(let p=0,u=0;p<l.children.length&&u<=d;p++){let f=l.children[p],m=u+f.length;m>=d&&(f.children.length?n(f,d-u):(!r||r.isHidden&&t>0)&&(m>d||u==m&&f.getSide()>0)?(r=f,i=d-u):(u<d||u==m&&f.getSide()<0&&!f.isHidden)&&(s=f,o=d-u)),u=m}}n(a,e);let c=(t<0?s:r)||s||r;return c?c.coordsAt(Math.max(0,c==s?o:i),t):Sg(a)}function Sg(a){let e=a.dom.lastChild;if(!e)return a.dom.getBoundingClientRect();let t=Ks(e);return t[t.length-1]||null}function Ki(a,e){for(let t in a)t=="class"&&e.class?e.class+=" "+a.class:t=="style"&&e.style?e.style+=";"+a.style:e[t]=a[t];return e}const Zc=Object.create(null);function ur(a,e,t){if(a==e)return!0;a||(a=Zc),e||(e=Zc);let s=Object.keys(a),o=Object.keys(e);if(s.length-(t&&s.indexOf(t)>-1?1:0)!=o.length-(t&&o.indexOf(t)>-1?1:0))return!1;for(let r of s)if(r!=t&&(o.indexOf(r)==-1||a[r]!==e[r]))return!1;return!0}function Gi(a,e,t){let s=!1;if(e)for(let o in e)t&&o in t||(s=!0,o=="style"?a.style.cssText="":a.removeAttribute(o));if(t)for(let o in t)e&&e[o]==t[o]||(s=!0,o=="style"?a.style.cssText=t[o]:a.setAttribute(o,t[o]));return s}function _g(a){let e=Object.create(null);for(let t=0;t<a.attributes.length;t++){let s=a.attributes[t];e[s.name]=s.value}return e}class Ba{eq(e){return!1}updateDOM(e,t){return!1}compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}get estimatedHeight(){return-1}get lineBreaks(){return 0}ignoreEvent(e){return!0}coordsAt(e,t,s){return null}get isHidden(){return!1}get editable(){return!1}destroy(e){}}var it=(function(a){return a[a.Text=0]="Text",a[a.WidgetBefore=1]="WidgetBefore",a[a.WidgetAfter=2]="WidgetAfter",a[a.WidgetRange=3]="WidgetRange",a})(it||(it={}));class be extends Ta{constructor(e,t,s,o){super(),this.startSide=e,this.endSide=t,this.widget=s,this.spec=o}get heightRelevant(){return!1}static mark(e){return new fo(e)}static widget(e){let t=Math.max(-1e4,Math.min(1e4,e.side||0)),s=!!e.block;return t+=s&&!e.inlineOrder?t>0?3e8:-4e8:t>0?1e8:-1e8,new ma(e,t,t,s,e.widget||null,!1)}static replace(e){let t=!!e.block,s,o;if(e.isBlockGap)s=-5e8,o=4e8;else{let{start:r,end:i}=Vp(e,t);s=(r?t?-3e8:-1:5e8)-1,o=(i?t?2e8:1:-6e8)+1}return new ma(e,s,o,t,e.widget||null,!0)}static line(e){return new mo(e)}static set(e,t=!1){return Pe.of(e,t)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}}be.none=Pe.empty;class fo extends be{constructor(e){let{start:t,end:s}=Vp(e);super(t?-1:5e8,s?1:-6e8,null,e),this.tagName=e.tagName||"span",this.class=e.class||"",this.attrs=e.attributes||null}eq(e){var t,s;return this==e||e instanceof fo&&this.tagName==e.tagName&&(this.class||((t=this.attrs)===null||t===void 0?void 0:t.class))==(e.class||((s=e.attrs)===null||s===void 0?void 0:s.class))&&ur(this.attrs,e.attrs,"class")}range(e,t=e){if(e>=t)throw new RangeError("Mark decorations may not be empty");return super.range(e,t)}}fo.prototype.point=!1;class mo extends be{constructor(e){super(-2e8,-2e8,null,e)}eq(e){return e instanceof mo&&this.spec.class==e.spec.class&&ur(this.spec.attributes,e.spec.attributes)}range(e,t=e){if(t!=e)throw new RangeError("Line decoration ranges must be zero-length");return super.range(e,t)}}mo.prototype.mapMode=Ye.TrackBefore;mo.prototype.point=!0;class ma extends be{constructor(e,t,s,o,r,i){super(t,s,r,e),this.block=o,this.isReplace=i,this.mapMode=o?t<=0?Ye.TrackBefore:Ye.TrackAfter:Ye.TrackDel}get type(){return this.startSide!=this.endSide?it.WidgetRange:this.startSide<=0?it.WidgetBefore:it.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(e){return e instanceof ma&&Pg(this.widget,e.widget)&&this.block==e.block&&this.startSide==e.startSide&&this.endSide==e.endSide}range(e,t=e){if(this.isReplace&&(e>t||e==t&&this.startSide>0&&this.endSide<=0))throw new RangeError("Invalid range for replacement decoration");if(!this.isReplace&&t!=e)throw new RangeError("Widget decorations can only have zero-length ranges");return super.range(e,t)}}ma.prototype.point=!0;function Vp(a,e=!1){let{inclusiveStart:t,inclusiveEnd:s}=a;return t==null&&(t=a.inclusive),s==null&&(s=a.inclusive),{start:t??e,end:s??e}}function Pg(a,e){return a==e||!!(a&&e&&a.compare(e))}function Jo(a,e,t,s=0){let o=t.length-1;o>=0&&t[o]+s>=a?t[o]=Math.max(t[o],e):t.push(a,e)}class We extends Ne{constructor(){super(...arguments),this.children=[],this.length=0,this.prevAttrs=void 0,this.attrs=null,this.breakAfter=0}merge(e,t,s,o,r,i){if(s){if(!(s instanceof We))return!1;this.dom||s.transferDOM(this)}return o&&this.setDeco(s?s.attrs:null),Ip(this,e,t,s?s.children.slice():[],r,i),!0}split(e){let t=new We;if(t.breakAfter=this.breakAfter,this.length==0)return t;let{i:s,off:o}=this.childPos(e);o&&(t.append(this.children[s].split(o),0),this.children[s].merge(o,this.children[s].length,null,!1,0,0),s++);for(let r=s;r<this.children.length;r++)t.append(this.children[r],0);for(;s>0&&this.children[s-1].length==0;)this.children[--s].destroy();return this.children.length=s,this.markDirty(),this.length=e,t}transferDOM(e){this.dom&&(this.markDirty(),e.setDOM(this.dom),e.prevAttrs=this.prevAttrs===void 0?this.attrs:this.prevAttrs,this.prevAttrs=void 0,this.dom=null)}setDeco(e){ur(this.attrs,e)||(this.dom&&(this.prevAttrs=this.attrs,this.markDirty()),this.attrs=e)}append(e,t){Bp(this,e,t)}addLineDeco(e){let t=e.spec.attributes,s=e.spec.class;t&&(this.attrs=Ki(t,this.attrs||{})),s&&(this.attrs=Ki({class:s},this.attrs||{}))}domAtPos(e){return Rp(this,e)}reuseDOM(e){e.nodeName=="DIV"&&(this.setDOM(e),this.flags|=6)}sync(e,t){var s;this.dom?this.flags&4&&(Mp(this.dom),this.dom.className="cm-line",this.prevAttrs=this.attrs?null:void 0):(this.setDOM(document.createElement("div")),this.dom.className="cm-line",this.prevAttrs=this.attrs?null:void 0),this.prevAttrs!==void 0&&(Gi(this.dom,this.prevAttrs,this.attrs),this.dom.classList.add("cm-line"),this.prevAttrs=void 0),super.sync(e,t);let o=this.dom.lastChild;for(;o&&Ne.get(o)instanceof Jt;)o=o.lastChild;if(!o||!this.length||o.nodeName!="BR"&&((s=Ne.get(o))===null||s===void 0?void 0:s.isEditable)==!1&&(!he.ios||!this.children.some(r=>r instanceof Ct))){let r=document.createElement("BR");r.cmIgnore=!0,this.dom.appendChild(r)}}measureTextSize(){if(this.children.length==0||this.length>20)return null;let e=0,t;for(let s of this.children){if(!(s instanceof Ct)||/[^ -~]/.test(s.text))return null;let o=Ks(s.dom);if(o.length!=1)return null;e+=o[0].width,t=o[0].height}return e?{lineHeight:this.dom.getBoundingClientRect().height,charWidth:e/this.length,textHeight:t}:null}coordsAt(e,t){let s=zp(this,e,t);if(!this.children.length&&s&&this.parent){let{heightOracle:o}=this.parent.view.viewState,r=s.bottom-s.top;if(Math.abs(r-o.lineHeight)<2&&o.textHeight<r){let i=(r-o.textHeight)/2;return{top:s.top+i,bottom:s.bottom-i,left:s.left,right:s.left}}}return s}become(e){return e instanceof We&&this.children.length==0&&e.children.length==0&&ur(this.attrs,e.attrs)&&this.breakAfter==e.breakAfter}covers(){return!0}static find(e,t){for(let s=0,o=0;s<e.children.length;s++){let r=e.children[s],i=o+r.length;if(i>=t){if(r instanceof We)return r;if(i>t)break}o=i+r.breakAfter}return null}}class Xt extends Ne{constructor(e,t,s){super(),this.widget=e,this.length=t,this.deco=s,this.breakAfter=0,this.prevWidget=null}merge(e,t,s,o,r,i){return s&&(!(s instanceof Xt)||!this.widget.compare(s.widget)||e>0&&r<=0||t<this.length&&i<=0)?!1:(this.length=e+(s?s.length:0)+(this.length-t),!0)}domAtPos(e){return e==0?et.before(this.dom):et.after(this.dom,e==this.length)}split(e){let t=this.length-e;this.length=e;let s=new Xt(this.widget,t,this.deco);return s.breakAfter=this.breakAfter,s}get children(){return Rn}sync(e){(!this.dom||!this.widget.updateDOM(this.dom,e))&&(this.dom&&this.prevWidget&&this.prevWidget.destroy(this.dom),this.prevWidget=null,this.setDOM(this.widget.toDOM(e)),this.widget.editable||(this.dom.contentEditable="false"))}get overrideDOMText(){return this.parent?this.parent.view.state.doc.slice(this.posAtStart,this.posAtEnd):Se.empty}domBoundsAround(){return null}become(e){return e instanceof Xt&&e.widget.constructor==this.widget.constructor?(e.widget.compare(this.widget)||this.markDirty(!0),this.dom&&!this.prevWidget&&(this.prevWidget=this.widget),this.widget=e.widget,this.length=e.length,this.deco=e.deco,this.breakAfter=e.breakAfter,!0):!1}ignoreMutation(){return!0}ignoreEvent(e){return this.widget.ignoreEvent(e)}get isEditable(){return!1}get isWidget(){return!0}coordsAt(e,t){let s=this.widget.coordsAt(this.dom,e,t);return s||(this.widget instanceof Yi?null:Nr(this.dom.getBoundingClientRect(),this.length?e==0:t<=0))}destroy(){super.destroy(),this.dom&&this.widget.destroy(this.dom)}covers(e){let{startSide:t,endSide:s}=this.deco;return t==s?!1:e<0?t<0:s>0}}class Yi extends Ba{constructor(e){super(),this.height=e}toDOM(){let e=document.createElement("div");return e.className="cm-gap",this.updateDOM(e),e}eq(e){return e.height==this.height}updateDOM(e){return e.style.height=this.height+"px",!0}get editable(){return!0}get estimatedHeight(){return this.height}ignoreEvent(){return!1}}class Ls{constructor(e,t,s,o){this.doc=e,this.pos=t,this.end=s,this.disallowBlockEffectsFor=o,this.content=[],this.curLine=null,this.breakAtStart=0,this.pendingBuffer=0,this.bufferMarks=[],this.atCursorPos=!0,this.openStart=-1,this.openEnd=-1,this.text="",this.textOff=0,this.cursor=e.iter(),this.skip=t}posCovered(){if(this.content.length==0)return!this.breakAtStart&&this.doc.lineAt(this.pos).from!=this.pos;let e=this.content[this.content.length-1];return!(e.breakAfter||e instanceof Xt&&e.deco.endSide<0)}getLine(){return this.curLine||(this.content.push(this.curLine=new We),this.atCursorPos=!0),this.curLine}flushBuffer(e=this.bufferMarks){this.pendingBuffer&&(this.curLine.append(Ao(new Ja(-1),e),e.length),this.pendingBuffer=0)}addBlockWidget(e){this.flushBuffer(),this.curLine=null,this.content.push(e)}finish(e){this.pendingBuffer&&e<=this.bufferMarks.length?this.flushBuffer():this.pendingBuffer=0,!this.posCovered()&&!(e&&this.content.length&&this.content[this.content.length-1]instanceof Xt)&&this.getLine()}buildText(e,t,s){for(;e>0;){if(this.textOff==this.text.length){let{value:r,lineBreak:i,done:n}=this.cursor.next(this.skip);if(this.skip=0,n)throw new Error("Ran out of text content when drawing inline views");if(i){this.posCovered()||this.getLine(),this.content.length?this.content[this.content.length-1].breakAfter=1:this.breakAtStart=1,this.flushBuffer(),this.curLine=null,this.atCursorPos=!0,e--;continue}else this.text=r,this.textOff=0}let o=Math.min(this.text.length-this.textOff,e,512);this.flushBuffer(t.slice(t.length-s)),this.getLine().append(Ao(new Ct(this.text.slice(this.textOff,this.textOff+o)),t),s),this.atCursorPos=!0,this.textOff+=o,e-=o,s=0}}span(e,t,s,o){this.buildText(t-e,s,o),this.pos=t,this.openStart<0&&(this.openStart=o)}point(e,t,s,o,r,i){if(this.disallowBlockEffectsFor[i]&&s instanceof ma){if(s.block)throw new RangeError("Block decorations may not be specified via plugins");if(t>this.doc.lineAt(this.pos).to)throw new RangeError("Decorations that replace line breaks may not be specified via plugins")}let n=t-e;if(s instanceof ma)if(s.block)s.startSide>0&&!this.posCovered()&&this.getLine(),this.addBlockWidget(new Xt(s.widget||Za.block,n,s));else{let c=ca.create(s.widget||Za.inline,n,n?0:s.startSide),l=this.atCursorPos&&!c.isEditable&&r<=o.length&&(e<t||s.startSide>0),d=!c.isEditable&&(e<t||r>o.length||s.startSide<=0),p=this.getLine();this.pendingBuffer==2&&!l&&!c.isEditable&&(this.pendingBuffer=0),this.flushBuffer(o),l&&(p.append(Ao(new Ja(1),o),r),r=o.length+Math.max(0,r-o.length)),p.append(Ao(c,o),r),this.atCursorPos=d,this.pendingBuffer=d?e<t||r>o.length?1:2:0,this.pendingBuffer&&(this.bufferMarks=o.slice())}else this.doc.lineAt(this.pos).from==this.pos&&this.getLine().addLineDeco(s);n&&(this.textOff+n<=this.text.length?this.textOff+=n:(this.skip+=n-(this.text.length-this.textOff),this.text="",this.textOff=0),this.pos=t),this.openStart<0&&(this.openStart=r)}static build(e,t,s,o,r){let i=new Ls(e,t,s,r);return i.openEnd=Pe.spans(o,t,s,i),i.openStart<0&&(i.openStart=i.openEnd),i.finish(i.openEnd),i}}function Ao(a,e){for(let t of e)a=new Jt(t,[a],a.length);return a}class Za extends Ba{constructor(e){super(),this.tag=e}eq(e){return e.tag==this.tag}toDOM(){return document.createElement(this.tag)}updateDOM(e){return e.nodeName.toLowerCase()==this.tag}get isHidden(){return!0}}Za.inline=new Za("span");Za.block=new Za("div");var Re=(function(a){return a[a.LTR=0]="LTR",a[a.RTL=1]="RTL",a})(Re||(Re={}));const Ia=Re.LTR,Bn=Re.RTL;function Wp(a){let e=[];for(let t=0;t<a.length;t++)e.push(1<<+a[t]);return e}const Ag=Wp("88888888888888888888888888888888888666888888787833333333337888888000000000000000000000000008888880000000000000000000000000088888888888888888888888888888888888887866668888088888663380888308888800000000000000000000000800000000000000000000000000000008"),Mg=Wp("4444448826627288999999999992222222222222222222222222222222222222222222222229999999999999999999994444444444644222822222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999949999999229989999223333333333"),Xi=Object.create(null),Mt=[];for(let a of["()","[]","{}"]){let e=a.charCodeAt(0),t=a.charCodeAt(1);Xi[e]=t,Xi[t]=-e}function Hp(a){return a<=247?Ag[a]:1424<=a&&a<=1524?2:1536<=a&&a<=1785?Mg[a-1536]:1774<=a&&a<=2220?4:8192<=a&&a<=8204?256:64336<=a&&a<=65023?4:1}const Eg=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\ufb50-\ufdff]/;class la{get dir(){return this.level%2?Bn:Ia}constructor(e,t,s){this.from=e,this.to=t,this.level=s}side(e,t){return this.dir==t==e?this.to:this.from}forward(e,t){return e==(this.dir==t)}static find(e,t,s,o){let r=-1;for(let i=0;i<e.length;i++){let n=e[i];if(n.from<=t&&n.to>=t){if(n.level==s)return i;(r<0||(o!=0?o<0?n.from<t:n.to>t:e[r].level>n.level))&&(r=i)}}if(r<0)throw new RangeError("Index out of range");return r}}function $p(a,e){if(a.length!=e.length)return!1;for(let t=0;t<a.length;t++){let s=a[t],o=e[t];if(s.from!=o.from||s.to!=o.to||s.direction!=o.direction||!$p(s.inner,o.inner))return!1}return!0}const Te=[];function Dg(a,e,t,s,o){for(let r=0;r<=s.length;r++){let i=r?s[r-1].to:e,n=r<s.length?s[r].from:t,c=r?256:o;for(let l=i,d=c,p=c;l<n;l++){let u=Hp(a.charCodeAt(l));u==512?u=d:u==8&&p==4&&(u=16),Te[l]=u==4?2:u,u&7&&(p=u),d=u}for(let l=i,d=c,p=c;l<n;l++){let u=Te[l];if(u==128)l<n-1&&d==Te[l+1]&&d&24?u=Te[l]=d:Te[l]=256;else if(u==64){let f=l+1;for(;f<n&&Te[f]==64;)f++;let m=l&&d==8||f<t&&Te[f]==8?p==1?1:8:256;for(let g=l;g<f;g++)Te[g]=m;l=f-1}else u==8&&p==1&&(Te[l]=1);d=u,u&7&&(p=u)}}}function Tg(a,e,t,s,o){let r=o==1?2:1;for(let i=0,n=0,c=0;i<=s.length;i++){let l=i?s[i-1].to:e,d=i<s.length?s[i].from:t;for(let p=l,u,f,m;p<d;p++)if(f=Xi[u=a.charCodeAt(p)])if(f<0){for(let g=n-3;g>=0;g-=3)if(Mt[g+1]==-f){let x=Mt[g+2],b=x&2?o:x&4?x&1?r:o:0;b&&(Te[p]=Te[Mt[g]]=b),n=g;break}}else{if(Mt.length==189)break;Mt[n++]=p,Mt[n++]=u,Mt[n++]=c}else if((m=Te[p])==2||m==1){let g=m==o;c=g?0:1;for(let x=n-3;x>=0;x-=3){let b=Mt[x+2];if(b&2)break;if(g)Mt[x+2]|=2;else{if(b&4)break;Mt[x+2]|=4}}}}}function Ng(a,e,t,s){for(let o=0,r=s;o<=t.length;o++){let i=o?t[o-1].to:a,n=o<t.length?t[o].from:e;for(let c=i;c<n;){let l=Te[c];if(l==256){let d=c+1;for(;;)if(d==n){if(o==t.length)break;d=t[o++].to,n=o<t.length?t[o].from:e}else if(Te[d]==256)d++;else break;let p=r==1,u=(d<e?Te[d]:s)==1,f=p==u?p?1:2:s;for(let m=d,g=o,x=g?t[g-1].to:a;m>c;)m==x&&(m=t[--g].from,x=g?t[g-1].to:a),Te[--m]=f;c=d}else r=l,c++}}}function Ji(a,e,t,s,o,r,i){let n=s%2?2:1;if(s%2==o%2)for(let c=e,l=0;c<t;){let d=!0,p=!1;if(l==r.length||c<r[l].from){let g=Te[c];g!=n&&(d=!1,p=g==16)}let u=!d&&n==1?[]:null,f=d?s:s+1,m=c;e:for(;;)if(l<r.length&&m==r[l].from){if(p)break e;let g=r[l];if(!d)for(let x=g.to,b=l+1;;){if(x==t)break e;if(b<r.length&&r[b].from==x)x=r[b++].to;else{if(Te[x]==n)break e;break}}if(l++,u)u.push(g);else{g.from>c&&i.push(new la(c,g.from,f));let x=g.direction==Ia!=!(f%2);Zi(a,x?s+1:s,o,g.inner,g.from,g.to,i),c=g.to}m=g.to}else{if(m==t||(d?Te[m]!=n:Te[m]==n))break;m++}u?Ji(a,c,m,s+1,o,u,i):c<m&&i.push(new la(c,m,f)),c=m}else for(let c=t,l=r.length;c>e;){let d=!0,p=!1;if(!l||c>r[l-1].to){let g=Te[c-1];g!=n&&(d=!1,p=g==16)}let u=!d&&n==1?[]:null,f=d?s:s+1,m=c;e:for(;;)if(l&&m==r[l-1].to){if(p)break e;let g=r[--l];if(!d)for(let x=g.from,b=l;;){if(x==e)break e;if(b&&r[b-1].to==x)x=r[--b].from;else{if(Te[x-1]==n)break e;break}}if(u)u.push(g);else{g.to<c&&i.push(new la(g.to,c,f));let x=g.direction==Ia!=!(f%2);Zi(a,x?s+1:s,o,g.inner,g.from,g.to,i),c=g.from}m=g.from}else{if(m==e||(d?Te[m-1]!=n:Te[m-1]==n))break;m--}u?Ji(a,m,c,s+1,o,u,i):m<c&&i.push(new la(m,c,f)),c=m}}function Zi(a,e,t,s,o,r,i){let n=e%2?2:1;Dg(a,o,r,s,n),Tg(a,o,r,s,n),Ng(o,r,s,n),Ji(a,o,r,e,t,s,i)}function Lg(a,e,t){if(!a)return[new la(0,0,e==Bn?1:0)];if(e==Ia&&!t.length&&!Eg.test(a))return Up(a.length);if(t.length)for(;a.length>Te.length;)Te[Te.length]=256;let s=[],o=e==Ia?0:1;return Zi(a,o,o,t,0,a.length,s),s}function Up(a){return[new la(0,a,0)]}let qp="";function Ig(a,e,t,s,o){var r;let i=s.head-a.from,n=la.find(e,i,(r=s.bidiLevel)!==null&&r!==void 0?r:-1,s.assoc),c=e[n],l=c.side(o,t);if(i==l){let u=n+=o?1:-1;if(u<0||u>=e.length)return null;c=e[n=u],i=c.side(!o,t),l=c.side(o,t)}let d=Xe(a.text,i,c.forward(o,t));(d<c.from||d>c.to)&&(d=l),qp=a.text.slice(Math.min(i,d),Math.max(i,d));let p=n==(o?e.length-1:0)?null:e[n+(o?1:-1)];return p&&d==l&&p.level+(o?0:1)<c.level?ae.cursor(p.side(!o,t)+a.from,p.forward(o,t)?1:-1,p.level):ae.cursor(d+a.from,c.forward(o,t)?-1:1,c.level)}function Og(a,e,t){for(let s=e;s<t;s++){let o=Hp(a.charCodeAt(s));if(o==1)return Ia;if(o==2||o==4)return Bn}return Ia}const Kp=fe.define(),Gp=fe.define(),Yp=fe.define(),Xp=fe.define(),Qi=fe.define(),Jp=fe.define(),Zp=fe.define(),zn=fe.define(),Vn=fe.define(),Qp=fe.define({combine:a=>a.some(e=>e)}),eu=fe.define({combine:a=>a.some(e=>e)}),tu=fe.define();class Ka{constructor(e,t="nearest",s="nearest",o=5,r=5,i=!1){this.range=e,this.y=t,this.x=s,this.yMargin=o,this.xMargin=r,this.isSnapshot=i}map(e){return e.empty?this:new Ka(this.range.map(e),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}clip(e){return this.range.to<=e.doc.length?this:new Ka(ae.cursor(e.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}}const Mo=we.define({map:(a,e)=>a.map(e)}),au=we.define();function kt(a,e,t){let s=a.facet(Xp);s.length?s[0](e):window.onerror?window.onerror(String(e),t,void 0,void 0,e):t?console.error(t+":",e):console.error(e)}const qt=fe.define({combine:a=>a.length?a[0]:!0});let Fg=0;const Ss=fe.define();class at{constructor(e,t,s,o,r){this.id=e,this.create=t,this.domEventHandlers=s,this.domEventObservers=o,this.extension=r(this)}static define(e,t){const{eventHandlers:s,eventObservers:o,provide:r,decorations:i}=t||{};return new at(Fg++,e,s,o,n=>{let c=[Ss.of(n)];return i&&c.push(Gs.of(l=>{let d=l.plugin(n);return d?i(d):be.none})),r&&c.push(r(n)),c})}static fromClass(e,t){return at.define(s=>new e(s),t)}}class ti{constructor(e){this.spec=e,this.mustUpdate=null,this.value=null}update(e){if(this.value){if(this.mustUpdate){let t=this.mustUpdate;if(this.mustUpdate=null,this.value.update)try{this.value.update(t)}catch(s){if(kt(t.state,s,"CodeMirror plugin crashed"),this.value.destroy)try{this.value.destroy()}catch{}this.deactivate()}}}else if(this.spec)try{this.value=this.spec.create(e)}catch(t){kt(e.state,t,"CodeMirror plugin crashed"),this.deactivate()}return this}destroy(e){var t;if(!((t=this.value)===null||t===void 0)&&t.destroy)try{this.value.destroy()}catch(s){kt(e.state,s,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const su=fe.define(),Wn=fe.define(),Gs=fe.define(),ou=fe.define(),Hn=fe.define(),ru=fe.define();function Qc(a,e){let t=a.state.facet(ru);if(!t.length)return t;let s=t.map(r=>r instanceof Function?r(a):r),o=[];return Pe.spans(s,e.from,e.to,{point(){},span(r,i,n,c){let l=r-e.from,d=i-e.from,p=o;for(let u=n.length-1;u>=0;u--,c--){let f=n[u].spec.bidiIsolate,m;if(f==null&&(f=Og(e.text,l,d)),c>0&&p.length&&(m=p[p.length-1]).to==l&&m.direction==f)m.to=d,p=m.inner;else{let g={from:l,to:d,direction:f,inner:[]};p.push(g),p=g.inner}}}}),o}const iu=fe.define();function $n(a){let e=0,t=0,s=0,o=0;for(let r of a.state.facet(iu)){let i=r(a);i&&(i.left!=null&&(e=Math.max(e,i.left)),i.right!=null&&(t=Math.max(t,i.right)),i.top!=null&&(s=Math.max(s,i.top)),i.bottom!=null&&(o=Math.max(o,i.bottom)))}return{left:e,right:t,top:s,bottom:o}}const _s=fe.define();class bt{constructor(e,t,s,o){this.fromA=e,this.toA=t,this.fromB=s,this.toB=o}join(e){return new bt(Math.min(this.fromA,e.fromA),Math.max(this.toA,e.toA),Math.min(this.fromB,e.fromB),Math.max(this.toB,e.toB))}addToSet(e){let t=e.length,s=this;for(;t>0;t--){let o=e[t-1];if(!(o.fromA>s.toA)){if(o.toA<s.fromA)break;s=s.join(o),e.splice(t-1,1)}}return e.splice(t,0,s),e}static extendWithRanges(e,t){if(t.length==0)return e;let s=[];for(let o=0,r=0,i=0,n=0;;o++){let c=o==e.length?null:e[o],l=i-n,d=c?c.fromB:1e9;for(;r<t.length&&t[r]<d;){let p=t[r],u=t[r+1],f=Math.max(n,p),m=Math.min(d,u);if(f<=m&&new bt(f+l,m+l,f,m).addToSet(s),u>d)break;r+=2}if(!c)return s;new bt(c.fromA,c.toA,c.fromB,c.toB).addToSet(s),i=c.toA,n=c.toB}}}class hr{constructor(e,t,s){this.view=e,this.state=t,this.transactions=s,this.flags=0,this.startState=e.state,this.changes=Ue.empty(this.startState.doc.length);for(let r of s)this.changes=this.changes.compose(r.changes);let o=[];this.changes.iterChangedRanges((r,i,n,c)=>o.push(new bt(r,i,n,c))),this.changedRanges=o}static create(e,t,s){return new hr(e,t,s)}get viewportChanged(){return(this.flags&4)>0}get viewportMoved(){return(this.flags&8)>0}get heightChanged(){return(this.flags&2)>0}get geometryChanged(){return this.docChanged||(this.flags&18)>0}get focusChanged(){return(this.flags&1)>0}get docChanged(){return!this.changes.empty}get selectionSet(){return this.transactions.some(e=>e.selection)}get empty(){return this.flags==0&&this.transactions.length==0}}class el extends Ne{get length(){return this.view.state.doc.length}constructor(e){super(),this.view=e,this.decorations=[],this.dynamicDecorationMap=[!1],this.domChanged=null,this.hasComposition=null,this.markedForComposition=new Set,this.editContextFormatting=be.none,this.lastCompositionAfterCursor=!1,this.minWidth=0,this.minWidthFrom=0,this.minWidthTo=0,this.impreciseAnchor=null,this.impreciseHead=null,this.forceSelection=!1,this.lastUpdate=Date.now(),this.setDOM(e.contentDOM),this.children=[new We],this.children[0].setParent(this),this.updateDeco(),this.updateInner([new bt(0,0,0,e.state.doc.length)],0,null)}update(e){var t;let s=e.changedRanges;this.minWidth>0&&s.length&&(s.every(({fromA:l,toA:d})=>d<this.minWidthFrom||l>this.minWidthTo)?(this.minWidthFrom=e.changes.mapPos(this.minWidthFrom,1),this.minWidthTo=e.changes.mapPos(this.minWidthTo,1)):this.minWidth=this.minWidthFrom=this.minWidthTo=0),this.updateEditContextFormatting(e);let o=-1;this.view.inputState.composing>=0&&!this.view.observer.editContext&&(!((t=this.domChanged)===null||t===void 0)&&t.newSel?o=this.domChanged.newSel.head:!$g(e.changes,this.hasComposition)&&!e.selectionSet&&(o=e.state.selection.main.head));let r=o>-1?Bg(this.view,e.changes,o):null;if(this.domChanged=null,this.hasComposition){this.markedForComposition.clear();let{from:l,to:d}=this.hasComposition;s=new bt(l,d,e.changes.mapPos(l,-1),e.changes.mapPos(d,1)).addToSet(s.slice())}this.hasComposition=r?{from:r.range.fromB,to:r.range.toB}:null,(he.ie||he.chrome)&&!r&&e&&e.state.doc.lines!=e.startState.doc.lines&&(this.forceSelection=!0);let i=this.decorations,n=this.updateDeco(),c=Wg(i,n,e.changes);return s=bt.extendWithRanges(s,c),!(this.flags&7)&&s.length==0?!1:(this.updateInner(s,e.startState.doc.length,r),e.transactions.length&&(this.lastUpdate=Date.now()),!0)}updateInner(e,t,s){this.view.viewState.mustMeasureContent=!0,this.updateChildren(e,t,s);let{observer:o}=this.view;o.ignore(()=>{this.dom.style.height=this.view.viewState.contentHeight/this.view.scaleY+"px",this.dom.style.flexBasis=this.minWidth?this.minWidth+"px":"";let i=he.chrome||he.ios?{node:o.selectionRange.focusNode,written:!1}:void 0;this.sync(this.view,i),this.flags&=-8,i&&(i.written||o.selectionRange.focusNode!=i.node)&&(this.forceSelection=!0),this.dom.style.height=""}),this.markedForComposition.forEach(i=>i.flags&=-9);let r=[];if(this.view.viewport.from||this.view.viewport.to<this.view.state.doc.length)for(let i of this.children)i instanceof Xt&&i.widget instanceof Yi&&r.push(i.dom);o.updateGaps(r)}updateChildren(e,t,s){let o=s?s.range.addToSet(e.slice()):e,r=this.childCursor(t);for(let i=o.length-1;;i--){let n=i>=0?o[i]:null;if(!n)break;let{fromA:c,toA:l,fromB:d,toB:p}=n,u,f,m,g;if(s&&s.range.fromB<p&&s.range.toB>d){let A=Ls.build(this.view.state.doc,d,s.range.fromB,this.decorations,this.dynamicDecorationMap),S=Ls.build(this.view.state.doc,s.range.toB,p,this.decorations,this.dynamicDecorationMap);f=A.breakAtStart,m=A.openStart,g=S.openEnd;let N=this.compositionView(s);S.breakAtStart?N.breakAfter=1:S.content.length&&N.merge(N.length,N.length,S.content[0],!1,S.openStart,0)&&(N.breakAfter=S.content[0].breakAfter,S.content.shift()),A.content.length&&N.merge(0,0,A.content[A.content.length-1],!0,0,A.openEnd)&&A.content.pop(),u=A.content.concat(N).concat(S.content)}else({content:u,breakAtStart:f,openStart:m,openEnd:g}=Ls.build(this.view.state.doc,d,p,this.decorations,this.dynamicDecorationMap));let{i:x,off:b}=r.findPos(l,1),{i:y,off:k}=r.findPos(c,-1);Lp(this,y,k,x,b,u,f,m,g)}s&&this.fixCompositionDOM(s)}updateEditContextFormatting(e){this.editContextFormatting=this.editContextFormatting.map(e.changes);for(let t of e.transactions)for(let s of t.effects)s.is(au)&&(this.editContextFormatting=s.value)}compositionView(e){let t=new Ct(e.text.nodeValue);t.flags|=8;for(let{deco:o}of e.marks)t=new Jt(o,[t],t.length);let s=new We;return s.append(t,0),s}fixCompositionDOM(e){let t=(r,i)=>{i.flags|=8|(i.children.some(c=>c.flags&7)?1:0),this.markedForComposition.add(i);let n=Ne.get(r);n&&n!=i&&(n.dom=null),i.setDOM(r)},s=this.childPos(e.range.fromB,1),o=this.children[s.i];t(e.line,o);for(let r=e.marks.length-1;r>=-1;r--)s=o.childPos(s.off,1),o=o.children[s.i],t(r>=0?e.marks[r].node:e.text,o)}updateSelection(e=!1,t=!1){(e||!this.view.observer.selectionRange.focusNode)&&this.view.observer.readSelectionRange();let s=this.view.root.activeElement,o=s==this.dom,r=!o&&!(this.view.state.facet(qt)||this.dom.tabIndex>-1)&&Xo(this.dom,this.view.observer.selectionRange)&&!(s&&this.dom.contains(s));if(!(o||t||r))return;let i=this.forceSelection;this.forceSelection=!1;let n=this.view.state.selection.main,c=this.moveToLine(this.domAtPos(n.anchor)),l=n.empty?c:this.moveToLine(this.domAtPos(n.head));if(he.gecko&&n.empty&&!this.hasComposition&&Rg(c)){let p=document.createTextNode("");this.view.observer.ignore(()=>c.node.insertBefore(p,c.node.childNodes[c.offset]||null)),c=l=new et(p,0),i=!0}let d=this.view.observer.selectionRange;(i||!d.focusNode||(!Ns(c.node,c.offset,d.anchorNode,d.anchorOffset)||!Ns(l.node,l.offset,d.focusNode,d.focusOffset))&&!this.suppressWidgetCursorChange(d,n))&&(this.view.observer.ignore(()=>{he.android&&he.chrome&&this.dom.contains(d.focusNode)&&Hg(d.focusNode,this.dom)&&(this.dom.blur(),this.dom.focus({preventScroll:!0}));let p=qs(this.view.root);if(p)if(n.empty){if(he.gecko){let u=zg(c.node,c.offset);if(u&&u!=3){let f=(u==1?Dp:Tp)(c.node,c.offset);f&&(c=new et(f.node,f.offset))}}p.collapse(c.node,c.offset),n.bidiLevel!=null&&p.caretBidiLevel!==void 0&&(p.caretBidiLevel=n.bidiLevel)}else if(p.extend){p.collapse(c.node,c.offset);try{p.extend(l.node,l.offset)}catch{}}else{let u=document.createRange();n.anchor>n.head&&([c,l]=[l,c]),u.setEnd(l.node,l.offset),u.setStart(c.node,c.offset),p.removeAllRanges(),p.addRange(u)}r&&this.view.root.activeElement==this.dom&&(this.dom.blur(),s&&s.focus())}),this.view.observer.setSelectionRange(c,l)),this.impreciseAnchor=c.precise?null:new et(d.anchorNode,d.anchorOffset),this.impreciseHead=l.precise?null:new et(d.focusNode,d.focusOffset)}suppressWidgetCursorChange(e,t){return this.hasComposition&&t.empty&&Ns(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)&&this.posFromDOM(e.focusNode,e.focusOffset)==t.head}enforceCursorAssoc(){if(this.hasComposition)return;let{view:e}
vendor: 4,089 bytes, line 43
43=this,t=e.state.selection.main,s=qs(e.root),{anchorNode:o,anchorOffset:r}=e.observer.selectionRange;if(!s||!t.empty||!t.assoc||!s.modify)return;let i=We.find(this,t.head);if(!i)return;let n=i.posAtStart;if(t.head==n||t.head==n+i.length)return;let c=this.coordsAt(t.head,-1),l=this.coordsAt(t.head,1);if(!c||!l||c.bottom>l.top)return;let d=this.domAtPos(t.head+t.assoc);s.collapse(d.node,d.offset),s.modify("move",t.assoc<0?"forward":"backward","lineboundary"),e.observer.readSelectionRange();let p=e.observer.selectionRange;e.docView.posFromDOM(p.anchorNode,p.anchorOffset)!=t.from&&s.collapse(o,r)}moveToLine(e){let t=this.dom,s;if(e.node!=t)return e;for(let o=e.offset;!s&&o<t.childNodes.length;o++){let r=Ne.get(t.childNodes[o]);r instanceof We&&(s=r.domAtPos(0))}for(let o=e.offset-1;!s&&o>=0;o--){let r=Ne.get(t.childNodes[o]);r instanceof We&&(s=r.domAtPos(r.length))}return s?new et(s.node,s.offset,!0):e}nearest(e){for(let t=e;t;){let s=Ne.get(t);if(s&&s.rootView==this)return s;t=t.parentNode}return null}posFromDOM(e,t){let s=this.nearest(e);if(!s)throw new RangeError("Trying to find position for a DOM position outside of the document");return s.localPosFromDOM(e,t)+s.posAtStart}domAtPos(e){let{i:t,off:s}=this.childCursor().findPos(e,-1);for(;t<this.children.length-1;){let o=this.children[t];if(s<o.length||o instanceof We)break;t++,s=0}return this.children[t].domAtPos(s)}coordsAt(e,t){let s=null,o=0;for(let r=this.length,i=this.children.length-1;i>=0;i--){let n=this.children[i],c=r-n.breakAfter,l=c-n.length;if(c<e)break;if(l<=e&&(l<e||n.covers(-1))&&(c>e||n.covers(1))&&(!s||n instanceof We&&!(s instanceof We&&t>=0)))s=n,o=l;else if(s&&l==e&&c==e&&n instanceof Xt&&Math.abs(t)<2){if(n.deco.startSide<0)break;i&&(s=null)}r=l}return s?s.coordsAt(e-o,t):null}coordsForChar(e){let{i:t,off:s}=this.childPos(e,1),o=this.children[t];if(!(o instanceof We))return null;for(;o.children.length;){let{i:n,off:c}=o.childPos(s,1);for(;;n++){if(n==o.children.length)return null;if((o=o.children[n]).length)break}s=c}if(!(o instanceof Ct))return null;let r=Xe(o.text,s);if(r==s)return null;let i=La(o.dom,s,r).getClientRects();for(let n=0;n<i.length;n++){let c=i[n];if(n==i.length-1||c.top<c.bottom&&c.left<c.right)return c}return null}measureVisibleLineHeights(e){let t=[],{from:s,to:o}=e,r=this.view.contentDOM.clientWidth,i=r>Math.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,n=-1,c=this.view.textDirection==Re.LTR;for(let l=0,d=0;d<this.children.length;d++){let p=this.children[d],u=l+p.length;if(u>o)break;if(l>=s){let f=p.dom.getBoundingClientRect();if(t.push(f.height),i){let m=p.dom.lastChild,g=m?Ks(m):[];if(g.length){let x=g[g.length-1],b=c?x.right-f.left:f.right-x.left;b>n&&(n=b,this.minWidth=r,this.minWidthFrom=l,this.minWidthTo=u)}}}l=u+p.breakAfter}return t}textDirectionAt(e){let{i:t}=this.childPos(e,1);return getComputedStyle(this.children[t].dom).direction=="rtl"?Re.RTL:Re.LTR}measureTextSize(){for(let r of this.children)if(r instanceof We){let i=r.measureTextSize();if(i)return i}let e=document.createElement("div"),t,s,o;return e.className="cm-line",e.style.width="99999px",e.style.position="absolute",e.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore(()=>{this.dom.appendChild(e);let r=Ks(e.firstChild)[0];t=e.getBoundingClientRect().height,s=r?r.width/27:7,o=r?r.height:t,e.remove()}),{lineHeight:t,charWidth:s,textHeight:o}}childCursor(e=this.length){let t=this.children.length;return t&&(e-=this.children[--t].length),new Np(this.children,e,t)}computeBlockGapDeco(){let e=[],t=this.view.viewState;for(let s=0,o=0;;o++){let r=o==t.viewports.length?null:t.viewports[o],i=r?r.from-1:this.length;if(i>s){let n=(t.lineBlockAt(i).bottom-t.lineBlockAt(s).top)/this.view.scaleY;e.push(be.replace({widget:new Yi(n),block:!0,inclusive:!0,isBlockGap:!0}).range(s,i))}if(!r)break;s=r.to+1}return be.set(e)}updateDeco(){let e=1,t=this.view.state.facet(Gs).map(r=>(this.dynamicDecorationMap[e++]=typeof r=="function")?r(this.view):r),s=!1,o=this.view.state.facet(ou).map((r,i)=>{let n=typeof r=="function";return n&&(s=!0),n?r(this.view):r});
vendor: 49,572 bytes, lines 43-45
43for(o.length&&(this.dynamicDecorationMap[e++]=s,t.push(Pe.join(o))),this.decorations=[this.editContextFormatting,...t,this.computeBlockGapDeco(),this.view.viewState.lineGapDeco];e<this.decorations.length;)this.dynamicDecorationMap[e++]=!1;return this.decorations}scrollIntoView(e){if(e.isSnapshot){let l=this.view.viewState.lineBlockAt(e.range.head);this.view.scrollDOM.scrollTop=l.top-e.yMargin,this.view.scrollDOM.scrollLeft=e.xMargin;return}for(let l of this.view.state.facet(tu))try{if(l(this.view,e.range,e))return!0}catch(d){kt(this.view.state,d,"scroll handler")}let{range:t}=e,s=this.coordsAt(t.head,t.empty?t.assoc:t.head>t.anchor?-1:1),o;if(!s)return;!t.empty&&(o=this.coordsAt(t.anchor,t.anchor>t.head?-1:1))&&(s={left:Math.min(s.left,o.left),top:Math.min(s.top,o.top),right:Math.max(s.right,o.right),bottom:Math.max(s.bottom,o.bottom)});let r=$n(this.view),i={left:s.left-r.left,top:s.top-r.top,right:s.right+r.right,bottom:s.bottom+r.bottom},{offsetWidth:n,offsetHeight:c}=this.view.scrollDOM;bg(this.view.scrollDOM,i,t.head<t.anchor?-1:1,e.x,e.y,Math.max(Math.min(e.xMargin,n),-n),Math.max(Math.min(e.yMargin,c),-c),this.view.textDirection==Re.LTR)}}function Rg(a){return a.node.nodeType==1&&a.node.firstChild&&(a.offset==0||a.node.childNodes[a.offset-1].contentEditable=="false")&&(a.offset==a.node.childNodes.length||a.node.childNodes[a.offset].contentEditable=="false")}function nu(a,e){let t=a.observer.selectionRange;if(!t.focusNode)return null;let s=Dp(t.focusNode,t.focusOffset),o=Tp(t.focusNode,t.focusOffset),r=s||o;if(o&&s&&o.node!=s.node){let n=Ne.get(o.node);if(!n||n instanceof Ct&&n.text!=o.node.nodeValue)r=o;else if(a.docView.lastCompositionAfterCursor){let c=Ne.get(s.node);!c||c instanceof Ct&&c.text!=s.node.nodeValue||(r=o)}}if(a.docView.lastCompositionAfterCursor=r!=s,!r)return null;let i=e-r.offset;return{from:i,to:i+r.node.nodeValue.length,node:r.node}}function Bg(a,e,t){let s=nu(a,t);if(!s)return null;let{node:o,from:r,to:i}=s,n=o.nodeValue;if(/[\n\r]/.test(n)||a.state.doc.sliceString(s.from,s.to)!=n)return null;let c=e.invertedDesc,l=new bt(c.mapPos(r),c.mapPos(i),r,i),d=[];for(let p=o.parentNode;;p=p.parentNode){let u=Ne.get(p);if(u instanceof Jt)d.push({node:p,deco:u.mark});else{if(u instanceof We||p.nodeName=="DIV"&&p.parentNode==a.contentDOM)return{range:l,text:o,marks:d,line:p};if(p!=a.contentDOM)d.push({node:p,deco:new fo({inclusive:!0,attributes:_g(p),tagName:p.tagName.toLowerCase()})});else return null}}}function zg(a,e){return a.nodeType!=1?0:(e&&a.childNodes[e-1].contentEditable=="false"?1:0)|(e<a.childNodes.length&&a.childNodes[e].contentEditable=="false"?2:0)}let Vg=class{constructor(){this.changes=[]}compareRange(e,t){Jo(e,t,this.changes)}comparePoint(e,t){Jo(e,t,this.changes)}boundChange(e){Jo(e,e,this.changes)}};function Wg(a,e,t){let s=new Vg;return Pe.compare(a,e,t,s),s.changes}function Hg(a,e){for(let t=a;t&&t!=e;t=t.assignedSlot||t.parentNode)if(t.nodeType==1&&t.contentEditable=="false")return!0;return!1}function $g(a,e){let t=!1;return e&&a.iterChangedRanges((s,o)=>{s<e.to&&o>e.from&&(t=!0)}),t}function Ug(a,e,t=1){let s=a.charCategorizer(e),o=a.doc.lineAt(e),r=e-o.from;if(o.length==0)return ae.cursor(e);r==0?t=1:r==o.length&&(t=-1);let i=r,n=r;t<0?i=Xe(o.text,r,!1):n=Xe(o.text,r);let c=s(o.text.slice(i,n));for(;i>0;){let l=Xe(o.text,i,!1);if(s(o.text.slice(l,i))!=c)break;i=l}for(;n<o.length;){let l=Xe(o.text,n);if(s(o.text.slice(n,l))!=c)break;n=l}return ae.range(i+o.from,n+o.from)}function qg(a,e){return e.left>a?e.left-a:Math.max(0,a-e.right)}function Kg(a,e){return e.top>a?e.top-a:Math.max(0,a-e.bottom)}function ai(a,e){return a.top<e.bottom-1&&a.bottom>e.top+1}function tl(a,e){return e<a.top?{top:e,left:a.left,right:a.right,bottom:a.bottom}:a}function al(a,e){return e>a.bottom?{top:a.top,left:a.left,right:a.right,bottom:e}:a}function en(a,e,t){let s,o,r,i,n=!1,c,l,d,p;for(let m=a.firstChild;m;m=m.nextSibling){let g=Ks(m);for(let x=0;x<g.length;x++){let b=g[x];o&&ai(o,b)&&(b=tl(al(b,o.bottom),o.top));let y=qg(e,b),k=Kg(t,b);if(y==0&&k==0)return m.nodeType==3?sl(m,e,t):en(m,e,t);if(!s||i>k||i==k&&r>y){s=m,o=b,r=y,i=k;let A=k?t<b.top?-1:1:y?e<b.left?-1:1:0;n=!A||(A>0?x<g.length-1:x>0)}y==0?t>b.bottom&&(!d||d.bottom<b.bottom)?(c=m,d=b):t<b.top&&(!p||p.top>b.top)&&(l=m,p=b):d&&ai(d,b)?d=al(d,b.bottom):p&&ai(p,b)&&(p=tl(p,b.top))}}if(d&&d.bottom>=t?(s=c,o=d):p&&p.top<=t&&(s=l,o=p),!s)return{node:a,offset:0};let u=Math.max(o.left,Math.min(o.right,e));if(s.nodeType==3)return sl(s,u,t);if(n&&s.contentEditable!="false")return en(s,u,t);let f=Array.prototype.indexOf.call(a.childNodes,s)+(e>=(o.left+o.right)/2?1:0);return{node:a,offset:f}}function sl(a,e,t){let s=a.nodeValue.length,o=-1,r=1e9,i=0;for(let n=0;n<s;n++){let c=La(a,n,n+1).getClientRects();for(let l=0;l<c.length;l++){let d=c[l];if(d.top==d.bottom)continue;i||(i=e-d.left);let p=(d.top>t?d.top-t:t-d.bottom)-1;if(d.left-1<=e&&d.right+1>=e&&p<r){let u=e>=(d.left+d.right)/2,f=u;if((he.chrome||he.gecko)&&La(a,n).getBoundingClientRect().left==d.right&&(f=!u),p<=0)return{node:a,offset:n+(f?1:0)};o=n+(f?1:0),r=p}}}return{node:a,offset:o>-1?o:i>0?a.nodeValue.length:0}}function cu(a,e,t,s=-1){var o,r;let i=a.contentDOM.getBoundingClientRect(),n=i.top+a.viewState.paddingTop,c,{docHeight:l}=a.viewState,{x:d,y:p}=e,u=p-n;if(u<0)return 0;if(u>l)return a.state.doc.length;for(let A=a.viewState.heightOracle.textHeight/2,S=!1;c=a.elementAtHeight(u),c.type!=it.Text;)for(;u=s>0?c.bottom+A:c.top-A,!(u>=0&&u<=l);){if(S)return t?null:0;S=!0,s=-s}p=n+u;let f=c.from;if(f<a.viewport.from)return a.viewport.from==0?0:t?null:ol(a,i,c,d,p);if(f>a.viewport.to)return a.viewport.to==a.state.doc.length?a.state.doc.length:t?null:ol(a,i,c,d,p);let m=a.dom.ownerDocument,g=a.root.elementFromPoint?a.root:m,x=g.elementFromPoint(d,p);x&&!a.contentDOM.contains(x)&&(x=null),x||(d=Math.max(i.left+1,Math.min(i.right-1,d)),x=g.elementFromPoint(d,p),x&&!a.contentDOM.contains(x)&&(x=null));let b,y=-1;if(x&&((o=a.docView.nearest(x))===null||o===void 0?void 0:o.isEditable)!=!1){if(m.caretPositionFromPoint){let A=m.caretPositionFromPoint(d,p);A&&({offsetNode:b,offset:y}=A)}else if(m.caretRangeFromPoint){let A=m.caretRangeFromPoint(d,p);A&&({startContainer:b,startOffset:y}=A,(!a.contentDOM.contains(b)||he.safari&&Gg(b,y,d)||he.chrome&&Yg(b,y,d))&&(b=void 0))}b&&(y=Math.min(Bt(b),y))}if(!b||!a.docView.dom.contains(b)){let A=We.find(a.docView,f);if(!A)return u>c.top+c.height/2?c.to:c.from;({node:b,offset:y}=en(A.dom,d,p))}let k=a.docView.nearest(b);if(!k)return null;if(k.isWidget&&((r=k.dom)===null||r===void 0?void 0:r.nodeType)==1){let A=k.dom.getBoundingClientRect();return e.y<A.top||e.y<=A.bottom&&e.x<=(A.left+A.right)/2?k.posAtStart:k.posAtEnd}else return k.localPosFromDOM(b,y)+k.posAtStart}function ol(a,e,t,s,o){let r=Math.round((s-e.left)*a.defaultCharacterWidth);if(a.lineWrapping&&t.height>a.defaultLineHeight*1.5){let n=a.viewState.heightOracle.textHeight,c=Math.floor((o-t.top-(a.defaultLineHeight-n)*.5)/n);r+=c*a.viewState.heightOracle.lineLength}let i=a.state.sliceDoc(t.from,t.to);return t.from+ug(i,r,a.state.tabSize)}function Gg(a,e,t){let s;if(a.nodeType!=3||e!=(s=a.nodeValue.length))return!1;for(let o=a.nextSibling;o;o=o.nextSibling)if(o.nodeType!=1||o.nodeName!="BR")return!1;return La(a,s-1,s).getBoundingClientRect().left>t}function Yg(a,e,t){if(e!=0)return!1;for(let o=a;;){let r=o.parentNode;if(!r||r.nodeType!=1||r.firstChild!=o)return!1;if(r.classList.contains("cm-line"))break;o=r}let s=a.nodeType==1?a.getBoundingClientRect():La(a,0,Math.max(a.nodeValue.length,1)).getBoundingClientRect();return t-s.left>5}function tn(a,e){let t=a.lineBlockAt(e);if(Array.isArray(t.type)){for(let s of t.type)if(s.to>e||s.to==e&&(s.to==t.to||s.type==it.Text))return s}return t}function Xg(a,e,t,s){let o=tn(a,e.head),r=!s||o.type!=it.Text||!(a.lineWrapping||o.widgetLineBreaks)?null:a.coordsAtPos(e.assoc<0&&e.head>o.from?e.head-1:e.head);if(r){let i=a.dom.getBoundingClientRect(),n=a.textDirectionAt(o.from),c=a.posAtCoords({x:t==(n==Re.LTR)?i.right-1:i.left+1,y:(r.top+r.bottom)/2});if(c!=null)return ae.cursor(c,t?-1:1)}return ae.cursor(t?o.to:o.from,t?-1:1)}function rl(a,e,t,s){let o=a.state.doc.lineAt(e.head),r=a.bidiSpans(o),i=a.textDirectionAt(o.from);for(let n=e,c=null;;){let l=Ig(o,r,i,n,t),d=qp;if(!l){if(o.number==(t?a.state.doc.lines:1))return n;d=` 44`,o=a.state.doc.line(o.number+(t?1:-1)),r=a.bidiSpans(o),l=a.visualLineSide(o,!t)}if(c){if(!c(d))return n}else{if(!s)return l;c=s(d)}n=l}}function Jg(a,e,t){let s=a.state.charCategorizer(e),o=s(t);return r=>{let i=s(r);return o==Fe.Space&&(o=i),o==i}}function Zg(a,e,t,s){let o=e.head,r=t?1:-1;if(o==(t?a.state.doc.length:0))return ae.cursor(o,e.assoc);let i=e.goalColumn,n,c=a.contentDOM.getBoundingClientRect(),l=a.coordsAtPos(o,e.assoc||-1),d=a.documentTop;if(l)i==null&&(i=l.left-c.left),n=r<0?l.top:l.bottom;else{let f=a.viewState.lineBlockAt(o);i==null&&(i=Math.min(c.right-c.left,a.defaultCharacterWidth*(o-f.from))),n=(r<0?f.top:f.bottom)+d}let p=c.left+i,u=s??a.viewState.heightOracle.textHeight>>1;for(let f=0;;f+=10){let m=n+(u+f)*r,g=cu(a,{x:p,y:m},!1,r);if(m<c.top||m>c.bottom||(r<0?g<o:g>o)){let x=a.docView.coordsForChar(g),b=!x||m<x.top?-1:1;return ae.cursor(g,b,void 0,i)}}}function Zo(a,e,t){for(;;){let s=0;for(let o of a)o.between(e-1,e+1,(r,i,n)=>{if(e>r&&e<i){let c=s||t||(e-r<i-e?-1:1);e=c<0?r:i,s=c}});if(!s)return e}}function si(a,e,t){let s=Zo(a.state.facet(Hn).map(o=>o(a)),t.from,e.head>t.from?-1:1);return s==t.from?t:ae.cursor(s,s<t.from?1:-1)}const Ps="ï¿¿";class Qg{constructor(e,t){this.points=e,this.text="",this.lineSeparator=t.facet(_e.lineSeparator)}append(e){this.text+=e}lineBreak(){this.text+=Ps}readRange(e,t){if(!e)return this;let s=e.parentNode;for(let o=e;;){this.findPointBefore(s,o);let r=this.text.length;this.readNode(o);let i=o.nextSibling;if(i==t)break;let n=Ne.get(o),c=Ne.get(i);(n&&c?n.breakAfter:(n?n.breakAfter:pr(o))||pr(i)&&(o.nodeName!="BR"||o.cmIgnore)&&this.text.length>r)&&this.lineBreak(),o=i}return this.findPointBefore(s,t),this}readTextNode(e){let t=e.nodeValue;for(let s of this.points)s.node==e&&(s.pos=this.text.length+Math.min(s.offset,t.length));for(let s=0,o=this.lineSeparator?null:/\r\n?|\n/g;;){let r=-1,i=1,n;if(this.lineSeparator?(r=t.indexOf(this.lineSeparator,s),i=this.lineSeparator.length):(n=o.exec(t))&&(r=n.index,i=n[0].length),this.append(t.slice(s,r<0?t.length:r)),r<0)break;if(this.lineBreak(),i>1)for(let c of this.points)c.node==e&&c.pos>this.text.length&&(c.pos-=i-1);s=r+i}}readNode(e){if(e.cmIgnore)return;let t=Ne.get(e),s=t&&t.overrideDOMText;if(s!=null){this.findPointInside(e,s.length);for(let o=s.iter();!o.next().done;)o.lineBreak?this.lineBreak():this.append(o.value)}else e.nodeType==3?this.readTextNode(e):e.nodeName=="BR"?e.nextSibling&&this.lineBreak():e.nodeType==1&&this.readRange(e.firstChild,null)}findPointBefore(e,t){for(let s of this.points)s.node==e&&e.childNodes[s.offset]==t&&(s.pos=this.text.length)}findPointInside(e,t){for(let s of this.points)(e.nodeType==3?s.node==e:e.contains(s.node))&&(s.pos=this.text.length+(ex(e,s.node,s.offset)?t:0))}}function ex(a,e,t){for(;;){if(!e||t<Bt(e))return!1;if(e==a)return!0;t=Na(e)+1,e=e.parentNode}}class il{constructor(e,t){this.node=e,this.offset=t,this.pos=-1}}class tx{constructor(e,t,s,o){this.typeOver=o,this.bounds=null,this.text="",this.domChanged=t>-1;let{impreciseHead:r,impreciseAnchor:i}=e.docView;if(e.state.readOnly&&t>-1)this.newSel=null;else if(t>-1&&(this.bounds=e.docView.domBoundsAround(t,s,0))){let n=r||i?[]:ox(e),c=new Qg(n,e.state);c.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=c.text,this.newSel=rx(n,this.bounds.from)}else{let n=e.observer.selectionRange,c=r&&r.node==n.focusNode&&r.offset==n.focusOffset||!Hi(e.contentDOM,n.focusNode)?e.state.selection.main.head:e.docView.posFromDOM(n.focusNode,n.focusOffset),l=i&&i.node==n.anchorNode&&i.offset==n.anchorOffset||!Hi(e.contentDOM,n.anchorNode)?e.state.selection.main.anchor:e.docView.posFromDOM(n.anchorNode,n.anchorOffset),d=e.viewport;if((he.ios||he.chrome)&&e.state.selection.main.empty&&c!=l&&(d.from>0||d.to<e.state.doc.length)){let p=Math.min(c,l),u=Math.max(c,l),f=d.from-p,m=d.to-u;(f==0||f==1||p==0)&&(m==0||m==-1||u==e.state.doc.length)&&(c=0,l=e.state.doc.length)}this.newSel=ae.single(l,c)}}}function lu(a,e){let t,{newSel:s}=e,o=a.state.selection.main,r=a.inputState.lastKeyTime>Date.now()-100?a.inputState.lastKeyCode:-1;if(e.bounds){let{from:i,to:n}=e.bounds,c=o.from,l=null;(r===8||he.android&&e.text.length<n-i)&&(c=o.to,l="end");let d=sx(a.state.doc.sliceString(i,n,Ps),e.text,c-i,l);d&&(he.chrome&&r==13&&d.toB==d.from+2&&e.text.slice(d.from,d.toB)==Ps+Ps&&d.toB--,t={from:i+d.from,to:i+d.toA,insert:Se.of(e.text.slice(d.from,d.toB).split(Ps))})}else s&&(!a.hasFocus&&a.state.facet(qt)||s.main.eq(o))&&(s=null);if(!t&&!s)return!1;if(!t&&e.typeOver&&!o.empty&&s&&s.main.empty?t={from:o.from,to:o.to,insert:a.state.doc.slice(o.from,o.to)}:(he.mac||he.android)&&t&&t.from==t.to&&t.from==o.head-1&&/^\. ?$/.test(t.insert.toString())&&a.contentDOM.getAttribute("autocorrect")=="off"?(s&&t.insert.length==2&&(s=ae.single(s.main.anchor-1,s.main.head-1)),t={from:t.from,to:t.to,insert:Se.of([t.insert.toString().replace("."," ")])}):t&&t.from>=o.from&&t.to<=o.to&&(t.from!=o.from||t.to!=o.to)&&o.to-o.from-(t.to-t.from)<=4?t={from:o.from,to:o.to,insert:a.state.doc.slice(o.from,t.from).append(t.insert).append(a.state.doc.slice(t.to,o.to))}:he.chrome&&t&&t.from==t.to&&t.from==o.head&&t.insert.toString()==` 45 `&&a.lineWrapping&&(s&&(s=ae.single(s.main.anchor-1,s.main.head-1)),t={from:o.from,to:o.to,insert:Se.of([" "])}),t)return Un(a,t,s,r);if(s&&!s.main.eq(o)){let i=!1,n="select";return a.inputState.lastSelectionTime>Date.now()-50&&(a.inputState.lastSelectionOrigin=="select"&&(i=!0),n=a.inputState.lastSelectionOrigin),a.dispatch({selection:s,scrollIntoView:i,userEvent:n}),!0}else return!1}function Un(a,e,t,s=-1){if(he.ios&&a.inputState.flushIOSKey(e))return!0;let o=a.state.selection.main;if(he.android&&(e.to==o.to&&(e.from==o.from||e.from==o.from-1&&a.state.sliceDoc(e.from,o.from)==" ")&&e.insert.length==1&&e.insert.lines==2&&qa(a.contentDOM,"Enter",13)||(e.from==o.from-1&&e.to==o.to&&e.insert.length==0||s==8&&e.insert.length<e.to-e.from&&e.to>o.head)&&qa(a.contentDOM,"Backspace",8)||e.from==o.from&&e.to==o.to+1&&e.insert.length==0&&qa(a.contentDOM,"Delete",46)))return!0;let r=e.insert.toString();a.inputState.composing>=0&&a.inputState.composing++;let i,n=()=>i||(i=ax(a,e,t));return a.state.facet(Jp).some(c=>c(a,e.from,e.to,r,n))||a.dispatch(n()),!0}function ax(a,e,t){let s,o=a.state,r=o.selection.main;if(e.from>=r.from&&e.to<=r.to&&e.to-e.from>=(r.to-r.from)/3&&(!t||t.main.empty&&t.main.from==e.from+e.insert.length)&&a.inputState.composing<0){let n=r.from<e.from?o.sliceDoc(r.from,e.from):"",c=r.to>e.to?o.sliceDoc(e.to,r.to):"";s=o.replaceSelection(a.state.toText(n+e.insert.sliceString(0,void 0,a.state.lineBreak)+c))}else{let n=o.changes(e),c=t&&t.main.to<=n.newLength?t.main:void 0;if(o.selection.ranges.length>1&&a.inputState.composing>=0&&e.to<=r.to&&e.to>=r.to-10){let l=a.state.sliceDoc(e.from,e.to),d,p=t&&nu(a,t.main.head);if(p){let m=e.insert.length-(e.to-e.from);d={from:p.from,to:p.to-m}}else d=a.state.doc.lineAt(r.head);let u=r.to-e.to,f=r.to-r.from;s=o.changeByRange(m=>{if(m.from==r.from&&m.to==r.to)return{changes:n,range:c||m.map(n)};let g=m.to-u,x=g-l.length;if(m.to-m.from!=f||a.state.sliceDoc(x,g)!=l||m.to>=d.from&&m.from<=d.to)return{range:m};let b=o.changes({from:x,to:g,insert:e.insert}),y=m.to-r.to;return{changes:b,range:c?ae.range(Math.max(0,c.anchor+y),Math.max(0,c.head+y)):m.map(b)}})}else s={changes:n,selection:c&&o.selection.replaceRange(c)}}let i="input.type";return(a.composing||a.inputState.compositionPendingChange&&a.inputState.compositionEndedAt>Date.now()-50)&&(a.inputState.compositionPendingChange=!1,i+=".compose",a.inputState.compositionFirstChange&&(i+=".start",a.inputState.compositionFirstChange=!1)),o.update(s,{userEvent:i,scrollIntoView:!0})}function sx(a,e,t,s){let o=Math.min(a.length,e.length),r=0;for(;r<o&&a.charCodeAt(r)==e.charCodeAt(r);)r++;if(r==o&&a.length==e.length)return null;let i=a.length,n=e.length;for(;i>0&&n>0&&a.charCodeAt(i-1)==e.charCodeAt(n-1);)i--,n--;if(s=="end"){let c=Math.max(0,r-Math.min(i,n));t-=i+c-r}if(i<r&&a.length<e.length){let c=t<=r&&t>=i?r-t:0;r-=c,n=r+(n-i),i=r}else if(n<r){let c=t<=r&&t>=n?r-t:0;r-=c,i=r+(i-n),n=r}return{from:r,toA:i,toB:n}}function ox(a){let e=[];if(a.root.activeElement!=a.contentDOM)return e;let{anchorNode:t,anchorOffset:s,focusNode:o,focusOffset:r}=a.observer.selectionRange;return t&&(e.push(new il(t,s)),(o!=t||r!=s)&&e.push(new il(o,r))),e}function rx(a,e){if(a.length==0)return null;let t=a[0].pos,s=a.length==2?a[1].pos:t;return t>-1&&s>-1?ae.single(t+e,s+e):null}class ix{setSelectionOrigin(e){this.lastSelectionOrigin=e,this.lastSelectionTime=Date.now()}constructor(e){this.view=e,this.lastKeyCode=0,this.lastKeyTime=0,this.lastTouchTime=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.pendingIOSKey=void 0,this.tabFocusMode=-1,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastContextMenu=0,this.scrollHandlers=[],this.handlers=Object.create(null),this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.compositionPendingKey=!1,this.compositionPendingChange=!1,this.mouseSelection=null,this.draggedContent=null,this.handleEvent=this.handleEvent.bind(this),this.notifiedFocused=e.hasFocus,he.safari&&e.contentDOM.addEventListener("input",()=>null),he.gecko&&yx(e.contentDOM.ownerDocument)}handleEvent(e){!fx(this.view,e)||this.ignoreDuringComposition(e)||e.type=="keydown"&&this.keydown(e)||(this.view.updateState!=0?Promise.resolve().then(()=>this.runHandlers(e.type,e)):this.runHandlers(e.type,e))}runHandlers(e,t){let s=this.handlers[e];if(s){for(let o of s.observers)o(this.view,t);for(let o of s.handlers){if(t.defaultPrevented)break;if(o(this.view,t)){t.preventDefault();break}}}}ensureHandlers(e){let t=nx(e),s=this.handlers,o=this.view.contentDOM;for(let r in t)if(r!="scroll"){let i=!t[r].handlers.length,n=s[r];n&&i!=!n.handlers.length&&(o.removeEventListener(r,this.handleEvent),n=null),n||o.addEventListener(r,this.handleEvent,{passive:i})}for(let r in s)r!="scroll"&&!t[r]&&o.removeEventListener(r,this.handleEvent);this.handlers=t}keydown(e){if(this.lastKeyCode=e.keyCode,this.lastKeyTime=Date.now(),e.keyCode==9&&this.tabFocusMode>-1&&(!this.tabFocusMode||Date.now()<=this.tabFocusMode))return!0;if(this.tabFocusMode>0&&e.keyCode!=27&&pu.indexOf(e.keyCode)<0&&(this.tabFocusMode=-1),he.android&&he.chrome&&!e.synthetic&&(e.keyCode==13||e.keyCode==8))return this.view.observer.delayAndroidKey(e.key,e.keyCode),!0;let t;return he.ios&&!e.synthetic&&!e.altKey&&!e.metaKey&&((t=du.find(s=>s.keyCode==e.keyCode))&&!e.ctrlKey||cx.indexOf(e.key)>-1&&e.ctrlKey&&!e.shiftKey)?(this.pendingIOSKey=t||e,setTimeout(()=>this.flushIOSKey(),250),!0):(e.keyCode!=229&&this.view.observer.forceFlush(),!1)}flushIOSKey(e){let t=this.pendingIOSKey;return!t||t.key=="Enter"&&e&&e.from<e.to&&/^\S+$/.test(e.insert.toString())?!1:(this.pendingIOSKey=void 0,qa(this.view.contentDOM,t.key,t.keyCode,t instanceof KeyboardEvent?t:void 0))}ignoreDuringComposition(e){return/^key/.test(e.type)?this.composing>0?!0:he.safari&&!he.ios&&this.compositionPendingKey&&Date.now()-this.compositionEndedAt<100?(this.compositionPendingKey=!1,!0):!1:!1}startMouseSelection(e){this.mouseSelection&&this.mouseSelection.destroy(),this.mouseSelection=e}update(e){this.view.observer.update(e),this.mouseSelection&&this.mouseSelection.update(e),this.draggedContent&&e.docChanged&&(this.draggedContent=this.draggedContent.map(e.changes)),e.transactions.length&&(this.lastKeyCode=this.lastSelectionTime=0)}destroy(){this.mouseSelection&&this.mouseSelection.destroy()}}function nl(a,e){return(t,s)=>{try{return e.call(a,s,t)}catch(o){kt(t.state,o)}}}function nx(a){let e=Object.create(null);function t(s){return e[s]||(e[s]={observers:[],handlers:[]})}for(let s of a){let o=s.spec;if(o&&o.domEventHandlers)for(let r in o.domEventHandlers){let i=o.domEventHandlers[r];i&&t(r).handlers.push(nl(s.value,i))}if(o&&o.domEventObservers)for(let r in o.domEventObservers){let i=o.domEventObservers[r];i&&t(r).observers.push(nl(s.value,i))}}for(let s in St)t(s).handlers.push(St[s]);for(let s in vt)t(s).observers.push(vt[s]);return e}const du=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],cx="dthko",pu=[16,17,18,20,91,92,224,225],Eo=6;function Do(a){return Math.max(0,a)*.7+8}function lx(a,e){return Math.max(Math.abs(a.clientX-e.clientX),Math.abs(a.clientY-e.clientY))}class dx{constructor(e,t,s,o){this.view=e,this.startEvent=t,this.style=s,this.mustSelect=o,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=t,this.scrollParents=vg(e.contentDOM),this.atoms=e.state.facet(Hn).map(i=>i(e));let r=e.contentDOM.ownerDocument;r.addEventListener("mousemove",this.move=this.move.bind(this)),r.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=t.shiftKey,this.multiple=e.state.facet(_e.allowMultipleSelections)&&px(e,t),this.dragging=hx(e,t)&&fu(t)==1?null:!1}start(e){this.dragging===!1&&this.select(e)}move(e){if(e.buttons==0)return this.destroy();if(this.dragging||this.dragging==null&&lx(this.startEvent,e)<10)return;this.select(this.lastEvent=e);let t=0,s=0,o=0,r=0,i=this.view.win.innerWidth,n=this.view.win.innerHeight;this.scrollParents.x&&({left:o,right:i}=this.scrollParents.x.getBoundingClientRect()),this.scrollParents.y&&({top:r,bottom:n}=this.scrollParents.y.getBoundingClientRect());let c=$n(this.view);e.clientX-c.left<=o+Eo?t=-Do(o-e.clientX):e.clientX+c.right>=i-Eo&&(t=Do(e.clientX-i)),e.clientY-c.top<=r+Eo?s=-Do(r-e.clientY):e.clientY+c.bottom>=n-Eo&&(s=Do(e.clientY-n)),this.setScrollSpeed(t,s)}up(e){this.dragging==null&&this.select(this.lastEvent),this.dragging||e.preventDefault(),this.destroy()}destroy(){this.setScrollSpeed(0,0);let e=this.view.contentDOM.ownerDocument;e.removeEventListener("mousemove",this.move),e.removeEventListener("mouseup",this.up),this.view.inputState.mouseSelection=this.view.inputState.draggedContent=null}setScrollSpeed(e,t){this.scrollSpeed={x:e,y:t},e||t?this.scrolling<0&&(this.scrolling=setInterval(()=>this.scroll(),50)):this.scrolling>-1&&(clearInterval(this.scrolling),this.scrolling=-1)}scroll(){let{x:e,y:t}=this.scrollSpeed;e&&this.scrollParents.x&&(this.scrollParents.x.scrollLeft+=e,e=0),t&&this.scrollParents.y&&(this.scrollParents.y.scrollTop+=t,t=0),(e||t)&&this.view.win.scrollBy(e,t),this.dragging===!1&&this.select(this.lastEvent)}skipAtoms(e){let t=null;for(let s=0;s<e.ranges.length;s++){let o=e.ranges[s],r=null;if(o.empty){let i=Zo(this.atoms,o.from,0);i!=o.from&&(r=ae.cursor(i,-1))}else{let i=Zo(this.atoms,o.from,-1),n=Zo(this.atoms,o.to,1);(i!=o.from||n!=o.to)&&(r=ae.range(o.from==o.anchor?i:n,o.from==o.head?i:n))}r&&(t||(t=e.ranges.slice()),t[s]=r)}return t?ae.create(t,e.mainIndex):e}select(e){let{view:t}=this,s=this.skipAtoms(this.style.get(e,this.extend,this.multiple));(this.mustSelect||!s.eq(t.state.selection,this.dragging===!1))&&this.view.dispatch({selection:s,userEvent:"select.pointer"}),this.mustSelect=!1}update(e){e.transactions.some(t=>t.isUserEvent("input.type"))?this.destroy():this.style.update(e)&&setTimeout(()=>this.select(this.lastEvent),20)}}function px(a,e){let t=a.state.facet(Kp);return t.length?t[0](e):he.mac?e.metaKey:e.ctrlKey}function ux(a,e){let t=a.state.facet(Gp);return t.length?t[0](e):he.mac?!e.altKey:!e.ctrlKey}function hx(a,e){let{main:t}=a.state.selection;if(t.empty)return!1;let s=qs(a.root);if(!s||s.rangeCount==0)return!0;let o=s.getRangeAt(0).getClientRects();for(let r=0;r<o.length;r++){let i=o[r];if(i.left<=e.clientX&&i.right>=e.clientX&&i.top<=e.clientY&&i.bottom>=e.clientY)return!0}return!1}function fx(a,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let t=e.target,s;t!=a.contentDOM;t=t.parentNode)if(!t||t.nodeType==11||(s=Ne.get(t))&&s.ignoreEvent(e))return!1;return!0}const St=Object.create(null),vt=Object.create(null),uu=he.ie&&he.ie_version<15||he.ios&&he.webkit_version<604;function mx(a){let e=a.dom.parentNode;if(!e)return;let t=e.appendChild(document.createElement("textarea"));t.style.cssText="position: fixed; left: -10000px; top: 10px",t.focus(),setTimeout(()=>{a.focus(),t.remove(),hu(a,t.value)},50)}function Ir(a,e,t){for(let s of a.facet(e))t=s(t,a);return t}function hu(a,e){e=Ir(a.state,zn,e);let{state:t}=a,s,o=1,r=t.toText(e),i=r.lines==t.selection.ranges.length;if(an!=null&&t.selection.ranges.every(c=>c.empty)&&an==r.toString()){let c=-1;s=t.changeByRange(l=>{let d=t.doc.lineAt(l.from);if(d.from==c)return{range:l};c=d.from;let p=t.toText((i?r.line(o++).text:e)+t.lineBreak);return{changes:{from:d.from,insert:p},range:ae.cursor(l.from+p.length)}})}else i?s=t.changeByRange(c=>{let l=r.line(o++);return{changes:{from:c.from,to:c.to,insert:l.text},range:ae.cursor(c.from+l.length)}}):s=t.replaceSelection(r);a.dispatch(s,{userEvent:"input.paste",scrollIntoView:!0})}vt.scroll=a=>{a.inputState.lastScrollTop=a.scrollDOM.scrollTop,a.inputState.lastScrollLeft=a.scrollDOM.scrollLeft};St.keydown=(a,e)=>(a.inputState.setSelectionOrigin("select"),e.keyCode==27&&a.inputState.tabFocusMode!=0&&(a.inputState.tabFocusMode=Date.now()+2e3),!1);vt.touchstart=(a,e)=>{a.inputState.lastTouchTime=Date.now(),a.inputState.setSelectionOrigin("select.pointer")};vt.touchmove=a=>{a.inputState.setSelectionOrigin("select.pointer")};St.mousedown=(a,e)=>{if(a.observer.flush(),a.inputState.lastTouchTime>Date.now()-2e3)return!1;let t=null;for(let s of a.state.facet(Yp))if(t=s(a,e),t)break;if(!t&&e.button==0&&(t=bx(a,e)),t){let s=!a.hasFocus;a.inputState.startMouseSelection(new dx(a,e,t,s)),s&&a.observer.ignore(()=>{Ap(a.contentDOM);let r=a.root.activeElement;r&&!r.contains(a.contentDOM)&&r.blur()});let o=a.inputState.mouseSelection;if(o)return o.start(e),o.dragging===!1}return!1};function cl(a,e,t,s){if(s==1)return ae.cursor(e,t);if(s==2)return Ug(a.state,e,t);{let o=We.find(a.docView,e),r=a.state.doc.lineAt(o?o.posAtEnd:e),i=o?o.posAtStart:r.from,n=o?o.posAtEnd:r.to;return n<a.state.doc.length&&n==r.to&&n++,ae.range(i,n)}}let ll=(a,e,t)=>e>=t.top&&e<=t.bottom&&a>=t.left&&a<=t.right;function gx(a,e,t,s){let o=We.find(a.docView,e);if(!o)return 1;let r=e-o.posAtStart;if(r==0)return 1;if(r==o.length)return-1;let i=o.coordsAt(r,-1);if(i&&ll(t,s,i))return-1;let n=o.coordsAt(r,1);return n&&ll(t,s,n)?1:i&&i.bottom>=s?-1:1}function dl(a,e){let t=a.posAtCoords({x:e.clientX,y:e.clientY},!1);return{pos:t,bias:gx(a,t,e.clientX,e.clientY)}}const xx=he.ie&&he.ie_version<=11;let pl=null,ul=0,hl=0;function fu(a){if(!xx)return a.detail;let e=pl,t=hl;return pl=a,hl=Date.now(),ul=!e||t>Date.now()-400&&Math.abs(e.clientX-a.clientX)<2&&Math.abs(e.clientY-a.clientY)<2?(ul+1)%3:1}function bx(a,e){let t=dl(a,e),s=fu(e),o=a.state.selection;return{update(r){r.docChanged&&(t.pos=r.changes.mapPos(t.pos),o=o.map(r.changes))},get(r,i,n){let c=dl(a,r),l,d=cl(a,c.pos,c.bias,s);if(t.pos!=c.pos&&!i){let p=cl(a,t.pos,t.bias,s),u=Math.min(p.from,d.from),f=Math.max(p.to,d.to);d=u<d.from?ae.range(u,f):ae.range(f,u)}return i?o.replaceRange(o.main.extend(d.from,d.to)):n&&s==1&&o.ranges.length>1&&(l=vx(o,c.pos))?l:n?o.addRange(d):ae.create([d])}}}function vx(a,e){for(let t=0;t<a.ranges.length;t++){let{from:s,to:o}=a.ranges[t];if(s<=e&&o>=e)return ae.create(a.ranges.slice(0,t).concat(a.ranges.slice(t+1)),a.mainIndex==t?0:a.mainIndex-(a.mainIndex>t?1:0))}return null}St.dragstart=(a,e)=>{let{selection:{main:t}}=a.state;if(e.target.draggable){let o=a.docView.nearest(e.target);if(o&&o.isWidget){let r=o.posAtStart,i=r+o.length;(r>=t.to||i<=t.from)&&(t=ae.range(r,i))}}let{inputState:s}=a;return s.mouseSelection&&(s.mouseSelection.dragging=!0),s.draggedContent=t,e.dataTransfer&&(e.dataTransfer.setData("Text",Ir(a.state,Vn,a.state.sliceDoc(t.from,t.to))),e.dataTransfer.effectAllowed="copyMove"),!1};St.dragend=a=>(a.inputState.draggedContent=null,!1);function fl(a,e,t,s){if(t=Ir(a.state,zn,t),!t)return;let o=a.posAtCoords({x:e.clientX,y:e.clientY},!1),{draggedContent:r}=a.inputState,i=s&&r&&ux(a,e)?{from:r.from,to:r.to}:null,n={from:o,insert:t},c=a.state.changes(i?[i,n]:n);a.focus(),a.dispatch({changes:c,selection:{anchor:c.mapPos(o,-1),head:c.mapPos(o,1)},userEvent:i?"move.drop":"input.drop"}),a.inputState.draggedContent=null}St.drop=(a,e)=>{if(!e.dataTransfer)return!1;if(a.state.readOnly)return!0;let t=e.dataTransfer.files;if(t&&t.length){let s=Array(t.length),o=0,r=()=>{++o==t.length&&fl(a,e,s.filter(i=>i!=null).join(a.state.lineBreak),!1)};for(let i=0;i<t.length;i++){let n=new FileReader;n.onerror=r,n.onload=()=>{/[\x00-\x08\x0e-\x1f]{2}/.test(n.result)||(s[i]=n.result),r()},n.readAsText(t[i])}return!0}else{let s=e.dataTransfer.getData("Text");if(s)return fl(a,e,s,!0),!0}return!1};St.paste=(a,e)=>{if(a.state.readOnly)return!0;a.observer.flush();let t=uu?null:e.clipboardData;return t?(hu(a,t.getData("text/plain")||t.getData("text/uri-list")),!0):(mx(a),!1)};function jx(a,e){let t=a.dom.parentNode;if(!t)return;let s=t.appendChild(document.createElement("textarea"));s.style.cssText="position: fixed; left: -10000px; top: 10px",s.value=e,s.focus(),s.selectionEnd=e.length,s.selectionStart=0,setTimeout(()=>{s.remove(),a.focus()},50)}function wx(a){let e=[],t=[],s=!1;for(let o of a.selection.ranges)o.empty||(e.push(a.sliceDoc(o.from,o.to)),t.push(o));if(!e.length){let o=-1;for(let{from:r}of a.selection.ranges){let i=a.doc.lineAt(r);i.number>o&&(e.push(i.text),t.push({from:i.from,to:Math.min(a.doc.length,i.to+1)})),o=i.number}s=!0}return{text:Ir(a,Vn,e.join(a.lineBreak)),ranges:t,linewise:s}}let an=null;St.copy=St.cut=(a,e)=>{let{text:t,ranges:s,linewise:o}=wx(a.state);if(!t&&!o)return!1;an=o?t:null,e.type=="cut"&&!a.state.readOnly&&a.dispatch({changes:s,scrollIntoView:!0,userEvent:"delete.cut"});let r=uu?null:e.clipboardData;return r?(r.clearData(),r.setData("text/plain",t),!0):(jx(a,t),!1)};const mu=Zt.define();function gu(a,e){let t=[];for(let s of a.facet(Zp)){let o=s(a,e);o&&t.push(o)}return t?a.update({effects:t,annotations:mu.of(!0)}):null}function xu(a){setTimeout(()=>{let e=a.hasFocus;if(e!=a.inputState.notifiedFocused){let t=gu(a.state,e);t?a.dispatch(t):a.update([])}},10)}vt.focus=a=>{a.inputState.lastFocusTime=Date.now(),!a.scrollDOM.scrollTop&&(a.inputState.lastScrollTop||a.inputState.lastScrollLeft)&&(a.scrollDOM.scrollTop=a.inputState.lastScrollTop,a.scrollDOM.scrollLeft=a.inputState.lastScrollLeft),xu(a)};vt.blur=a=>{a.observer.clearSelectionRange(),xu(a)};vt.compositionstart=vt.compositionupdate=a=>{a.observer.editContext||(a.inputState.compositionFirstChange==null&&(a.inputState.compositionFirstChange=!0),a.inputState.composing<0&&(a.inputState.composing=0))};vt.compositionend=a=>{a.observer.editContext||(a.inputState.composing=-1,a.inputState.compositionEndedAt=Date.now(),a.inputState.compositionPendingKey=!0,a.inputState.compositionPendingChange=a.observer.pendingRecords().length>0,a.inputState.compositionFirstChange=null,he.chrome&&he.android?a.observer.flushSoon():a.inputState.compositionPendingChange?Promise.resolve().then(()=>a.observer.flush()):setTimeout(()=>{a.inputState.composing<0&&a.docView.hasComposition&&a.update([])},50))};vt.contextmenu=a=>{a.inputState.lastContextMenu=Date.now()};St.beforeinput=(a,e)=>{var t,s;if(e.inputType=="insertReplacementText"&&a.observer.editContext){let r=(t=e.dataTransfer)===null||t===void 0?void 0:t.getData("text/plain"),i=e.getTargetRanges();if(r&&i.length){let n=i[0],c=a.posAtDOM(n.startContainer,n.startOffset),l=a.posAtDOM(n.endContainer,n.endOffset);return Un(a,{from:c,to:l,insert:a.state.toText(r)},null),!0}}let o;if(he.chrome&&he.android&&(o=du.find(r=>r.inputType==e.inputType))&&(a.observer.delayAndroidKey(o.key,o.keyCode),o.key=="Backspace"||o.key=="Delete")){let r=((s=window.visualViewport)===null||s===void 0?void 0:s.height)||0;setTimeout(()=>{var i;(((i=window.visualViewport)===null||i===void 0?void 0:i.height)||0)>r+10&&a.hasFocus&&(a.contentDOM.blur(),a.focus())},100)}return he.ios&&e.inputType=="deleteContentForward"&&a.observer.flushSoon(),he.safari&&e.inputType=="insertText"&&a.inputState.composing>=0&&setTimeout(()=>vt.compositionend(a,e),20),!1};const ml=new Set;function yx(a){ml.has(a)||(ml.add(a),a.addEventListener("copy",()=>{}),a.addEventListener("cut",()=>{}))}const gl=["pre-wrap","normal","pre-line","break-spaces"];let Qa=!1;function xl(){Qa=!1}class kx{constructor(e){this.lineWrapping=e,this.doc=Se.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30}heightForGap(e,t){let s=this.doc.lineAt(t).number-this.doc.lineAt(e).number+1;return this.lineWrapping&&(s+=Math.max(0,Math.ceil((t-e-s*this.lineLength*.5)/this.lineLength))),this.lineHeight*s}heightForLine(e){return this.lineWrapping?(1+Math.max(0,Math.ceil((e-this.lineLength)/(this.lineLength-5))))*this.lineHeight:this.lineHeight}setDoc(e){return this.doc=e,this}mustRefreshForWrapping(e){return gl.indexOf(e)>-1!=this.lineWrapping}mustRefreshForHeights(e){let t=!1;for(let s=0;s<e.length;s++){let o=e[s];o<0?s++:this.heightSamples[Math.floor(o*10)]||(t=!0,this.heightSamples[Math.floor(o*10)]=!0)}return t}refresh(e,t,s,o,r,i){let n=gl.indexOf(e)>-1,c=Math.round(t)!=Math.round(this.lineHeight)||this.lineWrapping!=n;if(this.lineWrapping=n,this.lineHeight=t,this.charWidth=s,this.textHeight=o,this.lineLength=r,c){this.heightSamples={};for(let l=0;l<i.length;l++){let d=i[l];d<0?l++:this.heightSamples[Math.floor(d*10)]=!0}}return c}}class Cx{constructor(e,t){this.from=e,this.heights=t,this.index=0}get more(){return this.index<this.heights.length}}class Lt{constructor(e,t,s,o,r){this.from=e,this.length=t,this.top=s,this.height=o,this._content=r}get type(){return typeof this._content=="number"?it.Text:Array.isArray(this._content)?this._content:this._content.type}get to(){return this.from+this.length}get bottom(){return this.top+this.height}get widget(){return this._content instanceof ma?this._content.widget:null}get widgetLineBreaks(){return typeof this._content=="number"?this._content:0}join(e){let t=(Array.isArray(this._content)?this._content:[this]).concat(Array.isArray(e._content)?e._content:[e]);return new Lt(this.from,this.length+e.length,this.top,this.height+e.height,t)}}var Oe=(function(a){return a[a.ByPos=0]="ByPos",a[a.ByHeight=1]="ByHeight",a[a.ByPosNoHeight=2]="ByPosNoHeight",a})(Oe||(Oe={}));const Qo=.001;class nt{constructor(e,t,s=2){this.length=e,this.height=t,this.flags=s}get outdated(){return(this.flags&2)>0}set outdated(e){this.flags=(e?2:0)|this.flags&-3}setHeight(e){this.height!=e&&(Math.abs(this.height-e)>Qo&&(Qa=!0),this.height=e)}replace(e,t,s){return nt.of(s)}decomposeLeft(e,t){t.push(this)}decomposeRight(e,t){t.push(this)}applyChanges(e,t,s,o){let r=this,i=s.doc;for(let n=o.length-1;n>=0;n--){let{fromA:c,toA:l,fromB:d,toB:p}=o[n],u=r.lineAt(c,Oe.ByPosNoHeight,s.setDoc(t),0,0),f=u.to>=l?u:r.lineAt(l,Oe.ByPosNoHeight,s,0,0);for(p+=f.to-l,l=f.to;n>0&&u.from<=o[n-1].toA;)c=o[n-1].fromA,d=o[n-1].fromB,n--,c<u.from&&(u=r.lineAt(c,Oe.ByPosNoHeight,s,0,0));d+=u.from-c,c=u.from;let m=qn.build(s.setDoc(i),e,d,p);r=fr(r,r.replace(c,l,m))}return r.updateHeight(s,0)}static empty(){return new ut(0,0)}static of(e){if(e.length==1)return e[0];let t=0,s=e.length,o=0,r=0;for(;;)if(t==s)if(o>r*2){let n=e[t-1];n.break?e.splice(--t,1,n.left,null,n.right):e.splice(--t,1,n.left,n.right),s+=1+n.break,o-=n.size}else if(r>o*2){let n=e[s];n.break?e.splice(s,1,n.left,null,n.right):e.splice(s,1,n.left,n.right),s+=2+n.break,r-=n.size}else break;else if(o<r){let n=e[t++];n&&(o+=n.size)}else{let n=e[--s];n&&(r+=n.size)}let i=0;return e[t-1]==null?(i=1,t--):e[t]==null&&(i=1,s++),new Sx(nt.of(e.slice(0,t)),i,nt.of(e.slice(s)))}}function fr(a,e){return a==e?a:(a.constructor!=e.constructor&&(Qa=!0),e)}nt.prototype.size=1;class bu extends nt{constructor(e,t,s){super(e,t),this.deco=s}blockAt(e,t,s,o){return new Lt(o,this.length,s,this.height,this.deco||0)}lineAt(e,t,s,o,r){return this.blockAt(0,s,o,r)}forEachLine(e,t,s,o,r,i){e<=r+this.length&&t>=r&&i(this.blockAt(0,s,o,r))}updateHeight(e,t=0,s=!1,o){return o&&o.from<=t&&o.more&&this.setHeight(o.heights[o.index++]),this.outdated=!1,this}toString(){return`block(${this.length})`}}class ut extends bu{constructor(e,t){super(e,t,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0}blockAt(e,t,s,o){return new Lt(o,this.length,s,this.height,this.breaks)}replace(e,t,s){let o=s[0];return s.length==1&&(o instanceof ut||o instanceof Ke&&o.flags&4)&&Math.abs(this.length-o.length)<10?(o instanceof Ke?o=new ut(o.length,this.height):o.height=this.height,this.outdated||(o.outdated=!1),o):nt.of(s)}updateHeight(e,t=0,s=!1,o){return o&&o.from<=t&&o.more?this.setHeight(o.heights[o.index++]):(s||this.outdated)&&this.setHeight(Math.max(this.widgetHeight,e.heightForLine(this.length-this.collapsed))+this.breaks*e.lineHeight),this.outdated=!1,this}toString(){return`line(${this.length}${this.collapsed?-this.collapsed:""}${this.widgetHeight?":"+this.widgetHeight:""})`}}class Ke extends nt{constructor(e){super(e,0)}heightMetrics(e,t){let s=e.doc.lineAt(t).number,o=e.doc.lineAt(t+this.length).number,r=o-s+1,i,n=0;if(e.lineWrapping){let c=Math.min(this.height,e.lineHeight*r);i=c/r,this.length>r+1&&(n=(this.height-c)/(this.length-r-1))}else i=this.height/r;return{firstLine:s,lastLine:o,perLine:i,perChar:n}}blockAt(e,t,s,o){let{firstLine:r,lastLine:i,perLine:n,perChar:c}=this.heightMetrics(t,o);if(t.lineWrapping){let l=o+(e<t.lineHeight?0:Math.round(Math.max(0,Math.min(1,(e-s)/this.height))*this.length)),d=t.doc.lineAt(l),p=n+d.length*c,u=Math.max(s,e-p/2);return new Lt(d.from,d.length,u,p,0)}else{let l=Math.max(0,Math.min(i-r,Math.floor((e-s)/n))),{from:d,length:p}=t.doc.line(r+l);return new Lt(d,p,s+n*l,n,0)}}lineAt(e,t,s,o,r){if(t==Oe.ByHeight)return this.blockAt(e,s,o,r);if(t==Oe.ByPosNoHeight){let{from:f,to:m}=s.doc.lineAt(e);return new Lt(f,m-f,0,0,0)}let{firstLine:i,perLine:n,perChar:c}=this.heightMetrics(s,r),l=s.doc.lineAt(e),d=n+l.length*c,p=l.number-i,u=o+n*p+c*(l.from-r-p);return new Lt(l.from,l.length,Math.max(o,Math.min(u,o+this.height-d)),d,0)}forEachLine(e,t,s,o,r,i){e=Math.max(e,r),t=Math.min(t,r+this.length);let{firstLine:n,perLine:c,perChar:l}=this.heightMetrics(s,r);for(let d=e,p=o;d<=t;){let u=s.doc.lineAt(d);if(d==e){let m=u.number-n;p+=c*m+l*(e-r-m)}let f=c+l*u.length;i(new Lt(u.from,u.length,p,f,0)),p+=f,d=u.to+1}}replace(e,t,s){let o=this.length-t;if(o>0){let r=s[s.length-1];r instanceof Ke?s[s.length-1]=new Ke(r.length+o):s.push(null,new Ke(o-1))}if(e>0){let r=s[0];r instanceof Ke?s[0]=new Ke(e+r.length):s.unshift(new Ke(e-1),null)}return nt.of(s)}decomposeLeft(e,t){t.push(new Ke(e-1),null)}decomposeRight(e,t){t.push(null,new Ke(this.length-e-1))}updateHeight(e,t=0,s=!1,o){let r=t+this.length;if(o&&o.from<=t+this.length&&o.more){let i=[],n=Math.max(t,o.from),c=-1;for(o.from>t&&i.push(new Ke(o.from-t-1).updateHeight(e,t));n<=r&&o.more;){let d=e.doc.lineAt(n).length;i.length&&i.push(null);let p=o.heights[o.index++];c==-1?c=p:Math.abs(p-c)>=Qo&&(c=-2);let u=new ut(d,p);u.outdated=!1,i.push(u),n+=d+1}n<=r&&i.push(null,new Ke(r-n).updateHeight(e,n));let l=nt.of(i);return(c<0||Math.abs(l.height-this.height)>=Qo||Math.abs(c-this.heightMetrics(e,t).perLine)>=Qo)&&(Qa=!0),fr(this,l)}else(s||this.outdated)&&(this.setHeight(e.heightForGap(t,t+this.length)),this.outdated=!1);return this}toString(){return`gap(${this.length})`}}class Sx extends nt{constructor(e,t,s){super(e.length+t+s.length,e.height+s.height,t|(e.outdated||s.outdated?2:0)),this.left=e,this.right=s,this.size=e.size+s.size}get break(){return this.flags&1}blockAt(e,t,s,o){let r=s+this.left.height;return e<r?this.left.blockAt(e,t,s,o):this.right.blockAt(e,t,r,o+this.left.length+this.break)}lineAt(e,t,s,o,r){let i=o+this.left.height,n=r+this.left.length+this.break,c=t==Oe.ByHeight?e<i:e<n,l=c?this.left.lineAt(e,t,s,o,r):this.right.lineAt(e,t,s,i,n);if(this.break||(c?l.to<n:l.from>n))return l;let d=t==Oe.ByPosNoHeight?Oe.ByPosNoHeight:Oe.ByPos;return c?l.join(this.right.lineAt(n,d,s,i,n)):this.left.lineAt(n,d,s,o,r).join(l)}forEachLine(e,t,s,o,r,i){let n=o+this.left.height,c=r+this.left.length+this.break;if(this.break)e<c&&this.left.forEachLine(e,t,s,o,r,i),t>=c&&this.right.forEachLine(e,t,s,n,c,i);else{let l=this.lineAt(c,Oe.ByPos,s,o,r);e<l.from&&this.left.forEachLine(e,l.from-1,s,o,r,i),l.to>=e&&l.from<=t&&i(l),t>l.to&&this.right.forEachLine(l.to+1,t,s,n,c,i)}}replace(e,t,s){let o=this.left.length+this.break;if(t<o)return this.balanced(this.left.replace(e,t,s),this.right);if(e>this.left.length)return this.balanced(this.left,this.right.replace(e-o,t-o,s));let r=[];e>0&&this.decomposeLeft(e,r);let i=r.length;for(let n of s)r.push(n);if(e>0&&bl(r,i-1),t<this.length){let n=r.length;this.decomposeRight(t,r),bl(r,n)}return nt.of(r)}decomposeLeft(e,t){let s=this.left.length;if(e<=s)return this.left.decomposeLeft(e,t);t.push(this.left),this.break&&(s++,e>=s&&t.push(null)),e>s&&this.right.decomposeLeft(e-s,t)}decomposeRight(e,t){let s=this.left.length,o=s+this.break;if(e>=o)return this.right.decomposeRight(e-o,t);e<s&&this.left.decomposeRight(e,t),this.break&&e<o&&t.push(null),t.push(this.right)}balanced(e,t){return e.size>2*t.size||t.size>2*e.size?nt.of(this.break?[e,null,t]:[e,t]):(this.left=fr(this.left,e),this.right=fr(this.right,t),this.setHeight(e.height+t.height),this.outdated=e.outdated||t.outdated,this.size=e.size+t.size,this.length=e.length+this.break+t.length,this)}updateHeight(e,t=0,s=!1,o){let{left:r,right:i}=this,n=t+r.length+this.break,c=null;return o&&o.from<=t+r.length&&o.more?c=r=r.updateHeight(e,t,s,o):r.updateHeight(e,t,s),o&&o.from<=n+i.length&&o.more?c=i=i.updateHeight(e,n,s,o):i.updateHeight(e,n,s),c?this.balanced(r,i):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?" ":"-")+this.right}}function bl(a,e){let t,s;a[e]==null&&(t=a[e-1])instanceof Ke&&(s=a[e+1])instanceof Ke&&a.splice(e-1,3,new Ke(t.length+1+s.length))}const _x=5;class qn{constructor(e,t){this.pos=e,this.oracle=t,this.nodes=[],this.lineStart=-1,this.lineEnd=-1,this.covering=null,this.writtenTo=e}get isCovered(){return this.covering&&this.nodes[this.nodes.length-1]==this.covering}span(e,t){if(this.lineStart>-1){let s=Math.min(t,this.lineEnd),o=this.nodes[this.nodes.length-1];o instanceof ut?o.length+=s-this.pos:(s>this.pos||!this.isCovered)&&this.nodes.push(new ut(s-this.pos,-1)),this.writtenTo=s,t>s&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=t}point(e,t,s){if(e<t||s.heightRelevant){let o=s.widget?s.widget.estimatedHeight:0,r=s.widget?s.widget.lineBreaks:0;o<0&&(o=this.oracle.lineHeight);let i=t-e;s.block?this.addBlock(new bu(i,o,s)):(i||r||o>=_x)&&this.addLineDeco(o,r,i)}else t>e&&this.span(e,t);this.lineEnd>-1&&this.lineEnd<this.pos&&(this.lineEnd=this.oracle.doc.lineAt(this.pos).to)}enterLine(){if(this.lineStart>-1)return;let{from:e,to:t}=this.oracle.doc.lineAt(this.pos);this.lineStart=e,this.lineEnd=t,this.writtenTo<e&&((this.writtenTo<e-1||this.nodes[this.nodes.length-1]==null)&&this.nodes.push(this.blankContent(this.writtenTo,e-1)),this.nodes.push(null)),this.pos>e&&this.nodes.push(new ut(this.pos-e,-1)),this.writtenTo=this.pos}blankContent(e,t){let s=new Ke(t-e);return this.oracle.doc.lineAt(e).to==t&&(s.flags|=4),s}ensureLine(){this.enterLine();let e=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(e instanceof ut)return e;let t=new ut(0,-1);return this.nodes.push(t),t}addBlock(e){this.enterLine();let t=e.deco;t&&t.startSide>0&&!this.isCovered&&this.ensureLine(),this.nodes.push(e),this.writtenTo=this.pos=this.pos+e.length,t&&t.endSide>0&&(this.covering=e)}addLineDeco(e,t,s){let o=this.ensureLine();o.length+=s,o.collapsed+=s,o.widgetHeight=Math.max(o.widgetHeight,e),o.breaks+=t,this.writtenTo=this.pos=this.pos+s}finish(e){let t=this.nodes.length==0?null:this.nodes[this.nodes.length-1];this.lineStart>-1&&!(t instanceof ut)&&!this.isCovered?this.nodes.push(new ut(0,-1)):(this.writtenTo<this.pos||t==null)&&this.nodes.push(this.blankContent(this.writtenTo,this.pos));let s=e;for(let o of this.nodes)o instanceof ut&&o.updateHeight(this.oracle,s),s+=o?o.length:1;return this.nodes}static build(e,t,s,o){let r=new qn(s,e);return Pe.spans(t,s,o,r,0),r.finish(s)}}function Px(a,e,t){let s=new Ax;return Pe.compare(a,e,t,s,0),s.changes}class Ax{constructor(){this.changes=[]}compareRange(){}comparePoint(e,t,s,o){(e<t||s&&s.heightRelevant||o&&o.heightRelevant)&&Jo(e,t,this.changes,5)}}function Mx(a,e){let t=a.getBoundingClientRect(),s=a.ownerDocument,o=s.defaultView||window,r=Math.max(0,t.left),i=Math.min(o.innerWidth,t.right),n=Math.max(0,t.top),c=Math.min(o.innerHeight,t.bottom);for(let l=a.parentNode;l&&l!=s.body;)if(l.nodeType==1){let d=l,p=window.getComputedStyle(d);if((d.scrollHeight>d.clientHeight||d.scrollWidth>d.clientWidth)&&p.overflow!="visible"){let u=d.getBoundingClientRect();r=Math.max(r,u.left),i=Math.min(i,u.right),n=Math.max(n,u.top),c=Math.min(l==a.parentNode?o.innerHeight:c,u.bottom)}l=p.position=="absolute"||p.position=="fixed"?d.offsetParent:d.parentNode}else if(l.nodeType==11)l=l.host;else break;return{left:r-t.left,right:Math.max(r,i)-t.left,top:n-(t.top+e),bottom:Math.max(n,c)-(t.top+e)}}function Ex(a){let e=a.getBoundingClientRect(),t=a.ownerDocument.defaultView||window;return e.left<t.innerWidth&&e.right>0&&e.top<t.innerHeight&&e.bottom>0}function Dx(a,e){let t=a.getBoundingClientRect();return{left:0,right:t.right-t.left,top:e,bottom:t.bottom-(t.top+e)}}class oi{constructor(e,t,s,o){this.from=e,this.to=t,this.size=s,this.displaySize=o}static same(e,t){if(e.length!=t.length)return!1;for(let s=0;s<e.length;s++){let o=e[s],r=t[s];if(o.from!=r.from||o.to!=r.to||o.size!=r.size)return!1}return!0}draw(e,t){return be.replace({widget:new Tx(this.displaySize*(t?e.scaleY:e.scaleX),t)}).range(this.from,this.to)}}class Tx extends Ba{constructor(e,t){super(),this.size=e,this.vertical=t}eq(e){return e.size==this.size&&e.vertical==this.vertical}toDOM(){let e=document.createElement("div");return this.vertical?e.style.height=this.size+"px":(e.style.width=this.size+"px",e.style.height="2px",e.style.display="inline-block"),e}get estimatedHeight(){return this.vertical?this.size:-1}}class vl{constructor(e){this.state=e,this.pixelViewport={left:0,right:window.innerWidth,top:0,bottom:0},this.inView=!0,this.paddingTop=0,this.paddingBottom=0,this.contentDOMWidth=0,this.contentDOMHeight=0,this.editorHeight=0,this.editorWidth=0,this.scrollTop=0,this.scrolledToBottom=!1,this.scaleX=1,this.scaleY=1,this.scrollAnchorPos=0,this.scrollAnchorHeight=-1,this.scaler=jl,this.scrollTarget=null,this.printing=!1,this.mustMeasureContent=!0,this.defaultTextDirection=Re.LTR,this.visibleRanges=[],this.mustEnforceCursorAssoc=!1;let t=e.facet(Wn).some(s=>typeof s!="function"&&s.class=="cm-lineWrapping");this.heightOracle=new kx(t),this.stateDeco=e.facet(Gs).filter(s=>typeof s!="function"),this.heightMap=nt.empty().applyChanges(this.stateDeco,Se.empty,this.heightOracle.setDoc(e.doc),[new bt(0,0,0,e.doc.length)]);for(let s=0;s<2&&(this.viewport=this.getViewport(0,null),!!this.updateForViewport());s++);this.updateViewportLines(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=be.set(this.lineGaps.map(s=>s.draw(this,!1))),this.computeVisibleRanges()}updateForViewport(){let e=[this.viewport],{main:t}=this.state.selection;for(let s=0;s<=1;s++){let o=s?t.head:t.anchor;if(!e.some(({from:r,to:i})=>o>=r&&o<=i)){let{from:r,to:i}=this.lineBlockAt(o);e.push(new To(r,i))}}return this.viewports=e.sort((s,o)=>s.from-o.from),this.updateScaler()}updateScaler(){let e=this.scaler;return this.scaler=this.heightMap.height<=7e6?jl:new Kn(this.heightOracle,this.heightMap,this.viewports),e.eq(this.scaler)?0:2}updateViewportLines(){this.viewportLines=[],this.heightMap.forEachLine(this.viewport.from,this.viewport.to,this.heightOracle.setDoc(this.state.doc),0,0,e=>{this.viewportLines.push(As(e,this.scaler))})}update(e,t=null){this.state=e.state;let s=this.stateDeco;this.stateDeco=this.state.facet(Gs).filter(d=>typeof d!="function");let o=e.changedRanges,r=bt.extendWithRanges(o,Px(s,this.stateDeco,e?e.changes:Ue.empty(this.state.doc.length))),i=this.heightMap.height,n=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollTop);xl(),this.heightMap=this.heightMap.applyChanges(this.stateDeco,e.startState.doc,this.heightOracle.setDoc(this.state.doc),r),(this.heightMap.height!=i||Qa)&&(e.flags|=2),n?(this.scrollAnchorPos=e.changes.mapPos(n.from,-1),this.scrollAnchorHeight=n.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=this.heightMap.height);let c=r.length?this.mapViewport(this.viewport,e.changes):this.viewport;(t&&(t.range.head<c.from||t.range.head>c.to)||!this.viewportIsAppropriate(c))&&(c=this.getViewport(0,t));let l=c.from!=this.viewport.from||c.to!=this.viewport.to;this.viewport=c,e.flags|=this.updateForViewport(),(l||!e.changes.empty||e.flags&2)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(this.mapLineGaps(this.lineGaps,e.changes))),e.flags|=this.computeVisibleRanges(e.changes),t&&(this.scrollTarget=t),!this.mustEnforceCursorAssoc&&e.selectionSet&&e.view.lineWrapping&&e.state.selection.main.empty&&e.state.selection.main.assoc&&!e.state.facet(eu)&&(this.mustEnfor
vendor: 1,237 bytes, line 45
45ceCursorAssoc=!0)}measure(e){let t=e.contentDOM,s=window.getComputedStyle(t),o=this.heightOracle,r=s.whiteSpace;this.defaultTextDirection=s.direction=="rtl"?Re.RTL:Re.LTR;let i=this.heightOracle.mustRefreshForWrapping(r),n=t.getBoundingClientRect(),c=i||this.mustMeasureContent||this.contentDOMHeight!=n.height;this.contentDOMHeight=n.height,this.mustMeasureContent=!1;let l=0,d=0;if(n.width&&n.height){let{scaleX:A,scaleY:S}=Pp(t,n);(A>.005&&Math.abs(this.scaleX-A)>.005||S>.005&&Math.abs(this.scaleY-S)>.005)&&(this.scaleX=A,this.scaleY=S,l|=16,i=c=!0)}let p=(parseInt(s.paddingTop)||0)*this.scaleY,u=(parseInt(s.paddingBottom)||0)*this.scaleY;(this.paddingTop!=p||this.paddingBottom!=u)&&(this.paddingTop=p,this.paddingBottom=u,l|=18),this.editorWidth!=e.scrollDOM.clientWidth&&(o.lineWrapping&&(c=!0),this.editorWidth=e.scrollDOM.clientWidth,l|=16);let f=e.scrollDOM.scrollTop*this.scaleY;this.scrollTop!=f&&(this.scrollAnchorHeight=-1,this.scrollTop=f),this.scrolledToBottom=Ep(e.scrollDOM);let m=(this.printing?Dx:Mx)(t,this.paddingTop),g=m.top-this.pixelViewport.top,x=m.bottom-this.pixelViewport.bottom;this.pixelViewport=m;let b=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;
vendor: 28,718 bytes, lines 45-46
45if(b!=this.inView&&(this.inView=b,b&&(c=!0)),!this.inView&&!this.scrollTarget&&!Ex(e.dom))return 0;let y=n.width;if((this.contentDOMWidth!=y||this.editorHeight!=e.scrollDOM.clientHeight)&&(this.contentDOMWidth=n.width,this.editorHeight=e.scrollDOM.clientHeight,l|=16),c){let A=e.docView.measureVisibleLineHeights(this.viewport);if(o.mustRefreshForHeights(A)&&(i=!0),i||o.lineWrapping&&Math.abs(y-this.contentDOMWidth)>o.charWidth){let{lineHeight:S,charWidth:N,textHeight:D}=e.docView.measureTextSize();i=S>0&&o.refresh(r,S,N,D,y/N,A),i&&(e.docView.minWidth=0,l|=16)}g>0&&x>0?d=Math.max(g,x):g<0&&x<0&&(d=Math.min(g,x)),xl();for(let S of this.viewports){let N=S.from==this.viewport.from?A:e.docView.measureVisibleLineHeights(S);this.heightMap=(i?nt.empty().applyChanges(this.stateDeco,Se.empty,this.heightOracle,[new bt(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(o,0,i,new Cx(S.from,N))}Qa&&(l|=2)}let k=!this.viewportIsAppropriate(this.viewport,d)||this.scrollTarget&&(this.scrollTarget.range.head<this.viewport.from||this.scrollTarget.range.head>this.viewport.to);return k&&(l&2&&(l|=this.updateScaler()),this.viewport=this.getViewport(d,this.scrollTarget),l|=this.updateForViewport()),(l&2||k)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(i?[]:this.lineGaps,e)),l|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,e.docView.enforceCursorAssoc()),l}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}getViewport(e,t){let s=.5-Math.max(-.5,Math.min(.5,e/1e3/2)),o=this.heightMap,r=this.heightOracle,{visibleTop:i,visibleBottom:n}=this,c=new To(o.lineAt(i-s*1e3,Oe.ByHeight,r,0,0).from,o.lineAt(n+(1-s)*1e3,Oe.ByHeight,r,0,0).to);if(t){let{head:l}=t.range;if(l<c.from||l>c.to){let d=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),p=o.lineAt(l,Oe.ByPos,r,0,0),u;t.y=="center"?u=(p.top+p.bottom)/2-d/2:t.y=="start"||t.y=="nearest"&&l<c.from?u=p.top:u=p.bottom-d,c=new To(o.lineAt(u-1e3/2,Oe.ByHeight,r,0,0).from,o.lineAt(u+d+1e3/2,Oe.ByHeight,r,0,0).to)}}return c}mapViewport(e,t){let s=t.mapPos(e.from,-1),o=t.mapPos(e.to,1);return new To(this.heightMap.lineAt(s,Oe.ByPos,this.heightOracle,0,0).from,this.heightMap.lineAt(o,Oe.ByPos,this.heightOracle,0,0).to)}viewportIsAppropriate({from:e,to:t},s=0){if(!this.inView)return!0;let{top:o}=this.heightMap.lineAt(e,Oe.ByPos,this.heightOracle,0,0),{bottom:r}=this.heightMap.lineAt(t,Oe.ByPos,this.heightOracle,0,0),{visibleTop:i,visibleBottom:n}=this;return(e==0||o<=i-Math.max(10,Math.min(-s,250)))&&(t==this.state.doc.length||r>=n+Math.max(10,Math.min(s,250)))&&o>i-2*1e3&&r<n+2*1e3}mapLineGaps(e,t){if(!e.length||t.empty)return e;let s=[];for(let o of e)t.touchesRange(o.from,o.to)||s.push(new oi(t.mapPos(o.from),t.mapPos(o.to),o.size,o.displaySize));return s}ensureLineGaps(e,t){let s=this.heightOracle.lineWrapping,o=s?1e4:2e3,r=o>>1,i=o<<1;if(this.defaultTextDirection!=Re.LTR&&!s)return[];let n=[],c=(d,p,u,f)=>{if(p-d<r)return;let m=this.state.selection.main,g=[m.from];m.empty||g.push(m.to);for(let b of g)if(b>d&&b<p){c(d,b-10,u,f),c(b+10,p,u,f);return}let x=Lx(e,b=>b.from>=u.from&&b.to<=u.to&&Math.abs(b.from-d)<r&&Math.abs(b.to-p)<r&&!g.some(y=>b.from<y&&b.to>y));if(!x){if(p<u.to&&t&&s&&t.visibleRanges.some(k=>k.from<=p&&k.to>=p)){let k=t.moveToLineBoundary(ae.cursor(p),!1,!0).head;k>d&&(p=k)}let b=this.gapSize(u,d,p,f),y=s||b<2e6?b:2e6;x=new oi(d,p,b,y)}n.push(x)},l=d=>{if(d.length<i||d.type!=it.Text)return;let p=Nx(d.from,d.to,this.stateDeco);if(p.total<i)return;let u=this.scrollTarget?this.scrollTarget.range.head:null,f,m;if(s){let g=o/this.heightOracle.lineLength*this.heightOracle.lineHeight,x,b;if(u!=null){let y=Lo(p,u),k=((this.visibleBottom-this.visibleTop)/2+g)/d.height;x=y-k,b=y+k}else x=(this.visibleTop-d.top-g)/d.height,b=(this.visibleBottom-d.top+g)/d.height;f=No(p,x),m=No(p,b)}else{let g=p.total*this.heightOracle.charWidth,x=o*this.heightOracle.charWidth,b=0;if(g>2e6)for(let N of e)N.from>=d.from&&N.from<d.to&&N.size!=N.displaySize&&N.from*this.heightOracle.charWidth+b<this.pixelViewport.left&&(b=N.size-N.displaySize);let y=this.pixelViewport.left+b,k=this.pixelViewport.right+b,A,S;if(u!=null){let N=Lo(p,u),D=((k-y)/2+x)/g;A=N-D,S=N+D}else A=(y-x)/g,S=(k+x)/g;f=No(p,A),m=No(p,S)}f>d.from&&c(d.from,f,d,p),m<d.to&&c(m,d.to,d,p)};for(let d of this.viewportLines)Array.isArray(d.type)?d.type.forEach(l):l(d);return n}gapSize(e,t,s,o){let r=Lo(o,s)-Lo(o,t);return this.heightOracle.lineWrapping?e.height*r:o.total*this.heightOracle.charWidth*r}updateLineGaps(e){oi.same(e,this.lineGaps)||(this.lineGaps=e,this.lineGapDeco=be.set(e.map(t=>t.draw(this,this.heightOracle.lineWrapping))))}computeVisibleRanges(e){let t=this.stateDeco;this.lineGaps.length&&(t=t.concat(this.lineGapDeco));let s=[];Pe.spans(t,this.viewport.from,this.viewport.to,{span(r,i){s.push({from:r,to:i})},point(){}},20);let o=0;if(s.length!=this.visibleRanges.length)o=12;else for(let r=0;r<s.length&&!(o&8);r++){let i=this.visibleRanges[r],n=s[r];(i.from!=n.from||i.to!=n.to)&&(o|=4,e&&e.mapPos(i.from,-1)==n.from&&e.mapPos(i.to,1)==n.to||(o|=8))}return this.visibleRanges=s,o}lineBlockAt(e){return e>=this.viewport.from&&e<=this.viewport.to&&this.viewportLines.find(t=>t.from<=e&&t.to>=e)||As(this.heightMap.lineAt(e,Oe.ByPos,this.heightOracle,0,0),this.scaler)}lineBlockAtHeight(e){return e>=this.viewportLines[0].top&&e<=this.viewportLines[this.viewportLines.length-1].bottom&&this.viewportLines.find(t=>t.top<=e&&t.bottom>=e)||As(this.heightMap.lineAt(this.scaler.fromDOM(e),Oe.ByHeight,this.heightOracle,0,0),this.scaler)}scrollAnchorAt(e){let t=this.lineBlockAtHeight(e+8);return t.from>=this.viewport.from||this.viewportLines[0].top-e>200?t:this.viewportLines[0]}elementAtHeight(e){return As(this.heightMap.blockAt(this.scaler.fromDOM(e),this.heightOracle,0,0),this.scaler)}get docHeight(){return this.scaler.toDOM(this.heightMap.height)}get contentHeight(){return this.docHeight+this.paddingTop+this.paddingBottom}}let To=class{constructor(e,t){this.from=e,this.to=t}};function Nx(a,e,t){let s=[],o=a,r=0;return Pe.spans(t,a,e,{span(){},point(i,n){i>o&&(s.push({from:o,to:i}),r+=i-o),o=n}},20),o<e&&(s.push({from:o,to:e}),r+=e-o),{total:r,ranges:s}}function No({total:a,ranges:e},t){if(t<=0)return e[0].from;if(t>=1)return e[e.length-1].to;let s=Math.floor(a*t);for(let o=0;;o++){let{from:r,to:i}=e[o],n=i-r;if(s<=n)return r+s;s-=n}}function Lo(a,e){let t=0;for(let{from:s,to:o}of a.ranges){if(e<=o){t+=e-s;break}t+=o-s}return t/a.total}function Lx(a,e){for(let t of a)if(e(t))return t}const jl={toDOM(a){return a},fromDOM(a){return a},scale:1,eq(a){return a==this}};class Kn{constructor(e,t,s){let o=0,r=0,i=0;this.viewports=s.map(({from:n,to:c})=>{let l=t.lineAt(n,Oe.ByPos,e,0,0).top,d=t.lineAt(c,Oe.ByPos,e,0,0).bottom;return o+=d-l,{from:n,to:c,top:l,bottom:d,domTop:0,domBottom:0}}),this.scale=(7e6-o)/(t.height-o);for(let n of this.viewports)n.domTop=i+(n.top-r)*this.scale,i=n.domBottom=n.domTop+(n.bottom-n.top),r=n.bottom}toDOM(e){for(let t=0,s=0,o=0;;t++){let r=t<this.viewports.length?this.viewports[t]:null;if(!r||e<r.top)return o+(e-s)*this.scale;if(e<=r.bottom)return r.domTop+(e-r.top);s=r.bottom,o=r.domBottom}}fromDOM(e){for(let t=0,s=0,o=0;;t++){let r=t<this.viewports.length?this.viewports[t]:null;if(!r||e<r.domTop)return s+(e-o)/this.scale;if(e<=r.domBottom)return r.top+(e-r.domTop);s=r.bottom,o=r.domBottom}}eq(e){return e instanceof Kn?this.scale==e.scale&&this.viewports.length==e.viewports.length&&this.viewports.every((t,s)=>t.from==e.viewports[s].from&&t.to==e.viewports[s].to):!1}}function As(a,e){if(e.scale==1)return a;let t=e.toDOM(a.top),s=e.toDOM(a.bottom);return new Lt(a.from,a.length,t,s-t,Array.isArray(a._content)?a._content.map(o=>As(o,e)):a._content)}const Io=fe.define({combine:a=>a.join(" ")}),sn=fe.define({combine:a=>a.indexOf(!0)>-1}),on=ha.newName(),vu=ha.newName(),ju=ha.newName(),wu={"&light":"."+vu,"&dark":"."+ju};function rn(a,e,t){return new ha(e,{finish(s){return/&/.test(s)?s.replace(/&\w*/,o=>{if(o=="&")return a;if(!t||!t[o])throw new RangeError(`Unsupported selector: ${o}`);return t[o]}):a+" "+s}})}const Ix=rn("."+on,{"&":{position:"relative !important",boxSizing:"border-box","&.cm-focused":{outline:"1px dotted #212121"},display:"flex !important",flexDirection:"column"},".cm-scroller":{display:"flex !important",alignItems:"flex-start !important",fontFamily:"monospace",lineHeight:1.4,height:"100%",overflowX:"auto",position:"relative",zIndex:0,overflowAnchor:"none"},".cm-content":{margin:0,flexGrow:2,flexShrink:0,display:"block",whiteSpace:"pre",wordWrap:"normal",boxSizing:"border-box",minHeight:"100%",padding:"4px 0",outline:"none","&[contenteditable=true]":{WebkitUserModify:"read-write-plaintext-only"}},".cm-lineWrapping":{whiteSpace_fallback:"pre-wrap",whiteSpace:"break-spaces",wordBreak:"break-word",overflowWrap:"anywhere",flexShrink:1},"&light .cm-content":{caretColor:"black"},"&dark .cm-content":{caretColor:"white"},".cm-line":{display:"block",padding:"0 2px 0 6px"},".cm-layer":{position:"absolute",left:0,top:0,contain:"size style","& > *":{position:"absolute"}},"&light .cm-selectionBackground":{background:"#d9d9d9"},"&dark .cm-selectionBackground":{background:"#222"},"&light.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#d7d4f0"},"&dark.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#233"},".cm-cursorLayer":{pointerEvents:"none"},"&.cm-focused > .cm-scroller > .cm-cursorLayer":{animation:"steps(1) cm-blink 1.2s infinite"},"@keyframes cm-blink":{"0%":{},"50%":{opacity:0},"100%":{}},"@keyframes cm-blink2":{"0%":{},"50%":{opacity:0},"100%":{}},".cm-cursor, .cm-dropCursor":{borderLeft:"1.2px solid black",marginLeft:"-0.6px",pointerEvents:"none"},".cm-cursor":{display:"none"},"&dark .cm-cursor":{borderLeftColor:"#ddd"},".cm-dropCursor":{position:"absolute"},"&.cm-focused > .cm-scroller > .cm-cursorLayer .cm-cursor":{display:"block"},".cm-iso":{unicodeBidi:"isolate"},".cm-announced":{position:"fixed",top:"-10000px"},"@media print":{".cm-announced":{display:"none"}},"&light .cm-activeLine":{backgroundColor:"#cceeff44"},"&dark .cm-activeLine":{backgroundColor:"#99eeff33"},"&light .cm-specialChar":{color:"red"},"&dark .cm-specialChar":{color:"#f78"},".cm-gutters":{flexShrink:0,display:"flex",height:"100%",boxSizing:"border-box",insetInlineStart:0,zIndex:200},"&light .cm-gutters":{backgroundColor:"#f5f5f5",color:"#6c6c6c",borderRight:"1px solid #ddd"},"&dark .cm-gutters":{backgroundColor:"#333338",color:"#ccc"},".cm-gutter":{display:"flex !important",flexDirection:"column",flexShrink:0,boxSizing:"border-box",minHeight:"100%",overflow:"hidden"},".cm-gutterElement":{boxSizing:"border-box"},".cm-lineNumbers .cm-gutterElement":{padding:"0 3px 0 5px",minWidth:"20px",textAlign:"right",whiteSpace:"nowrap"},"&light .cm-activeLineGutter":{backgroundColor:"#e2f2ff"},"&dark .cm-activeLineGutter":{backgroundColor:"#222227"},".cm-panels":{boxSizing:"border-box",position:"sticky",left:0,right:0,zIndex:300},"&light .cm-panels":{backgroundColor:"#f5f5f5",color:"black"},"&light .cm-panels-top":{borderBottom:"1px solid #ddd"},"&light .cm-panels-bottom":{borderTop:"1px solid #ddd"},"&dark .cm-panels":{backgroundColor:"#333338",color:"white"},".cm-tab":{display:"inline-block",overflow:"hidden",verticalAlign:"bottom"},".cm-widgetBuffer":{verticalAlign:"text-top",height:"1em",width:0,display:"inline"},".cm-placeholder":{color:"#888",display:"inline-block",verticalAlign:"top"},".cm-highlightSpace":{backgroundImage:"radial-gradient(circle at 50% 55%, #aaa 20%, transparent 5%)",backgroundPosition:"center"},".cm-highlightTab":{backgroundImage:`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="200" height="20"><path stroke="%23888" stroke-width="1" fill="none" d="M1 10H196L190 5M190 15L196 10M197 4L197 16"/></svg>')`,backgroundSize:"auto 100%",backgroundPosition:"right 90%",backgroundRepeat:"no-repeat"},".cm-trailingSpace":{backgroundColor:"#ff332255"},".cm-button":{verticalAlign:"middle",color:"inherit",fontSize:"70%",padding:".2em 1em",borderRadius:"1px"},"&light .cm-button":{backgroundImage:"linear-gradient(#eff1f5, #d9d9df)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#b4b4b4, #d0d3d6)"}},"&dark .cm-button":{backgroundImage:"linear-gradient(#393939, #111)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#111, #333)"}},".cm-textfield":{verticalAlign:"middle",color:"inherit",fontSize:"70%",border:"1px solid silver",padding:".2em .5em"},"&light .cm-textfield":{backgroundColor:"white"},"&dark .cm-textfield":{border:"1px solid #555",backgroundColor:"inherit"}},wu),Ox={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},ri=he.ie&&he.ie_version<=11;class Fx{constructor(e){this.view=e,this.active=!1,this.editContext=null,this.selectionRange=new jg,this.selectionChanged=!1,this.delayedFlush=-1,this.resizeTimeout=-1,this.queue=[],this.delayedAndroidKey=null,this.flushingAndroidKey=-1,this.lastChange=0,this.scrollTargets=[],this.intersection=null,this.resizeScroll=null,this.intersecting=!1,this.gapIntersection=null,this.gaps=[],this.printQuery=null,this.parentCheck=-1,this.dom=e.contentDOM,this.observer=new MutationObserver(t=>{for(let s of t)this.queue.push(s);(he.ie&&he.ie_version<=11||he.ios&&e.composing)&&t.some(s=>s.type=="childList"&&s.removedNodes.length||s.type=="characterData"&&s.oldValue.length>s.target.nodeValue.length)?this.flushSoon():this.flush()}),window.EditContext&&e.constructor.EDIT_CONTEXT!==!1&&!(he.chrome&&he.chrome_version<126)&&(this.editContext=new Bx(e),e.state.facet(qt)&&(e.contentDOM.editContext=this.editContext.editContext)),ri&&(this.onCharData=t=>{this.queue.push({target:t.target,type:"characterData",oldValue:t.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),this.onResize=this.onResize.bind(this),this.onPrint=this.onPrint.bind(this),this.onScroll=this.onScroll.bind(this),window.matchMedia&&(this.printQuery=window.matchMedia("print")),typeof ResizeObserver=="function"&&(this.resizeScroll=new ResizeObserver(()=>{var t;((t=this.view.docView)===null||t===void 0?void 0:t.lastUpdate)<Date.now()-75&&this.onResize()}),this.resizeScroll.observe(e.scrollDOM)),this.addWindowListeners(this.win=e.win),this.start(),typeof IntersectionObserver=="function"&&(this.intersection=new IntersectionObserver(t=>{this.parentCheck<0&&(this.parentCheck=setTimeout(this.listenForScroll.bind(this),1e3)),t.length>0&&t[t.length-1].intersectionRatio>0!=this.intersecting&&(this.intersecting=!this.intersecting,this.intersecting!=this.view.inView&&this.onScrollChanged(document.createEvent("Event")))},{threshold:[0,.001]}),this.intersection.observe(this.dom),this.gapIntersection=new IntersectionObserver(t=>{t.length>0&&t[t.length-1].intersectionRatio>0&&this.onScrollChanged(document.createEvent("Event"))},{})),this.listenForScroll(),this.readSelectionRange()}onScrollChanged(e){this.view.inputState.runHandlers("scroll",e),this.intersecting&&this.view.measure()}onScroll(e){this.intersecting&&this.flush(!1),this.editContext&&this.view.requestMeasure(this.editContext.measureReq),this.onScrollChanged(e)}onResize(){this.resizeTimeout<0&&(this.resizeTimeout=setTimeout(()=>{this.resizeTimeout=-1,this.view.requestMeasure()},50))}onPrint(e){(e.type=="change"||!e.type)&&!e.matches||(this.view.viewState.printing=!0,this.view.measure(),setTimeout(()=>{this.view.viewState.printing=!1,this.view.requestMeasure()},500))}updateGaps(e){if(this.gapIntersection&&(e.length!=this.gaps.length||this.gaps.some((t,s)=>t!=e[s]))){this.gapIntersection.disconnect();for(let t of e)this.gapIntersection.observe(t);this.gaps=e}}onSelectionChange(e){let t=this.selectionChanged;if(!this.readSelectionRange()||this.delayedAndroidKey)return;let{view:s}=this,o=this.selectionRange;if(s.state.facet(qt)?s.root.activeElement!=this.dom:!Xo(this.dom,o))return;let r=o.anchorNode&&s.docView.nearest(o.anchorNode);if(r&&r.ignoreEvent(e)){t||(this.selectionChanged=!1);return}(he.ie&&he.ie_version<=11||he.android&&he.chrome)&&!s.state.selection.main.empty&&o.focusNode&&Ns(o.focusNode,o.focusOffset,o.anchorNode,o.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:e}=this,t=qs(e.root);if(!t)return!1;let s=he.safari&&e.root.nodeType==11&&e.root.activeElement==this.dom&&Rx(this.view,t)||t;if(!s||this.selectionRange.eq(s))return!1;let o=Xo(this.dom,s);return o&&!this.selectionChanged&&e.inputState.lastFocusTime>Date.now()-200&&e.inputState.lastTouchTime<Date.now()-300&&yg(this.dom,s)?(this.view.inputState.lastFocusTime=0,e.docView.updateSelection(),!1):(this.selectionRange.setRange(s),o&&(this.selectionChanged=!0),!0)}setSelectionRange(e,t){this.selectionRange.set(e.node,e.offset,t.node,t.offset),this.selectionChanged=!1}clearSelectionRange(){this.selectionRange.set(null,0,null,0)}listenForScroll(){this.parentCheck=-1;let e=0,t=null;for(let s=this.dom;s;)if(s.nodeType==1)!t&&e<this.scrollTargets.length&&this.scrollTargets[e]==s?e++:t||(t=this.scrollTargets.slice(0,e)),t&&t.push(s),s=s.assignedSlot||s.parentNode;else if(s.nodeType==11)s=s.host;else break;if(e<this.scrollTargets.length&&!t&&(t=this.scrollTargets.slice(0,e)),t){for(let s of this.scrollTargets)s.removeEventListener("scroll",this.onScroll);for(let s of this.scrollTargets=t)s.addEventListener("scroll",this.onScroll)}}ignore(e){if(!this.active)return e();try{return this.stop(),e()}finally{this.start(),this.clear()}}start(){this.active||(this.observer.observe(this.dom,Ox),ri&&this.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.active=!0)}stop(){this.active&&(this.active=!1,this.observer.disconnect(),ri&&this.dom.removeEventListener("DOMCharacterDataModified",this.onCharData))}clear(){this.processRecords(),this.queue.length=0,this.selectionChanged=!1}delayAndroidKey(e,t){var s;if(!this.delayedAndroidKey){let o=()=>{let r=this.delayedAndroidKey;r&&(this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=r.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&r.force&&qa(this.dom,r.key,r.keyCode))};this.flushingAndroidKey=this.view.win.requestAnimationFrame(o)}(!this.delayedAndroidKey||e=="Enter")&&(this.delayedAndroidKey={key:e,keyCode:t,force:this.lastChange<Date.now()-50||!!(!((s=this.delayedAndroidKey)===null||s===void 0)&&s.force)})}clearDelayedAndroidKey(){this.win.cancelAnimationFrame(this.flushingAndroidKey),this.delayedAndroidKey=null,this.flushingAndroidKey=-1}flushSoon(){this.delayedFlush<0&&(this.delayedFlush=this.view.win.requestAnimationFrame(()=>{this.delayedFlush=-1,this.flush()}))}forceFlush(){this.delayedFlush>=0&&(this.view.win.cancelAnimationFrame(this.delayedFlush),this.delayedFlush=-1),this.flush()}pendingRecords(){for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}processRecords(){let e=this.pendingRecords();e.length&&(this.queue=[]);let t=-1,s=-1,o=!1;for(let r of e){let i=this.readMutation(r);i&&(i.typeOver&&(o=!0),t==-1?{from:t,to:s}=i:(t=Math.min(i.from,t),s=Math.max(i.to,s)))}return{from:t,to:s,typeOver:o}}readChange(){let{from:e,to:t,typeOver:s}=this.processRecords(),o=this.selectionChanged&&Xo(this.dom,this.selectionRange);if(e<0&&!o)return null;e>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1;let r=new tx(this.view,e,t,s);return this.view.docView.domChanged={newSel:r.newSel?r.newSel.main:null},r}flush(e=!0){if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;e&&this.readSelectionRange();let t=this.readChange();if(!t)return this.view.requestMeasure(),!1;let s=this.view.state,o=lu(this.view,t);return this.view.state==s&&(t.domChanged||t.newSel&&!t.newSel.main.eq(this.view.state.selection.main))&&this.view.update([]),o}readMutation(e){let t=this.view.docView.nearest(e.target);if(!t||t.ignoreMutation(e))return null;if(t.markDirty(e.type=="attributes"),e.type=="attributes"&&(t.flags|=4),e.type=="childList"){let s=wl(t,e.previousSibling||e.target.previousSibling,-1),o=wl(t,e.nextSibling||e.target.nextSibling,1);return{from:s?t.posAfter(s):t.posAtStart,to:o?t.posBefore(o):t.posAtEnd,typeOver:!1}}else return e.type=="characterData"?{from:t.posAtStart,to:t.posAtEnd,typeOver:e.target.nodeValue==e.oldValue}:null}setWindow(e){e!=this.win&&(this.removeWindowListeners(this.win),this.win=e,this.addWindowListeners(this.win))}addWindowListeners(e){e.addEventListener("resize",this.onResize),this.printQuery?this.printQuery.addEventListener?this.printQuery.addEventListener("change",this.onPrint):this.printQuery.addListener(this.onPrint):e.addEventListener("beforeprint",this.onPrint),e.addEventListener("scroll",this.onScroll),e.document.addEventListener("selectionchange",this.onSelectionChange)}removeWindowListeners(e){e.removeEventListener("scroll",this.onScroll),e.removeEventListener("resize",this.onResize),this.printQuery?this.printQuery.removeEventListener?this.printQuery.removeEventListener("change",this.onPrint):this.printQuery.removeListener(this.onPrint):e.removeEventListener("beforeprint",this.onPrint),e.document.removeEventListener("selectionchange",this.onSelectionChange)}update(e){this.editContext&&(this.editContext.update(e),e.startState.facet(qt)!=e.state.facet(qt)&&(e.view.contentDOM.editContext=e.state.facet(qt)?this.editContext.editContext:null))}destroy(){var e,t,s;this.stop(),(e=this.intersection)===null||e===void 0||e.disconnect(),(t=this.gapIntersection)===null||t===void 0||t.disconnect(),(s=this.resizeScroll)===null||s===void 0||s.disconnect();for(let o of this.scrollTargets)o.removeEventListener("scroll",this.onScroll);this.removeWindowListeners(this.win),clearTimeout(this.parentCheck),clearTimeout(this.resizeTimeout),this.win.cancelAnimationFrame(this.delayedFlush),this.win.cancelAnimationFrame(this.flushingAndroidKey),this.editContext&&(this.view.contentDOM.editContext=null,this.editContext.destroy())}}function wl(a,e,t){for(;e;){let s=Ne.get(e);if(s&&s.parent==a)return s;let o=e.parentNode;e=o!=a.dom?o:t>0?e.nextSibling:e.previousSibling}return null}function yl(a,e){let t=e.startContainer,s=e.startOffset,o=e.endContainer,r=e.endOffset,i=a.docView.domAtPos(a.state.selection.main.anchor);return Ns(i.node,i.offset,o,r)&&([t,s,o,r]=[o,r,t,s]),{anchorNode:t,anchorOffset:s,focusNode:o,focusOffset:r}}function Rx(a,e){if(e.getComposedRanges){let o=e.getComposedRanges(a.root)[0];if(o)return yl(a,o)}let t=null;function s(o){o.preventDefault(),o.stopImmediatePropagation(),t=o.getTargetRanges()[0]}return a.contentDOM.addEventListener("beforeinput",s,!0),a.dom.ownerDocument.execCommand("indent"),a.contentDOM.removeEventListener("beforeinput",s,!0),t?yl(a,t):null}class Bx{constructor(e){this.from=0,this.to=0,this.pendingContextChange=null,this.handlers=Object.create(null),this.composing=null,this.resetRange(e.state);let t=this.editContext=new window.EditContext({text:e.state.doc.sliceString(this.from,this.to),selectionStart:this.toContextPos(Math.max(this.from,Math.min(this.to,e.state.selection.main.anchor))),selectionEnd:this.toContextPos(e.state.selection.main.head)});this.handlers.textupdate=s=>{let o=e.state.selection.main,{anchor:r,head:i}=o,n=this.toEditorPos(s.updateRangeStart),c=this.toEditorPos(s.updateRangeEnd);e.inputState.composing>=0&&!this.composing&&(this.composing={contextBase:s.updateRangeStart,editorBase:n,drifted:!1});let l={from:n,to:c,insert:Se.of(s.text.split(` 46`))};if(l.from==this.from&&r<this.from?l.from=r:l.to==this.to&&r>this.to&&(l.to=r),l.from==l.to&&!l.insert.length){let d=ae.single(this.toEditorPos(s.selectionStart),this.toEditorPos(s.selectionEnd));d.main.eq(o)||e.dispatch({selection:d,userEvent:"select"});return}if((he.mac||he.android)&&l.from==i-1&&/^\. ?$/.test(s.text)&&e.contentDOM.getAttribute("autocorrect")=="off"&&(l={from:n,to:c,insert:Se.of([s.text.replace("."," ")])}),this.pendingContextChange=l,!e.state.readOnly){let d=this.to-this.from+(l.to-l.from+l.insert.length);Un(e,l,ae.single(this.toEditorPos(s.selectionStart,d),this.toEditorPos(s.selectionEnd,d)))}this.pendingContextChange&&(this.revertPending(e.state),this.setSelection(e.state))},this.handlers.characterboundsupdate=s=>{let o=[],r=null;for(let i=this.toEditorPos(s.rangeStart),n=this.toEditorPos(s.rangeEnd);i<n;i++){let c=e.coordsForChar(i);r=c&&new DOMRect(c.left,c.top,c.right-c.left,c.bottom-c.top)||r||new DOMRect,o.push(r)}t.updateCharacterBounds(s.rangeStart,o)},this.handlers.textformatupdate=s=>{let o=[];for(let r of s.getTextFormats()){let i=r.underlineStyle,n=r.underlineThickness;if(i!="None"&&n!="None"){let c=this.toEditorPos(r.rangeStart),l=this.toEditorPos(r.rangeEnd);if(c<l){let d=`text-decoration: underline ${i=="Dashed"?"dashed ":i=="Squiggle"?"wavy ":""}${n=="Thin"?1:2}px`;o.push(be.mark({attributes:{style:d}}).range(c,l))}}}e.dispatch({effects:au.of(be.set(o))})},this.handlers.compositionstart=()=>{e.inputState.composing<0&&(e.inputState.composing=0,e.inputState.compositionFirstChange=!0)},this.handlers.compositionend=()=>{if(e.inputState.composing=-1,e.inputState.compositionFirstChange=null,this.composing){let{drifted:s}=this.composing;this.composing=null,s&&this.reset(e.state)}};for(let s in this.handlers)t.addEventListener(s,this.handlers[s]);this.measureReq={read:s=>{this.editContext.updateControlBounds(s.contentDOM.getBoundingClientRect());let o=qs(s.root);o&&o.rangeCount&&this.editContext.updateSelectionBounds(o.getRangeAt(0).getBoundingClientRect())}}}applyEdits(e){let t=0,s=!1,o=this.pendingContextChange;return e.changes.iterChanges((r,i,n,c,l)=>{if(s)return;let d=l.length-(i-r);if(o&&i>=o.to)if(o.from==r&&o.to==i&&o.insert.eq(l)){o=this.pendingContextChange=null,t+=d,this.to+=d;return}else o=null,this.revertPending(e.state);if(r+=t,i+=t,i<=this.from)this.from+=d,this.to+=d;else if(r<this.to){if(r<this.from||i>this.to||this.to-this.from+l.length>3e4){s=!0;return}this.editContext.updateText(this.toContextPos(r),this.toContextPos(i),l.toString()),this.to+=d}t+=d}),o&&!s&&this.revertPending(e.state),!s}update(e){let t=this.pendingContextChange,s=e.startState.selection.main;this.composing&&(this.composing.drifted||!e.changes.touchesRange(s.from,s.to)&&e.transactions.some(o=>!o.isUserEvent("input.type")&&o.changes.touchesRange(this.from,this.to)))?(this.composing.drifted=!0,this.composing.editorBase=e.changes.mapPos(this.composing.editorBase)):!this.applyEdits(e)||!this.rangeIsValid(e.state)?(this.pendingContextChange=null,this.reset(e.state)):(e.docChanged||e.selectionSet||t)&&this.setSelection(e.state),(e.geometryChanged||e.docChanged||e.selectionSet)&&e.view.requestMeasure(this.measureReq)}resetRange(e){let{head:t}=e.selection.main;this.from=Math.max(0,t-1e4),this.to=Math.min(e.doc.length,t+1e4)}reset(e){this.resetRange(e),this.editContext.updateText(0,this.editContext.text.length,e.doc.sliceString(this.from,this.to)),this.setSelection(e)}revertPending(e){let t=this.pendingContextChange;this.pendingContextChange=null,this.editContext.updateText(this.toContextPos(t.from),this.toContextPos(t.from+t.insert.length),e.doc.sliceString(t.from,t.to))}setSelection(e){let{main:t}=e.selection,s=this.toContextPos(Math.max(this.from,Math.min(this.to,t.anchor))),o=this.toContextPos(t.head);(this.editContext.selectionStart!=s||this.editContext.selectionEnd!=o)&&this.editContext.updateSelection(s,o)}rangeIsValid(e){let{head:t}=e.selection.main;return!(this.from>0&&t-this.from<500||this.to<e.doc.length&&this.to-t<500||this.to-this.from>1e4*3)}toEditorPos(e,t=this.to-this.from){e=Math.min(e,t);let s=this.composing;return s&&s.drifted?s.editorBase+(e-s.contextBase):e+this.from}toContextPos(e){let t=this.composing;return t&&t.drifted?t.contextBase+(e-t.editorBase):e-this.from}destroy(){for(let e in this.handlers)this.editContext.removeEventListener(e,this.handlers[e])}}class pe{get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return this.inputState.composing>0}get compositionStarted(){return this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}constructor(e={}){var t;this.plugins=[],this.pluginMap=new Map,this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],this.destroyed=!1,this.updateState=2,this.measureScheduled=-1,this.measureRequests=[],this.contentDOM=document.createElement("div"),this.scrollDOM=document.createElement("div"),this.scrollDOM.tabIndex=-1,this.scrollDOM.className="
46cm-scroller",this.scrollDOM.appendChild(this.contentDOM),this.announceDOM=document.createElement("div"),this.announceDOM.className="cm-announced",this.announceDOM.setAttribute("aria-live","polite"),this.dom=document.createElement("div"),this.dom.appendChild(this.announceDOM),this.dom.appendChild(this.scrollDOM),e.parent&&e.parent.appendChild(this.dom);let{dispatch:s}=e;this.dispatchTransactions=e.dispatchTransactions||s&&(o=>o.forEach(r=>s(r,this)))||(o=>this.update(o)),this.dispatch=this.dispatch.bind(this),this._root=e.root||wg(e.parent)||document,this.viewState=new vl(e.state||_e.create(e)),e.scrollTo&&e.scrollTo.is(Mo)&&(this.viewState.scrollTarget=e.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(Ss).map(o=>new ti(o));for(let o of this.plugins)o.update(this);this.observer=new Fx(this),this.inputState=new ix(this),this.inputState.ensureHandlers(this.plugins),this.docView=new el(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),!((t=document.fonts)===null||t===void 0)&&t.ready&&document.fonts.ready.then(()=>this.requestMeasure())}dispatch(...e){let t=e.length==1&&e[0]instanceof $e?e:e.length==1&&Array.isArray(e[0])?e[0]:[this.state.update(...e)];this.dispatchTransactions(t,this)}update(e){if(this.updateState!=0)throw new Error("Calls to EditorView.update are not allowed while an update is in progress");let t=!1,s=!1,o,r=this.state;for(let u of e){if(u.startState!=r)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");r=u.state}if(this.destroyed){this.viewState.state=r;return}let i=this.hasFocus,n=0,c=null;e.some(u=>u.annotation(mu))?(this.inputState.notifiedFocused=i,n=1):i!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=i,c=gu(r,i),c||(n=1));let l=this.observer.delayedAndroidKey,d=null;if(l?(this.observer.clearDelayedAndroidKey(),d=this.observer.readChange(),(d&&!this.state.doc.eq(r.doc)||!this.state.selection.eq(r.selection))&&(d=null)):this.observer.clear(),r.facet(_e.phrases)!=this.state.facet(_e.phrases))return this.setState(r);o=hr.create(this,r,e),o.flags|=n;let p=this.viewState.scrollTarget;try{this.updateState=2;for(let u of e){if(p&&(p=p.map(u.changes)),u.scrollIntoView){let{main:f}=u.state.selection;p=new Ka(f.empty?f:ae.cursor(f.head,f.head>f.anchor?-1:1))}for(let f of u.effects)f.is(Mo)&&(p=f.value.clip(this.state))}this.viewState.update(o,p),this.bidiCache=mr.update(this.bidiCache,o.changes),o.empty||(this.updatePlugins(o),this.inputState.update(o)),t=this.docView.update(o),this.state.facet(_s)!=this.styleModules&&this.mountStyles(),s=this.updateAttrs(),this.showAnnouncements(e),this.docView.updateSelection(t,e.some(u=>u.isUserEvent("select.pointer")))}finally{this.updateState=0}if(o.startState.facet(Io)!=o.state.facet(Io)&&(this.viewState.mustMeasureContent=!0),(t||s||p||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),t&&this.docViewUpdate(),!o.empty)for(let u of this.state.facet(Qi))try{u(o)}catch(f){kt(this.state,f,"update listener")}(c||d)&&Promise.resolve().then(()=>{c&&this.state==c.startState&&this.dispatch(c),d&&!lu(this,d)&&l.force&&qa(this.contentDOM,l.key,l.keyCode)})}setState(e){if(this.updateState!=0)throw new Error("Calls to EditorView.setState are not allowed while an update is in progress");if(this.destroyed){this.viewState.state=e;return}this.updateState=2;let t=this.hasFocus;try{for(let s of this.plugins)s.destroy(this);this.viewState=new vl(e),this.plugins=e.facet(Ss).map(s=>new ti(s)),this.pluginMap.clear();for(let s of this.plugins)s.update(this);this.docView.destroy(),this.docView=new el(this),this.inputState.ensureHandlers(this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}t&&this.focus(),this.requestMeasure()}updatePlugins(e){let t=e.startState.facet(Ss),s=e.state.facet(Ss);if(t!=s){let o=[];for(let r of s){let i=t.indexOf(r);if(i<0)o.push(new ti(r));else{let n=this.plugins[i];n.mustUpdate=e,o.push(n)}}for(let r of this.plugins)r.mustUpdate!=e&&r.destroy(this);this.plugins=o,this.pluginMap.clear()}else for(let o of this.plugins)o.mustUpdate=e;for(let o=0;o<this.plugins.length;o++)this.plugins[o].update(this);t!=s&&this.inputState.ensureHandlers(this.plugins)}docViewUpdate(){for(let e of this.plugins){let t=e.value;if(t&&t.docViewUpdate)try{t.docViewUpdate(this)}catch(s){kt(this.state,s,"doc view update listener")}}}measure(e=!0){if(this.destroyed)return;if(this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.observer.delayedAndroidKey){this.measureScheduled=-1,this.requestMeasure();return}this.measureScheduled=0,e&&this.observer.forceFlush();let t=null,s=this.scrollDOM,o=s.scrollTop*this.scaleY,{scrollAnchorPos:r,scrollAnchorHeight:i}=this.viewState;Math.abs(o-this.viewState.scrollTop)>1&&(i=-1),this.viewState.scrollAnchorHeight=-1;try{for(let n=0;;n++){if(i<0)if(Ep(s))r=-1,i=this.viewState.heightMap.height;else{let f=this.viewState.scrollAnchorAt(o);r=f.from,i=f.top}this.updateState=1;let c=this.viewState.measure(this);if(!c&&!this.measureRequests.length&&this.viewState.scrollTarget==null)break;
vendor: 35,313 bytes, line 46
46if(n>5){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break}let l=[];c&4||([this.measureRequests,l]=[l,this.measureRequests]);let d=l.map(f=>{try{return f.read(this)}catch(m){return kt(this.state,m),kl}}),p=hr.create(this,this.state,[]),u=!1;p.flags|=c,t?t.flags|=c:t=p,this.updateState=2,p.empty||(this.updatePlugins(p),this.inputState.update(p),this.updateAttrs(),u=this.docView.update(p),u&&this.docViewUpdate());for(let f=0;f<l.length;f++)if(d[f]!=kl)try{let m=l[f];m.write&&m.write(d[f],this)}catch(m){kt(this.state,m)}if(u&&this.docView.updateSelection(!0),!p.viewportChanged&&this.measureRequests.length==0){if(this.viewState.editorHeight)if(this.viewState.scrollTarget){this.docView.scrollIntoView(this.viewState.scrollTarget),this.viewState.scrollTarget=null,i=-1;continue}else{let m=(r<0?this.viewState.heightMap.height:this.viewState.lineBlockAt(r).top)-i;if(m>1||m<-1){o=o+m,s.scrollTop=o/this.scaleY,i=-1;continue}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(t&&!t.empty)for(let n of this.state.facet(Qi))n(t)}get themeClasses(){return on+" "+(this.state.facet(sn)?ju:vu)+" "+this.state.facet(Io)}updateAttrs(){let e=Cl(this,su,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),t={spellcheck:"false",autocorrect:"off",autocapitalize:"off",writingsuggestions:"false",translate:"no",contenteditable:this.state.facet(qt)?"true":"false",class:"cm-content",style:`${he.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(t["aria-readonly"]="true"),Cl(this,Wn,t);let s=this.observer.ignore(()=>{let o=Gi(this.contentDOM,this.contentAttrs,t),r=Gi(this.dom,this.editorAttrs,e);return o||r});return this.editorAttrs=e,this.contentAttrs=t,s}showAnnouncements(e){let t=!0;for(let s of e)for(let o of s.effects)if(o.is(pe.announce)){t&&(this.announceDOM.textContent=""),t=!1;let r=this.announceDOM.appendChild(document.createElement("div"));r.textContent=o.value}}mountStyles(){this.styleModules=this.state.facet(_s);let e=this.state.facet(pe.cspNonce);ha.mount(this.root,this.styleModules.concat(Ix).reverse(),e?{nonce:e}:void 0)}readMeasured(){if(this.updateState==2)throw new Error("Reading the editor layout isn't allowed during an update");this.updateState==0&&this.measureScheduled>-1&&this.measure(!1)}requestMeasure(e){if(this.measureScheduled<0&&(this.measureScheduled=this.win.requestAnimationFrame(()=>this.measure())),e){if(this.measureRequests.indexOf(e)>-1)return;if(e.key!=null){for(let t=0;t<this.measureRequests.length;t++)if(this.measureRequests[t].key===e.key){this.measureRequests[t]=e;return}}this.measureRequests.push(e)}}plugin(e){let t=this.pluginMap.get(e);return(t===void 0||t&&t.spec!=e)&&this.pluginMap.set(e,t=this.plugins.find(s=>s.spec==e)||null),t&&t.update(this).value}get documentTop(){return this.contentDOM.getBoundingClientRect().top+this.viewState.paddingTop}get documentPadding(){return{top:this.viewState.paddingTop,bottom:this.viewState.paddingBottom}}get scaleX(){return this.viewState.scaleX}get scaleY(){return this.viewState.scaleY}elementAtHeight(e){return this.readMeasured(),this.viewState.elementAtHeight(e)}lineBlockAtHeight(e){return this.readMeasured(),this.viewState.lineBlockAtHeight(e)}get viewportLineBlocks(){return this.viewState.viewportLines}lineBlockAt(e){return this.viewState.lineBlockAt(e)}get contentHeight(){return this.viewState.contentHeight}moveByChar(e,t,s){return si(this,e,rl(this,e,t,s))}moveByGroup(e,t){return si(this,e,rl(this,e,t,s=>Jg(this,e.head,s)))}visualLineSide(e,t){let s=this.bidiSpans(e),o=this.textDirectionAt(e.from),r=s[t?s.length-1:0];return ae.cursor(r.side(t,o)+e.from,r.forward(!t,o)?1:-1)}moveToLineBoundary(e,t,s=!0){return Xg(this,e,t,s)}moveVertically(e,t,s){return si(this,e,Zg(this,e,t,s))}domAtPos(e){return this.docView.domAtPos(e)}posAtDOM(e,t=0){return this.docView.posFromDOM(e,t)}posAtCoords(e,t=!0){return this.readMeasured(),cu(this,e,t)}coordsAtPos(e,t=1){this.readMeasured();let s=this.docView.coordsAt(e,t);if(!s||s.left==s.right)return s;let o=this.state.doc.lineAt(e),r=this.bidiSpans(o),i=r[la.find(r,e-o.from,-1,t)];return Nr(s,i.dir==Re.LTR==t>0)}coordsForChar(e){return this.readMeasured(),this.docView.coordsForChar(e)}get defaultCharacterWidth(){return this.viewState.heightOracle.charWidth}get defaultLineHeight(){return this.viewState.heightOracle.lineHeight}get textDirection(){return this.viewState.defaultTextDirection}textDirectionAt(e){return!this.state.facet(Qp)||e<this.viewport.from||e>this.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(e))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(e){if(e.length>zx)return Up(e.length);let t=this.textDirectionAt(e.from),s;for(let r of this.bidiCache)if(r.from==e.from&&r.dir==t&&(r.fresh||$p(r.isolates,s=Qc(this,e))))return r.order;s||(s=Qc(this,e));let o=Lg(e.text,t,s);return this.bidiCache.push(new mr(e.from,e.to,t,s,!0,o)),o}get hasFocus(){var e;return(this.dom.ownerDocument.hasFocus()||he.safari&&((e=this.inputState)===null||e===void 0?void 0:e.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{Ap(this.contentDOM),this.docView.updateSelection()})}setRoot(e){this._root!=e&&(this._root=e,this.observer.setWindow((e.nodeType==9?e:e.ownerDocument).defaultView||window),this.mountStyles())}destroy(){this.root.activeElement==this.contentDOM&&this.contentDOM.blur();for(let e of this.plugins)e.destroy(this);this.plugins=[],this.inputState.destroy(),this.docView.destroy(),this.dom.remove(),this.observer.destroy(),this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.destroyed=!0}static scrollIntoView(e,t={}){return Mo.of(new Ka(typeof e=="number"?ae.cursor(e):e,t.y,t.x,t.yMargin,t.xMargin))}scrollSnapshot(){let{scrollTop:e,scrollLeft:t}=this.scrollDOM,s=this.viewState.scrollAnchorAt(e);return Mo.of(new Ka(ae.cursor(s.from),"start","start",s.top-e,t,!0))}setTabFocusMode(e){e==null?this.inputState.tabFocusMode=this.inputState.tabFocusMode<0?0:-1:typeof e=="boolean"?this.inputState.tabFocusMode=e?0:-1:this.inputState.tabFocusMode!=0&&(this.inputState.tabFocusMode=Date.now()+e)}static domEventHandlers(e){return at.define(()=>({}),{eventHandlers:e})}static domEventObservers(e){return at.define(()=>({}),{eventObservers:e})}static theme(e,t){let s=ha.newName(),o=[Io.of(s),_s.of(rn(`.${s}`,e))];return t&&t.dark&&o.push(sn.of(!0)),o}static baseTheme(e){return is.lowest(_s.of(rn("."+on,e,wu)))}static findFromDOM(e){var t;let s=e.querySelector(".cm-content"),o=s&&Ne.get(s)||Ne.get(e);return((t=o?.rootView)===null||t===void 0?void 0:t.view)||null}}pe.styleModule=_s;pe.inputHandler=Jp;pe.clipboardInputFilter=zn;pe.clipboardOutputFilter=Vn;pe.scrollHandler=tu;pe.focusChangeEffect=Zp;pe.perLineTextDirection=Qp;pe.exceptionSink=Xp;pe.updateListener=Qi;pe.editable=qt;pe.mouseSelectionStyle=Yp;pe.dragMovesSelection=Gp;pe.clickAddsSelectionRange=Kp;pe.decorations=Gs;pe.outerDecorations=ou;pe.atomicRanges=Hn;pe.bidiIsolatedRanges=ru;pe.scrollMargins=iu;pe.darkTheme=sn;pe.cspNonce=fe.define({combine:a=>a.length?a[0]:""});pe.contentAttributes=Wn;pe.editorAttributes=su;pe.lineWrapping=pe.contentAttributes.of({class:"cm-lineWrapping"});pe.announce=we.define();const zx=4096,kl={};class mr{constructor(e,t,s,o,r,i){this.from=e,this.to=t,this.dir=s,this.isolates=o,this.fresh=r,this.order=i}static update(e,t){if(t.empty&&!e.some(r=>r.fresh))return e;let s=[],o=e.length?e[e.length-1].dir:Re.LTR;for(let r=Math.max(0,e.length-10);r<e.length;r++){let i=e[r];i.dir==o&&!t.touchesRange(i.from,i.to)&&s.push(new mr(t.mapPos(i.from,1),t.mapPos(i.to,-1),i.dir,i.isolates,!1,i.order))}return s}}function Cl(a,e,t){for(let s=a.state.facet(e),o=s.length-1;o>=0;o--){let r=s[o],i=typeof r=="function"?r(a):r;i&&Ki(i,t)}return t}const Vx=he.mac?"mac":he.windows?"win":he.linux?"linux":"key";function Wx(a,e){const t=a.split(/-(?!$)/);let s=t[t.length-1];s=="Space"&&(s=" ");let o,r,i,n;for(let c=0;c<t.length-1;++c){const l=t[c];if(/^(cmd|meta|m)$/i.test(l))n=!0;else if(/^a(lt)?$/i.test(l))o=!0;else if(/^(c|ctrl|control)$/i.test(l))r=!0;else if(/^s(hift)?$/i.test(l))i=!0;else if(/^mod$/i.test(l))e=="mac"?n=!0:r=!0;else throw new Error("Unrecognized modifier name: "+l)}return o&&(s="Alt-"+s),r&&(s="Ctrl-"+s),n&&(s="Meta-"+s),i&&(s="Shift-"+s),s}function Oo(a,e,t){return e.altKey&&(a="Alt-"+a),e.ctrlKey&&(a="Ctrl-"+a),e.metaKey&&(a="Meta-"+a),t!==!1&&e.shiftKey&&(a="Shift-"+a),a}const Hx=is.default(pe.domEventHandlers({keydown(a,e){return ku(yu(e.state),a,e,"editor")}})),Gn=fe.define({enables:Hx}),Sl=new WeakMap;function yu(a){let e=a.facet(Gn),t=Sl.get(e);return t||Sl.set(e,t=qx(e.reduce((s,o)=>s.concat(o),[]))),t}function $x(a,e,t){return ku(yu(a.state),e,a,t)}let ia=null;const Ux=4e3;function qx(a,e=Vx){let t=Object.create(null),s=Object.create(null),o=(i,n)=>{let c=s[i];if(c==null)s[i]=n;else if(c!=n)throw new Error("Key binding "+i+" is used both as a regular binding and as a multi-stroke prefix")},r=(i,n,c,l,d)=>{var p,u;let f=t[i]||(t[i]=Object.create(null)),m=n.split(/ (?!$)/).map(b=>Wx(b,e));for(let b=1;b<m.length;b++){let y=m.slice(0,b).join(" ");o(y,!0),f[y]||(f[y]={preventDefault:!0,stopPropagation:!1,run:[k=>{let A=ia={view:k,prefix:y,scope:i};return setTimeout(()=>{ia==A&&(ia=null)},Ux),!0}]})}let g=m.join(" ");o(g,!1);let x=f[g]||(f[g]={preventDefault:!1,stopPropagation:!1,run:((u=(p=f._any)===null||p===void 0?void 0:p.run)===null||u===void 0?void 0:u.slice())||[]});c&&x.run.push(c),l&&(x.preventDefault=!0),d&&(x.stopPropagation=!0)};for(let i of a){let n=i.scope?i.scope.split(" "):["editor"];if(i.any)for(let l of n){let d=t[l]||(t[l]=Object.create(null));d._any||(d._any={preventDefault:!1,stopPropagation:!1,run:[]});let{any:p}=i;for(let u in d)d[u].run.push(f=>p(f,nn))}let c=i[e]||i.key;if(c)for(let l of n)r(l,c,i.run,i.preventDefault,i.stopPropagation),i.shift&&r(l,"Shift-"+c,i.shift,i.preventDefault,i.stopPropagation)}return t}let nn=null;function ku(a,e,t,s){nn=e;let o=gg(e),r=Ra(o,0),i=ho(r)==o.length&&o!=" ",n="",c=!1,l=!1,d=!1;ia&&ia.view==t&&ia.scope==s&&(n=ia.prefix+" ",pu.indexOf(e.keyCode)<0&&(l=!0,ia=null));let p=new Set,u=x=>{if(x){for(let b of x.run)if(!p.has(b)&&(p.add(b),b(t)))return x.stopPropagation&&(d=!0),!0;x.preventDefault&&(x.stopPropagation&&(d=!0),l=!0)}return!1},f=a[s],m,g;return f&&(u(f[n+Oo(o,e,!i)])?c=!0:i&&(e.altKey||e.metaKey||e.ctrlKey)&&!(he.windows&&e.ctrlKey&&e.altKey)&&(m=fa[e.keyCode])&&m!=o?(u(f[n+Oo(m,e,!0)])||e.shiftKey&&(g=Us[e.keyCode])!=o&&g!=m&&u(f[n+Oo(g,e,!1)]))&&(c=!0):i&&e.shiftKey&&u(f[n+Oo(o,e,!0)])&&(c=!0),!c&&u(f._any)&&(c=!0)),l&&(c=!0),c&&d&&e.stopPropagation(),nn=null,c}class go{constructor(e,t,s,o,r){this.className=e,this.left=t,this.top=s,this.width=o,this.height=r}draw(){let e=document.createElement("div");return e.className=this.className,this.adjust(e),e}update(e,t){return t.className!=this.className?!1:(this.adjust(e),!0)}adjust(e){e.style.left=this.left+"px",e.style.top=this.top+"px",this.width!=null&&(e.style.width=this.width+"px"),e.style.height=this.height+"px"}eq(e){return this.left==e.left&&this.top==e.top&&this.width==e.width&&this.height==e.height&&this.className==e.className}static forRange(e,t,s){if(s.empty){let o=e.coordsAtPos(s.head,s.assoc||1);if(!o)return[];let r=Cu(e);return[new go(t,o.left-r.left,o.top-r.top,null,o.bottom-o.top)]}else return Kx(e,t,s)}}function Cu(a){let e=a.scrollDOM.getBoundingClientRect();return{left:(a.textDirection==Re.LTR?e.left:e.right-a.scrollDOM.clientWidth*a.scaleX)-a.scrollDOM.scrollLeft*a.scaleX,top:e.top-a.scrollDOM.scrollTop*a.scaleY}}function _l(a,e,t,s){let o=a.coordsAtPos(e,t*2);if(!o)return s;let r=a.dom.getBoundingClientRect(),i=(o.top+o.bottom)/2,n=a.posAtCoords({x:r.left+1,y:i}),c=a.posAtCoords({x:r.right-1,y:i});return n==null||c==null?s:{from:Math.max(s.from,Math.min(n,c)),to:Math.min(s.to,Math.max(n,c))}}function Kx(a,e,t){if(t.to<=a.viewport.from||t.from>=a.viewport.to)return[];let s=Math.max(t.from,a.viewport.from),o=Math.min(t.to,a.viewport.to),r=a.textDirection==Re.LTR,i=a.contentDOM,n=i.getBoundingClientRect(),c=Cu(a),l=i.querySelector(".cm-line"),d=l&&window.getComputedStyle(l),p=n.left+(d?parseInt(d.paddingLeft)+Math.min(0,parseInt(d.textIndent)):0),u=n.right-(d?parseInt(d.paddingRight):0),f=tn(a,s),m=tn(a,o),g=f.type==it.Text?f:null,x=m.type==it.Text?m:null;if(g&&(a.lineWrapping||f.widgetLineBreaks)&&(g=_l(a,s,1,g)),x&&(a.lineWrapping||m.widgetLineBreaks)&&(x=_l(a,o,-1,x)),g&&x&&g.from==x.from&&g.to==x.to)return y(k(t.from,t.to,g));{let S=g?k(t.from,null,g):A(f,!1),N=x?k(null,t.to,x):A(m,!0),D=[];return(g||f).to<(x||m).from-(g&&x?1:0)||f.widgetLineBreaks>1&&S.bottom+a.defaultLineHeight/2<N.top?D.push(b(p,S.bottom,u,N.top)):S.bottom<N.top&&a.elementAtHeight((S.bottom+N.top)/2).type==it.Text&&(S.bottom=N.top=(S.bottom+N.top)/2),y(S).concat(D).concat(y(N))}function b(S,N,D,L){return new go(e,S-c.left,N-c.top,D-S,L-N)}function y({top:S,bottom:N,horizontal:D}){let L=[];for(let M=0;M<D.length;M+=2)L.push(b(D[M],S,D[M+1],N));return L}function k(S,N,D){let L=1e9,M=-1e9,B=[];function V(j,z,ce,$,K){let I=a.coordsAtPos(j,j==D.to?-2:2),X=a.coordsAtPos(ce,ce==D.from?2:-2);!I||!X||(L=Math.min(I.top,X.top,L),M=Math.max(I.bottom,X.bottom,M),K==Re.LTR?B.push(r&&z?p:I.left,r&&$?u:X.right):B.push(!r&&$?p:X.left,!r&&z?u:I.right))}let P=S??D.from,F=N??D.to;for(let j of a.visibleRanges)if(j.to>P&&j.from<F)for(let z=Math.max(j.from,P),ce=Math.min(j.to,F);;){let $=a.state.doc.lineAt(z);for(let K of a.bidiSpans($)){let I=K.from+$.from,X=K.to+$.from;if(I>=ce)break;X>z&&V(Math.max(I,z),S==null&&I<=P,Math.min(X,ce),N==null&&X>=F,K.dir)}if(z=$.to+1,z>=ce)break}return B.length==0&&V(P,S==null,F,N==null,a.textDirection),{top:L,bottom:M,horizontal:B}}function A(S,N){let D=n.top+(N?S.top:S.bottom);return{top:D,bottom:D,horizontal:[]}}}function Gx(a,e){return a.constructor==e.constructor&&a.eq(e)}class Yx{constructor(e,t){this.view=e,this.layer=t,this.drawn=[],this.scaleX=1,this.scaleY=1,this.measureReq={read:this.measure.bind(this),write:this.draw.bind(this)},this.dom=e.scrollDOM.appendChild(document.createElement("div")),this.dom.classList.add("cm-layer"),t.above&&this.dom.classList.add("cm-layer-above"),t.class&&this.dom.classList.add(t.class),this.scale(),this.dom.setAttribute("aria-hidden","true"),this.setOrder(e.state),e.requestMeasure(this.measureReq),t.mount&&t.mount(this.dom,e)}update(e){e.startState.facet(er)!=e.state.facet(er)&&this.setOrder(e.state),(this.layer.update(e,this.dom)||e.geometryChanged)&&(this.scale(),e.view.requestMeasure(this.measureReq))}docViewUpdate(e){this.layer.updateOnDocViewUpdate!==!1&&e.requestMeasure(this.measureReq)}setOrder(e){let t=0,s=e.facet(er);for(;t<s.length&&s[t]!=this.layer;)t++;this.dom.style.zIndex=String((this.layer.above?150:-1)-t)}measure(){return this.layer.markers(this.view)}scale(){let{scaleX:e,scaleY:t}=this.view;(e!=this.scaleX||t!=this.scaleY)&&(this.scaleX=e,this.scaleY=t,this.dom.style.transform=`scale(${1/e}, ${1/t})`)}draw(e){if(e.length!=this.drawn.length||e.some((t,s)=>!Gx(t,this.drawn[s]))){let t=this.dom.firstChild,s=0;for(let o of e)o.update&&t&&o.constructor&&this.drawn[s].constructor&&o.update(t,this.drawn[s])?(t=t.nextSibling,s++):this.dom.insertBefore(o.draw(),t);for(;t;){let o=t.nextSibling;t.remove(),t=o}this.drawn=e}}destroy(){this.layer.destroy&&this.layer.destroy(this.dom,this.view),this.dom.remove()}}const er=fe.define();function Su(a){return[at.define(e=>new Yx(e,a)),er.of(a)]}const _u=!(he.ios&&he.webkit&&he.webkit_version<534),Ys=fe.define({combine(a){return va(a,{cursorBlinkRate:1200,drawRangeCursor:!0},{cursorBlinkRate:(e,t)=>Math.min(e,t),drawRangeCursor:(e,t)=>e||t})}});function Xx(a={}){return[Ys.of(a),Jx,Zx,Qx,eu.of(!0)]}function Pu(a){return a.startState.facet(Ys)!=a.state.facet(Ys)}const Jx=Su({above:!0,markers(a){let{state:e}=a,t=e.facet(Ys),s=[];for(let o of e.selection.ranges){let r=o==e.selection.main;if(o.empty?!r||_u:t.drawRangeCursor){let i=r?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",n=o.empty?o:ae.cursor(o.head,o.head>o.anchor?-1:1);for(let c of go.forRange(a,i,n))s.push(c)}}return s},update(a,e){a.transactions.some(s=>s.selection)&&(e.style.animationName=e.style.animationName=="cm-blink"?"cm-blink2":"cm-blink");let t=Pu(a);return t&&Pl(a.state,e),a.docChanged||a.selectionSet||t},mount(a,e){Pl(e.state,a)},class:"cm-cursorLayer"});function Pl(a,e){e.style.animationDuration=a.facet(Ys).cursorBlinkRate+"ms"}const Zx=Su({above:!1,markers(a){return a.state.selection.ranges.map(e=>e.empty?[]:go.forRange(a,"cm-selectionBackground",e)).reduce((e,t)=>e.concat(t))},update(a,e){return a.docChanged||a.selectionSet||a.viewportChanged||Pu(a)},class:"cm-selectionLayer"}),cn={".cm-line":{"& ::selection, &::selection":{backgroundColor:"transparent !important"}},".cm-content":{"& :focus":{caretColor:"initial !important","&::selection, & ::selection":{backgroundColor:"Highlight !important"}}}};_u&&(cn[".cm-line"].caretColor=cn[".cm-content"].caretColor="transparent !important");const Qx=is.highest(pe.theme(cn));function eb(){return ab}const tb=be.line({class:"cm-activeLine"}),ab=at.fromClass(class{constructor(a){this.decorations=this.getDeco(a)}update(a){(a.docChanged||a.selectionSet)&&(this.decorations=this.getDeco(a.view))}getDeco(a){let e=-1,t=[];for(let s of a.state.selection.ranges){let o=a.lineBlockAt(s.head);o.from>e&&(t.push(tb.range(o.from)),e=o.from)}return be.set(t)}},{decorations:a=>a.decorations}),xs="-10000px";class Au{constructor(e,t,s,o){this.facet=t,this.createTooltipView=s,this.removeTooltipView=o,this.input=e.state.facet(t),this.tooltips=this.input.filter(i=>i);let r=null;this.tooltipViews=this.tooltips.map(i=>r=s(i,r))}update(e,t){var s;let o=e.state.facet(this.facet),r=o.filter(c=>c);if(o===this.input){for(let c of this.tooltipViews)c.update&&c.update(e);return!1}let i=[],n=t?[]:null;for(let c=0;c<r.length;c++){let l=r[c],d=-1;if(l){for(let p=0;p<this.tooltips.length;p++){let u=this.tooltips[p];u&&u.create==l.create&&(d=p)}if(d<0)i[c]=this.createTooltipView(l,c?i[c-1]:null),n&&(n[c]=!!l.above);else{let p=i[c]=this.tooltipViews[d];n&&(n[c]=t[d]),p.update&&p.update(e)}}}for(let c of this.tooltipViews)i.indexOf(c)<0&&(this.removeTooltipView(c),(s=c.destroy)===null||s===void 0||s.call(c));return t&&(n.forEach((c,l)=>t[l]=c),t.length=n.length),this.input=o,this.tooltips=r,this.tooltipViews=i,!0}}function sb(a){let e=a.dom.ownerDocument.documentElement;return{top:0,left:0,bottom:e.clientHeight,right:e.clientWidth}}const ii=fe.define({combine:a=>{var e,t,s;return{position:he.ios?"absolute":((e=a.find(o=>o.position))===null||e===void 0?void 0:e.position)||"fixed",parent:((t=a.find(o=>o.parent))===null||t===void 0?void 0:t.parent)||null,tooltipSpace:((s=a.find(o=>o.tooltipSpace))===null||s===void 0?void 0:s.tooltipSpace)||sb}}}),Al=new WeakMap,Mu=at.fromClass(class{constructor(a){this.view=a,this.above=[],this.inView=!0,this.madeAbsolute=!1,this.lastTransaction=0,this.measureTimeout=-1;let e=a.state.facet(ii);this.position=e.position,this.parent=e.parent,this.classes=a.themeClasses,this.createContainer(),this.measureReq={read:this.readMeasure.bind(this),write:this.writeMeasure.bind(this),key:this},this.resizeObserver=typeof ResizeObserver=="function"?new ResizeObserver(()=>this.measureSoon()):null,this.manager=new Au(a,Eu,(t,s)=>this.createTooltip(t,s),t=>{this.resizeObserver&&this.resizeObserver.unobserve(t.dom),t.dom.remove()}),this.above=this.manager.tooltips.map(t=>!!t.above),this.intersectionObserver=typeof IntersectionObserver=="function"?new IntersectionObserver(t=>{Date.now()>this.lastTransaction-50&&t.length>0&&t[t.length-1].intersectionRatio<1&&this.measureSoon()},{threshold:[1]}):null,this.observeIntersection(),a.win.addEventListener("resize",this.measureSoon=this.measureSoon.bind(this)),this.maybeMeasure()}createContainer(){this.parent?(this.container=document.createElement("div"),this.container.style.position="relative",this.container.className=this.view.themeClasses,this.parent.appendChild(this.container)):this.container=this.view.dom}observeIntersection(){if(this.intersectionObserver){this.intersectionObserver.disconnect();for(let a of this.manager.tooltipViews)this.intersectionObserver.observe(a.dom)}}measureSoon(){this.measureTimeout<0&&(this.measureTimeout=setTimeout(()=>{this.measureTimeout=-1,this.maybeMeasure()},50))}update(a){a.transactions.length&&(this.lastTransaction=Date.now());let e=this.manager.update(a,this.above);e&&this.observeIntersection();let t=e||a.geometryChanged,s=a.state.facet(ii);if(s.position!=this.position&&!this.madeAbsolute){this.position=s.position;for(let o of this.manager.tooltipViews)o.dom.style.position=this.position;t=!0}if(s.parent!=this.parent){this.parent&&this.container.remove(),this.parent=s.parent,this.createContainer();for(let o of this.manager.tooltipViews)this.container.appendChild(o.dom);t=!0}else this.parent&&this.view.themeClasses!=this.classes&&(this.classes=this.container.className=this.view.themeClasses);t&&this.maybeMeasure()}createTooltip(a,e){let t=a.create(this.view),s=e?e.dom:null;if(t.dom.classList.add("cm-tooltip"),a.arrow&&!t.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")){let o=document.createElement("div");o.className="cm-tooltip-arrow",t.dom.appendChild(o)}return t.dom.style.position=this.position,t.dom.style.top=xs,t.dom.style.left="0px",this.container.insertBefore(t.dom,s),t.mount&&t.mount(this.view),this.resizeObserver&&this.resizeObserver.observe(t.dom),t}destroy(){var a,e,t;this.view.win.removeEventListener("resize",this.measureSoon);for(let s of this.manager.tooltipViews)s.dom.remove(),(a=s.destroy)===null||a===void 0||a.call(s);this.parent&&this.container.remove(),(e=this.resizeObserver)===null||e===void 0||e.disconnect(),(t=this.intersectionObserver)===null||t===void 0||t.disconnect(),clearTimeout(this.measureTimeout)}readMeasure(){let a=1,e=1,t=!1;if(this.position=="fixed"&&this.manager.tooltipViews.length){let{dom:r}=this.manager.tooltipViews[0];if(he.gecko)t=r.offsetParent!=this.container.ownerDocument.body;else if(r.style.top==xs&&r.style.left=="0px"){let i=r.getBoundingClientRect();t=Math.abs(i.top+1e4)>1||Math.abs(i.left)>1}}if(t||this.position=="absolute")if(this.parent){let r=this.parent.getBoundingClientRect();r.width&&r.height&&(a=r.width/this.parent.offsetWidth,e=r.height/this.parent.offsetHeight)}else({scaleX:a,scaleY:e}=this.view.viewState);let s=this.view.scrollDOM.getBoundingClientRect(),o=$n(this.view);return{visible:{left:s.left+o.left,top:s.top+o.top,right:s.right-o.right,bottom:s.bottom-o.bottom},parent:this.parent?this.container.getBoundingClientRect():this.view.dom.getBoundingClientRect(),pos:this.manager.tooltips.map((r,i)=>{let n=this.manager.tooltipViews[i];return n.getCoords?n.getCoords(r.pos):this.view.coordsAtPos(r.pos)}),size:this.manager.tooltipViews.map(({dom:r})=>r.getBoundingClientRect()),space:this.view.state.facet(ii).tooltipSpace(this.view),scaleX:a,scaleY:e,makeAbsolute:t}}writeMeasure(a){var e;if(a.makeAbsolute){this.madeAbsolute=!0,this.position="absolute";for(let n of this.manager.tooltipViews)n.dom.style.position="absolute"}let{visible:t,space:s,scaleX:o,scaleY:r}=a,i=[];for(let n=0;n<this.manager.tooltips.length;n++){let c=this.manager.tooltips[n],l=this.manager.tooltipViews[n],{dom:d}=l,p=a.pos[n],u=a.size[n];if(!p||c.clip!==!1&&(p.bottom<=Math.max(t.top,s.top)||p.top>=Math.min(t.bottom,s.bottom)||p.right<Math.max(t.left,s.left)-.1||p.left>Math.min(t.right,s.right)+.1)){d.style.top=xs;continue}let f=c.arrow?l.dom.querySelector(".cm-tooltip-arrow"):null,m=f?7:0,g=u.right-u.left,x=(e=Al.get(l))!==null&&e!==void 0?e:u.bottom-u.top,b=l.offset||rb,y=this.view.textDirection==Re.LTR,k=u.width>s.right-s.left?y?s.left:s.right-u.width:y?Math.max(s.left,Math.min(p.left-(f?14:0)+b.x,s.right-g)):Math.min(Math.max(s.left,p.left-g+(f?14:0)-b.x),s.right-g),A=this.above[n];!c.strictSide&&(A?p.top-x-m-b.y<s.top:p.bottom+x+m+b.y>s.bottom)&&A==s.bottom-p.bottom>p.top-s.top&&(A=this.above[n]=!A);let S=(A?p.top-s.top:s.bottom-p.bottom)-m;if(S<x&&l.resize!==!1){if(S<this.view.defaultLineHeight){d.style.top=xs;continue}Al.set(l,x),d.style.height=(x=S)/r+"px"}else d.style.height&&(d.style.height="");let N=A?p.top-x-m-b.y:p.bottom+m+b.y,D=k+g;if(l.overlap!==!0)for(let L of i)L.left<D&&L.right>k&&L.top<N+x&&L.bottom>N&&(N=A?L.top-x-2-m:L.bottom+m+2);if(this.position=="absolute"?(d.style.top=(N-a.parent.top)/r+"px",Ml(d,(k-a.parent.left)/o)):(d.style.top=N/r+"px",Ml(d,k/o)),f){let L=p.left+(y?b.x:-b.x)-(k+14-7);f.style.left=L/o+"px"}l.overlap!==!0&&i.push({left:k,top:N,right:D,bottom:N+x}),d.classList.toggle("cm-tooltip-above",A),d.classList.toggle("cm-tooltip-below",!A),l.positioned&&l.positioned(a.space)}}maybeMeasure(){if(this.manager.tooltips.length&&(this.view.inView&&this.view.requestMeasure(this.measureReq),this.inView!=this.view.inView&&(this.inView=this.view.inView,!this.inView)))for(let a of this.manager.tooltipViews)a.dom.style.top=xs}},{eventObservers:{scroll(){this.maybeMeasure()}}});function Ml(a,e){let t=parseInt(a.style.left,10);(isNaN(t)||Math.abs(e-t)>1)&&(a.style.left=e+"px")}const ob=pe.baseTheme({".cm-tooltip":{zIndex:500,boxSizing:"border-box"},"&light .cm-tooltip":{border:"1px solid #bbb",backgroundColor:"#f5f5f5"},"&light .cm-tooltip-section:not(:first-child)":{borderTop:"1px solid #bbb"},"&dark .cm-tooltip":{backgroundColor:"#333338",color:"white"},".cm-tooltip-arrow":{height:"7px",width:"14px",position:"absolute",zIndex:-1,overflow:"hidden","&:before, &:after":{content:"''",position:"absolute",width:0,height:0,borderLeft:"7px solid transparent",borderRight:"7px solid transparent"},".cm-tooltip-above &":{bottom:"-7px","&:before":{borderTop:"7px solid #bbb"},"&:after":{borderTop:"7px solid #f5f5f5",bottom:"1px"}},".cm-tooltip-below &":{top:"-7px","&:before":{borderBottom:"7px solid #bbb"},"&:after":{borderBottom:"7px solid #f5f5f5",top:"1px"}}},"&dark .cm-tooltip .cm-tooltip-arrow":{"&:before":{borderTopColor:"#333338",borderBottomColor:"#333338"},"&:after":{borderTopColor:"transparent",borderBottomColor:"transparent"}}}),rb={x:0,y:0},Eu=fe.define({enables:[Mu,ob]}),gr=fe.define({combine:a=>a.reduce((e,t)=>e.concat(t),[])});class Or{static create(e){return new Or(e)}constructor(e){this.view=e,this.mounted=!1,this.dom=document.createElement("div"),this.dom.classList.add("cm-tooltip-hover"),this.manager=new Au(e,gr,(t,s)=>this.createHostedView(t,s),t=>t.dom.remove())}createHostedView(e,t){let s=e.create(this.view);return s.dom.classList.add("cm-tooltip-section"),this.dom.insertBefore(s.dom,t?t.dom.nextSibling:this.dom.firstChild),this.mounted&&s.mount&&s.mount(this.view),s}mount(e){for(let t of this.manager.tooltipViews)t.mount&&t.mount(e);this.mounted=!0}positioned(e){for(let t of this.manager.tooltipViews)t.positioned&&t.positioned(e)}update(e){this.manager.update(e)}destroy(){var e;for(let t of this.manager.tooltipViews)(e=t.destroy)===null||e===void 0||e.call(t)}passProp(e){let t;for(let s of this.manager.tooltipViews){let o=s[e];if(o!==void 0){if(t===void 0)t=o;else if(t!==o)return}}return t}get offset(){return this.passProp("offset")}get getCoords(){return this.passProp("getCoords")}get overlap(){return this.passProp("overlap")}get resize(){return this.passProp("resize")}}const ib=Eu.compute([gr],a=>{let e=a.facet(gr);return e.length===0?null:{pos:Math.min(...e.map(t=>t.pos)),end:Math.max(...e.map(t=>{var s;return(s=t.end)!==null&&s!==void 0?s:t.pos})),create:Or.create,above:e[0].above,arrow:e.some(t=>t.arrow)}});class nb{constructor(e,t,s,o,r){this.view=e,this.source=t,this.field=s,this.setHover=o,this.hoverTime=r,this.hoverTimeout=-1,this.restartTimeout=-1,this.pending=null,this.lastMove={x:0,y:0,target:e.dom,time:0},this.checkHover=this.checkHover.bind(this),e.dom.addEventListener("mouseleave",this.mouseleave=this.mouseleave.bind(this)),e.dom.addEventListener("mousemove",this.mousemove=this.mousemove.bind(this))}update(){this.pending&&(this.pending=null,clearTimeout(this.restartTimeout),this.restartTimeout=setTimeout(()=>this.startHover(),20))}get active(){return this.view.state.field(this.field)}checkHover(){if(this.hoverTimeout=-1,this.active.length)return;let e=Date.now()-this.lastMove.time;e<this.hoverTime?this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime-e):this.startHover()}startHover(){clearTimeout(this.restartTimeout);let{view:e,lastMove:t}=this,s=e.docView.nearest(t.target);if(!s)return;let o,r=1;if(s instanceof ca)o=s.posAtStart;else{if(o=e.posAtCoords(t),o==null)return;let n=e.coordsAtPos(o);if(!n||t.y<n.top||t.y>n.bottom||t.x<n.left-e.defaultCharacterWidth||t.x>n.right+e.defaultCharacterWidth)return;let c=e.bidiSpans(e.state.doc.lineAt(o)).find(d=>d.from<=o&&d.to>=o),l=c&&c.dir==Re.RTL?-1:1;r=t.x<n.left?-l:l}let i=this.source(e,o,r);if(i?.then){let n=this.pending={pos:o};i.then(c=>{this.pending==n&&(this.pending=null,c&&!(Array.isArray(c)&&!c.length)&&e.dispatch({effects:this.setHover.of(Array.isArray(c)?c:[c])}))},c=>kt(e.state,c,"hover tooltip"))}else i&&!(Array.isArray(i)&&!i.length)&&e.dispatch({effects:this.setHover.of(Array.isArray(i)?i:[i])})}get tooltip(){let e=this.view.plugin(Mu),t=e?e.manager.tooltips.findIndex(s=>s.create==Or.create):-1;return t>-1?e.manager.tooltipViews[t]:null}mousemove(e){var t,s;this.lastMove={x:e.clientX,y:e.clientY,target:e.target,time:Date.now()},this.hoverTimeout<0&&(this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime));let{active:o,tooltip:r}=this;if(o.length&&r&&!cb(r.dom,e)||this.pending){let{pos:i}=o[0]||this.pending,n=(s=(t=o[0])===null||t===void 0?void 0:t.end)!==null&&s!==void 0?s:i;(i==n?this.view.posAtCoords(this.lastMove)!=i:!lb(this.view,i,n,e.clientX,e.clientY))&&(this.view.dispatch({effects:this.setHover.of([])}),this.pending=null)}}mouseleave(e){clearTimeout(this.hoverTimeout),this.hoverTimeout=-1;let{active:t}=this;if(t.length){let{tooltip:s}=this;s&&s.dom.contains(e.relatedTarget)?this.watchTooltipLeave(s.dom):this.view.dispatch({effects:this.setHover.of([])})}}watchTooltipLeave(e){let t=s=>{e.removeEventListener("mouseleave",t),this.active.length&&!this.view.dom.contains(s.relatedTarget)&&this.view.dispatch({effects:this.setHover.of([])})};e.addEventListener("mouseleave",t)}destroy(){clearTimeout(this.hoverTimeout),this.view.dom.removeEventListener("mouseleave",this.mouseleave),this.view.dom.removeEventListener("mousemove",this.mousemove)}}const Fo=4;function cb(a,e){let{left:t,right:s,top:o,bottom:r}=a.getBoundingClientRect(),i;if(i=a.querySelector(".cm-tooltip-arrow")){let n=i.getBoundingClientRect();o=Math.min(n.top,o),r=Math.max(n.bottom,r)}return e.clientX>=t-Fo&&e.clientX<=s+Fo&&e.clientY>=o-Fo&&e.clientY<=r+Fo}function lb(a,e,t,s,o,r){let i=a.scrollDOM.getBoundingClientRect(),n=a.documentTop+a.documentPadding.top+a.contentHeight;if(i.left>s||i.right<s||i.top>o||Math.min(i.bottom,n)<o)return!1;let c=a.posAtCoords({x:s,y:o},!1);return c>=e&&c<=t}function db(a,e={}){let t=we.define(),s=st.define({create(){return[]},update(o,r){if(o.length&&(e.hideOnChange&&(r.docChanged||r.selection)?o=[]:e.hideOn&&(o=o.filter(i=>!e.hideOn(r,i))),r.docChanged)){let i=[];for(let n of o){let c=r.changes.mapPos(n.pos,-1,Ye.TrackDel);if(c!=null){let l=Object.assign(Object.create(null),n);l.pos=c,l.end!=null&&(l.end=r.changes.mapPos(l.end)),i.push(l)}}o=i}for(let i of r.effects)i.is(t)&&(o=i.value),i.is(pb)&&(o=[]);return o},provide:o=>gr.from(o)});return{active:s,extension:[s,at.define(o=>new nb(o,a,s,t,e.hoverTime||300)),ib]}}const pb=we.define(),El=fe.define({combine(a){let e,t;for(let s of a)e=e||s.topContainer,t=t||s.bottomContainer;return{topContainer:e,bottomContainer:t}}});function Xs(a,e){let t=a.plugin(Du),s=t?t.specs.indexOf(e):-1;return s>-1?t.panels[s]:null}const Du=at.fromClass(class{constructor(a){this.input=a.state.facet(Js),this.specs=this.input.filter(t=>t),this.panels=this.specs.map(t=>t(a));let e=a.state.facet(El);this.top=new Ro(a,!0,e.topContainer),this.bottom=new Ro(a,!1,e.bottomContainer),this.top.sync(this.panels.filter(t=>t.top)),this.bottom.sync(this.panels.filter(t=>!t.top));for(let t of this.panels)t.dom.classList.add("cm-panel"),t.mount&&t.mount()}update(a){let e=a.state.facet(El);this.top.container!=e.topContainer&&(this.top.sync([]),this.top=new Ro(a.view,!0,e.topContainer)),this.bottom.container!=e.bottomContainer&&(this.bottom.sync([]),this.bottom=new Ro(a.view,!1,e.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let t=a.state.facet(Js);if(t!=this.input){let s=t.filter(c=>c),o=[],r=[],i=[],n=[];for(let c of s){let l=this.specs.indexOf(c),d;l<0?(d=c(a.view),n.push(d)):(d=this.panels[l],d.update&&d.update(a)),o.push(d),(d.top?r:i).push(d)}this.specs=s,this.panels=o,this.top.sync(r),this.bottom.sync(i);for(let c of n)c.dom.classList.add("cm-panel"),c.mount&&c.mount()}else for(let s of this.panels)s.update&&s.update(a)}destroy(){this.top.sync([]),this.bottom.sync([])}},{provide:a=>pe.scrollMargins.of(e=>{let t=e.plugin(a);return t&&{top:t.top.scrollMargin(),bottom:t.bottom.scrollMargin()}})});class Ro{constructor(e,t,s){this.view=e,this.top=t,this.container=s,this.dom=void 0,this.classes="",this.panels=[],this.syncClasses()}sync(e){for(let t of this.panels)t.destroy&&e.indexOf(t)<0&&t.destroy();this.panels=e,this.syncDOM()}syncDOM(){if(this.panels.length==0){this.dom&&(this.dom.remove(),this.dom=void 0);return}if(!this.dom){this.dom=document.createElement("div"),this.dom.className=this.top?"cm-panels cm-panels-top":"cm-panels cm-panels-bottom",this.dom.style[this.top?"top":"bottom"]="0";let t=this.container||this.view.dom;t.insertBefore(this.dom,this.top?t.firstChild:null)}let e=this.dom.firstChild;for(let t of this.panels)if(t.dom.parentNode==this.dom){for(;e!=t.dom;)e=Dl(e);e=e.nextSibling}else this.dom.insertBefore(t.dom,e);for(;e;)e=Dl(e)}scrollMargin(){return!this.dom||this.container?0:Math.max(0,this.top?this.dom.getBoundingClientRect().bottom-Math.max(0,this.view.scrollDOM.getBoundingClientRect().top):Math.min(innerHeight,this.view.scrollDOM.getBoundingClientRect().bottom)-this.dom.getBoundingClientRect().top)}syncClasses(){if(!(!this.container||this.classes==this.view.themeClasses)){for(let e of this.classes.split(" "))e&&this.container.classList.remove(e);for(let e of(this.classes=this.view.themeClasses).split(" "))e&&this.container.classList.add(e)}}}function Dl(a){let e=a.nextSibling;return a.remove(),e}const Js=fe.define({enables:Du});class ga extends Ta{compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}eq(e){return!1}destroy(e){}}ga.prototype.elementClass="";ga.prototype.toDOM=void 0;ga.prototype.mapMode=Ye.TrackBefore;ga.prototype.startSide=ga.prototype.endSide=-1;ga.prototype.point=!0;const ni=fe.define(),ub=fe.define(),hb={class:"",renderEmptyElements:!1,elementStyle:"",markers:()=>Pe.empty,lineMarker:()=>null,widgetMarker:()=>null,lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{}},Is=fe.define();function fb(a){return[Tu(),Is.of(Object.assign(Object.assign({},hb),a))]}const Tl=fe.define({combine:a=>a.some(e=>e)});function Tu(a){return[mb]}const mb=at.fromClass(class{constructor(a){this.view=a,this.prevViewport=a.viewport,this.dom=document.createElement("div"),this.dom.className="
46cm-gutters",this.dom.setAttribute("aria-hidden","true"),this.dom.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.gutters=a.state.facet(Is).map(e=>new Ll(a,e));for(let e of this.gutters)this.dom.appendChild(e.dom);this.fixed=!a.state.facet(Tl),this.fixed&&(this.dom.style.position="sticky"),this.syncGutters(!1),a.scrollDOM.insertBefore(this.dom,a.contentDOM)}update(a){if(this.updateGutters(a)){let e=this.prevViewport,t=a.view.viewport,s=Math.min(e.to,t.to)-Math.max(e.from,t.from);this.syncGutters(s<(t.to-t.from)*.8)}a.geometryChanged&&(this.dom.style.minHeight=this.view.contentHeight/this.view.scaleY+"px"),this.view.state.facet(Tl)!=!this.fixed&&(this.fixed=!this.fixed,this.dom.style.position=this.fixed?"sticky":""),this.prevViewport=a.view.viewport}syncGutters(a){let e=this.dom.nextSibling;a&&this.dom.remove();let t=Pe.iter(this.view.state.facet(ni),this.view.viewport.from),s=[],o=this.gutters.map(r=>new gb(r,this.view.viewport,-this.view.documentPadding.top));for(let r of this.view.viewportLineBlocks)if(s.length&&(s=[]),Array.isArray(r.type)){let i=!0;for(let n of r.type)if(n.type==it.Text&&i){ln(t,s,n.from);for(let c of o)c.line(this.view,n,s);i=!1}else if(n.widget)for(let c of o)c.widget(this.view,n)}else if(r.type==it.Text){ln(t,s,r.from);
vendor: 28,399 bytes, line 46
46for(let i of o)i.line(this.view,r,s)}else if(r.widget)for(let i of o)i.widget(this.view,r);for(let r of o)r.finish();a&&this.view.scrollDOM.insertBefore(this.dom,e)}updateGutters(a){let e=a.startState.facet(Is),t=a.state.facet(Is),s=a.docChanged||a.heightChanged||a.viewportChanged||!Pe.eq(a.startState.facet(ni),a.state.facet(ni),a.view.viewport.from,a.view.viewport.to);if(e==t)for(let o of this.gutters)o.update(a)&&(s=!0);else{s=!0;let o=[];for(let r of t){let i=e.indexOf(r);i<0?o.push(new Ll(this.view,r)):(this.gutters[i].update(a),o.push(this.gutters[i]))}for(let r of this.gutters)r.dom.remove(),o.indexOf(r)<0&&r.destroy();for(let r of o)this.dom.appendChild(r.dom);this.gutters=o}return s}destroy(){for(let a of this.gutters)a.destroy();this.dom.remove()}},{provide:a=>pe.scrollMargins.of(e=>{let t=e.plugin(a);return!t||t.gutters.length==0||!t.fixed?null:e.textDirection==Re.LTR?{left:t.dom.offsetWidth*e.scaleX}:{right:t.dom.offsetWidth*e.scaleX}})});function Nl(a){return Array.isArray(a)?a:[a]}function ln(a,e,t){for(;a.value&&a.from<=t;)a.from==t&&e.push(a.value),a.next()}class gb{constructor(e,t,s){this.gutter=e,this.height=s,this.i=0,this.cursor=Pe.iter(e.markers,t.from)}addElement(e,t,s){let{gutter:o}=this,r=(t.top-this.height)/e.scaleY,i=t.height/e.scaleY;if(this.i==o.elements.length){let n=new Nu(e,i,r,s);o.elements.push(n),o.dom.appendChild(n.dom)}else o.elements[this.i].update(e,i,r,s);this.height=t.bottom,this.i++}line(e,t,s){let o=[];ln(this.cursor,o,t.from),s.length&&(o=o.concat(s));let r=this.gutter.config.lineMarker(e,t,o);r&&o.unshift(r);let i=this.gutter;o.length==0&&!i.config.renderEmptyElements||this.addElement(e,t,o)}widget(e,t){let s=this.gutter.config.widgetMarker(e,t.widget,t),o=s?[s]:null;for(let r of e.state.facet(ub)){let i=r(e,t.widget,t);i&&(o||(o=[])).push(i)}o&&this.addElement(e,t,o)}finish(){let e=this.gutter;for(;e.elements.length>this.i;){let t=e.elements.pop();e.dom.removeChild(t.dom),t.destroy()}}}class Ll{constructor(e,t){this.view=e,this.config=t,this.elements=[],this.spacer=null,this.dom=document.createElement("div"),this.dom.className="cm-gutter"+(this.config.class?" "+this.config.class:"");for(let s in t.domEventHandlers)this.dom.addEventListener(s,o=>{let r=o.target,i;if(r!=this.dom&&this.dom.contains(r)){for(;r.parentNode!=this.dom;)r=r.parentNode;let c=r.getBoundingClientRect();i=(c.top+c.bottom)/2}else i=o.clientY;let n=e.lineBlockAtHeight(i-e.documentTop);t.domEventHandlers[s](e,n,o)&&o.preventDefault()});this.markers=Nl(t.markers(e)),t.initialSpacer&&(this.spacer=new Nu(e,0,0,[t.initialSpacer(e)]),this.dom.appendChild(this.spacer.dom),this.spacer.dom.style.cssText+="visibility: hidden; pointer-events: none")}update(e){let t=this.markers;if(this.markers=Nl(this.config.markers(e.view)),this.spacer&&this.config.updateSpacer){let o=this.config.updateSpacer(this.spacer.markers[0],e);o!=this.spacer.markers[0]&&this.spacer.update(e.view,0,0,[o])}let s=e.view.viewport;return!Pe.eq(this.markers,t,s.from,s.to)||(this.config.lineMarkerChange?this.config.lineMarkerChange(e):!1)}destroy(){for(let e of this.elements)e.destroy()}}class Nu{constructor(e,t,s,o){this.height=-1,this.above=0,this.markers=[],this.dom=document.createElement("div"),this.dom.className="cm-gutterElement",this.update(e,t,s,o)}update(e,t,s,o){this.height!=t&&(this.height=t,this.dom.style.height=t+"px"),this.above!=s&&(this.dom.style.marginTop=(this.above=s)?s+"px":""),xb(this.markers,o)||this.setMarkers(e,o)}setMarkers(e,t){let s="cm-gutterElement",o=this.dom.firstChild;for(let r=0,i=0;;){let n=i,c=r<t.length?t[r++]:null,l=!1;if(c){let d=c.elementClass;d&&(s+=" "+d);for(let p=i;p<this.markers.length;p++)if(this.markers[p].compare(c)){n=p,l=!0;break}}else n=this.markers.length;for(;i<n;){let d=this.markers[i++];if(d.toDOM){d.destroy(o);let p=o.nextSibling;o.remove(),o=p}}if(!c)break;c.toDOM&&(l?o=o.nextSibling:this.dom.insertBefore(c.toDOM(e),o)),l&&i++}this.dom.className=s,this.markers=t}destroy(){this.setMarkers(null,[])}}function xb(a,e){if(a.length!=e.length)return!1;for(let t=0;t<a.length;t++)if(!a[t].compare(e[t]))return!1;return!0}const bb=fe.define(),vb=fe.define(),$a=fe.define({combine(a){return va(a,{formatNumber:String,domEventHandlers:{}},{domEventHandlers(e,t){let s=Object.assign({},e);for(let o in t){let r=s[o],i=t[o];s[o]=r?(n,c,l)=>r(n,c,l)||i(n,c,l):i}return s}})}});class ci extends ga{constructor(e){super(),this.number=e}eq(e){return this.number==e.number}toDOM(){return document.createTextNode(this.number)}}function li(a,e){return a.state.facet($a).formatNumber(e,a.state)}const jb=Is.compute([$a],a=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers(e){return e.state.facet(bb)},lineMarker(e,t,s){return s.some(o=>o.toDOM)?null:new ci(li(e,e.state.doc.lineAt(t.from).number))},widgetMarker:(e,t,s)=>{for(let o of e.state.facet(vb)){let r=o(e,t,s);if(r)return r}return null},lineMarkerChange:e=>e.startState.facet($a)!=e.state.facet($a),initialSpacer(e){return new ci(li(e,Il(e.state.doc.lines)))},updateSpacer(e,t){let s=li(t.view,Il(t.view.state.doc.lines));return s==e.number?e:new ci(s)},domEventHandlers:a.facet($a).domEventHandlers}));function wb(a={}){return[$a.of(a),Tu(),jb]}function Il(a){let e=9;for(;e<a;)e=e*10+9;return e}let yb=0;class ft{constructor(e,t,s,o){this.name=e,this.set=t,this.base=s,this.modified=o,this.id=yb++}toString(){let{name:e}=this;for(let t of this.modified)t.name&&(e=`${t.name}(${e})`);return e}static define(e,t){let s=typeof e=="string"?e:"?";if(e instanceof ft&&(t=e),t?.base)throw new Error("Can not derive from a modified tag");let o=new ft(s,[],null,[]);if(o.set.push(o),t)for(let r of t.set)o.set.push(r);return o}static defineModifier(e){let t=new xr(e);return s=>s.modified.indexOf(t)>-1?s:xr.get(s.base||s,s.modified.concat(t).sort((o,r)=>o.id-r.id))}}let kb=0;class xr{constructor(e){this.name=e,this.instances=[],this.id=kb++}static get(e,t){if(!t.length)return e;let s=t[0].instances.find(n=>n.base==e&&Cb(t,n.modified));if(s)return s;let o=[],r=new ft(e.name,o,e,t);for(let n of t)n.instances.push(r);let i=Sb(t);for(let n of e.set)if(!n.modified.length)for(let c of i)o.push(xr.get(n,c));return r}}function Cb(a,e){return a.length==e.length&&a.every((t,s)=>t==e[s])}function Sb(a){let e=[[]];for(let t=0;t<a.length;t++)for(let s=0,o=e.length;s<o;s++)e.push(e[s].concat(a[t]));return e.sort((t,s)=>s.length-t.length)}function _b(a){let e=Object.create(null);for(let t in a){let s=a[t];Array.isArray(s)||(s=[s]);for(let o of t.split(" "))if(o){let r=[],i=2,n=o;for(let p=0;;){if(n=="..."&&p>0&&p+3==o.length){i=1;break}let u=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(n);if(!u)throw new RangeError("Invalid path: "+o);if(r.push(u[0]=="*"?"":u[0][0]=='"'?JSON.parse(u[0]):u[0]),p+=u[0].length,p==o.length)break;let f=o[p++];if(p==o.length&&f=="!"){i=0;break}if(f!="/")throw new RangeError("Invalid path: "+o);n=o.slice(p)}let c=r.length-1,l=r[c];if(!l)throw new RangeError("Invalid path: "+o);let d=new br(s,i,c>0?r.slice(0,c):null);e[l]=d.sort(e[l])}}return Lu.add(e)}const Lu=new ye;class br{constructor(e,t,s,o){this.tags=e,this.mode=t,this.context=s,this.next=o}get opaque(){return this.mode==0}get inherit(){return this.mode==1}sort(e){return!e||e.depth<this.depth?(this.next=e,this):(e.next=this.sort(e.next),e)}get depth(){return this.context?this.context.length:0}}br.empty=new br([],2,null);function Iu(a,e){let t=Object.create(null);for(let r of a)if(!Array.isArray(r.tag))t[r.tag.id]=r.class;else for(let i of r.tag)t[i.id]=r.class;let{scope:s,all:o=null}=e||{};return{style:r=>{let i=o;for(let n of r)for(let c of n.set){let l=t[c.id];if(l){i=i?i+" "+l:l;break}}return i},scope:s}}function Pb(a,e){let t=null;for(let s of a){let o=s.style(e);o&&(t=t?t+" "+o:o)}return t}function Ab(a,e,t,s=0,o=a.length){let r=new Mb(s,Array.isArray(e)?e:[e],t);r.highlightRange(a.cursor(),s,o,"",r.highlighters),r.flush(o)}class Mb{constructor(e,t,s){this.at=e,this.highlighters=t,this.span=s,this.class=""}startSpan(e,t){t!=this.class&&(this.flush(e),e>this.at&&(this.at=e),this.class=t)}flush(e){e>this.at&&this.class&&this.span(this.at,e,this.class)}highlightRange(e,t,s,o,r){let{type:i,from:n,to:c}=e;if(n>=s||c<=t)return;i.isTop&&(r=this.highlighters.filter(f=>!f.scope||f.scope(i)));let l=o,d=Eb(e)||br.empty,p=Pb(r,d.tags);if(p&&(l&&(l+=" "),l+=p,d.mode==1&&(o+=(o?" ":"")+p)),this.startSpan(Math.max(t,n),l),d.opaque)return;let u=e.tree&&e.tree.prop(ye.mounted);if(u&&u.overlay){let f=e.node.enter(u.overlay[0].from+n,1),m=this.highlighters.filter(x=>!x.scope||x.scope(u.tree.type)),g=e.firstChild();for(let x=0,b=n;;x++){let y=x<u.overlay.length?u.overlay[x]:null,k=y?y.from+n:c,A=Math.max(t,b),S=Math.min(s,k);if(A<S&&g)for(;e.from<S&&(this.highlightRange(e,A,S,o,r),this.startSpan(Math.min(S,e.to),l),!(e.to>=k||!e.nextSibling())););if(!y||k>s)break;b=y.to+n,b>t&&(this.highlightRange(f.cursor(),Math.max(t,y.from+n),Math.min(s,b),"",m),this.startSpan(Math.min(s,b),l))}g&&e.parent()}else if(e.firstChild()){u&&(o="");do if(!(e.to<=t)){if(e.from>=s)break;this.highlightRange(e,t,s,o,r),this.startSpan(Math.min(s,e.to),l)}while(e.nextSibling());e.parent()}}}function Eb(a){let e=a.type.prop(Lu);for(;e&&e.context&&!a.matchContext(e.context);)e=e.next;return e||null}const le=ft.define,Bo=le(),aa=le(),Ol=le(aa),Fl=le(aa),sa=le(),zo=le(sa),di=le(sa),Tt=le(),ya=le(Tt),Et=le(),Dt=le(),dn=le(),bs=le(dn),Vo=le(),w={comment:Bo,lineComment:le(Bo),blockComment:le(Bo),docComment:le(Bo),name:aa,variableName:le(aa),typeName:Ol,tagName:le(Ol),propertyName:Fl,attributeName:le(Fl),className:le(aa),labelName:le(aa),namespace:le(aa),macroName:le(aa),literal:sa,string:zo,docString:le(zo),character:le(zo),attributeValue:le(zo),number:di,integer:le(di),float:le(di),bool:le(sa),regexp:le(sa),escape:le(sa),color:le(sa),url:le(sa),keyword:Et,self:le(Et),null:le(Et),atom:le(Et),unit:le(Et),modifier:le(Et),operatorKeyword:le(Et),controlKeyword:le(Et),definitionKeyword:le(Et),moduleKeyword:le(Et),operator:Dt,derefOperator:le(Dt),arithmeticOperator:le(Dt),logicOperator:le(Dt),bitwiseOperator:le(Dt),compareOperator:le(Dt),updateOperator:le(Dt),definitionOperator:le(Dt),typeOperator:le(Dt),controlOperator:le(Dt),punctuation:dn,separator:le(dn),bracket:bs,angleBracket:le(bs),squareBracket:le(bs),paren:le(bs),brace:le(bs),content:Tt,heading:ya,heading1:le(ya),heading2:le(ya),heading3:le(ya),heading4:le(ya),heading5:le(ya),heading6:le(ya),contentSeparator:le(Tt),list:le(Tt),quote:le(Tt),emphasis:le(Tt),strong:le(Tt),link:le(Tt),monospace:le(Tt),strikethrough:le(Tt),inserted:le(),deleted:le(),changed:le(),invalid:le(),meta:Vo,documentMeta:le(Vo),annotation:le(Vo),processingInstruction:le(Vo),definition:ft.defineModifier("definition"),constant:ft.defineModifier("constant"),function:ft.defineModifier("function"),standard:ft.defineModifier("standard"),local:ft.defineModifier("local"),special:ft.defineModifier("special")};for(let a in w){let e=w[a];e instanceof ft&&(e.name=a)}Iu([{tag:w.link,class:"tok-link"},{tag:w.heading,class:"tok-heading"},{tag:w.emphasis,class:"tok-emphasis"},{tag:w.strong,class:"tok-strong"},{tag:w.keyword,class:"tok-keyword"},{tag:w.atom,class:"tok-atom"},{tag:w.bool,class:"tok-bool"},{tag:w.url,class:"tok-url"},{tag:w.labelName,class:"tok-labelName"},{tag:w.inserted,class:"tok-inserted"},{tag:w.deleted,class:"tok-deleted"},{tag:w.literal,class:"tok-literal"},{tag:w.string,class:"tok-string"},{tag:w.number,class:"tok-number"},{tag:[w.regexp,w.escape,w.special(w.string)],class:"tok-string2"},{tag:w.variableName,class:"tok-variableName"},{tag:w.local(w.variableName),class:"tok-variableName tok-local"},{tag:w.definition(w.variableName),class:"tok-variableName tok-definition"},{tag:w.special(w.variableName),class:"tok-variableName2"},{tag:w.definition(w.propertyName),class:"tok-propertyName tok-definition"},{tag:w.typeName,class:"tok-typeName"},{tag:w.namespace,class:"tok-namespace"},{tag:w.className,class:"tok-className"},{tag:w.macroName,class:"tok-macroName"},{tag:w.propertyName,class:"tok-propertyName"},{tag:w.operator,class:"tok-operator"},{tag:w.comment,class:"tok-comment"},{tag:w.meta,class:"tok-meta"},{tag:w.invalid,class:"tok-invalid"},{tag:w.punctuation,class:"tok-punctuation"}]);var pi;const Aa=new ye;function Ou(a){return fe.define({combine:a?e=>e.concat(a):void 0})}const Db=new ye;class gt{constructor(e,t,s=[],o=""){this.data=e,this.name=o,_e.prototype.hasOwnProperty("tree")||Object.defineProperty(_e.prototype,"tree",{get(){return Je(this)}}),this.parser=t,this.extension=[xa.of(this),_e.languageData.of((r,i,n)=>{let c=Rl(r,i,n),l=c.type.prop(Aa);if(!l)return[];let d=r.facet(l),p=c.type.prop(Db);if(p){let u=c.resolve(i-c.from,n);for(let f of p)if(f.test(u,r)){let m=r.facet(f.facet);return f.type=="replace"?m:m.concat(d)}}return d})].concat(s)}isActiveAt(e,t,s=-1){return Rl(e,t,s).type.prop(Aa)==this.data}findRegions(e){let t=e.facet(xa);if(t?.data==this.data)return[{from:0,to:e.doc.length}];if(!t||!t.allowsNesting)return[];let s=[],o=(r,i)=>{if(r.prop(Aa)==this.data){s.push({from:i,to:i+r.length});return}let n=r.prop(ye.mounted);if(n){if(n.tree.prop(Aa)==this.data){if(n.overlay)for(let c of n.overlay)s.push({from:c.from+i,to:c.to+i});else s.push({from:i,to:i+r.length});return}else if(n.overlay){let c=s.length;if(o(n.tree,n.overlay[0].from+i),s.length>c)return}}for(let c=0;c<r.children.length;c++){let l=r.children[c];l instanceof Le&&o(l,r.positions[c]+i)}};return o(Je(e),0),s}get allowsNesting(){return!0}}gt.setState=we.define();function Rl(a,e,t){let s=a.facet(xa),o=Je(a).topNode;if(!s||s.allowsNesting)for(let r=o;r;r=r.enter(e,t,Be.ExcludeBuffers))r.type.isTop&&(o=r);return o}class pn extends gt{constructor(e,t,s){super(e,t,[],s),this.parser=t}static define(e){let t=Ou(e.languageData);return new pn(t,e.parser.configure({props:[Aa.add(s=>s.isTop?t:void 0)]}),e.name)}configure(e,t){return new pn(this.data,this.parser.configure(e),t||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function Je(a){let e=a.field(gt.state,!1);return e?e.tree:Le.empty}class Tb{constructor(e){this.doc=e,this.cursorPos=0,this.string="",this.cursor=e.iter()}get length(){return this.doc.length}syncTo(e){return this.string=this.cursor.next(e-this.cursorPos).value,this.cursorPos=e+this.string.length,this.cursorPos-this.string.length}chunk(e){return this.syncTo(e),this.string}get lineChunks(){return!0}read(e,t){let s=this.cursorPos-this.string.length;return e<s||t>=this.cursorPos?this.doc.sliceString(e,t):this.string.slice(e-s,t-s)}}let vs=null;class es{constructor(e,t,s=[],o,r,i,n,c){this.parser=e,this.state=t,this.fragments=s,this.tree=o,this.treeLen=r,this.viewport=i,this.skipped=n,this.scheduleOn=c,this.parse=null,this.tempSkipped=[]}static create(e,t,s){return new es(e,t,[],Le.empty,0,s,[],null)}startParse(){return this.parser.startParse(new Tb(this.state.doc),this.fragments)}work(e,t){return t!=null&&t>=this.state.doc.length&&(t=void 0),this.tree!=Le.empty&&this.isDone(t??this.state.doc.length)?(this.takeTree(),!0):this.withContext(()=>{var s;if(typeof e=="number"){let o=Date.now()+e;e=()=>Date.now()>o}for(this.parse||(this.parse=this.startParse()),t!=null&&(this.parse.stoppedAt==null||this.parse.stoppedAt>t)&&t<this.state.doc.length&&this.parse.stopAt(t);;){let o=this.parse.advance();if(o)if(this.fragments=this.withoutTempSkipped(Yt.addTree(o,this.fragments,this.parse.stoppedAt!=null)),this.treeLen=(s=this.parse.stoppedAt)!==null&&s!==void 0?s:this.state.doc.length,this.tree=o,this.parse=null,this.treeLen<(t??this.state.doc.length))this.parse=this.startParse();else return!0;if(e())return!1}})}takeTree(){let e,t;this.parse&&(e=this.parse.parsedPos)>=this.treeLen&&((this.parse.stoppedAt==null||this.parse.stoppedAt>e)&&this.parse.stopAt(e),this.withContext(()=>{for(;!(t=this.parse.advance()););}),this.treeLen=e,this.tree=t,this.fragments=this.withoutTempSkipped(Yt.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let t=vs;vs=this;try{return e()}finally{vs=t}}withoutTempSkipped(e){for(let t;t=this.tempSkipped.pop();)e=Bl(e,t.from,t.to);return e}changes(e,t){let{fragments:s,tree:o,treeLen:r,viewport:i,skipped:n}=this;if(this.takeTree(),!e.empty){let c=[];if(e.iterChangedRanges((l,d,p,u)=>c.push({fromA:l,toA:d,fromB:p,toB:u})),s=Yt.applyChanges(s,c),o=Le.empty,r=0,i={from:e.mapPos(i.from,-1),to:e.mapPos(i.to,1)},this.skipped.length){n=[];for(let l of this.skipped){let d=e.mapPos(l.from,1),p=e.mapPos(l.to,-1);d<p&&n.push({from:d,to:p})}}}return new es(this.parser,t,s,o,r,i,n,this.scheduleOn)}updateViewport(e){if(this.viewport.from==e.from&&this.viewport.to==e.to)return!1;this.viewport=e;let t=this.skipped.length;for(let s=0;s<this.skipped.length;s++){let{from:o,to:r}=this.skipped[s];o<e.to&&r>e.from&&(this.fragments=Bl(this.fragments,o,r),this.skipped.splice(s--,1))}return this.skipped.length>=t?!1:(this.reset(),!0)}reset(){this.parse&&(this.takeTree(),this.parse=null)}skipUntilInView(e,t){this.skipped.push({from:e,to:t})}static getSkippingParser(e){return new class extends np{createParse(t,s,o){let r=o[0].from,i=o[o.length-1].to;return{parsedPos:r,advance(){let c=vs;if(c){for(let l of o)c.tempSkipped.push(l);e&&(c.scheduleOn=c.scheduleOn?Promise.all([c.scheduleOn,e]):e)}return this.parsedPos=i,new Le(ct.none,[],[],i-r)},stoppedAt:null,stopAt(){}}}}}isDone(e){e=Math.min(e,this.state.doc.length);let t=this.fragments;return this.treeLen>=e&&t.length&&t[0].from==0&&t[0].to>=e}static get(){return vs}}function Bl(a,e,t){return Yt.applyChanges(a,[{fromA:e,toA:t,fromB:e,toB:t}])}class ts{constructor(e){this.context=e,this.tree=e.tree}apply(e){if(!e.docChanged&&this.tree==this.context.tree)return this;let t=this.context.changes(e.changes,e.state),s=this.context.treeLen==e.startState.doc.length?void 0:Math.max(e.changes.mapPos(this.context.treeLen),t.viewport.to);return t.work(20,s)||t.takeTree(),new ts(t)}static init(e){let t=Math.min(3e3,e.doc.length),s=es.create(e.facet(xa).parser,e,{from:0,to:t});return s.work(20,t)||s.takeTree(),new ts(s)}}gt.state=st.define({create:ts.init,update(a,e){for(let t of e.effects)if(t.is(gt.setState))return t.value;return e.startState.facet(xa)!=e.state.facet(xa)?ts.init(e.state):a.apply(e)}});let Fu=a=>{let e=setTimeout(()=>a(),500);return()=>clearTimeout(e)};typeof requestIdleCallback<"u"&&(Fu=a=>{let e=-1,t=setTimeout(()=>{e=requestIdleCallback(a,{timeout:400})},100);return()=>e<0?clearTimeout(t):cancelIdleCallback(e)});const ui=typeof navigator<"u"&&(!((pi=navigator.scheduling)===null||pi===void 0)&&pi.isInputPending)?()=>navigator.scheduling.isInputPending():null,Nb=at.fromClass(class{constructor(e){this.view=e,this.working=null,this.workScheduled=0,this.chunkEnd=-1,this.chunkBudget=-1,this.work=this.work.bind(this),this.scheduleWork()}update(e){let t=this.view.state.field(gt.state).context;(t.updateViewport(e.view.viewport)||this.view.viewport.to>t.treeLen)&&this.scheduleWork(),(e.docChanged||e.selectionSet)&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(t)}scheduleWork(){if(this.working)return;let{state:e}=this.view,t=e.field(gt.state);(t.tree!=t.context.tree||!t.context.isDone(e.doc.length))&&(this.working=Fu(this.work))}work(e){this.working=null;let t=Date.now();if(this.chunkEnd<t&&(this.chunkEnd<0||this.view.hasFocus)&&(this.chunkEnd=t+3e4,this.chunkBudget=3e3),this.chunkBudget<=0)return;let{state:s,viewport:{to:o}}=this.view,r=s.field(gt.state);if(r.tree==r.context.tree&&r.context.isDone(o+1e5))return;let i=Date.now()+Math.min(this.chunkBudget,100,e&&!ui?Math.max(25,e.timeRemaining()-5):1e9),n=r.context.treeLen<o&&s.doc.length>o+1e3,c=r.context.work(()=>ui&&ui()||Date.now()>i,o+(n?0:1e5));this.chunkBudget-=Date.now()-t,(c||this.chunkBudget<=0)&&(r.context.takeTree(),this.view.dispatch({effects:gt.setState.of(new ts(r.context))})),this.chunkBudget>0&&!(c&&!n)&&this.scheduleWork(),this.checkAsyncSchedule(r.context)}checkAsyncSchedule(e){e.scheduleOn&&(this.workScheduled++,e.scheduleOn.then(()=>this.scheduleWork()).catch(t=>kt(this.view.state,t)).then(()=>this.workScheduled--),e.scheduleOn=null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),xa=fe.define({combine(a){return a.length?a[0]:null},enables:a=>[gt.state,Nb,pe.contentAttributes.compute([a],e=>{let t=e.facet(a);return t&&t.name?{"data-language":t.name}:{}})]});class Lb{constructor(e,t=[]){this.language=e,this.support=t,this.extension=[e,t]}}class q{constructor(e,t,s,o,r,i=void 0){this.name=e,this.alias=t,this.extensions=s,this.filename=o,this.loadFunc=r,this.support=i,this.loading=null}load(){return this.loading||(this.loading=this.loadFunc().then(e=>this.support=e,e=>{throw this.loading=null,e}))}static of(e){let{load:t,support:s}=e;if(!t){if(!s)throw new RangeError("Must pass either 'load' or 'support' to LanguageDescription.of");t=()=>Promise.resolve(s)}return new q(e.name,(e.alias||[]).concat(e.name).map(o=>o.toLowerCase()),e.extensions||[],e.filename,t,s)}static matchFilename(e,t){for(let o of e)if(o.filename&&o.filename.test(t))return o;let s=/\.([^.]+)$/.exec(t);if(s){for(let o of e)if(o.extensions.indexOf(s[1])>-1)return o}return null}static matchLanguageName(e,t,s=!0){t=t.toLowerCase();for(let o of e)if(o.alias.some(r=>r==t))return o;if(s)for(let o of e)for(let r of o.alias){let i=t.indexOf(r);if(i>-1&&(r.length>2||!/\w/.test(t[i-1])&&!/\w/.test(t[i+r.length])))return o}return null}}const Ib=fe.define(),Fr=fe.define({combine:a=>{if(!a.length)return" ";let e=a[0];if(!e||/\S/.test(e)||Array.from(e).some(t=>t!=e[0]))throw new Error("Invalid indent unit: "+JSON.stringify(a[0]));return e}});function Oa(a){let e=a.facet(Fr);return e.charCodeAt(0)==9?a.tabSize*e.length:e.length}function Zs(a,e){let t="",s=a.tabSize,o=a.facet(Fr)[0];if(o==" "){for(;e>=s;)t+=" ",e-=s;o=" "}for(let r=0;r<e;r++)t+=o;return t}function Yn(a,e){a instanceof _e&&(a=new Rr(a));for(let s of a.state.facet(Ib)){let o=s(a,e);if(o!==void 0)return o}let t=Je(a.state);return t.length>=e?Ob(a,t,e):null}class Rr{constructor(e,t={}){this.state=e,this.options=t,this.unit=Oa(e)}lineAt(e,t=1){let s=this.state.doc.lineAt(e),{simulateBreak:o,simulateDoubleBreak:r}=this.options;return o!=null&&o>=s.from&&o<=s.to?r&&o==e?{text:"",from:e}:(t<0?o<e:o<=e)?{text:s.text.slice(o-s.from),from:o}:{text:s.text.slice(0,o-s.from),from:s.from}:s}textAfterPos(e,t=1){if(this.options.simulateDoubleBreak&&e==this.options.simulateBreak)return"";let{text:s,from:o}=this.lineAt(e,t);return s.slice(e-o,Math.min(s.length,e+100-o))}column(e,t=1){let{text:s,from:o}=this.lineAt(e,t),r=this.countColumn(s,e-o),i=this.options.overrideIndentation?this.options.overrideIndentation(o):-1;return i>-1&&(r+=i-this.countColumn(s,s.search(/\S|$/))),r}countColumn(e,t=e.length){return Tr(e,this.state.tabSize,t)}lineIndent(e,t=1){let{text:s,from:o}=this.lineAt(e,t),r=this.options.overrideIndentation;if(r){let i=r(o);if(i>-1)return i}return this.countColumn(s,s.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}}const Ru=new ye;function Ob(a,e,t){let s=e.resolveStack(t),o=e.resolveInner(t,-1).resolve(t,0).enterUnfinishedNodesBefore(t);if(o!=s.node){let r=[];for(let i=o;i&&!(i.from==s.node.from&&i.type==s.node.type);i=i.parent)r.push(i);for(let i=r.length-1;i>=0;i--)s={node:r[i],next:s}}return Bu(s,a,t)}function Bu(a,e,t){for(let s=a;s;s=s.next){let o=Rb(s.node);if(o)return o(Xn.create(e,t,s))}return 0}function Fb(a){return a.pos==a.options.simulateBreak&&a.options.simulateDoubleBreak}function Rb(a){let e=a.type.prop(Ru);if(e)return e;let t=a.firstChild,s;if(t&&(s=t.type.prop(ye.closedBy))){let o=a.lastChild,r=o&&s.indexOf(o.name)>-1;return i=>zu(i,!0,1,void 0,r&&!Fb(i)?o.from:void 0)}return a.parent==null?Bb:null}function Bb(){return 0}class Xn extends Rr{constructor(e,t,s){super(e.state,e.options),this.base=e,this.pos=t,this.context=s}get node(){return this.context.node}static create(e,t,s){return new Xn(e,t,s)}get textAfter(){return this.textAfterPos(this.pos)}get baseIndent(){return this.baseIndentFor(this.node)}baseIndentFor(e){let t=this.state.doc.lineAt(e.from);for(;;){let s=e.resolve(t.from);for(;s.parent&&s.parent.from==s.from;)s=s.parent;if(zb(s,e))break;t=this.state.doc.lineAt(s.from)}return this.lineIndent(t.from)}continue(){return Bu(this.context.next,this.base,this.pos)}}function zb(a,e){for(let t=e;t;t=t.parent)if(a==t)return!0;return!1}function Vb(a){let e=a.node,t=e.childAfter(e.from),s=e.lastChild;if(!t)return null;let o=a.options.simulateBreak,r=a.state.doc.lineAt(t.from),i=o==null||o<=r.from?r.to:Math.min(r.to,o);for(let n=t.to;;){let c=e.childAfter(n);if(!c||c==s)return null;if(!c.type.isSkipped){if(c.from>=i)return null;let l=/^ */.exec(r.text.slice(t.to-r.from))[0].length;return{from:t.from,to:t.to+l}}n=c.to}}function _2({closing:a,align:e=!0,units:t=1}){return s=>zu(s,e,t,a)}function zu(a,e,t,s,o){let r=a.textAfter,i=r.match(/^\s*/)[0].length,n=s&&r.slice(i,i+s.length)==s||o==a.pos+i,c=e?Vb(a):null;return c?n?a.column(c.from):a.column(c.to):a.baseIndent+(n?0:a.unit*t)}const P2=a=>a.baseIndent;function A2({except:a,units:e=1}={}){return t=>{let s=a&&a.test(t.textAfter);return t.baseIndent+(s?0:e*t.unit)}}const Wb=200;function Hb(){return _e.transactionFilter.of(a=>{if(!a.docChanged||!a.isUserEvent("input.type")&&!a.isUserEvent("input.complete"))return a;let e=a.startState.languageDataAt("indentOnInput",a.startState.selection.main.head);if(!e.length)return a;let t=a.newDoc,{head:s}=a.newSelection.main,o=t.lineAt(s);if(s>o.from+Wb)return a;let r=t.sliceString(o.from,s);if(!e.some(l=>l.test(r)))return a;let{state:i}=a,n=-1,c=[];for(let{head:l}of i.selection.ranges){let d=i.doc.lineAt(l);if(d.from==n)continue;n=d.from;let p=Yn(i,d.from);if(p==null)continue;let u=/^\s*/.exec(d.text)[0],f=Zs(i,p);u!=f&&c.push({from:d.from,to:d.from+u.length,insert:f})}return c.length?[a,{changes:c,sequential:!0}]:a})}const $b=fe.define(),Ub=new ye;function M2(a){let e=a.firstChild,t=a.lastChild;return e&&e.to<t.from?{from:e.to,to:t.type.isError?a.to:t.from}:null}function qb(a,e,t){let s=Je(a);if(s.length<t)return null;let o=s.resolveStack(t,1),r=null;for(let i=o;i;i=i.next){let n=i.node;if(n.to<=t||n.from>t)continue;if(r&&n.from<e)break;let c=n.type.prop(Ub);if(c&&(n.to<s.length-50||s.length==a.doc.length||!Kb(n))){let l=c(n,a);l&&l.from<=t&&l.from>=e&&l.to>t&&(r=l)}}return r}function Kb(a){let e=a.lastChild;return e&&e.to==a.to&&e.type.isError}function zl(a,e,t){for(let s of a.facet($b)){let o=s(a,e,t);if(o)return o}return qb(a,e,t)}function Vu(a,e){let t=e.mapPos(a.from,1),s=e.mapPos(a.to,-1);return t>=s?void 0:{from:t,to:s}}const Wu=we.define({map:Vu}),Jn=we.define({map:Vu}),vr=st.define({create(){return be.none},update(a,e){a=a.map(e.changes);for(let t of e.effects)if(t.is(Wu)&&!Gb(a,t.value.from,t.value.to)){let{preparePlaceholder:s}=e.state.facet(Hu),o=s?be.replace({widget:new Jb(s(e.state,t.value))}):Vl;a=a.update({add:[o.range(t.value.from,t.value.to)]})}else t.is(Jn)&&(a=a.update({filter:(s,o)=>t.value.from!=s||t.value.to!=o,filterFrom:t.value.from,filterTo:t.value.to}));if(e.selection){let t=!1,{head:s}=e.selection.main;a.between(s,s,(o,r)=>{o<s&&r>s&&(t=!0)}),t&&(a=a.update({filterFrom:s,filterTo:s,filter:(o,r)=>r<=s||o>=s}))}return a},provide:a=>pe.decorations.from(a),toJSON(a,e){let t=[];return a.between(0,e.doc.length,(s,o)=>{t.push(s,o)}),t},fromJSON(a){if(!Array.isArray(a)||a.length%2)throw new RangeError("Invalid JSON for fold state");let e=[];for(let t=0;t<a.length;){let s=a[t++],o=a[t++];if(typeof s!="number"||typeof o!="number")throw new RangeError("Invalid JSON for fold state");e.push(Vl.range(s,o))}return be.set(e,!0)}});function un(a,e,t){var s;let o=null;return(s=a.field(vr,!1))===null||s===void 0||s.between(e,t,(r,i)=>{(!o||o.from>r)&&(o={from:r,to:i})}),o}function Gb(a,e,t){let s=!1;return a.between(e,e,(o,r)=>{o==e&&r==t&&(s=!0)}),s}const Yb={placeholderDOM:null,preparePlaceholder:null,placeholderText:"â¦"},Hu=fe.define({combine(a){return va(a,Yb)}});function Xb(a){return[vr,e0]}function $u(a,e){let{state:t}=a,s=t.facet(Hu),o=i=>{let n=a.lineBlockAt(a.posAtDOM(i.target)),c=un(a.state,n.from,n.to);c&&a.dispatch({effects:Jn.of(c)}),i.preventDefault()};if(s.placeholderDOM)return s.placeholderDOM(a,o,e);let r=document.createElement("span");return r.textContent=s.placeholderText,r.setAttribute("aria-label",t.phrase("folded code")),r.title=t.phrase("unfold"),r.className="
46cm-foldPlaceholder",r.onclick=o,r}const Vl=be.replace({widget:new class extends Ba{toDOM(a){return $u(a,null)}}});class Jb extends Ba{constructor(e){super(),this.value=e}eq(e){return this.value==e.value}toDOM(e){return $u(e,this.value)}}const Zb={openText:"â",closedText:"âº",markerDOM:null,domEventHandlers:{},foldingChanged:()=>!1};class hi extends ga{constructor(e,t){super(),this.config=e,this.open=t}eq(e){return this.config==e.config&&this.open==e.open}toDOM(e){if(this.config.markerDOM)return this.config.markerDOM(this.open);let t=document.createElement("span");return t.textContent=this.open?this.config.openText:this.config.closedText,t.title=e.state.phrase(this.open?"Fold line":"Unfold line"),t}}function Qb(a={}){let e=Object.assign(Object.assign({},Zb),a),t=new hi(e,!0),s=new hi(e,!1),o=at.fromClass(class{constructor(i){this.from=i.viewport.from,this.markers=this.buildMarkers(i)}update(i){(i.docChanged||i.viewportChanged||i.startState.facet(xa)!=i.state.facet(xa)||i.startState.field(vr,!1)!=i.state.field(vr,!1)||Je(i.startState)!=Je(i.state)||e.foldingChanged(i))&&(this.markers=this.buildMarkers(i.view))}buildMarkers(i){let n=new ua;for(let c of i.viewportLineBlocks){let l=un(i.state,c.from,c.to)?s:zl(i.state,c.from,c.to)?t:null;l&&n.add(c.from,c.from,l)}return n.finish()}}),{domEventHandlers:r}=e;return[o,fb({class:"cm-foldGutter",markers(i){var n;return((n=i.plugin(o))===null||n===void 0?void 0:n.markers)||Pe.empty},initialSpacer(){return new hi(e,!1)},domEventHandlers:Object.assign(Object.assign({},r),{click:(i,n,c)=>{if(r.click&&r.click(i,n,c))return!0;let l=un(i.state,n.from,n.to);if(l)return i.dispatch({effects:Jn.of(l)}),!0;let d=zl(i.state,n.from,n.to);return d?(i.dispatch({effects:Wu.of(d)}),!0):!1}})}),Xb()]}const e0=pe.baseTheme({".cm-foldPlaceholder":{backgroundColor:"#eee",border:"1px solid #ddd",color:"#888",borderRadius:".2em",margin:"0 1px",padding:"0 1px",cursor:"pointer"},".cm-foldGutter span":{padding:"0 1px",cursor:"pointer"}});class cs{constructor(e,t){this.specs=e;let s;function o(n){let c=ha.newName();return(s||(s=Object.create(null)))["."+c]=n,c}const r=typeof t.all=="string"?t.all:t.all?o(t.all):void 0,i=t.scope;this.scope=i instanceof gt?n=>n.prop(Aa)==i.data:i?n=>n==i:void 0,this.style=Iu(e.map(n=>({tag:n.tag,class:n.class||o(Object.assign({},n,{tag:null}))})),{all:r}).style,this.module=s?new ha(s):null,this.themeType=t.themeType}static define(e,t){return new cs(e,t||{})}}const hn=fe.define(),t0=fe.define({combine(a){return a.length?[a[0]]:null}});function fi(a){let e=a.facet(hn);return e.length?e:a.facet(t0)}function Zn(a,e){let t=[s0],s;return a instanceof cs&&(a.module&&t.push(pe.styleModule.of(a.module)),s=a.themeType),s?t.push(hn.computeN([pe.darkTheme],o=>o.facet(pe.darkTheme)==(s=="dark")?[a]:[])):t.push(hn.of(a)),t}class a0{constructor(e){this.markCache=Object.create(null),this.tree=Je(e.state),this.decorations=this.buildDeco(e,fi(e.state)),this.decoratedTo=e.viewport.to}update(e){let t=Je(e.state),s=fi(e.state),o=s!=fi(e.startState),{viewport:r}=e.view,i=e.changes.mapPos(this.decoratedTo,1);t.length<r.to&&!o&&t.type==this.tree.type&&i>=r.to?(this.decorations=this.decorations.map(e.changes),this.decoratedTo=i):(t!=this.tree||e.viewportChanged||o)&&(this.tree=t,this.decorations=this.buildDeco(e.view,s),this.decoratedTo=r.to)}buildDeco(e,t){if(!t||!this.tree.length)return be.none;let s=new ua;for(let{from:o,to:r}of e.visibleRanges)Ab(this.tree,t,(i,n,c)=>{s.add(i,n,this.markCache[c]||(this.markCache[c]=be.mark({class:c})))},o,r);return s.finish()}}const s0=is.high(at.fromClass(a0,{decorations:a=>a.decorations})),o0=pe.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),Uu=1e4,qu="()[]{}
46",Ku=fe.define({combine(a){return va(a,{afterCursor:!0,brackets:qu,maxScanDistance:Uu,renderMatch:n0})}}),r0=be.mark({class:"cm-matchingBracket"}),i0=be.mark({class:"cm-nonmatchingBracket"});function n0(a){let e=[],t=a.matched?r0:i0;return e.push(t.range(a.start.from,a.start.to)),a.end&&e.push(t.range(a.end.from,a.end.to)),e}const c0=st.define({create(){return be.none},update(a,e){if(!e.docChanged&&!e.selection)return a;let t=[],s=e.state.facet(Ku);for(let o of e.state.selection.ranges){if(!o.empty)continue;let r=Ot(e.state,o.head,-1,s)||o.head>0&&Ot(e.state,o.head-1,1,s)||s.afterCursor&&(Ot(e.state,o.head,1,s)||o.head<e.state.doc.length&&Ot(e.state,o.head+1,-1,s));r&&(t=t.concat(s.renderMatch(r,e.state)))}return be.set(t,!0)},provide:a=>pe.decorations.from(a)}),l0=[c0,o0];function d0(a={}){return[Ku.of(a),l0]}const p0=new ye;function fn(a,e,t){let s=a.prop(e<0?ye.openedBy:ye.closedBy);if(s)return s;if(a.name.length==1){let o=t.indexOf(a.name);if(o>-1&&o%2==(e<0?1:0))return[t[o+e]]}return null}function mn(a){let e=a.type.prop(p0);return e?e(a.node):a}function Ot(a,e,t,s={}){let o=s.maxScanDistance||Uu,r=s.brackets||qu,i=Je(a),n=i.resolveInner(e,t);for(let c=n;c;c=c.parent){let l=fn(c.type,t,r);if(l&&c.from<c.to){let d=mn(c);if(d&&(t>0?e>=d.from&&e<d.to:e>d.from&&e<=d.to))return u0(a,e,t,c,d,l,r)}}return h0(a,e,t,i,n.type,o,r)}function u0(a,e,t,s,o,r,i){let n=s.parent,c={from:o.from,to:o.to},l=0,d=n?.cursor();if(d&&(t<0?d.childBefore(s.from):d.childAfter(s.to)))do if(t<0?d.to<=s.from:d.from>=s.to){if(l==0&&r.indexOf(d.type.name)>-1&&d.from<d.to){let p=mn(d);return{start:c,end:p?{from:p.from,to:p.to}:void 0,matched:!0}}else if(fn(d.type,t,i))l++;else if(fn(d.type,-t,i)){if(l==0){let p=mn(d);return{start:c,end:p&&p.from<p.to?{from:p.from,to:p.to}:void 0,matched:!1}}l--}}while(t<0?d.prevSibling():d.nextSibling());return{start:c,matched:!1}}function h0(a,e,t,s,o,r,i){let n=t<0?a.sliceDoc(e-1,e):a.sliceDoc(e,e+1),c=i.indexOf(n);if(c<0||c%2==0!=t>0)return null;let l={from:t<0?e-1:e,to:t>0?e+1:e},d=a.doc.iterRange(e,t>0?a.doc.length:0),p=0;for(let u=0;!d.next().done&&u<=r;){let f=d.value;t<0&&(u+=f.length);let m=e+u*t;for(let g=t>0?0:f.length-1,x=t>0?f.length:-1;g!=x;g+=t){let b=i.indexOf(f[g]);if(!(b<0||s.resolveInner(m+g,1).type!=o))if(b%2==0==t>0)p++;else{if(p==1)return{start:l,end:{from:m+g,to:m+g+1},matched:b>>1==c>>1};p--}}t>0&&(u+=f.length)}return d.done?{start:l,matched:!1}:null}function Wl(a,e,t,s=0,o=0){e==null&&(e=a.search(/[^\s\u00a0]/),e==-1&&(e=a.length));let r=o;for(let i=s;i<e;i++)a.charCodeAt(i)==9?r+=t-r%t:r++;return r}class Gu{constructor(e,t,s,o){this.string=e,this.tabSize=t,this.indentUnit=s,this.overrideIndent=o,this.pos=0,this.start=0,this.lastColumnPos=0,this.lastColumnValue=0}eol(){return this.pos>=this.string.length}sol(){return this.pos==0}peek(){return this.string.charAt(this.pos)||void 0}next(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)}eat(e){let t=this.string.charAt(this.pos),s;if(typeof e=="string"?s=t==e:s=t&&(e instanceof RegExp?e.test(t):e(t)),s)return++this.pos,t}eatWhile(e){let t=this.pos;for(;this.eat(e););return this.pos>t}eatSpace(){let e=this.pos;for(;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e}skipToEnd(){this.pos=this.string.length}skipTo(e){let t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0}backUp(e){this.pos-=e}column(){return this.lastColumnPos<this.start&&(this.lastColumnValue=Wl(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue}indentation(){var e;return(e=this.overrideIndent)!==null&&e!==void 0?e:Wl(this.string,null,this.tabSize)}match(e,t,s){if(typeof e=="string"){let o=i=>s?i.toLowerCase():i,r=this.string.substr(this.pos,e.length);return o(r)==o(e)?(t!==!1&&(this.pos+=e.length),!0):null}else{let o=this.string.slice(this.pos).match(e);return o&&o.index>0?null:(o&&t!==!1&&(this.pos+=o[0].length),o)}}current(){return this.string.slice(this.start,this.pos)}}function f0(a){return{name:a.name||"",token:a.token,blankLine:a.blankLine||(()=>{}),startState:a.startState||(()=>!0),copyState:a.copyState||m0,indent:a.indent||(()=>null),languageData:a.languageData||{},tokenTable:a.tokenTable||tc,mergeTokens:a.mergeTokens!==!1}}function m0(a){if(typeof a!="object")return a;let e={};for(let t in a){let s=a[t];e[t]=s instanceof Array?s.slice():s}return e}const Hl=new WeakMap;class Qn extends gt{constructor(e){let t=Ou(e.languageData),s=f0(e),o,r=new class extends np{createParse(i,n,c
vendor: 5,491 bytes, lines 46-48
46){return new x0(o,i,n,c)}};super(t,r,[],e.name),this.topNode=j0(t,this),o=this,this.streamParser=s,this.stateAfter=new ye({perNode:!0}),this.tokenTable=e.tokenTable?new Zu(s.tokenTable):v0}static define(e){return new Qn(e)}getIndent(e){let t,{overrideIndentation:s}=e.options;s&&(t=Hl.get(e.state),t!=null&&t<e.pos-1e4&&(t=void 0));let o=ec(this,e.node.tree,e.node.from,e.node.from,t??e.pos),r,i;if(o?(i=o.state,r=o.pos+1):(i=this.streamParser.startState(e.unit),r=e.node.from),e.pos-r>1e4)return null;for(;r<e.pos;){let c=e.state.doc.lineAt(r),l=Math.min(e.pos,c.to);if(c.length){let d=s?s(c.from):-1,p=new Gu(c.text,e.state.tabSize,e.unit,d<0?void 0:d);for(;p.pos<l-c.from;)Xu(this.streamParser.token,p,i)}else this.streamParser.blankLine(i,e.unit);if(l==e.pos)break;r=c.to+1}let n=e.lineAt(e.pos);return s&&t==null&&Hl.set(e.state,n.from),this.streamParser.indent(i,/^\s*(.*)/.exec(n.text)[1],e)}get allowsNesting(){return!1}}function ec(a,e,t,s,o){let r=t>=s&&t+e.length<=o&&e.prop(a.stateAfter);if(r)return{state:a.streamParser.copyState(r),pos:t+e.length};for(let i=e.children.length-1;i>=0;i--){let n=e.children[i],c=t+e.positions[i],l=n instanceof Le&&c<o&&ec(a,n,c,s,o);if(l)return l}return null}function Yu(a,e,t,s,o){if(o&&t<=0&&s>=e.length)return e;!o&&t==0&&e.type==a.topNode&&(o=!0);for(let r=e.children.length-1;r>=0;r--){let i=e.positions[r],n=e.children[r],c;if(i<s&&n instanceof Le){if(!(c=Yu(a,n,t-i,s-i,o)))break;return o?new Le(e.type,e.children.slice(0,r).concat(c),e.positions.slice(0,r+1),i+c.length):c}}return null}function g0(a,e,t,s,o){for(let r of e){let i=r.from+(r.openStart?25:0),n=r.to-(r.openEnd?25:0),c=i<=t&&n>t&&ec(a,r.tree,0-r.offset,t,n),l;if(c&&c.pos<=s&&(l=Yu(a,r.tree,t+r.offset,c.pos+r.offset,!1)))return{state:c.state,tree:l}}return{state:a.streamParser.startState(o?Oa(o):4),tree:Le.empty}}class x0{constructor(e,t,s,o){this.lang=e,this.input=t,this.fragments=s,this.ranges=o,this.stoppedAt=null,this.chunks=[],this.chunkPos=[],this.chunk=[],this.chunkReused=void 0,this.rangeIndex=0,this.to=o[o.length-1].to;let r=es.get(),i=o[0].from,{state:n,tree:c}=g0(e,s,i,this.to,r?.state);this.state=n,this.parsedPos=this.chunkStart=i+c.length;for(let l=0;l<c.children.length;l++)this.chunks.push(c.children[l]),this.chunkPos.push(c.positions[l]);r&&this.parsedPos<r.viewport.from-1e5&&o.some(l=>l.from<=r.viewport.from&&l.to>=r.viewport.from)&&(this.state=this.lang.streamParser.startState(Oa(r.state)),r.skipUntilInView(this.parsedPos,r.viewport.from),this.parsedPos=r.viewport.from),this.moveRangeIndex()}advance(){let e=es.get(),t=this.stoppedAt==null?this.to:Math.min(this.to,this.stoppedAt),s=Math.min(t,this.chunkStart+2048);for(e&&(s=Math.min(s,e.viewport.to));this.parsedPos<s;)this.parseLine(e);return this.chunkStart<this.parsedPos&&this.finishChunk(),this.parsedPos>=t?this.finish():e&&this.parsedPos>=e.viewport.to?(e.skipUntilInView(this.parsedPos,t),this.finish()):null}stopAt(e){this.stoppedAt=e}lineAfter(e){let t=this.input.chunk(e);if(this.input.lineChunks)t==` 47`&&(t="");else{let s=t.indexOf(` 48`);s>-1&&(t=t.slice(0,s))}return e+t.length<=this.to?t:t.slice(0,this.to-e)}nextLine(){let e=this.parsedPos,t=this.lineAfter(e),s=e+t.length;for(let o=this.rangeIndex;;){let r=this.ranges[o].to;if(r>=s||(t=t.slice(0,r-(s-t.length)),o++,o==this.ranges.length))break;let i=this.ranges[o].from,n=this.lineAfter(i);t+=n,s=i+n.length}return{line:t,end:s}}skipGapsTo(e,t,s){for(;;){let o=this.ranges[this.rangeIndex].to,r=e+t;if(s>0?o>r:o>=r)break;let i=this.ranges[++this.rangeIndex].from;t+=i-o}return t}moveRangeIndex(){for(;this.ranges[this.rangeIndex].to<this.parsedPos;)this.rangeIndex++}emitToken(e,t,s,o){let r=4;if(this.ranges.length>1){o=this.skipGapsTo(t,o,1),t+=o;let n=this.chunk.length;o=this.skipGapsTo(s,o,-1),s+=o,r+=this.chunk.length-n}let i=this.chunk.length-4;return this.lang.streamParser.mergeTokens&&r==4&&i>=0&&this.chunk[i]==e&&this.chunk[i+2]==t?this.chunk[i+2]=s:this.chunk.push(e,t,s,r),o}parseLine(e){let{line:t,end:s}=this.nextLine(),o=0,{streamParser:r}=this.lang,i=new Gu(t,e?e.state.tabSize:4,e?Oa(e.state):2);if(i.eol())r.blankLine(this.state,i.indentUnit);else for(;!i.eol();){let n=Xu(r.token,i,this.state);if(n&&(o=this.emitToken(this.lang.tokenTable.resolve(n),this.parsedPos+i.start,this.parsedPos+i.pos,o)),i.start>1e4)break}this.parsedPos=s,this.moveRangeIndex(),this.parsedPos<this.to&&this.parsedPos++}finishChunk(){let e=Le.build({buffer:this.chunk,start:this.chunkStart,length:this.parsedPos-this.chunkStart,nodeSet:b0,topID:0,maxBufferLength:2048,reused:this.chunkReused});e=new Le(e.type,e.children,e.positions,e.length,[[this.lang.stateAfter,this.lang.streamParser.copyState(this.state)]]),this.chunks.push(e),this.chunkPos.push(this.chunkStart-this.ranges[0].from),this.chunk=[],this.chunkReused=void 0,this.chunkStart=this.parsedPos}finish(){return new Le(this.lang.topNode,this.chunks,this.chunkPos,this.parsedPos-this.ranges[0].from).balance()}}function Xu(a,e,t){e.start=e.pos;for(let s=0;s<10;s++){let o=a(e,t);if(e.pos>e.start)return o}throw new Error("Stream parser failed to advance stream.")}const tc=Object.create(null),Qs=[ct.none],b0=new Dn(Qs),$l=[],Ul=Object.create(null),Ju=Object.create(null);for(let[a,e]of[["variable","variableName"],["variable-2","variableName.special"],["string-2","string.special"],["def","variableName.definition"],["tag","tagName"],["attribute","attributeName"],["type","typeName"],["builtin","variableName.standard"],["qualifier","modifier"],["error","invali
48d"],["header","heading"],["property","propertyName"]])Ju[a]=Qu(tc,e);class Zu{constructor(e){this.extra=e,this.table=Object.assign(Object.create(null),Ju)}resolve(e){return e?this.table[e]||(this.table[e]=Qu(this.extra,e)):0}}const v0=new Zu(tc);function mi(a,e){$l.indexOf(a)>-1||($l.push(a),console.warn(e))}function Qu(a,e){let t=[];for(let n of e.split(" ")){let c=[];for(let l of n.split(".")){let d=a[l]||w[l];d?typeof d=="function"?c.length?c=c.map(d):mi(l,`Modifier ${l} used at start of tag`):c.length?mi(l,`Tag ${l} used as modifier`):c=Array.isArray(d)?d:[d]:mi(l,`Unknown highlighting tag ${l}`)}for(let l of c)t.push(l)}if(!t.length)return 0;let s=e.replace(/ /g,"_"),o=s+" "+t.map(n=>n.id),r=Ul[o];if(r)return r.id;let i=Ul[o]=ct.define({id:Qs.length,name:s,props:[_b({[s]:t})]});return Qs.push(i),i.id}function j0(a,e){let t=ct.define({id:Qs.length,name:"Document",props:[Aa.add(()=>a),Ru.add(()=>s=>e.getIndent(s))],top:!0});return Qs.push(t),t}Re.RTL,Re.LTR;function te(a){return new Lb(Qn.define(a))}function ea(a){return G(()=>import("./index-C_rhOuGG.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74])).then(e=>e.sql({dialect:e[a]}))}const tr=[q.of({name:"C",extensions:["c","h","ino"],load(){return G(()=>import("./index-BpeFm0S3.js"),__vite__mapDeps([75,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74])).then(a=>a.cpp())}}),q.of({name:"C++",alias:["cpp"],extensions:["cpp","c++","cc","cxx","hpp","h++","hh","hxx"],load(){return G(()=>import("./index-BpeFm0S3.js"),__vite__mapDeps([75,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74])).then(a=>a.cpp())}}),q.of({name:"CQL",alias:["cassandra"],extensions:["cql"],load(){return ea("Cassandra")}}),q.of({name:"CSS",extensions:["css"],load(){return G(()=>import("./index-CaeAxJdO.js"),__vite__mapDeps([76,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74])).then(a=>a.css())}}),q.of({name:"Go",extensions:["go"],load(){return G(()=>import("./index-4RqkrFEn.js"),__vite__mapDeps([77,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74])).then(a=>a.go())}}),q.of({name:"HTML",alias:["xhtml"],extensions:["html","htm","handlebars","hbs"],load(){return G(()=>import("./index-lff58jhG.js"),__vite__mapDeps([78,1,76,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,79])).then(a=>a.html())}}),q.of({name:"Java",extensions:["java"],load(){return G(()=>import("./index-DiPymrBD.js"),__vite__mapDeps([80,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74])).then(a=>a.java())}}),q.of({name:"JavaScript",alias:["ecmascript","js","node"],extensions:["js","mjs","cjs"],load(){return G(()=>import("./index-DnedrNM9.js"),__vite__mapDeps([79,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74])).then(a=>a.javascript())}}),q.of({name:"JSON",alias:["json5"],extensions:["json","map"],load(){return G(()=>import("./index-BXGPTFyy.js"),__vite__mapDeps([81,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74])).then(a=>a.json())}}),q.of({name:"JSX",extensions:["jsx"],load(){return G(()=>import("./index-DnedrNM9.js"),__vite__mapDeps([79,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74])).then(a=>
48a.javascript({jsx:!0}))}}),q.of({name:"LESS",extensions:["less"],load(){return G(()=>import("./index-DyX-1A8x.js"),__vite__mapDeps([82,76,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74])).then(a=>a.less())}}),q.of({name:"Liquid",extensions:["liquid"],load(){return G(()=>import("./index-D5lPchXl.js"),__vite__mapDeps([83,78,1,76,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,79])).then(a=>a.liquid())}}),q.of({name:"MariaDB SQL",load(){return ea("MariaSQL")}}),q.of({name:"Markdown",extensions:["md","markdown","mkd"],load(){return G(()=>import("./index-DkOIOMPD.js"),__vite__mapDeps([84,78,1,76,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,79])).then(a=>a.markdown())}}),q.of({name:"MS SQL",load(){return ea("MSSQL")}}),q.of({name:"MySQL",load(){return ea("MySQL")}}),q.of({name:"PHP",extensions:["php","php3","php4","php5","php7","phtml"],load(){return G(()=>import("./index-CFNNpu0b.js"),__vite__mapDeps([85,1,78,76,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,79])).then(a=>a.php())}}),q.of({name:"PLSQL",extensions:["pls"],load(){return ea("PLSQL")}}),q.of({name:"PostgreSQL",load(){return ea("PostgreSQL")}}),q.of({name:"Python",extensions:["BUILD","bzl","py","pyw"],filename:/^(BUCK|BUILD)$/,load(){return G(()=>import("./index-BNaFSLSj.js"),__vite__mapDeps([86,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74])).then(a=>a.python())}}),q.of({name:"Rust",extensions:["rs"],load(){return G(()=>import("./index-Bx4e_ssU.js"),__vite__mapDeps([87,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74])).then(a=>a.rust())}}),q.of({name:"Sass",extensions:["sass"],load(){return G(()=>import("./index-CWpiksRe.js"),__vite__mapDeps([88,1,76,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74])).then(a=>a.sass({indented:!0}))}}),q.of({name:"SCSS",extensions:["scss"],load(){return G(()=>import("./index-CWpiksRe.js"),__vite__mapDeps([88,1,76,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74])).then(a=>a.sass())}}),q.of({name:"SQL",extensions:["sql"],load(){return ea("StandardSQL")}}),q.of({name:"SQLite",load(){return ea("SQLite")}}),q.of({name:"TSX",extensions:["tsx"],load(){return G(()=>import("./index-DnedrNM9.js"),__vite__mapDeps([79,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74])).then(a=>a.javascript({jsx:!0,typescript:!0}))}}),q.of({name:"TypeScript",alias:["ts"],extensions:["ts","mts","cts"],load(){return G(()=>import("./index-DnedrNM9.js"),__vite__mapDeps([79,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74])).then(a=>a.javascript({typescript:!0}))}}
48),q.of({name:"WebAssembly",extensions:["wat","wast"],load(){return G(()=>import("./index-V8tQUMg7.js"),__vite__mapDeps([89,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74])).then(a=>a.wast())}}),q.of({name:"XML",alias:["rss","wsdl","xsd"],extensions:["xml","xsl","xsd","svg"],load(){return G(()=>import("./index-C9839O3b.js"),__vite__mapDeps([90,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74])).then(a=>a.xml())}}),q.of({name:"YAML",alias:["yml"],extensions:["yaml","yml"],load(){return G(()=>import("./index-K_r3BB7G.js"),__vite__mapDeps([91,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74])).then(a=>a.yaml())}}),q.of({name:"APL",extensions:["dyalog","apl"],load(){return G(()=>import("./apl-BkC8CMjU.js"),[]).then(a=>te(a.apl))}}),q.of({name:"PGP",alias:["asciiarmor"],extensions:["asc","pgp","sig"],load(){return G(()=>import("./asciiarmor-DGkJRn6r.js"),[]).then(a=>te(a.asciiArmor))}}),q.of({name:"ASN.1",extensions:["asn","asn1"],load(){return G(()=>import("./asn1-BwCW_JJc.js"),[]).then(a=>te(a.asn1({})))}}),q.of({name:"Asterisk",filename:/^extensions\.conf$/i,load(){return G(()=>import("./asterisk-DY7oivEJ.js"),[]).then(a=>te(a.asterisk))}}),q.of({name:"Brainfuck",extensions:["b","bf"],load(){return G(()=>import("./brainfuck-B6QqRAT4.js"),[]).then(a=>te(a.brainfuck))}}),q.of({name:"Cobol",extensions:["cob","cpy"],load(){return G(()=>import("./cobol-BTrCQCoH.js"),[]).then(a=>te(a.cobol))}}),q.of({name:"C#",alias:["csharp","cs"],extensions:["cs"],load(){return G(()=>import("./clike-BlP1aWtb.js"),[]).then(a=>te(a.csharp))}}),q.of({name:"Clojure",extensions:["clj","cljc","cljx"],load(){return G(()=>import("./clojure-COBZX5M_.js"),[]).then(a=>te(a.clojure))}}),q.of({name:"ClojureScript",extensions:["cljs"],load(){return G(()=>import("./clojure-COBZX5M_.js"),[]).then(a=>te(a.clojure))}}),q.of({name:"Closure Stylesheets (GSS)",extensions:["gss"],load(){return G(()=>import("./css-fMGlLDC9.js"),[]).then(a=>te(a.gss))}}),q.of({name:"CMake",extensions:["cmake","cmake.in"],filename:/^CMakeLists\.txt$/,load(){return G(()=>import("./cmake-CdF7KM9z.js"),[]).then(a=>te(a.cmake))}}),q.of({name:"CoffeeScript",alias:["coffee","coffee-script"],extensions:["coffee"],load(){return G(()=>import("./coffeescript-wVHf63pv.js"),[]).then(a=>te(a.coffeeScript))}}),q.of({name:"Common Lisp",alias:["lisp"],extensions:["cl","lisp","el"],load(){return G(()=>import("./commonlisp-D9_EdBuK.js"),[]).then(a=>te(a.commonLisp))}}),q.of({name:"Cypher",extensions:["cyp","cypher"],load(){return G(()=>import("./cypher-CHADbhRA.js"),[]).then(a=>te(a.cypher))}}),q.of({name:"Cython",extensions:["pyx","pxd","pxi"],load(){return G(()=>import("./python-Cy_Z4UzQ.js"),[]).then(a=>te(a.cython))}}),q.of({name:"Crystal",extensions:["cr"],load(){return G(()=>import("./crystal-CzoJHsDk.js"),[]).then(a=>te(a.crystal))}}),q.of({name:"D",extensions:["d"],load(){return G(()=>import("./d-smmcaek8.js"),[]).then(a=>te(a.d))}}),q.of({name:"Dart",extensions:["dart"],load(){return G(()=>import("./clike-BlP1aWtb.js"),[]).then(a=>te(a.dart))}}),q.of({name:"diff",extensions:["diff","patch"],load(){return G(()=>import("./diff-DVU6hKen.js"),[]).then(a=>te(a.diff))}}),q.of({name:"Dockerfile",filename:/^Dockerfile$/,load(){return G(()=>import("./dockerfile-BAyhnR2b.js"),__vite__mapDeps([92,93])).then(a=>te(a.dockerFile))}}),q.of({name:"DTD",extensions:["dtd"],load(){return G(()=>import("./dtd-COiAq6uA.js"),[]).then(a=>te(a.dtd))}}),q.of({name:"Dylan",extensions:["dylan","dyl","intr"],load(){return G(()=>import("./dylan-W4yGXsR4.js"),[]).then(a=>te(a.dylan))}}),q.of({name:"EBNF",load(){return G(()=>import("./ebnf-DdKQscKW.js"),[]).then(a=>te(a.ebnf))}}),q.of({name:"ECL",extensions:["ecl"],load(){return G(()=>import("./ecl-CEgDSL20.js"),[]).then(a=>te(a.ecl))}}),q.of({name:"edn",extensions:["edn"],load(){return G(()=>import("./clojure-COBZX5M_.js"),[]).then(a=>te(a.clojure))}}),q.of({name:"Eiffel",extensions:["e"],load(){return G(()=>import("./eiffel-CAwq48Yt.js"),[]).then(a=>te(a.eiffel))}}),q.of({name:"Elm",extensions:["elm"],load(){return G(()=>import("./elm-DhdSJfpE.js"),[]).then(a=>te(a.elm))}}),q.of({name:"Erlang",extensions:["erl"],load(){return G(()=>import("./erlang-CwFfjEAa.js"),[]).then(a=>te(a.erlang))}}),q.of({name:"Esper",load(){return G(()=>import("./sql-DBi7nDYQ.js"),[]).then(a=>te(a.esper))}}),q.of({name:"Factor",extensions:["factor"],load(){return G(()=>import("./factor-g9Vujknx.js"),__vite__mapDeps([94,93])).then(a=>te(a.factor))}}),q.of({name:"FCL",load(){return G(()=>import("./fcl-DBwrG-dC.js"),[]).then(a=>te(a.fcl))}}),q.of({name:"Forth",extensions:["forth","fth","4th"],load(){return G(()=>import("./forth-C0RVNalf.js"),[]).then(a=>te(a.forth))}}),q.of({name:"Fortran",extensions:["f","for","f77","f90","f95"],load(){return G(()=>import("./fortran-DoRy66n7.js"),[]).then(a=>te(a.fortran))}}),q.of({name:"F#",alias:["fsharp"],extensions:["fs"],load(){return G(()=>import("./mllike-D9SLi1GQ.js"),[]).then(a=>te(a.fSharp))}}),q.of({name:"Gas",extensions:["s"],load(){return G(()=>import("./gas-DmjEjZLT.js"),[]).then(a=>te(a.gas))}}),q.of({name:"Gherkin",extensions:["feature"],load(){return G(()=>import("./gherkin-Dt12pB9I.js"),[]).then(a=>te(a.gherkin))}}),q.of({name:"Groovy",extensions:["groovy","gradle"],filename:/^Jenkinsfile$/,load(){return G(()=>import("./groovy-Bxbp-Qew.js"),[]).then(a=>te(a.groovy))}}),q.of({name:"Haskell",extensions:["hs"],load(){return G(()=>
48import("./haskell-Czm984vt.js"),[]).then(a=>te(a.haskell))}}),q.of({name:"Haxe",extensions:["hx"],load(){return G(()=>import("./haxe-ChgP9wVC.js"),[]).then(a=>te(a.haxe))}}),q.of({name:"HXML",extensions:["hxml"],load(){return G(()=>import("./haxe-ChgP9wVC.js"),[]).then(a=>te(a.hxml))}}),q.of({name:"HTTP",load(){return G(()=>import("./http-D1UtyRKj.js"),[]).then(a=>te(a.http))}}),q.of({name:"IDL",extensions:["pro"],load(){return G(()=>import("./idl-1n4pEydN.js"),[]).then(a=>te(a.idl))}}),q.of({name:"JSON-LD",alias:["jsonld"],extensions:["jsonld"],load(){return G(()=>import("./javascript-CVsRgwMr.js"),[]).then(a=>te(a.jsonld))}}),q.of({name:"Jinja2",extensions:["j2","jinja","jinja2"],load(){return G(()=>import("./jinja2-ClchB5RN.js"),[]).then(a=>te(a.jinja2))}}),q.of({name:"Julia",extensions:["jl"],load(){return G(()=>import("./julia-DByiuqaK.js"),[]).then(a=>te(a.julia))}}),q.of({name:"Kotlin",extensions:["kt","kts"],load(){return G(()=>import("./clike-BlP1aWtb.js"),[]).then(a=>te(a.kotlin))}}),q.of({name:"LiveScript",alias:["ls"],extensions:["ls"],load(){return G(()=>import("./livescript-Cuhx00Tt.js"),[]).then(a=>te(a.liveScript))}}),q.of({name:"Lua",extensions:["lua"],load(){return G(()=>import("./lua-B6lvxV09.js"),[]).then(a=>te(a.lua))}}),q.of({name:"mIRC",extensions:["mrc"],load(){return G(()=>import("./mirc-BmaRSkiu.js"),[]).then(a=>te(a.mirc))}}),q.of({name:"Mathematica",extensions:["m","nb","wl","wls"],load(){return G(()=>import("./mathematica-DKWfNtUi.js"),[]).then(a=>te(a.mathematica))}}),q.of({name:"Modelica",extensions:["mo"],load(){return G(()=>import("./modelica-CXD0ICb7.js"),[]).then(a=>te(a.modelica))}}),q.of({name:"MUMPS",extensions:["mps"],load(){return G(()=>import("./mumps-D9f6HLRP.js"),[]).then(a=>te(a.mumps))}}),q.of({name:"Mbox",extensions:["mbox"],load(){return G(()=>import("./mbox-Z-ZldVl1.js"),[]).then(a=>te(a.mbox))}}),q.of({name:"Nginx",filename:/nginx.*\.conf$/i,load(){return G(()=>import("./nginx-jrDS4B4m.js"),[]).then(a=>te(a.nginx))}}),q.of({name:"NSIS",extensions:["nsh","nsi"],load(){return G(()=>import("./nsis-BggecUF0.js"),__vite__mapDeps([95,93])).then(a=>te(a.nsis))}}),q.of({name:"NTriples",extensions:["nt","nq"],load(){return G(()=>import("./ntriples-BKKDi-AT.js"),[]).then(a=>te(a.ntriples))}}),q.of({name:"Objective-C",alias:["objective-c","objc"],extensions:["m"],load(){return G(()=>import("./clike-BlP1aWtb.js"),[]).then(a=>te(a.objectiveC))}}),q.of({name:"Objective-C++",alias:["objective-c++","objc++"],extensions:["mm"],load(){return G(()=>import("./clike-BlP1aWtb.js"),[]).then(a=>te(a.objectiveCpp))}}),q.of({name:"OCaml",extensions:["ml","mli","mll","mly"],load(){return G(()=>import("./mllike-D9SLi1GQ.js"),[]).then(a=>te(a.oCaml))}}),q.of({name:"Octave",extensions:["m"],load(){return G(()=>import("./octave-Bp8a8MR3.js"),[]).then(a=>te(a.octave))}}),q.of({name:"Oz",extensions:["oz"],load(){return G(()=>import("./oz-nK0PJ3Ao.js"),[]).then(a=>te(a.oz))}}),q.of({name:"Pascal",extensions:["p","pas"],load(){return G(()=>import("./pascal-R0qby9d0.js"),[]).then(a=>te(a.pascal))}}),q.of({name:"Perl",extensions:["pl","pm"],load(){return G(()=>import("./perl-CRY_QZql.js"),[]).then(a=>te(a.perl))}}),q.of({name:"Pig",extensions:["pig"],load(){return G(()=>import("./pig-wpt6Frer.js"),[]).then(a=>te(a.pig))}}),q.of({name:"PowerShell",extensions:["ps1","psd1","psm1"],load(){return G(()=>import("./powershell-BepS8kSM.js"),[]).then(a=>te(a.powerShell))}}),q.of({name:"Properties files",alias:["ini","properties"],extensions:["properties","ini","in"],load(){return G(()=>import("./properties-bw9dvwyk.js"),[]).then(a=>te(a.properties))}}),q.of({name:"ProtoBuf",extensions:["proto"],load(){return G(()=>import("./protobuf-BiS4Ko2n.js"),[]).then(a=>te(a.protobuf))}}),q.of({name:"Pug",alias:["jade"],extensions:["pug","jade"],load(){return G(()=>import("./pug-JOYBqibs.js"),__vite__mapDeps([96,97])).then(a=>te(a.pug))}}),q.of({name:"Puppet",extensions:["pp"],load(){return G(()=>import("./puppet-DInP2JgV.js"),[]).then(a=>te(a.puppet))}}),q.of({name:"Q",extensions:["q"],load(){return G(()=>import("./q-BYqJa5nD.js"),[]).then(a=>te(a.q))}}),q.of({name:"R",alias:["rscript"],extensions:["r","R"],load(){return G(()=>import("./r-YEUrdl0W.js"),[]).then(a=>te(a.r))}}),q.of({name:"RPM Changes",load(){return G(()=>import("./rpm-CxVerZ2q.js"),[]).then(a=>te(a.rpmChanges))}}),q.of({name:"RPM Spec",extensions:["spec"],load(){return G(()=>import("./rpm-CxVerZ2q.js"),[]).then(a=>te(a.rpmSpec))}}),q.of({name:"Ruby",alias:["jruby","macruby","rake","rb","rbx"],extensions:["rb"],filename:/^(Gemfile|Rakefile)$/,load(){return G(()=>import("./ruby-C6PC7qc9.js"),[]).then(a=>te(a.ruby))}}),q.of({name:"SAS",extensions:["sas"],load(){return G(()=>import("./sas-DQcU2Quo.js"),[]).then(a=>te(a.sas))}}),q.of({name:"Scala",extensions:["scala"],load(){return G(()=>import("./clike-BlP1aWtb.js"),[]).then(a=>te(a.scala))}}),q.of({name:"Scheme",extensions:["scm","ss"],load(){return G(()=>import("./scheme-C7NMcIO_.js"),[]).then(a=>te(a.scheme))}}
48),q.of({name:"Shell",alias:["bash","sh","zsh"],extensions:["sh","ksh","bash"],filename:/^PKGBUILD$/,load(){return G(()=>import("./shell-BrvLtP43.js"),[]).then(a=>te(a.shell))}}),q.of({name:"Sieve",extensions:["siv","sieve"],load(){return G(()=>import("./sieve-CF9hF5RM.js"),[]).then(a=>te(a.sieve))}}),q.of({name:"Smalltalk",extensions:["st"],load(){return G(()=>import("./smalltalk-D8HPWpb2.js"),[]).then(a=>te(a.smalltalk))}}),q.of({name:"Solr",load(){return G(()=>import("./solr-P-2GmpZt.js"),[]).then(a=>te(a.solr))}}),q.of({name:"SML",extensions:["sml","sig","fun","smackspec"],load(){return G(()=>import("./mllike-D9SLi1GQ.js"),[]).then(a=>te(a.sml))}}),q.of({name:"SPARQL",alias:["sparul"],extensions:["rq","sparql"],load(){return G(()=>import("./sparql-CYaHY_Ex.js"),[]).then(a=>te(a.sparql))}}),q.of({name:"Spreadsheet",alias:["excel","formula"],load(){return G(()=>import("./spreadsheet-B10LWt2I.js"),[]).then(a=>te(a.spreadsheet))}}),q.of({name:"Squirrel",extensions:["nut"],load(){return G(()=>import("./clike-BlP1aWtb.js"),[]).then(a=>te(a.squirrel))}}),q.of({name:"Stylus",extensions:["styl"],load(){return G(()=>import("./stylus-UqUjADXX.js"),[]).then(a=>te(a.stylus))}}),q.of({name:"Swift",extensions:["swift"],load(){return G(()=>import("./swift-BJxstuSd.js"),[]).then(a=>te(a.swift))}}),q.of({name:"sTeX",load(){return G(()=>import("./stex-CxAHwppT.js"),[]).then(a=>te(a.stex))}}),q.of({name:"LaTeX",alias:["tex"],extensions:["text","ltx","tex"],load(){return G(()=>import("./stex-CxAHwppT.js"),[]).then(a=>te(a.stex))}}),q.of({name:"SystemVerilog",extensions:["v","sv","svh"],load(){return G(()=>import("./verilog-tQz3ZH27.js"),[]).then(a=>te(a.verilog))}}),q.of({name:"Tcl",extensions:["tcl"],load(){return G(()=>import("./tcl-vlfkyWNM.js"),[]).then(a=>te(a.tcl))}}),q.of({name:"Textile",extensions:["textile"],load(){return G(()=>import("./textile-B-tEeNjh.js"),[]).then(a=>te(a.textile))}}),q.of({name:"TiddlyWiki",load(){return G(()=>import("./tiddlywiki-B5eIMHpy.js"),[]).then(a=>te(a.tiddlyWiki))}}),q.of({name:"Tiki wiki",load(){return G(()=>import("./tiki-CTXp2t3n.js"),[]).then(a=>te(a.tiki))}}),q.of({name:"TOML",extensions:["toml"],load(){return G(()=>import("./toml-CYnUuIjF.js"),[]).then(a=>te(a.toml))}}),q.of({name:"Troff",extensions:["1","2","3","4","5","6","7","8","9"],load(){return G(()=>import("./troff-m9COAcsQ.js"),[]).then(a=>te(a.troff))}}),q.of({name:"TTCN",extensions:["ttcn","ttcn3","ttcnpp"],load(){return G(()=>import("./ttcn-D4tvZUgj.js"),[]).then(a=>te(a.ttcn))}}),q.of({name:"TTCN_CFG",extensions:["cfg"],load(){return G(()=>import("./ttcn-cfg-B4Jkaskc.js"),[]).then(a=>te(a.ttcnCfg))}}),q.of({name:"Turtle",extensions:["ttl"],load(){return G(()=>import("./turtle-rhChZT_z.js"),[]).then(a=>te(a.turtle))}}),q.of({name:"Web IDL",extensions:["webidl"],load(){return G(()=>import("./webidl-i3cwtPrD.js"),[]).then(a=>te(a.webIDL))}}),q.of({name:"VB.NET",extensions:["vb"],load(){return G(()=>import("./vb-C_lxb7Cy.js"),[]).then(a=>te(a.vb))}}),q.of({name:"VBScript",extensions:["vbs"],load(){return G(()=>import("./vbscript-CMp-shBq.js"),[]).then(a=>te(a.vbScript))}}),q.of({name:"Velocity",extensions:["vtl"],load(){return G(()=>import("./velocity-CP81_C-F.js"),[]).then(a=>te(a.velocity))}}),q.of({name:"Verilog",extensions:["v"],load(){return G(()=>import("./verilog-tQz3ZH27.js"),[]).then(a=>te(a.verilog))}}),q.of({name:"VHDL",extensions:["vhd","vhdl"],load(){return G(()=>import("./vhdl-CD3NdPd_.js"),[]).then(a=>te(a.vhdl))}}),q.of({name:"XQuery",extensions:["xy","xquery"],load(){return G(()=>import("./xquery-B-TLYhIf.js"),[]).then(a=>te(a.xQuery))}}),q.of({name:"Yacas",extensions:["ys"],load(){return G(()=>import("./yacas-B8TKCZ4j.js"),[]).then(a=>te(a.yacas))}}),q.of({name:"Z80",extensions:["z80"],load(){return G(()=>import("./z80-D05QefSz.js"),[]).then(a=>te(a.z80))}}),q.of({name:"MscGen",extensions:["mscgen","mscin","msc"],load(){return G(()=>import("./mscgen-DHwcLAyr.js"),[]).then(a=>te(a.mscgen))}}),q.of({name:"Xù",extensions:["xu"],load(){return G(()=>import("./mscgen-DHwcLAyr.js"),[]).then(a=>te(a.xu))}}),q.of({name:"MsGenny",extensions:["msgenny"],load(){return G(()=>import("./mscgen-DHwcLAyr.js"),[]).then(a=>te(a.msgenny))}}),q.of({name:"Vue",extensions:["vue"],load(){return G(()=>import("./index-BCuauU0J.js"),__vite__mapDeps([98,78,1,76,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,79])).then(a=>a.vue())}}),q.of({name:"Angular Template",load(){return G(()=>import("./index-CpJCIf-M.js"),__vite__mapDeps([99,78,1,76,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,79])).then(a=>a.angular())}})],w0="#e5c07b",ql="#e06c75",y0="#56b6c2",k0="#ffffff",ar="#abb2bf",gn="#7d8799",C0="#61afef",S0="#98c379",Kl="#d19a66",_0="#c678dd",P0="#21252b",Gl="#2c313a",Yl="#282c34",gi="#353a42",A0="#3E4451",Xl="#528bff",M0=pe.theme({"&":{color:ar,backgroundColor:Yl},".cm-content":{caretColor:Xl},".cm-cursor, .cm-dropCursor":{borderLeftColor:Xl},"&.cm-focused > .cm-scroller >
48 .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:A0},".cm-panels":{backgroundColor:P0,color:ar},".cm-panels.cm-panels-top":{borderBottom:"2px solid black"},".cm-panels.cm-panels-bottom":{borderTop:"2px solid black"},".cm-searchMatch":{backgroundColor:"#72a1ff59",outline:"1px solid #457dff"},".cm-searchMatch.cm-searchMatch-selected":{backgroundColor:"#6199ff2f"},".cm-activeLine":{backgroundColor:"#6699ff0b"},".cm-selectionMatch":{backgroundColor:"#aafe661a"},"&.cm-focused .cm-matchingBracket, &.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bad0f847"},".cm-gutters":{backgroundColor:Yl,color:gn,border:"none"},".cm-activeLineGutter":{backgroundColor:Gl},".cm-foldPlaceholder":{backgroundColor:"transparent",border:"none",color:"#ddd"},".cm-tooltip":{border:"none",backgroundColor:gi},".cm-tooltip .cm-tooltip-arrow:before":{borderTopColor:"transparent",borderBottomColor:"transparent"},".cm-tooltip .cm-tooltip-arrow:after":{borderTopColor:gi,borderBottomColor:gi},".cm-tooltip-autocomplete":{"& > ul > li[aria-selected]":{backgroundColor:Gl,color:ar}}},{dark:!0}),E0=cs.define([{tag:w.keyword,color:_0},{tag:[w.name,w.deleted,w.character,w.propertyName,w.macroName],color:ql},{tag:[w.function(w.variableName),w.labelName],color:C0},{tag:[w.color,w.constant(w.name),w.standard(w.name)],color:Kl},{tag:[w.definition(w.name),w.separator],color:ar},{tag:[w.typeName,w.className,w.number,w.changed,w.annotation,w.modifier,w.self,w.namespace],color:w0},{tag:[w.operator,w.operatorKeyword,w.url,w.escape,w.regexp,w.link,w.special(w.string)],color:y0},{tag:[w.meta,w.comment],color:gn},{tag:w.strong,fontWeight:"bold"},{tag:w.emphasis,fontStyle:"italic"},{tag:w.strikethrough,textDecoration:"line-through"},{tag:w.link,color:gn,textDecoration:"underline"},{tag:w.heading,fontWeight:"bold",color:ql},{tag:[w.atom,w.bool,w.special(w.variableName)],color:Kl},{tag:[w.processingInstruction,w.string,w.inserted],color:S0},{tag:w.invalid,color:k0}]),D0=[M0,Zn(E0)];let Br=0;const js=new Map,T0=cs.define([{tag:w.keyword,color:"#0550AE"},{tag:w.comment,color:"#6a737d",fontStyle:"italic"},{tag:w.name,color:"#24292e"},{tag:w.propertyName,color:"#0550AE"},{tag:w.variableName,color:"#953800"},{tag:w.typeName,color:"#D73A49"},{tag:w.function(w.variableName),color:"#6f42c1"},{tag:w.number,color:"#005CC5"},{tag:w.bool,color:"#005CC5"},{tag:w.string,color:"#24292e"},{tag:w.className,color:"#22863a"},{tag:w.heading,color:"#24292e",fontWeight:"bold"},{tag:w.operator,color:"#005CC5"},{tag:w.angleBracket,color:"#24292e"},{tag:w.tagName,color:"#22863a"},{tag:w.attributeName,color:"#6f42c1"},{tag:w.attributeValue,color:"#032f62"},{tag:w.bracket,color:"#24292e"},{tag:w.punctuation,color:"#24292e"},{tag:w.regexp,color:"#032f62"}]),N0=[Zn(T0),pe.theme({"&":{backgroundColor:"#f6f8fa !important",color:"#24292e !important"},".cm-content":{caretColor:"#24292e",fontFamily:"Menlo, Monaco, Consolas, monospace"},".cm-line":{color:"#24292e !important"},".cm-gutters":{backgroundColor:"#f6f8fa",color:"#6e7781",borderRight:"1px solid #e0e0e0"},".cm-gutterElement":{color:"#57606a"}})],Qt=new Sn({html:!0,linkify:!1,typographer:!0,breaks:!0,highlight:(a,e)=>{const t=`code-block-${Br++}`;return`<div class="code-block-wrapper"> 49 <div class="code-block-header">${e||"plaintext"}</div> 50 <div id="${t}" class="code-block" 51 data-language="${e||"plaintext"}" 52 data-content="${encodeURIComponent(a)}"></div> 53 </div>`}}),ja=new Sn({html:!1,linkify:!1,typographer:!0,breaks:!0,highlight:(a,e)=>{const t=`code-block-${Br++}`;return`<div class="code-block-wrapper"> 54 <div class="code-block-header">${e||"plaintext"}</div> 55 <div id="${t}" class="code-block" 56 data-language="${e||"plaintext"}" 57 data-content="${encodeURIComponent(a)}"></div> 58 </div>`}}),L0=(a,e)=>{if(!e)return a;const t=ac(e);let s=a.replace(/@((?:[\w.-]+\/)*[\w.-]+\.(?:js|py|java|html|css|md|json|ts|tsx|jsx|c|cpp|php|rb|go|rs|swift|kt|scala|sh|bash|txt|yaml|yml|xml|sql|vue|svelte|astro|scss|less|sass))(?=\s|$|[.,;:)\]}'"])/g,(o,r)=>t.includes(r)||t.some(n=>n===r||n.endsWith(`/${r}`))?`<span class="file-mention" data-file="${t.find(c=>c===r||c.endsWith(`/${r}`))||r}">@${r}</span>`:o);return s=s.replace(/(^|[^`>"@])((?:[\w-]+\/)+[\w-]+\.(js|py|java|html|css|md|json|ts|tsx|jsx|c|cpp|php|rb|go|rs|swift|kt|scala|sh|bash|txt))(?!`|<\/code>|")/g,(o,r,i)=>t.includes(i)?`${r}<span class="file-reference" data-file="${i}">${i}</span>`:o),s=s.replace(/(^|[^`>"/\w@-])(\b[\w-]+\.(js|py|java|html|css|md|json|ts|tsx|jsx|c|cpp|php|rb|go|rs|swift|kt|scala|sh|bash|txt))\b(?=[^`<]|$)/g,(o,r,i)=>{const n=i.replace(/[.,;:)\]}]+$/,"");if(t.includes(n)||t.some(c=>
58c.endsWith(`/${n}`))){const c=i.substring(n.length);return`${r}<span class="file-reference" data-file="${n}">${n}</span>${c}`}return o}),s},ac=(a,e="")=>{if(!a)return[];let t=[];return Object.entries(a).forEach(([s,o])=>{const r=e?`${e}/${s}`:s;o.type==="folder"?t=[...t,...ac(o.children,r)]:t.push(r)}),t},I0=(a,e,t)=>{if(!e)return a;let o=eo(a).replace(/<span class="file-reference" data-file="([^"]+)">([^<]+)<\/span>/g,(r,i,n)=>n);return o=o.replace(/<span class="file-reference" data-file="([^"]+)">([^&<]+)<\/span>/g,(r,i,n)=>n),o},O0=(a,e,t)=>e?a.replace(/<code>(.*?)<\/code>/gs,(s,o)=>{if(o.includes('class="file-reference"')||o.includes('<span class="file-reference"')){let l=eo(o);return l=l.replace(/<span class="file-reference" data-file="([^"]+)">([^<]+)<\/span>/g,(d,p,u)=>u),l=l.replace(/<span class="file-reference" data-file="([^"]+)">([^&<]+)<\/span>/g,(d,p,u)=>u),`<code>${l}</code>`}const r=ac(e),i=eo(o);if(i.trim().length<3)return s;let n=!1,c=i;return r.forEach(l=>{const d=l.split("/").pop()||"";if(d.length<3)return;const p=new RegExp(`(^|\\s)(${F0(d)})($|\\s|\\.|,|;|:|\\)|\\]|})`,"g");p.test(c)&&(n=!0,c=c.replace(p,(u,f,m,g)=>`${f}<span class="inline-file-reference" data-file="${l}">${m}</span>${g}`))}),n?`<code class="has-file-refs">${c}</code>`:s}):a,F0=a=>a.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");Qt.renderer.rules.fence=function(a,e,t,s,o){const r=a[e],i=r.info?r.info.trim():"",n=i?i.split(/\s+/g)[0]:"",c=`code-block-${Br++}`,l=eh(r.content);return`<div class="code-block-wrapper"> 59 <div class="code-block-header"> 60 <span class="code-language">${n||"plaintext"}</span> 61 <div class="code-actions"> 62 <button class="code-action-btn copy-btn" aria-label="Copy code"> 63 <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"> 64 <rect x="9" y="9" width="13" height="13" rx="2" ry="2"></rect> 65 <path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"></path> 66 </svg> 67 </button> 68<!-- <button class="code-action-btn run-btn" aria-label="Run code">--> 69<!-- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round">--> 70<!-- <polygon points="5 3 19 12 5 21 5 3"></polygon>--> 71<!-- </svg>--> 72<!-- </button>--> 73 </div> 74 </div> 75 <div id="${c}" class="code-block" 76 data-language="${n||"plaintext"}" 77 data-content="${encodeURIComponent(l)}"></div> 78 </div>`};const R0=Qt.renderer.rules.link_open||function(a,e,t,s,o){return o.renderToken(a,e,t)};Qt.renderer.rules.link_open=function(a,e,t,s,o){const r=a[e];return r.attrGet("href")&&(r.attrSet("target","_blank"),r.attrSet("rel","noopener noreferrer")),R0(a,e,t,s,o)};Qt.use(_n);Qt.use(Dr,"warning");Qt.use(Dr,"info");Qt.use($d);ja.renderer.rules.fence=Qt.renderer.rules.fence;const B0=ja.renderer.rules.link_open||function(a,e,t,s,o){return o.renderToken(a,e,t)};ja.renderer.rules.link_open=function(a,e,t,s,o){const r=a[e];return r.attrGet("href")&&(r.attrSet("target","_blank"),r.attrSet("rel","noopener noreferrer")),B0(a,e,t,s,o)};ja.use(_n);ja.use(Dr,"warning");ja.use(Dr,"info");ja.use($d);const z0={ADD_ATTR:["target","rel","data-language","data-content","data-file","data-instance-id"],ADD_TAGS:["editor-view"],KEEP_CONTENT:!0,RETURN_DOM_FRAGMENT:!1,RETURN_DOM:!1},eh=a=>{if(!a)return"";const e=a.trim();return e?e.split(` 79`).map(o=>o.trimEnd()).join(` 80`):""},eo=a=>{const e=document.createElement("textarea");e.innerHTML=a;const t=e.value;return t.includes("<")||t.includes(">")?(e.innerHTML=t,e.value):t},V0=async(a,e,t)=>{const s=e.toLowerCase()==="plaintext",o=tr.find(f=>f.name.toLowerCase()===e.toLowerCase()||f.alias&&f.alias.some(m=>m.toLowerCase()===e.toLowerCase())),r=document.documentElement.classList.contains("dark"),i=[pe.editable.of(!1),pe.lineWrapping,r?D0:N0];if(o)try{const f=await o.load();i.push(f)}catch(f){console.warn(`Failed to load language: ${e}`,f)}a.innerHTML="",a.style.maxWidth="100%",a.style.width="100%",a.style.overflow="auto",a.style.boxSizing="border-box",a.style.display="block",a.style.position="relative",a.style.zIndex="1",s&&a.classList.add("plaintext-block");const n=eo(t),c=eh(n),l=new pe({doc:c,extensions:i,parent:a}),d=a.querySelector(".cm-editor");d instanceof HTMLElement&&(d.style.maxWidth="100%",d.style.width="100%",d.style.overflow="auto",d.style.boxSizing="border-box",d.setAttribute("data-language",e),d.style.position="relative",d.style.zIndex="2",d.style.background="#1e1e1e",r?(d.classList.add("dark-theme"),d.classList.remove("light-theme")):(d.classList.add("light-theme"),d.classList.remove("dark-theme")));const p=a.querySelector(".cm-content");p instanceof HTMLElement&&(p.style.display="block",p.style.maxWidth=s?"100%":"none",p.style.width=s?"auto":"max-content",p.style.boxSizing="border-box",p.style.whiteSpace="pre",p.style.minHeight="2rem");const u=a.querySelector(".cm-scroller");return u instanceof HTMLElement&&(u.style.overflow="auto",u.style.maxWidth="100%",u.style.position="relative",u.style.zIndex="3"),l},sr=E.forwardRef(({content:a,addClass:e="",fileTree:t,onFileClick:s,onRunCode:o,disableHtml:r=!1},i)=>{const n=E.useRef(`markdown-${Math.random().toString(36).substring(2,10)}`),c=E.useMemo(()=>{Br=0;const d=t?L0(a,t):a,u=(r?ja:Qt).render(d),f=t?O0(u,t):u;return Hd.sanitize(f,z0)},[a,t,s,r]);E.useEffect(()=>{const d=setTimeout(()=>{const p=document.querySelector(`[data-instance-id="${n.current}"]`);if(!p)return;p.querySelectorAll("code").forEach(f=>{const m=f.innerHTML;if(m.includes('<span class="file-reference"')||m.includes('<span class="file-reference"')){let g=eo(m);const x=[],b=g.matchAll(/<span class="file-reference" data-file="([^"]+)">([^<]+)<\/span>/g);
80for(const k of b)x.push({file:k[1],text:k[2]});const y=g.matchAll(/<span class="file-reference" data-file="([^"]+)">([^&<]+)<\/span>/g);for(const k of y)x.push({file:k[1],text:k[2]});if(g=g.replace(/<span class="file-reference" data-file="([^"]+)">([^<]+)<\/span>/g,(k,A,S)=>S),g=g.replace(/<span class="file-reference" data-file="([^"]+)">([^&<]+)<\/span>/g,(k,A,S)=>S),g!==m&&(f.innerHTML=g,x.length>0)){f.classList.add("has-file-refs");let k=f.innerHTML;x.forEach(({file:A,text:S})=>{const N=S.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),D=new RegExp(`(^|\\s)(${N})($|\\s|\\.|,|;|:|\\)|\\]|})`,"g");k=k.replace(D,(L,M,B,V)=>`${M}<span class="inline-file-reference" data-file="${A}">${B}</span>${V}`)}),f.innerHTML=k}}})},100);return()=>clearTimeout(d)},[c]),E.useEffect(()=>{if(!s)return;const d=document.querySelector(`[data-instance-id="${n.current}"]`);if(!d)return;const p=u=>{const f=u.target;if(f.classList.contains("file-reference")||f.classList.contains("inline-file-reference")||f.classList.contains("file-mention")){const m=f.getAttribute("data-file");m&&(u.preventDefault(),u.stopPropagation(),s(m))}};return d.addEventListener("click",p),()=>{d.removeEventListener("click",p)}},[s]);const l=()=>{const d=[];js.forEach((m,g)=>{g.startsWith(n.current)&&(d.push(g),m.destroy())}),d.forEach(m=>{js.delete(m)});const p=document.querySelector(`[data-instance-id="${n.current}"]`);if(!p){He.log("Cannot find container for instance",n.current);return}const u=p.querySelectorAll(".code-block"),f=Array.from(u).map(async m=>{if(m instanceof HTMLElement){m.querySelector(".cm-editor")&&(He.log("Code block already has an editor, removing it first",m.id),m.innerHTML="");const g=m.getAttribute("data-language")||"plaintext",x=m.getAttribute("data-content")||"";try{const b=decodeURIComponent(x),y=I0(b,t,s),k=`${n.current}-${m.id}`,A=await V0(m,g,y);js.set(k,A)}catch(b){console.error("Failed to create code editor:",b)}}});Promise.all(f).catch(m=>{console.error("Error creating code editors:",m)})};return E.useEffect(()=>{setTimeout(()=>{l(),d()},0);const d=()=>{const u=document.querySelector(`[data-instance-id="${n.current}"]`);if(!u)return;u.querySelectorAll(".copy-btn").forEach(g=>{g.addEventListener("click",x=>{x.preventDefault(),x.stopPropagation();const b=g.closest(".code-block-wrapper");if(!b)return;const y=b.querySelector(".code-block");if(!y)return;const k=y.getAttribute("data-content");if(!k)return;const A=Ci(k);navigator.clipboard.writeText(A).then(()=>{const S=g;S.classList.add("copied"),setTimeout(()=>S.classList.remove("copied"),1e3)}).catch(S=>console.error("Failed to copy code:",S))})}),u.querySelectorAll(".run-btn").forEach(g=>{g.addEventListener("click",x=>{x.preventDefault(),x.stopPropagation();const b=g.closest(".code-block-wrapper");if(!b)return;const y=b.querySelector(".code-block");if(!y)return;const k=y.getAttribute("data-language")||"plaintext",A=y.getAttribute("data-content");if(!A)return;const S=Ci(A);if(o){o(k,S);const L=g;L.classList.add("running"),setTimeout(()=>L.classList.remove("running"),1e3);return}const N=new CustomEvent("runCode",{bubbles:!0,detail:{language:k,content:S}});b.dispatchEvent(N);const D=g;D.classList.add("running"),setTimeout(()=>D.classList.remove("running"),1e3)})})},p=new MutationObserver(()=>{const u=document.documentElement.classList.contains("dark");He.log("Theme change detected, dark mode:",u),setTimeout(()=>{l(),d()},20)});return p.observe(document.documentElement,{attributes:!0,attributeFilter:["class"]}),()=>{p.disconnect();const u=[];js.forEach((f,m)=>{m.startsWith(n.current)&&(u.push(m),f.destroy())}),u.forEach(f=>{js.delete(f)})}},[a]),h.jsx("div",{"data-codepal-ve-id":"src-components-shared-markdowncontent-tsx:markdowncontent:div:874:13","data-codepal-binding-id":"src-components-shared-markdowncontent-tsx:markdowncontent:div:874:13","data-codepal-module-id":"src-components-shared-markdowncontent-tsx","data-codepal-component-id":"src-components-shared-markdowncontent-tsx:markdowncontent","data-codepal-source-node-id":"src-components-shared-markdowncontent-tsx:markdowncontent:div:874:13","data-codepal-source-file":"src/components/shared/MarkdownContent.tsx","data-codepal-source-line":"874","data-codepal-source-column":"13","data-codepal-source-symbol":"MarkdownContent",ref:i,className:`markdown-content ${e}`,dangerouslySetInnerHTML:{__html:c},"data-instance-id":n.current})});sr.displayName="MarkdownContent";function _t(a){const e=Object.prototype.toString.call(a);return a instanceof Date||typeof a=="object"&&e==="[object Date]"?new a.constructor(+a):typeof a=="number"||e==="[object Number]"||typeof a=="str
80ing"||e==="[object String]"?new Date(a):new Date(NaN)}function ba(a,e){return a instanceof Date?new a.constructor(e):new Date(e)}const th=6048e5,W0=864e5;let H0={};function zr(){return H0}function to(a,e){const t=zr(),s=e?.weekStartsOn??e?.locale?.options?.weekStartsOn??t.weekStartsOn??t.locale?.options?.weekStartsOn??0,o=_t(a),r=o.getDay(),i=(r<s?7:0)+r-s;return o.setDate(o.getDate()-i),o.setHours(0,0,0,0),o}function jr(a){return to(a,{weekStartsOn:1})}function ah(a){const e=_t(a),t=e.getFullYear(),s=ba(a,0);s.setFullYear(t+1,0,4),s.setHours(0,0,0,0);const o=jr(s),r=ba(a,0);r.setFullYear(t,0,4),r.setHours(0,0,0,0);const i=jr(r);return e.getTime()>=o.getTime()?t+1:e.getTime()>=i.getTime()?t:t-1}function wr(a){const e=_t(a);return e.setHours(0,0,0,0),e}function Jl(a){const e=_t(a),t=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return t.setUTCFullYear(e.getFullYear()),+a-+t}function $0(a,e){const t=wr(a),s=wr(e),o=+t-Jl(t),r=+s-Jl(s);return Math.round((o-r)/W0)}function U0(a){const e=ah(a),t=ba(a,0);return t.setFullYear(e,0,4),t.setHours(0,0,0,0),jr(t)}function q0(a){return ba(a,Date.now())}function K0(a,e){const t=wr(a),s=wr(e);return+t==+s}function G0(a){return a instanceof Date||typeof a=="object"&&Object.prototype.toString.call(a)==="[object Date]"}function Y0(a){if(!G0(a)&&typeof a!="number")return!1;const e=_t(a);return!isNaN(Number(e))}function X0(a){const e=_t(a),t=ba(a,0);return t.setFullYear(e.getFullYear(),0,1),t.setHours(0,0,0,0),t}const J0={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},Z0=(a,e,t)=>{let s;const o=J0[a];return typeof o=="string"?s=o:e===1?s=o.one:s=o.other.replace("{{count}}",e.toString()),t?.addSuffix?t.comparison&&t.comparison>0?"in "+s:s+" ago":s};function xi(a){return(e={})=>{const t=e.width?String(e.width):a.defaultWidth;return a.formats[t]||a.formats[a.defaultWidth]}}const Q0={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},ev={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},tv={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},av={date:xi({formats:Q0,defaultWidth:"full"}),time:xi({formats:ev,defaultWidth:"full"}),dateTime:xi({formats:tv,defaultWidth:"full"})},sv={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},ov=(a,e,t,s)=>sv[a];function ws(a){return(e,t)=>{const s=t?.context?String(t.context):"standalone";let o;if(s==="formatting"&&a.formattingValues){const i=a.defaultFormattingWidth||a.defaultWidth,n=t?.width?String(t.width):i;o=a.formattingValues[n]||a.formattingValues[i]}else{const i=a.defaultWidth,n=t?.width?String(t.width):a.defaultWidth;o=a.values[n]||a.values[i]}const r=a.argumentCallback?a.argumentCallback(e):e;return o[r]}}const rv={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},iv={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},nv={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},cv={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Frid
80ay","Saturday"]},lv={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},dv={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},pv=(a,e)=>{const t=Number(a),s=t%100;if(s>20||s<10)switch(s%10){case 1:return t+"st";case 2:return t+"nd";case 3:return t+"rd"}return t+"th"},uv={ordinalNumber:pv,era:ws({values:rv,defaultWidth:"wide"}),quarter:ws({values:iv,defaultWidth:"wide",argumentCallback:a=>a-1}),month:ws({values:nv,defaultWidth:"wide"}),day:ws({values:cv,defaultWidth:"wide"}),dayPeriod:ws({values:lv,defaultWidth:"wide",formattingValues:dv,defaultFormattingWidth:"wide"})};function ys(a){return(e,t={})=>{const s=t.width,o=s&&a.matchPatterns[s]||a.matchPatterns[a.defaultMatchWidth],r=e.match(o);if(!r)return null;const i=r[0],n=s&&a.parsePatterns[s]||a.parsePatterns[a.defaultParseWidth],c=Array.isArray(n)?fv(n,p=>p.test(i)):hv(n,p=>p.test(i));let l;l=a.valueCallback?a.valueCallback(c):c,l=t.valueCallback?t.valueCallback(l):l;const d=e.slice(i.length);return{value:l,rest:d}}}function hv(a,e){for(const t in a)if(Object.prototype.hasOwnProperty.call(a,t)&&e(a[t]))return t}function fv(a,e){for(let t=0;t<a.length;t++)if(e(a[t]))return t}function mv(a){return(e,t={})=>{const s=e.match(a.matchPattern);if(!s)return null;const o=s[0],r=e.match(a.parsePattern);if(!r)return null;let i=a.valueCallback?a.valueCallback(r[0]):r[0];i=t.valueCallback?t.valueCallback(i):i;const n=e.slice(o.length);return{value:i,rest:n}}}const gv=/^(\d+)(th|st|nd|rd)?/i,xv=/\d+/i,bv={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},vv={any:[/^b/i,/^(a|c)/i]},jv={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},wv={any:[/1/i,/2/i,/3/i,/4/i]},yv={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},kv={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},Cv={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},Sv={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},_v={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},Pv={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},Av={ordinalNumber:mv({matchPattern:gv,parsePattern:xv,valueCallback:a=>parseInt(a,10)}),era:ys({matchPatterns:bv,defaultMatchWidth:"wide",parsePatterns:vv,defaultParseWidth:"any"}),quarter:ys({matchPatterns:jv,defaultMatchWidth:"wide",parsePatterns:wv,defaultParseWidth:"any",valueCallback:a=>a+1}),month:ys({matchPatterns:yv,defaultMatchWidth:"wide",parsePatterns:kv,defaultParseWidth:"any"}),day:ys({matchPatterns:Cv,defaultMatchWidth:"wide",parsePatterns:Sv,defaultParseWidth:"any"}),dayPeriod:ys({matchPatterns:_v,defaultMatchWidth:"any",parsePatterns:Pv,defaultParseWidth:"any"})},Mv={code:"en-US",formatDistance:Z0,formatLong:av,formatRelative:ov,localize:uv,match:Av,options:{weekStartsOn:0,firstWeekContainsDate:1}};function Ev(a){const e=_t(a);return $0(e,X0(e))+1}function Dv(a){const e=_t(a),t=+jr(e)-+U0(e);return Math.round(t/th)+1}function sh(a,e){const t=_t(a),s=t.getFullYear(),o=zr(),r=e?.firstWeekContainsDate??e?.locale?.options?.firstWeekContainsDate??o.firstWeekContainsDate??o.locale?.options?.firstWeekContainsDate??1,i=ba(a,0);i.setFullYear(s+1,0,r),i.setHours(0,0,0,0);const n=to(i,e),c=ba(a,0);c.setFullYear(s,0,r),c.setHours(0,0,0,0);const l=to(c,e);return t.getTime()>=n.getTime()?s+1:t.getTime()>=l.getTime()?s:s-1}function Tv(a,e){const t=zr(),s=e?.firstWeekContainsDate??e?.locale?.options?.firstWeekContainsDate??t.firstWeekContainsDate??t.locale?.options?.firstWeekContainsDate??1,o=sh(a,e),r=ba(a,0);return r.setFullYear(o,0,s),r.setHours(0,0,0,0),to(r,e)}function Nv(a,e){const t=_t(a),s=+to(t,e)-+Tv(t,e);return Math.round(s/th)+1}function Ee(a,e){const t=a<0?"-":"",s=Math.abs(a).toString().padStart(e,"0");return t+s}
vendor: 5,432 bytes, line 80
80const ta={y(a,e){const t=a.getFullYear(),s=t>0?t:1-t;return Ee(e==="yy"?s%100:s,e.length)},M(a,e){const t=a.getMonth();return e==="M"?String(t+1):Ee(t+1,2)},d(a,e){return Ee(a.getDate(),e.length)},a(a,e){const t=a.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return t.toUpperCase();case"aaa":return t;case"aaaaa":return t[0];case"aaaa":default:return t==="am"?"a.m.":"p.m."}},h(a,e){return Ee(a.getHours()%12||12,e.length)},H(a,e){return Ee(a.getHours(),e.length)},m(a,e){return Ee(a.getMinutes(),e.length)},s(a,e){return Ee(a.getSeconds(),e.length)},S(a,e){const t=e.length,s=a.getMilliseconds(),o=Math.trunc(s*Math.pow(10,t-3));return Ee(o,e.length)}},Va={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},Zl={G:function(a,e,t){const s=a.getFullYear()>0?1:0;switch(e){case"G":case"GG":case"GGG":return t.era(s,{width:"abbreviated"});case"GGGGG":return t.era(s,{width:"narrow"});case"GGGG":default:return t.era(s,{width:"wide"})}},y:function(a,e,t){if(e==="yo"){const s=a.getFullYear(),o=s>0?s:1-s;return t.ordinalNumber(o,{unit:"year"})}return ta.y(a,e)},Y:function(a,e,t,s){const o=sh(a,s),r=o>0?o:1-o;if(e==="YY"){const i=r%100;return Ee(i,2)}return e==="Yo"?t.ordinalNumber(r,{unit:"year"}):Ee(r,e.length)},R:function(a,e){const t=ah(a);return Ee(t,e.length)},u:function(a,e){const t=a.getFullYear();return Ee(t,e.length)},Q:function(a,e,t){const s=Math.ceil((a.getMonth()+1)/3);switch(e){case"Q":return String(s);case"QQ":return Ee(s,2);case"Qo":return t.ordinalNumber(s,{unit:"quarter"});case"QQQ":return t.quarter(s,{width:"abbreviated",context:"formatting"});case"QQQQQ":return t.quarter(s,{width:"narrow",context:"formatting"});case"QQQQ":default:return t.quarter(s,{width:"wide",context:"formatting"})}},q:function(a,e,t){const s=Math.ceil((a.getMonth()+1)/3);switch(e){case"q":return String(s);case"qq":return Ee(s,2);case"qo":return t.ordinalNumber(s,{unit:"quarter"});case"qqq":return t.quarter(s,{width:"abbreviated",context:"standalone"});case"qqqqq":return t.quarter(s,{width:"narrow",context:"standalone"});case"qqqq":default:return t.quarter(s,{width:"wide",context:"standalone"})}},M:function(a,e,t){const s=a.getMonth();switch(e){case"M":case"MM":return ta.M(a,e);case"Mo":return t.ordinalNumber(s+1,{unit:"month"});case"MMM":return t.month(s,{width:"abbreviated",context:"formatting"});case"MMMMM":return t.month(s,{width:"narrow",context:"formatting"});case"MMMM":default:return t.month(s,{width:"wide",context:"formatting"})}},L:function(a,e,t){const s=a.getMonth();switch(e){case"L":return String(s+1);case"LL":return Ee(s+1,2);case"Lo":return t.ordinalNumber(s+1,{unit:"month"});case"LLL":return t.month(s,{width:"abbreviated",context:"standalone"});case"LLLLL":return t.month(s,{width:"narrow",context:"standalone"});case"LLLL":default:return t.month(s,{width:"wide",context:"standalone"})}},w:function(a,e,t,s){const o=Nv(a,s);return e==="wo"?t.ordinalNumber(o,{unit:"week"}):Ee(o,e.length)},I:function(a,e,t){const s=Dv(a);return e==="Io"?t.ordinalNumber(s,{unit:"week"}):Ee(s,e.length)},d:function(a,e,t){return e==="do"?t.ordinalNumber(a.getDate(),{unit:"date"}):ta.d(a,e)},D:function(a,e,t){const s=Ev(a);return e==="Do"?t.ordinalNumber(s,{unit:"dayOfYear"}):Ee(s,e.length)},E:function(a,e,t){const s=a.getDay();switch(e){case"E":case"EE":case"EEE":return t.day(s,{width:"abbreviated",context:"formatting"});case"EEEEE":return t.day(s,{width:"narrow",context:"formatting"});case"EEEEEE":return t.day(s,{width:"short",context:"formatting"});case"EEEE":default:return t.day(s,{width:"wide",context:"formatting"})}},e:function(a,e,t,s){const o=a.getDay(),r=(o-s.weekStartsOn+8)%7||7;switch(e){case"e":return String(r);case"ee":return Ee(r,2);case"eo":return t.ordinalNumber(r,{unit:"day"});case"eee":return t.day(o,{width:"abbreviated",context:"formatting"});case"eeeee":return t.day(o,{width:"narrow",context:"formatting"});case"eeeeee":return t.day(o,{width:"short",context:"formatting"});case"eeee":default:return t.day(o,{width:"wide",context:"formatting"})}},c:function(a,e,t,s){const o=a.getDay(),r=(o-s.weekStartsOn+8)%7||7;switch(e){case"c":return String(r);case"cc":return Ee(r,e.length);case"co":return t.ordinalNumber(r,{unit:"day"});case"ccc":return t.day(o,{width:"abbreviated",context:"standalone"});case"ccccc":return t.day(o,{width:"narrow",context:"standalone"});case"cccccc":return t.day(o,{width:"short",context:"standalone"});case"cccc":default:return t.day(o,{width:"wide",context:"standalone"})}},i:function(a,e,t){const s=a.getDay(),o=s===0?7:s;switch(e){case"i":return String(o);case"ii":return Ee(o,e.length);case"io":return t.ordinalNumber(o,{unit:"day"});case"iii":return t.day(s,{width:"abbreviated",context:"formatting"});case"iiiii":return t.day(s,{width:"narrow",context:"formatting"});case"iiiiii":return t.day(s,{width:"short",context:"formatting"});case"iiii":default:return t.day(s,{width:"wide",context:"formatting"})}},a:function(a,e,t){const o=a.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return t.dayPeriod(o,{width:"abbreviated",context:"formatting"});case"aaa":return t.dayPeriod(o,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return t.dayPeriod(o,{width:"narrow",context:"formatting"});case"aaaa":default:return t.dayPeriod(o,{width:"wide",context:"formatting"})}},b:function(a,e,t){const s=a.getHours();let o;switch(s===12?o=Va.noon:s===0?o=Va.midnight:o=s/12>
vendor: 4,314 bytes, line 80
80=1?"pm":"am",e){case"b":case"bb":return t.dayPeriod(o,{width:"abbreviated",context:"formatting"});case"bbb":return t.dayPeriod(o,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return t.dayPeriod(o,{width:"narrow",context:"formatting"});case"bbbb":default:return t.dayPeriod(o,{width:"wide",context:"formatting"})}},B:function(a,e,t){const s=a.getHours();let o;switch(s>=17?o=Va.evening:s>=12?o=Va.afternoon:s>=4?o=Va.morning:o=Va.night,e){case"B":case"BB":case"BBB":return t.dayPeriod(o,{width:"abbreviated",context:"formatting"});case"BBBBB":return t.dayPeriod(o,{width:"narrow",context:"formatting"});case"BBBB":default:return t.dayPeriod(o,{width:"wide",context:"formatting"})}},h:function(a,e,t){if(e==="ho"){let s=a.getHours()%12;return s===0&&(s=12),t.ordinalNumber(s,{unit:"hour"})}return ta.h(a,e)},H:function(a,e,t){return e==="Ho"?t.ordinalNumber(a.getHours(),{unit:"hour"}):ta.H(a,e)},K:function(a,e,t){const s=a.getHours()%12;return e==="Ko"?t.ordinalNumber(s,{unit:"hour"}):Ee(s,e.length)},k:function(a,e,t){let s=a.getHours();return s===0&&(s=24),e==="ko"?t.ordinalNumber(s,{unit:"hour"}):Ee(s,e.length)},m:function(a,e,t){return e==="mo"?t.ordinalNumber(a.getMinutes(),{unit:"minute"}):ta.m(a,e)},s:function(a,e,t){return e==="so"?t.ordinalNumber(a.getSeconds(),{unit:"second"}):ta.s(a,e)},S:function(a,e){return ta.S(a,e)},X:function(a,e,t){const s=a.getTimezoneOffset();if(s===0)return"Z";switch(e){case"X":return ed(s);case"XXXX":case"XX":return ka(s);case"XXXXX":case"XXX":default:return ka(s,":")}},x:function(a,e,t){const s=a.getTimezoneOffset();switch(e){case"x":return ed(s);case"xxxx":case"xx":return ka(s);case"xxxxx":case"xxx":default:return ka(s,":")}},O:function(a,e,t){const s=a.getTimezoneOffset();switch(e){case"O":case"OO":case"OOO":return"GMT"+Ql(s,":");case"OOOO":default:return"GMT"+ka(s,":")}},z:function(a,e,t){const s=a.getTimezoneOffset();switch(e){case"z":case"zz":case"zzz":return"GMT"+Ql(s,":");case"zzzz":default:return"GMT"+ka(s,":")}},t:function(a,e,t){const s=Math.trunc(a.getTime()/1e3);return Ee(s,e.length)},T:function(a,e,t){const s=a.getTime();return Ee(s,e.length)}};function Ql(a,e=""){const t=a>0?"-":"+",s=Math.abs(a),o=Math.trunc(s/60),r=s%60;return r===0?t+String(o):t+String(o)+e+Ee(r,2)}function ed(a,e){return a%60===0?(a>0?"-":"+")+Ee(Math.abs(a)/60,2):ka(a,e)}function ka(a,e=""){const t=a>0?"-":"+",s=Math.abs(a),o=Ee(Math.trunc(s/60),2),r=Ee(s%60,2);return t+o+e+r}const td=(a,e)=>{switch(a){case"P":return e.date({width:"short"});case"PP":return e.date({width:"medium"});case"PPP":return e.date({width:"long"});case"PPPP":default:return e.date({width:"full"})}},oh=(a,e)=>{switch(a){case"p":return e.time({width:"short"});case"pp":return e.time({width:"medium"});case"ppp":return e.time({width:"long"});case"pppp":default:return e.time({width:"full"})}},Lv=(a,e)=>{const t=a.match(/(P+)(p+)?/)||[],s=t[1],o=t[2];if(!o)return td(a,e);let r;switch(s){case"P":r=e.dateTime({width:"short"});break;case"PP":r=e.dateTime({width:"medium"});break;case"PPP":r=e.dateTime({width:"long"});break;case"PPPP":default:r=e.dateTime({width:"full"});break}return r.replace("{{date}}",td(s,e)).replace("{{time}}",oh(o,e))},Iv={p:oh,P:Lv},Ov=/^D+$/,Fv=/^Y+$/,Rv=["D","DD","YY","YYYY"];function Bv(a){return Ov.test(a)}function zv(a){return Fv.test(a)}function Vv(a,e,t){const s=Wv(a,e,t);if(console.warn(s),Rv.includes(a))throw new RangeError(s)}function Wv(a,e,t){const s=a[0]==="Y"?"years":"days of the month";return`Use \`${a.toLowerCase()}\` instead of \`${a}\` (in \`${e}\`) for formatting ${s} to the input \`${t}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const Hv=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,$v=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,Uv=/^'([^]*?)'?$/,qv=/''/g,Kv=/[a-zA-Z]/;function ad(a,e,t){const s=zr(),o=s.locale??Mv,r=s.firstWeekContainsDate??s.locale?.options?.firstWeekContainsDate??1,i=s.weekStartsOn??s.locale?.options?.weekStartsOn??0,n=_t(a);if(!Y0(n))throw new RangeError("Invalid time value");let c=e.match($v).map(d=>{const p=d[0];if(p==="p"||p==="P"){const u=Iv[p];return u(d,o.formatLong)}return d}).join("").match(Hv).map(d=>{if(d==="''")return{isToken:!1,value:"'"};const p=d[0];if(p==="'")return{isToken:!1,value:Gv(d)};if(Zl[p])return{isToken:!0,value:d};
80if(p.match(Kv))throw new RangeError("Format string contains an unescaped latin alphabet character `"+p+"`");return{isToken:!1,value:d}});o.localize.preprocessor&&(c=o.localize.preprocessor(n,c));const l={firstWeekContainsDate:r,weekStartsOn:i,locale:o};return c.map(d=>{if(!d.isToken)return d.value;const p=d.value;(zv(p)||Bv(p))&&Vv(p,e,String(a));const u=Zl[p[0]];return u(n,p,o.localize,l)}).join("")}function Gv(a){const e=a.match(Uv);return e?e[1].replace(qv,"'"):a}function Yv(a){return K0(a,q0(a))}const je=em()((a,e)=>({isFullscreen:!1,activeFile:"",didCopyCode:!1,isTerminalOpen:!1,isRunning:!1,isMaximized:!1,isAutoPilotMode:!0,editedFiles:{},fileToScrollIntoView:null,isPreviewMode:!1,setIsFullscreen:t=>a({isFullscreen:t}),setActiveFile:(t,s=!1)=>{t!==e().activeFile&&(s&&e().isAutoPilotMode&&(He.log("Disabling auto-pilot due to user file selection"),a({isAutoPilotMode:!1})),a({activeFile:t,fileToScrollIntoView:t}))},setDidCopyCode:t=>a({didCopyCode:t}),setTerminalOpen:t=>{a({isTerminalOpen:t})},setIsRunning:t=>a({isRunning:t}),setIsMaximized:t=>a({isMaximized:t}),setIsAutoPilotMode:t=>{a({isAutoPilotMode:t})},getIsAutoPilotMode:()=>e().isAutoPilotMode,setIsTerminalOpen:t=>{He.log("Setting terminal open:",t),a({isTerminalOpen:t})},setFileToScrollIntoView:t=>{a({fileToScrollIntoView:t})},updateFileContent:(t,s,o)=>{const r={...e().editedFiles};s===o?delete r[t]:r[t]={path:t,content:s,originalContent:o},a({editedFiles:r})},getEditedFiles:()=>Object.values(e().editedFiles),isFileEdited:t=>!!e().editedFiles[t],getFileContent:t=>{const s=e().editedFiles[t];return s?s.content:null},resetFileContent:t=>{const s={...e().editedFiles};delete s[t],a({editedFiles:s})},resetAllEditedFiles:()=>{a({editedFiles:{}})},hasEditedFiles:()=>Object.keys(e().editedFiles).length>0,setIsPreviewMode:t=>{a({isPreviewMode:t})}})),Xv=E.memo(({attachment:a})=>{const[e,t]=E.useState(!1),[s,o]=E.useState(!1),[r,i]=E.useState(!1),[n,c]=E.useState(!1),[l,d]=E.useState(!1),[p,u]=E.useState(""),[f,m]=E.useState(!1),[g,x]=E.useState(!1),b=a.media_type==="text",y=a.media_type==="image",k=a.media_type==="application/pdf",A=T=>T.split(".").pop()?.toLowerCase()||"",S=()=>{if(b)return!0;const T=A(a.filename);return["txt","md","json","js","jsx","ts","tsx","py","java","cpp","c","h","css","scss","sass","html","htm","xml","yaml","yml","toml","ini","cfg","conf","sh","bash","zsh","ps1","bat","cmd","sql","r","rb","php","go","rs","swift","kt","scala","clj","hs","elm","vue","svelte","dockerfile","makefile","gitignore","env","log","csv","tsv"].includes(T)||a.filename.toLowerCase().includes("dockerfile")||a.filename.toLowerCase().includes("makefile")||a.filename.toLowerCase().includes("readme")},N=async T=>{m(!0),x(!1);try{const O=await fetch(T);if(!O.ok)throw new Error(`HTTP error! status: ${O.status}`);const Z=await O.text();u(Z)}catch(O){console.error("Error fetching content:",O),x(!0)}finally{m(!1)}},D=()=>{if(y)return h.jsx(qd,{className:"w-4 h-4"});if(k)return h.jsx(Da,{className:"w-4 h-4"});switch(A(a.filename)){case"js":case"jsx":case"ts":case"tsx":return h.jsx(An,{className:"w-4 h-4"});case"json":return h.jsx(sp,{className:"w-4 h-4"});case"txt":case"md":return h.jsx(Da,{className:"w-4 h-4"});case"csv":case"xls":case"xlsx":return h.jsx(Gd,{className:"w-4 h-4"});case"zip":case"tar":case"gz":return h.jsx(Kd,{className:"w-4 h-4"});default:return h.jsx(_i,{className:"w-4 h-4"})}},L=T=>{if(T.stopPropagation(),a.presigned_url)window.open(a.presigned_url,"_blank");else if((p||a.content)&&S()){const O=p||a.content||"",Z=new Blob([O],{type:"text/plain"}),oe=URL.createObjectURL(Z),se=document.createElement("a");se.href=oe,se.download=a.filename,document.body.appendChild(se),se.click(),Kf(document.body,se),URL.revokeObjectURL(oe)}},M=()=>{t(!0),a.presigned_url&&S()&&!p&&!f&&N(a.presigned_url)},B=()=>{t(!1),o(!1),i(!1),u(""),x(!1),m(!1)},V=()=>{o(!s)},P=()=>{i(!r)},F=async()=>{const T=p||a.content;if(T)try{await navigator.clipboard.writeText(T)}catch(O){console.error("Failed to copy content:",O)}},j=()=>{const T=[];T.push({label:"File Name",value:a.filename}),T.push({label:"Type",value:a.media_type||a.mime_type||"Unknown"}),a.file_size&&T.push({label:"Size",value:$()});const O=A(a.filename);O&&T.push({label:"Extension",value:O.toUpperCase()});const Z=p||a.content;if(Z&&S()){const oe=Z.split(` 81`).length,se=Z.length;
81T.push({label:"Lines",value:oe.toLocaleString()}),T.push({label:"Characters",value:se.toLocaleString()})}return T},z=()=>{c(!0)},ce=()=>{d(!0),c(!0)},$=()=>{if(!a.file_size)return"";const T=a.file_size/1024;if(T<1024)return`${Math.round(T*10)/10} KB`;{const O=T/1024;return`${Math.round(O*10)/10} MB`}},K=!!a.presigned_url||S()&&!!a.content,I=$(),X=T=>{T.stopPropagation()};return h.jsxs(h.Fragment,{children:[h.jsxs("div",{"data-codepal-ve-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:div:248:13","data-codepal-binding-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:div:248:13","data-codepal-module-id":"src-pages-project-messagelist-attachmentitem-tsx","data-codepal-component-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem","data-codepal-source-node-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:div:248:13","data-codepal-source-file":"src/pages/Project/MessageList/AttachmentItem.tsx","data-codepal-source-line":"248","data-codepal-source-column":"13","data-codepal-source-symbol":"AttachmentItem",className:`attachment-chip inline-flex items-center mr-2 mb-2 px-2 py-1 rounded-md bg-white/10 backdrop-blur-sm 82 hover:bg-white/20 transition-colors cursor-pointer border border-white/20 min-w-0`,onClick:M,children:[h.jsx("div",{"data-codepal-ve-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:div:253:17","data-codepal-binding-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:div:253:17","data-codepal-module-id":"src-pages-project-messagelist-attachmentitem-tsx","data-codepal-component-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem","data-codepal-source-node-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:div:253:17","data-codepal-source-file":"src/pages/Project/MessageList/AttachmentItem.tsx","data-codepal-source-line":"253","data-codepal-source-column":"17","data-codepal-source-symbol":"AttachmentItem",className:"flex-shrink-0 mr-1.5",children:D()}),h.jsx("span",{"data-codepal-ve-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:span:256:17","data-codepal-binding-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:span:256:17","data-codepal-module-id":"src-pages-project-messagelist-attachmentitem-tsx","data-codepal-component-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem","data-codepal-source-node-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:span:256:17","data-codepal-source-file":"src/pages/Project/MessageList/AttachmentItem.tsx","data-codepal-source-line":"256","data-codepal-source-column":"17","data-codepal-source-symbol":"AttachmentItem",className:"text-xs font-medium truncate max-w-[120px] sm:max-w-[150px] md:max-w-[200px]",children:a.filename}),I&&h.jsx("span",{"data-codepal-ve-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:span:260:21","data-codepal-binding-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:span:260:21","data-codepal-module-id":"src-pages-project-messagelist-attachmentitem-tsx","data-codepal-component-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem","data-codepal-source-node-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:span:260:21","data-codepal-source-file":"src/pages/Project/MessageList/AttachmentItem.tsx","data-codepal-source-line":"260","data-codepal-source-column":"21","data-codepal-source-symbol":"AttachmentItem",className:"text-[10px] ml-1.5 opacity-70 hidden sm:inline",children:I})]}),e&&h.jsx("div",{"data-codepal-ve-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:div:268:17","data-codepal-binding-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:div:268:17","data-codepal-module-id":"src-pages-project-messagelist-attachmentitem-tsx","data-codepal-component-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem","data-codepal-source-node-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:div:268:17","data-codepal-source-file":"src/pages/Project/MessageList/AttachmentItem.tsx","data-codepal-source-line":"268","data-codepal-source-column":"17","data-codepal-source-symbol":"AttachmentItem",className:ie("fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm",s?"p-0":"p-2 sm:p-4"),onClick:B,children:h.jsxs("div",{"data-codepal-ve-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:div:273:21","data-codepal-binding-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:div:273:21","data-codepal-module-id":"src-pages-project-messagelist-attachmentitem-tsx","data-codepal-component-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem","data-codepal-source-node
82-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:div:273:21","data-codepal-source-file":"src/pages/Project/MessageList/AttachmentItem.tsx","data-codepal-source-line":"273","data-codepal-source-column":"21","data-codepal-source-symbol":"AttachmentItem",className:ie("bg-white dark:bg-gray-800 shadow-xl overflow-hidden flex flex-col",s?"w-full h-full":"rounded-lg w-full max-w-4xl h-[90vh] max-h-[800px]"),onClick:X,children:[h.jsx("div",{"data-codepal-ve-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:div:283:25","data-codepal-binding-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:div:283:25","data-codepal-module-id":"src-pages-project-messagelist-attachmentitem-tsx","data-codepal-component-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem","data-codepal-source-node-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:div:283:25","data-codepal-source-file":"src/pages/Project/MessageList/AttachmentItem.tsx","data-codepal-source-line":"283","data-codepal-source-column":"25","data-codepal-source-symbol":"AttachmentItem",className:"border-b border-gray-200 dark:border-gray-700 px-4 py-3 flex-shrink-0",children:h.jsxs("div",{"data-codepal-ve-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:div:284:29","data-codepal-binding-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:div:284:29","data-codepal-module-id":"src-pages-project-messagelist-attachmentitem-tsx","data-codepal-component-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem","data-codepal-source-node-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:div:284:29","data-codepal-source-file":"src/pages/Project/MessageList/AttachmentItem.tsx","data-codepal-source-line":"284","data-codepal-source-column":"29","data-codepal-source-symbol":"AttachmentItem",className:"flex justify-between items-center",children:[h.jsxs("div",{"data-codepal-ve-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:div:285:33","data-codepal-binding-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:div:285:33","data-codepal-module-id":"src-pages-project-messagelist-attachmentitem-tsx","data-codepal-component-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem","data-codepal-source-node-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:div:285:33","data-codepal-source-file":"src/pages/Project/MessageList/AttachmentItem.tsx","data-codepal-source-line":"285","data-codepal-source-column":"33","data-codepal-source-symbol":"AttachmentItem",className:"flex items-center min-w-0 flex-1",children:[h.jsx("div",{"data-codepal-ve-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:div:286:37","data-codepal-binding-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:div:286:37","data-codepal-module-id":"src-pages-project-messagelist-attachmentitem-tsx","data-codepal-component-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem","data-codepal-source-node-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:div:286:37","data-codepal-source-file":"src/pages/Project/MessageList/AttachmentItem.tsx","data-codepal-source-line":"286","data-codepal-source-column":"37","data-codepal-source-symbol":"AttachmentItem",className:"text-gray-500 dark:text-gray-400 mr-3 flex-shrink-0",children:D()}),h.jsxs("div",{"data-codepal-ve-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:div:289:37","data-codepal-binding-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:div:289:37","data-codepal-module-id":"src-pages-project-messagelist-attachmentitem-tsx","data-codepal-component-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem","data-codepal-source-node-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:div:289:37","data-codepal-source-file":"src/pages/Project/MessageList/AttachmentItem.tsx","data-codepal-source-line":"289","data-codepal-source-column":"37","data-codepal-source-symbol":"AttachmentItem",className:"min-w-0 flex-1",children:[h.jsx("h3",{"data-codepal-ve-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:h3:29
820:41","data-codepal-binding-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:h3:290:41","data-codepal-module-id":"src-pages-project-messagelist-attachmentitem-tsx","data-codepal-component-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem","data-codepal-source-node-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:h3:290:41","data-codepal-source-file":"src/pages/Project/MessageList/AttachmentItem.tsx","data-codepal-source-line":"290","data-codepal-source-column":"41","data-codepal-source-symbol":"AttachmentItem",className:"text-sm font-medium text-gray-800 dark:text-gray-200 truncate",children:a.filename}),h.jsxs("p",{"data-codepal-ve-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:p:293:41","data-codepal-binding-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:p:293:41","data-codepal-module-id":"src-pages-project-messagelist-attachmentitem-tsx","data-codepal-component-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem","data-codepal-source-node-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:p:293:41","data-codepal-source-file":"src/pages/Project/MessageList/AttachmentItem.tsx","data-codepal-source-line":"293","data-codepal-source-column":"41","data-codepal-source-symbol":"AttachmentItem",className:"text-xs text-gray-500 dark:text-gray-400",children:[I," ⢠",a.media_type]})]})]}),h.jsxs("div",{"data-codepal-ve-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:div:299:33","data-codepal-binding-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:div:299:33","data-codepal-module-id":"src-pages-project-messagelist-attachmentitem-tsx","data-codepal-component-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem","data-codepal-source-node-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:div:299:33","data-codepal-source-file":"src/pages/Project/MessageList/AttachmentItem.tsx","data-codepal-source-line":"299","data-codepal-source-column":"33","data-codepal-source-symbol":"AttachmentItem",className:"flex items-center gap-1 ml-4",children:[h.jsxs("button",{"data-codepal-ve-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:button:301:37","data-codepal-binding-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:button:301:37","data-codepal-module-id":"src-pages-project-messagelist-attachmentitem-tsx","data-codepal-component-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem","data-codepal-source-node-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:button:301:37","data-codepal-source-file":"src/pages/Project/MessageList/AttachmentItem.tsx","data-codepal-source-line":"301","data-codepal-source-column":"37","data-codepal-source-symbol":"AttachmentItem",className:ie("p-1.5 rounded-lg transition-all duration-200 relative group",r?"bg-blue-100 dark:bg-blue-900/40 text-blue-700 dark:text-blue-300 hover:bg-blue-200 dark:hover:bg-blue-900/60 ring-2 ring-blue-200 dark:ring-blue-800":"text-gray-600 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-700 hover:text-gray-700 dark:hover:text-gray-300"),onClick:T=>{T.stopPropagation(),P()},title:r?"Hide file details":"Show file details",children:[h.jsx(Es,{className:ie("w-4 h-4 transition-transform duration-200",r&&"scale-110")}),r&&h.jsx("div",{"data-codepal-ve-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:div:319:45","data-codepal-binding-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:div:319:45","data-codepal-module-id":"src-pages-project-messagelist-attachmentitem-tsx","data-codepal-component-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem","data-codepal-source-node-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:div:319:45","data-codepal-source-file":"src/pages/Project/MessageList/AttachmentItem.tsx","data-codepal-source-line":"319","data-codepal-source-column":"45","data-codepal-source-symbol":"AttachmentItem",className:"absolute -top-0.5 -right-0.5 w-2 h-2 bg-blue-500 rounded-full animate-pulse"})]}),(p||a.content)&&S()&&h.jsx("button",{"data-codepal-ve-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:button:326:41","data-codepal-binding-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:button:326:41","data-codepal-module-id":"src-pages-project-messagelist-attachmentitem-tsx","data-codepal-component-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem","data-codepal-source-node
82-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:button:326:41","data-codepal-source-file":"src/pages/Project/MessageList/AttachmentItem.tsx","data-codepal-source-line":"326","data-codepal-source-column":"41","data-codepal-source-symbol":"AttachmentItem",className:"p-1.5 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-700 text-gray-600 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-300 transition-all duration-200",onClick:T=>{T.stopPropagation(),F()},title:"Copy content to clipboard",children:h.jsx(Pn,{className:"w-4 h-4"})}),K&&h.jsx("button",{"data-codepal-ve-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:button:340:41","data-codepal-binding-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:button:340:41","data-codepal-module-id":"src-pages-project-messagelist-attachmentitem-tsx","data-codepal-component-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem","data-codepal-source-node-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:button:340:41","data-codepal-source-file":"src/pages/Project/MessageList/AttachmentItem.tsx","data-codepal-source-line":"340","data-codepal-source-column":"41","data-codepal-source-symbol":"AttachmentItem",className:"p-1.5 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-700 text-gray-600 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-300 transition-all duration-200",onClick:T=>{T.stopPropagation(),L(T)},title:"Download file",children:h.jsx(Si,{className:"w-4 h-4"})}),h.jsxs("button",{"data-codepal-ve-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:button:353:37","data-codepal-binding-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:button:353:37","data-codepal-module-id":"src-pages-project-messagelist-attachmentitem-tsx","data-codepal-component-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem","data-codepal-source-node-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:button:353:37","data-codepal-source-file":"src/pages/Project/MessageList/AttachmentItem.tsx","data-codepal-source-line":"353","data-codepal-source-column":"37","data-codepal-source-symbol":"AttachmentItem",className:ie("p-1.5 rounded-lg transition-all duration-200 relative",s?"bg-emerald-100 dark:bg-emerald-900/40 text-emerald-700 dark:text-emerald-300 hover:bg-emerald-200 dark:hover:bg-emerald-900/60 ring-2 ring-emerald-200 dark:ring-emerald-800":"text-gray-600 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-700 hover:text-gray-700 dark:hover:text-gray-300"),onClick:T=>{T.stopPropagation(),V()},title:s?"Exit fullscreen mode":"Enter fullscreen mode",children:[s?h.jsx(am,{className:"w-4 h-4 transition-transform duration-200 scale-110"}):h.jsx(sm,{className:"w-4 h-4 transition-transform duration-200"}),s&&h.jsx("div",{"data-codepal-ve-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:div:372:45","data-codepal-binding-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:div:372:45","data-codepal-module-id":"src-pages-project-messagelist-attachmentitem-tsx","data-codepal-component-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem","data-codepal-source-node-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:div:372:45","data-codepal-source-file":"src/pages/Project/MessageList/AttachmentItem.tsx","data-codepal-source-line":"372","data-codepal-source-column":"45","data-codepal-source-symbol":"AttachmentItem",className:"absolute -top-0.5 -right-0.5 w-2 h-2 bg-emerald-500 rounded-full animate-pulse"})]}),h.jsx("button",{"data-codepal-ve-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:button:378:37","data-codepal-binding-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:button:378:37","data-codepal-module-id":"src-pages-project-messagelist-attachmentitem-tsx","data-codepal-component-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem","data-codepal-source-node-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:button:378:37","data-codepal-source-file":"src/pages/Project/MessageList/AttachmentItem.tsx","data-codepal-source-line":"378","data-codepal-source-column":"37","data-codepal-source-symbol":"AttachmentItem",className:"p-1.5 rounded-lg hover:bg-red-50 dark:hover:bg-red-900/20 text-gray-600 dark:text-gray-400 hover:text-red-600 dark:hover:text-red-400 transition-all duration-200",onClick:T=>{T.stopPropagation(),B()},title:"Close modal",children:h.jsx("svg",{"data-codepal-ve-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:svg:386:41","data-codepal-binding-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:svg:386:41","data-codepal-module-id":"src-pages-project-messagelist-attachmentitem-tsx","data-codepal-component-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem","data-codepal-source-node
82-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:svg:386:41","data-codepal-source-file":"src/pages/Project/MessageList/AttachmentItem.tsx","data-codepal-source-line":"386","data-codepal-source-column":"41","data-codepal-source-symbol":"AttachmentItem",className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:h.jsx("path",{"data-codepal-ve-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:path:387:45","data-codepal-binding-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:path:387:45","data-codepal-module-id":"src-pages-project-messagelist-attachmentitem-tsx","data-codepal-component-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem","data-codepal-source-node-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:path:387:45","data-codepal-source-file":"src/pages/Project/MessageList/AttachmentItem.tsx","data-codepal-source-line":"387","data-codepal-source-column":"45","data-codepal-source-symbol":"AttachmentItem",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]})]})}),h.jsxs("div",{"data-codepal-ve-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:div:396:25","data-codepal-binding-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:div:396:25","data-codepal-module-id":"src-pages-project-messagelist-attachmentitem-tsx","data-codepal-component-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem","data-codepal-source-node-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:div:396:25","data-codepal-source-file":"src/pages/Project/MessageList/AttachmentItem.tsx","data-codepal-source-line":"396","data-codepal-source-column":"25","data-codepal-source-symbol":"AttachmentItem",className:"flex flex-1 overflow-hidden",children:[h.jsx("div",{"data-codepal-ve-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:div:398:29","data-codepal-binding-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:div:398:29","data-codepal-module-id":"src-pages-project-messagelist-attachmentitem-tsx","data-codepal-component-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem","data-codepal-source-node-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:div:398:29","data-codepal-source-file":"src/pages/Project/MessageList/AttachmentItem.tsx","data-codepal-source-line":"398","data-codepal-source-column":"29","data-codepal-source-symbol":"AttachmentItem",className:ie("flex flex-col overflow-hidden",r?"w-2/3":"w-full"),children:h.jsxs("div",{"data-codepal-ve-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:div:402:33","data-codepal-binding-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:div:402:33","data-codepal-module-id":"src-pages-project-messagelist-attachmentitem-tsx","data-codepal-component-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem","data-codepal-source-node-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:div:402:33","data-codepal-source-file":"src/pages/Project/MessageList/AttachmentItem.tsx","data-codepal-source-line":"402","data-codepal-source-column":"33","data-codepal-source-symbol":"AttachmentItem",className:"flex-1 overflow-auto p-4",children:[y&&a.presigned_url&&h.jsxs("div",{"data-codepal-ve-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:div:405:41","data-codepal-binding-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:div:405:41","data-codepal-module-id":"src-pages-project-messagelist-attachmentitem-tsx","data-codepal-component-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem","data-codepal-source-node-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:div:405:41","data-codepal-source-file":"src/pages/Project/MessageList/AttachmentItem.tsx","data-codepal-source-line":"405","data-codepal-source-column":"41","data-codepal-source-symbol":"AttachmentItem",className:"flex justify-center items-center h-full",children:[!n&&h.jsxs("div",{"data-codepal-ve-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:div:407:49","data-codepal-binding-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:div:407:49","data-codepal-module-id":"src-pages-project-messagelist-attachmentitem-tsx","data-codepal-component-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem","data-codepal-source-node
82-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:div:407:49","data-codepal-source-file":"src/pages/Project/MessageList/AttachmentItem.tsx","data-codepal-source-line":"407","data-codepal-source-column":"49","data-codepal-source-symbol":"AttachmentItem",className:"flex items-center justify-center",children:[h.jsx(nr,{className:"w-6 h-6 animate-spin text-gray-400"}),h.jsx("span",{"data-codepal-ve-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:span:409:53","data-codepal-binding-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:span:409:53","data-codepal-module-id":"src-pages-project-messagelist-attachmentitem-tsx","data-codepal-component-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem","data-codepal-source-node-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:span:409:53","data-codepal-source-file":"src/pages/Project/MessageList/AttachmentItem.tsx","data-codepal-source-line":"409","data-codepal-source-column":"53","data-codepal-source-symbol":"AttachmentItem",className:"ml-2 text-gray-400",children:"Loading image..."})]}),l?h.jsxs("div",{"data-codepal-ve-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:div:413:49","data-codepal-binding-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:div:413:49","data-codepal-module-id":"src-pages-project-messagelist-attachmentitem-tsx","data-codepal-component-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem","data-codepal-source-node-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:div:413:49","data-codepal-source-file":"src/pages/Project/MessageList/AttachmentItem.tsx","data-codepal-source-line":"413","data-codepal-source-column":"49","data-codepal-source-symbol":"AttachmentItem",className:"flex flex-col items-center justify-center text-gray-500 dark:text-gray-400",children:[h.jsx(Rs,{className:"w-8 h-8 mb-2"}),h.jsx("span",{"data-codepal-ve-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:span:416:53","data-codepal-binding-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:span:416:53","data-codepal-module-id":"src-pages-project-messagelist-attachmentitem-tsx","data-codepal-component-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem","data-codepal-source-node-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:span:416:53","data-codepal-source-file":"src/pages/Project/MessageList/AttachmentItem.tsx","data-codepal-source-line":"416","data-codepal-source-column":"53","data-codepal-source-symbol":"AttachmentItem",className:"text-sm",children:"Unable to load image"})]}):h.jsx("img",{"data-codepal-ve-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:img:419:49","data-codepal-binding-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:img:419:49","data-codepal-module-id":"src-pages-project-messagelist-attachmentitem-tsx","data-codepal-component-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem","data-codepal-source-node-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:img:419:49","data-codepal-source-file":"src/pages/Project/MessageList/AttachmentItem.tsx","data-codepal-source-line":"419","data-codepal-source-column":"49","data-codepal-source-symbol":"AttachmentItem",src:a.presigned_url,alt:a.filename,className:ie("max-w-full max-h-full object-contain",!n&&"hidden"),onLoad:z,onError:ce})]}),k&&a.presigned_url&&h.jsxs("div",{"data-codepal-ve-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:div:435:41","data-codepal-binding-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:div:435:41","data-codepal-module-id":"src-pages-project-messagelist-attachmentitem-tsx","data-codepal-component-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem","data-codepal-source-node-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:div:435:41","data-codepal-source-file":"src/pages/Project/MessageList/AttachmentItem.tsx","data-codepal-source-line":"435","data-codepal-source-column":"41","data-codepal-source-symbol":"AttachmentItem",className:"h-full flex flex-col",children:[h.jsx("iframe",{"data-codepal-ve-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:iframe:436:45","data-codepal-binding-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:iframe:436:45","data-codepal-module-id":"src-pages-project-messagelist-attachmentitem-tsx","data-codepal-component-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem","data-codepal-source-node
82-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:iframe:436:45","data-codepal-source-file":"src/pages/Project/MessageList/AttachmentItem.tsx","data-codepal-source-line":"436","data-codepal-source-column":"45","data-codepal-source-symbol":"AttachmentItem",src:a.presigned_url,className:"flex-1 w-full border border-gray-300 dark:border-gray-600 rounded-md",title:a.filename}),h.jsx("div",{"data-codepal-ve-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:div:441:45","data-codepal-binding-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:div:441:45","data-codepal-module-id":"src-pages-project-messagelist-attachmentitem-tsx","data-codepal-component-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem","data-codepal-source-node-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:div:441:45","data-codepal-source-file":"src/pages/Project/MessageList/AttachmentItem.tsx","data-codepal-source-line":"441","data-codepal-source-column":"45","data-codepal-source-symbol":"AttachmentItem",className:"mt-4 text-center",children:h.jsxs("button",{"data-codepal-ve-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:button:442:49","data-codepal-binding-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:button:442:49","data-codepal-module-id":"src-pages-project-messagelist-attachmentitem-tsx","data-codepal-component-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem","data-codepal-source-node-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:button:442:49","data-codepal-source-file":"src/pages/Project/MessageList/AttachmentItem.tsx","data-codepal-source-line":"442","data-codepal-source-column":"49","data-codepal-source-symbol":"AttachmentItem",className:`flex items-center gap-2 px-4 py-2 bg-blue-100 hover:bg-blue-200 dark:bg-blue-800/40 83 dark:hover:bg-blue-800/60 text-blue-700 dark:text-blue-300 rounded-md transition-colors mx-auto`,onClick:()=>window.open(a.presigned_url,"_blank"),children:[h.jsx(ko,{className:"w-4 h-4"}),h.jsx("span",{"data-codepal-ve-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:span:448:53","data-codepal-binding-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:span:448:53","data-codepal-module-id":"src-pages-project-messagelist-attachmentitem-tsx","data-codepal-component-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem","data-codepal-source-node-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:span:448:53","data-codepal-source-file":"src/pages/Project/MessageList/AttachmentItem.tsx","data-codepal-source-line":"448","data-codepal-source-column":"53","data-codepal-source-symbol":"AttachmentItem",children:"Open PDF in new tab"})]})})]}),S()&&!y&&!k&&h.jsx("div",{"data-codepal-ve-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:div:456:41","data-codepal-binding-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:div:456:41","data-codepal-module-id":"src-pages-project-messagelist-attachmentitem-tsx","data-codepal-component-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem","data-codepal-source-node-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:div:456:41","data-codepal-source-file":"src/pages/Project/MessageList/AttachmentItem.tsx","data-codepal-source-line":"456","data-codepal-source-column":"41","data-codepal-source-symbol":"AttachmentItem",className:"h-full flex flex-col",children:f?h.jsxs("div",{"data-codepal-ve-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:div:458:49","data-codepal-binding-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:div:458:49","data-codepal-module-id":"src-pages-project-messagelist-attachmentitem-tsx","data-codepal-component-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem","data-codepal-source-node-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:div:458:49","data-codepal-source-file":"src/pages/Project/MessageList/AttachmentItem.tsx","data-codepal-source-line":"458","data-codepal-source-column":"49","data-codepal-source-symbol":"AttachmentItem",className:"flex-1 flex items-center justify-center",children:[h.jsx(nr,{className:"w-6 h-6 animate-spin text-gray-400"}),h.jsx("span",{"data-codepal-ve-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:span:460:53","data-codepal-binding-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:span:460:53","data-codepal-module-id":"src-pages-project-messagelist-attachmentitem-tsx","data-codepal-component-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem","data-codepal-source-node
83-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:span:460:53","data-codepal-source-file":"src/pages/Project/MessageList/AttachmentItem.tsx","data-codepal-source-line":"460","data-codepal-source-column":"53","data-codepal-source-symbol":"AttachmentItem",className:"ml-2 text-gray-400",children:"Loading content..."})]}):g?h.jsxs("div",{"data-codepal-ve-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:div:463:49","data-codepal-binding-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:div:463:49","data-codepal-module-id":"src-pages-project-messagelist-attachmentitem-tsx","data-codepal-component-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem","data-codepal-source-node-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:div:463:49","data-codepal-source-file":"src/pages/Project/MessageList/AttachmentItem.tsx","data-codepal-source-line":"463","data-codepal-source-column":"49","data-codepal-source-symbol":"AttachmentItem",className:"flex-1 flex flex-col items-center justify-center text-gray-500 dark:text-gray-400",children:[h.jsx(Rs,{className:"w-8 h-8 mb-2"}),h.jsx("span",{"data-codepal-ve-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:span:466:53","data-codepal-binding-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:span:466:53","data-codepal-module-id":"src-pages-project-messagelist-attachmentitem-tsx","data-codepal-component-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem","data-codepal-source-node-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:span:466:53","data-codepal-source-file":"src/pages/Project/MessageList/AttachmentItem.tsx","data-codepal-source-line":"466","data-codepal-source-column":"53","data-codepal-source-symbol":"AttachmentItem",className:"text-sm mb-4",children:"Unable to load file content"}),a.presigned_url&&h.jsxs("button",{"data-codepal-ve-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:button:468:57","data-codepal-binding-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:button:468:57","data-codepal-module-id":"src-pages-project-messagelist-attachmentitem-tsx","data-codepal-component-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem","data-codepal-source-node-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:button:468:57","data-codepal-source-file":"src/pages/Project/MessageList/AttachmentItem.tsx","data-codepal-source-line":"468","data-codepal-source-column":"57","data-codepal-source-symbol":"AttachmentItem",className:`flex items-center gap-2 px-4 py-2 bg-blue-100 hover:bg-blue-200 dark:bg-blue-800/40 84 dark:hover:bg-blue-800/60 text-blue-700 dark:text-blue-300 rounded-md transition-colors`,onClick:()=>window.open(a.presigned_url,"_blank"),children:[h.jsx(ko,{className:"w-4 h-4"}),h.jsx("span",{"data-codepal-ve-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:span:474:61","data-codepal-binding-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:span:474:61","data-codepal-module-id":"src-pages-project-messagelist-attachmentitem-tsx","data-codepal-component-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem","data-codepal-source-node-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:span:474:61","data-codepal-source-file":"src/pages/Project/MessageList/AttachmentItem.tsx","data-codepal-source-line":"474","data-codepal-source-column":"61","data-codepal-source-symbol":"AttachmentItem",children:"Open file in new tab"})]})]}):p||a.content?h.jsxs("div",{"data-codepal-ve-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:div:479:49","data-codepal-binding-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:div:479:49","data-codepal-module-id":"src-pages-project-messagelist-attachmentitem-tsx","data-codepal-component-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem","data-codepal-source-node
84-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:div:479:49","data-codepal-source-file":"src/pages/Project/MessageList/AttachmentItem.tsx","data-codepal-source-line":"479","data-codepal-source-column":"49","data-codepal-source-symbol":"AttachmentItem",className:"bg-gray-50 dark:bg-gray-900/30 rounded-md overflow-hidden flex flex-col h-full",children:[h.jsx("div",{"data-codepal-ve-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:div:481:53","data-codepal-binding-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:div:481:53","data-codepal-module-id":"src-pages-project-messagelist-attachmentitem-tsx","data-codepal-component-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem","data-codepal-source-node-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:div:481:53","data-codepal-source-file":"src/pages/Project/MessageList/AttachmentItem.tsx","data-codepal-source-line":"481","data-codepal-source-column":"53","data-codepal-source-symbol":"AttachmentItem",className:"px-4 py-2 border-b border-gray-200 dark:border-gray-700 bg-gray-100 dark:bg-gray-800/50",children:h.jsxs("div",{"data-codepal-ve-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:div:483:57","data-codepal-binding-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:div:483:57","data-codepal-module-id":"src-pages-project-messagelist-attachmentitem-tsx","data-codepal-component-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem","data-codepal-source-node-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:div:483:57","data-codepal-source-file":"src/pages/Project/MessageList/AttachmentItem.tsx","data-codepal-source-line":"483","data-codepal-source-column":"57","data-codepal-source-symbol":"AttachmentItem",className:"text-xs text-gray-500 dark:text-gray-400",children:[A(a.filename).toUpperCase()," ⢠",a.filename]})}),h.jsx("div",{"data-codepal-ve-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:div:487:53","data-codepal-binding-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:div:487:53","data-codepal-module-id":"src-pages-project-messagelist-attachmentitem-tsx","data-codepal-component-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem","data-codepal-source-node-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:div:487:53","data-codepal-source-file":"src/pages/Project/MessageList/AttachmentItem.tsx","data-codepal-source-line":"487","data-codepal-source-column":"53","data-codepal-source-symbol":"AttachmentItem",className:"flex-1 overflow-auto p-4",children:h.jsx("pre",{"data-codepal-ve-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:pre:488:57","data-codepal-binding-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:pre:488:57","data-codepal-module-id":"src-pages-project-messagelist-attachmentitem-tsx","data-codepal-component-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem","data-codepal-source-node-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:pre:488:57","data-codepal-source-file":"src/pages/Project/MessageList/AttachmentItem.tsx","data-codepal-source-line":"488","data-codepal-source-column":"57","data-codepal-source-symbol":"AttachmentItem",className:"text-sm font-mono whitespace-pre-wrap text-gray-800 dark:text-gray-200 leading-relaxed",children:p||a.content})})]}):h.jsxs("div",{"data-codepal-ve-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:div:495:49","data-codepal-binding-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:div:495:49","data-codepal-module-id":"src-pages-project-messagelist-attachmentitem-tsx","data-codepal-component-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem","data-codepal-source-node-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:div:495:49","data-codepal-source-file":"src/pages/Project/MessageList/AttachmentItem.tsx","data-codepal-source-line":"495","data-codepal-source-column":"49","data-codepal-source-symbol":"AttachmentItem",className:"flex-1 flex flex-col items-center justify-center p-8 bg-gray-50 dark:bg-gray-900/30 rounded-md",children:[h.jsx("div",{"data-codepal-ve-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:div:497:53","data-codepal-binding-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:div:497:53","data-codepal-module-id":"src-pages-project-messagelist-attachmentitem-tsx","data-codepal-component-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem","data-codepal-source-node
84-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:div:497:53","data-codepal-source-file":"src/pages/Project/MessageList/AttachmentItem.tsx","data-codepal-source-line":"497","data-codepal-source-column":"53","data-codepal-source-symbol":"AttachmentItem",className:"w-12 h-12 mb-4 text-gray-500 dark:text-gray-400 flex items-center justify-center",children:Fs.cloneElement(D(),{className:"w-8 h-8"})}),h.jsx("p",{"data-codepal-ve-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:p:501:53","data-codepal-binding-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:p:501:53","data-codepal-module-id":"src-pages-project-messagelist-attachmentitem-tsx","data-codepal-component-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem","data-codepal-source-node-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:p:501:53","data-codepal-source-file":"src/pages/Project/MessageList/AttachmentItem.tsx","data-codepal-source-line":"501","data-codepal-source-column":"53","data-codepal-source-symbol":"AttachmentItem",className:"text-gray-600 dark:text-gray-300 mb-4 text-center",children:"No content available for preview"}),a.presigned_url&&h.jsxs("button",{"data-codepal-ve-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:button:505:57","data-codepal-binding-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:button:505:57","data-codepal-module-id":"src-pages-project-messagelist-attachmentitem-tsx","data-codepal-component-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem","data-codepal-source-node-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:button:505:57","data-codepal-source-file":"src/pages/Project/MessageList/AttachmentItem.tsx","data-codepal-source-line":"505","data-codepal-source-column":"57","data-codepal-source-symbol":"AttachmentItem",className:`flex items-center gap-2 px-4 py-2 bg-blue-100 hover:bg-blue-200 dark:bg-blue-800/40 85 dark:hover:bg-blue-800/60 text-blue-700 dark:text-blue-300 rounded-md transition-colors`,onClick:()=>window.open(a.presigned_url,"_blank"),children:[h.jsx(ko,{className:"w-4 h-4"}),h.jsx("span",{"data-codepal-ve-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:span:511:61","data-codepal-binding-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:span:511:61","data-codepal-module-id":"src-pages-project-messagelist-attachmentitem-tsx","data-codepal-component-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem","data-codepal-source-node-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:span:511:61","data-codepal-source-file":"src/pages/Project/MessageList/AttachmentItem.tsx","data-codepal-source-line":"511","data-codepal-source-column":"61","data-codepal-source-symbol":"AttachmentItem",children:"View file in new tab"})]})]})}),a.presigned_url&&!y&&!k&&!S()&&h.jsxs("div",{"data-codepal-ve-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:div:521:41","data-codepal-binding-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:div:521:41","data-codepal-module-id":"src-pages-project-messagelist-attachmentitem-tsx","data-codepal-component-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem","data-codepal-source-node-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:div:521:41","data-codepal-source-file":"src/pages/Project/MessageList/AttachmentItem.tsx","data-codepal-source-line":"521","data-codepal-source-column":"41","data-codepal-source-symbol":"AttachmentItem",className:"h-full flex flex-col items-center justify-center p-8 bg-gray-50 dark:bg-gray-900/30 rounded-md",children:[h.jsx("div",{"data-codepal-ve-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:div:523:45","data-codepal-binding-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:div:523:45","data-codepal-module-id":"src-pages-project-messagelist-attachmentitem-tsx","data-codepal-component-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem","data-codepal-source-node
85-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:div:523:45","data-codepal-source-file":"src/pages/Project/MessageList/AttachmentItem.tsx","data-codepal-source-line":"523","data-codepal-source-column":"45","data-codepal-source-symbol":"AttachmentItem",className:"w-12 h-12 mb-4 text-gray-500 dark:text-gray-400 flex items-center justify-center",children:Fs.cloneElement(D(),{className:"w-8 h-8"})}),h.jsx("p",{"data-codepal-ve-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:p:527:45","data-codepal-binding-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:p:527:45","data-codepal-module-id":"src-pages-project-messagelist-attachmentitem-tsx","data-codepal-component-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem","data-codepal-source-node-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:p:527:45","data-codepal-source-file":"src/pages/Project/MessageList/AttachmentItem.tsx","data-codepal-source-line":"527","data-codepal-source-column":"45","data-codepal-source-symbol":"AttachmentItem",className:"text-gray-600 dark:text-gray-300 mb-4 text-center",children:"File available for download"}),h.jsxs("button",{"data-codepal-ve-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:button:530:45","data-codepal-binding-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:button:530:45","data-codepal-module-id":"src-pages-project-messagelist-attachmentitem-tsx","data-codepal-component-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem","data-codepal-source-node-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:button:530:45","data-codepal-source-file":"src/pages/Project/MessageList/AttachmentItem.tsx","data-codepal-source-line":"530","data-codepal-source-column":"45","data-codepal-source-symbol":"AttachmentItem",className:`flex items-center gap-2 px-4 py-2 bg-blue-100 hover:bg-blue-200 dark:bg-blue-800/40 86 dark:hover:bg-blue-800/60 text-blue-700 dark:text-blue-300 rounded-md transition-colors`,onClick:()=>window.open(a.presigned_url,"_blank"),children:[h.jsx(ko,{className:"w-4 h-4"}),h.jsx("span",{"data-codepal-ve-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:span:536:49","data-codepal-binding-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:span:536:49","data-codepal-module-id":"src-pages-project-messagelist-attachmentitem-tsx","data-codepal-component-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem","data-codepal-source-node-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:span:536:49","data-codepal-source-file":"src/pages/Project/MessageList/AttachmentItem.tsx","data-codepal-source-line":"536","data-codepal-source-column":"49","data-codepal-source-symbol":"AttachmentItem",children:"View file in new tab"})]})]}),!K&&h.jsxs("div",{"data-codepal-ve-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:div:543:41","data-codepal-binding-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:div:543:41","data-codepal-module-id":"src-pages-project-messagelist-attachmentitem-tsx","data-codepal-component-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem","data-codepal-source-node-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:div:543:41","data-codepal-source-file":"src/pages/Project/MessageList/AttachmentItem.tsx","data-codepal-source-line":"543","data-codepal-source-column":"41","data-codepal-source-symbol":"AttachmentItem",className:"h-full flex flex-col items-center justify-center p-8 bg-gray-50 dark:bg-gray-900/30 rounded-md",children:[h.jsx(_i,{className:"w-12 h-12 mb-4 text-gray-500 dark:text-gray-400"}),h.jsx("p",{"data-codepal-ve-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:p:546:45","data-codepal-binding-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:p:546:45","data-codepal-module-id":"src-pages-project-messagelist-attachmentitem-tsx","data-codepal-component-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem","data-codepal-source-node
86-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:p:546:45","data-codepal-source-file":"src/pages/Project/MessageList/AttachmentItem.tsx","data-codepal-source-line":"546","data-codepal-source-column":"45","data-codepal-source-symbol":"AttachmentItem",className:"text-gray-600 dark:text-gray-300 mb-2 text-center",children:"This file cannot be previewed"}),h.jsxs("p",{"data-codepal-ve-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:p:549:45","data-codepal-binding-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:p:549:45","data-codepal-module-id":"src-pages-project-messagelist-attachmentitem-tsx","data-codepal-component-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem","data-codepal-source-node-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:p:549:45","data-codepal-source-file":"src/pages/Project/MessageList/AttachmentItem.tsx","data-codepal-source-line":"549","data-codepal-source-column":"45","data-codepal-source-symbol":"AttachmentItem",className:"text-gray-500 dark:text-gray-400 text-sm text-center",children:["File type: ",a.mime_type||a.media_type]})]})]})}),r&&h.jsxs("div",{"data-codepal-ve-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:div:559:33","data-codepal-binding-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:div:559:33","data-codepal-module-id":"src-pages-project-messagelist-attachmentitem-tsx","data-codepal-component-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem","data-codepal-source-node-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:div:559:33","data-codepal-source-file":"src/pages/Project/MessageList/AttachmentItem.tsx","data-codepal-source-line":"559","data-codepal-source-column":"33","data-codepal-source-symbol":"AttachmentItem",className:"w-1/3 border-l border-gray-200 dark:border-gray-700 bg-gradient-to-b from-slate-50 to-slate-100 dark:from-gray-800/50 dark:to-gray-900/50 backdrop-blur-sm overflow-auto",children:[h.jsx("div",{"data-codepal-ve-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:div:562:37","data-codepal-binding-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:div:562:37","data-codepal-module-id":"src-pages-project-messagelist-attachmentitem-tsx","data-codepal-component-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem","data-codepal-source-node-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:div:562:37","data-codepal-source-file":"src/pages/Project/MessageList/AttachmentItem.tsx","data-codepal-source-line":"562","data-codepal-source-column":"37","data-codepal-source-symbol":"AttachmentItem",className:"sticky top-0 bg-white/80 dark:bg-gray-800/80 backdrop-blur-md border-b border-gray-200 dark:border-gray-700 px-6 py-4",children:h.jsxs("div",{"data-codepal-ve-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:div:564:41","data-codepal-binding-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:div:564:41","data-codepal-module-id":"src-pages-project-messagelist-attachmentitem-tsx","data-codepal-component-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem","data-codepal-source-node-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:div:564:41","data-codepal-source-file":"src/pages/Project/MessageList/AttachmentItem.tsx","data-codepal-source-line":"564","data-codepal-source-column":"41","data-codepal-source-symbol":"AttachmentItem",className:"flex items-center gap-3",children:[h.jsx("div",{"data-codepal-ve-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:div:565:45","data-codepal-binding-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:div:565:45","data-codepal-module-id":"src-pages-project-messagelist-attachmentitem-tsx","data-codepal-component-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem","data-codepal-source-node-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:div:565:45","data-codepal-source-file":"src/pages/Project/MessageList/AttachmentItem.tsx","data-codepal-source-line":"565","data-codepal-source-column":"45","data-codepal-source-symbol":"AttachmentItem",className:"w-8 h-8 rounded-lg bg-blue-100 dar
86k:bg-blue-900/40 flex items-center justify-center",children:h.jsx(Es,{className:"w-4 h-4 text-blue-600 dark:text-blue-400"})}),h.jsxs("div",{"data-codepal-ve-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:div:569:45","data-codepal-binding-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:div:569:45","data-codepal-module-id":"src-pages-project-messagelist-attachmentitem-tsx","data-codepal-component-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem","data-codepal-source-node-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:div:569:45","data-codepal-source-file":"src/pages/Project/MessageList/AttachmentItem.tsx","data-codepal-source-line":"569","data-codepal-source-column":"45","data-codepal-source-symbol":"AttachmentItem",children:[h.jsx("h4",{"data-codepal-ve-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:h4:570:49","data-codepal-binding-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:h4:570:49","data-codepal-module-id":"src-pages-project-messagelist-attachmentitem-tsx","data-codepal-component-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem","data-codepal-source-node-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:h4:570:49","data-codepal-source-file":"src/pages/Project/MessageList/AttachmentItem.tsx","data-codepal-source-line":"570","data-codepal-source-column":"49","data-codepal-source-symbol":"AttachmentItem",className:"text-sm font-semibold text-gray-900 dark:text-gray-100",children:"File Information"}),h.jsx("p",{"data-codepal-ve-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:p:573:49","data-codepal-binding-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:p:573:49","data-codepal-module-id":"src-pages-project-messagelist-attachmentitem-tsx","data-codepal-component-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem","data-codepal-source-node-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:p:573:49","data-codepal-source-file":"src/pages/Project/MessageList/AttachmentItem.tsx","data-codepal-source-line":"573","data-codepal-source-column":"49","data-codepal-source-symbol":"AttachmentItem",className:"text-xs text-gray-500 dark:text-gray-400",children:"Detailed metadata"})]})]})}),h.jsxs("div",{"data-codepal-ve-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:div:581:37","data-codepal-binding-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:div:581:37","data-codepal-module-id":"src-pages-project-messagelist-attachmentitem-tsx","data-codepal-component-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem","data-codepal-source-node-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:div:581:37","data-codepal-source-file":"src/pages/Project/MessageList/AttachmentItem.tsx","data-codepal-source-line":"581","data-codepal-source-column":"37","data-codepal-source-symbol":"AttachmentItem",className:"p-6 space-y-4",children:[j().map((T,O)=>h.jsxs("div",{"data-codepal-ve-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:div:583:45","data-codepal-binding-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:div:583:45","data-codepal-module-id":"src-pages-project-messagelist-attachmentitem-tsx","data-codepal-component-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem","data-codepal-source-node-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:div:583:45","data-codepal-source-file":"src/pages/Project/MessageList/AttachmentItem.tsx","data-codepal-source-line":"583","data-codepal-source-column":"45","data-codepal-source-symbol":"AttachmentItem",className:"group",children:[h.jsxs("div",{"data-codepal-ve-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:div:584:49","data-codepal-binding-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:div:584:49","data-codepal-module-id":"src-pages-project-messagelist-attachmentitem-tsx","data-codepal-component-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem","data-codepal-source-node
86-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:div:584:49","data-codepal-source-file":"src/pages/Project/MessageList/AttachmentItem.tsx","data-codepal-source-line":"584","data-codepal-source-column":"49","data-codepal-source-symbol":"AttachmentItem",className:"flex items-center gap-2 mb-2",children:[h.jsx("div",{"data-codepal-ve-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:div:585:53","data-codepal-binding-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:div:585:53","data-codepal-module-id":"src-pages-project-messagelist-attachmentitem-tsx","data-codepal-component-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem","data-codepal-source-node-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:div:585:53","data-codepal-source-file":"src/pages/Project/MessageList/AttachmentItem.tsx","data-codepal-source-line":"585","data-codepal-source-column":"53","data-codepal-source-symbol":"AttachmentItem",className:"w-1.5 h-1.5 rounded-full bg-blue-500 opacity-60"}),h.jsx("label",{"data-codepal-ve-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:label:587:53","data-codepal-binding-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:label:587:53","data-codepal-module-id":"src-pages-project-messagelist-attachmentitem-tsx","data-codepal-component-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem","data-codepal-source-node-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:label:587:53","data-codepal-source-file":"src/pages/Project/MessageList/AttachmentItem.tsx","data-codepal-source-line":"587","data-codepal-source-column":"53","data-codepal-source-symbol":"AttachmentItem",className:"text-xs font-medium text-gray-600 dark:text-gray-400 uppercase tracking-wide",children:T.label})]}),h.jsx("div",{"data-codepal-ve-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:div:592:49","data-codepal-binding-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:div:592:49","data-codepal-module-id":"src-pages-project-messagelist-attachmentitem-tsx","data-codepal-component-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem","data-codepal-source-node-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:div:592:49","data-codepal-source-file":"src/pages/Project/MessageList/AttachmentItem.tsx","data-codepal-source-line":"592","data-codepal-source-column":"49","data-codepal-source-symbol":"AttachmentItem",className:"ml-3.5 p-3 rounded-lg bg-white dark:bg-gray-800/60 border border-gray-200 dark:border-gray-700 shadow-sm group-hover:shadow-md transition-shadow",children:h.jsx("div",{"data-codepal-ve-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:div:594:53","data-codepal-binding-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:div:594:53","data-codepal-module-id":"src-pages-project-messagelist-attachmentitem-tsx","data-codepal-component-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem","data-codepal-source-node-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:div:594:53","data-codepal-source-file":"src/pages/Project/MessageList/AttachmentItem.tsx","data-codepal-source-line":"594","data-codepal-source-column":"53","data-codepal-source-symbol":"AttachmentItem",className:"text-sm font-mono text-gray-800 dark:text-gray-200 break-all leading-relaxed",children:T.value})})]},O)),h.jsx("div",{"data-codepal-ve-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:div:603:41","data-codepal-binding-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:div:603:41","data-codepal-module-id":"src-pages-project-messagelist-attachmentitem-tsx","data-codepal-component-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem","data-codepal-source-node-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:div:603:41","data-codepal-source-file":"src/pages/Project/MessageList/AttachmentItem.tsx","data-codepal-source-line":"603","data-codepal-source-column":"41","data-codepal-source-symbol":"AttachmentItem",className:"mt-6 pt-4 border-t border-gray-200 dark:border-gray-700",children:h.jsxs("div",{"data-codepal-ve-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:div:604:45","data-codepal-binding-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:div:604:45","data-codepal-module-id":"src-pages-project-messagelist-attachmentitem-tsx","data-codepal-component-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem","data-codepal-source-node
86-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:div:604:45","data-codepal-source-file":"src/pages/Project/MessageList/AttachmentItem.tsx","data-codepal-source-line":"604","data-codepal-source-column":"45","data-codepal-source-symbol":"AttachmentItem",className:"flex items-center gap-2 text-xs text-gray-500 dark:text-gray-400",children:[h.jsx("div",{"data-codepal-ve-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:div:606:49","data-codepal-binding-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:div:606:49","data-codepal-module-id":"src-pages-project-messagelist-attachmentitem-tsx","data-codepal-component-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem","data-codepal-source-node-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:div:606:49","data-codepal-source-file":"src/pages/Project/MessageList/AttachmentItem.tsx","data-codepal-source-line":"606","data-codepal-source-column":"49","data-codepal-source-symbol":"AttachmentItem",className:"w-3 h-3 rounded-full bg-green-500 opacity-60"}),h.jsx("span",{"data-codepal-ve-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:span:607:49","data-codepal-binding-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:span:607:49","data-codepal-module-id":"src-pages-project-messagelist-attachmentitem-tsx","data-codepal-component-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem","data-codepal-source-node-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:span:607:49","data-codepal-source-file":"src/pages/Project/MessageList/AttachmentItem.tsx","data-codepal-source-line":"607","data-codepal-source-column":"49","data-codepal-source-symbol":"AttachmentItem",children:"File analysis complete"})]})})]})]})]}),h.jsx("div",{"data-codepal-ve-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:div:616:25","data-codepal-binding-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:div:616:25","data-codepal-module-id":"src-pages-project-messagelist-attachmentitem-tsx","data-codepal-component-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem","data-codepal-source-node-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:div:616:25","data-codepal-source-file":"src/pages/Project/MessageList/AttachmentItem.tsx","data-codepal-source-line":"616","data-codepal-source-column":"25","data-codepal-source-symbol":"AttachmentItem",className:"border-t border-gray-200 dark:border-gray-700 px-4 py-3 flex justify-end items-center flex-shrink-0",children:h.jsxs("div",{"data-codepal-ve-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:div:618:29","data-codepal-binding-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:div:618:29","data-codepal-module-id":"src-pages-project-messagelist-attachmentitem-tsx","data-codepal-component-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem","data-codepal-source-node-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:div:618:29","data-codepal-source-file":"src/pages/Project/MessageList/AttachmentItem.tsx","data-codepal-source-line":"618","data-codepal-source-column":"29","data-codepal-source-symbol":"AttachmentItem",className:"flex gap-3",children:[h.jsx("button",{"data-codepal-ve-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:button:619:33","data-codepal-binding-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:button:619:33","data-codepal-module-id":"src-pages-project-messagelist-attachmentitem-tsx","data-codepal-component-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem","data-codepal-source-node-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:button:619:33","data-codepal-source-file":"src/pages/Project/MessageList/AttachmentItem.tsx","data-codepal-source-line":"619","data-codepal-source-column":"33","data-codepal-source-symbol":"AttachmentItem",className:`px-4 py-2 text-sm bg-gray-100 hover:bg-gray-200 dark:bg-gray-700 dark:hover:bg-gray-600 87 text-gray-800 dark:text-gray-200 rounded-lg transition-all duration-200 font-medium 88 hover:shadow-sm active:scale-95`,onClick:T=>{T.stopPropagation(),B()},children:"Close"}),K&&h.jsxs("button",{"data-codepal-ve-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:button:631:37","data-codepal-binding-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:button:631:37","data-codepal-module-id":"src-pages-project-messagelist-attachmentitem-tsx","data-codepal-component-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem","data-codepal-source-node
88-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:button:631:37","data-codepal-source-file":"src/pages/Project/MessageList/AttachmentItem.tsx","data-codepal-source-line":"631","data-codepal-source-column":"37","data-codepal-source-symbol":"AttachmentItem",className:`px-4 py-2 text-sm bg-gradient-to-r from-blue-600 to-blue-700 hover:from-blue-700 hover:to-blue-800 89 text-white rounded-lg transition-all duration-200 flex items-center gap-2 font-medium 90 shadow-sm hover:shadow-md active:scale-95 disabled:opacity-50 disabled:cursor-not-allowed`,onClick:T=>{T.stopPropagation(),L(T)},disabled:!a.presigned_url&&(!b||!a.content),children:[h.jsx(Si,{className:"w-4 h-4"}),h.jsx("span",{"data-codepal-ve-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:span:642:41","data-codepal-binding-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:span:642:41","data-codepal-module-id":"src-pages-project-messagelist-attachmentitem-tsx","data-codepal-component-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem","data-codepal-source-node-id":"src-pages-project-messagelist-attachmentitem-tsx:attachmentitem:span:642:41","data-codepal-source-file":"src/pages/Project/MessageList/AttachmentItem.tsx","data-codepal-source-line":"642","data-codepal-source-column":"41","data-codepal-source-symbol":"AttachmentItem",children:"Download"})]})]})})]})})]})}),Jv=E.memo(()=>{const a=[0,1,2];return h.jsx("span",{"data-codepal-ve-id":"src-pages-project-messagelist-inlinetypingindicator-tsx:inlinetypingindicator:span:8:9","data-codepal-binding-id":"src-pages-project-messagelist-inlinetypingindicator-tsx:inlinetypingindicator:span:8:9","data-codepal-module-id":"src-pages-project-messagelist-inlinetypingindicator-tsx","data-codepal-component-id":"src-pages-project-messagelist-inlinetypingindicator-tsx:inlinetypingindicator","data-codepal-source-node-id":"src-pages-project-messagelist-inlinetypingindicator-tsx:inlinetypingindicator:span:8:9","data-codepal-source-file":"src/pages/Project/MessageList/InlineTypingIndicator.tsx","data-codepal-source-line":"8","data-codepal-source-column":"9","data-codepal-source-symbol":"InlineTypingIndicator",className:"inline-flex items-center align-middle h-3 ml-1",children:a.map(e=>h.jsx(Ze.span,{className:"w-1 h-1 bg-gray-400 dark:bg-gray-500 rounded-full ml-1 first:ml-0",animate:{scale:[1,1.3,1],opacity:[.3,1,.3]},transition:{duration:1.2,repeat:1/0,ease:"easeInOut",delay:e*.4}},e))})}),Zv=E.memo(({artifact:a,isStreaming:e,hasBottomContent:t})=>{const s=E.useRef(null),[o,r]=E.useState(0),i=E.useRef(0),n=E.useRef(null),c=E.useRef(new Set),l=je(I=>I.setActiveFile);ge(I=>I.isSendingMessage);const d=ge(I=>I.activeStreamingMessageId),p=ge(I=>I.currentlyStreamingFile),u=a?.files,f=E.useMemo(()=>u?.filter(I=>I.file_status==="new"||I.isNew===!0)||[],[u]),m=E.useMemo(()=>u?.filter(I=>I.file_status==="modified")||[],[u]),g=E.useMemo(()=>[...f,...m],[f,m]),x=a?.deleted_files,b=E.useCallback(I=>I.split("/").pop(),[]),y=E.useMemo(()=>{if(a?.partial_file){const I=a.partial_file.match(/path="([^"]+)"/);if(I&&I[1]){const X=a.partial_file.includes('file_status="new"')||a.partial_file.toLowerCase().includes("creating")||a.partial_file.includes('isNew="true"')||a.partial_file.includes('"isNew":true'),T=a.partial_file.includes('wasCompleteFile="true"')||a.partial_file.includes('"wasCompleteFile":true')||a.partial_file.toLowerCase().includes("updating");return{path:I[1],isNew:X,wasCompleteFile:T}}}return a?.currentlyStreamingFile?{path:a.currentlyStreamingFile.path,isNew:a.currentlyStreamingFile.isNew===!0,wasCompleteFile:a.currentlyStreamingFile.wasCompleteFile===!0}:null},[a]),k=E.useMemo(()=>g.length>0?g.map(I=>I.path):y&&!g.some(I=>I.path===y.path)?[y.path]:[],[g,y]),A=k.length+(y&&!k.includes(y.path)?1:0);E.useEffect(()=>{d&&d!==n.current&&(n.current=d,c.current=new Set)},[d]);const[S,N]=E.useState(!1),D=E.useMemo(()=>{if(!e)return!1;const I=y!==null||a?.partial_file||p!==null||u?.some(X=>X.isPartial===!0||X.isLastFile===!0);return I?!0:g.length>0&&!I?!1:e},[e,y,a?.partial_file,p,u,g]);E.useEffect(()=>{const I=setTimeout(()=>{N(D)},50);return()=>clearTimeout(I)},[D]),E.useEffect(()=>
90{k.forEach(I=>{c.current.has(I)||c.current.add(I)}),y&&!c.current.has(y.path)&&c.current.add(y.path),D||ge.getState().setIsCurrentFileMessageProcessing(null),i.current=A},[A,D,k,y]);const L=E.useCallback((I,X)=>{const T=b(I);return X.some(O=>O!==I&&b(O)===T)},[b]),M=E.useCallback(I=>{if(!D)return!1;if(p?.path===I)return!0;const X=u?.find(T=>T.path===I);return X?X.isPartial===!0||X.isLastFile===!0||X.isNew===!0:y&&y.path===I},[D,p,u,y]),B=E.useCallback(I=>{!M(I)&&I&&(l(I),setTimeout(()=>{je.getState().setFileToScrollIntoView(I)},50))},[M,l]),V=E.useCallback(I=>I.split(".").pop()?.toLowerCase()||"",[]),P=E.useCallback(I=>{switch(V(I)){case"js":case"jsx":case"ts":case"tsx":return h.jsx(An,{className:"w-3.5 h-3.5"});case"json":return h.jsx(sp,{className:"w-3.5 h-3.5"});case"html":case"htm":case"xml":case"svg":return h.jsx(Da,{className:"w-3.5 h-3.5"});case"css":case"scss":case"sass":case"less":return h.jsx(Da,{className:"w-3.5 h-3.5"});case"png":case"jpg":case"jpeg":case"gif":case"webp":return h.jsx(qd,{className:"w-3.5 h-3.5"});case"md":case"txt":return h.jsx(Da,{className:"w-3.5 h-3.5"});case"csv":case"xls":case"xlsx":return h.jsx(Gd,{className:"w-3.5 h-3.5"});case"zip":case"tar":case"gz":return h.jsx(Kd,{className:"w-3.5 h-3.5"});default:return h.jsx(_i,{className:"w-3.5 h-3.5"})}},[V]),F=E.useMemo(()=>S?{bg:"bg-indigo-50/80 dark:bg-indigo-950/30",border:"border-indigo-100 dark:border-indigo-800/50",text:"text-indigo-700 dark:text-indigo-300",subtext:"text-indigo-600/80 dark:text-indigo-400/80",icon:"text-indigo-500 dark:text-indigo-400",accent:"bg-indigo-500 dark:bg-indigo-400",progressBg:"bg-indigo-100 dark:bg-indigo-900/50"}:{bg:"bg-emerald-50/80 dark:bg-emerald-950/30",border:"border-emerald-100 dark:border-emerald-800/50",text:"text-emerald-700 dark:text-emerald-300",subtext:"text-emerald-600/80 dark:text-emerald-400/80",icon:"text-emerald-500 dark:text-emerald-400",accent:"bg-emerald-500 dark:bg-emerald-400",progressBg:"bg-emerald-100 dark:bg-emerald-900/50"},[S]),j=E.useMemo(()=>({initial:{opacity:0,y:-5},animate:{opacity:1,y:0,transition:{duration:.3,ease:[.4,0,.2,1]}},exit:{opacity:0,y:5,transition:{duration:.2,ease:[.4,0,1,1]}}}),[]),z=E.useMemo(()=>({initial:{width:"0%"},animate:{width:"100%",transition:{duration:7,ease:[.4,0,.2,1]}}}),[]),ce=E.useMemo(()=>({initial:{scale:.95,opacity:0},animate:{scale:1,opacity:1,transition:{type:"spring",stiffness:400,damping:20}}}),[]),$=k.length>0||y&&!k.includes(y.path)||x&&x.length>0,K=E.useCallback((I,X)=>{const T=M(I),O=u?.find(se=>se.path===I),oe=L(I,k)?I:b(I);return h.jsxs(Ze.div,{className:ie("flex items-center rounded-sm px-2 py-1","cursor-pointer hover:bg-gray-100/50 dark:hover:bg-gray-800/50 transition-colors",T?"opacity-70":""),onClick:()=>B(I),title:`Click to open ${I}`,initial:{opacity:0,x:-5},animate:{opacity:1,x:0},transition:{delay:X*.03},children:[h.jsx("div",{"data-codepal-ve-id":"src-pages-project-messagelist-artifactstatus-tsx:renderfileitem:div:386:17","data-codepal-binding-id":"src-pages-project-messagelist-artifactstatus-tsx:renderfileitem:div:386:17","data-codepal-module-id":"src-pages-project-messagelist-artifactstatus-tsx","data-codepal-component-id":"src-pages-project-messagelist-artifactstatus-tsx:renderfileitem","data-codepal-source-node-id":"src-pages-project-messagelist-artifactstatus-tsx:renderfileitem:div:386:17","data-codepal-source-file":"src/pages/Project/MessageList/ArtifactStatus.tsx","data-codepal-source-line":"386","data-codepal-source-column":"17","data-codepal-source-symbol":"renderFileItem",className:ie("mr-2 flex-shrink-0",F.icon),children:P(I)}),h.jsx("div",{"data-codepal-ve-id":"src-pages-project-messagelist-artifactstatus-tsx:renderfileitem:div:391:17","data-codepal-binding-id":"src-pages-project-messagelist-artifactstatus-tsx:renderfileitem:div:391:17","data-codepal-module-id":"src-pages-project-messagelist-artifactstatus-tsx","data-codepal-component-id":"src-pages-project-messagelist-artifactstatus-tsx:renderfileitem","data-codepal-source-node-id":"src-pages-project-messagelist-artifactstatus-tsx:renderfileitem:div:391:17","data-codepal-source-file":"src/pages/Project/MessageList/ArtifactStatus.tsx","data-codepal-source-line":"391","data-codepal-source-column":"17","data-codepal-source-symbol":"renderFileItem",className:"flex-grow min-w-0",children:h.jsx("div",{"data-codepal-ve-id":"src-pages-project-messagelist-artifactstatus-tsx:renderfileitem:div:392:21","data-codepal-binding-id":"src-pages-project-messagelist-artifactstatus-tsx:renderfileitem:div:392:21","data-codepal-module-id":"src-pages-project-messagelist-artifactstatus-tsx","data-codepal-component-id":"src-pages-project-messagelist-artifactstatus-tsx:renderfileitem","data-codepal-source-node
90-id":"src-pages-project-messagelist-artifactstatus-tsx:renderfileitem:div:392:21","data-codepal-source-file":"src/pages/Project/MessageList/ArtifactStatus.tsx","data-codepal-source-line":"392","data-codepal-source-column":"21","data-codepal-source-symbol":"renderFileItem",className:ie("text-xs font-mono truncate max-w-full",F.text),children:oe})}),h.jsx("div",{"data-codepal-ve-id":"src-pages-project-messagelist-artifactstatus-tsx:renderfileitem:div:401:17","data-codepal-binding-id":"src-pages-project-messagelist-artifactstatus-tsx:renderfileitem:div:401:17","data-codepal-module-id":"src-pages-project-messagelist-artifactstatus-tsx","data-codepal-component-id":"src-pages-project-messagelist-artifactstatus-tsx:renderfileitem","data-codepal-source-node-id":"src-pages-project-messagelist-artifactstatus-tsx:renderfileitem:div:401:17","data-codepal-source-file":"src/pages/Project/MessageList/ArtifactStatus.tsx","data-codepal-source-line":"401","data-codepal-source-column":"17","data-codepal-source-symbol":"renderFileItem",className:"ml-2 flex-shrink-0",children:T?h.jsx(Ze.div,{className:"flex items-center",animate:{opacity:[.5,1,.5],scale:[.95,1,.95]},transition:{duration:2,repeat:1/0,ease:"easeInOut"},children:h.jsx("div",{"data-codepal-ve-id":"src-pages-project-messagelist-artifactstatus-tsx:renderfileitem:div:415:29","data-codepal-binding-id":"src-pages-project-messagelist-artifactstatus-tsx:renderfileitem:div:415:29","data-codepal-module-id":"src-pages-project-messagelist-artifactstatus-tsx","data-codepal-component-id":"src-pages-project-messagelist-artifactstatus-tsx:renderfileitem","data-codepal-source-node-id":"src-pages-project-messagelist-artifactstatus-tsx:renderfileitem:div:415:29","data-codepal-source-file":"src/pages/Project/MessageList/ArtifactStatus.tsx","data-codepal-source-line":"415","data-codepal-source-column":"29","data-codepal-source-symbol":"renderFileItem",className:ie("w-1.5 h-1.5 rounded-full",F.accent)})}):h.jsx(Ze.div,{className:ie("rounded-sm px-1.5 py-0.5",O?.file_status==="new"||O?.isNew===!0?"bg-blue-100 dark:bg-blue-900/30":O?.file_status==="modified"?"bg-amber-100 dark:bg-amber-900/30":O?.file_status==="deleted"?"bg-red-100 dark:bg-red-900/30":O?.file_status==="unchanged"?"bg-gray-100 dark:bg-gray-900/30":"bg-amber-100 dark:bg-amber-900/30"),variants:ce,initial:"initial",animate:"animate",children:h.jsx("span",{"data-codepal-ve-id":"src-pages-project-messagelist-artifactstatus-tsx:renderfileitem:span:435:29","data-codepal-binding-id":"src-pages-project-messagelist-artifactstatus-tsx:renderfileitem:span:435:29","data-codepal-module-id":"src-pages-project-messagelist-artifactstatus-tsx","data-codepal-component-id":"src-pages-project-messagelist-artifactstatus-tsx:renderfileitem","data-codepal-source-node-id":"src-pages-project-messagelist-artifactstatus-tsx:renderfileitem:span:435:29","data-codepal-source-file":"src/pages/Project/MessageList/ArtifactStatus.tsx","data-codepal-source-line":"435","data-codepal-source-column":"29","data-codepal-source-symbol":"renderFileItem",className:ie("text-[9px] font-semibold uppercase",O?.file_status==="new"||O?.isNew===!0?"text-blue-700 dark:text-blue-400":O?.file_status==="modified"?"text-amber-700 dark:text-amber-400":O?.file_status==="deleted"?"text-red-700 dark:text-red-400":"text-gray-700 dark:text-gray-400"),children:O?.file_status==="new"||O?.isNew===!0?"new":O?.file_status==="modified"?"modified":O?.file_status==="deleted"?"deleted":"unchanged"})})})]},`${I}-${X}`)},[u,m,f,k,B,F,P,M,L,b,ce]);return!$&&!D?h.jsx(h.Fragment,{}):D&&k.length===0&&!y?h.jsx(h.Fragment,{}):h.jsx(Pi,{mode:"wait",children:h.jsxs(Ze.div,{className:ie("my-4 rounded-md overflow-hidden border shadow-sm",F.bg,F.border),variants:j,initial:"initial",animate:"animate",exit:"exit",style:{width:"100%"},children:[h.jsx("div",{"data-codepal-ve-id":"src-pages-project-messagelist-artifactstatus-tsx:artifactstatus:div:487:17","data-codepal-binding-id":"src-pages-project-messagelist-artifactstatus-tsx:artifactstatus:div:487:17","data-codepal-module-id":"src-pages-project-messagelist-artifactstatus-tsx","data-codepal-component-id":"src-pages-project-messagelist-artifactstatus-tsx:artifactstatus","data-codepal-source-node
90-id":"src-pages-project-messagelist-artifactstatus-tsx:artifactstatus:div:487:17","data-codepal-source-file":"src/pages/Project/MessageList/ArtifactStatus.tsx","data-codepal-source-line":"487","data-codepal-source-column":"17","data-codepal-source-symbol":"ArtifactStatus",className:"px-3 py-2 flex justify-between items-center border-b border-gray-100 dark:border-gray-800",children:h.jsxs("div",{"data-codepal-ve-id":"src-pages-project-messagelist-artifactstatus-tsx:artifactstatus:div:489:21","data-codepal-binding-id":"src-pages-project-messagelist-artifactstatus-tsx:artifactstatus:div:489:21","data-codepal-module-id":"src-pages-project-messagelist-artifactstatus-tsx","data-codepal-component-id":"src-pages-project-messagelist-artifactstatus-tsx:artifactstatus","data-codepal-source-node-id":"src-pages-project-messagelist-artifactstatus-tsx:artifactstatus:div:489:21","data-codepal-source-file":"src/pages/Project/MessageList/ArtifactStatus.tsx","data-codepal-source-line":"489","data-codepal-source-column":"21","data-codepal-source-symbol":"ArtifactStatus",className:"flex flex-col w-full",children:[h.jsxs("div",{"data-codepal-ve-id":"src-pages-project-messagelist-artifactstatus-tsx:artifactstatus:div:490:25","data-codepal-binding-id":"src-pages-project-messagelist-artifactstatus-tsx:artifactstatus:div:490:25","data-codepal-module-id":"src-pages-project-messagelist-artifactstatus-tsx","data-codepal-component-id":"src-pages-project-messagelist-artifactstatus-tsx:artifactstatus","data-codepal-source-node-id":"src-pages-project-messagelist-artifactstatus-tsx:artifactstatus:div:490:25","data-codepal-source-file":"src/pages/Project/MessageList/ArtifactStatus.tsx","data-codepal-source-line":"490","data-codepal-source-column":"25","data-codepal-source-symbol":"ArtifactStatus",className:"flex items-center",children:[h.jsx("h4",{"data-codepal-ve-id":"src-pages-project-messagelist-artifactstatus-tsx:artifactstatus:h4:491:29","data-codepal-binding-id":"src-pages-project-messagelist-artifactstatus-tsx:artifactstatus:h4:491:29","data-codepal-module-id":"src-pages-project-messagelist-artifactstatus-tsx","data-codepal-component-id":"src-pages-project-messagelist-artifactstatus-tsx:artifactstatus","data-codepal-source-node-id":"src-pages-project-messagelist-artifactstatus-tsx:artifactstatus:h4:491:29","data-codepal-source-file":"src/pages/Project/MessageList/ArtifactStatus.tsx","data-codepal-source-line":"491","data-codepal-source-column":"29","data-codepal-source-symbol":"ArtifactStatus",className:ie("text-xs font-medium",F.text),children:S?h.jsxs("div",{"data-codepal-ve-id":"src-pages-project-messagelist-artifactstatus-tsx:artifactstatus:div:493:37","data-codepal-binding-id":"src-pages-project-messagelist-artifactstatus-tsx:artifactstatus:div:493:37","data-codepal-module-id":"src-pages-project-messagelist-artifactstatus-tsx","data-codepal-component-id":"src-pages-project-messagelist-artifactstatus-tsx:artifactstatus","data-codepal-source-node-id":"src-pages-project-messagelist-artifactstatus-tsx:artifactstatus:div:493:37","data-codepal-source-file":"src/pages/Project/MessageList/ArtifactStatus.tsx","data-codepal-source-line":"493","data-codepal-source-column":"37","data-codepal-source-symbol":"ArtifactStatus",className:"flex items-center",children:[h.jsx(nr,{className:"w-3 h-3 mr-1.5 animate-spin"}),"Generating files..."]}):h.jsxs("div",{"data-codepal-ve-id":"src-pages-project-messagelist-artifactstatus-tsx:artifactstatus:div:498:37","data-codepal-binding-id":"src-pages-project-messagelist-artifactstatus-tsx:artifactstatus:div:498:37","data-codepal-module-id":"src-pages-project-messagelist-artifactstatus-tsx","data-codepal-component-id":"src-pages-project-messagelist-artifactstatus-tsx:artifactstatus","data-codepal-source-node-id":"src-pages-project-messagelist-artifactstatus-tsx:artifactstatus:div:498:37","data-codepal-source-file":"src/pages/Project/MessageList/ArtifactStatus.tsx","data-codepal-source-line":"498","data-codepal-source-column":"37","data-codepal-source-symbol":"ArtifactStatus",className:"flex items-center",children:[h.jsx(Ud,{className:"w-3 h-3 mr-1.5"}),"Files generated"]})}),h.jsxs("span",{"data-codepal-ve-id":"src-pages-project-messagelist-artifactstatus-tsx:artifactstatus:span:504:29","data-codepal-binding-id":"src-pages-project-messagelist-artifactstatus-tsx:artifactstatus:span:504:29","data-codepal-module-id":"src-pages-project-messagelist-artifactstatus-tsx","data-codepal-component-id":"src-pages-project-messagelist-artifactstatus-tsx:artifactstatus","data-codepal-source-node
90-id":"src-pages-project-messagelist-artifactstatus-tsx:artifactstatus:span:504:29","data-codepal-source-file":"src/pages/Project/MessageList/ArtifactStatus.tsx","data-codepal-source-line":"504","data-codepal-source-column":"29","data-codepal-source-symbol":"ArtifactStatus",className:ie("text-[10px] ml-auto font-medium uppercase tracking-wide opacity-80",F.subtext),children:[k.length+(y&&!k.includes(y.path)&&S?1:0)," file",k.length!==1?"s":""]})]}),S&&h.jsx("div",{"data-codepal-ve-id":"src-pages-project-messagelist-artifactstatus-tsx:artifactstatus:div:511:29","data-codepal-binding-id":"src-pages-project-messagelist-artifactstatus-tsx:artifactstatus:div:511:29","data-codepal-module-id":"src-pages-project-messagelist-artifactstatus-tsx","data-codepal-component-id":"src-pages-project-messagelist-artifactstatus-tsx:artifactstatus","data-codepal-source-node-id":"src-pages-project-messagelist-artifactstatus-tsx:artifactstatus:div:511:29","data-codepal-source-file":"src/pages/Project/MessageList/ArtifactStatus.tsx","data-codepal-source-line":"511","data-codepal-source-column":"29","data-codepal-source-symbol":"ArtifactStatus",className:ie("w-full h-1.5 mt-1.5 rounded-full overflow-hidden",F.progressBg),children:h.jsx(Ze.div,{className:ie("h-full rounded-full",F.accent),variants:z,initial:"initial",animate:"animate"},o)})]})}),h.jsx("div",{"data-codepal-ve-id":"src-pages-project-messagelist-artifactstatus-tsx:artifactstatus:div:526:17","data-codepal-binding-id":"src-pages-project-messagelist-artifactstatus-tsx:artifactstatus:div:526:17","data-codepal-module-id":"src-pages-project-messagelist-artifactstatus-tsx","data-codepal-component-id":"src-pages-project-messagelist-artifactstatus-tsx:artifactstatus","data-codepal-source-node-id":"src-pages-project-messagelist-artifactstatus-tsx:artifactstatus:div:526:17","data-codepal-source-file":"src/pages/Project/MessageList/ArtifactStatus.tsx","data-codepal-source-line":"526","data-codepal-source-column":"17","data-codepal-source-symbol":"ArtifactStatus",ref:s,className:"px-2 py-1.5 max-h-48 overflow-y-auto",children:h.jsxs("div",{"data-codepal-ve-id":"src-pages-project-messagelist-artifactstatus-tsx:artifactstatus:div:530:21","data-codepal-binding-id":"src-pages-project-messagelist-artifactstatus-tsx:artifactstatus:div:530:21","data-codepal-module-id":"src-pages-project-messagelist-artifactstatus-tsx","data-codepal-component-id":"src-pages-project-messagelist-artifactstatus-tsx:artifactstatus","data-codepal-source-node-id":"src-pages-project-messagelist-artifactstatus-tsx:artifactstatus:div:530:21","data-codepal-source-file":"src/pages/Project/MessageList/ArtifactStatus.tsx","data-codepal-source-line":"530","data-codepal-source-column":"21","data-codepal-source-symbol":"ArtifactStatus",className:"space-y-1",children:[k.map((I,X)=>
90K(I,X)),!S&&x&&x.length>0&&x.map((I,X)=>{if(X>0&&x.slice(0,X).some(Z=>Z.path===I.path))return null;const O=x.some((Z,oe)=>oe!==X&&b(Z.path)===b(I.path)&&Z.path!==I.path)?I.path:b(I.path);return h.jsxs(Ze.div,{className:"flex items-center rounded-sm px-2 py-1 opacity-80",initial:{opacity:0,x:-5},animate:{opacity:.8,x:0},transition:{delay:.05*(k.length+X)},children:[h.jsx("div",{"data-codepal-ve-id":"src-pages-project-messagelist-artifactstatus-tsx:artifactstatus:div:557:41","data-codepal-binding-id":"src-pages-project-messagelist-artifactstatus-tsx:artifactstatus:div:557:41","data-codepal-module-id":"src-pages-project-messagelist-artifactstatus-tsx","data-codepal-component-id":"src-pages-project-messagelist-artifactstatus-tsx:artifactstatus","data-codepal-source-node-id":"src-pages-project-messagelist-artifactstatus-tsx:artifactstatus:div:557:41","data-codepal-source-file":"src/pages/Project/MessageList/ArtifactStatus.tsx","data-codepal-source-line":"557","data-codepal-source-column":"41","data-codepal-source-symbol":"ArtifactStatus",className:"mr-2 flex-shrink-0 text-gray-400 dark:text-gray-500",children:P(I.path)}),h.jsx("div",{"data-codepal-ve-id":"src-pages-project-messagelist-artifactstatus-tsx:artifactstatus:div:562:41","data-codepal-binding-id":"src-pages-project-messagelist-artifactstatus-tsx:artifactstatus:div:562:41","data-codepal-module-id":"src-pages-project-messagelist-artifactstatus-tsx","data-codepal-component-id":"src-pages-project-messagelist-artifactstatus-tsx:artifactstatus","data-codepal-source-node-id":"src-pages-project-messagelist-artifactstatus-tsx:artifactstatus:div:562:41","data-codepal-source-file":"src/pages/Project/MessageList/ArtifactStatus.tsx","data-codepal-source-line":"562","data-codepal-source-column":"41","data-codepal-source-symbol":"ArtifactStatus",className:"flex-grow min-w-0",children:h.jsx("div",{"data-codepal-ve-id":"src-pages-project-messagelist-artifactstatus-tsx:artifactstatus:div:563:45","data-codepal-binding-id":"src-pages-project-messagelist-artifactstatus-tsx:artifactstatus:div:563:45","data-codepal-module-id":"src-pages-project-messagelist-artifactstatus-tsx","data-codepal-component-id":"src-pages-project-messagelist-artifactstatus-tsx:artifactstatus","data-codepal-source-node-id":"src-pages-project-messagelist-artifactstatus-tsx:artifactstatus:div:563:45","data-codepal-source-file":"src/pages/Project/MessageList/ArtifactStatus.tsx","data-codepal-source-line":"563","data-codepal-source-column":"45","data-codepal-source-symbol":"ArtifactStatus",className:"text-xs font-mono truncate max-w-full text-gray-500 dark:text-gray-400 line-through",children:O})}),h.jsx("div",{"data-codepal-ve-id":"src-pages-project-messagelist-artifactstatus-tsx:artifactstatus:div:570:41","data-codepal-binding-id":"src-pages-project-messagelist-artifactstatus-tsx:artifactstatus:div:570:41","data-codepal-module-id":"src-pages-project-messagelist-artifactstatus-tsx","data-codepal-component-id":"src-pages-project-messagelist-artifactstatus-tsx:artifactstatus","data-codepal-source-node-id":"src-pages-project-messagelist-artifactstatus-tsx:artifactstatus:div:570:41","data-codepal-source-file":"src/pages/Project/MessageList/ArtifactStatus.tsx","data-codepal-source-line":"570","data-codepal-source-column":"41","data-codepal-source-symbol":"ArtifactStatus",className:"ml-2 flex-shrink-0",children:h.jsx(Ze.div,{className:"rounded-sm px-1.5 py-0.5 bg-red-100 dark:bg-red-900/30",variants:ce,initial:"initial",animate:"animate",children:h.jsx("span",{"data-codepal-ve-id":"src-pages-project-messagelist-artifactstatus-tsx:artifactstatus:span:577:49","data-codepal-binding-id":"src-pages-project-messagelist-artifactstatus-tsx:artifactstatus:span:577:49","data-codepal-module-id":"src-pages-project-messagelist-artifactstatus-tsx","data-codepal-component-id":"src-pages-project-messagelist-artifactstatus-tsx:artifactstatus","data-codepal-source-node-id":"src-pages-project-messagelist-artifactstatus-tsx:artifactstatus:span:577:49","data-codepal-source-file":"src/pages/Project/MessageList/ArtifactStatus.tsx","data-codepal-source-line":"577","data-codepal-source-column":"49","data-codepal-source-symbol":"ArtifactStatus",className:"text-[9px] font-semibold uppercase text-red-700 dark:text-red-400",children:"deleted"})})})]},`deleted-${I.path}
90-${X}`)}),S&&y&&!k.includes(y.path)&&h.jsxs(Ze.div,{className:"flex items-center rounded-sm px-2 py-1 opacity-90",initial:{opacity:0,x:-5},animate:{opacity:.9,x:0},transition:{delay:.1},children:[h.jsx("div",{"data-codepal-ve-id":"src-pages-project-messagelist-artifactstatus-tsx:artifactstatus:div:597:33","data-codepal-binding-id":"src-pages-project-messagelist-artifactstatus-tsx:artifactstatus:div:597:33","data-codepal-module-id":"src-pages-project-messagelist-artifactstatus-tsx","data-codepal-component-id":"src-pages-project-messagelist-artifactstatus-tsx:artifactstatus","data-codepal-source-node-id":"src-pages-project-messagelist-artifactstatus-tsx:artifactstatus:div:597:33","data-codepal-source-file":"src/pages/Project/MessageList/ArtifactStatus.tsx","data-codepal-source-line":"597","data-codepal-source-column":"33","data-codepal-source-symbol":"ArtifactStatus",className:ie("mr-2 flex-shrink-0",F.icon),children:P(y.path)}),h.jsx("div",{"data-codepal-ve-id":"src-pages-project-messagelist-artifactstatus-tsx:artifactstatus:div:602:33","data-codepal-binding-id":"src-pages-project-messagelist-artifactstatus-tsx:artifactstatus:div:602:33","data-codepal-module-id":"src-pages-project-messagelist-artifactstatus-tsx","data-codepal-component-id":"src-pages-project-messagelist-artifactstatus-tsx:artifactstatus","data-codepal-source-node-id":"src-pages-project-messagelist-artifactstatus-tsx:artifactstatus:div:602:33","data-codepal-source-file":"src/pages/Project/MessageList/ArtifactStatus.tsx","data-codepal-source-line":"602","data-codepal-source-column":"33","data-codepal-source-symbol":"ArtifactStatus",className:"flex-grow min-w-0",children:h.jsx("div",{"data-codepal-ve-id":"src-pages-project-messagelist-artifactstatus-tsx:artifactstatus:div:603:37","data-codepal-binding-id":"src-pages-project-messagelist-artifactstatus-tsx:artifactstatus:div:603:37","data-codepal-module-id":"src-pages-project-messagelist-artifactstatus-tsx","data-codepal-component-id":"src-pages-project-messagelist-artifactstatus-tsx:artifactstatus","data-codepal-source-node-id":"src-pages-project-messagelist-artifactstatus-tsx:artifactstatus:div:603:37","data-codepal-source-file":"src/pages/Project/MessageList/ArtifactStatus.tsx","data-codepal-source-line":"603","data-codepal-source-column":"37","data-codepal-source-symbol":"ArtifactStatus",className:ie("text-xs font-mono truncate max-w-full",F.subtext),children:L(y.path,k)?y.path:b(y.path)})}),h.jsx("div",{"data-codepal-ve-id":"src-pages-project-messagelist-artifactstatus-tsx:artifactstatus:div:614:33","data-codepal-binding-id":"src-pages-project-messagelist-artifactstatus-tsx:artifactstatus:div:614:33","data-codepal-module-id":"src-pages-project-messagelist-artifactstatus-tsx","data-codepal-component-id":"src-pages-project-messagelist-artifactstatus-tsx:artifactstatus","data-codepal-source-node-id":"src-pages-project-messagelist-artifactstatus-tsx:artifactstatus:div:614:33","data-codepal-source-file":"src/pages/Project/MessageList/ArtifactStatus.tsx","data-codepal-source-line":"614","data-codepal-source-column":"33","data-codepal-source-symbol":"ArtifactStatus",className:"ml-2 flex-shrink-0",children:h.jsx(Ze.div,{className:"flex items-center",animate:{opacity:[.5,1,.5],scale:[.95,1,.95]},transition:{duration:1.5,repeat:1/0,ease:"easeInOut"},children:h.jsx(nr,{className:ie("w-3 h-3 animate-spin",F.icon)})})})]})]})})]},"artifact-container")})}),sd=400,Qv=E.memo(({message:a})=>{const{toast:e}=po(),t=ge(K=>K.chatMessages),s=ge(K=>K.project),o=Gt(K=>K.user),r=t[t.length-1]?.id===a.id,i=o&&s&&s.user_id===o._id,n=Ya(t),c=je(K=>K.setActiveFile),l=E.useRef(!0);E.useEffect(()=>{l.current=!1},[]);const[d,p]=E.useState(!1),[u,f]=E.useState(!1),[m,g]=E.useState(!1),[x,b]=E.useState(!1),y=E.useRef(null),[k,A]=E.useState(!1);E.useEffect(()=>{if(!a.is_user||!y.current)return;const K=y.current,I=()=>{A(K.scrollHeight>sd)};I();const X=new ResizeObserver(I);return X.observe(K),()=>X.disconnect()},[a]);const S=E.useCallback(async K=>{if(!(!s||m)){g(!0);try{await Of(s.id,a.id,K),e({title:"Feedback Received",description:"Thank y
90ou for your feedback!",duration:3e3})}catch(I){console.error("Error submitting feedback:",I),e({title:"Error",description:"Failed to submit your feedback. Please try again.",variant:"destructive",duration:3e3})}finally{g(!1)}}},[s,a.id,e,m]),N=a.status==="in_progress"||a.status==="dummy",D=E.useMemo(()=>{const K=new Date(a.created_at);return Yv(K)?ad(K,"p"):ad(K,"PPpp")},[a.created_at]),L=E.useMemo(()=>{if(!n?.files?.length)return{};const K={};return n.files.forEach(I=>{const X=I.path.split("/");let T=K;for(let Z=0;Z<X.length-1;Z++){const oe=X[Z];T[oe]||(T[oe]={type:"folder",children:{}}),T=T[oe].children}const O=X[X.length-1];T[O]={type:"file",content:I.content}}),K},[n]),M=E.useMemo(()=>a.is_system?[{type:"artifact",value:{id:a.id,title:a.message,files:a.files}}]:a.full_response?Array.isArray(a.full_response)?a.full_response.filter(I=>I.type!=="reasoning-block"&&I.type!=="reasoning"):[]:a.is_user?[{type:"text",value:a.message}]:[],[a.full_response,a.is_user,a.message]);E.useMemo(()=>M.find(K=>K.type==="artifact"),[M])?.value;const V=N&&!a.is_user,P=E.useCallback(()=>f(!0),[]),F=E.useCallback(()=>f(!1),[]),j=E.useCallback(async()=>{const K=M.filter(I=>I.type==="text").map(I=>typeof I.value=="string"?I.value:"").join(` 91 92`);await navigator.clipboard.writeText(K),p(!0),setTimeout(()=>p(!1),2e3)},[M]),z=E.useCallback(()=>{b(!x)},[x]),ce=a.is_user?Ze.div:"div",$=E.useMemo(()=>a.is_user&&l.current&&r?{initial:{opacity:0,y:10,scale:.98},animate:{opacity:1,y:0,scale:1},transition:{duration:.2,ease:[.4,0,.2,1]}}:{},[a.is_user,r]);if(a.is_system){const K=a.status==="in_progress",I=a.status==="done",X=a.status==="error";return h.jsx("div",{"data-codepal-ve-id":"src-pages-project-messagelist-messagebubble-tsx:messagebubble:div:220:13","data-codepal-binding-id":"src-pages-project-messagelist-messagebubble-tsx:messagebubble:div:220:13","data-codepal-module-id":"src-pages-project-messagelist-messagebubble-tsx","data-codepal-component-id":"src-pages-project-messagelist-messagebubble-tsx:messagebubble","data-codepal-source-node-id":"src-pages-project-messagelist-messagebubble-tsx:messagebubble:div:220:13","data-codepal-source-file":"src/pages/Project/MessageList/MessageBubble.tsx","data-codepal-source-line":"220","data-codepal-source-column":"13","data-codepal-source-symbol":"MessageBubble",className:"flex w-full items-center justify-center message-container my-2",children:h.jsx("div",{"data-codepal-ve-id":"src-pages-project-messagelist-messagebubble-tsx:messagebubble:div:221:17","data-codepal-binding-id":"src-pages-project-messagelist-messagebubble-tsx:messagebubble:div:221:17","data-codepal-module-id":"src-pages-project-messagelist-messagebubble-tsx","data-codepal-component-id":"src-pages-project-messagelist-messagebubble-tsx:messagebubble","data-codepal-source-node-id":"src-pages-project-messagelist-messagebubble-tsx:messagebubble:div:221:17","data-codepal-source-file":"src/pages/Project/MessageList/MessageBubble.tsx","data-codepal-source-line":"221","data-codepal-source-column":"17","data-codepal-source-symbol":"MessageBubble",className:"system-message relative",onMouseEnter:()=>{},onMouseLeave:()=>{},children:h.jsxs("div",{"data-codepal-ve-id":"src-pages-project-messagelist-messagebubble-tsx:messagebubble:div:228:21","data-codepal-binding-id":"src-pages-project-messagelist-messagebubble-tsx:messagebubble:div:228:21","data-codepal-module-id":"src-pages-project-messagelist-messagebubble-tsx","data-codepal-component-id":"src-pages-project-messagelist-messagebubble-tsx:messagebubble","data-codepal-source-node-id":"src-pages-project-messagelist-messagebubble-tsx:messagebubble:div:228:21","data-codepal-source-file":"src/pages/Project/MessageList/MessageBubble.tsx","data-codepal-source-line":"228","data-codepal-source-column":"21","data-codepal-source-symbol":"MessageBubble",className:ie("rounded-xl px-4 py-3 shadow-sm border break-words text-center transition-all duration-300 system-message-transition system-message-inner",X?"bg-red-50 dark:bg-red-900/20 border-red-100 dark:border-red-800/30":K?"bg-blue-50 dark:bg-blue-900/20 border-blue-100 dar
92k:border-blue-800/30":I?"bg-green-50 dark:bg-green-900/20 border-green-100 dark:border-green-800/30":"bg-amber-50 dark:bg-amber-900/20 border-amber-100 dark:border-amber-800/30"),children:[h.jsx("div",{"data-codepal-ve-id":"src-pages-project-messagelist-messagebubble-tsx:messagebubble:div:238:25","data-codepal-binding-id":"src-pages-project-messagelist-messagebubble-tsx:messagebubble:div:238:25","data-codepal-module-id":"src-pages-project-messagelist-messagebubble-tsx","data-codepal-component-id":"src-pages-project-messagelist-messagebubble-tsx:messagebubble","data-codepal-source-node-id":"src-pages-project-messagelist-messagebubble-tsx:messagebubble:div:238:25","data-codepal-source-file":"src/pages/Project/MessageList/MessageBubble.tsx","data-codepal-source-line":"238","data-codepal-source-column":"25","data-codepal-source-symbol":"MessageBubble",className:ie("text-sm w-full",X?"text-red-700 dark:text-red-300":K?"text-blue-700 dark:text-blue-300":I?"text-green-700 dark:text-green-300":"text-amber-700 dark:text-amber-300"),children:h.jsxs("div",{"data-codepal-ve-id":"src-pages-project-messagelist-messagebubble-tsx:messagebubble:div:248:29","data-codepal-binding-id":"src-pages-project-messagelist-messagebubble-tsx:messagebubble:div:248:29","data-codepal-module-id":"src-pages-project-messagelist-messagebubble-tsx","data-codepal-component-id":"src-pages-project-messagelist-messagebubble-tsx:messagebubble","data-codepal-source-node-id":"src-pages-project-messagelist-messagebubble-tsx:messagebubble:div:248:29","data-codepal-source-file":"src/pages/Project/MessageList/MessageBubble.tsx","data-codepal-source-line":"248","data-codepal-source-column":"29","data-codepal-source-symbol":"MessageBubble",className:"prose dark:prose-invert max-w-full w-full overflow-hidden",children:[h.jsxs("div",{"data-codepal-ve-id":"src-pages-project-messagelist-messagebubble-tsx:messagebubble:div:250:33","data-codepal-binding-id":"src-pages-project-messagelist-messagebubble-tsx:messagebubble:div:250:33","data-codepal-module-id":"src-pages-project-messagelist-messagebubble-tsx","data-codepal-component-id":"src-pages-project-messagelist-messagebubble-tsx:messagebubble","data-codepal-source-node-id":"src-pages-project-messagelist-messagebubble-tsx:messagebubble:div:250:33","data-codepal-source-file":"src/pages/Project/MessageList/MessageBubble.tsx","data-codepal-source-line":"250","data-codepal-source-column":"33","data-codepal-source-symbol":"MessageBubble",className:ie("system-message-header",X?"bg-red-100 dark:bg-red-800/30 text-red-700 dark:text-red-300":K?"bg-blue-100 dark:bg-blue-800/30 text-blue-700 dark:text-blue-300":I?"bg-green-100 dark:bg-green-800/30 text-green-700 dark:text-green-300":"bg-amber-100 dark:bg-amber-800/30 text-amber-700 dark:text-amber-300"),children:[X&&h.jsx(Rs,{className:"w-4 h-4"}),K&&h.jsx("svg",{"data-codepal-ve-id":"src-pages-project-messagelist-messagebubble-tsx:messagebubble:svg:262:41","data-codepal-binding-id":"src-pages-project-messagelist-messagebubble-tsx:messagebubble:svg:262:41","data-codepal-module-id":"src-pages-project-messagelist-messagebubble-tsx","data-codepal-component-id":"src-pages-project-messagelist-messagebubble-tsx:messagebubble","data-codepal-source-node-id":"src-pages-project-messagelist-messagebubble-tsx:messagebubble:svg:262:41","data-codepal-source-file":"src/pages/Project/MessageList/MessageBubble.tsx","data-codepal-source-line":"262","data-codepal-source-column":"41","data-codepal-source-symbol":"MessageBubble",className:"loading-spinner w-4 h-4",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:h.jsx("path",{"data-codepal-ve-id":"src-pages-project-messagelist-messagebubble-tsx:messagebubble:path:264:45","data-codepal-binding-id":"src-pages-project-messagelist-messagebubble-tsx:messagebubble:path:264:45","data-codepal-module-id":"src-pages-project-messagelist-messagebubble-tsx","data-codepal-component-id":"src-pages-project-messagelist-messagebubble-tsx:messagebubble","data-codepal-source-node-id":"src-pages-project-messagelist-messagebubble-tsx:messagebubble:path:264:45","data-codepal-source-file":"src/pages/Project/MessageList/MessageBubble.tsx","data-codepal-source-line":"264","data-codepal-source-column":"45","data-codepal-source-symbol":"MessageBubble",d:"M12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22C17.5228 22 22 17.5228 22 12C22 6.47715 17.5228 2 12 2Z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeDasharray:"60",strokeDashoffset:"20"})}),I&&h.jsx(Ud,{className:"w-4 h-4"}),h.jsx("span",{"data-codepal-ve-id":"src-pages-project-messagelist-messagebubble-tsx:messagebubble:span:271:37","data-codepal-binding-id":"src-pages-project-messagelist-messagebubble-tsx:messagebubble:span:271:37","data-codepal-module-id":"src-pages-project-messagelist-messagebubble-tsx","data-codepal-component-id":"src-pages-project-messagelist-messagebubble-tsx:messagebubble","data-codepal-source-node
92-id":"src-pages-project-messagelist-messagebubble-tsx:messagebubble:span:271:37","data-codepal-source-file":"src/pages/Project/MessageList/MessageBubble.tsx","data-codepal-source-line":"271","data-codepal-source-column":"37","data-codepal-source-symbol":"MessageBubble",children:X?"Error Saving Files":K?"Processing files":I?"Files Saved Successfully":"Status"})]}),M.map((T,O)=>T.type==="text"?h.jsx("div",{"data-codepal-ve-id":"src-pages-project-messagelist-messagebubble-tsx:messagebubble:div:282:45","data-codepal-binding-id":"src-pages-project-messagelist-messagebubble-tsx:messagebubble:div:282:45","data-codepal-module-id":"src-pages-project-messagelist-messagebubble-tsx","data-codepal-component-id":"src-pages-project-messagelist-messagebubble-tsx:messagebubble","data-codepal-source-node-id":"src-pages-project-messagelist-messagebubble-tsx:messagebubble:div:282:45","data-codepal-source-file":"src/pages/Project/MessageList/MessageBubble.tsx","data-codepal-source-line":"282","data-codepal-source-column":"45","data-codepal-source-symbol":"MessageBubble",className:"markdown-content mt-1",children:h.jsx(sr,{content:typeof T.value=="string"?T.value:"",fileTree:L,onFileClick:c,addClass:"message-markdown"})},`text-${O}`):null),X&&h.jsx("div",{"data-codepal-ve-id":"src-pages-project-messagelist-messagebubble-tsx:messagebubble:div:297:37","data-codepal-binding-id":"src-pages-project-messagelist-messagebubble-tsx:messagebubble:div:297:37","data-codepal-module-id":"src-pages-project-messagelist-messagebubble-tsx","data-codepal-component-id":"src-pages-project-messagelist-messagebubble-tsx:messagebubble","data-codepal-source-node-id":"src-pages-project-messagelist-messagebubble-tsx:messagebubble:div:297:37","data-codepal-source-file":"src/pages/Project/MessageList/MessageBubble.tsx","data-codepal-source-line":"297","data-codepal-source-column":"37","data-codepal-source-symbol":"MessageBubble",className:"error-message",children:h.jsx("div",{"data-codepal-ve-id":"src-pages-project-messagelist-messagebubble-tsx:messagebubble:div:298:41","data-codepal-binding-id":"src-pages-project-messagelist-messagebubble-tsx:messagebubble:div:298:41","data-codepal-module-id":"src-pages-project-messagelist-messagebubble-tsx","data-codepal-component-id":"src-pages-project-messagelist-messagebubble-tsx:messagebubble","data-codepal-source-node-id":"src-pages-project-messagelist-messagebubble-tsx:messagebubble:div:298:41","data-codepal-source-file":"src/pages/Project/MessageList/MessageBubble.tsx","data-codepal-source-line":"298","data-codepal-source-column":"41","data-codepal-source-symbol":"MessageBubble",className:"markdown-content",children:h.jsx(sr,{content:typeof M.find(T=>T.type==="text")?.value=="string"?M.find(T=>T.type==="text")?.value:"An error occurred while saving files.",fileTree:L,onFileClick:c,addClass:"message-markdown"})})}),I&&a.generated_files&&a.generated_files.length>0&&h.jsx("div",{"data-codepal-ve-id":"src-pages-project-messagelist-messagebubble-tsx:messagebubble:div:315:37","data-codepal-binding-id":"src-pages-project-messagelist-messagebubble-tsx:messagebubble:div:315:37","data-codepal-module-id":"src-pages-project-messagelist-messagebubble-tsx","data-codepal-component-id":"src-pages-project-messagelist-messagebubble-tsx:messagebubble","data-codepal-source-node-id":"src-pages-project-messagelist-messagebubble-tsx:messagebubble:div:315:37","data-codepal-source-file":"src/pages/Project/MessageList/MessageBubble.tsx","data-codepal-source-line":"315","data-codepal-source-column":"37","data-codepal-source-symbol":"MessageBubble",className:"success-message",children:h.jsx("ul",{"data-codepal-ve-id":"src-pages-project-messagelist-messagebubble-tsx:messagebubble:ul:316:41","data-codepal-binding-id":"src-pages-project-messagelist-messagebubble-tsx:messagebubble:ul:316:41","data-codepal-module-id":"src-pages-project-messagelist-messagebubble-tsx","data-codepal-component-id":"src-pages-project-messagelist-messagebubble-tsx:messagebubble","data-codepal-source-node-id":"src-pages-project-messagelist-messagebubble-tsx:messagebubble:ul:316:41","data-codepal-source-file":"src/pages/Project/MessageList/MessageBubble.tsx","data-codepal-source-line":"316","data-codepal-source-column":"41","data-codepal-source-symbol":"MessageBubble",className:"success-files-list text-xs space-y-0.5 w-full",children:a.generated_files.map((T,O)=>h.jsx("li",{"data-codepal-ve-id":"src-pages-project-messagelist-messagebubble-tsx:messagebubble:li:318:49","data-codepal-binding-id":"src-pages-project-messagelist-messagebubble-tsx:messagebubble:li:318:49","data-codepal-module-id":"src-pages-project-messagelist-messagebubble-tsx","data-codepal-component-id":"src-pages-project-messagelist-messagebubble-tsx:messagebubble","data-codepal-source-node
92-id":"src-pages-project-messagelist-messagebubble-tsx:messagebubble:li:318:49","data-codepal-source-file":"src/pages/Project/MessageList/MessageBubble.tsx","data-codepal-source-line":"318","data-codepal-source-column":"49","data-codepal-source-symbol":"MessageBubble",className:"hover:text-green-700 dark:hover:text-green-400",onClick:()=>c(T),children:T},O))})}),K&&a.generated_files&&a.generated_files.length>0&&h.jsx("div",{"data-codepal-ve-id":"src-pages-project-messagelist-messagebubble-tsx:messagebubble:div:332:37","data-codepal-binding-id":"src-pages-project-messagelist-messagebubble-tsx:messagebubble:div:332:37","data-codepal-module-id":"src-pages-project-messagelist-messagebubble-tsx","data-codepal-component-id":"src-pages-project-messagelist-messagebubble-tsx:messagebubble","data-codepal-source-node-id":"src-pages-project-messagelist-messagebubble-tsx:messagebubble:div:332:37","data-codepal-source-file":"src/pages/Project/MessageList/MessageBubble.tsx","data-codepal-source-line":"332","data-codepal-source-column":"37","data-codepal-source-symbol":"MessageBubble",className:"loading-message",children:h.jsx("div",{"data-codepal-ve-id":"src-pages-project-messagelist-messagebubble-tsx:messagebubble:div:333:41","data-codepal-binding-id":"src-pages-project-messagelist-messagebubble-tsx:messagebubble:div:333:41","data-codepal-module-id":"src-pages-project-messagelist-messagebubble-tsx","data-codepal-component-id":"src-pages-project-messagelist-messagebubble-tsx:messagebubble","data-codepal-source-node-id":"src-pages-project-messagelist-messagebubble-tsx:messagebubble:div:333:41","data-codepal-source-file":"src/pages/Project/MessageList/MessageBubble.tsx","data-codepal-source-line":"333","data-codepal-source-column":"41","data-codepal-source-symbol":"MessageBubble",className:"loading-files-list",children:a.generated_files.map((T,O)=>h.jsxs("div",{"data-codepal-ve-id":"src-pages-project-messagelist-messagebubble-tsx:messagebubble:div:335:49","data-codepal-binding-id":"src-pages-project-messagelist-messagebubble-tsx:messagebubble:div:335:49","data-codepal-module-id":"src-pages-project-messagelist-messagebubble-tsx","data-codepal-component-id":"src-pages-project-messagelist-messagebubble-tsx:messagebubble","data-codepal-source-node-id":"src-pages-project-messagelist-messagebubble-tsx:messagebubble:div:335:49","data-codepal-source-file":"src/pages/Project/MessageList/MessageBubble.tsx","data-codepal-source-line":"335","data-codepal-source-column":"49","data-codepal-source-symbol":"MessageBubble",className:"file-item",onClick:()=>c(T),children:[h.jsx(An,{className:"w-3.5 h-3.5 file-icon text-blue-500 dark:text-blue-400"}),h.jsx("span",{"data-codepal-ve-id":"src-pages-project-messagelist-messagebubble-tsx:messagebubble:span:342:53","data-codepal-binding-id":"src-pages-project-messagelist-messagebubble-tsx:messagebubble:span:342:53","data-codepal-module-id":"src-pages-project-messagelist-messagebubble-tsx","data-codepal-component-id":"src-pages-project-messagelist-messagebubble-tsx:messagebubble","data-codepal-source-node-id":"src-pages-project-messagelist-messagebubble-tsx:messagebubble:span:342:53","data-codepal-source-file":"src/pages/Project/MessageList/MessageBubble.tsx","data-codepal-source-line":"342","data-codepal-source-column":"53","data-codepal-source-symbol":"MessageBubble",className:"file-path text-xs",children:T})]},O))})})]})}),h.jsx("span",{"data-codepal-ve-id":"src-pages-project-messagelist-messagebubble-tsx:messagebubble:span:351:25","data-codepal-binding-id":"src-pages-project-messagelist-messagebubble-tsx:messagebubble:span:351:25","data-codepal-module-id":"src-pages-project-messagelist-messagebubble-tsx","data-codepal-component-id":"src-pages-project-messagelist-messagebubble-tsx:messagebubble","data-codepal-source-node-id":"src-pages-project-messagelist-messagebubble-tsx:messagebubble:span:351:25","data-codepal-source-file":"src/pages/Project/MessageList/MessageBubble.tsx","data-codepal-source-line":"351","data-codepal-source-column":"25","data-codepal-source-symbol":"MessageBubble",className:ie("text-xs mt-1 block font-light",X?"text-red-600/70 dark:text-red-400/70":K?"text-blue-600/70 dark:text-blue-400/70":I?"text-green-600/70 dark:text-green-400/70":"text-amber-600/70 dark:text-amber-400/70"),children:D})]})})})}return a.attachments&&a.attachments.length>0,h.jsx(ce,{...$,className:ie(a.is_user?"flex w-full items-start gap-2 group message-container":"w-full assistant-message-container",a.is_user?"justify-end":"justify-start"),children:h.jsxs("div",{"data-codepal-ve-id":"src-pages-project-messagelist-messagebubble-tsx:messagebubble:div:380:13","data-codepal-binding-id":"src-pages-project-messagelist-messagebubble-tsx:messagebubble:div:380:13","data-codepal-module-id":"src-pages-project-messagelist-messagebubble-tsx","data-codepal-component-id":"src-pages-project-messagelist-messagebubble-tsx:messagebubble","data-codepal-source-node
92-id":"src-pages-project-messagelist-messagebubble-tsx:messagebubble:div:380:13","data-codepal-source-file":"src/pages/Project/MessageList/MessageBubble.tsx","data-codepal-source-line":"380","data-codepal-source-column":"13","data-codepal-source-symbol":"MessageBubble",className:ie("relative min-w-0 shrink overflow-hidden",(a.is_user,"max-w-[85%] md:max-w-[75%]")),style:{maxWidth:"100%",width:"auto",boxSizing:"border-box"},onMouseEnter:P,onMouseLeave:F,children:[h.jsxs("div",{"data-codepal-ve-id":"src-pages-project-messagelist-messagebubble-tsx:messagebubble:div:389:17","data-codepal-binding-id":"src-pages-project-messagelist-messagebubble-tsx:messagebubble:div:389:17","data-codepal-module-id":"src-pages-project-messagelist-messagebubble-tsx","data-codepal-component-id":"src-pages-project-messagelist-messagebubble-tsx:messagebubble","data-codepal-source-node-id":"src-pages-project-messagelist-messagebubble-tsx:messagebubble:div:389:17","data-codepal-source-file":"src/pages/Project/MessageList/MessageBubble.tsx","data-codepal-source-line":"389","data-codepal-source-column":"17","data-codepal-source-symbol":"MessageBubble",className:ie("rounded-2xl px-4 pb-3 shadow-sm break-words min-w-0 w-full overflow-hidden transition-colors duration-150",a.is_user?"bg-gray-700 text-primary-foreground":"bg-gray-100/50 dark:bg-gray-800 border border-gray-100 dark:border-gray-700"),children:[h.jsxs("div",{"data-codepal-ve-id":"src-pages-project-messagelist-messagebubble-tsx:messagebubble:div:395:21","data-codepal-binding-id":"src-pages-project-messagelist-messagebubble-tsx:messagebubble:div:395:21","data-codepal-module-id":"src-pages-project-messagelist-messagebubble-tsx","data-codepal-component-id":"src-pages-project-messagelist-messagebubble-tsx:messagebubble","data-codepal-source-node-id":"src-pages-project-messagelist-messagebubble-tsx:messagebubble:div:395:21","data-codepal-source-file":"src/pages/Project/MessageList/MessageBubble.tsx","data-codepal-source-line":"395","data-codepal-source-column":"21","data-codepal-source-symbol":"MessageBubble",className:ie("text-sm leading-relaxed pt-4 min-w-0 w-full",a.is_user?"text-white":"text-gray-700 dark:text-gray-200"),style:{maxWidth:"100%"},children:[h.jsxs("div",{"data-codepal-ve-id":"src-pages-project-messagelist-messagebubble-tsx:messagebubble:div:403:25","data-codepal-binding-id":"src-pages-project-messagelist-messagebubble-tsx:messagebubble:div:403:25","data-codepal-module-id":"src-pages-project-messagelist-messagebubble-tsx","data-codepal-component-id":"src-pages-project-messagelist-messagebubble-tsx:messagebubble","data-codepal-source-node-id":"src-pages-project-messagelist-messagebubble-tsx:messagebubble:div:403:25","data-codepal-source-file":"src/pages/Project/MessageList/MessageBubble.tsx","data-codepal-source-line":"403","data-codepal-source-column":"25","data-codepal-source-symbol":"MessageBubble",className:"relative",children:[h.jsxs("div",{"data-codepal-ve-id":"src-pages-project-messagelist-messagebubble-tsx:messagebubble:div:404:29","data-codepal-binding-id":"src-pages-project-messagelist-messagebubble-tsx:messagebubble:div:404:29","data-codepal-module-id":"src-pages-project-messagelist-messagebubble-tsx","data-codepal-component-id":"src-pages-project-messagelist-messagebubble-tsx:messagebubble","data-codepal-source-node-id":"src-pages-project-messagelist-messagebubble-tsx:messagebubble:div:404:29","data-codepal-source-file":"src/pages/Project/MessageList/MessageBubble.tsx","data-codepal-source-line":"404","data-codepal-source-column":"29","data-codepal-source-symbol":"MessageBubble",ref:y,className:"prose dark:prose-invert max-w-full w-full overflow-hidden message-content",style:{maxWidth:"100%",maxHeight:a.is_user&&!x?`${sd}px`:a.is_user?"2000px":"none",overflow:a.is_user&&!x?"hidden":"visible",transition:"max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1)"},children:[M.map((K,I)=>K.type==="text"?h.jsx("div",{"data-codepal-ve-id":"src-pages-project-messagelist-messagebubble-tsx:messagebubble:div:420:45","data-codepal-binding-id":"src-pages-project-messagelist-messagebubble-tsx:messagebubble:div:420:45","data-codepal-module-id":"src-pages-project-messagelist-messagebubble-tsx","data-codepal-component-id":"src-pages-project-messagelist-messagebubble-tsx:messagebubble","data-codepal-source-node
92-id":"src-pages-project-messagelist-messagebubble-tsx:messagebubble:div:420:45","data-codepal-source-file":"src/pages/Project/MessageList/MessageBubble.tsx","data-codepal-source-line":"420","data-codepal-source-column":"45","data-codepal-source-symbol":"MessageBubble",className:"markdown-content",style:{opacity:1},children:h.jsx(sr,{content:typeof K.value=="string"?K.value:"",fileTree:L,onFileClick:c,disableHtml:a.is_user&&Object.keys(L).length===0,addClass:"message-markdown"})},`text-${I}`):K.type==="artifact"?h.jsx(Zv,{artifact:K.value,isStreaming:N,hasBottomContent:I<M.length-1},`artifact-${I}`):null),a.is_user&&a.attachments&&a.attachments.length>0&&h.jsx("div",{"data-codepal-ve-id":"src-pages-project-messagelist-messagebubble-tsx:messagebubble:div:446:37","data-codepal-binding-id":"src-pages-project-messagelist-messagebubble-tsx:messagebubble:div:446:37","data-codepal-module-id":"src-pages-project-messagelist-messagebubble-tsx","data-codepal-component-id":"src-pages-project-messagelist-messagebubble-tsx:messagebubble","data-codepal-source-node-id":"src-pages-project-messagelist-messagebubble-tsx:messagebubble:div:446:37","data-codepal-source-file":"src/pages/Project/MessageList/MessageBubble.tsx","data-codepal-source-line":"446","data-codepal-source-column":"37","data-codepal-source-symbol":"MessageBubble",className:"attachments-container mt-2 flex flex-wrap",children:a.attachments.map(K=>h.jsx(Xv,{attachment:K},K.id))}),V&&h.jsx(Jv,{})]}),k&&!x&&a.is_user&&!N&&h.jsx("div",{"data-codepal-ve-id":"src-pages-project-messagelist-messagebubble-tsx:messagebubble:div:464:33","data-codepal-binding-id":"src-pages-project-messagelist-messagebubble-tsx:messagebubble:div:464:33","data-codepal-module-id":"src-pages-project-messagelist-messagebubble-tsx","data-codepal-component-id":"src-pages-project-messagelist-messagebubble-tsx:messagebubble","data-codepal-source-node-id":"src-pages-project-messagelist-messagebubble-tsx:messagebubble:div:464:33","data-codepal-source-file":"src/pages/Project/MessageList/MessageBubble.tsx","data-codepal-source-line":"464","data-codepal-source-column":"33","data-codepal-source-symbol":"MessageBubble",className:"user-bubble-fade"})]}),k&&!N&&a.is_user&&h.jsxs("button",{"data-codepal-ve-id":"src-pages-project-messagelist-messagebubble-tsx:messagebubble:button:470:29","data-codepal-binding-id":"src-pages-project-messagelist-messagebubble-tsx:messagebubble:button:470:29","data-codepal-module-id":"src-pages-project-messagelist-messagebubble-tsx","data-codepal-component-id":"src-pages-project-messagelist-messagebubble-tsx:messagebubble","data-codepal-source-node-id":"src-pages-project-messagelist-messagebubble-tsx:messagebubble:button:470:29","data-codepal-source-file":"src/pages/Project/MessageList/MessageBubble.tsx","data-codepal-source-line":"470","data-codepal-source-column":"29","data-codepal-source-symbol":"MessageBubble",className:"show-more-btn",onClick:z,children:[h.jsx(lm,{className:ie("show-more-chevron",x&&"show-more-chevron-expanded")}),h.jsx("span",{"data-codepal-ve-id":"src-pages-project-messagelist-messagebubble-tsx:messagebubble:span:473:33","data-codepal-binding-id":"src-pages-project-messagelist-messagebubble-tsx:messagebubble:span:473:33","data-codepal-module-id":"src-pages-project-messagelist-messagebubble-tsx","data-codepal-component-id":"src-pages-project-messagelist-messagebubble-tsx:messagebubble","data-codepal-source-node-id":"src-pages-project-messagelist-messagebubble-tsx:messagebubble:span:473:33","data-codepal-source-file":"src/pages/Project/MessageList/MessageBubble.tsx","data-codepal-source-line":"473","data-codepal-source-column":"33","data-codepal-source-symbol":"MessageBubble",children:x?"Show less":"Show more"})]})]}),h.jsxs("span",{"data-codepal-ve-id":"src-pages-project-messagelist-messagebubble-tsx:messagebubble:span:478:21","data-codepal-binding-id":"src-pages-project-messagelist-messagebubble-tsx:messagebubble:span:478:21","data-codepal-module-id":"src-pages-project-messagelist-messagebubble-tsx","data-codepal-component-id":"src-pages-project-messagelist-messagebubble-tsx:messagebubble","data-codepal-source-node
92-id":"src-pages-project-messagelist-messagebubble-tsx:messagebubble:span:478:21","data-codepal-source-file":"src/pages/Project/MessageList/MessageBubble.tsx","data-codepal-source-line":"478","data-codepal-source-column":"21","data-codepal-source-symbol":"MessageBubble",className:ie("text-xs mt-1 block font-light",a.is_user?"text-white/70 text-right":"text-gray-400 dark:text-gray-500"),children:[D,N&&" · Loading..."]})]}),!a.is_user&&h.jsx(Pi,{children:!N&&i&&(u||d)&&h.jsx(Ze.div,{initial:{opacity:0,scale:.9},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.9},transition:{duration:.2},className:"absolute bottom-[5px] right-[5px] flex justify-start items-center gap-1.5",children:h.jsxs(ra,{children:[h.jsxs(Ht,{children:[h.jsx($t,{asChild:!0,children:h.jsx("button",{"data-codepal-ve-id":"src-pages-project-messagelist-messagebubble-tsx:messagebubble:button:500:45","data-codepal-binding-id":"src-pages-project-messagelist-messagebubble-tsx:messagebubble:button:500:45","data-codepal-module-id":"src-pages-project-messagelist-messagebubble-tsx","data-codepal-component-id":"src-pages-project-messagelist-messagebubble-tsx:messagebubble","data-codepal-source-node-id":"src-pages-project-messagelist-messagebubble-tsx:messagebubble:button:500:45","data-codepal-source-file":"src/pages/Project/MessageList/MessageBubble.tsx","data-codepal-source-line":"500","data-codepal-source-column":"45","data-codepal-source-symbol":"MessageBubble",className:ie("p-1.5 rounded-full hover:bg-gray-200 dark:hover:bg-gray-600 "," dark:text-gray-400 transition-colors","text-gray-500 hover:text-gray-600 dark:hover:text-white"),onClick:j,children:h.jsx(Pn,{className:"w-3.5 h-3.5"})})}),h.jsx(Ut,{children:h.jsx("p",{"data-codepal-ve-id":"src-pages-project-messagelist-messagebubble-tsx:messagebubble:p:512:45","data-codepal-binding-id":"src-pages-project-messagelist-messagebubble-tsx:messagebubble:p:512:45","data-codepal-module-id":"src-pages-project-messagelist-messagebubble-tsx","data-codepal-component-id":"src-pages-project-messagelist-messagebubble-tsx:messagebubble","data-codepal-source-node-id":"src-pages-project-messagelist-messagebubble-tsx:messagebubble:p:512:45","data-codepal-source-file":"src/pages/Project/MessageList/MessageBubble.tsx","data-codepal-source-line":"512","data-codepal-source-column":"45","data-codepal-source-symbol":"MessageBubble",children:"Copy message"})})]}),h.jsx("div",{"data-codepal-ve-id":"src-pages-project-messagelist-messagebubble-tsx:messagebubble:div:535:37","data-codepal-binding-id":"src-pages-project-messagelist-messagebubble-tsx:messagebubble:div:535:37","data-codepal-module-id":"src-pages-project-messagelist-messagebubble-tsx","data-codepal-component-id":"src-pages-project-messagelist-messagebubble-tsx:messagebubble","data-codepal-source-node-id":"src-pages-project-messagelist-messagebubble-tsx:messagebubble:div:535:37","data-codepal-source-file":"src/pages/Project/MessageList/MessageBubble.tsx","data-codepal-source-line":"535","data-codepal-source-column":"37","data-codepal-source-symbol":"MessageBubble",className:"h-4 w-px bg-gray-200 dark:bg-gray-600 mx-1"}),h.jsxs(Ht,{children:[h.jsx($t,{asChild:!0,children:h.jsx("button",{"data-codepal-ve-id":"src-pages-project-messagelist-messagebubble-tsx:messagebubble:button:539:45","data-codepal-binding-id":"src-pages-project-messagelist-messagebubble-tsx:messagebubble:button:539:45","data-codepal-module-id":"src-pages-project-messagelist-messagebubble-tsx","data-codepal-component-id":"src-pages-project-messagelist-messagebubble-tsx:messagebubble","data-codepal-source-node-id":"src-pages-project-messagelist-messagebubble-tsx:messagebubble:button:539:45","data-codepal-source-file":"src/pages/Project/MessageList/MessageBubble.tsx","data-codepal-source-line":"539","data-codepal-source-column":"45","data-codepal-source-symbol":"MessageBubble",className:ie("p-1.5 rounded-full hover:bg-gray-200 dark:hover:bg-gray-600 "," dark:text-gray-400 transition-colors","hover:text-green-600 dark:hover:text-green-400"),onClick:()=>S("good"),disabled:m,children:h.jsx(dm,{className:"w-3.5 h-3.5"})})}),h.jsx(Ut,{children:h.jsx("p",{"data-codepal-ve-id":"src-pages-project-messagelist-messagebubble-tsx:messagebubble:p:552:45","data-codepal-binding-id":"src-pages-project-messagelist-messagebubble-tsx:messagebubble:p:552:45","data-codepal-module-id":"src-pages-project-messagelist-messagebubble-tsx","data-codepal-component-id":"src-pages-project-messagelist-messagebubble-tsx:messagebubble","data-codepal-source-node
92-id":"src-pages-project-messagelist-messagebubble-tsx:messagebubble:p:552:45","data-codepal-source-file":"src/pages/Project/MessageList/MessageBubble.tsx","data-codepal-source-line":"552","data-codepal-source-column":"45","data-codepal-source-symbol":"MessageBubble",children:"Good response"})})]}),h.jsxs(Ht,{children:[h.jsx($t,{asChild:!0,children:h.jsx("button",{"data-codepal-ve-id":"src-pages-project-messagelist-messagebubble-tsx:messagebubble:button:558:45","data-codepal-binding-id":"src-pages-project-messagelist-messagebubble-tsx:messagebubble:button:558:45","data-codepal-module-id":"src-pages-project-messagelist-messagebubble-tsx","data-codepal-component-id":"src-pages-project-messagelist-messagebubble-tsx:messagebubble","data-codepal-source-node-id":"src-pages-project-messagelist-messagebubble-tsx:messagebubble:button:558:45","data-codepal-source-file":"src/pages/Project/MessageList/MessageBubble.tsx","data-codepal-source-line":"558","data-codepal-source-column":"45","data-codepal-source-symbol":"MessageBubble",className:ie("p-1.5 rounded-full hover:bg-gray-200 dark:hover:bg-gray-600 "," dark:text-gray-400 transition-colors","hover:text-red-600 dark:hover:text-red-400"),onClick:()=>S("bad"),disabled:m,children:h.jsx(pm,{className:"w-3.5 h-3.5"})})}),h.jsx(Ut,{children:h.jsx("p",{"data-codepal-ve-id":"src-pages-project-messagelist-messagebubble-tsx:messagebubble:p:571:45","data-codepal-binding-id":"src-pages-project-messagelist-messagebubble-tsx:messagebubble:p:571:45","data-codepal-module-id":"src-pages-project-messagelist-messagebubble-tsx","data-codepal-component-id":"src-pages-project-messagelist-messagebubble-tsx:messagebubble","data-codepal-source-node-id":"src-pages-project-messagelist-messagebubble-tsx:messagebubble:p:571:45","data-codepal-source-file":"src/pages/Project/MessageList/MessageBubble.tsx","data-codepal-source-line":"571","data-codepal-source-column":"45","data-codepal-source-symbol":"MessageBubble",children:"Bad response"})})]})]})})}),h.jsx(Pi,{children:d&&h.jsx(Ze.div,{initial:{opacity:0,y:5},animate:{opacity:1,y:0},exit:{opacity:0,y:5},className:"absolute left-0 -bottom-8 text-xs bg-gray-800 text-white px-2 py-1 rounded-md shadow-md",children:"Copied to clipboard"})})]})})}),ej=E.memo(({message:a})=>h.jsx(Qv,{message:a}),(a,e)=>{if(a.message.status==="done"&&e.message.status==="done"){if(a.message.id!==e.message.id||a.message.is_user!==e.message.is_user||a.message.is_system!==e.message.is_system||a.message.message!==e.message.message)return!1;if(!a.message.full_response&&!e.message.full_response)return!0;if(!a.message.full_response||!e.message.full_response)return!1;if(Array.isArray(a.message.full_response)&&Array.isArray(e.message.full_response)){if(a.message.full_response.length!==e.message.full_response.length)return!1;for(let t=0;t<a.message.full_response.length;t++){const s=a.message.full_response[t],o=e.message.full_response[t];if(s.type!==o.type||s.type==="text"&&s.value!==o.value)return!1;if(s.type==="artifact"){const r=s.value,i=o.value;if(r.id!==i.id||(r.files?.length||0)!==(i.files?.length||0))return!1}}return!0}return Array.isArray(a.message.full_response)===Array.isArray(e.message.full_response)}return!1}),xn=()=>{const a=E.useMemo(()=>{const r=["w-16","w-24","w-32","w-40","w-48","w-56"],i=Array(3).fill(null).map(()=>({blocks:Array(2+Math.floor(Math.random()*3)).fill(null).map(()=>({width:r[Math.floor(Math.random()*r.length)],isFullWidth:Math.random()>.7}))})),n=Array(2).fill(null).map(()=>({blocks:Array(1+Math.floor(Math.random()*2)).fill(null).map(()=>({width:r[Math.floor(Math.random()*4)],isFullWidth:!1}))}));return{assistantMessages:i,userMessages:n}},[]),{assistantMessages:e,userMessages:t}=a,s=[],o=Math.max(e.length,t.length);for(let r=0;r<o;r++)r<e.length&&s.push({type:"assistant",data:e[r]}),r<t.length&&s.push({type:"user",data:t[r]});return h.jsx("div",{"data-codepal-ve-id":"src-pages-project-messagelist-messagelistloadingplaceholder-tsx:messagelistloadingplaceholder:div:53:9","data-codepal-binding-id":"src-pages-project-messagelist-messagelistloadingplaceholder-tsx:messagelistloadingplaceholder:div:53:9","data-codepal-module-id":"src-pages-project-messagelist-messagelistloadingplaceholder-tsx","data-codepal-component-id":"src-pages-project-messagelist-messagelistloadingplaceholder-tsx:messagelistloadingplaceholder","data-codepal-source-node
92-id":"src-pages-project-messagelist-messagelistloadingplaceholder-tsx:messagelistloadingplaceholder:div:53:9","data-codepal-source-file":"src/pages/Project/MessageList/MessageListLoadingPlaceholder.tsx","data-codepal-source-line":"53","data-codepal-source-column":"9","data-codepal-source-symbol":"MessageListLoadingPlaceholder",className:"px-4 py-4 space-y-4 animate-pulse",children:s.map((r,i)=>h.jsx("div",{"data-codepal-ve-id":"src-pages-project-messagelist-messagelistloadingplaceholder-tsx:messagelistloadingplaceholder:div:55:17","data-codepal-binding-id":"src-pages-project-messagelist-messagelistloadingplaceholder-tsx:messagelistloadingplaceholder:div:55:17","data-codepal-module-id":"src-pages-project-messagelist-messagelistloadingplaceholder-tsx","data-codepal-component-id":"src-pages-project-messagelist-messagelistloadingplaceholder-tsx:messagelistloadingplaceholder","data-codepal-source-node-id":"src-pages-project-messagelist-messagelistloadingplaceholder-tsx:messagelistloadingplaceholder:div:55:17","data-codepal-source-file":"src/pages/Project/MessageList/MessageListLoadingPlaceholder.tsx","data-codepal-source-line":"55","data-codepal-source-column":"17","data-codepal-source-symbol":"MessageListLoadingPlaceholder",className:ie("flex w-full items-start gap-2",r.type==="user"?"justify-end":"justify-start"),children:h.jsx("div",{"data-codepal-ve-id":"src-pages-project-messagelist-messagelistloadingplaceholder-tsx:messagelistloadingplaceholder:div:62:21","data-codepal-binding-id":"src-pages-project-messagelist-messagelistloadingplaceholder-tsx:messagelistloadingplaceholder:div:62:21","data-codepal-module-id":"src-pages-project-messagelist-messagelistloadingplaceholder-tsx","data-codepal-component-id":"src-pages-project-messagelist-messagelistloadingplaceholder-tsx:messagelistloadingplaceholder","data-codepal-source-node-id":"src-pages-project-messagelist-messagelistloadingplaceholder-tsx:messagelistloadingplaceholder:div:62:21","data-codepal-source-file":"src/pages/Project/MessageList/MessageListLoadingPlaceholder.tsx","data-codepal-source-line":"62","data-codepal-source-column":"21","data-codepal-source-symbol":"MessageListLoadingPlaceholder",className:ie("relative min-w-0 max-w-[85%] md:max-w-[75%]"),children:h.jsxs("div",{"data-codepal-ve-id":"src-pages-project-messagelist-messagelistloadingplaceholder-tsx:messagelistloadingplaceholder:div:67:25","data-codepal-binding-id":"src-pages-project-messagelist-messagelistloadingplaceholder-tsx:messagelistloadingplaceholder:div:67:25","data-codepal-module-id":"src-pages-project-messagelist-messagelistloadingplaceholder-tsx","data-codepal-component-id":"src-pages-project-messagelist-messagelistloadingplaceholder-tsx:messagelistloadingplaceholder","data-codepal-source-node-id":"src-pages-project-messagelist-messagelistloadingplaceholder-tsx:messagelistloadingplaceholder:div:67:25","data-codepal-source-file":"src/pages/Project/MessageList/MessageListLoadingPlaceholder.tsx","data-codepal-source-line":"67","data-codepal-source-column":"25","data-codepal-source-symbol":"MessageListLoadingPlaceholder",className:ie("rounded-2xl px-4 py-3 shadow-sm",r.type==="user"?"bg-primary/20":"bg-gray-100 dark:bg-gray-800/50 border border-gray-200/20 dark:border-gray-700/20"),children:[h.jsx("div",{"data-codepal-ve-id":"src-pages-project-messagelist-messagelistloadingplaceholder-tsx:messagelistloadingplaceholder:div:74:29","data-codepal-binding-id":"src-pages-project-messagelist-messagelistloadingplaceholder-tsx:messagelistloadingplaceholder:div:74:29","data-codepal-module-id":"src-pages-project-messagelist-messagelistloadingplaceholder-tsx","data-codepal-component-id":"src-pages-project-messagelist-messagelistloadingplaceholder-tsx:messagelistloadingplaceholder","data-codepal-source-node-id":"src-pages-project-messagelist-messagelistloadingplaceholder-tsx:messagelistloadingplaceholder:div:74:29","data-codepal-source-file":"src/pages/Project/MessageList/MessageListLoadingPlaceholder.tsx","data-codepal-source-line":"74","data-codepal-source-column":"29","data-codepal-source-symbol":"MessageListLoadingPlaceholder",className:"space-y-2 pt-1 pb-2",children:r.data.blocks.map((n,c)=>h.jsx("div",{"data-codepal-ve-id":"src-pages-project-messagelist-messagelistloadingplaceholder-tsx:messagelistloadingplaceholder:div:76:37","data-codepal-binding-id":"src-pages-project-messagelist-messagelistloadingplaceholder-tsx:messagelistloadingplaceholder:div:76:37","data-codepal-module-id":"src-pages-project-messagelist-messagelistloadingplaceholder-tsx","data-codepal-component-id":"src-pages-project-messagelist-messagelistloadingplaceholder-tsx:messagelistloadingplaceholder","data-codepal-source-node
92-id":"src-pages-project-messagelist-messagelistloadingplaceholder-tsx:messagelistloadingplaceholder:div:76:37","data-codepal-source-file":"src/pages/Project/MessageList/MessageListLoadingPlaceholder.tsx","data-codepal-source-line":"76","data-codepal-source-column":"37","data-codepal-source-symbol":"MessageListLoadingPlaceholder",className:ie("h-4 bg-gray-200 dark:bg-gray-700 rounded",n.isFullWidth?"w-full":n.width)},`block-${i}-${c}`))}),h.jsx("div",{"data-codepal-ve-id":"src-pages-project-messagelist-messagelistloadingplaceholder-tsx:messagelistloadingplaceholder:div:87:29","data-codepal-binding-id":"src-pages-project-messagelist-messagelistloadingplaceholder-tsx:messagelistloadingplaceholder:div:87:29","data-codepal-module-id":"src-pages-project-messagelist-messagelistloadingplaceholder-tsx","data-codepal-component-id":"src-pages-project-messagelist-messagelistloadingplaceholder-tsx:messagelistloadingplaceholder","data-codepal-source-node-id":"src-pages-project-messagelist-messagelistloadingplaceholder-tsx:messagelistloadingplaceholder:div:87:29","data-codepal-source-file":"src/pages/Project/MessageList/MessageListLoadingPlaceholder.tsx","data-codepal-source-line":"87","data-codepal-source-column":"29","data-codepal-source-symbol":"MessageListLoadingPlaceholder",className:ie("h-3 mt-1 bg-gray-200 dark:bg-gray-700 rounded w-16",r.type==="user"?"ml-auto":"")})]})})},`message-${i}`))})},tj=Fs.createContext({disableAutoScroll:!1}),bn=()=>{const{projectId:a}=Vd(),e=ge(L=>L.chatMessages),t=ge(L=>L.isLoadingProject),s=ge(L=>L.activeStreamingMessageId),o=ge(L=>L.messagesMetadata),r=ge(L=>L.setChatMessages),i=ge(L=>L.setMessagesMetadata),[n,c]=E.useState(!1),l=10,d=o?.has_more===!0,p=E.useRef(null),u=E.useRef(!1),f=E.useRef(e.length),m=E.useRef(!1),g=E.useRef(null),x=E.useRef(!1),[b,y]=E.useState(!1),k=32,A=E.useCallback((L="auto")=>{const M=p.current;if(!M)return;g.current!==null&&(window.clearTimeout(g.current),g.current=null),m.current=!0,M.scrollTo({top:M.scrollHeight,behavior:L});const B=()=>{m.current=!1};L==="smooth"?g.current=window.setTimeout(()=>{B(),g.current=null},250):requestAnimationFrame(B)},[]),S=E.useCallback(()=>{const L=p.current;if(!L)return!1;const{scrollTop:M,scrollHeight:B,clientHeight:V}=L;return B-(M+V)<=k},[k]),N=E.useCallback(()=>{if(!p.current||m.current)return;const M=S();s&&(!M&&b?y(!1):M&&!b&&y(!0))},[s,b,S]);E.useEffect(()=>{!b||x.current||A("smooth")},[e,b,A]),E.useEffect(()=>{s?(y(!0),requestAnimationFrame(()=>A("auto"))):y(!1)},[s,A]),E.useEffect(()=>{if(t){u.current=!1;return}!s&&!u.current&&(u.current=!0,requestAnimationFrame(()=>A("auto")))},[t,s,A,e.length]),E.useEffect(()=>{const L=f.current,M=e.length;f.current=M,!x.current&&!t&&M>L&&e.slice(L).some(P=>P.is_user===!0)&&requestAnimationFrame(()=>A("smooth"))},[e,t,A]),E.useEffect(()=>()=>{g.current!==null&&(window.clearTimeout(g.current),g.current=null)},[]);const D=async()=>{if(!a||n||!o?.next_cursor)return;const L=p.current;if(!L)return;x.current=!0;const M=L.scrollHeight,B=L.scrollTop;c(!0);try{He.log(`Loading more messages with cursor=${o.next_cursor}, limit=${l}`);const V=await zd(a,{limit:l,cursor:o.next_cursor});V.messages_metadata&&(i(V.messages_metadata),He.log("Updated messages metadata:",V.messages_metadata)),V.messages_metadata?.total!==void 0?ge.getState().setTotalMessagesCount(V.messages_metadata.total):V.total_messages!==void 0&&ge.getState().setTotalMessagesCount(V.total_messages);const P=new Map(e.map(j=>[j.id,j])),F=V.messages.filter(j=>!P.get(j.id));r([...F,...e]);for(const j of F)!j.full_response||j.full_response===""||ge.getState().updateChatMessage(j.id,j.full_response);requestAnimationFrame(()=>{const z=L.scrollHeight-M;m.current=!0,L.scrollTop=B+z,requestAnimationFrame(()=>{m.current=!1,x.current=!1})})}catch(V){console.error("Error loading more messages:",V),x.current=!1}finally{c(!1)}};return t?h.jsx(xn,{}):h.jsx(tj.Provider,{value:{disableAutoScroll:!b},children:h.jsxs("div",{"data-codepal-ve-id":"src-pages-project-messagelist-index-tsx:messagelist:div:246:13","data-codepal-binding-id":"src-pages-project-messagelist-index-tsx:messagelist:div:246:13","data-codepal-module-id":"src-pages-project-messagelist-index-tsx","data-codepal-component-id":"src-pages-project-messagelist-index-tsx:messagelist","data-codepal-source-node
92-id":"src-pages-project-messagelist-index-tsx:messagelist:div:246:13","data-codepal-source-file":"src/pages/Project/MessageList/index.tsx","data-codepal-source-line":"246","data-codepal-source-column":"13","data-codepal-source-symbol":"MessageList",ref:p,className:"px-4 pt-4 pb-6 space-y-4 overflow-y-auto h-full","data-chat-scroll-container":!0,onScroll:N,children:[d&&h.jsx("div",{"data-codepal-ve-id":"src-pages-project-messagelist-index-tsx:messagelist:div:254:21","data-codepal-binding-id":"src-pages-project-messagelist-index-tsx:messagelist:div:254:21","data-codepal-module-id":"src-pages-project-messagelist-index-tsx","data-codepal-component-id":"src-pages-project-messagelist-index-tsx:messagelist","data-codepal-source-node-id":"src-pages-project-messagelist-index-tsx:messagelist:div:254:21","data-codepal-source-file":"src/pages/Project/MessageList/index.tsx","data-codepal-source-line":"254","data-codepal-source-column":"21","data-codepal-source-symbol":"MessageList",className:"flex justify-center pt-2 pb-1",children:h.jsx("div",{"data-codepal-ve-id":"src-pages-project-messagelist-index-tsx:messagelist:div:255:25","data-codepal-binding-id":"src-pages-project-messagelist-index-tsx:messagelist:div:255:25","data-codepal-module-id":"src-pages-project-messagelist-index-tsx","data-codepal-component-id":"src-pages-project-messagelist-index-tsx:messagelist","data-codepal-source-node-id":"src-pages-project-messagelist-index-tsx:messagelist:div:255:25","data-codepal-source-file":"src/pages/Project/MessageList/index.tsx","data-codepal-source-line":"255","data-codepal-source-column":"25","data-codepal-source-symbol":"MessageList",className:"flex justify-center w-full pb-3 pt-1 px-4",children:h.jsx(yt,{variant:"ghost",size:"sm",onClick:D,disabled:n,className:"text-xs border border-border hover:bg-accent hover:text-accent-foreground transition-colors",children:n?h.jsxs("div",{"data-codepal-ve-id":"src-pages-project-messagelist-index-tsx:messagelist:div:264:37","data-codepal-binding-id":"src-pages-project-messagelist-index-tsx:messagelist:div:264:37","data-codepal-module-id":"src-pages-project-messagelist-index-tsx","data-codepal-component-id":"src-pages-project-messagelist-index-tsx:messagelist","data-codepal-source-node-id":"src-pages-project-messagelist-index-tsx:messagelist:div:264:37","data-codepal-source-file":"src/pages/Project/MessageList/index.tsx","data-codepal-source-line":"264","data-codepal-source-column":"37","data-codepal-source-symbol":"MessageList",className:"flex items-center justify-center gap-2",children:[h.jsxs("svg",{"data-codepal-ve-id":"src-pages-project-messagelist-index-tsx:messagelist:svg:265:41","data-codepal-binding-id":"src-pages-project-messagelist-index-tsx:messagelist:svg:265:41","data-codepal-module-id":"src-pages-project-messagelist-index-tsx","data-codepal-component-id":"src-pages-project-messagelist-index-tsx:messagelist","data-codepal-source-node-id":"src-pages-project-messagelist-index-tsx:messagelist:svg:265:41","data-codepal-source-file":"src/pages/Project/MessageList/index.tsx","data-codepal-source-line":"265","data-codepal-source-column":"41","data-codepal-source-symbol":"MessageList",className:"animate-spin h-3 w-3 text-current",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[h.jsx("circle",{"data-codepal-ve-id":"src-pages-project-messagelist-index-tsx:messagelist:circle:267:45","data-codepal-binding-id":"src-pages-project-messagelist-index-tsx:messagelist:circle:267:45","data-codepal-module-id":"src-pages-project-messagelist-index-tsx","data-codepal-component-id":"src-pages-project-messagelist-index-tsx:messagelist","data-codepal-source-node-id":"src-pages-project-messagelist-index-tsx:messagelist:circle:267:45","data-codepal-source-file":"src/pages/Project/MessageList/index.tsx","data-codepal-source-line":"267","data-codepal-source-column":"45","data-codepal-source-symbol":"MessageList",className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),h.jsx("path",{"data-codepal-ve-id":"src-pages-project-messagelist-index-tsx:messagelist:path:269:45","data-codepal-binding-id":"src-pages-project-messagelist-index-tsx:messagelist:path:269:45","data-codepal-module-id":"src-pages-project-messagelist-index-tsx","data-codepal-component-id":"src-pages-project-messagelist-index-tsx:messagelist","data-codepal-source-node
92-id":"src-pages-project-messagelist-index-tsx:messagelist:path:269:45","data-codepal-source-file":"src/pages/Project/MessageList/index.tsx","data-codepal-source-line":"269","data-codepal-source-column":"45","data-codepal-source-symbol":"MessageList",className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),h.jsx("span",{"data-codepal-ve-id":"src-pages-project-messagelist-index-tsx:messagelist:span:272:41","data-codepal-binding-id":"src-pages-project-messagelist-index-tsx:messagelist:span:272:41","data-codepal-module-id":"src-pages-project-messagelist-index-tsx","data-codepal-component-id":"src-pages-project-messagelist-index-tsx:messagelist","data-codepal-source-node-id":"src-pages-project-messagelist-index-tsx:messagelist:span:272:41","data-codepal-source-file":"src/pages/Project/MessageList/index.tsx","data-codepal-source-line":"272","data-codepal-source-column":"41","data-codepal-source-symbol":"MessageList",children:"Loading..."})]}):"Load more"})})}),e.map(L=>h.jsx("div",{"data-codepal-ve-id":"src-pages-project-messagelist-index-tsx:messagelist:div:283:21","data-codepal-binding-id":"src-pages-project-messagelist-index-tsx:messagelist:div:283:21","data-codepal-module-id":"src-pages-project-messagelist-index-tsx","data-codepal-component-id":"src-pages-project-messagelist-index-tsx:messagelist","data-codepal-source-node-id":"src-pages-project-messagelist-index-tsx:messagelist:div:283:21","data-codepal-source-file":"src/pages/Project/MessageList/index.tsx","data-codepal-source-line":"283","data-codepal-source-column":"21","data-codepal-source-symbol":"MessageList",children:h.jsx(ej,{message:L})},L.originalId||L.id))]})})};bn.displayName="MessageList";const aj=()=>{const{chatMessages:a,updateChatMessage:e,setActiveStreamingMessageId:t,setCurrentlyStreamingFile:s,activeStreamingMessageId:o,project:r}=ge();Gt(f=>f.user);const{setActiveFile:i,setIsAutoPilotMode:n,setIsPreviewMode:c,getIsAutoPilotMode:l}=je(),d=E.useRef(null),p=E.useRef(""),u=E.useRef(a);return E.useEffect(()=>{u.current=a},[a]),E.useEffect(()=>{const f=()=>{if(d.current)return;const g=[...u.current].reverse().find(y=>!y.is_user&&y.status!=="done"&&y.status!=="error"&&y.status!=="dummy");if(!g)return;const x=g.id;if(!x||x.startsWith("temp-")||x===o&&d.current)return;p.current="",t(x),n(!0);const b=new EventSource(`${Ff()}/message/${x}/sse`,{withCredentials:nm});d.current=b,b.onopen=()=>{He.log(`SSE connection opened for message: ${x}`)},b.onmessage=y=>{try{const k=JSON.parse(y.data),A=k.xml_response,S=k.status||"in_progress",N=k.previous_files||[];if(A!==void 0){p.current=A;const D=ki(p.current,N);let L="",M=null;if(D.forEach(V=>{V.type==="text"?L+=V.value:V.type==="artifact"&&(M=V.value)}),e(x,{id:x,message:L,is_user:!1,full_response:D,status:S},S),M){if(M.partial_file){const V=Rf(M.partial_file);V&&(s(V),l()&&(i(V.path,!1),V.path.toLowerCase().endsWith(".md")&&c(!1)))}else if(M.files?.length>0){const V=M.files[M.files.length-1];S==="in_progress"&&V&&(s({...V,isPartial:!1,isLastFile:!0}),l()&&(i(V.path,!1),V.path.toLowerCase().endsWith(".md")&&c(!1)))}}}if(S==="done"||S==="error"){He.log(`Message ${x} complete with status: ${S}`),b.onmessage=null,b.onerror=null,b.onopen=null,b.close(),d.current=null,t(null),s(null);const M=ki(p.current,N).find(B=>B.type==="artifact")?.value;if(M?.files?.length>0){const B=M.files[M.files.length-1];B&&B.path.toLowerCase().endsWith(".md")&&c(!0)}setTimeout(()=>{const B=document.querySelector(".message-input textarea");B&&B.focus()},100),setTimeout(f,500)}}catch(k){console.error("Error processing SSE data:",k),d.current===b&&(b.close(),d.current=null,t(null),s(null))}},b.onerror=()=>{b.readyState===EventSource.CLOSED?He.warn(`[SSE] stream closed unexpectedly for ${x}`):He.warn(`[SSE] transient connection error (readyState=${b.readyState}) for ${x}`),Zf({surface:"legacy_sse",title:b.readyState===EventSource.CLOSED?"stream_closed":"connection_error",severity:"error",hasDescription:!1,hasAction:!1}),d.current===b&&(b.close(),d.current=null,t(null),s(null)),e(x,{id:x,message:"An error occurred while streaming the response.",is_user:!1,full_response:null,status:"error"},"error")}};f();const m=setInterval(f,1e3);return()=>{clearInterval(m),d.current&&(d.current.close(),d.current=null)}},[o,t,n]),null},sj=()=>{const a=E.useMemo(()=>{const o=["w-24","w-32","w-36","w-28","w-20"],r=[1,2].map(()=>o[Math.floor(Math.random()*o.length)]),i=[1,2,3].map(()=>o[Math.floor(Math.random()*o.length)]),n=[1,2,3,4,5].map(()=>o[Math.floor(Math.random()*o.length)]);return{folderWidths:r,nestedFileWidths:i,fileWidths:n}},[]),{folderWidths:e,nestedFileWidths:t,fileWidths:s}=a;return h.jsxs("div",{"data-codepal-ve-id":"src-pages-project-codeviewer-fileexplorerloadingplaceholder-tsx:fileexplorerloadingplaceholder:div:32:9","data-codepal-binding-id":"src-pages-project-codeviewer-fileexplorerloadingplaceholder-tsx:fileexplorerloadingplaceholder:div:32:9","data-codepal-module-id":"src-pages-project-codeviewer-fileexplorerloadingplaceholder-tsx","data-codepal-component-id":"src-pages-project-codeviewer-fileexplorerloadingplaceholder-tsx:fileexplorerloadingplaceholder","data-codepal-source-node
92-id":"src-pages-project-codeviewer-fileexplorerloadingplaceholder-tsx:fileexplorerloadingplaceholder:div:32:9","data-codepal-source-file":"src/pages/Project/CodeViewer/FileExplorerLoadingPlaceholder.tsx","data-codepal-source-line":"32","data-codepal-source-column":"9","data-codepal-source-symbol":"FileExplorerLoadingPlaceholder",className:"py-2 animate-pulse",children:[[1,2].map((o,r)=>h.jsxs("div",{"data-codepal-ve-id":"src-pages-project-codeviewer-fileexplorerloadingplaceholder-tsx:fileexplorerloadingplaceholder:div:35:17","data-codepal-binding-id":"src-pages-project-codeviewer-fileexplorerloadingplaceholder-tsx:fileexplorerloadingplaceholder:div:35:17","data-codepal-module-id":"src-pages-project-codeviewer-fileexplorerloadingplaceholder-tsx","data-codepal-component-id":"src-pages-project-codeviewer-fileexplorerloadingplaceholder-tsx:fileexplorerloadingplaceholder","data-codepal-source-node-id":"src-pages-project-codeviewer-fileexplorerloadingplaceholder-tsx:fileexplorerloadingplaceholder:div:35:17","data-codepal-source-file":"src/pages/Project/CodeViewer/FileExplorerLoadingPlaceholder.tsx","data-codepal-source-line":"35","data-codepal-source-column":"17","data-codepal-source-symbol":"FileExplorerLoadingPlaceholder",children:[h.jsxs("div",{"data-codepal-ve-id":"src-pages-project-codeviewer-fileexplorerloadingplaceholder-tsx:fileexplorerloadingplaceholder:div:36:21","data-codepal-binding-id":"src-pages-project-codeviewer-fileexplorerloadingplaceholder-tsx:fileexplorerloadingplaceholder:div:36:21","data-codepal-module-id":"src-pages-project-codeviewer-fileexplorerloadingplaceholder-tsx","data-codepal-component-id":"src-pages-project-codeviewer-fileexplorerloadingplaceholder-tsx:fileexplorerloadingplaceholder","data-codepal-source-node-id":"src-pages-project-codeviewer-fileexplorerloadingplaceholder-tsx:fileexplorerloadingplaceholder:div:36:21","data-codepal-source-file":"src/pages/Project/CodeViewer/FileExplorerLoadingPlaceholder.tsx","data-codepal-source-line":"36","data-codepal-source-column":"21","data-codepal-source-symbol":"FileExplorerLoadingPlaceholder",className:"flex items-center w-full py-1.5 px-3",children:[h.jsx(Bs,{className:"w-3.5 h-3.5 text-gray-200 dark:text-gray-700"}),h.jsx(Mn,{className:"w-4 h-4 ml-1 text-gray-200 dark:text-gray-700"}),h.jsx("div",{"data-codepal-ve-id":"src-pages-project-codeviewer-fileexplorerloadingplaceholder-tsx:fileexplorerloadingplaceholder:div:39:25","data-codepal-binding-id":"src-pages-project-codeviewer-fileexplorerloadingplaceholder-tsx:fileexplorerloadingplaceholder:div:39:25","data-codepal-module-id":"src-pages-project-codeviewer-fileexplorerloadingplaceholder-tsx","data-codepal-component-id":"src-pages-project-codeviewer-fileexplorerloadingplaceholder-tsx:fileexplorerloadingplaceholder","data-codepal-source-node-id":"src-pages-project-codeviewer-fileexplorerloadingplaceholder-tsx:fileexplorerloadingplaceholder:div:39:25","data-codepal-source-file":"src/pages/Project/CodeViewer/FileExplorerLoadingPlaceholder.tsx","data-codepal-source-line":"39","data-codepal-source-column":"25","data-codepal-source-symbol":"FileExplorerLoadingPlaceholder",className:ie("ml-2 h-4 bg-gray-200 dark:bg-gray-700 rounded",e[r])})]}),o===1&&h.jsx("div",{"data-codepal-ve-id":"src-pages-project-codeviewer-fileexplorerloadingplaceholder-tsx:fileexplorerloadingplaceholder:div:44:25","data-codepal-binding-id":"src-pages-project-codeviewer-fileexplorerloadingplaceholder-tsx:fileexplorerloadingplaceholder:div:44:25","data-codepal-module-id":"src-pages-project-codeviewer-fileexplorerloadingplaceholder-tsx","data-codepal-component-id":"src-pages-project-codeviewer-fileexplorerloadingplaceholder-tsx:fileexplorerloadingplaceholder","data-codepal-source-node-id":"src-pages-project-codeviewer-fileexplorerloadingplaceholder-tsx:fileexplorerloadingplaceholder:div:44:25","data-codepal-source-file":"src/pages/Project/CodeViewer/FileExplorerLoadingPlaceholder.tsx","data-codepal-source-line":"44","data-codepal-source-column":"25","data-codepal-source-symbol":"FileExplorerLoadingPlaceholder",className:"ml-6",children:[1,2,3].map((i,n)=>h.jsxs("div",{"data-codepal-ve-id":"src-pages-project-codeviewer-fileexplorerloadingplaceholder-tsx:fileexplorerloadingplaceholder:div:46:33","data-codepal-binding-id":"src-pages-project-codeviewer-fileexplorerloadingplaceholder-tsx:fileexplorerloadingplaceholder:div:46:33","data-codepal-module-id":"src-pages-project-codeviewer-fileexplorerloadingplaceholder-tsx","data-codepal-component-id":"src-pages-project-codeviewer-fileexplorerloadingplaceholder-tsx:fileexplorerloadingplaceholder","data-codepal-source-node
92-id":"src-pages-project-codeviewer-fileexplorerloadingplaceholder-tsx:fileexplorerloadingplaceholder:div:46:33","data-codepal-source-file":"src/pages/Project/CodeViewer/FileExplorerLoadingPlaceholder.tsx","data-codepal-source-line":"46","data-codepal-source-column":"33","data-codepal-source-symbol":"FileExplorerLoadingPlaceholder",className:"flex items-center w-full py-1.5 px-3",children:[h.jsx("div",{"data-codepal-ve-id":"src-pages-project-codeviewer-fileexplorerloadingplaceholder-tsx:fileexplorerloadingplaceholder:div:47:37","data-codepal-binding-id":"src-pages-project-codeviewer-fileexplorerloadingplaceholder-tsx:fileexplorerloadingplaceholder:div:47:37","data-codepal-module-id":"src-pages-project-codeviewer-fileexplorerloadingplaceholder-tsx","data-codepal-component-id":"src-pages-project-codeviewer-fileexplorerloadingplaceholder-tsx:fileexplorerloadingplaceholder","data-codepal-source-node-id":"src-pages-project-codeviewer-fileexplorerloadingplaceholder-tsx:fileexplorerloadingplaceholder:div:47:37","data-codepal-source-file":"src/pages/Project/CodeViewer/FileExplorerLoadingPlaceholder.tsx","data-codepal-source-line":"47","data-codepal-source-column":"37","data-codepal-source-symbol":"FileExplorerLoadingPlaceholder",className:"w-4 h-4 ml-2 bg-gray-200 dark:bg-gray-700 rounded-sm"}),h.jsx("div",{"data-codepal-ve-id":"src-pages-project-codeviewer-fileexplorerloadingplaceholder-tsx:fileexplorerloadingplaceholder:div:48:37","data-codepal-binding-id":"src-pages-project-codeviewer-fileexplorerloadingplaceholder-tsx:fileexplorerloadingplaceholder:div:48:37","data-codepal-module-id":"src-pages-project-codeviewer-fileexplorerloadingplaceholder-tsx","data-codepal-component-id":"src-pages-project-codeviewer-fileexplorerloadingplaceholder-tsx:fileexplorerloadingplaceholder","data-codepal-source-node-id":"src-pages-project-codeviewer-fileexplorerloadingplaceholder-tsx:fileexplorerloadingplaceholder:div:48:37","data-codepal-source-file":"src/pages/Project/CodeViewer/FileExplorerLoadingPlaceholder.tsx","data-codepal-source-line":"48","data-codepal-source-column":"37","data-codepal-source-symbol":"FileExplorerLoadingPlaceholder",className:ie("ml-2 h-3 bg-gray-200 dark:bg-gray-700 rounded",t[n])})]},`nested-${i}`))})]},`folder-${o}`)),[1,2,3,4,5].map((o,r)=>h.jsxs("div",{"data-codepal-ve-id":"src-pages-project-codeviewer-fileexplorerloadingplaceholder-tsx:fileexplorerloadingplaceholder:div:59:17","data-codepal-binding-id":"src-pages-project-codeviewer-fileexplorerloadingplaceholder-tsx:fileexplorerloadingplaceholder:div:59:17","data-codepal-module-id":"src-pages-project-codeviewer-fileexplorerloadingplaceholder-tsx","data-codepal-component-id":"src-pages-project-codeviewer-fileexplorerloadingplaceholder-tsx:fileexplorerloadingplaceholder","data-codepal-source-node-id":"src-pages-project-codeviewer-fileexplorerloadingplaceholder-tsx:fileexplorerloadingplaceholder:div:59:17","data-codepal-source-file":"src/pages/Project/CodeViewer/FileExplorerLoadingPlaceholder.tsx","data-codepal-source-line":"59","data-codepal-source-column":"17","data-codepal-source-symbol":"FileExplorerLoadingPlaceholder",className:"flex items-center w-full py-1.5 px-3 ml-6",children:[h.jsx("div",{"data-codepal-ve-id":"src-pages-project-codeviewer-fileexplorerloadingplaceholder-tsx:fileexplorerloadingplaceholder:div:60:21","data-codepal-binding-id":"src-pages-project-codeviewer-fileexplorerloadingplaceholder-tsx:fileexplorerloadingplaceholder:div:60:21","data-codepal-module-id":"src-pages-project-codeviewer-fileexplorerloadingplaceholder-tsx","data-codepal-component-id":"src-pages-project-codeviewer-fileexplorerloadingplaceholder-tsx:fileexplorerloadingplaceholder","data-codepal-source-node-id":"src-pages-project-codeviewer-fileexplorerloadingplaceholder-tsx:fileexplorerloadingplaceholder:div:60:21","data-codepal-source-file":"src/pages/Project/CodeViewer/FileExplorerLoadingPlaceholder.tsx","data-codepal-source-line":"60","data-codepal-source-column":"21","data-codepal-source-symbol":"FileExplorerLoadingPlaceholder",className:"w-4 h-4 bg-gray-200 dark:bg-gray-700 rounded-sm"}),h.jsx("div",{"data-codepal-ve-id":"src-pages-project-codeviewer-fileexplorerloadingplaceholder-tsx:fileexplorerloadingplaceholder:div:61:21","data-codepal-binding-id":"src-pages-project-codeviewer-fileexplorerloadingplaceholder-tsx:fileexplorerloadingplaceholder:div:61:21","data-codepal-module-id":"src-pages-project-codeviewer-fileexplorerloadingplaceholder-tsx","data-codepal-component-id":"src-pages-project-codeviewer-fileexplorerloadingplaceholder-tsx:fileexplorerloadingplaceholder","data-codepal-source-node
92-id":"src-pages-project-codeviewer-fileexplorerloadingplaceholder-tsx:fileexplorerloadingplaceholder:div:61:21","data-codepal-source-file":"src/pages/Project/CodeViewer/FileExplorerLoadingPlaceholder.tsx","data-codepal-source-line":"61","data-codepal-source-column":"21","data-codepal-source-symbol":"FileExplorerLoadingPlaceholder",className:ie("ml-2 h-3 bg-gray-200 dark:bg-gray-700 rounded",s[r])})]},`file-${o}`))]})},oj=Ef,rj=Df,ij=E.forwardRef(({className:a,inset:e,children:t,...s},o)=>h.jsxs(Dd,{ref:o,className:ie("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-gray-100 dark:focus:bg-gray-700 data-[state=open]:bg-gray-100 dark:data-[state=open]:bg-gray-700",e&&"pl-8",a),...s,children:[t,h.jsx(Bs,{className:"ml-auto h-4 w-4"})]}));ij.displayName=Dd.displayName;const nj=E.forwardRef(({className:a,...e},t)=>h.jsx(Td,{ref:t,className:ie("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-white dark:bg-gray-800 p-1 text-gray-900 dark:text-gray-100 shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",a),...e}));nj.displayName=Td.displayName;const rh=E.forwardRef(({className:a,sideOffset:e=4,...t},s)=>h.jsx(Tf,{children:h.jsx(Ad,{ref:s,sideOffset:e,className:ie("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-white dark:bg-gray-800 p-1 text-gray-900 dark:text-gray-100 shadow-lg ring-1 ring-black ring-opacity-5 dark:ring-white dark:ring-opacity-10 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",a),...t})}));rh.displayName=Ad.displayName;const Ms=E.forwardRef(({className:a,inset:e,...t},s)=>h.jsx(Md,{ref:s,className:ie("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-gray-100 dark:focus:bg-gray-700 focus:text-gray-900 dark:focus:text-gray-100 data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e&&"pl-8",a),...t}));Ms.displayName=Md.displayName;const cj=E.forwardRef(({className:a,children:e,checked:t,...s},o)=>h.jsxs(Nd,{ref:o,className:ie("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-gray-100 dark:focus:bg-gray-700 focus:text-gray-900 dark:focus:text-gray-100 data-[disabled]:pointer-events-none data-[disabled]:opacity-50",a),checked:t,...s,children:[h.jsx("span",{"data-codepal-ve-id":"src-components-ui-dropdown-menu-tsx:dropdownmenucheckboxitem:span:98:5","data-codepal-binding-id":"src-components-ui-dropdown-menu-tsx:dropdownmenucheckboxitem:span:98:5","data-codepal-module-id":"src-components-ui-dropdown-menu-tsx","data-codepal-component-id":"src-components-ui-dropdown-menu-tsx:dropdownmenucheckboxitem","data-codepal-source-node-id":"src-components-ui-dropdown-menu-tsx:dropdownmenucheckboxitem:span:98:5","data-codepal-source-file":"src/components/ui/dropdown-menu.tsx","data-codepal-source-line":"98","data-codepal-source-column":"5","data-codepal-source-symbol":"DropdownMenuCheckboxItem",className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:h.jsx(Ld,{children:h.jsx(En,{className:"h-4 w-4"})})}),e]}));cj.displayName=Nd.displayName;const lj=E.forwardRef(({className:a,children:e,...t},s)=>h.jsxs(Id,{ref:s,className:ie("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-gray-100 dark:focus:bg-gray-700 focus:text-gray-900 dark:focus:text-gray-100 data-[disabled]:pointer-events-none data-[disabled]:opacity-50",a),...t,children:[h.jsx("span",{"data-codepal-ve-id":"src-components-ui-dropdown-menu-tsx:dropdownmenuradioitem:span:121:5","data-codepal-binding-id":"src-components-ui-dropdown-menu-tsx:dropdownmenuradioitem:span:121:5","data-codepal-module-id":"src-components-ui-dropdown-menu-tsx","data-codepal-component-id":"src-components-ui-dropdown-menu-tsx:dropdownmenuradioitem","data-codepal-source-node
92-id":"src-components-ui-dropdown-menu-tsx:dropdownmenuradioitem:span:121:5","data-codepal-source-file":"src/components/ui/dropdown-menu.tsx","data-codepal-source-line":"121","data-codepal-source-column":"5","data-codepal-source-symbol":"DropdownMenuRadioItem",className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:h.jsx(Ld,{children:h.jsx(Nf,{className:"h-2 w-2 fill-current"})})}),e]}));lj.displayName=Id.displayName;const dj=E.forwardRef(({className:a,inset:e,...t},s)=>h.jsx(Od,{ref:s,className:ie("px-2 py-1.5 text-sm font-semibold text-gray-900 dark:text-gray-100",e&&"pl-8",a),...t}));dj.displayName=Od.displayName;const ih=E.forwardRef(({className:a,...e},t)=>h.jsx(Ed,{ref:t,className:ie("-mx-1 my-1 h-px bg-gray-200 dark:bg-gray-700",a),...e}));ih.displayName=Ed.displayName;const nh=Fs.memo(({onRunCode:a,onNewFile:e,onCollapseAll:t,onExpandAll:s,onDownloadProject:o})=>{je(c=>c.isRunning),je(c=>c.setIsRunning),je(c=>c.setIsTerminalOpen);const r=ge(c=>c.isSendingMessage),i=ge(c=>c.activeStreamingMessageId),n=r||i!==null;return h.jsxs("div",{"data-codepal-ve-id":"src-pages-project-codeviewer-fileexplorerheader-tsx:fileexplorerheader:div:57:9","data-codepal-binding-id":"src-pages-project-codeviewer-fileexplorerheader-tsx:fileexplorerheader:div:57:9","data-codepal-module-id":"src-pages-project-codeviewer-fileexplorerheader-tsx","data-codepal-component-id":"src-pages-project-codeviewer-fileexplorerheader-tsx:fileexplorerheader","data-codepal-source-node-id":"src-pages-project-codeviewer-fileexplorerheader-tsx:fileexplorerheader:div:57:9","data-codepal-source-file":"src/pages/Project/CodeViewer/FileExplorerHeader.tsx","data-codepal-source-line":"57","data-codepal-source-column":"9","data-codepal-source-symbol":"FileExplorerHeader",className:"h-10 px-4 border-b border-t border-gray-200 dark:border-gray-700 bg-gray-100 dark:bg-gray-800 flex items-center justify-between",children:[h.jsxs("div",{"data-codepal-ve-id":"src-pages-project-codeviewer-fileexplorerheader-tsx:fileexplorerheader:div:60:13","data-codepal-binding-id":"src-pages-project-codeviewer-fileexplorerheader-tsx:fileexplorerheader:div:60:13","data-codepal-module-id":"src-pages-project-codeviewer-fileexplorerheader-tsx","data-codepal-component-id":"src-pages-project-codeviewer-fileexplorerheader-tsx:fileexplorerheader","data-codepal-source-node-id":"src-pages-project-codeviewer-fileexplorerheader-tsx:fileexplorerheader:div:60:13","data-codepal-source-file":"src/pages/Project/CodeViewer/FileExplorerHeader.tsx","data-codepal-source-line":"60","data-codepal-source-column":"13","data-codepal-source-symbol":"FileExplorerHeader",className:"flex items-center gap-2",children:[h.jsx(Mn,{className:"w-4 h-4 text-gray-600 dark:text-gray-400"}),h.jsx("span",{"data-codepal-ve-id":"src-pages-project-codeviewer-fileexplorerheader-tsx:fileexplorerheader:span:62:17","data-codepal-binding-id":"src-pages-project-codeviewer-fileexplorerheader-tsx:fileexplorerheader:span:62:17","data-codepal-module-id":"src-pages-project-codeviewer-fileexplorerheader-tsx","data-codepal-component-id":"src-pages-project-codeviewer-fileexplorerheader-tsx:fileexplorerheader","data-codepal-source-node-id":"src-pages-project-codeviewer-fileexplorerheader-tsx:fileexplorerheader:span:62:17","data-codepal-source-file":"src/pages/Project/CodeViewer/FileExplorerHeader.tsx","data-codepal-source-line":"62","data-codepal-source-column":"17","data-codepal-source-symbol":"FileExplorerHeader",className:"font-medium text-gray-800 dark:text-gray-200",children:"Files"})]}),h.jsx("div",{"data-codepal-ve-id":"src-pages-project-codeviewer-fileexplorerheader-tsx:fileexplorerheader:div:68:13","data-codepal-binding-id":"src-pages-project-codeviewer-fileexplorerheader-tsx:fileexplorerheader:div:68:13","data-codepal-module-id":"src-pages-project-codeviewer-fileexplorerheader-tsx","data-codepal-component-id":"src-pages-project-codeviewer-fileexplorerheader-tsx:fileexplorerheader","data-codepal-source-node-id":"src-pages-project-codeviewer-fileexplorerheader-tsx:fileexplorerheader:div:68:13","data-codepal-source-file":"src/pages/Project/CodeViewer/FileExplorerHeader.tsx","data-codepal-source-line":"68","data-codepal-source-column":"13","data-codepal-source-symbol":"FileExplorerHeader",className:"flex items-center gap-1",children:h.jsxs(oj,{children:[h.jsx(rj,{asChild:!0,children:h.jsx(yt,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 text-gray-500 hover:text-gray-700 hover:bg-gray-100 dark:text-gray-400 dark:hover:text-gray-300 dark:hover:bg-gray-700",disabled:n,children:h.jsx(hm,{className:"w-4 h-4 text-gray-600 dark:text-gray-400"})})}),h.jsxs(rh,{align:"end",className:"w-48 dark:bg-gray-800 dark:border-gray-700",children:[h.jsxs(Ms,{onClick:e,className:"dark:text-gray-300 dark:hover:bg-gray-700 dark:focus:bg-gray-700",children:[h.jsx(rm,{className:"w-4 h-4 mr-2"}),"New file"]}),h.jsxs(Ms,{onClick:o,className:"dark:text-gray-300 dark:hover:bg-gray-700 dark:focus:bg-gray-700",children:[h.jsx(Si,{className:"w-4 h-4 mr-2"}),"Download project"]}),(t||s)&&h.jsx(ih,{className:"dark:bg-gray-700"}),t&&h.jsxs(Ms,{onClick:t,className:"dark:text-gray-300 dark:hover:bg-gray-700 dark:focus:bg-gray-700",children:[h.jsx(Mm,{className:"w-4 h-4 mr-2"}),"Collapse all folders"]}),s&&h.jsxs(Ms,{onClick:s,className:"dark:text-gray-300 dark:hover:bg-gray-700 dark:focus:bg-gray-700",children:[h.jsx(Em,{className:"w-4 h-4 mr-2"}),"Expand all folders"]})]})]})})]})});nh.displayName="FileExplorerHeader";function Wo(a){throw new Error('Could not dynamically require "'+a+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var bi={exports:{}};/*! 93 94JSZip v3.10.1 - A JavaScript class for generating and reading zip files 95<http://stuartk.com/jszip> 96
97(c) 2009-2016 Stuart Knightley <stuart [at] stuartk.com> 98Dual licenced under the MIT license or GPLv3. See https://raw.github.com/Stuk/jszip/main/LICENSE.markdown. 99 100JSZip uses the library pako released under the MIT license : 101https://github.com/nodeca/pako/blob/main/LICENSE 102*/var od;function pj(){return od||(od=1,(function(a,e){(function(t){a.exports=t()})(function(){return(function t(s,o,r){function i(l,d){if(!o[l]){if(!s[l]){var p=typeof Wo=="function"&&Wo;if(!d&&p)return p(l,!0);if(n)return n(l,!0);var u=new Error("Cannot find module '"+l+"'");throw u.code="MODULE_NOT_FOUND",u}var f=o[l]={exports:{}};s[l][0].call(f.exports,function(m){var g=s[l][1][m];return i(g||m)},f,f.exports,t,s,o,r)}return o[l].exports}for(var n=typeof Wo=="function"&&Wo,c=0;c<r.length;c++)i(r[c]);return i})({1:[function(t,s,o){var r=t("./utils"),i=t("./support"),n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";o.encode=function(c){for(var l,d,p,u,f,m,g,x=[],b=0,y=c.length,k=y,A=r.getTypeOf(c)!=="string";b<c.length;)k=y-b,p=A?(l=c[b++],d=b<y?c[b++]:0,b<y?c[b++]:0):(l=c.charCodeAt(b++),d=b<y?c.charCodeAt(b++):0,b<y?c.charCodeAt(b++):0),u=l>>2,f=(3&l)<<4|d>>4,m=1<k?(15&d)<<2|p>>6:64,g=2<k?63&p:64,x.push(n.charAt(u)+n.charAt(f)+n.charAt(m)+n.charAt(g));return x.join("")},o.decode=function(c){var l,d,p,u,f,m,g=0,x=0,b="data:";if(c.substr(0,b.length)===b)throw new Error("Invalid base64 input, it looks like a data url.");var y,k=3*(c=c.replace(/[^A-Za-z0-9+/=]/g,"")).length/4;if(c.charAt(c.length-1)===n.charAt(64)&&k--,c.charAt(c.length-2)===n.charAt(64)&&k--,k%1!=0)throw new Error("Invalid base64 input, bad content length.");for(y=i.uint8array?new Uint8Array(0|k):new Array(0|k);g<c.length;)l=n.indexOf(c.charAt(g++))<<2|(u=n.indexOf(c.charAt(g++)))>>4,d=(15&u)<<4|(f=n.indexOf(c.charAt(g++)))>>2,p=(3&f)<<6|(m=n.indexOf(c.charAt(g++))),y[x++]=l,f!==64&&(y[x++]=d),m!==64&&(y[x++]=p);return y}},{"./support":30,"./utils":32}],2:[function(t,s,o){var r=t("./external"),i=t("./stream/DataWorker"),n=t("./stream/Crc32Probe"),c=t("./stream/DataLengthProbe");function l(d,p,u,f,m){this.compressedSize=d,this.uncompressedSize=p,this.crc32=u,this.compression=f,this.compressedContent=m}l.prototype={getContentWorker:function(){var d=new i(r.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new c("data_length")),p=this;return d.on("end",function(){if(this.streamInfo.data_length!==p.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),d},getCompressedWorker:function(){return new i(r.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},l.createWorkerFrom=function(d,p,u){return d.pipe(new n).pipe(new c("uncompressedSize")).pipe(p.compressWorker(u)).pipe(new c("compressedSize")).withStreamInfo("compression",p)},s.exports=l},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(t,s,o){var r=t("./stream/GenericWorker");o.STORE={magic:"\0\0",compressWorker:function(){return new r("STORE compression")},uncompressWorker:function(){return new r("STORE decompression")}},o.DEFLATE=t("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(t,s,o){var r=t("./utils"),i=(function(){for(var n,c=[],l=0;l<256;l++){n=l;for(var d=0;d<8;d++)n=1&n?3988292384^n>>>1:n>>>1;c[l]=n}return c})();s.exports=function(n,c){return n!==void 0&&n.length?r.getTypeOf(n)!=="string"?(function(l,d,p,u){var f=i,m=u+p;l^=-1;for(var g=u;g<m;g++)l=l>>>8^f[255&(l^d[g])];return-1^l})(0|c,n,n.length,0):(function(l,d,p,u){var f=i,m=u+p;l^=-1;for(var g=u;g<m;g++)l=l>>>8^f[255&(l^d.charCodeAt(g))];return-1^l})(0|c,n,n.length,0):0}},{"./utils":32}],5:[function(t,s,o){o.base64=!1,o.binary=!1,o.dir=!1,o.createFolders=!0,o.date=null,o.compression=null,o.compressionOptions=null,o.comment=null,o.unixPermissions=null,o.dosPermissions=null},{}],6:[function(t,s,o){var r=null;r=typeof Promise<"u"?Promise:t("lie"),s.exports={Promise:r}},{lie:37}],7:[function(t,s,o){var r=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",i=t("pako"),n=t("./utils"),c=t("./stream/GenericWorker"),l=r?"uint8array":"array";function d(p,u){c.call(this,"FlateWorker/"+p),this._pako=null,this._pakoAction=p,this._pakoOptions=u,this.meta={}}o.magic="\b\0",n.inherits(d,c),d.prototype.processChunk=function(p){this.meta=p.meta,this._pako===null&&this._createPako(),this._pako.push(n.transformTo(l,p.data),!1)},d.prototype.flush=function(){c.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)}
vendor: 4,936 bytes, lines 102-103
102,d.prototype.cleanUp=function(){c.prototype.cleanUp.call(this),this._pako=null},d.prototype._createPako=function(){this._pako=new i[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var p=this;this._pako.onData=function(u){p.push({data:u,meta:p.meta})}},o.compressWorker=function(p){return new d("Deflate",p)},o.uncompressWorker=function(){return new d("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(t,s,o){function r(f,m){var g,x="";for(g=0;g<m;g++)x+=String.fromCharCode(255&f),f>>>=8;return x}function i(f,m,g,x,b,y){var k,A,S=f.file,N=f.compression,D=y!==l.utf8encode,L=n.transformTo("string",y(S.name)),M=n.transformTo("string",l.utf8encode(S.name)),B=S.comment,V=n.transformTo("string",y(B)),P=n.transformTo("string",l.utf8encode(B)),F=M.length!==S.name.length,j=P.length!==B.length,z="",ce="",$="",K=S.dir,I=S.date,X={crc32:0,compressedSize:0,uncompressedSize:0};m&&!g||(X.crc32=f.crc32,X.compressedSize=f.compressedSize,X.uncompressedSize=f.uncompressedSize);var T=0;m&&(T|=8),D||!F&&!j||(T|=2048);var O=0,Z=0;K&&(O|=16),b==="UNIX"?(Z=798,O|=(function(se,Ae){var Ie=se;return se||(Ie=Ae?16893:33204),(65535&Ie)<<16})(S.unixPermissions,K)):(Z=20,O|=(function(se){return 63&(se||0)})(S.dosPermissions)),k=I.getUTCHours(),k<<=6,k|=I.getUTCMinutes(),k<<=5,k|=I.getUTCSeconds()/2,A=I.getUTCFullYear()-1980,A<<=4,A|=I.getUTCMonth()+1,A<<=5,A|=I.getUTCDate(),F&&(ce=r(1,1)+r(d(L),4)+M,z+="up"+r(ce.length,2)+ce),j&&($=r(1,1)+r(d(V),4)+P,z+="uc"+r($.length,2)+$);var oe="";return oe+=` 103\0`,oe+=r(T,2),oe+=N.magic,oe+=r(k,2),oe+=r(A,2),oe+=r(X.crc32,4),oe+=r(X.compressedSize,4),oe+=r(X.uncompressedSize,4),oe+=r(L.length,2),oe+=r(z.length,2),{fileRecord:p.LOCAL_FILE_HEADER+oe+L+z,dirRecord:p.CENTRAL_FILE_HEADER+r(Z,2)+oe+r(V.length,2)+"\0\0\0\0"+r(O,4)+r(x,4)+L+z+V}}var n=t("../utils"),c=t("../stream/GenericWorker"),l=t("../utf8"),d=t("../crc32"),p=t("../signature");function u(f,m,g,x){c.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=m,this.zipPlatform=g,this.encodeFileName=x,this.streamFiles=f,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}n.inherits(u,c),u.prototype.push=function(f){var m=f.meta.percent||0,g=this.entriesCount,x=this._sources.length;this.accumulate?this.contentBuffer.push(f):(this.bytesWritten+=f.data.length,c.prototype.push.call(this,{data:f.data,meta:{currentFile:this.currentFile,percent:g?(m+100*(g-x-1))/g:100}}))},u.prototype.openedSource=function(f){this.currentSourceOffset=this.bytesWritten,this.currentFile=f.file.name;var m=this.streamFiles&&!f.file.dir;if(m){var g=i(f,m,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:g.fileRecord,meta:{percent:0}})}else this.accumulate=!0},u.prototype.closedSource=function(f){this.accumulate=!1;var m=this.streamFiles&&!f.file.dir,g=i(f,m,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(g.dirRecord),m)this.push({data:(function(x){return p.DATA_DESCRIPTOR+r(x.crc32,4)+r(x.compressedSize,4)+r(x.uncompressedSize,4)})(f),meta:{percent:100}});else for(this.push({data:g.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},u.prototype.flush=function(){for(var f=this.bytesWritten,m=0;m<this.dirRecords.length;m++)this.push({data:this.dirRecords[m],meta:{percent:100}});var g=this.bytesWritten-f,x=(function(b,y,k,A,S){var N=n.transformTo("string",S(A));return p.CENTRAL_DIRECTORY_END+"\0\0\0\0"+r(b,2)+r(b,2)+r(y,4)+r(k,4)+r(N.length,2)+N})(this.dirRecords.length,g,f,this.zipComment,this.encodeFileName);this.push({data:x,meta:{percent:100}})},u.prototype.prepareNextSource=function(){this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused?this.previous.pause():this.previous.resume()},u.prototype.registerPrevious=function(f){this._sources.push(f);var m=this;return f.on("data",function(g){m.processChunk(g)}),f.on("end",function(){m.closedSource(m.previous.streamInfo),m._sources.length?m.prepareNextSource():m.end()}),f.on("error",function(g){m.error(g)}),this},u.prototype.resume=function(){return!!c.prototype.resume.call(this)&&(!this.previous&&this._sources.length?(this.prepareNextSource(),!0):this.previous||this._sources.length||this.generatedError?void 0:(this.end(),!0))},u.prototype.error=function(f){var m=this._sources;if(!c.prototype.error.call(this,f))return!1;for(var g=0;g<m.length;g++)try{m[g].error(f)}catch{}return!0},u.prototype.lock=function(){c.prototype.lock.call(this);for(var f=this._sources,m=0;m<f.length;m++)f[m].lock()},s.exports=u},{"../crc32":4,"../signature":23,"../stream/GenericWorker":28,"../utf8":31,"../utils":32}],9:[function(t,s,o){var r=t("../compressions"),i=t("./ZipFileWorker");o.generateWorker=function(n,c,l){var d=new i(c.streamFiles,l,c.platform,c.encodeFileName),p=0;
vendor: 47,060 bytes, line 103
103try{n.forEach(function(u,f){p++;var m=(function(y,k){var A=y||k,S=r[A];if(!S)throw new Error(A+" is not a valid compression method !");return S})(f.options.compression,c.compression),g=f.options.compressionOptions||c.compressionOptions||{},x=f.dir,b=f.date;f._compressWorker(m,g).withStreamInfo("file",{name:u,dir:x,date:b,comment:f.comment||"",unixPermissions:f.unixPermissions,dosPermissions:f.dosPermissions}).pipe(d)}),d.entriesCount=p}catch(u){d.error(u)}return d}},{"../compressions":3,"./ZipFileWorker":8}],10:[function(t,s,o){function r(){if(!(this instanceof r))return new r;if(arguments.length)throw new Error("The constructor with parameters has been removed in JSZip 3.0, please check the upgrade guide.");this.files=Object.create(null),this.comment=null,this.root="",this.clone=function(){var i=new r;for(var n in this)typeof this[n]!="function"&&(i[n]=this[n]);return i}}(r.prototype=t("./object")).loadAsync=t("./load"),r.support=t("./support"),r.defaults=t("./defaults"),r.version="3.10.1",r.loadAsync=function(i,n){return new r().loadAsync(i,n)},r.external=t("./external"),s.exports=r},{"./defaults":5,"./external":6,"./load":11,"./object":15,"./support":30}],11:[function(t,s,o){var r=t("./utils"),i=t("./external"),n=t("./utf8"),c=t("./zipEntries"),l=t("./stream/Crc32Probe"),d=t("./nodejsUtils");function p(u){return new i.Promise(function(f,m){var g=u.decompressed.getContentWorker().pipe(new l);g.on("error",function(x){m(x)}).on("end",function(){g.streamInfo.crc32!==u.decompressed.crc32?m(new Error("Corrupted zip : CRC32 mismatch")):f()}).resume()})}s.exports=function(u,f){var m=this;return f=r.extend(f||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:n.utf8decode}),d.isNode&&d.isStream(u)?i.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")):r.prepareContent("the loaded zip file",u,!0,f.optimizedBinaryString,f.base64).then(function(g){var x=new c(f);return x.load(g),x}).then(function(g){var x=[i.Promise.resolve(g)],b=g.files;if(f.checkCRC32)for(var y=0;y<b.length;y++)x.push(p(b[y]));return i.Promise.all(x)}).then(function(g){for(var x=g.shift(),b=x.files,y=0;y<b.length;y++){var k=b[y],A=k.fileNameStr,S=r.resolve(k.fileNameStr);m.file(S,k.decompressed,{binary:!0,optimizedBinaryString:!0,date:k.date,dir:k.dir,comment:k.fileCommentStr.length?k.fileCommentStr:null,unixPermissions:k.unixPermissions,dosPermissions:k.dosPermissions,createFolders:f.createFolders}),k.dir||(m.file(S).unsafeOriginalName=A)}return x.zipComment.length&&(m.comment=x.zipComment),m})}},{"./external":6,"./nodejsUtils":14,"./stream/Crc32Probe":25,"./utf8":31,"./utils":32,"./zipEntries":33}],12:[function(t,s,o){var r=t("../utils"),i=t("../stream/GenericWorker");function n(c,l){i.call(this,"Nodejs stream input adapter for "+c),this._upstreamEnded=!1,this._bindStream(l)}r.inherits(n,i),n.prototype._bindStream=function(c){var l=this;(this._stream=c).pause(),c.on("data",function(d){l.push({data:d,meta:{percent:0}})}).on("error",function(d){l.isPaused?this.generatedError=d:l.error(d)}).on("end",function(){l.isPaused?l._upstreamEnded=!0:l.end()})},n.prototype.pause=function(){return!!i.prototype.pause.call(this)&&(this._stream.pause(),!0)},n.prototype.resume=function(){return!!i.prototype.resume.call(this)&&(this._upstreamEnded?this.end():this._stream.resume(),!0)},s.exports=n},{"../stream/GenericWorker":28,"../utils":32}],13:[function(t,s,o){var r=t("readable-stream").Readable;function i(n,c,l){r.call(this,c),this._helper=n;var d=this;n.on("data",function(p,u){d.push(p)||d._helper.pause(),l&&l(u)}).on("error",function(p){d.emit("error",p)}).on("end",function(){d.push(null)})}t("../utils").inherits(i,r),i.prototype._read=function(){this._helper.resume()},s.exports=i},{"../utils":32,"readable-stream":16}],14:[function(t,s,o){s.exports={isNode:typeof Buffer<"u",newBufferFrom:function(r,i){if(Buffer.from&&Buffer.from!==Uint8Array.from)return Buffer.from(r,i);if(typeof r=="number")throw new Error('The "data" argument must not be a number');return new Buffer(r,i)},allocBuffer:function(r){if(Buffer.alloc)return Buffer.alloc(r);var i=new Buffer(r);return i.fill(0),i},isBuffer:function(r){return Buffer.isBuffer(r)},isStream:function(r){return r&&typeof r.on=="function"&&typeof r.pause=="function"&&typeof r.resume=="function"}}},{}],15:[function(t,s,o){function r(S,N,D){var L,M=n.getTypeOf(N),B=n.extend(D||{},d);B.date=B.date||new Date,B.compression!==null&&(B.compression=B.compression.toUpperCase()),typeof B.unixPermissions=="string"&&(B.unixPermissions=parseInt(B.unixPermissions,8)),B.unixPermissions&&16384&B.unixPermissions&&(B.dir=!0),B.dosPermissions&&16&B.dosPermissions&&(B.dir=!0),B.dir&&(S=b(S)),B.createFolders&&(L=x(S))&&y.call(this,L,!0);var V=M==="string"&&B.binary===!1&&B.base64===!1;D&&D.binary!==void 0||(B.binary=!V),(N instanceof p&&N.uncompressedSize===0||B.dir||!N||N.length===0)&&(B.base64=!1,B.binary=!0,N="",B.compression="STORE",M="string");var P=null;P=N instanceof p||N instanceof c?N:m.isNode&&m.isStream(N)?new g(S,N):n.prepareContent(S,N,B.binary,B.optimizedBinaryString,B.base64);var F=new u(S,P,B);this.files[S]=F}var i=t("./utf8"),n=t("./utils"),c=t("./stream/GenericWorker"),l=t("./stream/StreamHelper"),d=t("./defaults"),p=t("./compressedObject"),u=t("./zipObject"),f=t("./generate"),m=t("./nodejsUtils"),g=t("./nodejs/NodejsStreamInputAdapter"),x=function(S){S.slice(-1)==="/"&&(S=S.substring(0,S.length-1));var N=S.lastIndexOf("/");return 0<N?S.substring(0,N):""},b=function(S){return S.slice(-1)!=="/"&&(S+="/"),S},y=function(S,N){return N=N!==void 0?N:d.createFolders,S=b(S),this.files[S]||r.call(this,S,null,{dir:!0,createFolders:N}),this.files[S]};function k(S){return Object.prototype.toString.call(S)==="[object RegExp]"}var A={load:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},forEach:function(S){var N,D,L;for(N in this.files)L=this.files[N],(D=N.slice(this.root.length,N.length))&&N.slice(0,this.root.length)===this.root&&S(D,L)},filter:function(S){var N=[];return this.forEach(function(D,L){S(D,L)&&N.push(L)}),N},file:function(S,N,D){if(arguments.length!==1)return S=this.root+S,r.call(this,S,N,D),this;if(k(S)){var L=S;return this.filter(function(B,V){return!V.dir&&L.test(B)})}var M=this.files[this.root+S];return M&&!M.dir?M:null},folder:function(S){if(!S)return this;if(k(S))return this.filter(function(M,B){return B.dir&&S.test(M)});var N=this.root+S,D=y.call(this,N),L=this.clone();return L.root=D.name,L},remove:function(S){S=this.root+S;var N=this.files[S];if(N||(S.slice(-1)!=="/"&&(S+="/"),N=this.files[S]),N&&!N.dir)delete this.files[S];else for(var D=this.filter(function(M,B){return B.name.slice(0,S.length)===S}),L=0;L<D.length;L++)delete this.files[D[L].name];return this},generate:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},generateInternalStream:function(S){var N,D={};try{if((D=n.extend(S||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:i.utf8encode})).type=D.type.toLowerCase(),D.compression=D.compression.toUpperCase(),D.type==="binarystring"&&(D.type="string"),!D.type)throw new Error("No output type specified.");n.checkSupport(D.type),D.platform!=="darwin"&&D.platform!=="freebsd"&&D.platform!=="linux"&&D.platform!=="sunos"||(D.platform="UNIX"),D.platform==="win32"&&(D.platform="DOS");var L=D.comment||this.comment||"";N=f.generateWorker(this,D,L)}catch(M){(N=new c("error")).error(M)}return new l(N,D.type||"string",D.mimeType)},generateAsync:function(S,N){return this.generateInternalStream(S).accumulate(N)},generateNodeStream:function(S,N){return(S=S||{}).type||(S.type="nodebuffer"),this.generateInternalStream(S).toNodejsStream(N)}};s.exports=A},{"./compressedObject":2,"./defaults":5,"./generate":9,"./nodejs/NodejsStreamInputAdapter":12,"./nodejsUtils":14,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31,"./utils":32,"./zipObject":35}],16:[function(t,s,o){s.exports=t("stream")},{stream:void 0}],17:[function(t,s,o){var r=t("./DataReader");function i(n){r.call(this,n);for(var c=0;c<this.data.length;c++)n[c]=255&n[c]}t("../utils").inherits(i,r),i.prototype.byteAt=function(n){return this.data[this.zero+n]},i.prototype.lastIndexOfSignature=function(n){for(var c=n.charCodeAt(0),l=n.charCodeAt(1),d=n.charCodeAt(2),p=n.charCodeAt(3),u=this.length-4;0<=u;--u)if(this.data[u]===c&&this.data[u+1]===l&&this.data[u+2]===d&&this.data[u+3]===p)return u-this.zero;return-1},i.prototype.readAndCheckSignature=function(n){var c=n.charCodeAt(0),l=n.charCodeAt(1),d=n.charCodeAt(2),p=n.charCodeAt(3),u=this.readData(4);return c===u[0]&&l===u[1]&&d===u[2]&&p===u[3]},i.prototype.readData=function(n){if(this.checkOffset(n),n===0)return[];var c=this.data.slice(this.zero+this.index,this.zero+this.index+n);return this.index+=n,c},s.exports=i},{"../utils":32,"./DataReader":18}],18:[function(t,s,o){var r=t("../utils");function i(n){this.data=n,this.length=n.length,this.index=0,this.zero=0}i.prototype={checkOffset:function(n){this.checkIndex(this.index+n)},checkIndex:function(n){if(this.length<this.zero+n||n<0)throw new Error("End of data reached (data length = "+this.length+", asked index = "+n+"). Corrupted zip ?")},setIndex:function(n){this.checkIndex(n),this.index=n},skip:function(n){this.setIndex(this.index+n)},byteAt:function(){},readInt:function(n){var c,l=0;for(this.checkOffset(n),c=this.index+n-1;c>=this.index;c--)l=(l<<8)+this.byteAt(c);return this.index+=n,l},readString:function(n){return r.transformTo("string",this.readData(n))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var n=this.readInt(4);return new Date(Date.UTC(1980+(n>>25&127),(n>>21&15)-1,n>>16&31,n>>11&31,n>>5&63,(31&n)<<1))}},s.exports=i},{"../utils":32}],19:[function(t,s,o){var r=t("./Uint8ArrayReader");function i(n){r.call(this,n)}t("../utils").inherits(i,r),i.prototype.readData=function(n){this.checkOffset(n);var c=this.data.slice(this.zero+this.index,this.zero+this.index+n);return this.index+=n,c},s.exports=i},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(t,s,o){var r=t("./DataReader");function i(n){r.call(this,n)}t("../utils").inherits(i,r),i.prototype.byteAt=function(n){return this.data.charCodeAt(this.zero+n)},i.prototype.lastIndexOfSignature=function(n){return this.data.lastIndexOf(n)-this.zero},i.prototype.readAndCheckSignature=function(n){return n===this.readData(4)},i.prototype.readData=function(n){this.checkOffset(n);var c=this.data.slice(this.zero+this.index,this.zero+this.index+n);return this.index+=n,c},s.exports=i},{"../utils":32,"./DataReader":18}],21:[function(t,s,o){var r=t("./ArrayReader");function i(n){r.call(this,n)}t("../utils").inherits(i,r),i.prototype.readData=function(n){if(this.checkOffset(n),n===0)return new Uint8Array(0);var c=this.data.subarray(this.zero+this.index,this.zero+this.index+n);return this.index+=n,c},s.exports=i},{"../utils":32,"./ArrayReader":17}],22:[function(t,s,o){var r=t("../utils"),i=t("../support"),n=t("./ArrayReader"),c=t("./StringReader"),l=t("./NodeBufferReader"),d=t("./Uint8ArrayReader");s.exports=function(p){var u=r.getTypeOf(p);return r.checkSupport(u),u!=="string"||i.uint8array?u==="nodebuffer"?new l(p):i.uint8array?new d(r.transformTo("uint8array",p)):new n(r.transformTo("array",p)):new c(p)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(t,s,o){o.LOCAL_FILE_HEADER="PK��",o.CENTRAL_FILE_HEADER="PK��",o.CENTRAL_DIRECTORY_END="PK��",o.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK�\x07",o.ZIP64_CENTRAL_DIRECTORY_END="PK��",o.DATA_DESCRIPTOR="PK\x07\b"},{}],24:[function(t,s,o){var r=t("./GenericWorker"),i=t("../utils");function n(c){r.call(this,"ConvertWorker to "+c),this.destType=c}i.inherits(n,r),n.prototype.processChunk=function(c){this.push({data:i.transformTo(this.destType,c.data),meta:c.meta})},s.exports=n},{"../utils":32,"./GenericWorker":28}],25:[function(t,s,o){var r=t("./GenericWorker"),i=t("../crc32");function n(){r.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}t("../utils").inherits(n,r),n.prototype.processChunk=function(c){this.streamInfo.crc32=i(c.data,this.streamInfo.crc32||0),this.push(c)},s.exports=n},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(t,s,o){var r=t("../utils"),i=t("./GenericWorker");function n(c){i.call(this,"DataLengthProbe for "+c),this.propName=c,this.withStreamInfo(c,0)}r.inherits(n,i),n.prototype.processChunk=function(c){if(c){var l=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=l+c.data.length}i.prototype.processChunk.call(this,c)},s.exports=n},{"../utils":32,"./GenericWorker":28}],27:[function(t,s,o){var r=t("../utils"),i=t("./GenericWorker");function n(c){i.call(this,"DataWorker");var l=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,c.then(function(d){l.dataIsReady=!0,l.data=d,l.max=d&&d.length||0,l.type=r.getTypeOf(d),l.isPaused||l._tickAndRepeat()},function(d){l.error(d)})}r.inherits(n,i),n.prototype.cleanUp=function(){i.prototype.cleanUp.call(this),this.data=null},n.prototype.resume=function(){return!!i.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,r.delay(this._tickAndRepeat,[],this)),!0)},n.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(r.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},n.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var c=null,l=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":c=this.data.substring(this.index,l);break;case"uint8array":c=this.data.subarray(this.index,l);break;case"array":case"nodebuffer":c=this.data.slice(this.index,l)}return this.index=l,this.push({data:c,meta:{percent:this.max?this.index/this.max*100:0}})},s.exports=n},{"../utils":32,"./GenericWorker":28}],28:[function(t,s,o){function r(i){this.name=i||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}r.prototype={push:function(i){this.emit("data",i)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(i){this.emit("error",i)}return!0},error:function(i){return!this.isFinished&&(this.isPaused?this.generatedError=i:(this.isFinished=!0,this.emit("error",i),this.previous&&this.previous.error(i),this.cleanUp()),!0)},on:function(i,n){return this._listeners[i].push(n),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(i,n){if(this._listeners[i])for(var c=0;c<this._listeners[i].length;c++)this._listeners[i][c].call(this,n)},pipe:function(i){return i.registerPrevious(this)},registerPrevious:function(i){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.streamInfo=i.streamInfo,this.mergeStreamInfo(),this.previous=i;var n=this;return i.on("data",function(c){n.processChunk(c)}),i.on("end",function(){n.end()}),i.on("error",function(c){n.error(c)}),this},pause:function(){return!this.isPaused&&!this.isFinished&&(this.isPaused=!0,this.previous&&this.previous.pause(),!0)},resume:function(){if(!this.isPaused||this.isFinished)return!1;var i=this.isPaused=!1;return this.generatedError&&(this.error(this.generatedError),i=!0),this.previous&&this.previous.resume(),!i},flush:function(){},processChunk:function(i){this.push(i)},withStreamInfo:function(i,n){return this.extraStreamInfo[i]=n,this.mergeStreamInfo(),this},mergeStreamInfo:function(){for(var i in this.extraStreamInfo)Object.prototype.hasOwnProperty.call(this.extraStreamInfo,i)&&(this.streamInfo[i]=this.extraStreamInfo[i])},lock:function(){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.isLocked=!0,this.previous&&this.previous.lock()},toString:function(){var i="Worker "+this.name;return this.previous?this.previous+" -> "+i:i}},s.exports=r},{}],29:[function(t,s,o){var r=t("../utils"),i=t("./ConvertWorker"),n=t("./GenericWorker"),c=t("../base64"),l=t("../support"),d=t("../external"),p=null;if(l.nodestream)try{p=t("../nodejs/NodejsStreamOutputAdapter")}catch{}function u(m,g){return new d.Promise(function(x,b){var y=[],k=m._internalType,A=m._outputType,S=m._mimeType;m.on("data",function(N,D){y.push(N),g&&g(D)}).on("error",function(N){y=[],b(N)}).on("end",function(){try{var N=(function(D,L,M){switch(D){case"blob":return r.newBlob(r.transformTo("arraybuffer",L),M);case"base64":return c.encode(L);default:return r.transformTo(D,L)}})(A,(function(D,L){var M,B=0,V=null,P=0;for(M=0;M<L.length;M++)P+=L[M].length;switch(D){case"string":return L.join("");case"array":return Array.prototype.concat.apply([],L);case"uint8array":for(V=new Uint8Array(P),M=0;M<L.length;M++)V.set(L[M],B),B+=L[M].length;return V;case"nodebuffer":return Buffer.concat(L);default:throw new Error("concat : unsupported type '"+D+"'")}})(k,y),S);x(N)}catch(D){b(D)}y=[]}).resume()})}function f(m,g,x){var b=g;switch(g){case"blob":case"arraybuffer":b="uint8array";break;case"base64":b="string"}try{this._internalType=b,this._outputType=g,this._mimeType=x,r.checkSupport(b),this._worker=m.pipe(new i(b)),m.lock()}catch(y){this._worker=new n("error"),this._worker.error(y)}}f.prototype={accumulate:function(m){return u(this,m)},on:function(m,g){var x=this;return m==="data"?this._worker.on(m,function(b){g.call(x,b.data,b.meta)}):this._worker.on(m,function(){r.delay(g,arguments,x)}),this},resume:function(){return r.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function(m){if(r.checkSupport("nodestream"),this._outputType!=="nodebuffer")throw new Error(this._outputType+" is not supported by this method");return new p(this,{objectMode:this._outputType!=="nodebuffer"},m)}},s.exports=f},{"../base64":1,"../external":6,"../nodejs/NodejsStreamOutputAdapter":13,"../support":30,"../utils":32,"./ConvertWorker":24,"./GenericWorker":28}],30:[function(t,s,o){if(o.base64=!0,o.array=!0,o.string=!0,o.arraybuffer=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u",o.nodebuffer=typeof Buffer<"u",o.uint8array=typeof Uint8Array<"u",typeof ArrayBuffer>"u")o.blob=!1;else{var r=new ArrayBuffer(0);try{o.blob=new Blob([r],{type:"application/zip"}).size===0}catch{try{var i=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);i.append(r),o.blob=i.getBlob("application/zip").size===0}catch{o.blob=!1}}}try{o.nodestream=!!t("readable-stream").Readable}catch{o.nodestream=!1}},{"readable-stream":16}],31:[function(t,s,o){for(var r=t("./utils"),i=t("./support"),n=t("./nodejsUtils"),c=t("./stream/GenericWorker"),l=new Array(256),d=0;d<256;d++)l[d]=252<=d?6:248<=d?5:240<=d?4:224<=d?3:192<=d?2:1;l[254]=l[254]=1;function p(){c.call(this,"utf-8 decode"),this.leftOver=null}function u(){c.call(this,"utf-8 encode")}o.utf8encode=function(f){return i.nodebuffer?n.newBufferFrom(f,"utf-8"):(function(m){var g,x,b,y,k,A=m.length,S=0;for(y=0;y<A;y++)(64512&(x=m.charCodeAt(y)))==55296&&y+1<A&&(64512&(b=m.charCodeAt(y+1)))==56320&&(x=65536+(x-55296<<10)+(b-56320),y++),S+=x<128?1:x<2048?2:x<65536?3:4;for(g=i.uint8array?new Uint8Array(S):new Array(S),y=k=0;k<S;y++)(64512&(x=m.charCodeAt(y)))==55296&&y+1<A&&(64512&(b=m.charCodeAt(y+1)))==56320&&(x=65536+(x-55296<<10)+(b-56320),y++),x<128?g[k++]=x:(x<2048?g[k++]=192|x>>>6:(x<65536?g[k++]=224|x>>>12:(g[k++]=240|x>>>18,g[k++]=128|x>>>12&63),g[k++]=128|x>>>6&63),g[k++]=128|63&x);return g})(f)},o.utf8decode=function(f){return i.nodebuffer?r.transformTo("nodebuffer",f).toString("utf-8"):(function(m){var g,x,b,y,k=m.length,A=new Array(2*k);for(g=x=0;g<k;)if((b=m[g++])<128)A[x++]=b;else if(4<(y=l[b]))A[x++]=65533,g+=y-1;else{for(b&=y===2?31:y===3?15:7;1<y&&g<k;)b=b<<6|63&m[g++],y--;1<y?A[x++]=65533:b<65536?A[x++]=b:(b-=65536,A[x++]=55296|b>>10&1023,A[x++]=56320|1023&b)}return A.length!==x&&(A.subarray?A=A.subarray(0,x):A.length=x),r.applyFromCharCode(A)})(f=r.transformTo(i.uint8array?"uint8array":"array",f))},r.inherits(p,c),p.prototype.processChunk=function(f){var m=r.transformTo(i.uint8array?"uint8array":"array",f.data);if(this.leftOver&&this.leftOver.length){if(i.uint8array){var g=m;(m=new Uint8Array(g.length+this.leftOver.length)).set(this.leftOver,0),m.set(g,this.leftOver.length)}else m=this.leftOver.concat(m);this.leftOver=null}var x=(function(y,k){var A;for((k=k||y.length)>y.length&&(k=y.length),A=k-1;0<=A&&(192&y[A])==128;)A--;return A<0||A===0?k:A+l[y[A]]>k?A:k})(m),b=m;x!==m.length&&(i.uint8array?(b=m.subarray(0,x),this.leftOver=m.subarray(x,m.length)):(b=m.slice(0,x),this.leftOver=m.slice(x,m.length))),this.push({data:o.utf8decode(b),meta:f.meta})},p.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:o.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},o.Utf8DecodeWorker=p,r.inherits(u,c),u.prototype.processChunk=function(f){this.push({data:o.utf8encode(f.data),meta:f.meta})},o.Utf8EncodeWorker=u},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(t,s,o){var r=t("./support"),i=t("./base64"),n=t("./nodejsUtils"),c=t("./external");function l(g){return g}function d(g,x){for(var b=0;b<g.length;++b)x[b]=255&g.charCodeAt(b);return x}t("setimmediate"),o.newBlob=function(g,x){o.checkSupport("blob");try{return new Blob([g],{type:x})}catch{try{var b=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);return b.append(g),b.getBlob(x)}catch{throw new Error("Bug : can't construct the Blob.")}}};var p={stringifyByChunk:function(g,x,b){var y=[],k=0,A=g.length;if(A<=b)return String.fromCharCode.apply(null,g);for(;k<A;)x==="array"||x==="nodebuffer"?y.push(String.fromCharCode.apply(null,g.slice(k,Math.min(k+b,A)))):y.push(String.fromCharCode.apply(null,g.subarray(k,Math.min(k+b,A)))),k+=b;return y.join("")},stringifyByChar:function(g){for(var x="",b=0;b<g.length;b++)x+=String.fromCharCode(g[b]);return x},applyCanBeUsed:{uint8array:(function(){try{return r.uint8array&&String.fromCharCode.apply(null,new Uint8Array(1)).length===1}catch{return!1}})(),nodebuffer:(function(){try{return r.nodebuffer&&String.fromCharCode.apply(null,n.allocBuffer(1)).length===1}catch{return!1}})()}};function u(g){var x=65536,b=o.getTypeOf(g),y=!0;if(b==="uint8array"?y=p.applyCanBeUsed.uint8array:b==="nodebuffer"&&(y=p.applyCanBeUsed.nodebuffer),y)for(;1<x;)try{return p.stringifyByChunk(g,b,x)}catch{x=Math.floor(x/2)}return p.stringifyByChar(g)}function f(g,x){for(var b=0;b<g.length;b++)x[b]=g[b];return x}o.applyFromCharCode=u;var m={};m.string={string:l,array:function(g){return d(g,new Array(g.length))},arraybuffer:function(g){return m.string.uint8array(g).buffer},uint8array:function(g){return d(g,new Uint8Array(g.length))},nodebuffer:function(g){return d(g,n.allocBuffer(g.length))}},m.array={string:u,array:l,arraybuffer:function(g){return new Uint8Array(g).buffer},uint8array:function(g){return new Uint8Array(g)},nodebuffer:function(g){return n.newBufferFrom(g)}},m.arraybuffer={string:function(g){return u(new Uint8Array(g))},array:function(g){return f(new Uint8Array(g),new Array(g.byteLength))},arraybuffer:l,uint8array:function(g){return new Uint8Array(g)},nodebuffer:function(g){return n.newBufferFrom(new Uint8Array(g))}},m.uint8array={string:u,array:function(g){return f(g,new Array(g.length))},arraybuffer:function(g){return g.buffer},uint8array:l,nodebuffer:function(g){return n.newBufferFrom(g)}},m.nodebuffer={string:u,array:function(g){return f(g,new Array(g.length))},arraybuffer:function(g){return m.nodebuffer.uint8array(g).buffer},uint8array:function(g){return f(g,new Uint8Array(g.length))},nodebuffer:l},o.transformTo=function(g,x){if(x=x||"",!g)return x;o.checkSupport(g);var b=o.getTypeOf(x);return m[b][g](x)},o.resolve=function(g){for(var x=g.split("/"),b=[],y=0;y<x.length;y++){var k=x[y];k==="."||k===""&&y!==0&&y!==x.length-1||(k===".."?b.pop():b.push(k))}return b.join("/")},o.getTypeOf=function(g){return typeof g=="string"?"string":Object.prototype.toString.call(g)==="[object Array]"?"array":r.nodebuffer&&n.isBuffer(g)?"nodebuffer":r.uint8array&&g instanceof Uint8Array?"uint8array":r.arraybuffer&&g instanceof ArrayBuffer?"arraybuffer":void 0},o.checkSupport=function(g){if(!r[g.toLowerCase()])throw new Error(g+" is not supported by this platform")},o.MAX_VALUE_16BITS=65535,o.MAX_VALUE_32BITS=-1,o.pretty=function(g){var x,b,y="";for(b=0;b<(g||"").length;b++)y+="\\x"+((x=g.charCodeAt(b))<16?"0":"")+x.toString(16).toUpperCase();return y},o.delay=function(g,x,b){setImmediate(function(){g.apply(b||null,x||[])})},o.inherits=function(g,x){function b(){}b.prototype=x.prototype,g.prototype=new b},o.extend=function(){var g,x,b={};for(g=0;g<arguments.length;g++)for(x in arguments[g])Object.prototype.hasOwnProperty.call(arguments[g],x)&&b[x]===void 0&&(b[x]=arguments[g][x]);return b},o.prepareContent=function(g,x,b,y,k){return c.Promise.resolve(x).then(function(A){return r.blob&&(A instanceof Blob||["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(A))!==-1)&&typeof FileReader<"u"?new c.Promise(function(S,N){var D=new FileReader;D.onload=function(L){S(L.target.result)},D.onerror=function(L){N(L.target.error)},D.readAsArrayBuffer(A)}):A}).then(function(A){var S=o.getTypeOf(A);return S?(S==="arraybuffer"?A=o.transformTo("uint8array",A):S==="string"&&(k?A=i.decode(A):b&&y!==!0&&(A=(function(N){return d(N,r.uint8array?new Uint8Array(N.length):new Array(N.length))})(A))),A):c.Promise.reject(new Error("Can't read the data of '"+g+"'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"))})}},{"./base64":1,"./external":6,"./nodejsUtils":14,"./support":30,setimmediate:54}],33:[function(t,s,o){var r=t("./reader/readerFor"),i=t("./utils"),n=t("./signature"),c=t("./zipEntry"),l=t("./support");function d(p){this.files=[],this.loadOptions=p}d.prototype={checkSignature:function(p){if(!this.reader.readAndCheckSignature(p)){this.reader.index-=4;var u=this.reader.readString(4);throw new Error("Corrupted zip or bug: unexpected signature ("+i.pretty(u)+", expected "+i.pretty(p)+")")}},isSignature:function(p,u){var f=this.reader.index;this.reader.setIndex(p);var m=this.reader.readString(4)===u;return this.reader.setIndex(f),m},readBlockEndOfCentral:function(){this.diskNumber=this.reader.readInt(2),this.diskWithCentralDirStart=this.reader.readInt(2),this.centralDirRecordsOnThisDisk=this.reader.readInt(2),this.centralDirRecords=this.reader.readInt(2),this.centralDirSize=this.reader.readInt(4),this.centralDirOffset=this.reader.readInt(4),this.zipCommentLength=this.reader.readInt(2);var p=this.reader.readData(this.zipCommentLength),u=l.uint8array?"uint8array":"array",f=i.transformTo(u,p);this.zipComment=this.loadOptions.decodeFileName(f)},readBlockZip64EndOfCentral:function(){this.zip64EndOfCentralSize=this.reader.readInt(8),this.reader.skip(4),this.diskNumber=this.reader.readInt(4),this.diskWithCentralDirStart=this.reader.readInt(4),this.centralDirRecordsOnThisDisk=this.reader.readInt(8),this.centralDirRecords=this.reader.readInt(8),this.centralDirSize=this.reader.readInt(8),this.centralDirOffset=this.reader.readInt(8),this.zip64ExtensibleData={};for(var p,u,f,m=this.zip64EndOfCentralSize-44;0<m;)p=this.reader.readInt(2),u=this.reader.readInt(4),f=this.reader.readData(u),this.zip64ExtensibleData[p]={id:p,length:u,value:f}},readBlockZip64EndOfCentralLocator:function(){if(this.diskWithZip64CentralDirStart=this.reader.readInt(4),this.relativeOffsetEndOfZip64CentralDir=this.reader.readInt(8),this.disksCount=this.reader.readInt(4),1<this.disksCount)throw new Error("Multi-volumes zip are not supported")},readLocalFiles:function(){var p,u;for(p=0;p<this.files.length;p++)u=this.files[p],this.reader.setIndex(u.localHeaderOffset),this.checkSignature(n.LOCAL_FILE_HEADER),u.readLocalPart(this.reader),u.handleUTF8(),u.processAttributes()},readCentralDir:function(){var p;for(this.reader.setIndex(this.centralDirOffset);this.reader.readAndCheckSignature(n.CENTRAL_FILE_HEADER);)(p=new c({zip64:this.zip64},this.loadOptions)).readCentralPart(this.reader),this.files.push(p);if(this.centralDirRecords!==this.files.length&&this.centralDirRecords!==0&&this.files.length===0)throw new Error("Corrupted zip or bug: expected "+this.centralDirRecords+" records in central dir, got "+this.files.length)},readEndOfCentral:function(){var p=this.reader.lastIndexOfSignature(n.CENTRAL_DIRECTORY_END);if(p<0)throw this.isSignature(0,n.LOCAL_FILE_HEADER)?new Error("Corrupted zip: can't find end of central directory"):new Error("Can't find end of central directory : is this a zip file ? If it is, see https://stuk.github.io/jszip/documentation/howto/read_zip.html");this.reader.setIndex(p);var u=p;if(this.checkSignature(n.CENTRAL_DIRECTORY_END),this.readBlockEndOfCentral(),this.diskNumber===i.MAX_VALUE_16BITS||this.diskWithCentralDirStart===i.MAX_VALUE_16BITS||this.centralDirRecordsOnThisDisk===i.MAX_VALUE_16BITS||this.centralDirRecords===i.MAX_VALUE_16BITS||this.centralDirSize===i.MAX_VALUE_32BITS||this.centralDirOffset===i.MAX_VALUE_32BITS){if(this.zip64=!0,(p=this.reader.lastIndexOfSignature(n.ZIP64_CENTRAL_DIRECTORY_LOCATOR))<0)throw new Error("Corrupted zip: can't find the ZIP64 end of central directory locator");if(this.reader.setIndex(p),this.checkSignature(n.ZIP64_CENTRAL_DIRECTORY_LOCATOR),this.readBlockZip64EndOfCentralLocator(),!this.isSignature(this.relativeOffsetEndOfZip64CentralDir,n.ZIP64_CENTRAL_DIRECTORY_END)&&(this.relativeOffsetEndOfZip64CentralDir=this.reader.lastIndexOfSignature(n.ZIP64_CENTRAL_DIRECTORY_END),this.relativeOffsetEndOfZip64CentralDir<0))throw new Error("Corrupted zip: can't find the ZIP64 end of central directory");this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir),this.checkSignature(n.ZIP64_CENTRAL_DIRECTORY_END),this.readBlockZip64EndOfCentral()}var f=this.centralDirOffset+this.centralDirSize;this.zip64&&(f+=20,f+=12+this.zip64EndOfCentralSize);var m=u-f;if(0<m)this.isSignature(u,n.CENTRAL_FILE_HEADER)||(this.reader.zero=m);else if(m<0)throw new Error("Corrupted zip: missing "+Math.abs(m)+" bytes.")},prepareReader:function(p){this.reader=r(p)},load:function(p){this.prepareReader(p),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}},s.exports=d},{"./reader/readerFor":22,"./signature":23,"./support":30,"./utils":32,"./zipEntry":34}],34:[function(t,s,o){var r=t("./reader/readerFor"),i=t("./utils"),n=t("./compressedObject"),c=t("./crc32"),l=t("./utf8"),d=t("./compressions"),p=t("./support");function u(f,m){this.options=f,this.loadOptions=m}u.prototype={isEncrypted:function(){return(1&this.bitFlag)==1},useUTF8:function(){return(2048&this.bitFlag)==2048},readLocalPart:function(f){var m,g;if(f.skip(22),this.fileNameLength=f.readInt(2),g=f.readInt(2),this.fileName=f.readData(this.fileNameLength),f.skip(g),this.compressedSize===-1||this.uncompressedSize===-1)throw new Error("Bug or corrupted zip : didn't get enough information from the central directory (compressedSize === -1 || uncompressedSize === -1)");if((m=(function(x){for(var b in d)if(Object.prototype.hasOwnProperty.call(d,b)&&d[b].magic===x)return d[b];return null})(this.compressionMethod))===null)throw new Error("Corrupted zip : compression "+i.pretty(this.compressionMethod)+" unknown (inner file : "+i.transformTo("string",this.fileName)+")");this.decompressed=new n(this.compressedSize,this.uncompressedSize,this.crc32,m,f.readData(this.compressedSize))},readCentralPart:function(f){this.versionMadeBy=f.readInt(2),f.skip(2),this.bitFlag=f.readInt(2),this.compressionMethod=f.readString(2),this.date=f.readDate(),this.crc32=f.readInt(4),this.compressedSize=f.readInt(4),this.uncompressedSize=f.readInt(4);var m=f.readInt(2);if(this.extraFieldsLength=f.readInt(2),this.fileCommentLength=f.readInt(2),this.diskNumberStart=f.readInt(2),this.internalFileAttributes=f.readInt(2),this.externalFileAttributes=f.readInt(4),this.localHeaderOffset=f.readInt(4),this.isEncrypted())throw new Error("Encrypted zip are not supported");f.skip(m),this.readExtraFields(f),this.parseZIP64ExtraField(f),this.fileComment=f.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var f=this.versionMadeBy>>8;this.dir=!!(16&this.externalFileAttributes),f==0&&(this.dosPermissions=63&this.externalFileAttributes),f==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var f=r(this.extraFields[1].value);this.uncompressedSize===i.MAX_VALUE_32BITS&&(this.uncompressedSize=f.readInt(8)),this.compressedSize===i.MAX_VALUE_32BITS&&(this.compressedSize=f.readInt(8)),this.localHeaderOffset===i.MAX_VALUE_32BITS&&(this.localHeaderOffset=f.readInt(8)),this.diskNumberStart===i.MAX_VALUE_32BITS&&(this.diskNumberStart=f.readInt(4))}},readExtraFields:function(f){var m,g,x,b=f.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});f.index+4<b;)m=f.readInt(2),g=f.readInt(2),x=f.readData(g),this.extraFields[m]={id:m,length:g,value:x};f.setIndex(b)},handleUTF8:function(){var f=p.uint8array?"uint8array":"array";if(this.useUTF8())this.fileNameStr=l.utf8decode(this.fileName),this.fileCommentStr=l.utf8decode(this.fileComment);else{var m=this.findExtraFieldUnicodePath();if(m!==null)this.fileNameStr=m;else{var g=i.transformTo(f,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(g)}var x=this.findExtraFieldUnicodeComment();if(x!==null)this.fileCommentStr=x;else{var b=i.transformTo(f,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(b)}}},findExtraFieldUnicodePath:function(){var f=this.extraFields[28789];if(f){var m=r(f.value);return m.readInt(1)!==1||c(this.fileName)!==m.readInt(4)?null:l.utf8decode(m.readData(f.length-5))}return null},findExtraFieldUnicodeComment:function(){var f=this.extraFields[25461];if(f){var m=r(f.value);return m.readInt(1)!==1||c(this.fileComment)!==m.readInt(4)?null:l.utf8decode(m.readData(f.length-5))}return null}},s.exports=u},{"./compressedObject":2,"./compressions":3,"./crc32":4,"./reader/readerFor":22,"./support":30,"./utf8":31,"./utils":32}],35:[function(t,s,o){function r(m,g,x){this.name=m,this.dir=x.dir,this.date=x.date,this.comment=x.comment,this.unixPermissions=x.unixPermissions,this.dosPermissions=x.dosPermissions,this._data=g,this._dataBinary=x.binary,this.options={compression:x.compression,compressionOptions:x.compressionOptions}}var i=t("./stream/StreamHelper"),n=t("./stream/DataWorker"),c=t("./utf8"),l=t("./compressedObject"),d=t("./stream/GenericWorker");r.prototype={internalStream:function(m){var g=null,x="string";try{if(!m)throw new Error("No output type specified.");var b=(x=m.toLowerCase())==="string"||x==="text";x!=="binarystring"&&x!=="text"||(x="string"),g=this._decompressWorker();var y=!this._dataBinary;y&&!b&&(g=g.pipe(new c.Utf8EncodeWorker)),!y&&b&&(g=g.pipe(new c.Utf8DecodeWorker))}catch(k){(g=new d("error")).error(k)}return new i(g,x,"")},async:function(m,g){return this.internalStream(m).accumulate(g)},nodeStream:function(m,g){return this.internalStream(m||"nodebuffer").toNodejsStream(g)},_compressWorker:function(m,g){if(this._data instanceof l&&this._data.compression.magic===m.magic)return this._data.getCompressedWorker();var x=this._decompressWorker();return this._dataBinary||(x=x.pipe(new c.Utf8EncodeWorker)),l.createWorkerFrom(x,m,g)},_decompressWorker:function(){return this._data instanceof l?this._data.getContentWorker():this._data instanceof d?this._data:new n(this._data)}};for(var p=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],u=function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},f=0;f<p.length;f++)r.prototype[p[f]]=u;s.exports=r},{"./compressedObject":2,"./stream/DataWorker":27,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31}],36:[function(t,s,o){(function(r){var i,n,c=r.MutationObserver||r.WebKitMutationObserver;if(c){var l=0,d=new c(m),p=r.document.createTextNode("");d.observe(p,{characterData:!0}),i=function(){p.data=l=++l%2}}else if(r.setImmediate||r.MessageChannel===void 0)i="document"in r&&"onreadystatechange"in r.document.createElement("script")?function(){var g=r.document.createElement("script");g.onreadystatechange=function(){m(),g.onreadystatechange=null,g.parentNode.removeChild(g),g=null},r.document.documentElement.appendChild(g)}:function(){setTimeout(m,0)};else{var u=new r.MessageChannel;u.port1.onmessage=m,i=function(){u.port2.postMessage(0)}}var f=[];function m(){var g,x;n=!0;for(var b=f.length;b;){for(x=f,f=[],g=-1;++g<b;)x[g]();b=f.length}n=!1}s.exports=function(g){f.push(g)!==1||n||i()}}).call(this,typeof yo<"u"?yo:typeof self<"u"?self:typeof window<"u"?window:{})},{}],37:[function(t,s,o){var r=t("immediate");function i(){}var n={},c=["REJECTED"],l=["FULFILLED"],d=["PENDING"];function p(b){if(typeof b!="function")throw new TypeError("resolver must be a function");this.state=d,this.queue=[],this.outcome=void 0,b!==i&&g(this,b)}function u(b,y,k){this.promise=b,typeof y=="function"&&(this.onFulfilled=y,this.callFulfilled=this.otherCallFulfilled),typeof k=="function"&&(this.onRejected=k,this.callRejected=this.otherCallRejected)}function f(b,y,k){r(function(){var A;try{A=y(k)}catch(S){return n.reject(b,S)}A===b?n.reject(b,new TypeError("Cannot resolve promise with itself")):n.resolve(b,A)})}function m(b){var y=b&&b.then;if(b&&(typeof b=="object"||typeof b=="function")&&typeof y=="function")return function(){y.apply(b,arguments)}}function g(b,y){var k=!1;function A(D){k||(k=!0,n.reject(b,D))}function S(D){k||(k=!0,n.resolve(b,D))}var N=x(function(){y(S,A)});N.status==="error"&&A(N.value)}function x(b,y){var k={};try{k.value=b(y),k.status="success"}catch(A){k.status="error",k.value=A}return k}(s.exports=p).prototype.finally=function(b){if(typeof b!="function")return this;var y=this.constructor;return this.then(function(k){return y.resolve(b()).then(function(){return k})},function(k){return y.resolve(b()).then(function(){throw k})})},p.prototype.catch=function(b){return this.then(null,b)},p.prototype.then=function(b,y){if(typeof b!="function"&&this.state===l||typeof y!="function"&&this.state===c)return this;var k=new this.constructor(i);return this.state!==d?f(k,this.state===l?b:y,this.outcome):this.queue.push(new u(k,b,y)),k},u.prototype.callFulfilled=function(b){n.resolve(this.promise,b)},u.prototype.otherCallFulfilled=function(b){f(this.promise,this.onFulfilled,b)},u.prototype.callRejected=function(b){n.reject(this.promise,b)},u.prototype.otherCallRejected=function(b){f(this.promise,this.onRejected,b)},n.resolve=function(b,y){var k=x(m,y);if(k.status==="error")return n.reject(b,k.value);var A=k.value;if(A)g(b,A);else{b.state=l,b.outcome=y;for(var S=-1,N=b.queue.length;++S<N;)b.queue[S].callFulfilled(y)}return b},n.reject=function(b,y){b.state=c,b.outcome=y;for(var k=-1,A=b.queue.length;++k<A;)b.queue[k].callRejected(y);return b},p.resolve=function(b){return b instanceof this?b:n.resolve(new this(i),b)},p.reject=function(b){var y=new this(i);return n.reject(y,b)},p.all=function(b){var y=this;if(Object.prototype.toString.call(b)!=="[object Array]")return this.reject(new TypeError("must be an array"));var k=b.length,A=!1;if(!k)return this.resolve([]);for(var S=new Array(k),N=0,D=-1,L=new this(i);++D<k;)M(b[D],D);return L;function M(B,V){y.resolve(B).then(function(P){S[V]=P,++N!==k||A||(A=!0,n.resolve(L,S))},function(P){A||(A=!0,n.reject(L,P))})}},p.race=function(b){var y=this;if(Object.prototype.toString.call(b)!=="[object Array]")return this.reject(new TypeError("must be an array"));var k=b.length,A=!1;if(!k)return this.resolve([]);for(var S=-1,N=new this(i);++S<k;)D=b[S],y.resolve(D).then(function(L){A||(A=!0,n.resolve(N,L))},function(L){A||(A=!0,n.reject(N,L))});var D;return N}},{immediate:36}],38:[function(t,s,o){var r={};(0,t("./lib/utils/common").assign)(r,t("./lib/deflate"),t("./lib/inflate"),t("./lib/zlib/constants")),s.exports=r},{"./lib/deflate":39,"./lib/inflate":40,"./lib/utils/common":41,"./lib/zlib/constants":44}],39:[function(t,s,o){var r=t("./zlib/deflate"),i=t("./utils/common"),n=t("./utils/strings"),c=t("./zlib/messages"),l=t("./zlib/zstream"),d=Object.prototype.toString,p=0,u=-1,f=0,m=8;function g(b){if(!(this instanceof g))return new g(b);this.options=i.assign({level:u,method:m,chunkSize:16384,windowBits:15,memLevel:8,strategy:f,to:""},b||{});var y=this.options;y.raw&&0<y.windowBits?y.windowBits=-y.windowBits:y.gzip&&0<y.windowBits&&y.windowBits<16&&(y.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new l,this.strm.avail_out=0;var k=r.deflateInit2(this.strm,y.level,y.method,y.windowBits,y.memLevel,y.strategy);if(k!==p)throw new Error(c[k]);if(y.header&&r.deflateSetHeader(this.strm,y.header),y.dictionary){var A;if(A=typeof y.dictionary=="string"?n.string2buf(y.dictionary):d.call(y.dictionary)==="[object ArrayBuffer]"?new Uint8Array(y.dictionary):y.dictionary,(k=r.deflateSetDictionary(this.strm,A))!==p)throw new Error(c[k]);this._dict_set=!0}}function x(b,y){var k=new g(y);if(k.push(b,!0),k.err)throw k.msg||c[k.err];return k.result}g.prototype.push=function(b,y){var k,A,S=this.strm,N=this.options.chunkSize;if(this.ended)return!1;A=y===~~y?y:y===!0?4:0,typeof b=="string"?S.input=n.string2buf(b):d.call(b)==="[object ArrayBuffer]"?S.input=new Uint8Array(b):S.input=b,S.next_in=0,S.avail_in=S.input.length;do{if(S.avail_out===0&&(S.output=new i.Buf8(N),S.next_out=0,S.avail_out=N),(k=r.deflate(S,A))!==1&&k!==p)return this.onEnd(k),!(this.ended=!0);S.avail_out!==0&&(S.avail_in!==0||A!==4&&A!==2)||(this.options.to==="string"?this.onData(n.buf2binstring(i.shrinkBuf(S.output,S.next_out))):this.onData(i.shrinkBuf(S.output,S.next_out)))}while((0<S.avail_in||S.avail_out===0)&&k!==1);return A===4?(k=r.deflateEnd(this.strm),this.onEnd(k),this.ended=!0,k===p):A!==2||(this.onEnd(p),!(S.avail_out=0))},g.prototype.onData=function(b){this.chunks.push(b)},g.prototype.onEnd=function(b){b===p&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=i.flattenChunks(this.chunks)),this.chunks=[],this.err=b,this.msg=this.strm.msg},o.Deflate=g,o.deflate=x,o.deflateRaw=function(b,y){return(y=y||{}).raw=!0,x(b,y)},o.gzip=function(b,y){return(y=y||{}).gzip=!0,x(b,y)}},{"./utils/common":41,"./utils/strings":42,"./zlib/deflate":46,"./zlib/messages":51,"./zlib/zstream":53}],40:[function(t,s,o){var r=t("./zlib/inflate"),i=t("./utils/common"),n=t("./utils/strings"),c=t("./zlib/constants"),l=t("./zlib/messages"),d=t("./zlib/zstream"),p=t("./zlib/gzheader"),u=Object.prototype.toString;function f(g){if(!(this instanceof f))return new f(g);this.options=i.assign({chunkSize:16384,windowBits:0,to:""},g||{});var x=this.options;x.raw&&0<=x.windowBits&&x.windowBits<16&&(x.windowBits=-x.windowBits,x.windowBits===0&&(x.windowBits=-15)),!(0<=x.windowBits&&x.windowBits<16)||g&&g.windowBits||(x.windowBits+=32),15<x.windowBits&&x.windowBits<48&&(15&x.windowBits)==0&&(x.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new d,this.strm.avail_out=0;var b=r.inflateInit2(this.strm,x.windowBits);if(b!==c.Z_OK)throw new Error(l[b]);this.header=new p,r.inflateGetHeader(this.strm,this.header)}function m(g,x){var b=new f(x);if(b.push(g,!0),b.err)throw b.msg||l[b.err];return b.result}f.prototype.push=function(g,x){var b,y,k,A,S,N,D=this.strm,L=this.options.chunkSize,M=this.options.dictionary,B=!1;if(this.ended)return!1;y=x===~~x?x:x===!0?c.Z_FINISH:c.Z_NO_FLUSH,typeof g=="string"?D.input=n.binstring2buf(g):u.call(g)==="[object ArrayBuffer]"?D.input=new Uint8Array(g):D.input=g,D.next_in=0,D.avail_in=D.input.length;do{if(D.avail_out===0&&(D.output=new i.Buf8(L),D.next_out=0,D.avail_out=L),(b=r.inflate(D,c.Z_NO_FLUSH))===c.Z_NEED_DICT&&M&&(N=typeof M=="string"?n.string2buf(M):u.call(M)==="[object ArrayBuffer]"?new Uint8Array(M):M,b=r.inflateSetDictionary(this.strm,N)),b===c.Z_BUF_ERROR&&B===!0&&(b=c.Z_OK,B=!1),b!==c.Z_STREAM_END&&b!==c.Z_OK)return this.onEnd(b),!(this.ended=!0);D.next_out&&(D.avail_out!==0&&b!==c.Z_STREAM_END&&(D.avail_in!==0||y!==c.Z_FINISH&&y!==c.Z_SYNC_FLUSH)||(this.options.to==="string"?(k=n.utf8border(D.output,D.next_out),A=D.next_out-k,S=n.buf2string(D.output,k),D.next_out=A,D.avail_out=L-A,A&&i.arraySet(D.output,D.output,k,A,0),this.onData(S)):this.onData(i.shrinkBuf(D.output,D.next_out)))),D.avail_in===0&&D.avail_out===0&&(B=!0)}while((0<D.avail_in||D.avail_out===0)&&b!==c.Z_STREAM_END);return b===c.Z_STREAM_END&&(y=c.Z_FINISH),y===c.Z_FINISH?(b=r.inflateEnd(this.strm),this.onEnd(b),this.ended=!0,b===c.Z_OK):y!==c.Z_SYNC_FLUSH||(this.onEnd(c.Z_OK),!(D.avail_out=0))},f.prototype.onData=function(g){this.chunks.push(g)},f.prototype.onEnd=function(g){g===c.Z_OK&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=i.flattenChunks(this.chunks)),this.chunks=[],this.err=g,this.msg=this.strm.msg},o.Inflate=f,o.inflate=m,o.inflateRaw=function(g,x){return(x=x||{}).raw=!0,m(g,x)},o.ungzip=m},{"./utils/common":41,"./utils/strings":42,"./zlib/constants":44,"./zlib/gzheader":47,"./zlib/inflate":49,"./zlib/messages":51,"./zlib/zstream":53}],41:[function(t,s,o){var r=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Int32Array<"u";o.assign=function(c){for(var l=Array.prototype.slice.call(arguments,1);l.length;){var d=l.shift();if(d){if(typeof d!="object")throw new TypeError(d+"must be non-object");for(var p in d)d.hasOwnProperty(p)&&(c[p]=d[p])}}return c},o.shrinkBuf=function(c,l){return c.length===l?c:c.subarray?c.subarray(0,l):(c.length=l,c)};var i={arraySet:function(c,l,d,p,u){if(l.subarray&&c.subarray)c.set(l.subarray(d,d+p),u);else for(var f=0;f<p;f++)c[u+f]=l[d+f]},flattenChunks:function(c){var l,d,p,u,f,m;for(l=p=0,d=c.length;l<d;l++)p+=c[l].length;for(m=new Uint8Array(p),l=u=0,d=c.length;l<d;l++)f=c[l],m.set(f,u),u+=f.length;return m}},n={arraySet:function(c,l,d,p,u){for(var f=0;f<p;f++)c[u+f]=l[d+f]},flattenChunks:function(c){return[].concat.apply([],c)}};o.setTyped=function(c){c?(o.Buf8=Uint8Array,o.Buf16=Uint16Array,o.Buf32=Int32Array,o.assign(o,i)):(o.Buf8=Array,o.Buf16=Array,o.Buf32=Array,o.assign(o,n))},o.setTyped(r)},{}],42:[function(t,s,o){var r=t("./common"),i=!0,n=!0;try{String.fromCharCode.apply(null,[0])}catch{i=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{n=!1}for(var c=new r.Buf8(256),l=0;l<256;l++)c[l]=252<=l?6:248<=l?5:240<=l?4:224<=l?3:192<=l?2:1;function d(p,u){if(u<65537&&(p.subarray&&n||!p.subarray&&i))return String.fromCharCode.apply(null,r.shrinkBuf(p,u));for(var f="",m=0;m<u;m++)f+=String.fromCharCode(p[m]);return f}c[254]=c[254]=1,o.string2buf=function(p){var u,f,m,g,x,b=p.length,y=0;for(g=0;g<b;
vendor: 5,443 bytes, line 103
103g++)(64512&(f=p.charCodeAt(g)))==55296&&g+1<b&&(64512&(m=p.charCodeAt(g+1)))==56320&&(f=65536+(f-55296<<10)+(m-56320),g++),y+=f<128?1:f<2048?2:f<65536?3:4;for(u=new r.Buf8(y),g=x=0;x<y;g++)(64512&(f=p.charCodeAt(g)))==55296&&g+1<b&&(64512&(m=p.charCodeAt(g+1)))==56320&&(f=65536+(f-55296<<10)+(m-56320),g++),f<128?u[x++]=f:(f<2048?u[x++]=192|f>>>6:(f<65536?u[x++]=224|f>>>12:(u[x++]=240|f>>>18,u[x++]=128|f>>>12&63),u[x++]=128|f>>>6&63),u[x++]=128|63&f);return u},o.buf2binstring=function(p){return d(p,p.length)},o.binstring2buf=function(p){for(var u=new r.Buf8(p.length),f=0,m=u.length;f<m;f++)u[f]=p.charCodeAt(f);return u},o.buf2string=function(p,u){var f,m,g,x,b=u||p.length,y=new Array(2*b);for(f=m=0;f<b;)if((g=p[f++])<128)y[m++]=g;else if(4<(x=c[g]))y[m++]=65533,f+=x-1;else{for(g&=x===2?31:x===3?15:7;1<x&&f<b;)g=g<<6|63&p[f++],x--;1<x?y[m++]=65533:g<65536?y[m++]=g:(g-=65536,y[m++]=55296|g>>10&1023,y[m++]=56320|1023&g)}return d(y,m)},o.utf8border=function(p,u){var f;for((u=u||p.length)>p.length&&(u=p.length),f=u-1;0<=f&&(192&p[f])==128;)f--;return f<0||f===0?u:f+c[p[f]]>u?f:u}},{"./common":41}],43:[function(t,s,o){s.exports=function(r,i,n,c){for(var l=65535&r|0,d=r>>>16&65535|0,p=0;n!==0;){for(n-=p=2e3<n?2e3:n;d=d+(l=l+i[c++]|0)|0,--p;);l%=65521,d%=65521}return l|d<<16|0}},{}],44:[function(t,s,o){s.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},{}],45:[function(t,s,o){var r=(function(){for(var i,n=[],c=0;c<256;c++){i=c;for(var l=0;l<8;l++)i=1&i?3988292384^i>>>1:i>>>1;n[c]=i}return n})();s.exports=function(i,n,c,l){var d=r,p=l+c;i^=-1;for(var u=l;u<p;u++)i=i>>>8^d[255&(i^n[u])];return-1^i}},{}],46:[function(t,s,o){var r,i=t("../utils/common"),n=t("./trees"),c=t("./adler32"),l=t("./crc32"),d=t("./messages"),p=0,u=4,f=0,m=-2,g=-1,x=4,b=2,y=8,k=9,A=286,S=30,N=19,D=2*A+1,L=15,M=3,B=258,V=B+M+1,P=42,F=113,j=1,z=2,ce=3,$=4;function K(v,U){return v.msg=d[U],U}function I(v){return(v<<1)-(4<v?9:0)}function X(v){for(var U=v.length;0<=--U;)v[U]=0}function T(v){var U=v.state,W=U.pending;W>v.avail_out&&(W=v.avail_out),W!==0&&(i.arraySet(v.output,U.pending_buf,U.pending_out,W,v.next_out),v.next_out+=W,U.pending_out+=W,v.total_out+=W,v.avail_out-=W,U.pending-=W,U.pending===0&&(U.pending_out=0))}function O(v,U){n._tr_flush_block(v,0<=v.block_start?v.block_start:-1,v.strstart-v.block_start,U),v.block_start=v.strstart,T(v.strm)}function Z(v,U){v.pending_buf[v.pending++]=U}function oe(v,U){v.pending_buf[v.pending++]=U>>>8&255,v.pending_buf[v.pending++]=255&U}function se(v,U){var W,C,_=v.max_chain_length,R=v.strstart,J=v.prev_length,Q=v.nice_match,H=v.strstart>v.w_size-V?v.strstart-(v.w_size-V):0,Y=v.window,ne=v.w_mask,re=v.prev,me=v.strstart+B,Me=Y[R+J-1],Ce=Y[R+J];v.prev_length>=v.good_match&&(_>>=2),Q>v.lookahead&&(Q=v.lookahead);do if(Y[(W=U)+J]===Ce&&Y[W+J-1]===Me&&Y[W]===Y[R]&&Y[++W]===Y[R+1]){R+=2,W++;do;while(Y[++R]===Y[++W]&&Y[++R]===Y[++W]&&Y[++R]===Y[++W]&&Y[++R]===Y[++W]&&Y[++R]===Y[++W]&&Y[++R]===Y[++W]&&Y[++R]===Y[++W]&&Y[++R]===Y[++W]&&R<me);if(C=B-(me-R),R=me-B,J<C){if(v.match_start=U,Q<=(J=C))break;Me=Y[R+J-1],Ce=Y[R+J]}}while((U=re[U&ne])>H&&--_!=0);return J<=v.lookahead?J:v.lookahead}function Ae(v){var U,W,C,_,R,J,Q,H,Y,ne,re=v.w_size;do{if(_=v.window_size-v.lookahead-v.strstart,v.strstart>=re+(re-V)){for(i.arraySet(v.window,v.window,re,re,0),v.match_start-=re,v.strstart-=re,v.block_start-=re,U=W=v.hash_size;C=v.head[--U],v.head[U]=re<=C?C-re:0,--W;);for(U=W=re;C=v.prev[--U],v.prev[U]=re<=C?C-re:0,--W;);_+=re}if(v.strm.avail_in===0)break;if(J=v.strm,Q=v.window,H=v.strstart+v.lookahead,Y=_,ne=void 0,ne=J.avail_in,Y<ne&&(ne=Y),W=ne===0?0:(J.avail_in-=ne,i.arraySet(Q,J.input,J.next_in,ne,H),J.state.wrap===1?J.adler=c(J.adler,Q,ne,H):J.state.wrap===2&&(J.adler=l(J.adler,Q,ne,H)),J.next_in+=ne,J.total_in+=ne,ne),v.lookahead+=W,v.lookahead+v.insert>=M)for(R=v.strstart-v.insert,v.ins_h=v.window[R],v.ins_h=(v.ins_h<<v.hash_shift^v.window[R+1])&v.hash_mask;v.insert&&(v.ins_h=(v.ins_h<<v.hash_shift^v.window[R+M-1])&v.hash_mask,v.prev[R&v.w_mask]=v.head[v.ins_h],v.head[v.ins_h]=R,R++,v.insert--,!(v.lookahead+v.insert<M)););}while(v.lookahead<V&&v.strm.avail_in!==0)}function Ie(v,U){for(var W,C;;){if(v.lookahead<V){if(Ae(v),v.lookahead<V&&U===p)return j;if(v.lookahead===0)break}if(W=0,v.lookahead>=M&&(v.ins_h=(v.ins_h<<v.hash_shift^v.window[v.strstart+M-1])&v.hash_mask,W=v.prev[v.strstart&v.w_mask]=v.head[v.ins_h],v.head[v.ins_h]=v.strstart),W!==0&&v.strstart-W<=v.w_size-V&&(v.match_length=se(v,W)),v.match_length>=M)if(C=n._tr_tally(v,v.strstart-v.match_start,v.match_length-M),v.lookahead-=v.match_length,v.match_length<=v.max_lazy_match&&v.lookahead>=M){for(v.match_length--;v.strstart++,v.ins_h=(v.ins_h<<v.hash_shift^v.window[v.strstart+M-1])&v.hash_mask,W=v.prev[v.strstart&v.w_mask]=v.head[v.ins_h],v.head[v.ins_h]=v.strstart,--v.match_length!=0;);v.strstart++}else v.strstart+=v.match_length,v.match_length=0,v.ins_h=v.window[v.strstart],v.ins_h=(v.ins_h<<v.hash_shift^v.window[v.strstart+1])&v.hash_mask;else C=n._tr_tally(v,0,v.window[v.strstart]),v.lookahead--,v.strstart++;if(C&&(O(v,!1),v.strm.avail_out===0))return j}
vendor: 30,924 bytes, line 103
103return v.insert=v.strstart<M-1?v.strstart:M-1,U===u?(O(v,!0),v.strm.avail_out===0?ce:$):v.last_lit&&(O(v,!1),v.strm.avail_out===0)?j:z}function ve(v,U){for(var W,C,_;;){if(v.lookahead<V){if(Ae(v),v.lookahead<V&&U===p)return j;if(v.lookahead===0)break}if(W=0,v.lookahead>=M&&(v.ins_h=(v.ins_h<<v.hash_shift^v.window[v.strstart+M-1])&v.hash_mask,W=v.prev[v.strstart&v.w_mask]=v.head[v.ins_h],v.head[v.ins_h]=v.strstart),v.prev_length=v.match_length,v.prev_match=v.match_start,v.match_length=M-1,W!==0&&v.prev_length<v.max_lazy_match&&v.strstart-W<=v.w_size-V&&(v.match_length=se(v,W),v.match_length<=5&&(v.strategy===1||v.match_length===M&&4096<v.strstart-v.match_start)&&(v.match_length=M-1)),v.prev_length>=M&&v.match_length<=v.prev_length){for(_=v.strstart+v.lookahead-M,C=n._tr_tally(v,v.strstart-1-v.prev_match,v.prev_length-M),v.lookahead-=v.prev_length-1,v.prev_length-=2;++v.strstart<=_&&(v.ins_h=(v.ins_h<<v.hash_shift^v.window[v.strstart+M-1])&v.hash_mask,W=v.prev[v.strstart&v.w_mask]=v.head[v.ins_h],v.head[v.ins_h]=v.strstart),--v.prev_length!=0;);if(v.match_available=0,v.match_length=M-1,v.strstart++,C&&(O(v,!1),v.strm.avail_out===0))return j}else if(v.match_available){if((C=n._tr_tally(v,0,v.window[v.strstart-1]))&&O(v,!1),v.strstart++,v.lookahead--,v.strm.avail_out===0)return j}else v.match_available=1,v.strstart++,v.lookahead--}return v.match_available&&(C=n._tr_tally(v,0,v.window[v.strstart-1]),v.match_available=0),v.insert=v.strstart<M-1?v.strstart:M-1,U===u?(O(v,!0),v.strm.avail_out===0?ce:$):v.last_lit&&(O(v,!1),v.strm.avail_out===0)?j:z}function ke(v,U,W,C,_){this.good_length=v,this.max_lazy=U,this.nice_length=W,this.max_chain=C,this.func=_}function ee(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=y,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new i.Buf16(2*D),this.dyn_dtree=new i.Buf16(2*(2*S+1)),this.bl_tree=new i.Buf16(2*(2*N+1)),X(this.dyn_ltree),X(this.dyn_dtree),X(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new i.Buf16(L+1),this.heap=new i.Buf16(2*A+1),X(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new i.Buf16(2*A+1),X(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function de(v){var U;return v&&v.state?(v.total_in=v.total_out=0,v.data_type=b,(U=v.state).pending=0,U.pending_out=0,U.wrap<0&&(U.wrap=-U.wrap),U.status=U.wrap?P:F,v.adler=U.wrap===2?0:1,U.last_flush=p,n._tr_init(U),f):K(v,m)}function ue(v){var U=de(v);return U===f&&(function(W){W.window_size=2*W.w_size,X(W.head),W.max_lazy_match=r[W.level].max_lazy,W.good_match=r[W.level].good_length,W.nice_match=r[W.level].nice_length,W.max_chain_length=r[W.level].max_chain,W.strstart=0,W.block_start=0,W.lookahead=0,W.insert=0,W.match_length=W.prev_length=M-1,W.match_available=0,W.ins_h=0})(v.state),U}function xe(v,U,W,C,_,R){if(!v)return m;var J=1;if(U===g&&(U=6),C<0?(J=0,C=-C):15<C&&(J=2,C-=16),_<1||k<_||W!==y||C<8||15<C||U<0||9<U||R<0||x<R)return K(v,m);C===8&&(C=9);var Q=new ee;return(v.state=Q).strm=v,Q.wrap=J,Q.gzhead=null,Q.w_bits=C,Q.w_size=1<<Q.w_bits,Q.w_mask=Q.w_size-1,Q.hash_bits=_+7,Q.hash_size=1<<Q.hash_bits,Q.hash_mask=Q.hash_size-1,Q.hash_shift=~~((Q.hash_bits+M-1)/M),Q.window=new i.Buf8(2*Q.w_size),Q.head=new i.Buf16(Q.hash_size),Q.prev=new i.Buf16(Q.w_size),Q.lit_bufsize=1<<_+6,Q.pending_buf_size=4*Q.lit_bufsize,Q.pending_buf=new i.Buf8(Q.pending_buf_size),Q.d_buf=1*Q.lit_bufsize,Q.l_buf=3*Q.lit_bufsize,Q.level=U,Q.strategy=R,Q.method=W,ue(v)}r=[new ke(0,0,0,0,function(v,U){var W=65535;for(W>v.pending_buf_size-5&&(W=v.pending_buf_size-5);;){if(v.lookahead<=1){if(Ae(v),v.lookahead===0&&U===p)return j;if(v.lookahead===0)break}v.strstart+=v.lookahead,v.lookahead=0;var C=v.block_start+W;if((v.strstart===0||v.strstart>=C)&&(v.lookahead=v.strstart-C,v.strstart=C,O(v,!1),v.strm.avail_out===0)||v.strstart-v.block_start>=v.w_size-V&&(O(v,!1),v.strm.avail_out===0))return j}return v.insert=0,U===u?(O(v,!0),v.strm.avail_out===0?ce:$):(v.strstart>v.block_start&&(O(v,!1),v.strm.avail_out),j)}),new ke(4,4,8,4,Ie),new ke(4,5,16,8,Ie),new ke(4,6,32,32,Ie),new ke(4,4,16,16,ve),new ke(8,16,32,32,ve),new ke(8,16,128,128,ve),new ke(8,32,128,256,ve),new ke(32,128,258,1024,ve),new ke(32,258,258,4096,ve)],o.deflateInit=function(v,U){return xe(v,U,y,15,8,0)},o.deflateInit2=xe,o.deflateReset=ue,o.deflateResetKeep=de,o.deflateSetHeader=function(v,U){return v&&v.state?v.state.wrap!==2?m:(v.state.gzhead=U,f):m},o.deflate=function(v,U){var W,C,_,R;if(!v||!v.state||5<U||U<0)return v?K(v,m):m;if(C=v.state,!v.output||!v.input&&v.avail_in!==0||C.status===666&&U!==u)return K(v,v.avail_out===0?-5:m);if(C.strm=v,W=C.last_flush,C.last_flush=U,C.status===P)if(C.wrap===2)v.adler=0,Z(C,31),Z(C,139),Z(C,8),C.gzhead?(Z(C,(C.gzhead.text?1:0)+(C.gzhead.hcrc?2:0)+(C.gzhead.extra?4:0)+(C.gzhead.name?8:0)+(C.gzhead.comment?16:0)),Z(C,255&C.gzhead.time),Z(C,C.gzhead.time>>8&255),Z(C,C.gzhead.time>>16&255),Z(C,C.gzhead.time>>24&255),Z(C,C.level===9?2:2<=C.strategy||C.level<2?4:0),Z(C,255&C.gzhead.os),C.gzhead.extra&&C.gzhead.extra.length&&(Z(C,255&C.gzhead.extra.length),Z(C,C.gzhead.extra.length>>8&255)),C.gzhead.hcrc&&(v.adler=l(v.adler,C.pending_buf,C.pending,0)),C.gzindex=0,C.status=69):(Z(C,0),Z(C,0),Z(C,0),Z(C,0),Z(C,0),Z(C,C.level===9?2:2<=C.strategy||C.level<2?4:0),Z(C,3),C.status=F);else{var J=y+(C.w_bits-8<<4)<<8;J|=(2<=C.strategy||C.level<2?0:C.level<6?1:C.level===6?2:3)<<6,C.strstart!==0&&(J|=32),J+=31-J%31,C.status=F,oe(C,J),C.strstart!==0&&(oe(C,v.adler>>>16),oe(C,65535&v.adler)),v.adler=1}if(C.status===69)if(C.gzhead.extra){for(_=C.pending;C.gzindex<(65535&C.gzhead.extra.length)&&(C.pending!==C.pending_buf_size||(C.gzhead.hcrc&&C.pending>_&&(v.adler=l(v.adler,C.pending_buf,C.pending-_,_)),T(v),_=C.pending,C.pending!==C.pending_buf_size));)Z(C,255&C.gzhead.extra[C.gzindex]),C.gzindex++;C.gzhead.hcrc&&C.pending>_&&(v.adler=l(v.adler,C.pending_buf,C.pending-_,_)),C.gzindex===C.gzhead.extra.length&&(C.gzindex=0,C.status=73)}else C.status=73;if(C.status===73)if(C.gzhead.name){_=C.pending;do{if(C.pending===C.pending_buf_size&&(C.gzhead.hcrc&&C.pending>_&&(v.adler=l(v.adler,C.pending_buf,C.pending-_,_)),T(v),_=C.pending,C.pending===C.pending_buf_size)){R=1;break}R=C.gzindex<C.gzhead.name.length?255&C.gzhead.name.charCodeAt(C.gzindex++):0,Z(C,R)}while(R!==0);C.gzhead.hcrc&&C.pending>_&&(v.adler=l(v.adler,C.pending_buf,C.pending-_,_)),R===0&&(C.gzindex=0,C.status=91)}else C.status=91;if(C.status===91)if(C.gzhead.comment){_=C.pending;do{if(C.pending===C.pending_buf_size&&(C.gzhead.hcrc&&C.pending>_&&(v.adler=l(v.adler,C.pending_buf,C.pending-_,_)),T(v),_=C.pending,C.pending===C.pending_buf_size)){R=1;break}R=C.gzindex<C.gzhead.comment.length?255&C.gzhead.comment.charCodeAt(C.gzindex++):0,Z(C,R)}while(R!==0);C.gzhead.hcrc&&C.pending>_&&(v.adler=l(v.adler,C.pending_buf,C.pending-_,_)),R===0&&(C.status=103)}else C.status=103;if(C.status===103&&(C.gzhead.hcrc?(C.pending+2>C.pending_buf_size&&T(v),C.pending+2<=C.pending_buf_size&&(Z(C,255&v.adler),Z(C,v.adler>>8&255),v.adler=0,C.status=F)):C.status=F),C.pending!==0){if(T(v),v.avail_out===0)return C.last_flush=-1,f}else if(v.avail_in===0&&I(U)<=I(W)&&U!==u)return K(v,-5);if(C.status===666&&v.avail_in!==0)return K(v,-5);if(v.avail_in!==0||C.lookahead!==0||U!==p&&C.status!==666){var Q=C.strategy===2?(function(H,Y){for(var ne;;){if(H.lookahead===0&&(Ae(H),H.lookahead===0)){if(Y===p)return j;break}if(H.match_length=0,ne=n._tr_tally(H,0,H.window[H.strstart]),H.lookahead--,H.strstart++,ne&&(O(H,!1),H.strm.avail_out===0))return j}return H.insert=0,Y===u?(O(H,!0),H.strm.avail_out===0?ce:$):H.last_lit&&(O(H,!1),H.strm.avail_out===0)?j:z})(C,U):C.strategy===3?(function(H,Y){for(var ne,re,me,Me,Ce=H.window;;){if(H.lookahead<=B){if(Ae(H),H.lookahead<=B&&Y===p)return j;if(H.lookahead===0)break}if(H.match_length=0,H.lookahead>=M&&0<H.strstart&&(re=Ce[me=H.strstart-1])===Ce[++me]&&re===Ce[++me]&&re===Ce[++me]){Me=H.strstart+B;do;while(re===Ce[++me]&&re===Ce[++me]&&re===Ce[++me]&&re===Ce[++me]&&re===Ce[++me]&&re===Ce[++me]&&re===Ce[++me]&&re===Ce[++me]&&me<Me);H.match_length=B-(Me-me),H.match_length>H.lookahead&&(H.match_length=H.lookahead)}if(H.match_length>=M?(ne=n._tr_tally(H,1,H.match_length-M),H.lookahead-=H.match_length,H.strstart+=H.match_length,H.match_length=0):(ne=n._tr_tally(H,0,H.window[H.strstart]),H.lookahead--,H.strstart++),ne&&(O(H,!1),H.strm.avail_out===0))return j}return H.insert=0,Y===u?(O(H,!0),H.strm.avail_out===0?ce:$):H.last_lit&&(O(H,!1),H.strm.avail_out===0)?j:z})(C,U):r[C.level].func(C,U);if(Q!==ce&&Q!==$||(C.status=666),Q===j||Q===ce)return v.avail_out===0&&(C.last_flush=-1),f;if(Q===z&&(U===1?n._tr_align(C):U!==5&&(n._tr_stored_block(C,0,0,!1),U===3&&(X(C.head),C.lookahead===0&&(C.strstart=0,C.block_start=0,C.insert=0))),T(v),v.avail_out===0))return C.last_flush=-1,f}return U!==u?f:C.wrap<=0?1:(C.wrap===2?(Z(C,255&v.adler),Z(C,v.adler>>8&255),Z(C,v.adler>>16&255),Z(C,v.adler>>24&255),Z(C,255&v.total_in),Z(C,v.total_in>>8&255),Z(C,v.total_in>>16&255),Z(C,v.total_in>>24&255)):(oe(C,v.adler>>>16),oe(C,65535&v.adler)),T(v),0<C.wrap&&(C.wrap=-C.wrap),C.pending!==0?f:1)},o.deflateEnd=function(v){var U;return v&&v.state?(U=v.state.status)!==P&&U!==69&&U!==73&&U!==91&&U!==103&&U!==F&&U!==666?K(v,m):(v.state=null,U===F?K(v,-3):f):m},o.deflateSetDictionary=function(v,U){var W,C,_,R,J,Q,H,Y,ne=U.length;if(!v||!v.state||(R=(W=v.state).wrap)===2||R===1&&W.status!==P||W.lookahead)return m;for(R===1&&(v.adler=c(v.adler,U,ne,0)),W.wrap=0,ne>=W.w_size&&(R===0&&(X(W.head),W.strstart=0,W.block_start=0,W.insert=0),Y=new i.Buf8(W.w_size),i.arraySet(Y,U,ne-W.w_size,W.w_size,0),U=Y,ne=W.w_size),J=v.avail_in,Q=v.next_in,H=v.input,v.avail_in=ne,v.next_in=0,v.input=U,Ae(W);W.lookahead>=M;){for(C=W.strstart,_=W.lookahead-(M-1);W.ins_h=(W.ins_h<<W.hash_shift^W.window[C+M-1])&W.hash_mask,W.prev[C&W.w_mask]=W.head[W.ins_h],W.head[W.ins_h]=C,C++,--_;);W.strstart=C,W.lookahead=M-1,Ae(W)}return W.strstart+=W.lookahead,W.block_start=W.strstart,W.insert=W.lookahead,W.lookahead=0,W.match_length=W.prev_length=M-1,W.match_available=0,v.next_in=Q,v.input=H,v.avail_in=J,W.wrap=R,f},o.deflateInfo="pako deflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./messages":51,"./trees":52}],47:[function(t,s,o){s.exports=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}},{}],48:[function(t,s,o){s.exports=function(r,i){var n,c,l,d,p,u,f,m,g,x,b,y,k,A,S,N,D,L,M,B,V,P,F,j,z;n=r.state,c=r.next_in,j=r.input,l=c+(r.avail_in-5),d=r.next_out,z=r.output,p=d-(i-r.avail_out),u=d+(r.avail_out-257),f=n.dmax,m=n.wsize,g=n.whave,x=n.wnext,b=n.window,y=n.hold,k=n.bits,A=n.lencode,S=n.distcode,N=(1<<n.lenbits)-1,D=(1<<n.distbits)-1;e:do{k<15&&(y+=j[c++]<<k,k+=8,y+=j[c++]<<k,k+=8),L=A[y&N];t:for(;;){if(y>>>=M=L>>>24,k-=M,(M=L>>>16&255)===0)z[d++]=65535&L;else{if(!(16&M)){if((64&M)==0){L=A[(65535&L)+(y&(1<<M)-1)];continue t}if(32&M){n.mode=12;break e}r.msg="invalid literal/length code",n.mode=30;break e}B=65535&L,(M&=15)&&(k<M&&(y+=j[c++]<<k,k+=8),B+=y&(1<<M)-1,y>>>=M,k-=M),k<15&&(y+=j[c++]<<k,k+=8,y+=j[c++]<<k,k+=8),L=S[y&D];a:for(;;){if(y>>>=M=L>>>24,k-=M,!(16&(M=L>>>16&255))){if((64&M)==0){L=S[(65535&L)+(y&(1<<M)-1)];continue a}r.msg="invalid distance code",n.mode=30;break e}if(V=65535&L,k<(M&=15)&&(y+=j[c++]<<k,(k+=8)<M&&(y+=j[c++]<<k,k+=8)),f<(V+=y&(1<<M)-1)){r.msg="invalid distance too far back",n.mode=30;break e}if(y>>>=M,k-=M,(M=d-p)<V){if(g<(M=V-M)&&n.sane){r.msg="invalid distance too far back",n.mode=30;break e}if(F=b,(P=0)===x){if(P+=m-M,M<B){for(B-=M;z[d++]=b[P++],--M;);P=d-V,F=z}}else if(x<M){if(P+=m+x-M,(M-=x)<B){for(B-=M;z[d++]=b[P++],--M;);if(P=0,x<B){for(B-=M=x;z[d++]=b[P++],--M;);P=d-V,F=z}}}else if(P+=x-M,M<B){for(B-=M;z[d++]=b[P++],--M;);P=d-V,F=z}for(;2<B;)z[d++]=F[P++],z[d++]=F[P++],z[d++]=F[P++],B-=3;B&&(z[d++]=F[P++],1<B&&(z[d++]=F[P++]))}else{for(P=d-V;z[d++]=z[P++],z[d++]=z[P++],z[d++]=z[P++],2<(B-=3););B&&(z[d++]=z[P++],1<B&&(z[d++]=z[P++]))}break}}break}}while(c<l&&d<u);c-=B=k>>3,y&=(1<<(k-=B<<3))-1,r.next_in=c,r.next_out=d,r.avail_in=c<l?l-c+5:5-(c-l),r.avail_out=d<u?u-d+257:257-(d-u),n.hold=y,n.bits=k}},{}],49:[function(t,s,o){var r=t("../utils/common"),i=t("./adler32"),n=t("./crc32"),c=t("./inffast"),l=t("./inftrees"),d=1,p=2,u=0,f=-2,m=1,g=852,x=592;function b(P){return(P>>>24&255)+(P>>>8&65280)+((65280&P)<<8)+((255&P)<<24)}function y(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new r.Buf16(320),this.work=new r.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function k(P){var F;return P&&P.state?(F=P.state,P.total_in=P.total_out=F.total=0,P.msg="",F.wrap&&(P.adler=1&F.wrap),F.mode=m,F.last=0,F.havedict=0,F.dmax=32768,F.head=null,F.hold=0,F.bits=0,F.lencode=F.lendyn=new r.Buf32(g),F.distcode=F.distdyn=new r.Buf32(x),F.sane=1,F.back=-1,u):f}function A(P){var F;return P&&P.state?((F=P.state).wsize=0,F.whave=0,F.wnext=0,k(P)):f}function S(P,F){var j,z;return P&&P.state?(z=P.state,F<0?(j=0,F=-F):(j=1+(F>>4),F<48&&(F&=15)),F&&(F<8||15<F)?f:(z.window!==null&&z.wbits!==F&&(z.window=null),z.wrap=j,z.wbits=F,A(P))):f}function N(P,F){var j,z;return P?(z=new y,(P.state=z).window=null,(j=S(P,F))!==u&&(P.state=null),j):f}var D,L,M=!0;function B(P){if(M){var F;for(D=new r.Buf32(512),L=new r.Buf32(32),F=0;F<144;)P.lens[F++]=8;for(;F<256;)P.lens[F++]=9;for(;F<280;)P.lens[F++]=7;for(;F<288;)P.lens[F++]=8;for(l(d,P.lens,0,288,D,0,P.work,{bits:9}),F=0;F<32;)P.lens[F++]=5;l(p,P.lens,0,32,L,0,P.work,{bits:5}),M=!1}P.lencode=D,P.lenbits=9,P.distcode=L,P.distbits=5}function V(P,F,j,z){var ce,$=P.state;return $.window===null&&($.wsize=1<<$.wbits,$.wnext=0,$.whave=0,$.window=new r.Buf8($.wsize)),z>=$.wsize?(r.arraySet($.window,F,j-$.wsize,$.wsize,0),$.wnext=0,$.whave=$.wsize):(z<(ce=$.wsize-$.wnext)&&(ce=z),r.arraySet($.window,F,j-z,ce,$.wnext),(z-=ce)?(r.arraySet($.window,F,j-z,z,0),$.wnext=z,$.whave=$.wsize):($.wnext+=ce,$.wnext===$.wsize&&($.wnext=0),$.whave<$.wsize&&($.whave+=ce))),0}o.inflateReset=A,o.inflateReset2=S,o.inflateResetKeep=k,o.inflateInit=function(P){return N(P,15)},o.inflateInit2=N,o.inflate=function(P,F){var j,z,ce,$,K,I,X,T,O,Z,oe,se,Ae,Ie,ve,ke,ee,de,ue,xe,v,U,W,C,_=0,R=new r.Buf8(4),J=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!P||!P.state||!P.output||!P.input&&P.avail_in!==0)return f;(j=P.state).mode===12&&(j.mode=13),K=P.next_out,ce=P.output,X=P.avail_out,$=P.next_in,z=P.input,I=P.avail_in,T=j.hold,O=j.bits,Z=I,oe=X,U=u;e:for(;;)switch(j.mode){case m:if(j.wrap===0){j.mode=13;break}for(;O<16;){if(I===0)break e;I--,T+=z[$++]<<O,O+=8}if(2&j.wrap&&T===35615){R[j.check=0]=255&T,R[1]=T>>>8&255,j.check=n(j.check,R,2,0),O=T=0,j.mode=2;break}if(j.flags=0,j.head&&(j.head.done=!1),!(1&j.wrap)||(((255&T)<<8)+(T>>8))%31){P.msg="incorrect header check",j.mode=30;break}if((15&T)!=8){P.msg="unknown compression method",j.mode=30;break}if(O-=4,v=8+(15&(T>>>=4)),j.wbits===0)j.wbits=v;else if(v>j.wbits){P.msg="invalid window size",j.mode=30;break}j.dmax=1<<v,P.adler=j.check=1,j.mode=512&T?10:12,O=T=0;break;case 2:for(;O<16;){if(I===0)break e;I--,T+=z[$++]<<O,O+=8}if(j.flags=T,(255&j.flags)!=8){P.msg="unknown compression method",j.mode=30;break}if(57344&j.flags){P.msg="unknown header flags set",j.mode=30;break}j.head&&(j.head.text=T>>8&1),512&j.flags&&(R[0]=255&T,R[1]=T>>>8&255,j.check=n(j.check,R,2,0)),O=T=0,j.mode=3;case 3:for(;O<32;){if(I===0)break e;I--,T+=z[$++]<<O,O+=8}j.head&&(j.head.time=T),512&j.flags&&(R[0]=255&T,R[1]=T>>>8&255,R[2]=T>>>16&255,R[3]=T>>>24&255,j.check=n(j.check,R,4,0)),O=T=0,j.mode=4;case 4:for(;O<16;){if(I===0)break e;I--,T+=z[$++]<<O,O+=8}j.head&&(j.head.xflags=255&T,j.head.os=T>>8),512&j.flags&&(R[0]=255&T,R[1]=T>>>8&255,j.check=n(j.check,R,2,0)),O=T=0,j.mode=5;case 5:if(1024&j.flags){for(;O<16;){if(I===0)break e;I--,T+=z[$++]<<O,O+=8}j.length=T,j.head&&(j.head.extra_len=T),512&j.flags&&(R[0]=255&T,R[1]=T>>>8&255,j.check=n(j.check,R,2,0)),O=T=0}else j.head&&(j.head.extra=null);j.mode=6;case 6:if(1024&j.flags&&(I<(se=j.length)&&(se=I),se&&(j.head&&(v=j.head.extra_len-j.length,j.head.extra||(j.head.extra=new Array(j.head.extra_len)),r.arraySet(j.head.extra,z,$,se,v)),512&j.flags&&(j.check=n(j.check,z,se,$)),I-=se,$+=se,j.length-=se),j.length))break e;j.length=0,j.mode=7;case 7:if(2048&j.flags){if(I===0)break e;for(se=0;v=z[$+se++],j.head&&v&&j.length<65536&&(j.head.name+=String.fromCharCode(v)),v&&se<I;);if(512&j.flags&&(j.check=n(j.check,z,se,$)),I-=se,$+=se,v)break e}else j.head&&(j.head.name=null);j.length=0,j.mode=8;case 8:if(4096&j.flags){if(I===0)break e;for(se=0;v=z[$+se++],j.head&&v&&j.length<65536&&(j.head.comment+=String.fromCharCode(v)),v&&se<I;);if(512&j.flags&&(j.check=n(j.check,z,se,$)),I-=se,$+=se,v)break e}else j.head&&(j.head.comment=null);j.mode=9;case 9:if(512&j.flags){for(;O<16;){if(I===0)break e;I--,T+=z[$++]<<O,O+=8}if(T!==(65535&j.check)){P.msg="header crc mismatch",j.mode=30;break}O=T=0}j.head&&(j.head.hcrc=j.flags>>9&1,j.head.done=!0),P.adler=j.check=0,j.mode=12;break;case 10:for(;O<32;){if(I===0)break e;I--,T+=z[$++]<<O,O+=8}P.adler=j.check=b(T),O=T=0,j.mode=11;case 11:if(j.havedict===0)return P.next_out=K,P.avail_out=X,P.next_in=$,P.avail_in=I,j.hold=T,j.bits=O,2;P.adler=j.check=1,j.mode=12;case 12:if(F===5||F===6)break e;case 13:if(j.last){T>>>=7&O,O-=7&O,j.mode=27;break}for(;O<3;){if(I===0)break e;I--,T+=z[$++]<<O,O+=8}switch(j.last=1&T,O-=1,3&(T>>>=1)){case 0:j.mode=14;break;case 1:if(B(j),j.mode=20,F!==6)break;T>>>=2,O-=2;break e;case 2:j.mode=17;break;case 3:P.msg="invalid block type",j.mode=30}T>>>=2,O-=2;break;case 14:for(T>>>=7&O,O-=7&O;O<32;){if(I===0)break e;I--,T+=z[$++]<<O,O+=8}if((65535&T)!=(T>>>16^65535)){P.msg="invalid stored block lengths",j.mode=30;break}if(j.length=65535&T,O=T=0,j.mode=15,F===6)break e;case 15:j.mode=16;case 16:if(se=j.length){if(I<se&&(se=I),X<se&&(se=X),se===0)break e;r.arraySet(ce,z,$,se,K),I-=se,$+=se,X-=se,K+=se,j.length-=se;break}j.mode=12;break;case 17:for(;O<14;){if(I===0)break e;I--,T+=z[$++]<<O,O+=8}if(j.nlen=257+(31&T),T>>>=5,O-=5,j.ndist=1+(31&T),T>>>=5,O-=5,j.ncode=4+(15&T),T>>>=4,O-=4,286<j.nlen||30<j.ndist){P.msg="too many length or distance symbols",j.mode=30;break}j.have=0,j.mode=18;case 18:for(;j.have<j.ncode;){for(;O<3;){if(I===0)break e;I--,T+=z[$++]<<O,O+=8}j.lens[J[j.have++]]=7&T,T>>>=3,O-=3}for(;j.have<19;)j.lens[J[j.have++]]=0;if(j.lencode=j.lendyn,j.lenbits=7,W={bits:j.lenbits},U=l(0,j.lens,0,19,j.lencode,0,j.work,W),j.lenbits=W.bits,U){P.msg="invalid code lengths set",j.mode=30;break}j.have=0,j.mode=19;case 19:for(;j.have<j.nlen+j.ndist;){for(;ke=(_=j.lencode[T&(1<<j.lenbits)-1])>>>16&255,ee=65535&_,!((ve=_>>>24)<=O);){if(I===0)break e;I--,T+=z[$++]<<O,O+=8}if(ee<16)T>>>=ve,O-=ve,j.lens[j.have++]=ee;else{if(ee===16){for(C=ve+2;O<C;){if(I===0)break e;I--,T+=z[$++]<<O,O+=8}if(T>>>=ve,O-=ve,j.have===0){P.msg="invalid bit length repeat",j.mode=30;break}v=j.lens[j.have-1],se=3+(3&T),T>>>=2,O-=2}else if(ee===17){for(C=ve+3;O<C;){if(I===0)break e;I--,T+=z[$++]<<O,O+=8}O-=ve,v=0,se=3+(7&(T>>>=ve)),T>>>=3,O-=3}else{for(C=ve+7;O<C;){if(I===0)break e;I--,T+=z[$++]<<O,O+=8}O-=ve,v=0,se=11+(127&(T>>>=ve)),T>>>=7,O-=7}if(j.have+se>j.nlen+j.ndist){P.msg="invalid bit length repeat",j.mode=30;break}for(;se--;)j.lens[j.have++]=v}}if(j.mode===30)break;if(j.lens[256]===0){P.msg="invalid code -- missing end-of-block",j.mode=30;break}if(j.lenbits=9,W={bits:j.lenbits},U=l(d,j.lens,0,j.nlen,j.lencode,0,j.work,W),j.lenbits=W.bits,U){P.msg="invalid literal/lengths set",j.mode=30;break}if(j.distbits=6,j.distcode=j.distdyn,W={bits:j.distbits},U=l(p,j.lens,j.nlen,j.ndist,j.distcode,0,j.work,W),j.distbits=W.bits,U){P.msg="invalid distances set",j.mode=30;break}if(j.mode=20,F===6)break e;case 20:j.mode=21;case 21:if(6<=I&&258<=X){P.next_out=K,P.avail_out=X,P.next_in=$,P.avail_in=I,j.hold=T,j.bits=O,c(P,oe),K=P.next_out,ce=P.output,X=P.avail_out,$=P.next_in,z=P.input,I=P.avail_in,T=j.hold,O=j.bits,j.mode===12&&(j.back=-1);break}for(j.back=0;ke=(_=j.lencode[T&(1<<j.lenbits)-1])>>>16&255,ee=65535&_,!((ve=_>>>24)<=O);){if(I===0)break e;I--,T+=z[$++]<<O,O+=8}if(ke&&(240&ke)==0){for(de=ve,ue=ke,xe=ee;ke=(_=j.lencode[xe+((T&(1<<de+ue)-1)>>de)])>>>16&255,ee=65535&_,!(de+(ve=_>>>24)<=O);){if(I===0)break e;I--,T+=z[$++]<<O,O+=8}T>>>=de,O-=de,j.back+=de}if(T>>>=ve,O-=ve,j.back+=ve,j.length=ee,ke===0){j.mode=26;break}if(32&ke){j.back=-1,j.mode=12;break}if(64&ke){P.msg="invalid literal/length code",j.mode=30;break}j.extra=15&ke,j.mode=22;case 22:if(j.extra){for(C=j.extra;O<C;){if(I===0)break e;I--,T+=z[$++]<<O,O+=8}j.length+=T&(1<<j.extra)-1,T>>>=j.extra,O-=j.extra,j.back+=j.extra}j.was=j.length,j.mode=23;case 23:for(;ke=(_=j.distcode[T&(1<<j.distbits)-1])>>>16&255,ee=65535&_,!((ve=_>>>24)<=O);){if(I===0)break e;I--,T+=z[$++]<<O,O+=8}if((240&ke)==0){for(de=ve,ue=ke,xe=ee;ke=(_=j.distcode[xe+((T&(1<<de+ue)-1)>>de)])>>>16&255,ee=65535&_,!(de+(ve=_>>>24)<=O);){if(I===0)break e;I--,T+=z[$++]<<O,O+=8}T>>>=de,O-=de,j.back+=de}if(T>>>=ve,O-=ve,j.back+=ve,64&ke){P.msg="invalid distance code",j.mode=30;break}j.offset=ee,j.extra=15&ke,j.mode=24;case 24:if(j.extra){for(C=j.extra;O<C;){if(I===0)break e;I--,T+=z[$++]<<O,O+=8}j.offset+=T&(1<<j.extra)-1,T>>>=j.extra,O-=j.extra,j.back+=j.extra}if(j.offset>j.dmax){P.msg="invalid distance too far back",j.mode=30;break}j.mode=25;case 25:if(X===0)break e;if(se=oe-X,j.offset>se){if((se=j.offset-se)>j.whave&&j.sane){P.msg="invalid distance too far back",j.mode=30;break}Ae=se>j.wnext?(se-=j.wnext,j.wsize-se):j.wnext-se,se>j.length&&(se=j.length),Ie=j.window}else Ie=ce,Ae=K-j.offset,se=j.length;for(X<se&&(se=X),X-=se,j.length-=se;ce[K++]=Ie[Ae++],--se;);j.length===0&&(j.mode=21);break;case 26:if(X===0)break e;ce[K++]=j.length,X--,j.mode=21;break;case 27:if(j.wrap){for(;O<32;){if(I===0)break e;I--,T|=z[$++]<<O,O+=8}if(oe-=X,P.total_out+=oe,j.total+=oe,oe&&(P.adler=j.check=j.flags?n(j.check,ce,oe,K-oe):i(j.check,ce,oe,K-oe)),oe=X,(j.flags?T:b(T))!==j.check){P.msg="incorrect data check",j.mode=30;break}O=T=0}j.mode=28;case 28:if(j.wrap&&j.flags){for(;O<32;){if(I===0)break e;I--,T+=z[$++]<<O,O+=8}if(T!==(4294967295&j.total)){P.msg="incorrect length check",j.mode=30;break}O=T=0}j.mode=29;case 29:U=1;break e;case 30:U=-3;break e;case 31:return-4;case 32:default:return f}return P.next_out=K,P.avail_out=X,P.next_in=$,P.avail_in=I,j.hold=T,j.bits=O,(j.wsize||oe!==P.avail_out&&j.mode<30&&(j.mode<27||F!==4))&&V(P,P.output,P.next_out,oe-P.avail_out)?(j.mode=31,-4):(Z-=P.avail_in,oe-=P.avail_out,P.total_in+=Z,P.total_out+=oe,j.total+=oe,j.wrap&&oe&&(P.adler=j.check=j.flags?n(j.check,ce,oe,P.next_out-oe):i(j.check,ce,oe,P.next_out-oe)),P.data_type=j.bits+(j.last?64:0)+(j.mode===12?128:0)+(j.mode===20||j.mode===15?256:0),(Z==0&&oe===0||F===4)&&U===u&&(U=-5),U)},o.inflateEnd=function(P){if(!P||!P.state)return f;var F=P.state;return F.window&&(F.window=null),P.state=null,u},o.inflateGetHeader=function(P,F){var j;return P&&P.state?(2&(j=P.state).wrap)==0?f:((j.head=F).done=!1,u):f},o.inflateSetDictionary=function(P,F){var j,z=F.length;return P&&P.state?(j=P.state).wrap!==0&&j.mode!==11?f:j.mode===11&&i(1,F,z,0)!==j.check?-3:V(P,F,z,z)?(j.mode=31,-4):(j.havedict=1,u):f},o.inflateInfo="pako inflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./inffast":48,"./inftrees":50}],50:[function(t,s,o){var r=t("../utils/common"),i=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],n=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],c=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],l=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];s.exports=function(d,p,u,f,m,g,x,b){var y,k,A,S,N,D,L,M,B,V=b.bits,P=0,F=0,j=0,z=0,ce=0,$=0,K=0,I=0,X=0,T=0,O=null,Z=0,oe=new r.Buf16(16),se=new r.Buf16(16),Ae=null,Ie=0;for(P=0;P<=15;P++)oe[P]=0;for(F=0;F<f;F++)oe[p[u+F]]++;for(ce=V,z=15;1<=z&&oe[z]===0;z--);if(z<ce&&(ce=z),z===0)return m[g++]=20971520,m[g++]=20971520,b.bits=1,0;for(j=1;j<z&&oe[j]===0;j++);for(ce<j&&(ce=j),P=I=1;P<=15;P++)if(I<<=1,(I-=oe[P])<0)return-1;if(0<I&&(d===0||z!==1))return-1;for(se[1]=0,P=1;P<15;P++)se[P+1]=se[P]+oe[P];for(F=0;F<f;F++)p[u+F]!==0&&(x[se[p[u+F]]++]=F);if(D=d===0?(O=Ae=x,19):d===1?(O=i,Z-=257,Ae=n,Ie-=257,256):(O=c,Ae=l,-1),P=j,N=g,K=F=T=0,A=-1,S=(X=1<<($=ce))-1,d===1&&852<X||d===2&&592<X)return 1;for(;;){for(L=P-K,B=x[F]<D?(M=0,x[F]):x[F]>D?(M=Ae[Ie+x[F]],O[Z+x[F]]):(M=96,0),y=1<<P-K,j=k=1<<$;m[N+(T>>K)+(k-=y)]=L<<24|M<<16|B|0,k!==0;);for(y=1<<P-1;T&y;)y>>=1;if(y!==0?(T&=y-1,T+=y):T=0,F++,--oe[P]==0){if(P===z)break;P=p[u+x[F]]}if(ce<P&&(T&S)!==A){for(K===0&&(K=ce),N+=j,I=1<<($=P-K);$+K<z&&!((I-=oe[$+K])<=0);)$++,I<<=1;if(X+=1<<$,d===1&&852<X||d===2&&592<X)return 1;m[A=T&S]=ce<<24|$<<16|N-g|0}}return T!==0&&(m[N+T]=P-K<<24|64<<16|0),b.bits=ce,0}},{"../utils/common":41}],51:[function(t,s,o){s.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},{}],52:[function(t,s,o){var r=t("../utils/common"),i=0,n=1;function c(_){for(var R=_.length;0<=--R;)_[R]=0}var l=0,d=29,p=256,u=p+1+d,f=30,m=19,g=2*u+1,x=15,b=16,y=7,k=256,A=16,S=17,N=18,D=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],L=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],M=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],B=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],V=new Array(2*(u+2));c(V);var P=new Array(2*f);c(P);var F=new Array(512);c(F);var j=new Array(256);c(j);var z=new Array(d);c(z);var ce,$,K,I=new Array(f);function X(_,R,J,Q,H){this.static_tree=_,this.extra_bits=R,this.extra_base=J,this.elems=Q,this.max_length=H,this.has_stree=_&&_.length}function T(_,R){this.dyn_tree=_,this.max_code=0,this.stat_desc=R}function O(_){return _<256?F[_]:F[256+(_>>>7)]}function Z(_,R){_.pending_buf[_.pending++]=255&R,_.pending_buf[_.pending++]=R>>>8&255}function oe(_,R,J){_.bi_valid>b-J?(_.bi_buf|=R<<_.bi_valid&65535,Z(_,_.bi_buf),_.bi_buf=R>>b-_.bi_valid,_.bi_valid+=J-b):(_.bi_buf|=R<<_.bi_valid&65535,_.bi_valid+=J)}function se(_,R,J){oe(_,J[2*R],J[2*R+1])}function Ae(_,R){for(var J=0;J|=1&_,_>>>=1,J<<=1,0<--R;);return J>>>1}function Ie(_,R,J){var Q,H,Y=new Array(x+1),ne=0;for(Q=1;Q<=x;Q++)Y[Q]=ne=ne+J[Q-1]<<1;for(H=0;H<=R;H++){var re=_[2*H+1];re!==0&&(_[2*H]=Ae(Y[re]++,re))}}function ve(_){var R;for(R=0;R<u;R++)_.dyn_ltree[2*R]=0;for(R=0;R<f;R++)_.dyn_dtree[2*R]=0;for(R=0;R<m;R++)_.bl_tree[2*R]=0;_.dyn_ltree[2*k]=1,_.opt_len=_.static_len=0,_.last_lit=_.matches=0}function ke(_){8<_.bi_valid?Z(_,_.bi_buf):0<_.bi_valid&&(_.pending_buf[_.pending++]=_.bi_buf),_.bi_buf=0,_.bi_valid=0}function ee(_,R,J,Q){var H=2*R,Y=2*J;return _[H]<_[Y]||_[H]===_[Y]&&Q[R]<=Q[J]}function de(_,R,J){for(var Q=_.heap[J],H=J<<1;H<=_.heap_len&&(H<_.heap_len&&ee(R,_.heap[H+1],_.heap[H],_.depth)&&H++,!ee(R,Q,_.heap[H],_.depth));)_.heap[J]=_.heap[H],J=H,H<<=1;_.heap[J]=Q}function ue(_,R,J){var Q,H,Y,ne,re=0;if(_.last_lit!==0)for(;Q=_.pending_buf[_.d_buf+2*re]<<8|_.pending_buf[_.d_buf+2*re+1],H=_.pending_buf[_.l_buf+re],re++,Q===0?se(_,H,R):(se(_,(Y=j[H])+p+1,R),(ne=D[Y])!==0&&oe(_,H-=z[Y],ne),se(_,Y=O(--Q),J),(ne=L[Y])!==0&&oe(_,Q-=I[Y],ne)),re<_.last_lit;);se(_,k,R)}function xe(_,R){var J,Q,H,Y=R.dyn_tree,ne=R.stat_desc.static_tree,re=R.stat_desc.has_stree,me=R.stat_desc.elems,Me=-1;for(_.heap_len=0,_.heap_max=g,J=0;J<me;J++)Y[2*J]!==0?(_.heap[++_.heap_len]=Me=J,_.depth[J]=0):Y[2*J+1]=0;for(;_.heap_len<2;)Y[2*(H=_.heap[++_.heap_len]=Me<2?++Me:0)]=1,_.depth[H]=0,_.opt_len--,re&&(_.static_len-=ne[2*H+1]);for(R.max_code=Me,J=_.heap_len>>1;1<=J;J--)de(_,Y,J);for(H=me;J=_.heap[1],_.heap[1]=_.heap[_.heap_len--],de(_,Y,1),Q=_.heap[1],_.heap[--_.heap_max]=J,_.heap[--_.heap_max]=Q,Y[2*H]=Y[2*J]+Y[2*Q],_.depth[H]=(_.depth[J]>=_.depth[Q]?_.depth[J]:_.depth[Q])+1,Y[2*J+1]=Y[2*Q+1]=H,_.heap[1]=H++,de(_,Y,1),2<=_.heap_len;);_.heap[--_.heap_max]=_.heap[1],(function(Ce,qe){var us,At,hs,ze,jo,Gr,Wt=qe.dyn_tree,jc=qe.max_code,yf=qe.stat_desc.static_tree,kf=qe.stat_desc.has_stree,Cf=qe.stat_desc.extra_bits,wc=qe.stat_desc.extra_base,fs=qe.stat_desc.max_length,wo=0;for(ze=0;ze<=x;ze++)Ce.bl_count[ze]=0;for(Wt[2*Ce.heap[Ce.heap_max]+1]=0,us=Ce.heap_max+1;us<g;us++)fs<(ze=Wt[2*Wt[2*(At=Ce.heap[us])+1]+1]+1)&&(ze=fs,wo++),Wt[2*At+1]=ze,jc<At||(Ce.bl_count[ze]++,jo=0,wc<=At&&(jo=Cf[At-wc]),Gr=Wt[2*At],Ce.opt_len+=Gr*(ze+jo),kf&&(Ce.static_len+=Gr*(yf[2*At+1]+jo)));if(wo!==0){do{for(ze=fs-1;Ce.bl_count[ze]===0;)ze--;Ce.bl_count[ze]--,Ce.bl_count[ze+1]+=2,Ce.bl_count[fs]--,wo-=2}while(0<wo);for(ze=fs;ze!==0;ze--)for(At=Ce.bl_count[ze];At!==0;)jc<(hs=Ce.heap[--us])||(Wt[2*hs+1]!==ze&&(Ce.opt_len+=(ze-Wt[2*hs+1])*Wt[2*hs],Wt[2*hs+1]=ze),At--)}})(_,R),Ie(Y,Me,_.bl_count)}function v(_,R,J){var Q,H,Y=-1,ne=R[1],re=0,me=7,Me=4;for(ne===0&&(me=138,Me=3),R[2*(J+1)+1]=65535,Q=0;Q<=J;Q++)H=ne,ne=R[2*(Q+1)+1],++re<me&&H===ne||(re<Me?_.bl_tree[2*H]+=re:H!==0?(H!==Y&&_.bl_tree[2*H]++,_.bl_tree[2*A]++):re<=10?_.bl_tree[2*S]++:_.bl_tree[2*N]++,Y=H,Me=(re=0)===ne?(me=138,3):H===ne?(me=6,3):(me=7,4))}function U(_,R,J){var Q,H,Y=-1,ne=R[1],re=0,me=7,Me=4;for(ne===0&&(me=138,Me=3),Q=0;Q<=J;Q++)if(H=ne,ne=R[2*(Q+1)+1],!(++re<me&&H===ne)){if(re<Me)for(;se(_,H,_.bl_tree),--re!=0;);else H!==0?(H!==Y&&(se(_,H,_.bl_tree),re--),se(_,A,_.bl_tree),oe(_,re-3,2)):re<=10?(se(_,S,_.bl_tree),oe(_,re-3,3)):(se(_,N,_.bl_tree),oe(_,re-11,7));Y=H,Me=(re=0)===ne?(me=138,3):H===ne?(me=6,3):(me=7,4)}}c(I);var W=!1;function C(_,R,J,Q){oe(_,(l<<1)+(Q?1:0),3),(function(H,Y,ne,re){ke(H),Z(H,ne),Z(H,~ne),r.arraySet(H.pending_buf,H.window,Y,ne,H.pending),H.pending+=ne})(_,R,J)}o._tr_init=function(_){W||((function(){var R,J,Q,H,Y,ne=new Array(x+1);for(H=Q=0;H<d-1;H++)for(z[H]=Q,R=0;R<1<<D[H];R++)j[Q++]=H;for(j[Q-1]=H,H=Y=0;H<16;H++)for(I[H]=Y,R=0;R<1<<L[H];
103R++)F[Y++]=H;for(Y>>=7;H<f;H++)for(I[H]=Y<<7,R=0;R<1<<L[H]-7;R++)F[256+Y++]=H;for(J=0;J<=x;J++)ne[J]=0;for(R=0;R<=143;)V[2*R+1]=8,R++,ne[8]++;for(;R<=255;)V[2*R+1]=9,R++,ne[9]++;for(;R<=279;)V[2*R+1]=7,R++,ne[7]++;for(;R<=287;)V[2*R+1]=8,R++,ne[8]++;for(Ie(V,u+1,ne),R=0;R<f;R++)P[2*R+1]=5,P[2*R]=Ae(R,5);ce=new X(V,D,p+1,u,x),$=new X(P,L,0,f,x),K=new X(new Array(0),M,0,m,y)})(),W=!0),_.l_desc=new T(_.dyn_ltree,ce),_.d_desc=new T(_.dyn_dtree,$),_.bl_desc=new T(_.bl_tree,K),_.bi_buf=0,_.bi_valid=0,ve(_)},o._tr_stored_block=C,o._tr_flush_block=function(_,R,J,Q){var H,Y,ne=0;0<_.level?(_.strm.data_type===2&&(_.strm.data_type=(function(re){var me,Me=4093624447;for(me=0;me<=31;me++,Me>>>=1)if(1&Me&&re.dyn_ltree[2*me]!==0)return i;if(re.dyn_ltree[18]!==0||re.dyn_ltree[20]!==0||re.dyn_ltree[26]!==0)return n;for(me=32;me<p;me++)if(re.dyn_ltree[2*me]!==0)return n;return i})(_)),xe(_,_.l_desc),xe(_,_.d_desc),ne=(function(re){var me;for(v(re,re.dyn_ltree,re.l_desc.max_code),v(re,re.dyn_dtree,re.d_desc.max_code),xe(re,re.bl_desc),me=m-1;3<=me&&re.bl_tree[2*B[me]+1]===0;me--);return re.opt_len+=3*(me+1)+5+5+4,me})(_),H=_.opt_len+3+7>>>3,(Y=_.static_len+3+7>>>3)<=H&&(H=Y)):H=Y=J+5,J+4<=H&&R!==-1?C(_,R,J,Q):_.strategy===4||Y===H?(oe(_,2+(Q?1:0),3),ue(_,V,P)):(oe(_,4+(Q?1:0),3),(function(re,me,Me,Ce){var qe;for(oe(re,me-257,5),oe(re,Me-1,5),oe(re,Ce-4,4),qe=0;qe<Ce;qe++)oe(re,re.bl_tree[2*B[qe]+1],3);U(re,re.dyn_ltree,me-1),U(re,re.dyn_dtree,Me-1)})(_,_.l_desc.max_code+1,_.d_desc.max_code+1,ne+1),ue(_,_.dyn_ltree,_.dyn_dtree)),ve(_),Q&&ke(_)},o._tr_tally=function(_,R,J){return _.pending_buf[_.d_buf+2*_.last_lit]=R>>>8&255,_.pending_buf[_.d_buf+2*_.last_lit+1]=255&R,_.pending_buf[_.l_buf+_.last_lit]=255&J,_.last_lit++,R===0?_.dyn_ltree[2*J]++:(_.matches++,R--,_.dyn_ltree[2*(j[J]+p+1)]++,_.dyn_dtree[2*O(R)]++),_.last_lit===_.lit_bufsize-1},o._tr_align=function(_){oe(_,2,3),se(_,k,V),(function(R){R.bi_valid===16?(Z(R,R.bi_buf),R.bi_buf=0,R.bi_valid=0):8<=R.bi_valid&&(R.pending_buf[R.pending++]=255&R.bi_buf,R.bi_buf>>=8,R.bi_valid-=8)})(_)}},{"../utils/common":41}],53:[function(t,s,o){s.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(t,s,o){(function(r){(function(i,n){if(!i.setImmediate){var c,l,d,p,u=1,f={},m=!1,g=i.document,x=Object.getPrototypeOf&&Object.getPrototypeOf(i);x=x&&x.setTimeout?x:i,c={}.toString.call(i.process)==="[object process]"?function(A){process.nextTick(function(){y(A)})}:(function(){if(i.postMessage&&!i.importScripts){var A=!0,S=i.onmessage;return i.onmessage=function(){A=!1},i.postMessage("","*"),i.onmessage=S,A}})()?(p="setImmediate$"+Math.random()+"$",i.addEventListener?i.addEventListener("message",k,!1):i.attachEvent("onmessage",k),function(A){i.postMessage(p+A,"*")}):i.MessageChannel?((d=new MessageChannel).port1.onmessage=function(A){y(A.data)},function(A){d.port2.postMessage(A)}):g&&"onreadystatechange"in g.createElement("script")?(l=g.documentElement,function(A){var S=g.createElement("script");S.onreadystatechange=function(){y(A),S.onreadystatechange=null,l.removeChild(S),S=null},l.appendChild(S)}):function(A){setTimeout(y,0,A)},x.setImmediate=function(A){typeof A!="function"&&(A=new Function(""+A));for(var S=new Array(arguments.length-1),N=0;N<S.length;N++)S[N]=arguments[N+1];var D={callback:A,args:S};return f[u]=D,c(u),u++},x.clearImmediate=b}function b(A){delete f[A]}function y(A){if(m)setTimeout(y,0,A);else{var S=f[A];if(S){m=!0;try{(function(N){var D=N.callback,L=N.args;switch(L.length){case 0:D();break;case 1:D(L[0]);break;case 2:D(L[0],L[1]);break;case 3:D(L[0],L[1],L[2]);break;default:D.apply(n,L)}})(S)}finally{b(A),m=!1}}}}function k(A){A.source===i&&typeof A.data=="string"&&A.data.indexOf(p)===0&&y(+A.data.slice(p.length))}})(typeof self>"u"?r===void 0?this:r:self)}).call(this,typeof yo<"u"?yo:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})})(bi)),bi.exports}var uj=pj();const hj=Sf(uj),fj=` 104 .custom-scrollbar::-webkit-scrollbar {
105 width: 6px; 106 } 107 108 .custom-scrollbar::-webkit-scrollbar-track { 109 background: rgba(0, 0, 0, 0.05); 110 border-radius: 6px; 111 } 112 113 .custom-scrollbar::-webkit-scrollbar-thumb { 114 background-color: rgba(156, 163, 175, 0.6); 115 border-radius: 6px; 116 transition: background-color 0.2s ease; 117 } 118 119 .custom-scrollbar::-webkit-scrollbar-thumb:hover { 120 background-color: rgba(107, 114, 128, 0.8); 121 } 122 123 .dark .custom-scrollbar::-webkit-scrollbar-track { 124 background: rgba(255, 255, 255, 0.05); 125 } 126 127 .dark .custom-scrollbar::-webkit-scrollbar-thumb { 128 background-color: rgba(107, 114, 128, 0.6); 129 } 130 131 .dark .custom-scrollbar::-webkit-scrollbar-thumb:hover { 132 background-color: rgba(156, 163, 175, 0.8); 133 } 134 135 /* Make sure the scrollbar is always visible */ 136 .custom-scrollbar { 137 scrollbar-width: thin; 138 scrollbar-color: rgba(156, 163, 175, 0.6) rgba(0, 0, 0, 0.05); 139 } 140 141 .dark .custom-scrollbar {
142 scrollbar-color: rgba(107, 114, 128, 0.6) rgba(255, 255, 255, 0.05); 143 } 144`,mj=({tree:a,onFileSelect:e,handleRunCode:t})=>{const[s,o]=E.useState(new Set),r=E.useRef(new Set),i=ge(ee=>ee.chatMessages),n=Ya(i),c=je(ee=>ee.activeFile),l=je(ee=>ee.fileToScrollIntoView),d=je(ee=>ee.setFileToScrollIntoView),p=ge(ee=>ee.currentlyStreamingFile),u=Bf(i),{toast:f}=po(),m=E.useRef({}),g=je(ee=>ee.editedFiles),[x,b]=E.useState([]),[y,k]=E.useState(!1),[A,S]=E.useState(""),[N,D]=E.useState(!1),L=E.useCallback(ee=>g?je.getState().isFileEdited(ee):!1,[g]),M=ge(ee=>ee.isSendingMessage),B=ge(ee=>ee.activeStreamingMessageId),V=i.length>0?i[i.length-1]:null,P=E.useMemo(()=>{if(!V?.full_response)return!1;const ee=V.full_response;if(ee.length<=1)return!1;const de=ee.map(ue=>ue.type).lastIndexOf("artifact");return de===-1?!1:ee.slice(de+1).some(ue=>ue.type==="text")},[V]),F=M||B!==null||ge.getState().isLoadingProject,j=!a||Object.keys(a).length===0,z=ee=>{const ue=(ee&&ee.trim()?ee:"project").replace(/[\\/:*?"<>|]/g,"").replace(/\s+/g,"_").trim(),xe=200,U=(ue.length>xe?ue.substring(0,xe):ue)||"project";return U.toLowerCase().endsWith(".zip")?U:`${U}.zip`},ce=E.useCallback(async()=>{const ee=new hj;n?.files.forEach(U=>{ee.file(U.path,U.content)});const de=await ee.generateAsync({type:"blob"}),ue=window.URL.createObjectURL(de),xe=document.createElement("a");xe.href=ue;const v=n?.title;xe.download=z(v),xe.click(),window.URL.revokeObjectURL(ue)},[n?.files,n?.title]),$=ee=>{if(!ee)return;const de=ee.split("/");o(ue=>{const xe=new Set(ue);let v="";for(let U=0;U<de.length-1;U++)v=v?`${v}/${de[U]}`:de[U],xe.add(v),r.current.delete(v);return xe})},K=(ee,de)=>{if(!ee||!de)return null;const ue=de.split("/");let xe=ee;for(let v=0;v<ue.length;v++){const U=ue[v];if(v===ue.length-1)return xe[U];if(!xe[U]||xe[U].type!=="folder")return null;xe=xe[U].children}return null},I=(ee,de)=>{if(!ee||!de)return null;const ue=(xe,v="")=>{for(const[U,W]of Object.entries(xe)){const C=v?`${v}/${U}`:U;if(W.type==="file"&&U===de)return C;if(W.type==="folder"&&W.children){const _=ue(W.children,C);if(_)return _}}return null};return ue(ee)};E.useEffect(()=>{l&&($(l),setTimeout(()=>{if(m.current[l])m.current[l].scrollIntoView({behavior:"smooth",block:"center"}),d(null);else{He.log("File ref not found for:",l);const ee=l.split("/").pop();if(ee){const de=I(a,ee);if(de){$(de),e&&e(de,!0);return}else f({title:"File not found",description:`Could not find file: ${ee}`,duration:3e3})}setTimeout(()=>{m.current[l]&&m.current[l].scrollIntoView({behavior:"smooth",block:"center"}),d(null)},300)}},100))},[l,d,a,e]),E.useEffect(()=>{const ee=(de,ue="")=>{if(!de)return new Set;const xe=new Set;return Object.entries(de).forEach(([v,U])=>{const W=ue?`${ue}/${v}`:v;U.type==="folder"&&(r.current.has(W)||xe.add(W),ee(U.children,W).forEach(_=>{r.current.has(_)||xe.add(_)}))}),xe};o(ee(a))},[a]);const X=ee=>{o(de=>{const ue=new Set(de);return ue.has(ee)?(ue.delete(ee),r.current.add(ee)):(ue.add(ee),r.current.delete(ee)),ue})},T=E.useCallback((ee,de="",ue=[])=>{if(!ee)return ue;const xe=Object.entries(ee).sort((v,U)=>{const W=v[1].type==="folder",C=U[1].type==="folder";return W===C?v[0].localeCompare(U[0]):W?-1:1});for(const[v,U]of xe){const W=de?`${de}/${v}`:v;U.type==="folder"?s.has(W)&&T(U.children,W,ue):ue.push(W)}return ue},[s]);E.useEffect(()=>{const ee=T(a);b(ee)},[a,s,T]);const O=E.useCallback(ee=>{if(ee===c)return;ee.toLowerCase().endsWith(".md")?je.getState().setIsPreviewMode(!0):je.getState().setIsPreviewMode(!1);const ue=K(a,ee);ue&&!P&&F&&(p?.path===ee||ue.isPartial===!0||ue.isLastFile===!0)&&ge.getState().setCurrentlyStreamingFile({path:ee,isPartial:!0,isLastFile:!0,content:ue.content||"",language:ue.language||"plaintext"}),e&&e(ee,!0)},[c,e,a,P,F,p]);E.useEffect(()=>{const ee=de=>{if(de.key!=="ArrowUp"&&de.key!=="ArrowDown"||de.target.tagName==="INPUT"||de.target.tagName==="TEXTAREA"||de.target.isContentEditable||(de.preventDefault(),x.length===0))return;const ue=x.indexOf(c);let xe;ue===-1?xe=0:de.key==="ArrowUp"?xe=Math.max(0,ue-1):de.key==="ArrowDown"&&(xe=Math.min(x.length-1,ue+1));
144const v=x[xe];v&&v!==c&&(O(v),d(v))};return window.addEventListener("keydown",ee),()=>{window.removeEventListener("keydown",ee)}},[x,c,O,d]);const Z=E.useCallback(async ee=>{const de=ge.getState().project;if(!de?.id){f({title:"Project Not Ready",description:"Please wait for the project to finish loading before creating files.",variant:"destructive",duration:3e3});return}let ue;const xe=Ya(i),v={...xe||{},id:xe?.id||"",title:xe?.title||"",entry:xe?.entry||"",deleted_files:xe?.deleted_files||[]},U=JSON.parse(JSON.stringify(v));D(!0),k(!1);try{ue=ge.getState().addSystemMessage("Creating new file...","files_saved","in_progress",[ee]),ge.getState().setIsSavingProject(!0);const W=await zf(de.id,{path:ee,content:""});if(W.file){const C={path:ee,content:W.file.content||"",language:W.file.language||"",isNew:!0};v.files=[...v.files||[],C],!v.entry&&(!v.files||v.files.length<=1)&&(v.entry=ee),ge.getState().updateChatMessage(ue,{full_response:[{type:"artifact",value:v}],generated_files:[ee],files:v.files},"done"),e&&e(ee,!0),d(ee),f({title:"File Created",description:`Successfully created ${ee}`,duration:3e3})}}catch(W){console.error("Error creating file:",W),ue&&ge.getState().updateChatMessage(ue,{message_type:"system",message_system_type:"files_saved",full_response:[{type:"artifact",value:U}],generated_files:[],files:U.files},"error"),f({title:"Error Creating File",description:W instanceof Error?W.message:"An unknown error occurred",variant:"destructive",duration:3e3})}finally{ge.getState().setIsSavingProject(!1),D(!1)}},[i,e,d,f]),oe=()=>{const ee=Gt.getState().isSignedIn,de=Gt.getState().user,ue=ge.getState().project;if(!ee){f({title:"Not Signed In",description:"You need to be signed in to create files",variant:"info",action:h.jsx("a",{"data-codepal-ve-id":"src-pages-project-codeviewer-fileexplorer-tsx:handlenewfile:a:607:25","data-codepal-binding-id":"src-pages-project-codeviewer-fileexplorer-tsx:handlenewfile:a:607:25","data-codepal-module-id":"src-pages-project-codeviewer-fileexplorer-tsx","data-codepal-component-id":"src-pages-project-codeviewer-fileexplorer-tsx:handlenewfile","data-codepal-source-node-id":"src-pages-project-codeviewer-fileexplorer-tsx:handlenewfile:a:607:25","data-codepal-source-file":"src/pages/Project/CodeViewer/FileExplorer.tsx","data-codepal-source-line":"607","data-codepal-source-column":"25","data-codepal-source-symbol":"handleNewFile",href:cm(),onClick:xe=>{xe.preventDefault(),Gt.getState().signIn(`${window.location.pathname}${window.location.search}`)},className:"underline text-white-500 hover:text-white-600 transition-colors",children:"Sign in"}),duration:5e3});return}if(ue.user_id&&ue.user_id!==de._id){f({title:"Permission Denied",description:"To create files in this project, clone it first.",variant:"destructive",duration:4e3});return}if(de?.isStarterSubscription){f({title:"Plan Limitation",description:"Creating files is not available on the Starter plan.",variant:"info",action:h.jsx("a",{"data-codepal-ve-id":"src-pages-project-codeviewer-fileexplorer-tsx:handlenewfile:a:633:25","data-codepal-binding-id":"src-pages-project-codeviewer-fileexplorer-tsx:handlenewfile:a:633:25","data-codepal-module-id":"src-pages-project-codeviewer-fileexplorer-tsx","data-codepal-component-id":"src-pages-project-codeviewer-fileexplorer-tsx:handlenewfile","data-codepal-source-node-id":"src-pages-project-codeviewer-fileexplorer-tsx:handlenewfile:a:633:25","data-codepal-source-file":"src/pages/Project/CodeViewer/FileExplorer.tsx","data-codepal-source-line":"633","data-codepal-source-column":"25","data-codepal-source-symbol":"handleNewFile",href:"/pricing",className:"underline text-white-500 hover:text-white-600 transition-colors",children:"Upgrade your plan"}),duration:5e3});return}S(""),k(!0)},se=async ee=>{ee.preventDefault();const de=A.trim();if(!de){f({title:"Invalid Filename",description:"Please enter a valid file name",variant:"destructive",duration:3e3});return}await Z(de)},Ae=()=>{o(new Set);const ee=ve(a);r.current=new Set(ee)},Ie=()=>{o(ve(a)),r.current=new Set},ve=(ee,de="")=>{if(!ee)return new Set;const ue=new Set;return Object.entries(ee).forEach(([xe,v])=>{const U=de?`${de}/${xe}`:xe;
144v.type==="folder"&&(ue.add(U),ve(v.children,U).forEach(C=>ue.add(C)))}),ue},ke=(ee,de="",ue=0)=>ee?Object.entries(ee).sort((v,U)=>{const W=v[1].type==="folder",C=U[1].type==="folder";return W===C?v[0].localeCompare(U[0]):W?-1:1}).map(([v,U])=>{const W=de?`${de}/${v}`:v,C=U.type==="folder",_=W===c,R=s.has(W),J=!P&&p?.path===W&&F,Q=!P&&U.isPartial===!0,H=!P&&U.isLastFile===!0,Y=U.isNew===!0,ne=!P&&F&&(J||Q||H),re=L(W),me=W===u;return C?h.jsxs("div",{"data-codepal-ve-id":"src-pages-project-codeviewer-fileexplorer-tsx:renderfiletree:div:730:21","data-codepal-binding-id":"src-pages-project-codeviewer-fileexplorer-tsx:renderfiletree:div:730:21","data-codepal-module-id":"src-pages-project-codeviewer-fileexplorer-tsx","data-codepal-component-id":"src-pages-project-codeviewer-fileexplorer-tsx:renderfiletree","data-codepal-source-node-id":"src-pages-project-codeviewer-fileexplorer-tsx:renderfiletree:div:730:21","data-codepal-source-file":"src/pages/Project/CodeViewer/FileExplorer.tsx","data-codepal-source-line":"730","data-codepal-source-column":"21","data-codepal-source-symbol":"renderFileTree",className:"select-none",children:[h.jsxs("div",{"data-codepal-ve-id":"src-pages-project-codeviewer-fileexplorer-tsx:renderfiletree:div:731:25","data-codepal-binding-id":"src-pages-project-codeviewer-fileexplorer-tsx:renderfiletree:div:731:25","data-codepal-module-id":"src-pages-project-codeviewer-fileexplorer-tsx","data-codepal-component-id":"src-pages-project-codeviewer-fileexplorer-tsx:renderfiletree","data-codepal-source-node-id":"src-pages-project-codeviewer-fileexplorer-tsx:renderfiletree:div:731:25","data-codepal-source-file":"src/pages/Project/CodeViewer/FileExplorer.tsx","data-codepal-source-line":"731","data-codepal-source-column":"25","data-codepal-source-symbol":"renderFileTree",className:ie("flex items-center py-1 px-2 hover:bg-gray-200 dark:hover:bg-slate-700 cursor-pointer truncate transition-none text-gray-800 dark:text-gray-200",ue===0?"mt-1":""),onClick:()=>X(W),style:{paddingLeft:`${ue*12+8}px`},children:[h.jsx(Bs,{className:ie("h-4 w-4 mr-1 transition-transform",R?"transform rotate-90":"")}),h.jsx(Mn,{className:"h-4 w-4 mr-2 text-blue-500"}),h.jsx("span",{"data-codepal-ve-id":"src-pages-project-codeviewer-fileexplorer-tsx:renderfiletree:span:746:29","data-codepal-binding-id":"src-pages-project-codeviewer-fileexplorer-tsx:renderfiletree:span:746:29","data-codepal-module-id":"src-pages-project-codeviewer-fileexplorer-tsx","data-codepal-component-id":"src-pages-project-codeviewer-fileexplorer-tsx:renderfiletree","data-codepal-source-node-id":"src-pages-project-codeviewer-fileexplorer-tsx:renderfiletree:span:746:29","data-codepal-source-file":"src/pages/Project/CodeViewer/FileExplorer.tsx","data-codepal-source-line":"746","data-codepal-source-column":"29","data-codepal-source-symbol":"renderFileTree",className:"truncate text-sm",children:v})]}),R&&h.jsx("div",{"data-codepal-ve-id":"src-pages-project-codeviewer-fileexplorer-tsx:renderfiletree:div:749:29","data-codepal-binding-id":"src-pages-project-codeviewer-fileexplorer-tsx:renderfiletree:div:749:29","data-codepal-module-id":"src-pages-project-codeviewer-fileexplorer-tsx","data-codepal-component-id":"src-pages-project-codeviewer-fileexplorer-tsx:renderfiletree","data-codepal-source-node-id":"src-pages-project-codeviewer-fileexplorer-tsx:renderfiletree:div:749:29","data-codepal-source-file":"src/pages/Project/CodeViewer/FileExplorer.tsx","data-codepal-source-line":"749","data-codepal-source-column":"29","data-codepal-source-symbol":"renderFileTree",children:ke(U.children,W,ue+1)})]},W):h.jsxs("div",{"data-codepal-ve-id":"src-pages-project-codeviewer-fileexplorer-tsx:renderfiletree:div:757:21","data-codepal-binding-id":"src-pages-project-codeviewer-fileexplorer-tsx:renderfiletree:div:757:21","data-codepal-module-id":"src-pages-project-codeviewer-fileexplorer-tsx","data-codepal-component-id":"src-pages-project-codeviewer-fileexplorer-tsx:renderfiletree","data-codepal-source-node-id":"src-pages-project-codeviewer-fileexplorer-tsx:renderfiletree:div:757:21","data-codepal-source-file":"src/pages/Project/CodeViewer/FileExplorer.tsx","data-codepal-source-line":"757","data-codepal-source-column":"21","data-codepal-source-symbol":"renderFileTree",ref:Me=>m.current[W]=Me,className:ie("flex items-center py-1 px-2 truncate group cursor-pointer transition-none",_?"bg-blue-100 dar
144k:bg-blue-900/30 text-blue-700 dark:text-blue-300":"hover:bg-gray-200 dark:hover:bg-slate-700 text-gray-800 dark:text-gray-200",me&&"text-green-500 dark:text-green-400",re?"font-medium":"",me?"font-medium":"",ne&&Y?"border-l-2 border-purple-500":"",ne&&!Y?"border-l-2 border-green-500":""),onClick:()=>O(W),style:{paddingLeft:ne?`${ue*12+26}px`:`${ue*12+28}px`},title:v,children:[h.jsx("div",{"data-codepal-ve-id":"src-pages-project-codeviewer-fileexplorer-tsx:renderfiletree:div:779:25","data-codepal-binding-id":"src-pages-project-codeviewer-fileexplorer-tsx:renderfiletree:div:779:25","data-codepal-module-id":"src-pages-project-codeviewer-fileexplorer-tsx","data-codepal-component-id":"src-pages-project-codeviewer-fileexplorer-tsx:renderfiletree","data-codepal-source-node-id":"src-pages-project-codeviewer-fileexplorer-tsx:renderfiletree:div:779:25","data-codepal-source-file":"src/pages/Project/CodeViewer/FileExplorer.tsx","data-codepal-source-line":"779","data-codepal-source-column":"25","data-codepal-source-symbol":"renderFileTree",className:"flex-shrink-0 mr-2",children:h.jsx(Yd,{fileName:v})}),h.jsx("span",{"data-codepal-ve-id":"src-pages-project-codeviewer-fileexplorer-tsx:renderfiletree:span:782:25","data-codepal-binding-id":"src-pages-project-codeviewer-fileexplorer-tsx:renderfiletree:span:782:25","data-codepal-module-id":"src-pages-project-codeviewer-fileexplorer-tsx","data-codepal-component-id":"src-pages-project-codeviewer-fileexplorer-tsx:renderfiletree","data-codepal-source-node-id":"src-pages-project-codeviewer-fileexplorer-tsx:renderfiletree:span:782:25","data-codepal-source-file":"src/pages/Project/CodeViewer/FileExplorer.tsx","data-codepal-source-line":"782","data-codepal-source-column":"25","data-codepal-source-symbol":"renderFileTree",className:ie("truncate text-sm flex-grow",ne&&Y&&"text-purple-600 dark:text-purple-400",ne&&!Y&&"text-green-600 dark:text-green-400"),children:v}),re&&h.jsx(_m,{className:"h-3.5 w-3.5 text-amber-500 ml-1 flex-shrink-0"}),ne&&h.jsx("div",{"data-codepal-ve-id":"src-pages-project-codeviewer-fileexplorer-tsx:renderfiletree:div:793:29","data-codepal-binding-id":"src-pages-project-codeviewer-fileexplorer-tsx:renderfiletree:div:793:29","data-codepal-module-id":"src-pages-project-codeviewer-fileexplorer-tsx","data-codepal-component-id":"src-pages-project-codeviewer-fileexplorer-tsx:renderfiletree","data-codepal-source-node-id":"src-pages-project-codeviewer-fileexplorer-tsx:renderfiletree:div:793:29","data-codepal-source-file":"src/pages/Project/CodeViewer/FileExplorer.tsx","data-codepal-source-line":"793","data-codepal-source-column":"29","data-codepal-source-symbol":"renderFileTree",className:ie("ml-1 h-2 w-2 rounded-full animate-pulse flex-shrink-0",Y?"bg-purple-500":"bg-green-500")})]},W)}):null;return F&&!n?.files?.length?h.jsx(sj,{}):h.jsxs("div",{"data-codepal-ve-id":"src-pages-project-codeviewer-fileexplorer-tsx:fileexplorer:div:810:9","data-codepal-binding-id":"src-pages-project-codeviewer-fileexplorer-tsx:fileexplorer:div:810:9","data-codepal-module-id":"src-pages-project-codeviewer-fileexplorer-tsx","data-codepal-component-id":"src-pages-project-codeviewer-fileexplorer-tsx:fileexplorer","data-codepal-source-node-id":"src-pages-project-codeviewer-fileexplorer-tsx:fileexplorer:div:810:9","data-codepal-source-file":"src/pages/Project/CodeViewer/FileExplorer.tsx","data-codepal-source-line":"810","data-codepal-source-column":"9","data-codepal-source-symbol":"FileExplorer",className:"flex flex-col h-full",children:[h.jsx("style",{"data-codepal-ve-id":"src-pages-project-codeviewer-fileexplorer-tsx:fileexplorer:style:812:13","data-codepal-binding-id":"src-pages-project-codeviewer-fileexplorer-tsx:fileexplorer:style:812:13","data-codepal-module-id":"src-pages-project-codeviewer-fileexplorer-tsx","data-codepal-component-id":"src-pages-project-codeviewer-fileexplorer-tsx:fileexplorer","data-codepal-source-node-id":"src-pages-project-codeviewer-fileexplorer-tsx:fileexplorer:style:812:13","data-codepal-source-file":"src/pages/Project/CodeViewer/FileExplorer.tsx","data-codepal-source-line":"812","data-codepal-source-column":"13","data-codepal-source-symbol":"FileExplorer",children:fj}),h.jsx(nh,{onRunCode:()=>{t&&t()},onNewFile:oe,onCollapseAll:ve(a).size?Ae:void 0,onExpandAll:ve(a).size?Ie:void 0,onDownloadProject:ce}),h.jsx(Xd,{open:y,onOpenChange:ee=>{N||k(ee)},children:h.jsx(Jd,{className:"max-w-sm",children:h.jsxs("form",{"data-codepal-ve-id":"src-pages-project-codeviewer-fileexplorer-tsx:fileexplorer:form:831:21","data-codepal-binding-id":"src-pages-project-codeviewer-fileexplorer-tsx:fileexplorer:form:831:21","data-codepal-module-id":"src-pages-project-codeviewer-fileexplorer-tsx","data-codepal-component-id":"src-pages-project-codeviewer-fileexplorer-tsx:fileexplorer","data-codepal-source-node
144-id":"src-pages-project-codeviewer-fileexplorer-tsx:fileexplorer:form:831:21","data-codepal-source-file":"src/pages/Project/CodeViewer/FileExplorer.tsx","data-codepal-source-line":"831","data-codepal-source-column":"21","data-codepal-source-symbol":"FileExplorer",onSubmit:se,children:[h.jsxs(Zd,{children:[h.jsx(Qd,{children:"Create New File"}),h.jsx(ep,{children:"Enter the file name or path for the new file"})]}),h.jsx(tp,{autoFocus:!0,value:A,onChange:ee=>S(ee.target.value),placeholder:"example.js or folder/example.js",disabled:N}),h.jsxs(fm,{children:[h.jsx(yt,{type:"button",variant:"outline",onClick:()=>k(!1),disabled:N,children:"Cancel"}),h.jsx(yt,{type:"submit",disabled:N,children:"Create"})]})]})})}),j?h.jsxs("div",{"data-codepal-ve-id":"src-pages-project-codeviewer-fileexplorer-tsx:fileexplorer:div:864:17","data-codepal-binding-id":"src-pages-project-codeviewer-fileexplorer-tsx:fileexplorer:div:864:17","data-codepal-module-id":"src-pages-project-codeviewer-fileexplorer-tsx","data-codepal-component-id":"src-pages-project-codeviewer-fileexplorer-tsx:fileexplorer","data-codepal-source-node-id":"src-pages-project-codeviewer-fileexplorer-tsx:fileexplorer:div:864:17","data-codepal-source-file":"src/pages/Project/CodeViewer/FileExplorer.tsx","data-codepal-source-line":"864","data-codepal-source-column":"17","data-codepal-source-symbol":"FileExplorer",className:"flex flex-col items-center justify-center text-center px-4 py-8",children:[h.jsx(Rs,{className:"w-8 h-8 text-gray-400 dark:text-gray-500 mb-2"}),h.jsx("p",{"data-codepal-ve-id":"src-pages-project-codeviewer-fileexplorer-tsx:fileexplorer:p:866:21","data-codepal-binding-id":"src-pages-project-codeviewer-fileexplorer-tsx:fileexplorer:p:866:21","data-codepal-module-id":"src-pages-project-codeviewer-fileexplorer-tsx","data-codepal-component-id":"src-pages-project-codeviewer-fileexplorer-tsx:fileexplorer","data-codepal-source-node-id":"src-pages-project-codeviewer-fileexplorer-tsx:fileexplorer:p:866:21","data-codepal-source-file":"src/pages/Project/CodeViewer/FileExplorer.tsx","data-codepal-source-line":"866","data-codepal-source-column":"21","data-codepal-source-symbol":"FileExplorer",className:"text-sm text-gray-600 dark:text-gray-400",children:"No files to display"})]}):h.jsx("div",{"data-codepal-ve-id":"src-pages-project-codeviewer-fileexplorer-tsx:fileexplorer:div:871:17","data-codepal-binding-id":"src-pages-project-codeviewer-fileexplorer-tsx:fileexplorer:div:871:17","data-codepal-module-id":"src-pages-project-codeviewer-fileexplorer-tsx","data-codepal-component-id":"src-pages-project-codeviewer-fileexplorer-tsx:fileexplorer","data-codepal-source-node-id":"src-pages-project-codeviewer-fileexplorer-tsx:fileexplorer:div:871:17","data-codepal-source-file":"src/pages/Project/CodeViewer/FileExplorer.tsx","data-codepal-source-line":"871","data-codepal-source-column":"17","data-codepal-source-symbol":"FileExplorer",className:"py-2 overflow-y-auto flex-1 custom-scrollbar",children:ke(a)})]})},gj=()=>h.jsxs(Ze.div,{className:"relative",initial:{scale:.8,opacity:0}
144,animate:{scale:1,opacity:1},transition:{duration:1,ease:[.16,1,.3,1]},children:[h.jsx("div",{"data-codepal-ve-id":"src-pages-project-codeviewer-glowingbot-tsx:glowingbot:div:15:9","data-codepal-binding-id":"src-pages-project-codeviewer-glowingbot-tsx:glowingbot:div:15:9","data-codepal-module-id":"src-pages-project-codeviewer-glowingbot-tsx","data-codepal-component-id":"src-pages-project-codeviewer-glowingbot-tsx:glowingbot","data-codepal-source-node-id":"src-pages-project-codeviewer-glowingbot-tsx:glowingbot:div:15:9","data-codepal-source-file":"src/pages/Project/CodeViewer/GlowingBot.tsx","data-codepal-source-line":"15","data-codepal-source-column":"9","data-codepal-source-symbol":"GlowingBot",className:"absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2",children:h.jsx("div",{"data-codepal-ve-id":"src-pages-project-codeviewer-glowingbot-tsx:glowingbot:div:16:13","data-codepal-binding-id":"src-pages-project-codeviewer-glowingbot-tsx:glowingbot:div:16:13","data-codepal-module-id":"src-pages-project-codeviewer-glowingbot-tsx","data-codepal-component-id":"src-pages-project-codeviewer-glowingbot-tsx:glowingbot","data-codepal-source-node-id":"src-pages-project-codeviewer-glowingbot-tsx:glowingbot:div:16:13","data-codepal-source-file":"src/pages/Project/CodeViewer/GlowingBot.tsx","data-codepal-source-line":"16","data-codepal-source-column":"13","data-codepal-source-symbol":"GlowingBot",className:"w-48 h-48 rounded-full bg-blue-500/[0.08] blur-2xl"})}),h.jsx(Ze.div,{animate:{y:[-2,2,-2],filter:["drop-shadow(0 0 20px rgba(59, 130, 246, 0.3))","drop-shadow(0 0 25px rgba(59, 130, 246, 0.4))","drop-shadow(0 0 20px rgba(59, 130, 246, 0.3))"]},transition:{duration:4,repeat:1/0,ease:"easeInOut"},className:"relative",children:h.jsx(mm,{size:80,className:"text-blue-500",strokeWidth:1.5})})]}),xj=({text:a,delay:e=0,className:t=""})=>h.jsx(Ze.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{duration:.8,delay:e,ease:[.16,1,.3,1]},className:t,children:a}),bj=()=>{const[a,e]=E.useState(()=>Math.floor(Math.random()*25)),[t,s]=E.useState(""),[o,r]=E.useState(!0),[i,n]=E.useState(!1),c=[{text:"The only way to learn programming is to start coding.",author:"John Johnson"},{text:"Education is the most powerful weapon which you can use to change the world.",author:"Nelson Mandela"},{text:"Those who cannot change their minds cannot change anything.",author:"George Bernard Shaw"},{text:"Taking a new step, uttering a new word, is what people fear most.",author:"Fyodor Dostoevsky"},{text:"Vulnerability is the birthplace of innovation, creativity and change.",author:"Brene Brown"},{text:"Innovation is an evolutionary process, so it's not necessary to be radical all the time.",author:"Marc Jacobs"},{text:"Do not get obsolete like an old technology, keep innovating yourself.",author:"Sukant Ratnakar"},{text:"Where all think alike there is little danger of innovation.",author:"Edward Abbey"},{text:"Innovation does not come from grades, it is result of craziness and hard work.",author:"Atlas Gondal"},{text:"If you want something new, you have to stop doing something old.",author:"Peter Drucker"},{text:"Dreams fuel innovation.",author:"Bertrand Piccard"},{text:"To be successful, innovation is not just about value creation, but value capture.",author:"Jay Samit"},{text:"Want to increase innovation? Lower the cost of failure.",author:"Joichi Ito"},{text:"Without curiosity, there will never be any innovation.",author:"Steve Stoute"},{text:"Innovation comes from long-term thinking and iterative execution.",author:"Reid Hoffman"},{text:"Progress and innovation happen when you set unrealistic goals.",author:"Simon Sinek"},{text:"The human spirit must prevail over technology.",author:"Albert Einstein"},{text:"Technology is anything that wasn't around when you were born.",author:"Alan Kay"},{text:"The world is one big data problem.",author:"Andrew McAfee"},{text:"The computer is a bicycle for our minds.",author:"Steve Jobs"},{text:"Technology is anything that makes life easier, then disappears.",author:"Mitch Kapor"},{text:"Good code is its own best documentation.",author:"Steve McConnell"},{text:"Computers are like bikinis. They save people a lot of guesswork.",author:"Sam Ewing"},{text:"The way to get good ideas is to get a lot of ideas.",author:"Linus Pauling"},{text:"The science of today is the technology of tomorrow.",author:"Edward Teller"}];return E.useEffect(()=>{const l=setInterval(()=>{e(d=>(d+1)%c.length),s(""),n(!1)},1e4);return()=>clearInterval(l)},[c]),E.useEffect(()=>{const l=c[a].text;if(t.length<l.length){const d=setTimeout(()=>{s(l.substring(0,t.length+1))},50);return()=>clearTimeout(d)}else setTimeout(()=>{n(!0)},500)},[t,a,c]),E.useEffect(()=>{const l=setInterval(()=>{r(d=>!d)},500);return()=>clearInterval(l)},[]),h.jsxs("div",{"data-codepal-ve-id":"src-pages-project-codeviewer-codeviewloader-tsx:codeviewloader:div:89:9","data-codepal-binding-id":"src-pages-project-codeviewer-codeviewloader-tsx:codeviewloader:div:89:9","data-codepal-module-id":"src-pages-project-codeviewer-codeviewloader-tsx","data-codepal-component-id":"src-pages-project-codeviewer-codeviewloader-tsx:codeviewloader","data-codepal-source-node
144-id":"src-pages-project-codeviewer-codeviewloader-tsx:codeviewloader:div:89:9","data-codepal-source-file":"src/pages/Project/CodeViewer/CodeViewLoader.tsx","data-codepal-source-line":"89","data-codepal-source-column":"9","data-codepal-source-symbol":"CodeViewLoader",className:"h-20 flex flex-col items-center justify-center px-4 max-w-md",children:[h.jsx(gj,{}),h.jsx("div",{"data-codepal-ve-id":"src-pages-project-codeviewer-codeviewloader-tsx:codeviewloader:div:92:13","data-codepal-binding-id":"src-pages-project-codeviewer-codeviewloader-tsx:codeviewloader:div:92:13","data-codepal-module-id":"src-pages-project-codeviewer-codeviewloader-tsx","data-codepal-component-id":"src-pages-project-codeviewer-codeviewloader-tsx:codeviewloader","data-codepal-source-node-id":"src-pages-project-codeviewer-codeviewloader-tsx:codeviewloader:div:92:13","data-codepal-source-file":"src/pages/Project/CodeViewer/CodeViewLoader.tsx","data-codepal-source-line":"92","data-codepal-source-column":"13","data-codepal-source-symbol":"CodeViewLoader",className:"flex flex-col items-center gap-1 m-5",children:h.jsx(xj,{text:"No files to display",delay:.3,className:"text-1xl font-light tracking-tight text-blue-500"})}),h.jsxs("div",{"data-codepal-ve-id":"src-pages-project-codeviewer-codeviewloader-tsx:codeviewloader:div:100:13","data-codepal-binding-id":"src-pages-project-codeviewer-codeviewloader-tsx:codeviewloader:div:100:13","data-codepal-module-id":"src-pages-project-codeviewer-codeviewloader-tsx","data-codepal-component-id":"src-pages-project-codeviewer-codeviewloader-tsx:codeviewloader","data-codepal-source-node-id":"src-pages-project-codeviewer-codeviewloader-tsx:codeviewloader:div:100:13","data-codepal-source-file":"src/pages/Project/CodeViewer/CodeViewLoader.tsx","data-codepal-source-line":"100","data-codepal-source-column":"13","data-codepal-source-symbol":"CodeViewLoader",className:"text-gray-700 dark:text-blue-300 text-center font-light text-sm transition-opacity duration-500 italic min-h-8",children:[h.jsxs("span",{"data-codepal-ve-id":"src-pages-project-codeviewer-codeviewloader-tsx:codeviewloader:span:102:17","data-codepal-binding-id":"src-pages-project-codeviewer-codeviewloader-tsx:codeviewloader:span:102:17","data-codepal-module-id":"src-pages-project-codeviewer-codeviewloader-tsx","data-codepal-component-id":"src-pages-project-codeviewer-codeviewloader-tsx:codeviewloader","data-codepal-source-node-id":"src-pages-project-codeviewer-codeviewloader-tsx:codeviewloader:span:102:17","data-codepal-source-file":"src/pages/Project/CodeViewer/CodeViewLoader.tsx","data-codepal-source-line":"102","data-codepal-source-column":"17","data-codepal-source-symbol":"CodeViewLoader",children:['"',t]}),h.jsx("span",{"data-codepal-ve-id":"src-pages-project-codeviewer-codeviewloader-tsx:codeviewloader:span:103:17","data-codepal-binding-id":"src-pages-project-codeviewer-codeviewloader-tsx:codeviewloader:span:103:17","data-codepal-module-id":"src-pages-project-codeviewer-codeviewloader-tsx","data-codepal-component-id":"src-pages-project-codeviewer-codeviewloader-tsx:codeviewloader","data-codepal-source-node-id":"src-pages-project-codeviewer-codeviewloader-tsx:codeviewloader:span:103:17","data-codepal-source-file":"src/pages/Project/CodeViewer/CodeViewLoader.tsx","data-codepal-source-line":"103","data-codepal-source-column":"17","data-codepal-source-symbol":"CodeViewLoader",className:`${o?"opacity-100":"opacity-0"} text-blue-500 dark:text-blue-400 transition-opacity duration-100`,children:"|"}),h.jsxs("span",{"data-codepal-ve-id":"src-pages-project-codeviewer-codeviewloader-tsx:codeviewloader:span:105:17","data-codepal-binding-id":"src-pages-project-codeviewer-codeviewloader-tsx:codeviewloader:span:105:17","data-codepal-module-id":"src-pages-project-codeviewer-codeviewloader-tsx","data-codepal-component-id":"src-pages-project-codeviewer-codeviewloader-tsx:codeviewloader","data-codepal-source-node-id":"src-pages-project-codeviewer-codeviewloader-tsx:codeviewloader:span:105:17","data-codepal-source-file":"src/pages/Project/CodeViewer/CodeViewLoader.tsx","data-codepal-source-line":"105","data-codepal-source-column":"17","data-codepal-source-symbol":"CodeViewLoader",className:"opacity-0",children:[c[a].text.substring(t.length),'"']}),t.length===c[a].text.length&&h.jsx("span",{"data-codepal-ve-id":"src-pages-project-codeviewer-codeviewloader-tsx:codeviewloader:span:107:21","data-codepal-binding-id":"src-pages-project-codeviewer-codeviewloader-tsx:codeviewloader:span:107:21","data-codepal-module-id":"src-pages-project-codeviewer-codeviewloader-tsx","data-codepal-component-id":"src-pages-project-codeviewer-codeviewloader-tsx:codeviewloader","data-codepal-source-node
144-id":"src-pages-project-codeviewer-codeviewloader-tsx:codeviewloader:span:107:21","data-codepal-source-file":"src/pages/Project/CodeViewer/CodeViewLoader.tsx","data-codepal-source-line":"107","data-codepal-source-column":"21","data-codepal-source-symbol":"CodeViewLoader",children:'"'})]}),h.jsxs("div",{"data-codepal-ve-id":"src-pages-project-codeviewer-codeviewloader-tsx:codeviewloader:div:110:13","data-codepal-binding-id":"src-pages-project-codeviewer-codeviewloader-tsx:codeviewloader:div:110:13","data-codepal-module-id":"src-pages-project-codeviewer-codeviewloader-tsx","data-codepal-component-id":"src-pages-project-codeviewer-codeviewloader-tsx:codeviewloader","data-codepal-source-node-id":"src-pages-project-codeviewer-codeviewloader-tsx:codeviewloader:div:110:13","data-codepal-source-file":"src/pages/Project/CodeViewer/CodeViewLoader.tsx","data-codepal-source-line":"110","data-codepal-source-column":"13","data-codepal-source-symbol":"CodeViewLoader",className:`text-gray-500 dark:text-gray-400 text-xs mt-2 font-medium transition-all duration-500 ${i?"opacity-100 transform translate-y-0":"opacity-0 transform translate-y-2"}`,children:["â ",c[a].author]})]})},vj=a=>{let{state:e}=a,t=e.doc.lineAt(e.selection.main.from),s=oc(a.state,t.from);return s.line?jj(a):s.block?yj(a):!1};function sc(a,e){return({state:t,dispatch:s})=>{if(t.readOnly)return!1;let o=a(e,t);return o?(s(t.update(o)),!0):!1}}const jj=sc(Sj,0),wj=sc(ch,0),yj=sc((a,e)=>ch(a,e,Cj(e)),0);function oc(a,e){let t=a.languageDataAt("commentTokens",e);return t.length?t[0]:{}}const ks=50;function kj(a,{open:e,close:t},s,o){let r=a.sliceDoc(s-ks,s),i=a.sliceDoc(o,o+ks),n=/\s*$/.exec(r)[0].length,c=/^\s*/.exec(i)[0].length,l=r.length-n;if(r.slice(l-e.length,l)==e&&i.slice(c,c+t.length)==t)return{open:{pos:s-n,margin:n&&1},close:{pos:o+c,margin:c&&1}};let d,p;o-s<=2*ks?d=p=a.sliceDoc(s,o):(d=a.sliceDoc(s,s+ks),p=a.sliceDoc(o-ks,o));let u=/^\s*/.exec(d)[0].length,f=/\s*$/.exec(p)[0].length,m=p.length-f-t.length;return d.slice(u,u+e.length)==e&&p.slice(m,m+t.length)==t?{open:{pos:s+u+e.length,margin:/\s/.test(d.charAt(u+e.length))?1:0},close:{pos:o-f-t.length,margin:/\s/.test(p.charAt(m-1))?1:0}}:null}function Cj(a){let e=[];for(let t of a.selection.ranges){let s=a.doc.lineAt(t.from),o=t.to<=s.to?s:a.doc.lineAt(t.to);o.from>s.from&&o.from==t.to&&(o=t.to==s.to+1?s:a.doc.lineAt(t.to-1));let r=e.length-1;r>=0&&e[r].to>s.from?e[r].to=o.to:e.push({from:s.from+/^\s*/.exec(s.text)[0].length,to:o.to})}return e}function ch(a,e,t=e.selection.ranges){let s=t.map(r=>oc(e,r.from).block);if(!s.every(r=>r))return null;let o=t.map((r,i)=>kj(e,s[i],r.from,r.to));if(a!=2&&!o.every(r=>r))return{changes:e.changes(t.map((r,i)=>o[i]?[]:[{from:r.from,insert:s[i].open+" "},{from:r.to,insert:" "+s[i].close}]))};if(a!=1&&o.some(r=>r)){let r=[];for(let i=0,n;i<o.length;i++)if(n=o[i]){let c=s[i],{open:l,close:d}=n;r.push({from:l.pos-c.open.length,to:l.pos+l.margin},{from:d.pos-d.margin,to:d.pos+c.close.length})}return{changes:r}}return null}function Sj(a,e,t=e.selection.ranges){let s=[],o=-1;for(let{from:r,to:i}of t){let n=s.length,c=1e9,l=oc(e,r).line;if(l){for(let d=r;d<=i;){let p=e.doc.lineAt(d);if(p.from>o&&(r==i||i>p.from)){o=p.from;let u=/^\s*/.exec(p.text)[0].length,f=u==p.length,m=p.text.slice(u,u+l.length)==l?u:-1;u<p.text.length&&u<c&&(c=u),s.push({line:p,comment:m,token:l,indent:u,empty:f,single:!1})}d=p.to+1}if(c<1e9)for(let d=n;d<s.length;d++)s[d].indent<s[d].line.text.length&&(s[d].indent=c);s.length==n+1&&(s[n].single=!0)}}if(a!=2&&s.some(r=>r.comment<0&&(!r.empty||r.single))){let r=[];for(let{line:n,token:c,indent:l,empty:d,single:p}of s)(p||!d)&&r.push({from:n.from+l,insert:c+" "});let i=e.changes(r);return{changes:i,selection:e.selection.map(i,1)}}else if(a!=1&&s.some(r=>r.comment>=0)){let r=[];for(let{line:i,comment:n,token:c}of s)if(n>=0){let l=i.from+n,d=l+c.length;i.text[d-i.from]==" "&&d++,r.push({from:l,to:d})}return{changes:r}}return null}const vn=Zt.define(),_j=Zt.define(),Pj=fe.define(),lh=fe.define({combine(a){return va(a,{minDepth:100,newGroupDelay:500,joinToEvent:(e,t)=>
vendor: 19,333 bytes, line 144
144t},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(e,t)=>(s,o)=>e(s,o)||t(s,o)})}}),dh=st.define({create(){return Ft.empty},update(a,e){let t=e.state.facet(lh),s=e.annotation(vn);if(s){let c=dt.fromTransaction(e,s.selection),l=s.side,d=l==0?a.undone:a.done;return c?d=yr(d,d.length,t.minDepth,c):d=hh(d,e.startState.selection),new Ft(l==0?s.rest:d,l==0?d:s.rest)}let o=e.annotation(_j);if((o=="full"||o=="before")&&(a=a.isolate()),e.annotation($e.addToHistory)===!1)return e.changes.empty?a:a.addMapping(e.changes.desc);let r=dt.fromTransaction(e),i=e.annotation($e.time),n=e.annotation($e.userEvent);return r?a=a.addChanges(r,i,n,t,e):e.selection&&(a=a.addSelection(e.startState.selection,i,n,t.newGroupDelay)),(o=="full"||o=="after")&&(a=a.isolate()),a},toJSON(a){return{done:a.done.map(e=>e.toJSON()),undone:a.undone.map(e=>e.toJSON())}},fromJSON(a){return new Ft(a.done.map(dt.fromJSON),a.undone.map(dt.fromJSON))}});function Aj(a={}){return[dh,lh.of(a),pe.domEventHandlers({beforeinput(e,t){let s=e.inputType=="historyUndo"?ph:e.inputType=="historyRedo"?jn:null;return s?(e.preventDefault(),s(t)):!1}})]}function Vr(a,e){return function({state:t,dispatch:s}){if(!e&&t.readOnly)return!1;let o=t.field(dh,!1);if(!o)return!1;let r=o.pop(a,t,e);return r?(s(r),!0):!1}}const ph=Vr(0,!1),jn=Vr(1,!1),Mj=Vr(0,!0),Ej=Vr(1,!0);class dt{constructor(e,t,s,o,r){this.changes=e,this.effects=t,this.mapped=s,this.startSelection=o,this.selectionsAfter=r}setSelAfter(e){return new dt(this.changes,this.effects,this.mapped,this.startSelection,e)}toJSON(){var e,t,s;return{changes:(e=this.changes)===null||e===void 0?void 0:e.toJSON(),mapped:(t=this.mapped)===null||t===void 0?void 0:t.toJSON(),startSelection:(s=this.startSelection)===null||s===void 0?void 0:s.toJSON(),selectionsAfter:this.selectionsAfter.map(o=>o.toJSON())}}static fromJSON(e){return new dt(e.changes&&Ue.fromJSON(e.changes),[],e.mapped&&Rt.fromJSON(e.mapped),e.startSelection&&ae.fromJSON(e.startSelection),e.selectionsAfter.map(ae.fromJSON))}static fromTransaction(e,t){let s=xt;for(let o of e.startState.facet(Pj)){let r=o(e);r.length&&(s=s.concat(r))}return!s.length&&e.changes.empty?null:new dt(e.changes.invert(e.startState.doc),s,void 0,t||e.startState.selection,xt)}static selection(e){return new dt(void 0,xt,void 0,void 0,e)}}function yr(a,e,t,s){let o=e+1>t+20?e-t-1:0,r=a.slice(o,e);return r.push(s),r}function Dj(a,e){let t=[],s=!1;return a.iterChangedRanges((o,r)=>t.push(o,r)),e.iterChangedRanges((o,r,i,n)=>{for(let c=0;c<t.length;){let l=t[c++],d=t[c++];n>=l&&i<=d&&(s=!0)}}),s}function Tj(a,e){return a.ranges.length==e.ranges.length&&a.ranges.filter((t,s)=>t.empty!=e.ranges[s].empty).length===0}function uh(a,e){return a.length?e.length?a.concat(e):a:e}const xt=[],Nj=200;function hh(a,e){if(a.length){let t=a[a.length-1],s=t.selectionsAfter.slice(Math.max(0,t.selectionsAfter.length-Nj));return s.length&&s[s.length-1].eq(e)?a:(s.push(e),yr(a,a.length-1,1e9,t.setSelAfter(s)))}else return[dt.selection([e])]}function Lj(a){let e=a[a.length-1],t=a.slice();return t[a.length-1]=e.setSelAfter(e.selectionsAfter.slice(0,e.selectionsAfter.length-1)),t}function vi(a,e){if(!a.length)return a;let t=a.length,s=xt;for(;t;){let o=Ij(a[t-1],e,s);if(o.changes&&!o.changes.empty||o.effects.length){let r=a.slice(0,t);return r[t-1]=o,r}else e=o.mapped,t--,s=o.selectionsAfter}return s.length?[dt.selection(s)]:xt}function Ij(a,e,t){let s=uh(a.selectionsAfter.length?a.selectionsAfter.map(n=>n.map(e)):xt,t);if(!a.changes)return dt.selection(s);let o=a.changes.map(e),r=e.mapDesc(a.changes,!0),i=a.mapped?a.mapped.composeDesc(r):r;return new dt(o,we.mapEffects(a.effects,e),i,a.startSelection.map(r),s)}const Oj=/^(input\.type|delete)($|\.)/;class Ft{constructor(e,t,s=0,o=void 0){this.done=e,this.undone=t,this.prevTime=s,this.prevUserEvent=o}isolate(){return this.prevTime?new Ft(this.done,this.undone):this}addChanges(e,t,s,o,r){let i=this.done,n=i[i.length-1];return n&&n.changes&&!n.changes.empty&&e.changes&&(!s||Oj.test(s))&&(!n.selectionsAfter.length&&t-this.prevTime<o.newGroupDelay&&o.joinToEvent(r,Dj(n.changes,e.changes))||s=="input.type.compose")?i=yr(i,i.length-1,o.minDepth,new dt(e.changes.compose(n.changes),uh(we.mapEffects(e.effects,n.changes),n.effects),n.mapped,n.startSelection,xt)):i=yr(i,i.length,o.minDepth,e),new Ft(i,xt,t,s)}addSelection(e,t,s,o){let r=this.done.length?this.done[this.done.length-1].selectionsAfter:xt;return r.length>0&&t-this.prevTime<o&&s==this.prevUserEvent&&s&&/^select($|\.)/.test(s)&&Tj(r[r.length-1],e)?this:new Ft(hh(this.done,e),this.undone,t,s)}addMapping(e){return new Ft(vi(this.done,e),vi(this.undone,e),this.prevTime,this.prevUserEvent)}pop(e,t,s){let o=e==0?this.done:this.undone;if(o.length==0)return null;let r=o[o.length-1],i=r.selectionsAfter[0]||t.selection;if(s&&r.selectionsAfter.length)return t.update({selection:r.selectionsAfter[r.selectionsAfter.length-1],annotations:vn.of({side:e,rest:Lj(o),selection:i}),userEvent:e==0?"select.undo":"select.redo",scrollIntoView:!0});if(r.changes){let n=o.length==1?xt:o.slice(0,o.length-1);return r.mapped&&(n=vi(n,r.mapped)),t.update({changes:r.changes,selection:r.startSelection,effects:r.effects,annotations:vn.of({side:e,rest:n,selection:i}),filter:!1,userEvent:e==0?"undo":"redo",scrollIntoView:!0})}else return null}}Ft.empty=new Ft(xt,xt);const Fj=[{key:"Mod-z",run:ph,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:jn,preventDefault:!0},{linux:"Ctrl-Shift-z",run:jn,preventDefault:!0},{key:"Mod-u",run:Mj,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:Ej,preventDefault:!0}];function ls(a,e){return ae.create(a.ranges.map(e),a.mainIndex)}function zt(a,e){return a.update({selection:e,scrollIntoView:!0,userEvent:"select"})}function Pt({state:a,dispatch:e},t){let s=ls(a.selection,t);return s.eq(a.selection,!0)?!1:(e(zt(a,s)),!0)}function Wr(a,e){return ae.cursor(e?a.to:a.from)}function fh(a,e){return Pt(a,t=>t.empty?a.moveByChar(t,e):Wr(t,e))}function ot(a){return a.textDirectionAt(a.state.selection.main.head)==Re.LTR}const mh=a=>fh(a,!ot(a)),gh=a=>fh(a,ot(a));function xh(a,e){return Pt(a,t=>t.empty?a.moveByGroup(t,e):Wr(t,e))}const Rj=a=>xh(a,!ot(a)),Bj=a=>xh(a,ot(a));function zj(a,e,t){if(e.type.prop(t))return!0;let s=e.to-e.from;return s&&(s>2||/[^\s,.;:]/.test(a.sliceDoc(e.from,e.to)))||e.firstChild}function Hr(a,e,t){let s=Je(a).resolveInner(e.head),o=t?ye.closedBy:ye.openedBy;for(let c=e.head;;){let l=t?s.childAfter(c):s.childBefore(c);if(!l)break;zj(a,l,o)?s=l:c=t?l.to:l.from}let r=s.type.prop(o),i,n;return r&&(i=t?Ot(a,s.from,1):Ot(a,s.to,-1))&&i.matched?n=t?i.end.to:i.end.from:n=t?s.to:s.from,ae.cursor(n,t?-1:1)}const Vj=a=>Pt(a,e=>Hr(a.state,e,!ot(a))),Wj=a=>Pt(a,e=>Hr(a.state,e,ot(a)));function bh(a,e){return Pt(a,t=>{if(!t.empty)return Wr(t,e);let s=a.moveVertically(t,e);return s.head!=t.head?s:a.moveToLineBoundary(t,e)})}const vh=a=>bh(a,!1),jh=a=>bh(a,!0);function wh(a){let e=a.scrollDOM.clientHeight<a.scrollDOM.scrollHeight-2,t=0,s=0,o;if(e){for(let r of a.state.facet(pe.scrollMargins)){let i=r(a);i?.top&&(t=Math.max(i?.top,t)),i?.bottom&&(s=Math.max(i?.bottom,s))}o=a.scrollDOM.clientHeight-t-s}else o=(a.dom.ownerDocument.defaultView||window).innerHeight;return{marginTop:t,marginBottom:s,selfScroll:e,height:Math.max(a.defaultLineHeight,o-5)}}function yh(a,e){let t=wh(a),{state:s}=a,o=ls(s.selection,i=>i.empty?a.moveVertically(i,e,t.height):Wr(i,e));if(o.eq(s.selection))return!1;let r;if(t.selfScroll){let i=a.coordsAtPos(s.selection.main.head),n=a.scrollDOM.getBoundingClientRect(),c=n.top+t.marginTop,l=n.bottom-t.marginBottom;i&&i.top>c&&i.bottom<l&&(r=pe.scrollIntoView(o.main.head,{y:"start",yMargin:i.top-c}))}return a.dispatch(zt(s,o),{effects:r}),!0}const rd=a=>yh(a,!1),wn=a=>yh(a,!0);function wa(a,e,t){let s=a.lineBlockAt(e.head),o=a.moveToLineBoundary(e,t);if(o.head==e.head&&o.head!=(t?s.to:s.from)&&(o=a.moveToLineBoundary(e,t,!1)),!t&&o.head==s.from&&s.length){let r=/^\s*/.exec(a.state.sliceDoc(s.from,Math.min(s.from+100,s.to)))[0].length;r&&e.head!=s.from+r&&(o=ae.cursor(s.from+r))}return o}const Hj=a=>Pt(a,e=>wa(a,e,!0)),$j=a=>Pt(a,e=>wa(a,e,!1)),Uj=a=>Pt(a,e=>wa(a,e,!ot(a))),qj=a=>Pt(a,e=>wa(a,e,ot(a))),Kj=a=>Pt(a,e=>ae.cursor(a.lineBlockAt(e.head).from,1)),Gj=a=>Pt(a,e=>ae.cursor(a.lineBlockAt(e.head).to,-1));function Yj(a,e,t){let s=!1,o=ls(a.selection,r=>{let i=Ot(a,r.head,-1)||Ot(a,r.head,1)||r.head>0&&Ot(a,r.head-1,1)||r.head<a.doc.length&&Ot(a,r.head+1,-1);if(!i||!i.end)return r;s=!0;let n=i.start.from==r.head?i.end.to:i.end.from;return ae.cursor(n)});return s?(e(zt(a,o)),!0):!1}const Xj=({state:a,dispatch:e})=>Yj(a,e);function jt(a,e){let t=ls(a.state.selection,s=>{let o=e(s);return ae.range(s.anchor,o.head,o.goalColumn,o.bidiLevel||void 0)});return t.eq(a.state.selection)?!1:(a.dispatch(zt(a.state,t)),!0)}function kh(a,e){return jt(a,t=>a.moveByChar(t,e))}const Ch=a=>kh(a,!ot(a)),Sh=a=>kh(a,ot(a));function _h(a,e){return jt(a,t=>a.moveByGroup(t,e))}const Jj=a=>_h(a,!ot(a)),Zj=a=>_h(a,ot(a)),Qj=a=>jt(a,e=>Hr(a.state,e,!ot(a))),ew=a=>jt(a,e=>Hr(a.state,e,ot(a)));function Ph(a,e){return jt(a,t=>a.moveVertically(t,e))}const Ah=a=>Ph(a,!1),Mh=a=>Ph(a,!0);function Eh(a,e){return jt(a,t=>a.moveVertically(t,e,wh(a).height))}const id=a=>Eh(a,!1),nd=a=>Eh(a,!0),tw=a=>jt(a,e=>wa(a,e,!0)),aw=a=>jt(a,e=>wa(a,e,!1)),sw=a=>jt(a,e=>wa(a,e,!ot(a))),ow=a=>jt(a,e=>wa(a,e,ot(a))),rw=a=>jt(a,e=>ae.cursor(a.lineBlockAt(e.head).from)),iw=a=>jt(a,e=>ae.cursor(a.lineBlockAt(e.head).to)),cd=({state:a,dispatch:e})=>(e(zt(a,{anchor:0})),!0),ld=({state:a,dispatch:e})=>(e(zt(a,{anchor:a.doc.length})),!0),dd=({state:a,dispatch:e})=>(e(zt(a,{anchor:a.selection.main.anchor,head:0})),!0),pd=({state:a,dispatch:e})=>(e(zt(a,{anchor:a.selection.main.anchor,head:a.doc.length})),!0),nw=({state:a,dispatch:e})=>(e(a.update({selection:{anchor:0,head:a.doc.length},userEvent:"select"})),!0),cw=({state:a,dispatch:e})=>{let t=$r(a).map(({from:s,to:o})=>ae.range(s,Math.min(o+1,a.doc.length)));return e(a.update({selection:ae.create(t),userEvent:"select"})),!0},lw=({state:a,dispatch:e})=>{let t=ls(a.selection,s=>{let o=Je(a),r=o.resolveStack(s.from,1);if(s.empty){let i=o.resolveStack(s.from,-1);i.node.from>=r.node.from&&i.node.to<=r.node.to&&(r=i)}for(let i=r;i;i=i.next){let{node:n}=i;if((n.from<s.from&&n.to>=s.to||n.to>s.to&&n.from<=s.from)&&i.next)return ae.range(n.to,n.from)}return s});return t.eq(a.selection)?!1:(e(zt(a,t)),!0)},dw=({state:a,dispatch:e})=>{let t=a.selection,s=null;return t.ranges.length>1?s=ae.create([t.main]):t.main.empty||(s=ae.create([ae.cursor(t.main.head)])),s?(e(zt(a,s)),!0):!1};function xo(a,e){if(a.state.readOnly)return!1;let t="delete.selection",{state:s}=a,o=s.changeByRange(r=>{let{from:i,to:n}=r;if(i==n){let c=e(r);c<i?(t="delete.backward",c=Ho(a,c,!1)):c>i&&(t="delete.forward",c=Ho(a,c,!0)),i=Math.min(i,c),n=Math.max(n,c)}else i=Ho(a,i,!1),n=Ho(a,n,!0);return i==n?{range:r}:{changes:{from:i,to:n},range:ae.cursor(i,i<r.head?-1:1)}});return o.changes.empty?!1:(a.dispatch(s.update(o,{scrollIntoView:!0,userEvent:t,effects:t=="delete.selection"?pe.announce.of(s.phrase("Selection deleted")):void 0})),!0)}function Ho(a,e,t){if(a instanceof pe)for(let s of a.state.facet(pe.atomicRanges).map(o=>o(a)))s.between(e,e,(o,r)=>{o<e&&r>e&&(e=t?r:o)});return e}const Dh=(a,e,t)=>xo(a,s=>{let o=s.from,{state:r}=a,i=r.doc.lineAt(o),n,c;if(t&&!e&&o>i.from&&o<i.from+200&&!/[^ \t]/.test(n=i.text.slice(0,o-i.from))){if(n[n.length-1]==" ")return o-1;let l=Tr(n,r.tabSize),d=l%Oa(r)||Oa(r);for(let p=0;p<d&&n[n.length-1-p]==" ";p++)o--;c=o}else c=Xe(i.text,o-i.from,e,e)+i.from,c==o&&i.number!=(e?r.doc.lines:1)?c+=e?1:-1:!e&&/[\ufe00-\ufe0f]/.test(i.text.slice(c-i.from,o-i.from))&&(c=Xe(i.text,c-i.from,!1,!1)+i.from);return c}),yn=a=>Dh(a,!1,!0),Th=a=>Dh(a,!0,!1),Nh=(a,e)=>xo(a,t=>{let s=t.head,{state:o}=a,r=o.doc.lineAt(s),i=o.charCategorizer(s);for(let n=null;;){if(s==(e?r.to:r.from)){s==t.head&&r.number!=(e?o.doc.lines:1)&&(s+=e?1:-1);break}let c=Xe(r.text,s-r.from,e)+r.from,l=r.text.slice(Math.min(s,c)-r.from,Math.max(s,c)-r.from),d=i(l);if(n!=null&&d!=n)break;(l!=" "||s!=t.head)&&(n=d),s=c}return s}),Lh=a=>Nh(a,!1),pw=a=>Nh(a,!0),uw=a=>xo(a,e=>{let t=a.lineBlockAt(e.head).to;return e.head<t?t:Math.min(a.state.doc.length,e.head+1)}),hw=a=>xo(a,e=>{let t=a.moveToLineBoundary(e,!1).head;return e.head>t?t:Math.max(0,e.head-1)}),fw=a=>xo(a,e=>{let t=a.moveToLineBoundary(e,!0).head;return e.head<t?t:Math.min(a.state.doc.length,e.head+1)}),mw=({state:a,dispatch:e})=>{if(a.readOnly)return!1;let t=a.changeByRange(s=>({changes:{from:s.from,to:s.to,insert:Se.of(["",""])},range:ae.cursor(s.from)}));return e(a.update(t,{scrollIntoView:!0,userEvent:"input"})),!0},gw=({state:a,dispatch:e})=>{if(a.readOnly)return!1;let t=a.changeByRange(s=>{if(!s.empty||s.from==0||s.from==a.doc.length)return{range:s};let o=s.from,r=a.doc.lineAt(o),i=o==r.from?o-1:Xe(r.text,o-r.from,!1)+r.from,n=o==r.to?o+1:Xe(r.text,o-r.from,!0)+r.from;return{changes:{from:i,to:n,insert:a.doc.slice(o,n).append(a.doc.slice(i,o))},range:ae.cursor(n)}});return t.changes.empty?!1:(e(a.update(t,{scrollIntoView:!0,userEvent:"move.character"})),!0)};function $r(a){let e=[],t=-1;for(let s of a.selection.ranges){let o=a.doc.lineAt(s.from),r=a.doc.lineAt(s.to);if(!s.empty&&s.to==r.from&&(r=a.doc.lineAt(s.to-1)),t>=o.number){let i=e[e.length-1];i.to=r.to,i.ranges.push(s)}else e.push({from:o.from,to:r.to,ranges:[s]});t=r.number+1}return e}function Ih(a,e,t){if(a.readOnly)return!1;let s=[],o=[];for(let r of $r(a)){if(t?r.to==a.doc.length:r.from==0)continue;let i=a.doc.lineAt(t?r.to+1:r.from-1),n=i.length+1;if(t){s.push({from:r.to,to:i.to},{from:r.from,insert:i.text+a.lineBreak});for(let c of r.ranges)o.push(ae.range(Math.min(a.doc.length,c.anchor+n),Math.min(a.doc.length,c.head+n)))}else{s.push({from:i.from,to:r.from},{from:r.to,insert:a.lineBreak+i.text});for(let c of r.ranges)o.push(ae.range(c.anchor-n,c.head-n))}}return s.length?(e(a.update({changes:s,scrollIntoView:!0,selection:ae.create(o,a.selection.mainIndex),userEvent:"move.line"})),!0):!1}const xw=({state:a,dispatch:e})=>Ih(a,e,!1),bw=({state:a,dispatch:e})=>Ih(a,e,!0);function Oh(a,e,t){if(a.readOnly)return!1;let s=[];for(let o of $r(a))t?s.push({from:o.from,insert:a.doc.slice(o.from,o.to)+a.lineBreak}):s.push({from:o.to,insert:a.lineBreak+a.doc.slice(o.from,o.to)});return e(a.update({changes:s,scrollIntoView:!0,userEvent:"input.copyline"})),!0}const vw=({state:a,dispatch:e})=>Oh(a,e,!1),jw=({state:a,dispatch:e})=>Oh(a,e,!0),ww=a=>{if(a.state.readOnly)return!1;let{state:e}=a,t=e.changes($r(e).map(({from:o,to:r})=>(o>0?o--:r<e.doc.length&&r++,{from:o,to:r}))),s=ls(e.selection,o=>{let r;if(a.lineWrapping){let i=a.lineBlockAt(o.head),n=a.coordsAtPos(o.head,o.assoc||1);n&&(r=i.bottom+a.documentTop-n.bottom+a.defaultLineHeight/2)}return a.moveVertically(o,!0,r)}).map(t);return a.dispatch({changes:t,selection:s,scrollIntoView:!0,userEvent:"delete.line"}),!0};function yw(a,e){if(/\(\)|\[\]|\{\}/.test(a.sliceDoc(e-1,e+1)))return{from:e,to:e};let t=Je(a).resolveInner(e),s=t.childBefore(e),o=t.childAfter(e),r;return s&&o&&s.to<=e&&o.from>=e&&(r=s.type.prop(ye.closedBy))&&r.indexOf(o.name)>-1&&a.doc.lineAt(s.to).from==a.doc.lineAt(o.from).from&&!/\S/.test(a.sliceDoc(s.to,o.from))?{from:s.to,to:o.from}:null}const ud=Fh(!1),kw=Fh(!0);function Fh(a){return({state:e,dispatch:t})=>{if(e.readOnly)return!1;let s=e.changeByRange(o=>{let{from:r,to:i}=o,n=e.doc.lineAt(r),c=!a&&r==i&&yw(e,r);a&&(r=i=(i<=n.to?n:e.doc.lineAt(i)).to);let l=new Rr(e,{simulateBreak:r,simulateDoubleBreak:!!c}),d=Yn(l,r);for(d==null&&(d=Tr(/^\s*/.exec(e.doc.lineAt(r).text)[0],e.tabSize));i<n.to&&/\s/.test(n.text[i-n.from]);)i++;c?{from:r,to:i}=c:r>n.from&&r<n.from+100&&!/\S/.test(n.text.slice(0,r))&&(r=n.from);let p=["",Zs(e,d)];return c&&p.push(Zs(e,l.lineIndent(n.from,-1))),{changes:{from:r,to:i,insert:Se.of(p)},range:ae.cursor(r+1+p[1].length)}});return t(e.update(s,{scrollIntoView:!0,userEvent:"input"})),!0}}function rc(a,e){let t=-1;return a.changeByRange(s=>{let o=[];for(let i=s.from;i<=s.to;){let n=a.doc.lineAt(i);n.number>t&&(s.empty||s.to>n.from)&&(e(n,o,s),t=n.number),i=n.to+1}let r=a.changes(o);return{changes:o,range:ae.range(r.mapPos(s.anchor,1),r.mapPos(s.head,1))}})}const Cw=({state:a,dispatch:e})=>{if(a.readOnly)return!1;let t=Object.create(null),s=new Rr(a,{overrideIndentation:r=>{let i=t[r];return i??-1}}),o=rc(a,(r,i,n)=>{let c=Yn(s,r.from);if(c==null)return;/\S/.test(r.text)||(c=0);let l=/^\s*/.exec(r.text)[0],d=Zs(a,c);(l!=d||n.from<r.from+l.length)&&(t[r.from]=c,i.push({from:r.from,to:r.from+l.length,insert:d}))});return o.changes.empty||e(a.update(o,{userEvent:"indent"})),!0},Rh=({state:a,dispatch:e})=>a.readOnly?!1:(e(a.update(rc(a,(t,s)=>{s.push({from:t.from,insert:a.facet(Fr)})}),{userEvent:"input.indent"})),!0),Bh=({state:a,dispatch:e})=>a.readOnly?!1:(e(a.update(rc(a,(t,s)=>{let o=/^\s*/.exec(t.text)[0];if(!o)return;let r=Tr(o,a.tabSize),i=0,n=Zs(a,Math.max(0,r-Oa(a)));for(;i<o.length&&i<n.length&&o.charCodeAt(i)==n.charCodeAt(i);)i++;s.push({from:t.from+i,to:t.from+o.length,insert:n.slice(i)})}),{userEvent:"delete.dedent"})),!0),Sw=a=>(a.setTabFocusMode(),!0),_w=[{key:"Ctrl-b",run:mh,shift:Ch,preventDefault:!0},{key:"Ctrl-f",run:gh,shift:Sh},{key:"Ctrl-p",run:vh,shift:Ah},{key:"Ctrl-n",run:jh,shift:Mh},{key:"Ctrl-a",run:Kj,shift:rw},{key:"Ctrl-e",run:Gj,shift:iw},{key:"Ctrl-d",run:Th},{key:"Ctrl-h",run:yn},{key:"Ctrl-k",run:uw},{key:"Ctrl-Alt-h",run:Lh},{key:"Ctrl-o",run:mw},{key:"Ctrl-t",run:gw},{key:"Ctrl-v",run:wn}],Pw=[{key:"ArrowLeft",run:mh,shift:Ch,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:Rj,shift:Jj,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:Uj,shift:sw,preventDefault:!0},{key:"ArrowRight",run:gh,shift:Sh,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:Bj,shift:Zj,preventDefault:!0},{mac:"Cmd-ArrowRight",run:qj,shift:ow,preventDefault:!0},{key:"ArrowUp",run:vh,shift:Ah,preventDefault:!0},{mac:"Cmd-ArrowUp",run:cd,shift:dd},{mac:"Ctrl-ArrowUp",run:rd,shift:id},{key:"ArrowDown",run:jh,shift:Mh,preventDefault:!0},{mac:"Cmd-ArrowDown",run:ld,shift:pd},{mac:"Ctrl-ArrowDown",run:wn,shift:nd},{key:"PageUp",run:rd,shift:id},{key:"PageDown",run:wn,shift:nd},{key:"Home",run:$j,shift:aw,preventDefault:!0},{key:"Mod-Home",run:cd,shift:dd},{key:"End",run:Hj,shift:tw,preventDefault:!0},{key:"Mod-End",run:ld,shift:pd},{key:"Enter",run:ud,shift:ud},{key:"Mod-a",run:nw},{key:"Backspace",run:yn,shift:yn},{key:"Delete",run:Th},{key:"Mod-Backspace",mac:"Alt-Backspace",run:Lh},{key:"Mod-Delete",mac:"Alt-Delete",run:pw},{mac:"Mod-Backspace",run:hw},{mac:"Mod-Delete",run:fw}].concat(_w.map(a=>({mac:a.key,run:a.run,shift:a.shift}))),Aw=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:Vj,shift:Qj},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:Wj,shift:ew},{key:"Alt-ArrowUp",run:xw},{key:"Shift-Alt-ArrowUp",run:vw},{key:"Alt-ArrowDown",run:bw},{key:"Shift-Alt-ArrowDown",run:jw},{key:"Escape",run:dw},{key:"Mod-Enter",run:kw},{key:"Alt-l",mac:"Ctrl-l",run:cw},{key:"Mod-i",run:lw,preventDefault:!0},{key:"Mod-[",run:Bh},{key:"Mod-]",run:Rh},{key:"Mod-Alt-\\",run:Cw},{key:"Shift-Mod-k",run:ww},{key:"Shift-Mod-\\",run:Xj},{key:"Mod-/",run:vj},{key:"Alt-A",run:wj},{key:"Ctrl-m",mac:"Shift-Alt-m",run:Sw}].concat(Pw),Mw={key:"Tab",run:Rh,shift:Bh};function De(){var a=arguments[0];
144typeof a=="string"&&(a=document.createElement(a));var e=1,t=arguments[1];if(t&&typeof t=="object"&&t.nodeType==null&&!Array.isArray(t)){for(var s in t)if(Object.prototype.hasOwnProperty.call(t,s)){var o=t[s];typeof o=="string"?a.setAttribute(s,o):o!=null&&(a[s]=o)}e++}for(;e<arguments.length;e++)zh(a,arguments[e]);return a}function zh(a,e){if(typeof e=="string")a.appendChild(document.createTextNode(e));else if(e!=null)if(e.nodeType!=null)a.appendChild(e);else if(Array.isArray(e))for(var t=0;t<e.length;t++)zh(a,e[t]);else throw new RangeError("Unsupported child node: "+e)}const hd=typeof String.prototype.normalize=="function"?a=>a.normalize("NFKD"):a=>a;class as{constructor(e,t,s=0,o=e.length,r,i){this.test=i,this.value={from:0,to:0},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=e.iterRange(s,o),this.bufferStart=s,this.normalize=r?n=>r(hd(n)):hd,this.query=this.normalize(t)}peek(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return-1;this.bufferPos=0,this.buffer=this.iter.value}return Ra(this.buffer,this.bufferPos)}next(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let e=this.peek();if(e<0)return this.done=!0,this;let t=fp(e),s=this.bufferStart+this.bufferPos;this.bufferPos+=ho(e);let o=this.normalize(t);if(o.length)for(let r=0,i=s;;r++){let n=o.charCodeAt(r),c=this.match(n,i,this.bufferPos+this.bufferStart);if(r==o.length-1){if(c)return this.value=c,this;break}i==s&&r<t.length&&t.charCodeAt(r)==n&&i++}}}match(e,t,s){let o=null;for(let r=0;r<this.matches.length;r+=2){let i=this.matches[r],n=!1;this.query.charCodeAt(i)==e&&(i==this.query.length-1?o={from:this.matches[r+1],to:s}:(this.matches[r]++,n=!0)),n||(this.matches.splice(r,2),r-=2)}return this.query.charCodeAt(0)==e&&(this.query.length==1?o={from:t,to:s}:this.matches.push(1,t)),o&&this.test&&!this.test(o.from,o.to,this.buffer,this.bufferStart)&&(o=null),o}}typeof Symbol<"u"&&(as.prototype[Symbol.iterator]=function(){return this});const Vh={from:-1,to:-1,match:/.*/.exec("")},ic="gm"+(/x/.unicode==null?"":"u");class Wh{constructor(e,t,s,o=0,r=e.length){if(this.text=e,this.to=r,this.curLine="",this.done=!1,this.value=Vh,/\\[sWDnr]|\n|\r|\[\^/.test(t))return new Hh(e,t,s,o,r);this.re=new RegExp(t,ic+(s?.ignoreCase?"i":"")),this.test=s?.test,this.iter=e.iter();let i=e.lineAt(o);this.curLineStart=i.from,this.matchPos=kr(e,o),this.getLine(this.curLineStart)}getLine(e){this.iter.next(e),this.iter.lineBreak?this.curLine="":(this.curLine=this.iter.value,this.curLineStart+this.curLine.length>this.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next())}nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine="":this.getLine(0)}next(){for(let e=this.matchPos-this.curLineStart;;){this.re.lastIndex=e;let t=this.matchPos<=this.to&&this.re.exec(this.curLine);if(t){let s=this.curLineStart+t.index,o=s+t[0].length;if(this.matchPos=kr(this.text,o+(s==o?1:0)),s==this.curLineStart+this.curLine.length&&this.nextLine(),(s<o||s>this.value.to)&&(!this.test||this.test(s,o,t)))return this.value={from:s,to:o,match:t},this;e=this.matchPos-this.curLineStart}else if(this.curLineStart+this.curLine.length<this.to)this.nextLine(),e=0;else return this.done=!0,this}}}const ji=new WeakMap;class Ga{constructor(e,t){this.from=e,this.text=t}get to(){return this.from+this.text.length}static get(e,t,s){let o=ji.get(e);if(!o||o.from>=s||o.to<=t){let n=new Ga(t,e.sliceString(t,s));return ji.set(e,n),n}if(o.from==t&&o.to==s)return o;let{text:r,from:i}=o;return i>t&&(r=e.sliceString(t,i)+r,i=t),o.to<s&&(r+=e.sliceString(o.to,s)),ji.set(e,new Ga(i,r)),new Ga(t,r.slice(t-i,s-i))}}class Hh{constructor(e,t,s,o,r){this.text=e,this.to=r,this.done=!1,this.value=Vh,this.matchPos=kr(e,o),this.re=new RegExp(t,ic+(s?.ignoreCase?"i":"")),this.test=s?.test,this.flat=Ga.get(e,o,this.chunkEnd(o+5e3))}chunkEnd(e){return e>=this.to?this.to:this.text.lineAt(e).to}next(){for(;;){let e=this.re.lastIndex=this.matchPos-this.flat.from,t=this.re.exec(this.flat.text);if(t&&!t[0]&&t.index==e&&(this.re.lastIndex=e+1,t=this.re.exec(this.flat.text)),t){let s=this.flat.from+t.index,o=s+t[0].length;if((this.flat.to>=this.to||t.index+t[0].length<=this.flat.text.length-10)&&(!this.test||this.test(s,o,t)))return this.value={from:s,to:o,match:t},this.matchPos=kr(this.text,o+(s==o?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=Ga.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}}typeof Symbol<"u"&&(Wh.prototype[Symbol.iterator]=Hh.prototype[Symbol.iterator]=function(){return this});function Ew(a){try{return new RegExp(a,ic),!0}catch{return!1}}function kr(a,e){if(e>=a.length)return e;let t=a.lineAt(e),s;for(;e<t.to&&(s=t.text.charCodeAt(e-t.from))>=56320&&s<57344;)e++;return e}function kn(a){let e=String(a.state.doc.lineAt(a.state.selection.main.head).number),t=De("input",{class:"cm-textfield",name:"line",value:e}),s=De("form",{class:"cm-gotoLine",onkeydown:r=>{r.keyCode==27?(r.preventDefault(),a.dispatch({effects:Os.of(!1)}),a.focus()):r.keyCode==13&&(r.preventDefault(),o())},onsubmit:r=>{r.preventDefault(),o()}},De("label",a.state.phrase("Go to line"),": ",t)," ",De("button",{class:"cm-button",type:"submit"},a.state.phrase("go")),De("button",{name:"close",onclick:()=>{a.dispatch({effects:Os.of(!1)}),a.focus()},"aria-label":a.state.phrase("close"),type:"button"},["Ã"]));function o(){let r=/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(t.value);if(!r)return;let{state:i}=a,n=i.doc.lineAt(i.selection.main.head),[,c,l,d,p]=r,u=d?+d.slice(1):0,f=l?+l:n.number;if(l&&p){let x=f/100;c&&(x=x*(c=="-"?-1:1)+n.number/i.doc.lines),f=Math.round(i.doc.lines*x)}else l&&c&&(f=f*(c=="-"?-1:1)+n.number);let m=i.doc.line(Math.max(1,Math.min(i.doc.lines,f))),g=ae.cursor(m.from+Math.max(0,Math.min(u,m.length)));a.dispatch({effects:[Os.of(!1),pe.scrollIntoView(g.from,{y:"center"})],selection:g}),a.focus()}return{dom:s}}const Os=we.define(),fd=st.define({create(){return!0},update(a,e){for(let t of e.effects)t.is(Os)&&(a=t.value);return a},provide:a=>Js.from(a,e=>e?kn:null)}),Dw=a=>{let e=Xs(a,kn);if(!e){let t=[Os.of(!0)];a.state.field(fd,!1)==null&&t.push(we.appendConfig.of([fd,Tw])),a.dispatch({effects:t}),e=Xs(a,kn)}return e&&e.dom.querySelector("input").select(),!0},Tw=pe.baseTheme({".cm-panel.cm-gotoLine":{padding:"2px 6px 4px",position:"relative","& label":{fontSize:"80%"},"& [name=close]":{position:"absolute",top:"0",bottom:"0",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",padding:"0"}}}),Nw={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},Lw=fe.define({combine(a){return va(a,Nw,{highlightWordAroundCursor:(e,t)=>
144e||t,minSelectionLength:Math.min,maxMatches:Math.min})}});function Iw(a){return[zw,Bw]}const Ow=be.mark({class:"cm-selectionMatch"}),Fw=be.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function md(a,e,t,s){return(t==0||a(e.sliceDoc(t-1,t))!=Fe.Word)&&(s==e.doc.length||a(e.sliceDoc(s,s+1))!=Fe.Word)}function Rw(a,e,t,s){return a(e.sliceDoc(t,t+1))==Fe.Word&&a(e.sliceDoc(s-1,s))==Fe.Word}const Bw=at.fromClass(class{constructor(a){this.decorations=this.getDeco(a)}update(a){(a.selectionSet||a.docChanged||a.viewportChanged)&&(this.decorations=this.getDeco(a.view))}getDeco(a){let e=a.state.facet(Lw),{state:t}=a,s=t.selection;if(s.ranges.length>1)return be.none;let o=s.main,r,i=null;if(o.empty){if(!e.highlightWordAroundCursor)return be.none;let c=t.wordAt(o.head);if(!c)return be.none;i=t.charCategorizer(o.head),r=t.sliceDoc(c.from,c.to)}else{let c=o.to-o.from;if(c<e.minSelectionLength||c>200)return be.none;if(e.wholeWords){if(r=t.sliceDoc(o.from,o.to),i=t.charCategorizer(o.head),!(md(i,t,o.from,o.to)&&Rw(i,t,o.from,o.to)))return be.none}else if(r=t.sliceDoc(o.from,o.to),!r)return be.none}let n=[];for(let c of a.visibleRanges){let l=new as(t.doc,r,c.from,c.to);for(;!l.next().done;){let{from:d,to:p}=l.value;if((!i||md(i,t,d,p))&&(o.empty&&d<=o.from&&p>=o.to?n.push(Fw.range(d,p)):(d>=o.to||p<=o.from)&&n.push(Ow.range(d,p)),n.length>e.maxMatches))return be.none}}return be.set(n)}},{decorations:a=>a.decorations}),zw=pe.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),Vw=({state:a,dispatch:e})=>{let{selection:t}=a,s=ae.create(t.ranges.map(o=>a.wordAt(o.head)||ae.cursor(o.head)),t.mainIndex);return s.eq(t)?!1:(e(a.update({selection:s})),!0)};function Ww(a,e){let{main:t,ranges:s}=a.selection,o=a.wordAt(t.head),r=o&&o.from==t.from&&o.to==t.to;for(let i=!1,n=new as(a.doc,e,s[s.length-1].to);;)if(n.next(),n.done){if(i)return null;n=new as(a.doc,e,0,Math.max(0,s[s.length-1].from-1)),i=!0}else{if(i&&s.some(c=>c.from==n.value.from))continue;if(r){let c=a.wordAt(n.value.from);if(!c||c.from!=n.value.from||c.to!=n.value.to)continue}return n.value}}const Hw=({state:a,dispatch:e})=>{let{ranges:t}=a.selection;if(t.some(r=>r.from===r.to))return Vw({state:a,dispatch:e});let s=a.sliceDoc(t[0].from,t[0].to);if(a.selection.ranges.some(r=>a.sliceDoc(r.from,r.to)!=s))return!1;let o=Ww(a,s);return o?(e(a.update({selection:a.selection.addRange(ae.range(o.from,o.to),!1),effects:pe.scrollIntoView(o.to)})),!0):!1},ds=fe.define({combine(a){return va(a,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new ty(e),scrollToMatch:e=>pe.scrollIntoView(e)})}});class $h{constructor(e){this.search=e.search,this.caseSensitive=!!e.caseSensitive,this.literal=!!e.literal,this.regexp=!!e.regexp,this.replace=e.replace||"",this.valid=!!this.search&&(!this.regexp||Ew(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!e.wholeWord}unquote(e){return this.literal?e:e.replace(/\\([nrt\\])/g,(t,s)=>s=="n"?` 145`:s=="r"?"\r":s=="t"?" ":"\\")}eq(e){return this.search==e.search&&this.replace==e.replace&&this.caseSensitive==e.caseSensitive&&this.regexp==e.regexp&&this.wholeWord==e.wholeWord}create(){return this.regexp?new Kw(this):new Uw(this)}getCursor(e,t=0,s){let o=e.doc?e:_e.create({doc:e});return s==null&&(s=o.doc.length),this.regexp?Ha(this,o,t,s):Wa(this,o,t,s)}}class Uh{constructor(e){this.spec=e}}function Wa(a,e,t,s){return new as(e.doc,a.unquoted,t,s,a.caseSensitive?void 0:o=>o.toLowerCase(),a.wholeWord?$w(e.doc,e.charCategorizer(e.selection.main.head)):void 0)}function $w(a,e){return(t,s,o,r)=>((r>t||r+o.length<s)&&(r=Math.max(0,t-2),o=a.sliceString(r,Math.min(a.length,s+2))),(e(Cr(o,t-r))!=Fe.Word||e(Sr(o,t-r))!=Fe.Word)&&(e(Sr(o,s-r))!=Fe.Word||e(Cr(o,s-r))!=Fe.Word))}class Uw extends Uh{constructor(e){super(e)}nextMatch(e,t,s){let o=Wa(this.spec,e,s,e.doc.length).nextOverlapping();if(o.done){let r=Math.min(e.doc.length,t+this.spec.unquoted.length);o=Wa(this.spec,e,0,r).nextOverlapping()}return o.done||o.value.from==t&&o.value.to==s?null:o.value}
145prevMatchInRange(e,t,s){for(let o=s;;){let r=Math.max(t,o-1e4-this.spec.unquoted.length),i=Wa(this.spec,e,r,o),n=null;for(;!i.nextOverlapping().done;)n=i.value;if(n)return n;if(r==t)return null;o-=1e4}}prevMatch(e,t,s){let o=this.prevMatchInRange(e,0,t);return o||(o=this.prevMatchInRange(e,Math.max(0,s-this.spec.unquoted.length),e.doc.length)),o&&(o.from!=t||o.to!=s)?o:null}getReplacement(e){return this.spec.unquote(this.spec.replace)}matchAll(e,t){let s=Wa(this.spec,e,0,e.doc.length),o=[];for(;!s.next().done;){if(o.length>=t)return null;o.push(s.value)}return o}highlight(e,t,s,o){let r=Wa(this.spec,e,Math.max(0,t-this.spec.unquoted.length),Math.min(s+this.spec.unquoted.length,e.doc.length));for(;!r.next().done;)o(r.value.from,r.value.to)}}function Ha(a,e,t,s){return new Wh(e.doc,a.search,{ignoreCase:!a.caseSensitive,test:a.wholeWord?qw(e.charCategorizer(e.selection.main.head)):void 0},t,s)}function Cr(a,e){return a.slice(Xe(a,e,!1),e)}function Sr(a,e){return a.slice(e,Xe(a,e))}function qw(a){return(e,t,s)=>!s[0].length||(a(Cr(s.input,s.index))!=Fe.Word||a(Sr(s.input,s.index))!=Fe.Word)&&(a(Sr(s.input,s.index+s[0].length))!=Fe.Word||a(Cr(s.input,s.index+s[0].length))!=Fe.Word)}class Kw extends Uh{nextMatch(e,t,s){let o=Ha(this.spec,e,s,e.doc.length).next();return o.done&&(o=Ha(this.spec,e,0,t).next()),o.done?null:o.value}prevMatchInRange(e,t,s){for(let o=1;;o++){let r=Math.max(t,s-o*1e4),i=Ha(this.spec,e,r,s),n=null;for(;!i.next().done;)n=i.value;if(n&&(r==t||n.from>r+10))return n;if(r==t)return null}}prevMatch(e,t,s){return this.prevMatchInRange(e,0,t)||this.prevMatchInRange(e,s,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g,(t,s)=>{if(s=="&")return e.match[0];if(s=="$")return"$";for(let o=s.length;o>0;o--){let r=+s.slice(0,o);if(r>0&&r<e.match.length)return e.match[r]+s.slice(o)}return t})}matchAll(e,t){let s=Ha(this.spec,e,0,e.doc.length),o=[];for(;!s.next().done;){if(o.length>=t)return null;o.push(s.value)}return o}highlight(e,t,s,o){let r=Ha(this.spec,e,Math.max(0,t-250),Math.min(s+250,e.doc.length));for(;!r.next().done;)o(r.value.from,r.value.to)}}const ao=we.define(),nc=we.define(),da=st.define({create(a){return new wi(Cn(a).create(),null)},update(a,e){for(let t of e.effects)t.is(ao)?a=new wi(t.value.create(),a.panel):t.is(nc)&&(a=new wi(a.query,t.value?cc:null));return a},provide:a=>Js.from(a,e=>e.panel)});class wi{constructor(e,t){this.query=e,this.panel=t}}const Gw=be.mark({class:"cm-searchMatch"}),Yw=be.mark({class:"cm-searchMatch cm-searchMatch-selected"}),Xw=at.fromClass(class{constructor(a){this.view=a,this.decorations=this.highlight(a.state.field(da))}update(a){let e=a.state.field(da);(e!=a.startState.field(da)||a.docChanged||a.selectionSet||a.viewportChanged)&&(this.decorations=this.highlight(e))}highlight({query:a,panel:e}){if(!e||!a.spec.valid)return be.none;let{view:t}=this,s=new ua;for(let o=0,r=t.visibleRanges,i=r.length;o<i;o++){let{from:n,to:c}=r[o];for(;o<i-1&&c>r[o+1].from-500;)c=r[++o].to;a.highlight(t.state,n,c,(l,d)=>{let p=t.state.selection.ranges.some(u=>u.from==l&&u.to==d);s.add(l,d,p?Yw:Gw)})}return s.finish()}},{decorations:a=>a.decorations});function bo(a){return e=>{let t=e.state.field(da,!1);return t&&t.query.spec.valid?a(e,t):so(e)}}const _r=bo((a,{query:e})=>{let{to:t}=a.state.selection.main,s=e.nextMatch(a.state,t,t);if(!s)return!1;let o=ae.single(s.from,s.to),r=a.state.facet(ds);return a.dispatch({selection:o,effects:[lc(a,s),r.scrollToMatch(o.main,a)],userEvent:"select.search"}),Kh(a),!0}),Pr=bo((a,{query:e})=>{let{state:t}=a,{from:s}=t.selection.main,o=e.prevMatch(t,s,s);if(!o)return!1;let r=ae.single(o.from,o.to),i=a.state.facet(ds);return a.dispatch({selection:r,effects:[lc(a,o),i.scrollToMatch(r.main,a)],userEvent:"select.search"}),Kh(a),!0}),Jw=bo((a,{query:e})=>{let t=e.matchAll(a.state,1e3);return!t||!t.length?!1:(a.dispatch({selection:ae.create(t.map(s=>ae.range(s.from,s.to))),userEvent:"select.search.matches"}),!0)}),Zw=({state:a,dispatch:e})=>{let t=a.selection;if(t.ranges.length>1||t.main.empty)return!1;let{from:s,to:o}=t.main,r=[],i=0;for(let n=new as(a.doc,a.sliceDoc(s,o));!n.next().done;){if(r.length>1e3)return!1;n.value.from==s&&(i=r.length),r.push(ae.range(n.value.from,n.value.to))}return e(a.update({selection:ae.create(r,i),userEvent:"select.search.matches"})),!0},gd=bo((a,{query:e})=>{let{state:t}=a,{from:s,to:o}=t.selection.main;if(t.readOnly)return!1;let r=e.nextMatch(t,s,s);if(!r)return!1;let i=r,n=[],c,l,d=[];if(i.from==s&&i.to==o&&(l=t.toText(e.getReplacement(i)),n.push({from:i.from,to:i.to,insert:l}),i=e.nextMatch(t,i.from,i.to),d.push(pe.announce.of(t.phrase("replaced match on line $",t.doc.lineAt(s).number)+"."))),i){let p=n.length==0||n[0].from>=r.to?0:r.to-r.from-l.length;c=ae.single(i.from-p,i.to-p),d.push(lc(a,i)),d.push(t.facet(ds).scrollToMatch(c.main,a))}return a.dispatch({changes:n,selection:c,effects:d,userEvent:"input.replace"}),!0}),Qw=bo((a,{query:e})=>
vendor: 6,423 bytes, line 145
145{if(a.state.readOnly)return!1;let t=e.matchAll(a.state,1e9).map(o=>{let{from:r,to:i}=o;return{from:r,to:i,insert:e.getReplacement(o)}});if(!t.length)return!1;let s=a.state.phrase("replaced $ matches",t.length)+".";return a.dispatch({changes:t,effects:pe.announce.of(s),userEvent:"input.replace.all"}),!0});function cc(a){return a.state.facet(ds).createPanel(a)}function Cn(a,e){var t,s,o,r,i;let n=a.selection.main,c=n.empty||n.to>n.from+100?"":a.sliceDoc(n.from,n.to);if(e&&!c)return e;let l=a.facet(ds);return new $h({search:((t=e?.literal)!==null&&t!==void 0?t:l.literal)?c:c.replace(/\n/g,"\\n"),caseSensitive:(s=e?.caseSensitive)!==null&&s!==void 0?s:l.caseSensitive,literal:(o=e?.literal)!==null&&o!==void 0?o:l.literal,regexp:(r=e?.regexp)!==null&&r!==void 0?r:l.regexp,wholeWord:(i=e?.wholeWord)!==null&&i!==void 0?i:l.wholeWord})}function qh(a){let e=Xs(a,cc);return e&&e.dom.querySelector("[main-field]")}function Kh(a){let e=qh(a);e&&e==a.root.activeElement&&e.select()}const so=a=>{let e=a.state.field(da,!1);if(e&&e.panel){let t=qh(a);if(t&&t!=a.root.activeElement){let s=Cn(a.state,e.query.spec);s.valid&&a.dispatch({effects:ao.of(s)}),t.focus(),t.select()}}else a.dispatch({effects:[nc.of(!0),e?ao.of(Cn(a.state,e.query.spec)):we.appendConfig.of(sy)]});return!0},oo=a=>{let e=a.state.field(da,!1);if(!e||!e.panel)return!1;let t=Xs(a,cc);return t&&t.dom.contains(a.root.activeElement)&&a.focus(),a.dispatch({effects:nc.of(!1)}),!0},ey=[{key:"Mod-f",run:so,scope:"editor search-panel"},{key:"F3",run:_r,shift:Pr,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:_r,shift:Pr,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:oo,scope:"editor search-panel"},{key:"Mod-Shift-l",run:Zw},{key:"Mod-Alt-g",run:Dw},{key:"Mod-d",run:Hw,preventDefault:!0}];class ty{constructor(e){this.view=e;let t=this.query=e.state.field(da).query.spec;this.commit=this.commit.bind(this),this.searchField=De("input",{value:t.search,placeholder:pt(e,"Find"),"aria-label":pt(e,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=De("input",{value:t.replace,placeholder:pt(e,"Replace"),"aria-label":pt(e,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=De("input",{type:"checkbox",name:"case",form:"",checked:t.caseSensitive,onchange:this.commit}),this.reField=De("input",{type:"checkbox",name:"re",form:"",checked:t.regexp,onchange:this.commit}),this.wordField=De("input",{type:"checkbox",name:"word",form:"",checked:t.wholeWord,onchange:this.commit});function s(o,r,i){return De("button",{class:"cm-button",name:o,onclick:r,type:"button"},i)}this.dom=De("div",{onkeydown:o=>this.keydown(o),class:"cm-search"},[this.searchField,s("next",()=>_r(e),[pt(e,"next")]),s("prev",()=>Pr(e),[pt(e,"previous")]),s("select",()=>Jw(e),[pt(e,"all")]),De("label",null,[this.caseField,pt(e,"match case")]),De("label",null,[this.reField,pt(e,"regexp")]),De("label",null,[this.wordField,pt(e,"by word")]),...e.state.readOnly?[]:[De("br"),this.replaceField,s("replace",()=>gd(e),[pt(e,"replace")]),s("replaceAll",()=>Qw(e),[pt(e,"replace all")])],De("button",{name:"close",onclick:()=>oo(e),"aria-label":pt(e,"close"),type:"button"},["Ã"])])}commit(){let e=new $h({search:this.searchField.value,caseSensitive:this.caseField.checked,regexp:this.reField.checked,wholeWord:this.wordField.checked,replace:this.replaceField.value});e.eq(this.query)||(this.query=e,this.view.dispatch({effects:ao.of(e)}))}keydown(e){$x(this.view,e,"search-panel")?e.preventDefault():e.keyCode==13&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?Pr:_r)(this.view)):e.keyCode==13&&e.target==this.replaceField&&(e.preventDefault(),gd(this.view))}update(e){for(let t of e.transactions)for(let s of t.effects)s.is(ao)&&!s.value.eq(this.query)&&this.setQuery(s.value)}setQuery(e){this.query=e,this.searchField.value=e.search,this.replaceField.value=e.replace,this.caseField.checked=e.caseSensitive,this.reField.checked=e.regexp,this.wordField.checked=e.wholeWord}mount(){this.searchField.select()}get pos(){return 80}get top(){return this.view.state.facet(ds).top}}function pt(a,e){return a.state.phrase(e)}const $o=30,Uo=/[\s\.,:;?!]/;function lc(a,{from:e,to:t}){let s=a.state.doc.lineAt(e),o=a.state.doc.lineAt(t).to,r=Math.max(s.from,e-$o),i=Math.min(o,t+$o),n=a.state.sliceDoc(r,i);if(r!=s.from){for(let c=0;c<$o;c++)if(!Uo.test(n[c+1])&&Uo.test(n[c])){n=n.slice(c);break}}if(i!=o){for(let c=n.length-1;c>n.length-$o;c--)if(!Uo.test(n[c-1])&&Uo.test(n[c])){n=n.slice(0,c);break}}return pe.announce.of(`${a.state.phrase("current match")}. ${n} ${a.state.phrase("on line")} ${s.number}.`)}const ay=pe.baseTheme({".cm-panel.cm-search":{padding:"2px 6px 4px",position:"relative","& [name=close]":{position:"absolute",top:"0",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",padding:0,margin:0},"& input, & button, & label":{margin:".2em .6em .2em 0"},"& input[type=checkbox]":{marginRight:".2em"},"& label":{fontSize:"80%",whiteSpace:"pre"}},"&light .cm-searchMatch":{backgroundColor:"#ffff0054"},"&dark .cm-searchMatch":{backgroundColor:"#00ffff8a"},"&light .cm-searchMatch-selected":{backgroundColor:"#ff6a0054"},"&dark .cm-searchMatch-selected":{backgroundColor:"#ff00ff8a"}}),sy=[da,is.low(Xw),ay];class E2{constructor(e,t,s,o){this.state=e,this.pos=t,this.explicit=s,this.view=o,this.abortListeners=[],this.abortOnDocChange=!1}tokenBefore(e){let t=Je(this.state).resolveInner(this.pos,-1);for(;t&&e.indexOf(t.name)<0;)t=t.parent;return t?{from:t.from,to:this.pos,text:this.state.sliceDoc(t.from,this.pos),type:t.type}:null}matchBefore(e){let t=this.state.doc.lineAt(this.pos),s=Math.max(t.from,this.pos-250),o=t.text.slice(s-t.from,this.pos-t.from),r=o.search(ry(e));return r<0?null:{from:s+r,to:this.pos,text:o.slice(r)}}get aborted(){return this.abortListeners==null}addEventListener(e,t,s){e=="abort"&&this.abortListeners&&(this.abortListeners.push(t),s&&s.onDocChange&&(this.abortOnDocChange=!0))}}function xd(a){let e=Object.keys(a).join(""),t=/\w/.test(e);return t&&(e=e.replace(/\w/g,"")),`[${t?"\\w":""}${e.replace(/[^\w\s]/g,"\\$&")}]`}function oy(a){let e=Object.create(null),t=Object.create(null);for(let{label:o}of a){e[o[0]]=!0;for(let r=1;r<o.length;r++)t[o[r]]=!0}let s=xd(e)+xd(t)+"*$";return[new RegExp("^"+s),new RegExp(s)]}function D2(a){let e=a.map(o=>
vendor: 21,491 bytes, line 145
145typeof o=="string"?{label:o}:o),[t,s]=e.every(o=>/^\w+$/.test(o.label))?[/\w*$/,/\w+$/]:oy(e);return o=>{let r=o.matchBefore(s);return r||o.explicit?{from:r?r.from:o.pos,options:e,validFor:t}:null}}function T2(a,e){return t=>{for(let s=Je(t.state).resolveInner(t.pos,-1);s;s=s.parent){if(a.indexOf(s.name)>-1)return null;if(s.type.isTop)break}return e(t)}}function ry(a,e){var t;let{source:s}=a,o=s[s.length-1]!="$";return o?new RegExp(`(?:${s})${o?"$":""}`,(t=a.flags)!==null&&t!==void 0?t:a.ignoreCase?"i":""):a}const iy=Zt.define(),ny=pe.baseTheme({".cm-tooltip.cm-tooltip-autocomplete":{"& > ul":{fontFamily:"monospace",whiteSpace:"nowrap",overflow:"hidden auto",maxWidth_fallback:"700px",maxWidth:"min(700px, 95vw)",minWidth:"250px",maxHeight:"10em",height:"100%",listStyle:"none",margin:0,padding:0,"& > li, & > completion-section":{padding:"1px 3px",lineHeight:1.2},"& > li":{overflowX:"hidden",textOverflow:"ellipsis",cursor:"pointer"},"& > completion-section":{display:"list-item",borderBottom:"1px solid silver",paddingLeft:"0.5em",opacity:.7}}},"&light .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#17c",color:"white"},"&light .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#777"},"&dark .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#347",color:"white"},"&dark .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#444"},".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after":{content:'"···"',opacity:.5,display:"block",textAlign:"center"},".cm-tooltip.cm-completionInfo":{position:"absolute",padding:"3px 9px",width:"max-content",maxWidth:"400px",boxSizing:"border-box",whiteSpace:"pre-line"},".cm-completionInfo.cm-completionInfo-left":{right:"100%"},".cm-completionInfo.cm-completionInfo-right":{left:"100%"},".cm-completionInfo.cm-completionInfo-left-narrow":{right:"30px"},".cm-completionInfo.cm-completionInfo-right-narrow":{left:"30px"},"&light .cm-snippetField":{backgroundColor:"#00000022"},"&dark .cm-snippetField":{backgroundColor:"#ffffff22"},".cm-snippetFieldPosition":{verticalAlign:"text-top",width:0,height:"1.15em",display:"inline-block",margin:"0 -0.7px -.7em",borderLeft:"1.4px dotted #888"},".cm-completionMatchedText":{textDecoration:"underline"},".cm-completionDetail":{marginLeft:"0.5em",fontStyle:"italic"},".cm-completionIcon":{fontSize:"90%",width:".8em",display:"inline-block",textAlign:"center",paddingRight:".6em",opacity:"0.6",boxSizing:"content-box"},".cm-completionIcon-function, .cm-completionIcon-method":{"&:after":{content:"'Æ'"}},".cm-completionIcon-class":{"&:after":{content:"'â'"}},".cm-completionIcon-interface":{"&:after":{content:"'â'"}},".cm-completionIcon-variable":{"&:after":{content:"'ð¥'"}},".cm-completionIcon-constant":{"&:after":{content:"'ð¶'"}},".cm-completionIcon-type":{"&:after":{content:"'ð¡'"}},".cm-completionIcon-enum":{"&:after":{content:"'âª'"}},".cm-completionIcon-property":{"&:after":{content:"'â¡'"}},".cm-completionIcon-keyword":{"&:after":{content:"'ðï¸'"}},".cm-completionIcon-namespace":{"&:after":{content:"'â¢'"}},".cm-completionIcon-text":{"&:after":{content:"'abc'",fontSize:"50%",verticalAlign:"middle"}}});class cy{constructor(e,t,s,o){this.field=e,this.line=t,this.from=s,this.to=o}}class dc{constructor(e,t,s){this.field=e,this.from=t,this.to=s}map(e){let t=e.mapPos(this.from,-1,Ye.TrackDel),s=e.mapPos(this.to,1,Ye.TrackDel);return t==null||s==null?null:new dc(this.field,t,s)}}class pc{constructor(e,t){this.lines=e,this.fieldPositions=t}instantiate(e,t){let s=[],o=[t],r=e.doc.lineAt(t),i=/^\s*/.exec(r.text)[0];for(let c of this.lines){if(s.length){let l=i,d=/^\t*/.exec(c)[0].length;for(let p=0;p<d;p++)l+=e.facet(Fr);o.push(t+l.length-d),c=l+c.slice(d)}s.push(c),t+=c.length+1}let n=this.fieldPositions.map(c=>new dc(c.field,o[c.line]+c.from,o[c.line]+c.to));return{text:s,ranges:n}}static parse(e){let t=[],s=[],o=[],r;for(let i of e.split(/\r\n?|\n/)){for(;r=/[#$]\{(?:(\d+)(?::([^}]*))?|((?:\\[{}]|[^}])*))\}/.exec(i);){let n=r[1]?+r[1]:null,c=r[2]||r[3]||"",l=-1,d=c.replace(/\\[{}]/g,p=>p[1]);for(let p=0;p<t.length;p++)(n!=null?t[p].seq==n:d&&t[p].name==d)&&(l=p);if(l<0){let p=0;for(;p<t.length&&(n==null||t[p].seq!=null&&t[p].seq<n);)p++;t.splice(p,0,{seq:n,name:d}),l=p;for(let u of o)u.field>=l&&u.field++}o.push(new cy(l,s.length,r.index,r.index+d.length)),i=i.slice(0,r.index)+c+i.slice(r.index+r[0].length)}i=i.replace(/\\([{}])/g,(n,c,l)=>{for(let d of o)d.line==s.length&&d.from>l&&(d.from--,d.to--);return c}),s.push(i)}return new pc(s,o)}}let ly=be.widget({widget:new class extends Ba{toDOM(){let a=document.createElement("span");return a.className="cm-snippetFieldPosition",a}ignoreEvent(){return!1}}}),dy=be.mark({class:"cm-snippetField"});class ps{constructor(e,t){this.ranges=e,this.active=t,this.deco=be.set(e.map(s=>(s.from==s.to?ly:dy).range(s.from,s.to)))}map(e){let t=[];for(let s of this.ranges){let o=s.map(e);if(!o)return null;t.push(o)}return new ps(t,this.active)}selectionInsideField(e){return e.ranges.every(t=>this.ranges.some(s=>s.field==this.active&&s.from<=t.from&&s.to>=t.to))}}const vo=we.define({map(a,e){return a&&a.map(e)}}),py=we.define(),ro=st.define({create(){return null},update(a,e){for(let t of e.effects){if(t.is(vo))return t.value;if(t.is(py)&&a)return new ps(a.ranges,t.value)}return a&&e.docChanged&&(a=a.map(e.changes)),a&&e.selection&&!a.selectionInsideField(e.selection)&&(a=null),a},provide:a=>pe.decorations.from(a,e=>e?e.deco:be.none)});function uc(a,e){return ae.create(a.filter(t=>t.field==e).map(t=>ae.range(t.from,t.to)))}function uy(a){let e=pc.parse(a);return(t,s,o,r)=>{let{text:i,ranges:n}=e.instantiate(t.state,o),{main:c}=t.state.selection,l={changes:{from:o,to:r==c.from?c.to:r,insert:Se.of(i)},scrollIntoView:!0,annotations:s?[iy.of(s),$e.userEvent.of("input.complete")]:void 0};if(n.length&&(l.selection=uc(n,0)),n.some(d=>d.field>0)){let d=new ps(n,0),p=l.effects=[vo.of(d)];t.state.field(ro,!1)===void 0&&p.push(we.appendConfig.of([ro,xy,by,ny]))}t.dispatch(t.state.update(l))}}function Gh(a){return({state:e,dispatch:t})=>{let s=e.field(ro,!1);if(!s||a<0&&s.active==0)return!1;let o=s.active+a,r=a>0&&!s.ranges.some(i=>i.field==o+a);return t(e.update({selection:uc(s.ranges,o),effects:vo.of(r?null:new ps(s.ranges,o)),scrollIntoView:!0})),!0}}const hy=({state:a,dispatch:e})=>a.field(ro,!1)?(e(a.update({effects:vo.of(null)})),!0):!1,fy=Gh(1),my=Gh(-1),gy=[{key:"Tab",run:fy,shift:my},{key:"Escape",run:hy}],bd=fe.define({combine(a){return a.length?a[0]:gy}}),xy=is.highest(Gn.compute([bd],a=>a.facet(bd)));function N2(a,e){return Object.assign(Object.assign({},e),{apply:uy(a)})}const by=pe.domEventHandlers({mousedown(a,e){let t=e.state.field(ro,!1),s;if(!t||(s=e.posAtCoords({x:a.clientX,y:a.clientY}))==null)return!1;let o=t.ranges.find(r=>r.from<=s&&r.to>=s);return!o||o.field==t.active?!1:(e.dispatch({selection:uc(t.ranges,o.field),effects:vo.of(t.ranges.some(r=>r.field>o.field)?new ps(t.ranges,o.field):null),scrollIntoView:!0}),!0)}}),io={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},Ma=we.define({map(a,e){let t=e.mapPos(a,-1,Ye.TrackAfter);return t??void 0}}),hc=new class extends Ta{};hc.startSide=1;hc.endSide=-1;const Yh=st.define({create(){return Pe.empty},update(a,e){if(a=a.map(e.changes),e.selection){let t=e.state.doc.lineAt(e.selection.main.head);a=a.update({filter:s=>s>=t.from&&s<=t.to})}for(let t of e.effects)t.is(Ma)&&(a=a.update({add:[hc.range(t.value,t.value+1)]}));return a}});function vy(){return[wy,Yh]}const yi="()[]{}<>«»»«[]ï½ï½";function Xh(a){for(let e=0;e<yi.length;e+=2)if(yi.charCodeAt(e)==a)return yi.charAt(e+1);return fp(a<128?a:a+1)}function Jh(a,e){return a.languageDataAt("closeBrackets",e)[0]||io}const jy=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent),wy=pe.inputHandler.of((a,e,t,s)=>{if((jy?a.composing:a.compositionStarted)||a.state.readOnly)return!1;let o=a.state.selection.main;if(s.length>2||s.length==2&&ho(Ra(s,0))==1||e!=o.from||t!=o.to)return!1;let r=Cy(a.state,s);return r?(a.dispatch(r),!0):!1}),yy=({state:a,dispatch:e})=>{if(a.readOnly)return!1;let s=Jh(a,a.selection.main.head).brackets||io.brackets,o=null,r=a.changeByRange(i=>{if(i.empty){let n=Sy(a.doc,i.head);for(let c of s)if(c==n&&Ur(a.doc,i.head)==Xh(Ra(c,0)))return{changes:{from:i.head-c.length,to:i.head+c.length},range:ae.cursor(i.head-c.length)}}return{range:o=i}});return o||e(a.update(r,{scrollIntoView:!0,userEvent:"delete.backward"})),!o},ky=[{key:"Backspace",run:yy}];function Cy(a,e){let t=Jh(a,a.selection.main.head),s=t.brackets||io.brackets;for(let o of s){let r=Xh(Ra(o,0));if(e==o)return r==o?Ay(a,o,s.indexOf(o+o+o)>-1,t):_y(a,o,r,t.before||io.before);if(e==r&&Zh(a,a.selection.main.from))return Py(a,o,r)}return null}function Zh(a,e){let t=!1;return a.field(Yh).between(0,a.doc.length,s=>{s==e&&(t=!0)}),t}function Ur(a,e){let t=a.sliceString(e,e+2);return t.slice(0,ho(Ra(t,0)))}function Sy(a,e){let t=a.sliceString(e-2,e);return ho(Ra(t,0))==t.length?t:t.slice(1)}function _y(a,e,t,s){let o=null,r=a.changeByRange(i=>{if(!i.empty)return{changes:[{insert:e,from:i.from},{insert:t,from:i.to}],effects:Ma.of(i.to+e.length),range:ae.range(i.anchor+e.length,i.head+e.length)};let n=Ur(a.doc,i.head);return!n||/\s/.test(n)||s.indexOf(n)>-1?{changes:{insert:e+t,from:i.head},effects:Ma.of(i.head+e.length),range:ae.cursor(i.head+e.length)}:{range:o=i}});return o?null:a.update(r,{scrollIntoView:!0,userEvent:"input.type"})}function Py(a,e,t){let s=null,o=a.changeByRange(r=>r.empty&&Ur(a.doc,r.head)==t?{changes:{from:r.head,to:r.head+t.length,insert:t},range:ae.cursor(r.head+t.length)}:s={range:r});return s?null:a.update(o,{scrollIntoView:!0,userEvent:"input.type"})}function Ay(a,e,t,s){let o=s.stringPrefixes||io.stringPrefixes,r=null,i=a.changeByRange(n=>{if(!n.empty)return{changes:[{insert:e,from:n.from},{insert:e,from:n.to}],effects:Ma.of(n.to+e.length),range:ae.range(n.anchor+e.length,n.head+e.length)};let c=n.head,l=Ur(a.doc,c),d;if(l==e){if(vd(a,c))return{changes:{insert:e+e,from:c},effects:Ma.of(c+e.length),range:ae.cursor(c+e.length)};if(Zh(a,c)){let u=t&&a.sliceDoc(c,c+e.length*3)==e+e+e?e+e+e:e;return{changes:{from:c,to:c+u.length,insert:u},range:ae.cursor(c+u.length)}}}else{if(t&&a.sliceDoc(c-2*e.length,c)==e+e&&(d=jd(a,c-2*e.length,o))>-1&&vd(a,d))return{changes:{insert:e+e+e+e,from:c},effects:Ma.of(c+e.length),range:ae.cursor(c+e.length)};if(a.charCategorizer(c)(l)!=Fe.Word&&jd(a,c,o)>-1&&!My(a,c,e,o))return{changes:{insert:e+e,from:c},effects:Ma.of(c+e.length),range:ae.cursor(c+e.length)}}return{range:r=n}});return r?null:a.update(i,{scrollIntoView:!0,userEvent:"input.type"})}function vd(a,e){let t=Je(a).resolveInner(e+1);return t.parent&&t.from==e}function My(a,e,t,s){let o=Je(a).resolveInner(e,-1),r=s.reduce((i,n)=>Math.max(i,n.length),0);for(let i=0;i<5;i++){let n=a.sliceDoc(o.from,Math.min(o.to,o.from+t.length+r)),c=n.indexOf(t);if(!c||c>-1&&s.indexOf(n.slice(0,c))>-1){let d=o.firstChild;for(;d&&d.from==o.from&&d.to-d.from>t.length+c;){if(a.sliceDoc(d.to-t.length,d.to)==t)return!1;d=d.firstChild}return!0}let l=o.to==e&&o.parent;if(!l)break;o=l}return!1}function jd(a,e,t){let s=a.charCategorizer(e);if(s(a.sliceDoc(e-1,e))!=Fe.Word)return e;for(let o of t){let r=e-o.length;if(a.sliceDoc(r,e)==o&&s(a.sliceDoc(r-1,r))!=Fe.Word)return r}return-1}class wd{constructor(e,t,s){this.from=e,this.to=t,this.diagnostic=s}}class _a{constructor(e,t,s){this.diagnostics=e,this.panel=t,this.selected=s}static init(e,t,s){let o=e,r=s.facet(no).markerFilter;r&&(o=r(o,s));let i=e.slice().sort((p,u)=>p.from-u.from||p.to-u.to),n=new ua,c=[],l=0;for(let p=0;;){let u=p==i.length?null:i[p];if(!u&&!c.length)break;let f,m;for(c.length?(f=l,m=c.reduce((x,b)=>Math.min(x,b.to),u&&u.from>f?u.from:1e8)):(f=u.from,m=u.to,c.push(u),p++);p<i.length;){let x=i[p];if(x.from==f&&(x.to>x.from||x.to==f))c.push(x),p++,m=Math.min(x.to,m);else{m=Math.min(x.from,m);break}}let g=Wy(c);if(c.some(x=>x.from==x.to||x.from==x.to-1&&s.doc.lineAt(x.from).to==x.from))n.add(f,f,be.widget({widget:new Ry(g),diagnostics:c.slice()}));else{let x=c.reduce((b,y)=>y.markClass?b+" "+y.markClass:b,"");n.add(f,m,be.mark({class:"cm-lintRange cm-lintRange-"+g+x,diagnostics:c.slice(),inclusiveEnd:c.some(b=>b.to>m)}))}l=m;for(let x=0;x<c.length;x++)c[x].to<=l&&c.splice(x--,1)}let d=n.finish();return new _a(d,t,ss(d))}}function ss(a,e=null,t=0){let s=null;return a.between(t,1e9,(o,r,{spec:i})=>{if(!(e&&i.diagnostics.indexOf(e)<0))if(!s)s=new wd(o,r,e||i.diagnostics[0]);else{if(i.diagnostics.indexOf(s.diagnostic)<0)return!1;s=new wd(s.from,r,s.diagnostic)}}),s}function Ey(a,e){let t=e.pos,s=e.end||t,o=a.state.facet(no).hideOn(a,t,s);if(o!=null)return o;let r=a.startState.doc.lineAt(e.pos);return!!(a.effects.some(i=>i.is(Qh))||a.changes.touchesRange(r.from,Math.max(r.to,s)))}function Dy(a,e){return a.field(ht,!1)?e:e.concat(we.appendConfig.of(Hy))}const Qh=we.define(),fc=we.define(),ef=we.define(),ht=st.define({create(){return new _a(be.none,null,null)},update(a,e){if(e.docChanged&&a.diagnostics.size){let t=a.diagnostics.map(e.changes),s=null,o=a.panel;if(a.selected){let r=e.changes.mapPos(a.selected.from,1);s=ss(t,a.selected.diagnostic,r)||ss(t,null,r)}!t.size&&o&&e.state.facet(no).autoPanel&&(o=null),a=new _a(t,o,s)}for(let t of e.effects)if(t.is(Qh)){let s=e.state.facet(no).autoPanel?t.value.length?co.open:null:a.panel;a=_a.init(t.value,s,e.state)}else t.is(fc)?a=new _a(a.diagnostics,t.value?co.open:null,a.selected):t.is(ef)&&(a=new _a(a.diagnostics,a.panel,t.value));return a},provide:a=>[Js.from(a,e=>e.panel),pe.decorations.from(a,e=>e.diagnostics)]}),Ty=be.mark({class:"cm-lintRange cm-lintRange-active"});function Ny(a,e,t){let{diagnostics:s}=a.state.field(ht),o,r=-1,i=-1;s.between(e-(t<0?1:0),e+(t>0?1:0),(c,l,{spec:d})=>{if(e>=c&&e<=l&&(c==l||(e>c||t>0)&&(e<l||t<0)))return o=d.diagnostics,r=c,i=l,!1});let n=a.state.facet(no).tooltipFilter;return o&&n&&(o=n(o,a.state)),o?{pos:r,end:i,above:a.state.doc.lineAt(r).to<i,create(){return{dom:Ly(a,o)}}}:null}function Ly(a,e){return De("ul",{class:"cm-tooltip-lint"},e.map(t=>af(a,t,!1)))}const Iy=a=>{let e=a.state.field(ht,!1);(!e||!e.panel)&&a.dispatch({effects:Dy(a.state,[fc.of(!0)])});let t=Xs(a,co.open);return t&&t.dom.querySelector(".cm-panel-lint ul").focus(),!0},yd=a=>{let e=a.state.field(ht,!1);return!e||!e.panel?!1:(a.dispatch({effects:fc.of(!1)}),!0)},Oy=a=>{let e=a.state.field(ht,!1);if(!e)return!1;let t=a.state.selection.main,s=e.diagnostics.iter(t.to+1);return!s.value&&(s=e.diagnostics.iter(0),!s.value||s.from==t.from&&s.to==t.to)?!1:(a.dispatch({selection:{anchor:s.from,head:s.to},scrollIntoView:!0}),!0)},Fy=[{key:"Mod-Shift-m",run:Iy,preventDefault:!0},{key:"F8",run:Oy}],no=fe.define({combine(a){return Object.assign({sources:a.map(e=>e.source).filter(e=>e!=null)},va(a.map(e=>e.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:()=>null},{needsRefresh:(e,t)=>e?t?s=>e(s)||t(s):e:t}))}});function tf(a){let e=[];if(a)e:for(let{name:t}of a){for(let s=0;s<t.length;s++){let o=t[s];if(/[a-zA-Z]/.test(o)&&!e.some(r=>r.toLowerCase()==o.toLowerCase())){e.push(o);continue e}}e.push("")}return e}function af(a,e,t){var s;let o=t?tf(e.actions):[];return De("li",{class:"cm-diagnostic cm-diagnostic-"+e.severity},De("span",{class:"cm-diagnosticText"},e.renderMessage?e.renderMessage(a):e.message),(s=e.actions)===null||s===void 0?void 0:s.map((r,i)=>{let n=!1,c=u=>{if(u.preventDefault(),n)return;n=!0;let f=ss(a.state.field(ht).diagnostics,e);f&&r.apply(a,f.from,f.to)},{name:l}=r,d=o[i]?l.indexOf(o[i]):-1,p=d<0?l:[l.slice(0,d),De("u",l.slice(d,d+1)),l.slice(d+1)];return De("button",{type:"button",class:"cm-diagnosticAction",onclick:c,onmousedown:c,"aria-label":` Action: ${l}${d<0?"":` (access key "${o[i]})"`}.`},p)}),e.source&&De("div",{class:"cm-diagnosticSource"},e.source))}class Ry extends Ba{constructor(e){super(),this.sev=e}eq(e){return e.sev==this.sev}toDOM(){return De("span",{class:"cm-lintPoint cm-lintPoint-"+this.sev})}}class kd{constructor(e,t){this.diagnostic=t,this.id="item_"+Math.floor(Math.random()*4294967295).toString(16),this.dom=af(e,t,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}}class co{constructor(e){this.view=e,this.items=[];let t=o=>{if(o.keyCode==27)yd(this.view),this.view.focus();else if(o.keyCode==38||o.keyCode==33)this.moveSelection((this.selectedIndex-1+this.items.length)%this.items.length);else if(o.keyCode==40||o.keyCode==34)this.moveSelection((this.selectedIndex+1)%this.items.length);else if(o.keyCode==36)this.moveSelection(0);else if(o.keyCode==35)this.moveSelection(this.items.length-1);else if(o.keyCode==13)this.view.focus();else if(o.keyCode>=65&&o.keyCode<=90&&this.selectedIndex>=0){let{diagnostic:r}=this.items[this.selectedIndex],i=tf(r.actions);for(let n=0;n<i.length;n++)if(i[n].toUpperCase().charCodeAt(0)==o.keyCode){let c=ss(this.view.state.field(ht).diagnostics,r);c&&r.actions[n].apply(e,c.from,c.to)}}else return;o.preventDefault()},s=o=>{for(let r=0;r<this.items.length;r++)this.items[r].dom.contains(o.target)&&this.moveSelection(r)};this.list=De("ul",{tabIndex:0,role:"listbox","aria-label":this.view.state.phrase("Diagnostics"),onkeydown:t,onclick:s}),this.dom=De("div",{class:"cm-panel-lint"},this.list,De("button",{type:"button",name:"close","aria-label":this.view.state.phrase("close"),onclick:()=>yd(this.view)},"Ã")),this.update()}get selectedIndex(){let e=this.view.state.field(ht).selected;if(!e)return-1;for(let t=0;t<this.items.length;t++)if(this.items[t].diagnostic==e.diagnostic)return t;return-1}update(){let{diagnostics:e,selected:t}=this.view.state.field(ht),s=0,o=!1,r=null,i=new Set;for(e.between(0,this.view.state.doc.length,(n,c,{spec:l})=>{for(let d of l.diagnostics){if(i.has(d))continue;i.add(d);let p=-1,u;for(let f=s;f<this.items.length;f++)if(this.items[f].diagnostic==d){p=f;break}p<0?(u=new kd(this.view,d),this.items.splice(s,0,u),o=!0):(u=this.items[p],p>s&&(this.items.splice(s,p-s),o=!0)),t&&u.diagnostic==t.diagnostic?u.dom.hasAttribute("aria-selected")||(u.dom.setAttribute("aria-selected","true"),r=u):u.dom.hasAttribute("aria-selected")&&u.dom.removeAttribute("aria-selected"),s++}});s<this.items.length&&!(this.items.length==1&&this.items[0].diagnostic.from<0);)o=!0,this.items.pop();this.items.length==0&&(this.items.push(new kd(this.view,{from:-1,to:-1,severity:"info",message:this.view.state.phrase("No diagnostics")})),o=!0),r?(this.list.setAttribute("aria-activedescendant",r.id),this.view.requestMeasure({key:this,read:()=>({sel:r.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:({sel:n,panel:c})=>{let l=c.height/this.list.offsetHeight;n.top<c.top?this.list.scrollTop-=(c.top-n.top)/l:n.bottom>c.bottom&&(this.list.scrollTop+=(n.bottom-c.bottom)/l)}})):this.selectedIndex<0&&this.list.removeAttribute("aria-activedescendant"),o&&this.sync()}sync(){let e=this.list.firstChild;function t(){let s=e;e=s.nextSibling,s.remove()}for(let s of this.items)if(s.dom.parentNode==this.list){for(;e!=s.dom;)t();e=s.dom.nextSibling}else this.list.insertBefore(s.dom,e);for(;e;)t()}moveSelection(e){if(this.selectedIndex<0)return;let t=this.view.state.field(ht),s=ss(t.diagnostics,this.items[e].diagnostic);s&&this.view.dispatch({selection:{anchor:s.from,head:s.to},scrollIntoView:!0,effects:ef.of(s)})}static open(e){return new co(e)}}function By(a,e='viewBox="0 0 40 40"'){return`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" ${e}>${encodeURIComponent(a)}</svg>')`}function qo(a){return By(`<path d="m0 2.5 l2 -1.5 l1 0 l2 1.5 l1 0" stroke="${a}" fill="none" stroke-width=".7"/>`,'width="6" height="3"')}const zy=pe.baseTheme({".cm-diagnostic":{padding:"3px 6px 3px 8px",marginLeft:"-1px",display:"block",whiteSpace:"pre-wrap"},".cm-diagnostic-error":{borderLeft:"5px solid #d11"},".cm-diagnostic-warning":{borderLeft:"5px solid orange"},".cm-diagnostic-info":{borderLeft:"5px solid #999"},".cm-diagnostic-hint":{borderLeft:"5px solid #66d"},".cm-diagnosticAction":{font:"inherit",border:"none",padding:"2px 4px",backgroundColor:"#444",color:"white",borderRadius:"3px",marginLeft:"8px",cursor:"pointer"},".cm-diagnosticSource":{fontSize:"70%",opacity:.7},".cm-lintRange":{backgroundPosition:"left bottom",backgroundRepeat:"repeat-x",paddingBottom:"0.7px"},".cm-lintRange-error":{backgroundImage:qo("#d11")},".cm-lintRange-warning":{backgroundImage:qo("orange")},".cm-lintRange-info":{backgroundImage:qo("#999")},".cm-lintRange-hint":{backgroundImage:qo("#66d")},".cm-lintRange-active":{backgroundColor:"#ffdd9980"},".cm-tooltip-lint":{padding:0,margin:0},".cm-lintPoint":{position:"relative","&:after":{content:'""',position:"absolute",bottom:0,left:"-2px",borderLeft:"3px solid transparent",borderRight:"3px solid transparent",borderBottom:"4px solid #d11"}},".cm-lintPoint-warning":{"&:after":{borderBottomColor:"orange"}},".cm-lintPoint-info":{"&:after":{borderBottomColor:"#999"}},".cm-lintPoint-hint":{"&:after":{borderBottomColor:"#66d"}},".cm-panel.cm-panel-lint":{position:"relative","& ul":{maxHeight:"100px",overflowY:"auto","& [aria-selected]":{backgroundColor:"#ddd","& u":{textDecoration:"underline"}},"&:focus [aria-selected]":{background_fallback:"#bdf",backgroundColor:"Highlight",color_fallback:"white",color:"HighlightText"},"& u":{textDecoration:"none"},padding:0,margin:0},"& [name=close]":{position:"absolute",top:"0",right:"2px",background:"inherit",border:"none",font:"inherit",padding:0,margin:0}}});
145function Vy(a){return a=="error"?4:a=="warning"?3:a=="info"?2:1}function Wy(a){let e="hint",t=1;for(let s of a){let o=Vy(s.severity);o>t&&(t=o,e=s.severity)}return e}const Hy=[ht,pe.decorations.compute([ht],a=>{let{selected:e,panel:t}=a.field(ht);return!e||!t||e.from==e.to?be.none:be.set([Ty.range(e.from,e.to)])}),db(Ny,{hideOn:Ey}),zy],oa={"docker-compose":"yaml","docker-compose.yml":"yaml",dotenv:"plaintext",tex:"latex",gitignore:"properties",editorconfig:"properties",makefile:"shell",dockerfile:"dockerfile",assembly_x86:"x86asm","assembly x86":"x86asm",assembly:"x86asm","c#":"csharp","c++":"cpp",reactjs:"jsx",jsx:"jsx",tsx:"tsx",ts:"typescript",js:"javascript",py:"python",rb:"ruby",rs:"rust",go:"go",php:"php",swift:"swift",kotlin:"kotlin",scala:"scala",zsh:"bash",sh:"bash",powershell:"powershell",ps1:"powershell",circleci:"yaml",jenkins:"groovy",gitlabci:"yaml",githubactions:"yaml",travisci:"yaml",azurepipelines:"yaml",awscodepipeline:"yaml",gcbuild:"yaml",bamboo:"groovy",teamcity:"xml",bitbucket:"yaml",drone:"yaml",spinnaker:"json",tekton:"yaml",json:"json",yaml:"yaml",yml:"yaml",xml:"xml",csv:"csv",toml:"toml",ini:"ini",googlesheets:"excel",excel:"excel",maven:"xml",gradle:"groovy",cargo:"toml",npm:"json",yarn:"yaml"},$y=["javascript","typescript","jsx","tsx","html","css","json","yaml","python","java","csharp","cpp","rust","go","ruby","php","markdown","bash","sql"];class Uy{languageCache=new Map;async getLanguageSupport(e){if(e=(e||"").toLowerCase(),oa[e]&&(e=oa[e]),this.languageCache.has(e))return this.languageCache.get(e);try{const t=tr.find(o=>o.name.toLowerCase()===e||o.alias&&o.alias.some(r=>r.toLowerCase()===e));if(!t){He.log(`Language "${e}" not found in CodeMirror, using plaintext`);const o=tr.find(r=>r.name.toLowerCase()==="plaintext"||r.name.toLowerCase()==="text");if(o){const r=await o.load();return this.languageCache.set(e,r),r}return null}const s=await t.load();return this.languageCache.set(e,s),s}catch(t){return console.error(`Failed to load language "${e}":`,t),null}}getLanguageInfo(e){return e=(e||"").toLowerCase(),oa[e]&&(e=oa[e]),tr.find(t=>t.name.toLowerCase()===e||t.alias&&t.alias.some(s=>s.toLowerCase()===e))}async preloadCommonLanguages(){const e=$y.map(t=>this.getLanguageSupport(t));await Promise.allSettled(e),He.log(`Preloaded ${this.languageCache.size} languages`)}getLanguageFromFilePath(e){if(!e)return"plaintext";const t=e.split("/").pop()?.toLowerCase()||"";if(t==="dockerfile")return"dockerfile";if(t===".gitignore")return"properties";if(t==="makefile")return"makefile";if(t==="package.json")return"json";const s=t.split(".").pop()?.toLowerCase()||"";if(s){if(oa[s])return oa[s];const o={js:"javascript",ts:"typescript",jsx:"jsx",tsx:"tsx",html:"html",css:"css",json:"json",yaml:"yaml",yml:"yaml",py:"python",java:"java",c:"c",cpp:"cpp",cs:"csharp",go:"go",rb:"ruby",php:"php",rs:"rust",md:"markdown",sql:"sql",sh:"bash",xml:"xml",toml:"toml",swift:"swift",kt:"kotlin"};if(o[s])return o[s]}return"plaintext"}}const sf=new Uy,rt=({variant:a,settings:e,styles:t})=>{const s=pe.theme({"&":{backgroundColor:e.background,color:e.foreground},".cm-content":{caretColor:e.caret},".cm-cursor, .cm-dropCursor":{borderLeftColor:e.caret},"&.cm-focused .cm-selectionBackgroundm .cm-selectionBackground, .cm-content ::selection":{backgroundColor:e.selection},".cm-activeLine":{backgroundColor:e.lineHighlight},".cm-gutters":{backgroundColor:e.gutterBackground,color:e.gutterForeground},".cm-activeLineGutter":{backgroundColor:e.lineHighlight}},{dark:a==="dark"}),o=cs.define(t);return[s,Zn(o)]};rt({variant:"dark",settings:{background:"#200020",foreground:"#D0D0FF",caret:"#7070FF",selection:"#80000080",gutterBackground:"#200020",gutterForeground:"#C080C0",lineHighlight:"#80000040"},styles:[{tag:w.comment,color:"#404080"},{tag:[w.string,w.regexp],color:"#999999"},{tag:w.number,color:"#7090B0"},{tag:[w.bool,w.null],color:"#8080A0"},{tag:[w.punctuation,w.derefOperator],color:"#805080"},{tag:w.keyword,color:"#60B0FF"},{tag:w.definitionKeyword,color:"#B0FFF0"},{tag:w.moduleKeyword,color:"#60B0FF"},{tag:w.operator,color:"#A0A0FF"},{tag:[w.variableName,w.self],color:"#008080"}
145,{tag:w.operatorKeyword,color:"#A0A0FF"},{tag:w.controlKeyword,color:"#80A0FF"},{tag:w.className,color:"#70E080"},{tag:[w.function(w.propertyName),w.propertyName],color:"#50A0A0"},{tag:w.tagName,color:"#009090"},{tag:w.modifier,color:"#B0FFF0"},{tag:[w.squareBracket,w.attributeName],color:"#D0D0FF"}]});const qy=rt({variant:"light",settings:{background:"#fcfcfc",foreground:"#5c6166",caret:"#ffaa33",selection:"#036dd626",gutterBackground:"#fcfcfc",gutterForeground:"#8a919966",lineHighlight:"#8a91991a"},styles:[{tag:w.comment,color:"#787b8099"},{tag:w.string,color:"#86b300"},{tag:w.regexp,color:"#4cbf99"},{tag:[w.number,w.bool,w.null],color:"#ffaa33"},{tag:w.variableName,color:"#5c6166"},{tag:[w.definitionKeyword,w.modifier],color:"#fa8d3e"},{tag:[w.keyword,w.special(w.brace)],color:"#fa8d3e"},{tag:w.operator,color:"#ed9366"},{tag:w.separator,color:"#5c6166b3"},{tag:w.punctuation,color:"#5c6166"},{tag:[w.definition(w.propertyName),w.function(w.variableName)],color:"#f2ae49"},{tag:[w.className,w.definition(w.typeName)],color:"#22a4e6"},{tag:[w.tagName,w.typeName,w.self,w.labelName],color:"#55b4d4"},{tag:w.angleBracket,color:"#55b4d480"},{tag:w.attributeName,color:"#f2ae49"}]});rt({variant:"dark",settings:{background:"#15191EFA",foreground:"#EEF2F7",caret:"#C4C4C4",selection:"#90B2D557",gutterBackground:"#15191EFA",gutterForeground:"#aaaaaa95",lineHighlight:"#57575712"},styles:[{tag:w.comment,color:"#6E6E6E"},{tag:[w.string,w.regexp,w.special(w.brace)],color:"#5C81B3"},{tag:w.number,color:"#C1E1B8"},{tag:w.bool,color:"#53667D"},{tag:[w.definitionKeyword,w.modifier,w.function(w.propertyName)],color:"#A3D295",fontWeight:"bold"},{tag:[w.keyword,w.moduleKeyword,w.operatorKeyword,w.operator],color:"#697A8E",fontWeight:"bold"},{tag:[w.variableName,w.attributeName],color:"#708E67"},{tag:[w.function(w.variableName),w.definition(w.propertyName),w.derefOperator],color:"#fff"},{tag:w.tagName,color:"#A3D295"}]});rt({variant:"dark",settings:{background:"#2e241d",foreground:"#BAAE9E",caret:"#A7A7A7",selection:"#DDF0FF33",gutterBackground:"#28211C",gutterForeground:"#BAAE9E90",lineHighlight:"#FFFFFF08"},styles:[{tag:w.comment,color:"#666666"},{tag:[w.string,w.special(w.brace)],color:"#54BE0D"},{tag:w.regexp,color:"#E9C062"},{tag:w.number,color:"#CF6A4C"},{tag:[w.keyword,w.operator],color:"#5EA6EA"},{tag:w.variableName,color:"#7587A6"},{tag:[w.definitionKeyword,w.modifier],color:"#F9EE98"},{tag:[w.propertyName,w.function(w.variableName)],color:"#937121"},{tag:[w.typeName,w.angleBracket,w.tagName],color:"#9B859D"}]});rt({variant:"dark",settings:{background:"#3b2627",foreground:"#E6E1C4",caret:"#E6E1C4",selection:"#16120E",gutterBackground:"#3b2627",gutterForeground:"#E6E1C490",lineHighlight:"#1F1611"},styles:[{tag:w.comment,color:"#6B4E32"},{tag:[w.keyword,w.operator,w.derefOperator],color:"#EF5D32"},{tag:w.className,color:"#EFAC32",fontWeight:"bold"},{tag:[w.typeName,w.propertyName,w.function(w.variableName),w.definition(w.variableName)],color:"#EFAC32"},{tag:w.definition(w.typeName),color:"#EFAC32",fontWeight:"bold"},{tag:w.labelName,color:"#EFAC32",fontWeight:"bold"},{tag:[w.number,w.bool],color:"#6C99BB"},{tag:[w.variableName,w.self],color:"#7DAF9C"},{tag:[w.string,w.special(w.brace),w.regexp],color:"#D9D762"},{tag:[w.angleBracket,w.tagName,w.attributeName],color:"#EFCB43"}]});rt({variant:"dark",settings:{background:"#000205",foreground:"#FFFFFF",caret:"#E60065",selection:"#E60C6559",gutterBackground:"#000205",gutterForeground:"#ffffff90",lineHighlight:"#4DD7FC1A"},styles:[{tag:w.comment,color:"#404040"},{tag:[w.string,w.special(w.brace),w.regexp],color:"#00D8FF"},{tag:w.number,color:"#E62286"},{tag:[w.variableName,w.attributeName,w.self],color:"#E62286",fontWeight:"bold"},{tag:w.function(w.variableName),color:"#fff",fontWeight:"bold"}]});rt({variant:"light",settings:{background:"#fff",foreground:"#000",caret:"#000",selection:"#BDD5FC",gutterBackground:"#fff",gutterForeground:"#00000070",lineHighlight:"#FFFBD1"},styles:[{tag:w.comment,color:"#BCC8BA"},{tag:[w.string,w.special(w.brace),w.regexp],color:"#5D90CD"},{tag:[w.number,w.bool,w.null],color:"#46A609"}
145,{tag:w.keyword,color:"#AF956F"},{tag:[w.definitionKeyword,w.modifier],color:"#C52727"},{tag:[w.angleBracket,w.tagName,w.attributeName],color:"#606060"},{tag:w.self,color:"#000"}]});rt({variant:"dark",settings:{background:"#00254b",foreground:"#FFFFFF",caret:"#FFFFFF",selection:"#B36539BF",gutterBackground:"#00254b",gutterForeground:"#FFFFFF70",lineHighlight:"#00000059"},styles:[{tag:w.comment,color:"#0088FF"},{tag:w.string,color:"#3AD900"},{tag:w.regexp,color:"#80FFC2"},{tag:[w.number,w.bool,w.null],color:"#FF628C"},{tag:[w.definitionKeyword,w.modifier],color:"#FFEE80"},{tag:w.variableName,color:"#CCCCCC"},{tag:w.self,color:"#FF80E1"},{tag:[w.className,w.definition(w.propertyName),w.function(w.variableName),w.definition(w.typeName),w.labelName],color:"#FFDD00"},{tag:[w.keyword,w.operator],color:"#FF9D00"},{tag:[w.propertyName,w.typeName],color:"#80FFBB"},{tag:w.special(w.brace),color:"#EDEF7D"},{tag:w.attributeName,color:"#9EFFFF"},{tag:w.derefOperator,color:"#fff"}]});const Ky=rt({variant:"dark",settings:{background:"#060521",foreground:"#E0E0E0",caret:"#FFFFFFA6",selection:"#122BBB",gutterBackground:"#060521",gutterForeground:"#E0E0E090",lineHighlight:"#FFFFFF0F"},styles:[{tag:w.comment,color:"#AEAEAE"},{tag:[w.string,w.special(w.brace),w.regexp],color:"#8DFF8E"},{tag:[w.className,w.definition(w.propertyName),w.function(w.variableName),w.function(w.definition(w.variableName)),w.definition(w.typeName)],color:"#A3EBFF"},{tag:[w.number,w.bool,w.null],color:"#62E9BD"},{tag:[w.keyword,w.operator],color:"#2BF1DC"},{tag:[w.definitionKeyword,w.modifier],color:"#F8FBB1"},{tag:[w.variableName,w.self],color:"#B683CA"},{tag:[w.angleBracket,w.tagName,w.typeName,w.propertyName],color:"#60A4F1"},{tag:w.derefOperator,color:"#E0E0E0"},{tag:w.attributeName,color:"#7BACCA"}]});rt({variant:"dark",settings:{background:"#2d2f3f",foreground:"#f8f8f2",caret:"#f8f8f0",selection:"#44475a",gutterBackground:"#282a36",gutterForeground:"rgb(144, 145, 148)",lineHighlight:"#44475a"},styles:[{tag:w.comment,color:"#6272a4"},{tag:[w.string,w.special(w.brace)],color:"#f1fa8c"},{tag:[w.number,w.self,w.bool,w.null],color:"#bd93f9"},{tag:[w.keyword,w.operator],color:"#ff79c6"},{tag:[w.definitionKeyword,w.typeName],color:"#8be9fd"},{tag:w.definition(w.typeName),color:"#f8f8f2"},{tag:[w.className,w.definition(w.propertyName),w.function(w.variableName),w.attributeName],color:"#50fa7b"}]});rt({variant:"light",settings:{background:"#FFFFFF",foreground:"#000000",caret:"#000000",selection:"#80C7FF",gutterBackground:"#FFFFFF",gutterForeground:"#00000070",lineHighlight:"#C1E2F8"},styles:[{tag:w.comment,color:"#AAAAAA"},{tag:[w.keyword,w.operator,w.typeName,w.tagName,w.propertyName],color:"#2F6F9F",fontWeight:"bold"},{tag:[w.attributeName,w.definition(w.propertyName)],color:"#4F9FD0"},{tag:[w.className,w.string,w.special(w.brace)],color:"#CF4F5F"},{tag:w.number,color:"#CF4F5F",fontWeight:"bold"},{tag:w.variableName,fontWeight:"bold"}]});rt({variant:"light",settings:{background:"#f2f1f8",foreground:"#0c006b",caret:"#5c49e9",selection:"#d5d1f2",gutterBackground:"#f2f1f8",gutterForeground:"#0c006b70",lineHighlight:"#e1def3"},styles:[{tag:w.comment,color:"#9995b7"},{tag:w.keyword,color:"#ff5792",fontWeight:"bold"},{tag:[w.definitionKeyword,w.modifier],color:"#ff5792"},{tag:[w.className,w.tagName,w.definition(w.typeName)],color:"#0094f0"},{tag:[w.number,w.bool,w.null,w.special(w.brace)],color:"#5842ff"},{tag:[w.definition(w.propertyName),w.function(w.variableName)],color:"#0095a8"},{tag:w.typeName,color:"#b3694d"},{tag:[w.propertyName,w.variableName],color:"#fa8900"},{tag:w.operator,color:"#ff5792"},{tag:w.self,color:"#e64100"},{tag:[w.string,w.regexp],color:"#00b368"},{tag:[w.paren,w.bracket],color:"#0431fa"},{tag:w.labelName,color:"#00bdd6"},{tag:w.attributeName,color:"#e64100"},{tag:w.angleBracket,color:"#9995b7"}]});rt({variant:"light",settings:{background:"#faf4ed",foreground:"#575279",caret:"#575279",selection:"#6e6a8614",gutterBackground:"#faf4ed",gutterForeground:"#57527970",lineHighlight:"#6e6a860d"},styles:[{tag:w.comment,color:"#9893a5"},{tag:[w.bool,w.null],color:"#286983"},{tag:w.number,color:"#d7827e"},{tag:w.className,color:"#d7827e"},{tag:[w.angleBracket,w.tagName,w.typeName],color:"#56949f"},{tag:w.attributeName,color:"#907aa9"},{tag:w.punctuation,color:"#797593"},{tag:[w.keyword,w.modifier],color:"#286983"},{tag:[w.string,w.regexp],color:"#ea9d34"},{tag:w.variableName,color:"#d7827e"}]});rt({variant:"light",settings:{background:"#FFFFFF",foreground:"#000000",caret:"#000000",selection:"#FFFD0054",gutterBackgroun
145d:"#FFFFFF",gutterForeground:"#00000070",lineHighlight:"#00000008"},styles:[{tag:w.comment,color:"#CFCFCF"},{tag:[w.number,w.bool,w.null],color:"#E66C29"},{tag:[w.className,w.definition(w.propertyName),w.function(w.variableName),w.labelName,w.definition(w.typeName)],color:"#2EB43B"},{tag:w.keyword,color:"#D8B229"},{tag:w.operator,color:"#4EA44E",fontWeight:"bold"},{tag:[w.definitionKeyword,w.modifier],color:"#925A47"},{tag:w.string,color:"#704D3D"},{tag:w.typeName,color:"#2F8996"},{tag:[w.variableName,w.propertyName],color:"#77ACB0"},{tag:w.self,color:"#77ACB0",fontWeight:"bold"},{tag:w.regexp,color:"#E3965E"},{tag:[w.tagName,w.angleBracket],color:"#BAA827"},{tag:w.attributeName,color:"#B06520"},{tag:w.derefOperator,color:"#000"}]});rt({variant:"light",settings:{background:"#fef7e5",foreground:"#586E75",caret:"#000000",selection:"#073642",gutterBackground:"#fef7e5",gutterForeground:"#586E7580",lineHighlight:"#EEE8D5"},styles:[{tag:w.comment,color:"#93A1A1"},{tag:w.string,color:"#2AA198"},{tag:w.regexp,color:"#D30102"},{tag:w.number,color:"#D33682"},{tag:w.variableName,color:"#268BD2"},{tag:[w.keyword,w.operator,w.punctuation],color:"#859900"},{tag:[w.definitionKeyword,w.modifier],color:"#073642",fontWeight:"bold"},{tag:[w.className,w.self,w.definition(w.propertyName)],color:"#268BD2"},{tag:w.function(w.variableName),color:"#268BD2"},{tag:[w.bool,w.null],color:"#B58900"},{tag:w.tagName,color:"#268BD2",fontWeight:"bold"},{tag:w.angleBracket,color:"#93A1A1"},{tag:w.attributeName,color:"#93A1A1"},{tag:w.typeName,color:"#859900"}]});rt({variant:"light",settings:{background:"#FFFFFF",foreground:"#4D4D4C",caret:"#AEAFAD",selection:"#D6D6D6",gutterBackground:"#FFFFFF",gutterForeground:"#4D4D4C80",lineHighlight:"#EFEFEF"},styles:[{tag:w.comment,color:"#8E908C"},{tag:[w.variableName,w.self,w.propertyName,w.attributeName,w.regexp],color:"#C82829"},{tag:[w.number,w.bool,w.null],color:"#F5871F"},{tag:[w.className,w.typeName,w.definition(w.typeName)],color:"#C99E00"},{tag:[w.string,w.special(w.brace)],color:"#718C00"},{tag:w.operator,color:"#3E999F"},{tag:[w.definition(w.propertyName),w.function(w.variableName)],color:"#4271AE"},{tag:w.keyword,color:"#8959A8"},{tag:w.derefOperator,color:"#4D4D4C"}]});class Gy{themesLoaded=!1;coolGlowTheme=[];ayuLightTheme=[];themeCompartment=new ns;constructor(){this.loadThemes()}getTheme(e){return this.themesLoaded||this.loadThemes(),e?this.coolGlowTheme:this.ayuLightTheme}createThemeCompartment(e){return this.themeCompartment.of(this.getTheme(e))}updateTheme(e,t){e&&e.dispatch({effects:this.themeCompartment.reconfigure(this.getTheme(t))})}loadThemes(){try{this.coolGlowTheme=Ky,this.ayuLightTheme=qy,this.themesLoaded=!0}catch(e){console.error("Failed to load CodeMirror themes:",e)}}}const Cd=new Gy;(()=>{if(typeof window>"u"||typeof navigator>"u"||!("EditContext"in window))return;const a=navigator.userAgent||"";if(/Android/i.test(a))try{delete window.EditContext}catch{try{window.EditContext=void 0}catch{}}})();const Yy=` 146.code-container { 147 background: #fcfcfc; 148} 149html.dark #codeViewerPanel .code-container { 150 background: #060521; 151} 152 153#codeViewerPanel .cm-panels button:not(.cm-button) { 154 margin: 8px 4px; 155} 156 157html.dark #codeViewerPanel .cm-foldPlaceholder { 158 background-color: #060521 !important; 159 border: 1px solid #2af1dd85 !important; 160 color: #2af1dd !important; 161} 162 163/* Custom styles for proper editor height */ 164#codeViewerPanel .cm-editor { 165 height: 100%; 166 display: flex; 167 flex-direction: column; 168} 169 170#codeViewerPanel .cm-scroller { 171 overflow: auto; 172 flex: 1; 173} 174 175/* Ensure content extends properly */ 176#codeViewerPanel .cm-content { 177 padding-bottom: 1.6em !important; 178 min-height: 100%; 179} 180 181/* Make the gutter stick to the viewport when scrolling */ 182#codeViewerPanel .cm-gutters { 183 height: 100% !important; 184 position: sticky !important; 185 left: 0; 186 z-index: 1; 187 width: 3.3rem; 188} 189 190#codeViewerPanel .cm-gutterElement { 191 width: 2rem; 192} 193 194/* Search panel - Light/Dark Mode support */ 195#codeViewerPanel .cm-search { 196 background-color: #fcfcfc; 197 color: #333; 198 text-transform: capitalize; 199 border-top: 1px solid #ddd; 200} 201 202html.dark #codeViewerPanel .cm-search { 203 background-color: #060521; 204 color: #fff; 205 border-top: 1px solid #2af1dd85; 206} 207 208#codeViewerPanel .cm-search button { 209 width: 85px; 210 background-color: #eee; 211 color: #333; 212 border: 1px solid #ddd; 213} 214 215html.dark #codeViewerPanel .cm-search button { 216 background-color: #1f1f3f; 217 color: #fff; 218 border: 1px solid #2af1dd85; 219} 220 221#codeViewerPanel .cm-search input { 222 background-color: #fff; 223 color: #333; 224 border: 1px solid #ddd; 225} 226 227html.dark #codeViewerPanel .cm-search input { 228 background-color: #1a1a3a; 229 color: #fff; 230 border: 1px solid #2af1dd85; 231} 232 233#codeViewerPanel .cm-search label input { 234 margin-right: 4px !important; 235 vertical-align: -2px; 236} 237 238`,Xy=E.forwardRef(({language:a,readOnly:e=!1,onChange:t,onEditorViewCreated:s,onCursorChange:o,filePath:r,onSave:i},n)=>{const c=E.useRef(null),l=E.useRef(null),d=E.useRef(new ns),p=E.useRef(null),u=ge(L=>L.chatMessages),f=Ya(u),m=je(L=>L.activeFile),g=E.useMemo(()=>f?.files.find(L=>L.path===m),[f?.files,m]);let b=je(L=>L.isFileEdited)(m)?je.getState().editedFiles[m].content:g?.content||"";b=b.trim().replace(/^```(?:\w+\n|\n)?([^`]+)```$/g,"$1").trim(),b.startsWith("```")&&(b=b.substring(b.indexOf(` 239`)+1));const[y,k]=E.useState(!1),A=uo(L=>L.isDarkMode()),{toast:S}=po(),N=E.useCallback(L=>{if(!o)return;const M=L.state,B=M.selection.main,V=M.doc.lineAt(B.head),P={line:V.number,column:B.head-V.from+1},F=Math.abs(B.from-B.to);o(P,F)},[o]),D=E.useCallback(L=>{e||(p.current=L,t&&t(L))},[t,e]);return E.useEffect(()=>{if(!y){k(!0);return}if(p.current!==b&&l.current&&l.current.state.doc.toString()!==b){const M=l.current.scrollDOM.scrollTop,B=l.current.state.selection;l.current.dispatch({changes:{from:0,to:l.current.state.doc.length,insert:b}}),requestAnimationFrame(()=>{if(l.current){l.current.scrollDOM.scrollTop=M;try{const V=Math.min(B.main.head,l.current.state.doc.length);l.current.dispatch({selection:{anchor:V,head:V}})}catch(V){console.warn("Error restoring cursor position:",V)}}})}},[b,y]),E.useEffect(()=>((async()=>
239{if(!c.current)return;let M=(a||"").toLowerCase();oa[M]&&(M=oa[M]);const B=await sf.getLanguageSupport(M||"plaintext"),V=pe.updateListener.of(F=>{if(F.docChanged){const j=F.state.doc.toString();D(j)}(F.selectionSet||F.docChanged)&&N(F.view)}),P=[wb(),eb(),Iw(),d0(),vy(),Aj(),Xx(),Hb(),Qb({openText:"â¾",closedText:"â¸"}),Cd.createThemeCompartment(A),d.current.of(pe.editable.of(!e)),pe.lineWrapping,V,Gn.of([...Aw,...Fj,...ey,...ky,...Fy,Mw]),pe.theme({".cm-gutters":{position:"sticky",left:"0px",background:A?"#060521":"#fcfcfc",height:"100% !important"},".cm-scroller":{overflow:"auto",flex:"1"},".cm-content":{caretColor:e?"transparent":"auto"},".cm-search":{backgroundColor:A?"#060521":"#fcfcfc",color:A?"#fff":"#333",borderTop:A?"1px solid #2af1dd85":"1px solid #ddd"},".cm-search button":{backgroundColor:A?"#1f1f3f":"#eee",color:A?"#fff":"#333",border:A?"1px solid #2af1dd85":"1px solid #ddd"},".cm-search input":{backgroundColor:A?"#1a1a3a":"#fff",color:A?"#fff":"#333",border:A?"1px solid #2af1dd85":"1px solid #ddd"}})];if(B&&P.push(B),l.current){const F=l.current.scrollDOM.scrollTop;l.current.destroy(),l.current=new pe({state:_e.create({doc:b,extensions:P}),parent:c.current}),requestAnimationFrame(()=>{l.current&&(l.current.scrollDOM.scrollTop=F)})}else l.current=new pe({state:_e.create({doc:b,extensions:P}),parent:c.current}),N(l.current),s&&s(l.current);p.current=b})(),()=>{l.current&&(l.current.destroy(),l.current=null)}),[a,A,e,N,s]),E.useEffect(()=>{l.current&&Cd.updateTheme(l.current,A)},[A]),E.useEffect(()=>{l.current&&l.current.dispatch({effects:d.current.reconfigure(pe.editable.of(!e))})},[e]),E.useEffect(()=>{if(e||!i||!r)return;const L=M=>{(M.ctrlKey||M.metaKey)&&M.key==="s"&&(M.preventDefault(),Object.keys(je.getState().editedFiles).length>0?i():S({title:"No changes to save",duration:2e3}))};return document.addEventListener("keydown",L),()=>document.removeEventListener("keydown",L)},[e,i,r]),E.useImperativeHandle(n,()=>({search:()=>{if(l.current)try{l.current.focus(),setTimeout(()=>{try{l.current?.dom.querySelector(".cm-search")?oo(l.current):so(l.current)}catch(L){console.error("Error toggling search panel:",L);const M=navigator.platform.toLowerCase().includes("mac"),B=new KeyboardEvent("keydown",{key:"f",code:"KeyF",ctrlKey:!M,metaKey:M,bubbles:!0});l.current?.dom.dispatchEvent(B)}},10)}catch(L){console.error("Error in search function:",L)}}})),h.jsxs(h.Fragment,{children:[h.jsx("style",{"data-codepal-ve-id":"src-pages-project-codeviewer-codemirroreditor-tsx:codemirroreditor:style:508:13","data-codepal-binding-id":"src-pages-project-codeviewer-codemirroreditor-tsx:codemirroreditor:style:508:13","data-codepal-module-id":"src-pages-project-codeviewer-codemirroreditor-tsx","data-codepal-component-id":"src-pages-project-codeviewer-codemirroreditor-tsx:codemirroreditor","data-codepal-source-node-id":"src-pages-project-codeviewer-codemirroreditor-tsx:codemirroreditor:style:508:13","data-codepal-source-file":"src/pages/Project/CodeViewer/CodeMirrorEditor.tsx","data-codepal-source-line":"508","data-codepal-source-column":"13","data-codepal-source-symbol":"CodeMirrorEditor",children:Yy}),h.jsx("div",{"data-codepal-ve-id":"src-pages-project-codeviewer-codemirroreditor-tsx:codemirroreditor:div:509:13","data-codepal-binding-id":"src-pages-project-codeviewer-codemirroreditor-tsx:codemirroreditor:div:509:13","data-codepal-module-id":"src-pages-project-codeviewer-codemirroreditor-tsx","data-codepal-component-id":"src-pages-project-codeviewer-codemirroreditor-tsx:codemirroreditor","data-codepal-source-node-id":"src-pages-project-codeviewer-codemirroreditor-tsx:codemirroreditor:div:509:13","data-codepal-source-file":"src/pages/Project/CodeViewer/CodeMirrorEditor.tsx","data-codepal-source-line":"509","data-codepal-source-column":"13","data-codepal-source-symbol":"CodeMirrorEditor",className:"code-container relative flex h-full w-full transition-colors duration-200",style:{height:"100%",borderRadius:"4px",overflow:"hidden"},children:h.jsx("div",{"data-codepal-ve-id":"src-pages-project-codeviewer-codemirroreditor-tsx:codemirroreditor:div:517:17","data-codepal-binding-id":"src-pages-project-codeviewer-codemirroreditor-tsx:codemirroreditor:div:517:17","data-codepal-module-id":"src-pages-project-codeviewer-codemirroreditor-tsx","data-codepal-component-id":"src-pages-project-codeviewer-codemirroreditor-tsx:codemirroreditor","data-codepal-source-node
239-id":"src-pages-project-codeviewer-codemirroreditor-tsx:codemirroreditor:div:517:17","data-codepal-source-file":"src/pages/Project/CodeViewer/CodeMirrorEditor.tsx","data-codepal-source-line":"517","data-codepal-source-column":"17","data-codepal-source-symbol":"CodeMirrorEditor",ref:c,className:"w-full h-full","data-enable-grammarly":"false",onClick:()=>{!e&&l.current&&l.current.focus()}})})]})}),Jy=(a={})=>{const{successDuration:e=2e3}=a,[t,s]=E.useState(!1),o=E.useCallback(async r=>{if(!navigator?.clipboard)return console.warn("Clipboard API not available"),!1;try{return await navigator.clipboard.writeText(r),s(!0),setTimeout(()=>{s(!1)},e),!0}catch(i){return console.error("Failed to copy text: ",i),s(!1),!1}},[e]);return{isCopied:t,copyToClipboard:o}},Zy=({filePath:a,isDarkMode:e=!1,className:t,onNavigate:s=null})=>{if(!a)return null;const o=a.split("/"),r=o.pop()||"",i=n=>{if(!s)return;const c=o.slice(0,n+1).join("/");s(c)};return h.jsxs("div",{"data-codepal-ve-id":"src-pages-project-codeviewer-filebreadcrumb-tsx:filebreadcrumb:div:35:9","data-codepal-binding-id":"src-pages-project-codeviewer-filebreadcrumb-tsx:filebreadcrumb:div:35:9","data-codepal-module-id":"src-pages-project-codeviewer-filebreadcrumb-tsx","data-codepal-component-id":"src-pages-project-codeviewer-filebreadcrumb-tsx:filebreadcrumb","data-codepal-source-node-id":"src-pages-project-codeviewer-filebreadcrumb-tsx:filebreadcrumb:div:35:9","data-codepal-source-file":"src/pages/Project/CodeViewer/FileBreadcrumb.tsx","data-codepal-source-line":"35","data-codepal-source-column":"9","data-codepal-source-symbol":"FileBreadcrumb",className:ie("flex items-center overflow-hidden",t),children:[o.length>0&&h.jsxs("div",{"data-codepal-ve-id":"src-pages-project-codeviewer-filebreadcrumb-tsx:filebreadcrumb:div:38:17","data-codepal-binding-id":"src-pages-project-codeviewer-filebreadcrumb-tsx:filebreadcrumb:div:38:17","data-codepal-module-id":"src-pages-project-codeviewer-filebreadcrumb-tsx","data-codepal-component-id":"src-pages-project-codeviewer-filebreadcrumb-tsx:filebreadcrumb","data-codepal-source-node-id":"src-pages-project-codeviewer-filebreadcrumb-tsx:filebreadcrumb:div:38:17","data-codepal-source-file":"src/pages/Project/CodeViewer/FileBreadcrumb.tsx","data-codepal-source-line":"38","data-codepal-source-column":"17","data-codepal-source-symbol":"FileBreadcrumb",className:"flex items-center overflow-hidden",children:[o.map((n,c)=>h.jsxs(Fs.Fragment,{children:[c>0&&h.jsx(Bs,{className:"mx-1 flex-shrink-0 w-3 h-3 text-gray-400"}),h.jsx("div",{"data-codepal-ve-id":"src-pages-project-codeviewer-filebreadcrumb-tsx:filebreadcrumb:div:44:29","data-codepal-binding-id":"src-pages-project-codeviewer-filebreadcrumb-tsx:filebreadcrumb:div:44:29","data-codepal-module-id":"src-pages-project-codeviewer-filebreadcrumb-tsx","data-codepal-component-id":"src-pages-project-codeviewer-filebreadcrumb-tsx:filebreadcrumb","data-codepal-source-node-id":"src-pages-project-codeviewer-filebreadcrumb-tsx:filebreadcrumb:div:44:29","data-codepal-source-file":"src/pages/Project/CodeViewer/FileBreadcrumb.tsx","data-codepal-source-line":"44","data-codepal-source-column":"29","data-codepal-source-symbol":"FileBreadcrumb",className:ie("flex items-center",s&&"cursor-pointer hover:text-gray-700 dark:hover:text-gray-300"),onClick:s?()=>i(c):void 0,children:h.jsx("span",{"data-codepal-ve-id":"src-pages-project-codeviewer-filebreadcrumb-tsx:filebreadcrumb:span:51:33","data-codepal-binding-id":"src-pages-project-codeviewer-filebreadcrumb-tsx:filebreadcrumb:span:51:33","data-codepal-module-id":"src-pages-project-codeviewer-filebreadcrumb-tsx","data-codepal-component-id":"src-pages-project-codeviewer-filebreadcrumb-tsx:filebreadcrumb","data-codepal-source-node-id":"src-pages-project-codeviewer-filebreadcrumb-tsx:filebreadcrumb:span:51:33","data-codepal-source-file":"src/pages/Project/CodeViewer/FileBreadcrumb.tsx","data-codepal-source-line":"51","data-codepal-source-column":"33","data-codepal-source-symbol":"FileBreadcrumb",className:ie("ml-1 font-mono text-xs truncate",e?"text-gray-400":"text-gray-500"),children:n})})]},c)),h.jsx(Bs,{className:"mx-1 flex-shrink-0 w-3 h-3 text-gray-400"})]}),h.jsxs("div",{"data-codepal-ve-id":"src-pages-project-codeviewer-filebreadcrumb-tsx:filebreadcrumb:div:65:13","data-codepal-binding-id":"src-pages-project-codeviewer-filebreadcrumb-tsx:filebreadcrumb:div:65:13","data-codepal-module-id":"src-pages-project-codeviewer-filebreadcrumb-tsx","data-codepal-component-id":"src-pages-project-codeviewer-filebreadcrumb-tsx:filebreadcrumb","data-codepal-source-node
239-id":"src-pages-project-codeviewer-filebreadcrumb-tsx:filebreadcrumb:div:65:13","data-codepal-source-file":"src/pages/Project/CodeViewer/FileBreadcrumb.tsx","data-codepal-source-line":"65","data-codepal-source-column":"13","data-codepal-source-symbol":"FileBreadcrumb",className:"flex items-center gap-1.5",children:[h.jsx("div",{"data-codepal-ve-id":"src-pages-project-codeviewer-filebreadcrumb-tsx:filebreadcrumb:div:66:17","data-codepal-binding-id":"src-pages-project-codeviewer-filebreadcrumb-tsx:filebreadcrumb:div:66:17","data-codepal-module-id":"src-pages-project-codeviewer-filebreadcrumb-tsx","data-codepal-component-id":"src-pages-project-codeviewer-filebreadcrumb-tsx:filebreadcrumb","data-codepal-source-node-id":"src-pages-project-codeviewer-filebreadcrumb-tsx:filebreadcrumb:div:66:17","data-codepal-source-file":"src/pages/Project/CodeViewer/FileBreadcrumb.tsx","data-codepal-source-line":"66","data-codepal-source-column":"17","data-codepal-source-symbol":"FileBreadcrumb",className:"flex-shrink-0",children:h.jsx(Yd,{fileName:r,className:"w-3.5 h-3.5",isActive:!0})}),h.jsx("span",{"data-codepal-ve-id":"src-pages-project-codeviewer-filebreadcrumb-tsx:filebreadcrumb:span:73:17","data-codepal-binding-id":"src-pages-project-codeviewer-filebreadcrumb-tsx:filebreadcrumb:span:73:17","data-codepal-module-id":"src-pages-project-codeviewer-filebreadcrumb-tsx","data-codepal-component-id":"src-pages-project-codeviewer-filebreadcrumb-tsx:filebreadcrumb","data-codepal-source-node-id":"src-pages-project-codeviewer-filebreadcrumb-tsx:filebreadcrumb:span:73:17","data-codepal-source-file":"src/pages/Project/CodeViewer/FileBreadcrumb.tsx","data-codepal-source-line":"73","data-codepal-source-column":"17","data-codepal-source-symbol":"FileBreadcrumb",className:ie("font-mono text-xs truncate max-w-xs",e?"text-gray-300":"text-gray-600"),children:r})]})]})},Qy=({editorView:a,filePath:e,isReadOnly:t,isStreaming:s,onNavigateToFolder:o,onSave:r,onCancel:i,isMarkdown:n=!1,previewMode:c=!1,onTogglePreviewMode:l,editorRef:d})=>{const p=uo(V=>V.isDarkMode()),[u,f]=E.useState(!1),{copyToClipboard:m}=Jy(),g=je(V=>V.hasEditedFiles()),x=ge(V=>V.isSavingProject),y=Gt(V=>V.user)?.isStarterSubscription||!1,k=E.useCallback(async()=>{if(!a)return;const V=a.state.doc.toString();await m(V),f(!0),setTimeout(()=>f(!1),2e3)},[a,m]),A=E.useCallback(()=>{const V=e&&je.getState().isFileEdited(e),P=V?je.getState().getEditedFiles().find(F=>F.path===e)?.originalContent:null;if(je.getState().resetAllEditedFiles(),V&&P&&a){const F=a.state.update({changes:{from:0,to:a.state.doc.length,insert:P}});a.dispatch(F),i()}},[a,e,i]),S=function(){return!!(a?.dom&&a.dom.querySelector(".cm-search"))},N=E.useCallback(()=>{if(d?.current){d.current.search();return}if(!a)return;if(!a.hasFocus)a.focus(),setTimeout(()=>{if(S()){oo(a);return}try{so(a)}catch(P){console.error("Error opening search panel:",P);const F=navigator.platform.toLowerCase().includes("mac"),j=new KeyboardEvent("keydown",{key:"f",code:"KeyF",ctrlKey:!F,metaKey:F,bubbles:!0});a.dom.dispatchEvent(j)}},50);else{if(S()){oo(a);return}try{so(a)}catch(P){console.error("Error opening search panel:",P);const F=navigator.platform.toLowerCase().includes("mac"),j=new KeyboardEvent("keydown",{key:"f",code:"KeyF",ctrlKey:!F,metaKey:F,bubbles:!0});a.dom.dispatchEvent(j)}}},[a,d]),D=`inline-flex items-center justify-center gap-1.5 whitespace-nowrap text-xs font-medium 240 ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 241 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none 242 disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-3.5 [&_svg]:shrink-0 rounded-md 243 h-6`,L=`${D} w-7 p-0 ${p?"dark:text-gray-400 dark:hover:text-gray-300 dark:hover:bg-gray-700":"text-gray-500 hover:text-gray-700 hover:bg-gray-200"}`,M=`${D} px-2 ${p?"dark:text-gray-300 dark:hover:text-white dark:hover:bg-gray-700":"text-gray-700 hover:text-gray-900 hover:bg-gray-200"}`,B=`${D} px-2 ${p?`dark:text-gray-300 dark:hover:text-white ${c?"dark:bg-purple-800/30":"dark:bg-gray-700/30"}`:`text-gray-700 hover:text-gray-900 ${c?"bg-purple-100":"bg-gray-200"}`}`;return h.jsxs("div",{"data-codepal-ve-id":"src-pages-project-codeviewer-editortoolbar-tsx:editortoolbar:div:180:9","data-codepal-binding-id":"src-pages-project-codeviewer-editortoolbar-tsx:editortoolbar:div:180:9","data-codepal-module-id":"src-pages-project-codeviewer-editortoolbar-tsx","data-codepal-component-id":"src-pages-project-codeviewer-editortoolbar-tsx:editortoolbar","data-codepal-source-node
243-id":"src-pages-project-codeviewer-editortoolbar-tsx:editortoolbar:div:180:9","data-codepal-source-file":"src/pages/Project/CodeViewer/EditorToolbar.tsx","data-codepal-source-line":"180","data-codepal-source-column":"9","data-codepal-source-symbol":"EditorToolbar",className:`py-2 h-10 px-4 border-b border-t border-gray-200 dark:border-gray-700 bg-gray-100 dark:bg-gray-800 dark:to-gray-850 flex items-center justify-between ${p?"bg-gray-800 border-gray-700":"bg-gray-50 border-gray-200"} transition-colors duration-150 shadow-sm`,children:[h.jsxs("div",{"data-codepal-ve-id":"src-pages-project-codeviewer-editortoolbar-tsx:editortoolbar:div:185:13","data-codepal-binding-id":"src-pages-project-codeviewer-editortoolbar-tsx:editortoolbar:div:185:13","data-codepal-module-id":"src-pages-project-codeviewer-editortoolbar-tsx","data-codepal-component-id":"src-pages-project-codeviewer-editortoolbar-tsx:editortoolbar","data-codepal-source-node-id":"src-pages-project-codeviewer-editortoolbar-tsx:editortoolbar:div:185:13","data-codepal-source-file":"src/pages/Project/CodeViewer/EditorToolbar.tsx","data-codepal-source-line":"185","data-codepal-source-column":"13","data-codepal-source-symbol":"EditorToolbar",className:"flex items-center space-x-3 overflow-hidden",children:[h.jsx(Zy,{filePath:e,isDarkMode:p,onNavigate:o}),n&&h.jsx("div",{"data-codepal-ve-id":"src-pages-project-codeviewer-editortoolbar-tsx:editortoolbar:div:201:21","data-codepal-binding-id":"src-pages-project-codeviewer-editortoolbar-tsx:editortoolbar:div:201:21","data-codepal-module-id":"src-pages-project-codeviewer-editortoolbar-tsx","data-codepal-component-id":"src-pages-project-codeviewer-editortoolbar-tsx:editortoolbar","data-codepal-source-node-id":"src-pages-project-codeviewer-editortoolbar-tsx:editortoolbar:div:201:21","data-codepal-source-file":"src/pages/Project/CodeViewer/EditorToolbar.tsx","data-codepal-source-line":"201","data-codepal-source-column":"21","data-codepal-source-symbol":"EditorToolbar",className:"flex items-center gap-2",children:l&&h.jsx("button",{"data-codepal-ve-id":"src-pages-project-codeviewer-editortoolbar-tsx:editortoolbar:button:203:29","data-codepal-binding-id":"src-pages-project-codeviewer-editortoolbar-tsx:editortoolbar:button:203:29","data-codepal-module-id":"src-pages-project-codeviewer-editortoolbar-tsx","data-codepal-component-id":"src-pages-project-codeviewer-editortoolbar-tsx:editortoolbar","data-codepal-source-node-id":"src-pages-project-codeviewer-editortoolbar-tsx:editortoolbar:button:203:29","data-codepal-source-file":"src/pages/Project/CodeViewer/EditorToolbar.tsx","data-codepal-source-line":"203","data-codepal-source-column":"29","data-codepal-source-symbol":"EditorToolbar",className:ie(B),onClick:l,"aria-label":c?"Edit Mode":"Preview Mode",title:c?"Editor Mode":"Preview Mode",children:c?h.jsxs(h.Fragment,{children:[h.jsx(Wd,{size:16}),h.jsx("span",{"data-codepal-ve-id":"src-pages-project-codeviewer-editortoolbar-tsx:editortoolbar:span:212:41","data-codepal-binding-id":"src-pages-project-codeviewer-editortoolbar-tsx:editortoolbar:span:212:41","data-codepal-module-id":"src-pages-project-codeviewer-editortoolbar-tsx","data-codepal-component-id":"src-pages-project-codeviewer-editortoolbar-tsx:editortoolbar","data-codepal-source-node-id":"src-pages-project-codeviewer-editortoolbar-tsx:editortoolbar:span:212:41","data-codepal-source-file":"src/pages/Project/CodeViewer/EditorToolbar.tsx","data-codepal-source-line":"212","data-codepal-source-column":"41","data-codepal-source-symbol":"EditorToolbar",children:"Editor"})]}):h.jsxs(h.Fragment,{children:[h.jsx(gm,{size:16}),h.jsx("span",{"data-codepal-ve-id":"src-pages-project-codeviewer-editortoolbar-tsx:editortoolbar:span:217:41","data-codepal-binding-id":"src-pages-project-codeviewer-editortoolbar-tsx:editortoolbar:span:217:41","data-codepal-module-id":"src-pages-project-codeviewer-editortoolbar-tsx","data-codepal-component-id":"src-pages-project-codeviewer-editortoolbar-tsx:editortoolbar","data-codepal-source-node-id":"src-pages-project-codeviewer-editortoolbar-tsx:editortoolbar:span:217:41","data-codepal-source-file":"src/pages/Project/CodeViewer/EditorToolbar.tsx","data-codepal-source-line":"217","data-codepal-source-column":"41","data-codepal-source-symbol":"EditorToolbar",children:"Preview"})]})})}),t&&h.jsxs("span",{"data-codepal-ve-id":"src-pages-project-codeviewer-editortoolbar-tsx:editortoolbar:span:227:21","data-codepal-binding-id":"src-pages-project-codeviewer-editortoolbar-tsx:editortoolbar:span:227:21","data-codepal-module-id":"src-pages-project-codeviewer-editortoolbar-tsx","data-codepal-component-id":"src-pages-project-codeviewer-editortoolbar-tsx:editortoolbar","data-codepal-source-node
243-id":"src-pages-project-codeviewer-editortoolbar-tsx:editortoolbar:span:227:21","data-codepal-source-file":"src/pages/Project/CodeViewer/EditorToolbar.tsx","data-codepal-source-line":"227","data-codepal-source-column":"21","data-codepal-source-symbol":"EditorToolbar",className:`text-xs px-2 py-1 rounded flex items-center gap-1 ${x?"bg-blue-100 text-blue-700 dark:bg-blue-900/30 dark:text-blue-300":y?"bg-amber-100 text-amber-700 dark:bg-amber-900/30 dark:text-amber-300":"bg-gray-100 text-gray-700 dark:bg-gray-700 dark:text-gray-300"}`,children:[h.jsx(ap,{size:12}),h.jsx("span",{"data-codepal-ve-id":"src-pages-project-codeviewer-editortoolbar-tsx:editortoolbar:span:237:25","data-codepal-binding-id":"src-pages-project-codeviewer-editortoolbar-tsx:editortoolbar:span:237:25","data-codepal-module-id":"src-pages-project-codeviewer-editortoolbar-tsx","data-codepal-component-id":"src-pages-project-codeviewer-editortoolbar-tsx:editortoolbar","data-codepal-source-node-id":"src-pages-project-codeviewer-editortoolbar-tsx:editortoolbar:span:237:25","data-codepal-source-file":"src/pages/Project/CodeViewer/EditorToolbar.tsx","data-codepal-source-line":"237","data-codepal-source-column":"25","data-codepal-source-symbol":"EditorToolbar",children:x?"Saving...":"Read-only"})]}),y&&h.jsxs("span",{"data-codepal-ve-id":"src-pages-project-codeviewer-editortoolbar-tsx:editortoolbar:span:247:21","data-codepal-binding-id":"src-pages-project-codeviewer-editortoolbar-tsx:editortoolbar:span:247:21","data-codepal-module-id":"src-pages-project-codeviewer-editortoolbar-tsx","data-codepal-component-id":"src-pages-project-codeviewer-editortoolbar-tsx:editortoolbar","data-codepal-source-node-id":"src-pages-project-codeviewer-editortoolbar-tsx:editortoolbar:span:247:21","data-codepal-source-file":"src/pages/Project/CodeViewer/EditorToolbar.tsx","data-codepal-source-line":"247","data-codepal-source-column":"21","data-codepal-source-symbol":"EditorToolbar",className:"text-xs px-2 py-1 rounded-md flex items-center gap-1 bg-blue-100 text-blue-700 dark:bg-blue-900/30 dark:text-blue-300",title:"Free tier uses a basic model with limited capabilities",children:[h.jsx(xm,{size:12}),h.jsxs("span",{"data-codepal-ve-id":"src-pages-project-codeviewer-editortoolbar-tsx:editortoolbar:span:252:25","data-codepal-binding-id":"src-pages-project-codeviewer-editortoolbar-tsx:editortoolbar:span:252:25","data-codepal-module-id":"src-pages-project-codeviewer-editortoolbar-tsx","data-codepal-component-id":"src-pages-project-codeviewer-editortoolbar-tsx:editortoolbar","data-codepal-source-node-id":"src-pages-project-codeviewer-editortoolbar-tsx:editortoolbar:span:252:25","data-codepal-source-file":"src/pages/Project/CodeViewer/EditorToolbar.tsx","data-codepal-source-line":"252","data-codepal-source-column":"25","data-codepal-source-symbol":"EditorToolbar",children:["Code Editing is Disabled ·",h.jsx("a",{"data-codepal-ve-id":"src-pages-project-codeviewer-editortoolbar-tsx:editortoolbar:a:253:29","data-codepal-binding-id":"src-pages-project-codeviewer-editortoolbar-tsx:editortoolbar:a:253:29","data-codepal-module-id":"src-pages-project-codeviewer-editortoolbar-tsx","data-codepal-component-id":"src-pages-project-codeviewer-editortoolbar-tsx:editortoolbar","data-codepal-source-node-id":"src-pages-project-codeviewer-editortoolbar-tsx:editortoolbar:a:253:29","data-codepal-source-file":"src/pages/Project/CodeViewer/EditorToolbar.tsx","data-codepal-source-line":"253","data-codepal-source-column":"29","data-codepal-source-symbol":"EditorToolbar",target:"_blank",href:"/pricing",className:"underline text-blue-600 dark:text-blue-400 hover:opacity-80 ml-1",children:"Upgrade"})]})]})]}),h.jsxs("div",{"data-codepal-ve-id":"src-pages-project-codeviewer-editortoolbar-tsx:editortoolbar:div:262:13","data-codepal-binding-id":"src-pages-project-codeviewer-editortoolbar-tsx:editortoolbar:div:262:13","data-codepal-module-id":"src-pages-project-codeviewer-editortoolbar-tsx","data-codepal-component-id":"src-pages-project-codeviewer-editortoolbar-tsx:editortoolbar","data-codepal-source-node-id":"src-pages-project-codeviewer-editortoolbar-tsx:editortoolbar:div:262:13","data-codepal-source-file":"src/pages/Project/CodeViewer/EditorToolbar.tsx","data-codepal-source-line":"262","data-codepal-source-column":"13","data-codepal-source-symbol":"EditorToolbar",className:"flex items-center space-x-2",children:[h.jsx("button",{"data-codepal-ve-id":"src-pages-project-codeviewer-editortoolbar-tsx:editortoolbar:button:264:17","data-codepal-binding-id":"src-pages-project-codeviewer-editortoolbar-tsx:editortoolbar:button:264:17","data-codepal-module-id":"src-pages-project-codeviewer-editortoolbar-tsx","data-codepal-component-id":"src-pages-project-codeviewer-editortoolbar-tsx:editortoolbar","data-codepal-source-node
243-id":"src-pages-project-codeviewer-editortoolbar-tsx:editortoolbar:button:264:17","data-codepal-source-file":"src/pages/Project/CodeViewer/EditorToolbar.tsx","data-codepal-source-line":"264","data-codepal-source-column":"17","data-codepal-source-symbol":"EditorToolbar",className:ie(L,`${p?`${S()?"bg-gray-700 text-gray-300":"text-gray-300"}`:`${S()?"bg-gray-200 text-gray-600":"text-gray-600"}`}`),onClick:N,"aria-label":"Search in code",title:"Search in code",disabled:!a||c,"aria-pressed":S(),children:h.jsx(om,{size:18})}),h.jsx("button",{"data-codepal-ve-id":"src-pages-project-codeviewer-editortoolbar-tsx:editortoolbar:button:282:17","data-codepal-binding-id":"src-pages-project-codeviewer-editortoolbar-tsx:editortoolbar:button:282:17","data-codepal-module-id":"src-pages-project-codeviewer-editortoolbar-tsx","data-codepal-component-id":"src-pages-project-codeviewer-editortoolbar-tsx:editortoolbar","data-codepal-source-node-id":"src-pages-project-codeviewer-editortoolbar-tsx:editortoolbar:button:282:17","data-codepal-source-file":"src/pages/Project/CodeViewer/EditorToolbar.tsx","data-codepal-source-line":"282","data-codepal-source-column":"17","data-codepal-source-symbol":"EditorToolbar",className:L,onClick:k,"aria-label":u?"Copied!":"Copy code",title:u?"Copied!":"Copy code",disabled:s||!a&&!c,children:u?h.jsx(En,{size:18,className:"text-green-500"}):h.jsx(Pn,{size:18})}),g&&!x&&!y&&h.jsxs(h.Fragment,{children:[h.jsx("div",{"data-codepal-ve-id":"src-pages-project-codeviewer-editortoolbar-tsx:editortoolbar:div:299:25","data-codepal-binding-id":"src-pages-project-codeviewer-editortoolbar-tsx:editortoolbar:div:299:25","data-codepal-module-id":"src-pages-project-codeviewer-editortoolbar-tsx","data-codepal-component-id":"src-pages-project-codeviewer-editortoolbar-tsx:editortoolbar","data-codepal-source-node-id":"src-pages-project-codeviewer-editortoolbar-tsx:editortoolbar:div:299:25","data-codepal-source-file":"src/pages/Project/CodeViewer/EditorToolbar.tsx","data-codepal-source-line":"299","data-codepal-source-column":"25","data-codepal-source-symbol":"EditorToolbar",className:"h-5 w-px bg-gray-300 dark:bg-gray-600 mx-1"}),h.jsxs("button",{"data-codepal-ve-id":"src-pages-project-codeviewer-editortoolbar-tsx:editortoolbar:button:301:25","data-codepal-binding-id":"src-pages-project-codeviewer-editortoolbar-tsx:editortoolbar:button:301:25","data-codepal-module-id":"src-pages-project-codeviewer-editortoolbar-tsx","data-codepal-component-id":"src-pages-project-codeviewer-editortoolbar-tsx:editortoolbar","data-codepal-source-node-id":"src-pages-project-codeviewer-editortoolbar-tsx:editortoolbar:button:301:25","data-codepal-source-file":"src/pages/Project/CodeViewer/EditorToolbar.tsx","data-codepal-source-line":"301","data-codepal-source-column":"25","data-codepal-source-symbol":"EditorToolbar",className:ie(M,"text-green-600 dark:text-green-400 hover:text-green-700 dark:hover:text-green-300"),onClick:r,"aria-label":"Save changes",title:"Save changes",disabled:s,children:[h.jsx(Pm,{size:16}),h.jsx("span",{"data-codepal-ve-id":"src-pages-project-codeviewer-editortoolbar-tsx:editortoolbar:span:312:29","data-codepal-binding-id":"src-pages-project-codeviewer-editortoolbar-tsx:editortoolbar:span:312:29","data-codepal-module-id":"src-pages-project-codeviewer-editortoolbar-tsx","data-codepal-component-id":"src-pages-project-codeviewer-editortoolbar-tsx:editortoolbar","data-codepal-source-node-id":"src-pages-project-codeviewer-editortoolbar-tsx:editortoolbar:span:312:29","data-codepal-source-file":"src/pages/Project/CodeViewer/EditorToolbar.tsx","data-codepal-source-line":"312","data-codepal-source-column":"29","data-codepal-source-symbol":"EditorToolbar",children:"Save"})]}),h.jsxs("button",{"data-codepal-ve-id":"src-pages-project-codeviewer-editortoolbar-tsx:editortoolbar:button:315:25","data-codepal-binding-id":"src-pages-project-codeviewer-editortoolbar-tsx:editortoolbar:button:315:25","data-codepal-module-id":"src-pages-project-codeviewer-editortoolbar-tsx","data-codepal-component-id":"src-pages-project-codeviewer-editortoolbar-tsx:editortoolbar","data-codepal-source-node
243-id":"src-pages-project-codeviewer-editortoolbar-tsx:editortoolbar:button:315:25","data-codepal-source-file":"src/pages/Project/CodeViewer/EditorToolbar.tsx","data-codepal-source-line":"315","data-codepal-source-column":"25","data-codepal-source-symbol":"EditorToolbar",className:ie(M,"text-amber-600 dark:text-amber-400 hover:text-amber-700 dark:hover:text-amber-300"),onClick:A,"aria-label":"Reset changes",title:"Reset all edited files",disabled:s,children:[h.jsx(Gf,{size:16}),h.jsx("span",{"data-codepal-ve-id":"src-pages-project-codeviewer-editortoolbar-tsx:editortoolbar:span:326:29","data-codepal-binding-id":"src-pages-project-codeviewer-editortoolbar-tsx:editortoolbar:span:326:29","data-codepal-module-id":"src-pages-project-codeviewer-editortoolbar-tsx","data-codepal-component-id":"src-pages-project-codeviewer-editortoolbar-tsx:editortoolbar","data-codepal-source-node-id":"src-pages-project-codeviewer-editortoolbar-tsx:editortoolbar:span:326:29","data-codepal-source-file":"src/pages/Project/CodeViewer/EditorToolbar.tsx","data-codepal-source-line":"326","data-codepal-source-column":"29","data-codepal-source-symbol":"EditorToolbar",children:"Reset"})]})]})]})]})},e1=()=>{const[a,e]=E.useState({width:typeof window<"u"?window.innerWidth:0,height:typeof window<"u"?window.innerHeight:0});return E.useEffect(()=>{if(typeof window>"u")return;const t=()=>{e({width:window.innerWidth,height:window.innerHeight})};return window.addEventListener("resize",t),t(),()=>window.removeEventListener("resize",t)},[]),a},t1=({fileName:a,isEditing:e=!1,cursorPosition:t={line:1,column:1},selectionLength:s=0,indentSize:o=2,lineCount:r=0,language:i=""})=>{const n=uo(p=>p.isDarkMode()),c=e1(),l=a?a.split(".").pop():"",d=i||(l||"").toUpperCase()||"Text";return h.jsxs("div",{"data-codepal-ve-id":"src-pages-project-codeviewer-codeeditorstatusbar-tsx:codeeditorstatusbar:div:35:9","data-codepal-binding-id":"src-pages-project-codeviewer-codeeditorstatusbar-tsx:codeeditorstatusbar:div:35:9","data-codepal-module-id":"src-pages-project-codeviewer-codeeditorstatusbar-tsx","data-codepal-component-id":"src-pages-project-codeviewer-codeeditorstatusbar-tsx:codeeditorstatusbar","data-codepal-source-node-id":"src-pages-project-codeviewer-codeeditorstatusbar-tsx:codeeditorstatusbar:div:35:9","data-codepal-source-file":"src/pages/Project/CodeViewer/CodeEditorStatusBar.tsx","data-codepal-source-line":"35","data-codepal-source-column":"9","data-codepal-source-symbol":"CodeEditorStatusBar",className:`flex items-center h-6 px-2 text-xs border-t ${n?"bg-gray-800 text-gray-400 border-gray-700":"bg-gray-100 text-gray-600 border-gray-200"} transition-colors duration-200`,children:[h.jsxs("div",{"data-codepal-ve-id":"src-pages-project-codeviewer-codeeditorstatusbar-tsx:codeeditorstatusbar:div:42:13","data-codepal-binding-id":"src-pages-project-codeviewer-codeeditorstatusbar-tsx:codeeditorstatusbar:div:42:13","data-codepal-module-id":"src-pages-project-codeviewer-codeeditorstatusbar-tsx","data-codepal-component-id":"src-pages-project-codeviewer-codeeditorstatusbar-tsx:codeeditorstatusbar","data-codepal-source-node-id":"src-pages-project-codeviewer-codeeditorstatusbar-tsx:codeeditorstatusbar:div:42:13","data-codepal-source-file":"src/pages/Project/CodeViewer/CodeEditorStatusBar.tsx","data-codepal-source-line":"42","data-codepal-source-column":"13","data-codepal-source-symbol":"CodeEditorStatusBar",className:"flex items-center",children:[e?h.jsxs("span",{"data-codepal-ve-id":"src-pages-project-codeviewer-codeeditorstatusbar-tsx:codeeditorstatusbar:span:44:21","data-codepal-binding-id":"src-pages-project-codeviewer-codeeditorstatusbar-tsx:codeeditorstatusbar:span:44:21","data-codepal-module-id":"src-pages-project-codeviewer-codeeditorstatusbar-tsx","data-codepal-component-id":"src-pages-project-codeviewer-codeeditorstatusbar-tsx:codeeditorstatusbar","data-codepal-source-node-id":"src-pages-project-codeviewer-codeeditorstatusbar-tsx:codeeditorstatusbar:span:44:21","data-codepal-source-file":"src/pages/Project/CodeViewer/CodeEditorStatusBar.tsx","data-codepal-source-line":"44","data-codepal-source-column":"21","data-codepal-source-symbol":"CodeEditorStatusBar",className:"flex items-center text-yellow-500 mr-3",children:[h.jsx(im,{size:12,className:"mr-1"}),h.jsx("span",{"data-codepal-ve-id":"src-pages-project-codeviewer-codeeditorstatusbar-tsx:codeeditorstatusbar:span:46:13","data-codepal-binding-id":"src-pages-project-codeviewer-codeeditorstatusbar-tsx:codeeditorstatusbar:span:46:13","data-codepal-module-id":"src-pages-project-codeviewer-codeeditorstatusbar-tsx","data-codepal-component-id":"src-pages-project-codeviewer-codeeditorstatusbar-tsx:codeeditorstatusbar","data-codepal-source-node
243-id":"src-pages-project-codeviewer-codeeditorstatusbar-tsx:codeeditorstatusbar:span:46:13","data-codepal-source-file":"src/pages/Project/CodeViewer/CodeEditorStatusBar.tsx","data-codepal-source-line":"46","data-codepal-source-column":"13","data-codepal-source-symbol":"CodeEditorStatusBar",children:"EDITING"})]}):null,h.jsxs("span",{"data-codepal-ve-id":"src-pages-project-codeviewer-codeeditorstatusbar-tsx:codeeditorstatusbar:span:50:17","data-codepal-binding-id":"src-pages-project-codeviewer-codeeditorstatusbar-tsx:codeeditorstatusbar:span:50:17","data-codepal-module-id":"src-pages-project-codeviewer-codeeditorstatusbar-tsx","data-codepal-component-id":"src-pages-project-codeviewer-codeeditorstatusbar-tsx:codeeditorstatusbar","data-codepal-source-node-id":"src-pages-project-codeviewer-codeeditorstatusbar-tsx:codeeditorstatusbar:span:50:17","data-codepal-source-file":"src/pages/Project/CodeViewer/CodeEditorStatusBar.tsx","data-codepal-source-line":"50","data-codepal-source-column":"17","data-codepal-source-symbol":"CodeEditorStatusBar",className:"mr-3",children:["Ln ",t.line,", Col ",t.column]}),s>0&&h.jsxs("span",{"data-codepal-ve-id":"src-pages-project-codeviewer-codeeditorstatusbar-tsx:codeeditorstatusbar:span:55:21","data-codepal-binding-id":"src-pages-project-codeviewer-codeeditorstatusbar-tsx:codeeditorstatusbar:span:55:21","data-codepal-module-id":"src-pages-project-codeviewer-codeeditorstatusbar-tsx","data-codepal-component-id":"src-pages-project-codeviewer-codeeditorstatusbar-tsx:codeeditorstatusbar","data-codepal-source-node-id":"src-pages-project-codeviewer-codeeditorstatusbar-tsx:codeeditorstatusbar:span:55:21","data-codepal-source-file":"src/pages/Project/CodeViewer/CodeEditorStatusBar.tsx","data-codepal-source-line":"55","data-codepal-source-column":"21","data-codepal-source-symbol":"CodeEditorStatusBar",className:"mr-3",children:[s," selected"]}),h.jsxs("span",{"data-codepal-ve-id":"src-pages-project-codeviewer-codeeditorstatusbar-tsx:codeeditorstatusbar:span:60:17","data-codepal-binding-id":"src-pages-project-codeviewer-codeeditorstatusbar-tsx:codeeditorstatusbar:span:60:17","data-codepal-module-id":"src-pages-project-codeviewer-codeeditorstatusbar-tsx","data-codepal-component-id":"src-pages-project-codeviewer-codeeditorstatusbar-tsx:codeeditorstatusbar","data-codepal-source-node-id":"src-pages-project-codeviewer-codeeditorstatusbar-tsx:codeeditorstatusbar:span:60:17","data-codepal-source-file":"src/pages/Project/CodeViewer/CodeEditorStatusBar.tsx","data-codepal-source-line":"60","data-codepal-source-column":"17","data-codepal-source-symbol":"CodeEditorStatusBar",className:"mr-3",children:["Spaces: ",o
243]}),r>0&&c.width>640&&h.jsxs("span",{"data-codepal-ve-id":"src-pages-project-codeviewer-codeeditorstatusbar-tsx:codeeditorstatusbar:span:65:21","data-codepal-binding-id":"src-pages-project-codeviewer-codeeditorstatusbar-tsx:codeeditorstatusbar:span:65:21","data-codepal-module-id":"src-pages-project-codeviewer-codeeditorstatusbar-tsx","data-codepal-component-id":"src-pages-project-codeviewer-codeeditorstatusbar-tsx:codeeditorstatusbar","data-codepal-source-node-id":"src-pages-project-codeviewer-codeeditorstatusbar-tsx:codeeditorstatusbar:span:65:21","data-codepal-source-file":"src/pages/Project/CodeViewer/CodeEditorStatusBar.tsx","data-codepal-source-line":"65","data-codepal-source-column":"21","data-codepal-source-symbol":"CodeEditorStatusBar",className:"mr-3",children:[r," lines"]})]}),h.jsx("div",{"data-codepal-ve-id":"src-pages-project-codeviewer-codeeditorstatusbar-tsx:codeeditorstatusbar:div:71:13","data-codepal-binding-id":"src-pages-project-codeviewer-codeeditorstatusbar-tsx:codeeditorstatusbar:div:71:13","data-codepal-module-id":"src-pages-project-codeviewer-codeeditorstatusbar-tsx","data-codepal-component-id":"src-pages-project-codeviewer-codeeditorstatusbar-tsx:codeeditorstatusbar","data-codepal-source-node-id":"src-pages-project-codeviewer-codeeditorstatusbar-tsx:codeeditorstatusbar:div:71:13","data-codepal-source-file":"src/pages/Project/CodeViewer/CodeEditorStatusBar.tsx","data-codepal-source-line":"71","data-codepal-source-column":"13","data-codepal-source-symbol":"CodeEditorStatusBar",className:"flex-1"}),h.jsx("div",{"data-codepal-ve-id":"src-pages-project-codeviewer-codeeditorstatusbar-tsx:codeeditorstatusbar:div:73:13","data-codepal-binding-id":"src-pages-project-codeviewer-codeeditorstatusbar-tsx:codeeditorstatusbar:div:73:13","data-codepal-module-id":"src-pages-project-codeviewer-codeeditorstatusbar-tsx","data-codepal-component-id":"src-pages-project-codeviewer-codeeditorstatusbar-tsx:codeeditorstatusbar","data-codepal-source-node-id":"src-pages-project-codeviewer-codeeditorstatusbar-tsx:codeeditorstatusbar:div:73:13","data-codepal-source-file":"src/pages/Project/CodeViewer/CodeEditorStatusBar.tsx","data-codepal-source-line":"73","data-codepal-source-column":"13","data-codepal-source-symbol":"CodeEditorStatusBar",className:"flex items-center",children:h.jsx("span",{"data-codepal-ve-id":"src-pages-project-codeviewer-codeeditorstatusbar-tsx:codeeditorstatusbar:span:74:9","data-codepal-binding-id":"src-pages-project-codeviewer-codeeditorstatusbar-tsx:codeeditorstatusbar:span:74:9","data-codepal-module-id":"src-pages-project-codeviewer-codeeditorstatusbar-tsx","data-codepal-component-id":"src-pages-project-codeviewer-codeeditorstatusbar-tsx:codeeditorstatusbar","data-codepal-source-node-id":"src-pages-project-codeviewer-codeeditorstatusbar-tsx:codeeditorstatusbar:span:74:9","data-codepal-source-file":"src/pages/Project/CodeViewer/CodeEditorStatusBar.tsx","data-codepal-source-line":"74","data-codepal-source-column":"9","data-codepal-source-symbol":"CodeEditorStatusBar",className:"px-2 py-0.5 rounded text-xs bg-opacity-20 font-mono",children:d})})]})},Kt=new Sn({html:!0,linkify:!1,typographer:!0,highlight:(a,e)=>{if(e&&Yr.getLanguage(e))try{return Yr.highlight(a,{language:e}).value}catch(t){console.error("Highlight error:",t)}return Yr.highlightAuto(a).value}}),a1=Kt.renderer.rules.link_open||function(a,e,t,s,o){return o.renderToken(a,e,t)};Kt.renderer.rules.link_open=function(a,e,t,s,o){const r=a[e];return r.attrPush(["target","_blank"]),r.attrPush(["rel","noopener noreferrer"]),a1(a,e,t,s,o)};Kt.use(Xf);Kt.use(Jf);Kt.use(_n);const s1=E.memo(({html:a,isDarkMode:e})=>{const[,t]=E.useState({}),s=E.useRef(!1);return E.useEffect(()=>{if(!a||s.current)return;const o=async r=>{const n=r.target.closest(".copy-button");if(!n)return;const c=Ci(n.getAttribute("data-code")||""),l=n.querySelector(".copy-icon"),d=n.querySelector(".check-icon");try{await navigator.clipboard.writeText(c),l&&d&&(l.classList.add("hidden"),d.classList.remove("hidden"),setTimeout(()=>{l.classList.remove("hidden"),d.classList.add("hidden")},2e3))}catch(p){console.error("Failed to copy:",p)}};return setTimeout(()=>{document.querySelectorAll(".markdown-body .copy-button").forEach(r=>{r.addEventListener("click",o)}),document.querySelectorAll(".markdown-body img").forEach(r=>{const i=r;i.loading="lazy",i.onerror=()=>{i.alt="Image failed to load",i.style.border="1px dashed #ccc",i.style.padding="10px",i.style.backgroundColor="#f8f8f8"}}),s.current=!0},0),()=>{document.querySelectorAll(".markdown-body .copy-button").forEach(r=>{r.removeEventListener("click",o)}),s.current=!1}},[a]),h.jsx("div",{"data-codepal-ve-id":"src-pages-project-codeviewer-markdownpreview-tsx:markdowncontent:div:122:9","data-codepal-binding-id":"src-pages-project-codeviewer-markdownpreview-tsx:markdowncontent:div:122:9","data-codepal-module-id":"src-pages-project-codeviewer-markdownpreview-tsx","data-codepal-component-id":"src-pages-project-codeviewer-markdownpreview-tsx:markdowncontent","data-codepal-source-node
243-id":"src-pages-project-codeviewer-markdownpreview-tsx:markdowncontent:div:122:9","data-codepal-source-file":"src/pages/Project/CodeViewer/MarkdownPreview.tsx","data-codepal-source-line":"122","data-codepal-source-column":"9","data-codepal-source-symbol":"MarkdownContent",className:`markdown-preview h-full ${e?"dark":"light"}`,children:h.jsx("div",{"data-codepal-ve-id":"src-pages-project-codeviewer-markdownpreview-tsx:markdowncontent:div:123:13","data-codepal-binding-id":"src-pages-project-codeviewer-markdownpreview-tsx:markdowncontent:div:123:13","data-codepal-module-id":"src-pages-project-codeviewer-markdownpreview-tsx","data-codepal-component-id":"src-pages-project-codeviewer-markdownpreview-tsx:markdowncontent","data-codepal-source-node-id":"src-pages-project-codeviewer-markdownpreview-tsx:markdowncontent:div:123:13","data-codepal-source-file":"src/pages/Project/CodeViewer/MarkdownPreview.tsx","data-codepal-source-line":"123","data-codepal-source-column":"13","data-codepal-source-symbol":"MarkdownContent",className:"markdown-body code-viewer-markdown h-full",dangerouslySetInnerHTML:{__html:a}})})},(a,e)=>a.html===e.html&&a.isDarkMode===e.isDarkMode),o1=E.memo(({content:a})=>{const[e,t]=E.useState(""),s=uo(r=>r.isDarkMode()),o=E.useRef(a);return E.useEffect(()=>{He.log("MarkdownPreview content changed, length:",a?.length||0),o.current=a;const r=a||"",i={ADD_ATTR:["target"]},n=Kt.renderer.rules.fence;Kt.renderer.rules.fence=(d,p,u,f,m)=>{const g=d[p],x=g.content.trim(),b=g.info||"",y=n?.(d,p,u,f,m)||"";return` 244 <div class="code-block-wrapper relative group"> 245 <div class="code-language-label">${b}</div> 246 <div class="code-block-buttons opacity-0 group-hover:opacity-100 absolute right-2 top-2 transition-opacity"> 247 <button class="copy-button" data-code="${encodeURIComponent(x)}" data-index="${p}"> 248 <span class="copy-icon"> 249 <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="copy"><rect width="14" height="14" x="8" y="8" rx="2" ry="2"/><path d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"/></svg> 250 </span> 251 <span class="check-icon hidden"> 252 <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="check"><polyline points="20 6 9 17 4 12"/></svg> 253 </span> 254 </button> 255 </div> 256 ${y} 257 </div> 258 `};const c=Kt.render(r),l=Hd.sanitize(c,i);t(l),Kt.renderer.rules.fence=n},[a]),h.jsx(s1,{html:e,isDarkMode:s})},(a,e)=>a.content===e.content&&a.content!==""),of=E.memo(({content:a,filePath:e,fileExtension:t})=>{const s=()=>{const o=t.toLowerCase();if(o==="svg"){if(a.startsWith("data:"))return h.jsx("div",{"data-codepal-ve-id":"src-pages-project-codeviewer-mediapreview-tsx:rendermedia:div:18:21","data-codepal-binding-id":"src-pages-project-codeviewer-mediapreview-tsx:rendermedia:div:18:21","data-codepal-module-id":"src-pages-project-codeviewer-mediapreview-tsx","data-codepal-component-id":"src-pages-project-codeviewer-mediapreview-tsx:rendermedia","data-codepal-source-node-id":"src-pages-project-codeviewer-mediapreview-tsx:rendermedia:div:18:21","data-codepal-source-file":"src/pages/Project/CodeViewer/MediaPreview.tsx","data-codepal-source-line":"18","data-codepal-source-column":"21","data-codepal-source-symbol":"renderMedia",className:"flex items-center justify-center h-full bg-gray-50 dark:bg-gray-800",children:h.jsx("img",{"data-codepal-ve-id":"src-pages-project-codeviewer-mediapreview-tsx:rendermedia:img:19:25","data-codepal-binding-id":"src-pages-project-codeviewer-mediapreview-tsx:rendermedia:img:19:25","data-codepal-module-id":"src-pages-project-codeviewer-mediapreview-tsx","data-codepal-component-id":"src-pages-project-codeviewer-mediapreview-tsx:rendermedia","data-codepal-source-node
258-id":"src-pages-project-codeviewer-mediapreview-tsx:rendermedia:img:19:25","data-codepal-source-file":"src/pages/Project/CodeViewer/MediaPreview.tsx","data-codepal-source-line":"19","data-codepal-source-column":"25","data-codepal-source-symbol":"renderMedia",src:a,alt:`SVG: ${e}`,className:"max-w-full max-h-full object-contain",style:{maxHeight:"calc(100vh - 200px)"}})});{const r=a.trim();if(r.startsWith("<svg")||r.includes("<svg"))return h.jsx("div",{"data-codepal-ve-id":"src-pages-project-codeviewer-mediapreview-tsx:rendermedia:div:32:25","data-codepal-binding-id":"src-pages-project-codeviewer-mediapreview-tsx:rendermedia:div:32:25","data-codepal-module-id":"src-pages-project-codeviewer-mediapreview-tsx","data-codepal-component-id":"src-pages-project-codeviewer-mediapreview-tsx:rendermedia","data-codepal-source-node-id":"src-pages-project-codeviewer-mediapreview-tsx:rendermedia:div:32:25","data-codepal-source-file":"src/pages/Project/CodeViewer/MediaPreview.tsx","data-codepal-source-line":"32","data-codepal-source-column":"25","data-codepal-source-symbol":"renderMedia",className:"flex items-center justify-center h-full bg-gray-50 dark:bg-gray-800",children:h.jsx("div",{"data-codepal-ve-id":"src-pages-project-codeviewer-mediapreview-tsx:rendermedia:div:33:29","data-codepal-binding-id":"src-pages-project-codeviewer-mediapreview-tsx:rendermedia:div:33:29","data-codepal-module-id":"src-pages-project-codeviewer-mediapreview-tsx","data-codepal-component-id":"src-pages-project-codeviewer-mediapreview-tsx:rendermedia","data-codepal-source-node-id":"src-pages-project-codeviewer-mediapreview-tsx:rendermedia:div:33:29","data-codepal-source-file":"src/pages/Project/CodeViewer/MediaPreview.tsx","data-codepal-source-line":"33","data-codepal-source-column":"29","data-codepal-source-symbol":"renderMedia",className:"max-w-full max-h-full",style:{maxHeight:"calc(100vh - 200px)"},dangerouslySetInnerHTML:{__html:r}})})}}if(["png","jpg","jpeg","gif","webp","bmp","ico"].includes(o)&&a.startsWith("data:")){const r=a.includes("â¦")||a.includes("...")||a.endsWith("â¦")||a.endsWith("...");return!(a.includes(",")&&a.split(",")[1].length>0)||r?(console.warn("Invalid or truncated data URL for file:",e,"Content length:",a.length,"Truncated:",r),h.jsx("div",{"data-codepal-ve-id":"src-pages-project-codeviewer-mediapreview-tsx:rendermedia:div:58:25","data-codepal-binding-id":"src-pages-project-codeviewer-mediapreview-tsx:rendermedia:div:58:25","data-codepal-module-id":"src-pages-project-codeviewer-mediapreview-tsx","data-codepal-component-id":"src-pages-project-codeviewer-mediapreview-tsx:rendermedia","data-codepal-source-node-id":"src-pages-project-codeviewer-mediapreview-tsx:rendermedia:div:58:25","data-codepal-source-file":"src/pages/Project/CodeViewer/MediaPreview.tsx","data-codepal-source-line":"58","data-codepal-source-column":"25","data-codepal-source-symbol":"renderMedia",className:"flex flex-col items-center justify-center h-full bg-gray-50 dark:bg-gray-800 text-gray-600 dark:text-gray-400",children:h.jsxs("div",{"data-codepal-ve-id":"src-pages-project-codeviewer-mediapreview-tsx:rendermedia:div:60:29","data-codepal-binding-id":"src-pages-project-codeviewer-mediapreview-tsx:rendermedia:div:60:29","data-codepal-module-id":"src-pages-project-codeviewer-mediapreview-tsx","data-codepal-component-id":"src-pages-project-codeviewer-mediapreview-tsx:rendermedia","data-codepal-source-node-id":"src-pages-project-codeviewer-mediapreview-tsx:rendermedia:div:60:29","data-codepal-source-file":"src/pages/Project/CodeViewer/MediaPreview.tsx","data-codepal-source-line":"60","data-codepal-source-column":"29","data-codepal-source-symbol":"renderMedia",className:"text-center max-w-md",children:[h.jsx("div",{"data-codepal-ve-id":"src-pages-project-codeviewer-mediapreview-tsx:rendermedia:div:61:33","data-codepal-binding-id":"src-pages-project-codeviewer-mediapreview-tsx:rendermedia:div:61:33","data-codepal-module-id":"src-pages-project-codeviewer-mediapreview-tsx","data-codepal-component-id":"src-pages-project-codeviewer-mediapreview-tsx:rendermedia","data-codepal-source-node
258-id":"src-pages-project-codeviewer-mediapreview-tsx:rendermedia:div:61:33","data-codepal-source-file":"src/pages/Project/CodeViewer/MediaPreview.tsx","data-codepal-source-line":"61","data-codepal-source-column":"33","data-codepal-source-symbol":"renderMedia",className:"text-6xl mb-4",children:"â ï¸"}),h.jsx("p",{"data-codepal-ve-id":"src-pages-project-codeviewer-mediapreview-tsx:rendermedia:p:62:33","data-codepal-binding-id":"src-pages-project-codeviewer-mediapreview-tsx:rendermedia:p:62:33","data-codepal-module-id":"src-pages-project-codeviewer-mediapreview-tsx","data-codepal-component-id":"src-pages-project-codeviewer-mediapreview-tsx:rendermedia","data-codepal-source-node-id":"src-pages-project-codeviewer-mediapreview-tsx:rendermedia:p:62:33","data-codepal-source-file":"src/pages/Project/CodeViewer/MediaPreview.tsx","data-codepal-source-line":"62","data-codepal-source-column":"33","data-codepal-source-symbol":"renderMedia",className:"text-lg font-medium",children:r?"Truncated Image Data":"Invalid Image Data"}),h.jsx("p",{"data-codepal-ve-id":"src-pages-project-codeviewer-mediapreview-tsx:rendermedia:p:65:33","data-codepal-binding-id":"src-pages-project-codeviewer-mediapreview-tsx:rendermedia:p:65:33","data-codepal-module-id":"src-pages-project-codeviewer-mediapreview-tsx","data-codepal-component-id":"src-pages-project-codeviewer-mediapreview-tsx:rendermedia","data-codepal-source-node-id":"src-pages-project-codeviewer-mediapreview-tsx:rendermedia:p:65:33","data-codepal-source-file":"src/pages/Project/CodeViewer/MediaPreview.tsx","data-codepal-source-line":"65","data-codepal-source-column":"33","data-codepal-source-symbol":"renderMedia",className:"text-sm mt-2",children:r?`The ${o.toUpperCase()} data appears to be truncated. This may happen with very large files.`:`The ${o.toUpperCase()} data appears to be invalid.`}),h.jsxs("p",{"data-codepal-ve-id":"src-pages-project-codeviewer-mediapreview-tsx:rendermedia:p:71:33","data-codepal-binding-id":"src-pages-project-codeviewer-mediapreview-tsx:rendermedia:p:71:33","data-codepal-module-id":"src-pages-project-codeviewer-mediapreview-tsx","data-codepal-component-id":"src-pages-project-codeviewer-mediapreview-tsx:rendermedia","data-codepal-source-node-id":"src-pages-project-codeviewer-mediapreview-tsx:rendermedia:p:71:33","data-codepal-source-file":"src/pages/Project/CodeViewer/MediaPreview.tsx","data-codepal-source-line":"71","data-codepal-source-column":"33","data-codepal-source-symbol":"renderMedia",className:"text-xs mt-3 text-gray-500",children:["Content length: ",a.length," characters"]}),h.jsx("p",{"data-codepal-ve-id":"src-pages-project-codeviewer-mediapreview-tsx:rendermedia:p:74:33","data-codepal-binding-id":"src-pages-project-codeviewer-mediapreview-tsx:rendermedia:p:74:33","data-codepal-module-id":"src-pages-project-codeviewer-mediapreview-tsx","data-codepal-component-id":"src-pages-project-codeviewer-mediapreview-tsx:rendermedia","data-codepal-source-node-id":"src-pages-project-codeviewer-mediapreview-tsx:rendermedia:p:74:33","data-codepal-source-file":"src/pages/Project/CodeViewer/MediaPreview.tsx","data-codepal-source-line":"74","data-codepal-source-column":"33","data-codepal-source-symbol":"renderMedia",className:"text-xs mt-2 text-blue-600 dark:text-blue-400",children:"Tip: Try switching to editor mode to view the raw data"})]})})):h.jsx("div",{"data-codepal-ve-id":"src-pages-project-codeviewer-mediapreview-tsx:rendermedia:div:83:21","data-codepal-binding-id":"src-pages-project-codeviewer-mediapreview-tsx:rendermedia:div:83:21","data-codepal-module-id":"src-pages-project-codeviewer-mediapreview-tsx","data-codepal-component-id":"src-pages-project-codeviewer-mediapreview-tsx:rendermedia","data-codepal-source-node-id":"src-pages-project-codeviewer-mediapreview-tsx:rendermedia:div:83:21","data-codepal-source-file":"src/pages/Project/CodeViewer/MediaPreview.tsx","data-codepal-source-line":"83","data-codepal-source-column":"21","data-codepal-source-symbol":"renderMedia",className:"flex items-center justify-center h-full bg-gray-50 dark:bg-gray-800",children:h.jsx("img",{"data-codepal-ve-id":"src-pages-project-codeviewer-mediapreview-tsx:rendermedia:img:84:25","data-codepal-binding-id":"src-pages-project-codeviewer-mediapreview-tsx:rendermedia:img:84:25","data-codepal-module-id":"src-pages-project-codeviewer-mediapreview-tsx","data-codepal-component-id":"src-pages-project-codeviewer-mediapreview-tsx:rendermedia","data-codepal-source-node
258-id":"src-pages-project-codeviewer-mediapreview-tsx:rendermedia:img:84:25","data-codepal-source-file":"src/pages/Project/CodeViewer/MediaPreview.tsx","data-codepal-source-line":"84","data-codepal-source-column":"25","data-codepal-source-symbol":"renderMedia",src:a,alt:`Image: ${e}`,className:"max-w-full max-h-full object-contain",onError:n=>{console.warn("Image load error for:",e,"Data URL length:",a.length);const c=n.target;c.style.display="none";const l=c.parentElement;l&&(l.innerHTML=` 259 <div class="text-center text-gray-600 dark:text-gray-400"> 260 <div style="font-size: 3rem; margin-bottom: 1rem;">â ï¸</div> 261 <p style="font-size: 1.125rem; font-weight: 500;">Failed to Load ${o.toUpperCase()}</p> 262 <p style="font-size: 0.875rem; margin-top: 0.5rem;">The image data may be corrupted or too large.</p> 263 </div> 264 `)}})})}if(["mp3","wav","ogg","aac","flac"].includes(o)&&a.startsWith("data:"))return h.jsx("div",{"data-codepal-ve-id":"src-pages-project-codeviewer-mediapreview-tsx:rendermedia:div:115:21","data-codepal-binding-id":"src-pages-project-codeviewer-mediapreview-tsx:rendermedia:div:115:21","data-codepal-module-id":"src-pages-project-codeviewer-mediapreview-tsx","data-codepal-component-id":"src-pages-project-codeviewer-mediapreview-tsx:rendermedia","data-codepal-source-node-id":"src-pages-project-codeviewer-mediapreview-tsx:rendermedia:div:115:21","data-codepal-source-file":"src/pages/Project/CodeViewer/MediaPreview.tsx","data-codepal-source-line":"115","data-codepal-source-column":"21","data-codepal-source-symbol":"renderMedia",className:"flex items-center justify-center h-full bg-gray-50 dark:bg-gray-800",children:h.jsxs("audio",{"data-codepal-ve-id":"src-pages-project-codeviewer-mediapreview-tsx:rendermedia:audio:116:25","data-codepal-binding-id":"src-pages-project-codeviewer-mediapreview-tsx:rendermedia:audio:116:25","data-codepal-module-id":"src-pages-project-codeviewer-mediapreview-tsx","data-codepal-component-id":"src-pages-project-codeviewer-mediapreview-tsx:rendermedia","data-codepal-source-node-id":"src-pages-project-codeviewer-mediapreview-tsx:rendermedia:audio:116:25","data-codepal-source-file":"src/pages/Project/CodeViewer/MediaPreview.tsx","data-codepal-source-line":"116","data-codepal-source-column":"25","data-codepal-source-symbol":"renderMedia",controls:!0,className:"max-w-full",children:[h.jsx("source",{"data-codepal-ve-id":"src-pages-project-codeviewer-mediapreview-tsx:rendermedia:source:117:29","data-codepal-binding-id":"src-pages-project-codeviewer-mediapreview-tsx:rendermedia:source:117:29","data-codepal-module-id":"src-pages-project-codeviewer-mediapreview-tsx","data-codepal-component-id":"src-pages-project-codeviewer-mediapreview-tsx:rendermedia","data-codepal-source-node-id":"src-pages-project-codeviewer-mediapreview-tsx:rendermedia:source:117:29","data-codepal-source-file":"src/pages/Project/CodeViewer/MediaPreview.tsx","data-codepal-source-line":"117","data-codepal-source-column":"29","data-codepal-source-symbol":"renderMedia",src:a}),"Your browser does not support the audio element."]})});if(["mp4","webm","ogg","avi","mov"].includes(o)&&a.startsWith("data:"))return h.jsx("div",{"data-codepal-ve-id":"src-pages-project-codeviewer-mediapreview-tsx:rendermedia:div:129:21","data-codepal-binding-id":"src-pages-project-codeviewer-mediapreview-tsx:rendermedia:div:129:21","data-codepal-module-id":"src-pages-project-codeviewer-mediapreview-tsx","data-codepal-component-id":"src-pages-project-codeviewer-mediapreview-tsx:rendermedia","data-codepal-source-node-id":"src-pages-project-codeviewer-mediapreview-tsx:rendermedia:div:129:21","data-codepal-source-file":"src/pages/Project/CodeViewer/MediaPreview.tsx","data-codepal-source-line":"129","data-codepal-source-column":"21","data-codepal-source-symbol":"renderMedia",className:"flex items-center justify-center h-full bg-gray-50 dark:bg-gray-800",children:h.jsxs("video",{"data-codepal-ve-id":"src-pages-project-codeviewer-mediapreview-tsx:rendermedia:video:130:25","data-codepal-binding-id":"src-pages-project-codeviewer-mediapreview-tsx:rendermedia:video:130:25","data-codepal-module-id":"src-pages-project-codeviewer-mediapreview-tsx","data-codepal-component-id":"src-pages-project-codeviewer-mediapreview-tsx:rendermedia","data-codepal-source-node
264-id":"src-pages-project-codeviewer-mediapreview-tsx:rendermedia:video:130:25","data-codepal-source-file":"src/pages/Project/CodeViewer/MediaPreview.tsx","data-codepal-source-line":"130","data-codepal-source-column":"25","data-codepal-source-symbol":"renderMedia",controls:!0,className:"max-w-full max-h-full object-contain",style:{maxHeight:"calc(100vh - 200px)"},children:[h.jsx("source",{"data-codepal-ve-id":"src-pages-project-codeviewer-mediapreview-tsx:rendermedia:source:132:29","data-codepal-binding-id":"src-pages-project-codeviewer-mediapreview-tsx:rendermedia:source:132:29","data-codepal-module-id":"src-pages-project-codeviewer-mediapreview-tsx","data-codepal-component-id":"src-pages-project-codeviewer-mediapreview-tsx:rendermedia","data-codepal-source-node-id":"src-pages-project-codeviewer-mediapreview-tsx:rendermedia:source:132:29","data-codepal-source-file":"src/pages/Project/CodeViewer/MediaPreview.tsx","data-codepal-source-line":"132","data-codepal-source-column":"29","data-codepal-source-symbol":"renderMedia",src:a}),"Your browser does not support the video element."]})});if(o==="pdf"&&a.startsWith("data:")){const r=a.includes("â¦")||a.includes("...")||a.endsWith("â¦")||a.endsWith("...");return!(a.includes(",")&&a.split(",")[1].length>0)||r?(console.warn("Invalid or truncated PDF data URL for file:",e,"Content length:",a.length,"Truncated:",r),h.jsx("div",{"data-codepal-ve-id":"src-pages-project-codeviewer-mediapreview-tsx:rendermedia:div:153:25","data-codepal-binding-id":"src-pages-project-codeviewer-mediapreview-tsx:rendermedia:div:153:25","data-codepal-module-id":"src-pages-project-codeviewer-mediapreview-tsx","data-codepal-component-id":"src-pages-project-codeviewer-mediapreview-tsx:rendermedia","data-codepal-source-node-id":"src-pages-project-codeviewer-mediapreview-tsx:rendermedia:div:153:25","data-codepal-source-file":"src/pages/Project/CodeViewer/MediaPreview.tsx","data-codepal-source-line":"153","data-codepal-source-column":"25","data-codepal-source-symbol":"renderMedia",className:"flex flex-col items-center justify-center h-full bg-gray-50 dark:bg-gray-800 text-gray-600 dark:text-gray-400",children:h.jsxs("div",{"data-codepal-ve-id":"src-pages-project-codeviewer-mediapreview-tsx:rendermedia:div:155:29","data-codepal-binding-id":"src-pages-project-codeviewer-mediapreview-tsx:rendermedia:div:155:29","data-codepal-module-id":"src-pages-project-codeviewer-mediapreview-tsx","data-codepal-component-id":"src-pages-project-codeviewer-mediapreview-tsx:rendermedia","data-codepal-source-node-id":"src-pages-project-codeviewer-mediapreview-tsx:rendermedia:div:155:29","data-codepal-source-file":"src/pages/Project/CodeViewer/MediaPreview.tsx","data-codepal-source-line":"155","data-codepal-source-column":"29","data-codepal-source-symbol":"renderMedia",className:"text-center max-w-md",children:[h.jsx("div",{"data-codepal-ve-id":"src-pages-project-codeviewer-mediapreview-tsx:rendermedia:div:156:33","data-codepal-binding-id":"src-pages-project-codeviewer-mediapreview-tsx:rendermedia:div:156:33","data-codepal-module-id":"src-pages-project-codeviewer-mediapreview-tsx","data-codepal-component-id":"src-pages-project-codeviewer-mediapreview-tsx:rendermedia","data-codepal-source-node-id":"src-pages-project-codeviewer-mediapreview-tsx:rendermedia:div:156:33","data-codepal-source-file":"src/pages/Project/CodeViewer/MediaPreview.tsx","data-codepal-source-line":"156","data-codepal-source-column":"33","data-codepal-source-symbol":"renderMedia",className:"text-6xl mb-4",children:"ð"}),h.jsx("p",{"data-codepal-ve-id":"src-pages-project-codeviewer-mediapreview-tsx:rendermedia:p:157:33","data-codepal-binding-id":"src-pages-project-codeviewer-mediapreview-tsx:rendermedia:p:157:33","data-codepal-module-id":"src-pages-project-codeviewer-mediapreview-tsx","data-codepal-component-id":"src-pages-project-codeviewer-mediapreview-tsx:rendermedia","data-codepal-source-node-id":"src-pages-project-codeviewer-mediapreview-tsx:rendermedia:p:157:33","data-codepal-source-file":"src/pages/Project/CodeViewer/MediaPreview.tsx","data-codepal-source-line":"157","data-codepal-source-column":"33","data-codepal-source-symbol":"renderMedia",className:"text-lg font-medium",children:r?"Truncated PDF Data":"Invalid PDF Data"}),h.jsx("p",{"data-codepal-ve-id":"src-pages-project-codeviewer-mediapreview-tsx:rendermedia:p:160:33","data-codepal-binding-id":"src-pages-project-codeviewer-mediapreview-tsx:rendermedia:p:160:33","data-codepal-module-id":"src-pages-project-codeviewer-mediapreview-tsx","data-codepal-component-id":"src-pages-project-codeviewer-mediapreview-tsx:rendermedia","data-codepal-source-node
264-id":"src-pages-project-codeviewer-mediapreview-tsx:rendermedia:p:160:33","data-codepal-source-file":"src/pages/Project/CodeViewer/MediaPreview.tsx","data-codepal-source-line":"160","data-codepal-source-column":"33","data-codepal-source-symbol":"renderMedia",className:"text-sm mt-2",children:r?"The PDF data appears to be truncated. This may happen with very large files.":"The PDF data appears to be invalid."}),h.jsxs("p",{"data-codepal-ve-id":"src-pages-project-codeviewer-mediapreview-tsx:rendermedia:p:166:33","data-codepal-binding-id":"src-pages-project-codeviewer-mediapreview-tsx:rendermedia:p:166:33","data-codepal-module-id":"src-pages-project-codeviewer-mediapreview-tsx","data-codepal-component-id":"src-pages-project-codeviewer-mediapreview-tsx:rendermedia","data-codepal-source-node-id":"src-pages-project-codeviewer-mediapreview-tsx:rendermedia:p:166:33","data-codepal-source-file":"src/pages/Project/CodeViewer/MediaPreview.tsx","data-codepal-source-line":"166","data-codepal-source-column":"33","data-codepal-source-symbol":"renderMedia",className:"text-xs mt-3 text-gray-500",children:["Content length: ",a.length," characters"]}),h.jsx("p",{"data-codepal-ve-id":"src-pages-project-codeviewer-mediapreview-tsx:rendermedia:p:169:33","data-codepal-binding-id":"src-pages-project-codeviewer-mediapreview-tsx:rendermedia:p:169:33","data-codepal-module-id":"src-pages-project-codeviewer-mediapreview-tsx","data-codepal-component-id":"src-pages-project-codeviewer-mediapreview-tsx:rendermedia","data-codepal-source-node-id":"src-pages-project-codeviewer-mediapreview-tsx:rendermedia:p:169:33","data-codepal-source-file":"src/pages/Project/CodeViewer/MediaPreview.tsx","data-codepal-source-line":"169","data-codepal-source-column":"33","data-codepal-source-symbol":"renderMedia",className:"text-xs mt-2 text-blue-600 dark:text-blue-400",children:"Tip: Try switching to editor mode to view the raw data"})]})})):h.jsx("div",{"data-codepal-ve-id":"src-pages-project-codeviewer-mediapreview-tsx:rendermedia:div:178:21","data-codepal-binding-id":"src-pages-project-codeviewer-mediapreview-tsx:rendermedia:div:178:21","data-codepal-module-id":"src-pages-project-codeviewer-mediapreview-tsx","data-codepal-component-id":"src-pages-project-codeviewer-mediapreview-tsx:rendermedia","data-codepal-source-node-id":"src-pages-project-codeviewer-mediapreview-tsx:rendermedia:div:178:21","data-codepal-source-file":"src/pages/Project/CodeViewer/MediaPreview.tsx","data-codepal-source-line":"178","data-codepal-source-column":"21","data-codepal-source-symbol":"renderMedia",className:"flex flex-col h-full bg-gray-50 dark:bg-gray-800",children:h.jsxs("div",{"data-codepal-ve-id":"src-pages-project-codeviewer-mediapreview-tsx:rendermedia:div:179:25","data-codepal-binding-id":"src-pages-project-codeviewer-mediapreview-tsx:rendermedia:div:179:25","data-codepal-module-id":"src-pages-project-codeviewer-mediapreview-tsx","data-codepal-component-id":"src-pages-project-codeviewer-mediapreview-tsx:rendermedia","data-codepal-source-node-id":"src-pages-project-codeviewer-mediapreview-tsx:rendermedia:div:179:25","data-codepal-source-file":"src/pages/Project/CodeViewer/MediaPreview.tsx","data-codepal-source-line":"179","data-codepal-source-column":"25","data-codepal-source-symbol":"renderMedia",className:"flex-1 relative",children:[h.jsx("embed",{"data-codepal-ve-id":"src-pages-project-codeviewer-mediapreview-tsx:rendermedia:embed:180:29","data-codepal-binding-id":"src-pages-project-codeviewer-mediapreview-tsx:rendermedia:embed:180:29","data-codepal-module-id":"src-pages-project-codeviewer-mediapreview-tsx","data-codepal-component-id":"src-pages-project-codeviewer-mediapreview-tsx:rendermedia","data-codepal-source-node-id":"src-pages-project-codeviewer-mediapreview-tsx:rendermedia:embed:180:29","data-codepal-source-file":"src/pages/Project/CodeViewer/MediaPreview.tsx","data-codepal-source-line":"180","data-codepal-source-column":"29","data-codepal-source-symbol":"renderMedia",src:a,type:"application/pdf",className:"w-full h-full",onError:n=>{console.warn("PDF embed error for:",e,"Data URL length:",a.length);const l=n.target.parentElement;l&&(l.innerHTML=` 265 <iframe 266 src="${a}" 267 class="w-full h-full border-0" 268 title="PDF Viewer" 269 ></iframe> 270 `)}}),h.jsx("div",{"data-codepal-ve-id":"src-pages-project-codeviewer-mediapreview-tsx:rendermedia:div:201:29","data-codepal-binding-id":"src-pages-project-codeviewer-mediapreview-tsx:rendermedia:div:201:29","data-codepal-module-id":"src-pages-project-codeviewer-mediapreview-tsx","data-codepal-component-id":"src-pages-project-codeviewer-mediapreview-tsx:rendermedia","data-codepal-source-node
270-id":"src-pages-project-codeviewer-mediapreview-tsx:rendermedia:div:201:29","data-codepal-source-file":"src/pages/Project/CodeViewer/MediaPreview.tsx","data-codepal-source-line":"201","data-codepal-source-column":"29","data-codepal-source-symbol":"renderMedia",className:"absolute inset-0 flex items-center justify-center pointer-events-none",children:h.jsxs("div",{"data-codepal-ve-id":"src-pages-project-codeviewer-mediapreview-tsx:rendermedia:div:202:33","data-codepal-binding-id":"src-pages-project-codeviewer-mediapreview-tsx:rendermedia:div:202:33","data-codepal-module-id":"src-pages-project-codeviewer-mediapreview-tsx","data-codepal-component-id":"src-pages-project-codeviewer-mediapreview-tsx:rendermedia","data-codepal-source-node-id":"src-pages-project-codeviewer-mediapreview-tsx:rendermedia:div:202:33","data-codepal-source-file":"src/pages/Project/CodeViewer/MediaPreview.tsx","data-codepal-source-line":"202","data-codepal-source-column":"33","data-codepal-source-symbol":"renderMedia",className:"bg-white dark:bg-gray-800 p-4 rounded-lg shadow-lg text-center hidden pdf-fallback",children:[h.jsx("div",{"data-codepal-ve-id":"src-pages-project-codeviewer-mediapreview-tsx:rendermedia:div:204:37","data-codepal-binding-id":"src-pages-project-codeviewer-mediapreview-tsx:rendermedia:div:204:37","data-codepal-module-id":"src-pages-project-codeviewer-mediapreview-tsx","data-codepal-component-id":"src-pages-project-codeviewer-mediapreview-tsx:rendermedia","data-codepal-source-node-id":"src-pages-project-codeviewer-mediapreview-tsx:rendermedia:div:204:37","data-codepal-source-file":"src/pages/Project/CodeViewer/MediaPreview.tsx","data-codepal-source-line":"204","data-codepal-source-column":"37","data-codepal-source-symbol":"renderMedia",className:"text-4xl mb-2",children:"ð"}),h.jsx("p",{"data-codepal-ve-id":"src-pages-project-codeviewer-mediapreview-tsx:rendermedia:p:205:37","data-codepal-binding-id":"src-pages-project-codeviewer-mediapreview-tsx:rendermedia:p:205:37","data-codepal-module-id":"src-pages-project-codeviewer-mediapreview-tsx","data-codepal-component-id":"src-pages-project-codeviewer-mediapreview-tsx:rendermedia","data-codepal-source-node-id":"src-pages-project-codeviewer-mediapreview-tsx:rendermedia:p:205:37","data-codepal-source-file":"src/pages/Project/CodeViewer/MediaPreview.tsx","data-codepal-source-line":"205","data-codepal-source-column":"37","data-codepal-source-symbol":"renderMedia",className:"text-sm text-gray-600 dark:text-gray-400",children:"Your browser doesn't support PDF viewing."}),h.jsx("a",{"data-codepal-ve-id":"src-pages-project-codeviewer-mediapreview-tsx:rendermedia:a:208:37","data-codepal-binding-id":"src-pages-project-codeviewer-mediapreview-tsx:rendermedia:a:208:37","data-codepal-module-id":"src-pages-project-codeviewer-mediapreview-tsx","data-codepal-component-id":"src-pages-project-codeviewer-mediapreview-tsx:rendermedia","data-codepal-source-node-id":"src-pages-project-codeviewer-mediapreview-tsx:rendermedia:a:208:37","data-codepal-source-file":"src/pages/Project/CodeViewer/MediaPreview.tsx","data-codepal-source-line":"208","data-codepal-source-column":"37","data-codepal-source-symbol":"renderMedia",href:a,download:e.split("/").pop(),className:"inline-block mt-2 px-3 py-1 text-xs bg-blue-500 text-white rounded hover:bg-blue-600 transition-colors pointer-events-auto",children:"Download PDF"})]})})]})})}return h.jsx("div",{"data-codepal-ve-id":"src-pages-project-codeviewer-mediapreview-tsx:rendermedia:div:225:13","data-codepal-binding-id":"src-pages-project-codeviewer-mediapreview-tsx:rendermedia:div:225:13","data-codepal-module-id":"src-pages-project-codeviewer-mediapreview-tsx","data-codepal-component-id":"src-pages-project-codeviewer-mediapreview-tsx:rendermedia","data-codepal-source-node-id":"src-pages-project-codeviewer-mediapreview-tsx:rendermedia:div:225:13","data-codepal-source-file":"src/pages/Project/CodeViewer/MediaPreview.tsx","data-codepal-source-line":"225","data-codepal-source-column":"13","data-codepal-source-symbol":"renderMedia",className:"flex flex-col items-center justify-center h-full bg-gray-50 dark:bg-gray-800 text-gray-600 dark:text-gray-400",children:h.jsxs("div",{"data-codepal-ve-id":"src-pages-project-codeviewer-mediapreview-tsx:rendermedia:div:227:17","data-codepal-binding-id":"src-pages-project-codeviewer-mediapreview-tsx:rendermedia:div:227:17","data-codepal-module-id":"src-pages-project-codeviewer-mediapreview-tsx","data-codepal-component-id":"src-pages-project-codeviewer-mediapreview-tsx:rendermedia","data-codepal-source-node
270-id":"src-pages-project-codeviewer-mediapreview-tsx:rendermedia:div:227:17","data-codepal-source-file":"src/pages/Project/CodeViewer/MediaPreview.tsx","data-codepal-source-line":"227","data-codepal-source-column":"17","data-codepal-source-symbol":"renderMedia",className:"text-center",children:[h.jsx("div",{"data-codepal-ve-id":"src-pages-project-codeviewer-mediapreview-tsx:rendermedia:div:228:21","data-codepal-binding-id":"src-pages-project-codeviewer-mediapreview-tsx:rendermedia:div:228:21","data-codepal-module-id":"src-pages-project-codeviewer-mediapreview-tsx","data-codepal-component-id":"src-pages-project-codeviewer-mediapreview-tsx:rendermedia","data-codepal-source-node-id":"src-pages-project-codeviewer-mediapreview-tsx:rendermedia:div:228:21","data-codepal-source-file":"src/pages/Project/CodeViewer/MediaPreview.tsx","data-codepal-source-line":"228","data-codepal-source-column":"21","data-codepal-source-symbol":"renderMedia",className:"text-6xl mb-4",children:"ð"}),h.jsx("p",{"data-codepal-ve-id":"src-pages-project-codeviewer-mediapreview-tsx:rendermedia:p:229:21","data-codepal-binding-id":"src-pages-project-codeviewer-mediapreview-tsx:rendermedia:p:229:21","data-codepal-module-id":"src-pages-project-codeviewer-mediapreview-tsx","data-codepal-component-id":"src-pages-project-codeviewer-mediapreview-tsx:rendermedia","data-codepal-source-node-id":"src-pages-project-codeviewer-mediapreview-tsx:rendermedia:p:229:21","data-codepal-source-file":"src/pages/Project/CodeViewer/MediaPreview.tsx","data-codepal-source-line":"229","data-codepal-source-column":"21","data-codepal-source-symbol":"renderMedia",className:"text-lg font-medium",children:"Media Preview Not Available"}),h.jsxs("p",{"data-codepal-ve-id":"src-pages-project-codeviewer-mediapreview-tsx:rendermedia:p:230:21","data-codepal-binding-id":"src-pages-project-codeviewer-mediapreview-tsx:rendermedia:p:230:21","data-codepal-module-id":"src-pages-project-codeviewer-mediapreview-tsx","data-codepal-component-id":"src-pages-project-codeviewer-mediapreview-tsx:rendermedia","data-codepal-source-node-id":"src-pages-project-codeviewer-mediapreview-tsx:rendermedia:p:230:21","data-codepal-source-file":"src/pages/Project/CodeViewer/MediaPreview.tsx","data-codepal-source-line":"230","data-codepal-source-column":"21","data-codepal-source-symbol":"renderMedia",className:"text-sm mt-2",children:["Unable to preview this ",o.toUpperCase()," file.",!a.startsWith("data:")&&" Content may not be in a supported format."]})]})})};return h.jsx("div",{"data-codepal-ve-id":"src-pages-project-codeviewer-mediapreview-tsx:mediapreview:div:240:9","data-codepal-binding-id":"src-pages-project-codeviewer-mediapreview-tsx:mediapreview:div:240:9","data-codepal-module-id":"src-pages-project-codeviewer-mediapreview-tsx","data-codepal-component-id":"src-pages-project-codeviewer-mediapreview-tsx:mediapreview","data-codepal-source-node-id":"src-pages-project-codeviewer-mediapreview-tsx:mediapreview:div:240:9","data-codepal-source-file":"src/pages/Project/CodeViewer/MediaPreview.tsx","data-codepal-source-line":"240","data-codepal-source-column":"9","data-codepal-source-symbol":"MediaPreview",className:"h-full w-full overflow-auto media-preview-container",onClick:o=>{o.stopPropagation()},children:s()})});of.displayName="MediaPreview";const Cs=a=>{const e=a.split(".").pop()?.toLowerCase()||"";return["svg","png","jpg","jpeg","gif","webp","bmp","ico","mp3","wav","ogg","aac","flac","mp4","webm","avi","mov","pdf"].includes(e)},r1=a=>a.split(".").pop()?.toLowerCase()||"",i1=E.memo(({content:a,filePath:e,fileExtension:t})=>{const s=`media-${e}-${Date.now()}`;return He.log("Rendering MemoizedMediaContainer for:",e,"content length:",a?.length||0),h.jsx("div",{"data-codepal-ve-id":"src-pages-project-codeviewer-index-tsx:memoizedmediacontainer:div:49:9","data-codepal-binding-id":"src-pages-project-codeviewer-index-tsx:memoizedmediacontainer:div:49:9","data-codepal-module-id":"src-pages-project-codeviewer-index-tsx","data-codepal-component-id":"src-pages-project-codeviewer-index-tsx:memoizedmediacontainer","data-codepal-source-node
270-id":"src-pages-project-codeviewer-index-tsx:memoizedmediacontainer:div:49:9","data-codepal-source-file":"src/pages/Project/CodeViewer/index.tsx","data-codepal-source-line":"49","data-codepal-source-column":"9","data-codepal-source-symbol":"MemoizedMediaContainer",id:"media-preview-container",className:"h-full overflow-auto media-container",onClick:o=>{o.stopPropagation()},children:h.jsx(of,{content:a,filePath:e,fileExtension:t},s)})},(a,e)=>a.content===""||e.content===""?!1:a.content===e.content&&a.filePath===e.filePath),n1=E.memo(({content:a,filePath:e})=>{const t=`markdown-${e}-${Date.now()}`;return He.log("Rendering MemoizedMarkdownContainer for:",e,"content length:",a?.length||0),h.jsx("div",{"data-codepal-ve-id":"src-pages-project-codeviewer-index-tsx:memoizedmarkdowncontainer:div:75:9","data-codepal-binding-id":"src-pages-project-codeviewer-index-tsx:memoizedmarkdowncontainer:div:75:9","data-codepal-module-id":"src-pages-project-codeviewer-index-tsx","data-codepal-component-id":"src-pages-project-codeviewer-index-tsx:memoizedmarkdowncontainer","data-codepal-source-node-id":"src-pages-project-codeviewer-index-tsx:memoizedmarkdowncontainer:div:75:9","data-codepal-source-file":"src/pages/Project/CodeViewer/index.tsx","data-codepal-source-line":"75","data-codepal-source-column":"9","data-codepal-source-symbol":"MemoizedMarkdownContainer",id:"markdown-preview-container",className:"h-full overflow-auto markdown-container",onClick:s=>{s.stopPropagation()},children:h.jsx(o1,{content:a},t)})},(a,e)=>a.content===""||e.content===""?!1:a.content===e.content&&a.filePath===e.filePath),Sd=({mobileLayoutMode:a="full"})=>{const{toast:e}=po(),s=Gt(C=>C.user)?.isStarterSubscription||!1;E.useEffect(()=>{sf.preloadCommonLanguages()},[]);const o=ge(C=>C.chatMessages),r=je(C=>C.isRunning),i=je(C=>C.setIsRunning);je(C=>C.isTerminalOpen);const n=je(C=>C.setIsTerminalOpen),c=je(C=>C.activeFile),l=je(C=>C.setActiveFile),d=je(C=>C.isFileEdited),p=je(C=>C.isPreviewMode),u=je(C=>C.setIsPreviewMode),f=uo(C=>C.isDarkMode()),m=a,g=m!=="preview",x=m!=="files",b=m==="files",y=m==="preview",[k,A]=E.useState(null),[S,N]=E.useState(!1),[D,L]=E.useState(!1);E.useEffect(()=>{c&&(c.toLowerCase().endsWith(".md")?(N(!0),u(!0),L(!1)):Cs(c)?(L(!0),u(!0),N(!1)):(N(!1),L(!1),u(!1)))},[c,u]);const M=je(C=>C.getIsAutoPilotMode),B=Ya(o),V=ge(C=>C.isSendingMessage),P=ge(C=>C.activeStreamingMessageId),F=ge(C=>C.isSavingProject),j=V||P!==null||F,z=ge(C=>C.currentlyStreamingFile),[ce,$]=E.useState({line:1,column:1}),[K,I]=E.useState(0),X=E.useRef(null);E.useEffect(()=>{if(B?.files.length>0&&!c)if(B?.entry){const C=B?.files.some(_=>_.path===B?.entry);l(C?B?.entry:B?.files[0].path)}else l(B?.files[0].path)},[B?.files,c,B?.entry,l]);const T={scrollArea:E.useRef(null),codeContent:E.useRef(null)},O=E.useMemo(()=>{const C={};if(!B?.files||!B?.files.length)return C;const _=[...B?.files??[]].sort((Y,ne)=>Y.path.localeCompare(ne.path)),R=new Set(B?.deleted_files?.map(Y=>Y.path)||[]),J=new Set(_.filter(Y=>!R.has(Y.path)).map(Y=>Y.path)),Q=null;if(z&&z.path&&!R.has(z.path)){const Y=_.findIndex(ne=>ne.path===z.path);Y!==-1?_[Y]={..._[Y],isPartial:z.isPartial||!1,isLastFile:z.isLastFile||!1,wasCompleteFile:_[Y].wasCompleteFile||z.wasCompleteFile||!1}:(_.push(z),J.add(z.path))}return _.forEach((Y,ne)=>{Y.content&&(Y.content.includes("</CodePal")||Y.content.includes("<CodePal"))&&(_[ne]={...Y,content:Y.content.replace(/<\/?CodePal.*$/,"")}),Y.isNew&&!j&&(_[ne]={...Y,isNew:!1})}),_.filter(Y=>!R.has(Y.path)).forEach(Y=>{const ne=Y.path.split("/");if(!Y.path)return;let re=C;ne.forEach((me,Me)=>{if(Me===ne.length-1)if(Array.from(J).some(qe=>qe!==Y.path&&qe.startsWith(Y.path+"/")))re[me]=re[me]||{type:"folder",children:{},content:Y.content,language:Y.language,isEntryFile:Y.path===B?.entry,isLastFile:!1};else{let qe=!1;j&&(qe=Y.path===z?.path||Y.isPartial===!0||Y.isLastFile===!0||Y.path===Q?.path),re[me]={type:"file",content:Y.content||"",language:Y.language||"",isEntryFile:Y.path===B?.entry,isLastFile:qe,isPartial:Y.isPartial||!1}}else re[me]=re[me]||{type:"folder",children:{}},re=re[me].children})}),C},[B?.files,B?.deleted_files,B?.entry,z,j]),Z=E.useMemo(()=>{const C=B?.files;return C?C?.find(_=>_.path===c):null},[B?.files,c]),[oe,se]=E.useState({isVisible:!1,position:{x:0,y:0},text:""}),Ae=E.useCallback(C=>{A(C)},[]),Ie=E.useCallback(C=>{const _=window.getSelection();if(!_||_.rangeCount===0){se(J=>({...J,isVisible:!1}));return}const R=_.toString()||"";if(!R.trim()){se(J=>({...J,isVisible:!1}));return}if(T.codeContent.current)try{const Q=_.getRangeAt(0)?.getBoundingClientRect();Q&&T.codeContent.current.contains(_.anchorNode)&&se({isVisible:!0,position:{x:Q.left+Q.width/2,y:Q.top},text:R})}catch(J){se(Q=>({...Q,isVisible:!1})),console.warn("Error getting selection range:",J)}else se(J=>({...J,isVisible:!1}))},[T.codeContent]),ve=E.useCallback((C,_)=>{$(C),I(_)},[]),ke=E.useCallback(()=>{n(!0),i(!r)},[r,i,n]),ee=E.useCallback(C=>{if(s){e({title:"Upgrade Required",description:"In-code edits are only available on paid plans. Please upgrade to enable editing.",variant:"destructive"});return}Z&&!j&&je.getState().updateFileContent(Z.path,C,Z.content)},[Z,j,s,e]),de=E.useCallback(async()=>
270{if(s){e({title:"Upgrade Required",description:"Saving edits is only available on paid plans. Please upgrade to enable this feature.",variant:"destructive"});return}const C=je.getState().getEditedFiles();if(C.length===0){e({title:"No changes",description:"There are no changes to save",variant:"default"});return}const _=ge.getState().addSystemMessage("Saving changes to files...","files_saved","in_progress",C.map(Q=>Q.path));ge.getState().setIsSavingProject(!0);const R=Ya(o),J={...R||{},id:R?.id||"",title:R?.title||"",entry:R?.entry||"",deleted_files:R?.deleted_files||[]};try{const Q=ge.getState().project.id;if(!Q)throw new Error("Project ID not found");const H=await Vf(Q,C.map(Y=>({path:Y.path,content:Y.content})));H.files&&(J.files=H.files),ge.getState().updateChatMessage(_,{full_response:[{type:"artifact",value:J}],generated_files:H.updated_files,files:J.files},"done"),je.getState().resetAllEditedFiles()}catch(Q){console.error("Error saving files:",Q),ge.getState().updateChatMessage(_,{message_type:"system",message_system_type:"files_saved",full_response:[{type:"artifact",value:J}]},"error"),e({title:"Error saving files",description:Q instanceof Error?Q.message:"An unknown error occurred",variant:"destructive"})}finally{ge.getState().setIsSavingProject(!1)}},[o,e,s]),ue=E.useCallback(()=>{if(Z&&(je.getState().resetFileContent(Z.path),k)){const C=k.state.update({changes:{from:0,to:k.state.doc.length,insert:Z.content}});k.dispatch(C)}},[Z,k]);E.useCallback(C=>{switch(C){case"explain":He.log("Explain:",oe.text);break;case"improve":He.log("Improve:",oe.text);break;case"reply":He.log("Reply:",oe.text);break}se(_=>({..._,isVisible:!1}))},[oe.text]);const xe=E.useCallback(C=>{const _=B?.files.filter(R=>R.path.startsWith(C+"/")&&R.path.slice(C.length+1).indexOf("/")===-1);_&&_.length>0&&(l(_[0].path,!0),e({title:"Folder Navigation",description:`Navigated to ${C}`,variant:"default"}))},[B?.files,l,e]);E.useEffect(()=>{document.addEventListener("selectionchange",Ie);const C=_=>{_.target.closest(".floating-selection-menu")||se(R=>({...R,isVisible:!1}))};return document.addEventListener("mousedown",C),()=>{document.removeEventListener("selectionchange",Ie),document.removeEventListener("mousedown",C)}},[Ie]),E.useEffect(()=>{M()&&z?.path&&z.path},[z,c,V,P,M]),E.useEffect(()=>{Z&&Z.path===z?.path&&(V||P!==null)&&(Z.path.toLowerCase().endsWith(".md")&&N(!1),Cs(Z.path)&&L(!1))},[Z,z,V,P]),E.useEffect(()=>{Z&&(Z.path.toLowerCase().endsWith(".md")?(N(p),L(!1)):Cs(Z.path)?(L(p),N(!1)):(N(!1),L(!1)))},[c,p,Z]);const v=E.useCallback(()=>{if(Z?.path===z?.path&&(V||P!==null))N(!1),L(!1),u(!1);else if(Z){if(Z.path.toLowerCase().endsWith(".md")){const _=!S;N(_),L(!1),u(_)}else if(Cs(Z.path)){const _=!D;L(_),N(!1),u(_)}}},[Z,z,V,P,S,D,u]),U=()=>{if(!Z)return h.jsx("div",{"data-codepal-ve-id":"src-pages-project-codeviewer-index-tsx:rendercode:div:698:17","data-codepal-binding-id":"src-pages-project-codeviewer-index-tsx:rendercode:div:698:17","data-codepal-module-id":"src-pages-project-codeviewer-index-tsx","data-codepal-component-id":"src-pages-project-codeviewer-index-tsx:rendercode","data-codepal-source-node-id":"src-pages-project-codeviewer-index-tsx:rendercode:div:698:17","data-codepal-source-file":"src/pages/Project/CodeViewer/index.tsx","data-codepal-source-line":"698","data-codepal-source-column":"17","data-codepal-source-symbol":"renderCode",className:"flex flex-col h-full w-full items-center justify-center text-gray-400",children:h.jsx("p",{"data-codepal-ve-id":"src-pages-project-codeviewer-index-tsx:rendercode:p:699:21","data-codepal-binding-id":"src-pages-project-codeviewer-index-tsx:rendercode:p:699:21","data-codepal-module-id":"src-pages-project-codeviewer-index-tsx","data-codepal-component-id":"src-pages-project-codeviewer-index-tsx:rendercode","data-codepal-source-node-id":"src-pages-project-codeviewer-index-tsx:rendercode:p:699:21","data-codepal-source-file":"src/pages/Project/CodeViewer/index.tsx","data-codepal-source-line":"699","data-codepal-source-column":"21","data-codepal-source-symbol":"renderCode",children:"No file selected"})});const C=Z.isPartial||Z.isLastFile,_=Z.path.toLowerCase().endsWith(".md"),R=Cs(Z.path),J=Z.path===z?.path&&(V||P!==null),Q=`editor-${Z.path}`,H=j;return h.jsxs("div",{"data-codepal-ve-id":"src-pages-project-codeviewer-index-tsx:rendercode:div:727:13","data-codepal-binding-id":"src-pages-project-codeviewer-index-tsx:rendercode:div:727:13","data-codepal-module-id":"src-pages-project-codeviewer-index-tsx","data-codepal-component-id":"src-pages-project-codeviewer-index-tsx:rendercode","data-codepal-source-node
270-id":"src-pages-project-codeviewer-index-tsx:rendercode:div:727:13","data-codepal-source-file":"src/pages/Project/CodeViewer/index.tsx","data-codepal-source-line":"727","data-codepal-source-column":"13","data-codepal-source-symbol":"renderCode",className:"flex flex-col h-full",children:[h.jsx(Qy,{editorView:k,filePath:Z.path,isReadOnly:H,isStreaming:C,onSave:de,onCancel:ue,onNavigateToFolder:xe,isMarkdown:_,previewMode:_&&S&&!J||R&&D&&!J,onTogglePreviewMode:_||R?v:void 0,editorRef:X}),h.jsx("div",{"data-codepal-ve-id":"src-pages-project-codeviewer-index-tsx:rendercode:div:741:17","data-codepal-binding-id":"src-pages-project-codeviewer-index-tsx:rendercode:div:741:17","data-codepal-module-id":"src-pages-project-codeviewer-index-tsx","data-codepal-component-id":"src-pages-project-codeviewer-index-tsx:rendercode","data-codepal-source-node-id":"src-pages-project-codeviewer-index-tsx:rendercode:div:741:17","data-codepal-source-file":"src/pages/Project/CodeViewer/index.tsx","data-codepal-source-line":"741","data-codepal-source-column":"17","data-codepal-source-symbol":"renderCode",className:"flex-grow overflow-hidden",ref:T.codeContent,children:_&&S&&!J?h.jsx(n1,{content:d(Z.path)?je.getState().editedFiles[Z.path].content:Z.content||"",filePath:Z.path}):R&&D&&!J?h.jsx(i1,{content:d(Z.path)?je.getState().editedFiles[Z.path].content:Z.content||"",filePath:Z.path,fileExtension:r1(Z.path)}):h.jsx(Xy,{ref:X,language:Z.language,readOnly:H,onEditorViewCreated:Ae,onChange:ee,onCursorChange:ve,filePath:Z.path,onSave:de},Q)}),h.jsx(t1,{cursorPosition:ce,selectionLength:K})]})},W=ge.getState().isLoadingProject;return h.jsx(h.Fragment,{children:h.jsx(ra,{children:h.jsx("div",{"data-codepal-ve-id":"src-pages-project-codeviewer-index-tsx:codeviewer:div:786:17","data-codepal-binding-id":"src-pages-project-codeviewer-index-tsx:codeviewer:div:786:17","data-codepal-module-id":"src-pages-project-codeviewer-index-tsx","data-codepal-component-id":"src-pages-project-codeviewer-index-tsx:codeviewer","data-codepal-source-node-id":"src-pages-project-codeviewer-index-tsx:codeviewer:div:786:17","data-codepal-source-file":"src/pages/Project/CodeViewer/index.tsx","data-codepal-source-line":"786","data-codepal-source-column":"17","data-codepal-source-symbol":"CodeViewer",className:`flex flex-col h-full overflow-hidden shadow-lg z-10 ${f?"bg-gray-900":"bg-white"} ${b||y?"shadow-md lg:shadow-lg":""}`,id:"codeViewerPanel",style:{width:"100%"},children:h.jsxs("div",{"data-codepal-ve-id":"src-pages-project-codeviewer-index-tsx:codeviewer:div:792:21","data-codepal-binding-id":"src-pages-project-codeviewer-index-tsx:codeviewer:div:792:21","data-codepal-module-id":"src-pages-project-codeviewer-index-tsx","data-codepal-component-id":"src-pages-project-codeviewer-index-tsx:codeviewer","data-codepal-source-node-id":"src-pages-project-codeviewer-index-tsx:codeviewer:div:792:21","data-codepal-source-file":"src/pages/Project/CodeViewer/index.tsx","data-codepal-source-line":"792","data-codepal-source-column":"21","data-codepal-source-symbol":"CodeViewer",className:"flex-1 flex min-h-0 overflow-hidden",children:[g&&h.jsx("div",{"data-codepal-ve-id":"src-pages-project-codeviewer-index-tsx:codeviewer:div:794:29","data-codepal-binding-id":"src-pages-project-codeviewer-index-tsx:codeviewer:div:794:29","data-codepal-module-id":"src-pages-project-codeviewer-index-tsx","data-codepal-component-id":"src-pages-project-codeviewer-index-tsx:codeviewer","data-codepal-source-node-id":"src-pages-project-codeviewer-index-tsx:codeviewer:div:794:29","data-codepal-source-file":"src/pages/Project/CodeViewer/index.tsx","data-codepal-source-line":"794","data-codepal-source-column":"29","data-codepal-source-symbol":"CodeViewer",className:`flex flex-col overflow-hidden h-full ${b?"w-full min-w-0 border-b border-gray-200 dark:border-gray-700":"border-r min-w-[10rem] w-64"} ${f?"bg-gray-800 border-gray-700 to-gray-850":"bg-gray-50 border-gray-200"}`,children:h.jsx(mj,{tree:O,onFileSelect:(C,_=!1)=>l(C,_),handleRunCode:ke})}),x&&h.jsx("div",{"data-codepal-ve-id":"src-pages-project-codeviewer-index-tsx:codeviewer:div:811:29","data-codepal-binding-id":"src-pages-project-codeviewer-index-tsx:codeviewer:div:811:29","data-codepal-module-id":"src-pages-project-codeviewer-index-tsx","data-codepal-component-id":"src-pages-project-codeviewer-index-tsx:codeviewer","data-codepal-source-node
270-id":"src-pages-project-codeviewer-index-tsx:codeviewer:div:811:29","data-codepal-source-file":"src/pages/Project/CodeViewer/index.tsx","data-codepal-source-line":"811","data-codepal-source-column":"29","data-codepal-source-symbol":"CodeViewer",className:`flex-1 flex flex-col relative overflow-hidden ${y?"w-full":""}`,children:W||!B?.files?h.jsx("div",{"data-codepal-ve-id":"src-pages-project-codeviewer-index-tsx:codeviewer:div:816:37","data-codepal-binding-id":"src-pages-project-codeviewer-index-tsx:codeviewer:div:816:37","data-codepal-module-id":"src-pages-project-codeviewer-index-tsx","data-codepal-component-id":"src-pages-project-codeviewer-index-tsx:codeviewer","data-codepal-source-node-id":"src-pages-project-codeviewer-index-tsx:codeviewer:div:816:37","data-codepal-source-file":"src/pages/Project/CodeViewer/index.tsx","data-codepal-source-line":"816","data-codepal-source-column":"37","data-codepal-source-symbol":"CodeViewer",className:"flex-1 flex items-center justify-center",children:h.jsx("div",{"data-codepal-ve-id":"src-pages-project-codeviewer-index-tsx:codeviewer:div:817:41","data-codepal-binding-id":"src-pages-project-codeviewer-index-tsx:codeviewer:div:817:41","data-codepal-module-id":"src-pages-project-codeviewer-index-tsx","data-codepal-component-id":"src-pages-project-codeviewer-index-tsx:codeviewer","data-codepal-source-node-id":"src-pages-project-codeviewer-index-tsx:codeviewer:div:817:41","data-codepal-source-file":"src/pages/Project/CodeViewer/index.tsx","data-codepal-source-line":"817","data-codepal-source-column":"41","data-codepal-source-symbol":"CodeViewer",className:"text-center",children:h.jsx(bj,{})})}):h.jsx(h.Fragment,{children:h.jsx("div",{"data-codepal-ve-id":"src-pages-project-codeviewer-index-tsx:codeviewer:div:823:41","data-codepal-binding-id":"src-pages-project-codeviewer-index-tsx:codeviewer:div:823:41","data-codepal-module-id":"src-pages-project-codeviewer-index-tsx","data-codepal-component-id":"src-pages-project-codeviewer-index-tsx:codeviewer","data-codepal-source-node-id":"src-pages-project-codeviewer-index-tsx:codeviewer:div:823:41","data-codepal-source-file":"src/pages/Project/CodeViewer/index.tsx","data-codepal-source-line":"823","data-codepal-source-column":"41","data-codepal-source-symbol":"CodeViewer",className:"flex-1 overflow-hidden",children:U()})})})]})})})})},c1=Lf,rf=E.forwardRef(({className:a,...e},t)=>h.jsx(Fd,{ref:t,className:ie("inline-flex h-10 items-center justify-center bg-muted p-1 text-muted-foreground",a),...e}));rf.displayName=Fd.displayName;const or=E.forwardRef(({className:a,...e},t)=>h.jsx(Rd,{ref:t,className:ie("inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm",a),...e}));or.displayName=Rd.displayName;const rr=E.forwardRef(({className:a,...e},t)=>h.jsx(Bd,{ref:t,className:ie("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",a),...e}));rr.displayName=Bd.displayName;const l1=If("inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function d1({className:a,variant:e,...t}){return h.jsx("div",{"data-codepal-ve-id":"src-components-ui-badge-tsx:badge:div:33:9","data-codepal-binding-id":"src-components-ui-badge-tsx:badge:div:33:9","data-codepal-module-id":"src-components-ui-badge-tsx","data-codepal-component-id":"src-components-ui-badge-tsx:badge","data-codepal-source-node
270-id":"src-components-ui-badge-tsx:badge:div:33:9","data-codepal-source-file":"src/components/ui/badge.tsx","data-codepal-source-line":"33","data-codepal-source-column":"9","data-codepal-source-symbol":"Badge",className:ie(l1({variant:e}),a),...t})}function p1(a,e){return E.useReducer((t,s)=>e[t][s]??t,a)}var mc="ScrollArea",[nf,L2]=Wf(mc),[u1,wt]=nf(mc),cf=E.forwardRef((a,e)=>{const{__scopeScrollArea:t,type:s="hover",dir:o,scrollHideDelay:r=600,...i}=a,[n,c]=E.useState(null),[l,d]=E.useState(null),[p,u]=E.useState(null),[f,m]=E.useState(null),[g,x]=E.useState(null),[b,y]=E.useState(0),[k,A]=E.useState(0),[S,N]=E.useState(!1),[D,L]=E.useState(!1),M=rs(e,V=>c(V)),B=tm(o);return h.jsx(u1,{scope:t,type:s,dir:B,scrollHideDelay:r,scrollArea:n,viewport:l,onViewportChange:d,content:p,onContentChange:u,scrollbarX:f,onScrollbarXChange:m,scrollbarXEnabled:S,onScrollbarXEnabledChange:N,scrollbarY:g,onScrollbarYChange:x,scrollbarYEnabled:D,onScrollbarYEnabledChange:L,onCornerWidthChange:y,onCornerHeightChange:A,children:h.jsx(lo.div,{dir:B,...i,ref:M,style:{position:"relative","--radix-scroll-area-corner-width":b+"px","--radix-scroll-area-corner-height":k+"px",...a.style}})})});cf.displayName=mc;var lf="ScrollAreaViewport",df=E.forwardRef((a,e)=>{const{__scopeScrollArea:t,children:s,nonce:o,...r}=a,i=wt(lf,t),n=E.useRef(null),c=rs(e,n,i.onViewportChange);return h.jsxs(h.Fragment,{children:[h.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:o}),h.jsx(lo.div,{"data-radix-scroll-area-viewport":"",...r,ref:c,style:{overflowX:i.scrollbarXEnabled?"scroll":"hidden",overflowY:i.scrollbarYEnabled?"scroll":"hidden",...a.style},children:h.jsx("div",{ref:i.onContentChange,style:{minWidth:"100%",display:"table"},children:s})})]})});df.displayName=lf;var Vt="ScrollAreaScrollbar",gc=E.forwardRef((a,e)=>{const{forceMount:t,...s}=a,o=wt(Vt,a.__scopeScrollArea),{onScrollbarXEnabledChange:r,onScrollbarYEnabledChange:i}=o,n=a.orientation==="horizontal";return E.useEffect(()=>(n?r(!0):i(!0),()=>{n?r(!1):i(!1)}),[n,r,i]),o.type==="hover"?h.jsx(h1,{...s,ref:e,forceMount:t}):o.type==="scroll"?h.jsx(f1,{...s,ref:e,forceMount:t}):o.type==="auto"?h.jsx(pf,{...s,ref:e,forceMount:t}):o.type==="always"?h.jsx(xc,{...s,ref:e}):null});gc.displayName=Vt;var h1=E.forwardRef((a,e)=>{const{forceMount:t,...s}=a,o=wt(Vt,a.__scopeScrollArea),[r,i]=E.useState(!1);return E.useEffect(()=>{const n=o.scrollArea;let c=0;if(n){const l=()=>{window.clearTimeout(c),i(!0)},d=()=>{c=window.setTimeout(()=>i(!1),o.scrollHideDelay)};return n.addEventListener("pointerenter",l),n.addEventListener("pointerleave",d),()=>{window.clearTimeout(c),n.removeEventListener("pointerenter",l),n.removeEventListener("pointerleave",d)}}},[o.scrollArea,o.scrollHideDelay]),h.jsx(Er,{present:t||r,children:h.jsx(pf,{"data-state":r?"visible":"hidden",...s,ref:e})})}),f1=E.forwardRef((a,e)=>{const{forceMount:t,...s}=a,o=wt(Vt,a.__scopeScrollArea),r=a.orientation==="horizontal",i=Kr(()=>c("SCROLL_END"),100),[n,c]=p1("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return E.useEffect(()=>{if(n==="idle"){const l=window.setTimeout(()=>c("HIDE"),o.scrollHideDelay);return()=>window.clearTimeout(l)}},[n,o.scrollHideDelay,c]),E.useEffect(()=>{const l=o.viewport,d=r?"scrollLeft":"scrollTop";if(l){let p=l[d];const u=()=>{const f=l[d];p!==f&&(c("SCROLL"),i()),p=f};return l.addEventListener("scroll",u),()=>l.removeEventListener("scroll",u)}},[o.viewport,r,c,i]),h.jsx(Er,{present:t||n!=="hidden",children:h.jsx(xc,{"data-state":n==="hidden"?"hidden":"visible",...s,ref:e,onPointerEnter:Ea(a.onPointerEnter,()=>c("POINTER_ENTER")),onPointerLeave:Ea(a.onPointerLeave,()=>c("POINTER_LEAVE"))})})}),pf=E.forwardRef((a,e)=>{const t=wt(Vt,a.__scopeScrollArea),{forceMount:s,...o}=a,[r,i]=E.useState(!1),n=a.orientation==="horizontal",c=Kr(()=>{if(t.viewport){const l=t.viewport.offsetWidth<t.viewport.scrollWidth,d=t.viewport.offsetHeight<t.viewport.scrollHeight;i(n?l:d)}},10);return os(t.viewport,c),os(t.content,c),h.jsx(Er,{present:s||r,children:h.jsx(xc,{"data-state":r?"visible":"hidden",...o,ref:e})})}),xc=E.forwardRef((a,e)=>{const{orientation:t="vertical",...s}=a,o=wt(Vt,a.__scopeScrollArea),r=E.useRef(null),i=E.useRef(0),[n,c]=E.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),l=gf(n.viewport,n.content),d={...s,sizes:n,onSizesChange:c,hasThumb:l>0&&l<1,onThumbChange:u=>r.current=u,onThumbPointerUp:()=>i.current=0,onThumbPointerDown:u=>i.current=u};function p(u,f){return j1(u,i.current,n,f)}return t==="horizontal"?h.jsx(m1,{...d,ref:e,onThumbPositionChange:()=>{if(o.viewport&&r.current){const u=o.viewport.scrollLeft,f=_d(u,n,o.dir);r.current.style.transform=`translate3d(${f}px, 0, 0)`}}
vendor: 5,804 bytes, line 270
270,onWheelScroll:u=>{o.viewport&&(o.viewport.scrollLeft=u)},onDragScroll:u=>{o.viewport&&(o.viewport.scrollLeft=p(u,o.dir))}}):t==="vertical"?h.jsx(g1,{...d,ref:e,onThumbPositionChange:()=>{if(o.viewport&&r.current){const u=o.viewport.scrollTop,f=_d(u,n);r.current.style.transform=`translate3d(0, ${f}px, 0)`}},onWheelScroll:u=>{o.viewport&&(o.viewport.scrollTop=u)},onDragScroll:u=>{o.viewport&&(o.viewport.scrollTop=p(u))}}):null}),m1=E.forwardRef((a,e)=>{const{sizes:t,onSizesChange:s,...o}=a,r=wt(Vt,a.__scopeScrollArea),[i,n]=E.useState(),c=E.useRef(null),l=rs(e,c,r.onScrollbarXChange);return E.useEffect(()=>{c.current&&n(getComputedStyle(c.current))},[c]),h.jsx(hf,{"data-orientation":"horizontal",...o,ref:l,sizes:t,style:{bottom:0,left:r.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:r.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":qr(t)+"px",...a.style},onThumbPointerDown:d=>a.onThumbPointerDown(d.x),onDragScroll:d=>a.onDragScroll(d.x),onWheelScroll:(d,p)=>{if(r.viewport){const u=r.viewport.scrollLeft+d.deltaX;a.onWheelScroll(u),bf(u,p)&&d.preventDefault()}},onResize:()=>{c.current&&r.viewport&&i&&s({content:r.viewport.scrollWidth,viewport:r.viewport.offsetWidth,scrollbar:{size:c.current.clientWidth,paddingStart:Mr(i.paddingLeft),paddingEnd:Mr(i.paddingRight)}})}})}),g1=E.forwardRef((a,e)=>{const{sizes:t,onSizesChange:s,...o}=a,r=wt(Vt,a.__scopeScrollArea),[i,n]=E.useState(),c=E.useRef(null),l=rs(e,c,r.onScrollbarYChange);return E.useEffect(()=>{c.current&&n(getComputedStyle(c.current))},[c]),h.jsx(hf,{"data-orientation":"vertical",...o,ref:l,sizes:t,style:{top:0,right:r.dir==="ltr"?0:void 0,left:r.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":qr(t)+"px",...a.style},onThumbPointerDown:d=>a.onThumbPointerDown(d.y),onDragScroll:d=>a.onDragScroll(d.y),onWheelScroll:(d,p)=>{if(r.viewport){const u=r.viewport.scrollTop+d.deltaY;a.onWheelScroll(u),bf(u,p)&&d.preventDefault()}},onResize:()=>{c.current&&r.viewport&&i&&s({content:r.viewport.scrollHeight,viewport:r.viewport.offsetHeight,scrollbar:{size:c.current.clientHeight,paddingStart:Mr(i.paddingTop),paddingEnd:Mr(i.paddingBottom)}})}})}),[x1,uf]=nf(Vt),hf=E.forwardRef((a,e)=>{const{__scopeScrollArea:t,sizes:s,hasThumb:o,onThumbChange:r,onThumbPointerUp:i,onThumbPointerDown:n,onThumbPositionChange:c,onDragScroll:l,onWheelScroll:d,onResize:p,...u}=a,f=wt(Vt,t),[m,g]=E.useState(null),x=rs(e,M=>g(M)),b=E.useRef(null),y=E.useRef(""),k=f.viewport,A=s.content-s.viewport,S=Ca(d),N=Ca(c),D=Kr(p,10);function L(M){if(b.current){const B=M.clientX-b.current.left,V=M.clientY-b.current.top;l({x:B,y:V})}}return E.useEffect(()=>{const M=B=>{const V=B.target;m?.contains(V)&&S(B,A)};return document.addEventListener("wheel",M,{passive:!1}),()=>document.removeEventListener("wheel",M,{passive:!1})},[k,m,A,S]),E.useEffect(N,[s,N]),os(m,D),os(f.content,D),h.jsx(x1,{scope:t,scrollbar:m,hasThumb:o,onThumbChange:Ca(r),onThumbPointerUp:Ca(i),onThumbPositionChange:N,onThumbPointerDown:Ca(n),children:h.jsx(lo.div,{...u,ref:x,style:{position:"absolute",...u.style},onPointerDown:Ea(a.onPointerDown,M=>{M.button===0&&(M.target.setPointerCapture(M.pointerId),b.current=m.getBoundingClientRect(),y.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",f.viewport&&(f.viewport.style.scrollBehavior="auto"),L(M))}),onPointerMove:Ea(a.onPointerMove,L),onPointerUp:Ea(a.onPointerUp,M=>{const B=M.target;B.hasPointerCapture(M.pointerId)&&B.releasePointerCapture(M.pointerId),document.body.style.webkitUserSelect=y.current,f.viewport&&(f.viewport.style.scrollBehavior=""),b.current=null})})})}),Ar="ScrollAreaThumb",ff=E.forwardRef((a,e)=>{const{forceMount:t,...s}=a,o=uf(Ar,a.__scopeScrollArea);return h.jsx(Er,{present:t||o.hasThumb,children:h.jsx(b1,{ref:e,...s})})}),b1=E.forwardRef((a,e)=>{const{__scopeScrollArea:t,style:s,...o}=a,r=wt(Ar,t),i=uf(Ar,t),{onThumbPositionChange:n}=i,c=rs(e,p=>i.onThumbChange(p)),l=E.useRef(void 0),d=Kr(()=>{l.current&&(l.current(),l.current=void 0)},100);return E.useEffect(()=>{const p=r.viewport;if(p){const u=()=>{if(d(),!l.current){const f=w1(p,n);l.current=f,n()}};return n(),p.addEventListener("scroll",u),()=>p.removeEventListener("scroll",u)}},[r.viewport,d,n]),h.jsx(lo.div,{"data-state":i.hasThumb?"visible":"hidden",...o,ref:c,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...s},onPointerDownCapture:Ea(a.onPointerDownCapture,p=>{const f=p.target.getBoundingClientRect(),m=p.clientX-f.left,g=p.clientY-f.top;i.onThumbPointerDown({x:m,y:g})}),onPointerUp:Ea(a.onPointerUp,i.onThumbPointerUp)})});ff.displayName=Ar;var bc="ScrollAreaCorner",mf=E.forwardRef((a,e)=>{const t=wt(bc,a.__scopeScrollArea),s=!!(t.scrollbarX&&t.scrollbarY);return t.type!=="scroll"&&s?h.jsx(v1,{...a,ref:e}):null});mf.displayName=bc;var v1=E.forwardRef((a,e)=>{const{__scopeScrollArea:t,...s}=a,o=wt(bc,t),[r,i]=E.useState(0),[n,c]=E.useState(0),l=!!(r&&n);return os(o.scrollbarX,()=>{const d=o.scrollbarX?.offsetHeight||0;o.onCornerHeightChange(d),c(d)}),os(o.scrollbarY,()=>{const d=o.scrollbarY?.offsetWidth||0;o.onCornerWidthChange(d),i(d)}),l?h.jsx(lo.div,{...s,ref:e,style:{width:r,height:n,position:"absolute",right:o.dir==="ltr"?0:void 0,left:o.dir==="rtl"?0:void 0,bottom:0,...a.style}}):null});function Mr(a){return a?parseInt(a,10):0}function gf(a,e){const t=a/e;return isNaN(t)?0:t}function qr(a){const e=gf(a.viewport,a.content),t=a.scrollbar.paddingStart+a.scrollbar.paddingEnd,s=(a.scrollbar.size-t)*e;return Math.max(s,18)}function j1(a,e,t,s="ltr"){const o=qr(t),r=o/2,i=e||r,n=o-i,c=t.scrollbar.paddingStart+i,l=t.scrollbar.size-t.scrollbar.paddingEnd-n,d=t.content-t.viewport,p=s==="ltr"?[0,d]:[d*-1,0];
270return xf([c,l],p)(a)}function _d(a,e,t="ltr"){const s=qr(e),o=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,r=e.scrollbar.size-o,i=e.content-e.viewport,n=r-s,c=t==="ltr"?[0,i]:[i*-1,0],l=bm(a,c);return xf([0,i],[0,n])(l)}function xf(a,e){return t=>{if(a[0]===a[1]||e[0]===e[1])return e[0];const s=(e[1]-e[0])/(a[1]-a[0]);return e[0]+s*(t-a[0])}}function bf(a,e){return a>0&&a<e}var w1=(a,e=()=>{})=>{let t={left:a.scrollLeft,top:a.scrollTop},s=0;return(function o(){const r={left:a.scrollLeft,top:a.scrollTop},i=t.left!==r.left,n=t.top!==r.top;(i||n)&&e(),t=r,s=window.requestAnimationFrame(o)})(),()=>window.cancelAnimationFrame(s)};function Kr(a,e){const t=Ca(a),s=E.useRef(0);return E.useEffect(()=>()=>window.clearTimeout(s.current),[]),E.useCallback(()=>{window.clearTimeout(s.current),s.current=window.setTimeout(t,e)},[t,e])}function os(a,e){const t=Ca(e);Hf(()=>{let s=0;if(a){const o=new ResizeObserver(()=>{cancelAnimationFrame(s),s=window.requestAnimationFrame(t)});return o.observe(a),()=>{window.cancelAnimationFrame(s),o.unobserve(a)}}},[a,t])}var vf=cf,vc=df,y1=mf;const jf=()=>h.jsx("style",{"data-codepal-ve-id":"src-components-ui-scroll-area-tsx:scrollareastylefix:style:8:5","data-codepal-binding-id":"src-components-ui-scroll-area-tsx:scrollareastylefix:style:8:5","data-codepal-module-id":"src-components-ui-scroll-area-tsx","data-codepal-component-id":"src-components-ui-scroll-area-tsx:scrollareastylefix","data-codepal-source-node-id":"src-components-ui-scroll-area-tsx:scrollareastylefix:style:8:5","data-codepal-source-file":"src/components/ui/scroll-area.tsx","data-codepal-source-line":"8","data-codepal-source-column":"5","data-codepal-source-symbol":"ScrollAreaStyleFix",children:` 271 /* Override Radix UI's problematic styles */ 272 [data-radix-scroll-area-viewport] > div { 273 min-width: 100% !important; 274 display: block !important; 275 } 276 `}),ir=E.forwardRef(({className:a,children:e,...t},s)=>h.jsxs(vf,{ref:s,type:"hover",scrollHideDelay:0,className:ie("relative overflow-hidden",a),...t,children:[h.jsx(jf,{}),h.jsx(vc,{className:"h-full w-full rounded-[inherit]",style:{display:"flex",flexDirection:"column"},children:h.jsx("div",{"data-codepal-ve-id":"src-components-ui-scroll-area-tsx:scrollarea:div:38:13","data-codepal-binding-id":"src-components-ui-scroll-area-tsx:scrollarea:div:38:13","data-codepal-module-id":"src-components-ui-scroll-area-tsx","data-codepal-component-id":"src-components-ui-scroll-area-tsx:scrollarea","data-codepal-source-node-id":"src-components-ui-scroll-area-tsx:scrollarea:div:38:13","data-codepal-source-file":"src/components/ui/scroll-area.tsx","data-codepal-source-line":"38","data-codepal-source-column":"13","data-codepal-source-symbol":"ScrollArea",style:{width:"100%"},children:e})}),h.jsx(wf,{}),h.jsx(y1,{})]}));ir.displayName=vf.displayName;const wf=E.forwardRef(({className:a,orientation:e="vertical",...t},s)=>h.jsx(gc,{ref:s,orientation:e,className:ie("flex touch-none select-none transition-colors",e==="vertical"&&"h-full w-3 border-l border-l-transparent p-[1px] hover:bg-gray-100/20 dark:hover:bg-gray-800/40",e==="horizontal"&&"h-3 flex-col border-t border-t-transparent p-[1px] hover:bg-gray-100/20 dark:hover:bg-gray-800/40",a),...t,children:h.jsx(ff,{className:"relative flex-1 rounded-full bg-gray-400 dark:bg-gray-600 hover:bg-gray-500 dark:hover:bg-gray-500 transition-colors"})}));wf.displayName=gc.displayName;const k1=E.forwardRef(({className:a,children:e,...t},s)=>h.jsxs(vc,{ref:s,className:ie("h-full w-full rounded-[inherit]",a),style:{display:"flex",flexDirection:"column"},...t,children:[h.jsx(jf,{}),h.jsx("div",{"data-codepal-ve-id":"src-components-ui-scroll-area-tsx:scrollareaviewport:div:86:9","data-codepal-binding-id":"src-components-ui-scroll-area-tsx:scrollareaviewport:div:86:9","data-codepal-module-id":"src-components-ui-scroll-area-tsx","data-codepal-component-id":"src-components-ui-scroll-area-tsx:scrollareaviewport","data-codepal-source-node-id":"src-components-ui-scroll-area-tsx:scrollareaviewport:div:86:9","data-codepal-source-file":"src/components/ui/scroll-area.tsx","data-codepal-source-line":"86","data-codepal-source-column":"9","data-codepal-source-symbol":"ScrollAreaViewport",style:{width:"100%"},children:e})]}));k1.displayName=vc.displayName;const C1=({open:a,onOpenChange:e,project:t,onToggleFavorite:s,isFavorite:o=!1,onShare:r})=>{const[i,n]=E.useState("details"),c=$f(t.tool_id),[l,d]=E.useState((t.visibility??"private")==="public"),p=ge(K=>K.setVisibility),[u,f]=E.useState(!1),[m,g]=E.useState(t.title),[x,b]=E.useState(!1),[y,k]=E.useState(null),A=E.useRef(null),S=Gt(K=>K.user),N=S&&t?.user_id===S._id;E.useEffect(()=>{d((t.visibility??"private")==="public")},[t.visibility]),E.useEffect(()=>{u&&A.current&&A.current.focus()},[u]);const D=Object.entries(t.advanced_options||{}).filter(([K,I])=>{const X=c?.advancedOptions?.find(T=>T.id===K);return X?X.type==="boolean"?I===!0:["select","radio"].includes(X.type)?I!==X.defaultValue:!1:!1}).length,M=(()=>
276{if(!c?.advancedOptions?.length)return new Map;const K=new Map;return K.set("General",[]),c.advancedOptions.forEach(I=>{const X=I.category||"General";K.has(X)||K.set(X,[]),K.get(X)?.push(I)}),new Map(Array.from(K.entries()).filter(([I,X])=>X.length>0))})();(()=>{const K=new Map;return Array.from(M.entries()).forEach(([I,X])=>{const T=X.filter(O=>O.type==="boolean"?!!t.advanced_options?.[O.id]:["select","radio"].includes(O.type)?t.advanced_options?.[O.id]!==O.defaultValue:!1).length;K.set(I,T)}),K})();const V=K=>new Date(K).toLocaleDateString(void 0,{year:"numeric",month:"long",day:"numeric"}),P=K=>new Date(K).toLocaleString(void 0,{year:"numeric",month:"long",day:"numeric",hour:"2-digit",minute:"2-digit"}),F=async K=>{b(!0),k(null);try{const I=await qf(t.id,K);if((I.success||I)&&(K.title&&(g(K.title),f(!1),t.title=K.title),K.visibility)){const X=K.visibility==="public";d(X),p(X),t.visibility=K.visibility}}catch(I){const X=I?.message||"An error occurred. Please try again.";k(X)}finally{b(!1)}},j=async()=>{if(m.trim()===""){k("Title cannot be empty.");return}if(m===t.title){f(!1);return}await F({title:m})},z=async K=>{if(K===l)return;await F({visibility:K?"public":"private"})},ce=K=>{K.key==="Enter"&&(K.preventDefault(),j())},$=K=>{if(K==="visibility"&&!N){n("details");return}n(K)};return h.jsx(Xd,{open:a,onOpenChange:e,children:h.jsxs(Jd,{className:"max-w-4xl h-[85vh] p-0 overflow-hidden flex flex-col bg-white dark:bg-gray-900",children:[h.jsxs(Zd,{className:"px-5 py-3 border-b border-gray-200 dark:border-gray-700 flex flex-row items-center justify-between bg-white dark:bg-gray-900 shrink-0",children:[h.jsxs("div",{"data-codepal-ve-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:256:21","data-codepal-binding-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:256:21","data-codepal-module-id":"src-components-project-projectconfigdialog-tsx","data-codepal-component-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog","data-codepal-source-node-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:256:21","data-codepal-source-file":"src/components/project/ProjectConfigDialog.tsx","data-codepal-source-line":"256","data-codepal-source-column":"21","data-codepal-source-symbol":"ProjectConfigDialog",children:[h.jsxs(Qd,{className:"text-lg flex items-center gap-2 text-gray-900 dark:text-gray-100",children:[t.title,D>0&&h.jsxs(d1,{variant:"outline",className:"ml-2 bg-primary/10 text-primary border-primary/30 text-xs",children:[D," settings"]})]}),h.jsxs(ep,{className:"mt-0.5 text-xs text-gray-500 dark:text-gray-400",children:["Created on ",V(t.created_at)]})]}),h.jsxs("div",{"data-codepal-ve-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:270:21","data-codepal-binding-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:270:21","data-codepal-module-id":"src-components-project-projectconfigdialog-tsx","data-codepal-component-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog","data-codepal-source-node-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:270:21","data-codepal-source-file":"src/components/project/ProjectConfigDialog.tsx","data-codepal-source-line":"270","data-codepal-source-column":"21","data-codepal-source-symbol":"ProjectConfigDialog",className:"flex items-center gap-3 mr-6",children:[h.jsx(ra,{children:h.jsxs(Ht,{children:[h.jsx($t,{asChild:!0,children:h.jsx(yt,{variant:"ghost",size:"sm",onClick:s,className:ie("transition-all h-8 w-8 p-0",o&&"text-yellow-500 hover:text-yellow-600"),children:h.jsx(Uf,{className:ie("h-4 w-4",o?"fill-yellow-500":"fill-transparent")})})}),h.jsx(Ut,{children:h.jsx("p",{"data-codepal-ve-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:p:290:37","data-codepal-binding-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:p:290:37","data-codepal-module-id":"src-components-project-projectconfigdialog-tsx","data-codepal-component-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog","data-codepal-source-node
276-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:p:290:37","data-codepal-source-file":"src/components/project/ProjectConfigDialog.tsx","data-codepal-source-line":"290","data-codepal-source-column":"37","data-codepal-source-symbol":"ProjectConfigDialog",children:o?"Remove from favorites":"Add to favorites"})})]})}),h.jsx(ra,{children:h.jsxs(Ht,{children:[h.jsx($t,{asChild:!0,children:h.jsx(yt,{variant:"ghost",size:"sm",onClick:r,className:"h-8 w-8 p-0",children:h.jsx(Am,{className:"h-4 w-4"})})}),h.jsx(Ut,{children:h.jsx("p",{"data-codepal-ve-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:p:308:37","data-codepal-binding-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:p:308:37","data-codepal-module-id":"src-components-project-projectconfigdialog-tsx","data-codepal-component-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog","data-codepal-source-node-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:p:308:37","data-codepal-source-file":"src/components/project/ProjectConfigDialog.tsx","data-codepal-source-line":"308","data-codepal-source-column":"37","data-codepal-source-symbol":"ProjectConfigDialog",children:"Share project"})})]})})]})]}),h.jsx("div",{"data-codepal-ve-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:315:17","data-codepal-binding-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:315:17","data-codepal-module-id":"src-components-project-projectconfigdialog-tsx","data-codepal-component-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog","data-codepal-source-node-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:315:17","data-codepal-source-file":"src/components/project/ProjectConfigDialog.tsx","data-codepal-source-line":"315","data-codepal-source-column":"17","data-codepal-source-symbol":"ProjectConfigDialog",className:"flex flex-1 overflow-hidden",children:h.jsxs(c1,{defaultValue:"details",value:i,onValueChange:$,orientation:"vertical",className:"flex h-full w-full",children:[h.jsx("div",{"data-codepal-ve-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:323:25","data-codepal-binding-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:323:25","data-codepal-module-id":"src-components-project-projectconfigdialog-tsx","data-codepal-component-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog","data-codepal-source-node-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:323:25","data-codepal-source-file":"src/components/project/ProjectConfigDialog.tsx","data-codepal-source-line":"323","data-codepal-source-column":"25","data-codepal-source-symbol":"ProjectConfigDialog",className:"w-44 h-full border-r border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-800",children:h.jsxs(rf,{className:"flex flex-col items-start w-full rounded-none py-3 px-2 bg-transparent space-y-1 h-auto",children:[h.jsxs(or,{value:"details",className:"w-full justify-start gap-2 px-3 py-2 text-start rounded-md text-sm font-medium",children:[h.jsx(Da,{className:"h-4 w-4"}),h.jsx("span",{"data-codepal-ve-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:span:332:37","data-codepal-binding-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:span:332:37","data-codepal-module-id":"src-components-project-projectconfigdialog-tsx","data-codepal-component-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog","data-codepal-source-node-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:span:332:37","data-codepal-source-file":"src/components/project/ProjectConfigDialog.tsx","data-codepal-source-line":"332","data-codepal-source-column":"37","data-codepal-source-symbol":"ProjectConfigDialog",children:"Project Details"})]}),N&&h.jsxs(or,{value:"visibility",className:"w-full justify-start gap-2 px-3 py-2 text-start rounded-md text-sm font-medium",children:[h.jsx(yc,{className:"h-4 w-4"}),h.jsx("span",{"data-codepal-ve-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:span:340:41","data-codepal-binding-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:span:340:41","data-codepal-module-id":"src-components-project-projectconfigdialog-tsx","data-codepal-component-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog","data-codepal-source-node
276-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:span:340:41","data-codepal-source-file":"src/components/project/ProjectConfigDialog.tsx","data-codepal-source-line":"340","data-codepal-source-column":"41","data-codepal-source-symbol":"ProjectConfigDialog",children:"Visibility"})]}),h.jsxs(or,{value:"advanced",className:"w-full justify-start gap-2 px-3 py-2 text-start rounded-md text-sm font-medium",children:[h.jsx(Sm,{className:"h-4 w-4"}),h.jsx("span",{"data-codepal-ve-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:span:348:37","data-codepal-binding-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:span:348:37","data-codepal-module-id":"src-components-project-projectconfigdialog-tsx","data-codepal-component-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog","data-codepal-source-node-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:span:348:37","data-codepal-source-file":"src/components/project/ProjectConfigDialog.tsx","data-codepal-source-line":"348","data-codepal-source-column":"37","data-codepal-source-symbol":"ProjectConfigDialog",children:"Settings"})]})]})}),h.jsxs("div",{"data-codepal-ve-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:353:25","data-codepal-binding-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:353:25","data-codepal-module-id":"src-components-project-projectconfigdialog-tsx","data-codepal-component-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog","data-codepal-source-node-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:353:25","data-codepal-source-file":"src/components/project/ProjectConfigDialog.tsx","data-codepal-source-line":"353","data-codepal-source-column":"25","data-codepal-source-symbol":"ProjectConfigDialog",className:"flex-1 overflow-hidden",children:[h.jsx(rr,{value:"details",className:"h-full m-0 p-0 data-[state=active]:block",children:h.jsx(ir,{className:"h-full p-5",children:h.jsxs("div",{"data-codepal-ve-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:359:37","data-codepal-binding-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:359:37","data-codepal-module-id":"src-components-project-projectconfigdialog-tsx","data-codepal-component-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog","data-codepal-source-node-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:359:37","data-codepal-source-file":"src/components/project/ProjectConfigDialog.tsx","data-codepal-source-line":"359","data-codepal-source-column":"37","data-codepal-source-symbol":"ProjectConfigDialog",className:"space-y-4",children:[h.jsxs("div",{"data-codepal-ve-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:360:41","data-codepal-binding-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:360:41","data-codepal-module-id":"src-components-project-projectconfigdialog-tsx","data-codepal-component-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog","data-codepal-source-node-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:360:41","data-codepal-source-file":"src/components/project/ProjectConfigDialog.tsx","data-codepal-source-line":"360","data-codepal-source-column":"41","data-codepal-source-symbol":"ProjectConfigDialog",className:"bg-white dark:bg-gray-800 shadow-sm border border-gray-100 dark:border-gray-700 rounded-lg overflow-hidden",children:[h.jsx("div",{"data-codepal-ve-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:362:45","data-codepal-binding-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:362:45","data-codepal-module-id":"src-components-project-projectconfigdialog-tsx","data-codepal-component-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog","data-codepal-source-node-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:362:45","data-codepal-source-file":"src/components/project/ProjectConfigDialog.tsx","data-codepal-source-line":"362","data-codepal-source-column":"45","data-codepal-source-symbol":"ProjectConfigDialog",className:"px-4 py-3 border-b border-gray-100 dark:border-gray-700 bg-gray-50 dark:bg-gray-900/50",children:h.jsx("h3",{"data-codepal-ve-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:h3:364:49","data-codepal-binding-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:h3:364:49","data-codepal-module-id":"src-components-project-projectconfigdialog-tsx","data-codepal-component-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog","data-codepal-source-node
276-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:h3:364:49","data-codepal-source-file":"src/components/project/ProjectConfigDialog.tsx","data-codepal-source-line":"364","data-codepal-source-column":"49","data-codepal-source-symbol":"ProjectConfigDialog",className:"text-sm font-medium text-gray-900 dark:text-gray-100",children:"Project Information"})}),h.jsxs("div",{"data-codepal-ve-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:367:45","data-codepal-binding-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:367:45","data-codepal-module-id":"src-components-project-projectconfigdialog-tsx","data-codepal-component-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog","data-codepal-source-node-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:367:45","data-codepal-source-file":"src/components/project/ProjectConfigDialog.tsx","data-codepal-source-line":"367","data-codepal-source-column":"45","data-codepal-source-symbol":"ProjectConfigDialog",className:"divide-y divide-gray-100 dark:divide-gray-700",children:[h.jsxs("div",{"data-codepal-ve-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:368:49","data-codepal-binding-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:368:49","data-codepal-module-id":"src-components-project-projectconfigdialog-tsx","data-codepal-component-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog","data-codepal-source-node-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:368:49","data-codepal-source-file":"src/components/project/ProjectConfigDialog.tsx","data-codepal-source-line":"368","data-codepal-source-column":"49","data-codepal-source-symbol":"ProjectConfigDialog",className:"flex items-center px-4 py-3",children:[h.jsxs("div",{"data-codepal-ve-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:369:53","data-codepal-binding-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:369:53","data-codepal-module-id":"src-components-project-projectconfigdialog-tsx","data-codepal-component-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog","data-codepal-source-node-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:369:53","data-codepal-source-file":"src/components/project/ProjectConfigDialog.tsx","data-codepal-source-line":"369","data-codepal-source-column":"53","data-codepal-source-symbol":"ProjectConfigDialog",className:"flex items-center gap-2 w-[180px] shrink-0 text-gray-500 dark:text-gray-400",children:[h.jsx(vm,{className:"h-4 w-4"}),h.jsx("span",{"data-codepal-ve-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:span:372:57","data-codepal-binding-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:span:372:57","data-codepal-module-id":"src-components-project-projectconfigdialog-tsx","data-codepal-component-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog","data-codepal-source-node-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:span:372:57","data-codepal-source-file":"src/components/project/ProjectConfigDialog.tsx","data-codepal-source-line":"372","data-codepal-source-column":"57","data-codepal-source-symbol":"ProjectConfigDialog",className:"text-sm",children:"Project Name"})]}),u?h.jsxs("div",{"data-codepal-ve-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:375:57","data-codepal-binding-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:375:57","data-codepal-module-id":"src-components-project-projectconfigdialog-tsx","data-codepal-component-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog","data-codepal-source-node-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:375:57","data-codepal-source-file":"src/components/project/ProjectConfigDialog.tsx","data-codepal-source-line":"375","data-codepal-source-column":"57","data-codepal-source-symbol":"ProjectConfigDialog",className:"flex-1 flex items-center space-x-2",children:[h.jsx(tp,{ref:A,value:m,onChange:K=>g(K.target.value),onKeyDown:ce,className:"h-8 text-sm",placeholder:"Project name",maxLength:200,disabled:x}),h.jsxs("div",{"data-codepal-ve-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:386:61","data-codepal-binding-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:386:61","data-codepal-module-id":"src-components-project-projectconfigdialog-tsx","data-codepal-component-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog","data-codepal-source-node
276-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:386:61","data-codepal-source-file":"src/components/project/ProjectConfigDialog.tsx","data-codepal-source-line":"386","data-codepal-source-column":"61","data-codepal-source-symbol":"ProjectConfigDialog",className:"flex items-center space-x-1",children:[h.jsx(yt,{size:"sm",variant:"ghost",className:"h-8 w-8 p-0",onClick:j,disabled:x,children:h.jsx(En,{className:"h-4 w-4 text-green-500"})}),h.jsx(yt,{size:"sm",variant:"ghost",className:"h-8 w-8 p-0",onClick:()=>{f(!1),g(t.title),k(null)},disabled:x,children:h.jsx(um,{className:"h-4 w-4 text-red-500"})})]})]}):h.jsxs("div",{"data-codepal-ve-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:412:57","data-codepal-binding-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:412:57","data-codepal-module-id":"src-components-project-projectconfigdialog-tsx","data-codepal-component-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog","data-codepal-source-node-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:412:57","data-codepal-source-file":"src/components/project/ProjectConfigDialog.tsx","data-codepal-source-line":"412","data-codepal-source-column":"57","data-codepal-source-symbol":"ProjectConfigDialog",className:"flex-1 flex items-center justify-between",children:[h.jsx("div",{"data-codepal-ve-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:413:61","data-codepal-binding-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:413:61","data-codepal-module-id":"src-components-project-projectconfigdialog-tsx","data-codepal-component-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog","data-codepal-source-node-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:413:61","data-codepal-source-file":"src/components/project/ProjectConfigDialog.tsx","data-codepal-source-line":"413","data-codepal-source-column":"61","data-codepal-source-symbol":"ProjectConfigDialog",className:"text-sm font-medium text-gray-900 dark:text-gray-100",children:t.title}),S&&t.user_id===S._id&&h.jsx(yt,{size:"sm",variant:"ghost",className:"h-8 w-8 p-0",onClick:()=>f(!0),children:h.jsx(Wd,{className:"h-3.5 w-3.5 text-gray-500"})})]})]}),h.jsxs("div",{"data-codepal-ve-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:431:49","data-codepal-binding-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:431:49","data-codepal-module-id":"src-components-project-projectconfigdialog-tsx","data-codepal-component-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog","data-codepal-source-node-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:431:49","data-codepal-source-file":"src/components/project/ProjectConfigDialog.tsx","data-codepal-source-line":"431","data-codepal-source-column":"49","data-codepal-source-symbol":"ProjectConfigDialog",className:"flex items-center px-4 py-3",children:[h.jsxs("div",{"data-codepal-ve-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:432:53","data-codepal-binding-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:432:53","data-codepal-module-id":"src-components-project-projectconfigdialog-tsx","data-codepal-component-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog","data-codepal-source-node-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:432:53","data-codepal-source-file":"src/components/project/ProjectConfigDialog.tsx","data-codepal-source-line":"432","data-codepal-source-column":"53","data-codepal-source-symbol":"ProjectConfigDialog",className:"flex items-center gap-2 w-[180px] shrink-0 text-gray-500 dark:text-gray-400",children:[h.jsx(Da,{className:"h-4 w-4"}),h.jsx("span",{"data-codepal-ve-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:span:435:57","data-codepal-binding-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:span:435:57","data-codepal-module-id":"src-components-project-projectconfigdialog-tsx","data-codepal-component-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog","data-codepal-source-node
276-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:span:435:57","data-codepal-source-file":"src/components/project/ProjectConfigDialog.tsx","data-codepal-source-line":"435","data-codepal-source-column":"57","data-codepal-source-symbol":"ProjectConfigDialog",className:"text-sm",children:"Tool"})]}),h.jsx("div",{"data-codepal-ve-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:437:53","data-codepal-binding-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:437:53","data-codepal-module-id":"src-components-project-projectconfigdialog-tsx","data-codepal-component-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog","data-codepal-source-node-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:437:53","data-codepal-source-file":"src/components/project/ProjectConfigDialog.tsx","data-codepal-source-line":"437","data-codepal-source-column":"53","data-codepal-source-symbol":"ProjectConfigDialog",className:"text-sm font-medium text-gray-900 dark:text-gray-100 flex items-center",children:c?.name||t.tool_id})]})]})]}),h.jsxs("div",{"data-codepal-ve-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:446:41","data-codepal-binding-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:446:41","data-codepal-module-id":"src-components-project-projectconfigdialog-tsx","data-codepal-component-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog","data-codepal-source-node-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:446:41","data-codepal-source-file":"src/components/project/ProjectConfigDialog.tsx","data-codepal-source-line":"446","data-codepal-source-column":"41","data-codepal-source-symbol":"ProjectConfigDialog",className:"bg-white dark:bg-gray-800 shadow-sm border border-gray-100 dark:border-gray-700 rounded-lg overflow-hidden",children:[h.jsx("div",{"data-codepal-ve-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:448:45","data-codepal-binding-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:448:45","data-codepal-module-id":"src-components-project-projectconfigdialog-tsx","data-codepal-component-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog","data-codepal-source-node-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:448:45","data-codepal-source-file":"src/components/project/ProjectConfigDialog.tsx","data-codepal-source-line":"448","data-codepal-source-column":"45","data-codepal-source-symbol":"ProjectConfigDialog",className:"px-4 py-3 border-b border-gray-100 dark:border-gray-700 bg-gray-50 dark:bg-gray-900/50",children:h.jsx("h3",{"data-codepal-ve-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:h3:450:49","data-codepal-binding-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:h3:450:49","data-codepal-module-id":"src-components-project-projectconfigdialog-tsx","data-codepal-component-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog","data-codepal-source-node-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:h3:450:49","data-codepal-source-file":"src/components/project/ProjectConfigDialog.tsx","data-codepal-source-line":"450","data-codepal-source-column":"49","data-codepal-source-symbol":"ProjectConfigDialog",className:"text-sm font-medium text-gray-900 dark:text-gray-100",children:"Timestamps"})}),h.jsxs("div",{"data-codepal-ve-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:452:45","data-codepal-binding-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:452:45","data-codepal-module-id":"src-components-project-projectconfigdialog-tsx","data-codepal-component-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog","data-codepal-source-node-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:452:45","data-codepal-source-file":"src/components/project/ProjectConfigDialog.tsx","data-codepal-source-line":"452","data-codepal-source-column":"45","data-codepal-source-symbol":"ProjectConfigDialog",className:"divide-y divide-gray-100 dark:divide-gray-700",children:[h.jsxs("div",{"data-codepal-ve-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:453:49","data-codepal-binding-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:453:49","data-codepal-module-id":"src-components-project-projectconfigdialog-tsx","data-codepal-component-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog","data-codepal-source-node
276-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:453:49","data-codepal-source-file":"src/components/project/ProjectConfigDialog.tsx","data-codepal-source-line":"453","data-codepal-source-column":"49","data-codepal-source-symbol":"ProjectConfigDialog",className:"flex items-center px-4 py-3",children:[h.jsxs("div",{"data-codepal-ve-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:454:53","data-codepal-binding-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:454:53","data-codepal-module-id":"src-components-project-projectconfigdialog-tsx","data-codepal-component-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog","data-codepal-source-node-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:454:53","data-codepal-source-file":"src/components/project/ProjectConfigDialog.tsx","data-codepal-source-line":"454","data-codepal-source-column":"53","data-codepal-source-symbol":"ProjectConfigDialog",className:"flex items-center gap-2 w-[180px] shrink-0 text-gray-500 dark:text-gray-400",children:[h.jsx(jm,{className:"h-4 w-4"}),h.jsx("span",{"data-codepal-ve-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:span:457:57","data-codepal-binding-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:span:457:57","data-codepal-module-id":"src-components-project-projectconfigdialog-tsx","data-codepal-component-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog","data-codepal-source-node-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:span:457:57","data-codepal-source-file":"src/components/project/ProjectConfigDialog.tsx","data-codepal-source-line":"457","data-codepal-source-column":"57","data-codepal-source-symbol":"ProjectConfigDialog",className:"text-sm",children:"Created"})]}),h.jsx("div",{"data-codepal-ve-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:459:53","data-codepal-binding-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:459:53","data-codepal-module-id":"src-components-project-projectconfigdialog-tsx","data-codepal-component-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog","data-codepal-source-node-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:459:53","data-codepal-source-file":"src/components/project/ProjectConfigDialog.tsx","data-codepal-source-line":"459","data-codepal-source-column":"53","data-codepal-source-symbol":"ProjectConfigDialog",className:"text-sm text-gray-700 dark:text-gray-300",children:P(t.created_at)})]}),h.jsxs("div",{"data-codepal-ve-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:464:49","data-codepal-binding-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:464:49","data-codepal-module-id":"src-components-project-projectconfigdialog-tsx","data-codepal-component-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog","data-codepal-source-node-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:464:49","data-codepal-source-file":"src/components/project/ProjectConfigDialog.tsx","data-codepal-source-line":"464","data-codepal-source-column":"49","data-codepal-source-symbol":"ProjectConfigDialog",className:"flex items-center px-4 py-3",children:[h.jsxs("div",{"data-codepal-ve-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:465:53","data-codepal-binding-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:465:53","data-codepal-module-id":"src-components-project-projectconfigdialog-tsx","data-codepal-component-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog","data-codepal-source-node-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:465:53","data-codepal-source-file":"src/components/project/ProjectConfigDialog.tsx","data-codepal-source-line":"465","data-codepal-source-column":"53","data-codepal-source-symbol":"ProjectConfigDialog",className:"flex items-center gap-2 w-[180px] shrink-0 text-gray-500 dark:text-gray-400",children:[h.jsx(wm,{className:"h-4 w-4"}),h.jsx("span",{"data-codepal-ve-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:span:468:57","data-codepal-binding-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:span:468:57","data-codepal-module-id":"src-components-project-projectconfigdialog-tsx","data-codepal-component-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog","data-codepal-source-node
276-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:span:468:57","data-codepal-source-file":"src/components/project/ProjectConfigDialog.tsx","data-codepal-source-line":"468","data-codepal-source-column":"57","data-codepal-source-symbol":"ProjectConfigDialog",className:"text-sm",children:"Last Updated"})]}),h.jsx("div",{"data-codepal-ve-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:470:53","data-codepal-binding-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:470:53","data-codepal-module-id":"src-components-project-projectconfigdialog-tsx","data-codepal-component-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog","data-codepal-source-node-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:470:53","data-codepal-source-file":"src/components/project/ProjectConfigDialog.tsx","data-codepal-source-line":"470","data-codepal-source-column":"53","data-codepal-source-symbol":"ProjectConfigDialog",className:"text-sm text-gray-700 dark:text-gray-300",children:P(t.updated_at)})]})]})]}),D>0&&h.jsxs("div",{"data-codepal-ve-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:478:45","data-codepal-binding-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:478:45","data-codepal-module-id":"src-components-project-projectconfigdialog-tsx","data-codepal-component-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog","data-codepal-source-node-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:478:45","data-codepal-source-file":"src/components/project/ProjectConfigDialog.tsx","data-codepal-source-line":"478","data-codepal-source-column":"45","data-codepal-source-symbol":"ProjectConfigDialog",className:"bg-white dark:bg-gray-800 shadow-sm border border-gray-100 dark:border-gray-700 rounded-lg overflow-hidden",children:[h.jsx("div",{"data-codepal-ve-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:480:49","data-codepal-binding-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:480:49","data-codepal-module-id":"src-components-project-projectconfigdialog-tsx","data-codepal-component-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog","data-codepal-source-node-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:480:49","data-codepal-source-file":"src/components/project/ProjectConfigDialog.tsx","data-codepal-source-line":"480","data-codepal-source-column":"49","data-codepal-source-symbol":"ProjectConfigDialog",className:"px-4 py-3 border-b border-gray-100 dark:border-gray-700 bg-gray-50 dark:bg-gray-900/50",children:h.jsx("h3",{"data-codepal-ve-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:h3:482:53","data-codepal-binding-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:h3:482:53","data-codepal-module-id":"src-components-project-projectconfigdialog-tsx","data-codepal-component-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog","data-codepal-source-node-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:h3:482:53","data-codepal-source-file":"src/components/project/ProjectConfigDialog.tsx","data-codepal-source-line":"482","data-codepal-source-column":"53","data-codepal-source-symbol":"ProjectConfigDialog",className:"text-sm font-medium text-gray-900 dark:text-gray-100",children:"Settings Summary"})}),h.jsxs("div",{"data-codepal-ve-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:485:49","data-codepal-binding-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:485:49","data-codepal-module-id":"src-components-project-projectconfigdialog-tsx","data-codepal-component-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog","data-codepal-source-node-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:485:49","data-codepal-source-file":"src/components/project/ProjectConfigDialog.tsx","data-codepal-source-line":"485","data-codepal-source-column":"49","data-codepal-source-symbol":"ProjectConfigDialog",className:"p-4",children:[h.jsxs("div",{"data-codepal-ve-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:486:53","data-codepal-binding-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:486:53","data-codepal-module-id":"src-components-project-projectconfigdialog-tsx","data-codepal-component-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog","data-codepal-source-node
276-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:486:53","data-codepal-source-file":"src/components/project/ProjectConfigDialog.tsx","data-codepal-source-line":"486","data-codepal-source-column":"53","data-codepal-source-symbol":"ProjectConfigDialog",className:"text-sm text-gray-500 dark:text-gray-400 mb-3",children:["This project has ",D," active advanced settings."]}),h.jsx(yt,{variant:"outline",size:"sm",className:"text-xs",onClick:()=>n("advanced"),children:"View Advanced Settings"})]})]})]})})}),N&&h.jsx(rr,{value:"visibility",className:"h-full m-0 p-0 data-[state=active]:flex data-[state=active]:flex-col",children:h.jsx(ir,{className:"h-full p-5",children:h.jsx("div",{"data-codepal-ve-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:510:41","data-codepal-binding-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:510:41","data-codepal-module-id":"src-components-project-projectconfigdialog-tsx","data-codepal-component-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog","data-codepal-source-node-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:510:41","data-codepal-source-file":"src/components/project/ProjectConfigDialog.tsx","data-codepal-source-line":"510","data-codepal-source-column":"41","data-codepal-source-symbol":"ProjectConfigDialog",className:"space-y-4",children:h.jsxs("div",{"data-codepal-ve-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:511:45","data-codepal-binding-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:511:45","data-codepal-module-id":"src-components-project-projectconfigdialog-tsx","data-codepal-component-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog","data-codepal-source-node-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:511:45","data-codepal-source-file":"src/components/project/ProjectConfigDialog.tsx","data-codepal-source-line":"511","data-codepal-source-column":"45","data-codepal-source-symbol":"ProjectConfigDialog",className:"bg-white dark:bg-gray-800 shadow-sm border border-gray-100 dark:border-gray-700 rounded-lg overflow-hidden",children:[h.jsx("div",{"data-codepal-ve-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:513:49","data-codepal-binding-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:513:49","data-codepal-module-id":"src-components-project-projectconfigdialog-tsx","data-codepal-component-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog","data-codepal-source-node-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:513:49","data-codepal-source-file":"src/components/project/ProjectConfigDialog.tsx","data-codepal-source-line":"513","data-codepal-source-column":"49","data-codepal-source-symbol":"ProjectConfigDialog",className:"px-4 py-3 border-b border-gray-100 dark:border-gray-700 bg-gray-50 dark:bg-gray-900/50",children:h.jsx("h3",{"data-codepal-ve-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:h3:515:53","data-codepal-binding-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:h3:515:53","data-codepal-module-id":"src-components-project-projectconfigdialog-tsx","data-codepal-component-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog","data-codepal-source-node-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:h3:515:53","data-codepal-source-file":"src/components/project/ProjectConfigDialog.tsx","data-codepal-source-line":"515","data-codepal-source-column":"53","data-codepal-source-symbol":"ProjectConfigDialog",className:"text-sm font-medium text-gray-900 dark:text-gray-100",children:"Access Control"})}),h.jsxs("div",{"data-codepal-ve-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:518:49","data-codepal-binding-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:518:49","data-codepal-module-id":"src-components-project-projectconfigdialog-tsx","data-codepal-component-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog","data-codepal-source-node
276-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:518:49","data-codepal-source-file":"src/components/project/ProjectConfigDialog.tsx","data-codepal-source-line":"518","data-codepal-source-column":"49","data-codepal-source-symbol":"ProjectConfigDialog",className:"p-4",children:[h.jsx("div",{"data-codepal-ve-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:519:53","data-codepal-binding-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:519:53","data-codepal-module-id":"src-components-project-projectconfigdialog-tsx","data-codepal-component-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog","data-codepal-source-node-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:519:53","data-codepal-source-file":"src/components/project/ProjectConfigDialog.tsx","data-codepal-source-line":"519","data-codepal-source-column":"53","data-codepal-source-symbol":"ProjectConfigDialog",className:"text-xs text-gray-500 dark:text-gray-400 mb-4",children:"Control who can access your project"}),y&&h.jsxs("div",{"data-codepal-ve-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:524:57","data-codepal-binding-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:524:57","data-codepal-module-id":"src-components-project-projectconfigdialog-tsx","data-codepal-component-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog","data-codepal-source-node-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:524:57","data-codepal-source-file":"src/components/project/ProjectConfigDialog.tsx","data-codepal-source-line":"524","data-codepal-source-column":"57","data-codepal-source-symbol":"ProjectConfigDialog",className:"mb-4 bg-red-50 dark:bg-red-900/30 border border-red-200 dark:border-red-800 rounded-md p-3 flex items-start gap-2 text-red-800 dark:text-red-300",children:[h.jsx(Rs,{className:"h-4 w-4 mt-0.5 shrink-0"}),h.jsx("p",{"data-codepal-ve-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:p:527:61","data-codepal-binding-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:p:527:61","data-codepal-module-id":"src-components-project-projectconfigdialog-tsx","data-codepal-component-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog","data-codepal-source-node-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:p:527:61","data-codepal-source-file":"src/components/project/ProjectConfigDialog.tsx","data-codepal-source-line":"527","data-codepal-source-column":"61","data-codepal-source-symbol":"ProjectConfigDialog",className:"text-sm",children:y})]}),h.jsxs("div",{"data-codepal-ve-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:531:53","data-codepal-binding-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:531:53","data-codepal-module-id":"src-components-project-projectconfigdialog-tsx","data-codepal-component-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog","data-codepal-source-node-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:531:53","data-codepal-source-file":"src/components/project/ProjectConfigDialog.tsx","data-codepal-source-line":"531","data-codepal-source-column":"53","data-codepal-source-symbol":"ProjectConfigDialog",className:"space-y-3",children:[h.jsxs("div",{"data-codepal-ve-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:532:57","data-codepal-binding-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:532:57","data-codepal-module-id":"src-components-project-projectconfigdialog-tsx","data-codepal-component-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog","data-codepal-source-node-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:532:57","data-codepal-source-file":"src/components/project/ProjectConfigDialog.tsx","data-codepal-source-line":"532","data-codepal-source-column":"57","data-codepal-source-symbol":"ProjectConfigDialog",className:ie("flex items-center justify-between p-3 rounded-md cursor-pointer transition-colors",l?"bg-white dark:bg-gray-800 shadow-sm border border-gray-100 dark:border-gray-700":"bg-gray-100 dark:bg-gray-950"),onClick:()=>!x&&z(!0),children:[h.jsxs("div",{"data-codepal-ve-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:539:61","data-codepal-binding-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:539:61","data-codepal-module-id":"src-components-project-projectconfigdialog-tsx","data-codepal-component-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog","data-codepal-source-node
276-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:539:61","data-codepal-source-file":"src/components/project/ProjectConfigDialog.tsx","data-codepal-source-line":"539","data-codepal-source-column":"61","data-codepal-source-symbol":"ProjectConfigDialog",className:"flex items-center space-x-3",children:[h.jsx(yc,{className:ie("h-4 w-4",l?"text-primary":"text-gray-500 dark:text-gray-400")}),h.jsxs("div",{"data-codepal-ve-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:544:65","data-codepal-binding-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:544:65","data-codepal-module-id":"src-components-project-projectconfigdialog-tsx","data-codepal-component-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog","data-codepal-source-node-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:544:65","data-codepal-source-file":"src/components/project/ProjectConfigDialog.tsx","data-codepal-source-line":"544","data-codepal-source-column":"65","data-codepal-source-symbol":"ProjectConfigDialog",children:[h.jsx("h3",{"data-codepal-ve-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:h3:545:69","data-codepal-binding-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:h3:545:69","data-codepal-module-id":"src-components-project-projectconfigdialog-tsx","data-codepal-component-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog","data-codepal-source-node-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:h3:545:69","data-codepal-source-file":"src/components/project/ProjectConfigDialog.tsx","data-codepal-source-line":"545","data-codepal-source-column":"69","data-codepal-source-symbol":"ProjectConfigDialog",className:"font-medium text-sm text-gray-900 dark:text-gray-100",children:"Public"}),h.jsx("p",{"data-codepal-ve-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:p:546:69","data-codepal-binding-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:p:546:69","data-codepal-module-id":"src-components-project-projectconfigdialog-tsx","data-codepal-component-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog","data-codepal-source-node-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:p:546:69","data-codepal-source-file":"src/components/project/ProjectConfigDialog.tsx","data-codepal-source-line":"546","data-codepal-source-column":"69","data-codepal-source-symbol":"ProjectConfigDialog",className:"text-xs text-gray-500 dark:text-gray-400",children:"Anyone with the link can view this project"})]})]}),h.jsx("div",{"data-codepal-ve-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:551:61","data-codepal-binding-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:551:61","data-codepal-module-id":"src-components-project-projectconfigdialog-tsx","data-codepal-component-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog","data-codepal-source-node-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:551:61","data-codepal-source-file":"src/components/project/ProjectConfigDialog.tsx","data-codepal-source-line":"551","data-codepal-source-column":"61","data-codepal-source-symbol":"ProjectConfigDialog",children:h.jsx(Xr,{checked:l,onCheckedChange:()=>!x&&z(!0),disabled:x})})]}),h.jsxs("div",{"data-codepal-ve-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:560:57","data-codepal-binding-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:560:57","data-codepal-module-id":"src-components-project-projectconfigdialog-tsx","data-codepal-component-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog","data-codepal-source-node-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:560:57","data-codepal-source-file":"src/components/project/ProjectConfigDialog.tsx","data-codepal-source-line":"560","data-codepal-source-column":"57","data-codepal-source-symbol":"ProjectConfigDialog",className:ie("flex items-center justify-between p-3 rounded-md cursor-pointer transition-colors",l?"bg-gray-100 dark:bg-gray-950":"bg-white dark:bg-gray-800 shadow-sm border border-gray-100 dark:border-gray-700"),onClick:()=>!x&&z(!1),children:[h.jsxs("div",{"data-codepal-ve-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:567:61","data-codepal-binding-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:567:61","data-codepal-module-id":"src-components-project-projectconfigdialog-tsx","data-codepal-component-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog","data-codepal-source-node
276-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:567:61","data-codepal-source-file":"src/components/project/ProjectConfigDialog.tsx","data-codepal-source-line":"567","data-codepal-source-column":"61","data-codepal-source-symbol":"ProjectConfigDialog",className:"flex items-center space-x-3",children:[h.jsx(ap,{className:ie("h-4 w-4",l?"text-gray-500 dark:text-gray-400":"text-primary")}),h.jsxs("div",{"data-codepal-ve-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:572:65","data-codepal-binding-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:572:65","data-codepal-module-id":"src-components-project-projectconfigdialog-tsx","data-codepal-component-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog","data-codepal-source-node-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:572:65","data-codepal-source-file":"src/components/project/ProjectConfigDialog.tsx","data-codepal-source-line":"572","data-codepal-source-column":"65","data-codepal-source-symbol":"ProjectConfigDialog",children:[h.jsx("h3",{"data-codepal-ve-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:h3:573:69","data-codepal-binding-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:h3:573:69","data-codepal-module-id":"src-components-project-projectconfigdialog-tsx","data-codepal-component-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog","data-codepal-source-node-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:h3:573:69","data-codepal-source-file":"src/components/project/ProjectConfigDialog.tsx","data-codepal-source-line":"573","data-codepal-source-column":"69","data-codepal-source-symbol":"ProjectConfigDialog",className:"font-medium text-sm text-gray-900 dark:text-gray-100",children:"Private"}),h.jsx("p",{"data-codepal-ve-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:p:574:69","data-codepal-binding-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:p:574:69","data-codepal-module-id":"src-components-project-projectconfigdialog-tsx","data-codepal-component-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog","data-codepal-source-node-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:p:574:69","data-codepal-source-file":"src/components/project/ProjectConfigDialog.tsx","data-codepal-source-line":"574","data-codepal-source-column":"69","data-codepal-source-symbol":"ProjectConfigDialog",className:"text-xs text-gray-500 dark:text-gray-400",children:"Only you can access this project"})]})]}),h.jsx("div",{"data-codepal-ve-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:579:61","data-codepal-binding-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:579:61","data-codepal-module-id":"src-components-project-projectconfigdialog-tsx","data-codepal-component-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog","data-codepal-source-node-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:579:61","data-codepal-source-file":"src/components/project/ProjectConfigDialog.tsx","data-codepal-source-line":"579","data-codepal-source-column":"61","data-codepal-source-symbol":"ProjectConfigDialog",children:h.jsx(Xr,{checked:!l,onCheckedChange:()=>!x&&z(!1),disabled:x})})]}),h.jsx("div",{"data-codepal-ve-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:588:57","data-codepal-binding-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:588:57","data-codepal-module-id":"src-components-project-projectconfigdialog-tsx","data-codepal-component-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog","data-codepal-source-node-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:588:57","data-codepal-source-file":"src/components/project/ProjectConfigDialog.tsx","data-codepal-source-line":"588","data-codepal-source-column":"57","data-codepal-source-symbol":"ProjectConfigDialog",className:"text-xs text-amber-600 dar
276k:text-amber-400 italic mt-2 pl-2",children:"Note: Private projects are only available for paid plans."})]})]})]})})})}),h.jsx(rr,{value:"advanced",className:"h-full m-0 p-0 data-[state=active]:block",children:h.jsxs(ir,{className:"h-full px-5 py-4",children:[N&&h.jsxs("div",{"data-codepal-ve-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:606:41","data-codepal-binding-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:606:41","data-codepal-module-id":"src-components-project-projectconfigdialog-tsx","data-codepal-component-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog","data-codepal-source-node-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:606:41","data-codepal-source-file":"src/components/project/ProjectConfigDialog.tsx","data-codepal-source-line":"606","data-codepal-source-column":"41","data-codepal-source-symbol":"ProjectConfigDialog",className:"bg-amber-50 dark:bg-amber-900/30 border border-amber-200 dark:border-amber-700 rounded-lg p-3 mb-4 flex items-start gap-2",children:[h.jsx(ym,{className:"h-4 w-4 text-amber-600 dark:text-amber-500 mt-0.5 shrink-0"}),h.jsxs("div",{"data-codepal-ve-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:610:45","data-codepal-binding-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:610:45","data-codepal-module-id":"src-components-project-projectconfigdialog-tsx","data-codepal-component-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog","data-codepal-source-node-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:610:45","data-codepal-source-file":"src/components/project/ProjectConfigDialog.tsx","data-codepal-source-line":"610","data-codepal-source-column":"45","data-codepal-source-symbol":"ProjectConfigDialog",children:[h.jsx("p",{"data-codepal-ve-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:p:611:49","data-codepal-binding-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:p:611:49","data-codepal-module-id":"src-components-project-projectconfigdialog-tsx","data-codepal-component-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog","data-codepal-source-node-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:p:611:49","data-codepal-source-file":"src/components/project/ProjectConfigDialog.tsx","data-codepal-source-line":"611","data-codepal-source-column":"49","data-codepal-source-symbol":"ProjectConfigDialog",className:"text-sm font-medium text-amber-800 dark:text-amber-500",children:"Settings cannot be edited"}),h.jsx("p",{"data-codepal-ve-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:p:613:49","data-codepal-binding-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:p:613:49","data-codepal-module-id":"src-components-project-projectconfigdialog-tsx","data-codepal-component-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog","data-codepal-source-node-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:p:613:49","data-codepal-source-file":"src/components/project/ProjectConfigDialog.tsx","data-codepal-source-line":"613","data-codepal-source-column":"49","data-codepal-source-symbol":"ProjectConfigDialog",className:"text-xs text-amber-700 dark:text-amber-400",children:"These settings cannot be modified for an existing project. To change these settings, please create a new project."})]})]}),!t.advanced_options||Object.keys(t.advanced_options).length===0?h.jsxs("div",{"data-codepal-ve-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:622:41","data-codepal-binding-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:622:41","data-codepal-module-id":"src-components-project-projectconfigdialog-tsx","data-codepal-component-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog","data-codepal-source-node-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:622:41","data-codepal-source-file":"src/components/project/ProjectConfigDialog.tsx","data-codepal-source-line":"622","data-codepal-source-column":"41","data-codepal-source-symbol":"ProjectConfigDialog",className:"bg-white dark:bg-gray-800 shadow-sm border border-gray-100 dark:border-gray-700 rounded-lg p-6 text-center",children:[h.jsx(Es,{className:"h-6 w-6 mx-auto mb-3 text-gray-400"}),h.jsx("h3",{"data-codepal-ve-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:h3:625:45","data-codepal-binding-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:h3:625:45","data-codepal-module-id":"src-components-project-projectconfigdialog-tsx","data-codepal-component-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog","data-codepal-source-node
276-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:h3:625:45","data-codepal-source-file":"src/components/project/ProjectConfigDialog.tsx","data-codepal-source-line":"625","data-codepal-source-column":"45","data-codepal-source-symbol":"ProjectConfigDialog",className:"text-base font-medium text-gray-900 dark:text-gray-100",children:"No Advanced Options"}),h.jsx("p",{"data-codepal-ve-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:p:627:45","data-codepal-binding-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:p:627:45","data-codepal-module-id":"src-components-project-projectconfigdialog-tsx","data-codepal-component-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog","data-codepal-source-node-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:p:627:45","data-codepal-source-file":"src/components/project/ProjectConfigDialog.tsx","data-codepal-source-line":"627","data-codepal-source-column":"45","data-codepal-source-symbol":"ProjectConfigDialog",className:"text-xs text-gray-500 dark:text-gray-400 mt-1.5 max-w-md mx-auto",children:"This project was created without any advanced options. Advanced options allow you to customize the behavior of tools."})]}):h.jsx("div",{"data-codepal-ve-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:633:41","data-codepal-binding-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:633:41","data-codepal-module-id":"src-components-project-projectconfigdialog-tsx","data-codepal-component-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog","data-codepal-source-node-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:633:41","data-codepal-source-file":"src/components/project/ProjectConfigDialog.tsx","data-codepal-source-line":"633","data-codepal-source-column":"41","data-codepal-source-symbol":"ProjectConfigDialog",className:"space-y-4",children:Array.from(M.entries()).map(([K,I],X)=>h.jsxs("div",{"data-codepal-ve-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:635:49","data-codepal-binding-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:635:49","data-codepal-module-id":"src-components-project-projectconfigdialog-tsx","data-codepal-component-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog","data-codepal-source-node-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:635:49","data-codepal-source-file":"src/components/project/ProjectConfigDialog.tsx","data-codepal-source-line":"635","data-codepal-source-column":"49","data-codepal-source-symbol":"ProjectConfigDialog",className:"bg-white dark:bg-gray-800 shadow-sm border border-gray-100 dark:border-gray-700 rounded-lg overflow-hidden animate-in fade-in",style:{animationDelay:`${X*50}ms`,animationDuration:"400ms"},children:[h.jsx("div",{"data-codepal-ve-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:643:53","data-codepal-binding-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:643:53","data-codepal-module-id":"src-components-project-projectconfigdialog-tsx","data-codepal-component-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog","data-codepal-source-node-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:643:53","data-codepal-source-file":"src/components/project/ProjectConfigDialog.tsx","data-codepal-source-line":"643","data-codepal-source-column":"53","data-codepal-source-symbol":"ProjectConfigDialog",className:"px-4 py-3 border-b border-gray-100 dark:border-gray-700 bg-gray-50 dark:bg-gray-900/50 flex items-center justify-between",children:h.jsx("h3",{"data-codepal-ve-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:h3:645:57","data-codepal-binding-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:h3:645:57","data-codepal-module-id":"src-components-project-projectconfigdialog-tsx","data-codepal-component-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog","data-codepal-source-node
276-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:h3:645:57","data-codepal-source-file":"src/components/project/ProjectConfigDialog.tsx","data-codepal-source-line":"645","data-codepal-source-column":"57","data-codepal-source-symbol":"ProjectConfigDialog",className:"text-sm font-medium text-gray-900 dark:text-gray-100",children:K})}),h.jsx("div",{"data-codepal-ve-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:647:53","data-codepal-binding-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:647:53","data-codepal-module-id":"src-components-project-projectconfigdialog-tsx","data-codepal-component-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog","data-codepal-source-node-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:647:53","data-codepal-source-file":"src/components/project/ProjectConfigDialog.tsx","data-codepal-source-line":"647","data-codepal-source-column":"53","data-codepal-source-symbol":"ProjectConfigDialog",className:"divide-y divide-gray-100 dark:divide-gray-700",children:I.map(T=>h.jsxs("div",{"data-codepal-ve-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:649:61","data-codepal-binding-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:649:61","data-codepal-module-id":"src-components-project-projectconfigdialog-tsx","data-codepal-component-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog","data-codepal-source-node-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:649:61","data-codepal-source-file":"src/components/project/ProjectConfigDialog.tsx","data-codepal-source-line":"649","data-codepal-source-column":"61","data-codepal-source-symbol":"ProjectConfigDialog",children:[T.type==="boolean"&&h.jsxs("div",{"data-codepal-ve-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:653:69","data-codepal-binding-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:653:69","data-codepal-module-id":"src-components-project-projectconfigdialog-tsx","data-codepal-component-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog","data-codepal-source-node-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:653:69","data-codepal-source-file":"src/components/project/ProjectConfigDialog.tsx","data-codepal-source-line":"653","data-codepal-source-column":"69","data-codepal-source-symbol":"ProjectConfigDialog",className:"flex items-center justify-between space-x-4 p-3",children:[h.jsxs("div",{"data-codepal-ve-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:655:73","data-codepal-binding-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:655:73","data-codepal-module-id":"src-components-project-projectconfigdialog-tsx","data-codepal-component-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog","data-codepal-source-node-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:655:73","data-codepal-source-file":"src/components/project/ProjectConfigDialog.tsx","data-codepal-source-line":"655","data-codepal-source-column":"73","data-codepal-source-symbol":"ProjectConfigDialog",className:"flex items-center space-x-2",children:[h.jsx(Cc,{className:"text-sm font-medium text-gray-900 dark:text-gray-100",children:T.name}),h.jsx(ra,{children:h.jsxs(Ht,{delayDuration:300,children:[h.jsx($t,{asChild:!0,children:h.jsx(Es,{className:"w-3.5 h-3.5 text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 cursor-help"})}),h.jsx(Ut,{side:"right",className:"max-w-xs",children:h.jsx("p",{"data-codepal-ve-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:p:668:89","data-codepal-binding-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:p:668:89","data-codepal-module-id":"src-components-project-projectconfigdialog-tsx","data-codepal-component-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog","data-codepal-source-node
276-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:p:668:89","data-codepal-source-file":"src/components/project/ProjectConfigDialog.tsx","data-codepal-source-line":"668","data-codepal-source-column":"89","data-codepal-source-symbol":"ProjectConfigDialog",className:"text-xs",children:T.description})})]})})]}),h.jsx(Xr,{checked:!!t.advanced_options?.[T.id],disabled:!0,className:ie("data-[state=checked]:bg-blue-600 data-[state=unchecked]:bg-gray-300","dark:data-[state=checked]:bg-blue-500 dark:data-[state=unchecked]:bg-gray-700")})]}),(T.type==="radio"||T.type==="select")&&T.levels&&h.jsxs("div",{"data-codepal-ve-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:684:69","data-codepal-binding-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:684:69","data-codepal-module-id":"src-components-project-projectconfigdialog-tsx","data-codepal-component-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog","data-codepal-source-node-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:684:69","data-codepal-source-file":"src/components/project/ProjectConfigDialog.tsx","data-codepal-source-line":"684","data-codepal-source-column":"69","data-codepal-source-symbol":"ProjectConfigDialog",className:"p-3 space-y-2",children:[h.jsxs("div",{"data-codepal-ve-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:685:73","data-codepal-binding-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:685:73","data-codepal-module-id":"src-components-project-projectconfigdialog-tsx","data-codepal-component-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog","data-codepal-source-node-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:685:73","data-codepal-source-file":"src/components/project/ProjectConfigDialog.tsx","data-codepal-source-line":"685","data-codepal-source-column":"73","data-codepal-source-symbol":"ProjectConfigDialog",className:"flex items-center justify-between",children:[h.jsxs("div",{"data-codepal-ve-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:687:77","data-codepal-binding-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:687:77","data-codepal-module-id":"src-components-project-projectconfigdialog-tsx","data-codepal-component-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog","data-codepal-source-node-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:687:77","data-codepal-source-file":"src/components/project/ProjectConfigDialog.tsx","data-codepal-source-line":"687","data-codepal-source-column":"77","data-codepal-source-symbol":"ProjectConfigDialog",className:"flex items-center space-x-2",children:[h.jsx(Cc,{className:"text-sm font-medium text-gray-900 dark:text-gray-100",children:T.name}),h.jsx(ra,{children:h.jsxs(Ht,{delayDuration:300,children:[h.jsx($t,{asChild:!0,children:h.jsx(Es,{className:"w-3.5 h-3.5 text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 cursor-help"})}),h.jsx(Ut,{side:"right",className:"max-w-xs",children:h.jsx("p",{"data-codepal-ve-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:p:701:93","data-codepal-binding-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:p:701:93","data-codepal-module-id":"src-components-project-projectconfigdialog-tsx","data-codepal-component-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog","data-codepal-source-node-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:p:701:93","data-codepal-source-file":"src/components/project/ProjectConfigDialog.tsx","data-codepal-source-line":"701","data-codepal-source-column":"93","data-codepal-source-symbol":"ProjectConfigDialog",className:"text-xs",children:T.description})})]})})]}),h.jsx("span",{"data-codepal-ve-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:span:706:77","data-codepal-binding-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:span:706:77","data-codepal-module-id":"src-components-project-projectconfigdialog-tsx","data-codepal-component-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog","data-codepal-source-node
276-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:span:706:77","data-codepal-source-file":"src/components/project/ProjectConfigDialog.tsx","data-codepal-source-line":"706","data-codepal-source-column":"77","data-codepal-source-symbol":"ProjectConfigDialog",className:"text-xs font-medium text-primary transition-colors duration-200",children:T.levels.find(O=>O.value===t.advanced_options?.[T.id])?.name||T.levels.find(O=>O.value===T.defaultValue)?.name})]}),h.jsx("div",{"data-codepal-ve-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:713:73","data-codepal-binding-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:713:73","data-codepal-module-id":"src-components-project-projectconfigdialog-tsx","data-codepal-component-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog","data-codepal-source-node-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:713:73","data-codepal-source-file":"src/components/project/ProjectConfigDialog.tsx","data-codepal-source-line":"713","data-codepal-source-column":"73","data-codepal-source-symbol":"ProjectConfigDialog",className:"flex flex-wrap gap-1",children:T.levels.map(O=>h.jsx(ra,{children:h.jsxs(Ht,{delayDuration:300,children:[h.jsx($t,{asChild:!0,children:h.jsx("div",{"data-codepal-ve-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:718:93","data-codepal-binding-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:718:93","data-codepal-module-id":"src-components-project-projectconfigdialog-tsx","data-codepal-component-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog","data-codepal-source-node-id":"src-components-project-projectconfigdialog-tsx:projectconfigdialog:div:718:93","data-codepal-source-file":"src/components/project/ProjectConfigDialog.tsx","data-codepal-source-line":"718","data-codepal-source-column":"93","data-codepal-source-symbol":"ProjectConfigDialog",className:ie("px-1.5 py-1 rounded-md text-xs transition-all","border text-center min-w-[70px] flex-1",O.value===t.advanced_options?.[T.id]?"bg-primary text-white border-primary font-medium":"bg-gray-50 text-gray-700 border-gray-200 dark:bg-gray-800 dark:text-gray-300 dark:border-gray-700"),children:O.name})}),h.jsx(Ut,{side:"bottom",className:"text-xs max-w-[180px]",children:O.description||O.name})]})},O.id))})]})]},T.id))})]},K))})]})})]})]})})]})})},Pd=({project:a,isFavorite:e=!1,onToggleFavorite:t,onShare:s,className:o})=>{const[r,i]=E.useState(!1);return h.jsxs(h.Fragment,{children:[h.jsx(ra,{children:h.jsxs(Ht,{children:[h.jsx($t,{asChild:!0,children:h.jsx(yt,{variant:"ghost",size:"icon",onClick:()=>i(!0),className:o,"aria-label":"Project settings",children:h.jsx(km,{className:"w-4 h-4 text-gray-600 dark:text-gray-400"})})}),h.jsx(Ut,{children:h.jsx("p",{"data-codepal-ve-id":"src-components-project-projectconfigbutton-tsx:projectconfigbutton:p:41:25","data-codepal-binding-id":"src-components-project-projectconfigbutton-tsx:projectconfigbutton:p:41:25","data-codepal-module-id":"src-components-project-projectconfigbutton-tsx","data-codepal-component-id":"src-components-project-projectconfigbutton-tsx:projectconfigbutton","data-codepal-source-node-id":"src-components-project-projectconfigbutton-tsx:projectconfigbutton:p:41:25","data-codepal-source-file":"src/components/project/ProjectConfigButton.tsx","data-codepal-source-line":"41","data-codepal-source-column":"25","data-codepal-source-symbol":"ProjectConfigButton",children:"Project settings"})})]})}),h.jsx(C1,{open:r,onOpenChange:i,project:a,isFavorite:e,onToggleFavorite:t,onShare:s})]})};function S1(){const{projectId:a}=Vd(),{toast:e}=po(),t=Yf(),s=E.useRef(!1),o=E.useRef(null),[r,i]=E.useState(!1),n=ge(j=>j.project),c=ge(j=>j.setProject),l=ge(j=>j.setChatMessages),d=ge(j=>j.resetDefaults),p=ge(j=>j.setActiveStreamingMessageId),u=ge(j=>j.activeStreamingMessageId),f=ge(j=>j.updateChatMessage),m=ge(j=>j.isLoadingProject),g=ge(j=>j.setIsLoadingProject),x=Gt(j=>j.user),b=x?.isStarterSubscription||!1,y=x&&n&&n.user_id===x._id,[k,A]=E.useState("chat"),[S,N]=E.useState(()=>typeof window>"u"?!1:window.matchMedia("(min-width: 1024px)").matches),D=[{value:"chat",label:"Chat"},{value:"files",label:"Files"},{value:"preview",label:"Preview"}],L={chat:"mobile-chat-panel",files:"mobile-workspace-panel",preview:"mobile-workspace-panel"},M={chat:"mobile-tab-trigger-chat",files:"mobile-tab-trigger-files",preview:"mobile-tab-trigger-preview"},B=j=>
276ie("inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1.5 text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",k===j?"bg-white text-foreground shadow-sm dark:bg-gray-800":"text-muted-foreground hover:text-foreground"),V=()=>{i(!r)},P=()=>{const j=window.location.href;navigator.clipboard&&navigator.clipboard.writeText(j).then(()=>{e({title:"Link copied!",description:"Project link copied to clipboard"})}).catch(z=>{console.error("Could not copy text: ",z)})};if(E.useEffect(()=>{if(typeof window>"u")return;const j=window.matchMedia("(min-width: 1024px)"),z=ce=>{N(ce.matches),ce.matches&&A("chat")};return N(j.matches),typeof j.addEventListener=="function"?j.addEventListener("change",z):j.addListener(z),()=>{typeof j.removeEventListener=="function"?j.removeEventListener("change",z):j.removeListener(z)}},[]),E.useEffect(()=>!a||m||n.id===a||s.current&&o.current===a?void 0:(o.current=a,(async()=>{s.current=!0;try{g(!0),n.id&&n.id!==a&&(u&&p(null),d());const z=await zd(a,{limit:10,offset:0});if(c(z),l(z.messages),z.messages_metadata)ge.getState().setMessagesMetadata(z.messages_metadata),ge.getState().setTotalMessagesCount(z.messages_metadata.total||0);else if(z.total_messages!==void 0)ge.getState().setTotalMessagesCount(z.total_messages),ge.getState().setMessagesMetadata(null);else{const $=z.messages?.length||0;ge.getState().setTotalMessagesCount($),ge.getState().setMessagesMetadata(null)}for(const $ of z.messages)if(!(z.messages.indexOf($)===z.messages.length-1)&&$.status!=="error"&&$.status!=="done"&&($.status="error"),typeof $.full_response=="string"&&!$.is_user){const I=ki($.full_response);if($.files&&I)for(const O of I)O.type==="artifact"&&typeof O.value!="string"&&O.value&&(O.value.files=$.files);const X={id:$.id,is_user:$.is_user,is_system:$.message_type==="system",message_type:$.message_type,generated_files:$.generated_files,full_response:I,status:$.status},T=I.filter(O=>O.type==="text").map(O=>O.value).join(` 277 278`);T?X.message=T:X.message="",f($.id,X,$.status)}else $.is_user?$.attachments?f($.id,{attachments:$.attachments},$.status):f($.id,{attachments:[]},$.status):$.status==="error"&&f($.id,{id:$.id,is_user:$.is_user,is_system:$.message_type==="system",message_type:$.message_type,generated_files:$.generated_files,full_response:[{type:"text",value:"Message content could not be loaded."}],status:$.status},$.status);const ce=z.messages.filter($=>!$.is_user&&$.status!=="done"&&$.status!=="error").pop();ce&&p(ce.id)}catch(z){const ce=z?.status;if(Qf(z)||ce===404){e({title:"Project unavailable",description:"This project doesn't exist or you no longer have access to it."}),t("/");return}console.error("Error loading project:",z),e({title:"Error",description:z.message,variant:"destructive"}),t("/")}finally{g(!1)}})(),()=>{o.current!==a&&(s.current=!1),u&&p(null)}),[a]),E.useEffect(()=>{a||(e({title:"Error",description:"Project doesn't exist",variant:"destructive"}),t("/"))},[a,t,e]),E.useEffect(()=>(n.title?document.title=`${n.title} - CodePal`:document.title="Untitled Project - CodePal",()=>{document.title="CodePal"}),[n.title]),!a)return h.jsx("div",{"data-codepal-ve-id":"src-pages-project-index-tsx:project:div:352:13","data-codepal-binding-id":"src-pages-project-index-tsx:project:div:352:13","data-codepal-module-id":"src-pages-project-index-tsx","data-codepal-component-id":"src-pages-project-index-tsx:project","data-codepal-source-node-id":"src-pages-project-index-tsx:project:div:352:13","data-codepal-source-file":"src/pages/Project/index.tsx","data-codepal-source-line":"352","data-codepal-source-column":"13","data-codepal-source-symbol":"Project",className:"flex items-center justify-center h-full",children:h.jsx("div",{"data-codepal-ve-id":"src-pages-project-index-tsx:project:div:353:17","data-codepal-binding-id":"src-pages-project-index-tsx:project:div:353:17","data-codepal-module-id":"src-pages-project-index-tsx","data-codepal-component-id":"src-pages-project-index-tsx:project","data-codepal-source-node-id":"src-pages-project-index-tsx:project:div:353:17","data-codepal-source-file":"src/pages/Project/index.tsx","data-codepal-source-line":"353","data-codepal-source-column":"17","data-codepal-source-symbol":"Project",className:"animate-spin h-8 w-8 border-2 border-gray-500 border-t-transparent roun
278ded-full"})});const F=k==="preview"?M.preview:M.files;return h.jsxs("main",{"data-codepal-ve-id":"src-pages-project-index-tsx:project:main:363:9","data-codepal-binding-id":"src-pages-project-index-tsx:project:main:363:9","data-codepal-module-id":"src-pages-project-index-tsx","data-codepal-component-id":"src-pages-project-index-tsx:project","data-codepal-source-node-id":"src-pages-project-index-tsx:project:main:363:9","data-codepal-source-file":"src/pages/Project/index.tsx","data-codepal-source-line":"363","data-codepal-source-column":"9","data-codepal-source-symbol":"Project",className:"flex-1 flex flex-col",children:[h.jsx(_f,{children:h.jsx("meta",{"data-codepal-ve-id":"src-pages-project-index-tsx:project:meta:365:17","data-codepal-binding-id":"src-pages-project-index-tsx:project:meta:365:17","data-codepal-module-id":"src-pages-project-index-tsx","data-codepal-component-id":"src-pages-project-index-tsx:project","data-codepal-source-node-id":"src-pages-project-index-tsx:project:meta:365:17","data-codepal-source-file":"src/pages/Project/index.tsx","data-codepal-source-line":"365","data-codepal-source-column":"17","data-codepal-source-symbol":"Project",name:"robots",content:"noindex,follow"})}),h.jsx(aj,{}),h.jsx("div",{"data-codepal-ve-id":"src-pages-project-index-tsx:project:div:369:13","data-codepal-binding-id":"src-pages-project-index-tsx:project:div:369:13","data-codepal-module-id":"src-pages-project-index-tsx","data-codepal-component-id":"src-pages-project-index-tsx:project","data-codepal-source-node-id":"src-pages-project-index-tsx:project:div:369:13","data-codepal-source-file":"src/pages/Project/index.tsx","data-codepal-source-line":"369","data-codepal-source-column":"13","data-codepal-source-symbol":"Project",className:"w-full flex justify-center",children:h.jsx("div",{"data-codepal-ve-id":"src-pages-project-index-tsx:project:div:370:17","data-codepal-binding-id":"src-pages-project-index-tsx:project:div:370:17","data-codepal-module-id":"src-pages-project-index-tsx","data-codepal-component-id":"src-pages-project-index-tsx:project","data-codepal-source-node-id":"src-pages-project-index-tsx:project:div:370:17","data-codepal-source-file":"src/pages/Project/index.tsx","data-codepal-source-line":"370","data-codepal-source-column":"17","data-codepal-source-symbol":"Project",className:ie("h-[calc(100vh-3.6rem)] w-full",S?"max-w-[calc(100vw-4rem)]":"px-3 sm:px-4"),children:S?h.jsxs(Dm,{direction:"horizontal",style:{width:"calc(100%)"},className:"h-full",children:[h.jsxs(Sc,{defaultSize:20,minSize:15,maxSize:60,className:"bg-white dark:bg-gray-900 border-gray-200 dark:border-gray-700 flex flex-col",style:{minWidth:"200px"},children:[h.jsxs("div",{"data-codepal-ve-id":"src-pages-project-index-tsx:project:div:385:33","data-codepal-binding-id":"src-pages-project-index-tsx:project:div:385:33","data-codepal-module-id":"src-pages-project-index-tsx","data-codepal-component-id":"src-pages-project-index-tsx:project","data-codepal-source-node-id":"src-pages-project-index-tsx:project:div:385:33","data-codepal-source-file":"src/pages/Project/index.tsx","data-codepal-source-line":"385","data-codepal-source-column":"33","data-codepal-source-symbol":"Project",className:"flex-1 min-h-0 flex flex-col",children:[h.jsxs("div",{"data-codepal-ve-id":"src-pages-project-index-tsx:project:div:386:37","data-codepal-binding-id":"src-pages-project-index-tsx:project:div:386:37","data-codepal-module-id":"src-pages-project-index-tsx","data-codepal-component-id":"src-pages-project-index-tsx:project","data-codepal-source-node-id":"src-pages-project-index-tsx:project:div:386:37","data-codepal-source-file":"src/pages/Project/index.tsx","data-codepal-source-line":"386","data-codepal-source-column":"37","data-codepal-source-symbol":"Project",className:"h-10 px-4 border-b border-t border-gray-200 dark:border-gray-700 bg-gray-100 dark:bg-gray-800 flex items-center justify-between",children:[h.jsx("h3",{"data-codepal-ve-id":"src-pages-project-index-tsx:project:h3:388:41","data-codepal-binding-id":"src-pages-project-index-tsx:project:h3:388:41","data-codepal-module-id":"src-pages-project-index-tsx","data-codepal-component-id":"src-pages-project-index-tsx:project","data-codepal-source-node
278-id":"src-pages-project-index-tsx:project:h3:388:41","data-codepal-source-file":"src/pages/Project/index.tsx","data-codepal-source-line":"388","data-codepal-source-column":"41","data-codepal-source-symbol":"Project",className:"font-medium text-sm truncate",children:n.title||"Untitled Project"}),h.jsx(Pd,{project:n,isFavorite:r,onToggleFavorite:V,onShare:P,className:"inline-flex items-center justify-center gap-1.5 whitespace-nowrap text-xs font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-3.5 [&_svg]:shrink-0 rounded-md h-6 w-7 p-0 dark:text-gray-400 dark:hover:text-gray-300 dark:hover:bg-gray-700 text-gray-500"})]}),y&&b&&h.jsx("div",{"data-codepal-ve-id":"src-pages-project-index-tsx:project:div:400:41","data-codepal-binding-id":"src-pages-project-index-tsx:project:div:400:41","data-codepal-module-id":"src-pages-project-index-tsx","data-codepal-component-id":"src-pages-project-index-tsx:project","data-codepal-source-node-id":"src-pages-project-index-tsx:project:div:400:41","data-codepal-source-file":"src/pages/Project/index.tsx","data-codepal-source-line":"400","data-codepal-source-column":"41","data-codepal-source-symbol":"Project",className:"p-2 mb-1 text-center text-xs bg-gradient-to-r from-amber-100 to-amber-50 dark:from-amber-900 dark:to-amber-950 text-amber-800 dark:text-amber-200 border-b border-amber-200 dark:border-amber-800 shadow-sm",children:h.jsxs("div",{"data-codepal-ve-id":"src-pages-project-index-tsx:project:div:402:45","data-codepal-binding-id":"src-pages-project-index-tsx:project:div:402:45","data-codepal-module-id":"src-pages-project-index-tsx","data-codepal-component-id":"src-pages-project-index-tsx:project","data-codepal-source-node-id":"src-pages-project-index-tsx:project:div:402:45","data-codepal-source-file":"src/pages/Project/index.tsx","data-codepal-source-line":"402","data-codepal-source-column":"45","data-codepal-source-symbol":"Project",className:"flex items-center justify-center gap-1.5",children:[h.jsx("span",{"data-codepal-ve-id":"src-pages-project-index-tsx:project:span:403:49","data-codepal-binding-id":"src-pages-project-index-tsx:project:span:403:49","data-codepal-module-id":"src-pages-project-index-tsx","data-codepal-component-id":"src-pages-project-index-tsx:project","data-codepal-source-node-id":"src-pages-project-index-tsx:project:span:403:49","data-codepal-source-file":"src/pages/Project/index.tsx","data-codepal-source-line":"403","data-codepal-source-column":"49","data-codepal-source-symbol":"Project",className:"font-medium pt-0.5",children:"Basic Model in Use ·"}),h.jsx("a",{"data-codepal-ve-id":"src-pages-project-index-tsx:project:a:404:49","data-codepal-binding-id":"src-pages-project-index-tsx:project:a:404:49","data-codepal-module-id":"src-pages-project-index-tsx","data-codepal-component-id":"src-pages-project-index-tsx:project","data-codepal-source-node-id":"src-pages-project-index-tsx:project:a:404:49","data-codepal-source-file":"src/pages/Project/index.tsx","data-codepal-source-line":"404","data-codepal-source-column":"49","data-codepal-source-symbol":"Project",href:"/pricing",target:"_blank",className:"text-amber-700 dark:text-amber-400 hover:text-amber-900 dark:hover:text-amber-300 underline underline-offset-2 text-xs font-medium transition-colors",children:"Upgrade Now"})]})}),h.jsx("div",{"data-codepal-ve-id":"src-pages-project-index-tsx:project:div:411:37","data-codepal-binding-id":"src-pages-project-index-tsx:project:div:411:37","data-codepal-module-id":"src-pages-project-index-tsx","data-codepal-component-id":"src-pages-project-index-tsx:project","data-codepal-source-node-id":"src-pages-project-index-tsx:project:div:411:37","data-codepal-source-file":"src/pages/Project/index.tsx","data-codepal-source-line":"411","data-codepal-source-column":"37","data-codepal-source-symbol":"Project",className:"flex-1 min-h-0",children:m?h.jsx(xn,{}):h.jsx(bn,{})})]}),h.jsx(kc,{})]}),h.jsx(Tm,{className:"bg-gray-200 dark:bg-gray-700 hover:bg-gray-300 dark:hover:bg-gray-600 transition-colors"}),h.jsx(Sc,{defaultSize:80,minSize:40,maxSize:85,className:"",children:h.jsx("div",{"data-codepal-ve-id":"src-pages-project-index-tsx:project:div:427:33","data-codepal-binding-id":"src-pages-project-index-tsx:project:div:427:33","data-codepal-module-id":"src-pages-project-index-tsx","data-codepal-component-id":"src-pages-project-index-tsx:project","data-codepal-source-node
278-id":"src-pages-project-index-tsx:project:div:427:33","data-codepal-source-file":"src/pages/Project/index.tsx","data-codepal-source-line":"427","data-codepal-source-column":"33","data-codepal-source-symbol":"Project",className:"h-full",children:h.jsx(Sd,{})})})]}):h.jsxs("div",{"data-codepal-ve-id":"src-pages-project-index-tsx:project:div:433:25","data-codepal-binding-id":"src-pages-project-index-tsx:project:div:433:25","data-codepal-module-id":"src-pages-project-index-tsx","data-codepal-component-id":"src-pages-project-index-tsx:project","data-codepal-source-node-id":"src-pages-project-index-tsx:project:div:433:25","data-codepal-source-file":"src/pages/Project/index.tsx","data-codepal-source-line":"433","data-codepal-source-column":"25","data-codepal-source-symbol":"Project",className:"flex h-full flex-col overflow-hidden rounded-xl border border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-900 shadow-sm",children:[h.jsxs("div",{"data-codepal-ve-id":"src-pages-project-index-tsx:project:div:435:29","data-codepal-binding-id":"src-pages-project-index-tsx:project:div:435:29","data-codepal-module-id":"src-pages-project-index-tsx","data-codepal-component-id":"src-pages-project-index-tsx:project","data-codepal-source-node-id":"src-pages-project-index-tsx:project:div:435:29","data-codepal-source-file":"src/pages/Project/index.tsx","data-codepal-source-line":"435","data-codepal-source-column":"29","data-codepal-source-symbol":"Project",className:"px-4 py-3 border-b border-gray-200 dark:border-gray-700 bg-gray-100 dark:bg-gray-800 flex items-center justify-between",children:[h.jsx("h3",{"data-codepal-ve-id":"src-pages-project-index-tsx:project:h3:437:33","data-codepal-binding-id":"src-pages-project-index-tsx:project:h3:437:33","data-codepal-module-id":"src-pages-project-index-tsx","data-codepal-component-id":"src-pages-project-index-tsx:project","data-codepal-source-node-id":"src-pages-project-index-tsx:project:h3:437:33","data-codepal-source-file":"src/pages/Project/index.tsx","data-codepal-source-line":"437","data-codepal-source-column":"33","data-codepal-source-symbol":"Project",className:"font-medium text-base truncate pr-4",children:n.title||"Untitled Project"}),h.jsx(Pd,{project:n,isFavorite:r,onToggleFavorite:V,onShare:P,className:"inline-flex items-center justify-center gap-1 whitespace-nowrap text-xs font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-3 [&_svg]:shrink-0 rounded-md h-7 w-7 p-0 dark:text-gray-300 dark:hover:text-gray-200 dark:hover:bg-gray-700 text-gray-500"})]}),y&&b&&h.jsx("div",{"data-codepal-ve-id":"src-pages-project-index-tsx:project:div:449:33","data-codepal-binding-id":"src-pages-project-index-tsx:project:div:449:33","data-codepal-module-id":"src-pages-project-index-tsx","data-codepal-component-id":"src-pages-project-index-tsx:project","data-codepal-source-node-id":"src-pages-project-index-tsx:project:div:449:33","data-codepal-source-file":"src/pages/Project/index.tsx","data-codepal-source-line":"449","data-codepal-source-column":"33","data-codepal-source-symbol":"Project",className:"px-4 py-2 text-center text-xs bg-gradient-to-r from-amber-100 to-amber-50 dark:from-amber-900 dark:to-amber-950 text-amber-800 dark:text-amber-200 border-b border-amber-200 dark:border-amber-800",children:h.jsxs("div",{"data-codepal-ve-id":"src-pages-project-index-tsx:project:div:451:37","data-codepal-binding-id":"src-pages-project-index-tsx:project:div:451:37","data-codepal-module-id":"src-pages-project-index-tsx","data-codepal-component-id":"src-pages-project-index-tsx:project","data-codepal-source-node-id":"src-pages-project-index-tsx:project:div:451:37","data-codepal-source-file":"src/pages/Project/index.tsx","data-codepal-source-line":"451","data-codepal-source-column":"37","data-codepal-source-symbol":"Project",className:"flex items-center justify-center gap-1.5",children:[h.jsx("span",{"data-codepal-ve-id":"src-pages-project-index-tsx:project:span:452:41","data-codepal-binding-id":"src-pages-project-index-tsx:project:span:452:41","data-codepal-module-id":"src-pages-project-index-tsx","data-codepal-component-id":"src-pages-project-index-tsx:project","data-codepal-source-node
278-id":"src-pages-project-index-tsx:project:span:452:41","data-codepal-source-file":"src/pages/Project/index.tsx","data-codepal-source-line":"452","data-codepal-source-column":"41","data-codepal-source-symbol":"Project",className:"font-medium",children:"Basic Model in Use ·"}),h.jsx("a",{"data-codepal-ve-id":"src-pages-project-index-tsx:project:a:453:41","data-codepal-binding-id":"src-pages-project-index-tsx:project:a:453:41","data-codepal-module-id":"src-pages-project-index-tsx","data-codepal-component-id":"src-pages-project-index-tsx:project","data-codepal-source-node-id":"src-pages-project-index-tsx:project:a:453:41","data-codepal-source-file":"src/pages/Project/index.tsx","data-codepal-source-line":"453","data-codepal-source-column":"41","data-codepal-source-symbol":"Project",href:"/pricing",target:"_blank",className:"text-amber-700 dark:text-amber-400 hover:text-amber-900 dark:hover:text-amber-300 underline underline-offset-2 text-xs font-medium transition-colors",children:"Upgrade Now"})]})}),h.jsx("div",{"data-codepal-ve-id":"src-pages-project-index-tsx:project:div:460:29","data-codepal-binding-id":"src-pages-project-index-tsx:project:div:460:29","data-codepal-module-id":"src-pages-project-index-tsx","data-codepal-component-id":"src-pages-project-index-tsx:project","data-codepal-source-node-id":"src-pages-project-index-tsx:project:div:460:29","data-codepal-source-file":"src/pages/Project/index.tsx","data-codepal-source-line":"460","data-codepal-source-column":"29","data-codepal-source-symbol":"Project",className:"px-3 pt-3 pb-2",children:h.jsx("div",{"data-codepal-ve-id":"src-pages-project-index-tsx:project:div:461:33","data-codepal-binding-id":"src-pages-project-index-tsx:project:div:461:33","data-codepal-module-id":"src-pages-project-index-tsx","data-codepal-component-id":"src-pages-project-index-tsx:project","data-codepal-source-node-id":"src-pages-project-index-tsx:project:div:461:33","data-codepal-source-file":"src/pages/Project/index.tsx","data-codepal-source-line":"461","data-codepal-source-column":"33","data-codepal-source-symbol":"Project",role:"tablist","aria-label":"Project sections",className:"grid grid-cols-3 gap-1 rounded-lg bg-muted p-1",children:D.map(({value:j,label:z})=>h.jsx("button",{"data-codepal-ve-id":"src-pages-project-index-tsx:project:button:467:41","data-codepal-binding-id":"src-pages-project-index-tsx:project:button:467:41","data-codepal-module-id":"src-pages-project-index-tsx","data-codepal-component-id":"src-pages-project-index-tsx:project","data-codepal-source-node-id":"src-pages-project-index-tsx:project:button:467:41","data-codepal-source-file":"src/pages/Project/index.tsx","data-codepal-source-line":"467","data-codepal-source-column":"41","data-codepal-source-symbol":"Project",type:"button",id:M[j],role:"tab","aria-selected":k===j,"aria-controls":L[j],className:B(j),onClick:()=>A(j),children:z},j))})}),h.jsxs("div",{"data-codepal-ve-id":"src-pages-project-index-tsx:project:div:482:29","data-codepal-binding-id":"src-pages-project-index-tsx:project:div:482:29","data-codepal-module-id":"src-pages-project-index-tsx","data-codepal-component-id":"src-pages-project-index-tsx:project","data-codepal-source-node-id":"src-pages-project-index-tsx:project:div:482:29","data-codepal-source-file":"src/pages/Project/index.tsx","data-codepal-source-line":"482","data-codepal-source-column":"29","data-codepal-source-symbol":"Project",className:"flex-1 min-h-0 px-0",children:[h.jsxs("div",{"data-codepal-ve-id":"src-pages-project-index-tsx:project:div:483:33","data-codepal-binding-id":"src-pages-project-index-tsx:project:div:483:33","data-codepal-module-id":"src-pages-project-index-tsx","data-codepal-component-id":"src-pages-project-index-tsx:project","data-codepal-source-node-id":"src-pages-project-index-tsx:project:div:483:33","data-codepal-source-file":"src/pages/Project/index.tsx","data-codepal-source-line":"483","data-codepal-source-column":"33","data-codepal-source-symbol":"Project",id:"mobile-chat-panel",role:"tabpanel","aria-labelledby":M.chat,className:ie("flex h-full flex-col",k!=="chat"&&"hidden"),children:[h.jsx("div",{"data-codepal-ve-id":"src-pages-project-index-tsx:project:div:489:37","data-codepal-binding-id":"src-pages-project-index-tsx:project:div:489:37","data-codepal-module-id":"src-pages-project-index-tsx","data-codepal-component-id":"src-pages-project-index-tsx:project","data-codepal-source-node
278-id":"src-pages-project-index-tsx:project:div:489:37","data-codepal-source-file":"src/pages/Project/index.tsx","data-codepal-source-line":"489","data-codepal-source-column":"37","data-codepal-source-symbol":"Project",className:"flex-1 min-h-0",children:m?h.jsx(xn,{}):h.jsx(bn,{})}),h.jsx("div",{"data-codepal-ve-id":"src-pages-project-index-tsx:project:div:496:37","data-codepal-binding-id":"src-pages-project-index-tsx:project:div:496:37","data-codepal-module-id":"src-pages-project-index-tsx","data-codepal-component-id":"src-pages-project-index-tsx:project","data-codepal-source-node-id":"src-pages-project-index-tsx:project:div:496:37","data-codepal-source-file":"src/pages/Project/index.tsx","data-codepal-source-line":"496","data-codepal-source-column":"37","data-codepal-source-symbol":"Project",className:"border-t border-gray-200 dark:border-gray-800 bg-gray-50 dark:bg-gray-900/60",children:h.jsx(kc,{})})]}),h.jsx("div",{"data-codepal-ve-id":"src-pages-project-index-tsx:project:div:501:33","data-codepal-binding-id":"src-pages-project-index-tsx:project:div:501:33","data-codepal-module-id":"src-pages-project-index-tsx","data-codepal-component-id":"src-pages-project-index-tsx:project","data-codepal-source-node-id":"src-pages-project-index-tsx:project:div:501:33","data-codepal-source-file":"src/pages/Project/index.tsx","data-codepal-source-line":"501","data-codepal-source-column":"33","data-codepal-source-symbol":"Project",id:"mobile-workspace-panel",role:"tabpanel","aria-labelledby":F,className:ie("flex h-full flex-col",k==="chat"&&"hidden"),children:h.jsx("div",{"data-codepal-ve-id":"src-pages-project-index-tsx:project:div:507:37","data-codepal-binding-id":"src-pages-project-index-tsx:project:div:507:37","data-codepal-module-id":"src-pages-project-index-tsx","data-codepal-component-id":"src-pages-project-index-tsx:project","data-codepal-source-node-id":"src-pages-project-index-tsx:project:div:507:37","data-codepal-source-file":"src/pages/Project/index.tsx","data-codepal-source-line":"507","data-codepal-source-column":"37","data-codepal-source-symbol":"Project",className:"flex-1 min-h-0",children:h.jsx(Sd,{mobileLayoutMode:k==="preview"?"preview":"files"})})})]})]})})}),!u&&h.jsx(Cm,{})]})}const I2=Object.freeze(Object.defineProperty({__proto__:null,default:S1},Symbol.toStringTag,{value:"Module"}));export{Gn as A,Fr as B,Aa as C,Nm as D,pe as E,E2 as F,_e as G,q as H,Be as I,es as J,I2 as K,pn as L,Dn as N,np as P,Le as T,Lb as a,T2 as b,A2 as c,D2 as d,Je as e,Ub as f,ct as g,ye as h,Ru as i,M2 as j,ae as k,_2 as l,P2 as m,w2 as n,N2 as o,y2 as p,p0 as q,Db as r,_b as s,w as t,Ou as u,ft as v,gt as w,$b as x,Tr as y,is as z};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.