@kabmo-labs/kabmo 0.47.0 → 0.48.0

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 (249) hide show
  1. package/dist/client/index.html +1 -1
  2. package/dist/client/index.js +497 -497
  3. package/dist/client/static/js/Body-3tspyjtk.js +3 -0
  4. package/dist/client/static/js/{CsvGrid-vfgttmym.js → CsvGrid-3pwsfmxp.js} +2 -2
  5. package/dist/client/static/js/{DocxView-dc41t6rp.js → DocxView-xcg9jktb.js} +3 -3
  6. package/dist/client/static/js/{DrawioView-wpwr38d9.js → DrawioView-2q19tgkx.js} +2 -2
  7. package/dist/client/static/js/{HtmlPreview-23n7t5cs.js → HtmlPreview-92cadvbr.js} +1 -1
  8. package/dist/client/static/js/ImageView-pr4h38hb.js +1 -0
  9. package/dist/client/static/js/LayoutWrapper-n4tzhjes.js +2 -0
  10. package/dist/client/static/js/MergeDiffView-0t15nh9f.js +1 -0
  11. package/dist/client/static/js/{Modal-dsqhas10.js → Modal-77hgx4dw.js} +20 -20
  12. package/dist/client/static/js/{PdfView-cpvsbfk0.js → PdfView-gzxhvxe8.js} +1 -1
  13. package/dist/client/static/js/{SessionsView-s0crtcm8.js → SessionsView-2tdqrvk0.js} +1 -1
  14. package/dist/client/static/js/{SheetView-n6mst0hq.js → SheetView-w5w2m2de.js} +21 -21
  15. package/dist/client/static/js/{SvgPreview-g2aqq812.js → SvgPreview-mtk6de6h.js} +1 -1
  16. package/dist/client/static/js/{abnfDiagram-O67JEVCF-3vac8sq4.js → abnfDiagram-O67JEVCF-tha4j2fn.js} +1 -1
  17. package/dist/client/static/js/architecture-7GRP2DOG-zs15nydj.js +1 -0
  18. package/dist/client/static/js/{architectureDiagram-NJMV4G6O-1nh4htz2.js → architectureDiagram-NJMV4G6O-heep78p6.js} +6 -6
  19. package/dist/client/static/js/{astro-63zcysj7.js → astro-r4dp34pw.js} +1 -1
  20. package/dist/client/static/js/bash-8d3wrx5c.js +1 -0
  21. package/dist/client/static/js/{blockDiagram-BEXU5L5S-62z6kaar.js → blockDiagram-BEXU5L5S-6mzgfqh8.js} +5 -5
  22. package/dist/client/static/js/c-rn3z0csz.js +1 -0
  23. package/dist/client/static/js/{c4Diagram-YGBWAQC7-rts5zgx4.js → c4Diagram-YGBWAQC7-sfkcw7g9.js} +4 -4
  24. package/dist/client/static/js/{classDiagram-v2-NBCMYWYE-tnpww186.js → classDiagram-v2-NBCMYWYE-v530ny5e.js} +6 -6
  25. package/dist/client/static/js/{cose-bilkent-JH36ORCC-8vsjbzwa.js → cose-bilkent-JH36ORCC-ybv1ttbx.js} +1 -1
  26. package/dist/client/static/js/cpp-99ws9nak.js +1 -0
  27. package/dist/client/static/js/css-narcr42w.js +1 -0
  28. package/dist/client/static/js/cynefin-OW5HDTMX-p3y1b4ap.js +1 -0
  29. package/dist/client/static/js/{cynefinDiagram-VND7K2PF-005gc8km.js → cynefinDiagram-VND7K2PF-k8f3z0mm.js} +2 -2
  30. package/dist/client/static/js/{dagre-6A5THRUB-41zsteyd.js → dagre-6A5THRUB-gk0gp124.js} +2 -2
  31. package/dist/client/static/js/{diagram-22UHCM2B-prsm18a1.js → diagram-22UHCM2B-2zh2957c.js} +15 -15
  32. package/dist/client/static/js/{diagram-3UASUU5V-5nx9wf04.js → diagram-3UASUU5V-bzstt5e2.js} +2 -2
  33. package/dist/client/static/js/{diagram-ATOU4E4O-k3d4z3aq.js → diagram-ATOU4E4O-16adx4g0.js} +3 -3
  34. package/dist/client/static/js/{diagram-CDSNMT55-x2c5x5j2.js → diagram-CDSNMT55-1ja98ens.js} +5 -5
  35. package/dist/client/static/js/{diagram-MLGK6HIB-nvr76jqh.js → diagram-MLGK6HIB-f9nnyjbq.js} +2 -2
  36. package/dist/client/static/js/{diagram-MPIPVDR6-v1jpzp9p.js → diagram-MPIPVDR6-3qgadfjz.js} +2 -2
  37. package/dist/client/static/js/{dockerfile-vz6va73h.js → dockerfile-04tc68pq.js} +1 -1
  38. package/dist/client/static/js/{ebnfDiagram-ZINNZB2B-0v4tqr9v.js → ebnfDiagram-ZINNZB2B-022cz603.js} +1 -1
  39. package/dist/client/static/js/{elixir-80wq7gak.js → elixir-61gbjv6c.js} +1 -1
  40. package/dist/client/static/js/{elk-276RUBZZ-qfn4r7xj.js → elk-276RUBZZ-2anf1c36.js} +1 -1
  41. package/dist/client/static/js/{erDiagram-OPXOYQCR-cd667n9f.js → erDiagram-OPXOYQCR-ndd27fz1.js} +7 -7
  42. package/dist/client/static/js/{erlang-vk66vt7q.js → erlang-bh5cbm8m.js} +1 -1
  43. package/dist/client/static/js/eventmodeling-NTZA5JFV-sx2cwkz3.js +1 -0
  44. package/dist/client/static/js/flowDiagram-KWPJA3E3-dsc17mty.js +1 -0
  45. package/dist/client/static/js/{ganttDiagram-FUAMR5RP-ps0h3drm.js → ganttDiagram-FUAMR5RP-9gm6hkgn.js} +4 -4
  46. package/dist/client/static/js/gitGraph-4MIJSDKK-yqhbscsd.js +1 -0
  47. package/dist/client/static/js/{gitGraphDiagram-X574FWY7-fts23jer.js → gitGraphDiagram-X574FWY7-78bxa67c.js} +8 -8
  48. package/dist/client/static/js/graphql-tr0jcndy.js +1 -0
  49. package/dist/client/static/js/html-n8fdvrdk.js +1 -0
  50. package/dist/client/static/js/index-0e51wknc.js +10 -0
  51. package/dist/client/static/js/{index-7zedprz3.js → index-13g17wa3.js} +1 -1
  52. package/dist/client/static/js/index-1hb8fvw9.js +1 -0
  53. package/dist/client/static/js/{index-1c2jvnyh.js → index-2bsnywea.js} +2 -2
  54. package/dist/client/static/js/{index-9ab6xaxd.js → index-2n1fgpjv.js} +2 -2
  55. package/dist/client/static/js/{index-a4h5np9r.js → index-30a8py59.js} +2 -2
  56. package/dist/client/static/js/{index-e5j5gc4h.js → index-34aq5bz5.js} +2 -2
  57. package/dist/client/static/js/index-3en15m75.js +2 -0
  58. package/dist/client/static/js/{index-64p1dncg.js → index-417fbrqk.js} +2 -2
  59. package/dist/client/static/js/{index-z4530r3c.js → index-45p59fxq.js} +2 -2
  60. package/dist/client/static/js/index-4n7t26ap.js +2 -0
  61. package/dist/client/static/js/{index-1whzs9kb.js → index-55pqvh82.js} +2 -2
  62. package/dist/client/static/js/index-5mpv57fn.js +12 -0
  63. package/dist/client/static/js/{index-tqgj7rd9.js → index-7pz6n3pg.js} +2 -2
  64. package/dist/client/static/js/{index-4jzsr1ky.js → index-7whstwc7.js} +2 -2
  65. package/dist/client/static/js/index-869vdnz8.js +2 -0
  66. package/dist/client/static/js/{index-52nd4hgm.js → index-8tvrzce0.js} +2 -2
  67. package/dist/client/static/js/index-9a78xmkk.js +462 -0
  68. package/dist/client/static/js/{index-33qxg79j.js → index-a58rkn3f.js} +5 -5
  69. package/dist/client/static/js/{index-9xsf8162.js → index-aa3hmn6j.js} +65 -65
  70. package/dist/client/static/js/{index-dxkefysk.js → index-aabp7nt6.js} +1 -1
  71. package/dist/client/static/js/{index-c5hjht5e.js → index-abrrqhne.js} +2 -2
  72. package/dist/client/static/js/{index-an2wv33f.js → index-ac2q5903.js} +2 -2
  73. package/dist/client/static/js/index-axtm1aq8.js +2 -0
  74. package/dist/client/static/js/index-b2cs4c51.js +4 -0
  75. package/dist/client/static/js/{index-xk1cqjkn.js → index-c250nzm1.js} +3 -3
  76. package/dist/client/static/js/{index-56rtb871.js → index-dxnkwf39.js} +52 -52
  77. package/dist/client/static/js/{index-39d8zbkx.js → index-e6ny4gd9.js} +6 -6
  78. package/dist/client/static/js/index-ebf50mrs.js +9 -0
  79. package/dist/client/static/js/{index-g4kkapka.js → index-ep6bqcmg.js} +2 -2
  80. package/dist/client/static/js/{index-396r53n0.js → index-fb2s080r.js} +2 -2
  81. package/dist/client/static/js/index-fryp0kgf.js +2 -0
  82. package/dist/client/static/js/{index-evmcc5qh.js → index-g3rg6vsd.js} +2 -2
  83. package/dist/client/static/js/{index-sa1675y0.js → index-g8rpydkr.js} +2 -2
  84. package/dist/client/static/js/{index-zhjjpvcc.js → index-gkmn4y1v.js} +1 -1
  85. package/dist/client/static/js/{index-0dkc6z8e.js → index-gpmcth0x.js} +2 -2
  86. package/dist/client/static/js/{index-62jgcgfd.js → index-hcmhdpp4.js} +10 -10
  87. package/dist/client/static/js/{index-fxd8dfj4.js → index-he4k2j91.js} +2 -2
  88. package/dist/client/static/js/{index-x0xspam4.js → index-hq28918s.js} +2 -2
  89. package/dist/client/static/js/{index-c63qyysm.js → index-hwzxdwwg.js} +1 -1
  90. package/dist/client/static/js/{index-4wnzs76g.js → index-jnkc9p53.js} +1 -1
  91. package/dist/client/static/js/{index-54mkp2r2.js → index-k39be93q.js} +1 -1
  92. package/dist/client/static/js/{index-y6ke70e6.js → index-kaxvwh07.js} +2 -2
  93. package/dist/client/static/js/{index-7zeah164.js → index-kjr68pcj.js} +2 -2
  94. package/dist/client/static/js/{index-cra9mgkq.js → index-m0fatq7c.js} +4 -4
  95. package/dist/client/static/js/{index-ccgzzydx.js → index-m39gbcxn.js} +1 -1
  96. package/dist/client/static/js/{index-q4ke39rh.js → index-mqzgf7rw.js} +2 -2
  97. package/dist/client/static/js/{index-dzeyd153.js → index-pzsp1src.js} +2 -2
  98. package/dist/client/static/js/{index-n1yr4khe.js → index-qe0vfv6s.js} +1 -1
  99. package/dist/client/static/js/{index-6009v8jf.js → index-qek9mt5w.js} +1 -1
  100. package/dist/client/static/js/{index-nkahe229.js → index-qxzj780x.js} +2 -2
  101. package/dist/client/static/js/{index-cvyqp8nz.css → index-rgxg0azs.css} +1 -1
  102. package/dist/client/static/js/{index-1d8bxjsz.js → index-rq4dk4tp.js} +4 -4
  103. package/dist/client/static/js/{index-6d6hxwb5.js → index-seekt5k3.js} +2 -2
  104. package/dist/client/static/js/{index-gzkzwgzv.js → index-sng4prpr.js} +2 -2
  105. package/dist/client/static/js/{index-dyc886cc.js → index-t4s10406.js} +2 -2
  106. package/dist/client/static/js/{index-f2ahkev0.js → index-tzz5gp8a.js} +5 -5
  107. package/dist/client/static/js/index-vnv9z0a1.js +1 -0
  108. package/dist/client/static/js/{index-70g527sb.js → index-x7rajphe.js} +2 -2
  109. package/dist/client/static/js/{index-5f4b44ay.js → index-xny7vsfz.js} +2 -2
  110. package/dist/client/static/js/index-xr4hjv01.js +2 -0
  111. package/dist/client/static/js/{index-fjex1y0t.js → index-ya9yqj5w.js} +2 -2
  112. package/dist/client/static/js/{index-z0fkfphe.js → index-zcgqacvx.js} +2 -2
  113. package/dist/client/static/js/info-A6RAGUB7-0sd3zzgg.js +1 -0
  114. package/dist/client/static/js/{infoDiagram-VRGFBTTK-88qbtpq5.js → infoDiagram-VRGFBTTK-bxk0g0pe.js} +2 -2
  115. package/dist/client/static/js/ini-tnaw7zjy.js +1 -0
  116. package/dist/client/static/js/{ishikawaDiagram-OU5B5YK6-s8bagk00.js → ishikawaDiagram-OU5B5YK6-d1kdkhth.js} +3 -3
  117. package/dist/client/static/js/java-m4dpc2vw.js +1 -0
  118. package/dist/client/static/js/javascript-8y26t991.js +1 -0
  119. package/dist/client/static/js/{journeyDiagram-ZHPQQLJL-hz8z0b9x.js → journeyDiagram-ZHPQQLJL-cahg3zjq.js} +4 -4
  120. package/dist/client/static/js/json-azm7bdqd.js +1 -0
  121. package/dist/client/static/js/jsx-p9j1k773.js +1 -0
  122. package/dist/client/static/js/{julia-dm0j9apa.js → julia-2n5k898q.js} +1 -1
  123. package/dist/client/static/js/{kanban-definition-PNTS6WVX-sjjnjb51.js → kanban-definition-PNTS6WVX-nq7t83en.js} +6 -6
  124. package/dist/client/static/js/lua-hbm9rhz9.js +1 -0
  125. package/dist/client/static/js/markdown-tk3cd3vs.js +1 -0
  126. package/dist/client/static/js/{mermaid.core-zvwygxbh.js → mermaid.core-6nw0853j.js} +8 -8
  127. package/dist/client/static/js/{mindmap-definition-NLK3R4M7-kgj8enan.js → mindmap-definition-NLK3R4M7-cm7ykxf2.js} +3 -3
  128. package/dist/client/static/js/one-dark-pro-2cdc2nk7.js +1 -0
  129. package/dist/client/static/js/one-light-bt6z4jf0.js +1 -0
  130. package/dist/client/static/js/packet-AYTQ26CC-13w2v5bb.js +1 -0
  131. package/dist/client/static/js/{pegDiagram-GJSIUBJH-gxzw1qwa.js → pegDiagram-GJSIUBJH-xwxz8nsq.js} +1 -1
  132. package/dist/client/static/js/{perl-4jcm2jxv.js → perl-66vb5pz7.js} +1 -1
  133. package/dist/client/static/js/{php-q32mec74.js → php-4e9we8am.js} +1 -1
  134. package/dist/client/static/js/pie-WAS4IAKB-swtnysgn.js +1 -0
  135. package/dist/client/static/js/{pieDiagram-5QR66LMP-pdqwyqcm.js → pieDiagram-5QR66LMP-n910k9th.js} +3 -3
  136. package/dist/client/static/js/properties-6911ckw7.js +1 -0
  137. package/dist/client/static/js/python-44cvj250.js +1 -0
  138. package/dist/client/static/js/{quadrantDiagram-O4NWA36T-yx2t364p.js → quadrantDiagram-O4NWA36T-dxkwxbqb.js} +6 -6
  139. package/dist/client/static/js/r-t3sepzm4.js +1 -0
  140. package/dist/client/static/js/radar-RG4KPBEZ-vtvxkx55.js +1 -0
  141. package/dist/client/static/js/railroad-74A4TZTK-5sp2d63r.js +1 -0
  142. package/dist/client/static/js/railroad-abnf-HS5TGJTU-kg706fan.js +1 -0
  143. package/dist/client/static/js/railroad-ebnf-LZEXJU2U-4ra1gzx5.js +1 -0
  144. package/dist/client/static/js/railroad-peg-WCYAUIDC-hms3zpjm.js +1 -0
  145. package/dist/client/static/js/{railroadDiagram-XR7U4H2S-800fdzkr.js → railroadDiagram-XR7U4H2S-xb1smt7r.js} +1 -1
  146. package/dist/client/static/js/{requirementDiagram-PLB6GJNP-vc5rpgtm.js → requirementDiagram-PLB6GJNP-6kb21b9f.js} +6 -6
  147. package/dist/client/static/js/{ruby-npmpb290.js → ruby-v7nmcvyr.js} +1 -1
  148. package/dist/client/static/js/{rust-waks43wh.js → rust-5ersd7be.js} +1 -1
  149. package/dist/client/static/js/{sankeyDiagram-IPEJSGJF-ccjk8zgn.js → sankeyDiagram-IPEJSGJF-74z0fskw.js} +4 -4
  150. package/dist/client/static/js/{sass-502a4r7y.js → sass-h3nvy4c8.js} +1 -1
  151. package/dist/client/static/js/{sequenceDiagram-PO4LG4MO-c0tk7gfn.js → sequenceDiagram-PO4LG4MO-apn6kezn.js} +17 -17
  152. package/dist/client/static/js/{sizeCapture-INFHLROL-fma9p1vy.js → sizeCapture-INFHLROL-2drzcjb8.js} +1 -1
  153. package/dist/client/static/js/sql-zdkawqx3.js +1 -0
  154. package/dist/client/static/js/{stateDiagram-v2-GCMORJYK-d8f24b7j.js → stateDiagram-v2-GCMORJYK-ma09vhby.js} +3 -3
  155. package/dist/client/static/js/{svelte-c15d0421.js → svelte-dhspkgss.js} +1 -1
  156. package/dist/client/static/js/{swimlanes-2SLR337P-sdt7qy36.js → swimlanes-2SLR337P-f6y9xqnx.js} +1 -1
  157. package/dist/client/static/js/swimlanesDiagram-TC7HE7FX-3dwas56m.js +8 -0
  158. package/dist/client/static/js/{timeline-definition-EJHVYXUP-rv8qyr8b.js → timeline-definition-EJHVYXUP-zmcmvq00.js} +5 -5
  159. package/dist/client/static/js/treeView-Q6P3EWNA-7t5k6rs2.js +1 -0
  160. package/dist/client/static/js/treemap-WGGIJYW6-w56ry3bg.js +1 -0
  161. package/dist/client/static/js/tsx-b7eabr17.js +1 -0
  162. package/dist/client/static/js/typescript-nnkvhwfy.js +1 -0
  163. package/dist/client/static/js/{usecaseDiagram-POWQR4AR-w6ew1red.js → usecaseDiagram-POWQR4AR-wfaa019a.js} +24 -24
  164. package/dist/client/static/js/{vennDiagram-UO4OBE2U-p9axw7ch.js → vennDiagram-UO4OBE2U-46wf2pgd.js} +8 -8
  165. package/dist/client/static/js/{vue-xpemy62d.js → vue-ffngx2b3.js} +1 -1
  166. package/dist/client/static/js/wardley-WFR3VGLG-rtjb9kgv.js +1 -0
  167. package/dist/client/static/js/{wardleyDiagram-VNRHLVJA-5ewc8s4p.js → wardleyDiagram-VNRHLVJA-10ph3bzq.js} +4 -4
  168. package/dist/client/static/js/xml-xy1tw6b2.js +1 -0
  169. package/dist/client/static/js/{xychartDiagram-PMCCYNJV-7n4gn7k6.js → xychartDiagram-PMCCYNJV-2ba825z9.js} +5 -5
  170. package/dist/client/static/js/yaml-0fexqg2d.js +1 -0
  171. package/package.json +1 -1
  172. package/src/client/components/settings/categories/usage-settings/LimitsSection.tsx +10 -3
  173. package/src/client/components/settings/categories/usage-settings/ProviderDetail.tsx +27 -4
  174. package/src/client/components/settings/categories/usage-settings/TokenHarborCard.tsx +160 -0
  175. package/src/client/components/settings/categories/usage-settings/TokenPortalCard.tsx +104 -0
  176. package/src/client/components/settings/categories/usage-settings/format.ts +35 -0
  177. package/src/client/components/settings/categories/usage-settings/limits-section.test.tsx +16 -0
  178. package/src/client/components/settings/categories/usage-settings/providers.ts +26 -4
  179. package/src/client/components/settings/categories/usage-settings/token-harbor-card.test.tsx +114 -0
  180. package/src/client/components/settings/categories/usage-settings/token-harbor-hint.test.ts +68 -0
  181. package/src/client/components/settings/categories/usage-settings/token-portal-card.test.tsx +81 -0
  182. package/src/client/components/settings/categories/usage-settings/usage-and-picker.test.ts +66 -0
  183. package/src/client/components/workspace/chat-timeline/tool-renderers/shared/DiffView.test.ts +13 -0
  184. package/src/client/components/workspace/chat-timeline/tool-renderers/shared/DiffView.tsx +41 -18
  185. package/src/client/components/workspace/editor/BodyLazy.tsx +40 -0
  186. package/src/client/components/workspace/editor/index.tsx +2 -2
  187. package/src/client/data/settings/omp-schema.json +33 -10
  188. package/src/server/lib/usage/provider-key.ts +18 -0
  189. package/src/server/lib/usage/providers.server.ts +27 -3
  190. package/src/server/lib/usage/report.server.ts +24 -0
  191. package/src/server/lib/usage/token-harbor.test.ts +191 -0
  192. package/src/server/lib/usage/token-harbor.ts +207 -0
  193. package/src/server/lib/usage/token-portal.test.ts +140 -0
  194. package/src/server/lib/usage/token-portal.ts +179 -0
  195. package/src/server/lib/usage/vendor-http.test.ts +52 -0
  196. package/src/server/lib/usage/vendor-http.ts +9 -2
  197. package/src/shared/lib/omp/config/schema-releases.test.ts +22 -0
  198. package/src/shared/types/settings/usage.ts +89 -2
  199. package/dist/client/static/js/ImageView-mvjb3qh1.js +0 -1
  200. package/dist/client/static/js/LayoutWrapper-eenx0hp2.js +0 -2
  201. package/dist/client/static/js/architecture-7GRP2DOG-b5w9mnn5.js +0 -1
  202. package/dist/client/static/js/bash-hv3167gh.js +0 -1
  203. package/dist/client/static/js/c-acmn1zc9.js +0 -1
  204. package/dist/client/static/js/cpp-v2mqp8j7.js +0 -1
  205. package/dist/client/static/js/css-x7gyc3ta.js +0 -1
  206. package/dist/client/static/js/cynefin-OW5HDTMX-kdj8rjc1.js +0 -1
  207. package/dist/client/static/js/eventmodeling-NTZA5JFV-m57b7ytw.js +0 -1
  208. package/dist/client/static/js/flowDiagram-KWPJA3E3-fasj2gxy.js +0 -1
  209. package/dist/client/static/js/gitGraph-4MIJSDKK-wvzsc4ph.js +0 -1
  210. package/dist/client/static/js/graphql-a4gbqpj9.js +0 -1
  211. package/dist/client/static/js/html-m0megrvb.js +0 -1
  212. package/dist/client/static/js/index-3nsrnyqr.js +0 -2
  213. package/dist/client/static/js/index-4x9p7hf9.js +0 -2
  214. package/dist/client/static/js/index-9vqkyj58.js +0 -3
  215. package/dist/client/static/js/index-d2xtbabt.js +0 -2
  216. package/dist/client/static/js/index-dxp2yvy7.js +0 -2
  217. package/dist/client/static/js/index-p6s3fz6b.js +0 -12
  218. package/dist/client/static/js/index-qtd0e38d.js +0 -1
  219. package/dist/client/static/js/index-x2v1zmth.js +0 -479
  220. package/dist/client/static/js/index-x9hfvbz6.js +0 -2
  221. package/dist/client/static/js/info-A6RAGUB7-ym2xevn8.js +0 -1
  222. package/dist/client/static/js/ini-80p6sp79.js +0 -1
  223. package/dist/client/static/js/java-mm2b3s9b.js +0 -1
  224. package/dist/client/static/js/javascript-n9w9p97f.js +0 -1
  225. package/dist/client/static/js/json-fzy76fkw.js +0 -1
  226. package/dist/client/static/js/jsx-c7v2f8s7.js +0 -1
  227. package/dist/client/static/js/lua-ppfdxrmv.js +0 -1
  228. package/dist/client/static/js/markdown-xed7y3ds.js +0 -1
  229. package/dist/client/static/js/one-dark-pro-mq6sn6a2.js +0 -1
  230. package/dist/client/static/js/one-light-pt6t6vax.js +0 -1
  231. package/dist/client/static/js/packet-AYTQ26CC-01vcsy6x.js +0 -1
  232. package/dist/client/static/js/pie-WAS4IAKB-053gzkmh.js +0 -1
  233. package/dist/client/static/js/properties-8ysbq2n2.js +0 -1
  234. package/dist/client/static/js/python-4ysexc8s.js +0 -1
  235. package/dist/client/static/js/r-hrsw5arc.js +0 -1
  236. package/dist/client/static/js/radar-RG4KPBEZ-bkpby8am.js +0 -1
  237. package/dist/client/static/js/railroad-74A4TZTK-67bxrjgw.js +0 -1
  238. package/dist/client/static/js/railroad-abnf-HS5TGJTU-xj9ymacg.js +0 -1
  239. package/dist/client/static/js/railroad-ebnf-LZEXJU2U-2xxpbnf6.js +0 -1
  240. package/dist/client/static/js/railroad-peg-WCYAUIDC-78w88znz.js +0 -1
  241. package/dist/client/static/js/sql-hd42h8wx.js +0 -1
  242. package/dist/client/static/js/swimlanesDiagram-TC7HE7FX-rz309qrx.js +0 -8
  243. package/dist/client/static/js/treeView-Q6P3EWNA-g2bkjr4z.js +0 -1
  244. package/dist/client/static/js/treemap-WGGIJYW6-pj7yw9rw.js +0 -1
  245. package/dist/client/static/js/tsx-xjp2ds8g.js +0 -1
  246. package/dist/client/static/js/typescript-yg97da8h.js +0 -1
  247. package/dist/client/static/js/wardley-WFR3VGLG-c7ekf8r2.js +0 -1
  248. package/dist/client/static/js/xml-nrb23phz.js +0 -1
  249. package/dist/client/static/js/yaml-sqs6pjpx.js +0 -1
@@ -95,8 +95,91 @@ export interface DeepSeekUsageReport {
95
95
  error?: string;
96
96
  }
97
97
 
98
- /** Unit of a provider-reported quota amount (mirrors omp's `UsageUnit`). */
99
- export type UsageUnit = 'percent' | 'tokens' | 'requests' | 'credits' | 'usd' | 'minutes' | 'bytes' | 'unknown';
98
+ /**
99
+ * The allowance Token Harbor reports for one account
100
+ * (`GET https://tokenharbor.ai/api/cli/free-tier`).
101
+ *
102
+ * Percentages only, by contract: the endpoint states how much of each allowance
103
+ * is used and never a dollar remainder, so a card built from it must not imply
104
+ * an amount. A Pass allowance and the free-model allowance are metered
105
+ * separately but share ONE 7-day window, hence a single `resetAt`.
106
+ */
107
+ export interface TokenHarborAllowance {
108
+ /** "Agent Pass" | "Office Pass" | "Frontier Pass", or null without a Pass. */
109
+ planName: string | null;
110
+ /** False when the account holds no Pass: there is no Pass allowance to draw. */
111
+ onPlan: boolean;
112
+ /** Percent of the 7-day Pass allowance used (0-100), null on schema drift. */
113
+ planUsedPct: number | null;
114
+ /**
115
+ * The Pass allowance is spent for this window. Authoritative over
116
+ * `planUsedPct`: the percentage is rounded, so it can read 100 on a request
117
+ * that is still covered and 99 on the one that is refused.
118
+ */
119
+ planExhausted: boolean;
120
+ /** Percent of the free-model allowance used (0-100), null on schema drift. */
121
+ usedPct: number | null;
122
+ /** The free allowance is spent for this window. */
123
+ exhausted: boolean;
124
+ /** False until the first request starts the 7-day window. */
125
+ activated: boolean;
126
+ /** When both allowances come back in full; null before the first request. */
127
+ resetAt: string | null;
128
+ periodStartedAt: string | null;
129
+ periodEndsAt: string | null;
130
+ /**
131
+ * The `:free` ids the key can call right now, as the endpoint spells them.
132
+ * Kept verbatim: the docs show a `:free` suffix the live response omits, so
133
+ * rebuilding ids from these would invent a model that does not resolve.
134
+ */
135
+ freeModels: string[];
136
+ /** False when free models are switched off for the account (calls get 403). */
137
+ modelsEnabled: boolean;
138
+ }
139
+
140
+ /** Token Harbor allowance; present only when Token Harbor has a credential. */
141
+ export interface TokenHarborUsageReport {
142
+ allowance?: TokenHarborAllowance;
143
+ error?: string;
144
+ }
145
+
146
+ /**
147
+ * The wallet TokenPortal reports for one API key (`GET /v1/key`).
148
+ *
149
+ * The endpoint is OpenRouter-shaped, but the numbers are the vendor's own: both
150
+ * money fields are whole units of the `currency` it names (IDR on the live
151
+ * endpoint), NOT cents — `balance` is what is left, `limit` the key's cap, and
152
+ * `limitRemaining` what is left under that cap.
153
+ */
154
+ export interface TokenPortalBalance {
155
+ /** The key's own label ("Kabmo"), when the endpoint names it. */
156
+ label: string | null;
157
+ /** ISO 4217 code the amounts are denominated in. */
158
+ currency: string;
159
+ /** Money left on this key, in whole `currency` units. */
160
+ balance: number;
161
+ /** The key's spending cap, when the operator set one. */
162
+ limit: number | null;
163
+ /** Money left under that cap, as the vendor reports it. */
164
+ limitRemaining: number | null;
165
+ /** True while the key is on the free tier. */
166
+ isFreeTier: boolean;
167
+ /** A per-session cap, when the operator set one. */
168
+ sessionBudget: number | null;
169
+ }
170
+
171
+ /** TokenPortal wallet; present only when TokenPortal has a credential. */
172
+ export interface TokenPortalUsageReport {
173
+ balance?: TokenPortalBalance;
174
+ error?: string;
175
+ }
176
+
177
+ /**
178
+ * Unit of a provider-reported quota amount (mirrors omp's `UsageUnit`, plus
179
+ * `idr` for the Rupiah wallets Kabmo reads itself — an IDR amount formatted as
180
+ * USD would misstate the balance by four orders of magnitude).
181
+ */
182
+ export type UsageUnit = 'percent' | 'tokens' | 'requests' | 'credits' | 'usd' | 'idr' | 'minutes' | 'bytes' | 'unknown';
100
183
 
101
184
  /** Coarse state of one quota window. */
102
185
  export type UsageWindowStatus = 'ok' | 'warning' | 'exhausted' | 'unknown';
@@ -172,6 +255,10 @@ export interface UsageProviderSummary {
172
255
  kenari?: KenariUsageReport;
173
256
  /** Rich DeepSeek report (prepaid balance). */
174
257
  deepseek?: DeepSeekUsageReport;
258
+ /** Rich Token Harbor report (Pass + free allowance percentages). */
259
+ tokenHarbor?: TokenHarborUsageReport;
260
+ /** Rich TokenPortal report (wallet, key cap, session budget). */
261
+ tokenPortal?: TokenPortalUsageReport;
175
262
  }
176
263
 
177
264
  /** Response body of `GET /api/settings/usage`. */
@@ -1 +0,0 @@
1
- import{e,m,Rr}from"./index-x2v1zmth.js";import{Ei,iu}from"./index-p6s3fz6b.js";function g({source:t,name:r,revision:s=0}){let{url:i,loading:n,error:o}=iu(t,s);if(o)return e(Rr,{name:r,message:o});if(n||!i)return e("div",{className:"flex flex-1 items-center justify-center gap-2 text-xs text-ink/40",children:[e(m,{size:14,className:"animate-spin"}),e("span",{children:"Loading image…"})]});return e(Ei,{src:i,name:r,className:"flex-1 min-h-0"})}export{g as ImageView};
@@ -1,2 +0,0 @@
1
- import{d,n,o,K,i,u,a,We,le,Ot,dc,e,s,De,Ee,m,nn,rn,_,at,an,f,B,se,ot,re,fe,Tt,Ke,pn,me,qe,ce,ka,Yr,mn,xa,Zn,P,D,U,tl,b,er,nl,Oe,xe,ln,wA,Ha,Vp,gn,rl,Te,Dt,Io,$e,ol,Sr,ue,Z,ct,os,is,od,mc,ge,He,ls,JA,Ac,Et,Qt,Rt,bc,ul,So,dl,pl,dd,Do,Ve,tt,ra,Ye,Ja,gl,Lc,Sa,Mc,md,As,Ta,Qo,Ro,Fo,It,nr,vs,Lo,Mo,Po,Za,hl,bl,yl,vl,rr,Vm,Ym,Oo,zc,Jm,ks,xs,Zm,ws,ef,tf,nf,Uc,hi,kl,Da,bi,rf,af,Gc,jc,of,sf,zh,bd,Uh,zo,yd,xn,lf,cf,uf,df,xl,zg,no,Ef,Bf,Hc,Sl,Nf,Qf,Sd,Rf,o0}from"./index-x2v1zmth.js";import{Fd}from"./index-d2xtbabt.js";import{Jc,Zc,Xc,eu,tu,nu,ru,Bs,au,ou,Go,Is,Ei,su,Tl,lu,cu,uu,du,pu,mu,fu,gu,Au}from"./index-p6s3fz6b.js";import{Ju,Zu,ei,Xu,ed}from"./index-xk1cqjkn.js";import{mt,Bi,bu,yu,ku}from"./index-dxp2yvy7.js";import{Ts,Qa,Fr,xu,wu,jo,Cu,Ds,Gd,Zg,Ns,Qs,Rs,Lr,Fs,Ls,qo,Ms,Ps,Os,$s,_i,Ho,zs,Us,Eu,jd,Bu,Iu,_u,Su,Tu,Du}from"./index-1d8bxjsz.js";import{Ra,Fa}from"./index-52nd4hgm.js";function Je(t){let{editorOpen:r,diffOpen:l,settingsOpen:p,offMainScreen:h,onCloseEditor:g,onCloseDiff:S,onCloseSettings:v,onReturnToMain:x}=t;o(()=>o0(()=>{if(r)return g(),!0;if(l)return S(),!0;if(p)return v(),!0;if(h)return x(),!0;return!1}),[r,l,p,h,g,S,v,x])}var gt="terminal";function Ge(t){return t===gt}function Re(t){if(Ge(t))JA()}function Qe({dock:t,sessionId:r,currentScreen:l,setCurrentScreen:p}){let[h,g]=n(0),[S,v]=n(0),x=a(()=>{let k=xe(r,"layout.mobileRightPanel")??dc;Re(k),g((y)=>y+1),p("right")},[r,p]),c=a(()=>{v((k)=>k+1),p("session")},[p]),w=a((k)=>{let y=Uh(k,t);if(!y)return;let M=xe(r,"layout.mobileRightPanel");if(y==="right"&&(l!=="right"||M!==k))Re(k);if(ln(r,y==="left"?"layout.mobileLeftPanel":"layout.mobileRightPanel",k),y==="right")g(0);p(y==="left"?"session":"right")},[t,r,l,p]);return ge(bd,(k)=>{let y=k.detail?.panelKey;if(y)w(y)}),{right:h,left:S,openSessionDrawer:c,openRightDrawer:x,openNamedPanel:w}}var vt={name:"menu",size:24,node:[["path",{d:"M4 5h16",key:"1tepv9"}],["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 19h16",key:"1djgab"}]]},eo=s(vt);function Le(){let t=ls(),[r,l]=n(null),p=a((S,v)=>{l({top:v,bottom:v,left:S,right:S})},[]),h=Ju({enabled:t,onLongPress:p}),g=a(()=>l(null),[]);return{anchor:r,close:g,surfaceProps:{onContextMenu:(S)=>{S.preventDefault();let v=S.currentTarget.getBoundingClientRect();l({top:v.top,bottom:v.bottom,left:v.left,right:v.right})},onTouchStart:h.onTouchStart,onTouchMove:h.onTouchMove,onTouchEnd:h.onTouchEnd,onTouchCancel:h.onTouchCancel,onClickCapture:(S)=>{if(!h.consume())return;S.preventDefault(),S.stopPropagation()}}}}var St=10,oo=600000;function to({activeSessionTitle:t,activeSessionId:r,onOpenSessionSidebar:l,onOpenRightSidebar:p,onNewSession:h,onSelectSession:g}){let{folders:S}=Ye(),v=Sd(),x=Ta(r),[c,w]=n(null),{hidden:k,setHidden:y}=cf(),M=Le(),T=yd("mobile"),I=u(()=>{let C=Date.now(),A=[];for(let E of S)for(let O of E.sessions??[]){if(O.is_archived===1)continue;let R=wA(String(O.id)),L=O.updated_at?Date.parse(O.updated_at):0,q=R!==void 0&&C-R<=oo?R:L;if(R!==void 0&&C-R>oo)continue;A.push({id:O.id,title:O.title,folderName:E.name,modified:q})}return A.sort((E,O)=>O.modified-E.modified).slice(0,St)},[S]),N=t?t.charAt(0).toUpperCase()+t.slice(1):"New session";return e("header",{className:`flex-shrink-0 bg-canvas border-b border-ink/10 flex items-center justify-between ${ol} px-3 z-20 titlebar-drag-region select-none`,...Da(),...M.surfaceProps,style:zo(),children:[e("div",{className:"flex items-center space-x-2 flex-1 min-w-0 titlebar-no-drag",children:[e("button",{type:"button",onClick:l,className:"w-9 h-9 rounded-lg hover:bg-ink/5 active:bg-ink/10 text-ink transition-colors flex-shrink-0 inline-flex items-center justify-center",title:"Open Sessions","aria-label":"Open Sessions",children:e(eo,{size:20,strokeWidth:2})}),e("span",{className:"relative font-bold text-sm tracking-tight flex items-center flex-shrink-0",children:[e(Sa,{glow:!0}),e("span",{className:"absolute -top-0.5 -right-1.5 flex",children:e(Uc,{status:v})})]}),e("span",{className:"text-ink/25 font-light text-xs flex-shrink-0 select-none",children:"/"}),e("div",{className:"relative min-w-0 flex-1 max-w-[150px]","data-testid":"session-picker",children:[e("button",{type:"button",onClick:(C)=>{w((A)=>A?null:Et(C.currentTarget))},className:"tap-chip flex w-full items-center space-x-1 text-xs font-semibold text-ink hover:text-ink/80 transition-colors py-1 min-w-0",title:N,"aria-haspopup":"menu","aria-expanded":c!==null,children:[e("span",{className:"truncate",children:N}),x&&e(m,{size:12,className:"animate-spin text-ink/50 flex-shrink-0",role:"status","aria-label":"Generating a session name…"}),e(B,{size:13,className:"text-ink/50 flex-shrink-0"})]}),c&&e(Qt,{anchor:c,align:"start",className:"w-72 bg-paper border border-ink/15 rounded-xl shadow-lg p-2 text-xs",onClose:()=>w(null),children:[e("button",{type:"button",onClick:()=>{w(null),h()},className:"w-full text-left px-3 py-2 rounded-lg bg-ink text-canvas flex items-center space-x-2 font-medium mb-1.5",children:[e(P,{size:14}),e("span",{children:"Start New Session"})]}),e("div",{className:"px-2 py-1 text-[10px] uppercase font-bold text-ink/40",children:"Recent Sessions"}),e("div",{className:"max-h-64 scrollbar-overlay-container space-y-0.5",children:I.length===0?e("div",{className:"px-2.5 py-2 text-ink/40 italic",children:"No sessions yet"}):I.map((C)=>e("button",{type:"button",onClick:()=>{w(null),g(C.id)},className:`w-full text-left px-2.5 py-1.5 rounded-lg flex items-center justify-between space-x-2 transition-colors ${String(r)===String(C.id)?"bg-ink/10 font-semibold text-ink":"hover:bg-ink/5 text-ink/80"}`,children:[e("span",{className:"min-w-0 flex flex-col",children:[e("span",{className:"truncate",children:C.title?C.title.charAt(0).toUpperCase()+C.title.slice(1):"Untitled"}),e("span",{className:"truncate text-[10px] text-ink/40 font-mono",children:C.folderName})]}),String(r)===String(C.id)&&e(f,{size:12,className:"flex-shrink-0"})]},C.id))})]})]})]}),e(uf,{layout:"mobile",sessionId:r==null?null:String(r),showRightPanel:!1,onToggleRightPanel:p,entries:T,hidden:k}),M.anchor?e(Oo,{anchor:M.anchor,title:"Navbar",align:"right",items:lf([...T.inline,...T.folded]).filter((C)=>C.id!==xn.install).map((C)=>({...C,removable:!0})),hidden:k,onToggle:y,onClose:M.close}):null]})}function io({activeSessionId:t,onSelectSession:r,onNewSession:l,onOpenSessionSidebar:p,onOpenRightSidebar:h,appSettings:g={}}){let{folders:S}=Ye(),[v,x]=n(null),c=u(()=>{if(!t)return"New session";for(let k of S){let y=k.sessions?.find((M)=>String(M.id)===String(t));if(y)return y.title}return null},[t,S]);return e("div",{className:"flex flex-col h-full w-full bg-canvas text-ink relative",children:[e(to,{activeSessionTitle:v||c||"New session",activeSessionId:t,onOpenSessionSidebar:p,onOpenRightSidebar:h,onNewSession:l,onSelectSession:r}),e("main",{className:"flex-1 min-h-0",children:e(Bf,{appSettings:g,onSessionTitle:x,variant:"mobile"})})]})}function ro({onClose:t,viewLabel:r="Sessions",menuProps:l}){return e("div",{className:"border-b border-ink/10 flex items-center justify-between px-3 flex-shrink-0 bg-canvas titlebar-drag-region select-none",...Da(),...l,style:{...zo()},children:[e("div",{className:"flex items-center space-x-2.5 titlebar-no-drag min-w-0",children:[e("span",{className:"font-bold text-sm tracking-tight flex items-center flex-shrink-0",children:e(Sa,{className:"text-[16px]",glow:!0})}),e("span",{className:"text-ink/25 text-xs select-none flex-shrink-0",children:"/"}),e("span",{className:"text-[11px] font-semibold text-ink/60 uppercase tracking-wider font-mono truncate",children:r})]}),e("div",{className:"flex items-center gap-1 titlebar-no-drag flex-shrink-0",children:[e(df,{variant:"chip"}),e("button",{type:"button",onClick:t,className:"w-9 h-9 rounded-xl hover:bg-ink/5 active:bg-ink/10 text-ink flex items-center justify-center transition-colors cursor-pointer",title:"Close sidebar","aria-label":"Close sidebar",children:e(b,{size:19,strokeWidth:2})})]})]})}function so({onSettings:t,onKeyBindings:r,onAbout:l,updateAvailable:p,onUpdateClick:h,onDesktopToggle:g,shellDownload:S}){return e("div",{className:"px-3 pt-3 border-t border-ink/10 flex items-center justify-between flex-shrink-0 bg-canvas text-xs text-ink/60",style:{paddingBottom:"max(0.75rem, env(safe-area-inset-bottom, 0px))"},children:[e("div",{className:"flex items-center space-x-3",children:[e("button",{type:"button",onClick:t,className:"flex items-center space-x-1 hover:text-ink transition-colors",children:[e(tl,{size:14}),e("span",{children:"Settings"})]}),e("button",{type:"button",onClick:r,className:"flex items-center space-x-1 hover:text-ink transition-colors",children:[e(ka,{size:14}),e("span",{children:"Keys"})]}),e("button",{type:"button",onClick:l,className:"flex items-center space-x-1 hover:text-ink transition-colors",children:[e(ce,{size:14}),e("span",{children:"About"})]}),S&&e(nf,{download:S,variant:"label"}),g&&e("button",{type:"button",onClick:g,className:"flex items-center space-x-1 hover:text-ink transition-colors",title:"Switch to desktop view",children:[e(xa,{size:14}),e("span",{children:"Desktop"})]})]}),e("div",{className:"flex items-center gap-2",children:[e("span",{className:"font-mono text-[10px] text-ink/40",children:["v",Lc.version]}),p&&e("button",{type:"button",onClick:h,className:"px-2 py-0.5 rounded-full border border-ink/20 text-[10px] font-semibold text-ink hover:border-ink/40",children:"update"})]})]})}function ao(t){let r=rf(),l=tf();return ge(Mc,()=>{t.onClose(),t.openAbout(),r.apply("kabmo").then((p)=>{if(!p)return;t.pushToast(p.message,mc(p))})}),af(r,t.pushToast),{updates:r,shellDownload:l}}function lo(t,r,l){return t.filter((p)=>p.id!==r&&!(l&&p.side==="left"))}function co(t){return t}var xt=8;function Be({panels:t,activeId:r,onSelect:l,hasGitChanges:p=!1}){let h=i(null),g=i(new Map),S=i({activeId:r,panels:t});S.current={activeId:r,panels:t};let v=i({signature:"",width:0}),x=a(()=>{let c=h.current,w=g.current.get(S.current.activeId);if(!c||!w||c.clientWidth<=0)return;let k=`${S.current.activeId}\x00${S.current.panels.map((N)=>N.id).join("\x00")}`,y=v.current;if(y.signature===k&&y.width===c.clientWidth)return;v.current={signature:k,width:c.clientWidth};let M=c.getBoundingClientRect(),T=w.getBoundingClientRect(),I=Jm({scrollLeft:c.scrollLeft,clientWidth:c.clientWidth,scrollWidth:c.scrollWidth,start:T.left-M.left+c.scrollLeft,size:T.width},xt);if(I!==c.scrollLeft)c.scrollLeft=I},[]);return K(x,[r,t,x]),o(()=>{let c=h.current;if(!c||typeof ResizeObserver>"u")return;let w=new ResizeObserver(x);return w.observe(c),()=>w.disconnect()},[x]),e("div",{ref:h,className:"flex items-center space-x-1.5 overflow-x-auto no-scrollbar py-1",children:t.map((c)=>{let w=c.id===r;return e("button",{ref:(k)=>{if(k)g.current.set(c.id,k);else g.current.delete(c.id)},type:"button",onClick:()=>l(c.id),"aria-pressed":w,"aria-label":c.title,className:`tap-chip relative flex shrink-0 items-center transition-all cursor-pointer ${w?"space-x-1.5 px-3 py-1.5 rounded-lg text-xs font-semibold bg-ink text-canvas shadow-sm":"p-2 rounded-lg text-ink/70 hover:bg-ink/5"}`,title:c.title,children:[e(Ja,{panelId:c.id,builtin:c.builtin,icon:c.builtin?c.icon:void 0,name:c.builtin?c.label:c.name,...c.iconUrl?{iconUrl:c.iconUrl}:{},...c.color?{color:c.color}:{},size:Ot}),w&&e("span",{className:`shrink-0 whitespace-nowrap ${c.id==="git"?"tracking-wide":""}`,children:c.label}),c.id==="git"&&p&&e("span",{className:"absolute top-1 right-1 w-1.5 h-1.5 rounded-full bg-info",title:"Uncommitted changes"})]},c.id)})})}function po({panels:t,activeId:r,onSelect:l,menuProps:p}){return e("div",{className:"px-3 py-1.5 border-b border-ink/10 bg-canvas flex-shrink-0",...p,children:e(Be,{panels:t,activeId:r,onSelect:l})})}function mo({panelKey:t,panel:r,body:l}){if(!r)return e("div",{className:"flex-1 min-h-0",children:e(zc,{panelKey:t})});return e("div",{className:"flex-1 min-h-0 overflow-hidden relative",children:e(We,{fallback:e("div",{className:"h-full flex items-center justify-center text-ink/40",children:e("span",{className:"text-xs font-mono",children:"Loading…"})}),children:e(Io,{value:l,children:r.render(l)})})})}var Ae="w-9.5 h-9.5 rounded-xl border flex items-center justify-center transition-all flex-shrink-0 cursor-pointer shadow-xs",Fe="border-ink/15 bg-paper hover:bg-ink/5 text-ink/80 hover:text-ink",uo="bg-ink/10 text-ink border-ink/30";function fo({searchQuery:t,sortOption:r,optionsOpen:l,showArchived:p,optionsRef:h,onNewSession:g,onNewWorkspace:S,onScheduler:v,scheduledCount:x,onRefresh:c,refreshing:w,onToggleOptions:k,onSortChange:y,onResetSort:M,onToggleArchived:T,onHideArchived:I,onSearchChange:N,onClearSearch:C,onSelectWorkspaces:A,selecting:E}){let{ref:O,width:R}=Ds(0),L=Zg(R),q={};for(let X of Gd.slice(0,L))q[X]=!0;let z=Gd.slice(L),F=p?"Hide archived sessions":"Show archived sessions",te=x>0?`Scheduled tasks (${x} armed)`:"Scheduled tasks",H=[];if(z.includes("new-workspace"))H.push({id:"new-workspace",label:"New Workspace",icon:pn,onSelect:S});if(z.includes("refresh"))H.push({id:"refresh",label:"Refresh sessions",icon:D,onSelect:c});if(z.includes("scheduler"))H.push({id:"scheduler",label:te,icon:Qa,onSelect:v});if(z.includes("archive"))H.push({id:"archive",label:F,icon:at,onSelect:T,active:p});if(z.includes("select"))H.push({id:"select",label:E?"Cancel selection":"Select workspaces",icon:Fr,onSelect:A,active:E});return e("div",{className:"p-3 border-b border-ink/10 flex flex-col space-y-2.5 flex-shrink-0 bg-canvas",children:[e("div",{ref:O,className:"flex items-center space-x-2",children:[e("button",{type:"button",onClick:g,"aria-label":"New Session",title:"New Session",className:"flex-1 min-w-0 h-9.5 flex items-center justify-center space-x-2 px-3.5 rounded-xl bg-ink text-canvas hover:bg-ink/90 text-xs font-semibold transition-all shadow-xs",children:[e(P,{size:15,strokeWidth:2.4,className:"shrink-0"}),e("span",{className:"min-w-0 truncate",children:"New Session"})]}),q["new-workspace"]&&e("button",{type:"button",onClick:S,className:`${Ae} ${Fe}`,title:"New Workspace","aria-label":"New Workspace",children:e(pn,{size:16,strokeWidth:1.8})}),q.scheduler&&e("button",{type:"button",onClick:v,className:`relative ${Ae} ${Fe}`,title:te,"aria-label":x>0?`Scheduled tasks, ${x} armed`:"Scheduled tasks",children:[e(Qa,{size:16,strokeWidth:1.8}),x>0&&e("span",{className:"absolute -top-0.5 -right-0.5 min-w-[13px] h-[13px] px-[3px] rounded-full bg-ink text-canvas text-[10px] leading-[13px] text-center font-semibold",children:x>9?"9+":x})]}),q.archive&&e("button",{type:"button",onClick:T,"aria-pressed":p,className:`${Ae} ${p?"bg-warning/15 border-warning/40 text-warning":Fe}`,title:F,"aria-label":F,children:e(at,{size:16,strokeWidth:1.8})}),q.select&&e("button",{type:"button",onClick:A,"aria-pressed":E,className:`${Ae} ${E?uo:Fe}`,title:E?"Cancel selection":"Select workspaces","aria-label":E?"Cancel selection":"Select workspaces",children:e(Fr,{size:16,strokeWidth:1.8})}),q.refresh&&e("button",{type:"button",onClick:c,className:`${Ae} ${Fe}`,title:"Refresh sessions","aria-label":"Refresh sessions","aria-busy":w,children:e(D,{size:15,strokeWidth:1.8,className:w?"animate-spin":void 0})}),q.sort&&e("div",{className:"relative flex-shrink-0",ref:h,children:[e("button",{type:"button",onClick:k,className:`${Ae} ${l||r!=="A-Z"?uo:Fe}`,title:"Sort workspaces","aria-label":"Sort workspaces",children:e(Ts,{size:15,strokeWidth:1.8})}),l&&e("div",{className:"glass-popover absolute right-0 top-full mt-2 w-52 bg-paper border border-ink/15 rounded-xl shadow-xl z-50 p-2 text-xs",children:e(jo,{variant:"mobile",sortOption:r,onSortChange:y})})]}),z.length>0&&e(Cu,{actions:H,sortHidden:z.includes("sort"),sortOption:r,onSortChange:y,layout:"mobile"})]}),e("div",{className:"relative flex items-center",children:[e(U,{size:14,className:"absolute left-3 text-ink/40"}),e("input",{type:"text",value:t,onChange:(X)=>N(X.currentTarget.value),placeholder:"Search workspaces & sessions...",className:"w-full bg-paper border border-ink/15 rounded-xl pl-8 pr-8 py-2 text-xs text-ink placeholder-ink/40 focus:outline-none focus:border-ink/40 transition-colors font-mono"}),t&&e("button",{type:"button",onClick:C,className:"absolute right-2.5 text-ink/40 hover:text-ink p-1","aria-label":"Clear search",children:e(b,{size:13})})]}),(p||r!=="A-Z")&&e("div",{className:"flex items-center space-x-1.5 flex-wrap gap-y-1 pt-0.5",children:[r!=="A-Z"&&e("span",{className:"inline-flex items-center space-x-1 bg-ink/5 border border-ink/10 text-ink/80 rounded-lg px-2 py-0.5 text-[10px] font-mono",children:[e("span",{children:["Sort: ",r.replace("_"," ")]}),e("button",{type:"button",onClick:M,className:"hover:text-ink ml-0.5",title:"Reset sort",children:e(b,{size:10})})]}),p&&e("span",{className:"inline-flex items-center space-x-1 bg-warning/15 border border-warning/25 text-warning rounded-lg px-2 py-0.5 text-[10px] font-mono",children:[e(at,{size:10}),e("span",{children:"Archived"}),e("button",{type:"button",onClick:I,className:"hover:text-warning-hover ml-0.5",title:"Hide archived",children:e(b,{size:10})})]})]})]})}var wt="p-1.5 rounded-lg hover:bg-ink/10 active:bg-ink/15 text-ink/60 hover:text-ink";function ho({folder:t,canWorktree:r,onOpenFolder:l,onNewWorktree:p,onSelectSessions:h,confirmDelete:g,onPin:S,onDelete:v,onRequestDelete:x,onCancelDelete:c}){let[w,k]=n(!1),y=i(null),[M,T]=n(null),I=(N)=>()=>{k(!1),N()};return e("div",{className:"relative flex items-center",onClick:(N)=>N.stopPropagation(),children:[e("button",{ref:y,type:"button",onClick:(N)=>{if(N.stopPropagation(),y.current)T(Et(y.current));k((C)=>!C)},className:wt,title:"Workspace options","aria-label":`Options for ${t.name}`,"aria-haspopup":"menu","aria-expanded":w,children:e(Ee,{size:15})}),e(Qt,{anchor:w?M:null,align:"end",ariaLabel:`Options for ${t.name}`,className:"w-48 rounded-lg border border-ink/15 bg-paper py-1 text-xs shadow-lg",onClose:()=>{k(!1),c()},children:e(Os,{variant:"mobile",isPinned:t.isPinned,onOpenFolder:l?I(l):void 0,onNewWorktree:r&&p?I(p):void 0,onSelectSessions:h?I(h):void 0,confirmDelete:g,onPin:I(S),onDelete:I(v),onRequestDelete:x,onCancelDelete:c})})]})}var bo={inset:"",insetPx:0,slotWidth:16,markGap:8,padding:"py-2",glyph:tt.touch};function go({session:t,harness:r,isActive:l,status:p,awaitingInput:h=!1,timeAgo:g,timeTitle:S,runStartedAt:v,expandable:x=!1,isExpanded:c=!1,onToggleExpand:w,isChild:k=!1,folderId:y,onSelect:M,onArchive:T,onDelete:I,onRename:N,onRenameWithAi:C,waitingFor:A,onCancelWait:E,selectable:O=!1,selected:R=!1,onToggleSelect:L}){let{isEditing:q,draft:z,setDraft:F,inputRef:te,startRename:H,handleKeyDown:X,handleBlur:ae}=Fo(t.title,N),W=Ta(t.id),ne=Lo(),ie=ne.anchor!==null,ee=Boolean(N||T||I||E),J=Boolean(A),de=x&&Boolean(w),Q=t.title.charAt(0).toUpperCase()+t.title.slice(1);if(q)return e("div",{className:"w-full rounded-lg flex items-center bg-ink/10",children:e("input",{ref:te,autoFocus:!0,value:z,onChange:(oe)=>F(oe.currentTarget.value),onKeyDown:X,onBlur:ae,className:"flex-1 min-w-0 mx-2 my-1.5 bg-paper border border-ink/25 rounded px-2 py-1 text-xs text-ink outline-none focus:border-ink/50"})});return e(d,{children:[e("div",{"data-testid":"session-item","data-session-id":String(t.id),"data-menu-open":ie?"true":void 0,onContextMenu:ee&&!O?ne.openAtCursor:void 0,className:`w-full rounded-lg flex items-center transition-colors ${O&&R||ie?Ps:l?"bg-ink/10 font-medium text-ink":"hover:bg-ink/5 text-ink/85"}`,children:[e("button",{type:"button",onClick:O?L:M,className:"flex-1 text-left py-2 flex items-center justify-between min-w-0",children:[e("div",{className:"flex items-center min-w-0 pr-2",children:[O?e(Lr,{checked:R,label:`Select ${t.title}`,onChange:()=>L?.()}):e("span",{className:"w-4 flex-shrink-0 flex items-center justify-center",children:W?e("span",{role:"status","aria-label":"Generating a name…",children:e(m,{size:13,className:"text-ink/50 animate-spin"})}):h?e(De,{size:13,className:"text-ink/70 animate-pulse"}):J?e("span",{role:"status","aria-label":`Waiting for ${A?.title??"another session"}`,children:e(qe,{size:13,className:"text-ink/60 animate-pulse"})}):p==="stream"?e("span",{role:"status","aria-label":"Running",children:e(m,{size:13,className:"text-ink/50 animate-spin"})}):p?e(f,{size:13,className:"text-ink/50"}):k?e("span",{"data-testid":"child-indicator",className:"text-ink/35","aria-hidden":"true",children:e(me,{size:13})}):null}),e("span",{className:"flex flex-col min-w-0 ml-2 leading-snug",children:[e("span",{className:"flex min-w-0 items-center",children:[r&&e("span",{className:"mr-1.5 flex shrink-0 items-center",children:e(Ve,{harness:r,size:tt.touch})}),e("span",{className:"min-w-0 truncate text-xs",children:Q})]}),J&&e("span",{className:"text-[10px] text-ink/40 truncate",children:["waiting for ",A?.title??"another session"]}),t.worktree?e(Fs,{worktree:t.worktree}):null]})]}),e(Ms,{timeAgo:g,timeTitle:S,runStartedAt:v,className:"text-[11px] font-mono flex-shrink-0 ml-2",restingClassName:"text-ink/45"})]}),ee&&!O&&e("button",{type:"button",onClick:ne.openBelow,title:"Session actions","aria-label":"Session actions","aria-haspopup":"menu","aria-expanded":ie,className:"flex-shrink-0 py-1.5 pl-1.5 pr-1 text-ink/35 hover:text-ink rounded-lg cursor-pointer",children:e(Ee,{size:16})}),de&&!O&&e("button",{type:"button",onClick:w,title:c?"Collapse sessions and subagents":"Expand sessions and subagents","aria-expanded":c,"aria-label":c?"Collapse sessions and subagents":"Expand sessions and subagents",className:"flex-shrink-0 py-1.5 pl-1.5 pr-1 flex items-center justify-center text-ink/50 hover:text-ink rounded-lg cursor-pointer",children:c?e(B,{size:14}):e(se,{size:14})})]}),ne.anchor&&e(Mo,{anchor:ne.anchor,sessionId:t.id,...r?{harness:r}:{},...y!==void 0?{folderId:y}:{},isArchived:t.is_archived===1,onRename:N?H:void 0,onRenameWithAi:C,onArchive:T,onDelete:I,onCancelWait:E,onClose:ne.close})]})}function vo(t,r){let[l,p]=n(!1);return{open:()=>p(!0),dialog:l?e(Po,{isOpen:!0,onClose:()=>p(!1),root:t.project_path??null,folderId:t.id,folderName:t.name,onCreated:(h)=>{p(!1),r(h.path)}}):null}}function xo({hiddenCount:t,canShowLess:r,onShowMore:l,onShowLess:p}){if(t<=0&&!r)return null;return e("div",{className:"flex items-center gap-1",children:[t>0&&e("button",{type:"button",onClick:l,className:"flex items-center min-w-0 text-left py-2 pr-3 text-xs text-ink/60 hover:text-ink",children:[e("span",{className:"w-4 h-4 flex-shrink-0 flex items-center justify-center",children:e(B,{size:12})}),e("span",{className:"w-2 shrink-0"}),e("span",{className:"truncate",children:["Show more sessions (",t,")"]})]}),r&&e("button",{type:"button",onClick:p,className:"ml-auto shrink-0 flex items-center gap-1 text-xs text-ink/60 hover:text-ink pl-3 py-2",children:[e(ot,{size:12}),e("span",{className:"truncate",children:"Show less"})]})]})}function wo(t){return t?"mb-4":"mb-1"}function ko({folder:t,activeSessionId:r,onSelectSession:l,onNewSessionForFolder:p,onNewWorktreeSession:h,isExpanded:g,onToggleExpand:S,showArchived:v=!1,sessionStatus:x={},onToast:c,batch:w,onStartSessionSelection:k,onCancelWait:y}){let{visibleCount:M,showMore:T,showLess:I,canShowLess:N}=Qs(),C=vo(t,(G)=>h?.(t.id,G)),{refresh:A,runStartedAtMap:E}=Ye(),{expandedSessionIds:O,toggleSession:R}=vs(),[L]=le(),q=L.get("subagent"),z=L.get("sessionId"),{confirmDelete:F,requestDelete:te,cancelDelete:H,handlePin:X,handleDelete:ae,handleArchive:W,handleRename:ne,handleRenameWithAi:ie,handleOpenFolder:ee}=Rs(t,A,c),J=Qo(),de=X,Q=ae,oe=ee??void 0,pe=(t.sessions||[]).filter((G)=>v?G.is_archived===1:G.is_archived!==1),ke=ra(t.icon),{folderCheckbox:be,sessionCheckboxes:he,folderSummary:V,toggleFolderSelection:j,rendered:Y,hiddenCount:ye}=zs({batch:w,folder:t,sessions:pe,showArchived:v,visibleCount:M,activeSessionId:r,sessionStatus:x}),Pe=Ho(Y),Se=g||he,Ne=(G,Me)=>{let ve=String(G.id),Ze=String(r)===ve,ht=Ze&&z===ve&&Boolean(q),Ue=It(ve);return e(go,{session:G,harness:G.harness,folderId:G.folder_id,isActive:Ze&&!ht,status:x[ve],awaitingInput:Boolean(G.awaitingInput),timeAgo:Ls(G.updated_at??G.created_at),timeTitle:qo(G.updated_at??G.created_at),runStartedAt:x[ve]==="stream"?E[ve]:void 0,expandable:Me.expandable,isChild:Me.isChild,isExpanded:Me.isExpanded,onToggleExpand:Me.onToggleExpand,onSelect:()=>l(G.id),onArchive:()=>W(G),onDelete:Ue?void 0:()=>J.requestDelete(G),onRename:Ue?void 0:(bt)=>void ne(G,bt),onRenameWithAi:Ue?void 0:()=>void ie(G),waitingFor:G.waitingFor?{title:G.waitingFor.title}:void 0,onCancelWait:G.waitingFor?()=>y?.(G.waitingFor.waitId):void 0,selectable:he,selected:Boolean(w?.selected.includes(ve)),onToggleSelect:w?()=>w.toggle(ve):void 0})},ft=(G)=>$s(G,Pe.childrenOf,O,R);return e("div",{className:wo(Se),"data-testid":"session-folder",children:[e("div",{onClick:w?void 0:S,className:"flex items-center justify-between gap-2 py-1 cursor-pointer hover:bg-ink/5 rounded-lg select-none transition-colors",children:[e("div",{className:"flex items-center space-x-2 min-w-0",children:[be&&V?e(Lr,{size:"md",checked:V.all,indeterminate:V.some,label:`Select ${t.name}`,onChange:j}):e(d,{children:e("span",{className:"w-4 h-4 flex items-center justify-center flex-shrink-0",children:t.customIconUrl?e("img",{src:t.customIconUrl,alt:"",className:"w-[15px] h-[15px] rounded-xs object-contain",referrerPolicy:"no-referrer"}):t.iconType==="chat"?e(mn,{size:15,className:"text-ink/80"}):e(ke,{size:15,className:"text-ink/80",style:{color:t.accentColor||void 0}})})}),e("span",{className:"text-sm font-semibold text-ink truncate",children:t.name})]}),e("div",{className:"flex items-center space-x-2 text-xs text-ink/60",children:[e("span",{className:"font-mono text-[11px] text-ink/70",children:pe.length}),t.project_path&&e(me,{size:13,className:"text-ink/50 ml-1"}),!w&&e(d,{children:[e("button",{type:"button",onClick:(G)=>{G.stopPropagation(),p(t.id)},className:"p-1.5 rounded-lg hover:bg-ink/10 active:bg-ink/15 text-ink/60 hover:text-ink",title:"New Session","aria-label":`New session in ${t.name}`,children:e(P,{size:15})}),e(ho,{folder:t,canWorktree:Boolean(h&&t.project_path),onOpenFolder:oe,onNewWorktree:h?()=>C.open():void 0,onSelectSessions:k?()=>k(t.id):void 0,confirmDelete:F,onPin:de,onDelete:Q,onRequestDelete:te,onCancelDelete:H}),e("span",{className:"flex items-center justify-center pr-1",children:g?e(B,{size:14}):e(se,{size:14})})]})]})]}),Se&&e("div",{className:"mt-0.5 space-y-0.5",children:[Pe.roots.map((G)=>{let Me=String(G.id),ve=ft(G);return e("div",{className:"space-y-0.5",children:[Ne(G,ve),ve.isExpanded&&e(_i,{parentId:Me,hasSubagents:Boolean(G.hasSubagents),childrenOf:Pe.childrenOf,expandedIds:O,onToggle:R,activeSessionId:r===null?null:String(r),renderSession:Ne,style:bo})]},G.id)}),e(xo,{hiddenCount:he?0:ye,canShowLess:!he&&N,onShowMore:T,onShowLess:I})]}),e(Ro,{session:J.pending,isDeleting:J.isDeleting,error:J.error,onClose:J.cancelDelete,onConfirm:()=>void J.confirmDelete()}),C.dialog]})}function yo({folders:t,activeSessionId:r,expandedFolders:l,showArchived:p,sessionStatus:h,onSelectSession:g,onNewSessionForFolder:S,onNewWorktreeSession:v,onToggleFolder:x,onToast:c,batch:w,onStartSessionSelection:k,onCancelWait:y}){return e("div",{className:"flex-1 scrollbar-overlay-container pl-3 pr-2 py-3",children:t.length===0?e("div",{className:"text-center py-12 text-xs text-ink/50 italic",children:"No matching sessions found"}):t.map((M)=>e(ko,{folder:M,activeSessionId:r,onSelectSession:g,onNewSessionForFolder:S,onNewWorktreeSession:v,isExpanded:l[M.id]??!0,onToggleExpand:()=>x(M.id),showArchived:p,sessionStatus:h,onToast:c,batch:w,onStartSessionSelection:k,onCancelWait:y},M.id))})}var kt=[3,2];function No(){return e("div",{className:"flex-1 p-3 space-y-4","aria-hidden":"true",children:kt.map((t,r)=>e("div",{className:"space-y-2",children:[e("div",{className:"flex items-center gap-2 py-2",children:[e("span",{className:"w-4 h-4 rounded-sm animate-pulse bg-ink/10"}),e("span",{className:"h-3 w-24 rounded animate-pulse bg-ink/10"})]}),Array.from({length:t},(l,p)=>e("div",{className:"flex items-center gap-2 rounded py-2",children:[e("span",{className:"w-4 h-4 rounded-full animate-pulse bg-ink/10"}),e("span",{className:"h-3 rounded animate-pulse bg-ink/10",style:{width:`${58-p%3*12}%`}})]},p))]},r))})}function Co({folders:t,initializing:r,failed:l,activeSessionId:p,expandedFolders:h,sessionStatus:g,searchQuery:S,sortOption:v,optionsOpen:x,showArchived:c,harnessFilter:w,onHarnessFilterChange:k,harnessOptions:y,optionsRef:M,scheduledCount:T,refreshing:I,selecting:N,batch:C,onNewSession:A,onNewWorkspace:E,onScheduler:O,onRefresh:R,onToggleOptions:L,onSortChange:q,onResetSort:z,onToggleArchived:F,onHideArchived:te,onSearchChange:H,onClearSearch:X,onSelectWorkspaces:ae,onSelectSession:W,onNewSessionForFolder:ne,onNewWorktreeSession:ie,onToggleFolder:ee,onToast:J,onStartSessionSelection:de,onCancelWait:Q}){return e(d,{children:[e(fo,{searchQuery:S,sortOption:v,optionsOpen:x,showArchived:c,optionsRef:M,onNewSession:A,onNewWorkspace:E,onScheduler:O,scheduledCount:T,onRefresh:R,refreshing:I,onToggleOptions:L,onSortChange:q,onResetSort:z,onToggleArchived:F,onHideArchived:te,onSearchChange:H,onClearSearch:X,onSelectWorkspaces:ae,selecting:N}),e("div",{className:"px-3 pt-2 pb-1",children:e(Ns,{options:y,value:w,onChange:k,touch:!0})}),l?e(Us,{touch:!0,onRetry:R,refreshing:I}):r?e(No,{}):e(yo,{folders:t,activeSessionId:p,expandedFolders:h,showArchived:c,sessionStatus:g,onSelectSession:W,onNewSessionForFolder:ne,onNewWorktreeSession:ie,onToggleFolder:ee,onToast:J,batch:C,onStartSessionSelection:de,onCancelWait:Q})]})}function To({sidebarStyle:t,controller:r,batch:l,dock:p,dockBody:h,expandedFolders:g,optionsRef:S,activeSessionId:v,scheduledCount:x,onToggleFolder:c,onNewSession:w,onNewWorkspace:k,onScheduler:y,onToggleArchived:M,onNewSessionForFolder:T,onNewWorktreeSession:I,onToast:N,onArchiveSelected:C,onCancelWait:A}){let{initializing:E,failed:O,refreshNow:R,isRefreshing:L,searchQuery:q,setSearchQuery:z,showArchived:F,setShowArchived:te,optionsOpen:H,setOptionsOpen:X,sortOption:ae,handleSortChange:W,harnessFilter:ne,setHarnessFilter:ie,harnessOptions:ee,processedFolders:J,sessionStatus:de,handleSelectSession:Q}=r,{selection:oe,deleteRun:pe,archiveRun:ke,binding:be,scopeFolder:he,available:V,selected:j}=l,Y={className:"flex-1 min-h-0 w-full",folders:J,initializing:E,failed:O,activeSessionId:v,sessionStatus:de,searchQuery:q,onSearchChange:z,showArchived:F,onToggleArchived:M,sortOption:ae,optionsOpen:H,onToggleOptions:()=>X(!H),onCloseOptions:()=>X(!1),onSortChange:W,harnessFilter:ne,onHarnessFilterChange:ie,harnessOptions:ee,onRefresh:R,refreshing:L,scheduledCount:x,onNewSession:w,onNewWorkspace:k,onScheduler:y,onSelectSession:Q,onNewSessionForFolder:T,onNewWorktreeSession:I,onToast:N,onCancelWait:A,batch:be,onSelectWorkspaces:l.toggleWorkspaceSelection,onStartSessionSelection:(ye)=>oe.begin("session",ye)};return e(d,{children:[e("div",{className:p.showingSessions?"contents":"hidden",children:[t==="modern"?e(Eu,{...Y,touch:!0}):e(Co,{folders:J,initializing:E,failed:O,activeSessionId:v,expandedFolders:g,sessionStatus:de,searchQuery:q,sortOption:ae,optionsOpen:H,showArchived:F,harnessFilter:ne,onHarnessFilterChange:ie,harnessOptions:ee,optionsRef:S,scheduledCount:x,refreshing:L,selecting:oe.mode!==null,batch:be,onNewSession:w,onNewWorkspace:k,onScheduler:y,onRefresh:R,onToggleOptions:()=>X(!H),onSortChange:W,onResetSort:()=>W("A-Z"),onToggleArchived:M,onHideArchived:()=>te(!1),onSearchChange:z,onClearSearch:()=>z(""),onSelectWorkspaces:l.toggleWorkspaceSelection,onSelectSession:Q,onNewSessionForFolder:T,onNewWorktreeSession:I,onToggleFolder:c,onToast:N,onStartSessionSelection:(ye)=>oe.begin("session",ye),onCancelWait:A}),oe.mode&&e(Tu,{drawer:!0,mode:oe.mode,count:j.length,total:V.length,busy:pe.isDeleting,archiving:ke.isArchiving,scopeLabel:he?.name,onSelectAll:()=>oe.selectAllOf(V),onUnselectAll:()=>oe.unselectAllOf(V),onDelete:()=>pe.request(j),onArchive:C,onCancel:oe.end})]}),p.showingSessions?null:e(mo,{panelKey:p.activeView,panel:p.activePanel,body:h})]})}function Eo(t,r){let l=t.tabs;ws({enabled:t.tabsMode,revealed:Zm(r),storedView:t.activeView,home:l?.home??!1,chosenHome:l?.chosenHome??!1,openTab:l?.open??null,known:new Set(t.catalog.map((g)=>g.id))});let p=i(!1),h=l?{...l,select:(g)=>{p.current=!0,l.select(g)},open:(g)=>{p.current=!0,l.open(g)},close:(g)=>{p.current=!0,l.close(g)}}:null;return o(()=>{if(!t.tabsMode||!l)return;if(l.active!==null&&l.active!==t.activeView)t.setActiveView(l.active)},[t.tabsMode,l?.active,t.activeView,t.setActiveView]),o(()=>{if(!t.tabsMode||!l)return;if(p.current){p.current=!1;return}if(l.tabs.includes(t.activeView))return;if(!t.catalog.some((g)=>g.id===t.activeView))return;l.open(t.activeView)},[t.tabsMode,l,t.activeView,t.catalog]),{tabs:h}}function _e(t){return{dragRegion:!0,layout:"mobile",rootProps:{...Da(),...t},style:{paddingLeft:bi(hi("0.75rem",!0)),paddingRight:kl("0.75rem",!0)}}}function Ao({side:t,onClose:r}){let l=t==="left"?nn:Zn;return e("button",{type:"button",onClick:r,className:`${$e.mobile} flex-none cursor-pointer rounded-lg text-ink/60 transition-colors hover:bg-ink/5 hover:text-ink titlebar-no-drag`,title:t==="left"?"Tutup panel kiri":"Tutup panel kanan","aria-label":t==="left"?"Close left sidebar":"Close right sidebar",children:e(l,{size:Sr.mobile,strokeWidth:1.8})})}function Wo({activeSessionId:t,newWorkspaceOpen:r,onCloseNewWorkspace:l,schedulerOpen:p,onCloseScheduler:h,aboutOpen:g,onCloseAbout:S,updates:v,pushToast:x,batchDelete:c,batchMode:w,onEndBatch:k,scopeLabel:y}){return e(d,{children:[e(As,{isOpen:r,onClose:l,onCreate:yl,onClone:vl}),e(wu,{isOpen:p,onClose:h,activeSessionId:t===null?null:String(t),onToast:x}),e(md,{isOpen:g,onClose:S,updates:v,onToast:x}),e(ef,{updates:v}),e(Du,{mode:w??"session",count:c.pending.length,scopeLabel:y,isDeleting:c.isDeleting,progress:c.progress,outcome:c.outcome,onClose:()=>{let M=c.outcome?.refused.length??0;if(c.cancel(),c.outcome&&M===0)k()},onConfirm:()=>{let M=w??"session";c.confirm(M).then((T)=>{if(T&&T.refused.length===0)k()})}})]})}function Bo(){let t=Dt(),r=rr("left"),[l,p]=Ha("layout.mobileLeftPanel",Te),h=Vm(l,t.enabled),g=Fd("left"),S=t.enabled&&g==="tabs",v=u(()=>new Set(r.map((c)=>c.id)),[r]),x=xs("left",v,Te);return{catalog:r,activeView:h,setActiveView:p,showingSessions:h===Te,activePanel:r.find((c)=>c.id===h),enabled:t.enabled,tabsMode:S,tabs:S?x:null}}function _o(t){return{className:"w-full h-full",sessionId:t.sessionId===null?null:String(t.sessionId),enabled:t.requiresWorkspace?t.hasActiveContext===!0:!0,active:!0,refreshKey:t.refreshKey,...t.rootPath?{rootPath:t.rootPath}:{},...t.onRefresh?{onRefresh:t.onRefresh}:{},...t.onOpenFile?{onOpenFile:t.onOpenFile}:{},onClose:t.onClose,showHeader:!1,layout:"phone"}}function Vo({appSettings:t,onSelectSession:r,onClose:l,rootPath:p,refreshKey:h,onRefresh:g,onOpenFile:S}){let v=Bu(t,{onSelectSession:r,onAfterSelect:l}),{folders:x,processedFolders:c,refreshNow:w,showArchived:k,activeSessionId:y}=v,M=Su(c,k,w),[T,I]=n({1:!0,2:!0,3:!0}),N=i(null);ue(N,()=>v.setOptionsOpen(!1));let C=(R)=>{I((z)=>({...z,[R]:!z[R]}));let L=x.find((z)=>z.id===R),q=!(T[R]??L?.isExpanded??!0);jd(R,q)},A=c.map((R)=>`${R.id}:${R.isExpanded}`).join("|");o(()=>{I(Object.fromEntries(c.map((R)=>[R.id,R.isExpanded])))},[A]);let E=Bo(),O=_o({sessionId:y,refreshKey:h,rootPath:p,onRefresh:g,onOpenFile:S,onClose:l,requiresWorkspace:E.activePanel?.requiresWorkspace??!1,hasActiveContext:Boolean(p)});return{controller:v,batch:M,expandedFolders:T,toggleFolder:C,optionsRef:N,dock:E,dockBody:O}}function ze(t){let{disabledPanels:r}=gn(),{setEnabled:l}=rl(),p=Le(),h=Ym(t),g=a((S,v)=>{l(S,v)},[l]);return{...p,items:h,hidden:r,toggle:g}}function Ko({activeSessionId:t,onSelectSession:r,onNewSession:l,onNewSessionForFolder:p,onNewWorktreeSession:h,onClose:g,onDesktopToggle:S,appSettings:v={},rootPath:x,refreshKey:c=0,onRefresh:w,onOpenFile:k,revealSignal:y=0}){let{controller:M,batch:T,expandedFolders:I,toggleFolder:N,optionsRef:C,dock:A,dockBody:E}=Vo({appSettings:v,onSelectSession:r,onClose:g,rootPath:x,refreshKey:c,onRefresh:w,onOpenFile:k}),{showArchived:O,setShowArchived:R}=M,{selection:L,deleteRun:q,archiveRun:z,selected:F,scopeFolder:te}=T,H=dd(),X=ze("left"),[ae,W]=n(!1),[ne,ie]=n(!1),ee=xu(),[J,de]=n(!1),{pushToast:Q}=He(),oe=bl(Q);Iu({onNotice:Q});let{updates:pe,shellDownload:ke}=ao({onClose:g,openAbout:()=>de(!0),pushToast:Q}),{tabs:be}=Eo(A,y),he=()=>{l(),g()},V=()=>{z.archive(F).then((Se)=>{if(!Se)return;let Ne=_u(Se);if(Ne)Q(Ne.message,Ne.tone);if(!Se.error)L.end()})},j=(Se)=>{p(Se),g()},Y=()=>{R(!O)},ye=h?(Se,Ne)=>{h(Se,Ne),g()}:void 0,Pe=e(To,{sidebarStyle:H,controller:M,batch:T,dock:A,dockBody:E,expandedFolders:I,optionsRef:C,activeSessionId:t,scheduledCount:ee,onToggleFolder:N,onNewSession:he,onNewWorkspace:()=>W(!0),onScheduler:()=>ie(!0),onToggleArchived:Y,onNewSessionForFolder:j,...ye?{onNewWorktreeSession:ye}:{},onToast:Q,onArchiveSelected:V,onCancelWait:oe});return e("div",{className:"flex flex-col h-full w-full bg-canvas text-ink relative select-none",children:[e(ro,{onClose:g,viewLabel:A.showingSessions?"Sessions":A.activePanel?.label??"Panel",menuProps:X.surfaceProps}),!A.tabsMode&&co(A.enabled)?e(po,{panels:A.catalog,activeId:A.activeView,onSelect:A.setActiveView,menuProps:X.surfaceProps}):null,A.tabsMode&&be?e("div",{className:"flex-1 min-h-0 flex flex-col",children:e(ks,{catalog:A.catalog,tabs:be,pinned:Te,homeTitle:"Panel kiri",stripProps:_e(X.surfaceProps),children:e("div",{className:"h-full w-full",children:Pe})})}):null,X.anchor?e(Oo,{anchor:X.anchor,items:X.items,hidden:X.hidden,onToggle:X.toggle,onClose:X.close}):null,A.tabsMode?null:e("div",{className:"contents",children:Pe}),e(so,{onSettings:()=>window.dispatchEvent(new CustomEvent("omp:open-settings",{detail:{}})),onKeyBindings:Gc,onAbout:()=>de(!0),shellDownload:ke,onDesktopToggle:S,updateAvailable:pe.hasUpdate,onUpdateClick:()=>{de(!0),pe.check()}}),e(Wo,{activeSessionId:t,newWorkspaceOpen:ae,onCloseNewWorkspace:()=>W(!1),schedulerOpen:ne,onCloseScheduler:()=>ie(!1),aboutOpen:J,onCloseAbout:()=>de(!1),updates:pe,pushToast:Q,batchDelete:q,batchMode:L.mode,onEndBatch:L.end,scopeLabel:te?.name})]})}function $o({catalog:t,activeId:r,onSelect:l,hasGitChanges:p,onClose:h,menuProps:g}){return e("div",{className:"border-b border-ink/10 flex items-center justify-between px-3 flex-shrink-0 bg-canvas titlebar-drag-region select-none",...Da(),...g,style:zo(),children:[e("div",{className:"flex items-center min-w-0 titlebar-no-drag",children:e(Be,{panels:t,activeId:r,onSelect:l,hasGitChanges:p})}),e("button",{type:"button",onClick:h,className:"p-1.5 rounded-lg hover:bg-ink/5 active:bg-ink/10 text-ink transition-colors flex-shrink-0 ml-2 titlebar-no-drag",title:"Close right sidebar","aria-label":"Close right sidebar",children:e(b,{size:20,strokeWidth:1.8})})]})}function je({panel:t,body:r}){if(!t)return e("div",{className:"h-full flex items-center justify-center text-ink/40",children:e("span",{className:"text-xs font-mono text-muted",children:"No session selected"})});return e(We,{fallback:e("div",{className:"h-full flex items-center justify-center text-ink/40",children:e("span",{className:"text-xs font-mono",children:"Loading…"})}),children:e(Io,{value:r,children:t.render(r)})})}function Uo({enabled:t=!0,rootPath:r,refreshKey:l=0,onRefresh:p,onOpenFile:h,onClose:g,revealSignal:S=0}){let[v,x]=Ha("layout.mobileRightPanel",dc),{sessionId:c}=Oe(),w=Dt(),k=lo(rr("all"),Te,w.enabled),y=k.find((W)=>W.id===v)??k[0],T=Fd("right")==="tabs",I=u(()=>new Set(k.map((W)=>W.id)),[k]),N=xs("right",I,null),C=xe(c,"layout.mobileRightPanel")!==void 0;ws({enabled:T,revealed:Zm(S),storedView:C?v:null,home:N.home,chosenHome:N.chosenHome,openTab:N.open,known:I});let{open:A,tabs:E}=N,O=(W)=>{if(W!==y?.id)Re(W)},R=i(!1),L={...N,select:(W)=>{R.current=!0,O(W),N.select(W)},open:(W)=>{R.current=!0,O(W),N.open(W)},close:(W)=>{R.current=!0,N.close(W)}};o(()=>{if(!T)return;if(N.active!==null&&N.active!==v)x(N.active)},[T,N.active,v,x]),o(()=>{if(!T||N.home)return;if(R.current){R.current=!1;return}if(!C)return;if(E.includes(v)||!I.has(v))return;A(v)},[T,N.home,C,v,E,A,I]);let q=Vp(r,t),{changes:z}=nl(r,q,t),F=z.length>0,te=a((W)=>{if(W!==y?.id)Re(W);x(W)},[y?.id,x]);o(()=>{if(!Ge(y?.id))Ac()},[y?.id]);let H=ze(w.enabled?"right":"all"),X=w.enabled?H.items:H.items.filter((W)=>W.id!==Te),ae={className:"h-full w-full",enabled:t||!y?.requiresWorkspace,active:!0,refreshKey:l,...r?{rootPath:r}:{},onRefresh:p,onOpenFile:h,onClose:g,showHeader:!1,layout:"phone"};return e("div",{className:"flex flex-col h-full w-full bg-paper text-ink relative select-none",children:[T?null:e($o,{catalog:k,activeId:y?.id??v,onSelect:te,hasGitChanges:F,onClose:g,menuProps:H.surfaceProps}),T?e("div",{className:"flex-1 min-h-0 flex flex-col",children:e(ks,{catalog:k,tabs:L,homeTitle:"Panel kanan",stripProps:_e(H.surfaceProps),actions:e(Ao,{side:"right",onClose:g}),children:e("div",{className:"h-full w-full",children:e(je,{panel:y,body:ae})})})}):null,H.anchor?e(Oo,{anchor:H.anchor,align:"right",items:X,hidden:H.hidden,onToggle:H.toggle,onClose:H.close}):null,T?null:e("div",{className:"flex-1 min-h-0 overflow-hidden relative",style:{paddingBottom:"env(safe-area-inset-bottom, 0px)"},children:e(je,{panel:y,body:ae})})]})}function Ce({label:t,onClick:r,active:l=!1,danger:p=!1,children:h}){let g=p?"bg-error text-canvas hover:bg-error/90":l?"bg-ink text-canvas":"text-ink/70 hover:bg-ink/10 hover:text-ink";return e("button",{type:"button",onClick:r,title:t,"aria-label":t,"aria-pressed":l||void 0,className:`${$e.mobile} flex-none cursor-pointer rounded-lg transition-colors ${g}`,children:h})}var we=Sr.mobile;function Xo({actions:t}){let[r,l]=n(!1),p=i(null);return ue(p,()=>l(!1),r),o(()=>{if(!r)return;let h=(g)=>{if(g.key==="Escape")l(!1)};return window.addEventListener("keydown",h),()=>window.removeEventListener("keydown",h)},[r]),e("div",{className:"relative flex-none",ref:p,children:[e("button",{type:"button",onClick:()=>l((h)=>!h),title:"More file actions","aria-label":"More file actions","aria-haspopup":"menu","aria-expanded":r,className:`${$e.mobile} flex-none cursor-pointer rounded-lg text-ink/70 transition-colors hover:bg-ink/10 hover:text-ink`,children:e(Ee,{size:Sr.mobile})}),r?e("div",{role:"menu","aria-label":"File actions",className:"absolute right-0 top-full z-50 mt-1 w-52 overflow-hidden rounded-xl border border-ink/15 bg-paper py-1 text-xs shadow-lg",children:t.map((h)=>{let g=h.icon;return e("button",{type:"button",role:"menuitem",onClick:()=>{l(!1),h.onSelect()},className:"flex w-full items-center gap-2 px-3 py-2.5 text-left text-ink/80 transition-colors hover:bg-ink/5 hover:text-ink",children:[e(g,{size:15,className:"flex-none text-ink/60"}),e("span",{className:"truncate",children:h.label})]},h.id)})}):null]})}var yt=420;function Yo({fileName:t,hasPreview:r,isPreview:l,hasReview:p,isReviewing:h,onToggleReview:g,wordWrap:S,copied:v,byteViewer:x=!1,missing:c=!1,onSave:w,onClose:k,onTogglePreview:y,onToggleFind:M,findOpen:T,onToggleWrap:I,onZoomOut:N,onZoomIn:C,onCopy:A,onDownload:E}){let O=jc(yt),R=u(()=>{let L=[];if(!x)L.push({id:"wrap",label:S?"Word wrap: on":"Word wrap: off",icon:rn,onSelect:I},{id:"zoom-out",label:"Decrease font size",icon:Fa,onSelect:N},{id:"zoom-in",label:"Increase font size",icon:Ra,onSelect:C});if(!O)L.push({id:"copy",label:v?"Copied":"Copy content",icon:v?f:re,onSelect:A},{id:"download",label:"Download file",icon:fe,onSelect:E});return L},[x,O,S,v,I,N,C,A,E]);return e("header",{className:"bg-canvas border-b border-ink/10 flex items-center justify-between gap-1 px-3 flex-shrink-0 titlebar-drag-region",style:zo(),children:[e("div",{className:"flex items-center gap-1 min-w-0 titlebar-no-drag",children:[e(Ce,{label:"Close editor",onClick:k,children:e(an,{size:we,strokeWidth:2})}),e("div",{className:"flex min-w-0 items-center gap-1.5",children:[e(ct,{name:t,size:15,className:`flex-shrink-0${c?" text-error":""}`}),e("span",{className:`truncate font-semibold text-xs${c?" text-error line-through":" text-ink"}`,children:t})]})]}),e("div",{className:"flex flex-none items-center gap-0.5 text-ink/70 titlebar-no-drag",children:[c&&w&&e(Ce,{label:"Save and recreate the file",onClick:w,danger:!0,children:e(mt,{size:we})}),!x&&e(Ce,{label:T?"Close find":"Find in file",onClick:M,active:T,children:e(U,{size:we})}),p&&e(Ce,{label:h?"Exit review mode":"Review this document",onClick:g,active:h,children:e(mn,{size:we})}),r&&e(Ce,{label:l?"View source":"Show preview",onClick:y,active:l,children:l?e(Tt,{size:we}):e(Ke,{size:we})}),O&&e(d,{children:[e(Ce,{label:"Copy content",onClick:A,children:v?e(f,{size:we,className:"text-success"}):e(re,{size:we})}),e(Ce,{label:"Download file",onClick:E,children:e(fe,{size:we})})]}),R.length>0&&e(Xo,{actions:R})]})]})}function Zo({fileName:t,content:r,path:l,root:p,repo:h,fontSize:g,scrollRef:S,onScroll:v,isLoading:x,unsupported:c,loadError:w,reviewActive:k,onExitReview:y}){return e("div",{ref:S,onScroll:v,"data-testid":"editor-scroller",className:"flex-1 min-h-0 overflow-auto relative bg-paper text-ink select-text",children:x?e("div",{className:"flex items-center justify-center h-full text-ink/40 text-xs gap-2",children:[e(m,{size:14,className:"animate-spin"}),e("span",{children:"Loading file content..."})]}):c?e("div",{className:"flex flex-col items-center justify-center h-full gap-2 px-6 text-center",children:[e(Jc,{size:20,className:"text-ink/40"}),e("span",{className:"text-xs text-ink/70 font-sans",children:[t," cannot be opened here"]}),e("span",{className:"text-[11px] text-ink/50 font-sans max-w-[42ch]",children:c})]}):w?e("div",{className:"flex flex-col items-center justify-center h-full gap-2 px-6 text-center",children:[e(_,{size:20,className:"text-error"}),e("span",{className:"text-xs text-error font-sans",children:["Could not read ",t]}),e("span",{className:"text-[11px] text-ink/50 font-mono break-all",children:w})]}):e("div",{className:"p-4 bg-paper text-ink min-h-full font-sans",style:{fontSize:`${g}px`},children:e(Xc,{content:r,file:{name:t,path:l,root:p,repo:h},active:k,onExit:y})})})}function Jo({file:t,editor:r,viewerKind:l,byteViewer:p,isPreview:h,isMd:g,content:S,language:v,wordWrap:x,fileKey:c,revealMarks:w,currentMark:k,surfaceRef:y,setCodeScroller:M,previewRef:T,scroll:I,fontSize:N,reviewActive:C,onExitReview:A,editorTheme:E,editorFontFamily:O,indentUnitText:R,typing:L}){let q=a(async(z)=>{let F=await cu(t,z,{interactive:!0,baseMtimeMs:r.baseMtimeMs});if(F.status==="written")return{ok:!0};if(F.status==="conflict")return{ok:!1,error:"This file changed on disk since it was opened."};if(F.status==="needs-permission")return{ok:!1,error:"Tap Save again to grant write access."};return{ok:!1,error:F.error}},[t,r.baseMtimeMs]);if(r.isImage&&r.imageUrl)return e(Ei,{src:r.imageUrl,name:t.name,className:"flex-1 min-h-0"});if(r.isImage||su(l)&&(p||h))return e(Tl,{kind:l,path:t.path??t.name,name:t.name,source:r.byteSource,content:r.content,root:t.root,repo:t.repo,revision:r.revision,onContentChange:r.onChange,onSaveBytes:r.deviceBacked?void 0:q,onDirtyChange:r.setBinaryDirty});if(r.isLoading||r.unsupported||r.loadError||g&&h)return e(Zo,{fileName:t.name,content:S,path:t.path??t.name,root:t.root,repo:t.repo,fontSize:N,scrollRef:T,onScroll:I.onScroll,isLoading:r.isLoading,unsupported:r.unsupported,loadError:r.loadError,reviewActive:C,onExitReview:A});return e(tu,{ref:y,value:S,onValueChange:r.onChange,language:v,wordWrap:x,documentKey:c,marks:w,currentMark:k,onScroller:M,scrollTestId:"editor-scroller",className:"flex-1 min-h-0 text-ink select-text",themeVars:E.vars,themes:E.themes,indentUnitText:R,typing:L,padding:12,placeholder:"This file is empty",style:{fontFamily:O,fontSize:`${N}px`,lineHeight:ul}})}function et(){return e("div",{className:"flex items-start gap-2 px-3 py-2 border-b border-error/30 bg-error/10 text-error shrink-0",children:[e(_,{size:14,className:"shrink-0 mt-0.5"}),e("div",{className:"min-w-0",children:[e("div",{className:"text-[11.5px] font-sans",children:"This file was deleted from disk."}),e("div",{className:"text-[11px] font-sans text-error/80",children:"The buffer is still here. Saving recreates the file — autosave is off until then."})]})]})}function nt({isImage:t,byteViewer:r,viewerKind:l,lineCount:p,charCount:h,language:g,saveStatus:S,path:v,conflicts:x=0}){return e("footer",{className:"bg-canvas border-t border-ink/10 px-3 flex items-center justify-between text-[10px] text-ink/60 flex-shrink-0 font-mono",style:{height:"calc(1.75rem + env(safe-area-inset-bottom, 0px))",paddingBottom:"env(safe-area-inset-bottom, 0px)",paddingLeft:"max(0.75rem, env(safe-area-inset-left, 0px))",paddingRight:"max(0.75rem, env(safe-area-inset-right, 0px))"},children:[e("div",{className:"flex items-center space-x-3",children:t?e("span",{className:"uppercase",children:"Image"}):r?e("span",{className:"uppercase",children:Go[l]}):e(d,{children:[x>0&&e("span",{className:"text-error font-semibold tabular-nums",children:["⚠ ",x]}),e("span",{children:[p," lines"]}),e("span",{children:[h," chars"]}),e("span",{className:"uppercase",children:g})]})}),e("div",{className:"flex items-center space-x-2",children:[S==="saving"&&e(d,{children:[e(m,{size:10,className:"animate-spin"}),e("span",{children:"Saving…"})]}),S==="saved"&&e(d,{children:[e("span",{className:"w-1.5 h-1.5 rounded-full bg-success"}),e("span",{children:"Saved"})]}),S==="error"&&e(d,{children:[e("span",{className:"w-1.5 h-1.5 rounded-full bg-error"}),e("span",{className:"text-error",children:"Save failed"})]}),S==="idle"&&v&&e("span",{className:"truncate max-w-[140px]",children:v})]})]})}function it({path:t,content:r,ready:l,surfaceRef:p}){let h=pu(t,r,l),g=i(null);return o(()=>{if(!h||g.current===h.request)return;g.current=h.request;let S=h.matches[h.currentIndex];if(!S)return;p.current?.select(S.start,S.end,!1),p.current?.revealOffset(S.start)},[h,p]),{matches:h?.matches??[],currentIndex:h?.currentIndex??-1}}function rt({path:t,content:r,documentKey:l,ready:p,surfaceRef:h,toggleWordWrap:g}){let S=it({path:t,content:r,ready:p,surfaceRef:h}),v=du({text:r,documentKey:l,readSelection:()=>h.current?.getSelection()??null,select:(x,c,w=!0)=>h.current?.select(x,c,w),reveal:(x)=>h.current?.revealOffset(x),applyDocument:(x,c,w)=>h.current?.applyDocument(x,c,w),toggleWordWrap:g});if(v.open&&v.matches.length>0)return{find:v,revealMarks:v.matches,currentMark:v.currentIndex};return{find:v,revealMarks:S.matches.length>0?S.matches:void 0,currentMark:S.currentIndex}}function st({path:t,symbols:r,total:l,truncated:p,emptyNotice:h,preview:g=!1}){let[S,v]=n(!1);if(!t)return null;let x=(c,w)=>{if(v(!1),g){let k=od(r,w);if(k)is({path:t,...k});return}os({path:t,line:c.line,column:c.column,length:c.name.length})};return e(d,{children:[e("div",{className:"absolute bottom-14 right-3 z-20",children:e("button",{type:"button",onClick:()=>v(!0),"aria-label":`Outline (${l} symbols)`,title:"Outline",className:"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",children:e(Yr,{size:16})})}),S&&e(Z,{onClose:()=>v(!1),maxWidthClass:"max-w-sm",zClass:"z-[70]",header:e("div",{className:"flex min-w-0 items-center gap-2",children:[e(Yr,{size:15,className:"flex-shrink-0 text-ink/50"}),e("span",{className:"text-sm font-medium",children:"Outline"}),e("span",{className:"font-mono text-[11px] text-ink/40",children:p?`${r.length}/${l}`:l})]}),children:e("div",{className:"max-h-[60vh] overflow-y-auto scrollbar-overlay-container py-1",children:[r.length===0?e("div",{className:"px-4 py-3 text-[11px] italic text-ink/40",children:h}):r.map((c,w)=>e("button",{type:"button",onClick:()=>x(c,w),"aria-label":g?`${ei(c.kind)} ${c.name}`:`${ei(c.kind)} ${c.name}, line ${c.line}`,className:"flex w-full min-w-0 items-center gap-2 px-4 py-2 text-left transition-colors hover:bg-ink/5 active:bg-ink/10",style:{paddingLeft:`${16+c.depth*12}px`},children:[e(Zu,{kind:c.kind,size:13}),e("span",{className:"min-w-0 flex-1 truncate font-mono text-[11px] text-ink",children:c.name}),!g&&e("span",{className:"flex-shrink-0 font-mono text-[10px] text-ink/40",children:c.line})]},`${c.line}:${c.kind}:${c.name}`)),p&&e("div",{className:"px-4 py-2 text-[11px] italic text-ink/40",children:Xu(l)})]})})]})}function lt({file:t,missing:r=!1,onClose:l,onFileSaved:p,onDropResult:h}){let g=Is(t.path??t.name),[S,v]=n({}),[x,c]=n(So),[w,k]=n(!0),y=Do(),M=Bi(),T=yu(),I=ku(),N=g==="markdown",C=Bs[g]===!0,A=au[g]===!0,E=t.path??t.name,O=S[E]??ou(g),R=Au(String(E)),L=N&&O,q=()=>v((Y)=>({...Y,[E]:!O})),z=Hc({enabled:Boolean(t.root),onResult:h}),F=uu(t,{flushOnUnmount:!0,reportSaveError:!0,downloadMimeType:"text/plain;charset=utf-8",onFileSaved:p,missing:r}),[te,H]=n(null),X=xl({tabKey:E,surface:N&&O?"rendered":"code",ready:F.loaded,slot:zh,element:N&&O?void 0:te}),[ae,W]=n(null),ne=a((Y)=>{X.ref(Y),W(Y)},[X.ref]);ru({path:t.path??null,scroller:ae,preview:N&&O});let ie=i(null),{find:ee,revealMarks:J,currentMark:de}=rt({path:t.path??null,content:F.content,documentKey:`${E}\x00${F.language}`,ready:F.loaded&&!F.loadError,surfaceRef:ie,toggleWordWrap:()=>k((Y)=>!Y)}),{content:Q,language:oe}=F,pe=Q.split(`
2
- `).length,ke=eu(Q);mu({file:{id:E,name:t.name,path:t.path??E},editor:F,surfaceRef:ie,isPreview:O,exitPreview:()=>v((Y)=>({...Y,[E]:!1})),publish:!1});let{symbols:be,total:he,truncated:V,notice:j}=ed({content:Q,language:oe,path:t.path??null,state:C?"not-a-document":F.loadError?"error":F.loaded?"ready":"loading",note:C?`${Go[g]} files have no text outline.`:F.loadError});return e("div",{className:"fixed inset-x-0 top-0 h-dvh z-[60] bg-paper flex flex-col font-mono text-xs select-none",...z.dropProps,...z.captureDropProps,children:[e(Sl,{visible:z.isDragging}),e(Yo,{fileName:t.name,hasPreview:A,isPreview:O,wordWrap:w,copied:F.copied,byteViewer:C,missing:r,onSave:F.saveNow,onClose:l,onTogglePreview:q,hasReview:L,isReviewing:L&&R.active,onToggleReview:R.toggle,onToggleFind:()=>ee.open?ee.close():ee.openFind(),findOpen:ee.open,onToggleWrap:()=>k(!w),onZoomOut:()=>c((Y)=>Math.max(dl,Y-1)),onZoomIn:()=>c((Y)=>Math.min(pl,Y+1)),onCopy:F.copy,onDownload:F.download}),r&&e(et,{}),F.diskChange&&e(fu,{fileName:t.name,onReload:F.reloadFromDisk,onKeepMine:F.keepMineAgainstDisk}),ee.open&&!C&&e("div",{className:"relative shrink-0 h-9 border-b border-ink/10 bg-paper",children:e(nu,{find:ee})}),e(Jo,{file:t,editor:F,viewerKind:g,byteViewer:C,isPreview:O,isMd:N,content:Q,language:oe,wordWrap:w,fileKey:E,revealMarks:J,currentMark:de,surfaceRef:ie,setCodeScroller:H,previewRef:ne,scroll:X,fontSize:x,reviewActive:L&&R.active,onExitReview:R.toggle,editorTheme:M,editorFontFamily:y,indentUnitText:bu(T),typing:I}),!C&&e(st,{path:t.path??null,symbols:be,total:he,truncated:V,emptyNotice:j,preview:N&&O}),e(nt,{isImage:F.isImage,byteViewer:C,viewerKind:g,lineCount:pe,charCount:Q.length,language:oe,saveStatus:F.saveStatus,path:t.path,conflicts:ke}),F.saveMissingConfirm&&t.path&&e(gu,{fileName:t.name,filePath:t.path,onClose:F.cancelSaveMissing,onConfirm:F.confirmSaveMissing})]})}function dt({diff:t,onClose:r,onFileSaved:l}){let p=t.path.split("/").pop()||t.path,h=Boolean(t.staged),g=t.status||"M",S=er(g,h);return e("div",{className:"fixed inset-x-0 top-0 h-dvh z-[60] bg-paper flex flex-col",children:[e("header",{className:"bg-canvas border-b border-ink/10 flex items-center justify-between px-3 flex-shrink-0",style:zo(),children:[e("div",{className:"flex items-center space-x-2 min-w-0 pr-2",children:[e("button",{type:"button",onClick:r,className:"p-1.5 -ml-1 rounded-lg hover:bg-ink/5 active:bg-ink/10 text-ink transition-colors flex-shrink-0",title:"Back","aria-label":"Close diff",children:e(an,{size:18,strokeWidth:1.9})}),e(ct,{name:p,size:14,className:"flex-shrink-0"}),e("span",{className:"font-mono text-xs text-ink font-medium truncate",title:t.path,children:p})]}),e("span",{className:`px-1.5 py-0.5 text-[10px] font-mono font-semibold rounded border flex-shrink-0 ${S.badgeBgClass}`,children:[S.charStatus," ",S.label]})]}),e("div",{className:"flex-1 min-h-0",children:e(Zc,{className:"h-full",viewModeButtons:!1,filePath:t.path,status:g,isStaged:h,root:t.root,repo:t.repo||".",journalDiff:t.journal,readOnly:Boolean(t.journal),onFileSaved:l,tabKey:t.journal?sf(t.journal.path,t.journal.from,t.journal.to):of(t.path,h)})})]})}function Ie(t,r){let l=t[r];return typeof l==="string"&&l.length>0?l:void 0}function Nt(t){let r=t.content;return typeof r==="string"?r:void 0}function Xe(t,r){let l=typeof t==="object"&&t!==null?t:{},p=(Ie(l,"path")??"").replace(/^\/+/,"");if(!p)return null;return{name:Ie(l,"name")??p.split("/").pop()??"file",path:p,content:Nt(l),root:Ie(l,"root")??r??void 0,repo:Ie(l,"repo"),handleId:Ie(l,"handleId"),deviceFile:l.deviceFile===!0?!0:void 0}}function pt(t){if(!t)return[];return[{id:"mobile-editor",path:t.path,root:t.root,repo:t.repo,content:t.content,handleId:t.handleId,deviceFile:t.deviceFile}]}function ut(t,r,l){Za(l);let p=nr(r);return ln(p,zg,{folderId:r,worktreePath:l}),t.setSearchParams((h)=>{let g=Rt(h);return g.set("sessionId",p),g.set("folderId",r.toString()),g},{replace:!0}),t.afterNavigate?.(),p}function lp({onDesktopToggle:t,appSettings:r={}}){let{folders:l,isMock:p}=Ye(),h=Dt(),{sessionId:g}=Oe(),[S,v]=le(),x=S.get("sessionId"),c=x?Number.isNaN(Number(x))?x:Number(x):null,w=S.get("folderId"),k=w?Number.isNaN(Number(w))?w:Number(w):null,[y,M]=n("main"),T=Qe({dock:h,sessionId:g,currentScreen:y,setCurrentScreen:M}),[I,N]=n(null),[C,A]=n(null),[E,O]=n(0),[R,L]=n(!1),[q,z]=n("appearance"),[F,te]=n(!1),H=a(()=>O((V)=>V+1),[]),X=lu(pt(I),E),{pushToast:ae}=He(),W=a((V)=>ae(V.message,V.ok?"success":"error"),[ae]),ne=X.size>0;Je({editorOpen:I!==null,diffOpen:C!==null,settingsOpen:R,offMainScreen:y!=="main",onCloseEditor:()=>N(null),onCloseDiff:()=>A(null),onCloseSettings:()=>{L(!1),te(!1)},onReturnToMain:()=>M("main")});let{folder:ie}=no(l,c),ee=ie??(k?l.find((V)=>String(V.id)===String(k))??null:null),J=Ef(l,c)??ee?.project_path??null,de=!!ee,Q=Hc({enabled:de,onResult:W});ge("omp:open-file",(V)=>{let Y=Xe(V.detail,J);if(Y)N(Y)}),ge("omp:open-diff",(V)=>{let j=V.detail;if(!j?.file)return;A({path:j.file.replace(/^\/+/,""),status:j.status,staged:j.staged,repo:j.repo,root:j.root??J??void 0,...j.source==="journal"&&j.journal?{journal:j.journal}:{}})}),ge("omp:view-subagent",()=>M("main")),ge("omp:open-settings",(V)=>{let j=V.detail;z(j?.category??"appearance"),te(Boolean(j?.autoOpenAdd)),L(!0)});let oe=(V)=>{v((j)=>{let Y=Rt(j);if(Y.set("sessionId",V.toString()),Y.has("subagent"))Y.delete("subagent");return Y},{replace:!0}),M("main")},pe=()=>{v(new URLSearchParams,{replace:!0}),M("main")},ke=(V)=>{let j=hl(l,x,V);if(j)Za(j);v((Y)=>bc(Y,nr(V),V),{replace:!0}),M("main")},be=(V,j)=>ut({setSearchParams:v,afterNavigate:()=>M("main")},V,j),he=a((V)=>{let j=Xe(V,J);if(j)N(j)},[J]);return e("div",{"data-testid":"app-root",className:"app-window flex flex-col h-dvh w-screen overflow-hidden bg-canvas text-ink font-sans selection:bg-ink selection:text-canvas relative",children:[e(Nf,{}),e(Qf,{isMock:p}),e(Rf,{workspacePath:J}),e("div",{className:`flex-1 min-h-0 w-full relative ${y==="main"?"block":"hidden"}`,...Q.dropProps,...Q.captureDropProps,children:[e(Sl,{visible:Q.isDragging}),e(io,{activeSessionId:c,onSelectSession:oe,onNewSession:pe,onOpenSessionSidebar:T.openSessionDrawer,onOpenRightSidebar:T.openRightDrawer,appSettings:r})]}),e("div",{className:`flex-1 min-h-0 w-full ${y==="session"?"block":"hidden"}`,children:e(Ko,{activeSessionId:c,onSelectSession:oe,onNewSession:pe,onNewSessionForFolder:ke,onNewWorktreeSession:be,onClose:()=>M("main"),onDesktopToggle:t,appSettings:r,rootPath:J??void 0,refreshKey:E,onRefresh:H,onOpenFile:he,revealSignal:T.left})}),y==="right"&&e("div",{className:"flex-1 min-h-0 w-full",children:e(Uo,{enabled:de,rootPath:J??void 0,refreshKey:E,onRefresh:H,onOpenFile:he,onClose:()=>M("main"),revealSignal:T.right})}),I&&e(lt,{file:I,missing:ne,onClose:()=>N(null),onFileSaved:H}),C&&e(dt,{diff:C,onClose:()=>A(null),onFileSaved:H}),e(gl,{isOpen:R,onClose:()=>{L(!1),te(!1)},initialCategory:q,autoOpenAddProvider:F,appSettings:r})]})}export{lp as MobileLayoutWrapper};
@@ -1 +0,0 @@
1
- import{Kf}from"./index-56rtb871.js";export{Kf as createArchitectureServices};
@@ -1 +0,0 @@
1
- import{jp}from"./index-64p1dncg.js";export{jp as default};
@@ -1 +0,0 @@
1
- import{ti}from"./index-z4530r3c.js";export{ti as default};
@@ -1 +0,0 @@
1
- import{uc}from"./index-5f4b44ay.js";import"./index-z4530r3c.js";export{uc as default};
@@ -1 +0,0 @@
1
- import{Rd,_s,s0,l0,c0,u0}from"./index-70g527sb.js";export{s0 as css,u0 as gss,_s as keywords,c0 as less,Rd as mkCSS,l0 as sCSS};
@@ -1 +0,0 @@
1
- import{Uf}from"./index-56rtb871.js";export{Uf as createCynefinServices};
@@ -1 +0,0 @@
1
- import{Vf}from"./index-56rtb871.js";export{Vf as createEventModelingServices};
@@ -1 +0,0 @@
1
- import"./index-9xsf8162.js";import"./index-a4h5np9r.js";import{i0}from"./index-62jgcgfd.js";export{i0 as diagram};
@@ -1 +0,0 @@
1
- import{Gf}from"./index-56rtb871.js";export{Gf as createGitGraphServices};
@@ -1 +0,0 @@
1
- import{fg}from"./index-nkahe229.js";import"./index-e5j5gc4h.js";import"./index-c5hjht5e.js";import"./index-1c2jvnyh.js";import"./index-dzeyd153.js";export{fg as default};
@@ -1 +0,0 @@
1
- import{Ln}from"./index-z0fkfphe.js";import"./index-1c2jvnyh.js";import"./index-hkz2mz34.js";export{Ln as default};
@@ -1,2 +0,0 @@
1
- import{En}from"./index-evmcc5qh.js";var X={};En(X,{default:()=>ua});var J={};En(J,{default:()=>io});var hr=typeof global=="object"&&global&&global.Object===Object&&global,H=hr;var cr=typeof self=="object"&&self&&self.Object===Object&&self,gr=H||cr||Function("return this")(),Ut=gr;var _r=Ut.Symbol,Bn=_r;var yt=Object.prototype,{hasOwnProperty:br,toString:Ar}=yt,G=Bn?Bn.toStringTag:void 0;function Tr(t){var e=br.call(t,G),r=t[G];try{t[G]=void 0;var o=!0}catch(f){}var a=Ar.call(t);if(o)if(e)t[G]=r;else delete t[G];return a}var bt=Tr;var wr=Object.prototype,Sr=wr.toString;function Cr(t){return Sr.call(t)}var vt=Cr;var Er="[object Null]",Ir="[object Undefined]",Ot=Bn?Bn.toStringTag:void 0;function Lr(t){if(t==null)return t===void 0?Ir:Er;return Ot&&Ot in Object(t)?bt(t):vt(t)}var ir=Lr;function jr(t){return t!=null&&typeof t=="object"}var Xt=jr;var Nr="[object Symbol]";function Dr(t){return typeof t=="symbol"||Xt(t)&&ir(t)==Nr}var Mr=Dr;function Rr(t,e){var r=-1,o=t==null?0:t.length,a=Array(o);while(++r<o)a[r]=e(t[r],r,t);return a}var ao=Rr;var Fr=Array.isArray,ke=Fr;var Br=1/0,At=Bn?Bn.prototype:void 0,Tt=At?At.toString:void 0;function wt(t){if(typeof t=="string")return t;if(ke(t))return ao(t,wt)+"";if(Mr(t))return Tt?Tt.call(t):"";var e=t+"";return e=="0"&&1/t==-Br?"-0":e}var St=wt;function Gr(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var _t=Gr;function Ur(t){return t}var yr=Ur;var zr="[object AsyncFunction]",Wr="[object Function]",Kr="[object GeneratorFunction]",Hr="[object Proxy]";function qr(t){if(!_t(t))return!1;var e=ir(t);return e==Wr||e==Kr||e==zr||e==Hr}var oo=qr;var $r=Ut["__core-js_shared__"],q=$r;var Pt=function(){var t=/[^.]+$/.exec(q&&q.keys&&q.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}();function kr(t){return!!Pt&&Pt in t}var Ct=kr;var Yr=Function.prototype,Xr=Yr.toString;function Zr(t){if(t!=null){try{return Xr.call(t)}catch(e){}try{return t+""}catch(e){}}return""}var y=Zr;var Jr=/[\\^$.*+?()[\]{}|]/g,Qr=/^\[object .+?Constructor\]$/,Vr=Function.prototype,to=Object.prototype,eo=Vr.toString,ro=to.hasOwnProperty,fo=RegExp("^"+eo.call(ro).replace(Jr,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function no(t){if(!_t(t)||Ct(t))return!1;var e=oo(t)?fo:Qr;return e.test(y(t))}var Et=no;function po(t,e){return t==null?void 0:t[e]}var It=po;function uo(t,e){var r=It(t,e);return Et(r)?r:void 0}var x=uo;var mo=x(Ut,"WeakMap"),k=mo;function xo(t,e,r){switch(r.length){case 0:return t.call(e);case 1:return t.call(e,r[0]);case 2:return t.call(e,r[0],r[1]);case 3:return t.call(e,r[0],r[1],r[2])}return t.apply(e,r)}var Lt=xo;function ho(){}var Mt=ho;var go=800,yo=16,_o=Date.now;function bo(t){var e=0,r=0;return function(){var o=_o(),a=yo-(o-r);if(r=o,a>0){if(++e>=go)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}var Nt=bo;function vo(t){return function(){return t}}var vr=vo;var Oo=function(){try{var t=x(Object,"defineProperty");return t({},"",{}),t}catch(e){}}(),$l=Oo;var Ao=!$l?yr:function(t,e){return $l(t,"toString",{configurable:!0,enumerable:!1,value:vr(e),writable:!0})},Dt=Ao;var To=Nt(Dt),Yd=To;function wo(t,e){var r=-1,o=t==null?0:t.length;while(++r<o)if(e(t[r],r,t)===!1)break;return t}var Jd=wo;function So(t,e,r,o){var a=t.length,f=r+(o?1:-1);while(o?f--:++f<a)if(e(t[f],f,t))return f;return-1}var Zd=So;function Po(t){return t!==t}var Rt=Po;function Co(t,e,r){var o=r-1,a=t.length;while(++o<a)if(t[o]===e)return o;return-1}var Ft=Co;function Eo(t,e,r){return e===e?Ft(t,e,r):Zd(t,Rt,r)}var Bt=Eo;function Io(t,e){var r=t==null?0:t.length;return!!r&&Bt(t,e,0)>-1}var zt=Io;var Lo=9007199254740991,jo=/^(?:0|[1-9]\d*)$/;function Mo(t,e){var r=typeof t;return e=e==null?Lo:e,!!e&&(r=="number"||r!="symbol"&&jo.test(t))&&(t>-1&&t%1==0&&t<e)}var Ti=Mo;function No(t,e){return t===e||t!==t&&e!==e}var ca=No;var Wt=Math.max;function Do(t,e,r){return e=Wt(e===void 0?t.length-1:e,0),function(){var o=arguments,a=-1,f=Wt(o.length-e,0),i=Array(f);while(++a<f)i[a]=o[e+a];a=-1;var n=Array(e+1);while(++a<e)n[a]=o[a];return n[e]=r(i),Lt(t,this,n)}}var Xd=Do;function Ro(t,e){return Yd(Xd(t,e,yr),t+"")}var Di=Ro;var Fo=9007199254740991;function Bo(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=Fo}var j=Bo;function Go(t){return t!=null&&j(t.length)&&!oo(t)}var In=Go;var Uo=Object.prototype;function zo(t){var e=t&&t.constructor,r=typeof e=="function"&&e.prototype||Uo;return t===r}var Ni=zo;function Wo(t,e){var r=-1,o=Array(t);while(++r<t)o[r]=e(r);return o}var Kt=Wo;var Ko="[object Arguments]";function Ho(t){return Xt(t)&&ir(t)==Ko}var ut=Ho;var Ht=Object.prototype,{hasOwnProperty:qo,propertyIsEnumerable:$o}=Ht,ko=ut(function(){return arguments}())?ut:function(t){return Xt(t)&&qo.call(t,"callee")&&!$o.call(t,"callee")},Pa=ko;function Yo(){return!1}var qt=Yo;var Yt=typeof X=="object"&&X&&!X.nodeType&&X,$t=Yt&&typeof Y=="object"&&Y&&!Y.nodeType&&Y,Xo=$t&&$t.exports===Yt,kt=Xo?Ut.Buffer:void 0,Zo=kt?kt.isBuffer:void 0,Jo=Zo||qt,ua=Jo;var Qo="[object Arguments]",Vo="[object Array]",ta="[object Boolean]",ea="[object Date]",ra="[object Error]",oa="[object Function]",aa="[object Map]",fa="[object Number]",ia="[object Object]",na="[object RegExp]",sa="[object Set]",pa="[object String]",ma="[object WeakMap]",la="[object ArrayBuffer]",da="[object DataView]",xa="[object Float32Array]",ha="[object Float64Array]",ga="[object Int8Array]",ya="[object Int16Array]",_a="[object Int32Array]",ba="[object Uint8Array]",va="[object Uint8ClampedArray]",Oa="[object Uint16Array]",Aa="[object Uint32Array]",u={};u[xa]=u[ha]=u[ga]=u[ya]=u[_a]=u[ba]=u[va]=u[Oa]=u[Aa]=!0;u[Qo]=u[Vo]=u[la]=u[ta]=u[da]=u[ea]=u[ra]=u[oa]=u[aa]=u[fa]=u[ia]=u[na]=u[sa]=u[pa]=u[ma]=!1;function Ta(t){return Xt(t)&&j(t.length)&&!!u[ir(t)]}var Zt=Ta;function wa(t){return function(e){return t(e)}}var Qi=wa;var Jt=typeof J=="object"&&J&&!J.nodeType&&J,U=Jt&&typeof Z=="object"&&Z&&!Z.nodeType&&Z,Sa=U&&U.exports===Jt,mt=Sa&&H.process,Ca=function(){try{var t=U&&U.require&&U.require("util").types;if(t)return t;return mt&&mt.binding&&mt.binding("util")}catch(e){}}(),io=Ca;var Qt=io&&io.isTypedArray,Ea=Qt?Qi(Qt):Zt,Ri=Ea;var Ia=Object.prototype,La=Ia.hasOwnProperty;function ja(t,e){var r=ke(t),o=!r&&Pa(t),a=!r&&!o&&ua(t),f=!r&&!o&&!a&&Ri(t),i=r||o||a||f,n=i?Kt(t.length,String):[],s=n.length;for(var p in t)if((e||La.call(t,p))&&!(i&&(p=="length"||a&&(p=="offset"||p=="parent")||f&&(p=="buffer"||p=="byteLength"||p=="byteOffset")||Ti(p,s))))n.push(p);return n}var ep=ja;function Ma(t,e){return function(r){return t(e(r))}}var tp=Ma;var Na=tp(Object.keys,Object),Vt=Na;var Da=Object.prototype,Ra=Da.hasOwnProperty;function Fa(t){if(!Ni(t))return Vt(t);var e=[];for(var r in Object(t))if(Ra.call(t,r)&&r!="constructor")e.push(r);return e}var zl=Fa;function Ba(t){return In(t)?ep(t):zl(t)}var Gt=Ba;var Ga=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Ua=/^\w*$/;function za(t,e){if(ke(t))return!1;var r=typeof t;if(r=="number"||r=="symbol"||r=="boolean"||t==null||Mr(t))return!0;return Ua.test(t)||!Ga.test(t)||e!=null&&t in Object(e)}var M=za;var Wa=x(Object,"create"),_=Wa;function Ka(){this.__data__=_?_(null):{},this.size=0}var te=Ka;function Ha(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}var ee=Ha;var qa="__lodash_hash_undefined__",$a=Object.prototype,ka=$a.hasOwnProperty;function Ya(t){var e=this.__data__;if(_){var r=e[t];return r===qa?void 0:r}return ka.call(e,t)?e[t]:void 0}var re=Ya;var Xa=Object.prototype,Za=Xa.hasOwnProperty;function Ja(t){var e=this.__data__;return _?e[t]!==void 0:Za.call(e,t)}var oe=Ja;var Qa="__lodash_hash_undefined__";function Va(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=_&&e===void 0?Qa:e,this}var ae=Va;function N(t){var e=-1,r=t==null?0:t.length;this.clear();while(++e<r){var o=t[e];this.set(o[0],o[1])}}N.prototype.clear=te;N.prototype.delete=ee;N.prototype.get=re;N.prototype.has=oe;N.prototype.set=ae;var lt=N;function tf(){this.__data__=[],this.size=0}var fe=tf;function ef(t,e){var r=t.length;while(r--)if(ca(t[r][0],e))return r;return-1}var O=ef;var rf=Array.prototype,of=rf.splice;function af(t){var e=this.__data__,r=O(e,t);if(r<0)return!1;var o=e.length-1;if(r==o)e.pop();else of.call(e,r,1);return--this.size,!0}var ie=af;function ff(t){var e=this.__data__,r=O(e,t);return r<0?void 0:e[r][1]}var ne=ff;function nf(t){return O(this.__data__,t)>-1}var se=nf;function sf(t,e){var r=this.__data__,o=O(r,t);if(o<0)++this.size,r.push([t,e]);else r[o][1]=e;return this}var pe=sf;function D(t){var e=-1,r=t==null?0:t.length;this.clear();while(++e<r){var o=t[e];this.set(o[0],o[1])}}D.prototype.clear=fe;D.prototype.delete=ie;D.prototype.get=ne;D.prototype.has=se;D.prototype.set=pe;var A=D;var pf=x(Ut,"Map"),T=pf;function uf(){this.size=0,this.__data__={hash:new lt,map:new(T||A),string:new lt}}var ue=uf;function mf(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}var me=mf;function lf(t,e){var r=t.__data__;return me(e)?r[typeof e=="string"?"string":"hash"]:r.map}var w=lf;function df(t){var e=w(this,t).delete(t);return this.size-=e?1:0,e}var le=df;function xf(t){return w(this,t).get(t)}var de=xf;function hf(t){return w(this,t).has(t)}var xe=hf;function cf(t,e){var r=w(this,t),o=r.size;return r.set(t,e),this.size+=r.size==o?0:1,this}var he=cf;function R(t){var e=-1,r=t==null?0:t.length;this.clear();while(++e<r){var o=t[e];this.set(o[0],o[1])}}R.prototype.clear=ue;R.prototype.delete=le;R.prototype.get=de;R.prototype.has=xe;R.prototype.set=he;var E=R;var gf="Expected a function";function dt(t,e){if(typeof t!="function"||e!=null&&typeof e!="function")throw TypeError(gf);var r=function(){var o=arguments,a=e?e.apply(this,o):o[0],f=r.cache;if(f.has(a))return f.get(a);var i=t.apply(this,o);return r.cache=f.set(a,i)||f,i};return r.cache=new(dt.Cache||E),r}dt.Cache=E;var ce=dt;var yf=500;function _f(t){var e=ce(t,function(o){if(r.size===yf)r.clear();return o}),r=e.cache;return e}var ge=_f;var bf=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,vf=/\\(\\)?/g,Of=ge(function(t){var e=[];if(t.charCodeAt(0)===46)e.push("");return t.replace(bf,function(r,o,a,f){e.push(a?f.replace(vf,"$1"):o||r)}),e}),ye=Of;function Af(t){return t==null?"":St(t)}var np=Af;function Tf(t,e){if(ke(t))return t;return M(t,e)?[t]:ye(np(t))}var Fi=Tf;var wf=1/0;function Sf(t){if(typeof t=="string"||Mr(t))return t;var e=t+"";return e=="0"&&1/t==-wf?"-0":e}var so=Sf;function Pf(t,e){e=Fi(e,t);var r=0,o=e.length;while(t!=null&&r<o)t=t[so(e[r++])];return r&&r==o?t:void 0}var Li=Pf;function Cf(t,e,r){var o=t==null?void 0:Li(t,e);return o===void 0?r:o}var _e=Cf;function Ef(t,e){var r=-1,o=e.length,a=t.length;while(++r<o)t[a+r]=e[r];return t}var Ul=Ef;var be=Bn?Bn.isConcatSpreadable:void 0;function If(t){return ke(t)||Pa(t)||!!(be&&t&&t[be])}var ve=If;function Oe(t,e,r,o,a){var f=-1,i=t.length;r||(r=ve),a||(a=[]);while(++f<i){var n=t[f];if(e>0&&r(n))if(e>1)Oe(n,e-1,r,o,a);else Ul(a,n);else if(!o)a[a.length]=n}return a}var Gl=Oe;function Lf(t,e,r,o){var a=-1,f=t==null?0:t.length;if(o&&f)r=t[++a];while(++a<f)r=e(r,t[a],a,t);return r}var Ae=Lf;function jf(){this.__data__=new A,this.size=0}var Te=jf;function Mf(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r}var we=Mf;function Nf(t){return this.__data__.get(t)}var Se=Nf;function Df(t){return this.__data__.has(t)}var Pe=Df;var Rf=200;function Ff(t,e){var r=this.__data__;if(r instanceof A){var o=r.__data__;if(!T||o.length<Rf-1)return o.push([t,e]),this.size=++r.size,this;r=this.__data__=new E(o)}return r.set(t,e),this.size=r.size,this}var Ce=Ff;function F(t){var e=this.__data__=new A(t);this.size=e.size}F.prototype.clear=Te;F.prototype.delete=we;F.prototype.get=Se;F.prototype.has=Pe;F.prototype.set=Ce;var lo=F;function Bf(t,e){var r=-1,o=t==null?0:t.length,a=0,f=[];while(++r<o){var i=t[r];if(e(i,r,t))f[a++]=i}return f}var Q=Bf;function Gf(){return[]}var rp=Gf;var Uf=Object.prototype,zf=Uf.propertyIsEnumerable,Ee=Object.getOwnPropertySymbols,Wf=!Ee?rp:function(t){if(t==null)return[];return t=Object(t),Q(Ee(t),function(e){return zf.call(t,e)})},jl=Wf;function Kf(t,e,r){var o=e(t);return ke(t)?o:Ul(o,r(t))}var ap=Kf;function Hf(t){return ap(t,Gt,jl)}var Ou=Hf;var qf=x(Ut,"DataView"),V=qf;var $f=x(Ut,"Promise"),tt=$f;var kf=x(Ut,"Set"),S=kf;var Ie="[object Map]",Yf="[object Object]",Le="[object Promise]",je="[object Set]",Me="[object WeakMap]",Ne="[object DataView]",Xf=y(V),Zf=y(T),Jf=y(tt),Qf=y(S),Vf=y(k),I=ir;if(V&&I(new V(new ArrayBuffer(1)))!=Ne||T&&I(new T)!=Ie||tt&&I(tt.resolve())!=Le||S&&I(new S)!=je||k&&I(new k)!=Me)I=function(t){var e=ir(t),r=e==Yf?t.constructor:void 0,o=r?y(r):"";if(o)switch(o){case Xf:return Ne;case Zf:return Ie;case Jf:return Le;case Qf:return je;case Vf:return Me}return e};var Pr=I;var ti=Ut.Uint8Array,ql=ti;var ei="__lodash_hash_undefined__";function ri(t){return this.__data__.set(t,ei),this}var De=ri;function oi(t){return this.__data__.has(t)}var Re=oi;function et(t){var e=-1,r=t==null?0:t.length;this.__data__=new E;while(++e<r)this.add(t[e])}et.prototype.add=et.prototype.push=De;et.prototype.has=Re;var rt=et;function ai(t,e){var r=-1,o=t==null?0:t.length;while(++r<o)if(e(t[r],r,t))return!0;return!1}var Fe=ai;function fi(t,e){return t.has(e)}var ot=fi;var ii=1,ni=2;function si(t,e,r,o,a,f){var i=r&ii,n=t.length,s=e.length;if(n!=s&&!(i&&s>n))return!1;var p=f.get(t),d=f.get(e);if(p&&d)return p==e&&d==t;var l=-1,m=!0,g=r&ni?new rt:void 0;f.set(t,e),f.set(e,t);while(++l<n){var h=t[l],c=e[l];if(o)var b=i?o(c,h,l,e,t,f):o(h,c,l,t,e,f);if(b!==void 0){if(b)continue;m=!1;break}if(g){if(!Fe(e,function(P,C){if(!ot(g,C)&&(h===P||a(h,P,r,o,f)))return g.push(C)})){m=!1;break}}else if(!(h===c||a(h,c,r,o,f))){m=!1;break}}return f.delete(t),f.delete(e),m}var at=si;function pi(t){var e=-1,r=Array(t.size);return t.forEach(function(o,a){r[++e]=[a,o]}),r}var Be=pi;function ui(t){var e=-1,r=Array(t.size);return t.forEach(function(o){r[++e]=o}),r}var B=ui;var mi=1,li=2,di="[object Boolean]",xi="[object Date]",hi="[object Error]",ci="[object Map]",gi="[object Number]",yi="[object RegExp]",_i="[object Set]",bi="[object String]",vi="[object Symbol]",Oi="[object ArrayBuffer]",Ai="[object DataView]",Ue=Bn?Bn.prototype:void 0,xt=Ue?Ue.valueOf:void 0;function wi(t,e,r,o,a,f,i){switch(r){case Ai:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case Oi:if(t.byteLength!=e.byteLength||!f(new ql(t),new ql(e)))return!1;return!0;case di:case xi:case gi:return ca(+t,+e);case hi:return t.name==e.name&&t.message==e.message;case yi:case bi:return t==e+"";case ci:var n=Be;case _i:var s=o&mi;if(n||(n=B),t.size!=e.size&&!s)return!1;var p=i.get(t);if(p)return p==e;o|=li,i.set(t,e);var d=at(n(t),n(e),o,a,f,i);return i.delete(t),d;case vi:if(xt)return xt.call(t)==xt.call(e)}return!1}var ze=wi;var Si=1,Pi=Object.prototype,Ci=Pi.hasOwnProperty;function Ei(t,e,r,o,a,f){var i=r&Si,n=Ou(t),s=n.length,p=Ou(e),d=p.length;if(s!=d&&!i)return!1;var l=s;while(l--){var m=n[l];if(!(i?m in e:Ci.call(e,m)))return!1}var g=f.get(t),h=f.get(e);if(g&&h)return g==e&&h==t;var c=!0;f.set(t,e),f.set(e,t);var b=i;while(++l<s){m=n[l];var P=t[m],C=e[m];if(o)var gt=i?o(C,P,m,e,t,f):o(P,C,m,t,e,f);if(!(gt===void 0?P===C||a(P,C,r,o,f):gt)){c=!1;break}b||(b=m=="constructor")}if(c&&!b){var W=t.constructor,K=e.constructor;if(W!=K&&(("constructor"in t)&&("constructor"in e))&&!(typeof W=="function"&&W instanceof W&&typeof K=="function"&&K instanceof K))c=!1}return f.delete(t),f.delete(e),c}var We=Ei;var Ii=1,Ke="[object Arguments]",He="[object Array]",ft="[object Object]",ji=Object.prototype,qe=ji.hasOwnProperty;function Bi(t,e,r,o,a,f){var i=ke(t),n=ke(e),s=i?He:Pr(t),p=n?He:Pr(e);s=s==Ke?ft:s,p=p==Ke?ft:p;var d=s==ft,l=p==ft,m=s==p;if(m&&ua(t)){if(!ua(e))return!1;i=!0,d=!1}if(m&&!d)return f||(f=new lo),i||Ri(t)?at(t,e,r,o,a,f):ze(t,e,s,r,o,a,f);if(!(r&Ii)){var g=d&&qe.call(t,"__wrapped__"),h=l&&qe.call(e,"__wrapped__");if(g||h){var c=g?t.value():t,b=h?e.value():e;return f||(f=new lo),a(c,b,r,o,f)}}if(!m)return!1;return f||(f=new lo),We(t,e,r,o,a,f)}var $e=Bi;function Ye(t,e,r,o,a){if(t===e)return!0;if(t==null||e==null||!Xt(t)&&!Xt(e))return t!==t&&e!==e;return $e(t,e,r,o,Ye,a)}var it=Ye;var Gi=1,Ui=2;function zi(t,e,r,o){var a=r.length,f=a,i=!o;if(t==null)return!f;t=Object(t);while(a--){var n=r[a];if(i&&n[2]?n[1]!==t[n[0]]:!(n[0]in t))return!1}while(++a<f){n=r[a];var s=n[0],p=t[s],d=n[1];if(i&&n[2]){if(p===void 0&&!(s in t))return!1}else{var l=new lo;if(o)var m=o(p,d,s,t,e,l);if(!(m===void 0?it(d,p,Gi|Ui,o,l):m))return!1}}return!0}var Xe=zi;function Wi(t){return t===t&&!_t(t)}var nt=Wi;function Ki(t){var e=Gt(t),r=e.length;while(r--){var o=e[r],a=t[o];e[r]=[o,a,nt(a)]}return e}var Ze=Ki;function Hi(t,e){return function(r){if(r==null)return!1;return r[t]===e&&(e!==void 0||(t in Object(r)))}}var st=Hi;function qi(t){var e=Ze(t);if(e.length==1&&e[0][2])return st(e[0][0],e[0][1]);return function(r){return r===t||Xe(r,t,e)}}var Je=qi;function $i(t,e){return t!=null&&e in Object(t)}var Qe=$i;function ki(t,e,r){e=Fi(e,t);var o=-1,a=e.length,f=!1;while(++o<a){var i=so(e[o]);if(!(f=t!=null&&r(t,i)))break;t=t[i]}if(f||++o!=a)return f;return a=t==null?0:t.length,!!a&&j(a)&&Ti(i,a)&&(ke(t)||Pa(t))}var op=ki;function Yi(t,e){return t!=null&&op(t,e,Qe)}var ip=Yi;var Xi=1,Zi=2;function Ji(t,e){if(M(t)&&nt(e))return st(so(t),e);return function(r){var o=_e(r,t);return o===void 0&&o===e?ip(r,t):it(e,o,Xi|Zi)}}var Ve=Ji;function Vi(t){return function(e){return e==null?void 0:e[t]}}var sp=Vi;function tn(t){return function(e){return Li(e,t)}}var tr=tn;function en(t){return M(t)?sp(so(t)):tr(t)}var er=en;function rn(t){if(typeof t=="function")return t;if(t==null)return yr;if(typeof t=="object")return ke(t)?Ve(t[0],t[1]):Je(t);return er(t)}var Wn=rn;function on(t){return function(e,r,o){var a=-1,f=Object(e),i=o(e),n=i.length;while(n--){var s=i[t?n:++a];if(r(f[s],s,f)===!1)break}return e}}var rr=on;var an=rr(),Hl=an;function fn(t,e){return t&&Hl(t,e,Gt)}var Wl=fn;function nn(t,e){return function(r,o){if(r==null)return r;if(!In(r))return t(r,o);var a=r.length,f=e?a:-1,i=Object(r);while(e?f--:++f<a)if(o(i[f],f,i)===!1)break;return r}}var or=nn;var sn=or(Wl),Mi=sn;function pn(t){return Xt(t)&&In(t)}var lp=pn;function un(t,e,r){var o=-1,a=t==null?0:t.length;while(++o<a)if(r(e,t[o]))return!0;return!1}var ar=un;function mn(t){return typeof t=="function"?t:yr}var Kl=mn;function ln(t,e){var r=ke(t)?Jd:Mi;return r(t,Kl(e))}var v=ln;function dn(t,e){var r=[];return Mi(t,function(o,a,f){if(e(o,a,f))r.push(o)}),r}var fr=dn;function xn(t,e){var r=ke(t)?Q:fr;return r(t,Wn(e,3))}var sr=xn;function hn(t,e){return ao(e,function(r){return t[r]})}var nr=hn;function cn(t){return t==null?[]:nr(t,Gt(t))}var Or=cn;var gn="[object Map]",yn="[object Set]",_n=Object.prototype,bn=_n.hasOwnProperty;function vn(t){if(t==null)return!0;if(In(t)&&(ke(t)||typeof t=="string"||typeof t.splice=="function"||ua(t)||Ri(t)||Pa(t)))return!t.length;var e=Pr(t);if(e==gn||e==yn)return!t.size;if(Ni(t))return!zl(t).length;for(var r in t)if(bn.call(t,r))return!1;return!0}var pt=vn;function On(t){return t===void 0}var jt=On;function An(t,e,r,o,a){return a(t,function(f,i,n){r=o?(o=!1,f):e(r,f,i,n)}),r}var pr=An;function Tn(t,e,r){var o=ke(t)?Ae:pr,a=arguments.length<3;return o(t,Wn(e,4),r,a,Mi)}var co=Tn;var wn=1/0,Sn=!(S&&1/B(new S([,-0]))[1]==wn)?Mt:function(t){return new S(t)},ur=Sn;var Pn=200;function Cn(t,e,r){var o=-1,a=zt,f=t.length,i=!0,n=[],s=n;if(r)i=!1,a=ar;else if(f>=Pn){var p=e?null:ur(t);if(p)return B(p);i=!1,a=ot,s=new rt}else s=e?[]:n;t:while(++o<f){var d=t[o],l=e?e(d):d;if(d=r||d!==0?d:0,i&&l===l){var m=s.length;while(m--)if(s[m]===l)continue t;if(e)s.push(l);n.push(d)}else if(!a(s,l,r)){if(s!==n)s.push(l);n.push(d)}}return n}var mr=Cn;var Ln=Di(function(t){return mr(Gl(t,1,lp,!0))}),ht=Ln;var Mn="\x00",L="\x00",lr="\x01";class Ge{constructor(t={}){if(this._isDirected=Object.prototype.hasOwnProperty.call(t,"directed")?t.directed:!0,this._isMultigraph=Object.prototype.hasOwnProperty.call(t,"multigraph")?t.multigraph:!1,this._isCompound=Object.prototype.hasOwnProperty.call(t,"compound")?t.compound:!1,this._label=void 0,this._defaultNodeLabelFn=vr(void 0),this._defaultEdgeLabelFn=vr(void 0),this._nodes={},this._isCompound)this._parent={},this._children={},this._children[L]={};this._in={},this._preds={},this._out={},this._sucs={},this._edgeObjs={},this._edgeLabels={}}isDirected(){return this._isDirected}isMultigraph(){return this._isMultigraph}isCompound(){return this._isCompound}setGraph(t){return this._label=t,this}graph(){return this._label}setDefaultNodeLabel(t){if(!oo(t))t=vr(t);return this._defaultNodeLabelFn=t,this}nodeCount(){return this._nodeCount}nodes(){return Gt(this._nodes)}sources(){var t=this;return sr(this.nodes(),function(e){return pt(t._in[e])})}sinks(){var t=this;return sr(this.nodes(),function(e){return pt(t._out[e])})}setNodes(t,e){var r=arguments,o=this;return v(t,function(a){if(r.length>1)o.setNode(a,e);else o.setNode(a)}),this}setNode(t,e){if(Object.prototype.hasOwnProperty.call(this._nodes,t)){if(arguments.length>1)this._nodes[t]=e;return this}if(this._nodes[t]=arguments.length>1?e:this._defaultNodeLabelFn(t),this._isCompound)this._parent[t]=L,this._children[t]={},this._children[L][t]=!0;return this._in[t]={},this._preds[t]={},this._out[t]={},this._sucs[t]={},++this._nodeCount,this}node(t){return this._nodes[t]}hasNode(t){return Object.prototype.hasOwnProperty.call(this._nodes,t)}removeNode(t){if(Object.prototype.hasOwnProperty.call(this._nodes,t)){var e=(r)=>this.removeEdge(this._edgeObjs[r]);if(delete this._nodes[t],this._isCompound)this._removeFromParentsChildList(t),delete this._parent[t],v(this.children(t),(r)=>{this.setParent(r)}),delete this._children[t];v(Gt(this._in[t]),e),delete this._in[t],delete this._preds[t],v(Gt(this._out[t]),e),delete this._out[t],delete this._sucs[t],--this._nodeCount}return this}setParent(t,e){if(!this._isCompound)throw Error("Cannot set parent in a non-compound graph");if(jt(e))e=L;else{e+="";for(var r=e;!jt(r);r=this.parent(r))if(r===t)throw Error("Setting "+e+" as parent of "+t+" would create a cycle");this.setNode(e)}return this.setNode(t),this._removeFromParentsChildList(t),this._parent[t]=e,this._children[e][t]=!0,this}_removeFromParentsChildList(t){delete this._children[this._parent[t]][t]}parent(t){if(this._isCompound){var e=this._parent[t];if(e!==L)return e}}children(t){if(jt(t))t=L;if(this._isCompound){var e=this._children[t];if(e)return Gt(e)}else if(t===L)return this.nodes();else if(this.hasNode(t))return[]}predecessors(t){var e=this._preds[t];if(e)return Gt(e)}successors(t){var e=this._sucs[t];if(e)return Gt(e)}neighbors(t){var e=this.predecessors(t);if(e)return ht(e,this.successors(t))}isLeaf(t){var e;if(this.isDirected())e=this.successors(t);else e=this.neighbors(t);return e.length===0}filterNodes(t){var e=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});e.setGraph(this.graph());var r=this;v(this._nodes,function(f,i){if(t(i))e.setNode(i,f)}),v(this._edgeObjs,function(f){if(e.hasNode(f.v)&&e.hasNode(f.w))e.setEdge(f,r.edge(f))});var o={};function a(f){var i=r.parent(f);if(i===void 0||e.hasNode(i))return o[f]=i,i;else if(i in o)return o[i];else return a(i)}if(this._isCompound)v(e.nodes(),function(f){e.setParent(f,a(f))});return e}setDefaultEdgeLabel(t){if(!oo(t))t=vr(t);return this._defaultEdgeLabelFn=t,this}edgeCount(){return this._edgeCount}edges(){return Or(this._edgeObjs)}setPath(t,e){var r=this,o=arguments;return co(t,function(a,f){if(o.length>1)r.setEdge(a,f,e);else r.setEdge(a,f);return f}),this}setEdge(){var t,e,r,o,a=!1,f=arguments[0];if(typeof f==="object"&&f!==null&&"v"in f){if(t=f.v,e=f.w,r=f.name,arguments.length===2)o=arguments[1],a=!0}else if(t=f,e=arguments[1],r=arguments[3],arguments.length>2)o=arguments[2],a=!0;if(t=""+t,e=""+e,!jt(r))r=""+r;var i=z(this._isDirected,t,e,r);if(Object.prototype.hasOwnProperty.call(this._edgeLabels,i)){if(a)this._edgeLabels[i]=o;return this}if(!jt(r)&&!this._isMultigraph)throw Error("Cannot set a named edge when isMultigraph = false");this.setNode(t),this.setNode(e),this._edgeLabels[i]=a?o:this._defaultEdgeLabelFn(t,e,r);var n=Nn(this._isDirected,t,e,r);return t=n.v,e=n.w,Object.freeze(n),this._edgeObjs[i]=n,dr(this._preds[e],t),dr(this._sucs[t],e),this._in[e][i]=n,this._out[t][i]=n,this._edgeCount++,this}edge(t,e,r){var o=arguments.length===1?ct(this._isDirected,arguments[0]):z(this._isDirected,t,e,r);return this._edgeLabels[o]}hasEdge(t,e,r){var o=arguments.length===1?ct(this._isDirected,arguments[0]):z(this._isDirected,t,e,r);return Object.prototype.hasOwnProperty.call(this._edgeLabels,o)}removeEdge(t,e,r){var o=arguments.length===1?ct(this._isDirected,arguments[0]):z(this._isDirected,t,e,r),a=this._edgeObjs[o];if(a)t=a.v,e=a.w,delete this._edgeLabels[o],delete this._edgeObjs[o],xr(this._preds[e],t),xr(this._sucs[t],e),delete this._in[e][o],delete this._out[t][o],this._edgeCount--;return this}inEdges(t,e){var r=this._in[t];if(r){var o=Or(r);if(!e)return o;return sr(o,function(a){return a.v===e})}}outEdges(t,e){var r=this._out[t];if(r){var o=Or(r);if(!e)return o;return sr(o,function(a){return a.w===e})}}nodeEdges(t,e){var r=this.inEdges(t,e);if(r)return r.concat(this.outEdges(t,e))}}Ge.prototype._nodeCount=0;Ge.prototype._edgeCount=0;function dr(t,e){if(t[e])t[e]++;else t[e]=1}function xr(t,e){if(!--t[e])delete t[e]}function z(t,e,r,o){var a=""+e,f=""+r;if(!t&&a>f){var i=a;a=f,f=i}return a+lr+f+lr+(jt(o)?Mn:o)}function Nn(t,e,r,o){var a=""+e,f=""+r;if(!t&&a>f){var i=a;a=f,f=i}var n={v:a,w:f};if(o)n.name=o;return n}function ct(t,e){return z(t,e.v,e.w,e.name)}
2
- export{Ut,Bn,ir,Xt,Mr,ao,ke,_t,yr,oo,vr,$l,Yd,Jd,Zd,Ti,ca,Xd,Di,In,Ni,Pa,ua,Qi,io,Ri,ep,tp,zl,Gt,np,Fi,so,Li,Ul,Gl,lo,rp,jl,ap,Ou,Pr,ql,op,ip,sp,Wn,Hl,Wl,Mi,lp,Kl,v,sr,Or,jt,co,Ge};
@@ -1,2 +0,0 @@
1
- import{d,n,o,a,e,s,E,D,lt,dt}from"./index-x2v1zmth.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(dt,{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 ia(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 ",ia(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 ",ia(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(lt,{value:p,label:"Wallet balance",hint:c}),e(lt,{value:l?.planName??"–",label:"Active plan",hint:l?"kenari quota plan":"Quota unavailable"}),e(lt,{value:i?b(i.totalRequests):"–",label:"Requests (30 days)",hint:i?"Across all models":"Usage report unavailable"}),e(lt,{value:i?x(i.totalCostRp):"–",label:"Cost (30 days)",hint:i?"Billed in Rupiah":"Usage report unavailable"}),e(lt,{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(lt,{value:r.isAvailable?"Available":"Unavailable",label:"Prepaid balance",hint:r.isAvailable?"Account can spend":"Top up required",tone:r.isAvailable?"default":"muted"}),e(lt,{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 ${ia(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 Nu({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 Gs(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 Xg(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 ",ia(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 Qu(){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 Ru(){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
- export{ia,Nu,Gs,Xg,Qu,Ru};
@@ -1,3 +0,0 @@
1
- import{d,n,o,K,i,u,a,je,oe,e,s,E,m,rn,_,f,B,re,Xe,fe,Tt,Ke,si,mn,Zn,D,U,b,er,Oe,xe,S,hr,et,rs,ue,br,Z,ct,ul,So,dl,pl,Do,Ih,$h,Xm,$o,xl,Me,ae,Zt,T,ve,wi,_f,Gg}from"./index-x2v1zmth.js";import{mt,Bi,bu,yu,ku,Ss,Ii,zd}from"./index-dxp2yvy7.js";import{Jc,Dd,Nd,Kg,Vg,Zc,or,Es,Xc,eu,tu,nu,ru,Bs,au,ou,Go,Is,Ei,su,Tl,Dl,lu,cu,uu,du,pu,mu,fu,gu,Au}from"./index-p6s3fz6b.js";import{Ra,Fa,Wo}from"./index-52nd4hgm.js";var gn={name:"git-commit-vertical",size:24,node:[["path",{d:"M12 3v6",key:"1holv5"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}],["path",{d:"M12 15v6",key:"a9ows0"}]]},De=s(gn);var vn={name:"maximize",size:24,node:[["path",{d:"M8 3H5a2 2 0 0 0-2 2v3",key:"1dcmit"}],["path",{d:"M21 8V5a2 2 0 0 0-2-2h-3",key:"1e4gt3"}],["path",{d:"M3 16v3a2 2 0 0 0 2 2h3",key:"wsl5sc"}],["path",{d:"M16 21h3a2 2 0 0 0 2-2v-3",key:"18trek"}]]},ke=s(vn);var yn={name:"minimize",size:24,node:[["path",{d:"M8 3v3a2 2 0 0 1-2 2H3",key:"hohbtr"}],["path",{d:"M21 8h-3a2 2 0 0 1-2-2V3",key:"5jw1f3"}],["path",{d:"M3 16h3a2 2 0 0 1 2 2v3",key:"198tvr"}],["path",{d:"M16 21v-3a2 2 0 0 1 2-2h3",key:"ph8mxp"}]]},Se=s(yn);var xn={name:"panel-right-close",size:24,node:[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}],["path",{d:"m8 9 3 3-3 3",key:"12hl5m"}]]},We=s(xn);var wn={name:"save-all",size:24,node:[["path",{d:"M10 2v3a1 1 0 0 0 1 1h5",key:"1xspal"}],["path",{d:"M18 18v-6a1 1 0 0 0-1-1h-6a1 1 0 0 0-1 1v6",key:"1ra60u"}],["path",{d:"M18 22H4a2 2 0 0 1-2-2V6",key:"pblm9e"}],["path",{d:"M8 18a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9.172a2 2 0 0 1 1.414.586l2.828 2.828A2 2 0 0 1 22 6.828V16a2 2 0 0 1-2.01 2z",key:"1yve0x"}]]},Ce=s(wn);var se=new Set,Ae=new Set,Ve=new Set;function Ue(){Ve=new Set(se);for(let t of[...Ae])t()}function _e(t){let r=new Set(t);if(r.size===se.size){let l=!0;for(let c of r)if(!se.has(c)){l=!1;break}if(l)return}se.clear();for(let l of r)se.add(l);Ue()}function Ge(t){let r=new Set(t),l=!1;for(let c of[...se])if(!r.has(c))se.delete(c),l=!0;if(l)Ue()}function qe(t){return se.has(t)}function Ze(){return se.size>0}function kn(t){return Ae.add(t),()=>{Ae.delete(t)}}var Sn=kn;function Ye(){return je(Sn,()=>Ve)}function Je({x:t,y:r,rows:l,onAction:c,onClose:p}){let h=i(null),[g,v]=n({left:t,top:r});return K(()=>{let y=h.current;if(!y)return;let{width:w,height:x}=y.getBoundingClientRect();v({left:Math.min(t,Math.max(0,window.innerWidth-w-8)),top:Math.min(r,Math.max(0,window.innerHeight-x-8))})},[t,r,l.length]),oe(e("div",{className:"fixed inset-0 z-[70]",onClick:p,onContextMenu:(y)=>{y.preventDefault(),p()},children:e("div",{ref:h,role:"menu","aria-label":"Tab actions",className:"glass-popover absolute w-52 bg-paper border border-ink/15 rounded-md shadow-xl py-1 text-xs text-ink",style:{left:`${g.left}px`,top:`${g.top}px`},onClick:(y)=>y.stopPropagation(),children:l.map((y)=>e("button",{type:"button",role:"menuitem",onClick:()=>{c(y.action),p()},className:"w-full text-left px-3 py-1.5 hover:bg-ink/5 transition-colors cursor-pointer",children:y.label},y.action))})}),document.body)}var ge={rightFileId:null,fraction:0.5};function Ee(t,r,l){if(t===null)return!1;if(t===r)return!1;return l.includes(t)}function Qe(t,r){for(let l=r.length-1;l>=0;l-=1){let c=r[l];if(c!==t)return c}return null}function tt(t,r){if(t.rightFileId===null)return t;if(t.rightFileId!==r)return t;return{...t,rightFileId:null}}function pe(t){if(!Number.isFinite(t))return ge.fraction;return Math.max(0.2,Math.min(0.8,t))}function nt(t,r){if(typeof t!=="object"||t===null)return ge;let l=t,c=typeof l.fraction==="number"?pe(l.fraction):ge.fraction,p=typeof l.rightFileId==="string"||typeof l.rightFileId==="number"?l.rightFileId:null;if(p===null||!r.includes(p))return{rightFileId:null,fraction:c};return{rightFileId:p,fraction:c}}function ot({tab:t,openedFiles:r,dirtyIds:l,reopenable:c,activeFileId:p,splitRightFileId:h}){let g=r.filter((x)=>x.id!==t.id),v=r.filter((x)=>!l.has(x.id)),y=r.map((x)=>x.id);return[{action:"split-right",label:"Split right",enabled:Ee(t.id,p,y)},{action:"unsplit",label:"Unsplit",enabled:h!==null},{action:"close",label:"Close",enabled:!0},{action:"close-others",label:"Close others",enabled:g.length>0},{action:"close-all",label:"Close all",enabled:r.length>0},{action:"close-saved",label:"Close saved",enabled:v.some((x)=>x.id!==t.id)},{action:"copy-path",label:"Copy path",enabled:Boolean(t.path)},{action:"reveal-in-files",label:"Reveal in Files",enabled:Boolean(t.path)&&!t.isDiff},{action:"reopen-closed",label:"Reopen closed tab",enabled:c>0}].filter((x)=>x.enabled)}function be({onHide:t}){let r=$o("toggleEditorPanel","Hide Editor Panel");return e("button",{type:"button",onClick:t,className:"p-1.5 mx-1 rounded transition-colors cursor-pointer text-ink/60 hover:bg-ink/10 hover:text-ink flex-shrink-0",title:r,"aria-label":r,children:e(We,{size:14})})}function it({openedFiles:t,activeFileId:r,onSelectFile:l,onCloseFile:c,missingIds:p,onCopyPath:h,onRevealInFiles:g,onReopenClosed:v,reopenableCount:y,onSplitTo:w,onUnsplit:x,splitRightFileId:k=null,onHide:O}){let C=Ye(),M=i(null),I=i(null),[F,z]=n(5),[A,V]=n(!1),[R,L]=n(null);ue(I,()=>V(!1)),o(()=>{let N=new ResizeObserver((P)=>{for(let H of P){let J=H.contentRect.width,Q=Math.max(1,Math.floor((J-60)/150));z(Q)}});if(M.current)N.observe(M.current);return()=>N.disconnect()},[]);let G=Qe(r,t.map((N)=>N.id)),X=[],Y=[];if(t.length<=F)X=t;else{let N=t.findIndex((H)=>H.id===r),P=new Set;if(N!==-1&&r!==null)P.add(r);for(let H=t.length-1;H>=0;H--){if(P.size>=F)break;P.add(t[H].id)}X=t.filter((H)=>P.has(H.id)),Y=t.filter((H)=>!P.has(H.id))}return e("div",{className:`${rs.desktop} flex bg-ink/10 w-full relative border-b border-ink/10`,ref:M,children:[e("div",{className:"flex overflow-hidden",children:X.map((N)=>{let P=N.id===r,H=Boolean(N.isDiff),J=H?er(N.diffStatus||"M",N.diffStaged):null,Q=Boolean(p?.has(N.id));return e("div",{onClick:()=>l(N.id),onContextMenu:(te)=>{te.preventDefault(),L({tab:N,x:te.clientX,y:te.clientY})},className:`flex items-center space-x-1.5 px-3 py-1.5 cursor-pointer border-r border-ink/10 min-w-[120px] max-w-[210px] group ${P?"bg-paper border-t-2 border-t-ink text-ink":"bg-transparent border-t-2 border-t-transparent text-ink/60 hover:bg-paper/50"}`,title:Q?`${N.path} — file no longer exists`:N.path,children:[H?e(si,{size:14,className:P?"text-info flex-shrink-0":"text-info/70 flex-shrink-0"}):e(ct,{name:N.name,size:14,className:`flex-shrink-0${P||Q?"":" opacity-60"}${Q?" text-error":""}`}),e("span",{className:`text-xs font-mono truncate flex-1${Q?" text-error line-through":""}`,children:N.name}),J&&e("span",{className:`px-1 text-[10px] font-mono font-bold rounded ${J.badgeBgClass}`,children:J.charStatus}),e(rt,{dirty:C.has(N.id),active:P,label:`Close ${N.name}`,onClose:()=>c(N.id)})]},N.id)})}),R?e(Je,{x:R.x,y:R.y,rows:ot({tab:R.tab,openedFiles:t,dirtyIds:C,reopenable:y?.()??0,activeFileId:r,splitRightFileId:k}),onAction:(N)=>{let P=R.tab;switch(N){case"close":c(P.id);return;case"close-others":for(let H of[...t].reverse())if(H.id!==P.id)c(H.id);l(P.id);return;case"close-all":for(let H of[...t].reverse())c(H.id);return;case"close-saved":for(let H of[...t].reverse())if(!C.has(H.id))c(H.id);return;case"copy-path":h?.(P);return;case"reveal-in-files":g?.(P);return;case"reopen-closed":v?.();return;case"split-right":w?.(P.id);return;case"unsplit":x?.();return}},onClose:()=>L(null)}):null,e("div",{className:"ml-auto flex items-center",children:[e("button",{type:"button",onClick:()=>k!==null?x?.():w?.(G),disabled:k===null&&G===null,"aria-pressed":k!==null,"aria-label":"Split editor",title:k!==null?"Close the split pane (the tab stays open)":G===null?"Open another file to split the editor":"Split the editor and show the newest other file",className:`p-1.5 mx-1 rounded transition-colors cursor-pointer disabled:opacity-30 disabled:cursor-default ${k!==null?"bg-ink/10 text-ink":"text-ink/60 hover:bg-ink/10"}`,children:e(Zn,{size:14})}),O&&e(be,{onHide:O})]}),Y.length>0&&e("div",{className:"relative flex items-center bg-ink/10",ref:I,children:[e("button",{className:`p-1.5 mx-1 rounded hover:bg-ink/10 text-ink/60 ${A?"bg-ink/10 text-ink":""}`,onClick:()=>V(!A),title:"More open files",children:e(B,{size:14})}),A&&e("div",{className:"glass-popover absolute right-0 top-full mt-1 w-52 bg-paper border border-ink/10 rounded shadow-lg z-50 py-1",children:[e("div",{className:"px-3 py-1 text-[10px] uppercase font-mono text-ink/40 border-b border-ink/10 mb-1",children:"Older Tabs"}),Y.map((N)=>{let P=Boolean(p?.has(N.id));return e("div",{onClick:()=>{l(N.id),V(!1)},className:"flex items-center space-x-2 px-3 py-1.5 hover:bg-ink/5 cursor-pointer group",children:[N.isDiff?e(si,{size:14,className:"text-info/80"}):e(ct,{name:N.name,size:14,className:P?"text-error":"opacity-60"}),e("span",{className:`text-xs font-mono truncate flex-1 ${P?"text-error line-through":"text-ink/80"}`,children:N.name}),e(rt,{dirty:C.has(N.id),active:!1,label:`Close ${N.name}`,onClose:()=>{if(c(N.id),Y.length===1)V(!1)}})]},N.id)})]})]})]})}function rt({dirty:t,active:r,label:l,onClose:c}){return e("div",{role:"button",tabIndex:-1,"aria-label":l,title:t?`${l} — unsaved changes`:l,className:`p-0.5 rounded hover:bg-ink/10 touch-visible ${r||t?"opacity-100":"opacity-0 group-hover:opacity-100"}`,onClick:(p)=>{p.stopPropagation(),c()},children:t?e("span",{className:"block w-2 h-2 rounded-full bg-current mx-0.5","data-tab-dirty":"","aria-hidden":"true"}):e(b,{size:12})})}function Cn(t){if(t===null)return null;let r=new Date(t);if(Number.isNaN(r.getTime()))return null;return r.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"})}function Te({diskMtimeMs:t,fileName:r,onReload:l,onKeepMine:c}){let p=Cn(t);return e("div",{className:"flex items-start gap-2 px-3 py-2 border-b border-warning/30 bg-warning/10 text-[11px] text-ink flex-shrink-0",role:"alert","data-conflict-strip":"",children:[e(_,{size:13,className:"text-warning flex-shrink-0 mt-0.5"}),e("div",{className:"min-w-0 flex-1",children:[e("div",{className:"font-medium",children:[e("span",{className:"font-mono",children:r})," changed on disk",p?e("span",{className:"text-ink/60",children:[" at ",p]}):null,"."]}),e("div",{className:"text-ink/60 mt-0.5",children:"Your save was refused so nothing was overwritten."})]}),e("div",{className:"flex items-center gap-1 flex-shrink-0",children:[e("button",{type:"button",onClick:l,className:"px-2 py-1 rounded border border-ink/20 hover:bg-ink/5 transition-colors cursor-pointer",title:"Discard my changes and take the file from disk",children:"Reload"}),e("button",{type:"button",onClick:c,className:"px-2 py-1 rounded border border-warning/50 text-warning hover:bg-warning/10 transition-colors cursor-pointer",title:"Write my buffer over the file on disk",children:"Keep mine"})]})]})}function at(t){if(t.byteViewer)return[];return[{id:"save",pinned:!0,actions:[{label:"Save file",icon:Ce,onSelect:t.onSave,disabled:t.saveDisabled}],children:t.saveButton},{id:"save-as",actions:[{label:"Save as…",icon:Ce,onSelect:t.onSaveAs}],children:e("button",{type:"button",onClick:t.onSaveAs,className:`${or} hover:bg-ink/5 hover:text-ink`,title:"Save the buffer to a new file","aria-label":"Save as",children:e(Ce,{size:14})})}]}function st(t){if(!t.hasReview)return[];let r=t.isReviewing?"Exit review mode":"Review this document";return[{id:"review",actions:[{label:r,icon:mn,onSelect:t.onToggleReview,active:t.isReviewing}],children:e(Es,{label:r,pressed:t.isReviewing,title:t.isReviewing?"Review mode is on — click a block to judge it":"Review: click blocks to mark them good or needing work",onClick:t.onToggleReview,children:e(mn,{size:14})})}]}function lt(t){if(!t.hasPreview)return[];return[{id:"preview",actions:[{label:t.previewLabel,icon:t.isPreview?Tt:Ke,onSelect:t.onTogglePreview,active:t.isPreview}],children:e(Es,{label:t.previewLabel,pressed:t.isPreview,onClick:t.onTogglePreview,children:t.isPreview?e(Tt,{size:14}):e(Ke,{size:14})})}]}function dt(t){let r=[];if(r.push(...at(t),...st(t),...lt(t)),!t.byteViewer)r.push({id:"find",actions:[{label:t.findLabel,icon:U,onSelect:t.onToggleFind,active:t.findOpen}],children:e(Es,{label:t.findLabel,pressed:t.findOpen,title:`${t.findLabel} (Ctrl+F)`,onClick:t.onToggleFind,children:e(U,{size:14})})}),r.push({id:"wrap",actions:[{label:t.wordWrapLabel,icon:rn,onSelect:t.onToggleWordWrap,active:t.wordWrap}],children:e(Es,{label:t.wordWrapLabel,pressed:t.wordWrap,onClick:t.onToggleWordWrap,children:e(rn,{size:14})})}),r.push({id:"blame",actions:[{label:t.blameInline?"Hide line blame":"Show line blame",icon:De,onSelect:t.onToggleBlameInline,active:t.blameInline}],children:e(Es,{label:t.blameInline?"Hide line blame":"Show line blame",pressed:t.blameInline,title:"Who last changed each block, from git (hover a line for the commit)",onClick:t.onToggleBlameInline,children:e(De,{size:14})})}),r.push({id:"zoom",actions:[{label:"Decrease font size",icon:Fa,onSelect:t.onZoomOut},{label:"Increase font size",icon:Ra,onSelect:t.onZoomIn}],children:e(d,{children:[e("button",{type:"button",onClick:t.onZoomOut,className:`${or} hover:bg-ink/5 hover:text-ink`,title:"Decrease font size","aria-label":"Decrease font size",children:e(Fa,{size:14})}),e("button",{type:"button",onClick:t.onZoomIn,className:`${or} hover:bg-ink/5 hover:text-ink`,title:"Increase font size","aria-label":"Increase font size",children:e(Ra,{size:14})})]})}),r.push({id:"reload",actions:[{label:"Reload from disk",icon:D,onSelect:t.onReload,disabled:!t.canReload}],children:e("button",{type:"button",onClick:t.onReload,disabled:!t.canReload||t.refreshing,"aria-busy":t.refreshing,className:`${or} hover:bg-ink/5 hover:text-ink`,title:!t.canReload?"Nothing to reload — this tab has no file on disk":t.reloadDiscardsEdits?"Discard my changes and reload from disk":"Reload from disk","aria-label":"Reload from disk",children:e(D,{size:14,className:t.refreshing?"animate-spin":void 0})})});return r.push({id:"copy",actions:[{label:t.copyLabel,icon:re,onSelect:t.onCopy},{label:"Download file",icon:fe,onSelect:t.onDownload}],children:e(d,{children:[e("button",{type:"button",onClick:t.onCopy,className:`${or} hover:bg-ink/5 hover:text-ink`,title:t.copyLabel,"aria-label":t.copyLabel,children:t.copied?e(re,{size:14,className:"text-success"}):e(re,{size:14})}),e("button",{type:"button",onClick:t.onDownload,className:`${or} hover:bg-ink/5 hover:text-ink`,title:"Download file","aria-label":"Download file",children:e(fe,{size:14})})]})}),r.push({id:"view-modes",pinned:!0,actions:t.viewModeActions,children:t.viewModeButtons}),r.push({id:"maximize",pinned:!0,actions:[{label:t.maximizeLabel,icon:t.isMaximized?Se:ke,onSelect:t.onToggleMaximize,active:t.isMaximized}],children:t.maximizeButton}),r}function ut({path:t,saveStatus:r,wordWrap:l,hasPreview:c,isPreview:p,hasReview:h,isReviewing:g,copied:v,byteViewer:y=!1,saveDisabled:w=!1,unsupported:x=!1,handleMissing:k=!1,readOnly:O=!1,isMaximized:C=!1,findOpen:M=!1,onToggleFind:I,onSave:F,onTogglePreview:z,onToggleReview:A,onToggleWordWrap:V,onZoomIn:R,onZoomOut:L,onCopy:G,onDownload:X,onReload:Y,canReload:N,refreshing:P=!1,reloadDiscardsEdits:H,onSaveAs:J,onToggleMaximize:Q}){let te=w?O?"Read-only — this file was opened from the phone, not from a workspace":k?"Cannot save — reopen the file from the system to restore write access":x?"Nothing to save — this file cannot be opened as a document":"Nothing to save — this file could not be read":r==="needs-permission"?"Click Save to allow writing this file":r==="saving"?"Saving…":r==="error"?"Save failed — the file on disk was not changed":"Save file (Ctrl+S)",ie=e("button",{type:"button",onClick:F,disabled:w||r==="saving",className:`${or} hover:bg-ink/5`,title:te,"aria-label":te,children:r==="saving"?e(mt,{size:14,className:"text-warning animate-pulse"}):r==="saved"?e(f,{size:14,className:"text-success"}):r==="error"?e(E,{size:14,className:"text-error"}):r==="needs-permission"?e(mt,{size:14,className:"text-warning"}):e(mt,{size:14,className:"hover:text-ink"})}),le=C?"Exit full screen":"Full screen",ee=e("button",{type:"button",onClick:Q,className:`${or} hover:bg-ink/5 hover:text-ink ${C?"text-ink":""}`,title:le,"aria-label":le,"aria-pressed":C,children:C?e(Se,{size:14}):e(ke,{size:14})}),ne=zd(),de=Dd(),ce=dt({byteViewer:y,hasPreview:c,isPreview:p,wordWrap:l,hasReview:h,isReviewing:g,blameInline:ne.inline,findOpen:M,copied:v,isMaximized:C,saveDisabled:w,canReload:N,refreshing:P,reloadDiscardsEdits:H,saveButton:ie,maximizeButton:ee,viewModeButtons:e(Nd,{size:14}),viewModeActions:de,previewLabel:p?"Show source":"Show preview",findLabel:"Find and replace",wordWrapLabel:l?"Word wrap on":"Word wrap off",copyLabel:v?"Copied":y?"Copy image":"Copy content",maximizeLabel:le,onTogglePreview:z,onToggleReview:A,onToggleFind:I,onToggleWordWrap:V,onToggleBlameInline:()=>{let he={...Ii(),inline:!ne.inline};hr({editorBlameInline:he.inline}),window.dispatchEvent(new CustomEvent(Ss,{detail:he}))},onZoomIn:R,onZoomOut:L,onCopy:G,onDownload:X,onReload:Y,onSaveAs:J,onToggleMaximize:Q,onSave:F});return e("div",{className:`@container ${rs.desktop} flex items-center justify-between gap-2 px-3 border-b border-ink/10 bg-paper flex-shrink-0`,children:[e("div",{className:"hidden @[420px]:flex items-center space-x-2 text-xs font-mono text-ink/40 min-w-0",children:e("span",{className:"truncate max-w-[300px]",title:t,children:t})}),e(Wo,{clusters:ce,className:"text-ink/40 ml-auto"})]})}function pt({content:t,file:r,zoomLevel:l,reviewActive:c,onExitReview:p,scrollRef:h,onScroll:g}){return e("div",{ref:h,onScroll:g,"data-testid":"editor-scroller",className:"flex-1 overflow-auto bg-paper flex",children:e("div",{className:"p-6 max-w-4xl mx-auto font-sans flex-1",style:{fontSize:`${l}px`},children:e(Xc,{content:t,file:r,active:c,onExit:p})})})}function En(t,r){return r?`Spaces: ${t}`:"Tabs"}function ft({caret:t,eol:r,onSetEol:l,indentWidth:c,insertSpaces:p,language:h,byteViewer:g,viewerKind:v,lineCount:y,conflicts:w=0}){return e("footer",{className:"flex bg-canvas border-t border-ink/10 px-3 items-center justify-between text-[10px] text-ink/50 flex-shrink-0 font-mono h-6","data-editor-status-bar":"",children:[e("div",{className:"flex items-center gap-3 min-w-0",children:g?e("span",{className:"uppercase",children:Go[v]}):e(d,{children:[e("span",{className:"tabular-nums",children:t?`Ln ${t.line}, Col ${t.column}`:"Ln —, Col —"}),e("span",{children:En(c,p)}),e("button",{type:"button",onClick:()=>l(r==="lf"?"crlf":"lf"),className:"uppercase hover:text-ink transition-colors cursor-pointer",title:`Line endings: ${r.toUpperCase()} — click to switch`,"aria-label":`Line endings ${r.toUpperCase()}, switch`,children:r}),e("span",{children:[y," lines"]})]})}),e("div",{className:"flex items-center gap-3 min-w-0",children:[w>0&&e("span",{className:"text-error font-semibold tabular-nums",title:`${w} unresolved conflict${w===1?"":"s"} — markers are highlighted in the file`,children:["⚠ ",w," conflict",w===1?"":"s"]}),e("span",{className:"uppercase text-ink/40",children:h})]})]})}function Tn(t){if(t===0)return 0;return Math.max(-1,Math.min(1,-Math.sign(t)))}function Mn(t,r,l=dl,c=pl){return Math.max(l,Math.min(c,t+r))}function Nn(t,r){let l=t instanceof HTMLElement?t:null;while(l&&l!==r){let c=getComputedStyle(l);if(/(auto|scroll)/.test(c.overflowY)&&l.scrollHeight>l.clientHeight)return!0;l=l.parentElement}return!1}function bt(t,r){o(()=>{if(!t)return;let l=t.closest("[data-code-surface]"),c=l instanceof HTMLElement?l:t,p=(h)=>{if(!h.ctrlKey&&!h.metaKey)return;if(h.preventDefault(),Nn(h.target,c))return;let g=Tn(h.deltaY);if(g===0)return;r((v)=>Mn(v,g))};return t.addEventListener("wheel",p,{passive:!1}),()=>t.removeEventListener("wheel",p)},[t,r])}function ht(t,r){let l=t.trim();if(!/^\d+$/.test(l))return null;let c=Number(l);if(c<1)return null;return Math.min(c,Math.max(r,1))}function gt({lineCount:t,onGo:r,onClose:l}){let[c,p]=n(""),h=i(null);o(()=>{h.current?.focus(),h.current?.select()},[]);let g=()=>{let w=ht(c,t);if(w===null)return;r(w)},v=(w)=>{if(w.key==="Enter"){w.preventDefault(),g();return}if(w.key==="Escape")w.preventDefault(),l()},y=ht(c,t);return e(Z,{onClose:l,maxWidthClass:"max-w-xs",header:e("span",{className:"text-sm font-semibold text-ink",children:"Go to line"}),children:e("div",{className:"px-4 py-3 space-y-2",children:[e("div",{className:"flex items-center gap-2",children:[e("input",{ref:h,value:c,onInput:(w)=>p(w.target.value),onKeyDown:v,inputMode:"numeric",placeholder:"1","aria-label":"Line number",className:"flex-1 bg-paper border border-ink/20 rounded px-2 py-1 text-xs font-mono text-ink outline-none focus:border-ink/40"}),e("span",{className:"text-[10px] font-mono text-ink/40",children:["/ ",t]}),e("button",{type:"button",onClick:g,disabled:y===null,className:"flex items-center gap-1 px-2 py-1 rounded bg-ink text-paper text-xs disabled:opacity-40 disabled:cursor-default cursor-pointer",children:[e(Xe,{size:12}),"Go"]})]}),c&&y!==null&&String(y)!==c.trim()?e("div",{className:"text-[10px] text-ink/50 font-mono",children:["line ",y," (the last line)"]}):null,c&&y===null?e("div",{className:"text-[10px] text-error font-mono",children:"Enter a line number"}):null]})})}var vt={status:"idle",payload:null,message:null};function yt(t){if(!t?.path)return"";return`${t.root??""}\x00${t.repo??""}\x00${t.path}`}function xt(t,r={}){let l=r.enabled!==!1&&Boolean(t?.path)&&t?.deviceFile!==!0,c=r.dirty===!0,p=yt(t),[h,g]=n({key:"",value:vt}),v=i(t);v.current=t;let y=i(p);y.current=p;let w=i(l);w.current=l;let x=i(c);x.current=c;let k=i(h);k.current=h;let O=i(0),C=i(""),M=i(new Map),I=i(new Set),F=a(async()=>{let L=v.current;if(!L?.path)return;let G=yt(L),X=++O.current;C.current=G,g((N)=>({key:G,value:{status:"loading",payload:N.key===G?N.value.payload:null,message:null}}));let Y=new URLSearchParams({blame:"1",file:L.path,repo:L.repo||"."});if(L.root)Y.set("root",L.root);try{let N=await fetch(`/api/fs/git?${Y.toString()}`),P=await N.json().catch(()=>null);if(X!==O.current)return;if(!N.ok||!P){g({key:G,value:{status:"error",payload:null,message:P?.error??`Blame request failed (HTTP ${N.status})`}});return}g({key:G,value:P.available?{status:"ready",payload:P,message:null}:{status:"unavailable",payload:P,message:P.message??null}})}catch(N){if(X!==O.current)return;g({key:G,value:{status:"error",payload:null,message:N instanceof Error?N.message:"Blame failed"}})}finally{if(C.current===G)C.current=""}},[]),z=a(async(L)=>{let G=M.current.get(L);if(G)return G;let X=v.current;if(!X?.path)return{entries:[],truncated:!1};let Y=new URLSearchParams({blameHistory:"1",file:X.path,line:String(L),repo:X.repo||"."});if(X.root)Y.set("root",X.root);try{let P=await(await fetch(`/api/fs/git?${Y.toString()}`)).json().catch(()=>null),H={entries:Array.isArray(P?.entries)?P.entries:[],truncated:P?.truncated===!0};return M.current.set(L,H),H}catch{return{entries:[],truncated:!1}}},[]),A=i(null);if(!A.current)A.current={ensure:()=>{if(!w.current||x.current)return;let L=k.current;if(L.key===y.current&&L.value.status!=="idle")return;if(C.current===y.current)return;F()},reload:()=>{M.current.clear(),F()},history:z,snapshot:()=>{let L=k.current;return L.key===y.current?L.value:vt},stale:()=>x.current,subscribe:(L)=>(I.current.add(L),()=>{I.current.delete(L)})};o(()=>{if(!l||c||!p)return;M.current.clear(),F()},[l,c,p,F]);let V=i(c);return o(()=>{if(V.current===c)return;V.current=c;for(let L of I.current)L()},[c]),o(()=>{for(let L of I.current)L()},[h]),A.current}var Rn="0".repeat(40);function Ne(t){return t===Rn}function ye(t,r=Date.now()){let l=Math.max(0,Math.floor(r/1000)-t);if(l<60)return"just now";let c=Math.floor(l/60);if(c<60)return`${c}m ago`;let p=Math.floor(c/60);if(p<24)return`${p}h ago`;let h=Math.floor(p/24);if(h<30)return`${h}d ago`;let g=Math.floor(h/30);if(g<12)return`${g}mo ago`;return`${Math.floor(h/365)}y ago`}function wt(t,r){switch(t){case"not-repo":return"This folder is not a git repository.";case"no-commit":return"This repository has no commits yet.";case"untracked":return"This file has never been committed, so it has no history.";case"too-large":return r??"This file is too large to blame.";case"empty":return"This file is empty.";default:return r??"git could not read this file."}}var Et="fixed z-50 w-[min(340px,92vw)] rounded-xl border border-ink/20 bg-paper p-3 shadow-xl font-sans text-xs text-ink",kt="flex items-baseline justify-between gap-2",St="truncate text-xs font-semibold text-ink",Pn="shrink-0 font-mono text-[10px] text-ink/40",Ln="mt-1 line-clamp-2 text-[11px] leading-snug text-ink/80",Bn="mt-2 border-t border-ink/10 pt-2",Dn="flex items-center gap-2 font-mono text-[10px] text-ink/40",Ct="mt-1 text-[10px] leading-snug text-ink/50",On="mt-2 flex w-full items-center gap-1.5 text-left text-[10px] text-ink/50 hover:text-ink cursor-pointer",An="mt-1.5 space-y-1 border-t border-ink/10 pt-1.5",Re="flex items-center gap-1.5 font-mono text-[10px]";function q(t,r,l){let c=document.createElement(t);if(c.className=r,l!==void 0)c.textContent=l;return c}function In(t){return new Date(t*1000).toLocaleDateString(void 0,{day:"numeric",month:"short",year:"numeric"})}function Fn(t){let r=t.payload;if(t.status==="error")return{title:"Blame failed",body:t.message??"git could not read this file."};if(t.status==="unavailable")return{title:r?.reason==="untracked"?"Not tracked":"No history",body:wt(r?.reason??"error",t.message??void 0)};if(!r)return null;if(t.stale)return{title:"Not committed yet",body:"This line changed in the editor. Save the file to see its blame."};if(t.line>r.lines)return{title:"Not committed yet",body:`Line ${t.line} is past the end of the file at HEAD (${r.lines} lines).`};let l=r.runs.length>0?Mt(r,t.line):null;if(!l)return{title:"Not committed yet",body:`git has no attribution for line ${t.line}.`};if(Ne(l.sha))return{title:"Not committed yet",body:"This line differs from the last commit."};return null}function Mt(t,r){for(let l of t.runs)if(r>=l.from&&r<=l.to)return t.commits[l.sha]??null;return null}function zn(t,r){t.replaceChildren(),t.className=Et;let l=Fn(r);if(l){let w=q("div",kt);if(w.append(q("span",St,l.title)),r.status==="error"&&r.message){let x=q("button","shrink-0 cursor-pointer text-[10px] text-ink/50 hover:text-ink","Try again");x.type="button",x.setAttribute("aria-label","Read the blame again"),w.append(x)}t.append(w,q("p",Ct,l.body));return}let c=r.payload;if(!c){t.append(q("p",Ct,"Reading blame…"));return}let p=Mt(c,r.line),h=q("div",kt);if(h.append(q("span",St,p.author.trim()||"Unknown"),q("span",Pn,ye(p.time))),t.append(h),p.summary)t.append(q("p",Ln,p.summary));let g=q("div",`${Dn} ${Bn}`);if(g.append(q("code","truncate",p.sha.slice(0,7)),q("span","",In(p.time))),p.mail){let w=q("span","truncate",p.mail);w.title=p.mail,g.append(w)}t.append(g);let v=q("button",On);if(v.type="button",v.setAttribute("aria-expanded",r.historyOpen?"true":"false"),v.textContent=`${r.historyOpen?"▾":"▸"} Line history`,t.append(v),!r.historyOpen)return;let y=q("ol",An);if(r.historyLoading)y.append(q("li",`${Re} text-ink/40`,"Reading history…"));else if(!r.history||r.history.entries.length===0)y.append(q("li",`${Re} text-ink/40`,"No commits touched this line."));else{let w=r.history.entries;if(w.forEach((x,k)=>{let O=q("li",Re),C=k===w.length-1?"new":"edit";O.append(q("span","text-ink/40",k===0?"●":"○"),q("code","text-ink/60",x.sha.slice(0,7)),q("span","truncate text-ink/80",x.author.trim()||"Unknown"),q("span","ml-auto shrink-0 text-ink/40",ye(x.time)),q("span","shrink-0 rounded bg-ink/5 px-1 text-[8.5px] uppercase tracking-wider text-ink/45",C)),y.append(O)}),r.history.truncated)y.append(q("li",`${Re} text-ink/40`,"Older commits are not shown."))}t.append(y)}function Nt(t,r,l){let c=q("div",Et);c.setAttribute("role","dialog"),c.setAttribute("aria-label","Line blame"),c.addEventListener("mousedown",(x)=>x.stopPropagation());let p=null,h=!1,g=!1,v=()=>{let x=r.snapshot();return{line:t,status:x.status,payload:x.payload,message:x.message,stale:r.stale(),history:p,historyOpen:h,historyLoading:g}},y=()=>{zn(c,v());let x=c.querySelector('[aria-label="Read the blame again"]');if(x)x.addEventListener("click",(k)=>{k.stopPropagation(),l()});c.querySelector("button[aria-expanded]")?.addEventListener("click",(k)=>{if(k.stopPropagation(),h=!h,y(),!h||p||g)return;g=!0,y(),r.history(t).then((O)=>{p=O,g=!1,y()})})};y();let w=r.subscribe(y);return{element:c,place(x){let k=c.ownerDocument.defaultView,O=k?.innerWidth??1024,C=k?.innerHeight??768,M=c.offsetWidth||340,I=c.offsetHeight||120,F=8,z=Math.max(8,Math.min(x.left,O-M-8)),A=x.bottom+6,V=x.top-I-6,R=A+I>C-8&&V>8?V:A;c.style.left=`${z}px`,c.style.top=`${Math.max(8,R)}px`},destroy(){w(),c.remove()}}}function Rt(t){return ve.define((r)=>{let l=null,c=0,p,h=()=>{clearTimeout(p),p=void 0,l?.destroy(),l=null,c=0},g=(C,M)=>{let I=C.getBoundingClientRect();if(I.width>0)return{left:I.left,top:I.top,bottom:I.bottom};let F=r.state.doc.line(Math.min(M,r.state.doc.lines)),z=null;try{z=r.coordsAtPos(F.from)}catch{z=null}if(z)return z;let A=r.scrollDOM.getBoundingClientRect();return{left:A.left,top:A.top+24,bottom:A.top+24}},v=(C,M)=>{if(c===C&&l)return;h(),c=C,l=Nt(C,t,()=>{t.reload(),h()}),document.body.append(l.element),l.place(M)},y=(C)=>{let M=C.target,I=M?.closest?.(".cm-blame-label");if(I){let A=Number(I.dataset.blameLine);return Number.isInteger(A)&&A>0?{line:A,anchor:I}:null}let F=M?.closest?.(".cm-lineNumbers .cm-gutterElement");if(!F)return null;let z=Number((F.textContent??"").trim());return Number.isInteger(z)&&z>0?{line:z,anchor:F}:null},w=(C)=>{let M=y(C);if(!M)return;v(M.line,g(M.anchor,M.line))},x=(C)=>{let M=y(C);if(M){C.preventDefault(),v(M.line,g(M.anchor,M.line));return}if(l&&!l.element.contains(C.target))h()},k=(C)=>{if(C.key==="Escape"&&l)h(),C.stopPropagation()},O=(C)=>{if(!l)return;let M=C.relatedTarget;if(M&&(l.element.contains(M)||r.scrollDOM.contains(M)))return;p=setTimeout(h,200)};return r.scrollDOM.addEventListener("mouseover",w),r.scrollDOM.addEventListener("mouseleave",O),r.scrollDOM.addEventListener("mousedown",x),document.addEventListener("mousedown",x),document.addEventListener("keydown",k,!0),{update(C){if(C.docChanged&&l)h()},destroy(){h(),r.scrollDOM.removeEventListener("mouseover",w),r.scrollDOM.removeEventListener("mouseleave",O),r.scrollDOM.removeEventListener("mousedown",x),document.removeEventListener("mousedown",x),document.removeEventListener("keydown",k,!0)}}})}var Pt=40,Bt=ae.define();function Hn(t){return Me.define({create:()=>({payload:t.snapshot().payload,stale:!1}),update(r,l){let c=r;for(let p of l.effects){if(!p.is(Bt))continue;c=p.value.payload!==r.payload?{payload:p.value.payload,stale:!1}:{payload:r.payload,stale:r.stale}}if(l.docChanged&&!c.stale)c={payload:c.payload,stale:!0};return c}})}function $n(t,r,l){let c=t.commits[r];if(!c||Ne(r))return null;let p=c.author.trim()||"Unknown";return l?p:`${p} · ${ye(c.time)}`}class Dt extends Zt{constructor(t,r,l){super();this.line=t;this.text=r;this.title=l}eq(t){return t.line===this.line&&t.text===this.text&&t.title===this.title}toDOM(){let t=document.createElement("span");return t.className="cm-blame-label",t.dataset.blameLine=String(this.line),t.title=this.title,t.textContent=this.text,t}}function Lt(t,r,l){let{payload:c,stale:p}=t;if(!c?.available||p)return T.none;let h=Math.min(c.lines,r.state.doc.lines);if(h<1)return T.none;let g=r.state.doc.lineAt(Math.max(0,Math.min(r.viewport.from,r.state.doc.length))).number,v=r.state.doc.lineAt(Math.max(0,Math.min(r.viewport.to,r.state.doc.length))).number,y=Math.max(1,g-Pt),w=Math.min(h,v+Pt),x=[];for(let k of c.runs){let O=Math.max(k.from,y);if(O>k.to||O>w)continue;let C=$n(c,k.sha,l);if(!C)continue;let M=c.commits[k.sha],I=r.state.doc.line(O);x.push({from:I.to,deco:T.widget({widget:new Dt(I.number,C,M.summary||M.sha),side:1})})}return T.set(x.map((k)=>k.deco.range(k.from)),!0)}function Wn(t,r){return ve.fromClass(class{constructor(l){this.view=l;this.decorations=Lt(l.state.field(t),l,r)}update(l){if(l.startState.field(t)===l.state.field(t)&&!l.docChanged&&!l.viewportChanged)return;this.decorations=Lt(l.state.field(t),l.view,r)}},{decorations:(l)=>l.decorations})}function Kn(t){return ve.define((r)=>{let l=!0,c=()=>{if(!l)return;let h=t.snapshot();r.dispatch({effects:Bt.of({payload:h.payload,stale:!1})})},p=t.subscribe(c);return{destroy(){l=!1,p()}}})}function Ot({controller:t,inline:r=!0,compact:l=!1}){let c=Hn(t);return[c,Kn(t),r?Wn(c,l):[],Rt(t)]}function At({activeFile:t,editor:r,find:l,surfaceRef:c,goToLineRequest:p,rootPath:h=null,repoPath:g=null,onRunCommand:v,wordWrap:y,zoomLevel:w,setZoomLevel:x,editorFontFamily:k,editorTheme:O,viewerKind:C,isPreview:M,reviewActive:I,onToggleReview:F,revealActive:z}){let A=C==="markdown",V=yu(),R=ku(),L=zd(),G=xt({name:t.name,path:t.path,root:t.root??h??void 0,repo:t.repo??g??"."},{enabled:L.enabled,dirty:r.isDirty}),X=u(()=>L.enabled?Ot({controller:G,inline:L.inline}):null,[L.enabled,L.inline,G]),[Y,N]=n(null),P=u(()=>eu(r.content),[r.content]),[H,J]=n(!1);o(()=>{if(p>0)J(!0)},[p]);let[Q,te]=n(null),[ie,le]=n(null);bt(Q,x);let ee=xl({tabKey:String(t.id),surface:A&&M?"rendered":"code",ready:r.loaded,element:A&&M?void 0:Q}),ne=a((de)=>{ee.ref(de),le(de)},[ee.ref]);return ru({path:t.path,scroller:ie,preview:A&&M}),e("div",{className:"relative flex-1 min-h-0 flex flex-col",children:[l.open?e(nu,{find:l}):null,H?e(gt,{lineCount:r.content?r.content.split(`
2
- `).length:1,onGo:(de)=>{J(!1);let ce=br(r.content,de-1);c.current?.select(ce,ce,!0),c.current?.revealOffset(ce)},onClose:()=>J(!1)}):null,A&&M?e(pt,{content:r.content,file:{name:t.name,path:t.path,root:t.root,repo:t.repo},zoomLevel:w,reviewActive:I,onExitReview:F,scrollRef:ne,onScroll:ee.onScroll}):e(tu,{ref:c,value:r.content,onValueChange:r.onChange,language:r.language,wordWrap:y,documentKey:String(t.id),marks:l.open||z?l.matches:void 0,currentMark:l.currentIndex,onCommand:v,onScroller:te,onCaret:N,scrollTestId:"editor-scroller",className:"flex-1 min-h-0 text-ink select-text",blame:X,themeVars:O.vars,themes:O.themes,indentUnitText:bu(V),typing:R,padding:16,placeholder:"This file is empty",style:{fontFamily:k,fontSize:`${w}px`,lineHeight:ul}}),!A||!M?e(ft,{caret:Y,eol:r.eol,onSetEol:r.setEol,indentWidth:V.width,insertSpaces:V.insertSpaces,language:r.language,byteViewer:r.isBinaryViewer,viewerKind:C,lineCount:r.content?r.content.split(`
3
- `).length:0,conflicts:P}):null]})}function It({activeFile:t,editor:r,find:l,surfaceRef:c,pluginFileView:p,wordWrap:h,setWordWrap:g,viewerKind:v,isPreview:y,isReviewing:w,onToggleReview:x,isMaximized:k,setIsMaximized:O,zoomLevel:C,setZoomLevel:M,goToLineRequest:I,onSaveAs:F,rootPath:z=null,repoPath:A=null,runCommand:V,editorFontFamily:R,editorTheme:L,togglePreview:G,revealActive:X,missing:Y}){let N=Bs[v]===!0,P=au[v]===!0,H=a(async(J)=>{let Q=await cu(t,J,{interactive:!0,baseMtimeMs:r.baseMtimeMs});if(Q.status==="written")return{ok:!0};if(Q.status==="conflict")return{ok:!1,error:"This file changed on disk since it was opened."};if(Q.status==="needs-permission")return{ok:!1,error:"Click Save again to grant write access."};return{ok:!1,error:Q.error}},[t,r.baseMtimeMs]);return e(d,{children:[e(ut,{path:t.path,saveStatus:r.saveStatus,wordWrap:h,hasPreview:P,isPreview:y,hasReview:v==="markdown"&&y,isReviewing:w,copied:r.copied,byteViewer:N,saveDisabled:Boolean(r.loadError)||r.handleMissing||r.deviceBacked,unsupported:Boolean(r.unsupported),handleMissing:r.handleMissing,readOnly:r.deviceBacked,isMaximized:k,findOpen:l.open,onToggleFind:()=>l.open?l.close():l.openFind(),onSave:r.saveNow,onTogglePreview:G,onToggleReview:x,onToggleWordWrap:()=>g(!h),onZoomIn:()=>M((J)=>Math.min(pl,J+1)),onZoomOut:()=>M((J)=>Math.max(dl,J-1)),onCopy:r.copy,onDownload:r.download,onReload:r.reloadFromDisk,onSaveAs:F,canReload:Dl(t)&&!r.loadError&&!r.unsupported,refreshing:r.isReading,reloadDiscardsEdits:r.isDirty,onToggleMaximize:()=>O(!k)}),Y&&e("div",{className:"flex items-start gap-2 px-3 py-2 border-b border-error/30 bg-error/10 text-error",children:[e(_,{size:14,className:"shrink-0 mt-0.5"}),e("div",{className:"min-w-0",children:[e("div",{className:"text-[11.5px] font-sans",children:"This file was deleted from disk."}),e("div",{className:"text-[11px] font-sans text-error/80",children:"The buffer is still here. Saving recreates the file — autosave is off until then."})]})]}),r.conflict&&e(Te,{diskMtimeMs:r.conflict.diskMtimeMs,fileName:t.name,onReload:r.resolveConflictByReload,onKeepMine:r.resolveConflictByKeepingMine}),r.handleMissing&&e("div",{className:"flex items-start gap-2 px-3 py-2 border-b border-warning/30 bg-warning/10 text-warning",children:[e(_,{size:14,className:"shrink-0 mt-0.5"}),e("div",{className:"min-w-0",children:[e("div",{className:"text-[11.5px] font-sans",children:"This file was opened by the system, not from a workspace."}),e("div",{className:"text-[11px] font-sans text-warning/80",children:"Its write permission ended with the last page load. Reopen the file from the OS to edit it again."})]})]}),r.deviceBacked&&e("div",{className:"flex items-start gap-2 px-3 py-2 border-b border-ink/20 bg-ink/5 text-ink/70",children:[e(_,{size:14,className:"shrink-0 mt-0.5"}),e("div",{className:"min-w-0",children:[e("div",{className:"text-[11.5px] font-sans",children:r.deviceMissing?"The bytes for this file did not survive the reload.":"Opened from this device, so it is read-only here."}),e("div",{className:"text-[11px] font-sans text-ink/50",children:r.deviceMissing?"A phone's file lives only on the phone, so it cannot be re-read. Open it again from the app that shared it.":"The console cannot reach a file on your phone. Copy it into a workspace to edit it."})]})]}),r.isImage&&r.imageUrl?e(Ei,{src:r.imageUrl,name:t.name,className:"flex-1 min-h-0"}):r.isImage?e(Tl,{kind:"image",path:t.path,name:t.name,source:r.byteSource,content:r.content,revision:r.revision}):r.isLoading?e("div",{className:"flex-1 flex items-center justify-center gap-2 text-ink/40 text-xs font-mono",children:[e(m,{size:14,className:"animate-spin"}),e("span",{children:"Loading file content…"})]}):r.unsupported?e("div",{className:"flex-1 flex flex-col items-center justify-center gap-2 px-6 text-center",children:[e(Jc,{size:20,className:"text-ink/40"}),e("span",{className:"text-xs text-ink/70 font-sans",children:[t.name," cannot be opened here"]}),e("span",{className:"text-[11px] text-ink/50 font-sans max-w-[42ch]",children:r.unsupported})]}):r.loadError?e("div",{className:"flex-1 flex flex-col items-center justify-center gap-2 px-6 text-center",children:[e(_,{size:20,className:"text-error"}),e("span",{className:"text-xs text-error font-sans",children:["Could not read ",t.name]}),e("span",{className:"text-[11px] text-ink/50 font-mono break-all",children:r.loadError})]}):p&&!r.isImage?e(Vg,{view:p}):su(v)&&(N||y)?e(Tl,{kind:v,path:t.path,name:t.name,source:r.byteSource,content:r.content,root:t.root??z,repo:t.repo??A,revision:r.revision,onContentChange:r.onChange,onSaveBytes:r.deviceBacked?void 0:H,onDirtyChange:r.setBinaryDirty}):e(At,{activeFile:t,editor:r,find:l,surfaceRef:c,goToLineRequest:I,rootPath:z,repoPath:A,onRunCommand:V,wordWrap:h,zoomLevel:C,setZoomLevel:M,editorFontFamily:R,editorTheme:L,isPreview:y,reviewActive:w,onToggleReview:x,viewerKind:v,revealActive:X})]})}function Ft({activeFile:t,editor:r,find:l,surfaceRef:c,pluginFileView:p,wordWrap:h,setWordWrap:g,viewerKind:v,isPreview:y,isReviewing:w,onToggleReview:x,isMaximized:k,setIsMaximized:O,zoomLevel:C,setZoomLevel:M,goToLineRequest:I,onSaveAs:F,rootPath:z=null,repoPath:A=null,runCommand:V,editorFontFamily:R,editorTheme:L,togglePreview:G,revealActive:X,missing:Y,onConvertDiffToEditor:N,onFileSaved:P}){if(!t)return e("div",{className:"flex-1 flex items-center justify-center text-ink/40",children:e("p",{className:"font-mono text-sm",children:"Select a tab to view content"})});if(t.isDiff)return e(Zc,{filePath:t.path,status:t.diffStatus||"M",isStaged:Boolean(t.diffStaged),root:t.root,repo:t.repo||".",journalDiff:t.journalDiff,readOnly:t.diffSource==="journal",onOpenInEditor:()=>N(t.id),onFileSaved:P,className:"flex-1",tabKey:String(t.id)});return e(It,{activeFile:t,editor:r,find:l,surfaceRef:c,pluginFileView:p,wordWrap:h,setWordWrap:g,viewerKind:v,isPreview:y,isReviewing:w,onToggleReview:x,isMaximized:k,setIsMaximized:O,zoomLevel:C,setZoomLevel:M,goToLineRequest:I,onSaveAs:F,rootPath:z,repoPath:A,runCommand:V,editorFontFamily:R,editorTheme:L,togglePreview:G,revealActive:X,missing:Y})}function zt({pluginId:t,Component:r,sessionId:l,className:c="",onHide:p}){return e("div",{className:`flex flex-col h-full bg-canvas ${c}`,children:[p&&e("div",{className:"flex justify-end flex-shrink-0 border-b border-ink/10",children:e(be,{onHide:p})}),e(et,{pluginId:t,children:e(r,{sessionId:l,workspacePath:null})})]})}function Ht({className:t="",onHide:r}){return e("div",{className:`relative flex flex-col h-full bg-canvas items-center justify-center text-muted ${t}`,children:[r&&e("div",{className:"absolute top-0 right-0 flex items-center",children:e(be,{onHide:r})}),e(ct,{name:"placeholder.txt",size:48,className:"mb-4 opacity-20"}),e("p",{className:"font-mono text-sm",children:"Select a file to open"})]})}function $t({searchReveal:t,revealMatch:r}){let l=i(r);l.current=r;let c=i(null);o(()=>{if(!t||c.current===t.request)return;c.current=t.request,l.current({query:t.request.query,options:t.request.options,line:t.request.line})},[t])}function Wt({openedFiles:t,dirtyKeys:r,activeFile:l,previewReady:c,setPreviewMode:p,sessionId:h}){o(()=>{let g=new Set(t.filter((v)=>!v.isDiff&&v.content===void 0).map((v)=>v.id));_e([...r].filter((v)=>g.has(v)))},[r,t]),o(()=>{if(!c)return;let g=l?.id;if(!l||g===void 0||g===null)return;if(!ou(Is(l.name)))return;let v=xe(h,"editor.previewMode");if(v&&v[g]!==void 0)return;p((y)=>y[g]===void 0?{...y,[g]:!0}:y)},[c,l])}function Kt({activeFile:t,externalChange:r,conflict:l,onReload:c,onKeepMine:p}){if(!t)return null;if(l)return e(Te,{diskMtimeMs:l.diskMtimeMs,fileName:t.name,onReload:c,onKeepMine:p});if(r)return e(fu,{fileName:t.name,onReload:c,onKeepMine:p});return null}async function Vt(t){let r=t.name.trim();if(!r)return{status:"failed",reason:"Enter a file name."};let l=new FormData;if(l.append("actionType","saveAs"),l.append("path",t.parent),l.append("name",r),l.append("content",t.content),l.append("eol",t.eol),t.root)l.append("root",t.root);if(t.repo&&t.repo!==".")l.append("repo",t.repo);try{let c=await fetch("/api/fs/action",{method:"POST",body:l}),p=await c.json().catch(()=>null),h=typeof p?.error==="string"?p.error:null;if(c.status===409)return{status:"exists",reason:h??`${r} already exists.`};if(c.ok&&p?.success&&typeof p.path==="string")return{status:"written",path:p.path};return{status:"failed",reason:h??"The file could not be written."}}catch{return{status:"failed",reason:"The file could not be written."}}}function Ut(t){let r=t.lastIndexOf(".");if(r<=0)return`${t} copy`;return`${t.slice(0,r)} copy${t.slice(r)}`}function _t(t){let r=t.trim();if(!r)return!1;if(r==="."||r==="..")return!1;return!r.includes("/")&&!r.includes("\\")}function Vn(t){let r=t.lastIndexOf("/");return r===-1?"":t.slice(0,r)}function Gt({fileName:t,filePath:r,content:l,eol:c,root:p,repo:h,onSaved:g,onClose:v}){let[y,w]=n(()=>Vn(r)),[x,k]=n(()=>Ut(t)),[O,C]=n(!1),[M,I]=n(null),F=i(null);o(()=>{F.current?.focus(),F.current?.select()},[]);let z=_t(x),A=async()=>{if(!z||O)return;C(!0),I(null);let R=await Vt({parent:y,name:x,content:l,eol:c,root:p,repo:h});if(C(!1),R.status==="written"){g({path:R.path});return}I(R.reason)},V=(R)=>{if(R.key==="Enter"){R.preventDefault(),A();return}if(R.key==="Escape")R.preventDefault(),v()};return e(Z,{onClose:v,maxWidthClass:"max-w-md",header:e("span",{className:"text-sm font-semibold text-ink",children:"Save as"}),footer:e("div",{className:"flex items-center justify-end gap-2 px-4 py-3 border-t border-ink/10",children:[e("button",{type:"button",onClick:v,className:"px-3 py-1.5 rounded border border-ink/20 text-ink/80 hover:bg-ink/5 transition-colors cursor-pointer",children:"Cancel"}),e("button",{type:"button",onClick:()=>void A(),disabled:!z||O,className:"flex items-center gap-1.5 px-3 py-1.5 rounded bg-ink text-paper disabled:opacity-40 disabled:cursor-default cursor-pointer",children:[O?e(m,{size:12,className:"animate-spin"}):e(Xe,{size:12}),"Save"]})]}),children:e("div",{className:"px-4 py-3 space-y-2 text-xs",children:[e("label",{className:"block",children:[e("span",{className:"block text-[10px] uppercase tracking-wide text-ink/50 mb-1",children:"Folder"}),e("input",{value:y,onInput:(R)=>w(R.target.value),onKeyDown:V,placeholder:"(workspace root)","aria-label":"Destination folder",className:"w-full bg-paper border border-ink/20 rounded px-2 py-1 font-mono text-ink outline-none focus:border-ink/40"})]}),e("label",{className:"block",children:[e("span",{className:"block text-[10px] uppercase tracking-wide text-ink/50 mb-1",children:"Name"}),e("input",{ref:F,value:x,onInput:(R)=>k(R.target.value),onKeyDown:V,"aria-label":"File name","aria-invalid":!z,className:`w-full bg-paper border rounded px-2 py-1 font-mono text-ink outline-none ${z?"border-ink/20 focus:border-ink/40":"border-error text-error"}`})]}),!z?e("div",{className:"text-[10px] text-error font-mono",children:"Enter a file name without a path separator"}):null,M?e("div",{className:"text-[10px] text-error font-mono",children:M}):null,e("div",{className:"text-[10px] text-ink/40",children:"The original file stays where it is, and its tab stays open."})]})})}function qt(){o(()=>{let t=(r)=>{if(!Ze())return;r.preventDefault(),r.returnValue=""};return window.addEventListener("beforeunload",t),()=>window.removeEventListener("beforeunload",t)},[])}function Xt({fileName:t,onAnswer:r}){return e(Z,{onClose:()=>r("cancel"),header:e("div",{className:"flex items-center gap-2",children:[e(_,{size:15,className:"text-warning"}),e("span",{className:"text-sm font-semibold text-ink",children:"Unsaved changes"})]}),footer:e("div",{className:"flex items-center justify-end gap-2 px-4 py-3 border-t border-ink/10",children:[e("button",{type:"button",onClick:()=>r("cancel"),className:"px-3 py-1.5 rounded border border-ink/20 text-ink/80 hover:bg-ink/5 transition-colors cursor-pointer",children:"Cancel"}),e("button",{type:"button",onClick:()=>r("discard"),className:"px-3 py-1.5 rounded border border-error/40 text-error hover:bg-error/10 transition-colors cursor-pointer",children:"Discard"}),e("button",{type:"button",onClick:()=>r("save"),className:"px-3 py-1.5 rounded bg-ink text-paper hover:bg-ink/90 transition-colors cursor-pointer",children:"Save & close"})]}),children:e("div",{className:"px-4 py-3 text-xs text-ink/80",children:[e("span",{className:"font-mono text-ink",children:t})," has changes that are not on disk.",e("div",{className:"mt-1 text-ink/50",children:"Discarding them cannot be undone."})]})})}function Yt({closeGuard:t,activeFile:r,saveMissingConfirm:l,onCancelSaveMissing:c,onConfirmSaveMissing:p}){if(t.pending)return e(Xt,{fileName:t.pending.name,onAnswer:t.answer});if(l&&r)return e(gu,{fileName:r.name,filePath:r.path,onClose:c,onConfirm:p});return null}function jt({className:t="",isMaximized:r,onKeyDownCapture:l,onFocusCapture:c,asSplitPane:p,tabs:h,activeFile:g,editor:v,externalChange:y,conflict:w,onReload:x,onKeepMine:k,body:O,saveAsOpen:C,onSaveAsClose:M,onSavedAs:I,closeGuard:F}){let z=r?"fixed inset-0 z-50 flex flex-col bg-canvas":`flex flex-col h-full bg-canvas ${t}`;return e("div",{className:z,onKeyDownCapture:l,onFocusCapture:c,children:[p?null:h,e(Kt,{activeFile:g,externalChange:y,conflict:w,onReload:x,onKeepMine:k}),O,C&&g?e(Gt,{fileName:g.name,filePath:g.path,content:v.content,eol:v.eol,root:g.root,repo:g.repo,onSaved:({path:A})=>I(A),onClose:M}):null,e(Yt,{closeGuard:F,activeFile:g,saveMissingConfirm:v.saveMissingConfirm,onCancelSaveMissing:v.cancelSaveMissing,onConfirmSaveMissing:v.confirmSaveMissing})]})}function Jt({fileName:t,onClose:r,children:l}){return e("div",{className:"flex flex-col h-full min-w-0","data-split-pane":"",children:[e("div",{className:"flex items-center justify-between gap-2 px-3 py-1 border-b border-ink/10 bg-canvas flex-shrink-0",children:[e("span",{className:"text-[11px] font-mono text-ink/60 truncate",title:t,children:t}),e("button",{type:"button",onClick:r,className:"p-0.5 rounded hover:bg-ink/10 text-ink/50 hover:text-ink transition-colors cursor-pointer flex-shrink-0",title:"Close this pane (the tab stays open)","aria-label":"Close split pane",children:e(b,{size:12})})]}),e("div",{className:"flex-1 min-h-0",children:l})]})}function Qt({fraction:t,onFraction:r,rightPaneName:l,onClosePane:c,rightPane:p,children:h}){let g=i(null),v=i(null),y=Xm(v),w=(x)=>{let k=x.currentTarget,O=g.current;if(!k||!O)return;k.setPointerCapture(x.pointerId);let C=(I)=>{let F=O.getBoundingClientRect();if(F.width===0)return;r(pe((I.clientX-F.left)/F.width))},M=()=>{k.releasePointerCapture(x.pointerId),k.removeEventListener("pointermove",C),k.removeEventListener("pointerup",M)};k.addEventListener("pointermove",C),k.addEventListener("pointerup",M)};return e("div",{ref:g,className:"flex w-full h-full","data-split-column":"",children:[e("div",{className:"flex flex-col min-w-0 h-full",style:{width:`${Math.round(pe(t)*100)}%`},children:h}),e("div",{ref:v,className:`w-[3px] flex-shrink-0 cursor-col-resize transition-colors active:bg-ink/40 ${y?"bg-ink/40":"bg-ink/10"}`,role:"separator","aria-orientation":"vertical","aria-label":"Resize split panes",onPointerDown:w}),e("div",{className:"flex-1 min-w-0 h-full",children:e(Jt,{fileName:l,onClose:c,children:p})})]})}function en({openedFiles:t,activeFileId:r,enabled:l}){let[c,p]=S("editor.split",ge),h=t.map((k)=>k.id),g=tt(nt(c,h),r),v=l&&g.rightFileId!==null?t.find((k)=>k.id===g.rightFileId)??null:null,y=a((k)=>{if(k!==null&&!Ee(k,r,h))return;p({...g,rightFileId:k})},[g,p,r,h]),w=a(()=>p({...g,rightFileId:null}),[g,p]),x=a((k)=>p({...g,fraction:pe(k)}),[g,p]);return{rightFile:v,fraction:g.fraction,splitTo:y,close:w,setFraction:x}}function tn({find:t,runCommand:r,reopenClosed:l}){let c=i(t);c.current=t;let p=i(r);p.current=r;let h=i(l);return h.current=l,{onKeyDownCapture:a((v)=>{let y=c.current;if(v.key==="Escape"){if(!y.open)return;v.preventDefault(),v.stopPropagation(),y.close();return}if((v.metaKey||v.ctrlKey)&&v.shiftKey&&v.code==="KeyT"){if(h.current?.())v.preventDefault(),v.stopPropagation();return}let w=Ih(wi,v);if(!w||!_f(w))return;v.preventDefault(),v.stopPropagation(),p.current(w)},[])}}function nn(t){let r=i(t);r.current=t;let l=i(null);if(!l.current)l.current={saveNow:()=>r.current.saveNow(),runCommand:(p)=>r.current.runCommand(p)};return o(()=>{let p=l.current;if(!p)return;return Gg(p)},[]),{onFocusCapture:a(()=>{if(l.current)Gg(l.current)},[])}}function on({openedFiles:t,activeFileId:r,onSelectFile:l,onCloseFile:c,saveNow:p}){let[h,g]=n(null);qt();let v=a((w)=>{let x=t.find((k)=>k.id===w);if(x&&qe(w)){g(x);return}c(w)},[t,c]),y=a((w)=>{let x=h;if(!x)return;if(w==="cancel"){g(null);return}if(w==="save"){if(x.id!==r)l(x.id);p()}g(null),c(x.id)},[h,r,l,p,c]);return{requestClose:v,pending:h,answer:y}}function an(){let[t,r]=n(0),[l,c]=n(!1),p=a(()=>r((h)=>h+1),[]);return{goToLineRequest:t,openGoToLine:p,saveAsOpen:l,setSaveAsOpen:c}}function Un({className:t="",openedFiles:r,activeFileId:l,onSelectFile:c,onCloseFile:p,onConvertDiffToEditor:h,refreshKey:g=0,onFileSaved:v,onOpenPath:y,onReopenClosed:w,reopenableCount:x,onCopyPath:k,onRevealInFiles:O,rootPath:C=null,repoPath:M=null,activeEditorPanelKey:I=null,forcedActiveFileId:F=null,asSplitPane:z=!1,onHidePanel:A}){let V=z?F:l,R=r.find((W)=>W.id===V),[L,G,X]=S("editor.previewMode",{}),Y=Au(String(V??"")),[N,P]=S("editor.zoomLevel",So),[H,J]=n(!1),[Q,te]=S("editor.wordWrap",!0),ie=an(),{sessionId:le}=Oe(),ee=en({openedFiles:r,activeFileId:V,enabled:!z}),ne=i(null),de=Do(),ce=Bi(),he=lu(r,g),Ie=Boolean(R&&he.has(R.id)),j=uu(R??null,{reportSaveError:!0,onFileSaved:v,missing:Ie}),sn=Kg({path:R?.path??"",content:j.content,language:j.language}),ln=j.diskChange,Fe=on({openedFiles:r,activeFileId:V,onSelectFile:c,onCloseFile:p,saveNow:j.saveNow}),we=du({text:j.content,documentKey:`${R?.id??""}\x00${j.language}`,readSelection:()=>ne.current?.getSelection()??null,select:(W,me,Be=!0)=>ne.current?.select(W,me,Be),reveal:(W)=>ne.current?.revealOffset(W),applyDocument:(W,me,Be)=>ne.current?.applyDocument(W,me,Be),toggleWordWrap:()=>te((W)=>!W)}),ze=pu(R?.path??null,j.content,j.loaded&&!j.loadError);$t({searchReveal:ze,revealMatch:we.revealMatch}),mu({file:R,editor:j,surfaceRef:ne,isPreview:R?L[R.id]===!0:!1,exitPreview:()=>{let W=R?.id;if(W===void 0||W===null)return;G((me)=>({...me,[W]:!1}))}}),o(()=>{if(g>0)j.reset()},[g]),o(()=>{j.retain(r.map((W)=>W.id)),Ge(r.map((W)=>W.id))},[r]),Wt({openedFiles:r,dirtyKeys:j.dirtyKeys,activeFile:R,previewReady:X,setPreviewMode:G,sessionId:le});let dn=()=>{if(!R)return;G((W)=>({...W,[R.id]:!W[R.id]}))},Pe=(W)=>{if(_f(W)){we.runCommand(W);return}if(W==="toggleWordWrap"){te((me)=>!me);return}if(W==="goToLine"){ie.openGoToLine();return}ne.current?.runCommand(W)},cn=tn({find:we,runCommand:Pe,reopenClosed:w}),un=nn({saveNow:j.saveNow,runCommand:Pe}),Le=$h(I);if(Le)return e(zt,{pluginId:Le.pluginId,Component:Le.Component,sessionId:le,className:t,onHide:A});if(r.length===0)return e(Ht,{className:t,onHide:A});let pn=j.viewerKind,He=R?L[R.id]:!1,fn={activeFile:R,editor:j,find:we,surfaceRef:ne,pluginFileView:sn,wordWrap:Q,setWordWrap:te,viewerKind:pn,isPreview:Boolean(He),isReviewing:Boolean(He)&&Y.active,onToggleReview:Y.toggle,isMaximized:H,setIsMaximized:J,zoomLevel:N,setZoomLevel:P,goToLineRequest:ie.goToLineRequest,onSaveAs:()=>ie.setSaveAsOpen(!0),onOpenPath:y,rootPath:C,repoPath:M,runCommand:Pe,editorFontFamily:de,editorTheme:ce,togglePreview:dn,revealActive:Boolean(ze),missing:Ie,onConvertDiffToEditor:h,onFileSaved:v},bn=(W)=>({openedFiles:r,activeFileId:l,onSelectFile:c,onCloseFile:p,onConvertDiffToEditor:h,refreshKey:g,onFileSaved:v,onOpenPath:y,rootPath:C,repoPath:M,forcedActiveFileId:W,asSplitPane:!0}),hn=e(it,{openedFiles:r,activeFileId:l,onSelectFile:c,onCloseFile:Fe.requestClose,missingIds:he,onCopyPath:k,onRevealInFiles:O,onReopenClosed:w,reopenableCount:x,onSplitTo:ee.splitTo,onUnsplit:ee.close,splitRightFileId:ee.rightFile?.id??null,onHide:A}),$e=e(jt,{className:t,isMaximized:H,onKeyDownCapture:cn.onKeyDownCapture,onFocusCapture:un.onFocusCapture,asSplitPane:z,tabs:hn,activeFile:R,editor:j,externalChange:ln,conflict:j.conflict,onReload:j.resolveConflictByReload,onKeepMine:j.keepMineAgainstDisk,body:e(Ft,{...fn}),saveAsOpen:ie.saveAsOpen,onSaveAsClose:()=>ie.setSaveAsOpen(!1),onSavedAs:(W)=>{ie.setSaveAsOpen(!1),y?.(W)},closeGuard:Fe});if(!ee.rightFile)return $e;return e(Qt,{fraction:ee.fraction,onFraction:ee.setFraction,rightPaneName:ee.rightFile.name,onClosePane:ee.close,rightPane:e(Un,{...bn(ee.rightFile.id)}),children:$e})}export{Un as Editor};
@@ -1,2 +0,0 @@
1
- import{n,R,ge,us,_g}from"./index-x2v1zmth.js";var r={left:_g.left,right:_g.right},a="omp:mobile-panel-nav-changed";function s(e,t){return us(R(r[e],t))}function Pf(e,t){if(typeof window>"u")return;window.dispatchEvent(new CustomEvent(a,{detail:{side:e,style:us(t)}}))}function Fd(e){let[t,i]=n(()=>s(e));return ge(a,(l)=>{let o=l.detail;if(o?.side!==e)return;i(us(o.style))}),t}
2
- export{Pf,Fd};