@wirekyt/dom 0.0.1 → 0.0.2

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 (476) hide show
  1. package/dist/anatomy-DMuSMbOP.d.cts +18 -0
  2. package/dist/anatomy-DMuSMbOP.d.ts +18 -0
  3. package/dist/anatomy.cjs +3 -0
  4. package/dist/anatomy.d.cts +2 -0
  5. package/dist/anatomy.d.ts +2 -0
  6. package/dist/anatomy.js +2 -0
  7. package/dist/angle-3hqP0Mp5.cjs +13 -0
  8. package/dist/angle-oNt8uGHQ.js +8 -0
  9. package/dist/aria-hidden-CEXexb2I.js +127 -0
  10. package/dist/aria-hidden-Y7iJHPMr.cjs +132 -0
  11. package/dist/aria-hidden.cjs +3 -0
  12. package/dist/aria-hidden.d.cts +10 -0
  13. package/dist/aria-hidden.d.ts +10 -0
  14. package/dist/aria-hidden.js +2 -0
  15. package/dist/array-BGtygd0o.cjs +198 -0
  16. package/dist/array-C4KbHsha.js +73 -0
  17. package/dist/auto-resize-5F5iiKZb.cjs +106 -0
  18. package/dist/auto-resize-KkNfCcBt.js +95 -0
  19. package/dist/auto-resize.cjs +4 -0
  20. package/dist/auto-resize.d.cts +7 -0
  21. package/dist/auto-resize.d.ts +7 -0
  22. package/dist/auto-resize.js +2 -0
  23. package/dist/caret-CHqaP4XG.cjs +30 -0
  24. package/dist/caret-aiDJ6mAS.js +19 -0
  25. package/dist/closest-Clo6ODcK.js +117 -0
  26. package/dist/closest-IiRz1GIJ.cjs +176 -0
  27. package/dist/collection-CJU0oDtX.js +1295 -0
  28. package/dist/collection-CwzUJwBJ.cjs +1342 -0
  29. package/dist/collection.cjs +15 -0
  30. package/dist/collection.d.cts +34 -0
  31. package/dist/collection.d.ts +34 -0
  32. package/dist/collection.js +3 -0
  33. package/dist/color-CsugZjq6.d.cts +60 -0
  34. package/dist/color-CsugZjq6.d.ts +60 -0
  35. package/dist/color-utils-DzeOVYlL.cjs +662 -0
  36. package/dist/color-utils-lDDg9FEh.js +639 -0
  37. package/dist/color-utils.cjs +6 -0
  38. package/dist/color-utils.d.cts +18 -0
  39. package/dist/color-utils.d.ts +18 -0
  40. package/dist/color-utils.js +2 -0
  41. package/dist/computed-style-B1MKlCoo.js +9 -0
  42. package/dist/computed-style-DLArEFNw.cjs +14 -0
  43. package/dist/controller-B8E8ZJCI.cjs +133 -0
  44. package/dist/controller-Dv7lWHDr.js +92 -0
  45. package/dist/core-BF6G2RiC.d.cts +1 -0
  46. package/dist/core-BNMw-JId.cjs +372 -0
  47. package/dist/core-BdeZuSX6.d.ts +1 -0
  48. package/dist/core-CJ0MZr3D.js +289 -0
  49. package/dist/core.cjs +19 -0
  50. package/dist/core.d.cts +3 -0
  51. package/dist/core.d.ts +3 -0
  52. package/dist/core.js +3 -0
  53. package/dist/create-anatomy-B2q3wiaw.js +22 -0
  54. package/dist/create-anatomy-BwDn25ph.cjs +27 -0
  55. package/dist/create-props-CgtcN_Qu.js +4 -0
  56. package/dist/create-props-CjLx2oS8.cjs +9 -0
  57. package/dist/data-url-C-Uk31Q9.cjs +42 -0
  58. package/dist/data-url-DHUHj7UF.js +37 -0
  59. package/dist/data-url-Gx_SWG-k.d.cts +10 -0
  60. package/dist/data-url-Gx_SWG-k.d.ts +10 -0
  61. package/dist/date-utils-D-JJHedx.cjs +868 -0
  62. package/dist/date-utils-D5zXW-Cs.js +569 -0
  63. package/dist/date-utils.cjs +52 -0
  64. package/dist/date-utils.d.cts +7 -0
  65. package/dist/date-utils.d.ts +7 -0
  66. package/dist/date-utils.js +2 -0
  67. package/dist/dismissable-C0bixtzl.cjs +348 -0
  68. package/dist/dismissable-KM1jPtNQ.js +337 -0
  69. package/dist/dismissable-layer-BTX5EvXw.d.ts +40 -0
  70. package/dist/dismissable-layer-Ch5niVaq.d.cts +40 -0
  71. package/dist/dismissable.cjs +4 -0
  72. package/dist/dismissable.d.cts +3 -0
  73. package/dist/dismissable.d.ts +3 -0
  74. package/dist/dismissable.js +2 -0
  75. package/dist/dom-query-CQzY93XU.cjs +488 -0
  76. package/dist/dom-query-e7fh0TEH.js +243 -0
  77. package/dist/dom-query.cjs +180 -0
  78. package/dist/dom-query.d.cts +142 -0
  79. package/dist/dom-query.d.ts +142 -0
  80. package/dist/dom-query.js +43 -0
  81. package/dist/equal-C927y7MN.cjs +30 -0
  82. package/dist/equal-DtrP8DPh.js +25 -0
  83. package/dist/event-DDz-mMhM.cjs +242 -0
  84. package/dist/event-bTItRgiw.js +117 -0
  85. package/dist/file-utils-6EXCdfHx.js +116 -0
  86. package/dist/file-utils-B7OJigQq.cjs +151 -0
  87. package/dist/file-utils.cjs +92 -0
  88. package/dist/file-utils.d.cts +40 -0
  89. package/dist/file-utils.d.ts +40 -0
  90. package/dist/file-utils.js +82 -0
  91. package/dist/focus-trap-89E5I9nm.js +487 -0
  92. package/dist/focus-trap-D7jKsfHW.cjs +498 -0
  93. package/dist/focus-trap.cjs +4 -0
  94. package/dist/focus-trap.d.cts +89 -0
  95. package/dist/focus-trap.d.ts +89 -0
  96. package/dist/focus-trap.js +2 -0
  97. package/dist/focus-visible-DWdQf__4.js +176 -0
  98. package/dist/focus-visible-G4cmlWqq.cjs +217 -0
  99. package/dist/focus-visible.cjs +9 -0
  100. package/dist/focus-visible.d.cts +32 -0
  101. package/dist/focus-visible.d.ts +32 -0
  102. package/dist/focus-visible.js +2 -0
  103. package/dist/form-B1DW_w_3.js +89 -0
  104. package/dist/form-CoupKpuP.cjs +130 -0
  105. package/dist/from-window-5ZhzSURC.js +68 -0
  106. package/dist/from-window-B9DKtaoR.cjs +115 -0
  107. package/dist/functions-isw5Ovcx.d.cts +16 -0
  108. package/dist/functions-isw5Ovcx.d.ts +16 -0
  109. package/dist/highlight-word.cjs +95 -0
  110. package/dist/highlight-word.d.cts +24 -0
  111. package/dist/highlight-word.d.ts +24 -0
  112. package/dist/highlight-word.js +94 -0
  113. package/dist/hotkeys.cjs +1183 -0
  114. package/dist/hotkeys.d.cts +199 -0
  115. package/dist/hotkeys.d.ts +199 -0
  116. package/dist/hotkeys.js +1173 -0
  117. package/dist/i18n-utils-BD4VtonY.cjs +345 -0
  118. package/dist/i18n-utils-C4FQZ39m.js +280 -0
  119. package/dist/i18n-utils.cjs +216 -0
  120. package/dist/i18n-utils.d.cts +71 -0
  121. package/dist/i18n-utils.d.ts +71 -0
  122. package/dist/i18n-utils.js +204 -0
  123. package/dist/index-3tNJficI.d.cts +117 -0
  124. package/dist/index-3tNJficI.d.ts +117 -0
  125. package/dist/index-BEfvdGE2.d.cts +116 -0
  126. package/dist/index-BEfvdGE2.d.ts +116 -0
  127. package/dist/index-BF6G2RiC.d.cts +1 -0
  128. package/dist/index-BKgxIVbE.d.cts +285 -0
  129. package/dist/index-BMtpmaRD.d.cts +16 -0
  130. package/dist/index-BMtpmaRD.d.ts +16 -0
  131. package/dist/index-BWiYePx8.d.cts +216 -0
  132. package/dist/index-BXfunVyD.d.cts +1342 -0
  133. package/dist/index-BXfunVyD.d.ts +1342 -0
  134. package/dist/index-BdeZuSX6.d.ts +1 -0
  135. package/dist/index-C2865AJq.d.cts +25 -0
  136. package/dist/index-C2865AJq.d.ts +25 -0
  137. package/dist/index-CFoN0L3C.d.ts +285 -0
  138. package/dist/index-vPrqYDHu.d.ts +216 -0
  139. package/dist/index.cjs +19 -0
  140. package/dist/index.d.cts +3 -0
  141. package/dist/index.d.ts +3 -0
  142. package/dist/index.js +3 -0
  143. package/dist/initial-focus-BQxRRFPa.cjs +37 -0
  144. package/dist/initial-focus-BrN5tT2X.js +26 -0
  145. package/dist/interact-outside-BjqIunFx.js +211 -0
  146. package/dist/interact-outside-Dphjr2Zh.cjs +216 -0
  147. package/dist/interact-outside.cjs +3 -0
  148. package/dist/interact-outside.d.cts +2 -0
  149. package/dist/interact-outside.d.ts +2 -0
  150. package/dist/interact-outside.js +2 -0
  151. package/dist/json-tree-utils.cjs +1518 -0
  152. package/dist/json-tree-utils.d.cts +117 -0
  153. package/dist/json-tree-utils.d.ts +117 -0
  154. package/dist/json-tree-utils.js +1469 -0
  155. package/dist/list-collection-D_eNKrot.d.cts +60 -0
  156. package/dist/list-collection-RqYEWHb4.d.ts +60 -0
  157. package/dist/live-region-BD0OgmrH.cjs +68 -0
  158. package/dist/live-region-F8YMmbrY.js +63 -0
  159. package/dist/live-region.cjs +3 -0
  160. package/dist/live-region.d.cts +2 -0
  161. package/dist/live-region.d.ts +2 -0
  162. package/dist/live-region.js +2 -0
  163. package/dist/machines/accordion/index.cjs +328 -0
  164. package/dist/machines/accordion/index.d.cts +83 -0
  165. package/dist/machines/accordion/index.d.ts +83 -0
  166. package/dist/machines/accordion/index.js +321 -0
  167. package/dist/machines/angle-slider/index.cjs +420 -0
  168. package/dist/machines/angle-slider/index.d.cts +84 -0
  169. package/dist/machines/angle-slider/index.d.ts +84 -0
  170. package/dist/machines/angle-slider/index.js +415 -0
  171. package/dist/machines/async-list/index.cjs +310 -0
  172. package/dist/machines/async-list/index.d.cts +90 -0
  173. package/dist/machines/async-list/index.d.ts +90 -0
  174. package/dist/machines/async-list/index.js +308 -0
  175. package/dist/machines/avatar/index.cjs +165 -0
  176. package/dist/machines/avatar/index.d.cts +63 -0
  177. package/dist/machines/avatar/index.d.ts +63 -0
  178. package/dist/machines/avatar/index.js +160 -0
  179. package/dist/machines/carousel/index.cjs +929 -0
  180. package/dist/machines/carousel/index.d.cts +146 -0
  181. package/dist/machines/carousel/index.d.ts +146 -0
  182. package/dist/machines/carousel/index.js +920 -0
  183. package/dist/machines/cascade-select/index.cjs +1426 -0
  184. package/dist/machines/cascade-select/index.d.cts +167 -0
  185. package/dist/machines/cascade-select/index.d.ts +167 -0
  186. package/dist/machines/cascade-select/index.js +1419 -0
  187. package/dist/machines/checkbox/index.cjs +316 -0
  188. package/dist/machines/checkbox/index.d.cts +81 -0
  189. package/dist/machines/checkbox/index.d.ts +81 -0
  190. package/dist/machines/checkbox/index.js +311 -0
  191. package/dist/machines/clipboard/index.cjs +228 -0
  192. package/dist/machines/clipboard/index.d.cts +72 -0
  193. package/dist/machines/clipboard/index.d.ts +72 -0
  194. package/dist/machines/clipboard/index.js +221 -0
  195. package/dist/machines/collapsible/index.cjs +363 -0
  196. package/dist/machines/collapsible/index.d.cts +82 -0
  197. package/dist/machines/collapsible/index.d.ts +82 -0
  198. package/dist/machines/collapsible/index.js +358 -0
  199. package/dist/machines/color-picker/index.cjs +1534 -0
  200. package/dist/machines/color-picker/index.d.cts +207 -0
  201. package/dist/machines/color-picker/index.d.ts +207 -0
  202. package/dist/machines/color-picker/index.js +1518 -0
  203. package/dist/machines/combobox/index.cjs +1554 -0
  204. package/dist/machines/combobox/index.d.cts +219 -0
  205. package/dist/machines/combobox/index.d.ts +219 -0
  206. package/dist/machines/combobox/index.js +1542 -0
  207. package/dist/machines/date-input/index.cjs +1974 -0
  208. package/dist/machines/date-input/index.d.cts +230 -0
  209. package/dist/machines/date-input/index.d.ts +230 -0
  210. package/dist/machines/date-input/index.js +1958 -0
  211. package/dist/machines/date-picker/index.cjs +2424 -0
  212. package/dist/machines/date-picker/index.d.cts +378 -0
  213. package/dist/machines/date-picker/index.d.ts +378 -0
  214. package/dist/machines/date-picker/index.js +2408 -0
  215. package/dist/machines/dialog/index.cjs +378 -0
  216. package/dist/machines/dialog/index.d.cts +94 -0
  217. package/dist/machines/dialog/index.d.ts +94 -0
  218. package/dist/machines/dialog/index.js +373 -0
  219. package/dist/machines/drawer/index.cjs +2066 -0
  220. package/dist/machines/drawer/index.d.cts +334 -0
  221. package/dist/machines/drawer/index.d.ts +334 -0
  222. package/dist/machines/drawer/index.js +2059 -0
  223. package/dist/machines/editable/index.cjs +550 -0
  224. package/dist/machines/editable/index.d.cts +114 -0
  225. package/dist/machines/editable/index.d.ts +114 -0
  226. package/dist/machines/editable/index.js +545 -0
  227. package/dist/machines/file-upload/index.cjs +648 -0
  228. package/dist/machines/file-upload/index.d.cts +150 -0
  229. package/dist/machines/file-upload/index.d.ts +150 -0
  230. package/dist/machines/file-upload/index.js +641 -0
  231. package/dist/machines/floating-panel/index.cjs +1020 -0
  232. package/dist/machines/floating-panel/index.d.cts +149 -0
  233. package/dist/machines/floating-panel/index.d.ts +149 -0
  234. package/dist/machines/floating-panel/index.js +1012 -0
  235. package/dist/machines/hover-card/index.cjs +441 -0
  236. package/dist/machines/hover-card/index.d.cts +82 -0
  237. package/dist/machines/hover-card/index.d.ts +82 -0
  238. package/dist/machines/hover-card/index.js +436 -0
  239. package/dist/machines/image-cropper/index.cjs +2082 -0
  240. package/dist/machines/image-cropper/index.d.cts +182 -0
  241. package/dist/machines/image-cropper/index.d.ts +182 -0
  242. package/dist/machines/image-cropper/index.js +2076 -0
  243. package/dist/machines/listbox/index.cjs +873 -0
  244. package/dist/machines/listbox/index.d.cts +175 -0
  245. package/dist/machines/listbox/index.d.ts +175 -0
  246. package/dist/machines/listbox/index.js +860 -0
  247. package/dist/machines/marquee/index.cjs +387 -0
  248. package/dist/machines/marquee/index.d.cts +102 -0
  249. package/dist/machines/marquee/index.d.ts +102 -0
  250. package/dist/machines/marquee/index.js +382 -0
  251. package/dist/machines/menu/index.cjs +1562 -0
  252. package/dist/machines/menu/index.d.cts +188 -0
  253. package/dist/machines/menu/index.d.ts +188 -0
  254. package/dist/machines/menu/index.js +1549 -0
  255. package/dist/machines/navigation-menu/index.cjs +860 -0
  256. package/dist/machines/navigation-menu/index.d.cts +131 -0
  257. package/dist/machines/navigation-menu/index.d.ts +131 -0
  258. package/dist/machines/navigation-menu/index.js +855 -0
  259. package/dist/machines/number-input/index.cjs +1014 -0
  260. package/dist/machines/number-input/index.d.cts +136 -0
  261. package/dist/machines/number-input/index.d.ts +136 -0
  262. package/dist/machines/number-input/index.js +1009 -0
  263. package/dist/machines/pagination/index.cjs +413 -0
  264. package/dist/machines/pagination/index.d.cts +139 -0
  265. package/dist/machines/pagination/index.d.ts +139 -0
  266. package/dist/machines/pagination/index.js +404 -0
  267. package/dist/machines/password-input/index.cjs +224 -0
  268. package/dist/machines/password-input/index.d.cts +71 -0
  269. package/dist/machines/password-input/index.d.ts +71 -0
  270. package/dist/machines/password-input/index.js +219 -0
  271. package/dist/machines/pin-input/index.cjs +595 -0
  272. package/dist/machines/pin-input/index.d.cts +107 -0
  273. package/dist/machines/pin-input/index.d.ts +107 -0
  274. package/dist/machines/pin-input/index.js +590 -0
  275. package/dist/machines/popover/index.cjs +516 -0
  276. package/dist/machines/popover/index.d.cts +107 -0
  277. package/dist/machines/popover/index.d.ts +107 -0
  278. package/dist/machines/popover/index.js +511 -0
  279. package/dist/machines/presence/index.cjs +193 -0
  280. package/dist/machines/presence/index.d.cts +44 -0
  281. package/dist/machines/presence/index.d.ts +44 -0
  282. package/dist/machines/presence/index.js +190 -0
  283. package/dist/machines/progress/index.cjs +282 -0
  284. package/dist/machines/progress/index.d.cts +96 -0
  285. package/dist/machines/progress/index.d.ts +96 -0
  286. package/dist/machines/progress/index.js +277 -0
  287. package/dist/machines/qr-code/index.cjs +167 -0
  288. package/dist/machines/qr-code/index.d.cts +71 -0
  289. package/dist/machines/qr-code/index.d.ts +71 -0
  290. package/dist/machines/qr-code/index.js +162 -0
  291. package/dist/machines/radio-group/index.cjs +465 -0
  292. package/dist/machines/radio-group/index.d.cts +218 -0
  293. package/dist/machines/radio-group/index.d.ts +218 -0
  294. package/dist/machines/radio-group/index.js +458 -0
  295. package/dist/machines/rating-group/index.cjs +405 -0
  296. package/dist/machines/rating-group/index.d.cts +101 -0
  297. package/dist/machines/rating-group/index.d.ts +101 -0
  298. package/dist/machines/rating-group/index.js +398 -0
  299. package/dist/machines/scroll-area/index.cjs +865 -0
  300. package/dist/machines/scroll-area/index.d.cts +126 -0
  301. package/dist/machines/scroll-area/index.d.ts +126 -0
  302. package/dist/machines/scroll-area/index.js +860 -0
  303. package/dist/machines/select/index.cjs +1226 -0
  304. package/dist/machines/select/index.d.cts +190 -0
  305. package/dist/machines/select/index.d.ts +190 -0
  306. package/dist/machines/select/index.js +1214 -0
  307. package/dist/machines/signature-pad/index.cjs +337 -0
  308. package/dist/machines/signature-pad/index.d.cts +108 -0
  309. package/dist/machines/signature-pad/index.d.ts +108 -0
  310. package/dist/machines/signature-pad/index.js +330 -0
  311. package/dist/machines/slider/index.cjs +1103 -0
  312. package/dist/machines/slider/index.d.cts +154 -0
  313. package/dist/machines/slider/index.d.ts +154 -0
  314. package/dist/machines/slider/index.js +1094 -0
  315. package/dist/machines/splitter/index.cjs +1686 -0
  316. package/dist/machines/splitter/index.d.cts +282 -0
  317. package/dist/machines/splitter/index.d.ts +282 -0
  318. package/dist/machines/splitter/index.js +1675 -0
  319. package/dist/machines/steps/index.cjs +330 -0
  320. package/dist/machines/steps/index.d.cts +109 -0
  321. package/dist/machines/steps/index.d.ts +109 -0
  322. package/dist/machines/steps/index.js +325 -0
  323. package/dist/machines/switch/index.cjs +307 -0
  324. package/dist/machines/switch/index.d.cts +80 -0
  325. package/dist/machines/switch/index.d.ts +80 -0
  326. package/dist/machines/switch/index.js +302 -0
  327. package/dist/machines/tabs/index.cjs +542 -0
  328. package/dist/machines/tabs/index.d.cts +113 -0
  329. package/dist/machines/tabs/index.d.ts +113 -0
  330. package/dist/machines/tabs/index.js +533 -0
  331. package/dist/machines/tags-input/index.cjs +1151 -0
  332. package/dist/machines/tags-input/index.d.cts +182 -0
  333. package/dist/machines/tags-input/index.d.ts +182 -0
  334. package/dist/machines/tags-input/index.js +1144 -0
  335. package/dist/machines/timer/index.cjs +329 -0
  336. package/dist/machines/timer/index.d.cts +102 -0
  337. package/dist/machines/timer/index.d.ts +102 -0
  338. package/dist/machines/timer/index.js +323 -0
  339. package/dist/machines/toast/index.cjs +1185 -0
  340. package/dist/machines/toast/index.d.cts +204 -0
  341. package/dist/machines/toast/index.d.ts +204 -0
  342. package/dist/machines/toast/index.js +1180 -0
  343. package/dist/machines/toc/index.cjs +358 -0
  344. package/dist/machines/toc/index.d.cts +98 -0
  345. package/dist/machines/toc/index.d.ts +98 -0
  346. package/dist/machines/toc/index.js +351 -0
  347. package/dist/machines/toggle/index.cjs +99 -0
  348. package/dist/machines/toggle/index.d.cts +46 -0
  349. package/dist/machines/toggle/index.d.ts +46 -0
  350. package/dist/machines/toggle/index.js +94 -0
  351. package/dist/machines/toggle-group/index.cjs +329 -0
  352. package/dist/machines/toggle-group/index.d.cts +81 -0
  353. package/dist/machines/toggle-group/index.d.ts +81 -0
  354. package/dist/machines/toggle-group/index.js +322 -0
  355. package/dist/machines/tooltip/index.cjs +638 -0
  356. package/dist/machines/tooltip/index.d.cts +84 -0
  357. package/dist/machines/tooltip/index.d.ts +84 -0
  358. package/dist/machines/tooltip/index.js +633 -0
  359. package/dist/machines/tour/index.cjs +1123 -0
  360. package/dist/machines/tour/index.d.cts +207 -0
  361. package/dist/machines/tour/index.d.ts +207 -0
  362. package/dist/machines/tour/index.js +1115 -0
  363. package/dist/machines/tree-view/index.cjs +1288 -0
  364. package/dist/machines/tree-view/index.d.cts +221 -0
  365. package/dist/machines/tree-view/index.d.ts +221 -0
  366. package/dist/machines/tree-view/index.js +1279 -0
  367. package/dist/mutation-observer-_LbwtN3W.cjs +61 -0
  368. package/dist/mutation-observer-qObPUo3D.js +50 -0
  369. package/dist/navigate-CJOaL3vx.js +31 -0
  370. package/dist/navigate-uJG-006f.cjs +42 -0
  371. package/dist/overflow-BBihfMxX.cjs +67 -0
  372. package/dist/overflow-C-zO1CWA.js +44 -0
  373. package/dist/platform-BDB0wXUk.js +26 -0
  374. package/dist/platform-BZS-dkZN.cjs +109 -0
  375. package/dist/point-C9A4dk1i.js +27 -0
  376. package/dist/point-DxnCrJBy.cjs +32 -0
  377. package/dist/pointer-lock-BvfSjt_s.cjs +31 -0
  378. package/dist/pointer-lock-WezxTqu-.js +26 -0
  379. package/dist/pointer-move-CGzan38r.cjs +42 -0
  380. package/dist/pointer-move-Tijb8Ptk.js +37 -0
  381. package/dist/polygon-BvdwYRBw.js +76 -0
  382. package/dist/polygon-CTR1kEoU.cjs +93 -0
  383. package/dist/popper-DkAAS9VE.cjs +487 -0
  384. package/dist/popper-DzBZzAe4.js +464 -0
  385. package/dist/popper.cjs +6 -0
  386. package/dist/popper.d.cts +2 -0
  387. package/dist/popper.d.ts +2 -0
  388. package/dist/popper.js +2 -0
  389. package/dist/press-B7XLrLGR.js +65 -0
  390. package/dist/press-BdD5suLQ.cjs +70 -0
  391. package/dist/proxy-tab-focus-DWMXvAfO.js +54 -0
  392. package/dist/proxy-tab-focus-NthYgHdY.cjs +59 -0
  393. package/dist/raf-BSDcY4UD.cjs +85 -0
  394. package/dist/raf-DgINgykK.d.cts +15 -0
  395. package/dist/raf-DgINgykK.d.ts +15 -0
  396. package/dist/raf-Dhvm7f1e.js +62 -0
  397. package/dist/rect-utils-DiT4k3jS.cjs +548 -0
  398. package/dist/rect-utils-d_3gZVsc.js +459 -0
  399. package/dist/rect-utils.cjs +165 -0
  400. package/dist/rect-utils.d.cts +197 -0
  401. package/dist/rect-utils.d.ts +197 -0
  402. package/dist/rect-utils.js +116 -0
  403. package/dist/remove-scroll-DTVA5f4w.cjs +86 -0
  404. package/dist/remove-scroll-WEheFCiq.js +81 -0
  405. package/dist/remove-scroll.cjs +3 -0
  406. package/dist/remove-scroll.d.cts +4 -0
  407. package/dist/remove-scroll.d.ts +4 -0
  408. package/dist/remove-scroll.js +2 -0
  409. package/dist/rolldown-runtime-D6vf50IK.cjs +28 -0
  410. package/dist/scale-C5BBHVgH.js +17 -0
  411. package/dist/scale-C7iiUGhS.cjs +22 -0
  412. package/dist/scope-CysKlKe9.cjs +28 -0
  413. package/dist/scope-D1873Mzi.js +23 -0
  414. package/dist/scroll-CVJ40w2e.js +46 -0
  415. package/dist/scroll-Dyd1QLrc.cjs +63 -0
  416. package/dist/scroll-snap-Cuaqdevf.cjs +224 -0
  417. package/dist/scroll-snap-DqMiFASa.js +201 -0
  418. package/dist/scroll-snap.cjs +6 -0
  419. package/dist/scroll-snap.d.cts +14 -0
  420. package/dist/scroll-snap.d.ts +14 -0
  421. package/dist/scroll-snap.js +2 -0
  422. package/dist/selection-ClKhnWit.d.cts +49 -0
  423. package/dist/selection-DzLiSVkg.d.ts +49 -0
  424. package/dist/selection-map-962WvX2k.js +45 -0
  425. package/dist/selection-map-BwlZr1LH.cjs +68 -0
  426. package/dist/set-CFNGOW5W.js +50 -0
  427. package/dist/set-DrtWCLFb.cjs +73 -0
  428. package/dist/store-BLpJlMxz.js +257 -0
  429. package/dist/store-Btfrm2bs.cjs +47 -0
  430. package/dist/store-C5HvdLyc.js +42 -0
  431. package/dist/store-Wg8KVwNv.cjs +298 -0
  432. package/dist/store.cjs +9 -0
  433. package/dist/store.d.cts +26 -0
  434. package/dist/store.d.ts +26 -0
  435. package/dist/store.js +2 -0
  436. package/dist/stringify-state.cjs +48 -0
  437. package/dist/stringify-state.d.cts +8 -0
  438. package/dist/stringify-state.d.ts +8 -0
  439. package/dist/stringify-state.js +44 -0
  440. package/dist/tabbable-Bz1-1GAY.cjs +206 -0
  441. package/dist/tabbable-CDA1YMjZ.js +147 -0
  442. package/dist/text-selection-B3OQpQGy.cjs +75 -0
  443. package/dist/text-selection-DXvWvm6k.js +64 -0
  444. package/dist/timers-BRyPrXIX.js +82 -0
  445. package/dist/timers-Beu4SfAj.cjs +99 -0
  446. package/dist/tree-collection-3QX3EIhq.d.ts +77 -0
  447. package/dist/tree-collection-C6oDQGUJ.d.cts +77 -0
  448. package/dist/typeahead-DremEgML.d.cts +45 -0
  449. package/dist/typeahead-DremEgML.d.ts +45 -0
  450. package/dist/types-BFuHIo7S.js +10 -0
  451. package/dist/types-CczqoQLL.d.cts +57 -0
  452. package/dist/types-CczqoQLL.d.ts +57 -0
  453. package/dist/types-CjocssbC.d.cts +13 -0
  454. package/dist/types-CjocssbC.d.ts +13 -0
  455. package/dist/types-D7oF7eWh.d.cts +54 -0
  456. package/dist/types-D7oF7eWh.d.ts +54 -0
  457. package/dist/types-HCvp3Bhv.cjs +21 -0
  458. package/dist/types.cjs +14 -0
  459. package/dist/types.d.cts +6 -0
  460. package/dist/types.d.ts +6 -0
  461. package/dist/types.js +12 -0
  462. package/dist/utils-BH-oBBz2.cjs +614 -0
  463. package/dist/utils-Cht5XaHf.js +267 -0
  464. package/dist/utils.cjs +95 -0
  465. package/dist/utils.d.cts +144 -0
  466. package/dist/utils.d.ts +144 -0
  467. package/dist/utils.js +7 -0
  468. package/dist/visually-hidden-BgSCFLz_.cjs +29 -0
  469. package/dist/visually-hidden-yDJ517KZ.js +18 -0
  470. package/dist/wait-for-3n85JcCU.d.cts +15 -0
  471. package/dist/wait-for-3n85JcCU.d.ts +15 -0
  472. package/dist/wait-for-CI5Ye-Lo.js +69 -0
  473. package/dist/wait-for-Db73VpZQ.cjs +86 -0
  474. package/dist/warning-CrzBpWT1.js +19 -0
  475. package/dist/warning-HAmFXLHm.cjs +42 -0
  476. package/package.json +349 -6
@@ -0,0 +1,1183 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ //#region src/common/hotkeys/modifier.ts
3
+ const MODIFIER_NORMALIZATION_MAP = /* @__PURE__ */ new Map([
4
+ ["ctrl", "Control"],
5
+ ["control", "Control"],
6
+ ["alt", "Alt"],
7
+ ["option", "Alt"],
8
+ ["shift", "Shift"],
9
+ ["meta", "Meta"],
10
+ ["cmd", "Meta"],
11
+ ["command", "Meta"],
12
+ ["win", "Meta"],
13
+ ["windows", "Meta"]
14
+ ]);
15
+ const normalizeModifier = (key) => MODIFIER_NORMALIZATION_MAP.get(key.toLowerCase()) ?? key;
16
+ const MODIFIER_SET = /* @__PURE__ */ new Set([
17
+ "control",
18
+ "ctrl",
19
+ "alt",
20
+ "option",
21
+ "shift",
22
+ "meta",
23
+ "cmd",
24
+ "command",
25
+ "win",
26
+ "windows"
27
+ ]);
28
+ const isModifierSet = (key) => MODIFIER_SET.has(key.toLowerCase());
29
+ function resolveControlOrMeta(key, platform) {
30
+ return isModKey(key.toLowerCase()) ? platform === "mac" ? "Meta" : "Control" : key;
31
+ }
32
+ function isModKey(key) {
33
+ return key.toLowerCase() === "mod" || key.toLowerCase() === "controlormeta";
34
+ }
35
+ //#endregion
36
+ //#region src/common/hotkeys/normalize.ts
37
+ function normalizeKey(eventKey) {
38
+ if (eventKey.length === 1 && SINGLE_LETTER_REGEX.test(eventKey)) return eventKey.toUpperCase();
39
+ const lower = eventKey.toLowerCase();
40
+ const normalized = KEY_NORMALIZATION_MAP.get(lower);
41
+ if (normalized !== void 0) return normalized;
42
+ if (FUNCTION_KEY_REGEX$1.test(lower)) return lower.toUpperCase();
43
+ return eventKey;
44
+ }
45
+ const SINGLE_LETTER_REGEX = /[a-z]/i;
46
+ const FUNCTION_KEY_REGEX$1 = /^f([1-9]|1[0-9])$/;
47
+ const KEY_NORMALIZATION_MAP = /* @__PURE__ */ new Map([
48
+ ["backspace", "Backspace"],
49
+ ["tab", "Tab"],
50
+ ["clear", "Clear"],
51
+ ["enter", "Enter"],
52
+ ["return", "Enter"],
53
+ ["esc", "Escape"],
54
+ ["escape", "Escape"],
55
+ ["space", " "],
56
+ ["spacebar", " "],
57
+ ["up", "ArrowUp"],
58
+ ["arrowup", "ArrowUp"],
59
+ ["down", "ArrowDown"],
60
+ ["arrowdown", "ArrowDown"],
61
+ ["left", "ArrowLeft"],
62
+ ["arrowleft", "ArrowLeft"],
63
+ ["right", "ArrowRight"],
64
+ ["arrowright", "ArrowRight"],
65
+ ["pageup", "PageUp"],
66
+ ["pgup", "PageUp"],
67
+ ["pagedown", "PageDown"],
68
+ ["pgdn", "PageDown"],
69
+ ["home", "Home"],
70
+ ["end", "End"],
71
+ ["del", "Delete"],
72
+ ["delete", "Delete"],
73
+ ["ins", "Insert"],
74
+ ["insert", "Insert"]
75
+ ]);
76
+ //#endregion
77
+ //#region src/common/hotkeys/key-to-code.ts
78
+ function keyToCode(key) {
79
+ if (UPPERCASE_LETTER_REGEX.test(key)) return `Key${key}`;
80
+ if (SINGLE_DIGIT_REGEX.test(key)) return `Digit${key}`;
81
+ if (FUNCTION_KEY_WITH_F20_REGEX.test(key)) return key;
82
+ if (DIRECT_KEY_CODES.has(key)) return key;
83
+ return SPECIAL_KEY_CODES.get(key);
84
+ }
85
+ const UPPERCASE_LETTER_REGEX = /^[A-Z]$/;
86
+ const SINGLE_DIGIT_REGEX = /^[0-9]$/;
87
+ const FUNCTION_KEY_WITH_F20_REGEX = /^F([1-9]|1[0-9]|20)$/;
88
+ const DIRECT_KEY_CODES = /* @__PURE__ */ new Set([
89
+ "Enter",
90
+ "Tab",
91
+ "Backspace",
92
+ "Delete",
93
+ "Escape",
94
+ "ArrowUp",
95
+ "ArrowDown",
96
+ "ArrowLeft",
97
+ "ArrowRight",
98
+ "Home",
99
+ "End",
100
+ "PageUp",
101
+ "PageDown",
102
+ "Insert"
103
+ ]);
104
+ const SPECIAL_KEY_CODES = /* @__PURE__ */ new Map([
105
+ [" ", "Space"],
106
+ ["-", "Minus"],
107
+ ["=", "Equal"],
108
+ ["+", "Equal"],
109
+ ["[", "BracketLeft"],
110
+ ["]", "BracketRight"],
111
+ [";", "Semicolon"],
112
+ ["'", "Quote"],
113
+ ["`", "Backquote"],
114
+ ["\\", "Backslash"],
115
+ [",", "Comma"],
116
+ [".", "Period"],
117
+ ["/", "Slash"]
118
+ ]);
119
+ //#endregion
120
+ //#region src/common/hotkeys/utils.ts
121
+ const typeOf = (value) => Object.prototype.toString.call(value).slice(8, -1);
122
+ const isDocument = (value) => typeOf(value) === "Document";
123
+ function getDoc(root) {
124
+ return isDocument(root) ? root : root.ownerDocument || document;
125
+ }
126
+ function getWin(root) {
127
+ return getDoc(root).defaultView || window;
128
+ }
129
+ const FORM_TAGS = /* @__PURE__ */ new Set([
130
+ "input",
131
+ "textarea",
132
+ "select"
133
+ ]);
134
+ const isFormTag = (tagName) => FORM_TAGS.has(tagName);
135
+ const isHTMLElement = (target) => {
136
+ return target !== null && typeof target === "object" && "localName" in target && "nodeType" in target && target.nodeType === 1;
137
+ };
138
+ const getEventTarget = (event) => {
139
+ const target = event.composedPath?.()[0] || event.target;
140
+ return isHTMLElement(target) ? target : null;
141
+ };
142
+ const isContentEditableElement = (target) => {
143
+ if (!target) return false;
144
+ return isHTMLElement(target) && target.isContentEditable;
145
+ };
146
+ const NA_REGEX = /Mac|iPod|iPhone|iPad/;
147
+ const isMac = () => typeof navigator !== "undefined" && NA_REGEX.test(navigator.userAgent);
148
+ const getPlatform = () => isMac() ? "mac" : "windows";
149
+ const toArray = (value) => {
150
+ if (Array.isArray(value)) return value.filter((item) => item !== void 0);
151
+ return value !== void 0 ? [value] : [];
152
+ };
153
+ const UNICODE_LETTER = /^\p{L}$/u;
154
+ const UNICODE_NUMBER = /^\p{N}$/u;
155
+ const isSymbolKey = (key) => {
156
+ if (key.length !== 1) return false;
157
+ if (UNICODE_LETTER.test(key) || UNICODE_NUMBER.test(key)) return false;
158
+ return true;
159
+ };
160
+ //#endregion
161
+ //#region src/common/hotkeys/parser.ts
162
+ function parseHotkeyString(hotkey, platform) {
163
+ const parts = hotkey.split("+");
164
+ const modifiers = [];
165
+ let keyIndex = parts.length - 1;
166
+ for (let i = 0; i < parts.length - 1; i++) {
167
+ const part = parts[i].trim().toLowerCase();
168
+ const resolved = resolveControlOrMeta(part, platform).toLowerCase();
169
+ if (part === "") {
170
+ keyIndex = i;
171
+ break;
172
+ }
173
+ if (isModifierSet(resolved) || resolved === "mod" || resolved === "controlormeta") modifiers.push(parts[i].trim());
174
+ else {
175
+ keyIndex = i;
176
+ break;
177
+ }
178
+ }
179
+ return {
180
+ modifiers,
181
+ key: parts.slice(keyIndex).join("+").trim()
182
+ };
183
+ }
184
+ function parseHotkey(hotkey, platform) {
185
+ if (hotkey.includes(">")) {
186
+ const sequenceParts = hotkey.split(">");
187
+ const sequenceSteps = [];
188
+ const allKeys = [];
189
+ const allCodes = [];
190
+ for (const rawPart of sequenceParts) {
191
+ const part = rawPart.trim();
192
+ if (part.includes("+")) {
193
+ const { modifiers, key } = parseHotkeyString(part, platform);
194
+ const step = {
195
+ key: normalizeKey(key),
196
+ alt: false,
197
+ ctrl: false,
198
+ meta: false,
199
+ shift: false
200
+ };
201
+ for (const modifier of modifiers) switch (normalizeModifier(resolveControlOrMeta(modifier, platform))) {
202
+ case "Alt":
203
+ step.alt = true;
204
+ break;
205
+ case "Control":
206
+ step.ctrl = true;
207
+ break;
208
+ case "Meta":
209
+ step.meta = true;
210
+ break;
211
+ case "Shift":
212
+ step.shift = true;
213
+ break;
214
+ }
215
+ sequenceSteps.push(step);
216
+ allKeys.push(step.key);
217
+ const code = keyToCode(step.key);
218
+ if (code != null) allCodes.push(code);
219
+ } else {
220
+ const key = normalizeKey(part);
221
+ sequenceSteps.push({
222
+ key,
223
+ alt: false,
224
+ ctrl: false,
225
+ meta: false,
226
+ shift: false
227
+ });
228
+ allKeys.push(key);
229
+ const code = keyToCode(key);
230
+ if (code != null) allCodes.push(code);
231
+ }
232
+ }
233
+ return {
234
+ keys: allKeys,
235
+ codes: allCodes.length > 0 ? allCodes : void 0,
236
+ alt: false,
237
+ ctrl: false,
238
+ meta: false,
239
+ shift: false,
240
+ isSequence: true,
241
+ sequenceSteps
242
+ };
243
+ }
244
+ const { modifiers, key } = parseHotkeyString(hotkey, platform);
245
+ const result = {
246
+ keys: [],
247
+ codes: [],
248
+ alt: false,
249
+ ctrl: false,
250
+ meta: false,
251
+ shift: false,
252
+ isSequence: false
253
+ };
254
+ for (const modifier of modifiers) switch (normalizeModifier(resolveControlOrMeta(modifier, platform))) {
255
+ case "Alt":
256
+ result.alt = true;
257
+ break;
258
+ case "Control":
259
+ result.ctrl = true;
260
+ break;
261
+ case "Meta":
262
+ result.meta = true;
263
+ break;
264
+ case "Shift":
265
+ result.shift = true;
266
+ break;
267
+ }
268
+ if (key && key !== ">") {
269
+ const normalizedKey = normalizeKey(key);
270
+ result.keys.push(normalizedKey);
271
+ const code = keyToCode(normalizedKey);
272
+ if (code != null) result.codes?.push(code);
273
+ }
274
+ return result;
275
+ }
276
+ function toMatchableHotkeySteps(parsed) {
277
+ return parsed.keys.map((key, index) => ({
278
+ key,
279
+ code: parsed.codes?.[index],
280
+ alt: parsed.alt,
281
+ ctrl: parsed.ctrl,
282
+ meta: parsed.meta,
283
+ shift: parsed.shift
284
+ }));
285
+ }
286
+ function matchesHotkeyStep(step, event) {
287
+ const eventKey = normalizeKey(event.key);
288
+ const keyMatches = step.key === eventKey;
289
+ if (isSymbolKey(step.key)) {
290
+ const modifierHeld = event.altKey || event.metaKey || event.ctrlKey;
291
+ if (!keyMatches && !(modifierHeld && step.code && step.code === event.code)) return false;
292
+ const isRealAltGr = (event.getModifierState?.("AltGraph") ?? false) && event.ctrlKey;
293
+ const effectiveCtrl = isRealAltGr ? false : event.ctrlKey;
294
+ const effectiveAlt = isRealAltGr ? false : event.altKey;
295
+ if ((step.ctrl || false) !== effectiveCtrl) return false;
296
+ if ((step.meta || false) !== event.metaKey) return false;
297
+ if (step.shift && !event.shiftKey) return false;
298
+ if (step.alt && !effectiveAlt) return false;
299
+ return true;
300
+ }
301
+ if ((event.getModifierState?.("AltGraph") ?? false) && event.ctrlKey) return false;
302
+ if ((step.alt || false) !== event.altKey) return false;
303
+ if ((step.ctrl || false) !== event.ctrlKey) return false;
304
+ if ((step.meta || false) !== event.metaKey) return false;
305
+ if ((step.shift || false) !== event.shiftKey) return false;
306
+ return keyMatches || !!step.code && step.code === event.code;
307
+ }
308
+ function matchesHotkey(parsed, event) {
309
+ return toMatchableHotkeySteps(parsed).some((step) => matchesHotkeyStep(step, event));
310
+ }
311
+ function shouldTrigger(event, options) {
312
+ const target = getEventTarget(event);
313
+ if (!target) return true;
314
+ const tagName = target.localName;
315
+ const isContentEditable = isContentEditableElement(target);
316
+ if (isFormTag(tagName)) {
317
+ if (options.enableOnFormTags === false || options.enableOnFormTags === void 0) return false;
318
+ if (Array.isArray(options.enableOnFormTags)) {
319
+ if (!options.enableOnFormTags.includes(tagName)) return false;
320
+ }
321
+ }
322
+ if (isContentEditable && !options.enableOnContentEditable) return false;
323
+ return true;
324
+ }
325
+ function isHotKey(hotkey, event, options = {}, platform) {
326
+ if (event.key === "Dead") return false;
327
+ if (!shouldTrigger(event, options)) return false;
328
+ const resolved = platform ?? getPlatform();
329
+ return toArray(hotkey).some((h) => {
330
+ return matchesHotkey(parseHotkey(h, resolved), event);
331
+ });
332
+ }
333
+ function isHotkeyEqual(a, b, platform) {
334
+ const resolved = platform ?? getPlatform();
335
+ const pa = parseHotkey(a, resolved);
336
+ const pb = parseHotkey(b, resolved);
337
+ if (pa.isSequence !== pb.isSequence) return false;
338
+ if (pa.isSequence && pb.isSequence) {
339
+ const stepsA = pa.sequenceSteps;
340
+ const stepsB = pb.sequenceSteps;
341
+ if (!stepsA || !stepsB || stepsA.length !== stepsB.length) return false;
342
+ return stepsA.every((stepA, i) => {
343
+ const stepB = stepsB[i];
344
+ return stepA.key === stepB.key && (stepA.ctrl ?? false) === (stepB.ctrl ?? false) && (stepA.alt ?? false) === (stepB.alt ?? false) && (stepA.shift ?? false) === (stepB.shift ?? false) && (stepA.meta ?? false) === (stepB.meta ?? false);
345
+ });
346
+ }
347
+ return pa.ctrl === pb.ctrl && pa.alt === pb.alt && pa.shift === pb.shift && pa.meta === pb.meta && pa.keys.length === pb.keys.length && pa.keys.every((k, i) => k === pb.keys[i]);
348
+ }
349
+ function getHotkeyPriority(parsed) {
350
+ let priority = 0;
351
+ if (parsed.isSequence) priority += 1e3;
352
+ if (parsed.alt) priority += 100;
353
+ if (parsed.ctrl) priority += 100;
354
+ if (parsed.meta) priority += 100;
355
+ if (parsed.shift) priority += 100;
356
+ priority += parsed.keys.length * 10;
357
+ return priority;
358
+ }
359
+ //#endregion
360
+ //#region src/common/hotkeys/store.ts
361
+ const defaultOptions = {
362
+ preventDefault: true,
363
+ stopPropagation: false,
364
+ enableOnFormTags: false,
365
+ enableOnContentEditable: false,
366
+ capture: true
367
+ };
368
+ const DEFAULT_SCOPES = ["*"];
369
+ function hasNonShiftModifier(parsed) {
370
+ return !!(parsed.ctrl || parsed.meta || parsed.alt);
371
+ }
372
+ var HotkeyStore = class {
373
+ state;
374
+ target;
375
+ defaultCommandOptions = { ...defaultOptions };
376
+ commandOptionOverrides = /* @__PURE__ */ new Map();
377
+ sequenceTimeoutMs = 1e3;
378
+ conflictBehavior = "warn";
379
+ sequenceStates = /* @__PURE__ */ new Map();
380
+ registrationOrder = 0;
381
+ platform = "mac";
382
+ listeners = {};
383
+ firedCommands = /* @__PURE__ */ new Set();
384
+ hasKeyupCommands = false;
385
+ subscribers = /* @__PURE__ */ new Set();
386
+ constructor(options) {
387
+ const defaultScopes = options?.activeScopes ? toArray(options.activeScopes) : DEFAULT_SCOPES;
388
+ this.state = {
389
+ pressedKeys: /* @__PURE__ */ new Set(),
390
+ pressedCodes: /* @__PURE__ */ new Set(),
391
+ commands: /* @__PURE__ */ new Map(),
392
+ listening: false,
393
+ activeScopes: new Set(defaultScopes)
394
+ };
395
+ if (options?.sequenceTimeoutMs !== void 0) this.sequenceTimeoutMs = options.sequenceTimeoutMs;
396
+ if (options?.conflictBehavior !== void 0) this.conflictBehavior = options.conflictBehavior;
397
+ this.applyDefaultOptions(options?.defaultOptions);
398
+ }
399
+ init(options) {
400
+ if (!options.target) throw new Error("target is required for initialization");
401
+ this.applyDefaultOptions(options.defaultOptions);
402
+ this.target = options.target;
403
+ this.platform = getPlatform();
404
+ this.updateParsedHotkeys();
405
+ this.updateListeners();
406
+ return this;
407
+ }
408
+ destroy() {
409
+ this.stopListening();
410
+ this.clear();
411
+ this.subscribers.clear();
412
+ this.sequenceStates.clear();
413
+ this.firedCommands.clear();
414
+ this.target = void 0;
415
+ this.registrationOrder = 0;
416
+ }
417
+ setScope(scope) {
418
+ const scopes = toArray(scope);
419
+ this.state.activeScopes = new Set(scopes);
420
+ this.clearAllSequences();
421
+ this.notifySubscribers();
422
+ return this;
423
+ }
424
+ addScope(scope) {
425
+ this.state.activeScopes.add(scope);
426
+ this.notifySubscribers();
427
+ return this;
428
+ }
429
+ removeScope(scope) {
430
+ this.state.activeScopes.delete(scope);
431
+ this.notifySubscribers();
432
+ return this;
433
+ }
434
+ getActiveScopes() {
435
+ return [...this.state.activeScopes];
436
+ }
437
+ getState() {
438
+ return this.state;
439
+ }
440
+ toggleScope(scope) {
441
+ if (this.state.activeScopes.has(scope)) this.state.activeScopes.delete(scope);
442
+ else this.state.activeScopes.add(scope);
443
+ this.notifySubscribers();
444
+ return this;
445
+ }
446
+ subscribe(selector, callback) {
447
+ const subscriber = {
448
+ selector,
449
+ callback,
450
+ lastValue: selector(this.state)
451
+ };
452
+ this.subscribers.add(subscriber);
453
+ return () => {
454
+ this.subscribers.delete(subscriber);
455
+ };
456
+ }
457
+ register(commands) {
458
+ const commandArray = toArray(commands);
459
+ for (const command of commandArray) {
460
+ const scopes = command.scopes ? toArray(command.scopes) : DEFAULT_SCOPES;
461
+ const parsed = parseHotkey(command.hotkey, this.platform);
462
+ const priority = getHotkeyPriority(parsed);
463
+ const resolvedOptions = {
464
+ ...this.defaultCommandOptions,
465
+ ...command.options
466
+ };
467
+ if (command.options?.enableOnFormTags === void 0 && hasNonShiftModifier(parsed)) resolvedOptions.enableOnFormTags = true;
468
+ this.detectConflicts(command.id, command.hotkey);
469
+ this.state.commands.set(command.id, {
470
+ id: command.id,
471
+ hotkey: command.hotkey,
472
+ action: command.action,
473
+ options: resolvedOptions,
474
+ enabled: command.enabled ?? true,
475
+ scopes,
476
+ keywords: command.keywords ?? [],
477
+ _parsed: parsed,
478
+ _priority: priority,
479
+ _registrationOrder: this.registrationOrder++,
480
+ ...command.label !== void 0 && { label: command.label },
481
+ ...command.description !== void 0 && { description: command.description },
482
+ ...command.category !== void 0 && { category: command.category }
483
+ });
484
+ this.commandOptionOverrides.set(command.id, command.options);
485
+ }
486
+ this.refreshKeyupFlag();
487
+ this.updateListeners();
488
+ this.notifySubscribers();
489
+ return this;
490
+ }
491
+ unregister(id) {
492
+ const command = this.state.commands.get(id);
493
+ if (command) {
494
+ this.state.commands.delete(id);
495
+ this.commandOptionOverrides.delete(id);
496
+ this.firedCommands.delete(id);
497
+ this.resetSequence(command.hotkey);
498
+ this.refreshKeyupFlag();
499
+ this.updateListeners();
500
+ this.notifySubscribers();
501
+ }
502
+ return this;
503
+ }
504
+ enable(id) {
505
+ const command = this.state.commands.get(id);
506
+ if (command) {
507
+ command.enabled = true;
508
+ this.updateListeners();
509
+ this.notifySubscribers();
510
+ }
511
+ return this;
512
+ }
513
+ disable(id) {
514
+ const command = this.state.commands.get(id);
515
+ if (command) {
516
+ command.enabled = false;
517
+ this.updateListeners();
518
+ this.notifySubscribers();
519
+ }
520
+ return this;
521
+ }
522
+ setEnabled(id, enabled) {
523
+ const command = this.state.commands.get(id);
524
+ if (command) {
525
+ command.enabled = enabled;
526
+ this.updateListeners();
527
+ this.notifySubscribers();
528
+ }
529
+ return this;
530
+ }
531
+ clear() {
532
+ this.clearAllSequences();
533
+ this.state.commands.clear();
534
+ this.commandOptionOverrides.clear();
535
+ this.state.pressedKeys.clear();
536
+ this.state.pressedCodes.clear();
537
+ this.firedCommands.clear();
538
+ this.hasKeyupCommands = false;
539
+ this.updateListeners();
540
+ this.notifySubscribers();
541
+ return this;
542
+ }
543
+ isPressed(hotkey) {
544
+ const parsed = parseHotkey(hotkey, this.platform);
545
+ if (parsed.isSequence) return false;
546
+ const logicalKeysMatch = parsed.keys.every((k) => this.state.pressedKeys.has(k));
547
+ const codes = parsed.codes;
548
+ const codesAligned = codes && codes.length > 0 && codes.length === parsed.keys.length && codes.every((c) => this.state.pressedCodes.has(c));
549
+ return (logicalKeysMatch || !!codesAligned) && this.modifiersMatchPressed(parsed);
550
+ }
551
+ getCurrentlyPressed() {
552
+ return [...this.state.pressedKeys];
553
+ }
554
+ getPressedCodes() {
555
+ return [...this.state.pressedCodes];
556
+ }
557
+ modifiersMatchPressed(parsed) {
558
+ const pk = this.state.pressedKeys;
559
+ const has = (name) => pk.has(name);
560
+ if (parsed.keys.some(isSymbolKey)) {
561
+ if (parsed.ctrl !== has("Control")) return false;
562
+ if (parsed.meta !== has("Meta")) return false;
563
+ if (parsed.shift && !has("Shift")) return false;
564
+ if (parsed.alt && !has("Alt")) return false;
565
+ return true;
566
+ }
567
+ if (parsed.alt !== has("Alt")) return false;
568
+ if (parsed.ctrl !== has("Control")) return false;
569
+ if (parsed.meta !== has("Meta")) return false;
570
+ if (parsed.shift !== has("Shift")) return false;
571
+ return true;
572
+ }
573
+ applyDefaultOptions(options) {
574
+ if (!options) return;
575
+ this.defaultCommandOptions = {
576
+ ...defaultOptions,
577
+ ...options
578
+ };
579
+ for (const [id, command] of this.state.commands) command.options = {
580
+ ...this.defaultCommandOptions,
581
+ ...this.commandOptionOverrides.get(id)
582
+ };
583
+ }
584
+ updateParsedHotkeys() {
585
+ for (const command of this.state.commands.values()) if (command.hotkey.split("+").some((part) => isModKey(part.trim()))) {
586
+ command._parsed = parseHotkey(command.hotkey, this.platform);
587
+ command._priority = getHotkeyPriority(command._parsed);
588
+ }
589
+ }
590
+ refreshKeyupFlag() {
591
+ this.hasKeyupCommands = false;
592
+ for (const command of this.state.commands.values()) if (command.options.eventType === "keyup") {
593
+ this.hasKeyupCommands = true;
594
+ break;
595
+ }
596
+ }
597
+ detectConflicts(newId, newHotkey) {
598
+ if (this.conflictBehavior === "allow") return;
599
+ const toDelete = [];
600
+ for (const [existingId, existing] of this.state.commands) {
601
+ if (existingId === newId) continue;
602
+ if (existing.hotkey !== newHotkey) continue;
603
+ const message = `[hotkeys] Conflict: "${newHotkey}" is already registered by command "${existingId}". Command "${newId}" will also respond to this hotkey.`;
604
+ switch (this.conflictBehavior) {
605
+ case "error": throw new Error(message);
606
+ case "replace":
607
+ toDelete.push(existingId);
608
+ break;
609
+ default:
610
+ console.warn(message);
611
+ break;
612
+ }
613
+ }
614
+ for (const id of toDelete) {
615
+ this.state.commands.delete(id);
616
+ this.commandOptionOverrides.delete(id);
617
+ }
618
+ }
619
+ updateListeners() {
620
+ if (!this.target) return;
621
+ if (this.state.commands.size > 0) this.startListening();
622
+ else this.stopListening();
623
+ }
624
+ startListening() {
625
+ if (!this.target || this.state.listening) return;
626
+ const win = getWin(this.target);
627
+ const phases = this.getListenerPhases();
628
+ if (phases.capture) {
629
+ const record = {
630
+ keyDown: ((e) => this.executeMatchingCommands(e, true, "keydown")),
631
+ keyUp: ((e) => this.handleKeyUp(e, true)),
632
+ blur: (() => this.handleBlur())
633
+ };
634
+ this.target.addEventListener("keydown", record.keyDown, true);
635
+ this.target.addEventListener("keyup", record.keyUp, true);
636
+ win.addEventListener("blur", record.blur);
637
+ win.addEventListener("contextmenu", record.blur);
638
+ this.listeners.capture = record;
639
+ }
640
+ if (phases.bubble) {
641
+ const record = {
642
+ keyDown: ((e) => this.executeMatchingCommands(e, false, "keydown")),
643
+ keyUp: ((e) => this.handleKeyUp(e, false)),
644
+ blur: (() => this.handleBlur())
645
+ };
646
+ this.target.addEventListener("keydown", record.keyDown, false);
647
+ this.target.addEventListener("keyup", record.keyUp, false);
648
+ win.addEventListener("blur", record.blur);
649
+ win.addEventListener("contextmenu", record.blur);
650
+ this.listeners.bubble = record;
651
+ }
652
+ this.state.listening = true;
653
+ }
654
+ stopListening() {
655
+ if (!this.target || !this.state.listening) return;
656
+ const win = getWin(this.target);
657
+ if (this.listeners.capture) {
658
+ const r = this.listeners.capture;
659
+ if (r.keyDown) this.target.removeEventListener("keydown", r.keyDown, true);
660
+ if (r.keyUp) this.target.removeEventListener("keyup", r.keyUp, true);
661
+ if (r.blur) {
662
+ win.removeEventListener("blur", r.blur);
663
+ win.removeEventListener("contextmenu", r.blur);
664
+ }
665
+ }
666
+ if (this.listeners.bubble) {
667
+ const r = this.listeners.bubble;
668
+ if (r.keyDown) this.target.removeEventListener("keydown", r.keyDown, false);
669
+ if (r.keyUp) this.target.removeEventListener("keyup", r.keyUp, false);
670
+ if (r.blur) {
671
+ win.removeEventListener("blur", r.blur);
672
+ win.removeEventListener("contextmenu", r.blur);
673
+ }
674
+ }
675
+ this.listeners = {};
676
+ this.state.listening = false;
677
+ }
678
+ getListenerPhases() {
679
+ let capture = false;
680
+ let bubble = false;
681
+ for (const command of this.state.commands.values()) {
682
+ if (!(typeof command.enabled === "function" ? command.enabled() : command.enabled)) continue;
683
+ if (command.options.capture !== false) capture = true;
684
+ else bubble = true;
685
+ if (capture && bubble) break;
686
+ }
687
+ return {
688
+ capture,
689
+ bubble
690
+ };
691
+ }
692
+ handleKeyUp(event, capture) {
693
+ if (this.hasKeyupCommands) this.executeMatchingCommands(event, capture, "keyup");
694
+ const eventKey = normalizeKey(event.key);
695
+ this.state.pressedKeys.delete(eventKey);
696
+ if (event.code) this.state.pressedCodes.delete(event.code);
697
+ if (this.firedCommands.size > 0) this.firedCommands.clear();
698
+ this.notifySubscribers();
699
+ }
700
+ handleBlur() {
701
+ this.state.pressedKeys.clear();
702
+ this.state.pressedCodes.clear();
703
+ this.firedCommands.clear();
704
+ this.clearAllSequences();
705
+ this.notifySubscribers();
706
+ }
707
+ executeMatchingCommands(event, capture, eventType) {
708
+ if (event.key === "Dead") return;
709
+ const eventKey = normalizeKey(event.key);
710
+ if (eventType === "keydown") {
711
+ this.state.pressedKeys.add(eventKey);
712
+ if (event.code) this.state.pressedCodes.add(event.code);
713
+ this.notifySubscribers();
714
+ }
715
+ const matches = [];
716
+ for (const [_id, command] of this.state.commands) {
717
+ if (!(typeof command.enabled === "function" ? command.enabled() : command.enabled)) continue;
718
+ if (command.options.capture !== false !== capture) continue;
719
+ if ((command.options.eventType ?? "keydown") !== eventType) continue;
720
+ if (!command.scopes.some((scope) => scope === "*" || this.state.activeScopes.has(scope))) continue;
721
+ if (!shouldTrigger(event, command.options)) continue;
722
+ if (command.options.requireReset && this.firedCommands.has(command.id)) continue;
723
+ if (command._parsed.isSequence ? this.handleSequence(command.hotkey, command._parsed, eventKey, event) : matchesHotkey(command._parsed, event)) matches.push({
724
+ command,
725
+ priority: command._priority
726
+ });
727
+ }
728
+ if (matches.length === 0) return;
729
+ matches.sort((a, b) => {
730
+ if (b.priority !== a.priority) return b.priority - a.priority;
731
+ return a.command._registrationOrder - b.command._registrationOrder;
732
+ });
733
+ const highestPriority = matches[0].priority;
734
+ const toExecute = matches.filter((m) => m.priority === highestPriority);
735
+ for (const { command } of toExecute) {
736
+ if (command.options.preventDefault) event.preventDefault();
737
+ if (command.options.stopPropagation) event.stopPropagation();
738
+ if (command.options.requireReset) this.firedCommands.add(command.id);
739
+ try {
740
+ command.action(event);
741
+ } catch (error) {
742
+ console.error(`Error executing hotkey command "${command.id}":`, error);
743
+ }
744
+ }
745
+ }
746
+ handleSequence(hotkeyString, parsed, eventKey, event) {
747
+ if (!this.target) {
748
+ console.warn("Cannot handle sequence: target is not initialized");
749
+ return false;
750
+ }
751
+ const win = getWin(this.target);
752
+ let state = this.sequenceStates.get(hotkeyString);
753
+ if (!state) {
754
+ state = { recordedKeys: [] };
755
+ this.sequenceStates.set(hotkeyString, state);
756
+ }
757
+ if (state.timeoutId) clearTimeout(state.timeoutId);
758
+ const currentStepIndex = state.recordedKeys.length;
759
+ const expectedStep = parsed.sequenceSteps?.[currentStepIndex];
760
+ if (expectedStep) if (matchesHotkeyStep({
761
+ key: expectedStep.key,
762
+ code: parsed.codes?.[currentStepIndex],
763
+ alt: expectedStep.alt,
764
+ ctrl: expectedStep.ctrl,
765
+ meta: expectedStep.meta,
766
+ shift: expectedStep.shift
767
+ }, event)) {
768
+ state.recordedKeys.push(eventKey);
769
+ if (state.recordedKeys.length === parsed.sequenceSteps.length) {
770
+ this.resetSequence(hotkeyString);
771
+ return true;
772
+ }
773
+ state.timeoutId = win.setTimeout(() => {
774
+ this.resetSequence(hotkeyString);
775
+ }, this.sequenceTimeoutMs);
776
+ } else this.resetSequence(hotkeyString);
777
+ else this.resetSequence(hotkeyString);
778
+ return false;
779
+ }
780
+ clearAllSequences() {
781
+ for (const state of this.sequenceStates.values()) if (typeof state.timeoutId === "number") clearTimeout(state.timeoutId);
782
+ this.sequenceStates.clear();
783
+ }
784
+ resetSequence(hotkey) {
785
+ const state = this.sequenceStates.get(hotkey);
786
+ if (state && typeof state.timeoutId === "number") clearTimeout(state.timeoutId);
787
+ this.sequenceStates.delete(hotkey);
788
+ }
789
+ notifySubscribers() {
790
+ for (const subscriber of this.subscribers) try {
791
+ const newValue = subscriber.selector(this.state);
792
+ if (newValue !== subscriber.lastValue) {
793
+ subscriber.lastValue = newValue;
794
+ subscriber.callback(newValue);
795
+ }
796
+ } catch (error) {
797
+ console.error("Error in hotkey store subscriber:", error);
798
+ }
799
+ }
800
+ };
801
+ function createHotkeyStore(options) {
802
+ const store = new HotkeyStore(options);
803
+ if (options?.target) store.init(options);
804
+ return store;
805
+ }
806
+ //#endregion
807
+ //#region src/common/hotkeys/format.ts
808
+ const PLATFORM_MODIFIERS = {
809
+ mac: {
810
+ Control: "⌃",
811
+ Alt: "⌥",
812
+ Shift: "⇧",
813
+ Meta: "⌘"
814
+ },
815
+ windows: {
816
+ Control: "Ctrl",
817
+ Alt: "Alt",
818
+ Shift: "Shift",
819
+ Meta: "Win"
820
+ },
821
+ linux: {
822
+ Control: "Ctrl",
823
+ Alt: "Alt",
824
+ Shift: "Shift",
825
+ Meta: "Super"
826
+ }
827
+ };
828
+ const KEY_SYMBOLS = /* @__PURE__ */ new Map([
829
+ ["ArrowUp", "↑"],
830
+ ["ArrowDown", "↓"],
831
+ ["ArrowLeft", "←"],
832
+ ["ArrowRight", "→"],
833
+ ["Backspace", "⌫"],
834
+ ["Delete", "⌦"],
835
+ ["Enter", "↵"],
836
+ ["Tab", "⇥"],
837
+ ["Escape", "Esc"],
838
+ ["Space", "␣"],
839
+ [" ", "␣"]
840
+ ]);
841
+ const KEY_NAMES = /* @__PURE__ */ new Map([
842
+ ["ArrowUp", "Up"],
843
+ ["ArrowDown", "Down"],
844
+ ["ArrowLeft", "Left"],
845
+ ["ArrowRight", "Right"],
846
+ ["Space", "Space"],
847
+ [" ", "Space"]
848
+ ]);
849
+ function formatHotkey(hotkey, options = {}) {
850
+ const { platform = "auto", style = "mixed", separator = " ", sequenceSeparator = " then ", useShortNames = true } = options;
851
+ const targetPlatform = platform === "auto" ? getPlatform() : platform;
852
+ if (hotkey.includes(">")) return hotkey.split(">").map((part) => formatSingleHotkey(part.trim(), targetPlatform, style, separator, useShortNames)).join(sequenceSeparator);
853
+ return formatSingleHotkey(hotkey, targetPlatform, style, separator, useShortNames);
854
+ }
855
+ function formatSingleHotkey(hotkey, platform, style, separator, useShortNames) {
856
+ if (!hotkey.trim()) return "";
857
+ const parsed = parseHotkey(hotkey, platform);
858
+ const modifiers = [];
859
+ if (parsed.ctrl) modifiers.push("Control");
860
+ if (parsed.alt) modifiers.push("Alt");
861
+ if (parsed.shift) modifiers.push("Shift");
862
+ if (parsed.meta) modifiers.push("Meta");
863
+ const keys = parsed.keys;
864
+ const platformModifiers = PLATFORM_MODIFIERS[platform];
865
+ const formattedModifiers = modifiers.map((modifier) => {
866
+ const mappedModifier = platformModifiers[modifier];
867
+ if (style === "symbols" && platform === "mac") return mappedModifier || modifier;
868
+ if (style === "text" || platform !== "mac") return useShortNames && modifier === "Control" ? "Ctrl" : mappedModifier || modifier;
869
+ return mappedModifier || modifier;
870
+ });
871
+ const formattedKeys = keys.map((key) => {
872
+ if (style === "symbols") return KEY_SYMBOLS.get(key) || key;
873
+ if (style === "text") return KEY_NAMES.get(key) || key;
874
+ return KEY_SYMBOLS.get(key) || KEY_NAMES.get(key) || key;
875
+ });
876
+ return [...formattedModifiers, ...formattedKeys].join(separator);
877
+ }
878
+ //#endregion
879
+ //#region src/common/hotkeys/recorder.ts
880
+ const MODIFIER_KEYS = /* @__PURE__ */ new Set([
881
+ "Control",
882
+ "Alt",
883
+ "Shift",
884
+ "Meta"
885
+ ]);
886
+ const DEFAULT_SEQUENCE_TIMEOUT = 1e3;
887
+ var HotkeyRecorder = class {
888
+ state = {
889
+ recording: false,
890
+ value: null
891
+ };
892
+ target;
893
+ options;
894
+ platform;
895
+ keyDownHandler;
896
+ keyUpHandler;
897
+ subscribers = /* @__PURE__ */ new Set();
898
+ steps = [];
899
+ sequenceTimerId;
900
+ constructor(options = {}) {
901
+ this.options = options;
902
+ this.platform = getPlatform();
903
+ }
904
+ init(target) {
905
+ this.target = target;
906
+ this.platform = getPlatform();
907
+ return this;
908
+ }
909
+ start() {
910
+ if (this.state.recording) return this;
911
+ const root = this.target;
912
+ if (!root) {
913
+ console.warn("HotkeyRecorder: target is not set. Call init() first.");
914
+ return this;
915
+ }
916
+ this.steps = [];
917
+ this.clearSequenceTimer();
918
+ this.setState({
919
+ recording: true,
920
+ value: this.state.value
921
+ });
922
+ this.attachListeners(root);
923
+ return this;
924
+ }
925
+ stop() {
926
+ if (!this.state.recording) return this;
927
+ this.finalize();
928
+ return this;
929
+ }
930
+ cancel() {
931
+ if (!this.state.recording) return this;
932
+ this.detachListeners();
933
+ this.clearSequenceTimer();
934
+ this.steps = [];
935
+ this.setState({
936
+ recording: false,
937
+ value: this.state.value
938
+ });
939
+ this.options.onCancel?.();
940
+ return this;
941
+ }
942
+ clear() {
943
+ this.detachListeners();
944
+ this.clearSequenceTimer();
945
+ this.steps = [];
946
+ this.setState({
947
+ recording: false,
948
+ value: null
949
+ });
950
+ this.options.onClear?.();
951
+ return this;
952
+ }
953
+ setOptions(options) {
954
+ this.options = {
955
+ ...this.options,
956
+ ...options
957
+ };
958
+ return this;
959
+ }
960
+ getState() {
961
+ return this.state;
962
+ }
963
+ subscribe(callback) {
964
+ this.subscribers.add(callback);
965
+ return () => {
966
+ this.subscribers.delete(callback);
967
+ };
968
+ }
969
+ destroy() {
970
+ this.detachListeners();
971
+ this.clearSequenceTimer();
972
+ this.subscribers.clear();
973
+ this.steps = [];
974
+ this.target = void 0;
975
+ }
976
+ setState(next) {
977
+ this.state = next;
978
+ for (const fn of this.subscribers) try {
979
+ fn(this.state);
980
+ } catch (error) {
981
+ console.error("Error in hotkey recorder subscriber:", error);
982
+ }
983
+ }
984
+ attachListeners(root) {
985
+ this.keyDownHandler = ((event) => {
986
+ this.handleKeyDown(event);
987
+ });
988
+ this.keyUpHandler = ((event) => {
989
+ event.preventDefault();
990
+ });
991
+ root.addEventListener("keydown", this.keyDownHandler, true);
992
+ root.addEventListener("keyup", this.keyUpHandler, true);
993
+ }
994
+ detachListeners() {
995
+ if (!this.target) return;
996
+ if (this.keyDownHandler) this.target.removeEventListener("keydown", this.keyDownHandler, true);
997
+ if (this.keyUpHandler) this.target.removeEventListener("keyup", this.keyUpHandler, true);
998
+ this.keyDownHandler = void 0;
999
+ this.keyUpHandler = void 0;
1000
+ }
1001
+ handleKeyDown(event) {
1002
+ event.preventDefault();
1003
+ event.stopPropagation();
1004
+ const key = event.key;
1005
+ if (key === "Escape") {
1006
+ this.cancel();
1007
+ return;
1008
+ }
1009
+ if (key === "Backspace" || key === "Delete") {
1010
+ this.clear();
1011
+ return;
1012
+ }
1013
+ if (MODIFIER_KEYS.has(key)) return;
1014
+ if (key === "Dead") return;
1015
+ this.clearSequenceTimer();
1016
+ const parts = [];
1017
+ if (event.ctrlKey) parts.push("Control");
1018
+ if (event.altKey) parts.push("Alt");
1019
+ if (event.shiftKey) parts.push("Shift");
1020
+ if (event.metaKey) parts.push("Meta");
1021
+ const normalizedKey = normalizeKey(key);
1022
+ parts.push(normalizedKey);
1023
+ const chord = parts.join("+");
1024
+ this.steps.push(chord);
1025
+ const currentValue = this.buildRecordedHotkey();
1026
+ this.setState({
1027
+ recording: true,
1028
+ value: currentValue
1029
+ });
1030
+ const timeout = this.options.sequenceTimeoutMs ?? DEFAULT_SEQUENCE_TIMEOUT;
1031
+ this.sequenceTimerId = setTimeout(() => {
1032
+ this.finalize();
1033
+ }, timeout);
1034
+ }
1035
+ buildRecordedHotkey() {
1036
+ const value = this.steps.join(` > `);
1037
+ return {
1038
+ value,
1039
+ display: formatHotkey(value, {
1040
+ platform: this.platform,
1041
+ ...this.options.formatOptions
1042
+ })
1043
+ };
1044
+ }
1045
+ finalize() {
1046
+ this.detachListeners();
1047
+ this.clearSequenceTimer();
1048
+ const recorded = this.steps.length > 0 ? this.buildRecordedHotkey() : null;
1049
+ this.steps = [];
1050
+ this.setState({
1051
+ recording: false,
1052
+ value: recorded
1053
+ });
1054
+ if (recorded) this.options.onRecord?.(recorded);
1055
+ }
1056
+ clearSequenceTimer() {
1057
+ if (this.sequenceTimerId !== void 0) {
1058
+ clearTimeout(this.sequenceTimerId);
1059
+ this.sequenceTimerId = void 0;
1060
+ }
1061
+ }
1062
+ };
1063
+ function createHotkeyRecorder(options) {
1064
+ const recorder = new HotkeyRecorder(options);
1065
+ if (options?.target) recorder.init(options.target);
1066
+ return recorder;
1067
+ }
1068
+ //#endregion
1069
+ //#region src/common/hotkeys/validate.ts
1070
+ const KNOWN_SPECIAL_KEYS = /* @__PURE__ */ new Set([
1071
+ "Backspace",
1072
+ "Tab",
1073
+ "Clear",
1074
+ "Enter",
1075
+ "Escape",
1076
+ "ArrowUp",
1077
+ "ArrowDown",
1078
+ "ArrowLeft",
1079
+ "ArrowRight",
1080
+ "PageUp",
1081
+ "PageDown",
1082
+ "Home",
1083
+ "End",
1084
+ "Delete",
1085
+ "Insert",
1086
+ " "
1087
+ ]);
1088
+ const FUNCTION_KEY_REGEX = /^F([1-9]|1[0-9]|20)$/;
1089
+ function isKnownKey(key) {
1090
+ if (key.length === 1) return true;
1091
+ if (FUNCTION_KEY_REGEX.test(key)) return true;
1092
+ if (KNOWN_SPECIAL_KEYS.has(key)) return true;
1093
+ if (normalizeKey(key) !== key) return true;
1094
+ return false;
1095
+ }
1096
+ function validateHotkey(hotkey) {
1097
+ const errors = [];
1098
+ const warnings = [];
1099
+ if (!hotkey || !hotkey.trim()) {
1100
+ errors.push("Hotkey string is empty");
1101
+ return {
1102
+ valid: false,
1103
+ errors,
1104
+ warnings
1105
+ };
1106
+ }
1107
+ if (hotkey.includes(">")) {
1108
+ const steps = hotkey.split(">");
1109
+ for (let i = 0; i < steps.length; i++) {
1110
+ const step = steps[i].trim();
1111
+ if (!step) {
1112
+ errors.push(`Sequence step ${i + 1} is empty`);
1113
+ continue;
1114
+ }
1115
+ const stepResult = validateSingleHotkey(step);
1116
+ for (const err of stepResult.errors) errors.push(`Step ${i + 1}: ${err}`);
1117
+ for (const warn of stepResult.warnings) warnings.push(`Step ${i + 1}: ${warn}`);
1118
+ }
1119
+ } else {
1120
+ const result = validateSingleHotkey(hotkey);
1121
+ errors.push(...result.errors);
1122
+ warnings.push(...result.warnings);
1123
+ }
1124
+ return {
1125
+ valid: errors.length === 0,
1126
+ errors,
1127
+ warnings
1128
+ };
1129
+ }
1130
+ function validateSingleHotkey(hotkey) {
1131
+ const errors = [];
1132
+ const warnings = [];
1133
+ const parts = hotkey.split("+");
1134
+ if (parts.length === 0) {
1135
+ errors.push("Hotkey string is empty");
1136
+ return {
1137
+ errors,
1138
+ warnings
1139
+ };
1140
+ }
1141
+ const modifiers = [];
1142
+ let keyPart;
1143
+ for (let i = 0; i < parts.length; i++) {
1144
+ const part = parts[i].trim();
1145
+ if (i === parts.length - 1) if (isModifierSet(part) || part.toLowerCase() === "mod" || part.toLowerCase() === "controlormeta") {
1146
+ warnings.push(`"${hotkey}" contains only modifiers with no action key`);
1147
+ keyPart = part;
1148
+ } else keyPart = part;
1149
+ else if (!isModifierSet(part) && part.toLowerCase() !== "mod" && part.toLowerCase() !== "controlormeta") {
1150
+ if (part === "") {
1151
+ keyPart = "+";
1152
+ break;
1153
+ }
1154
+ errors.push(`"${part}" is not a recognized modifier`);
1155
+ } else {
1156
+ const lower = part.toLowerCase();
1157
+ if (modifiers.includes(lower)) warnings.push(`Duplicate modifier "${part}"`);
1158
+ modifiers.push(lower);
1159
+ }
1160
+ }
1161
+ if (keyPart !== void 0) {
1162
+ if (!isKnownKey(normalizeKey(keyPart)) && keyPart !== "+") warnings.push(`"${keyPart}" is not a commonly recognized key`);
1163
+ }
1164
+ return {
1165
+ errors,
1166
+ warnings
1167
+ };
1168
+ }
1169
+ function assertValidHotkey(hotkey) {
1170
+ const result = validateHotkey(hotkey);
1171
+ if (!result.valid) throw new Error(`Invalid hotkey "${hotkey}": ${result.errors.join(", ")}`);
1172
+ }
1173
+ //#endregion
1174
+ exports.HotkeyRecorder = HotkeyRecorder;
1175
+ exports.HotkeyStore = HotkeyStore;
1176
+ exports.assertValidHotkey = assertValidHotkey;
1177
+ exports.createHotkeyRecorder = createHotkeyRecorder;
1178
+ exports.createHotkeyStore = createHotkeyStore;
1179
+ exports.formatHotkey = formatHotkey;
1180
+ exports.isHotKey = isHotKey;
1181
+ exports.isHotkeyEqual = isHotkeyEqual;
1182
+ exports.parseHotkey = parseHotkey;
1183
+ exports.validateHotkey = validateHotkey;