@kabmo-labs/kabmo 0.39.0 → 0.39.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (99) hide show
  1. package/dist/client/index.html +1 -1
  2. package/dist/client/index.js +270 -270
  3. package/dist/client/static/js/{CsvGrid-kfcp4sd6.js → CsvGrid-7synegzg.js} +1 -1
  4. package/dist/client/static/js/{DocxView-atff5w38.js → DocxView-v5d9n5yw.js} +1 -1
  5. package/dist/client/static/js/{DrawioView-yfnq4c99.js → DrawioView-ww7y98tt.js} +1 -1
  6. package/dist/client/static/js/{ImageView-nreh25s0.js → ImageView-t3rkypzs.js} +1 -1
  7. package/dist/client/static/js/{LayoutWrapper-0x1q1q5z.js → LayoutWrapper-th2pd4yt.js} +1 -1
  8. package/dist/client/static/js/{Modal-2xqd3sss.js → Modal-qj39shgb.js} +1 -1
  9. package/dist/client/static/js/{PdfView-mk8paxt1.js → PdfView-t9v4datp.js} +1 -1
  10. package/dist/client/static/js/{SessionsView-ner25qxn.js → SessionsView-yqy0a1xg.js} +1 -1
  11. package/dist/client/static/js/{SheetView-s6n3fawm.js → SheetView-6zkxbjd4.js} +1 -1
  12. package/dist/client/static/js/{SvgPreview-8bxvz3ez.js → SvgPreview-7rt2p1y1.js} +1 -1
  13. package/dist/client/static/js/{abnfDiagram-O67JEVCF-tvvz9fha.js → abnfDiagram-O67JEVCF-888zn5zg.js} +1 -1
  14. package/dist/client/static/js/{architectureDiagram-NJMV4G6O-bybv3wg4.js → architectureDiagram-NJMV4G6O-b04e26rb.js} +1 -1
  15. package/dist/client/static/js/{blockDiagram-BEXU5L5S-h3fs79x6.js → blockDiagram-BEXU5L5S-32ph2m52.js} +1 -1
  16. package/dist/client/static/js/{c4Diagram-YGBWAQC7-h8p3h54v.js → c4Diagram-YGBWAQC7-hwnaa333.js} +1 -1
  17. package/dist/client/static/js/{classDiagram-v2-NBCMYWYE-q645r4q6.js → classDiagram-v2-NBCMYWYE-2kg7dqeb.js} +1 -1
  18. package/dist/client/static/js/{cose-bilkent-JH36ORCC-p4mm1zcv.js → cose-bilkent-JH36ORCC-tj2sbtyv.js} +1 -1
  19. package/dist/client/static/js/{cynefinDiagram-VND7K2PF-v2hbc3aq.js → cynefinDiagram-VND7K2PF-wx2y8dhm.js} +1 -1
  20. package/dist/client/static/js/{dagre-6A5THRUB-4edpda33.js → dagre-6A5THRUB-5v3rzdxd.js} +1 -1
  21. package/dist/client/static/js/{diagram-22UHCM2B-b6gp813w.js → diagram-22UHCM2B-7er2jwy1.js} +1 -1
  22. package/dist/client/static/js/{diagram-3UASUU5V-s1f3b0ng.js → diagram-3UASUU5V-2b7nmdha.js} +1 -1
  23. package/dist/client/static/js/{diagram-ATOU4E4O-ga06kjp5.js → diagram-ATOU4E4O-yf61ftn0.js} +1 -1
  24. package/dist/client/static/js/{diagram-CDSNMT55-wdbmv4td.js → diagram-CDSNMT55-cn3rs9xn.js} +1 -1
  25. package/dist/client/static/js/{diagram-MLGK6HIB-fkntefcq.js → diagram-MLGK6HIB-7kvtsj6c.js} +1 -1
  26. package/dist/client/static/js/{diagram-MPIPVDR6-k2zh7edp.js → diagram-MPIPVDR6-g3zg3r5e.js} +1 -1
  27. package/dist/client/static/js/{dockerfile-srcym0bs.js → dockerfile-f9j396wm.js} +1 -1
  28. package/dist/client/static/js/{ebnfDiagram-ZINNZB2B-4vc4vz9c.js → ebnfDiagram-ZINNZB2B-ft02nzne.js} +1 -1
  29. package/dist/client/static/js/{elk-276RUBZZ-g2ppf1by.js → elk-276RUBZZ-87fvkn2k.js} +1 -1
  30. package/dist/client/static/js/{erDiagram-OPXOYQCR-rmnwkb5q.js → erDiagram-OPXOYQCR-gh9mp6j8.js} +1 -1
  31. package/dist/client/static/js/flowDiagram-KWPJA3E3-6gc6gd1d.js +1 -0
  32. package/dist/client/static/js/{ganttDiagram-FUAMR5RP-ptfvae64.js → ganttDiagram-FUAMR5RP-227xs61z.js} +1 -1
  33. package/dist/client/static/js/{gitGraphDiagram-X574FWY7-ne9n3cyf.js → gitGraphDiagram-X574FWY7-4671gdym.js} +1 -1
  34. package/dist/client/static/js/{index-a7qccdq2.js → index-28a5kf88.js} +1 -1
  35. package/dist/client/static/js/{index-ymp2wqtc.js → index-35mh9kbs.js} +1 -1
  36. package/dist/client/static/js/{index-3fw3sd10.js → index-4c2zcvem.js} +7 -7
  37. package/dist/client/static/js/{index-jkph8wqq.js → index-4ry8kz8h.js} +1 -1
  38. package/dist/client/static/js/{index-v8vjh5jj.js → index-668chrpq.js} +1 -1
  39. package/dist/client/static/js/{index-8qgwj6m8.js → index-6rs8e8ng.js} +1 -1
  40. package/dist/client/static/js/{index-56w8m083.js → index-7qc2avfy.js} +1 -1
  41. package/dist/client/static/js/{index-5kvvb0zm.js → index-87qandgr.js} +1 -1
  42. package/dist/client/static/js/{index-ntx3bbmb.js → index-8xasfxf3.js} +1 -1
  43. package/dist/client/static/js/{index-gvkc9e32.js → index-d3prrt2q.js} +1 -1
  44. package/dist/client/static/js/{index-4pehdq5h.js → index-f1nqk6z6.js} +1 -1
  45. package/dist/client/static/js/{index-pzqsp5jw.js → index-f73v86a3.js} +1 -1
  46. package/dist/client/static/js/{index-270y5r9k.js → index-fjqp03xe.js} +1 -1
  47. package/dist/client/static/js/{index-mmsszqvn.js → index-fs3pbqwn.js} +1 -1
  48. package/dist/client/static/js/{index-xdqsqhnn.js → index-h8rr48px.js} +1 -1
  49. package/dist/client/static/js/{index-dmd26a1y.js → index-hdd8nqz8.js} +1 -1
  50. package/dist/client/static/js/{index-me7m3516.js → index-j2g39xq7.js} +1 -1
  51. package/dist/client/static/js/{index-dt22v9ns.js → index-jze0zg3z.js} +1 -1
  52. package/dist/client/static/js/{index-m3r0j562.js → index-kkfbd1db.js} +1 -1
  53. package/dist/client/static/js/{index-7h5n5rz4.js → index-m847wafq.js} +1 -1
  54. package/dist/client/static/js/{index-y2prm0xm.js → index-mtadrbxt.js} +1 -1
  55. package/dist/client/static/js/{index-7z63xr1s.js → index-phm1zb8m.js} +1 -1
  56. package/dist/client/static/js/{index-p89z1qmj.js → index-qbnd827h.js} +1 -1
  57. package/dist/client/static/js/{index-8w2tx2k9.js → index-s80x8d58.js} +1 -1
  58. package/dist/client/static/js/{index-ywpdhntc.js → index-tmnnafht.js} +1 -1
  59. package/dist/client/static/js/{index-hh05xd1d.js → index-vb3srfyc.js} +1 -1
  60. package/dist/client/static/js/{index-k61tdd4a.js → index-w0rbyw47.js} +1 -1
  61. package/dist/client/static/js/{index-5a4w58r2.js → index-w0xvdda9.js} +1 -1
  62. package/dist/client/static/js/{index-878d61js.js → index-wfcgqjzr.js} +1 -1
  63. package/dist/client/static/js/{index-pr7gk5eq.js → index-wgvysmnr.js} +1 -1
  64. package/dist/client/static/js/{index-mdxnhndy.js → index-xfr6r539.js} +1 -1
  65. package/dist/client/static/js/{index-k3c3n69j.js → index-xnk1500f.js} +2 -2
  66. package/dist/client/static/js/{index-61qjr1k0.js → index-y5ymgp20.js} +2 -2
  67. package/dist/client/static/js/{index-k5a6r25s.js → index-y91j4t1q.js} +1 -1
  68. package/dist/client/static/js/{infoDiagram-VRGFBTTK-ctfwcm3n.js → infoDiagram-VRGFBTTK-k1jnhhbp.js} +1 -1
  69. package/dist/client/static/js/{ishikawaDiagram-OU5B5YK6-b0b0pn4y.js → ishikawaDiagram-OU5B5YK6-ar94x2gr.js} +1 -1
  70. package/dist/client/static/js/{journeyDiagram-ZHPQQLJL-kdq12drs.js → journeyDiagram-ZHPQQLJL-ntfp0w54.js} +1 -1
  71. package/dist/client/static/js/{kanban-definition-PNTS6WVX-65x6xn2q.js → kanban-definition-PNTS6WVX-q5rsr6j3.js} +1 -1
  72. package/dist/client/static/js/{mermaid.core-0fq63jpa.js → mermaid.core-0gafsqrm.js} +2 -2
  73. package/dist/client/static/js/{mindmap-definition-NLK3R4M7-p86myex3.js → mindmap-definition-NLK3R4M7-jgz6nyhk.js} +1 -1
  74. package/dist/client/static/js/one-dark-pro-n0as47q7.js +1 -0
  75. package/dist/client/static/js/one-light-05nw3mzj.js +1 -0
  76. package/dist/client/static/js/{pegDiagram-GJSIUBJH-p2hkk9xb.js → pegDiagram-GJSIUBJH-b3e9ma2c.js} +1 -1
  77. package/dist/client/static/js/{pieDiagram-5QR66LMP-bza19wkx.js → pieDiagram-5QR66LMP-66mn2qnt.js} +1 -1
  78. package/dist/client/static/js/{quadrantDiagram-O4NWA36T-bxqec9w1.js → quadrantDiagram-O4NWA36T-n7warg0e.js} +1 -1
  79. package/dist/client/static/js/{railroadDiagram-XR7U4H2S-1g3hx3sm.js → railroadDiagram-XR7U4H2S-k8j43rxj.js} +1 -1
  80. package/dist/client/static/js/{requirementDiagram-PLB6GJNP-qbjjm48v.js → requirementDiagram-PLB6GJNP-ef2v7nyq.js} +1 -1
  81. package/dist/client/static/js/{rust-jatm47v6.js → rust-jvkbr060.js} +1 -1
  82. package/dist/client/static/js/{sankeyDiagram-IPEJSGJF-t2ythbh7.js → sankeyDiagram-IPEJSGJF-3njbd1yd.js} +1 -1
  83. package/dist/client/static/js/{sequenceDiagram-PO4LG4MO-mqsfek2j.js → sequenceDiagram-PO4LG4MO-k2wqc0qt.js} +1 -1
  84. package/dist/client/static/js/{sizeCapture-INFHLROL-xj67pgds.js → sizeCapture-INFHLROL-cpnd12ee.js} +1 -1
  85. package/dist/client/static/js/{stateDiagram-v2-GCMORJYK-gj4fezak.js → stateDiagram-v2-GCMORJYK-1ydpxaeg.js} +1 -1
  86. package/dist/client/static/js/{swimlanes-2SLR337P-pgtdd1pk.js → swimlanes-2SLR337P-4md43da2.js} +1 -1
  87. package/dist/client/static/js/{swimlanesDiagram-TC7HE7FX-zk37paj9.js → swimlanesDiagram-TC7HE7FX-d48g5gjf.js} +1 -1
  88. package/dist/client/static/js/{timeline-definition-EJHVYXUP-q013vdd1.js → timeline-definition-EJHVYXUP-sp32bf3e.js} +1 -1
  89. package/dist/client/static/js/{usecaseDiagram-POWQR4AR-7swsbqnq.js → usecaseDiagram-POWQR4AR-p2ssettn.js} +1 -1
  90. package/dist/client/static/js/{vennDiagram-UO4OBE2U-9dygxdxf.js → vennDiagram-UO4OBE2U-ejqq8b82.js} +1 -1
  91. package/dist/client/static/js/{wardleyDiagram-VNRHLVJA-aaaa9kj3.js → wardleyDiagram-VNRHLVJA-tkk79rsn.js} +1 -1
  92. package/dist/client/static/js/{xychartDiagram-PMCCYNJV-tamf39gx.js → xychartDiagram-PMCCYNJV-zhgrsqpb.js} +1 -1
  93. package/package.json +1 -1
  94. package/src/server/lib/terminal/attach-replay.test.ts +80 -17
  95. package/src/server/plugins/static.test.ts +23 -1
  96. package/src/server/plugins/static.ts +24 -1
  97. package/dist/client/static/js/flowDiagram-KWPJA3E3-jvrvhb9d.js +0 -1
  98. package/dist/client/static/js/one-dark-pro-c4q810z4.js +0 -1
  99. package/dist/client/static/js/one-light-czk9dzya.js +0 -1
@@ -1,3 +1,3 @@
1
- import{n,o,i,u,e,s,vr,kr,Ga,bo,Hr,Mi,Pi,vo,Yr}from"./index-3fw3sd10.js";var Ae={name:"square-function",size:24,node:[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["path",{d:"M9 17c2 0 2.8-1 2.8-2.8V10c0-2 1-3.3 3.2-3",key:"m1af9g"}],["path",{d:"M9 11.2h5.7",key:"3zgcl2"}]],aliases:["function-square"]},v=s(Ae);var xe={name:"blocks",size:24,node:[["path",{d:"M10 22V7a1 1 0 0 0-1-1H4a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-5a1 1 0 0 0-1-1H2",key:"1ah6g2"}],["rect",{x:"14",y:"2",width:"8",height:"8",rx:"1",key:"88lufb"}]]},M=s(xe);var Le={name:"box",size:24,node:[["path",{d:"M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z",key:"hh9hay"}],["path",{d:"m3.3 7 8.7 5 8.7-5",key:"g66t2b"}],["path",{d:"M12 22V12",key:"d0xqtd"}]]},I=s(Le);var Ee={name:"component",size:24,node:[["path",{d:"M15.536 11.293a1 1 0 0 0 0 1.414l2.376 2.377a1 1 0 0 0 1.414 0l2.377-2.377a1 1 0 0 0 0-1.414l-2.377-2.377a1 1 0 0 0-1.414 0z",key:"1uwlt4"}],["path",{d:"M2.297 11.293a1 1 0 0 0 0 1.414l2.377 2.377a1 1 0 0 0 1.414 0l2.377-2.377a1 1 0 0 0 0-1.414L6.088 8.916a1 1 0 0 0-1.414 0z",key:"10291m"}],["path",{d:"M8.916 17.912a1 1 0 0 0 0 1.415l2.377 2.376a1 1 0 0 0 1.414 0l2.377-2.376a1 1 0 0 0 0-1.415l-2.377-2.376a1 1 0 0 0-1.414 0z",key:"1tqoq1"}],["path",{d:"M8.916 4.674a1 1 0 0 0 0 1.414l2.377 2.376a1 1 0 0 0 1.414 0l2.377-2.376a1 1 0 0 0 0-1.414l-2.377-2.377a1 1 0 0 0-1.414 0z",key:"1x6lto"}]]},D=s(Ee);var ze={name:"heading",size:24,node:[["path",{d:"M6 12h12",key:"8npq4p"}],["path",{d:"M6 20V4",key:"1w1bmo"}],["path",{d:"M18 20V4",key:"o2hl4u"}]]},N=s(ze);var Ze={name:"paintbrush",size:24,node:[["path",{d:"m14.622 17.897-10.68-2.913",key:"vj2p1u"}],["path",{d:"M18.376 2.622a1 1 0 1 1 3.002 3.002L17.36 9.643a.5.5 0 0 0 0 .707l.944.944a2.41 2.41 0 0 1 0 3.408l-.944.944a.5.5 0 0 1-.707 0L8.354 7.348a.5.5 0 0 1 0-.707l.944-.944a2.41 2.41 0 0 1 3.408 0l.944.944a.5.5 0 0 0 .707 0z",key:"18tc5c"}],["path",{d:"M9 8c-1.804 2.71-3.97 3.46-6.583 3.948a.507.507 0 0 0-.302.819l7.32 8.883a1 1 0 0 0 1.185.204C12.735 20.405 16 16.792 16 15",key:"ytzfxy"}]]},T=s(Ze);var Oe={name:"tag",size:24,node:[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",key:"vktsd0"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}]]},q=s(Oe);var Ue={name:"variable",size:24,node:[["path",{d:"M8 21s-4-3-4-9 4-9 4-9",key:"uto9ud"}],["path",{d:"M16 3s4 3 4 9-4 9-4 9",key:"4w2vsq"}],["line",{x1:"15",x2:"9",y1:"9",y2:"15",key:"f7djnv"}],["line",{x1:"9",x2:"15",y1:"9",y2:"15",key:"1shsy8"}]]},C=s(Ue);var K={class:{Icon:kr,label:"Class"},interface:{Icon:vo,label:"Interface"},type:{Icon:Yr,label:"Type"},enum:{Icon:Hr,label:"Enum"},function:{Icon:v,label:"Function"},method:{Icon:D,label:"Method"},constant:{Icon:Ga,label:"Constant"},variable:{Icon:C,label:"Variable"},struct:{Icon:I,label:"Struct"},trait:{Icon:Pi,label:"Trait"},impl:{Icon:M,label:"Impl"},module:{Icon:Mi,label:"Module"},heading:{Icon:N,label:"Heading"},selector:{Icon:T,label:"Selector"},key:{Icon:bo,label:"Key"},tag:{Icon:q,label:"Tag"},macro:{Icon:vr,label:"Macro"}};function Du({kind:l,size:r=12}){let{Icon:a}=K[l];return e(a,{size:r,className:"flex-shrink-0 text-ink/45",strokeWidth:1.8})}function Ko(l){return K[l].label}var ve={c:{line:["//"],block:["/*","*/"],quotes:["'",'"'],template:!0},css:{line:[],block:["/*","*/"],quotes:["'",'"']},python:{line:["#"],quotes:["'",'"'],triple:!0},hash:{line:["#"],quotes:["'",'"']},dash:{line:["--"],quotes:["'",'"']},lua:{line:["--"],block:["--[[","]]"],quotes:["'",'"']},sql:{line:["--"],block:["/*","*/"],quotes:["'",'"']},ml:{line:[],block:["(*","*)"],quotes:['"']},hcl:{line:["#","//"],block:["/*","*/"],quotes:[]},percent:{line:["%"],quotes:["'",'"']},lisp:{line:[";"],block:["#|","|#"],quotes:['"']},none:{line:[],quotes:['"',"'"]},raw:{line:[],quotes:[]}};function A(l,r){let a=ve[r],[d,t]=a.block??["",""],p=[],c="code",b="";for(let f of l){let m="";for(let k=0;k<f.length;k+=1){let h=f[k],_=f[k+1];if(c==="line"){m+=" ";continue}if(c==="block"){if(t&&h===t[0]&&f.startsWith(t,k)){c="code",m+=" ".repeat(t.length),k+=t.length-1;continue}m+=" ";continue}if(c==="quoted"||c==="template"||c==="triple"){if(h==="\\"){m+=" ",k+=1;continue}if(c==="triple"){if(h===b&&f.startsWith(b.repeat(3),k)){c="code",m+=" ",k+=2;continue}m+=" ";continue}if(m+=" ",h===b)c="code";continue}let g=a.line.find((Re)=>f.startsWith(Re,k));if(g){c="line",m+=" ".repeat(g.length),k+=g.length-1;continue}if(d&&f.startsWith(d,k)){c="block",m+=" ".repeat(d.length),k+=d.length-1;continue}if(a.triple&&h===(_??"")&&h===f[k+2]&&(h==="'"||h==='"')){c="triple",b=h,m+=" ",k+=2;continue}if(a.template&&h==="`"){c="template",b="`",m+=" ";continue}if(a.quotes?.includes(h)){c="quoted",b=h,m+=" ";continue}m+=h}if(c==="line"||c==="quoted")c="code";p.push(m)}return p}function z(l){let r=0;for(let a of l)if(a==="{")r+=1;else if(a==="}")r-=1;return r}var x=[{kind:"class",re:/^(?:export\s+)?(?:default\s+)?(?:abstract\s+)?(?:declare\s+)?class\s+([A-Za-z_$][\w$]*)/d},{kind:"interface",re:/^(?:export\s+)?(?:declare\s+)?interface\s+([A-Za-z_$][\w$]*)/d},{kind:"type",re:/^(?:export\s+)?(?:declare\s+)?type\s+([A-Za-z_$][\w$]*)/d},{kind:"enum",re:/^(?:export\s+)?(?:declare\s+)?(?:const\s+)?enum\s+([A-Za-z_$][\w$]*)/d},{kind:"module",re:/^(?:export\s+)?(?:declare\s+)?(?:namespace|module)\s+([A-Za-z_$][\w$]*)/d},{kind:"function",re:/^(?:export\s+)?(?:default\s+)?(?:async\s+)?function\s*\*?\s*([A-Za-z_$][\w$]*)/d},{kind:"function",re:/^(?:export\s+)?(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s*(?::[^=]+)?=\s*(?:async\s*)?(?:\([^)]*\)|[A-Za-z_$][\w$]*)\s*(?::[^=]+)?=>/d},{kind:"constant",re:/^(?:export\s+)?(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s*[:=]/d}],Me=/^(?:(?:public|private|protected|static|async|readonly|override|abstract|declare|get|set)\s+)*(?:\*|#)?([A-Za-z_$][\w$]*)\s*(?:<[^>]*>)?\s*\(/d,Ie=/^(?:(?:public|private|protected|static|readonly|override|declare)\s+)*(?:#)?([A-Za-z_$][\w$]*)\s*(?::[^=]+)?=\s*(?:async\s*)?(?:\([^)]*\)|[A-Za-z_$][\w$]*)\s*(?::[^=]+)?=>/d,De=/^(?:(?:public|private|protected|static|readonly|override|declare)\s+)*(?:#)?([A-Za-z_$][\w$]*)\s*(?::[^=;]+)?(?:=[^>]|;)/d,L=[{kind:"method",re:Me},{kind:"method",re:Ie},{kind:"variable",re:De}];function P(l,r){let a=A(l,r.mask),d=[],t=0,p=[];for(let c=0;c<a.length;c+=1){let b=a[c].trim(),f=p.length>0&&t===p[p.length-1].depth?p[p.length-1]:null;if(b&&(t===0||f)){let m=a[c].length-a[c].trimStart().length,k=f&&r.members?Te(r.memberRules??[],b):null;if(k)d.push({name:k.name,kind:k.kind,line:c+1,column:m+k.column+1,depth:1});else{let h=f!==null&&$e.has(f.kind),_=Z(r.rules,b,h);if(_){if(d.push({name:_.name,kind:h&&_.kind==="function"?"method":_.kind,line:c+1,column:m+_.column+1,depth:f?1:0}),!h&&(r.scopes??[]).includes(_.kind))p.push({depth:t+1,kind:_.kind})}}}if(t+=z(a[c]),t<=0)t=0,p.length=0;else while(p.length>0&&t<p[p.length-1].depth)p.pop()}return d}var $e=new Set(["class","interface","struct","trait","impl","enum"]);function Z(l,r,a){for(let d of l){if(a&&Ne.has(d.kind))continue;let t=d.re.exec(r),p=t?.[1]?.trim();if(!t||!p)continue;return{name:p,kind:d.kind,column:t.indices?.[1]?.[0]??0}}return null}var Ne=new Set(["class","interface","enum","type","struct","trait","impl","module"]);function Te(l,r){for(let a of l){let d=a.re.exec(r),t=d?.[1]?.trim();if(!d||!t||qe.has(t))continue;return{name:t,kind:a.kind,column:d.indices?.[1]?.[0]??0}}return null}var qe=new Set(["if","for","while","switch","catch","return","throw","new","typeof","await","yield","super","this","delete","void","function","constructor","else","do","try","with"]);function H(l,r){let a=A(l,r.mask),d=[],t=[];for(let p=0;p<a.length;p+=1){let c=a[p],b=c.trim();if(!b)continue;let f=c.length-c.trimStart().length;while(t.length>0&&f<=t[t.length-1])t.pop();let m=Z(r.rules,b,!1);if(!m)continue;if(t.length>1){t.push(f);continue}let k=t.length===1;d.push({name:m.name,kind:k&&m.kind==="function"?"method":m.kind,line:p+1,column:f+m.column+1,depth:k?1:0}),t.push(f)}return d}function B(l,r){let a=A(l,r.mask),d=[];for(let t=0;t<a.length;t+=1){let p=a[t],c=p.trim();if(!c)continue;let b=Z(r.rules,c,!1);if(!b)continue;let f=d[d.length-1];if(r.dedupe&&f&&f.name===b.name&&f.kind===b.kind)continue;d.push({name:b.name,kind:b.kind,line:t+1,column:p.length-p.trimStart().length+b.column+1,depth:0})}return d}function j(l){let r=[],a=null;for(let d=0;d<l.length;d+=1){let t=l[d],p=/^\s*(```+|~~~+)/.exec(t);if(p){if(a===null)a=p[1][0];else if(p[1][0]===a)a=null;continue}if(a!==null)continue;let c=/^(#{1,6})\s+(.+?)\s*#*\s*$/.exec(t);if(!c)continue;r.push({name:c[2],kind:"heading",line:d+1,column:c[1].length+2,depth:Math.min(c[1].length-1,2)})}return r}function F(l){let r=A(l,"raw"),a=[],d=0;for(let t=0;t<r.length;t+=1){let p=r[t].trim();if(d===1){let c=/^"([^"]+)"\s*:/.exec(p);if(c)a.push({name:c[1],kind:"key",line:t+1,column:r[t].length-r[t].trimStart().length+1,depth:0})}if(d+=z(r[t]),d<0)d=0}return a}var S=[{kind:"class",re:/^(?:(?:public|private|protected|internal|static|final|abstract|sealed|open|data|partial|export|declare)\s+)*(?:class|record|object)\s+([A-Za-z_$][\w$]*)/d},{kind:"struct",re:/^(?:(?:public|private|protected|internal|export|packed)\s+)*(?:struct|union)\s+([A-Za-z_$][\w$]*)/d},{kind:"interface",re:/^(?:(?:public|private|protected|internal|static|abstract|sealed)\s+)*interface\s+([A-Za-z_$][\w$]*)/d},{kind:"enum",re:/^(?:(?:public|private|protected|internal|static)\s+)*(?:enum|@interface)\s+([A-Za-z_$][\w$]*)/d},{kind:"type",re:/^(?:(?:public|private|protected|internal|export)\s+)*(?:typedef|using)\b[^;=]*?\b([A-Za-z_]\w*)\s*(?:=|;|\{)/d},{kind:"trait",re:/^(?:(?:public|private|protected)\s+)*trait\s+([A-Za-z_$][\w$]*)/d},{kind:"module",re:/^(?:(?:public|internal|export)\s+)*(?:namespace|package)\s+([A-Za-z_$][\w$.]*)/d},{kind:"function",re:/^(?:(?:public|private|protected|internal|static|final|abstract|synchronized|override|open|suspend|inline|async|extern|unsafe|virtual|sealed|export)\s+)*(?:fun|func|function|def|void|int|long|float|double|boolean|bool|char|byte|short|string|String|object|dynamic|var|auto|val|[A-Z][\w$<>[\],.? ]*)\s+([A-Za-z_$][\w$]*)\s*(?:<[^>]*>)?\s*\(/d},{kind:"macro",re:/^#\s*(?:define|import)\s+([A-Za-z_]\w*)/d},{kind:"constant",re:/^(?:static\s+)?(?:const|constexpr|let|var|val)\s+([A-Za-z_$][\w$]*)/d}],W=[{kind:"method",re:/^(?:(?:public|private|protected|internal|static|final|abstract|synchronized|override|open|suspend|inline|async|extern|unsafe|virtual|sealed|readonly)\s+)*(?:<[^>]*>\s*)?([A-Za-z_$][\w$]*)\s*\(/d},{kind:"variable",re:/^(?:(?:public|private|protected|internal|static|final|readonly|override|volatile|transient|val|var|let|const)\s+)*([A-Za-z_$][\w$]*)\s*(?::[^=;]+)?(?:=[^>]|;)/d},{kind:"variable",re:/^(?:(?:public|private|protected|internal|static|final|readonly|volatile|transient)\s+)*[A-Za-z_$][\w$<>[\],.?]*\s+([A-Za-z_$][\w$]*)\s*(?:=|;)/d}],Y=[{kind:"function",re:/^func\s+(?:\([^)]*\)\s*)?([A-Za-z_]\w*)/d},{kind:"struct",re:/^type\s+([A-Za-z_]\w*)\s+struct\b/d},{kind:"interface",re:/^type\s+([A-Za-z_]\w*)\s+interface\b/d},{kind:"type",re:/^type\s+([A-Za-z_]\w*)\s+/d},{kind:"constant",re:/^(?:var|const)\s+([A-Za-z_]\w*)/d}],V=[{kind:"function",re:/^(?:pub(?:\([^)]*\))?\s+)?(?:async\s+)?(?:const\s+)?fn\s+([A-Za-z_]\w*)/d},{kind:"struct",re:/^(?:pub(?:\([^)]*\))?\s+)?struct\s+([A-Za-z_]\w*)/d},{kind:"enum",re:/^(?:pub(?:\([^)]*\))?\s+)?enum\s+([A-Za-z_]\w*)/d},{kind:"trait",re:/^(?:pub(?:\([^)]*\))?\s+)?(?:unsafe\s+)?trait\s+([A-Za-z_]\w*)/d},{kind:"module",re:/^(?:pub(?:\([^)]*\))?\s+)?mod\s+([A-Za-z_]\w*)/d},{kind:"impl",re:/^(?:pub\s+)?impl(?:<[^>]*>)?\s+(?:[A-Za-z_][\w:<>]*\s+for\s+)?([A-Za-z_]\w*)/d},{kind:"macro",re:/^(?:pub\s+)?macro_rules!\s*([A-Za-z_]\w*)/d},{kind:"constant",re:/^(?:pub(?:\([^)]*\))?\s+)?(?:const|static)\s+([A-Za-z_]\w*)/d}],X=[{kind:"class",re:/^class\s+([A-Z][\w:]*)/d},{kind:"module",re:/^module\s+([A-Z][\w:]*)/d},{kind:"function",re:/^def\s+(?:self\.)?([A-Za-z_]\w*[?!=]?)/d},{kind:"constant",re:/^([A-Z][A-Z0-9_]*)\s*=/d}],G=[{kind:"class",re:/^(?:(?:final|abstract|readonly)\s+)*(?:class|enum|trait)\s+([A-Za-z_]\w*)/d},{kind:"interface",re:/^interface\s+([A-Za-z_]\w*)/d},{kind:"function",re:/^(?:(?:public|private|protected|static|final|abstract)\s+)*function\s+&?([A-Za-z_]\w*)/d},{kind:"constant",re:/^(?:const|define\s*\(\s*['"])([A-Za-z_]\w*)/d}],J=[{kind:"function",re:/^(?:local\s+)?function\s+([A-Za-z_][\w.:]*)/d},{kind:"variable",re:/^local\s+([A-Za-z_]\w*)\s*=/d}],Q=[{kind:"class",re:/^class\s+([A-Za-z_]\w*)/d},{kind:"function",re:/^(?:async\s+)?def\s+([A-Za-z_]\w*)/d},{kind:"constant",re:/^([A-Z][A-Z0-9_]*)\s*(?::[^=]+)?=/d}],ee=[{kind:"function",re:/^(?:function\s+)?([A-Za-z_][\w-]*)\s*\(\s*\)/d},{kind:"function",re:/^function\s+([A-Za-z_][\w-]*)/d},{kind:"variable",re:/^(?:export\s+|declare\s+(?:-\w+\s+)*|readonly\s+)?([A-Za-z_]\w*)=/d}],te=[{kind:"module",re:/^defmodule\s+([A-Z][\w.]*)/d},{kind:"function",re:/^defp?\s+([a-z_]\w*[?!]?)/d},{kind:"macro",re:/^defmacro\s+([a-z_]\w*[?!]?)/d},{kind:"variable",re:/^@([a-z_]\w*)/d}],ne=[{kind:"module",re:/^-module\(([a-z_]\w*)\)/d},{kind:"function",re:/^([a-z_]\w*)\s*\([^)]*\)\s*(?:when\s+.*)?->/d},{kind:"macro",re:/^-define\(([A-Za-z_]\w*)/d}],se=[{kind:"module",re:/^module\s+([A-Z][\w.]*)/d},{kind:"type",re:/^(?:data|newtype|type|type alias)\s+([A-Z][\w]*)/d},{kind:"class",re:/^class\s+(?:\([^)]*\)\s*=>\s*)?([A-Z][\w]*)/d},{kind:"function",re:/^([a-z_][\w']*)\s*(?:::|[^=]*=)/d}],re=[{kind:"module",re:/^module\s+(?:type\s+)?([A-Z][\w]*)/d},{kind:"type",re:/^type\s+(?:'[\w]+\s+)*([a-z_]\w*)/d},{kind:"class",re:/^class\s+(?:virtual\s+)?([a-z_]\w*)/d},{kind:"function",re:/^(?:let\s+rec\s+|let\s+|and\s+)([a-z_]\w*)/d}],E=[{kind:"function",re:/^\(defn-?\s+([^\s()]+)/d},{kind:"macro",re:/^\(defmacro\s+([^\s()]+)/d},{kind:"variable",re:/^\(def\s+([^\s()]+)/d},{kind:"module",re:/^\((?:ns|module|define-module|library)\s+\(?([^\s()]+)/d},{kind:"function",re:/^\(define\s+\(([^\s()]+)/d},{kind:"type",re:/^\(defrecord\s+([^\s()]+)/d},{kind:"class",re:/^\(defclass\s+([^\s()]+)/d}],ae=[{kind:"function",re:/^(?:pub\s+)?(?:export\s+)?(?:inline\s+)?fn\s+([A-Za-z_]\w*)/d},{kind:"struct",re:/^(?:pub\s+)?const\s+([A-Za-z_]\w*)\s*=\s*(?:extern\s+)?(?:packed\s+)?struct/d},{kind:"enum",re:/^(?:pub\s+)?const\s+([A-Za-z_]\w*)\s*=\s*(?:packed\s+)?enum/d},{kind:"constant",re:/^(?:pub\s+)?const\s+([A-Za-z_]\w*)/d},{kind:"variable",re:/^(?:pub\s+)?var\s+([A-Za-z_]\w*)/d}],oe=[{kind:"module",re:/^(?:baremodule|module)\s+([A-Za-z_]\w*)/d},{kind:"struct",re:/^(?:mutable\s+)?struct\s+([A-Za-z_]\w*)/d},{kind:"interface",re:/^abstract\s+type\s+([A-Za-z_]\w*)/d},{kind:"macro",re:/^macro\s+([A-Za-z_]\w*)/d},{kind:"function",re:/^function\s+([A-Za-z_]\w*[!?]?)/d},{kind:"function",re:/^([A-Za-z_]\w*[!?]?)\s*\([^)]*\)\s*(?:::[^=]+)?=/d},{kind:"constant",re:/^const\s+([A-Za-z_]\w*)/d}],ie=[{kind:"function",re:/^([A-Za-z._][\w.]*)\s*(?:<-|=)\s*function/d},{kind:"variable",re:/^([A-Za-z._][\w.]*)\s*(?:<-|=)/d}],le=[{kind:"class",re:/^create\s+(?:or\s+replace\s+)?(?:table|view)\s+(?:if\s+not\s+exists\s+)?["`]?([\w.]+)/id},{kind:"function",re:/^create\s+(?:or\s+replace\s+)?(?:function|procedure)\s+["`]?([\w.]+)/id},{kind:"type",re:/^create\s+(?:or\s+replace\s+)?(?:type|domain|index)\s+(?:if\s+not\s+exists\s+)?["`]?([\w.]+)/id},{kind:"constant",re:/^create\s+(?:or\s+replace\s+)?(?:sequence|schema)\s+(?:if\s+not\s+exists\s+)?["`]?([\w.]+)/id}],O=[{kind:"class",re:/^(?:message|type|input|object)\s+([A-Za-z_]\w*)/d},{kind:"interface",re:/^(?:interface|service|union|scalar)\s+([A-Za-z_]\w*)/d},{kind:"enum",re:/^enum\s+([A-Za-z_]\w*)/d},{kind:"function",re:/^(?:query|mutation|subscription)\s+([A-Za-z_]\w*)/d},{kind:"function",re:/^(?:rpc\s+)?([A-Za-z_]\w*)\s*\([^)]*\)\s*(?::|returns|;)/d}],ce=[{kind:"module",re:/^(?:resource|data|module|provider|variable|output|locals|terraform)\s+"([^"]+)"/d},{kind:"function",re:/^([A-Za-z_]\w*)\s*=\s*\{/d}],de=[{kind:"function",re:/^([A-Za-z0-9_./-]+)\s*:(?!=)/d},{kind:"variable",re:/^(?:export\s+)?([A-Za-z_]\w*)\s*[:?+]?=/d}],ue=[{kind:"module",re:/^FROM\s+(?:--platform=\S+\s+)?\S+\s+[Aa][Ss]\s+(\S+)/d},{kind:"module",re:/^FROM\s+(?:--platform=\S+\s+)?(\S+)/id},{kind:"variable",re:/^(?:ARG|ENV)\s+([A-Za-z_]\w*)/d}],pe=[{kind:"function",re:/^([A-Za-z_][\w'-]*)\s*=\s*(?:pkgs\.)?(?:lib\.)?(?:callPackage|\{)/d},{kind:"variable",re:/^([A-Za-z_][\w'-]*)\s*=/d}],R=[{kind:"macro",re:/^(@(?:mixin|function|keyframes)\s+[\w-]+)/d},{kind:"selector",re:/^(@(?:media|supports|layer|container)\s+[^{]+)/d},{kind:"selector",re:/^([.#&:][^{};]*(?:\s*,\s*[^{};]+)*)\s*\{/d},{kind:"variable",re:/^(--[\w-]+|@[\w-]+|\$[\w-]+)\s*:/d}],me=[{kind:"module",re:/^package\s+([\w:]+)/d},{kind:"function",re:/^sub\s+([A-Za-z_]\w*)/d}],fe=[{kind:"class",re:/^(?:abstract\s+)?(?:contract|library)\s+([A-Za-z_]\w*)/d},{kind:"interface",re:/^interface\s+([A-Za-z_]\w*)/d},{kind:"struct",re:/^struct\s+([A-Za-z_]\w*)/d},{kind:"enum",re:/^enum\s+([A-Za-z_]\w*)/d},{kind:"function",re:/^(?:function|modifier|constructor|fallback|receive)\s+([A-Za-z_]\w*)/d},{kind:"variable",re:/^(?:event|error)\s+([A-Za-z_]\w*)/d}],ke=[{kind:"class",re:/^class\s+([A-Za-z_]\w*)/d},{kind:"enum",re:/^enum\s+([A-Za-z_]\w*)/d},{kind:"function",re:/^(?:function|filter|workflow)\s+([A-Za-z_][\w-]*)/d}],w=[{kind:"tag",re:/^\s*<([A-Z][\w.]*)/d},{kind:"tag",re:/^\s*<[a-z][\w-]*\b[^>]*\bid=["']([^"']+)["']/d}];var y={mask:"c",nesting:"braces",scopes:["class","module","interface","struct","trait","enum"],members:!0,memberRules:W},be={typescript:{...y,rules:x,memberRules:L,scopes:["class"]},tsx:{...y,rules:x,memberRules:L,scopes:["class"]},javascript:{...y,rules:x,memberRules:L,scopes:["class"]},jsx:{...y,rules:x,memberRules:L,scopes:["class"]},java:{...y,rules:S},c:{...y,rules:S},cpp:{...y,rules:S},csharp:{...y,rules:S},"objective-c":{...y,rules:S},kotlin:{...y,rules:S},swift:{...y,rules:S},scala:{...y,rules:S},dart:{...y,rules:S},groovy:{...y,rules:S},solidity:{...y,rules:fe},php:{mask:"c",nesting:"braces",rules:G,scopes:["class","interface","trait"],members:!0},go:{mask:"c",nesting:"braces",rules:Y},rust:{mask:"c",nesting:"braces",rules:V,scopes:["impl","trait"],members:!0},zig:{mask:"c",nesting:"braces",rules:ae,scopes:["struct","enum"],members:!0},hcl:{mask:"hcl",nesting:"braces",rules:ce},protobuf:{mask:"c",nesting:"braces",rules:O,scopes:["class","interface"],members:!0},graphql:{mask:"hash",nesting:"braces",rules:O,scopes:["class","interface"],members:!0},css:{mask:"css",nesting:"braces",rules:R,scopes:["selector"]},less:{mask:"css",nesting:"braces",rules:R,scopes:["selector"]},scss:{mask:"css",nesting:"braces",rules:R,scopes:["selector"]},sass:{mask:"css",nesting:"braces",rules:R,scopes:["selector"]},stylus:{mask:"css",nesting:"braces",rules:R,scopes:["selector"]},ruby:{mask:"hash",nesting:"flat",rules:X},lua:{mask:"lua",nesting:"flat",rules:J},elixir:{mask:"hash",nesting:"flat",rules:te},erlang:{mask:"percent",nesting:"flat",rules:ne},haskell:{mask:"hash",nesting:"flat",rules:se,dedupe:!0},ocaml:{mask:"ml",nesting:"flat",rules:re},julia:{mask:"hash",nesting:"flat",rules:oe},r:{mask:"hash",nesting:"flat",rules:ie},clojure:{mask:"lisp",nesting:"flat",rules:E},scheme:{mask:"lisp",nesting:"flat",rules:E},racket:{mask:"lisp",nesting:"flat",rules:E},perl:{mask:"hash",nesting:"flat",rules:me},powershell:{mask:"hash",nesting:"flat",rules:ke},bash:{mask:"hash",nesting:"flat",rules:ee},sql:{mask:"sql",nesting:"flat",rules:le},makefile:{mask:"hash",nesting:"flat",rules:de},dockerfile:{mask:"hash",nesting:"flat",rules:ue},nix:{mask:"hash",nesting:"flat",rules:pe},python:{mask:"python",nesting:"indent",rules:Q},yaml:{mask:"hash",nesting:"indent",rules:[{kind:"key",re:/^([A-Za-z_$][\w$.-]*)\s*:/d}]},toml:{mask:"hash",nesting:"flat",rules:[{kind:"module",re:/^\[\[?([^\]]+)\]\]?/d},{kind:"key",re:/^([A-Za-z_][\w.-]*)\s*=/d}]},ini:{mask:"none",nesting:"flat",rules:[{kind:"module",re:/^\[([^\]]+)\]/d},{kind:"key",re:/^([A-Za-z_][\w.-]*)\s*[=:]/d}]},properties:{mask:"none",nesting:"flat",rules:[{kind:"key",re:/^([A-Za-z_][\w.-]*)\s*[=:]/d}]},json:{mask:"raw",nesting:"json",rules:[]},json5:{mask:"raw",nesting:"json",rules:[]},html:{mask:"raw",nesting:"flat",rules:w},xml:{mask:"raw",nesting:"flat",rules:w},svg:{mask:"raw",nesting:"flat",rules:w},vue:{mask:"raw",nesting:"flat",rules:w},svelte:{mask:"raw",nesting:"flat",rules:w},astro:{mask:"raw",nesting:"flat",rules:w},markdown:{mask:"none",nesting:"markdown",rules:[]},diff:{mask:"none",nesting:"flat",rules:[]}};function U(l,r){let a=be[r];if(!l||!a)return[];let d=l.split(`
1
+ import{n,o,i,u,e,s,vr,kr,Ga,bo,Hr,Mi,Pi,vo,Yr}from"./index-4c2zcvem.js";var Ae={name:"square-function",size:24,node:[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["path",{d:"M9 17c2 0 2.8-1 2.8-2.8V10c0-2 1-3.3 3.2-3",key:"m1af9g"}],["path",{d:"M9 11.2h5.7",key:"3zgcl2"}]],aliases:["function-square"]},v=s(Ae);var xe={name:"blocks",size:24,node:[["path",{d:"M10 22V7a1 1 0 0 0-1-1H4a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-5a1 1 0 0 0-1-1H2",key:"1ah6g2"}],["rect",{x:"14",y:"2",width:"8",height:"8",rx:"1",key:"88lufb"}]]},M=s(xe);var Le={name:"box",size:24,node:[["path",{d:"M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z",key:"hh9hay"}],["path",{d:"m3.3 7 8.7 5 8.7-5",key:"g66t2b"}],["path",{d:"M12 22V12",key:"d0xqtd"}]]},I=s(Le);var Ee={name:"component",size:24,node:[["path",{d:"M15.536 11.293a1 1 0 0 0 0 1.414l2.376 2.377a1 1 0 0 0 1.414 0l2.377-2.377a1 1 0 0 0 0-1.414l-2.377-2.377a1 1 0 0 0-1.414 0z",key:"1uwlt4"}],["path",{d:"M2.297 11.293a1 1 0 0 0 0 1.414l2.377 2.377a1 1 0 0 0 1.414 0l2.377-2.377a1 1 0 0 0 0-1.414L6.088 8.916a1 1 0 0 0-1.414 0z",key:"10291m"}],["path",{d:"M8.916 17.912a1 1 0 0 0 0 1.415l2.377 2.376a1 1 0 0 0 1.414 0l2.377-2.376a1 1 0 0 0 0-1.415l-2.377-2.376a1 1 0 0 0-1.414 0z",key:"1tqoq1"}],["path",{d:"M8.916 4.674a1 1 0 0 0 0 1.414l2.377 2.376a1 1 0 0 0 1.414 0l2.377-2.376a1 1 0 0 0 0-1.414l-2.377-2.377a1 1 0 0 0-1.414 0z",key:"1x6lto"}]]},D=s(Ee);var ze={name:"heading",size:24,node:[["path",{d:"M6 12h12",key:"8npq4p"}],["path",{d:"M6 20V4",key:"1w1bmo"}],["path",{d:"M18 20V4",key:"o2hl4u"}]]},N=s(ze);var Ze={name:"paintbrush",size:24,node:[["path",{d:"m14.622 17.897-10.68-2.913",key:"vj2p1u"}],["path",{d:"M18.376 2.622a1 1 0 1 1 3.002 3.002L17.36 9.643a.5.5 0 0 0 0 .707l.944.944a2.41 2.41 0 0 1 0 3.408l-.944.944a.5.5 0 0 1-.707 0L8.354 7.348a.5.5 0 0 1 0-.707l.944-.944a2.41 2.41 0 0 1 3.408 0l.944.944a.5.5 0 0 0 .707 0z",key:"18tc5c"}],["path",{d:"M9 8c-1.804 2.71-3.97 3.46-6.583 3.948a.507.507 0 0 0-.302.819l7.32 8.883a1 1 0 0 0 1.185.204C12.735 20.405 16 16.792 16 15",key:"ytzfxy"}]]},T=s(Ze);var Oe={name:"tag",size:24,node:[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",key:"vktsd0"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}]]},q=s(Oe);var Ue={name:"variable",size:24,node:[["path",{d:"M8 21s-4-3-4-9 4-9 4-9",key:"uto9ud"}],["path",{d:"M16 3s4 3 4 9-4 9-4 9",key:"4w2vsq"}],["line",{x1:"15",x2:"9",y1:"9",y2:"15",key:"f7djnv"}],["line",{x1:"9",x2:"15",y1:"9",y2:"15",key:"1shsy8"}]]},C=s(Ue);var K={class:{Icon:kr,label:"Class"},interface:{Icon:vo,label:"Interface"},type:{Icon:Yr,label:"Type"},enum:{Icon:Hr,label:"Enum"},function:{Icon:v,label:"Function"},method:{Icon:D,label:"Method"},constant:{Icon:Ga,label:"Constant"},variable:{Icon:C,label:"Variable"},struct:{Icon:I,label:"Struct"},trait:{Icon:Pi,label:"Trait"},impl:{Icon:M,label:"Impl"},module:{Icon:Mi,label:"Module"},heading:{Icon:N,label:"Heading"},selector:{Icon:T,label:"Selector"},key:{Icon:bo,label:"Key"},tag:{Icon:q,label:"Tag"},macro:{Icon:vr,label:"Macro"}};function Du({kind:l,size:r=12}){let{Icon:a}=K[l];return e(a,{size:r,className:"flex-shrink-0 text-ink/45",strokeWidth:1.8})}function Ko(l){return K[l].label}var ve={c:{line:["//"],block:["/*","*/"],quotes:["'",'"'],template:!0},css:{line:[],block:["/*","*/"],quotes:["'",'"']},python:{line:["#"],quotes:["'",'"'],triple:!0},hash:{line:["#"],quotes:["'",'"']},dash:{line:["--"],quotes:["'",'"']},lua:{line:["--"],block:["--[[","]]"],quotes:["'",'"']},sql:{line:["--"],block:["/*","*/"],quotes:["'",'"']},ml:{line:[],block:["(*","*)"],quotes:['"']},hcl:{line:["#","//"],block:["/*","*/"],quotes:[]},percent:{line:["%"],quotes:["'",'"']},lisp:{line:[";"],block:["#|","|#"],quotes:['"']},none:{line:[],quotes:['"',"'"]},raw:{line:[],quotes:[]}};function A(l,r){let a=ve[r],[d,t]=a.block??["",""],p=[],c="code",b="";for(let f of l){let m="";for(let k=0;k<f.length;k+=1){let h=f[k],_=f[k+1];if(c==="line"){m+=" ";continue}if(c==="block"){if(t&&h===t[0]&&f.startsWith(t,k)){c="code",m+=" ".repeat(t.length),k+=t.length-1;continue}m+=" ";continue}if(c==="quoted"||c==="template"||c==="triple"){if(h==="\\"){m+=" ",k+=1;continue}if(c==="triple"){if(h===b&&f.startsWith(b.repeat(3),k)){c="code",m+=" ",k+=2;continue}m+=" ";continue}if(m+=" ",h===b)c="code";continue}let g=a.line.find((Re)=>f.startsWith(Re,k));if(g){c="line",m+=" ".repeat(g.length),k+=g.length-1;continue}if(d&&f.startsWith(d,k)){c="block",m+=" ".repeat(d.length),k+=d.length-1;continue}if(a.triple&&h===(_??"")&&h===f[k+2]&&(h==="'"||h==='"')){c="triple",b=h,m+=" ",k+=2;continue}if(a.template&&h==="`"){c="template",b="`",m+=" ";continue}if(a.quotes?.includes(h)){c="quoted",b=h,m+=" ";continue}m+=h}if(c==="line"||c==="quoted")c="code";p.push(m)}return p}function z(l){let r=0;for(let a of l)if(a==="{")r+=1;else if(a==="}")r-=1;return r}var x=[{kind:"class",re:/^(?:export\s+)?(?:default\s+)?(?:abstract\s+)?(?:declare\s+)?class\s+([A-Za-z_$][\w$]*)/d},{kind:"interface",re:/^(?:export\s+)?(?:declare\s+)?interface\s+([A-Za-z_$][\w$]*)/d},{kind:"type",re:/^(?:export\s+)?(?:declare\s+)?type\s+([A-Za-z_$][\w$]*)/d},{kind:"enum",re:/^(?:export\s+)?(?:declare\s+)?(?:const\s+)?enum\s+([A-Za-z_$][\w$]*)/d},{kind:"module",re:/^(?:export\s+)?(?:declare\s+)?(?:namespace|module)\s+([A-Za-z_$][\w$]*)/d},{kind:"function",re:/^(?:export\s+)?(?:default\s+)?(?:async\s+)?function\s*\*?\s*([A-Za-z_$][\w$]*)/d},{kind:"function",re:/^(?:export\s+)?(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s*(?::[^=]+)?=\s*(?:async\s*)?(?:\([^)]*\)|[A-Za-z_$][\w$]*)\s*(?::[^=]+)?=>/d},{kind:"constant",re:/^(?:export\s+)?(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s*[:=]/d}],Me=/^(?:(?:public|private|protected|static|async|readonly|override|abstract|declare|get|set)\s+)*(?:\*|#)?([A-Za-z_$][\w$]*)\s*(?:<[^>]*>)?\s*\(/d,Ie=/^(?:(?:public|private|protected|static|readonly|override|declare)\s+)*(?:#)?([A-Za-z_$][\w$]*)\s*(?::[^=]+)?=\s*(?:async\s*)?(?:\([^)]*\)|[A-Za-z_$][\w$]*)\s*(?::[^=]+)?=>/d,De=/^(?:(?:public|private|protected|static|readonly|override|declare)\s+)*(?:#)?([A-Za-z_$][\w$]*)\s*(?::[^=;]+)?(?:=[^>]|;)/d,L=[{kind:"method",re:Me},{kind:"method",re:Ie},{kind:"variable",re:De}];function P(l,r){let a=A(l,r.mask),d=[],t=0,p=[];for(let c=0;c<a.length;c+=1){let b=a[c].trim(),f=p.length>0&&t===p[p.length-1].depth?p[p.length-1]:null;if(b&&(t===0||f)){let m=a[c].length-a[c].trimStart().length,k=f&&r.members?Te(r.memberRules??[],b):null;if(k)d.push({name:k.name,kind:k.kind,line:c+1,column:m+k.column+1,depth:1});else{let h=f!==null&&$e.has(f.kind),_=Z(r.rules,b,h);if(_){if(d.push({name:_.name,kind:h&&_.kind==="function"?"method":_.kind,line:c+1,column:m+_.column+1,depth:f?1:0}),!h&&(r.scopes??[]).includes(_.kind))p.push({depth:t+1,kind:_.kind})}}}if(t+=z(a[c]),t<=0)t=0,p.length=0;else while(p.length>0&&t<p[p.length-1].depth)p.pop()}return d}var $e=new Set(["class","interface","struct","trait","impl","enum"]);function Z(l,r,a){for(let d of l){if(a&&Ne.has(d.kind))continue;let t=d.re.exec(r),p=t?.[1]?.trim();if(!t||!p)continue;return{name:p,kind:d.kind,column:t.indices?.[1]?.[0]??0}}return null}var Ne=new Set(["class","interface","enum","type","struct","trait","impl","module"]);function Te(l,r){for(let a of l){let d=a.re.exec(r),t=d?.[1]?.trim();if(!d||!t||qe.has(t))continue;return{name:t,kind:a.kind,column:d.indices?.[1]?.[0]??0}}return null}var qe=new Set(["if","for","while","switch","catch","return","throw","new","typeof","await","yield","super","this","delete","void","function","constructor","else","do","try","with"]);function H(l,r){let a=A(l,r.mask),d=[],t=[];for(let p=0;p<a.length;p+=1){let c=a[p],b=c.trim();if(!b)continue;let f=c.length-c.trimStart().length;while(t.length>0&&f<=t[t.length-1])t.pop();let m=Z(r.rules,b,!1);if(!m)continue;if(t.length>1){t.push(f);continue}let k=t.length===1;d.push({name:m.name,kind:k&&m.kind==="function"?"method":m.kind,line:p+1,column:f+m.column+1,depth:k?1:0}),t.push(f)}return d}function B(l,r){let a=A(l,r.mask),d=[];for(let t=0;t<a.length;t+=1){let p=a[t],c=p.trim();if(!c)continue;let b=Z(r.rules,c,!1);if(!b)continue;let f=d[d.length-1];if(r.dedupe&&f&&f.name===b.name&&f.kind===b.kind)continue;d.push({name:b.name,kind:b.kind,line:t+1,column:p.length-p.trimStart().length+b.column+1,depth:0})}return d}function j(l){let r=[],a=null;for(let d=0;d<l.length;d+=1){let t=l[d],p=/^\s*(```+|~~~+)/.exec(t);if(p){if(a===null)a=p[1][0];else if(p[1][0]===a)a=null;continue}if(a!==null)continue;let c=/^(#{1,6})\s+(.+?)\s*#*\s*$/.exec(t);if(!c)continue;r.push({name:c[2],kind:"heading",line:d+1,column:c[1].length+2,depth:Math.min(c[1].length-1,2)})}return r}function F(l){let r=A(l,"raw"),a=[],d=0;for(let t=0;t<r.length;t+=1){let p=r[t].trim();if(d===1){let c=/^"([^"]+)"\s*:/.exec(p);if(c)a.push({name:c[1],kind:"key",line:t+1,column:r[t].length-r[t].trimStart().length+1,depth:0})}if(d+=z(r[t]),d<0)d=0}return a}var S=[{kind:"class",re:/^(?:(?:public|private|protected|internal|static|final|abstract|sealed|open|data|partial|export|declare)\s+)*(?:class|record|object)\s+([A-Za-z_$][\w$]*)/d},{kind:"struct",re:/^(?:(?:public|private|protected|internal|export|packed)\s+)*(?:struct|union)\s+([A-Za-z_$][\w$]*)/d},{kind:"interface",re:/^(?:(?:public|private|protected|internal|static|abstract|sealed)\s+)*interface\s+([A-Za-z_$][\w$]*)/d},{kind:"enum",re:/^(?:(?:public|private|protected|internal|static)\s+)*(?:enum|@interface)\s+([A-Za-z_$][\w$]*)/d},{kind:"type",re:/^(?:(?:public|private|protected|internal|export)\s+)*(?:typedef|using)\b[^;=]*?\b([A-Za-z_]\w*)\s*(?:=|;|\{)/d},{kind:"trait",re:/^(?:(?:public|private|protected)\s+)*trait\s+([A-Za-z_$][\w$]*)/d},{kind:"module",re:/^(?:(?:public|internal|export)\s+)*(?:namespace|package)\s+([A-Za-z_$][\w$.]*)/d},{kind:"function",re:/^(?:(?:public|private|protected|internal|static|final|abstract|synchronized|override|open|suspend|inline|async|extern|unsafe|virtual|sealed|export)\s+)*(?:fun|func|function|def|void|int|long|float|double|boolean|bool|char|byte|short|string|String|object|dynamic|var|auto|val|[A-Z][\w$<>[\],.? ]*)\s+([A-Za-z_$][\w$]*)\s*(?:<[^>]*>)?\s*\(/d},{kind:"macro",re:/^#\s*(?:define|import)\s+([A-Za-z_]\w*)/d},{kind:"constant",re:/^(?:static\s+)?(?:const|constexpr|let|var|val)\s+([A-Za-z_$][\w$]*)/d}],W=[{kind:"method",re:/^(?:(?:public|private|protected|internal|static|final|abstract|synchronized|override|open|suspend|inline|async|extern|unsafe|virtual|sealed|readonly)\s+)*(?:<[^>]*>\s*)?([A-Za-z_$][\w$]*)\s*\(/d},{kind:"variable",re:/^(?:(?:public|private|protected|internal|static|final|readonly|override|volatile|transient|val|var|let|const)\s+)*([A-Za-z_$][\w$]*)\s*(?::[^=;]+)?(?:=[^>]|;)/d},{kind:"variable",re:/^(?:(?:public|private|protected|internal|static|final|readonly|volatile|transient)\s+)*[A-Za-z_$][\w$<>[\],.?]*\s+([A-Za-z_$][\w$]*)\s*(?:=|;)/d}],Y=[{kind:"function",re:/^func\s+(?:\([^)]*\)\s*)?([A-Za-z_]\w*)/d},{kind:"struct",re:/^type\s+([A-Za-z_]\w*)\s+struct\b/d},{kind:"interface",re:/^type\s+([A-Za-z_]\w*)\s+interface\b/d},{kind:"type",re:/^type\s+([A-Za-z_]\w*)\s+/d},{kind:"constant",re:/^(?:var|const)\s+([A-Za-z_]\w*)/d}],V=[{kind:"function",re:/^(?:pub(?:\([^)]*\))?\s+)?(?:async\s+)?(?:const\s+)?fn\s+([A-Za-z_]\w*)/d},{kind:"struct",re:/^(?:pub(?:\([^)]*\))?\s+)?struct\s+([A-Za-z_]\w*)/d},{kind:"enum",re:/^(?:pub(?:\([^)]*\))?\s+)?enum\s+([A-Za-z_]\w*)/d},{kind:"trait",re:/^(?:pub(?:\([^)]*\))?\s+)?(?:unsafe\s+)?trait\s+([A-Za-z_]\w*)/d},{kind:"module",re:/^(?:pub(?:\([^)]*\))?\s+)?mod\s+([A-Za-z_]\w*)/d},{kind:"impl",re:/^(?:pub\s+)?impl(?:<[^>]*>)?\s+(?:[A-Za-z_][\w:<>]*\s+for\s+)?([A-Za-z_]\w*)/d},{kind:"macro",re:/^(?:pub\s+)?macro_rules!\s*([A-Za-z_]\w*)/d},{kind:"constant",re:/^(?:pub(?:\([^)]*\))?\s+)?(?:const|static)\s+([A-Za-z_]\w*)/d}],X=[{kind:"class",re:/^class\s+([A-Z][\w:]*)/d},{kind:"module",re:/^module\s+([A-Z][\w:]*)/d},{kind:"function",re:/^def\s+(?:self\.)?([A-Za-z_]\w*[?!=]?)/d},{kind:"constant",re:/^([A-Z][A-Z0-9_]*)\s*=/d}],G=[{kind:"class",re:/^(?:(?:final|abstract|readonly)\s+)*(?:class|enum|trait)\s+([A-Za-z_]\w*)/d},{kind:"interface",re:/^interface\s+([A-Za-z_]\w*)/d},{kind:"function",re:/^(?:(?:public|private|protected|static|final|abstract)\s+)*function\s+&?([A-Za-z_]\w*)/d},{kind:"constant",re:/^(?:const|define\s*\(\s*['"])([A-Za-z_]\w*)/d}],J=[{kind:"function",re:/^(?:local\s+)?function\s+([A-Za-z_][\w.:]*)/d},{kind:"variable",re:/^local\s+([A-Za-z_]\w*)\s*=/d}],Q=[{kind:"class",re:/^class\s+([A-Za-z_]\w*)/d},{kind:"function",re:/^(?:async\s+)?def\s+([A-Za-z_]\w*)/d},{kind:"constant",re:/^([A-Z][A-Z0-9_]*)\s*(?::[^=]+)?=/d}],ee=[{kind:"function",re:/^(?:function\s+)?([A-Za-z_][\w-]*)\s*\(\s*\)/d},{kind:"function",re:/^function\s+([A-Za-z_][\w-]*)/d},{kind:"variable",re:/^(?:export\s+|declare\s+(?:-\w+\s+)*|readonly\s+)?([A-Za-z_]\w*)=/d}],te=[{kind:"module",re:/^defmodule\s+([A-Z][\w.]*)/d},{kind:"function",re:/^defp?\s+([a-z_]\w*[?!]?)/d},{kind:"macro",re:/^defmacro\s+([a-z_]\w*[?!]?)/d},{kind:"variable",re:/^@([a-z_]\w*)/d}],ne=[{kind:"module",re:/^-module\(([a-z_]\w*)\)/d},{kind:"function",re:/^([a-z_]\w*)\s*\([^)]*\)\s*(?:when\s+.*)?->/d},{kind:"macro",re:/^-define\(([A-Za-z_]\w*)/d}],se=[{kind:"module",re:/^module\s+([A-Z][\w.]*)/d},{kind:"type",re:/^(?:data|newtype|type|type alias)\s+([A-Z][\w]*)/d},{kind:"class",re:/^class\s+(?:\([^)]*\)\s*=>\s*)?([A-Z][\w]*)/d},{kind:"function",re:/^([a-z_][\w']*)\s*(?:::|[^=]*=)/d}],re=[{kind:"module",re:/^module\s+(?:type\s+)?([A-Z][\w]*)/d},{kind:"type",re:/^type\s+(?:'[\w]+\s+)*([a-z_]\w*)/d},{kind:"class",re:/^class\s+(?:virtual\s+)?([a-z_]\w*)/d},{kind:"function",re:/^(?:let\s+rec\s+|let\s+|and\s+)([a-z_]\w*)/d}],E=[{kind:"function",re:/^\(defn-?\s+([^\s()]+)/d},{kind:"macro",re:/^\(defmacro\s+([^\s()]+)/d},{kind:"variable",re:/^\(def\s+([^\s()]+)/d},{kind:"module",re:/^\((?:ns|module|define-module|library)\s+\(?([^\s()]+)/d},{kind:"function",re:/^\(define\s+\(([^\s()]+)/d},{kind:"type",re:/^\(defrecord\s+([^\s()]+)/d},{kind:"class",re:/^\(defclass\s+([^\s()]+)/d}],ae=[{kind:"function",re:/^(?:pub\s+)?(?:export\s+)?(?:inline\s+)?fn\s+([A-Za-z_]\w*)/d},{kind:"struct",re:/^(?:pub\s+)?const\s+([A-Za-z_]\w*)\s*=\s*(?:extern\s+)?(?:packed\s+)?struct/d},{kind:"enum",re:/^(?:pub\s+)?const\s+([A-Za-z_]\w*)\s*=\s*(?:packed\s+)?enum/d},{kind:"constant",re:/^(?:pub\s+)?const\s+([A-Za-z_]\w*)/d},{kind:"variable",re:/^(?:pub\s+)?var\s+([A-Za-z_]\w*)/d}],oe=[{kind:"module",re:/^(?:baremodule|module)\s+([A-Za-z_]\w*)/d},{kind:"struct",re:/^(?:mutable\s+)?struct\s+([A-Za-z_]\w*)/d},{kind:"interface",re:/^abstract\s+type\s+([A-Za-z_]\w*)/d},{kind:"macro",re:/^macro\s+([A-Za-z_]\w*)/d},{kind:"function",re:/^function\s+([A-Za-z_]\w*[!?]?)/d},{kind:"function",re:/^([A-Za-z_]\w*[!?]?)\s*\([^)]*\)\s*(?:::[^=]+)?=/d},{kind:"constant",re:/^const\s+([A-Za-z_]\w*)/d}],ie=[{kind:"function",re:/^([A-Za-z._][\w.]*)\s*(?:<-|=)\s*function/d},{kind:"variable",re:/^([A-Za-z._][\w.]*)\s*(?:<-|=)/d}],le=[{kind:"class",re:/^create\s+(?:or\s+replace\s+)?(?:table|view)\s+(?:if\s+not\s+exists\s+)?["`]?([\w.]+)/id},{kind:"function",re:/^create\s+(?:or\s+replace\s+)?(?:function|procedure)\s+["`]?([\w.]+)/id},{kind:"type",re:/^create\s+(?:or\s+replace\s+)?(?:type|domain|index)\s+(?:if\s+not\s+exists\s+)?["`]?([\w.]+)/id},{kind:"constant",re:/^create\s+(?:or\s+replace\s+)?(?:sequence|schema)\s+(?:if\s+not\s+exists\s+)?["`]?([\w.]+)/id}],O=[{kind:"class",re:/^(?:message|type|input|object)\s+([A-Za-z_]\w*)/d},{kind:"interface",re:/^(?:interface|service|union|scalar)\s+([A-Za-z_]\w*)/d},{kind:"enum",re:/^enum\s+([A-Za-z_]\w*)/d},{kind:"function",re:/^(?:query|mutation|subscription)\s+([A-Za-z_]\w*)/d},{kind:"function",re:/^(?:rpc\s+)?([A-Za-z_]\w*)\s*\([^)]*\)\s*(?::|returns|;)/d}],ce=[{kind:"module",re:/^(?:resource|data|module|provider|variable|output|locals|terraform)\s+"([^"]+)"/d},{kind:"function",re:/^([A-Za-z_]\w*)\s*=\s*\{/d}],de=[{kind:"function",re:/^([A-Za-z0-9_./-]+)\s*:(?!=)/d},{kind:"variable",re:/^(?:export\s+)?([A-Za-z_]\w*)\s*[:?+]?=/d}],ue=[{kind:"module",re:/^FROM\s+(?:--platform=\S+\s+)?\S+\s+[Aa][Ss]\s+(\S+)/d},{kind:"module",re:/^FROM\s+(?:--platform=\S+\s+)?(\S+)/id},{kind:"variable",re:/^(?:ARG|ENV)\s+([A-Za-z_]\w*)/d}],pe=[{kind:"function",re:/^([A-Za-z_][\w'-]*)\s*=\s*(?:pkgs\.)?(?:lib\.)?(?:callPackage|\{)/d},{kind:"variable",re:/^([A-Za-z_][\w'-]*)\s*=/d}],R=[{kind:"macro",re:/^(@(?:mixin|function|keyframes)\s+[\w-]+)/d},{kind:"selector",re:/^(@(?:media|supports|layer|container)\s+[^{]+)/d},{kind:"selector",re:/^([.#&:][^{};]*(?:\s*,\s*[^{};]+)*)\s*\{/d},{kind:"variable",re:/^(--[\w-]+|@[\w-]+|\$[\w-]+)\s*:/d}],me=[{kind:"module",re:/^package\s+([\w:]+)/d},{kind:"function",re:/^sub\s+([A-Za-z_]\w*)/d}],fe=[{kind:"class",re:/^(?:abstract\s+)?(?:contract|library)\s+([A-Za-z_]\w*)/d},{kind:"interface",re:/^interface\s+([A-Za-z_]\w*)/d},{kind:"struct",re:/^struct\s+([A-Za-z_]\w*)/d},{kind:"enum",re:/^enum\s+([A-Za-z_]\w*)/d},{kind:"function",re:/^(?:function|modifier|constructor|fallback|receive)\s+([A-Za-z_]\w*)/d},{kind:"variable",re:/^(?:event|error)\s+([A-Za-z_]\w*)/d}],ke=[{kind:"class",re:/^class\s+([A-Za-z_]\w*)/d},{kind:"enum",re:/^enum\s+([A-Za-z_]\w*)/d},{kind:"function",re:/^(?:function|filter|workflow)\s+([A-Za-z_][\w-]*)/d}],w=[{kind:"tag",re:/^\s*<([A-Z][\w.]*)/d},{kind:"tag",re:/^\s*<[a-z][\w-]*\b[^>]*\bid=["']([^"']+)["']/d}];var y={mask:"c",nesting:"braces",scopes:["class","module","interface","struct","trait","enum"],members:!0,memberRules:W},be={typescript:{...y,rules:x,memberRules:L,scopes:["class"]},tsx:{...y,rules:x,memberRules:L,scopes:["class"]},javascript:{...y,rules:x,memberRules:L,scopes:["class"]},jsx:{...y,rules:x,memberRules:L,scopes:["class"]},java:{...y,rules:S},c:{...y,rules:S},cpp:{...y,rules:S},csharp:{...y,rules:S},"objective-c":{...y,rules:S},kotlin:{...y,rules:S},swift:{...y,rules:S},scala:{...y,rules:S},dart:{...y,rules:S},groovy:{...y,rules:S},solidity:{...y,rules:fe},php:{mask:"c",nesting:"braces",rules:G,scopes:["class","interface","trait"],members:!0},go:{mask:"c",nesting:"braces",rules:Y},rust:{mask:"c",nesting:"braces",rules:V,scopes:["impl","trait"],members:!0},zig:{mask:"c",nesting:"braces",rules:ae,scopes:["struct","enum"],members:!0},hcl:{mask:"hcl",nesting:"braces",rules:ce},protobuf:{mask:"c",nesting:"braces",rules:O,scopes:["class","interface"],members:!0},graphql:{mask:"hash",nesting:"braces",rules:O,scopes:["class","interface"],members:!0},css:{mask:"css",nesting:"braces",rules:R,scopes:["selector"]},less:{mask:"css",nesting:"braces",rules:R,scopes:["selector"]},scss:{mask:"css",nesting:"braces",rules:R,scopes:["selector"]},sass:{mask:"css",nesting:"braces",rules:R,scopes:["selector"]},stylus:{mask:"css",nesting:"braces",rules:R,scopes:["selector"]},ruby:{mask:"hash",nesting:"flat",rules:X},lua:{mask:"lua",nesting:"flat",rules:J},elixir:{mask:"hash",nesting:"flat",rules:te},erlang:{mask:"percent",nesting:"flat",rules:ne},haskell:{mask:"hash",nesting:"flat",rules:se,dedupe:!0},ocaml:{mask:"ml",nesting:"flat",rules:re},julia:{mask:"hash",nesting:"flat",rules:oe},r:{mask:"hash",nesting:"flat",rules:ie},clojure:{mask:"lisp",nesting:"flat",rules:E},scheme:{mask:"lisp",nesting:"flat",rules:E},racket:{mask:"lisp",nesting:"flat",rules:E},perl:{mask:"hash",nesting:"flat",rules:me},powershell:{mask:"hash",nesting:"flat",rules:ke},bash:{mask:"hash",nesting:"flat",rules:ee},sql:{mask:"sql",nesting:"flat",rules:le},makefile:{mask:"hash",nesting:"flat",rules:de},dockerfile:{mask:"hash",nesting:"flat",rules:ue},nix:{mask:"hash",nesting:"flat",rules:pe},python:{mask:"python",nesting:"indent",rules:Q},yaml:{mask:"hash",nesting:"indent",rules:[{kind:"key",re:/^([A-Za-z_$][\w$.-]*)\s*:/d}]},toml:{mask:"hash",nesting:"flat",rules:[{kind:"module",re:/^\[\[?([^\]]+)\]\]?/d},{kind:"key",re:/^([A-Za-z_][\w.-]*)\s*=/d}]},ini:{mask:"none",nesting:"flat",rules:[{kind:"module",re:/^\[([^\]]+)\]/d},{kind:"key",re:/^([A-Za-z_][\w.-]*)\s*[=:]/d}]},properties:{mask:"none",nesting:"flat",rules:[{kind:"key",re:/^([A-Za-z_][\w.-]*)\s*[=:]/d}]},json:{mask:"raw",nesting:"json",rules:[]},json5:{mask:"raw",nesting:"json",rules:[]},html:{mask:"raw",nesting:"flat",rules:w},xml:{mask:"raw",nesting:"flat",rules:w},svg:{mask:"raw",nesting:"flat",rules:w},vue:{mask:"raw",nesting:"flat",rules:w},svelte:{mask:"raw",nesting:"flat",rules:w},astro:{mask:"raw",nesting:"flat",rules:w},markdown:{mask:"none",nesting:"markdown",rules:[]},diff:{mask:"none",nesting:"flat",rules:[]}};function U(l,r){let a=be[r];if(!l||!a)return[];let d=l.split(`
2
2
  `);if(a.nesting==="markdown")return j(d);if(a.nesting==="json")return F(d);if(a.nesting==="indent")return H(d,a);if(a.nesting==="flat")return B(d,a);return P(d,a)}function he(l,r){return U(l,r)}var Ce={idle:"No file open in the editor.",loading:"Reading the file…",error:"Could not read this file.","not-a-document":"This tab has no outline.",diff:"Diff tabs have no outline.",ready:"No symbols found."};function ye(l,r){return r??Ce[l]}var _e=8388608;function ge(l){let r=l.length;if(r<=500)return{rows:l,total:r,truncated:!1};return{rows:l.slice(0,500),total:r,truncated:!0}}function Qu(l){return`Showing the first ${500 .toLocaleString()} of ${l.toLocaleString()} symbols.`}function Se(l){if(l<=8388608)return null;return`This file is ${(l/1048576).toFixed(1)} MB — too large to outline.`}var Ke=300;function we(l){return l.length>_e}function Nu({content:l,language:r,state:a,note:d,path:t}){let[p,c]=n({content:l,language:r,path:t}),b=i(t);o(()=>{let h=t!==b.current;if(b.current=t,h||we(l)){c((g)=>g.content===l&&g.language===r?g:{content:l,language:r,path:t});return}let _=window.setTimeout(()=>{c((g)=>g.content===l&&g.language===r?g:{content:l,language:r,path:t})},Ke);return()=>window.clearTimeout(_)},[t,l,r]);let f=u(()=>{if(a!=="ready"||we(p.content))return[];return he(p.content,p.language)},[a,p]),m=u(()=>ge(f),[f]),k=a==="ready"?Se(l.length):null;return{symbols:m.rows,total:m.total,truncated:m.truncated,notice:k??ye(a,d)}}
3
3
  export{Du,Ko,Qu,Nu};
@@ -1,2 +1,2 @@
1
- import{d,n,o,i,a,e,s,E,ne,De,Le,_,Zo,tt,Se,_e,b,ee,si,Lm}from"./index-3fw3sd10.js";var B={name:"list-filter",size:24,node:[["path",{d:"M2 5h20",key:"1fs1ex"}],["path",{d:"M6 12h12",key:"8npq4p"}],["path",{d:"M9 19h6",key:"456am0"}]]},M=s(B);function I({title:t,options:r,methodLabel:p,badge:m,icon:x,onCancel:g}){let f=si({title:t,options:r})?Lm(t):null,h=f?`Allow ${f.tool}`:t||p;return e("div",{className:"flex items-center justify-between border-b border-ink/8 bg-canvas/40 px-5 py-3.5",children:[e("div",{className:"flex items-center gap-3 min-w-0",children:[e("div",{className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-lg border border-ink/12 bg-paper text-ink shadow-xs",children:x}),e("div",{className:"min-w-0",children:[e("div",{className:"flex items-center gap-2",children:[e("h3",{className:"truncate text-[14px] font-semibold tracking-tight text-ink",children:h}),e("span",{className:"flex items-center gap-1 rounded-full border border-ink/10 bg-paper px-2 py-0.5 font-mono text-[10px] font-medium tracking-wider text-ink/60 uppercase",children:[e(Le,{size:9,className:"text-ink/40"}),m]})]}),e("p",{className:"mt-0.5 text-[11px] text-ink/50",children:f?"The agent wants to run this. Review it before you allow.":"Autonomous agent inquiry requiring user confirmation"})]})]}),e("button",{type:"button",onClick:g,"aria-label":"Close dialog (Esc)",title:"Cancel (Esc)",className:"flex h-7 w-7 shrink-0 cursor-pointer items-center justify-center rounded-lg border border-ink/10 text-ink/45 transition-colors hover:border-ink/25 hover:bg-ink/5 hover:text-ink",children:e(b,{size:14})})]})}function T({options:t,optionDetails:r,selectedOption:p,customValue:m,onCustomChange:x,customInputRef:g,onSelect:f,onConfirmOption:h,hideCustomAnswer:l=!1}){return e("div",{className:"space-y-2",children:[e("div",{className:"flex items-center justify-between text-[11px] font-medium tracking-wider text-ink/50 uppercase",children:[e("span",{children:"Available Options"}),e("span",{className:"font-mono text-[10px] text-ink/40",children:["Press [1-",Math.min(9,t.length),"] to choose"]})]}),e("div",{className:"grid gap-2",role:"radiogroup",children:t.map((k,y)=>{let u=p===k,v=r[y]?.description;return e("button",{type:"button",onClick:()=>f(k),onDblClick:()=>h(k),"aria-checked":u,role:"radio",className:`group flex w-full cursor-pointer items-start gap-3 rounded-xl border p-3.5 text-left transition-all ${u?"border-ink bg-paper shadow-sm ring-1 ring-ink/10":"border-ink/10 bg-canvas/30 hover:border-ink/25 hover:bg-paper"}`,children:[e("span",{className:`flex h-6 w-6 shrink-0 items-center justify-center rounded-md font-mono text-[11px] font-semibold transition-colors ${u?"bg-ink text-paper":"border border-ink/15 bg-paper text-ink/60 group-hover:border-ink/30 group-hover:text-ink"}`,children:y+1}),e("div",{className:"min-w-0 flex-1",children:[e("div",{className:"flex items-center gap-2",children:e("span",{className:`text-[13px] font-medium leading-snug ${u?"text-ink font-semibold":"text-ink/85"}`,children:k})}),v&&e("div",{className:"mt-1 text-[11.5px] leading-relaxed text-ink/55",children:v})]}),e("span",{className:"mt-0.5 shrink-0",children:u?e(ne,{size:16,className:"text-ink"}):e(Zo,{size:16,className:"text-ink/20 group-hover:text-ink/40"})})]},k)})}),!l&&e("div",{className:"space-y-1.5 pt-1",children:[e("div",{className:"text-[11px] font-medium tracking-wider text-ink/50 uppercase",children:"Other: type your own answer"}),e("input",{ref:g,type:"text",value:m,placeholder:"Type a custom answer and press Enter...",onChange:(k)=>x(k.currentTarget.value),onKeyDown:(k)=>{if(k.key==="Enter"){if(k.preventDefault(),k.stopPropagation(),m.trim())h(m.trim())}},className:"w-full rounded-xl border border-ink/15 bg-paper px-4 py-3 text-[13.5px] text-ink placeholder:text-ink/35 outline-none transition-all focus:border-ink focus:ring-2 focus:ring-ink/15"})]})]})}function S({method:t,optionsLength:r,selectedOption:p,hasCustomAnswer:m=!1,onCancel:x,onSubmit:g}){let f=t==="select"&&!p&&!m;return e("div",{className:"flex flex-wrap items-center justify-between gap-3 border-t border-ink/8 bg-canvas/40 px-5 py-3.5",children:[e("div",{className:"flex items-center gap-2 font-mono text-[11px] text-ink/50",children:[t==="select"&&e(d,{children:[e("span",{className:"hidden items-center gap-1 sm:inline-flex",children:[e("kbd",{className:"rounded border border-ink/15 bg-paper px-1.5 py-0.5 text-[10px] text-ink shadow-xs",children:["1-",Math.min(9,r)]}),e("span",{className:"text-ink/40",children:"choose"})]}),e("span",{className:"hidden text-ink/30 sm:inline",children:"•"}),e("span",{className:"inline-flex items-center gap-1",children:[e("kbd",{className:"rounded border border-ink/15 bg-paper px-1.5 py-0.5 text-[10px] text-ink shadow-xs",children:"↵"}),e("span",{className:"text-ink/40",children:"select"})]})]}),t==="confirm"&&e("span",{className:"inline-flex items-center gap-1",children:[e("kbd",{className:"rounded border border-ink/15 bg-paper px-1.5 py-0.5 text-[10px] text-ink shadow-xs",children:"↵"}),e("span",{className:"text-ink/40",children:"confirm"})]}),t==="editor"&&e("span",{className:"inline-flex items-center gap-1",children:[e("kbd",{className:"rounded border border-ink/15 bg-paper px-1.5 py-0.5 text-[10px] text-ink shadow-xs",children:"⌘↵"}),e("span",{className:"text-ink/40",children:"save buffer"})]}),e("span",{className:"text-ink/30",children:"•"}),e("span",{className:"inline-flex items-center gap-1",children:[e("kbd",{className:"rounded border border-ink/15 bg-paper px-1.5 py-0.5 text-[10px] text-ink shadow-xs",children:"Esc"}),e("span",{className:"text-ink/40",children:"cancel"})]})]}),e("div",{className:"flex items-center gap-2.5 ml-auto",children:[e("button",{type:"button",onClick:x,className:"flex cursor-pointer items-center gap-1 rounded-lg border border-ink/15 bg-paper px-3.5 py-1.5 text-[12px] font-medium text-ink/70 transition-colors hover:border-ink/30 hover:bg-canvas/50 hover:text-ink",children:[e(b,{size:12,className:"opacity-60"}),e("span",{children:"Cancel"})]}),e("button",{type:"button",onClick:g,disabled:f,className:"flex cursor-pointer items-center gap-1.5 rounded-lg bg-ink px-4 py-1.5 text-[12px] font-semibold text-paper shadow-xs transition-all hover:opacity-90 active:scale-[0.98] disabled:cursor-not-allowed disabled:opacity-35",children:[e("span",{children:t==="confirm"?"Confirm":t==="select"?"Select Option":"Submit Response"}),e(tt,{size:12,className:"opacity-70"})]})]})]})}function P({title:t,options:r}){let p=si({title:t,options:r})?Lm(t):null;if(!p)return null;return e("div",{className:"space-y-2",children:[p.reason&&e("div",{className:"flex items-start gap-2 rounded-xl border border-warning/25 bg-warning/8 px-3.5 py-2.5 text-[12px] leading-relaxed text-ink/80",children:[e(_,{size:13,className:"mt-0.5 shrink-0 text-warning"}),e("span",{className:"min-w-0 break-words",children:p.reason})]}),p.details.length>0&&e("div",{className:"rounded-xl border border-ink/10 bg-canvas/40 px-3.5 py-2.5",children:p.details.map((m,x)=>e("div",{className:"font-mono text-[11.5px] leading-relaxed text-ink/75 break-all",children:m},`${x}-${m}`))})]})}function R({method:t,options:r,selectedOption:p,onSelectOption:m,customInputRef:x,onSubmit:g,onCancel:f}){o(()=>{let h=(l)=>{if(l.key==="Escape"){l.preventDefault(),l.stopPropagation(),f();return}if(t==="select"&&r.length>0){if(l.target instanceof HTMLInputElement&&l.target===x.current)return;let y=parseInt(l.key,10);if(!isNaN(y)&&y>=1&&y<=r.length){l.preventDefault(),m(r[y-1]);return}if(l.key==="ArrowDown"){l.preventDefault();let u=r.findIndex((N)=>N===p),v=u<r.length-1?u+1:0;m(r[v]);return}if(l.key==="ArrowUp"){l.preventDefault();let u=r.findIndex((N)=>N===p),v=u>0?u-1:r.length-1;m(r[v]);return}if(l.key==="Enter"&&p){l.preventDefault(),g();return}}if(t==="confirm"){if(l.key==="Enter"){l.preventDefault(),g();return}}if(t==="editor"){if((l.metaKey||l.ctrlKey)&&l.key==="Enter"){l.preventDefault(),g();return}}};return window.addEventListener("keydown",h),()=>window.removeEventListener("keydown",h)},[f,g,t,r,p,m,x])}function L(t,r){switch(t){case"select":return{icon:e(M,{size:16,className:"text-ink"}),label:"Decision Required",badge:`${r} Choices`};case"confirm":return{icon:e(E,{size:16,className:"text-ink"}),label:"Confirmation Required",badge:"Confirm Action"};case"input":return{icon:e(_e,{size:16,className:"text-ink"}),label:"Prompt Input",badge:"Text Input"};case"editor":return{icon:e(Se,{size:16,className:"text-ink"}),label:"Buffer Editor",badge:"Multiline Buffer"};default:return{icon:e(De,{size:16,className:"text-ink"}),label:"Agent Request",badge:"Input"}}}function ke({request:t,onRespond:r}){let[p,m]=n(t.method==="editor"?t.prefill??"":""),[x,g]=n(null),[f,h]=n(""),l=i(null),k=i(null),y=i(null),u=i(null),v=t.options??[],N=t.optionDetails??[],C=si(t);o(()=>{let c=t.options??[];m(t.method==="editor"?t.prefill??"":""),g(c.length>0?c[0]:null),h("")},[t]),o(()=>{if(l.current?.focus(),t.method==="input")k.current?.focus();else if(t.method==="editor")y.current?.focus();else if(t.method==="select"){if((t.options??[]).some((H)=>/^other\b/i.test(H.trim())))u.current?.focus()}},[t]);let w=a(()=>{r(t,{cancelled:!0})},[r,t]),A=a(()=>{if(t.method==="confirm")r(t,{confirmed:!0});else if(t.method==="select"){if(f.trim()&&!C)r(t,{value:f.trim()});else if(x)r(t,{value:x})}else r(t,{value:p})},[r,t,x,p,f,C]),O=a((c)=>{if(/^other\b/i.test(c.trim())){g(c),u.current?.focus();return}r(t,{value:c})},[r,t]),z=a((c)=>{if(g(c),/^other\b/i.test(c.trim()))u.current?.focus()},[]);R({method:t.method,options:v,selectedOption:x,onSelectOption:g,customInputRef:u,onSubmit:A,onCancel:w});let D=L(t.method,v.length);return e("div",{className:"extension-dialog-backdrop modal-scrim fixed inset-0 z-50 flex items-center justify-center p-4 sm:p-6 backdrop-blur-[8px]",onMouseDown:(c)=>{if(c.target===c.currentTarget)w()},children:e("div",{ref:l,role:"dialog","aria-modal":"true","aria-label":t.title||D.label,tabIndex:-1,className:"glass-overlay extension-dialog-panel w-full max-w-[560px] overflow-hidden rounded-2xl border border-ink/15 bg-paper shadow-2xl outline-none",style:{boxShadow:"0 24px 64px -8px color-mix(in srgb, var(--theme-ink) 28%, transparent)"},children:[e(I,{title:t.title,options:v,methodLabel:D.label,badge:D.badge,icon:D.icon,onCancel:w}),e("div",{className:"max-h-[65vh] overflow-y-auto px-6 py-5 space-y-4",children:[e(P,{title:t.title,options:v}),t.message&&e("div",{className:"rounded-xl border border-ink/8 bg-canvas/40 p-4 text-[13px] leading-relaxed text-ink/85 select-text",children:e(ee,{content:t.message})}),t.method==="select"&&e(T,{options:v,optionDetails:N,selectedOption:x,customValue:f,onCustomChange:h,customInputRef:u,onSelect:z,onConfirmOption:O,hideCustomAnswer:C}),t.method==="confirm"&&e("div",{className:"flex items-center gap-3 rounded-xl border border-ink/10 bg-canvas/30 p-4",children:[e("div",{className:"flex h-9 w-9 shrink-0 items-center justify-center rounded-lg bg-ink/5 text-ink",children:e(ne,{size:18})}),e("div",{className:"text-[12.5px] leading-relaxed text-ink/75",children:["Confirming will allow the autonomous agent to proceed with this operation. Press ",e("kbd",{className:"rounded border border-ink/20 bg-paper px-1 py-0.2 font-mono text-[10.5px]",children:"Enter"})," to confirm or ",e("kbd",{className:"rounded border border-ink/20 bg-paper px-1 py-0.2 font-mono text-[10.5px]",children:"Esc"})," to abort."]})]}),t.method==="input"&&e("div",{className:"space-y-2",children:[e("div",{className:"flex items-center justify-between text-[11px] font-medium tracking-wider text-ink/50 uppercase",children:[e("span",{children:"Your Response"}),e("span",{className:"font-mono text-[10px] text-ink/40",children:"Press [Enter] to submit"})]}),e("input",{ref:k,type:t.secret===!0?"password":"text",value:p,placeholder:t.placeholder||"Type your response...",onChange:(c)=>m(c.currentTarget.value),onKeyDown:(c)=>{if(c.key==="Enter")c.preventDefault(),A()},className:"w-full rounded-xl border border-ink/15 bg-paper px-4 py-3 text-[13.5px] text-ink placeholder:text-ink/35 outline-none transition-all focus:border-ink focus:ring-2 focus:ring-ink/15"})]}),t.method==="editor"&&e("div",{className:"space-y-2",children:[e("div",{className:"flex items-center justify-between text-[11px] font-medium tracking-wider text-ink/50 uppercase",children:[e("span",{children:"Buffer Content"}),e("span",{className:"font-mono text-[10px] text-ink/40",children:[p.split(`
1
+ import{d,n,o,i,a,e,s,E,ne,De,Le,_,Zo,tt,Se,_e,b,ee,si,Lm}from"./index-4c2zcvem.js";var B={name:"list-filter",size:24,node:[["path",{d:"M2 5h20",key:"1fs1ex"}],["path",{d:"M6 12h12",key:"8npq4p"}],["path",{d:"M9 19h6",key:"456am0"}]]},M=s(B);function I({title:t,options:r,methodLabel:p,badge:m,icon:x,onCancel:g}){let f=si({title:t,options:r})?Lm(t):null,h=f?`Allow ${f.tool}`:t||p;return e("div",{className:"flex items-center justify-between border-b border-ink/8 bg-canvas/40 px-5 py-3.5",children:[e("div",{className:"flex items-center gap-3 min-w-0",children:[e("div",{className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-lg border border-ink/12 bg-paper text-ink shadow-xs",children:x}),e("div",{className:"min-w-0",children:[e("div",{className:"flex items-center gap-2",children:[e("h3",{className:"truncate text-[14px] font-semibold tracking-tight text-ink",children:h}),e("span",{className:"flex items-center gap-1 rounded-full border border-ink/10 bg-paper px-2 py-0.5 font-mono text-[10px] font-medium tracking-wider text-ink/60 uppercase",children:[e(Le,{size:9,className:"text-ink/40"}),m]})]}),e("p",{className:"mt-0.5 text-[11px] text-ink/50",children:f?"The agent wants to run this. Review it before you allow.":"Autonomous agent inquiry requiring user confirmation"})]})]}),e("button",{type:"button",onClick:g,"aria-label":"Close dialog (Esc)",title:"Cancel (Esc)",className:"flex h-7 w-7 shrink-0 cursor-pointer items-center justify-center rounded-lg border border-ink/10 text-ink/45 transition-colors hover:border-ink/25 hover:bg-ink/5 hover:text-ink",children:e(b,{size:14})})]})}function T({options:t,optionDetails:r,selectedOption:p,customValue:m,onCustomChange:x,customInputRef:g,onSelect:f,onConfirmOption:h,hideCustomAnswer:l=!1}){return e("div",{className:"space-y-2",children:[e("div",{className:"flex items-center justify-between text-[11px] font-medium tracking-wider text-ink/50 uppercase",children:[e("span",{children:"Available Options"}),e("span",{className:"font-mono text-[10px] text-ink/40",children:["Press [1-",Math.min(9,t.length),"] to choose"]})]}),e("div",{className:"grid gap-2",role:"radiogroup",children:t.map((k,y)=>{let u=p===k,v=r[y]?.description;return e("button",{type:"button",onClick:()=>f(k),onDblClick:()=>h(k),"aria-checked":u,role:"radio",className:`group flex w-full cursor-pointer items-start gap-3 rounded-xl border p-3.5 text-left transition-all ${u?"border-ink bg-paper shadow-sm ring-1 ring-ink/10":"border-ink/10 bg-canvas/30 hover:border-ink/25 hover:bg-paper"}`,children:[e("span",{className:`flex h-6 w-6 shrink-0 items-center justify-center rounded-md font-mono text-[11px] font-semibold transition-colors ${u?"bg-ink text-paper":"border border-ink/15 bg-paper text-ink/60 group-hover:border-ink/30 group-hover:text-ink"}`,children:y+1}),e("div",{className:"min-w-0 flex-1",children:[e("div",{className:"flex items-center gap-2",children:e("span",{className:`text-[13px] font-medium leading-snug ${u?"text-ink font-semibold":"text-ink/85"}`,children:k})}),v&&e("div",{className:"mt-1 text-[11.5px] leading-relaxed text-ink/55",children:v})]}),e("span",{className:"mt-0.5 shrink-0",children:u?e(ne,{size:16,className:"text-ink"}):e(Zo,{size:16,className:"text-ink/20 group-hover:text-ink/40"})})]},k)})}),!l&&e("div",{className:"space-y-1.5 pt-1",children:[e("div",{className:"text-[11px] font-medium tracking-wider text-ink/50 uppercase",children:"Other: type your own answer"}),e("input",{ref:g,type:"text",value:m,placeholder:"Type a custom answer and press Enter...",onChange:(k)=>x(k.currentTarget.value),onKeyDown:(k)=>{if(k.key==="Enter"){if(k.preventDefault(),k.stopPropagation(),m.trim())h(m.trim())}},className:"w-full rounded-xl border border-ink/15 bg-paper px-4 py-3 text-[13.5px] text-ink placeholder:text-ink/35 outline-none transition-all focus:border-ink focus:ring-2 focus:ring-ink/15"})]})]})}function S({method:t,optionsLength:r,selectedOption:p,hasCustomAnswer:m=!1,onCancel:x,onSubmit:g}){let f=t==="select"&&!p&&!m;return e("div",{className:"flex flex-wrap items-center justify-between gap-3 border-t border-ink/8 bg-canvas/40 px-5 py-3.5",children:[e("div",{className:"flex items-center gap-2 font-mono text-[11px] text-ink/50",children:[t==="select"&&e(d,{children:[e("span",{className:"hidden items-center gap-1 sm:inline-flex",children:[e("kbd",{className:"rounded border border-ink/15 bg-paper px-1.5 py-0.5 text-[10px] text-ink shadow-xs",children:["1-",Math.min(9,r)]}),e("span",{className:"text-ink/40",children:"choose"})]}),e("span",{className:"hidden text-ink/30 sm:inline",children:"•"}),e("span",{className:"inline-flex items-center gap-1",children:[e("kbd",{className:"rounded border border-ink/15 bg-paper px-1.5 py-0.5 text-[10px] text-ink shadow-xs",children:"↵"}),e("span",{className:"text-ink/40",children:"select"})]})]}),t==="confirm"&&e("span",{className:"inline-flex items-center gap-1",children:[e("kbd",{className:"rounded border border-ink/15 bg-paper px-1.5 py-0.5 text-[10px] text-ink shadow-xs",children:"↵"}),e("span",{className:"text-ink/40",children:"confirm"})]}),t==="editor"&&e("span",{className:"inline-flex items-center gap-1",children:[e("kbd",{className:"rounded border border-ink/15 bg-paper px-1.5 py-0.5 text-[10px] text-ink shadow-xs",children:"⌘↵"}),e("span",{className:"text-ink/40",children:"save buffer"})]}),e("span",{className:"text-ink/30",children:"•"}),e("span",{className:"inline-flex items-center gap-1",children:[e("kbd",{className:"rounded border border-ink/15 bg-paper px-1.5 py-0.5 text-[10px] text-ink shadow-xs",children:"Esc"}),e("span",{className:"text-ink/40",children:"cancel"})]})]}),e("div",{className:"flex items-center gap-2.5 ml-auto",children:[e("button",{type:"button",onClick:x,className:"flex cursor-pointer items-center gap-1 rounded-lg border border-ink/15 bg-paper px-3.5 py-1.5 text-[12px] font-medium text-ink/70 transition-colors hover:border-ink/30 hover:bg-canvas/50 hover:text-ink",children:[e(b,{size:12,className:"opacity-60"}),e("span",{children:"Cancel"})]}),e("button",{type:"button",onClick:g,disabled:f,className:"flex cursor-pointer items-center gap-1.5 rounded-lg bg-ink px-4 py-1.5 text-[12px] font-semibold text-paper shadow-xs transition-all hover:opacity-90 active:scale-[0.98] disabled:cursor-not-allowed disabled:opacity-35",children:[e("span",{children:t==="confirm"?"Confirm":t==="select"?"Select Option":"Submit Response"}),e(tt,{size:12,className:"opacity-70"})]})]})]})}function P({title:t,options:r}){let p=si({title:t,options:r})?Lm(t):null;if(!p)return null;return e("div",{className:"space-y-2",children:[p.reason&&e("div",{className:"flex items-start gap-2 rounded-xl border border-warning/25 bg-warning/8 px-3.5 py-2.5 text-[12px] leading-relaxed text-ink/80",children:[e(_,{size:13,className:"mt-0.5 shrink-0 text-warning"}),e("span",{className:"min-w-0 break-words",children:p.reason})]}),p.details.length>0&&e("div",{className:"rounded-xl border border-ink/10 bg-canvas/40 px-3.5 py-2.5",children:p.details.map((m,x)=>e("div",{className:"font-mono text-[11.5px] leading-relaxed text-ink/75 break-all",children:m},`${x}-${m}`))})]})}function R({method:t,options:r,selectedOption:p,onSelectOption:m,customInputRef:x,onSubmit:g,onCancel:f}){o(()=>{let h=(l)=>{if(l.key==="Escape"){l.preventDefault(),l.stopPropagation(),f();return}if(t==="select"&&r.length>0){if(l.target instanceof HTMLInputElement&&l.target===x.current)return;let y=parseInt(l.key,10);if(!isNaN(y)&&y>=1&&y<=r.length){l.preventDefault(),m(r[y-1]);return}if(l.key==="ArrowDown"){l.preventDefault();let u=r.findIndex((N)=>N===p),v=u<r.length-1?u+1:0;m(r[v]);return}if(l.key==="ArrowUp"){l.preventDefault();let u=r.findIndex((N)=>N===p),v=u>0?u-1:r.length-1;m(r[v]);return}if(l.key==="Enter"&&p){l.preventDefault(),g();return}}if(t==="confirm"){if(l.key==="Enter"){l.preventDefault(),g();return}}if(t==="editor"){if((l.metaKey||l.ctrlKey)&&l.key==="Enter"){l.preventDefault(),g();return}}};return window.addEventListener("keydown",h),()=>window.removeEventListener("keydown",h)},[f,g,t,r,p,m,x])}function L(t,r){switch(t){case"select":return{icon:e(M,{size:16,className:"text-ink"}),label:"Decision Required",badge:`${r} Choices`};case"confirm":return{icon:e(E,{size:16,className:"text-ink"}),label:"Confirmation Required",badge:"Confirm Action"};case"input":return{icon:e(_e,{size:16,className:"text-ink"}),label:"Prompt Input",badge:"Text Input"};case"editor":return{icon:e(Se,{size:16,className:"text-ink"}),label:"Buffer Editor",badge:"Multiline Buffer"};default:return{icon:e(De,{size:16,className:"text-ink"}),label:"Agent Request",badge:"Input"}}}function ke({request:t,onRespond:r}){let[p,m]=n(t.method==="editor"?t.prefill??"":""),[x,g]=n(null),[f,h]=n(""),l=i(null),k=i(null),y=i(null),u=i(null),v=t.options??[],N=t.optionDetails??[],C=si(t);o(()=>{let c=t.options??[];m(t.method==="editor"?t.prefill??"":""),g(c.length>0?c[0]:null),h("")},[t]),o(()=>{if(l.current?.focus(),t.method==="input")k.current?.focus();else if(t.method==="editor")y.current?.focus();else if(t.method==="select"){if((t.options??[]).some((H)=>/^other\b/i.test(H.trim())))u.current?.focus()}},[t]);let w=a(()=>{r(t,{cancelled:!0})},[r,t]),A=a(()=>{if(t.method==="confirm")r(t,{confirmed:!0});else if(t.method==="select"){if(f.trim()&&!C)r(t,{value:f.trim()});else if(x)r(t,{value:x})}else r(t,{value:p})},[r,t,x,p,f,C]),O=a((c)=>{if(/^other\b/i.test(c.trim())){g(c),u.current?.focus();return}r(t,{value:c})},[r,t]),z=a((c)=>{if(g(c),/^other\b/i.test(c.trim()))u.current?.focus()},[]);R({method:t.method,options:v,selectedOption:x,onSelectOption:g,customInputRef:u,onSubmit:A,onCancel:w});let D=L(t.method,v.length);return e("div",{className:"extension-dialog-backdrop modal-scrim fixed inset-0 z-50 flex items-center justify-center p-4 sm:p-6 backdrop-blur-[8px]",onMouseDown:(c)=>{if(c.target===c.currentTarget)w()},children:e("div",{ref:l,role:"dialog","aria-modal":"true","aria-label":t.title||D.label,tabIndex:-1,className:"glass-overlay extension-dialog-panel w-full max-w-[560px] overflow-hidden rounded-2xl border border-ink/15 bg-paper shadow-2xl outline-none",style:{boxShadow:"0 24px 64px -8px color-mix(in srgb, var(--theme-ink) 28%, transparent)"},children:[e(I,{title:t.title,options:v,methodLabel:D.label,badge:D.badge,icon:D.icon,onCancel:w}),e("div",{className:"max-h-[65vh] overflow-y-auto px-6 py-5 space-y-4",children:[e(P,{title:t.title,options:v}),t.message&&e("div",{className:"rounded-xl border border-ink/8 bg-canvas/40 p-4 text-[13px] leading-relaxed text-ink/85 select-text",children:e(ee,{content:t.message})}),t.method==="select"&&e(T,{options:v,optionDetails:N,selectedOption:x,customValue:f,onCustomChange:h,customInputRef:u,onSelect:z,onConfirmOption:O,hideCustomAnswer:C}),t.method==="confirm"&&e("div",{className:"flex items-center gap-3 rounded-xl border border-ink/10 bg-canvas/30 p-4",children:[e("div",{className:"flex h-9 w-9 shrink-0 items-center justify-center rounded-lg bg-ink/5 text-ink",children:e(ne,{size:18})}),e("div",{className:"text-[12.5px] leading-relaxed text-ink/75",children:["Confirming will allow the autonomous agent to proceed with this operation. Press ",e("kbd",{className:"rounded border border-ink/20 bg-paper px-1 py-0.2 font-mono text-[10.5px]",children:"Enter"})," to confirm or ",e("kbd",{className:"rounded border border-ink/20 bg-paper px-1 py-0.2 font-mono text-[10.5px]",children:"Esc"})," to abort."]})]}),t.method==="input"&&e("div",{className:"space-y-2",children:[e("div",{className:"flex items-center justify-between text-[11px] font-medium tracking-wider text-ink/50 uppercase",children:[e("span",{children:"Your Response"}),e("span",{className:"font-mono text-[10px] text-ink/40",children:"Press [Enter] to submit"})]}),e("input",{ref:k,type:t.secret===!0?"password":"text",value:p,placeholder:t.placeholder||"Type your response...",onChange:(c)=>m(c.currentTarget.value),onKeyDown:(c)=>{if(c.key==="Enter")c.preventDefault(),A()},className:"w-full rounded-xl border border-ink/15 bg-paper px-4 py-3 text-[13.5px] text-ink placeholder:text-ink/35 outline-none transition-all focus:border-ink focus:ring-2 focus:ring-ink/15"})]}),t.method==="editor"&&e("div",{className:"space-y-2",children:[e("div",{className:"flex items-center justify-between text-[11px] font-medium tracking-wider text-ink/50 uppercase",children:[e("span",{children:"Buffer Content"}),e("span",{className:"font-mono text-[10px] text-ink/40",children:[p.split(`
2
2
  `).length," lines · ⌘↵ to save"]})]}),e("textarea",{ref:y,value:p,onChange:(c)=>m(c.currentTarget.value),rows:8,placeholder:t.placeholder||"Enter content...",className:"w-full rounded-xl border border-ink/15 bg-canvas/30 px-4 py-3 font-mono text-[12px] leading-relaxed text-ink placeholder:text-ink/35 outline-none transition-all focus:border-ink focus:bg-paper focus:ring-2 focus:ring-ink/15"})]})]}),e(S,{method:t.method,optionsLength:v.length,selectedOption:x,hasCustomAnswer:f.trim().length>0,onCancel:w,onSubmit:A})]})})}export{ke as ExtensionDialog};
@@ -1 +1 @@
1
- import{d,n,o,u,le,e,$g,we,E,m,en,Se,O,Os,mt,at,ee}from"./index-3fw3sd10.js";function S(a){if(!Number.isFinite(a)||a<=0)return"";return new Date(a).toLocaleString(void 0,{dateStyle:"short",timeStyle:"short"})}function N({files:a,selected:h,onSelect:k}){let[t,c]=n(""),p=u(()=>{let l=t.trim().toLowerCase();if(!l)return a;return a.filter((r)=>r.title.toLowerCase().includes(l))},[a,t]);return e("div",{className:"flex h-full min-h-0 w-full flex-col bg-canvas/40",children:[e("div",{className:"flex flex-shrink-0 items-center gap-1.5 border-b border-ink/10 px-2 py-1.5",children:[e(O,{size:12,className:"flex-shrink-0 text-ink/40"}),e("input",{type:"search",value:t,onChange:(l)=>c(l.target.value),placeholder:"Filter plans…","aria-label":"Filter plans",className:"min-w-0 flex-1 bg-transparent text-[11px] text-ink outline-none placeholder:text-ink/35"})]}),e("div",{className:"flex-1 min-h-0 overflow-y-auto scrollbar-overlay-container",children:p.length===0?e("p",{className:"px-3 py-2 text-[11px] text-ink/40 italic",children:a.length===0?"No plan yet":"No plan matches the filter"}):e("ul",{className:"py-1",children:p.map((l)=>{let r=l.path===h,i=S(l.modifiedAt);return e("li",{children:e("button",{type:"button",onClick:()=>k(l.path),"aria-current":r?"true":void 0,title:`${l.path}${i?` · ${i}`:""}`,className:`flex w-full items-start gap-1.5 px-2.5 py-1.5 text-left transition-colors ${r?"bg-ink/10 font-semibold text-ink":"text-ink/80 hover:bg-ink/5 hover:text-ink"}`,children:[e(Se,{size:12,className:`mt-0.5 flex-shrink-0 ${r?"text-ink":"text-ink/40"}`}),e("span",{className:"min-w-0 flex-1",children:[e("span",{className:"block truncate text-[11.5px]",children:l.title}),i&&e("span",{className:"block truncate font-mono text-[10px] text-ink/40",children:i})]})]})},l.path)})})})]})}function P({file:a,content:h,isLoading:k,error:t,truncated:c,onBack:p}){return e("div",{className:"flex h-full min-h-0 w-full flex-col bg-paper",children:[e("div",{className:"flex flex-shrink-0 items-center gap-1.5 border-b border-ink/10 px-2.5 py-1.5",children:[e("button",{type:"button",onClick:p,title:"Back to the plan list","aria-label":"Back to the plan list",className:"flex-shrink-0 rounded p-1 text-ink/60 hover:bg-ink/5 hover:text-ink @[520px]:hidden",children:e(en,{size:13})}),e("span",{className:"min-w-0 flex-1 truncate text-[11px] text-ink/50",title:a?.path??"",children:a?.path??"Plan"}),k&&e(m,{size:12,className:"flex-shrink-0 animate-spin text-ink/40"})]}),e("div",{className:"flex-1 min-h-0 overflow-y-auto scrollbar-overlay-container",children:t?e("div",{className:"flex flex-col items-center gap-2 px-6 py-8 text-center",children:[e(E,{size:16,className:"text-error"}),e("p",{className:"text-xs text-error",children:t})]}):!h?e("div",{className:"px-6 py-8 text-center text-xs text-ink/40",children:k?"Reading the plan…":"This plan is empty."}):e("article",{className:"mx-auto max-w-4xl px-5 py-4",children:[e(ee,{content:h,className:"max-w-none"}),c&&e("p",{className:"mt-4 border-t border-ink/10 pt-2 text-[11px] text-ink/50",children:"This plan is longer than the reader's budget and was cut off."})]})})]})}function K({className:a="",active:h=!0}){let[k]=le(),t=k.get("sessionId"),[c,p]=Os("plan.selectedFile",null),[l,r]=n(!1),i=c&&c.sessionId===t?c.path:null,s=we(t?$g(t):null,{enabled:h}),x=s.data?.files??[],g=s.data?.current??null,f=u(()=>{if(i&&x.some((b)=>b.path===i))return i;return g},[i,x,g]),y=u(()=>x.find((b)=>b.path===f)??null,[x,f]);o(()=>{if(!t||!f||f===i)return;p({sessionId:t,path:f})},[t,f,i,p]),o(()=>{r(!1)},[t]);let w=(b)=>{if(t)p({sessionId:t,path:b});r(!0)};if(!t)return e("div",{className:`flex h-full flex-col items-center justify-center bg-paper text-ink/40 ${a}`,children:e("span",{className:"text-xs font-mono text-muted",children:"No session selected"})});let v=x.length>0;return e("div",{className:`@container flex h-full min-h-0 w-full flex-col bg-paper text-xs text-ink ${a}`,children:[e(mt,{left:e(d,{children:[e(Se,{size:12,className:"flex-shrink-0 text-ink/50"}),e("span",{className:"truncate text-[11px] font-medium text-ink/70",children:"Plan mode"}),v&&e("span",{className:"flex-shrink-0 rounded border border-ink/15 bg-ink/5 px-1.5 py-0.5 font-mono text-[10px] text-ink/60",children:x.length})]}),right:e(at,{label:"Re-read the plan",onClick:s.refresh,busy:s.isLoading||s.refreshing,disabled:s.isLoading})}),s.stale&&!s.data?e("div",{className:"flex flex-1 flex-col items-center justify-center gap-2 px-6 text-center",children:[e(E,{size:16,className:"text-error"}),e("p",{className:"text-error",children:"The plan could not be read."}),e("button",{type:"button",onClick:s.refresh,className:"text-[11px] font-semibold text-ink/70 underline underline-offset-2 hover:text-ink",children:"Try again"})]}):!s.data?e("div",{className:"flex flex-1 items-center justify-center gap-2 text-ink/40",children:[e(m,{size:14,className:"animate-spin"}),e("span",{children:"Reading the plan…"})]}):!v?e("div",{className:"flex flex-1 flex-col items-center justify-center gap-2 px-6 text-center",children:[e(Se,{size:18,className:"text-ink/30"}),e("p",{className:"max-w-sm text-[11px] leading-relaxed text-ink/60",children:"No plan yet. Turn on Plan mode in the composer, and the plan this session writes will appear here."})]}):e("div",{className:"flex min-h-0 flex-1 flex-col @[520px]:flex-row-reverse",children:[e("div",{className:`min-h-0 w-full @[520px]:w-52 @[520px]:flex-shrink-0 border-b border-ink/10 @[520px]:border-b-0 @[520px]:border-l ${l?"hidden @[520px]:flex":"flex"} flex-col`,children:e(N,{files:x,selected:f,onSelect:w})}),e("div",{className:`min-w-0 min-h-0 flex-1 ${l?"flex":"hidden @[520px]:flex"} flex-col`,children:e(P,{file:y,content:s.data.content,isLoading:s.isLoading,error:s.stale?"The plan could not be read.":null,truncated:s.data.truncated,onBack:()=>r(!1)})})]})]})}export{K as PlanPanel};
1
+ import{d,n,o,u,le,e,$g,we,E,m,en,Se,O,Os,mt,at,ee}from"./index-4c2zcvem.js";function S(a){if(!Number.isFinite(a)||a<=0)return"";return new Date(a).toLocaleString(void 0,{dateStyle:"short",timeStyle:"short"})}function N({files:a,selected:h,onSelect:k}){let[t,c]=n(""),p=u(()=>{let l=t.trim().toLowerCase();if(!l)return a;return a.filter((r)=>r.title.toLowerCase().includes(l))},[a,t]);return e("div",{className:"flex h-full min-h-0 w-full flex-col bg-canvas/40",children:[e("div",{className:"flex flex-shrink-0 items-center gap-1.5 border-b border-ink/10 px-2 py-1.5",children:[e(O,{size:12,className:"flex-shrink-0 text-ink/40"}),e("input",{type:"search",value:t,onChange:(l)=>c(l.target.value),placeholder:"Filter plans…","aria-label":"Filter plans",className:"min-w-0 flex-1 bg-transparent text-[11px] text-ink outline-none placeholder:text-ink/35"})]}),e("div",{className:"flex-1 min-h-0 overflow-y-auto scrollbar-overlay-container",children:p.length===0?e("p",{className:"px-3 py-2 text-[11px] text-ink/40 italic",children:a.length===0?"No plan yet":"No plan matches the filter"}):e("ul",{className:"py-1",children:p.map((l)=>{let r=l.path===h,i=S(l.modifiedAt);return e("li",{children:e("button",{type:"button",onClick:()=>k(l.path),"aria-current":r?"true":void 0,title:`${l.path}${i?` · ${i}`:""}`,className:`flex w-full items-start gap-1.5 px-2.5 py-1.5 text-left transition-colors ${r?"bg-ink/10 font-semibold text-ink":"text-ink/80 hover:bg-ink/5 hover:text-ink"}`,children:[e(Se,{size:12,className:`mt-0.5 flex-shrink-0 ${r?"text-ink":"text-ink/40"}`}),e("span",{className:"min-w-0 flex-1",children:[e("span",{className:"block truncate text-[11.5px]",children:l.title}),i&&e("span",{className:"block truncate font-mono text-[10px] text-ink/40",children:i})]})]})},l.path)})})})]})}function P({file:a,content:h,isLoading:k,error:t,truncated:c,onBack:p}){return e("div",{className:"flex h-full min-h-0 w-full flex-col bg-paper",children:[e("div",{className:"flex flex-shrink-0 items-center gap-1.5 border-b border-ink/10 px-2.5 py-1.5",children:[e("button",{type:"button",onClick:p,title:"Back to the plan list","aria-label":"Back to the plan list",className:"flex-shrink-0 rounded p-1 text-ink/60 hover:bg-ink/5 hover:text-ink @[520px]:hidden",children:e(en,{size:13})}),e("span",{className:"min-w-0 flex-1 truncate text-[11px] text-ink/50",title:a?.path??"",children:a?.path??"Plan"}),k&&e(m,{size:12,className:"flex-shrink-0 animate-spin text-ink/40"})]}),e("div",{className:"flex-1 min-h-0 overflow-y-auto scrollbar-overlay-container",children:t?e("div",{className:"flex flex-col items-center gap-2 px-6 py-8 text-center",children:[e(E,{size:16,className:"text-error"}),e("p",{className:"text-xs text-error",children:t})]}):!h?e("div",{className:"px-6 py-8 text-center text-xs text-ink/40",children:k?"Reading the plan…":"This plan is empty."}):e("article",{className:"mx-auto max-w-4xl px-5 py-4",children:[e(ee,{content:h,className:"max-w-none"}),c&&e("p",{className:"mt-4 border-t border-ink/10 pt-2 text-[11px] text-ink/50",children:"This plan is longer than the reader's budget and was cut off."})]})})]})}function K({className:a="",active:h=!0}){let[k]=le(),t=k.get("sessionId"),[c,p]=Os("plan.selectedFile",null),[l,r]=n(!1),i=c&&c.sessionId===t?c.path:null,s=we(t?$g(t):null,{enabled:h}),x=s.data?.files??[],g=s.data?.current??null,f=u(()=>{if(i&&x.some((b)=>b.path===i))return i;return g},[i,x,g]),y=u(()=>x.find((b)=>b.path===f)??null,[x,f]);o(()=>{if(!t||!f||f===i)return;p({sessionId:t,path:f})},[t,f,i,p]),o(()=>{r(!1)},[t]);let w=(b)=>{if(t)p({sessionId:t,path:b});r(!0)};if(!t)return e("div",{className:`flex h-full flex-col items-center justify-center bg-paper text-ink/40 ${a}`,children:e("span",{className:"text-xs font-mono text-muted",children:"No session selected"})});let v=x.length>0;return e("div",{className:`@container flex h-full min-h-0 w-full flex-col bg-paper text-xs text-ink ${a}`,children:[e(mt,{left:e(d,{children:[e(Se,{size:12,className:"flex-shrink-0 text-ink/50"}),e("span",{className:"truncate text-[11px] font-medium text-ink/70",children:"Plan mode"}),v&&e("span",{className:"flex-shrink-0 rounded border border-ink/15 bg-ink/5 px-1.5 py-0.5 font-mono text-[10px] text-ink/60",children:x.length})]}),right:e(at,{label:"Re-read the plan",onClick:s.refresh,busy:s.isLoading||s.refreshing,disabled:s.isLoading})}),s.stale&&!s.data?e("div",{className:"flex flex-1 flex-col items-center justify-center gap-2 px-6 text-center",children:[e(E,{size:16,className:"text-error"}),e("p",{className:"text-error",children:"The plan could not be read."}),e("button",{type:"button",onClick:s.refresh,className:"text-[11px] font-semibold text-ink/70 underline underline-offset-2 hover:text-ink",children:"Try again"})]}):!s.data?e("div",{className:"flex flex-1 items-center justify-center gap-2 text-ink/40",children:[e(m,{size:14,className:"animate-spin"}),e("span",{children:"Reading the plan…"})]}):!v?e("div",{className:"flex flex-1 flex-col items-center justify-center gap-2 px-6 text-center",children:[e(Se,{size:18,className:"text-ink/30"}),e("p",{className:"max-w-sm text-[11px] leading-relaxed text-ink/60",children:"No plan yet. Turn on Plan mode in the composer, and the plan this session writes will appear here."})]}):e("div",{className:"flex min-h-0 flex-1 flex-col @[520px]:flex-row-reverse",children:[e("div",{className:`min-h-0 w-full @[520px]:w-52 @[520px]:flex-shrink-0 border-b border-ink/10 @[520px]:border-b-0 @[520px]:border-l ${l?"hidden @[520px]:flex":"flex"} flex-col`,children:e(N,{files:x,selected:f,onSelect:w})}),e("div",{className:`min-w-0 min-h-0 flex-1 ${l?"flex":"hidden @[520px]:flex"} flex-col`,children:e(P,{file:y,content:s.data.content,isLoading:s.isLoading,error:s.stale?"The plan could not be read.":null,truncated:s.data.truncated,onBack:()=>r(!1)})})]})]})}export{K as PlanPanel};
@@ -1,2 +1,2 @@
1
- import{n,o,i,a,e,Ze,S,s,ne,Sn,m,_,dr,tt,Qe,Ue,Cr,Ln,Yr,Ui,b,Jl}from"./index-3fw3sd10.js";import{gu}from"./index-k61tdd4a.js";import"./index-hh05xd1d.js";var te={name:"mouse-pointer-click",size:24,node:[["path",{d:"M14 4.1 12 6",key:"ita8i4"}],["path",{d:"m5.1 8-2.9-.8",key:"1go3kf"}],["path",{d:"m6 12-1.9 2",key:"mnht97"}],["path",{d:"M7.2 2.2 8 5.1",key:"1cfko1"}],["path",{d:"M9.037 9.69a.498.498 0 0 1 .653-.653l11 4.5a.5.5 0 0 1-.074.949l-4.349 1.041a1 1 0 0 0-.74.739l-1.04 4.35a.5.5 0 0 1-.95.074z",key:"s0h3yz"}]]},U=s(te);var re={name:"move-vertical",size:24,node:[["path",{d:"M12 2v20",key:"t6zp3m"}],["path",{d:"m8 18 4 4 4-4",key:"bh5tu3"}],["path",{d:"m8 6 4-4 4 4",key:"ybng9g"}]]},D=s(re);var oe={live:"Live","agent-offline":"Agent offline","browser-offline":"Browser offline","no-tab":"Tanpa tab"};function j({url:t,status:r,zoomLevel:d=100,onIncludeInChat:c,onReconnect:l,onOpenExternal:u,onZoomIn:p,onZoomOut:w,onResetZoom:k}){return e(gu,{url:t??"",statusDotClass:r==="live"?"bg-success animate-pulse":"bg-ink/25",statusLabel:oe[r],zoomLevel:d,onZoomIn:p,onZoomOut:w,onResetZoom:k,onIncludeInChat:c,onOpenExternal:u,onReconnect:l,openExternalLabel:"Buka di jendela baru",openExternalTitle:t?"Open in new window":"No URL loaded",children:e("div",{className:"flex-1 min-w-0 flex items-center bg-canvas border border-ink/15 rounded-md px-2 py-0.5",children:[e(Qe,{size:12,className:"text-ink/40 mr-1.5 flex-shrink-0"}),e("span",{className:"w-full truncate text-ink/80 font-mono text-[11px]",title:t??"",children:t||"No page open yet"})]})})}var se=[["RAM","~93 MB → ~259 MB untuk satu tab"],["Disk","~346 MB untuk Chrome for Testing bila belum terpasang"],["Idle","Tab Chromium terus melukis; omp membekukannya saat turn selesai"],["Deteksi","Halaman bisa melihat otomasi (navigator.webdriver, CDP)"]];function Z({saving:t,onUseChromium:r}){return e("button",{type:"button",onClick:r,disabled:t,className:"inline-flex items-center gap-1.5 rounded-md border border-ink/15 bg-ink/5 px-2.5 py-1 text-[11px] font-medium text-ink transition-colors hover:bg-ink/10 disabled:cursor-not-allowed disabled:opacity-60",children:[t&&e(m,{size:11,className:"animate-spin"}),t?"Mengaktifkan…":"Pakai Chromium"]})}function z({saving:t,error:r,onUseChromium:d,variant:c}){if(c==="strip")return e("div",{className:"flex items-center justify-between gap-2 border-b border-ink/10 bg-ink/[0.03] px-2.5 py-1.5 flex-shrink-0",children:[e("span",{className:"min-w-0 truncate text-[11px] text-ink/70",children:"Agen memakai WebKit — tab baru tidak akan muncul di panel ini."}),e(Z,{saving:t,onUseChromium:d})]});return e("div",{className:"flex-1 flex flex-col items-center justify-center overflow-y-auto p-6 text-center select-none my-auto",children:[e("div",{className:"w-12 h-12 rounded-xl bg-ink/5 border border-ink/10 flex items-center justify-center text-ink/40 mb-3",children:e(_,{size:24})}),e("h3",{className:"text-sm font-semibold text-ink mb-1",children:"Agen memakai WebKit — panel ini tidak bisa memantulkannya"}),e("p",{className:"text-xs text-ink/60 max-w-sm",children:"WebKit milik omp tidak punya CDP dan tidak mengekspos aliran frame, jadi tab yang dijalankannya tidak bisa ditampilkan di sini. Panel ini hanya bisa memantulkan Chromium."}),e("div",{className:"mt-4 w-full max-w-sm rounded-lg border border-ink/10 bg-paper text-left",children:[e("div",{className:"border-b border-ink/10 px-3 py-1.5 text-[10px] uppercase tracking-wider text-ink/50",children:"Biaya pindah ke Chromium"}),e("dl",{className:"divide-y divide-ink/5",children:se.map(([l,u])=>e("div",{className:"flex gap-2 px-3 py-1.5",children:[e("dt",{className:"w-14 flex-shrink-0 text-[11px] font-medium text-ink/70",children:l}),e("dd",{className:"text-[11px] text-ink/60",children:u})]},l))})]}),e("div",{className:"mt-3 flex flex-col items-center gap-1.5",children:[e(Z,{saving:t,onUseChromium:d}),e("p",{className:"text-[10.5px] text-ink/45 max-w-sm",children:"Berlaku untuk tab yang dibuka berikutnya; sesi tidak perlu di-restart. Tab WebKit yang sudah terbuka tetap tidak terlihat."}),r&&e("p",{role:"alert",className:"text-[11px] text-error max-w-sm",children:r})]})]})}var ae={open:Qe,navigate:Qe,loaded:ne,click:U,type:Yr,press:tt,submit:Ln,wait:Ue,screenshot:dr,scroll:D,upload:Ui,close:Sn,error:Sn};function F({actions:t}){if(t.length===0)return null;return e("div",{className:"absolute bottom-3 left-3 z-20 flex flex-col gap-1.5 pointer-events-none max-w-[320px]",children:t.map((r)=>{let d=ae[r.kind],c=r.kind==="error";return e("div",{className:`flex items-center gap-2 rounded-md border px-2.5 py-1.5 text-[11px] shadow-sm backdrop-blur-sm ${c?"border-error/30 bg-error/10 text-error":"border-ink/15 bg-paper/95 text-ink"}`,children:[e(d,{size:12,className:`flex-shrink-0 ${c?"text-error":"text-ink/60"}`}),e("span",{className:"truncate",children:r.label})]},r.id)})})}function ie(t){return t.title||t.url||t.targetId}function H({tabs:t,targetId:r,closing:d,onSelectTarget:c,onCloseTarget:l}){let u=i(null);return o(()=>{u.current?.scrollIntoView({block:"nearest",inline:"nearest"})},[r,t.length]),e("div",{className:"px-2 py-1 border-b border-ink/10 bg-paper flex items-center gap-1 overflow-x-auto flex-shrink-0",children:t.map((p)=>{let w=p.targetId===r,k=ie(p);return e("div",{ref:w?u:void 0,className:`group flex items-center rounded border transition-colors flex-shrink-0 ${w?"bg-ink text-canvas border-ink":"bg-paper text-ink/70 border-ink/15 hover:border-ink/35 hover:text-ink"}`,children:[e("button",{type:"button",onClick:()=>c(w?"":p.targetId),className:"pl-2 pr-1 py-0.5 text-[11px] font-mono max-w-[220px] truncate cursor-pointer",title:`${k}
1
+ import{n,o,i,a,e,Ze,S,s,ne,Sn,m,_,dr,tt,Qe,Ue,Cr,Ln,Yr,Ui,b,Jl}from"./index-4c2zcvem.js";import{gu}from"./index-w0rbyw47.js";import"./index-vb3srfyc.js";var te={name:"mouse-pointer-click",size:24,node:[["path",{d:"M14 4.1 12 6",key:"ita8i4"}],["path",{d:"m5.1 8-2.9-.8",key:"1go3kf"}],["path",{d:"m6 12-1.9 2",key:"mnht97"}],["path",{d:"M7.2 2.2 8 5.1",key:"1cfko1"}],["path",{d:"M9.037 9.69a.498.498 0 0 1 .653-.653l11 4.5a.5.5 0 0 1-.074.949l-4.349 1.041a1 1 0 0 0-.74.739l-1.04 4.35a.5.5 0 0 1-.95.074z",key:"s0h3yz"}]]},U=s(te);var re={name:"move-vertical",size:24,node:[["path",{d:"M12 2v20",key:"t6zp3m"}],["path",{d:"m8 18 4 4 4-4",key:"bh5tu3"}],["path",{d:"m8 6 4-4 4 4",key:"ybng9g"}]]},D=s(re);var oe={live:"Live","agent-offline":"Agent offline","browser-offline":"Browser offline","no-tab":"Tanpa tab"};function j({url:t,status:r,zoomLevel:d=100,onIncludeInChat:c,onReconnect:l,onOpenExternal:u,onZoomIn:p,onZoomOut:w,onResetZoom:k}){return e(gu,{url:t??"",statusDotClass:r==="live"?"bg-success animate-pulse":"bg-ink/25",statusLabel:oe[r],zoomLevel:d,onZoomIn:p,onZoomOut:w,onResetZoom:k,onIncludeInChat:c,onOpenExternal:u,onReconnect:l,openExternalLabel:"Buka di jendela baru",openExternalTitle:t?"Open in new window":"No URL loaded",children:e("div",{className:"flex-1 min-w-0 flex items-center bg-canvas border border-ink/15 rounded-md px-2 py-0.5",children:[e(Qe,{size:12,className:"text-ink/40 mr-1.5 flex-shrink-0"}),e("span",{className:"w-full truncate text-ink/80 font-mono text-[11px]",title:t??"",children:t||"No page open yet"})]})})}var se=[["RAM","~93 MB → ~259 MB untuk satu tab"],["Disk","~346 MB untuk Chrome for Testing bila belum terpasang"],["Idle","Tab Chromium terus melukis; omp membekukannya saat turn selesai"],["Deteksi","Halaman bisa melihat otomasi (navigator.webdriver, CDP)"]];function Z({saving:t,onUseChromium:r}){return e("button",{type:"button",onClick:r,disabled:t,className:"inline-flex items-center gap-1.5 rounded-md border border-ink/15 bg-ink/5 px-2.5 py-1 text-[11px] font-medium text-ink transition-colors hover:bg-ink/10 disabled:cursor-not-allowed disabled:opacity-60",children:[t&&e(m,{size:11,className:"animate-spin"}),t?"Mengaktifkan…":"Pakai Chromium"]})}function z({saving:t,error:r,onUseChromium:d,variant:c}){if(c==="strip")return e("div",{className:"flex items-center justify-between gap-2 border-b border-ink/10 bg-ink/[0.03] px-2.5 py-1.5 flex-shrink-0",children:[e("span",{className:"min-w-0 truncate text-[11px] text-ink/70",children:"Agen memakai WebKit — tab baru tidak akan muncul di panel ini."}),e(Z,{saving:t,onUseChromium:d})]});return e("div",{className:"flex-1 flex flex-col items-center justify-center overflow-y-auto p-6 text-center select-none my-auto",children:[e("div",{className:"w-12 h-12 rounded-xl bg-ink/5 border border-ink/10 flex items-center justify-center text-ink/40 mb-3",children:e(_,{size:24})}),e("h3",{className:"text-sm font-semibold text-ink mb-1",children:"Agen memakai WebKit — panel ini tidak bisa memantulkannya"}),e("p",{className:"text-xs text-ink/60 max-w-sm",children:"WebKit milik omp tidak punya CDP dan tidak mengekspos aliran frame, jadi tab yang dijalankannya tidak bisa ditampilkan di sini. Panel ini hanya bisa memantulkan Chromium."}),e("div",{className:"mt-4 w-full max-w-sm rounded-lg border border-ink/10 bg-paper text-left",children:[e("div",{className:"border-b border-ink/10 px-3 py-1.5 text-[10px] uppercase tracking-wider text-ink/50",children:"Biaya pindah ke Chromium"}),e("dl",{className:"divide-y divide-ink/5",children:se.map(([l,u])=>e("div",{className:"flex gap-2 px-3 py-1.5",children:[e("dt",{className:"w-14 flex-shrink-0 text-[11px] font-medium text-ink/70",children:l}),e("dd",{className:"text-[11px] text-ink/60",children:u})]},l))})]}),e("div",{className:"mt-3 flex flex-col items-center gap-1.5",children:[e(Z,{saving:t,onUseChromium:d}),e("p",{className:"text-[10.5px] text-ink/45 max-w-sm",children:"Berlaku untuk tab yang dibuka berikutnya; sesi tidak perlu di-restart. Tab WebKit yang sudah terbuka tetap tidak terlihat."}),r&&e("p",{role:"alert",className:"text-[11px] text-error max-w-sm",children:r})]})]})}var ae={open:Qe,navigate:Qe,loaded:ne,click:U,type:Yr,press:tt,submit:Ln,wait:Ue,screenshot:dr,scroll:D,upload:Ui,close:Sn,error:Sn};function F({actions:t}){if(t.length===0)return null;return e("div",{className:"absolute bottom-3 left-3 z-20 flex flex-col gap-1.5 pointer-events-none max-w-[320px]",children:t.map((r)=>{let d=ae[r.kind],c=r.kind==="error";return e("div",{className:`flex items-center gap-2 rounded-md border px-2.5 py-1.5 text-[11px] shadow-sm backdrop-blur-sm ${c?"border-error/30 bg-error/10 text-error":"border-ink/15 bg-paper/95 text-ink"}`,children:[e(d,{size:12,className:`flex-shrink-0 ${c?"text-error":"text-ink/60"}`}),e("span",{className:"truncate",children:r.label})]},r.id)})})}function ie(t){return t.title||t.url||t.targetId}function H({tabs:t,targetId:r,closing:d,onSelectTarget:c,onCloseTarget:l}){let u=i(null);return o(()=>{u.current?.scrollIntoView({block:"nearest",inline:"nearest"})},[r,t.length]),e("div",{className:"px-2 py-1 border-b border-ink/10 bg-paper flex items-center gap-1 overflow-x-auto flex-shrink-0",children:t.map((p)=>{let w=p.targetId===r,k=ie(p);return e("div",{ref:w?u:void 0,className:`group flex items-center rounded border transition-colors flex-shrink-0 ${w?"bg-ink text-canvas border-ink":"bg-paper text-ink/70 border-ink/15 hover:border-ink/35 hover:text-ink"}`,children:[e("button",{type:"button",onClick:()=>c(w?"":p.targetId),className:"pl-2 pr-1 py-0.5 text-[11px] font-mono max-w-[220px] truncate cursor-pointer",title:`${k}
2
2
  ${p.url}`,"aria-pressed":w,children:k}),e("button",{type:"button",onClick:()=>l(p.targetId),disabled:d===p.targetId,className:`mr-0.5 p-1 rounded hover:bg-error hover:text-paper transition-colors cursor-pointer disabled:opacity-40 disabled:cursor-not-allowed ${w?"text-on-ink-muted":"text-ink/40 opacity-0 group-hover:opacity-100 focus-visible:opacity-100"}`,"aria-label":`Tutup tab ${k}`,title:`Tutup tab ${k}`,children:e(b,{size:11})})]},p.targetId)})})}function le(t){let r=atob(t),d=new Uint8Array(r.length);for(let c=0;c<r.length;c++)d[c]=r.charCodeAt(c);return d}function ce(t,r){return new Blob([le(t)],{type:r})}async function K(t,r,d){let c=t.getContext("2d");if(!c)return!1;if(typeof createImageBitmap!=="function")return!1;let l;try{l=await createImageBitmap(ce(r,d))}catch{return!1}try{if(t.width!==l.width||t.height!==l.height)t.width=l.width,t.height=l.height;return c.drawImage(l,0,0),!0}finally{l.close()}}var ue={"agent-offline":{title:"The agent is not running",body:"Start this session so the agent can drive the browser."},"browser-offline":{title:"No browser is open",body:"Ask the agent to open a page; the live view appears here."},"no-tab":{title:"Browser is open, with no tab yet",body:"This session has not opened a tab in the shared browser."}};function J({status:t,url:r,tabs:d,targetId:c,frame:l,actions:u,onSelectTarget:p,onCloseTarget:w,closingTarget:k,zoomLevel:I}){let B=t==="live",L=B?null:ue[t],g=i(null),[f,x]=n(!1);return o(()=>{let E=g.current;if(!E||!l)return;let y=!1;return K(E,l.data,l.mimeType).then((T)=>{if(T&&!y)x(!0)}),()=>{y=!0}},[l]),o(()=>{if(!B)x(!1)},[B]),e("div",{className:"flex-1 flex flex-col min-h-0 bg-canvas/60 relative overflow-hidden",children:[e(F,{actions:u}),B&&d.length>0&&e(H,{tabs:d,targetId:c,closing:k,onSelectTarget:p,onCloseTarget:w}),e("div",{className:"flex-1 flex items-center justify-center p-2 min-h-0 overflow-auto",children:B?e("div",{className:"relative flex flex-col bg-paper w-full h-full transition-all duration-200",style:{zoom:I!==100?`${I}%`:void 0,transformOrigin:"top center"},children:[e("canvas",{ref:g,"aria-label":r||"Live browser view",className:`w-full h-full object-contain bg-paper ${f?"":"hidden"}`}),!f&&e("div",{className:"absolute inset-0 flex flex-col items-center justify-center text-center p-6 select-none",children:[e(m,{size:20,className:"animate-spin text-ink/40 mb-2"}),e("p",{className:"text-xs text-ink/60",children:"Menunggu frame pertama dari browser…"})]})]}):e("div",{className:"flex-1 flex flex-col items-center justify-center p-6 text-center select-none my-auto",children:[e("div",{className:"w-12 h-12 rounded-xl bg-ink/5 border border-ink/10 flex items-center justify-center text-ink/40 mb-3",children:t==="agent-offline"?e(Cr,{size:24}):e(Qe,{size:24})}),e("h3",{className:"text-sm font-semibold text-ink mb-1",children:L?.title}),e("p",{className:"text-xs text-ink/60 max-w-sm",children:L?.body})]})})]})}function W(t){if(typeof t!=="object"||t===null||!("error"in t))return null;return typeof t.error==="string"?t.error:null}function X(){let[t,r]=n(null),[d,c]=n(!0),[l,u]=n(!1),[p,w]=n(null),[k,I]=n(0);o(()=>{let g=!1;return c(!0),fetch("/api/browser/engine").then((f)=>f.json()).then((f)=>{if(g)return;let x=W(f);if(x){w(x);return}r(f),w(null)}).catch((f)=>{if(!g)w(f instanceof Error?f.message:String(f))}).finally(()=>{if(!g)c(!1)}),()=>{g=!0}},[k]);let B=a(()=>I((g)=>g+1),[]),L=a(async()=>{u(!0),w(null);try{let g=await fetch("/api/browser/engine",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({webkit:!1})}),f=await g.json().catch(()=>null),x=W(f)??(g.ok?null:`The write answered ${g.status}`);if(x)return w(x),!1;return r(f),!0}catch(g){return w(g instanceof Error?g.message:String(g)),!1}finally{u(!1)}},[]);return{state:t,loading:d,saving:l,error:p,refresh:B,useChromium:L}}var G={status:"agent-offline",tabs:[]},Y=5000,de=4000,me=500,pe=3,q=16;function Q(t=!0){let{sessionId:r,ready:d}=Ze(),[c,l]=n(G),[u,p]=n(null),[w,k]=n([]),[I,B]=n(""),[L,g]=n(0),f=i(null),x=i(null),E=i(void 0),y=i(0),T=i([]),M=a((N)=>{B(N.trim())},[]),O=a(()=>{g((N)=>N+1)},[]);return o(()=>{let N=setInterval(()=>{k((P)=>{let R=Date.now(),A=P.filter((h)=>h.expiresAt>R),C=T.current.shift();if(!C)return A.length===P.length?P:A;return[...A.slice(-(pe-1)),{...C,expiresAt:R+de}]})},me);return()=>clearInterval(N)},[]),o(()=>{l(G),p(null),B(""),T.current=[],k([])},[r]),o(()=>{if(!d||!r||!t)return;let N=!1,P=()=>{if(N)return;let A=I?`?target=${encodeURIComponent(I)}`:"",C=new EventSource(`/api/browser/${encodeURIComponent(r)}/stream${A}`);f.current=C,C.addEventListener("open",()=>{y.current=0}),C.addEventListener("state",(h)=>{try{let v=JSON.parse(h.data);if(E.current=v.targetId,l(v),v.status!=="live")p(null)}catch{}}),C.addEventListener("frame",(h)=>{try{let v=JSON.parse(h.data),V=E.current;if(V&&v.targetId&&v.targetId!==V)return;if(!V&&v.targetId)E.current=v.targetId;p({data:v.data,mimeType:v.mimeType})}catch{}}),C.addEventListener("action",(h)=>{try{let v=JSON.parse(h.data);if(typeof v?.label!=="string"||!v.label)return;if(T.current.push(v),T.current.length>q)T.current.splice(0,T.current.length-q)}catch{}}),C.addEventListener("error",()=>{if(C.readyState===EventSource.CLOSED)R()})},R=()=>{if(N||x.current)return;let A=Math.min(y.current+1,Y/1000);y.current=A,x.current=setTimeout(()=>{x.current=null,f.current?.close(),f.current=null,P()},Math.min(A*1000,Y))};return P(),()=>{if(N=!0,x.current)clearTimeout(x.current),x.current=null;f.current?.close(),f.current=null}},[d,r,I,L,t]),{status:c.status,url:c.url,title:c.title,tabs:c.tabs,targetId:c.targetId,frame:u,actions:w,sessionId:r,selectTarget:M,reconnect:O}}function fe(t){return typeof t==="string"&&t?t:null}function ee(t){let[r,d]=n(null);return{closeTab:a(async(l)=>{if(!t||!l)return{ok:!1,next:null,error:"No tab to close"};d(l);try{let u=await fetch(`/api/browser/${encodeURIComponent(t)}/tabs/close`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({targetId:l})}),p=await u.json().catch(()=>({}));if(!u.ok)return{ok:!1,next:null,error:typeof p.error==="string"&&p.error?p.error:`Close failed (${u.status})`};return{ok:!0,next:fe(p.next)}}catch(u){return{ok:!1,next:null,error:u instanceof Error?u.message:String(u)}}finally{d(null)}},[t]),closing:r}}function it({className:t="",active:r=!0}){let[d,c]=S("browser.zoomLevel",100),{status:l,url:u,title:p,tabs:w,targetId:k,frame:I,actions:B,sessionId:L,selectTarget:g,reconnect:f}=Q(r),{closeTab:x,closing:E}=ee(L),y=X(),[T,M]=n(null),O=y.state?.effective==="webkit"&&!y.state.mock,N=O&&(l==="browser-offline"||l==="no-tab"),P=a(()=>{y.useChromium().then((h)=>{if(h)f()})},[y.useChromium,f]),R=()=>{if(!u)return;let h=u.startsWith("/")&&typeof window<"u"?`${window.location.origin}${u}`:u;window.open(h,"_blank","noopener,noreferrer")},A=a(()=>{if(!u)return;Jl({url:u,title:p})},[u,p]),C=a((h)=>{if(E===h)return;x(h).then((v)=>{if(!v.ok){M(v.error??"The tab could not be closed");return}M(null),g(v.next??"")})},[x,E,g]);return e("div",{className:`flex flex-col h-full w-full bg-paper text-ink overflow-hidden select-none ${t}`,children:[e(j,{url:u,status:l,zoomLevel:d,onIncludeInChat:A,onReconnect:f,onOpenExternal:R,onZoomIn:()=>c((h)=>Math.min(200,h+10)),onZoomOut:()=>c((h)=>Math.max(50,h-10)),onResetZoom:()=>c(100)}),T&&e("div",{role:"alert",className:"px-2.5 py-1 border-b border-error/30 bg-error/5 text-[11px] text-error flex items-center justify-between gap-2 flex-shrink-0",children:[e("span",{className:"truncate",title:T,children:T}),e("button",{type:"button",onClick:()=>M(null),className:"text-[10px] uppercase tracking-wide text-error/80 hover:text-error cursor-pointer flex-shrink-0",children:"Tutup"})]}),O&&l==="live"&&y.state&&e(z,{saving:y.saving,error:y.error,onUseChromium:P,variant:"strip"}),N&&y.state?e(z,{saving:y.saving,error:y.error,onUseChromium:P,variant:"body"}):e(J,{status:l,url:u,tabs:w,targetId:k,frame:I,actions:B,onSelectTarget:g,onCloseTarget:C,closingTarget:E,zoomLevel:d})]})}export{it as BrowserPanel};
@@ -1,2 +1,2 @@
1
- import{d,n,o,a,e,s,E,D,ot,lt}from"./index-3fw3sd10.js";var q={name:"ticket",size:24,node:[["path",{d:"M2 9a3 3 0 0 1 0 6v2a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-2a3 3 0 0 1 0-6V7a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2Z",key:"qn84l0"}],["path",{d:"M13 5v2",key:"dyzc3o"}],["path",{d:"M13 17v2",key:"1ont0d"}],["path",{d:"M13 11v2",key:"1wjjxi"}]]},S=s(q);function P({providerName:t,providerSlug:r,iconUrl:i,credentialSources:l,error:p,note:c,children:m}){return e("section",{className:"bg-paper border border-ink/15 rounded-lg shadow-xs",children:[e("header",{className:"flex items-center justify-between gap-2 px-3.5 py-2.5 border-b border-ink/10",children:[e("span",{className:"flex min-w-0 items-center gap-2",children:[r&&e(lt,{provider:{slug:r,name:t,...i?{iconUrl:i}:{}},size:20}),e("span",{className:"truncate text-xs font-semibold text-ink",children:t})]}),e("span",{className:"text-[10px] font-mono uppercase tracking-wider text-ink/50 truncate",title:`Credentials from ${l.join(", ")}`,children:l.join(" · ")})]}),e("div",{className:"p-3.5 space-y-4",children:[p&&e("p",{className:"flex items-start gap-2 text-error text-xs leading-relaxed",children:[e(E,{size:14,className:"shrink-0 mt-0.5"}),e("span",{className:"break-words",children:p})]}),m,c&&e("p",{className:"text-[10px] text-ink/50 leading-relaxed border-t border-ink/10 pt-2.5",children:c})]})]})}var B=new Intl.NumberFormat("id-ID",{style:"currency",currency:"IDR",maximumFractionDigits:0}),j=new Intl.NumberFormat("id-ID"),y=new Intl.NumberFormat("id-ID",{minimumFractionDigits:2,maximumFractionDigits:2,useGrouping:!1}),G=new Intl.DateTimeFormat("id-ID",{dateStyle:"medium",timeStyle:"short"});function x(t){return B.format(t)}function b(t){return j.format(t)}function ra(t){let r=new Date(t);if(Number.isNaN(r.getTime()))return t;return G.format(r)}function L(t,r){if(r<=0)return 0;return Math.min(100,Math.max(0,t/r*100))}function T(t,r){if(r<=0)return"0%";return`${new Intl.NumberFormat("id-ID",{maximumFractionDigits:1}).format(t/r*100)}%`}function k(t){if(!Number.isFinite(t))return"0";let r=Math.abs(t);if(r>=1e9)return`${y.format(t/1e9)}B`;if(r>=1e6)return`${y.format(t/1e6)}M`;if(r>=1000)return`${y.format(t/1000)}K`;return b(t)}function N(t){let r=Number(t);if(t.trim()===""||!Number.isFinite(r))return t;return b(r)}var O=new Intl.NumberFormat("id-ID",{minimumFractionDigits:2,maximumFractionDigits:2});function U(t){if(!Number.isFinite(t))return"$0,00";return`$${O.format(t)}`}function w(t,r){if(!Number.isFinite(t))return"—";switch(r){case"percent":return`${new Intl.NumberFormat("id-ID",{maximumFractionDigits:1}).format(t)}%`;case"usd":return U(t);case"tokens":case"bytes":return k(t);default:return b(t)}}function C(t){if(!Number.isFinite(t))return"0%";return`${new Intl.NumberFormat("id-ID",{maximumFractionDigits:1}).format(t*100)}%`}function z({window:t}){let r=t.usedRp+t.remainingRp,i=L(t.usedRp,r);return e("div",{className:"bg-paper border border-ink/15 rounded-lg p-3 shadow-xs space-y-2",children:[e("div",{className:"flex items-center justify-between gap-2",children:[e("span",{className:"text-[11px] font-semibold text-ink",children:t.label}),e("span",{className:"text-[10px] text-ink/50",children:["Resets ",ra(t.resetsAt)]})]}),e("div",{className:"h-1.5 w-full bg-ink/10 rounded-full overflow-hidden",children:e("div",{className:"h-full bg-ink/80 rounded-full",style:{width:`${i}%`}})}),e("div",{className:"flex flex-wrap items-center justify-between gap-x-3 gap-y-0.5 text-[10px] text-ink/60",children:[e("span",{children:["Used ",e("span",{className:"font-semibold text-ink",children:x(t.usedRp)})," ·"," ",T(t.usedRp,r)]}),e("span",{children:["Remaining ",e("span",{className:"font-semibold text-ink",children:x(t.remainingRp)})]})]})]})}function H({coupon:t}){return e("div",{className:"bg-ink/5 border border-ink/10 rounded-lg p-3 shadow-xs",children:[e("div",{className:"flex items-center gap-1.5 mb-1.5",children:[e(S,{size:12,className:"text-ink/60"}),e("span",{className:"text-[11px] font-semibold text-ink",children:["Active coupon · ",t.name]})]}),e("div",{className:"text-[10px] text-ink/60 space-y-0.5",children:[e("div",{children:["Remaining"," ",e("span",{className:"font-semibold text-ink",children:t.remainingRp===null?"Unlimited":x(t.remainingRp)})," ","· Used ",e("span",{className:"font-semibold text-ink",children:x(t.usedRp)})]}),e("div",{children:["Expires ",ra(t.expiresAt)]}),t.scopeModels.length>0&&e("div",{children:["Models: ",t.scopeModels.join(", ")]})]})]})}function I({quota:t}){if(!t)return e("p",{className:"text-[11px] text-ink/50",children:"Quota data is not available for this account."});return e("div",{className:"space-y-2",children:[e("div",{className:"flex items-center justify-between gap-2",children:[e("h4",{className:"text-[10px] font-mono font-semibold uppercase tracking-wider text-ink/40",children:"Quota windows"}),t.planName&&e("span",{className:"text-[10px] text-ink/60",children:["Plan ",e("span",{className:"font-semibold text-ink",children:t.planName})]})]}),t.windows.length===0?e("p",{className:"text-[11px] text-ink/50",children:"No quota windows reported."}):e("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-2.5",children:t.windows.map((r)=>e(z,{window:r},r.key))}),t.coupon&&e(H,{coupon:t.coupon})]})}function A({usage:t}){if(!t)return e("p",{className:"text-[11px] text-ink/50",children:"The 30-day usage report is not available."});let r=t.rows.reduce((l,p)=>l+p.inputTokens,0),i=t.rows.reduce((l,p)=>l+p.outputTokens,0);return e("div",{className:"space-y-2",children:[e("h4",{className:"text-[10px] font-mono font-semibold uppercase tracking-wider text-ink/40",children:"30-day usage by model"}),e("div",{className:"overflow-x-auto border border-ink/15 rounded-lg shadow-xs",children:e("table",{className:"w-full text-[11px]",children:[e("thead",{className:"bg-ink/5 text-ink/60",children:e("tr",{children:[e("th",{className:"text-left font-semibold px-3 py-2 whitespace-nowrap",children:"Model"}),e("th",{className:"text-right font-semibold px-3 py-2 whitespace-nowrap",children:"Requests"}),e("th",{className:"text-right font-semibold px-3 py-2 whitespace-nowrap",children:"Input tokens"}),e("th",{className:"text-right font-semibold px-3 py-2 whitespace-nowrap",children:"Output tokens"}),e("th",{className:"text-right font-semibold px-3 py-2 whitespace-nowrap",children:"Cost"})]})}),e("tbody",{className:"divide-y divide-ink/10",children:t.rows.length===0?e("tr",{children:e("td",{colSpan:5,className:"px-3 py-3 text-center text-ink/50",children:"No usage recorded in the last 30 days."})}):t.rows.map((l)=>e("tr",{children:[e("td",{className:"px-3 py-1.5 font-mono text-ink whitespace-nowrap",children:l.model}),e("td",{className:"px-3 py-1.5 text-right tabular-nums text-ink/80",children:b(l.requests)}),e("td",{className:"px-3 py-1.5 text-right tabular-nums text-ink/80",children:k(l.inputTokens)}),e("td",{className:"px-3 py-1.5 text-right tabular-nums text-ink/80",children:k(l.outputTokens)}),e("td",{className:"px-3 py-1.5 text-right tabular-nums text-ink/80",children:x(l.costRp)})]},l.model))}),e("tfoot",{className:"bg-ink/5 border-t border-ink/15 font-semibold text-ink",children:e("tr",{children:[e("td",{className:"px-3 py-2",children:"Total"}),e("td",{className:"px-3 py-2 text-right tabular-nums",children:b(t.totalRequests)}),e("td",{className:"px-3 py-2 text-right tabular-nums",children:k(r)}),e("td",{className:"px-3 py-2 text-right tabular-nums",children:k(i)}),e("td",{className:"px-3 py-2 text-right tabular-nums",children:x(t.totalCostRp)})]})})]})})]})}function F({report:t}){let{balance:r,usage:i,quota:l}=t;if(!r&&!i&&!l)return e("p",{className:"text-[11px] text-ink/50",children:"No kenari data was returned for this account."});let p=r?r.amountRp!==null?x(r.amountRp):r.raw:"–",c=r?r.amountRp!==null?r.raw:"Amount could not be parsed":"Balance unavailable",m=i?i.rows.reduce((g,u)=>g+u.inputTokens+u.outputTokens,0):0;return e(d,{children:[e("div",{className:"@container",children:e("div",{className:"grid grid-cols-3 @[540px]:grid-cols-5 gap-2.5 items-stretch",children:[e(ot,{value:p,label:"Wallet balance",hint:c}),e(ot,{value:l?.planName??"–",label:"Active plan",hint:l?"kenari quota plan":"Quota unavailable"}),e(ot,{value:i?b(i.totalRequests):"–",label:"Requests (30 days)",hint:i?"Across all models":"Usage report unavailable"}),e(ot,{value:i?x(i.totalCostRp):"–",label:"Cost (30 days)",hint:i?"Billed in Rupiah":"Usage report unavailable"}),e(ot,{value:i?k(m):"–",label:"Tokens processed (30 days)",hint:i?"Input + output":"Usage report unavailable",tone:"muted",className:"col-span-2 @[540px]:col-span-1"})]})}),e(I,{quota:l}),e(A,{usage:i})]})}function W({report:t}){let r=t.balance;if(!r)return e("p",{className:"text-[11px] text-ink/50",children:"DeepSeek balance data is not available."});return e(d,{children:[e("div",{className:"@container",children:e("div",{className:"grid grid-cols-3 @[540px]:grid-cols-5 gap-2.5 items-stretch",children:[e(ot,{value:r.isAvailable?"Available":"Unavailable",label:"Prepaid balance",hint:r.isAvailable?"Account can spend":"Top up required",tone:r.isAvailable?"default":"muted"}),e(ot,{value:b(r.entries.length),label:"Currency buckets",hint:r.entries.length>0?"From the balance endpoint":"No entries returned",tone:"muted"})]})}),r.entries.length===0?e("p",{className:"text-[11px] text-ink/50",children:"The balance endpoint returned no currency entries."}):e("div",{className:"grid grid-cols-1 gap-2.5",children:r.entries.map((i)=>e("div",{className:"bg-paper border border-ink/15 rounded-lg p-3 shadow-xs",children:[e("div",{className:"flex items-center justify-between gap-2 mb-2",children:[e("span",{className:"text-[11px] font-semibold text-ink",children:i.currency}),e("span",{className:"text-[10px] font-mono uppercase tracking-wider text-ink/40",children:"Balance"})]}),e("dl",{className:"grid grid-cols-3 gap-2 text-[10px]",children:[e("div",{children:[e("dt",{className:"text-ink/50",children:"Total"}),e("dd",{className:"font-semibold text-ink tabular-nums break-words",children:N(i.totalBalance)})]}),e("div",{children:[e("dt",{className:"text-ink/50",children:"Granted"}),e("dd",{className:"font-semibold text-ink tabular-nums break-words",children:N(i.grantedBalance)})]}),e("div",{children:[e("dt",{className:"text-ink/50",children:"Topped up"}),e("dd",{className:"font-semibold text-ink tabular-nums break-words",children:N(i.toppedUpBalance)})]})]})]},i.currency))})]})}function R(t,r,i,l){let p=t.find((c)=>c.id===r);if(p){p.limits.push(l);return}t.push({id:r,title:i,limits:[l]})}function V(t){let r=(t.split(":")[1]??"").toLowerCase();if(r==="google")return{id:"google",title:"Google"};if(r==="anthropic"||r==="openai")return{id:"third-party",title:"Claude & GPT (shared)"};if(r==="default"||r==="")return{id:"default",title:"Usage"};return{id:r,title:r}}function X(t){let r=[];for(let i of t)if(i.id==="anthropic:extra")R(r,"balance","Balance",i);else R(r,"windows","Quota windows",i);return r}function J(t){let r=[];for(let i of t){let l=V(i.id);if(l.id==="third-party"){if(r.find((c)=>c.id==="third-party")?.limits.some((c)=>Z(c,i)))continue}R(r,l.id,l.title,i)}return r}function Z(t,r){return t.unit===r.unit&&t.label===r.label&&t.usedFraction===r.usedFraction&&t.remaining===r.remaining&&t.resetsAt===r.resetsAt}function _(t,r){if(r.length===0)return[];let i=t.trim().toLowerCase();if(i==="anthropic")return X(r);if(i==="google-antigravity")return J(r);return[{id:"all",title:"Quota windows",limits:[...r]}]}function Y({limit:t}){let r=Math.min(100,Math.max(0,(t.usedFraction??0)*100)),i=t.modelId??t.accountId,l=t.used!==void 0?w(t.used,t.unit):void 0,p=t.limit!==void 0?w(t.limit,t.unit):void 0,c=t.remaining!==void 0?w(t.remaining,t.unit):void 0;return e("div",{className:"bg-paper border border-ink/15 rounded-lg p-3 shadow-xs space-y-2",children:[e("div",{className:"flex items-start justify-between gap-2",children:[e("div",{className:"min-w-0",children:[e("div",{className:"text-[11px] font-semibold text-ink truncate",children:[t.label,t.windowLabel&&e("span",{className:"ml-1.5 rounded border border-ink/15 px-1 py-px font-mono text-[9px] font-normal text-ink/50",children:t.windowLabel})]}),i&&e("div",{className:"text-[10px] text-ink/50 truncate",children:i})]}),e("span",{className:"text-[10px] text-ink/50 flex-shrink-0 whitespace-nowrap",children:t.resetsAt!==void 0?`Resets ${ra(new Date(t.resetsAt).toISOString())}`:""})]}),e("div",{className:"h-1.5 w-full bg-ink/10 rounded-full overflow-hidden",children:e("div",{className:`h-full rounded-full ${t.status==="exhausted"?"bg-error/70":"bg-ink/80"}`,style:{width:`${r}%`}})}),e("div",{className:"flex flex-wrap items-center justify-between gap-x-3 gap-y-0.5 text-[10px] text-ink/60",children:[e("span",{children:["Used"," ",e("span",{className:"font-semibold text-ink",children:t.unit==="percent"||!l?C(t.usedFraction??0):l}),t.unit!=="percent"&&l&&p?` of ${p}`:""]}),e("span",{className:"flex items-center gap-2",children:[t.status!=="ok"&&t.status!=="unknown"&&e("span",{className:"text-[10px] font-mono uppercase px-1.5 py-0.5 rounded bg-ink/10 text-ink/70",children:t.status}),c&&e("span",{children:["Remaining ",e("span",{className:"font-semibold text-ink",children:c})]})]})]}),t.notes&&t.notes.length>0&&e("ul",{className:"text-[10px] text-ink/50 leading-relaxed space-y-0.5",children:t.notes.map((m)=>e("li",{children:m},m))})]})}function Q({providerId:t,limits:r,tracked:i,unavailable:l,notes:p}){let c=_(t,r);return e("div",{className:"space-y-2",children:[p&&p.length>0&&e("ul",{className:"text-[10px] text-ink/50 leading-relaxed space-y-0.5",children:p.map((m)=>e("li",{children:m},m))}),c.length===0?e(d,{children:[e("h4",{className:"text-[10px] font-mono font-semibold uppercase tracking-wider text-ink/40",children:"Quota windows"}),e("p",{className:"text-[11px] text-ink/50",children:!i?"No quota source for this provider: omp ships no usage adapter for it and it exposes no balance endpoint Kabmo knows.":l?"omp tracks this provider but its usage endpoint returned no data — an invalid or expired credential, an unreachable endpoint, or a plan without quota windows.":"No quota windows were reported for this provider."})]}):c.map((m)=>e("div",{className:"@container space-y-2",children:[e("h4",{className:"text-[10px] font-mono font-semibold uppercase tracking-wider text-ink/40",children:m.title}),e("div",{className:"grid grid-cols-1 @[520px]:grid-cols-2 gap-2.5",children:m.limits.map((g)=>e(Y,{limit:g},g.id))})]},m.id))]})}var ee="DeepSeek exposes no usage or quota API — only the prepaid balance (and the web console at platform.deepseek.com) is available.";function pu({summary:t}){let r=Boolean(t.kenari||t.deepseek);return e(P,{providerName:t.name,providerSlug:t.id,iconUrl:t.iconUrl,credentialSources:t.credentialSources,error:t.error,note:t.deepseek?ee:void 0,children:[t.kenari&&e(F,{report:t.kenari}),t.deepseek&&e(W,{report:t.deepseek}),!r&&(t.limits.length>0||!t.error)&&e(Q,{providerId:t.id,limits:t.limits,tracked:t.tracked,unavailable:t.limitsUnavailable,notes:t.notes})]})}function te(t){let r=t.filter((p)=>p.usedFraction!==void 0);if(r.length===0){let p=t.find((c)=>c.unit==="usd"&&c.remaining!==void 0);if(p)return`${U(p.remaining??0)} left`;return t[0]?.label}let i=r.reduce((p,c)=>(c.usedFraction??0)>(p.usedFraction??0)?c:p),l=Math.round((i.usedFraction??0)*100);return i.windowLabel?`${l}% · ${i.windowLabel}`:`${l}% used`}function Cs(t){return t.providers.map((r)=>({id:r.id,name:r.name,...r.iconUrl?{iconUrl:r.iconUrl}:{},error:r.error,hint:ne(r),limits:r.limits,tracked:r.tracked,limitsUnavailable:r.limitsUnavailable,summary:r}))}function ne(t){let r=t.kenari?.quota?.planName;if(r)return r;let i=t.deepseek?.balance?.entries[0];if(i)return`${i.currency} ${N(i.totalBalance)}`;return te(t.limits)??"No quota reported"}function vg(t){return t.error?"Error":"Connected"}function K(){let[t,r]=n([]),[i,l]=n(null),[p,c]=n(!0),m=a(()=>{c(!0),fetch("/api/settings/usage/reset").then((u)=>u.json()).then((u)=>{r(Array.isArray(u.accounts)?u.accounts:[]),l(typeof u.error==="string"?u.error:null)}).catch((u)=>{r([]),l(u instanceof Error?u.message:"Failed to load saved resets")}).finally(()=>c(!1))},[]);o(()=>{m()},[m]);let g=a(async(u)=>{try{let h=await(await fetch("/api/settings/usage/reset",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({target:u})})).json();if(h.ok)m();return{ok:Boolean(h.ok),message:h.message||"No result reported."}}catch(f){return{ok:!1,message:f instanceof Error?f.message:"Failed to spend the saved reset"}}},[m]);return{accounts:t,error:i,isLoading:p,reload:m,spend:g}}function ae({account:t,onSpend:r,spending:i}){let l=`${t.provider}/${t.credentialId}`,p=t.email??t.accountId??t.credentialId,c=t.orgName??t.orgId,m=t.availableCount??t.credits.length,g=t.redeemableCount??0,u=t.error??t.unavailableReason;return e("div",{className:"bg-paper border border-ink/15 rounded-lg p-3 shadow-xs space-y-2",children:[e("div",{className:"flex items-start justify-between gap-2",children:[e("div",{className:"min-w-0",children:[e("div",{className:"text-[11px] font-semibold text-ink truncate",children:[p,c?e("span",{className:"text-ink/50 font-normal",children:[" · ",c]}):null]}),e("div",{className:"text-[10px] text-ink/50 font-mono truncate",children:l})]}),e("span",{className:"text-[10px] text-ink/60 flex-shrink-0 whitespace-nowrap",children:g>0?`${g} of ${m} usable`:`${m} saved`})]}),t.soonestExpiry!==void 0&&e("div",{className:"text-[10px] text-ink/60",children:["Soonest expires ",ra(new Date(t.soonestExpiry).toISOString())]}),t.credits.length>0&&e("div",{className:"space-y-1",children:t.credits.map((f)=>e("div",{className:"flex items-center justify-between gap-2 text-[10px] text-ink/70",children:[e("span",{className:"truncate",children:f.title??f.program??f.id}),e("span",{className:"flex items-center gap-1.5 flex-shrink-0",children:[f.clears&&f.clears.length>0&&e("span",{className:"font-mono text-ink/50",children:f.clears.join(", ")}),f.usable===!1&&e("span",{className:"font-mono uppercase px-1.5 py-0.5 rounded bg-ink/10 text-ink/60",children:"blocked"})]})]},f.id))}),u&&e("div",{className:"text-[10px] text-ink/60 leading-snug",children:u}),e("button",{type:"button",onClick:()=>r(l),disabled:i||g===0,title:g===0?u??"Nothing to spend on this account right now.":`Spend a saved reset on ${l}`,className:"w-full rounded-md border border-ink/15 px-2 py-1 text-[11px] font-medium text-ink/80 hover:bg-ink/5 transition-colors cursor-pointer disabled:opacity-40 disabled:cursor-not-allowed",children:i?"Spending…":"Spend saved reset"})]})}function mu(){let{accounts:t,error:r,isLoading:i,reload:l,spend:p}=K(),[c,m]=n(null),[g,u]=n(null),f=(v)=>{m(v),u(null),p(v).then((M)=>{u(M),m(null)})},h=!i&&!r&&t.length===0;return e("div",{className:"space-y-2",children:[e("div",{className:"flex items-center justify-between gap-2",children:[e("div",{className:"min-w-0",children:[e("div",{className:"text-[11px] font-semibold text-ink",children:"Saved rate-limit resets"}),e("div",{className:"text-[10px] text-ink/50 leading-snug",children:"Provider-issued resets for Codex and Claude accounts. Spending one clears the window it covers."})]}),e("button",{type:"button",onClick:l,disabled:i,title:"Re-read saved resets",className:"p-1.5 bg-paper border border-ink/15 rounded-md hover:bg-ink/5 text-ink/80 transition-colors disabled:opacity-50 flex-shrink-0",children:e(D,{size:12,className:i?"animate-spin text-ink":""})})]}),r&&e("div",{className:"flex items-start gap-1.5 text-[10px] text-error leading-snug",children:[e(E,{size:12,className:"flex-shrink-0 mt-px"}),e("span",{children:r})]}),t.map((v)=>e(ae,{account:v,onSpend:f,spending:c===`${v.provider}/${v.credentialId}`},`${v.provider}/${v.credentialId}`)),h&&e("p",{className:"text-[10px] text-ink/50 leading-snug",children:"No saved resets on any account."}),g&&e("div",{className:`text-[10px] leading-snug ${g.ok?"text-ink/70":"text-error"}`,children:g.message})]})}function fu(){let[t,r]=n(null),[i,l]=n(!0),[p,c]=n(null),m=a(async(g)=>{if(!g?.silent)l(!0);c(null);try{let u=g?.force?"/api/settings/usage?refresh=1":"/api/settings/usage",f=await fetch(u);if(!f.ok)throw Error(`Usage request failed (${f.status})`);let h=await f.json();r(h)}catch(u){c(u instanceof Error?u.message:"Failed to load provider usage")}finally{if(!g?.silent)l(!1)}},[]);return o(()=>{m()},[m]),{report:t,isLoading:i,error:p,reload:m}}
1
+ import{d,n,o,a,e,s,E,D,ot,lt}from"./index-4c2zcvem.js";var q={name:"ticket",size:24,node:[["path",{d:"M2 9a3 3 0 0 1 0 6v2a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-2a3 3 0 0 1 0-6V7a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2Z",key:"qn84l0"}],["path",{d:"M13 5v2",key:"dyzc3o"}],["path",{d:"M13 17v2",key:"1ont0d"}],["path",{d:"M13 11v2",key:"1wjjxi"}]]},S=s(q);function P({providerName:t,providerSlug:r,iconUrl:i,credentialSources:l,error:p,note:c,children:m}){return e("section",{className:"bg-paper border border-ink/15 rounded-lg shadow-xs",children:[e("header",{className:"flex items-center justify-between gap-2 px-3.5 py-2.5 border-b border-ink/10",children:[e("span",{className:"flex min-w-0 items-center gap-2",children:[r&&e(lt,{provider:{slug:r,name:t,...i?{iconUrl:i}:{}},size:20}),e("span",{className:"truncate text-xs font-semibold text-ink",children:t})]}),e("span",{className:"text-[10px] font-mono uppercase tracking-wider text-ink/50 truncate",title:`Credentials from ${l.join(", ")}`,children:l.join(" · ")})]}),e("div",{className:"p-3.5 space-y-4",children:[p&&e("p",{className:"flex items-start gap-2 text-error text-xs leading-relaxed",children:[e(E,{size:14,className:"shrink-0 mt-0.5"}),e("span",{className:"break-words",children:p})]}),m,c&&e("p",{className:"text-[10px] text-ink/50 leading-relaxed border-t border-ink/10 pt-2.5",children:c})]})]})}var B=new Intl.NumberFormat("id-ID",{style:"currency",currency:"IDR",maximumFractionDigits:0}),j=new Intl.NumberFormat("id-ID"),y=new Intl.NumberFormat("id-ID",{minimumFractionDigits:2,maximumFractionDigits:2,useGrouping:!1}),G=new Intl.DateTimeFormat("id-ID",{dateStyle:"medium",timeStyle:"short"});function x(t){return B.format(t)}function b(t){return j.format(t)}function ra(t){let r=new Date(t);if(Number.isNaN(r.getTime()))return t;return G.format(r)}function L(t,r){if(r<=0)return 0;return Math.min(100,Math.max(0,t/r*100))}function T(t,r){if(r<=0)return"0%";return`${new Intl.NumberFormat("id-ID",{maximumFractionDigits:1}).format(t/r*100)}%`}function k(t){if(!Number.isFinite(t))return"0";let r=Math.abs(t);if(r>=1e9)return`${y.format(t/1e9)}B`;if(r>=1e6)return`${y.format(t/1e6)}M`;if(r>=1000)return`${y.format(t/1000)}K`;return b(t)}function N(t){let r=Number(t);if(t.trim()===""||!Number.isFinite(r))return t;return b(r)}var O=new Intl.NumberFormat("id-ID",{minimumFractionDigits:2,maximumFractionDigits:2});function U(t){if(!Number.isFinite(t))return"$0,00";return`$${O.format(t)}`}function w(t,r){if(!Number.isFinite(t))return"—";switch(r){case"percent":return`${new Intl.NumberFormat("id-ID",{maximumFractionDigits:1}).format(t)}%`;case"usd":return U(t);case"tokens":case"bytes":return k(t);default:return b(t)}}function C(t){if(!Number.isFinite(t))return"0%";return`${new Intl.NumberFormat("id-ID",{maximumFractionDigits:1}).format(t*100)}%`}function z({window:t}){let r=t.usedRp+t.remainingRp,i=L(t.usedRp,r);return e("div",{className:"bg-paper border border-ink/15 rounded-lg p-3 shadow-xs space-y-2",children:[e("div",{className:"flex items-center justify-between gap-2",children:[e("span",{className:"text-[11px] font-semibold text-ink",children:t.label}),e("span",{className:"text-[10px] text-ink/50",children:["Resets ",ra(t.resetsAt)]})]}),e("div",{className:"h-1.5 w-full bg-ink/10 rounded-full overflow-hidden",children:e("div",{className:"h-full bg-ink/80 rounded-full",style:{width:`${i}%`}})}),e("div",{className:"flex flex-wrap items-center justify-between gap-x-3 gap-y-0.5 text-[10px] text-ink/60",children:[e("span",{children:["Used ",e("span",{className:"font-semibold text-ink",children:x(t.usedRp)})," ·"," ",T(t.usedRp,r)]}),e("span",{children:["Remaining ",e("span",{className:"font-semibold text-ink",children:x(t.remainingRp)})]})]})]})}function H({coupon:t}){return e("div",{className:"bg-ink/5 border border-ink/10 rounded-lg p-3 shadow-xs",children:[e("div",{className:"flex items-center gap-1.5 mb-1.5",children:[e(S,{size:12,className:"text-ink/60"}),e("span",{className:"text-[11px] font-semibold text-ink",children:["Active coupon · ",t.name]})]}),e("div",{className:"text-[10px] text-ink/60 space-y-0.5",children:[e("div",{children:["Remaining"," ",e("span",{className:"font-semibold text-ink",children:t.remainingRp===null?"Unlimited":x(t.remainingRp)})," ","· Used ",e("span",{className:"font-semibold text-ink",children:x(t.usedRp)})]}),e("div",{children:["Expires ",ra(t.expiresAt)]}),t.scopeModels.length>0&&e("div",{children:["Models: ",t.scopeModels.join(", ")]})]})]})}function I({quota:t}){if(!t)return e("p",{className:"text-[11px] text-ink/50",children:"Quota data is not available for this account."});return e("div",{className:"space-y-2",children:[e("div",{className:"flex items-center justify-between gap-2",children:[e("h4",{className:"text-[10px] font-mono font-semibold uppercase tracking-wider text-ink/40",children:"Quota windows"}),t.planName&&e("span",{className:"text-[10px] text-ink/60",children:["Plan ",e("span",{className:"font-semibold text-ink",children:t.planName})]})]}),t.windows.length===0?e("p",{className:"text-[11px] text-ink/50",children:"No quota windows reported."}):e("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-2.5",children:t.windows.map((r)=>e(z,{window:r},r.key))}),t.coupon&&e(H,{coupon:t.coupon})]})}function A({usage:t}){if(!t)return e("p",{className:"text-[11px] text-ink/50",children:"The 30-day usage report is not available."});let r=t.rows.reduce((l,p)=>l+p.inputTokens,0),i=t.rows.reduce((l,p)=>l+p.outputTokens,0);return e("div",{className:"space-y-2",children:[e("h4",{className:"text-[10px] font-mono font-semibold uppercase tracking-wider text-ink/40",children:"30-day usage by model"}),e("div",{className:"overflow-x-auto border border-ink/15 rounded-lg shadow-xs",children:e("table",{className:"w-full text-[11px]",children:[e("thead",{className:"bg-ink/5 text-ink/60",children:e("tr",{children:[e("th",{className:"text-left font-semibold px-3 py-2 whitespace-nowrap",children:"Model"}),e("th",{className:"text-right font-semibold px-3 py-2 whitespace-nowrap",children:"Requests"}),e("th",{className:"text-right font-semibold px-3 py-2 whitespace-nowrap",children:"Input tokens"}),e("th",{className:"text-right font-semibold px-3 py-2 whitespace-nowrap",children:"Output tokens"}),e("th",{className:"text-right font-semibold px-3 py-2 whitespace-nowrap",children:"Cost"})]})}),e("tbody",{className:"divide-y divide-ink/10",children:t.rows.length===0?e("tr",{children:e("td",{colSpan:5,className:"px-3 py-3 text-center text-ink/50",children:"No usage recorded in the last 30 days."})}):t.rows.map((l)=>e("tr",{children:[e("td",{className:"px-3 py-1.5 font-mono text-ink whitespace-nowrap",children:l.model}),e("td",{className:"px-3 py-1.5 text-right tabular-nums text-ink/80",children:b(l.requests)}),e("td",{className:"px-3 py-1.5 text-right tabular-nums text-ink/80",children:k(l.inputTokens)}),e("td",{className:"px-3 py-1.5 text-right tabular-nums text-ink/80",children:k(l.outputTokens)}),e("td",{className:"px-3 py-1.5 text-right tabular-nums text-ink/80",children:x(l.costRp)})]},l.model))}),e("tfoot",{className:"bg-ink/5 border-t border-ink/15 font-semibold text-ink",children:e("tr",{children:[e("td",{className:"px-3 py-2",children:"Total"}),e("td",{className:"px-3 py-2 text-right tabular-nums",children:b(t.totalRequests)}),e("td",{className:"px-3 py-2 text-right tabular-nums",children:k(r)}),e("td",{className:"px-3 py-2 text-right tabular-nums",children:k(i)}),e("td",{className:"px-3 py-2 text-right tabular-nums",children:x(t.totalCostRp)})]})})]})})]})}function F({report:t}){let{balance:r,usage:i,quota:l}=t;if(!r&&!i&&!l)return e("p",{className:"text-[11px] text-ink/50",children:"No kenari data was returned for this account."});let p=r?r.amountRp!==null?x(r.amountRp):r.raw:"–",c=r?r.amountRp!==null?r.raw:"Amount could not be parsed":"Balance unavailable",m=i?i.rows.reduce((g,u)=>g+u.inputTokens+u.outputTokens,0):0;return e(d,{children:[e("div",{className:"@container",children:e("div",{className:"grid grid-cols-3 @[540px]:grid-cols-5 gap-2.5 items-stretch",children:[e(ot,{value:p,label:"Wallet balance",hint:c}),e(ot,{value:l?.planName??"–",label:"Active plan",hint:l?"kenari quota plan":"Quota unavailable"}),e(ot,{value:i?b(i.totalRequests):"–",label:"Requests (30 days)",hint:i?"Across all models":"Usage report unavailable"}),e(ot,{value:i?x(i.totalCostRp):"–",label:"Cost (30 days)",hint:i?"Billed in Rupiah":"Usage report unavailable"}),e(ot,{value:i?k(m):"–",label:"Tokens processed (30 days)",hint:i?"Input + output":"Usage report unavailable",tone:"muted",className:"col-span-2 @[540px]:col-span-1"})]})}),e(I,{quota:l}),e(A,{usage:i})]})}function W({report:t}){let r=t.balance;if(!r)return e("p",{className:"text-[11px] text-ink/50",children:"DeepSeek balance data is not available."});return e(d,{children:[e("div",{className:"@container",children:e("div",{className:"grid grid-cols-3 @[540px]:grid-cols-5 gap-2.5 items-stretch",children:[e(ot,{value:r.isAvailable?"Available":"Unavailable",label:"Prepaid balance",hint:r.isAvailable?"Account can spend":"Top up required",tone:r.isAvailable?"default":"muted"}),e(ot,{value:b(r.entries.length),label:"Currency buckets",hint:r.entries.length>0?"From the balance endpoint":"No entries returned",tone:"muted"})]})}),r.entries.length===0?e("p",{className:"text-[11px] text-ink/50",children:"The balance endpoint returned no currency entries."}):e("div",{className:"grid grid-cols-1 gap-2.5",children:r.entries.map((i)=>e("div",{className:"bg-paper border border-ink/15 rounded-lg p-3 shadow-xs",children:[e("div",{className:"flex items-center justify-between gap-2 mb-2",children:[e("span",{className:"text-[11px] font-semibold text-ink",children:i.currency}),e("span",{className:"text-[10px] font-mono uppercase tracking-wider text-ink/40",children:"Balance"})]}),e("dl",{className:"grid grid-cols-3 gap-2 text-[10px]",children:[e("div",{children:[e("dt",{className:"text-ink/50",children:"Total"}),e("dd",{className:"font-semibold text-ink tabular-nums break-words",children:N(i.totalBalance)})]}),e("div",{children:[e("dt",{className:"text-ink/50",children:"Granted"}),e("dd",{className:"font-semibold text-ink tabular-nums break-words",children:N(i.grantedBalance)})]}),e("div",{children:[e("dt",{className:"text-ink/50",children:"Topped up"}),e("dd",{className:"font-semibold text-ink tabular-nums break-words",children:N(i.toppedUpBalance)})]})]})]},i.currency))})]})}function R(t,r,i,l){let p=t.find((c)=>c.id===r);if(p){p.limits.push(l);return}t.push({id:r,title:i,limits:[l]})}function V(t){let r=(t.split(":")[1]??"").toLowerCase();if(r==="google")return{id:"google",title:"Google"};if(r==="anthropic"||r==="openai")return{id:"third-party",title:"Claude & GPT (shared)"};if(r==="default"||r==="")return{id:"default",title:"Usage"};return{id:r,title:r}}function X(t){let r=[];for(let i of t)if(i.id==="anthropic:extra")R(r,"balance","Balance",i);else R(r,"windows","Quota windows",i);return r}function J(t){let r=[];for(let i of t){let l=V(i.id);if(l.id==="third-party"){if(r.find((c)=>c.id==="third-party")?.limits.some((c)=>Z(c,i)))continue}R(r,l.id,l.title,i)}return r}function Z(t,r){return t.unit===r.unit&&t.label===r.label&&t.usedFraction===r.usedFraction&&t.remaining===r.remaining&&t.resetsAt===r.resetsAt}function _(t,r){if(r.length===0)return[];let i=t.trim().toLowerCase();if(i==="anthropic")return X(r);if(i==="google-antigravity")return J(r);return[{id:"all",title:"Quota windows",limits:[...r]}]}function Y({limit:t}){let r=Math.min(100,Math.max(0,(t.usedFraction??0)*100)),i=t.modelId??t.accountId,l=t.used!==void 0?w(t.used,t.unit):void 0,p=t.limit!==void 0?w(t.limit,t.unit):void 0,c=t.remaining!==void 0?w(t.remaining,t.unit):void 0;return e("div",{className:"bg-paper border border-ink/15 rounded-lg p-3 shadow-xs space-y-2",children:[e("div",{className:"flex items-start justify-between gap-2",children:[e("div",{className:"min-w-0",children:[e("div",{className:"text-[11px] font-semibold text-ink truncate",children:[t.label,t.windowLabel&&e("span",{className:"ml-1.5 rounded border border-ink/15 px-1 py-px font-mono text-[9px] font-normal text-ink/50",children:t.windowLabel})]}),i&&e("div",{className:"text-[10px] text-ink/50 truncate",children:i})]}),e("span",{className:"text-[10px] text-ink/50 flex-shrink-0 whitespace-nowrap",children:t.resetsAt!==void 0?`Resets ${ra(new Date(t.resetsAt).toISOString())}`:""})]}),e("div",{className:"h-1.5 w-full bg-ink/10 rounded-full overflow-hidden",children:e("div",{className:`h-full rounded-full ${t.status==="exhausted"?"bg-error/70":"bg-ink/80"}`,style:{width:`${r}%`}})}),e("div",{className:"flex flex-wrap items-center justify-between gap-x-3 gap-y-0.5 text-[10px] text-ink/60",children:[e("span",{children:["Used"," ",e("span",{className:"font-semibold text-ink",children:t.unit==="percent"||!l?C(t.usedFraction??0):l}),t.unit!=="percent"&&l&&p?` of ${p}`:""]}),e("span",{className:"flex items-center gap-2",children:[t.status!=="ok"&&t.status!=="unknown"&&e("span",{className:"text-[10px] font-mono uppercase px-1.5 py-0.5 rounded bg-ink/10 text-ink/70",children:t.status}),c&&e("span",{children:["Remaining ",e("span",{className:"font-semibold text-ink",children:c})]})]})]}),t.notes&&t.notes.length>0&&e("ul",{className:"text-[10px] text-ink/50 leading-relaxed space-y-0.5",children:t.notes.map((m)=>e("li",{children:m},m))})]})}function Q({providerId:t,limits:r,tracked:i,unavailable:l,notes:p}){let c=_(t,r);return e("div",{className:"space-y-2",children:[p&&p.length>0&&e("ul",{className:"text-[10px] text-ink/50 leading-relaxed space-y-0.5",children:p.map((m)=>e("li",{children:m},m))}),c.length===0?e(d,{children:[e("h4",{className:"text-[10px] font-mono font-semibold uppercase tracking-wider text-ink/40",children:"Quota windows"}),e("p",{className:"text-[11px] text-ink/50",children:!i?"No quota source for this provider: omp ships no usage adapter for it and it exposes no balance endpoint Kabmo knows.":l?"omp tracks this provider but its usage endpoint returned no data — an invalid or expired credential, an unreachable endpoint, or a plan without quota windows.":"No quota windows were reported for this provider."})]}):c.map((m)=>e("div",{className:"@container space-y-2",children:[e("h4",{className:"text-[10px] font-mono font-semibold uppercase tracking-wider text-ink/40",children:m.title}),e("div",{className:"grid grid-cols-1 @[520px]:grid-cols-2 gap-2.5",children:m.limits.map((g)=>e(Y,{limit:g},g.id))})]},m.id))]})}var ee="DeepSeek exposes no usage or quota API — only the prepaid balance (and the web console at platform.deepseek.com) is available.";function pu({summary:t}){let r=Boolean(t.kenari||t.deepseek);return e(P,{providerName:t.name,providerSlug:t.id,iconUrl:t.iconUrl,credentialSources:t.credentialSources,error:t.error,note:t.deepseek?ee:void 0,children:[t.kenari&&e(F,{report:t.kenari}),t.deepseek&&e(W,{report:t.deepseek}),!r&&(t.limits.length>0||!t.error)&&e(Q,{providerId:t.id,limits:t.limits,tracked:t.tracked,unavailable:t.limitsUnavailable,notes:t.notes})]})}function te(t){let r=t.filter((p)=>p.usedFraction!==void 0);if(r.length===0){let p=t.find((c)=>c.unit==="usd"&&c.remaining!==void 0);if(p)return`${U(p.remaining??0)} left`;return t[0]?.label}let i=r.reduce((p,c)=>(c.usedFraction??0)>(p.usedFraction??0)?c:p),l=Math.round((i.usedFraction??0)*100);return i.windowLabel?`${l}% · ${i.windowLabel}`:`${l}% used`}function Cs(t){return t.providers.map((r)=>({id:r.id,name:r.name,...r.iconUrl?{iconUrl:r.iconUrl}:{},error:r.error,hint:ne(r),limits:r.limits,tracked:r.tracked,limitsUnavailable:r.limitsUnavailable,summary:r}))}function ne(t){let r=t.kenari?.quota?.planName;if(r)return r;let i=t.deepseek?.balance?.entries[0];if(i)return`${i.currency} ${N(i.totalBalance)}`;return te(t.limits)??"No quota reported"}function vg(t){return t.error?"Error":"Connected"}function K(){let[t,r]=n([]),[i,l]=n(null),[p,c]=n(!0),m=a(()=>{c(!0),fetch("/api/settings/usage/reset").then((u)=>u.json()).then((u)=>{r(Array.isArray(u.accounts)?u.accounts:[]),l(typeof u.error==="string"?u.error:null)}).catch((u)=>{r([]),l(u instanceof Error?u.message:"Failed to load saved resets")}).finally(()=>c(!1))},[]);o(()=>{m()},[m]);let g=a(async(u)=>{try{let h=await(await fetch("/api/settings/usage/reset",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({target:u})})).json();if(h.ok)m();return{ok:Boolean(h.ok),message:h.message||"No result reported."}}catch(f){return{ok:!1,message:f instanceof Error?f.message:"Failed to spend the saved reset"}}},[m]);return{accounts:t,error:i,isLoading:p,reload:m,spend:g}}function ae({account:t,onSpend:r,spending:i}){let l=`${t.provider}/${t.credentialId}`,p=t.email??t.accountId??t.credentialId,c=t.orgName??t.orgId,m=t.availableCount??t.credits.length,g=t.redeemableCount??0,u=t.error??t.unavailableReason;return e("div",{className:"bg-paper border border-ink/15 rounded-lg p-3 shadow-xs space-y-2",children:[e("div",{className:"flex items-start justify-between gap-2",children:[e("div",{className:"min-w-0",children:[e("div",{className:"text-[11px] font-semibold text-ink truncate",children:[p,c?e("span",{className:"text-ink/50 font-normal",children:[" · ",c]}):null]}),e("div",{className:"text-[10px] text-ink/50 font-mono truncate",children:l})]}),e("span",{className:"text-[10px] text-ink/60 flex-shrink-0 whitespace-nowrap",children:g>0?`${g} of ${m} usable`:`${m} saved`})]}),t.soonestExpiry!==void 0&&e("div",{className:"text-[10px] text-ink/60",children:["Soonest expires ",ra(new Date(t.soonestExpiry).toISOString())]}),t.credits.length>0&&e("div",{className:"space-y-1",children:t.credits.map((f)=>e("div",{className:"flex items-center justify-between gap-2 text-[10px] text-ink/70",children:[e("span",{className:"truncate",children:f.title??f.program??f.id}),e("span",{className:"flex items-center gap-1.5 flex-shrink-0",children:[f.clears&&f.clears.length>0&&e("span",{className:"font-mono text-ink/50",children:f.clears.join(", ")}),f.usable===!1&&e("span",{className:"font-mono uppercase px-1.5 py-0.5 rounded bg-ink/10 text-ink/60",children:"blocked"})]})]},f.id))}),u&&e("div",{className:"text-[10px] text-ink/60 leading-snug",children:u}),e("button",{type:"button",onClick:()=>r(l),disabled:i||g===0,title:g===0?u??"Nothing to spend on this account right now.":`Spend a saved reset on ${l}`,className:"w-full rounded-md border border-ink/15 px-2 py-1 text-[11px] font-medium text-ink/80 hover:bg-ink/5 transition-colors cursor-pointer disabled:opacity-40 disabled:cursor-not-allowed",children:i?"Spending…":"Spend saved reset"})]})}function mu(){let{accounts:t,error:r,isLoading:i,reload:l,spend:p}=K(),[c,m]=n(null),[g,u]=n(null),f=(v)=>{m(v),u(null),p(v).then((M)=>{u(M),m(null)})},h=!i&&!r&&t.length===0;return e("div",{className:"space-y-2",children:[e("div",{className:"flex items-center justify-between gap-2",children:[e("div",{className:"min-w-0",children:[e("div",{className:"text-[11px] font-semibold text-ink",children:"Saved rate-limit resets"}),e("div",{className:"text-[10px] text-ink/50 leading-snug",children:"Provider-issued resets for Codex and Claude accounts. Spending one clears the window it covers."})]}),e("button",{type:"button",onClick:l,disabled:i,title:"Re-read saved resets",className:"p-1.5 bg-paper border border-ink/15 rounded-md hover:bg-ink/5 text-ink/80 transition-colors disabled:opacity-50 flex-shrink-0",children:e(D,{size:12,className:i?"animate-spin text-ink":""})})]}),r&&e("div",{className:"flex items-start gap-1.5 text-[10px] text-error leading-snug",children:[e(E,{size:12,className:"flex-shrink-0 mt-px"}),e("span",{children:r})]}),t.map((v)=>e(ae,{account:v,onSpend:f,spending:c===`${v.provider}/${v.credentialId}`},`${v.provider}/${v.credentialId}`)),h&&e("p",{className:"text-[10px] text-ink/50 leading-snug",children:"No saved resets on any account."}),g&&e("div",{className:`text-[10px] leading-snug ${g.ok?"text-ink/70":"text-error"}`,children:g.message})]})}function fu(){let[t,r]=n(null),[i,l]=n(!0),[p,c]=n(null),m=a(async(g)=>{if(!g?.silent)l(!0);c(null);try{let u=g?.force?"/api/settings/usage?refresh=1":"/api/settings/usage",f=await fetch(u);if(!f.ok)throw Error(`Usage request failed (${f.status})`);let h=await f.json();r(h)}catch(u){c(u instanceof Error?u.message:"Failed to load provider usage")}finally{if(!g?.silent)l(!1)}},[]);return o(()=>{m()},[m]),{report:t,isLoading:i,error:p,reload:m}}
2
2
  export{ra,pu,Cs,vg,mu,fu};
@@ -1 +1 @@
1
- import{d,n,o,i,u,a,e,Ug,we,S,lr,cr,E,m,en,tn,Ce,Wr,O,mt,at,J,ee}from"./index-3fw3sd10.js";import{hr}from"./index-270y5r9k.js";function K({sections:c,selected:t,onSelect:l}){let[r,f]=n(""),x=u(()=>{let p=r.trim().toLowerCase();if(!p)return c;return c.map((h)=>({...h,links:h.links.filter((s)=>s.label.toLowerCase().includes(p)||(s.path??s.target).toLowerCase().includes(p))})).filter((h)=>h.links.length>0)},[c,r]),k=c.some((p)=>p.links.length>0);return e("div",{className:"flex h-full min-h-0 w-full flex-col bg-canvas/40",children:[e("div",{className:"flex items-center gap-1.5 border-b border-ink/10 px-2 py-1.5 flex-shrink-0",children:[e(O,{size:11,className:"flex-shrink-0 text-ink/40"}),e("input",{type:"text",value:r,onChange:(p)=>f(p.currentTarget.value),placeholder:"Filter pages…",title:"Filter wiki pages",className:"w-full min-w-0 bg-transparent text-xs text-ink outline-none placeholder-ink/40"}),r&&e("button",{type:"button",onClick:()=>f(""),title:"Clear filter",className:"flex-shrink-0 text-ink/40 hover:text-ink",children:"×"})]}),e("div",{className:"flex-1 min-h-0 overflow-y-auto scrollbar-overlay-container",children:x.length===0?e("p",{className:"px-3 py-2 text-[11px] italic text-ink/40",children:k?"No page matches the filter":"This wiki has no pages"}):x.map((p,h)=>e("div",{className:"py-0.5",children:[p.title&&e("div",{className:"px-2.5 py-1 text-[10px] font-semibold uppercase tracking-wider text-ink/40",children:p.title}),p.links.map((s,g)=>{let b=s.path!==null&&s.path===t,w=`${s.path??s.target}-${g}`;if(s.path)return e("button",{type:"button",onClick:()=>l(s.path),title:s.path,"aria-current":b?"page":void 0,className:`flex w-full items-center gap-1 px-2.5 py-1 text-left text-xs transition-colors ${b?"bg-ink/8 font-medium text-ink":"text-ink/70 hover:bg-ink/5 hover:text-ink"}`,children:e("span",{className:"truncate",children:s.label})},w);if(s.url)return e("a",{href:s.url,target:"_blank",rel:"noopener noreferrer",title:s.url,className:"flex w-full items-center gap-1 px-2.5 py-1 text-left text-xs text-ink/70 hover:bg-ink/5 hover:text-ink",children:[e("span",{className:"truncate",children:s.label}),e(Ce,{size:10,className:"flex-shrink-0 text-ink/30"})]},w);return e("div",{title:`Not in this wiki: ${s.target}`,className:"flex w-full items-center px-2.5 py-1 text-left text-xs text-ink/35 line-through decoration-ink/20",children:e("span",{className:"truncate",children:s.label})},w)}),p.notes.map((s,g)=>e("p",{className:"px-2.5 py-0.5 text-[10px] leading-snug text-ink/50",children:s},`note-${g}`))]},`${p.title??"links"}-${h}`))})]})}function j({open:c,onClick:t}){return e("button",{type:"button",onClick:t,title:"Browse wiki pages","aria-label":"Browse wiki pages","aria-expanded":c,className:"absolute bottom-3 right-3 z-20 flex h-9 w-9 items-center justify-center rounded-full border border-ink/20 bg-paper text-ink/60 shadow-sm transition-all hover:bg-ink/5 hover:text-ink active:scale-95",children:e(Wr,{size:16})})}function V({open:c,sections:t,selected:l,onSelect:r,onClose:f}){if(o(()=>{if(!c)return;let x=(k)=>{if(k.key==="Escape")f()};return document.addEventListener("keydown",x),()=>document.removeEventListener("keydown",x)},[c,f]),!c)return null;return e(J,{onClose:f,maxWidthClass:"max-w-sm",zClass:"z-[70]",ariaLabel:"Wiki pages",header:e("div",{className:"flex min-w-0 items-center gap-2",children:[e(Wr,{size:15,className:"flex-shrink-0 text-ink/50"}),e("span",{className:"text-sm font-medium",children:"Wiki pages"})]}),children:e("div",{className:"flex h-[60vh] min-h-0 flex-col",children:e(K,{sections:t,selected:l,onSelect:(x)=>{r(x),f()}})})})}function re(c,t){if(!c.webUrl)return null;let r=(t.split("/").pop()??t).replace(/\.(md|markdown)$/i,"");return c.provider==="gitlab"?`${c.webUrl.replace(/\/home$/,"")}/${encodeURIComponent(t.replace(/\.(md|markdown)$/i,""))}`:`${c.webUrl}/${encodeURIComponent(r)}`}function G({repo:c,entries:t,path:l,page:r,isLoading:f,error:x,rootPath:k,repoScope:p,onNavigate:h,onBack:s}){let g=re(c,l),b=u(()=>({path:l,entries:t,root:k,repo:p}),[l,t,k,p]);return e("div",{className:"flex h-full min-h-0 w-full flex-col bg-paper",children:[e("div",{className:"flex flex-shrink-0 items-center gap-1.5 border-b border-ink/10 px-2.5 py-1.5",children:[s&&e("button",{type:"button",onClick:s,title:"Back to the page list","aria-label":"Back to the page list",className:"flex-shrink-0 rounded p-1 text-ink/60 hover:bg-ink/5 hover:text-ink @[520px]:hidden",children:e(en,{size:13})}),e("span",{className:"min-w-0 flex-1 truncate text-[11px] text-ink/50",title:l,children:l}),f&&e(m,{size:12,className:"flex-shrink-0 animate-spin text-ink/40"}),g&&e("a",{href:g,target:"_blank",rel:"noopener noreferrer",title:"Open this page on the wiki host","aria-label":"Open this page on the wiki host",className:"flex-shrink-0 rounded p-1 text-ink/60 hover:bg-ink/5 hover:text-ink",children:e(Ce,{size:13})})]}),e("div",{className:"flex-1 min-h-0 overflow-y-auto scrollbar-overlay-container",children:x?e("div",{className:"flex flex-col items-center gap-2 px-6 py-8 text-center",children:[e(E,{size:16,className:"text-error"}),e("p",{className:"text-xs text-error",children:x})]}):!r?e("div",{className:"px-6 py-8 text-center text-xs text-ink/40",children:f?"Loading page…":"No page selected"}):e("article",{className:"mx-auto max-w-4xl px-5 py-4",children:[e(ee,{content:r.content,className:"max-w-none",wikiScope:b,onWikiNavigate:h}),r.truncated&&e("p",{className:"mt-4 border-t border-ink/10 pt-2 text-[11px] text-ink/50",children:"This page is longer than the reader's budget and was cut off."})]})})]})}function B(c,t){return`${c??""}\x00${t}`}function H(c,t){let l=new URLSearchParams;if(c)l.set("root",c);if(t&&t!==".")l.set("repo",t);return l}function X(c){let{rootPath:t,repo:l,enabled:r,active:f,revisionKey:x=0}=c,k=B(t,l),[p,h]=n(null),s=i(k);s.current=k;let g=we(Ug(k),{enabled:r&&f}),{refresh:b}=g;o(()=>{h(null)},[k]);let w=a((R)=>{if(!r)return;if(!R?.force){b();return}let W=s.current,L=H(t,l);L.set("refresh","1"),fetch(`/api/wiki?${L.toString()}`).then(async(N)=>{let y=await N.json();if(!N.ok)throw Error(y?.error||`Wiki request failed (${N.status})`)}).then(()=>{if(s.current!==W)return;h(null),b()}).catch((N)=>{if(s.current!==W)return;h(N instanceof Error?N.message:"Failed to load the wiki")})},[r,t,l,b]);return o(()=>{if(x>0)b()},[x]),{data:g.data,isLoading:g.isLoading,refreshing:g.refreshing,error:p,reload:w}}function Q(c){let{rootPath:t,repo:l,path:r,enabled:f,active:x,revisionKey:k=0}=c,p=`${B(t,l)}\x00${r??""}`,[h,s]=n({scope:p,data:null}),[g,b]=n(!1),[w,R]=n(null),W=i(0);return o(()=>{if(!f||!x||!r){s({scope:p,data:null}),R(null);return}let L=++W.current;b(!0);let N=H(t,l);N.set("path",r),fetch(`/api/wiki/page?${N.toString()}`).then(async(y)=>{let _=await y.json();if(!y.ok)throw Error(_?.error||`Page request failed (${y.status})`);return _}).then((y)=>{if(W.current!==L)return;s({scope:p,data:y}),R(null)}).catch((y)=>{if(W.current!==L)return;R(y instanceof Error?y.message:"Failed to load the page")}).finally(()=>{if(W.current===L)b(!1)})},[p,t,l,r,f,x,k]),{data:h.scope===p?h.data:null,isLoading:g,error:w}}function Y(c){let t=[];for(let l of c){if(!l.isMarkdown)continue;let r=t[t.length-1],f={label:l.title,target:l.path,path:l.path,url:null};if(r&&r.title===(l.folder||"Pages")){r.links.push(f);continue}t.push({title:l.folder||"Pages",links:[f],notes:[]})}return t}var oe={"no-remote":"This repository has no origin remote, so there is no wiki to find.","unsupported-remote":"The origin remote is not a URL a wiki can be derived from.","no-wiki":"This project has no wiki (or Kabmo cannot read it).",unreachable:"The wiki could not be reached."};function qe({className:c="",enabled:t=!0,active:l=!0,rootPath:r,refreshKey:f=0,layout:x="desktop"}){let k=x==="phone",{activeRepo:p,setActiveRepo:h}=lr(r),{repos:s,scanning:g,rescan:b}=cr(r,t),w=B(r,p),[R,W]=S("wiki.selectedPage",null),[L,N]=n(!1),[y,_]=n(!1),[Z,te]=n(0),v=X({rootPath:r,repo:p,enabled:t,active:l,revisionKey:f}),M=v.data?.entries??[],z=u(()=>M.filter((C)=>C.isMarkdown),[M]),U=u(()=>v.data?.sidebar??Y(M),[v.data?.sidebar,M]),ie=u(()=>U.some((C)=>C.links.length>0),[U]),A=R&&R.scope===w?R.path:null,T=u(()=>{if(A&&z.some((F)=>F.path===A))return A;return(z.find((F)=>F.title.toLowerCase()==="home")??z[0])?.path??null},[A,z]),D=Q({rootPath:r,repo:p,path:T,enabled:t,active:l,revisionKey:Z});o(()=>{if(!T||T===A)return;W({scope:w,path:T})},[T,A,w,W]),o(()=>{N(!1),_(!1)},[w]);let q=(C)=>{if(W({scope:w,path:C}),!k)_(!0)},ne=()=>{v.reload({force:!0}),te((C)=>C+1)},P=v.data?.repo??null,I=v.data&&!P?v.data:null;if(!t)return e("div",{className:`flex h-full flex-col items-center justify-center bg-paper text-ink/40 ${c}`,children:e("span",{className:"text-xs font-mono text-muted",children:"No session selected"})});return e("div",{className:`@container flex h-full min-h-0 w-full flex-col bg-paper text-xs text-ink ${c}`,children:[e(mt,{left:e(d,{children:[e(hr,{rootPath:r,activeRepo:p,onSelectRepo:h,repos:s,scanning:g,onRefreshRepos:b}),P&&e("span",{className:"flex-shrink-0 rounded border border-ink/15 bg-ink/5 px-1.5 py-0.5 font-mono text-[10px] uppercase tracking-wider text-ink/60",title:`${P.host}/${P.slug} · ${P.revision.slice(0,8)}`,children:P.provider})]}),right:e(d,{children:[P?.webUrl&&e("a",{href:P.webUrl,target:"_blank",rel:"noopener noreferrer",title:"Open the wiki on its host","aria-label":"Open the wiki on its host",className:"rounded p-1 text-ink/60 hover:bg-ink/5 hover:text-ink",children:e(Ce,{size:13})}),e(at,{label:"Re-fetch the wiki",onClick:ne,busy:v.isLoading||v.refreshing,disabled:v.isLoading})]})}),v.error&&!v.data?e("div",{className:"flex flex-1 flex-col items-center justify-center gap-2 px-6 text-center",children:[e(E,{size:16,className:"text-error"}),e("p",{className:"text-error",children:v.error}),e("button",{type:"button",onClick:()=>v.reload(),className:"text-[11px] font-semibold text-ink/70 underline underline-offset-2 hover:text-ink",children:"Try again"})]}):!v.data?e("div",{className:"flex flex-1 items-center justify-center gap-2 text-ink/40",children:[e(m,{size:14,className:"animate-spin"}),e("span",{children:"Reading the wiki…"})]}):I?e("div",{className:"flex flex-1 flex-col items-center justify-center gap-2 px-6 text-center",children:[e(tn,{size:18,className:"text-ink/30"}),e("p",{className:"max-w-sm text-[11px] leading-relaxed text-ink/60",children:oe[I.reason??"no-wiki"]}),I.detail&&e("p",{className:"max-w-sm break-words font-mono text-[10px] text-ink/40",children:I.detail})]}):e("div",{className:"flex min-h-0 flex-1 flex-col @[520px]:flex-row-reverse",children:[e("div",{className:`${k?"hidden":y?"hidden @[520px]:flex":"flex"} min-h-0 w-full flex-col @[520px]:w-52 @[520px]:flex-shrink-0 @[520px]:border-l @[520px]:border-ink/10`,children:e(K,{sections:U,selected:T,onSelect:q})}),e("div",{className:`relative min-w-0 min-h-0 flex-1 ${k?"flex":y?"flex":"hidden @[520px]:flex"} flex-col`,children:[P&&T?e(G,{repo:P,entries:M,path:T,page:D.data,isLoading:D.isLoading,error:D.error,rootPath:r,repoScope:p,onNavigate:q,onBack:k?void 0:()=>_(!1)}):e("div",{className:"flex h-full items-center justify-center px-6 text-center text-[11px] text-ink/40",children:"This wiki has no markdown pages."}),k&&ie&&e(j,{open:L,onClick:()=>N(!0)}),e(V,{open:L,sections:U,selected:T,onSelect:q,onClose:()=>N(!1)})]})]})]})}export{qe as WikiPanel};
1
+ import{d,n,o,i,u,a,e,Ug,we,S,lr,cr,E,m,en,tn,Ce,Wr,O,mt,at,J,ee}from"./index-4c2zcvem.js";import{hr}from"./index-fjqp03xe.js";function K({sections:c,selected:t,onSelect:l}){let[r,f]=n(""),x=u(()=>{let p=r.trim().toLowerCase();if(!p)return c;return c.map((h)=>({...h,links:h.links.filter((s)=>s.label.toLowerCase().includes(p)||(s.path??s.target).toLowerCase().includes(p))})).filter((h)=>h.links.length>0)},[c,r]),k=c.some((p)=>p.links.length>0);return e("div",{className:"flex h-full min-h-0 w-full flex-col bg-canvas/40",children:[e("div",{className:"flex items-center gap-1.5 border-b border-ink/10 px-2 py-1.5 flex-shrink-0",children:[e(O,{size:11,className:"flex-shrink-0 text-ink/40"}),e("input",{type:"text",value:r,onChange:(p)=>f(p.currentTarget.value),placeholder:"Filter pages…",title:"Filter wiki pages",className:"w-full min-w-0 bg-transparent text-xs text-ink outline-none placeholder-ink/40"}),r&&e("button",{type:"button",onClick:()=>f(""),title:"Clear filter",className:"flex-shrink-0 text-ink/40 hover:text-ink",children:"×"})]}),e("div",{className:"flex-1 min-h-0 overflow-y-auto scrollbar-overlay-container",children:x.length===0?e("p",{className:"px-3 py-2 text-[11px] italic text-ink/40",children:k?"No page matches the filter":"This wiki has no pages"}):x.map((p,h)=>e("div",{className:"py-0.5",children:[p.title&&e("div",{className:"px-2.5 py-1 text-[10px] font-semibold uppercase tracking-wider text-ink/40",children:p.title}),p.links.map((s,g)=>{let b=s.path!==null&&s.path===t,w=`${s.path??s.target}-${g}`;if(s.path)return e("button",{type:"button",onClick:()=>l(s.path),title:s.path,"aria-current":b?"page":void 0,className:`flex w-full items-center gap-1 px-2.5 py-1 text-left text-xs transition-colors ${b?"bg-ink/8 font-medium text-ink":"text-ink/70 hover:bg-ink/5 hover:text-ink"}`,children:e("span",{className:"truncate",children:s.label})},w);if(s.url)return e("a",{href:s.url,target:"_blank",rel:"noopener noreferrer",title:s.url,className:"flex w-full items-center gap-1 px-2.5 py-1 text-left text-xs text-ink/70 hover:bg-ink/5 hover:text-ink",children:[e("span",{className:"truncate",children:s.label}),e(Ce,{size:10,className:"flex-shrink-0 text-ink/30"})]},w);return e("div",{title:`Not in this wiki: ${s.target}`,className:"flex w-full items-center px-2.5 py-1 text-left text-xs text-ink/35 line-through decoration-ink/20",children:e("span",{className:"truncate",children:s.label})},w)}),p.notes.map((s,g)=>e("p",{className:"px-2.5 py-0.5 text-[10px] leading-snug text-ink/50",children:s},`note-${g}`))]},`${p.title??"links"}-${h}`))})]})}function j({open:c,onClick:t}){return e("button",{type:"button",onClick:t,title:"Browse wiki pages","aria-label":"Browse wiki pages","aria-expanded":c,className:"absolute bottom-3 right-3 z-20 flex h-9 w-9 items-center justify-center rounded-full border border-ink/20 bg-paper text-ink/60 shadow-sm transition-all hover:bg-ink/5 hover:text-ink active:scale-95",children:e(Wr,{size:16})})}function V({open:c,sections:t,selected:l,onSelect:r,onClose:f}){if(o(()=>{if(!c)return;let x=(k)=>{if(k.key==="Escape")f()};return document.addEventListener("keydown",x),()=>document.removeEventListener("keydown",x)},[c,f]),!c)return null;return e(J,{onClose:f,maxWidthClass:"max-w-sm",zClass:"z-[70]",ariaLabel:"Wiki pages",header:e("div",{className:"flex min-w-0 items-center gap-2",children:[e(Wr,{size:15,className:"flex-shrink-0 text-ink/50"}),e("span",{className:"text-sm font-medium",children:"Wiki pages"})]}),children:e("div",{className:"flex h-[60vh] min-h-0 flex-col",children:e(K,{sections:t,selected:l,onSelect:(x)=>{r(x),f()}})})})}function re(c,t){if(!c.webUrl)return null;let r=(t.split("/").pop()??t).replace(/\.(md|markdown)$/i,"");return c.provider==="gitlab"?`${c.webUrl.replace(/\/home$/,"")}/${encodeURIComponent(t.replace(/\.(md|markdown)$/i,""))}`:`${c.webUrl}/${encodeURIComponent(r)}`}function G({repo:c,entries:t,path:l,page:r,isLoading:f,error:x,rootPath:k,repoScope:p,onNavigate:h,onBack:s}){let g=re(c,l),b=u(()=>({path:l,entries:t,root:k,repo:p}),[l,t,k,p]);return e("div",{className:"flex h-full min-h-0 w-full flex-col bg-paper",children:[e("div",{className:"flex flex-shrink-0 items-center gap-1.5 border-b border-ink/10 px-2.5 py-1.5",children:[s&&e("button",{type:"button",onClick:s,title:"Back to the page list","aria-label":"Back to the page list",className:"flex-shrink-0 rounded p-1 text-ink/60 hover:bg-ink/5 hover:text-ink @[520px]:hidden",children:e(en,{size:13})}),e("span",{className:"min-w-0 flex-1 truncate text-[11px] text-ink/50",title:l,children:l}),f&&e(m,{size:12,className:"flex-shrink-0 animate-spin text-ink/40"}),g&&e("a",{href:g,target:"_blank",rel:"noopener noreferrer",title:"Open this page on the wiki host","aria-label":"Open this page on the wiki host",className:"flex-shrink-0 rounded p-1 text-ink/60 hover:bg-ink/5 hover:text-ink",children:e(Ce,{size:13})})]}),e("div",{className:"flex-1 min-h-0 overflow-y-auto scrollbar-overlay-container",children:x?e("div",{className:"flex flex-col items-center gap-2 px-6 py-8 text-center",children:[e(E,{size:16,className:"text-error"}),e("p",{className:"text-xs text-error",children:x})]}):!r?e("div",{className:"px-6 py-8 text-center text-xs text-ink/40",children:f?"Loading page…":"No page selected"}):e("article",{className:"mx-auto max-w-4xl px-5 py-4",children:[e(ee,{content:r.content,className:"max-w-none",wikiScope:b,onWikiNavigate:h}),r.truncated&&e("p",{className:"mt-4 border-t border-ink/10 pt-2 text-[11px] text-ink/50",children:"This page is longer than the reader's budget and was cut off."})]})})]})}function B(c,t){return`${c??""}\x00${t}`}function H(c,t){let l=new URLSearchParams;if(c)l.set("root",c);if(t&&t!==".")l.set("repo",t);return l}function X(c){let{rootPath:t,repo:l,enabled:r,active:f,revisionKey:x=0}=c,k=B(t,l),[p,h]=n(null),s=i(k);s.current=k;let g=we(Ug(k),{enabled:r&&f}),{refresh:b}=g;o(()=>{h(null)},[k]);let w=a((R)=>{if(!r)return;if(!R?.force){b();return}let W=s.current,L=H(t,l);L.set("refresh","1"),fetch(`/api/wiki?${L.toString()}`).then(async(N)=>{let y=await N.json();if(!N.ok)throw Error(y?.error||`Wiki request failed (${N.status})`)}).then(()=>{if(s.current!==W)return;h(null),b()}).catch((N)=>{if(s.current!==W)return;h(N instanceof Error?N.message:"Failed to load the wiki")})},[r,t,l,b]);return o(()=>{if(x>0)b()},[x]),{data:g.data,isLoading:g.isLoading,refreshing:g.refreshing,error:p,reload:w}}function Q(c){let{rootPath:t,repo:l,path:r,enabled:f,active:x,revisionKey:k=0}=c,p=`${B(t,l)}\x00${r??""}`,[h,s]=n({scope:p,data:null}),[g,b]=n(!1),[w,R]=n(null),W=i(0);return o(()=>{if(!f||!x||!r){s({scope:p,data:null}),R(null);return}let L=++W.current;b(!0);let N=H(t,l);N.set("path",r),fetch(`/api/wiki/page?${N.toString()}`).then(async(y)=>{let _=await y.json();if(!y.ok)throw Error(_?.error||`Page request failed (${y.status})`);return _}).then((y)=>{if(W.current!==L)return;s({scope:p,data:y}),R(null)}).catch((y)=>{if(W.current!==L)return;R(y instanceof Error?y.message:"Failed to load the page")}).finally(()=>{if(W.current===L)b(!1)})},[p,t,l,r,f,x,k]),{data:h.scope===p?h.data:null,isLoading:g,error:w}}function Y(c){let t=[];for(let l of c){if(!l.isMarkdown)continue;let r=t[t.length-1],f={label:l.title,target:l.path,path:l.path,url:null};if(r&&r.title===(l.folder||"Pages")){r.links.push(f);continue}t.push({title:l.folder||"Pages",links:[f],notes:[]})}return t}var oe={"no-remote":"This repository has no origin remote, so there is no wiki to find.","unsupported-remote":"The origin remote is not a URL a wiki can be derived from.","no-wiki":"This project has no wiki (or Kabmo cannot read it).",unreachable:"The wiki could not be reached."};function qe({className:c="",enabled:t=!0,active:l=!0,rootPath:r,refreshKey:f=0,layout:x="desktop"}){let k=x==="phone",{activeRepo:p,setActiveRepo:h}=lr(r),{repos:s,scanning:g,rescan:b}=cr(r,t),w=B(r,p),[R,W]=S("wiki.selectedPage",null),[L,N]=n(!1),[y,_]=n(!1),[Z,te]=n(0),v=X({rootPath:r,repo:p,enabled:t,active:l,revisionKey:f}),M=v.data?.entries??[],z=u(()=>M.filter((C)=>C.isMarkdown),[M]),U=u(()=>v.data?.sidebar??Y(M),[v.data?.sidebar,M]),ie=u(()=>U.some((C)=>C.links.length>0),[U]),A=R&&R.scope===w?R.path:null,T=u(()=>{if(A&&z.some((F)=>F.path===A))return A;return(z.find((F)=>F.title.toLowerCase()==="home")??z[0])?.path??null},[A,z]),D=Q({rootPath:r,repo:p,path:T,enabled:t,active:l,revisionKey:Z});o(()=>{if(!T||T===A)return;W({scope:w,path:T})},[T,A,w,W]),o(()=>{N(!1),_(!1)},[w]);let q=(C)=>{if(W({scope:w,path:C}),!k)_(!0)},ne=()=>{v.reload({force:!0}),te((C)=>C+1)},P=v.data?.repo??null,I=v.data&&!P?v.data:null;if(!t)return e("div",{className:`flex h-full flex-col items-center justify-center bg-paper text-ink/40 ${c}`,children:e("span",{className:"text-xs font-mono text-muted",children:"No session selected"})});return e("div",{className:`@container flex h-full min-h-0 w-full flex-col bg-paper text-xs text-ink ${c}`,children:[e(mt,{left:e(d,{children:[e(hr,{rootPath:r,activeRepo:p,onSelectRepo:h,repos:s,scanning:g,onRefreshRepos:b}),P&&e("span",{className:"flex-shrink-0 rounded border border-ink/15 bg-ink/5 px-1.5 py-0.5 font-mono text-[10px] uppercase tracking-wider text-ink/60",title:`${P.host}/${P.slug} · ${P.revision.slice(0,8)}`,children:P.provider})]}),right:e(d,{children:[P?.webUrl&&e("a",{href:P.webUrl,target:"_blank",rel:"noopener noreferrer",title:"Open the wiki on its host","aria-label":"Open the wiki on its host",className:"rounded p-1 text-ink/60 hover:bg-ink/5 hover:text-ink",children:e(Ce,{size:13})}),e(at,{label:"Re-fetch the wiki",onClick:ne,busy:v.isLoading||v.refreshing,disabled:v.isLoading})]})}),v.error&&!v.data?e("div",{className:"flex flex-1 flex-col items-center justify-center gap-2 px-6 text-center",children:[e(E,{size:16,className:"text-error"}),e("p",{className:"text-error",children:v.error}),e("button",{type:"button",onClick:()=>v.reload(),className:"text-[11px] font-semibold text-ink/70 underline underline-offset-2 hover:text-ink",children:"Try again"})]}):!v.data?e("div",{className:"flex flex-1 items-center justify-center gap-2 text-ink/40",children:[e(m,{size:14,className:"animate-spin"}),e("span",{children:"Reading the wiki…"})]}):I?e("div",{className:"flex flex-1 flex-col items-center justify-center gap-2 px-6 text-center",children:[e(tn,{size:18,className:"text-ink/30"}),e("p",{className:"max-w-sm text-[11px] leading-relaxed text-ink/60",children:oe[I.reason??"no-wiki"]}),I.detail&&e("p",{className:"max-w-sm break-words font-mono text-[10px] text-ink/40",children:I.detail})]}):e("div",{className:"flex min-h-0 flex-1 flex-col @[520px]:flex-row-reverse",children:[e("div",{className:`${k?"hidden":y?"hidden @[520px]:flex":"flex"} min-h-0 w-full flex-col @[520px]:w-52 @[520px]:flex-shrink-0 @[520px]:border-l @[520px]:border-ink/10`,children:e(K,{sections:U,selected:T,onSelect:q})}),e("div",{className:`relative min-w-0 min-h-0 flex-1 ${k?"flex":y?"flex":"hidden @[520px]:flex"} flex-col`,children:[P&&T?e(G,{repo:P,entries:M,path:T,page:D.data,isLoading:D.isLoading,error:D.error,rootPath:r,repoScope:p,onNavigate:q,onBack:k?void 0:()=>_(!1)}):e("div",{className:"flex h-full items-center justify-center px-6 text-center text-[11px] text-ink/40",children:"This wiki has no markdown pages."}),k&&ie&&e(j,{open:L,onClick:()=>N(!0)}),e(V,{open:L,sections:U,selected:T,onSelect:q,onClose:()=>N(!1)})]})]})]})}export{qe as WikiPanel};
@@ -1 +1 @@
1
- import{d,n,o,W,i,u,a,Jt,e,S,lr,cr,Be,Li,f,Oi,$i,zi,O,Gi,b,mt,pe,ai,$s,it,st,ft,$u,Vl}from"./index-3fw3sd10.js";import{hr}from"./index-270y5r9k.js";var fe=2000,D=new Map;function me(s){if(s.length===0)return"";let r="";for(let t of s)r+=`${t.start}-${t.end},`;return r}function Z(s,r,t){let h=ai(r),c=`${r}\x00${me(t)}\x00${s}`;if(h){let m=D.get(c);if(m!==void 0)return D.delete(c),D.set(c,m),m}let l=$s(s,r,{marks:t});if(!h)return l;if(D.set(c,l),D.size>fe){let m=D.keys().next();if(!m.done)D.delete(m.value)}return l}function ee(s,r,t){let h=[],c=0;for(let l of r){if(l.start<c||l.end<=l.start||l.end>s.length)continue;if(l.start>c)h.push({text:s.slice(c,l.start),kind:"plain"});if(h.push({text:s.slice(l.start,l.end),kind:"removed"}),t)h.push({text:t,kind:"inserted"});c=l.end}if(c<s.length)h.push({text:s.slice(c),kind:"plain"});return h}function ge({file:s,result:r,replacement:t,showReplacePreview:h,onOpen:c}){let l=r.ranges??[],m=h&&t.length>0;return e("button",{type:"button",onClick:()=>c(r),className:"flex w-full items-start gap-2 rounded px-1 py-0.5 text-left hover:bg-ink/5 cursor-pointer",title:`Open ${s}:${r.line}`,children:[e("span",{className:"w-6 flex-shrink-0 text-right font-mono text-ink/40",children:r.line}),m?e("span",{className:"min-w-0 truncate font-mono text-ink",children:ee(r.content,l,t).map((R,p)=>R.kind==="plain"?e("span",{children:R.text},p):R.kind==="removed"?e("del",{className:"search-replace-old",children:R.text},p):e("ins",{className:"search-replace-new",children:R.text},p))}):e("span",{className:"min-w-0 truncate font-mono text-ink",dangerouslySetInnerHTML:{__html:Z(r.content,ft(s),l)}})]})}var te=Jt(ge);var Y={header:4,hit:4,group:16},re={headerBox:16,hitBox:20},ne=5000;function se(s){let r=[],t=null;for(let h of s){if(!t||t.file!==h.file)t={file:h.file,results:[]},r.push(t);t.results.push(h)}return r}function oe(s){let r=[];for(let t of s){r.push({kind:"group",file:t.file,count:t.results.length});for(let h=0;h<t.results.length;h++)r.push({kind:"hit",file:t.file,result:t.results[h],last:h===t.results.length-1})}return r}function xe(s,r){if(s.kind==="group")return r.headerBox+Y.header;return r.hitBox+(s.last?Y.group:Y.hit)}function ie(s,r){let t=Array(s.length),h=Array(s.length),c=0;for(let l=0;l<s.length;l++){let m=xe(s[l],r);t[l]=c,h[l]=m,c+=m}return{offsets:t,heights:h,total:c}}function ae(s,r,t,h,c=240){if(s.length===0)return{start:0,end:0};let l=Math.max(0,t),m=l-c,R=l+h+c,p=0,v=s.length-1;while(p<v){let x=p+v>>1;if(s[x]+r[x]>m)v=x;else p=x+1}let w=p;p=w,v=s.length;while(p<v){let x=p+v>>1;if(s[x]>=R)v=x;else p=x+1}return{start:w,end:p}}var be=8,Se=8;function le({groups:s,replacement:r,showReplacePreview:t,onOpen:h,onReplaceFile:c,replaceBusy:l}){let m=i(null),R=i(null),p=u(()=>oe(s),[s]),[v,w]=n(re),x=u(()=>ie(p,v),[p,v]),[M,E]=n(()=>({start:0,end:Math.min(p.length,60)})),F=a((g)=>{m.current=g},[]),k=a(()=>{let g=m.current;if(!g)return;let N=ae(x.offsets,x.heights,g.scrollTop,g.clientHeight);E((I)=>I.start===N.start&&I.end===N.end?I:N)},[x]),y=a(()=>{k()},[k]);W(()=>{let g=R.current;if(!g)return;let N=g.querySelector("[data-search-header] > div")?.offsetHeight??0,I=g.querySelector("[data-search-hit] > button")?.offsetHeight??0;if(N>0&&N!==v.headerBox)w((C)=>({...C,headerBox:N}));if(I>0&&I!==v.hitBox)w((C)=>({...C,hitBox:I}))},[M,v,p]),W(()=>{k()},[k]),W(()=>{let g=m.current;if(!g||typeof ResizeObserver>"u")return;let N=new ResizeObserver(()=>k());return N.observe(g),()=>N.disconnect()},[k]);let P=p.length===0?0:Math.min(M.start,p.length-1),L=Math.min(M.end,p.length),B=p.slice(P,L),A=L<p.length?x.total-x.offsets[L]:0;return e("div",{ref:F,onScroll:y,className:"flex-1 scrollbar-overlay-container px-3 text-xs",style:{overflowAnchor:"none"},children:[e("div",{style:{height:be+(x.offsets[P]??0)},"aria-hidden":"true"}),e("div",{ref:R,children:B.map((g,N)=>{let I=P+N,C=x.heights[I];if(g.kind==="group")return e("div",{"data-search-header":"",style:{height:C},children:e("div",{className:"font-semibold text-ink/80 flex items-center justify-between group",children:[e("div",{className:"flex items-center min-w-0",children:[e(it,{name:g.file,size:12,className:"mr-1.5 flex-shrink-0"}),e("span",{className:"truncate",children:g.file}),e("span",{className:"ml-2 bg-ink/10 text-[10px] px-1.5 py-0.5 rounded-full flex-shrink-0",children:g.count})]}),e("button",{onClick:()=>c(g.file),disabled:l,className:"touch-visible opacity-0 group-hover:opacity-100 p-1 text-ink/40 hover:text-ink rounded hover:bg-ink/5 disabled:opacity-50 flex-shrink-0",title:"Replace in this file",children:e(zi,{size:12})})]})},`group:${g.file}`);return e("div",{"data-search-hit":"",style:{height:C},children:e(te,{file:g.file,result:g.result,replacement:r,showReplacePreview:t,onOpen:h})},`hit:${g.file}:${g.result.line}:${I}`)})}),e("div",{style:{height:Se+A},"aria-hidden":"true"})]})}function ce({className:s,query:r,setQuery:t,replaceQuery:h,setReplaceQuery:c,matchCase:l,setMatchCase:m,wholeWord:R,setWholeWord:p,useRegex:v,setUseRegex:w,includeFiles:x,setIncludeFiles:M,showIncludeField:E,setShowIncludeField:F,showMenu:k,setShowMenu:y,menuRef:P,rootPath:L,activeRepo:B,setActiveRepo:A,repos:g,reposScanning:N,rescanRepos:I,results:C,isSearching:G,truncated:H,error:z,onOpenFile:J,handleReplace:q,replaceBusy:Q}){let X=u(()=>se(C),[C]),_=i(null),K=i(null),U=a(()=>{t(""),_.current?.focus()},[t]),j=a(()=>{c(""),K.current?.focus()},[c]),V=u(()=>({matchCase:l,wholeWord:R,isRegex:v,inSelection:!1}),[l,R,v]),he=a((T)=>{$u({path:T.file,line:Number(T.line),query:r,options:V}),J?.({path:T.file,name:T.file.split("/").pop()||T.file,root:L,repo:B})},[r,V,L,B,J]),de=a((T)=>q(T),[q]);return e("div",{className:`flex flex-col h-full bg-paper ${s}`,children:[e(mt,{left:e(d,{children:[e("h2",{className:"text-xs font-semibold text-ink uppercase tracking-wider",children:"Search"}),e(hr,{rootPath:L,activeRepo:B,onSelectRepo:A,repos:g,scanning:N,onRefreshRepos:I})]}),right:e("div",{className:"relative",ref:P,children:[e("button",{onClick:()=>y(!k),className:`p-1 rounded hover:bg-ink/5 transition-colors ${k||E?"text-ink":"text-ink/40"}`,title:"Search Options",children:e(Be,{size:14})}),k&&e("div",{className:"glass-popover absolute right-0 top-full mt-1 w-48 bg-paper border border-ink/10 rounded shadow-lg z-10 py-1",children:e("button",{onClick:()=>{if(F(!E),E)M("");y(!1)},className:"w-full px-3 py-1.5 text-left text-xs text-ink hover:bg-ink/5 flex items-center justify-between",children:[e("span",{children:"Files to include"}),E&&e(f,{size:12,className:"text-ink/60"})]})})]})}),e("div",{className:"p-3 flex flex-col gap-2.5 border-b border-ink/10",children:[e("div",{className:"relative",children:e("div",{className:"flex items-center border border-ink/20 rounded bg-paper focus-within:border-ink/40 focus-within:ring-1 focus-within:ring-ink/10 transition-all",children:[e(O,{size:14,className:"ml-2 text-ink/40 flex-shrink-0"}),e("input",{ref:_,type:"text",placeholder:"Search",value:r,onChange:(T)=>t(T.currentTarget.value),className:"w-full bg-transparent border-none text-xs px-2 py-1.5 focus:outline-none text-ink placeholder-ink/35 min-w-0"}),r&&e("button",{type:"button",onClick:U,title:"Clear search","aria-label":"Clear search",className:"p-1 mr-0.5 rounded text-ink/40 hover:text-ink hover:bg-ink/5 flex-shrink-0",children:e(b,{size:12})}),e("div",{className:"flex items-center space-x-0.5 pr-1 text-ink/40 flex-shrink-0",children:[e("button",{onClick:()=>m(!l),className:`p-1 rounded hover:text-ink ${l?"bg-ink/10 text-ink":"hover:bg-ink/5"}`,title:"Match Case",children:e(Li,{size:14})}),e("button",{onClick:()=>p(!R),className:`p-1 rounded hover:text-ink ${R?"bg-ink/10 text-ink":"hover:bg-ink/5"}`,title:"Match Whole Word",children:e(Gi,{size:14})}),e("button",{onClick:()=>w(!v),className:`p-1 rounded hover:text-ink ${v?"bg-ink/10 text-ink":"hover:bg-ink/5"}`,title:"Use Regular Expression",children:e(Oi,{size:14})})]})]})}),e("div",{className:"relative flex items-center space-x-1",children:[e("div",{className:"flex flex-1 min-w-0 items-center border border-ink/20 rounded bg-paper focus-within:border-ink/40 focus-within:ring-1 focus-within:ring-ink/10 transition-all",children:[e("input",{ref:K,type:"text",placeholder:"Replace",value:h,onChange:(T)=>c(T.currentTarget.value),className:"flex-1 min-w-0 bg-transparent border-none text-xs px-2 py-1.5 focus:outline-none text-ink placeholder-ink/35"}),h&&e("button",{type:"button",onClick:j,title:"Clear replace","aria-label":"Clear replace",className:"p-1 mr-0.5 rounded text-ink/40 hover:text-ink hover:bg-ink/5 flex-shrink-0",children:e(b,{size:12})})]}),e("button",{onClick:()=>q(),disabled:C.length===0||Q,className:"p-1.5 rounded border border-ink/20 text-ink/60 hover:text-ink hover:bg-ink/5 disabled:opacity-50 disabled:cursor-not-allowed bg-paper",title:"Replace All",children:e($i,{size:14})})]}),E&&e("div",{className:"relative",children:e("input",{type:"text",value:x,onChange:(T)=>M(T.currentTarget.value),placeholder:"Files to include (e.g. *.js, src/*)",className:"w-full bg-paper border border-ink/20 rounded text-xs px-2 py-1.5 focus:outline-none focus:border-ink/40 focus:ring-1 focus:ring-ink/10 transition-all text-ink placeholder-ink/40"})})]}),z&&C.length===0?e("div",{className:"flex-1 px-3 py-3",role:"alert",children:e("div",{className:"rounded border border-error/30 bg-error/5 px-2.5 py-2",children:[e("div",{className:"text-[11px] font-semibold text-error",children:"Search failed"}),e("div",{className:"mt-1 whitespace-pre-wrap break-words font-mono text-[10.5px] text-ink/70",children:z}),v&&e("div",{className:"mt-1 text-[10.5px] text-ink/50",children:["Regex is on — escape metacharacters such as ",e("code",{className:"font-mono",children:"( ) [ ] * ? +"})," or turn it off to search literally."]})]})}):G&&C.length===0?e("div",{className:"flex-1 text-ink/40 italic text-center py-4",children:"Searching..."}):r.trim().length<=2?e("div",{className:"flex-1 text-ink/40 italic text-center py-4",children:"Type at least 3 characters to search."}):C.length===0?e("div",{className:"flex-1 text-ink/40 italic text-center py-4",children:"No results found."}):e(d,{children:[z&&e("div",{className:"px-3 pt-2 text-[10.5px] text-error",role:"alert",children:["Search failed: ",e("span",{className:"font-mono",children:z})]}),G&&e("div",{className:"px-3 pt-2 text-ink/40 italic",children:"Searching…"}),H&&e("div",{className:"px-3 pt-2 text-ink/50 italic",children:["Showing the first ",ne," matches — refine the query to see the rest."]}),e(le,{groups:X,replacement:h,showReplacePreview:h.length>0,onOpen:he,onReplaceFile:de,replaceBusy:Q})]})]})}function ue(s){let[r,t]=n({scope:s,results:[],truncated:!1,error:null}),[h,c]=n(!1),l=i(null),m=i(!0),R=i(s);R.current=s,o(()=>(m.current=!0,()=>{m.current=!1,l.current?.abort(),l.current=null}),[]);let p=a(async(v)=>{l.current?.abort();let w=new AbortController;l.current=w;let x=R.current;t({scope:x,results:[],truncated:!1,error:null}),c(!0);try{let M=await fetch("/api/fs/search",{method:"POST",headers:{"content-type":"application/x-www-form-urlencoded"},body:new URLSearchParams(v),signal:w.signal});await Vl(M,(E,F)=>{if(R.current!==x)return;if(E==="done"){let k=!1;try{k=JSON.parse(F)?.truncated===!0}catch{}t((y)=>y.scope===x?{...y,truncated:k}:y);return}if(E==="error"){let k="Search failed";try{k=JSON.parse(F)?.error||k}catch{}t((y)=>y.scope===x?{...y,error:k}:y);return}if(E!=="matches")return;try{let k=JSON.parse(F);if(Array.isArray(k))t((y)=>y.scope===x?{...y,results:[...y.results,...k]}:y)}catch{}},w.signal)}catch{}finally{if(m.current&&l.current===w)l.current=null,c(!1)}},[]);return{results:r.scope===s?r.results:[],isSearching:h&&r.scope===s,truncated:r.scope===s&&r.truncated,error:r.scope===s?r.error:null,start:p}}function ot({className:s="",enabled:r=!0,rootPath:t,onOpenFile:h}){let[c,l]=S("search.query",""),[m,R]=S("search.replaceQuery",""),[p,v]=S("search.matchCase",!1),[w,x]=S("search.wholeWord",!1),[M,E]=S("search.useRegex",!1),[F,k]=S("search.includeFiles",""),[y,P]=n(!1),[L,B]=S("search.showIncludeField",!1),{activeRepo:A,setActiveRepo:g}=lr(t),{repos:N,scanning:I,rescan:C}=cr(t,r),G=i(null),H=st(),{results:z,isSearching:J,truncated:q,error:Q,start:X}=ue(`${t??""}\x00${A}`);pe(G,()=>P(!1));let _=a(()=>{if(!r)return;if(c.trim().length>2)return X({q:c,matchCase:String(p),wholeWord:String(w),useRegex:String(M),includeFiles:L?F:"",...t?{root:t}:{},...A!=="."?{repo:A}:{}})},[r,c,p,w,M,L,F,t,A,X]);o(()=>{let U=setTimeout(()=>{_()},300);return()=>clearTimeout(U)},[_]);let K=a((U)=>{if(!c)return;let j=U?[U]:Array.from(new Set(z.map((V)=>V.file)));if(j.length===0)return;H.submit({q:c,replaceWith:m,matchCase:String(p),wholeWord:String(w),useRegex:String(M),files:JSON.stringify(j),...t?{root:t}:{},...A!=="."?{repo:A}:{}},{method:"POST",action:"/api/fs/replace"})},[c,m,p,w,M,z,t,A,H]);if(o(()=>{if(H.state==="idle"&&H.data?.success)_()},[H.state,H.data,_]),!r)return e("div",{className:`flex flex-col h-full bg-paper items-center justify-center text-ink/40 ${s}`,children:e("span",{className:"text-xs font-mono text-muted",children:"No session selected"})});return e(ce,{className:s,query:c,setQuery:l,replaceQuery:m,setReplaceQuery:R,matchCase:p,setMatchCase:v,wholeWord:w,setWholeWord:x,useRegex:M,setUseRegex:E,includeFiles:F,setIncludeFiles:k,showIncludeField:L,setShowIncludeField:B,showMenu:y,setShowMenu:P,menuRef:G,rootPath:t,activeRepo:A,setActiveRepo:g,repos:N,reposScanning:I,rescanRepos:C,results:z,isSearching:J,truncated:q,error:Q,onOpenFile:h,handleReplace:K,replaceBusy:H.state!=="idle"})}export{ot as SearchPanel};
1
+ import{d,n,o,W,i,u,a,Jt,e,S,lr,cr,Be,Li,f,Oi,$i,zi,O,Gi,b,mt,pe,ai,$s,it,st,ft,$u,Vl}from"./index-4c2zcvem.js";import{hr}from"./index-fjqp03xe.js";var fe=2000,D=new Map;function me(s){if(s.length===0)return"";let r="";for(let t of s)r+=`${t.start}-${t.end},`;return r}function Z(s,r,t){let h=ai(r),c=`${r}\x00${me(t)}\x00${s}`;if(h){let m=D.get(c);if(m!==void 0)return D.delete(c),D.set(c,m),m}let l=$s(s,r,{marks:t});if(!h)return l;if(D.set(c,l),D.size>fe){let m=D.keys().next();if(!m.done)D.delete(m.value)}return l}function ee(s,r,t){let h=[],c=0;for(let l of r){if(l.start<c||l.end<=l.start||l.end>s.length)continue;if(l.start>c)h.push({text:s.slice(c,l.start),kind:"plain"});if(h.push({text:s.slice(l.start,l.end),kind:"removed"}),t)h.push({text:t,kind:"inserted"});c=l.end}if(c<s.length)h.push({text:s.slice(c),kind:"plain"});return h}function ge({file:s,result:r,replacement:t,showReplacePreview:h,onOpen:c}){let l=r.ranges??[],m=h&&t.length>0;return e("button",{type:"button",onClick:()=>c(r),className:"flex w-full items-start gap-2 rounded px-1 py-0.5 text-left hover:bg-ink/5 cursor-pointer",title:`Open ${s}:${r.line}`,children:[e("span",{className:"w-6 flex-shrink-0 text-right font-mono text-ink/40",children:r.line}),m?e("span",{className:"min-w-0 truncate font-mono text-ink",children:ee(r.content,l,t).map((R,p)=>R.kind==="plain"?e("span",{children:R.text},p):R.kind==="removed"?e("del",{className:"search-replace-old",children:R.text},p):e("ins",{className:"search-replace-new",children:R.text},p))}):e("span",{className:"min-w-0 truncate font-mono text-ink",dangerouslySetInnerHTML:{__html:Z(r.content,ft(s),l)}})]})}var te=Jt(ge);var Y={header:4,hit:4,group:16},re={headerBox:16,hitBox:20},ne=5000;function se(s){let r=[],t=null;for(let h of s){if(!t||t.file!==h.file)t={file:h.file,results:[]},r.push(t);t.results.push(h)}return r}function oe(s){let r=[];for(let t of s){r.push({kind:"group",file:t.file,count:t.results.length});for(let h=0;h<t.results.length;h++)r.push({kind:"hit",file:t.file,result:t.results[h],last:h===t.results.length-1})}return r}function xe(s,r){if(s.kind==="group")return r.headerBox+Y.header;return r.hitBox+(s.last?Y.group:Y.hit)}function ie(s,r){let t=Array(s.length),h=Array(s.length),c=0;for(let l=0;l<s.length;l++){let m=xe(s[l],r);t[l]=c,h[l]=m,c+=m}return{offsets:t,heights:h,total:c}}function ae(s,r,t,h,c=240){if(s.length===0)return{start:0,end:0};let l=Math.max(0,t),m=l-c,R=l+h+c,p=0,v=s.length-1;while(p<v){let x=p+v>>1;if(s[x]+r[x]>m)v=x;else p=x+1}let w=p;p=w,v=s.length;while(p<v){let x=p+v>>1;if(s[x]>=R)v=x;else p=x+1}return{start:w,end:p}}var be=8,Se=8;function le({groups:s,replacement:r,showReplacePreview:t,onOpen:h,onReplaceFile:c,replaceBusy:l}){let m=i(null),R=i(null),p=u(()=>oe(s),[s]),[v,w]=n(re),x=u(()=>ie(p,v),[p,v]),[M,E]=n(()=>({start:0,end:Math.min(p.length,60)})),F=a((g)=>{m.current=g},[]),k=a(()=>{let g=m.current;if(!g)return;let N=ae(x.offsets,x.heights,g.scrollTop,g.clientHeight);E((I)=>I.start===N.start&&I.end===N.end?I:N)},[x]),y=a(()=>{k()},[k]);W(()=>{let g=R.current;if(!g)return;let N=g.querySelector("[data-search-header] > div")?.offsetHeight??0,I=g.querySelector("[data-search-hit] > button")?.offsetHeight??0;if(N>0&&N!==v.headerBox)w((C)=>({...C,headerBox:N}));if(I>0&&I!==v.hitBox)w((C)=>({...C,hitBox:I}))},[M,v,p]),W(()=>{k()},[k]),W(()=>{let g=m.current;if(!g||typeof ResizeObserver>"u")return;let N=new ResizeObserver(()=>k());return N.observe(g),()=>N.disconnect()},[k]);let P=p.length===0?0:Math.min(M.start,p.length-1),L=Math.min(M.end,p.length),B=p.slice(P,L),A=L<p.length?x.total-x.offsets[L]:0;return e("div",{ref:F,onScroll:y,className:"flex-1 scrollbar-overlay-container px-3 text-xs",style:{overflowAnchor:"none"},children:[e("div",{style:{height:be+(x.offsets[P]??0)},"aria-hidden":"true"}),e("div",{ref:R,children:B.map((g,N)=>{let I=P+N,C=x.heights[I];if(g.kind==="group")return e("div",{"data-search-header":"",style:{height:C},children:e("div",{className:"font-semibold text-ink/80 flex items-center justify-between group",children:[e("div",{className:"flex items-center min-w-0",children:[e(it,{name:g.file,size:12,className:"mr-1.5 flex-shrink-0"}),e("span",{className:"truncate",children:g.file}),e("span",{className:"ml-2 bg-ink/10 text-[10px] px-1.5 py-0.5 rounded-full flex-shrink-0",children:g.count})]}),e("button",{onClick:()=>c(g.file),disabled:l,className:"touch-visible opacity-0 group-hover:opacity-100 p-1 text-ink/40 hover:text-ink rounded hover:bg-ink/5 disabled:opacity-50 flex-shrink-0",title:"Replace in this file",children:e(zi,{size:12})})]})},`group:${g.file}`);return e("div",{"data-search-hit":"",style:{height:C},children:e(te,{file:g.file,result:g.result,replacement:r,showReplacePreview:t,onOpen:h})},`hit:${g.file}:${g.result.line}:${I}`)})}),e("div",{style:{height:Se+A},"aria-hidden":"true"})]})}function ce({className:s,query:r,setQuery:t,replaceQuery:h,setReplaceQuery:c,matchCase:l,setMatchCase:m,wholeWord:R,setWholeWord:p,useRegex:v,setUseRegex:w,includeFiles:x,setIncludeFiles:M,showIncludeField:E,setShowIncludeField:F,showMenu:k,setShowMenu:y,menuRef:P,rootPath:L,activeRepo:B,setActiveRepo:A,repos:g,reposScanning:N,rescanRepos:I,results:C,isSearching:G,truncated:H,error:z,onOpenFile:J,handleReplace:q,replaceBusy:Q}){let X=u(()=>se(C),[C]),_=i(null),K=i(null),U=a(()=>{t(""),_.current?.focus()},[t]),j=a(()=>{c(""),K.current?.focus()},[c]),V=u(()=>({matchCase:l,wholeWord:R,isRegex:v,inSelection:!1}),[l,R,v]),he=a((T)=>{$u({path:T.file,line:Number(T.line),query:r,options:V}),J?.({path:T.file,name:T.file.split("/").pop()||T.file,root:L,repo:B})},[r,V,L,B,J]),de=a((T)=>q(T),[q]);return e("div",{className:`flex flex-col h-full bg-paper ${s}`,children:[e(mt,{left:e(d,{children:[e("h2",{className:"text-xs font-semibold text-ink uppercase tracking-wider",children:"Search"}),e(hr,{rootPath:L,activeRepo:B,onSelectRepo:A,repos:g,scanning:N,onRefreshRepos:I})]}),right:e("div",{className:"relative",ref:P,children:[e("button",{onClick:()=>y(!k),className:`p-1 rounded hover:bg-ink/5 transition-colors ${k||E?"text-ink":"text-ink/40"}`,title:"Search Options",children:e(Be,{size:14})}),k&&e("div",{className:"glass-popover absolute right-0 top-full mt-1 w-48 bg-paper border border-ink/10 rounded shadow-lg z-10 py-1",children:e("button",{onClick:()=>{if(F(!E),E)M("");y(!1)},className:"w-full px-3 py-1.5 text-left text-xs text-ink hover:bg-ink/5 flex items-center justify-between",children:[e("span",{children:"Files to include"}),E&&e(f,{size:12,className:"text-ink/60"})]})})]})}),e("div",{className:"p-3 flex flex-col gap-2.5 border-b border-ink/10",children:[e("div",{className:"relative",children:e("div",{className:"flex items-center border border-ink/20 rounded bg-paper focus-within:border-ink/40 focus-within:ring-1 focus-within:ring-ink/10 transition-all",children:[e(O,{size:14,className:"ml-2 text-ink/40 flex-shrink-0"}),e("input",{ref:_,type:"text",placeholder:"Search",value:r,onChange:(T)=>t(T.currentTarget.value),className:"w-full bg-transparent border-none text-xs px-2 py-1.5 focus:outline-none text-ink placeholder-ink/35 min-w-0"}),r&&e("button",{type:"button",onClick:U,title:"Clear search","aria-label":"Clear search",className:"p-1 mr-0.5 rounded text-ink/40 hover:text-ink hover:bg-ink/5 flex-shrink-0",children:e(b,{size:12})}),e("div",{className:"flex items-center space-x-0.5 pr-1 text-ink/40 flex-shrink-0",children:[e("button",{onClick:()=>m(!l),className:`p-1 rounded hover:text-ink ${l?"bg-ink/10 text-ink":"hover:bg-ink/5"}`,title:"Match Case",children:e(Li,{size:14})}),e("button",{onClick:()=>p(!R),className:`p-1 rounded hover:text-ink ${R?"bg-ink/10 text-ink":"hover:bg-ink/5"}`,title:"Match Whole Word",children:e(Gi,{size:14})}),e("button",{onClick:()=>w(!v),className:`p-1 rounded hover:text-ink ${v?"bg-ink/10 text-ink":"hover:bg-ink/5"}`,title:"Use Regular Expression",children:e(Oi,{size:14})})]})]})}),e("div",{className:"relative flex items-center space-x-1",children:[e("div",{className:"flex flex-1 min-w-0 items-center border border-ink/20 rounded bg-paper focus-within:border-ink/40 focus-within:ring-1 focus-within:ring-ink/10 transition-all",children:[e("input",{ref:K,type:"text",placeholder:"Replace",value:h,onChange:(T)=>c(T.currentTarget.value),className:"flex-1 min-w-0 bg-transparent border-none text-xs px-2 py-1.5 focus:outline-none text-ink placeholder-ink/35"}),h&&e("button",{type:"button",onClick:j,title:"Clear replace","aria-label":"Clear replace",className:"p-1 mr-0.5 rounded text-ink/40 hover:text-ink hover:bg-ink/5 flex-shrink-0",children:e(b,{size:12})})]}),e("button",{onClick:()=>q(),disabled:C.length===0||Q,className:"p-1.5 rounded border border-ink/20 text-ink/60 hover:text-ink hover:bg-ink/5 disabled:opacity-50 disabled:cursor-not-allowed bg-paper",title:"Replace All",children:e($i,{size:14})})]}),E&&e("div",{className:"relative",children:e("input",{type:"text",value:x,onChange:(T)=>M(T.currentTarget.value),placeholder:"Files to include (e.g. *.js, src/*)",className:"w-full bg-paper border border-ink/20 rounded text-xs px-2 py-1.5 focus:outline-none focus:border-ink/40 focus:ring-1 focus:ring-ink/10 transition-all text-ink placeholder-ink/40"})})]}),z&&C.length===0?e("div",{className:"flex-1 px-3 py-3",role:"alert",children:e("div",{className:"rounded border border-error/30 bg-error/5 px-2.5 py-2",children:[e("div",{className:"text-[11px] font-semibold text-error",children:"Search failed"}),e("div",{className:"mt-1 whitespace-pre-wrap break-words font-mono text-[10.5px] text-ink/70",children:z}),v&&e("div",{className:"mt-1 text-[10.5px] text-ink/50",children:["Regex is on — escape metacharacters such as ",e("code",{className:"font-mono",children:"( ) [ ] * ? +"})," or turn it off to search literally."]})]})}):G&&C.length===0?e("div",{className:"flex-1 text-ink/40 italic text-center py-4",children:"Searching..."}):r.trim().length<=2?e("div",{className:"flex-1 text-ink/40 italic text-center py-4",children:"Type at least 3 characters to search."}):C.length===0?e("div",{className:"flex-1 text-ink/40 italic text-center py-4",children:"No results found."}):e(d,{children:[z&&e("div",{className:"px-3 pt-2 text-[10.5px] text-error",role:"alert",children:["Search failed: ",e("span",{className:"font-mono",children:z})]}),G&&e("div",{className:"px-3 pt-2 text-ink/40 italic",children:"Searching…"}),H&&e("div",{className:"px-3 pt-2 text-ink/50 italic",children:["Showing the first ",ne," matches — refine the query to see the rest."]}),e(le,{groups:X,replacement:h,showReplacePreview:h.length>0,onOpen:he,onReplaceFile:de,replaceBusy:Q})]})]})}function ue(s){let[r,t]=n({scope:s,results:[],truncated:!1,error:null}),[h,c]=n(!1),l=i(null),m=i(!0),R=i(s);R.current=s,o(()=>(m.current=!0,()=>{m.current=!1,l.current?.abort(),l.current=null}),[]);let p=a(async(v)=>{l.current?.abort();let w=new AbortController;l.current=w;let x=R.current;t({scope:x,results:[],truncated:!1,error:null}),c(!0);try{let M=await fetch("/api/fs/search",{method:"POST",headers:{"content-type":"application/x-www-form-urlencoded"},body:new URLSearchParams(v),signal:w.signal});await Vl(M,(E,F)=>{if(R.current!==x)return;if(E==="done"){let k=!1;try{k=JSON.parse(F)?.truncated===!0}catch{}t((y)=>y.scope===x?{...y,truncated:k}:y);return}if(E==="error"){let k="Search failed";try{k=JSON.parse(F)?.error||k}catch{}t((y)=>y.scope===x?{...y,error:k}:y);return}if(E!=="matches")return;try{let k=JSON.parse(F);if(Array.isArray(k))t((y)=>y.scope===x?{...y,results:[...y.results,...k]}:y)}catch{}},w.signal)}catch{}finally{if(m.current&&l.current===w)l.current=null,c(!1)}},[]);return{results:r.scope===s?r.results:[],isSearching:h&&r.scope===s,truncated:r.scope===s&&r.truncated,error:r.scope===s?r.error:null,start:p}}function ot({className:s="",enabled:r=!0,rootPath:t,onOpenFile:h}){let[c,l]=S("search.query",""),[m,R]=S("search.replaceQuery",""),[p,v]=S("search.matchCase",!1),[w,x]=S("search.wholeWord",!1),[M,E]=S("search.useRegex",!1),[F,k]=S("search.includeFiles",""),[y,P]=n(!1),[L,B]=S("search.showIncludeField",!1),{activeRepo:A,setActiveRepo:g}=lr(t),{repos:N,scanning:I,rescan:C}=cr(t,r),G=i(null),H=st(),{results:z,isSearching:J,truncated:q,error:Q,start:X}=ue(`${t??""}\x00${A}`);pe(G,()=>P(!1));let _=a(()=>{if(!r)return;if(c.trim().length>2)return X({q:c,matchCase:String(p),wholeWord:String(w),useRegex:String(M),includeFiles:L?F:"",...t?{root:t}:{},...A!=="."?{repo:A}:{}})},[r,c,p,w,M,L,F,t,A,X]);o(()=>{let U=setTimeout(()=>{_()},300);return()=>clearTimeout(U)},[_]);let K=a((U)=>{if(!c)return;let j=U?[U]:Array.from(new Set(z.map((V)=>V.file)));if(j.length===0)return;H.submit({q:c,replaceWith:m,matchCase:String(p),wholeWord:String(w),useRegex:String(M),files:JSON.stringify(j),...t?{root:t}:{},...A!=="."?{repo:A}:{}},{method:"POST",action:"/api/fs/replace"})},[c,m,p,w,M,z,t,A,H]);if(o(()=>{if(H.state==="idle"&&H.data?.success)_()},[H.state,H.data,_]),!r)return e("div",{className:`flex flex-col h-full bg-paper items-center justify-center text-ink/40 ${s}`,children:e("span",{className:"text-xs font-mono text-muted",children:"No session selected"})});return e(ce,{className:s,query:c,setQuery:l,replaceQuery:m,setReplaceQuery:R,matchCase:p,setMatchCase:v,wholeWord:w,setWholeWord:x,useRegex:M,setUseRegex:E,includeFiles:F,setIncludeFiles:k,showIncludeField:L,setShowIncludeField:B,showMenu:y,setShowMenu:P,menuRef:G,rootPath:t,activeRepo:A,setActiveRepo:g,repos:N,reposScanning:I,rescanRepos:C,results:z,isSearching:J,truncated:q,error:Q,onOpenFile:h,handleReplace:K,replaceBusy:H.state!=="idle"})}export{ot as SearchPanel};
@@ -1,2 +1,2 @@
1
- import{t,Bs,h,Ss}from"./index-61qjr1k0.js";import{dn}from"./index-t6gznaxm.js";var o=dn(Ss(),1);var Go=t((s,e)=>{let r=s.append("rect");if(r.attr("x",e.x),r.attr("y",e.y),r.attr("fill",e.fill),r.attr("stroke",e.stroke),r.attr("width",e.width),r.attr("height",e.height),e.name)r.attr("name",e.name);if(e.rx)r.attr("rx",e.rx);if(e.ry)r.attr("ry",e.ry);if(e.attrs!==void 0)for(let a in e.attrs)r.attr(a,e.attrs[a]);if(e.class)r.attr("class",e.class);return r},"drawRect"),vu=t((s,e)=>{let r={x:e.startx,y:e.starty,width:e.stopx-e.startx,height:e.stopy-e.starty,fill:e.fill,stroke:e.stroke,class:"rect"};Go(s,r).lower()},"drawBackgroundRect"),xg=t((s,e)=>{let r=e.text.replace(Bs," "),a=s.append("text");if(a.attr("x",e.x),a.attr("y",e.y),a.attr("class","legend"),a.style("text-anchor",e.anchor),e.class)a.attr("class",e.class);let i=a.append("tspan");return i.attr("x",e.x+e.textMargin*2),i.text(r),a},"drawText"),zd=t((s,e,r,a)=>{let i=s.append("image");i.attr("x",e),i.attr("y",r);let n=o.sanitizeUrl(a);i.attr("xlink:href",n)},"drawImage"),Ud=t((s,e,r,a)=>{let i=s.append("use");i.attr("x",e),i.attr("y",r);let n=o.sanitizeUrl(a);i.attr("xlink:href",`#${n}`)},"drawEmbeddedImage"),ar=t(()=>({x:0,y:0,width:100,height:100,fill:"#EDF2AE",stroke:"#666",anchor:"start",rx:0,ry:0}),"getNoteRect"),Gd=t(()=>({x:0,y:0,width:100,height:100,"text-anchor":"start",style:"#666",textMargin:0,rx:0,ry:0,tspan:!0}),"getTextObj"),La=t(()=>{let s=h(".mermaidTooltip");if(s.empty())s=h("body").append("div").attr("class","mermaidTooltip").style("opacity",0).style("position","absolute").style("text-align","center").style("max-width","200px").style("padding","2px").style("font-size","12px").style("background","#ffffde").style("border","1px solid #333").style("border-radius","2px").style("pointer-events","none").style("z-index","100");return s},"createTooltip");
1
+ import{t,Bs,h,Ss}from"./index-y5ymgp20.js";import{dn}from"./index-t6gznaxm.js";var o=dn(Ss(),1);var Go=t((s,e)=>{let r=s.append("rect");if(r.attr("x",e.x),r.attr("y",e.y),r.attr("fill",e.fill),r.attr("stroke",e.stroke),r.attr("width",e.width),r.attr("height",e.height),e.name)r.attr("name",e.name);if(e.rx)r.attr("rx",e.rx);if(e.ry)r.attr("ry",e.ry);if(e.attrs!==void 0)for(let a in e.attrs)r.attr(a,e.attrs[a]);if(e.class)r.attr("class",e.class);return r},"drawRect"),vu=t((s,e)=>{let r={x:e.startx,y:e.starty,width:e.stopx-e.startx,height:e.stopy-e.starty,fill:e.fill,stroke:e.stroke,class:"rect"};Go(s,r).lower()},"drawBackgroundRect"),xg=t((s,e)=>{let r=e.text.replace(Bs," "),a=s.append("text");if(a.attr("x",e.x),a.attr("y",e.y),a.attr("class","legend"),a.style("text-anchor",e.anchor),e.class)a.attr("class",e.class);let i=a.append("tspan");return i.attr("x",e.x+e.textMargin*2),i.text(r),a},"drawText"),zd=t((s,e,r,a)=>{let i=s.append("image");i.attr("x",e),i.attr("y",r);let n=o.sanitizeUrl(a);i.attr("xlink:href",n)},"drawImage"),Ud=t((s,e,r,a)=>{let i=s.append("use");i.attr("x",e),i.attr("y",r);let n=o.sanitizeUrl(a);i.attr("xlink:href",`#${n}`)},"drawEmbeddedImage"),ar=t(()=>({x:0,y:0,width:100,height:100,fill:"#EDF2AE",stroke:"#666",anchor:"start",rx:0,ry:0}),"getNoteRect"),Gd=t(()=>({x:0,y:0,width:100,height:100,"text-anchor":"start",style:"#666",textMargin:0,rx:0,ry:0,tspan:!0}),"getTextObj"),La=t(()=>{let s=h(".mermaidTooltip");if(s.empty())s=h("body").append("div").attr("class","mermaidTooltip").style("opacity",0).style("position","absolute").style("text-align","center").style("max-width","200px").style("padding","2px").style("font-size","12px").style("background","#ffffde").style("border","1px solid #333").style("border-radius","2px").style("pointer-events","none").style("z-index","100");return s},"createTooltip");
2
2
  export{Go,vu,xg,zd,Ud,ar,Gd,La};