@vantaloom/runtime-win32-x64 0.6.47 → 0.6.48

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -22,7 +22,7 @@ ${n.map(([e,n])=>{let r=n.theme?.[t]??n.color;return r?` --color-${e}: ${r};`:n
22
22
  ${e.detail}`:e.title;async function l(){try{await navigator.clipboard.writeText(o??""),i(!0),window.setTimeout(()=>i(!1),1500)}catch{}}return(0,ey.jsxs)("article",{className:"vtl-agent-event-row group","data-kind":e.kind,children:[(0,ey.jsx)("div",{"data-streaming":e.isStreaming?"true":"false",children:(0,ey.jsx)(Vw,{content:o,isStreaming:e.isStreaming})}),e.isStreaming||!n?null:(0,ey.jsxs)(Vd,{className:(0,eI.cn)("mt-0.5 gap-0.5 transition-opacity","opacity-0 focus-within:opacity-100 group-hover:opacity-100 max-md:opacity-100"),children:[(0,ey.jsx)(Vu,{type:"button","aria-label":t?.copyReply??"复制",title:t?.copyReply??"复制",onClick:()=>void l(),children:a?(0,ey.jsx)(pR,{}):(0,ey.jsx)(lU,{})}),r?(0,ey.jsx)(Vu,{type:"button","aria-label":t?.branch??"从此处分支对话",title:t?.branch??"从此处分支对话",onClick:()=>r?.(e),children:(0,ey.jsx)(Vl,{})}):null]})]})}let VP=ew.memo(function({event:e,autoOpen:t,showActions:n,labels:r,onOpenFile:a,onOpenSubagent:i,onRecallUserMessage:o,onBranchAssistantMessage:l,onRetry:s,onApprovalDecision:c,onContinue:d}){return"approval"===e.kind?(0,ey.jsx)(Vz,{event:e,onApprovalDecision:c}):"user"===e.kind?(0,ey.jsx)(VE,{event:e,labels:r,onRecallUserMessage:o}):"assistant"===e.kind||"done"===e.kind?Vj(e)?null:(0,ey.jsx)(VO,{event:e,labels:r,showActions:n,onBranchAssistantMessage:l}):"toolgroup"===e.kind?(0,ey.jsx)(VG,{event:e,labels:r,onOpenFile:a,onOpenSubagent:i}):("read"===e.kind||"search"===e.kind||"tool"===e.kind)&&(e.files?.length||e.detail?.trim())?(0,ey.jsx)("article",{className:"vtl-agent-event-row","data-kind":e.kind,children:(0,ey.jsx)(VX,{event:e,autoOpen:t,children:(0,ey.jsx)(VT,{event:e,onOpenFile:a})})}):"subagent"===e.kind&&e.subagents?.length?(0,ey.jsx)("article",{className:"vtl-agent-event-row","data-kind":e.kind,children:(0,ey.jsx)(VV,{event:e,onOpenSubagent:i})}):"change"===e.kind?(0,ey.jsx)(VY,{event:e,onOpenFile:a}):"thought"===e.kind?(0,ey.jsx)(VK,{event:e,labels:r}):"compression"===e.kind?(0,ey.jsxs)("article",{className:"vtl-agent-event-row","data-kind":"compression",children:[(0,ey.jsxs)("div",{className:"vtl-agent-compression-divider",children:[(0,ey.jsx)("div",{className:"vtl-agent-compression-line"}),(0,ey.jsx)("span",{className:"vtl-agent-compression-label",children:e.title}),(0,ey.jsx)("div",{className:"vtl-agent-compression-line"})]}),e.detail&&(0,ey.jsx)("div",{className:"vtl-agent-compression-detail",children:e.detail})]}):"limit"===e.kind?(0,ey.jsx)("article",{className:"vtl-agent-event-row","data-kind":"limit",children:(0,ey.jsxs)("div",{className:"vtl-agent-limit-card",children:[(0,ey.jsx)("span",{className:"vtl-agent-limit-title",children:e.title}),e.detail&&(0,ey.jsx)("span",{className:"vtl-agent-limit-detail",children:e.detail}),d&&(0,ey.jsxs)(eA.Button,{type:"button",size:"sm",variant:"outline",className:"vtl-agent-limit-continue",onClick:d,children:[(0,ey.jsx)(Vs,{className:"mr-1.5 size-3"}),e.actionLabel??"继续"]})]})}):"error"===e.kind?(0,ey.jsx)(Vq,{event:e,onRetry:s}):(0,ey.jsx)(VW,{event:e})}),VA={safe:{text:"安全",className:"vtl-approval-badge-safe"},normal:{text:"常规",className:"vtl-approval-badge-normal"},risky:{text:"风险",className:"vtl-approval-badge-risky"},dangerous:{text:"危险",className:"vtl-approval-badge-dangerous"}},VI={recursive_deletion:"递归删除",force_flag:"强制覆盖",network_access:"网络访问",system_modification:"系统修改",process_management:"进程管理",pipe_to_interpreter:"管道执行",dynamic_execution:"动态执行",git_destructive:"Git 破坏性操作",env_modification:"环境变量修改",registry_modification:"注册表修改",system_destructive:"系统破坏性",parse_error:"解析错误"};function Vz({event:e,onApprovalDecision:t}){let n=function(e){if(!e)return null;try{return JSON.parse(e)}catch{return null}}(e.meta),r="pending"===e.status,a="done"===e.status,i="failed"===e.status,o=(n?VA[n.classification]:void 0)??{text:"常规",className:"vtl-approval-badge-normal"};return(0,ey.jsx)("article",{className:"vtl-agent-event-row","data-kind":"approval",children:(0,ey.jsxs)("div",{className:(0,eI.cn)("vtl-approval-card",r&&"vtl-approval-pending",a&&"vtl-approval-approved",i&&"vtl-approval-rejected"),children:[(0,ey.jsxs)("div",{className:"vtl-approval-header",children:[(0,ey.jsx)("span",{className:(0,eI.cn)("vtl-approval-badge",o.className),children:o.text}),(0,ey.jsx)("span",{className:"vtl-approval-label",children:r?"需要确认":a?"已放行":"已拒绝"}),n?.toolName&&(0,ey.jsx)("span",{className:"vtl-approval-tool",children:n.toolName})]}),(0,ey.jsx)("div",{className:"vtl-approval-command",children:(0,ey.jsx)("code",{children:e.title})}),e.detail&&!a&&!i&&(0,ey.jsx)("div",{className:"vtl-approval-reason",children:e.detail}),n?.riskFactors&&n.riskFactors.length>0&&r&&(0,ey.jsx)("div",{className:"vtl-approval-risks",children:n.riskFactors.map(e=>(0,ey.jsx)("span",{className:"vtl-approval-risk-tag",children:VI[e]??e},e))}),(a||i)&&e.detail&&(0,ey.jsx)("div",{className:"vtl-approval-resolved-detail",children:e.detail}),r&&t&&n&&(0,ey.jsxs)("div",{className:"vtl-approval-actions",children:[(0,ey.jsx)("button",{type:"button",className:"vtl-approval-btn vtl-approval-btn-approve",onClick:()=>t(n.approvalId,"approve"),children:"放行"}),(0,ey.jsx)("button",{type:"button",className:"vtl-approval-btn vtl-approval-btn-reject",onClick:()=>t(n.approvalId,"reject"),children:"拒绝"})]})]})})}function VT({event:e,onOpenFile:t}){if(e.shellMeta)return(0,ey.jsx)(VD,{event:e,onOpenFile:t});let n=function(e){var t;let n=e.files?.map((t,n)=>VR(e,t,n))??[],r=e.detail?.trim()&&("read"!==e.kind||e.actionLabel?.trim()==="探索")?Vf(e.detail.replace(/\r\n/g,"\n")).trimEnd():"";return r?e.actionLabel?.trim()==="探索"?(t=function(e,t){let n,r,a,i,o=(n=[],r=[],a=[],i=null,t.split("\n").forEach((e,t)=>{let o=e.trim();if(!o)return;if(o.startsWith("hint:"))return void a.push({key:`hint-${t}`,label:o.replace(/^hint:\s*/,""),level:0,kind:"hint"});let l=Math.max(0,Math.floor((e.match(/^ */)?.[0].length??0)/2)),s=/[\\/]$/.test(o),c={key:`detail-${t}-${o}`,label:o.replace(/[\\/]+$/,""),level:l,kind:s?"folder":"file"};if(0===l){i={root:c,children:[]},n.push(i);return}i?i.children.push(c):r.push(c)}),{sections:n,orphans:r,hints:a});if(!o.sections.length&&!o.orphans.length)return[...e,...o.hints];let l=new Set,s=[];return e.forEach(e=>{s.push(e);let t=o.sections.findIndex((t,n)=>!l.has(n)&&VL(t.root.label)===VL(e.label));t>=0&&(l.add(t),s.push(...function(e,t,n){if(!t)return e;let r=[];return e.map(e=>{var a,i;let o,l=Math.max(0,e.level-1);return(r.length=l,r[l]=e.label,"file"!==e.kind)?e:{...e,file:{id:e.key,name:e.label,machineId:n,path:(a=t,i=r.slice(0,l+1),o=a.includes("\\")?"\\":"/",[a.replace(/[\\/]+$/,""),...i.map(e=>e.replace(/^[\\/]+|[\\/]+$/g,""))].filter(Boolean).join(o))}}})}(o.sections[t]?.children??[],e.file?.path,e.file?.machineId)))}),o.sections.forEach((e,t)=>{l.has(t)||s.push(e.root,...e.children)}),s.push(...o.orphans,...o.hints),s}(n,r)).map((e,n)=>{if(e.level<=0)return e;let r=Array.from({length:e.level-1},(e,r)=>V$(t,n,r+1));return{...e,branch:{ancestorLines:r,isLast:!V$(t,n,e.level)}}}):[...n,...r.split("\n").map((e,t)=>{let n=e.trim();return n?n.startsWith("hint:")?{key:`detail-hint-${t}`,label:n.replace(/^hint:\s*/,""),level:0,kind:"hint"}:{key:`detail-plain-${t}`,label:n,level:Math.max(0,Math.floor((e.match(/^ */)?.[0].length??0)/2)),kind:"plain"}:null}).filter(e=>!!e)]:n}(e);return n.length?(0,ey.jsx)("div",{className:"vtl-agent-tool-result","data-kind":e.actionLabel?.trim()==="探索"?"tree":e.kind,children:n.map(e=>(0,ey.jsx)(V_,{row:e,onOpenFile:t},e.key))}):null}function VD({event:e,onOpenFile:t}){let n=e.shellMeta,r=e.detail?Vf(e.detail).trim():void 0,a=e.files?.map((t,n)=>VR(e,t,n))??[],i=ew.useCallback((e,t)=>{t.stopPropagation(),navigator.clipboard?.writeText(e)},[]),o="completed"===n.status||"done"===n.status?"shell-ok":"failed"===n.status||"timeout"===n.status?"shell-err":"shell-run",l=void 0!==n.exitCode&&null!==n.exitCode?0===n.exitCode:void 0;return(0,ey.jsxs)("div",{className:"vtl-agent-tool-result","data-kind":"shell",children:[(0,ey.jsxs)("div",{className:"vtl-shell-status-bar",children:[n.commandId?(0,ey.jsx)("button",{type:"button",className:"vtl-shell-chip",title:`命令 ID: ${n.commandId}
23
23
  点击复制`,onClick:e=>i(n.commandId,e),children:n.commandId}):null,n.logId?(0,ey.jsx)("button",{type:"button",className:"vtl-shell-chip",title:`日志 ID: ${n.logId}
24
24
  点击复制`,onClick:e=>i(n.logId,e),children:n.logId.replace(/^artifacts\//,"")}):null,n.cwd?(0,ey.jsx)("button",{type:"button",className:"vtl-shell-chip vtl-shell-chip-cwd",title:`工作目录: ${n.cwd}
25
- 点击复制`,onClick:e=>i(n.cwd,e),children:n.cwd}):null,(0,ey.jsx)("span",{className:"vtl-shell-spacer"}),n.status?(0,ey.jsx)("span",{className:`vtl-shell-badge ${o}`,children:n.status}):null,void 0!==l?(0,ey.jsxs)("span",{className:`vtl-shell-badge ${l?"shell-ok":"shell-err"}`,children:["exit ",n.exitCode]}):null,n.durationMs?(0,ey.jsx)("span",{className:"vtl-shell-badge shell-time",children:n.durationMs>=1e3?`${(n.durationMs/1e3).toFixed(1)}s`:`${n.durationMs}ms`}):null]}),r?(0,ey.jsx)("pre",{className:"vtl-shell-output",children:r}):null,a.length>0?(0,ey.jsx)("div",{className:"vtl-agent-tool-result","data-kind":"tool",children:a.map(e=>(0,ey.jsx)(V_,{row:e,onOpenFile:t},e.key))}):null]})}function V_({row:e,onOpenFile:t}){let n=(0,ey.jsxs)(ey.Fragment,{children:[(0,ey.jsxs)("span",{className:"vtl-agent-tool-row-tree","aria-hidden":"true","data-level":e.level,children:[e.branch?.ancestorLines.map((e,t)=>(0,ey.jsx)("span",{className:"vtl-agent-tool-row-tree-ancestor","data-active":e?"true":void 0},`ancestor-${t}`)),e.level>0?(0,ey.jsx)("span",{className:"vtl-agent-tool-row-tree-elbow","data-last":e.branch?.isLast?"true":void 0}):null,(0,ey.jsx)("span",{className:"vtl-agent-tool-row-icon",children:"folder"===e.kind?"▾":""})]}),(0,ey.jsx)("span",{className:"vtl-agent-tool-row-label",children:e.label}),e.meta?(0,ey.jsx)("em",{children:e.meta}):null]}),r={"--tool-tree-indent":`${13*Math.min(e.level,8)}px`,"--tool-tree-level":Math.min(e.level,8)};return e.file&&"file"===e.kind?(0,ey.jsx)("button",{type:"button",className:"vtl-agent-tool-row","data-kind":e.kind,style:r,onClick:()=>t?.(e.file),children:n}):(0,ey.jsx)("div",{className:"vtl-agent-tool-row","data-kind":e.kind,style:r,children:n})}function VR(e,t,n){let r=e.actionLabel?.trim()==="探索"||t.meta?.toLowerCase().startsWith("depth")||/[\\/]$/.test(t.name)||!!(t.path&&/[\\/]$/.test(t.path)),a=VZ(t.name||t.path||"untitled");return{key:t.id??`file-${n}-${t.path??t.name}`,label:a,level:0,kind:r?"folder":"file",meta:t.lines??t.meta,file:t}}function VL(e){return VZ(e.replace(/[\\/]+$/,"")).toLowerCase()}function V$(e,t,n){for(let r=t+1;r<e.length;r+=1){let t=e[r]?.level??0;if(t<n)break;if(t===n)return!0}return!1}let VF={explore:{label:"探索",color:"text-sky-600 dark:text-sky-400",Icon:Vo},workflow:{label:"工作流",color:"text-violet-600 dark:text-violet-400",Icon:uk},operator:{label:"操作员",color:"text-pink-600 dark:text-pink-400",Icon:uj},custom:{label:"自定义",color:"text-amber-600 dark:text-amber-400",Icon:um}};function VB(e){return VF[e??""]??{label:"子代理",color:"text-muted-foreground",Icon:um}}function VV({event:e,onOpenSubagent:t}){return(0,ey.jsx)("div",{className:"grid gap-2",children:e.subagents?.map(n=>(0,ey.jsx)(VH,{subagent:n,event:e,onOpenSubagent:t},n.id||n.title))})}function VH({subagent:e,event:t,onOpenSubagent:n}){let[r,a]=ew.useState(!1),i=VB(e.subagentType),o=e.status??(e.isRunning?"running":"done"),l=!!e.isRunning||"running"===o,s="failed"===o,c=e.name||`${i.label}子代理`,d=(e.result??t.detail??"").trim(),u=i.Icon,f=!!e.inline;return(0,ey.jsxs)("section",{className:(0,eI.cn)("overflow-hidden rounded-lg border bg-card/60",s&&"border-destructive/40"),"data-subagent-card":!0,"data-running":l?"true":void 0,children:[f?(0,ey.jsxs)("div",{className:"flex w-full items-center gap-2.5 px-3 py-2 text-left",children:[(0,ey.jsx)("span",{className:(0,eI.cn)("flex size-6 shrink-0 items-center justify-center rounded-md bg-muted/60",i.color),children:(0,ey.jsx)(u,{className:"size-3.5"})}),(0,ey.jsxs)("span",{className:"flex min-w-0 flex-1 flex-col",children:[(0,ey.jsxs)("span",{className:"flex items-center gap-1.5 text-[13px] font-medium",children:[(0,ey.jsx)("span",{className:"truncate",children:c}),(0,ey.jsx)("span",{className:"shrink-0 rounded bg-muted px-1 py-px text-[10px] font-normal text-muted-foreground",children:i.label})]}),e.title?(0,ey.jsx)("span",{className:"truncate text-xs text-muted-foreground",children:e.title}):null]}),(0,ey.jsx)(VU,{status:o,running:l})]}):(0,ey.jsxs)("button",{type:"button",className:"flex w-full items-center gap-2.5 px-3 py-2 text-left transition-colors hover:bg-accent/40",onClick:()=>n?.(e,t),title:"打开子代理对话",children:[(0,ey.jsx)("span",{className:(0,eI.cn)("flex size-6 shrink-0 items-center justify-center rounded-md bg-muted/60",i.color),children:(0,ey.jsx)(u,{className:"size-3.5"})}),(0,ey.jsxs)("span",{className:"flex min-w-0 flex-1 flex-col",children:[(0,ey.jsxs)("span",{className:"flex items-center gap-1.5 text-[13px] font-medium",children:[(0,ey.jsx)("span",{className:"truncate",children:c}),(0,ey.jsx)("span",{className:"shrink-0 rounded bg-muted px-1 py-px text-[10px] font-normal text-muted-foreground",children:i.label})]}),e.title?(0,ey.jsx)("span",{className:"truncate text-xs text-muted-foreground",children:e.title}):null]}),(0,ey.jsx)(VU,{status:o,running:l})]}),d?(0,ey.jsx)("div",{className:"border-t",children:f?(0,ey.jsx)("div",{className:"max-h-72 overflow-auto whitespace-pre-wrap px-3 py-2 text-xs leading-relaxed text-foreground/80",children:d}):(0,ey.jsxs)(ey.Fragment,{children:[(0,ey.jsxs)("button",{type:"button",className:"flex w-full items-center gap-1 px-3 py-1.5 text-left text-xs text-muted-foreground transition-colors hover:text-foreground",onClick:()=>a(e=>!e),"aria-expanded":r,children:[(0,ey.jsx)(p$,{className:(0,eI.cn)("size-3 transition-transform",r&&"rotate-90")}),r?"收起结果":"查看结果"]}),r?(0,ey.jsx)("div",{className:"max-h-72 overflow-auto whitespace-pre-wrap px-3 pb-3 text-xs leading-relaxed text-foreground/80",children:d}):null]})}):null]})}function VU({status:e,running:t}){return t?(0,ey.jsxs)("span",{className:"flex shrink-0 items-center gap-1 text-xs text-muted-foreground",children:[(0,ey.jsx)(eM,{className:"size-3 animate-spin"}),"运行中"]}):"failed"===e?(0,ey.jsxs)("span",{className:"flex shrink-0 items-center gap-1 text-xs text-destructive",children:[(0,ey.jsx)(hb,{className:"size-3"}),"失败"]}):(0,ey.jsxs)("span",{className:"flex shrink-0 items-center gap-1 text-xs text-emerald-600 dark:text-emerald-500",children:[(0,ey.jsx)(eO,{className:"size-3"}),"完成"]})}function VW({event:e}){return(0,ey.jsx)("article",{className:"vtl-agent-event-row","data-kind":e.kind,children:(0,ey.jsxs)("p",{className:"vtl-agent-action-line",children:[e.actionLabel?(0,ey.jsx)("strong",{children:e.actionLabel}):null,e.title,e.meta?(0,ey.jsx)("em",{children:e.meta}):null]})})}function Vq({event:e,onRetry:t}){return(0,ey.jsx)("article",{className:"vtl-agent-event-row","data-kind":e.kind,children:(0,ey.jsxs)("div",{className:"vtl-agent-error-card",children:[(0,ey.jsxs)("div",{className:"vtl-agent-error-card-body",children:[(0,ey.jsxs)("span",{children:[e.meta?(0,ey.jsx)("strong",{children:e.meta}):null,e.title]}),e.detail?(0,ey.jsx)("p",{children:e.detail}):null]}),e.retryable&&t?(0,ey.jsxs)("button",{type:"button",className:"vtl-agent-error-retry",onClick:()=>t(e),children:[(0,ey.jsx)(x1,{className:"size-3.5"}),"重试"]}):null]})})}function VK({event:e,labels:t}){let[n,r]=ew.useState(!!e.isStreaming),a=!!e.detail?.trim(),i=e.title||t?.thinking||"思考中";return ew.useEffect(()=>{r(!!e.isStreaming)},[e.isStreaming]),(0,ey.jsxs)("article",{className:"vtl-agent-event-row","data-kind":e.kind,children:[(0,ey.jsxs)("button",{type:"button",className:"vtl-agent-thought-line","data-streaming":e.isStreaming?"true":"false","aria-expanded":n,onClick:()=>a&&r(e=>!e),children:[(0,ey.jsx)("span",{children:i}),e.meta?(0,ey.jsx)("em",{children:e.meta}):null]}),a?(0,ey.jsx)("div",{className:(0,eI.cn)("grid overflow-hidden transition-[grid-template-rows,opacity,transform] duration-200 ease-out",n?"translate-y-0 grid-rows-[1fr] opacity-100":"-translate-y-1 grid-rows-[0fr] opacity-0"),children:(0,ey.jsx)("div",{className:"min-h-0 overflow-hidden",children:(0,ey.jsx)("div",{className:"vtl-agent-thought-detail",children:(0,ey.jsx)(Vw,{content:e.detail??"",isStreaming:e.isStreaming})})})}):null]})}function VG({event:e,labels:t,onOpenFile:n,onOpenSubagent:r}){let[a,i]=ew.useState(!1),o=e.groupedEvents??[];return(0,ey.jsxs)("article",{className:"vtl-agent-event-row","data-kind":"toolgroup",children:[(0,ey.jsxs)("button",{type:"button",className:"vtl-agent-event-read-line",onClick:()=>i(e=>!e),"aria-expanded":a,children:[(0,ey.jsx)("span",{children:a?"收起":"展开"}),e.title]}),(0,ey.jsx)("div",{className:(0,eI.cn)("grid overflow-hidden transition-[grid-template-rows,opacity] duration-200 ease-out",a?"grid-rows-[1fr] opacity-100":"grid-rows-[0fr] opacity-0"),children:(0,ey.jsx)("div",{className:"min-h-0 overflow-hidden",children:(0,ey.jsx)("div",{className:"mt-1 space-y-0.5 border-l border-border/60 pl-2",children:o.map((e,a)=>(0,ey.jsx)(VP,{event:e,autoOpen:!1,labels:t,onOpenFile:n,onOpenSubagent:r},VJ(e,a)))})})})]})}function VX({event:e,autoOpen:t,children:n}){let[r,a]=ew.useState(t),i=ew.useRef(null);return ew.useEffect(()=>{a(t)},[t]),ew.useEffect(()=>{if(!r||!t||!i.current)return;let e=i.current.querySelector(".vtl-agent-tool-result");e&&(e.scrollTop=e.scrollHeight)},[t,n,e.detail,e.files?.length,r]),(0,ey.jsxs)(ey.Fragment,{children:[(0,ey.jsxs)("button",{type:"button",className:"vtl-agent-event-read-line",onClick:()=>a(e=>!e),"aria-expanded":r,children:[(0,ey.jsx)("span",{children:e.actionLabel?e.actionLabel:null}),e.title]}),(0,ey.jsx)("div",{className:(0,eI.cn)("grid overflow-hidden transition-[grid-template-rows,opacity,transform] duration-200 ease-out",r?"translate-y-0 grid-rows-[1fr] opacity-100":"-translate-y-1 grid-rows-[0fr] opacity-0"),children:(0,ey.jsx)("div",{ref:i,className:"min-h-0 overflow-hidden",children:n})})]})}function VY({event:e,onOpenFile:t}){let n=e.files?.length?e.files:[{id:e.id,name:e.title,diff:e.diff,kind:"diff",mutationId:e.mutationId,additions:e.additions,deletions:e.deletions}];return(0,ey.jsx)("article",{className:"vtl-agent-event-row","data-kind":e.kind,children:(0,ey.jsx)("div",{className:"vtl-agent-change-stack",children:n.map((r,a)=>{let i=r.additions??(1===n.length?e.additions:void 0),o=r.deletions??(1===n.length?e.deletions:void 0),l=!!(r.diff??e.diff);return(0,ey.jsxs)("button",{type:"button",className:"vtl-agent-change-row","data-streaming":e.isStreaming?"true":void 0,disabled:!l,onClick:()=>{l&&t?.({...r,diff:r.diff??e.diff,kind:r.kind??"diff",mutationId:r.mutationId??e.mutationId})},children:[(0,ey.jsxs)("span",{children:[e.actionLabel?(0,ey.jsx)("strong",{children:e.actionLabel}):null,VZ(r.name||r.path||e.title)]}),"number"==typeof i||"number"==typeof o?(0,ey.jsxs)("em",{children:["number"==typeof i?(0,ey.jsxs)("b",{"data-kind":"add",children:["+",i]}):null,"number"==typeof o?(0,ey.jsxs)("b",{"data-kind":"delete",children:["-",o]}):null]}):e.meta?(0,ey.jsx)("em",{children:e.meta}):null]},r.id??`${e.id}-${r.path??r.name}-${a}`)})})})}function VZ(e){return e.split(/[\\/]/).filter(Boolean).at(-1)??e}function VJ(e,t){return e.id||`index-${t}`}let VQ="max-w-[42.5rem]",V0={recall:"回退对话到此处",branch:"从此处分支对话",copy:"复制提示词",copyReply:"复制",more:"更多操作",expand:"展开",collapse:"收起",completed:"完成",thinking:"运行中"},V1=ew.forwardRef(function(e,t){return(0,ey.jsx)(V2,{...e,handleRef:t})});function V2({handleRef:e,className:t,composerClassName:n,flowContentClassName:r,initialEvents:a,events:i,hasEarlier:o,loadingEarlier:l,onLoadEarlier:s,models:c,modelId:d,permissionModeId:u,running:f,disabled:h,onEventsChange:p,onModelChange:m,onPermissionModeChange:g,onSubmit:v,attachments:x,onAttachmentsChange:y,onStop:b,onOpenFile:w,onOpenSubagent:j,onRetry:k,onApprovalDecision:S,onContinue:N,onRecallUserMessage:C,onBranchAssistantMessage:M,onActiveEventChange:E,composerValue:O,onComposerValueChange:P,promptHistory:A,queuedMessages:I,onQueuedMessagesChange:z,onNudge:T,contextUsage:D}){let _=i??a??Vi,[R,L]=ew.useState(_),$=ew.useRef(0),F=ew.useRef(_),B=ew.useRef([]),V=ew.useRef(null),H=ew.useRef(null),U=ew.useRef(null),W=ew.useRef([]),[q,K]=ew.useState(168),[G,X]=ew.useState(!0),Y=ew.useId().replace(/[^a-zA-Z0-9_-]/g,""),Z=i??R,J=ew.useCallback(e=>{j?.(e)},[j]);function Q(e){let t=e(F.current);F.current=t,void 0===i&&L(t),p?.(t)}function ee(e,t){let n=window.setTimeout(t,e);B.current.push(n)}return ew.useImperativeHandle(e,()=>({scrollToEvent:e=>{let t=H.current;if(!t||!e)return;let n=t.querySelector('[data-slot="agent-conversation-flow"]');if(!n)return;W.current.forEach(e=>window.clearTimeout(e)),W.current=[];let r=`[data-index="${(window.CSS?.escape??function(e){return e.replace(/["\\]/g,"\\$&")})(e)}"]`,a=["rounded-lg","ring-2","ring-primary/60","ring-offset-2","ring-offset-background","transition-shadow","duration-300"],i=e=>{e.scrollIntoView({behavior:"smooth",block:"start"}),e.classList.add(...a);let t=window.setTimeout(()=>{e.classList.remove(...a)},1600);W.current.push(t)},o=n.querySelector(r);if(o)return void i(o);U.current?.scrollToEvent(e);let l=0,s=()=>{let e=n.querySelector(r);if(e)return void i(e);if((l+=1)<8){let e=window.setTimeout(s,60);W.current.push(e)}},c=window.setTimeout(s,60);W.current.push(c)}}),[]),ew.useEffect(()=>()=>{W.current.forEach(e=>window.clearTimeout(e)),W.current=[]},[]),ew.useLayoutEffect(()=>{let e=V.current;if(!e)return;function t(){K(Math.ceil(e.getBoundingClientRect().height))}t();let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[]),ew.useEffect(()=>{F.current=Z},[Z]),ew.useEffect(()=>()=>{B.current.forEach(e=>window.clearTimeout(e)),B.current=[]},[]),(0,ey.jsxs)("section",{ref:H,className:(0,eI.cn)("vtl-agent-conversation-panel relative flex size-full min-h-0 min-w-0 flex-col overflow-hidden bg-transparent",t),children:[(0,ey.jsx)(VN,{ref:U,events:Z,hasEarlier:o,loadingEarlier:l,onLoadEarlier:s,bottomInset:q+16,contentClassName:(0,eI.cn)(VQ,n,r),onOpenFile:w,onOpenSubagent:J,onRetry:k,onApprovalDecision:S,onContinue:N,onRecallUserMessage:C,onBranchAssistantMessage:M,onActiveEventChange:E,onAtBottomChange:X,labels:V0}),(0,ey.jsx)("button",{type:"button","aria-label":"滚动到底部",onClick:()=>U.current?.scrollToBottom(),style:{bottom:q+12},className:(0,eI.cn)("pointer-events-auto absolute left-1/2 z-30 -translate-x-1/2 flex size-9 items-center justify-center rounded-full border bg-popover text-popover-foreground shadow-md transition-opacity hover:bg-muted",G&&"pointer-events-none opacity-0"),children:(0,ey.jsx)(jg,{className:"size-4"})}),(0,ey.jsx)("div",{ref:V,className:"pointer-events-none absolute inset-x-0 bottom-0 z-20 flex justify-center px-4 pb-4",children:(0,ey.jsx)("div",{className:(0,eI.cn)("vtl-agent-composer-dock pointer-events-auto relative w-full",VQ,n),children:(0,ey.jsx)(B6,{className:"relative z-10 w-full",submitOnEnter:!0,value:O,onValueChange:P,promptHistory:A,running:f,disabled:h,minRows:1,maxRows:8,permissionModeId:u,onPermissionModeChange:e=>g?.(e),models:c,modelId:d,onModelChange:e=>m?.(e),queuedMessages:I,onQueuedMessagesChange:z,onNudge:T,attachments:x,onAttachmentsChange:y,contextUsage:D,labels:{placeholder:"请问",mode:"模式",model:"模型",attach:"添加上下文",removeChip:"移除上下文",removeAttachment:"移除附件",queuedMessage:"待发送消息",guideQueuedMessage:"引导",removeQueuedMessage:"移除待发送消息",moreQueuedMessageActions:"更多待发送消息操作",contextUsage:"上下文用量",contextUsed:"已用",contextTokenSummary:"已用 {used} / {total}",toolCalls:"输入 token",userMessages:"输出 token",otherContext:"已完成轮次",compressContext:"压缩上下文",compressPrecise:"精确",compressExtreme:"极致",send:"发送",stop:"停止"},onSubmit:function(e){let t,n,r=e.value.trim(),a=(e.attachments?.length??0)>0;if(!r&&!a)return;if(v)return void v({value:r,modeId:"agent",modelId:e.modelId??d,attachments:e.attachments});$.current+=1;let i=`${Y}-${$.current}`,o=`user-${i}`;Q(e=>[...e,{id:o,kind:"user",title:r}]),t=Va(i),n=180,t.forEach(e=>{if("done"===e.kind){var t,r,a;let i,o,l=e.title;ee(n,()=>{Q(t=>[...t,{...e,title:"",isStreaming:!0,status:"running"}])}),t=e.id,r=l,a=n+120,i=Math.max(4,Math.ceil(r.length/36)),o=0,ee(a,function e(){o=Math.min(r.length,o+i),Q(e=>e.map(e=>e.id===t?{...e,title:r.slice(0,o),isStreaming:o<r.length,status:o<r.length?"running":"done"}:e)),o<r.length&&ee(42,e)}),n+=Math.min(2200,Math.max(900,18*l.length))+260;return}ee(n,()=>{Q(t=>[...t,e])}),n+="thought"===e.kind?520:300})},onStop:b})})})]})}function V5({ownerMachineId:e,title:t,resolvedLocation:n,className:r}){let a=function(e){let{machines:t}=vs();return ew.useMemo(()=>{if(sC(e))return"本机";let n=t.find(t=>t.id===e);return n?n.isLocal?"本机":n.name:e??"本机"},[t,e])}(e),i=n??a,o=t.trim()||"新 Agent 对话";return(0,ey.jsxs)("div",{className:(0,eI.cn)("flex h-9 shrink-0 items-center gap-1.5 border-b px-3 text-sm",r),children:[(0,ey.jsx)(eP,{className:"size-3.5 shrink-0 text-muted-foreground","aria-hidden":"true"}),(0,ey.jsx)("span",{className:"shrink-0 truncate text-muted-foreground",title:i,children:i}),(0,ey.jsx)("span",{className:"shrink-0 text-muted-foreground/60","aria-hidden":"true",children:"/"}),(0,ey.jsx)("span",{className:"min-w-0 flex-1 truncate font-medium text-foreground",title:o,children:o})]})}function V4({rounds:e,onJumpToRound:t,activeRunId:n,className:r}){let[a,i]=ew.useState(!1),o=ew.useRef(null),[l,s]=ew.useState(304);if(ew.useEffect(()=>{if(!a)return;let e=e=>{"Escape"===e.key&&i(!1)};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[a]),ew.useLayoutEffect(()=>{if(!a)return;let e=()=>{let e=o.current;if(!e)return;let t=e.getBoundingClientRect().left;s(Math.max(120,Math.min(304,window.innerWidth-t-16)))};return e(),window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[a]),!e.length)return null;let c=e.length>24?e.slice(e.length-24):e;return(0,ey.jsxs)("div",{ref:o,className:(0,eI.cn)("relative",r),children:[(0,ey.jsx)("button",{type:"button","aria-label":"轮次时间轴",title:`轮次时间轴 \xb7 共 ${e.length} 轮`,onClick:()=>i(e=>!e),className:(0,eI.cn)("group flex flex-col items-start gap-[7px] rounded-md px-1.5 py-2 outline-none transition-colors hover:bg-muted/50 focus-visible:bg-muted/50",a&&"invisible"),children:c.map(e=>{let t=!!n&&e.runId===n;return(0,ey.jsx)("span",{"aria-hidden":"true",className:(0,eI.cn)("h-[3px] rounded-full transition-all duration-200",t?"w-5 bg-foreground/85":"w-2.5 bg-muted-foreground/30 group-hover:bg-muted-foreground/55")},e.runId)})}),a?(0,ey.jsxs)(ey.Fragment,{children:[(0,ey.jsx)("div",{className:"fixed inset-0 z-40","aria-hidden":"true",onClick:()=>i(!1)}),(0,ey.jsx)("div",{style:{width:l},className:"absolute left-0 top-0 z-50 max-h-[20rem] overflow-y-auto overflow-x-hidden rounded-lg border bg-popover p-1 text-popover-foreground shadow-md vtl-scrollbar-hidden",children:(0,ey.jsx)("div",{className:"grid gap-px",children:e.map(e=>{let r=!!n&&e.runId===n;return(0,ey.jsxs)("button",{type:"button",className:(0,eI.cn)("flex w-full items-center gap-2 rounded px-2 py-1 text-left transition-colors",r?"bg-muted":"hover:bg-muted/70"),onClick:()=>{t(e),i(!1)},children:[(0,ey.jsx)("span",{"aria-hidden":"true",className:(0,eI.cn)("h-[2.5px] shrink-0 rounded-full transition-all",r?"w-3.5 bg-foreground/85":"w-2.5 bg-muted-foreground/40")}),(0,ey.jsx)("span",{className:(0,eI.cn)("min-w-0 flex-1 truncate text-[13px] leading-snug",r?"font-medium text-foreground":"text-foreground/90"),children:e.title?.trim()||e.summary?.trim()||"未命名轮次"})]},e.runId)})})})]}):null]})}let V3=(0,ek.default)("file-plus-corner",[["path",{d:"M11.35 22H6a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v5.35",key:"17jvcc"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M14 19h6",key:"bvotb8"}],["path",{d:"M17 16v6",key:"18yu1i"}]]),V6=(0,ek.default)("pencil",[["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"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]),V8={title:"Explorer",search:"Search files...",newFile:"New file",newFolder:"New folder",refresh:"Refresh",collapseAll:"Collapse all",rename:"Rename",delete:"Delete",copyPath:"Copy path",open:"Open",empty:"No files yet.",noResults:"No matching files.",loading:"Loading..."};function V7(e){return"folder"===e.kind||!!e.children||!!e.hasChildren}function V9(e){return`${e.name} ${e.path}`.toLowerCase()}function He(e,t){if(e&&t)return Ht(e.children,t)}function Ht(e,t){for(let n of e){if(n.id===t)return n;let e=n.children?Ht(n.children,t):void 0;if(e)return e}}function Hn(e,t){return e?t.map(t=>Ht(e.children,t)).filter(e=>!!e):[]}function Hr(e,t){let n=e.includes("\\")?"\\":"/";return e.endsWith("\\")||e.endsWith("/")?`${e}${t}`:`${e}${n}${t}`}function Ha(e,t,n){return e.map(e=>e.id===t?n(e):e.children?{...e,children:Ha(e.children,t,n)}:e)}function Hi(e,t){return e.filter(e=>!t.has(e.id)).map(e=>({...e,children:e.children?Hi(e.children,t):void 0}))}function Ho(e,t){return e.some(e=>e.id===t||!!(e.children&&Ho(e.children,t)))}function Hl(e,t){let n=Hr(t,e.name);return{...e,path:n,children:e.children?.map(e=>Hl(e,n))}}function Hs(e,t,n){let[r,a]=ew.useState(t??n);return[e??r,a]}function Hc({roots:e,defaultRoots:t,activeRootId:n,defaultActiveRootId:r,activeNodeId:a,defaultActiveNodeId:i,selectedIds:o,defaultSelectedIds:l,expandedIds:s,defaultExpandedIds:c,searchValue:d,defaultSearchValue:u,loadingIds:f,labels:h,allowMultiSelect:p=!0,allowCreateFile:m=!0,allowCreateFolder:g=!0,allowRename:v=!0,allowDelete:x=!0,allowDragAndDrop:y=!0,allowBoxSelect:b=!0,openFilesOnSingleClick:w=!0,showSearch:j=!0,showToolbar:k=!0,compact:S=!1,onActiveRootChange:N,onActiveNodeChange:C,onSelectionChange:M,onExpandedChange:E,onSearchValueChange:O,onOpenNode:P,onLoadChildren:A,onCreateNode:I,onRenameNode:z,onDeleteNodes:T,onMoveNodes:D,onCopyPath:_,onRefresh:R,className:L,sidebarClassName:$,style:F}){let B={...V8,...h},V=ew.useRef(null),H=ew.useRef(void 0),U=ew.useRef([]),[W,q]=ew.useState(()=>(t??[]).map(e=>({...e,children:function e(t){return t.map(t=>({...t,children:t.children?e(t.children):void 0}))}(e.children)}))),K=e??W,G=K[0]?.id,[X,Y]=ew.useState(r??G),Z=n??X??G,J=K.find(e=>e.id===Z)??K[0],[Q,ee]=ew.useState(i),et=a??Q,[en,er]=Hs(o,l,i?[i]:[]),[ea,ei]=Hs(s,c,G?[G]:[]),[eo,el]=ew.useState(u??""),es=d??eo,[ec,ed]=ew.useState(),[eu,ef]=ew.useState(""),[eh,ep]=ew.useState([]),[em,eg]=ew.useState(),[ev,ex]=ew.useState(),eb=ew.useRef(0),ej=ew.useMemo(()=>new Set(f),[f]),ek=ew.useMemo(()=>new Set(ea),[ea]),eS=ew.useMemo(()=>new Set(en),[en]),eN=He(J,et),eC=es.trim().length>0;function eM(t){e||q(e=>t(e))}function eE(e){void 0===s&&ei(e),E?.(e)}function eO(e){void 0===o&&er(e),M?.({root:J,node:e.at(-1)?He(J,e.at(-1)):void 0,nodes:Hn(J,e)})}function eP(e){void 0===a&&ee(e?.id),C?.(e)}async function ez(e){if(V7(e)&&J){if(ek.has(e.id))return void eE(ea.filter(t=>t!==e.id));if(A&&e.hasChildren&&!e.children){let t=await A(e,J);eM(n=>n.map(n=>n.id===J.id?{...n,children:Ha(n.children,e.id,e=>({...e,children:t}))}:n))}eE([...ea,e.id])}}function eT(e){var t;t=e.id,void 0===n&&Y(t),N?.(t),ek.has(e.id)?eE(ea.filter(t=>t!==e.id)):eE([...ea,e.id])}function eD(e,t){if(e.disabled)return;let n=p&&(t?.metaKey||t?.ctrlKey)?eS.has(e.id)?en.filter(t=>t!==e.id):[...en,e.id]:[e.id];eP(e),eO(n)}function e_(e){J&&!e.disabled&&P?.(e,J)}function eR(e){if(!J)return;let t=eN&&V7(eN)?eN:J,n="folder"===e?"untitled-folder":"untitled.ts";eb.current+=1;let r={id:`created-${eb.current}`,name:n,path:Hr(t.path,n),kind:"folder"===e?"folder":"code",children:"folder"===e?[]:void 0};I?.(t,e,n),eM(e=>e.map(e=>{var n,a;return e.id!==J.id?e:"children"in t&&"platform"in t?{...e,children:[r,...e.children]}:{...e,children:(n=e.children,a=t.id,Ha(n,a,e=>({...e,children:[r,...e.children??[]],hasChildren:!0})))}})),eE([...new Set([...ea,t.id])]),eP(r),eO([r.id]),ed(r.id),ef(r.name)}function eL(e){!v||e.disabled||e.readonly||(ed(e.id),ef(e.name))}function e$(e){let t=eu.trim();ed(void 0),t&&t!==e.name&&(z?.(e,t),eM(n=>n.map(n=>n.id===J?.id?{...n,children:Ha(n.children,e.id,e=>{let n,r,a;return{...e,name:t,path:Hr((r=(n=e.path.replace(/[\\/]+$/,"")).includes("\\")?"\\":"/",(a=n.lastIndexOf(r))<=0?n:n.slice(0,a)),t)}})}:n)))}function eF(e,t){if(!J||!y||e.disabled||ev)return void t.preventDefault();let n=eS.has(e.id)?en:[e.id];eS.has(e.id)||(eO([e.id]),eP(e)),ep(n),t.dataTransfer.effectAllowed="move",t.dataTransfer.setData("text/plain",n.join(","))}function eB(e,t){if(!y||0===eh.length)return;t.preventDefault(),t.dataTransfer.dropEffect="move";let n=t.currentTarget.getBoundingClientRect(),r=(t.clientY-n.top)/n.height,a=r<.3?"before":r>.7?"after":V7(e)?"inside":"after";eg({targetId:e.id,position:a})}function eV(e,t){t.preventDefault(),em?.targetId===e.id&&function(e,t){let n;if(!J||0===eh.length||!y)return;let r=(n=new Set(eh),Hn(J,eh).filter(e=>!Array.from(n).some(t=>{var n,r;let a;return t!==e.id&&(n=J.children,r=e.id,a=Ht(n,t),!!(a?.children&&Ho(a.children,r)))})));if(0===r.length||r.some(t=>t.id===e.id||!!(t.children&&Ho(t.children,e.id))))return;let a=new Set(r.map(e=>e.id)),i="inside"!==t||V7(e)?t:"after";D?.({root:J,nodes:r,target:e,position:i}),eM(t=>t.map(t=>{if(t.id!==J.id)return t;let n=function e(t,n,r,a,i){let o=!1,l=[];for(let s of t){if(s.id===n){if("before"===r){l.push(...a.map(e=>Hl(e,i))),l.push(s),o=!0;continue}if("after"===r){l.push(s),l.push(...a.map(e=>Hl(e,i))),o=!0;continue}if("inside"===r){l.push({...s,children:[...a.map(e=>Hl(e,s.path)),...s.children??[]],hasChildren:!0}),o=!0;continue}}if(s.children){let t=e(s.children,n,r,a,s.path);l.push({...s,children:t.nodes}),o=o||t.inserted}else l.push(s)}return{nodes:l,inserted:o}}(Hi(t.children,a),e.id,i,r,t.path);return{...t,children:n.inserted?n.nodes:t.children}})),"inside"===i&&eE([...new Set([...ea,e.id])]),eO(r.map(e=>e.id)),eP(r[0])}(e,em.position),eg(void 0),ep([])}function eH(e){let t=V.current;if(!t||!J)return;let n=Math.min(e.startX,e.currentX),r=Math.max(e.startX,e.currentX),a=Math.min(e.startY,e.currentY),i=Math.max(e.startY,e.currentY),o=Array.from(t.querySelectorAll("[data-file-tree-node-id]")).filter(e=>{let t=e.getBoundingClientRect();return t.left<r&&t.right>n&&t.top<i&&t.bottom>a}).map(e=>e.dataset.fileTreeNodeId).filter(e=>!!e);if(o.length>0){eO(Array.from(new Set([...U.current,...o])));let e=He(J,o.at(-1));e&&eP(e)}}return ew.useEffect(()=>{n||X||!G||Y(G)},[n,G,X]),(0,ey.jsxs)("div",{ref:V,"data-slot":"file-tree-panel",className:(0,eI.cn)("vtl-surface-panel relative flex min-h-[28rem] w-full max-w-sm flex-col overflow-hidden rounded-[var(--surface-panel-radius)] border",L),style:F,onPointerDown:function(e){let t=e.target;if(!b||!p||!e.ctrlKey||0!==e.button||t.closest("input, textarea, [data-file-tree-ignore-box]"))return;e.preventDefault();let n=e.currentTarget.getBoundingClientRect();H.current=e.pointerId,U.current=en,e.currentTarget.setPointerCapture(e.pointerId),ex({startX:e.clientX,startY:e.clientY,currentX:e.clientX,currentY:e.clientY,panelLeft:n.left,panelTop:n.top})},onPointerMove:function(e){if(!ev||H.current!==e.pointerId)return;e.preventDefault();let t={...ev,currentX:e.clientX,currentY:e.clientY};ex(t),eH(t)},onPointerUp:function(e){ev&&H.current===e.pointerId&&(eH(ev),ex(void 0),U.current=[],H.current=void 0)},onPointerCancel:()=>{ex(void 0),U.current=[],H.current=void 0},children:[k&&(0,ey.jsxs)("div",{"data-file-tree-ignore-box":!0,className:"flex h-10 shrink-0 items-center gap-1 border-b px-2",children:[(0,ey.jsx)("div",{className:"mr-auto min-w-0 truncate px-1 text-sm font-medium",children:B.title}),m&&(0,ey.jsx)(eA.Button,{type:"button",variant:"ghost",size:"icon-xs","aria-label":B.newFile,onClick:()=>eR("file"),children:(0,ey.jsx)(lJ,{})}),g&&(0,ey.jsx)(eA.Button,{type:"button",variant:"ghost",size:"icon-xs","aria-label":B.newFolder,onClick:()=>eR("folder"),children:(0,ey.jsx)(xY,{})}),(0,ey.jsx)(eA.Button,{type:"button",variant:"ghost",size:"icon-xs","aria-label":B.refresh,onClick:()=>J&&R?.(J),children:(0,ey.jsx)(x1,{})}),(0,ey.jsx)(eA.Button,{type:"button",variant:"ghost",size:"icon-xs","aria-label":B.collapseAll,onClick:function(){eE(J?[J.id]:[])},children:(0,ey.jsx)(fc.XIcon,{})})]}),j&&(0,ey.jsx)("div",{"data-file-tree-ignore-box":!0,className:"shrink-0 border-b p-2",children:(0,ey.jsxs)(bK,{className:"h-7 rounded-md",children:[(0,ey.jsx)(bX,{align:"inline-start",className:"pl-2",children:(0,ey.jsx)(vc,{className:"size-3.5"})}),(0,ey.jsx)(bY,{value:es,onChange:e=>{var t;return t=e.target.value,void(void 0===d&&el(t),O?.(t))},placeholder:B.search,className:"h-7 text-xs"})]})}),(0,ey.jsx)(wb,{className:(0,eI.cn)("min-h-0 flex-1",$),"data-slot":"file-tree-panel-scroll",children:(0,ey.jsxs)("div",{className:(0,eI.cn)("py-1",S&&"py-0.5"),children:[0===K.length&&(0,ey.jsx)("div",{className:"px-3 py-8 text-center text-xs text-muted-foreground",children:B.empty}),K.map(e=>(0,ey.jsx)(Hd,{root:e,activeRoot:J,labels:B,expandedSet:ek,selectedSet:eS,activeNodeId:et,searchValue:es,loadingSet:ej,compact:S,renamingId:ec,renamingName:eu,allowRename:v,allowDelete:x,allowDragAndDrop:y,openFilesOnSingleClick:w,draggingIds:eh,dropTarget:em,hasSearch:eC,onRootToggle:eT,onNodeToggle:e=>void ez(e),onNodeSelect:eD,onNodeOpen:e_,onStartRename:eL,onRenamingNameChange:ef,onCommitRename:e$,onCancelRename:()=>ed(void 0),onDelete:e=>(function(e){if(!x||0===e.length||!J)return;T?.(e);let t=new Set(e.map(e=>e.id));eM(e=>e.map(e=>e.id===J.id?{...e,children:Hi(e.children,t)}:e)),eO(en.filter(e=>!t.has(e))),et&&t.has(et)&&eP(void 0)})(function(e){if(eS.has(e.id)){let t=Hn(J,en);return t.length>0?t:[e]}return[e]}(e)),onCopyPath:e=>_?.(e),onDragStart:eF,onDragOver:eB,onDragEnd:()=>{ep([]),eg(void 0)},onDrop:eV},e.id))]})}),ev&&(0,ey.jsx)(Hp,{box:ev})]})}function Hd({root:e,activeRoot:t,labels:n,expandedSet:r,selectedSet:a,activeNodeId:i,searchValue:o,loadingSet:l,compact:s,renamingId:c,renamingName:d,allowRename:u,allowDelete:f,allowDragAndDrop:h,openFilesOnSingleClick:p,draggingIds:m,dropTarget:g,hasSearch:v,onRootToggle:x,onNodeToggle:y,onNodeSelect:b,onNodeOpen:w,onStartRename:j,onRenamingNameChange:k,onCommitRename:S,onCancelRename:N,onDelete:C,onCopyPath:M,onDragStart:E,onDragOver:O,onDragEnd:P,onDrop:A}){let I=r.has(e.id),z=o.trim().toLowerCase(),T=v?e.children.filter(e=>Hv(e,z)):e.children;return(0,ey.jsxs)("section",{"data-slot":"file-tree-root",className:"min-w-0",children:[(0,ey.jsxs)("button",{type:"button",className:(0,eI.cn)("group flex h-7 w-full items-center gap-1 px-2 text-left text-xs font-medium text-muted-foreground transition-colors hover:bg-muted/60 hover:text-foreground",t?.id===e.id&&"text-foreground"),onClick:()=>x(e),children:[(0,ey.jsx)("span",{className:"flex size-4 shrink-0 items-center justify-center",children:I?(0,ey.jsx)(g8,{className:"size-3.5"}):(0,ey.jsx)(p$,{className:"size-3.5"})}),(0,ey.jsx)("span",{className:"flex size-4 shrink-0 items-center justify-center [&_svg]:size-3.5",children:e.icon??(0,ey.jsx)(ub,{})}),(0,ey.jsx)("span",{className:"truncate uppercase tracking-wide",children:e.name})]}),(I||v)&&(0,ey.jsxs)("div",{children:[l.has(e.id)&&(0,ey.jsx)("div",{className:"px-8 py-2 text-xs text-muted-foreground",children:n.loading}),!l.has(e.id)&&0===T.length&&(0,ey.jsx)("div",{className:"px-8 py-2 text-xs text-muted-foreground",children:v?n.noResults:n.empty}),T.map(t=>(0,ey.jsx)(Hu,{node:t,root:e,depth:0,labels:n,expandedSet:r,selectedSet:a,activeNodeId:i,searchValue:z,loadingSet:l,compact:s,renamingId:c,renamingName:d,allowRename:u,allowDelete:f,allowDragAndDrop:h,openFilesOnSingleClick:p,draggingIds:m,dropTarget:g,hasSearch:v,onNodeToggle:y,onNodeSelect:b,onNodeOpen:w,onStartRename:j,onRenamingNameChange:k,onCommitRename:S,onCancelRename:N,onDelete:C,onCopyPath:M,onDragStart:E,onDragOver:O,onDragEnd:P,onDrop:A},t.id))]})]})}function Hu({node:e,root:t,depth:n,labels:r,expandedSet:a,selectedSet:i,activeNodeId:o,searchValue:l,loadingSet:s,compact:c,renamingId:d,renamingName:u,allowRename:f,allowDelete:h,allowDragAndDrop:p,openFilesOnSingleClick:m,draggingIds:g,dropTarget:v,hasSearch:x,onNodeToggle:y,onNodeSelect:b,onNodeOpen:w,onStartRename:j,onRenamingNameChange:k,onCommitRename:S,onCancelRename:N,onDelete:C,onCopyPath:M,onDragStart:E,onDragOver:O,onDragEnd:P,onDrop:A}){let I=V7(e),z=a.has(e.id),T=i.has(e.id),D=o===e.id,_=d===e.id,R=s.has(e.id),L=g.includes(e.id),$=v?.targetId===e.id&&"inside"!==v.position,F=v?.targetId===e.id&&"inside"===v.position,B=e.children??[],V=x?B.filter(e=>Hv(e,l)):B,H=!x||V9(e).includes(l),U=(z||x)&&V.length>0,W=8+14*n;if(x&&!H&&0===V.length)return null;let q=(0,ey.jsxs)("div",{"data-slot":"file-tree-row","data-file-tree-node-id":e.id,"data-active":D?"true":void 0,"data-selected":T?"true":void 0,draggable:p&&!_&&!e.disabled,className:(0,eI.cn)("group/tree-row relative flex w-full items-center gap-1 pr-1 text-left text-xs transition-colors",c?"h-6":"h-7",T||D?"bg-muted text-foreground":"text-foreground hover:bg-muted/60",F&&"bg-primary/10 ring-1 ring-inset ring-primary/35",L&&"opacity-45",e.disabled&&"pointer-events-none opacity-50"),style:{paddingLeft:W},onDragStart:t=>E(e,t),onDragOver:t=>O(e,t),onDragLeave:e=>{e.currentTarget.contains(e.relatedTarget)||(e.currentTarget.dataset.dragLeave="true")},onDragEnd:P,onDrop:t=>A(e,t),onDoubleClick:()=>w(e),onKeyDown:t=>{"Enter"===t.key&&w(e),"F2"===t.key&&(t.preventDefault(),j(e)),("Delete"===t.key||"Backspace"===t.key)&&(t.preventDefault(),C(e)),"ArrowRight"===t.key&&I&&!z&&(t.preventDefault(),y(e)),"ArrowLeft"===t.key&&I&&z&&(t.preventDefault(),y(e))},children:[(0,ey.jsx)(Hf,{depth:n}),$&&(0,ey.jsx)(Hh,{position:v.position,depth:n}),e.recentlyModified&&(0,ey.jsx)("span",{className:"absolute top-1/2 left-1 h-1.5 w-1.5 -translate-y-1/2 rounded-full bg-primary"}),(0,ey.jsx)("button",{type:"button",tabIndex:-1,className:"flex size-4 shrink-0 items-center justify-center rounded-sm text-muted-foreground hover:bg-muted-foreground/10 hover:text-foreground",onClick:t=>{t.stopPropagation(),y(e)},"aria-label":z?"Collapse":"Expand",children:I?z?(0,ey.jsx)(g8,{className:"size-3.5"}):(0,ey.jsx)(p$,{className:"size-3.5"}):null}),(0,ey.jsxs)("button",{type:"button",className:"flex min-w-0 flex-1 items-center gap-1.5 text-left",onClick:t=>{b(e,t),!I||t.metaKey||t.ctrlKey?!I&&m&&w(e):y(e)},children:[(0,ey.jsx)(Hg,{node:e,open:z}),_?(0,ey.jsx)("input",{value:u,onChange:e=>k(e.target.value),onClick:e=>e.stopPropagation(),onKeyDown:t=>{"Enter"===t.key&&(t.preventDefault(),S(e)),"Escape"===t.key&&(t.preventDefault(),N())},onBlur:()=>S(e),autoFocus:!0,className:"h-5 min-w-0 flex-1 rounded-sm border border-ring bg-background px-1 text-xs outline-none"}):(0,ey.jsxs)(ey.Fragment,{children:[(0,ey.jsx)("span",{className:"min-w-0 flex-1 truncate",children:e.name}),e.badge&&(0,ey.jsx)("span",{className:"shrink-0 text-muted-foreground",children:e.badge}),e.meta&&(0,ey.jsx)("span",{className:"hidden shrink-0 text-muted-foreground group-hover/tree-row:inline sm:inline",children:e.meta})]})]}),!_&&(0,ey.jsx)(Hm,{node:e,root:t,labels:r,allowRename:f,allowDelete:h,onOpen:w,onRename:j,onDelete:C,onCopyPath:M}),R&&(0,ey.jsx)("span",{className:"absolute inset-y-0 right-8 flex items-center text-[10px] text-muted-foreground",children:r.loading})]});return(0,ey.jsxs)(ey.Fragment,{children:[(0,ey.jsxs)(ba,{children:[(0,ey.jsx)(bo,{asChild:!0,children:q}),(0,ey.jsxs)(bp,{className:"w-40",children:[(0,ey.jsxs)(bm,{onSelect:()=>w(e),children:[(0,ey.jsx)(xW,{}),r.open]}),(0,ey.jsxs)(bm,{onSelect:()=>M(e),children:[(0,ey.jsx)(lU,{}),r.copyPath]}),f&&!e.readonly&&(0,ey.jsxs)(bm,{onSelect:()=>j(e),children:[(0,ey.jsx)(V6,{}),r.rename]}),h&&!e.readonly&&(0,ey.jsxs)(ey.Fragment,{children:[(0,ey.jsx)(bg,{}),(0,ey.jsxs)(bm,{variant:"destructive",onSelect:()=>C(e),children:[(0,ey.jsx)(x2,{}),r.delete]})]})]})]}),z&&I&&R&&(0,ey.jsx)("div",{className:"py-1 text-xs text-muted-foreground",style:{paddingLeft:W+40},children:r.loading}),U&&V.map(e=>(0,ey.jsx)(Hu,{node:e,root:t,depth:n+1,labels:r,expandedSet:a,selectedSet:i,activeNodeId:o,searchValue:l,loadingSet:s,compact:c,renamingId:d,renamingName:u,allowRename:f,allowDelete:h,allowDragAndDrop:p,openFilesOnSingleClick:m,draggingIds:g,dropTarget:v,hasSearch:x,onNodeToggle:y,onNodeSelect:b,onNodeOpen:w,onStartRename:j,onRenamingNameChange:k,onCommitRename:S,onCancelRename:N,onDelete:C,onCopyPath:M,onDragStart:E,onDragOver:O,onDragEnd:P,onDrop:A},e.id))]})}function Hf({depth:e}){return e<=0?null:(0,ey.jsx)("span",{"aria-hidden":"true",className:"pointer-events-none absolute inset-y-0 left-0",children:Array.from({length:e}).map((e,t)=>(0,ey.jsx)("span",{className:"absolute inset-y-0 w-px bg-border/80 dark:bg-border/70",style:{left:17+14*t}},t))})}function Hh({position:e,depth:t}){return(0,ey.jsxs)("span",{"aria-hidden":"true",className:(0,eI.cn)("pointer-events-none absolute right-2 z-10 flex h-3 items-center text-primary","before"===e?"top-[-6px]":"bottom-[-6px]"),style:{left:28+14*t},children:[(0,ey.jsx)("span",{className:"text-[10px] leading-none",children:">"}),(0,ey.jsx)("span",{className:"mx-0.5 h-px flex-1 bg-primary"}),(0,ey.jsx)("span",{className:"text-[10px] leading-none",children:"<"})]})}function Hp({box:e}){let t=Math.min(e.startX,e.currentX)-e.panelLeft,n=Math.min(e.startY,e.currentY)-e.panelTop,r=Math.abs(e.currentX-e.startX),a=Math.abs(e.currentY-e.startY);return(0,ey.jsx)("div",{"aria-hidden":"true",className:"pointer-events-none absolute z-50 rounded-sm border border-primary bg-primary/10 shadow-sm",style:{left:t,top:n,width:r,height:a}})}function Hm({node:e,labels:t,allowRename:n,allowDelete:r,onOpen:a,onRename:i,onDelete:o,onCopyPath:l}){return(0,ey.jsxs)(bk,{children:[(0,ey.jsx)(bN,{asChild:!0,children:(0,ey.jsx)(eA.Button,{type:"button","data-file-tree-ignore-box":!0,variant:"ghost",size:"icon-xs",className:"size-6 opacity-0 group-hover/tree-row:opacity-100 data-[state=open]:opacity-100",onClick:e=>e.stopPropagation(),"aria-label":"More actions",children:(0,ey.jsx)(lY,{})})}),(0,ey.jsxs)(bL,{align:"end",className:"w-40",children:[(0,ey.jsxs)(b$,{onSelect:()=>a(e),children:[(0,ey.jsx)(xW,{}),t.open]}),(0,ey.jsxs)(b$,{onSelect:()=>l(e),children:[(0,ey.jsx)(lU,{}),t.copyPath]}),n&&!e.readonly&&(0,ey.jsxs)(b$,{onSelect:()=>i(e),children:[(0,ey.jsx)(V6,{}),t.rename]}),r&&!e.readonly&&(0,ey.jsxs)(ey.Fragment,{children:[(0,ey.jsx)(bV,{}),(0,ey.jsxs)(b$,{variant:"destructive",onSelect:()=>o(e),children:[(0,ey.jsx)(x2,{}),t.delete]})]})]})]})}function Hg({node:e,open:t}){let n=e.icon??function(e,t){if(V7(e))return t?(0,ey.jsx)(ub,{}):(0,ey.jsx)(xX,{});let n=e.name.toLowerCase();return"image"===e.kind||/\.(png|jpg|jpeg|gif|webp|svg|avif)$/.test(n)?(0,ey.jsx)(xq,{}):"archive"===e.kind||/\.(zip|rar|7z|tar|gz)$/.test(n)?(0,ey.jsx)(xV,{}):"code"===e.kind||/\.(ts|tsx|js|jsx|json|css|scss|html|py|rs|go|mdx)$/.test(n)?(0,ey.jsx)(uv,{}):"text"===e.kind||/\.(md|txt|log|yaml|yml)$/.test(n)?(0,ey.jsx)(xK,{}):(0,ey.jsx)(xW,{})}(e,t);return(0,ey.jsx)("span",{className:"flex size-4 shrink-0 items-center justify-center text-muted-foreground [&_svg]:size-3.5",children:n})}function Hv(e,t){return!!(!t||V9(e).includes(t))||!!e.children?.some(e=>Hv(e,t))}function Hx(e){let t=e.trim(),n=/^vantaloom:\/\/([^/]+)\/(.+)$/i.exec(t);return n?{machineId:n[1]||"local",path:decodeURIComponent(n[2]||"").replace(/\//g,"/")}:{machineId:"local",path:t}}function Hy(e){return e.map(e=>{var t;return{id:e.id,name:e.name,path:e.path,kind:"folder"===(t=e.kind)?"folder":"image"===t?"image":"archive"===t?"archive":"text"===t?"text":"code"===t?"code":"executable"===t?"config":"unknown",hasChildren:"folder"===e.kind,readonly:e.readonly,disabled:e.disabled}})}async function Hb(e){let t=e.map(Hx).filter(e=>e.path);return await Promise.all(t.map(async(e,t)=>{let n,r,a=await uF(e.machineId,e.path);return{id:`agent-root-${e.machineId}-${t}-${a.path}`,machineId:e.machineId,name:(n=a.path.replace(/[\\/]+$/,""),r=/([^\\/]+)$/.exec(n),r?.[1]??(n||"workspace")),path:a.path,platform:a.machine.platform,children:Hy(a.items)}}))}async function Hw(e,t){let n=t.machineId||"local";return Hy((await uF(n,e.path)).items)}function Hj({folders:e,className:t,onOpenFile:n}){let[r,a]=ew.useState([]),[i,o]=ew.useState(!1),[l,s]=ew.useState(0),c=e.join("\0"),d=ew.useCallback(async()=>{o(!0);try{a(await Hb(e)),s(e=>e+1)}catch{a([]),s(e=>e+1)}finally{o(!1)}},[e]);return ew.useEffect(()=>{d()},[c,d]),ew.useEffect(()=>{function e(){d()}return window.addEventListener("vantaloom:file-system-changed",e),()=>window.removeEventListener("vantaloom:file-system-changed",e)},[d]),(0,ey.jsx)(Hc,{className:t,compact:!0,openFilesOnSingleClick:!1,allowCreateFile:!1,allowCreateFolder:!1,allowRename:!1,allowDelete:!1,allowDragAndDrop:!1,allowBoxSelect:!1,defaultRoots:r,defaultExpandedIds:r.map(e=>e.id),loadingIds:i?r.map(e=>e.id):[],labels:{title:"Explorer",refresh:"刷新",collapseAll:"折叠",empty:0===e.length?"未配置可访问文件夹":"没有文件",noResults:"没有匹配文件",loading:"读取中..."},onLoadChildren:Hw,onOpenNode:(e,t)=>{"folder"!==e.kind&&n?.({machineId:t.machineId||"local",path:e.path})},onRefresh:()=>{d()}},l)}function Hk({open:e,folders:t,onOpenChange:n,onSelectFile:r}){return(0,ey.jsx)(dw,{open:e,onOpenChange:n,children:(0,ey.jsxs)(fu,{className:"h-[min(42rem,calc(100svh-2rem))] max-w-2xl gap-0 overflow-hidden p-0",children:[(0,ey.jsx)(fh,{className:"sr-only",children:"选择文件"}),(0,ey.jsx)(fp,{className:"sr-only",children:"从当前 Agent 可访问的文件夹中选择文件。"}),(0,ey.jsx)(Hj,{folders:t,className:"size-full max-w-none rounded-none border-0",onOpenFile:e=>{r(e),n(!1)}})]})})}function HS({className:e,onChooseFile:t}){return(0,ey.jsx)("div",{className:(0,eI.cn)("grid size-full place-items-center rounded-[inherit] bg-background p-6",e),children:(0,ey.jsxs)("div",{className:"grid justify-items-center gap-3 text-center",children:[(0,ey.jsx)("div",{className:"grid size-10 place-items-center rounded-full border bg-muted/35 text-muted-foreground",children:(0,ey.jsx)(ub,{className:"size-4"})}),(0,ey.jsxs)(eA.Button,{type:"button",size:"sm",variant:"outline",onClick:t,children:[(0,ey.jsx)(V3,{className:"size-4"}),"选择文件"]})]})})}let HN={expand:"展开",collapse:"收起",completed:"完成",thinking:"运行中"};function HC({icon:e,title:t,role:n,running:r,status:a,active:i,onClick:o,events:l}){let s=ew.useMemo(()=>(function(e){for(let t=e.length-1;t>=0;t--)if(e[t]?.kind==="user")return e.slice(t);return e})(l),[l]);return(0,ey.jsxs)("button",{type:"button",onClick:o,className:(0,eI.cn)("relative flex h-48 w-full shrink-0 flex-col overflow-hidden rounded-xl border bg-card text-left shadow-md transition-all","hover:-translate-y-0.5 hover:shadow-lg",i?"border-primary/70 ring-2 ring-primary/40":r?"border-green-500/50":"border-border/70"),children:[(0,ey.jsxs)("div",{className:"flex items-center gap-2 border-b bg-muted/50 px-2.5 py-1.5",children:[(0,ey.jsx)("span",{className:"shrink-0",children:e}),(0,ey.jsxs)("span",{className:"min-w-0 flex-1 truncate text-[12px] font-medium",children:[t,(0,ey.jsxs)("span",{className:"ml-1 text-[10px] font-normal text-muted-foreground",children:["· ",n]})]}),(0,ey.jsxs)("span",{className:(0,eI.cn)("flex shrink-0 items-center gap-0.5 rounded px-1.5 py-px text-[9.5px]",r?"bg-green-500/15 text-green-600 dark:text-green-400":"failed"===a?"bg-hot-pink/15 text-hot-pink":"bg-muted text-muted-foreground"),children:[r?(0,ey.jsx)(eM,{className:"size-2.5 animate-spin"}):null,r?"运行中":"failed"===a?"失败":"paused"===a?"已暂停":"已完成"]})]}),(0,ey.jsxs)("div",{className:"relative min-h-0 flex-1 overflow-hidden bg-background",children:[s.length>0?(0,ey.jsx)("div",{className:"pointer-events-none absolute inset-0",children:(0,ey.jsx)(VN,{events:s,bottomInset:8,contentClassName:"max-w-none px-3",labels:HN})}):(0,ey.jsx)("div",{className:"flex h-full items-center justify-center text-[11px] text-muted-foreground/50",children:"暂无内容"}),(0,ey.jsx)("div",{className:"pointer-events-none absolute inset-x-0 top-0 h-5 bg-gradient-to-b from-background to-transparent"})]})]})}function HM({subagent:e,ownerMachineId:t,active:n,onClick:r}){let[a,i]=ew.useState([]);ew.useEffect(()=>{let n,r=!1,a=async()=>{try{let o=await sA(e.id,t);if(r)return;i(o.events);let l="working"===o.conversation.status||!!o.conversation.running;n=window.setTimeout(a,l?1500:6e3)}catch{if(r)return;n=window.setTimeout(a,4e3)}};return a(),()=>{r=!0,n&&window.clearTimeout(n)}},[e.id,t]);let o=VB(e.type),l=o.Icon;return(0,ey.jsx)(HC,{icon:(0,ey.jsx)(l,{className:(0,eI.cn)("size-4",o.color)}),title:e.name||`${o.label}子代理`,role:o.label,running:e.running,status:e.status,active:n,onClick:r,events:a})}function HE({conversationTitle:e,rootEvents:t,rootOwnerMachineId:n,running:r,subagentTree:a,baselineSubagentIds:i,activeSubagentPath:o,onSelectMain:l,onSelectSubagent:s}){let c=ew.useMemo(()=>(function e(t,n=[]){for(let r of t)n.push({id:r.id,name:r.subagentName,type:r.subagentType,status:r.status,running:r.running,ownerMachineId:r.ownerMachineId,createdAt:r.createdAt}),e(r.children??[],n);return n})(a).filter(e=>!i.has(e.id)).sort((e,t)=>(e.createdAt??"").localeCompare(t.createdAt??"")),[a,i]),d=o[o.length-1]?.id,u=0===o.length;return(0,ey.jsx)("div",{className:"h-full min-h-0 overflow-y-auto px-4 py-4 vtl-scrollbar-hidden",children:(0,ey.jsxs)("div",{className:"ml-auto flex w-full max-w-[20rem] flex-col gap-4",children:[(0,ey.jsx)(HC,{icon:(0,ey.jsx)(um,{className:"size-4 text-sky-500"}),title:"主 Agent",role:e||"主对话",running:r,status:r?"working":"idle",active:u,onClick:l,events:t}),c.map(e=>(0,ey.jsx)(HM,{subagent:e,ownerMachineId:n,active:e.id===d,onClick:()=>s({id:e.id,ownerMachineId:e.ownerMachineId??n,name:e.name,subagentType:e.type})},e.id))]})})}function HO(e){return`vtl:composer-draft:${e}`}function HP(e){if(!e)return"";try{return window.localStorage.getItem(HO(e))??""}catch{return""}}function HA(e){return`vtl:agent:prompt-history:${e}`}function HI(e){if(!e)return[];try{let t=window.localStorage.getItem(HA(e));if(!t)return[];let n=JSON.parse(t);if(!Array.isArray(n))return[];return n.filter(e=>"string"==typeof e)}catch{return[]}}function Hz(e){return`vtl:agent-read-pos:${e}`}let HT=(0,ek.default)("columns-2",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 3v18",key:"108xh3"}]]),HD=(0,ek.default)("file-diff",[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M9 10h6",key:"9gxzsh"}],["path",{d:"M12 13V7",key:"h0r20n"}],["path",{d:"M9 17h6",key:"r8uit2"}]]),H_=(0,ek.default)("folder-tree",[["path",{d:"M20 10a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1h-2.5a1 1 0 0 1-.8-.4l-.9-1.2A1 1 0 0 0 15 3h-2a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z",key:"hod4my"}],["path",{d:"M20 21a1 1 0 0 0 1-1v-3a1 1 0 0 0-1-1h-2.9a1 1 0 0 1-.88-.55l-.42-.85a1 1 0 0 0-.92-.6H13a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z",key:"w4yl2u"}],["path",{d:"M3 5a2 2 0 0 0 2 2h3",key:"f2jnh7"}],["path",{d:"M3 3v13a2 2 0 0 0 2 2h3",key:"k8epm1"}]]),HR=(0,ek.default)("globe",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]]),HL=(0,ek.default)("maximize",[["path",{d:"M8 3H5a2 2 0 0 0-2 2v3",key:"1dcmit"}],["path",{d:"M21 8V5a2 2 0 0 0-2-2h-3",key:"1e4gt3"}],["path",{d:"M3 16v3a2 2 0 0 0 2 2h3",key:"wsl5sc"}],["path",{d:"M16 21h3a2 2 0 0 0 2-2v-3",key:"18trek"}]]),H$=(0,ek.default)("panel-bottom",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 15h18",key:"5xshup"}]]),HF=(0,ek.default)("panel-top",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}]]);var HB=e.i(78737);let HV=(0,ek.default)("earth",[["path",{d:"M21.54 15H17a2 2 0 0 0-2 2v4.54",key:"1djwo0"}],["path",{d:"M7 3.34V5a3 3 0 0 0 3 3a2 2 0 0 1 2 2c0 1.1.9 2 2 2a2 2 0 0 0 2-2c0-1.1.9-2 2-2h3.17",key:"1tzkfa"}],["path",{d:"M11 21.95V18a2 2 0 0 0-2-2a2 2 0 0 1-2-2v-1a2 2 0 0 0-2-2H2.05",key:"14pb5j"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]),HH=(0,ek.default)("smartphone",[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]]),HU=(0,ek.default)("tablet",[["rect",{width:"16",height:"20",x:"4",y:"2",rx:"2",ry:"2",key:"76otgf"}],["line",{x1:"12",x2:"12.01",y1:"18",y2:"18",key:"1dp563"}]]),HW=[{id:"phone",label:"Phone",width:390,userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 18_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.0 Mobile/15E148 Safari/604.1"},{id:"tablet",label:"Tablet",width:820,userAgent:"Mozilla/5.0 (iPad; CPU OS 18_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.0 Mobile/15E148 Safari/604.1"},{id:"desktop",label:"Desktop",width:1200,userAgent:"Mozilla/5.0 (Macintosh; Intel Mac OS X 15_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36"}],Hq=[{id:"adaptive",label:"自适应",adaptive:!0},{id:"16:9",label:"16:9",value:16/9},{id:"4:3",label:"4:3",value:4/3},{id:"3:2",label:"3:2",value:1.5},{id:"1:1",label:"1:1",value:1},{id:"9:16",label:"9:16",value:9/16}],HK={urlLabel:"URL",urlPlaceholder:"https://example.com",navigate:"Navigate",actions:"Browser view options",devices:"User agent",ratios:"Viewport ratio",back:"Back",forward:"Forward",reload:"Reload preview",previewTitle:"Browser preview"};function HG(e,t,n){return e.find(e=>e.id===t)??n}function HX({id:e}){return"phone"===e?(0,ey.jsx)(HH,{className:"size-4"}):"tablet"===e?(0,ey.jsx)(HU,{className:"size-4"}):(0,ey.jsx)(eP,{className:"size-4"})}function HY({url:e,defaultUrl:t="https://vantaloom.local/workspace",onUrlChange:n,onNavigate:r,onBack:a,onForward:i,device:o,defaultDevice:l="desktop",onDeviceChange:s,ratio:c,defaultRatio:d="adaptive",onRatioChange:u,devices:f=HW,ratios:h=Hq,srcDoc:p,renderPreview:m,showHeader:g=!0,labels:v,className:x,headerClassName:y,previewClassName:b,...w}){let j=ew.useMemo(()=>({...HK,...v}),[v]),[k,S]=ew.useState(t),[N,C]=ew.useState(e??t),[M,E]=ew.useState(()=>[e??t]),[O,P]=ew.useState(0),[A,I]=ew.useState(l),[z,T]=ew.useState(d),[D,_]=ew.useState(!1),[R,L]=ew.useState(0),$=ew.useRef(null),F=ew.useId(),[B,V]=function(){let e=ew.useRef(null),[t,n]=ew.useState({width:0,height:0});return ew.useEffect(()=>{let t=e.current;if(!t)return;function r(e){t&&n(e??{width:t.clientWidth,height:t.clientHeight})}r();let a=new ResizeObserver(e=>{let t=e[0];t?r({width:t.contentRect.width,height:t.contentRect.height}):r()});return a.observe(t),()=>a.disconnect()},[]),[e,t]}(),H=e??k,U=HG(f,o??A,f[0]??HW[0]),W=HG(h,c??z,h[0]??Hq[0]),q=V.width>0&&V.height>0,K=W.adaptive||"adaptive"===W.id,G=W.value??16/9,X=K&&V.width||U.width,Y=K?V.height||U.width/G:X/G,Z=(q?V.width/V.height:1)<=G,J=Math.max(1,Math.round(q?K||Z?V.width:V.height*G:X)),Q=Math.max(1,Math.round(q?K?V.height:Z?V.width/G:V.height:Y)),ee=J/X,et=ew.useMemo(()=>({url:H,device:U,ratio:W,viewport:{width:J,height:Q,scale:ee}}),[U,W,H,ee,Q,J]);function en(t,a={history:"push"}){void 0===e&&S(t),"none"!==a.history&&E(e=>{let n=e.slice(0,O+1);return n[n.length-1]===t?n:(P(n.length),[...n,t])}),n?.(t),r?.(t)}return ew.useEffect(()=>{C(e??k)},[k,e]),ew.useEffect(()=>{if(D)return window.addEventListener("pointerdown",e),()=>window.removeEventListener("pointerdown",e);function e(e){let t=e.target;t instanceof Node&&$.current?.contains(t)||_(!1)}},[D]),(0,ey.jsxs)("div",{ref:$,"data-slot":"browser-tab-viewer","data-device":U.id,"data-ratio":W.id,className:(0,eI.cn)("vtl-surface-panel relative grid min-h-0 overflow-hidden rounded-[var(--surface-panel-radius)] border",g?"grid-rows-[auto_minmax(0,1fr)]":"grid-rows-[minmax(0,1fr)]",x),...w,children:[g&&(0,ey.jsxs)("div",{"data-slot":"browser-tab-viewer-header",className:(0,eI.cn)("flex min-w-0 items-center gap-2 border-b bg-muted/35 px-3 py-2",y),children:[(0,ey.jsx)("span",{className:"grid size-5 shrink-0 place-items-center rounded-md border bg-background text-muted-foreground",children:(0,ey.jsx)(HV,{className:"size-3.5"})}),(0,ey.jsxs)("form",{onSubmit:function(e){let t;e.preventDefault();let n=(t=N.trim())?/^[a-z][a-z\d+\-.]*:\/\//i.test(t)?t:/^(localhost|127\.0\.0\.1|\[::1\])(?::\d+)?(?:\/|$)/i.test(t)?`http://${t}`:`https://${t}`:"";C(n),en(n)},className:"min-w-0 flex-1",children:[(0,ey.jsx)("label",{className:"sr-only",htmlFor:F,children:j.urlLabel}),(0,ey.jsx)(ez,{id:F,value:N,onChange:e=>C(e.target.value),placeholder:j.urlPlaceholder,className:"h-5 rounded-md border bg-background px-2 shadow-none ui-text-kbd",spellCheck:!1})]}),(0,ey.jsx)(eA.Button,{type:"button",variant:"ghost",size:"icon-xs","aria-label":j.back,disabled:O<=0,onClick:function(){if(O<=0)return;let e=O-1,t=M[e];t&&(P(e),C(t),en(t,{history:"none"}),a?.(t))},className:"size-5 rounded-md",children:(0,ey.jsx)(HB.ArrowLeftIcon,{className:"size-3.5"})}),(0,ey.jsx)(eA.Button,{type:"button",variant:"ghost",size:"icon-xs","aria-label":j.forward,disabled:O>=M.length-1,onClick:function(){if(O>=M.length-1)return;let e=O+1,t=M[e];t&&(P(e),C(t),en(t,{history:"none"}),i?.(t))},className:"size-5 rounded-md",children:(0,ey.jsx)(ej.ArrowRightIcon,{className:"size-3.5"})}),(0,ey.jsx)(eA.Button,{type:"button",variant:"ghost",size:"icon-xs","aria-label":j.reload,onClick:()=>L(e=>e+1),className:"size-5 rounded-md",children:(0,ey.jsx)(x1,{className:"size-3.5"})})]}),(0,ey.jsx)("div",{ref:B,"data-slot":"browser-tab-viewer-stage",className:(0,eI.cn)("grid min-h-0 place-items-center overflow-hidden bg-muted/20",b),children:(0,ey.jsx)("div",{"data-slot":"browser-tab-viewer-viewport",className:"overflow-hidden rounded-lg border bg-background shadow-sm",style:{width:J,height:Q},children:m?m(et):(0,ey.jsx)("iframe",{title:j.previewTitle,src:p?void 0:H,srcDoc:p,sandbox:"allow-forms allow-modals allow-popups allow-same-origin allow-scripts",className:"size-full border-0 bg-background"},`${R}-${H}-${U.id}-${W.id}`)})}),(0,ey.jsxs)("div",{"data-slot":"browser-tab-floating-actions",className:"absolute right-3 bottom-3 z-20",children:[(0,ey.jsxs)("div",{className:(0,eI.cn)("vtl-surface-popover absolute right-0 bottom-10 grid w-56 gap-3 rounded-[var(--surface-popover-radius)] border p-3 transition-[opacity,transform] duration-150",D?"pointer-events-auto opacity-100":"pointer-events-none translate-y-1 opacity-0"),children:[(0,ey.jsxs)("div",{className:"grid gap-2",children:[(0,ey.jsx)("div",{className:"text-muted-foreground ui-text-kbd",children:j.devices}),(0,ey.jsx)("div",{className:"flex gap-1.5",children:f.map(e=>(0,ey.jsx)(eA.Button,{type:"button",variant:U.id===e.id?"default":"outline",size:"icon-sm","aria-label":e.label,title:e.label,className:"rounded-full",onClick:()=>{let t;return t=HG(f,e.id,U),void(void 0===o&&I(t.id),s?.(t.id,t))},children:(0,ey.jsx)(HX,{id:e.id})},e.id))})]}),(0,ey.jsxs)("div",{className:"grid gap-2",children:[(0,ey.jsx)("div",{className:"text-muted-foreground ui-text-kbd",children:j.ratios}),(0,ey.jsx)("div",{className:"flex flex-wrap gap-1.5",children:h.map(e=>(0,ey.jsx)(eA.Button,{type:"button",variant:W.id===e.id?"default":"outline",size:"xs",className:"h-7 rounded-full px-2.5 ui-text-kbd",onClick:()=>{let t;return t=HG(h,e.id,W),void(void 0===c&&T(t.id),u?.(t.id,t))},children:e.label},e.id))})]})]}),(0,ey.jsx)(eA.Button,{type:"button",variant:"outline",size:"icon-sm","aria-label":j.actions,"aria-expanded":D,onClick:()=>_(e=>!e),className:"rounded-full bg-background/95 shadow-md backdrop-blur",children:(0,ey.jsx)(lY,{className:(0,eI.cn)("size-4 transition-transform",D&&"rotate-90")})})]})]})}function HZ(e,t){return"function"==typeof e?e(t):e}function HJ(e,t){return n=>{t.setState(t=>({...t,[e]:HZ(n,t[e])}))}}function HQ(e){return e instanceof Function}function H0(e,t,n){let r,a=[];return i=>{let o,l;n.key&&n.debug&&(o=Date.now());let s=e(i);if(!(s.length!==a.length||s.some((e,t)=>a[t]!==e)))return r;if(a=s,n.key&&n.debug&&(l=Date.now()),r=t(...s),null==n||null==n.onChange||n.onChange(r),n.key&&n.debug&&null!=n&&n.debug()){let e=Math.round((Date.now()-o)*100)/100,t=Math.round((Date.now()-l)*100)/100,r=t/16,a=(e,t)=>{for(e=String(e);e.length<t;)e=" "+e;return e};console.info(`%c⏱ ${a(t,5)} /${a(e,5)} ms`,`
25
+ 点击复制`,onClick:e=>i(n.cwd,e),children:n.cwd}):null,(0,ey.jsx)("span",{className:"vtl-shell-spacer"}),n.status?(0,ey.jsx)("span",{className:`vtl-shell-badge ${o}`,children:n.status}):null,void 0!==l?(0,ey.jsxs)("span",{className:`vtl-shell-badge ${l?"shell-ok":"shell-err"}`,children:["exit ",n.exitCode]}):null,n.durationMs?(0,ey.jsx)("span",{className:"vtl-shell-badge shell-time",children:n.durationMs>=1e3?`${(n.durationMs/1e3).toFixed(1)}s`:`${n.durationMs}ms`}):null]}),r?(0,ey.jsx)("pre",{className:"vtl-shell-output",children:r}):null,a.length>0?(0,ey.jsx)("div",{className:"vtl-agent-tool-result","data-kind":"tool",children:a.map(e=>(0,ey.jsx)(V_,{row:e,onOpenFile:t},e.key))}):null]})}function V_({row:e,onOpenFile:t}){let n=(0,ey.jsxs)(ey.Fragment,{children:[(0,ey.jsxs)("span",{className:"vtl-agent-tool-row-tree","aria-hidden":"true","data-level":e.level,children:[e.branch?.ancestorLines.map((e,t)=>(0,ey.jsx)("span",{className:"vtl-agent-tool-row-tree-ancestor","data-active":e?"true":void 0},`ancestor-${t}`)),e.level>0?(0,ey.jsx)("span",{className:"vtl-agent-tool-row-tree-elbow","data-last":e.branch?.isLast?"true":void 0}):null,(0,ey.jsx)("span",{className:"vtl-agent-tool-row-icon",children:"folder"===e.kind?"▾":""})]}),(0,ey.jsx)("span",{className:"vtl-agent-tool-row-label",children:e.label}),e.meta?(0,ey.jsx)("em",{children:e.meta}):null]}),r={"--tool-tree-indent":`${13*Math.min(e.level,8)}px`,"--tool-tree-level":Math.min(e.level,8)};return e.file&&"file"===e.kind?(0,ey.jsx)("button",{type:"button",className:"vtl-agent-tool-row","data-kind":e.kind,style:r,onClick:()=>t?.(e.file),children:n}):(0,ey.jsx)("div",{className:"vtl-agent-tool-row","data-kind":e.kind,style:r,children:n})}function VR(e,t,n){let r=e.actionLabel?.trim()==="探索"||t.meta?.toLowerCase().startsWith("depth")||/[\\/]$/.test(t.name)||!!(t.path&&/[\\/]$/.test(t.path)),a=VZ(t.name||t.path||"untitled");return{key:t.id??`file-${n}-${t.path??t.name}`,label:a,level:0,kind:r?"folder":"file",meta:t.lines??t.meta,file:t}}function VL(e){return VZ(e.replace(/[\\/]+$/,"")).toLowerCase()}function V$(e,t,n){for(let r=t+1;r<e.length;r+=1){let t=e[r]?.level??0;if(t<n)break;if(t===n)return!0}return!1}let VF={explore:{label:"探索",color:"text-sky-600 dark:text-sky-400",Icon:Vo},workflow:{label:"工作流",color:"text-violet-600 dark:text-violet-400",Icon:uk},operator:{label:"操作员",color:"text-pink-600 dark:text-pink-400",Icon:uj},custom:{label:"自定义",color:"text-amber-600 dark:text-amber-400",Icon:um}};function VB(e){return VF[e??""]??{label:"子代理",color:"text-muted-foreground",Icon:um}}function VV({event:e,onOpenSubagent:t}){return(0,ey.jsx)("div",{className:"grid gap-2",children:e.subagents?.map(n=>(0,ey.jsx)(VH,{subagent:n,event:e,onOpenSubagent:t},n.id||n.title))})}function VH({subagent:e,event:t,onOpenSubagent:n}){let[r,a]=ew.useState(!1),i=VB(e.subagentType),o=e.status??(e.isRunning?"running":"done"),l=!!e.isRunning||"running"===o,s="failed"===o,c=e.name||`${i.label}子代理`,d=(e.result??t.detail??"").trim(),u=i.Icon,f=!!e.inline;return(0,ey.jsxs)("section",{className:(0,eI.cn)("overflow-hidden rounded-lg border bg-card/60",s&&"border-destructive/40"),"data-subagent-card":!0,"data-running":l?"true":void 0,children:[f?(0,ey.jsxs)("div",{className:"flex w-full items-center gap-2.5 px-3 py-2 text-left",children:[(0,ey.jsx)("span",{className:(0,eI.cn)("flex size-6 shrink-0 items-center justify-center rounded-md bg-muted/60",i.color),children:(0,ey.jsx)(u,{className:"size-3.5"})}),(0,ey.jsxs)("span",{className:"flex min-w-0 flex-1 flex-col",children:[(0,ey.jsxs)("span",{className:"flex items-center gap-1.5 text-[13px] font-medium",children:[(0,ey.jsx)("span",{className:"truncate",children:c}),(0,ey.jsx)("span",{className:"shrink-0 rounded bg-muted px-1 py-px text-[10px] font-normal text-muted-foreground",children:i.label})]}),e.title?(0,ey.jsx)("span",{className:"truncate text-xs text-muted-foreground",children:e.title}):null]}),(0,ey.jsx)(VU,{status:o,running:l})]}):(0,ey.jsxs)("button",{type:"button",className:"flex w-full items-center gap-2.5 px-3 py-2 text-left transition-colors hover:bg-accent/40",onClick:()=>n?.(e,t),title:"打开子代理对话",children:[(0,ey.jsx)("span",{className:(0,eI.cn)("flex size-6 shrink-0 items-center justify-center rounded-md bg-muted/60",i.color),children:(0,ey.jsx)(u,{className:"size-3.5"})}),(0,ey.jsxs)("span",{className:"flex min-w-0 flex-1 flex-col",children:[(0,ey.jsxs)("span",{className:"flex items-center gap-1.5 text-[13px] font-medium",children:[(0,ey.jsx)("span",{className:"truncate",children:c}),(0,ey.jsx)("span",{className:"shrink-0 rounded bg-muted px-1 py-px text-[10px] font-normal text-muted-foreground",children:i.label})]}),e.title?(0,ey.jsx)("span",{className:"truncate text-xs text-muted-foreground",children:e.title}):null]}),(0,ey.jsx)(VU,{status:o,running:l})]}),d?(0,ey.jsx)("div",{className:"border-t",children:f?(0,ey.jsx)("div",{className:"max-h-72 overflow-auto whitespace-pre-wrap px-3 py-2 text-xs leading-relaxed text-foreground/80",children:d}):(0,ey.jsxs)(ey.Fragment,{children:[(0,ey.jsxs)("button",{type:"button",className:"flex w-full items-center gap-1 px-3 py-1.5 text-left text-xs text-muted-foreground transition-colors hover:text-foreground",onClick:()=>a(e=>!e),"aria-expanded":r,children:[(0,ey.jsx)(p$,{className:(0,eI.cn)("size-3 transition-transform",r&&"rotate-90")}),r?"收起结果":"查看结果"]}),r?(0,ey.jsx)("div",{className:"max-h-72 overflow-auto whitespace-pre-wrap px-3 pb-3 text-xs leading-relaxed text-foreground/80",children:d}):null]})}):null]})}function VU({status:e,running:t}){return t?(0,ey.jsxs)("span",{className:"flex shrink-0 items-center gap-1 text-xs text-muted-foreground",children:[(0,ey.jsx)(eM,{className:"size-3 animate-spin"}),"运行中"]}):"failed"===e?(0,ey.jsxs)("span",{className:"flex shrink-0 items-center gap-1 text-xs text-destructive",children:[(0,ey.jsx)(hb,{className:"size-3"}),"失败"]}):(0,ey.jsxs)("span",{className:"flex shrink-0 items-center gap-1 text-xs text-emerald-600 dark:text-emerald-500",children:[(0,ey.jsx)(eO,{className:"size-3"}),"完成"]})}function VW({event:e}){return(0,ey.jsx)("article",{className:"vtl-agent-event-row","data-kind":e.kind,children:(0,ey.jsxs)("p",{className:"vtl-agent-action-line",children:[e.actionLabel?(0,ey.jsx)("strong",{children:e.actionLabel}):null,e.title,e.meta?(0,ey.jsx)("em",{children:e.meta}):null]})})}function Vq({event:e,onRetry:t}){return(0,ey.jsx)("article",{className:"vtl-agent-event-row","data-kind":e.kind,children:(0,ey.jsxs)("div",{className:"vtl-agent-error-card",children:[(0,ey.jsxs)("div",{className:"vtl-agent-error-card-body",children:[(0,ey.jsxs)("span",{children:[e.meta?(0,ey.jsx)("strong",{children:e.meta}):null,e.title]}),e.detail?(0,ey.jsx)("p",{children:e.detail}):null]}),e.retryable&&t?(0,ey.jsxs)("button",{type:"button",className:"vtl-agent-error-retry",onClick:()=>t(e),children:[(0,ey.jsx)(x1,{className:"size-3.5"}),"重试"]}):null]})})}function VK({event:e,labels:t}){let[n,r]=ew.useState(!!e.isStreaming),a=!!e.detail?.trim(),i=e.title||t?.thinking||"思考中";return ew.useEffect(()=>{r(!!e.isStreaming)},[e.isStreaming]),(0,ey.jsxs)("article",{className:"vtl-agent-event-row","data-kind":e.kind,children:[(0,ey.jsxs)("button",{type:"button",className:"vtl-agent-thought-line","data-streaming":e.isStreaming?"true":"false","aria-expanded":n,onClick:()=>a&&r(e=>!e),children:[(0,ey.jsx)("span",{children:i}),e.meta?(0,ey.jsx)("em",{children:e.meta}):null]}),a?(0,ey.jsx)("div",{className:(0,eI.cn)("grid overflow-hidden transition-[grid-template-rows,opacity,transform] duration-200 ease-out",n?"translate-y-0 grid-rows-[1fr] opacity-100":"-translate-y-1 grid-rows-[0fr] opacity-0"),children:(0,ey.jsx)("div",{className:"min-h-0 overflow-hidden",children:(0,ey.jsx)("div",{className:"vtl-agent-thought-detail",children:(0,ey.jsx)(Vw,{content:e.detail??"",isStreaming:e.isStreaming})})})}):null]})}function VG({event:e,labels:t,onOpenFile:n,onOpenSubagent:r}){let[a,i]=ew.useState(!1),o=e.groupedEvents??[];return(0,ey.jsxs)("article",{className:"vtl-agent-event-row","data-kind":"toolgroup",children:[(0,ey.jsxs)("button",{type:"button",className:"vtl-agent-event-read-line",onClick:()=>i(e=>!e),"aria-expanded":a,children:[(0,ey.jsx)("span",{children:a?"收起":"展开"}),e.title]}),(0,ey.jsx)("div",{className:(0,eI.cn)("grid overflow-hidden transition-[grid-template-rows,opacity] duration-200 ease-out",a?"grid-rows-[1fr] opacity-100":"grid-rows-[0fr] opacity-0"),children:(0,ey.jsx)("div",{className:"min-h-0 overflow-hidden",children:(0,ey.jsx)("div",{className:"mt-1 space-y-0.5 border-l border-border/60 pl-2",children:o.map((e,a)=>(0,ey.jsx)(VP,{event:e,autoOpen:!1,labels:t,onOpenFile:n,onOpenSubagent:r},VJ(e,a)))})})})]})}function VX({event:e,autoOpen:t,children:n}){let[r,a]=ew.useState(t),i=ew.useRef(null);return ew.useEffect(()=>{a(t)},[t]),ew.useEffect(()=>{if(!r||!t||!i.current)return;let e=i.current.querySelector(".vtl-agent-tool-result");e&&(e.scrollTop=e.scrollHeight)},[t,n,e.detail,e.files?.length,r]),(0,ey.jsxs)(ey.Fragment,{children:[(0,ey.jsxs)("button",{type:"button",className:"vtl-agent-event-read-line",onClick:()=>a(e=>!e),"aria-expanded":r,children:[(0,ey.jsx)("span",{children:e.actionLabel?e.actionLabel:null}),e.title]}),(0,ey.jsx)("div",{className:(0,eI.cn)("grid overflow-hidden transition-[grid-template-rows,opacity,transform] duration-200 ease-out",r?"translate-y-0 grid-rows-[1fr] opacity-100":"-translate-y-1 grid-rows-[0fr] opacity-0"),children:(0,ey.jsx)("div",{ref:i,className:"min-h-0 overflow-hidden",children:n})})]})}function VY({event:e,onOpenFile:t}){let n=e.files?.length?e.files:[{id:e.id,name:e.title,diff:e.diff,kind:"diff",mutationId:e.mutationId,additions:e.additions,deletions:e.deletions}];return(0,ey.jsx)("article",{className:"vtl-agent-event-row","data-kind":e.kind,children:(0,ey.jsx)("div",{className:"vtl-agent-change-stack",children:n.map((r,a)=>{let i=r.additions??(1===n.length?e.additions:void 0),o=r.deletions??(1===n.length?e.deletions:void 0),l=!!(r.diff??e.diff);return(0,ey.jsxs)("button",{type:"button",className:"vtl-agent-change-row","data-streaming":e.isStreaming?"true":void 0,disabled:!l,onClick:()=>{l&&t?.({...r,diff:r.diff??e.diff,kind:r.kind??"diff",mutationId:r.mutationId??e.mutationId})},children:[(0,ey.jsxs)("span",{children:[e.actionLabel?(0,ey.jsx)("strong",{children:e.actionLabel}):null,VZ(r.name||r.path||e.title)]}),"number"==typeof i||"number"==typeof o?(0,ey.jsxs)("em",{children:["number"==typeof i?(0,ey.jsxs)("b",{"data-kind":"add",children:["+",i]}):null,"number"==typeof o?(0,ey.jsxs)("b",{"data-kind":"delete",children:["-",o]}):null]}):e.meta?(0,ey.jsx)("em",{children:e.meta}):null]},r.id??`${e.id}-${r.path??r.name}-${a}`)})})})}function VZ(e){return e.split(/[\\/]/).filter(Boolean).at(-1)??e}function VJ(e,t){return e.id||`index-${t}`}let VQ="max-w-[42.5rem]",V0={recall:"回退对话到此处",branch:"从此处分支对话",copy:"复制提示词",copyReply:"复制",more:"更多操作",expand:"展开",collapse:"收起",completed:"完成",thinking:"运行中"},V1=ew.forwardRef(function(e,t){return(0,ey.jsx)(V2,{...e,handleRef:t})});function V2({handleRef:e,className:t,composerClassName:n,flowContentClassName:r,initialEvents:a,events:i,hasEarlier:o,loadingEarlier:l,onLoadEarlier:s,models:c,modelId:d,permissionModeId:u,running:f,disabled:h,onEventsChange:p,onModelChange:m,onPermissionModeChange:g,onSubmit:v,attachments:x,onAttachmentsChange:y,onStop:b,onOpenFile:w,onOpenSubagent:j,onRetry:k,onApprovalDecision:S,onContinue:N,onRecallUserMessage:C,onBranchAssistantMessage:M,onActiveEventChange:E,composerValue:O,onComposerValueChange:P,promptHistory:A,queuedMessages:I,onQueuedMessagesChange:z,onNudge:T,contextUsage:D}){let _=i??a??Vi,[R,L]=ew.useState(_),$=ew.useRef(0),F=ew.useRef(_),B=ew.useRef([]),V=ew.useRef(null),H=ew.useRef(null),U=ew.useRef(null),W=ew.useRef([]),[q,K]=ew.useState(168),[G,X]=ew.useState(!0),Y=ew.useId().replace(/[^a-zA-Z0-9_-]/g,""),Z=i??R,J=ew.useCallback(e=>{j?.(e)},[j]);function Q(e){let t=e(F.current);F.current=t,void 0===i&&L(t),p?.(t)}function ee(e,t){let n=window.setTimeout(t,e);B.current.push(n)}return ew.useImperativeHandle(e,()=>({scrollToEvent:e=>{let t=H.current;if(!t||!e)return;let n=t.querySelector('[data-slot="agent-conversation-flow"]');if(!n)return;W.current.forEach(e=>window.clearTimeout(e)),W.current=[];let r=`[data-index="${(window.CSS?.escape??function(e){return e.replace(/["\\]/g,"\\$&")})(e)}"]`,a=["rounded-lg","ring-2","ring-primary/60","ring-offset-2","ring-offset-background","transition-shadow","duration-300"],i=e=>{e.scrollIntoView({behavior:"smooth",block:"start"}),e.classList.add(...a);let t=window.setTimeout(()=>{e.classList.remove(...a)},1600);W.current.push(t)},o=n.querySelector(r);if(o)return void i(o);U.current?.scrollToEvent(e);let l=0,s=()=>{let e=n.querySelector(r);if(e)return void i(e);if((l+=1)<8){let e=window.setTimeout(s,60);W.current.push(e)}},c=window.setTimeout(s,60);W.current.push(c)}}),[]),ew.useEffect(()=>()=>{W.current.forEach(e=>window.clearTimeout(e)),W.current=[]},[]),ew.useLayoutEffect(()=>{let e=V.current;if(!e)return;function t(){K(Math.ceil(e.getBoundingClientRect().height))}t();let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[]),ew.useEffect(()=>{F.current=Z},[Z]),ew.useEffect(()=>()=>{B.current.forEach(e=>window.clearTimeout(e)),B.current=[]},[]),(0,ey.jsxs)("section",{ref:H,className:(0,eI.cn)("vtl-agent-conversation-panel relative flex size-full min-h-0 min-w-0 flex-col overflow-hidden bg-transparent",t),children:[(0,ey.jsx)(VN,{ref:U,events:Z,hasEarlier:o,loadingEarlier:l,onLoadEarlier:s,bottomInset:q+16,contentClassName:(0,eI.cn)(VQ,n,r),onOpenFile:w,onOpenSubagent:J,onRetry:k,onApprovalDecision:S,onContinue:N,onRecallUserMessage:C,onBranchAssistantMessage:M,onActiveEventChange:E,onAtBottomChange:X,labels:V0}),(0,ey.jsx)("button",{type:"button","aria-label":"滚动到底部",onClick:()=>U.current?.scrollToBottom(),style:{bottom:q+12},className:(0,eI.cn)("pointer-events-auto absolute left-1/2 z-30 -translate-x-1/2 flex size-9 items-center justify-center rounded-full border bg-popover text-popover-foreground shadow-md transition-opacity hover:bg-muted",G&&"pointer-events-none opacity-0"),children:(0,ey.jsx)(jg,{className:"size-4"})}),(0,ey.jsx)("div",{ref:V,className:"pointer-events-none absolute inset-x-0 bottom-0 z-20 flex justify-center px-4 pb-4",children:(0,ey.jsx)("div",{className:(0,eI.cn)("vtl-agent-composer-dock pointer-events-auto relative w-full",VQ,n),children:(0,ey.jsx)(B6,{className:"relative z-10 w-full",submitOnEnter:!0,value:O,onValueChange:P,promptHistory:A,running:f,disabled:h,minRows:1,maxRows:8,permissionModeId:u,onPermissionModeChange:e=>g?.(e),models:c,modelId:d,onModelChange:e=>m?.(e),queuedMessages:I,onQueuedMessagesChange:z,onNudge:T,attachments:x,onAttachmentsChange:y,contextUsage:D,labels:{placeholder:"请问",mode:"模式",model:"模型",attach:"添加上下文",removeChip:"移除上下文",removeAttachment:"移除附件",queuedMessage:"待发送消息",guideQueuedMessage:"引导",removeQueuedMessage:"移除待发送消息",moreQueuedMessageActions:"更多待发送消息操作",contextUsage:"上下文用量",contextUsed:"已用",contextTokenSummary:"已用 {used} / {total}",toolCalls:"输入 token",userMessages:"输出 token",otherContext:"已完成轮次",compressContext:"压缩上下文",compressPrecise:"精确",compressExtreme:"极致",send:"发送",stop:"停止"},onSubmit:function(e){let t,n,r=e.value.trim(),a=(e.attachments?.length??0)>0;if(!r&&!a)return;if(v)return void v({value:r,modeId:"agent",modelId:e.modelId??d,attachments:e.attachments});$.current+=1;let i=`${Y}-${$.current}`,o=`user-${i}`;Q(e=>[...e,{id:o,kind:"user",title:r}]),t=Va(i),n=180,t.forEach(e=>{if("done"===e.kind){var t,r,a;let i,o,l=e.title;ee(n,()=>{Q(t=>[...t,{...e,title:"",isStreaming:!0,status:"running"}])}),t=e.id,r=l,a=n+120,i=Math.max(4,Math.ceil(r.length/36)),o=0,ee(a,function e(){o=Math.min(r.length,o+i),Q(e=>e.map(e=>e.id===t?{...e,title:r.slice(0,o),isStreaming:o<r.length,status:o<r.length?"running":"done"}:e)),o<r.length&&ee(42,e)}),n+=Math.min(2200,Math.max(900,18*l.length))+260;return}ee(n,()=>{Q(t=>[...t,e])}),n+="thought"===e.kind?520:300})},onStop:b})})})]})}function V5({ownerMachineId:e,title:t,resolvedLocation:n,className:r}){let a=function(e){let{machines:t}=vs();return ew.useMemo(()=>{if(sC(e))return"本机";let n=t.find(t=>t.id===e);return n?n.isLocal?"本机":n.name:e??"本机"},[t,e])}(e),i=n??a,o=t.trim()||"新 Agent 对话";return(0,ey.jsxs)("div",{className:(0,eI.cn)("flex h-9 shrink-0 items-center gap-1.5 border-b px-3 text-sm",r),children:[(0,ey.jsx)(eP,{className:"size-3.5 shrink-0 text-muted-foreground","aria-hidden":"true"}),(0,ey.jsx)("span",{className:"shrink-0 truncate text-muted-foreground",title:i,children:i}),(0,ey.jsx)("span",{className:"shrink-0 text-muted-foreground/60","aria-hidden":"true",children:"/"}),(0,ey.jsx)("span",{className:"min-w-0 flex-1 truncate font-medium text-foreground",title:o,children:o})]})}function V4({rounds:e,onJumpToRound:t,activeRunId:n,className:r}){let[a,i]=ew.useState(!1),o=ew.useRef(null),[l,s]=ew.useState(304);if(ew.useEffect(()=>{if(!a)return;let e=e=>{"Escape"===e.key&&i(!1)};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[a]),ew.useLayoutEffect(()=>{if(!a)return;let e=()=>{let e=o.current;if(!e)return;let t=e.getBoundingClientRect().left;s(Math.max(120,Math.min(304,window.innerWidth-t-16)))};return e(),window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[a]),!e.length)return null;let c=e.length>24?e.slice(e.length-24):e;return(0,ey.jsxs)("div",{ref:o,className:(0,eI.cn)("relative",r),children:[(0,ey.jsx)("button",{type:"button","aria-label":"轮次时间轴",title:`轮次时间轴 \xb7 共 ${e.length} 轮`,onClick:()=>i(e=>!e),className:(0,eI.cn)("group flex flex-col items-start gap-[7px] rounded-md px-1.5 py-2 outline-none transition-colors hover:bg-muted/50 focus-visible:bg-muted/50",a&&"invisible"),children:c.map(e=>{let t=!!n&&e.runId===n;return(0,ey.jsx)("span",{"aria-hidden":"true",className:(0,eI.cn)("h-[3px] rounded-full transition-all duration-200",t?"w-5 bg-foreground/85":"w-2.5 bg-muted-foreground/30 group-hover:bg-muted-foreground/55")},e.runId)})}),a?(0,ey.jsxs)(ey.Fragment,{children:[(0,ey.jsx)("div",{className:"fixed inset-0 z-40","aria-hidden":"true",onClick:()=>i(!1)}),(0,ey.jsx)("div",{style:{width:l},className:"absolute left-0 top-0 z-50 max-h-[20rem] overflow-y-auto overflow-x-hidden rounded-lg border bg-popover p-1 text-popover-foreground shadow-md vtl-scrollbar-hidden",children:(0,ey.jsx)("div",{className:"grid grid-cols-[minmax(0,1fr)] gap-px",children:e.map(e=>{let r=!!n&&e.runId===n;return(0,ey.jsxs)("button",{type:"button",className:(0,eI.cn)("flex w-full min-w-0 items-center gap-2 rounded px-2 py-1 text-left transition-colors",r?"bg-muted":"hover:bg-muted/70"),onClick:()=>{t(e),i(!1)},children:[(0,ey.jsx)("span",{"aria-hidden":"true",className:(0,eI.cn)("h-[2.5px] shrink-0 rounded-full transition-all",r?"w-3.5 bg-foreground/85":"w-2.5 bg-muted-foreground/40")}),(0,ey.jsx)("span",{className:(0,eI.cn)("min-w-0 flex-1 truncate text-[13px] leading-snug",r?"font-medium text-foreground":"text-foreground/90"),children:e.title?.trim()||e.summary?.trim()||"未命名轮次"})]},e.runId)})})})]}):null]})}let V3=(0,ek.default)("file-plus-corner",[["path",{d:"M11.35 22H6a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v5.35",key:"17jvcc"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M14 19h6",key:"bvotb8"}],["path",{d:"M17 16v6",key:"18yu1i"}]]),V6=(0,ek.default)("pencil",[["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"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]),V8={title:"Explorer",search:"Search files...",newFile:"New file",newFolder:"New folder",refresh:"Refresh",collapseAll:"Collapse all",rename:"Rename",delete:"Delete",copyPath:"Copy path",open:"Open",empty:"No files yet.",noResults:"No matching files.",loading:"Loading..."};function V7(e){return"folder"===e.kind||!!e.children||!!e.hasChildren}function V9(e){return`${e.name} ${e.path}`.toLowerCase()}function He(e,t){if(e&&t)return Ht(e.children,t)}function Ht(e,t){for(let n of e){if(n.id===t)return n;let e=n.children?Ht(n.children,t):void 0;if(e)return e}}function Hn(e,t){return e?t.map(t=>Ht(e.children,t)).filter(e=>!!e):[]}function Hr(e,t){let n=e.includes("\\")?"\\":"/";return e.endsWith("\\")||e.endsWith("/")?`${e}${t}`:`${e}${n}${t}`}function Ha(e,t,n){return e.map(e=>e.id===t?n(e):e.children?{...e,children:Ha(e.children,t,n)}:e)}function Hi(e,t){return e.filter(e=>!t.has(e.id)).map(e=>({...e,children:e.children?Hi(e.children,t):void 0}))}function Ho(e,t){return e.some(e=>e.id===t||!!(e.children&&Ho(e.children,t)))}function Hl(e,t){let n=Hr(t,e.name);return{...e,path:n,children:e.children?.map(e=>Hl(e,n))}}function Hs(e,t,n){let[r,a]=ew.useState(t??n);return[e??r,a]}function Hc({roots:e,defaultRoots:t,activeRootId:n,defaultActiveRootId:r,activeNodeId:a,defaultActiveNodeId:i,selectedIds:o,defaultSelectedIds:l,expandedIds:s,defaultExpandedIds:c,searchValue:d,defaultSearchValue:u,loadingIds:f,labels:h,allowMultiSelect:p=!0,allowCreateFile:m=!0,allowCreateFolder:g=!0,allowRename:v=!0,allowDelete:x=!0,allowDragAndDrop:y=!0,allowBoxSelect:b=!0,openFilesOnSingleClick:w=!0,showSearch:j=!0,showToolbar:k=!0,compact:S=!1,onActiveRootChange:N,onActiveNodeChange:C,onSelectionChange:M,onExpandedChange:E,onSearchValueChange:O,onOpenNode:P,onLoadChildren:A,onCreateNode:I,onRenameNode:z,onDeleteNodes:T,onMoveNodes:D,onCopyPath:_,onRefresh:R,className:L,sidebarClassName:$,style:F}){let B={...V8,...h},V=ew.useRef(null),H=ew.useRef(void 0),U=ew.useRef([]),[W,q]=ew.useState(()=>(t??[]).map(e=>({...e,children:function e(t){return t.map(t=>({...t,children:t.children?e(t.children):void 0}))}(e.children)}))),K=e??W,G=K[0]?.id,[X,Y]=ew.useState(r??G),Z=n??X??G,J=K.find(e=>e.id===Z)??K[0],[Q,ee]=ew.useState(i),et=a??Q,[en,er]=Hs(o,l,i?[i]:[]),[ea,ei]=Hs(s,c,G?[G]:[]),[eo,el]=ew.useState(u??""),es=d??eo,[ec,ed]=ew.useState(),[eu,ef]=ew.useState(""),[eh,ep]=ew.useState([]),[em,eg]=ew.useState(),[ev,ex]=ew.useState(),eb=ew.useRef(0),ej=ew.useMemo(()=>new Set(f),[f]),ek=ew.useMemo(()=>new Set(ea),[ea]),eS=ew.useMemo(()=>new Set(en),[en]),eN=He(J,et),eC=es.trim().length>0;function eM(t){e||q(e=>t(e))}function eE(e){void 0===s&&ei(e),E?.(e)}function eO(e){void 0===o&&er(e),M?.({root:J,node:e.at(-1)?He(J,e.at(-1)):void 0,nodes:Hn(J,e)})}function eP(e){void 0===a&&ee(e?.id),C?.(e)}async function ez(e){if(V7(e)&&J){if(ek.has(e.id))return void eE(ea.filter(t=>t!==e.id));if(A&&e.hasChildren&&!e.children){let t=await A(e,J);eM(n=>n.map(n=>n.id===J.id?{...n,children:Ha(n.children,e.id,e=>({...e,children:t}))}:n))}eE([...ea,e.id])}}function eT(e){var t;t=e.id,void 0===n&&Y(t),N?.(t),ek.has(e.id)?eE(ea.filter(t=>t!==e.id)):eE([...ea,e.id])}function eD(e,t){if(e.disabled)return;let n=p&&(t?.metaKey||t?.ctrlKey)?eS.has(e.id)?en.filter(t=>t!==e.id):[...en,e.id]:[e.id];eP(e),eO(n)}function e_(e){J&&!e.disabled&&P?.(e,J)}function eR(e){if(!J)return;let t=eN&&V7(eN)?eN:J,n="folder"===e?"untitled-folder":"untitled.ts";eb.current+=1;let r={id:`created-${eb.current}`,name:n,path:Hr(t.path,n),kind:"folder"===e?"folder":"code",children:"folder"===e?[]:void 0};I?.(t,e,n),eM(e=>e.map(e=>{var n,a;return e.id!==J.id?e:"children"in t&&"platform"in t?{...e,children:[r,...e.children]}:{...e,children:(n=e.children,a=t.id,Ha(n,a,e=>({...e,children:[r,...e.children??[]],hasChildren:!0})))}})),eE([...new Set([...ea,t.id])]),eP(r),eO([r.id]),ed(r.id),ef(r.name)}function eL(e){!v||e.disabled||e.readonly||(ed(e.id),ef(e.name))}function e$(e){let t=eu.trim();ed(void 0),t&&t!==e.name&&(z?.(e,t),eM(n=>n.map(n=>n.id===J?.id?{...n,children:Ha(n.children,e.id,e=>{let n,r,a;return{...e,name:t,path:Hr((r=(n=e.path.replace(/[\\/]+$/,"")).includes("\\")?"\\":"/",(a=n.lastIndexOf(r))<=0?n:n.slice(0,a)),t)}})}:n)))}function eF(e,t){if(!J||!y||e.disabled||ev)return void t.preventDefault();let n=eS.has(e.id)?en:[e.id];eS.has(e.id)||(eO([e.id]),eP(e)),ep(n),t.dataTransfer.effectAllowed="move",t.dataTransfer.setData("text/plain",n.join(","))}function eB(e,t){if(!y||0===eh.length)return;t.preventDefault(),t.dataTransfer.dropEffect="move";let n=t.currentTarget.getBoundingClientRect(),r=(t.clientY-n.top)/n.height,a=r<.3?"before":r>.7?"after":V7(e)?"inside":"after";eg({targetId:e.id,position:a})}function eV(e,t){t.preventDefault(),em?.targetId===e.id&&function(e,t){let n;if(!J||0===eh.length||!y)return;let r=(n=new Set(eh),Hn(J,eh).filter(e=>!Array.from(n).some(t=>{var n,r;let a;return t!==e.id&&(n=J.children,r=e.id,a=Ht(n,t),!!(a?.children&&Ho(a.children,r)))})));if(0===r.length||r.some(t=>t.id===e.id||!!(t.children&&Ho(t.children,e.id))))return;let a=new Set(r.map(e=>e.id)),i="inside"!==t||V7(e)?t:"after";D?.({root:J,nodes:r,target:e,position:i}),eM(t=>t.map(t=>{if(t.id!==J.id)return t;let n=function e(t,n,r,a,i){let o=!1,l=[];for(let s of t){if(s.id===n){if("before"===r){l.push(...a.map(e=>Hl(e,i))),l.push(s),o=!0;continue}if("after"===r){l.push(s),l.push(...a.map(e=>Hl(e,i))),o=!0;continue}if("inside"===r){l.push({...s,children:[...a.map(e=>Hl(e,s.path)),...s.children??[]],hasChildren:!0}),o=!0;continue}}if(s.children){let t=e(s.children,n,r,a,s.path);l.push({...s,children:t.nodes}),o=o||t.inserted}else l.push(s)}return{nodes:l,inserted:o}}(Hi(t.children,a),e.id,i,r,t.path);return{...t,children:n.inserted?n.nodes:t.children}})),"inside"===i&&eE([...new Set([...ea,e.id])]),eO(r.map(e=>e.id)),eP(r[0])}(e,em.position),eg(void 0),ep([])}function eH(e){let t=V.current;if(!t||!J)return;let n=Math.min(e.startX,e.currentX),r=Math.max(e.startX,e.currentX),a=Math.min(e.startY,e.currentY),i=Math.max(e.startY,e.currentY),o=Array.from(t.querySelectorAll("[data-file-tree-node-id]")).filter(e=>{let t=e.getBoundingClientRect();return t.left<r&&t.right>n&&t.top<i&&t.bottom>a}).map(e=>e.dataset.fileTreeNodeId).filter(e=>!!e);if(o.length>0){eO(Array.from(new Set([...U.current,...o])));let e=He(J,o.at(-1));e&&eP(e)}}return ew.useEffect(()=>{n||X||!G||Y(G)},[n,G,X]),(0,ey.jsxs)("div",{ref:V,"data-slot":"file-tree-panel",className:(0,eI.cn)("vtl-surface-panel relative flex min-h-[28rem] w-full max-w-sm flex-col overflow-hidden rounded-[var(--surface-panel-radius)] border",L),style:F,onPointerDown:function(e){let t=e.target;if(!b||!p||!e.ctrlKey||0!==e.button||t.closest("input, textarea, [data-file-tree-ignore-box]"))return;e.preventDefault();let n=e.currentTarget.getBoundingClientRect();H.current=e.pointerId,U.current=en,e.currentTarget.setPointerCapture(e.pointerId),ex({startX:e.clientX,startY:e.clientY,currentX:e.clientX,currentY:e.clientY,panelLeft:n.left,panelTop:n.top})},onPointerMove:function(e){if(!ev||H.current!==e.pointerId)return;e.preventDefault();let t={...ev,currentX:e.clientX,currentY:e.clientY};ex(t),eH(t)},onPointerUp:function(e){ev&&H.current===e.pointerId&&(eH(ev),ex(void 0),U.current=[],H.current=void 0)},onPointerCancel:()=>{ex(void 0),U.current=[],H.current=void 0},children:[k&&(0,ey.jsxs)("div",{"data-file-tree-ignore-box":!0,className:"flex h-10 shrink-0 items-center gap-1 border-b px-2",children:[(0,ey.jsx)("div",{className:"mr-auto min-w-0 truncate px-1 text-sm font-medium",children:B.title}),m&&(0,ey.jsx)(eA.Button,{type:"button",variant:"ghost",size:"icon-xs","aria-label":B.newFile,onClick:()=>eR("file"),children:(0,ey.jsx)(lJ,{})}),g&&(0,ey.jsx)(eA.Button,{type:"button",variant:"ghost",size:"icon-xs","aria-label":B.newFolder,onClick:()=>eR("folder"),children:(0,ey.jsx)(xY,{})}),(0,ey.jsx)(eA.Button,{type:"button",variant:"ghost",size:"icon-xs","aria-label":B.refresh,onClick:()=>J&&R?.(J),children:(0,ey.jsx)(x1,{})}),(0,ey.jsx)(eA.Button,{type:"button",variant:"ghost",size:"icon-xs","aria-label":B.collapseAll,onClick:function(){eE(J?[J.id]:[])},children:(0,ey.jsx)(fc.XIcon,{})})]}),j&&(0,ey.jsx)("div",{"data-file-tree-ignore-box":!0,className:"shrink-0 border-b p-2",children:(0,ey.jsxs)(bK,{className:"h-7 rounded-md",children:[(0,ey.jsx)(bX,{align:"inline-start",className:"pl-2",children:(0,ey.jsx)(vc,{className:"size-3.5"})}),(0,ey.jsx)(bY,{value:es,onChange:e=>{var t;return t=e.target.value,void(void 0===d&&el(t),O?.(t))},placeholder:B.search,className:"h-7 text-xs"})]})}),(0,ey.jsx)(wb,{className:(0,eI.cn)("min-h-0 flex-1",$),"data-slot":"file-tree-panel-scroll",children:(0,ey.jsxs)("div",{className:(0,eI.cn)("py-1",S&&"py-0.5"),children:[0===K.length&&(0,ey.jsx)("div",{className:"px-3 py-8 text-center text-xs text-muted-foreground",children:B.empty}),K.map(e=>(0,ey.jsx)(Hd,{root:e,activeRoot:J,labels:B,expandedSet:ek,selectedSet:eS,activeNodeId:et,searchValue:es,loadingSet:ej,compact:S,renamingId:ec,renamingName:eu,allowRename:v,allowDelete:x,allowDragAndDrop:y,openFilesOnSingleClick:w,draggingIds:eh,dropTarget:em,hasSearch:eC,onRootToggle:eT,onNodeToggle:e=>void ez(e),onNodeSelect:eD,onNodeOpen:e_,onStartRename:eL,onRenamingNameChange:ef,onCommitRename:e$,onCancelRename:()=>ed(void 0),onDelete:e=>(function(e){if(!x||0===e.length||!J)return;T?.(e);let t=new Set(e.map(e=>e.id));eM(e=>e.map(e=>e.id===J.id?{...e,children:Hi(e.children,t)}:e)),eO(en.filter(e=>!t.has(e))),et&&t.has(et)&&eP(void 0)})(function(e){if(eS.has(e.id)){let t=Hn(J,en);return t.length>0?t:[e]}return[e]}(e)),onCopyPath:e=>_?.(e),onDragStart:eF,onDragOver:eB,onDragEnd:()=>{ep([]),eg(void 0)},onDrop:eV},e.id))]})}),ev&&(0,ey.jsx)(Hp,{box:ev})]})}function Hd({root:e,activeRoot:t,labels:n,expandedSet:r,selectedSet:a,activeNodeId:i,searchValue:o,loadingSet:l,compact:s,renamingId:c,renamingName:d,allowRename:u,allowDelete:f,allowDragAndDrop:h,openFilesOnSingleClick:p,draggingIds:m,dropTarget:g,hasSearch:v,onRootToggle:x,onNodeToggle:y,onNodeSelect:b,onNodeOpen:w,onStartRename:j,onRenamingNameChange:k,onCommitRename:S,onCancelRename:N,onDelete:C,onCopyPath:M,onDragStart:E,onDragOver:O,onDragEnd:P,onDrop:A}){let I=r.has(e.id),z=o.trim().toLowerCase(),T=v?e.children.filter(e=>Hv(e,z)):e.children;return(0,ey.jsxs)("section",{"data-slot":"file-tree-root",className:"min-w-0",children:[(0,ey.jsxs)("button",{type:"button",className:(0,eI.cn)("group flex h-7 w-full items-center gap-1 px-2 text-left text-xs font-medium text-muted-foreground transition-colors hover:bg-muted/60 hover:text-foreground",t?.id===e.id&&"text-foreground"),onClick:()=>x(e),children:[(0,ey.jsx)("span",{className:"flex size-4 shrink-0 items-center justify-center",children:I?(0,ey.jsx)(g8,{className:"size-3.5"}):(0,ey.jsx)(p$,{className:"size-3.5"})}),(0,ey.jsx)("span",{className:"flex size-4 shrink-0 items-center justify-center [&_svg]:size-3.5",children:e.icon??(0,ey.jsx)(ub,{})}),(0,ey.jsx)("span",{className:"truncate uppercase tracking-wide",children:e.name})]}),(I||v)&&(0,ey.jsxs)("div",{children:[l.has(e.id)&&(0,ey.jsx)("div",{className:"px-8 py-2 text-xs text-muted-foreground",children:n.loading}),!l.has(e.id)&&0===T.length&&(0,ey.jsx)("div",{className:"px-8 py-2 text-xs text-muted-foreground",children:v?n.noResults:n.empty}),T.map(t=>(0,ey.jsx)(Hu,{node:t,root:e,depth:0,labels:n,expandedSet:r,selectedSet:a,activeNodeId:i,searchValue:z,loadingSet:l,compact:s,renamingId:c,renamingName:d,allowRename:u,allowDelete:f,allowDragAndDrop:h,openFilesOnSingleClick:p,draggingIds:m,dropTarget:g,hasSearch:v,onNodeToggle:y,onNodeSelect:b,onNodeOpen:w,onStartRename:j,onRenamingNameChange:k,onCommitRename:S,onCancelRename:N,onDelete:C,onCopyPath:M,onDragStart:E,onDragOver:O,onDragEnd:P,onDrop:A},t.id))]})]})}function Hu({node:e,root:t,depth:n,labels:r,expandedSet:a,selectedSet:i,activeNodeId:o,searchValue:l,loadingSet:s,compact:c,renamingId:d,renamingName:u,allowRename:f,allowDelete:h,allowDragAndDrop:p,openFilesOnSingleClick:m,draggingIds:g,dropTarget:v,hasSearch:x,onNodeToggle:y,onNodeSelect:b,onNodeOpen:w,onStartRename:j,onRenamingNameChange:k,onCommitRename:S,onCancelRename:N,onDelete:C,onCopyPath:M,onDragStart:E,onDragOver:O,onDragEnd:P,onDrop:A}){let I=V7(e),z=a.has(e.id),T=i.has(e.id),D=o===e.id,_=d===e.id,R=s.has(e.id),L=g.includes(e.id),$=v?.targetId===e.id&&"inside"!==v.position,F=v?.targetId===e.id&&"inside"===v.position,B=e.children??[],V=x?B.filter(e=>Hv(e,l)):B,H=!x||V9(e).includes(l),U=(z||x)&&V.length>0,W=8+14*n;if(x&&!H&&0===V.length)return null;let q=(0,ey.jsxs)("div",{"data-slot":"file-tree-row","data-file-tree-node-id":e.id,"data-active":D?"true":void 0,"data-selected":T?"true":void 0,draggable:p&&!_&&!e.disabled,className:(0,eI.cn)("group/tree-row relative flex w-full items-center gap-1 pr-1 text-left text-xs transition-colors",c?"h-6":"h-7",T||D?"bg-muted text-foreground":"text-foreground hover:bg-muted/60",F&&"bg-primary/10 ring-1 ring-inset ring-primary/35",L&&"opacity-45",e.disabled&&"pointer-events-none opacity-50"),style:{paddingLeft:W},onDragStart:t=>E(e,t),onDragOver:t=>O(e,t),onDragLeave:e=>{e.currentTarget.contains(e.relatedTarget)||(e.currentTarget.dataset.dragLeave="true")},onDragEnd:P,onDrop:t=>A(e,t),onDoubleClick:()=>w(e),onKeyDown:t=>{"Enter"===t.key&&w(e),"F2"===t.key&&(t.preventDefault(),j(e)),("Delete"===t.key||"Backspace"===t.key)&&(t.preventDefault(),C(e)),"ArrowRight"===t.key&&I&&!z&&(t.preventDefault(),y(e)),"ArrowLeft"===t.key&&I&&z&&(t.preventDefault(),y(e))},children:[(0,ey.jsx)(Hf,{depth:n}),$&&(0,ey.jsx)(Hh,{position:v.position,depth:n}),e.recentlyModified&&(0,ey.jsx)("span",{className:"absolute top-1/2 left-1 h-1.5 w-1.5 -translate-y-1/2 rounded-full bg-primary"}),(0,ey.jsx)("button",{type:"button",tabIndex:-1,className:"flex size-4 shrink-0 items-center justify-center rounded-sm text-muted-foreground hover:bg-muted-foreground/10 hover:text-foreground",onClick:t=>{t.stopPropagation(),y(e)},"aria-label":z?"Collapse":"Expand",children:I?z?(0,ey.jsx)(g8,{className:"size-3.5"}):(0,ey.jsx)(p$,{className:"size-3.5"}):null}),(0,ey.jsxs)("button",{type:"button",className:"flex min-w-0 flex-1 items-center gap-1.5 text-left",onClick:t=>{b(e,t),!I||t.metaKey||t.ctrlKey?!I&&m&&w(e):y(e)},children:[(0,ey.jsx)(Hg,{node:e,open:z}),_?(0,ey.jsx)("input",{value:u,onChange:e=>k(e.target.value),onClick:e=>e.stopPropagation(),onKeyDown:t=>{"Enter"===t.key&&(t.preventDefault(),S(e)),"Escape"===t.key&&(t.preventDefault(),N())},onBlur:()=>S(e),autoFocus:!0,className:"h-5 min-w-0 flex-1 rounded-sm border border-ring bg-background px-1 text-xs outline-none"}):(0,ey.jsxs)(ey.Fragment,{children:[(0,ey.jsx)("span",{className:"min-w-0 flex-1 truncate",children:e.name}),e.badge&&(0,ey.jsx)("span",{className:"shrink-0 text-muted-foreground",children:e.badge}),e.meta&&(0,ey.jsx)("span",{className:"hidden shrink-0 text-muted-foreground group-hover/tree-row:inline sm:inline",children:e.meta})]})]}),!_&&(0,ey.jsx)(Hm,{node:e,root:t,labels:r,allowRename:f,allowDelete:h,onOpen:w,onRename:j,onDelete:C,onCopyPath:M}),R&&(0,ey.jsx)("span",{className:"absolute inset-y-0 right-8 flex items-center text-[10px] text-muted-foreground",children:r.loading})]});return(0,ey.jsxs)(ey.Fragment,{children:[(0,ey.jsxs)(ba,{children:[(0,ey.jsx)(bo,{asChild:!0,children:q}),(0,ey.jsxs)(bp,{className:"w-40",children:[(0,ey.jsxs)(bm,{onSelect:()=>w(e),children:[(0,ey.jsx)(xW,{}),r.open]}),(0,ey.jsxs)(bm,{onSelect:()=>M(e),children:[(0,ey.jsx)(lU,{}),r.copyPath]}),f&&!e.readonly&&(0,ey.jsxs)(bm,{onSelect:()=>j(e),children:[(0,ey.jsx)(V6,{}),r.rename]}),h&&!e.readonly&&(0,ey.jsxs)(ey.Fragment,{children:[(0,ey.jsx)(bg,{}),(0,ey.jsxs)(bm,{variant:"destructive",onSelect:()=>C(e),children:[(0,ey.jsx)(x2,{}),r.delete]})]})]})]}),z&&I&&R&&(0,ey.jsx)("div",{className:"py-1 text-xs text-muted-foreground",style:{paddingLeft:W+40},children:r.loading}),U&&V.map(e=>(0,ey.jsx)(Hu,{node:e,root:t,depth:n+1,labels:r,expandedSet:a,selectedSet:i,activeNodeId:o,searchValue:l,loadingSet:s,compact:c,renamingId:d,renamingName:u,allowRename:f,allowDelete:h,allowDragAndDrop:p,openFilesOnSingleClick:m,draggingIds:g,dropTarget:v,hasSearch:x,onNodeToggle:y,onNodeSelect:b,onNodeOpen:w,onStartRename:j,onRenamingNameChange:k,onCommitRename:S,onCancelRename:N,onDelete:C,onCopyPath:M,onDragStart:E,onDragOver:O,onDragEnd:P,onDrop:A},e.id))]})}function Hf({depth:e}){return e<=0?null:(0,ey.jsx)("span",{"aria-hidden":"true",className:"pointer-events-none absolute inset-y-0 left-0",children:Array.from({length:e}).map((e,t)=>(0,ey.jsx)("span",{className:"absolute inset-y-0 w-px bg-border/80 dark:bg-border/70",style:{left:17+14*t}},t))})}function Hh({position:e,depth:t}){return(0,ey.jsxs)("span",{"aria-hidden":"true",className:(0,eI.cn)("pointer-events-none absolute right-2 z-10 flex h-3 items-center text-primary","before"===e?"top-[-6px]":"bottom-[-6px]"),style:{left:28+14*t},children:[(0,ey.jsx)("span",{className:"text-[10px] leading-none",children:">"}),(0,ey.jsx)("span",{className:"mx-0.5 h-px flex-1 bg-primary"}),(0,ey.jsx)("span",{className:"text-[10px] leading-none",children:"<"})]})}function Hp({box:e}){let t=Math.min(e.startX,e.currentX)-e.panelLeft,n=Math.min(e.startY,e.currentY)-e.panelTop,r=Math.abs(e.currentX-e.startX),a=Math.abs(e.currentY-e.startY);return(0,ey.jsx)("div",{"aria-hidden":"true",className:"pointer-events-none absolute z-50 rounded-sm border border-primary bg-primary/10 shadow-sm",style:{left:t,top:n,width:r,height:a}})}function Hm({node:e,labels:t,allowRename:n,allowDelete:r,onOpen:a,onRename:i,onDelete:o,onCopyPath:l}){return(0,ey.jsxs)(bk,{children:[(0,ey.jsx)(bN,{asChild:!0,children:(0,ey.jsx)(eA.Button,{type:"button","data-file-tree-ignore-box":!0,variant:"ghost",size:"icon-xs",className:"size-6 opacity-0 group-hover/tree-row:opacity-100 data-[state=open]:opacity-100",onClick:e=>e.stopPropagation(),"aria-label":"More actions",children:(0,ey.jsx)(lY,{})})}),(0,ey.jsxs)(bL,{align:"end",className:"w-40",children:[(0,ey.jsxs)(b$,{onSelect:()=>a(e),children:[(0,ey.jsx)(xW,{}),t.open]}),(0,ey.jsxs)(b$,{onSelect:()=>l(e),children:[(0,ey.jsx)(lU,{}),t.copyPath]}),n&&!e.readonly&&(0,ey.jsxs)(b$,{onSelect:()=>i(e),children:[(0,ey.jsx)(V6,{}),t.rename]}),r&&!e.readonly&&(0,ey.jsxs)(ey.Fragment,{children:[(0,ey.jsx)(bV,{}),(0,ey.jsxs)(b$,{variant:"destructive",onSelect:()=>o(e),children:[(0,ey.jsx)(x2,{}),t.delete]})]})]})]})}function Hg({node:e,open:t}){let n=e.icon??function(e,t){if(V7(e))return t?(0,ey.jsx)(ub,{}):(0,ey.jsx)(xX,{});let n=e.name.toLowerCase();return"image"===e.kind||/\.(png|jpg|jpeg|gif|webp|svg|avif)$/.test(n)?(0,ey.jsx)(xq,{}):"archive"===e.kind||/\.(zip|rar|7z|tar|gz)$/.test(n)?(0,ey.jsx)(xV,{}):"code"===e.kind||/\.(ts|tsx|js|jsx|json|css|scss|html|py|rs|go|mdx)$/.test(n)?(0,ey.jsx)(uv,{}):"text"===e.kind||/\.(md|txt|log|yaml|yml)$/.test(n)?(0,ey.jsx)(xK,{}):(0,ey.jsx)(xW,{})}(e,t);return(0,ey.jsx)("span",{className:"flex size-4 shrink-0 items-center justify-center text-muted-foreground [&_svg]:size-3.5",children:n})}function Hv(e,t){return!!(!t||V9(e).includes(t))||!!e.children?.some(e=>Hv(e,t))}function Hx(e){let t=e.trim(),n=/^vantaloom:\/\/([^/]+)\/(.+)$/i.exec(t);return n?{machineId:n[1]||"local",path:decodeURIComponent(n[2]||"").replace(/\//g,"/")}:{machineId:"local",path:t}}function Hy(e){return e.map(e=>{var t;return{id:e.id,name:e.name,path:e.path,kind:"folder"===(t=e.kind)?"folder":"image"===t?"image":"archive"===t?"archive":"text"===t?"text":"code"===t?"code":"executable"===t?"config":"unknown",hasChildren:"folder"===e.kind,readonly:e.readonly,disabled:e.disabled}})}async function Hb(e){let t=e.map(Hx).filter(e=>e.path);return await Promise.all(t.map(async(e,t)=>{let n,r,a=await uF(e.machineId,e.path);return{id:`agent-root-${e.machineId}-${t}-${a.path}`,machineId:e.machineId,name:(n=a.path.replace(/[\\/]+$/,""),r=/([^\\/]+)$/.exec(n),r?.[1]??(n||"workspace")),path:a.path,platform:a.machine.platform,children:Hy(a.items)}}))}async function Hw(e,t){let n=t.machineId||"local";return Hy((await uF(n,e.path)).items)}function Hj({folders:e,className:t,onOpenFile:n}){let[r,a]=ew.useState([]),[i,o]=ew.useState(!1),[l,s]=ew.useState(0),c=e.join("\0"),d=ew.useCallback(async()=>{o(!0);try{a(await Hb(e)),s(e=>e+1)}catch{a([]),s(e=>e+1)}finally{o(!1)}},[e]);return ew.useEffect(()=>{d()},[c,d]),ew.useEffect(()=>{function e(){d()}return window.addEventListener("vantaloom:file-system-changed",e),()=>window.removeEventListener("vantaloom:file-system-changed",e)},[d]),(0,ey.jsx)(Hc,{className:t,compact:!0,openFilesOnSingleClick:!1,allowCreateFile:!1,allowCreateFolder:!1,allowRename:!1,allowDelete:!1,allowDragAndDrop:!1,allowBoxSelect:!1,defaultRoots:r,defaultExpandedIds:r.map(e=>e.id),loadingIds:i?r.map(e=>e.id):[],labels:{title:"Explorer",refresh:"刷新",collapseAll:"折叠",empty:0===e.length?"未配置可访问文件夹":"没有文件",noResults:"没有匹配文件",loading:"读取中..."},onLoadChildren:Hw,onOpenNode:(e,t)=>{"folder"!==e.kind&&n?.({machineId:t.machineId||"local",path:e.path})},onRefresh:()=>{d()}},l)}function Hk({open:e,folders:t,onOpenChange:n,onSelectFile:r}){return(0,ey.jsx)(dw,{open:e,onOpenChange:n,children:(0,ey.jsxs)(fu,{className:"h-[min(42rem,calc(100svh-2rem))] max-w-2xl gap-0 overflow-hidden p-0",children:[(0,ey.jsx)(fh,{className:"sr-only",children:"选择文件"}),(0,ey.jsx)(fp,{className:"sr-only",children:"从当前 Agent 可访问的文件夹中选择文件。"}),(0,ey.jsx)(Hj,{folders:t,className:"size-full max-w-none rounded-none border-0",onOpenFile:e=>{r(e),n(!1)}})]})})}function HS({className:e,onChooseFile:t}){return(0,ey.jsx)("div",{className:(0,eI.cn)("grid size-full place-items-center rounded-[inherit] bg-background p-6",e),children:(0,ey.jsxs)("div",{className:"grid justify-items-center gap-3 text-center",children:[(0,ey.jsx)("div",{className:"grid size-10 place-items-center rounded-full border bg-muted/35 text-muted-foreground",children:(0,ey.jsx)(ub,{className:"size-4"})}),(0,ey.jsxs)(eA.Button,{type:"button",size:"sm",variant:"outline",onClick:t,children:[(0,ey.jsx)(V3,{className:"size-4"}),"选择文件"]})]})})}let HN={expand:"展开",collapse:"收起",completed:"完成",thinking:"运行中"};function HC({icon:e,title:t,role:n,running:r,status:a,active:i,onClick:o,events:l}){let s=ew.useMemo(()=>(function(e){for(let t=e.length-1;t>=0;t--)if(e[t]?.kind==="user")return e.slice(t);return e})(l),[l]);return(0,ey.jsxs)("button",{type:"button",onClick:o,className:(0,eI.cn)("relative flex h-48 w-full shrink-0 flex-col overflow-hidden rounded-xl border bg-card text-left shadow-md transition-all","hover:-translate-y-0.5 hover:shadow-lg",i?"border-primary/70 ring-2 ring-primary/40":r?"border-green-500/50":"border-border/70"),children:[(0,ey.jsxs)("div",{className:"flex items-center gap-2 border-b bg-muted/50 px-2.5 py-1.5",children:[(0,ey.jsx)("span",{className:"shrink-0",children:e}),(0,ey.jsxs)("span",{className:"min-w-0 flex-1 truncate text-[12px] font-medium",children:[t,(0,ey.jsxs)("span",{className:"ml-1 text-[10px] font-normal text-muted-foreground",children:["· ",n]})]}),(0,ey.jsxs)("span",{className:(0,eI.cn)("flex shrink-0 items-center gap-0.5 rounded px-1.5 py-px text-[9.5px]",r?"bg-green-500/15 text-green-600 dark:text-green-400":"failed"===a?"bg-hot-pink/15 text-hot-pink":"bg-muted text-muted-foreground"),children:[r?(0,ey.jsx)(eM,{className:"size-2.5 animate-spin"}):null,r?"运行中":"failed"===a?"失败":"paused"===a?"已暂停":"已完成"]})]}),(0,ey.jsxs)("div",{className:"relative min-h-0 flex-1 overflow-hidden bg-background",children:[s.length>0?(0,ey.jsx)("div",{className:"pointer-events-none absolute inset-0",children:(0,ey.jsx)(VN,{events:s,bottomInset:8,contentClassName:"max-w-none px-3",labels:HN})}):(0,ey.jsx)("div",{className:"flex h-full items-center justify-center text-[11px] text-muted-foreground/50",children:"暂无内容"}),(0,ey.jsx)("div",{className:"pointer-events-none absolute inset-x-0 top-0 h-5 bg-gradient-to-b from-background to-transparent"})]})]})}function HM({subagent:e,ownerMachineId:t,active:n,onClick:r}){let[a,i]=ew.useState([]);ew.useEffect(()=>{let n,r=!1,a=async()=>{try{let o=await sA(e.id,t);if(r)return;i(o.events);let l="working"===o.conversation.status||!!o.conversation.running;n=window.setTimeout(a,l?1500:6e3)}catch{if(r)return;n=window.setTimeout(a,4e3)}};return a(),()=>{r=!0,n&&window.clearTimeout(n)}},[e.id,t]);let o=VB(e.type),l=o.Icon;return(0,ey.jsx)(HC,{icon:(0,ey.jsx)(l,{className:(0,eI.cn)("size-4",o.color)}),title:e.name||`${o.label}子代理`,role:o.label,running:e.running,status:e.status,active:n,onClick:r,events:a})}function HE({conversationTitle:e,rootEvents:t,rootOwnerMachineId:n,running:r,subagentTree:a,baselineSubagentIds:i,activeSubagentPath:o,onSelectMain:l,onSelectSubagent:s}){let c=ew.useMemo(()=>(function e(t,n=[]){for(let r of t)n.push({id:r.id,name:r.subagentName,type:r.subagentType,status:r.status,running:r.running,ownerMachineId:r.ownerMachineId,createdAt:r.createdAt}),e(r.children??[],n);return n})(a).filter(e=>!i.has(e.id)).sort((e,t)=>(e.createdAt??"").localeCompare(t.createdAt??"")),[a,i]),d=o[o.length-1]?.id,u=0===o.length;return(0,ey.jsx)("div",{className:"h-full min-h-0 overflow-y-auto px-4 py-4 vtl-scrollbar-hidden",children:(0,ey.jsxs)("div",{className:"ml-auto flex w-full max-w-[20rem] flex-col gap-4",children:[(0,ey.jsx)(HC,{icon:(0,ey.jsx)(um,{className:"size-4 text-sky-500"}),title:"主 Agent",role:e||"主对话",running:r,status:r?"working":"idle",active:u,onClick:l,events:t}),c.map(e=>(0,ey.jsx)(HM,{subagent:e,ownerMachineId:n,active:e.id===d,onClick:()=>s({id:e.id,ownerMachineId:e.ownerMachineId??n,name:e.name,subagentType:e.type})},e.id))]})})}function HO(e){return`vtl:composer-draft:${e}`}function HP(e){if(!e)return"";try{return window.localStorage.getItem(HO(e))??""}catch{return""}}function HA(e){return`vtl:agent:prompt-history:${e}`}function HI(e){if(!e)return[];try{let t=window.localStorage.getItem(HA(e));if(!t)return[];let n=JSON.parse(t);if(!Array.isArray(n))return[];return n.filter(e=>"string"==typeof e)}catch{return[]}}function Hz(e){return`vtl:agent-read-pos:${e}`}let HT=(0,ek.default)("columns-2",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 3v18",key:"108xh3"}]]),HD=(0,ek.default)("file-diff",[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M9 10h6",key:"9gxzsh"}],["path",{d:"M12 13V7",key:"h0r20n"}],["path",{d:"M9 17h6",key:"r8uit2"}]]),H_=(0,ek.default)("folder-tree",[["path",{d:"M20 10a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1h-2.5a1 1 0 0 1-.8-.4l-.9-1.2A1 1 0 0 0 15 3h-2a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z",key:"hod4my"}],["path",{d:"M20 21a1 1 0 0 0 1-1v-3a1 1 0 0 0-1-1h-2.9a1 1 0 0 1-.88-.55l-.42-.85a1 1 0 0 0-.92-.6H13a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z",key:"w4yl2u"}],["path",{d:"M3 5a2 2 0 0 0 2 2h3",key:"f2jnh7"}],["path",{d:"M3 3v13a2 2 0 0 0 2 2h3",key:"k8epm1"}]]),HR=(0,ek.default)("globe",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]]),HL=(0,ek.default)("maximize",[["path",{d:"M8 3H5a2 2 0 0 0-2 2v3",key:"1dcmit"}],["path",{d:"M21 8V5a2 2 0 0 0-2-2h-3",key:"1e4gt3"}],["path",{d:"M3 16v3a2 2 0 0 0 2 2h3",key:"wsl5sc"}],["path",{d:"M16 21h3a2 2 0 0 0 2-2v-3",key:"18trek"}]]),H$=(0,ek.default)("panel-bottom",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 15h18",key:"5xshup"}]]),HF=(0,ek.default)("panel-top",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}]]);var HB=e.i(78737);let HV=(0,ek.default)("earth",[["path",{d:"M21.54 15H17a2 2 0 0 0-2 2v4.54",key:"1djwo0"}],["path",{d:"M7 3.34V5a3 3 0 0 0 3 3a2 2 0 0 1 2 2c0 1.1.9 2 2 2a2 2 0 0 0 2-2c0-1.1.9-2 2-2h3.17",key:"1tzkfa"}],["path",{d:"M11 21.95V18a2 2 0 0 0-2-2a2 2 0 0 1-2-2v-1a2 2 0 0 0-2-2H2.05",key:"14pb5j"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]),HH=(0,ek.default)("smartphone",[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]]),HU=(0,ek.default)("tablet",[["rect",{width:"16",height:"20",x:"4",y:"2",rx:"2",ry:"2",key:"76otgf"}],["line",{x1:"12",x2:"12.01",y1:"18",y2:"18",key:"1dp563"}]]),HW=[{id:"phone",label:"Phone",width:390,userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 18_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.0 Mobile/15E148 Safari/604.1"},{id:"tablet",label:"Tablet",width:820,userAgent:"Mozilla/5.0 (iPad; CPU OS 18_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.0 Mobile/15E148 Safari/604.1"},{id:"desktop",label:"Desktop",width:1200,userAgent:"Mozilla/5.0 (Macintosh; Intel Mac OS X 15_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36"}],Hq=[{id:"adaptive",label:"自适应",adaptive:!0},{id:"16:9",label:"16:9",value:16/9},{id:"4:3",label:"4:3",value:4/3},{id:"3:2",label:"3:2",value:1.5},{id:"1:1",label:"1:1",value:1},{id:"9:16",label:"9:16",value:9/16}],HK={urlLabel:"URL",urlPlaceholder:"https://example.com",navigate:"Navigate",actions:"Browser view options",devices:"User agent",ratios:"Viewport ratio",back:"Back",forward:"Forward",reload:"Reload preview",previewTitle:"Browser preview"};function HG(e,t,n){return e.find(e=>e.id===t)??n}function HX({id:e}){return"phone"===e?(0,ey.jsx)(HH,{className:"size-4"}):"tablet"===e?(0,ey.jsx)(HU,{className:"size-4"}):(0,ey.jsx)(eP,{className:"size-4"})}function HY({url:e,defaultUrl:t="https://vantaloom.local/workspace",onUrlChange:n,onNavigate:r,onBack:a,onForward:i,device:o,defaultDevice:l="desktop",onDeviceChange:s,ratio:c,defaultRatio:d="adaptive",onRatioChange:u,devices:f=HW,ratios:h=Hq,srcDoc:p,renderPreview:m,showHeader:g=!0,labels:v,className:x,headerClassName:y,previewClassName:b,...w}){let j=ew.useMemo(()=>({...HK,...v}),[v]),[k,S]=ew.useState(t),[N,C]=ew.useState(e??t),[M,E]=ew.useState(()=>[e??t]),[O,P]=ew.useState(0),[A,I]=ew.useState(l),[z,T]=ew.useState(d),[D,_]=ew.useState(!1),[R,L]=ew.useState(0),$=ew.useRef(null),F=ew.useId(),[B,V]=function(){let e=ew.useRef(null),[t,n]=ew.useState({width:0,height:0});return ew.useEffect(()=>{let t=e.current;if(!t)return;function r(e){t&&n(e??{width:t.clientWidth,height:t.clientHeight})}r();let a=new ResizeObserver(e=>{let t=e[0];t?r({width:t.contentRect.width,height:t.contentRect.height}):r()});return a.observe(t),()=>a.disconnect()},[]),[e,t]}(),H=e??k,U=HG(f,o??A,f[0]??HW[0]),W=HG(h,c??z,h[0]??Hq[0]),q=V.width>0&&V.height>0,K=W.adaptive||"adaptive"===W.id,G=W.value??16/9,X=K&&V.width||U.width,Y=K?V.height||U.width/G:X/G,Z=(q?V.width/V.height:1)<=G,J=Math.max(1,Math.round(q?K||Z?V.width:V.height*G:X)),Q=Math.max(1,Math.round(q?K?V.height:Z?V.width/G:V.height:Y)),ee=J/X,et=ew.useMemo(()=>({url:H,device:U,ratio:W,viewport:{width:J,height:Q,scale:ee}}),[U,W,H,ee,Q,J]);function en(t,a={history:"push"}){void 0===e&&S(t),"none"!==a.history&&E(e=>{let n=e.slice(0,O+1);return n[n.length-1]===t?n:(P(n.length),[...n,t])}),n?.(t),r?.(t)}return ew.useEffect(()=>{C(e??k)},[k,e]),ew.useEffect(()=>{if(D)return window.addEventListener("pointerdown",e),()=>window.removeEventListener("pointerdown",e);function e(e){let t=e.target;t instanceof Node&&$.current?.contains(t)||_(!1)}},[D]),(0,ey.jsxs)("div",{ref:$,"data-slot":"browser-tab-viewer","data-device":U.id,"data-ratio":W.id,className:(0,eI.cn)("vtl-surface-panel relative grid min-h-0 overflow-hidden rounded-[var(--surface-panel-radius)] border",g?"grid-rows-[auto_minmax(0,1fr)]":"grid-rows-[minmax(0,1fr)]",x),...w,children:[g&&(0,ey.jsxs)("div",{"data-slot":"browser-tab-viewer-header",className:(0,eI.cn)("flex min-w-0 items-center gap-2 border-b bg-muted/35 px-3 py-2",y),children:[(0,ey.jsx)("span",{className:"grid size-5 shrink-0 place-items-center rounded-md border bg-background text-muted-foreground",children:(0,ey.jsx)(HV,{className:"size-3.5"})}),(0,ey.jsxs)("form",{onSubmit:function(e){let t;e.preventDefault();let n=(t=N.trim())?/^[a-z][a-z\d+\-.]*:\/\//i.test(t)?t:/^(localhost|127\.0\.0\.1|\[::1\])(?::\d+)?(?:\/|$)/i.test(t)?`http://${t}`:`https://${t}`:"";C(n),en(n)},className:"min-w-0 flex-1",children:[(0,ey.jsx)("label",{className:"sr-only",htmlFor:F,children:j.urlLabel}),(0,ey.jsx)(ez,{id:F,value:N,onChange:e=>C(e.target.value),placeholder:j.urlPlaceholder,className:"h-5 rounded-md border bg-background px-2 shadow-none ui-text-kbd",spellCheck:!1})]}),(0,ey.jsx)(eA.Button,{type:"button",variant:"ghost",size:"icon-xs","aria-label":j.back,disabled:O<=0,onClick:function(){if(O<=0)return;let e=O-1,t=M[e];t&&(P(e),C(t),en(t,{history:"none"}),a?.(t))},className:"size-5 rounded-md",children:(0,ey.jsx)(HB.ArrowLeftIcon,{className:"size-3.5"})}),(0,ey.jsx)(eA.Button,{type:"button",variant:"ghost",size:"icon-xs","aria-label":j.forward,disabled:O>=M.length-1,onClick:function(){if(O>=M.length-1)return;let e=O+1,t=M[e];t&&(P(e),C(t),en(t,{history:"none"}),i?.(t))},className:"size-5 rounded-md",children:(0,ey.jsx)(ej.ArrowRightIcon,{className:"size-3.5"})}),(0,ey.jsx)(eA.Button,{type:"button",variant:"ghost",size:"icon-xs","aria-label":j.reload,onClick:()=>L(e=>e+1),className:"size-5 rounded-md",children:(0,ey.jsx)(x1,{className:"size-3.5"})})]}),(0,ey.jsx)("div",{ref:B,"data-slot":"browser-tab-viewer-stage",className:(0,eI.cn)("grid min-h-0 place-items-center overflow-hidden bg-muted/20",b),children:(0,ey.jsx)("div",{"data-slot":"browser-tab-viewer-viewport",className:"overflow-hidden rounded-lg border bg-background shadow-sm",style:{width:J,height:Q},children:m?m(et):(0,ey.jsx)("iframe",{title:j.previewTitle,src:p?void 0:H,srcDoc:p,sandbox:"allow-forms allow-modals allow-popups allow-same-origin allow-scripts",className:"size-full border-0 bg-background"},`${R}-${H}-${U.id}-${W.id}`)})}),(0,ey.jsxs)("div",{"data-slot":"browser-tab-floating-actions",className:"absolute right-3 bottom-3 z-20",children:[(0,ey.jsxs)("div",{className:(0,eI.cn)("vtl-surface-popover absolute right-0 bottom-10 grid w-56 gap-3 rounded-[var(--surface-popover-radius)] border p-3 transition-[opacity,transform] duration-150",D?"pointer-events-auto opacity-100":"pointer-events-none translate-y-1 opacity-0"),children:[(0,ey.jsxs)("div",{className:"grid gap-2",children:[(0,ey.jsx)("div",{className:"text-muted-foreground ui-text-kbd",children:j.devices}),(0,ey.jsx)("div",{className:"flex gap-1.5",children:f.map(e=>(0,ey.jsx)(eA.Button,{type:"button",variant:U.id===e.id?"default":"outline",size:"icon-sm","aria-label":e.label,title:e.label,className:"rounded-full",onClick:()=>{let t;return t=HG(f,e.id,U),void(void 0===o&&I(t.id),s?.(t.id,t))},children:(0,ey.jsx)(HX,{id:e.id})},e.id))})]}),(0,ey.jsxs)("div",{className:"grid gap-2",children:[(0,ey.jsx)("div",{className:"text-muted-foreground ui-text-kbd",children:j.ratios}),(0,ey.jsx)("div",{className:"flex flex-wrap gap-1.5",children:h.map(e=>(0,ey.jsx)(eA.Button,{type:"button",variant:W.id===e.id?"default":"outline",size:"xs",className:"h-7 rounded-full px-2.5 ui-text-kbd",onClick:()=>{let t;return t=HG(h,e.id,W),void(void 0===c&&T(t.id),u?.(t.id,t))},children:e.label},e.id))})]})]}),(0,ey.jsx)(eA.Button,{type:"button",variant:"outline",size:"icon-sm","aria-label":j.actions,"aria-expanded":D,onClick:()=>_(e=>!e),className:"rounded-full bg-background/95 shadow-md backdrop-blur",children:(0,ey.jsx)(lY,{className:(0,eI.cn)("size-4 transition-transform",D&&"rotate-90")})})]})]})}function HZ(e,t){return"function"==typeof e?e(t):e}function HJ(e,t){return n=>{t.setState(t=>({...t,[e]:HZ(n,t[e])}))}}function HQ(e){return e instanceof Function}function H0(e,t,n){let r,a=[];return i=>{let o,l;n.key&&n.debug&&(o=Date.now());let s=e(i);if(!(s.length!==a.length||s.some((e,t)=>a[t]!==e)))return r;if(a=s,n.key&&n.debug&&(l=Date.now()),r=t(...s),null==n||null==n.onChange||n.onChange(r),n.key&&n.debug&&null!=n&&n.debug()){let e=Math.round((Date.now()-o)*100)/100,t=Math.round((Date.now()-l)*100)/100,r=t/16,a=(e,t)=>{for(e=String(e);e.length<t;)e=" "+e;return e};console.info(`%c⏱ ${a(t,5)} /${a(e,5)} ms`,`
26
26
  font-size: .6rem;
27
27
  font-weight: bold;
28
28
  color: hsl(${Math.max(0,Math.min(120-120*r,120))}deg 100% 31%);`,null==n?void 0:n.key)}return r}}function H1(e,t,n,r){return{debug:()=>{var n;return null!=(n=null==e?void 0:e.debugAll)?n:e[t]},key:!1,onChange:r}}let H2="debugHeaders";function H5(e,t,n){var r;let a={id:null!=(r=n.id)?r:t.id,column:t,index:n.index,isPlaceholder:!!n.isPlaceholder,placeholderId:n.placeholderId,depth:n.depth,subHeaders:[],colSpan:0,rowSpan:0,headerGroup:null,getLeafHeaders:()=>{let e=[],t=n=>{n.subHeaders&&n.subHeaders.length&&n.subHeaders.map(t),e.push(n)};return t(a),e},getContext:()=>({table:e,header:a,column:t})};return e._features.forEach(t=>{null==t.createHeader||t.createHeader(a,e)}),a}function H4(e,t,n,r){var a,i;let o=0,l=function(e,t){void 0===t&&(t=1),o=Math.max(o,t),e.filter(e=>e.getIsVisible()).forEach(e=>{var n;null!=(n=e.columns)&&n.length&&l(e.columns,t+1)},0)};l(e);let s=[],c=(e,t)=>{let a={depth:t,id:[r,`${t}`].filter(Boolean).join("_"),headers:[]},i=[];e.forEach(e=>{let o,l=[...i].reverse()[0],s=e.column.depth===a.depth,c=!1;if(s&&e.column.parent?o=e.column.parent:(o=e.column,c=!0),l&&(null==l?void 0:l.column)===o)l.subHeaders.push(e);else{let a=H5(n,o,{id:[r,t,o.id,null==e?void 0:e.id].filter(Boolean).join("_"),isPlaceholder:c,placeholderId:c?`${i.filter(e=>e.column===o).length}`:void 0,depth:t,index:i.length});a.subHeaders.push(e),i.push(a)}a.headers.push(e),e.headerGroup=a}),s.push(a),t>0&&c(i,t-1)};c(t.map((e,t)=>H5(n,e,{depth:o,index:t})),o-1),s.reverse();let d=e=>e.filter(e=>e.column.getIsVisible()).map(e=>{let t=0,n=0,r=[0];return e.subHeaders&&e.subHeaders.length?(r=[],d(e.subHeaders).forEach(e=>{let{colSpan:n,rowSpan:a}=e;t+=n,r.push(a)})):t=1,n+=Math.min(...r),e.colSpan=t,e.rowSpan=n,{colSpan:t,rowSpan:n}});return d(null!=(a=null==(i=s[0])?void 0:i.headers)?a:[]),s}let H3=(e,t,n,r,a,i,o)=>{let l={id:t,index:r,original:n,depth:a,parentId:o,_valuesCache:{},_uniqueValuesCache:{},getValue:t=>{if(l._valuesCache.hasOwnProperty(t))return l._valuesCache[t];let n=e.getColumn(t);if(null!=n&&n.accessorFn)return l._valuesCache[t]=n.accessorFn(l.original,r),l._valuesCache[t]},getUniqueValues:t=>{if(l._uniqueValuesCache.hasOwnProperty(t))return l._uniqueValuesCache[t];let n=e.getColumn(t);if(null!=n&&n.accessorFn)return n.columnDef.getUniqueValues?l._uniqueValuesCache[t]=n.columnDef.getUniqueValues(l.original,r):l._uniqueValuesCache[t]=[l.getValue(t)],l._uniqueValuesCache[t]},renderValue:t=>{var n;return null!=(n=l.getValue(t))?n:e.options.renderFallbackValue},subRows:null!=i?i:[],getLeafRows:()=>{var e,t;let n,r;return e=l.subRows,t=e=>e.subRows,n=[],(r=e=>{e.forEach(e=>{n.push(e);let a=t(e);null!=a&&a.length&&r(a)})})(e),n},getParentRow:()=>l.parentId?e.getRow(l.parentId,!0):void 0,getParentRows:()=>{let e=[],t=l;for(;;){let n=t.getParentRow();if(!n)break;e.push(n),t=n}return e.reverse()},getAllCells:H0(()=>[e.getAllLeafColumns()],t=>t.map(t=>{var n;let r;return n=t.id,r={id:`${l.id}_${t.id}`,row:l,column:t,getValue:()=>l.getValue(n),renderValue:()=>{var t;return null!=(t=r.getValue())?t:e.options.renderFallbackValue},getContext:H0(()=>[e,t,l,r],(e,t,n,r)=>({table:e,column:t,row:n,cell:r,getValue:r.getValue,renderValue:r.renderValue}),H1(e.options,"debugCells","cell.getContext"))},e._features.forEach(n=>{null==n.createCell||n.createCell(r,t,l,e)},{}),r}),H1(e.options,"debugRows","getAllCells")),_getAllCellsByColumnId:H0(()=>[l.getAllCells()],e=>e.reduce((e,t)=>(e[t.column.id]=t,e),{}),H1(e.options,"debugRows","getAllCellsByColumnId"))};for(let t=0;t<e._features.length;t++){let n=e._features[t];null==n||null==n.createRow||n.createRow(l,e)}return l},H6=(e,t,n)=>{var r,a;let i=null==n||null==(r=n.toString())?void 0:r.toLowerCase();return!!(null==(a=e.getValue(t))||null==(a=a.toString())||null==(a=a.toLowerCase())?void 0:a.includes(i))};H6.autoRemove=e=>Uo(e);let H8=(e,t,n)=>{var r;return!!(null==(r=e.getValue(t))||null==(r=r.toString())?void 0:r.includes(n))};H8.autoRemove=e=>Uo(e);let H7=(e,t,n)=>{var r;return(null==(r=e.getValue(t))||null==(r=r.toString())?void 0:r.toLowerCase())===(null==n?void 0:n.toLowerCase())};H7.autoRemove=e=>Uo(e);let H9=(e,t,n)=>{var r;return null==(r=e.getValue(t))?void 0:r.includes(n)};H9.autoRemove=e=>Uo(e);let Ue=(e,t,n)=>!n.some(n=>{var r;return!(null!=(r=e.getValue(t))&&r.includes(n))});Ue.autoRemove=e=>Uo(e)||!(null!=e&&e.length);let Ut=(e,t,n)=>n.some(n=>{var r;return null==(r=e.getValue(t))?void 0:r.includes(n)});Ut.autoRemove=e=>Uo(e)||!(null!=e&&e.length);let Un=(e,t,n)=>e.getValue(t)===n;Un.autoRemove=e=>Uo(e);let Ur=(e,t,n)=>e.getValue(t)==n;Ur.autoRemove=e=>Uo(e);let Ua=(e,t,n)=>{let[r,a]=n,i=e.getValue(t);return i>=r&&i<=a};Ua.resolveFilterValue=e=>{let[t,n]=e,r="number"!=typeof t?parseFloat(t):t,a="number"!=typeof n?parseFloat(n):n,i=null===t||Number.isNaN(r)?-1/0:r,o=null===n||Number.isNaN(a)?1/0:a;if(i>o){let e=i;i=o,o=e}return[i,o]},Ua.autoRemove=e=>Uo(e)||Uo(e[0])&&Uo(e[1]);let Ui={includesString:H6,includesStringSensitive:H8,equalsString:H7,arrIncludes:H9,arrIncludesAll:Ue,arrIncludesSome:Ut,equals:Un,weakEquals:Ur,inNumberRange:Ua};function Uo(e){return null==e||""===e}function Ul(e,t,n){return!!e&&!!e.autoRemove&&e.autoRemove(t,n)||void 0===t||"string"==typeof t&&!t}let Us={sum:(e,t,n)=>n.reduce((t,n)=>{let r=n.getValue(e);return t+("number"==typeof r?r:0)},0),min:(e,t,n)=>{let r;return n.forEach(t=>{let n=t.getValue(e);null!=n&&(r>n||void 0===r&&n>=n)&&(r=n)}),r},max:(e,t,n)=>{let r;return n.forEach(t=>{let n=t.getValue(e);null!=n&&(r<n||void 0===r&&n>=n)&&(r=n)}),r},extent:(e,t,n)=>{let r,a;return n.forEach(t=>{let n=t.getValue(e);null!=n&&(void 0===r?n>=n&&(r=a=n):(r>n&&(r=n),a<n&&(a=n)))}),[r,a]},mean:(e,t)=>{let n=0,r=0;if(t.forEach(t=>{let a=t.getValue(e);null!=a&&(a*=1)>=a&&(++n,r+=a)}),n)return r/n},median:(e,t)=>{if(!t.length)return;let n=t.map(t=>t.getValue(e));if(!(Array.isArray(n)&&n.every(e=>"number"==typeof e)))return;if(1===n.length)return n[0];let r=Math.floor(n.length/2),a=n.sort((e,t)=>e-t);return n.length%2!=0?a[r]:(a[r-1]+a[r])/2},unique:(e,t)=>Array.from(new Set(t.map(t=>t.getValue(e))).values()),uniqueCount:(e,t)=>new Set(t.map(t=>t.getValue(e))).size,count:(e,t)=>t.length},Uc=()=>({left:[],right:[]}),Ud={size:150,minSize:20,maxSize:Number.MAX_SAFE_INTEGER},Uu=()=>({startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,isResizingColumn:!1,columnSizingStart:[]}),Uf=null;function Uh(e){return"touchstart"===e.type}function Up(e,t){return t?"center"===t?e.getCenterVisibleLeafColumns():"left"===t?e.getLeftVisibleLeafColumns():e.getRightVisibleLeafColumns():e.getVisibleLeafColumns()}let Um=()=>({pageIndex:0,pageSize:10}),Ug=()=>({top:[],bottom:[]}),Uv=(e,t,n,r,a)=>{var i;let o=a.getRow(t,!0);n?(o.getCanMultiSelect()||Object.keys(e).forEach(t=>delete e[t]),o.getCanSelect()&&(e[t]=!0)):delete e[t],r&&null!=(i=o.subRows)&&i.length&&o.getCanSelectSubRows()&&o.subRows.forEach(t=>Uv(e,t.id,n,r,a))};function Ux(e,t){let n=e.getState().rowSelection,r=[],a={},i=function(e,t){return e.map(e=>{var t;let o=Uy(e,n);if(o&&(r.push(e),a[e.id]=e),null!=(t=e.subRows)&&t.length&&(e={...e,subRows:i(e.subRows)}),o)return e}).filter(Boolean)};return{rows:i(t.rows),flatRows:r,rowsById:a}}function Uy(e,t){var n;return null!=(n=t[e.id])&&n}function Ub(e,t,n){var r;if(!(null!=(r=e.subRows)&&r.length))return!1;let a=!0,i=!1;return e.subRows.forEach(e=>{if((!i||a)&&(e.getCanSelect()&&(Uy(e,t)?i=!0:a=!1),e.subRows&&e.subRows.length)){let n=Ub(e,t);"all"===n?i=!0:("some"===n&&(i=!0),a=!1)}}),a?"all":!!i&&"some"}let Uw=/([0-9]+)/gm;function Uj(e,t){return e===t?0:e>t?1:-1}function Uk(e){return"number"==typeof e?isNaN(e)||e===1/0||e===-1/0?"":String(e):"string"==typeof e?e:""}function US(e,t){let n=e.split(Uw).filter(Boolean),r=t.split(Uw).filter(Boolean);for(;n.length&&r.length;){let e=n.shift(),t=r.shift(),a=parseInt(e,10),i=parseInt(t,10),o=[a,i].sort();if(isNaN(o[0])){if(e>t)return 1;if(t>e)return -1;continue}if(isNaN(o[1]))return isNaN(a)?-1:1;if(a>i)return 1;if(i>a)return -1}return n.length-r.length}let UN={alphanumeric:(e,t,n)=>US(Uk(e.getValue(n)).toLowerCase(),Uk(t.getValue(n)).toLowerCase()),alphanumericCaseSensitive:(e,t,n)=>US(Uk(e.getValue(n)),Uk(t.getValue(n))),text:(e,t,n)=>Uj(Uk(e.getValue(n)).toLowerCase(),Uk(t.getValue(n)).toLowerCase()),textCaseSensitive:(e,t,n)=>Uj(Uk(e.getValue(n)),Uk(t.getValue(n))),datetime:(e,t,n)=>{let r=e.getValue(n),a=t.getValue(n);return r>a?1:r<a?-1:0},basic:(e,t,n)=>Uj(e.getValue(n),t.getValue(n))},UC=[{createTable:e=>{e.getHeaderGroups=H0(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(t,n,r,a)=>{var i,o;let l=null!=(i=null==r?void 0:r.map(e=>n.find(t=>t.id===e)).filter(Boolean))?i:[],s=null!=(o=null==a?void 0:a.map(e=>n.find(t=>t.id===e)).filter(Boolean))?o:[];return H4(t,[...l,...n.filter(e=>!(null!=r&&r.includes(e.id))&&!(null!=a&&a.includes(e.id))),...s],e)},H1(e.options,H2,"getHeaderGroups")),e.getCenterHeaderGroups=H0(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(t,n,r,a)=>H4(t,n=n.filter(e=>!(null!=r&&r.includes(e.id))&&!(null!=a&&a.includes(e.id))),e,"center"),H1(e.options,H2,"getCenterHeaderGroups")),e.getLeftHeaderGroups=H0(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left],(t,n,r)=>{var a;return H4(t,null!=(a=null==r?void 0:r.map(e=>n.find(t=>t.id===e)).filter(Boolean))?a:[],e,"left")},H1(e.options,H2,"getLeftHeaderGroups")),e.getRightHeaderGroups=H0(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.right],(t,n,r)=>{var a;return H4(t,null!=(a=null==r?void 0:r.map(e=>n.find(t=>t.id===e)).filter(Boolean))?a:[],e,"right")},H1(e.options,H2,"getRightHeaderGroups")),e.getFooterGroups=H0(()=>[e.getHeaderGroups()],e=>[...e].reverse(),H1(e.options,H2,"getFooterGroups")),e.getLeftFooterGroups=H0(()=>[e.getLeftHeaderGroups()],e=>[...e].reverse(),H1(e.options,H2,"getLeftFooterGroups")),e.getCenterFooterGroups=H0(()=>[e.getCenterHeaderGroups()],e=>[...e].reverse(),H1(e.options,H2,"getCenterFooterGroups")),e.getRightFooterGroups=H0(()=>[e.getRightHeaderGroups()],e=>[...e].reverse(),H1(e.options,H2,"getRightFooterGroups")),e.getFlatHeaders=H0(()=>[e.getHeaderGroups()],e=>e.map(e=>e.headers).flat(),H1(e.options,H2,"getFlatHeaders")),e.getLeftFlatHeaders=H0(()=>[e.getLeftHeaderGroups()],e=>e.map(e=>e.headers).flat(),H1(e.options,H2,"getLeftFlatHeaders")),e.getCenterFlatHeaders=H0(()=>[e.getCenterHeaderGroups()],e=>e.map(e=>e.headers).flat(),H1(e.options,H2,"getCenterFlatHeaders")),e.getRightFlatHeaders=H0(()=>[e.getRightHeaderGroups()],e=>e.map(e=>e.headers).flat(),H1(e.options,H2,"getRightFlatHeaders")),e.getCenterLeafHeaders=H0(()=>[e.getCenterFlatHeaders()],e=>e.filter(e=>{var t;return!(null!=(t=e.subHeaders)&&t.length)}),H1(e.options,H2,"getCenterLeafHeaders")),e.getLeftLeafHeaders=H0(()=>[e.getLeftFlatHeaders()],e=>e.filter(e=>{var t;return!(null!=(t=e.subHeaders)&&t.length)}),H1(e.options,H2,"getLeftLeafHeaders")),e.getRightLeafHeaders=H0(()=>[e.getRightFlatHeaders()],e=>e.filter(e=>{var t;return!(null!=(t=e.subHeaders)&&t.length)}),H1(e.options,H2,"getRightLeafHeaders")),e.getLeafHeaders=H0(()=>[e.getLeftHeaderGroups(),e.getCenterHeaderGroups(),e.getRightHeaderGroups()],(e,t,n)=>{var r,a,i,o,l,s;return[...null!=(r=null==(a=e[0])?void 0:a.headers)?r:[],...null!=(i=null==(o=t[0])?void 0:o.headers)?i:[],...null!=(l=null==(s=n[0])?void 0:s.headers)?l:[]].map(e=>e.getLeafHeaders()).flat()},H1(e.options,H2,"getLeafHeaders"))}},{getInitialState:e=>({columnVisibility:{},...e}),getDefaultOptions:e=>({onColumnVisibilityChange:HJ("columnVisibility",e)}),createColumn:(e,t)=>{e.toggleVisibility=n=>{e.getCanHide()&&t.setColumnVisibility(t=>({...t,[e.id]:null!=n?n:!e.getIsVisible()}))},e.getIsVisible=()=>{var n,r;let a=e.columns;return null==(n=a.length?a.some(e=>e.getIsVisible()):null==(r=t.getState().columnVisibility)?void 0:r[e.id])||n},e.getCanHide=()=>{var n,r;return(null==(n=e.columnDef.enableHiding)||n)&&(null==(r=t.options.enableHiding)||r)},e.getToggleVisibilityHandler=()=>t=>{null==e.toggleVisibility||e.toggleVisibility(t.target.checked)}},createRow:(e,t)=>{e._getAllVisibleCells=H0(()=>[e.getAllCells(),t.getState().columnVisibility],e=>e.filter(e=>e.column.getIsVisible()),H1(t.options,"debugRows","_getAllVisibleCells")),e.getVisibleCells=H0(()=>[e.getLeftVisibleCells(),e.getCenterVisibleCells(),e.getRightVisibleCells()],(e,t,n)=>[...e,...t,...n],H1(t.options,"debugRows","getVisibleCells"))},createTable:e=>{let t=(t,n)=>H0(()=>[n(),n().filter(e=>e.getIsVisible()).map(e=>e.id).join("_")],e=>e.filter(e=>null==e.getIsVisible?void 0:e.getIsVisible()),H1(e.options,"debugColumns",t));e.getVisibleFlatColumns=t("getVisibleFlatColumns",()=>e.getAllFlatColumns()),e.getVisibleLeafColumns=t("getVisibleLeafColumns",()=>e.getAllLeafColumns()),e.getLeftVisibleLeafColumns=t("getLeftVisibleLeafColumns",()=>e.getLeftLeafColumns()),e.getRightVisibleLeafColumns=t("getRightVisibleLeafColumns",()=>e.getRightLeafColumns()),e.getCenterVisibleLeafColumns=t("getCenterVisibleLeafColumns",()=>e.getCenterLeafColumns()),e.setColumnVisibility=t=>null==e.options.onColumnVisibilityChange?void 0:e.options.onColumnVisibilityChange(t),e.resetColumnVisibility=t=>{var n;e.setColumnVisibility(t?{}:null!=(n=e.initialState.columnVisibility)?n:{})},e.toggleAllColumnsVisible=t=>{var n;t=null!=(n=t)?n:!e.getIsAllColumnsVisible(),e.setColumnVisibility(e.getAllLeafColumns().reduce((e,n)=>({...e,[n.id]:t||!(null!=n.getCanHide&&n.getCanHide())}),{}))},e.getIsAllColumnsVisible=()=>!e.getAllLeafColumns().some(e=>!(null!=e.getIsVisible&&e.getIsVisible())),e.getIsSomeColumnsVisible=()=>e.getAllLeafColumns().some(e=>null==e.getIsVisible?void 0:e.getIsVisible()),e.getToggleAllColumnsVisibilityHandler=()=>t=>{var n;e.toggleAllColumnsVisible(null==(n=t.target)?void 0:n.checked)}}},{getInitialState:e=>({columnOrder:[],...e}),getDefaultOptions:e=>({onColumnOrderChange:HJ("columnOrder",e)}),createColumn:(e,t)=>{e.getIndex=H0(e=>[Up(t,e)],t=>t.findIndex(t=>t.id===e.id),H1(t.options,"debugColumns","getIndex")),e.getIsFirstColumn=n=>{var r;return(null==(r=Up(t,n)[0])?void 0:r.id)===e.id},e.getIsLastColumn=n=>{var r;let a=Up(t,n);return(null==(r=a[a.length-1])?void 0:r.id)===e.id}},createTable:e=>{e.setColumnOrder=t=>null==e.options.onColumnOrderChange?void 0:e.options.onColumnOrderChange(t),e.resetColumnOrder=t=>{var n;e.setColumnOrder(t?[]:null!=(n=e.initialState.columnOrder)?n:[])},e._getOrderColumnsFn=H0(()=>[e.getState().columnOrder,e.getState().grouping,e.options.groupedColumnMode],(e,t,n)=>r=>{let a=[];if(null!=e&&e.length){let t=[...e],n=[...r];for(;n.length&&t.length;){let e=t.shift(),r=n.findIndex(t=>t.id===e);r>-1&&a.push(n.splice(r,1)[0])}a=[...a,...n]}else a=r;var i=a;if(!(null!=t&&t.length)||!n)return i;let o=i.filter(e=>!t.includes(e.id));return"remove"===n?o:[...t.map(e=>i.find(t=>t.id===e)).filter(Boolean),...o]},H1(e.options,"debugTable","_getOrderColumnsFn"))}},{getInitialState:e=>({columnPinning:Uc(),...e}),getDefaultOptions:e=>({onColumnPinningChange:HJ("columnPinning",e)}),createColumn:(e,t)=>{e.pin=n=>{let r=e.getLeafColumns().map(e=>e.id).filter(Boolean);t.setColumnPinning(e=>{var t,a,i,o,l,s;return"right"===n?{left:(null!=(i=null==e?void 0:e.left)?i:[]).filter(e=>!(null!=r&&r.includes(e))),right:[...(null!=(o=null==e?void 0:e.right)?o:[]).filter(e=>!(null!=r&&r.includes(e))),...r]}:"left"===n?{left:[...(null!=(l=null==e?void 0:e.left)?l:[]).filter(e=>!(null!=r&&r.includes(e))),...r],right:(null!=(s=null==e?void 0:e.right)?s:[]).filter(e=>!(null!=r&&r.includes(e)))}:{left:(null!=(t=null==e?void 0:e.left)?t:[]).filter(e=>!(null!=r&&r.includes(e))),right:(null!=(a=null==e?void 0:e.right)?a:[]).filter(e=>!(null!=r&&r.includes(e)))}})},e.getCanPin=()=>e.getLeafColumns().some(e=>{var n,r,a;return(null==(n=e.columnDef.enablePinning)||n)&&(null==(r=null!=(a=t.options.enableColumnPinning)?a:t.options.enablePinning)||r)}),e.getIsPinned=()=>{let n=e.getLeafColumns().map(e=>e.id),{left:r,right:a}=t.getState().columnPinning,i=n.some(e=>null==r?void 0:r.includes(e)),o=n.some(e=>null==a?void 0:a.includes(e));return i?"left":!!o&&"right"},e.getPinnedIndex=()=>{var n,r;let a=e.getIsPinned();return a?null!=(n=null==(r=t.getState().columnPinning)||null==(r=r[a])?void 0:r.indexOf(e.id))?n:-1:0}},createRow:(e,t)=>{e.getCenterVisibleCells=H0(()=>[e._getAllVisibleCells(),t.getState().columnPinning.left,t.getState().columnPinning.right],(e,t,n)=>{let r=[...null!=t?t:[],...null!=n?n:[]];return e.filter(e=>!r.includes(e.column.id))},H1(t.options,"debugRows","getCenterVisibleCells")),e.getLeftVisibleCells=H0(()=>[e._getAllVisibleCells(),t.getState().columnPinning.left],(e,t)=>(null!=t?t:[]).map(t=>e.find(e=>e.column.id===t)).filter(Boolean).map(e=>({...e,position:"left"})),H1(t.options,"debugRows","getLeftVisibleCells")),e.getRightVisibleCells=H0(()=>[e._getAllVisibleCells(),t.getState().columnPinning.right],(e,t)=>(null!=t?t:[]).map(t=>e.find(e=>e.column.id===t)).filter(Boolean).map(e=>({...e,position:"right"})),H1(t.options,"debugRows","getRightVisibleCells"))},createTable:e=>{e.setColumnPinning=t=>null==e.options.onColumnPinningChange?void 0:e.options.onColumnPinningChange(t),e.resetColumnPinning=t=>{var n,r;return e.setColumnPinning(t?Uc():null!=(n=null==(r=e.initialState)?void 0:r.columnPinning)?n:Uc())},e.getIsSomeColumnsPinned=t=>{var n,r,a;let i=e.getState().columnPinning;return t?!!(null==(n=i[t])?void 0:n.length):!!((null==(r=i.left)?void 0:r.length)||(null==(a=i.right)?void 0:a.length))},e.getLeftLeafColumns=H0(()=>[e.getAllLeafColumns(),e.getState().columnPinning.left],(e,t)=>(null!=t?t:[]).map(t=>e.find(e=>e.id===t)).filter(Boolean),H1(e.options,"debugColumns","getLeftLeafColumns")),e.getRightLeafColumns=H0(()=>[e.getAllLeafColumns(),e.getState().columnPinning.right],(e,t)=>(null!=t?t:[]).map(t=>e.find(e=>e.id===t)).filter(Boolean),H1(e.options,"debugColumns","getRightLeafColumns")),e.getCenterLeafColumns=H0(()=>[e.getAllLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(e,t,n)=>{let r=[...null!=t?t:[],...null!=n?n:[]];return e.filter(e=>!r.includes(e.id))},H1(e.options,"debugColumns","getCenterLeafColumns"))}},{createColumn:(e,t)=>{e._getFacetedRowModel=t.options.getFacetedRowModel&&t.options.getFacetedRowModel(t,e.id),e.getFacetedRowModel=()=>e._getFacetedRowModel?e._getFacetedRowModel():t.getPreFilteredRowModel(),e._getFacetedUniqueValues=t.options.getFacetedUniqueValues&&t.options.getFacetedUniqueValues(t,e.id),e.getFacetedUniqueValues=()=>e._getFacetedUniqueValues?e._getFacetedUniqueValues():new Map,e._getFacetedMinMaxValues=t.options.getFacetedMinMaxValues&&t.options.getFacetedMinMaxValues(t,e.id),e.getFacetedMinMaxValues=()=>{if(e._getFacetedMinMaxValues)return e._getFacetedMinMaxValues()}}},{getDefaultColumnDef:()=>({filterFn:"auto"}),getInitialState:e=>({columnFilters:[],...e}),getDefaultOptions:e=>({onColumnFiltersChange:HJ("columnFilters",e),filterFromLeafRows:!1,maxLeafRowFilterDepth:100}),createColumn:(e,t)=>{e.getAutoFilterFn=()=>{let n=t.getCoreRowModel().flatRows[0],r=null==n?void 0:n.getValue(e.id);return"string"==typeof r?Ui.includesString:"number"==typeof r?Ui.inNumberRange:"boolean"==typeof r||null!==r&&"object"==typeof r?Ui.equals:Array.isArray(r)?Ui.arrIncludes:Ui.weakEquals},e.getFilterFn=()=>{var n,r;return HQ(e.columnDef.filterFn)?e.columnDef.filterFn:"auto"===e.columnDef.filterFn?e.getAutoFilterFn():null!=(n=null==(r=t.options.filterFns)?void 0:r[e.columnDef.filterFn])?n:Ui[e.columnDef.filterFn]},e.getCanFilter=()=>{var n,r,a;return(null==(n=e.columnDef.enableColumnFilter)||n)&&(null==(r=t.options.enableColumnFilters)||r)&&(null==(a=t.options.enableFilters)||a)&&!!e.accessorFn},e.getIsFiltered=()=>e.getFilterIndex()>-1,e.getFilterValue=()=>{var n;return null==(n=t.getState().columnFilters)||null==(n=n.find(t=>t.id===e.id))?void 0:n.value},e.getFilterIndex=()=>{var n,r;return null!=(n=null==(r=t.getState().columnFilters)?void 0:r.findIndex(t=>t.id===e.id))?n:-1},e.setFilterValue=n=>{t.setColumnFilters(t=>{var r,a;let i=e.getFilterFn(),o=null==t?void 0:t.find(t=>t.id===e.id),l=HZ(n,o?o.value:void 0);if(Ul(i,l,e))return null!=(r=null==t?void 0:t.filter(t=>t.id!==e.id))?r:[];let s={id:e.id,value:l};return o?null!=(a=null==t?void 0:t.map(t=>t.id===e.id?s:t))?a:[]:null!=t&&t.length?[...t,s]:[s]})}},createRow:(e,t)=>{e.columnFilters={},e.columnFiltersMeta={}},createTable:e=>{e.setColumnFilters=t=>{let n=e.getAllLeafColumns();null==e.options.onColumnFiltersChange||e.options.onColumnFiltersChange(e=>{var r;return null==(r=HZ(t,e))?void 0:r.filter(e=>{let t=n.find(t=>t.id===e.id);return!(t&&Ul(t.getFilterFn(),e.value,t))&&!0})})},e.resetColumnFilters=t=>{var n,r;e.setColumnFilters(t?[]:null!=(n=null==(r=e.initialState)?void 0:r.columnFilters)?n:[])},e.getPreFilteredRowModel=()=>e.getCoreRowModel(),e.getFilteredRowModel=()=>(!e._getFilteredRowModel&&e.options.getFilteredRowModel&&(e._getFilteredRowModel=e.options.getFilteredRowModel(e)),e.options.manualFiltering||!e._getFilteredRowModel)?e.getPreFilteredRowModel():e._getFilteredRowModel()}},{createTable:e=>{e._getGlobalFacetedRowModel=e.options.getFacetedRowModel&&e.options.getFacetedRowModel(e,"__global__"),e.getGlobalFacetedRowModel=()=>e.options.manualFiltering||!e._getGlobalFacetedRowModel?e.getPreFilteredRowModel():e._getGlobalFacetedRowModel(),e._getGlobalFacetedUniqueValues=e.options.getFacetedUniqueValues&&e.options.getFacetedUniqueValues(e,"__global__"),e.getGlobalFacetedUniqueValues=()=>e._getGlobalFacetedUniqueValues?e._getGlobalFacetedUniqueValues():new Map,e._getGlobalFacetedMinMaxValues=e.options.getFacetedMinMaxValues&&e.options.getFacetedMinMaxValues(e,"__global__"),e.getGlobalFacetedMinMaxValues=()=>{if(e._getGlobalFacetedMinMaxValues)return e._getGlobalFacetedMinMaxValues()}}},{getInitialState:e=>({globalFilter:void 0,...e}),getDefaultOptions:e=>({onGlobalFilterChange:HJ("globalFilter",e),globalFilterFn:"auto",getColumnCanGlobalFilter:t=>{var n;let r=null==(n=e.getCoreRowModel().flatRows[0])||null==(n=n._getAllCellsByColumnId()[t.id])?void 0:n.getValue();return"string"==typeof r||"number"==typeof r}}),createColumn:(e,t)=>{e.getCanGlobalFilter=()=>{var n,r,a,i;return(null==(n=e.columnDef.enableGlobalFilter)||n)&&(null==(r=t.options.enableGlobalFilter)||r)&&(null==(a=t.options.enableFilters)||a)&&(null==(i=null==t.options.getColumnCanGlobalFilter?void 0:t.options.getColumnCanGlobalFilter(e))||i)&&!!e.accessorFn}},createTable:e=>{e.getGlobalAutoFilterFn=()=>Ui.includesString,e.getGlobalFilterFn=()=>{var t,n;let{globalFilterFn:r}=e.options;return HQ(r)?r:"auto"===r?e.getGlobalAutoFilterFn():null!=(t=null==(n=e.options.filterFns)?void 0:n[r])?t:Ui[r]},e.setGlobalFilter=t=>{null==e.options.onGlobalFilterChange||e.options.onGlobalFilterChange(t)},e.resetGlobalFilter=t=>{e.setGlobalFilter(t?void 0:e.initialState.globalFilter)}}},{getInitialState:e=>({sorting:[],...e}),getDefaultColumnDef:()=>({sortingFn:"auto",sortUndefined:1}),getDefaultOptions:e=>({onSortingChange:HJ("sorting",e),isMultiSortEvent:e=>e.shiftKey}),createColumn:(e,t)=>{e.getAutoSortingFn=()=>{let n=t.getFilteredRowModel().flatRows.slice(10),r=!1;for(let t of n){let n=null==t?void 0:t.getValue(e.id);if("[object Date]"===Object.prototype.toString.call(n))return UN.datetime;if("string"==typeof n&&(r=!0,n.split(Uw).length>1))return UN.alphanumeric}return r?UN.text:UN.basic},e.getAutoSortDir=()=>{let n=t.getFilteredRowModel().flatRows[0];return"string"==typeof(null==n?void 0:n.getValue(e.id))?"asc":"desc"},e.getSortingFn=()=>{var n,r;if(!e)throw Error();return HQ(e.columnDef.sortingFn)?e.columnDef.sortingFn:"auto"===e.columnDef.sortingFn?e.getAutoSortingFn():null!=(n=null==(r=t.options.sortingFns)?void 0:r[e.columnDef.sortingFn])?n:UN[e.columnDef.sortingFn]},e.toggleSorting=(n,r)=>{let a=e.getNextSortingOrder(),i=null!=n;t.setSorting(o=>{let l,s=null==o?void 0:o.find(t=>t.id===e.id),c=null==o?void 0:o.findIndex(t=>t.id===e.id),d=[],u=i?n:"desc"===a;if("toggle"!=(l=null!=o&&o.length&&e.getCanMultiSort()&&r?s?"toggle":"add":null!=o&&o.length&&c!==o.length-1?"replace":s?"toggle":"replace")||i||a||(l="remove"),"add"===l){var f;(d=[...o,{id:e.id,desc:u}]).splice(0,d.length-(null!=(f=t.options.maxMultiSortColCount)?f:Number.MAX_SAFE_INTEGER))}else d="toggle"===l?o.map(t=>t.id===e.id?{...t,desc:u}:t):"remove"===l?o.filter(t=>t.id!==e.id):[{id:e.id,desc:u}];return d})},e.getFirstSortDir=()=>{var n,r;return(null!=(n=null!=(r=e.columnDef.sortDescFirst)?r:t.options.sortDescFirst)?n:"desc"===e.getAutoSortDir())?"desc":"asc"},e.getNextSortingOrder=n=>{var r,a;let i=e.getFirstSortDir(),o=e.getIsSorted();return o?(o===i||null!=(r=t.options.enableSortingRemoval)&&!r||!!n&&null!=(a=t.options.enableMultiRemove)&&!a)&&("desc"===o?"asc":"desc"):i},e.getCanSort=()=>{var n,r;return(null==(n=e.columnDef.enableSorting)||n)&&(null==(r=t.options.enableSorting)||r)&&!!e.accessorFn},e.getCanMultiSort=()=>{var n,r;return null!=(n=null!=(r=e.columnDef.enableMultiSort)?r:t.options.enableMultiSort)?n:!!e.accessorFn},e.getIsSorted=()=>{var n;let r=null==(n=t.getState().sorting)?void 0:n.find(t=>t.id===e.id);return!!r&&(r.desc?"desc":"asc")},e.getSortIndex=()=>{var n,r;return null!=(n=null==(r=t.getState().sorting)?void 0:r.findIndex(t=>t.id===e.id))?n:-1},e.clearSorting=()=>{t.setSorting(t=>null!=t&&t.length?t.filter(t=>t.id!==e.id):[])},e.getToggleSortingHandler=()=>{let n=e.getCanSort();return r=>{n&&(null==r.persist||r.persist(),null==e.toggleSorting||e.toggleSorting(void 0,!!e.getCanMultiSort()&&(null==t.options.isMultiSortEvent?void 0:t.options.isMultiSortEvent(r))))}}},createTable:e=>{e.setSorting=t=>null==e.options.onSortingChange?void 0:e.options.onSortingChange(t),e.resetSorting=t=>{var n,r;e.setSorting(t?[]:null!=(n=null==(r=e.initialState)?void 0:r.sorting)?n:[])},e.getPreSortedRowModel=()=>e.getGroupedRowModel(),e.getSortedRowModel=()=>(!e._getSortedRowModel&&e.options.getSortedRowModel&&(e._getSortedRowModel=e.options.getSortedRowModel(e)),e.options.manualSorting||!e._getSortedRowModel)?e.getPreSortedRowModel():e._getSortedRowModel()}},{getDefaultColumnDef:()=>({aggregatedCell:e=>{var t,n;return null!=(t=null==(n=e.getValue())||null==n.toString?void 0:n.toString())?t:null},aggregationFn:"auto"}),getInitialState:e=>({grouping:[],...e}),getDefaultOptions:e=>({onGroupingChange:HJ("grouping",e),groupedColumnMode:"reorder"}),createColumn:(e,t)=>{e.toggleGrouping=()=>{t.setGrouping(t=>null!=t&&t.includes(e.id)?t.filter(t=>t!==e.id):[...null!=t?t:[],e.id])},e.getCanGroup=()=>{var n,r;return(null==(n=e.columnDef.enableGrouping)||n)&&(null==(r=t.options.enableGrouping)||r)&&(!!e.accessorFn||!!e.columnDef.getGroupingValue)},e.getIsGrouped=()=>{var n;return null==(n=t.getState().grouping)?void 0:n.includes(e.id)},e.getGroupedIndex=()=>{var n;return null==(n=t.getState().grouping)?void 0:n.indexOf(e.id)},e.getToggleGroupingHandler=()=>{let t=e.getCanGroup();return()=>{t&&e.toggleGrouping()}},e.getAutoAggregationFn=()=>{let n=t.getCoreRowModel().flatRows[0],r=null==n?void 0:n.getValue(e.id);return"number"==typeof r?Us.sum:"[object Date]"===Object.prototype.toString.call(r)?Us.extent:void 0},e.getAggregationFn=()=>{var n,r;if(!e)throw Error();return HQ(e.columnDef.aggregationFn)?e.columnDef.aggregationFn:"auto"===e.columnDef.aggregationFn?e.getAutoAggregationFn():null!=(n=null==(r=t.options.aggregationFns)?void 0:r[e.columnDef.aggregationFn])?n:Us[e.columnDef.aggregationFn]}},createTable:e=>{e.setGrouping=t=>null==e.options.onGroupingChange?void 0:e.options.onGroupingChange(t),e.resetGrouping=t=>{var n,r;e.setGrouping(t?[]:null!=(n=null==(r=e.initialState)?void 0:r.grouping)?n:[])},e.getPreGroupedRowModel=()=>e.getFilteredRowModel(),e.getGroupedRowModel=()=>(!e._getGroupedRowModel&&e.options.getGroupedRowModel&&(e._getGroupedRowModel=e.options.getGroupedRowModel(e)),e.options.manualGrouping||!e._getGroupedRowModel)?e.getPreGroupedRowModel():e._getGroupedRowModel()},createRow:(e,t)=>{e.getIsGrouped=()=>!!e.groupingColumnId,e.getGroupingValue=n=>{if(e._groupingValuesCache.hasOwnProperty(n))return e._groupingValuesCache[n];let r=t.getColumn(n);return null!=r&&r.columnDef.getGroupingValue?(e._groupingValuesCache[n]=r.columnDef.getGroupingValue(e.original),e._groupingValuesCache[n]):e.getValue(n)},e._groupingValuesCache={}},createCell:(e,t,n,r)=>{e.getIsGrouped=()=>t.getIsGrouped()&&t.id===n.groupingColumnId,e.getIsPlaceholder=()=>!e.getIsGrouped()&&t.getIsGrouped(),e.getIsAggregated=()=>{var t;return!e.getIsGrouped()&&!e.getIsPlaceholder()&&!!(null!=(t=n.subRows)&&t.length)}}},{getInitialState:e=>({expanded:{},...e}),getDefaultOptions:e=>({onExpandedChange:HJ("expanded",e),paginateExpandedRows:!0}),createTable:e=>{let t=!1,n=!1;e._autoResetExpanded=()=>{var r,a;if(!t)return void e._queue(()=>{t=!0});if(null!=(r=null!=(a=e.options.autoResetAll)?a:e.options.autoResetExpanded)?r:!e.options.manualExpanding){if(n)return;n=!0,e._queue(()=>{e.resetExpanded(),n=!1})}},e.setExpanded=t=>null==e.options.onExpandedChange?void 0:e.options.onExpandedChange(t),e.toggleAllRowsExpanded=t=>{(null!=t?t:!e.getIsAllRowsExpanded())?e.setExpanded(!0):e.setExpanded({})},e.resetExpanded=t=>{var n,r;e.setExpanded(t?{}:null!=(n=null==(r=e.initialState)?void 0:r.expanded)?n:{})},e.getCanSomeRowsExpand=()=>e.getPrePaginationRowModel().flatRows.some(e=>e.getCanExpand()),e.getToggleAllRowsExpandedHandler=()=>t=>{null==t.persist||t.persist(),e.toggleAllRowsExpanded()},e.getIsSomeRowsExpanded=()=>{let t=e.getState().expanded;return!0===t||Object.values(t).some(Boolean)},e.getIsAllRowsExpanded=()=>{let t=e.getState().expanded;return"boolean"==typeof t?!0===t:!(!Object.keys(t).length||e.getRowModel().flatRows.some(e=>!e.getIsExpanded()))},e.getExpandedDepth=()=>{let t=0;return(!0===e.getState().expanded?Object.keys(e.getRowModel().rowsById):Object.keys(e.getState().expanded)).forEach(e=>{let n=e.split(".");t=Math.max(t,n.length)}),t},e.getPreExpandedRowModel=()=>e.getSortedRowModel(),e.getExpandedRowModel=()=>(!e._getExpandedRowModel&&e.options.getExpandedRowModel&&(e._getExpandedRowModel=e.options.getExpandedRowModel(e)),e.options.manualExpanding||!e._getExpandedRowModel)?e.getPreExpandedRowModel():e._getExpandedRowModel()},createRow:(e,t)=>{e.toggleExpanded=n=>{t.setExpanded(r=>{var a;let i=!0===r||!!(null!=r&&r[e.id]),o={};if(!0===r?Object.keys(t.getRowModel().rowsById).forEach(e=>{o[e]=!0}):o=r,n=null!=(a=n)?a:!i,!i&&n)return{...o,[e.id]:!0};if(i&&!n){let{[e.id]:t,...n}=o;return n}return r})},e.getIsExpanded=()=>{var n;let r=t.getState().expanded;return!!(null!=(n=null==t.options.getIsRowExpanded?void 0:t.options.getIsRowExpanded(e))?n:!0===r||(null==r?void 0:r[e.id]))},e.getCanExpand=()=>{var n,r,a;return null!=(n=null==t.options.getRowCanExpand?void 0:t.options.getRowCanExpand(e))?n:(null==(r=t.options.enableExpanding)||r)&&!!(null!=(a=e.subRows)&&a.length)},e.getIsAllParentsExpanded=()=>{let n=!0,r=e;for(;n&&r.parentId;)n=(r=t.getRow(r.parentId,!0)).getIsExpanded();return n},e.getToggleExpandedHandler=()=>{let t=e.getCanExpand();return()=>{t&&e.toggleExpanded()}}}},{getInitialState:e=>({...e,pagination:{...Um(),...null==e?void 0:e.pagination}}),getDefaultOptions:e=>({onPaginationChange:HJ("pagination",e)}),createTable:e=>{let t=!1,n=!1;e._autoResetPageIndex=()=>{var r,a;if(!t)return void e._queue(()=>{t=!0});if(null!=(r=null!=(a=e.options.autoResetAll)?a:e.options.autoResetPageIndex)?r:!e.options.manualPagination){if(n)return;n=!0,e._queue(()=>{e.resetPageIndex(),n=!1})}},e.setPagination=t=>null==e.options.onPaginationChange?void 0:e.options.onPaginationChange(e=>HZ(t,e)),e.resetPagination=t=>{var n;e.setPagination(t?Um():null!=(n=e.initialState.pagination)?n:Um())},e.setPageIndex=t=>{e.setPagination(n=>{let r=HZ(t,n.pageIndex);return r=Math.max(0,Math.min(r,void 0===e.options.pageCount||-1===e.options.pageCount?Number.MAX_SAFE_INTEGER:e.options.pageCount-1)),{...n,pageIndex:r}})},e.resetPageIndex=t=>{var n,r;e.setPageIndex(t?0:null!=(n=null==(r=e.initialState)||null==(r=r.pagination)?void 0:r.pageIndex)?n:0)},e.resetPageSize=t=>{var n,r;e.setPageSize(t?10:null!=(n=null==(r=e.initialState)||null==(r=r.pagination)?void 0:r.pageSize)?n:10)},e.setPageSize=t=>{e.setPagination(e=>{let n=Math.max(1,HZ(t,e.pageSize)),r=Math.floor(e.pageSize*e.pageIndex/n);return{...e,pageIndex:r,pageSize:n}})},e.setPageCount=t=>e.setPagination(n=>{var r;let a=HZ(t,null!=(r=e.options.pageCount)?r:-1);return"number"==typeof a&&(a=Math.max(-1,a)),{...n,pageCount:a}}),e.getPageOptions=H0(()=>[e.getPageCount()],e=>{let t=[];return e&&e>0&&(t=[...Array(e)].fill(null).map((e,t)=>t)),t},H1(e.options,"debugTable","getPageOptions")),e.getCanPreviousPage=()=>e.getState().pagination.pageIndex>0,e.getCanNextPage=()=>{let{pageIndex:t}=e.getState().pagination,n=e.getPageCount();return -1===n||0!==n&&t<n-1},e.previousPage=()=>e.setPageIndex(e=>e-1),e.nextPage=()=>e.setPageIndex(e=>e+1),e.firstPage=()=>e.setPageIndex(0),e.lastPage=()=>e.setPageIndex(e.getPageCount()-1),e.getPrePaginationRowModel=()=>e.getExpandedRowModel(),e.getPaginationRowModel=()=>(!e._getPaginationRowModel&&e.options.getPaginationRowModel&&(e._getPaginationRowModel=e.options.getPaginationRowModel(e)),e.options.manualPagination||!e._getPaginationRowModel)?e.getPrePaginationRowModel():e._getPaginationRowModel(),e.getPageCount=()=>{var t;return null!=(t=e.options.pageCount)?t:Math.ceil(e.getRowCount()/e.getState().pagination.pageSize)},e.getRowCount=()=>{var t;return null!=(t=e.options.rowCount)?t:e.getPrePaginationRowModel().rows.length}}},{getInitialState:e=>({rowPinning:Ug(),...e}),getDefaultOptions:e=>({onRowPinningChange:HJ("rowPinning",e)}),createRow:(e,t)=>{e.pin=(n,r,a)=>{let i=r?e.getLeafRows().map(e=>{let{id:t}=e;return t}):[],o=new Set([...a?e.getParentRows().map(e=>{let{id:t}=e;return t}):[],e.id,...i]);t.setRowPinning(e=>{var t,r,a,i,l,s;return"bottom"===n?{top:(null!=(a=null==e?void 0:e.top)?a:[]).filter(e=>!(null!=o&&o.has(e))),bottom:[...(null!=(i=null==e?void 0:e.bottom)?i:[]).filter(e=>!(null!=o&&o.has(e))),...Array.from(o)]}:"top"===n?{top:[...(null!=(l=null==e?void 0:e.top)?l:[]).filter(e=>!(null!=o&&o.has(e))),...Array.from(o)],bottom:(null!=(s=null==e?void 0:e.bottom)?s:[]).filter(e=>!(null!=o&&o.has(e)))}:{top:(null!=(t=null==e?void 0:e.top)?t:[]).filter(e=>!(null!=o&&o.has(e))),bottom:(null!=(r=null==e?void 0:e.bottom)?r:[]).filter(e=>!(null!=o&&o.has(e)))}})},e.getCanPin=()=>{var n;let{enableRowPinning:r,enablePinning:a}=t.options;return"function"==typeof r?r(e):null==(n=null!=r?r:a)||n},e.getIsPinned=()=>{let n=[e.id],{top:r,bottom:a}=t.getState().rowPinning,i=n.some(e=>null==r?void 0:r.includes(e)),o=n.some(e=>null==a?void 0:a.includes(e));return i?"top":!!o&&"bottom"},e.getPinnedIndex=()=>{var n,r;let a=e.getIsPinned();if(!a)return -1;let i=null==(n="top"===a?t.getTopRows():t.getBottomRows())?void 0:n.map(e=>{let{id:t}=e;return t});return null!=(r=null==i?void 0:i.indexOf(e.id))?r:-1}},createTable:e=>{e.setRowPinning=t=>null==e.options.onRowPinningChange?void 0:e.options.onRowPinningChange(t),e.resetRowPinning=t=>{var n,r;return e.setRowPinning(t?Ug():null!=(n=null==(r=e.initialState)?void 0:r.rowPinning)?n:Ug())},e.getIsSomeRowsPinned=t=>{var n,r,a;let i=e.getState().rowPinning;return t?!!(null==(n=i[t])?void 0:n.length):!!((null==(r=i.top)?void 0:r.length)||(null==(a=i.bottom)?void 0:a.length))},e._getPinnedRows=(t,n,r)=>{var a;return(null==(a=e.options.keepPinnedRows)||a?(null!=n?n:[]).map(t=>{let n=e.getRow(t,!0);return n.getIsAllParentsExpanded()?n:null}):(null!=n?n:[]).map(e=>t.find(t=>t.id===e))).filter(Boolean).map(e=>({...e,position:r}))},e.getTopRows=H0(()=>[e.getRowModel().rows,e.getState().rowPinning.top],(t,n)=>e._getPinnedRows(t,n,"top"),H1(e.options,"debugRows","getTopRows")),e.getBottomRows=H0(()=>[e.getRowModel().rows,e.getState().rowPinning.bottom],(t,n)=>e._getPinnedRows(t,n,"bottom"),H1(e.options,"debugRows","getBottomRows")),e.getCenterRows=H0(()=>[e.getRowModel().rows,e.getState().rowPinning.top,e.getState().rowPinning.bottom],(e,t,n)=>{let r=new Set([...null!=t?t:[],...null!=n?n:[]]);return e.filter(e=>!r.has(e.id))},H1(e.options,"debugRows","getCenterRows"))}},{getInitialState:e=>({rowSelection:{},...e}),getDefaultOptions:e=>({onRowSelectionChange:HJ("rowSelection",e),enableRowSelection:!0,enableMultiRowSelection:!0,enableSubRowSelection:!0}),createTable:e=>{e.setRowSelection=t=>null==e.options.onRowSelectionChange?void 0:e.options.onRowSelectionChange(t),e.resetRowSelection=t=>{var n;return e.setRowSelection(t?{}:null!=(n=e.initialState.rowSelection)?n:{})},e.toggleAllRowsSelected=t=>{e.setRowSelection(n=>{t=void 0!==t?t:!e.getIsAllRowsSelected();let r={...n},a=e.getPreGroupedRowModel().flatRows;return t?a.forEach(e=>{e.getCanSelect()&&(r[e.id]=!0)}):a.forEach(e=>{delete r[e.id]}),r})},e.toggleAllPageRowsSelected=t=>e.setRowSelection(n=>{let r=void 0!==t?t:!e.getIsAllPageRowsSelected(),a={...n};return e.getRowModel().rows.forEach(t=>{Uv(a,t.id,r,!0,e)}),a}),e.getPreSelectedRowModel=()=>e.getCoreRowModel(),e.getSelectedRowModel=H0(()=>[e.getState().rowSelection,e.getCoreRowModel()],(t,n)=>Object.keys(t).length?Ux(e,n):{rows:[],flatRows:[],rowsById:{}},H1(e.options,"debugTable","getSelectedRowModel")),e.getFilteredSelectedRowModel=H0(()=>[e.getState().rowSelection,e.getFilteredRowModel()],(t,n)=>Object.keys(t).length?Ux(e,n):{rows:[],flatRows:[],rowsById:{}},H1(e.options,"debugTable","getFilteredSelectedRowModel")),e.getGroupedSelectedRowModel=H0(()=>[e.getState().rowSelection,e.getSortedRowModel()],(t,n)=>Object.keys(t).length?Ux(e,n):{rows:[],flatRows:[],rowsById:{}},H1(e.options,"debugTable","getGroupedSelectedRowModel")),e.getIsAllRowsSelected=()=>{let t=e.getFilteredRowModel().flatRows,{rowSelection:n}=e.getState(),r=!!(t.length&&Object.keys(n).length);return r&&t.some(e=>e.getCanSelect()&&!n[e.id])&&(r=!1),r},e.getIsAllPageRowsSelected=()=>{let t=e.getPaginationRowModel().flatRows.filter(e=>e.getCanSelect()),{rowSelection:n}=e.getState(),r=!!t.length;return r&&t.some(e=>!n[e.id])&&(r=!1),r},e.getIsSomeRowsSelected=()=>{var t;let n=Object.keys(null!=(t=e.getState().rowSelection)?t:{}).length;return n>0&&n<e.getFilteredRowModel().flatRows.length},e.getIsSomePageRowsSelected=()=>{let t=e.getPaginationRowModel().flatRows;return!e.getIsAllPageRowsSelected()&&t.filter(e=>e.getCanSelect()).some(e=>e.getIsSelected()||e.getIsSomeSelected())},e.getToggleAllRowsSelectedHandler=()=>t=>{e.toggleAllRowsSelected(t.target.checked)},e.getToggleAllPageRowsSelectedHandler=()=>t=>{e.toggleAllPageRowsSelected(t.target.checked)}},createRow:(e,t)=>{e.toggleSelected=(n,r)=>{let a=e.getIsSelected();t.setRowSelection(i=>{var o;if(n=void 0!==n?n:!a,e.getCanSelect()&&a===n)return i;let l={...i};return Uv(l,e.id,n,null==(o=null==r?void 0:r.selectChildren)||o,t),l})},e.getIsSelected=()=>{let{rowSelection:n}=t.getState();return Uy(e,n)},e.getIsSomeSelected=()=>{let{rowSelection:n}=t.getState();return"some"===Ub(e,n)},e.getIsAllSubRowsSelected=()=>{let{rowSelection:n}=t.getState();return"all"===Ub(e,n)},e.getCanSelect=()=>{var n;return"function"==typeof t.options.enableRowSelection?t.options.enableRowSelection(e):null==(n=t.options.enableRowSelection)||n},e.getCanSelectSubRows=()=>{var n;return"function"==typeof t.options.enableSubRowSelection?t.options.enableSubRowSelection(e):null==(n=t.options.enableSubRowSelection)||n},e.getCanMultiSelect=()=>{var n;return"function"==typeof t.options.enableMultiRowSelection?t.options.enableMultiRowSelection(e):null==(n=t.options.enableMultiRowSelection)||n},e.getToggleSelectedHandler=()=>{let t=e.getCanSelect();return n=>{var r;t&&e.toggleSelected(null==(r=n.target)?void 0:r.checked)}}}},{getDefaultColumnDef:()=>Ud,getInitialState:e=>({columnSizing:{},columnSizingInfo:Uu(),...e}),getDefaultOptions:e=>({columnResizeMode:"onEnd",columnResizeDirection:"ltr",onColumnSizingChange:HJ("columnSizing",e),onColumnSizingInfoChange:HJ("columnSizingInfo",e)}),createColumn:(e,t)=>{e.getSize=()=>{var n,r,a;let i=t.getState().columnSizing[e.id];return Math.min(Math.max(null!=(n=e.columnDef.minSize)?n:Ud.minSize,null!=(r=null!=i?i:e.columnDef.size)?r:Ud.size),null!=(a=e.columnDef.maxSize)?a:Ud.maxSize)},e.getStart=H0(e=>[e,Up(t,e),t.getState().columnSizing],(t,n)=>n.slice(0,e.getIndex(t)).reduce((e,t)=>e+t.getSize(),0),H1(t.options,"debugColumns","getStart")),e.getAfter=H0(e=>[e,Up(t,e),t.getState().columnSizing],(t,n)=>n.slice(e.getIndex(t)+1).reduce((e,t)=>e+t.getSize(),0),H1(t.options,"debugColumns","getAfter")),e.resetSize=()=>{t.setColumnSizing(t=>{let{[e.id]:n,...r}=t;return r})},e.getCanResize=()=>{var n,r;return(null==(n=e.columnDef.enableResizing)||n)&&(null==(r=t.options.enableColumnResizing)||r)},e.getIsResizing=()=>t.getState().columnSizingInfo.isResizingColumn===e.id},createHeader:(e,t)=>{e.getSize=()=>{let t=0,n=e=>{if(e.subHeaders.length)e.subHeaders.forEach(n);else{var r;t+=null!=(r=e.column.getSize())?r:0}};return n(e),t},e.getStart=()=>{if(e.index>0){let t=e.headerGroup.headers[e.index-1];return t.getStart()+t.getSize()}return 0},e.getResizeHandler=n=>{let r=t.getColumn(e.column.id),a=null==r?void 0:r.getCanResize();return i=>{if(!r||!a||(null==i.persist||i.persist(),Uh(i)&&i.touches&&i.touches.length>1))return;let o=e.getSize(),l=e?e.getLeafHeaders().map(e=>[e.column.id,e.column.getSize()]):[[r.id,r.getSize()]],s=Uh(i)?Math.round(i.touches[0].clientX):i.clientX,c={},d=(e,n)=>{"number"==typeof n&&(t.setColumnSizingInfo(e=>{var r,a;let i="rtl"===t.options.columnResizeDirection?-1:1,o=(n-(null!=(r=null==e?void 0:e.startOffset)?r:0))*i,l=Math.max(o/(null!=(a=null==e?void 0:e.startSize)?a:0),-.999999);return e.columnSizingStart.forEach(e=>{let[t,n]=e;c[t]=Math.round(100*Math.max(n+n*l,0))/100}),{...e,deltaOffset:o,deltaPercentage:l}}),("onChange"===t.options.columnResizeMode||"end"===e)&&t.setColumnSizing(e=>({...e,...c})))},u=e=>{d("end",e),t.setColumnSizingInfo(e=>({...e,isResizingColumn:!1,startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,columnSizingStart:[]}))},f=n||("u">typeof document?document:null),h={moveHandler:e=>d("move",e.clientX),upHandler:e=>{null==f||f.removeEventListener("mousemove",h.moveHandler),null==f||f.removeEventListener("mouseup",h.upHandler),u(e.clientX)}},p={moveHandler:e=>(e.cancelable&&(e.preventDefault(),e.stopPropagation()),d("move",e.touches[0].clientX),!1),upHandler:e=>{var t;null==f||f.removeEventListener("touchmove",p.moveHandler),null==f||f.removeEventListener("touchend",p.upHandler),e.cancelable&&(e.preventDefault(),e.stopPropagation()),u(null==(t=e.touches[0])?void 0:t.clientX)}},m=!!function(){if("boolean"==typeof Uf)return Uf;let e=!1;try{let t=()=>{};window.addEventListener("test",t,{get passive(){return e=!0,!1}}),window.removeEventListener("test",t)}catch(t){e=!1}return Uf=e}()&&{passive:!1};Uh(i)?(null==f||f.addEventListener("touchmove",p.moveHandler,m),null==f||f.addEventListener("touchend",p.upHandler,m)):(null==f||f.addEventListener("mousemove",h.moveHandler,m),null==f||f.addEventListener("mouseup",h.upHandler,m)),t.setColumnSizingInfo(e=>({...e,startOffset:s,startSize:o,deltaOffset:0,deltaPercentage:0,columnSizingStart:l,isResizingColumn:r.id}))}}},createTable:e=>{e.setColumnSizing=t=>null==e.options.onColumnSizingChange?void 0:e.options.onColumnSizingChange(t),e.setColumnSizingInfo=t=>null==e.options.onColumnSizingInfoChange?void 0:e.options.onColumnSizingInfoChange(t),e.resetColumnSizing=t=>{var n;e.setColumnSizing(t?{}:null!=(n=e.initialState.columnSizing)?n:{})},e.resetHeaderSizeInfo=t=>{var n;e.setColumnSizingInfo(t?Uu():null!=(n=e.initialState.columnSizingInfo)?n:Uu())},e.getTotalSize=()=>{var t,n;return null!=(t=null==(n=e.getHeaderGroups()[0])?void 0:n.headers.reduce((e,t)=>e+t.getSize(),0))?t:0},e.getLeftTotalSize=()=>{var t,n;return null!=(t=null==(n=e.getLeftHeaderGroups()[0])?void 0:n.headers.reduce((e,t)=>e+t.getSize(),0))?t:0},e.getCenterTotalSize=()=>{var t,n;return null!=(t=null==(n=e.getCenterHeaderGroups()[0])?void 0:n.headers.reduce((e,t)=>e+t.getSize(),0))?t:0},e.getRightTotalSize=()=>{var t,n;return null!=(t=null==(n=e.getRightHeaderGroups()[0])?void 0:n.headers.reduce((e,t)=>e+t.getSize(),0))?t:0}}}];function UM(e,t){var n,r,a;let i;return e?"function"==typeof(r=n=e)&&(i=Object.getPrototypeOf(r)).prototype&&i.prototype.isReactComponent||"function"==typeof n||"object"==typeof(a=n)&&"symbol"==typeof a.$$typeof&&["react.memo","react.forward_ref"].includes(a.$$typeof.description)?ew.createElement(e,t):e:null}function UE(e,t,n){let r,a=n.initialDeps??[],i=!0;function o(){let o=e();return(o.length!==a.length||o.some((e,t)=>a[t]!==e))&&(a=o,r=t(...o),(null==n?void 0:n.onChange)&&!(i&&n.skipInitialOnChange)&&n.onChange(r),i=!1),r}return o.updateDeps=e=>{a=e},o}function UO(e,t){if(void 0!==e)return e;throw Error(`Unexpected undefined${t?`: ${t}`:""}`)}let UP=()=>{if(void 0!==i)return i;if("u"<typeof navigator)return i=!1;if(/iP(hone|od|ad)/.test(navigator.userAgent))return i=!0;let e=navigator.maxTouchPoints;return i="MacIntel"===navigator.platform&&void 0!==e&&e>0},UA=e=>{let{offsetWidth:t,offsetHeight:n}=e;return{width:t,height:n}},UI=e=>e,Uz=e=>{let t=Math.max(e.startIndex-e.overscan,0),n=Math.min(e.endIndex+e.overscan,e.count-1)-t+1,r=Array(n);for(let e=0;e<n;e++)r[e]=t+e;return r},UT=(e,t)=>{let n=e.scrollElement;if(!n)return;let r=e.targetWindow;if(!r)return;let a=e=>{let{width:n,height:r}=e;t({width:Math.round(n),height:Math.round(r)})};if(a(UA(n)),!r.ResizeObserver)return()=>{};let i=new r.ResizeObserver(t=>{let r=()=>{let e=t[0];if(null==e?void 0:e.borderBoxSize){let t=e.borderBoxSize[0];if(t)return void a({width:t.inlineSize,height:t.blockSize})}a(UA(n))};e.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(r):r()});return i.observe(n,{box:"border-box"}),()=>{i.unobserve(n)}},UD={passive:!0},U_="u"<typeof window||"onscrollend"in window,UR=(e,t)=>((e,t,n)=>{var r,a;let i,o=e.scrollElement;if(!o)return;let l=e.targetWindow;if(!l)return;let s=e.options.useScrollendEvent&&U_,c=0,d=s?null:(r=()=>t(c,!1),a=e.options.isScrollingResetDelay,function(...e){l.clearTimeout(i),i=l.setTimeout(()=>r.apply(this,e),a)}),u=e=>()=>{c=n(o),null==d||d(),t(c,e)},f=u(!0),h=u(!1);return o.addEventListener("scroll",f,UD),s&&o.addEventListener("scrollend",h,UD),()=>{o.removeEventListener("scroll",f),s&&o.removeEventListener("scrollend",h)}})(e,t,t=>{let{horizontal:n,isRtl:r}=e.options;return n?t.scrollLeft*(r&&-1||1):t.scrollTop}),UL=(e,t,n)=>{if(null==t?void 0:t.borderBoxSize){let e=t.borderBoxSize[0];if(e)return Math.round(e[n.options.horizontal?"inlineSize":"blockSize"])}return e[n.options.horizontal?"offsetWidth":"offsetHeight"]},U$=(e,{adjustments:t=0,behavior:n},r)=>{var a,i;null==(i=null==(a=r.scrollElement)?void 0:a.scrollTo)||i.call(a,{[r.options.horizontal?"left":"top"]:e+t,behavior:n})};class UF{constructor(e){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollState=null,this.measurementsCache=[],this._flatMeasurements=null,this.itemSizeCache=new Map,this.itemSizeCacheVersion=0,this.laneAssignments=new Map,this.pendingMin=null,this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this._iosDeferredAdjustment=0,this._iosTouching=!1,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._intendedScrollOffset=null,this.elementsCache=new Map,this.now=()=>{var e,t,n;return(null==(n=null==(t=null==(e=this.targetWindow)?void 0:e.performance)?void 0:t.now)?void 0:n.call(t))??Date.now()},this.observer=(()=>{let e=null,t=()=>e||(this.targetWindow&&this.targetWindow.ResizeObserver?e=new this.targetWindow.ResizeObserver(e=>{e.forEach(e=>{let t=()=>{let t=e.target,n=this.indexFromElement(t);if(!t.isConnected){for(let[e,n]of(this.observer.unobserve(t),this.elementsCache))if(n===t){this.elementsCache.delete(e);break}return}this.shouldMeasureDuringScroll(n)&&this.resizeItem(n,this.options.measureElement(t,e,this))};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(t):t()})}):null);return{disconnect:()=>{var n;null==(n=t())||n.disconnect(),e=null},observe:e=>{var n;return null==(n=t())?void 0:n.observe(e,{box:"border-box"})},unobserve:e=>{var n;return null==(n=t())?void 0:n.unobserve(e)}}})(),this.range=null,this.setOptions=e=>{let t={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:UI,rangeExtractor:Uz,onChange:()=>{},measureElement:UL,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,laneAssignmentMode:"estimate"};for(let n in e){let r=e[n];void 0!==r&&(t[n]=r)}this.options=t},this.notify=e=>{var t,n;null==(n=(t=this.options).onChange)||n.call(t,this,e)},this.maybeNotify=UE(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),e=>{this.notify(e)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(e=>e()),this.unsubs=[],this.observer.disconnect(),null!=this.rafId&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null,this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var e;let t=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==t){if(this.cleanup(),!t)return void this.maybeNotify();if(this.scrollElement=t,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=(null==(e=this.scrollElement)?void 0:e.window)??null,this.elementsCache.forEach(e=>{this.observer.observe(e)}),this.unsubs.push(this.options.observeElementRect(this,e=>{this.scrollRect=e,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(e,t)=>{null!==this._intendedScrollOffset&&1.5>Math.abs(e-this._intendedScrollOffset)&&(e=this._intendedScrollOffset),this._intendedScrollOffset=null,this.scrollAdjustments=0,this.scrollDirection=t?this.getScrollOffset()<e?"forward":"backward":null,this.scrollOffset=e,this.isScrolling=t,this._flushIosDeferredIfReady(),this.scrollState&&this.scheduleScrollReconcile(),this.maybeNotify()})),"addEventListener"in this.scrollElement){let e=this.scrollElement,t=()=>{this._iosTouching=!0,this._iosJustTouchEnded=!1,null!==this._iosTouchEndTimerId&&null!=this.targetWindow&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)},n=()=>{this._iosTouching=!1,UP()&&null!=this.targetWindow&&(this._iosJustTouchEnded=!0,this._iosTouchEndTimerId=this.targetWindow.setTimeout(()=>{this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._flushIosDeferredIfReady()},150))};e.addEventListener("touchstart",t,UD),e.addEventListener("touchend",n,UD),this.unsubs.push(()=>{e.removeEventListener("touchstart",t),e.removeEventListener("touchend",n),null!==this._iosTouchEndTimerId&&null!=this.targetWindow&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)})}this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})}},this._flushIosDeferredIfReady=()=>{if(0===this._iosDeferredAdjustment||this.isScrolling||this._iosTouching||this._iosJustTouchEnded)return;let e=this.getScrollOffset(),t=this.getMaxScrollOffset();if(e<0||e>t)return;let n=this._iosDeferredAdjustment;this._iosDeferredAdjustment=0,this._scrollToOffset(e,{adjustments:this.scrollAdjustments+=n,behavior:void 0})},this.rafId=null,this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??("function"==typeof this.options.initialOffset?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getFurthestMeasurement=(e,t)=>{let n=new Map,r=new Map;for(let a=t-1;a>=0;a--){let t=e[a];if(n.has(t.lane))continue;let i=r.get(t.lane);if(null==i||t.end>i.end?r.set(t.lane,t):t.end<i.end&&n.set(t.lane,!0),n.size===this.options.lanes)break}return r.size===this.options.lanes?Array.from(r.values()).sort((e,t)=>e.end===t.end?e.index-t.index:e.end-t.end)[0]:void 0},this.getMeasurementOptions=UE(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes,this.options.laneAssignmentMode],(e,t,n,r,a,i,o)=>(void 0!==this.prevLanes&&this.prevLanes!==i&&(this.lanesChangedFlag=!0),this.prevLanes=i,this.pendingMin=null,{count:e,paddingStart:t,scrollMargin:n,getItemKey:r,enabled:a,lanes:i,laneAssignmentMode:o}),{key:!1}),this.getMeasurements=UE(()=>[this.getMeasurementOptions(),this.itemSizeCacheVersion],({count:e,paddingStart:t,scrollMargin:n,getItemKey:r,enabled:a,lanes:i,laneAssignmentMode:o},l)=>{let s=this.itemSizeCache;if(!a)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>e)for(let t of this.laneAssignments.keys())t>=e&&this.laneAssignments.delete(t);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMin=null),0!==this.measurementsCache.length||this.lanesSettling||(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(e=>{this.itemSizeCache.set(e.key,e.size)}));let c=this.lanesSettling?0:this.pendingMin??0;if(this.pendingMin=null,this.lanesSettling&&this.measurementsCache.length===e&&(this.lanesSettling=!1),1===i){var d;let a,i=this.options.gap,o=2*e,l=this._flatMeasurements;if(!l||l.length<o){let e=new Float64Array(o);l&&c>0&&e.set(l.subarray(0,2*c)),l=e,this._flatMeasurements=l}if(0===c)a=t+n;else{let e=c-1;a=l[2*e]+l[2*e+1]+i}for(let t=c;t<e;t++){let e=r(t),n=s.get(e),o="number"==typeof n?n:this.options.estimateSize(t);l[2*t]=a,l[2*t+1]=o,a+=o+i}let u=(d=l,new Proxy(Array(e),{get(t,n,a){if("string"==typeof n){let a=n.charCodeAt(0);if(a>=48&&a<=57){let a=+n;if(Number.isInteger(a)&&a>=0&&a<e){let e=t[a];if(!e){let n=d[2*a];e=t[a]={index:a,key:r(a),start:n,size:d[2*a+1],end:n+d[2*a+1],lane:0}}return e}}if("length"===n)return e}return Reflect.get(t,n,a)}}));return this.measurementsCache=u,u}let u=this.measurementsCache.slice(0,c),f=Array(i).fill(void 0);for(let e=0;e<c;e++){let t=u[e];t&&(f[t.lane]=e)}for(let a=c;a<e;a++){let e,i,l=r(a),c=this.laneAssignments.get(a),d="estimate"===o||s.has(l);if(void 0!==c&&this.options.lanes>1){let r=f[e=c],a=void 0!==r?u[r]:void 0;i=a?a.end+this.options.gap:t+n}else{let r=1===this.options.lanes?u[a-1]:this.getFurthestMeasurement(u,a);i=r?r.end+this.options.gap:t+n,e=r?r.lane:a%this.options.lanes,this.options.lanes>1&&d&&this.laneAssignments.set(a,e)}let h=s.get(l),p="number"==typeof h?h:this.options.estimateSize(a),m=i+p;u[a]={index:a,start:i,size:p,end:m,key:l,lane:e},f[e]=a}return this.measurementsCache=u,u},{key:!1,debug:()=>this.options.debug}),this.calculateRange=UE(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(e,t,n,r)=>this.range=e.length>0&&t>0?function({measurements:e,outerSize:t,scrollOffset:n,lanes:r,flat:a}){let i=e.length-1,o=a?e=>a[2*e]:t=>e[t].start,l=a?e=>a[2*e]+a[2*e+1]:t=>e[t].end;if(e.length<=r)return{startIndex:0,endIndex:i};let s=UB(0,i,o,n),c=s;if(1===r)for(;c<i&&l(c)<n+t;)c++;else if(r>1){let a=Array(r).fill(0);for(;c<i&&a.some(e=>e<n+t);){let t=e[c];a[t.lane]=t.end,c++}let o=Array(r).fill(n+t);for(;s>=0&&o.some(e=>e>=n);){let t=e[s];o[t.lane]=t.start,s--}s=Math.max(0,s-s%r),c=Math.min(i,c+(r-1-c%r))}return{startIndex:s,endIndex:c}}({measurements:e,outerSize:t,scrollOffset:n,lanes:r,flat:1===r&&null!=this._flatMeasurements?this._flatMeasurements:null}):null,{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=UE(()=>{let e=null,t=null,n=this.calculateRange();return n&&(e=n.startIndex,t=n.endIndex),this.maybeNotify.updateDeps([this.isScrolling,e,t]),[this.options.rangeExtractor,this.options.overscan,this.options.count,e,t]},(e,t,n,r,a)=>null===r||null===a?[]:e({startIndex:r,endIndex:a,overscan:t,count:n}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=e=>{let t=this.options.indexAttribute,n=e.getAttribute(t);return n?parseInt(n,10):(console.warn(`Missing attribute name '${t}={index}' on measured element.`),-1)},this.shouldMeasureDuringScroll=e=>{var t;if(!this.scrollState||"smooth"!==this.scrollState.behavior)return!0;let n=this.scrollState.index??(null==(t=this.getVirtualItemForOffset(this.scrollState.lastTargetOffset))?void 0:t.index);if(void 0!==n&&this.range){let t=Math.max(this.options.overscan,Math.ceil((this.range.endIndex-this.range.startIndex)/2)),r=Math.max(0,n-t),a=Math.min(this.options.count-1,n+t);return e>=r&&e<=a}return!0},this.measureElement=e=>{if(!e)return void this.elementsCache.forEach((e,t)=>{e.isConnected||(this.observer.unobserve(e),this.elementsCache.delete(t))});let t=this.indexFromElement(e),n=this.options.getItemKey(t),r=this.elementsCache.get(n);r!==e&&(r&&this.observer.unobserve(r),this.observer.observe(e),this.elementsCache.set(n,e)),(!this.isScrolling||this.scrollState)&&this.shouldMeasureDuringScroll(t)&&this.resizeItem(t,this.options.measureElement(e,void 0,this))},this.resizeItem=(e,t)=>{var n;let r,a,i;if(e<0||e>=this.options.count)return;let o=this._flatMeasurements;if(1===this.options.lanes&&null!==o)i=this.options.getItemKey(e),a=o[2*e],r=o[2*e+1];else{let t=this.measurementsCache[e];if(!t)return;i=t.key,a=t.start,r=t.size}let l=t-(this.itemSizeCache.get(i)??r);0!==l&&((null==(n=this.scrollState)?void 0:n.behavior)!=="smooth"&&(void 0!==this.shouldAdjustScrollPositionOnItemSizeChange?this.shouldAdjustScrollPositionOnItemSizeChange(this.measurementsCache[e]??{index:e,key:i,start:a,size:r,end:a+r,lane:0},l,this):a<this.getScrollOffset()+this.scrollAdjustments&&"backward"!==this.scrollDirection)&&(UP()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded)?this._iosDeferredAdjustment+=l:this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=l,behavior:void 0})),(null===this.pendingMin||e<this.pendingMin)&&(this.pendingMin=e),this.itemSizeCache.set(i,t),this.itemSizeCacheVersion++,this.notify(!1))},this.getVirtualItems=UE(()=>[this.getVirtualIndexes(),this.getMeasurements()],(e,t)=>{let n=[];for(let r=0,a=e.length;r<a;r++){let a=t[e[r]];n.push(a)}return n},{key:!1,debug:()=>this.options.debug}),this.getVirtualItemForOffset=e=>{let t=this.getMeasurements();if(0===t.length)return;let n=this._flatMeasurements,r=1===this.options.lanes&&null!=n,a=UB(0,t.length-1,r?e=>n[2*e]:e=>UO(t[e]).start,e);return UO(t[a])},this.getMaxScrollOffset=()=>{if(!this.scrollElement)return 0;if("scrollHeight"in this.scrollElement)return this.options.horizontal?this.scrollElement.scrollWidth-this.scrollElement.clientWidth:this.scrollElement.scrollHeight-this.scrollElement.clientHeight;{let e=this.scrollElement.document.documentElement;return this.options.horizontal?e.scrollWidth-this.scrollElement.innerWidth:e.scrollHeight-this.scrollElement.innerHeight}},this.getOffsetForAlignment=(e,t,n=0)=>{if(!this.scrollElement)return 0;let r=this.getSize(),a=this.getScrollOffset();return"auto"===t&&(t=e>=a+r?"end":"start"),"center"===t?e+=(n-r)/2:"end"===t&&(e-=r),Math.max(Math.min(this.getMaxScrollOffset(),e),0)},this.getOffsetForIndex=(e,t="auto")=>{e=Math.max(0,Math.min(e,this.options.count-1));let n=this.getSize(),r=this.getScrollOffset(),a=this.measurementsCache[e];if(!a)return;if("auto"===t)if(a.end>=r+n-this.options.scrollPaddingEnd)t="end";else{if(!(a.start<=r+this.options.scrollPaddingStart))return[r,t];t="start"}if("end"===t&&e===this.options.count-1)return[this.getMaxScrollOffset(),t];let i="end"===t?a.end+this.options.scrollPaddingEnd:a.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(i,t,a.size),t]},this.scrollToOffset=(e,{align:t="start",behavior:n="auto"}={})=>{let r=this.getOffsetForAlignment(e,t),a=this.now();this.scrollState={index:null,align:t,behavior:n,startedAt:a,lastTargetOffset:r,stableFrames:0},this._scrollToOffset(r,{adjustments:void 0,behavior:n}),this.scheduleScrollReconcile()},this.scrollToIndex=(e,{align:t="auto",behavior:n="auto"}={})=>{e=Math.max(0,Math.min(e,this.options.count-1));let r=this.getOffsetForIndex(e,t);if(!r)return;let[a,i]=r,o=this.now();this.scrollState={index:e,align:i,behavior:n,startedAt:o,lastTargetOffset:a,stableFrames:0},this._scrollToOffset(a,{adjustments:void 0,behavior:n}),this.scheduleScrollReconcile()},this.scrollBy=(e,{behavior:t="auto"}={})=>{let n=this.getScrollOffset()+e,r=this.now();this.scrollState={index:null,align:"start",behavior:t,startedAt:r,lastTargetOffset:n,stableFrames:0},this._scrollToOffset(n,{adjustments:void 0,behavior:t}),this.scheduleScrollReconcile()},this.getTotalSize=()=>{var e;let t,n=this.getMeasurements();if(0===n.length)t=this.options.paddingStart;else if(1===this.options.lanes){let r=n.length-1,a=this._flatMeasurements;t=null!=a?a[2*r]+a[2*r+1]:(null==(e=n[r])?void 0:e.end)??0}else{let e=Array(this.options.lanes).fill(null),r=n.length-1;for(;r>=0&&e.some(e=>null===e);){let t=n[r];null===e[t.lane]&&(e[t.lane]=t.end),r--}t=Math.max(...e.filter(e=>null!==e))}return Math.max(t-this.options.scrollMargin+this.options.paddingEnd,0)},this.takeSnapshot=()=>{let e=[];if(0===this.itemSizeCache.size)return e;for(let t of this.getMeasurements())t&&this.itemSizeCache.has(t.key)&&e.push({index:t.index,key:t.key,start:t.start,size:t.size,end:t.end,lane:t.lane});return e},this._scrollToOffset=(e,{adjustments:t,behavior:n})=>{this._intendedScrollOffset=e+(t??0),this.options.scrollToFn(e,{behavior:n,adjustments:t},this)},this.measure=()=>{this.pendingMin=null,this.itemSizeCache.clear(),this.laneAssignments.clear(),this.itemSizeCacheVersion++,this.notify(!1)},this.setOptions(e)}scheduleScrollReconcile(){if(!this.targetWindow){this.scrollState=null;return}null==this.rafId&&(this.rafId=this.targetWindow.requestAnimationFrame(()=>{this.rafId=null,this.reconcileScroll()}))}reconcileScroll(){if(!this.scrollState||!this.scrollElement)return;if(this.now()-this.scrollState.startedAt>5e3){this.scrollState=null;return}let e=null!=this.scrollState.index?this.getOffsetForIndex(this.scrollState.index,this.scrollState.align):void 0,t=e?e[0]:this.scrollState.lastTargetOffset,n=t!==this.scrollState.lastTargetOffset;if(!n&&1.01>Math.abs(t-this.getScrollOffset())){if(this.scrollState.stableFrames++,this.scrollState.stableFrames>=1){this.getScrollOffset()!==t&&this._scrollToOffset(t,{adjustments:void 0,behavior:"auto"}),this.scrollState=null;return}}else if(this.scrollState.stableFrames=0,n){let e=this.getSize()||600,n=Math.abs(t-this.getScrollOffset()),r="smooth"===this.scrollState.behavior&&n>e;this.scrollState.lastTargetOffset=t,r||(this.scrollState.behavior="auto"),this._scrollToOffset(t,{adjustments:void 0,behavior:r?"smooth":"auto"})}this.scheduleScrollReconcile()}}let UB=(e,t,n,r)=>{for(;e<=t;){let a=(e+t)/2|0,i=n(a);if(i<r)e=a+1;else{if(!(i>r))return a;t=a-1}}return e>0?e-1:0},UV="u">typeof document?ew.useLayoutEffect:ew.useEffect,UH=(0,ek.default)("arrow-up-down",[["path",{d:"m21 16-4 4-4-4",key:"f6ql7i"}],["path",{d:"M17 20V4",key:"1ejh1v"}],["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}]]),UU={pathSeparator:"/",searchPlaceholder:"Filter rows...",rows:e=>`${e.toLocaleString()} rows`,columns:e=>`${e.toLocaleString()} columns`,selected:e=>`${e.toLocaleString()} selected`,copied:"Copied",copyCell:"Copy cell",noRows:"No rows match this view.",selectAllRows:"Select all visible rows",selectRow:e=>`Select row ${e+1}`,resizeColumn:"Resize column",sortAsc:"Sort ascending",sortDesc:"Sort descending",sortClear:"Clear sorting"};function UW(e,t){return"function"==typeof e?e(t):e}function Uq(e){return null==e?"":"string"==typeof e?e:"number"==typeof e||"boolean"==typeof e?String(e):e instanceof Date?e.toISOString():JSON.stringify(e)}function UK(e){return"number"==typeof e?e:"boolean"==typeof e?+!!e:Uq(e).toLowerCase()}function UG({file:e={name:"data-table.csv",type:"records"},rows:t,data:n,columns:r,source:a,rowId:i,sorting:o,defaultSorting:l=[],onSortingChange:s,globalFilter:c,defaultGlobalFilter:d="",onGlobalFilterChange:u,rowSelection:f,defaultRowSelection:h={},onRowSelectionChange:p,columnSizing:m,defaultColumnSizing:g={},onColumnSizingChange:v,onCellCopy:x,showHeader:y=!0,showToolbar:b=!0,rowHeight:w=32,overscan:j=14,labels:k,className:S,headerClassName:N,toolbarClassName:C,gridClassName:M,...E}){let O=ew.useMemo(()=>({...UU,...k}),[k]),P=ew.useMemo(()=>{var e,t;let n;return(e=a)?"csv"===e.type?function(e,t=","){let n=function(e,t=","){let n=[],r="",a=[],i=!1;for(let o=0;o<e.length;o+=1){let l=e[o],s=e[o+1];if('"'===l){i&&'"'===s?(r+='"',o+=1):i=!i;continue}if(!i&&l===t){a.push(r),r="";continue}if(!i&&("\n"===l||"\r"===l)){"\r"===l&&"\n"===s&&(o+=1),a.push(r),n.push(a),a=[],r="";continue}r+=l}return a.push(r),a.some(e=>e.length>0)&&n.push(a),n}(e.trim(),t),r=n[0]?.map((e,t)=>e.trim()||`Column ${t+1}`)??[];return{rows:n.slice(1).map(e=>{let t={};return r.forEach((n,r)=>{t[n]=e[r]??""}),t}),columns:r.map(e=>({id:e,header:e,accessorKey:e,minWidth:96,width:Math.max(120,Math.min(260,12*e.length+80))}))}}(e.content,e.delimiter):Array.isArray(n="string"==typeof(t=e.content)?JSON.parse(t):t)?{rows:n,columns:void 0}:n&&"object"==typeof n?{rows:n.rows??n.data??[n],columns:n.columns}:{rows:[{value:n}],columns:void 0}:{rows:void 0,columns:void 0}},[a]),A=ew.useMemo(()=>n??t??P.rows??[],[n,t,P.rows]),I=ew.useMemo(()=>r??P.columns??function(e){let t=new Set;for(let n of e.slice(0,50))Object.keys(n).forEach(e=>t.add(e));return Array.from(t).map(e=>({id:e,header:e,accessorKey:e,minWidth:96,width:Math.max(120,Math.min(280,12*e.length+88))}))}(A),[r,P.columns,A]),[z,T]=ew.useState(l),[D,_]=ew.useState(d),[R,L]=ew.useState(h),[$,F]=ew.useState(g),[B,V]=ew.useState(void 0),[H,U]=ew.useState(void 0),W=ew.useRef(null),q=o??z,K=c??D,G=f??R,X=m??$,Y=function(e){let t={state:{},onStateChange:()=>{},renderFallbackValue:null,...e},[n]=ew.useState(()=>({current:function(e){var t,n;let r=[...UC,...null!=(t=e._features)?t:[]],a={_features:r},i=a._features.reduce((e,t)=>Object.assign(e,null==t.getDefaultOptions?void 0:t.getDefaultOptions(a)),{}),o={...null!=(n=e.initialState)?n:{}};a._features.forEach(e=>{var t;o=null!=(t=null==e.getInitialState?void 0:e.getInitialState(o))?t:o});let l=[],s=!1,c={_features:r,options:{...i,...e},initialState:o,_queue:e=>{l.push(e),s||(s=!0,Promise.resolve().then(()=>{for(;l.length;)l.shift()();s=!1}).catch(e=>setTimeout(()=>{throw e})))},reset:()=>{a.setState(a.initialState)},setOptions:e=>{var t;t=HZ(e,a.options),a.options=a.options.mergeOptions?a.options.mergeOptions(i,t):{...i,...t}},getState:()=>a.options.state,setState:e=>{null==a.options.onStateChange||a.options.onStateChange(e)},_getRowId:(e,t,n)=>{var r;return null!=(r=null==a.options.getRowId?void 0:a.options.getRowId(e,t,n))?r:`${n?[n.id,t].join("."):t}`},getCoreRowModel:()=>(a._getCoreRowModel||(a._getCoreRowModel=a.options.getCoreRowModel(a)),a._getCoreRowModel()),getRowModel:()=>a.getPaginationRowModel(),getRow:(e,t)=>{let n=(t?a.getPrePaginationRowModel():a.getRowModel()).rowsById[e];if(!n&&!(n=a.getCoreRowModel().rowsById[e]))throw Error();return n},_getDefaultColumnDef:H0(()=>[a.options.defaultColumn],e=>{var t;return e=null!=(t=e)?t:{},{header:e=>{let t=e.header.column.columnDef;return t.accessorKey?t.accessorKey:t.accessorFn?t.id:null},cell:e=>{var t,n;return null!=(t=null==(n=e.renderValue())||null==n.toString?void 0:n.toString())?t:null},...a._features.reduce((e,t)=>Object.assign(e,null==t.getDefaultColumnDef?void 0:t.getDefaultColumnDef()),{}),...e}},H1(e,"debugColumns","_getDefaultColumnDef")),_getColumnDefs:()=>a.options.columns,getAllColumns:H0(()=>[a._getColumnDefs()],e=>{let t=function(e,n,r){return void 0===r&&(r=0),e.map(e=>{let i=function(e,t,n,r){var a,i;let o,l={...e._getDefaultColumnDef(),...t},s=l.accessorKey,c=null!=(a=null!=(i=l.id)?i:s?"function"==typeof String.prototype.replaceAll?s.replaceAll(".","_"):s.replace(/\./g,"_"):void 0)?a:"string"==typeof l.header?l.header:void 0;if(l.accessorFn?o=l.accessorFn:s&&(o=s.includes(".")?e=>{let t=e;for(let e of s.split(".")){var n;t=null==(n=t)?void 0:n[e]}return t}:e=>e[l.accessorKey]),!c)throw Error();let d={id:`${String(c)}`,accessorFn:o,parent:r,depth:n,columnDef:l,columns:[],getFlatColumns:H0(()=>[!0],()=>{var e;return[d,...null==(e=d.columns)?void 0:e.flatMap(e=>e.getFlatColumns())]},H1(e.options,"debugColumns","column.getFlatColumns")),getLeafColumns:H0(()=>[e._getOrderColumnsFn()],e=>{var t;return null!=(t=d.columns)&&t.length?e(d.columns.flatMap(e=>e.getLeafColumns())):[d]},H1(e.options,"debugColumns","column.getLeafColumns"))};for(let t of e._features)null==t.createColumn||t.createColumn(d,e);return d}(a,e,r,n);return i.columns=e.columns?t(e.columns,i,r+1):[],i})};return t(e)},H1(e,"debugColumns","getAllColumns")),getAllFlatColumns:H0(()=>[a.getAllColumns()],e=>e.flatMap(e=>e.getFlatColumns()),H1(e,"debugColumns","getAllFlatColumns")),_getAllFlatColumnsById:H0(()=>[a.getAllFlatColumns()],e=>e.reduce((e,t)=>(e[t.id]=t,e),{}),H1(e,"debugColumns","getAllFlatColumnsById")),getAllLeafColumns:H0(()=>[a.getAllColumns(),a._getOrderColumnsFn()],(e,t)=>t(e.flatMap(e=>e.getLeafColumns())),H1(e,"debugColumns","getAllLeafColumns")),getColumn:e=>a._getAllFlatColumnsById()[e]};Object.assign(a,c);for(let e=0;e<a._features.length;e++){let t=a._features[e];null==t||null==t.createTable||t.createTable(a)}return a}(t)})),[r,a]=ew.useState(()=>n.current.initialState);return n.current.setOptions(t=>({...t,...e,state:{...r,...e.state},onStateChange:t=>{a(t),null==e.onStateChange||e.onStateChange(t)}})),n.current}({data:A,columns:ew.useMemo(()=>I.map(e=>({id:e.id,accessorFn:(t,n)=>e.accessorFn?e.accessorFn(t,n):e.accessorKey?t[e.accessorKey]:void 0,header:()=>e.header,cell:t=>e.cell?e.cell({row:t.row.original,rowIndex:t.row.index,value:t.getValue(),column:e}):Uq(t.getValue()),sortingFn:(e,t,n)=>{let r=UK(e.getValue(n)),a=UK(t.getValue(n));return"number"==typeof r&&"number"==typeof a?r-a:String(r).localeCompare(String(a),void 0,{numeric:!0})},enableSorting:e.enableSorting??!0,enableGlobalFilter:e.enableFiltering??!0,size:e.width??168,minSize:e.minWidth??80,maxSize:e.maxWidth??640,meta:{align:e.align,className:e.className,headerClassName:e.headerClassName,copyValue:e.copyValue,sourceColumn:e}})),[I]),state:{sorting:q,globalFilter:K,rowSelection:G,columnSizing:X},defaultColumn:{minSize:80,size:168,maxSize:640},columnResizeMode:"onChange",enableRowSelection:!0,getRowId:"function"==typeof i?(e,t)=>i(e,t):i?(e,t)=>Uq(e[i])||String(t):void 0,onSortingChange:e=>{let t=UW(e,q);void 0===o&&T(t),s?.(t)},onGlobalFilterChange:e=>{let t=UW(e,K);void 0===c&&_(t),u?.(t)},onRowSelectionChange:e=>{let t=UW(e,G);void 0===f&&L(t),p?.(t)},onColumnSizingChange:e=>{let t=UW(e,X);void 0===m&&F(t),v?.(t)},globalFilterFn:(e,t,n)=>{let r=String(n??"").trim().toLowerCase();return!r||Uq(e.getValue(t)).toLowerCase().includes(r)},getCoreRowModel:e=>H0(()=>[e.options.data],t=>{let n={rows:[],flatRows:[],rowsById:{}},r=function(t,a,i){void 0===a&&(a=0);let o=[];for(let s=0;s<t.length;s++){let c=H3(e,e._getRowId(t[s],s,i),t[s],s,a,void 0,null==i?void 0:i.id);if(n.flatRows.push(c),n.rowsById[c.id]=c,o.push(c),e.options.getSubRows){var l;c.originalSubRows=e.options.getSubRows(t[s],s),null!=(l=c.originalSubRows)&&l.length&&(c.subRows=r(c.originalSubRows,a+1,c))}}return o};return n.rows=r(t),n},H1(e.options,"debugTable","getRowModel",()=>e._autoResetPageIndex())),getFilteredRowModel:e=>H0(()=>[e.getPreFilteredRowModel(),e.getState().columnFilters,e.getState().globalFilter],(t,n,r)=>{var a,i,o,l,s,c,d,u,f,h;let p,m,g,v,x,y,b,w,j,k;if(!t.rows.length||!(null!=n&&n.length)&&!r){for(let e=0;e<t.flatRows.length;e++)t.flatRows[e].columnFilters={},t.flatRows[e].columnFiltersMeta={};return t}let S=[],N=[];(null!=n?n:[]).forEach(t=>{var n;let r=e.getColumn(t.id);if(!r)return;let a=r.getFilterFn();a&&S.push({id:t.id,filterFn:a,resolvedValue:null!=(n=null==a.resolveFilterValue?void 0:a.resolveFilterValue(t.value))?n:t.value})});let C=(null!=n?n:[]).map(e=>e.id),M=e.getGlobalFilterFn(),E=e.getAllLeafColumns().filter(e=>e.getCanGlobalFilter());r&&M&&E.length&&(C.push("__global__"),E.forEach(e=>{var t;N.push({id:e.id,filterFn:M,resolvedValue:null!=(t=null==M.resolveFilterValue?void 0:M.resolveFilterValue(r))?t:r})}));for(let e=0;e<t.flatRows.length;e++){let n=t.flatRows[e];if(n.columnFilters={},S.length)for(let e=0;e<S.length;e++){let t=(p=S[e]).id;n.columnFilters[t]=p.filterFn(n,t,p.resolvedValue,e=>{n.columnFiltersMeta[t]=e})}if(N.length){for(let e=0;e<N.length;e++){let t=(m=N[e]).id;if(m.filterFn(n,t,m.resolvedValue,e=>{n.columnFiltersMeta[t]=e})){n.columnFilters.__global__=!0;break}}!0!==n.columnFilters.__global__&&(n.columnFilters.__global__=!1)}}return a=t.rows,i=e=>{for(let t=0;t<C.length;t++)if(!1===e.columnFilters[C[t]])return!1;return!0},e.options.filterFromLeafRows?(o=a,l=i,g=[],v={},x=null!=(c=(s=e).options.maxLeafRowFilterDepth)?c:100,{rows:(y=function(e,t){void 0===t&&(t=0);let n=[];for(let a=0;a<e.length;a++){var r;let i=e[a],o=H3(s,i.id,i.original,i.index,i.depth,void 0,i.parentId);if(o.columnFilters=i.columnFilters,null!=(r=i.subRows)&&r.length&&t<x){if(o.subRows=y(i.subRows,t+1),l(i=o)&&!o.subRows.length||l(i)||o.subRows.length){n.push(i),v[i.id]=i,g.push(i);continue}}else l(i=o)&&(n.push(i),v[i.id]=i,g.push(i))}return n})(o),flatRows:g,rowsById:v}):(d=a,u=i,b=[],w={},j=null!=(h=(f=e).options.maxLeafRowFilterDepth)?h:100,{rows:(k=function(e,t){void 0===t&&(t=0);let n=[];for(let a=0;a<e.length;a++){let i=e[a];if(u(i)){var r;if(null!=(r=i.subRows)&&r.length&&t<j){let e=H3(f,i.id,i.original,i.index,i.depth,void 0,i.parentId);e.subRows=k(i.subRows,t+1),i=e}n.push(i),b.push(i),w[i.id]=i}}return n})(d),flatRows:b,rowsById:w})},H1(e.options,"debugTable","getFilteredRowModel",()=>e._autoResetPageIndex())),getSortedRowModel:e=>H0(()=>[e.getState().sorting,e.getPreSortedRowModel()],(t,n)=>{if(!n.rows.length||!(null!=t&&t.length))return n;let r=e.getState().sorting,a=[],i=r.filter(t=>{var n;return null==(n=e.getColumn(t.id))?void 0:n.getCanSort()}),o={};i.forEach(t=>{let n=e.getColumn(t.id);n&&(o[t.id]={sortUndefined:n.columnDef.sortUndefined,invertSorting:n.columnDef.invertSorting,sortingFn:n.getSortingFn()})});let l=e=>{let t=e.map(e=>({...e}));return t.sort((e,t)=>{for(let r=0;r<i.length;r+=1){var n;let a=i[r],l=o[a.id],s=l.sortUndefined,c=null!=(n=null==a?void 0:a.desc)&&n,d=0;if(s){let n=e.getValue(a.id),r=t.getValue(a.id),i=void 0===n,o=void 0===r;if(i||o){if("first"===s)return i?-1:1;if("last"===s)return i?1:-1;d=i&&o?0:i?s:-s}}if(0===d&&(d=l.sortingFn(e,t,a.id)),0!==d)return c&&(d*=-1),l.invertSorting&&(d*=-1),d}return e.index-t.index}),t.forEach(e=>{var t;a.push(e),null!=(t=e.subRows)&&t.length&&(e.subRows=l(e.subRows))}),t};return{rows:l(n.rows),flatRows:a,rowsById:n.rowsById}},H1(e.options,"debugTable","getSortedRowModel",()=>e._autoResetPageIndex()))}),Z=Y.getRowModel().rows,J=function({useFlushSync:e=!0,...t}){let n=ew.useReducer(e=>e+1,0)[1],r={...t,onChange:(r,a)=>{var i;e&&a?(0,iy.flushSync)(n):n(),null==(i=t.onChange)||i.call(t,r,a)}},[a]=ew.useState(()=>new UF(r));return a.setOptions(r),UV(()=>a._didMount(),[]),UV(()=>a._willUpdate()),a}({observeElementRect:UT,observeElementOffset:UR,scrollToFn:U$,...{count:Z.length,getScrollElement:()=>W.current,estimateSize:()=>w,overscan:j,scrollMargin:w}}),Q=Y.getVisibleLeafColumns(),ee=Q.reduce((e,t)=>e+t.getSize(),40),et=`40px ${Q.map(e=>`${e.getSize()}px`).join(" ")}`,en=(e?.path??e?.name??"data-table").split(/[\\/]+/).filter(Boolean),er=Y.getSelectedRowModel().rows.length;async function ea(e,t){let n=I.find(e=>e.id===t);if(!n)return;let r=e.getValue(t),a=n.copyValue?n.copyValue({row:e.original,rowIndex:e.index,value:r,column:n}):Uq(r);await UX(a)&&(U({rowId:e.id,columnId:t}),x?.({row:e.original,rowIndex:e.index,columnId:t,value:r,text:a}),window.setTimeout(()=>{U(n=>n?.rowId===e.id&&n.columnId===t?void 0:n)},1200))}return(0,ey.jsxs)("div",{"data-slot":"data-table-tab-viewer",className:(0,eI.cn)("vtl-surface-panel relative grid min-h-0 w-full min-w-0 overflow-hidden rounded-[var(--surface-panel-radius)] border",y&&b?"grid-rows-[auto_auto_minmax(0,1fr)]":y||b?"grid-rows-[auto_minmax(0,1fr)]":"grid-rows-[minmax(0,1fr)]",S),...E,children:[y&&(0,ey.jsxs)("div",{"data-slot":"data-table-tab-viewer-header",className:(0,eI.cn)("flex min-h-9 min-w-0 items-center gap-2 border-b bg-muted/35 px-3 py-2",N),children:[(0,ey.jsx)("span",{className:"grid size-5 shrink-0 place-items-center rounded-md border bg-background text-muted-foreground",children:(0,ey.jsx)(uy,{className:"size-3.5"})}),(0,ey.jsx)("div",{className:"flex min-w-0 flex-1 items-center gap-1.5 ui-text-kbd",children:en.map((e,t)=>(0,ey.jsxs)(ew.Fragment,{children:[t>0&&(0,ey.jsx)("span",{className:"text-muted-foreground",children:O.pathSeparator}),(0,ey.jsx)("span",{className:(0,eI.cn)("truncate",t<en.length-1?"text-muted-foreground":"text-foreground"),children:e})]},`${e}-${t}`))}),(0,ey.jsx)("span",{className:"shrink-0 text-muted-foreground ui-text-kbd",children:e.type??"records"})]}),b&&(0,ey.jsxs)("div",{"data-slot":"data-table-tab-viewer-toolbar",className:(0,eI.cn)("flex min-h-10 min-w-0 items-center gap-2 border-b px-3 py-1.5",C),children:[(0,ey.jsxs)("div",{className:"relative min-w-36 flex-1 sm:max-w-80",children:[(0,ey.jsx)(vc,{className:"pointer-events-none absolute top-1/2 left-2.5 size-3.5 -translate-y-1/2 text-muted-foreground"}),(0,ey.jsx)(ez,{value:K,onChange:e=>Y.setGlobalFilter(e.target.value),placeholder:O.searchPlaceholder,className:"h-7 rounded-md border-border bg-background pl-8 ui-text-control"})]}),(0,ey.jsxs)("div",{className:"flex shrink-0 items-center gap-2 text-muted-foreground ui-text-kbd",children:[(0,ey.jsx)("span",{children:O.rows(Z.length)}),(0,ey.jsx)("span",{className:"h-3 w-px bg-border"}),(0,ey.jsx)("span",{children:O.columns(I.length)}),er>0&&(0,ey.jsxs)(ey.Fragment,{children:[(0,ey.jsx)("span",{className:"h-3 w-px bg-border"}),(0,ey.jsx)("span",{className:"text-foreground",children:O.selected(er)})]})]})]}),(0,ey.jsx)("div",{ref:W,"data-slot":"data-table-tab-viewer-grid",className:(0,eI.cn)("min-h-0 min-w-0 overflow-auto bg-background","[scrollbar-color:var(--border)_transparent] [scrollbar-width:thin]","[&::-webkit-scrollbar]:size-2.5 [&::-webkit-scrollbar-corner]:bg-transparent [&::-webkit-scrollbar-track]:bg-transparent","[&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-thumb]:border-[3px] [&::-webkit-scrollbar-thumb]:border-transparent [&::-webkit-scrollbar-thumb]:bg-border [&::-webkit-scrollbar-thumb]:bg-clip-content",M),children:(0,ey.jsxs)("div",{className:"relative min-h-full",style:{width:ee,minWidth:"100%"},children:[(0,ey.jsxs)("div",{"data-slot":"data-table-tab-viewer-head",className:"sticky top-0 z-20 grid min-w-full border-b bg-muted/70 backdrop-blur",style:{gridTemplateColumns:et,width:ee,minWidth:"100%"},children:[(0,ey.jsx)("div",{className:"grid h-8 place-items-center border-r",children:(0,ey.jsx)(vN,{checked:!!Y.getIsAllRowsSelected()||!!Y.getIsSomeRowsSelected()&&"indeterminate",onCheckedChange:e=>Y.toggleAllRowsSelected(!0===e),"aria-label":O.selectAllRows})}),Y.getFlatHeaders().map(e=>{let t=e.column.columnDef.meta,n=e.column.getIsSorted();return(0,ey.jsxs)("div",{className:(0,eI.cn)("group/header relative flex h-8 min-w-0 items-center border-r text-muted-foreground",t?.align==="right"&&"justify-end",t?.align==="center"&&"justify-center",t?.headerClassName),children:[(0,ey.jsxs)("button",{type:"button",disabled:!e.column.getCanSort(),"aria-label":`${Uq(t?.sourceColumn.header??e.id)}: ${"asc"===n?O.sortDesc:"desc"===n?O.sortClear:O.sortAsc}`,onClick:e.column.getToggleSortingHandler(),className:(0,eI.cn)("flex h-full min-w-0 flex-1 items-center gap-1.5 px-2 text-left ui-text-kbd",e.column.getCanSort()&&"text-foreground hover:bg-muted"),children:[(0,ey.jsx)("span",{className:"truncate",children:UM(e.column.columnDef.header,e.getContext())}),"asc"===n?(0,ey.jsx)(jv,{className:"size-3 shrink-0"}):"desc"===n?(0,ey.jsx)(jg,{className:"size-3 shrink-0"}):e.column.getCanSort()?(0,ey.jsx)(UH,{className:"size-3 shrink-0 opacity-45"}):null]}),e.column.getCanResize()&&(0,ey.jsx)("button",{type:"button","aria-label":O.resizeColumn,onDoubleClick:()=>e.column.resetSize(),onMouseDown:e.getResizeHandler(),onTouchStart:e.getResizeHandler(),className:(0,eI.cn)("absolute top-0 right-0 h-full w-2 translate-x-1/2 cursor-col-resize touch-none","after:absolute after:top-1 after:right-1/2 after:bottom-1 after:w-px after:bg-border","hover:after:bg-foreground",e.column.getIsResizing()&&"after:bg-foreground")})]},e.id)})]}),0===Z.length?(0,ey.jsx)("div",{className:"grid min-h-44 place-items-center text-muted-foreground ui-text-body",children:O.noRows}):(0,ey.jsx)("div",{"data-slot":"data-table-tab-viewer-rows",className:"relative",style:{height:J.getTotalSize()},children:J.getVirtualItems().map(e=>{let t=Z[e.index];return t?(0,ey.jsxs)("div",{"data-slot":"data-table-tab-viewer-row","data-state":t.getIsSelected()?"selected":void 0,className:(0,eI.cn)("absolute left-0 grid min-w-full border-b transition-colors","hover:bg-muted/40 data-[state=selected]:bg-muted/65"),style:{gridTemplateColumns:et,width:ee,minWidth:"100%",height:e.size,transform:`translateY(${e.start-J.options.scrollMargin}px)`},children:[(0,ey.jsx)("div",{className:"grid place-items-center border-r",children:(0,ey.jsx)(vN,{checked:t.getIsSelected(),onCheckedChange:e=>t.toggleSelected(!0===e),"aria-label":O.selectRow(t.index)})}),t.getVisibleCells().map(e=>{let n=e.column.columnDef.meta,r=B?.rowId===t.id&&B.columnId===e.column.id,a=H?.rowId===t.id&&H.columnId===e.column.id;return(0,ey.jsxs)("button",{type:"button","data-slot":"data-table-tab-viewer-cell","data-active":r?"":void 0,onClick:()=>V({rowId:t.id,columnId:e.column.id}),onDoubleClick:()=>ea(t,e.column.id),className:(0,eI.cn)("group/cell relative flex min-w-0 items-center border-r px-2 text-left ui-text-code","focus-visible:z-10 focus-visible:border-ring focus-visible:ring-2 focus-visible:ring-ring/40 focus-visible:outline-none","data-active:bg-selection/10",n?.align==="right"&&"justify-end text-right",n?.align==="center"&&"justify-center text-center",n?.className),style:{height:w},children:[(0,ey.jsx)("span",{className:"min-w-0 truncate",children:UM(e.column.columnDef.cell,e.getContext())}),(0,ey.jsx)("span",{className:(0,eI.cn)("absolute top-1/2 right-1 grid size-5 -translate-y-1/2 place-items-center rounded-full border bg-background/95 text-muted-foreground opacity-0 shadow-xs transition-opacity","group-hover/cell:opacity-100",r&&"opacity-100"),title:O.copyCell,onClick:n=>{n.stopPropagation(),ea(t,e.column.id)},children:a?(0,ey.jsx)(pR,{className:"size-3"}):(0,ey.jsx)(lU,{className:"size-3"})})]},e.id)})]},t.id):null})})]})})]})}async function UX(e){try{return await navigator.clipboard?.writeText(e),!0}catch{var t=e;try{let e=document.createElement("textarea");e.value=t,e.setAttribute("readonly",""),e.style.position="fixed",e.style.left="-9999px",e.style.top="0",document.body.appendChild(e),e.select();let n=document.execCommand("copy");return document.body.removeChild(e),n}catch{return!1}}}let UY=(0,ek.default)("rows-2",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 12h18",key:"1i2n21"}]]),UZ={pathSeparator:"/",additions:"additions",deletions:"deletions",actions:"Diff view options",unified:"Unified diff",split:"Split diff",foldedLines:e=>`${e} folded lines`,expandDown:"Expand next lines",expandUp:"Expand previous lines",expandAll:"Expand folded lines",empty:"No diff content."};function UJ(e){return void 0===e?"":String(e)}function UQ({line:e,language:t}){let n=ew.useMemo(()=>(function(e,t){if(!e)return[{text:" ",type:"plain"}];let n=RegExp(`("(?:(?:\\\\.)|[^"\\\\])*"|'(?:(?:\\\\.)|[^'\\\\])*'|\\\`(?:(?:\\\\.)|[^\\\`\\\\])*\\\`|//.*|${"css"===t?"\\b(?:align-items|background|border|className|color|display|font|gap|grid|height|justify-content|margin|padding|position|width)\\b":"\\b(?:as|async|await|const|export|false|from|function|if|import|in|let|new|null|return|string|true|type|undefined)\\b"}|\\b\\d+(?:\\.\\d+)?\\b|[{}()[\\].,;:<>/=+\\-*])`,"g"),r=[],a=0;for(let t of e.matchAll(n)){let n=t[0],i=t.index??0;i>a&&r.push({text:e.slice(a,i),type:"plain"}),n.startsWith("//")?r.push({text:n,type:"comment"}):/^["'`]/.test(n)?r.push({text:n,type:"string"}):/^\d/.test(n)?r.push({text:n,type:"number"}):/^[{}()[\].,;:<>/=+\-*]$/.test(n)?r.push({text:n,type:"punctuation"}):r.push({text:n,type:"keyword"}),a=i+n.length}return a<e.length&&r.push({text:e.slice(a),type:"plain"}),r})(e,t),[t,e]);return(0,ey.jsx)(ey.Fragment,{children:n.map((e,t)=>(0,ey.jsx)("span",{className:(0,eI.cn)("comment"===e.type&&"text-[var(--vtl-diff-comment)] italic","keyword"===e.type&&"text-[var(--vtl-diff-keyword)]","string"===e.type&&"text-[var(--vtl-diff-string)]","number"===e.type&&"text-[var(--vtl-diff-number)]","punctuation"===e.type&&"text-[var(--vtl-diff-punctuation)]"),children:e.text},`${e.text}-${t}`))})}function U0({row:e,language:t,side:n,blankType:r}){if(!e)return(0,ey.jsxs)("div",{className:(0,eI.cn)("relative grid grid-cols-[2.5rem_minmax(0,1fr)] items-stretch overflow-hidden bg-[var(--vtl-diff-empty-bg)]","old"===n&&"border-r",r&&"bg-[image:var(--vtl-diff-empty-hatch)]"),children:[r&&(0,ey.jsx)("span",{className:(0,eI.cn)("absolute inset-y-0 left-0 w-1","insert"===r&&"bg-[var(--vtl-diff-insert-fg)]","delete"===r&&"bg-[var(--vtl-diff-delete-fg)]")}),(0,ey.jsx)("span",{}),(0,ey.jsx)("span",{})]});let a="old"===n?"insert"===e.type?void 0:e.oldLineNumber:"delete"===e.type?void 0:e.newLineNumber;return(0,ey.jsxs)("div",{className:(0,eI.cn)("relative grid grid-cols-[2.5rem_minmax(0,1fr)] items-stretch overflow-hidden","old"===n&&"border-r","insert"===e.type&&"bg-[var(--vtl-diff-insert-bg)]","delete"===e.type&&"bg-[var(--vtl-diff-delete-bg)]"),children:["context"!==e.type&&(0,ey.jsx)("span",{className:(0,eI.cn)("absolute inset-y-0 left-0 w-1","insert"===e.type&&"bg-[var(--vtl-diff-insert-fg)]","delete"===e.type&&"bg-[var(--vtl-diff-delete-fg)]")}),(0,ey.jsx)("span",{className:(0,eI.cn)("select-none bg-inherit px-2 text-right text-[var(--vtl-diff-gutter-fg)]","insert"===e.type&&"text-[var(--vtl-diff-insert-fg)]","delete"===e.type&&"text-[var(--vtl-diff-delete-fg)]"),children:UJ(a)}),(0,ey.jsx)("span",{className:"overflow-hidden px-3 text-[var(--vtl-diff-code-fg)]",children:(0,ey.jsx)("span",{className:"inline-block whitespace-pre will-change-transform",style:{transform:"translateX(calc(var(--vtl-diff-scroll-left,0px) * -1))"},children:(0,ey.jsx)(UQ,{line:e.content,language:t})})})]})}function U1({row:e,language:t,style:n,viewportWidth:r}){return(0,ey.jsx)("div",{"data-slot":"diff-tab-viewer-line","data-type":e.type,className:(0,eI.cn)("absolute w-full min-w-full ui-text-code","insert"===e.type&&"bg-[var(--vtl-diff-insert-bg)]","delete"===e.type&&"bg-[var(--vtl-diff-delete-bg)]"),style:n,children:(0,ey.jsxs)("div",{className:"sticky left-0 grid h-full grid-cols-[2.5rem_minmax(0,1fr)] items-stretch",style:{width:r},children:["context"!==e.type&&(0,ey.jsx)("span",{className:(0,eI.cn)("absolute inset-y-0 left-0 w-1","insert"===e.type&&"bg-[var(--vtl-diff-insert-fg)]","delete"===e.type&&"bg-[var(--vtl-diff-delete-fg)]")}),(0,ey.jsx)("span",{className:(0,eI.cn)("select-none bg-inherit px-2 text-right text-[var(--vtl-diff-gutter-fg)]","insert"===e.type&&"text-[var(--vtl-diff-insert-fg)]","delete"===e.type&&"text-[var(--vtl-diff-delete-fg)]"),children:UJ(e.newLineNumber)}),(0,ey.jsx)("span",{className:"overflow-hidden px-3 text-[var(--vtl-diff-code-fg)]",children:(0,ey.jsx)("span",{className:"inline-block whitespace-pre will-change-transform",style:{transform:"translateX(calc(var(--vtl-diff-scroll-left,0px) * -1))"},children:(0,ey.jsx)(UQ,{line:e.content,language:t})})})]})})}function U2({row:e,language:t,style:n,viewportWidth:r}){return(0,ey.jsx)("div",{"data-slot":"diff-tab-viewer-split-line",className:"absolute w-full min-w-full ui-text-code",style:n,children:(0,ey.jsxs)("div",{className:"sticky left-0 grid h-full grid-cols-[minmax(0,1fr)_minmax(0,1fr)] items-stretch",style:{width:r},children:[(0,ey.jsx)(U0,{row:e.oldLine,language:t,side:"old",blankType:e.oldBlankType}),(0,ey.jsx)(U0,{row:e.newLine,language:t,side:"new",blankType:e.newBlankType})]})})}function U5({row:e,labels:t,style:n,viewportWidth:r,onExpand:a}){let i="fold-count"===e.kind,o=(0,ey.jsxs)(ey.Fragment,{children:[(0,ey.jsx)("span",{}),i?(0,ey.jsx)("div",{className:"flex h-full min-w-0 items-center justify-start px-3 text-muted-foreground",children:(0,ey.jsx)("span",{children:t.foldedLines(e.hiddenCount)})}):(0,ey.jsx)("button",{type:"button",className:"group flex h-full min-w-0 items-center gap-2 px-3 text-muted-foreground outline-none transition-colors hover:text-foreground focus-visible:bg-muted/70","aria-label":"down"===e.direction?t.expandDown:t.expandUp,onClick:()=>a(e.direction),children:(0,ey.jsxs)(ey.Fragment,{children:["down"===e.direction?(0,ey.jsx)(g8,{className:"size-3.5 shrink-0"}):(0,ey.jsx)(g7,{className:"size-3.5 shrink-0"}),(0,ey.jsx)("span",{className:"h-px min-w-8 flex-1 bg-border transition-colors group-hover:bg-foreground/35"})]})})]});return void 0!==r?(0,ey.jsx)("div",{"data-slot":`diff-tab-viewer-${e.kind}`,className:"absolute w-full min-w-full bg-muted/25 ui-text-code",style:n,children:(0,ey.jsx)("div",{className:"sticky left-0 grid h-full grid-cols-[2.5rem_minmax(0,1fr)] items-stretch",style:{width:r},children:o})}):(0,ey.jsx)("div",{"data-slot":`diff-tab-viewer-${e.kind}`,className:"absolute grid w-full min-w-full grid-cols-[2.5rem_minmax(0,1fr)] items-stretch bg-muted/25 ui-text-code",style:n,children:o})}function U4({open:e,labels:t,currentView:n,onOpenChange:r,onToggleView:a}){let i="unified"===n?t.split:t.unified;return(0,ey.jsx)("div",{"data-slot":"diff-tab-floating-actions",className:"absolute right-3 bottom-3 z-20",children:(0,ey.jsxs)("div",{className:"relative size-8",children:[(0,ey.jsx)(eA.Button,{type:"button",variant:"outline",size:"icon-sm","aria-label":i,onPointerDown:e=>{e.preventDefault(),e.stopPropagation(),a()},className:(0,eI.cn)("absolute inset-0 rounded-full bg-background/95 shadow-md backdrop-blur transition-[opacity,transform] duration-150 ease-out active:translate-y-0",e?"pointer-events-auto -translate-y-[42px] opacity-100":"pointer-events-none translate-y-1 opacity-0"),children:"unified"===n?(0,ey.jsx)(HT,{className:"size-4"}):(0,ey.jsx)(UY,{className:"size-4"})}),(0,ey.jsx)(eA.Button,{type:"button",variant:"outline",size:"icon-sm","aria-label":t.actions,"aria-expanded":e,onClick:()=>r(!e),className:"absolute inset-0 rounded-full bg-background/95 shadow-md backdrop-blur",children:(0,ey.jsx)(lY,{className:(0,eI.cn)("size-4 transition-transform",e&&"rotate-90")})})]})})}function U3({file:e,lines:t,diff:n,showHeader:r=!0,contextBefore:a=4,contextAfter:i=4,minFoldLines:o=18,expandStep:l=50,rowHeight:s=22,view:c,defaultView:d="unified",onViewChange:u,labels:f,className:h,headerClassName:p,viewerClassName:m,style:g,...v}){let x,y=ew.useMemo(()=>({...UZ,...f}),[f]),b=ew.useMemo(()=>t??(n?function(e){let t=[],n=0,r=0,a=!1;for(let i of e.split("\n")){let e=/^@@\s+-(\d+)(?:,\d+)?\s+\+(\d+)(?:,\d+)?\s+@@/.exec(i);if(e){n=Number(e[1]),r=Number(e[2]),a=!0;continue}if(!a||i.startsWith("\\ No newline"))continue;let o=i[0],l=i.slice(1);if("+"===o){t.push({type:"insert",content:l,newLineNumber:r}),r+=1;continue}if("-"===o){t.push({type:"delete",content:l,oldLineNumber:n,newLineNumber:r}),n+=1;continue}t.push({type:"context",content:" "===o?l:i,oldLineNumber:n,newLineNumber:r}),n+=1,r+=1}return t}(n):[]),[n,t]),[w,j]=ew.useState({}),[k,S]=ew.useState(0),[N,C]=ew.useState(d),[M,E]=ew.useState(!1),O=ew.useRef(null),[P,A]=function(){let e=ew.useRef(null),[t,n]=ew.useState({height:0,width:0});return ew.useEffect(()=>{let t=e.current;if(!t)return;function r(){n({height:t.getBoundingClientRect().height,width:t.clientWidth})}r();let a=new ResizeObserver(r);return a.observe(t),()=>a.disconnect()},[]),[e,t]}(),I=(x=/\.([^.\\/]+)$/.exec(e.name||e.path||""),(e.language??x?.[1]??"text").toLowerCase()),z=c??N,T=ew.useMemo(()=>b.reduce((e,t)=>({additions:e.additions+ +("insert"===t.type),deletions:e.deletions+ +("delete"===t.type),maxLineLength:Math.max(e.maxLineLength,t.content.length)}),{additions:0,deletions:0,maxLineLength:0}),[b]),D=ew.useMemo(()=>(function({rows:e,folds:t,contextBefore:n,contextAfter:r,minFoldLines:a}){let i=[],o=0;function l(e,t){i.push({kind:"line",id:`line-${t}-${e.type}`,line:e})}for(;o<e.length;){let s=e[o];if(s?.type!=="context"){s&&l(s,o),o+=1;continue}let c=o;for(;o<e.length&&e[o]?.type==="context";)o+=1;let d=o,u=d-c;if(u<=n+r+a){for(let t=c;t<d;t+=1)l(e[t],t);continue}let f=`${c}-${d}`,h=t[f]??{revealTop:0,revealBottom:0},p=Math.min(n+h.revealTop,u),m=Math.min(r+h.revealBottom,u-p),g=c+p,v=d-m,x=v-g;if(x<=0){for(let t=c;t<d;t+=1)l(e[t],t);continue}for(let t=c;t<g;t+=1)l(e[t],t);i.push({kind:"fold-action",id:`fold-${f}-down-${x}`,foldId:f,direction:"down",hiddenCount:x}),i.push({kind:"fold-count",id:`fold-${f}-count-${x}`,foldId:f,hiddenCount:x}),i.push({kind:"fold-action",id:`fold-${f}-up-${x}`,foldId:f,direction:"up",hiddenCount:x});for(let t=v;t<d;t+=1)l(e[t],t)}return i})({rows:b,folds:w,contextBefore:a,contextAfter:i,minFoldLines:o}),[i,a,w,o,b]),_=ew.useMemo(()=>(function(e){let t=[],n=0;for(;n<e.length;){let r=e[n];if(!r)break;if("line"!==r.kind){t.push(r),n+=1;continue}if("context"===r.line.type){t.push({kind:"split-line",id:`split-${r.id}`,oldLine:r.line,newLine:r.line}),n+=1;continue}let a=[];for(;e[n]?.kind==="line";){let t=e[n];if("context"===t.line.type)break;a.push(t.line),n+=1}let i=a.filter(e=>"delete"===e.type),o=a.filter(e=>"insert"===e.type),l=Math.max(i.length,o.length);for(let e=0;e<l;e+=1){let n=i[e],r=o[e];t.push({kind:"split-line",id:`split-change-${t.length}-${n?.oldLineNumber??"empty"}-${r?.newLineNumber??"empty"}`,oldLine:n,newLine:r,oldBlankType:n?void 0:"insert",newBlankType:r?void 0:"delete"})}}return t})(D),[D]),R="split"===z?_:D,L=(e.path??e.name).split(/[\\/]+/).filter(Boolean),$=R.length*s,F=Math.max(0,Math.floor(k/s)-12),B=Math.min(R.length,Math.ceil((k+A.height)/s)+12),V=R.slice(F,B),H=Math.max(A.width,1),U=9.6*T.maxLineLength+168,W=Math.max(760,U),q=Math.max(A.width,1),K=Math.max(q,q/2+U),G=`${e.path??e.name}-${n??""}-${t?.length??0}`;return ew.useEffect(()=>{j({}),S(0),E(!1)},[G]),ew.useEffect(()=>{if(M)return window.addEventListener("pointerdown",e),()=>window.removeEventListener("pointerdown",e);function e(e){let t=e.target;t instanceof Node&&O.current?.contains(t)||E(!1)}},[M]),(0,ey.jsxs)("div",{ref:O,"data-slot":"diff-tab-viewer","data-view":z,className:(0,eI.cn)("vtl-surface-panel relative grid min-h-0 w-full min-w-0 overflow-hidden rounded-[var(--surface-panel-radius)] border",r?"grid-rows-[auto_minmax(0,1fr)]":"grid-rows-[minmax(0,1fr)]",h),style:g,...v,children:[r&&(0,ey.jsxs)("div",{"data-slot":"diff-tab-viewer-header",className:(0,eI.cn)("flex min-w-0 items-center gap-2 border-b bg-muted/35 px-3 py-2",p),children:[(0,ey.jsx)("span",{className:"grid size-5 shrink-0 place-items-center rounded-md border bg-background text-muted-foreground",children:(0,ey.jsx)(HD,{className:"size-3.5"})}),(0,ey.jsx)("div",{className:"flex min-w-0 flex-1 items-center gap-1.5 ui-text-kbd",children:L.map((e,t)=>(0,ey.jsxs)(ew.Fragment,{children:[t>0&&(0,ey.jsx)("span",{className:"text-muted-foreground",children:y.pathSeparator}),(0,ey.jsx)("span",{className:(0,eI.cn)("truncate",t===L.length-1?"font-medium text-foreground":"text-muted-foreground"),children:e})]},`${e}-${t}`))}),(0,ey.jsxs)("div",{className:"hidden shrink-0 items-center gap-1.5 sm:flex",children:[(0,ey.jsxs)(F3,{variant:"outline",className:"text-[var(--vtl-diff-insert-fg)]",children:["+",T.additions," ",y.additions]}),(0,ey.jsxs)(F3,{variant:"outline",className:"text-[var(--vtl-diff-delete-fg)]",children:["-",T.deletions," ",y.deletions]})]})]}),0===b.length?(0,ey.jsx)("div",{className:"grid min-h-0 place-items-center p-6 text-muted-foreground ui-text-body",children:y.empty}):(0,ey.jsx)("div",{ref:P,"data-slot":"diff-tab-viewer-body",className:(0,eI.cn)("min-h-0 min-w-0 overflow-auto bg-background font-mono","[scrollbar-color:var(--border)_transparent] [scrollbar-width:thin]","[&::-webkit-scrollbar]:size-2.5 [&::-webkit-scrollbar-corner]:bg-transparent [&::-webkit-scrollbar-track]:bg-transparent","[&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-thumb]:border-[3px] [&::-webkit-scrollbar-thumb]:border-transparent [&::-webkit-scrollbar-thumb]:bg-border [&::-webkit-scrollbar-thumb]:bg-clip-content",m),style:{"--vtl-diff-scroll-left":"0px"},onScroll:e=>{S(e.currentTarget.scrollTop),e.currentTarget.style.setProperty("--vtl-diff-scroll-left",`${e.currentTarget.scrollLeft}px`)},children:(0,ey.jsx)("div",{"data-slot":"diff-tab-viewer-scroll-width",className:"relative min-h-full",style:{height:$,width:"split"===z?K:W,minWidth:"100%"},children:V.map((e,t)=>{let n=F+t,r={height:s,lineHeight:`${s}px`,transform:`translateY(${n*s}px)`};return"line"===e.kind?(0,ey.jsx)(U1,{row:e.line,language:I,style:r,viewportWidth:H},e.id):"split-line"===e.kind?(0,ey.jsx)(U2,{row:e,language:I,style:r,viewportWidth:q},e.id):(0,ey.jsx)(U5,{row:e,labels:y,style:r,viewportWidth:"split"===z?q:void 0,onExpand:t=>{var n;return n=e.foldId,void j(e=>{let r=e[n]??{revealTop:0,revealBottom:0};return"all"===t?{...e,[n]:{revealTop:Number.MAX_SAFE_INTEGER,revealBottom:0}}:{...e,[n]:{revealTop:"down"===t?r.revealTop+l:r.revealTop,revealBottom:"up"===t?r.revealBottom+l:r.revealBottom}}})}},e.id)})})}),(0,ey.jsx)(U4,{open:M,labels:y,currentView:z,onOpenChange:E,onToggleView:function(){var e;e="unified"===z?"split":"unified",void 0===c&&C(e),u?.(e)}})]})}var U6=e.i(32800);function U8(e){return new U6.LanguageSupport(U6.StreamLanguage.define(e))}function U7(t){return e.A(22206).then(e=>e.sql({dialect:e[t]}))}let U9=[U6.LanguageDescription.of({name:"C",extensions:["c","h","ino"],load:()=>e.A(92137).then(e=>e.cpp())}),U6.LanguageDescription.of({name:"C++",alias:["cpp"],extensions:["cpp","c++","cc","cxx","hpp","h++","hh","hxx"],load:()=>e.A(92137).then(e=>e.cpp())}),U6.LanguageDescription.of({name:"CQL",alias:["cassandra"],extensions:["cql"],load:()=>U7("Cassandra")}),U6.LanguageDescription.of({name:"CSS",extensions:["css"],load:()=>e.A(79258).then(e=>e.css())}),U6.LanguageDescription.of({name:"Go",extensions:["go"],load:()=>e.A(44771).then(e=>e.go())}),U6.LanguageDescription.of({name:"HTML",alias:["xhtml"],extensions:["html","htm","handlebars","hbs"],load:()=>e.A(82412).then(e=>e.html())}),U6.LanguageDescription.of({name:"Java",extensions:["java"],load:()=>e.A(35733).then(e=>e.java())}),U6.LanguageDescription.of({name:"JavaScript",alias:["ecmascript","js","node"],extensions:["js","mjs","cjs"],load:()=>e.A(56714).then(e=>e.javascript())}),U6.LanguageDescription.of({name:"Jinja",extensions:["j2","jinja","jinja2"],load:()=>e.A(68909).then(e=>e.jinja())}),U6.LanguageDescription.of({name:"JSON",alias:["json5"],extensions:["json","map"],load:()=>e.A(42017).then(e=>e.json())}),U6.LanguageDescription.of({name:"JSX",extensions:["jsx"],load:()=>e.A(56714).then(e=>e.javascript({jsx:!0}))}),U6.LanguageDescription.of({name:"LESS",extensions:["less"],load:()=>e.A(23404).then(e=>e.less())}),U6.LanguageDescription.of({name:"Liquid",extensions:["liquid"],load:()=>e.A(20628).then(e=>e.liquid())}),U6.LanguageDescription.of({name:"MariaDB SQL",load:()=>U7("MariaSQL")}),U6.LanguageDescription.of({name:"Markdown",extensions:["md","markdown","mkd"],load:()=>e.A(80207).then(e=>e.markdown())}),U6.LanguageDescription.of({name:"MS SQL",load:()=>U7("MSSQL")}),U6.LanguageDescription.of({name:"MySQL",load:()=>U7("MySQL")}),U6.LanguageDescription.of({name:"PHP",extensions:["php","php3","php4","php5","php7","phtml"],load:()=>e.A(50333).then(e=>e.php())}),U6.LanguageDescription.of({name:"PLSQL",extensions:["pls"],load:()=>U7("PLSQL")}),U6.LanguageDescription.of({name:"PostgreSQL",load:()=>U7("PostgreSQL")}),U6.LanguageDescription.of({name:"Python",extensions:["BUILD","bzl","py","pyw"],filename:/^(BUCK|BUILD)$/,load:()=>e.A(43848).then(e=>e.python())}),U6.LanguageDescription.of({name:"Rust",extensions:["rs"],load:()=>e.A(22094).then(e=>e.rust())}),U6.LanguageDescription.of({name:"Sass",extensions:["sass"],load:()=>e.A(62363).then(e=>e.sass({indented:!0}))}),U6.LanguageDescription.of({name:"SCSS",extensions:["scss"],load:()=>e.A(62363).then(e=>e.sass())}),U6.LanguageDescription.of({name:"SQL",extensions:["sql"],load:()=>U7("StandardSQL")}),U6.LanguageDescription.of({name:"SQLite",load:()=>U7("SQLite")}),U6.LanguageDescription.of({name:"TSX",extensions:["tsx"],load:()=>e.A(56714).then(e=>e.javascript({jsx:!0,typescript:!0}))}),U6.LanguageDescription.of({name:"TypeScript",alias:["ts"],extensions:["ts","mts","cts"],load:()=>e.A(56714).then(e=>e.javascript({typescript:!0}))}),U6.LanguageDescription.of({name:"WebAssembly",extensions:["wat","wast"],load:()=>e.A(11043).then(e=>e.wast())}),U6.LanguageDescription.of({name:"XML",alias:["rss","wsdl","xsd"],extensions:["xml","xsl","xsd","svg"],load:()=>e.A(25290).then(e=>e.xml())}),U6.LanguageDescription.of({name:"YAML",alias:["yml"],extensions:["yaml","yml"],load:()=>e.A(66027).then(e=>e.yaml())}),U6.LanguageDescription.of({name:"APL",extensions:["dyalog","apl"],load:()=>e.A(66919).then(e=>U8(e.apl))}),U6.LanguageDescription.of({name:"PGP",alias:["asciiarmor"],extensions:["asc","pgp","sig"],load:()=>e.A(96245).then(e=>U8(e.asciiArmor))}),U6.LanguageDescription.of({name:"ASN.1",extensions:["asn","asn1"],load:()=>e.A(95592).then(e=>U8(e.asn1({})))}),U6.LanguageDescription.of({name:"Asterisk",filename:/^extensions\.conf$/i,load:()=>e.A(38120).then(e=>U8(e.asterisk))}),U6.LanguageDescription.of({name:"Brainfuck",extensions:["b","bf"],load:()=>e.A(33855).then(e=>U8(e.brainfuck))}),U6.LanguageDescription.of({name:"Cobol",extensions:["cob","cpy"],load:()=>e.A(37413).then(e=>U8(e.cobol))}),U6.LanguageDescription.of({name:"C#",alias:["csharp","cs"],extensions:["cs"],load:()=>e.A(38138).then(e=>U8(e.csharp))}),U6.LanguageDescription.of({name:"Clojure",extensions:["clj","cljc","cljx"],load:()=>e.A(32566).then(e=>U8(e.clojure))}),U6.LanguageDescription.of({name:"ClojureScript",extensions:["cljs"],load:()=>e.A(32566).then(e=>U8(e.clojure))}),U6.LanguageDescription.of({name:"Closure Stylesheets (GSS)",extensions:["gss"],load:()=>e.A(48876).then(e=>U8(e.gss))}),U6.LanguageDescription.of({name:"CMake",extensions:["cmake","cmake.in"],filename:/^CMakeLists\.txt$/,load:()=>e.A(44086).then(e=>U8(e.cmake))}),U6.LanguageDescription.of({name:"CoffeeScript",alias:["coffee","coffee-script"],extensions:["coffee"],load:()=>e.A(11973).then(e=>U8(e.coffeeScript))}),U6.LanguageDescription.of({name:"Common Lisp",alias:["lisp"],extensions:["cl","lisp","el"],load:()=>e.A(16995).then(e=>U8(e.commonLisp))}),U6.LanguageDescription.of({name:"Cypher",extensions:["cyp","cypher"],load:()=>e.A(45748).then(e=>U8(e.cypher))}),U6.LanguageDescription.of({name:"Cython",extensions:["pyx","pxd","pxi"],load:()=>e.A(64832).then(e=>U8(e.cython))}),U6.LanguageDescription.of({name:"Crystal",extensions:["cr"],load:()=>e.A(55133).then(e=>U8(e.crystal))}),U6.LanguageDescription.of({name:"D",extensions:["d"],load:()=>e.A(24299).then(e=>U8(e.d))}),U6.LanguageDescription.of({name:"Dart",extensions:["dart"],load:()=>e.A(38138).then(e=>U8(e.dart))}),U6.LanguageDescription.of({name:"diff",extensions:["diff","patch"],load:()=>e.A(85978).then(e=>U8(e.diff))}),U6.LanguageDescription.of({name:"Dockerfile",filename:/^Dockerfile$/,load:()=>e.A(89654).then(e=>U8(e.dockerFile))}),U6.LanguageDescription.of({name:"DTD",extensions:["dtd"],load:()=>e.A(77925).then(e=>U8(e.dtd))}),U6.LanguageDescription.of({name:"Dylan",extensions:["dylan","dyl","intr"],load:()=>e.A(27553).then(e=>U8(e.dylan))}),U6.LanguageDescription.of({name:"EBNF",load:()=>e.A(6232).then(e=>U8(e.ebnf))}),U6.LanguageDescription.of({name:"ECL",extensions:["ecl"],load:()=>e.A(11956).then(e=>U8(e.ecl))}),U6.LanguageDescription.of({name:"edn",extensions:["edn"],load:()=>e.A(32566).then(e=>U8(e.clojure))}),U6.LanguageDescription.of({name:"Eiffel",extensions:["e"],load:()=>e.A(25267).then(e=>U8(e.eiffel))}),U6.LanguageDescription.of({name:"Elm",extensions:["elm"],load:()=>e.A(6956).then(e=>U8(e.elm))}),U6.LanguageDescription.of({name:"Erlang",extensions:["erl"],load:()=>e.A(2095).then(e=>U8(e.erlang))}),U6.LanguageDescription.of({name:"Esper",load:()=>e.A(45412).then(e=>U8(e.esper))}),U6.LanguageDescription.of({name:"Factor",extensions:["factor"],load:()=>e.A(2075).then(e=>U8(e.factor))}),U6.LanguageDescription.of({name:"FCL",load:()=>e.A(68091).then(e=>U8(e.fcl))}),U6.LanguageDescription.of({name:"Forth",extensions:["forth","fth","4th"],load:()=>e.A(54669).then(e=>U8(e.forth))}),U6.LanguageDescription.of({name:"Fortran",extensions:["f","for","f77","f90","f95"],load:()=>e.A(76946).then(e=>U8(e.fortran))}),U6.LanguageDescription.of({name:"F#",alias:["fsharp"],extensions:["fs"],load:()=>e.A(36855).then(e=>U8(e.fSharp))}),U6.LanguageDescription.of({name:"Gas",extensions:["s"],load:()=>e.A(40367).then(e=>U8(e.gas))}),U6.LanguageDescription.of({name:"Gherkin",extensions:["feature"],load:()=>e.A(23161).then(e=>U8(e.gherkin))}),U6.LanguageDescription.of({name:"Groovy",extensions:["groovy","gradle"],filename:/^Jenkinsfile$/,load:()=>e.A(97713).then(e=>U8(e.groovy))}),U6.LanguageDescription.of({name:"Haskell",extensions:["hs"],load:()=>e.A(56334).then(e=>U8(e.haskell))}),U6.LanguageDescription.of({name:"Haxe",extensions:["hx"],load:()=>e.A(70963).then(e=>U8(e.haxe))}),U6.LanguageDescription.of({name:"HXML",extensions:["hxml"],load:()=>e.A(70963).then(e=>U8(e.hxml))}),U6.LanguageDescription.of({name:"HTTP",load:()=>e.A(35064).then(e=>U8(e.http))}),U6.LanguageDescription.of({name:"IDL",extensions:["pro"],load:()=>e.A(89381).then(e=>U8(e.idl))}),U6.LanguageDescription.of({name:"JSON-LD",alias:["jsonld"],extensions:["jsonld"],load:()=>e.A(59695).then(e=>U8(e.jsonld))}),U6.LanguageDescription.of({name:"Julia",extensions:["jl"],load:()=>e.A(64014).then(e=>U8(e.julia))}),U6.LanguageDescription.of({name:"Kotlin",extensions:["kt","kts"],load:()=>e.A(38138).then(e=>U8(e.kotlin))}),U6.LanguageDescription.of({name:"LiveScript",alias:["ls"],extensions:["ls"],load:()=>e.A(42765).then(e=>U8(e.liveScript))}),U6.LanguageDescription.of({name:"Lua",extensions:["lua"],load:()=>e.A(97328).then(e=>U8(e.lua))}),U6.LanguageDescription.of({name:"mIRC",extensions:["mrc"],load:()=>e.A(34747).then(e=>U8(e.mirc))}),U6.LanguageDescription.of({name:"Mathematica",extensions:["m","nb","wl","wls"],load:()=>e.A(15637).then(e=>U8(e.mathematica))}),U6.LanguageDescription.of({name:"Modelica",extensions:["mo"],load:()=>e.A(4877).then(e=>U8(e.modelica))}),U6.LanguageDescription.of({name:"MUMPS",extensions:["mps"],load:()=>e.A(51221).then(e=>U8(e.mumps))}),U6.LanguageDescription.of({name:"Mbox",extensions:["mbox"],load:()=>e.A(64186).then(e=>U8(e.mbox))}),U6.LanguageDescription.of({name:"Nginx",filename:/nginx.*\.conf$/i,load:()=>e.A(84274).then(e=>U8(e.nginx))}),U6.LanguageDescription.of({name:"NSIS",extensions:["nsh","nsi"],load:()=>e.A(51971).then(e=>U8(e.nsis))}),U6.LanguageDescription.of({name:"NTriples",extensions:["nt","nq"],load:()=>e.A(42967).then(e=>U8(e.ntriples))}),U6.LanguageDescription.of({name:"Objective-C",alias:["objective-c","objc"],extensions:["m"],load:()=>e.A(38138).then(e=>U8(e.objectiveC))}),U6.LanguageDescription.of({name:"Objective-C++",alias:["objective-c++","objc++"],extensions:["mm"],load:()=>e.A(38138).then(e=>U8(e.objectiveCpp))}),U6.LanguageDescription.of({name:"OCaml",extensions:["ml","mli","mll","mly"],load:()=>e.A(36855).then(e=>U8(e.oCaml))}),U6.LanguageDescription.of({name:"Octave",extensions:["m"],load:()=>e.A(22492).then(e=>U8(e.octave))}),U6.LanguageDescription.of({name:"Oz",extensions:["oz"],load:()=>e.A(73945).then(e=>U8(e.oz))}),U6.LanguageDescription.of({name:"Pascal",extensions:["p","pas"],load:()=>e.A(2372).then(e=>U8(e.pascal))}),U6.LanguageDescription.of({name:"Perl",extensions:["pl","pm"],load:()=>e.A(44660).then(e=>U8(e.perl))}),U6.LanguageDescription.of({name:"Pig",extensions:["pig"],load:()=>e.A(28734).then(e=>U8(e.pig))}),U6.LanguageDescription.of({name:"PowerShell",extensions:["ps1","psd1","psm1"],load:()=>e.A(36584).then(e=>U8(e.powerShell))}),U6.LanguageDescription.of({name:"Properties files",alias:["ini","properties"],extensions:["properties","ini","in"],load:()=>e.A(97145).then(e=>U8(e.properties))}),U6.LanguageDescription.of({name:"ProtoBuf",extensions:["proto"],load:()=>e.A(86304).then(e=>U8(e.protobuf))}),U6.LanguageDescription.of({name:"Pug",alias:["jade"],extensions:["pug","jade"],load:()=>e.A(86501).then(e=>U8(e.pug))}),U6.LanguageDescription.of({name:"Puppet",extensions:["pp"],load:()=>e.A(16397).then(e=>U8(e.puppet))}),U6.LanguageDescription.of({name:"Q",extensions:["q"],load:()=>e.A(71617).then(e=>U8(e.q))}),U6.LanguageDescription.of({name:"R",alias:["rscript"],extensions:["r","R"],load:()=>e.A(62905).then(e=>U8(e.r))}),U6.LanguageDescription.of({name:"RPM Changes",load:()=>e.A(31053).then(e=>U8(e.rpmChanges))}),U6.LanguageDescription.of({name:"RPM Spec",extensions:["spec"],load:()=>e.A(31053).then(e=>U8(e.rpmSpec))}),U6.LanguageDescription.of({name:"Ruby",alias:["jruby","macruby","rake","rb","rbx"],extensions:["rb"],filename:/^(Gemfile|Rakefile)$/,load:()=>e.A(84403).then(e=>U8(e.ruby))}),U6.LanguageDescription.of({name:"SAS",extensions:["sas"],load:()=>e.A(57388).then(e=>U8(e.sas))}),U6.LanguageDescription.of({name:"Scala",extensions:["scala"],load:()=>e.A(38138).then(e=>U8(e.scala))}),U6.LanguageDescription.of({name:"Scheme",extensions:["scm","ss"],load:()=>e.A(94780).then(e=>U8(e.scheme))}),U6.LanguageDescription.of({name:"Shell",alias:["bash","sh","zsh"],extensions:["sh","ksh","bash"],filename:/^PKGBUILD$/,load:()=>e.A(8240).then(e=>U8(e.shell))}),U6.LanguageDescription.of({name:"Sieve",extensions:["siv","sieve"],load:()=>e.A(46740).then(e=>U8(e.sieve))}),U6.LanguageDescription.of({name:"Smalltalk",extensions:["st"],load:()=>e.A(48213).then(e=>U8(e.smalltalk))}),U6.LanguageDescription.of({name:"Solr",load:()=>e.A(47982).then(e=>U8(e.solr))}),U6.LanguageDescription.of({name:"SML",extensions:["sml","sig","fun","smackspec"],load:()=>e.A(36855).then(e=>U8(e.sml))}),U6.LanguageDescription.of({name:"SPARQL",alias:["sparul"],extensions:["rq","sparql"],load:()=>e.A(85501).then(e=>U8(e.sparql))}),U6.LanguageDescription.of({name:"Spreadsheet",alias:["excel","formula"],load:()=>e.A(44878).then(e=>U8(e.spreadsheet))}),U6.LanguageDescription.of({name:"Squirrel",extensions:["nut"],load:()=>e.A(38138).then(e=>U8(e.squirrel))}),U6.LanguageDescription.of({name:"Stylus",extensions:["styl"],load:()=>e.A(76475).then(e=>U8(e.stylus))}),U6.LanguageDescription.of({name:"Swift",extensions:["swift"],load:()=>e.A(8835).then(e=>U8(e.swift))}),U6.LanguageDescription.of({name:"sTeX",load:()=>e.A(42690).then(e=>U8(e.stex))}),U6.LanguageDescription.of({name:"LaTeX",alias:["tex"],extensions:["text","ltx","tex"],load:()=>e.A(42690).then(e=>U8(e.stex))}),U6.LanguageDescription.of({name:"SystemVerilog",extensions:["v","sv","svh"],load:()=>e.A(78077).then(e=>U8(e.verilog))}),U6.LanguageDescription.of({name:"Tcl",extensions:["tcl"],load:()=>e.A(139).then(e=>U8(e.tcl))}),U6.LanguageDescription.of({name:"Textile",extensions:["textile"],load:()=>e.A(75208).then(e=>U8(e.textile))}),U6.LanguageDescription.of({name:"TiddlyWiki",load:()=>e.A(44524).then(e=>U8(e.tiddlyWiki))}),U6.LanguageDescription.of({name:"Tiki wiki",load:()=>e.A(38168).then(e=>U8(e.tiki))}),U6.LanguageDescription.of({name:"TOML",extensions:["toml"],load:()=>e.A(40346).then(e=>U8(e.toml))}),U6.LanguageDescription.of({name:"Troff",extensions:["1","2","3","4","5","6","7","8","9"],load:()=>e.A(13368).then(e=>U8(e.troff))}),U6.LanguageDescription.of({name:"TTCN",extensions:["ttcn","ttcn3","ttcnpp"],load:()=>e.A(49796).then(e=>U8(e.ttcn))}),U6.LanguageDescription.of({name:"TTCN_CFG",extensions:["cfg"],load:()=>e.A(80429).then(e=>U8(e.ttcnCfg))}),U6.LanguageDescription.of({name:"Turtle",extensions:["ttl"],load:()=>e.A(98657).then(e=>U8(e.turtle))}),U6.LanguageDescription.of({name:"Web IDL",extensions:["webidl"],load:()=>e.A(86672).then(e=>U8(e.webIDL))}),U6.LanguageDescription.of({name:"VB.NET",extensions:["vb"],load:()=>e.A(39480).then(e=>U8(e.vb))}),U6.LanguageDescription.of({name:"VBScript",extensions:["vbs"],load:()=>e.A(77625).then(e=>U8(e.vbScript))}),U6.LanguageDescription.of({name:"Velocity",extensions:["vtl"],load:()=>e.A(42762).then(e=>U8(e.velocity))}),U6.LanguageDescription.of({name:"Verilog",extensions:["v"],load:()=>e.A(78077).then(e=>U8(e.verilog))}),U6.LanguageDescription.of({name:"VHDL",extensions:["vhd","vhdl"],load:()=>e.A(24973).then(e=>U8(e.vhdl))}),U6.LanguageDescription.of({name:"XQuery",extensions:["xy","xquery","xq","xqm","xqy"],load:()=>e.A(50321).then(e=>U8(e.xQuery))}),U6.LanguageDescription.of({name:"Yacas",extensions:["ys"],load:()=>e.A(79514).then(e=>U8(e.yacas))}),U6.LanguageDescription.of({name:"Z80",extensions:["z80"],load:()=>e.A(91533).then(e=>U8(e.z80))}),U6.LanguageDescription.of({name:"MscGen",extensions:["mscgen","mscin","msc"],load:()=>e.A(20878).then(e=>U8(e.mscgen))}),U6.LanguageDescription.of({name:"Xù",extensions:["xu"],load:()=>e.A(20878).then(e=>U8(e.xu))}),U6.LanguageDescription.of({name:"MsGenny",extensions:["msgenny"],load:()=>e.A(20878).then(e=>U8(e.msgenny))}),U6.LanguageDescription.of({name:"Vue",extensions:["vue"],load:()=>e.A(99646).then(e=>e.vue())}),U6.LanguageDescription.of({name:"Angular Template",load:()=>e.A(29423).then(e=>e.angular())})];var We=e.i(68113),Wt=e.i(2262),Wn=e.i(17300);function Wr(e,t){return({state:n,dispatch:r})=>{if(n.readOnly)return!1;let a=e(t,n);return!!a&&(r(n.update(a)),!0)}}let Wa=Wr(function(e,t,n=t.selection.ranges){let r=[],a=-1;t:for(let{from:e,to:i}of n){let n=r.length,o=1e9,l;for(let n=e;n<=i;){let s=t.doc.lineAt(n);if(void 0==l&&!(l=Wl(t,s.from).line))continue t;if(s.from>a&&(e==i||i>s.from)){a=s.from;let e=/^\s*/.exec(s.text)[0].length,t=e==s.length,n=s.text.slice(e,e+l.length)==l?e:-1;e<s.text.length&&e<o&&(o=e),r.push({line:s,comment:n,token:l,indent:e,empty:t,single:!1})}n=s.to+1}if(o<1e9)for(let e=n;e<r.length;e++)r[e].indent<r[e].line.text.length&&(r[e].indent=o);r.length==n+1&&(r[n].single=!0)}if(2!=e&&r.some(e=>e.comment<0&&(!e.empty||e.single))){let e=[];for(let{line:t,token:n,indent:a,empty:i,single:o}of r)(o||!i)&&e.push({from:t.from+a,insert:n+" "});let n=t.changes(e);return{changes:n,selection:t.selection.map(n,1)}}if(1!=e&&r.some(e=>e.comment>=0)){let e=[];for(let{line:t,comment:n,token:a}of r)if(n>=0){let r=t.from+n,i=r+a.length;" "==t.text[i-t.from]&&i++,e.push({from:r,to:i})}return{changes:e}}return null},0),Wi=Wr(Ws,0),Wo=Wr((e,t)=>Ws(e,t,function(e){let t=[];for(let n of e.selection.ranges){let r=e.doc.lineAt(n.from),a=n.to<=r.to?r:e.doc.lineAt(n.to);a.from>r.from&&a.from==n.to&&(a=n.to==r.to+1?r:e.doc.lineAt(n.to-1));let i=t.length-1;i>=0&&t[i].to>r.from?t[i].to=a.to:t.push({from:r.from+/^\s*/.exec(r.text)[0].length,to:a.to})}return t}(t)),0);function Wl(e,t){let n=e.languageDataAt("commentTokens",t,1);return n.length?n[0]:{}}function Ws(e,t,n=t.selection.ranges){let r=n.map(e=>Wl(t,e.from).block);if(!r.every(e=>e))return null;let a=n.map((e,n)=>(function(e,{open:t,close:n},r,a){let i,o,l=e.sliceDoc(r-50,r),s=e.sliceDoc(a,a+50),c=/\s*$/.exec(l)[0].length,d=/^\s*/.exec(s)[0].length,u=l.length-c;if(l.slice(u-t.length,u)==t&&s.slice(d,d+n.length)==n)return{open:{pos:r-c,margin:c&&1},close:{pos:a+d,margin:d&&1}};a-r<=100?i=o=e.sliceDoc(r,a):(i=e.sliceDoc(r,r+50),o=e.sliceDoc(a-50,a));let f=/^\s*/.exec(i)[0].length,h=/\s*$/.exec(o)[0].length,p=o.length-h-n.length;return i.slice(f,f+t.length)==t&&o.slice(p,p+n.length)==n?{open:{pos:r+f+t.length,margin:+!!/\s/.test(i.charAt(f+t.length))},close:{pos:a-h-n.length,margin:+!!/\s/.test(o.charAt(p-1))}}:null})(t,r[n],e.from,e.to));if(2!=e&&!a.every(e=>e))return{changes:t.changes(n.map((e,t)=>a[t]?[]:[{from:e.from,insert:r[t].open+" "},{from:e.to,insert:" "+r[t].close}]))};if(1!=e&&a.some(e=>e)){let e=[];for(let t=0,n;t<a.length;t++)if(n=a[t]){let a=r[t],{open:i,close:o}=n;e.push({from:i.pos-a.open.length,to:i.pos+i.margin},{from:o.pos-o.margin,to:o.pos+a.close.length})}return{changes:e}}return null}let Wc=We.Annotation.define(),Wd=We.Annotation.define(),Wu=We.Facet.define(),Wf=We.Facet.define({combine:e=>(0,We.combineConfig)(e,{minDepth:100,newGroupDelay:500,joinToEvent:(e,t)=>t},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(e,t)=>(n,r)=>e(n,r)||t(n,r)})}),Wh=We.StateField.define({create:()=>WC.empty,update(e,t){let n=t.state.facet(Wf),r=t.annotation(Wc);if(r){let a=Wy.fromTransaction(t,r.selection),i=r.side,o=0==i?e.undone:e.done;return o=a?Wb(o,o.length,n.minDepth,a):Wk(o,t.startState.selection),new WC(0==i?r.rest:o,0==i?o:r.rest)}let a=t.annotation(Wd);if(("full"==a||"before"==a)&&(e=e.isolate()),!1===t.annotation(We.Transaction.addToHistory))return t.changes.empty?e:e.addMapping(t.changes.desc);let i=Wy.fromTransaction(t),o=t.annotation(We.Transaction.time),l=t.annotation(We.Transaction.userEvent);return i?e=e.addChanges(i,o,l,n,t):t.selection&&(e=e.addSelection(t.startState.selection,o,l,n.newGroupDelay)),("full"==a||"after"==a)&&(e=e.isolate()),e},toJSON:e=>({done:e.done.map(e=>e.toJSON()),undone:e.undone.map(e=>e.toJSON())}),fromJSON:e=>new WC(e.done.map(Wy.fromJSON),e.undone.map(Wy.fromJSON))});function Wp(e,t){return function({state:n,dispatch:r}){if(!t&&n.readOnly)return!1;let a=n.field(Wh,!1);if(!a)return!1;let i=a.pop(e,n,t);return!!i&&(r(i),!0)}}let Wm=Wp(0,!1),Wg=Wp(1,!1),Wv=Wp(0,!0),Wx=Wp(1,!0);class Wy{constructor(e,t,n,r,a){this.changes=e,this.effects=t,this.mapped=n,this.startSelection=r,this.selectionsAfter=a}setSelAfter(e){return new Wy(this.changes,this.effects,this.mapped,this.startSelection,e)}toJSON(){var e,t,n;return{changes:null==(e=this.changes)?void 0:e.toJSON(),mapped:null==(t=this.mapped)?void 0:t.toJSON(),startSelection:null==(n=this.startSelection)?void 0:n.toJSON(),selectionsAfter:this.selectionsAfter.map(e=>e.toJSON())}}static fromJSON(e){return new Wy(e.changes&&We.ChangeSet.fromJSON(e.changes),[],e.mapped&&We.ChangeDesc.fromJSON(e.mapped),e.startSelection&&We.EditorSelection.fromJSON(e.startSelection),e.selectionsAfter.map(We.EditorSelection.fromJSON))}static fromTransaction(e,t){let n=Wj;for(let t of e.startState.facet(Wu)){let r=t(e);r.length&&(n=n.concat(r))}return!n.length&&e.changes.empty?null:new Wy(e.changes.invert(e.startState.doc),n,void 0,t||e.startState.selection,Wj)}static selection(e){return new Wy(void 0,Wj,void 0,void 0,e)}}function Wb(e,t,n,r){let a=e.slice(t+1>n+20?t-n-1:0,t);return a.push(r),a}function Ww(e,t){return e.length?t.length?e.concat(t):e:t}let Wj=[];function Wk(e,t){if(!e.length)return[Wy.selection([t])];{let n=e[e.length-1],r=n.selectionsAfter.slice(Math.max(0,n.selectionsAfter.length-200));return r.length&&r[r.length-1].eq(t)?e:(r.push(t),Wb(e,e.length-1,1e9,n.setSelAfter(r)))}}function WS(e,t){if(!e.length)return e;let n=e.length,r=Wj;for(;n;){let a=function(e,t,n){let r=Ww(e.selectionsAfter.length?e.selectionsAfter.map(e=>e.map(t)):Wj,n);if(!e.changes)return Wy.selection(r);let a=e.changes.map(t),i=t.mapDesc(e.changes,!0),o=e.mapped?e.mapped.composeDesc(i):i;return new Wy(a,We.StateEffect.mapEffects(e.effects,t),o,e.startSelection.map(i),r)}(e[n-1],t,r);if(a.changes&&!a.changes.empty||a.effects.length){let t=e.slice(0,n);return t[n-1]=a,t}t=a.mapped,n--,r=a.selectionsAfter}return r.length?[Wy.selection(r)]:Wj}let WN=/^(input\.type|delete)($|\.)/;class WC{constructor(e,t,n=0,r){this.done=e,this.undone=t,this.prevTime=n,this.prevUserEvent=r}isolate(){return this.prevTime?new WC(this.done,this.undone):this}addChanges(e,t,n,r,a){var i,o;let l,s,c=this.done,d=c[c.length-1];return new WC(c=d&&d.changes&&!d.changes.empty&&e.changes&&(!n||WN.test(n))&&(!d.selectionsAfter.length&&t-this.prevTime<r.newGroupDelay&&r.joinToEvent(a,(i=d.changes,o=e.changes,l=[],s=!1,i.iterChangedRanges((e,t)=>l.push(e,t)),o.iterChangedRanges((e,t,n,r)=>{for(let e=0;e<l.length;){let t=l[e++],a=l[e++];r>=t&&n<=a&&(s=!0)}}),s))||"input.type.compose"==n)?Wb(c,c.length-1,r.minDepth,new Wy(e.changes.compose(d.changes),Ww(We.StateEffect.mapEffects(e.effects,d.changes),d.effects),d.mapped,d.startSelection,Wj)):Wb(c,c.length,r.minDepth,e),Wj,t,n)}addSelection(e,t,n,r){var a;let i=this.done.length?this.done[this.done.length-1].selectionsAfter:Wj;return i.length>0&&t-this.prevTime<r&&n==this.prevUserEvent&&n&&/^select($|\.)/.test(n)&&(a=i[i.length-1],a.ranges.length==e.ranges.length&&0===a.ranges.filter((t,n)=>t.empty!=e.ranges[n].empty).length)?this:new WC(Wk(this.done,e),this.undone,t,n)}addMapping(e){return new WC(WS(this.done,e),WS(this.undone,e),this.prevTime,this.prevUserEvent)}pop(e,t,n){let r=0==e?this.done:this.undone;if(0==r.length)return null;let a=r[r.length-1],i=a.selectionsAfter[0]||(a.startSelection?a.startSelection.map(a.changes.invertedDesc,1):t.selection);if(n&&a.selectionsAfter.length){let n,o;return t.update({selection:a.selectionsAfter[a.selectionsAfter.length-1],annotations:Wc.of({side:e,rest:(n=r[r.length-1],(o=r.slice())[r.length-1]=n.setSelAfter(n.selectionsAfter.slice(0,n.selectionsAfter.length-1)),o),selection:i}),userEvent:0==e?"select.undo":"select.redo",scrollIntoView:!0})}{if(!a.changes)return null;let n=1==r.length?Wj:r.slice(0,r.length-1);return a.mapped&&(n=WS(n,a.mapped)),t.update({changes:a.changes,selection:a.startSelection,effects:a.effects,annotations:Wc.of({side:e,rest:n,selection:i}),filter:!1,userEvent:0==e?"undo":"redo",scrollIntoView:!0})}}}WC.empty=new WC(Wj,Wj);function WM(e,t){return We.EditorSelection.create(e.ranges.map(t),e.mainIndex)}function WE(e,t){return e.update({selection:t,scrollIntoView:!0,userEvent:"select"})}function WO({state:e,dispatch:t},n){let r=WM(e.selection,n);return!r.eq(e.selection,!0)&&(t(WE(e,r)),!0)}function WP(e,t){return We.EditorSelection.cursor(t?e.to:e.from)}function WA(e,t){return WO(e,n=>n.empty?e.moveByChar(n,t):WP(n,t))}function WI(e){return e.textDirectionAt(e.state.selection.main.head)==Wt.Direction.LTR}let Wz=e=>WA(e,!WI(e)),WT=e=>WA(e,WI(e));function WD(e,t){return WO(e,n=>n.empty?e.moveByGroup(n,t):WP(n,t))}function W_(e,t,n){let r,a,i=(0,U6.syntaxTree)(e).resolveInner(t.head),o=n?Wn.NodeProp.closedBy:Wn.NodeProp.openedBy;for(let r=t.head;;){let t=n?i.childAfter(r):i.childBefore(r);if(!t)break;!function(e,t,n){if(t.type.prop(n))return!0;let r=t.to-t.from;return r&&(r>2||/[^\s,.;:]/.test(e.sliceDoc(t.from,t.to)))||t.firstChild}(e,t,o)?r=n?t.to:t.from:i=t}return a=i.type.prop(o)&&(r=n?(0,U6.matchBrackets)(e,i.from,1):(0,U6.matchBrackets)(e,i.to,-1))&&r.matched?n?r.end.to:r.end.from:n?i.to:i.from,We.EditorSelection.cursor(a,n?-1:1)}function WR(e,t){return WO(e,n=>{if(!n.empty)return WP(n,t);let r=e.moveVertically(n,t);return r.head!=n.head?r:e.moveToLineBoundary(n,t)})}"u">typeof Intl&&Intl.Segmenter;let WL=e=>WR(e,!1),W$=e=>WR(e,!0);function WF(e){let t=e.scrollDOM.clientHeight<e.scrollDOM.scrollHeight-2,n=0,r=0,a;if(t){for(let t of e.state.facet(Wt.EditorView.scrollMargins)){let a=t(e);(null==a?void 0:a.top)&&(n=Math.max(null==a?void 0:a.top,n)),(null==a?void 0:a.bottom)&&(r=Math.max(null==a?void 0:a.bottom,r))}a=e.scrollDOM.clientHeight-n-r}else a=(e.dom.ownerDocument.defaultView||window).innerHeight;return{marginTop:n,marginBottom:r,selfScroll:t,height:Math.max(e.defaultLineHeight,a-5)}}function WB(e,t){let n,r=WF(e),{state:a}=e,i=WM(a.selection,n=>n.empty?e.moveVertically(n,t,r.height):WP(n,t));if(i.eq(a.selection))return!1;if(r.selfScroll){let t=e.coordsAtPos(a.selection.main.head),o=e.scrollDOM.getBoundingClientRect(),l=o.top+r.marginTop,s=o.bottom-r.marginBottom;t&&t.top>l&&t.bottom<s&&(n=Wt.EditorView.scrollIntoView(i.main.head,{y:"start",yMargin:t.top-l}))}return e.dispatch(WE(a,i),{effects:n}),!0}let WV=e=>WB(e,!1),WH=e=>WB(e,!0);function WU(e,t,n){let r=e.lineBlockAt(t.head),a=e.moveToLineBoundary(t,n);if(a.head==t.head&&a.head!=(n?r.to:r.from)&&(a=e.moveToLineBoundary(t,n,!1)),!n&&a.head==r.from&&r.length){let n=/^\s*/.exec(e.state.sliceDoc(r.from,Math.min(r.from+100,r.to)))[0].length;n&&t.head!=r.from+n&&(a=We.EditorSelection.cursor(r.from+n))}return a}function WW(e,t){let n=WM(e.state.selection,e=>{let n=t(e);return We.EditorSelection.range(e.anchor,n.head,n.goalColumn,n.bidiLevel||void 0,n.assoc)});return!n.eq(e.state.selection)&&(e.dispatch(WE(e.state,n)),!0)}function Wq(e,t){return WW(e,n=>e.moveByChar(n,t))}let WK=e=>Wq(e,!WI(e)),WG=e=>Wq(e,WI(e));function WX(e,t){return WW(e,n=>e.moveByGroup(n,t))}function WY(e,t){return WW(e,n=>e.moveVertically(n,t))}let WZ=e=>WY(e,!1),WJ=e=>WY(e,!0);function WQ(e,t){return WW(e,n=>e.moveVertically(n,t,WF(e).height))}let W0=e=>WQ(e,!1),W1=e=>WQ(e,!0),W2=({state:e,dispatch:t})=>(t(WE(e,{anchor:0})),!0),W5=({state:e,dispatch:t})=>(t(WE(e,{anchor:e.doc.length})),!0),W4=({state:e,dispatch:t})=>(t(WE(e,{anchor:e.selection.main.anchor,head:0})),!0),W3=({state:e,dispatch:t})=>(t(WE(e,{anchor:e.selection.main.anchor,head:e.doc.length})),!0);function W6(e,t){let{state:n}=e,r=n.selection,a=n.selection.ranges.slice();for(let r of n.selection.ranges){let i=n.doc.lineAt(r.head);if(t?i.to<e.state.doc.length:i.from>0)for(let n=r;;){let r=e.moveVertically(n,t);if(r.head<i.from||r.head>i.to){a.some(e=>e.head==r.head)||a.push(r);break}if(r.head==n.head)break;n=r}}return a.length!=r.ranges.length&&(e.dispatch(WE(n,We.EditorSelection.create(a,a.length-1))),!0)}function W8(e,t){if(e.state.readOnly)return!1;let n="delete.selection",{state:r}=e,a=r.changeByRange(r=>{let{from:a,to:i}=r;if(a==i){let o=t(r);o<a?(n="delete.backward",o=W7(e,o,!1)):o>a&&(n="delete.forward",o=W7(e,o,!0)),a=Math.min(a,o),i=Math.max(i,o)}else a=W7(e,a,!1),i=W7(e,i,!0);return a==i?{range:r}:{changes:{from:a,to:i},range:We.EditorSelection.cursor(a,a<r.head?-1:1)}});return!a.changes.empty&&(e.dispatch(r.update(a,{scrollIntoView:!0,userEvent:n,effects:"delete.selection"==n?Wt.EditorView.announce.of(r.phrase("Selection deleted")):void 0})),!0)}function W7(e,t,n){if(e instanceof Wt.EditorView)for(let r of e.state.facet(Wt.EditorView.atomicRanges).map(t=>t(e)))r.between(t,t,(e,r)=>{e<t&&r>t&&(t=n?r:e)});return t}let W9=(e,t,n)=>W8(e,r=>{let a=r.from,{state:i}=e,o=i.doc.lineAt(a),l,s;if(n&&!t&&a>o.from&&a<o.from+200&&!/[^ \t]/.test(l=o.text.slice(0,a-o.from))){if(" "==l[l.length-1])return a-1;let e=(0,We.countColumn)(l,i.tabSize)%(0,U6.getIndentUnit)(i)||(0,U6.getIndentUnit)(i);for(let t=0;t<e&&" "==l[l.length-1-t];t++)a--;s=a}else(s=(0,We.findClusterBreak)(o.text,a-o.from,t,t)+o.from)==a&&o.number!=(t?i.doc.lines:1)?s+=t?1:-1:!t&&/[\ufe00-\ufe0f]/.test(o.text.slice(s-o.from,a-o.from))&&(s=(0,We.findClusterBreak)(o.text,s-o.from,!1,!1)+o.from);return s}),qe=e=>W9(e,!1,!0),qt=e=>W9(e,!0,!1),qn=(e,t)=>W8(e,n=>{let r=n.head,{state:a}=e,i=a.doc.lineAt(r),o=a.charCategorizer(r);for(let e=null;;){if(r==(t?i.to:i.from)){r==n.head&&i.number!=(t?a.doc.lines:1)&&(r+=t?1:-1);break}let l=(0,We.findClusterBreak)(i.text,r-i.from,t)+i.from,s=i.text.slice(Math.min(r,l)-i.from,Math.max(r,l)-i.from),c=o(s);if(null!=e&&c!=e)break;(" "!=s||r!=n.head)&&(e=c),r=l}return r}),qr=e=>qn(e,!1);function qa(e){let t=[],n=-1;for(let r of e.selection.ranges){let a=e.doc.lineAt(r.from),i=e.doc.lineAt(r.to);if(r.empty||r.to!=i.from||(i=e.doc.lineAt(r.to-1)),n>=a.number){let e=t[t.length-1];e.to=i.to,e.ranges.push(r)}else t.push({from:a.from,to:i.to,ranges:[r]});n=i.number+1}return t}function qi(e,t,n){if(e.readOnly)return!1;let r=[],a=[];for(let t of qa(e)){if(n?t.to==e.doc.length:0==t.from)continue;let i=e.doc.lineAt(n?t.to+1:t.from-1),o=i.length+1;if(n)for(let n of(r.push({from:t.to,to:i.to},{from:t.from,insert:i.text+e.lineBreak}),t.ranges))a.push(We.EditorSelection.range(Math.min(e.doc.length,n.anchor+o),Math.min(e.doc.length,n.head+o)));else for(let n of(r.push({from:i.from,to:t.from},{from:t.to,insert:e.lineBreak+i.text}),t.ranges))a.push(We.EditorSelection.range(n.anchor-o,n.head-o))}return!!r.length&&(t(e.update({changes:r,scrollIntoView:!0,selection:We.EditorSelection.create(a,e.selection.mainIndex),userEvent:"move.line"})),!0)}function qo(e,t,n){if(e.readOnly)return!1;let r=[];for(let t of qa(e))n?r.push({from:t.from,insert:e.doc.slice(t.from,t.to)+e.lineBreak}):r.push({from:t.to,insert:e.lineBreak+e.doc.slice(t.from,t.to)});let a=e.changes(r);return t(e.update({changes:a,selection:e.selection.map(a,n?1:-1),scrollIntoView:!0,userEvent:"input.copyline"})),!0}let ql=qc(!1),qs=qc(!0);function qc(e){return({state:t,dispatch:n})=>{if(t.readOnly)return!1;let r=t.changeByRange(n=>{let{from:r,to:a}=n,i=t.doc.lineAt(r),o=!e&&r==a&&function(e,t){if(/\(\)|\[\]|\{\}/.test(e.sliceDoc(t-1,t+1)))return{from:t,to:t};let n=(0,U6.syntaxTree)(e).resolveInner(t),r=n.childBefore(t),a=n.childAfter(t),i;return r&&a&&r.to<=t&&a.from>=t&&(i=r.type.prop(Wn.NodeProp.closedBy))&&i.indexOf(a.name)>-1&&e.doc.lineAt(r.to).from==e.doc.lineAt(a.from).from&&!/\S/.test(e.sliceDoc(r.to,a.from))?{from:r.to,to:a.from}:null}(t,r);e&&(r=a=(a<=i.to?i:t.doc.lineAt(a)).to);let l=new U6.IndentContext(t,{simulateBreak:r,simulateDoubleBreak:!!o}),s=(0,U6.getIndentation)(l,r);for(null==s&&(s=(0,We.countColumn)(/^\s*/.exec(t.doc.lineAt(r).text)[0],t.tabSize));a<i.to&&/\s/.test(i.text[a-i.from]);)a++;o?{from:r,to:a}=o:r>i.from&&r<i.from+100&&!/\S/.test(i.text.slice(0,r))&&(r=i.from);let c=["",(0,U6.indentString)(t,s)];return o&&c.push((0,U6.indentString)(t,l.lineIndent(i.from,-1))),{changes:{from:r,to:a,insert:We.Text.of(c)},range:We.EditorSelection.cursor(r+1+c[1].length)}});return n(t.update(r,{scrollIntoView:!0,userEvent:"input"})),!0}}function qd(e,t){let n=-1;return e.changeByRange(r=>{let a=[];for(let i=r.from;i<=r.to;){let o=e.doc.lineAt(i);o.number>n&&(r.empty||r.to>o.from)&&(t(o,a,r),n=o.number),i=o.to+1}let i=e.changes(a);return{changes:a,range:We.EditorSelection.range(i.mapPos(r.anchor,1),i.mapPos(r.head,1))}})}let qu=[{key:"Ctrl-b",run:Wz,shift:WK,preventDefault:!0},{key:"Ctrl-f",run:WT,shift:WG},{key:"Ctrl-p",run:WL,shift:WZ},{key:"Ctrl-n",run:W$,shift:WJ},{key:"Ctrl-a",run:e=>WO(e,t=>We.EditorSelection.cursor(e.lineBlockAt(t.head).from,1)),shift:e=>WW(e,t=>We.EditorSelection.cursor(e.lineBlockAt(t.head).from))},{key:"Ctrl-e",run:e=>WO(e,t=>We.EditorSelection.cursor(e.lineBlockAt(t.head).to,-1)),shift:e=>WW(e,t=>We.EditorSelection.cursor(e.lineBlockAt(t.head).to))},{key:"Ctrl-d",run:qt},{key:"Ctrl-h",run:qe},{key:"Ctrl-k",run:e=>W8(e,t=>{let n=e.lineBlockAt(t.head).to;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)})},{key:"Ctrl-Alt-h",run:qr},{key:"Ctrl-o",run:({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange(e=>({changes:{from:e.from,to:e.to,insert:We.Text.of(["",""])},range:We.EditorSelection.cursor(e.from)}));return t(e.update(n,{scrollIntoView:!0,userEvent:"input"})),!0}},{key:"Ctrl-t",run:({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange(t=>{if(!t.empty||0==t.from||t.from==e.doc.length)return{range:t};let n=t.from,r=e.doc.lineAt(n),a=n==r.from?n-1:(0,We.findClusterBreak)(r.text,n-r.from,!1)+r.from,i=n==r.to?n+1:(0,We.findClusterBreak)(r.text,n-r.from,!0)+r.from;return{changes:{from:a,to:i,insert:e.doc.slice(n,i).append(e.doc.slice(a,n))},range:We.EditorSelection.cursor(i)}});return!n.changes.empty&&(t(e.update(n,{scrollIntoView:!0,userEvent:"move.character"})),!0)}},{key:"Ctrl-v",run:WH}],qf=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:e=>WO(e,t=>W_(e.state,t,!WI(e))),shift:e=>WW(e,t=>W_(e.state,t,!WI(e)))},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:e=>WO(e,t=>W_(e.state,t,WI(e))),shift:e=>WW(e,t=>W_(e.state,t,WI(e)))},{key:"Alt-ArrowUp",run:({state:e,dispatch:t})=>qi(e,t,!1)},{key:"Shift-Alt-ArrowUp",run:({state:e,dispatch:t})=>qo(e,t,!1)},{key:"Alt-ArrowDown",run:({state:e,dispatch:t})=>qi(e,t,!0)},{key:"Shift-Alt-ArrowDown",run:({state:e,dispatch:t})=>qo(e,t,!0)},{key:"Mod-Alt-ArrowUp",run:e=>W6(e,!1)},{key:"Mod-Alt-ArrowDown",run:e=>W6(e,!0)},{key:"Escape",run:({state:e,dispatch:t})=>{let n=e.selection,r=null;return n.ranges.length>1?r=We.EditorSelection.create([n.main]):n.main.empty||(r=We.EditorSelection.create([We.EditorSelection.cursor(n.main.head)])),!!r&&(t(WE(e,r)),!0)}},{key:"Mod-Enter",run:qs},{key:"Alt-l",mac:"Ctrl-l",run:({state:e,dispatch:t})=>{let n=qa(e).map(({from:t,to:n})=>We.EditorSelection.range(t,Math.min(n+1,e.doc.length)));return t(e.update({selection:We.EditorSelection.create(n),userEvent:"select"})),!0}},{key:"Mod-i",run:({state:e,dispatch:t})=>{let n=WM(e.selection,t=>{let n=(0,U6.syntaxTree)(e),r=n.resolveStack(t.from,1);if(t.empty){let e=n.resolveStack(t.from,-1);e.node.from>=r.node.from&&e.node.to<=r.node.to&&(r=e)}for(let e=r;e;e=e.next){let{node:n}=e;if((n.from<t.from&&n.to>=t.to||n.to>t.to&&n.from<=t.from)&&e.next)return We.EditorSelection.range(n.to,n.from)}return t});return!n.eq(e.selection)&&(t(WE(e,n)),!0)},preventDefault:!0},{key:"Mod-[",run:({state:e,dispatch:t})=>!e.readOnly&&(t(e.update(qd(e,(t,n)=>{let r=/^\s*/.exec(t.text)[0];if(!r)return;let a=(0,We.countColumn)(r,e.tabSize),i=0,o=(0,U6.indentString)(e,Math.max(0,a-(0,U6.getIndentUnit)(e)));for(;i<r.length&&i<o.length&&r.charCodeAt(i)==o.charCodeAt(i);)i++;n.push({from:t.from+i,to:t.from+r.length,insert:o.slice(i)})}),{userEvent:"delete.dedent"})),!0)},{key:"Mod-]",run:({state:e,dispatch:t})=>!e.readOnly&&(t(e.update(qd(e,(t,n)=>{n.push({from:t.from,insert:e.facet(U6.indentUnit)})}),{userEvent:"input.indent"})),!0)},{key:"Mod-Alt-\\",run:({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=Object.create(null),r=new U6.IndentContext(e,{overrideIndentation:e=>{let t=n[e];return null==t?-1:t}}),a=qd(e,(t,a,i)=>{let o=(0,U6.getIndentation)(r,t.from);if(null==o)return;/\S/.test(t.text)||(o=0);let l=/^\s*/.exec(t.text)[0],s=(0,U6.indentString)(e,o);(l!=s||i.from<t.from+l.length)&&(n[t.from]=o,a.push({from:t.from,to:t.from+l.length,insert:s}))});return a.changes.empty||t(e.update(a,{userEvent:"indent"})),!0}},{key:"Shift-Mod-k",run:e=>{if(e.state.readOnly)return!1;let{state:t}=e,n=t.changes(qa(t).map(({from:e,to:n})=>(e>0?e--:n<t.doc.length&&n++,{from:e,to:n}))),r=WM(t.selection,t=>{let n;if(e.lineWrapping){let r=e.lineBlockAt(t.head),a=e.coordsAtPos(t.head,t.assoc||1);a&&(n=r.bottom+e.documentTop-a.bottom+e.defaultLineHeight/2)}return e.moveVertically(t,!0,n)}).map(n);return e.dispatch({changes:n,selection:r,scrollIntoView:!0,userEvent:"delete.line"}),!0}},{key:"Shift-Mod-\\",run:({state:e,dispatch:t})=>{let n,r;return n=!1,r=WM(e.selection,t=>{let r=(0,U6.matchBrackets)(e,t.head,-1)||(0,U6.matchBrackets)(e,t.head,1)||t.head>0&&(0,U6.matchBrackets)(e,t.head-1,1)||t.head<e.doc.length&&(0,U6.matchBrackets)(e,t.head+1,-1);if(!r||!r.end)return t;n=!0;let a=r.start.from==t.head?r.end.to:r.end.from;return We.EditorSelection.cursor(a)}),!!n&&(t(WE(e,r)),!0)}},{key:"Mod-/",run:e=>{let{state:t}=e,n=t.doc.lineAt(t.selection.main.from),r=Wl(e.state,n.from);return r.line?Wa(e):!!r.block&&Wo(e)}},{key:"Alt-A",run:Wi},{key:"Ctrl-m",mac:"Shift-Alt-m",run:e=>(e.setTabFocusMode(),!0)}].concat([{key:"ArrowLeft",run:Wz,shift:WK,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:e=>WD(e,!WI(e)),shift:e=>WX(e,!WI(e)),preventDefault:!0},{mac:"Cmd-ArrowLeft",run:e=>WO(e,t=>WU(e,t,!WI(e))),shift:e=>WW(e,t=>WU(e,t,!WI(e))),preventDefault:!0},{key:"ArrowRight",run:WT,shift:WG,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:e=>WD(e,WI(e)),shift:e=>WX(e,WI(e)),preventDefault:!0},{mac:"Cmd-ArrowRight",run:e=>WO(e,t=>WU(e,t,WI(e))),shift:e=>WW(e,t=>WU(e,t,WI(e))),preventDefault:!0},{key:"ArrowUp",run:WL,shift:WZ,preventDefault:!0},{mac:"Cmd-ArrowUp",run:W2,shift:W4},{mac:"Ctrl-ArrowUp",run:WV,shift:W0},{key:"ArrowDown",run:W$,shift:WJ,preventDefault:!0},{mac:"Cmd-ArrowDown",run:W5,shift:W3},{mac:"Ctrl-ArrowDown",run:WH,shift:W1},{key:"PageUp",run:WV,shift:W0},{key:"PageDown",run:WH,shift:W1},{key:"Home",run:e=>WO(e,t=>WU(e,t,!1)),shift:e=>WW(e,t=>WU(e,t,!1)),preventDefault:!0},{key:"Mod-Home",run:W2,shift:W4},{key:"End",run:e=>WO(e,t=>WU(e,t,!0)),shift:e=>WW(e,t=>WU(e,t,!0)),preventDefault:!0},{key:"Mod-End",run:W5,shift:W3},{key:"Enter",run:ql,shift:ql},{key:"Mod-a",run:({state:e,dispatch:t})=>(t(e.update({selection:{anchor:0,head:e.doc.length},userEvent:"select"})),!0)},{key:"Backspace",run:qe,shift:qe,preventDefault:!0},{key:"Delete",run:qt,preventDefault:!0},{key:"Mod-Backspace",mac:"Alt-Backspace",run:qr,preventDefault:!0},{key:"Mod-Delete",mac:"Alt-Delete",run:e=>qn(e,!0),preventDefault:!0},{mac:"Mod-Backspace",run:e=>W8(e,t=>{let n=e.moveToLineBoundary(t,!1).head;return t.head>n?n:Math.max(0,t.head-1)}),preventDefault:!0},{mac:"Mod-Delete",run:e=>W8(e,t=>{let n=e.moveToLineBoundary(t,!0).head;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)}),preventDefault:!0}].concat(qu.map(e=>({mac:e.key,run:e.run,shift:e.shift}))));var qh=e.i(41016);let qp="function"==typeof String.prototype.normalize?e=>e.normalize("NFKD"):e=>e;class qm{constructor(e,t,n=0,r=e.length,a,i){this.test=i,this.value={from:0,to:0,precise:!1},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=e.iterRange(n,r),this.bufferStart=n,this.normalize=a?e=>a(qp(e)):qp,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(0,We.codePointAt)(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=(0,We.fromCodePoint)(e),n=this.bufferStart+this.bufferPos;this.bufferPos+=(0,We.codePointSize)(e);let r=this.normalize(t);if(r.length)for(let e=0,a=n,i=!0;;e++){let n=r.charCodeAt(e),o=this.match(n,a,i,this.bufferPos+this.bufferStart,e==r.length-1);if(o)return this.value=o,this;if(e==r.length-1)break;i&&e<t.length&&t.charCodeAt(e)==n?a++:i=!1}}}match(e,t,n,r,a){let i=null;for(let t=0;t<this.matches.length;){let n=this.matches[t],o=!1;this.query.charCodeAt(n.index)==e&&(n.index==this.query.length-1?i={from:n.from,to:r,precise:a&&n.precise}:(n.index++,o=!0)),o?t++:this.matches.splice(t,1)}return this.query.charCodeAt(0)==e&&(1==this.query.length?i={from:t,to:r,precise:n&&a}:this.matches.push({from:t,index:1,precise:n})),i&&this.test&&!this.test(i.from,i.to,this.buffer,this.bufferStart)&&(i=null),i}}"u">typeof Symbol&&(qm.prototype[Symbol.iterator]=function(){return this});let qg={from:-1,to:-1,match:/.*/.exec(""),precise:!0},qv="gm"+(null==/x/.unicode?"":"u");class qx{constructor(e,t,n,r=0,a=e.length){if(this.text=e,this.to=a,this.curLine="",this.done=!1,this.value=qg,/\\[sWDnr]|\n|\r|\[\^/.test(t))return new qw(e,t,n,r,a);this.re=new RegExp(t,qv+((null==n?void 0:n.ignoreCase)?"i":"")),this.test=null==n?void 0:n.test,this.iter=e.iter();let i=e.lineAt(r);this.curLineStart=i.from,this.matchPos=qj(e,r),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 n=this.curLineStart+t.index,r=n+t[0].length;if(this.matchPos=qj(this.text,r+ +(n==r)),n==this.curLineStart+this.curLine.length&&this.nextLine(),(n<r||n>this.value.to)&&(!this.test||this.test(n,r,t)))return this.value={from:n,to:r,precise:!0,match:t},this;e=this.matchPos-this.curLineStart}else{if(!(this.curLineStart+this.curLine.length<this.to))return this.done=!0,this;this.nextLine(),e=0}}}}let qy=new WeakMap;class qb{constructor(e,t){this.from=e,this.text=t}get to(){return this.from+this.text.length}static get(e,t,n){let r=qy.get(e);if(!r||r.from>=n||r.to<=t){let r=new qb(t,e.sliceString(t,n));return qy.set(e,r),r}if(r.from==t&&r.to==n)return r;let{text:a,from:i}=r;return i>t&&(a=e.sliceString(t,i)+a,i=t),r.to<n&&(a+=e.sliceString(r.to,n)),qy.set(e,new qb(i,a)),new qb(t,a.slice(t-i,n-i))}}class qw{constructor(e,t,n,r,a){this.text=e,this.to=a,this.done=!1,this.value=qg,this.matchPos=qj(e,r),this.re=new RegExp(t,qv+((null==n?void 0:n.ignoreCase)?"i":"")),this.test=null==n?void 0:n.test,this.flat=qb.get(e,r,this.chunkEnd(r+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 e=this.flat.from+t.index,n=e+t[0].length;if((this.flat.to>=this.to||t.index+t[0].length<=this.flat.text.length-10)&&(!this.test||this.test(e,n,t)))return this.value={from:e,to:n,precise:!0,match:t},this.matchPos=qj(this.text,n+ +(e==n)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=qb.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+2*this.flat.text.length))}}}function qj(e,t){if(t>=e.length)return t;let n=e.lineAt(t),r;for(;t<n.to&&(r=n.text.charCodeAt(t-n.from))>=56320&&r<57344;)t++;return t}"u">typeof Symbol&&(qx.prototype[Symbol.iterator]=qw.prototype[Symbol.iterator]=function(){return this});let qk={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},qS=We.Facet.define({combine:e=>(0,We.combineConfig)(e,qk,{highlightWordAroundCursor:(e,t)=>e||t,minSelectionLength:Math.min,maxMatches:Math.min})}),qN=Wt.Decoration.mark({class:"cm-selectionMatch"}),qC=Wt.Decoration.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function qM(e,t,n,r){return(0==n||e(t.sliceDoc(n-1,n))!=We.CharCategory.Word)&&(r==t.doc.length||e(t.sliceDoc(r,r+1))!=We.CharCategory.Word)}let qE=Wt.ViewPlugin.fromClass(class{constructor(e){this.decorations=this.getDeco(e)}update(e){(e.selectionSet||e.docChanged||e.viewportChanged)&&(this.decorations=this.getDeco(e.view))}getDeco(e){let t=e.state.facet(qS),{state:n}=e,r=n.selection;if(r.ranges.length>1)return Wt.Decoration.none;let a=r.main,i,o=null;if(a.empty){if(!t.highlightWordAroundCursor)return Wt.Decoration.none;let e=n.wordAt(a.head);if(!e)return Wt.Decoration.none;o=n.charCategorizer(a.head),i=n.sliceDoc(e.from,e.to)}else{let e=a.to-a.from;if(e<t.minSelectionLength||e>200)return Wt.Decoration.none;if(t.wholeWords){var l,s,c;if(i=n.sliceDoc(a.from,a.to),!(qM(o=n.charCategorizer(a.head),n,a.from,a.to)&&(l=o,s=a.from,c=a.to,l(n.sliceDoc(s,s+1))==We.CharCategory.Word&&l(n.sliceDoc(c-1,c))==We.CharCategory.Word)))return Wt.Decoration.none}else if(!(i=n.sliceDoc(a.from,a.to)))return Wt.Decoration.none}let d=[];for(let r of e.visibleRanges){let e=new qm(n.doc,i,r.from,r.to);for(;!e.next().done;){let{from:r,to:i}=e.value;if((!o||qM(o,n,r,i))&&(a.empty&&r<=a.from&&i>=a.to?d.push(qC.range(r,i)):(r>=a.to||i<=a.from)&&d.push(qN.range(r,i)),d.length>t.maxMatches))return Wt.Decoration.none}}return Wt.Decoration.set(d)}},{decorations:e=>e.decorations}),qO=Wt.EditorView.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),qP=We.Facet.define({combine:e=>(0,We.combineConfig)(e,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new q3(e),scrollToMatch:e=>Wt.EditorView.scrollIntoView(e)})});class qA{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||function(e){try{return new RegExp(e,qv),!0}catch(e){return!1}}(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!e.wholeWord,this.test=e.test}unquote(e){return this.literal?e:e.replace(/\\([nrt\\])/g,(e,t)=>"n"==t?"\n":"r"==t?"\r":"t"==t?" ":"\\")}eq(e){return this.search==e.search&&this.replace==e.replace&&this.caseSensitive==e.caseSensitive&&this.regexp==e.regexp&&this.wholeWord==e.wholeWord&&this.test==e.test}create(){return this.regexp?new qL(this):new qT(this)}getCursor(e,t=0,n){let r=e.doc?e:We.EditorState.create({doc:e});return null==n&&(n=r.doc.length),this.regexp?qD(this,r,t,n):qz(this,r,t,n)}}class qI{constructor(e){this.spec=e}}function qz(e,t,n,r){var a,i,o,l;let s;return e.wholeWord&&(o=t.doc,l=t.charCategorizer(t.selection.main.head),s=(e,t,n,r)=>((r>e||r+n.length<t)&&(r=Math.max(0,e-2),n=o.sliceString(r,Math.min(o.length,t+2))),(l(q_(n,e-r))!=We.CharCategory.Word||l(qR(n,e-r))!=We.CharCategory.Word)&&(l(qR(n,t-r))!=We.CharCategory.Word||l(q_(n,t-r))!=We.CharCategory.Word))),e.test&&(a=e.test,i=s,s=(e,n,r,o)=>(!i||!!i(e,n,r,o))&&a(e>=o&&n<=o+r.length?r.slice(e-o,n-o):t.doc.sliceString(e,n),t,e,n)),new qm(t.doc,e.unquoted,n,r,e.caseSensitive?void 0:e=>e.toLowerCase(),s)}class qT extends qI{constructor(e){super(e)}nextMatch(e,t,n){let r=qz(this.spec,e,n,e.doc.length).nextOverlapping();if(r.done){let n=Math.min(e.doc.length,t+this.spec.unquoted.length);r=qz(this.spec,e,0,n).nextOverlapping()}return r.done||r.value.from==t&&r.value.to==n?null:r.value}prevMatchInRange(e,t,n){for(let r=n;;){let n=Math.max(t,r-1e4-this.spec.unquoted.length),a=qz(this.spec,e,n,r),i=null;for(;!a.nextOverlapping().done;)i=a.value;if(i)return i;if(n==t)return null;r-=1e4}}prevMatch(e,t,n){let r=this.prevMatchInRange(e,0,t);return r||(r=this.prevMatchInRange(e,Math.max(0,n-this.spec.unquoted.length),e.doc.length)),r&&(r.from!=t||r.to!=n)?r:null}getReplacement(e){return this.spec.unquote(this.spec.replace)}matchAll(e,t){let n=qz(this.spec,e,0,e.doc.length),r=[];for(;!n.next().done;){if(r.length>=t)return null;r.push(n.value)}return r}highlight(e,t,n,r){let a=qz(this.spec,e,Math.max(0,t-this.spec.unquoted.length),Math.min(n+this.spec.unquoted.length,e.doc.length));for(;!a.next().done;)r(a.value.from,a.value.to)}}function qD(e,t,n,r){var a,i,o;let l;return e.wholeWord&&(o=t.charCategorizer(t.selection.main.head),l=(e,t,n)=>!n[0].length||(o(q_(n.input,n.index))!=We.CharCategory.Word||o(qR(n.input,n.index))!=We.CharCategory.Word)&&(o(qR(n.input,n.index+n[0].length))!=We.CharCategory.Word||o(q_(n.input,n.index+n[0].length))!=We.CharCategory.Word)),e.test&&(a=e.test,i=l,l=(e,n,r)=>(!i||i(e,n,r))&&a(r[0],t,e,n)),new qx(t.doc,e.search,{ignoreCase:!e.caseSensitive,test:l},n,r)}function q_(e,t){return e.slice((0,We.findClusterBreak)(e,t,!1),t)}function qR(e,t){return e.slice(t,(0,We.findClusterBreak)(e,t))}class qL extends qI{nextMatch(e,t,n){let r=qD(this.spec,e,n,e.doc.length).next();return r.done&&(r=qD(this.spec,e,0,t).next()),r.done?null:r.value}prevMatchInRange(e,t,n){for(let r=1;;r++){let a=Math.max(t,n-1e4*r),i=qD(this.spec,e,a,n),o=null;for(;!i.next().done;)o=i.value;if(o&&(a==t||o.from>a+10))return o;if(a==t)return null}}prevMatch(e,t,n){return this.prevMatchInRange(e,0,t)||this.prevMatchInRange(e,n,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g,(t,n)=>{if("&"==n)return e.match[0];if("$"==n)return"$";for(let t=n.length;t>0;t--){let r=+n.slice(0,t);if(r>0&&r<e.match.length)return e.match[r]+n.slice(t)}return t})}matchAll(e,t){let n=qD(this.spec,e,0,e.doc.length),r=[];for(;!n.next().done;){if(r.length>=t)return null;r.push(n.value)}return r}highlight(e,t,n,r){let a=qD(this.spec,e,Math.max(0,t-250),Math.min(n+250,e.doc.length));for(;!a.next().done;)r(a.value.from,a.value.to)}}let q$=We.StateEffect.define(),qF=We.StateEffect.define(),qB=We.StateField.define({create:e=>new qV(qQ(e).create(),null),update(e,t){for(let n of t.effects)n.is(q$)?e=new qV(n.value.create(),e.panel):n.is(qF)&&(e=new qV(e.query,n.value?qJ:null));return e},provide:e=>Wt.showPanel.from(e,e=>e.panel)});class qV{constructor(e,t){this.query=e,this.panel=t}}let qH=Wt.Decoration.mark({class:"cm-searchMatch"}),qU=Wt.Decoration.mark({class:"cm-searchMatch cm-searchMatch-selected"}),qW=Wt.ViewPlugin.fromClass(class{constructor(e){this.view=e,this.decorations=this.highlight(e.state.field(qB))}update(e){let t=e.state.field(qB);(t!=e.startState.field(qB)||e.docChanged||e.selectionSet||e.viewportChanged)&&(this.decorations=this.highlight(t))}highlight({query:e,panel:t}){if(!t||!e.spec.valid)return Wt.Decoration.none;let{view:n}=this,r=new We.RangeSetBuilder;for(let t=0,a=n.visibleRanges,i=a.length;t<i;t++){let{from:o,to:l}=a[t];for(;t<i-1&&l>a[t+1].from-500;)l=a[++t].to;e.highlight(n.state,o,l,(e,t)=>{let a=n.state.selection.ranges.some(n=>n.from==e&&n.to==t);r.add(e,t,a?qU:qH)})}return r.finish()}},{decorations:e=>e.decorations});function qq(e){return t=>{let n=t.state.field(qB,!1);return n&&n.query.spec.valid?e(t,n):q2(t)}}let qK=qq((e,{query:t})=>{let{to:n}=e.state.selection.main,r=t.nextMatch(e.state,n,n);if(!r)return!1;let a=We.EditorSelection.single(r.from,r.to),i=e.state.facet(qP);return e.dispatch({selection:a,effects:[q7(e,r),i.scrollToMatch(a.main,e)],userEvent:"select.search"}),q1(e),!0}),qG=qq((e,{query:t})=>{let{state:n}=e,{from:r}=n.selection.main,a=t.prevMatch(n,r,r);if(!a)return!1;let i=We.EditorSelection.single(a.from,a.to),o=e.state.facet(qP);return e.dispatch({selection:i,effects:[q7(e,a),o.scrollToMatch(i.main,e)],userEvent:"select.search"}),q1(e),!0}),qX=qq((e,{query:t})=>{let n=t.matchAll(e.state,1e3);return!!n&&!!n.length&&(e.dispatch({selection:We.EditorSelection.create(n.map(e=>We.EditorSelection.range(e.from,e.to))),userEvent:"select.search.matches"}),!0)}),qY=qq((e,{query:t})=>{let{state:n}=e,{from:r,to:a}=n.selection.main;if(n.readOnly)return!1;let i=t.nextMatch(n,r,r);if(!i)return!1;let o=i,l=[],s,c,d=[];o.precise?o.from==r&&o.to==a&&(c=n.toText(t.getReplacement(o)),l.push({from:o.from,to:o.to,insert:c}),d.push(Wt.EditorView.announce.of(n.phrase("replaced match on line $",n.doc.lineAt(r).number)+"."))):o=t.nextMatch(n,o.from,o.to);let u=e.state.changes(l);return o&&(s=We.EditorSelection.single(o.from,o.to).map(u),d.push(q7(e,o)),d.push(n.facet(qP).scrollToMatch(s.main,e))),e.dispatch({changes:u,selection:s,effects:d,userEvent:"input.replace"}),!0}),qZ=qq((e,{query:t})=>{if(e.state.readOnly)return!1;let n=[];for(let r of t.matchAll(e.state,1e9)){let{from:e,to:a,precise:i}=r;i&&n.push({from:e,to:a,insert:t.getReplacement(r)})}if(!n.length)return!1;let r=e.state.phrase("replaced $ matches",n.length)+".";return e.dispatch({changes:n,effects:Wt.EditorView.announce.of(r),userEvent:"input.replace.all"}),!0});function qJ(e){return e.state.facet(qP).createPanel(e)}function qQ(e,t){var n,r,a,i,o;let l=e.selection.main,s=l.empty||l.to>l.from+100?"":e.sliceDoc(l.from,l.to);if(t&&!s)return t;let c=e.facet(qP);return new qA({search:(null!=(n=null==t?void 0:t.literal)?n:c.literal)?s:s.replace(/\n/g,"\\n"),caseSensitive:null!=(r=null==t?void 0:t.caseSensitive)?r:c.caseSensitive,literal:null!=(a=null==t?void 0:t.literal)?a:c.literal,regexp:null!=(i=null==t?void 0:t.regexp)?i:c.regexp,wholeWord:null!=(o=null==t?void 0:t.wholeWord)?o:c.wholeWord})}function q0(e){let t=(0,Wt.getPanel)(e,qJ);return t&&t.dom.querySelector("[main-field]")}function q1(e){let t=q0(e);t&&t==e.root.activeElement&&t.select()}let q2=e=>{let t=e.state.field(qB,!1);if(t&&t.panel){let n=q0(e);if(n&&n!=e.root.activeElement){let r=qQ(e.state,t.query.spec);r.valid&&e.dispatch({effects:q$.of(r)}),n.focus(),n.select()}}else e.dispatch({effects:[qF.of(!0),t?q$.of(qQ(e.state,t.query.spec)):We.StateEffect.appendConfig.of(Ke)]});return!0},q5=e=>{let t=e.state.field(qB,!1);if(!t||!t.panel)return!1;let n=(0,Wt.getPanel)(e,qJ);return n&&n.dom.contains(e.root.activeElement)&&e.focus(),e.dispatch({effects:qF.of(!1)}),!0},q4=[{key:"Mod-f",run:q2,scope:"editor search-panel"},{key:"F3",run:qK,shift:qG,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:qK,shift:qG,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:q5,scope:"editor search-panel"},{key:"Mod-Shift-l",run:({state:e,dispatch:t})=>{let n=e.selection;if(n.ranges.length>1||n.main.empty)return!1;let{from:r,to:a}=n.main,i=[],o=0;for(let t=new qm(e.doc,e.sliceDoc(r,a));!t.next().done;){if(i.length>1e3)return!1;t.value.from==r&&(o=i.length),i.push(We.EditorSelection.range(t.value.from,t.value.to))}return t(e.update({selection:We.EditorSelection.create(i,o),userEvent:"select.search.matches"})),!0}},{key:"Mod-Alt-g",run:e=>{let{state:t}=e,n=String(t.doc.lineAt(e.state.selection.main.head).number),{close:r,result:a}=(0,Wt.showDialog)(e,{label:t.phrase("Go to line"),input:{type:"text",name:"line",value:n},focus:!0,submitLabel:t.phrase("go")});return a.then(n=>{let a=n&&/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(n.elements.line.value);if(!a)return void e.dispatch({effects:r});let i=t.doc.lineAt(t.selection.main.head),[,o,l,s,c]=a,d=s?+s.slice(1):0,u=l?+l:i.number;if(l&&c){let e=u/100;o&&(e=e*("-"==o?-1:1)+i.number/t.doc.lines),u=Math.round(t.doc.lines*e)}else l&&o&&(u=u*("-"==o?-1:1)+i.number);let f=t.doc.line(Math.max(1,Math.min(t.doc.lines,u))),h=We.EditorSelection.cursor(f.from+Math.max(0,Math.min(d,f.length)));e.dispatch({effects:[r,Wt.EditorView.scrollIntoView(h.from,{y:"center"})],selection:h})}),!0}},{key:"Mod-d",run:({state:e,dispatch:t})=>{let{ranges:n}=e.selection;if(n.some(e=>e.from===e.to))return(({state:e,dispatch:t})=>{let{selection:n}=e,r=We.EditorSelection.create(n.ranges.map(t=>e.wordAt(t.head)||We.EditorSelection.cursor(t.head)),n.mainIndex);return!r.eq(n)&&(t(e.update({selection:r})),!0)})({state:e,dispatch:t});let r=e.sliceDoc(n[0].from,n[0].to);if(e.selection.ranges.some(t=>e.sliceDoc(t.from,t.to)!=r))return!1;let a=function(e,t){let{main:n,ranges:r}=e.selection,a=e.wordAt(n.head),i=a&&a.from==n.from&&a.to==n.to;for(let n=!1,a=new qm(e.doc,t,r[r.length-1].to);;)if(a.next(),a.done){if(n)return null;a=new qm(e.doc,t,0,Math.max(0,r[r.length-1].from-1)),n=!0}else{if(n&&r.some(e=>e.from==a.value.from))continue;if(i){let t=e.wordAt(a.value.from);if(!t||t.from!=a.value.from||t.to!=a.value.to)continue}return a.value}}(e,r);return!!a&&(t(e.update({selection:e.selection.addRange(We.EditorSelection.range(a.from,a.to),!1),effects:Wt.EditorView.scrollIntoView(a.to)})),!0)},preventDefault:!0}];class q3{constructor(e){this.view=e;let t=this.query=e.state.field(qB).query.spec;function n(e,t,n){return(0,qh.default)("button",{class:"cm-button",name:e,onclick:t,type:"button"},n)}this.commit=this.commit.bind(this),this.searchField=(0,qh.default)("input",{value:t.search,placeholder:q6(e,"Find"),"aria-label":q6(e,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=(0,qh.default)("input",{value:t.replace,placeholder:q6(e,"Replace"),"aria-label":q6(e,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=(0,qh.default)("input",{type:"checkbox",name:"case",form:"",checked:t.caseSensitive,onchange:this.commit}),this.reField=(0,qh.default)("input",{type:"checkbox",name:"re",form:"",checked:t.regexp,onchange:this.commit}),this.wordField=(0,qh.default)("input",{type:"checkbox",name:"word",form:"",checked:t.wholeWord,onchange:this.commit}),this.dom=(0,qh.default)("div",{onkeydown:e=>this.keydown(e),class:"cm-search"},[this.searchField,n("next",()=>qK(e),[q6(e,"next")]),n("prev",()=>qG(e),[q6(e,"previous")]),n("select",()=>qX(e),[q6(e,"all")]),(0,qh.default)("label",null,[this.caseField,q6(e,"match case")]),(0,qh.default)("label",null,[this.reField,q6(e,"regexp")]),(0,qh.default)("label",null,[this.wordField,q6(e,"by word")]),...e.state.readOnly?[]:[(0,qh.default)("br"),this.replaceField,n("replace",()=>qY(e),[q6(e,"replace")]),n("replaceAll",()=>qZ(e),[q6(e,"replace all")])],(0,qh.default)("button",{name:"close",onclick:()=>q5(e),"aria-label":q6(e,"close"),type:"button"},["×"])])}commit(){let e=new qA({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:q$.of(e)}))}keydown(e){(0,Wt.runScopeHandlers)(this.view,e,"search-panel")?e.preventDefault():13==e.keyCode&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?qG:qK)(this.view)):13==e.keyCode&&e.target==this.replaceField&&(e.preventDefault(),qY(this.view))}update(e){for(let t of e.transactions)for(let e of t.effects)e.is(q$)&&!e.value.eq(this.query)&&this.setQuery(e.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(qP).top}}function q6(e,t){return e.state.phrase(t)}let q8=/[\s\.,:;?!]/;function q7(e,{from:t,to:n}){let r=e.state.doc.lineAt(t),a=e.state.doc.lineAt(n).to,i=Math.max(r.from,t-30),o=Math.min(a,n+30),l=e.state.sliceDoc(i,o);if(i!=r.from){for(let e=0;e<30;e++)if(!q8.test(l[e+1])&&q8.test(l[e])){l=l.slice(e);break}}if(o!=a){for(let e=l.length-1;e>l.length-30;e--)if(!q8.test(l[e-1])&&q8.test(l[e])){l=l.slice(0,e);break}}return Wt.EditorView.announce.of(`${e.state.phrase("current match")}. ${l} ${e.state.phrase("on line")} ${r.number}.`)}let q9=Wt.EditorView.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"}}),Ke=[qB,We.Prec.low(qW),q9];var Kt=e.i(62291),Kn=Wt;class Kr{constructor(e,t,n){this.from=e,this.to=t,this.diagnostic=n}}class Ka{constructor(e,t,n){this.diagnostics=e,this.panel=t,this.selected=n}static init(e,t,n){let r=n.facet(Km).markerFilter;r&&(e=r(e,n));let a=e.slice().sort((e,t)=>e.from-t.from||e.to-t.to),i=new We.RangeSetBuilder,o=[],l=0,s=n.doc.iter(),c=0,d=n.doc.length;for(let e=0;;){let t,n,r=e==a.length?null:a[e];if(!r&&!o.length)break;if(o.length)t=l,n=o.reduce((e,t)=>Math.min(e,t.to),r&&r.from>t?r.from:1e8);else{if((t=r.from)>d)break;n=r.to,o.push(r),e++}for(;e<a.length;){let r=a[e];if(r.from==t&&(r.to>r.from||r.to==t))o.push(r),e++,n=Math.min(r.to,n);else{n=Math.min(r.from,n);break}}n=Math.min(n,d);let u=!1;if(o.some(e=>e.from==t&&(e.to==n||n==d))&&!(u=t==n)&&n-t<10){let e=t-(c+s.value.length);e>0&&(s.next(e),c=t);for(let e=t;;){if(e>=n){u=!0;break}if(!s.lineBreak&&c+s.value.length>e)break;e=c+s.value.length,c+=s.value.length,s.next()}}let f=KS(o);if(u)i.add(t,t,Kn.Decoration.widget({widget:new Ky(f),diagnostics:o.slice()}));else{let e=o.reduce((e,t)=>t.markClass?e+" "+t.markClass:e,"");i.add(t,n,Kn.Decoration.mark({class:"cm-lintRange cm-lintRange-"+f+e,diagnostics:o.slice(),inclusiveEnd:o.some(e=>e.to>n)}))}if((l=n)==d)break;for(let e=0;e<o.length;e++)o[e].to<=l&&o.splice(e--,1)}let u=i.finish();return new Ka(u,t,Ki(u))}}function Ki(e,t=null,n=0){let r=null;return e.between(n,1e9,(e,n,{spec:a})=>{if(!(t&&0>a.diagnostics.indexOf(t)))if(r){if(0>a.diagnostics.indexOf(r.diagnostic))return!1;r=new Kr(r.from,n,r.diagnostic)}else r=new Kr(e,n,t||a.diagnostics[0])}),r}function Ko(e,t){let n=t.pos,r=t.end||n,a=e.state.facet(Km).hideOn(e,n,r);if(null!=a)return a;let i=e.startState.doc.lineAt(t.pos);return!!(e.effects.some(e=>e.is(Kl))||e.changes.touchesRange(i.from,Math.max(i.to,r)))}let Kl=We.StateEffect.define(),Ks=We.StateEffect.define(),Kc=We.StateEffect.define(),Kd=We.StateField.define({create:()=>new Ka(Kn.Decoration.none,null,null),update(e,t){if(t.docChanged&&e.diagnostics.size){let n=e.diagnostics.map(t.changes),r=null,a=e.panel;if(e.selected){let a=t.changes.mapPos(e.selected.from,1);r=Ki(n,e.selected.diagnostic,a)||Ki(n,null,a)}!n.size&&a&&t.state.facet(Km).autoPanel&&(a=null),e=new Ka(n,a,r)}for(let n of t.effects)if(n.is(Kl)){let r=t.state.facet(Km).autoPanel?n.value.length?Kw.open:null:e.panel;e=Ka.init(n.value,r,t.state)}else n.is(Ks)?e=new Ka(e.diagnostics,n.value?Kw.open:null,e.selected):n.is(Kc)&&(e=new Ka(e.diagnostics,e.panel,n.value));return e},provide:e=>[Kn.showPanel.from(e,e=>e.panel),Kn.EditorView.decorations.from(e,e=>e.diagnostics)]}),Ku=Kn.Decoration.mark({class:"cm-lintRange cm-lintRange-active"});function Kf(e,t){return(0,qh.default)("ul",{class:"cm-tooltip-lint"},t.map(t=>Kx(e,t,!1)))}let Kh=e=>{let t=e.state.field(Kd,!1);return!!t&&!!t.panel&&(e.dispatch({effects:Ks.of(!1)}),!0)},Kp=[{key:"Mod-Shift-m",run:e=>{var t,n;let r=e.state.field(Kd,!1);r&&r.panel||e.dispatch({effects:(t=e.state,n=[Ks.of(!0)],t.field(Kd,!1)?n:n.concat(We.StateEffect.appendConfig.of(KE)))});let a=(0,Kn.getPanel)(e,Kw.open);return a&&a.dom.querySelector(".cm-panel-lint ul").focus(),!0},preventDefault:!0},{key:"F8",run:e=>{let t=e.state.field(Kd,!1);if(!t)return!1;let n=e.state.selection.main,r=Ki(t.diagnostics,null,n.to+1);return(!!r||!!(r=Ki(t.diagnostics,null,0))&&(r.from!=n.from||r.to!=n.to))&&(e.dispatch({selection:{anchor:r.from,head:r.to},scrollIntoView:!0}),(0,Kn.activateHover)(e,r.from,1,{tooltip:KM,until:e=>e.docChanged||e.newSelection.main.head<r.from||e.newSelection.main.head>r.to}),!0)}}],Km=We.Facet.define({combine:e=>({sources:e.map(e=>e.source).filter(e=>null!=e),...(0,We.combineConfig)(e.map(e=>e.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:()=>null},{delay:Math.max,markerFilter:Kg,tooltipFilter:Kg,needsRefresh:(e,t)=>e?t?n=>e(n)||t(n):e:t,hideOn:(e,t)=>e?t?(n,r,a)=>e(n,r,a)||t(n,r,a):e:t,autoPanel:(e,t)=>e||t})})});function Kg(e,t){return e?t?(n,r)=>t(e(n,r),r):e:t}function Kv(e){let t=[];if(e)n:for(let{name:n}of e){for(let e=0;e<n.length;e++){let r=n[e];if(/[a-zA-Z]/.test(r)&&!t.some(e=>e.toLowerCase()==r.toLowerCase())){t.push(r);continue n}}t.push("")}return t}function Kx(e,t,n){var r;let a=n?Kv(t.actions):[];return(0,qh.default)("li",{class:"cm-diagnostic cm-diagnostic-"+t.severity},(0,qh.default)("span",{class:"cm-diagnosticText"},t.renderMessage?t.renderMessage(e):t.message),null==(r=t.actions)?void 0:r.map((n,r)=>{let i=!1,o=r=>{if(r.preventDefault(),i)return;i=!0;let a=Ki(e.state.field(Kd).diagnostics,t);a&&n.apply(e,a.from,a.to)},{name:l}=n,s=a[r]?l.indexOf(a[r]):-1,c=s<0?l:[l.slice(0,s),(0,qh.default)("u",l.slice(s,s+1)),l.slice(s+1)],d=n.markClass?" "+n.markClass:"";return(0,qh.default)("button",{type:"button",class:"cm-diagnosticAction"+d,onclick:o,onmousedown:o,"aria-label":` Action: ${l}${s<0?"":` (access key "${a[r]})"`}.`},c)}),t.source&&(0,qh.default)("div",{class:"cm-diagnosticSource"},t.source))}class Ky extends Kn.WidgetType{constructor(e){super(),this.sev=e}eq(e){return e.sev==this.sev}toDOM(){return(0,qh.default)("span",{class:"cm-lintPoint cm-lintPoint-"+this.sev})}}class Kb{constructor(e,t){this.diagnostic=t,this.id="item_"+Math.floor(0xffffffff*Math.random()).toString(16),this.dom=Kx(e,t,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}}class Kw{constructor(e){this.view=e,this.items=[];let t=t=>{if(!t.ctrlKey&&!t.altKey&&!t.metaKey){if(27==t.keyCode)Kh(this.view),this.view.focus();else if(38==t.keyCode||33==t.keyCode)this.moveSelection((this.selectedIndex-1+this.items.length)%this.items.length);else if(40==t.keyCode||34==t.keyCode)this.moveSelection((this.selectedIndex+1)%this.items.length);else if(36==t.keyCode)this.moveSelection(0);else if(35==t.keyCode)this.moveSelection(this.items.length-1);else if(13==t.keyCode)this.view.focus();else{if(!(t.keyCode>=65)||!(t.keyCode<=90)||!(this.selectedIndex>=0))return;let{diagnostic:n}=this.items[this.selectedIndex],r=Kv(n.actions);for(let a=0;a<r.length;a++)if(r[a].toUpperCase().charCodeAt(0)==t.keyCode){let t=Ki(this.view.state.field(Kd).diagnostics,n);t&&n.actions[a].apply(e,t.from,t.to)}}t.preventDefault()}},n=e=>{for(let t=0;t<this.items.length;t++)this.items[t].dom.contains(e.target)&&this.moveSelection(t)};this.list=(0,qh.default)("ul",{tabIndex:0,role:"listbox","aria-label":this.view.state.phrase("Diagnostics"),onkeydown:t,onclick:n}),this.dom=(0,qh.default)("div",{class:"cm-panel-lint"},this.list,(0,qh.default)("button",{type:"button",name:"close","aria-label":this.view.state.phrase("close"),onclick:()=>Kh(this.view)},"×")),this.update()}get selectedIndex(){let e=this.view.state.field(Kd).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(Kd),n=0,r=!1,a=null,i=new Set;for(e.between(0,this.view.state.doc.length,(e,o,{spec:l})=>{for(let e of l.diagnostics){if(i.has(e))continue;i.add(e);let o=-1,l;for(let t=n;t<this.items.length;t++)if(this.items[t].diagnostic==e){o=t;break}o<0?(l=new Kb(this.view,e),this.items.splice(n,0,l),r=!0):(l=this.items[o],o>n&&(this.items.splice(n,o-n),r=!0)),t&&l.diagnostic==t.diagnostic?l.dom.hasAttribute("aria-selected")||(l.dom.setAttribute("aria-selected","true"),a=l):l.dom.hasAttribute("aria-selected")&&l.dom.removeAttribute("aria-selected"),n++}});n<this.items.length&&!(1==this.items.length&&this.items[0].diagnostic.from<0);)r=!0,this.items.pop();0==this.items.length&&(this.items.push(new Kb(this.view,{from:-1,to:-1,severity:"info",message:this.view.state.phrase("No diagnostics")})),r=!0),a?(this.list.setAttribute("aria-activedescendant",a.id),this.view.requestMeasure({key:this,read:()=>({sel:a.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:({sel:e,panel:t})=>{let n=t.height/this.list.offsetHeight;e.top<t.top?this.list.scrollTop-=(t.top-e.top)/n:e.bottom>t.bottom&&(this.list.scrollTop+=(e.bottom-t.bottom)/n)}})):this.selectedIndex<0&&this.list.removeAttribute("aria-activedescendant"),r&&this.sync()}sync(){let e=this.list.firstChild;function t(){let t=e;e=t.nextSibling,t.remove()}for(let n of this.items)if(n.dom.parentNode==this.list){for(;e!=n.dom;)t();e=n.dom.nextSibling}else this.list.insertBefore(n.dom,e);for(;e;)t()}moveSelection(e){if(this.selectedIndex<0)return;let t=Ki(this.view.state.field(Kd).diagnostics,this.items[e].diagnostic);t&&this.view.dispatch({selection:{anchor:t.from,head:t.to},scrollIntoView:!0,effects:Kc.of(t)})}static open(e){return new Kw(e)}}function Kj(e){return function(e,t='viewBox="0 0 40 40"'){return`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" ${t}>${encodeURIComponent(e)}</svg>')`}(`<path d="m0 2.5 l2 -1.5 l1 0 l2 1.5 l1 0" stroke="${e}" fill="none" stroke-width=".7"/>`,'width="6" height="3"')}let Kk=Kn.EditorView.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:Kj("#f11")},".cm-lintRange-warning":{backgroundImage:Kj("orange")},".cm-lintRange-info":{backgroundImage:Kj("#999")},".cm-lintRange-hint":{backgroundImage:Kj("#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}},"&dark .cm-lintRange-active":{backgroundColor:"#86714a80"},"&dark .cm-panel.cm-panel-lint ul":{"& [aria-selected]":{backgroundColor:"#2e343e"}}});function KS(e){let t="hint",n=1;for(let a of e){var r;let e="error"==(r=a.severity)?4:"warning"==r?3:"info"==r?2:1;e>n&&(n=e,t=a.severity)}return t}Kn.GutterMarker;let KN=We.StateEffect.define(),KC=We.StateField.define({create:()=>null,update:(e,t)=>(e&&t.docChanged&&(e=Ko(t,e)?null:{...e,pos:t.changes.mapPos(e.pos)}),t.effects.reduce((e,t)=>t.is(KN)?t.value:e,e)),provide:e=>Kn.showTooltip.from(e)}),KM=(0,Kn.hoverTooltip)(function(e,t,n){let{diagnostics:r}=e.state.field(Kd),a,i=-1,o=-1;r.between(t-(n<0),t+ +(n>0),(e,r,{spec:l})=>{if(t>=e&&t<=r&&(e==r||(t>e||n>0)&&(t<r||n<0)))return a=l.diagnostics,i=e,o=r,!1});let l=e.state.facet(Km).tooltipFilter;return(a&&l&&(a=l(a,e.state)),a)?{pos:i,end:o,above:e.state.doc.lineAt(i).to<o,create:()=>({dom:Kf(e,a)})}:null},{hideOn:Ko}),KE=[Kd,Kn.EditorView.decorations.compute([Kd],e=>{let{selected:t,panel:n}=e.field(Kd);return t&&n&&t.from!=t.to?Kn.Decoration.set([Ku.range(t.from,t.to)]):Kn.Decoration.none}),KM,Kk],KO=We.Facet.define({combine:e=>(0,We.combineConfig)(e,{hoverTime:300,markerFilter:null,tooltipFilter:null})}),KP=[(0,Wt.lineNumbers)(),(0,Wt.highlightActiveLineGutter)(),(0,Wt.highlightSpecialChars)(),function(e={}){return[Wh,Wf.of(e),Wt.EditorView.domEventHandlers({beforeinput(e,t){let n="historyUndo"==e.inputType?Wm:"historyRedo"==e.inputType?Wg:null;return!!n&&(e.preventDefault(),n(t))}})]}(),(0,U6.foldGutter)(),(0,Wt.drawSelection)(),(0,Wt.dropCursor)(),We.EditorState.allowMultipleSelections.of(!0),(0,U6.indentOnInput)(),(0,U6.syntaxHighlighting)(U6.defaultHighlightStyle,{fallback:!0}),(0,U6.bracketMatching)(),(0,Kt.closeBrackets)(),(0,Kt.autocompletion)(),(0,Wt.rectangularSelection)(),(0,Wt.crosshairCursor)(),(0,Wt.highlightActiveLine)(),[qO,qE],Wt.keymap.of([...Kt.closeBracketsKeymap,...qf,...q4,{key:"Mod-z",run:Wm,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:Wg,preventDefault:!0},{linux:"Ctrl-Shift-z",run:Wg,preventDefault:!0},{key:"Mod-u",run:Wv,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:Wx,preventDefault:!0},...U6.foldKeymap,...Kt.completionKeymap,...Kp])];var KA=e.i(99242);let KI=(0,ek.default)("binary",[["rect",{x:"14",y:"14",width:"4",height:"6",rx:"2",key:"p02svl"}],["rect",{x:"6",y:"4",width:"4",height:"6",rx:"2",key:"xm4xkj"}],["path",{d:"M6 20h4",key:"1i6q5t"}],["path",{d:"M14 10h4",key:"ru81e7"}],["path",{d:"M6 14h2v6",key:"16z9wg"}],["path",{d:"M14 4h2v6",key:"1idq9u"}]]),Kz=(0,ek.default)("pen-line",[["path",{d:"M13 21h8",key:"1jsn5i"}],["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"}]]),KT=(0,ek.default)("history",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]]),KD=(0,ek.default)("image",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]),K_=(0,ek.default)("square-play",[["rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",key:"h1oib"}],["path",{d:"M9 9.003a1 1 0 0 1 1.517-.859l4.997 2.997a1 1 0 0 1 0 1.718l-4.997 2.997A1 1 0 0 1 9 14.996z",key:"kmsa83"}]]),KR=(0,ek.default)("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"}]]),KL={review:"Review",edit:"Edit",view:"View",code:"Code",preview:"Preview",hex:"Hex",actions:"File view options",save:"Save",saving:"Saving",binaryTitle:"Binary content is not rendered",binaryDescription:"This file is binary or too large to decode safely. Render it only when you explicitly need to inspect the raw bytes.",renderAnyway:"Render anyway",unsupportedPreview:"No preview renderer is available for this file.",noContent:"No file content.",pathSeparator:"/",history:"History"};function K$(e){let t=e.name||e.path||"",n=/\.([^.\\/]+)$/.exec(t);return n?.[1]?.toLowerCase()}function KF(e){if(e.kind)return e.kind;let t=e.mimeType?.toLowerCase()??"",n=K$(e);return t.startsWith("image/")?"svg"===n?"svg":"image":t.startsWith("video/")?"video":t.includes("html")?"html":t.includes("markdown")?"markdown":t.includes("json")?"code":t.startsWith("text/")?"text":"svg"===n?"svg":"html"===n||"htm"===n?"html":"md"===n||"mdx"===n?"markdown":["png","jpg","jpeg","gif","webp","avif"].includes(n??"")?"image":["mp4","webm","mov","m4v","ogg"].includes(n??"")?"video":["zip","tar","gz","7z","rar","exe","dll","bin","wasm","pdf","psd"].includes(n??"")?"binary":"code"}async function KB(e){let t=function(e){for(let t of[(e.language??K$(e)??"text").toLowerCase(),e.mimeType?.toLowerCase()]){if(!t)continue;let e=U6.LanguageDescription.matchLanguageName(U9,t,!0);if(e)return e}for(let t of[e.name,e.path]){if(!t)continue;let e=U6.LanguageDescription.matchFilename(U9,t);if(e)return e}}(e);if(!t)return[];try{return await t.load()}catch{return[]}}function KV(e){if(e&&!(e<=0))return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(1)} MB`}function KH(e){let t=KF(e);return"binary"===t?["hex"]:"image"===t||"video"===t?["preview"]:["html","markdown","richtext","svg"].includes(t)?["code","preview"]:["code"]}let KU=U6.HighlightStyle.define([{tag:KA.tags.comment,color:"var(--vtl-cm-comment)",fontStyle:"italic"},{tag:[KA.tags.keyword,KA.tags.modifier,KA.tags.operatorKeyword],color:"var(--vtl-cm-keyword)"},{tag:[KA.tags.atom,KA.tags.bool,KA.tags.null],color:"var(--vtl-cm-constant)"},{tag:[KA.tags.number,KA.tags.integer,KA.tags.float],color:"var(--vtl-cm-number)"},{tag:[KA.tags.string,KA.tags.special(KA.tags.string),KA.tags.regexp],color:"var(--vtl-cm-string)"},{tag:[KA.tags.variableName,KA.tags.self,KA.tags.propertyName],color:"var(--vtl-cm-variable)"},{tag:[KA.tags.definition(KA.tags.variableName),KA.tags.function(KA.tags.variableName)],color:"var(--vtl-cm-function)"},{tag:[KA.tags.className,KA.tags.typeName,KA.tags.namespace],color:"var(--vtl-cm-type)"},{tag:[KA.tags.tagName,KA.tags.heading],color:"var(--vtl-cm-tag)"},{tag:KA.tags.attributeName,color:"var(--vtl-cm-attribute)"},{tag:[KA.tags.attributeValue,KA.tags.link],color:"var(--vtl-cm-string)"},{tag:[KA.tags.punctuation,KA.tags.separator,KA.tags.bracket],color:"var(--vtl-cm-punctuation)"},{tag:[KA.tags.invalid],color:"var(--vtl-cm-invalid)"}]),KW=Wt.EditorView.theme({"&":{height:"100%",backgroundColor:"var(--vtl-cm-background)",color:"var(--vtl-cm-foreground)",fontSize:"var(--font-size-code)",lineHeight:"var(--vtl-cm-line-height)"},".cm-scroller":{fontFamily:"var(--font-family-mono)",height:"100%",overflow:"auto",scrollbarColor:"var(--border) transparent",scrollbarWidth:"thin"},".cm-scroller::-webkit-scrollbar":{width:"10px",height:"10px"},".cm-scroller::-webkit-scrollbar-track, .cm-scroller::-webkit-scrollbar-corner":{background:"transparent"},".cm-scroller::-webkit-scrollbar-thumb":{backgroundColor:"var(--border)",border:"3px solid transparent",borderRadius:"9999px",backgroundClip:"content-box"},".cm-content":{minHeight:"100%",caretColor:"var(--vtl-cm-foreground)",padding:"0 0"},".cm-gutters":{backgroundColor:"var(--vtl-cm-background)",color:"var(--vtl-cm-gutter-foreground)",borderRightColor:"transparent",left:"0",position:"sticky",zIndex:"2"},".cm-gutter":{minWidth:"2.5rem"},".cm-gutters .cm-foldGutter":{display:"none !important"},".cm-lineNumbers .cm-gutterElement":{minWidth:"2.5rem",padding:"0 0.5rem 0 0",textAlign:"right",lineHeight:"var(--vtl-cm-line-height)"},".cm-activeLine":{backgroundColor:"var(--vtl-cm-active-line)"},".cm-activeLineGutter":{backgroundColor:"var(--vtl-cm-background)",color:"var(--vtl-cm-foreground)"},".cm-selectionBackground, &.cm-focused .cm-selectionBackground":{backgroundColor:"var(--vtl-cm-selection) !important"},".cm-line ::selection, .cm-content ::selection, ::selection":{backgroundColor:"var(--vtl-cm-selection) !important",color:"var(--vtl-cm-selection-text) !important"},"&.cm-focused":{outline:"none"},".cm-cursor":{borderLeftColor:"var(--vtl-cm-foreground)"},".cm-line":{caretColor:"var(--vtl-cm-foreground)",lineHeight:"var(--vtl-cm-line-height)",minHeight:"var(--vtl-cm-line-height)",padding:"0 0.75rem"}});function Kq({value:e,file:t,readOnly:n,onValueChange:r,wrapLines:a,className:i}){let o=ew.useRef(null),l=ew.useRef(null),s=ew.useRef(e),c=ew.useRef(r);return ew.useEffect(()=>{c.current=r},[r]),ew.useEffect(()=>{s.current=e;let t=l.current;t&&t.state.doc.toString()!==e&&t.dispatch({changes:{from:0,to:t.state.doc.length,insert:e}})},[e]),ew.useEffect(()=>{let e=o.current;if(!e)return;let r=!1,i=new We.Compartment,d=new Wt.EditorView({parent:e,state:We.EditorState.create({doc:s.current,extensions:[KP,KW,We.EditorState.readOnly.of(n),Wt.EditorView.editable.of(!n),a?Wt.EditorView.lineWrapping:[],i.of([]),We.Prec.high((0,U6.syntaxHighlighting)(KU)),Wt.EditorView.updateListener.of(e=>{if(!e.docChanged)return;let t=e.state.doc.toString();s.current=t,c.current?.(t)})]})});return l.current=d,KB(t).then(e=>{r||l.current!==d||d.dispatch({effects:i.reconfigure(e)})}),()=>{r=!0,d.destroy(),l.current=null}},[t.kind,t.language,t.mimeType,t.name,t.path,t.readOnly,n,a]),(0,ey.jsx)("div",{"data-slot":"file-tab-code-editor",className:(0,eI.cn)("size-full overflow-hidden bg-background",i),ref:o})}function KK({value:e}){let t=e.split(/\n{2,}/);return(0,ey.jsx)("div",{className:"mx-auto grid w-full max-w-3xl gap-3 p-6",children:t.map((e,t)=>{let n=e.trim();return n?n.startsWith("### ")?(0,ey.jsx)("h3",{className:"ui-text-body font-semibold text-foreground",children:n.replace(/^###\s+/,"")},t):n.startsWith("## ")?(0,ey.jsx)("h2",{className:"text-lg font-semibold text-foreground",children:n.replace(/^##\s+/,"")},t):n.startsWith("# ")?(0,ey.jsx)("h1",{className:"text-xl font-semibold text-foreground",children:n.replace(/^#\s+/,"")},t):n.startsWith(">")?(0,ey.jsx)("blockquote",{className:"ui-text-body border-l-2 pl-3 text-muted-foreground",children:n.replace(/^>\s?/gm,"")},t):/^[-*]\s+/m.test(n)?(0,ey.jsx)("ul",{className:"ui-text-body grid list-disc gap-1 pl-5",children:n.split("\n").map(e=>(0,ey.jsx)("li",{children:e.replace(/^[-*]\s+/,"")},e))},t):n.startsWith("```")?(0,ey.jsx)("pre",{className:"overflow-auto rounded-lg border bg-code p-3 ui-text-code text-code-foreground",children:n.replace(/^```\w*\n?/,"").replace(/```$/,"")},t):(0,ey.jsx)("p",{className:"ui-text-body text-muted-foreground",children:n},t):null})})}function KG({title:e,value:t,className:n}){let r=function(){let[e,t]=ew.useState("light");return ew.useEffect(()=>{function e(){let e=document.documentElement.classList.contains("dark"),n=document.documentElement.classList.contains("light");e||n?t(e?"dark":"light"):t(window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light")}e();let n=new MutationObserver(e),r=window.matchMedia("(prefers-color-scheme: dark)");return n.observe(document.documentElement,{attributeFilter:["class"],attributes:!0}),r.addEventListener("change",e),()=>{n.disconnect(),r.removeEventListener("change",e)}},[]),e}(),a=ew.useMemo(()=>{let e,n;return e="dark"===r?"rgba(255, 255, 255, 0.16)":"#d8dee9",n=`<style data-vantaloom-scrollbar>