dispach 0.2.3 → 0.2.4

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 (209) hide show
  1. package/README.md +29 -25
  2. package/dist/APEv2Parser-x13n424p.js +5 -0
  3. package/dist/{FlacParser-drm5wq0p.js.map → APEv2Parser-x13n424p.js.map} +1 -1
  4. package/dist/{AiffParser-9hj6fpmy.js → AiffParser-ns1y9f0g.js} +3 -3
  5. package/dist/{AiffParser-9hj6fpmy.js.map → AiffParser-ns1y9f0g.js.map} +1 -1
  6. package/dist/App-wkpkwgjt.js +11 -0
  7. package/dist/{App-2f72vhjv.js.map → App-wkpkwgjt.js.map} +1 -1
  8. package/dist/AsfParser-bae2a1yf.js +5 -0
  9. package/dist/{AsfParser-7emspn04.js.map → AsfParser-bae2a1yf.js.map} +1 -1
  10. package/dist/ConfigEditor-hy9jtas3.js +6 -0
  11. package/dist/{ConfigEditor-vk7vxaa6.js.map → ConfigEditor-hy9jtas3.js.map} +1 -1
  12. package/dist/DsdiffParser-s0zvxnfa.js +5 -0
  13. package/dist/{DsdiffParser-dz88pnnr.js.map → DsdiffParser-s0zvxnfa.js.map} +1 -1
  14. package/dist/{DsfParser-qgh63tbs.js → DsfParser-90mvzt4v.js} +3 -3
  15. package/dist/{DsfParser-qgh63tbs.js.map → DsfParser-90mvzt4v.js.map} +1 -1
  16. package/dist/FlacParser-8xprykrh.js +5 -0
  17. package/dist/{APEv2Parser-ysjr6adv.js.map → FlacParser-8xprykrh.js.map} +1 -1
  18. package/dist/{KeyProbe-5anphmb7.js → KeyProbe-fk5krzks.js} +3 -3
  19. package/dist/{KeyProbe-5anphmb7.js.map → KeyProbe-fk5krzks.js.map} +1 -1
  20. package/dist/MP4Parser-nmvbkq21.js +5 -0
  21. package/dist/{MP4Parser-yr7p3z12.js.map → MP4Parser-nmvbkq21.js.map} +2 -2
  22. package/dist/{MatroskaParser-jkbsbsk3.js → MatroskaParser-tsmz2qfq.js} +3 -3
  23. package/dist/{MatroskaParser-jkbsbsk3.js.map → MatroskaParser-tsmz2qfq.js.map} +1 -1
  24. package/dist/{MpegParser-t93vwnew.js → MpegParser-y5fjpaz9.js} +3 -3
  25. package/dist/{MpegParser-t93vwnew.js.map → MpegParser-y5fjpaz9.js.map} +1 -1
  26. package/dist/MusepackParser-544q0byg.js +5 -0
  27. package/dist/{MusepackParser-6e8kbh2d.js.map → MusepackParser-544q0byg.js.map} +2 -2
  28. package/dist/OggParser-v77rbjnt.js +5 -0
  29. package/dist/{OggParser-ggcypmag.js.map → OggParser-v77rbjnt.js.map} +1 -1
  30. package/dist/Picker-32m79nmp.js +5 -0
  31. package/dist/{Picker-j7txnm7w.js.map → Picker-32m79nmp.js.map} +1 -1
  32. package/dist/SessionPicker-9p06npt5.js +5 -0
  33. package/dist/{SessionPicker-hpv2ncsb.js.map → SessionPicker-9p06npt5.js.map} +1 -1
  34. package/dist/SkillBrowser-ezdx3xsh.js +5 -0
  35. package/dist/{SkillBrowser-qc542n71.js.map → SkillBrowser-ezdx3xsh.js.map} +1 -1
  36. package/dist/WavPackParser-k623m0hk.js +5 -0
  37. package/dist/{WavPackParser-jw9stzqp.js.map → WavPackParser-k623m0hk.js.map} +1 -1
  38. package/dist/WaveParser-nj4p1vx8.js +5 -0
  39. package/dist/{WaveParser-epmncs9w.js.map → WaveParser-nj4p1vx8.js.map} +1 -1
  40. package/dist/WizardApp-p350qspw.js +5 -0
  41. package/dist/{WizardApp-pgzcz9zq.js.map → WizardApp-p350qspw.js.map} +1 -1
  42. package/dist/channels-a9zx9yba.js +31 -0
  43. package/dist/{channels-m8nambmm.js.map → channels-a9zx9yba.js.map} +1 -1
  44. package/dist/config-3mz4zwsf.js +24 -0
  45. package/dist/{config-hmgrqgf2.js.map → config-3mz4zwsf.js.map} +2 -2
  46. package/dist/credential-ja7zmd4c.js +19 -0
  47. package/dist/{credential-nkb2ya59.js.map → credential-ja7zmd4c.js.map} +1 -1
  48. package/dist/index-039ew35r.js +6 -0
  49. package/dist/index-039ew35r.js.map +10 -0
  50. package/dist/index-0dvs3a06.js +6 -0
  51. package/dist/{index-jc4kmfwa.js.map → index-0dvs3a06.js.map} +1 -1
  52. package/dist/{index-pszmnhgq.js → index-1cagdzqe.js} +9 -9
  53. package/dist/{index-pszmnhgq.js.map → index-1cagdzqe.js.map} +1 -1
  54. package/dist/index-2fw9e5gg.js +6 -0
  55. package/dist/{index-0444sh6x.js.map → index-2fw9e5gg.js.map} +1 -1
  56. package/dist/{index-hgm2gchq.js → index-2td5h856.js} +12 -12
  57. package/dist/{index-hgm2gchq.js.map → index-2td5h856.js.map} +1 -1
  58. package/dist/{index-m6fqx0ch.js → index-446exxcb.js} +7 -7
  59. package/dist/{index-m6fqx0ch.js.map → index-446exxcb.js.map} +1 -1
  60. package/dist/{index-snz49ndn.js → index-4fajxhdv.js} +4 -4
  61. package/dist/{index-snz49ndn.js.map → index-4fajxhdv.js.map} +1 -1
  62. package/dist/index-4j65jp20.js +9 -0
  63. package/dist/{index-38gs9anh.js.map → index-4j65jp20.js.map} +1 -1
  64. package/dist/index-5gn74n56.js +10 -0
  65. package/dist/{index-22fzzn7z.js.map → index-5gn74n56.js.map} +2 -2
  66. package/dist/index-5zpfz4kb.js +9 -0
  67. package/dist/{index-eztfverw.js.map → index-5zpfz4kb.js.map} +1 -1
  68. package/dist/index-60h4knj6.js +126 -0
  69. package/dist/{index-ry6a4bqh.js.map → index-60h4knj6.js.map} +2 -2
  70. package/dist/index-635wcsh1.js +5 -0
  71. package/dist/{index-2bsardvh.js.map → index-635wcsh1.js.map} +1 -1
  72. package/dist/{index-k8e9f466.js → index-67sfck4d.js} +19 -19
  73. package/dist/index-67sfck4d.js.map +13 -0
  74. package/dist/index-7p8d1gf0.js +63 -0
  75. package/dist/{index-ytxbw8py.js.map → index-7p8d1gf0.js.map} +1 -1
  76. package/dist/index-7zgjkbb0.js +5 -0
  77. package/dist/{index-qgsdgbk8.js.map → index-7zgjkbb0.js.map} +1 -1
  78. package/dist/{index-zw6wyas6.js → index-86rb86nr.js} +4 -4
  79. package/dist/{index-zw6wyas6.js.map → index-86rb86nr.js.map} +1 -1
  80. package/dist/{index-fbsrhcga.js → index-8jejze0z.js} +4 -4
  81. package/dist/{index-fbsrhcga.js.map → index-8jejze0z.js.map} +1 -1
  82. package/dist/index-8k8y7edx.js +7 -0
  83. package/dist/{index-3826kf9t.js.map → index-8k8y7edx.js.map} +1 -1
  84. package/dist/index-8mkatm20.js +6 -0
  85. package/dist/{index-42e29zs4.js.map → index-8mkatm20.js.map} +1 -1
  86. package/dist/{index-3vzf253k.js → index-9k6qa50r.js} +7 -7
  87. package/dist/{index-3vzf253k.js.map → index-9k6qa50r.js.map} +1 -1
  88. package/dist/{index-yw3fby4n.js → index-a1axc952.js} +4 -4
  89. package/dist/{index-yw3fby4n.js.map → index-a1axc952.js.map} +1 -1
  90. package/dist/index-ayhdn87b.js +6 -0
  91. package/dist/{index-dzy19wtf.js.map → index-ayhdn87b.js.map} +1 -1
  92. package/dist/index-b8bfzbfe.js +6 -0
  93. package/dist/{index-836hc2h1.js.map → index-b8bfzbfe.js.map} +2 -2
  94. package/dist/index-brh25jhq.js +6 -0
  95. package/dist/{index-hrwakb11.js.map → index-brh25jhq.js.map} +2 -2
  96. package/dist/index-c6qrcweh.js +6 -0
  97. package/dist/{index-nxhqf597.js.map → index-c6qrcweh.js.map} +1 -1
  98. package/dist/index-cb45233h.js +6 -0
  99. package/dist/{index-nvc24414.js.map → index-cb45233h.js.map} +1 -1
  100. package/dist/{index-51x0n5z0.js → index-dcy14zdn.js} +5 -5
  101. package/dist/{index-51x0n5z0.js.map → index-dcy14zdn.js.map} +1 -1
  102. package/dist/index-f6r3h2yh.js +8 -0
  103. package/dist/{index-9t4dz145.js.map → index-f6r3h2yh.js.map} +1 -1
  104. package/dist/index-gezqawvw.js +11 -0
  105. package/dist/{index-sh44ymqz.js.map → index-gezqawvw.js.map} +1 -1
  106. package/dist/{index-1mbdz3f7.js → index-h787rq0h.js} +10 -10
  107. package/dist/{index-1mbdz3f7.js.map → index-h787rq0h.js.map} +1 -1
  108. package/dist/index-hd5nkwd7.js +74 -0
  109. package/dist/{index-djeqvfms.js.map → index-hd5nkwd7.js.map} +5 -5
  110. package/dist/index-k6wq0j4q.js +6 -0
  111. package/dist/{index-mjfv7k5w.js.map → index-k6wq0j4q.js.map} +1 -1
  112. package/dist/index-kz01jz58.js +6 -0
  113. package/dist/{index-323jvr1g.js.map → index-kz01jz58.js.map} +1 -1
  114. package/dist/{index-dv9pdjy4.js → index-mgef1n4e.js} +10 -10
  115. package/dist/{index-dv9pdjy4.js.map → index-mgef1n4e.js.map} +1 -1
  116. package/dist/{index-fxpmx6cr.js → index-n197qdw1.js} +191 -191
  117. package/dist/{index-fxpmx6cr.js.map → index-n197qdw1.js.map} +3 -3
  118. package/dist/index-nndwx2wp.js +153 -0
  119. package/dist/{index-dpcm1j62.js.map → index-nndwx2wp.js.map} +2 -2
  120. package/dist/index-pz92ksp8.js +5 -0
  121. package/dist/{index-3c5jt6by.js.map → index-pz92ksp8.js.map} +1 -1
  122. package/dist/index-qj4adnfe.js +14 -0
  123. package/dist/{index-y7dxq4a4.js.map → index-qj4adnfe.js.map} +2 -2
  124. package/dist/index-r83jpct7.js +6 -0
  125. package/dist/{index-xg7s813b.js.map → index-r83jpct7.js.map} +2 -2
  126. package/dist/{index-2zjh5zd5.js → index-rqfwd7j5.js} +4 -4
  127. package/dist/{index-2zjh5zd5.js.map → index-rqfwd7j5.js.map} +1 -1
  128. package/dist/index-s0f0s6n5.js +6 -0
  129. package/dist/{index-pqw1n1pv.js.map → index-s0f0s6n5.js.map} +1 -1
  130. package/dist/index-s0t15ndj.js +6 -0
  131. package/dist/{index-8edck2pr.js.map → index-s0t15ndj.js.map} +1 -1
  132. package/dist/index-tc054tcb.js +6 -0
  133. package/dist/{index-8tmv33mr.js.map → index-tc054tcb.js.map} +1 -1
  134. package/dist/{index-095hrkyr.js → index-ts8a1sdn.js} +6 -6
  135. package/dist/{index-095hrkyr.js.map → index-ts8a1sdn.js.map} +1 -1
  136. package/dist/index-tv52jhac.js +1252 -0
  137. package/dist/{index-hpvfqq6r.js.map → index-tv52jhac.js.map} +3 -3
  138. package/dist/index-x9nn57kk.js +6 -0
  139. package/dist/{index-1x8mzvz7.js.map → index-x9nn57kk.js.map} +1 -1
  140. package/dist/{index-308y9xt0.js → index-xyh98x7p.js} +4 -4
  141. package/dist/{index-308y9xt0.js.map → index-xyh98x7p.js.map} +1 -1
  142. package/dist/{index-jff5q27j.js → index-yy4v9kca.js} +4 -4
  143. package/dist/{index-jff5q27j.js.map → index-yy4v9kca.js.map} +1 -1
  144. package/dist/{index-bqdkm3de.js → index-yz0fcxky.js} +4 -4
  145. package/dist/{index-bqdkm3de.js.map → index-yz0fcxky.js.map} +1 -1
  146. package/dist/{index-p6ya59m6.js → index-z4adxmzm.js} +5 -5
  147. package/dist/{index-p6ya59m6.js.map → index-z4adxmzm.js.map} +1 -1
  148. package/dist/{index-4fj1k64j.js → index-zzpgsbn3.js} +4 -4
  149. package/dist/{index-4fj1k64j.js.map → index-zzpgsbn3.js.map} +1 -1
  150. package/dist/index.js +345 -345
  151. package/dist/index.js.map +4 -4
  152. package/dist/web-7mdrcb8a.js +14 -0
  153. package/dist/{web-gfv0mzgs.js.map → web-7mdrcb8a.js.map} +1 -1
  154. package/dist/wrapper-4hdmdwft.js +5 -0
  155. package/dist/{wrapper-f662ny3r.js.map → wrapper-4hdmdwft.js.map} +1 -1
  156. package/package.json +1 -1
  157. package/dist/APEv2Parser-ysjr6adv.js +0 -5
  158. package/dist/App-2f72vhjv.js +0 -11
  159. package/dist/AsfParser-7emspn04.js +0 -5
  160. package/dist/ConfigEditor-vk7vxaa6.js +0 -6
  161. package/dist/DsdiffParser-dz88pnnr.js +0 -5
  162. package/dist/FlacParser-drm5wq0p.js +0 -5
  163. package/dist/MP4Parser-yr7p3z12.js +0 -5
  164. package/dist/MusepackParser-6e8kbh2d.js +0 -5
  165. package/dist/OggParser-ggcypmag.js +0 -5
  166. package/dist/Picker-j7txnm7w.js +0 -5
  167. package/dist/SessionPicker-hpv2ncsb.js +0 -5
  168. package/dist/SkillBrowser-qc542n71.js +0 -5
  169. package/dist/WavPackParser-jw9stzqp.js +0 -5
  170. package/dist/WaveParser-epmncs9w.js +0 -5
  171. package/dist/WizardApp-pgzcz9zq.js +0 -5
  172. package/dist/channels-m8nambmm.js +0 -31
  173. package/dist/config-hmgrqgf2.js +0 -24
  174. package/dist/credential-nkb2ya59.js +0 -19
  175. package/dist/index-0444sh6x.js +0 -6
  176. package/dist/index-1x8mzvz7.js +0 -6
  177. package/dist/index-22fzzn7z.js +0 -10
  178. package/dist/index-2bsardvh.js +0 -5
  179. package/dist/index-323jvr1g.js +0 -6
  180. package/dist/index-3826kf9t.js +0 -7
  181. package/dist/index-38gs9anh.js +0 -9
  182. package/dist/index-3c5jt6by.js +0 -5
  183. package/dist/index-42e29zs4.js +0 -6
  184. package/dist/index-836hc2h1.js +0 -6
  185. package/dist/index-8edck2pr.js +0 -6
  186. package/dist/index-8tmv33mr.js +0 -6
  187. package/dist/index-9t4dz145.js +0 -8
  188. package/dist/index-djeqvfms.js +0 -74
  189. package/dist/index-dpcm1j62.js +0 -153
  190. package/dist/index-dzy19wtf.js +0 -6
  191. package/dist/index-eztfverw.js +0 -9
  192. package/dist/index-hpvfqq6r.js +0 -1252
  193. package/dist/index-hrwakb11.js +0 -6
  194. package/dist/index-jc4kmfwa.js +0 -6
  195. package/dist/index-k8e9f466.js.map +0 -13
  196. package/dist/index-mjfv7k5w.js +0 -6
  197. package/dist/index-nvc24414.js +0 -6
  198. package/dist/index-nxhqf597.js +0 -6
  199. package/dist/index-pqw1n1pv.js +0 -6
  200. package/dist/index-qgsdgbk8.js +0 -5
  201. package/dist/index-qv6ktepc.js +0 -6
  202. package/dist/index-qv6ktepc.js.map +0 -10
  203. package/dist/index-ry6a4bqh.js +0 -126
  204. package/dist/index-sh44ymqz.js +0 -11
  205. package/dist/index-xg7s813b.js +0 -6
  206. package/dist/index-y7dxq4a4.js +0 -14
  207. package/dist/index-ytxbw8py.js +0 -63
  208. package/dist/web-gfv0mzgs.js +0 -14
  209. package/dist/wrapper-f662ny3r.js +0 -5
@@ -1,12 +1,12 @@
1
1
  #!/usr/bin/env node
2
- import{ea}from"./index-4fj1k64j.js";import{ia}from"./index-dzy19wtf.js";import{Ea,mi}from"./index-8tmv33mr.js";var he={value:"",cursor:0,history:[],historyOffset:0,draft:"",past:[],future:[],search:void 0,anchor:void 0};function c(r){return[...r]}function u(r,e){return Math.max(0,Math.min(r,e))}function h(r){return{value:r.value,cursor:r.cursor}}function d(r,e){let n=r.past.at(-1);if(e.coalesce&&n!==void 0&&r.future.length===0)return{...r,future:[]};if(n!==void 0&&n.value===r.value)return{...r,future:[]};return{...r,past:[...r.past,h(r)].slice(-mi),future:[]}}function a(r,e){return{...r,value:e,cursor:c(e).length}}function k(r,e){let n=d(r,{coalesce:!e.includes(`
2
+ import{ta}from"./index-zzpgsbn3.js";import{sa}from"./index-ayhdn87b.js";import{pa,Si}from"./index-tc054tcb.js";var ye={value:"",cursor:0,history:[],historyOffset:0,draft:"",past:[],future:[],search:void 0,anchor:void 0};function c(r){return[...r]}function u(r,e){return Math.max(0,Math.min(r,e))}function h(r){return{value:r.value,cursor:r.cursor}}function d(r,e){let n=r.past.at(-1);if(e.coalesce&&n!==void 0&&r.future.length===0)return{...r,future:[]};if(n!==void 0&&n.value===r.value)return{...r,future:[]};return{...r,past:[...r.past,h(r)].slice(-Si),future:[]}}function a(r,e){return{...r,value:e,cursor:c(e).length}}function k(r,e){let n=d(r,{coalesce:!e.includes(`
3
3
  `)}),o=c(n.value),t=u(n.cursor,o.length),i=[...o.slice(0,t),...c(e),...o.slice(t)];return{...n,value:i.join(""),cursor:t+c(e).length}}function E(r){let e=c(r.value),n=u(r.cursor,e.length);if(n===0)return r;let o=d(r,{coalesce:!1}),t=[...e.slice(0,n-1),...e.slice(n)];return{...o,value:t.join(""),cursor:n-1}}function y(r){let e=c(r.value),n=u(r.cursor,e.length);if(n>=e.length)return r;return{...d(r,{coalesce:!1}),value:[...e.slice(0,n),...e.slice(n+1)].join("")}}function f(r){return r===void 0||/\s/.test(r)}function v(r,e){let n=e;while(n>0&&f(r[n-1]))n-=1;while(n>0&&!f(r[n-1]))n-=1;return n}function b(r,e){let n=e;while(n<r.length&&f(r[n]))n+=1;while(n<r.length&&!f(r[n]))n+=1;return n}function x(r){let e=c(r.value),n=v(e,u(r.cursor,e.length));if(n===r.cursor)return r;return{...d(r,{coalesce:!1}),value:[...e.slice(0,n),...e.slice(r.cursor)].join(""),cursor:n}}function A(r){let e=c(r.value),n=u(r.cursor,e.length),o=b(e,n);if(o===n)return r;return{...d(r,{coalesce:!1}),value:[...e.slice(0,n),...e.slice(o)].join("")}}function l(r,e){let n=c(r),o=u(e,n.length),t=o;while(t>0&&n[t-1]!==`
4
4
  `)t-=1;let i=o;while(i<n.length&&n[i]!==`
5
- `)i+=1;return{start:t,end:i}}function zo(r){let e=c(r.value),n=u(r.cursor,e.length),o=e.slice(0,n),{start:t}=l(r.value,n);return{line:o.filter((i)=>i===`
5
+ `)i+=1;return{start:t,end:i}}function Zo(r){let e=c(r.value),n=u(r.cursor,e.length),o=e.slice(0,n),{start:t}=l(r.value,n);return{line:o.filter((i)=>i===`
6
6
  `).length,lines:e.filter((i)=>i===`
7
- `).length+1,column:n-t}}function p(r,e){let n=c(r.value),o=u(r.cursor,n.length),t=l(r.value,o),i=o-t.start;if(e<0){if(t.start===0)return r;let m=l(r.value,t.start-1);return{...r,cursor:Math.min(m.start+i,m.end)}}if(t.end>=n.length)return r;let s=l(r.value,t.end+1);return{...r,cursor:Math.min(s.start+i,s.end)}}function L(r){if(r.history.length===0)return r;let e=Math.min(r.historyOffset+1,r.history.length),n=r.history[r.history.length-e];if(n===void 0)return r;return a({...d(r,{coalesce:!1}),historyOffset:e,draft:r.historyOffset===0?r.value:r.draft},n)}function I(r){if(r.historyOffset===0)return r;let e=r.historyOffset-1,n=d(r,{coalesce:!1});if(e===0)return a({...n,historyOffset:0},r.draft);let o=r.history[r.history.length-e];return o===void 0?r:a({...n,historyOffset:e},o)}function en(r){let e=(r.search?.query??"").toLowerCase(),n=new Set,o=[];for(let t=r.history.length-1;t>=0;t-=1){let i=r.history[t];if(i===void 0||n.has(i))continue;if(e===""||i.toLowerCase().includes(e))n.add(i),o.push(i)}return o}function C(r){let e=en(r);return e[u(r.search?.index??0,Math.max(0,e.length-1))]}function g(r,e){let n=r.search;if(n===void 0)return r;let o=en(r);if(o.length===0)return r;return{...r,search:{...n,index:u(n.index+e,o.length-1)}}}function T(r,e){let n=r.search;if(n===void 0)return r;return{...r,search:{query:n.query+e,index:0}}}function M(r){let e=r.search;if(e===void 0)return r;let n=c(e.query).slice(0,-1).join("");return{...r,search:{query:n,index:0}}}function O(r){let e=C(r);if(e===void 0)return{...r,search:void 0};return a({...d(r,{coalesce:!1}),search:void 0},e)}function K(r){let e=r.past.at(-1);if(e===void 0)return r;return{...r,value:e.value,cursor:u(e.cursor,c(e.value).length),past:r.past.slice(0,-1),future:[h(r),...r.future],historyOffset:0}}function j(r){let e=r.future[0];if(e===void 0)return r;return{...r,value:e.value,cursor:u(e.cursor,c(e.value).length),past:[...r.past,h(r)].slice(-mi),future:r.future.slice(1)}}function wA(r){if(r.anchor===void 0||r.anchor===r.cursor)return;return r.anchor<r.cursor?{start:r.anchor,end:r.cursor}:{start:r.cursor,end:r.anchor}}function w(r){let e=wA(r);if(e===void 0)return{...r,anchor:void 0};let n=c(r.value);return{...d(r,{coalesce:!1}),value:[...n.slice(0,e.start),...n.slice(e.end)].join(""),cursor:e.start,anchor:void 0}}function R(r){return r.kind==="insert"||r.kind==="newline"||r.kind==="backspace"||r.kind==="delete"}function Ge(r,e){if(r.search===void 0&&R(e)&&wA(r)!==void 0){let o=w(r);if(e.kind==="backspace"||e.kind==="delete")return o;return Ge(o,e)}if(e.kind==="extend"){let o=r.anchor??r.cursor;return{...Ge({...r,anchor:void 0},{kind:e.to}),anchor:o}}if(e.kind==="cutSelection")return w(r);if(e.kind==="copySelection")return r;if(e.kind==="selectAll")return{...r,anchor:0,cursor:c(r.value).length};let n=W(r,e);return n.anchor===void 0?n:{...n,anchor:void 0}}function W(r,e){if(r.search!==void 0)switch(e.kind){case"insert":return T(r,e.text);case"backspace":return M(r);case"historyPrev":case"lineUp":return g(r,1);case"historyNext":case"lineDown":return g(r,-1);case"searchAccept":return O(r);case"searchCancel":return{...r,search:void 0};case"searchOpen":return r;default:return{...r,search:void 0}}switch(e.kind){case"insert":return k(r,e.text);case"newline":return k(r,`
8
- `);case"backspace":return E(r);case"delete":return y(r);case"cursorLeft":return{...r,cursor:u(r.cursor-1,c(r.value).length)};case"cursorRight":return{...r,cursor:u(r.cursor+1,c(r.value).length)};case"cursorHome":return{...r,cursor:l(r.value,r.cursor).start};case"cursorEnd":return{...r,cursor:l(r.value,r.cursor).end};case"bufferStart":return{...r,cursor:0};case"bufferEnd":return{...r,cursor:c(r.value).length};case"wordLeft":return{...r,cursor:v(c(r.value),r.cursor)};case"wordRight":return{...r,cursor:b(c(r.value),r.cursor)};case"lineUp":return p(r,-1);case"lineDown":return p(r,1);case"killToStart":{let{start:n}=l(r.value,r.cursor);if(n===r.cursor)return r;let o=c(r.value);return{...d(r,{coalesce:!1}),value:[...o.slice(0,n),...o.slice(r.cursor)].join(""),cursor:n}}case"killToEnd":{let{end:n}=l(r.value,r.cursor);if(n===r.cursor)return r;let o=c(r.value);return{...d(r,{coalesce:!1}),value:[...o.slice(0,r.cursor),...o.slice(n)].join("")}}case"killWord":return x(r);case"killWordForward":return A(r);case"historyPrev":return L(r);case"historyNext":return I(r);case"undo":return K(r);case"redo":return j(r);case"searchOpen":return{...r,search:{query:"",index:0}};case"searchAccept":case"searchCancel":case"submit":case"cancel":case"exit":case"arm":case"scroll":case"pointer":case"reasoning":case"paste":case"none":return r;case"extend":case"selectAll":case"copySelection":case"cutSelection":return r}}function xi(r){let e=r.value.trim();if(e==="")return{text:"",state:{...he,history:r.history}};let o=r.history.at(-1)===e?r.history:[...r.history,e].slice(-Ea);return{text:e,state:{...he,history:o}}}function Gn(r,e,n={}){let{line:o,lines:t}=zo(r);return{busy:e,empty:r.value==="",firstLine:o===0,lastLine:o===t-1,searching:r.search!==void 0,armed:n.armed??!1,scrolled:n.scrolled??!1}}function D(r,e){switch(r){case"c":if(e.searching)return{kind:"searchCancel"};if(e.busy)return{kind:"cancel"};return e.armed?{kind:"exit"}:{kind:"arm"};case"d":return e.empty?{kind:"exit"}:{kind:"delete"};case"a":return{kind:"cursorHome"};case"e":return{kind:"cursorEnd"};case"b":return{kind:"cursorLeft"};case"f":return{kind:"cursorRight"};case"u":return{kind:"killToStart"};case"k":return{kind:"killToEnd"};case"w":return{kind:"killWord"};case"p":return{kind:"historyPrev"};case"n":return{kind:"historyNext"};case"r":return{kind:"searchOpen"};case"o":return{kind:"reasoning"};case"z":return{kind:"undo"};case"y":return{kind:"redo"};default:return{kind:"none"}}}function tn(r,e,n){let o=ia(r);if(o!==void 0){if(o.rows!==0)return{kind:"scroll",move:o.rows<0?"up":"down",times:Math.abs(o.rows)};if(o.at!==void 0&&o.kind!==void 0&&o.kind!=="wheel")return{kind:"pointer",gesture:o.kind,column:o.at.column,row:o.at.row,shift:o.shift===!0};return{kind:"none"}}if(e.eventType==="release")return{kind:"none"};if(e.shift){let i=H(e);if(i!==void 0)return{kind:"extend",to:i}}if(e.super){if(e.leftArrow)return{kind:"cursorHome"};if(e.rightArrow)return{kind:"cursorEnd"};if(e.upArrow)return{kind:"bufferStart"};if(e.downArrow)return{kind:"bufferEnd"};if(e.backspace)return{kind:"killToStart"};if(e.delete)return{kind:"killToEnd"};if(r==="z")return e.shift?{kind:"redo"}:{kind:"undo"};if(r==="a")return{kind:"selectAll"};if(r==="c")return{kind:"copySelection"};if(r==="x")return{kind:"cutSelection"};return{kind:"none"}}if(ea(r))return{kind:"none"};if(e.ctrl&&e.leftArrow)return{kind:"wordLeft"};if(e.ctrl&&e.rightArrow)return{kind:"wordRight"};if(e.ctrl&&e.backspace)return{kind:"killWord"};if(e.ctrl)return D(r.toLowerCase(),n);if(e.meta){if(e.return)return{kind:"newline"};if(e.pageUp)return{kind:"scroll",move:"top"};if(e.pageDown)return{kind:"scroll",move:"bottom"};if(e.upArrow)return{kind:"scroll",move:"up"};if(e.downArrow)return{kind:"scroll",move:"down"};if(e.leftArrow||r==="b")return{kind:"wordLeft"};if(e.rightArrow||r==="f")return{kind:"wordRight"};if(e.backspace)return{kind:"killWord"};if(r==="d")return{kind:"killWordForward"};if(r==="r")return{kind:"reasoning"};return{kind:"none"}}if(e.return&&e.shift)return{kind:"newline"};if(e.pageUp)return{kind:"scroll",move:"pageUp"};if(e.pageDown)return{kind:"scroll",move:"pageDown"};if(e.home)return{kind:"cursorHome"};if(e.end)return{kind:"cursorEnd"};if(e.return)return n.searching?{kind:"searchAccept"}:{kind:"submit"};if(e.backspace)return{kind:"backspace"};if(e.delete)return{kind:"delete"};if(e.leftArrow)return{kind:"cursorLeft"};if(e.rightArrow)return{kind:"cursorRight"};if(e.upArrow)return n.searching||n.firstLine?{kind:"historyPrev"}:{kind:"lineUp"};if(e.downArrow)return n.searching||n.lastLine?{kind:"historyNext"}:{kind:"lineDown"};if(e.escape){if(n.searching)return{kind:"searchCancel"};return n.scrolled?{kind:"scroll",move:"bottom"}:{kind:"none"}}if(e.tab)return{kind:"none"};if(r==="")return{kind:"none"};if(r==="\x1B[H"||r==="\x1B[1~")return{kind:"cursorHome"};if(r==="\x1B[F"||r==="\x1B[4~")return{kind:"cursorEnd"};if(/[\r\n]/.test(r)){let i=r.split(/\r\n|[\r\n]/).map(S),s=i.at(-1)===""&&i.length>1;return{kind:"paste",lines:s?i.slice(0,-1):i,complete:s}}let t=S(r);return t===""?{kind:"none"}:{kind:"insert",text:t}}function H(r){if(r.super){if(r.leftArrow)return"cursorHome";if(r.rightArrow)return"cursorEnd";if(r.upArrow)return"bufferStart";if(r.downArrow)return"bufferEnd";return}if(r.meta||r.ctrl){if(r.leftArrow)return"wordLeft";if(r.rightArrow)return"wordRight";return}if(r.home)return"cursorHome";if(r.end)return"cursorEnd";if(r.leftArrow)return"cursorLeft";if(r.rightArrow)return"cursorRight";if(r.upArrow)return"lineUp";if(r.downArrow)return"lineDown";return}function S(r){return[...r].filter((e)=>{let n=e.codePointAt(0)??0;return n>=32&&n!==127}).join("")}function An(r,e){if(e.ctrl)return r.toLowerCase()==="c"||r.toLowerCase()==="d"?{kind:"cancel"}:{kind:"none"};if(e.return)return{kind:"confirm"};if(e.escape)return{kind:"cancel"};if(r===" ")return{kind:"toggle"};if(r==="a")return{kind:"all"};if(r==="n")return{kind:"none-selected"};let n=mt(r,e);return n.kind==="move"?n:{kind:"none"}}function mt(r,e){if(e.ctrl)return r.toLowerCase()==="c"||r.toLowerCase()==="d"?{kind:"exit"}:{kind:"none"};if(e.return)return{kind:"choose"};if(e.escape)return{kind:"back"};if(e.upArrow)return{kind:"move",move:{kind:"up"}};if(e.downArrow)return{kind:"move",move:{kind:"down"}};switch(r){case"k":return{kind:"move",move:{kind:"up"}};case"j":return{kind:"move",move:{kind:"down"}};case"g":return{kind:"move",move:{kind:"first"}};case"G":return{kind:"move",move:{kind:"last"}};default:break}if(/^[1-9]$/.test(r))return{kind:"move",move:{kind:"jump",index:Number(r)-1}};return{kind:"none"}}function Fn(r,e,n){if(e.ctrl&&r.toLowerCase()==="c")return{kind:"abort"};if(e.escape)return{kind:"back"};if(e.return)return{kind:"commit"};if(n.select)return{kind:"list",intent:mt(r,e)};let o=tn(r,e,{busy:!1,empty:n.empty,firstLine:!0,lastLine:!0,searching:!1,armed:!1,scrolled:!1});switch(o.kind){case"submit":return{kind:"commit"};case"exit":return{kind:"abort"};case"arm":case"scroll":return{kind:"edit",intent:{kind:"none"}};case"historyPrev":case"historyNext":return{kind:"edit",intent:{kind:"none"}};case"paste":return{kind:"edit",intent:{kind:"insert",text:o.lines[0]??""}};default:return{kind:"edit",intent:o}}}
9
- export{he,zo,en,wA,Ge,xi,Gn,tn,An,mt,Fn};
7
+ `).length+1,column:n-t}}function p(r,e){let n=c(r.value),o=u(r.cursor,n.length),t=l(r.value,o),i=o-t.start;if(e<0){if(t.start===0)return r;let m=l(r.value,t.start-1);return{...r,cursor:Math.min(m.start+i,m.end)}}if(t.end>=n.length)return r;let s=l(r.value,t.end+1);return{...r,cursor:Math.min(s.start+i,s.end)}}function L(r){if(r.history.length===0)return r;let e=Math.min(r.historyOffset+1,r.history.length),n=r.history[r.history.length-e];if(n===void 0)return r;return a({...d(r,{coalesce:!1}),historyOffset:e,draft:r.historyOffset===0?r.value:r.draft},n)}function I(r){if(r.historyOffset===0)return r;let e=r.historyOffset-1,n=d(r,{coalesce:!1});if(e===0)return a({...n,historyOffset:0},r.draft);let o=r.history[r.history.length-e];return o===void 0?r:a({...n,historyOffset:e},o)}function tn(r){let e=(r.search?.query??"").toLowerCase(),n=new Set,o=[];for(let t=r.history.length-1;t>=0;t-=1){let i=r.history[t];if(i===void 0||n.has(i))continue;if(e===""||i.toLowerCase().includes(e))n.add(i),o.push(i)}return o}function C(r){let e=tn(r);return e[u(r.search?.index??0,Math.max(0,e.length-1))]}function g(r,e){let n=r.search;if(n===void 0)return r;let o=tn(r);if(o.length===0)return r;return{...r,search:{...n,index:u(n.index+e,o.length-1)}}}function T(r,e){let n=r.search;if(n===void 0)return r;return{...r,search:{query:n.query+e,index:0}}}function M(r){let e=r.search;if(e===void 0)return r;let n=c(e.query).slice(0,-1).join("");return{...r,search:{query:n,index:0}}}function O(r){let e=C(r);if(e===void 0)return{...r,search:void 0};return a({...d(r,{coalesce:!1}),search:void 0},e)}function K(r){let e=r.past.at(-1);if(e===void 0)return r;return{...r,value:e.value,cursor:u(e.cursor,c(e.value).length),past:r.past.slice(0,-1),future:[h(r),...r.future],historyOffset:0}}function j(r){let e=r.future[0];if(e===void 0)return r;return{...r,value:e.value,cursor:u(e.cursor,c(e.value).length),past:[...r.past,h(r)].slice(-Si),future:r.future.slice(1)}}function DA(r){if(r.anchor===void 0||r.anchor===r.cursor)return;return r.anchor<r.cursor?{start:r.anchor,end:r.cursor}:{start:r.cursor,end:r.anchor}}function w(r){let e=DA(r);if(e===void 0)return{...r,anchor:void 0};let n=c(r.value);return{...d(r,{coalesce:!1}),value:[...n.slice(0,e.start),...n.slice(e.end)].join(""),cursor:e.start,anchor:void 0}}function R(r){return r.kind==="insert"||r.kind==="newline"||r.kind==="backspace"||r.kind==="delete"}function xe(r,e){if(r.search===void 0&&R(e)&&DA(r)!==void 0){let o=w(r);if(e.kind==="backspace"||e.kind==="delete")return o;return xe(o,e)}if(e.kind==="extend"){let o=r.anchor??r.cursor;return{...xe({...r,anchor:void 0},{kind:e.to}),anchor:o}}if(e.kind==="cutSelection")return w(r);if(e.kind==="copySelection")return r;if(e.kind==="selectAll")return{...r,anchor:0,cursor:c(r.value).length};let n=W(r,e);return n.anchor===void 0?n:{...n,anchor:void 0}}function W(r,e){if(r.search!==void 0)switch(e.kind){case"insert":return T(r,e.text);case"backspace":return M(r);case"historyPrev":case"lineUp":return g(r,1);case"historyNext":case"lineDown":return g(r,-1);case"searchAccept":return O(r);case"searchCancel":return{...r,search:void 0};case"searchOpen":return r;default:return{...r,search:void 0}}switch(e.kind){case"insert":return k(r,e.text);case"newline":return k(r,`
8
+ `);case"backspace":return E(r);case"delete":return y(r);case"cursorLeft":return{...r,cursor:u(r.cursor-1,c(r.value).length)};case"cursorRight":return{...r,cursor:u(r.cursor+1,c(r.value).length)};case"cursorHome":return{...r,cursor:l(r.value,r.cursor).start};case"cursorEnd":return{...r,cursor:l(r.value,r.cursor).end};case"bufferStart":return{...r,cursor:0};case"bufferEnd":return{...r,cursor:c(r.value).length};case"wordLeft":return{...r,cursor:v(c(r.value),r.cursor)};case"wordRight":return{...r,cursor:b(c(r.value),r.cursor)};case"lineUp":return p(r,-1);case"lineDown":return p(r,1);case"killToStart":{let{start:n}=l(r.value,r.cursor);if(n===r.cursor)return r;let o=c(r.value);return{...d(r,{coalesce:!1}),value:[...o.slice(0,n),...o.slice(r.cursor)].join(""),cursor:n}}case"killToEnd":{let{end:n}=l(r.value,r.cursor);if(n===r.cursor)return r;let o=c(r.value);return{...d(r,{coalesce:!1}),value:[...o.slice(0,r.cursor),...o.slice(n)].join("")}}case"killWord":return x(r);case"killWordForward":return A(r);case"historyPrev":return L(r);case"historyNext":return I(r);case"undo":return K(r);case"redo":return j(r);case"searchOpen":return{...r,search:{query:"",index:0}};case"searchAccept":case"searchCancel":case"submit":case"cancel":case"exit":case"arm":case"scroll":case"pointer":case"reasoning":case"paste":case"none":return r;case"extend":case"selectAll":case"copySelection":case"cutSelection":return r}}function Hi(r){let e=r.value.trim();if(e==="")return{text:"",state:{...ye,history:r.history}};let o=r.history.at(-1)===e?r.history:[...r.history,e].slice(-pa);return{text:e,state:{...ye,history:o}}}function Fn(r,e,n={}){let{line:o,lines:t}=Zo(r);return{busy:e,empty:r.value==="",firstLine:o===0,lastLine:o===t-1,searching:r.search!==void 0,armed:n.armed??!1,scrolled:n.scrolled??!1}}function D(r,e){switch(r){case"c":if(e.searching)return{kind:"searchCancel"};if(e.busy)return{kind:"cancel"};return e.armed?{kind:"exit"}:{kind:"arm"};case"d":return e.empty?{kind:"exit"}:{kind:"delete"};case"a":return{kind:"cursorHome"};case"e":return{kind:"cursorEnd"};case"b":return{kind:"cursorLeft"};case"f":return{kind:"cursorRight"};case"u":return{kind:"killToStart"};case"k":return{kind:"killToEnd"};case"w":return{kind:"killWord"};case"p":return{kind:"historyPrev"};case"n":return{kind:"historyNext"};case"r":return{kind:"searchOpen"};case"o":return{kind:"reasoning"};case"z":return{kind:"undo"};case"y":return{kind:"redo"};default:return{kind:"none"}}}function An(r,e,n){let o=sa(r);if(o!==void 0){if(o.rows!==0)return{kind:"scroll",move:o.rows<0?"up":"down",times:Math.abs(o.rows)};if(o.at!==void 0&&o.kind!==void 0&&o.kind!=="wheel")return{kind:"pointer",gesture:o.kind,column:o.at.column,row:o.at.row,shift:o.shift===!0};return{kind:"none"}}if(e.eventType==="release")return{kind:"none"};if(e.shift){let i=H(e);if(i!==void 0)return{kind:"extend",to:i}}if(e.super){if(e.leftArrow)return{kind:"cursorHome"};if(e.rightArrow)return{kind:"cursorEnd"};if(e.upArrow)return{kind:"bufferStart"};if(e.downArrow)return{kind:"bufferEnd"};if(e.backspace)return{kind:"killToStart"};if(e.delete)return{kind:"killToEnd"};if(r==="z")return e.shift?{kind:"redo"}:{kind:"undo"};if(r==="a")return{kind:"selectAll"};if(r==="c")return{kind:"copySelection"};if(r==="x")return{kind:"cutSelection"};return{kind:"none"}}if(ta(r))return{kind:"none"};if(e.ctrl&&e.leftArrow)return{kind:"wordLeft"};if(e.ctrl&&e.rightArrow)return{kind:"wordRight"};if(e.ctrl&&e.backspace)return{kind:"killWord"};if(e.ctrl)return D(r.toLowerCase(),n);if(e.meta){if(e.return)return{kind:"newline"};if(e.pageUp)return{kind:"scroll",move:"top"};if(e.pageDown)return{kind:"scroll",move:"bottom"};if(e.upArrow)return{kind:"scroll",move:"up"};if(e.downArrow)return{kind:"scroll",move:"down"};if(e.leftArrow||r==="b")return{kind:"wordLeft"};if(e.rightArrow||r==="f")return{kind:"wordRight"};if(e.backspace)return{kind:"killWord"};if(r==="d")return{kind:"killWordForward"};if(r==="r")return{kind:"reasoning"};return{kind:"none"}}if(e.return&&e.shift)return{kind:"newline"};if(e.pageUp)return{kind:"scroll",move:"pageUp"};if(e.pageDown)return{kind:"scroll",move:"pageDown"};if(e.home)return{kind:"cursorHome"};if(e.end)return{kind:"cursorEnd"};if(e.return)return n.searching?{kind:"searchAccept"}:{kind:"submit"};if(e.backspace)return{kind:"backspace"};if(e.delete)return{kind:"delete"};if(e.leftArrow)return{kind:"cursorLeft"};if(e.rightArrow)return{kind:"cursorRight"};if(e.upArrow)return n.searching||n.firstLine?{kind:"historyPrev"}:{kind:"lineUp"};if(e.downArrow)return n.searching||n.lastLine?{kind:"historyNext"}:{kind:"lineDown"};if(e.escape){if(n.searching)return{kind:"searchCancel"};return n.scrolled?{kind:"scroll",move:"bottom"}:{kind:"none"}}if(e.tab)return{kind:"none"};if(r==="")return{kind:"none"};if(r==="\x1B[H"||r==="\x1B[1~")return{kind:"cursorHome"};if(r==="\x1B[F"||r==="\x1B[4~")return{kind:"cursorEnd"};if(/[\r\n]/.test(r)){let i=r.split(/\r\n|[\r\n]/).map(S),s=i.at(-1)===""&&i.length>1;return{kind:"paste",lines:s?i.slice(0,-1):i,complete:s}}let t=S(r);return t===""?{kind:"none"}:{kind:"insert",text:t}}function H(r){if(r.super){if(r.leftArrow)return"cursorHome";if(r.rightArrow)return"cursorEnd";if(r.upArrow)return"bufferStart";if(r.downArrow)return"bufferEnd";return}if(r.meta||r.ctrl){if(r.leftArrow)return"wordLeft";if(r.rightArrow)return"wordRight";return}if(r.home)return"cursorHome";if(r.end)return"cursorEnd";if(r.leftArrow)return"cursorLeft";if(r.rightArrow)return"cursorRight";if(r.upArrow)return"lineUp";if(r.downArrow)return"lineDown";return}function S(r){return[...r].filter((e)=>{let n=e.codePointAt(0)??0;return n>=32&&n!==127}).join("")}function nn(r,e){if(e.ctrl)return r.toLowerCase()==="c"||r.toLowerCase()==="d"?{kind:"cancel"}:{kind:"none"};if(e.return)return{kind:"confirm"};if(e.escape)return{kind:"cancel"};if(r===" ")return{kind:"toggle"};if(r==="a")return{kind:"all"};if(r==="n")return{kind:"none-selected"};let n=St(r,e);return n.kind==="move"?n:{kind:"none"}}function St(r,e){if(e.ctrl)return r.toLowerCase()==="c"||r.toLowerCase()==="d"?{kind:"exit"}:{kind:"none"};if(e.return)return{kind:"choose"};if(e.escape)return{kind:"back"};if(e.upArrow)return{kind:"move",move:{kind:"up"}};if(e.downArrow)return{kind:"move",move:{kind:"down"}};switch(r){case"k":return{kind:"move",move:{kind:"up"}};case"j":return{kind:"move",move:{kind:"down"}};case"g":return{kind:"move",move:{kind:"first"}};case"G":return{kind:"move",move:{kind:"last"}};default:break}if(/^[1-9]$/.test(r))return{kind:"move",move:{kind:"jump",index:Number(r)-1}};return{kind:"none"}}function Un(r,e,n){if(e.ctrl&&r.toLowerCase()==="c")return{kind:"abort"};if(e.escape)return{kind:"back"};if(e.return)return{kind:"commit"};if(n.select)return{kind:"list",intent:St(r,e)};let o=An(r,e,{busy:!1,empty:n.empty,firstLine:!0,lastLine:!0,searching:!1,armed:!1,scrolled:!1});switch(o.kind){case"submit":return{kind:"commit"};case"exit":return{kind:"abort"};case"arm":case"scroll":return{kind:"edit",intent:{kind:"none"}};case"historyPrev":case"historyNext":return{kind:"edit",intent:{kind:"none"}};case"paste":return{kind:"edit",intent:{kind:"insert",text:o.lines[0]??""}};default:return{kind:"edit",intent:o}}}
9
+ export{ye,Zo,tn,DA,xe,Hi,Fn,An,nn,St,Un};
10
10
 
11
- //# debugId=1DB124110DBD055F64756E2164756E21
12
- //# sourceMappingURL=index-m6fqx0ch.js.map
11
+ //# debugId=DF643C201E22768D64756E2164756E21
12
+ //# sourceMappingURL=index-446exxcb.js.map
@@ -6,6 +6,6 @@
6
6
  "/**\n * Keystrokes in, intents out. Pure, and free of any Ink import.\n *\n * The one contract worth stating explicitly, because Phase 1 established and measured it:\n * **Ctrl-C cancels the turn, not the process.** Whether a keystroke means \"cancel\" or \"exit\"\n * depends on whether a turn is in flight, so that decision belongs here — in a function that can be\n * tested against both states — rather than in a component where it can only be tested by hand.\n */\n\nimport { lineInfo } from \"#editor\"\nimport { isTerminalReply } from \"#lib/csi\"\nimport { mouseInput } from \"#lib/mouse\"\nimport type { EditorState, Intent, KeyState, MotionKind } from \"#lib/types\"\n\nexport interface KeyContext {\n /** A turn is in flight. */\n readonly busy: boolean\n /** The input buffer is empty. */\n readonly empty: boolean\n /**\n * The cursor is on the first line, so ↑ means history rather than a line up.\n *\n * Position decides, because a multi-line buffer wants both and every editor resolves it this way:\n * at the top of what you are composing there is nothing above to move to, so the arrow is free to\n * mean the other thing. `^P`/`^N` stay unconditional history for anyone who would rather not think\n * about where the cursor is.\n */\n readonly firstLine: boolean\n readonly lastLine: boolean\n /** `^R` is open, so enter accepts a match and escape closes it. */\n readonly searching: boolean\n /**\n * A first ^C has already been pressed at an idle prompt, so the next one leaves.\n *\n * Held by the caller rather than derived, because it is the one piece of keyboard state with a\n * *clock* attached — it expires — and a pure function cannot own that. What it must not do is\n * decide what an armed ^C means, which is why the flag comes in here and the decision stays below.\n */\n readonly armed: boolean\n /**\n * The transcript window is parked above the newest row, so escape means \"come back down\".\n *\n * Escape had nothing to do at an idle prompt and was claimed as `none` to keep control characters\n * out of the buffer. A scrolled-away view is the one state where a reader plainly wants a way out\n * of where they are, and escape is the key they will press.\n */\n readonly scrolled: boolean\n}\n\n/**\n * The context for a given editor state.\n *\n * Exported and derived in one place so no renderer computes it by hand. `empty` was already this shape\n * — editor state passed to the keymap as context — and the two line flags are the same idea; a caller\n * that got `firstLine` wrong would make the arrows misbehave in a way no test of this module would see.\n */\nexport function keyContext(\n editor: EditorState,\n busy: boolean,\n session: { readonly armed?: boolean; readonly scrolled?: boolean } = {},\n): KeyContext {\n const { line, lines } = lineInfo(editor)\n return {\n busy,\n empty: editor.value === \"\",\n firstLine: line === 0,\n lastLine: line === lines - 1,\n searching: editor.search !== undefined,\n armed: session.armed ?? false,\n scrolled: session.scrolled ?? false,\n }\n}\n\n/** Ctrl-key chords arrive as `key.ctrl` plus the letter in `input`. */\nfunction ctrlIntent(letter: string, context: KeyContext): Intent {\n switch (letter) {\n case \"c\":\n // While a search is open, ^C dismisses it rather than the session: the search is the\n // foreground thing, and quitting the whole session from it would lose a message somebody\n // is part-way through composing.\n if (context.searching) return { kind: \"searchCancel\" }\n // The whole point. Busy means a turn is generating; interrupting it must leave the\n // prompt behind, not the shell.\n if (context.busy) return { kind: \"cancel\" }\n // At an idle prompt it takes two, and the first one says so.\n //\n // One press used to exit, which was defensible while the session left its conversation in\n // the scrollback: ^C landed you back in a shell with the transcript still above it. On the\n // alternate screen the buffer is discarded on the way out, so the same keystroke now throws\n // the visible conversation away — and it is one press away from the chord that means\n // \"cancel this turn\", pressed reflexively when a reply runs long. ^D still leaves in one,\n // for anyone who wants that, and the status line names whichever is live.\n return context.armed ? { kind: \"exit\" } : { kind: \"arm\" }\n case \"d\":\n // Ctrl-D is end-of-input, so it only ends the session when there is nothing to submit.\n // On a line with text it is a forward delete, as in a shell.\n return context.empty ? { kind: \"exit\" } : { kind: \"delete\" }\n case \"a\":\n return { kind: \"cursorHome\" }\n case \"e\":\n return { kind: \"cursorEnd\" }\n case \"b\":\n return { kind: \"cursorLeft\" }\n case \"f\":\n return { kind: \"cursorRight\" }\n case \"u\":\n return { kind: \"killToStart\" }\n case \"k\":\n return { kind: \"killToEnd\" }\n case \"w\":\n return { kind: \"killWord\" }\n case \"p\":\n return { kind: \"historyPrev\" }\n case \"n\":\n return { kind: \"historyNext\" }\n case \"r\":\n return { kind: \"searchOpen\" }\n case \"o\":\n // The same thing ⌥r does, on a chord that cannot fail to arrive.\n //\n // ⌥r needs either the kitty protocol or the terminal's option-as-meta setting; a ctrl letter\n // needs neither, because it is a single control byte every terminal has always sent. Reported\n // as \"⌥r doesn't do anything\", and while the immediate cause was a fold with nothing in it,\n // the standing cause is that a view toggle should not depend on a terminal handshake at all.\n // ^O is what the reference CLI binds its own transcript toggle to, so the habit transfers.\n return { kind: \"reasoning\" }\n case \"z\":\n // Undo, not SIGTSTP. Ink puts stdin in raw mode, so the terminal never generates the\n // signal and the byte arrives here — which makes this a choice rather than an accident.\n // Suspending a chat you can leave with ^D is worth little; undo is worth a lot, and the\n // footer says so, which is what keeps the trade visible.\n return { kind: \"undo\" }\n case \"y\":\n return { kind: \"redo\" }\n default:\n return { kind: \"none\" }\n }\n}\n\nexport function keyToIntent(input: string, key: KeyState, context: KeyContext): Intent {\n // The mouse, before anything else, and unconditionally.\n //\n // Ink has no idea what a mouse report is and hands it over as text: with tracking on, one wheel notch\n // reached the insert branch and typed the report into the message. So every report is claimed here —\n // the wheel becomes a scroll and everything else becomes nothing at all, because a click that falls\n // through is the same bug with a different button.\n const mouse = mouseInput(input)\n if (mouse !== undefined) {\n if (mouse.rows !== 0) {\n return {\n kind: \"scroll\",\n move: mouse.rows < 0 ? \"up\" : \"down\",\n times: Math.abs(mouse.rows),\n }\n }\n // A press, drag or release. Reported rather than resolved: which row of the conversation a cell\n // sits on is a question about the frame, and this function has no frame. Still claimed either way —\n // a report that fell through would be typed into the message, which is the bug this branch exists\n // for and does not stop being one because the gesture is now useful.\n if (mouse.at !== undefined && mouse.kind !== undefined && mouse.kind !== \"wheel\") {\n return {\n kind: \"pointer\",\n gesture: mouse.kind,\n column: mouse.at.column,\n row: mouse.at.row,\n shift: mouse.shift === true,\n }\n }\n return { kind: \"none\" }\n }\n\n // A key *release* is not a keystroke. `reportEventTypes` is on so that `super` survives on an arrow\n // key (Ink's kitty branch requires the `:eventType` field), and the cost is that Ink hands the type\n // through without filtering — so every enhanced key arrives twice, down and up, and every chord would\n // fire twice. Repeats are kept: holding a key down is a real thing to do.\n if (key.eventType === \"release\") return { kind: \"none\" }\n\n // ─── shift extends a selection ───────────────────────────────────────────────────────\n //\n // Before the cmd, ctrl and option blocks, because every one of them would otherwise claim the chord\n // and drop the shift: `cmd+shift+←` arrives as `CSI 1;10D` — one plus shift plus super — and the\n // super block below matches on `key.super` without looking at shift at all.\n //\n // Only the motion keys are recognised, which is what keeps this from swallowing ordinary typing:\n // `key.shift` is true for every capital letter, and a letter matches none of the tests in\n // `shiftMotion`. Return is not a motion either, so `⇧⏎` still reaches the newline branch.\n if (key.shift) {\n const to = shiftMotion(key)\n if (to !== undefined) return { kind: \"extend\", to }\n }\n\n // ─── command chords ──────────────────────────────────────────────────────────────────\n //\n // `super` is Cmd, and it is only ever true once the kitty keyboard protocol has been negotiated —\n // no legacy sequence can express it, and Ink's legacy path folds it into `meta`, which is why\n // `cmd+←` used to word-move like `⌥←` instead of jumping to the start of the line.\n //\n // Horizontal is the line, vertical is the whole message: that is what macOS binds and what every\n // editor on the platform does. Before the ctrl and meta blocks because a chord can carry more than\n // one modifier, and cmd is the most specific claim.\n if (key.super) {\n if (key.leftArrow) return { kind: \"cursorHome\" }\n if (key.rightArrow) return { kind: \"cursorEnd\" }\n if (key.upArrow) return { kind: \"bufferStart\" }\n if (key.downArrow) return { kind: \"bufferEnd\" }\n if (key.backspace) return { kind: \"killToStart\" }\n if (key.delete) return { kind: \"killToEnd\" }\n if (input === \"z\") return key.shift ? { kind: \"redo\" } : { kind: \"undo\" }\n if (input === \"a\") return { kind: \"selectAll\" }\n // Reachable only where the protocol delivers `super`, and the terminal may claim them first for\n // its own copy — which is exactly why a *selection* in the composer does not auto-copy: the\n // fallback for a chord that may not arrive is retyping, not a surprise clipboard write.\n if (input === \"c\") return { kind: \"copySelection\" }\n if (input === \"x\") return { kind: \"cutSelection\" }\n // Unclaimed, and deliberately swallowed for the same reason an unclaimed option chord is: the\n // insert branch would type the bare letter, so cmd+s would put an \"s\" in the message.\n return { kind: \"none\" }\n }\n\n // Ctrl with an arrow or a backspace is the other spelling of a word operation — Linux and Windows\n // convention, and the reference honours `ctrl || meta || fn` for exactly one action because a\n // physical chord reaches a terminal in more than one encoding. Before `ctrlIntent`, which dispatches\n // on a *letter* and would see an empty string here.\n // A terminal's answer to a question this process asked is not a keystroke. Claimed next to the mouse\n // for the same reason: Ink hands it over as text, and text reaches the insert branch.\n if (isTerminalReply(input)) return { kind: \"none\" }\n\n if (key.ctrl && key.leftArrow) return { kind: \"wordLeft\" }\n if (key.ctrl && key.rightArrow) return { kind: \"wordRight\" }\n if (key.ctrl && key.backspace) return { kind: \"killWord\" }\n\n if (key.ctrl) return ctrlIntent(input.toLowerCase(), context)\n\n // ─── option chords ───────────────────────────────────────────────────────────────────\n //\n // Every one of these is measured against Ink's parser rather than assumed, because a terminal has\n // more than one way to send them and the parser reporting *a* key says nothing about which:\n //\n // ⌥← Apple Terminal `ESC b` → input \"b\" + meta iTerm2 `CSI 1;3D` → leftArrow + meta\n // ⌥→ Apple Terminal `ESC f` → input \"f\" + meta iTerm2 `CSI 1;3C` → rightArrow + meta\n // ⌥⌫ `ESC DEL` → backspace + meta\n // ⌥d `ESC d` → input \"d\" + meta\n // ⌥r `ESC r` → input \"r\" + meta\n // ⌥⏎ `ESC CR` → return + meta\n // ⇧⏎ kitty protocol `CSI 13;2u` → return + shift (only once the terminal is taught)\n //\n // Both spellings of each are honoured, so the same binding works in both families of terminal.\n //\n // Under the kitty protocol these arrive as `CSI <codepoint>;3u` instead — `⌥r` is `CSI 114;3u`, and\n // Ink reports it as `input \"r\"` with `meta` set, which is the same shape the table above describes.\n // That is why negotiating the protocol needed no change here: these bindings were always right and\n // simply never arrived, because Warp's Option-as-Meta setting is off by default and `⌥r` was\n // reaching us as the composed character `®`.\n if (key.meta) {\n if (key.return) return { kind: \"newline\" }\n // ⌥↑/⌥↓ walk the conversation a row at a time, and ⌥PgUp/⌥PgDn go to its ends. Bare ↑/↓ cannot\n // do this: they already mean line movement inside a message and history at its edges, and a\n // third meaning on one key is how a keyboard stops being predictable.\n if (key.pageUp) return { kind: \"scroll\", move: \"top\" }\n if (key.pageDown) return { kind: \"scroll\", move: \"bottom\" }\n if (key.upArrow) return { kind: \"scroll\", move: \"up\" }\n if (key.downArrow) return { kind: \"scroll\", move: \"down\" }\n if (key.leftArrow || input === \"b\") return { kind: \"wordLeft\" }\n if (key.rightArrow || input === \"f\") return { kind: \"wordRight\" }\n if (key.backspace) return { kind: \"killWord\" }\n if (input === \"d\") return { kind: \"killWordForward\" }\n // Reasoning is folded to a few rows by default, and this is how the rest of it is read. Same\n // shape as ⌥d — a letter with meta — so it works wherever the chords above already do.\n if (input === \"r\") return { kind: \"reasoning\" }\n // An unclaimed option chord does nothing. Falling through would reach the insert branch and\n // type the bare letter, so ⌥s would silently put an \"s\" in the message. Composed characters\n // (é, ∆) are unaffected: macOS sends those as the character itself, with no meta flag.\n return { kind: \"none\" }\n }\n\n // Shift+enter is a newline where the terminal can express it — `terminal-setup` is what teaches\n // iTerm2, VS Code, Ghostty and Kitty to send the sequence Ink already understands. Where it\n // cannot, this is never true and ⏎ submits, which is why ⌥⏎ is the documented chord.\n if (key.return && key.shift) return { kind: \"newline\" }\n\n // Paging the conversation, unmodified.\n //\n // Deliberately not ^U/^D, which the plan named: both are already taken by the editor — ^U deletes to\n // the start of the line and ^D leaves an empty one — and they are documented, shell-standard, and\n // reached by muscle memory. A scroll key that silently deleted half a message would be a worse bug\n // than no scroll key.\n if (key.pageUp) return { kind: \"scroll\", move: \"pageUp\" }\n if (key.pageDown) return { kind: \"scroll\", move: \"pageDown\" }\n\n // Home and End. Ink has always parsed them; `KeyState` never declared the fields, so both keys did\n // nothing whatsoever until now. The raw-sequence fallback further down catches the terminals that\n // send a spelling Ink does not flag.\n if (key.home) return { kind: \"cursorHome\" }\n if (key.end) return { kind: \"cursorEnd\" }\n\n if (key.return) return context.searching ? { kind: \"searchAccept\" } : { kind: \"submit\" }\n if (key.backspace) return { kind: \"backspace\" }\n if (key.delete) return { kind: \"delete\" }\n if (key.leftArrow) return { kind: \"cursorLeft\" }\n if (key.rightArrow) return { kind: \"cursorRight\" }\n // History at the edges of the buffer, line movement inside it. While searching both walk the match\n // list, which the reducer routes — the arrows mean \"previous\" and \"next\" either way.\n if (key.upArrow) {\n return context.searching || context.firstLine ? { kind: \"historyPrev\" } : { kind: \"lineUp\" }\n }\n if (key.downArrow) {\n return context.searching || context.lastLine\n ? { kind: \"historyNext\" }\n : { kind: \"lineDown\" }\n }\n\n // Escape closes a search; otherwise it is claimed deliberately and does nothing, rather than\n // falling through to the insert branch where it would put a control character into the buffer and\n // be sent to a model. Tab is claimed for the same reason.\n if (key.escape) {\n if (context.searching) return { kind: \"searchCancel\" }\n return context.scrolled ? { kind: \"scroll\", move: \"bottom\" } : { kind: \"none\" }\n }\n if (key.tab) return { kind: \"none\" }\n\n // A paste arrives as one large `input` with no key flags, so insert has to accept many\n // characters at once rather than assuming a single keypress.\n if (input === \"\") return { kind: \"none\" }\n\n // Home and End again, by raw sequence. There are four spellings in the wild and Ink flags only some\n // of them — the reference keeps the same fallback for the same reason (`useTextInput.ts:385-389`).\n // After the empty-input check and before the printable filter, which would otherwise strip the\n // escape and insert `[H` into the message.\n if (input === \"\\u001B[H\" || input === \"\\u001B[1~\") return { kind: \"cursorHome\" }\n if (input === \"\\u001B[F\" || input === \"\\u001B[4~\") return { kind: \"cursorEnd\" }\n\n // Newlines inside that chunk are line breaks, not control noise. Stripping them — which the\n // printable filter below would do — silently joins the last word of one line to the first word\n // of the next and submits nothing, so a pasted multi-line prompt arrives mangled with no error.\n if (/[\\r\\n]/.test(input)) {\n const lines = input.split(/\\r\\n|[\\r\\n]/).map(printableOnly)\n // A trailing newline means the final line is finished too; without one, the tail is still\n // being typed.\n const complete = lines.at(-1) === \"\" && lines.length > 1\n return { kind: \"paste\", lines: complete ? lines.slice(0, -1) : lines, complete }\n }\n\n const printable = printableOnly(input)\n return printable === \"\" ? { kind: \"none\" } : { kind: \"insert\", text: printable }\n}\n\n/**\n * Which motion a shift chord extends by, or `undefined` when the key is not a motion at all.\n *\n * Modifier first, then the bare keys, so `shift+cmd+←` is a line and `shift+⌥←` is a word rather than both\n * being a character. `shift+↑` extends a line up even on the first line, where the unshifted arrow means\n * history: selecting upward is unambiguous, and a history chord that also grew a selection would be one\n * key doing two unrelated things.\n *\n * `input` is deliberately not consulted. The `ESC b` spelling of `⌥←` would arrive shifted as `ESC B`, and\n * matching a capital letter here is how `shift+B` would start selecting words. Terminals send the CSI form\n * for a shifted arrow, which carries the flags this reads.\n */\nfunction shiftMotion(key: KeyState): MotionKind | undefined {\n if (key.super) {\n if (key.leftArrow) return \"cursorHome\"\n if (key.rightArrow) return \"cursorEnd\"\n if (key.upArrow) return \"bufferStart\"\n if (key.downArrow) return \"bufferEnd\"\n return undefined\n }\n if (key.meta || key.ctrl) {\n if (key.leftArrow) return \"wordLeft\"\n if (key.rightArrow) return \"wordRight\"\n return undefined\n }\n if (key.home) return \"cursorHome\"\n if (key.end) return \"cursorEnd\"\n if (key.leftArrow) return \"cursorLeft\"\n if (key.rightArrow) return \"cursorRight\"\n if (key.upArrow) return \"lineUp\"\n if (key.downArrow) return \"lineDown\"\n return undefined\n}\n\n/**\n * Drop C0 controls and DEL. A bracketed-paste marker or a stray escape sequence reaching the buffer\n * would be invisible on screen and sent to the model as if it had been typed.\n */\nfunction printableOnly(text: string): string {\n return [...text]\n .filter((char) => {\n const code = char.codePointAt(0) ?? 0\n return code >= 0x20 && code !== 0x7f\n })\n .join(\"\")\n}\n\n// ─── screen keymaps ──────────────────────────────────────────────────────────────────────\n//\n// The wizard and picker differ from the chat input in what Esc means — a *context*, not a new\n// module, which is why they live here beside `keyToIntent` rather than in per-screen files: one\n// keyboard home, closed by the same drift tests.\n\nimport type { SelectMove } from \"#lib/select\"\n\nexport type ListIntent =\n | { readonly kind: \"move\"; readonly move: SelectMove }\n | { readonly kind: \"choose\" }\n | { readonly kind: \"back\" }\n | { readonly kind: \"exit\" }\n | { readonly kind: \"none\" }\n\n/**\n * A checklist adds two verbs a single-select list does not have: tick a row, and finish.\n *\n * Space ticks and enter finishes, which is the convention every multi-select in a terminal uses — and\n * getting it the other way round is the mistake that makes a picker feel broken, because enter on a\n * highlighted row is such a strong habit that people submit with one thing ticked and never see the rest.\n * `a` and `n` are all/none, worth having when the list is fifty rows long.\n */\nexport type CheckIntent =\n | { readonly kind: \"move\"; readonly move: SelectMove }\n | { readonly kind: \"toggle\" }\n | { readonly kind: \"all\" }\n | { readonly kind: \"none-selected\" }\n | { readonly kind: \"confirm\" }\n | { readonly kind: \"cancel\" }\n | { readonly kind: \"none\" }\n\nexport function keyToCheckIntent(input: string, key: KeyState): CheckIntent {\n if (key.ctrl) {\n return input.toLowerCase() === \"c\" || input.toLowerCase() === \"d\"\n ? { kind: \"cancel\" }\n : { kind: \"none\" }\n }\n if (key.return) return { kind: \"confirm\" }\n if (key.escape) return { kind: \"cancel\" }\n // Ink reports the space bar as the input string \" \" with no flag of its own.\n if (input === \" \") return { kind: \"toggle\" }\n if (input === \"a\") return { kind: \"all\" }\n if (input === \"n\") return { kind: \"none-selected\" }\n\n const list = keyToListIntent(input, key)\n // Movement is shared so the two lists cannot drift apart; `choose` cannot arrive, because `key.return`\n // is handled above, and the remaining kinds are not this screen's.\n return list.kind === \"move\" ? list : { kind: \"none\" }\n}\n\n/**\n * List navigation: arrows or j/k, g/G for ends, enter chooses, esc backs out, ^C/^D leave.\n *\n * A digit jumps the cursor — visibly and reversibly — and deliberately does not choose: a stray\n * number must never launch an agent.\n */\nexport function keyToListIntent(input: string, key: KeyState): ListIntent {\n if (key.ctrl) {\n return input.toLowerCase() === \"c\" || input.toLowerCase() === \"d\"\n ? { kind: \"exit\" }\n : { kind: \"none\" }\n }\n if (key.return) return { kind: \"choose\" }\n if (key.escape) return { kind: \"back\" }\n if (key.upArrow) return { kind: \"move\", move: { kind: \"up\" } }\n if (key.downArrow) return { kind: \"move\", move: { kind: \"down\" } }\n\n switch (input) {\n case \"k\":\n return { kind: \"move\", move: { kind: \"up\" } }\n case \"j\":\n return { kind: \"move\", move: { kind: \"down\" } }\n case \"g\":\n return { kind: \"move\", move: { kind: \"first\" } }\n case \"G\":\n return { kind: \"move\", move: { kind: \"last\" } }\n default:\n break\n }\n if (/^[1-9]$/.test(input)) {\n return { kind: \"move\", move: { kind: \"jump\", index: Number(input) - 1 } }\n }\n return { kind: \"none\" }\n}\n\nexport type WizardKeyIntent =\n | { readonly kind: \"back\" }\n | { readonly kind: \"abort\" }\n | { readonly kind: \"commit\" }\n | { readonly kind: \"list\"; readonly intent: ListIntent }\n | { readonly kind: \"edit\"; readonly intent: Intent }\n\n/**\n * The wizard's chrome keys are checked before delegation — Esc means \"back a question\" here,\n * which is exactly why chat's `keyToIntent` (which claims Esc as none) is not reused raw.\n *\n * Text steps then get the full chat editor treatment (^A/^E, ^W, code-point cursor); select steps\n * get the list navigation. A pasted blob collapses to its first line — a wizard answer is one\n * line — and history chords mean nothing inside a question.\n */\nexport function keyToWizardIntent(\n input: string,\n key: KeyState,\n context: { readonly select: boolean; readonly empty: boolean },\n): WizardKeyIntent {\n if (key.ctrl && input.toLowerCase() === \"c\") return { kind: \"abort\" }\n if (key.escape) return { kind: \"back\" }\n if (key.return) return { kind: \"commit\" }\n\n if (context.select) {\n return { kind: \"list\", intent: keyToListIntent(input, key) }\n }\n\n // A wizard answer is one line — a pasted blob collapses to its first — so the cursor is always on\n // both the first and the last line, and ↑/↓ mean history rather than line movement. There is no\n // search here either.\n const intent = keyToIntent(input, key, {\n busy: false,\n empty: context.empty,\n firstLine: true,\n lastLine: true,\n searching: false,\n // A question is not a conversation: there is nothing to scroll and nothing to arm, and Esc is\n // claimed above as \"back a question\" before this is ever reached.\n armed: false,\n scrolled: false,\n })\n switch (intent.kind) {\n case \"submit\":\n return { kind: \"commit\" }\n case \"exit\":\n // ^D on an empty question line reads as \"get me out\", same as ^C.\n return { kind: \"abort\" }\n case \"arm\":\n case \"scroll\":\n // Unreachable in practice — ^C is claimed as `abort` above and there is nothing to scroll —\n // and listed rather than left to the default, so adding a session-only intent cannot\n // silently become an edit the wizard applies to a field.\n return { kind: \"edit\", intent: { kind: \"none\" } }\n case \"historyPrev\":\n case \"historyNext\":\n return { kind: \"edit\", intent: { kind: \"none\" } }\n case \"paste\":\n return {\n kind: \"edit\",\n intent: { kind: \"insert\", text: intent.lines[0] ?? \"\" },\n }\n default:\n return { kind: \"edit\", intent }\n }\n}\n"
7
7
  ],
8
8
  "mappings": ";+GA2BO,IAAM,GAA4B,CACrC,MAAO,GACP,OAAQ,EACR,QAAS,CAAC,EACV,cAAe,EACf,MAAO,GACP,KAAM,CAAC,EACP,OAAQ,CAAC,EACT,OAAQ,OACR,OAAQ,MACZ,EAEA,SAAS,CAAK,CAAC,EAAyB,CACpC,MAAO,CAAC,GAAG,CAAK,EAGpB,SAAS,CAAK,CAAC,EAAgB,EAAwB,CACnD,OAAO,KAAK,IAAI,EAAG,KAAK,IAAI,EAAQ,CAAM,CAAC,EA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,IAAK,cACL,IAAK,cACD,MAAO,CAAE,KAAM,OAAQ,OAAQ,CAAE,KAAM,MAAO,CAAE,EACpD,IAAK,QACD,MAAO,CACH,KAAM,OACN,OAAQ,CAAE,KAAM,SAAU,KAAM,EAAO,MAAM,IAAM,EAAG,CAC1D,EACJ,QACI,MAAO,CAAE,KAAM,OAAQ,QAAO",
9
- "debugId": "1DB124110DBD055F64756E2164756E21",
9
+ "debugId": "DF643C201E22768D64756E2164756E21",
10
10
  "names": []
11
11
  }
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
- import{i}from"./index-dzy19wtf.js";import{Y}from"./index-0444sh6x.js";import{Box as y,Text as h}from"ink";import{jsx as k,jsxs as b}from"react/jsx-runtime";function Rn({lines:t}){let r=t.map((n,e)=>({at:e,text:n}));return k(y,{flexDirection:"column",children:r.map((n)=>b(h,{color:i.brand,bold:!0,wrap:"truncate",children:[" ".repeat(mA),n.text]},`mark-${n.at}`))})}var mA=1;var m="#",u={A:[".###.","#...#","#####","#...#","#...#"],B:["####.","#...#","####.","#...#","####."],C:[".####","#....","#....","#....",".####"],D:["####.","#...#","#...#","#...#","####."],E:["#####","#....","####.","#....","#####"],F:["#####","#....","####.","#....","#...."],G:[".####","#....","#..##","#...#",".###."],H:["#...#","#...#","#####","#...#","#...#"],I:["#####","..#..","..#..","..#..","#####"],J:["..###","....#","....#","#...#",".###."],K:["#...#","#..#.","###..","#..#.","#...#"],L:["#....","#....","#....","#....","#####"],M:["#...#","##.##","#.#.#","#...#","#...#"],N:["#...#","##..#","#.#.#","#..##","#...#"],O:[".###.","#...#","#...#","#...#",".###."],P:["####.","#...#","####.","#....","#...."],Q:[".###.","#...#","#.#.#","#..#.",".##.#"],R:["####.","#...#","####.","#..#.","#...#"],S:[".####","#....",".###.","....#","####."],T:["#####","..#..","..#..","..#..","..#.."],U:["#...#","#...#","#...#","#...#",".###."],V:["#...#","#...#","#...#",".#.#.","..#.."],W:["#...#","#...#","#.#.#","##.##","#...#"],X:["#...#",".#.#.","..#..",".#.#.","#...#"],Y:["#...#",".#.#.","..#..","..#..","..#.."],Z:["#####","...#.","..#..",".#...","#####"],"0":[".###.","#..##","#.#.#","##..#",".###."],"1":["..#..",".##..","..#..","..#..",".###."],"2":[".###.","#...#","..##.",".#...","#####"],"3":["####.","....#",".###.","....#","####."],"4":["#..#.","#..#.","#####","...#.","...#."],"5":["#####","#....","####.","....#","####."],"6":[".###.","#....","####.","#...#",".###."],"7":["#####","....#","...#.","..#..",".#..."],"8":[".###.","#...#",".###.","#...#",".###."],"9":[".###.","#...#",".####","....#",".###."],".":[".....",".....",".....",".....","..#.."],"-":[".....",".....",".###.",".....","....."]," ":[".....",".....",".....",".....","....."]},w=5,x=1;function T(t){return[...t.toUpperCase()].every((r)=>u[r]!==void 0)}function B(t){let r=[...t.toUpperCase()].map((e)=>u[e]??u[" "]),n=".".repeat(x);return Array.from({length:w},(e,s)=>r.map((a)=>a?.[s]??"").join(n))}function f(t,r,n){let e=r.repeat(n),s=" ".repeat(n);return t.map((a)=>[...a].map((o)=>o===m?e:s).join(""))}function W(t){let r=[".".repeat([...t[0]??""].length),...t],n=[];for(let e=0;e<r.length;e+=2){let s=[...r[e]??""],a=[...r[e+1]??""],o=[];for(let l=0;l<Math.max(s.length,a.length);l+=1){let d=s[l]===m,c=a[l]===m;o.push(d&&c?"█":d?"▀":c?"▄":" ")}n.push(o.join(""))}return n}function g(t,r){return[Y([...t.toUpperCase()].join(" "),r)]}function p(t){return t.reduce((r,n)=>Math.max(r,[...n].length),0)}function _n(t,r){let n=t.trim();if(n===""||!T(n)){let o=g(n,r.columns);return{lines:o,tier:"plain",width:p(o)}}let e=B(n),s=[{tier:"wide",lines:f(e,"█",2)},{tier:"block",lines:f(e,"█",1)},{tier:"half",lines:W(e)}];for(let o of s){let l=o.lines.map((c)=>c.replace(/\s+$/,"")),d=p(l);if(d<=r.columns&&l.length<=r.rows)return{lines:l,tier:o.tier,width:d}}let a=g(n,r.columns);return{lines:a,tier:"plain",width:p(a)}}
3
- export{Rn,mA,_n};
2
+ import{s}from"./index-ayhdn87b.js";import{j}from"./index-2fw9e5gg.js";import{Box as y,Text as h}from"ink";import{jsx as k,jsxs as b}from"react/jsx-runtime";function _n({lines:t}){let r=t.map((n,e)=>({at:e,text:n}));return k(y,{flexDirection:"column",children:r.map((n)=>b(h,{color:s.brand,bold:!0,wrap:"truncate",children:[" ".repeat(SA),n.text]},`mark-${n.at}`))})}var SA=1;var m="#",u={A:[".###.","#...#","#####","#...#","#...#"],B:["####.","#...#","####.","#...#","####."],C:[".####","#....","#....","#....",".####"],D:["####.","#...#","#...#","#...#","####."],E:["#####","#....","####.","#....","#####"],F:["#####","#....","####.","#....","#...."],G:[".####","#....","#..##","#...#",".###."],H:["#...#","#...#","#####","#...#","#...#"],I:["#####","..#..","..#..","..#..","#####"],J:["..###","....#","....#","#...#",".###."],K:["#...#","#..#.","###..","#..#.","#...#"],L:["#....","#....","#....","#....","#####"],M:["#...#","##.##","#.#.#","#...#","#...#"],N:["#...#","##..#","#.#.#","#..##","#...#"],O:[".###.","#...#","#...#","#...#",".###."],P:["####.","#...#","####.","#....","#...."],Q:[".###.","#...#","#.#.#","#..#.",".##.#"],R:["####.","#...#","####.","#..#.","#...#"],S:[".####","#....",".###.","....#","####."],T:["#####","..#..","..#..","..#..","..#.."],U:["#...#","#...#","#...#","#...#",".###."],V:["#...#","#...#","#...#",".#.#.","..#.."],W:["#...#","#...#","#.#.#","##.##","#...#"],X:["#...#",".#.#.","..#..",".#.#.","#...#"],Y:["#...#",".#.#.","..#..","..#..","..#.."],Z:["#####","...#.","..#..",".#...","#####"],"0":[".###.","#..##","#.#.#","##..#",".###."],"1":["..#..",".##..","..#..","..#..",".###."],"2":[".###.","#...#","..##.",".#...","#####"],"3":["####.","....#",".###.","....#","####."],"4":["#..#.","#..#.","#####","...#.","...#."],"5":["#####","#....","####.","....#","####."],"6":[".###.","#....","####.","#...#",".###."],"7":["#####","....#","...#.","..#..",".#..."],"8":[".###.","#...#",".###.","#...#",".###."],"9":[".###.","#...#",".####","....#",".###."],".":[".....",".....",".....",".....","..#.."],"-":[".....",".....",".###.",".....","....."]," ":[".....",".....",".....",".....","....."]},w=5,x=1;function T(t){return[...t.toUpperCase()].every((r)=>u[r]!==void 0)}function B(t){let r=[...t.toUpperCase()].map((e)=>u[e]??u[" "]),n=".".repeat(x);return Array.from({length:w},(e,a)=>r.map((i)=>i?.[a]??"").join(n))}function f(t,r,n){let e=r.repeat(n),a=" ".repeat(n);return t.map((i)=>[...i].map((o)=>o===m?e:a).join(""))}function W(t){let r=[".".repeat([...t[0]??""].length),...t],n=[];for(let e=0;e<r.length;e+=2){let a=[...r[e]??""],i=[...r[e+1]??""],o=[];for(let l=0;l<Math.max(a.length,i.length);l+=1){let d=a[l]===m,c=i[l]===m;o.push(d&&c?"█":d?"▀":c?"▄":" ")}n.push(o.join(""))}return n}function g(t,r){return[j([...t.toUpperCase()].join(" "),r)]}function p(t){return t.reduce((r,n)=>Math.max(r,[...n].length),0)}function kn(t,r){let n=t.trim();if(n===""||!T(n)){let o=g(n,r.columns);return{lines:o,tier:"plain",width:p(o)}}let e=B(n),a=[{tier:"wide",lines:f(e,"█",2)},{tier:"block",lines:f(e,"█",1)},{tier:"half",lines:W(e)}];for(let o of a){let l=o.lines.map((c)=>c.replace(/\s+$/,"")),d=p(l);if(d<=r.columns&&l.length<=r.rows)return{lines:l,tier:o.tier,width:d}}let i=g(n,r.columns);return{lines:i,tier:"plain",width:p(i)}}
3
+ export{_n,SA,kn};
4
4
 
5
- //# debugId=95C0EA15AF2A18E264756E2164756E21
6
- //# sourceMappingURL=index-snz49ndn.js.map
5
+ //# debugId=B621E1276FA67B4164756E2164756E21
6
+ //# sourceMappingURL=index-4fajxhdv.js.map
@@ -6,6 +6,6 @@
6
6
  "/**\n * The product name, drawn large, from a glyph grid.\n *\n * ## Why a grid and not a string\n *\n * Hard rule 3: no brand strings outside `brand.ts`, so that a rename is one commit. An ASCII wordmark is\n * a brand string — a literal one would be the single largest violation in the tree. So this renders\n * whatever `BRAND.name` happens to say, from a table of letters, and a rename changes nothing here.\n *\n * ## The research, and what it settled\n *\n * Three findings shaped this. **5×5 pixels is the floor** for a legible Latin glyph without\n * anti-aliasing, so that is the grid. **A width-aware fallback is mandatory rather than polish** — the\n * big figlet faces (`big`, `ansi-shadow`) pass 120 columns on a nine-letter word, and this CLI's floor is\n * 40. And **half-blocks are the density trick**: one character cell per pixel renders a 5×5 glyph tall and\n * thin, because a cell is roughly 1:2, while packing two pixel rows into one cell with `▀▄█` brings it\n * back to nearly square.\n *\n * A third-party font was the obvious shortcut and is not taken: embedding `.flf` data or another\n * project's bitmap into an Apache-2.0 repo buys a licence question, and 26 letters are verifiable by\n * rendering them.\n *\n * ## One table, four renderings\n *\n * The tiers are parameter changes over the same grid — how many columns a pixel occupies, and whether\n * rows are packed — not four codepaths:\n *\n * | tier | pixel | rows | nine letters |\n * | --- | --- | --- | --- |\n * | `wide` | 2 columns | 5 | 106 columns |\n * | `block` | 1 column | 5 | 53 columns |\n * | `half` | 1 column | 3 | 53 columns |\n * | `plain` | — | 1 | as wide as the name |\n *\n * `plain` is the floor and always fits, because it is the name with spaces in it and gets clipped like\n * any other line. A screen too small for that is a screen with no wordmark, which is a real answer.\n *\n * Pure: text and a size in, lines out. Colour is the component's business.\n */\n\nimport { clip } from \"#lib/rows\"\n\n/** On and off, as authored. `#` reads as ink in the source, which is the only place these are edited. */\nconst ON = \"#\"\n\n/**\n * A 5×5 grid per glyph, authored by hand and verified by rendering.\n *\n * Uppercase only: the input is upper-cased before lookup, because a display face has no lowercase at this\n * size, and inventing one is how a name and its shout become two different-looking products. Digits are\n * here for a version, and `.`/`-`/space for what a name might contain.\n */\nconst GLYPHS: Readonly<Record<string, readonly string[]>> = {\n A: [\".###.\", \"#...#\", \"#####\", \"#...#\", \"#...#\"],\n B: [\"####.\", \"#...#\", \"####.\", \"#...#\", \"####.\"],\n C: [\".####\", \"#....\", \"#....\", \"#....\", \".####\"],\n D: [\"####.\", \"#...#\", \"#...#\", \"#...#\", \"####.\"],\n E: [\"#####\", \"#....\", \"####.\", \"#....\", \"#####\"],\n F: [\"#####\", \"#....\", \"####.\", \"#....\", \"#....\"],\n G: [\".####\", \"#....\", \"#..##\", \"#...#\", \".###.\"],\n H: [\"#...#\", \"#...#\", \"#####\", \"#...#\", \"#...#\"],\n I: [\"#####\", \"..#..\", \"..#..\", \"..#..\", \"#####\"],\n J: [\"..###\", \"....#\", \"....#\", \"#...#\", \".###.\"],\n K: [\"#...#\", \"#..#.\", \"###..\", \"#..#.\", \"#...#\"],\n L: [\"#....\", \"#....\", \"#....\", \"#....\", \"#####\"],\n M: [\"#...#\", \"##.##\", \"#.#.#\", \"#...#\", \"#...#\"],\n N: [\"#...#\", \"##..#\", \"#.#.#\", \"#..##\", \"#...#\"],\n O: [\".###.\", \"#...#\", \"#...#\", \"#...#\", \".###.\"],\n P: [\"####.\", \"#...#\", \"####.\", \"#....\", \"#....\"],\n Q: [\".###.\", \"#...#\", \"#.#.#\", \"#..#.\", \".##.#\"],\n R: [\"####.\", \"#...#\", \"####.\", \"#..#.\", \"#...#\"],\n S: [\".####\", \"#....\", \".###.\", \"....#\", \"####.\"],\n T: [\"#####\", \"..#..\", \"..#..\", \"..#..\", \"..#..\"],\n U: [\"#...#\", \"#...#\", \"#...#\", \"#...#\", \".###.\"],\n V: [\"#...#\", \"#...#\", \"#...#\", \".#.#.\", \"..#..\"],\n W: [\"#...#\", \"#...#\", \"#.#.#\", \"##.##\", \"#...#\"],\n X: [\"#...#\", \".#.#.\", \"..#..\", \".#.#.\", \"#...#\"],\n Y: [\"#...#\", \".#.#.\", \"..#..\", \"..#..\", \"..#..\"],\n Z: [\"#####\", \"...#.\", \"..#..\", \".#...\", \"#####\"],\n \"0\": [\".###.\", \"#..##\", \"#.#.#\", \"##..#\", \".###.\"],\n \"1\": [\"..#..\", \".##..\", \"..#..\", \"..#..\", \".###.\"],\n \"2\": [\".###.\", \"#...#\", \"..##.\", \".#...\", \"#####\"],\n \"3\": [\"####.\", \"....#\", \".###.\", \"....#\", \"####.\"],\n \"4\": [\"#..#.\", \"#..#.\", \"#####\", \"...#.\", \"...#.\"],\n \"5\": [\"#####\", \"#....\", \"####.\", \"....#\", \"####.\"],\n \"6\": [\".###.\", \"#....\", \"####.\", \"#...#\", \".###.\"],\n \"7\": [\"#####\", \"....#\", \"...#.\", \"..#..\", \".#...\"],\n \"8\": [\".###.\", \"#...#\", \".###.\", \"#...#\", \".###.\"],\n \"9\": [\".###.\", \"#...#\", \".####\", \"....#\", \".###.\"],\n \".\": [\".....\", \".....\", \".....\", \".....\", \"..#..\"],\n \"-\": [\".....\", \".....\", \".###.\", \".....\", \".....\"],\n \" \": [\".....\", \".....\", \".....\", \".....\", \".....\"],\n}\n\nconst GLYPH_ROWS = 5\n/** Blank pixel columns between letters. One is enough at this weight; two reads as word spacing. */\nconst TRACKING = 1\n\nexport type WordmarkTier = \"wide\" | \"block\" | \"half\" | \"plain\"\n\nexport interface Wordmark {\n readonly lines: readonly string[]\n readonly tier: WordmarkTier\n /** Code points in the widest line, so a caller can centre it without measuring. */\n readonly width: number\n}\n\n/** Letters this module can draw. A name containing anything else falls back to `plain`. */\nexport function drawable(text: string): boolean {\n return [...text.toUpperCase()].every((char) => GLYPHS[char] !== undefined)\n}\n\n/** The pixel grid for a whole word: rows of `#` and `.`, tracking included. */\nfunction pixels(text: string): readonly string[] {\n const glyphs = [...text.toUpperCase()].map((char) => GLYPHS[char] ?? GLYPHS[\" \"])\n const gap = \".\".repeat(TRACKING)\n return Array.from({ length: GLYPH_ROWS }, (_, row) =>\n glyphs.map((glyph) => glyph?.[row] ?? \"\").join(gap),\n )\n}\n\n/** Every pixel as `columns` cells of the fill character, or of space. */\nfunction solid(grid: readonly string[], fill: string, columns: number): readonly string[] {\n const on = fill.repeat(columns)\n const off = \" \".repeat(columns)\n return grid.map((row) => [...row].map((cell) => (cell === ON ? on : off)).join(\"\"))\n}\n\n/**\n * Two pixel rows to a text row, using the half blocks.\n *\n * This is what makes the compact tier look like type rather than a stretched grid: five pixel rows become\n * three text rows, so a 5-wide glyph is 5×3 cells — near enough square once a cell's own 1:2 ratio is\n * accounted for.\n *\n * Five rows is odd, so one of them pairs with nothing, and **which end gets the blank decides the\n * weight**. Padding the bottom leaves every baseline as a thin `▀`, so the letters sit on a hairline and\n * read light. Padding the *top* puts the blank against the cap line instead: the top stroke becomes `▄`\n * and the baseline becomes a full `█`. Compared side by side that is not a close call — caps want to be\n * bottom-heavy — which is why the blank row is prepended rather than appended.\n */\nfunction packed(grid: readonly string[]): readonly string[] {\n const padded = [\".\".repeat([...(grid[0] ?? \"\")].length), ...grid]\n const lines: string[] = []\n for (let row = 0; row < padded.length; row += 2) {\n const top = [...(padded[row] ?? \"\")]\n const bottom = [...(padded[row + 1] ?? \"\")]\n const cells: string[] = []\n for (let at = 0; at < Math.max(top.length, bottom.length); at += 1) {\n const up = top[at] === ON\n const down = bottom[at] === ON\n cells.push(up && down ? \"█\" : up ? \"▀\" : down ? \"▄\" : \" \")\n }\n lines.push(cells.join(\"\"))\n }\n return lines\n}\n\n/** The name with a space between every letter — the floor, and it always fits because it is clipped. */\nfunction spaced(text: string, columns: number): readonly string[] {\n return [clip([...text.toUpperCase()].join(\" \"), columns)]\n}\n\nfunction widthOf(lines: readonly string[]): number {\n return lines.reduce((widest, line) => Math.max(widest, [...line].length), 0)\n}\n\n/**\n * The largest wordmark that fits, and how it was drawn.\n *\n * Degrades on both axes, because a splash is constrained by both: a 40-column terminal has no room for the\n * grid at any packing, and an 8-row one has no room for five rows of anything. Trailing blank space is\n * trimmed from each line so a caller centring on `width` centres the ink rather than the padding.\n */\nexport function wordmark(\n text: string,\n space: { readonly columns: number; readonly rows: number },\n): Wordmark {\n const trimmed = text.trim()\n if (trimmed === \"\" || !drawable(trimmed)) {\n const lines = spaced(trimmed, space.columns)\n return { lines, tier: \"plain\", width: widthOf(lines) }\n }\n\n const grid = pixels(trimmed)\n const candidates: readonly { tier: WordmarkTier; lines: readonly string[] }[] = [\n { tier: \"wide\", lines: solid(grid, \"█\", 2) },\n { tier: \"block\", lines: solid(grid, \"█\", 1) },\n { tier: \"half\", lines: packed(grid) },\n ]\n\n for (const candidate of candidates) {\n const lines = candidate.lines.map((line) => line.replace(/\\s+$/, \"\"))\n const width = widthOf(lines)\n if (width <= space.columns && lines.length <= space.rows) {\n return { lines, tier: candidate.tier, width }\n }\n }\n\n const lines = spaced(trimmed, space.columns)\n return { lines, tier: \"plain\", width: widthOf(lines) }\n}\n"
7
7
  ],
8
8
  "mappings": ";sEAoBA,cAAS,UAAK,8DAIP,SAAS,EAAS,EAAG,SAAyB,CAIjD,IAAM,EAAO,EAAM,IAAI,CAAC,EAAM,KAAQ,CAAE,KAAI,MAAK,EAAE,EAEnD,OACI,EAAC,EAAD,CAAK,cAAc,SAAnB,SACK,EAAK,IAAI,CAAC,IACP,EAAC,EAAD,CAA6B,MAAO,EAAM,MAAO,KAAI,GAAC,KAAK,WAA3D,SAGE,CAFG,IAAI,OAAO,EAAY,EACvB,EAAI,OAFE,QAAQ,EAAI,IAGrB,CACL,EACH,EAYH,IAAM,GAAe,ECP5B,IAAM,EAAK,IASL,EAAsD,CACxD,EAAG,CAAC,QAAS,QAAS,QAAS,QAAS,OAAO,EAC/C,EAAG,CAAC,QAAS,QAAS,QAAS,QAAS,OAAO,EAC/C,EAAG,CAAC,QAAS,QAAS,QAAS,QAAS,OAAO,EAC/C,EAAG,CAAC,QAAS,QAAS,QAAS,QAAS,OAAO,EAC/C,EAAG,CAAC,QAAS,QAAS,QAAS,QAAS,OAAO,EAC/C,EAAG,CAAC,QAAS,QAAS,QAAS,QAAS,OAAO,EAC/C,EAAG,CAAC,QAAS,QAAS,QAAS,QAAS,OAAO,EAC/C,EAAG,CAAC,QAAS,QAAS,QAAS,QAAS,OAAO,EAC/C,EAAG,CAAC,QAAS,QAAS,QAAS,QAAS,OAAO,EAC/C,EAAG,CAAC,QAAS,Q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EAAM,OAAO,EAC3C,MAAO,CAAE,QAAO,KAAM,QAAS,MAAO,EAAQ,CAAK,CAAE",
9
- "debugId": "95C0EA15AF2A18E264756E2164756E21",
9
+ "debugId": "B621E1276FA67B4164756E2164756E21",
10
10
  "names": []
11
11
  }
@@ -0,0 +1,9 @@
1
+ #!/usr/bin/env node
2
+ import{ia}from"./index-ayhdn87b.js";import{Ia,vo,ua,Ea,E,ya}from"./index-tc054tcb.js";function f(){return{out:process.stdout,in:process.stdin}}var n=[],i=!1,s=!1,o=!1,a=!1,u=!1,c=!1,d=!1;function ro(){o=!0}function wt(){o=!0,a=!0}function Cs(){o=!0,u=!0}function fs(){o=!0,c=!0}function H(e){n.push(e)}function hs(){d=!0}function Ze(e=f()){if(s||!o)return;if(s=!0,e.in.isTTY===!0&&e.in.setRawMode!==void 0)e.in.setRawMode(!1);if(e.out.isTTY!==!0)return;if(e.out.write(`${vo}${Ia}`),u)e.out.write(ia);if(c)e.out.write(Ea);if(a)e.out.write(ua)}async function ht(e=process.stdout){if(e.writableEnded===!0||e.destroyed===!0)return;await new Promise((r)=>{e.write("",()=>r())})}async function p(){for(let e of[...n].reverse())try{await e()}catch(r){process.stderr.write(`warning: cleanup failed: ${r instanceof Error?r.message:String(r)}
3
+ `)}n.length=0}async function m(e){await p(),Ze(),process.exitCode=e,await ht()}async function Ir(e){await m(e),process.exit(e)}function Bs(){if(i)return;i=!0,process.on("exit",()=>Ze()),process.on("SIGTERM",()=>{if(d)return;Ir(ya)});let e=(r)=>(t)=>{Ze();let l=t instanceof Error?t.stack??t.message:String(t);process.stderr.write(`
4
+ ${r}: ${l}
5
+ `),Ir(E)};process.on("uncaughtException",e("uncaught exception")),process.on("unhandledRejection",e("unhandled rejection"));for(let r of[process.stdout,process.stderr])r.on("error",(t)=>{if(t.code==="EPIPE"||t.code==="ERR_STREAM_DESTROYED")return;e("output error")(t)})}
6
+ export{ro,wt,Cs,fs,H,hs,Ze,ht,Ir,Bs};
7
+
8
+ //# debugId=2FCD0201A38C4ED364756E2164756E21
9
+ //# sourceMappingURL=index-4j65jp20.js.map
@@ -5,6 +5,6 @@
5
5
  "/**\n * One way out of the process.\n *\n * Two failure modes this exists to prevent, both of which the previous CLI had:\n *\n * **A hidden cursor and a terminal left in raw mode.** Ink hides the cursor and puts stdin in raw\n * mode. `process.exit()` from anywhere else — an error path, a signal, an uncaught rejection —\n * skips React's cleanup, and the shell you get back does not echo what you type. Recovering needs\n * `stty sane`, and nothing tells you that. So the restore is registered on `process.on(\"exit\")`\n * as well as run explicitly: whatever route the process takes out, the terminal is handed back.\n *\n * **Truncated output.** `process.stdout.write` to a *pipe* is asynchronous, and `process.exit()`\n * discards whatever has not flushed — so a `sessions … | head` invocation could lose its last lines,\n * intermittently and only when piped. Measured: 10 MB written and then exited immediately arrives as\n * **65,536 bytes**, one pipe buffer.\n *\n * The rule used to be \"set `process.exitCode` and let the event loop drain\", and that rule assumed the\n * loop *can* drain. It cannot. A command that boots a runtime leaves a keep-alive TLS socket to the\n * tool provider in Node's global `fetch` pool — `backend.composio.dev:443`, opened by the\n * post-readiness refresh — and that socket is ref'd, with no public API to close it. Measured: the\n * process was still alive **180 seconds** after `/exit`, and the `tools` command had to be killed at 30 s.\n * `^C` appeared to work only because SIGINT is deliberately unhandled here, so the default action kills\n * the process. a `tools --json | jq` invocation would have waited forever.\n *\n * So the rule is now: run the teardowns, drain the output *properly*, then leave. Both halves are\n * load-bearing — draining without leaving is the hang above, and leaving without draining is the\n * truncation above.\n */\n\nimport {\n DISABLE_ENHANCED_KEYS,\n EXIT_FAILURE,\n EXIT_SIGTERM,\n LEAVE_ALT_SCREEN,\n RESET_STYLE,\n SHOW_CURSOR,\n} from \"#lib/const\"\nimport { DISABLE_MOUSE } from \"#lib/mouse\"\nimport type { TerminalHandles } from \"#lib/schema\"\n\n/**\n * The real streams. Spelled out rather than passing `process` itself, which has no `in`/`out` —\n * that mistake typechecked against the structural type and threw only at runtime, inside the one\n * function whose entire job is to run when things have already gone wrong.\n */\nfunction processHandles(): TerminalHandles {\n return { out: process.stdout, in: process.stdin }\n}\n\ntype Teardown = () => void | Promise<void>\n\nconst teardowns: Teardown[] = []\nlet guardsInstalled = false\nlet restored = false\nlet dirty = false\nlet altScreen = false\nlet mouse = false\nlet enhancedKeys = false\nlet signalsClaimed = false\n\n/**\n * Declare that the terminal has been put into a state that needs undoing — raw mode, a hidden\n * cursor, alternate styling. Only the rich path does this.\n *\n * Without the flag, the restore would fire on *every* exit, including the plain path, which puts a\n * cursor-and-style reset at the end of output that is otherwise pure text. That breaks the property\n * plain mode exists for: `--plain` at a terminal has to produce exactly what a pipe produces.\n */\nexport function markTerminalDirty(): void {\n dirty = true\n}\n\n/**\n * Declare that the alternate screen buffer has been entered, so the restore swaps back out of it.\n *\n * Separate from `markTerminalDirty` rather than folded into it, because the two are not the same\n * claim: every rich surface dirties the terminal, and only the ones that *take* it need swapping\n * back. Folding them together would write the leave sequence after every wizard and every chat\n * session, and a `1049l` sent to a terminal that never entered the buffer clears the screen the\n * output was just written to — the plain path's parity rule, broken in the least debuggable way.\n *\n * Setting this and never entering is therefore worse than the reverse. The host that writes\n * `ENTER_ALT_SCREEN` calls this in the same statement.\n */\nexport function markAltScreen(): void {\n dirty = true\n altScreen = true\n}\n\n/**\n * The session asked the terminal to report the mouse, so the terminal has to be told to stop.\n *\n * Separate from `markAltScreen` because only the chat reads mouse reports. A surface that enabled\n * tracking without claiming every report would have them typed into it as text, which is what Ink does\n * with one — so the flag follows whoever handles them rather than whoever took the screen.\n *\n * Left on, the shell that gets the terminal back emits a report on every click and scroll, into a prompt\n * that has no idea what they are. That is the failure worth being loud about: it outlives the process.\n */\nexport function markMouse(): void {\n dirty = true\n mouse = true\n}\n\n/**\n * Ink negotiated the kitty keyboard protocol, so the terminal has to be told to stop reporting that way.\n *\n * Ink pops it itself on unmount and around a suspend — this exists for the path it cannot cover, which is\n * the same one `markMouse` exists for: a signal. `SIGTERM` is the only route a service manager uses, and\n * a terminal left in the protocol hands the next shell `CSI u` for every Ctrl chord, which reads as a\n * broken keyboard and outlives the process.\n *\n * Set by the render sites rather than derived, because whether the protocol was actually *pushed* depends\n * on the terminal answering a query 200 ms after mount — so the honest flag is \"we asked\", and popping a\n * protocol that was never pushed is a no-op on every terminal.\n */\nexport function markEnhancedKeys(): void {\n dirty = true\n enhancedKeys = true\n}\n\n/**\n * Run before the process ends. Registration order is preserved and reversed on the way out, so a\n * later-registered resource is released before the thing it depends on.\n */\nexport function onExit(teardown: Teardown): void {\n teardowns.push(teardown)\n}\n\n/**\n * Take ownership of SIGTERM, for a command whose shutdown *is* the point.\n *\n * The default guard answers SIGTERM with `finishNow(EXIT_SIGTERM)`, which is right for a command\n * that was interrupted: 143 is the shell convention and the work was not finished. It is wrong for\n * `serve`, where a signal is the ordinary and expected way to stop — the work was to stay up, and\n * being asked to stop is the successful end of it, not a failure.\n *\n * That distinction is not cosmetic once a service manager is involved. The generated service\n * definition restarts only on a crash, precisely so a misconfiguration stops once instead of\n * looping forever; a graceful stop reported as 143 is indistinguishable from that misconfiguration,\n * so the supervisor would refuse to bring the agent back.\n *\n * The caller must resolve its own wait on the signal and return an exit code normally. Everything\n * registered with `onExit` still runs, because `finish` awaits the teardowns either way.\n */\nexport function claimSignals(): void {\n signalsClaimed = true\n}\n\n/**\n * Synchronous by necessity — `process.on(\"exit\")` cannot await. Idempotent, because it runs both\n * explicitly and from the exit hook.\n */\nexport function restoreTerminal(handles: TerminalHandles = processHandles()): void {\n if (restored || !dirty) return\n restored = true\n if (handles.in.isTTY === true && handles.in.setRawMode !== undefined) {\n handles.in.setRawMode(false)\n }\n if (handles.out.isTTY !== true) return\n // Style and cursor first, buffer swap second. A reset applies to the buffer that is current when\n // it arrives, so resetting after the swap leaves the app's last colour on the shell's screen and\n // dutifully resets the one being thrown away.\n handles.out.write(`${RESET_STYLE}${SHOW_CURSOR}`)\n // Before the buffer swap, for the same reason the style reset is: the request was made against this\n // buffer and the shell must not be left with a terminal that reports clicks at it.\n if (mouse) handles.out.write(DISABLE_MOUSE)\n // Before the buffer swap for the same reason, and after the mouse for no reason but stable ordering\n // — a test asserts the sequence, and an order nothing pins is an order that drifts.\n //\n // This is usually the *second* pop: Ink pops on unmount, and on both the normal and the signal path\n // the unmount teardown has already run by the time this fires. Kept anyway, because the path it exists\n // for is the one where teardowns do not run at all — a hard crash — and a terminal left reporting\n // `CSI u` for every Ctrl chord outlives the process. Seen in a capture as `[<u[<u`.\n //\n // The cost is stated rather than hidden. A pop on an empty stack is ignored, so standalone this is\n // harmless; nested inside *another* application that pushed its own flags, the extra pop takes that\n // application's entry instead. That trade is accepted for a top-level CLI and would be the wrong one\n // for a library.\n if (enhancedKeys) handles.out.write(DISABLE_ENHANCED_KEYS)\n if (altScreen) handles.out.write(LEAVE_ALT_SCREEN)\n}\n\n/** Test seam. Nothing in `src/` outside this module calls it. */\nexport function resetForTests(\n options: {\n readonly dirty?: boolean\n readonly altScreen?: boolean\n readonly mouse?: boolean\n readonly enhancedKeys?: boolean\n } = {},\n): void {\n teardowns.length = 0\n restored = false\n dirty = options.dirty ?? true\n altScreen = options.altScreen ?? false\n mouse = options.mouse ?? false\n enhancedKeys = options.enhancedKeys ?? false\n signalsClaimed = false\n}\n\n/** Enough of a stream to wait on. Spelled out so a test can supply one without a pipe. */\ninterface Drainable {\n write(chunk: string, callback: () => void): unknown\n readonly writableEnded?: boolean\n readonly destroyed?: boolean\n}\n\n/**\n * Wait until everything written to stdout has actually reached the operating system.\n *\n * This used to test `writableNeedDrain` and await a `drain` event, which is a weaker claim than it\n * reads as: the flag is only true once the buffer is *over* the high-water mark, so a modest pending\n * write to a pipe reported nothing to wait for and the function named \"flush\" returned immediately.\n * That was survivable while the process went on to idle until the loop emptied, and is not survivable\n * now that it exits on purpose.\n *\n * A zero-length write is the receipt. `Writable` invokes callbacks in write order once the underlying\n * write completes, so a chunk queued behind everything else calls back only after everything else has\n * gone out. Measured against a pipe with a sleeping reader: 10 MB exits complete, where an immediate\n * `process.exit` delivered 65,536 bytes.\n *\n * **The wait is deliberately unbounded.** A timeout would trade a silent truncation for a bounded exit,\n * and with a slow reader — `| less`, a terminal being scrolled — truncation is the worse of the two. A\n * closed reader is not the hazard it looks like: the callback still fires, carrying `EPIPE`.\n *\n * Also awaited between turns, where the point is different: a long session feeding a slow reader\n * accumulates unwritten output in memory, and this bounds that to one turn's worth.\n */\nexport async function flushOutput(stream: Drainable = process.stdout): Promise<void> {\n // Nothing to wait for, and writing would throw. Checked rather than caught, because a throw here\n // lands inside the function whose whole job is to run when things are already ending.\n if (stream.writableEnded === true || stream.destroyed === true) return\n await new Promise<void>((resolve) => {\n stream.write(\"\", () => resolve())\n })\n}\n\nasync function runTeardowns(): Promise<void> {\n for (const teardown of [...teardowns].reverse()) {\n try {\n await teardown()\n } catch (error) {\n // A failing teardown must not mask the exit code that brought us here, and must not\n // stop the remaining teardowns — the terminal restore is one of them.\n process.stderr.write(\n `warning: cleanup failed: ${error instanceof Error ? error.message : String(error)}\\n`,\n )\n }\n }\n teardowns.length = 0\n}\n\n/**\n * Everything that has to happen before the process ends: teardowns, the terminal, the exit code, and\n * the output.\n *\n * Sets `process.exitCode` rather than exiting, so a caller that has its own reason to stay alive can.\n * Nothing in `src/` is such a caller any more — the entry point uses `finishNow` — but the split is\n * what makes this testable: a `finish` that exited would take the test runner with it.\n */\nexport async function finish(code: number): Promise<void> {\n await runTeardowns()\n restoreTerminal()\n process.exitCode = code\n await flushOutput()\n}\n\n/**\n * Finish, and then actually leave.\n *\n * The ordinary way out, not the exceptional one. It was written for a signal or a crash — \"where\n * waiting for the loop to drain would mean hanging\" — on the assumption that the ordinary path could\n * wait. It cannot: the module docstring records the measurement, a keep-alive socket in the global\n * `fetch` pool that outlived the process by three minutes.\n *\n * Safe to call here and nowhere earlier, because `finish` has already awaited the teardowns and the\n * output. Anything still holding the loop open at this point is a resource with no owner, and waiting\n * on one is what the hang was.\n */\nexport async function finishNow(code: number): Promise<never> {\n await finish(code)\n process.exit(code)\n}\n\n/**\n * Guards for the ways a process dies without being asked to.\n *\n * `SIGINT` is deliberately **not** handled here. During a turn it means \"cancel this turn\", not\n * \"exit\" — the chat path owns it, and a guard that exited would break the contract Phase 1\n * established and measured.\n */\nexport function installGuards(): void {\n if (guardsInstalled) return\n guardsInstalled = true\n\n // Last line of defence. Runs even when something calls process.exit directly.\n process.on(\"exit\", () => restoreTerminal())\n\n process.on(\"SIGTERM\", () => {\n // Yield to a command that owns its own shutdown. Without this the two handlers raced and\n // the hard exit won: `serve`'s graceful path started, `process.exit(143)` landed first, and\n // `runtime.stop()` never completed — so the outbox was not flushed, the database was not\n // closed, and the child processes `exec` backgrounds were never reaped. Invisible at a\n // terminal, because ctrl-C sends SIGINT and this guard deliberately ignores that one.\n if (signalsClaimed) return\n void finishNow(EXIT_SIGTERM)\n })\n\n const crash = (label: string) => (error: unknown) => {\n restoreTerminal()\n const message = error instanceof Error ? (error.stack ?? error.message) : String(error)\n // Loud and non-zero. An unexpected failure that exits 0 is the thing hard rule 8 forbids.\n process.stderr.write(`\\n${label}: ${message}\\n`)\n void finishNow(EXIT_FAILURE)\n }\n process.on(\"uncaughtException\", crash(\"uncaught exception\"))\n process.on(\"unhandledRejection\", crash(\"unhandled rejection\"))\n\n // A reader that closed early — `<cli> validate | head -1` — is the reader deciding it has what it\n // wanted, not this command failing: every write after it raises EPIPE (then ERR_STREAM_DESTROYED)\n // as an 'error' event, and unhandled that became \"uncaught exception: write EPIPE\" on stderr and,\n // under some timings, exit 134. The command's own exit code stands. Anything else on these streams\n // still goes to the crash path above, loudly.\n for (const stream of [process.stdout, process.stderr]) {\n stream.on(\"error\", (error: NodeJS.ErrnoException) => {\n if (error.code === \"EPIPE\" || error.code === \"ERR_STREAM_DESTROYED\") return\n crash(\"output error\")(error)\n })\n }\n}\n"
6
6
  ],
7
7
  "mappings": ";sFA6CA,SAAS,CAAc,EAAoB,CACvC,MAAO,CAAE,IAAK,QAAQ,OAAQ,GAAI,QAAQ,KAAM,EAKpD,IAAM,E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Aa,EACnB,GAAgB,EAChB,QAAQ,SAAW,EACnB,MAAM,GAAY,EAef,eAAe,EAAS,CAAC,EAA8B,CAC1D,MAAM,EAAO,CAAI,EACjB,QAAQ,KAAK,CAAI,EAUd,SAAS,EAAa,EAAS,CAClC,GAAI,EAAiB,OACrB,EAAkB,GAGlB,QAAQ,GAAG,OAAQ,IAAM,GAAgB,CAAC,EAE1C,QAAQ,GAAG,UAAW,IAAM,CAMxB,GAAI,EAAgB,OACf,GAAU,EAAY,EAC9B,EAED,IAAM,EAAQ,CAAC,IAAkB,CAAC,IAAmB,CACjD,GAAgB,EAChB,IAAM,EAAU,aAAiB,MAAS,EAAM,OAAS,EAAM,QAAW,OAAO,CAAK,EAEtF,QAAQ,OAAO,MAAM;AAAA,EAAK,MAAU;AAAA,CAAW,EAC1C,GAAU,CAAY,GAE/B,QAAQ,GAAG,oBAAqB,EAAM,oBAAoB,CAAC,EAC3D,QAAQ,GAAG,qBAAsB,EAAM,qBAAqB,CAAC,EAO7D,QAAW,IAAU,CAAC,QAAQ,OAAQ,QAAQ,MAAM,EAChD,EAAO,GAAG,QAAS,CAAC,IAAiC,CACjD,GAAI,EAAM,OAAS,SAAW,EAAM,OAAS,uBAAwB,OACrE,EAAM,cAAc,EAAE,CAAK,EAC9B",
8
- "debugId": "BA9EEC684635AE2264756E2164756E21",
8
+ "debugId": "2FCD0201A38C4ED364756E2164756E21",
9
9
  "names": []
10
10
  }
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env node
2
+ import{u,e,Li,I}from"./index-kz01jz58.js";var qe=e(function(Wn,Ve){var J=1000,Z=J*60,K=Z*60,W=K*24,Ct=W*7,bt=W*365.25;Ve.exports=function(t,r){r=r||{};var n=typeof t;if(n==="string"&&t.length>0)return Et(t);else if(n==="number"&&isFinite(t))return r.long?Bt(t):Ft(t);throw Error("val is not a non-empty string or a valid number. val="+JSON.stringify(t))};function Et(t){if(t=String(t),t.length>100)return;var r=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(t);if(!r)return;var n=parseFloat(r[1]),o=(r[2]||"ms").toLowerCase();switch(o){case"years":case"year":case"yrs":case"yr":case"y":return n*bt;case"weeks":case"week":case"w":return n*Ct;case"days":case"day":case"d":return n*W;case"hours":case"hour":case"hrs":case"hr":case"h":return n*K;case"minutes":case"minute":case"mins":case"min":case"m":return n*Z;case"seconds":case"second":case"secs":case"sec":case"s":return n*J;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return n;default:return}}function Ft(t){var r=Math.abs(t);if(r>=W)return Math.round(t/W)+"d";if(r>=K)return Math.round(t/K)+"h";if(r>=Z)return Math.round(t/Z)+"m";if(r>=J)return Math.round(t/J)+"s";return t+"ms"}function Bt(t){var r=Math.abs(t);if(r>=W)return ge(t,r,W,"day");if(r>=K)return ge(t,r,K,"hour");if(r>=Z)return ge(t,r,Z,"minute");if(r>=J)return ge(t,r,J,"second");return t+" ms"}function ge(t,r,n,o){var s=r>=n*1.5;return Math.round(t/n)+" "+o+(s?"s":"")}});var Ne=e(function(Vn,Je){function It(t){n.debug=n,n.default=n,n.coerce=b,n.disable=p,n.enable=s,n.enabled=C,n.humanize=qe(),n.destroy=A,Object.keys(t).forEach((a)=>{n[a]=t[a]}),n.names=[],n.skips=[],n.formatters={};function r(a){let h=0;for(let x=0;x<a.length;x++)h=(h<<5)-h+a.charCodeAt(x),h|=0;return n.colors[Math.abs(h)%n.colors.length]}n.selectColor=r;function n(a){let h,x=null,w,v;function U(...z){if(!U.enabled)return;let H=U,ce=Number(new Date),ft=ce-(h||ce);if(H.diff=ft,H.prev=h,H.curr=ce,h=ce,z[0]=n.coerce(z[0]),typeof z[0]!=="string")z.unshift("%O");let ue=0;z[0]=z[0].replace(/%([a-zA-Z%])/g,(Ae,ht)=>{if(Ae==="%%")return"%";ue++;let Ge=n.formatters[ht];if(typeof Ge==="function"){let gt=z[ue];Ae=Ge.call(H,gt),z.splice(ue,1),ue--}return Ae}),n.formatArgs.call(H,z),(H.log||n.log).apply(H,z)}if(U.namespace=a,U.useColors=n.useColors(),U.color=n.selectColor(a),U.extend=o,U.destroy=n.destroy,Object.defineProperty(U,"enabled",{enumerable:!0,configurable:!1,get:()=>{if(x!==null)return x;if(w!==n.namespaces)w=n.namespaces,v=n.enabled(a);return v},set:(z)=>{x=z}}),typeof n.init==="function")n.init(U);return U}function o(a,h){let x=n(this.namespace+(typeof h>"u"?":":h)+a);return x.log=this.log,x}function s(a){n.save(a),n.namespaces=a,n.names=[],n.skips=[];let h=(typeof a==="string"?a:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(let x of h)if(x[0]==="-")n.skips.push(x.slice(1));else n.names.push(x)}function i(a,h){let x=0,w=0,v=-1,U=0;while(x<a.length)if(w<h.length&&(h[w]===a[x]||h[w]==="*"))if(h[w]==="*")v=w,U=x,w++;else x++,w++;else if(v!==-1)w=v+1,U++,x=U;else return!1;while(w<h.length&&h[w]==="*")w++;return w===h.length}function p(){let a=[...n.names,...n.skips.map((h)=>"-"+h)].join(",");return n.enable(""),a}function C(a){for(let h of n.skips)if(i(a,h))return!1;for(let h of n.names)if(i(a,h))return!0;return!1}function b(a){if(a instanceof Error)return a.stack||a.message;return a}function A(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return n.enable(n.load()),n}Je.exports=It});var Ze=e(function(Pe,me){Pe.formatArgs=St;Pe.save=Rt;Pe.load=zt;Pe.useColors=Ut;Pe.storage=Dt();Pe.destroy=(()=>{let t=!1;return()=>{if(!t)t=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}})();Pe.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function Ut(){if(typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))return!0;if(typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let t;return typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&(t=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(t[1],10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function St(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+me.exports.humanize(this.diff),!this.useColors)return;let r="color: "+this.color;t.splice(1,0,r,"color: inherit");let n=0,o=0;t[0].replace(/%[a-zA-Z%]/g,(s)=>{if(s==="%%")return;if(n++,s==="%c")o=n}),t.splice(o,0,r)}Pe.log=console.debug||console.log||(()=>{});function Rt(t){try{if(t)Pe.storage.setItem("debug",t);else Pe.storage.removeItem("debug")}catch(r){}}function zt(){let t;try{t=Pe.storage.getItem("debug")||Pe.storage.getItem("DEBUG")}catch(r){}if(!t&&typeof process<"u"&&"env"in process)t=process.env.DEBUG;return t}function Dt(){try{return localStorage}catch(t){}}me.exports=Ne()(Pe);var{formatters:Nt}=me.exports;Nt.j=function(t){try{return JSON.stringify(t)}catch(r){return"[UnexpectedJSONParseError]: "+r.message}}});var Ye=e(function(Oe,xe){var Ke=I("tty"),_=I("util");Oe.init=Qt;Oe.log=Jt;Oe.formatArgs=Vt;Oe.save=Zt;Oe.load=Kt;Oe.useColors=Wt;Oe.destroy=_.deprecate(()=>{},"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");Oe.colors=[6,2,3,4,5,1];try{let t=(()=>{throw new Error("Cannot require module "+"supports-color");})();if(t&&(t.stderr||t).level>=2)Oe.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221]}catch(t){}Oe.inspectOpts=Object.keys(process.env).filter((t)=>/^debug_/i.test(t)).reduce((t,r)=>{let n=r.substring(6).toLowerCase().replace(/_([a-z])/g,(s,i)=>i.toUpperCase()),o=process.env[r];if(/^(yes|on|true|enabled)$/i.test(o))o=!0;else if(/^(no|off|false|disabled)$/i.test(o))o=!1;else if(o==="null")o=null;else o=Number(o);return t[n]=o,t},{});function Wt(){return"colors"in Oe.inspectOpts?Boolean(Oe.inspectOpts.colors):Ke.isatty(process.stderr.fd)}function Vt(t){let{namespace:r,useColors:n}=this;if(n){let o=this.color,s="\x1B[3"+(o<8?o:"8;5;"+o),i=` ${s};1m${r} \x1B[0m`;t[0]=i+t[0].split(`
3
+ `).join(`
4
+ `+i),t.push(s+"m+"+xe.exports.humanize(this.diff)+"\x1B[0m")}else t[0]=qt()+r+" "+t[0]}function qt(){if(Oe.inspectOpts.hideDate)return"";return new Date().toISOString()+" "}function Jt(...t){return process.stderr.write(_.formatWithOptions(Oe.inspectOpts,...t)+`
5
+ `)}function Zt(t){if(t)process.env.DEBUG=t;else delete process.env.DEBUG}function Kt(){return process.env.DEBUG}function Qt(t){t.inspectOpts={};let r=Object.keys(Oe.inspectOpts);for(let n=0;n<r.length;n++)t.inspectOpts[r[n]]=Oe.inspectOpts[r[n]]}xe.exports=Ne()(Oe);var{formatters:Qe}=xe.exports;Qe.o=function(t){return this.inspectOpts.colors=this.useColors,_.inspect(t,this.inspectOpts).split(`
6
+ `).map((r)=>r.trim()).join(" ")};Qe.O=function(t){return this.inspectOpts.colors=this.useColors,_.inspect(t,this.inspectOpts)}});var T=e(function(Zn,Le){if(typeof process>"u"||process.type==="renderer"||!1||process.__nwjs)Le.exports=Ze();else Le.exports=Ye()});var Dn={};Li(Dn,{AnsiStringType:()=>nt,Float16_BE:()=>Cr,Float16_LE:()=>br,Float32_BE:()=>Mi,Float32_LE:()=>Er,Float64_BE:()=>kr,Float64_LE:()=>Br,Float80_BE:()=>Ir,Float80_LE:()=>Ur,INT16_BE:()=>At,INT16_LE:()=>yr,INT24_BE:()=>_r,INT24_LE:()=>Tr,INT32_BE:()=>ke,INT32_LE:()=>ie,INT64_BE:()=>Ni,INT64_LE:()=>Oi,INT8:()=>kt,IgnoreType:()=>rt,StringType:()=>d,UINT16_BE:()=>D,UINT16_LE:()=>y,UINT24_BE:()=>le,UINT24_LE:()=>Yo,UINT32_BE:()=>l,UINT32_LE:()=>c,UINT64_BE:()=>yt,UINT64_LE:()=>se,UINT8:()=>f,Uint8ArrayType:()=>P});import{stat as wt}from"node:fs/promises";class m extends Error{constructor(){super("End-Of-Stream");this.name="EndOfStreamError"}}class j extends Error{constructor(t="The operation was aborted"){super(t);this.name="AbortError"}}class Se{constructor(){this.resolve=()=>null,this.reject=()=>null,this.promise=new Promise((t,r)=>{this.reject=r,this.resolve=t})}}class G{constructor(){this.endOfStream=!1,this.interrupted=!1,this.peekQueue=[]}async peek(t,r=!1){let n=await this.read(t,r);return this.peekQueue.push(t.subarray(0,n)),n}async read(t,r=!1){if(t.length===0)return 0;let n=this.readFromPeekBuffer(t);if(!this.endOfStream)n+=await this.readRemainderFromStream(t.subarray(n),r);if(n===0&&!r)throw new m;return n}readFromPeekBuffer(t){let r=t.length,n=0;while(this.peekQueue.length>0&&r>0){let o=this.peekQueue.pop();if(!o)throw Error("peekData should be defined");let s=Math.min(o.length,r);if(t.set(o.subarray(0,s),n),n+=s,r-=s,s<o.length)this.peekQueue.push(o.subarray(s))}return n}async readRemainderFromStream(t,r){let n=0;while(n<t.length&&!this.endOfStream){if(this.interrupted)throw new j;let o=await this.readFromStream(t.subarray(n),r);if(o===0)break;n+=o}if(!r&&n<t.length)throw new m;return n}}class de extends G{constructor(t){super();if(this.s=t,this.deferred=null,!t.read||!t.once)throw Error("Expected an instance of stream.Readable");this.s.once("end",()=>{if(this.endOfStream=!0,this.deferred)this.deferred.resolve(0)}),this.s.once("error",(r)=>this.reject(r)),this.s.once("close",()=>this.abort())}async readFromStream(t,r){if(t.length===0)return 0;let n=this.s.read(t.length);if(n)return t.set(n),n.length;let o={buffer:t,mayBeLess:r,deferred:new Se};return this.deferred=o.deferred,this.s.once("readable",()=>{this.readDeferred(o)}),o.deferred.promise}readDeferred(t){let r=this.s.read(t.buffer.length);if(r)t.buffer.set(r),t.deferred.resolve(r.length),this.deferred=null;else this.s.once("readable",()=>{this.readDeferred(t)})}reject(t){if(this.interrupted=!0,this.deferred)this.deferred.reject(t),this.deferred=null}async abort(){this.reject(new j)}async close(){return this.abort()}}class Re extends G{constructor(t){super();this.reader=t}async abort(){return this.close()}async close(){this.reader.releaseLock()}}class pe extends Re{async readFromStream(t,r){if(t.length===0)return 0;let n=await this.reader.read(new Uint8Array(t.length),{min:r?void 0:t.length});if(n.done)this.endOfStream=n.done;if(n.value)return t.set(n.value),n.value.length;return 0}}class ee extends G{constructor(t){super();this.reader=t,this.buffer=null}writeChunk(t,r){let n=Math.min(r.length,t.length);if(t.set(r.subarray(0,n)),n<r.length)this.buffer=r.subarray(n);else this.buffer=null;return n}async readFromStream(t,r){if(t.length===0)return 0;let n=0;if(this.buffer)n+=this.writeChunk(t,this.buffer);while(n<t.length&&!this.endOfStream){let o=await this.reader.read();if(o.done){this.endOfStream=!0;break}if(o.value)n+=this.writeChunk(t.subarray(n),o.value)}if(!r&&n===0&&this.endOfStream)throw new m;return n}abort(){return this.interrupted=!0,this.reader.cancel()}async close(){await this.abort(),this.reader.releaseLock()}}function ze(t){try{let r=t.getReader({mode:"byob"});if(r instanceof ReadableStreamDefaultReader)return new ee(r);return new pe(r)}catch(r){if(r instanceof TypeError)return new ee(t.getReader());throw r}}class N{constructor(t){if(this.numBuffer=new Uint8Array(8),this.position=0,this.onClose=t?.onClose,t?.abortSignal)t.abortSignal.addEventListener("abort",()=>{this.abort()})}async readToken(t,r=this.position){let n=new Uint8Array(t.len);if(await this.readBuffer(n,{position:r})<t.len)throw new m;return t.get(n,0)}async peekToken(t,r=this.position){let n=new Uint8Array(t.len);if(await this.peekBuffer(n,{position:r})<t.len)throw new m;return t.get(n,0)}async readNumber(t){if(await this.readBuffer(this.numBuffer,{length:t.len})<t.len)throw new m;return t.get(this.numBuffer,0)}async peekNumber(t){if(await this.peekBuffer(this.numBuffer,{length:t.len})<t.len)throw new m;return t.get(this.numBuffer,0)}async ignore(t){if(t<0)throw RangeError("ignore length must be ≥ 0 bytes");if(this.fileInfo.size!==void 0){let r=this.fileInfo.size-this.position;if(t>r)return this.position+=r,r}return this.position+=t,t}async close(){await this.abort(),await this.onClose?.()}normalizeOptions(t,r){if(!this.supportsRandomAccess()&&r&&r.position!==void 0&&r.position<this.position)throw Error("`options.position` must be equal or greater than `tokenizer.position`");return{...{mayBeLess:!1,offset:0,length:t.length,position:this.position},...r}}abort(){return Promise.resolve()}}var mt=256000;class he extends N{constructor(t,r){super(r);this.streamReader=t,this.fileInfo=r?.fileInfo??{}}async readBuffer(t,r){let n=this.normalizeOptions(t,r),o=n.position-this.position;if(o>0)return await this.ignore(o),this.readBuffer(t,r);if(o<0)throw Error("`options.position` must be equal or greater than `tokenizer.position`");if(n.length===0)return 0;let s=await this.streamReader.read(t.subarray(0,n.length),n.mayBeLess);if(this.position+=s,(!r||!r.mayBeLess)&&s<n.length)throw new m;return s}async peekBuffer(t,r){let n=this.normalizeOptions(t,r),o=0;if(n.position){let s=n.position-this.position;if(s>0){let i=new Uint8Array(n.length+s);return o=await this.peekBuffer(i,{mayBeLess:n.mayBeLess}),t.set(i.subarray(s)),o-s}if(s<0)throw Error("Cannot peek from a negative offset in a stream")}if(n.length>0){try{o=await this.streamReader.peek(t.subarray(0,n.length),n.mayBeLess)}catch(s){if(r?.mayBeLess&&s instanceof m)return 0;throw s}if(!n.mayBeLess&&o<n.length)throw new m}return o}async ignore(t){if(t<0)throw RangeError("ignore length must be ≥ 0 bytes");let r=Math.min(mt,t),n=new Uint8Array(r),o=0;while(o<t){let s=t-o,i=await this.readBuffer(n,{length:Math.min(r,s)});if(i<0)return i;o+=i}return o}abort(){return this.streamReader.abort()}async close(){return this.streamReader.close()}supportsRandomAccess(){return!1}}class De extends N{constructor(t,r){super(r);this.uint8Array=t,this.fileInfo={...r?.fileInfo??{},...{size:t.length}}}async readBuffer(t,r){if(r?.position)this.position=r.position;let n=await this.peekBuffer(t,r);return this.position+=n,n}async peekBuffer(t,r){let n=this.normalizeOptions(t,r),o=Math.min(this.uint8Array.length-n.position,n.length);if(!n.mayBeLess&&o<n.length)throw new m;return t.set(this.uint8Array.subarray(n.position,n.position+o)),o}close(){return super.close()}supportsRandomAccess(){return!0}setPosition(t){this.position=t}}class ve extends N{constructor(t,r){super(r);this.blob=t,this.fileInfo={...r?.fileInfo??{},...{size:t.size,mimeType:t.type}}}async readBuffer(t,r){if(r?.position)this.position=r.position;let n=await this.peekBuffer(t,r);return this.position+=n,n}async peekBuffer(t,r){let n=this.normalizeOptions(t,r),o=Math.min(this.blob.size-n.position,n.length);if(!n.mayBeLess&&o<n.length)throw new m;let s=await this.blob.slice(n.position,n.position+o).arrayBuffer();return t.set(new Uint8Array(s)),o}close(){return super.close()}supportsRandomAccess(){return!0}setPosition(t){this.position=t}}function We(t,r){let n=new de(t),o=r??{},s=o.onClose;return o.onClose=async()=>{if(await n.close(),s)return s()},new he(n,o)}function wi(t,r){let n=ze(t),o=r??{},s=o.onClose;return o.onClose=async()=>{if(await n.close(),s)return s()},new he(n,o)}function _e(t,r){return new De(t,r)}function Di(t,r){return new ve(t,r)}import{open as xt}from"node:fs/promises";class re extends N{static async fromFile(t){let r=await xt(t,"r"),n=await r.stat();return new re(r,{fileInfo:{path:t,size:n.size}})}constructor(t,r){super(r);this.fileHandle=t,this.fileInfo=r.fileInfo}async readBuffer(t,r){let n=this.normalizeOptions(t,r);if(this.position=n.position,n.length===0)return 0;let o=await this.fileHandle.read(t,0,n.length,n.position);if(this.position+=o.bytesRead,o.bytesRead<n.length&&(!r||!r.mayBeLess))throw new m;return o.bytesRead}async peekBuffer(t,r){let n=this.normalizeOptions(t,r),o=await this.fileHandle.read(t,0,n.length,n.position);if(!n.mayBeLess&&o.bytesRead<n.length)throw new m;return o.bytesRead}async close(){return await this.fileHandle.close(),super.close()}setPosition(t){this.position=t}supportsRandomAccess(){return!0}}async function bi(t,r){let n=We(t,r);if(t.path){let o=await wt(t.path);n.fileInfo.path=t.path,n.fileInfo.size=o.size}return n}var Oa=re.fromFile;/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */var Q=function(t,r,n,o,s){var i,p,C=s*8-o-1,b=(1<<C)-1,A=b>>1,a=-7,h=n?s-1:0,x=n?-1:1,w=t[r+h];h+=x,i=w&(1<<-a)-1,w>>=-a,a+=C;for(;a>0;i=i*256+t[r+h],h+=x,a-=8);p=i&(1<<-a)-1,i>>=-a,a+=o;for(;a>0;p=p*256+t[r+h],h+=x,a-=8);if(i===0)i=1-A;else if(i===b)return p?NaN:(w?-1:1)*(1/0);else p=p+Math.pow(2,o),i=i-A;return(w?-1:1)*p*Math.pow(2,i-o)},X=function(t,r,n,o,s,i){var p,C,b,A=i*8-s-1,a=(1<<A)-1,h=a>>1,x=s===23?Math.pow(2,-24)-Math.pow(2,-77):0,w=o?0:i-1,v=o?1:-1,U=r<0||r===0&&1/r<0?1:0;if(r=Math.abs(r),isNaN(r)||r===1/0)C=isNaN(r)?1:0,p=a;else{if(p=Math.floor(Math.log(r)/Math.LN2),r*(b=Math.pow(2,-p))<1)p--,b*=2;if(p+h>=1)r+=x/b;else r+=x*Math.pow(2,1-h);if(r*b>=2)p++,b/=2;if(p+h>=a)C=0,p=a;else if(p+h>=1)C=(r*b-1)*Math.pow(2,s),p=p+h;else C=r*Math.pow(2,h-1)*Math.pow(2,s),p=0}for(;s>=8;t[n+w]=C&255,w+=v,C/=256,s-=8);p=p<<s|C,A+=s;for(;A>0;t[n+w]=p&255,w+=v,p/=256,A-=8);t[n+w-v]|=U*128};var et={128:"€",130:"‚",131:"ƒ",132:"„",133:"…",134:"†",135:"‡",136:"ˆ",137:"‰",138:"Š",139:"‹",140:"Œ",142:"Ž",145:"‘",146:"’",147:"“",148:"”",149:"•",150:"–",151:"—",152:"˜",153:"™",154:"š",155:"›",156:"œ",158:"ž",159:"Ÿ"},Me={};for(let[t,r]of Object.entries(et))Me[r]=Number.parseInt(t,10);var we,ye;function ir(){if(typeof globalThis.TextDecoder>"u")return;return we!==null&&we!==void 0?we:we=new globalThis.TextDecoder("utf-8")}function ar(){if(typeof globalThis.TextEncoder>"u")return;return ye!==null&&ye!==void 0?ye:ye=new globalThis.TextEncoder}var Y=32768,B=65533;function te(t,r="utf-8"){switch(r.toLowerCase()){case"utf-8":case"utf8":{let n=ir();return n?n.decode(t):lr(t)}case"utf-16le":return ur(t);case"us-ascii":case"ascii":return dr(t);case"latin1":case"iso-8859-1":return pr(t);case"windows-1252":return fr(t);default:throw RangeError(`Encoding '${r}' not supported`)}}function tt(t="",r="utf-8"){switch(r.toLowerCase()){case"utf-8":case"utf8":{let n=ar();return n?n.encode(t):hr(t)}case"utf-16le":return gr(t);case"us-ascii":case"ascii":return mr(t);case"latin1":case"iso-8859-1":return xr(t);case"windows-1252":return wr(t);default:throw RangeError(`Encoding '${r}' not supported`)}}function He(t,r){if(r.length===0)return;t.push(String.fromCharCode.apply(null,r)),r.length=0}function E(t,r,n){if(r.push(n),r.length>=Y)He(t,r)}function cr(t,r,n){if(n<=65535){E(t,r,n);return}n-=65536,E(t,r,55296+(n>>10)),E(t,r,56320+(n&1023))}function lr(t){let r=[],n=[],o=0;if(t.length>=3&&t[0]===239&&t[1]===187&&t[2]===191)o=3;while(o<t.length){let s=t[o];if(s<=127){E(r,n,s),o++;continue}if(s<194||s>244){E(r,n,B),o++;continue}if(s<=223){if(o+1>=t.length){E(r,n,B),o++;continue}let a=t[o+1];if((a&192)!==128){E(r,n,B),o++;continue}let h=(s&31)<<6|a&63;E(r,n,h),o+=2;continue}if(s<=239){if(o+2>=t.length){E(r,n,B),o++;continue}let a=t[o+1],h=t[o+2];if(!((a&192)===128&&(h&192)===128&&!(s===224&&a<160)&&!(s===237&&a>=160))){E(r,n,B),o++;continue}let w=(s&15)<<12|(a&63)<<6|h&63;E(r,n,w),o+=3;continue}if(o+3>=t.length){E(r,n,B),o++;continue}let i=t[o+1],p=t[o+2],C=t[o+3];if(!((i&192)===128&&(p&192)===128&&(C&192)===128&&!(s===240&&i<144)&&!(s===244&&i>143))){E(r,n,B),o++;continue}let A=(s&7)<<18|(i&63)<<12|(p&63)<<6|C&63;cr(r,n,A),o+=4}return He(r,n),r.join("")}function ur(t){let r=[],n=[],o=t.length,s=0;while(s+1<o){let i=t[s]|t[s+1]<<8;if(s+=2,i>=55296&&i<=56319){if(s+1<o){let p=t[s]|t[s+1]<<8;if(p>=56320&&p<=57343)E(r,n,i),E(r,n,p),s+=2;else E(r,n,B)}else E(r,n,B);continue}if(i>=56320&&i<=57343){E(r,n,B);continue}E(r,n,i)}if(s<o)E(r,n,B);return He(r,n),r.join("")}function dr(t){let r=[];for(let n=0;n<t.length;n+=Y){let o=Math.min(t.length,n+Y),s=Array(o-n);for(let i=n,p=0;i<o;i++,p++)s[p]=t[i]&127;r.push(String.fromCharCode.apply(null,s))}return r.join("")}function pr(t){let r=[];for(let n=0;n<t.length;n+=Y){let o=Math.min(t.length,n+Y),s=Array(o-n);for(let i=n,p=0;i<o;i++,p++)s[p]=t[i];r.push(String.fromCharCode.apply(null,s))}return r.join("")}function fr(t){let r=[],n="";for(let o=0;o<t.length;o++){let s=t[o],i=s>=128&&s<=159?et[s]:void 0;if(n+=i!==null&&i!==void 0?i:String.fromCharCode(s),n.length>=Y)r.push(n),n=""}if(n)r.push(n);return r.join("")}function hr(t){let r=[];for(let n=0;n<t.length;n++){let o=t.charCodeAt(n);if(o>=55296&&o<=56319)if(n+1<t.length){let s=t.charCodeAt(n+1);if(s>=56320&&s<=57343)o=65536+(o-55296<<10)+(s-56320),n++;else o=B}else o=B;else if(o>=56320&&o<=57343)o=B;if(o<128)r.push(o);else if(o<2048)r.push(192|o>>6,128|o&63);else if(o<65536)r.push(224|o>>12,128|o>>6&63,128|o&63);else r.push(240|o>>18,128|o>>12&63,128|o>>6&63,128|o&63)}return new Uint8Array(r)}function gr(t){let r=[];for(let o=0;o<t.length;o++){let s=t.charCodeAt(o);if(s>=55296&&s<=56319){if(o+1<t.length){let i=t.charCodeAt(o+1);if(i>=56320&&i<=57343)r.push(s,i),o++;else r.push(B)}else r.push(B);continue}if(s>=56320&&s<=57343){r.push(B);continue}r.push(s)}let n=new Uint8Array(r.length*2);for(let o=0;o<r.length;o++){let s=r[o],i=o*2;n[i]=s&255,n[i+1]=s>>>8}return n}function mr(t){let r=new Uint8Array(t.length);for(let n=0;n<t.length;n++)r[n]=t.charCodeAt(n)&127;return r}function xr(t){let r=new Uint8Array(t.length);for(let n=0;n<t.length;n++)r[n]=t.charCodeAt(n)&255;return r}function wr(t){let r=new Uint8Array(t.length);for(let n=0;n<t.length;n++){let o=t[n],s=o.charCodeAt(0);if(Me[o]!==void 0){r[n]=Me[o];continue}if(s>=0&&s<=127||s>=160&&s<=255){r[n]=s;continue}r[n]=63}return r}function g(t){return new DataView(t.buffer,t.byteOffset)}var f={len:1,get(t,r){return g(t).getUint8(r)},put(t,r,n){return g(t).setUint8(r,n),r+1}},y={len:2,get(t,r){return g(t).getUint16(r,!0)},put(t,r,n){return g(t).setUint16(r,n,!0),r+2}},D={len:2,get(t,r){return g(t).getUint16(r)},put(t,r,n){return g(t).setUint16(r,n),r+2}},Yo={len:3,get(t,r){let n=g(t);return n.getUint8(r)+(n.getUint16(r+1,!0)<<8)},put(t,r,n){let o=g(t);return o.setUint8(r,n&255),o.setUint16(r+1,n>>8,!0),r+3}},le={len:3,get(t,r){let n=g(t);return(n.getUint16(r)<<8)+n.getUint8(r+2)},put(t,r,n){let o=g(t);return o.setUint16(r,n>>8),o.setUint8(r+2,n&255),r+3}},c={len:4,get(t,r){return g(t).getUint32(r,!0)},put(t,r,n){return g(t).setUint32(r,n,!0),r+4}},l={len:4,get(t,r){return g(t).getUint32(r)},put(t,r,n){return g(t).setUint32(r,n),r+4}},kt={len:1,get(t,r){return g(t).getInt8(r)},put(t,r,n){return g(t).setInt8(r,n),r+1}},At={len:2,get(t,r){return g(t).getInt16(r)},put(t,r,n){return g(t).setInt16(r,n),r+2}},yr={len:2,get(t,r){return g(t).getInt16(r,!0)},put(t,r,n){return g(t).setInt16(r,n,!0),r+2}},Tr={len:3,get(t,r){let n=Yo.get(t,r);return n>8388607?n-16777216:n},put(t,r,n){let o=g(t);return o.setUint8(r,n&255),o.setUint16(r+1,n>>8,!0),r+3}},_r={len:3,get(t,r){let n=le.get(t,r);return n>8388607?n-16777216:n},put(t,r,n){let o=g(t);return o.setUint16(r,n>>8),o.setUint8(r+2,n&255),r+3}},ke={len:4,get(t,r){return g(t).getInt32(r)},put(t,r,n){return g(t).setInt32(r,n),r+4}},ie={len:4,get(t,r){return g(t).getInt32(r,!0)},put(t,r,n){return g(t).setInt32(r,n,!0),r+4}},se={len:8,get(t,r){return g(t).getBigUint64(r,!0)},put(t,r,n){return g(t).setBigUint64(r,n,!0),r+8}},Oi={len:8,get(t,r){return g(t).getBigInt64(r,!0)},put(t,r,n){return g(t).setBigInt64(r,n,!0),r+8}},yt={len:8,get(t,r){return g(t).getBigUint64(r)},put(t,r,n){return g(t).setBigUint64(r,n),r+8}},Ni={len:8,get(t,r){return g(t).getBigInt64(r)},put(t,r,n){return g(t).setBigInt64(r,n),r+8}},Cr={len:2,get(t,r){return Q(t,r,!1,10,this.len)},put(t,r,n){return X(t,n,r,!1,10,this.len),r+this.len}},br={len:2,get(t,r){return Q(t,r,!0,10,this.len)},put(t,r,n){return X(t,n,r,!0,10,this.len),r+this.len}},Mi={len:4,get(t,r){return g(t).getFloat32(r)},put(t,r,n){return g(t).setFloat32(r,n),r+4}},Er={len:4,get(t,r){return g(t).getFloat32(r,!0)},put(t,r,n){return g(t).setFloat32(r,n,!0),r+4}},kr={len:8,get(t,r){return g(t).getFloat64(r)},put(t,r,n){return g(t).setFloat64(r,n),r+8}},Br={len:8,get(t,r){return g(t).getFloat64(r,!0)},put(t,r,n){return g(t).setFloat64(r,n,!0),r+8}},Ir={len:10,get(t,r){return Q(t,r,!1,63,this.len)},put(t,r,n){return X(t,n,r,!1,63,this.len),r+this.len}},Ur={len:10,get(t,r){return Q(t,r,!0,63,this.len)},put(t,r,n){return X(t,n,r,!0,63,this.len),r+this.len}};class rt{constructor(t){this.len=t}get(t,r){}}class P{constructor(t){this.len=t}get(t,r){return t.subarray(r,r+this.len)}}class d{constructor(t,r){this.len=t,this.encoding=r}get(t,r=0){let n=t.subarray(r,r+this.len);return te(n,this.encoding)}}class nt extends d{constructor(t){super(t,"windows-1252")}}var Ar=Object.prototype.toString;function Sr(t,r,n){if(!t)return!1;if(t.constructor===r)return!0;return Ar.call(t)===n}function Rr(t){return Sr(t,Uint8Array,"[object Uint8Array]")}function zr(t){if(!Rr(t))throw TypeError(`Expected \`Uint8Array\`, got \`${typeof t}\``)}var Xn={utf8:new globalThis.TextDecoder("utf8")};var Yn=new globalThis.TextEncoder;var Dr=Array.from({length:256},(t,r)=>r.toString(16).padStart(2,"0"));function jo(t){zr(t);let r="";for(let n=0;n<t.length;n++)r+=Dr[t[n]];return r}function Jo(t){let{byteLength:r}=t;if(r===6)return t.getUint16(0)*4294967296+t.getUint32(2);if(r===5)return t.getUint8(0)*4294967296+t.getUint32(1);if(r===4)return t.getUint32(0);if(r===3)return t.getUint8(0)*65536+t.getUint16(1);if(r===2)return t.getUint16(0);if(r===1)return t.getUint8(0)}var Na={10:"shot",20:"scene",30:"track",40:"part",50:"album",60:"edition",70:"collection"},fe={video:1,audio:2,complex:3,logo:4,subtitle:17,button:18,control:32},Ti={[fe.video]:"video",[fe.audio]:"audio",[fe.complex]:"complex",[fe.logo]:"logo",[fe.subtitle]:"subtitle",[fe.button]:"button",[fe.control]:"control"};var oe=(t)=>class extends Error{constructor(n){super(n);this.name=t}};class bn extends oe("CouldNotDetermineFileTypeError"){}class On extends oe("UnsupportedFileTypeError"){}class ot extends oe("UnexpectedFileContentError"){constructor(t,r){super(r);this.fileType=t}toString(){return`${this.name} (FileType: ${this.fileType}): ${this.message}`}}class vt extends oe("FieldDecodingError"){}class qo extends oe("InternalParserError"){}var R=(t)=>class extends ot{constructor(r){super(t,r)}};function O(t,r,n){return(t[r]&1<<n)!==0}function Lt(t,r){let n=t.length;if(r==="utf-16le"||r==="utf-16be"){for(let o=0;o+1<n;o+=2)if(t[o]===0&&t[o+1]===0)return o;return n}for(let o=0;o<n;o++)if(t[o]===0)return o;return n}function vr(t){let r=t.indexOf("\x00");return r===-1?t:t.substring(0,r)}function st(t){let r=t.length;if((r&1)!==0)throw new vt("Buffer length must be even");for(let n=0;n<r;n+=2){let o=t[n];t[n]=t[n+1],t[n+1]=o}return t}function Be(t,r){if(t[0]===255&&t[1]===254)return Be(t.subarray(2),r);if(r==="utf-16le"&&t[0]===254&&t[1]===255){if((t.length&1)!==0)throw new vt("Expected even number of octets for 16-bit unicode string");return Be(st(t),r)}if(r==="utf-16be"){if((t.length&1)!==0)throw new vt("Expected even number of octets for 16-bit unicode string");return new d(t.length,"utf-16le").get(st(Uint8Array.from(t)),0)}return new d(t.length,r).get(t,0)}function je(t){return t=t.replace(/^\x00+/g,""),t=t.replace(/\x00+$/g,""),t}function k(t,r,n,o){let s=r+~~(n/8),i=n%8,p=t[s];p&=255>>i;let C=8-i,b=o-C;if(b<0)p>>=8-i-o;else if(b>0)p<<=b,p|=k(t,r,n+C,b);return p}function Te(t,r,n){return k(t,r,n,1)===1}function it(t){let r=[];for(let n=0,o=t.length;n<o;n++){let s=Number(t.charCodeAt(n)).toString(16);r.push(s.length===1?`0${s}`:s)}return r.join(" ")}function Nr(t){return 10*Math.log10(t)}function Or(t){return 10**(t/10)}function Ma(t){let r=t.split(" ").map((n)=>n.trim().toLowerCase());if(r.length>=1){let n=Number.parseFloat(r[0]);return r.length===2&&r[1]==="db"?{dB:n,ratio:Or(n)}:{dB:Nr(n),ratio:n}}}function Ri(t){if(t.length===0)throw Error("decodeUintBE: empty Uint8Array");let r=new DataView(t.buffer,t.byteOffset,t.byteLength);return Jo(r)}var hA={0:"Other",1:"32x32 pixels 'file icon' (PNG only)",2:"Other file icon",3:"Cover (front)",4:"Cover (back)",5:"Leaflet page",6:"Media (e.g. label side of CD)",7:"Lead artist/lead performer/soloist",8:"Artist/performer",9:"Conductor",10:"Band/Orchestra",11:"Composer",12:"Lyricist/text writer",13:"Recording Location",14:"During recording",15:"During performance",16:"Movie/video screen capture",17:"A bright coloured fish",18:"Illustration",19:"Band/artist logotype",20:"Publisher/Studio logotype"},Lr={other:0,lyrics:1,text:2,movement_part:3,events:4,chord:5,trivia_pop:6},Pr={notSynchronized:0,mpegFrameNumber:1,milliseconds:2},_i={get:(t,r)=>t[r+3]&127|t[r+2]<<7|t[r+1]<<14|t[r]<<21,len:4},nA={len:10,get:(t,r)=>({fileIdentifier:new d(3,"ascii").get(t,r),version:{major:kt.get(t,r+3),revision:kt.get(t,r+4)},flags:{unsynchronisation:O(t,r+5,7),isExtendedHeader:O(t,r+5,6),expIndicator:O(t,r+5,5),footer:O(t,r+5,4)},size:_i.get(t,r+6)})},ki={len:10,get:(t,r)=>({size:l.get(t,r),extendedFlags:D.get(t,r+4),sizeOfPadding:l.get(t,r+6),crcDataPresent:O(t,r+4,31)})},Nn={len:1,get:(t,r)=>{switch(t[r]){case 0:return{encoding:"latin1"};case 1:return{encoding:"utf-16le",bom:!0};case 2:return{encoding:"utf-16be",bom:!1};case 3:return{encoding:"utf8",bom:!1};default:return{encoding:"utf8",bom:!1}}}},Gr={len:4,get:(t,r)=>({encoding:Nn.get(t,r),language:new d(3,"latin1").get(t,r+1)})},vi={len:6,get:(t,r)=>{let n=Gr.get(t,r);return{encoding:n.encoding,language:n.language,timeStampFormat:f.get(t,r+4),contentType:f.get(t,r+5)}}};var dt=u(T(),1);class F{constructor(t,r,n){this.metadata=t,this.tokenizer=r,this.options=n}}var Mr=/^[\x21-\x7e©][\x20-\x7e\x00()]{3}/,M={len:4,get:(t,r)=>{let n=te(t.subarray(r,r+M.len),"latin1");if(!n.match(Mr))throw new vt(`FourCC contains invalid characters: ${it(n)} "${n}"`);return n},put:(t,r,n)=>{let o=tt(n,"latin1");if(o.length!==4)throw new qo("Invalid length");return t.set(o,r),r+4}};var ae={text_utf8:0,binary:1,external_info:2,reserved:3},$e={len:52,get:(t,r)=>({ID:M.get(t,r),version:c.get(t,r+4)/1000,descriptorBytes:c.get(t,r+8),headerBytes:c.get(t,r+12),seekTableBytes:c.get(t,r+16),headerDataBytes:c.get(t,r+20),apeFrameDataBytes:c.get(t,r+24),apeFrameDataBytesHigh:c.get(t,r+28),terminatingDataBytes:c.get(t,r+32),fileMD5:new P(16).get(t,r+36)})},at={len:24,get:(t,r)=>({compressionLevel:y.get(t,r),formatFlags:y.get(t,r+2),blocksPerFrame:c.get(t,r+4),finalFrameBlocks:c.get(t,r+8),totalFrames:c.get(t,r+12),bitsPerSample:y.get(t,r+16),channel:y.get(t,r+18),sampleRate:c.get(t,r+20)})},S={len:32,get:(t,r)=>({ID:new d(8,"ascii").get(t,r),version:c.get(t,r+8),size:c.get(t,r+12),fields:c.get(t,r+16),flags:ct(c.get(t,r+20))})},Ee={len:8,get:(t,r)=>({size:c.get(t,r),flags:ct(c.get(t,r+4))})};function ct(t){return{containsHeader:be(t,31),containsFooter:be(t,30),isHeader:be(t,29),readOnly:be(t,0),dataType:(t&6)>>1}}function be(t,r){return(t&1<<r)!==0}var L=dt.default("music-metadata:parser:APEv2"),lt="APEv2",ut="APETAGEX";class Fe extends R("APEv2"){}function BA(t,r,n){return new Pt(t,r,n).tryParseApeHeader()}class Pt extends F{constructor(){super(...arguments);this.ape={}}static calculateDuration(t){let r=t.totalFrames>1?t.blocksPerFrame*(t.totalFrames-1):0;return r+=t.finalFrameBlocks,r/t.sampleRate}static async findApeFooterOffset(t,r){let n=new Uint8Array(S.len),o=t.position;if(r<=S.len){L(`Offset is too small to read APE footer: offset=${r}`);return}if(r>S.len){await t.readBuffer(n,{position:r-S.len}),t.setPosition(o);let s=S.get(n,0);if(s.ID==="APETAGEX"){if(s.flags.isHeader)L(`APE Header found at offset=${r-S.len}`);else L(`APE Footer found at offset=${r-S.len}`),r-=s.size;return{footer:s,offset:r}}}}static parseTagFooter(t,r,n){let o=S.get(r,r.length-S.len);if(o.ID!==ut)throw new Fe("Unexpected APEv2 Footer ID preamble value");return _e(r),new Pt(t,_e(r),n).parseTags(o)}async tryParseApeHeader(){if(this.tokenizer.fileInfo.size&&this.tokenizer.fileInfo.size-this.tokenizer.position<S.len){L("No APEv2 header found, end-of-file reached");return}let t=await this.tokenizer.peekToken(S);if(t.ID===ut)return await this.tokenizer.ignore(S.len),this.parseTags(t);if(L(`APEv2 header not found at offset=${this.tokenizer.position}`),this.tokenizer.fileInfo.size){let r=this.tokenizer.fileInfo.size-this.tokenizer.position,n=new Uint8Array(r);return await this.tokenizer.readBuffer(n),Pt.parseTagFooter(this.metadata,n,this.options)}}async parse(){let t=await this.tokenizer.readToken($e);if(t.ID!=="MAC ")throw new Fe("Unexpected descriptor ID");this.ape.descriptor=t;let r=t.descriptorBytes-$e.len,n=await(r>0?this.parseDescriptorExpansion(r):this.parseHeader());return this.metadata.setAudioOnly(),await this.tokenizer.ignore(n.forwardBytes),this.tryParseApeHeader()}async parseTags(t){let r=new Uint8Array(256),n=t.size-S.len;L(`Parse APE tags at offset=${this.tokenizer.position}, size=${n}`);for(let o=0;o<t.fields;o++){if(n<Ee.len){this.metadata.addWarning(`APEv2 Tag-header: ${t.fields-o} items remaining, but no more tag data to read.`);break}let s=await this.tokenizer.readToken(Ee);n-=Ee.len+s.size,await this.tokenizer.peekBuffer(r,{length:Math.min(r.length,n)});let i=Lt(r),p=await this.tokenizer.readToken(new d(i,"ascii"));switch(await this.tokenizer.ignore(1),n-=p.length+1,s.flags.dataType){case ae.text_utf8:{let b=(await this.tokenizer.readToken(new d(s.size,"utf8"))).split(/\x00/g);await Promise.all(b.map((A)=>this.metadata.addTag(lt,p,A)));break}case ae.binary:if(this.options.skipCovers)await this.tokenizer.ignore(s.size);else{let C=new Uint8Array(s.size);await this.tokenizer.readBuffer(C),i=Lt(C);let b=te(C.subarray(0,i),"utf-8"),A=C.subarray(i+1);await this.metadata.addTag(lt,p,{description:b,data:A})}break;case ae.external_info:L(`Ignore external info ${p}`),await this.tokenizer.ignore(s.size);break;case ae.reserved:L(`Ignore external info ${p}`),this.metadata.addWarning(`APEv2 header declares a reserved datatype for "${p}"`),await this.tokenizer.ignore(s.size);break}}}async parseDescriptorExpansion(t){return await this.tokenizer.ignore(t),this.parseHeader()}async parseHeader(){let t=await this.tokenizer.readToken(at);if(this.metadata.setFormat("lossless",!0),this.metadata.setFormat("container","Monkey's Audio"),this.metadata.setFormat("bitsPerSample",t.bitsPerSample),this.metadata.setFormat("sampleRate",t.sampleRate),this.metadata.setFormat("numberOfChannels",t.channel),this.metadata.setFormat("duration",Pt.calculateDuration(t)),!this.ape.descriptor)throw new Fe("Missing APE descriptor");return{forwardBytes:this.ape.descriptor.seekTableBytes+this.ape.descriptor.headerDataBytes+this.ape.descriptor.apeFrameDataBytes+this.ape.descriptor.terminatingDataBytes}}}var pt=u(T(),1);var Ie=pt.default("music-metadata:parser:ID3v1"),WA=["Blues","Classic Rock","Country","Dance","Disco","Funk","Grunge","Hip-Hop","Jazz","Metal","New Age","Oldies","Other","Pop","R&B","Rap","Reggae","Rock","Techno","Industrial","Alternative","Ska","Death Metal","Pranks","Soundtrack","Euro-Techno","Ambient","Trip-Hop","Vocal","Jazz+Funk","Fusion","Trance","Classical","Instrumental","Acid","House","Game","Sound Clip","Gospel","Noise","Alt. Rock","Bass","Soul","Punk","Space","Meditative","Instrumental Pop","Instrumental Rock","Ethnic","Gothic","Darkwave","Techno-Industrial","Electronic","Pop-Folk","Eurodance","Dream","Southern Rock","Comedy","Cult","Gangsta Rap","Top 40","Christian Rap","Pop/Funk","Jungle","Native American","Cabaret","New Wave","Psychedelic","Rave","Showtunes","Trailer","Lo-Fi","Tribal","Acid Punk","Acid Jazz","Polka","Retro","Musical","Rock & Roll","Hard Rock","Folk","Folk/Rock","National Folk","Swing","Fast-Fusion","Bebob","Latin","Revival","Celtic","Bluegrass","Avantgarde","Gothic Rock","Progressive Rock","Psychedelic Rock","Symphonic Rock","Slow Rock","Big Band","Chorus","Easy Listening","Acoustic","Humour","Speech","Chanson","Opera","Chamber Music","Sonata","Symphony","Booty Bass","Primus","Porn Groove","Satire","Slow Jam","Club","Tango","Samba","Folklore","Ballad","Power Ballad","Rhythmic Soul","Freestyle","Duet","Punk Rock","Drum Solo","A Cappella","Euro-House","Dance Hall","Goa","Drum & Bass","Club-House","Hardcore","Terror","Indie","BritPop","Negerpunk","Polsk Punk","Beat","Christian Gangsta Rap","Heavy Metal","Black Metal","Crossover","Contemporary Christian","Christian Rock","Merengue","Salsa","Thrash Metal","Anime","JPop","Synthpop","Abstract","Art Rock","Baroque","Bhangra","Big Beat","Breakbeat","Chillout","Downtempo","Dub","EBM","Eclectic","Electro","Electroclash","Emo","Experimental","Garage","Global","IDM","Illbient","Industro-Goth","Jam Band","Krautrock","Leftfield","Lounge","Math Rock","New Romantic","Nu-Breakz","Post-Punk","Post-Rock","Psytrance","Shoegaze","Space Rock","Trop Rock","World Music","Neoclassical","Audiobook","Audio Theatre","Neue Deutsche Welle","Podcast","Indie Rock","G-Funk","Dubstep","Garage Rock","Psybient"],Ue={len:128,get:(t,r)=>{let n=new q(3).get(t,r);return n==="TAG"?{header:n,title:new q(30).get(t,r+3),artist:new q(30).get(t,r+33),album:new q(30).get(t,r+63),year:new q(4).get(t,r+93),comment:new q(28).get(t,r+97),zeroByte:f.get(t,r+127),track:f.get(t,r+126),genre:f.get(t,r+127)}:null}};class q{constructor(t){this.len=t,this.stringType=new d(t,"latin1")}get(t,r){let n=this.stringType.get(t,r);return n=vr(n),n=n.trim(),n.length>0?n:void 0}}class Fr extends F{constructor(t,r,n){super(t,r,n);this.apeHeader=n.apeHeader}static getGenre(t){if(t<WA.length)return WA[t];return}async parse(){if(!this.tokenizer.fileInfo.size){Ie("Skip checking for ID3v1 because the file-size is unknown");return}if(this.apeHeader&&this.tokenizer.supportsRandomAccess())this.tokenizer.setPosition(this.apeHeader.offset),await new Pt(this.metadata,this.tokenizer,this.options).parseTags(this.apeHeader.footer);let t=this.tokenizer.fileInfo.size-Ue.len;if(this.tokenizer.position>t){Ie("Already consumed the last 128 bytes");return}let r=await this.tokenizer.readToken(Ue,t);if(r){Ie("ID3v1 header found at: pos=%s",this.tokenizer.fileInfo.size-Ue.len);let n=["title","artist","album","comment","track","year"];for(let s of n)if(r[s]&&r[s]!=="")await this.addTag(s,r[s]);let o=Fr.getGenre(r.genre);if(o)await this.addTag("genre",o)}else Ie("ID3v1 header not found at: pos=%s",this.tokenizer.fileInfo.size-Ue.len)}async addTag(t,r){await this.metadata.addTag("ID3v1",t,r)}}async function Ta(t){if(t.fileInfo.size>=128){let r=new Uint8Array(3),n=t.position;return await t.readBuffer(r,{position:t.fileInfo.size-128}),t.setPosition(n),te(r,"latin1")==="TAG"}return!1}
7
+ export{m,wi,_e,Di,bi,Oa,T,te,f,y,D,Yo,le,c,l,kt,At,_r,ke,ie,se,Oi,yt,Ni,Mi,kr,P,d,Dn,jo,Jo,Na,fe,Ti,bn,On,vt,qo,R,O,Lt,vr,Be,je,k,Te,Ma,Ri,hA,Lr,Pr,_i,nA,ki,Nn,Gr,vi,F,M,BA,Pt,WA,Fr,Ta};
8
+
9
+ //# debugId=B5E851EB0376F37964756E2164756E21
10
+ //# sourceMappingURL=index-5gn74n56.js.map