@benev/tact 0.1.0-3 → 0.1.0-5

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 (410) hide show
  1. package/README.md +113 -104
  2. package/package.json +7 -7
  3. package/s/core/bindings/action.ts +14 -4
  4. package/s/core/bindings/parts/defaults.ts +4 -1
  5. package/s/core/bindings/parts/lens-algo.ts +21 -13
  6. package/s/core/bindings/parts/lookup-proxies.ts +17 -0
  7. package/s/core/bindings/resolver.ts +12 -12
  8. package/s/core/bindings/sample-map.ts +25 -0
  9. package/s/core/bindings/types.ts +4 -1
  10. package/s/core/core.test.ts +46 -34
  11. package/s/core/devices/auto-gamepads.ts +8 -0
  12. package/s/core/devices/device.ts +12 -0
  13. package/s/core/devices/infra/group.ts +24 -0
  14. package/s/core/devices/infra/sampler.ts +22 -0
  15. package/s/core/devices/standard/gamepad.ts +83 -0
  16. package/s/core/{controllers → devices}/standard/index.ts +2 -1
  17. package/s/core/devices/standard/keyboard.ts +31 -0
  18. package/s/core/{controllers → devices}/standard/pointer.ts +19 -11
  19. package/s/core/devices/standard/primary.ts +20 -0
  20. package/s/core/devices/standard/stick.ts +27 -0
  21. package/s/core/{controllers/standard/virtual-gamepad.ts → devices/standard/vpad.ts} +9 -9
  22. package/s/core/{controllers → devices}/types.ts +0 -1
  23. package/s/core/hub/hub.ts +78 -62
  24. package/s/core/hub/meta-bindings.ts +23 -0
  25. package/s/core/hub/parts/connected.ts +15 -0
  26. package/s/core/hub/port.ts +26 -0
  27. package/s/core/hub/types.ts +5 -6
  28. package/s/core/index.ts +12 -14
  29. package/s/core/testing/testing.ts +19 -14
  30. package/s/deck/components/components.ts +22 -0
  31. package/s/deck/components/deck-bindings/component.ts +99 -0
  32. package/s/deck/components/deck-bindings/style.css.ts +6 -0
  33. package/s/deck/components/deck-overlay/component.ts +51 -0
  34. package/s/deck/components/deck-overlay/style.css.ts +110 -0
  35. package/s/deck/components/framework.ts +17 -0
  36. package/s/deck/deck.ts +82 -0
  37. package/s/deck/index.ts +14 -0
  38. package/s/deck/parts/catalog.ts +58 -0
  39. package/s/deck/parts/db.ts +66 -0
  40. package/s/deck/parts/device-skins/device-icons.ts +38 -0
  41. package/s/deck/parts/device-skins/device-skin.ts +29 -0
  42. package/s/deck/parts/local-storage-kv.ts +8 -0
  43. package/s/deck/parts/merge-bindings.ts +21 -0
  44. package/s/deck/parts/overlay-visibility.ts +49 -0
  45. package/s/demo/game/game.ts +85 -0
  46. package/s/demo/game/parts/agent.ts +10 -0
  47. package/s/demo/game/parts/game-bindings.ts +20 -0
  48. package/s/demo/game/parts/logic.ts +24 -0
  49. package/s/demo/game/parts/player.ts +32 -0
  50. package/s/demo/game/parts/renderer.ts +113 -0
  51. package/s/demo/game/parts/state.ts +24 -0
  52. package/s/demo/game/parts/virtual-device.ts +13 -0
  53. package/s/demo/main.bundle.ts +9 -10
  54. package/s/demo/main.css +30 -2
  55. package/s/demo/ui/theater/styles.css.ts +58 -0
  56. package/s/demo/ui/theater/view.ts +60 -0
  57. package/s/demo/ui/theater/virtual/style.css.ts +43 -0
  58. package/s/demo/ui/theater/virtual/view.ts +31 -0
  59. package/s/demo/ui/utils/loader.ts +5 -0
  60. package/s/index.html.ts +17 -7
  61. package/s/index.ts +3 -1
  62. package/s/nubs/components.ts +14 -0
  63. package/s/nubs/index.ts +6 -0
  64. package/s/nubs/lookpad/component.ts +45 -0
  65. package/s/nubs/stick/component.ts +115 -0
  66. package/s/nubs/stick/style.css.ts +70 -0
  67. package/s/nubs/{virtual-gamepad/view.ts → vpad/component.ts} +21 -11
  68. package/s/nubs/{virtual-gamepad → vpad}/styles.css.ts +5 -4
  69. package/s/utils/circular-clamp.ts +15 -0
  70. package/s/utils/dispensers.ts +20 -0
  71. package/s/utils/split-axis.ts +10 -2
  72. package/s/utils/types.ts +19 -0
  73. package/x/core/bindings/action.d.ts +3 -1
  74. package/x/core/bindings/action.js +12 -4
  75. package/x/core/bindings/action.js.map +1 -1
  76. package/x/core/bindings/parts/defaults.js +4 -1
  77. package/x/core/bindings/parts/defaults.js.map +1 -1
  78. package/x/core/bindings/parts/lens-algo.js +18 -7
  79. package/x/core/bindings/parts/lens-algo.js.map +1 -1
  80. package/x/core/bindings/parts/lookup-proxies.d.ts +1 -0
  81. package/x/core/bindings/parts/lookup-proxies.js +19 -0
  82. package/x/core/bindings/parts/lookup-proxies.js.map +1 -0
  83. package/x/core/bindings/resolver.d.ts +5 -4
  84. package/x/core/bindings/resolver.js +12 -10
  85. package/x/core/bindings/resolver.js.map +1 -1
  86. package/x/core/bindings/sample-map.d.ts +7 -0
  87. package/x/core/bindings/sample-map.js +22 -0
  88. package/x/core/bindings/sample-map.js.map +1 -0
  89. package/x/core/bindings/types.d.ts +4 -1
  90. package/x/core/core.test.d.ts +5 -4
  91. package/x/core/core.test.js +45 -34
  92. package/x/core/core.test.js.map +1 -1
  93. package/x/core/devices/auto-gamepads.d.ts +2 -0
  94. package/x/core/devices/auto-gamepads.js +6 -0
  95. package/x/core/devices/auto-gamepads.js.map +1 -0
  96. package/x/core/devices/device.d.ts +5 -0
  97. package/x/core/devices/device.js +7 -0
  98. package/x/core/devices/device.js.map +1 -0
  99. package/x/core/devices/infra/group.d.ts +8 -0
  100. package/x/core/devices/infra/group.js +21 -0
  101. package/x/core/devices/infra/group.js.map +1 -0
  102. package/x/core/devices/infra/sampler.d.ts +9 -0
  103. package/x/core/devices/infra/sampler.js +18 -0
  104. package/x/core/devices/infra/sampler.js.map +1 -0
  105. package/x/core/devices/standard/gamepad.d.ts +11 -0
  106. package/x/core/devices/standard/gamepad.js +65 -0
  107. package/x/core/devices/standard/gamepad.js.map +1 -0
  108. package/x/core/{controllers → devices}/standard/index.d.ts +2 -1
  109. package/x/core/{controllers → devices}/standard/index.js +2 -1
  110. package/x/core/devices/standard/index.js.map +1 -0
  111. package/x/core/devices/standard/keyboard.d.ts +9 -0
  112. package/x/core/devices/standard/keyboard.js +28 -0
  113. package/x/core/devices/standard/keyboard.js.map +1 -0
  114. package/x/core/devices/standard/pointer.d.ts +15 -0
  115. package/x/core/{controllers → devices}/standard/pointer.js +18 -11
  116. package/x/core/devices/standard/pointer.js.map +1 -0
  117. package/x/core/devices/standard/primary.d.ts +10 -0
  118. package/x/core/devices/standard/primary.js +17 -0
  119. package/x/core/devices/standard/primary.js.map +1 -0
  120. package/x/core/devices/standard/stick.d.ts +15 -0
  121. package/x/core/devices/standard/stick.js +24 -0
  122. package/x/core/devices/standard/stick.js.map +1 -0
  123. package/x/core/devices/standard/vpad.d.ts +7 -0
  124. package/x/core/{controllers/standard/virtual-gamepad.js → devices/standard/vpad.js} +10 -10
  125. package/x/core/devices/standard/vpad.js.map +1 -0
  126. package/x/core/{controllers → devices}/types.d.ts +0 -1
  127. package/x/core/{controllers → devices}/types.js.map +1 -1
  128. package/x/core/hub/hub.d.ts +27 -23
  129. package/x/core/hub/hub.js +71 -61
  130. package/x/core/hub/hub.js.map +1 -1
  131. package/x/core/hub/meta-bindings.d.ts +2 -0
  132. package/x/core/hub/meta-bindings.js +21 -0
  133. package/x/core/hub/meta-bindings.js.map +1 -0
  134. package/x/core/hub/parts/connected.d.ts +14 -0
  135. package/x/core/hub/parts/connected.js +12 -0
  136. package/x/core/hub/parts/connected.js.map +1 -0
  137. package/x/core/hub/port.d.ts +10 -0
  138. package/x/core/hub/port.js +19 -0
  139. package/x/core/hub/port.js.map +1 -0
  140. package/x/core/hub/types.d.ts +5 -5
  141. package/x/core/hub/types.js +1 -1
  142. package/x/core/hub/types.js.map +1 -1
  143. package/x/core/index.d.ts +12 -12
  144. package/x/core/index.js +12 -12
  145. package/x/core/index.js.map +1 -1
  146. package/x/core/testing/testing.d.ts +13 -11
  147. package/x/core/testing/testing.js +14 -13
  148. package/x/core/testing/testing.js.map +1 -1
  149. package/x/deck/components/components.d.ts +14 -0
  150. package/x/deck/components/components.js +9 -0
  151. package/x/deck/components/components.js.map +1 -0
  152. package/x/deck/components/deck-bindings/component.d.ts +6 -0
  153. package/x/deck/components/deck-bindings/component.js +83 -0
  154. package/x/deck/components/deck-bindings/component.js.map +1 -0
  155. package/x/deck/components/deck-bindings/style.css.js +5 -0
  156. package/x/deck/components/deck-bindings/style.css.js.map +1 -0
  157. package/x/deck/components/deck-overlay/component.d.ts +6 -0
  158. package/x/deck/components/deck-overlay/component.js +44 -0
  159. package/x/deck/components/deck-overlay/component.js.map +1 -0
  160. package/x/deck/components/deck-overlay/style.css.d.ts +2 -0
  161. package/x/deck/components/deck-overlay/style.css.js +109 -0
  162. package/x/deck/components/deck-overlay/style.css.js.map +1 -0
  163. package/x/deck/components/framework.d.ts +7 -0
  164. package/x/deck/components/framework.js +13 -0
  165. package/x/deck/components/framework.js.map +1 -0
  166. package/x/deck/deck.d.ts +37 -0
  167. package/x/deck/deck.js +55 -0
  168. package/x/deck/deck.js.map +1 -0
  169. package/x/deck/index.d.ts +10 -0
  170. package/x/deck/index.js +11 -0
  171. package/x/deck/index.js.map +1 -0
  172. package/x/deck/parts/catalog.d.ts +23 -0
  173. package/x/deck/parts/catalog.js +35 -0
  174. package/x/deck/parts/catalog.js.map +1 -0
  175. package/x/deck/parts/db.d.ts +20 -0
  176. package/x/deck/parts/db.js +52 -0
  177. package/x/deck/parts/db.js.map +1 -0
  178. package/x/deck/parts/device-skins/device-icons.d.ts +12 -0
  179. package/x/deck/parts/device-skins/device-icons.js +27 -0
  180. package/x/deck/parts/device-skins/device-icons.js.map +1 -0
  181. package/x/deck/parts/device-skins/device-skin.d.ts +14 -0
  182. package/x/deck/parts/device-skins/device-skin.js +22 -0
  183. package/x/deck/parts/device-skins/device-skin.js.map +1 -0
  184. package/x/deck/parts/local-storage-kv.js +6 -0
  185. package/x/deck/parts/local-storage-kv.js.map +1 -0
  186. package/x/deck/parts/merge-bindings.d.ts +2 -0
  187. package/x/deck/parts/merge-bindings.js +15 -0
  188. package/x/deck/parts/merge-bindings.js.map +1 -0
  189. package/x/deck/parts/overlay-visibility.d.ts +21 -0
  190. package/x/deck/parts/overlay-visibility.js +35 -0
  191. package/x/deck/parts/overlay-visibility.js.map +1 -0
  192. package/x/demo/game/game.d.ts +20 -0
  193. package/x/demo/game/game.js +63 -0
  194. package/x/demo/game/game.js.map +1 -0
  195. package/x/demo/game/parts/agent.d.ts +7 -0
  196. package/x/demo/game/parts/agent.js +8 -0
  197. package/x/demo/game/parts/agent.js.map +1 -0
  198. package/x/demo/game/parts/game-bindings.d.ts +15 -0
  199. package/x/demo/game/parts/game-bindings.js +10 -0
  200. package/x/demo/game/parts/game-bindings.js.map +1 -0
  201. package/x/demo/game/parts/logic.d.ts +8 -0
  202. package/x/demo/game/parts/logic.js +21 -0
  203. package/x/demo/game/parts/logic.js.map +1 -0
  204. package/x/demo/game/parts/player.d.ts +14 -0
  205. package/x/demo/game/parts/player.js +26 -0
  206. package/x/demo/game/parts/player.js.map +1 -0
  207. package/x/demo/game/parts/renderer.d.ts +13 -0
  208. package/x/demo/game/parts/renderer.js +91 -0
  209. package/x/demo/game/parts/renderer.js.map +1 -0
  210. package/x/demo/game/parts/state.d.ts +8 -0
  211. package/x/demo/game/parts/state.js +20 -0
  212. package/x/demo/game/parts/state.js.map +1 -0
  213. package/x/demo/game/parts/virtual-device.d.ts +8 -0
  214. package/x/demo/game/parts/virtual-device.js +11 -0
  215. package/x/demo/game/parts/virtual-device.js.map +1 -0
  216. package/x/demo/main.bundle.js +9 -9
  217. package/x/demo/main.bundle.js.map +1 -1
  218. package/x/demo/main.bundle.min.js +361 -55
  219. package/x/demo/main.bundle.min.js.map +4 -4
  220. package/x/demo/main.css +30 -2
  221. package/x/demo/ui/theater/styles.css.js +57 -0
  222. package/x/demo/ui/theater/styles.css.js.map +1 -0
  223. package/x/demo/ui/theater/view.d.ts +368 -0
  224. package/x/demo/ui/theater/view.js +50 -0
  225. package/x/demo/ui/theater/view.js.map +1 -0
  226. package/x/demo/ui/theater/virtual/style.css.d.ts +2 -0
  227. package/x/demo/ui/theater/virtual/style.css.js +42 -0
  228. package/x/demo/ui/theater/virtual/style.css.js.map +1 -0
  229. package/x/demo/ui/theater/virtual/view.d.ts +4 -0
  230. package/x/demo/ui/theater/virtual/view.js +19 -0
  231. package/x/demo/ui/theater/virtual/view.js.map +1 -0
  232. package/x/demo/ui/utils/loader.d.ts +2 -0
  233. package/x/demo/ui/utils/loader.js +3 -0
  234. package/x/demo/ui/utils/loader.js.map +1 -0
  235. package/x/index.d.ts +3 -1
  236. package/x/index.html +48 -9
  237. package/x/index.html.js +17 -7
  238. package/x/index.html.js.map +1 -1
  239. package/x/index.js +3 -1
  240. package/x/index.js.map +1 -1
  241. package/x/nubs/components.d.ts +9 -0
  242. package/x/nubs/components.js +11 -0
  243. package/x/nubs/components.js.map +1 -0
  244. package/x/nubs/index.d.ts +4 -0
  245. package/x/nubs/index.js +5 -0
  246. package/x/nubs/index.js.map +1 -0
  247. package/x/nubs/lookpad/component.d.ts +4 -0
  248. package/x/nubs/lookpad/component.js +36 -0
  249. package/x/nubs/lookpad/component.js.map +1 -0
  250. package/x/nubs/stick/component.d.ts +368 -0
  251. package/x/nubs/stick/component.js +101 -0
  252. package/x/nubs/stick/component.js.map +1 -0
  253. package/x/nubs/stick/style.css.d.ts +2 -0
  254. package/x/nubs/stick/style.css.js +69 -0
  255. package/x/nubs/stick/style.css.js.map +1 -0
  256. package/x/nubs/vpad/component.d.ts +368 -0
  257. package/x/nubs/{virtual-gamepad/view.js → vpad/component.js} +20 -11
  258. package/x/nubs/vpad/component.js.map +1 -0
  259. package/x/nubs/vpad/styles.css.d.ts +2 -0
  260. package/x/nubs/{virtual-gamepad → vpad}/styles.css.js +4 -4
  261. package/x/nubs/vpad/styles.css.js.map +1 -0
  262. package/x/nubs/vpad/utils/gamepad-inputs.js.map +1 -0
  263. package/x/nubs/vpad/utils/prevent-default-touch-shenanigans.js.map +1 -0
  264. package/x/nubs/vpad/utils/touch-tracking.js.map +1 -0
  265. package/x/utils/circular-clamp.d.ts +2 -0
  266. package/x/utils/circular-clamp.js +8 -0
  267. package/x/utils/circular-clamp.js.map +1 -0
  268. package/x/utils/dispensers.d.ts +7 -0
  269. package/x/utils/dispensers.js +16 -0
  270. package/x/utils/dispensers.js.map +1 -0
  271. package/x/utils/split-axis.d.ts +7 -0
  272. package/x/utils/split-axis.js +7 -2
  273. package/x/utils/split-axis.js.map +1 -1
  274. package/x/utils/types.d.ts +3 -0
  275. package/x/utils/types.js +3 -0
  276. package/x/utils/types.js.map +1 -0
  277. package/s/core/controllers/controller.ts +0 -7
  278. package/s/core/controllers/infra/group.ts +0 -17
  279. package/s/core/controllers/infra/sampler.ts +0 -22
  280. package/s/core/controllers/standard/gamepad.ts +0 -77
  281. package/s/core/controllers/standard/keyboard.ts +0 -50
  282. package/s/core/controllers/standard/stick.ts +0 -30
  283. package/s/core/deck/deck.ts +0 -40
  284. package/s/core/deck/parts/bindings-depot.ts +0 -24
  285. package/s/core/deck/parts/local-storage-kv.ts +0 -7
  286. package/s/core/hub/auto-gamepads.ts +0 -8
  287. package/s/core/hub/bindings.ts +0 -18
  288. package/s/core/port/port.ts +0 -34
  289. package/s/core/port/utils/aggregate_samples_into_map.ts +0 -20
  290. package/s/core/port/utils/wipe_samples_map.ts +0 -8
  291. package/s/nubs/lookpad/utils/listeners.ts +0 -53
  292. package/s/nubs/lookpad/view.ts +0 -32
  293. package/s/nubs/stick/styles.ts +0 -22
  294. package/s/nubs/stick/utils/calculate_new_vector_from_pointer_position.ts +0 -27
  295. package/s/nubs/stick/utils/find_closest_point_on_circle.ts +0 -15
  296. package/s/nubs/stick/utils/make_pointer_listeners.ts +0 -50
  297. package/s/nubs/stick/utils/within_radius.ts +0 -6
  298. package/s/nubs/stick/view.ts +0 -50
  299. package/s/nubs/stick-graphic/styles.ts +0 -38
  300. package/s/nubs/stick-graphic/types/basis.ts +0 -5
  301. package/s/nubs/stick-graphic/utils/calculate_basis.ts +0 -19
  302. package/s/nubs/stick-graphic/utils/stick_vector_to_pixels.ts +0 -13
  303. package/s/nubs/stick-graphic/utils/transform.ts +0 -10
  304. package/s/nubs/stick-graphic/view.ts +0 -43
  305. package/x/core/controllers/controller.d.ts +0 -4
  306. package/x/core/controllers/controller.js +0 -3
  307. package/x/core/controllers/controller.js.map +0 -1
  308. package/x/core/controllers/infra/group.d.ts +0 -7
  309. package/x/core/controllers/infra/group.js +0 -13
  310. package/x/core/controllers/infra/group.js.map +0 -1
  311. package/x/core/controllers/infra/sampler.d.ts +0 -8
  312. package/x/core/controllers/infra/sampler.js +0 -17
  313. package/x/core/controllers/infra/sampler.js.map +0 -1
  314. package/x/core/controllers/standard/gamepad.d.ts +0 -9
  315. package/x/core/controllers/standard/gamepad.js +0 -66
  316. package/x/core/controllers/standard/gamepad.js.map +0 -1
  317. package/x/core/controllers/standard/index.js.map +0 -1
  318. package/x/core/controllers/standard/keyboard.d.ts +0 -9
  319. package/x/core/controllers/standard/keyboard.js +0 -39
  320. package/x/core/controllers/standard/keyboard.js.map +0 -1
  321. package/x/core/controllers/standard/pointer.d.ts +0 -11
  322. package/x/core/controllers/standard/pointer.js.map +0 -1
  323. package/x/core/controllers/standard/stick.d.ts +0 -15
  324. package/x/core/controllers/standard/stick.js +0 -27
  325. package/x/core/controllers/standard/stick.js.map +0 -1
  326. package/x/core/controllers/standard/virtual-gamepad.d.ts +0 -7
  327. package/x/core/controllers/standard/virtual-gamepad.js.map +0 -1
  328. package/x/core/deck/deck.d.ts +0 -16
  329. package/x/core/deck/deck.js +0 -31
  330. package/x/core/deck/deck.js.map +0 -1
  331. package/x/core/deck/parts/bindings-depot.d.ts +0 -9
  332. package/x/core/deck/parts/bindings-depot.js +0 -19
  333. package/x/core/deck/parts/bindings-depot.js.map +0 -1
  334. package/x/core/deck/parts/local-storage-kv.js +0 -5
  335. package/x/core/deck/parts/local-storage-kv.js.map +0 -1
  336. package/x/core/hub/auto-gamepads.d.ts +0 -2
  337. package/x/core/hub/auto-gamepads.js +0 -6
  338. package/x/core/hub/auto-gamepads.js.map +0 -1
  339. package/x/core/hub/bindings.d.ts +0 -2
  340. package/x/core/hub/bindings.js +0 -16
  341. package/x/core/hub/bindings.js.map +0 -1
  342. package/x/core/port/port.d.ts +0 -12
  343. package/x/core/port/port.js +0 -25
  344. package/x/core/port/port.js.map +0 -1
  345. package/x/core/port/utils/aggregate_samples_into_map.d.ts +0 -3
  346. package/x/core/port/utils/aggregate_samples_into_map.js +0 -11
  347. package/x/core/port/utils/aggregate_samples_into_map.js.map +0 -1
  348. package/x/core/port/utils/wipe_samples_map.d.ts +0 -2
  349. package/x/core/port/utils/wipe_samples_map.js +0 -5
  350. package/x/core/port/utils/wipe_samples_map.js.map +0 -1
  351. package/x/nubs/lookpad/utils/listeners.d.ts +0 -19
  352. package/x/nubs/lookpad/utils/listeners.js +0 -37
  353. package/x/nubs/lookpad/utils/listeners.js.map +0 -1
  354. package/x/nubs/lookpad/view.d.ts +0 -1
  355. package/x/nubs/lookpad/view.js +0 -24
  356. package/x/nubs/lookpad/view.js.map +0 -1
  357. package/x/nubs/stick/styles.d.ts +0 -1
  358. package/x/nubs/stick/styles.js +0 -22
  359. package/x/nubs/stick/styles.js.map +0 -1
  360. package/x/nubs/stick/utils/calculate_new_vector_from_pointer_position.d.ts +0 -3
  361. package/x/nubs/stick/utils/calculate_new_vector_from_pointer_position.js +0 -16
  362. package/x/nubs/stick/utils/calculate_new_vector_from_pointer_position.js.map +0 -1
  363. package/x/nubs/stick/utils/find_closest_point_on_circle.d.ts +0 -2
  364. package/x/nubs/stick/utils/find_closest_point_on_circle.js +0 -6
  365. package/x/nubs/stick/utils/find_closest_point_on_circle.js.map +0 -1
  366. package/x/nubs/stick/utils/make_pointer_listeners.d.ts +0 -16
  367. package/x/nubs/stick/utils/make_pointer_listeners.js +0 -34
  368. package/x/nubs/stick/utils/make_pointer_listeners.js.map +0 -1
  369. package/x/nubs/stick/utils/within_radius.d.ts +0 -2
  370. package/x/nubs/stick/utils/within_radius.js +0 -4
  371. package/x/nubs/stick/utils/within_radius.js.map +0 -1
  372. package/x/nubs/stick/view.d.ts +0 -2
  373. package/x/nubs/stick/view.js +0 -38
  374. package/x/nubs/stick/view.js.map +0 -1
  375. package/x/nubs/stick-graphic/styles.js +0 -38
  376. package/x/nubs/stick-graphic/styles.js.map +0 -1
  377. package/x/nubs/stick-graphic/types/basis.d.ts +0 -4
  378. package/x/nubs/stick-graphic/types/basis.js +0 -2
  379. package/x/nubs/stick-graphic/types/basis.js.map +0 -1
  380. package/x/nubs/stick-graphic/utils/calculate_basis.d.ts +0 -2
  381. package/x/nubs/stick-graphic/utils/calculate_basis.js +0 -10
  382. package/x/nubs/stick-graphic/utils/calculate_basis.js.map +0 -1
  383. package/x/nubs/stick-graphic/utils/stick_vector_to_pixels.d.ts +0 -2
  384. package/x/nubs/stick-graphic/utils/stick_vector_to_pixels.js +0 -7
  385. package/x/nubs/stick-graphic/utils/stick_vector_to_pixels.js.map +0 -1
  386. package/x/nubs/stick-graphic/utils/transform.d.ts +0 -2
  387. package/x/nubs/stick-graphic/utils/transform.js +0 -7
  388. package/x/nubs/stick-graphic/utils/transform.js.map +0 -1
  389. package/x/nubs/stick-graphic/view.d.ts +0 -3
  390. package/x/nubs/stick-graphic/view.js +0 -30
  391. package/x/nubs/stick-graphic/view.js.map +0 -1
  392. package/x/nubs/virtual-gamepad/styles.css.js.map +0 -1
  393. package/x/nubs/virtual-gamepad/utils/gamepad-inputs.js.map +0 -1
  394. package/x/nubs/virtual-gamepad/utils/prevent-default-touch-shenanigans.js.map +0 -1
  395. package/x/nubs/virtual-gamepad/utils/touch-tracking.js.map +0 -1
  396. package/x/nubs/virtual-gamepad/view.d.ts +0 -2
  397. package/x/nubs/virtual-gamepad/view.js.map +0 -1
  398. /package/s/nubs/{virtual-gamepad → vpad}/utils/gamepad-inputs.ts +0 -0
  399. /package/s/nubs/{virtual-gamepad → vpad}/utils/prevent-default-touch-shenanigans.ts +0 -0
  400. /package/s/nubs/{virtual-gamepad → vpad}/utils/touch-tracking.ts +0 -0
  401. /package/x/core/{controllers → devices}/types.js +0 -0
  402. /package/x/{nubs/virtual-gamepad/styles.css.d.ts → deck/components/deck-bindings/style.css.d.ts} +0 -0
  403. /package/x/{core/deck → deck}/parts/local-storage-kv.d.ts +0 -0
  404. /package/x/{nubs/stick-graphic/styles.d.ts → demo/ui/theater/styles.css.d.ts} +0 -0
  405. /package/x/nubs/{virtual-gamepad → vpad}/utils/gamepad-inputs.d.ts +0 -0
  406. /package/x/nubs/{virtual-gamepad → vpad}/utils/gamepad-inputs.js +0 -0
  407. /package/x/nubs/{virtual-gamepad → vpad}/utils/prevent-default-touch-shenanigans.d.ts +0 -0
  408. /package/x/nubs/{virtual-gamepad → vpad}/utils/prevent-default-touch-shenanigans.js +0 -0
  409. /package/x/nubs/{virtual-gamepad → vpad}/utils/touch-tracking.d.ts +0 -0
  410. /package/x/nubs/{virtual-gamepad → vpad}/utils/touch-tracking.js +0 -0
@@ -1,6 +1,6 @@
1
- function ne(r){return r.replace(/([a-zA-Z])(?=[A-Z])/g,"$1-").toLowerCase()}var nt=globalThis,it=nt.ShadowRoot&&(nt.ShadyCSS===void 0||nt.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,jt=Symbol(),ie=new WeakMap,W=class{constructor(t,e,s){if(this._$cssResult$=!0,s!==jt)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o,e=this.t;if(it&&t===void 0){let s=e!==void 0&&e.length===1;s&&(t=ie.get(e)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),s&&ie.set(e,t))}return t}toString(){return this.cssText}},ae=r=>new W(typeof r=="string"?r:r+"",void 0,jt),g=(r,...t)=>{let e=r.length===1?r[0]:t.reduce(((s,o,n)=>s+(i=>{if(i._$cssResult$===!0)return i.cssText;if(typeof i=="number")return i;throw Error("Value passed to 'css' function must be a 'css' function result: "+i+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(o)+r[n+1]),r[0]);return new W(e,r,jt)},at=(r,t)=>{if(it)r.adoptedStyleSheets=t.map((e=>e instanceof CSSStyleSheet?e:e.styleSheet));else for(let e of t){let s=document.createElement("style"),o=nt.litNonce;o!==void 0&&s.setAttribute("nonce",o),s.textContent=e.cssText,r.appendChild(s)}},I=it?r=>r:r=>r instanceof CSSStyleSheet?(t=>{let e="";for(let s of t.cssRules)e+=s.cssText;return ae(e)})(r):r;var{is:er,defineProperty:rr,getOwnPropertyDescriptor:sr,getOwnPropertyNames:or,getOwnPropertySymbols:nr,getPrototypeOf:ir}=Object,ct=globalThis,ce=ct.trustedTypes,ar=ce?ce.emptyScript:"",cr=ct.reactiveElementPolyfillSupport,Z=(r,t)=>r,Ot={toAttribute(r,t){switch(t){case Boolean:r=r?ar:null;break;case Object:case Array:r=r==null?r:JSON.stringify(r)}return r},fromAttribute(r,t){let e=r;switch(t){case Boolean:e=r!==null;break;case Number:e=r===null?null:Number(r);break;case Object:case Array:try{e=JSON.parse(r)}catch{e=null}}return e}},le=(r,t)=>!er(r,t),ue={attribute:!0,type:String,converter:Ot,reflect:!1,useDefault:!1,hasChanged:le};Symbol.metadata??=Symbol("metadata"),ct.litPropertyMetadata??=new WeakMap;var A=class extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??=[]).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,e=ue){if(e.state&&(e.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(t)&&((e=Object.create(e)).wrapped=!0),this.elementProperties.set(t,e),!e.noAccessor){let s=Symbol(),o=this.getPropertyDescriptor(t,s,e);o!==void 0&&rr(this.prototype,t,o)}}static getPropertyDescriptor(t,e,s){let{get:o,set:n}=sr(this.prototype,t)??{get(){return this[e]},set(i){this[e]=i}};return{get:o,set(i){let c=o?.call(this);n?.call(this,i),this.requestUpdate(t,c,s)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??ue}static _$Ei(){if(this.hasOwnProperty(Z("elementProperties")))return;let t=ir(this);t.finalize(),t.l!==void 0&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(Z("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(Z("properties"))){let e=this.properties,s=[...or(e),...nr(e)];for(let o of s)this.createProperty(o,e[o])}let t=this[Symbol.metadata];if(t!==null){let e=litPropertyMetadata.get(t);if(e!==void 0)for(let[s,o]of e)this.elementProperties.set(s,o)}this._$Eh=new Map;for(let[e,s]of this.elementProperties){let o=this._$Eu(e,s);o!==void 0&&this._$Eh.set(o,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){let e=[];if(Array.isArray(t)){let s=new Set(t.flat(1/0).reverse());for(let o of s)e.unshift(I(o))}else t!==void 0&&e.push(I(t));return e}static _$Eu(t,e){let s=e.attribute;return s===!1?void 0:typeof s=="string"?s:typeof t=="string"?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise((t=>this.enableUpdating=t)),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach((t=>t(this)))}addController(t){(this._$EO??=new Set).add(t),this.renderRoot!==void 0&&this.isConnected&&t.hostConnected?.()}removeController(t){this._$EO?.delete(t)}_$E_(){let t=new Map,e=this.constructor.elementProperties;for(let s of e.keys())this.hasOwnProperty(s)&&(t.set(s,this[s]),delete this[s]);t.size>0&&(this._$Ep=t)}createRenderRoot(){let t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return at(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach((t=>t.hostConnected?.()))}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach((t=>t.hostDisconnected?.()))}attributeChangedCallback(t,e,s){this._$AK(t,s)}_$ET(t,e){let s=this.constructor.elementProperties.get(t),o=this.constructor._$Eu(t,s);if(o!==void 0&&s.reflect===!0){let n=(s.converter?.toAttribute!==void 0?s.converter:Ot).toAttribute(e,s.type);this._$Em=t,n==null?this.removeAttribute(o):this.setAttribute(o,n),this._$Em=null}}_$AK(t,e){let s=this.constructor,o=s._$Eh.get(t);if(o!==void 0&&this._$Em!==o){let n=s.getPropertyOptions(o),i=typeof n.converter=="function"?{fromAttribute:n.converter}:n.converter?.fromAttribute!==void 0?n.converter:Ot;this._$Em=o;let c=i.fromAttribute(e,n.type);this[o]=c??this._$Ej?.get(o)??c,this._$Em=null}}requestUpdate(t,e,s){if(t!==void 0){let o=this.constructor,n=this[t];if(s??=o.getPropertyOptions(t),!((s.hasChanged??le)(n,e)||s.useDefault&&s.reflect&&n===this._$Ej?.get(t)&&!this.hasAttribute(o._$Eu(t,s))))return;this.C(t,e,s)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(t,e,{useDefault:s,reflect:o,wrapped:n},i){s&&!(this._$Ej??=new Map).has(t)&&(this._$Ej.set(t,i??e??this[t]),n!==!0||i!==void 0)||(this._$AL.has(t)||(this.hasUpdated||s||(e=void 0),this._$AL.set(t,e)),o===!0&&this._$Em!==t&&(this._$Eq??=new Set).add(t))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}let t=this.scheduleUpdate();return t!=null&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(let[o,n]of this._$Ep)this[o]=n;this._$Ep=void 0}let s=this.constructor.elementProperties;if(s.size>0)for(let[o,n]of s){let{wrapped:i}=n,c=this[o];i!==!0||this._$AL.has(o)||c===void 0||this.C(o,void 0,n,c)}}let t=!1,e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),this._$EO?.forEach((s=>s.hostUpdate?.())),this.update(e)):this._$EM()}catch(s){throw t=!1,this._$EM(),s}t&&this._$AE(e)}willUpdate(t){}_$AE(t){this._$EO?.forEach((e=>e.hostUpdated?.())),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Eq&&=this._$Eq.forEach((e=>this._$ET(e,this[e]))),this._$EM()}updated(t){}firstUpdated(t){}};A.elementStyles=[],A.shadowRootOptions={mode:"open"},A[Z("elementProperties")]=new Map,A[Z("finalized")]=new Map,cr?.({ReactiveElement:A}),(ct.reactiveElementVersions??=[]).push("2.1.1");var Tt=globalThis,ut=Tt.trustedTypes,he=ut?ut.createPolicy("lit-html",{createHTML:r=>r}):void 0,Nt="$lit$",B=`lit$${Math.random().toFixed(9).slice(2)}$`,It="?"+B,ur=`<${It}>`,C=document,K=()=>C.createComment(""),Q=r=>r===null||typeof r!="object"&&typeof r!="function",Ht=Array.isArray,xe=r=>Ht(r)||typeof r?.[Symbol.iterator]=="function",zt=`[
2
- \f\r]`,J=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,pe=/-->/g,fe=/>/g,k=RegExp(`>|${zt}(?:([^\\s"'>=/]+)(${zt}*=${zt}*(?:[^
3
- \f\r"'\`<>=]|("|')|))|$)`,"g"),de=/'/g,me=/"/g,ge=/^(?:script|style|textarea|title)$/i,Ut=r=>(t,...e)=>({_$litType$:r,strings:t,values:e}),U=Ut(1),zr=Ut(2),Tr=Ut(3),P=Symbol.for("lit-noChange"),y=Symbol.for("lit-nothing"),ye=new WeakMap,M=C.createTreeWalker(C,129);function be(r,t){if(!Ht(r)||!r.hasOwnProperty("raw"))throw Error("invalid template strings array");return he!==void 0?he.createHTML(t):t}var we=(r,t)=>{let e=r.length-1,s=[],o,n=t===2?"<svg>":t===3?"<math>":"",i=J;for(let c=0;c<e;c++){let a=r[c],u,h,l=-1,m=0;for(;m<a.length&&(i.lastIndex=m,h=i.exec(a),h!==null);)m=i.lastIndex,i===J?h[1]==="!--"?i=pe:h[1]!==void 0?i=fe:h[2]!==void 0?(ge.test(h[2])&&(o=RegExp("</"+h[2],"g")),i=k):h[3]!==void 0&&(i=k):i===k?h[0]===">"?(i=o??J,l=-1):h[1]===void 0?l=-2:(l=i.lastIndex-h[2].length,u=h[1],i=h[3]===void 0?k:h[3]==='"'?me:de):i===me||i===de?i=k:i===pe||i===fe?i=J:(i=k,o=void 0);let S=i===k&&r[c+1].startsWith("/>")?" ":"";n+=i===J?a+ur:l>=0?(s.push(u),a.slice(0,l)+Nt+a.slice(l)+B+S):a+B+(l===-2?c:S)}return[be(r,n+(r[e]||"<?>")+(t===2?"</svg>":t===3?"</math>":"")),s]},Y=class r{constructor({strings:t,_$litType$:e},s){let o;this.parts=[];let n=0,i=0,c=t.length-1,a=this.parts,[u,h]=we(t,e);if(this.el=r.createElement(u,s),M.currentNode=this.el.content,e===2||e===3){let l=this.el.content.firstChild;l.replaceWith(...l.childNodes)}for(;(o=M.nextNode())!==null&&a.length<c;){if(o.nodeType===1){if(o.hasAttributes())for(let l of o.getAttributeNames())if(l.endsWith(Nt)){let m=h[i++],S=o.getAttribute(l).split(B),ot=/([.?@])?(.*)/.exec(m);a.push({type:1,index:n,name:ot[2],strings:S,ctor:ot[1]==="."?ht:ot[1]==="?"?pt:ot[1]==="@"?ft:O}),o.removeAttribute(l)}else l.startsWith(B)&&(a.push({type:6,index:n}),o.removeAttribute(l));if(ge.test(o.tagName)){let l=o.textContent.split(B),m=l.length-1;if(m>0){o.textContent=ut?ut.emptyScript:"";for(let S=0;S<m;S++)o.append(l[S],K()),M.nextNode(),a.push({type:2,index:++n});o.append(l[m],K())}}}else if(o.nodeType===8)if(o.data===It)a.push({type:2,index:n});else{let l=-1;for(;(l=o.data.indexOf(B,l+1))!==-1;)a.push({type:7,index:n}),l+=B.length-1}n++}}static createElement(t,e){let s=C.createElement("template");return s.innerHTML=t,s}};function j(r,t,e=r,s){if(t===P)return t;let o=s!==void 0?e._$Co?.[s]:e._$Cl,n=Q(t)?void 0:t._$litDirective$;return o?.constructor!==n&&(o?._$AO?.(!1),n===void 0?o=void 0:(o=new n(r),o._$AT(r,e,s)),s!==void 0?(e._$Co??=[])[s]=o:e._$Cl=o),o!==void 0&&(t=j(r,o._$AS(r,t.values),o,s)),t}var lt=class{constructor(t,e){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){let{el:{content:e},parts:s}=this._$AD,o=(t?.creationScope??C).importNode(e,!0);M.currentNode=o;let n=M.nextNode(),i=0,c=0,a=s[0];for(;a!==void 0;){if(i===a.index){let u;a.type===2?u=new H(n,n.nextSibling,this,t):a.type===1?u=new a.ctor(n,a.name,a.strings,this,t):a.type===6&&(u=new dt(n,this,t)),this._$AV.push(u),a=s[++c]}i!==a?.index&&(n=M.nextNode(),i++)}return M.currentNode=C,o}p(t){let e=0;for(let s of this._$AV)s!==void 0&&(s.strings!==void 0?(s._$AI(t,s,e),e+=s.strings.length-2):s._$AI(t[e])),e++}},H=class r{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,e,s,o){this.type=2,this._$AH=y,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=s,this.options=o,this._$Cv=o?.isConnected??!0}get parentNode(){let t=this._$AA.parentNode,e=this._$AM;return e!==void 0&&t?.nodeType===11&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=j(this,t,e),Q(t)?t===y||t==null||t===""?(this._$AH!==y&&this._$AR(),this._$AH=y):t!==this._$AH&&t!==P&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):xe(t)?this.k(t):this._(t)}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}_(t){this._$AH!==y&&Q(this._$AH)?this._$AA.nextSibling.data=t:this.T(C.createTextNode(t)),this._$AH=t}$(t){let{values:e,_$litType$:s}=t,o=typeof s=="number"?this._$AC(t):(s.el===void 0&&(s.el=Y.createElement(be(s.h,s.h[0]),this.options)),s);if(this._$AH?._$AD===o)this._$AH.p(e);else{let n=new lt(o,this),i=n.u(this.options);n.p(e),this.T(i),this._$AH=n}}_$AC(t){let e=ye.get(t.strings);return e===void 0&&ye.set(t.strings,e=new Y(t)),e}k(t){Ht(this._$AH)||(this._$AH=[],this._$AR());let e=this._$AH,s,o=0;for(let n of t)o===e.length?e.push(s=new r(this.O(K()),this.O(K()),this,this.options)):s=e[o],s._$AI(n),o++;o<e.length&&(this._$AR(s&&s._$AB.nextSibling,o),e.length=o)}_$AR(t=this._$AA.nextSibling,e){for(this._$AP?.(!1,!0,e);t!==this._$AB;){let s=t.nextSibling;t.remove(),t=s}}setConnected(t){this._$AM===void 0&&(this._$Cv=t,this._$AP?.(t))}},O=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,s,o,n){this.type=1,this._$AH=y,this._$AN=void 0,this.element=t,this.name=e,this._$AM=o,this.options=n,s.length>2||s[0]!==""||s[1]!==""?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=y}_$AI(t,e=this,s,o){let n=this.strings,i=!1;if(n===void 0)t=j(this,t,e,0),i=!Q(t)||t!==this._$AH&&t!==P,i&&(this._$AH=t);else{let c=t,a,u;for(t=n[0],a=0;a<n.length-1;a++)u=j(this,c[s+a],e,a),u===P&&(u=this._$AH[a]),i||=!Q(u)||u!==this._$AH[a],u===y?t=y:t!==y&&(t+=(u??"")+n[a+1]),this._$AH[a]=u}i&&!o&&this.j(t)}j(t){t===y?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}},ht=class extends O{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===y?void 0:t}},pt=class extends O{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==y)}},ft=class extends O{constructor(t,e,s,o,n){super(t,e,s,o,n),this.type=5}_$AI(t,e=this){if((t=j(this,t,e,0)??y)===P)return;let s=this._$AH,o=t===y&&s!==y||t.capture!==s.capture||t.once!==s.once||t.passive!==s.passive,n=t!==y&&(s===y||o);o&&this.element.removeEventListener(this.name,this,s),n&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t)}},dt=class{constructor(t,e,s){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=s}get _$AU(){return this._$AM._$AU}_$AI(t){j(this,t)}},ve={M:Nt,P:B,A:It,C:1,L:we,R:lt,D:xe,V:j,I:H,H:O,N:pt,U:ft,B:ht,F:dt},lr=Tt.litHtmlPolyfillSupport;lr?.(Y,H),(Tt.litHtmlVersions??=[]).push("3.3.1");var E=(r,t,e)=>{let s=e?.renderBefore??t,o=s._$litPart$;if(o===void 0){let n=e?.renderBefore??null;s._$litPart$=o=new H(t.insertBefore(K(),n),n,void 0,e??{})}return o._$AI(r),o};var Dt=globalThis,D=class extends A{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){let t=super.createRenderRoot();return this.renderOptions.renderBefore??=t.firstChild,t}update(t){let e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=E(e,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return P}};D._$litElement$=!0,D.finalized=!0,Dt.litElementHydrateSupport?.({LitElement:D});var hr=Dt.litElementPolyfillSupport;hr?.({LitElement:D});(Dt.litElementVersions??=[]).push("4.2.1");function mt(r,t={}){let{soft:e=!1,upgrade:s=!0}=t;for(let[o,n]of Object.entries(r)){let i=ne(o),c=customElements.get(i);e&&c||(customElements.define(i,n),s&&document.querySelectorAll(i).forEach(a=>{a.constructor===HTMLElement&&customElements.upgrade(a)}))}}function q(r,t=document){let e=t.querySelector(r);if(!e)throw new Error(`$1 ${r} not found`);return e}function pr(r,t=document){return Array.from(t.querySelectorAll(r))}q.maybe=(r,t=document)=>t.querySelector(r);q.all=pr;q.render=(r,...t)=>E(t,r);q.register=mt;var w=Object.freeze({eq(r,t){if(r.length!==t.length)return!1;for(let e=0;e<=r.length;e++)if(r.at(e)!==t.at(e))return!1;return!0},random(r){return crypto.getRandomValues(new Uint8Array(r))}});var z=Object.freeze({fromBytes(r){return[...r].map(t=>t.toString(16).padStart(2,"0")).join("")},toBytes(r){if(r.length%2!==0)throw new Error("must have even number of hex characters");let t=new Uint8Array(r.length/2);for(let e=0;e<r.length;e+=2)t[e/2]=parseInt(r.slice(e,e+2),16);return t},random(r=32){return this.fromBytes(w.random(r))},string(r){return z.fromBytes(r)},bytes(r){return z.toBytes(r)}});var qt=58,yt="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",Rt=Object.freeze({fromBytes(r){let t=BigInt("0x"+z.fromBytes(r)),e="";for(;t>0;){let s=t%BigInt(qt);t=t/BigInt(qt),e=yt[Number(s)]+e}for(let s of r)if(s===0)e=yt[0]+e;else break;return e},toBytes(r){let t=BigInt(0);for(let i of r){let c=yt.indexOf(i);if(c===-1)throw new Error(`Invalid character '${i}' in base58 string`);t=t*BigInt(qt)+BigInt(c)}let e=t.toString(16);e.length%2!==0&&(e="0"+e);let s=z.toBytes(e),o=0;for(let i of r)if(i===yt[0])o++;else break;let n=new Uint8Array(o+s.length);return n.set(s,o),n},random(r=32){return this.fromBytes(w.random(r))},string(r){return Rt.fromBytes(r)},bytes(r){return Rt.toBytes(r)}});var $e=class{lexicon;static lexicons=Object.freeze({base2:{characters:"01"},hex:{characters:"0123456789abcdef"},base36:{characters:"0123456789abcdefghijklmnopqrstuvwxyz"},base58:{characters:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"},base62:{characters:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"},base64url:{negativePrefix:"~",characters:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"},base64:{characters:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",padding:{character:"=",size:4}}});lookup;negativePrefix;constructor(t){this.lexicon=t,this.lookup=Object.fromEntries([...t.characters].map((e,s)=>[e,s])),this.negativePrefix=t.negativePrefix??"-"}toBytes(t){let e=Math.log2(this.lexicon.characters.length);if(Number.isInteger(e)){let c=0,a=0,u=[];for(let h of t){if(h===this.lexicon.padding?.character)continue;let l=this.lookup[h];if(l===void 0)throw new Error(`Invalid character: ${h}`);for(c=c<<e|l,a+=e;a>=8;)a-=8,u.push(c>>a&255)}return new Uint8Array(u)}let s=0n,o=BigInt(this.lexicon.characters.length),n=!1;t.startsWith(this.negativePrefix)&&(t=t.slice(this.negativePrefix.length),n=!0);for(let c of t){let a=this.lookup[c];if(a===void 0)throw new Error(`Invalid character: ${c}`);s=s*o+BigInt(a)}let i=[];for(;s>0n;)i.unshift(Number(s%256n)),s=s/256n;return new Uint8Array(i)}fromBytes(t){let e=Math.log2(this.lexicon.characters.length);if(Number.isInteger(e)){let i=0,c=0,a="";for(let u of t)for(i=i<<8|u,c+=8;c>=e;){c-=e;let h=i>>c&(1<<e)-1;a+=this.lexicon.characters[h]}if(c>0){let u=i<<e-c&(1<<e)-1;a+=this.lexicon.characters[u]}if(this.lexicon.padding)for(;a.length%this.lexicon.padding.size!==0;)a+=this.lexicon.padding.character;return a}let s=0n;for(let i of t)s=(s<<8n)+BigInt(i);if(s===0n)return this.lexicon.characters[0];let o=BigInt(this.lexicon.characters.length),n="";for(;s>0n;)n=this.lexicon.characters[Number(s%o)]+n,s=s/o;return n}toInteger(t){if(!t)return 0;let e=0n,s=!1,o=BigInt(this.lexicon.characters.length);t.startsWith(this.negativePrefix)&&(t=t.slice(this.negativePrefix.length),s=!0);for(let n of t){let i=this.lookup[n];if(i===void 0)throw new Error(`Invalid character: ${n}`);e=e*o+BigInt(i)}return Number(s?-e:e)}fromInteger(t){t=Math.floor(t);let e=t<0,s=BigInt(e?-t:t);if(s===0n)return this.lexicon.characters[0];let o=BigInt(this.lexicon.characters.length),n="";for(;s>0n;)n=this.lexicon.characters[Number(s%o)]+n,s=s/o;return e?`${this.negativePrefix}${n}`:n}random(t=32){return this.fromBytes(w.random(t))}};var Lt=Object.freeze({fromBytes(r){return typeof btoa=="function"?btoa(String.fromCharCode(...r)):Buffer.from(r).toString("base64")},toBytes(r){return typeof atob=="function"?Uint8Array.from(atob(r),t=>t.charCodeAt(0)):Uint8Array.from(Buffer.from(r,"base64"))},random(r=32){return this.fromBytes(w.random(r))},string(r){return Lt.fromBytes(r)},bytes(r){return Lt.toBytes(r)}});var _e=Object.freeze({fromBytes(r){return new TextDecoder().decode(r)},toBytes(r){return new TextEncoder().encode(r)},string(r){return _e.fromBytes(r)},bytes(r){return _e.toBytes(r)}});function Ae(r,t){let e,s,o=[];function n(){e=[],s&&clearTimeout(s),s=void 0,o=[]}return n(),((...i)=>{e=i,s&&clearTimeout(s);let c=new Promise((a,u)=>{o.push({resolve:a,reject:u})});return s=setTimeout(()=>{Promise.resolve().then(()=>t(...e)).then(a=>{for(let{resolve:u}of o)u(a);n()}).catch(a=>{for(let{reject:u}of o)u(a);n()})},r),c})}var Vt=Object.freeze({happy:r=>r!=null,sad:r=>r==null,boolean:r=>typeof r=="boolean",number:r=>typeof r=="number",string:r=>typeof r=="string",bigint:r=>typeof r=="bigint",object:r=>typeof r=="object"&&r!==null,array:r=>Array.isArray(r),fn:r=>typeof r=="function",symbol:r=>typeof r=="symbol"});function X(){let r,t,e=new Promise((o,n)=>{r=o,t=n});function s(o){return o.then(r).catch(t),e}return{promise:e,resolve:r,reject:t,entangle:s}}var R=class r extends Map{static require(t,e){if(t.has(e))return t.get(e);throw new Error(`required key not found: "${e}"`)}static guarantee(t,e,s){if(t.has(e))return t.get(e);{let o=s();return t.set(e,o),o}}array(){return[...this]}require(t){return r.require(this,t)}guarantee(t,e){return r.guarantee(this,t,e)}};var Be=(r=0)=>new Promise(t=>setTimeout(t,r));function fr(r){return{map:t=>Se(r,t),filter:t=>Ee(r,t)}}fr.pipe=Object.freeze({map:r=>(t=>Se(t,r)),filter:r=>(t=>Ee(t,r))});var Se=(r,t)=>Object.fromEntries(Object.entries(r).map(([e,s])=>[e,t(s,e)])),Ee=(r,t)=>Object.fromEntries(Object.entries(r).filter(([e,s])=>t(s,e)));function ke(){let r=new Set;async function t(...a){await Promise.all([...r].map(u=>u(...a)))}function e(a){return r.add(a),()=>{r.delete(a)}}async function s(...a){return t(...a)}function o(a){return e(a)}async function n(a){let{promise:u,resolve:h}=X(),l=o(async(...m)=>{a&&await a(...m),h(m),l()});return u}function i(){r.clear()}let c={pub:s,sub:o,publish:t,subscribe:e,on:e,next:n,clear:i};return Object.assign(o,c),Object.assign(s,c),c}function Me(r){let t=ke();return r&&t.sub(r),t.sub}function Ft(r){let t=ke();return r&&t.sub(r),t.pub}function Ce(r){let t,e=!1,s=()=>{e=!0,clearTimeout(t)},o=async()=>{e||(await r(s),!e&&(t=setTimeout(o,0)))};return o(),s}var v=Object.freeze({eq(r,t){if(r.length!==t.length)return!1;for(let e=0;e<=r.length;e++)if(r.at(e)!==t.at(e))return!1;return!0},random(r){return crypto.getRandomValues(new Uint8Array(r))}});var T=Object.freeze({fromBytes(r){return[...r].map(t=>t.toString(16).padStart(2,"0")).join("")},toBytes(r){if(r.length%2!==0)throw new Error("must have even number of hex characters");let t=new Uint8Array(r.length/2);for(let e=0;e<r.length;e+=2)t[e/2]=parseInt(r.slice(e,e+2),16);return t},random(r=32){return this.fromBytes(v.random(r))},string(r){return T.fromBytes(r)},bytes(r){return T.toBytes(r)}});var Wt=58,xt="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",Zt=Object.freeze({fromBytes(r){let t=BigInt("0x"+T.fromBytes(r)),e="";for(;t>0;){let s=t%BigInt(Wt);t=t/BigInt(Wt),e=xt[Number(s)]+e}for(let s of r)if(s===0)e=xt[0]+e;else break;return e},toBytes(r){let t=BigInt(0);for(let i of r){let c=xt.indexOf(i);if(c===-1)throw new Error(`Invalid character '${i}' in base58 string`);t=t*BigInt(Wt)+BigInt(c)}let e=t.toString(16);e.length%2!==0&&(e="0"+e);let s=T.toBytes(e),o=0;for(let i of r)if(i===xt[0])o++;else break;let n=new Uint8Array(o+s.length);return n.set(s,o),n},random(r=32){return this.fromBytes(v.random(r))},string(r){return Zt.fromBytes(r)},bytes(r){return Zt.toBytes(r)}});var Pe=class{lexicon;static lexicons=Object.freeze({base2:{characters:"01"},hex:{characters:"0123456789abcdef"},base36:{characters:"0123456789abcdefghijklmnopqrstuvwxyz"},base58:{characters:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"},base62:{characters:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"},base64url:{negativePrefix:"~",characters:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"},base64:{characters:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",padding:{character:"=",size:4}}});lookup;negativePrefix;constructor(t){this.lexicon=t,this.lookup=Object.fromEntries([...t.characters].map((e,s)=>[e,s])),this.negativePrefix=t.negativePrefix??"-"}toBytes(t){let e=Math.log2(this.lexicon.characters.length);if(Number.isInteger(e)){let c=0,a=0,u=[];for(let h of t){if(h===this.lexicon.padding?.character)continue;let l=this.lookup[h];if(l===void 0)throw new Error(`Invalid character: ${h}`);for(c=c<<e|l,a+=e;a>=8;)a-=8,u.push(c>>a&255)}return new Uint8Array(u)}let s=0n,o=BigInt(this.lexicon.characters.length),n=!1;t.startsWith(this.negativePrefix)&&(t=t.slice(this.negativePrefix.length),n=!0);for(let c of t){let a=this.lookup[c];if(a===void 0)throw new Error(`Invalid character: ${c}`);s=s*o+BigInt(a)}let i=[];for(;s>0n;)i.unshift(Number(s%256n)),s=s/256n;return new Uint8Array(i)}fromBytes(t){let e=Math.log2(this.lexicon.characters.length);if(Number.isInteger(e)){let i=0,c=0,a="";for(let u of t)for(i=i<<8|u,c+=8;c>=e;){c-=e;let h=i>>c&(1<<e)-1;a+=this.lexicon.characters[h]}if(c>0){let u=i<<e-c&(1<<e)-1;a+=this.lexicon.characters[u]}if(this.lexicon.padding)for(;a.length%this.lexicon.padding.size!==0;)a+=this.lexicon.padding.character;return a}let s=0n;for(let i of t)s=(s<<8n)+BigInt(i);if(s===0n)return this.lexicon.characters[0];let o=BigInt(this.lexicon.characters.length),n="";for(;s>0n;)n=this.lexicon.characters[Number(s%o)]+n,s=s/o;return n}toInteger(t){if(!t)return 0;let e=0n,s=!1,o=BigInt(this.lexicon.characters.length);t.startsWith(this.negativePrefix)&&(t=t.slice(this.negativePrefix.length),s=!0);for(let n of t){let i=this.lookup[n];if(i===void 0)throw new Error(`Invalid character: ${n}`);e=e*o+BigInt(i)}return Number(s?-e:e)}fromInteger(t){t=Math.floor(t);let e=t<0,s=BigInt(e?-t:t);if(s===0n)return this.lexicon.characters[0];let o=BigInt(this.lexicon.characters.length),n="";for(;s>0n;)n=this.lexicon.characters[Number(s%o)]+n,s=s/o;return e?`${this.negativePrefix}${n}`:n}random(t=32){return this.fromBytes(v.random(t))}};var Jt=Object.freeze({fromBytes(r){return typeof btoa=="function"?btoa(String.fromCharCode(...r)):Buffer.from(r).toString("base64")},toBytes(r){return typeof atob=="function"?Uint8Array.from(atob(r),t=>t.charCodeAt(0)):Uint8Array.from(Buffer.from(r,"base64"))},random(r=32){return this.fromBytes(v.random(r))},string(r){return Jt.fromBytes(r)},bytes(r){return Jt.toBytes(r)}});var je=Object.freeze({fromBytes(r){return new TextDecoder().decode(r)},toBytes(r){return new TextEncoder().encode(r)},string(r){return je.fromBytes(r)},bytes(r){return je.toBytes(r)}});function Kt(r,t){let e,s,o=[];function n(){e=[],s&&clearTimeout(s),s=void 0,o=[]}return n(),((...i)=>{e=i,s&&clearTimeout(s);let c=new Promise((a,u)=>{o.push({resolve:a,reject:u})});return s=setTimeout(()=>{Promise.resolve().then(()=>t(...e)).then(a=>{for(let{resolve:u}of o)u(a);n()}).catch(a=>{for(let{reject:u}of o)u(a);n()})},r),c})}var Qt=Object.freeze({set:r=>r!=null,unset:r=>r==null,boolean:r=>typeof r=="boolean",number:r=>typeof r=="number",string:r=>typeof r=="string",bigint:r=>typeof r=="bigint",object:r=>typeof r=="object"&&r!==null,array:r=>Array.isArray(r),fn:r=>typeof r=="function",symbol:r=>typeof r=="symbol"});function Oe(){let r,t,e=new Promise((o,n)=>{r=o,t=n});function s(o){return o.then(r).catch(t),e}return{promise:e,resolve:r,reject:t,entangle:s}}function dr(r){return{map:t=>ze(r,t),filter:t=>Te(r,t)}}dr.pipe=Object.freeze({map:r=>(t=>ze(t,r)),filter:r=>(t=>Te(t,r))});var ze=(r,t)=>Object.fromEntries(Object.entries(r).map(([e,s])=>[e,t(s,e)])),Te=(r,t)=>Object.fromEntries(Object.entries(r).filter(([e,s])=>t(s,e)));function mr(){let r=new Set;function t(n){return r.add(n),()=>{r.delete(n)}}async function e(...n){await Promise.all([...r].map(i=>i(...n)))}async function s(){let{promise:n,resolve:i}=Oe(),c=t((...a)=>{i(a),c()});return n}function o(){r.clear()}return t.pub=e,t.sub=t,t.on=t,t.next=s,t.clear=o,e.pub=e,e.sub=t,e.on=t,e.next=s,e.clear=o,[e,t]}function gt(r){let t=mr()[1];return r&&t.sub(r),t}var Yt=class{#t=[];#e=new WeakMap;#r=[];#s=new Set;notifyRead(t){this.#t.at(-1)?.add(t)}async notifyWrite(t){if(this.#s.has(t))throw new Error("circularity forbidden");let e=this.#o(t).pub();return this.#r.at(-1)?.add(e),e}observe(t){this.#t.push(new Set);let e=t();return{seen:this.#t.pop(),result:e}}subscribe(t,e){return this.#o(t)(async()=>{let s=new Set;this.#r.push(s),this.#s.add(t),s.add(e()),this.#s.delete(t),await Promise.all(s),this.#r.pop()})}#o(t){let e=this.#e.get(t);return e||(e=gt(),this.#e.set(t,e)),e}},b=globalThis[Symbol.for("e280.tracker")]??=new Yt;var{I:la}=ve;var Ne=r=>r.strings===void 0;var Ie={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},wt=r=>(...t)=>({_$litDirective$:r,values:t}),bt=class{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,s){this._$Ct=t,this._$AM=e,this._$Ci=s}_$AS(t,e){return this.update(t,e)}update(t,e){return this.render(...e)}};var G=(r,t)=>{let e=r._$AN;if(e===void 0)return!1;for(let s of e)s._$AO?.(t,!1),G(s,t);return!0},vt=r=>{let t,e;do{if((t=r._$AM)===void 0)break;e=t._$AN,e.delete(r),r=t}while(e?.size===0)},He=r=>{for(let t;t=r._$AM;r=t){let e=t._$AN;if(e===void 0)t._$AN=e=new Set;else if(e.has(r))break;e.add(r),gr(t)}};function yr(r){this._$AN!==void 0?(vt(this),this._$AM=r,He(this)):this._$AM=r}function xr(r,t=!1,e=0){let s=this._$AH,o=this._$AN;if(o!==void 0&&o.size!==0)if(t)if(Array.isArray(s))for(let n=e;n<s.length;n++)G(s[n],!1),vt(s[n]);else s!=null&&(G(s,!1),vt(s));else G(this,r)}var gr=r=>{r.type==Ie.CHILD&&(r._$AP??=xr,r._$AQ??=yr)},$t=class extends bt{constructor(){super(...arguments),this._$AN=void 0}_$AT(t,e,s){super._$AT(t,e,s),He(this),this.isConnected=t._$AU}_$AO(t,e=!0){t!==this.isConnected&&(this.isConnected=t,t?this.reconnected?.():this.disconnected?.()),e&&(G(this,t),vt(this))}setValue(t){if(Ne(this._$Ct))this._$Ct._$AI(t,this);else{let e=[...this._$Ct._$AH];e[this._$Ci]=t,this._$Ct._$AI(e,this,0)}}disconnected(){}reconnected(){}};function Ue(r,t){for(let[e,s]of Object.entries(t))s===void 0||s===null?r.removeAttribute(e):typeof s=="string"?r.setAttribute(e,s):typeof s=="number"?r.setAttribute(e,s.toString()):typeof s=="boolean"?s===!0?r.setAttribute(e,""):r.removeAttribute(e):console.warn(`invalid attribute type ${e} is ${typeof s}`)}function _t(r,t){at(r,br(t))}function br(r){let t=[];if(Array.isArray(r)){let e=new Set(r.flat(1/0).reverse());for(let s of e)t.unshift(I(s))}else r!==void 0&&t.push(I(r));return t}function Xt(r,t=r){let{seen:e,result:s}=b.observe(r),o=Kt(0,t),n=[],i=()=>n.forEach(c=>c());for(let c of e){let a=b.subscribe(c,o);n.push(a)}return{result:s,dispose:i}}var wr={compare:(r,t)=>r===t};function L(r={}){return{...wr,...r}}var At=class{sneak;constructor(t){this.sneak=t}get(){return b.notifyRead(this),this.sneak}get value(){return this.get()}},Bt=class extends At{on=gt();dispose(){this.on.clear()}},tt=class extends Bt{_options;kind="signal";_lock=!1;constructor(t,e){super(t),this._options=e}async set(t){return!this._options.compare(this.sneak,t)&&await this.publish(t),t}get value(){return this.get()}set value(t){this.set(t)}async publish(t=this.get()){if(this._lock)throw new Error("forbid circularity");let e=Promise.resolve();try{this._lock=!0,this.sneak=t,e=Promise.all([b.notifyWrite(this),this.on.pub(t)])}finally{this._lock=!1}return await e,t}},et=class extends At{_formula;_options;kind="lazy";_dirty=!1;_effect;constructor(t,e){super(void 0),this._formula=t,this._options=e}get(){if(!this._effect){let{result:t,dispose:e}=Xt(this._formula,()=>this._dirty=!0);this._effect=e,this.sneak=t}if(this._dirty){this._dirty=!1;let t=this._formula();!this._options.compare(this.sneak,t)&&(this.sneak=t,b.notifyWrite(this))}return super.get()}get value(){return this.get()}dispose(){this._effect&&this._effect()}},rt=class extends Bt{_effect;static make(t,e,s){let{result:o,dispose:n}=Xt(e,async()=>{let i=e();!s.compare(t.sneak,i)&&(t.sneak=i,await Promise.all([b.notifyWrite(t),t.on.pub(i)]))});return new this(o,n)}kind="derived";constructor(t,e){super(t),this._effect=e}get value(){return this.get()}dispose(){super.dispose(),this._effect()}};function De(r,t={}){function e(){return e.value}let s=L(t),o=rt.make(e,r,s);return Object.setPrototypeOf(e,rt.prototype),Object.assign(e,o),e}function qe(r,t={}){function e(){return e.value}let s=L(t),o=new et(r,s);return Object.setPrototypeOf(e,et.prototype),Object.assign(e,o),e}function $(r,t={}){function e(n){return n!==void 0?e.set(n):e.get()}let s=L(t),o=new tt(r,s);return Object.setPrototypeOf(e,tt.prototype),Object.assign(e,o),e}$.lazy=qe;$.derive=De;var N={status:r=>r[0],value:r=>r[0]==="ready"?r[1]:void 0,error:r=>r[0]==="error"?r[1]:void 0,select:(r,t)=>{switch(r[0]){case"loading":return t.loading();case"error":return t.error(r[1]);case"ready":return t.ready(r[1]);default:throw new Error("unknown op status")}},morph:(r,t)=>N.select(r,{loading:()=>["loading"],error:e=>["error",e],ready:e=>["ready",t(e)]}),all:(...r)=>{let t=[],e=[],s=0;for(let o of r)switch(o[0]){case"loading":s++;break;case"ready":t.push(o[1]);break;case"error":e.push(o[1]);break}return e.length>0?["error",e]:s===0?["ready",t]:["loading"]}};var st=class{static loading(){return new this}static ready(t){return new this(["ready",t])}static error(t){return new this(["error",t])}static promise(t){let e=new this;return e.promise(t),e}static fn(t){return this.promise(t())}static all(...t){let e=t.map(s=>s.pod);return N.all(...e)}signal;#t=0;#e=Ft();#r=Ft();constructor(t=["loading"]){this.signal=$(t)}get wait(){return new Promise((t,e)=>{this.#e.next().then(([s])=>t(s)),this.#r.next().then(([s])=>e(s))})}get then(){return this.wait.then.bind(this.wait)}get catch(){return this.wait.catch.bind(this.wait)}get finally(){return this.wait.finally.bind(this.wait)}async setLoading(){await this.signal(["loading"])}async setReady(t){await this.signal(["ready",t]),await this.#e(t)}async setError(t){await this.signal(["error",t]),await this.#r(t)}async promise(t){let e=++this.#t;await this.setLoading();try{let s=await t;return e===this.#t&&await this.setReady(s),s}catch(s){e===this.#t&&await this.setError(s)}}async fn(t){return this.promise(t())}get pod(){return this.signal()}set pod(t){this.signal(t)}get status(){return this.signal()[0]}get value(){return N.value(this.signal())}get error(){return N.error(this.signal())}get isLoading(){return this.status==="loading"}get isReady(){return this.status==="ready"}get isError(){return this.status==="error"}require(){let t=this.signal();if(t[0]!=="ready")throw new Error("required value not ready");return t[1]}select(t){return N.select(this.signal(),t)}morph(t){return N.morph(this.pod,t)}};var St=class{#t=[];#e=[];mount(t){this.#t.push(t),this.#e.push(t())}unmountAll(){for(let t of this.#e)t();this.#e=[]}remountAll(){for(let t of this.#t)this.#e.push(t())}};var Re=(r,t)=>new Proxy(t,{get:(e,s)=>{let o=t[s],n=r.getAttribute(s);switch(o){case String:return n??void 0;case Number:return n!==null?Number(n):void 0;case Boolean:return n!==null;default:throw new Error(`invalid attribute type for "${s}"`)}},set:(e,s,o)=>{switch(t[s]){case String:return r.setAttribute(s,o),!0;case Number:return r.setAttribute(s,o.toString()),!0;case Boolean:return o?r.setAttribute(s,""):r.removeAttribute(s),!0;default:throw new Error(`invalid attribute type for "${s}"`)}}});function Le(r,t){let e=new MutationObserver(t);return e.observe(r,{attributes:!0}),()=>e.disconnect()}var Gt=Symbol(),te=Symbol(),ee=Symbol(),Et=class{element;shadow;renderNow;render;#t=0;#e=0;#r=new R;#s=X();#o=new St;[Gt](t){this.#t++,this.#e=0,this.#s=X();let e=t();return this.#s.resolve(),e}[te](){this.#o.unmountAll()}[ee](){this.#o.remountAll()}constructor(t,e,s,o){this.element=t,this.shadow=e,this.renderNow=s,this.render=o}get renderCount(){return this.#t}get rendered(){return this.#s.promise}name(t){this.once(()=>this.element.setAttribute("view",t))}styles(...t){this.once(()=>_t(this.shadow,t))}css(...t){return this.styles(...t)}attrs(t){return this.mount(()=>Le(this.element,this.render)),this.once(()=>Re(this.element,t))}once(t){return this.#r.guarantee(this.#e++,t)}mount(t){return this.once(()=>this.#o.mount(t))}life(t){let e;return this.mount(()=>{let[s,o]=t();return e=s,o}),e}wake(t){return this.life(()=>[t(),()=>{}])}op=(()=>{let t=this;function e(s){return t.once(()=>st.fn(s))}return e.fn=e,e.promise=s=>this.once(()=>st.promise(s)),e})();signal(t){return this.once(()=>$(t))}};var _=Ve({mode:"open"}),re=class extends HTMLElement{};mt({SlyView:re},{soft:!0,upgrade:!0});function Ve(r){function t(e){let s=i=>class extends $t{#t=i.getElement();#e=this.#t.attachShadow(r);#r=Ae(0,()=>this.#i());#s=new R;#o;#n=new Et(this.#t,this.#e,()=>this.#i(),this.#r);#a=(()=>{let a=e(this.#n);return this.#t.setAttribute("view",r.name??""),r.styles&&_t(this.#e,r.styles),a})();#i(){if(!this.#o||!this.isConnected)return;let{with:a,props:u}=this.#o;this.#n[Gt](()=>{Ue(this.#t,a.attrs);let{result:h,seen:l}=b.observe(()=>this.#a(...u));E(h,this.#e);for(let m of l)this.#s.guarantee(m,()=>b.subscribe(m,async()=>this.#r()));i.isComponent||E(a.children,this.#t)})}render(a,u){return this.#o={with:a,props:u},this.#i(),i.isComponent?null:this.#t}disconnected(){this.#n[te]();for(let a of this.#s.values())a();this.#s.clear()}reconnected(){this.#n[ee]()}},o=wt(s({getElement:()=>document.createElement(r.tag??"sly-view"),isComponent:!1}));function n(i){let c=(...a)=>o(i,a);return c.props=c,c.with=a=>n({...i,...a}),c.children=(...a)=>n({...i,children:a}),c.attrs=a=>n({...i,attrs:a}),c.attr=(a,u)=>n({...i,attrs:{...i.attrs,[a]:u}}),c.component=(...a)=>class extends HTMLElement{#t=wt(s({getElement:()=>this,isComponent:!0}));constructor(){super(),this.render(...a)}render(...u){this.isConnected&&E(this.#t(i,u),this)}},c}return n({attrs:{},children:null})}return t.view=t,t.settings=e=>Ve({...r,...e}),t.component=e=>t(s=>()=>e(s)).component(),t}var kt=g`
1
+ var ie=globalThis,oe=ie.ShadowRoot&&(ie.ShadyCSS===void 0||ie.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,hr=Symbol(),Cr=new WeakMap,Dt=class{constructor(t,e,s){if(this._$cssResult$=!0,s!==hr)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o,e=this.t;if(oe&&t===void 0){let s=e!==void 0&&e.length===1;s&&(t=Cr.get(e)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),s&&Cr.set(e,t))}return t}toString(){return this.cssText}},Pr=r=>new Dt(typeof r=="string"?r:r+"",void 0,hr),_=(r,...t)=>{let e=r.length===1?r[0]:t.reduce(((s,i,o)=>s+(n=>{if(n._$cssResult$===!0)return n.cssText;if(typeof n=="number")return n;throw Error("Value passed to 'css' function must be a 'css' function result: "+n+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+r[o+1]),r[0]);return new Dt(e,r,hr)},ne=(r,t)=>{if(oe)r.adoptedStyleSheets=t.map((e=>e instanceof CSSStyleSheet?e:e.styleSheet));else for(let e of t){let s=document.createElement("style"),i=ie.litNonce;i!==void 0&&s.setAttribute("nonce",i),s.textContent=e.cssText,r.appendChild(s)}},nt=oe?r=>r:r=>r instanceof CSSStyleSheet?(t=>{let e="";for(let s of t.cssRules)e+=s.cssText;return Pr(e)})(r):r;var{is:Os,defineProperty:Rs,getOwnPropertyDescriptor:Ds,getOwnPropertyNames:Ts,getOwnPropertySymbols:zs,getPrototypeOf:js}=Object,ae=globalThis,Br=ae.trustedTypes,Ns=Br?Br.emptyScript:"",Ls=ae.reactiveElementPolyfillSupport,Tt=(r,t)=>r,pr={toAttribute(r,t){switch(t){case Boolean:r=r?Ns:null;break;case Object:case Array:r=r==null?r:JSON.stringify(r)}return r},fromAttribute(r,t){let e=r;switch(t){case Boolean:e=r!==null;break;case Number:e=r===null?null:Number(r);break;case Object:case Array:try{e=JSON.parse(r)}catch{e=null}}return e}},Rr=(r,t)=>!Os(r,t),Or={attribute:!0,type:String,converter:pr,reflect:!1,useDefault:!1,hasChanged:Rr};Symbol.metadata??=Symbol("metadata"),ae.litPropertyMetadata??=new WeakMap;var L=class extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??=[]).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,e=Or){if(e.state&&(e.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(t)&&((e=Object.create(e)).wrapped=!0),this.elementProperties.set(t,e),!e.noAccessor){let s=Symbol(),i=this.getPropertyDescriptor(t,s,e);i!==void 0&&Rs(this.prototype,t,i)}}static getPropertyDescriptor(t,e,s){let{get:i,set:o}=Ds(this.prototype,t)??{get(){return this[e]},set(n){this[e]=n}};return{get:i,set(n){let c=i?.call(this);o?.call(this,n),this.requestUpdate(t,c,s)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??Or}static _$Ei(){if(this.hasOwnProperty(Tt("elementProperties")))return;let t=js(this);t.finalize(),t.l!==void 0&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(Tt("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(Tt("properties"))){let e=this.properties,s=[...Ts(e),...zs(e)];for(let i of s)this.createProperty(i,e[i])}let t=this[Symbol.metadata];if(t!==null){let e=litPropertyMetadata.get(t);if(e!==void 0)for(let[s,i]of e)this.elementProperties.set(s,i)}this._$Eh=new Map;for(let[e,s]of this.elementProperties){let i=this._$Eu(e,s);i!==void 0&&this._$Eh.set(i,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){let e=[];if(Array.isArray(t)){let s=new Set(t.flat(1/0).reverse());for(let i of s)e.unshift(nt(i))}else t!==void 0&&e.push(nt(t));return e}static _$Eu(t,e){let s=e.attribute;return s===!1?void 0:typeof s=="string"?s:typeof t=="string"?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise((t=>this.enableUpdating=t)),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach((t=>t(this)))}addController(t){(this._$EO??=new Set).add(t),this.renderRoot!==void 0&&this.isConnected&&t.hostConnected?.()}removeController(t){this._$EO?.delete(t)}_$E_(){let t=new Map,e=this.constructor.elementProperties;for(let s of e.keys())this.hasOwnProperty(s)&&(t.set(s,this[s]),delete this[s]);t.size>0&&(this._$Ep=t)}createRenderRoot(){let t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return ne(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach((t=>t.hostConnected?.()))}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach((t=>t.hostDisconnected?.()))}attributeChangedCallback(t,e,s){this._$AK(t,s)}_$ET(t,e){let s=this.constructor.elementProperties.get(t),i=this.constructor._$Eu(t,s);if(i!==void 0&&s.reflect===!0){let o=(s.converter?.toAttribute!==void 0?s.converter:pr).toAttribute(e,s.type);this._$Em=t,o==null?this.removeAttribute(i):this.setAttribute(i,o),this._$Em=null}}_$AK(t,e){let s=this.constructor,i=s._$Eh.get(t);if(i!==void 0&&this._$Em!==i){let o=s.getPropertyOptions(i),n=typeof o.converter=="function"?{fromAttribute:o.converter}:o.converter?.fromAttribute!==void 0?o.converter:pr;this._$Em=i;let c=n.fromAttribute(e,o.type);this[i]=c??this._$Ej?.get(i)??c,this._$Em=null}}requestUpdate(t,e,s){if(t!==void 0){let i=this.constructor,o=this[t];if(s??=i.getPropertyOptions(t),!((s.hasChanged??Rr)(o,e)||s.useDefault&&s.reflect&&o===this._$Ej?.get(t)&&!this.hasAttribute(i._$Eu(t,s))))return;this.C(t,e,s)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(t,e,{useDefault:s,reflect:i,wrapped:o},n){s&&!(this._$Ej??=new Map).has(t)&&(this._$Ej.set(t,n??e??this[t]),o!==!0||n!==void 0)||(this._$AL.has(t)||(this.hasUpdated||s||(e=void 0),this._$AL.set(t,e)),i===!0&&this._$Em!==t&&(this._$Eq??=new Set).add(t))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}let t=this.scheduleUpdate();return t!=null&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(let[i,o]of this._$Ep)this[i]=o;this._$Ep=void 0}let s=this.constructor.elementProperties;if(s.size>0)for(let[i,o]of s){let{wrapped:n}=o,c=this[i];n!==!0||this._$AL.has(i)||c===void 0||this.C(i,void 0,o,c)}}let t=!1,e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),this._$EO?.forEach((s=>s.hostUpdate?.())),this.update(e)):this._$EM()}catch(s){throw t=!1,this._$EM(),s}t&&this._$AE(e)}willUpdate(t){}_$AE(t){this._$EO?.forEach((e=>e.hostUpdated?.())),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Eq&&=this._$Eq.forEach((e=>this._$ET(e,this[e]))),this._$EM()}updated(t){}firstUpdated(t){}};L.elementStyles=[],L.shadowRootOptions={mode:"open"},L[Tt("elementProperties")]=new Map,L[Tt("finalized")]=new Map,Ls?.({ReactiveElement:L}),(ae.reactiveElementVersions??=[]).push("2.1.1");var dr=globalThis,ce=dr.trustedTypes,Dr=ce?ce.createPolicy("lit-html",{createHTML:r=>r}):void 0,mr="$lit$",H=`lit$${Math.random().toFixed(9).slice(2)}$`,fr="?"+H,Hs=`<${fr}>`,Q=document,jt=()=>Q.createComment(""),Nt=r=>r===null||typeof r!="object"&&typeof r!="function",gr=Array.isArray,Hr=r=>gr(r)||typeof r?.[Symbol.iterator]=="function",ur=`[
2
+ \f\r]`,zt=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Tr=/-->/g,zr=/>/g,J=RegExp(`>|${ur}(?:([^\\s"'>=/]+)(${ur}*=${ur}*(?:[^
3
+ \f\r"'\`<>=]|("|')|))|$)`,"g"),jr=/'/g,Nr=/"/g,Vr=/^(?:script|style|textarea|title)$/i,yr=r=>(t,...e)=>({_$litType$:r,strings:t,values:e}),v=yr(1),bi=yr(2),wi=yr(3),V=Symbol.for("lit-noChange"),S=Symbol.for("lit-nothing"),Lr=new WeakMap,Z=Q.createTreeWalker(Q,129);function qr(r,t){if(!gr(r)||!r.hasOwnProperty("raw"))throw Error("invalid template strings array");return Dr!==void 0?Dr.createHTML(t):t}var Ur=(r,t)=>{let e=r.length-1,s=[],i,o=t===2?"<svg>":t===3?"<math>":"",n=zt;for(let c=0;c<e;c++){let a=r[c],l,p,h=-1,u=0;for(;u<a.length&&(n.lastIndex=u,p=n.exec(a),p!==null);)u=n.lastIndex,n===zt?p[1]==="!--"?n=Tr:p[1]!==void 0?n=zr:p[2]!==void 0?(Vr.test(p[2])&&(i=RegExp("</"+p[2],"g")),n=J):p[3]!==void 0&&(n=J):n===J?p[0]===">"?(n=i??zt,h=-1):p[1]===void 0?h=-2:(h=n.lastIndex-p[2].length,l=p[1],n=p[3]===void 0?J:p[3]==='"'?Nr:jr):n===Nr||n===jr?n=J:n===Tr||n===zr?n=zt:(n=J,i=void 0);let m=n===J&&r[c+1].startsWith("/>")?" ":"";o+=n===zt?a+Hs:h>=0?(s.push(l),a.slice(0,h)+mr+a.slice(h)+H+m):a+H+(h===-2?c:m)}return[qr(r,o+(r[e]||"<?>")+(t===2?"</svg>":t===3?"</math>":"")),s]},Lt=class r{constructor({strings:t,_$litType$:e},s){let i;this.parts=[];let o=0,n=0,c=t.length-1,a=this.parts,[l,p]=Ur(t,e);if(this.el=r.createElement(l,s),Z.currentNode=this.el.content,e===2||e===3){let h=this.el.content.firstChild;h.replaceWith(...h.childNodes)}for(;(i=Z.nextNode())!==null&&a.length<c;){if(i.nodeType===1){if(i.hasAttributes())for(let h of i.getAttributeNames())if(h.endsWith(mr)){let u=p[n++],m=i.getAttribute(h).split(H),w=/([.?@])?(.*)/.exec(u);a.push({type:1,index:o,name:w[2],strings:m,ctor:w[1]==="."?he:w[1]==="?"?pe:w[1]==="@"?ue:et}),i.removeAttribute(h)}else h.startsWith(H)&&(a.push({type:6,index:o}),i.removeAttribute(h));if(Vr.test(i.tagName)){let h=i.textContent.split(H),u=h.length-1;if(u>0){i.textContent=ce?ce.emptyScript:"";for(let m=0;m<u;m++)i.append(h[m],jt()),Z.nextNode(),a.push({type:2,index:++o});i.append(h[u],jt())}}}else if(i.nodeType===8)if(i.data===fr)a.push({type:2,index:o});else{let h=-1;for(;(h=i.data.indexOf(H,h+1))!==-1;)a.push({type:7,index:o}),h+=H.length-1}o++}}static createElement(t,e){let s=Q.createElement("template");return s.innerHTML=t,s}};function tt(r,t,e=r,s){if(t===V)return t;let i=s!==void 0?e._$Co?.[s]:e._$Cl,o=Nt(t)?void 0:t._$litDirective$;return i?.constructor!==o&&(i?._$AO?.(!1),o===void 0?i=void 0:(i=new o(r),i._$AT(r,e,s)),s!==void 0?(e._$Co??=[])[s]=i:e._$Cl=i),i!==void 0&&(t=tt(r,i._$AS(r,t.values),i,s)),t}var le=class{constructor(t,e){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){let{el:{content:e},parts:s}=this._$AD,i=(t?.creationScope??Q).importNode(e,!0);Z.currentNode=i;let o=Z.nextNode(),n=0,c=0,a=s[0];for(;a!==void 0;){if(n===a.index){let l;a.type===2?l=new at(o,o.nextSibling,this,t):a.type===1?l=new a.ctor(o,a.name,a.strings,this,t):a.type===6&&(l=new de(o,this,t)),this._$AV.push(l),a=s[++c]}n!==a?.index&&(o=Z.nextNode(),n++)}return Z.currentNode=Q,i}p(t){let e=0;for(let s of this._$AV)s!==void 0&&(s.strings!==void 0?(s._$AI(t,s,e),e+=s.strings.length-2):s._$AI(t[e])),e++}},at=class r{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,e,s,i){this.type=2,this._$AH=S,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=s,this.options=i,this._$Cv=i?.isConnected??!0}get parentNode(){let t=this._$AA.parentNode,e=this._$AM;return e!==void 0&&t?.nodeType===11&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=tt(this,t,e),Nt(t)?t===S||t==null||t===""?(this._$AH!==S&&this._$AR(),this._$AH=S):t!==this._$AH&&t!==V&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):Hr(t)?this.k(t):this._(t)}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}_(t){this._$AH!==S&&Nt(this._$AH)?this._$AA.nextSibling.data=t:this.T(Q.createTextNode(t)),this._$AH=t}$(t){let{values:e,_$litType$:s}=t,i=typeof s=="number"?this._$AC(t):(s.el===void 0&&(s.el=Lt.createElement(qr(s.h,s.h[0]),this.options)),s);if(this._$AH?._$AD===i)this._$AH.p(e);else{let o=new le(i,this),n=o.u(this.options);o.p(e),this.T(n),this._$AH=o}}_$AC(t){let e=Lr.get(t.strings);return e===void 0&&Lr.set(t.strings,e=new Lt(t)),e}k(t){gr(this._$AH)||(this._$AH=[],this._$AR());let e=this._$AH,s,i=0;for(let o of t)i===e.length?e.push(s=new r(this.O(jt()),this.O(jt()),this,this.options)):s=e[i],s._$AI(o),i++;i<e.length&&(this._$AR(s&&s._$AB.nextSibling,i),e.length=i)}_$AR(t=this._$AA.nextSibling,e){for(this._$AP?.(!1,!0,e);t!==this._$AB;){let s=t.nextSibling;t.remove(),t=s}}setConnected(t){this._$AM===void 0&&(this._$Cv=t,this._$AP?.(t))}},et=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,s,i,o){this.type=1,this._$AH=S,this._$AN=void 0,this.element=t,this.name=e,this._$AM=i,this.options=o,s.length>2||s[0]!==""||s[1]!==""?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=S}_$AI(t,e=this,s,i){let o=this.strings,n=!1;if(o===void 0)t=tt(this,t,e,0),n=!Nt(t)||t!==this._$AH&&t!==V,n&&(this._$AH=t);else{let c=t,a,l;for(t=o[0],a=0;a<o.length-1;a++)l=tt(this,c[s+a],e,a),l===V&&(l=this._$AH[a]),n||=!Nt(l)||l!==this._$AH[a],l===S?t=S:t!==S&&(t+=(l??"")+o[a+1]),this._$AH[a]=l}n&&!i&&this.j(t)}j(t){t===S?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}},he=class extends et{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===S?void 0:t}},pe=class extends et{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==S)}},ue=class extends et{constructor(t,e,s,i,o){super(t,e,s,i,o),this.type=5}_$AI(t,e=this){if((t=tt(this,t,e,0)??S)===V)return;let s=this._$AH,i=t===S&&s!==S||t.capture!==s.capture||t.once!==s.once||t.passive!==s.passive,o=t!==S&&(s===S||i);i&&this.element.removeEventListener(this.name,this,s),o&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t)}},de=class{constructor(t,e,s){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=s}get _$AU(){return this._$AM._$AU}_$AI(t){tt(this,t)}},Ir={M:mr,P:H,A:fr,C:1,L:Ur,R:le,D:Hr,V:tt,I:at,H:et,N:pe,U:ue,B:he,F:de},Vs=dr.litHtmlPolyfillSupport;Vs?.(Lt,at),(dr.litHtmlVersions??=[]).push("3.3.1");var Ht=(r,t,e)=>{let s=e?.renderBefore??t,i=s._$litPart$;if(i===void 0){let o=e?.renderBefore??null;s._$litPart$=i=new at(t.insertBefore(jt(),o),o,void 0,e??{})}return i._$AI(r),i};var xr=globalThis,ct=class extends L{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){let t=super.createRenderRoot();return this.renderOptions.renderBefore??=t.firstChild,t}update(t){let e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=Ht(e,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return V}};ct._$litElement$=!0,ct.finalized=!0,xr.litElementHydrateSupport?.({LitElement:ct});var qs=xr.litElementPolyfillSupport;qs?.({LitElement:ct});(xr.litElementVersions??=[]).push("4.2.1");var C=_`
4
4
  @layer reset {
5
5
  * {
6
6
  margin: 0;
@@ -16,92 +16,397 @@ function ne(r){return r.replace(/([a-zA-Z])(?=[A-Z])/g,"$1-").toLowerCase()}var
16
16
  ::-webkit-scrollbar-thumb { background: #333; border-radius: 1em; }
17
17
  ::-webkit-scrollbar-thumb:hover { background: #444; }
18
18
  }
19
- `;function p(r,t){return()=>vr({hz:r,frames:t})}var vr=_(r=>({hz:t,frames:e})=>{r.name("loading"),r.styles(kt,$r);let s=r.signal(0);return r.mount(()=>Ce(async()=>{await Be(1e3/t);let o=s()+1;s(o>=e.length?0:o)})),e.at(s())}),$r=g`
19
+ `;var me=Object.freeze({eq(r,t){if(r.length!==t.length)return!1;for(let e=0;e<=r.length;e++)if(r.at(e)!==t.at(e))return!1;return!0},random(r){return crypto.getRandomValues(new Uint8Array(r))}});var q=Object.freeze({fromBytes(r){return[...r].map(t=>t.toString(16).padStart(2,"0")).join("")},toBytes(r){if(r.length%2!==0)throw new Error("must have even number of hex characters");let t=new Uint8Array(r.length/2);for(let e=0;e<r.length;e+=2)t[e/2]=parseInt(r.slice(e,e+2),16);return t},random(r=32){return this.fromBytes(me.random(r))},string(r){return q.fromBytes(r)},bytes(r){return q.toBytes(r)}});var br=["doz","mar","bin","wan","sam","lit","sig","hid","fid","lis","sog","dir","wac","sab","wis","sib","rig","sol","dop","mod","fog","lid","hop","dar","dor","lor","hod","fol","rin","tog","sil","mir","hol","pas","lac","rov","liv","dal","sat","lib","tab","han","tic","pid","tor","bol","fos","dot","los","dil","for","pil","ram","tir","win","tad","bic","dif","roc","wid","bis","das","mid","lop","ril","nar","dap","mol","san","loc","nov","sit","nid","tip","sic","rop","wit","nat","pan","min","rit","pod","mot","tam","tol","sav","pos","nap","nop","som","fin","fon","ban","mor","wor","sip","ron","nor","bot","wic","soc","wat","dol","mag","pic","dav","bid","bal","tim","tas","mal","lig","siv","tag","pad","sal","div","dac","tan","sid","fab","tar","mon","ran","nis","wol","mis","pal","las","dis","map","rab","tob","rol","lat","lon","nod","nav","fig","nom","nib","pag","sop","ral","bil","had","doc","rid","moc","pac","rav","rip","fal","tod","til","tin","hap","mic","fan","pat","tac","lab","mog","sim","son","pin","lom","ric","tap","fir","has","bos","bat","poc","hac","tid","hav","sap","lin","dib","hos","dab","bit","bar","rac","par","lod","dos","bor","toc","hil","mac","tom","dig","fil","fas","mit","hob","har","mig","hin","rad","mas","hal","rag","lag","fad","top","mop","hab","nil","nos","mil","fop","fam","dat","nol","din","hat","nac","ris","fot","rib","hoc","nim","lar","fit","wal","rap","sar","nal","mos","lan","don","dan","lad","dov","riv","bac","pol","lap","tal","pit","nam","bon","ros","ton","fod","pon","sov","noc","sor","lav","mat","mip","fip"];var wr=["zod","nec","bud","wes","sev","per","sut","let","ful","pen","syt","dur","wep","ser","wyl","sun","ryp","syx","dyr","nup","heb","peg","lup","dep","dys","put","lug","hec","ryt","tyv","syd","nex","lun","mep","lut","sep","pes","del","sul","ped","tem","led","tul","met","wen","byn","hex","feb","pyl","dul","het","mev","rut","tyl","wyd","tep","bes","dex","sef","wyc","bur","der","nep","pur","rys","reb","den","nut","sub","pet","rul","syn","reg","tyd","sup","sem","wyn","rec","meg","net","sec","mul","nym","tev","web","sum","mut","nyx","rex","teb","fus","hep","ben","mus","wyx","sym","sel","ruc","dec","wex","syr","wet","dyl","myn","mes","det","bet","bel","tux","tug","myr","pel","syp","ter","meb","set","dut","deg","tex","sur","fel","tud","nux","rux","ren","wyt","nub","med","lyt","dus","neb","rum","tyn","seg","lyx","pun","res","red","fun","rev","ref","mec","ted","rus","bex","leb","dux","ryn","num","pyx","ryg","ryx","fep","tyr","tus","tyc","leg","nem","fer","mer","ten","lus","nus","syl","tec","mex","pub","rym","tuc","fyl","lep","deb","ber","mug","hut","tun","byl","sud","pem","dev","lur","def","bus","bep","run","mel","pex","dyt","byt","typ","lev","myl","wed","duc","fur","fex","nul","luc","len","ner","lex","rup","ned","lec","ryd","lyd","fen","wel","nyd","hus","rel","rud","nes","hes","fet","des","ret","dun","ler","nyr","seb","hul","ryl","lud","rem","lys","fyn","wer","ryc","sug","nys","nyl","lyn","dyn","dem","lux","fed","sed","bec","mun","lyr","tes","mud","nyt","byr","sen","weg","fyr","mur","tel","rep","teg","pec","nel","nev","fes"];var rt={defaults:{groupSize:4,wordSeparator:".",groupSeparator:" "},random(r,t){let e=me.random(r);return this.fromBytes(e,t)},fromBytes(r,t={}){let{groupSize:e=rt.defaults.groupSize,wordSeparator:s=rt.defaults.wordSeparator,groupSeparator:i=rt.defaults.groupSeparator}=t,o=[],n=[];r.forEach((a,l)=>{let p=l%2===0?br:wr;n.push(p[a]),n.length===2&&(o.push(n.join("")),n=[])}),n.length&&o.push(n.join(""));let c=[];for(let a=0;a<o.length;a+=e)c.push(o.slice(a,a+e).join(s));return c.join(i)},toBytes(r){let t=r.toLowerCase().replace(/[^a-z]/g,"");if(t.length/3%1!==0)throw new Error(`invalid triplet count, ${t.length} does not divide into triplets`);let s=[];for(let i=0;i<t.length;i+=3)s.push(t.slice(i,i+3));return new Uint8Array(s.map((i,o)=>{let c=(o%2===0?br:wr).findIndex(a=>a===i);if(c===-1)throw new Error(`unknown triplet ${i}`);return c}))},toHex(r){return q.fromBytes(rt.toBytes(r))},fromHex(r,t){return rt.fromBytes(q.toBytes(r),t)}};function z(r,t){let e,s,i=[];function o(){e=[],s&&clearTimeout(s),s=void 0,i=[]}return o(),((...n)=>{e=n,s&&clearTimeout(s);let c=new Promise((a,l)=>{i.push({resolve:a,reject:l})});return s=setTimeout(()=>{Promise.resolve().then(()=>t(...e)).then(a=>{for(let{resolve:l}of i)l(a);o()}).catch(a=>{for(let{reject:l}of i)l(a);o()})},r),c})}function lt(r,t=new Set){if(t.has(r))throw new Error("cannot clone circular reference");let e;return typeof r=="function"||r!==null&&typeof r=="object"?(t.add(r),Array.isArray(r)?e=r.map(s=>lt(s,new Set(t))):r.constructor===Object?e=Object.fromEntries(Object.entries(r).map(([s,i])=>[s,lt(i,new Set(t))])):r instanceof Map?e=new Map(Array.from(r,([s,i])=>[s,lt(i,new Set(t))])):r instanceof Set?e=new Set(Array.from(r,s=>lt(s,new Set(t)))):r instanceof Date?e=new Date(r.getTime()):e=r,t.delete(r)):e=r,e}var Vt=Object.freeze({happy:r=>r!=null,sad:r=>r==null,boolean:r=>typeof r=="boolean",number:r=>typeof r=="number",string:r=>typeof r=="string",bigint:r=>typeof r=="bigint",object:r=>typeof r=="object"&&r!==null,array:r=>Array.isArray(r),fn:r=>typeof r=="function",symbol:r=>typeof r=="symbol"});var Fr=(r,t)=>{function e(s,i,o){if(!Vt.object(s)||!Vt.object(i))return s===i;if(o.includes(s))throw new Error("forbidden circularity detected in deep equal comparison");let n=[...o,s];if(s instanceof Map&&i instanceof Map){if(s.size!==i.size)return!1;for(let[c,a]of s)if(!i.has(c)||!e(a,i.get(c),n))return!1}else if(s instanceof Set&&i instanceof Set){if(s.size!==i.size)return!1;for(let c of s)if(!Array.from(i).some(a=>e(c,a,n)))return!1}else{let c=Object.keys(s),a=Object.keys(i);if(c.length!==a.length)return!1;for(let l of c)if(!a.includes(l)||!e(s[l],i[l],n))return!1}return!0}return e(r,t,[])};function Wr(r){function t(e,s){if(!Vt.object(e)||s.includes(e))return e;let i=[...s,e];if(e instanceof Map)for(let o of e.entries())for(let n of o)t(n,i);else if(e instanceof Set)for(let o of e)t(o,i);else if(Array.isArray(e))for(let o of e)t(o,i);else for(let o of Object.values(e))t(o,i);return Object.freeze(e)}return t(r,[])}var fe={clone:lt,equal:Fr,freeze:Wr};function Kr(...r){return(...t)=>r.forEach(e=>e(...t))}function qt(){let r,t,e=new Promise((i,o)=>{r=i,t=o});function s(i){return i.then(r).catch(t),e}return{promise:e,resolve:r,reject:t,entangle:s}}var ge=class{getRefill;#t=[];constructor(t){this.getRefill=t,this.#e()}get currentStock(){return[...this.#t]}#e(){if(this.#t.length===0&&(this.#t=[...this.getRefill()]),this.#t.length===0)throw new Error("dispenser's getRefill returned an empty array")}takeAll(){let t=this.#t;return this.#t=[...this.getRefill()],t}takeRandom(){this.#e();let t=Math.floor(Math.random()*this.#t.length),[e]=this.#t.splice(t,1);return e}takeFirst(){return this.#e(),this.#t.shift()}takeLast(){return this.#e(),this.#t.pop()}shift=this.takeFirst.bind(this);pop=this.takeLast.bind(this)};function P(){let r=[];function t(){for(let e of r)e();r=[]}return t.schedule=e=>(r.push(e),t),t}function st(r,t){let e=Object.entries(t);for(let[s,i]of e)r.addEventListener(s,i);return()=>{for(let[s,i]of e)r.removeEventListener(s,i)}}function*Us(r){for(let t=0;t<r;t++)yield t}function ye(r){return[...Us(r)]}var k=class r extends Map{static require(t,e){if(t.has(e))return t.get(e);throw new Error(`required key not found: "${e}"`)}static guarantee(t,e,s){if(t.has(e))return t.get(e);{let i=s();return t.set(e,i),i}}array(){return[...this]}require(t){return r.require(this,t)}guarantee(t,e){return r.guarantee(this,t,e)}},xe=class r extends WeakMap{static require(t,e){if(t.has(e))return t.get(e);throw new Error("required key not found")}static guarantee(t,e,s){if(t.has(e))return t.get(e);{let i=s();return t.set(e,i),i}}require(t){return r.require(this,t)}guarantee(t,e){return r.guarantee(this,t,e)}};var ht=(r=0)=>new Promise(t=>setTimeout(t,r));function Ut(r){return{map:t=>It(r,t),filter:t=>Gr(r,t)}}Ut.pipe=Object.freeze({map:r=>(t=>It(t,r)),filter:r=>(t=>Gr(t,r))});var It=(r,t)=>Object.fromEntries(Object.entries(r).map(([e,s])=>[e,t(s,e)])),Gr=(r,t)=>Object.fromEntries(Object.entries(r).filter(([e,s])=>t(s,e)));function $r(r){return new vr(r)}var vr=class r{#t;static with=$r;constructor(t){this.#t=t}to(t){return new r(t(this.#t))}done(){return this.#t}line(...t){let e=this.#t;for(let s of t)e=s(e);return e}};function Yr(){let r=new Set;async function t(...a){await Promise.all([...r].map(l=>l(...a)))}function e(a){return r.add(a),()=>{r.delete(a)}}async function s(...a){return t(...a)}function i(a){return e(a)}async function o(a){let{promise:l,resolve:p}=qt(),h=i(async(...u)=>{a&&await a(...u),p(u),h()});return l}function n(){r.clear()}let c={pub:s,sub:i,publish:t,subscribe:e,on:e,next:o,clear:n};return Object.assign(i,c),Object.assign(s,c),c}function T(r){let t=Yr();return r&&t.sub(r),t.sub}function Ft(r){let t=Yr();return r&&t.sub(r),t.pub}function be(r){let t,e=!1,s=()=>{e=!0,clearTimeout(t)},i=async()=>{e||(await r(s),!e&&(t=setTimeout(i,0)))};return i(),s}var pt=class extends Set{array(){return[...this]}hasAll(...t){return t.every(e=>this.has(e))}adds(...t){for(let e of t)this.add(e);return this}deletes(...t){for(let e of t)this.delete(e);return this}clear(){return super.clear(),this}};function Is(r,t,e){e==null?r.removeAttribute(t):typeof e=="string"?r.setAttribute(t,e):typeof e=="number"?r.setAttribute(t,e.toString()):typeof e=="boolean"?e===!0?r.setAttribute(t,""):r.removeAttribute(t):console.warn(`invalid attribute "${t}" type is "${typeof e}"`)}function we(r,t){for(let[e,s]of t)Is(r,e,s)}function Xr(r,t){let e=document.createElement(r);return we(e,Object.entries(t)),e}function Jr(r,t){let e=new MutationObserver(t);return e.observe(r,{attributes:!0}),()=>e.disconnect()}var E={get:{string:(r,t)=>r.getAttribute(t)??void 0,number:(r,t)=>{let e=r.getAttribute(t);return e===null||!e?void 0:Number(e)},boolean:(r,t)=>r.getAttribute(t)!==null},set:{string:(r,t,e)=>(e===void 0?r.removeAttribute(t):r.setAttribute(t,e),!0),number:(r,t,e)=>(e===void 0?r.removeAttribute(t):r.setAttribute(t,e.toString()),!0),boolean:(r,t,e)=>(e?r.setAttribute(t,""):r.removeAttribute(t),!0)}};var Zr=(r,t)=>new Proxy(t,{get:(e,s)=>{switch(t[s]){case String:return E.get.string(r,s);case Number:return E.get.number(r,s);case Boolean:return E.get.boolean(r,s);default:throw new Error(`invalid attribute type for "${s}"`)}},set:(e,s,i)=>{switch(t[s]){case String:return E.set.string(r,s,i);case Number:return E.set.number(r,s,i);case Boolean:return E.set.boolean(r,s,i);default:throw new Error(`invalid attribute type for "${s}"`)}}});var ve=class{element;constructor(t){this.element=t}strings=new Proxy({},{get:(t,e)=>E.get.string(this.element,e),set:(t,e,s)=>E.set.string(this.element,e,s)});numbers=new Proxy({},{get:(t,e)=>E.get.number(this.element,e),set:(t,e,s)=>E.set.number(this.element,e,s)});booleans=new Proxy({},{get:(t,e)=>E.get.boolean(this.element,e),set:(t,e,s)=>E.set.boolean(this.element,e,s)})};function Wt(r){let t=new ve(r);return{strings:t.strings,numbers:t.numbers,booleans:t.booleans,on:e=>Jr(r,e),spec:e=>Zr(r,e)}}Wt.get=E.get;Wt.set=E.set;function Ar(r,t){let e=[];for(let[s,i]of Object.entries(t))if(typeof i=="function")r.addEventListener(s,i),e.push(()=>r.removeEventListener(s,i));else{let[o,n]=i;r.addEventListener(s,n,o),e.push(()=>r.removeEventListener(s,n))}return()=>e.forEach(s=>s())}function Qr(r){return r.replace(/([a-zA-Z])(?=[A-Z])/g,"$1-").toLowerCase()}function ts(r,t={}){let{soft:e=!1,upgrade:s=!0}=t;for(let[i,o]of Object.entries(r)){let n=Qr(i),c=customElements.get(n);e&&c||(customElements.define(n,o),s&&document.querySelectorAll(n).forEach(a=>{a.constructor===HTMLElement&&customElements.upgrade(a)}))}}function es(r,t){let e=r.querySelector(t);if(!e)throw new Error(`element not found (${t})`);return e}var $e=class r{element;constructor(t){this.element=t}in(t){return new r(typeof t=="string"?es(this.element,t):t)}require(t){let e=this.element.querySelector(t);if(!e)throw new Error(`element not found (${t})`);return e}maybe(t){return this.element.querySelector(t)}all(t){return Array.from(this.element.querySelectorAll(t))}render(...t){return Ht(t,this.element)}attrs(){return Wt(this.element)}events(t){return Ar(this.element,t)}};function f(r){return typeof r=="string"?es(document,r):new $e(r)}var I=new $e(document);f.in=I.in.bind(I);f.require=I.require.bind(I);f.maybe=I.maybe.bind(I);f.all=I.all.bind(I);f.el=Xr;f.events=Ar;f.attrs=Wt;f.register=ts;f.render=(r,...t)=>Ht(t,r);var Sr=class{#t=[];#e=new WeakMap;#r=[];#s=new Set;notifyRead(t){this.#t.at(-1)?.add(t)}async notifyWrite(t){if(this.#s.has(t))throw new Error("circularity forbidden");let e=this.#i(t).pub();return this.#r.at(-1)?.add(e),e}observe(t){this.#t.push(new Set);let e=t();return{seen:this.#t.pop(),result:e}}subscribe(t,e){return this.#i(t)(async()=>{let s=new Set;this.#r.push(s),this.#s.add(t),s.add(e()),this.#s.delete(t),await Promise.all(s),this.#r.pop()})}#i(t){let e=this.#e.get(t);return e||(e=T(),this.#e.set(t,e)),e}},M=globalThis[Symbol.for("e280.tracker")]??=new Sr;var ut=class{sneak;constructor(t){this.sneak=t}get(){return M.notifyRead(this),this.sneak}get value(){return this.get()}};var dt=class extends ut{on=T();dispose(){this.on.clear()}};function Ae(r,t=r){let{seen:e,result:s}=M.observe(r),i=z(0,t),o=[],n=()=>o.forEach(c=>c());for(let c of e){let a=M.subscribe(c,i);o.push(a)}return{result:s,dispose:n}}function mt(r,t){return r===t}var Se=class extends dt{#t;constructor(t,e){let s=e?.compare??mt,{result:i,dispose:o}=Ae(t,async()=>{let n=t();!s(this.sneak,n)&&(this.sneak=n,await Promise.all([M.notifyWrite(this),this.on.pub(n)]))});super(i),this.#t=o}toString(){return`(derived "${String(this.get())}")`}dispose(){super.dispose(),this.#t()}get core(){return this}fn(){let t=this;function e(){return t.get()}return e.core=t,e.get=t.get.bind(t),e.on=t.on,e.dispose=t.dispose.bind(t),e.fn=t.fn.bind(t),Object.defineProperty(e,"value",{get:()=>t.value}),Object.defineProperty(e,"sneak",{get:()=>t.sneak}),e}};var ke=class extends ut{#t;#e;#r=!1;#s;constructor(t,e){super(void 0),this.#t=t,this.#e=e?.compare??mt}toString(){return`($lazy "${String(this.get())}")`}get(){if(!this.#s){let{result:t,dispose:e}=Ae(this.#t,()=>this.#r=!0);this.#s=e,this.sneak=t}if(this.#r){this.#r=!1;let t=this.#t();!this.#e(this.sneak,t)&&(this.sneak=t,M.notifyWrite(this))}return super.get()}dispose(){this.#s&&this.#s()}get core(){return this}fn(){let t=this;function e(){return t.get()}return e.core=t,e.get=t.get.bind(t),e.dispose=t.dispose.bind(t),e.fn=t.fn.bind(t),Object.defineProperty(e,"value",{get:()=>t.value}),Object.defineProperty(e,"sneak",{get:()=>t.sneak}),e}};var _e=class extends dt{#t=!1;#e;constructor(t,e){super(t),this.#e=e?.compare??mt}toString(){return`($signal "${String(this.get())}")`}async set(t,e=!1){let s=this.sneak;return this.sneak=t,(e||!this.#e(s,t))&&await this.publish(),t}get value(){return this.get()}set value(t){this.set(t)}async publish(){if(this.#t)throw new Error("forbid circularity");let t=this.sneak,e=Promise.resolve();try{this.#t=!0,e=Promise.all([M.notifyWrite(this),this.on.publish(t)])}finally{this.#t=!1}return await e,t}get core(){return this}fn(){let t=this;function e(s){return arguments.length===0?t.get():t.set(arguments[0])}return e.core=t,e.get=t.get.bind(t),e.set=t.set.bind(t),e.on=t.on,e.dispose=t.dispose.bind(t),e.publish=t.publish.bind(t),e.fn=t.fn.bind(t),Object.defineProperty(e,"value",{get:()=>t.value,set:s=>t.value=s}),Object.defineProperty(e,"sneak",{get:()=>t.sneak,set:s=>t.sneak=s}),e}};function Fs(r,t){return new ke(r,t).fn()}function Ee(r,t){return new Se(r,t).fn()}function g(r,t){return new _e(r,t).fn()}g.lazy=Fs;g.derived=Ee;var F=class{#t=new k;effect(t,e){let{seen:s,result:i}=M.observe(t);for(let o of s)this.#t.guarantee(o,()=>M.subscribe(o,e));for(let[o,n]of this.#t)s.has(o)||(n(),this.#t.delete(o));return i}clear(){for(let t of this.#t.values())t();this.#t.clear()}};var ft=class{element;response;#t;constructor(t,e){this.element=t,this.response=e}start(){this.#t||(this.#t=f.attrs(this.element).on(this.response))}stop(){this.#t&&this.#t(),this.#t=void 0}};function Me(r,t){ne(r,Ks(t))}function Ks(r){let t=[];if(Array.isArray(r)){let e=new Set(r.flat(1/0).reverse());for(let s of e)t.unshift(nt(s))}else r!==void 0&&t.push(nt(r));return t}var it={status:r=>r[0],value:r=>r[0]==="ready"?r[1]:void 0,error:r=>r[0]==="error"?r[1]:void 0,select:(r,t)=>{switch(r[0]){case"loading":return t.loading();case"error":return t.error(r[1]);case"ready":return t.ready(r[1]);default:throw new Error("unknown op status")}},morph:(r,t)=>it.select(r,{loading:()=>["loading"],error:e=>["error",e],ready:e=>["ready",t(e)]}),all:(...r)=>{let t=[],e=[],s=0;for(let i of r)switch(i[0]){case"loading":s++;break;case"ready":t.push(i[1]);break;case"error":e.push(i[1]);break}return e.length>0?["error",e]:s===0?["ready",t]:["loading"]}};var gt=class{static loading(){return new this}static ready(t){return new this(["ready",t])}static error(t){return new this(["error",t])}static promise(t){let e=new this;return e.promise(t),e}static load(t){return this.promise(t())}static all(...t){let e=t.map(s=>s.pod);return it.all(...e)}signal;#t=0;#e=Ft();#r=Ft();constructor(t=["loading"]){this.signal=g(t)}get wait(){return new Promise((t,e)=>{this.#e.next().then(([s])=>t(s)),this.#r.next().then(([s])=>e(s))})}get then(){return this.wait.then.bind(this.wait)}get catch(){return this.wait.catch.bind(this.wait)}get finally(){return this.wait.finally.bind(this.wait)}async setLoading(){await this.signal.set(["loading"])}async setReady(t){await this.signal.set(["ready",t]),await this.#e(t)}async setError(t){await this.signal.set(["error",t]),await this.#r(t)}async promise(t){let e=++this.#t;await this.setLoading();try{let s=await t;return e===this.#t&&await this.setReady(s),s}catch(s){console.error(s),e===this.#t&&await this.setError(s)}}async load(t){return this.promise(t())}get pod(){return this.signal.get()}set pod(t){this.signal.set(t)}get status(){return this.signal.get()[0]}get value(){return it.value(this.signal.get())}get error(){return it.error(this.signal.get())}get isLoading(){return this.status==="loading"}get isReady(){return this.status==="ready"}get isError(){return this.status==="error"}require(){let t=this.signal.get();if(t[0]!=="ready")throw new Error("required value not ready");return t[1]}select(t){return it.select(this.signal.get(),t)}morph(t){return it.morph(this.pod,t)}};var Ce=class{#t=[];#e=[];mount(t){this.#t.push(t),this.#e.push(t())}unmountAll(){for(let t of this.#e)t();this.#e=[]}remountAll(){for(let t of this.#t)this.#e.push(t())}};var Pe=class{#t;#e;constructor(t){this.#t=t,this.#e=f.attrs(t.element)}get strings(){return this.#e.strings}get numbers(){return this.#e.numbers}get booleans(){return this.#e.booleans}spec(t){return this.#t.once(()=>this.#e.spec(t))}on(t){return this.#t.mount(()=>this.#e.on(t))}};var Kt=Symbol(),Gt=Symbol(),Yt=Symbol(),yt=class{element;shadow;renderNow;render;attrs;#t=0;#e=0;#r=new k;#s=qt();#i=new Ce;[Kt](t){this.#t++,this.#e=0,this.#s=qt();let e=t();return this.#s.resolve(),e}[Gt](){this.#i.unmountAll()}[Yt](){this.#i.remountAll()}constructor(t,e,s,i){this.element=t,this.shadow=e,this.renderNow=s,this.render=i,this.attrs=new Pe(this)}get renderCount(){return this.#t}get rendered(){return this.#s.promise}name(t){this.once(()=>this.element.setAttribute("view",t))}styles(...t){this.once(()=>Me(this.shadow,t))}css(...t){return this.styles(...t)}once(t){return this.#r.guarantee(this.#e++,t)}mount(t){return this.once(()=>this.#i.mount(t))}life(t){let e;return this.mount(()=>{let[s,i]=t();return e=s,i}),e}wake(t){return this.life(()=>[t(),()=>{}])}op=(()=>{let t=this;function e(s){return t.once(()=>gt.load(s))}return e.load=e,e.promise=s=>this.once(()=>gt.promise(s)),e})();signal=(()=>{let t=this;function e(s,i){return t.once(()=>g(s,i))}return e.derived=function(i,o){return t.once(()=>g.derived(i,o))},e.lazy=function(i,o){return t.once(()=>g.lazy(i,o))},e})();derived(t,e){return this.once(()=>g.derived(t,e))}lazy(t,e){return this.once(()=>g.lazy(t,e))}};var B=class extends HTMLElement{static styles;shadow;#t;#e=0;#r=new F;#s=new ft(this,()=>this.update());createShadow(){return this.attachShadow({mode:"open"})}constructor(){super(),this.shadow=this.createShadow(),this.#t=new yt(this,this.shadow,this.updateNow,this.update)}render(t){}updateNow=()=>{this.#t[Kt](()=>{f.render(this.shadow,this.#r.effect(()=>this.render(this.#t),this.update))})};update=z(0,this.updateNow);connectedCallback(){if(this.#e===0){let t=this.constructor.styles;t&&Me(this.shadow,t),this.updateNow()}else this.#t[Yt]();this.#s.start(),this.#e++}disconnectedCallback(){this.#t[Gt](),this.#r.clear(),this.#s.stop()}};var Be=class{#t;#e;constructor(t,e){this.#e=t,this.#t=e}attr(t,e){return this.#e.attrs.set(t,e),this}children(...t){return this.#e.children.push(...t),this}render(){return this.#t(this.#e)}};var Xt=class{props;attrs=new Map;children=[];constructor(t){this.props=t}};function rs(r,t,e,s){return class extends t{static view=xt(s,r);#t=new F;createShadow(){return this.attachShadow(r)}render(o){return s(o)(...this.#t.effect(()=>e(this),()=>this.update()))}}}var{I:Gs}=Ir;var is=r=>r.strings===void 0,ss=()=>document.createComment(""),bt=(r,t,e)=>{let s=r._$AA.parentNode,i=t===void 0?r._$AB:t._$AA;if(e===void 0){let o=s.insertBefore(ss(),i),n=s.insertBefore(ss(),i);e=new Gs(o,n,r,r.options)}else{let o=e._$AB.nextSibling,n=e._$AM,c=n!==r;if(c){let a;e._$AQ?.(r),e._$AM=r,e._$AP!==void 0&&(a=r._$AU)!==n._$AU&&e._$AP(a)}if(o!==i||c){let a=e._$AA;for(;a!==o;){let l=a.nextSibling;s.insertBefore(a,i),a=l}}}return e},W=(r,t,e=r)=>(r._$AI(t,e),r),Ys={},os=(r,t=Ys)=>r._$AH=t,ns=r=>r._$AH,Oe=r=>{r._$AR(),r._$AA.remove()};var Re={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},Jt=r=>(...t)=>({_$litDirective$:r,values:t}),wt=class{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,s){this._$Ct=t,this._$AM=e,this._$Ci=s}_$AS(t,e){return this.update(t,e)}update(t,e){return this.render(...e)}};var Zt=(r,t)=>{let e=r._$AN;if(e===void 0)return!1;for(let s of e)s._$AO?.(t,!1),Zt(s,t);return!0},De=r=>{let t,e;do{if((t=r._$AM)===void 0)break;e=t._$AN,e.delete(r),r=t}while(e?.size===0)},as=r=>{for(let t;t=r._$AM;r=t){let e=t._$AN;if(e===void 0)t._$AN=e=new Set;else if(e.has(r))break;e.add(r),Zs(t)}};function Xs(r){this._$AN!==void 0?(De(this),this._$AM=r,as(this)):this._$AM=r}function Js(r,t=!1,e=0){let s=this._$AH,i=this._$AN;if(i!==void 0&&i.size!==0)if(t)if(Array.isArray(s))for(let o=e;o<s.length;o++)Zt(s[o],!1),De(s[o]);else s!=null&&(Zt(s,!1),De(s));else Zt(this,r)}var Zs=r=>{r.type==Re.CHILD&&(r._$AP??=Js,r._$AQ??=Xs)},Te=class extends wt{constructor(){super(...arguments),this._$AN=void 0}_$AT(t,e,s){super._$AT(t,e,s),as(this),this.isConnected=t._$AU}_$AO(t,e=!0){t!==this.isConnected&&(this.isConnected=t,t?this.reconnected?.():this.disconnected?.()),e&&(Zt(this,t),De(this))}setValue(t){if(is(this._$Ct))this._$Ct._$AI(t,this);else{let e=[...this._$Ct._$AH];e[this._$Ci]=t,this._$Ct._$AI(e,this,0)}}disconnected(){}reconnected(){}};var ze=class r extends HTMLElement{static#t=!1;static make(){return this.#t||(f.register({SlyView:r},{soft:!0,upgrade:!0}),this.#t=!0),document.createElement("sly-view")}};var je=class{viewFn;settings;#t=ze.make();#e=new F;#r;#s;#i;#o=new ft(this.#t,()=>this.#a());constructor(t,e){this.viewFn=t,this.settings=e,this.#s=this.#t.attachShadow(this.settings),this.#r=new yt(this.#t,this.#s,this.#n,this.#a)}update(t){return this.#i=t,this.#n(),this.#t}#n=()=>{this.#r[Kt](()=>{let t=this.#e.effect(()=>this.viewFn(this.#r)(...this.#i.props),()=>this.#a());we(this.#t,[...this.#i.attrs]),f.render(this.#s,t),f.render(this.#t,this.#i.children),this.#o.start()})};#a=z(0,this.#n);disconnected(){this.#r[Gt](),this.#e.clear(),this.#o.stop()}reconnected(){this.#r[Yt](),this.#o.start()}};function cs(r,t){return Jt(class extends Te{#t=new je(r,t);render(s){return this.#t.update(s)}disconnected(){this.#t.disconnected()}reconnected(){this.#t.reconnected()}})}function xt(r,t){let e=cs(r,t);function s(...i){return e(new Xt(i))}return s.props=(...i)=>new Be(new Xt(i),e),s.transmute=i=>xt(n=>{let c=r(n);return(...a)=>c(...i(...a))},t),s.component=(i=B)=>({props:o=>rs(t,i,o,r)}),s}function $(r){return xt(r,{mode:"open"})}$.settings=r=>({render:t=>xt(t,r)});$.render=$;$.component=r=>$(t=>()=>r(t)).component(B).props(()=>[]);function d(r,t){return()=>Qs({hz:r,frames:t})}var Qs=$(r=>({hz:t,frames:e})=>{r.name("loading"),r.styles(C,ti);let s=r.signal(0);return r.mount(()=>be(async()=>{await ht(1e3/t);let i=s.get()+1;s.set(i>=e.length?0:i)})),e.at(s.get())}),ti=_`
20
20
  :host {
21
21
  font-family: monospace;
22
22
  white-space: pre;
23
23
  user-select: none;
24
24
  }
25
- `;var f=20,V=10,F=4,Bc=p(f,["|","/","-","\\"]),_r=p(f,["\u2808","\u2810","\u2820","\u2880","\u2840","\u2804","\u2802","\u2801"]),Sc=p(f,["\u2B06\uFE0F","\u2197\uFE0F","\u27A1\uFE0F","\u2198\uFE0F","\u2B07\uFE0F","\u2199\uFE0F","\u2B05\uFE0F","\u2196\uFE0F"]),Ec=p(f,["\u25B0\u25B1\u25B1\u25B1\u25B1","\u25B0\u25B1\u25B1\u25B1\u25B1","\u25B1\u25B0\u25B1\u25B1\u25B1","\u25B1\u25B1\u25B0\u25B1\u25B1","\u25B1\u25B1\u25B1\u25B0\u25B1","\u25B1\u25B1\u25B1\u25B1\u25B0","\u25B1\u25B1\u25B1\u25B1\u25B0","\u25B1\u25B1\u25B1\u25B0\u25B1","\u25B1\u25B1\u25B0\u25B1\u25B1","\u25B1\u25B0\u25B1\u25B1\u25B1"]),kc=p(f,["\u25B1\u25B1\u25B0\u25B1\u25B1","\u25B1\u25B1\u25B1\u25B0\u25B1","\u25B1\u25B1\u25B1\u25B0\u25B0","\u25B1\u25B1\u25B1\u25B0\u25B0","\u25B1\u25B1\u25B1\u25B1\u25B0","\u25B1\u25B1\u25B1\u25B1\u25B0","\u25B1\u25B1\u25B1\u25B1\u25B0","\u25B1\u25B1\u25B1\u25B0\u25B0","\u25B1\u25B1\u25B1\u25B0\u25B0","\u25B1\u25B1\u25B1\u25B0\u25B1","\u25B1\u25B1\u25B0\u25B1\u25B1","\u25B1\u25B0\u25B1\u25B1\u25B1","\u25B0\u25B0\u25B1\u25B1\u25B1","\u25B0\u25B0\u25B1\u25B1\u25B1","\u25B0\u25B1\u25B1\u25B1\u25B1","\u25B0\u25B1\u25B1\u25B1\u25B1","\u25B0\u25B1\u25B1\u25B1\u25B1","\u25B0\u25B0\u25B1\u25B1\u25B1","\u25B0\u25B0\u25B1\u25B1\u25B1","\u25B1\u25B0\u25B1\u25B1\u25B1"]),Mc=p(f,["\u25B0\u25B1\u25B1\u25B1\u25B1","\u25B0\u25B1\u25B1\u25B1\u25B1","\u25B0\u25B0\u25B1\u25B1\u25B1","\u25B0\u25B0\u25B0\u25B1\u25B1","\u25B1\u25B0\u25B0\u25B0\u25B1","\u25B1\u25B1\u25B0\u25B0\u25B0","\u25B1\u25B1\u25B1\u25B0\u25B0","\u25B1\u25B1\u25B1\u25B1\u25B0","\u25B1\u25B1\u25B1\u25B1\u25B0","\u25B1\u25B1\u25B1\u25B0\u25B0","\u25B1\u25B1\u25B0\u25B0\u25B0","\u25B1\u25B0\u25B0\u25B0\u25B1","\u25B0\u25B0\u25B0\u25B1\u25B1","\u25B0\u25B0\u25B1\u25B1\u25B1"]),Cc=p(f,["\u25B1\u25B1\u25B1\u25B1\u25B1","\u25B1\u25B1\u25B1\u25B1\u25B1","\u25B0\u25B1\u25B1\u25B1\u25B1","\u25B0\u25B0\u25B1\u25B1\u25B1","\u25B0\u25B0\u25B0\u25B1\u25B1","\u25B0\u25B0\u25B0\u25B0\u25B1","\u25B0\u25B0\u25B0\u25B0\u25B0","\u25B0\u25B0\u25B0\u25B0\u25B0","\u25B1\u25B0\u25B0\u25B0\u25B0","\u25B1\u25B1\u25B0\u25B0\u25B0","\u25B1\u25B1\u25B1\u25B0\u25B0","\u25B1\u25B1\u25B1\u25B1\u25B0"]),Pc=p(f,["\u2581\u2581\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581","\u2588\u2581\u2581\u2581\u2581","\u2588\u2588\u2581\u2581\u2581","\u2588\u2588\u2588\u2581\u2581","\u2588\u2588\u2588\u2588\u2581","\u2588\u2588\u2588\u2588\u2588","\u2588\u2588\u2588\u2588\u2588","\u2581\u2588\u2588\u2588\u2588","\u2581\u2581\u2588\u2588\u2588","\u2581\u2581\u2581\u2588\u2588","\u2581\u2581\u2581\u2581\u2588"]),jc=p(f,["\u2588\u2581\u2581\u2581\u2581","\u2588\u2581\u2581\u2581\u2581","\u2588\u2588\u2581\u2581\u2581","\u2588\u2588\u2588\u2581\u2581","\u2588\u2588\u2588\u2588\u2581","\u2588\u2588\u2588\u2588\u2588","\u2588\u2588\u2588\u2588\u2588","\u2581\u2588\u2588\u2588\u2588","\u2581\u2581\u2588\u2588\u2588","\u2581\u2581\u2581\u2588\u2588","\u2581\u2581\u2581\u2581\u2588","\u2581\u2581\u2581\u2581\u2588","\u2581\u2581\u2581\u2588\u2588","\u2581\u2581\u2588\u2588\u2588","\u2581\u2588\u2588\u2588\u2588","\u2588\u2588\u2588\u2588\u2588","\u2588\u2588\u2588\u2588\u2588","\u2588\u2588\u2588\u2588\u2581","\u2588\u2588\u2588\u2581\u2581","\u2588\u2588\u2581\u2581\u2581"]),Oc=p(F,["\u{1F6B6}","\u{1F3C3}"]),zc=p(V,["\u25F7","\u25F6","\u25F5","\u25F4"]),Tc=p(f,["=----","-=---","--=--","---=-","----=","----=","---=-","--=--","-=---","=----"]),Nc=p(f,["o----","-o---","--o--","---o-","----o","----o","---o-","--o--","-o---","o----"]),Ic=p(V,["[ ]","[ ]","[= ]","[== ]","[===]","[ ==]","[ =]"]),Hc=p(V,["[ ]","[ ]","[= ]","[== ]","[===]","[ ==]","[ =]","[ ]","[ ]","[ =]","[ ==]","[===]","[== ]","[= ]"]),Uc=p(V,[" "," ",". ",".. ","..."," .."," ."]),Dc=p(f,[". ",". ",".. ","..."," .."," ."," ."," ..","...",".. "]),qc=p(f,[".....",".....",":....","::...",":::..","::::.",":::::",":::::",".::::","..:::","...::","....:"]),Rc=p(f,[":....",":....","::...",".::..","..::.","...::","....:","....:","...::","..::.",".::..","::..."]),Lc=p(f,[".....",".....","..:..",".:::.",".:::.",":::::",":::::","::.::",":...:"]),Vc=p(f,[".....",".....","..:..",".:::.",".:::.",":::::",":::::","::.::",":...:",".....",".....",":...:","::.::",":::::",":::::",".:::.",".:::.","..:.."]),Fc=p(f,["000","100","110","111","011","001"]),Wc=p(f,["11111","01111","00111","10011","11001","01100","00110","10011","11001","11100","11110"]),Zc=p(f,["11111","01111","10111","11011","11101","11110","11111","11110","11101","11011","10111","01111"]),Jc=p(F,["\u{1F539}","\u{1F535}"]),Kc=p(V,["\u{1F642}","\u{1F642}","\u{1F617}","\u{1F619}","\u{1F618}","\u{1F618}","\u{1F619}"]),Qc=p(f,["\u{1F550}","\u{1F551}","\u{1F552}","\u{1F553}","\u{1F554}","\u{1F555}","\u{1F556}","\u{1F557}","\u{1F558}","\u{1F559}","\u{1F55A}","\u{1F55B}"]),Yc=p(f,["\u{1F91C} \u{1F91B}","\u{1F91C} \u{1F91B}","\u{1F91C} \u{1F91B}"," \u{1F91C} \u{1F91B} "," \u{1F91C}\u{1F91B} "," \u{1F91C}\u{1F91B} "," \u{1F91C}\u{1F4A5}\u{1F91B} ","\u{1F91C} \u{1F4A5} \u{1F91B}","\u{1F91C} \u2728 \u{1F91B}","\u{1F91C} \u2728 \u{1F91B}"]),Xc=p(F,["\u{1F30E}","\u{1F30F}","\u{1F30D}"]),Gc=p(F,["\u{1F513}","\u{1F512}"]),tu=p(F,["\u{1F505}","\u{1F506}"]),eu=p(F,["\u{1F508}","\u{1F508}","\u{1F509}","\u{1F50A}","\u{1F50A}","\u{1F509}"]),ru=p(V,["\u{1F311}","\u{1F311}","\u{1F311}","\u{1F318}","\u{1F317}","\u{1F316}","\u{1F315}","\u{1F314}","\u{1F313}","\u{1F312}"]);var Br=_(r=>t=>(r.name("error"),r.styles(kt,Sr),typeof t=="string"?t:t instanceof Error?U`<strong>${t.name}:</strong> <span>${t.message}</span>`:"error")),Sr=g`
25
+ `;var x=20,vt=10,$t=4,zc=d(x,["|","/","-","\\"]),jc=d(x,["\u2808","\u2810","\u2820","\u2880","\u2840","\u2804","\u2802","\u2801"]),Nc=d(x,["\u2B06\uFE0F","\u2197\uFE0F","\u27A1\uFE0F","\u2198\uFE0F","\u2B07\uFE0F","\u2199\uFE0F","\u2B05\uFE0F","\u2196\uFE0F"]),Lc=d(x,["\u25B0\u25B1\u25B1\u25B1\u25B1","\u25B0\u25B1\u25B1\u25B1\u25B1","\u25B1\u25B0\u25B1\u25B1\u25B1","\u25B1\u25B1\u25B0\u25B1\u25B1","\u25B1\u25B1\u25B1\u25B0\u25B1","\u25B1\u25B1\u25B1\u25B1\u25B0","\u25B1\u25B1\u25B1\u25B1\u25B0","\u25B1\u25B1\u25B1\u25B0\u25B1","\u25B1\u25B1\u25B0\u25B1\u25B1","\u25B1\u25B0\u25B1\u25B1\u25B1"]),Hc=d(x,["\u25B1\u25B1\u25B0\u25B1\u25B1","\u25B1\u25B1\u25B1\u25B0\u25B1","\u25B1\u25B1\u25B1\u25B0\u25B0","\u25B1\u25B1\u25B1\u25B0\u25B0","\u25B1\u25B1\u25B1\u25B1\u25B0","\u25B1\u25B1\u25B1\u25B1\u25B0","\u25B1\u25B1\u25B1\u25B1\u25B0","\u25B1\u25B1\u25B1\u25B0\u25B0","\u25B1\u25B1\u25B1\u25B0\u25B0","\u25B1\u25B1\u25B1\u25B0\u25B1","\u25B1\u25B1\u25B0\u25B1\u25B1","\u25B1\u25B0\u25B1\u25B1\u25B1","\u25B0\u25B0\u25B1\u25B1\u25B1","\u25B0\u25B0\u25B1\u25B1\u25B1","\u25B0\u25B1\u25B1\u25B1\u25B1","\u25B0\u25B1\u25B1\u25B1\u25B1","\u25B0\u25B1\u25B1\u25B1\u25B1","\u25B0\u25B0\u25B1\u25B1\u25B1","\u25B0\u25B0\u25B1\u25B1\u25B1","\u25B1\u25B0\u25B1\u25B1\u25B1"]),Vc=d(x,["\u25B0\u25B1\u25B1\u25B1\u25B1","\u25B0\u25B1\u25B1\u25B1\u25B1","\u25B0\u25B0\u25B1\u25B1\u25B1","\u25B0\u25B0\u25B0\u25B1\u25B1","\u25B1\u25B0\u25B0\u25B0\u25B1","\u25B1\u25B1\u25B0\u25B0\u25B0","\u25B1\u25B1\u25B1\u25B0\u25B0","\u25B1\u25B1\u25B1\u25B1\u25B0","\u25B1\u25B1\u25B1\u25B1\u25B0","\u25B1\u25B1\u25B1\u25B0\u25B0","\u25B1\u25B1\u25B0\u25B0\u25B0","\u25B1\u25B0\u25B0\u25B0\u25B1","\u25B0\u25B0\u25B0\u25B1\u25B1","\u25B0\u25B0\u25B1\u25B1\u25B1"]),qc=d(x,["\u25B1\u25B1\u25B1\u25B1\u25B1","\u25B1\u25B1\u25B1\u25B1\u25B1","\u25B0\u25B1\u25B1\u25B1\u25B1","\u25B0\u25B0\u25B1\u25B1\u25B1","\u25B0\u25B0\u25B0\u25B1\u25B1","\u25B0\u25B0\u25B0\u25B0\u25B1","\u25B0\u25B0\u25B0\u25B0\u25B0","\u25B0\u25B0\u25B0\u25B0\u25B0","\u25B1\u25B0\u25B0\u25B0\u25B0","\u25B1\u25B1\u25B0\u25B0\u25B0","\u25B1\u25B1\u25B1\u25B0\u25B0","\u25B1\u25B1\u25B1\u25B1\u25B0"]),Uc=d(x,["\u2581\u2581\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581","\u2588\u2581\u2581\u2581\u2581","\u2588\u2588\u2581\u2581\u2581","\u2588\u2588\u2588\u2581\u2581","\u2588\u2588\u2588\u2588\u2581","\u2588\u2588\u2588\u2588\u2588","\u2588\u2588\u2588\u2588\u2588","\u2581\u2588\u2588\u2588\u2588","\u2581\u2581\u2588\u2588\u2588","\u2581\u2581\u2581\u2588\u2588","\u2581\u2581\u2581\u2581\u2588"]),Ic=d(x,["\u2588\u2581\u2581\u2581\u2581","\u2588\u2581\u2581\u2581\u2581","\u2588\u2588\u2581\u2581\u2581","\u2588\u2588\u2588\u2581\u2581","\u2588\u2588\u2588\u2588\u2581","\u2588\u2588\u2588\u2588\u2588","\u2588\u2588\u2588\u2588\u2588","\u2581\u2588\u2588\u2588\u2588","\u2581\u2581\u2588\u2588\u2588","\u2581\u2581\u2581\u2588\u2588","\u2581\u2581\u2581\u2581\u2588","\u2581\u2581\u2581\u2581\u2588","\u2581\u2581\u2581\u2588\u2588","\u2581\u2581\u2588\u2588\u2588","\u2581\u2588\u2588\u2588\u2588","\u2588\u2588\u2588\u2588\u2588","\u2588\u2588\u2588\u2588\u2588","\u2588\u2588\u2588\u2588\u2581","\u2588\u2588\u2588\u2581\u2581","\u2588\u2588\u2581\u2581\u2581"]),Fc=d($t,["\u{1F6B6}","\u{1F3C3}"]),Wc=d(vt,["\u25F7","\u25F6","\u25F5","\u25F4"]),Kc=d(x,["=----","-=---","--=--","---=-","----=","----=","---=-","--=--","-=---","=----"]),Gc=d(x,["o----","-o---","--o--","---o-","----o","----o","---o-","--o--","-o---","o----"]),Yc=d(vt,["[ ]","[ ]","[= ]","[== ]","[===]","[ ==]","[ =]"]),Xc=d(vt,["[ ]","[ ]","[= ]","[== ]","[===]","[ ==]","[ =]","[ ]","[ ]","[ =]","[ ==]","[===]","[== ]","[= ]"]),Jc=d(vt,[" "," ",". ",".. ","..."," .."," ."]),Zc=d(x,[". ",". ",".. ","..."," .."," ."," ."," ..","...",".. "]),Qc=d(x,[".....",".....",":....","::...",":::..","::::.",":::::",":::::",".::::","..:::","...::","....:"]),tl=d(x,[":....",":....","::...",".::..","..::.","...::","....:","....:","...::","..::.",".::..","::..."]),el=d(x,[".....",".....","..:..",".:::.",".:::.",":::::",":::::","::.::",":...:"]),rl=d(x,[".....",".....","..:..",".:::.",".:::.",":::::",":::::","::.::",":...:",".....",".....",":...:","::.::",":::::",":::::",".:::.",".:::.","..:.."]),sl=d(x,["000","100","110","111","011","001"]),il=d(x,["11111","01111","00111","10011","11001","01100","00110","10011","11001","11100","11110"]),ol=d(x,["11111","01111","10111","11011","11101","11110","11111","11110","11101","11011","10111","01111"]),nl=d($t,["\u{1F539}","\u{1F535}"]),al=d(vt,["\u{1F642}","\u{1F642}","\u{1F617}","\u{1F619}","\u{1F618}","\u{1F618}","\u{1F619}"]),cl=d(x,["\u{1F550}","\u{1F551}","\u{1F552}","\u{1F553}","\u{1F554}","\u{1F555}","\u{1F556}","\u{1F557}","\u{1F558}","\u{1F559}","\u{1F55A}","\u{1F55B}"]),ll=d(x,["\u{1F91C} \u{1F91B}","\u{1F91C} \u{1F91B}","\u{1F91C} \u{1F91B}"," \u{1F91C} \u{1F91B} "," \u{1F91C}\u{1F91B} "," \u{1F91C}\u{1F91B} "," \u{1F91C}\u{1F4A5}\u{1F91B} ","\u{1F91C} \u{1F4A5} \u{1F91B}","\u{1F91C} \u2728 \u{1F91B}","\u{1F91C} \u2728 \u{1F91B}"]),ei=d($t,["\u{1F30E}","\u{1F30F}","\u{1F30D}"]),hl=d($t,["\u{1F513}","\u{1F512}"]),pl=d($t,["\u{1F505}","\u{1F506}"]),ul=d($t,["\u{1F508}","\u{1F508}","\u{1F509}","\u{1F50A}","\u{1F50A}","\u{1F509}"]),dl=d(vt,["\u{1F311}","\u{1F311}","\u{1F311}","\u{1F318}","\u{1F317}","\u{1F316}","\u{1F315}","\u{1F314}","\u{1F313}","\u{1F312}"]);var si=$(r=>t=>(r.name("error"),r.styles(C,ii),typeof t=="string"?t:t instanceof Error?v`<strong>${t.name}:</strong> <span>${t.message}</span>`:"error")),ii=_`
26
26
  :host {
27
27
  font-family: monospace;
28
28
  color: red;
29
29
  }
30
- `;var x=class r{x;constructor(t){this.x=t}static new(t){return new this(t)}clone(){return new r(this.x)}set(t){return this.x=t,this}static isBetween(t,e=0,s=1){let o=Math.min(e,s),n=Math.max(e,s);return t>=o&&t<=n}isBetween(t=0,e=1){return r.isBetween(this.x,t,e)}static isNear(t,e,s=.01){return Math.abs(t-e)<=s}isNear(t,e=.01){return r.isNear(this.x,t,e)}static add(...t){let e=0;for(let s of t)e+=s;return e}add(...t){return this.x=r.add(this.x,...t),this}subtract(...t){for(let e of t)this.x-=e;return this}static atLeast(t,e=0){return Math.max(t,e)}atLeast(t=0){return this.x=r.atLeast(this.x,t),this}static atMost(t,e=1){return Math.min(t,e)}atMost(t=1){return this.x=r.atMost(this.x,t),this}static clamp(t,e=0,s=1){return t=r.atLeast(t,Math.min(e,s)),t=r.atMost(t,Math.max(e,s)),t}clamp(t=0,e=1){return this.x=r.clamp(this.x,t,e),this}static lerp(t,e,s,o){let i=(e-t)*s;return o!==void 0&&Math.abs(i)>o&&(i=Math.sign(i)*o),t+i}lerp(t,e,s){return this.x=r.lerp(this.x,t,e,s),this}static step(t,e,s){let o=e-t;return Math.abs(o)<=s?e:t+Math.sign(o)*s}step(t,e){return this.x=r.step(this.x,t,e),this}static creep(t,e,s,o){let n=t*(1-Math.exp(-e*s));if(o!==void 0){let i=o*s;Math.abs(n)>i&&(n=Math.sign(n)*i)}return n}static approach(t,e,s,o,n){let i=e-t,c=this.creep(i,s,o,n);return t+c}approach(t,e,s,o){return this.x=r.approach(this.x,t,e,s,o),this}static wrap(t,e=0,s=1){let o=Math.min(e,s),i=Math.max(e,s)-o,c=t-o,a=c<0?i- -c%i:c%i;return o+a}wrap(t=0,e=1){return this.x=r.wrap(this.x,t,e),this}static constrainProximity(t,e,s){let o=e-t,n=Math.abs(o),i=n>s?s:n,c=o<0?-i:i;return t+c}constrainProximity(t,e){return this.x=r.constrainProximity(this.x,t,e),this}static inverse(t){return 1-t}inverse(){return this.x=r.inverse(this.x),this}static center(t){return t*2-1}center(){return this.x=r.center(this.x),this}static uncenter(t){return(t+1)/2}uncenter(){return this.x=r.uncenter(this.x),this}static map(t,e,s){let n=(s-e)*t;return e+n}map(t,e){return this.x=r.map(this.x,t,e),this}static remap(t,e,s,o=0,n=1,i=!1){let a=(t-e)/(s-e)*(n-o)+o;return i?r.clamp(a,o,n):a}remap(t,e,s=0,o=1,n=!1){return this.x=r.remap(this.x,t,e,s,o,n),this}static magnify(t){return 4*Math.pow(t-.5,3)+.5}magnify(){return this.x=r.magnify(this.x),this}static floor(t){return Math.floor(t)}floor(){return this.x=r.floor(this.x),this}static ceil(t){return Math.ceil(t)}ceil(){return this.x=r.ceil(this.x),this}static round(t){return Math.round(t)}round(){return this.x=r.round(this.x),this}static smooth(t,e,s){return s<=1?e:t+(e-t)/s}smooth(t,e){return this.x=r.smooth(this.x,t,e),this}};var d=class r{x;y;constructor(t,e){this.x=t,this.y=e}static new(t,e){return new this(t,e)}static zero(){return new this(0,0)}static all(t){return new this(t,t)}static from(t){return Array.isArray(t)?new this(...t):new this(t.x,t.y)}static magnitudeSquared(t,e){return t*t+e*e}static magnitude(t,e){return Math.sqrt(this.magnitudeSquared(t,e))}static average(...t){return this.zero().add(...t).divideBy(t.length)}static min(...t){return new this(Math.min(...t.map(e=>e.x)),Math.min(...t.map(e=>e.y)))}static max(...t){return new this(Math.max(...t.map(e=>e.x)),Math.max(...t.map(e=>e.y)))}static fromAngle(t){return new this(Math.cos(t),Math.sin(t))}clone(){return new r(this.x,this.y)}*[Symbol.iterator](){yield this.x,yield this.y}toJSON(){return[this.x,this.y]}toString(){return`(Vec2 x${this.x.toFixed(2)}, y${this.y.toFixed(2)})`}set_(t,e){return this.x=t,this.y=e,this}set({x:t,y:e}){return this.x=t,this.y=e,this}magnitudeSquared(){return r.magnitudeSquared(this.x,this.y)}magnitude(){return r.magnitude(this.x,this.y)}rotation(){return Math.atan2(this.y,this.x)}equals_(t,e){return this.x===t&&this.y===e}equals(...t){return t.every(({x:e,y:s})=>this.equals_(e,s))}near_(t,e,s=1e-6){return Math.abs(this.x-t)<=s&&Math.abs(this.y-e)<=s}near({x:t,y:e},s=1e-6){return this.near_(t,e,s)}dot_(t,e){return this.x*t+this.y*e}dot({x:t,y:e}){return this.dot_(t,e)}distanceSquared_(t,e){return t=this.x-t,e=this.y-e,t*t+e*e}distanceSquared({x:t,y:e}){return this.distanceSquared_(t,e)}distance_(t,e){return Math.sqrt(this.distanceSquared_(t,e))}distance({x:t,y:e}){return this.distance_(t,e)}angleBetween_(t,e){let s=this.dot_(t,e),o=this.magnitude()*r.magnitude(t,e);if(o===0)return 0;let n=x.clamp(s/o,-1,1);return Math.acos(n)}angleBetween({x:t,y:e}){return this.angleBetween_(t,e)}normalize(){return this.divideBy(this.magnitude())}half(){return this.divideBy(2)}double(){return this.multiplyBy(2)}abs(){return this.map(t=>Math.abs(t))}rotate(t){let{x:e,y:s}=this;return this.x=e*Math.cos(t)-s*Math.sin(t),this.y=e*Math.sin(t)+s*Math.cos(t),this}perpendicular(){let{x:t,y:e}=this;return this.x=-e,this.y=t,this}clampMagnitude(t){return this.magnitude()>t&&this.normalize().multiplyBy(t),this}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}map(t){return this.x=t(this.x,0),this.y=t(this.y,1),this}clamp(t,e){return this.x=x.clamp(this.x,t.x,e.x),this.y=x.clamp(this.y,t.y,e.y),this}clampBy(t,e){return this.x=x.clamp(this.x,t,e),this.y=x.clamp(this.y,t,e),this}negate(){return this.map(t=>t*-1)}addBy(t){return this.x+=t,this.y+=t,this}subtractBy(t){return this.x-=t,this.y-=t,this}multiplyBy(t){return this.x*=t,this.y*=t,this}divideBy(t){return t===0?this:(this.x/=t,this.y/=t,this)}add_(t,e){return this.x+=t,this.y+=e,this}add(...t){for(let{x:e,y:s}of t)this.add_(e,s);return this}subtract_(t,e){return this.x-=t,this.y-=e,this}subtract(...t){for(let{x:e,y:s}of t)this.subtract_(e,s);return this}multiply_(t,e){return this.x*=t,this.y*=e,this}multiply(...t){for(let{x:e,y:s}of t)this.multiply_(e,s);return this}divide_(t,e){return t!==0&&(this.x/=t),e!==0&&(this.y/=e),this}divide(...t){for(let{x:e,y:s}of t)this.divide_(e,s);return this}lerp_(t,e,s){return this.x+=(t-this.x)*s,this.y+=(e-this.y)*s,this}lerp({x:t,y:e},s){return this.lerp_(t,e,s)}approach_(t,e,s,o,n){return this.x=x.approach(this.x,t,s,o,n),this.y=x.approach(this.y,e,s,o,n),this}approach({x:t,y:e},s,o,n){return this.approach_(t,e,s,o,n)}reflect_(t,e){let s=2*this.dot_(t,e);return this.x-=s*t,this.y-=s*e,this}reflect({x:t,y:e}){return this.reflect_(t,e)}rotateAroundPoint_(t,e,s){let o=this.x-t,n=this.y-e,i=Math.cos(s),c=Math.sin(s);return this.x=i*o-c*n+t,this.y=c*o+i*n+e,this}rotateAroundPoint({x:t,y:e},s){return this.rotateAroundPoint_(t,e,s)}smooth_(t,e,s){return this.x=x.smooth(this.x,t,s),this.y=x.smooth(this.y,e,s),this}smooth({x:t,y:e},s){return this.smooth_(t,e,s)}};var Fe=g`
30
+ `;var y=class r{x;constructor(t){this.x=t}static new(t){return new this(t)}clone(){return new r(this.x)}set(t){return this.x=t,this}static isBetween(t,e=0,s=1){let i=Math.min(e,s),o=Math.max(e,s);return t>=i&&t<=o}isBetween(t=0,e=1){return r.isBetween(this.x,t,e)}static isNear(t,e,s=.01){return Math.abs(t-e)<=s}isNear(t,e=.01){return r.isNear(this.x,t,e)}static add(...t){let e=0;for(let s of t)e+=s;return e}add(...t){return this.x=r.add(this.x,...t),this}subtract(...t){for(let e of t)this.x-=e;return this}static atLeast(t,e=0){return Math.max(t,e)}atLeast(t=0){return this.x=r.atLeast(this.x,t),this}static atMost(t,e=1){return Math.min(t,e)}atMost(t=1){return this.x=r.atMost(this.x,t),this}static clamp(t,e=0,s=1){return t=r.atLeast(t,Math.min(e,s)),t=r.atMost(t,Math.max(e,s)),t}clamp(t=0,e=1){return this.x=r.clamp(this.x,t,e),this}static lerp(t,e,s,i){let n=(e-t)*s;return i!==void 0&&Math.abs(n)>i&&(n=Math.sign(n)*i),t+n}lerp(t,e,s){return this.x=r.lerp(this.x,t,e,s),this}static step(t,e,s){let i=e-t;return Math.abs(i)<=s?e:t+Math.sign(i)*s}step(t,e){return this.x=r.step(this.x,t,e),this}static creep(t,e,s,i){let o=t*(1-Math.exp(-e*s));if(i!==void 0){let n=i*s;Math.abs(o)>n&&(o=Math.sign(o)*n)}return o}static approach(t,e,s,i,o){let n=e-t,c=this.creep(n,s,i,o);return t+c}approach(t,e,s,i){return this.x=r.approach(this.x,t,e,s,i),this}static wrap(t,e=0,s=1){let i=Math.min(e,s),n=Math.max(e,s)-i,c=t-i,a=c<0?n- -c%n:c%n;return i+a}wrap(t=0,e=1){return this.x=r.wrap(this.x,t,e),this}static constrainProximity(t,e,s){let i=e-t,o=Math.abs(i),n=o>s?s:o,c=i<0?-n:n;return t+c}constrainProximity(t,e){return this.x=r.constrainProximity(this.x,t,e),this}static inverse(t){return 1-t}inverse(){return this.x=r.inverse(this.x),this}static center(t){return t*2-1}center(){return this.x=r.center(this.x),this}static uncenter(t){return(t+1)/2}uncenter(){return this.x=r.uncenter(this.x),this}static map(t,e,s){let o=(s-e)*t;return e+o}map(t,e){return this.x=r.map(this.x,t,e),this}static remap(t,e,s,i=0,o=1,n=!1){let a=(t-e)/(s-e)*(o-i)+i;return n?r.clamp(a,i,o):a}remap(t,e,s=0,i=1,o=!1){return this.x=r.remap(this.x,t,e,s,i,o),this}static magnify(t){return 4*Math.pow(t-.5,3)+.5}magnify(){return this.x=r.magnify(this.x),this}static floor(t){return Math.floor(t)}floor(){return this.x=r.floor(this.x),this}static ceil(t){return Math.ceil(t)}ceil(){return this.x=r.ceil(this.x),this}static round(t){return Math.round(t)}round(){return this.x=r.round(this.x),this}static smooth(t,e,s){return s<=1?e:t+(e-t)/s}smooth(t,e){return this.x=r.smooth(this.x,t,e),this}};var b=class r{x;y;constructor(t,e){this.x=t,this.y=e}static new(t,e){return new this(t,e)}static zero(){return new this(0,0)}static all(t){return new this(t,t)}static from(t){return Array.isArray(t)?new this(...t):new this(t.x,t.y)}static magnitudeSquared(t,e){return t*t+e*e}static magnitude(t,e){return Math.sqrt(this.magnitudeSquared(t,e))}static average(...t){return this.zero().add(...t).divideBy(t.length)}static min(...t){return new this(Math.min(...t.map(e=>e.x)),Math.min(...t.map(e=>e.y)))}static max(...t){return new this(Math.max(...t.map(e=>e.x)),Math.max(...t.map(e=>e.y)))}static fromAngle(t){return new this(Math.cos(t),Math.sin(t))}clone(){return new r(this.x,this.y)}*[Symbol.iterator](){yield this.x,yield this.y}toJSON(){return[this.x,this.y]}toString(){return`(Vec2 x${this.x.toFixed(2)}, y${this.y.toFixed(2)})`}set_(t,e){return this.x=t,this.y=e,this}set({x:t,y:e}){return this.x=t,this.y=e,this}magnitudeSquared(){return r.magnitudeSquared(this.x,this.y)}magnitude(){return r.magnitude(this.x,this.y)}rotation(){return Math.atan2(this.y,this.x)}equals_(t,e){return this.x===t&&this.y===e}equals(...t){return t.every(({x:e,y:s})=>this.equals_(e,s))}near_(t,e,s=1e-6){return Math.abs(this.x-t)<=s&&Math.abs(this.y-e)<=s}near({x:t,y:e},s=1e-6){return this.near_(t,e,s)}dot_(t,e){return this.x*t+this.y*e}dot({x:t,y:e}){return this.dot_(t,e)}distanceSquared_(t,e){return t=this.x-t,e=this.y-e,t*t+e*e}distanceSquared({x:t,y:e}){return this.distanceSquared_(t,e)}distance_(t,e){return Math.sqrt(this.distanceSquared_(t,e))}distance({x:t,y:e}){return this.distance_(t,e)}angleBetween_(t,e){let s=this.dot_(t,e),i=this.magnitude()*r.magnitude(t,e);if(i===0)return 0;let o=y.clamp(s/i,-1,1);return Math.acos(o)}angleBetween({x:t,y:e}){return this.angleBetween_(t,e)}normalize(){return this.divideBy(this.magnitude())}half(){return this.divideBy(2)}double(){return this.multiplyBy(2)}abs(){return this.map(t=>Math.abs(t))}rotate(t){let{x:e,y:s}=this;return this.x=e*Math.cos(t)-s*Math.sin(t),this.y=e*Math.sin(t)+s*Math.cos(t),this}perpendicular(){let{x:t,y:e}=this;return this.x=-e,this.y=t,this}clampMagnitude(t){return this.magnitude()>t&&this.normalize().multiplyBy(t),this}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}map(t){return this.x=t(this.x,0),this.y=t(this.y,1),this}morph(t){let e=t(this);return e&&e!==this&&this.set(e),this}clamp(t={x:0,y:0},e={x:1,y:1}){return this.x=y.clamp(this.x,t.x,e.x),this.y=y.clamp(this.y,t.y,e.y),this}clampBy(t=0,e=1){return this.x=y.clamp(this.x,t,e),this.y=y.clamp(this.y,t,e),this}negate(){return this.map(t=>t*-1)}addBy(t){return this.x+=t,this.y+=t,this}subtractBy(t){return this.x-=t,this.y-=t,this}multiplyBy(t){return this.x*=t,this.y*=t,this}divideBy(t){return t===0?this:(this.x/=t,this.y/=t,this)}add_(t,e){return this.x+=t,this.y+=e,this}add(...t){for(let{x:e,y:s}of t)this.add_(e,s);return this}subtract_(t,e){return this.x-=t,this.y-=e,this}subtract(...t){for(let{x:e,y:s}of t)this.subtract_(e,s);return this}multiply_(t,e){return this.x*=t,this.y*=e,this}multiply(...t){for(let{x:e,y:s}of t)this.multiply_(e,s);return this}divide_(t,e){return t!==0&&(this.x/=t),e!==0&&(this.y/=e),this}divide(...t){for(let{x:e,y:s}of t)this.divide_(e,s);return this}lerp_(t,e,s){return this.x+=(t-this.x)*s,this.y+=(e-this.y)*s,this}lerp({x:t,y:e},s){return this.lerp_(t,e,s)}approach_(t,e,s,i,o){return this.x=y.approach(this.x,t,s,i,o),this.y=y.approach(this.y,e,s,i,o),this}approach({x:t,y:e},s,i,o){return this.approach_(t,e,s,i,o)}reflect_(t,e){let s=2*this.dot_(t,e);return this.x-=s*t,this.y-=s*e,this}reflect({x:t,y:e}){return this.reflect_(t,e)}rotateAroundPoint_(t,e,s){let i=this.x-t,o=this.y-e,n=Math.cos(s),c=Math.sin(s);return this.x=n*i-c*o+t,this.y=c*i+n*o+e,this}rotateAroundPoint({x:t,y:e},s){return this.rotateAroundPoint_(t,e,s)}smooth_(t,e,s){return this.x=y.smooth(this.x,t,s),this.y=y.smooth(this.y,e,s),this}smooth({x:t,y:e},s){return this.smooth_(t,e,s)}};var Ne=class{state;players;constructor(t,e){this.state=t,this.players=e}tick(){for(let t of this.players){let{agent:e,port:{actions:s}}=t,i=1;e.position.y+=i*s.gameplay.up.value,e.position.y-=i*s.gameplay.down.value,e.position.x-=i*s.gameplay.left.value,e.position.x+=i*s.gameplay.right.value,e.position.clamp(b.zero(),this.state.arenaSize)}}};var Le=class{label="0";alive=!0;color="#444";position=b.zero()};var He=class{arenaSize=new b(200,100);agents=new Set;makeAgent(t){let e=new Le;return e.label=t,e.position.set_(.5,.5).multiply(this.arenaSize),this.agents.add(e),e}deleteAgent(t){return this.agents.delete(t),this}};var At=class{};function St(r,{start:t,end:e}){return!(t&&r<t||e&&r>e)}var Ve=class extends At{#t=new Map;async gets(...t){return t.map(e=>this.#t.get(e))}async hasKeys(...t){return t.map(e=>this.#t.has(e))}async*keys(t={}){if(t.limit===0)return;let e=0;for(let s of this.#t.keys())if(St(s,t)&&(yield s,e+=1),e>=(t.limit??1/0))break}async*entries(t={}){if(t.limit===0)return;let e=0;for(let[s,i]of this.#t.entries())if(St(s,t)&&(yield[s,i],e+=1),e>=(t.limit??1/0))break}async transaction(...t){for(let[e,s]of t)s===void 0?this.#t.delete(e):this.#t.set(e,s)}};function hs(r,t,e){let s=Object.entries(t);for(let[i,o]of s)r.addEventListener(i,o,e);return function(){for(let[o,n]of s)r.removeEventListener(o,n)}}var kt=class extends At{storage;static onStorageEvent=t=>hs(window,{storage:t});constructor(t=window.localStorage){super(),this.storage=t}async gets(...t){return t.map(e=>this.storage.getItem(e)??void 0)}async hasKeys(...t){return t.map(e=>this.storage.getItem(e)!==null)}async*keys(t={}){if(t.limit===0)return;let e=0;for(let s of Object.keys(this.storage))if(St(s,t)&&(yield s,e+=1),e>=(t.limit??1/0))break}async*entries(t={}){if(t.limit===0)return;let e=0;for(let[s,i]of Object.entries(this.storage))if(St(s,t)&&(yield[s,i],e+=1),e>=(t.limit??1/0))break}async transaction(...t){for(let[e,s]of t)s===void 0?this.storage.removeItem(e):this.storage.setItem(e,s)}};async function ps(r){let t=[];for await(let e of r)t.push(e);return t}var qe=class{kv;key;write;constructor(t,e){this.kv=t,this.key=e,this.write=new kr(t.write,e)}async set(t){return this.kv.set(this.key,t)}async get(){return this.kv.get(this.key)}async require(){return this.kv.require(this.key)}async guarantee(t){let e=await this.get();return e===void 0&&(e=await t(),await this.set(e)),e}},kr=class{key;#t;constructor(t,e){this.key=e,this.#t=t}set(t){return this.#t.set(this.key,t)}};var Qt={parse:r=>JSON.parse(r),stringify:r=>JSON.stringify(r)};var Ue=class{#t;constructor(t){this.#t=t}sets(...t){return t.map(([e,s])=>{let i=this.#t.prefix(e),o=s===void 0?void 0:Qt.stringify(s);return[i,o]})}set(t,e){return this.sets([t,e])}del(...t){return t.map(e=>[this.#t.prefix(e),void 0])}};function*us(r,t){if(r<=0)throw new Error("chunk size must be greater than zero");for(let e=0;e<t.length;e+=r)yield t.slice(e,e+r)}var Ie=class{#t;constructor(t){let{scopes:e,divisor:s,delimiter:i}=t;this.#t=e.length>0?e.join(s)+i:""}prefix=t=>this.#t+t;unprefix=t=>{let e=this.#t.length;return t.slice(e)};scan=t=>{let{limit:e}=t,s=this.#t+(t.start??""),i=this.#t+(t.end??"\xFF");return{limit:e,start:s,end:i}}};var Fe=class r{driver;static collect=ps;write;#t;#e;constructor(t=new Ve,e={}){this.driver=t,this.#t={scopes:[],divisor:".",delimiter:":",chunkSize:1e4,...e},this.#e=new Ie(this.#t),this.write=new Ue(this.#e)}async gets(...t){return(await this.driver.gets(...t.map(this.#e.prefix))).map(s=>s===void 0?s:Qt.parse(s))}async get(t){let[e]=await this.gets(t);return e}async requires(...t){let e=await this.gets(...t);for(let s of e)if(s===void 0)throw new Error("required key not found");return e}async require(t){let[e]=await this.requires(t);return e}async hasKeys(...t){return this.driver.hasKeys(...t.map(this.#e.prefix))}async has(t){let[e]=await this.hasKeys(t);return e}async*keys(t={}){for await(let e of this.driver.keys(this.#e.scan(t)))yield this.#e.unprefix(e)}async clear(t={}){let e=[];for await(let s of this.keys(t))e.push(s);for(let s of us(this.#t.chunkSize,e))await this.del(...s)}async*entries(t={}){for await(let[e,s]of this.driver.entries(this.#e.scan(t)))yield[this.#e.unprefix(e),Qt.parse(s)]}async*values(t){for await(let[,e]of this.entries(t))yield e}async transaction(t){let e=t(this.write).flat();return this.driver.transaction(...e)}async set(t,e){return this.transaction(s=>[s.set(t,e)])}async sets(...t){return this.transaction(e=>[e.sets(...t)])}async del(...t){return this.transaction(e=>[e.del(...t)])}async guarantee(t,e){let s=await this.get(t);return s===void 0&&(s=await e(),await this.transaction(i=>[i.set(t,s)])),s}async versionMigration(t,e,s){let i=this,o=await i.get(t)??0;typeof o!="number"&&(o=0),o!==e&&(await s(o),await i.set(t,e))}store(t){return new qe(this,t)}scope(t,e=this.#t.delimiter){return new r(this.driver,{...this.#t,delimiter:e,scopes:[...this.#t.scopes,t]})}flatten(){return new r(this.driver,{...this.#t,delimiter:""})}};var te=class r{profiles=new k;portProfiles=[];metaBindings=null;constructor(t){if(t){for(let e of t.profiles)this.profiles.set(e.id,e);this.portProfiles=t.portProfiles.map(e=>e&&(this.profiles.has(e)?e:null)),this.metaBindings=t.metaBindings}}toJSON(){return fe.clone({profiles:[...this.profiles.values()],portProfiles:this.portProfiles,metaBindings:this.metaBindings})}clone(){return new r(this.toJSON())}getProfile(t){return this.profiles.get(t)}getProfileForPort(t){let e=this.portProfiles.at(t);return e?this.getProfile(e):void 0}};var We=class{store;$catalog;static async load(t){let e=g(new te(await t.get()));return new this(t,e)}dispose=P();constructor(t,e){this.store=t,this.$catalog=e,this.dispose.schedule(kt.onStorageEvent(async()=>this.reload()))}async reload(){let t=new te(await this.store.get());await this.$catalog.set(t)}async save(t){await this.store.set(t.toJSON()),await this.$catalog(t)}async#t(t){let e=this.$catalog().clone(),s=t(e);return await this.store.set(e.toJSON()),await this.$catalog(e),s}async createProfile(t,e){return this.#t(s=>{let i=q.random(),o={id:i,label:t,bindings:e};return s.profiles.set(i,o),o})}async deleteProfile(t){return this.#t(e=>{e.profiles.delete(t)})}async assignPortProfile(t,e){return this.#t(s=>{s.portProfiles[t]=e})}};function O(r){return r>0}var Ke=class{on=T();onDown=T();#t=0;#e=0;get value(){return this.#t}set value(t){this.#e=this.#t,this.#t=t,this.on.publish(this),this.down&&this.onDown.publish(this)}get previous(){return this.#e}get changed(){return this.#t!==this.#e}get pressed(){return O(this.#t)}get down(){return!O(this.#e)&&O(this.#t)}get up(){return O(this.#e)&&!O(this.#t)}};var j=class extends k{constructor(t){if(super(),t)for(let[e,s]of t)this.set(e,s)}zero(){for(let t of this.keys())this.set(t,0);return this}mergeSample([t,e]){let s=this.get(t)??0;return e>s&&this.set(t,e),this}};function ds([,,r]){return{lastValue:0,holdStart:0,settings:li(r)}}function ci(){return{scale:1,invert:!1,clamp:null,range:null,bottom:null,top:null,timing:["direct"]}}function li(r={}){return{...ci(),...r}}var ms=(r,t,e)=>$r(e).line(function(i){let{settings:o}=t;if(o.clamp){let[n,c]=o.clamp;i=y.clamp(i,n,c)}if(o.range){let[n,c]=o.range;i=y.isBetween(i,n,c)?y.remap(i,n,c,0,1,!0):0}return o.bottom&&(i=i<o.bottom?0:i),o.top&&(i=Math.min(o.top,i)),i},function(i){return t.settings.invert?1-i:i},function(i){return t.settings.scale*i},function(i){let{settings:o}=t,n=(o.timing[0]==="direct"?void 0:o.timing[1])??250,c=!O(t.lastValue)&&O(i),a=O(t.lastValue)&&!O(i),l=r-t.holdStart>=n;switch(c&&(t.holdStart=r),t.lastValue=i,o.timing[0]){case"direct":return i;case"tap":return a&&!l?1:0;case"hold":return O(i)&&l?i:0;default:throw new Error("unknown bindings timing")}});function fs(r){return r.length>0?Math.max(...r):0}function gs(r){return r.length>0?Math.min(...r):0}var Ge=class{bindings;actions;#t=new Set;#e=new j;#r=0;#s=new k;#i=Ft();constructor(t){this.bindings=t,this.actions=It(t,(e,s)=>It(e,i=>{let o=new Ke;return this.#i.subscribe(()=>{o.value=this.#t.has(s)?this.#n()(i):0}),o}))}resolve(t,e,s){return this.#r=t,this.#t=e,this.#e=s,this.#i(),this.actions}#o(t,e,s){let i=this.#s.guarantee(t,()=>ds(["code",e,s])),o=this.#e.get(e)??0;return ms(this.#r,i,o)}#n=(t={count:0})=>e=>{let s=this.#n(t);if(typeof e=="string")return this.#o(t.count++,e);switch(e[0]){case"code":{let[,i,o]=e;return this.#o(t.count++,i,o)}case"and":{let[,...i]=e,o=i.map(s);return gs(o)}case"or":{let[,...i]=e,o=i.map(s);return fs(o)}case"not":{let[,i]=e;return s(i)>0?0:1}case"cond":{let[,i,o]=e;return s(o)>0?s(i):0}case"mods":{let[,i,o]=e,n=(a,...l)=>a?["or",...l]:["not",["or",...l]];return s(["cond",i,["and",n(o.ctrl??!1,"ControlLeft","ControlRight"),n(o.alt??!1,"AltLeft","AltRight"),n(o.meta??!1,"MetaLeft","MetaRight"),n(o.shift??!1,"ShiftLeft","ShiftRight")]])>0?s(i):0}}}};var K=class{*[Symbol.iterator](){for(let t of this.samples())yield t}};var _t=class extends K{devices=new pt;#t=new j;constructor(...t){super(),this.devices.adds(...t)}*samples(){this.#t.zero();for(let t of this.devices)for(let e of t.samples())this.#t.mergeSample(e);yield*this.#t.entries()}};var G=class extends Ge{#t=new _t;devices=this.#t.devices;modes=new pt;constructor(t){super(t),this.modes.adds(...Object.keys(t))}resolve(t=Date.now()){let e=new j(this.#t.samples());return super.resolve(t,this.modes,e)}};var ot="meta";var Et=()=>({[ot]:{revealOverlay:["or","Backslash","gamepad.beta","gamepad.gamma"],shimmyNext:["or","BracketRight",["and",["or","gamepad.beta","gamepad.gamma"],"gamepad.right"],["and",["or","gamepad.beta","gamepad.gamma"],"gamepad.bumper.right"]],shimmyPrevious:["or","BracketLeft",["and",["or","gamepad.beta","gamepad.gamma"],"gamepad.left"],["and",["or","gamepad.beta","gamepad.gamma"],"gamepad.bumper.left"]]}});var Ye=class{device;metaPort;constructor(t,e=Et()){this.device=t,this.metaPort=new G(e),this.metaPort.devices.add(t)}};var Xe=class{ports;metaBindings;on=T();#t=new k;metaPort;constructor(t,e=Et()){this.ports=t,this.metaBindings=e,this.metaPort=new G(e)}poll(t=Date.now()){return this.#r(t),this.#s(t),this.#i(t)}portByIndex(t){let e=this.ports.at(t);if(!e)throw new Error(`port ${t} not found`);return e}portByDevice(t){for(let e of this.ports)if(e.devices.has(t))return e}shimmy(t,e){let s=this.ports.findIndex(c=>c.devices.has(t)),i=Math.max(0,this.ports.length-1),o=y.clamp(s+e,0,i),n=this.portByIndex(o);return this.reassign(t,n),n}reassign(t,e=this.getLonelyPort()){this.ports.forEach(s=>s.devices.delete(t)),e.devices.add(t),this.#e()}unplug(t){this.ports.forEach(e=>e.devices.delete(t)),this.#t.delete(t),this.#e()}plug=(t,e=this.getLonelyPort())=>(this.unplug(t),this.#t.set(t,new Ye(t,this.metaBindings)),e.devices.add(t),this.#e(),()=>this.unplug(t));getLonelyPort(){let t=this.ports.at(0);for(let e of this.ports)e.devices.size<t.devices.size&&(t=e);return t}#e=z(0,()=>this.on.publish());#r(t){this.metaPort.devices.clear(),this.metaPort.devices.adds(...this.#t.keys()),this.metaPort.resolve(t)}#s(t){for(let e of this.#t.values()){let s=e.metaPort.resolve(t);s[ot].shimmyNext.down&&this.shimmy(e.device,1),s[ot].shimmyPrevious.down&&this.shimmy(e.device,-1)}}#i(t){return this.ports.map(e=>(e.resolve(t),e))}};function ys(r,t){let e=fe.clone(r);if(!t)return e;for(let[s,i]of Object.entries(e))for(let o of Object.keys(i)){let n=t[s]?.[o];n&&(i[o]=n)}return e}function ee(r){return r>=0?[r,0]:[0,Math.abs(r)]}function re(r){let[t,e]=ee(r.x),[s,i]=ee(r.y);return{up:i,down:s,left:e,right:t}}var U=class extends K{channel;$vector=g(b.zero());$breakdown=Ee(()=>re(this.$vector.get()));constructor(t="stick"){super(),this.channel=t}samples(){let{channel:t}=this,{up:e,down:s,left:i,right:o}=this.$breakdown.get();return[[`${t}.up`,e],[`${t}.down`,s],[`${t}.left`,i],[`${t}.right`,o]]}};var N=class extends K{on=T();sampleMap=new j;setSample(t,e){return this.sampleMap.set(t,e),this.on.pub(t,e),this}*samples(){for(let t of this.sampleMap)yield t}};var Mt=class extends N{stickLeft=new U;stickRight=new U;samples(){let t=this.stickLeft.$breakdown();this.setSample("gamepad.stick.left.up",t.up),this.setSample("gamepad.stick.left.down",t.down),this.setSample("gamepad.stick.left.left",t.left),this.setSample("gamepad.stick.left.right",t.right);let e=this.stickRight.$breakdown();return this.setSample("gamepad.stick.right.up",e.up),this.setSample("gamepad.stick.right.down",e.down),this.setSample("gamepad.stick.right.left",e.left),this.setSample("gamepad.stick.right.right",e.right),super.samples()}};var Je=class r extends N{client=new b(0,0);movement=new b(0,0);dispose=P();constructor(t=window){super(),this.dispose.schedule(st(t,{pointerdown:e=>{let s=r.buttonCode(e);this.setSample(s,1)},pointerup:e=>{let s=r.buttonCode(e);this.setSample(s,0)},pointermove:e=>{this.client.x=e.clientX,this.client.y=e.clientY,this.movement.x+=e.movementX,this.movement.y+=e.movementY},wheel:e=>{this.sampleMap.set("pointer.wheel.right",0),this.sampleMap.set("pointer.wheel.left",0),this.sampleMap.set("pointer.wheel.up",0),this.sampleMap.set("pointer.wheel.down",0);for(let[s,i]of r.wheelCodes(e))this.setSample(s,i)}}))}static buttonCode(t){switch(t.button){case 0:return"pointer.button.left";case 1:return"pointer.button.middle";case 2:return"pointer.button.right";default:return`pointer.button.${t.button+1}`}}static wheelCodes(t){let e=[];return t.deltaX&&e.push([t.deltaX>0?"pointer.wheel.right":"pointer.wheel.left",t.deltaX]),t.deltaY&&e.push([t.deltaY>0?"pointer.wheel.down":"pointer.wheel.up",t.deltaY]),e}samples(){return this.#t(),super.samples()}#t(){let[t,e]=this.movement,[s,i]=ee(t),[o,n]=ee(e);t&&(t>=0?this.setSample("pointer.move.right",Math.abs(i)):this.setSample("pointer.move.left",Math.abs(s))),e&&(e>=0?this.setSample("pointer.move.up",Math.abs(n)):this.setSample("pointer.move.down",Math.abs(o))),this.movement.set_(0,0)}};var Ze=class extends N{dispose=P();constructor(t=window){super(),this.dispose.schedule(st(t,this.#t)),this.dispose.schedule(st(window,this.#e))}#t={keydown:t=>{if(t.repeat)return null;this.setSample(t.code,1)},keyup:t=>{if(t.repeat)return null;this.setSample(t.code,0)}};#e={blur:()=>{this.sampleMap.zero()}}};var Y=class extends _t{keyboard=new Ze;pointer=new Je;vpad=new Mt;constructor(){super(),this.devices.add(this.keyboard).add(this.pointer).add(this.vpad)}};function se(r,t){let e=b.from(r),s=e.distance_(0,0),i=y.remap(s,t.x,t.y,0,1,!0);return e.normalize().multiplyBy(i)}var hi=["gamepad.a","gamepad.b","gamepad.x","gamepad.y","gamepad.bumper.left","gamepad.bumper.right","gamepad.trigger.left","gamepad.trigger.right","gamepad.alpha","gamepad.beta","gamepad.stick.left.click","gamepad.stick.right.click","gamepad.up","gamepad.down","gamepad.left","gamepad.right","gamepad.gamma"],Ct=class extends N{pad;range=new b(.2,.9);constructor(t){super(),this.pad=t}get gamepad(){return this.pad.gamepad}samples(){return this.#t(this.pad.gamepad),this.#e(this.pad.gamepad),super.samples()}#t(t){let e=0,s=i=>{e=Math.max(e,i)};for(let[i,o]of hi.entries()){let n=t.buttons.at(i)?.value??0;s(n),this.setSample(o,n)}this.setSample("gamepad.any",e)}#e(t){let[e=0,s=0,i=0,o=0]=t.axes,n=re(se(new b(e,s),this.range)),c=re(se(new b(i,o),this.range));this.setSample("gamepad.stick.left.up",n.up),this.setSample("gamepad.stick.left.down",n.down),this.setSample("gamepad.stick.left.left",n.left),this.setSample("gamepad.stick.left.right",n.right),this.setSample("gamepad.stick.right.up",c.up),this.setSample("gamepad.stick.right.down",c.down),this.setSample("gamepad.stick.right.left",c.left),this.setSample("gamepad.stick.right.right",c.right)}};var Qe=class{fallback="\u2754";#t=new Map;constructor(t=[[Y,"\u{1F4BB}"],[Ct,"\u{1F3AE}"],[Mt,"\u{1F4F1}"]]){this.add(...t)}get(t){return this.#t.get(t)??this.fallback}add(...t){for(let[e,s]of t)this.#t.set(e,s);return this}clear(){return this.#t.clear(),this}};var pi=r=>ye(r).map(t=>`hsl(${(t*(360/r)+180)%360}deg, 100%, 50%)`),tr=class extends ge{constructor(){super(()=>pi(12))}};var _r=class{icon;label;color;constructor(t,e,s){this.icon=t,this.label=e,this.color=s}},Pt=class{icons=new Qe;#t=new xe;#e=new tr;get(t){return this.#t.guarantee(t,()=>new _r(this.icons.get(t.constructor),q.random(4),this.#e.takeFirst()))}};var er=class{hub;deviceSkins;auto=!0;dispose=P();#t=Date.now();#e=g(!1);$manual=g(!1);$visible=g.derived(()=>this.$manual()||this.auto&&this.#e());$showLabels=g(!1);constructor(t,e=new Pt){this.hub=t,this.deviceSkins=e,this.dispose.schedule(t.on(async()=>{Date.now()-this.#t>100&&await this.bump()}))}#r=z(1500,()=>this.#e(!1));async bump(){await this.#e(!0),await this.#r()}async toggle(t=!this.$manual()){return this.$manual.set(t)}};var xs=_`
31
31
 
32
32
  :host {
33
- display: block;
34
- width: 8em;
35
- aspect-ratio: 1 / 1;
36
- touch-action: none;
33
+ --gap: 0.3em;
34
+ pointer-events: none;
35
+ cursor: default;
36
+ user-select: none;
37
37
  }
38
38
 
39
- .container {
40
- width: 100%;
41
- height: 100%;
39
+ .portlist {
40
+ pointer-events: none;
41
+
42
+ display: flex;
43
+ align-items: start;
44
+
45
+ width: max-content;
46
+ gap: var(--gap);
47
+ padding: 0.5em;
48
+
49
+ color: #fff8;
50
+ background: #222a;
51
+ border-radius: 1em;
52
+
53
+ opacity: 0;
54
+ transition: opacity 300ms linear;
55
+
56
+ &[data-active] {
57
+ opacity: 1;
58
+ pointer-events: all;
59
+ }
60
+
61
+ .port {
62
+ flex: 1 0 0;
63
+ display: flex;
64
+ flex-direction: column;
65
+
66
+ min-width: 6em;
67
+ gap: var(--gap);
68
+
69
+ > * {
70
+ color: white;
71
+ font-weight: bold;
72
+ text-shadow: 0.05em 0.05em 0.1em #0008;
73
+ text-transform: uppercase;
74
+ }
75
+
76
+ header {
77
+ text-align: center;
78
+ color: #fff8;
79
+ }
80
+
81
+ .device {
82
+ display: flex;
83
+ flex-direction: column;
84
+ gap: var(--gap);
85
+
86
+ box-shadow: 0.1em 0.2em 0.7em #0004;
87
+ background: color-mix(in srgb, #fffa, var(--color) 50%);
88
+ border-top: 2px solid #fff8;
89
+ border-bottom: 2px solid #0004;
90
+ border-radius: 0.5em;
91
+
92
+ .row {
93
+ display: flex;
94
+ align-items: center;
95
+
96
+ &.primary {
97
+ justify-content: space-between;
98
+ }
99
+
100
+ &.secondary {
101
+ justify-content: center;
102
+ }
103
+ }
104
+
105
+ .icon {
106
+ font-size: 1.5em;
107
+ }
108
+
109
+ .label {
110
+ font-family: monospace;
111
+ font-size: 0.8em;
112
+ opacity: 0.5;
113
+ line-height: 0.9em;
114
+ }
115
+
116
+ button {
117
+ opacity: 0.2;
118
+ cursor: pointer;
119
+ padding: 0 0.2em;
120
+ font-family: monospace;
121
+ font-size: 1.5em;
122
+ font-weight: bold;
123
+
124
+ background: transparent;
125
+ border: 1px solid transparent;
126
+ text-shadow: inherit;
127
+
128
+ &:is(:hover, :focus-visible) {
129
+ opacity: 1;
130
+ }
131
+ }
132
+ }
133
+ }
134
+ }
135
+
136
+ `;var Bt=class extends B{#t;get deck(){if(!this.#t)throw new Error(".deck was not set on component, but is required");return this.#t}set deck(t){this.#t=t}};var rr=class extends $(t=>e=>{t.css(C,xs),t.attrs.strings.deck="overlay";let{hub:s,deviceSkins:i,overlayVisibility:{$visible:o,$showLabels:n}}=e;function c(a){let l=i.get(a),p=`--color: ${l.color};`,h=()=>s.shimmy(a,1);return v`
137
+ <div class=device style="${p}">
138
+ <div class="primary row">
139
+ <button @click="${()=>s.shimmy(a,-1)}">&lt;</button>
140
+ <div class=icon>${l.icon}</div>
141
+ <button @click="${h}">&gt;</button>
142
+ </div>
143
+
144
+ ${n()?v`
145
+ <div class="secondary row">
146
+ <div class=label>${l.label}</div>
147
+ </div>
148
+ `:null}
149
+ </div>
150
+ `}return v`
151
+ <div class=portlist ?data-active="${o()}">
152
+ ${s.ports.map((a,l)=>v`
153
+ <div class=port>
154
+ <header>P${l+1}</header>
155
+ ${a.devices.array().map(c)}
156
+ </div>
157
+ `)}
158
+ </div>
159
+ `}).component(Bt).props(t=>[t.deck]){};var bs=_`
160
+
161
+ `;var Ot=class extends $(t=>e=>{t.css(C,bs),t.attrs.strings.deck="bindings";let{db:s,hub:i}=e,o=s.$catalog(),n={id:"default",label:"default",bindings:e.baseBindings},c=[n,...o.profiles.values()],a=t.signal("default"),l=s.$catalog().getProfile(a())??n;function p(A,D){let Rt=o.getProfileForPort(D)??n;return v`
162
+ <div class=port>
163
+ <span>port ${D+1}</span>
164
+ <select>
165
+ ${c.map(lr=>v`
166
+ <option
167
+ data-id="${lr.id}"
168
+ ?selected="${lr.id===Rt.id}">
169
+ ${lr.label}
170
+ </option>
171
+ `)}
172
+ </select>
173
+ </div>
174
+ `}function h([A,D]){return v`
175
+ <div class=bracket>
176
+ <strong class=mode>${A}</strong>
177
+ <div>${Object.entries(D).map(u)}</div>
178
+ </div>
179
+ `}function u([A,D]){return v`
180
+ <div class=bind>
181
+ <span class=action>${A}</span>
182
+ </div>
183
+ `}let m=async()=>{let{bindings:A}=l,D=rt.random(4),Rt=await s.createProfile(D,A);a(Rt.id)},w=A=>async()=>{await s.deleteProfile(A)},R=A=>{let Rt=A.target.value;a(Rt)};return v`
184
+ <div class=portlist>
185
+ ${i.ports.map(p)}
186
+ </div>
187
+
188
+ <div class=bindable>
189
+ <select @input="${R}">
190
+ ${c.map(A=>v`
191
+ <option value="${A.id}" ?selected="${A.id===l.id}">${A.label}</option>
192
+ `)}
193
+ </select>
194
+ <button @click="${m}">clone</button>
195
+ <button ?disabled="${l.id===n.id}" @click="${w(l.id)}">delete</button>
196
+ <div class=bindings>
197
+ ${Object.entries(l.bindings).map(h)}
198
+ </div>
199
+ </div>
200
+ `}).component(Bt).props(t=>[t.deck]){};var ui={DeckOverlay:rr,DeckBindings:Ot},ws=r=>Ut(ui).map(t=>class extends t{deck=r});var sr=class{baseBindings;baseMetaBindings;hub;db;static async load(t){let e=await We.load(t.kv.store("catalog")),s=ye(t.portCount).map(o=>e.$catalog().getProfileForPort(o)).map(o=>ys(t.bindings,o?.bindings)).map(o=>new G(o)),i=new Xe(s,e.$catalog().metaBindings??t.metaBindings??Et());return new this(t.bindings,t.metaBindings,i,e)}dispose=P();deviceSkins=new Pt;primaryDevice=new Y;overlayVisibility;components=ws(this);views=Ut(this.components).map(t=>(...e)=>t.view(this,...e));registerComponents(){f.register(this.components)}constructor(t,e,s,i){this.baseBindings=t,this.baseMetaBindings=e,this.hub=s,this.db=i,this.overlayVisibility=new er(s,this.deviceSkins),this.dispose.schedule(s.metaPort.actions[ot].revealOverlay.on(o=>{o.pressed&&this.overlayVisibility.bump()}))}get catalog(){return this.db.$catalog()}};var Er=class{port;agent;constructor(t,e){this.port=t,this.agent=e}},ir=class{#t=new k;constructor(t,e){for(let[s,i]of t.ports.entries()){let o=(s+1).toString();this.#t.set(i,new Er(i,e.makeAgent(o)))}}[Symbol.iterator](){return this.#t.values()}require(t){return this.#t.require(t)}};var or=class{state;canvas=(()=>{let t=document.createElement("canvas");return t.width=200,t.height=100,t})();ctx=this.canvas.getContext("2d");constructor(t){this.state=t}percent(t){let e=Math.min(this.canvas.width,this.canvas.height);return Math.ceil(e*(t/100))}resolve(t){return t.clone().divide(this.state.arenaSize).morph(e=>{e.y=1-e.y}).multiply_(this.canvas.width,this.canvas.height)}render(){let{state:t}=this;this.#e();let e=[...t.agents].reverse(),s=e.filter(o=>!o.alive),i=e.filter(o=>o.alive);for(let o of s)this.#r(o);for(let o of i)this.#s(o)}#t(){let{ctx:t}=this;return t.imageSmoothingEnabled=!1,t.fillStyle="#000",t.strokeStyle="#000",t.lineWidth=1,t.font="10px sans-serif",t.textAlign="center",t.textBaseline="middle",t}#e(){let{canvas:t}=this,e=this.#t();e.fillStyle="#000",e.fillRect(0,0,t.width,t.height)}#r(t){let e=this.#t(),s=this.percent(10),{position:i}=t,[o,n]=this.resolve(i);e.font=`${s*1.3}px sans-serif`,e.textAlign="center",e.textBaseline="middle",e.fillStyle="#fff4",e.fillText(t.label,o,n)}#s(t){let e=this.#t(),s=this.percent(10),{color:i,position:o}=t,[n,c]=this.resolve(o);e.beginPath(),e.arc(n,c,s,0,Math.PI*2),e.fillStyle=i,e.fill(),e.lineWidth=this.percent(2),e.strokeStyle="#fff",e.stroke(),e.font=`${s*1.3}px sans-serif`,e.textAlign="center",e.textBaseline="middle",e.strokeStyle="#0004",e.strokeText(t.label,n,c),e.fillStyle="#fff",e.fillText(t.label,n,c)}};var X=class extends U{hub;constructor(t){super(),this.hub=t}shimmyNext=()=>this.hub.shimmy(this,1);shimmyPrevious=()=>this.hub.shimmy(this,-1)};var vs={gameplay:{up:["or","KeyW","ArrowUp","stick.up","gamepad.stick.left.up","gamepad.stick.right.up"],down:["or","KeyS","ArrowDown","stick.down","gamepad.stick.left.down","gamepad.stick.right.down"],left:["or","KeyA","ArrowLeft","stick.left","gamepad.stick.left.left","gamepad.stick.right.left"],right:["or","KeyD","ArrowRight","stick.right","gamepad.stick.left.right","gamepad.stick.right.right"]}};function $s(r,t){let e=r;return()=>{let s=t();return s!=null&&(e=s),e}}var Mr=class{get;constructor(t){this.get=t}get gamepad(){return this.get()}};function As(r){let t=new k;return st(window,{gamepadconnected:({gamepad:e})=>{let s=()=>navigator.getGamepads().at(e.index),i=new Mr($s(e,s)),o=r(i);t.set(e.index,{pad:i,dispose:o})},gamepaddisconnected:({gamepad:e})=>{let s=t.get(e.index);s&&(t.delete(e.index),s.dispose())}})}function Ss(r){return As(t=>r(new Ct(t)))}function ks(){let r=new kt(window.localStorage);return new Fe(r).scope("tact")}var nr=class{deck;static async load(){return new this(await sr.load({portCount:4,kv:ks(),bindings:vs}))}logic;dispose=P();state=new He;renderer=new or(this.state);constructor(t){this.deck=t,this.deck.deviceSkins.icons.add([X,"\u{1F518}"]),this.logic=new Ne(this.state,new ir(t.hub,this.state)),this.dispose.schedule(this.deck.hub.on(()=>{for(let e of this.logic.players){e.agent.alive=e.port.devices.size>0;let[s]=e.port.devices;e.agent.color=s?this.deck.deviceSkins.get(s).color:"#444"}})),this.plug(new Y),this.plug(new X(t.hub)),this.dispose.schedule(Ss(t.hub.plug))}plug(t){return this.deck.hub.plug(t),()=>this.unplug(t)}unplug(t){this.deck.hub.unplug(t)}loop(t){return be(async()=>{await ht(1e3/t),this.deck.hub.poll(),this.logic.tick(),this.renderer.render()})}};var _s=(r,t,e)=>{let s=new Map;for(let i=t;i<=e;i++)s.set(r[i],i);return s},Es=Jt(class extends wt{constructor(r){if(super(r),r.type!==Re.CHILD)throw Error("repeat() can only be used in text expressions")}dt(r,t,e){let s;e===void 0?e=t:t!==void 0&&(s=t);let i=[],o=[],n=0;for(let c of r)i[n]=s?s(c,n):n,o[n]=e(c,n),n++;return{values:o,keys:i}}render(r,t,e){return this.dt(r,t,e).values}update(r,[t,e,s]){let i=ns(r),{values:o,keys:n}=this.dt(t,e,s);if(!Array.isArray(i))return this.ut=n,o;let c=this.ut??=[],a=[],l,p,h=0,u=i.length-1,m=0,w=o.length-1;for(;h<=u&&m<=w;)if(i[h]===null)h++;else if(i[u]===null)u--;else if(c[h]===n[m])a[m]=W(i[h],o[m]),h++,m++;else if(c[u]===n[w])a[w]=W(i[u],o[w]),u--,w--;else if(c[h]===n[w])a[w]=W(i[h],o[w]),bt(r,a[w+1],i[h]),h++,w--;else if(c[u]===n[m])a[m]=W(i[u],o[m]),bt(r,i[h],i[u]),u--,m++;else if(l===void 0&&(l=_s(n,m,w),p=_s(c,h,u)),l.has(c[h]))if(l.has(c[u])){let R=p.get(n[m]),A=R!==void 0?i[R]:null;if(A===null){let D=bt(r,i[h]);W(D,o[m]),a[m]=D}else a[m]=W(A,o[m]),bt(r,i[h],A),i[R]=null;m++}else Oe(i[u]),u--;else Oe(i[h]),h++;for(;m<=w;){let R=bt(r,a[w+1]);W(R,o[m]),a[m++]=R}for(;h<=u;){let R=i[h++];R!==null&&Oe(R)}return this.ut=n,os(r,a),V}});var Ms=_`
201
+
202
+ :host {
203
+ display: flex;
204
+ flex-direction: column;
205
+ align-items: center;
206
+
207
+ gap: 1em;
42
208
  }
43
209
 
44
- [part="graphic"] {
210
+ .surface {
211
+ position: relative;
45
212
  width: 100%;
46
- height: 100%;
213
+ height: auto;
214
+ aspect-ratio: 2 / 1;
215
+ overflow: hidden;
216
+
217
+ background: #000;
218
+ border: 0.5em solid #fff4;
219
+ border-radius: 2em;
220
+
221
+ canvas {
222
+ display: block;
223
+ position: absolute;
224
+ inset: 0;
225
+
226
+ width: 100%;
227
+ height: 100%;
228
+
229
+ image-rendering: pixelated;
230
+ outline: 1px solid red;
231
+ }
232
+
233
+ [deck="overlay"] {
234
+ position: absolute;
235
+ top: 10%;
236
+ left: 0;
237
+ right: 0;
238
+
239
+ display: flex;
240
+ flex-direction: column;
241
+ justify-content: center;
242
+ align-items: center;
243
+ }
47
244
  }
48
245
 
49
- `;var We=g`
246
+ .dlist {
247
+ display: flex;
248
+ flex-wrap: wrap;
249
+ justify-content: center;
250
+ align-items: center;
251
+ gap: 0.5em;
252
+ }
253
+
254
+ `;var Cs=_`
50
255
 
51
256
  :host {
52
- display: block;
53
- width: 8em;
54
- height: 8em;
55
- --size: var(--nub-stick-size, 66%);
56
- --background: var(--nub-stick-background, black);
57
- --color: var(--nub-stick-color, white);
257
+ --color: #aaa;
58
258
  }
59
259
 
60
- [part="base"] {
260
+ .box {
261
+ display: flex;
262
+ align-items: center;
263
+ justify-content: center;
264
+
265
+ gap: 0.2em;
266
+ padding: 0.2em;
267
+ padding-right: 0.5em;
268
+
269
+ border-radius: 2em;
270
+ background: color-mix(in srgb, #fff4, var(--color));
271
+ }
272
+
273
+ [view="nub-stick"] {
274
+ width: 2em;
275
+ }
276
+
277
+ .label {
278
+ font-size: 1.2em;
279
+ font-weight: bold;
280
+
281
+ padding: 0 0.5em;
282
+ text-align: center;
283
+
284
+ color: white;
285
+ text-shadow: 0.1em 0.1em 0.1em #0004;
286
+ }
287
+
288
+ button {
289
+ font-size: 0.8em;
290
+ padding: 0.2em;
291
+ }
292
+
293
+ `;var Ps=_`
294
+
295
+ :host {
296
+ --nub-size: 60%;
297
+ --nub-color: #fff8;
298
+
61
299
  position: relative;
62
- aspect-ratio: 1/1;
63
- width: 100%;
64
- height: 100%;
65
- background: var(--background);
300
+ display: block;
301
+
302
+ cursor: default;
303
+ user-select: none;
304
+
305
+ width: 6em;
306
+ height: auto;
307
+ aspect-ratio: 1 / 1;
308
+
309
+ background: #0008;
66
310
  border-radius: 100%;
311
+ outline: 1px solid color-mix(in srgb, transparent, var(--nub-color) 10%);
312
+ }
313
+
314
+ :host * {
315
+ pointer-events: none;
67
316
  }
68
317
 
69
- [part="over"], [part="under"] {
318
+ .frame {
70
319
  position: absolute;
71
320
  inset: 0;
72
- width: var(--size);
73
- height: var(--size);
74
- border-radius: 100%;
75
321
  margin: auto;
76
- pointer-events: none;
77
- background: var(--color);
322
+
323
+ width: 100%;
324
+ height: auto;
325
+ aspect-ratio: 1 / 1;
326
+
327
+ > div {
328
+ position: absolute;
329
+ inset: 0;
330
+ margin: auto;
331
+ width: var(--nub-size);
332
+ height: auto;
333
+ aspect-ratio: 1 / 1;
334
+ border-radius: 100%;
335
+ }
78
336
  }
79
337
 
80
- [part="under"] {
81
- opacity: 0.5;
338
+ .inner {
339
+ outline: 1px solid color-mix(in srgb, transparent, var(--nub-color) 10%);
82
340
  }
83
341
 
84
- `;var se=({x:r,y:t})=>`
85
- transform: translate(
86
- ${r}px,
87
- ${t}px
88
- );
89
- `;function Ze(r,t){let e=r.getBoundingClientRect(),s=e.width/2,o=t.getBoundingClientRect().width/4;return{rect:e,radius:s-o}}function Je(r,t){return r!==void 0?t.clone().multiply_(r,-r):d.zero()}var Ke=_(r=>(t,e)=>{r.name("nub-stick-graphic"),r.styles(We);let s=r.signal(null);r.rendered.then(()=>{let c=r.shadow.querySelector('[part="base"]'),a=r.shadow.querySelector('[part="over"]');if(c&&a){let u=Ze(c,a);s.value=u,e(u)}});let o=Je(s.value?.radius,t),n=se(o),i=se(o.clone().half());return U`
90
- <div part=base>
91
- <div part=under style="${i}"></div>
92
- <div part=over style="${n}"></div>
93
- </div>
94
- `});function Qe({set_vector:r,set_pointer_position:t}){let e;return{pointerdown:{handleEvent:s=>{s.preventDefault();let o=s.currentTarget;e&&o.releasePointerCapture(e),e=s.pointerId,o.setPointerCapture(e),t(d.new(s.clientX,s.clientY)),r(d.zero())}},pointermove:{passive:!1,handleEvent:s=>{s.preventDefault(),s.pointerId===e&&t(d.new(s.clientX,s.clientY))}},pointerup:{handleEvent:s=>{s.preventDefault(),e=void 0,r(d.zero())}}}}function Ye(r,{x:t,y:e}){return t**2+e**2<r**2}function Xe(r,{x:t,y:e}){let s=Math.sqrt(t**2+e**2);return d.new(t/s*r,e/s*r)}function Ge({radius:r,rect:{left:t,top:e,width:s,height:o}},{x:n,y:i}){let c=t+s/2,a=e+o/2,u=d.new(n-c,i-a);Ye(r,u)||(u=Xe(r,u));let[h,l]=u,m=d.new(h/r,-(l/r));return[...m].some(isNaN)?d.zero():m}var tr=_(r=>t=>{r.name("nub-stick"),r.styles(Fe);let e,s=n=>e=n,o=r.once(()=>Qe({set_vector:n=>t.vector.value=n,set_pointer_position:n=>{e&&(t.vector.value=Ge(e,n))}}));return r.mount(()=>(t.vector.set(d.zero()),()=>t.vector.set(d.zero()))),U`
95
- <div
96
- class=container
97
- .vector="${t.vector}"
98
- @pointerdown="${o.pointerdown}"
99
- @pointermove="${o.pointermove}"
100
- @pointerup="${o.pointerup}"
101
- >
102
- ${Ke.attr("part","graphic").props(t.vector.get(),s)}
342
+ .outer {
343
+ outline: 1px solid color-mix(in srgb, transparent, var(--nub-color) 10%);
344
+ }
345
+
346
+ .stickbase {
347
+ display: none;
348
+ background: color-mix(in srgb, transparent, var(--nub-color) 25%);
349
+ }
350
+
351
+ .stickunder {
352
+ background: color-mix(in srgb, transparent, var(--nub-color) 50%);
353
+ }
354
+
355
+ .stick {
356
+ background: #fff8;
357
+ }
358
+
359
+ `;var di=$(r=>({$vector:t})=>{r.name("nub-stick"),r.css(C,Ps);let e=r.once(()=>new b(.2,.8)),s=r.signal(void 0);r.mount(()=>{function a(p){let h=r.element.getBoundingClientRect(),u=t.get();u.x=y.remap(p.clientX,h.left,h.right,-1,1),u.y=y.remap(p.clientY,h.top,h.bottom,-1,1),u.set(se(u,e)),t.publish()}function l(){s.value!==void 0&&(t.get().set_(0,0),t.publish(),ht(0).then(()=>{s.value!==void 0&&(r.element.releasePointerCapture(s.value),s.value=void 0)}))}return Kr(f.events(document.body,{click:[{capture:!0},p=>{s.value!==void 0&&(p.preventDefault(),p.stopPropagation())}]}),f.events(r.element,{pointerdown:p=>{s.value===void 0&&(s.value=p.pointerId,r.element.setPointerCapture(s.value),a(p))},pointermove:[{},p=>{s.value!==void 0&&a(p)}],pointerup:l,pointercancel:l}))});let i=t.get(),o=`width: ${e.x*100}%;`,n=`width: ${e.y*100}%;`,c=a=>{let l=a*.5,p=l*i.x*100,h=l*i.y*100;return`
360
+ transform-origin: center center;
361
+ transform: translate(${p}%, ${h}%);
362
+ `};return v`
363
+ <div class=frame>
364
+ <div class=inner style="${o}"></div>
365
+ </div>
366
+
367
+ <div class=frame>
368
+ <div class=outer style="${n}"></div>
369
+ </div>
370
+
371
+ <div class=frame>
372
+ <div class=stickbase></div>
373
+ </div>
374
+
375
+ <div class=frame style="${c(.5)}">
376
+ <div class=stickunder></div>
377
+ </div>
378
+
379
+ <div class=frame style="${c(1)}">
380
+ <div class=stick></div>
381
+ </div>
382
+ `}),ar=class extends di.component(class extends B{device=new U}).props(t=>[t.device]){};var Bs=$(r=>(t,e,s)=>{r.styles(C,Cs),r.attrs.strings.device="virtual";let i=()=>t.unplug(e);return v`
383
+ <div class=box>
384
+ ${ar.view(e)}
385
+
386
+ <button @click="${e.shimmyPrevious}">👈</button>
387
+ <button @click="${i}">💀</button>
388
+ <button @click="${e.shimmyNext}">👉</button>
103
389
  </div>
104
- `});var Mt=class{};var Ct=class extends Mt{on=Me();#t=new Map;setSample(t,e){return this.#t.set(t,e),this.on.pub(t,e),this}takeSamples(){let t=[...this.#t];return this.#t.clear(),t}};function oe(r){return r>=0?[0,r]:[Math.abs(r),0]}var Pt=class extends Ct{channel;vector=$(d.zero());dispose;constructor(t="stick"){super(),this.channel=t,this.dispose=this.vector.on(()=>{let{up:e,down:s,left:o,right:n}=this.breakdown();this.setSample(`${t}.up`,e),this.setSample(`${t}.down`,s),this.setSample(`${t}.left`,o),this.setSample(`${t}.right`,n)})}breakdown(){let{x:t,y:e}=this.vector.get(),[s,o]=oe(e),[n,i]=oe(t);return{up:o,down:s,left:n,right:i}}};q.register({TactDemo:_.component(r=>{let t=r.once(()=>new Pt);return tr(t)})});console.log("tact");
390
+ `});var cr=class extends $(t=>e=>{t.css(C,Ms),t.mount(()=>e.loop(60)),t.mount(()=>e.deck.hub.on(t.render));let s=()=>e.plug(new X(e.deck.hub)),i=()=>e.deck.overlayVisibility.bump(),o=e.deck.hub.ports.flatMap(n=>n.devices.array()).filter(n=>n instanceof X).map(n=>({device:n,skin:e.deck.deviceSkins.get(n)})).sort((n,c)=>n.skin.label<c.skin.label?-1:1);return v`
391
+ <div class=surface>
392
+ ${e.renderer.canvas}
393
+ ${e.deck.views.DeckOverlay()}
394
+ </div>
395
+
396
+ <div class=dlist>
397
+ ${Es(o,n=>n.skin.label,({device:n,skin:c})=>Bs.props(e.deck.hub,n,c).attr("style",`--color: ${c.color};`).render())}
398
+
399
+ <button @click="${s}">
400
+
401
+ </button>
402
+
403
+ <button @click="${i}">
404
+ 👁️
405
+ </button>
406
+ </div>
407
+
408
+ ${Ot.view(e.deck)}
409
+ `}).component(class extends B{game}).props(t=>[t.game]){};var mi=await nr.load();f.register({DemoTheater:class extends cr{game=mi}});console.log("\u{1F3AE} tact");
105
410
  /*! Bundled license information:
106
411
 
107
412
  @lit/reactive-element/css-tag.js:
@@ -116,6 +421,7 @@ lit-html/lit-html.js:
116
421
  lit-element/lit-element.js:
117
422
  lit-html/directive.js:
118
423
  lit-html/async-directive.js:
424
+ lit-html/directives/repeat.js:
119
425
  (**
120
426
  * @license
121
427
  * Copyright 2017 Google LLC