dimcode-web 0.1.0-alpha.6 → 0.1.0-alpha.7

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.
Files changed (69) hide show
  1. package/package.json +1 -1
  2. package/release-manifest.json +63 -63
  3. package/web/assets/{CodeBlockNode-dNQRJI7x.js → CodeBlockNode-BkKCYSZe.js} +2 -2
  4. package/web/assets/{PreCodeBlock-D6Vrdwmh.js → PreCodeBlock-CQiTyDCM.js} +1 -1
  5. package/web/assets/{Tooltip-ZLwIccO5.js → Tooltip-CU5QexXw.js} +1 -1
  6. package/web/assets/{arc-DPLvnfEZ.js → arc-8_yX_UH-.js} +1 -1
  7. package/web/assets/{architectureDiagram-3BPJPVTR-Dp46r6qo.js → architectureDiagram-3BPJPVTR-BcXLOfOI.js} +1 -1
  8. package/web/assets/{blockDiagram-GPEHLZMM-CNkSu7fi.js → blockDiagram-GPEHLZMM-CEKtakPc.js} +1 -1
  9. package/web/assets/{c4Diagram-AAUBKEIU-CQpKn4Qu.js → c4Diagram-AAUBKEIU-zZcpoKmv.js} +1 -1
  10. package/web/assets/channel-Bd1htsYX.js +1 -0
  11. package/web/assets/{chunk-2J33WTMH-UvZy7f86.js → chunk-2J33WTMH-dFnQn9hc.js} +1 -1
  12. package/web/assets/{chunk-4BX2VUAB-BeOeLZBs.js → chunk-4BX2VUAB-DjjPcYaV.js} +1 -1
  13. package/web/assets/{chunk-55IACEB6-BMehs481.js → chunk-55IACEB6-D_6EcDqZ.js} +1 -1
  14. package/web/assets/{chunk-727SXJPM-BRrHfUVX.js → chunk-727SXJPM-CI-3chrs.js} +1 -1
  15. package/web/assets/{chunk-AQP2D5EJ-DlFPEC70.js → chunk-AQP2D5EJ-DRgiAbw2.js} +1 -1
  16. package/web/assets/{chunk-FMBD7UC4-BmrNedMT.js → chunk-FMBD7UC4-BqKrwDA_.js} +1 -1
  17. package/web/assets/{chunk-ND2GUHAM-BktGAoA7.js → chunk-ND2GUHAM-B5cAPOB1.js} +1 -1
  18. package/web/assets/{chunk-QZHKN3VN-Cn0Ufw6g.js → chunk-QZHKN3VN-F4YC8_f_.js} +1 -1
  19. package/web/assets/classDiagram-4FO5ZUOK-BIb2luMM.js +1 -0
  20. package/web/assets/classDiagram-v2-Q7XG4LA2-BIb2luMM.js +1 -0
  21. package/web/assets/{cose-bilkent-S5V4N54A-Bg8zNVyQ.js → cose-bilkent-S5V4N54A-CajCdXuh.js} +1 -1
  22. package/web/assets/{cynefin-OW5HDTMX-DK7JR-k7.js → cynefin-OW5HDTMX-Dy6w1bhP.js} +1 -1
  23. package/web/assets/{dagre-BM42HDAG-BH4Aku3T.js → dagre-BM42HDAG-BymkC887.js} +1 -1
  24. package/web/assets/{diagram-2AECGRRQ-C8nUJJQE.js → diagram-2AECGRRQ-CtfaySwH.js} +1 -1
  25. package/web/assets/{diagram-5GNKFQAL-PvBz3O1i.js → diagram-5GNKFQAL-Bl6KUMhr.js} +1 -1
  26. package/web/assets/{diagram-KO2AKTUF-CLJk2tgT.js → diagram-KO2AKTUF-P5sfwN61.js} +1 -1
  27. package/web/assets/{diagram-LMA3HP47-XYR2Iaou.js → diagram-LMA3HP47-D9gD2CpB.js} +1 -1
  28. package/web/assets/{diagram-OG6HWLK6-C6TwDtIj.js → diagram-OG6HWLK6-CaCRrHGf.js} +1 -1
  29. package/web/assets/{erDiagram-TEJ5UH35-D0IvMBhT.js → erDiagram-TEJ5UH35-CNM4s1KX.js} +1 -1
  30. package/web/assets/{flowDiagram-I6XJVG4X-DCcPqJtr.js → flowDiagram-I6XJVG4X-Bdb65Mja.js} +1 -1
  31. package/web/assets/{ganttDiagram-6RSMTGT7-Dd6jNilZ.js → ganttDiagram-6RSMTGT7-D9faE2e8.js} +1 -1
  32. package/web/assets/{gitGraphDiagram-PVQCEYII-dLEYc9sf.js → gitGraphDiagram-PVQCEYII-4d4jIMfU.js} +1 -1
  33. package/web/assets/index-BNyYcMrm.js +191 -0
  34. package/web/assets/{index-CeeeNh8y.css → index-CRlNNu-y.css} +1 -1
  35. package/web/assets/{index-RuQTkZJb.js → index-DR4aU0C0.js} +5 -5
  36. package/web/assets/{index-sbvImgCO.js → index-DejS3DXy.js} +1 -1
  37. package/web/assets/{index10-CYBa-X9L.js → index10-juJIi9I9.js} +1 -1
  38. package/web/assets/{index5-0ddz3aZZ.js → index5-Bl0GOZhI.js} +1 -1
  39. package/web/assets/{index6-sINF5Zn7.js → index6-BHdMpBG5.js} +1 -1
  40. package/web/assets/{index8-DOHEQLGI.js → index8-AB_Nvz6R.js} +1 -1
  41. package/web/assets/{index9-BBZwrvIj.js → index9-DMukeGfx.js} +1 -1
  42. package/web/assets/{infoDiagram-5YYISTIA-CsYbsXnr.js → infoDiagram-5YYISTIA-CdX5UJTa.js} +1 -1
  43. package/web/assets/{ishikawaDiagram-YF4QCWOH-BRTrHa87.js → ishikawaDiagram-YF4QCWOH-Dr_2Rp3Q.js} +1 -1
  44. package/web/assets/{journeyDiagram-JHISSGLW-CA4FF1Bb.js → journeyDiagram-JHISSGLW-CCfHuw7c.js} +1 -1
  45. package/web/assets/{kanban-definition-UN3LZRKU-CUj3vX_Y.js → kanban-definition-UN3LZRKU-Dj3UcbF2.js} +1 -1
  46. package/web/assets/{linear-DJ-jo7u7.js → linear-CL3Z5odF.js} +1 -1
  47. package/web/assets/{markstream-CzP-U2lR.js → markstream-CoUaLNpp.js} +2 -2
  48. package/web/assets/{mermaid.core-BvSKTRe8.js → mermaid.core-BJxGOoVA.js} +4 -4
  49. package/web/assets/{mindmap-definition-RKZ34NQL-h3AulNua.js → mindmap-definition-RKZ34NQL-D00RLQRV.js} +1 -1
  50. package/web/assets/{pieDiagram-4H26LBE5-CPpwBWjO.js → pieDiagram-4H26LBE5-BGqQfehd.js} +1 -1
  51. package/web/assets/{quadrantDiagram-W4KKPZXB-BnLu4itc.js → quadrantDiagram-W4KKPZXB-C_tNe1Cp.js} +1 -1
  52. package/web/assets/{requirementDiagram-4Y6WPE33-jUcosDJE.js → requirementDiagram-4Y6WPE33-DI3N4qEV.js} +1 -1
  53. package/web/assets/{sankeyDiagram-5OEKKPKP-DSLSRtBi.js → sankeyDiagram-5OEKKPKP-B4HsHxOU.js} +1 -1
  54. package/web/assets/{sequenceDiagram-3UESZ5HK-B0cLrDIf.js → sequenceDiagram-3UESZ5HK-BwPltP8r.js} +1 -1
  55. package/web/assets/{stateDiagram-AJRCARHV-Cm32tcPC.js → stateDiagram-AJRCARHV-CaXU_K9y.js} +1 -1
  56. package/web/assets/stateDiagram-v2-BHNVJYJU-Bi9yoMtb.js +1 -0
  57. package/web/assets/{timeline-definition-PNZ67QCA-CQKopER7.js → timeline-definition-PNZ67QCA-CH2JsvOa.js} +1 -1
  58. package/web/assets/{vennDiagram-CIIHVFJN-BH2oewdT.js → vennDiagram-CIIHVFJN-CmXeNPt4.js} +1 -1
  59. package/web/assets/{wardleyDiagram-YWT4CUSO-DLTd3l42.js → wardleyDiagram-YWT4CUSO-BjI-bjBh.js} +1 -1
  60. package/web/assets/{xychartDiagram-2RQKCTM6-BPMX-u0w.js → xychartDiagram-2RQKCTM6-DCM4Ln-n.js} +1 -1
  61. package/web/assets/zh-CN-D1J2z6LG.js +1 -0
  62. package/web/dimcode-web.json +2 -2
  63. package/web/index.html +2 -2
  64. package/web/assets/channel-CJ35sLov.js +0 -1
  65. package/web/assets/classDiagram-4FO5ZUOK-CjlBIWs5.js +0 -1
  66. package/web/assets/classDiagram-v2-Q7XG4LA2-CjlBIWs5.js +0 -1
  67. package/web/assets/index-BdrW2KdJ.js +0 -173
  68. package/web/assets/stateDiagram-v2-BHNVJYJU-CB0cqS10.js +0 -1
  69. package/web/assets/zh-CN-BQXM47_T.js +0 -1
@@ -1,4 +1,4 @@
1
- import{p as he}from"./chunk-4BX2VUAB-BeOeLZBs.js";import{I as $e}from"./chunk-QZHKN3VN-Cn0Ufw6g.js";import{q as fe,p as ge,s as ue,g as ye,a as xe,b as me,_ as $,D as Q,l as k,d as pe,c as z,u as be,E as we,z as ke,k as L,F as ve,G as Ee,H as Ce}from"./mermaid.core-BvSKTRe8.js";import{p as Be}from"./cynefin-OW5HDTMX-DK7JR-k7.js";import"./index-BdrW2KdJ.js";import"./vendor-vue-CrmKjNvT.js";var p={NORMAL:0,REVERSE:1,HIGHLIGHT:2,MERGE:3,CHERRY_PICK:4},Te=Ee.gitGraph,D=$(()=>ve({...Te,...Q().gitGraph}),"getConfig"),i=new $e(()=>{const e=D(),r=e.mainBranchName,t=e.mainBranchOrder;return{mainBranchName:r,commits:new Map,head:null,branchConfig:new Map([[r,{name:r,order:t}]]),branches:new Map([[r,null]]),currBranch:r,direction:"LR",seq:0,options:{}}});function K(){return Ce({length:7})}$(K,"getID");function ae(e,r){const t=Object.create(null);return e.reduce((o,s)=>{const d=r(s);return t[d]||(t[d]=!0,o.push(s)),o},[])}$(ae,"uniqBy");var Le=$(function(e){i.records.direction=e},"setDirection"),Me=$(function(e){k.debug("options str",e),e=e==null?void 0:e.trim(),e=e||"{}";try{i.records.options=JSON.parse(e)}catch(r){k.error("error while parsing gitGraph options",r.message)}},"setOptions"),Re=$(function(){return i.records.options},"getOptions"),Ie=$(function(e){let r=e.msg,t=e.id;const o=e.type;let s=e.tags;k.info("commit",r,t,o,s),k.debug("Entering commit:",r,t,o,s);const d=D();t=L.sanitizeText(t,d),r=L.sanitizeText(r,d),s=s==null?void 0:s.map(a=>L.sanitizeText(a,d));const n={id:t||i.records.seq+"-"+K(),message:r,seq:i.records.seq++,type:o??p.NORMAL,tags:s??[],parents:i.records.head==null?[]:[i.records.head.id],branch:i.records.currBranch};i.records.head=n,k.info("main branch",d.mainBranchName),i.records.commits.has(n.id)&&k.warn(`Commit ID ${n.id} already exists`),i.records.commits.set(n.id,n),i.records.branches.set(i.records.currBranch,n.id),k.debug("in pushCommit "+n.id)},"commit"),Oe=$(function(e){let r=e.name;const t=e.order;if(r=L.sanitizeText(r,D()),i.records.branches.has(r))throw new Error(`Trying to create an existing branch. (Help: Either use a new name if you want create a new branch or try using "checkout ${r}")`);i.records.branches.set(r,i.records.head!=null?i.records.head.id:null),i.records.branchConfig.set(r,{name:r,order:t}),ne(r),k.debug("in createBranch")},"branch"),_e=$(e=>{let r=e.branch,t=e.id;const o=e.type,s=e.tags,d=D();r=L.sanitizeText(r,d),t&&(t=L.sanitizeText(t,d));const n=i.records.branches.get(i.records.currBranch),a=i.records.branches.get(r),l=n?i.records.commits.get(n):void 0,h=a?i.records.commits.get(a):void 0;if(l&&h&&l.branch===r)throw new Error(`Cannot merge branch '${r}' into itself.`);if(i.records.currBranch===r){const c=new Error('Incorrect usage of "merge". Cannot merge a branch to itself');throw c.hash={text:`merge ${r}`,token:`merge ${r}`,expected:["branch abc"]},c}if(l===void 0||!l){const c=new Error(`Incorrect usage of "merge". Current branch (${i.records.currBranch})has no commits`);throw c.hash={text:`merge ${r}`,token:`merge ${r}`,expected:["commit"]},c}if(!i.records.branches.has(r)){const c=new Error('Incorrect usage of "merge". Branch to be merged ('+r+") does not exist");throw c.hash={text:`merge ${r}`,token:`merge ${r}`,expected:[`branch ${r}`]},c}if(h===void 0||!h){const c=new Error('Incorrect usage of "merge". Branch to be merged ('+r+") has no commits");throw c.hash={text:`merge ${r}`,token:`merge ${r}`,expected:['"commit"']},c}if(l===h){const c=new Error('Incorrect usage of "merge". Both branches have same head');throw c.hash={text:`merge ${r}`,token:`merge ${r}`,expected:["branch abc"]},c}if(t&&i.records.commits.has(t)){const c=new Error('Incorrect usage of "merge". Commit with id:'+t+" already exists, use different custom id");throw c.hash={text:`merge ${r} ${t} ${o} ${s==null?void 0:s.join(" ")}`,token:`merge ${r} ${t} ${o} ${s==null?void 0:s.join(" ")}`,expected:[`merge ${r} ${t}_UNIQUE ${o} ${s==null?void 0:s.join(" ")}`]},c}const g=a||"",f={id:t||`${i.records.seq}-${K()}`,message:`merged branch ${r} into ${i.records.currBranch}`,seq:i.records.seq++,parents:i.records.head==null?[]:[i.records.head.id,g],branch:i.records.currBranch,type:p.MERGE,customType:o,customId:!!t,tags:s??[]};i.records.head=f,i.records.commits.set(f.id,f),i.records.branches.set(i.records.currBranch,f.id),k.debug(i.records.branches),k.debug("in mergeBranch")},"merge"),Ge=$(function(e){let r=e.id,t=e.targetId,o=e.tags,s=e.parent;k.debug("Entering cherryPick:",r,t,o);const d=D();if(r=L.sanitizeText(r,d),t=L.sanitizeText(t,d),o=o==null?void 0:o.map(l=>L.sanitizeText(l,d)),s=L.sanitizeText(s,d),!r||!i.records.commits.has(r)){const l=new Error('Incorrect usage of "cherryPick". Source commit id should exist and provided');throw l.hash={text:`cherryPick ${r} ${t}`,token:`cherryPick ${r} ${t}`,expected:["cherry-pick abc"]},l}const n=i.records.commits.get(r);if(n===void 0||!n)throw new Error('Incorrect usage of "cherryPick". Source commit id should exist and provided');if(s&&!(Array.isArray(n.parents)&&n.parents.includes(s)))throw new Error("Invalid operation: The specified parent commit is not an immediate parent of the cherry-picked commit.");const a=n.branch;if(n.type===p.MERGE&&!s)throw new Error("Incorrect usage of cherry-pick: If the source commit is a merge commit, an immediate parent commit must be specified.");if(!t||!i.records.commits.has(t)){if(a===i.records.currBranch){const f=new Error('Incorrect usage of "cherryPick". Source commit is already on current branch');throw f.hash={text:`cherryPick ${r} ${t}`,token:`cherryPick ${r} ${t}`,expected:["cherry-pick abc"]},f}const l=i.records.branches.get(i.records.currBranch);if(l===void 0||!l){const f=new Error(`Incorrect usage of "cherry-pick". Current branch (${i.records.currBranch})has no commits`);throw f.hash={text:`cherryPick ${r} ${t}`,token:`cherryPick ${r} ${t}`,expected:["cherry-pick abc"]},f}const h=i.records.commits.get(l);if(h===void 0||!h){const f=new Error(`Incorrect usage of "cherry-pick". Current branch (${i.records.currBranch})has no commits`);throw f.hash={text:`cherryPick ${r} ${t}`,token:`cherryPick ${r} ${t}`,expected:["cherry-pick abc"]},f}const g={id:i.records.seq+"-"+K(),message:`cherry-picked ${n==null?void 0:n.message} into ${i.records.currBranch}`,seq:i.records.seq++,parents:i.records.head==null?[]:[i.records.head.id,n.id],branch:i.records.currBranch,type:p.CHERRY_PICK,tags:o?o.filter(Boolean):[`cherry-pick:${n.id}${n.type===p.MERGE?`|parent:${s}`:""}`]};i.records.head=g,i.records.commits.set(g.id,g),i.records.branches.set(i.records.currBranch,g.id),k.debug(i.records.branches),k.debug("in cherryPick")}},"cherryPick"),ne=$(function(e){if(e=L.sanitizeText(e,D()),i.records.branches.has(e)){i.records.currBranch=e;const r=i.records.branches.get(i.records.currBranch);r===void 0||!r?i.records.head=null:i.records.head=i.records.commits.get(r)??null}else{const r=new Error(`Trying to checkout branch which is not yet created. (Help try using "branch ${e}")`);throw r.hash={text:`checkout ${e}`,token:`checkout ${e}`,expected:[`branch ${e}`]},r}},"checkout");function X(e,r,t){const o=e.indexOf(r);o===-1?e.push(t):e.splice(o,1,t)}$(X,"upsert");function Z(e){const r=e.reduce((s,d)=>s.seq>d.seq?s:d,e[0]);let t="";e.forEach(function(s){s===r?t+=" *":t+=" |"});const o=[t,r.id,r.seq];for(const s in i.records.branches)i.records.branches.get(s)===r.id&&o.push(s);if(k.debug(o.join(" ")),r.parents&&r.parents.length==2&&r.parents[0]&&r.parents[1]){const s=i.records.commits.get(r.parents[0]);X(e,r,s),r.parents[1]&&e.push(i.records.commits.get(r.parents[1]))}else{if(r.parents.length==0)return;if(r.parents[0]){const s=i.records.commits.get(r.parents[0]);X(e,r,s)}}e=ae(e,s=>s.id),Z(e)}$(Z,"prettyPrintCommitHistory");var He=$(function(){k.debug(i.records.commits);const e=se()[0];Z([e])},"prettyPrint"),Se=$(function(){i.reset(),ke()},"clear"),Ae=$(function(){return[...i.records.branchConfig.values()].map((r,t)=>r.order!==null&&r.order!==void 0?r:{...r,order:parseFloat(`0.${t}`)}).sort((r,t)=>(r.order??0)-(t.order??0)).map(({name:r})=>({name:r}))},"getBranchesAsObjArray"),De=$(function(){return i.records.branches},"getBranches"),qe=$(function(){return i.records.commits},"getCommits"),se=$(function(){const e=[...i.records.commits.values()];return e.forEach(function(r){k.debug(r.id)}),e.sort((r,t)=>r.seq-t.seq),e},"getCommitsArray"),Pe=$(function(){return i.records.currBranch},"getCurrentBranch"),We=$(function(){return i.records.direction},"getDirection"),Ne=$(function(){return i.records.head},"getHead"),oe={commitType:p,getConfig:D,setDirection:Le,setOptions:Me,getOptions:Re,commit:Ie,branch:Oe,merge:_e,cherryPick:Ge,checkout:ne,prettyPrint:He,clear:Se,getBranchesAsObjArray:Ae,getBranches:De,getCommits:qe,getCommitsArray:se,getCurrentBranch:Pe,getDirection:We,getHead:Ne,setAccTitle:me,getAccTitle:xe,getAccDescription:ye,setAccDescription:ue,setDiagramTitle:ge,getDiagramTitle:fe},Fe=$((e,r)=>{he(e,r),e.dir&&r.setDirection(e.dir);for(const t of e.statements)ze(t,r)},"populate"),ze=$((e,r)=>{const o={Commit:$(s=>r.commit(Ye(s)),"Commit"),Branch:$(s=>r.branch(je(s)),"Branch"),Merge:$(s=>r.merge(Ue(s)),"Merge"),Checkout:$(s=>r.checkout(Ke(s)),"Checkout"),CherryPicking:$(s=>r.cherryPick(Ve(s)),"CherryPicking")}[e.$type];o?o(e):k.error(`Unknown statement type: ${e.$type}`)},"parseStatement"),Ye=$(e=>({id:e.id,msg:e.message??"",type:e.type!==void 0?p[e.type]:p.NORMAL,tags:e.tags??void 0}),"parseCommit"),je=$(e=>({name:e.name,order:e.order??0}),"parseBranch"),Ue=$(e=>({branch:e.branch,id:e.id??"",type:e.type!==void 0?p[e.type]:void 0,tags:e.tags??void 0}),"parseMerge"),Ke=$(e=>e.branch,"parseCheckout"),Ve=$(e=>{var t;return{id:e.id,targetId:"",tags:((t=e.tags)==null?void 0:t.length)===0?void 0:e.tags,parent:e.parent}},"parseCherryPicking"),Xe={parse:$(async e=>{const r=await Be("gitGraph",e);k.debug(r),Fe(r,oe)},"parse")},G=10,H=40,M=4,I=2,S=8,V=new Set(["redux","redux-dark","redux-color","redux-dark-color"]),J=12,ee=new Set(["redux-color","redux-dark-color"]),Je=new Set(["dark","redux-dark","redux-dark-color","neo-dark"]),A=$((e,r,t=!1)=>t&&e>0?(e-1)%(r-1)+1:e%r,"calcColorIndex"),B=new Map,T=new Map,j=30,N=new Map,U=[],O=0,y="LR",Qe=$(()=>{B.clear(),T.clear(),N.clear(),O=0,U=[],y="LR"},"clear"),ce=$(e=>{const r=document.createElementNS("http://www.w3.org/2000/svg","text");return(typeof e=="string"?e.split(/\\n|\n|<br\s*\/?>/gi):e).forEach(o=>{const s=document.createElementNS("http://www.w3.org/2000/svg","tspan");s.setAttributeNS("http://www.w3.org/XML/1998/namespace","xml:space","preserve"),s.setAttribute("dy","1em"),s.setAttribute("x","0"),s.setAttribute("class","row"),s.textContent=o.trim(),r.appendChild(s)}),r},"drawText"),ie=$(e=>{let r,t,o;return y==="BT"?(t=$((s,d)=>s<=d,"comparisonFunc"),o=1/0):(t=$((s,d)=>s>=d,"comparisonFunc"),o=0),e.forEach(s=>{var n,a;const d=y==="TB"||y=="BT"?(n=T.get(s))==null?void 0:n.y:(a=T.get(s))==null?void 0:a.x;d!==void 0&&t(d,o)&&(r=s,o=d)}),r},"findClosestParent"),Ze=$(e=>{let r="",t=1/0;return e.forEach(o=>{const s=T.get(o).y;s<=t&&(r=o,t=s)}),r||void 0},"findClosestParentBT"),er=$((e,r,t)=>{let o=t,s=t;const d=[];e.forEach(n=>{const a=r.get(n);if(!a)throw new Error(`Commit not found for key ${n}`);a.parents.length?(o=tr(a),s=Math.max(o,s)):d.push(a),ar(a,o)}),o=s,d.forEach(n=>{nr(n,o,t)}),e.forEach(n=>{const a=r.get(n);if(a!=null&&a.parents.length){const l=Ze(a.parents);o=T.get(l).y-H,o<=s&&(s=o);const h=B.get(a.branch).pos,g=o-G;T.set(a.id,{x:h,y:g})}})},"setParallelBTPos"),rr=$(e=>{var o;const r=ie(e.parents.filter(s=>s!==null));if(!r)throw new Error(`Closest parent not found for commit ${e.id}`);const t=(o=T.get(r))==null?void 0:o.y;if(t===void 0)throw new Error(`Closest parent position not found for commit ${e.id}`);return t},"findClosestParentPos"),tr=$(e=>rr(e)+H,"calculateCommitPosition"),ar=$((e,r)=>{const t=B.get(e.branch);if(!t)throw new Error(`Branch not found for commit ${e.id}`);const o=t.pos,s=r+G;return T.set(e.id,{x:o,y:s}),{x:o,y:s}},"setCommitPosition"),nr=$((e,r,t)=>{const o=B.get(e.branch);if(!o)throw new Error(`Branch not found for commit ${e.id}`);const s=r+t,d=o.pos;T.set(e.id,{x:d,y:s})},"setRootPosition"),sr=$((e,r,t,o,s,d)=>{const{theme:n}=z(),a=V.has(n??""),l=ee.has(n??""),h=Je.has(n??"");if(d===p.HIGHLIGHT)e.append("rect").attr("x",t.x-10+(a?3:0)).attr("y",t.y-10+(a?3:0)).attr("width",a?14:20).attr("height",a?14:20).attr("class",`commit ${r.id} commit-highlight${A(s,S,l)} ${o}-outer`),e.append("rect").attr("x",t.x-6+(a?2:0)).attr("y",t.y-6+(a?2:0)).attr("width",a?8:12).attr("height",a?8:12).attr("class",`commit ${r.id} commit${A(s,S,l)} ${o}-inner`);else if(d===p.CHERRY_PICK)e.append("circle").attr("cx",t.x).attr("cy",t.y).attr("r",a?7:10).attr("class",`commit ${r.id} ${o}`),e.append("circle").attr("cx",t.x-3).attr("cy",t.y+2).attr("r",a?2.5:2.75).attr("fill",h?"#000000":"#fff").attr("class",`commit ${r.id} ${o}`),e.append("circle").attr("cx",t.x+3).attr("cy",t.y+2).attr("r",a?2.5:2.75).attr("fill",h?"#000000":"#fff").attr("class",`commit ${r.id} ${o}`),e.append("line").attr("x1",t.x+3).attr("y1",t.y+1).attr("x2",t.x).attr("y2",t.y-5).attr("stroke",h?"#000000":"#fff").attr("class",`commit ${r.id} ${o}`),e.append("line").attr("x1",t.x-3).attr("y1",t.y+1).attr("x2",t.x).attr("y2",t.y-5).attr("stroke",h?"#000000":"#fff").attr("class",`commit ${r.id} ${o}`);else{const g=e.append("circle");if(g.attr("cx",t.x),g.attr("cy",t.y),g.attr("r",a?7:10),g.attr("class",`commit ${r.id} commit${A(s,S,l)}`),d===p.MERGE){const f=e.append("circle");f.attr("cx",t.x),f.attr("cy",t.y),f.attr("r",a?5:6),f.attr("class",`commit ${o} ${r.id} commit${A(s,S,l)}`)}if(d===p.REVERSE){const f=e.append("path"),c=a?4:5;f.attr("d",`M ${t.x-c},${t.y-c}L${t.x+c},${t.y+c}M${t.x-c},${t.y+c}L${t.x+c},${t.y-c}`).attr("class",`commit ${o} ${r.id} commit${A(s,S,l)}`)}}},"drawCommitBullet"),or=$((e,r,t,o,s)=>{var d;if(r.type!==p.CHERRY_PICK&&(r.customId&&r.type===p.MERGE||r.type!==p.MERGE)&&s.showCommitLabel){const n=e.append("g"),a=n.insert("rect").attr("class","commit-label-bkg"),l=n.append("text").attr("x",o).attr("y",t.y+25).attr("class","commit-label").text(r.id),h=(d=l.node())==null?void 0:d.getBBox();if(h&&(a.attr("x",t.posWithOffset-h.width/2-I).attr("y",t.y+13.5).attr("width",h.width+2*I).attr("height",h.height+2*I),y==="TB"||y==="BT"?(a.attr("x",t.x-(h.width+4*M+5)).attr("y",t.y-12),l.attr("x",t.x-(h.width+4*M)).attr("y",t.y+h.height-12)):l.attr("x",t.posWithOffset-h.width/2),s.rotateCommitLabel))if(y==="TB"||y==="BT")l.attr("transform","rotate(-45, "+t.x+", "+t.y+")"),a.attr("transform","rotate(-45, "+t.x+", "+t.y+")");else{const g=-7.5-(h.width+10)/25*9.5,f=10+h.width/25*8.5;n.attr("transform","translate("+g+", "+f+") rotate(-45, "+o+", "+t.y+")")}}},"drawCommitLabel"),cr=$((e,r,t,o)=>{var s;if(r.tags.length>0){let d=0,n=0,a=0;const l=[];for(const h of r.tags.reverse()){const g=e.insert("polygon"),f=e.append("circle"),c=e.append("text").attr("y",t.y-16-d).attr("class","tag-label").text(h),x=(s=c.node())==null?void 0:s.getBBox();if(!x)throw new Error("Tag bbox not found");n=Math.max(n,x.width),a=Math.max(a,x.height),c.attr("x",t.posWithOffset-x.width/2),l.push({tag:c,hole:f,rect:g,yOffset:d}),d+=20}for(const{tag:h,hole:g,rect:f,yOffset:c}of l){const x=a/2,u=t.y-19.2-c;if(f.attr("class","tag-label-bkg").attr("points",`
1
+ import{p as he}from"./chunk-4BX2VUAB-DjjPcYaV.js";import{I as $e}from"./chunk-QZHKN3VN-F4YC8_f_.js";import{q as fe,p as ge,s as ue,g as ye,a as xe,b as me,_ as $,D as Q,l as k,d as pe,c as z,u as be,E as we,z as ke,k as L,F as ve,G as Ee,H as Ce}from"./mermaid.core-BJxGOoVA.js";import{p as Be}from"./cynefin-OW5HDTMX-Dy6w1bhP.js";import"./index-BNyYcMrm.js";import"./vendor-vue-CrmKjNvT.js";var p={NORMAL:0,REVERSE:1,HIGHLIGHT:2,MERGE:3,CHERRY_PICK:4},Te=Ee.gitGraph,D=$(()=>ve({...Te,...Q().gitGraph}),"getConfig"),i=new $e(()=>{const e=D(),r=e.mainBranchName,t=e.mainBranchOrder;return{mainBranchName:r,commits:new Map,head:null,branchConfig:new Map([[r,{name:r,order:t}]]),branches:new Map([[r,null]]),currBranch:r,direction:"LR",seq:0,options:{}}});function K(){return Ce({length:7})}$(K,"getID");function ae(e,r){const t=Object.create(null);return e.reduce((o,s)=>{const d=r(s);return t[d]||(t[d]=!0,o.push(s)),o},[])}$(ae,"uniqBy");var Le=$(function(e){i.records.direction=e},"setDirection"),Me=$(function(e){k.debug("options str",e),e=e==null?void 0:e.trim(),e=e||"{}";try{i.records.options=JSON.parse(e)}catch(r){k.error("error while parsing gitGraph options",r.message)}},"setOptions"),Re=$(function(){return i.records.options},"getOptions"),Ie=$(function(e){let r=e.msg,t=e.id;const o=e.type;let s=e.tags;k.info("commit",r,t,o,s),k.debug("Entering commit:",r,t,o,s);const d=D();t=L.sanitizeText(t,d),r=L.sanitizeText(r,d),s=s==null?void 0:s.map(a=>L.sanitizeText(a,d));const n={id:t||i.records.seq+"-"+K(),message:r,seq:i.records.seq++,type:o??p.NORMAL,tags:s??[],parents:i.records.head==null?[]:[i.records.head.id],branch:i.records.currBranch};i.records.head=n,k.info("main branch",d.mainBranchName),i.records.commits.has(n.id)&&k.warn(`Commit ID ${n.id} already exists`),i.records.commits.set(n.id,n),i.records.branches.set(i.records.currBranch,n.id),k.debug("in pushCommit "+n.id)},"commit"),Oe=$(function(e){let r=e.name;const t=e.order;if(r=L.sanitizeText(r,D()),i.records.branches.has(r))throw new Error(`Trying to create an existing branch. (Help: Either use a new name if you want create a new branch or try using "checkout ${r}")`);i.records.branches.set(r,i.records.head!=null?i.records.head.id:null),i.records.branchConfig.set(r,{name:r,order:t}),ne(r),k.debug("in createBranch")},"branch"),_e=$(e=>{let r=e.branch,t=e.id;const o=e.type,s=e.tags,d=D();r=L.sanitizeText(r,d),t&&(t=L.sanitizeText(t,d));const n=i.records.branches.get(i.records.currBranch),a=i.records.branches.get(r),l=n?i.records.commits.get(n):void 0,h=a?i.records.commits.get(a):void 0;if(l&&h&&l.branch===r)throw new Error(`Cannot merge branch '${r}' into itself.`);if(i.records.currBranch===r){const c=new Error('Incorrect usage of "merge". Cannot merge a branch to itself');throw c.hash={text:`merge ${r}`,token:`merge ${r}`,expected:["branch abc"]},c}if(l===void 0||!l){const c=new Error(`Incorrect usage of "merge". Current branch (${i.records.currBranch})has no commits`);throw c.hash={text:`merge ${r}`,token:`merge ${r}`,expected:["commit"]},c}if(!i.records.branches.has(r)){const c=new Error('Incorrect usage of "merge". Branch to be merged ('+r+") does not exist");throw c.hash={text:`merge ${r}`,token:`merge ${r}`,expected:[`branch ${r}`]},c}if(h===void 0||!h){const c=new Error('Incorrect usage of "merge". Branch to be merged ('+r+") has no commits");throw c.hash={text:`merge ${r}`,token:`merge ${r}`,expected:['"commit"']},c}if(l===h){const c=new Error('Incorrect usage of "merge". Both branches have same head');throw c.hash={text:`merge ${r}`,token:`merge ${r}`,expected:["branch abc"]},c}if(t&&i.records.commits.has(t)){const c=new Error('Incorrect usage of "merge". Commit with id:'+t+" already exists, use different custom id");throw c.hash={text:`merge ${r} ${t} ${o} ${s==null?void 0:s.join(" ")}`,token:`merge ${r} ${t} ${o} ${s==null?void 0:s.join(" ")}`,expected:[`merge ${r} ${t}_UNIQUE ${o} ${s==null?void 0:s.join(" ")}`]},c}const g=a||"",f={id:t||`${i.records.seq}-${K()}`,message:`merged branch ${r} into ${i.records.currBranch}`,seq:i.records.seq++,parents:i.records.head==null?[]:[i.records.head.id,g],branch:i.records.currBranch,type:p.MERGE,customType:o,customId:!!t,tags:s??[]};i.records.head=f,i.records.commits.set(f.id,f),i.records.branches.set(i.records.currBranch,f.id),k.debug(i.records.branches),k.debug("in mergeBranch")},"merge"),Ge=$(function(e){let r=e.id,t=e.targetId,o=e.tags,s=e.parent;k.debug("Entering cherryPick:",r,t,o);const d=D();if(r=L.sanitizeText(r,d),t=L.sanitizeText(t,d),o=o==null?void 0:o.map(l=>L.sanitizeText(l,d)),s=L.sanitizeText(s,d),!r||!i.records.commits.has(r)){const l=new Error('Incorrect usage of "cherryPick". Source commit id should exist and provided');throw l.hash={text:`cherryPick ${r} ${t}`,token:`cherryPick ${r} ${t}`,expected:["cherry-pick abc"]},l}const n=i.records.commits.get(r);if(n===void 0||!n)throw new Error('Incorrect usage of "cherryPick". Source commit id should exist and provided');if(s&&!(Array.isArray(n.parents)&&n.parents.includes(s)))throw new Error("Invalid operation: The specified parent commit is not an immediate parent of the cherry-picked commit.");const a=n.branch;if(n.type===p.MERGE&&!s)throw new Error("Incorrect usage of cherry-pick: If the source commit is a merge commit, an immediate parent commit must be specified.");if(!t||!i.records.commits.has(t)){if(a===i.records.currBranch){const f=new Error('Incorrect usage of "cherryPick". Source commit is already on current branch');throw f.hash={text:`cherryPick ${r} ${t}`,token:`cherryPick ${r} ${t}`,expected:["cherry-pick abc"]},f}const l=i.records.branches.get(i.records.currBranch);if(l===void 0||!l){const f=new Error(`Incorrect usage of "cherry-pick". Current branch (${i.records.currBranch})has no commits`);throw f.hash={text:`cherryPick ${r} ${t}`,token:`cherryPick ${r} ${t}`,expected:["cherry-pick abc"]},f}const h=i.records.commits.get(l);if(h===void 0||!h){const f=new Error(`Incorrect usage of "cherry-pick". Current branch (${i.records.currBranch})has no commits`);throw f.hash={text:`cherryPick ${r} ${t}`,token:`cherryPick ${r} ${t}`,expected:["cherry-pick abc"]},f}const g={id:i.records.seq+"-"+K(),message:`cherry-picked ${n==null?void 0:n.message} into ${i.records.currBranch}`,seq:i.records.seq++,parents:i.records.head==null?[]:[i.records.head.id,n.id],branch:i.records.currBranch,type:p.CHERRY_PICK,tags:o?o.filter(Boolean):[`cherry-pick:${n.id}${n.type===p.MERGE?`|parent:${s}`:""}`]};i.records.head=g,i.records.commits.set(g.id,g),i.records.branches.set(i.records.currBranch,g.id),k.debug(i.records.branches),k.debug("in cherryPick")}},"cherryPick"),ne=$(function(e){if(e=L.sanitizeText(e,D()),i.records.branches.has(e)){i.records.currBranch=e;const r=i.records.branches.get(i.records.currBranch);r===void 0||!r?i.records.head=null:i.records.head=i.records.commits.get(r)??null}else{const r=new Error(`Trying to checkout branch which is not yet created. (Help try using "branch ${e}")`);throw r.hash={text:`checkout ${e}`,token:`checkout ${e}`,expected:[`branch ${e}`]},r}},"checkout");function X(e,r,t){const o=e.indexOf(r);o===-1?e.push(t):e.splice(o,1,t)}$(X,"upsert");function Z(e){const r=e.reduce((s,d)=>s.seq>d.seq?s:d,e[0]);let t="";e.forEach(function(s){s===r?t+=" *":t+=" |"});const o=[t,r.id,r.seq];for(const s in i.records.branches)i.records.branches.get(s)===r.id&&o.push(s);if(k.debug(o.join(" ")),r.parents&&r.parents.length==2&&r.parents[0]&&r.parents[1]){const s=i.records.commits.get(r.parents[0]);X(e,r,s),r.parents[1]&&e.push(i.records.commits.get(r.parents[1]))}else{if(r.parents.length==0)return;if(r.parents[0]){const s=i.records.commits.get(r.parents[0]);X(e,r,s)}}e=ae(e,s=>s.id),Z(e)}$(Z,"prettyPrintCommitHistory");var He=$(function(){k.debug(i.records.commits);const e=se()[0];Z([e])},"prettyPrint"),Se=$(function(){i.reset(),ke()},"clear"),Ae=$(function(){return[...i.records.branchConfig.values()].map((r,t)=>r.order!==null&&r.order!==void 0?r:{...r,order:parseFloat(`0.${t}`)}).sort((r,t)=>(r.order??0)-(t.order??0)).map(({name:r})=>({name:r}))},"getBranchesAsObjArray"),De=$(function(){return i.records.branches},"getBranches"),qe=$(function(){return i.records.commits},"getCommits"),se=$(function(){const e=[...i.records.commits.values()];return e.forEach(function(r){k.debug(r.id)}),e.sort((r,t)=>r.seq-t.seq),e},"getCommitsArray"),Pe=$(function(){return i.records.currBranch},"getCurrentBranch"),We=$(function(){return i.records.direction},"getDirection"),Ne=$(function(){return i.records.head},"getHead"),oe={commitType:p,getConfig:D,setDirection:Le,setOptions:Me,getOptions:Re,commit:Ie,branch:Oe,merge:_e,cherryPick:Ge,checkout:ne,prettyPrint:He,clear:Se,getBranchesAsObjArray:Ae,getBranches:De,getCommits:qe,getCommitsArray:se,getCurrentBranch:Pe,getDirection:We,getHead:Ne,setAccTitle:me,getAccTitle:xe,getAccDescription:ye,setAccDescription:ue,setDiagramTitle:ge,getDiagramTitle:fe},Fe=$((e,r)=>{he(e,r),e.dir&&r.setDirection(e.dir);for(const t of e.statements)ze(t,r)},"populate"),ze=$((e,r)=>{const o={Commit:$(s=>r.commit(Ye(s)),"Commit"),Branch:$(s=>r.branch(je(s)),"Branch"),Merge:$(s=>r.merge(Ue(s)),"Merge"),Checkout:$(s=>r.checkout(Ke(s)),"Checkout"),CherryPicking:$(s=>r.cherryPick(Ve(s)),"CherryPicking")}[e.$type];o?o(e):k.error(`Unknown statement type: ${e.$type}`)},"parseStatement"),Ye=$(e=>({id:e.id,msg:e.message??"",type:e.type!==void 0?p[e.type]:p.NORMAL,tags:e.tags??void 0}),"parseCommit"),je=$(e=>({name:e.name,order:e.order??0}),"parseBranch"),Ue=$(e=>({branch:e.branch,id:e.id??"",type:e.type!==void 0?p[e.type]:void 0,tags:e.tags??void 0}),"parseMerge"),Ke=$(e=>e.branch,"parseCheckout"),Ve=$(e=>{var t;return{id:e.id,targetId:"",tags:((t=e.tags)==null?void 0:t.length)===0?void 0:e.tags,parent:e.parent}},"parseCherryPicking"),Xe={parse:$(async e=>{const r=await Be("gitGraph",e);k.debug(r),Fe(r,oe)},"parse")},G=10,H=40,M=4,I=2,S=8,V=new Set(["redux","redux-dark","redux-color","redux-dark-color"]),J=12,ee=new Set(["redux-color","redux-dark-color"]),Je=new Set(["dark","redux-dark","redux-dark-color","neo-dark"]),A=$((e,r,t=!1)=>t&&e>0?(e-1)%(r-1)+1:e%r,"calcColorIndex"),B=new Map,T=new Map,j=30,N=new Map,U=[],O=0,y="LR",Qe=$(()=>{B.clear(),T.clear(),N.clear(),O=0,U=[],y="LR"},"clear"),ce=$(e=>{const r=document.createElementNS("http://www.w3.org/2000/svg","text");return(typeof e=="string"?e.split(/\\n|\n|<br\s*\/?>/gi):e).forEach(o=>{const s=document.createElementNS("http://www.w3.org/2000/svg","tspan");s.setAttributeNS("http://www.w3.org/XML/1998/namespace","xml:space","preserve"),s.setAttribute("dy","1em"),s.setAttribute("x","0"),s.setAttribute("class","row"),s.textContent=o.trim(),r.appendChild(s)}),r},"drawText"),ie=$(e=>{let r,t,o;return y==="BT"?(t=$((s,d)=>s<=d,"comparisonFunc"),o=1/0):(t=$((s,d)=>s>=d,"comparisonFunc"),o=0),e.forEach(s=>{var n,a;const d=y==="TB"||y=="BT"?(n=T.get(s))==null?void 0:n.y:(a=T.get(s))==null?void 0:a.x;d!==void 0&&t(d,o)&&(r=s,o=d)}),r},"findClosestParent"),Ze=$(e=>{let r="",t=1/0;return e.forEach(o=>{const s=T.get(o).y;s<=t&&(r=o,t=s)}),r||void 0},"findClosestParentBT"),er=$((e,r,t)=>{let o=t,s=t;const d=[];e.forEach(n=>{const a=r.get(n);if(!a)throw new Error(`Commit not found for key ${n}`);a.parents.length?(o=tr(a),s=Math.max(o,s)):d.push(a),ar(a,o)}),o=s,d.forEach(n=>{nr(n,o,t)}),e.forEach(n=>{const a=r.get(n);if(a!=null&&a.parents.length){const l=Ze(a.parents);o=T.get(l).y-H,o<=s&&(s=o);const h=B.get(a.branch).pos,g=o-G;T.set(a.id,{x:h,y:g})}})},"setParallelBTPos"),rr=$(e=>{var o;const r=ie(e.parents.filter(s=>s!==null));if(!r)throw new Error(`Closest parent not found for commit ${e.id}`);const t=(o=T.get(r))==null?void 0:o.y;if(t===void 0)throw new Error(`Closest parent position not found for commit ${e.id}`);return t},"findClosestParentPos"),tr=$(e=>rr(e)+H,"calculateCommitPosition"),ar=$((e,r)=>{const t=B.get(e.branch);if(!t)throw new Error(`Branch not found for commit ${e.id}`);const o=t.pos,s=r+G;return T.set(e.id,{x:o,y:s}),{x:o,y:s}},"setCommitPosition"),nr=$((e,r,t)=>{const o=B.get(e.branch);if(!o)throw new Error(`Branch not found for commit ${e.id}`);const s=r+t,d=o.pos;T.set(e.id,{x:d,y:s})},"setRootPosition"),sr=$((e,r,t,o,s,d)=>{const{theme:n}=z(),a=V.has(n??""),l=ee.has(n??""),h=Je.has(n??"");if(d===p.HIGHLIGHT)e.append("rect").attr("x",t.x-10+(a?3:0)).attr("y",t.y-10+(a?3:0)).attr("width",a?14:20).attr("height",a?14:20).attr("class",`commit ${r.id} commit-highlight${A(s,S,l)} ${o}-outer`),e.append("rect").attr("x",t.x-6+(a?2:0)).attr("y",t.y-6+(a?2:0)).attr("width",a?8:12).attr("height",a?8:12).attr("class",`commit ${r.id} commit${A(s,S,l)} ${o}-inner`);else if(d===p.CHERRY_PICK)e.append("circle").attr("cx",t.x).attr("cy",t.y).attr("r",a?7:10).attr("class",`commit ${r.id} ${o}`),e.append("circle").attr("cx",t.x-3).attr("cy",t.y+2).attr("r",a?2.5:2.75).attr("fill",h?"#000000":"#fff").attr("class",`commit ${r.id} ${o}`),e.append("circle").attr("cx",t.x+3).attr("cy",t.y+2).attr("r",a?2.5:2.75).attr("fill",h?"#000000":"#fff").attr("class",`commit ${r.id} ${o}`),e.append("line").attr("x1",t.x+3).attr("y1",t.y+1).attr("x2",t.x).attr("y2",t.y-5).attr("stroke",h?"#000000":"#fff").attr("class",`commit ${r.id} ${o}`),e.append("line").attr("x1",t.x-3).attr("y1",t.y+1).attr("x2",t.x).attr("y2",t.y-5).attr("stroke",h?"#000000":"#fff").attr("class",`commit ${r.id} ${o}`);else{const g=e.append("circle");if(g.attr("cx",t.x),g.attr("cy",t.y),g.attr("r",a?7:10),g.attr("class",`commit ${r.id} commit${A(s,S,l)}`),d===p.MERGE){const f=e.append("circle");f.attr("cx",t.x),f.attr("cy",t.y),f.attr("r",a?5:6),f.attr("class",`commit ${o} ${r.id} commit${A(s,S,l)}`)}if(d===p.REVERSE){const f=e.append("path"),c=a?4:5;f.attr("d",`M ${t.x-c},${t.y-c}L${t.x+c},${t.y+c}M${t.x-c},${t.y+c}L${t.x+c},${t.y-c}`).attr("class",`commit ${o} ${r.id} commit${A(s,S,l)}`)}}},"drawCommitBullet"),or=$((e,r,t,o,s)=>{var d;if(r.type!==p.CHERRY_PICK&&(r.customId&&r.type===p.MERGE||r.type!==p.MERGE)&&s.showCommitLabel){const n=e.append("g"),a=n.insert("rect").attr("class","commit-label-bkg"),l=n.append("text").attr("x",o).attr("y",t.y+25).attr("class","commit-label").text(r.id),h=(d=l.node())==null?void 0:d.getBBox();if(h&&(a.attr("x",t.posWithOffset-h.width/2-I).attr("y",t.y+13.5).attr("width",h.width+2*I).attr("height",h.height+2*I),y==="TB"||y==="BT"?(a.attr("x",t.x-(h.width+4*M+5)).attr("y",t.y-12),l.attr("x",t.x-(h.width+4*M)).attr("y",t.y+h.height-12)):l.attr("x",t.posWithOffset-h.width/2),s.rotateCommitLabel))if(y==="TB"||y==="BT")l.attr("transform","rotate(-45, "+t.x+", "+t.y+")"),a.attr("transform","rotate(-45, "+t.x+", "+t.y+")");else{const g=-7.5-(h.width+10)/25*9.5,f=10+h.width/25*8.5;n.attr("transform","translate("+g+", "+f+") rotate(-45, "+o+", "+t.y+")")}}},"drawCommitLabel"),cr=$((e,r,t,o)=>{var s;if(r.tags.length>0){let d=0,n=0,a=0;const l=[];for(const h of r.tags.reverse()){const g=e.insert("polygon"),f=e.append("circle"),c=e.append("text").attr("y",t.y-16-d).attr("class","tag-label").text(h),x=(s=c.node())==null?void 0:s.getBBox();if(!x)throw new Error("Tag bbox not found");n=Math.max(n,x.width),a=Math.max(a,x.height),c.attr("x",t.posWithOffset-x.width/2),l.push({tag:c,hole:f,rect:g,yOffset:d}),d+=20}for(const{tag:h,hole:g,rect:f,yOffset:c}of l){const x=a/2,u=t.y-19.2-c;if(f.attr("class","tag-label-bkg").attr("points",`
2
2
  ${o-n/2-M/2},${u+I}
3
3
  ${o-n/2-M/2},${u-I}
4
4
  ${t.posWithOffset-n/2-M},${u-x-I}
@@ -0,0 +1,191 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-DR4aU0C0.js","assets/vendor-vue-CrmKjNvT.js"])))=>i.map(i=>d[i]);
2
+ var Ft=Object.defineProperty;var Wt=(t,s,e)=>s in t?Ft(t,s,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[s]=e;var D=(t,s,e)=>Wt(t,typeof s!="symbol"?s+"":s,e);import{R as ze,d as N,p as m,i as J,G as W,H as B,a as d,b as h,n as Le,W as pe,r as A,u as S,X as Qe,Y as Dt,D as Ne,Z as j,z as l,c as L,t as b,_ as le,A as xe,e as R,s as q,g as Y,$ as ge,f as se,h as H,w as G,a0 as je,m as oe,o as me,a1 as Te,a2 as Nt,k as ue,a3 as jt,K as _t,q as Bt,M as Vt,U as et,T as Ht,a4 as It,a5 as Ut,a6 as Kt,a7 as Yt,a8 as Gt}from"./vendor-vue-CrmKjNvT.js";(function(){const s=document.createElement("link").relList;if(s&&s.supports&&s.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))n(o);new MutationObserver(o=>{for(const i of o)if(i.type==="childList")for(const a of i.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&n(a)}).observe(document,{childList:!0,subtree:!0});function e(o){const i={};return o.integrity&&(i.integrity=o.integrity),o.referrerPolicy&&(i.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?i.credentials="include":o.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function n(o){if(o.ep)return;o.ep=!0;const i=e(o);fetch(o.href,i)}})();/**
3
+ * @license lucide-vue-next v0.577.0 - ISC
4
+ *
5
+ * This source code is licensed under the ISC license.
6
+ * See the LICENSE file in the root directory of this source tree.
7
+ */const Zt=t=>{for(const s in t)if(s.startsWith("aria-")||s==="role"||s==="title")return!0;return!1};/**
8
+ * @license lucide-vue-next v0.577.0 - ISC
9
+ *
10
+ * This source code is licensed under the ISC license.
11
+ * See the LICENSE file in the root directory of this source tree.
12
+ */const tt=t=>t==="";/**
13
+ * @license lucide-vue-next v0.577.0 - ISC
14
+ *
15
+ * This source code is licensed under the ISC license.
16
+ * See the LICENSE file in the root directory of this source tree.
17
+ */const Jt=(...t)=>t.filter((s,e,n)=>!!s&&s.trim()!==""&&n.indexOf(s)===e).join(" ").trim();/**
18
+ * @license lucide-vue-next v0.577.0 - ISC
19
+ *
20
+ * This source code is licensed under the ISC license.
21
+ * See the LICENSE file in the root directory of this source tree.
22
+ */const st=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();/**
23
+ * @license lucide-vue-next v0.577.0 - ISC
24
+ *
25
+ * This source code is licensed under the ISC license.
26
+ * See the LICENSE file in the root directory of this source tree.
27
+ */const Xt=t=>t.replace(/^([A-Z])|[\s-_]+(\w)/g,(s,e,n)=>n?n.toUpperCase():e.toLowerCase());/**
28
+ * @license lucide-vue-next v0.577.0 - ISC
29
+ *
30
+ * This source code is licensed under the ISC license.
31
+ * See the LICENSE file in the root directory of this source tree.
32
+ */const Qt=t=>{const s=Xt(t);return s.charAt(0).toUpperCase()+s.slice(1)};/**
33
+ * @license lucide-vue-next v0.577.0 - ISC
34
+ *
35
+ * This source code is licensed under the ISC license.
36
+ * See the LICENSE file in the root directory of this source tree.
37
+ */var ve={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":2,"stroke-linecap":"round","stroke-linejoin":"round"};/**
38
+ * @license lucide-vue-next v0.577.0 - ISC
39
+ *
40
+ * This source code is licensed under the ISC license.
41
+ * See the LICENSE file in the root directory of this source tree.
42
+ */const es=({name:t,iconNode:s,absoluteStrokeWidth:e,"absolute-stroke-width":n,strokeWidth:o,"stroke-width":i,size:a=ve.width,color:r=ve.stroke,...u},{slots:v})=>ze("svg",{...ve,...u,width:a,height:a,stroke:r,"stroke-width":tt(e)||tt(n)||e===!0||n===!0?Number(o||i||ve["stroke-width"])*24/Number(a):o||i||ve["stroke-width"],class:Jt("lucide",u.class,...t?[`lucide-${st(Qt(t))}-icon`,`lucide-${st(t)}`]:["lucide-icon"]),...!v.default&&!Zt(u)&&{"aria-hidden":"true"}},[...s.map(p=>ze(...p)),...v.default?[v.default()]:[]]);/**
43
+ * @license lucide-vue-next v0.577.0 - ISC
44
+ *
45
+ * This source code is licensed under the ISC license.
46
+ * See the LICENSE file in the root directory of this source tree.
47
+ */const F=(t,s)=>(e,{slots:n,attrs:o})=>ze(es,{...o,...e,iconNode:s,name:t},n);/**
48
+ * @license lucide-vue-next v0.577.0 - ISC
49
+ *
50
+ * This source code is licensed under the ISC license.
51
+ * See the LICENSE file in the root directory of this source tree.
52
+ */const ts=F("arrow-up",[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]]);/**
53
+ * @license lucide-vue-next v0.577.0 - ISC
54
+ *
55
+ * This source code is licensed under the ISC license.
56
+ * See the LICENSE file in the root directory of this source tree.
57
+ */const we=F("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/**
58
+ * @license lucide-vue-next v0.577.0 - ISC
59
+ *
60
+ * This source code is licensed under the ISC license.
61
+ * See the LICENSE file in the root directory of this source tree.
62
+ */const Be=F("chevron-down",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/**
63
+ * @license lucide-vue-next v0.577.0 - ISC
64
+ *
65
+ * This source code is licensed under the ISC license.
66
+ * See the LICENSE file in the root directory of this source tree.
67
+ */const Se=F("chevron-right",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/**
68
+ * @license lucide-vue-next v0.577.0 - ISC
69
+ *
70
+ * This source code is licensed under the ISC license.
71
+ * See the LICENSE file in the root directory of this source tree.
72
+ */const ss=F("circle-slash-2",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M22 2 2 22",key:"y4kqgn"}]]);/**
73
+ * @license lucide-vue-next v0.577.0 - ISC
74
+ *
75
+ * This source code is licensed under the ISC license.
76
+ * See the LICENSE file in the root directory of this source tree.
77
+ */const $t=F("copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);/**
78
+ * @license lucide-vue-next v0.577.0 - ISC
79
+ *
80
+ * This source code is licensed under the ISC license.
81
+ * See the LICENSE file in the root directory of this source tree.
82
+ */const ns=F("file-pen",[["path",{d:"M12.659 22H18a2 2 0 0 0 2-2V8a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 14 2H6a2 2 0 0 0-2 2v9.34",key:"o6klzx"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10.378 12.622a1 1 0 0 1 3 3.003L8.36 20.637a2 2 0 0 1-.854.506l-2.867.837a.5.5 0 0 1-.62-.62l.836-2.869a2 2 0 0 1 .506-.853z",key:"zhnas1"}]]);/**
83
+ * @license lucide-vue-next v0.577.0 - ISC
84
+ *
85
+ * This source code is licensed under the ISC license.
86
+ * See the LICENSE file in the root directory of this source tree.
87
+ */const os=F("folder-open",[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]]);/**
88
+ * @license lucide-vue-next v0.577.0 - ISC
89
+ *
90
+ * This source code is licensed under the ISC license.
91
+ * See the LICENSE file in the root directory of this source tree.
92
+ */const Pe=F("folder",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]);/**
93
+ * @license lucide-vue-next v0.577.0 - ISC
94
+ *
95
+ * This source code is licensed under the ISC license.
96
+ * See the LICENSE file in the root directory of this source tree.
97
+ */const is=F("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"}]]);/**
98
+ * @license lucide-vue-next v0.577.0 - ISC
99
+ *
100
+ * This source code is licensed under the ISC license.
101
+ * See the LICENSE file in the root directory of this source tree.
102
+ */const as=F("info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);/**
103
+ * @license lucide-vue-next v0.577.0 - ISC
104
+ *
105
+ * This source code is licensed under the ISC license.
106
+ * See the LICENSE file in the root directory of this source tree.
107
+ */const Ve=F("loader-circle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/**
108
+ * @license lucide-vue-next v0.577.0 - ISC
109
+ *
110
+ * This source code is licensed under the ISC license.
111
+ * See the LICENSE file in the root directory of this source tree.
112
+ */const xt=F("menu",[["path",{d:"M4 5h16",key:"1tepv9"}],["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 19h16",key:"1djgab"}]]);/**
113
+ * @license lucide-vue-next v0.577.0 - ISC
114
+ *
115
+ * This source code is licensed under the ISC license.
116
+ * See the LICENSE file in the root directory of this source tree.
117
+ */const rs=F("panel-left-close",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m16 15-3-3 3-3",key:"14y99z"}]]);/**
118
+ * @license lucide-vue-next v0.577.0 - ISC
119
+ *
120
+ * This source code is licensed under the ISC license.
121
+ * See the LICENSE file in the root directory of this source tree.
122
+ */const ls=F("panel-left-open",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m14 9 3 3-3 3",key:"8010ee"}]]);/**
123
+ * @license lucide-vue-next v0.577.0 - ISC
124
+ *
125
+ * This source code is licensed under the ISC license.
126
+ * See the LICENSE file in the root directory of this source tree.
127
+ */const St=F("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/**
128
+ * @license lucide-vue-next v0.577.0 - ISC
129
+ *
130
+ * This source code is licensed under the ISC license.
131
+ * See the LICENSE file in the root directory of this source tree.
132
+ */const cs=F("quote",[["path",{d:"M16 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"rib7q0"}],["path",{d:"M5 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"1ymkrd"}]]);/**
133
+ * @license lucide-vue-next v0.577.0 - ISC
134
+ *
135
+ * This source code is licensed under the ISC license.
136
+ * See the LICENSE file in the root directory of this source tree.
137
+ */const He=F("search",[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]]);/**
138
+ * @license lucide-vue-next v0.577.0 - ISC
139
+ *
140
+ * This source code is licensed under the ISC license.
141
+ * See the LICENSE file in the root directory of this source tree.
142
+ */const ds=F("square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]);/**
143
+ * @license lucide-vue-next v0.577.0 - ISC
144
+ *
145
+ * This source code is licensed under the ISC license.
146
+ * See the LICENSE file in the root directory of this source tree.
147
+ */const us=F("terminal",[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]]);/**
148
+ * @license lucide-vue-next v0.577.0 - ISC
149
+ *
150
+ * This source code is licensed under the ISC license.
151
+ * See the LICENSE file in the root directory of this source tree.
152
+ */const hs=F("wifi-off",[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}],["path",{d:"M5 12.859a10 10 0 0 1 5.17-2.69",key:"1dl1wf"}],["path",{d:"M19 12.859a10 10 0 0 0-2.007-1.523",key:"4k23kn"}],["path",{d:"M2 8.82a15 15 0 0 1 4.177-2.643",key:"1grhjp"}],["path",{d:"M22 8.82a15 15 0 0 0-11.288-3.764",key:"z3jwby"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/**
153
+ * @license lucide-vue-next v0.577.0 - ISC
154
+ *
155
+ * This source code is licensed under the ISC license.
156
+ * See the LICENSE file in the root directory of this source tree.
157
+ */const ps=F("wifi",[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M2 8.82a15 15 0 0 1 20 0",key:"dnpr2z"}],["path",{d:"M5 12.859a10 10 0 0 1 14 0",key:"1x1e6c"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}]]);/**
158
+ * @license lucide-vue-next v0.577.0 - ISC
159
+ *
160
+ * This source code is licensed under the ISC license.
161
+ * See the LICENSE file in the root directory of this source tree.
162
+ */const ms=F("wrench",[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z",key:"1ngwbx"}]]);/**
163
+ * @license lucide-vue-next v0.577.0 - ISC
164
+ *
165
+ * This source code is licensed under the ISC license.
166
+ * See the LICENSE file in the root directory of this source tree.
167
+ */const Fe=F("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),fs=["d"],vs=N({__name:"BrandMark",props:{animated:{type:Boolean,default:!1}},setup(t){const s=[{delay:"-1.6s",d:"M52.042 34C50.8561 34.0001 49.8945 34.9615 49.8945 36.1475V46.1689C49.8946 47.3549 50.8561 48.3163 52.042 48.3164H77.958C79.144 48.3164 80.1054 47.3549 80.1055 46.1689V36.1475C80.1055 34.9615 79.144 34 77.958 34H52.042Z"},{delay:"-1.333s",d:"M83.8311 49.8945C82.6452 49.8947 81.6836 50.8561 81.6836 52.042V62.0635C81.6838 63.2493 82.6453 64.2108 83.8311 64.2109H93.8525C95.0384 64.2109 95.9998 63.2493 96 62.0635V52.042C96 50.856 95.0385 49.8945 93.8525 49.8945H83.8311Z"},{delay:"-1.067s",d:"M83.8311 65.7891C82.6453 65.7892 81.6838 66.7508 81.6836 67.9365V77.958C81.6836 79.1439 82.6452 80.1053 83.8311 80.1055H93.8525C95.0385 80.1055 96 79.144 96 77.958V67.9365C95.9998 66.7507 95.0384 65.7891 93.8525 65.7891H83.8311Z"},{delay:"-0.8s",d:"M52.042 81.6836C50.8561 81.6837 49.8946 82.6452 49.8945 83.8311V93.8525C49.8945 95.0385 50.8561 95.9999 52.042 96H77.958C79.144 96 80.1055 95.0385 80.1055 93.8525V83.8311C80.1054 82.6451 79.1439 81.6836 77.958 81.6836H52.042Z"},{delay:"-0.533s",d:"M36.1475 65.7891C34.9616 65.7891 34.0002 66.7507 34 67.9365V77.958C34 79.144 34.9615 80.1055 36.1475 80.1055H46.1689C47.3548 80.1054 48.3164 79.1439 48.3164 77.958V67.9365C48.3162 66.7507 47.3547 65.7892 46.1689 65.7891H36.1475Z"},{delay:"-0.267s",d:"M36.1475 49.8945C34.9615 49.8945 34 50.856 34 52.042V62.0635C34.0002 63.2493 34.9616 64.2109 36.1475 64.2109H46.1689C47.3547 64.2108 48.3162 63.2493 48.3164 62.0635V52.042C48.3164 50.8561 47.3548 49.8946 46.1689 49.8945H36.1475Z"}];return(e,n)=>(d(),m("svg",{viewBox:"34 34 62 62","aria-hidden":"true",class:J(["brand-mark",{"is-animated":t.animated}])},[(d(),m(W,null,B(s,o=>h("path",{key:o.d,fill:"currentColor",d:o.d,style:Le({animationDelay:o.delay})},null,12,fs)),64))],2))}}),ee=(t,s)=>{const e=t.__vccOpts||t;for(const[n,o]of s)e[n]=o;return e},Ee=ee(vs,[["__scopeId","data-v-44bc694b"]]),nt=3,ae="main";class re extends Error{constructor(){super(...arguments);D(this,"name","ProtocolError")}}function ie(t,s){throw new re(`Invalid ${t}: expected ${s}`)}function P(t,s){return(t===null||typeof t!="object"||Array.isArray(t))&&ie(s,"an object"),t}function ne(t,s){return Array.isArray(t)||ie(s,"an array"),t}function M(t,s,e){const n=t[s];return typeof n!="string"&&ie(`${e}.${s}`,"a string"),n}function Me(t,s,e){return t[s]===void 0||t[s]===null?void 0:M(t,s,e)}function X(t,s,e){const n=t[s];return(typeof n!="number"||!Number.isSafeInteger(n)||n<0)&&ie(`${e}.${s}`,"a nonnegative safe integer"),n}function he(t,s,e){const n=t[s];return typeof n!="boolean"&&ie(`${e}.${s}`,"a boolean"),n}function Ue(t,s){const e=P(t,s);return{providerId:M(e,"providerId",s),modelId:M(e,"modelId",s)}}function gs(t){const s=P(t,"hello");return{instanceId:M(s,"instanceId","hello"),serverVersion:M(s,"serverVersion","hello"),protocolVersion:X(s,"protocolVersion","hello"),features:ne(s.features,"hello.features").map((e,n)=>(typeof e!="string"&&ie(`hello.features[${n}]`,"a string"),e))}}function _e(t){P(t,"reply")}function ys(t){return ne(t,"session.summaries").map((s,e)=>{const n=`session.summaries[${e}]`,o=P(s,n),i=Me(o,"preview",n);return{sessionId:M(o,"sessionId",n),cwd:M(o,"cwd",n),model:Ue(o.model,`${n}.model`),createdAt:X(o,"createdAt",n),running:he(o,"running",n),sequence:X(o,"sequence",n),...i===void 0?{}:{preview:i},updatedAt:X(o,"updatedAt",n)}})}function bs(t){const s=P(t,"session.create");return{sessionId:M(s,"sessionId","session.create"),model:Ue(s.model,"session.create.model"),sequence:X(s,"sequence","session.create")}}function ws(t){const s=P(t,"session.history");return{events:ne(s.events,"session.history.events").map((e,n)=>Ct(e,`session.history.events[${n}]`)),through:X(s,"through","session.history"),nextAfter:X(s,"nextAfter","session.history"),done:he(s,"done","session.history")}}function ks(t){const s=P(t,"session.model.update");return{model:Ue(s.model,"session.model.update.model"),outcome:M(s,"outcome","session.model.update")}}function _s(t){const s=P(t,"provider.list");return ne(s.providers,"provider.list.providers").map((e,n)=>{const o=`provider.list.providers[${n}]`,i=P(e,o);return{providerId:M(i,"providerId",o),displayName:M(i,"displayName",o),enabled:he(i,"enabled",o),credentialConfigured:he(i,"credentialConfigured",o)}})}function Is(t){const s=P(t,"provider.catalog");if(s.catalog===null)return;const e=P(s.catalog,"provider.catalog.catalog");return{models:ne(e.models,"provider.catalog.models").map((n,o)=>{const i=`provider.catalog.models[${o}]`,a=P(n,i),r=Me(a,"unavailableReason",i);return{id:M(a,"id",i),name:M(a,"name",i),...r===void 0?{}:{unavailableReason:r}}}),disabledModelIds:ne(e.disabledModelIds,"provider.catalog.disabledModelIds").map((n,o)=>(typeof n!="string"&&ie(`provider.catalog.disabledModelIds[${o}]`,"a string"),n))}}function $s(t){const s=P(t,"provider.selection");if(s.selection===null)return;const e=P(s.selection,"provider.selection.selection");return{providerId:M(e,"provider_id","provider.selection"),modelId:M(e,"model_id","provider.selection")}}function Mt(t,s){return ne(t,s).flatMap((e,n)=>{const o=P(e,`${s}[${n}]`);return o.type==="text"?[M(o,"text",`${s}[${n}]`)]:[]}).join(`
168
+ `)}function ot(t,s){const e=P(t,s),n=typeof e.content=="string"?e.content:Mt(e.content,`${s}.content`),o=e.structuredContent===void 0||e.structuredContent===null?void 0:P(e.structuredContent,`${s}.structuredContent`),i=typeof(o==null?void 0:o.diff)=="string"?o.diff:void 0;return{text:n,isError:e.isError===!0,...i===void 0?{}:{diff:i}}}function xs(t,s,e,n){switch(`${t}/${s}`){case"input/message":return e.user===void 0||e.user===null?{kind:"input"}:{kind:"input",text:Mt(P(e.user,`${n}.user`).content,`${n}.user.content`)};case"turn/end":{const o=M(e,"status",n);o!=="completed"&&o!=="failed"&&o!=="cancelled"&&ie(`${n}.status`,"a turn outcome");const i=o==="failed"?M(e,"error",n):void 0;return{kind:"turn-end",outcome:o,...i===void 0?{}:{error:i}}}case"step/model-start":return{kind:"model-start",requestId:M(e,"request_id",n)};case"step/thinking":return{kind:"thinking",requestId:M(e,"request_id",n),delta:M(e,"delta",n)};case"step/text":return{kind:"text",requestId:M(e,"request_id",n),delta:M(e,"delta",n)};case"step/tool-use":{const o=P(e.call,`${n}.call`);return{kind:"tool-use",requestId:M(e,"request_id",n),callId:M(o,"id",`${n}.call`),name:M(o,"name",`${n}.call`),input:P(o.input,`${n}.call.input`)}}case"step/tool-completed":return{kind:"tool-completed",callId:M(e,"call_id",n),result:ot(e.result,`${n}.result`)};case"step/tool-result":return{kind:"tool-result",results:ne(e.results,`${n}.results`).map((o,i)=>{const a=P(o,`${n}.results[${i}]`);return{callId:M(a,"call_id",`${n}.results[${i}]`),result:ot(a.result,`${n}.results[${i}].result`)}})};case"step/model-output-end":{const o=M(e,"status",n)==="failed"?M(e,"error",n):void 0;return{kind:"model-end",requestId:M(e,"request_id",n),...o===void 0?{}:{error:o}}}case"context/configured":return{kind:"context-configured",model:{providerId:M(e,"provider_id",n),modelId:M(e,"model_id",n)}};default:return{kind:"other"}}}function Ct(t,s){const e=P(t,s),n=M(e,"type",s),o=M(e,"name",s);return{sequence:X(e,"sequence",s),createAt:X(e,"create_at",s),content:xs(n,o,P(e.data,`${s}.data`),`${s}.data`)}}function Ss(t){const s="approval.request",e=P(t.call,`${s}.call`),n=P(t.source,`${s}.source`),o=n.kind==="tool"?M(n,"call_id",`${s}.source`):void 0;return{sessionId:M(t,"sessionId",s),branchId:M(t,"branchId",s),requestId:M(t,"requestId",s),...o===void 0?{}:{callId:o},call:{name:M(e,"name",`${s}.call`),input:P(e.input,`${s}.call.input`)},reason:M(t,"reason",s)}}function Ms(t,s){const e=P(s??{},t);switch(t){case"session.event":return{method:t,sessionId:M(e,"sessionId",t),branchId:M(e,"branchId",t),event:Ct(e.event,`${t}.event`)};case"session.state":return{method:t,sessionId:M(e,"sessionId",t),branchId:M(e,"branchId",t),running:he(e,"running",t),stopping:he(e,"stopping",t)};case"session.model.progress":{const n=Me(e,"requestId",t);return{method:t,progress:{sessionId:M(e,"sessionId",t),branchId:M(e,"branchId",t),...n===void 0?{}:{requestId:n},text:M(e,"text",t),textOffset:X(e,"textOffset",t),thinking:M(e,"thinking",t),thinkingOffset:X(e,"thinkingOffset",t)}}}case"approval.request":return{method:t,request:Ss(e)};case"approval.cancelled":return{method:t,sessionId:M(e,"sessionId",t),branchId:M(e,"branchId",t),requestId:M(e,"requestId",t)};case"session.closed":{const n=Me(e,"reason",t);return{method:t,sessionId:M(e,"sessionId",t),...n===void 0?{}:{reason:n}}}default:return}}class Ke extends Error{constructor(e,n,o){super(n);D(this,"name","RpcError");this.code=e,this.appError=o}}class $e extends Error{constructor(){super(...arguments);D(this,"name","ConnectionLost")}}const Cs=3e4,Ts=2e4,Es=1e4,it=[500,1e3,2e3,4e3,8e3,15e3];class As{constructor(s){D(this,"socket");D(this,"nextId",1);D(this,"pending",new Map);D(this,"heartbeat");D(this,"retry");D(this,"attempt",0);D(this,"connectedOnce",!1);D(this,"stopped",!1);this.handlers=s}start(){this.stopped=!1,this.open()}stop(){var s;this.stopped=!0,clearTimeout(this.retry),(s=this.socket)==null||s.close()}retryNow(){this.socket!==void 0||this.stopped||(clearTimeout(this.retry),this.open())}call(s,e,n,o=Cs){const i=this.socket;if(i===void 0||i.readyState!==WebSocket.OPEN)return Promise.reject(new $e("Not connected"));const a=this.nextId++;return new Promise((r,u)=>{const v=setTimeout(()=>{this.pending.delete(a),u(new $e(`${s} timed out`))},o);this.pending.set(a,{resolve:r,reject:u,timer:v}),i.send(JSON.stringify({jsonrpc:"2.0",id:a,method:s,params:e}))}).then(n)}open(){this.handlers.phase(this.connectedOnce?"reconnecting":"connecting");const s=location.protocol==="https:"?"wss:":"ws:",e=new WebSocket(`${s}//${location.host}/ws`);this.socket=e;let n=!1;e.onopen=()=>{n=!0,this.handshake()},e.onmessage=o=>this.receive(o.data),e.onclose=()=>{if(this.socket===e){this.socket=void 0,clearInterval(this.heartbeat);for(const[o,i]of this.pending)clearTimeout(i.timer),i.reject(new $e("Connection closed")),this.pending.delete(o);this.stopped||(n?this.schedule():this.diagnoseRefusal())}}}async handshake(){var n,o;let s;try{s=await this.call("hello",{protocolVersion:nt,clientKind:"web",clientName:"dim-web"},gs)}catch(i){i instanceof Ke&&i.appError==="protocol_version"&&(this.stopped=!0,this.handlers.phase("version-mismatch")),(n=this.socket)==null||n.close();return}if(s.protocolVersion!==nt){this.stopped=!0,this.handlers.phase("version-mismatch"),(o=this.socket)==null||o.close();return}const e=this.connectedOnce;this.connectedOnce=!0,this.attempt=0,this.heartbeat=setInterval(()=>{this.call("daemon.ping",{},()=>{},Es).catch(()=>{var i;return(i=this.socket)==null?void 0:i.close()})},Ts),this.handlers.phase("connected"),this.handlers.ready(s,e)}async diagnoseRefusal(){let s=!1;try{s=(await fetch("/api/auth/session",{cache:"no-store"})).status===401}catch{s=!1}this.stopped||(s?(this.stopped=!0,this.handlers.phase("unauthenticated")):this.schedule())}schedule(){this.handlers.phase(this.connectedOnce?"reconnecting":"connecting");const s=it[Math.min(this.attempt,it.length-1)];this.attempt+=1,this.retry=setTimeout(()=>this.open(),s)}receive(s){let e;try{const o=JSON.parse(String(s));if(o===null||typeof o!="object"||Array.isArray(o))throw new re("Expected a JSON-RPC object");e=o}catch(o){this.handlers.invalid(o instanceof re?o:new re("Invalid JSON frame"));return}if(typeof e.id=="number"){const o=this.pending.get(e.id);if(o===void 0)return;this.pending.delete(e.id),clearTimeout(o.timer),"error"in e?o.reject(Os(e.error)):o.resolve(e.result);return}if(typeof e.method!="string")return;let n;try{n=Ms(e.method,e.params)}catch(o){this.handlers.invalid(o instanceof re?o:new re(String(o)));return}n!==void 0&&this.handlers.notification(n)}}function Os(t){const s=t!==null&&typeof t=="object"?t:{},e=s.data!==null&&typeof s.data=="object"?s.data:{};return new Ke(typeof s.code=="number"?s.code:-32603,typeof s.message=="string"?s.message:"Request failed",typeof e.appError=="string"?e.appError:void 0)}async function qs(){const t=new URLSearchParams(location.hash.slice(1)).get("bootstrap");if(t!==null){history.replaceState(history.state,"",`${location.pathname}${location.search}`);try{await fetch("/api/auth/exchange",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:t})})}catch{}}}class Rs{constructor(){D(this,"rows",[]);D(this,"cursor",0);D(this,"model");D(this,"answers",new Map);D(this,"thoughts",new Map);D(this,"requestStarts",new Map);D(this,"tools",new Map)}apply(s){if(s.sequence<=this.cursor)return!1;this.cursor=s.sequence;const e=s.content;switch(e.kind){case"input":e.text!==void 0&&this.push({kind:"user",key:`user-${s.sequence}`,text:e.text,at:s.createAt});break;case"model-start":this.requestStarts.set(e.requestId,s.createAt);break;case"thinking":{const n=this.openThinking(e.requestId);at(n,e.delta);const o=this.requestStarts.get(e.requestId);this.update(n.index,{text:Ie(n),...o===void 0?{}:{elapsedMs:Math.max(0,s.createAt-o)}});break}case"text":{this.closeThinking(e.requestId);const n=this.openAnswer(e.requestId);at(n,e.delta),this.update(n.index,{text:Ie(n)});break}case"tool-use":this.closeThinking(e.requestId),this.closeAnswer(e.requestId),this.requestStarts.delete(e.requestId),this.tools.set(e.callId,this.push({kind:"tool",key:`tool-${e.callId}`,callId:e.callId,name:e.name,input:e.input,pending:!0}));break;case"tool-completed":this.completeTool(e.callId,e.result);break;case"tool-result":for(const n of e.results)this.completeTool(n.callId,n.result);break;case"model-end":this.closeThinking(e.requestId),this.closeAnswer(e.requestId),this.requestStarts.delete(e.requestId),e.error!==void 0&&this.push({kind:"error",key:`error-${s.sequence}`,text:e.error});break;case"turn-end":for(const n of[...this.thoughts.keys()])this.closeThinking(n);for(const n of[...this.answers.keys()])this.closeAnswer(n);this.requestStarts.clear(),e.outcome==="failed"&&this.push({kind:"error",key:`error-${s.sequence}`,text:e.error??""}),e.outcome==="cancelled"&&this.push({kind:"stopped",key:`stopped-${s.sequence}`});break;case"context-configured":this.model=e.model;break}return!0}progress(s){const e=s.requestId;if(e!==void 0){if(s.thinking!==""){const n=this.openThinking(e);n.progress={text:s.thinking,offset:s.thinkingOffset},this.update(n.index,{text:Ie(n)})}if(s.text!==""){const n=this.openAnswer(e);n.progress={text:s.text,offset:s.textOffset},this.update(n.index,{text:Ie(n)})}}}push(s){return this.rows.push(s),this.rows.length-1}update(s,e){this.rows[s]={...this.rows[s],...e}}openThinking(s){let e=this.thoughts.get(s);return e===void 0&&(e={index:this.push({kind:"thinking",key:`thinking-${s}-${this.rows.length}`,text:"",streaming:!0}),written:"",writtenChars:0},this.thoughts.set(s,e)),e}openAnswer(s){let e=this.answers.get(s);return e===void 0&&(e={index:this.push({kind:"assistant",key:`assistant-${s}-${this.rows.length}`,text:"",streaming:!0}),written:"",writtenChars:0},this.answers.set(s,e)),e}closeThinking(s){const e=this.thoughts.get(s);e!==void 0&&(this.thoughts.delete(s),this.update(e.index,{text:e.written,streaming:!1}))}closeAnswer(s){const e=this.answers.get(s);e!==void 0&&(this.answers.delete(s),this.update(e.index,{text:e.written,streaming:!1}))}completeTool(s,e){const n=this.tools.get(s);n!==void 0&&(this.tools.delete(s),this.update(n,{pending:!1,result:e}))}}function at(t,s){t.written+=s,t.writtenChars+=[...s].length}function Ie(t){const s=t.progress;if(s===void 0)return t.written;const e=t.writtenChars-s.offset;if(e<0)return t.written;const n=[...s.text];return e>=n.length?(t.progress=void 0,t.written):t.written+n.slice(e).join("")}const U=pe("sessions",()=>{const t=A([]),s=A(!1),e=A("");let n;const o=S(()=>new Map(t.value.map(p=>[p.sessionId,p]))),i=S(()=>{const p=new Map;for(const g of t.value){const y=p.get(g.cwd);y===void 0?p.set(g.cwd,[g]):y.push(g)}return[...p].map(([g,y])=>(y.sort((_,$)=>$.updatedAt-_.updatedAt),{cwd:g,name:Ae(g),sessions:y,updatedAt:y[0].updatedAt})).sort((g,y)=>y.updatedAt-g.updatedAt)});function a(){return n??(n=K().client.call("session.summaries",{},ys).then(p=>{t.value=p,s.value=!0,e.value=""}).catch(p=>{e.value=p instanceof Error?p.message:String(p)}).finally(()=>{n=void 0})),n}async function r(p,g){const y={cwd:p};g!==void 0&&(y.model={provider:g.providerId,modelId:g.modelId});const _=await K().client.call("session.create",y,bs);return a(),_.sessionId}function u(p,g){const y=o.value.get(p);y!==void 0&&y.running!==g&&(y.running=g)}function v(p){t.value=t.value.filter(g=>g.sessionId!==p)}return{summaries:t,loaded:s,error:e,byId:o,workspaces:i,refresh:a,create:r,setRunning:u,forget:v}});function Ae(t){return t.replace(/[\\/]+$/,"").split(/[\\/]/).at(-1)||t}const zs=256,Ls=6e4,Ps=16,ye=pe("chat",()=>{const t=Qe({}),s=new Map;let e;function n(){return K().client}function o(c){var E,C;if(s.has(c))return;const f=Qe({sessionId:c,status:"loading",error:"",rows:[],running:((E=U().byId.get(c))==null?void 0:E.running)??!1,stopping:!1,approvals:[],model:(C=U().byId.get(c))==null?void 0:C.model}),I={view:f,projection:new Rs,syncing:!1,queued:[],publishTimer:void 0};s.set(c,I),t[c]=f,a(I)}function i(){for(const c of s.values())c.view.status!=="closed"&&a(c)}async function a(c){const{view:f,projection:I}=c;c.syncing=!0,c.queued=[],f.approvals=[];try{await n().call("session.attach",{sessionId:f.sessionId},_e);let E=I.cursor,C;for(;;){const x=await n().call("session.history",{sessionId:f.sessionId,branchId:ae,after:E,limit:zs,...C===void 0?{}:{through:C}},ws,Ls);if(C!==void 0&&x.through!==C||x.nextAfter<E||x.nextAfter>x.through||!x.done&&x.nextAfter===E)throw new re("Invalid history page cursor");C=x.through;for(const T of x.events)I.apply(T);if(E=x.nextAfter,x.done)break}for(const x of c.queued)u(c,x);f.status="ready",f.error=""}catch(E){E instanceof Ke&&E.appError==="session_closed"?f.status="closed":E instanceof $e||(f.status="failed",f.error=E instanceof Error?E.message:String(E))}finally{c.syncing=!1,c.queued=[],p(c)}}function r(c){const f=c.method==="session.model.progress"?c.progress.sessionId:c.method==="approval.request"?c.request.sessionId:c.sessionId,I=s.get(f);if(I!==void 0){if(I.syncing&&(c.method==="session.event"||c.method==="session.model.progress")){I.queued.push(c);return}u(I,c)}}function u(c,f){const I=c.view;switch(f.method){case"session.event":f.branchId===ae&&c.projection.apply(f.event)&&v(c);break;case"session.model.progress":f.progress.branchId===ae&&(c.projection.progress(f.progress),v(c));break;case"session.state":if(f.branchId!==ae)break;I.running&&!f.running&&g(),I.running=f.running,I.stopping=f.stopping,U().setRunning(I.sessionId,f.running);break;case"approval.request":I.approvals.some(E=>E.requestId===f.request.requestId)||(I.approvals=[...I.approvals,f.request]);break;case"approval.cancelled":y(I,f.requestId);break;case"session.closed":I.status="closed",I.running=!1,I.approvals=[],U().forget(I.sessionId);break}}function v(c){c.publishTimer??(c.publishTimer=setTimeout(()=>p(c),Ps))}function p(c){var f;clearTimeout(c.publishTimer),c.publishTimer=void 0,c.view.rows=c.projection.rows.slice(),c.view.model=c.projection.model??((f=U().byId.get(c.view.sessionId))==null?void 0:f.model)}function g(){clearTimeout(e),e=setTimeout(()=>void U().refresh(),500)}function y(c,f){c.approvals=c.approvals.filter(I=>I.requestId!==f)}async function _(c,f){await n().call("session.submit",{sessionId:c,branchId:ae,submissionId:crypto.randomUUID(),text:f,mode:"queue"},_e)}async function $(c){await n().call("session.stop",{sessionId:c,branchId:ae,reason:"Stopped from the web workspace"},_e)}async function k(c,f,I){await n().call("approval.respond",{sessionId:c,branchId:f.branchId,requestId:f.requestId,decision:I},_e);const E=t[c];E!==void 0&&y(E,f.requestId)}async function w(c,f){const I=await n().call("session.model.update",{sessionId:c,branchId:ae,providerId:f.providerId,modelId:f.modelId},ks),E=s.get(c);E!==void 0&&(E.projection.model=I.model,p(E))}return{views:t,open:o,resync:i,receive:r,submit:_,stop:$,respond:k,setModel:w}}),Fs=4e3,Ye=pe("toast",()=>{const t=A([]),s=new Map;let e=0;function n(r){clearTimeout(s.get(r)),s.delete(r),t.value=t.value.filter(u=>u.id!==r)}function o(r){clearTimeout(s.get(r)),s.set(r,setTimeout(()=>n(r),Fs))}function i(r){clearTimeout(s.get(r)),s.delete(r)}function a(r){const u=++e,v=[...t.value,{...r,id:u}];for(const p of v.slice(0,-3))i(p.id);t.value=v.slice(-3),o(u)}return{toasts:t,push:a,dismiss:n,pause:i,resume:o}}),Ws="modulepreload",Ds=function(t){return"/"+t},rt={},Tt=function(s,e,n){let o=Promise.resolve();if(e&&e.length>0){let a=function(v){return Promise.all(v.map(p=>Promise.resolve(p).then(g=>({status:"fulfilled",value:g}),g=>({status:"rejected",reason:g}))))};document.getElementsByTagName("link");const r=document.querySelector("meta[property=csp-nonce]"),u=(r==null?void 0:r.nonce)||(r==null?void 0:r.getAttribute("nonce"));o=a(e.map(v=>{if(v=Ds(v),v in rt)return;rt[v]=!0;const p=v.endsWith(".css"),g=p?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${v}"]${g}`))return;const y=document.createElement("link");if(y.rel=p?"stylesheet":Ws,p||(y.as="script"),y.crossOrigin="",y.href=v,u&&y.setAttribute("nonce",u),document.head.appendChild(y),p)return new Promise((_,$)=>{y.addEventListener("load",_),y.addEventListener("error",()=>$(new Error(`Unable to preload CSS for ${v}`)))})}))}function i(a){const r=new Event("vite:preloadError",{cancelable:!0});if(r.payload=a,window.dispatchEvent(r),!r.defaultPrevented)throw a}return o.then(a=>{for(const r of a||[])r.status==="rejected"&&i(r.reason);return s().catch(i)})},Ns={"a11y.mainContent":"Main content","a11y.primaryNavigation":"Primary navigation","a11y.workspaceSessionIndex":"Workspace and session index","auth.connectingTitle":"Connecting to Dim…","auth.expiredTitle":"This link has expired","auth.expiredBefore":"This browser is not signed in to the web workspace, or the workspace was reopened. Run ","auth.expiredAfter":" to get a fresh link.","auth.versionTitle":"Update the browser page","auth.versionDescription":"This page and the App Server speak different protocol versions. Reload the page; if it persists, run dimcode web again.","brand.product":"Dim","brand.webHost":"Web workspace","chat.assistant":"Dim","chat.composer":"Message composer","chat.copyFailed":"Clipboard access failed.","chat.emptyTimeline":"Send a message to begin.","chat.pathCopied":"Path copied","chat.removedDescription":"This session is closed or no longer exists on the App Server.","chat.removedTitle":"Session closed","chat.you":"You","common.close":"Close","common.loading":"Loading…","common.search":"Search","common.skipToContent":"Skip to content","composer.modelLoadRetry":"Load failed · Retry","composer.modelLoading":"Loading models…","composer.noModels":"No models available","composer.notConfigured":"Default model","composer.searchModels":"Search models...","composer.send":"Send","composer.sendMessage":"Send a message...","composer.stopResponse":"Stop response","connection.accessRequired":"Access required","connection.connecting":"Connecting","connection.host":"App Server","connection.live":"Live","connection.protocolError":"Unexpected data from the App Server","connection.reconnecting":"Reconnecting","connection.versionMismatch":"Version mismatch","detail.output":"Output","message.collapse":"Collapse message","message.copy":"Copy entire message","message.expand":"Show full message","message.quote":"Quote in the composer","newThread.pathLabel":"Absolute directory path","newThread.pathPlaceholder":"/path/to/project","newThread.selectWorkspace":"Select workspace...","newThread.title":"Start Build","newThread.usePath":"Use","newThread.workspaceRequired":"Choose a workspace or type an absolute directory.","page.notFoundDescription":"There is nothing at this address.","page.reconnecting":"Connection lost. Reconnecting…","prompt.actionRequest":"Dim wants to: {action}","prompt.allowOnce":"Allow once","prompt.awaitingApproval":"Awaiting approval","prompt.input":"Input","prompt.permissionSubmitFailed":"Failed to submit tool permission","prompt.reject":"Reject","prompt.useTool":"Use a tool","route.newSession":"New session","route.notFound":"Page not found","route.session":"Session","sidebar.closeMenu":"Close navigation","sidebar.collapseWorkspace":"Collapse {name}","sidebar.expandWorkspace":"Expand {name}","sidebar.newInWorkspace":"New session in {name}","sidebar.newSession":"New session","sidebar.noMatches":"No workspaces or sessions match.","sidebar.noWorkspaces":"No sessions yet.","sidebar.openMenu":"Open navigation","sidebar.searchPlaceholder":"Search workspaces and sessions","sidebar.showLess":"Show less","sidebar.showMore":"Show more","sidebar.untitled":"New session","sidebar.workspaces":"Workspaces","status.running":"Running","status.stopping":"Stopping","timeline.copied":"Copied","timeline.copy":"Copy","timeline.noticeStopped":"Stopped","timeline.scrollToBottom":"Scroll to bottom","tool.edit":"Edit","tool.glob":"Find","tool.grep":"Search content","tool.listFiles":"List files","tool.read":"Read","tool.run":"Run","tool.runBackground":"Run (background)","tool.webFetch":"Fetch webpage","tool.webSearch":"Search web","tool.write":"Write","work.actionSeparator":", ","work.command":"{count} command | {count} commands","work.edit":"{count} edit | {count} edits","work.processing":"Processing","work.read":"{count} read | {count} reads","work.search":"{count} search | {count} searches","work.separator":" · ","work.thinking":"Thinking","work.thinkingSteps":"Thought once | Thought {count} times","work.thoughtFor":"Thought for {duration}","work.unknown":"{count} tool | {count} tools","work.webFetch":"{count} fetch | {count} fetches","work.webSearch":"{count} web search | {count} web searches"},js=()=>Tt(()=>import("./zh-CN-D1J2z6LG.js"),[]),de=Dt({legacy:!1,locale:"en",fallbackLocale:"en",messages:{en:Ns}});function Bs(t){return t.toLowerCase().startsWith("zh")?"zh-CN":"en"}async function Vs(t){const s=Bs(t);s==="zh-CN"&&!de.global.availableLocales.includes(s)&&de.global.setLocaleMessage(s,(await js()).default),de.global.locale.value=s}function Hs(t,s){return de.global.t(t,{})}const K=pe("connection",()=>{const t=A("connecting"),s=Ne(),e=A(!1),n=new As({phase(i){t.value=i},ready(i,a){s.value=i,e.value=!0,U().refresh(),a&&ye().resync()},notification(i){ye().receive(i)},invalid(i){console.error(i),Ye().push({tone:"danger",title:Hs("connection.protocolError"),description:i.message})}});function o(i){var a;return((a=s.value)==null?void 0:a.features.includes(i))??!1}return{phase:t,hello:s,everConnected:e,client:n,supports:o}}),Us=["data-state"],Ks=N({__name:"ConnectionBadge",setup(t){const s=K(),{t:e}=j(),n=S(()=>({connecting:e("connection.connecting"),connected:e("connection.live"),reconnecting:e("connection.reconnecting"),unauthenticated:e("connection.accessRequired"),"version-mismatch":e("connection.versionMismatch")})[s.phase]);return(o,i)=>(d(),m("div",{class:"connection-badge","aria-live":"polite","data-state":l(s).phase},[l(s).phase==="connected"?(d(),L(l(ps),{key:0,size:14,"aria-hidden":"true"})):(d(),L(l(hs),{key:1,size:14,"aria-hidden":"true"})),h("span",null,[h("strong",null,b(n.value),1),h("small",null,b(l(e)("connection.host")),1)])],8,Us))}}),Ys=1440*60*1e3;function lt(t){const s=new Date(t);return s.setHours(0,0,0,0),s.getTime()}function Gs(t,s,e=new Date){const n=new Intl.DateTimeFormat(s,{hour:"2-digit",minute:"2-digit",hour12:!1}).format(t);return lt(e)-lt(t)<7*Ys?`${new Intl.DateTimeFormat(s,{weekday:"long"}).format(t)} ${n}`:`${new Intl.DateTimeFormat(s,{...t.getFullYear()===e.getFullYear()?{}:{year:"numeric"},month:"short",day:"numeric"}).format(t)} ${n}`}function Zs(t,s=Date.now()){const e=Math.max(0,s-t.getTime());return e<6e4?"now":e<36e5?`${Math.floor(e/6e4)}m`:e<864e5?`${Math.floor(e/36e5)}h`:`${Math.floor(e/864e5)}d`}function Js(t){const s=Math.max(t,0),e=Math.floor(s/1e3);if(e<60)return e===0&&s>0?`${Math.round(s/100)/10}s`:`${e}s`;const n=Math.floor(e/60),o=e%60;return o>0?`${n}m ${o}s`:`${n}m`}const Xs={class:"workspace-group"},Qs=["aria-expanded","aria-label"],en={class:"workspace-disclosure","aria-hidden":"true"},tn=["data-open"],sn={class:"workspace-disclosure-icon"},nn=["title"],on={key:0,class:"workspace-running","aria-hidden":"true"},an={key:0,class:"session-list"},rn=["data-state"],ln={key:0},Oe=5,cn=20,dn=N({__name:"SidebarWorkspaceGroup",props:{workspace:{},expanded:{type:Boolean},activeSessionId:{},nowMs:{}},emits:["toggle","navigate"],setup(t,{emit:s}){const e=t,n=s,{t:o}=j(),i=A(Oe),a=S(()=>e.workspace.sessions.slice(0,i.value)),r=S(()=>e.workspace.sessions.length>i.value),u=S(()=>!e.expanded&&e.workspace.sessions.some(p=>p.running));function v(){i.value=r.value?i.value+cn:Oe}return(p,g)=>{const y=le("tooltip");return d(),m("section",Xs,[h("div",{class:"workspace-row",onClick:g[3]||(g[3]=_=>n("toggle"))},[h("button",{class:"workspace-toggle",type:"button","aria-expanded":t.expanded,"aria-label":l(o)(t.expanded?"sidebar.collapseWorkspace":"sidebar.expandWorkspace",{name:t.workspace.name}),onClick:g[0]||(g[0]=xe(_=>n("toggle"),["stop"]))},[h("span",en,[h("span",{class:"workspace-disclosure-chevron","data-open":t.expanded?"true":void 0},[R(l(Se),{size:14})],8,tn),h("span",sn,[t.expanded?(d(),L(l(os),{key:0,size:14})):(d(),L(l(Pe),{key:1,size:14}))])]),h("strong",{title:t.workspace.cwd},b(t.workspace.name),9,nn)],8,Qs),u.value?(d(),m("span",on,[R(l(Ve),{size:14,class:"is-spinning"})])):q("",!0),h("div",{class:"workspace-row-actions",onClick:g[2]||(g[2]=xe(()=>{},["stop"]))},[Y((d(),L(l(ge),{class:"ui-icon-button workspace-add","data-variant":"ghost","data-size":"sm",to:{name:"chat-new",query:{cwd:t.workspace.cwd}},"aria-label":l(o)("sidebar.newInWorkspace",{name:t.workspace.name}),onClick:g[1]||(g[1]=_=>n("navigate"))},{default:se(()=>[R(l(St),{"aria-hidden":"true"})]),_:1},8,["to","aria-label"])),[[y,l(o)("sidebar.newInWorkspace",{name:t.workspace.name})]])])]),t.expanded?(d(),m("ul",an,[(d(!0),m(W,null,B(a.value,_=>(d(),m("li",{key:_.sessionId},[R(l(ge),{class:"session-open",to:{name:"chat-session",params:{sessionId:_.sessionId}},"data-open":_.sessionId===t.activeSessionId?"true":void 0,"aria-current":_.sessionId===t.activeSessionId?"page":void 0,title:_.preview,onClick:g[4]||(g[4]=$=>n("navigate"))},{default:se(()=>[h("span",{class:"status-dot","data-state":_.running?"running":"idle","aria-hidden":"true"},null,8,rn),h("strong",null,b(_.preview??l(o)("sidebar.untitled")),1),h("small",null,b(l(Zs)(new Date(_.updatedAt),t.nowMs)),1)]),_:2},1032,["to","data-open","aria-current","title"])]))),128)),t.workspace.sessions.length>Oe?(d(),m("li",ln,[h("button",{class:"ui-button reveal-more","data-variant":"ghost","data-size":"sm",type:"button",onClick:v},[R(l(Se),{"data-open":r.value?void 0:"true","aria-hidden":"true"},null,8,["data-open"]),H(" "+b(l(o)(r.value?"sidebar.showMore":"sidebar.showLess")),1)])])):q("",!0)])):q("",!0)])}}}),un=ee(dn,[["__scopeId","data-v-883a0b20"]]),Et="dim-web.ui.v1";function hn(){const t={sidebarCollapsed:!1,collapsedWorkspaces:[],lastSessionId:void 0};try{const s=JSON.parse(localStorage.getItem(Et)??"null");if(s===null||typeof s!="object")return t;const e=s;return{sidebarCollapsed:e.sidebarCollapsed===!0,collapsedWorkspaces:Array.isArray(e.collapsedWorkspaces)?e.collapsedWorkspaces.filter(n=>typeof n=="string"):[],lastSessionId:typeof e.lastSessionId=="string"?e.lastSessionId:void 0}}catch{return t}}const fe=pe("ui",()=>{const t=hn(),s=A(t.sidebarCollapsed),e=A(t.collapsedWorkspaces),n=A(t.lastSessionId),o=A(!1),i=A(960),a=S(()=>i.value<720?"compact":i.value<960?"regular":"wide");G([s,e,n],()=>{try{localStorage.setItem(Et,JSON.stringify({sidebarCollapsed:s.value,collapsedWorkspaces:e.value,lastSessionId:n.value}))}catch{}},{deep:!0});const r=matchMedia("(prefers-color-scheme: dark)"),u=()=>{document.documentElement.classList.toggle("dark",r.matches)};u(),r.addEventListener("change",u);function v(y){i.value=y,a.value!=="compact"&&(o.value=!1)}function p(y){return!e.value.includes(y)}function g(y){e.value=p(y)?[...e.value,y]:e.value.filter(_=>_!==y)}return{sidebarCollapsed:s,lastSessionId:n,drawerOpen:o,shellWidth:i,shellMode:a,setShellWidth:v,isWorkspaceExpanded:p,toggleWorkspace:g}}),pn=["aria-label"],mn={class:"brand-row"},fn={class:"brand-copy"},vn=["aria-label"],gn=["aria-label"],yn={class:"sidebar-new-label"},bn={class:"ui-field-wrap sidebar-search"},wn=["placeholder","aria-label"],kn={class:"workspace-scroll app-scroll-viewport"},_n={class:"section-label"},In={key:0,class:"sidebar-empty",role:"alert"},$n={key:1,class:"sidebar-empty"},xn={class:"sidebar-footer"},Sn=N({__name:"AppSidebar",emits:["navigate"],setup(t){const{t:s}=j(),e=je(),n=U(),o=fe(),i=A(""),a=A(Date.now());let r;oe(()=>{r=setInterval(()=>{a.value=Date.now()},6e4)}),me(()=>clearInterval(r));const u=S(()=>typeof e.params.sessionId=="string"?e.params.sessionId:void 0),v=S(()=>{var _;return u.value===void 0||(_=n.byId.get(u.value))==null?void 0:_.cwd}),p=S(()=>({name:"chat-new",...v.value===void 0?{}:{query:{cwd:v.value}}})),g=S(()=>i.value.trim().toLocaleLowerCase()),y=S(()=>n.workspaces.flatMap(_=>{if(g.value==="")return[_];const k=_.name.toLocaleLowerCase().includes(g.value)||_.cwd.toLocaleLowerCase().includes(g.value)?_.sessions:_.sessions.filter(w=>{var c;return(c=w.preview)==null?void 0:c.toLocaleLowerCase().includes(g.value)});return k.length===0?[]:[{..._,sessions:k}]}));return(_,$)=>(d(),m("aside",{class:"app-sidebar","aria-label":l(s)("a11y.workspaceSessionIndex")},[h("header",mn,[R(Ee,{class:"brand-logo"}),h("strong",fn,b(l(s)("brand.product")),1),h("button",{class:"ui-icon-button sidebar-collapse","data-variant":"ghost","data-size":"sm",type:"button","aria-label":l(s)("sidebar.closeMenu"),onClick:$[0]||($[0]=k=>l(o).sidebarCollapsed=!0)},[R(l(rs),{"aria-hidden":"true"})],8,vn)]),h("nav",{class:"primary-actions","aria-label":l(s)("a11y.primaryNavigation")},[R(l(ge),{class:"ui-button sidebar-new","data-variant":"secondary","data-size":"md",to:p.value,onClick:$[1]||($[1]=k=>_.$emit("navigate"))},{default:se(()=>[R(l(St),{"aria-hidden":"true"}),h("span",yn,b(l(s)("sidebar.newSession")),1)]),_:1},8,["to"])],8,gn),h("div",bn,[R(l(He),{"aria-hidden":"true"}),Y(h("input",{"onUpdate:modelValue":$[2]||($[2]=k=>i.value=k),class:"ui-field","data-size":"md",type:"search",placeholder:l(s)("sidebar.searchPlaceholder"),"aria-label":l(s)("common.search")},null,8,wn),[[Te,i.value]])]),h("div",kn,[h("p",_n,b(l(s)("sidebar.workspaces")),1),l(n).error&&!l(n).loaded?(d(),m("p",In,b(l(n).error),1)):l(n).loaded&&y.value.length===0?(d(),m("p",$n,b(l(s)(g.value?"sidebar.noMatches":"sidebar.noWorkspaces")),1)):q("",!0),(d(!0),m(W,null,B(y.value,k=>(d(),L(un,{key:k.cwd,workspace:k,expanded:g.value!==""||l(o).isWorkspaceExpanded(k.cwd),"active-session-id":u.value,"now-ms":a.value,onToggle:w=>l(o).toggleWorkspace(k.cwd),onNavigate:$[3]||($[3]=w=>_.$emit("navigate"))},null,8,["workspace","expanded","active-session-id","now-ms","onToggle"]))),128))]),h("footer",xn,[R(Ks)])],8,pn))}}),ct=ee(Sn,[["__scopeId","data-v-716c88db"]]),Mn=["role","onMouseenter","onMouseleave","onFocusin","onFocusout"],Cn=["data-tone"],Tn={class:"ui-toast-title"},En={key:0,class:"ui-toast-description"},An=["onClick"],On=["aria-label","onClick"],qn=N({__name:"ToastRegion",setup(t){const{t:s}=j(),e=Ye();function n(o){var i;e.dismiss(o.id),(i=o.action)==null||i.run()}return(o,i)=>(d(),L(Nt,{name:"ui-toast",tag:"div",class:"ui-toast-region","aria-live":"polite"},{default:se(()=>[(d(!0),m(W,null,B(l(e).toasts,a=>(d(),m("div",{key:a.id,class:"ui-toast",role:a.tone==="danger"?"alert":"status",onMouseenter:r=>l(e).pause(a.id),onMouseleave:r=>l(e).resume(a.id),onFocusin:r=>l(e).pause(a.id),onFocusout:r=>l(e).resume(a.id)},[h("span",{class:"ui-toast-icon","data-tone":a.tone},[a.tone==="danger"?(d(),L(l(Fe),{key:0,"aria-hidden":"true"})):a.tone==="info"?(d(),L(l(as),{key:1,"aria-hidden":"true"})):(d(),L(l(we),{key:2,"aria-hidden":"true"}))],8,Cn),h("div",null,[h("p",Tn,b(a.title),1),a.description?(d(),m("p",En,b(a.description),1)):q("",!0)]),a.action?(d(),m("button",{key:0,type:"button",class:"ui-button","data-variant":"ghost","data-size":"xs",onClick:r=>n(a)},b(a.action.label),9,An)):(d(),m("button",{key:1,type:"button",class:"ui-icon-button","data-variant":"close","data-size":"xs","aria-label":l(s)("common.close"),onClick:r=>l(e).dismiss(a.id)},[R(l(Fe),{"aria-hidden":"true"})],8,On))],40,Mn))),128))]),_:1}))}}),Rn=["data-mode","data-sidebar-collapsed","data-chat-route"],zn={key:0,class:"compact-header"},Ln=["aria-label"],Pn={class:"compact-title"},Fn={class:"sr-only"},Wn=["aria-label"],Dn={class:"content-region"},Nn=["aria-label"],jn=["aria-label"],Bn={class:"main-header"},Vn={key:1,class:"reconnect-banner",role:"status"},dt="details.session-menu[open], details.composer-popover[open]",Hn=N({__name:"AppShell",setup(t){const s=je(),{t:e}=j(),n=K(),o=U(),i=fe(),a=A(),r=A();let u;const v=S(()=>s.name==="chat-new"||s.name==="chat-session"),p=S(()=>{if(s.name==="chat-session"&&typeof s.params.sessionId=="string"){const k=o.byId.get(s.params.sessionId);return(k==null?void 0:k.preview)??(k===void 0?e("route.session"):Ae(k.cwd))}return s.name==="not-found"?e("route.notFound"):e("route.newSession")});G(p,k=>{document.title=`${k} — Dim`},{immediate:!0}),G(()=>i.drawerOpen,async k=>{await ue();const w=r.value;w!==void 0&&(k&&!w.open?w.showModal():!k&&w.open&&w.close())});function g(k){const w=k.target instanceof Node?k.target:void 0;for(const c of document.querySelectorAll(dt))(w===void 0||!c.contains(w))&&(c.open=!1)}function y(k){if(k.key==="Escape"){for(const c of document.querySelectorAll(dt))c.open=!1;return}(navigator.userAgent.includes("Mac")?k.metaKey:k.ctrlKey)&&!k.altKey&&!k.shiftKey&&k.key.toLowerCase()==="b"&&(k.preventDefault(),i.shellMode==="compact"?i.drawerOpen=!i.drawerOpen:i.sidebarCollapsed=!i.sidebarCollapsed)}function _(){n.phase==="connected"&&o.refresh()}oe(()=>{a.value!==void 0&&(u=new ResizeObserver(([k])=>{k!==void 0&&i.setShellWidth(k.contentRect.width)}),u.observe(a.value)),window.addEventListener("keydown",y),window.addEventListener("focus",_),document.addEventListener("pointerdown",g,!0)}),me(()=>{u==null||u.disconnect(),window.removeEventListener("keydown",y),window.removeEventListener("focus",_),document.removeEventListener("pointerdown",g,!0)});function $(k){k.target===r.value&&(i.drawerOpen=!1)}return(k,w)=>{var f;const c=le("tooltip");return d(),m("div",{ref_key:"root",ref:a,class:"app-shell","data-mode":l(i).shellMode,"data-sidebar-collapsed":l(i).sidebarCollapsed,"data-chat-route":v.value,style:{"--sidebar-width":"280px"}},[R(qn),l(i).shellMode==="compact"?(d(),m("header",zn,[h("button",{class:"ui-icon-button","data-variant":"ghost","data-size":"md",type:"button","aria-label":l(e)("sidebar.openMenu"),onClick:w[0]||(w[0]=I=>l(i).drawerOpen=!0)},[R(l(xt),{"aria-hidden":"true"})],8,Ln),h("span",Pn,b(p.value),1)])):q("",!0),l(i).shellMode==="compact"?(d(),m("dialog",{key:1,ref_key:"drawer",ref:r,class:"drawer-content",onClick:$,onClose:w[3]||(w[3]=I=>l(i).drawerOpen=!1)},[h("h2",Fn,b(l(e)("sidebar.workspaces")),1),h("button",{autofocus:"",class:"ui-icon-button drawer-close","data-variant":"ghost","data-size":"md",type:"button","aria-label":l(e)("sidebar.closeMenu"),onClick:w[1]||(w[1]=I=>l(i).drawerOpen=!1)},[R(l(Fe),{"aria-hidden":"true"})],8,Wn),R(ct,{onNavigate:w[2]||(w[2]=I=>l(i).drawerOpen=!1)})],544)):q("",!0),l(i).shellMode!=="compact"&&!l(i).sidebarCollapsed?(d(),L(ct,{key:2,class:"inline-sidebar"})):q("",!0),h("div",Dn,[h("main",{id:"main",class:"main-region","aria-label":l(e)("a11y.mainContent")},[l(i).sidebarCollapsed&&l(i).shellMode!=="compact"?Y((d(),m("button",{key:0,class:"ui-icon-button sidebar-reopen","data-variant":"ghost","data-size":"md",type:"button","aria-label":l(e)("sidebar.openMenu"),onClick:w[4]||(w[4]=I=>l(i).sidebarCollapsed=!1)},[R(l(ls),{"aria-hidden":"true"})],8,jn)),[[c,l(e)("sidebar.openMenu")]]):q("",!0),h("header",Bn,[h("div",null,[h("p",null,"Dim "+b((f=l(n).hello)==null?void 0:f.serverVersion),1),h("strong",null,b(p.value),1)])]),l(n).phase==="reconnecting"?(d(),m("p",Vn,b(l(e)("page.reconnecting")),1)):q("",!0),(d(),L(l(jt),{key:l(s).fullPath}))],8,Nn)])],8,Rn)}}}),Un={class:"skip-link",href:"#main"},Kn={key:1,id:"main",class:"boot-page",tabindex:"-1","aria-busy":"true"},Yn={class:"sr-only"},Gn={key:2,id:"main",class:"auth-page",tabindex:"-1"},Zn={class:"eyebrow"},Jn={key:0},Xn={key:1},Qn=N({__name:"AppRoot",setup(t){const{t:s}=j(),e=K(),n=S(()=>e.everConnected&&e.phase!=="unauthenticated"&&e.phase!=="version-mismatch"),o=S(()=>e.phase==="unauthenticated"?s("auth.expiredTitle"):e.phase==="version-mismatch"?s("auth.versionTitle"):s("auth.connectingTitle"));return G([n,o],([i,a])=>{i||(document.title=`${a} — Dim`)},{immediate:!0}),(i,a)=>(d(),m(W,null,[h("a",Un,b(l(s)("common.skipToContent")),1),n.value?(d(),L(Hn,{key:0})):l(e).phase==="connecting"||l(e).phase==="reconnecting"?(d(),m("main",Kn,[R(Ee,{animated:"",class:"boot-mark"}),h("h1",Yn,b(o.value),1)])):(d(),m("main",Gn,[a[1]||(a[1]=h("span",{class:"auth-signal","aria-hidden":"true"},null,-1)),h("p",Zn,b(l(s)("brand.webHost")),1),h("h1",null,b(o.value),1),l(e).phase==="unauthenticated"?(d(),m("p",Jn,[H(b(l(s)("auth.expiredBefore")),1),a[0]||(a[0]=h("code",null,"dimcode web",-1)),H(b(l(s)("auth.expiredAfter")),1)])):(d(),m("p",Xn,b(l(s)("auth.versionDescription")),1))]))],64))}}),eo=400,to=300,ut=6,qe=8,Ge="ui-tooltip";let V,Q,be,At=0,We=null,Ze=!1;function so(){return V!==void 0||(V=document.createElement("div"),V.id=Ge,V.className="ui-tooltip",V.setAttribute("role","tooltip"),V.popover="manual",Object.assign(V.style,{position:"fixed",inset:"auto",margin:"0",border:"0",overflow:"visible"}),document.body.append(V)),V}function Ce(t){clearTimeout(be);const s=t._tooltip;if(!s||!t.isConnected)return;const e=so();e.textContent=s,e.matches(":popover-open")||e.showPopover(),Q=t,t.getAttribute("aria-label")!==s&&t.setAttribute("aria-describedby",Ge),no(t,e)}function no(t,s){const e=t.getBoundingClientRect(),n=s.getBoundingClientRect(),o=e.top-ut-n.height,i=o>=qe?o:e.bottom+ut,a=e.left+e.width/2-n.width/2,r=Math.min(Math.max(a,qe),window.innerWidth-qe-n.width);s.style.left=`${Math.round(r)}px`,s.style.top=`${Math.round(i)}px`}function te(){clearTimeout(be),be=void 0,Q!==void 0&&(Q.getAttribute("aria-describedby")===Ge&&Q.removeAttribute("aria-describedby"),Q=void 0,V!=null&&V.matches(":popover-open")&&V.hidePopover())}function oo(t){const s=t.currentTarget;clearTimeout(be),!Ze&&(performance.now()<At?Ce(s):be=setTimeout(()=>Ce(s),eo))}function io(){Q!==void 0&&(At=performance.now()+to),te()}function ao(t){const s=t.currentTarget;if(s===We){We=null;return}s.matches(":focus-visible")&&Ce(s)}function ro(t){Ze=t.pointerType==="touch",Q!==void 0&&!(t.target instanceof Node&&Q.contains(t.target))&&te()}function lo(){We=document.activeElement,te()}function co(t){t.key==="Escape"&&te()}const ht=[["mouseenter",oo],["mouseleave",io],["focus",ao],["blur",te],["pointerdown",te],["keydown",co]];let pt=!1;function uo(){pt||(pt=!0,window.addEventListener("scroll",te,{capture:!0,passive:!0}),window.addEventListener("blur",lo),document.addEventListener("pointermove",ro,{passive:!0}),document.addEventListener("pointerdown",t=>{Ze=t.pointerType==="touch"},{capture:!0,passive:!0}))}const ho={mounted(t,s){t._tooltip=s.value;for(const[e,n]of ht)t.addEventListener(e,n);uo()},updated(t,s){t._tooltip=s.value,Q===t&&(s.value?Ce(t):te())},beforeUnmount(t){Q===t&&te();for(const[s,e]of ht)t.removeEventListener(s,e)}};let po;function Ot(){return po??(po=Tt(async()=>{const{default:t}=await import("./index-DR4aU0C0.js").then(s=>s.a4);return{default:t}},__vite__mapDeps([0,1])).then(({default:t})=>t))}const mt={read:"tool.read",read_file:"tool.read",write:"tool.write",write_file:"tool.write",edit:"tool.edit",edit_file:"tool.edit",apply_patch:"tool.edit",grep:"tool.grep",rg:"tool.grep",glob:"tool.glob"};function mo(t){const s=t.trim().toLowerCase();return s.split(/(?:__|[./\s:-])+/).filter(Boolean).at(-1)??s}function Je(t,s){const e=t.trim().toLowerCase();if(e.startsWith("mcp__"))return{renderer:"generic",labelKey:"prompt.useTool"};const n=mo(t);if(["exec","bash","shell","run_command","exec_command"].includes(n))return{renderer:"command",labelKey:s.runInBackground===!0?"tool.runBackground":"tool.run"};if(["grep","rg","glob","find","ls","list_files"].includes(n)){const o=typeof s.pattern=="string"?s.pattern:void 0;return{renderer:"search",labelKey:n==="glob"&&(!o||o==="*")?"tool.listFiles":mt[n]??"tool.grep"}}return["read","read_file","write","write_file","edit","edit_file","apply_patch"].includes(n)?{renderer:"file",labelKey:mt[n]??"tool.edit"}:e.includes("web_search")||n==="websearch"?{renderer:"web",labelKey:"tool.webSearch"}:e.includes("web_fetch")||n==="webfetch"?{renderer:"web",labelKey:"tool.webFetch"}:{renderer:"generic",labelKey:"prompt.useTool"}}function qt(t,s){if(s!==void 0)return s.split(`
169
+ `).filter(o=>!o.startsWith("---")&&!o.startsWith("+++")&&!o.startsWith("@@")).map(o=>{const i=o.startsWith("+")?"+":o.startsWith("-")?"-":" ";return{sign:i,text:i===" "?o.replace(/^ /,""):o.slice(1)}});const e=typeof t.oldText=="string"?t.oldText:void 0,n=typeof t.newText=="string"?t.newText:void 0;return e===void 0||n===void 0?[]:[...e.split(`
170
+ `).map(o=>({sign:"-",text:o})),...n.split(`
171
+ `).map(o=>({sign:"+",text:o}))]}const fo={class:"prompt-card","data-inline-interaction-prompt":""},vo={class:"prompt-header"},go={class:"prompt-icon","aria-hidden":"true"},yo={class:"prompt-title"},bo={class:"ui-badge","data-tone":"warning"},wo={key:0,class:"prompt-subtitle"},ko={key:1,class:"approval-command"},_o={key:0,class:"approval-muted"},Io={key:2,class:"approval-panel"},$o={class:"approval-panel-header"},xo={key:0,class:"approval-panel-body"},So={key:1,class:"approval-panel-body"},Mo={class:"approval-line-number"},Co={key:3,class:"approval-panel"},To={class:"approval-panel-header"},Eo={class:"approval-panel-body"},Ao={key:0},Oo={key:1},qo={key:2},Ro={key:3,class:"approval-muted"},zo={key:4,class:"approval-panel"},Lo={class:"approval-panel-header is-mono"},Po={class:"approval-panel-body"},Fo={key:5,class:"approval-panel"},Wo={class:"approval-panel-body approval-muted"},Do={key:6,class:"prompt-error",role:"alert"},No={class:"prompt-buttons"},jo=["disabled"],Bo=["disabled"],Vo=N({__name:"ApprovalPrompt",props:{sessionId:{},request:{}},setup(t){const s=t,{t:e}=j(),n=ye(),o=A(!1),i=A(""),a=S(()=>s.request.call.input),r=S(()=>Je(s.request.call.name,a.value)),u={command:us,search:He,file:ns,web:is,generic:ms};function v(w){const c=a.value[w];return typeof c=="string"&&c.trim()!==""?c:void 0}const p=S(()=>s.request.call.name.trim().toLowerCase()),g=S(()=>p.value==="edit"?qt(a.value,void 0):[]),y=S(()=>p.value==="write"?v("content"):void 0),_=S(()=>Object.entries(a.value).filter(([w])=>!["command","cwd","path","pattern","oldText","newText","content","query","url"].includes(w)).map(([w,c])=>({key:w,value:typeof c=="string"?c:JSON.stringify(c)})));async function $(w){if(!o.value){o.value=!0,i.value="";try{await n.respond(s.sessionId,s.request,w)}catch(c){i.value=c instanceof Error&&c.message?c.message:e("prompt.permissionSubmitFailed"),o.value=!1}}}function k(w){if(o.value||w.defaultPrevented||document.querySelector("dialog[open]")!==null)return;const c=w.target;c instanceof HTMLElement&&(c.tagName==="INPUT"||c.tagName==="TEXTAREA"||c.isContentEditable)||(w.key==="Enter"||w.key==="y"||w.key==="Y"?(w.preventDefault(),$("allow")):(w.key==="Escape"||w.key==="n"||w.key==="N")&&(w.preventDefault(),$("deny")))}return oe(()=>window.addEventListener("keydown",k)),me(()=>window.removeEventListener("keydown",k)),(w,c)=>(d(),m("article",fo,[h("header",vo,[h("span",go,[(d(),L(_t(u[r.value.renderer]),{size:12,"stroke-width":2.25}))]),h("h2",yo,b(l(e)("prompt.actionRequest",{action:r.value.renderer==="generic"?t.request.call.name:l(e)(r.value.labelKey)})),1),h("span",bo,b(l(e)("prompt.awaitingApproval")),1)]),t.request.reason?(d(),m("p",wo,b(t.request.reason),1)):q("",!0),r.value.renderer==="command"?(d(),m("div",ko,[h("div",null,[c[2]||(c[2]=h("span",{class:"approval-muted"},"$",-1)),H(" "+b(v("command")),1)]),v("cwd")?(d(),m("div",_o," cwd: "+b(v("cwd")),1)):q("",!0)])):r.value.renderer==="file"?(d(),m("div",Io,[h("div",$o,b(v("path")??t.request.call.name),1),g.value.length?(d(),m("div",xo,[(d(!0),m(W,null,B(g.value,(f,I)=>(d(),m("div",{key:I,class:J(f.sign==="-"?"approval-diff-del":"approval-diff-add")},b(f.sign)+" "+b(f.text),3))),128))])):y.value!==void 0?(d(),m("div",So,[(d(!0),m(W,null,B(y.value.split(`
172
+ `),(f,I)=>(d(),m("div",{key:I,class:"approval-code-line"},[h("span",Mo,b(I+1),1),H(b(f),1)]))),128))])):q("",!0)])):r.value.renderer==="search"||r.value.renderer==="web"?(d(),m("div",Co,[h("div",To,b(l(e)("prompt.input")),1),h("div",Eo,[v("pattern")?(d(),m("div",Ao,"pattern: "+b(v("pattern")),1)):q("",!0),v("query")?(d(),m("div",Oo,"query: "+b(v("query")),1)):q("",!0),v("url")?(d(),m("div",qo,"url: "+b(v("url")),1)):q("",!0),v("path")?(d(),m("div",Ro,"path: "+b(v("path")),1)):q("",!0)])])):(d(),m("div",zo,[h("div",Lo,b(t.request.call.name),1),h("pre",Po,b(JSON.stringify(a.value,null,2)),1)])),r.value.renderer!=="generic"&&_.value.length?(d(),m("div",Fo,[h("div",Wo,[(d(!0),m(W,null,B(_.value,f=>(d(),m("div",{key:f.key},b(f.key)+": "+b(f.value),1))),128))])])):q("",!0),i.value?(d(),m("p",Do,b(i.value),1)):q("",!0),h("div",No,[h("button",{type:"button",class:"ui-button","data-size":"md","data-variant":"ghost",disabled:o.value,onClick:c[0]||(c[0]=f=>$("deny"))},b(l(e)("prompt.reject")),9,jo),h("button",{type:"button",class:"ui-button","data-size":"md","data-variant":"primary",disabled:o.value,onClick:c[1]||(c[1]=f=>$("allow"))},b(l(e)("prompt.allowOnce")),9,Bo)])]))}}),Rt=pe("models",()=>{const t=A(),s=A("");let e;const n=S(()=>{const u=K();return u.supports("provider.list")&&u.supports("provider.catalog")});function o(){return e??(e=i().finally(()=>{e=void 0})),e}async function i(){const u=K().client;s.value="";try{const p=(await u.call("provider.list",{},_s)).filter(y=>y.enabled&&y.credentialConfigured),g=await Promise.all(p.map(y=>u.call("provider.catalog",{providerId:y.providerId},Is).catch(()=>{})));t.value=p.flatMap((y,_)=>{const $=g[_];if($===void 0)return[];const k=new Set($.disabledModelIds),w=$.models.filter(c=>c.unavailableReason===void 0&&!k.has(c.id));return w.length===0?[]:[{providerId:y.providerId,name:y.displayName,models:w}]})}catch(v){s.value=v instanceof Error?v.message:String(v)}}async function a(u){if(K().supports("provider.selection"))return K().client.call("provider.selection",{cwd:u},$s).catch(()=>{})}function r(u){var p,g;const v=(p=t.value)==null?void 0:p.find(y=>y.providerId===u.providerId);return((g=v==null?void 0:v.models.find(y=>y.id===u.modelId))==null?void 0:g.name)??u.modelId}return{providers:t,error:s,available:n,load:o,defaultFor:a,nameOf:r}}),Ho={key:0,class:"ui-button model-trigger","data-variant":"ghost","data-size":"sm","aria-disabled":"true"},Uo={class:"model-trigger-label"},Ko={class:"ui-button model-trigger","data-variant":"ghost","data-size":"sm"},Yo={key:0,class:"provider-badge","aria-hidden":"true"},Go={class:"model-trigger-label"},Zo={class:"composer-popover-content is-end ui-popover model-content","data-width":"xl"},Jo={class:"ui-menu-search model-search"},Xo=["placeholder","aria-label"],Qo={key:0,class:"menu-empty"},ei={key:1,class:"menu-empty"},ti={key:2,class:"model-panes"},si={key:0,class:"provider-pane"},ni=["aria-current","onClick"],oi={class:"provider-badge","aria-hidden":"true"},ii=["aria-label"],ai={key:0,class:"menu-empty"},ri=["aria-selected","data-highlighted","title","onMouseenter","onClick"],li={class:"model-check"},ci={key:0,class:"provider-badge","aria-hidden":"true"},di={class:"model-name"},ui=N({__name:"ComposerModelMenu",props:{model:{},selectable:{type:Boolean},disabled:{type:Boolean}},emits:["select"],setup(t,{emit:s}){const e=t,n=s,{t:o}=j(),i=Rt(),a=A(),r=A(),u=A(""),v=A(),p=A(0),g=S(()=>i.providers??[]),y=S(()=>g.value.flatMap(C=>C.models.map(x=>({providerId:C.providerId,providerName:C.name,modelId:x.id,name:x.name})))),_=S(()=>u.value.trim()!==""),$=S(()=>{if(!_.value)return y.value.filter(x=>x.providerId===v.value);const C=u.value.trim().toLocaleLowerCase();return y.value.filter(x=>[x.name,x.modelId,x.providerName].some(T=>T.toLocaleLowerCase().includes(C)))}),k=S(()=>e.model===void 0?o("composer.notConfigured"):i.nameOf(e.model));oe(()=>{e.selectable&&i.available&&i.providers===void 0&&i.load()});function w(C){var x;return C.providerId===((x=e.model)==null?void 0:x.providerId)&&C.modelId===e.model.modelId}function c(C){return C.trim().charAt(0).toLocaleUpperCase()}async function f(){var C,x,T,O;((C=a.value)==null?void 0:C.open)===!0&&(i.providers===void 0&&await i.load(),u.value="",v.value=((x=e.model)==null?void 0:x.providerId)??((T=g.value[0])==null?void 0:T.providerId),p.value=Math.max(0,$.value.findIndex(w)),await ue(),matchMedia("(pointer: coarse)").matches||(O=r.value)==null||O.focus())}function I(C){a.value&&(a.value.open=!1),w(C)||n("select",{providerId:C.providerId,modelId:C.modelId})}function E(C){if(C.key==="ArrowDown")C.preventDefault(),p.value=Math.min($.value.length-1,p.value+1);else if(C.key==="ArrowUp")C.preventDefault(),p.value=Math.max(0,p.value-1);else if(C.key==="Enter"){C.preventDefault();const x=$.value[p.value];x!==void 0&&I(x)}}return(C,x)=>{const T=le("tooltip");return!t.selectable||!l(i).available?(d(),m("span",Ho,[h("span",Uo,b(k.value),1)])):(d(),m("details",{key:1,ref_key:"details",ref:a,class:J(["composer-popover model-menu",{"is-disabled":t.disabled}]),onToggle:f},[Y((d(),m("summary",Ko,[t.model?(d(),m("span",Yo,b(c(t.model.providerId)),1)):q("",!0),h("span",Go,b(k.value),1)])),[[T,t.model?`${k.value} · ${t.model.providerId}`:void 0]]),h("div",Zo,[h("label",Jo,[R(l(He),{"aria-hidden":"true"}),Y(h("input",{ref_key:"searchInput",ref:r,"onUpdate:modelValue":x[0]||(x[0]=O=>u.value=O),type:"text",placeholder:l(o)("composer.searchModels"),"aria-label":l(o)("composer.searchModels"),onKeydown:E,onInput:x[1]||(x[1]=O=>p.value=0)},null,40,Xo),[[Te,u.value]])]),l(i).providers===void 0&&!l(i).error?(d(),m("p",Qo,[R(l(Ve),{class:"is-spinning","aria-hidden":"true"}),H(b(l(o)("composer.modelLoading")),1)])):l(i).error?(d(),m("p",ei,[h("button",{type:"button",class:"ui-button","data-variant":"danger-ghost","data-size":"sm",onClick:x[2]||(x[2]=O=>l(i).load())},b(l(o)("composer.modelLoadRetry")),1)])):(d(),m("div",ti,[_.value?q("",!0):(d(),m("div",si,[(d(!0),m(W,null,B(g.value,O=>(d(),m("button",{key:O.providerId,type:"button",class:"ui-menu-item","aria-current":v.value===O.providerId,onClick:z=>{v.value=O.providerId,p.value=0}},[h("span",oi,b(c(O.name)),1),h("span",null,b(O.name),1)],8,ni))),128))])),h("div",{class:"model-pane",role:"listbox","aria-label":l(o)("composer.searchModels")},[$.value.length===0?(d(),m("p",ai,b(l(o)("composer.noModels")),1)):q("",!0),(d(!0),m(W,null,B($.value,(O,z)=>(d(),m("button",{key:`${O.providerId}:${O.modelId}`,type:"button",role:"option",class:"ui-menu-item","aria-selected":w(O),"data-highlighted":z===p.value?"":void 0,title:`${O.name} · ${O.providerName}`,onMouseenter:Z=>p.value=z,onClick:Z=>I(O)},[h("span",li,[w(O)?(d(),L(l(we),{key:0,"aria-hidden":"true"})):q("",!0)]),_.value?(d(),m("span",ci,b(c(O.providerName)),1)):q("",!0),h("span",di,b(O.name),1)],40,ri))),128))],8,ii)]))])],34))}}}),hi=ee(ui,[["__scopeId","data-v-2d7995f0"]]);function pi(t,s){let e=s.replaceAll(`\r
173
+ `,`
174
+ `);if(e.endsWith(`
175
+ `)&&(e=e.slice(0,-1)),e==="")return t;const n=e.split(`
176
+ `).map(i=>i===""?`>
177
+ `:`> ${i}
178
+ `).join(""),o=t===""||t.endsWith(`
179
+
180
+ `)?"":t.endsWith(`
181
+ `)?`
182
+ `:`
183
+
184
+ `;return`${t}${o}${n}
185
+ `}const mi=["aria-label"],fi={key:0,class:"inline-error",role:"alert"},vi=["placeholder","aria-label"],gi={class:"composer-toolbar"},yi={class:"composer-run-group"},bi=["data-variant","aria-label","disabled"],wi={key:1,class:"composer-statusbar"},ki={class:"composer-status-start"},_i=N({__name:"ComposerPanel",props:{running:{type:Boolean},stopping:{type:Boolean},model:{},modelSelectable:{type:Boolean},send:{type:Function},stop:{type:Function},selectModel:{type:Function}},setup(t,{expose:s}){const e=t,{t:n}=j(),o=A(),i=A(""),a=A(!1),r=A(!1),u=A(""),v=S(()=>e.running&&e.stop!==void 0&&i.value.trim()===""),p=S(()=>i.value.trim()!==""&&!a.value);function g(){const c=o.value;c!==void 0&&(c.style.height="auto",c.style.height=`${Math.min(c.scrollHeight,300)}px`)}async function y(){if(!p.value)return;const c=i.value;a.value=!0,u.value="";try{await e.send(c),i.value===c&&(i.value=""),await ue(),g()}catch(f){u.value=f instanceof Error?f.message:String(f)}finally{a.value=!1}}async function _(){var c;u.value="";try{await((c=e.stop)==null?void 0:c.call(e))}catch(f){u.value=f instanceof Error?f.message:String(f)}}async function $(c){r.value=!0,u.value="";try{await e.selectModel(c)}catch(f){u.value=f instanceof Error?f.message:String(f)}finally{r.value=!1}}function k(c){c.key==="Enter"&&!c.shiftKey&&!c.altKey&&!c.isComposing&&(c.preventDefault(),y())}async function w(c){i.value=pi(i.value,c),await ue(),g();const f=o.value;f==null||f.focus(),f==null||f.setSelectionRange(i.value.length,i.value.length)}return oe(()=>{var c;return(c=o.value)==null?void 0:c.focus()}),s({focus:()=>{var c;return(c=o.value)==null?void 0:c.focus()},quote:w}),(c,f)=>{const I=le("tooltip");return d(),m("section",{class:"composer-panel","aria-label":l(n)("chat.composer")},[u.value?(d(),m("p",fi,b(u.value),1)):q("",!0),h("div",{class:"composer-surface",onClick:f[2]||(f[2]=E=>{var C;return(C=o.value)==null?void 0:C.focus()})},[Y(h("textarea",{ref_key:"field",ref:o,"onUpdate:modelValue":f[0]||(f[0]=E=>i.value=E),class:"composer-input",rows:"2",placeholder:l(n)("composer.sendMessage"),"aria-label":l(n)("composer.sendMessage"),onInput:g,onKeydown:k},null,40,vi),[[Te,i.value]]),h("footer",gi,[f[3]||(f[3]=h("div",{class:"composer-tool-group"},null,-1)),h("div",yi,[R(hi,{model:t.model,selectable:t.modelSelectable,disabled:r.value,onSelect:$},null,8,["model","selectable","disabled"]),Y((d(),m("button",{class:"ui-icon-button","data-variant":v.value?"contrast":"primary","data-size":"sm",type:"button","aria-label":v.value?l(n)("composer.stopResponse"):l(n)("composer.send"),disabled:v.value?t.stopping:!p.value,onClick:f[1]||(f[1]=xe(E=>v.value?_():y(),["stop"]))},[v.value?(d(),L(l(ds),{key:0,fill:"currentColor","aria-hidden":"true"})):(d(),L(l(ts),{key:1,"stroke-width":2.25,"aria-hidden":"true"}))],8,bi)),[[I,v.value?l(n)("composer.stopResponse"):l(n)("composer.send")]])])])]),c.$slots.status?(d(),m("div",wi,[h("div",ki,[Bt(c.$slots,"status",{},void 0,!0)])])):q("",!0)],8,mi)}}}),zt=ee(_i,[["__scopeId","data-v-b6454220"]]);function ce(t,s,e){let n=e.initialDeps??[],o,i=!0;function a(){var r,u,v;let p;e.key&&((r=e.debug)!=null&&r.call(e))&&(p=Date.now());const g=t();if(!(g.length!==n.length||g.some(($,k)=>n[k]!==$)))return o;n=g;let _;if(e.key&&((u=e.debug)!=null&&u.call(e))&&(_=Date.now()),o=s(...g),e.key&&((v=e.debug)!=null&&v.call(e))){const $=Math.round((Date.now()-p)*100)/100,k=Math.round((Date.now()-_)*100)/100,w=k/16,c=(f,I)=>{for(f=String(f);f.length<I;)f=" "+f;return f};console.info(`%c⏱ ${c(k,5)} /${c($,5)} ms`,`
186
+ font-size: .6rem;
187
+ font-weight: bold;
188
+ color: hsl(${Math.max(0,Math.min(120-120*w,120))}deg 100% 31%);`,e==null?void 0:e.key)}return e!=null&&e.onChange&&!(i&&e.skipInitialOnChange)&&e.onChange(o),i=!1,o}return a.updateDeps=r=>{n=r},a}function ft(t,s){if(t===void 0)throw new Error("Unexpected undefined");return t}const Ii=(t,s)=>Math.abs(t-s)<1.01,$i=(t,s,e)=>{let n;return function(...o){t.clearTimeout(n),n=t.setTimeout(()=>s.apply(this,o),e)}},vt=t=>{const{offsetWidth:s,offsetHeight:e}=t;return{width:s,height:e}},xi=t=>t,Si=t=>{const s=Math.max(t.startIndex-t.overscan,0),e=Math.min(t.endIndex+t.overscan,t.count-1),n=[];for(let o=s;o<=e;o++)n.push(o);return n},Mi=(t,s)=>{const e=t.scrollElement;if(!e)return;const n=t.targetWindow;if(!n)return;const o=a=>{const{width:r,height:u}=a;s({width:Math.round(r),height:Math.round(u)})};if(o(vt(e)),!n.ResizeObserver)return()=>{};const i=new n.ResizeObserver(a=>{const r=()=>{const u=a[0];if(u!=null&&u.borderBoxSize){const v=u.borderBoxSize[0];if(v){o({width:v.inlineSize,height:v.blockSize});return}}o(vt(e))};t.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(r):r()});return i.observe(e,{box:"border-box"}),()=>{i.unobserve(e)}},gt={passive:!0},yt=typeof window>"u"?!0:"onscrollend"in window,Ci=(t,s)=>{const e=t.scrollElement;if(!e)return;const n=t.targetWindow;if(!n)return;let o=0;const i=t.options.useScrollendEvent&&yt?()=>{}:$i(n,()=>{s(o,!1)},t.options.isScrollingResetDelay),a=p=>()=>{const{horizontal:g,isRtl:y}=t.options;o=g?e.scrollLeft*(y&&-1||1):e.scrollTop,i(),s(o,p)},r=a(!0),u=a(!1);e.addEventListener("scroll",r,gt);const v=t.options.useScrollendEvent&&yt;return v&&e.addEventListener("scrollend",u,gt),()=>{e.removeEventListener("scroll",r),v&&e.removeEventListener("scrollend",u)}},Ti=(t,s,e)=>{if(s!=null&&s.borderBoxSize){const n=s.borderBoxSize[0];if(n)return Math.round(n[e.options.horizontal?"inlineSize":"blockSize"])}return t[e.options.horizontal?"offsetWidth":"offsetHeight"]},Ei=(t,{adjustments:s=0,behavior:e},n)=>{var o,i;const a=t+s;(i=(o=n.scrollElement)==null?void 0:o.scrollTo)==null||i.call(o,{[n.options.horizontal?"left":"top"]:a,behavior:e})};class Ai{constructor(s){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollState=null,this.measurementsCache=[],this.itemSizeCache=new Map,this.laneAssignments=new Map,this.pendingMeasuredCacheIndexes=[],this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this.elementsCache=new Map,this.now=()=>{var e,n,o;return((o=(n=(e=this.targetWindow)==null?void 0:e.performance)==null?void 0:n.now)==null?void 0:o.call(n))??Date.now()},this.observer=(()=>{let e=null;const n=()=>e||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:e=new this.targetWindow.ResizeObserver(o=>{o.forEach(i=>{const a=()=>{const r=i.target,u=this.indexFromElement(r);if(!r.isConnected){this.observer.unobserve(r),this.elementsCache.delete(this.options.getItemKey(u));return}this.shouldMeasureDuringScroll(u)&&this.resizeItem(u,this.options.measureElement(r,i,this))};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(a):a()})}));return{disconnect:()=>{var o;(o=n())==null||o.disconnect(),e=null},observe:o=>{var i;return(i=n())==null?void 0:i.observe(o,{box:"border-box"})},unobserve:o=>{var i;return(i=n())==null?void 0:i.unobserve(o)}}})(),this.range=null,this.setOptions=e=>{Object.entries(e).forEach(([n,o])=>{typeof o>"u"&&delete e[n]}),this.options={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:xi,rangeExtractor:Si,onChange:()=>{},measureElement:Ti,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,...e}},this.notify=e=>{var n,o;(o=(n=this.options).onChange)==null||o.call(n,this,e)},this.maybeNotify=ce(()=>(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(),this.rafId!=null&&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;const n=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==n){if(this.cleanup(),!n){this.maybeNotify();return}this.scrollElement=n,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((e=this.scrollElement)==null?void 0:e.window)??null,this.elementsCache.forEach(o=>{this.observer.observe(o)}),this.unsubs.push(this.options.observeElementRect(this,o=>{this.scrollRect=o,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(o,i)=>{this.scrollAdjustments=0,this.scrollDirection=i?this.getScrollOffset()<o?"forward":"backward":null,this.scrollOffset=o,this.isScrolling=i,this.scrollState&&this.scheduleScrollReconcile(),this.maybeNotify()})),this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,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??(typeof this.options.initialOffset=="function"?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getFurthestMeasurement=(e,n)=>{const o=new Map,i=new Map;for(let a=n-1;a>=0;a--){const r=e[a];if(o.has(r.lane))continue;const u=i.get(r.lane);if(u==null||r.end>u.end?i.set(r.lane,r):r.end<u.end&&o.set(r.lane,!0),o.size===this.options.lanes)break}return i.size===this.options.lanes?Array.from(i.values()).sort((a,r)=>a.end===r.end?a.index-r.index:a.end-r.end)[0]:void 0},this.getMeasurementOptions=ce(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes],(e,n,o,i,a,r)=>(this.prevLanes!==void 0&&this.prevLanes!==r&&(this.lanesChangedFlag=!0),this.prevLanes=r,this.pendingMeasuredCacheIndexes=[],{count:e,paddingStart:n,scrollMargin:o,getItemKey:i,enabled:a,lanes:r}),{key:!1}),this.getMeasurements=ce(()=>[this.getMeasurementOptions(),this.itemSizeCache],({count:e,paddingStart:n,scrollMargin:o,getItemKey:i,enabled:a,lanes:r},u)=>{if(!a)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>e)for(const y of this.laneAssignments.keys())y>=e&&this.laneAssignments.delete(y);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMeasuredCacheIndexes=[]),this.measurementsCache.length===0&&!this.lanesSettling&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(y=>{this.itemSizeCache.set(y.key,y.size)}));const v=this.lanesSettling?0:this.pendingMeasuredCacheIndexes.length>0?Math.min(...this.pendingMeasuredCacheIndexes):0;this.pendingMeasuredCacheIndexes=[],this.lanesSettling&&this.measurementsCache.length===e&&(this.lanesSettling=!1);const p=this.measurementsCache.slice(0,v),g=new Array(r).fill(void 0);for(let y=0;y<v;y++){const _=p[y];_&&(g[_.lane]=y)}for(let y=v;y<e;y++){const _=i(y),$=this.laneAssignments.get(y);let k,w;if($!==void 0&&this.options.lanes>1){k=$;const E=g[k],C=E!==void 0?p[E]:void 0;w=C?C.end+this.options.gap:n+o}else{const E=this.options.lanes===1?p[y-1]:this.getFurthestMeasurement(p,y);w=E?E.end+this.options.gap:n+o,k=E?E.lane:y%this.options.lanes,this.options.lanes>1&&this.laneAssignments.set(y,k)}const c=u.get(_),f=typeof c=="number"?c:this.options.estimateSize(y),I=w+f;p[y]={index:y,start:w,size:f,end:I,key:_,lane:k},g[k]=y}return this.measurementsCache=p,p},{key:!1,debug:()=>this.options.debug}),this.calculateRange=ce(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(e,n,o,i)=>this.range=e.length>0&&n>0?Oi({measurements:e,outerSize:n,scrollOffset:o,lanes:i}):null,{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=ce(()=>{let e=null,n=null;const o=this.calculateRange();return o&&(e=o.startIndex,n=o.endIndex),this.maybeNotify.updateDeps([this.isScrolling,e,n]),[this.options.rangeExtractor,this.options.overscan,this.options.count,e,n]},(e,n,o,i,a)=>i===null||a===null?[]:e({startIndex:i,endIndex:a,overscan:n,count:o}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=e=>{const n=this.options.indexAttribute,o=e.getAttribute(n);return o?parseInt(o,10):(console.warn(`Missing attribute name '${n}={index}' on measured element.`),-1)},this.shouldMeasureDuringScroll=e=>{var n;if(!this.scrollState||this.scrollState.behavior!=="smooth")return!0;const o=this.scrollState.index??((n=this.getVirtualItemForOffset(this.scrollState.lastTargetOffset))==null?void 0:n.index);if(o!==void 0&&this.range){const i=Math.max(this.options.overscan,Math.ceil((this.range.endIndex-this.range.startIndex)/2)),a=Math.max(0,o-i),r=Math.min(this.options.count-1,o+i);return e>=a&&e<=r}return!0},this.measureElement=e=>{if(!e){this.elementsCache.forEach((a,r)=>{a.isConnected||(this.observer.unobserve(a),this.elementsCache.delete(r))});return}const n=this.indexFromElement(e),o=this.options.getItemKey(n),i=this.elementsCache.get(o);i!==e&&(i&&this.observer.unobserve(i),this.observer.observe(e),this.elementsCache.set(o,e)),(!this.isScrolling||this.scrollState)&&this.shouldMeasureDuringScroll(n)&&this.resizeItem(n,this.options.measureElement(e,void 0,this))},this.resizeItem=(e,n)=>{var o;const i=this.measurementsCache[e];if(!i)return;const a=this.itemSizeCache.get(i.key)??i.size,r=n-a;r!==0&&(((o=this.scrollState)==null?void 0:o.behavior)!=="smooth"&&(this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(i,r,this):i.start<this.getScrollOffset()+this.scrollAdjustments)&&this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=r,behavior:void 0}),this.pendingMeasuredCacheIndexes.push(i.index),this.itemSizeCache=new Map(this.itemSizeCache.set(i.key,n)),this.notify(!1))},this.getVirtualItems=ce(()=>[this.getVirtualIndexes(),this.getMeasurements()],(e,n)=>{const o=[];for(let i=0,a=e.length;i<a;i++){const r=e[i],u=n[r];o.push(u)}return o},{key:!1,debug:()=>this.options.debug}),this.getVirtualItemForOffset=e=>{const n=this.getMeasurements();if(n.length!==0)return ft(n[Lt(0,n.length-1,o=>ft(n[o]).start,e)])},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;{const e=this.scrollElement.document.documentElement;return this.options.horizontal?e.scrollWidth-this.scrollElement.innerWidth:e.scrollHeight-this.scrollElement.innerHeight}},this.getOffsetForAlignment=(e,n,o=0)=>{if(!this.scrollElement)return 0;const i=this.getSize(),a=this.getScrollOffset();n==="auto"&&(n=e>=a+i?"end":"start"),n==="center"?e+=(o-i)/2:n==="end"&&(e-=i);const r=this.getMaxScrollOffset();return Math.max(Math.min(r,e),0)},this.getOffsetForIndex=(e,n="auto")=>{e=Math.max(0,Math.min(e,this.options.count-1));const o=this.getSize(),i=this.getScrollOffset(),a=this.measurementsCache[e];if(!a)return;if(n==="auto")if(a.end>=i+o-this.options.scrollPaddingEnd)n="end";else if(a.start<=i+this.options.scrollPaddingStart)n="start";else return[i,n];if(n==="end"&&e===this.options.count-1)return[this.getMaxScrollOffset(),n];const r=n==="end"?a.end+this.options.scrollPaddingEnd:a.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(r,n,a.size),n]},this.scrollToOffset=(e,{align:n="start",behavior:o="auto"}={})=>{const i=this.getOffsetForAlignment(e,n),a=this.now();this.scrollState={index:null,align:n,behavior:o,startedAt:a,lastTargetOffset:i,stableFrames:0},this._scrollToOffset(i,{adjustments:void 0,behavior:o}),this.scheduleScrollReconcile()},this.scrollToIndex=(e,{align:n="auto",behavior:o="auto"}={})=>{e=Math.max(0,Math.min(e,this.options.count-1));const i=this.getOffsetForIndex(e,n);if(!i)return;const[a,r]=i,u=this.now();this.scrollState={index:e,align:r,behavior:o,startedAt:u,lastTargetOffset:a,stableFrames:0},this._scrollToOffset(a,{adjustments:void 0,behavior:o}),this.scheduleScrollReconcile()},this.scrollBy=(e,{behavior:n="auto"}={})=>{const o=this.getScrollOffset()+e,i=this.now();this.scrollState={index:null,align:"start",behavior:n,startedAt:i,lastTargetOffset:o,stableFrames:0},this._scrollToOffset(o,{adjustments:void 0,behavior:n}),this.scheduleScrollReconcile()},this.getTotalSize=()=>{var e;const n=this.getMeasurements();let o;if(n.length===0)o=this.options.paddingStart;else if(this.options.lanes===1)o=((e=n[n.length-1])==null?void 0:e.end)??0;else{const i=Array(this.options.lanes).fill(null);let a=n.length-1;for(;a>=0&&i.some(r=>r===null);){const r=n[a];i[r.lane]===null&&(i[r.lane]=r.end),a--}o=Math.max(...i.filter(r=>r!==null))}return Math.max(o-this.options.scrollMargin+this.options.paddingEnd,0)},this._scrollToOffset=(e,{adjustments:n,behavior:o})=>{this.options.scrollToFn(e,{behavior:o,adjustments:n},this)},this.measure=()=>{this.itemSizeCache=new Map,this.laneAssignments=new Map,this.notify(!1)},this.setOptions(s)}scheduleScrollReconcile(){if(!this.targetWindow){this.scrollState=null;return}this.rafId==null&&(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}const n=this.scrollState.index!=null?this.getOffsetForIndex(this.scrollState.index,this.scrollState.align):void 0,o=n?n[0]:this.scrollState.lastTargetOffset,i=1,a=o!==this.scrollState.lastTargetOffset;if(!a&&Ii(o,this.getScrollOffset())){if(this.scrollState.stableFrames++,this.scrollState.stableFrames>=i){this.scrollState=null;return}}else this.scrollState.stableFrames=0,a&&(this.scrollState.lastTargetOffset=o,this.scrollState.behavior="auto",this._scrollToOffset(o,{adjustments:void 0,behavior:"auto"}));this.scheduleScrollReconcile()}}const Lt=(t,s,e,n)=>{for(;t<=s;){const o=(t+s)/2|0,i=e(o);if(i<n)t=o+1;else if(i>n)s=o-1;else return o}return t>0?t-1:0};function Oi({measurements:t,outerSize:s,scrollOffset:e,lanes:n}){const o=t.length-1,i=u=>t[u].start;if(t.length<=n)return{startIndex:0,endIndex:o};let a=Lt(0,o,i,e),r=a;if(n===1)for(;r<o&&t[r].end<e+s;)r++;else if(n>1){const u=Array(n).fill(0);for(;r<o&&u.some(p=>p<e+s);){const p=t[r];u[p.lane]=p.end,r++}const v=Array(n).fill(e+s);for(;a>=0&&v.some(p=>p>=e);){const p=t[a];v[p.lane]=p.start,a--}a=Math.max(0,a-a%n),r=Math.min(o,r+(n-1-r%n))}return{startIndex:a,endIndex:r}}function qi(t){const s=new Ai(l(t)),e=Ne(s),n=s._didMount();return G(()=>l(t).getScrollElement(),o=>{o&&s._willUpdate()},{immediate:!0}),G(()=>l(t),o=>{s.setOptions({...o,onChange:(i,a)=>{var r;et(e),(r=o.onChange)==null||r.call(o,i,a)}}),s._willUpdate(),et(e)},{immediate:!0}),Vt(n),e}function Ri(t){return qi(S(()=>({observeElementRect:Mi,observeElementOffset:Ci,scrollToFn:Ei,...l(t)})))}async function Xe(t){if(window.isSecureContext)return navigator.clipboard.writeText(t);const s=document.activeElement instanceof HTMLElement?document.activeElement:null,e=document.createElement("textarea");e.value=t,e.setAttribute("readonly",""),e.style.cssText="position:fixed;top:0;left:-9999px;font-size:16px;opacity:0",document.body.append(e),e.select(),e.setSelectionRange(0,t.length);const n=document.execCommand("copy");if(e.remove(),s==null||s.focus({preventScroll:!0}),!n)throw new Error("Copy to clipboard failed")}const zi=/^[a-z][a-z\d+.-]*:/i;function bt(t){try{return decodeURIComponent(t)}catch{return t}}function Li(t){if(!(t===""||t.startsWith("#"))){if(t.startsWith("file:"))return bt(t.replace(/^file:(\/\/)?/,""));if(!zi.test(t))return bt(t.split(/[?#]/)[0]??t)}}const Pi={key:1,class:"chat-markdown chat-markdown--pending"};let Re;const Fi=N({__name:"ChatMarkdown",props:{content:{},final:{type:Boolean},messageId:{}},setup(t){const{t:s}=j(),e=Ye(),n={fontSize:13,lineHeight:20},o=Ne(Re),i=A(!1);let a;function r(){i.value=document.documentElement.dataset.theme==="dark"||document.documentElement.classList.contains("dark")}oe(async()=>{r(),a=new MutationObserver(r),a.observe(document.documentElement,{attributes:!0,attributeFilter:["class","data-theme"]}),Re??(Re=await Ot()),o.value=Re}),me(()=>a==null?void 0:a.disconnect());async function u(v){const p=v.target instanceof Element?v.target.closest("a[href]"):null,g=p===null?void 0:Li(p.getAttribute("href")??"");if(g!==void 0){v.preventDefault();try{await Xe(g),e.push({tone:"success",title:s("chat.pathCopied"),description:g})}catch{e.push({tone:"danger",title:s("chat.copyFailed")})}}}return(v,p)=>o.value?(d(),L(_t(o.value),{key:0,class:J(["chat-markdown",{dark:i.value}]),content:t.content,final:t.final,"index-key":t.messageId,"is-dark":i.value,"code-block-options":n,"html-policy":"escape",mode:"chat","node-virtual":!1,onClick:u},null,8,["class","content","final","index-key","is-dark"])):(d(),m("div",Pi,b(t.content),1))}}),Wi={class:"user-message","data-role":"user"},Di={class:"sr-only"},Ni={class:"user-bubble"},ji=["aria-expanded"],Bi={class:"user-actions"},Vi={class:"user-sent-time timestamp"},Hi=["aria-label"],Ui=["aria-label"],Ki=N({__name:"TimelineUserMessage",props:{text:{},at:{},quotable:{type:Boolean}},emits:["quote"],setup(t,{emit:s}){const e=t,n=s,{t:o,locale:i}=j(),a=A(),r=A(!1),u=A(!1),v=A(!1);let p;const g=S(()=>Gs(new Date(e.at),i.value));oe(async()=>{var _;await ue(),r.value=(((_=a.value)==null?void 0:_.scrollHeight)??0)>300}),me(()=>clearTimeout(p));async function y(){await Xe(e.text),v.value=!0,clearTimeout(p),p=setTimeout(()=>{v.value=!1},1500)}return(_,$)=>{const k=le("tooltip");return d(),m("article",Wi,[h("strong",Di,b(l(o)("chat.you")),1),h("div",Ni,[h("div",{ref_key:"content",ref:a,class:J(["user-bubble-content",{"is-clipped":r.value&&!u.value}])},b(t.text),3),r.value?(d(),m("button",{key:0,type:"button",class:"ui-button user-bubble-expand","data-variant":"ghost","data-size":"xs","aria-expanded":u.value,onClick:$[0]||($[0]=w=>u.value=!u.value)},[R(l(Be),{"aria-hidden":"true",class:J({"is-expanded":u.value})},null,8,["class"]),h("span",null,b(u.value?l(o)("message.collapse"):l(o)("message.expand")),1)],8,ji)):q("",!0)]),h("div",Bi,[h("span",Vi,b(g.value),1),Y((d(),m("button",{class:"ui-icon-button","data-variant":"ghost","data-size":"sm",type:"button","aria-label":l(o)("message.copy"),onClick:y},[v.value?(d(),L(l(we),{key:0,class:"is-copied","aria-hidden":"true"})):(d(),L(l($t),{key:1,"aria-hidden":"true"}))],8,Hi)),[[k,l(o)("message.copy")]]),t.quotable?Y((d(),m("button",{key:0,class:"ui-icon-button","data-variant":"ghost","data-size":"sm",type:"button","aria-label":l(o)("message.quote"),onClick:$[1]||($[1]=w=>n("quote",t.text))},[R(l(cs),{"aria-hidden":"true"})],8,Ui)),[[k,l(o)("message.quote")]]):q("",!0)])])}}}),Yi=ee(Ki,[["__scopeId","data-v-5ab9d305"]]),Gi={class:"timeline-work-item"},Zi=["aria-expanded"],Ji=["title"],Xi={key:0},Qi={key:1,class:"timeline-work-item-summary"},ea={class:"timeline-work-stat","data-tone":"success"},ta={key:0,class:"timeline-work-stat","data-tone":"danger"},sa={key:0,class:"timeline-work-item-details"},na={key:0,class:"timeline-thinking-quote"},oa={key:1,class:"tool-panel"},ia={class:"tool-panel-label"},aa=["title"],ra=["onClick"],la={key:0,class:"tool-panel-code"},ca={class:"is-strong"},da={key:0,class:"is-faint"},ua={key:1,class:"tool-panel-code"},ha={class:"is-strong"},pa={key:0,class:"is-faint"},ma={key:2,class:"tool-panel-diff"},fa=["data-sign"],va={class:"tool-panel-sign","aria-hidden":"true"},ga={key:3,class:"tool-panel-lines"},ya={class:"tool-panel-line-number","aria-hidden":"true"},ba={class:"tool-panel-line"},wt=2e4,wa=N({__name:"TimelineWorkItem",props:{item:{},expanded:{type:Boolean}},emits:["toggle"],setup(t,{emit:s}){const e=t,n=s,{t:o}=j(),i=S(()=>e.item.kind==="tool"?e.item:void 0),a=S(()=>i.value===void 0?void 0:Je(i.value.name,i.value.input)),r=S(()=>{const T=a.value;return T===void 0||i.value===void 0?"":T.renderer==="generic"?i.value.name:o(T.labelKey)}),u=S(()=>e.item.kind!=="thinking"?"":e.item.running?o("work.thinking"):o("work.thoughtFor",{duration:e.item.durationMs===void 0?"…":Js(e.item.durationMs)})),v=S(()=>e.item.kind==="thinking"?e.item.content.trim():"");function p(T){return T.length<=wt?T:`${T.slice(0,wt)}…`}function g(T){var z;const O=(z=i.value)==null?void 0:z.input[T];return typeof O=="string"&&O!==""?O:void 0}const y=S(()=>{var T,O;return p((((O=(T=i.value)==null?void 0:T.result)==null?void 0:O.text)??"").replace(/\s+$/u,""))}),_=S(()=>{var T;return((T=i.value)==null?void 0:T.status)==="error"}),$=S(()=>{var T;return((T=i.value)==null?void 0:T.name.trim().toLowerCase())??""}),k=S(()=>{var T,O,z;return $.value==="edit"?qt(((T=i.value)==null?void 0:T.input)??{},(z=(O=i.value)==null?void 0:O.result)==null?void 0:z.diff):[]}),w=S(()=>$.value==="write"?p(g("content")??""):""),c=S(()=>{if(k.value.length>0)return{added:k.value.filter(T=>T.sign==="+").length,removed:k.value.filter(T=>T.sign==="-").length};if(w.value!=="")return{added:w.value.split(`
189
+ `).length,removed:0}}),f=S(()=>{const T=i.value;if(T===void 0||a.value===void 0)return[];const O=y.value?[{id:"output",label:o("detail.output"),copy:y.value,body:"pre"}]:[];switch(a.value.renderer){case"command":{const z=g("command");return[...z===void 0?[]:[{id:"input",label:o("prompt.input"),copy:z,body:"command"}],...O]}case"search":{const z=g("pattern")??g("path");return[...z===void 0?[]:[{id:"input",label:o("prompt.input"),copy:z,body:"search"}],...O]}case"file":{const z=g("path")??T.name;return k.value.length>0?[{id:"file",label:z,copy:k.value.map(Z=>`${Z.sign}${Z.text}`).join(`
190
+ `),body:"diff"},..._.value?O:[]]:w.value!==""?[{id:"file",label:z,copy:w.value,body:"lines"},..._.value?O:[]]:_.value?O:[]}default:{const z=Object.keys(T.input).length===0?"":p(JSON.stringify(T.input,null,2));return[...z?[{id:"input",label:o("prompt.input"),copy:z,body:"pre"}]:[],...O]}}}),I=S(()=>e.item.kind==="thinking"?v.value!=="":f.value.length>0),E=A();let C;me(()=>clearTimeout(C));async function x(T){await Xe(T.copy),E.value=T.id,clearTimeout(C),C=setTimeout(()=>{E.value=void 0},1500)}return(T,O)=>(d(),m("div",Gi,[h("button",{type:"button",class:J(["timeline-work-item-toggle",{"is-running":t.item.kind==="thinking"?t.item.running:t.item.status==="running","is-error":_.value,"is-static":!I.value}]),"aria-expanded":I.value?t.expanded:void 0,onClick:O[0]||(O[0]=z=>I.value&&n("toggle"))},[R(l(Se),{size:14,"aria-hidden":"true",class:J({"is-expanded":t.expanded&&I.value})},null,8,["class"]),i.value?(d(),m("span",{key:0,class:"timeline-work-item-summary",title:[r.value,i.value.primary].filter(Boolean).join(" ")},[h("span",null,b(r.value),1),i.value.primary?(d(),m("small",Xi,b(i.value.primary),1)):q("",!0)],8,Ji)):(d(),m("span",Qi,[h("span",null,b(u.value),1)])),c.value?(d(),m(W,{key:2},[h("span",ea,"+"+b(c.value.added),1),c.value.removed?(d(),m("span",ta,"−"+b(c.value.removed),1)):q("",!0)],64)):q("",!0)],10,Zi),t.expanded&&I.value?(d(),m("div",sa,[t.item.kind==="thinking"?(d(),m("div",na,b(v.value),1)):(d(),m("div",oa,[(d(!0),m(W,null,B(f.value,z=>(d(),m(W,{key:z.id},[h("div",ia,[h("span",{title:z.label},b(z.label),9,aa),h("button",{type:"button",class:"ui-button","data-variant":"ghost","data-size":"xs",onClick:Z=>x(z)},[E.value===z.id?(d(),L(l(we),{key:0,"aria-hidden":"true"})):(d(),L(l($t),{key:1,"aria-hidden":"true"})),H(b(l(o)(E.value===z.id?"timeline.copied":"timeline.copy")),1)],8,ra)]),z.body==="command"?(d(),m("div",la,[h("div",ca,[O[1]||(O[1]=h("span",{class:"is-muted"},"$",-1)),H(" "+b(z.copy),1)]),g("cwd")?(d(),m("div",da," cwd: "+b(g("cwd")),1)):q("",!0)])):z.body==="search"?(d(),m("div",ua,[h("div",ha,b(z.copy),1),g("pattern")&&g("path")?(d(),m("div",pa," path: "+b(g("path")),1)):q("",!0)])):z.body==="diff"?(d(),m("div",ma,[(d(!0),m(W,null,B(k.value,(Z,ke)=>(d(),m("div",{key:ke,class:"tool-panel-diff-line","data-sign":Z.sign},[h("span",va,b(Z.sign),1),H(b(Z.text),1)],8,fa))),128))])):z.body==="lines"?(d(),m("div",ga,[(d(!0),m(W,null,B(w.value.split(`
191
+ `),(Z,ke)=>(d(),m(W,{key:ke},[h("span",ya,b(ke+1),1),h("span",ba,b(Z),1)],64))),128))])):(d(),m("pre",{key:4,class:J(["tool-panel-pre",{"is-error":_.value&&z.id==="output"}])},b(z.copy),3))],64))),128))]))])):q("",!0)]))}}),kt=ee(wa,[["__scopeId","data-v-e3447865"]]),ka={class:"timeline-work-row"},_a=["aria-expanded"],Ia={key:0,class:"timeline-work-group-content"},$a=N({__name:"TimelineWorkRow",props:{items:{},expanded:{type:Boolean},expandedItemIds:{}},emits:["toggle","toggleItem"],setup(t,{emit:s}){const e=t,n=s,{t:o}=j(),i={read:"work.read",edit:"work.edit",command:"work.command",search:"work.search",web_search:"work.webSearch",web_fetch:"work.webFetch",unknown:"work.unknown"},a=Object.keys(i),r=S(()=>{let v="",p;const g=e.items.filter(_=>_.kind==="thinking").length;g>0&&(v=o("work.thinkingSteps",{count:g},g),p="thinking");const y=new Map;for(const _ of e.items)_.kind==="tool"&&y.set(_.category,(y.get(_.category)??0)+1);for(const _ of a){const $=y.get(_);$!==void 0&&(p!==void 0&&(v+=o(p==="thinking"?"work.separator":"work.actionSeparator")),v+=o(i[_],{count:$},$),p=_)}return v}),u=S(()=>e.items.some(v=>v.kind==="thinking"?v.running:v.status==="running"));return(v,p)=>(d(),m("div",ka,[t.items.length>1?(d(),m(W,{key:0},[h("button",{type:"button",class:J(["timeline-work-group-toggle",{"is-running":u.value}]),"aria-expanded":t.expanded,onClick:p[0]||(p[0]=g=>n("toggle"))},[R(l(Se),{size:14,"aria-hidden":"true",class:J({"is-expanded":t.expanded})},null,8,["class"]),h("span",null,b(r.value),1)],10,_a),t.expanded?(d(),m("div",Ia,[(d(!0),m(W,null,B(t.items,g=>(d(),L(kt,{key:g.id,item:g,expanded:t.expandedItemIds[g.id]===!0,onToggle:y=>n("toggleItem",g.id)},null,8,["item","expanded","onToggle"]))),128))])):q("",!0)],64)):t.items[0]?(d(),L(kt,{key:1,item:t.items[0],expanded:t.expandedItemIds[t.items[0].id]===!0,onToggle:p[1]||(p[1]=g=>n("toggleItem",t.items[0].id))},null,8,["item","expanded"])):q("",!0)]))}});function xa(t){var o;const s=[];let e=[];const n=()=>{e.length>0&&s.push({key:`work-${e[0].id}`,kind:"work",items:e}),e=[]};for(const i of t)if(i.kind==="thinking"){if(i.text===""&&!i.streaming)continue;e.push({id:i.key,kind:"thinking",content:i.text,running:i.streaming,...i.elapsedMs===void 0?{}:{durationMs:i.elapsedMs}})}else if(i.kind==="tool"){const a=Sa(i.name,i.input),r=Ma(a,i.input);e.push({id:i.key,kind:"tool",name:i.name,category:a,...r===void 0?{}:{primary:r},status:i.pending?"running":((o=i.result)==null?void 0:o.isError)===!0?"error":"complete",input:i.input,...i.result===void 0?{}:{result:i.result}})}else n(),s.push({key:i.key,kind:"row",row:i});return n(),s}function Sa(t,s){const{renderer:e,labelKey:n}=Je(t,s);switch(e){case"command":return"command";case"search":return"search";case"file":return n==="tool.read"?"read":"edit";case"web":return n==="tool.webSearch"?"web_search":"web_fetch";case"generic":return"unknown"}}function Ma(t,s){const n=(t==="command"?["command"]:t==="web_search"?["query"]:t==="web_fetch"?["url"]:t==="search"?["pattern","path"]:["path"]).map(i=>s[i]).find(i=>typeof i=="string"&&i.trim()!=="");if(n===void 0)return;const o=t==="read"||t==="edit"?n.replaceAll("\\","/").split("/").at(-1)??n:n;return o.length<=80?o:`${o.slice(0,79)}…`}const Ca={class:"timeline-shell"},Ta={key:0,class:"timeline-empty"},Ea=["data-index"],Aa={key:2,class:"timeline-row","data-role":"assistant"},Oa={class:"sr-only"},qa={key:3,class:"notice-row error-row",role:"alert"},Ra={key:4,class:"timeline-notice"},za={key:1,class:"processing-row",role:"status"},La=["aria-label"],Pa=96,Fa=N({__name:"TimelineView",props:{rows:{},running:{type:Boolean},quotable:{type:Boolean}},emits:["quote"],setup(t,{emit:s}){const e=t,n=s,{t:o}=j(),i=A(),a=A(),r=A(!0),u=A({}),v=A({}),p=S(()=>xa(e.rows)),g=Ri(S(()=>({count:p.value.length,getScrollElement:()=>i.value??null,estimateSize:()=>72,overscan:6,getItemKey:f=>p.value[f].key})));g.value.shouldAdjustScrollPositionOnItemSizeChange=(f,I,E)=>{var T;const C=i.value;return C===void 0||a.value===void 0?!1:(E.getTotalSize(),(((T=E.measurementsCache[f.index])==null?void 0:T.start)??f.start)<C.scrollTop-a.value.offsetTop)};const y=S(()=>g.value.getVirtualItems()),_=S(()=>g.value.getTotalSize());function $(f){f instanceof Element&&g.value.measureElement(f)}function k(){const f=i.value;f!==void 0&&(r.value=f.scrollHeight-f.scrollTop-f.clientHeight<=Pa)}async function w(){await ue();const f=i.value;f!==void 0&&(f.scrollTop=f.scrollHeight)}function c(){r.value=!0,w()}return G([()=>p.value.length,_,()=>e.rows.at(-1),()=>e.running],()=>{r.value&&w()}),oe(()=>void w()),(f,I)=>{const E=le("tooltip");return d(),m("div",Ca,[h("div",{ref_key:"viewport",ref:i,class:"timeline app-scroll-viewport",onScrollPassive:k},[p.value.length===0&&!t.running?(d(),m("p",Ta,b(l(o)("chat.emptyTimeline")),1)):q("",!0),h("div",{ref_key:"list",ref:a,class:"virtual-timeline",style:Le({height:`${_.value}px`,position:"relative"})},[(d(!0),m(W,null,B(y.value,C=>(d(),m("div",{key:String(C.key),ref_for:!0,ref:$,class:"virtual-timeline-row","data-index":C.index,style:Le({position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${C.start}px)`})},[(d(!0),m(W,null,B([p.value[C.index]],x=>(d(),m(W,{key:x.key},[x.kind==="work"?(d(),L($a,{key:0,items:x.items,expanded:u.value[x.key]===!0,"expanded-item-ids":v.value,onToggle:T=>u.value[x.key]=!u.value[x.key],onToggleItem:I[0]||(I[0]=T=>v.value[T]=!v.value[T])},null,8,["items","expanded","expanded-item-ids","onToggle"])):x.row.kind==="user"?(d(),L(Yi,{key:1,text:x.row.text,at:x.row.at,quotable:t.quotable,onQuote:I[1]||(I[1]=T=>n("quote",T))},null,8,["text","at","quotable"])):x.row.kind==="assistant"?(d(),m("article",Aa,[h("strong",Oa,b(l(o)("chat.assistant")),1),R(Fi,{content:x.row.text,final:!x.row.streaming,"message-id":x.row.key},null,8,["content","final","message-id"])])):x.row.kind==="error"?(d(),m("div",qa,[h("span",null,b(x.row.text),1)])):(d(),m("p",Ra,b(l(o)("timeline.noticeStopped")),1))],64))),128))],12,Ea))),128))],4),t.running?(d(),m("div",za,[R(l(Ve),{size:14,class:"is-spinning","aria-hidden":"true"}),h("span",null,b(l(o)("work.processing")),1)])):q("",!0)],544),R(Ht,{name:"jump-latest"},{default:se(()=>[r.value?q("",!0):Y((d(),m("button",{key:0,class:"ui-icon-button jump-latest","data-variant":"secondary","data-size":"md",type:"button","aria-label":l(o)("timeline.scrollToBottom"),onClick:c},[R(l(Be),{"aria-hidden":"true"})],8,La)),[[E,l(o)("timeline.scrollToBottom")]])]),_:1})])}}}),Wa=ee(Fa,[["__scopeId","data-v-6e13569c"]]),Da={key:0,class:"removed-state route-page"},Na={"data-route-heading":"",tabindex:"-1"},ja={key:1,class:"removed-state route-page"},Ba={"data-route-heading":"",tabindex:"-1"},Va={role:"alert"},Ha={key:2,class:"chat-loading","aria-busy":"true"},Ua={class:"sr-only"},Ka={key:3,class:"chat-page"},Ya={class:"chat-page-top"},Ga={class:"session-header"},Za=["aria-label"],Ja={class:"session-heading"},Xa=["title"],Qa=["title"],er={key:1,class:"ui-badge session-running","data-tone":"primary"},tr={key:0,class:"composer-panel"},sr=N({__name:"ChatPage",props:{sessionId:{}},setup(t){const s=t,{t:e}=j(),n=ye(),o=K(),i=U(),a=fe();G(()=>s.sessionId,k=>n.open(k),{immediate:!0});const r=S(()=>n.views[s.sessionId]),u=S(()=>i.byId.get(s.sessionId)),v=S(()=>{var k;return((k=u.value)==null?void 0:k.preview)??e("sidebar.untitled")}),p=S(()=>{var k;return(k=r.value)==null?void 0:k.approvals[0]}),g=A();function y(k){return n.submit(s.sessionId,k)}function _(){return n.stop(s.sessionId)}function $(k){return n.setModel(s.sessionId,k)}return(k,w)=>{var c,f;return((c=r.value)==null?void 0:c.status)==="closed"?(d(),m("section",Da,[h("h1",Na,b(l(e)("chat.removedTitle")),1),h("p",null,b(l(e)("chat.removedDescription")),1),R(l(ge),{to:"/chat/new"},{default:se(()=>[H(b(l(e)("sidebar.newSession")),1)]),_:1})])):((f=r.value)==null?void 0:f.status)==="failed"?(d(),m("section",ja,[h("h1",Ba,b(v.value),1),h("p",Va,b(r.value.error),1)])):!r.value||r.value.status==="loading"?(d(),m("section",Ha,[h("h1",Ua,b(l(e)("route.session")),1),R(Ee,{animated:"",class:"boot-mark"}),h("p",null,b(l(e)("common.loading")),1)])):(d(),m("section",Ka,[h("div",Ya,[h("header",Ga,[l(a).shellMode==="compact"?(d(),m("button",{key:0,class:"ui-icon-button session-nav","data-variant":"ghost","data-size":"md",type:"button","aria-label":l(e)("sidebar.openMenu"),onClick:w[0]||(w[0]=I=>l(a).drawerOpen=!0)},[R(l(xt),{"aria-hidden":"true"})],8,Za)):q("",!0),h("div",Ja,[u.value?(d(),m(W,{key:0},[h("span",{class:"workspace-crumb",title:u.value.cwd},b(l(Ae)(u.value.cwd)),9,Xa),w[2]||(w[2]=h("span",{class:"workspace-crumb-separator","aria-hidden":"true"},"/",-1))],64)):q("",!0),h("h1",{"data-route-heading":"",tabindex:"-1",title:v.value},b(v.value),9,Qa)]),r.value.running?(d(),m("span",er,[w[3]||(w[3]=h("span",{class:"status-dot","data-state":"running","aria-hidden":"true"},null,-1)),H(b(l(e)(r.value.stopping?"status.stopping":"status.running")),1)])):q("",!0)])]),R(Wa,{rows:r.value.rows,running:r.value.running,quotable:!p.value,onQuote:w[1]||(w[1]=I=>{var E;return(E=g.value)==null?void 0:E.quote(I)})},null,8,["rows","running","quotable"]),p.value?(d(),m("div",tr,[(d(),L(Vo,{key:p.value.requestId,"session-id":t.sessionId,request:p.value},null,8,["session-id","request"]))])):(d(),L(zt,{key:1,ref_key:"composer",ref:g,running:r.value.running,stopping:r.value.stopping,model:r.value.model,send:y,stop:_,"model-selectable":l(o).supports("session.model.update"),"select-model":$},null,8,["running","stopping","model","model-selectable"]))]))}}}),nr=ee(sr,[["__scopeId","data-v-60e470e2"]]),or={class:"new-session-page"},ir={class:"new-session-hero"},ar={"data-route-heading":"",tabindex:"-1"},rr={class:"ui-button","data-variant":"ghost","data-size":"xs","data-trailing":""},lr={class:"workspace-trigger-label"},cr={class:"composer-popover-content workspace-menu-content ui-popover","data-width":"lg"},dr=["placeholder","aria-label"],ur=["disabled"],hr={key:0,class:"ui-menu-separator"},pr=["aria-label"],mr=["aria-selected","onClick"],fr={class:"ui-menu-desc workspace-path"},vr=N({__name:"NewSessionPage",setup(t){const{t:s}=j(),e=je(),n=It(),o=U(),i=ye(),a=Rt(),r=A(),u=A(typeof e.query.cwd=="string"?e.query.cwd:""),v=A("");G(()=>o.workspaces,w=>{u.value===""&&w[0]!==void 0&&(u.value=w[0].cwd)},{immediate:!0});const p=A(),g=A();G(u,async w=>{if(g.value=void 0,w==="")return;const c=await a.defaultFor(w);u.value===w&&(g.value=c)},{immediate:!0});const y=S(()=>p.value??g.value);function _(w){u.value=w,r.value&&(r.value.open=!1)}function $(){const w=v.value.trim();w!==""&&(_(w),v.value="")}async function k(w){if(u.value==="")throw new Error(s("newThread.workspaceRequired"));const c=await o.create(u.value,p.value);i.open(c),await i.submit(c,w),await n.push({name:"chat-session",params:{sessionId:c}})}return(w,c)=>{const f=le("tooltip");return d(),m("section",or,[h("div",ir,[R(Ee,{class:"new-session-mark"}),h("h1",ar,b(l(s)("newThread.title")),1)]),R(zt,{class:"is-new-thread",running:!1,model:y.value,"model-selectable":!0,send:k,"select-model":I=>{p.value=I}},{status:se(()=>[h("details",{ref_key:"menu",ref:r,class:"composer-popover workspace-menu"},[Y((d(),m("summary",rr,[R(l(Pe),{"aria-hidden":"true"}),h("span",lr,b(u.value?l(Ae)(u.value):l(s)("newThread.selectWorkspace")),1),R(l(Be),{class:"workspace-chevron","aria-hidden":"true"})])),[[f,u.value||void 0]]),h("div",cr,[h("form",{class:"workspace-path-form",onSubmit:xe($,["prevent"])},[Y(h("input",{"onUpdate:modelValue":c[0]||(c[0]=I=>v.value=I),class:"ui-field","data-size":"sm",type:"text",spellcheck:"false",autocapitalize:"off",placeholder:l(s)("newThread.pathPlaceholder"),"aria-label":l(s)("newThread.pathLabel")},null,8,dr),[[Te,v.value]]),h("button",{type:"submit",class:"ui-button","data-variant":"secondary","data-size":"sm",disabled:v.value.trim()===""},b(l(s)("newThread.usePath")),9,ur)],32),l(o).workspaces.length?(d(),m("hr",hr)):q("",!0),h("div",{class:"workspace-list",role:"listbox","aria-label":l(s)("sidebar.workspaces")},[(d(!0),m(W,null,B(l(o).workspaces,I=>(d(),m("button",{key:I.cwd,type:"button",role:"option",class:"ui-menu-item","data-two-line":"","aria-selected":I.cwd===u.value,onClick:E=>_(I.cwd)},[R(l(Pe),{"aria-hidden":"true"}),h("span",null,[H(b(I.name),1),h("span",fr,b(I.cwd),1)]),I.cwd===u.value?(d(),L(l(we),{key:0,class:"ui-menu-check","aria-hidden":"true"})):q("",!0)],8,mr))),128))],8,pr)])],512)]),_:1},8,["model","select-model"])])}}}),gr=ee(vr,[["__scopeId","data-v-2350b414"]]),yr={class:"chat-loading","aria-busy":"true"},br=N({__name:"RootRedirect",setup(t){const{t:s}=j(),e=It(),n=U(),o=fe();return G(()=>n.loaded||n.error!=="",i=>{if(!i)return;const a=o.lastSessionId;e.replace(a!==void 0&&n.byId.has(a)?{name:"chat-session",params:{sessionId:a}}:{name:"chat-new"})},{immediate:!0}),(i,a)=>(d(),m("section",yr,[h("p",null,b(l(s)("common.loading")),1)]))}}),wr={class:"route-page app-scroll-viewport"},kr={"data-route-heading":"",tabindex:"-1"},_r={class:"page-description"},Ir=N({__name:"NotFoundView",setup(t){const{t:s}=j();return(e,n)=>(d(),m("section",wr,[R(l(ss),{size:20,class:"state-icon","aria-hidden":"true"}),h("h1",kr,b(l(s)("route.notFound")),1),h("p",_r,b(l(s)("page.notFoundDescription")),1),R(l(ge),{to:"/chat/new"},{default:se(()=>[H(b(l(s)("sidebar.newSession")),1)]),_:1})]))}}),Pt=Ut({history:Kt(),routes:[{path:"/",name:"root",component:br},{path:"/chat/new",name:"chat-new",component:gr},{path:"/chat/:sessionId",name:"chat-session",component:nr,props:!0},{path:"/:pathMatch(.*)*",name:"not-found",component:Ir}]});Pt.afterEach(t=>{t.name==="chat-session"&&typeof t.params.sessionId=="string"&&(fe().lastSessionId=t.params.sessionId)});G(de.global.locale,t=>{document.documentElement.lang=t},{immediate:!0});const De=Yt();fe(De);Promise.all([qs(),Vs(navigator.language)]).then(()=>{K(De).client.start(),Gt(Qn).use(De).use(de).use(Pt).directive("tooltip",ho).mount("#app"),setTimeout(()=>void Ot(),0)});export{Tt as _};