@asymmetric-effort/specifyjs 1.1.0 → 1.1.7

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 (281) hide show
  1. package/dist/esm/components-barrel.js +1 -1
  2. package/dist/specifyjs-build.d.ts +1 -1
  3. package/dist/specifyjs-client.d.ts +1 -1
  4. package/dist/specifyjs-components.cjs.js +1 -1
  5. package/dist/specifyjs-components.d.ts +1 -1
  6. package/dist/specifyjs-components.esm.js +1 -1
  7. package/dist/specifyjs-dom.d.ts +1 -1
  8. package/dist/specifyjs-jsx-dev-runtime.cjs.js +1 -1
  9. package/dist/specifyjs-jsx-runtime.cjs.js +1 -1
  10. package/dist/specifyjs-server.d.ts +1 -1
  11. package/dist/specifyjs-telemetry.d.ts +1 -1
  12. package/dist/specifyjs.d.ts +1 -1
  13. package/dist/types/build/index.d.ts +4 -4
  14. package/dist/types/client/index.d.ts +3 -3
  15. package/dist/types/components/ad/adsense/src/index.d.ts +2 -2
  16. package/dist/types/components/analytics/google-analytics/src/index.d.ts +2 -2
  17. package/dist/types/components/component.d.ts +1 -1
  18. package/dist/types/components/data/analog-clock/src/index.d.ts +2 -2
  19. package/dist/types/components/data/avatar/src/index.d.ts +2 -2
  20. package/dist/types/components/data/badge/src/index.d.ts +2 -2
  21. package/dist/types/components/data/board/src/Board.d.ts +2 -2
  22. package/dist/types/components/data/board/src/BoardReducer.d.ts +1 -1
  23. package/dist/types/components/data/board/src/Card.d.ts +2 -2
  24. package/dist/types/components/data/board/src/CardLink.d.ts +1 -1
  25. package/dist/types/components/data/board/src/Container.d.ts +1 -1
  26. package/dist/types/components/data/board/src/NamespaceValidator.d.ts +1 -1
  27. package/dist/types/components/data/board/src/index.d.ts +13 -13
  28. package/dist/types/components/data/data-grid/src/index.d.ts +2 -2
  29. package/dist/types/components/data/digital-clock/src/index.d.ts +2 -2
  30. package/dist/types/components/data/list-view/src/index.d.ts +2 -2
  31. package/dist/types/components/data/tag/src/index.d.ts +2 -2
  32. package/dist/types/components/data/virtual-scroll/src/index.d.ts +2 -2
  33. package/dist/types/components/error-boundary.d.ts +2 -2
  34. package/dist/types/components/errors/_shared/src/index.d.ts +2 -2
  35. package/dist/types/components/errors/http-400/src/index.d.ts +2 -2
  36. package/dist/types/components/errors/http-401/src/index.d.ts +2 -2
  37. package/dist/types/components/errors/http-403/src/index.d.ts +2 -2
  38. package/dist/types/components/errors/http-404/src/index.d.ts +2 -2
  39. package/dist/types/components/errors/http-405/src/index.d.ts +2 -2
  40. package/dist/types/components/errors/http-408/src/index.d.ts +2 -2
  41. package/dist/types/components/errors/http-429/src/index.d.ts +2 -2
  42. package/dist/types/components/errors/http-500/src/index.d.ts +2 -2
  43. package/dist/types/components/errors/http-502/src/index.d.ts +2 -2
  44. package/dist/types/components/errors/http-503/src/index.d.ts +2 -2
  45. package/dist/types/components/errors/http-504/src/index.d.ts +2 -2
  46. package/dist/types/components/feedback/alert/src/index.d.ts +2 -2
  47. package/dist/types/components/feedback/banner/src/index.d.ts +2 -2
  48. package/dist/types/components/feedback/empty-state/src/index.d.ts +2 -2
  49. package/dist/types/components/feedback/progress-bar/src/index.d.ts +2 -2
  50. package/dist/types/components/feedback/skeleton/src/index.d.ts +2 -2
  51. package/dist/types/components/feedback/spinner/src/index.d.ts +2 -2
  52. package/dist/types/components/form/buildable-list/src/index.d.ts +2 -2
  53. package/dist/types/components/form/button/src/index.d.ts +2 -2
  54. package/dist/types/components/form/checkbox/src/index.d.ts +2 -2
  55. package/dist/types/components/form/color-picker/src/index.d.ts +2 -2
  56. package/dist/types/components/form/color-wheel/src/index.d.ts +2 -2
  57. package/dist/types/components/form/datepicker/src/index.d.ts +2 -2
  58. package/dist/types/components/form/file-upload/src/index.d.ts +2 -2
  59. package/dist/types/components/form/multiline/src/MultilineField.d.ts +1 -1
  60. package/dist/types/components/form/multiline/src/index.d.ts +2 -2
  61. package/dist/types/components/form/number-spinner/src/index.d.ts +2 -2
  62. package/dist/types/components/form/radio/src/index.d.ts +2 -2
  63. package/dist/types/components/form/select/src/index.d.ts +2 -2
  64. package/dist/types/components/form/slider/src/index.d.ts +2 -2
  65. package/dist/types/components/form/texteditor/src/TextEditor.d.ts +1 -1
  66. package/dist/types/components/form/texteditor/src/index.d.ts +2 -2
  67. package/dist/types/components/form/textfield/src/TextField.d.ts +1 -1
  68. package/dist/types/components/form/textfield/src/index.d.ts +2 -2
  69. package/dist/types/components/form/timepicker/src/index.d.ts +2 -2
  70. package/dist/types/components/form/toggle/src/index.d.ts +2 -2
  71. package/dist/types/components/form/wrapper/src/index.d.ts +2 -2
  72. package/dist/types/components/layout/app-drag-drop/src/index.d.ts +2 -2
  73. package/dist/types/components/layout/app-message-bus/src/index.d.ts +2 -2
  74. package/dist/types/components/layout/card/src/index.d.ts +2 -2
  75. package/dist/types/components/layout/desktop-background/src/DesktopBackground.d.ts +1 -1
  76. package/dist/types/components/layout/desktop-background/src/index.d.ts +2 -2
  77. package/dist/types/components/layout/draggable-window/src/DraggableWindow.d.ts +1 -1
  78. package/dist/types/components/layout/draggable-window/src/index.d.ts +4 -4
  79. package/dist/types/components/layout/flex-container/src/index.d.ts +2 -2
  80. package/dist/types/components/layout/footer/src/index.d.ts +2 -2
  81. package/dist/types/components/layout/grid/src/index.d.ts +2 -2
  82. package/dist/types/components/layout/panel/src/index.d.ts +2 -2
  83. package/dist/types/components/layout/scroll-container/src/index.d.ts +2 -2
  84. package/dist/types/components/layout/splitter/src/index.d.ts +2 -2
  85. package/dist/types/components/layout/tabs/src/index.d.ts +2 -2
  86. package/dist/types/components/layout/window-manager/src/index.d.ts +2 -2
  87. package/dist/types/components/math/src/index.d.ts +5 -5
  88. package/dist/types/components/math/src/mat4.d.ts +2 -2
  89. package/dist/types/components/math/src/quaternion.d.ts +1 -1
  90. package/dist/types/components/math/src/solver.d.ts +1 -1
  91. package/dist/types/components/media/carousel/src/index.d.ts +2 -2
  92. package/dist/types/components/media/image/src/index.d.ts +2 -2
  93. package/dist/types/components/media/video-player/src/index.d.ts +2 -2
  94. package/dist/types/components/nav/accordion/src/Accordion.d.ts +1 -1
  95. package/dist/types/components/nav/accordion/src/index.d.ts +2 -2
  96. package/dist/types/components/nav/breadcrumb/src/index.d.ts +2 -2
  97. package/dist/types/components/nav/dock/src/index.d.ts +2 -2
  98. package/dist/types/components/nav/dropdown/src/Dropdown.d.ts +1 -1
  99. package/dist/types/components/nav/dropdown/src/index.d.ts +2 -2
  100. package/dist/types/components/nav/menubar/src/index.d.ts +2 -2
  101. package/dist/types/components/nav/pagination/src/index.d.ts +2 -2
  102. package/dist/types/components/nav/sidebar/src/index.d.ts +2 -2
  103. package/dist/types/components/nav/stepper/src/index.d.ts +2 -2
  104. package/dist/types/components/nav/system-tray/src/index.d.ts +2 -2
  105. package/dist/types/components/nav/toolbar/src/index.d.ts +2 -2
  106. package/dist/types/components/nav/treenav/src/TreeNav.d.ts +3 -3
  107. package/dist/types/components/nav/treenav/src/index.d.ts +4 -4
  108. package/dist/types/components/nav/wrapper/src/index.d.ts +2 -2
  109. package/dist/types/components/overlay/context-menu/src/index.d.ts +2 -2
  110. package/dist/types/components/overlay/drawer/src/index.d.ts +2 -2
  111. package/dist/types/components/overlay/modal/src/index.d.ts +2 -2
  112. package/dist/types/components/overlay/popover/src/index.d.ts +2 -2
  113. package/dist/types/components/overlay/toast/src/index.d.ts +2 -2
  114. package/dist/types/components/overlay/tooltip/src/index.d.ts +2 -2
  115. package/dist/types/components/page/ide/src/index.d.ts +19 -19
  116. package/dist/types/components/page/trading-dashboard/src/index.d.ts +2 -2
  117. package/dist/types/components/page/unity-desktop/src/UnityApp.d.ts +2 -2
  118. package/dist/types/components/page/unity-desktop/src/UnityDesktop.d.ts +1 -1
  119. package/dist/types/components/page/unity-desktop/src/index.d.ts +8 -8
  120. package/dist/types/components/page/word-processor/src/index.d.ts +2 -2
  121. package/dist/types/components/viz/2D-bar-graph/src/index.d.ts +2 -2
  122. package/dist/types/components/viz/2D-cartesian-raw/src/index.d.ts +2 -2
  123. package/dist/types/components/viz/2D-complex-graph/src/index.d.ts +2 -2
  124. package/dist/types/components/viz/2D-discrete-cartesian/src/index.d.ts +2 -2
  125. package/dist/types/components/viz/2D-line-graph/src/index.d.ts +2 -2
  126. package/dist/types/components/viz/2D-pie-graph/src/index.d.ts +3 -3
  127. package/dist/types/components/viz/2D-polar-graph/src/index.d.ts +2 -2
  128. package/dist/types/components/viz/3d-force-graph/src/ForceGraph3D.d.ts +4 -4
  129. package/dist/types/components/viz/3d-force-graph/src/force-sim.d.ts +1 -1
  130. package/dist/types/components/viz/3d-force-graph/src/index.d.ts +6 -6
  131. package/dist/types/components/viz/3d-force-graph/src/types.d.ts +5 -5
  132. package/dist/types/components/viz/3d-layers/src/index.d.ts +2 -2
  133. package/dist/types/components/viz/3dSpace/src/Space3D.d.ts +12 -12
  134. package/dist/types/components/viz/3dSpace/src/animation.d.ts +1 -1
  135. package/dist/types/components/viz/3dSpace/src/bounds.d.ts +2 -2
  136. package/dist/types/components/viz/3dSpace/src/camera-controller.d.ts +1 -1
  137. package/dist/types/components/viz/3dSpace/src/camera.d.ts +2 -2
  138. package/dist/types/components/viz/3dSpace/src/collision.d.ts +2 -2
  139. package/dist/types/components/viz/3dSpace/src/cpu-pipeline.d.ts +7 -7
  140. package/dist/types/components/viz/3dSpace/src/geom-polyhedron.d.ts +3 -3
  141. package/dist/types/components/viz/3dSpace/src/geom-sphere.d.ts +3 -3
  142. package/dist/types/components/viz/3dSpace/src/index.d.ts +37 -37
  143. package/dist/types/components/viz/3dSpace/src/light.d.ts +2 -2
  144. package/dist/types/components/viz/3dSpace/src/lighting-model.d.ts +3 -3
  145. package/dist/types/components/viz/3dSpace/src/material.d.ts +1 -1
  146. package/dist/types/components/viz/3dSpace/src/picking.d.ts +5 -5
  147. package/dist/types/components/viz/3dSpace/src/pipeline-factory.d.ts +1 -1
  148. package/dist/types/components/viz/3dSpace/src/raycast.d.ts +4 -4
  149. package/dist/types/components/viz/3dSpace/src/render-pipeline.d.ts +5 -5
  150. package/dist/types/components/viz/3dSpace/src/scene-graph.d.ts +1 -1
  151. package/dist/types/components/viz/3dSpace/src/scene-object.d.ts +4 -4
  152. package/dist/types/components/viz/3dSpace/src/terrain.d.ts +2 -2
  153. package/dist/types/components/viz/3dSpace/src/texture.d.ts +1 -1
  154. package/dist/types/components/viz/3dSpace/src/types.d.ts +4 -4
  155. package/dist/types/components/viz/3dSpace/src/viewport.d.ts +2 -2
  156. package/dist/types/components/viz/3dSpace/src/webgl-pipeline.d.ts +6 -6
  157. package/dist/types/components/viz/3dSpace/src/webgpu-pipeline.d.ts +6 -6
  158. package/dist/types/components/viz/big-number/src/index.d.ts +2 -2
  159. package/dist/types/components/viz/bloch-sphere/src/index.d.ts +2 -2
  160. package/dist/types/components/viz/box-plot/src/index.d.ts +2 -2
  161. package/dist/types/components/viz/bubble-chart/src/index.d.ts +2 -2
  162. package/dist/types/components/viz/calendar-heat-map/src/index.d.ts +2 -2
  163. package/dist/types/components/viz/chord/src/index.d.ts +2 -2
  164. package/dist/types/components/viz/decomposition-tree/src/index.d.ts +2 -2
  165. package/dist/types/components/viz/earth-globe/src/index.d.ts +5 -5
  166. package/dist/types/components/viz/force-graph/src/index.d.ts +2 -2
  167. package/dist/types/components/viz/funnel/src/index.d.ts +2 -2
  168. package/dist/types/components/viz/gantt-chart/src/index.d.ts +2 -2
  169. package/dist/types/components/viz/gauge/src/index.d.ts +2 -2
  170. package/dist/types/components/viz/graph/src/HypercubeGraph.d.ts +1 -1
  171. package/dist/types/components/viz/graph/src/index.d.ts +4 -4
  172. package/dist/types/components/viz/heat-map/src/index.d.ts +2 -2
  173. package/dist/types/components/viz/histogram/src/index.d.ts +2 -2
  174. package/dist/types/components/viz/lollipop/src/index.d.ts +2 -2
  175. package/dist/types/components/viz/matrix/src/index.d.ts +2 -2
  176. package/dist/types/components/viz/partition/src/index.d.ts +2 -2
  177. package/dist/types/components/viz/pivot-table/src/index.d.ts +2 -2
  178. package/dist/types/components/viz/radar-chart/src/index.d.ts +2 -2
  179. package/dist/types/components/viz/sankey/src/index.d.ts +2 -2
  180. package/dist/types/components/viz/sunburst/src/index.d.ts +2 -2
  181. package/dist/types/components/viz/tree-map/src/index.d.ts +2 -2
  182. package/dist/types/components/viz/us-state-map/src/index.d.ts +4 -4
  183. package/dist/types/components/viz/vector-field/src/index.d.ts +2 -2
  184. package/dist/types/components/viz/waterfall/src/index.d.ts +2 -2
  185. package/dist/types/components/viz/word-cloud/src/index.d.ts +2 -2
  186. package/dist/types/components/viz/wrapper/src/index.d.ts +2 -2
  187. package/dist/types/compute/context.d.ts +1 -1
  188. package/dist/types/compute/cpu-backend.d.ts +1 -1
  189. package/dist/types/compute/index.d.ts +2 -2
  190. package/dist/types/compute/webgl-backend.d.ts +1 -1
  191. package/dist/types/compute/webgpu-backend.d.ts +1 -1
  192. package/dist/types/context/create-context.d.ts +1 -1
  193. package/dist/types/core/children.d.ts +1 -1
  194. package/dist/types/core/clone-element.d.ts +1 -1
  195. package/dist/types/core/create-element.d.ts +1 -1
  196. package/dist/types/core/create-ref.d.ts +1 -1
  197. package/dist/types/core/fiber.d.ts +1 -1
  198. package/dist/types/core/forward-ref.d.ts +1 -1
  199. package/dist/types/core/is-valid-element.d.ts +1 -1
  200. package/dist/types/core/lazy.d.ts +1 -1
  201. package/dist/types/core/memo.d.ts +1 -1
  202. package/dist/types/core/reconciler.d.ts +1 -1
  203. package/dist/types/core/src/build/index.d.ts +4 -4
  204. package/dist/types/core/src/client/index.d.ts +3 -3
  205. package/dist/types/core/src/components/component.d.ts +1 -1
  206. package/dist/types/core/src/components/error-boundary.d.ts +2 -2
  207. package/dist/types/core/src/components-barrel.d.ts +103 -103
  208. package/dist/types/core/src/compute/context.d.ts +1 -1
  209. package/dist/types/core/src/compute/cpu-backend.d.ts +1 -1
  210. package/dist/types/core/src/compute/index.d.ts +2 -2
  211. package/dist/types/core/src/compute/webgl-backend.d.ts +1 -1
  212. package/dist/types/core/src/compute/webgpu-backend.d.ts +1 -1
  213. package/dist/types/core/src/context/create-context.d.ts +1 -1
  214. package/dist/types/core/src/core/children.d.ts +1 -1
  215. package/dist/types/core/src/core/clone-element.d.ts +1 -1
  216. package/dist/types/core/src/core/create-element.d.ts +1 -1
  217. package/dist/types/core/src/core/create-ref.d.ts +1 -1
  218. package/dist/types/core/src/core/fiber.d.ts +1 -1
  219. package/dist/types/core/src/core/forward-ref.d.ts +1 -1
  220. package/dist/types/core/src/core/is-valid-element.d.ts +1 -1
  221. package/dist/types/core/src/core/lazy.d.ts +1 -1
  222. package/dist/types/core/src/core/memo.d.ts +1 -1
  223. package/dist/types/core/src/core/reconciler.d.ts +1 -1
  224. package/dist/types/core/src/devtools/index.d.ts +1 -1
  225. package/dist/types/core/src/dom/create-portal.d.ts +1 -1
  226. package/dist/types/core/src/dom/create-root.d.ts +1 -1
  227. package/dist/types/core/src/dom/index.d.ts +4 -4
  228. package/dist/types/core/src/dom/legacy.d.ts +1 -1
  229. package/dist/types/core/src/dom/work-loop.d.ts +1 -1
  230. package/dist/types/core/src/features/feature-flags.d.ts +1 -1
  231. package/dist/types/core/src/features/index.d.ts +2 -2
  232. package/dist/types/core/src/hooks/dispatcher.d.ts +1 -1
  233. package/dist/types/core/src/hooks/hook-state.d.ts +1 -1
  234. package/dist/types/core/src/hooks/index.d.ts +3 -3
  235. package/dist/types/core/src/index.d.ts +23 -23
  236. package/dist/types/core/src/jsx-dev-runtime.d.ts +1 -1
  237. package/dist/types/core/src/jsx-runtime.d.ts +2 -2
  238. package/dist/types/core/src/router/index.d.ts +12 -12
  239. package/dist/types/core/src/router/link-component.d.ts +1 -1
  240. package/dist/types/core/src/router/route-component.d.ts +1 -1
  241. package/dist/types/core/src/router/router-component.d.ts +1 -1
  242. package/dist/types/core/src/router/use-router.d.ts +1 -1
  243. package/dist/types/core/src/server/index.d.ts +3 -3
  244. package/dist/types/core/src/server/render-to-pipeable-stream.d.ts +1 -1
  245. package/dist/types/core/src/server/render-to-readable-stream.d.ts +1 -1
  246. package/dist/types/core/src/server/render-to-string.d.ts +1 -1
  247. package/dist/types/core/src/shared/types.d.ts +2 -2
  248. package/dist/types/core/src/telemetry/index.d.ts +2 -2
  249. package/dist/types/core/src/telemetry/metrics.d.ts +1 -1
  250. package/dist/types/demos/project-manager/src/Board.d.ts +4 -4
  251. package/dist/types/demos/project-manager/src/BoardState.d.ts +3 -3
  252. package/dist/types/demos/project-manager/src/InterApp.d.ts +1 -1
  253. package/dist/types/demos/project-manager/src/LocalStorage.d.ts +1 -1
  254. package/dist/types/demos/project-manager/src/types.d.ts +2 -2
  255. package/dist/types/devtools/index.d.ts +1 -1
  256. package/dist/types/dom/create-portal.d.ts +1 -1
  257. package/dist/types/dom/create-root.d.ts +1 -1
  258. package/dist/types/dom/index.d.ts +4 -4
  259. package/dist/types/dom/legacy.d.ts +1 -1
  260. package/dist/types/dom/work-loop.d.ts +1 -1
  261. package/dist/types/features/feature-flags.d.ts +1 -1
  262. package/dist/types/features/index.d.ts +2 -2
  263. package/dist/types/hooks/dispatcher.d.ts +1 -1
  264. package/dist/types/hooks/hook-state.d.ts +1 -1
  265. package/dist/types/hooks/index.d.ts +3 -3
  266. package/dist/types/index.d.ts +23 -23
  267. package/dist/types/jsx-dev-runtime.d.ts +1 -1
  268. package/dist/types/jsx-runtime.d.ts +2 -2
  269. package/dist/types/router/index.d.ts +12 -12
  270. package/dist/types/router/link-component.d.ts +1 -1
  271. package/dist/types/router/route-component.d.ts +1 -1
  272. package/dist/types/router/router-component.d.ts +1 -1
  273. package/dist/types/router/use-router.d.ts +1 -1
  274. package/dist/types/server/index.d.ts +3 -3
  275. package/dist/types/server/render-to-pipeable-stream.d.ts +1 -1
  276. package/dist/types/server/render-to-readable-stream.d.ts +1 -1
  277. package/dist/types/server/render-to-string.d.ts +1 -1
  278. package/dist/types/shared/types.d.ts +2 -2
  279. package/dist/types/telemetry/index.d.ts +2 -2
  280. package/dist/types/telemetry/metrics.d.ts +1 -1
  281. package/package.json +3 -2
@@ -4,6 +4,6 @@
4
4
  from { opacity: 0; transform: translateY(-12px); }
5
5
  to { opacity: 1; transform: translateY(0); }
6
6
  }
7
- `,document.head.appendChild(d),()=>{let u=document.getElementById(l);u&&u.remove()}},[]);let s=S(l=>t.dismiss(l),[t]),a=r.map(l=>o(Gl,{key:l.id,item:l,onDismiss:s}));return o("div",{style:i},...a)}function ti(e={}){let t=te(null);t.current||(t.current=_n(e));let n=t.current,r=S(()=>o(On,{toaster:n}),[n]);return{toast:n.toast,dismiss:n.dismiss,dismissAll:n.dismissAll,ToastContainer:r}}var Xl=6,Kl=8;function ql(e,t){let n=window.scrollX||window.pageXOffset,r=window.scrollY||window.pageYOffset,i=Kl;switch(t){case"top":return{position:"fixed",left:`${e.left+e.width/2}px`,top:`${e.top-i}px`,transform:"translate(-50%, -100%)"};case"bottom":return{position:"fixed",left:`${e.left+e.width/2}px`,top:`${e.bottom+i}px`,transform:"translateX(-50%)"};case"left":return{position:"fixed",left:`${e.left-i}px`,top:`${e.top+e.height/2}px`,transform:"translate(-100%, -50%)"};case"right":return{position:"fixed",left:`${e.right+i}px`,top:`${e.top+e.height/2}px`,transform:"translateY(-50%)"}}}function Zl(e){let t={position:"absolute",width:"0",height:"0",borderStyle:"solid"},n=`${Xl}px`,r="transparent",i="#1f2937";switch(e){case"top":return{...t,bottom:`-${n}`,left:"50%",transform:"translateX(-50%)",borderWidth:`${n} ${n} 0 ${n}`,borderColor:`${i} ${r} ${r} ${r}`};case"bottom":return{...t,top:`-${n}`,left:"50%",transform:"translateX(-50%)",borderWidth:`0 ${n} ${n} ${n}`,borderColor:`${r} ${r} ${i} ${r}`};case"left":return{...t,right:`-${n}`,top:"50%",transform:"translateY(-50%)",borderWidth:`${n} 0 ${n} ${n}`,borderColor:`${r} ${r} ${r} ${i}`};case"right":return{...t,left:`-${n}`,top:"50%",transform:"translateY(-50%)",borderWidth:`${n} ${n} ${n} 0`,borderColor:`${r} ${i} ${r} ${r}`}}}function ni(e){let{text:t,placement:n="top",delay:r=200,maxWidth:i="250px",children:s}=e,[a,l]=j(!1),[d,u]=j(null),h=te(null),p=te(null),c=`tooltip-${Math.random().toString(36).slice(2,9)}`,m=S(()=>{p.current=setTimeout(()=>{if(h.current){let x=h.current.getBoundingClientRect();u(ql(x,n))}l(!0)},r)},[r,n]),f=S(()=>{p.current&&(clearTimeout(p.current),p.current=null),l(!1)},[]);re(()=>()=>{p.current&&clearTimeout(p.current)},[]);let b={display:"inline-block"},y={...d??{},backgroundColor:"#1f2937",color:"#fff",fontSize:"13px",lineHeight:"1.4",padding:"6px 10px",borderRadius:"6px",maxWidth:i,zIndex:"10002",pointerEvents:"none",whiteSpace:"normal",wordWrap:"break-word"},g=[o("div",{ref:h,style:b,onMouseEnter:m,onMouseLeave:f,onFocus:m,onBlur:f,"aria-describedby":a?c:void 0},s)];return a&&d&&g.push(o("div",{id:c,style:y,role:"tooltip"},t,o("div",{style:Zl(n)}))),o("div",{style:{display:"inline-block",position:"relative"}},...g)}function Hn(e,t,n,r,i){return q(()=>{let s=Math.max(1,(r-i*(e+1))/e);return{valueScale:d=>t===0?0:d/t*n,categoryScale:d=>i+d*(s+i),barThickness:s,maxValue:t,valueAxisLength:n,categoryAxisLength:r}},[e,t,n,r,i])}function Jl(e,t,n){if(t&&t.length>0){if(n){let s=0;for(let a of t)for(let l of a.values)l.value>s&&(s=l.value);return s}let i=0;for(let s of t){let a=0;for(let l of s.values)a+=l.value;a>i&&(i=a)}return i}let r=0;for(let i of e)i.value>r&&(r=i.value);return r}function Ql(e){if(e<=0)return 1;let t=e/5,n=Math.pow(10,Math.floor(Math.log10(t))),r=t/n;return r<=1.5?n:r<=3.5?2*n:r<=7.5?5*n:10*n}function ec(e){let t=new Set;for(let n of e)for(let r of n.values)t.add(r.category);return Array.from(t)}var oi=["#3b82f6","#ef4444","#22c55e","#f59e0b","#8b5cf6","#ec4899","#14b8a6","#f97316","#6366f1","#84cc16"];function ri(e,t){return t||oi[e%oi.length]}function ii(e){let{data:t=[],width:n=600,height:r=400,orientation:i="vertical",barColor:s="#3b82f6",barGap:a=8,barRadius:l=4,showValues:d=!0,showGrid:u=!0,gridColor:h="#e5e7eb",title:p,padding:c=50,animate:m=!1,stacked:f,grouped:b=!1}=e,y=i==="vertical",g=n-c*2,x=r-c*2,v=y?x:g,R=y?g:x,D=f!==void 0&&f.length>0,M=q(()=>D?ec(f):[],[D,f]),$=D?f.length:t.length,A=q(()=>Jl(t,f,b),[t,f,b]),I=A>0?A:1,P=Hn($,I,v,R,a),L=S(()=>{if(!u)return[];let W=Ql(I),V=[];for(let K=W;K<=I;K+=W){let Q=P.valueScale(K);if(y){let G=c+x-Q;V.push(o("line",{key:`grid-${K}`,x1:String(c),y1:String(G),x2:String(c+g),y2:String(G),stroke:h,"stroke-width":"1","stroke-dasharray":"4 2"})),V.push(o("text",{key:`grid-label-${K}`,x:String(c-6),y:String(G+4),"text-anchor":"end","font-size":"11","font-family":"sans-serif",fill:"#6b7280"},String(K)))}else{let G=c+Q;V.push(o("line",{key:`grid-${K}`,x1:String(G),y1:String(c),x2:String(G),y2:String(c+x),stroke:h,"stroke-width":"1","stroke-dasharray":"4 2"})),V.push(o("text",{key:`grid-label-${K}`,x:String(G),y:String(c+x+16),"text-anchor":"middle","font-size":"11","font-family":"sans-serif",fill:"#6b7280"},String(K)))}}return V},[u,I,P,y,c,g,x,h]),E=S(()=>{let W=[];return y?(W.push(o("line",{key:"axis-y",x1:String(c),y1:String(c),x2:String(c),y2:String(c+x),stroke:"#374151","stroke-width":"1.5"})),W.push(o("line",{key:"axis-x",x1:String(c),y1:String(c+x),x2:String(c+g),y2:String(c+x),stroke:"#374151","stroke-width":"1.5"}))):(W.push(o("line",{key:"axis-x",x1:String(c),y1:String(c+x),x2:String(c+g),y2:String(c+x),stroke:"#374151","stroke-width":"1.5"})),W.push(o("line",{key:"axis-y",x1:String(c),y1:String(c),x2:String(c),y2:String(c+x),stroke:"#374151","stroke-width":"1.5"}))),W},[y,c,g,x]),B=S(()=>{let W=[];for(let V=0;V<t.length;V++){let K=t[V],Q=P.valueScale(K.value),G=P.categoryScale(V),O=K.color??s,Y,X,U=String(K.value);if(y){let Z=c+G,ee=c+x-Q;Y={x:String(Z),y:String(ee),width:String(P.barThickness),height:String(Q),rx:String(l),ry:String(l),fill:O},X={x:String(Z+P.barThickness/2),y:String(ee-6),"text-anchor":"middle","font-size":"11","font-family":"sans-serif",fill:"#374151"}}else{let Z=c+G,ee=c;Y={x:String(ee),y:String(Z),width:String(Q),height:String(P.barThickness),rx:String(l),ry:String(l),fill:O},X={x:String(ee+Q+6),y:String(Z+P.barThickness/2+4),"text-anchor":"start","font-size":"11","font-family":"sans-serif",fill:"#374151"}}if(m&&(Y.style=y?`animation: barGrow 0.6s ease-out ${V*.05}s both`:`animation: barGrow 0.6s ease-out ${V*.05}s both`),W.push(o("rect",{key:`bar-${V}`,...Y})),d&&W.push(o("text",{key:`val-${V}`,...X},U)),y){let Z=c+G+P.barThickness/2,ee=c+x+16;W.push(o("text",{key:`cat-${V}`,x:String(Z),y:String(ee),"text-anchor":"end","font-size":"11","font-family":"sans-serif",fill:"#374151",transform:`rotate(-45, ${Z}, ${ee})`},K.label))}else W.push(o("text",{key:`cat-${V}`,x:String(c-6),y:String(c+G+P.barThickness/2+4),"text-anchor":"end","font-size":"11","font-family":"sans-serif",fill:"#374151"},K.label))}return W},[t,P,s,l,d,m,y,c,x]),z=S(()=>{if(!f)return[];let W=[];for(let V=0;V<f.length;V++){let K=f[V],Q=P.categoryScale(V),G=0;for(let O=0;O<K.values.length;O++){let Y=K.values[O],X=P.valueScale(Y.value),U=P.valueScale(G),Z=ri(O,Y.color);if(y){let ee=c+Q,ae=c+x-U-X;W.push(o("rect",{key:`sbar-${V}-${O}`,x:String(ee),y:String(ae),width:String(P.barThickness),height:String(X),rx:O===K.values.length-1?String(l):"0",ry:O===K.values.length-1?String(l):"0",fill:Z,...m?{style:`animation: barGrow 0.6s ease-out ${(V*K.values.length+O)*.03}s both`}:{}})),d&&X>14&&W.push(o("text",{key:`sval-${V}-${O}`,x:String(ee+P.barThickness/2),y:String(ae+X/2+4),"text-anchor":"middle","font-size":"10","font-family":"sans-serif",fill:"#fff"},String(Y.value)))}else{let ee=c+U,ae=c+Q;W.push(o("rect",{key:`sbar-${V}-${O}`,x:String(ee),y:String(ae),width:String(X),height:String(P.barThickness),rx:O===K.values.length-1?String(l):"0",ry:O===K.values.length-1?String(l):"0",fill:Z,...m?{style:`animation: barGrow 0.6s ease-out ${(V*K.values.length+O)*.03}s both`}:{}})),d&&X>20&&W.push(o("text",{key:`sval-${V}-${O}`,x:String(ee+X/2),y:String(ae+P.barThickness/2+4),"text-anchor":"middle","font-size":"10","font-family":"sans-serif",fill:"#fff"},String(Y.value)))}G+=Y.value}if(d){let O=P.valueScale(G);y?W.push(o("text",{key:`stotal-${V}`,x:String(c+Q+P.barThickness/2),y:String(c+x-O-6),"text-anchor":"middle","font-size":"11","font-family":"sans-serif",fill:"#374151"},String(G))):W.push(o("text",{key:`stotal-${V}`,x:String(c+O+6),y:String(c+Q+P.barThickness/2+4),"text-anchor":"start","font-size":"11","font-family":"sans-serif",fill:"#374151"},String(G)))}if(y){let O=c+Q+P.barThickness/2,Y=c+x+16;W.push(o("text",{key:`scat-${V}`,x:String(O),y:String(Y),"text-anchor":"end","font-size":"11","font-family":"sans-serif",fill:"#374151",transform:`rotate(-45, ${O}, ${Y})`},K.label))}else W.push(o("text",{key:`scat-${V}`,x:String(c-6),y:String(c+Q+P.barThickness/2+4),"text-anchor":"end","font-size":"11","font-family":"sans-serif",fill:"#374151"},K.label))}return W},[f,P,l,d,m,y,c,x]),k=S(()=>{if(!f)return[];let W=M.length,V=[];for(let K=0;K<f.length;K++){let Q=f[K],G=P.categoryScale(K),O=2,Y=Math.max(1,(P.barThickness-O*(W-1))/W);for(let X=0;X<Q.values.length;X++){let U=Q.values[X],Z=M.indexOf(U.category),ee=Z*(Y+O),ae=P.valueScale(U.value),J=ri(Z>=0?Z:X,U.color);if(y){let se=c+G+ee,ce=c+x-ae;V.push(o("rect",{key:`gbar-${K}-${X}`,x:String(se),y:String(ce),width:String(Y),height:String(ae),rx:String(l),ry:String(l),fill:J,...m?{style:`animation: barGrow 0.6s ease-out ${(K*W+X)*.04}s both`}:{}})),d&&V.push(o("text",{key:`gval-${K}-${X}`,x:String(se+Y/2),y:String(ce-4),"text-anchor":"middle","font-size":"9","font-family":"sans-serif",fill:"#374151"},String(U.value)))}else{let se=c,ce=c+G+ee;V.push(o("rect",{key:`gbar-${K}-${X}`,x:String(se),y:String(ce),width:String(ae),height:String(Y),rx:String(l),ry:String(l),fill:J,...m?{style:`animation: barGrow 0.6s ease-out ${(K*W+X)*.04}s both`}:{}})),d&&V.push(o("text",{key:`gval-${K}-${X}`,x:String(se+ae+4),y:String(ce+Y/2+3),"text-anchor":"start","font-size":"9","font-family":"sans-serif",fill:"#374151"},String(U.value)))}}if(y){let X=c+G+P.barThickness/2,U=c+x+16;V.push(o("text",{key:`gcat-${K}`,x:String(X),y:String(U),"text-anchor":"end","font-size":"11","font-family":"sans-serif",fill:"#374151",transform:`rotate(-45, ${X}, ${U})`},Q.label))}else V.push(o("text",{key:`gcat-${K}`,x:String(c-6),y:String(c+G+P.barThickness/2+4),"text-anchor":"end","font-size":"11","font-family":"sans-serif",fill:"#374151"},Q.label))}return V},[f,M,P,l,d,m,y,c,x]),w=S(()=>p?[o("text",{key:"title",x:String(n/2),y:String(c/2+4),"text-anchor":"middle","font-size":"16","font-weight":"bold","font-family":"sans-serif",fill:"#111827"},p)]:[],[p,n,c]),T=S(()=>m?[o("defs",{key:"anim-defs"},o("style",{key:"anim-style"},y?"@keyframes barGrow { from { transform: scaleY(0); transform-origin: bottom; } to { transform: scaleY(1); transform-origin: bottom; } }":"@keyframes barGrow { from { transform: scaleX(0); transform-origin: left; } to { transform: scaleX(1); transform-origin: left; } }"))]:[],[m,y]),C=L(),N=E(),F=w(),_=T(),H;return D&&b?H=k():D?H=z():H=B(),o("svg",{width:"100%",viewBox:`0 0 ${n} ${r}`,preserveAspectRatio:"xMidYMid meet",xmlns:"http://www.w3.org/2000/svg",style:{fontFamily:"sans-serif"}},..._,...F,...C,...N,...H)}function yt(e){let{start:t,end:n,step:r}=e;if(r<=0||!isFinite(r))return[];let i=Math.ceil((n-t)/r)+1;if(i>1e6)return[];let s=[];for(let a=0;a<i;a++){let l=t+a*r;if(l>n+r*.001)break;s.push(l)}return s}function qt(e,t){let n=[];for(let r=0;r<t.length;r++){let i=t[r],s=e(i);isFinite(s)&&n.push({input:i,output:s})}return n}function Zt(e,t,n,r){let i=!1,s=0,a=[],l=()=>{if(i)return;let d=Math.min(s+n,t.length);for(let u=s;u<d;u++){let h=t[u],p=e(h);isFinite(p)&&a.push({input:h,output:p})}if(s=d,s>=t.length){r(a,!0);return}r(a,!1),si(l)};return si(l),()=>{i=!0}}function si(e){typeof requestIdleCallback=="function"?requestIdleCallback(()=>e(),{timeout:16}):setTimeout(e,0)}function tc(e,t){let n=e/t,r=Math.pow(10,Math.floor(Math.log10(n))),i=n/r;return(i<1.5?1:i<3?2:i<7?5:10)*r}function ai(e,t){let n=t-e;if(n<=0)return[e];let r=tc(n,8),i=Math.ceil(e/r)*r,s=[];for(let a=i;a<=t+r*.001;a+=r)s.push(Math.round(a*1e10)/1e10);return s}function li(e){return Number.isInteger(e)?String(e):e.toFixed(2).replace(/0+$/,"").replace(/\.$/,"")}var De=40,ci=1.1,di=.01,ui=1e6;function pi(e){let{width:t=400,height:n=300,points:r=[],plotFunction:i,plotResolution:s=200,xStep:a,sync:l=!1,xRange:d=[-5,5],yRange:u=[-5,5],showGrid:h=!0,showAxes:p=!0,pointRadius:c=3,pointColor:m="#3b82f6",curveColor:f="#3b82f6",gridColor:b="#e2e8f0",axisColor:y="#94a3b8",onPointClick:g,onPointDoubleClick:x,onPointContextMenu:v,onPointHover:R}=e,[D,M]=j(d[0]),[$,A]=j(d[1]),[I,P]=j(u[0]),[L,E]=j(u[1]),B=te(!1),z=te(null),k=S(U=>De+(U-D)/($-D)*(t-2*De),[D,$,t]),w=S(U=>n-De-(U-I)/(L-I)*(n-2*De),[I,L,n]),T=S(U=>D+(U-De)/(t-2*De)*($-D),[D,$,t]),C=S(U=>I+(n-De-U)/(n-2*De)*(L-I),[I,L,n]),N=S(U=>{let Z=U;B.current=!0,z.current={mx:Z.clientX,my:Z.clientY,x0:D,x1:$,y0:I,y1:L}},[D,$,I,L]),F=S(U=>{if(!B.current||!z.current)return;let Z=U,ee=z.current,ae=Z.clientX-ee.mx,J=Z.clientY-ee.my,se=ae/(t-2*De)*(ee.x1-ee.x0),ce=J/(n-2*De)*(ee.y1-ee.y0);M(ee.x0-se),A(ee.x1-se),P(ee.y0+ce),E(ee.y1+ce)},[t,n]),_=S(()=>{B.current=!1,z.current=null},[]),H=S(U=>{let Z=U;Z.preventDefault();let ee=Z.currentTarget.getBoundingClientRect(),ae=Z.clientX-ee.left,J=Z.clientY-ee.top,se=T(ae),ce=C(J),me=Z.deltaY>0?ci:1/ci,ge=($-D)*me,ye=(L-I)*me;if(ge<di||ye<di||ge>ui||ye>ui)return;let le=(se-D)/($-D),ne=(ce-I)/(L-I);M(se-le*ge),A(se+(1-le)*ge),P(ce-ne*ye),E(ce+(1-ne)*ye)},[D,$,I,L,T,C]),W=[];if(W.push(o("rect",{x:0,y:0,width:t,height:n,fill:"white",key:"bg"})),h){let U=ai(D,$),Z=ai(I,L);for(let ee=0;ee<U.length;ee++){let ae=k(U[ee]);W.push(o("line",{x1:ae,y1:De,x2:ae,y2:n-De,stroke:b,"stroke-width":.5,key:`gx-${ee}`})),W.push(o("text",{x:ae,y:n-De+14,"text-anchor":"end","font-size":10,fill:y,transform:`rotate(-45, ${ae}, ${n-De+14})`,key:`lx-${ee}`},li(U[ee])))}for(let ee=0;ee<Z.length;ee++){let ae=w(Z[ee]);W.push(o("line",{x1:De,y1:ae,x2:t-De,y2:ae,stroke:b,"stroke-width":.5,key:`gy-${ee}`})),W.push(o("text",{x:De-6,y:ae+3,"text-anchor":"end","font-size":10,fill:y,key:`ly-${ee}`},li(Z[ee])))}}if(p){let U=Math.max(De,Math.min(t-De,k(0))),Z=Math.max(De,Math.min(n-De,w(0)));W.push(o("line",{x1:De,y1:Z,x2:t-De,y2:Z,stroke:y,"stroke-width":1,key:"x-axis"})),W.push(o("line",{x1:U,y1:De,x2:U,y2:n-De,stroke:y,"stroke-width":1,key:"y-axis"}))}let V=q(()=>{if(!i||!l)return[];let U=a??($-D)/s,Z=yt({start:D,end:$,step:U});return qt(i,Z)},[i,D,$,a,s,l]),[K,Q]=j([]),G=te(null);re(()=>{if(!i||l){Q([]);return}let U=a??($-D)/s,Z=yt({start:D,end:$,step:U});return G.current&&G.current(),G.current=Zt(i,Z,200,ee=>{Q([...ee])}),()=>{G.current&&G.current()}},[i,D,$,a,s,l]);let O=l?V:K;if(O.length>0){let U=[];for(let Z=0;Z<O.length;Z++){let ee=O[Z],ae=k(ee.input),J=w(ee.output);U.push(`${U.length===0?"M":"L"}${ae},${J}`)}W.push(o("path",{d:U.join(" "),fill:"none",stroke:f,"stroke-width":1.5,key:"curve"}))}let Y=(U,Z,ee,ae)=>{if(Z)return J=>Z({x:ae.x,y:ae.y,index:ee,event:J})};for(let U=0;U<r.length;U++){let Z=r[U],ee=k(Z.x),ae=w(Z.y),J={cx:ee,cy:ae,r:c,fill:m,cursor:"pointer",key:`pt-${U}`};g&&(J.onClick=Y("click",g,U,Z)),x&&(J.onDblClick=Y("dblclick",x,U,Z)),v&&(J.onContextMenu=Y("contextmenu",v,U,Z)),R&&(J.onMouseOver=Y("mouseover",R,U,Z)),W.push(o("circle",J))}let X=o("defs",{key:"defs"},o("clipPath",{id:"plot-clip"},o("rect",{x:De,y:De,width:t-2*De,height:n-2*De})));return o("svg",{xmlns:"http://www.w3.org/2000/svg",width:"100%",viewBox:`0 0 ${t} ${n}`,preserveAspectRatio:"xMidYMid meet",style:"user-select: none; touch-action: none;",onMouseDown:N,onMouseMove:F,onMouseUp:_,onMouseLeave:_,onWheel:H},X,...W)}function mi(e,t,n){let r=0,i=0;for(let s=0;s<n;s++){let a=r*r,l=i*i;if(a+l>4)return s;i=2*r*i+t,r=a-l+e}return n}function fi(e,t,n){if(e===t)return[0,0,0];let r=e/t;if(n==="fire")return[Math.floor(255*Math.min(1,r*3)),Math.floor(255*Math.max(0,r*3-1)),Math.floor(255*Math.max(0,r*3-2))];if(n==="ocean")return[Math.floor(255*r*.3),Math.floor(255*r*.6),Math.floor(255*(.4+r*.6))];let i=r*360%360,s=1,a=.5,l=(1-Math.abs(2*a-1))*s,d=l*(1-Math.abs(i/60%2-1)),u=a-l/2,h=0,p=0,c=0;return i<60?(h=l,p=d):i<120?(h=d,p=l):i<180?(p=l,c=d):i<240?(p=d,c=l):i<300?(h=d,c=l):(h=l,c=d),[Math.floor((h+u)*255),Math.floor((p+u)*255),Math.floor((c+u)*255)]}function gi(e,t,n=[-2.5,1],r=[-1.25,1.25],i=80,s=mi){let a=[];for(let l=0;l<t;l++){let d=[],u=r[1]-l/t*(r[1]-r[0]);for(let h=0;h<e;h++){let p=n[0]+h/e*(n[1]-n[0]);d.push(s(p,u,i))}a.push(d)}return a}function hi(e){let{width:t=400,height:n=300,realRange:r=[-2.5,1],imagRange:i=[-1.25,1.25],maxIterations:s=100,colorScheme:a="classic",computeFunction:l=mi,data:d,resolution:u=2,onPointClick:h,onPointHover:p,onPointDoubleClick:c,onPointContextMenu:m}=e;if(d){let C=d.length,N=C>0?d[0].length:0,F=N>0?t/N:1,_=C>0?n/C:1,H=[];for(let W=0;W<C;W++){let V=d[W];for(let K=0;K<N;K++){let Q=V[K]??0,[G,O,Y]=fi(Q,s,a);H.push(o("rect",{key:`${W}-${K}`,x:String(K*F),y:String(W*_),width:String(Math.ceil(F)),height:String(Math.ceil(_)),fill:`rgb(${G},${O},${Y})`}))}}return o("svg",{width:"100%",viewBox:`0 0 ${t} ${n}`,preserveAspectRatio:"xMidYMid meet",xmlns:"http://www.w3.org/2000/svg",role:"img","aria-label":"Complex plane visualization",style:{cursor:"crosshair",borderRadius:"6px",maxWidth:"100%"}},...H)}let[f,b]=j(r[0]),[y,g]=j(r[1]),[x,v]=j(i[0]),[R,D]=j(i[1]),M=te(null),$=te(!1),A=te(null),I=S((C,N)=>{let F=f+C/t*(y-f),_=R-N/n*(R-x);return{re:F,im:_}},[f,y,x,R,t,n]);re(()=>{let C=M.current;if(!C)return;let N=C.getContext("2d");if(!N)return;let F=N.createImageData(t,n),_=F.data;for(let H=0;H<n;H++)for(let W=0;W<t;W++){let{re:V,im:K}=I(W,H),Q=l(V,K,s),[G,O,Y]=fi(Q,s,a),X=(H*t+W)*4;_[X]=G,_[X+1]=O,_[X+2]=Y,_[X+3]=255}N.putImageData(F,0,0)},[f,y,x,R,t,n,s,a,l,I]);let P=S(C=>{let N=C.target.getBoundingClientRect(),F=C.clientX-N.left,_=C.clientY-N.top,{re:H,im:W}=I(F,_),V=l(H,W,s);return{re:H,im:W,iterations:V,event:C}},[I,l,s]),L=S(C=>{$.current=!0,A.current={x:C.clientX,y:C.clientY,rMin:f,rMax:y,iMin:x,iMax:R}},[f,y,x,R]),E=S(C=>{if(p&&p(P(C)),!$.current||!A.current)return;let N=A.current,F=C.clientX-N.x,_=C.clientY-N.y,H=(N.rMax-N.rMin)/t,W=(N.iMax-N.iMin)/n;b(N.rMin-F*H),g(N.rMax-F*H),v(N.iMin+_*W),D(N.iMax+_*W)},[t,n,p,P]),B=S(()=>{$.current=!1},[]),z=S(C=>{C.preventDefault();let N=C.deltaY>0?1.15:1/1.15,F=C.target.getBoundingClientRect(),_=C.clientX-F.left,H=C.clientY-F.top,{re:W,im:V}=I(_,H);b(W+(f-W)*N),g(W+(y-W)*N),v(V+(x-V)*N),D(V+(R-V)*N)},[I,f,y,x,R]),k=S(C=>{h&&h(P(C))},[h,P]),w=S(C=>{c&&c(P(C))},[c,P]),T=S(C=>{C.preventDefault(),m&&m(P(C))},[m,P]);return o("canvas",{ref:M,width:t,height:n,style:{cursor:"crosshair"},onMouseDown:L,onMouseMove:E,onMouseUp:B,onMouseLeave:B,onWheel:z,onClick:k,onDblClick:w,onContextMenu:T})}function bi(e,t,n){if(e===t)return[e];let r=(t-e)/(n-1),i=[];for(let s=0;s<n;s++){let a=e+r*s;i.push(Math.round(a*1e10)/1e10)}return i}function nc(e,t,n,r){if(e.length===0)return{xScale:()=>r,yScale:()=>n-r,xTicks:[],yTicks:[],xMin:0,xMax:0,yMin:0,yMax:0};let i=1/0,s=-1/0,a=1/0,l=-1/0;for(let b of e)b.x<i&&(i=b.x),b.x>s&&(s=b.x),b.y<a&&(a=b.y),b.y>l&&(l=b.y);i===s&&(i-=1,s+=1),a===l&&(a-=1,l+=1);let d=t-r*2,u=n-r*2,h=b=>r+(b-i)/(s-i)*d,p=b=>n-r-(b-a)/(l-a)*u,c=6,m=bi(i,s,c),f=bi(a,l,c);return{xScale:h,yScale:p,xTicks:m,yTicks:f,xMin:i,xMax:s,yMin:a,yMax:l}}function Yn(e,t,n,r){return q(()=>nc(e,t,n,r),[e,t,n,r])}function xi(e){return Number.isInteger(e)?String(e):e.toFixed(1)}function yi(e,t,n,r,i,s,a){let l={fill:i,key:s,...a};switch(e){case"square":return o("rect",{...l,x:t-r,y:n-r,width:r*2,height:r*2});case"diamond":{let d=`${t},${n-r} ${t+r},${n} ${t},${n+r} ${t-r},${n}`;return o("polygon",{...l,points:d})}case"triangle":{let d=r*1.15,u=`${t},${n-d} ${t+r},${n+r*.6} ${t-r},${n+r*.6}`;return o("polygon",{...l,points:u})}case"triangle-down":{let d=r*1.15,u=`${t-r},${n-r*.6} ${t+r},${n-r*.6} ${t},${n+d}`;return o("polygon",{...l,points:u})}case"cross":{let d=r*.35;return o("path",{...l,fill:"none",stroke:i,"stroke-width":String(d*2),"stroke-linecap":"round",d:`M${t-r},${n-r}L${t+r},${n+r}M${t+r},${n-r}L${t-r},${n+r}`})}case"plus":{let d=r*.35;return o("path",{...l,fill:"none",stroke:i,"stroke-width":String(d*2),"stroke-linecap":"round",d:`M${t},${n-r}L${t},${n+r}M${t-r},${n}L${t+r},${n}`})}case"circle":default:return o("circle",{...l,cx:t,cy:n,r})}}function Si(e){let{data:t,width:n=600,height:r=400,lineColor:i="#3b82f6",lineWidth:s=2,pointRadius:a=4,pointColor:l="#3b82f6",pointShape:d="circle",showPoints:u=!0,showGrid:h=!0,showArea:p=!1,areaColor:c="rgba(59,130,246,0.15)",xLabel:m,yLabel:f,title:b,padding:y=50,animate:g=!1,multiLine:x}=e,v=q(()=>{let L=[...t];if(x)for(let E of x)L.push(...E.data);return L},[t,x]),R=Yn(v,n,r,y),{xScale:D,yScale:M,xTicks:$,yTicks:A}=R,I=[];if(I.push(o("rect",{x:0,y:0,width:"100%",fill:"white",key:"bg"})),h){for(let L=0;L<$.length;L++){let E=D($[L]);I.push(o("line",{x1:E,y1:y,x2:E,y2:r-y,stroke:"#e5e7eb","stroke-dasharray":"4,4",key:`grid-x-${L}`}))}for(let L=0;L<A.length;L++){let E=M(A[L]);I.push(o("line",{x1:y,y1:E,x2:n-y,y2:E,stroke:"#e5e7eb","stroke-dasharray":"4,4",key:`grid-y-${L}`}))}}I.push(o("line",{x1:y,y1:r-y,x2:n-y,y2:r-y,stroke:"#374151","stroke-width":1,key:"x-axis"})),I.push(o("line",{x1:y,y1:y,x2:y,y2:r-y,stroke:"#374151","stroke-width":1,key:"y-axis"}));for(let L=0;L<$.length;L++){let E=D($[L]);I.push(o("line",{x1:E,y1:r-y,x2:E,y2:r-y+5,stroke:"#374151",key:`xtick-${L}`})),I.push(o("text",{x:E,y:r-y+18,"text-anchor":"end","font-size":11,fill:"#6b7280",transform:`rotate(-45, ${E}, ${r-y+18})`,key:`xlabel-${L}`},xi($[L])))}for(let L=0;L<A.length;L++){let E=M(A[L]);I.push(o("line",{x1:y-5,y1:E,x2:y,y2:E,stroke:"#374151",key:`ytick-${L}`})),I.push(o("text",{x:y-10,y:E+4,"text-anchor":"end","font-size":11,fill:"#6b7280",key:`ylabel-${L}`},xi(A[L])))}function P(L,E,B,z,k,w,T,C,N,F){if(L.length===0)return;let _=[...L].sort((V,K)=>V.x-K.x);if(z){let V=M(R.yMin),K=_.map(Y=>`${D(Y.x)},${M(Y.y)}`).join(" "),Q=D(_[0].x),G=D(_[_.length-1].x),O=`${Q},${V} ${K} ${G},${V}`;I.push(o("polygon",{points:O,fill:k,key:`${F}-area`}))}let W={points:_.map(V=>`${D(V.x)},${M(V.y)}`).join(" "),fill:"none",stroke:E,"stroke-width":B,"stroke-linejoin":"round","stroke-linecap":"round",key:`${F}-line`};if(g?(W["stroke-dasharray"]="1000",W["stroke-dashoffset"]="1000",I.push(o("polyline",W,o("animate",{attributeName:"stroke-dashoffset",from:1e3,to:0,dur:"1.5s",fill:"freeze"})))):I.push(o("polyline",W)),w)for(let V=0;V<_.length;V++){let K=D(_[V].x),Q=M(_[V].y),G=_[V].shape??N,O=_[V].radius??C,Y=`${F}-pt-${V}`;if(g){let X=yi(G,K,Q,O,T,Y,{opacity:0});I.push(o("g",{key:`${Y}-g`},X,o("animate",{attributeName:"opacity",from:0,to:1,dur:"0.3s",begin:"1.2s",fill:"freeze"})))}else I.push(yi(G,K,Q,O,T,Y))}}if(P(t,i,s,p,c,u,l,a,d,"primary"),x)for(let L=0;L<x.length;L++){let E=x[L];P(E.data,E.color,s,!1,"transparent",u,E.color,E.pointRadius??a,E.pointShape??d,`series-${L}`)}if(x&&x.length>0){let L=[],E=[{color:i,label:"Primary"},...x.map((H,W)=>({color:H.color,label:H.label??`Series ${W+1}`}))],B=y+10,z=16,k=22,w=7.2,T=14,C=6,N=n-y*2-20,F=0,_=0;for(let H=0;H<E.length;H++){let W=E[H].label.length*w,V=T+C+W;F>0&&F+V>N&&(F=0,_+=k);let K=B+F,Q=y-30-_;L.push(o("rect",{x:K,y:Q,width:T,height:14,fill:E[H].color,rx:2,key:`legend-rect-${H}`})),L.push(o("text",{x:K+T+C,y:Q+12,"font-size":12,fill:"#374151",key:`legend-text-${H}`},E[H].label)),F+=V+z}I.push(o("g",{key:"legend"},...L))}return m&&I.push(o("text",{x:n/2,y:r-8,"text-anchor":"middle","font-size":13,fill:"#374151",key:"x-axis-label"},m)),f&&I.push(o("text",{x:14,y:r/2,"text-anchor":"middle","font-size":13,fill:"#374151",transform:`rotate(-90, 14, ${r/2})`,key:"y-axis-label"},f)),b&&I.push(o("text",{x:n/2,y:20,"text-anchor":"middle","font-size":16,"font-weight":"bold",fill:"#111827",key:"title"},b)),o("svg",{xmlns:"http://www.w3.org/2000/svg",width:"100%",viewBox:`0 0 ${n} ${r}`,preserveAspectRatio:"xMidYMid meet"},...I)}function oc(e){let t=[];for(let n=0;n<e;n++){let r=Math.round(360*n/e);t.push(`hsl(${r}, 70%, 55%)`)}return t}function rc(e,t){let n=t??oc(e.length);return e.map((r,i)=>r.color??n[i%n.length])}function St(e,t,n,r){return{x:e+n*Math.cos(r),y:t+n*Math.sin(r)}}function Vn(e,t,n,r,i,s){let a=i-Math.PI/2,l=s-Math.PI/2,d=St(e,t,r,a),u=St(e,t,r,l),h=s-i>Math.PI?1:0;if(n<=0)return[`M ${e} ${t}`,`L ${d.x} ${d.y}`,`A ${r} ${r} 0 ${h} 1 ${u.x} ${u.y}`,"Z"].join(" ");let p=St(e,t,n,l),c=St(e,t,n,a);return[`M ${d.x} ${d.y}`,`A ${r} ${r} 0 ${h} 1 ${u.x} ${u.y}`,`L ${p.x} ${p.y}`,`A ${n} ${n} 0 ${h} 0 ${c.x} ${c.y}`,"Z"].join(" ")}function Un(e,t){let n=t?.padAngle??0,r=rc(e,t?.colors),i=e.reduce((u,h)=>u+h.value,0);if(i<=0)return[];let s=n*e.length,a=Math.PI*2-s,l=[],d=0;for(let u=0;u<e.length;u++){let h=e[u],p=h.value/i*a,c=d+n/2,m=c+p;l.push({label:h.label,value:h.value,startAngle:c,endAngle:m,percentage:h.value/i*100,color:r[u]}),d=m+n/2}return l}function vi(e){let{data:t,width:n=400,height:r=400,innerRadius:i=0,padAngle:s=.02,showLabels:a=!0,showValues:l=!0,showLegend:d=!0,legendPosition:u="right",title:h,centerLabel:p,colors:c,strokeColor:m="#fff",strokeWidth:f=2,textColor:b="currentColor"}=e,y=d&&u==="right"?140:0,g=h?30:0,x=d&&u==="bottom"?Math.ceil(t.length/2)*22+10:0,v=n-y,R=r-g-x,D=v/2,M=g+R/2,$=Math.min(v,R)/2-10,A=e.outerRadius??$,I=q(()=>Un(t,{padAngle:s,colors:c}),[t,s,c]),P=[];h&&P.push(o("text",{key:"title",x:v/2,y:20,textAnchor:"middle",fontFamily:"sans-serif",fontSize:16,fontWeight:"bold",fill:b},h));for(let L=0;L<I.length;L++){let E=I[L],B=Vn(D,M,i,A,E.startAngle,E.endAngle);if(P.push(o("path",{key:`slice-${L}`,d:B,fill:E.color,stroke:m,strokeWidth:f})),a||l){let z=(E.startAngle+E.endAngle)/2,k=E.percentage<5,w=k?A+14:i+(A-i)*.65,T=St(D,M,w,z-Math.PI/2),C=k?b:"#fff",N=k?11:12,F=[];if(a&&F.push(E.label),l&&F.push(`${E.percentage.toFixed(1)}%`),k){let _=St(D,M,A+2,z-Math.PI/2);P.push(o("line",{key:`connector-${L}`,x1:_.x,y1:_.y,x2:T.x,y2:T.y,stroke:"#999",strokeWidth:1}))}a&&P.push(o("text",{key:`label-${L}`,x:T.x,y:T.y-(l?6:0),textAnchor:"middle",fontFamily:"sans-serif",fontSize:N,fill:C,pointerEvents:"none"},E.label)),l&&P.push(o("text",{key:`value-${L}`,x:T.x,y:T.y+(a?10:0),textAnchor:"middle",fontFamily:"sans-serif",fontSize:N-1,fill:C,pointerEvents:"none"},`${E.percentage.toFixed(1)}%`))}}if(p&&i>0&&P.push(o("text",{key:"center-label",x:D,y:M,textAnchor:"middle",dominantBaseline:"central",fontFamily:"sans-serif",fontSize:14,fontWeight:"bold",fill:b},p)),d){let L=[];if(u==="right"){let E=v+10,B=g+20;for(let z=0;z<I.length;z++){let k=I[z],w=B+z*22;L.push(o("circle",{key:`legend-dot-${z}`,cx:E+6,cy:w,r:6,fill:k.color})),L.push(o("text",{key:`legend-text-${z}`,x:E+18,y:w,dominantBaseline:"central",fontFamily:"sans-serif",fontSize:12,fill:b},`${k.label} (${k.percentage.toFixed(1)}%)`))}}else{let E=r-x+10;for(let B=0;B<I.length;B++){let z=I[B],k=B%2,w=Math.floor(B/2),T=k*(n/2)+10,C=E+w*22;L.push(o("circle",{key:`legend-dot-${B}`,cx:T+6,cy:C,r:6,fill:z.color})),L.push(o("text",{key:`legend-text-${B}`,x:T+18,y:C,dominantBaseline:"central",fontFamily:"sans-serif",fontSize:12,fill:b},`${z.label} (${z.percentage.toFixed(1)}%)`))}}P.push(...L)}return o("svg",{xmlns:"http://www.w3.org/2000/svg",width:"100%",viewBox:`0 0 ${n} ${r}`,preserveAspectRatio:"xMidYMid meet"},...P)}function wi(e,t,n,r,i){return{x:n+e*Math.cos(t)*i,y:r-e*Math.sin(t)*i}}function ki(e){let{width:t=400,height:n=400,rRange:r=[0,2],plotFunction:i,plotResolution:s=360,thetaStep:a,sync:l=!1,points:d=[],showGrid:u=!0,pointRadius:h=3,pointColor:p="#3b82f6",curveColor:c="#3b82f6",onPointClick:m,onPointDoubleClick:f,onPointContextMenu:b,onPointHover:y}=e,[g,x]=j(r[1]),[v,R]=j(0),[D,M]=j(0),[$,A]=j(null),I=t/2+v,P=n/2+D,E=Math.min(t,n)/2-30,B=E/g,z=q(()=>{let O=Math.max(1,Math.ceil(g)),Y=[],X=g/O;for(let U=1;U<=O;U++)Y.push(X*U);return Y},[g]),k=q(()=>{let O=[];for(let Y=0;Y<360;Y+=30)O.push(Y*Math.PI/180);return O},[]),w=q(()=>{if(!i||!l)return[];let O=a??2*Math.PI/s,Y=yt({start:0,end:2*Math.PI,step:O});return qt(i,Y)},[i,s,a,l]),[T,C]=j([]),N=te(null);re(()=>{if(!i||l){C([]);return}let O=a??2*Math.PI/s,Y=yt({start:0,end:2*Math.PI,step:O});return N.current&&N.current(),N.current=Zt(i,Y,200,X=>{C([...X])}),()=>{N.current&&N.current()}},[i,s,a,l]);let F=l?w:T,_=q(()=>{if(F.length===0)return"";let O=[];for(let Y=0;Y<F.length;Y++){let X=F[Y],U=X.output;if(U<0||!isFinite(U))continue;let{x:Z,y:ee}=wi(U,X.input,I,P,B);O.push(`${O.length===0?"M":"L"}${Z.toFixed(2)},${ee.toFixed(2)}`)}return O.join(" ")},[F,I,P,B]),H=S(O=>{A({x:O.clientX,y:O.clientY,px:v,py:D})},[v,D]),W=S(O=>{$&&(R($.px+(O.clientX-$.x)),M($.py+(O.clientY-$.y)))},[$]),V=S(()=>{A(null)},[]),K=S(O=>{O.preventDefault();let Y=O.deltaY>0?1.15:1/1.15;x(Math.max(.1,g*Y))},[g]),Q=S((O,Y,X)=>{if(O)return U=>O({r:Y.r,theta:Y.theta,index:X,event:U})},[]),G=[];if(G.push(o("rect",{x:0,y:0,width:t,height:n,fill:"white",key:"bg"})),u){for(let O=0;O<z.length;O++){let Y=z[O]*B;G.push(o("circle",{cx:I,cy:P,r:Y,fill:"none",stroke:"#e5e7eb","stroke-width":1,key:`gc-${O}`})),G.push(o("text",{x:I+Y+2,y:P-4,"font-size":10,fill:"#9ca3af",key:`gl-${O}`},z[O].toFixed(1)))}for(let O=0;O<k.length;O++){let Y=k[O],X=z[z.length-1]*B,U=I+X*Math.cos(Y),Z=P-X*Math.sin(Y);G.push(o("line",{x1:I,y1:P,x2:U,y2:Z,stroke:"#e5e7eb","stroke-width":1,key:`al-${O}`}));let ee=Math.round(Y*180/Math.PI),ae=I+(X+14)*Math.cos(Y),J=P-(X+14)*Math.sin(Y);G.push(o("text",{x:ae,y:J+4,"text-anchor":"middle","font-size":10,fill:"#9ca3af",key:`at-${O}`},`${ee}\xB0`))}}G.push(o("line",{x1:I-E,y1:P,x2:I+E,y2:P,stroke:"#d1d5db","stroke-width":1,key:"x-axis"})),G.push(o("line",{x1:I,y1:P-E,x2:I,y2:P+E,stroke:"#d1d5db","stroke-width":1,key:"y-axis"})),_&&G.push(o("path",{d:_,fill:"none",stroke:c,"stroke-width":2,key:"curve"}));for(let O=0;O<d.length;O++){let Y=d[O],{x:X,y:U}=wi(Y.r,Y.theta,I,P,B);G.push(o("circle",{cx:X,cy:U,r:h,fill:p,key:`pt-${O}`,style:{cursor:"pointer"},onClick:Q(m,Y,O),onDblClick:Q(f,Y,O),onContextMenu:Q(b,Y,O),onMouseEnter:Q(y,Y,O)}))}return o("svg",{xmlns:"http://www.w3.org/2000/svg",width:"100%",viewBox:`0 0 ${t} ${n}`,preserveAspectRatio:"xMidYMid meet",style:{cursor:$?"grabbing":"grab"},onMouseDown:H,onMouseMove:W,onMouseUp:V,onMouseLeave:V,onWheel:K},...G)}function jn(e){let t=1<<e,n=[];for(let r=0;r<t;r++){let i=[];for(let s=0;s<e;s++)i.push((r>>s&1)*2-1);n.push({coords:i})}return n}function Gn(e){let t=1<<e,n=[];for(let r=0;r<t;r++)for(let i=0;i<e;i++){let s=r^1<<i;s>r&&n.push({source:r,target:s})}return n}function Xn(e,t){let n=Ci(e),r=0;for(let i=0;i<e;i++)for(let s=i+1;s<e;s++){if(r<t.length){let a=t[r];n=sc(n,ic(e,i,s,a))}r++}return n}function Ci(e){let t=[];for(let n=0;n<e;n++){let r=new Array(e).fill(0);r[n]=1,t.push(r)}return t}function ic(e,t,n,r){let i=Ci(e),s=Math.cos(r),a=Math.sin(r);return i[t][t]=s,i[t][n]=-a,i[n][t]=a,i[n][n]=s,i}function sc(e,t){let n=e.length,r=[];for(let i=0;i<n;i++){let s=new Array(n).fill(0);for(let a=0;a<n;a++)for(let l=0;l<n;l++)s[a]+=e[i][l]*t[l][a];r.push(s)}return r}function Kn(e,t){let n=e.length,r=new Array(n).fill(0);for(let i=0;i<n;i++)for(let s=0;s<n;s++)r[i]+=e[i][s]*t.coords[s];return r}function qn(e,t=0){let n=e[0]??0,r=e[1]??0,i=0;for(let s=2;s<e.length;s++)i+=e[s]??0;if(e.length>2&&(i/=e.length-2),t>0){let s=1/(1+t*(i+2));return{x:n*s,y:r*s,depth:i}}return{x:n,y:r,depth:i}}function Pt(e,t=[],n=.3,r=1){let i=jn(e),s=Gn(e),a=Xn(e,t);return{vertices:i.map((d,u)=>{let h=Kn(a,d),p=qn(h,n);return{id:u,position:d,x:p.x*r,y:p.y*r,depth:p.depth}}),edges:s,dimension:e}}function Tt(e){return e*(e-1)/2}function Jt(e,t=70,n=55){let r=[];for(let i=0;i<e;i++){let s=Math.round(360*i/e);r.push(`hsl(${s}, ${t}%, ${n}%)`)}return r}function Mi(e){let t=e.dimension??4,n=e.width??600,r=e.height??600,i=e.vertexRadius??10,s=e.edgeWidth??3,a=e.edgeColor??"#111",l=e.perspective??.25,d=e.rotationSpeed??.008,u=e.showLabels??!1,h=e.backgroundColor??"transparent",p=e.scale??Math.min(n,r)*.3,c=Tt(t),m=1<<t,f=q(()=>e.vertexColors==="auto"||e.vertexColors===void 0?Jt(m):e.vertexColors,[m,e.vertexColors]),[b,y]=j(()=>{let C=[];for(let N=0;N<c;N++)C.push(0);return C}),[g,x]=j(!1),v=te({x:0,y:0}),R=te([]),D=te(0);re(()=>{if(d===0)return;let C=!0,N=()=>{C&&(y(F=>{let _=F.slice();for(let H=0;H<_.length;H++)_[H]=(_[H]??0)+d*(1+H*.3);return _}),D.current=requestAnimationFrame(N))};return D.current=requestAnimationFrame(N),()=>{C=!1,cancelAnimationFrame(D.current)}},[d]);let M=q(()=>Pt(t,b,l,p),[t,b,l,p]),$=n/2,A=r/2,I=q(()=>M.edges.map(C=>{let N=M.vertices[C.source],F=M.vertices[C.target],_=(N.depth+F.depth)/2;return{...C,avgDepth:_,sv:N,tv:F}}).sort((C,N)=>C.avgDepth-N.avgDepth),[M]),P=q(()=>M.vertices.slice().sort((C,N)=>C.depth-N.depth),[M]),L=S(C=>{let N=C;x(!0),v.current={x:N.clientX,y:N.clientY},R.current=b.slice()},[b]),E=S(C=>{if(!g)return;let N=C,F=(N.clientX-v.current.x)*.01,_=(N.clientY-v.current.y)*.01;y(()=>{let H=R.current.slice();return H.length>0&&(H[0]=(H[0]??0)+F),H.length>1&&(H[1]=(H[1]??0)+_),H})},[g]),B=S(()=>{x(!1)},[]),z=C=>{let N=(C+2)/4;return .3+.7*Math.max(0,Math.min(1,N))},k=C=>{let N=(C+2)/4;return .6+.4*Math.max(0,Math.min(1,N))},w=I.map((C,N)=>{let F=z(C.avgDepth);return o("line",{key:`e-${C.source}-${C.target}`,x1:String($+C.sv.x),y1:String(A+C.sv.y),x2:String($+C.tv.x),y2:String(A+C.tv.y),stroke:a,"stroke-width":String(s),"stroke-opacity":String(F),"stroke-linecap":"round"})}),T=P.map(C=>{let N=i*k(C.depth),F=f[C.id%f.length]??"#3b82f6",_=[o("circle",{key:`v-${C.id}-circle`,cx:String($+C.x),cy:String(A+C.y),r:String(N),fill:F,stroke:"#000","stroke-width":"1.5",style:{filter:"drop-shadow(0 1px 2px rgba(0,0,0,0.3))"}})];return u&&_.push(o("text",{key:`v-${C.id}-label`,x:String($+C.x),y:String(A+C.y+N+14),"text-anchor":"middle","font-size":"11","font-family":"monospace",fill:"#555"},C.id.toString(2).padStart(t,"0"))),_});return o("svg",{width:"100%",viewBox:`0 0 ${n} ${r}`,preserveAspectRatio:"xMidYMid meet",style:{backgroundColor:h,cursor:g?"grabbing":"grab",userSelect:"none"},onMouseDown:L,onMouseMove:E,onMouseUp:B,onMouseLeave:B},...w,...T.flat())}function Ei(e={}){let t=e.dimension??4,n=e.rotationSpeed??.008,r=e.perspective??.25,i=e.scale??200,s=Tt(t),[a,l]=j(()=>new Array(s).fill(0));return re(()=>{if(n===0)return;let u=!0,h=0,p=()=>{u&&(l(c=>c.map((m,f)=>m+n*(1+f*.3))),h=requestAnimationFrame(p))};return h=requestAnimationFrame(p),()=>{u=!1,cancelAnimationFrame(h)}},[n]),{data:q(()=>Pt(t,a,r,i),[t,a,r,i]),angles:a,setAngles:l}}function Ii(e){let t=e.titlePosition??"top",n=e.legendPosition??"bottom",r=e.titleAlign??"center",i=e.legendAlign??"center",s=e.gap??"12px",a=e.contain??"layout style paint",l={display:"flex",flexDirection:ac(t,n),gap:s,width:typeof e.width=="number"?`${e.width}px`:e.width??"auto",height:typeof e.height=="number"?`${e.height}px`:e.height??"auto",backgroundColor:e.backgroundColor??"#ffffff",border:e.border??"1px solid #e5e7eb",borderRadius:e.borderRadius??"8px",padding:e.padding??"16px",fontFamily:e.fontFamily??"inherit",contain:a,overflow:"hidden",position:"relative",boxSizing:"border-box",...e.boxShadow?{boxShadow:e.boxShadow}:{},...e.style??{}},d=e.title?o("div",{className:"viz-title",style:{fontSize:e.titleFontSize??"16px",fontWeight:e.titleFontWeight??"600",color:e.titleColor??"#1f2937",textAlign:r,flexShrink:"0"}},e.title):null,u=e.legend&&e.legend.length>0?cc(e.legend,{align:i,fontSize:e.legendFontSize??"12px",gap:e.legendGap??16,direction:n==="left"||n==="right"?"column":"row"}):null,h=o("div",{className:"viz-content",style:{flex:"1",minWidth:"0",minHeight:"0",position:"relative",display:"flex",alignItems:"center",justifyContent:"center"}},e.children),p=lc(d,h,u,t,n);return o("div",{className:`viz-wrapper ${e.className??""}`.trim(),style:l},...p)}function ac(e,t){return"column"}function lc(e,t,n,r,i){let s=[];if(r==="top"&&e&&s.push(e),i==="left"||i==="right"){let a=[];i==="left"&&n&&a.push(n),r==="left"&&e&&a.push(e),a.push(t),r==="right"&&e&&a.push(e),i==="right"&&n&&a.push(n),s.push(o("div",{style:{display:"flex",flexDirection:"row",flex:"1",gap:"12px",minHeight:"0",alignItems:"stretch"}},...a))}else if(r==="left"||r==="right"){i==="top"&&n&&s.push(n);let a=[];r==="left"&&e&&a.push(e),a.push(t),r==="right"&&e&&a.push(e),s.push(o("div",{style:{display:"flex",flexDirection:"row",flex:"1",gap:"12px",minHeight:"0",alignItems:"center"}},...a)),i==="bottom"&&n&&s.push(n)}else i==="top"&&n&&s.push(n),s.push(t),i==="bottom"&&n&&s.push(n);return r==="bottom"&&e&&s.push(e),s}function cc(e,t){return o("div",{className:"viz-legend",style:{display:"flex",flexDirection:t.direction,flexWrap:"wrap",gap:`${t.gap}px`,justifyContent:t.align,alignItems:"center",fontSize:t.fontSize,color:"#6b7280",flexShrink:"0"}},...e.map((n,r)=>o("div",{key:`legend-${r}`,style:{display:"flex",alignItems:"center",gap:"6px"}},dc(n),o("span",null,n.label))))}function dc(e){let t=e.shape??"circle";return t==="line"?o("svg",{width:"20",height:"12",viewBox:"0 0 20 12"},o("line",{x1:"0",y1:"6",x2:"20",y2:"6",stroke:e.color,"stroke-width":"2","stroke-dasharray":e.dash??""})):t==="square"?o("div",{style:{width:"12px",height:"12px",backgroundColor:e.color,borderRadius:"2px",flexShrink:"0"}}):o("div",{style:{width:"10px",height:"10px",backgroundColor:e.color,borderRadius:"50%",flexShrink:"0"}})}function uc(e){if(typeof document>"u")return;let t="specifyjs-gtag";if(document.getElementById(t))return;let n=document.createElement("script");n.id=t,n.async=!0,n.src=`https://www.googletagmanager.com/gtag/js?id=${encodeURIComponent(e)}`,document.head.appendChild(n)}function pc(){typeof window>"u"||(window.dataLayer=window.dataLayer||[],window.gtag||(window.gtag=function(){window.dataLayer.push(arguments)},window.gtag("js",new Date)))}function Ri(e){let{measurementId:t,disabled:n=!1,debug:r=!1,anonymizeIp:i=!1,config:s}=e;return re(()=>{if(n||typeof window>"u")return;uc(t),pc();let a={...s};return i&&(a.anonymize_ip=!0),r&&(a.debug_mode=!0),window.gtag&&window.gtag("config",t,a),()=>{let l=document.getElementById("specifyjs-gtag");l&&l.remove()}},[t,n,r,i]),null}function Pi(e){let{left:t,center:n,right:r,borderTop:i="1px solid var(--color-border, #e2e8f0)",background:s="var(--color-bg, transparent)",color:a="var(--color-text-muted, #64748b)",fontSize:l="13px",padding:d="24px",maxWidth:u="1200px",className:h,ariaLabel:p="Site footer"}=e;return o("footer",{className:h,role:"contentinfo","aria-label":p,style:{borderTop:i,background:s,color:a,fontSize:l,padding:d,marginTop:"48px"}},o("div",{className:"footer-inner",style:{maxWidth:u,margin:"0 auto",display:"flex",alignItems:"center",justifyContent:"space-between",flexWrap:"wrap",gap:"12px"}},o("div",{className:"footer-section",style:{flex:"1",textAlign:"left",minWidth:"150px"}},t??null),o("div",{className:"footer-section",style:{flex:"1",textAlign:"center",minWidth:"150px"}},n??null),o("div",{className:"footer-section",style:{flex:"1",textAlign:"right",minWidth:"150px"}},r??null)))}var $i=je({windows:[],openWindow:()=>{},closeWindow:()=>{},focusWindow:()=>{},minimizeWindow:()=>{},maximizeWindow:()=>{},restoreWindow:()=>{},moveWindow:()=>{},resizeWindow:()=>{},tileWindows:()=>{},cascadeWindows:()=>{},minimizeAll:()=>{},focusedWindowId:null,setMenuBar:()=>{},clearMenuBar:()=>{},activeMenuBar:null,signalDock:()=>{},dockSignals:new Map}),fc={width:600,height:400},mc={x:30,y:30},gc={top:0,left:0,width:1920,height:1080},Zn=1e3;function Ti(e,t,n,r){let i=n.left+e*t.x,s=n.top+e*t.y,a=n.left+n.width-r.width,l=n.top+n.height-r.height;return a>n.left&&i>a&&(i=n.left+(i-n.left)%Math.max(1,a-n.left)),l>n.top&&s>l&&(s=n.top+(s-n.top)%Math.max(1,l-n.top)),{x:i,y:s}}function Jn(e){let t=[...e].sort((r,i)=>r.zIndex-i.zIndex),n=[];for(let r=0;r<t.length;r++)n.push({...t[r],zIndex:r+1});return n}function Di(e,t){let n=null;for(let r=0;r<e.length;r++){let i=e[r];i.id!==t&&i.windowState!=="minimized"&&(n===null||i.zIndex>n.zIndex)&&(n=i)}return n}function Qn(e){let t=0;for(let n=0;n<e.length;n++)e[n].zIndex>t&&(t=e[n].zIndex);return t}function Qt(e){let t=e.workspaceBounds??gc,n=e.defaultWindowSize??fc,r=e.cascadeOffset??mc,[i,s]=j([]),a=S(((...L)=>{let E=L[0];s(B=>{if(B.find(_=>_.id===E.id)){let H=Qn(B)+1,W=B.map(V=>V.id===E.id?{...V,focused:!0,zIndex:H,windowState:V.windowState==="minimized"?"normal":V.windowState}:{...V,focused:!1});return H>Zn&&(W=Jn(W)),W}let k=E.size??n,w=E.position??Ti(B.length,r,t,k),C=Qn(B)+1,N={id:E.id,title:E.title,icon:E.icon,position:w,size:k,windowState:"normal",zIndex:C,focused:!0,appProps:E.appProps},F=B.map(_=>({..._,focused:!1}));return F.push(N),C>Zn&&(F=Jn(F)),e.onWindowOpen&&e.onWindowOpen(E.id),e.onFocusChange&&e.onFocusChange(E.id),F})}),[n,r,t,e.onWindowOpen,e.onFocusChange]),l=S(((...L)=>{let E=L[0];v(B=>{if(B[E]){let z={...B};return delete z[E],z}return B}),D(B=>{if(B.has(E)){let z=new Map(B);return z.delete(E),z}return B}),s(B=>{let z=B.find(w=>w.id===E);if(!z)return B;let k=B.filter(w=>w.id!==E);if(z.focused&&k.length>0){let w=Di(k,E);if(w){let T=k.map(C=>({...C,focused:C.id===w.id}));return e.onWindowClose&&e.onWindowClose(E),e.onFocusChange&&e.onFocusChange(w.id),T}}return e.onWindowClose&&e.onWindowClose(E),k.length===0&&e.onFocusChange&&e.onFocusChange(null),k})}),[e.onWindowClose,e.onFocusChange]),d=S(((...L)=>{let E=L[0];s(B=>{if(!B.find(C=>C.id===E))return B;let w=Qn(B)+1,T=B.map(C=>C.id===E?{...C,focused:!0,zIndex:w}:{...C,focused:!1});return w>Zn&&(T=Jn(T)),e.onFocusChange&&e.onFocusChange(E),T})}),[e.onFocusChange]),u=S(((...L)=>{let E=L[0];s(B=>{let z=B.find(w=>w.id===E);if(!z)return B;let k=B.map(w=>w.id===E?{...w,windowState:"minimized",focused:!1}:w);if(z.focused){let w=Di(k,E);w?(k=k.map(T=>({...T,focused:T.id===w.id})),e.onFocusChange&&e.onFocusChange(w.id)):e.onFocusChange&&e.onFocusChange(null)}return k})}),[e.onFocusChange]),h=S(((...L)=>{let E=L[0];s(B=>B.map(z=>z.id===E?{...z,windowState:"maximized"}:z))}),[]),p=S(((...L)=>{let E=L[0];s(B=>B.map(z=>z.id===E?{...z,windowState:"normal"}:z))}),[]),c=S(((...L)=>{let E=L[0],B=L[1];s(z=>z.map(k=>k.id===E?{...k,position:B}:k))}),[]),m=S(((...L)=>{let E=L[0],B=L[1];s(z=>z.map(k=>k.id===E?{...k,size:B}:k))}),[]),f=S(((...L)=>{s(E=>{let B=E.filter(w=>w.windowState!=="minimized");if(B.length===0)return E;let z=B.length,k=new Map;if(z===1)k.set(B[0].id,{position:{x:t.left,y:t.top},size:{width:t.width,height:t.height}});else if(z===2){let w=Math.floor(t.width/2);k.set(B[0].id,{position:{x:t.left,y:t.top},size:{width:w,height:t.height}}),k.set(B[1].id,{position:{x:t.left+w,y:t.top},size:{width:t.width-w,height:t.height}})}else if(z===3){let w=Math.floor(t.width/2),T=Math.floor(t.height/2);k.set(B[0].id,{position:{x:t.left,y:t.top},size:{width:w,height:t.height}}),k.set(B[1].id,{position:{x:t.left+w,y:t.top},size:{width:t.width-w,height:T}}),k.set(B[2].id,{position:{x:t.left+w,y:t.top+T},size:{width:t.width-w,height:t.height-T}})}else{let w=Math.ceil(Math.sqrt(z)),T=Math.ceil(z/w),C=Math.floor(t.width/w),N=Math.floor(t.height/T);for(let F=0;F<B.length;F++){let _=Math.floor(F/w),H=F%w;k.set(B[F].id,{position:{x:t.left+H*C,y:t.top+_*N},size:{width:C,height:N}})}}return E.map(w=>{let T=k.get(w.id);return T?{...w,position:T.position,size:T.size,windowState:"normal"}:w})})}),[t]),b=S(((...L)=>{s(E=>{let B=E.filter(w=>w.windowState!=="minimized");if(B.length===0)return E;let z=[...B].sort((w,T)=>w.zIndex-T.zIndex),k=new Map;for(let w=0;w<z.length;w++){let T=Ti(w,r,t,z[w].size);k.set(z[w].id,{position:T,zIndex:w+1})}return E.map(w=>{let T=k.get(w.id);return T?{...w,position:T.position,zIndex:T.zIndex,windowState:"normal"}:w})})}),[r,t]),y=S(((...L)=>{s(E=>{let B=E.map(z=>({...z,windowState:"minimized",focused:!1}));return e.onFocusChange&&e.onFocusChange(null),B})}),[e.onFocusChange]),g=q(()=>{let L=i.find(E=>E.focused);return L?L.id:null},[i]),[x,v]=j({}),[R,D]=j(new Map),M=S(((...L)=>{let E=L[0],B=L[1];v(z=>({...z,[E]:B}))}),[]),$=S(((...L)=>{let E=L[0];v(B=>{let z={...B};return delete z[E],z})}),[]),A=q(()=>g&&x[g]?x[g]:null,[g,x]),I=S(((...L)=>{let E=L[0],B=L[1];D(z=>{let k=new Map(z),w=k.get(E);return k.set(E,{...w,...B}),k})}),[]),P=q(()=>({windows:i,openWindow:a,closeWindow:l,focusWindow:d,minimizeWindow:u,maximizeWindow:h,restoreWindow:p,moveWindow:c,resizeWindow:m,tileWindows:f,cascadeWindows:b,minimizeAll:y,focusedWindowId:g,setMenuBar:M,clearMenuBar:$,activeMenuBar:A,signalDock:I,dockSignals:R}),[i,a,l,d,u,h,p,c,m,f,b,y,g,M,$,A,I,R]);return o($i.Provider,{value:P},e.children)}function vt(){return Ye($i)}var zi=je({appId:""});function it(e){let t=q(()=>({appId:e.appId}),[e.appId]);return o(zi.Provider,{value:t},e.children)}function wt(){return Ye(zi).appId}var Ai=je({publish:()=>{},subscribe:()=>()=>{},subscribeAll:()=>()=>{}});function Dt(e){let t=te([]),n=te([]),r=S(((...l)=>{let d=l[0],u=l[1],h=l[2],p=l[3]||"",c={channel:d,from:p,to:h||null,payload:u,timestamp:Date.now()},m=t.current;for(let b=0;b<m.length;b++){let y=m[b];y.channel===d&&(c.to&&y.appId!==c.to||!c.to&&y.appId===p||y.handler(c))}let f=n.current;for(let b=0;b<f.length;b++)f[b].handler(c)}),[]),i=S(((...l)=>{let d=l[0],u=l[1],h=l[2]||"",p={channel:d,handler:u,appId:h};return t.current=[...t.current,p],()=>{t.current=t.current.filter(c=>c!==p)}}),[]),s=S(((...l)=>{let u={handler:l[0]};return n.current=[...n.current,u],()=>{n.current=n.current.filter(h=>h!==u)}}),[]),a=q(()=>({publish:r,subscribe:i,subscribeAll:s}),[r,i,s]);return o(Ai.Provider,{value:a},e.children)}function st(){let e=Ye(Ai),t=wt(),n=S(((...i)=>{let s=i[0],a=i[1],l=i[2];e.publish(s,a,l,t)}),[e.publish,t]),r=S(((...i)=>{let s=i[0],a=i[1];return e.subscribe(s,a,t)}),[e.subscribe,t]);return q(()=>({publish:n,subscribe:r,subscribeAll:e.subscribeAll}),[n,r,e.subscribeAll])}function $t(e,t){let n=st(),r=te(t);r.current=t,re(()=>n.subscribe(e,s=>{r.current(s)}),[n,e])}var Li=je({startDrag:()=>{},cancelDrag:()=>{},registerDropZone:()=>()=>{},currentDrag:null,isDragging:!1});function zt(e){let[t,n]=j(null),[r,i]=j({x:0,y:0}),s=te(new Map),a=te(null),l=t!==null,d=S(((...m)=>{let f=m[0];n(f)}),[]),u=S(((...m)=>{if(a.current){let f=s.current.get(a.current);f&&f.onDragLeave&&f.onDragLeave(),a.current=null}n(null)}),[]),h=S(((...m)=>{let f=m[0],b=m[1];return s.current=new Map(s.current),s.current.set(f,b),()=>{s.current=new Map(s.current),s.current.delete(f),a.current===f&&(a.current=null)}}),[]);re(()=>{if(!l)return;let m=y=>{let g=y;i({x:g.clientX,y:g.clientY});let x=document.elementFromPoint(g.clientX,g.clientY);if(!x)return;let v=null,R=s.current;R.forEach((M,$)=>{let A=document.querySelector(`[data-dropzone-id="${$}"]`);A&&A.contains(x)&&(v=$)});let D=a.current;if(v!==D){if(D){let M=R.get(D);M&&M.onDragLeave&&M.onDragLeave()}if(v){let M=R.get(v);M&&M.onDragEnter&&t&&M.acceptTypes.indexOf(t.type)!==-1&&M.onDragEnter(t)}a.current=v}},f=y=>{let g=a.current;if(g&&t){let x=s.current.get(g);x&&x.acceptTypes.indexOf(t.type)!==-1&&x.onDrop(t)}a.current=null,n(null)},b=y=>{y.key==="Escape"&&u()};return document.addEventListener("mousemove",m),document.addEventListener("mouseup",f),document.addEventListener("keydown",b),()=>{document.removeEventListener("mousemove",m),document.removeEventListener("mouseup",f),document.removeEventListener("keydown",b)}},[l,t,u]);let p=q(()=>({startDrag:d,cancelDrag:u,registerDropZone:h,currentDrag:t,isDragging:l}),[d,u,h,t,l]),c=l?o("div",{className:"drag-drop-preview",style:{position:"fixed",left:`${r.x+12}px`,top:`${r.y+12}px`,pointerEvents:"none",zIndex:"10000",opacity:"0.8",padding:"6px 10px",backgroundColor:"rgba(50, 50, 50, 0.9)",color:"#ffffff",borderRadius:"4px",fontSize:"12px",boxShadow:"0 4px 12px rgba(0,0,0,0.3)",whiteSpace:"nowrap"}},t&&t.preview?String(t.preview):`Dragging ${t?t.type:""}`):null;return o(Li.Provider,{value:p},e.children,c)}function pt(){return Ye(Li)}function eo(e,t){let n=pt(),r=wt(),i=te(t);i.current=t;let s=S(l=>{l.preventDefault(),n.startDrag({type:e,data:i.current,sourceAppId:r||""})},[n,e,r]),a=n.isDragging&&n.currentDrag!==null&&n.currentDrag.type===e;return q(()=>({onMouseDown:s,isDragging:a}),[s,a])}function At(e){let t=pt(),[n,r]=j(!1),i=te(e.zoneId||`zone-${Math.random().toString(36).slice(2,10)}`),s=te(e);s.current=e,re(()=>t.registerDropZone(i.current,{acceptTypes:s.current.acceptTypes,onDragEnter:d=>{r(!0),s.current.onDragEnter&&s.current.onDragEnter(d)},onDragLeave:()=>{r(!1),s.current.onDragLeave&&s.current.onDragLeave()},onDrop:d=>{r(!1),s.current.onDrop(d)}}),[t]);let a=t.isDragging&&t.currentDrag!==null&&e.acceptTypes.indexOf(t.currentDrag.type)!==-1;return q(()=>({isOver:n,canDrop:a,zoneId:i.current}),[n,a])}var hc=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],bc=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function to(e){return e<10?"0"+String(e):String(e)}function xc(e,t,n){let r=e.getHours(),i=to(e.getMinutes()),s=to(e.getSeconds());if(t==="12h"){let l=r>=12?"PM":"AM";return r=r%12,r===0&&(r=12),`${n?`${String(r)}:${i}:${s}`:`${String(r)}:${i}`} ${l}`}let a=to(r);return n?`${a}:${i}:${s}`:`${a}:${i}`}function yc(e){let t=hc[e.getDay()],n=bc[e.getMonth()],r=e.getDate();return`${t}, ${n} ${String(r)}`}function Sc(e){let{label:t,onClick:n}=e,{hover:r,onMouseEnter:i,onMouseLeave:s}=Ne(),a=S(()=>{n()},[n]),l=S(d=>{let u=d;(u.key==="Enter"||u.key===" ")&&(u.preventDefault(),n())},[n]);return o("button",{type:"button",role:"button","aria-label":t,tabIndex:0,onClick:a,onKeyDown:l,onMouseEnter:i,onMouseLeave:s,style:{display:"inline-flex",alignItems:"center",padding:"0 12px",height:"100%",border:"none",outline:"none",backgroundColor:r?"rgba(255,255,255,0.15)":"transparent",color:"inherit",fontFamily:"inherit",fontSize:"13px",fontWeight:"700",cursor:"pointer",transition:"background-color 0.15s"}},t)}function vc(e){let{format:t,showSeconds:n,showDate:r}=e,[i,s]=j(new Date);re(()=>{let u=setInterval(()=>{s(new Date)},1e3);return()=>{clearInterval(u)}},[]);let a=q(()=>xc(i,t,n),[i,t,n]),l=q(()=>yc(i),[i]),d=r?o("span",{style:{fontSize:"11px",opacity:"0.85"}},l):null;return o("div",{role:"timer","aria-live":"polite","aria-label":"System clock",style:{display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"center",gap:"6px",lineHeight:"1",padding:"0 8px"}},d,o("span",{style:{fontSize:"13px",fontWeight:"500"}},a))}function wc(e){let{indicator:t}=e,{hover:n,onMouseEnter:r,onMouseLeave:i}=Ne(),s=S(()=>{t.onClick&&t.onClick()},[t]),a=S(l=>{let d=l;(d.key==="Enter"||d.key===" ")&&(d.preventDefault(),t.onClick&&t.onClick())},[t]);return o("button",{type:"button",role:"button","aria-label":t.label||t.icon,tabIndex:0,onClick:s,onKeyDown:a,onMouseEnter:r,onMouseLeave:i,style:{display:"inline-flex",alignItems:"center",gap:"4px",padding:"0 4px",height:"100%",border:"none",outline:"none",backgroundColor:n?"rgba(255,255,255,0.15)":"transparent",color:"inherit",fontFamily:"inherit",fontSize:"13px",cursor:t.onClick?"pointer":"default",transition:"background-color 0.15s"}},o("span",{"aria-hidden":"true"},t.icon),t.label?o("span",null,t.label):null)}function kc(e){let{item:t,onClose:n}=e,{hover:r,onMouseEnter:i,onMouseLeave:s}=Ne();if(t.divider)return o("div",{role:"separator",style:{height:"1px",backgroundColor:"var(--panel-divider, #555555)",margin:"4px 0"}});let a=S(()=>{t.onClick(),n()},[t,n]),l=S(d=>{let u=d;(u.key==="Enter"||u.key===" ")&&(u.preventDefault(),t.onClick(),n())},[t,n]);return o("button",{type:"button",role:"menuitem",tabIndex:-1,onClick:a,onKeyDown:l,onMouseEnter:i,onMouseLeave:s,style:{display:"flex",alignItems:"center",gap:"8px",width:"100%",padding:"6px 16px",border:"none",outline:"none",backgroundColor:r?"var(--panel-hover, rgba(255,255,255,0.15))":"transparent",color:"var(--panel-text, #ffffff)",fontFamily:"inherit",fontSize:"13px",textAlign:"left",cursor:"pointer",boxSizing:"border-box",transition:"background-color 0.1s"}},t.icon?o("span",{style:{width:"16px",textAlign:"center"},"aria-hidden":"true"},t.icon):null,o("span",null,t.label))}function Cc(e){let{user:t,menuItems:n}=e,{hover:r,onMouseEnter:i,onMouseLeave:s}=Ne(),[a,l]=j(!1),d=te(null),u=S(()=>{l(y=>!y)},[]),h=S(()=>{l(!1)},[]),p=S(y=>{let g=y;(g.key==="Enter"||g.key===" ")&&(g.preventDefault(),l(x=>!x)),g.key==="Escape"&&l(!1)},[]);re(()=>{if(!a)return;let y=g=>{let x=d.current;x&&!x.contains(g.target)&&l(!1)};return document.addEventListener("click",y,!0),()=>{document.removeEventListener("click",y,!0)}},[a]);let c={width:"24px",height:"24px",borderRadius:"50%",display:"inline-flex",alignItems:"center",justifyContent:"center",fontSize:"12px",fontWeight:"700",backgroundColor:"rgba(255,255,255,0.2)",color:"inherit",overflow:"hidden",flexShrink:"0"},m=t.avatar?o("img",{src:t.avatar,alt:t.name,style:{width:"100%",height:"100%",objectFit:"cover"}}):t.name.charAt(0).toUpperCase(),f=o("span",{style:c,"aria-hidden":"true"},m),b=a&&n&&n.length>0?o("div",{role:"menu","aria-label":"User menu",style:{position:"absolute",top:"100%",right:"0",marginTop:"2px",backgroundColor:"var(--panel-bg, #2c2c2c)",border:"1px solid var(--panel-divider, #555555)",borderRadius:"6px",boxShadow:"0 4px 12px rgba(0,0,0,0.3)",padding:"4px 0",minWidth:"180px",zIndex:"1000"}},...n.map((y,g)=>o(kc,{key:String(g),item:y,onClose:h}))):null;return o("div",{ref:d,style:{position:"relative",display:"inline-flex",height:"100%"}},o("button",{type:"button","aria-haspopup":"true","aria-expanded":String(a),tabIndex:0,onClick:u,onKeyDown:p,onMouseEnter:i,onMouseLeave:s,style:{display:"inline-flex",alignItems:"center",gap:"6px",padding:"0 8px",height:"100%",border:"none",outline:"none",backgroundColor:r||a?"rgba(255,255,255,0.15)":"transparent",color:"inherit",fontFamily:"inherit",fontSize:"13px",cursor:"pointer",transition:"background-color 0.15s"}},f,o("span",null,t.name),o("span",{"aria-hidden":"true",style:{fontSize:"10px"}},"\u25BE")),b)}function Mc(e){let{menu:t}=e,{hover:n,onMouseEnter:r,onMouseLeave:i}=Ne(),[s,a]=j(!1),l=te(null),d=S(()=>{a(c=>!c)},[]),u=S(()=>{a(!1)},[]),h=S(c=>{let m=c;(m.key==="Enter"||m.key===" ")&&(m.preventDefault(),a(f=>!f)),m.key==="Escape"&&a(!1)},[]);re(()=>{if(!s)return;let c=m=>{let f=l.current;f&&!f.contains(m.target)&&a(!1)};return document.addEventListener("click",c,!0),()=>{document.removeEventListener("click",c,!0)}},[s]);let p=s&&t.items.length>0?o("div",{role:"menu","aria-label":t.label+" menu",style:{position:"absolute",top:"100%",left:"0",marginTop:"2px",backgroundColor:"var(--panel-bg, #2c2c2c)",border:"1px solid var(--panel-divider, #555555)",borderRadius:"6px",boxShadow:"0 4px 12px rgba(0,0,0,0.3)",padding:"4px 0",minWidth:"180px",zIndex:"1000"}},...t.items.map((c,m)=>c.divider?o("div",{key:"div-"+String(m),role:"separator",style:{height:"1px",backgroundColor:"var(--panel-divider, #555555)",margin:"4px 0"}}):o("button",{key:String(m),type:"button",role:"menuitem",tabIndex:-1,disabled:c.disabled??!1,onClick:()=>{c.onClick&&c.onClick(),u()},style:{display:"flex",alignItems:"center",justifyContent:"space-between",width:"100%",padding:"6px 16px",border:"none",outline:"none",backgroundColor:"transparent",color:c.disabled?"rgba(255,255,255,0.4)":"var(--panel-text, #ffffff)",fontFamily:"inherit",fontSize:"13px",textAlign:"left",cursor:c.disabled?"default":"pointer",boxSizing:"border-box"}},o("span",null,c.checked?"\u2713 ":"",c.label||""),c.shortcut?o("span",{style:{fontSize:"11px",opacity:"0.6",marginLeft:"16px"}},c.shortcut):null))):null;return o("div",{ref:l,className:"system-tray__app-menu",style:{position:"relative",display:"inline-flex",height:"100%"}},o("button",{type:"button","aria-haspopup":"true","aria-expanded":String(s),tabIndex:0,onClick:d,onKeyDown:h,onMouseEnter:r,onMouseLeave:i,style:{display:"inline-flex",alignItems:"center",padding:"0 10px",height:"100%",border:"none",outline:"none",backgroundColor:n||s?"rgba(255,255,255,0.15)":"transparent",color:"inherit",fontFamily:"inherit",fontSize:"13px",fontWeight:"500",cursor:"pointer",transition:"background-color 0.15s"}},t.label),p)}function en(e){let{activeAppName:t,activitiesButton:n,appMenuBar:r,clockFormat:i="24h",showSeconds:s=!0,showDate:a=!0,indicators:l,user:d,userMenuItems:u,height:h=28,children:p}=e,c=String(h)+"px",m=[];if(n&&m.push(o(Sc,{key:"activities",label:n.label,onClick:n.onClick})),t&&m.push(o("span",{key:"appname",style:{padding:"0 12px",fontSize:"13px",fontWeight:"700",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",maxWidth:"200px"}},t)),r&&r.menus.length>0)for(let v=0;v<r.menus.length;v++)m.push(o(Mc,{key:"appmenu-"+String(v),menu:r.menus[v]}));let f=o("div",{style:{display:"flex",alignItems:"center",height:"100%",flex:"1",minWidth:"0"}},...m),b=[];b.push(o(vc,{key:"clock",format:i,showSeconds:s,showDate:a})),p&&b.push(p);let y=o("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",height:"100%"}},...b),g=[];if(l&&l.length>0){let v=l.map(R=>o(wc,{key:R.id,indicator:R}));g.push(o("div",{key:"indicators",style:{display:"flex",alignItems:"center",gap:"8px",height:"100%"}},...v))}d&&g.push(o(Cc,{key:"user",user:d,menuItems:u}));let x=o("div",{style:{display:"flex",alignItems:"center",justifyContent:"flex-end",height:"100%",flex:"1",gap:"4px"}},...g);return o("div",{role:"menubar","aria-label":"System panel","data-theme":"dark",style:{display:"flex",alignItems:"center",justifyContent:"space-between",width:"100%",height:c,backgroundColor:"var(--panel-bg, #2c2c2c)",color:"var(--panel-text, #ffffff)",fontFamily:"inherit",fontSize:"13px",boxSizing:"border-box",position:"relative"}},f,y,x)}function Ec(e){return e.startsWith("http")||e.startsWith("/")||e.startsWith(".")}var Bi=["#3465a4","#e67e22","#2ecc71","#3498db","#e74c3c","#9b59b6","#f39c12","#1abc9c","#e91e63","#00bcd4"];function Ic(e){let t=0;for(let n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n)|0;return Bi[Math.abs(t)%Bi.length]}function Rc(e){return e>99?"99+":String(e)}function Pc(e){return e.badge&&e.badge>0?`${e.label}, ${e.badge} unread`:e.label}function Tc(e){switch(e){case"left":return{left:"100%",top:"50%",transform:"translateY(-50%)",marginLeft:"8px"};case"right":return{right:"100%",top:"50%",transform:"translateY(-50%)",marginRight:"8px"};case"top":return{top:"100%",left:"50%",transform:"translateX(-50%)",marginTop:"8px"};case"bottom":return{bottom:"100%",left:"50%",transform:"translateX(-50%)",marginBottom:"8px"};default:return{left:"100%",top:"50%",transform:"translateY(-50%)",marginLeft:"8px"}}}function Dc(e,t){return t==="vertical"?e==="right"?{position:"absolute",right:"0",top:"50%",transform:"translateY(-50%)"}:{position:"absolute",left:"0",top:"50%",transform:"translateY(-50%)"}:e==="bottom"?{position:"absolute",top:"0",left:"50%",transform:"translateX(-50%)"}:{position:"absolute",bottom:"0",left:"50%",transform:"translateX(-50%)"}}function $c(e){let{item:t,iconSize:n,position:r,orientation:i,onItemClick:s,onItemContextMenu:a}=e,[l,d]=j(!1),u=t.disabled??!1,h=S(()=>{u||d(!0)},[u]),p=S(()=>{d(!1)},[]),c=S(()=>{!u&&s&&s(t.id)},[u,s,t.id]),m=S(D=>{if(!u&&a){let M=D;M.preventDefault(),a(t.id,{x:M.clientX,y:M.clientY})}},[u,a,t.id]),f=`${n}px`,b=Ec(t.icon)?o("img",{src:t.icon,alt:t.label,style:{width:f,height:f,objectFit:"contain",display:"block"}}):o("span",{style:{width:f,height:f,display:"flex",alignItems:"center",justifyContent:"center",fontSize:`${Math.round(n*.6)}px`,fontWeight:"700",userSelect:"none",backgroundColor:Ic(t.icon),color:"#ffffff",borderRadius:"8px"},"aria-hidden":"true"},t.icon),y=t.badge!=null&&t.badge>0?o("span",{style:{position:"absolute",top:"0",right:"0",backgroundColor:"var(--dock-badge-bg, #e74c3c)",color:"#ffffff",fontSize:"9px",fontWeight:"700",lineHeight:"1",minWidth:"14px",height:"14px",display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"7px",padding:"0 3px",pointerEvents:"none",zIndex:"2"},"aria-hidden":"true"},Rc(t.badge)):null,g=t.active?o("span",{style:{...Dc(r,i),width:"6px",height:"6px",borderRadius:"50%",backgroundColor:"var(--dock-active-color, #ffffff)",pointerEvents:"none",zIndex:"2"},"aria-hidden":"true"}):null,x=t.progress!=null&&t.progress>0?o("div",{style:{position:"absolute",bottom:"2px",left:"6px",right:"6px",height:"3px",backgroundColor:"rgba(255,255,255,0.2)",borderRadius:"2px",overflow:"hidden",pointerEvents:"none",zIndex:"2"},"aria-hidden":"true"},o("div",{style:{width:`${Math.min(1,Math.max(0,t.progress))*100}%`,height:"100%",backgroundColor:"var(--dock-progress-color, #3b82f6)",borderRadius:"2px",transition:"width 200ms ease"}})):null,v=l?o("div",{role:"tooltip",style:{position:"absolute",...Tc(r),padding:"4px 10px",backgroundColor:"#1f2937",color:"#ffffff",fontSize:"12px",borderRadius:"4px",whiteSpace:"nowrap",zIndex:"1000",pointerEvents:"none"}},t.label):null,R={position:"relative",display:"flex",alignItems:"center",justifyContent:"center",padding:"6px",border:"none",backgroundColor:"transparent",cursor:u?"default":"pointer",opacity:u?"0.4":"1",pointerEvents:u?"none":"auto",transition:"transform 100ms, background-color 100ms",borderRadius:"8px",outline:"none",...l&&!u?{transform:"scale(1.1)",backgroundColor:"rgba(255,255,255,0.15)"}:{},...t.urgent&&!u?{animation:"dock-urgent-pulse 0.6s ease-in-out infinite alternate"}:{}};return o("button",{type:"button",role:"button",style:R,"aria-label":Pc(t),"aria-pressed":t.active?"true":"false","aria-disabled":u?"true":void 0,tabIndex:u?-1:0,onClick:c,onContextMenu:m,onMouseEnter:h,onMouseLeave:p,"data-dock-item-id":t.id,"data-urgent":t.urgent?"true":void 0},b,y,g,x,v)}function tn(e){let{items:t,orientation:n="vertical",position:r="left",iconSize:i=36,autoHide:s=!1,showTrailingSeparator:a=!1,onItemClick:l,onItemContextMenu:d,children:u}=e,[h,p]=j(!s),c=te(null),m=S(()=>{s&&(c.current!=null&&(clearTimeout(c.current),c.current=null),p(!0))},[s]),f=S(()=>{s&&(c.current=setTimeout(()=>{p(!1)},300))},[s]),b=S(R=>{let D=R,M=D.target,$=M.closest('[role="toolbar"]');if(!$)return;let A=Array.from($.querySelectorAll("button[data-dock-item-id]")),I=A.indexOf(M);if(I<0)return;let P=n==="vertical",L=P?"ArrowDown":"ArrowRight",E=P?"ArrowUp":"ArrowLeft";if(D.key===L){D.preventDefault();let B=A[I+1];B&&B.focus()}else if(D.key===E){D.preventDefault();let B=A[I-1];B&&B.focus()}else D.key==="Home"?(D.preventDefault(),A[0]?.focus()):D.key==="End"?(D.preventDefault(),A[A.length-1]?.focus()):(D.key==="Enter"||D.key===" ")&&(D.preventDefault(),M.click())},[n]),y=n==="vertical",g={display:"flex",flexDirection:y?"column":"row",alignItems:"center",gap:"2px",padding:"4px",backgroundColor:"var(--dock-bg, rgba(0, 0, 0, 0.7))",color:"#ffffff",border:"1px solid var(--dock-border, rgba(255, 255, 255, 0.1))",borderRadius:"8px",boxSizing:"border-box",position:"relative",transition:"transform 200ms ease, opacity 200ms ease"};s&&!h&&(r==="left"?(g.transform="translateX(-100%)",g.opacity="0"):r==="right"?(g.transform="translateX(100%)",g.opacity="0"):r==="top"?(g.transform="translateY(-100%)",g.opacity="0"):r==="bottom"&&(g.transform="translateY(100%)",g.opacity="0"));let x=[];for(let R=0;R<t.length;R++){if(a&&R===t.length-1&&t.length>1){let D=y?{width:"60%",height:"1px",backgroundColor:"rgba(255,255,255,0.2)",margin:"4px auto",flexShrink:"0"}:{height:"60%",width:"1px",backgroundColor:"rgba(255,255,255,0.2)",margin:"auto 4px",flexShrink:"0"};x.push(o("div",{key:`sep-${R}`,style:D,"aria-hidden":"true",role:"separator"}))}x.push(o($c,{key:t[R].id,item:t[R],iconSize:i,position:r,orientation:n,onItemClick:l,onItemContextMenu:d}))}let v=s&&!h?o("div",{style:{position:"absolute",...r==="left"?{left:"0",top:"0",width:"4px",height:"100%"}:{},...r==="right"?{right:"0",top:"0",width:"4px",height:"100%"}:{},...r==="top"?{top:"0",left:"0",height:"4px",width:"100%"}:{},...r==="bottom"?{bottom:"0",left:"0",height:"4px",width:"100%"}:{},zIndex:"10"},"aria-hidden":"true"}):null;return o("div",{role:"toolbar","aria-label":"Application launcher","aria-orientation":n,style:g,onMouseEnter:m,onMouseLeave:f,onKeyDown:b},v,...x,u??null)}var zc="#2c001e";function nn(e){let{backgroundColor:t=zc,backgroundGradient:n,backgroundImage:r,backgroundImageOpacity:i=1,contextMenuItems:s,onClick:a,onDoubleClick:l,overflow:d="visible",children:u}=e,h=S(g=>{let x=g;x.target===x.currentTarget&&a&&a()},[a]),p=S(g=>{let x=g;x.target===x.currentTarget&&l&&l()},[l]),c=q(()=>{let g={position:"relative",width:"100%",height:"100%",overflow:d,cursor:"default",margin:"0",padding:"0"};return g.backgroundColor=t,n&&(g.background=n),r&&i>=1&&(g.backgroundImage=`url(${r})`,g.backgroundSize="cover",g.backgroundPosition="center"),g},[t,n,r,i]),m=q(()=>!r||i>=1?null:{position:"absolute",top:"0",left:"0",width:"100%",height:"100%",backgroundImage:`url(${r})`,backgroundSize:"cover",backgroundPosition:"center",opacity:String(i),pointerEvents:"none",zIndex:"0"},[r,i]),f={position:"relative",width:"100%",height:"100%",zIndex:"1"},b=[];m&&b.push(o("div",{className:"desktop-background__image-overlay",style:m,"aria-hidden":"true"})),b.push(o("div",{className:"desktop-background__content",style:f},u));let y=o("div",{className:"desktop-background",style:c,onClick:h,onDblClick:p,role:"application","aria-label":"Desktop workspace","data-theme":"dark"},...b);return s&&s.length>0?o(Kt,{items:s},y):y}function no(e){let{items:t,backgroundColor:n="#007acc",color:r="#ffffff",height:i=22}=e,s=t.filter(p=>p.align!=="right"),a=t.filter(p=>p.align==="right"),l={display:"flex",alignItems:"center",justifyContent:"space-between",height:`${i}px`,backgroundColor:n,color:r,fontSize:"12px",flexShrink:"0",padding:"0 8px",overflow:"hidden",userSelect:"none"};function d(p){let c=typeof p.onClick=="function",m={display:"inline-flex",alignItems:"center",gap:"4px",padding:"0 6px",height:"100%",whiteSpace:"nowrap",cursor:c?"pointer":"default"},f=[];p.icon&&f.push(o("span",{className:"status-bar__item-icon",style:{fontSize:"12px",lineHeight:"1"}},p.icon)),f.push(o("span",{className:"status-bar__item-label"},p.label));let b={key:p.key,className:`status-bar__item${c?" status-bar__item--clickable":""}`,style:m};return c&&(b.onClick=p.onClick,b.onMouseEnter=y=>{y.currentTarget.style.backgroundColor="rgba(255, 255, 255, 0.15)"},b.onMouseLeave=y=>{y.currentTarget.style.backgroundColor=""}),o("span",b,...f)}let u=o("div",{className:"status-bar__left",style:{display:"flex",alignItems:"center",height:"100%",overflow:"hidden"}},...s.map(d)),h=o("div",{className:"status-bar__right",style:{display:"flex",alignItems:"center",height:"100%",overflow:"hidden"}},...a.map(d));return o("div",{className:"status-bar",style:l,role:"status","aria-label":"Status bar"},u,h)}var Ac={width:200,height:150},Lc={x:50,y:50},Bc={width:400,height:300},We=8,oo=20,Fc={n:"n-resize",s:"s-resize",e:"e-resize",w:"w-resize",ne:"ne-resize",nw:"nw-resize",se:"se-resize",sw:"sw-resize"};function kt(e){let{id:t,title:n,icon:r,defaultPosition:i=Lc,defaultSize:s=Bc,minSize:a=Ac,maxSize:l,resizable:d=!0,draggable:u=!0,windowState:h="normal",focused:p=!0,zIndex:c,onClose:m,onMinimize:f,onMaximize:b,onFocus:y,onMove:g,onResize:x,statusBar:v,children:R}=e,[D,M]=j(i.x),[$,A]=j(i.y),[I,P]=j(s.width),[L,E]=j(s.height),[B,z]=j(!1),[k,w]=j(!1),[T,C]=j(null),N=te(null),F=te(null),_=te(null),H=S((le,ne)=>{let pe=Math.max(le,a.width),ie=Math.max(ne,a.height);return l&&(pe=Math.min(pe,l.width),ie=Math.min(ie,l.height)),{width:pe,height:ie}},[a,l]),W=S(()=>{let le=_.current;return le&&le.parentElement?{width:le.parentElement.clientWidth,height:le.parentElement.clientHeight}:{width:window.innerWidth,height:window.innerHeight}},[]),V=S((le,ne,pe,ie)=>{let he=W(),xe=Math.max(0,Math.min(le,he.width-pe)),Ce=Math.max(0,Math.min(ne,he.height-ie));return{x:xe,y:Ce}},[W]),K=S(le=>{if(!u||h==="maximized")return;let ne=le;ne.target.closest("button")||(ne.preventDefault(),N.current={startMouseX:ne.clientX,startMouseY:ne.clientY,startPosX:D,startPosY:$},z(!0))},[u,h,D,$]),Q=S(le=>{le.target.closest("button")||d&&b&&b()},[b,d]);re(()=>{if(!B)return;let le=pe=>{let ie=pe,he=N.current;if(!he)return;let xe=ie.clientX-he.startMouseX,Ce=ie.clientY-he.startMouseY,de=he.startPosX+xe,be=he.startPosY+Ce,ke=W();de=Math.max(0,Math.min(de,ke.width-I)),be=Math.max(0,Math.min(be,ke.height-L)),M(de),A(be),ie.clientX<=oo?C("left"):ie.clientX>=ke.width-oo?C("right"):ie.clientY<=oo?C("top"):C(null)},ne=pe=>{let ie=pe;z(!1);let he=W();if(T==="left"){M(0),A(0),P(Math.floor(he.width/2)),E(he.height),C(null),g&&g({x:0,y:0}),x&&x({width:Math.floor(he.width/2),height:he.height});return}if(T==="right"){let Ce=Math.floor(he.width/2);M(Ce),A(0),P(Ce),E(he.height),C(null),g&&g({x:Ce,y:0}),x&&x({width:Ce,height:he.height});return}if(T==="top"){C(null),b&&b();return}C(null);let xe=N.current;if(xe&&g){let Ce=ie.clientX-xe.startMouseX,de=ie.clientY-xe.startMouseY,be=xe.startPosX+Ce,ke=xe.startPosY+de;be=Math.max(0,Math.min(be,he.width-I)),ke=Math.max(0,Math.min(ke,he.height-L)),g({x:be,y:ke})}N.current=null};return document.addEventListener("mousemove",le),document.addEventListener("mouseup",ne),()=>{document.removeEventListener("mousemove",le),document.removeEventListener("mouseup",ne)}},[B,T,I,L,W,g,x,b]);let G=S(le=>ne=>{if(!d||h!=="normal")return;let pe=ne;pe.preventDefault(),pe.stopPropagation(),F.current={direction:le,startMouseX:pe.clientX,startMouseY:pe.clientY,startPosX:D,startPosY:$,startWidth:I,startHeight:L},w(!0)},[d,h,D,$,I,L]);re(()=>{if(!k)return;let le=pe=>{let ie=pe,he=F.current;if(!he)return;let xe=ie.clientX-he.startMouseX,Ce=ie.clientY-he.startMouseY,de=he.direction,be=he.startWidth,ke=he.startHeight,Re=he.startPosX,Le=he.startPosY;de.includes("e")&&(be=he.startWidth+xe),de.includes("w")&&(be=he.startWidth-xe,Re=he.startPosX+xe),de.includes("s")&&(ke=he.startHeight+Ce),de.includes("n")&&(ke=he.startHeight-Ce,Le=he.startPosY+Ce);let oe=H(be,ke);de.includes("w")&&(Re=he.startPosX+(he.startWidth-oe.width)),de.includes("n")&&(Le=he.startPosY+(he.startHeight-oe.height)),P(oe.width),E(oe.height),M(Re),A(Le)},ne=()=>{w(!1),x&&x({width:I,height:L}),F.current=null};return document.addEventListener("mousemove",le),document.addEventListener("mouseup",ne),()=>{document.removeEventListener("mousemove",le),document.removeEventListener("mouseup",ne)}},[k,I,L,H,x]),re(()=>{if(!p||!m)return;let le=ne=>{ne.key==="Escape"&&m()};return document.addEventListener("keydown",le),()=>document.removeEventListener("keydown",le)},[p,m]);let O=S(le=>{y&&y()},[y]);if(h==="minimized")return null;let Y=h==="maximized",X=q(()=>{let le={position:"absolute",display:"flex",flexDirection:"column",border:"1px solid var(--window-border, #555555)",borderRadius:Y?"0":"6px",overflow:"hidden",backgroundColor:"var(--window-body-bg, #1e1e1e)",boxShadow:p?"0 8px 32px rgba(0, 0, 0, 0.4)":"0 4px 16px rgba(0, 0, 0, 0.2)",transition:Y?"all 200ms ease":"box-shadow 200ms ease",outline:"none"};return Y?(le.top="0",le.left="0",le.width="100%",le.height="100%"):(le.top=`${$}px`,le.left=`${D}px`,le.width=`${I}px`,le.height=`${L}px`),c!==void 0&&(le.zIndex=String(c)),B&&(le.cursor="grabbing",le.userSelect="none"),le},[Y,D,$,I,L,c,p,B]),U=q(()=>{let le={display:"flex",alignItems:"center",padding:"0 8px",height:"32px",backgroundColor:"var(--window-title-bg, #2c2c2c)",color:"var(--window-title-text, #ffffff)",userSelect:"none",flexShrink:"0",cursor:u&&!Y?"grab":"default",opacity:p?"1":"0.6"};return B&&(le.cursor="grabbing"),le},[p,u,Y,B]),Z={flex:"1",overflow:"auto",backgroundColor:"var(--window-body-bg, #1e1e1e)"},ee={width:"14px",height:"14px",borderRadius:"50%",border:"none",cursor:"pointer",padding:"0",marginLeft:"6px",fontSize:"0",lineHeight:"0",display:"inline-flex",alignItems:"center",justifyContent:"center"},ae=[];r&&(r.startsWith("http")||r.startsWith("/")||r.startsWith("data:")?ae.push(o("img",{src:r,alt:"",style:{width:"16px",height:"16px",marginRight:"6px",flexShrink:"0"},className:"draggable-window__icon"})):ae.push(o("span",{style:{marginRight:"6px",fontSize:"14px",flexShrink:"0"},className:"draggable-window__icon"},r))),ae.push(o("span",{className:"draggable-window__title-text",style:{flex:"1",fontSize:"13px",fontWeight:"500",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}},n));let J=[];J.push(o("button",{type:"button","aria-label":"Minimize",className:"draggable-window__btn-minimize",style:{...ee,backgroundColor:"var(--window-button-minimize, #f39c12)"},onClick:le=>{le.stopPropagation(),f&&f()}})),d&&J.push(o("button",{type:"button","aria-label":Y?"Restore":"Maximize",className:"draggable-window__btn-maximize",style:{...ee,backgroundColor:"var(--window-button-maximize, #2ecc71)"},onClick:le=>{le.stopPropagation(),b&&b()}})),J.push(o("button",{type:"button","aria-label":"Close",className:"draggable-window__btn-close",style:{...ee,backgroundColor:"var(--window-button-close, #e74c3c)"},onClick:le=>{le.stopPropagation(),m&&m()}}));let se=o("div",{style:{display:"flex",alignItems:"center",flexShrink:"0"},className:"draggable-window__controls"},...J);ae.push(se);let ce=[];if(d&&!Y){let le=["n","s","e","w","ne","nw","se","sw"];for(let ne=0;ne<le.length;ne++){let pe=le[ne],ie={position:"absolute",zIndex:"1"};pe==="n"?(ie.top="0",ie.left=`${We}px`,ie.right=`${We}px`,ie.height=`${We}px`):pe==="s"?(ie.bottom="0",ie.left=`${We}px`,ie.right=`${We}px`,ie.height=`${We}px`):pe==="e"?(ie.top=`${We}px`,ie.right="0",ie.bottom=`${We}px`,ie.width=`${We}px`):pe==="w"?(ie.top=`${We}px`,ie.left="0",ie.bottom=`${We}px`,ie.width=`${We}px`):pe==="ne"?(ie.top="0",ie.right="0",ie.width=`${We}px`,ie.height=`${We}px`):pe==="nw"?(ie.top="0",ie.left="0",ie.width=`${We}px`,ie.height=`${We}px`):pe==="se"?(ie.bottom="0",ie.right="0",ie.width=`${We}px`,ie.height=`${We}px`):pe==="sw"&&(ie.bottom="0",ie.left="0",ie.width=`${We}px`,ie.height=`${We}px`),ie.cursor=Fc[pe],ce.push(o("div",{className:`draggable-window__resize-handle draggable-window__resize-${pe}`,style:ie,onMouseDown:G(pe)}))}}let me=null;if(T){let le={position:"fixed",backgroundColor:"rgba(66, 133, 244, 0.2)",border:"2px solid rgba(66, 133, 244, 0.5)",borderRadius:"4px",zIndex:"999999",pointerEvents:"none",transition:"all 150ms ease"};T==="left"?(le.top="0",le.left="0",le.width="50%",le.height="100%"):T==="right"?(le.top="0",le.right="0",le.width="50%",le.height="100%"):T==="top"&&(le.top="0",le.left="0",le.width="100%",le.height="100%"),me=o("div",{className:"draggable-window__snap-preview",style:le})}let ge=[];for(let le=0;le<ce.length;le++)ge.push(ce[le]);ge.push(o("div",{className:"draggable-window__title-bar",style:U,onMouseDown:K,onDblClick:Q,role:"toolbar","aria-label":`${n} window controls`},...ae)),ge.push(o("div",{className:"draggable-window__body",style:Z},R)),v&&v!==!1&&ge.push(o(no,v));let ye=[o("div",{ref:_,id:`draggable-window-${t}`,className:`draggable-window ${p?"draggable-window--focused":"draggable-window--unfocused"} draggable-window--${h}`,style:X,role:"dialog","aria-label":n,tabIndex:-1,onMouseDown:O},...ge)];return me&&ye.push(me),ye.length===1?ye[0]:o("div",{style:{display:"contents"}},...ye)}var Nc=["File","Edit","View","Insert","Format","Tools","Help"],Fi={File:[{label:"New",action:"new"},{label:"Open",action:"open"},{label:"Save",action:"save"},{label:"Print",action:"print"}],Edit:[{label:"Undo",action:"undo"},{label:"Redo",action:"redo"},{label:"Cut",action:"cut"},{label:"Copy",action:"copy"},{label:"Paste",action:"paste"}],View:[{label:"Zoom In",action:"zoomIn"},{label:"Zoom Out",action:"zoomOut"},{label:"Full Screen",action:"fullScreen"}],Insert:[{label:"Image",action:"insertImage"},{label:"Table",action:"insertTable"},{label:"Link",action:"insertLink"}],Format:[{label:"Bold",action:"bold"},{label:"Italic",action:"italic"},{label:"Underline",action:"underline"}],Tools:[{label:"Word Count",action:"wordCount"},{label:"Spell Check",action:"spellCheck"}],Help:[{label:"About",action:"about"},{label:"Keyboard Shortcuts",action:"shortcuts"}]},Wc=[{id:"bold",label:"Bold",text:"B",shortcut:"Ctrl+B",style:{fontWeight:"700"}},{id:"italic",label:"Italic",text:"I",shortcut:"Ctrl+I",style:{fontStyle:"italic"}},{id:"underline",label:"Underline",text:"U",shortcut:"Ctrl+U",style:{textDecoration:"underline"}}],_c=[{label:"Align left",text:"\u2261",command:"justifyLeft"},{label:"Align center",text:"\u2263",command:"justifyCenter"},{label:"Align right",text:"\u2262",command:"justifyRight"}],Oc=["1","2","3","4","5","6","7"],Hc={1:"8",2:"10",3:"12",4:"14",5:"18",6:"24",7:"36"};function Yc(){let e=[];for(let t=0;t<=20;t++){let n=t%2===0;e.push(o("div",{key:String(t),style:{position:"absolute",left:`${t/20*100}%`,bottom:"0",width:"1px",height:n?"10px":"5px",backgroundColor:"#999"}})),n&&e.push(o("span",{key:`l${t}`,style:{position:"absolute",left:`${t/20*100}%`,top:"1px",fontSize:"8px",color:"#666",transform:"translateX(-50%)"}},String(t/2)))}return e}function Ni(e){return e.trim().split(/\s+/).filter(t=>t.length>0).length}function on(e){let[t,n]=j(!1),[r,i]=j(!1),[s,a]=j(!1),[l,d]=j(-1),[u,h]=j(""),[p,c]=j(-1),[m,f]=j(0),[b,y]=j("3"),g=te(null),x=S(()=>{document.execCommand("bold",!1),n(U=>!U),g.current&&g.current.focus()},[]),v=S(()=>{document.execCommand("italic",!1),i(U=>!U),g.current&&g.current.focus()},[]),R=S(()=>{document.execCommand("underline",!1),a(U=>!U),g.current&&g.current.focus()},[]),D={bold:x,italic:v,underline:R},M={bold:t,italic:r,underline:s},$=S(U=>{document.execCommand(U,!1),g.current&&g.current.focus()},[]),A=S(U=>{document.execCommand("fontSize",!1,U),y(U),g.current&&g.current.focus()},[]),I=S(U=>{c(Z=>Z===U?-1:U)},[]),P=S(U=>{switch(U){case"undo":document.execCommand("undo",!1);break;case"redo":document.execCommand("redo",!1);break;case"cut":document.execCommand("cut",!1);break;case"copy":document.execCommand("copy",!1);break;case"paste":document.execCommand("paste",!1);break;case"bold":document.execCommand("bold",!1);break;case"italic":document.execCommand("italic",!1);break;case"underline":document.execCommand("underline",!1);break;case"print":typeof window<"u"&&window.print&&window.print();break;case"new":g.current&&(g.current.innerHTML="",f(0));break;default:break}c(-1),g.current&&g.current.focus()},[]),L=S(()=>{if(g.current){let U=g.current.textContent??"";f(Ni(U))}},[]),E=S(()=>{c(-1)},[]),B=q(()=>({width:"100%",height:"100%",minHeight:"500px",display:"flex",flexDirection:"column",fontFamily:'"Segoe UI", Roboto, Arial, sans-serif',fontSize:"13px",color:"var(--color-text, #333)",backgroundColor:"#f0f0f0",overflow:"hidden"}),[]),z={display:"flex",alignItems:"center",height:"30px",backgroundColor:"var(--color-bg-subtle, #ffffff)",borderBottom:"1px solid var(--color-border, #d0d0d0)",padding:"0 8px",gap:"2px",flexShrink:"0",position:"relative"},k={display:"flex",alignItems:"center",height:"36px",backgroundColor:"var(--color-bg-subtle, #f8f9fa)",borderBottom:"1px solid var(--color-border, #d0d0d0)",padding:"0 12px",gap:"12px",flexShrink:"0"},w={height:"20px",backgroundColor:"#e8e8e8",borderBottom:"1px solid #ccc",position:"relative",flexShrink:"0",margin:"0 60px"},T={flex:"1",display:"flex",justifyContent:"center",alignItems:"flex-start",padding:"30px 40px",overflow:"auto",backgroundColor:"#e0e0e0",cursor:"text"},C={width:"680px",minHeight:"880px",backgroundColor:"#ffffff",boxShadow:"0 2px 12px rgba(0,0,0,0.18), 0 0 1px rgba(0,0,0,0.1)",padding:"72px 72px 96px 72px",boxSizing:"border-box",fontSize:"14px",lineHeight:"1.6",color:"#222",fontFamily:'"Times New Roman", Georgia, serif',cursor:"text",outline:"none"},N={height:"24px",backgroundColor:"var(--color-bg-subtle, #f0f0f0)",borderTop:"1px solid var(--color-border, #ccc)",display:"flex",alignItems:"center",justifyContent:"space-between",padding:"0 16px",fontSize:"11px",color:"#666",flexShrink:"0"},F=q(()=>Yc(),[]),_=e.content??"Start typing...",H=Ni(_),W=m>0?m:H;function V(U){return{padding:"4px 10px",cursor:"pointer",borderRadius:"3px",fontSize:"13px",color:"var(--color-text, #333)",backgroundColor:p===U?"rgba(0,0,0,0.12)":l===U?"rgba(0,0,0,0.08)":"transparent",border:"none",lineHeight:"1",transition:"background 0.15s",position:"relative"}}let K={position:"absolute",top:"100%",left:"0",minWidth:"160px",backgroundColor:"#ffffff",border:"1px solid #d0d0d0",borderRadius:"4px",boxShadow:"0 4px 12px rgba(0,0,0,0.15)",padding:"4px 0",zIndex:"1000"},Q={display:"block",width:"100%",padding:"6px 16px",fontSize:"13px",color:"#333",backgroundColor:"transparent",border:"none",textAlign:"left",cursor:"pointer",transition:"background 0.1s"};function G(U,Z){return{width:"28px",height:"28px",display:"flex",alignItems:"center",justifyContent:"center",border:"1px solid transparent",borderRadius:"3px",cursor:"pointer",fontSize:"13px",backgroundColor:M[U]??!1?"rgba(0,0,0,0.12)":u===U?"rgba(0,0,0,0.06)":"transparent",color:"var(--color-text, #444)",transition:"background 0.15s",...Z??{}}}let O={display:"flex",alignItems:"center",padding:"2px 8px",border:"1px solid var(--color-border, #ccc)",borderRadius:"3px",fontSize:"12px",color:"var(--color-text, #444)",backgroundColor:"transparent",cursor:"default",height:"24px",gap:"4px"},Y={padding:"2px 4px",border:"1px solid var(--color-border, #ccc)",borderRadius:"3px",fontSize:"12px",color:"var(--color-text, #444)",backgroundColor:"transparent",cursor:"pointer",height:"24px",outline:"none"},X=Nc.map((U,Z)=>{let ee=[U];return p===Z&&Fi[U]&&ee.push(o("div",{key:"dropdown",style:K,className:"word-processor__menu-dropdown"},...Fi[U].map((ae,J)=>o("button",{key:String(J),style:Q,onClick:se=>{se.stopPropagation(),P(ae.action)},role:"menuitem"},ae.label)))),o("button",{key:String(Z),style:V(Z),role:"menuitem","aria-label":U,onClick:()=>I(Z),onMouseEnter:()=>{d(Z)},onMouseLeave:()=>d(-1)},...ee)});return o("div",{className:`word-processor ${e.className??""}`.trim(),style:B},o("div",{className:"word-processor__menu-bar",style:z,role:"menubar"},...X),o("div",{className:"word-processor__toolbar",style:k,role:"toolbar","aria-label":"Formatting toolbar"},o("div",{style:O,"aria-label":"Font family"},o("span",null,"Arial"),o("span",{style:{fontSize:"10px",color:"#999"}},"\u25BC")),o("div",{key:"0",style:{display:"flex",gap:"2px",borderLeft:"1px solid var(--color-border, #ccc)",paddingLeft:"10px"}},...Wc.map(U=>o("button",{key:U.id,style:G(U.id,U.style),title:U.shortcut?`${U.label} (${U.shortcut})`:U.label,"aria-label":U.label,"aria-pressed":String(M[U.id]??!1),onClick:D[U.id],onMouseEnter:()=>h(U.id),onMouseLeave:()=>h("")},U.text))),o("div",{key:"1",style:{display:"flex",gap:"2px",borderLeft:"1px solid var(--color-border, #ccc)",paddingLeft:"10px",alignItems:"center"}},o("select",{style:Y,"aria-label":"Font size",value:b,onChange:U=>{let Z=U.target;A(Z.value)}},...Oc.map(U=>o("option",{key:U,value:U},Hc[U])))),o("div",{key:"2",style:{display:"flex",gap:"2px",borderLeft:"1px solid var(--color-border, #ccc)",paddingLeft:"10px"}},..._c.map((U,Z)=>o("button",{key:String(Z),style:G(`align-${Z}`),title:U.label,"aria-label":U.label,onClick:()=>$(U.command),onMouseEnter:()=>h(`align-${Z}`),onMouseLeave:()=>h("")},U.text)))),o("div",{className:"word-processor__ruler",style:w,"aria-hidden":"true"},...F),o("main",{className:"word-processor__document-area",style:T,onClick:E},o("div",{className:"word-processor__page",style:C,contentEditable:"true",ref:g,onInput:L,suppressContentEditableWarning:!0},_)),o("div",{className:"word-processor__status-bar",style:N},o("span",null,"Page 1 of 1"),o("span",null,`${W} words`),o("span",null,"100%")))}function rn(e){let t=q(()=>({height:"30px",backgroundColor:"#323233",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"12px",color:"#999",flexShrink:"0",borderBottom:"1px solid var(--color-border, #252526)"}),[]),n=e.style?{...t,...e.style}:t;return o("div",{className:"ide__title-bar",style:n},e.title)}var Vc={height:"28px",backgroundColor:"#3c3c3c",display:"flex",alignItems:"center",padding:"0 8px",gap:"2px",flexShrink:"0",position:"relative"},Wi={padding:"3px 8px",fontSize:"12px",color:"#cccccc",cursor:"pointer",borderRadius:"3px",backgroundColor:"transparent",border:"none",position:"relative"},Uc={...Wi,backgroundColor:"rgba(255,255,255,0.1)"},jc={position:"absolute",top:"100%",left:"0",minWidth:"180px",backgroundColor:"#2d2d2d",border:"1px solid #454545",borderRadius:"4px",boxShadow:"0 4px 12px rgba(0,0,0,0.4)",padding:"4px 0",zIndex:"1000"},Gc={display:"block",width:"100%",padding:"6px 16px",fontSize:"12px",color:"#cccccc",backgroundColor:"transparent",border:"none",textAlign:"left",cursor:"pointer",transition:"background 0.1s"};function sn(e){let[t,n]=j(-1),r=S(a=>{n(l=>l===a?-1:a)},[]),i=S(a=>{e.onAction(a),n(-1)},[e.onAction]),s=e.menus.map((a,l)=>{let d=[a],u=t===l;return u&&e.menuItems[a]&&d.push(o("div",{key:"dropdown",style:jc,className:"ide__menu-dropdown"},...e.menuItems[a].map((h,p)=>o("button",{key:String(p),style:Gc,onClick:c=>{c.stopPropagation(),i(h.action)},role:"menuitem"},h.label)))),o("button",{key:String(l),style:u?Uc:Wi,role:"menuitem","aria-label":a,onClick:()=>r(l)},...d)});return o("div",{className:"ide__menu-bar",style:Vc,role:"menubar"},...s)}var Xc={width:"220px",backgroundColor:"#252526",borderRight:"none",display:"flex",flexDirection:"column",flexShrink:"0",overflowY:"auto"},Kc={padding:"8px 12px",fontSize:"11px",fontWeight:"600",textTransform:"uppercase",letterSpacing:"0.5px",color:"#bbbbbb"};function qc(e,t,n){return{padding:"3px 8px",paddingLeft:`${12+e*16}px`,fontSize:"13px",cursor:"pointer",color:t?"#cccccc":"#d4d4d4",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",borderRadius:"3px",margin:"0 4px",transition:"background-color 0.1s",backgroundColor:n?"rgba(255,255,255,0.08)":"transparent"}}function an(e){let t=i=>{if(!i.parent)return!0;if(!e.expandedFolders[i.parent])return!1;let s=e.files.find(a=>a.name===i.parent&&a.isFolder);return s?t(s):!0},r=e.files.map((i,s)=>{if(!t(i))return null;let a=!i.isFolder&&i.name===e.activeFile,l=i.isFolder?e.expandedFolders[i.name]?"\u{1F4C2} ":"\u{1F4C1} ":"\u{1F4C4} ";return o("div",{key:String(s),style:qc(i.indent,i.isFolder,a),onClick:i.isFolder?()=>e.onFolderToggle(i.name):()=>e.onFileClick(i.name)},l,i.name)}).filter(i=>i!==null);return o("nav",{className:"ide__sidebar",style:Xc,"aria-label":"File explorer"},o("div",{style:Kc},"Explorer"),...r)}var Zc={height:"35px",backgroundColor:"#252526",display:"flex",alignItems:"center",flexShrink:"0"},Jc={padding:"0 16px",height:"35px",lineHeight:"35px",backgroundColor:"#1e1e1e",color:"#ffffff",fontSize:"13px",cursor:"pointer",border:"none",borderBottom:"2px solid #007acc",boxSizing:"border-box"},Qc={padding:"0 16px",height:"35px",lineHeight:"35px",backgroundColor:"#2d2d2d",color:"#999999",fontSize:"13px",cursor:"pointer",border:"none",borderBottom:"2px solid transparent",boxSizing:"border-box"};function ln(e){let t=e.tabs.map((n,r)=>{let i=n===e.activeTab;return o("button",{key:String(r),style:i?Jc:Qc,"aria-label":n,onClick:()=>e.onTabClick(n)},n)});return o("div",{style:Zc},...t)}var cn="#569cd6",ro="#ce9178",io="#4ec9b0",so="#6a9955",ao="#dcdcaa",Lt="#d4d4d4",lo="#d4d4d4",co="#b5cea8",ed=new Set(["import","export","from","const","let","var","function","return","if","else","for","while","class","new","throw","try","catch","finally","typeof","instanceof","in","of","default","switch","case","break","continue","do","void","delete","yield","async","await"]),td=new Set(["string","number","boolean","void","null","undefined","any","never","unknown","object","interface","type","enum"]);function dn(e){if(!e.trim())return[{text:"\xA0",color:Lt}];let t=[],n=0;for(;n<e.length;){if(e[n]==="/"&&e[n+1]==="/"){t.push({text:e.slice(n),color:so});break}if(e[n]==='"'||e[n]==="'"||e[n]==="`"){let r=e[n],i=n+1;for(;i<e.length&&e[i]!==r;)e[i]==="\\"&&i++,i++;i=Math.min(i+1,e.length),t.push({text:e.slice(n,i),color:ro}),n=i;continue}if(/[0-9]/.test(e[n])&&(n===0||/[\s(,=:[\]{}+\-*/]/.test(e[n-1]))){let r=n;for(;r<e.length&&/[0-9.]/.test(e[r]);)r++;t.push({text:e.slice(n,r),color:co}),n=r;continue}if(/[a-zA-Z_$]/.test(e[n])){let r=n;for(;r<e.length&&/[a-zA-Z0-9_$]/.test(e[r]);)r++;let i=e.slice(n,r),s=r;for(;s<e.length&&e[s]===" ";)s++;let a=s<e.length&&e[s]==="(",l=Lt;ed.has(i)?l=cn:td.has(i)?l=io:a?l=ao:(i==="true"||i==="false")&&(l=cn),t.push({text:i,color:l}),n=r;continue}if(e[n]===" "||e[n]===" "){let r=n;for(;r<e.length&&(e[r]===" "||e[r]===" ");)r++;t.push({text:e.slice(n,r),color:Lt}),n=r;continue}t.push({text:e[n],color:lo}),n++}return t}var nd={flex:"1",display:"flex",overflow:"auto",backgroundColor:"#1e1e1e",fontFamily:'"Cascadia Code", "Fira Code", "Consolas", monospace',fontSize:"13px",lineHeight:"20px"},od={padding:"8px 0",textAlign:"right",color:"#858585",userSelect:"none",minWidth:"48px",paddingRight:"12px",paddingLeft:"12px",flexShrink:"0"},rd={padding:"8px 0",flex:"1",whiteSpace:"pre",overflowX:"auto",outline:"none",color:"#d4d4d4"};function un(e){let t=e.content.map((r,i)=>{let s=dn(r),a=[],l=0;for(let d of s)a.push(o("span",{key:String(l++),style:{color:d.color}},d.text));return o("div",{key:String(i),style:{minHeight:"20px"}},...a)}),n=[];for(let r=0;r<e.content.length;r++)n.push(o("div",{key:String(r)},String(r+1)));return o("div",{style:nd},o("div",{style:od,"aria-hidden":"true"},...n),o("code",{style:rd,contentEditable:"true",ref:e.editorRef,onInput:e.onInput,suppressContentEditableWarning:!0},...t))}var id={width:"60px",backgroundColor:"#1e1e1e",borderLeft:"1px solid var(--color-border, #252526)",flexShrink:"0",padding:"8px 4px",display:"flex",flexDirection:"column",gap:"2px",position:"relative"};function pn(e){return o("div",{className:"ide__minimap",style:id,"aria-hidden":"true"},o("div",{style:{position:"absolute",top:`${e.visibleStart}px`,left:"0",right:"0",height:`${e.visibleEnd}px`,backgroundColor:"rgba(100, 100, 200, 0.15)",border:"1px solid rgba(100, 100, 200, 0.3)",borderRadius:"2px",pointerEvents:"none"}}),...e.lines.map((t,n)=>o("div",{key:String(n),style:{height:"2px",backgroundColor:t.trim()?"#555555":"transparent",borderRadius:"1px",width:`${Math.min(100,t.length*2)}%`}})))}var sd={height:"22px",backgroundColor:"#007acc",display:"flex",alignItems:"center",justifyContent:"space-between",padding:"0 12px",fontSize:"12px",color:"#ffffff",flexShrink:"0"},ad={cursor:"pointer",padding:"0 6px",borderRadius:"3px",transition:"background-color 0.15s"};function uo(e){let t=n=>n.map((r,i)=>o("span",{key:String(i),style:ad,onClick:r.onClick},r.label));return o("div",{className:"ide__status-bar",style:sd},o("div",{style:{display:"flex",gap:"16px"}},...t(e.items)),o("div",{style:{display:"flex",gap:"16px"}},...t(e.rightItems)))}var ld=["File","Edit","Selection","View","Go","Run","Terminal","Help"],cd={File:[{label:"New File",action:"newFile"},{label:"Open",action:"open"},{label:"Save",action:"save"},{label:"Save As",action:"saveAs"}],Edit:[{label:"Undo",action:"undo"},{label:"Redo",action:"redo"},{label:"Cut",action:"cut"},{label:"Copy",action:"copy"},{label:"Paste",action:"paste"}],View:[{label:"Command Palette",action:"commandPalette"},{label:"Explorer",action:"explorer"},{label:"Search",action:"search"}]},dd=[{name:"src",indent:0,isFolder:!0},{name:"components",indent:1,isFolder:!0,parent:"src"},{name:"App.ts",indent:2,isFolder:!1,parent:"components"},{name:"Header.ts",indent:2,isFolder:!1,parent:"components"},{name:"hooks",indent:1,isFolder:!0,parent:"src"},{name:"useAuth.ts",indent:2,isFolder:!1,parent:"hooks"},{name:"index.ts",indent:1,isFolder:!1,parent:"src"},{name:"main.ts",indent:1,isFolder:!1,parent:"src"},{name:"types.ts",indent:1,isFolder:!1,parent:"src"},{name:"package.json",indent:0,isFolder:!1},{name:"tsconfig.json",indent:0,isFolder:!1}],po={"App.ts":['import { createElement, useState } from "specifyjs";',"","interface AppProps {"," title: string;"," version?: number;","}","","export function App(props: AppProps) {"," const [count, setCount] = useState(0);",""," const increment = () => {"," setCount((prev: number) => prev + 1);"," };",""," return createElement(",' "div",',' { className: "app" },',' createElement("h1", null, props.title),',' createElement("p", null, `Count: ${count}`),'," createElement(",' "button",'," { onClick: increment },",' "Increment",'," ),"," );","}"],"Header.ts":['import { createElement } from "specifyjs";',"","interface HeaderProps {"," title: string;"," subtitle?: string;","}","","export function Header(props: HeaderProps) {"," return createElement(",' "header",',' { className: "header" },',' createElement("h1", null, props.title),'," props.subtitle",' ? createElement("p", null, props.subtitle)'," : null,"," );","}"],"useAuth.ts":['import { useState, useCallback } from "specifyjs";',"","interface AuthState {"," user: string | null;"," isLoggedIn: boolean;","}","","export function useAuth() {"," const [auth, setAuth] = useState<AuthState>({"," user: null,"," isLoggedIn: false,"," });",""," const login = useCallback((username: string) => {"," setAuth({ user: username, isLoggedIn: true });"," }, []);",""," const logout = useCallback(() => {"," setAuth({ user: null, isLoggedIn: false });"," }, []);",""," return { ...auth, login, logout };","}"],"index.ts":['export { App } from "./components/App";','export { Header } from "./components/Header";','export { useAuth } from "./hooks/useAuth";'],"main.ts":['import { createElement, createRoot } from "specifyjs";','import { App } from "./components/App";',"","const root = createRoot(",' document.getElementById("root")!',");","","root.render("," createElement(App, {",' title: "My SpecifyJS App",'," version: 1,"," }),",");"],"types.ts":["export interface User {"," id: string;"," name: string;"," email: string;",' role: "admin" | "user" | "guest";',"}","","export interface Config {"," apiUrl: string;"," debug: boolean;"," maxRetries: number;","}","","export type EventHandler<T = void> = (event: T) => void;"],"package.json":["{",' "name": "specifyjs-app",',' "version": "1.0.0",',' "scripts": {',' "dev": "vite",',' "build": "tsc && vite build",',' "preview": "vite preview"'," }","}"],"tsconfig.json":["{",' "compilerOptions": {',' "target": "ES2020",',' "module": "ESNext",',' "strict": true,',' "jsx": "preserve"'," },",' "include": ["src"]',"}"]},_i=po["App.ts"];function fn(e){let[t,n]=j("App.ts"),[r,i]=j({src:!0,components:!0,hooks:!0}),[s,a]=j(_i.length),l=te(null),d=S(v=>{n(v);let R=po[v];R&&a(R.length)},[]),u=S(v=>{i(R=>{let D={},M=Object.keys(R);for(let $=0;$<M.length;$++)D[M[$]]=R[M[$]];return D[v]=!R[v],D})},[]),h=S(v=>{switch(v){case"undo":document.execCommand("undo",!1);break;case"redo":document.execCommand("redo",!1);break;case"cut":document.execCommand("cut",!1);break;case"copy":document.execCommand("copy",!1);break;case"paste":document.execCommand("paste",!1);break;case"newFile":l.current&&(l.current.textContent="",a(1));break;default:break}l.current&&l.current.focus()},[]),p=S(()=>{if(l.current){let R=(l.current.textContent??"").split(`
7
+ `,document.head.appendChild(d),()=>{let u=document.getElementById(l);u&&u.remove()}},[]);let s=S(l=>t.dismiss(l),[t]),a=r.map(l=>o(Gl,{key:l.id,item:l,onDismiss:s}));return o("div",{style:i},...a)}function ti(e={}){let t=te(null);t.current||(t.current=_n(e));let n=t.current,r=S(()=>o(On,{toaster:n}),[n]);return{toast:n.toast,dismiss:n.dismiss,dismissAll:n.dismissAll,ToastContainer:r}}var Xl=6,Kl=8;function ql(e,t){let n=window.scrollX||window.pageXOffset,r=window.scrollY||window.pageYOffset,i=Kl;switch(t){case"top":return{position:"fixed",left:`${e.left+e.width/2}px`,top:`${e.top-i}px`,transform:"translate(-50%, -100%)"};case"bottom":return{position:"fixed",left:`${e.left+e.width/2}px`,top:`${e.bottom+i}px`,transform:"translateX(-50%)"};case"left":return{position:"fixed",left:`${e.left-i}px`,top:`${e.top+e.height/2}px`,transform:"translate(-100%, -50%)"};case"right":return{position:"fixed",left:`${e.right+i}px`,top:`${e.top+e.height/2}px`,transform:"translateY(-50%)"}}}function Zl(e){let t={position:"absolute",width:"0",height:"0",borderStyle:"solid"},n=`${Xl}px`,r="transparent",i="#1f2937";switch(e){case"top":return{...t,bottom:`-${n}`,left:"50%",transform:"translateX(-50%)",borderWidth:`${n} ${n} 0 ${n}`,borderColor:`${i} ${r} ${r} ${r}`};case"bottom":return{...t,top:`-${n}`,left:"50%",transform:"translateX(-50%)",borderWidth:`0 ${n} ${n} ${n}`,borderColor:`${r} ${r} ${i} ${r}`};case"left":return{...t,right:`-${n}`,top:"50%",transform:"translateY(-50%)",borderWidth:`${n} 0 ${n} ${n}`,borderColor:`${r} ${r} ${r} ${i}`};case"right":return{...t,left:`-${n}`,top:"50%",transform:"translateY(-50%)",borderWidth:`${n} ${n} ${n} 0`,borderColor:`${r} ${i} ${r} ${r}`}}}function ni(e){let{text:t,placement:n="top",delay:r=200,maxWidth:i="250px",children:s}=e,[a,l]=j(!1),[d,u]=j(null),h=te(null),p=te(null),c=`tooltip-${Math.random().toString(36).slice(2,9)}`,m=S(()=>{p.current=setTimeout(()=>{if(h.current){let x=h.current.getBoundingClientRect();u(ql(x,n))}l(!0)},r)},[r,n]),f=S(()=>{p.current&&(clearTimeout(p.current),p.current=null),l(!1)},[]);re(()=>()=>{p.current&&clearTimeout(p.current)},[]);let b={display:"inline-block"},y={...d??{},backgroundColor:"#1f2937",color:"#fff",fontSize:"13px",lineHeight:"1.4",padding:"6px 10px",borderRadius:"6px",maxWidth:i,zIndex:"10002",pointerEvents:"none",whiteSpace:"normal",wordWrap:"break-word"},g=[o("div",{ref:h,style:b,onMouseEnter:m,onMouseLeave:f,onFocus:m,onBlur:f,"aria-describedby":a?c:void 0},s)];return a&&d&&g.push(o("div",{id:c,style:y,role:"tooltip"},t,o("div",{style:Zl(n)}))),o("div",{style:{display:"inline-block",position:"relative"}},...g)}function Hn(e,t,n,r,i){return q(()=>{let s=Math.max(1,(r-i*(e+1))/e);return{valueScale:d=>t===0?0:d/t*n,categoryScale:d=>i+d*(s+i),barThickness:s,maxValue:t,valueAxisLength:n,categoryAxisLength:r}},[e,t,n,r,i])}function Jl(e,t,n){if(t&&t.length>0){if(n){let s=0;for(let a of t)for(let l of a.values)l.value>s&&(s=l.value);return s}let i=0;for(let s of t){let a=0;for(let l of s.values)a+=l.value;a>i&&(i=a)}return i}let r=0;for(let i of e)i.value>r&&(r=i.value);return r}function Ql(e){if(e<=0)return 1;let t=e/5,n=Math.pow(10,Math.floor(Math.log10(t))),r=t/n;return r<=1.5?n:r<=3.5?2*n:r<=7.5?5*n:10*n}function ec(e){let t=new Set;for(let n of e)for(let r of n.values)t.add(r.category);return Array.from(t)}var oi=["#3b82f6","#ef4444","#22c55e","#f59e0b","#8b5cf6","#ec4899","#14b8a6","#f97316","#6366f1","#84cc16"];function ri(e,t){return t||oi[e%oi.length]}function ii(e){let{data:t=[],width:n=600,height:r=400,orientation:i="vertical",barColor:s="#3b82f6",barGap:a=8,barRadius:l=4,showValues:d=!0,showGrid:u=!0,gridColor:h="#e5e7eb",title:p,padding:c=50,animate:m=!1,stacked:f,grouped:b=!1}=e,y=i==="vertical",g=n-c*2,x=r-c*2,v=y?x:g,R=y?g:x,D=f!==void 0&&f.length>0,M=q(()=>D?ec(f):[],[D,f]),$=D?f.length:t.length,A=q(()=>Jl(t,f,b),[t,f,b]),I=A>0?A:1,P=Hn($,I,v,R,a),L=S(()=>{if(!u)return[];let W=Ql(I),V=[];for(let K=W;K<=I;K+=W){let Q=P.valueScale(K);if(y){let G=c+x-Q;V.push(o("line",{key:`grid-${K}`,x1:String(c),y1:String(G),x2:String(c+g),y2:String(G),stroke:h,"stroke-width":"1","stroke-dasharray":"4 2"})),V.push(o("text",{key:`grid-label-${K}`,x:String(c-6),y:String(G+4),"text-anchor":"end","font-size":"11","font-family":"sans-serif",fill:"#6b7280"},String(K)))}else{let G=c+Q;V.push(o("line",{key:`grid-${K}`,x1:String(G),y1:String(c),x2:String(G),y2:String(c+x),stroke:h,"stroke-width":"1","stroke-dasharray":"4 2"})),V.push(o("text",{key:`grid-label-${K}`,x:String(G),y:String(c+x+16),"text-anchor":"middle","font-size":"11","font-family":"sans-serif",fill:"#6b7280"},String(K)))}}return V},[u,I,P,y,c,g,x,h]),E=S(()=>{let W=[];return y?(W.push(o("line",{key:"axis-y",x1:String(c),y1:String(c),x2:String(c),y2:String(c+x),stroke:"#374151","stroke-width":"1.5"})),W.push(o("line",{key:"axis-x",x1:String(c),y1:String(c+x),x2:String(c+g),y2:String(c+x),stroke:"#374151","stroke-width":"1.5"}))):(W.push(o("line",{key:"axis-x",x1:String(c),y1:String(c+x),x2:String(c+g),y2:String(c+x),stroke:"#374151","stroke-width":"1.5"})),W.push(o("line",{key:"axis-y",x1:String(c),y1:String(c),x2:String(c),y2:String(c+x),stroke:"#374151","stroke-width":"1.5"}))),W},[y,c,g,x]),B=S(()=>{let W=[];for(let V=0;V<t.length;V++){let K=t[V],Q=P.valueScale(K.value),G=P.categoryScale(V),O=K.color??s,Y,X,U=String(K.value);if(y){let Z=c+G,ee=c+x-Q;Y={x:String(Z),y:String(ee),width:String(P.barThickness),height:String(Q),rx:String(l),ry:String(l),fill:O},X={x:String(Z+P.barThickness/2),y:String(ee-6),"text-anchor":"middle","font-size":"11","font-family":"sans-serif",fill:"#374151"}}else{let Z=c+G,ee=c;Y={x:String(ee),y:String(Z),width:String(Q),height:String(P.barThickness),rx:String(l),ry:String(l),fill:O},X={x:String(ee+Q+6),y:String(Z+P.barThickness/2+4),"text-anchor":"start","font-size":"11","font-family":"sans-serif",fill:"#374151"}}if(m&&(Y.style=y?`animation: barGrow 0.6s ease-out ${V*.05}s both`:`animation: barGrow 0.6s ease-out ${V*.05}s both`),W.push(o("rect",{key:`bar-${V}`,...Y})),d&&W.push(o("text",{key:`val-${V}`,...X},U)),y){let Z=c+G+P.barThickness/2,ee=c+x+16;W.push(o("text",{key:`cat-${V}`,x:String(Z),y:String(ee),"text-anchor":"end","font-size":"11","font-family":"sans-serif",fill:"#374151",transform:`rotate(-45, ${Z}, ${ee})`},K.label))}else W.push(o("text",{key:`cat-${V}`,x:String(c-6),y:String(c+G+P.barThickness/2+4),"text-anchor":"end","font-size":"11","font-family":"sans-serif",fill:"#374151"},K.label))}return W},[t,P,s,l,d,m,y,c,x]),z=S(()=>{if(!f)return[];let W=[];for(let V=0;V<f.length;V++){let K=f[V],Q=P.categoryScale(V),G=0;for(let O=0;O<K.values.length;O++){let Y=K.values[O],X=P.valueScale(Y.value),U=P.valueScale(G),Z=ri(O,Y.color);if(y){let ee=c+Q,ae=c+x-U-X;W.push(o("rect",{key:`sbar-${V}-${O}`,x:String(ee),y:String(ae),width:String(P.barThickness),height:String(X),rx:O===K.values.length-1?String(l):"0",ry:O===K.values.length-1?String(l):"0",fill:Z,...m?{style:`animation: barGrow 0.6s ease-out ${(V*K.values.length+O)*.03}s both`}:{}})),d&&X>14&&W.push(o("text",{key:`sval-${V}-${O}`,x:String(ee+P.barThickness/2),y:String(ae+X/2+4),"text-anchor":"middle","font-size":"10","font-family":"sans-serif",fill:"#fff"},String(Y.value)))}else{let ee=c+U,ae=c+Q;W.push(o("rect",{key:`sbar-${V}-${O}`,x:String(ee),y:String(ae),width:String(X),height:String(P.barThickness),rx:O===K.values.length-1?String(l):"0",ry:O===K.values.length-1?String(l):"0",fill:Z,...m?{style:`animation: barGrow 0.6s ease-out ${(V*K.values.length+O)*.03}s both`}:{}})),d&&X>20&&W.push(o("text",{key:`sval-${V}-${O}`,x:String(ee+X/2),y:String(ae+P.barThickness/2+4),"text-anchor":"middle","font-size":"10","font-family":"sans-serif",fill:"#fff"},String(Y.value)))}G+=Y.value}if(d){let O=P.valueScale(G);y?W.push(o("text",{key:`stotal-${V}`,x:String(c+Q+P.barThickness/2),y:String(c+x-O-6),"text-anchor":"middle","font-size":"11","font-family":"sans-serif",fill:"#374151"},String(G))):W.push(o("text",{key:`stotal-${V}`,x:String(c+O+6),y:String(c+Q+P.barThickness/2+4),"text-anchor":"start","font-size":"11","font-family":"sans-serif",fill:"#374151"},String(G)))}if(y){let O=c+Q+P.barThickness/2,Y=c+x+16;W.push(o("text",{key:`scat-${V}`,x:String(O),y:String(Y),"text-anchor":"end","font-size":"11","font-family":"sans-serif",fill:"#374151",transform:`rotate(-45, ${O}, ${Y})`},K.label))}else W.push(o("text",{key:`scat-${V}`,x:String(c-6),y:String(c+Q+P.barThickness/2+4),"text-anchor":"end","font-size":"11","font-family":"sans-serif",fill:"#374151"},K.label))}return W},[f,P,l,d,m,y,c,x]),k=S(()=>{if(!f)return[];let W=M.length,V=[];for(let K=0;K<f.length;K++){let Q=f[K],G=P.categoryScale(K),O=2,Y=Math.max(1,(P.barThickness-O*(W-1))/W);for(let X=0;X<Q.values.length;X++){let U=Q.values[X],Z=M.indexOf(U.category),ee=Z*(Y+O),ae=P.valueScale(U.value),J=ri(Z>=0?Z:X,U.color);if(y){let se=c+G+ee,ce=c+x-ae;V.push(o("rect",{key:`gbar-${K}-${X}`,x:String(se),y:String(ce),width:String(Y),height:String(ae),rx:String(l),ry:String(l),fill:J,...m?{style:`animation: barGrow 0.6s ease-out ${(K*W+X)*.04}s both`}:{}})),d&&V.push(o("text",{key:`gval-${K}-${X}`,x:String(se+Y/2),y:String(ce-4),"text-anchor":"middle","font-size":"9","font-family":"sans-serif",fill:"#374151"},String(U.value)))}else{let se=c,ce=c+G+ee;V.push(o("rect",{key:`gbar-${K}-${X}`,x:String(se),y:String(ce),width:String(ae),height:String(Y),rx:String(l),ry:String(l),fill:J,...m?{style:`animation: barGrow 0.6s ease-out ${(K*W+X)*.04}s both`}:{}})),d&&V.push(o("text",{key:`gval-${K}-${X}`,x:String(se+ae+4),y:String(ce+Y/2+3),"text-anchor":"start","font-size":"9","font-family":"sans-serif",fill:"#374151"},String(U.value)))}}if(y){let X=c+G+P.barThickness/2,U=c+x+16;V.push(o("text",{key:`gcat-${K}`,x:String(X),y:String(U),"text-anchor":"end","font-size":"11","font-family":"sans-serif",fill:"#374151",transform:`rotate(-45, ${X}, ${U})`},Q.label))}else V.push(o("text",{key:`gcat-${K}`,x:String(c-6),y:String(c+G+P.barThickness/2+4),"text-anchor":"end","font-size":"11","font-family":"sans-serif",fill:"#374151"},Q.label))}return V},[f,M,P,l,d,m,y,c,x]),w=S(()=>p?[o("text",{key:"title",x:String(n/2),y:String(c/2+4),"text-anchor":"middle","font-size":"16","font-weight":"bold","font-family":"sans-serif",fill:"#111827"},p)]:[],[p,n,c]),T=S(()=>m?[o("defs",{key:"anim-defs"},o("style",{key:"anim-style"},y?"@keyframes barGrow { from { transform: scaleY(0); transform-origin: bottom; } to { transform: scaleY(1); transform-origin: bottom; } }":"@keyframes barGrow { from { transform: scaleX(0); transform-origin: left; } to { transform: scaleX(1); transform-origin: left; } }"))]:[],[m,y]),C=L(),N=E(),F=w(),_=T(),H;return D&&b?H=k():D?H=z():H=B(),o("svg",{width:"100%",viewBox:`0 0 ${n} ${r}`,preserveAspectRatio:"xMidYMid meet",xmlns:"http://www.w3.org/2000/svg",style:{fontFamily:"sans-serif"}},..._,...F,...C,...N,...H)}function yt(e){let{start:t,end:n,step:r}=e;if(r<=0||!isFinite(r))return[];let i=Math.ceil((n-t)/r)+1;if(i>1e6)return[];let s=[];for(let a=0;a<i;a++){let l=t+a*r;if(l>n+r*.001)break;s.push(l)}return s}function qt(e,t){let n=[];for(let r=0;r<t.length;r++){let i=t[r],s=e(i);isFinite(s)&&n.push({input:i,output:s})}return n}function Zt(e,t,n,r){let i=!1,s=0,a=[],l=()=>{if(i)return;let d=Math.min(s+n,t.length);for(let u=s;u<d;u++){let h=t[u],p=e(h);isFinite(p)&&a.push({input:h,output:p})}if(s=d,s>=t.length){r(a,!0);return}r(a,!1),si(l)};return si(l),()=>{i=!0}}function si(e){typeof requestIdleCallback=="function"?requestIdleCallback(()=>e(),{timeout:16}):setTimeout(e,0)}function tc(e,t){let n=e/t,r=Math.pow(10,Math.floor(Math.log10(n))),i=n/r;return(i<1.5?1:i<3?2:i<7?5:10)*r}function ai(e,t){let n=t-e;if(n<=0)return[e];let r=tc(n,8),i=Math.ceil(e/r)*r,s=[];for(let a=i;a<=t+r*.001;a+=r)s.push(Math.round(a*1e10)/1e10);return s}function li(e){return Number.isInteger(e)?String(e):e.toFixed(2).replace(/0+$/,"").replace(/\.$/,"")}var De=40,ci=1.1,di=.01,ui=1e6;function pi(e){let{width:t=400,height:n=300,points:r=[],plotFunction:i,plotResolution:s=200,xStep:a,sync:l=!1,xRange:d=[-5,5],yRange:u=[-5,5],showGrid:h=!0,showAxes:p=!0,pointRadius:c=3,pointColor:m="#3b82f6",curveColor:f="#3b82f6",gridColor:b="#e2e8f0",axisColor:y="#94a3b8",onPointClick:g,onPointDoubleClick:x,onPointContextMenu:v,onPointHover:R}=e,[D,M]=j(d[0]),[$,A]=j(d[1]),[I,P]=j(u[0]),[L,E]=j(u[1]),B=te(!1),z=te(null),k=S(U=>De+(U-D)/($-D)*(t-2*De),[D,$,t]),w=S(U=>n-De-(U-I)/(L-I)*(n-2*De),[I,L,n]),T=S(U=>D+(U-De)/(t-2*De)*($-D),[D,$,t]),C=S(U=>I+(n-De-U)/(n-2*De)*(L-I),[I,L,n]),N=S(U=>{let Z=U;B.current=!0,z.current={mx:Z.clientX,my:Z.clientY,x0:D,x1:$,y0:I,y1:L}},[D,$,I,L]),F=S(U=>{if(!B.current||!z.current)return;let Z=U,ee=z.current,ae=Z.clientX-ee.mx,J=Z.clientY-ee.my,se=ae/(t-2*De)*(ee.x1-ee.x0),ce=J/(n-2*De)*(ee.y1-ee.y0);M(ee.x0-se),A(ee.x1-se),P(ee.y0+ce),E(ee.y1+ce)},[t,n]),_=S(()=>{B.current=!1,z.current=null},[]),H=S(U=>{let Z=U;Z.preventDefault();let ee=Z.currentTarget.getBoundingClientRect(),ae=Z.clientX-ee.left,J=Z.clientY-ee.top,se=T(ae),ce=C(J),me=Z.deltaY>0?ci:1/ci,ge=($-D)*me,ye=(L-I)*me;if(ge<di||ye<di||ge>ui||ye>ui)return;let le=(se-D)/($-D),ne=(ce-I)/(L-I);M(se-le*ge),A(se+(1-le)*ge),P(ce-ne*ye),E(ce+(1-ne)*ye)},[D,$,I,L,T,C]),W=[];if(W.push(o("rect",{x:0,y:0,width:t,height:n,fill:"white",key:"bg"})),h){let U=ai(D,$),Z=ai(I,L);for(let ee=0;ee<U.length;ee++){let ae=k(U[ee]);W.push(o("line",{x1:ae,y1:De,x2:ae,y2:n-De,stroke:b,"stroke-width":.5,key:`gx-${ee}`})),W.push(o("text",{x:ae,y:n-De+14,"text-anchor":"end","font-size":10,fill:y,transform:`rotate(-45, ${ae}, ${n-De+14})`,key:`lx-${ee}`},li(U[ee])))}for(let ee=0;ee<Z.length;ee++){let ae=w(Z[ee]);W.push(o("line",{x1:De,y1:ae,x2:t-De,y2:ae,stroke:b,"stroke-width":.5,key:`gy-${ee}`})),W.push(o("text",{x:De-6,y:ae+3,"text-anchor":"end","font-size":10,fill:y,key:`ly-${ee}`},li(Z[ee])))}}if(p){let U=Math.max(De,Math.min(t-De,k(0))),Z=Math.max(De,Math.min(n-De,w(0)));W.push(o("line",{x1:De,y1:Z,x2:t-De,y2:Z,stroke:y,"stroke-width":1,key:"x-axis"})),W.push(o("line",{x1:U,y1:De,x2:U,y2:n-De,stroke:y,"stroke-width":1,key:"y-axis"}))}let V=q(()=>{if(!i||!l)return[];let U=a??($-D)/s,Z=yt({start:D,end:$,step:U});return qt(i,Z)},[i,D,$,a,s,l]),[K,Q]=j([]),G=te(null);re(()=>{if(!i||l){Q([]);return}let U=a??($-D)/s,Z=yt({start:D,end:$,step:U});return G.current&&G.current(),G.current=Zt(i,Z,200,ee=>{Q([...ee])}),()=>{G.current&&G.current()}},[i,D,$,a,s,l]);let O=l?V:K;if(O.length>0){let U=[];for(let Z=0;Z<O.length;Z++){let ee=O[Z],ae=k(ee.input),J=w(ee.output);U.push(`${U.length===0?"M":"L"}${ae},${J}`)}W.push(o("path",{d:U.join(" "),fill:"none",stroke:f,"stroke-width":1.5,key:"curve"}))}let Y=(U,Z,ee,ae)=>{if(Z)return J=>Z({x:ae.x,y:ae.y,index:ee,event:J})};for(let U=0;U<r.length;U++){let Z=r[U],ee=k(Z.x),ae=w(Z.y),J={cx:ee,cy:ae,r:c,fill:m,cursor:"pointer",key:`pt-${U}`};g&&(J.onClick=Y("click",g,U,Z)),x&&(J.onDblClick=Y("dblclick",x,U,Z)),v&&(J.onContextMenu=Y("contextmenu",v,U,Z)),R&&(J.onMouseOver=Y("mouseover",R,U,Z)),W.push(o("circle",J))}let X=o("defs",{key:"defs"},o("clipPath",{id:"plot-clip"},o("rect",{x:De,y:De,width:t-2*De,height:n-2*De})));return o("svg",{xmlns:"http://www.w3.org/2000/svg",width:"100%",viewBox:`0 0 ${t} ${n}`,preserveAspectRatio:"xMidYMid meet",style:"user-select: none; touch-action: none;",onMouseDown:N,onMouseMove:F,onMouseUp:_,onMouseLeave:_,onWheel:H},X,...W)}function mi(e,t,n){let r=0,i=0;for(let s=0;s<n;s++){let a=r*r,l=i*i;if(a+l>4)return s;i=2*r*i+t,r=a-l+e}return n}function fi(e,t,n){if(e===t)return[0,0,0];let r=e/t;if(n==="fire")return[Math.floor(255*Math.min(1,r*3)),Math.floor(255*Math.max(0,r*3-1)),Math.floor(255*Math.max(0,r*3-2))];if(n==="ocean")return[Math.floor(255*r*.3),Math.floor(255*r*.6),Math.floor(255*(.4+r*.6))];let i=r*360%360,s=1,a=.5,l=(1-Math.abs(2*a-1))*s,d=l*(1-Math.abs(i/60%2-1)),u=a-l/2,h=0,p=0,c=0;return i<60?(h=l,p=d):i<120?(h=d,p=l):i<180?(p=l,c=d):i<240?(p=d,c=l):i<300?(h=d,c=l):(h=l,c=d),[Math.floor((h+u)*255),Math.floor((p+u)*255),Math.floor((c+u)*255)]}function gi(e,t,n=[-2.5,1],r=[-1.25,1.25],i=80,s=mi){let a=[];for(let l=0;l<t;l++){let d=[],u=r[1]-l/t*(r[1]-r[0]);for(let h=0;h<e;h++){let p=n[0]+h/e*(n[1]-n[0]);d.push(s(p,u,i))}a.push(d)}return a}function hi(e){let{width:t=400,height:n=300,realRange:r=[-2.5,1],imagRange:i=[-1.25,1.25],maxIterations:s=100,colorScheme:a="classic",computeFunction:l=mi,data:d,resolution:u=2,onPointClick:h,onPointHover:p,onPointDoubleClick:c,onPointContextMenu:m}=e;if(d){let C=d.length,N=C>0?d[0].length:0,F=N>0?t/N:1,_=C>0?n/C:1,H=[];for(let W=0;W<C;W++){let V=d[W];for(let K=0;K<N;K++){let Q=V[K]??0,[G,O,Y]=fi(Q,s,a);H.push(o("rect",{key:`${W}-${K}`,x:String(K*F),y:String(W*_),width:String(Math.ceil(F)),height:String(Math.ceil(_)),fill:`rgb(${G},${O},${Y})`}))}}return o("svg",{width:"100%",viewBox:`0 0 ${t} ${n}`,preserveAspectRatio:"xMidYMid meet",xmlns:"http://www.w3.org/2000/svg",role:"img","aria-label":"Complex plane visualization",style:{cursor:"crosshair",borderRadius:"6px",maxWidth:"100%"}},...H)}let[f,b]=j(r[0]),[y,g]=j(r[1]),[x,v]=j(i[0]),[R,D]=j(i[1]),M=te(null),$=te(!1),A=te(null),I=S((C,N)=>{let F=f+C/t*(y-f),_=R-N/n*(R-x);return{re:F,im:_}},[f,y,x,R,t,n]);re(()=>{let C=M.current;if(!C)return;let N=C.getContext("2d");if(!N)return;let F=N.createImageData(t,n),_=F.data;for(let H=0;H<n;H++)for(let W=0;W<t;W++){let{re:V,im:K}=I(W,H),Q=l(V,K,s),[G,O,Y]=fi(Q,s,a),X=(H*t+W)*4;_[X]=G,_[X+1]=O,_[X+2]=Y,_[X+3]=255}N.putImageData(F,0,0)},[f,y,x,R,t,n,s,a,l,I]);let P=S(C=>{let N=C.target.getBoundingClientRect(),F=C.clientX-N.left,_=C.clientY-N.top,{re:H,im:W}=I(F,_),V=l(H,W,s);return{re:H,im:W,iterations:V,event:C}},[I,l,s]),L=S(C=>{$.current=!0,A.current={x:C.clientX,y:C.clientY,rMin:f,rMax:y,iMin:x,iMax:R}},[f,y,x,R]),E=S(C=>{if(p&&p(P(C)),!$.current||!A.current)return;let N=A.current,F=C.clientX-N.x,_=C.clientY-N.y,H=(N.rMax-N.rMin)/t,W=(N.iMax-N.iMin)/n;b(N.rMin-F*H),g(N.rMax-F*H),v(N.iMin+_*W),D(N.iMax+_*W)},[t,n,p,P]),B=S(()=>{$.current=!1},[]),z=S(C=>{C.preventDefault();let N=C.deltaY>0?1.15:1/1.15,F=C.target.getBoundingClientRect(),_=C.clientX-F.left,H=C.clientY-F.top,{re:W,im:V}=I(_,H);b(W+(f-W)*N),g(W+(y-W)*N),v(V+(x-V)*N),D(V+(R-V)*N)},[I,f,y,x,R]),k=S(C=>{h&&h(P(C))},[h,P]),w=S(C=>{c&&c(P(C))},[c,P]),T=S(C=>{C.preventDefault(),m&&m(P(C))},[m,P]);return o("canvas",{ref:M,width:t,height:n,style:{cursor:"crosshair"},onMouseDown:L,onMouseMove:E,onMouseUp:B,onMouseLeave:B,onWheel:z,onClick:k,onDblClick:w,onContextMenu:T})}function bi(e,t,n){if(e===t)return[e];let r=(t-e)/(n-1),i=[];for(let s=0;s<n;s++){let a=e+r*s;i.push(Math.round(a*1e10)/1e10)}return i}function nc(e,t,n,r){if(e.length===0)return{xScale:()=>r,yScale:()=>n-r,xTicks:[],yTicks:[],xMin:0,xMax:0,yMin:0,yMax:0};let i=1/0,s=-1/0,a=1/0,l=-1/0;for(let b of e)b.x<i&&(i=b.x),b.x>s&&(s=b.x),b.y<a&&(a=b.y),b.y>l&&(l=b.y);i===s&&(i-=1,s+=1),a===l&&(a-=1,l+=1);let d=t-r*2,u=n-r*2,h=b=>r+(b-i)/(s-i)*d,p=b=>n-r-(b-a)/(l-a)*u,c=6,m=bi(i,s,c),f=bi(a,l,c);return{xScale:h,yScale:p,xTicks:m,yTicks:f,xMin:i,xMax:s,yMin:a,yMax:l}}function Yn(e,t,n,r){return q(()=>nc(e,t,n,r),[e,t,n,r])}function xi(e){return Number.isInteger(e)?String(e):e.toFixed(1)}function yi(e,t,n,r,i,s,a){let l={fill:i,key:s,...a};switch(e){case"square":return o("rect",{...l,x:t-r,y:n-r,width:r*2,height:r*2});case"diamond":{let d=`${t},${n-r} ${t+r},${n} ${t},${n+r} ${t-r},${n}`;return o("polygon",{...l,points:d})}case"triangle":{let d=r*1.15,u=`${t},${n-d} ${t+r},${n+r*.6} ${t-r},${n+r*.6}`;return o("polygon",{...l,points:u})}case"triangle-down":{let d=r*1.15,u=`${t-r},${n-r*.6} ${t+r},${n-r*.6} ${t},${n+d}`;return o("polygon",{...l,points:u})}case"cross":{let d=r*.35;return o("path",{...l,fill:"none",stroke:i,"stroke-width":String(d*2),"stroke-linecap":"round",d:`M${t-r},${n-r}L${t+r},${n+r}M${t+r},${n-r}L${t-r},${n+r}`})}case"plus":{let d=r*.35;return o("path",{...l,fill:"none",stroke:i,"stroke-width":String(d*2),"stroke-linecap":"round",d:`M${t},${n-r}L${t},${n+r}M${t-r},${n}L${t+r},${n}`})}case"circle":default:return o("circle",{...l,cx:t,cy:n,r})}}function Si(e){let{data:t,width:n=600,height:r=400,lineColor:i="#3b82f6",lineWidth:s=2,pointRadius:a=4,pointColor:l="#3b82f6",pointShape:d="circle",showPoints:u=!0,showGrid:h=!0,showArea:p=!1,areaColor:c="rgba(59,130,246,0.15)",xLabel:m,yLabel:f,title:b,padding:y=50,animate:g=!1,multiLine:x}=e,v=q(()=>{let L=[...t];if(x)for(let E of x)L.push(...E.data);return L},[t,x]),R=Yn(v,n,r,y),{xScale:D,yScale:M,xTicks:$,yTicks:A}=R,I=[];if(I.push(o("rect",{x:0,y:0,width:"100%",fill:"white",key:"bg"})),h){for(let L=0;L<$.length;L++){let E=D($[L]);I.push(o("line",{x1:E,y1:y,x2:E,y2:r-y,stroke:"#e5e7eb","stroke-dasharray":"4,4",key:`grid-x-${L}`}))}for(let L=0;L<A.length;L++){let E=M(A[L]);I.push(o("line",{x1:y,y1:E,x2:n-y,y2:E,stroke:"#e5e7eb","stroke-dasharray":"4,4",key:`grid-y-${L}`}))}}I.push(o("line",{x1:y,y1:r-y,x2:n-y,y2:r-y,stroke:"#374151","stroke-width":1,key:"x-axis"})),I.push(o("line",{x1:y,y1:y,x2:y,y2:r-y,stroke:"#374151","stroke-width":1,key:"y-axis"}));for(let L=0;L<$.length;L++){let E=D($[L]);I.push(o("line",{x1:E,y1:r-y,x2:E,y2:r-y+5,stroke:"#374151",key:`xtick-${L}`})),I.push(o("text",{x:E,y:r-y+18,"text-anchor":"end","font-size":11,fill:"#6b7280",transform:`rotate(-45, ${E}, ${r-y+18})`,key:`xlabel-${L}`},xi($[L])))}for(let L=0;L<A.length;L++){let E=M(A[L]);I.push(o("line",{x1:y-5,y1:E,x2:y,y2:E,stroke:"#374151",key:`ytick-${L}`})),I.push(o("text",{x:y-10,y:E+4,"text-anchor":"end","font-size":11,fill:"#6b7280",key:`ylabel-${L}`},xi(A[L])))}function P(L,E,B,z,k,w,T,C,N,F){if(L.length===0)return;let _=[...L].sort((V,K)=>V.x-K.x);if(z){let V=M(R.yMin),K=_.map(Y=>`${D(Y.x)},${M(Y.y)}`).join(" "),Q=D(_[0].x),G=D(_[_.length-1].x),O=`${Q},${V} ${K} ${G},${V}`;I.push(o("polygon",{points:O,fill:k,key:`${F}-area`}))}let W={points:_.map(V=>`${D(V.x)},${M(V.y)}`).join(" "),fill:"none",stroke:E,"stroke-width":B,"stroke-linejoin":"round","stroke-linecap":"round",key:`${F}-line`};if(g?(W["stroke-dasharray"]="1000",W["stroke-dashoffset"]="1000",I.push(o("polyline",W,o("animate",{attributeName:"stroke-dashoffset",from:1e3,to:0,dur:"1.5s",fill:"freeze"})))):I.push(o("polyline",W)),w)for(let V=0;V<_.length;V++){let K=D(_[V].x),Q=M(_[V].y),G=_[V].shape??N,O=_[V].radius??C,Y=`${F}-pt-${V}`;if(g){let X=yi(G,K,Q,O,T,Y,{opacity:0});I.push(o("g",{key:`${Y}-g`},X,o("animate",{attributeName:"opacity",from:0,to:1,dur:"0.3s",begin:"1.2s",fill:"freeze"})))}else I.push(yi(G,K,Q,O,T,Y))}}if(P(t,i,s,p,c,u,l,a,d,"primary"),x)for(let L=0;L<x.length;L++){let E=x[L];P(E.data,E.color,s,!1,"transparent",u,E.color,E.pointRadius??a,E.pointShape??d,`series-${L}`)}if(x&&x.length>0){let L=[],E=[{color:i,label:"Primary"},...x.map((H,W)=>({color:H.color,label:H.label??`Series ${W+1}`}))],B=y+10,z=16,k=22,w=7.2,T=14,C=6,N=n-y*2-20,F=0,_=0;for(let H=0;H<E.length;H++){let W=E[H].label.length*w,V=T+C+W;F>0&&F+V>N&&(F=0,_+=k);let K=B+F,Q=y-30-_;L.push(o("rect",{x:K,y:Q,width:T,height:14,fill:E[H].color,rx:2,key:`legend-rect-${H}`})),L.push(o("text",{x:K+T+C,y:Q+12,"font-size":12,fill:"#374151",key:`legend-text-${H}`},E[H].label)),F+=V+z}I.push(o("g",{key:"legend"},...L))}return m&&I.push(o("text",{x:n/2,y:r-8,"text-anchor":"middle","font-size":13,fill:"#374151",key:"x-axis-label"},m)),f&&I.push(o("text",{x:14,y:r/2,"text-anchor":"middle","font-size":13,fill:"#374151",transform:`rotate(-90, 14, ${r/2})`,key:"y-axis-label"},f)),b&&I.push(o("text",{x:n/2,y:20,"text-anchor":"middle","font-size":16,"font-weight":"bold",fill:"#111827",key:"title"},b)),o("svg",{xmlns:"http://www.w3.org/2000/svg",width:"100%",viewBox:`0 0 ${n} ${r}`,preserveAspectRatio:"xMidYMid meet"},...I)}function oc(e){let t=[];for(let n=0;n<e;n++){let r=Math.round(360*n/e);t.push(`hsl(${r}, 70%, 55%)`)}return t}function rc(e,t){let n=t??oc(e.length);return e.map((r,i)=>r.color??n[i%n.length])}function St(e,t,n,r){return{x:e+n*Math.cos(r),y:t+n*Math.sin(r)}}function Vn(e,t,n,r,i,s){let a=i-Math.PI/2,l=s-Math.PI/2,d=St(e,t,r,a),u=St(e,t,r,l),h=s-i>Math.PI?1:0;if(n<=0)return[`M ${e} ${t}`,`L ${d.x} ${d.y}`,`A ${r} ${r} 0 ${h} 1 ${u.x} ${u.y}`,"Z"].join(" ");let p=St(e,t,n,l),c=St(e,t,n,a);return[`M ${d.x} ${d.y}`,`A ${r} ${r} 0 ${h} 1 ${u.x} ${u.y}`,`L ${p.x} ${p.y}`,`A ${n} ${n} 0 ${h} 0 ${c.x} ${c.y}`,"Z"].join(" ")}function Un(e,t){let n=t?.padAngle??0,r=rc(e,t?.colors),i=e.reduce((u,h)=>u+h.value,0);if(i<=0)return[];let s=n*e.length,a=Math.PI*2-s,l=[],d=0;for(let u=0;u<e.length;u++){let h=e[u],p=h.value/i*a,c=d+n/2,m=c+p;l.push({label:h.label,value:h.value,startAngle:c,endAngle:m,percentage:h.value/i*100,color:r[u]}),d=m+n/2}return l}function vi(e){let{data:t,width:n=400,height:r=400,innerRadius:i=0,padAngle:s=.02,showLabels:a=!0,showValues:l=!0,showLegend:d=!0,legendPosition:u="right",title:h,centerLabel:p,colors:c,strokeColor:m="#fff",strokeWidth:f=2,textColor:b="currentColor"}=e,y=d&&u==="right"?140:0,g=h?30:0,x=d&&u==="bottom"?Math.ceil(t.length/2)*22+10:0,v=n-y,R=r-g-x,D=v/2,M=g+R/2,$=Math.min(v,R)/2-10,A=e.outerRadius??$,I=q(()=>Un(t,{padAngle:s,colors:c}),[t,s,c]),P=[];h&&P.push(o("text",{key:"title",x:v/2,y:20,textAnchor:"middle",fontFamily:"sans-serif",fontSize:16,fontWeight:"bold",fill:b},h));for(let L=0;L<I.length;L++){let E=I[L],B=Vn(D,M,i,A,E.startAngle,E.endAngle);if(P.push(o("path",{key:`slice-${L}`,d:B,fill:E.color,stroke:m,strokeWidth:f})),a||l){let z=(E.startAngle+E.endAngle)/2,k=E.percentage<5,w=k?A+14:i+(A-i)*.65,T=St(D,M,w,z-Math.PI/2),C=k?b:"#fff",N=k?11:12,F=[];if(a&&F.push(E.label),l&&F.push(`${E.percentage.toFixed(1)}%`),k){let _=St(D,M,A+2,z-Math.PI/2);P.push(o("line",{key:`connector-${L}`,x1:_.x,y1:_.y,x2:T.x,y2:T.y,stroke:"#999",strokeWidth:1}))}a&&P.push(o("text",{key:`label-${L}`,x:T.x,y:T.y-(l?6:0),textAnchor:"middle",fontFamily:"sans-serif",fontSize:N,fill:C,pointerEvents:"none"},E.label)),l&&P.push(o("text",{key:`value-${L}`,x:T.x,y:T.y+(a?10:0),textAnchor:"middle",fontFamily:"sans-serif",fontSize:N-1,fill:C,pointerEvents:"none"},`${E.percentage.toFixed(1)}%`))}}if(p&&i>0&&P.push(o("text",{key:"center-label",x:D,y:M,textAnchor:"middle",dominantBaseline:"central",fontFamily:"sans-serif",fontSize:14,fontWeight:"bold",fill:b},p)),d){let L=[];if(u==="right"){let E=v+10,B=g+20;for(let z=0;z<I.length;z++){let k=I[z],w=B+z*22;L.push(o("circle",{key:`legend-dot-${z}`,cx:E+6,cy:w,r:6,fill:k.color})),L.push(o("text",{key:`legend-text-${z}`,x:E+18,y:w,dominantBaseline:"central",fontFamily:"sans-serif",fontSize:12,fill:b},`${k.label} (${k.percentage.toFixed(1)}%)`))}}else{let E=r-x+10;for(let B=0;B<I.length;B++){let z=I[B],k=B%2,w=Math.floor(B/2),T=k*(n/2)+10,C=E+w*22;L.push(o("circle",{key:`legend-dot-${B}`,cx:T+6,cy:C,r:6,fill:z.color})),L.push(o("text",{key:`legend-text-${B}`,x:T+18,y:C,dominantBaseline:"central",fontFamily:"sans-serif",fontSize:12,fill:b},`${z.label} (${z.percentage.toFixed(1)}%)`))}}P.push(...L)}return o("svg",{xmlns:"http://www.w3.org/2000/svg",width:"100%",viewBox:`0 0 ${n} ${r}`,preserveAspectRatio:"xMidYMid meet"},...P)}function wi(e,t,n,r,i){return{x:n+e*Math.cos(t)*i,y:r-e*Math.sin(t)*i}}function ki(e){let{width:t=400,height:n=400,rRange:r=[0,2],plotFunction:i,plotResolution:s=360,thetaStep:a,sync:l=!1,points:d=[],showGrid:u=!0,pointRadius:h=3,pointColor:p="#3b82f6",curveColor:c="#3b82f6",onPointClick:m,onPointDoubleClick:f,onPointContextMenu:b,onPointHover:y}=e,[g,x]=j(r[1]),[v,R]=j(0),[D,M]=j(0),[$,A]=j(null),I=t/2+v,P=n/2+D,E=Math.min(t,n)/2-30,B=E/g,z=q(()=>{let O=Math.max(1,Math.ceil(g)),Y=[],X=g/O;for(let U=1;U<=O;U++)Y.push(X*U);return Y},[g]),k=q(()=>{let O=[];for(let Y=0;Y<360;Y+=30)O.push(Y*Math.PI/180);return O},[]),w=q(()=>{if(!i||!l)return[];let O=a??2*Math.PI/s,Y=yt({start:0,end:2*Math.PI,step:O});return qt(i,Y)},[i,s,a,l]),[T,C]=j([]),N=te(null);re(()=>{if(!i||l){C([]);return}let O=a??2*Math.PI/s,Y=yt({start:0,end:2*Math.PI,step:O});return N.current&&N.current(),N.current=Zt(i,Y,200,X=>{C([...X])}),()=>{N.current&&N.current()}},[i,s,a,l]);let F=l?w:T,_=q(()=>{if(F.length===0)return"";let O=[];for(let Y=0;Y<F.length;Y++){let X=F[Y],U=X.output;if(U<0||!isFinite(U))continue;let{x:Z,y:ee}=wi(U,X.input,I,P,B);O.push(`${O.length===0?"M":"L"}${Z.toFixed(2)},${ee.toFixed(2)}`)}return O.join(" ")},[F,I,P,B]),H=S(O=>{A({x:O.clientX,y:O.clientY,px:v,py:D})},[v,D]),W=S(O=>{$&&(R($.px+(O.clientX-$.x)),M($.py+(O.clientY-$.y)))},[$]),V=S(()=>{A(null)},[]),K=S(O=>{O.preventDefault();let Y=O.deltaY>0?1.15:1/1.15;x(Math.max(.1,g*Y))},[g]),Q=S((O,Y,X)=>{if(O)return U=>O({r:Y.r,theta:Y.theta,index:X,event:U})},[]),G=[];if(G.push(o("rect",{x:0,y:0,width:t,height:n,fill:"white",key:"bg"})),u){for(let O=0;O<z.length;O++){let Y=z[O]*B;G.push(o("circle",{cx:I,cy:P,r:Y,fill:"none",stroke:"#e5e7eb","stroke-width":1,key:`gc-${O}`})),G.push(o("text",{x:I+Y+2,y:P-4,"font-size":10,fill:"#9ca3af",key:`gl-${O}`},z[O].toFixed(1)))}for(let O=0;O<k.length;O++){let Y=k[O],X=z[z.length-1]*B,U=I+X*Math.cos(Y),Z=P-X*Math.sin(Y);G.push(o("line",{x1:I,y1:P,x2:U,y2:Z,stroke:"#e5e7eb","stroke-width":1,key:`al-${O}`}));let ee=Math.round(Y*180/Math.PI),ae=I+(X+14)*Math.cos(Y),J=P-(X+14)*Math.sin(Y);G.push(o("text",{x:ae,y:J+4,"text-anchor":"middle","font-size":10,fill:"#9ca3af",key:`at-${O}`},`${ee}\xB0`))}}G.push(o("line",{x1:I-E,y1:P,x2:I+E,y2:P,stroke:"#d1d5db","stroke-width":1,key:"x-axis"})),G.push(o("line",{x1:I,y1:P-E,x2:I,y2:P+E,stroke:"#d1d5db","stroke-width":1,key:"y-axis"})),_&&G.push(o("path",{d:_,fill:"none",stroke:c,"stroke-width":2,key:"curve"}));for(let O=0;O<d.length;O++){let Y=d[O],{x:X,y:U}=wi(Y.r,Y.theta,I,P,B);G.push(o("circle",{cx:X,cy:U,r:h,fill:p,key:`pt-${O}`,style:{cursor:"pointer"},onClick:Q(m,Y,O),onDblClick:Q(f,Y,O),onContextMenu:Q(b,Y,O),onMouseEnter:Q(y,Y,O)}))}return o("svg",{xmlns:"http://www.w3.org/2000/svg",width:"100%",viewBox:`0 0 ${t} ${n}`,preserveAspectRatio:"xMidYMid meet",style:{cursor:$?"grabbing":"grab"},onMouseDown:H,onMouseMove:W,onMouseUp:V,onMouseLeave:V,onWheel:K},...G)}function jn(e){let t=1<<e,n=[];for(let r=0;r<t;r++){let i=[];for(let s=0;s<e;s++)i.push((r>>s&1)*2-1);n.push({coords:i})}return n}function Gn(e){let t=1<<e,n=[];for(let r=0;r<t;r++)for(let i=0;i<e;i++){let s=r^1<<i;s>r&&n.push({source:r,target:s})}return n}function Xn(e,t){let n=Ci(e),r=0;for(let i=0;i<e;i++)for(let s=i+1;s<e;s++){if(r<t.length){let a=t[r];n=sc(n,ic(e,i,s,a))}r++}return n}function Ci(e){let t=[];for(let n=0;n<e;n++){let r=new Array(e).fill(0);r[n]=1,t.push(r)}return t}function ic(e,t,n,r){let i=Ci(e),s=Math.cos(r),a=Math.sin(r);return i[t][t]=s,i[t][n]=-a,i[n][t]=a,i[n][n]=s,i}function sc(e,t){let n=e.length,r=[];for(let i=0;i<n;i++){let s=new Array(n).fill(0);for(let a=0;a<n;a++)for(let l=0;l<n;l++)s[a]+=e[i][l]*t[l][a];r.push(s)}return r}function Kn(e,t){let n=e.length,r=new Array(n).fill(0);for(let i=0;i<n;i++)for(let s=0;s<n;s++)r[i]+=e[i][s]*t.coords[s];return r}function qn(e,t=0){let n=e[0]??0,r=e[1]??0,i=0;for(let s=2;s<e.length;s++)i+=e[s]??0;if(e.length>2&&(i/=e.length-2),t>0){let s=1/(1+t*(i+2));return{x:n*s,y:r*s,depth:i}}return{x:n,y:r,depth:i}}function Pt(e,t=[],n=.3,r=1){let i=jn(e),s=Gn(e),a=Xn(e,t);return{vertices:i.map((d,u)=>{let h=Kn(a,d),p=qn(h,n);return{id:u,position:d,x:p.x*r,y:p.y*r,depth:p.depth}}),edges:s,dimension:e}}function Tt(e){return e*(e-1)/2}function Jt(e,t=70,n=55){let r=[];for(let i=0;i<e;i++){let s=Math.round(360*i/e);r.push(`hsl(${s}, ${t}%, ${n}%)`)}return r}function Mi(e){let t=e.dimension??4,n=e.width??600,r=e.height??600,i=e.vertexRadius??10,s=e.edgeWidth??3,a=e.edgeColor??"#111",l=e.perspective??.25,d=e.rotationSpeed??.008,u=e.showLabels??!1,h=e.backgroundColor??"transparent",p=e.scale??Math.min(n,r)*.3,c=Tt(t),m=1<<t,f=q(()=>e.vertexColors==="auto"||e.vertexColors===void 0?Jt(m):e.vertexColors,[m,e.vertexColors]),[b,y]=j(()=>{let C=[];for(let N=0;N<c;N++)C.push(0);return C}),[g,x]=j(!1),v=te({x:0,y:0}),R=te([]),D=te(0);re(()=>{if(d===0)return;let C=!0,N=()=>{C&&(y(F=>{let _=F.slice();for(let H=0;H<_.length;H++)_[H]=(_[H]??0)+d*(1+H*.3);return _}),D.current=requestAnimationFrame(N))};return D.current=requestAnimationFrame(N),()=>{C=!1,cancelAnimationFrame(D.current)}},[d]);let M=q(()=>Pt(t,b,l,p),[t,b,l,p]),$=n/2,A=r/2,I=q(()=>M.edges.map(C=>{let N=M.vertices[C.source],F=M.vertices[C.target],_=(N.depth+F.depth)/2;return{...C,avgDepth:_,sv:N,tv:F}}).sort((C,N)=>C.avgDepth-N.avgDepth),[M]),P=q(()=>M.vertices.slice().sort((C,N)=>C.depth-N.depth),[M]),L=S(C=>{let N=C;x(!0),v.current={x:N.clientX,y:N.clientY},R.current=b.slice()},[b]),E=S(C=>{if(!g)return;let N=C,F=(N.clientX-v.current.x)*.01,_=(N.clientY-v.current.y)*.01;y(()=>{let H=R.current.slice();return H.length>0&&(H[0]=(H[0]??0)+F),H.length>1&&(H[1]=(H[1]??0)+_),H})},[g]),B=S(()=>{x(!1)},[]),z=C=>{let N=(C+2)/4;return .3+.7*Math.max(0,Math.min(1,N))},k=C=>{let N=(C+2)/4;return .6+.4*Math.max(0,Math.min(1,N))},w=I.map((C,N)=>{let F=z(C.avgDepth);return o("line",{key:`e-${C.source}-${C.target}`,x1:String($+C.sv.x),y1:String(A+C.sv.y),x2:String($+C.tv.x),y2:String(A+C.tv.y),stroke:a,"stroke-width":String(s),"stroke-opacity":String(F),"stroke-linecap":"round"})}),T=P.map(C=>{let N=i*k(C.depth),F=f[C.id%f.length]??"#3b82f6",_=[o("circle",{key:`v-${C.id}-circle`,cx:String($+C.x),cy:String(A+C.y),r:String(N),fill:F,stroke:"#000","stroke-width":"1.5",style:{filter:"drop-shadow(0 1px 2px rgba(0,0,0,0.3))"}})];return u&&_.push(o("text",{key:`v-${C.id}-label`,x:String($+C.x),y:String(A+C.y+N+14),"text-anchor":"middle","font-size":"11","font-family":"monospace",fill:"#555"},C.id.toString(2).padStart(t,"0"))),_});return o("svg",{width:"100%",viewBox:`0 0 ${n} ${r}`,preserveAspectRatio:"xMidYMid meet",style:{backgroundColor:h,cursor:g?"grabbing":"grab",userSelect:"none"},onMouseDown:L,onMouseMove:E,onMouseUp:B,onMouseLeave:B},...w,...T.flat())}function Ei(e={}){let t=e.dimension??4,n=e.rotationSpeed??.008,r=e.perspective??.25,i=e.scale??200,s=Tt(t),[a,l]=j(()=>new Array(s).fill(0));return re(()=>{if(n===0)return;let u=!0,h=0,p=()=>{u&&(l(c=>c.map((m,f)=>m+n*(1+f*.3))),h=requestAnimationFrame(p))};return h=requestAnimationFrame(p),()=>{u=!1,cancelAnimationFrame(h)}},[n]),{data:q(()=>Pt(t,a,r,i),[t,a,r,i]),angles:a,setAngles:l}}function Ii(e){let t=e.titlePosition??"top",n=e.legendPosition??"bottom",r=e.titleAlign??"center",i=e.legendAlign??"center",s=e.gap??"12px",a=e.contain??"layout style paint",l={display:"flex",flexDirection:ac(t,n),gap:s,width:typeof e.width=="number"?`${e.width}px`:e.width??"auto",height:typeof e.height=="number"?`${e.height}px`:e.height??"auto",backgroundColor:e.backgroundColor??"#ffffff",border:e.border??"1px solid #e5e7eb",borderRadius:e.borderRadius??"8px",padding:e.padding??"16px",fontFamily:e.fontFamily??"inherit",contain:a,overflow:"hidden",position:"relative",boxSizing:"border-box",...e.boxShadow?{boxShadow:e.boxShadow}:{},...e.style??{}},d=e.title?o("div",{className:"viz-title",style:{fontSize:e.titleFontSize??"16px",fontWeight:e.titleFontWeight??"600",color:e.titleColor??"#1f2937",textAlign:r,flexShrink:"0"}},e.title):null,u=e.legend&&e.legend.length>0?cc(e.legend,{align:i,fontSize:e.legendFontSize??"12px",gap:e.legendGap??16,direction:n==="left"||n==="right"?"column":"row"}):null,h=o("div",{className:"viz-content",style:{flex:"1",minWidth:"0",minHeight:"0",position:"relative",display:"flex",alignItems:"center",justifyContent:"center"}},e.children),p=lc(d,h,u,t,n);return o("div",{className:`viz-wrapper ${e.className??""}`.trim(),style:l},...p)}function ac(e,t){return"column"}function lc(e,t,n,r,i){let s=[];if(r==="top"&&e&&s.push(e),i==="left"||i==="right"){let a=[];i==="left"&&n&&a.push(n),r==="left"&&e&&a.push(e),a.push(t),r==="right"&&e&&a.push(e),i==="right"&&n&&a.push(n),s.push(o("div",{style:{display:"flex",flexDirection:"row",flex:"1",gap:"12px",minHeight:"0",alignItems:"stretch"}},...a))}else if(r==="left"||r==="right"){i==="top"&&n&&s.push(n);let a=[];r==="left"&&e&&a.push(e),a.push(t),r==="right"&&e&&a.push(e),s.push(o("div",{style:{display:"flex",flexDirection:"row",flex:"1",gap:"12px",minHeight:"0",alignItems:"center"}},...a)),i==="bottom"&&n&&s.push(n)}else i==="top"&&n&&s.push(n),s.push(t),i==="bottom"&&n&&s.push(n);return r==="bottom"&&e&&s.push(e),s}function cc(e,t){return o("div",{className:"viz-legend",style:{display:"flex",flexDirection:t.direction,flexWrap:"wrap",gap:`${t.gap}px`,justifyContent:t.align,alignItems:"center",fontSize:t.fontSize,color:"#6b7280",flexShrink:"0"}},...e.map((n,r)=>o("div",{key:`legend-${r}`,style:{display:"flex",alignItems:"center",gap:"6px"}},dc(n),o("span",null,n.label))))}function dc(e){let t=e.shape??"circle";return t==="line"?o("svg",{width:"20",height:"12",viewBox:"0 0 20 12"},o("line",{x1:"0",y1:"6",x2:"20",y2:"6",stroke:e.color,"stroke-width":"2","stroke-dasharray":e.dash??""})):t==="square"?o("div",{style:{width:"12px",height:"12px",backgroundColor:e.color,borderRadius:"2px",flexShrink:"0"}}):o("div",{style:{width:"10px",height:"10px",backgroundColor:e.color,borderRadius:"50%",flexShrink:"0"}})}function uc(e){if(typeof document>"u")return;let t="specifyjs-gtag";if(document.getElementById(t))return;let n=document.createElement("script");n.id=t,n.async=!0,n.src=`https://www.googletagmanager.com/gtag/js?id=${encodeURIComponent(e)}`,document.head.appendChild(n)}function pc(){typeof window>"u"||(window.dataLayer=window.dataLayer||[],window.gtag||(window.gtag=function(){window.dataLayer.push(arguments)},window.gtag("js",new Date)))}function Ri(e){let{measurementId:t,disabled:n=!1,debug:r=!1,anonymizeIp:i=!1,config:s}=e;return re(()=>{if(n||typeof window>"u")return;uc(t),pc();let a={...s};return i&&(a.anonymize_ip=!0),r&&(a.debug_mode=!0),window.gtag&&window.gtag("config",t,a),()=>{let l=document.getElementById("specifyjs-gtag");l&&l.remove()}},[t,n,r,i]),null}function Pi(e){let{left:t,center:n,right:r,borderTop:i="1px solid var(--color-border, #e2e8f0)",background:s="var(--color-bg, transparent)",color:a="var(--color-text-muted, #64748b)",fontSize:l="13px",padding:d="24px",maxWidth:u="1200px",className:h,ariaLabel:p="Site footer"}=e;return o("footer",{className:h,role:"contentinfo","aria-label":p,style:{borderTop:i,background:s,color:a,fontSize:l,padding:d,marginTop:"48px"}},o("div",{className:"footer-inner",style:{maxWidth:u,margin:"0 auto",display:"flex",alignItems:"center",justifyContent:"space-between",flexWrap:"wrap",gap:"12px"}},o("div",{className:"footer-section",style:{flex:"1",textAlign:"left",minWidth:"150px"}},t??null),o("div",{className:"footer-section",style:{flex:"1",textAlign:"center",minWidth:"150px"}},n??null),o("div",{className:"footer-section",style:{flex:"1",textAlign:"right",minWidth:"150px"}},r??null)))}var $i=je({windows:[],openWindow:()=>{},closeWindow:()=>{},focusWindow:()=>{},minimizeWindow:()=>{},maximizeWindow:()=>{},restoreWindow:()=>{},moveWindow:()=>{},resizeWindow:()=>{},tileWindows:()=>{},cascadeWindows:()=>{},minimizeAll:()=>{},focusedWindowId:null,setMenuBar:()=>{},clearMenuBar:()=>{},activeMenuBar:null,signalDock:()=>{},dockSignals:new Map}),fc={width:600,height:400},mc={x:30,y:30},gc={top:0,left:0,width:1920,height:1080},Zn=1e3;function Ti(e,t,n,r){let i=n.left+e*t.x,s=n.top+e*t.y,a=n.left+n.width-r.width,l=n.top+n.height-r.height;return a>n.left&&i>a&&(i=n.left+(i-n.left)%Math.max(1,a-n.left)),l>n.top&&s>l&&(s=n.top+(s-n.top)%Math.max(1,l-n.top)),{x:i,y:s}}function Jn(e){let t=[...e].sort((r,i)=>r.zIndex-i.zIndex),n=[];for(let r=0;r<t.length;r++)n.push({...t[r],zIndex:r+1});return n}function Di(e,t){let n=null;for(let r=0;r<e.length;r++){let i=e[r];i.id!==t&&i.windowState!=="minimized"&&(n===null||i.zIndex>n.zIndex)&&(n=i)}return n}function Qn(e){let t=0;for(let n=0;n<e.length;n++)e[n].zIndex>t&&(t=e[n].zIndex);return t}function Qt(e){let t=e.workspaceBounds??gc,n=e.defaultWindowSize??fc,r=e.cascadeOffset??mc,[i,s]=j([]),a=S(((...L)=>{let E=L[0];s(B=>{if(B.find(_=>_.id===E.id)){let H=Qn(B)+1,W=B.map(V=>V.id===E.id?{...V,focused:!0,zIndex:H,windowState:V.windowState==="minimized"?"normal":V.windowState}:{...V,focused:!1});return H>Zn&&(W=Jn(W)),W}let k=E.size??n,w=E.position??Ti(B.length,r,t,k),C=Qn(B)+1,N={id:E.id,title:E.title,icon:E.icon,position:w,size:k,windowState:"normal",zIndex:C,focused:!0,appProps:E.appProps},F=B.map(_=>({..._,focused:!1}));return F.push(N),C>Zn&&(F=Jn(F)),e.onWindowOpen&&e.onWindowOpen(E.id),e.onFocusChange&&e.onFocusChange(E.id),F})}),[n,r,t,e.onWindowOpen,e.onFocusChange]),l=S(((...L)=>{let E=L[0];v(B=>{if(B[E]){let z={...B};return delete z[E],z}return B}),D(B=>{if(B.has(E)){let z=new Map(B);return z.delete(E),z}return B}),s(B=>{let z=B.find(w=>w.id===E);if(!z)return B;let k=B.filter(w=>w.id!==E);if(z.focused&&k.length>0){let w=Di(k,E);if(w){let T=k.map(C=>({...C,focused:C.id===w.id}));return e.onWindowClose&&e.onWindowClose(E),e.onFocusChange&&e.onFocusChange(w.id),T}}return e.onWindowClose&&e.onWindowClose(E),k.length===0&&e.onFocusChange&&e.onFocusChange(null),k})}),[e.onWindowClose,e.onFocusChange]),d=S(((...L)=>{let E=L[0];s(B=>{if(!B.find(C=>C.id===E))return B;let w=Qn(B)+1,T=B.map(C=>C.id===E?{...C,focused:!0,zIndex:w}:{...C,focused:!1});return w>Zn&&(T=Jn(T)),e.onFocusChange&&e.onFocusChange(E),T})}),[e.onFocusChange]),u=S(((...L)=>{let E=L[0];s(B=>{let z=B.find(w=>w.id===E);if(!z)return B;let k=B.map(w=>w.id===E?{...w,windowState:"minimized",focused:!1}:w);if(z.focused){let w=Di(k,E);w?(k=k.map(T=>({...T,focused:T.id===w.id})),e.onFocusChange&&e.onFocusChange(w.id)):e.onFocusChange&&e.onFocusChange(null)}return k})}),[e.onFocusChange]),h=S(((...L)=>{let E=L[0];s(B=>B.map(z=>z.id===E?{...z,windowState:"maximized"}:z))}),[]),p=S(((...L)=>{let E=L[0];s(B=>B.map(z=>z.id===E?{...z,windowState:"normal"}:z))}),[]),c=S(((...L)=>{let E=L[0],B=L[1];s(z=>z.map(k=>k.id===E?{...k,position:B}:k))}),[]),m=S(((...L)=>{let E=L[0],B=L[1];s(z=>z.map(k=>k.id===E?{...k,size:B}:k))}),[]),f=S(((...L)=>{s(E=>{let B=E.filter(w=>w.windowState!=="minimized");if(B.length===0)return E;let z=B.length,k=new Map;if(z===1)k.set(B[0].id,{position:{x:t.left,y:t.top},size:{width:t.width,height:t.height}});else if(z===2){let w=Math.floor(t.width/2);k.set(B[0].id,{position:{x:t.left,y:t.top},size:{width:w,height:t.height}}),k.set(B[1].id,{position:{x:t.left+w,y:t.top},size:{width:t.width-w,height:t.height}})}else if(z===3){let w=Math.floor(t.width/2),T=Math.floor(t.height/2);k.set(B[0].id,{position:{x:t.left,y:t.top},size:{width:w,height:t.height}}),k.set(B[1].id,{position:{x:t.left+w,y:t.top},size:{width:t.width-w,height:T}}),k.set(B[2].id,{position:{x:t.left+w,y:t.top+T},size:{width:t.width-w,height:t.height-T}})}else{let w=Math.ceil(Math.sqrt(z)),T=Math.ceil(z/w),C=Math.floor(t.width/w),N=Math.floor(t.height/T);for(let F=0;F<B.length;F++){let _=Math.floor(F/w),H=F%w;k.set(B[F].id,{position:{x:t.left+H*C,y:t.top+_*N},size:{width:C,height:N}})}}return E.map(w=>{let T=k.get(w.id);return T?{...w,position:T.position,size:T.size,windowState:"normal"}:w})})}),[t]),b=S(((...L)=>{s(E=>{let B=E.filter(w=>w.windowState!=="minimized");if(B.length===0)return E;let z=[...B].sort((w,T)=>w.zIndex-T.zIndex),k=new Map;for(let w=0;w<z.length;w++){let T=Ti(w,r,t,z[w].size);k.set(z[w].id,{position:T,zIndex:w+1})}return E.map(w=>{let T=k.get(w.id);return T?{...w,position:T.position,zIndex:T.zIndex,windowState:"normal"}:w})})}),[r,t]),y=S(((...L)=>{s(E=>{let B=E.map(z=>({...z,windowState:"minimized",focused:!1}));return e.onFocusChange&&e.onFocusChange(null),B})}),[e.onFocusChange]),g=q(()=>{let L=i.find(E=>E.focused);return L?L.id:null},[i]),[x,v]=j({}),[R,D]=j(new Map),M=S(((...L)=>{let E=L[0],B=L[1];v(z=>({...z,[E]:B}))}),[]),$=S(((...L)=>{let E=L[0];v(B=>{let z={...B};return delete z[E],z})}),[]),A=q(()=>g&&x[g]?x[g]:null,[g,x]),I=S(((...L)=>{let E=L[0],B=L[1];D(z=>{let k=new Map(z),w=k.get(E);return k.set(E,{...w,...B}),k})}),[]),P=q(()=>({windows:i,openWindow:a,closeWindow:l,focusWindow:d,minimizeWindow:u,maximizeWindow:h,restoreWindow:p,moveWindow:c,resizeWindow:m,tileWindows:f,cascadeWindows:b,minimizeAll:y,focusedWindowId:g,setMenuBar:M,clearMenuBar:$,activeMenuBar:A,signalDock:I,dockSignals:R}),[i,a,l,d,u,h,p,c,m,f,b,y,g,M,$,A,I,R]);return o($i.Provider,{value:P},e.children)}function vt(){return Ye($i)}var zi=je({appId:""});function it(e){let t=q(()=>({appId:e.appId}),[e.appId]);return o(zi.Provider,{value:t},e.children)}function wt(){return Ye(zi).appId}var Ai=je({publish:()=>{},subscribe:()=>()=>{},subscribeAll:()=>()=>{}});function Dt(e){let t=te([]),n=te([]),r=S(((...l)=>{let d=l[0],u=l[1],h=l[2],p=l[3]||"",c={channel:d,from:p,to:h||null,payload:u,timestamp:Date.now()},m=t.current;for(let b=0;b<m.length;b++){let y=m[b];y.channel===d&&(c.to&&y.appId!==c.to||!c.to&&y.appId===p||y.handler(c))}let f=n.current;for(let b=0;b<f.length;b++)f[b].handler(c)}),[]),i=S(((...l)=>{let d=l[0],u=l[1],h=l[2]||"",p={channel:d,handler:u,appId:h};return t.current=[...t.current,p],()=>{t.current=t.current.filter(c=>c!==p)}}),[]),s=S(((...l)=>{let u={handler:l[0]};return n.current=[...n.current,u],()=>{n.current=n.current.filter(h=>h!==u)}}),[]),a=q(()=>({publish:r,subscribe:i,subscribeAll:s}),[r,i,s]);return o(Ai.Provider,{value:a},e.children)}function st(){let e=Ye(Ai),t=wt(),n=S(((...i)=>{let s=i[0],a=i[1],l=i[2];e.publish(s,a,l,t)}),[e.publish,t]),r=S(((...i)=>{let s=i[0],a=i[1];return e.subscribe(s,a,t)}),[e.subscribe,t]);return q(()=>({publish:n,subscribe:r,subscribeAll:e.subscribeAll}),[n,r,e.subscribeAll])}function $t(e,t){let n=st(),r=te(t);r.current=t,re(()=>n.subscribe(e,s=>{r.current(s)}),[n,e])}var Li=je({startDrag:()=>{},cancelDrag:()=>{},registerDropZone:()=>()=>{},currentDrag:null,isDragging:!1});function zt(e){let[t,n]=j(null),[r,i]=j({x:0,y:0}),s=te(new Map),a=te(null),l=t!==null,d=S(((...m)=>{let f=m[0];n(f)}),[]),u=S(((...m)=>{if(a.current){let f=s.current.get(a.current);f&&f.onDragLeave&&f.onDragLeave(),a.current=null}n(null)}),[]),h=S(((...m)=>{let f=m[0],b=m[1];return s.current=new Map(s.current),s.current.set(f,b),()=>{s.current=new Map(s.current),s.current.delete(f),a.current===f&&(a.current=null)}}),[]);re(()=>{if(!l)return;let m=y=>{let g=y;i({x:g.clientX,y:g.clientY});let x=document.elementFromPoint(g.clientX,g.clientY);if(!x)return;let v=null,R=s.current;R.forEach((M,$)=>{let A=document.querySelector(`[data-dropzone-id="${$}"]`);A&&A.contains(x)&&(v=$)});let D=a.current;if(v!==D){if(D){let M=R.get(D);M&&M.onDragLeave&&M.onDragLeave()}if(v){let M=R.get(v);M&&M.onDragEnter&&t&&M.acceptTypes.indexOf(t.type)!==-1&&M.onDragEnter(t)}a.current=v}},f=y=>{let g=a.current;if(g&&t){let x=s.current.get(g);x&&x.acceptTypes.indexOf(t.type)!==-1&&x.onDrop(t)}a.current=null,n(null)},b=y=>{y.key==="Escape"&&u()};return document.addEventListener("mousemove",m),document.addEventListener("mouseup",f),document.addEventListener("keydown",b),()=>{document.removeEventListener("mousemove",m),document.removeEventListener("mouseup",f),document.removeEventListener("keydown",b)}},[l,t,u]);let p=q(()=>({startDrag:d,cancelDrag:u,registerDropZone:h,currentDrag:t,isDragging:l}),[d,u,h,t,l]),c=l?o("div",{className:"drag-drop-preview",style:{position:"fixed",left:`${r.x+12}px`,top:`${r.y+12}px`,pointerEvents:"none",zIndex:"10000",opacity:"0.8",padding:"6px 10px",backgroundColor:"rgba(50, 50, 50, 0.9)",color:"#ffffff",borderRadius:"4px",fontSize:"12px",boxShadow:"0 4px 12px rgba(0,0,0,0.3)",whiteSpace:"nowrap"}},t&&t.preview?String(t.preview):`Dragging ${t?t.type:""}`):null;return o(Li.Provider,{value:p},e.children,c)}function pt(){return Ye(Li)}function eo(e,t){let n=pt(),r=wt(),i=te(t);i.current=t;let s=S(l=>{l.preventDefault(),n.startDrag({type:e,data:i.current,sourceAppId:r||""})},[n,e,r]),a=n.isDragging&&n.currentDrag!==null&&n.currentDrag.type===e;return q(()=>({onMouseDown:s,isDragging:a}),[s,a])}function At(e){let t=pt(),[n,r]=j(!1),i=te(e.zoneId||`zone-${Math.random().toString(36).slice(2,10)}`),s=te(e);s.current=e,re(()=>t.registerDropZone(i.current,{acceptTypes:s.current.acceptTypes,onDragEnter:d=>{r(!0),s.current.onDragEnter&&s.current.onDragEnter(d)},onDragLeave:()=>{r(!1),s.current.onDragLeave&&s.current.onDragLeave()},onDrop:d=>{r(!1),s.current.onDrop(d)}}),[t]);let a=t.isDragging&&t.currentDrag!==null&&e.acceptTypes.indexOf(t.currentDrag.type)!==-1;return q(()=>({isOver:n,canDrop:a,zoneId:i.current}),[n,a])}var hc=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],bc=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function to(e){return e<10?"0"+String(e):String(e)}function xc(e,t,n){let r=e.getHours(),i=to(e.getMinutes()),s=to(e.getSeconds());if(t==="12h"){let l=r>=12?"PM":"AM";return r=r%12,r===0&&(r=12),`${n?`${String(r)}:${i}:${s}`:`${String(r)}:${i}`} ${l}`}let a=to(r);return n?`${a}:${i}:${s}`:`${a}:${i}`}function yc(e){let t=hc[e.getDay()],n=bc[e.getMonth()],r=e.getDate();return`${t}, ${n} ${String(r)}`}function Sc(e){let{label:t,onClick:n}=e,{hover:r,onMouseEnter:i,onMouseLeave:s}=Ne(),a=S(()=>{n()},[n]),l=S(d=>{let u=d;(u.key==="Enter"||u.key===" ")&&(u.preventDefault(),n())},[n]);return o("button",{type:"button",role:"button","aria-label":t,tabIndex:0,onClick:a,onKeyDown:l,onMouseEnter:i,onMouseLeave:s,style:{display:"inline-flex",alignItems:"center",padding:"0 12px",height:"100%",border:"none",outline:"none",backgroundColor:r?"rgba(255,255,255,0.15)":"transparent",color:"inherit",fontFamily:"inherit",fontSize:"13px",fontWeight:"700",cursor:"pointer",transition:"background-color 0.15s"}},t)}function vc(e){let{format:t,showSeconds:n,showDate:r}=e,[i,s]=j(new Date);re(()=>{let u=setInterval(()=>{s(new Date)},1e3);return()=>{clearInterval(u)}},[]);let a=q(()=>xc(i,t,n),[i,t,n]),l=q(()=>yc(i),[i]),d=r?o("span",{style:{fontSize:"11px",opacity:"0.85"}},l):null;return o("div",{role:"timer","aria-live":"polite","aria-label":"System clock",style:{display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"center",gap:"6px",lineHeight:"1",padding:"0 8px"}},d,o("span",{style:{fontSize:"13px",fontWeight:"500"}},a))}function wc(e){let{indicator:t}=e,{hover:n,onMouseEnter:r,onMouseLeave:i}=Ne(),s=S(()=>{t.onClick&&t.onClick()},[t]),a=S(l=>{let d=l;(d.key==="Enter"||d.key===" ")&&(d.preventDefault(),t.onClick&&t.onClick())},[t]);return o("button",{type:"button",role:"button","aria-label":t.label||t.icon,tabIndex:0,onClick:s,onKeyDown:a,onMouseEnter:r,onMouseLeave:i,style:{display:"inline-flex",alignItems:"center",gap:"4px",padding:"0 4px",height:"100%",border:"none",outline:"none",backgroundColor:n?"rgba(255,255,255,0.15)":"transparent",color:"inherit",fontFamily:"inherit",fontSize:"13px",cursor:t.onClick?"pointer":"default",transition:"background-color 0.15s"}},o("span",{"aria-hidden":"true"},t.icon),t.label?o("span",null,t.label):null)}function kc(e){let{item:t,onClose:n}=e,{hover:r,onMouseEnter:i,onMouseLeave:s}=Ne();if(t.divider)return o("div",{role:"separator",style:{height:"1px",backgroundColor:"var(--panel-divider, #555555)",margin:"4px 0"}});let a=S(()=>{t.onClick(),n()},[t,n]),l=S(d=>{let u=d;(u.key==="Enter"||u.key===" ")&&(u.preventDefault(),t.onClick(),n())},[t,n]);return o("button",{type:"button",role:"menuitem",tabIndex:-1,onClick:a,onKeyDown:l,onMouseEnter:i,onMouseLeave:s,style:{display:"flex",alignItems:"center",gap:"8px",width:"100%",padding:"6px 16px",border:"none",outline:"none",backgroundColor:r?"var(--panel-hover, rgba(255,255,255,0.15))":"transparent",color:"var(--panel-text, #ffffff)",fontFamily:"inherit",fontSize:"13px",textAlign:"left",cursor:"pointer",boxSizing:"border-box",transition:"background-color 0.1s"}},t.icon?o("span",{style:{width:"16px",textAlign:"center"},"aria-hidden":"true"},t.icon):null,o("span",null,t.label))}function Cc(e){let{user:t,menuItems:n}=e,{hover:r,onMouseEnter:i,onMouseLeave:s}=Ne(),[a,l]=j(!1),d=te(null),u=S(()=>{l(y=>!y)},[]),h=S(()=>{l(!1)},[]),p=S(y=>{let g=y;(g.key==="Enter"||g.key===" ")&&(g.preventDefault(),l(x=>!x)),g.key==="Escape"&&l(!1)},[]);re(()=>{if(!a)return;let y=g=>{let x=d.current;x&&!x.contains(g.target)&&l(!1)};return document.addEventListener("click",y,!0),()=>{document.removeEventListener("click",y,!0)}},[a]);let c={width:"24px",height:"24px",borderRadius:"50%",display:"inline-flex",alignItems:"center",justifyContent:"center",fontSize:"12px",fontWeight:"700",backgroundColor:"rgba(255,255,255,0.2)",color:"inherit",overflow:"hidden",flexShrink:"0"},m=t.avatar?o("img",{src:t.avatar,alt:t.name,style:{width:"100%",height:"100%",objectFit:"cover"}}):t.name.charAt(0).toUpperCase(),f=o("span",{style:c,"aria-hidden":"true"},m),b=a&&n&&n.length>0?o("div",{role:"menu","aria-label":"User menu",style:{position:"absolute",top:"100%",right:"0",marginTop:"2px",backgroundColor:"var(--panel-bg, #2c2c2c)",border:"1px solid var(--panel-divider, #555555)",borderRadius:"6px",boxShadow:"0 4px 12px rgba(0,0,0,0.3)",padding:"4px 0",minWidth:"180px",zIndex:"1000"}},...n.map((y,g)=>o(kc,{key:String(g),item:y,onClose:h}))):null;return o("div",{ref:d,style:{position:"relative",display:"inline-flex",height:"100%"}},o("button",{type:"button","aria-haspopup":"true","aria-expanded":String(a),tabIndex:0,onClick:u,onKeyDown:p,onMouseEnter:i,onMouseLeave:s,style:{display:"inline-flex",alignItems:"center",gap:"6px",padding:"0 8px",height:"100%",border:"none",outline:"none",backgroundColor:r||a?"rgba(255,255,255,0.15)":"transparent",color:"inherit",fontFamily:"inherit",fontSize:"13px",cursor:"pointer",transition:"background-color 0.15s"}},f,o("span",null,t.name),o("span",{"aria-hidden":"true",style:{fontSize:"10px"}},"\u25BE")),b)}function Mc(e){let{menu:t}=e,{hover:n,onMouseEnter:r,onMouseLeave:i}=Ne(),[s,a]=j(!1),l=te(null),d=S(()=>{a(c=>!c)},[]),u=S(()=>{a(!1)},[]),h=S(c=>{let m=c;(m.key==="Enter"||m.key===" ")&&(m.preventDefault(),a(f=>!f)),m.key==="Escape"&&a(!1)},[]);re(()=>{if(!s)return;let c=m=>{let f=l.current;f&&!f.contains(m.target)&&a(!1)};return document.addEventListener("click",c,!0),()=>{document.removeEventListener("click",c,!0)}},[s]);let p=s&&t.items.length>0?o("div",{role:"menu","aria-label":t.label+" menu",style:{position:"absolute",top:"100%",left:"0",marginTop:"2px",backgroundColor:"var(--panel-bg, #2c2c2c)",border:"1px solid var(--panel-divider, #555555)",borderRadius:"6px",boxShadow:"0 4px 12px rgba(0,0,0,0.3)",padding:"4px 0",minWidth:"180px",zIndex:"1000"}},...t.items.map((c,m)=>c.divider?o("div",{key:"div-"+String(m),role:"separator",style:{height:"1px",backgroundColor:"var(--panel-divider, #555555)",margin:"4px 0"}}):o("button",{key:String(m),type:"button",role:"menuitem",tabIndex:-1,disabled:c.disabled??!1,onClick:()=>{c.onClick&&c.onClick(),u()},style:{display:"flex",alignItems:"center",justifyContent:"space-between",width:"100%",padding:"6px 16px",border:"none",outline:"none",backgroundColor:"transparent",color:c.disabled?"rgba(255,255,255,0.4)":"var(--panel-text, #ffffff)",fontFamily:"inherit",fontSize:"13px",textAlign:"left",cursor:c.disabled?"default":"pointer",boxSizing:"border-box"}},o("span",null,c.checked?"\u2713 ":"",c.label||""),c.shortcut?o("span",{style:{fontSize:"11px",opacity:"0.6",marginLeft:"16px"}},c.shortcut):null))):null;return o("div",{ref:l,className:"system-tray__app-menu",style:{position:"relative",display:"inline-flex",height:"100%"}},o("button",{type:"button","aria-haspopup":"true","aria-expanded":String(s),tabIndex:0,onClick:d,onKeyDown:h,onMouseEnter:r,onMouseLeave:i,style:{display:"inline-flex",alignItems:"center",padding:"0 10px",height:"100%",border:"none",outline:"none",backgroundColor:n||s?"rgba(255,255,255,0.15)":"transparent",color:"inherit",fontFamily:"inherit",fontSize:"13px",fontWeight:"500",cursor:"pointer",transition:"background-color 0.15s"}},t.label),p)}function en(e){let{activeAppName:t,activitiesButton:n,appMenuBar:r,clockFormat:i="24h",showSeconds:s=!0,showDate:a=!0,indicators:l,user:d,userMenuItems:u,height:h=28,children:p}=e,c=String(h)+"px",m=[];if(n&&m.push(o(Sc,{key:"activities",label:n.label,onClick:n.onClick})),t&&m.push(o("span",{key:"appname",style:{padding:"0 12px",fontSize:"13px",fontWeight:"700",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",maxWidth:"200px"}},t)),r&&r.menus.length>0)for(let v=0;v<r.menus.length;v++)m.push(o(Mc,{key:"appmenu-"+String(v),menu:r.menus[v]}));let f=o("div",{style:{display:"flex",alignItems:"center",height:"100%",flex:"1",minWidth:"0"}},...m),b=[];b.push(o(vc,{key:"clock",format:i,showSeconds:s,showDate:a})),p&&b.push(p);let y=o("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",height:"100%"}},...b),g=[];if(l&&l.length>0){let v=l.map(R=>o(wc,{key:R.id,indicator:R}));g.push(o("div",{key:"indicators",style:{display:"flex",alignItems:"center",gap:"8px",height:"100%"}},...v))}d&&g.push(o(Cc,{key:"user",user:d,menuItems:u}));let x=o("div",{style:{display:"flex",alignItems:"center",justifyContent:"flex-end",height:"100%",flex:"1",gap:"4px"}},...g);return o("div",{role:"menubar","aria-label":"System panel","data-theme":"dark",style:{display:"flex",alignItems:"center",justifyContent:"space-between",width:"100%",height:c,backgroundColor:"var(--panel-bg, #2c2c2c)",color:"var(--panel-text, #ffffff)",fontFamily:"inherit",fontSize:"13px",boxSizing:"border-box",position:"relative"}},f,y,x)}function Ec(e){return e.startsWith("http")||e.startsWith("/")||e.startsWith(".")}var Bi=["#3465a4","#e67e22","#2ecc71","#3498db","#e74c3c","#9b59b6","#f39c12","#1abc9c","#e91e63","#00bcd4"];function Ic(e){let t=0;for(let n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n)|0;return Bi[Math.abs(t)%Bi.length]}function Rc(e){return e>99?"99+":String(e)}function Pc(e){return e.badge&&e.badge>0?`${e.label}, ${e.badge} unread`:e.label}function Tc(e){switch(e){case"left":return{left:"100%",top:"50%",transform:"translateY(-50%)",marginLeft:"8px"};case"right":return{right:"100%",top:"50%",transform:"translateY(-50%)",marginRight:"8px"};case"top":return{top:"100%",left:"50%",transform:"translateX(-50%)",marginTop:"8px"};case"bottom":return{bottom:"100%",left:"50%",transform:"translateX(-50%)",marginBottom:"8px"};default:return{left:"100%",top:"50%",transform:"translateY(-50%)",marginLeft:"8px"}}}function Dc(e,t){return t==="vertical"?e==="right"?{position:"absolute",right:"0",top:"50%",transform:"translateY(-50%)"}:{position:"absolute",left:"0",top:"50%",transform:"translateY(-50%)"}:e==="bottom"?{position:"absolute",top:"0",left:"50%",transform:"translateX(-50%)"}:{position:"absolute",bottom:"0",left:"50%",transform:"translateX(-50%)"}}function $c(e){let{item:t,iconSize:n,position:r,orientation:i,onItemClick:s,onItemContextMenu:a}=e,[l,d]=j(!1),u=t.disabled??!1,h=S(()=>{u||d(!0)},[u]),p=S(()=>{d(!1)},[]),c=S(()=>{!u&&s&&s(t.id)},[u,s,t.id]),m=S(D=>{if(!u&&a){let M=D;M.preventDefault(),a(t.id,{x:M.clientX,y:M.clientY})}},[u,a,t.id]),f=`${n}px`,b=Ec(t.icon)?o("img",{src:t.icon,alt:t.label,style:{width:f,height:f,objectFit:"contain",display:"block"}}):o("span",{style:{width:f,height:f,display:"flex",alignItems:"center",justifyContent:"center",fontSize:`${Math.round(n*.6)}px`,fontWeight:"700",userSelect:"none",backgroundColor:Ic(t.icon),color:"#ffffff",borderRadius:"8px"},"aria-hidden":"true"},t.icon),y=t.badge!=null&&t.badge>0?o("span",{style:{position:"absolute",top:"0",right:"0",backgroundColor:"var(--dock-badge-bg, #e74c3c)",color:"#ffffff",fontSize:"9px",fontWeight:"700",lineHeight:"1",minWidth:"14px",height:"14px",display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"7px",padding:"0 3px",pointerEvents:"none",zIndex:"2"},"aria-hidden":"true"},Rc(t.badge)):null,g=t.active?o("span",{style:{...Dc(r,i),width:"6px",height:"6px",borderRadius:"50%",backgroundColor:"var(--dock-active-color, #ffffff)",pointerEvents:"none",zIndex:"2"},"aria-hidden":"true"}):null,x=t.progress!=null&&t.progress>0?o("div",{style:{position:"absolute",bottom:"2px",left:"6px",right:"6px",height:"3px",backgroundColor:"rgba(255,255,255,0.2)",borderRadius:"2px",overflow:"hidden",pointerEvents:"none",zIndex:"2"},"aria-hidden":"true"},o("div",{style:{width:`${Math.min(1,Math.max(0,t.progress))*100}%`,height:"100%",backgroundColor:"var(--dock-progress-color, #3b82f6)",borderRadius:"2px",transition:"width 200ms ease"}})):null,v=l?o("div",{role:"tooltip",style:{position:"absolute",...Tc(r),padding:"4px 10px",backgroundColor:"#1f2937",color:"#ffffff",fontSize:"12px",borderRadius:"4px",whiteSpace:"nowrap",zIndex:"1000",pointerEvents:"none"}},t.label):null,R={position:"relative",display:"flex",alignItems:"center",justifyContent:"center",padding:"6px",border:"none",backgroundColor:"transparent",cursor:u?"default":"pointer",opacity:u?"0.4":"1",pointerEvents:u?"none":"auto",transition:"transform 100ms, background-color 100ms",borderRadius:"8px",outline:"none",...l&&!u?{transform:"scale(1.1)",backgroundColor:"rgba(255,255,255,0.15)"}:{},...t.urgent&&!u?{animation:"dock-urgent-pulse 0.6s ease-in-out infinite alternate"}:{}};return o("button",{type:"button",role:"button",style:R,"aria-label":Pc(t),"aria-pressed":t.active?"true":"false","aria-disabled":u?"true":void 0,tabIndex:u?-1:0,onClick:c,onContextMenu:m,onMouseEnter:h,onMouseLeave:p,"data-dock-item-id":t.id,"data-urgent":t.urgent?"true":void 0},b,y,g,x,v)}function tn(e){let{items:t,orientation:n="vertical",position:r="left",iconSize:i=36,autoHide:s=!1,showTrailingSeparator:a=!1,onItemClick:l,onItemContextMenu:d,children:u}=e,[h,p]=j(!s),c=te(null),m=S(()=>{s&&(c.current!=null&&(clearTimeout(c.current),c.current=null),p(!0))},[s]),f=S(()=>{s&&(c.current=setTimeout(()=>{p(!1)},300))},[s]),b=S(R=>{let D=R,M=D.target,$=M.closest('[role="toolbar"]');if(!$)return;let A=Array.from($.querySelectorAll("button[data-dock-item-id]")),I=A.indexOf(M);if(I<0)return;let P=n==="vertical",L=P?"ArrowDown":"ArrowRight",E=P?"ArrowUp":"ArrowLeft";if(D.key===L){D.preventDefault();let B=A[I+1];B&&B.focus()}else if(D.key===E){D.preventDefault();let B=A[I-1];B&&B.focus()}else D.key==="Home"?(D.preventDefault(),A[0]?.focus()):D.key==="End"?(D.preventDefault(),A[A.length-1]?.focus()):(D.key==="Enter"||D.key===" ")&&(D.preventDefault(),M.click())},[n]),y=n==="vertical",g={display:"flex",flexDirection:y?"column":"row",alignItems:"center",gap:"2px",padding:"4px",backgroundColor:"var(--dock-bg, rgba(0, 0, 0, 0.7))",color:"#ffffff",border:"1px solid var(--dock-border, rgba(255, 255, 255, 0.1))",borderRadius:"8px",boxSizing:"border-box",position:"relative",transition:"transform 200ms ease, opacity 200ms ease"};s&&!h&&(r==="left"?(g.transform="translateX(-100%)",g.opacity="0"):r==="right"?(g.transform="translateX(100%)",g.opacity="0"):r==="top"?(g.transform="translateY(-100%)",g.opacity="0"):r==="bottom"&&(g.transform="translateY(100%)",g.opacity="0"));let x=[];for(let R=0;R<t.length;R++){if(a&&R===t.length-1&&t.length>1){let D=y?{width:"60%",height:"1px",backgroundColor:"rgba(255,255,255,0.2)",margin:"4px auto",flexShrink:"0"}:{height:"60%",width:"1px",backgroundColor:"rgba(255,255,255,0.2)",margin:"auto 4px",flexShrink:"0"};x.push(o("div",{key:`sep-${R}`,style:D,"aria-hidden":"true",role:"separator"}))}x.push(o($c,{key:t[R].id,item:t[R],iconSize:i,position:r,orientation:n,onItemClick:l,onItemContextMenu:d}))}let v=s&&!h?o("div",{style:{position:"absolute",...r==="left"?{left:"0",top:"0",width:"4px",height:"100%"}:{},...r==="right"?{right:"0",top:"0",width:"4px",height:"100%"}:{},...r==="top"?{top:"0",left:"0",height:"4px",width:"100%"}:{},...r==="bottom"?{bottom:"0",left:"0",height:"4px",width:"100%"}:{},zIndex:"10"},"aria-hidden":"true"}):null;return o("div",{role:"toolbar","aria-label":"Application launcher","aria-orientation":n,style:g,onMouseEnter:m,onMouseLeave:f,onKeyDown:b},v,...x,u??null)}var zc="#2c001e";function nn(e){let{backgroundColor:t=zc,backgroundGradient:n,backgroundImage:r,backgroundImageOpacity:i=1,contextMenuItems:s,onClick:a,onDoubleClick:l,overflow:d="visible",children:u}=e,h=S(g=>{let x=g;x.target===x.currentTarget&&a&&a()},[a]),p=S(g=>{let x=g;x.target===x.currentTarget&&l&&l()},[l]),c=q(()=>{let g={position:"relative",width:"100%",height:"100%",overflow:d,cursor:"default",margin:"0",padding:"0"};return g.backgroundColor=t,n&&(g.background=n),r&&i>=1&&(g.backgroundImage=`url(${r})`,g.backgroundSize="cover",g.backgroundPosition="center"),g},[t,n,r,i]),m=q(()=>!r||i>=1?null:{position:"absolute",top:"0",left:"0",width:"100%",height:"100%",backgroundImage:`url(${r})`,backgroundSize:"cover",backgroundPosition:"center",opacity:String(i),pointerEvents:"none",zIndex:"0"},[r,i]),f={position:"relative",width:"100%",height:"100%",zIndex:"1"},b=[];m&&b.push(o("div",{className:"desktop-background__image-overlay",style:m,"aria-hidden":"true"})),b.push(o("div",{className:"desktop-background__content",style:f},u));let y=o("div",{className:"desktop-background",style:c,onClick:h,onDblClick:p,role:"application","aria-label":"Desktop workspace","data-theme":"dark"},...b);return s&&s.length>0?o(Kt,{items:s},y):y}function no(e){let{items:t,backgroundColor:n="#007acc",color:r="#ffffff",height:i=22}=e,s=t.filter(p=>p.align!=="right"),a=t.filter(p=>p.align==="right"),l={display:"flex",alignItems:"center",justifyContent:"space-between",height:`${i}px`,backgroundColor:n,color:r,fontSize:"12px",flexShrink:"0",padding:"0 8px",overflow:"hidden",userSelect:"none"};function d(p){let c=typeof p.onClick=="function",m={display:"inline-flex",alignItems:"center",gap:"4px",padding:"0 6px",height:"100%",whiteSpace:"nowrap",cursor:c?"pointer":"default"},f=[];p.icon&&f.push(o("span",{className:"status-bar__item-icon",style:{fontSize:"12px",lineHeight:"1"}},p.icon)),f.push(o("span",{className:"status-bar__item-label"},p.label));let b={key:p.key,className:`status-bar__item${c?" status-bar__item--clickable":""}`,style:m};return c&&(b.onClick=p.onClick,b.onMouseEnter=y=>{y.currentTarget.style.backgroundColor="rgba(255, 255, 255, 0.15)"},b.onMouseLeave=y=>{y.currentTarget.style.backgroundColor=""}),o("span",b,...f)}let u=o("div",{className:"status-bar__left",style:{display:"flex",alignItems:"center",height:"100%",overflow:"hidden"}},...s.map(d)),h=o("div",{className:"status-bar__right",style:{display:"flex",alignItems:"center",height:"100%",overflow:"hidden"}},...a.map(d));return o("div",{className:"status-bar",style:l,role:"status","aria-label":"Status bar"},u,h)}var Ac={width:200,height:150},Lc={x:50,y:50},Bc={width:400,height:300},We=8,oo=20,Fc={n:"n-resize",s:"s-resize",e:"e-resize",w:"w-resize",ne:"ne-resize",nw:"nw-resize",se:"se-resize",sw:"sw-resize"};function kt(e){let{id:t,title:n,icon:r,defaultPosition:i=Lc,defaultSize:s=Bc,minSize:a=Ac,maxSize:l,resizable:d=!0,draggable:u=!0,windowState:h="normal",focused:p=!0,zIndex:c,onClose:m,onMinimize:f,onMaximize:b,onFocus:y,onMove:g,onResize:x,statusBar:v,children:R}=e,[D,M]=j(i.x),[$,A]=j(i.y),[I,P]=j(s.width),[L,E]=j(s.height),[B,z]=j(!1),[k,w]=j(!1),[T,C]=j(null),N=te(null),F=te(null),_=te(null),H=S((le,ne)=>{let pe=Math.max(le,a.width),ie=Math.max(ne,a.height);return l&&(pe=Math.min(pe,l.width),ie=Math.min(ie,l.height)),{width:pe,height:ie}},[a,l]),W=S(()=>{let le=_.current;return le&&le.parentElement?{width:le.parentElement.clientWidth,height:le.parentElement.clientHeight}:{width:window.innerWidth,height:window.innerHeight}},[]),V=S((le,ne,pe,ie)=>{let he=W(),xe=Math.max(0,Math.min(le,he.width-pe)),Ce=Math.max(0,Math.min(ne,he.height-ie));return{x:xe,y:Ce}},[W]),K=S(le=>{if(!u||h==="maximized")return;let ne=le;ne.target.closest("button")||(ne.preventDefault(),N.current={startMouseX:ne.clientX,startMouseY:ne.clientY,startPosX:D,startPosY:$},z(!0))},[u,h,D,$]),Q=S(le=>{le.target.closest("button")||d&&b&&b()},[b,d]);re(()=>{if(!B)return;let le=pe=>{let ie=pe,he=N.current;if(!he)return;let xe=ie.clientX-he.startMouseX,Ce=ie.clientY-he.startMouseY,de=he.startPosX+xe,be=he.startPosY+Ce,ke=W();de=Math.max(0,Math.min(de,ke.width-I)),be=Math.max(0,Math.min(be,ke.height-L)),M(de),A(be),ie.clientX<=oo?C("left"):ie.clientX>=ke.width-oo?C("right"):ie.clientY<=oo?C("top"):C(null)},ne=pe=>{let ie=pe;z(!1);let he=W();if(T==="left"){M(0),A(0),P(Math.floor(he.width/2)),E(he.height),C(null),g&&g({x:0,y:0}),x&&x({width:Math.floor(he.width/2),height:he.height});return}if(T==="right"){let Ce=Math.floor(he.width/2);M(Ce),A(0),P(Ce),E(he.height),C(null),g&&g({x:Ce,y:0}),x&&x({width:Ce,height:he.height});return}if(T==="top"){C(null),b&&b();return}C(null);let xe=N.current;if(xe&&g){let Ce=ie.clientX-xe.startMouseX,de=ie.clientY-xe.startMouseY,be=xe.startPosX+Ce,ke=xe.startPosY+de;be=Math.max(0,Math.min(be,he.width-I)),ke=Math.max(0,Math.min(ke,he.height-L)),g({x:be,y:ke})}N.current=null};return document.addEventListener("mousemove",le),document.addEventListener("mouseup",ne),()=>{document.removeEventListener("mousemove",le),document.removeEventListener("mouseup",ne)}},[B,T,I,L,W,g,x,b]);let G=S(le=>ne=>{if(!d||h!=="normal")return;let pe=ne;pe.preventDefault(),pe.stopPropagation(),F.current={direction:le,startMouseX:pe.clientX,startMouseY:pe.clientY,startPosX:D,startPosY:$,startWidth:I,startHeight:L},w(!0)},[d,h,D,$,I,L]);re(()=>{if(!k)return;let le=pe=>{let ie=pe,he=F.current;if(!he)return;let xe=ie.clientX-he.startMouseX,Ce=ie.clientY-he.startMouseY,de=he.direction,be=he.startWidth,ke=he.startHeight,Re=he.startPosX,Le=he.startPosY;de.includes("e")&&(be=he.startWidth+xe),de.includes("w")&&(be=he.startWidth-xe,Re=he.startPosX+xe),de.includes("s")&&(ke=he.startHeight+Ce),de.includes("n")&&(ke=he.startHeight-Ce,Le=he.startPosY+Ce);let oe=H(be,ke);de.includes("w")&&(Re=he.startPosX+(he.startWidth-oe.width)),de.includes("n")&&(Le=he.startPosY+(he.startHeight-oe.height)),P(oe.width),E(oe.height),M(Re),A(Le)},ne=()=>{w(!1),x&&x({width:I,height:L}),F.current=null};return document.addEventListener("mousemove",le),document.addEventListener("mouseup",ne),()=>{document.removeEventListener("mousemove",le),document.removeEventListener("mouseup",ne)}},[k,I,L,H,x]),re(()=>{if(!p||!m)return;let le=ne=>{ne.key==="Escape"&&m()};return document.addEventListener("keydown",le),()=>document.removeEventListener("keydown",le)},[p,m]);let O=S(le=>{y&&y()},[y]);if(h==="minimized")return null;let Y=h==="maximized",X=q(()=>{let le={position:"absolute",display:"flex",flexDirection:"column",border:"1px solid var(--window-border, #555555)",borderRadius:Y?"0":"6px",overflow:"hidden",backgroundColor:"var(--window-body-bg, #1e1e1e)",boxShadow:p?"0 8px 32px rgba(0, 0, 0, 0.4)":"0 4px 16px rgba(0, 0, 0, 0.2)",transition:Y?"all 200ms ease":"box-shadow 200ms ease",outline:"none"};return Y?(le.top="0",le.left="0",le.width="100%",le.height="100%"):(le.top=`${$}px`,le.left=`${D}px`,le.width=`${I}px`,le.height=`${L}px`),c!==void 0&&(le.zIndex=String(c)),B&&(le.cursor="grabbing",le.userSelect="none"),le},[Y,D,$,I,L,c,p,B]),U=q(()=>{let le={display:"flex",alignItems:"center",padding:"0 8px",height:"32px",backgroundColor:"var(--window-title-bg, #2c2c2c)",color:"var(--window-title-text, #ffffff)",userSelect:"none",flexShrink:"0",cursor:u&&!Y?"grab":"default",opacity:p?"1":"0.6"};return B&&(le.cursor="grabbing"),le},[p,u,Y,B]),Z={flex:"1",overflow:"auto",backgroundColor:"var(--window-body-bg, #1e1e1e)"},ee={width:"14px",height:"14px",borderRadius:"50%",border:"none",cursor:"pointer",padding:"0",marginLeft:"6px",fontSize:"0",lineHeight:"0",display:"inline-flex",alignItems:"center",justifyContent:"center"},ae=[];r&&(r.startsWith("http")||r.startsWith("/")||r.startsWith("data:")?ae.push(o("img",{src:r,alt:"",style:{width:"16px",height:"16px",marginRight:"6px",flexShrink:"0"},className:"draggable-window__icon"})):ae.push(o("span",{style:{marginRight:"6px",fontSize:"14px",flexShrink:"0"},className:"draggable-window__icon"},r))),ae.push(o("span",{className:"draggable-window__title-text",style:{flex:"1",fontSize:"13px",fontWeight:"500",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}},n));let J=[];J.push(o("button",{type:"button","aria-label":"Minimize",className:"draggable-window__btn-minimize",style:{...ee,backgroundColor:"var(--window-button-minimize, #f39c12)"},onClick:le=>{le.stopPropagation(),f&&f()}})),d&&J.push(o("button",{type:"button","aria-label":Y?"Restore":"Maximize",className:"draggable-window__btn-maximize",style:{...ee,backgroundColor:"var(--window-button-maximize, #2ecc71)"},onClick:le=>{le.stopPropagation(),b&&b()}})),J.push(o("button",{type:"button","aria-label":"Close",className:"draggable-window__btn-close",style:{...ee,backgroundColor:"var(--window-button-close, #e74c3c)"},onClick:le=>{le.stopPropagation(),m&&m()}}));let se=o("div",{style:{display:"flex",alignItems:"center",flexShrink:"0"},className:"draggable-window__controls"},...J);ae.push(se);let ce=[];if(d&&!Y){let le=["n","s","e","w","ne","nw","se","sw"];for(let ne=0;ne<le.length;ne++){let pe=le[ne],ie={position:"absolute",zIndex:"1"};pe==="n"?(ie.top="0",ie.left=`${We}px`,ie.right=`${We}px`,ie.height=`${We}px`):pe==="s"?(ie.bottom="0",ie.left=`${We}px`,ie.right=`${We}px`,ie.height=`${We}px`):pe==="e"?(ie.top=`${We}px`,ie.right="0",ie.bottom=`${We}px`,ie.width=`${We}px`):pe==="w"?(ie.top=`${We}px`,ie.left="0",ie.bottom=`${We}px`,ie.width=`${We}px`):pe==="ne"?(ie.top="0",ie.right="0",ie.width=`${We}px`,ie.height=`${We}px`):pe==="nw"?(ie.top="0",ie.left="0",ie.width=`${We}px`,ie.height=`${We}px`):pe==="se"?(ie.bottom="0",ie.right="0",ie.width=`${We}px`,ie.height=`${We}px`):pe==="sw"&&(ie.bottom="0",ie.left="0",ie.width=`${We}px`,ie.height=`${We}px`),ie.cursor=Fc[pe],ce.push(o("div",{className:`draggable-window__resize-handle draggable-window__resize-${pe}`,style:ie,onMouseDown:G(pe)}))}}let me=null;if(T){let le={position:"fixed",backgroundColor:"rgba(66, 133, 244, 0.2)",border:"2px solid rgba(66, 133, 244, 0.5)",borderRadius:"4px",zIndex:"999999",pointerEvents:"none",transition:"all 150ms ease"};T==="left"?(le.top="0",le.left="0",le.width="50%",le.height="100%"):T==="right"?(le.top="0",le.right="0",le.width="50%",le.height="100%"):T==="top"&&(le.top="0",le.left="0",le.width="100%",le.height="100%"),me=o("div",{className:"draggable-window__snap-preview",style:le})}let ge=[];for(let le=0;le<ce.length;le++)ge.push(ce[le]);ge.push(o("div",{className:"draggable-window__title-bar",style:U,onMouseDown:K,onDblClick:Q,role:"toolbar","aria-label":`${n} window controls`},...ae)),ge.push(o("div",{className:"draggable-window__body",style:Z},R)),v&&ge.push(o(no,v));let ye=[o("div",{ref:_,id:`draggable-window-${t}`,className:`draggable-window ${p?"draggable-window--focused":"draggable-window--unfocused"} draggable-window--${h}`,style:X,role:"dialog","aria-label":n,tabIndex:-1,onMouseDown:O},...ge)];return me&&ye.push(me),ye.length===1?ye[0]:o("div",{style:{display:"contents"}},...ye)}var Nc=["File","Edit","View","Insert","Format","Tools","Help"],Fi={File:[{label:"New",action:"new"},{label:"Open",action:"open"},{label:"Save",action:"save"},{label:"Print",action:"print"}],Edit:[{label:"Undo",action:"undo"},{label:"Redo",action:"redo"},{label:"Cut",action:"cut"},{label:"Copy",action:"copy"},{label:"Paste",action:"paste"}],View:[{label:"Zoom In",action:"zoomIn"},{label:"Zoom Out",action:"zoomOut"},{label:"Full Screen",action:"fullScreen"}],Insert:[{label:"Image",action:"insertImage"},{label:"Table",action:"insertTable"},{label:"Link",action:"insertLink"}],Format:[{label:"Bold",action:"bold"},{label:"Italic",action:"italic"},{label:"Underline",action:"underline"}],Tools:[{label:"Word Count",action:"wordCount"},{label:"Spell Check",action:"spellCheck"}],Help:[{label:"About",action:"about"},{label:"Keyboard Shortcuts",action:"shortcuts"}]},Wc=[{id:"bold",label:"Bold",text:"B",shortcut:"Ctrl+B",style:{fontWeight:"700"}},{id:"italic",label:"Italic",text:"I",shortcut:"Ctrl+I",style:{fontStyle:"italic"}},{id:"underline",label:"Underline",text:"U",shortcut:"Ctrl+U",style:{textDecoration:"underline"}}],_c=[{label:"Align left",text:"\u2261",command:"justifyLeft"},{label:"Align center",text:"\u2263",command:"justifyCenter"},{label:"Align right",text:"\u2262",command:"justifyRight"}],Oc=["1","2","3","4","5","6","7"],Hc={1:"8",2:"10",3:"12",4:"14",5:"18",6:"24",7:"36"};function Yc(){let e=[];for(let t=0;t<=20;t++){let n=t%2===0;e.push(o("div",{key:String(t),style:{position:"absolute",left:`${t/20*100}%`,bottom:"0",width:"1px",height:n?"10px":"5px",backgroundColor:"#999"}})),n&&e.push(o("span",{key:`l${t}`,style:{position:"absolute",left:`${t/20*100}%`,top:"1px",fontSize:"8px",color:"#666",transform:"translateX(-50%)"}},String(t/2)))}return e}function Ni(e){return e.trim().split(/\s+/).filter(t=>t.length>0).length}function on(e){let[t,n]=j(!1),[r,i]=j(!1),[s,a]=j(!1),[l,d]=j(-1),[u,h]=j(""),[p,c]=j(-1),[m,f]=j(0),[b,y]=j("3"),g=te(null),x=S(()=>{document.execCommand("bold",!1),n(U=>!U),g.current&&g.current.focus()},[]),v=S(()=>{document.execCommand("italic",!1),i(U=>!U),g.current&&g.current.focus()},[]),R=S(()=>{document.execCommand("underline",!1),a(U=>!U),g.current&&g.current.focus()},[]),D={bold:x,italic:v,underline:R},M={bold:t,italic:r,underline:s},$=S(U=>{document.execCommand(U,!1),g.current&&g.current.focus()},[]),A=S(U=>{document.execCommand("fontSize",!1,U),y(U),g.current&&g.current.focus()},[]),I=S(U=>{c(Z=>Z===U?-1:U)},[]),P=S(U=>{switch(U){case"undo":document.execCommand("undo",!1);break;case"redo":document.execCommand("redo",!1);break;case"cut":document.execCommand("cut",!1);break;case"copy":document.execCommand("copy",!1);break;case"paste":document.execCommand("paste",!1);break;case"bold":document.execCommand("bold",!1);break;case"italic":document.execCommand("italic",!1);break;case"underline":document.execCommand("underline",!1);break;case"print":typeof window<"u"&&window.print&&window.print();break;case"new":g.current&&(g.current.innerHTML="",f(0));break;default:break}c(-1),g.current&&g.current.focus()},[]),L=S(()=>{if(g.current){let U=g.current.textContent??"";f(Ni(U))}},[]),E=S(()=>{c(-1)},[]),B=q(()=>({width:"100%",height:"100%",minHeight:"500px",display:"flex",flexDirection:"column",fontFamily:'"Segoe UI", Roboto, Arial, sans-serif',fontSize:"13px",color:"var(--color-text, #333)",backgroundColor:"#f0f0f0",overflow:"hidden"}),[]),z={display:"flex",alignItems:"center",height:"30px",backgroundColor:"var(--color-bg-subtle, #ffffff)",borderBottom:"1px solid var(--color-border, #d0d0d0)",padding:"0 8px",gap:"2px",flexShrink:"0",position:"relative"},k={display:"flex",alignItems:"center",height:"36px",backgroundColor:"var(--color-bg-subtle, #f8f9fa)",borderBottom:"1px solid var(--color-border, #d0d0d0)",padding:"0 12px",gap:"12px",flexShrink:"0"},w={height:"20px",backgroundColor:"#e8e8e8",borderBottom:"1px solid #ccc",position:"relative",flexShrink:"0",margin:"0 60px"},T={flex:"1",display:"flex",justifyContent:"center",alignItems:"flex-start",padding:"30px 40px",overflow:"auto",backgroundColor:"#e0e0e0",cursor:"text"},C={width:"680px",minHeight:"880px",backgroundColor:"#ffffff",boxShadow:"0 2px 12px rgba(0,0,0,0.18), 0 0 1px rgba(0,0,0,0.1)",padding:"72px 72px 96px 72px",boxSizing:"border-box",fontSize:"14px",lineHeight:"1.6",color:"#222",fontFamily:'"Times New Roman", Georgia, serif',cursor:"text",outline:"none"},N={height:"24px",backgroundColor:"var(--color-bg-subtle, #f0f0f0)",borderTop:"1px solid var(--color-border, #ccc)",display:"flex",alignItems:"center",justifyContent:"space-between",padding:"0 16px",fontSize:"11px",color:"#666",flexShrink:"0"},F=q(()=>Yc(),[]),_=e.content??"Start typing...",H=Ni(_),W=m>0?m:H;function V(U){return{padding:"4px 10px",cursor:"pointer",borderRadius:"3px",fontSize:"13px",color:"var(--color-text, #333)",backgroundColor:p===U?"rgba(0,0,0,0.12)":l===U?"rgba(0,0,0,0.08)":"transparent",border:"none",lineHeight:"1",transition:"background 0.15s",position:"relative"}}let K={position:"absolute",top:"100%",left:"0",minWidth:"160px",backgroundColor:"#ffffff",border:"1px solid #d0d0d0",borderRadius:"4px",boxShadow:"0 4px 12px rgba(0,0,0,0.15)",padding:"4px 0",zIndex:"1000"},Q={display:"block",width:"100%",padding:"6px 16px",fontSize:"13px",color:"#333",backgroundColor:"transparent",border:"none",textAlign:"left",cursor:"pointer",transition:"background 0.1s"};function G(U,Z){return{width:"28px",height:"28px",display:"flex",alignItems:"center",justifyContent:"center",border:"1px solid transparent",borderRadius:"3px",cursor:"pointer",fontSize:"13px",backgroundColor:M[U]??!1?"rgba(0,0,0,0.12)":u===U?"rgba(0,0,0,0.06)":"transparent",color:"var(--color-text, #444)",transition:"background 0.15s",...Z??{}}}let O={display:"flex",alignItems:"center",padding:"2px 8px",border:"1px solid var(--color-border, #ccc)",borderRadius:"3px",fontSize:"12px",color:"var(--color-text, #444)",backgroundColor:"transparent",cursor:"default",height:"24px",gap:"4px"},Y={padding:"2px 4px",border:"1px solid var(--color-border, #ccc)",borderRadius:"3px",fontSize:"12px",color:"var(--color-text, #444)",backgroundColor:"transparent",cursor:"pointer",height:"24px",outline:"none"},X=Nc.map((U,Z)=>{let ee=[U];return p===Z&&Fi[U]&&ee.push(o("div",{key:"dropdown",style:K,className:"word-processor__menu-dropdown"},...Fi[U].map((ae,J)=>o("button",{key:String(J),style:Q,onClick:se=>{se.stopPropagation(),P(ae.action)},role:"menuitem"},ae.label)))),o("button",{key:String(Z),style:V(Z),role:"menuitem","aria-label":U,onClick:()=>I(Z),onMouseEnter:()=>{d(Z)},onMouseLeave:()=>d(-1)},...ee)});return o("div",{className:`word-processor ${e.className??""}`.trim(),style:B},o("div",{className:"word-processor__menu-bar",style:z,role:"menubar"},...X),o("div",{className:"word-processor__toolbar",style:k,role:"toolbar","aria-label":"Formatting toolbar"},o("div",{style:O,"aria-label":"Font family"},o("span",null,"Arial"),o("span",{style:{fontSize:"10px",color:"#999"}},"\u25BC")),o("div",{key:"0",style:{display:"flex",gap:"2px",borderLeft:"1px solid var(--color-border, #ccc)",paddingLeft:"10px"}},...Wc.map(U=>o("button",{key:U.id,style:G(U.id,U.style),title:U.shortcut?`${U.label} (${U.shortcut})`:U.label,"aria-label":U.label,"aria-pressed":String(M[U.id]??!1),onClick:D[U.id],onMouseEnter:()=>h(U.id),onMouseLeave:()=>h("")},U.text))),o("div",{key:"1",style:{display:"flex",gap:"2px",borderLeft:"1px solid var(--color-border, #ccc)",paddingLeft:"10px",alignItems:"center"}},o("select",{style:Y,"aria-label":"Font size",value:b,onChange:U=>{let Z=U.target;A(Z.value)}},...Oc.map(U=>o("option",{key:U,value:U},Hc[U])))),o("div",{key:"2",style:{display:"flex",gap:"2px",borderLeft:"1px solid var(--color-border, #ccc)",paddingLeft:"10px"}},..._c.map((U,Z)=>o("button",{key:String(Z),style:G(`align-${Z}`),title:U.label,"aria-label":U.label,onClick:()=>$(U.command),onMouseEnter:()=>h(`align-${Z}`),onMouseLeave:()=>h("")},U.text)))),o("div",{className:"word-processor__ruler",style:w,"aria-hidden":"true"},...F),o("main",{className:"word-processor__document-area",style:T,onClick:E},o("div",{className:"word-processor__page",style:C,contentEditable:"true",ref:g,onInput:L,suppressContentEditableWarning:!0},_)),o("div",{className:"word-processor__status-bar",style:N},o("span",null,"Page 1 of 1"),o("span",null,`${W} words`),o("span",null,"100%")))}function rn(e){let t=q(()=>({height:"30px",backgroundColor:"#323233",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"12px",color:"#999",flexShrink:"0",borderBottom:"1px solid var(--color-border, #252526)"}),[]),n=e.style?{...t,...e.style}:t;return o("div",{className:"ide__title-bar",style:n},e.title)}var Vc={height:"28px",backgroundColor:"#3c3c3c",display:"flex",alignItems:"center",padding:"0 8px",gap:"2px",flexShrink:"0",position:"relative"},Wi={padding:"3px 8px",fontSize:"12px",color:"#cccccc",cursor:"pointer",borderRadius:"3px",backgroundColor:"transparent",border:"none",position:"relative"},Uc={...Wi,backgroundColor:"rgba(255,255,255,0.1)"},jc={position:"absolute",top:"100%",left:"0",minWidth:"180px",backgroundColor:"#2d2d2d",border:"1px solid #454545",borderRadius:"4px",boxShadow:"0 4px 12px rgba(0,0,0,0.4)",padding:"4px 0",zIndex:"1000"},Gc={display:"block",width:"100%",padding:"6px 16px",fontSize:"12px",color:"#cccccc",backgroundColor:"transparent",border:"none",textAlign:"left",cursor:"pointer",transition:"background 0.1s"};function sn(e){let[t,n]=j(-1),r=S(a=>{n(l=>l===a?-1:a)},[]),i=S(a=>{e.onAction(a),n(-1)},[e.onAction]),s=e.menus.map((a,l)=>{let d=[a],u=t===l;return u&&e.menuItems[a]&&d.push(o("div",{key:"dropdown",style:jc,className:"ide__menu-dropdown"},...e.menuItems[a].map((h,p)=>o("button",{key:String(p),style:Gc,onClick:c=>{c.stopPropagation(),i(h.action)},role:"menuitem"},h.label)))),o("button",{key:String(l),style:u?Uc:Wi,role:"menuitem","aria-label":a,onClick:()=>r(l)},...d)});return o("div",{className:"ide__menu-bar",style:Vc,role:"menubar"},...s)}var Xc={width:"220px",backgroundColor:"#252526",borderRight:"none",display:"flex",flexDirection:"column",flexShrink:"0",overflowY:"auto"},Kc={padding:"8px 12px",fontSize:"11px",fontWeight:"600",textTransform:"uppercase",letterSpacing:"0.5px",color:"#bbbbbb"};function qc(e,t,n){return{padding:"3px 8px",paddingLeft:`${12+e*16}px`,fontSize:"13px",cursor:"pointer",color:t?"#cccccc":"#d4d4d4",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",borderRadius:"3px",margin:"0 4px",transition:"background-color 0.1s",backgroundColor:n?"rgba(255,255,255,0.08)":"transparent"}}function an(e){let t=i=>{if(!i.parent)return!0;if(!e.expandedFolders[i.parent])return!1;let s=e.files.find(a=>a.name===i.parent&&a.isFolder);return s?t(s):!0},r=e.files.map((i,s)=>{if(!t(i))return null;let a=!i.isFolder&&i.name===e.activeFile,l=i.isFolder?e.expandedFolders[i.name]?"\u{1F4C2} ":"\u{1F4C1} ":"\u{1F4C4} ";return o("div",{key:String(s),style:qc(i.indent,i.isFolder,a),onClick:i.isFolder?()=>e.onFolderToggle(i.name):()=>e.onFileClick(i.name)},l,i.name)}).filter(i=>i!==null);return o("nav",{className:"ide__sidebar",style:Xc,"aria-label":"File explorer"},o("div",{style:Kc},"Explorer"),...r)}var Zc={height:"35px",backgroundColor:"#252526",display:"flex",alignItems:"center",flexShrink:"0"},Jc={padding:"0 16px",height:"35px",lineHeight:"35px",backgroundColor:"#1e1e1e",color:"#ffffff",fontSize:"13px",cursor:"pointer",border:"none",borderBottom:"2px solid #007acc",boxSizing:"border-box"},Qc={padding:"0 16px",height:"35px",lineHeight:"35px",backgroundColor:"#2d2d2d",color:"#999999",fontSize:"13px",cursor:"pointer",border:"none",borderBottom:"2px solid transparent",boxSizing:"border-box"};function ln(e){let t=e.tabs.map((n,r)=>{let i=n===e.activeTab;return o("button",{key:String(r),style:i?Jc:Qc,"aria-label":n,onClick:()=>e.onTabClick(n)},n)});return o("div",{style:Zc},...t)}var cn="#569cd6",ro="#ce9178",io="#4ec9b0",so="#6a9955",ao="#dcdcaa",Lt="#d4d4d4",lo="#d4d4d4",co="#b5cea8",ed=new Set(["import","export","from","const","let","var","function","return","if","else","for","while","class","new","throw","try","catch","finally","typeof","instanceof","in","of","default","switch","case","break","continue","do","void","delete","yield","async","await"]),td=new Set(["string","number","boolean","void","null","undefined","any","never","unknown","object","interface","type","enum"]);function dn(e){if(!e.trim())return[{text:"\xA0",color:Lt}];let t=[],n=0;for(;n<e.length;){if(e[n]==="/"&&e[n+1]==="/"){t.push({text:e.slice(n),color:so});break}if(e[n]==='"'||e[n]==="'"||e[n]==="`"){let r=e[n],i=n+1;for(;i<e.length&&e[i]!==r;)e[i]==="\\"&&i++,i++;i=Math.min(i+1,e.length),t.push({text:e.slice(n,i),color:ro}),n=i;continue}if(/[0-9]/.test(e[n])&&(n===0||/[\s(,=:[\]{}+\-*/]/.test(e[n-1]))){let r=n;for(;r<e.length&&/[0-9.]/.test(e[r]);)r++;t.push({text:e.slice(n,r),color:co}),n=r;continue}if(/[a-zA-Z_$]/.test(e[n])){let r=n;for(;r<e.length&&/[a-zA-Z0-9_$]/.test(e[r]);)r++;let i=e.slice(n,r),s=r;for(;s<e.length&&e[s]===" ";)s++;let a=s<e.length&&e[s]==="(",l=Lt;ed.has(i)?l=cn:td.has(i)?l=io:a?l=ao:(i==="true"||i==="false")&&(l=cn),t.push({text:i,color:l}),n=r;continue}if(e[n]===" "||e[n]===" "){let r=n;for(;r<e.length&&(e[r]===" "||e[r]===" ");)r++;t.push({text:e.slice(n,r),color:Lt}),n=r;continue}t.push({text:e[n],color:lo}),n++}return t}var nd={flex:"1",display:"flex",overflow:"auto",backgroundColor:"#1e1e1e",fontFamily:'"Cascadia Code", "Fira Code", "Consolas", monospace',fontSize:"13px",lineHeight:"20px"},od={padding:"8px 0",textAlign:"right",color:"#858585",userSelect:"none",minWidth:"48px",paddingRight:"12px",paddingLeft:"12px",flexShrink:"0"},rd={padding:"8px 0",flex:"1",whiteSpace:"pre",overflowX:"auto",outline:"none",color:"#d4d4d4"};function un(e){let t=e.content.map((r,i)=>{let s=dn(r),a=[],l=0;for(let d of s)a.push(o("span",{key:String(l++),style:{color:d.color}},d.text));return o("div",{key:String(i),style:{minHeight:"20px"}},...a)}),n=[];for(let r=0;r<e.content.length;r++)n.push(o("div",{key:String(r)},String(r+1)));return o("div",{style:nd},o("div",{style:od,"aria-hidden":"true"},...n),o("code",{style:rd,contentEditable:"true",ref:e.editorRef,onInput:e.onInput,suppressContentEditableWarning:!0},...t))}var id={width:"60px",backgroundColor:"#1e1e1e",borderLeft:"1px solid var(--color-border, #252526)",flexShrink:"0",padding:"8px 4px",display:"flex",flexDirection:"column",gap:"2px",position:"relative"};function pn(e){return o("div",{className:"ide__minimap",style:id,"aria-hidden":"true"},o("div",{style:{position:"absolute",top:`${e.visibleStart}px`,left:"0",right:"0",height:`${e.visibleEnd}px`,backgroundColor:"rgba(100, 100, 200, 0.15)",border:"1px solid rgba(100, 100, 200, 0.3)",borderRadius:"2px",pointerEvents:"none"}}),...e.lines.map((t,n)=>o("div",{key:String(n),style:{height:"2px",backgroundColor:t.trim()?"#555555":"transparent",borderRadius:"1px",width:`${Math.min(100,t.length*2)}%`}})))}var sd={height:"22px",backgroundColor:"#007acc",display:"flex",alignItems:"center",justifyContent:"space-between",padding:"0 12px",fontSize:"12px",color:"#ffffff",flexShrink:"0"},ad={cursor:"pointer",padding:"0 6px",borderRadius:"3px",transition:"background-color 0.15s"};function uo(e){let t=n=>n.map((r,i)=>o("span",{key:String(i),style:ad,onClick:r.onClick},r.label));return o("div",{className:"ide__status-bar",style:sd},o("div",{style:{display:"flex",gap:"16px"}},...t(e.items)),o("div",{style:{display:"flex",gap:"16px"}},...t(e.rightItems)))}var ld=["File","Edit","Selection","View","Go","Run","Terminal","Help"],cd={File:[{label:"New File",action:"newFile"},{label:"Open",action:"open"},{label:"Save",action:"save"},{label:"Save As",action:"saveAs"}],Edit:[{label:"Undo",action:"undo"},{label:"Redo",action:"redo"},{label:"Cut",action:"cut"},{label:"Copy",action:"copy"},{label:"Paste",action:"paste"}],View:[{label:"Command Palette",action:"commandPalette"},{label:"Explorer",action:"explorer"},{label:"Search",action:"search"}]},dd=[{name:"src",indent:0,isFolder:!0},{name:"components",indent:1,isFolder:!0,parent:"src"},{name:"App.ts",indent:2,isFolder:!1,parent:"components"},{name:"Header.ts",indent:2,isFolder:!1,parent:"components"},{name:"hooks",indent:1,isFolder:!0,parent:"src"},{name:"useAuth.ts",indent:2,isFolder:!1,parent:"hooks"},{name:"index.ts",indent:1,isFolder:!1,parent:"src"},{name:"main.ts",indent:1,isFolder:!1,parent:"src"},{name:"types.ts",indent:1,isFolder:!1,parent:"src"},{name:"package.json",indent:0,isFolder:!1},{name:"tsconfig.json",indent:0,isFolder:!1}],po={"App.ts":['import { createElement, useState } from "specifyjs";',"","interface AppProps {"," title: string;"," version?: number;","}","","export function App(props: AppProps) {"," const [count, setCount] = useState(0);",""," const increment = () => {"," setCount((prev: number) => prev + 1);"," };",""," return createElement(",' "div",',' { className: "app" },',' createElement("h1", null, props.title),',' createElement("p", null, `Count: ${count}`),'," createElement(",' "button",'," { onClick: increment },",' "Increment",'," ),"," );","}"],"Header.ts":['import { createElement } from "specifyjs";',"","interface HeaderProps {"," title: string;"," subtitle?: string;","}","","export function Header(props: HeaderProps) {"," return createElement(",' "header",',' { className: "header" },',' createElement("h1", null, props.title),'," props.subtitle",' ? createElement("p", null, props.subtitle)'," : null,"," );","}"],"useAuth.ts":['import { useState, useCallback } from "specifyjs";',"","interface AuthState {"," user: string | null;"," isLoggedIn: boolean;","}","","export function useAuth() {"," const [auth, setAuth] = useState<AuthState>({"," user: null,"," isLoggedIn: false,"," });",""," const login = useCallback((username: string) => {"," setAuth({ user: username, isLoggedIn: true });"," }, []);",""," const logout = useCallback(() => {"," setAuth({ user: null, isLoggedIn: false });"," }, []);",""," return { ...auth, login, logout };","}"],"index.ts":['export { App } from "./components/App";','export { Header } from "./components/Header";','export { useAuth } from "./hooks/useAuth";'],"main.ts":['import { createElement, createRoot } from "specifyjs";','import { App } from "./components/App";',"","const root = createRoot(",' document.getElementById("root")!',");","","root.render("," createElement(App, {",' title: "My SpecifyJS App",'," version: 1,"," }),",");"],"types.ts":["export interface User {"," id: string;"," name: string;"," email: string;",' role: "admin" | "user" | "guest";',"}","","export interface Config {"," apiUrl: string;"," debug: boolean;"," maxRetries: number;","}","","export type EventHandler<T = void> = (event: T) => void;"],"package.json":["{",' "name": "specifyjs-app",',' "version": "1.0.0",',' "scripts": {',' "dev": "vite",',' "build": "tsc && vite build",',' "preview": "vite preview"'," }","}"],"tsconfig.json":["{",' "compilerOptions": {',' "target": "ES2020",',' "module": "ESNext",',' "strict": true,',' "jsx": "preserve"'," },",' "include": ["src"]',"}"]},_i=po["App.ts"];function fn(e){let[t,n]=j("App.ts"),[r,i]=j({src:!0,components:!0,hooks:!0}),[s,a]=j(_i.length),l=te(null),d=S(v=>{n(v);let R=po[v];R&&a(R.length)},[]),u=S(v=>{i(R=>{let D={},M=Object.keys(R);for(let $=0;$<M.length;$++)D[M[$]]=R[M[$]];return D[v]=!R[v],D})},[]),h=S(v=>{switch(v){case"undo":document.execCommand("undo",!1);break;case"redo":document.execCommand("redo",!1);break;case"cut":document.execCommand("cut",!1);break;case"copy":document.execCommand("copy",!1);break;case"paste":document.execCommand("paste",!1);break;case"newFile":l.current&&(l.current.textContent="",a(1));break;default:break}l.current&&l.current.focus()},[]),p=S(()=>{if(l.current){let R=(l.current.textContent??"").split(`
8
8
  `);a(Math.max(R.length,1))}},[]),c=q(()=>({width:"100%",height:"100%",minHeight:"500px",display:"flex",flexDirection:"column",fontFamily:'"Segoe UI", Roboto, Arial, sans-serif',fontSize:"13px",color:"#cccccc",backgroundColor:"#1e1e1e",overflow:"hidden"}),[]),m={flex:"1",display:"flex",overflow:"hidden"},f={width:"1px",backgroundColor:"#007acc",cursor:"col-resize",flexShrink:"0",opacity:"0.4",transition:"opacity 0.2s"},b={flex:"1",display:"flex",flexDirection:"column",overflow:"hidden"},y=8,g=30,x=po[t]??_i;return o("div",{className:`ide ${e.className??""}`.trim(),style:c},o(rn,{title:"SpecifyJS IDE"}),o(sn,{menus:ld,menuItems:cd,onAction:h}),o("div",{style:m},o(an,{files:dd,activeFile:t,expandedFolders:r,onFileClick:d,onFolderToggle:u}),o("div",{style:f}),o("div",{style:b},o(ln,{tabs:[t],activeTab:t,onTabClick:d}),o(un,{content:x,onInput:p,editorRef:l})),o(pn,{lines:x,visibleStart:y,visibleEnd:g,totalLines:x.length})),o(uo,{items:[{label:"\u2387 main"},{label:"0 errors"},{label:"0 warnings"}],rightItems:[{label:"Ln 1, Col 1"},{label:"UTF-8"},{label:"TypeScript"}]}))}var ud=[{symbol:"AAPL",price:189.42,change:1.23,volume:523e5,spark:[186,187,188,187,189]},{symbol:"GOOGL",price:141.8,change:-.87,volume:231e5,spark:[143,142,141,142,141]},{symbol:"MSFT",price:378.91,change:2.45,volume:187e5,spark:[375,376,378,377,379]},{symbol:"AMZN",price:185.63,change:-1.12,volume:314e5,spark:[187,186,186,185,185]},{symbol:"TSLA",price:248.5,change:3.78,volume:672e5,spark:[244,245,247,246,249]},{symbol:"NVDA",price:875.3,change:12.5,volume:418e5,spark:[860,865,870,868,876]}],Oi=[{price:189.4,qty:1200},{price:189.38,qty:3400},{price:189.35,qty:800},{price:189.32,qty:5600},{price:189.3,qty:2100},{price:189.28,qty:4300}],Hi=[{price:189.44,qty:900},{price:189.47,qty:2200},{price:189.5,qty:1500},{price:189.53,qty:3800},{price:189.55,qty:1100},{price:189.58,qty:2700}],Yi=[{symbol:"AAPL",qty:100,avgPrice:185.2,currentPrice:189.42,pnl:422},{symbol:"MSFT",qty:50,avgPrice:382.1,currentPrice:378.91,pnl:-159.5},{symbol:"NVDA",qty:25,avgPrice:850,currentPrice:875.3,pnl:632.5}],pd=[{time:"14:32:01",symbol:"AAPL",side:"BUY",qty:50,price:189.42},{time:"14:31:45",symbol:"MSFT",side:"SELL",qty:25,price:378.95},{time:"14:30:22",symbol:"TSLA",side:"BUY",qty:100,price:247.8},{time:"14:29:58",symbol:"NVDA",side:"BUY",qty:10,price:874.5},{time:"14:28:33",symbol:"GOOGL",side:"SELL",qty:75,price:142.1}],fd=[185.2,186.1,185.8,187.5,188.2,187.9,186.5,187.8,188.4,189.1,188.6,187.2,188.5,189.8,189.2,188.9,189.5,190.1,189.4,188.8,189.6,190.3,189.9,189.42],Vi=[{price:189.4,volume:1200},{price:189.35,volume:3400},{price:189.3,volume:2800},{price:189.25,volume:5100},{price:189.2,volume:4200}],Ui=[{price:189.45,volume:900},{price:189.5,volume:2600},{price:189.55,volume:1800},{price:189.6,volume:4400},{price:189.65,volume:3100}],ji=["09:30","10:00","10:30","11:00","11:30","12:00"];function md(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:String(e)}function Bt(e){return e.toString().replace(/\B(?=(\d{3})+(?!\d))/g,",")}function Ge(e){return e.toFixed(2)}var Ct={backgroundColor:"#1a1a2e",borderRadius:"4px",padding:"12px",border:"1px solid #2a2a4a",overflow:"auto",display:"flex",flexDirection:"column"},Mt={fontSize:"12px",fontWeight:"600",textTransform:"uppercase",letterSpacing:"0.5px",color:"#8888aa",marginBottom:"8px",flexShrink:"0"},mn={width:"100%",borderCollapse:"collapse",fontSize:"12px"},Oe={textAlign:"left",padding:"4px 6px",borderBottom:"1px solid #2a2a4a",color:"#8888aa",fontWeight:"600",fontSize:"11px"},He={padding:"3px 6px",borderBottom:"1px solid #16162a",color:"#ccccdd",fontSize:"12px"},gn={cursor:"default",transition:"background-color 0.1s"};function gd(e,t){let i=Math.min(...e),a=Math.max(...e)-i||1,l=e.map((u,h)=>{let p=h/(e.length-1)*40,c=14-(u-i)/a*14;return`${p.toFixed(1)},${c.toFixed(1)}`}).join(" ");return o("svg",{viewBox:"0 0 40 14",style:{width:"40px",height:"14px",display:"inline-block",verticalAlign:"middle",marginLeft:"4px"},"aria-hidden":"true"},o("polyline",{points:l,fill:"none",stroke:t?"#00c853":"#ff1744",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}))}function hd(e,t){let u=Math.min(...e),h=Math.max(...e),p=h-u||1,c=310/(e.length-1),m=e.map((M,$)=>{let A=40+$*c,I=15+(1-(M-u)/p)*120;return{x:A,y:I}}),f=m.map(M=>`${M.x.toFixed(1)},${M.y.toFixed(1)}`).join(" "),b="M40,135 "+m.map(M=>`L${M.x.toFixed(1)},${M.y.toFixed(1)}`).join(" ")+` L${m[m.length-1].x.toFixed(1)},135 Z`,y=[];for(let M=1;M<e.length;M++){let $=e[M]>=e[M-1]?"#00c853":"#ff1744";y.push(o("line",{key:String(M),x1:String(m[M-1].x.toFixed(1)),y1:String(m[M-1].y.toFixed(1)),x2:String(m[M].x.toFixed(1)),y2:String(m[M].y.toFixed(1)),stroke:$,strokeWidth:"2",strokeLinecap:"round"}))}let g=[];for(let M=0;M<5;M++){let $=15+M/4*120,A=h-M/4*p;g.push(o("line",{key:`g${M}`,x1:String(40),y1:String($.toFixed(1)),x2:String(350),y2:String($.toFixed(1)),stroke:"#2a2a4a",strokeWidth:"0.5",strokeDasharray:"3,3"})),g.push(o("text",{key:`yl${M}`,x:String(36),y:String(($+3).toFixed(1)),fill:"#6666aa",fontSize:"8",textAnchor:"end",fontFamily:"monospace"},Ge(A)))}let x=[],v=Math.min(ji.length,e.length),R=(e.length-1)/(v-1);for(let M=0;M<v;M++){let A=40+Math.round(M*R)*c;x.push(o("text",{key:`tl${M}`,x:String(A.toFixed(1)),y:String(156),fill:"#6666aa",fontSize:"8",textAnchor:"middle",fontFamily:"monospace"},ji[M]))}let D="chartGrad";return o("div",{style:Ct},o("div",{style:Mt},"AAPL ",o("span",{style:{color:"#00c853",fontSize:"14px",fontWeight:"700"}},`$${Ge(t)}`),o("span",{style:{color:"#00c853",fontSize:"11px",marginLeft:"8px"}},"+1.23%")),o("svg",{viewBox:"0 0 360 160",style:{width:"100%",flex:"1",minHeight:"0"},"aria-label":"Price chart",role:"img"},o("defs",null,o("linearGradient",{id:D,x1:"0",y1:"0",x2:"0",y2:"1"},o("stop",{offset:"0%",stopColor:"#00c853",stopOpacity:"0.3"}),o("stop",{offset:"100%",stopColor:"#00c853",stopOpacity:"0.02"}))),o("path",{d:b,fill:`url(#${D})`}),...g,...x,...y,o("line",{x1:String(40),y1:String((15+(1-(t-u)/p)*120).toFixed(1)),x2:String(350),y2:String((15+(1-(t-u)/p)*120).toFixed(1)),stroke:"#00c853",strokeWidth:"0.5",strokeDasharray:"4,2",opacity:"0.6"})))}function bd(){let e=Math.max(...Oi.map(t=>t.qty),...Hi.map(t=>t.qty));return o("div",{style:Ct},o("div",{style:Mt},"Order Book"),o("table",{style:mn},o("thead",null,o("tr",null,o("th",{style:Oe},"Bid Price"),o("th",{style:Oe},"Qty"),o("th",{style:Oe},"Ask Price"),o("th",{style:Oe},"Qty"))),o("tbody",null,...Oi.map((t,n)=>{let r=Hi[n],i=t.qty/e*.25,s=(r?.qty??0)/e*.25;return o("tr",{key:String(n),style:gn},o("td",{style:{...He,color:"#00c853",backgroundColor:`rgba(0,200,83,${i.toFixed(3)})`,fontFamily:"monospace"}},Ge(t.price)),o("td",{style:{...He,backgroundColor:`rgba(0,200,83,${(i*.5).toFixed(3)})`,fontFamily:"monospace"}},Bt(t.qty)),o("td",{style:{...He,color:"#ff1744",backgroundColor:`rgba(255,23,68,${s.toFixed(3)})`,fontFamily:"monospace"}},r?Ge(r.price):""),o("td",{style:{...He,backgroundColor:`rgba(255,23,68,${(s*.5).toFixed(3)})`,fontFamily:"monospace"}},r?Bt(r.qty):""))}))))}function xd(e){return o("div",{style:Ct},o("div",{style:Mt},"Watchlist"),o("table",{style:mn},o("thead",null,o("tr",null,o("th",{style:Oe},"Symbol"),o("th",{style:Oe},"Price"),o("th",{style:Oe},"Chg%"),o("th",{style:Oe},"Volume"))),o("tbody",null,...ud.map((t,n)=>{let r=t.price+(n===0?e:0),i=t.change>=0;return o("tr",{key:String(n),style:gn},o("td",{style:{...He,fontWeight:"600",color:"#ffffff"}},t.symbol,gd(t.spark,i)),o("td",{style:{...He,fontFamily:"monospace"}},Ge(r)),o("td",{style:{...He,color:i?"#00c853":"#ff1744",fontWeight:"600"}},`${i?"+":""}${Ge(t.change)}%`),o("td",{style:{...He,fontFamily:"monospace",color:"#8888aa"}},md(t.volume)))}))))}function yd(){let e=Yi.reduce((n,r)=>n+r.pnl,0),t=e>=0;return o("div",{style:Ct},o("div",{style:Mt},"Positions",o("span",{style:{marginLeft:"12px",color:t?"#00c853":"#ff1744",fontWeight:"700",fontSize:"12px"}},`${t?"+":""}$${Ge(e)}`)),o("table",{style:mn},o("thead",null,o("tr",null,o("th",{style:Oe},"Symbol"),o("th",{style:Oe},"Qty"),o("th",{style:Oe},"Avg"),o("th",{style:Oe},"P&L"))),o("tbody",null,...Yi.map((n,r)=>{let i=n.pnl>=0;return o("tr",{key:String(r),style:{...gn,backgroundColor:i?"rgba(0,200,83,0.04)":"rgba(255,23,68,0.04)"}},o("td",{style:{...He,fontWeight:"600",color:"#ffffff"}},n.symbol),o("td",{style:{...He,fontFamily:"monospace"}},String(n.qty)),o("td",{style:{...He,fontFamily:"monospace"}},Ge(n.avgPrice)),o("td",{style:{...He,color:i?"#00c853":"#ff1744",fontWeight:"700",fontFamily:"monospace"}},`${i?"+":""}$${Ge(n.pnl)}`))}))))}function Sd(){return o("div",{style:Ct},o("div",{style:Mt},"Recent Trades"),o("table",{style:mn},o("thead",null,o("tr",null,o("th",{style:Oe},"Time"),o("th",{style:Oe},"Sym"),o("th",{style:Oe},"Side"),o("th",{style:Oe},"Qty"),o("th",{style:Oe},"Price"))),o("tbody",null,...pd.map((e,t)=>{let n=e.side==="BUY";return o("tr",{key:String(t),style:gn},o("td",{style:{...He,color:"#8888aa",fontFamily:"monospace"}},e.time),o("td",{style:{...He,fontWeight:"600",color:"#ffffff"}},e.symbol),o("td",{style:{...He,color:n?"#00c853":"#ff1744",fontWeight:"600"}},e.side),o("td",{style:{...He,fontFamily:"monospace"}},Bt(e.qty)),o("td",{style:{...He,fontFamily:"monospace"}},Ge(e.price)))}))))}function vd(){let e=Math.max(...Vi.map(n=>n.volume),...Ui.map(n=>n.volume)),t="16px";return o("div",{style:Ct},o("div",{style:Mt},"Market Depth"),o("div",{style:{flex:"1",display:"flex",flexDirection:"column",gap:"2px",justifyContent:"center"}},...Vi.map((n,r)=>o("div",{key:`b${r}`,style:{display:"flex",alignItems:"center",gap:"6px"}},o("span",{style:{width:"52px",fontSize:"11px",color:"#8888aa",textAlign:"right",fontFamily:"monospace"}},Ge(n.price)),o("div",{style:{height:t,width:`${n.volume/e*100}%`,backgroundColor:"#00c853",opacity:"0.6",borderRadius:"2px",maxWidth:"60%",transition:"width 0.3s"}}),o("span",{style:{fontSize:"11px",color:"#ccccdd",fontFamily:"monospace"}},Bt(n.volume)))),o("div",{style:{height:"1px",backgroundColor:"#2a2a4a",margin:"4px 0"}}),...Ui.map((n,r)=>o("div",{key:`a${r}`,style:{display:"flex",alignItems:"center",gap:"6px"}},o("span",{style:{width:"52px",fontSize:"11px",color:"#8888aa",textAlign:"right",fontFamily:"monospace"}},Ge(n.price)),o("div",{style:{height:t,width:`${n.volume/e*100}%`,backgroundColor:"#ff1744",opacity:"0.6",borderRadius:"2px",maxWidth:"60%",transition:"width 0.3s"}}),o("span",{style:{fontSize:"11px",color:"#ccccdd",fontFamily:"monospace"}},Bt(n.volume))))))}function hn(e){let[t,n]=j(0),[r,i]=j("--:--:--"),[s,a]=j(!0);re(()=>{let m=setInterval(()=>{n(f=>{let b=(Math.random()-.5)*.5;return Math.round(b*100)/100})},2e3);return()=>clearInterval(m)},[]),re(()=>{let m=()=>{let b=new Date,y=String(b.getHours()).padStart(2,"0"),g=String(b.getMinutes()).padStart(2,"0"),x=String(b.getSeconds()).padStart(2,"0");i(`${y}:${g}:${x}`)};m();let f=setInterval(m,1e3);return()=>clearInterval(f)},[]),re(()=>{let m=setInterval(()=>{a(f=>!f)},800);return()=>clearInterval(m)},[]);let l=q(()=>({width:"100%",height:"100%",minHeight:"500px",display:"flex",flexDirection:"column",fontFamily:'"Inter", "Segoe UI", Roboto, sans-serif',fontSize:"13px",color:"#ccccdd",backgroundColor:"#0d0d1a",overflow:"hidden"}),[]),d={height:"40px",backgroundColor:"#12122a",borderBottom:"1px solid #2a2a4a",display:"flex",alignItems:"center",justifyContent:"space-between",padding:"0 16px",flexShrink:"0"},u={fontSize:"14px",fontWeight:"700",color:"#ffffff",letterSpacing:"0.5px",display:"flex",alignItems:"center",gap:"8px"},h={flex:"1",display:"grid",gridTemplateColumns:"1fr 1fr 1fr",gridTemplateRows:"1fr 1fr",gap:"8px",padding:"8px",overflow:"hidden"},p=189.42+t,c={width:"8px",height:"8px",borderRadius:"50%",backgroundColor:"#00c853",display:"inline-block",marginRight:"4px",opacity:s?"1":"0.3",transition:"opacity 0.3s"};return o("div",{className:`trading-dashboard ${e.className??""}`.trim(),style:l},o("header",{className:"trading-dashboard__header",style:d},o("span",{style:u},"SpecifyJS Trading Platform",o("span",{style:{display:"flex",alignItems:"center",fontSize:"11px",color:"#00c853",fontWeight:"600",marginLeft:"8px"}},o("span",{style:c}),"LIVE")),o("div",{style:{display:"flex",alignItems:"center",gap:"16px",fontSize:"12px"}},o("span",{style:{color:"#ffffff",fontFamily:"monospace",fontWeight:"600",fontSize:"13px"}},r),o("span",{style:{color:"#8888aa"}},"Account: SJS-28401"),o("span",{style:{color:"#00c853"}},"Balance: $124,582.30"),o("span",{style:{color:"#8888aa"}},"Status: Connected"))),o("div",{className:"trading-dashboard__grid",style:h},hd(fd,p),bd(),xd(t),yd(),Sd(),vd()))}function Be(e){return e.type==="card"}function $e(e){return e.type==="container"}function qe(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{let t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)})}function Xe(e){return Be(e)?e.card_id:e.container_id}function fo(e){return Be(e)?e.card_title:e.name}var mo={low:"#22c55e",medium:"#f59e0b",high:"#f97316",critical:"#ef4444"},Ft=[{label:"Text",value:"text"},{label:"JSON",value:"json"},{label:"Task",value:"task"},{label:"Project",value:"project"}];function wd(e){let t=e.content;return o("div",{style:{fontSize:"12px",color:"#555555",lineHeight:"1.4",overflow:"hidden",flex:"1"},"data-testid":`card-text-content-${e.card_id}`},t.text||"")}function kd(e){let t=e.content,r=Object.entries(t).map(([i,s],a)=>o("div",{key:String(a),style:{display:"flex",gap:"4px",fontSize:"11px",lineHeight:"1.6",borderBottom:"1px solid rgba(0,0,0,0.05)",padding:"2px 0"}},o("span",{style:{fontWeight:"600",color:"#374151",minWidth:"60px"}},`${i}:`),o("span",{style:{color:"#555555"}},String(s??""))));return o("div",{style:{flex:"1",overflow:"auto"},"data-testid":`card-json-content-${e.card_id}`},...r)}function Cd(e){return o("div",{style:{fontSize:"12px",color:"#9ca3af",fontStyle:"italic",flex:"1",display:"flex",alignItems:"center",justifyContent:"center"},"data-testid":`card-task-content-${e.card_id}`},"Task card (coming soon)")}function Md(e,t){let n=e.content;return o("div",{style:{display:"inline-flex",alignItems:"center",justifyContent:"center",padding:"4px 16px",borderRadius:"999px",backgroundColor:e.color||"#e0e7ff",fontSize:"13px",fontWeight:"600",color:"#1e3a5f",cursor:"pointer",flex:"1"},onDblClick:r=>{r.preventDefault(),r.stopPropagation(),t&&n.project_id&&t(n.project_id)},"data-testid":`card-project-content-${e.card_id}`},n.project_name||"Untitled Project")}function bn(e){let{card:t,selected:n=!1,onSelect:r,onMove:i,onResize:s,onDelete:a,dispatch:l,onOpenProject:d,onCardContextMenu:u,onUpdate:h,onDragStart:p,onDragEnd:c,onAnchorDragStart:m}=e,[f,b]=j(!1),[y,g]=j(!1),[x,v]=j(null),[R,D]=j(!1),[M,$]=j(!1),[A,I]=j(!1),[P,L]=j(t.card_title||""),[E,B]=j(""),z=te(null),k=te(null),w=t.priority?mo[t.priority]||"#94a3b8":"transparent",T=S(de=>{let be=de;be.preventDefault(),be.stopPropagation(),v({x:be.clientX,y:be.clientY}),D(!1),u&&u(t.card_id,{x:be.clientX,y:be.clientY})},[u,t.card_id]),C=S(()=>{v(null),D(!1)},[]),N=S(de=>{let be=de,ke=be.target;if(ke.dataset&&(ke.dataset.role==="delete"||ke.dataset.role==="resize"||ke.dataset.role==="drag-handle"||ke.dataset.role==="inline-edit"||ke.dataset.role==="anchor"))return;be.preventDefault(),be.stopPropagation(),r&&r(t.card_id),z.current={x:be.clientX,y:be.clientY,cardX:t.position.x,cardY:t.position.y},p&&p(t.card_id),g(!0);let Re=oe=>{let fe=oe;if(!z.current)return;let Se=fe.clientX-z.current.x,we=fe.clientY-z.current.y;i&&i(t.card_id,{x:z.current.cardX+Se,y:z.current.cardY+we})},Le=()=>{z.current=null,g(!1),c&&c(t.card_id),document.removeEventListener("mousemove",Re),document.removeEventListener("mouseup",Le)};document.addEventListener("mousemove",Re),document.addEventListener("mouseup",Le)},[t.card_id,t.position.x,t.position.y,r,i,p,c]),F=S(de=>{let be=de;be.preventDefault(),be.stopPropagation(),k.current={x:be.clientX,y:be.clientY,w:t.size.width,h:t.size.height};let ke=Le=>{let oe=Le;if(!k.current)return;let fe=oe.clientX-k.current.x,Se=oe.clientY-k.current.y,we=Math.max(120,k.current.w+fe),Ie=Math.max(80,k.current.h+Se);s&&s(t.card_id,{width:we,height:Ie})},Re=()=>{k.current=null,document.removeEventListener("mousemove",ke),document.removeEventListener("mouseup",Re)};document.addEventListener("mousemove",ke),document.addEventListener("mouseup",Re)},[t.card_id,t.size.width,t.size.height,s]),_=S(de=>{de.preventDefault(),de.stopPropagation(),a&&a(t.card_id)},[t.card_id,a]),H=S(de=>{let be=de;be.preventDefault(),be.stopPropagation();let Re=be.target.dataset.anchor;if(!Re||!m)return;let Le=t.position.x,oe=t.position.y,fe=t.size.width,Se=t.size.height,we=Le+fe/2,Ie=oe+Se/2;Re==="top"?(we=Le+fe/2,Ie=oe):Re==="right"?(we=Le+fe,Ie=oe+Se/2):Re==="bottom"?(we=Le+fe/2,Ie=oe+Se):Re==="left"&&(we=Le,Ie=oe+Se/2),m(t.card_id,Re,{x:we,y:Ie})},[t.card_id,t.position.x,t.position.y,t.size.width,t.size.height,m]),W=S(de=>{l&&l({type:"CHANGE_CARD_TYPE",cardId:t.card_id,newType:de}),C()},[t.card_id,l,C]),V=S(de=>{de.preventDefault(),de.stopPropagation(),L(t.card_title||""),$(!0)},[t.card_title]),K=S(()=>{$(!1),h&&P!==t.card_title&&h(t.card_id,{card_title:P})},[h,t.card_id,t.card_title,P]),Q=S(de=>{let be=de;be.key==="Enter"?(be.preventDefault(),K()):be.key==="Escape"&&(be.preventDefault(),$(!1),L(t.card_title||""))},[K,t.card_title]),G=S(de=>{let be=de.target;L(be.value)},[]),O=S(de=>{de.stopPropagation();let be=t.content;B(be.text||""),I(!0)},[t.content]),Y=S(()=>{I(!1),h&&h(t.card_id,{content:{text:E}})},[h,t.card_id,E]),X=S(de=>{let be=de;if(be.key==="Escape"){be.preventDefault(),I(!1);let ke=t.content;B(ke.text||"")}},[t.content]),U=S(de=>{let be=de.target;B(be.value)},[]),Z;switch(t.card_type){case"text":A?Z=o("textarea",{"data-role":"inline-edit","data-testid":`card-desc-edit-${t.card_id}`,value:E,onInput:U,onBlur:Y,onKeyDown:X,onFocus:de=>{let be=de.target;be.setSelectionRange(be.value.length,be.value.length)},style:{fontSize:"12px",color:"#555555",lineHeight:"1.4",flex:"1",border:"1px solid #3b82f6",borderRadius:"3px",padding:"2px 4px",resize:"none",outline:"none",fontFamily:"inherit",backgroundColor:"#fff",width:"100%",boxSizing:"border-box"}}):Z=o("div",{style:{fontSize:"12px",color:"#555555",lineHeight:"1.4",overflow:"hidden",flex:"1",cursor:"text"},"data-testid":`card-text-content-${t.card_id}`,onClick:O},t.content.text||"");break;case"json":Z=kd(t);break;case"task":Z=Cd(t);break;case"project":Z=Md(t,d);break;default:Z=wd(t)}let ee=t.card_type==="project",ae={position:"absolute",left:`${t.position.x}px`,top:`${t.position.y}px`,width:`${t.size.width}px`,height:`${t.size.height}px`,backgroundColor:t.color||"#fef9c3",borderRadius:ee?"999px":"6px",borderLeft:`4px solid ${w}`,boxShadow:n?"0 0 0 2px #3b82f6, 0 4px 12px rgba(0,0,0,0.15)":"0 2px 8px rgba(0,0,0,0.1)",cursor:"grab",userSelect:"none",overflow:"hidden",display:"flex",flexDirection:"column",padding:"8px 10px",boxSizing:"border-box",transition:"box-shadow 150ms ease",zIndex:y?"9999":"1"},J={fontWeight:"600",fontSize:"14px",color:"#1a1a1a",marginBottom:"4px",lineHeight:"1.3",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},se={position:"absolute",top:"4px",right:"4px",width:"18px",height:"18px",borderRadius:"50%",backgroundColor:"rgba(0,0,0,0.15)",color:"#333",fontSize:"12px",lineHeight:"18px",textAlign:"center",cursor:"pointer",display:f?"block":"none",border:"none",padding:"0"},ce={position:"absolute",bottom:"0",right:"0",width:"12px",height:"12px",cursor:"nwse-resize",opacity:"0.4",background:"linear-gradient(135deg, transparent 50%, #666 50%)"},me={position:"absolute",top:"4px",right:"24px",width:"18px",height:"18px",borderRadius:"3px",backgroundColor:"rgba(0,0,0,0.1)",color:"#333",fontSize:"10px",lineHeight:"18px",textAlign:"center",cursor:"grab",display:f?"block":"none",border:"none",padding:"0"},ge=8,ye={position:"absolute",width:`${ge}px`,height:`${ge}px`,borderRadius:"50%",backgroundColor:"#3b82f6",border:"2px solid #fff",boxSizing:"border-box",cursor:"crosshair",display:f?"block":"none",zIndex:"10"},ne=[{anchor:"top",style:{...ye,top:`${-ge/2}px`,left:"50%",marginLeft:`${-ge/2}px`}},{anchor:"right",style:{...ye,top:"50%",right:`${-ge/2}px`,marginTop:`${-ge/2}px`}},{anchor:"bottom",style:{...ye,bottom:`${-ge/2}px`,left:"50%",marginLeft:`${-ge/2}px`}},{anchor:"left",style:{...ye,top:"50%",left:`${-ge/2}px`,marginTop:`${-ge/2}px`}}].map((de,be)=>o("div",{key:`anchor-${de.anchor}`,style:de.style,"data-role":"anchor","data-anchor":de.anchor,"data-testid":`card-anchor-${de.anchor}-${t.card_id}`,onMouseDown:H})),pe=t.assignee?o("div",{style:{display:"flex",alignItems:"center",gap:"4px",marginTop:"4px",fontSize:"10px",color:"#555"},"data-testid":`card-assignee-${t.card_id}`},o("span",{style:{width:"16px",height:"16px",borderRadius:"50%",backgroundColor:"#3b82f6",color:"#fff",fontSize:"9px",fontWeight:"700",display:"inline-flex",alignItems:"center",justifyContent:"center",flexShrink:"0"}},t.assignee.charAt(0).toUpperCase()),o("span",{},t.assignee)):null,ie=t.tags&&t.tags.length>0?o("div",{style:{display:"flex",gap:"4px",flexWrap:"wrap",marginTop:"4px"}},...t.tags.map((de,be)=>o("span",{key:String(be),style:{fontSize:"10px",padding:"1px 4px",borderRadius:"3px",backgroundColor:"rgba(0,0,0,0.08)",color:"#444"}},de))):null,he={padding:"6px 12px",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"space-between",whiteSpace:"nowrap"},xe={position:"absolute",left:"100%",top:"0",backgroundColor:"#ffffff",border:"1px solid #d1d5db",borderRadius:"6px",boxShadow:"0 4px 16px rgba(0,0,0,0.15)",padding:"4px 0",minWidth:"120px"},Ce=x?o("div",{className:"card-context-menu",style:{position:"fixed",left:`${x.x}px`,top:`${x.y}px`,backgroundColor:"#ffffff",border:"1px solid #d1d5db",borderRadius:"6px",boxShadow:"0 4px 16px rgba(0,0,0,0.15)",padding:"4px 0",zIndex:"10000",minWidth:"160px",fontSize:"13px",color:"#1a1a1a"},"data-testid":`card-context-menu-${t.card_id}`,role:"menu","aria-label":"Card context menu",onClick:de=>de.stopPropagation()},o("div",{style:he,onClick:de=>{de.stopPropagation(),a&&a(t.card_id),C()},role:"menuitem","data-testid":`ctx-delete-${t.card_id}`},"Delete"),o("div",{style:{...he,position:"relative"},onMouseEnter:()=>D(!0),role:"menuitem","aria-haspopup":"true","data-testid":`ctx-change-type-${t.card_id}`},"Change Type",o("span",{style:{marginLeft:"8px"}},"\u25B6"),R?o("div",{style:xe,role:"menu","data-testid":`ctx-type-submenu-${t.card_id}`},...Ft.map(de=>o("div",{key:de.value,style:{...he,fontWeight:t.card_type===de.value?"700":"400"},onClick:be=>{be.stopPropagation(),W(de.value)},role:"menuitem","data-testid":`ctx-type-${de.value}-${t.card_id}`},de.label,t.card_type===de.value?" \u2713":""))):null)):null;return ee?o("div",{className:"board-card board-card--project",style:ae,onMouseDown:N,onContextMenu:T,onMouseEnter:()=>b(!0),onMouseLeave:()=>{b(!1),C()},"data-card-id":t.card_id,"data-testid":`card-${t.card_id}`,role:"button","aria-label":`Project card: ${t.card_title}`,tabIndex:0},Z,o("div",{style:me,"data-role":"drag-handle","data-testid":`card-drag-handle-${t.card_id}`,"aria-label":"Export drag handle",title:"Drag to export card"},"\u2630"),...ne,Ce):o("div",{className:"board-card",style:ae,onMouseDown:N,onContextMenu:T,onMouseEnter:()=>b(!0),onMouseLeave:()=>{b(!1),C()},"data-card-id":t.card_id,"data-testid":`card-${t.card_id}`,role:"button","aria-label":`Card: ${t.card_title}`,tabIndex:0},M?o("input",{"data-role":"inline-edit","data-testid":`card-title-edit-${t.card_id}`,value:P,onInput:G,onBlur:K,onKeyDown:Q,onFocus:de=>{let be=de.target;be.setSelectionRange(be.value.length,be.value.length)},style:{...J,border:"1px solid #3b82f6",borderRadius:"3px",padding:"1px 4px",outline:"none",width:"100%",boxSizing:"border-box",backgroundColor:"#fff"}}):o("div",{style:J,"data-testid":`card-title-${t.card_id}`,onDblClick:V},t.card_title||"Untitled"),Z,ie,pe,o("div",{style:me,"data-role":"drag-handle","data-testid":`card-drag-handle-${t.card_id}`,"aria-label":`Export drag handle for ${t.card_title}`,title:"Drag to export card"},"\u2630"),o("button",{style:se,"data-role":"delete","data-testid":`card-delete-${t.card_id}`,onClick:_,"aria-label":`Delete ${t.card_title}`,tabIndex:-1},"\xD7"),o("div",{style:ce,"data-role":"resize",onMouseDown:F,"aria-label":"Resize card"}),...ne,Ce)}function xn(e){let{container:t,selected:n=!1,highlighted:r=!1,onSelect:i,onMove:s,onResize:a,onDelete:l,onDrop:d,onDragStart:u,onDragEnd:h,onContainerContextMenu:p,children:c}=e,[m,f]=j(!1),[b,y]=j(!1),[g,x]=j(!1),v=te(null),R=te(null),D=S(C=>{C.stopPropagation(),l&&l(t.container_id)},[t.container_id,l]),M=S(C=>{C.stopPropagation(),y(N=>!N)},[]),$=S(C=>{let N=C;N.preventDefault(),N.stopPropagation(),p&&p(t.container_id,{x:N.clientX,y:N.clientY})},[t.container_id,p]),A=S(C=>{let N=C;N.preventDefault(),N.stopPropagation(),i&&i(t.container_id),u&&u(t.container_id),x(!0),v.current={x:N.clientX,y:N.clientY,posX:t.position.x,posY:t.position.y};let F=H=>{let W=H;if(!v.current)return;let V=W.clientX-v.current.x,K=W.clientY-v.current.y;s&&s(t.container_id,{x:v.current.posX+V,y:v.current.posY+K})},_=()=>{v.current=null,x(!1),h&&h(t.container_id),document.removeEventListener("mousemove",F),document.removeEventListener("mouseup",_)};document.addEventListener("mousemove",F),document.addEventListener("mouseup",_)},[t.container_id,t.position.x,t.position.y,i,s,u,h]),I=S(C=>{let N=C;N.preventDefault(),N.stopPropagation(),R.current={x:N.clientX,y:N.clientY,w:t.size.width,h:t.size.height};let F=H=>{let W=H;if(!R.current)return;let V=W.clientX-R.current.x,K=W.clientY-R.current.y,Q=Math.max(160,R.current.w+V),G=Math.max(120,R.current.h+K);a&&a(t.container_id,{width:Q,height:G})},_=()=>{R.current=null,document.removeEventListener("mousemove",F),document.removeEventListener("mouseup",_)};document.addEventListener("mousemove",F),document.addEventListener("mouseup",_)},[t.container_id,t.size.width,t.size.height,a]),P=S(C=>{C.preventDefault(),f(!0)},[]),L=S(()=>{f(!1)},[]),E=S(C=>{let N=C;if(N.preventDefault(),f(!1),d&&N.dataTransfer){let F=N.dataTransfer.getData("text/plain");F&&d(F,t.container_id)}},[t.container_id,d]),B=r||m,z={position:"absolute",left:`${t.position.x}px`,top:`${t.position.y}px`,width:`${t.size.width}px`,height:`${t.size.height}px`,backgroundColor:r?"#eff6ff":"#ffffff",border:r?"2px dashed #3b82f6":n?"2px solid #3b82f6":"2px solid #d1d5db",borderRadius:"8px",boxShadow:B?"0 0 0 3px rgba(59,130,246,0.3), 0 4px 16px rgba(0,0,0,0.1)":"0 2px 8px rgba(0,0,0,0.08)",display:"flex",flexDirection:"column",overflow:"hidden",zIndex:g?"9999":"0",boxSizing:"border-box",transition:"border 150ms ease, background-color 150ms ease, box-shadow 150ms ease"},k={padding:"6px 12px",borderBottom:"1px solid #e5e7eb",backgroundColor:"#f9fafb",cursor:"grab",userSelect:"none",textAlign:"center",fontWeight:"700",fontSize:"15px",color:"#1f2937",flexShrink:"0"},w={flex:"1",overflow:"auto",position:"relative",padding:"4px"},T={position:"absolute",bottom:"0",right:"0",width:"14px",height:"14px",cursor:"nwse-resize",opacity:"0.4",background:"linear-gradient(135deg, transparent 50%, #666 50%)"};return o("div",{className:"board-container",style:z,"data-container-id":t.container_id,"data-testid":`container-${t.container_id}`,role:"group","aria-label":`Container: ${t.name}`,onDragOver:P,onDragLeave:L,onDrop:E,onContextMenu:$},o("div",{className:"board-container__title",style:{...k,display:"flex",alignItems:"center",justifyContent:"space-between"},onMouseDown:A,"data-testid":`container-title-${t.container_id}`},o("span",null,t.name),o("span",{style:{display:"flex",gap:"4px"}},o("button",{style:{border:"none",backgroundColor:"transparent",cursor:"pointer",color:"#94a3b8",fontSize:"12px",padding:"0 2px",lineHeight:"1"},onClick:M,"aria-label":b?"Expand container":"Minimize container",title:b?"Expand":"Minimize"},b?"\u25B2":"\u2014"),o("button",{style:{border:"none",backgroundColor:"transparent",cursor:"pointer",color:"#94a3b8",fontSize:"14px",padding:"0 2px",lineHeight:"1"},onClick:D,"aria-label":"Delete container",title:"Delete"},"\xD7"))),b?null:o("div",{className:"board-container__contents",style:w,"data-testid":`container-contents-${t.container_id}`},c),b?null:o("div",{style:T,"data-role":"resize",onMouseDown:I,"aria-label":"Resize container"}))}function Gi(e){let t=e.position.x+e.size.width/2,n=e.position.y+e.size.height/2;return{top:{x:t,y:e.position.y},right:{x:e.position.x+e.size.width,y:n},bottom:{x:t,y:e.position.y+e.size.height},left:{x:e.position.x,y:n}}}function Ed(e,t){let n=Gi(e),r=Gi(t),i=[n.top,n.right,n.bottom,n.left],s=[r.top,r.right,r.bottom,r.left],a=1/0,l=n.right,d=r.left;for(let u=0;u<i.length;u++)for(let h=0;h<s.length;h++){let p=s[h].x-i[u].x,c=s[h].y-i[u].y,m=p*p+c*c;m<a&&(a=m,l=i[u],d=s[h])}return{from:l,to:d}}var Xi="board-card-link-arrowhead";function yn(e){let{links:t,cards:n,selectedLinkId:r,onSelectLink:i,onLinkContextMenu:s,canvasWidth:a,canvasHeight:l}=e,d=new Map;for(let m=0;m<n.length;m++)d.set(n[m].card_id,n[m]);let u=S(m=>{i(m)},[i]),h=[];for(let m=0;m<t.length;m++){let{source:f,link:b}=t[m],y=d.get(b.target_card_id);if(!y)continue;let{from:g,to:x}=Ed(f,y),v=b.link_id===r,R=v?"#3b82f6":b.color||"#94a3b8",D=x.x-g.x,M=x.y-g.y,$=Math.sqrt(D*D+M*M),A=Math.min(40,$*.15),I=$>0?-M/$:0,P=$>0?D/$:0,L=(g.x+x.x)/2,E=(g.y+x.y)/2,B=L+I*A,z=E+P*A,k=`M ${g.x} ${g.y} Q ${B} ${z} ${x.x} ${x.y}`,w=f.card_id;h.push(o("path",{key:`hit-${b.link_id}`,d:k,fill:"none",stroke:"transparent","stroke-width":"12",style:{cursor:"pointer",pointerEvents:"stroke"},onClick:()=>u(b.link_id),onContextMenu:T=>{let C=T;C.preventDefault(),C.stopPropagation(),s&&s(b.link_id,w,{x:C.clientX,y:C.clientY})},"data-testid":`link-hit-${b.link_id}`})),h.push(o("path",{key:b.link_id,d:k,fill:"none",stroke:R,"stroke-width":v?"3":"2","pointer-events":"none","marker-end":`url(#${Xi})`,"data-testid":`link-${b.link_id}`})),b.link_name&&h.push(o("text",{key:`label-${b.link_id}`,x:String(B),y:String(z-6),"text-anchor":"middle",fill:"#64748b","font-size":"11","pointer-events":"none","data-testid":`link-label-${b.link_id}`},b.link_name))}let p={position:"absolute",top:"0",left:"0",width:"100%",height:"100%",pointerEvents:"none",overflow:"visible",zIndex:"9999"},c=o("defs",{},o("marker",{id:Xi,viewBox:"0 0 10 10",refX:"10",refY:"5",markerWidth:"8",markerHeight:"8",orient:"auto-start-reverse"},o("path",{d:"M 0 0 L 10 5 L 0 10 z",fill:"#94a3b8"})));return o("svg",{style:p,width:String(a),height:String(l),className:"card-link-overlay","data-testid":"card-link-overlay",role:"img","aria-label":"Card links"},c,o("g",{style:{pointerEvents:"auto"}},...h))}var Id=[{value:"#fef9c3",label:"Yellow"},{value:"#fecaca",label:"Red"},{value:"#fed7aa",label:"Orange"},{value:"#bbf7d0",label:"Green"},{value:"#bfdbfe",label:"Blue"},{value:"#ddd6fe",label:"Purple"},{value:"#fbcfe8",label:"Pink"},{value:"#e5e7eb",label:"Gray"}],go=20,Et=5e3;function Rd(e,t){let n=new Set,r=[...e],i=null;for(;r.length>0;){let a=r.pop();if($e(a)&&a.container_id===t){i=a;break}if($e(a))for(let l=0;l<a.contents.length;l++)r.push(a.contents[l])}if(!i||!$e(i))return n;let s=[...i.contents];for(;s.length>0;){let a=s.pop();if($e(a)){n.add(a.container_id);for(let l=0;l<a.contents.length;l++)s.push(a.contents[l])}}return n}function Pd(e,t,n,r){let i=new Set;if(r){i.add(r);let d=Rd(e,r);for(let u of d)i.add(u)}let s=null,a=-1,l=[[e,0,0,0]];for(;l.length>0;){let[d,u,h,p]=l.pop();for(let c=0;c<d.length;c++){let m=d[c];if(!$e(m)||i.has(m.container_id))continue;let f=m.position.x+u,b=m.position.y+h;t>=f&&t<=f+m.size.width&&n>=b&&n<=b+m.size.height&&(p>a&&(s=m.container_id,a=p),m.contents.length>0&&l.push([m.contents,f,b+30,p+1]))}}return s}function qi(e,t){return{x:Math.round(e.x/t)*t,y:Math.round(e.y/t)*t}}function Ki(e,t){let n=[[e,null]];for(;n.length>0;){let[r,i]=n.pop();for(let s=0;s<r.length;s++){let a=r[s];if(Xe(a)===t)return i;$e(a)&&n.push([a.contents,a.container_id])}}return null}function Zi(e,t,n){return{x:(e-n.panX)/n.zoom,y:(t-n.panY)/n.zoom}}function Td(e){let t=[],n=[],r=[];for(let i=e.length-1;i>=0;i--)r.push([e[i],0,0]);for(;r.length>0;){let[i,s,a]=r.pop();if(Be(i)){let l={...i,position:{x:i.position.x+s,y:i.position.y+a}};t.push(l);for(let d=0;d<i.card_link.length;d++)n.push({source:l,link:i.card_link[d]})}else if($e(i)){let l=s+i.position.x,d=a+i.position.y+30;for(let u=i.contents.length-1;u>=0;u--)r.push([i.contents[u],l,d])}}return{cards:t,links:n}}function Nt(e){let{state:t,dispatch:n,selectedId:r=null,onSelectItem:i,gridEnabled:s=!1,searchQuery:a="",colorFilter:l=null,onOpenProject:d,onCardContextMenu:u,onUpdateItem:h}=e,{collection:p,viewport:c}=t,m=te(null),f=te(!1),b=te(null),[y,g]=j(null),[x,v]=j(null),[R,D]=j(null),[M,$]=j(null),[A,I]=j(!1),[P,L]=j(!1),[E,B]=j(null),[z,k]=j(null),w=S(oe=>{let fe=oe,Se=fe.target;if(Se.closest(".board-card")||Se.closest(".board-container"))return;let we=fe.button===1,Ie=fe.button===0&&fe.shiftKey;we||Ie?(fe.preventDefault(),f.current=!0,b.current={x:fe.clientX,y:fe.clientY,panX:c.panX,panY:c.panY}):fe.button===0&&i&&i(null)},[c.panX,c.panY,i]);re(()=>{let oe=Se=>{if(!f.current||!b.current)return;let we=Se,Ie=we.clientX-b.current.x,Fe=we.clientY-b.current.y;n({type:"PAN",panX:b.current.panX+Ie,panY:b.current.panY+Fe})},fe=()=>{f.current=!1,b.current=null};return document.addEventListener("mousemove",oe),document.addEventListener("mouseup",fe),()=>{document.removeEventListener("mousemove",oe),document.removeEventListener("mouseup",fe)}},[n]);let T=S(oe=>{let fe=oe;if(!fe.ctrlKey)return;fe.preventDefault();let Se=fe.deltaY>0?-.1:.1;n({type:"ZOOM",zoom:c.zoom+Se})},[c.zoom,n]),C=te(null);re(()=>{let oe=m.current;if(!oe)return;let fe=Ae=>{let ze=[];for(let ue=0;ue<Ae.touches.length;ue++)ze.push({x:Ae.touches[ue].clientX,y:Ae.touches[ue].clientY});return ze},Se=(Ae,ze)=>Math.sqrt((Ae.x-ze.x)**2+(Ae.y-ze.y)**2),we=Ae=>{let ze=Ae;if(ze.touches.length===2){ze.preventDefault();let ue=fe(ze);C.current={touches:ue,panX:c.panX,panY:c.panY,zoom:c.zoom,dist:Se(ue[0],ue[1])}}},Ie=Ae=>{let ze=Ae;if(ze.touches.length!==2||!C.current)return;ze.preventDefault();let ue=fe(ze),ve=C.current,Me=(ve.touches[0].x+ve.touches[1].x)/2,Te=(ve.touches[0].y+ve.touches[1].y)/2,Ke=(ue[0].x+ue[1].x)/2,Qe=(ue[0].y+ue[1].y)/2;n({type:"PAN",panX:ve.panX+(Ke-Me),panY:ve.panY+(Qe-Te)});let ct=Se(ue[0],ue[1]);ve.dist>0&&n({type:"ZOOM",zoom:ve.zoom*(ct/ve.dist)})},Fe=()=>{C.current=null};return oe.addEventListener("touchstart",we,{passive:!1}),oe.addEventListener("touchmove",Ie,{passive:!1}),oe.addEventListener("touchend",Fe),()=>{oe.removeEventListener("touchstart",we),oe.removeEventListener("touchmove",Ie),oe.removeEventListener("touchend",Fe)}},[c.panX,c.panY,c.zoom,n]);let N=S((oe,fe)=>{$({cardId:oe,x:fe.x,y:fe.y}),I(!1),L(!1),u&&u(oe,fe)},[u]),F=S(()=>{$(null),I(!1),L(!1)},[]);re(()=>{if(!M)return;let oe=()=>{F()};return document.addEventListener("click",oe),()=>{document.removeEventListener("click",oe)}},[M,F]);let _=S((oe,fe,Se)=>{k({linkId:oe,cardId:fe,x:Se.x,y:Se.y}),F()},[F]),H=S(()=>{k(null)},[]);re(()=>{if(!z)return;let oe=()=>H();return document.addEventListener("click",oe),()=>document.removeEventListener("click",oe)},[z,H]);let W=S((oe,fe)=>{B({containerId:oe,x:fe.x,y:fe.y}),F(),H()},[F,H]),V=S(()=>{B(null)},[]);re(()=>{if(!E)return;let oe=()=>V();return document.addEventListener("click",oe),()=>document.removeEventListener("click",oe)},[E,V]);let K=S(oe=>{i&&i(oe)},[i]),Q=S((oe,fe)=>{let Se=fe;if(s&&(Se=qi(fe,go)),n({type:"MOVE_ITEM",itemId:oe,position:Se}),U.current===oe){let Ie=0,Fe=0,Ae=[...p];for(;Ae.length>0;){let Me=Ae.pop();if(Xe(Me)===oe){Ie=Me.size.width,Fe=Me.size.height;break}if($e(Me))for(let Te=0;Te<Me.contents.length;Te++)Ae.push(Me.contents[Te])}let ze=Se.x+Ie/2,ue=Se.y+Fe/2,ve=Pd(p,ze,ue,oe);g(ve)}},[n,s,p]),G=S((oe,fe)=>{n({type:"RESIZE_ITEM",itemId:oe,size:fe})},[n]),O=S(oe=>{n({type:"REMOVE_ITEM",itemId:oe}),i&&r===oe&&i(null)},[n,r,i]),Y=S((oe,fe)=>{n({type:"NEST_ITEM",itemId:oe,containerId:fe})},[n]),X=S(oe=>{v(oe),U.current=oe,g(null)},[]),U=te(null);U.current=x;let Z=te(null);Z.current=y;let ee=S(oe=>{let fe=Z.current;fe&&n({type:"NEST_ITEM",itemId:oe,containerId:fe}),v(null),U.current=null,g(null)},[n]),ae=S((oe,fe,Se)=>{D({fromCardId:oe,fromAnchor:fe,fromPos:Se,currentPos:Se})},[]),J=te(null);J.current=R,re(()=>{if(!R)return;let oe=Se=>{let we=Se,Ie=0,Fe=0;if(m.current){let ze=m.current.getBoundingClientRect();Ie=ze.left,Fe=ze.top}let Ae=Zi(we.clientX-Ie,we.clientY-Fe,c);D(ze=>ze?{...ze,currentPos:Ae}:null)},fe=Se=>{let we=Se,Ie=J.current;if(!Ie){D(null);return}let Fe=document.elementFromPoint(we.clientX,we.clientY);if(Fe&&Fe.dataset&&Fe.dataset.role==="anchor"&&Fe.dataset.anchor){let Ae=Fe.closest("[data-card-id]");if(Ae&&Ae.dataset.cardId&&Ae.dataset.cardId!==Ie.fromCardId){let ze=Ae.dataset.cardId;n({type:"ADD_LINK",cardId:Ie.fromCardId,link:{link_id:qe(),link_name:"relates to",target_card_id:ze,color:"#94a3b8",attributes:{}}})}}D(null)};return document.addEventListener("mousemove",oe),document.addEventListener("mouseup",fe),()=>{document.removeEventListener("mousemove",oe),document.removeEventListener("mouseup",fe)}},[R!==null,c.panX,c.panY,c.zoom,n]);let se=a.toLowerCase(),ce=new Set,me=[],ge=[...p];for(;ge.length>0;){let oe=ge.pop();if(me.push(oe),$e(oe))for(let fe=0;fe<oe.contents.length;fe++)ge.push(oe.contents[fe])}if(se)for(let oe=0;oe<me.length;oe++){let fe=me[oe];(Be(fe)?fe.card_title:fe.name).toLowerCase().includes(se)||ce.add(Xe(fe))}if(l)for(let oe=0;oe<me.length;oe++){let fe=me[oe];Be(fe)&&fe.color!==l&&ce.add(fe.card_id)}let{cards:ye,links:le}=Td(p);function ne(oe){let fe=Xe(oe),Se=ce.has(fe),we;if(Be(oe))we=o(bn,{key:fe,card:oe,selected:fe===r,onSelect:K,onMove:Q,onResize:G,onDelete:O,dispatch:n,onOpenProject:d,onCardContextMenu:N,onUpdate:h,onDragStart:X,onDragEnd:ee,onAnchorDragStart:ae});else{let Ie=oe.contents.map(Fe=>ne(Fe));we=o(xn,{key:fe,container:oe,selected:fe===r,highlighted:y===oe.container_id,onSelect:K,onMove:Q,onResize:G,onDelete:O,onDrop:Y,onDragStart:X,onDragEnd:ee,onContainerContextMenu:W},...Ie)}return Se?o("div",{key:`dim-${fe}`,style:{opacity:"0.3"}},we):we}let pe=p.map(oe=>ne(oe)),ie={flex:"1",overflow:"hidden",position:"relative",backgroundColor:"#f8fafc",cursor:"default",backgroundImage:s?"radial-gradient(circle, #d1d5db 1px, transparent 1px)":"none",backgroundSize:`${go}px ${go}px`},he={transform:`translate(${c.panX}px, ${c.panY}px) scale(${c.zoom})`,transformOrigin:"0 0",position:"relative",width:`${Et}px`,height:`${Et}px`},xe={padding:"6px 12px",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"space-between",whiteSpace:"nowrap",fontSize:"13px",color:"#1a1a1a"},Ce={position:"absolute",left:"100%",top:"0",backgroundColor:"#ffffff",border:"1px solid #d1d5db",borderRadius:"6px",boxShadow:"0 4px 16px rgba(0,0,0,0.15)",padding:"4px 0",minWidth:"120px"},de={height:"1px",backgroundColor:"#e5e7eb",margin:"4px 0"},be=M?o("div",{className:"board-context-menu",style:{position:"fixed",left:`${M.x}px`,top:`${M.y}px`,backgroundColor:"#ffffff",border:"1px solid #d1d5db",borderRadius:"6px",boxShadow:"0 4px 16px rgba(0,0,0,0.15)",padding:"4px 0",zIndex:"10000",minWidth:"160px",fontSize:"13px",color:"#1a1a1a"},"data-testid":`board-context-menu-${M.cardId}`,role:"menu","aria-label":"Card context menu",onClick:oe=>oe.stopPropagation()},o("div",{style:{...xe,position:"relative"},onMouseEnter:()=>{I(!0),L(!1)},role:"menuitem","aria-haspopup":"true","data-testid":`board-ctx-change-color-${M.cardId}`},"Change Color",o("span",{style:{marginLeft:"8px"}},"\u25B6"),A?o("div",{style:Ce,role:"menu","data-testid":`board-ctx-color-submenu-${M.cardId}`},...Id.map(oe=>o("div",{key:oe.value,style:{...xe,gap:"8px"},onClick:fe=>{fe.stopPropagation(),n({type:"UPDATE_CARD",cardId:M.cardId,updates:{color:oe.value}}),F()},role:"menuitem","data-testid":`board-ctx-color-${oe.label.toLowerCase()}-${M.cardId}`},o("span",{style:{display:"inline-block",width:"14px",height:"14px",borderRadius:"3px",backgroundColor:oe.value,border:"1px solid #d1d5db",flexShrink:"0"}}),oe.label))):null),o("div",{style:{...xe,position:"relative"},onMouseEnter:()=>{L(!0),I(!1)},role:"menuitem","aria-haspopup":"true","data-testid":`board-ctx-change-type-${M.cardId}`},"Change Type",o("span",{style:{marginLeft:"8px"}},"\u25B6"),P?o("div",{style:Ce,role:"menu","data-testid":`board-ctx-type-submenu-${M.cardId}`},...Ft.map(oe=>o("div",{key:oe.value,style:xe,onClick:fe=>{fe.stopPropagation(),n({type:"CHANGE_CARD_TYPE",cardId:M.cardId,newType:oe.value}),F()},role:"menuitem","data-testid":`board-ctx-type-${oe.value}-${M.cardId}`},oe.label))):null),(()=>{let oe=Ki(p,M.cardId);return oe?o("div",{style:xe,onClick:fe=>{fe.stopPropagation(),n({type:"UNNEST_ITEM",itemId:M.cardId,containerId:oe}),F()},role:"menuitem","data-testid":`board-ctx-detach-${M.cardId}`},"Detach Card"):null})(),o("div",{style:de,role:"separator"}),o("div",{style:{...xe,color:"#dc2626"},onClick:oe=>{oe.stopPropagation(),n({type:"REMOVE_ITEM",itemId:M.cardId}),i&&r===M.cardId&&i(null),F()},role:"menuitem","data-testid":`board-ctx-delete-${M.cardId}`},"Delete")):null,ke=E?o("div",{className:"board-container-context-menu",role:"menu",style:{position:"fixed",left:`${E.x}px`,top:`${E.y}px`,backgroundColor:"#ffffff",border:"1px solid #d1d5db",borderRadius:"6px",boxShadow:"0 4px 16px rgba(0,0,0,0.15)",padding:"4px 0",zIndex:"10001",minWidth:"160px"},"data-testid":`board-container-ctx-menu-${E.containerId}`},(()=>{let oe=Ki(p,E.containerId);return oe?o("div",{style:xe,onClick:fe=>{fe.stopPropagation(),n({type:"UNNEST_ITEM",itemId:E.containerId,containerId:oe}),V()},role:"menuitem","data-testid":`board-ctx-detach-container-${E.containerId}`},"Detach Container"):null})(),o("div",{style:de,role:"separator"}),o("div",{style:{...xe,color:"#dc2626"},onClick:oe=>{oe.stopPropagation(),n({type:"REMOVE_ITEM",itemId:E.containerId}),i&&r===E.containerId&&i(null),V()},role:"menuitem","data-testid":`board-ctx-delete-container-${E.containerId}`},"Delete")):null,Re=["relates to","depends on","blocks","is blocked by","implements","is implemented by","extends","includes","references","duplicates","parent of","child of"],Le=z?o("div",{className:"board-link-context-menu",style:{position:"fixed",left:`${z.x}px`,top:`${z.y}px`,backgroundColor:"#ffffff",border:"1px solid #d1d5db",borderRadius:"6px",boxShadow:"0 4px 16px rgba(0,0,0,0.15)",padding:"4px 0",minWidth:"180px",maxHeight:"240px",overflowY:"auto",zIndex:"10001",fontSize:"13px"},onClick:oe=>oe.stopPropagation()},o("div",{style:{padding:"4px 14px",fontSize:"11px",color:"#94a3b8",fontWeight:"600"}},"Edge Type"),...Re.map(oe=>o("button",{key:oe,style:{display:"block",width:"100%",padding:"6px 14px",border:"none",backgroundColor:"transparent",textAlign:"left",cursor:"pointer",fontSize:"13px",color:"#334155",fontFamily:"inherit",boxSizing:"border-box"},onClick:()=>{n({type:"UPDATE_CARD",cardId:z.cardId,updates:{card_link:(()=>{let fe=null,Se=[...p];for(;Se.length>0;){let we=Se.pop();if(Be(we)&&we.card_id===z.cardId){fe=we;break}if($e(we))for(let Ie of we.contents)Se.push(Ie)}return fe?fe.card_link.map(we=>we.link_id===z.linkId?{...we,link_name:oe}:we):[]})()}}),H()},role:"menuitem"},oe)),o("div",{style:{height:"1px",backgroundColor:"#e5e7eb",margin:"4px 0"}}),o("button",{style:{display:"block",width:"100%",padding:"6px 14px",border:"none",backgroundColor:"transparent",textAlign:"left",cursor:"pointer",fontSize:"13px",color:"#ef4444",fontFamily:"inherit"},onClick:()=>{n({type:"REMOVE_LINK",cardId:z.cardId,linkId:z.linkId}),H()},role:"menuitem"},"Delete Link")):null;return o("div",{ref:m,className:"board-canvas",style:ie,onMouseDown:w,onWheel:T,"data-testid":"board-canvas",role:"application","aria-label":`Board: ${t.name}`,tabIndex:0},o("div",{className:"board-canvas__inner",style:he,"data-testid":"board-canvas-inner"},o(yn,{links:le,cards:ye,selectedLinkId:null,onSelectLink:()=>{},onLinkContextMenu:_,canvasWidth:Et,canvasHeight:Et}),R?o("svg",{style:{position:"absolute",top:"0",left:"0",width:"100%",height:"100%",pointerEvents:"none",overflow:"visible"},width:String(Et),height:String(Et),className:"link-drag-overlay","data-testid":"link-drag-overlay"},o("line",{x1:String(R.fromPos.x),y1:String(R.fromPos.y),x2:String(R.currentPos.x),y2:String(R.currentPos.y),stroke:"#3b82f6","stroke-width":"2","stroke-dasharray":"6 4","pointer-events":"none","data-testid":"link-drag-line"})):null,...pe),be,ke,Le)}function Dd(e){let t=[],n=[...e];for(;n.length>0;){let r=n.pop();if(Be(r))t.push(r);else if($e(r))for(let i=r.contents.length-1;i>=0;i--)n.push(r.contents[i])}return t}function Ji(e,t,n,r){let i=r??40,s=Dd(e);if(s.length===0)return{panX:0,panY:0,zoom:1};let a=1/0,l=1/0,d=-1/0,u=-1/0;for(let g=0;g<s.length;g++){let x=s[g];x.position.x<a&&(a=x.position.x),x.position.y<l&&(l=x.position.y);let v=x.position.x+x.size.width,R=x.position.y+x.size.height;v>d&&(d=v),R>u&&(u=R)}let h=d-a+i*2,p=u-l+i*2,c=t/h,m=n/p,f=Math.max(.25,Math.min(4,Math.min(c,m))),b=-a*f+(t-(d-a)*f)/2,y=-l*f+(n-(u-l)*f)/2;return{panX:b,panY:y,zoom:f}}var ho=["#fef9c3","#fecaca","#fed7aa","#bbf7d0","#bfdbfe","#ddd6fe","#fbcfe8","#e5e7eb"];function Qi(e){let{zoom:t,gridEnabled:n,selectedColor:r,colorFilter:i,onNewCard:s,onZoomIn:a,onZoomOut:l,onZoomReset:d,onColorSelect:u,onColorFilter:h,onGridToggle:p,onSearch:c}=e,[m,f]=j(""),b=S($=>{let A=$.target.value;f(A),c(A)},[c]),y={display:"flex",alignItems:"center",gap:"8px",padding:"6px 12px",backgroundColor:"rgba(255,255,255,0.95)",borderBottom:"1px solid #e2e8f0",fontSize:"12px",flexShrink:"0",flexWrap:"wrap"},g={padding:"4px 10px",border:"1px solid #d1d5db",borderRadius:"4px",backgroundColor:"#ffffff",cursor:"pointer",fontSize:"12px",color:"#374151",lineHeight:"1.4"},x={...g,backgroundColor:"#3b82f6",color:"#ffffff",borderColor:"#3b82f6"},v={fontSize:"12px",color:"#64748b",minWidth:"40px",textAlign:"center",cursor:"pointer"},R={width:"1px",height:"20px",backgroundColor:"#e2e8f0",margin:"0 4px"},D={padding:"4px 8px",border:"1px solid #d1d5db",borderRadius:"4px",fontSize:"12px",width:"120px",outline:"none"},M=ho.map($=>{let A=$===r,I=$===i,P=()=>{A&&h?h(I?null:$):u($)},L="1px solid rgba(0,0,0,0.15)";return I?L="3px solid #ef4444":A&&(L="2px solid #3b82f6"),o("button",{key:$,title:$,style:{width:"18px",height:"18px",borderRadius:"50%",backgroundColor:$,border:L,cursor:"pointer",padding:"0",flexShrink:"0",opacity:I?"1":i?"0.5":"1"},onClick:P,"aria-label":I?`Clear color filter ${$}`:`Select color ${$}`,"data-testid":`color-swatch-${$}`})});return o("div",{className:"board-toolbar",style:y,role:"toolbar","aria-label":"Board toolbar","data-testid":"board-toolbar"},o("button",{style:g,onClick:s,"data-testid":"btn-new-card","aria-label":"New card"},"+ New Card"),o("div",{style:R}),o("button",{style:g,onClick:l,"data-testid":"btn-zoom-out","aria-label":"Zoom out"},"-"),o("span",{style:v,onClick:d,"data-testid":"zoom-level",role:"status","aria-label":`Zoom ${Math.round(t*100)}%`},`${Math.round(t*100)}%`),o("button",{style:g,onClick:a,"data-testid":"btn-zoom-in","aria-label":"Zoom in"},"+"),o("div",{style:R}),...M,o("div",{style:R}),o("button",{style:n?x:g,onClick:p,"data-testid":"btn-grid-toggle","aria-label":n?"Disable grid snapping":"Enable grid snapping","aria-pressed":String(n)},"Grid"),o("div",{style:R}),o("input",{type:"text",placeholder:"Search cards...",value:m,onInput:b,style:D,"data-testid":"search-input","aria-label":"Search cards"}))}var es=50,tt={id:qe(),name:"Untitled",collection:[],viewport:{panX:0,panY:0,zoom:1}};function ts(e,t){let n=null;function r(s){let a=[];for(let l=0;l<s.length;l++){let d=s[l];if(Xe(d)===t){n=d;continue}if($e(d)){let h=r(d.contents);a.push({...d,contents:h})}else a.push(d)}return a}return[r(e),n]}function ft(e,t,n){let r=[];for(let i=0;i<e.length;i++){let s=e[i];Xe(s)===t?r.push(n(s)):$e(s)?r.push({...s,contents:ft(s.contents,t,n)}):r.push(s)}return r}function Sn(e,t,n){let r=[];for(let i=0;i<e.length;i++){let s=e[i];$e(s)&&s.container_id===t?r.push({...s,contents:[...s.contents,n]}):$e(s)?r.push({...s,contents:Sn(s.contents,t,n)}):r.push(s)}return r}function ns(e,t){let n=[...e];for(;n.length>0;){let r=n.pop();if($e(r)){if(r.container_id===t)return r;for(let i=0;i<r.contents.length;i++)n.push(r.contents[i])}}return null}function $d(e,t,n){let r=null;function i(a){let l=[];for(let d=0;d<a.length;d++){let u=a[d];if($e(u)&&u.container_id===t){let h=[];for(let p=0;p<u.contents.length;p++){let c=u.contents[p];Xe(c)===n?r=c:h.push(c)}l.push({...u,contents:h})}else $e(u)?l.push({...u,contents:i(u.contents)}):l.push(u)}return l}return[i(e),r]}function zd(e){switch(e){case"text":return{text:""};case"json":return{};case"task":return{};case"project":return{project_id:"",project_name:""}}}function vn(e,t){switch(t.type){case"ADD_ITEM":return t.containerId?{...e,collection:Sn(e.collection,t.containerId,t.item)}:{...e,collection:[...e.collection,t.item]};case"REMOVE_ITEM":{let[n]=ts(e.collection,t.itemId);return{...e,collection:n}}case"MOVE_ITEM":return{...e,collection:ft(e.collection,t.itemId,n=>({...n,position:t.position,...Be(n)?{updatedAt:Date.now()}:{}}))};case"RESIZE_ITEM":return{...e,collection:ft(e.collection,t.itemId,n=>({...n,size:t.size,...Be(n)?{updatedAt:Date.now()}:{}}))};case"UPDATE_CARD":return{...e,collection:ft(e.collection,t.cardId,n=>Be(n)?{...n,...t.updates,updatedAt:Date.now()}:n)};case"CHANGE_CARD_TYPE":return{...e,collection:ft(e.collection,t.cardId,n=>Be(n)?{...n,card_type:t.newType,content:zd(t.newType),updatedAt:Date.now()}:n)};case"ADD_CONTAINER":return t.parentContainerId?{...e,collection:Sn(e.collection,t.parentContainerId,t.container)}:{...e,collection:[...e.collection,t.container]};case"NEST_ITEM":{let n=ns(e.collection,t.containerId);if(!n)return e;let[r,i]=ts(e.collection,t.itemId);if(!i)return e;let s={...i,position:{x:i.position.x-n.position.x,y:i.position.y-n.position.y-30}};return{...e,collection:Sn(r,t.containerId,s)}}case"UNNEST_ITEM":{let n=ns(e.collection,t.containerId),[r,i]=$d(e.collection,t.containerId,t.itemId);if(!i)return e;let s=n?{...i,position:{x:i.position.x+n.position.x,y:i.position.y+n.position.y+30}}:i;return{...e,collection:[...r,s]}}case"ADD_LINK":return{...e,collection:ft(e.collection,t.cardId,n=>Be(n)?{...n,card_link:[...n.card_link,t.link],updatedAt:Date.now()}:n)};case"REMOVE_LINK":return{...e,collection:ft(e.collection,t.cardId,n=>Be(n)?{...n,card_link:n.card_link.filter(r=>r.link_id!==t.linkId),updatedAt:Date.now()}:n)};case"PAN":return{...e,viewport:{...e.viewport,panX:t.panX,panY:t.panY}};case"ZOOM":{let n=Math.max(.25,Math.min(4,t.zoom));return{...e,viewport:{...e.viewport,zoom:n}}}case"SET_BOARD":return t.state;case"RENAME_BOARD":return{...e,name:t.name};default:return e}}function Ad(e){return e.type==="PAN"||e.type==="ZOOM"}function wn(e,t){switch(t.type){case"UNDO":{if(e.past.length===0)return e;let n=e.past[e.past.length-1];return{past:e.past.slice(0,e.past.length-1),present:n,future:[e.present,...e.future]}}case"REDO":{if(e.future.length===0)return e;let n=e.future[0],r=e.future.slice(1);return{past:[...e.past,e.present],present:n,future:r}}case"BOARD_ACTION":{let n=vn(e.present,t.action);if(n===e.present)return e;if(Ad(t.action))return{...e,present:n};if(t.action.type==="SET_BOARD")return{past:[],present:n,future:[]};let r=[...e.past,e.present];return r.length>es&&r.splice(0,r.length-es),{past:r,present:n,future:[]}}default:return e}}function Wt(e){let t={past:[],present:e||tt,future:[]},[n,r]=zn(wn,t),i=S(l=>{r({type:"BOARD_ACTION",action:l})},[r]),s=S(()=>{r({type:"UNDO"})},[r]),a=S(()=>{r({type:"REDO"})},[r]);return{state:n.present,dispatch:i,undo:s,redo:a,canUndo:n.past.length>0,canRedo:n.future.length>0}}function os(e,t){let{state:n,dispatch:r,undo:i,redo:s,canUndo:a,canRedo:l}=Wt(),d=te(!1);re(()=>{e&&t&&!d.current&&(d.current=!0,e.load(t).then(p=>{r({type:"SET_BOARD",state:p})}).catch(()=>{}))},[e,t,r]);let u=te(null),h=te(n);return h.current=n,re(()=>{if(!(!e||!t))return u.current!==null&&clearTimeout(u.current),u.current=setTimeout(()=>{e.save(t,h.current).catch(()=>{}),u.current=null},500),()=>{u.current!==null&&clearTimeout(u.current)}},[e,t,n]),{state:n,dispatch:r,undo:i,redo:s,canUndo:a,canRedo:l}}var kn=class{async load(t){try{let n=localStorage.getItem("board:"+t);return n?JSON.parse(n):{...tt}}catch{return{...tt}}}async save(t,n){try{localStorage.setItem("board:"+t,JSON.stringify(n))}catch{}}};function Ld(e){let t=[],n=[...e];for(;n.length>0;){let r=n.pop();if(Be(r))t.push(r);else for(let i=r.contents.length-1;i>=0;i--)n.push(r.contents[i])}return t}function rs(e){let{collection:t,onCardDropped:n,children:r}=e,i=st(),s=te([]);re(()=>{let u=Ld(t),h=s.current,p=new Set(h.map(m=>m.card_id)),c=new Set(u.map(m=>m.card_id));for(let m of u)p.has(m.card_id)||i.publish("project-board",{event:"card-created",card:m});for(let m of h)c.has(m.card_id)||i.publish("project-board",{event:"card-deleted",cardId:m.card_id});for(let m of u)if(p.has(m.card_id)){let f=h.find(b=>b.card_id===m.card_id);f&&f.updatedAt!==m.updatedAt&&i.publish("project-board",{event:"card-updated",card:m})}s.current=u},[t,i]);let a=S(u=>{if(u.type==="text/plain"&&typeof u.data=="string")n(u.data,"");else if(u.type==="application/json"){let h=u.data;n(String(h.title||"Dropped Item"),String(h.description||""))}},[n]),{isOver:l}=At({acceptTypes:["text/plain","application/json","application/project-card"],onDrop:a}),d={width:"100%",height:"100%",...l?{outline:"2px dashed #3b82f6",outlineOffset:"-2px"}:{}};return o("div",{style:d,"data-dropzone-id":"project-board-dropzone"},r)}var Bd=new kn;function is(e){let t=[],n=[...e];for(;n.length>0;){let r=n.pop();if(Be(r))t.push(r);else if($e(r))for(let i=r.contents.length-1;i>=0;i--)n.push(r.contents[i])}return t}var at=Date.now(),Fd={id:"sample-board-001",name:"Sample Project",collection:[{type:"card",card_id:"sample-1",card_type:"text",card_title:"Auth API",card_link:[{link_id:"link-1",link_name:"blocks",target_card_id:"sample-2",color:"#94a3b8",attributes:{}}],content:{text:"Design the auth flow"},position:{x:50,y:50},size:{width:180,height:120},color:"#3b82f6",priority:"high",assignee:"Alice",createdAt:at,updatedAt:at},{type:"card",card_id:"sample-2",card_type:"text",card_title:"Dashboard",card_link:[],content:{text:"Build the main dashboard"},position:{x:300,y:80},size:{width:180,height:120},color:"#22c55e",priority:"medium",assignee:"Bob",createdAt:at,updatedAt:at},{type:"card",card_id:"sample-3",card_type:"text",card_title:"Deploy",card_link:[],content:{text:"Set up CI pipeline"},position:{x:150,y:250},size:{width:180,height:120},color:"#f59e0b",priority:"low",createdAt:at,updatedAt:at},{type:"card",card_id:"sample-4",card_type:"text",card_title:"Docs",card_link:[],content:{text:"Write API reference"},position:{x:400,y:280},size:{width:180,height:120},color:"#a855f7",priority:"medium",assignee:"Carol",createdAt:at,updatedAt:at}],viewport:{panX:0,panY:0,zoom:1}};function Nd(e){return e.collection.length===0}function ss(e){let t=e.boardId||"default",{state:n,dispatch:r,undo:i,redo:s,canUndo:a,canRedo:l}=os(Bd,t),[d,u]=j(ho[0]),[h,p]=j(!1),[c,m]=j(""),[f,b]=j(null),[y,g]=j(null),[x,v]=j(n.name||"Untitled"),[R,D]=j(!1),[M,$]=j(""),[A,I]=j(null),[P,L]=j(!0),[E,B]=j([{name:"relates to",weight:1},{name:"depends on",weight:2},{name:"blocks",weight:3},{name:"is blocked by",weight:3},{name:"implements",weight:2},{name:"references",weight:1}]),[z,k]=j(null),[w,T]=j(""),[C,N]=j("1"),[F,_]=j([]),H=te(!1);re(()=>{!H.current&&Nd(n)?(H.current=!0,r({type:"SET_BOARD",state:Fd})):n.collection.length>0&&(H.current=!0)},[n,r]);let W=S(()=>{let ue=(-n.viewport.panX+300)/n.viewport.zoom,ve=(-n.viewport.panY+200)/n.viewport.zoom,Me=(Math.random()-.5)*300,Te=(Math.random()-.5)*200,Ke={type:"card",card_id:qe(),card_type:"text",card_title:"New Card",card_link:[],content:{text:""},color:d,position:{x:Math.round(ue+Me),y:Math.round(ve+Te)},size:{width:180,height:120},priority:"medium",createdAt:Date.now(),updatedAt:Date.now()};r({type:"ADD_ITEM",item:Ke})},[n.viewport,d,r]),V=S(()=>{r({type:"ZOOM",zoom:n.viewport.zoom+.1})},[n.viewport.zoom,r]),K=S(()=>{r({type:"ZOOM",zoom:n.viewport.zoom-.1})},[n.viewport.zoom,r]),Q=S(()=>{r({type:"ZOOM",zoom:1})},[r]),G=S(()=>{p(ue=>!ue)},[]),O=S(ue=>{m(ue)},[]),Y=S(ue=>{b(ue)},[]),X=S(ue=>{g(ue)},[]),U=S(()=>{L(ue=>!ue)},[]),Z=S(()=>{r({type:"SET_BOARD",state:tt}),b(null)},[r]),ee=S(()=>{let ue=JSON.stringify(n,null,2),ve=new Blob([ue],{type:"application/json"}),Me=URL.createObjectURL(ve),Te=document.createElement("a");Te.href=Me,Te.download=`board-${t}.json`,Te.style.display="none",document.body.appendChild(Te),Te.click(),document.body.removeChild(Te),URL.revokeObjectURL(Me)},[n,t]),ae=S(()=>{let ue=document.createElement("input");ue.type="file",ue.accept=".json,application/json",ue.style.display="none",ue.addEventListener("change",()=>{let ve=ue.files&&ue.files[0];if(!ve)return;let Me=new FileReader;Me.onload=()=>{try{let Te=JSON.parse(Me.result);Te&&Te.collection&&Te.viewport&&r({type:"SET_BOARD",state:Te})}catch{}},Me.readAsText(ve)}),document.body.appendChild(ue),ue.click(),document.body.removeChild(ue)},[r]),J=S(()=>{window.print()},[]),se=is(n.collection),ce=S(()=>{let ue=is(n.collection);ue.length>0&&b(ue[0].card_id)},[n.collection]),me=S(()=>{f&&(r({type:"REMOVE_ITEM",itemId:f}),b(null))},[f,r]),ge=S(()=>{if(n.collection.length===0)return;let Me=Ji(n.collection,800,600);r({type:"PAN",panX:Me.panX,panY:Me.panY}),r({type:"ZOOM",zoom:Me.zoom})},[n.collection,r]);re(()=>{let ue={menus:[{label:"File",items:[{label:"New Board",onClick:Z},{label:"Export JSON",onClick:ee},{label:"Import JSON",onClick:ae},{divider:!0},{label:"Print",onClick:J}]},{label:"Edit",items:[{label:"Undo",shortcut:"Ctrl+Z",onClick:i,disabled:!a},{label:"Redo",shortcut:"Ctrl+Y",onClick:s,disabled:!l},{divider:!0},{label:"Select All",shortcut:"Ctrl+A",onClick:ce},{label:"Delete Selected",onClick:me}]},{label:"View",items:[{label:"Zoom In",onClick:V},{label:"Zoom Out",onClick:K},{label:"Fit All",onClick:ge},{divider:!0},{label:"Toggle Grid",onClick:G}]}]}},[Z,ee,ae,J,i,s,a,l,ce,me,V,K,ge,G]),re(()=>{let ue=ve=>{let Me=ve;Me.ctrlKey&&Me.key==="z"?(Me.preventDefault(),i()):Me.ctrlKey&&Me.key==="y"&&(Me.preventDefault(),s())};return document.addEventListener("keydown",ue),()=>document.removeEventListener("keydown",ue)},[i,s]),re(()=>{if(!A)return;let ue=()=>I(null),ve=setTimeout(()=>document.addEventListener("click",ue),0);return()=>{clearTimeout(ve),document.removeEventListener("click",ue)}},[A]);let ye=S(()=>{$(x),D(!0)},[x]),le=S(()=>{let ue=M.trim();ue&&(v(ue),r({type:"RENAME_BOARD",name:ue}),e.onTitleChange&&e.onTitleChange(`Project Board: ${ue}`)),D(!1)},[M,r,e.onTitleChange]),ne=S(()=>{D(!1)},[]),pe=S(ue=>{$(ue.target.value)},[]),ie=S(ue=>{let ve=ue;ve.key==="Enter"&&(ve.preventDefault(),le()),ve.key==="Escape"&&(ve.preventDefault(),ne())},[le,ne]),he={display:"flex",flexDirection:"column",width:"100%",height:"100%",backgroundColor:"#f8fafc",overflow:"hidden"},xe=S((ue,ve)=>{let Me=(-n.viewport.panX+300)/n.viewport.zoom,Te=(-n.viewport.panY+200)/n.viewport.zoom,Ke=(Math.random()-.5)*300,Qe=(Math.random()-.5)*200,ct={type:"card",card_id:qe(),card_type:"text",card_title:ue,card_link:[],content:{text:ve},color:d,position:{x:Math.round(Me+Ke),y:Math.round(Te+Qe)},size:{width:180,height:120},priority:"medium",createdAt:Date.now(),updatedAt:Date.now()};r({type:"ADD_ITEM",item:ct})},[n.viewport,d,r]),Ce={display:"flex",alignItems:"center",height:"28px",backgroundColor:"#f1f5f9",borderBottom:"1px solid #e2e8f0",padding:"0 8px",fontSize:"13px",flexShrink:"0"},de={padding:"2px 10px",border:"none",backgroundColor:"transparent",cursor:"pointer",fontSize:"13px",color:"#334155",borderRadius:"4px",fontFamily:"inherit"},be=S(()=>{let ue=(-n.viewport.panX+300)/n.viewport.zoom,ve=(-n.viewport.panY+200)/n.viewport.zoom,Me=(Math.random()-.5)*300,Te=(Math.random()-.5)*200;r({type:"ADD_CONTAINER",container:{type:"container",container_id:qe(),name:"New Container",position:{x:Math.round(ue+Me),y:Math.round(ve+Te)},size:{width:300,height:250},contents:[]}}),I(null)},[n.viewport,r]),ke={position:"absolute",top:"100%",left:"0",marginTop:"2px",backgroundColor:"#ffffff",border:"1px solid #d1d5db",borderRadius:"6px",boxShadow:"0 4px 12px rgba(0,0,0,0.15)",padding:"4px 0",minWidth:"180px",zIndex:"1000"},Re={display:"block",width:"100%",padding:"6px 14px",border:"none",backgroundColor:"transparent",textAlign:"left",cursor:"pointer",fontSize:"13px",color:"#334155",fontFamily:"inherit",boxSizing:"border-box"},Le=o("div",{style:Ce,"data-testid":"app-menu-bar"},o("div",{style:{position:"relative",display:"inline-flex"}},o("button",{style:de,onClick:()=>I(A==="project"?null:"project")},"Project"),A==="project"?o("div",{style:ke},o("button",{style:Re,onClick:()=>{ye(),I(null)}},"Rename Project..."),o("div",{style:{height:"1px",backgroundColor:"#e5e7eb",margin:"4px 0"}}),o("button",{style:Re,onClick:()=>{be()}},"New Container"),o("button",{style:Re,onClick:()=>{W(),I(null)}},"New Card")):null),o("div",{style:{position:"relative",display:"inline-flex"}},o("button",{style:de,onClick:()=>I(A==="graphs"?null:"graphs")},"Graphs"),A==="graphs"?o("div",{style:ke},o("button",{style:Re,onClick:()=>{T(""),N("1"),k("add"),I(null)}},"Add Attribute..."),o("button",{style:Re,onClick:()=>{k("delete"),I(null)}},"Delete Attribute..."),o("button",{style:Re,onClick:()=>{_(E.map(ue=>({...ue}))),k("edit"),I(null)}},"Edit Attributes...")):null),o("div",{style:{position:"relative",display:"inline-flex"}},o("button",{style:de,onClick:()=>I(A==="settings"?null:"settings")},"Settings"),A==="settings"?o("div",{style:ke},o("button",{style:Re,onClick:()=>{G(),I(null)}},h?"Disable Grid Snap":"Enable Grid Snap"),o("button",{style:Re,onClick:()=>{U(),I(null)}},P?"Hide Links":"Show Links")):null),o("div",{style:{position:"relative",display:"inline-flex"}},o("button",{style:de,onClick:()=>I(A==="help"?null:"help")},"Help"),A==="help"?o("div",{style:ke},o("button",{style:Re,onClick:()=>I(null)},"About Project Board"),o("button",{style:Re,onClick:()=>I(null)},"Keyboard Shortcuts")):null),o("span",{style:{marginLeft:"auto",fontSize:"12px",color:"#94a3b8"}},`Project Board: ${x}`)),oe=R?o("div",{style:{position:"absolute",inset:"0",backgroundColor:"rgba(0,0,0,0.3)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:"200"},onClick:ne},o("div",{style:{backgroundColor:"#ffffff",borderRadius:"8px",padding:"20px",boxShadow:"0 8px 24px rgba(0,0,0,0.2)",minWidth:"300px"},onClick:ue=>ue.stopPropagation(),role:"dialog","aria-label":"Rename project"},o("div",{style:{fontWeight:"600",fontSize:"14px",marginBottom:"12px",color:"#1a1a1a"}},"Rename Project"),o("input",{type:"text",value:M,onInput:pe,onKeyDown:ie,autoFocus:!0,style:{width:"100%",padding:"8px 10px",border:"1px solid #d1d5db",borderRadius:"6px",fontSize:"14px",boxSizing:"border-box",outline:"none",fontFamily:"inherit"},"data-testid":"rename-input"}),o("div",{style:{display:"flex",justifyContent:"flex-end",gap:"8px",marginTop:"12px"}},o("button",{onClick:ne,style:{padding:"6px 14px",border:"1px solid #d1d5db",borderRadius:"6px",backgroundColor:"#ffffff",cursor:"pointer",fontSize:"13px",fontFamily:"inherit"}},"Cancel"),o("button",{onClick:le,style:{padding:"6px 14px",border:"none",borderRadius:"6px",backgroundColor:"#3b82f6",color:"#ffffff",cursor:"pointer",fontSize:"13px",fontWeight:"600",fontFamily:"inherit"},"data-testid":"rename-confirm"},"Rename")))):null,fe={position:"absolute",inset:"0",backgroundColor:"rgba(0,0,0,0.3)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:"200"},Se={backgroundColor:"#ffffff",borderRadius:"8px",padding:"20px",boxShadow:"0 8px 24px rgba(0,0,0,0.2)",minWidth:"320px",maxHeight:"400px",overflow:"auto"},we={fontWeight:"600",fontSize:"14px",marginBottom:"12px",color:"#1a1a1a"},Ie={width:"100%",padding:"8px 10px",border:"1px solid #d1d5db",borderRadius:"6px",fontSize:"14px",boxSizing:"border-box",outline:"none",fontFamily:"inherit"},Fe={padding:"6px 14px",border:"none",borderRadius:"6px",backgroundColor:"#3b82f6",color:"#ffffff",cursor:"pointer",fontSize:"13px",fontWeight:"600",fontFamily:"inherit"},Ae={padding:"6px 14px",border:"1px solid #d1d5db",borderRadius:"6px",backgroundColor:"#ffffff",cursor:"pointer",fontSize:"13px",fontFamily:"inherit"},ze=null;return z==="add"&&(ze=o("div",{style:fe,onClick:()=>k(null)},o("div",{style:Se,onClick:ue=>ue.stopPropagation(),role:"dialog","aria-label":"Add edge attribute"},o("div",{style:we},"Add Edge Attribute"),o("div",{style:{marginBottom:"8px"}},o("label",{style:{fontSize:"12px",color:"#64748b",display:"block",marginBottom:"4px"}},"Name"),o("input",{type:"text",value:w,style:Ie,placeholder:"e.g. depends on",onInput:ue=>T(ue.target.value)})),o("div",{style:{marginBottom:"12px"}},o("label",{style:{fontSize:"12px",color:"#64748b",display:"block",marginBottom:"4px"}},"Weight"),o("input",{type:"number",value:C,style:Ie,min:"0",step:"1",onInput:ue=>N(ue.target.value)})),o("div",{style:{display:"flex",justifyContent:"flex-end",gap:"8px"}},o("button",{style:Ae,onClick:()=>k(null)},"Cancel"),o("button",{style:Fe,onClick:()=>{let ue=w.trim(),ve=parseFloat(C)||1;ue&&B(Me=>[...Me,{name:ue,weight:ve}]),k(null)}},"Add"))))),z==="delete"&&(ze=o("div",{style:fe,onClick:()=>k(null)},o("div",{style:Se,onClick:ue=>ue.stopPropagation(),role:"dialog","aria-label":"Delete edge attribute"},o("div",{style:we},"Delete Edge Attribute"),E.length===0?o("div",{style:{color:"#94a3b8",padding:"8px 0"}},"No attributes defined."):o("div",{style:{display:"flex",flexDirection:"column",gap:"4px"}},...E.map((ue,ve)=>o("div",{key:String(ve),style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"6px 8px",borderRadius:"4px",border:"1px solid #e5e7eb"}},o("span",{style:{fontSize:"13px"}},`${ue.name} (weight: ${ue.weight})`),o("button",{style:{border:"none",backgroundColor:"transparent",color:"#ef4444",cursor:"pointer",fontSize:"16px"},onClick:()=>B(Me=>Me.filter((Te,Ke)=>Ke!==ve))},"\xD7")))),o("div",{style:{display:"flex",justifyContent:"flex-end",marginTop:"12px"}},o("button",{style:Ae,onClick:()=>k(null)},"Done"))))),z==="edit"&&(ze=o("div",{style:fe,onClick:()=>k(null)},o("div",{style:{...Se,minWidth:"400px"},onClick:ue=>ue.stopPropagation(),role:"dialog","aria-label":"Edit edge attributes"},o("div",{style:we},"Edit Edge Attributes"),F.length===0?o("div",{style:{color:"#94a3b8",padding:"8px 0"}},"No attributes defined."):o("div",{style:{display:"flex",flexDirection:"column",gap:"6px"}},...F.map((ue,ve)=>o("div",{key:String(ve),style:{display:"flex",alignItems:"center",gap:"8px"}},o("input",{type:"text",value:ue.name,style:{...Ie,flex:"1"},onInput:Me=>{let Te=Me.target.value;_(Ke=>Ke.map((Qe,ct)=>ct===ve?{...Qe,name:Te}:Qe))}}),o("input",{type:"number",value:String(ue.weight),min:"0",step:"1",style:{...Ie,width:"80px"},onInput:Me=>{let Te=parseFloat(Me.target.value)||0;_(Ke=>Ke.map((Qe,ct)=>ct===ve?{...Qe,weight:Te}:Qe))}})))),o("div",{style:{display:"flex",justifyContent:"flex-end",gap:"8px",marginTop:"12px"}},o("button",{style:Ae,onClick:()=>k(null)},"Cancel"),o("button",{style:Fe,onClick:()=>{B(F.filter(ue=>ue.name.trim())),k(null)}},"Save"))))),o("div",{className:"project-manager-app",style:he,"data-testid":"project-manager-app"},Le,o(Qi,{zoom:n.viewport.zoom,gridEnabled:h,selectedColor:d,colorFilter:y,onNewCard:W,onZoomIn:V,onZoomOut:K,onZoomReset:Q,onColorSelect:u,onColorFilter:X,onGridToggle:G,onSearch:O}),o(rs,{collection:n.collection,onCardDropped:xe},o(Nt,{state:n,dispatch:r,searchQuery:c,gridEnabled:h,selectedId:f,onSelectItem:Y,colorFilter:y,onUpdateItem:(ue,ve)=>{r({type:"UPDATE_CARD",cardId:ue,updates:ve})},onCardContextMenu:(ue,ve)=>{}})),oe,ze)}var Wd=28,_d=5e3;var as=0;function ls(e){return as++,`${e}-${as}`}function Od(e){return e.replace(/\s*\(\d+\)$/,"")}function Hd(e){let{toasts:t,onDismiss:n}=e;if(t.length===0)return null;let r={position:"absolute",top:"8px",right:"8px",zIndex:"9999",display:"flex",flexDirection:"column",gap:"8px",pointerEvents:"none",maxWidth:"320px"},i=t.map(s=>{let a="rgba(50, 50, 50, 0.95)",l="#555";return s.severity==="warning"?(a="rgba(60, 40, 10, 0.95)",l="#f39c12"):s.severity==="error"&&(a="rgba(60, 10, 10, 0.95)",l="#e74c3c"),o("div",{key:String(s.id),className:`unity-desktop__toast unity-desktop__toast--${s.severity}`,style:{backgroundColor:a,border:`1px solid ${l}`,borderRadius:"6px",padding:"10px 14px",color:"#ffffff",fontSize:"13px",boxShadow:"0 4px 12px rgba(0,0,0,0.3)",pointerEvents:"auto",cursor:"pointer",transition:"opacity 200ms ease"},onClick:()=>n(s.id),role:"alert","aria-live":"polite"},s.message)});return o("div",{className:"unity-desktop__toast-container",style:r,"aria-label":"Notifications"},...i)}function Yd(){let e=st(),t=te(!1);return re(()=>{t.current||(t.current=!0,e.publish("terminal-output",{text:"Terminal session started",pid:1}))},[e]),o("div",{style:{padding:"16px",fontSize:"12px",color:"#00ff41",height:"100%",overflow:"auto",backgroundColor:"#1a1a2e",fontFamily:"monospace"}},o("div",null,"$ whoami"),o("div",null,"operator"),o("div",null,"$ uname -a"),o("div",null,"Linux specifyjs 6.1.0 #1 SMP x86_64 GNU/Linux"),o("div",{style:{opacity:"0.6",marginTop:"8px",fontSize:"10px"}},"[Published terminal-output message]"),o("div",null,"$ _"))}function Vd(){let[e,t]=j([]),n=pt();$t("terminal-output",s=>{t(a=>[...a,`[terminal] ${s.payload.text}`])});let r=S(s=>{s.preventDefault(),n.startDrag({type:"application/file",data:{name:"readme.txt",size:1024},sourceAppId:"files",preview:"readme.txt"})},[n]);return o("div",{style:{padding:"16px",fontSize:"13px",color:"var(--color-text, #333)",height:"100%",overflow:"auto"}},o("div",{style:{fontWeight:"600",marginBottom:"12px"}},"Home"),o("div",{style:{display:"flex",flexDirection:"column",gap:"6px"}},...["\u{1F4C1} Documents","\u{1F4C1} Downloads","\u{1F4C1} Music","\u{1F4C1} Pictures","\u{1F4C1} Videos"].map(s=>o("span",{style:{cursor:"pointer"}},s)),o("span",{style:{cursor:"grab",padding:"4px 8px",border:"1px dashed #94a3b8",borderRadius:"4px",backgroundColor:"rgba(148, 163, 184, 0.1)"},onMouseDown:r,"aria-label":"Drag readme.txt"},"\u{1F4C4} readme.txt (drag me)")),e.length>0?o("div",{style:{marginTop:"12px",padding:"8px",backgroundColor:"rgba(0,0,0,0.05)",borderRadius:"4px",fontSize:"11px",fontFamily:"monospace"}},o("div",{style:{fontWeight:"600",marginBottom:"4px"}},"Messages received:"),...e.map((s,a)=>o("div",{key:String(a),style:{color:"#64748b"}},s))):null)}function Ud(e,t,n){let r={padding:"16px",fontSize:"13px",color:"var(--color-text, #333)",height:"100%",overflow:"auto"};switch(Od(e)){case"Files":return o(it,{appId:"files"},o(Vd,null));case"Terminal":return o(it,{appId:"terminal"},o(Yd,null));case"Browser":return o("div",{style:r},o("div",{style:{padding:"6px 10px",backgroundColor:"#f1f5f9",borderRadius:"4px",marginBottom:"12px",fontSize:"12px",color:"#64748b"}},"https://specifyjs.asymmetric-effort.com"),o("div",{style:{textAlign:"center",padding:"32px",color:"#94a3b8"}},"Web page content area"));case"Mail":return o("div",{style:r},o("div",{style:{fontWeight:"600",marginBottom:"8px"}},"Inbox (3)"),...["Build passed \u2014 CI/CD Pipeline","PR Review: feat/unity-desktop","Weekly sync notes"].map(s=>o("div",{style:{padding:"8px",borderBottom:"1px solid #e2e8f0",cursor:"pointer"}},s)));case"Settings":return o("div",{style:r},o("div",{style:{fontWeight:"600",marginBottom:"12px"}},"System Settings"),...["Appearance","Network","Sound","Power","Users","About"].map(s=>o("div",{style:{padding:"8px 0",borderBottom:"1px solid #e2e8f0"}},s)));case"Word Processor":return o(on,null);case"IDE":return o(fn,null);case"Trading":return o(hn,null);case"Project Board":return o(ss,{boardId:t||"default",onTitleChange:n||void 0});default:return o("div",{style:r},o("div",{style:{textAlign:"center",padding:"32px",color:"#94a3b8"}},`${e} application content`))}}function jd(e){let{apps:t,user:n,onAppOpen:r,onLogout:i,theme:s="dark",children:a}=e,l=vt(),d=l.activeMenuBar,u=l.dockSignals,h=te(l);h.current=l;let[p,c]=j([]),[m,f]=j([]),[b,y]=j(!1),[g,x]=j(!1),[v,R]=j(null),[D,M]=j({x:0,y:0}),[$,A]=j(null),I=S(()=>{y(ne=>!ne)},[]),P=S(ne=>{f(pe=>pe.filter(ie=>ie.id!==ne))},[]);re(()=>{if(m.length===0)return;let ne=m[0],pe=Date.now()-ne.timestamp,ie=Math.max(0,_d-pe),he=setTimeout(()=>{f(xe=>xe.filter(Ce=>Ce.id!==ne.id))},ie);return()=>clearTimeout(he)},[m]);let L=te(t);L.current=t;let E=te(r);E.current=r;let B=te({});for(let ne of p)if(!B.current[ne.id]){let pe=ne.id;B.current[pe]=ie=>{c(he=>he.map(xe=>xe.id===pe?{...xe,title:ie}:xe))}}let z=S(ne=>{let ie=L.current.find(he=>he.id===ne);ie&&(c(he=>{let Ce=he.filter(Le=>Le.appId===ne).length+1,de=Ce===1?ie.label:`${ie.label} (${Ce})`,be=ls(ne),ke=he.length>0?Math.max(...he.map(Le=>Le.zIndex))+1:1,Re={id:be,appId:ie.id,title:de,icon:ie.icon,x:60+he.length*30,y:40+he.length*30,width:ie.defaultSize?.width??600,height:ie.defaultSize?.height??400,zIndex:ke,focused:!0,windowState:"normal",resizable:ie.resizable!==!1,statusBar:ie.statusBar};return[...he.map(Le=>({...Le,focused:!1})),Re]}),ne==="files"&&h.current.setMenuBar("files",{menus:[{label:"File",items:[{label:"New",shortcut:"Ctrl+N",onClick:()=>{}},{label:"Open",shortcut:"Ctrl+O",onClick:()=>{}},{label:"Save",shortcut:"Ctrl+S",onClick:()=>{}}]},{label:"Edit",items:[{label:"Cut",shortcut:"Ctrl+X",onClick:()=>{}},{label:"Copy",shortcut:"Ctrl+C",onClick:()=>{}},{label:"Paste",shortcut:"Ctrl+V",onClick:()=>{}}]}]}),ne==="terminal"&&h.current.signalDock("terminal",{badge:3}),E.current&&E.current(ne))},[]),k=S(ne=>{c(pe=>{if(!pe.find(xe=>xe.id===ne))return pe;let he=Math.max(...pe.map(xe=>xe.zIndex))+1;return pe.map(xe=>xe.id===ne?{...xe,focused:!0,zIndex:he,windowState:xe.windowState==="minimized"?"normal":xe.windowState}:{...xe,focused:!1})})},[]),w=S(ne=>{c(pe=>{let ie=pe.filter(de=>de.appId===ne);if(ie.length===0)return pe;let xe=[...ie].sort((de,be)=>be.zIndex-de.zIndex)[0],Ce=Math.max(...pe.map(de=>de.zIndex))+1;return pe.map(de=>de.id===xe.id?{...de,focused:!0,zIndex:Ce,windowState:de.windowState==="minimized"?"normal":de.windowState}:{...de,focused:!1})}),c(pe=>{if(pe.filter(he=>he.appId===ne).length===0){let xe=L.current.find(ke=>ke.id===ne);if(!xe)return pe;let Ce=ls(ne),de=pe.length>0?Math.max(...pe.map(ke=>ke.zIndex))+1:1,be={id:Ce,appId:xe.id,title:xe.label,icon:xe.icon,x:60+pe.length*30,y:40+pe.length*30,width:xe.defaultSize?.width??600,height:xe.defaultSize?.height??400,zIndex:de,focused:!0,windowState:"normal",resizable:xe.resizable!==!1,statusBar:xe.statusBar};return ne==="files"&&h.current.setMenuBar("files",{menus:[{label:"File",items:[{label:"New",shortcut:"Ctrl+N",onClick:()=>{}},{label:"Open",shortcut:"Ctrl+O",onClick:()=>{}},{label:"Save",shortcut:"Ctrl+S",onClick:()=>{}}]},{label:"Edit",items:[{label:"Cut",shortcut:"Ctrl+X",onClick:()=>{}},{label:"Copy",shortcut:"Ctrl+C",onClick:()=>{}},{label:"Paste",shortcut:"Ctrl+V",onClick:()=>{}}]}]}),ne==="terminal"&&h.current.signalDock("terminal",{badge:3}),E.current&&E.current(ne),[...pe.map(ke=>({...ke,focused:!1})),be]}return pe})},[]),T=t.map(ne=>{let pe=p.some(xe=>xe.appId===ne.id),ie=u.get(ne.id),he={id:ne.id,icon:ne.icon,label:ie?.tooltip||ne.label,active:pe};return ie&&(ie.badge!=null&&(he.badge=ie.badge>0?ie.badge:void 0),ie.progress!=null&&(he.progress=ie.progress>0?ie.progress:void 0),ie.urgent&&(he.urgent=!0)),he}),C=p.find(ne=>ne.focused),N=C?C.title:void 0,F=S(()=>{x(!0)},[]),_=S(()=>{x(!1)},[]),H=S((ne,pe)=>{R(ne),M(pe)},[]),W=S(()=>{R(null)},[]),V=S(()=>{},[]),K=S(()=>{i&&i()},[i]),Q=[];n&&(Q.push({label:n.name,icon:void 0,onClick:V,divider:!1}),Q.push({label:"",icon:void 0,onClick:V,divider:!0})),Q.push({label:"Lock",icon:void 0,onClick:F,divider:!1}),Q.push({label:"Logout",icon:void 0,onClick:K,divider:!1});let G=q(()=>({width:"100%",height:"100%",minHeight:"500px",display:"flex",flexDirection:"column",fontFamily:'Ubuntu, "Segoe UI", sans-serif',fontSize:"13px",color:s==="dark"?"#ffffff":"#1a1a1a",overflow:"hidden",position:"relative"}),[s]),O={display:"flex",flex:"1",overflow:"hidden"},Y={display:"flex",flexDirection:"column",height:"100%",backgroundColor:s==="dark"?"var(--dock-bg, rgba(0, 0, 0, 0.7))":"var(--dock-bg, rgba(200, 200, 200, 0.9))",borderRight:s==="dark"?"1px solid rgba(255, 255, 255, 0.1)":"1px solid rgba(0, 0, 0, 0.1)",flexShrink:"0"},X={width:"100%",height:"100%",position:"relative"},U=o(en,{activeAppName:N,activitiesButton:{label:"Activities",onClick:I},appMenuBar:d||void 0,clockFormat:"24h",showSeconds:!0,showDate:!0,user:n?{name:n.name,avatar:n.avatar}:void 0,userMenuItems:Q.length>0?Q:void 0,height:Wd}),Z=o(tn,{items:T,orientation:"vertical",position:"left",iconSize:36,onItemClick:w,onItemContextMenu:H}),ee=o(Hd,{toasts:m,onDismiss:P}),ae=p.filter(ne=>ne.windowState!=="minimized").map(ne=>o(kt,{key:ne.id,id:ne.id,title:ne.title,icon:ne.icon,defaultPosition:{x:ne.x,y:ne.y},defaultSize:{width:ne.width,height:ne.height},resizable:ne.resizable,statusBar:ne.statusBar,zIndex:ne.zIndex,focused:ne.focused,windowState:ne.windowState,onClose:()=>{c(pe=>pe.filter(ie=>ie.id!==ne.id))},onFocus:()=>{c(pe=>{let ie=Math.max(...pe.map(he=>he.zIndex))+1;return pe.map(he=>he.id===ne.id?{...he,focused:!0,zIndex:ie}:{...he,focused:!1})})},onMinimize:()=>{c(pe=>pe.map(ie=>ie.id===ne.id?{...ie,windowState:"minimized"}:ie))},onMaximize:()=>{c(pe=>pe.map(ie=>ie.id===ne.id?{...ie,windowState:ie.windowState==="maximized"?"normal":"maximized"}:ie))}},(()=>{let pe=t.find(ie=>ie.id===ne.appId);return pe?.render?pe.render(ne.id):Ud(pe?.label||ne.title,ne.id,B.current[ne.id])})())),J=[];a&&J.push(a),J.push(...ae),J.push(ee);let se=o(nn,{backgroundColor:s==="dark"?"#2c001e":"#e8e0e4",backgroundGradient:s==="dark"?"linear-gradient(135deg, #2c001e 0%, #5e2750 50%, #2c001e 100%)":"linear-gradient(135deg, #e8e0e4 0%, #d4c4d0 50%, #e8e0e4 100%)"},o("div",{className:"unity-desktop__workspace",style:X},...J)),ce=b?o("div",{style:{position:"absolute",inset:"0",zIndex:"100",backgroundColor:"rgba(0, 0, 0, 0.85)",display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(80px, 1fr))",gap:"24px",padding:"48px",alignContent:"start",overflowY:"auto"},onClick:I},...t.map(ne=>o("button",{key:ne.id,style:{display:"flex",flexDirection:"column",alignItems:"center",gap:"8px",background:"none",border:"none",color:"#ffffff",cursor:"pointer",padding:"12px",borderRadius:"8px",fontSize:"12px"},onClick:pe=>{pe.stopPropagation(),y(!1),w(ne.id)}},o("span",{style:{fontSize:"32px",display:"block"}},ne.icon),o("span",null,ne.label)))):null,me=g?o("div",{className:"unity-desktop__lock-overlay",style:{position:"absolute",inset:"0",zIndex:"9999",backgroundColor:"rgba(0,0,0,0.85)",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",cursor:"pointer",color:"#ffffff"},onClick:_},o("div",{style:{fontSize:"64px",marginBottom:"16px"}},"\u{1F512}"),o("div",{style:{fontSize:"24px",fontWeight:"600",marginBottom:"8px"}},"Locked"),o("div",{style:{fontSize:"14px",opacity:"0.7"}},"Click to unlock")):null,ge=(()=>{if(!v)return null;let ne=t.find(de=>de.id===v),pe=p.filter(de=>de.appId===v),ie={padding:"6px 14px",cursor:"pointer"},he={onMouseEnter:de=>{de.currentTarget.style.backgroundColor="#444"},onMouseLeave:de=>{de.currentTarget.style.backgroundColor="transparent"}},xe={borderBottom:"1px solid #444",margin:"4px 0"},Ce=[];return Ce.push(o("div",{key:"new",style:ie,...he,onClick:()=>{z(v),R(null)},role:"menuitem"},"\u25CF New")),pe.length>0&&(Ce.push(o("div",{key:"sep-1",style:xe})),pe.forEach((de,be)=>{let ke=de.title;Ce.push(o("div",{key:`inst-${de.id}`,style:ie,...he,onClick:()=>{k(de.id),R(null)},role:"menuitem"},ke))})),Ce.push(o("div",{key:"sep-2",style:xe})),Ce.push(o("div",{key:"about",style:ie,...he,onClick:()=>{A(v),R(null)},role:"menuitem"},"About")),o("div",{className:"unity-desktop__context-menu-backdrop",style:{position:"absolute",inset:"0",zIndex:"9000"},onClick:W},o("div",{className:"unity-desktop__context-menu",style:{position:"absolute",top:`${D.y}px`,left:`${D.x}px`,backgroundColor:"#2d2d2d",border:"1px solid #555",borderRadius:"6px",padding:"4px 0",minWidth:"160px",boxShadow:"0 4px 12px rgba(0,0,0,0.4)",zIndex:"9001",color:"#ffffff",fontSize:"13px"},onClick:de=>de.stopPropagation()},...Ce))})(),ye=$?t.find(ne=>ne.id===$):null,le=ye?o("div",{className:"unity-desktop__about-backdrop",style:{position:"absolute",inset:"0",zIndex:"9500",backgroundColor:"rgba(0,0,0,0.5)",display:"flex",alignItems:"center",justifyContent:"center"},onClick:()=>A(null)},o("div",{style:{backgroundColor:"#2d2d2d",border:"1px solid #555",borderRadius:"8px",padding:"24px",minWidth:"280px",color:"#ffffff",textAlign:"center"},onClick:ne=>ne.stopPropagation()},o("div",{style:{fontSize:"18px",fontWeight:"600",marginBottom:"8px"}},ye.label),o("div",{style:{fontSize:"13px",marginBottom:"4px",color:"#aaa"}},"SpecifyJS Demo App"),o("div",{style:{fontSize:"13px",marginBottom:"4px",color:"#aaa"}},"MIT License"),o("div",{style:{fontSize:"13px",color:"#aaa"}},"v0.2.47"),o("button",{style:{marginTop:"16px",padding:"6px 16px",border:"1px solid #555",borderRadius:"4px",backgroundColor:"#444",color:"#fff",cursor:"pointer"},onClick:()=>A(null)},"Close"))):null;return o("div",{className:"unity-desktop",style:G,"data-theme":s},o("div",{className:"unity-desktop__top-panel",style:{flexShrink:"0",zIndex:"10"}},U),o("div",{style:O},o("div",{className:"unity-desktop__dock",style:Y},Z),o("main",{className:"unity-desktop__desktop",style:{flex:"1",position:"relative",overflow:"hidden",minHeight:"0"}},se,ce)),ge,le,me)}function cs(e){let{apps:t,user:n,onAppOpen:r,onLogout:i,theme:s="dark",children:a}=e;return o(Qt,{onWindowOpen:r},o(Dt,null,o(zt,null,o(jd,{apps:t,user:n,onAppOpen:r,onLogout:i,theme:s,children:a}))))}function ds(e){let{id:t,title:n,icon:r,defaultPosition:i,defaultSize:s,minSize:a,resizable:l=!0,onClose:d,menuBar:u,statusBar:h,onActivate:p,onDeactivate:c,children:m}=e,f=vt(),b=q(()=>f.windows.find(A=>A.id===t),[f.windows,t]);re(()=>(u?f.setMenuBar(t,u):f.clearMenuBar(t),()=>{f.clearMenuBar(t)}),[u,t,f]);let y=te(!1),g=b?b.focused:!1;re(()=>{let A=y.current;y.current=g,g&&!A?p&&p():!g&&A&&c&&c()},[g,p,c]);let x=S(()=>{f.closeWindow(t),d&&d()},[f,t,d]),v=S(()=>{f.focusWindow(t)},[f,t]),R=S(A=>{f.moveWindow(t,A)},[f,t]),D=S(A=>{f.resizeWindow(t,A)},[f,t]),M=S(()=>{f.minimizeWindow(t)},[f,t]),$=S(()=>{b&&b.windowState==="maximized"?f.restoreWindow(t):f.maximizeWindow(t)},[f,t,b]);return b?o(it,{appId:t},o(kt,{id:t,title:n,icon:r,defaultPosition:b.position,defaultSize:b.size,minSize:a,resizable:l,windowState:b.windowState,focused:b.focused,zIndex:b.zIndex,onClose:x,onFocus:v,onMove:R,onResize:D,onMinimize:M,onMaximize:$,statusBar:h,children:m})):(f.openWindow({id:t,title:n,icon:r,position:i,size:s}),null)}function Gd(e,t){let n=new Set,r=[];for(let i=e.length-1;i>=0;i--)r.push(e[i]);for(;r.length>0;){let i=r.pop();if($e(i)){if(t&&i.container_id===t)continue;i.name&&n.add(i.name);for(let s=i.contents.length-1;s>=0;s--)r.push(i.contents[s])}}return n}function bo(e,t,n){return!e||(!n||t.container_id!==n)&&t.name===e?!1:!Gd(t.contents,n).has(e)}function us(e,t,n){if(!e)return!1;for(let r=0;r<t.length;r++){let i=t[r];if($e(i)&&!(n&&i.container_id===n)&&i.name===e)return!1}return!0}function ps(e,t,n){return bo(e,t,n)}function fs(e){let{value:t,onChange:n,orientation:r="vertical",inputPosition:i="below",delimiter:s,placeholder:a="Add item...",disabled:l=!1,label:d,maxItems:u}=e,h=s??(r==="horizontal"?", ":`
9
9
  `),p=q(()=>Array.from(new Set(t)),[t]),[c,m]=j({type:"closed"}),[f,b]=j(""),[y,g]=j(!1),x=te(null),v=S(()=>{l||u!==void 0&&p.length>=u||(m({type:"add"}),b(""),g(!1))},[l,u,p.length]),R=S(W=>{l||(m({type:"edit",index:W,original:p[W]}),b(p[W]),g(!1))},[l,p]),D=S(()=>{m({type:"closed"}),b(""),g(!1)},[]),M=S(()=>{let W=f.trim();if(W){if(c.type==="add"){if(p.includes(W)){g(!0),b("");return}n([...p,W]),b(""),g(!1)}else if(c.type==="edit"){if(W===c.original){D();return}if(p.includes(W)){g(!0);return}let V=p.slice();V[c.index]=W,n(V),D()}}},[f,c,p,n,D]),$=S(()=>{if(c.type==="edit"){let W=p.filter((V,K)=>K!==c.index);n(W),D()}},[c,p,n,D]),A=S(W=>{let V=W.key;V==="Enter"?(W.preventDefault(),M()):V==="Escape"&&(W.preventDefault(),D())},[M,D]),I=S(W=>{if(l)return;W.key==="+"&&c.type==="closed"&&(W.preventDefault(),v())},[l,c,v]),P={display:"flex",flexDirection:"column",gap:"4px"},L={display:"flex",flexDirection:r==="vertical"?"column":"row",flexWrap:r==="horizontal"?"wrap":"nowrap",gap:r==="vertical"?"2px":"0",alignItems:r==="horizontal"?"center":"stretch"},E={padding:"4px 8px",cursor:l?"default":"pointer",borderRadius:"4px",fontSize:"14px",color:"#1f2937",backgroundColor:"transparent",transition:"background-color 0.1s",border:"1px solid transparent",userSelect:"none"},B={display:"inline-flex",alignItems:"center",justifyContent:"center",border:"1px solid #d1d5db",borderRadius:"6px",backgroundColor:"#ffffff",cursor:l?"not-allowed":"pointer",fontSize:"16px",fontWeight:"700",lineHeight:"1",padding:"4px 10px",color:"#374151",transition:"background-color 0.15s, border-color 0.15s"},z={display:"flex",alignItems:"center",gap:"4px"},k=Ve({},{focused:!1,error:y}),w=[];for(let W=0;W<p.length;W++){let V=p[W];r==="horizontal"&&W>0&&w.push(o("span",{key:`delim-${W}`,style:{color:"#9ca3af",fontSize:"14px",userSelect:"none"},"aria-hidden":"true"},h)),w.push(o("span",{key:`item-${W}`,role:"listitem",tabIndex:l?-1:0,style:E,onClick:l?void 0:()=>R(W),onKeyDown:l?void 0:K=>{K.key==="Enter"&&R(W)}},V))}let T=o("div",{role:"list",style:L},...w),C=l||u!==void 0&&p.length>=u,N=o("button",{type:"button","aria-label":"Add item",style:{...B,opacity:C?"0.5":"1",cursor:C?"not-allowed":"pointer"},disabled:C,onClick:C?void 0:v},"+"),F=null;if(c.type!=="closed"){let W=o("button",{type:"button","aria-label":"Confirm",style:{...B,fontSize:"13px",padding:"4px 8px"},onClick:M},"OK"),V=c.type==="edit"?o("button",{type:"button","aria-label":"Delete",style:{...B,fontSize:"13px",padding:"4px 8px",color:"#ef4444"},onClick:$},"X"):null;F=o("div",{style:z,className:"buildable-list__input-row"},o("input",{ref:x,type:"text",value:f,placeholder:a,"aria-label":c.type==="edit"?"Edit item":"New item",style:{...k,flex:"1",minWidth:"0"},autoFocus:!0,onInput:K=>{b(K.target.value),g(!1)},onKeyDown:A}),W,V)}let _=[];c.type!=="closed"&&i==="above"&&_.push(F),_.push(o("div",{style:{display:"flex",alignItems:"flex-start",gap:"8px"}},T,N)),c.type!=="closed"&&i==="below"&&_.push(F);let H=o("div",{style:P,tabIndex:0,onKeyDown:I,className:"buildable-list"},..._);return o(Pe,{label:d,disabled:l},H)}var ms={sm:{padding:"3px 10px",fontSize:"12px",borderRadius:"4px"},md:{padding:"6px 14px",fontSize:"13px",borderRadius:"6px"},lg:{padding:"8px 20px",fontSize:"15px",borderRadius:"6px"}},gs={primary:{bg:"#3b82f6",color:"white",border:"#3b82f6"},secondary:{bg:"#f8fafc",color:"#0f172a",border:"#d1d5db"},outline:{bg:"transparent",color:"#0f172a",border:"#d1d5db"},ghost:{bg:"transparent",color:"#0f172a",border:"transparent"},danger:{bg:"#ef4444",color:"white",border:"#ef4444"}};function hs(e){let{children:t,onClick:n,variant:r="secondary",size:i="md",disabled:s=!1,fullWidth:a=!1,type:l="button",className:d,style:u,ariaLabel:h,active:p=!1}=e,c=q(()=>{let m=ms[i]??ms.md,f=gs[r]??gs.secondary,b={padding:m.padding,fontSize:m.fontSize,borderRadius:m.borderRadius,border:`1px solid ${f.border}`,backgroundColor:p?"#3b82f6":f.bg,color:p?"white":f.color,cursor:s?"default":"pointer",fontFamily:"inherit",lineHeight:"1.4",display:"inline-flex",alignItems:"center",justifyContent:"center",gap:"4px",transition:"background-color 0.15s, opacity 0.15s",opacity:s?"0.5":"1"};return a&&(b.width="100%"),u&&Object.assign(b,u),b},[r,i,s,a,p,u]);return o("button",{type:l,onClick:s?void 0:n,disabled:s,className:d,style:c,"aria-label":h,"aria-pressed":p?"true":void 0},t)}var Xd=["#3b82f6","#ef4444","#22c55e","#f59e0b","#8b5cf6","#ec4899","#14b8a6","#f97316","#6366f1","#84cc16"],It=Math.PI/180;function Kd(e,t,n,r,i,s,a,l,d,u){let h=Math.cos(r*It),p=Math.sin(r*It),c=Math.cos(i*It),m=Math.sin(i*It),f=Math.cos(s*It),b=Math.sin(s*It),y=e*f-t*b,g=e*b+t*f,x=y*c-g*m,v=y*m+g*c,R=n,D=x,M=v*h-R*p,$=v*p+R*h,A=1+a*.001*$,I=l+D*u*A,P=d-M*u*A;return{sx:I,sy:P,depth:$}}function bs(e,t){let n=e.replace("#",""),r,i,s;return n.length===3?(r=parseInt(n[0]+n[0],16),i=parseInt(n[1]+n[1],16),s=parseInt(n[2]+n[2],16)):(r=parseInt(n.substring(0,2),16),i=parseInt(n.substring(2,4),16),s=parseInt(n.substring(4,6),16)),r=isNaN(r)?0:r,i=isNaN(i)?0:i,s=isNaN(s)?0:s,`rgba(${r},${i},${s},${t})`}function xs(e,t){let n=e.replace("#",""),r,i,s;n.length===3?(r=parseInt(n[0]+n[0],16),i=parseInt(n[1]+n[1],16),s=parseInt(n[2]+n[2],16)):(r=parseInt(n.substring(0,2),16),i=parseInt(n.substring(2,4),16),s=parseInt(n.substring(4,6),16)),r=isNaN(r)?0:r,i=isNaN(i)?0:i,s=isNaN(s)?0:s;let a=d=>Math.max(0,Math.min(255,Math.round(d*t))),l=d=>a(d).toString(16).padStart(2,"0");return"#"+l(r)+l(i)+l(s)}function ys(e){let{layers:t,width:n=700,height:r=500,perspective:i=.5,rotateX:s=35,rotateY:a=45,rotateZ:l=0,showLabels:d=!0,showAxes:u=!0,layerSpacing:h=2,colorScale:p=Xd,gridColor:c="#94a3b8",title:m}=e,f=q(()=>{let z=0,k=0,w=0;for(let T=0;T<t.length;T++){let C=t[T],N=C.data.length;N>z&&(z=N);for(let F=0;F<N;F++){let _=C.data[F].length;_>k&&(k=_);for(let H=0;H<_;H++){let W=Math.abs(C.data[F][H]??0);W>w&&(w=W)}}}return{maxRows:Math.max(z,1),maxCols:Math.max(k,1),maxHeight:w>0?w:1}},[t]),b=q(()=>{let z=f.maxHeight+(t.length-1)*h+f.maxHeight,k=Math.sqrt(f.maxCols*f.maxCols+f.maxRows*f.maxRows+z*z),w=Math.min(n,r)*.75;return k>0?w/k:1},[f,t.length,h,n,r]),y=n/2,g=r/2,x=S((z,k,w)=>Kd(z,k,w,s,a,l,i,y,g,b),[s,a,l,i,y,g,b]),v=S(()=>{if(!u)return[];let z=[],k=Math.max(f.maxCols,f.maxRows),w=f.maxCols/2,T=f.maxRows/2,C=x(-w,-T,0),N=x(w,-T,0);z.push(o("line",{key:"axis-x",x1:String(C.sx),y1:String(C.sy),x2:String(N.sx),y2:String(N.sy),stroke:"#374151","stroke-width":"1.5"})),z.push(o("text",{key:"axis-x-label",x:String(N.sx+8),y:String(N.sy+4),"font-size":"11","font-family":"sans-serif",fill:"#374151"},"X"));let F=x(-w,T,0);z.push(o("line",{key:"axis-y",x1:String(C.sx),y1:String(C.sy),x2:String(F.sx),y2:String(F.sy),stroke:"#374151","stroke-width":"1.5"})),z.push(o("text",{key:"axis-y-label",x:String(F.sx-12),y:String(F.sy+4),"font-size":"11","font-family":"sans-serif",fill:"#374151"},"Y"));let _=f.maxHeight+(t.length-1)*h,H=x(-w,-T,_);return z.push(o("line",{key:"axis-z",x1:String(C.sx),y1:String(C.sy),x2:String(H.sx),y2:String(H.sy),stroke:"#374151","stroke-width":"1.5"})),z.push(o("text",{key:"axis-z-label",x:String(H.sx-4),y:String(H.sy-8),"font-size":"11","font-family":"sans-serif",fill:"#374151"},"Z")),z},[u,f,t.length,h,x]),R=S(()=>{let z=[],k=f.maxCols/2,w=f.maxRows/2,T=[];for(let C=0;C<t.length;C++){let N=t[C],F=N.color??p[C%p.length],_=N.opacity??.7,H=C*h,W=N.data.length;for(let V=0;V<W-1;V++){let K=N.data[V],Q=N.data[V+1],G=Math.min(K.length,Q.length);for(let O=0;O<G-1;O++){let Y=O-k,X=O+1-k,U=V-w,Z=V+1-w,ee=(K[O]??0)+H,ae=(K[O+1]??0)+H,J=(Q[O]??0)+H,se=(Q[O+1]??0)+H,ce=x(Y,U,ee),me=x(X,U,ae),ge=x(Y,Z,J),ye=x(X,Z,se),le=(ce.depth+me.depth+ge.depth+ye.depth)/4,ne=`${ce.sx},${ce.sy} ${me.sx},${me.sy} ${ye.sx},${ye.sy} ${ge.sx},${ge.sy}`;T.push({points:ne,fill:bs(F,_),stroke:xs(F,.7),strokeWidth:"0.5",depth:le,key:`quad-${C}-${V}-${O}`})}}if(W===1||W>0&&N.data[0].length===1)for(let V=0;V<W;V++){let K=N.data[V];for(let Q=0;Q<K.length;Q++){let G=Q-k,O=V-w,Y=(K[Q]??0)+H,X=x(G,O,Y),U=3,Z=`${X.sx},${X.sy-U} ${X.sx+U},${X.sy} ${X.sx},${X.sy+U} ${X.sx-U},${X.sy}`;T.push({points:Z,fill:bs(F,_),stroke:xs(F,.7),strokeWidth:"0.5",depth:X.depth,key:`point-${C}-${V}-${Q}`})}}}T.sort((C,N)=>C.depth-N.depth);for(let C=0;C<T.length;C++){let N=T[C];z.push(o("polygon",{key:N.key,points:N.points,fill:N.fill,stroke:N.stroke,"stroke-width":N.strokeWidth,"stroke-linejoin":"round"}))}return z},[t,f,h,p,x]),D=S(()=>{let z=[],k=f.maxCols/2,w=f.maxRows/2;for(let T=0;T<=f.maxRows;T++){let C=T-w,N=x(-k,C,0),F=x(k,C,0);z.push(o("line",{key:`base-h-${T}`,x1:String(N.sx),y1:String(N.sy),x2:String(F.sx),y2:String(F.sy),stroke:c,"stroke-width":"0.3","stroke-dasharray":"2 2",opacity:"0.5"}))}for(let T=0;T<=f.maxCols;T++){let C=T-k,N=x(C,-w,0),F=x(C,w,0);z.push(o("line",{key:`base-v-${T}`,x1:String(N.sx),y1:String(N.sy),x2:String(F.sx),y2:String(F.sy),stroke:c,"stroke-width":"0.3","stroke-dasharray":"2 2",opacity:"0.5"}))}return z},[f,c,x]),M=S(()=>{if(!d)return[];let z=[],k=f.maxCols/2,w=f.maxRows/2;for(let T=0;T<t.length;T++){let C=t[T],N=T*h,F=0,_=0;for(let K=0;K<C.data.length;K++){let Q=C.data[K];for(let G=0;G<Q.length;G++)F+=Q[G]??0,_++}let H=_>0?F/_:0,W=x(k+1,0,H+N),V=C.color??p[T%p.length];z.push(o("text",{key:`layer-label-${T}`,x:String(W.sx+8),y:String(W.sy+4),"font-size":"11","font-family":"sans-serif","font-weight":"bold",fill:V},C.label))}return z},[d,t,f,h,p,x]),A=S(()=>m?[o("text",{key:"title",x:String(n/2),y:String(24),"text-anchor":"middle","font-size":"16","font-weight":"bold","font-family":"sans-serif",fill:"#111827"},m)]:[],[m,n])(),I=D(),P=v(),L=R(),E=M(),B=t.length===0?[o("text",{key:"empty-msg",x:String(n/2),y:String(r/2),"text-anchor":"middle","font-size":"14","font-family":"sans-serif",fill:"#9ca3af"},"No layer data")]:[];return o("svg",{width:"100%",viewBox:`0 0 ${n} ${r}`,preserveAspectRatio:"xMidYMid meet",xmlns:"http://www.w3.org/2000/svg",role:"img","aria-label":m??"3D layer visualization",style:{fontFamily:"sans-serif",maxWidth:"100%"}},...A,...B,...I,...P,...L,...E)}function qd(e){if(typeof e=="string")return e;if(!isFinite(e)||isNaN(e))return"--";let t=e.toString().split("."),n=t[0],r=t.length>1?"."+t[1]:"",i=n.startsWith("-"),s=i?n.slice(1):n,a="";for(let l=0;l<s.length;l++)l>0&&(s.length-l)%3===0&&(a+=","),a+=s[l];return(i?"-":"")+a+r}function Zd(e){if(!isFinite(e)||isNaN(e))return"--";let t=Math.abs(e);return t<100&&t!==Math.floor(t)?t.toFixed(1):String(Math.round(t))}function Ss(e){let{value:t,label:n,prefix:r="",suffix:i="",trend:s,trendLabel:a,sparkline:l,width:d=280,height:u=160,valueColor:h="currentColor",trendUpColor:p="#22c55e",trendDownColor:c="#ef4444",backgroundColor:m="#ffffff"}=e,f=q(()=>qd(t),[t]),b=s!=null&&isFinite(s)&&!isNaN(s),y=l!=null&&l.length>1,g=n!=null&&n.length>0,x=b&&s>=0?p:c,v=20,R=g?u*.38:u*.45,D=Math.min(d*.15,48),M=D*.55,$=R+D*.4+8,A=g?$+22:R+D*.4+22,I=y?Math.min(u*.22,36):0,P=u-v-I,L=d-v*2,E=S(()=>[o("rect",{key:"bg",x:"0",y:"0",width:"100%",rx:"8",ry:"8",fill:m,stroke:"#e5e7eb","stroke-width":"1"})],[d,u,m]),B=S(()=>{let W=[],V=r+f+i;return W.push(o("text",{key:"value",x:String(d/2),y:String(R),"text-anchor":"middle","dominant-baseline":"central","font-size":String(D),"font-weight":"bold","font-family":"sans-serif",fill:h,"aria-label":`Value: ${V}`},r?o("tspan",{key:"prefix","font-size":String(M),"font-weight":"normal"},r):null,f,i?o("tspan",{key:"suffix","font-size":String(M),"font-weight":"normal"},i):null)),W},[d,R,D,M,f,r,i,h]),z=S(()=>g?[o("text",{key:"label",x:String(d/2),y:String($),"text-anchor":"middle","font-size":"13","font-family":"sans-serif",fill:"currentColor",opacity:"0.6"},n)]:[],[g,d,$,n]),k=S(()=>{if(!b)return[];let W=[],V=s,K=V>=0,Q=8,G=Zd(V),O=(K?"+":"-")+G+(a?" "+a:""),Y=d/2-40,X=A;if(K){let U=`${Y},${X} ${Y-Q/2},${X+Q} ${Y+Q/2},${X+Q}`;W.push(o("polygon",{key:"trend-arrow",points:U,fill:x}))}else{let U=`${Y},${X+Q} ${Y-Q/2},${X} ${Y+Q/2},${X}`;W.push(o("polygon",{key:"trend-arrow",points:U,fill:x}))}return W.push(o("text",{key:"trend-text",x:String(Y+Q+4),y:String(X+Q*.7),"text-anchor":"start","font-size":"12","font-family":"sans-serif",fill:x,"aria-label":`Trend: ${O}`},O)),W},[b,s,a,x,d,A]),w=S(()=>{if(!y)return[];let W=[],V=l,K=[];for(let ee of V)typeof ee=="number"&&isFinite(ee)&&!isNaN(ee)&&K.push(ee);if(K.length<2)return[];let Q=1/0,G=-1/0;for(let ee of K)ee<Q&&(Q=ee),ee>G&&(G=ee);Q===G&&(Q-=1,G+=1);let O=G-Q,Y=L/(K.length-1),X="";for(let ee=0;ee<K.length;ee++){let ae=v+ee*Y,J=P+I-(K[ee]-Q)/O*I;ee===0?X+=`M ${ae} ${J}`:X+=` L ${ae} ${J}`}let U=v+(K.length-1)*Y,Z=X+` L ${U} ${P+I} L ${v} ${P+I} Z`;return W.push(o("defs",{key:"spark-defs"},o("linearGradient",{key:"spark-grad",id:"sparkGrad",x1:"0",y1:"0",x2:"0",y2:"1"},o("stop",{key:"stop1",offset:"0%","stop-color":"#3b82f6","stop-opacity":"0.3"}),o("stop",{key:"stop2",offset:"100%","stop-color":"#3b82f6","stop-opacity":"0.05"})))),W.push(o("path",{key:"spark-fill",d:Z,fill:"url(#sparkGrad)"})),W.push(o("path",{key:"spark-line",d:X,fill:"none",stroke:"#3b82f6","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"})),W},[y,l,L,P,I,v]),T=E(),C=B(),N=z(),F=k(),_=w(),H=`${r}${f}${i}${g?`, ${n}`:""}`;return o("svg",{width:"100%",viewBox:`0 0 ${d} ${u}`,preserveAspectRatio:"xMidYMid meet",xmlns:"http://www.w3.org/2000/svg",role:"img","aria-label":H,style:{fontFamily:"sans-serif"}},...T,..._,...C,...N,...F)}var Cn=Math.PI/180;function Jd(e,t,n,r,i,s,a,l){let d=Math.cos(r*Cn),u=Math.sin(r*Cn),h=Math.cos(i*Cn),p=Math.sin(i*Cn),c=e*h+n*p,m=-e*p+n*h,f=t*d-m*u,b=t*u+m*d;return{sx:s+c*l,sy:a-f*l,depth:b}}function Rt(e){return{x:Math.sin(e.theta)*Math.cos(e.phi),y:Math.sin(e.theta)*Math.sin(e.phi),z:Math.cos(e.theta)}}function Mn(e,t,n){let r=Math.sqrt(e*e+t*t+n*n);if(r<1e-10)return{theta:0,phi:0};let i=e/r,s=t/r,a=n/r,l=Math.acos(Math.max(-1,Math.min(1,a))),d=Math.atan2(s,i);return{theta:l,phi:d<0?d+2*Math.PI:d}}function lt(e,t,n){let{x:r,y:i,z:s}=Rt(e),a=Math.cos(n),l=Math.sin(n),d,u,h;return t==="x"?(d=r,u=i*a-s*l,h=i*l+s*a):t==="y"?(d=r*a+s*l,u=i,h=-r*l+s*a):(d=r*a-i*l,u=r*l+i*a,h=s),Mn(d,u,h)}function xo(e,t){let n=t.angle??Math.PI;switch(t.gate){case"X":return lt(e,"x",Math.PI);case"Y":return lt(e,"y",Math.PI);case"Z":return lt(e,"z",Math.PI);case"H":{let{x:r,y:i,z:s}=Rt(e);return Mn(s,-i,r)}case"S":return lt(e,"z",Math.PI/2);case"T":return lt(e,"z",Math.PI/4);case"Rx":return lt(e,"x",n);case"Ry":return lt(e,"y",n);case"Rz":return lt(e,"z",n)}}function vs(e){let{state:t,gates:n,width:r=400,height:i=400,rotateY:s=-25,rotateX:a=15,zoom:l=1,interactive:d=!0,zoomable:u=!0,showVector:h=!0,showLabels:p=!0,showWireframe:c=!0,showTrail:m=!0,trailMaxPoints:f=200,trailColor:b="#ef4444",wireframeColor:y="#cbd5e1",vectorColor:g="#3b82f6",backgroundColor:x,sphereRadius:v=130,title:R,onStateChange:D}=e,[M,$]=j(t??{theta:0,phi:0}),[A,I]=j(s),[P,L]=j(a),[E,B]=j(l),z=te([]),k=te(!1),w=te(null),T=te(null);re(()=>{t&&$(t)},[t?.theta,t?.phi]);let C=te(0);re(()=>{if(!n||n.length===0)return;C.current=0;let Y=0,X=()=>{C.current>=n.length||($(U=>{let Z=xo(U,n[C.current]);return C.current++,D&&D(Z),Z}),Y=requestAnimationFrame(X))};return Y=requestAnimationFrame(X),()=>cancelAnimationFrame(Y)},[n]),re(()=>{let Y=Rt(M);z.current.push(Y),z.current.length>f&&z.current.splice(0,z.current.length-f)},[M.theta,M.phi]);let N=v*E,F=r/2,_=i/2,H=S((Y,X,U)=>Jd(Y,X,U,P,A,F,_,N),[P,A,F,_,N]),W=S(Y=>{if(!d)return;let X=Y;k.current=!0,w.current={mx:X.clientX,my:X.clientY,rx:P,ry:A}},[d,P,A]),V=S(Y=>{if(!k.current||!w.current)return;let X=Y,U=w.current;I(U.ry+(X.clientX-U.mx)*.5),L(U.rx-(X.clientY-U.my)*.5)},[]),K=S(()=>{k.current=!1},[]),Q=S(Y=>{if(!u)return;let X=Y;X.preventDefault(),B(U=>Math.max(.5,Math.min(3,U*(X.deltaY>0?.95:1.05))))},[u]),G=[];if(x&&G.push(o("rect",{key:"bg",x:"0",y:"0",width:String(r),height:String(i),fill:x,rx:"6"})),R&&G.push(o("text",{key:"title",x:String(F),y:"24","text-anchor":"middle","font-size":"14","font-weight":"bold","font-family":"sans-serif",fill:"#374151"},R)),c){let X=[];for(let ee=0;ee<=60;ee++){let ae=ee/60*2*Math.PI,J=H(Math.cos(ae),Math.sin(ae),0);X.push(`${ee===0?"M":"L"}${J.sx.toFixed(1)},${J.sy.toFixed(1)}`)}G.push(o("path",{key:"eq",d:X.join(" "),fill:"none",stroke:y,"stroke-width":"0.8",opacity:"0.5"}));let U=[];for(let ee=0;ee<=60;ee++){let ae=ee/60*2*Math.PI,J=H(Math.cos(ae),0,Math.sin(ae));U.push(`${ee===0?"M":"L"}${J.sx.toFixed(1)},${J.sy.toFixed(1)}`)}G.push(o("path",{key:"xz",d:U.join(" "),fill:"none",stroke:y,"stroke-width":"0.8",opacity:"0.4"}));let Z=[];for(let ee=0;ee<=60;ee++){let ae=ee/60*2*Math.PI,J=H(0,Math.cos(ae),Math.sin(ae));Z.push(`${ee===0?"M":"L"}${J.sx.toFixed(1)},${J.sy.toFixed(1)}`)}G.push(o("path",{key:"yz",d:Z.join(" "),fill:"none",stroke:y,"stroke-width":"0.8",opacity:"0.4"}))}let O=[{id:"x",dir:[1,0,0],color:"#ef4444"},{id:"y",dir:[0,1,0],color:"#22c55e"},{id:"z",dir:[0,0,1],color:"#3b82f6"}];for(let Y of O){let X=H(Y.dir[0]*1.15,Y.dir[1]*1.15,Y.dir[2]*1.15),U=H(-Y.dir[0]*1.15,-Y.dir[1]*1.15,-Y.dir[2]*1.15),Z=H(0,0,0);G.push(o("line",{key:`axis-${Y.id}`,x1:String(U.sx),y1:String(U.sy),x2:String(X.sx),y2:String(X.sy),stroke:Y.color,"stroke-width":"0.8",opacity:"0.4","stroke-dasharray":"3 3"}))}if(p){let Y=[{text:"|0\u27E9",pos:[0,0,1.3]},{text:"|1\u27E9",pos:[0,0,-1.3]},{text:"|+\u27E9",pos:[1.3,0,0]},{text:"|-\u27E9",pos:[-1.3,0,0]},{text:"|+i\u27E9",pos:[0,1.3,0]},{text:"|-i\u27E9",pos:[0,-1.3,0]}];for(let X of Y){let U=H(X.pos[0],X.pos[1],X.pos[2]);G.push(o("text",{key:`lbl-${X.text}`,x:String(U.sx),y:String(U.sy),"text-anchor":"middle","dominant-baseline":"central","font-size":"11","font-family":"serif",fill:"#475569",style:{pointerEvents:"none"}},X.text))}}if(m&&z.current.length>1){let Y=z.current,X=[];for(let U=0;U<Y.length;U++){let Z=Y[U],ee=H(Z.x,Z.y,Z.z);X.push(`${U===0?"M":"L"}${ee.sx.toFixed(1)},${ee.sy.toFixed(1)}`)}G.push(o("path",{key:"trail",d:X.join(" "),fill:"none",stroke:b,"stroke-width":"1.5",opacity:"0.5","stroke-linecap":"round","stroke-linejoin":"round"}))}if(h){let Y=Rt(M),X=H(0,0,0),U=H(Y.x,Y.y,Y.z);G.push(o("line",{key:"vec-line",x1:String(X.sx),y1:String(X.sy),x2:String(U.sx),y2:String(U.sy),stroke:g,"stroke-width":"2.5","stroke-linecap":"round"})),G.push(o("circle",{key:"vec-point",cx:String(U.sx),cy:String(U.sy),r:"5",fill:g,stroke:"#fff","stroke-width":"1.5"}));let Z=(M.theta*180/Math.PI).toFixed(0),ee=(M.phi*180/Math.PI).toFixed(0);G.push(o("text",{key:"state-label",x:String(r-10),y:String(i-10),"text-anchor":"end","font-size":"10","font-family":"monospace",fill:"#64748b"},`\u03B8=${Z}\xB0 \u03C6=${ee}\xB0`))}return o("svg",{ref:T,width:"100%",viewBox:`0 0 ${r} ${i}`,preserveAspectRatio:"xMidYMid meet",xmlns:"http://www.w3.org/2000/svg",role:"img","aria-label":R??"Bloch sphere quantum state visualization",style:{fontFamily:"sans-serif",cursor:d?k.current?"grabbing":"grab":"default"},onMouseDown:d?W:void 0,onMouseMove:d?V:void 0,onMouseUp:d?K:void 0,onMouseLeave:d?K:void 0,onWheel:u?Q:void 0},...G)}function Qd(e){let t=[];for(let n=0;n<e.length;n++){let r=e[n];typeof r=="number"&&isFinite(r)&&!isNaN(r)&&t.push(r)}return t.sort((n,r)=>n-r),t}function yo(e,t){if(e.length===0)return 0;if(e.length===1)return e[0];let n=t/100*(e.length-1),r=Math.floor(n),i=Math.ceil(n);if(r===i)return e[r];let s=n-r;return e[r]+s*(e[i]-e[r])}function So(e){let t=Qd(e);if(t.length===0)return null;let n=yo(t,25),r=yo(t,50),i=yo(t,75),s=i-n,a=n-1.5*s,l=i+1.5*s,d=t[0];for(let m of t)if(m>=a){d=m;break}let u=t[t.length-1];for(let m=t.length-1;m>=0;m--)if(t[m]<=l){u=t[m];break}let h=0;for(let m of t)h+=m;let p=h/t.length,c=[];for(let m of t)(m<a||m>l)&&c.push(m);return{q1:n,median:r,q3:i,iqr:s,whiskerLow:d,whiskerHigh:u,mean:p,outliers:c,min:t[0],max:t[t.length-1]}}function eu(e){if(e<=0)return 1;let t=e/5,n=Math.pow(10,Math.floor(Math.log10(t))),r=t/n;return r<=1.5?n:r<=3.5?2*n:r<=7.5?5*n:10*n}function ws(e){let{data:t=[],width:n=600,height:r=400,orientation:i="vertical",showOutliers:s=!0,showMean:a=!1,whiskerColor:l="#374151",boxWidth:d=.6,showGrid:u=!0,title:h,padding:p=60}=e,c=i==="vertical",m=n-p*2,f=r-p*2,b=["#3b82f6","#ef4444","#22c55e","#f59e0b","#8b5cf6","#ec4899","#14b8a6","#f97316","#6366f1","#84cc16"],y=q(()=>{let w=[];for(let T of t)w.push(So(T.values));return w},[t]),g=q(()=>{let w=1/0,T=-1/0;for(let F of y){if(F===null)continue;let _=s&&F.outliers.length>0?Math.min(F.whiskerLow,F.outliers[0]):F.whiskerLow,H=s&&F.outliers.length>0?Math.max(F.whiskerHigh,F.outliers[F.outliers.length-1]):F.whiskerHigh;_<w&&(w=_),H>T&&(T=H)}isFinite(w)||(w=0,T=1);let C=T-w,N=C>0?C*.05:.5;return{min:w-N,max:T+N}},[y,s]),x=c?f:m,v=c?m:f,R=t.length>0?t.length:1,D=v/R,M=D*Math.min(Math.max(d,.1),.95),$=S(w=>{let T=g.max-g.min;return T===0?x/2:(w-g.min)/T*x},[g,x]),A=S(()=>{if(!u)return[];let w=[],T=g.max-g.min,C=eu(T),N=Math.ceil(g.min/C)*C;for(let F=N;F<=g.max;F+=C){let _=$(F),H=String(Math.round(F*1e3)/1e3);if(c){let W=p+f-_;w.push(o("line",{key:`grid-${F}`,x1:String(p),y1:String(W),x2:String(p+m),y2:String(W),stroke:"#e5e7eb","stroke-width":"1","stroke-dasharray":"4 2"})),w.push(o("text",{key:`glabel-${F}`,x:String(p-6),y:String(W+4),"text-anchor":"end","font-size":"11","font-family":"sans-serif",fill:"#6b7280"},H))}else{let W=p+_;w.push(o("line",{key:`grid-${F}`,x1:String(W),y1:String(p),x2:String(W),y2:String(p+f),stroke:"#e5e7eb","stroke-width":"1","stroke-dasharray":"4 2"})),w.push(o("text",{key:`glabel-${F}`,x:String(W),y:String(p+f+16),"text-anchor":"middle","font-size":"11","font-family":"sans-serif",fill:"#6b7280"},H))}}return w},[u,g,$,c,p,m,f]),I=S(()=>{let w=[];return w.push(o("line",{key:"axis-value",x1:String(p),y1:String(c?p:p+f),x2:String(p),y2:String(p+f),stroke:"#374151","stroke-width":"1.5"})),w.push(o("line",{key:"axis-category",x1:String(p),y1:String(p+f),x2:String(p+m),y2:String(p+f),stroke:"#374151","stroke-width":"1.5"})),w},[p,m,f,c]),P=S(()=>{let w=[];for(let T=0;T<t.length;T++){let C=y[T];if(C===null)continue;let N=t[T],F=N.color??b[T%b.length],_=D*T+D/2,H=M/2;if(c){let W=p+f-$(C.q1),V=p+f-$(C.q3),K=p+f-$(C.median),Q=p+f-$(C.whiskerLow),G=p+f-$(C.whiskerHigh),O=p+_;w.push(o("line",{key:`wl-${T}`,x1:String(O),y1:String(W),x2:String(O),y2:String(Q),stroke:l,"stroke-width":"1.5"})),w.push(o("line",{key:`wlc-${T}`,x1:String(O-H*.4),y1:String(Q),x2:String(O+H*.4),y2:String(Q),stroke:l,"stroke-width":"1.5"})),w.push(o("line",{key:`wh-${T}`,x1:String(O),y1:String(V),x2:String(O),y2:String(G),stroke:l,"stroke-width":"1.5"})),w.push(o("line",{key:`whc-${T}`,x1:String(O-H*.4),y1:String(G),x2:String(O+H*.4),y2:String(G),stroke:l,"stroke-width":"1.5"}));let Y=Math.min(W,V),X=Math.abs(W-V);if(w.push(o("rect",{key:`box-${T}`,x:String(O-H),y:String(Y),width:String(M),height:String(Math.max(X,1)),fill:F,stroke:l,"stroke-width":"1.5",opacity:"0.8","aria-label":`${N.label}: Q1=${C.q1.toFixed(1)}, median=${C.median.toFixed(1)}, Q3=${C.q3.toFixed(1)}`,role:"img"})),w.push(o("line",{key:`med-${T}`,x1:String(O-H),y1:String(K),x2:String(O+H),y2:String(K),stroke:"#fff","stroke-width":"2.5"})),a){let U=p+f-$(C.mean);w.push(o("circle",{key:`mean-${T}`,cx:String(O),cy:String(U),r:"3.5",fill:"#fff",stroke:l,"stroke-width":"1.5","aria-label":`Mean: ${C.mean.toFixed(1)}`}))}if(s)for(let U=0;U<C.outliers.length;U++){let Z=p+f-$(C.outliers[U]);w.push(o("circle",{key:`out-${T}-${U}`,cx:String(O),cy:String(Z),r:"3",fill:"none",stroke:l,"stroke-width":"1.5","aria-label":`Outlier: ${C.outliers[U]}`}))}w.push(o("text",{key:`cat-${T}`,x:String(O),y:String(p+f+18),"text-anchor":"middle","font-size":"11","font-family":"sans-serif",fill:"#374151"},N.label))}else{let W=p+$(C.q1),V=p+$(C.q3),K=p+$(C.median),Q=p+$(C.whiskerLow),G=p+$(C.whiskerHigh),O=p+_;w.push(o("line",{key:`wl-${T}`,x1:String(W),y1:String(O),x2:String(Q),y2:String(O),stroke:l,"stroke-width":"1.5"})),w.push(o("line",{key:`wlc-${T}`,x1:String(Q),y1:String(O-H*.4),x2:String(Q),y2:String(O+H*.4),stroke:l,"stroke-width":"1.5"})),w.push(o("line",{key:`wh-${T}`,x1:String(V),y1:String(O),x2:String(G),y2:String(O),stroke:l,"stroke-width":"1.5"})),w.push(o("line",{key:`whc-${T}`,x1:String(G),y1:String(O-H*.4),x2:String(G),y2:String(O+H*.4),stroke:l,"stroke-width":"1.5"}));let Y=Math.min(W,V),X=Math.abs(V-W);if(w.push(o("rect",{key:`box-${T}`,x:String(Y),y:String(O-H),width:String(Math.max(X,1)),height:String(M),fill:F,stroke:l,"stroke-width":"1.5",opacity:"0.8","aria-label":`${N.label}: Q1=${C.q1.toFixed(1)}, median=${C.median.toFixed(1)}, Q3=${C.q3.toFixed(1)}`,role:"img"})),w.push(o("line",{key:`med-${T}`,x1:String(K),y1:String(O-H),x2:String(K),y2:String(O+H),stroke:"#fff","stroke-width":"2.5"})),a){let U=p+$(C.mean);w.push(o("circle",{key:`mean-${T}`,cx:String(U),cy:String(O),r:"3.5",fill:"#fff",stroke:l,"stroke-width":"1.5","aria-label":`Mean: ${C.mean.toFixed(1)}`}))}if(s)for(let U=0;U<C.outliers.length;U++){let Z=p+$(C.outliers[U]);w.push(o("circle",{key:`out-${T}-${U}`,cx:String(Z),cy:String(O),r:"3",fill:"none",stroke:l,"stroke-width":"1.5","aria-label":`Outlier: ${C.outliers[U]}`}))}w.push(o("text",{key:`cat-${T}`,x:String(p-6),y:String(O+4),"text-anchor":"end","font-size":"11","font-family":"sans-serif",fill:"#374151"},N.label))}}return w},[t,y,$,c,p,m,f,D,M,l,s,a,b]),L=S(()=>h?[o("text",{key:"title",x:String(n/2),y:String(p/2+4),"text-anchor":"middle","font-size":"16","font-weight":"bold","font-family":"sans-serif",fill:"#111827"},h)]:[],[h,n,p]),E=A(),B=I(),z=P(),k=L();return o("svg",{width:"100%",viewBox:`0 0 ${n} ${r}`,preserveAspectRatio:"xMidYMid meet",xmlns:"http://www.w3.org/2000/svg",role:"img","aria-label":h??"Box plot",style:{fontFamily:"sans-serif"}},...k,...E,...B,...z)}function ks(e){if(e<=0)return 1;let t=e/5,n=Math.pow(10,Math.floor(Math.log10(t))),r=t/n;return r<=1.5?n:r<=3.5?2*n:r<=7.5?5*n:10*n}function tu(e,t,n){return e<t?t:e>n?n:e}function vo(e){return typeof e=="number"&&isFinite(e)&&!isNaN(e)}function Cs(e){let{data:t=[],width:n=600,height:r=400,xLabel:i,yLabel:s,showGrid:a=!0,showAxes:l=!0,showLabels:d=!1,maxBubbleRadius:u=40,minBubbleRadius:h=4,defaultColor:p="#3b82f6",opacity:c=.7,title:m,padding:f=60}=e,b=q(()=>{let z=[];for(let k=0;k<t.length;k++){let w=t[k];vo(w.x)&&vo(w.y)&&vo(w.r)&&z.push(w)}return z},[t]),y=n-f*2,g=r-f*2,x=q(()=>{if(b.length===0)return{xMin:0,xMax:1,yMin:0,yMax:1,rMin:0,rMax:1};let z=1/0,k=-1/0,w=1/0,T=-1/0,C=1/0,N=-1/0;for(let F of b)F.x<z&&(z=F.x),F.x>k&&(k=F.x),F.y<w&&(w=F.y),F.y>T&&(T=F.y),F.r<C&&(C=F.r),F.r>N&&(N=F.r);return z===k&&(z-=1,k+=1),w===T&&(w-=1,T+=1),C===N&&(C=0,N=N>0?N:1),{xMin:z,xMax:k,yMin:w,yMax:T,rMin:C,rMax:N}},[b]),v=S(z=>{let k=x.xMax-x.xMin;return f+(z-x.xMin)/k*y},[x,f,y]),R=S(z=>{let k=x.yMax-x.yMin;return f+g-(z-x.yMin)/k*g},[x,f,g]),D=S(z=>{let k=x.rMax-x.rMin;if(k===0)return(h+u)/2;let w=(z-x.rMin)/k;return h+w*(u-h)},[x,h,u]),M=S(()=>{if(!a)return[];let z=[],k=ks(x.xMax-x.xMin),w=Math.ceil(x.xMin/k)*k;for(let N=w;N<=x.xMax;N+=k){let F=v(N);z.push(o("line",{key:`grid-x-${N}`,x1:String(F),y1:String(f),x2:String(F),y2:String(f+g),stroke:"#e5e7eb","stroke-width":"1","stroke-dasharray":"4 2"})),z.push(o("text",{key:`grid-xlabel-${N}`,x:String(F),y:String(f+g+16),"text-anchor":"middle","font-size":"11","font-family":"sans-serif",fill:"#6b7280"},String(Math.round(N*1e3)/1e3)))}let T=ks(x.yMax-x.yMin),C=Math.ceil(x.yMin/T)*T;for(let N=C;N<=x.yMax;N+=T){let F=R(N);z.push(o("line",{key:`grid-y-${N}`,x1:String(f),y1:String(F),x2:String(f+y),y2:String(F),stroke:"#e5e7eb","stroke-width":"1","stroke-dasharray":"4 2"})),z.push(o("text",{key:`grid-ylabel-${N}`,x:String(f-6),y:String(F+4),"text-anchor":"end","font-size":"11","font-family":"sans-serif",fill:"#6b7280"},String(Math.round(N*1e3)/1e3)))}return z},[a,x,v,R,f,y,g]),$=S(()=>{if(!l)return[];let z=[];return z.push(o("line",{key:"axis-y",x1:String(f),y1:String(f),x2:String(f),y2:String(f+g),stroke:"#374151","stroke-width":"1.5"})),z.push(o("line",{key:"axis-x",x1:String(f),y1:String(f+g),x2:String(f+y),y2:String(f+g),stroke:"#374151","stroke-width":"1.5"})),i&&z.push(o("text",{key:"x-label",x:String(f+y/2),y:String(f+g+40),"text-anchor":"middle","font-size":"13","font-family":"sans-serif",fill:"#374151"},i)),s&&z.push(o("text",{key:"y-label",x:String(f-40),y:String(f+g/2),"text-anchor":"middle","font-size":"13","font-family":"sans-serif",fill:"#374151",transform:`rotate(-90, ${f-40}, ${f+g/2})`},s)),z},[l,f,y,g,i,s]),A=S(()=>{let z=[];for(let k=0;k<b.length;k++){let w=b[k],T=v(w.x),C=R(w.y),N=tu(D(w.r),h,u),F=w.color??p;z.push(o("circle",{key:`bubble-${k}`,cx:String(T),cy:String(C),r:String(N),fill:F,opacity:String(c),stroke:F,"stroke-width":"1","stroke-opacity":"0.8","aria-label":w.label??`Bubble at (${w.x}, ${w.y}) size ${w.r}`,role:"img"})),d&&w.label&&z.push(o("text",{key:`label-${k}`,x:String(T),y:String(C-N-4),"text-anchor":"middle","font-size":"10","font-family":"sans-serif",fill:"#374151"},w.label))}return z},[b,v,R,D,p,c,d,h,u]),I=S(()=>m?[o("text",{key:"title",x:String(n/2),y:String(f/2+4),"text-anchor":"middle","font-size":"16","font-weight":"bold","font-family":"sans-serif",fill:"#111827"},m)]:[],[m,n,f]),P=M(),L=$(),E=A(),B=I();return o("svg",{width:"100%",viewBox:`0 0 ${n} ${r}`,preserveAspectRatio:"xMidYMid meet",xmlns:"http://www.w3.org/2000/svg",role:"img","aria-label":m??"Bubble chart",style:{fontFamily:"sans-serif"}},...B,...P,...L,...E)}var nu=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],ou=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"];function ru(e){let t=e.split("-");return t.length!==3?new Date(NaN):new Date(parseInt(t[0],10),parseInt(t[1],10)-1,parseInt(t[2],10))}function Ms(e){let t=e.getFullYear(),n=String(e.getMonth()+1).padStart(2,"0"),r=String(e.getDate()).padStart(2,"0");return`${t}-${n}-${r}`}function Es(e){let t=e.replace("#",""),n=t.length===3?t[0]+t[0]+t[1]+t[1]+t[2]+t[2]:t,r=parseInt(n,16);return{r:r>>16&255,g:r>>8&255,b:r&255}}function iu(e,t,n){let r=i=>{let s=Math.max(0,Math.min(255,Math.round(i))).toString(16);return s.length===1?"0"+s:s};return`#${r(e)}${r(t)}${r(n)}`}function su(e,t){if(t.length===0)return"#000000";if(t.length===1)return t[0];let n=Math.max(0,Math.min(1,e)),r=t.length-1,i=Math.min(Math.floor(n*r),r-1),s=n*r-i,a=Es(t[i]),l=Es(t[i+1]);return iu(a.r+(l.r-a.r)*s,a.g+(l.g-a.g)*s,a.b+(l.b-a.b)*s)}var au=["#9be9a8","#40c463","#30a14e","#216e39"];function Is(e){let{data:t=[],width:n=800,height:r=160,colorScale:i=au,cellSize:s=12,cellGap:a=2,showMonthLabels:l=!0,showDayLabels:d=!0,emptyColor:u="#ebedf0",title:h}=e,{dateMap:p,startDate:c,endDate:m,maxVal:f}=q(()=>{let E=new Map,B=0,z=null,k=null;for(let C of t){let N=ru(C.date);if(isNaN(N.getTime()))continue;let F=Ms(N);E.set(F,(E.get(F)??0)+C.value);let _=E.get(F);_>B&&(B=_),(z===null||N<z)&&(z=N),(k===null||N>k)&&(k=N)}if(z===null||k===null){let C=new Date;z=new Date(C.getFullYear(),0,1),k=new Date(C.getFullYear(),11,31)}let w=new Date(z);w.setDate(w.getDate()-w.getDay());let T=new Date(k);return T.setDate(T.getDate()+(6-T.getDay())),{dateMap:E,startDate:w,endDate:T,maxVal:B>0?B:1}},[t]),b=d?30:0,y=l?16:0,g=h?28:0,x=b+10,v=g+y+4,R=S(()=>{let E=[],B=new Date(c),z=0;for(;B<=m;){let k=B.getDay();k===0&&B>c&&z++;let w=Ms(B),T=p.get(w),C=T!==void 0&&T>0?su(T/f,i):u,N=x+z*(s+a),F=v+k*(s+a);E.push(o("rect",{key:`day-${w}`,x:String(N),y:String(F),width:String(s),height:String(s),rx:"2",ry:"2",fill:C,"aria-label":`${w}: ${T??0}`})),B.setDate(B.getDate()+1)}return E},[c,m,p,f,i,u,s,a,x,v]),D=S(()=>{if(!l)return[];let E=[],B=new Date(c),z=0,k=-1;for(;B<=m;){let w=B.getDay();w===0&&B>c&&z++;let T=B.getMonth();if(T!==k&&w===0){k=T;let C=x+z*(s+a);E.push(o("text",{key:`month-${z}`,x:String(C),y:String(g+y-2),"font-size":"10","font-family":"sans-serif",fill:"currentColor",opacity:"0.6"},nu[T]))}B.setDate(B.getDate()+1)}return E},[l,c,m,s,a,x,g,y]),M=S(()=>{if(!d)return[];let E=[],B=[1,3,5];for(let z of B){let k=v+z*(s+a)+s/2;E.push(o("text",{key:`day-label-${z}`,x:String(b),y:String(k),"text-anchor":"end","dominant-baseline":"central","font-size":"10","font-family":"sans-serif",fill:"currentColor",opacity:"0.6"},ou[z]))}return E},[d,s,a,v,b]),$=S(()=>h?[o("text",{key:"title",x:String(n/2),y:"18","text-anchor":"middle","font-size":"14","font-weight":"bold","font-family":"sans-serif",fill:"currentColor"},h)]:[],[h,n]);if(t.length===0)return o("svg",{width:"100%",viewBox:`0 0 ${n} ${r}`,preserveAspectRatio:"xMidYMid meet",xmlns:"http://www.w3.org/2000/svg",role:"img","aria-label":h??"Calendar heat map \u2014 no data"},o("text",{x:String(n/2),y:String(r/2),"text-anchor":"middle","font-size":"14","font-family":"sans-serif",fill:"currentColor",opacity:"0.6"},"No data to display."));let A=$(),I=D(),P=M(),L=R();return o("svg",{width:"100%",viewBox:`0 0 ${n} ${r}`,preserveAspectRatio:"xMidYMid meet",xmlns:"http://www.w3.org/2000/svg",role:"img","aria-label":h??"Calendar heat map",style:{fontFamily:"sans-serif"}},...A,...I,...P,...L)}var lu=["#3b82f6","#ef4444","#22c55e","#f59e0b","#8b5cf6","#ec4899","#14b8a6","#f97316","#6366f1","#84cc16"];function nt(e,t,n,r){let i=r-Math.PI/2;return{x:e+n*Math.cos(i),y:t+n*Math.sin(i)}}function cu(e,t,n,r,i,s){let a=nt(e,t,n,i),l=nt(e,t,n,s),d=nt(e,t,r,i),u=nt(e,t,r,s),p=s-i>Math.PI?1:0;return[`M ${a.x} ${a.y}`,`A ${n} ${n} 0 ${p} 1 ${l.x} ${l.y}`,`L ${u.x} ${u.y}`,`A ${r} ${r} 0 ${p} 0 ${d.x} ${d.y}`,"Z"].join(" ")}function du(e,t,n,r,i,s,a){let l=nt(e,t,n,r),d=nt(e,t,n,i),u=nt(e,t,n,s),h=nt(e,t,n,a),p=i-r,c=a-s,m=p>Math.PI?1:0,f=c>Math.PI?1:0;return[`M ${l.x} ${l.y}`,`A ${n} ${n} 0 ${m} 1 ${d.x} ${d.y}`,`Q ${e} ${t} ${u.x} ${u.y}`,`A ${n} ${n} 0 ${f} 1 ${h.x} ${h.y}`,`Q ${e} ${t} ${l.x} ${l.y}`,"Z"].join(" ")}function uu(e,t,n,r){let i=e.length;if(i===0)return{groups:[],chords:[]};let s=[],a=0;for(let c=0;c<i;c++){let m=0;for(let f=0;f<i;f++){let b=e[c]?.[f]??0;m+=Math.max(0,b)}s.push(m),a+=m}if(a===0){let c=(2*Math.PI-i*r)/Math.max(i,1),m=[],f=0;for(let b=0;b<i;b++)m.push({index:b,label:t[b]??`Group ${b}`,color:n[b%n.length],startAngle:f,endAngle:f+c,value:0}),f+=c+r;return{groups:m,chords:[]}}let l=2*Math.PI-i*r,d=[],u=0;for(let c=0;c<i;c++){let m=s[c]/a*l;d.push({index:c,label:t[c]??`Group ${c}`,color:n[c%n.length],startAngle:u,endAngle:u+m,value:s[c]}),u+=m+r}let h=[];for(let c=0;c<i;c++)h.push(d[c].startAngle);let p=[];for(let c=0;c<i;c++)for(let m=c;m<i;m++){let f=Math.max(0,e[c]?.[m]??0),b=c===m?0:Math.max(0,e[m]?.[c]??0);if(f===0&&b===0)continue;let y=f+b,g=s[c]>0?f/a*l:0,x=h[c],v=x+g;h[c]=v;let R=s[m]>0?f/a*l:0,D=h[m],M=D+R;if(h[m]=M,c===m){f>0&&p.push({sourceIndex:c,targetIndex:m,sourceStartAngle:x,sourceEndAngle:v,targetStartAngle:D,targetEndAngle:M,value:f,color:d[c].color});continue}let $=s[m]>0?b/a*l:0,I=h[m]+$;h[m]=I;let P=s[c]>0?b/a*l:0,E=h[c]+P;h[c]=E,(f>0||b>0)&&p.push({sourceIndex:c,targetIndex:m,sourceStartAngle:x,sourceEndAngle:Math.max(v,x+.001),targetStartAngle:D,targetEndAngle:Math.max(M,D+.001),value:y,color:d[c].color})}return{groups:d,chords:p}}function Rs(e){let{matrix:t,labels:n,width:r=600,height:i=600,colors:s=lu,padAngle:a=.05,showLabels:l=!0,showValues:d=!1,ribbonOpacity:u=.5,innerRadiusRatio:h=.9,title:p}=e;if(!t||t.length===0||!n||n.length===0)return o("svg",{width:"100%",viewBox:`0 0 ${r} ${i}`,preserveAspectRatio:"xMidYMid meet",xmlns:"http://www.w3.org/2000/svg",role:"img","aria-label":p??"Empty chord diagram"},o("text",{x:String(r/2),y:String(i/2),"text-anchor":"middle","font-size":"14","font-family":"sans-serif",fill:"#6b7280"},"No data"));let c=r/2,m=i/2,f=Math.min(r,i)/2-40,b=f*Math.max(.5,Math.min(.99,h)),y=f+16,g=q(()=>uu(t,n,s,a),[t,n,s,a]),x=S(()=>{let A=[];for(let I=0;I<g.groups.length;I++){let P=g.groups[I];if(P.endAngle-P.startAngle<.001)continue;let E=cu(c,m,f,b,P.startAngle,P.endAngle);if(A.push(o("path",{key:`arc-${I}`,d:E,fill:P.color,stroke:"#fff","stroke-width":"1",role:"img","aria-label":`${P.label}: ${P.value}`})),l){let B=(P.startAngle+P.endAngle)/2,z=nt(c,m,y,B),T=((B-Math.PI/2)%(2*Math.PI)+2*Math.PI)%(2*Math.PI)<Math.PI,C=T?"start":"end",N=B*180/Math.PI-90;T||(N+=180);let F=d?`${P.label} (${P.value})`:P.label;A.push(o("text",{key:`label-${I}`,x:String(z.x),y:String(z.y),"text-anchor":C,"font-size":"11","font-family":"sans-serif",fill:"#374151",transform:`rotate(${N}, ${z.x}, ${z.y})`,"dominant-baseline":"central","pointer-events":"none"},F))}}return A},[g,c,m,f,b,y,l,d]),v=S(()=>{let A=[];for(let I=0;I<g.chords.length;I++){let P=g.chords[I],L=du(c,m,b,P.sourceStartAngle,P.sourceEndAngle,P.targetStartAngle,P.targetEndAngle);A.push(o("path",{key:`ribbon-${I}`,d:L,fill:P.color,"fill-opacity":String(u),stroke:P.color,"stroke-width":"0.5","stroke-opacity":"0.3"}))}return A},[g,c,m,b,u]),R=S(()=>p?[o("text",{key:"title",x:String(r/2),y:"24","text-anchor":"middle","font-size":"16","font-weight":"bold","font-family":"sans-serif",fill:"#111827"},p)]:[],[p,r]),D=v(),M=x(),$=R();return o("svg",{width:"100%",viewBox:`0 0 ${r} ${i}`,preserveAspectRatio:"xMidYMid meet",xmlns:"http://www.w3.org/2000/svg",role:"img","aria-label":p??"Chord diagram",style:{fontFamily:"sans-serif"}},...$,...D,...M)}var pu=["#3b82f6","#22c55e","#f59e0b","#8b5cf6","#ef4444","#ec4899","#14b8a6","#f97316","#6366f1","#84cc16"];function fu(e){let t=[],n=0,r=[];r.push([e,0,null]);let i=0;for(;r.length>0;){let[s,a,l]=r.shift(),d=n++;i=Math.max(i,a);let u=s.children??[],h=[];for(let p=0;p<u.length;p++)h.push(n+r.length+p);t.push({id:d,node:s,depth:a,parentId:l,childIndices:h});for(let p=0;p<u.length;p++)r.push([u[p],a+1,d])}return{flatNodes:t,maxDepth:i}}function mu(e){let t=e.length,n=new Array(t).fill(0);for(let r=t-1;r>=0;r--){let i=e[r];if(i.childIndices.length===0)n[r]=1;else{let s=0;for(let a of i.childIndices)a<t&&(s+=n[a]);n[r]=Math.max(s,1)}}return n}function gu(e,t,n,r,i,s,a,l){let{flatNodes:d,maxDepth:u}=fu(e);if(d.length===0)return[];let h=mu(d),p=t-s*2,c=n-s*2,m=a==="horizontal",f=u+1,b=m?f>1?(p-r)/u:0:f>1?(c-i)/u:0,y=new Array(d.length),g=h[0],x=m?c:p,v=g>0?x/g:x,R=new Array(d.length);R[0]=[0,g];let D=[0],M=0;for(;M<D.length;){let $=D[M];M++;let A=d[$],[I,P]=R[$],L=(I+P)/2,E=s+A.depth*b,B=s+(L-.5)*v,z=m?E:B,k=m?B:E,w=A.node.color??l[A.depth%l.length];y[$]={id:A.id,label:A.node.label,value:A.node.value!==void 0?String(A.node.value):"",color:w,depth:A.depth,x:z,y:k,parentId:A.parentId,childCount:A.childIndices.length,subtreeLeafCount:h[$]};let T=I;for(let C of A.childIndices)if(C<d.length){let N=h[C],F=T+N;R[C]=[T,F],T=F,D.push(C)}}return y}function Ps(e){let{data:t,width:n=800,height:r=500,orientation:i="horizontal",nodeWidth:s=120,nodeHeight:a=40,showValues:l=!0,showConnectors:d=!0,connectorColor:u="#94a3b8",colors:h=pu,title:p,padding:c=40}=e;if(!t)return o("svg",{width:"100%",viewBox:`0 0 ${n} ${r}`,preserveAspectRatio:"xMidYMid meet",xmlns:"http://www.w3.org/2000/svg",role:"img","aria-label":p??"Empty decomposition tree"},o("text",{x:String(n/2),y:String(r/2),"text-anchor":"middle","font-size":"14","font-family":"sans-serif",fill:"#6b7280"},"No data"));let m=i==="horizontal",f=q(()=>gu(t,n,r,s,a,c,i,h),[t,n,r,s,a,c,i,h]),b=q(()=>{let M=new Map;for(let $=0;$<f.length;$++){let A=f[$];M.set(A.id,A)}return M},[f]),y=S(()=>{if(!d)return[];let M=[];for(let $=0;$<f.length;$++){let A=f[$];if(A.parentId===null)continue;let I=b.get(A.parentId);if(!I)continue;let P,L,E,B;m?(P=I.x+s,L=I.y+a/2,E=A.x,B=A.y+a/2):(P=I.x+s/2,L=I.y+a,E=A.x+s/2,B=A.y);let z=(P+E)/2,k=(L+B)/2,w;m?w=`M ${P} ${L} C ${z} ${L}, ${z} ${B}, ${E} ${B}`:w=`M ${P} ${L} C ${P} ${k}, ${E} ${k}, ${E} ${B}`,M.push(o("path",{key:`conn-${$}`,d:w,fill:"none",stroke:u,"stroke-width":"1.5","stroke-opacity":"0.7"}))}return M},[f,b,m,s,a,d,u]),g=S(()=>{let M=[];for(let $=0;$<f.length;$++){let A=f[$];M.push(o("rect",{key:`node-rect-${A.id}`,x:String(A.x),y:String(A.y),width:String(s),height:String(a),rx:"4",ry:"4",fill:A.color,stroke:"#374151","stroke-width":"1",role:"img","aria-label":A.value?`${A.label}: ${A.value}`:A.label}));let I=l&&A.value?A.y+a/2-2:A.y+a/2+4;M.push(o("text",{key:`node-label-${A.id}`,x:String(A.x+s/2),y:String(I),"text-anchor":"middle","font-size":"11","font-weight":"bold","font-family":"sans-serif",fill:"#fff","pointer-events":"none"},A.label)),l&&A.value&&M.push(o("text",{key:`node-value-${A.id}`,x:String(A.x+s/2),y:String(A.y+a/2+12),"text-anchor":"middle","font-size":"10","font-family":"sans-serif",fill:"rgba(255,255,255,0.85)","pointer-events":"none"},A.value))}return M},[f,s,a,l]),x=S(()=>p?[o("text",{key:"title",x:String(n/2),y:"24","text-anchor":"middle","font-size":"16","font-weight":"bold","font-family":"sans-serif",fill:"#111827"},p)]:[],[p,n]),v=y(),R=g(),D=x();return o("svg",{width:"100%",viewBox:`0 0 ${n} ${r}`,preserveAspectRatio:"xMidYMid meet",xmlns:"http://www.w3.org/2000/svg",role:"img","aria-label":p??"Decomposition tree",style:{fontFamily:"sans-serif"}},...D,...v,...R)}var Ts=["#3b82f6","#ef4444","#22c55e","#f59e0b","#8b5cf6","#ec4899","#14b8a6","#f97316","#6366f1","#84cc16"];function hu(e){return Ts[e%Ts.length]}function Ds(e,t,n){let r=t/2,i=n/2,s=Math.min(t,n)*.3,a=e.length,l=[];for(let d=0;d<a;d++){let u=e[d],h=2*Math.PI*d/Math.max(a,1);l.push({id:u.id,label:u.label??u.id,color:u.color??hu(d),x:u.x??r+s*Math.cos(h),y:u.y??i+s*Math.sin(h),vx:0,vy:0,fixed:u.fixed??!1,solid:u.solid??!0})}return l}function $s(e,t){let n=t*2;for(let r=0;r<e.length;r++){let i=e[r];if(i.solid)for(let s=r+1;s<e.length;s++){let a=e[s];if(!a.solid)continue;let l=a.x-i.x,d=a.y-i.y,u=l*l+d*d;if(u>=n*n||u<1e-4)continue;let h=Math.sqrt(u),p=l/h,c=d/h,m=n-h;if(i.fixed&&a.fixed)continue;i.fixed?(a.x+=p*m,a.y+=c*m):a.fixed?(i.x-=p*m,i.y-=c*m):(i.x-=p*m*.5,i.y-=c*m*.5,a.x+=p*m*.5,a.y+=c*m*.5);let f=i.vx-a.vx,b=i.vy-a.vy,y=f*p+b*c;y<=0||(i.fixed?(a.vx+=y*p,a.vy+=y*c):a.fixed?(i.vx-=y*p,i.vy-=y*c):(i.vx-=y*p,i.vy-=y*c,a.vx+=y*p,a.vy+=y*c))}}}function bu(e,t,n,r,i,s,a,l,d=12){let u=e.length;if(u===0)return e;let h=new Map;for(let x=0;x<u;x++)h.set(e[x].id,x);let p=new Float64Array(u),c=new Float64Array(u);for(let x=0;x<u;x++){let v=e[x];for(let R=x+1;R<u;R++){let D=e[R],M=v.x-D.x,$=v.y-D.y,A=M*M+$*$;A<1&&(A=1);let I=Math.sqrt(A),P=i/A,L=M/I*P,E=$/I*P;p[x]+=L,c[x]+=E,p[R]-=L,c[R]-=E}}for(let x=0;x<t.length;x++){let v=t[x],R=h.get(v.source),D=h.get(v.target);if(R===void 0||D===void 0)continue;let M=e[R],$=e[D],A=$.x-M.x,I=$.y-M.y,P=Math.sqrt(A*A+I*I);if(P<.1)continue;let L=v.weight??1,E=P-l,B=s*E*L,z=A/P*B,k=I/P*B;p[R]+=z,c[R]+=k,p[D]-=z,c[D]-=k}let m=n/2,f=r/2,b=.001;for(let x=0;x<u;x++){let v=e[x];p[x]+=(m-v.x)*b,c[x]+=(f-v.y)*b}let y=20,g=[];for(let x=0;x<u;x++){let v=e[x];if(v.fixed){g.push({...v,vx:0,vy:0});continue}let R=(v.vx+p[x])*a,D=(v.vy+c[x])*a,M=Math.sqrt(R*R+D*D),$=10;M>$&&(R=R/M*$,D=D/M*$);let A=v.x+R,I=v.y+D;A=Math.max(y,Math.min(n-y,A)),I=Math.max(y,Math.min(r-y,I)),g.push({...v,x:A,y:I,vx:R,vy:D})}return $s(g,d),g}function xu(e){let t=0;for(let n=0;n<e.length;n++){let r=e[n];t+=r.vx*r.vx+r.vy*r.vy}return t}function zs(e){let{nodes:t,edges:n,width:r=600,height:i=400,nodeRadius:s=12,nodeStrokeWidth:a=2,solidNodes:l=!0,showLabels:d=!0,showArrows:u=!1,repulsionForce:h=300,attractionForce:p=.01,damping:c=.9,edgeLength:m=100,edgeColor:f="#94a3b8",edgeWidth:b=1.5,title:y,customForce:g,trails:x}=e;if(!t||t.length===0)return o("svg",{width:"100%",viewBox:`0 0 ${r} ${i}`,preserveAspectRatio:"xMidYMid meet",xmlns:"http://www.w3.org/2000/svg",role:"img","aria-label":y??"Empty force-directed graph"},y?o("text",{x:String(r/2),y:String(i/2),"text-anchor":"middle","font-size":"16","font-weight":"bold","font-family":"sans-serif",fill:"#111827"},y):o("text",{x:String(r/2),y:String(i/2),"text-anchor":"middle","font-size":"14","font-family":"sans-serif",fill:"#6b7280"},"No data"));let v=te(Ds(t,r,i)),[R,D]=j(0),M=te(!0),$=te(!1),A=te(n);A.current=n;let I=te(g);I.current=g;let P=te(null),L=te({repulsionForce:h,attractionForce:p,damping:c,edgeLength:m,width:r,height:i,nodeRadius:s,solidNodes:l});L.current={repulsionForce:h,attractionForce:p,damping:c,edgeLength:m,width:r,height:i,nodeRadius:s,solidNodes:l};let E=te(new Map);re(()=>{v.current=Ds(t,r,i),$.current=!1,M.current=!0,E.current=new Map,D(ae=>ae+1)},[t.length]),re(()=>{let ae=0,J=()=>{if(!M.current)return;let se=L.current,ce=I.current,me;if(ce?(me=ce(v.current,A.current,se.width,se.height,P.current),se.solidNodes&&$s(me,se.nodeRadius)):me=bu(v.current,A.current,se.width,se.height,se.repulsionForce,se.attractionForce,se.damping,se.edgeLength,se.nodeRadius),v.current=me,x)for(let ge=0;ge<x.length;ge++){let ye=x[ge],le=me.find(ie=>ie.id===ye.nodeId);if(!le)continue;let ne=E.current.get(ye.nodeId);ne||(ne=[],E.current.set(ye.nodeId,ne)),ne.push({x:le.x,y:le.y});let pe=ye.maxPoints??200;ne.length>pe&&ne.splice(0,ne.length-pe)}if(!ce&&xu(me)<.01){$.current=!0,D(ge=>ge+1);return}D(ge=>ge+1),ae=requestAnimationFrame(J)};return ae=requestAnimationFrame(J),()=>{M.current=!1,cancelAnimationFrame(ae)}},[]);let B=v.current,z=S(ae=>{v.current=v.current.map(J=>J.id===ae?{...J,fixed:!J.fixed,vx:0,vy:0}:J),$.current&&($.current=!1,M.current=!0,D(J=>J+1))},[]),k=te(null),w=te(null),T=S(ae=>{let J=ae,se=w.current;if(!se)return{x:J.clientX,y:J.clientY};let ce=se.getBoundingClientRect(),me=r/ce.width,ge=i/ce.height;return{x:(J.clientX-ce.left)*me,y:(J.clientY-ce.top)*ge}},[r,i]),C=te(!1),N=S((ae,J)=>{J.stopPropagation(),k.current=ae;let se=v.current.find(ce=>ce.id===ae);C.current=se?.fixed??!1,v.current=v.current.map(ce=>ce.id===ae?{...ce,fixed:!0,vx:0,vy:0}:ce)},[]),F=S(ae=>{let J=T(ae);if(P.current={x:J.x,y:J.y},!k.current)return;let se=k.current,ce=20;v.current=v.current.map(me=>me.id===se?{...me,x:Math.max(ce,Math.min(r-ce,J.x)),y:Math.max(ce,Math.min(i-ce,J.y))}:me),$.current&&($.current=!1,M.current=!0),D(me=>me+1)},[r,i,T]),_=S(()=>{let ae=k.current;ae&&(v.current=v.current.map(J=>J.id===ae?{...J,fixed:C.current}:J)),k.current=null},[]),H=S(()=>{k.current=null,P.current=null},[]),W=q(()=>{let ae=new Map;for(let J=0;J<B.length;J++)ae.set(B[J].id,B[J]);return ae},[R]),V=S(()=>u?[o("defs",{key:"arrow-defs"},o("marker",{key:"arrowhead",id:"arrowhead",markerWidth:"10",markerHeight:"7",refX:String(10+s),refY:"3.5",orient:"auto",markerUnits:"userSpaceOnUse"},o("polygon",{key:"arrow-poly",points:"0 0, 10 3.5, 0 7",fill:f})))]:[],[u,s,f]),K=S(()=>{let ae=[];for(let J=0;J<n.length;J++){let se=n[J],ce=W.get(se.source),me=W.get(se.target);if(!ce||!me||se.weight!==void 0&&se.weight<=0)continue;let ge=se.weight?Math.max(.5,Math.min(6,b*se.weight)):b,ye={key:`edge-${J}`,x1:String(ce.x),y1:String(ce.y),x2:String(me.x),y2:String(me.y),stroke:se.color??f,"stroke-width":String(ge),"stroke-opacity":"0.6"};u&&(ye["marker-end"]="url(#arrowhead)"),ae.push(o("line",ye))}return ae},[R,f,b,u]),Q=S(()=>{let ae=[];for(let J=0;J<B.length;J++){let se=B[J];ae.push(o("circle",{key:`node-${se.id}`,cx:String(se.x),cy:String(se.y),r:String(s),fill:se.color,stroke:se.fixed?"#0f172a":"#fff","stroke-width":se.fixed?"3":String(a),style:{cursor:k.current===se.id?"grabbing":"grab"},onMouseDown:ce=>N(se.id,ce),onDblClick:()=>z(se.id),role:"button",tabIndex:0,"aria-label":`Node: ${se.label}${se.fixed?" (locked)":""} \u2014 drag to move, double-click to lock`})),d&&ae.push(o("text",{key:`label-${se.id}`,x:String(se.x),y:String(se.y+s+14),"text-anchor":"middle","font-size":"11","font-family":"sans-serif",fill:"#374151","pointer-events":"none"},se.label))}return ae},[R,s,d,z]),G=S(()=>y?[o("text",{key:"title",x:String(r/2),y:"24","text-anchor":"middle","font-size":"16","font-weight":"bold","font-family":"sans-serif",fill:"#111827"},y)]:[],[y,r]),O=S(()=>{if(!x||x.length===0)return[];let ae=[];for(let J=0;J<x.length;J++){let se=x[J],ce=E.current.get(se.nodeId);if(!ce||ce.length<2)continue;let me=[];for(let ge=0;ge<ce.length;ge++){let ye=ce[ge];me.push(`${ge===0?"M":"L"}${ye.x.toFixed(1)},${ye.y.toFixed(1)}`)}ae.push(o("path",{key:`trail-${se.nodeId}`,d:me.join(" "),fill:"none",stroke:se.color??"#3b82f6","stroke-width":String(se.width??1),opacity:String(se.opacity??.5),"stroke-linecap":"round","stroke-linejoin":"round"}))}return ae},[R,x]),Y=V(),X=O(),U=K(),Z=Q(),ee=G();return o("svg",{ref:w,width:"100%",viewBox:`0 0 ${r} ${i}`,preserveAspectRatio:"xMidYMid meet",xmlns:"http://www.w3.org/2000/svg",role:"img","aria-label":y??"Force-directed graph \u2014 drag nodes to move, double-click to lock",style:{fontFamily:"sans-serif",cursor:k.current?"grabbing":"default"},onMouseMove:F,onMouseUp:_,onMouseLeave:H},...Y,...ee,...X,...U,...Z)}var As=["#3b82f6","#6366f1","#8b5cf6","#a855f7","#c084fc","#d8b4fe","#e9d5ff","#f3e8ff"];function Ls(e){let{data:t=[],width:n=600,height:r=400,orientation:i="vertical",showLabels:s=!0,showValues:a=!0,showPercentage:l=!0,gapSize:d=2,colors:u=As,title:h}=e,p=i==="vertical",c=h?30:0,m=120,f=q(()=>{let A=0;for(let I=0;I<t.length;I++)t[I].value>A&&(A=t[I].value);return A>0?A:1},[t]),b=S(A=>f===0?0:Math.max(.05,A/f),[f]),y=S((A,I)=>I||(u[A%u.length]??As[0]),[u]),g=S(()=>{if(t.length===0)return[];let A=[],I=40,P=n-I*2-m,L=r-c-I*2,E=d*(t.length-1),B=Math.max(1,(L-E)/t.length),z=I+P/2;for(let k=0;k<t.length;k++){let w=t[k],T=k<t.length-1?t[k+1]:null,C=y(k,w.color),N=b(w.value),F=T!==null?b(T.value):N*.6,_=P/2*N,H=P/2*F,W=c+I+k*(B+d),V=z-_,K=z+_,Q=z+H,G=z-H,O=`${V},${W} ${K},${W} ${Q},${W+B} ${G},${W+B}`;A.push(o("polygon",{key:`section-${k}`,points:O,fill:C,stroke:"#fff","stroke-width":"1"}));let Y=I+P+12,X=W+B/2;if(s&&A.push(o("text",{key:`label-${k}`,x:String(Y),y:String(X-(a||l?6:0)),"text-anchor":"start","font-size":"12","font-weight":"bold","font-family":"sans-serif",fill:"#374151"},w.label)),a||l){let U="";if(a&&(U=String(w.value)),l&&t.length>0){let Z=t[0].value,ee=Z>0?Math.round(w.value/Z*100):0;U+=a?` (${ee}%)`:`${ee}%`}A.push(o("text",{key:`value-${k}`,x:String(Y),y:String(X+(s?10:4)),"text-anchor":"start","font-size":"11","font-family":"sans-serif",fill:"#6b7280"},U))}}return A},[t,n,r,c,d,s,a,l,y,b,m]),x=S(()=>{if(t.length===0)return[];let A=[],I=40,P=n-I*2,E=r-c-I*2-40,B=d*(t.length-1),z=Math.max(1,(P-B)/t.length),k=c+I+E/2;for(let w=0;w<t.length;w++){let T=t[w],C=w<t.length-1?t[w+1]:null,N=y(w,T.color),F=b(T.value),_=C!==null?b(C.value):F*.6,H=E/2*F,W=E/2*_,V=I+w*(z+d),K=k-H,Q=k-W,G=k+W,O=k+H,Y=`${V},${K} ${V+z},${Q} ${V+z},${G} ${V},${O}`;A.push(o("polygon",{key:`section-${w}`,points:Y,fill:N,stroke:"#fff","stroke-width":"1"}));let X=V+z/2,U=c+I+E+14;if(s&&A.push(o("text",{key:`label-${w}`,x:String(X),y:String(U),"text-anchor":"middle","font-size":"11","font-weight":"bold","font-family":"sans-serif",fill:"#374151"},T.label)),a||l){let Z="";if(a&&(Z=String(T.value)),l&&t.length>0){let ee=t[0].value,ae=ee>0?Math.round(T.value/ee*100):0;Z+=a?` (${ae}%)`:`${ae}%`}A.push(o("text",{key:`value-${w}`,x:String(X),y:String(U+14),"text-anchor":"middle","font-size":"10","font-family":"sans-serif",fill:"#6b7280"},Z))}}return A},[t,n,r,c,d,s,a,l,y,b]),v=S(()=>h?[o("text",{key:"title",x:String(n/2),y:String(20),"text-anchor":"middle","font-size":"16","font-weight":"bold","font-family":"sans-serif",fill:"#111827"},h)]:[],[h,n]),R=S(()=>t.length>0?[]:[o("text",{key:"empty",x:String(n/2),y:String(r/2),"text-anchor":"middle","font-size":"14","font-family":"sans-serif",fill:"#9ca3af"},"No data")],[t.length,n,r]),D=v(),M=p?g():x(),$=R();return o("svg",{width:"100%",viewBox:`0 0 ${n} ${r}`,preserveAspectRatio:"xMidYMid meet",xmlns:"http://www.w3.org/2000/svg",role:"img","aria-label":h??"Funnel chart",style:{fontFamily:"sans-serif"}},...D,...M,...$)}var Bs=["#3b82f6","#22c55e","#f59e0b","#ef4444","#8b5cf6","#ec4899","#14b8a6","#f97316","#6366f1","#84cc16"];function Fs(e){if(e<=0)return 1;let t=e/6,n=Math.pow(10,Math.floor(Math.log10(t))),r=t/n;return r<=1.5?n:r<=3.5?2*n:r<=7.5?5*n:10*n}function yu(e,t){return t||Bs[e%Bs.length]}function Ns(e){let{tasks:t=[],width:n=800,height:r,barHeight:i=24,barGap:s=8,showGrid:a=!0,showLabels:l=!0,showProgress:d=!1,timeUnit:u="days",title:h,padding:p=50}=e;if(t.length===0)return o("svg",{width:"100%",height:String(r??100),viewBox:`0 0 ${n} ${r??100}`,xmlns:"http://www.w3.org/2000/svg",role:"img","aria-label":h??"Empty Gantt chart"},o("text",{x:String(n/2),y:String((r??100)/2),"text-anchor":"middle","font-size":"14","font-family":"sans-serif",fill:"currentColor",opacity:"0.4"},"No tasks to display"));let c=l?120:0,m=q(()=>{let L=1/0,E=-1/0;for(let B of t){B.start<L&&(L=B.start);let z=B.start+B.duration;z>E&&(E=z)}return L===1/0&&(L=0,E=1),{min:L,max:E,range:E-L}},[t]),f=q(()=>{let L=t.slice();return L.sort((E,B)=>E.group!==B.group?(E.group??"").localeCompare(B.group??""):E.start-B.start),L},[t]),b=r??p*2+f.length*(i+s)+s+20,y=n-p-c-p,g=p+(h?20:0),x=S(L=>m.range===0?c+p:c+p+(L-m.min)/m.range*y,[m,y,c,p]),v=S(()=>{if(!a)return[];let L=[],E=Fs(m.range),B=Math.ceil(m.min/E)*E,z=g+f.length*(i+s)+s;for(let k=B;k<=m.max;k+=E){let w=x(k);L.push(o("line",{key:`grid-${k}`,x1:String(w),y1:String(g),x2:String(w),y2:String(z),stroke:"#e5e7eb","stroke-width":"1","stroke-dasharray":"4 2"}))}return L},[a,m,g,f.length,i,s,x]),R=S(()=>{let L=[],E=Fs(m.range),B=Math.ceil(m.min/E)*E,z=g-8;for(let k=B;k<=m.max;k+=E){let w=x(k);L.push(o("text",{key:`taxis-${k}`,x:String(w),y:String(z),"text-anchor":"middle","font-size":"10","font-family":"sans-serif",fill:"currentColor",opacity:"0.6"},String(k)))}return L.push(o("text",{key:"time-unit",x:String(n-p),y:String(z),"text-anchor":"end","font-size":"10","font-family":"sans-serif",fill:"currentColor",opacity:"0.4","font-style":"italic"},u)),L},[m,g,x,u,n,p]),D=S(()=>{let L=[],E="";for(let B=0;B<f.length;B++){let z=f[B],k=g+B*(i+s)+s,w=x(z.start),T=Math.max(2,x(z.start+z.duration)-w),C=yu(B,z.color);z.group&&z.group!==E&&(E=z.group,l&&L.push(o("text",{key:`group-${B}`,x:String(p),y:String(k+i/2-12),"font-size":"9","font-family":"sans-serif","font-weight":"bold",fill:"currentColor",opacity:"0.4","text-transform":"uppercase"},z.group))),L.push(o("rect",{key:`bar-${z.id}`,x:String(w),y:String(k),width:String(T),height:String(i),rx:"4",ry:"4",fill:C,role:"graphics-symbol","aria-label":`${z.label}: start ${z.start}, duration ${z.duration}`})),l&&L.push(o("text",{key:`label-${z.id}`,x:String(c+p-8),y:String(k+i/2+4),"text-anchor":"end","font-size":"11","font-family":"sans-serif",fill:"currentColor"},z.label.length>16?z.label.substring(0,14)+"..":z.label)),d&&T>30&&L.push(o("text",{key:`prog-${z.id}`,x:String(w+T/2),y:String(k+i/2+4),"text-anchor":"middle","font-size":"10","font-family":"sans-serif",fill:"#ffffff"},`${z.start}-${z.start+z.duration}`))}return L},[f,g,i,s,x,l,d,c,p]),M=S(()=>h?[o("text",{key:"title",x:String(n/2),y:String(p/2+4),"text-anchor":"middle","font-size":"16","font-weight":"bold","font-family":"sans-serif",fill:"currentColor"},h)]:[],[h,n,p]),$=v(),A=R(),I=D(),P=M();return o("svg",{width:"100%",height:String(b),viewBox:`0 0 ${n} ${b}`,xmlns:"http://www.w3.org/2000/svg",role:"img","aria-label":h??"Gantt chart",style:{fontFamily:"sans-serif"}},...P,...$,...A,...I)}var Su=Math.PI/180;function vu(e){return e*Su}function Je(e,t,n,r){let i=vu(r);return{x:e+n*Math.cos(i),y:t+n*Math.sin(i)}}function Ws(e,t,n,r,i){let s=Je(e,t,n,i),a=Je(e,t,n,r),l=i-r,d=Math.abs(l)>180?1:0,u=l>0?1:0;return`M ${s.x} ${s.y} A ${n} ${n} 0 ${d} ${u===1?0:1} ${a.x} ${a.y}`}function wu(e,t,n){return e<t?t:e>n?n:e}function mt(e){return!isFinite(e)||isNaN(e)?"--":Math.abs(e)>=1e3?Math.round(e).toString():e===Math.floor(e)?e.toString():e.toFixed(1)}function _s(e){let{value:t,min:n=0,max:r=100,width:i=300,height:s=200,startAngle:a=-135,endAngle:l=135,arcWidth:d=20,showValue:u=!0,showMinMax:h=!0,showTicks:p=!0,tickCount:c=10,label:m,unit:f,colors:b=["#22c55e","#f59e0b","#ef4444"],needleColor:y="#374151",backgroundColor:g="#e5e7eb"}=e,x=isFinite(n)&&!isNaN(n)?n:0,v=isFinite(r)&&!isNaN(r)&&r>x?r:x+100,R=isFinite(t)&&!isNaN(t)?wu(t,x,v):x,D=(u?24:0)+(m?18:0),M=i/2,$=(s-D)*.6,A=Math.min(i/2,(s-D)*.55)-d/2-10,I=A-d,P=A-d/2,L=l-a,E=S(O=>{let Y=v-x;if(Y===0)return a;let X=(O-x)/Y;return a+X*L},[x,v,a,L]),B=S(()=>{let O=Ws(M,$,P,a,l);return[o("path",{key:"bg-arc",d:O,fill:"none",stroke:g,"stroke-width":String(d),"stroke-linecap":"round"})]},[M,$,P,a,l,g,d]),z=S(()=>{if(b.length===0)return[];let O=[],Y=L/b.length;for(let X=0;X<b.length;X++){let U=a+X*Y,Z=U+Y,ee=Ws(M,$,P,U,Z);O.push(o("path",{key:`seg-${X}`,d:ee,fill:"none",stroke:b[X],"stroke-width":String(d),"stroke-linecap":X===0||X===b.length-1?"round":"butt",opacity:"0.85"}))}return O},[b,L,a,M,$,P,d]),k=S(()=>{if(!p||c<=0)return[];let O=[],Y=Math.max(1,Math.min(c,100));for(let X=0;X<=Y;X++){let U=X/Y,Z=a+U*L,ee=X%2===0,ae=ee?10:6,J=Je(M,$,A+4,Z),se=Je(M,$,A+4+ae,Z);if(O.push(o("line",{key:`tick-${X}`,x1:String(J.x),y1:String(J.y),x2:String(se.x),y2:String(se.y),stroke:"currentColor",opacity:"0.4","stroke-width":ee?"2":"1"})),ee){let ce=x+U*(v-x),me=Je(M,$,A+4+ae+12,Z);O.push(o("text",{key:`tick-label-${X}`,x:String(me.x),y:String(me.y+3),"text-anchor":"middle","font-size":"9","font-family":"sans-serif",fill:"currentColor",opacity:"0.55"},mt(ce)))}}return O},[p,c,a,L,M,$,A,x,v]),w=S(()=>{let O=[],Y=E(R),X=I-8,U=Je(M,$,X,Y),Z=6,ee=Y+90,ae=Y-90,J=Je(M,$,Z,ee),se=Je(M,$,Z,ae);return O.push(o("polygon",{key:"needle",points:`${U.x},${U.y} ${J.x},${J.y} ${se.x},${se.y}`,fill:y,stroke:"none"})),O.push(o("circle",{key:"needle-cap",cx:String(M),cy:String($),r:"8",fill:y,stroke:"#fff","stroke-width":"2"})),O},[R,E,M,$,I,y]),T=S(()=>{if(!u)return[];let O=[],Y=mt(R),X=Y+(f?" "+f:""),U=$+P+20;return O.push(o("text",{key:"value-text",x:String(M),y:String(U),"text-anchor":"middle","font-size":"22","font-weight":"bold","font-family":"sans-serif",fill:"currentColor","aria-label":`Value: ${X}`},Y,f?o("tspan",{key:"unit","font-size":"14","font-weight":"normal",opacity:"0.6",fill:"currentColor"}," "+f):null)),O},[u,R,f,M,$,P]),C=S(()=>{if(!m)return[];let O=$+P+(u?40:20);return[o("text",{key:"label",x:String(M),y:String(O),"text-anchor":"middle","font-size":"13","font-family":"sans-serif",fill:"currentColor",opacity:"0.6"},m)]},[m,M,$,P,u]),N=S(()=>{if(!h)return[];let O=[],Y=Je(M,$,P,a),X=Je(M,$,P,l);return O.push(o("text",{key:"min-label",x:String(Y.x-4),y:String(Y.y+18),"text-anchor":"middle","font-size":"11","font-family":"sans-serif",fill:"currentColor",opacity:"0.55"},mt(x))),O.push(o("text",{key:"max-label",x:String(X.x+4),y:String(X.y+18),"text-anchor":"middle","font-size":"11","font-family":"sans-serif",fill:"currentColor",opacity:"0.55"},mt(v))),O},[h,M,$,P,a,l,x,v]),F=B(),_=z(),H=k(),W=w(),V=T(),K=C(),Q=N(),G=`Gauge: ${mt(R)}${f?" "+f:""}, range ${mt(x)} to ${mt(v)}${m?", "+m:""}`;return o("svg",{width:"100%",viewBox:`0 0 ${i} ${s}`,preserveAspectRatio:"xMidYMid meet",xmlns:"http://www.w3.org/2000/svg",role:"meter","aria-valuenow":String(R),"aria-valuemin":String(x),"aria-valuemax":String(v),"aria-label":G,style:{fontFamily:"sans-serif"}},...F,..._,...H,...W,...V,...K,...Q)}var _t={AL:{name:"Alabama",path:"m 643,467.4 .4,-7.3 -.9,-1.2 -1.7,-.7 -2.5,-2.8 .5,-2.9 48.8,-5.1 -.7,-2.2 -1.5,-1.5 -.5,-1.4 .6,-6.3 -2.4,-5.7 .5,-2.6 .3,-3.7 2.2,-3.8 -.2,-1.1 -1.7,-1 v -3.2 l -1.8,-1.9 -2.9,-6.1 -12.9,-45.8 -45.7,4 1.3,2 -1.3,67 4.4,33.2 .9,-.5 1.3,.1 .6,.4 .8,-.1 2,-3.8 v -2.3 l 1.1,-1.1 1.4,.5 3.4,6.4 v .9 l -3.3,2.2 3.5,-.4 4.9,-1.6 z"},AK:{name:"Alaska",path:"m 15.8,572 h 2.4 l .7,.7 -1,1.2 -1.9,.2 -2.5,1.3 -3.7,-.1 2.2,-.9 .3,-1.1 2.5,-.3 z m 8.3,-1.7 1.3,.5 h .9 l .5,1.2 .3,-.6 .9,.2 1.1,1.5 0,.5 -4.2,1.9 -2.4,-.1 -1,-.5 -1.1,.7 -2,0 -1.1,-1.4 4.7,-.5 z m 5.4,-.1 1,.1 .7,.7 v 1 l -1.3,.1 -.9,-1.1 z m 2.5,.3 1.3,-.1 -.1,1 -1.1,.6 z m .3,2.2 3.4,-.1 .2,1.1 -1.3,.1 -.3,-.5 -.8,.6 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 2.8,-.2 4.9,.8 1.4,1.5 -1,1 .8,.8 3.8,.7 1.2,1.2 .1,4.4 -1.3,2.8 2,.1 1,-.8 .9,.8 -1.1,3.1 1,1.6 1.2,.3 z m -49.5,-37.3 -.5,.1 -1.5,1.6 .2,.5 1.5,-.6 v -.6 l .9,-.3 z m 1.6,-1.1 -1,.3 -.2,.7 .9,-.1 z m -1.3,-1.6 -.2,.9 h 1.7 l .6,-.4 .1,-1 z m 2.8,-3 -.3,1.9 1.2,-.5 .1,-1.4 z m 58.3,31.9 -2,.3 -.4,1.3 1.3,1.7 z"},WY:{name:"Wyoming",path:"m 355.3,143.7 -51,-5.3 -57.3,-7.9 -2,10.7 -8.5,54.8 -3.3,21.9 32.1,4.8 44.9,5.7 37.5,3.4 3.7,-44.2 z"},DC:{name:"District of Columbia",path:"m 803.5,252 -2.6,-1.8 -1,1.7 .5,.4 .4,.1 .6,.5 .3,.7 -.1,.5 .2,.5 z"}};function Os(e){let{width:t=959,height:n=593,stateColors:r={},defaultColor:i="#D0D0D0",strokeColor:s="#FFFFFF",strokeWidth:a=1,onStateClick:l,onStateHover:d,hoverColor:u="#FFD700",title:h="Map of the United States"}=e,p=q(()=>Object.keys(_t),[]),c=S(g=>{l&&l(g)},[l]),m=S((g,x)=>{let v=x.currentTarget;v&&v.setAttribute("fill",u),d&&d(g)},[d,u]),f=S((g,x)=>{let v=x.currentTarget;if(v){let R=r[g]??i;v.setAttribute("fill",R)}d&&d(null)},[d,r,i]),b=q(()=>{let g=[];for(let x=0;x<p.length;x++){let v=p[x],R=_t[v],D=r[v]??i,M={key:`state-${v}`,d:R.path,fill:D,stroke:s,"stroke-width":String(a),"stroke-linejoin":"round","data-state":v,role:"img","aria-label":R.name,style:{cursor:l?"pointer":"default"}};if(l){let A=v;M.onClick=()=>c(A),M.onKeyDown=I=>{(I.key==="Enter"||I.key===" ")&&c(A)},M.tabindex=0,M.role="button",M["aria-label"]=R.name}let $=v;M.onMouseOver=A=>m($,A),M.onMouseOut=A=>f($,A),g.push(o("path",M))}return g},[p,r,i,s,a,l,c,m,f]),y=o("title",{key:"map-title"},h);return o("svg",{width:"100%",viewBox:`0 0 ${t} ${n}`,preserveAspectRatio:"xMidYMid meet",xmlns:"http://www.w3.org/2000/svg",role:"img","aria-label":h,style:{fontFamily:"sans-serif"}},y,...b)}function wo(e){let t=e.replace("#",""),n=t.length===3?t[0]+t[0]+t[1]+t[1]+t[2]+t[2]:t,r=parseInt(n,16);return{r:r>>16&255,g:r>>8&255,b:r&255}}function ku(e,t,n){let r=i=>{let s=Math.max(0,Math.min(255,Math.round(i))).toString(16);return s.length===1?"0"+s:s};return`#${r(e)}${r(t)}${r(n)}`}function Cu(e,t){if(t.length===0)return"#000000";if(t.length===1)return t[0];let n=Math.max(0,Math.min(1,e)),r=t.length-1,i=Math.min(Math.floor(n*r),r-1),s=n*r-i,a=wo(t[i]),l=wo(t[i+1]);return ku(a.r+(l.r-a.r)*s,a.g+(l.g-a.g)*s,a.b+(l.b-a.b)*s)}function Mu(e){let{r:t,g:n,b:r}=wo(e);return(.299*t+.587*n+.114*r)/255}var Eu=["#3b82f6","#fbbf24","#ef4444"];function Hs(e){let{data:t=[],rowLabels:n,columnLabels:r,width:i=600,height:s=400,colorScale:a=Eu,minValue:l,maxValue:d,showValues:u=!1,cellBorderColor:h="#fff",cellBorderWidth:p=1,title:c,padding:m=60}=e,f=t.length,b=q(()=>{let k=0;for(let w of t)w.length>k&&(k=w.length);return k},[t]),{minVal:y,maxVal:g}=q(()=>{let k=l??1/0,w=d??-1/0;for(let T of t)for(let C of T)l===void 0&&C<k&&(k=C),d===void 0&&C>w&&(w=C);return k===1/0&&(k=0),w===-1/0&&(w=1),k===w&&(w=k+1),{minVal:k,maxVal:w}},[t,l,d]),x=c?30:0,v=n?m:20,R=r?m:20,D=i-v-20,M=s-x-R-20,$=b>0?D/b:0,A=f>0?M/f:0,I=S(()=>{let k=[];for(let w=0;w<f;w++){let T=t[w];for(let C=0;C<b;C++){let N=C<T.length?T[C]:0,F=(N-y)/(g-y),_=Cu(F,a),H=v+C*$,W=x+20+w*A;if(k.push(o("rect",{key:`cell-${w}-${C}`,x:String(H),y:String(W),width:String($),height:String(A),fill:_,stroke:h,"stroke-width":String(p)})),u){let V=Mu(_)>.5?"#111827":"#ffffff";k.push(o("text",{key:`val-${w}-${C}`,x:String(H+$/2),y:String(W+A/2),"text-anchor":"middle","dominant-baseline":"central","font-size":String(Math.min(11,$*.3,A*.4)),"font-family":"sans-serif",fill:V},String(Math.round(N*100)/100)))}}}return k},[t,f,b,y,g,a,$,A,v,x,u,h,p]),P=S(()=>{let k=[];if(n)for(let w=0;w<f;w++){let T=w<n.length?n[w]:"",C=x+20+w*A+A/2;k.push(o("text",{key:`row-label-${w}`,x:String(v-8),y:String(C),"text-anchor":"end","dominant-baseline":"central","font-size":"11","font-family":"sans-serif",fill:"currentColor"},T))}if(r)for(let w=0;w<b;w++){let T=w<r.length?r[w]:"",C=v+w*$+$/2,N=x+20+f*A+16;k.push(o("text",{key:`col-label-${w}`,x:String(C),y:String(N),"text-anchor":"middle","font-size":"11","font-family":"sans-serif",fill:"currentColor"},T))}return k},[n,r,f,b,$,A,v,x]),L=S(()=>c?[o("text",{key:"title",x:String(i/2),y:"22","text-anchor":"middle","font-size":"16","font-weight":"bold","font-family":"sans-serif",fill:"currentColor"},c)]:[],[c,i]);if(f===0||b===0)return o("svg",{width:"100%",viewBox:`0 0 ${i} ${s}`,preserveAspectRatio:"xMidYMid meet",xmlns:"http://www.w3.org/2000/svg",role:"img","aria-label":c??"Heat map \u2014 no data"},o("text",{x:String(i/2),y:String(s/2),"text-anchor":"middle","font-size":"14","font-family":"sans-serif",fill:"currentColor",opacity:"0.6"},"No data to display."));let E=L(),B=I(),z=P();return o("svg",{width:"100%",viewBox:`0 0 ${i} ${s}`,preserveAspectRatio:"xMidYMid meet",xmlns:"http://www.w3.org/2000/svg",role:"img","aria-label":c??"Heat map",style:{fontFamily:"sans-serif"}},...E,...B,...z)}function Iu(e,t){if(e.length===0)return[];let n=e[0],r=e[0];for(let a=1;a<e.length;a++){let l=e[a];l<n&&(n=l),l>r&&(r=l)}if(n===r)return[{min:n,max:r+1,count:e.length}];let i=(r-n)/t,s=[];for(let a=0;a<t;a++)s.push({min:n+a*i,max:n+(a+1)*i,count:0});for(let a=0;a<e.length;a++){let l=e[a],d=Math.floor((l-n)/i);d>=t&&(d=t-1),s[d].count++}return s}function Ru(e){if(e<=0)return 1;let t=e/5,n=Math.pow(10,Math.floor(Math.log10(t))),r=t/n;return r<=1.5?n:r<=3.5?2*n:r<=7.5?5*n:10*n}function ko(e){return Number.isInteger(e)?String(e):e.toFixed(1)}function Ys(e){let{data:t=[],bins:n=10,width:r=600,height:i=400,barColor:s="#3b82f6",barGap:a=2,showGrid:l=!0,showValues:d=!0,title:u,xLabel:h,yLabel:p,padding:c=60}=e,m=Math.max(1,Math.round(n)),f=q(()=>Iu(t,m),[t,m]),b=q(()=>{let E=0;for(let B=0;B<f.length;B++)f[B].count>E&&(E=f[B].count);return E>0?E:1},[f]),y=r-c*2,g=i-c*2,x=S(()=>{if(!l)return[];let E=Ru(b),B=[];for(let z=E;z<=b;z+=E){let k=c+g-z/b*g;B.push(o("line",{key:`grid-${z}`,x1:String(c),y1:String(k),x2:String(c+y),y2:String(k),stroke:"#e5e7eb","stroke-width":"1","stroke-dasharray":"4 2"})),B.push(o("text",{key:`grid-label-${z}`,x:String(c-8),y:String(k+4),"text-anchor":"end","font-size":"11","font-family":"sans-serif",fill:"#6b7280"},String(z)))}return B},[l,b,c,y,g]),v=S(()=>{let E=[];return E.push(o("line",{key:"axis-y",x1:String(c),y1:String(c),x2:String(c),y2:String(c+g),stroke:"#374151","stroke-width":"1.5"})),E.push(o("line",{key:"axis-x",x1:String(c),y1:String(c+g),x2:String(c+y),y2:String(c+g),stroke:"#374151","stroke-width":"1.5"})),E},[c,y,g]),R=S(()=>{if(f.length===0)return[];let E=[],B=a*(f.length-1),z=Math.max(1,(y-B)/f.length);for(let k=0;k<f.length;k++){let w=f[k],T=w.count/b*g,C=c+k*(z+a),N=c+g-T;if(E.push(o("rect",{key:`bar-${k}`,x:String(C),y:String(N),width:String(z),height:String(T),fill:s})),d&&w.count>0&&E.push(o("text",{key:`val-${k}`,x:String(C+z/2),y:String(N-4),"text-anchor":"middle","font-size":"10","font-family":"sans-serif",fill:"#374151"},String(w.count))),f.length<=15||k%2===0||k===f.length-1){let _=(f.length===1,ko(w.min));E.push(o("text",{key:`xlabel-${k}`,x:String(C+z/2),y:String(c+g+14),"text-anchor":"middle","font-size":"9","font-family":"sans-serif",fill:"#6b7280"},_))}}if(f.length>0){let k=f[f.length-1],w=c+y;E.push(o("text",{key:"xlabel-end",x:String(w),y:String(c+g+14),"text-anchor":"middle","font-size":"9","font-family":"sans-serif",fill:"#6b7280"},ko(k.max)))}return E},[f,b,a,s,d,c,y,g]),D=S(()=>{let E=[];return u&&E.push(o("text",{key:"title",x:String(r/2),y:String(c/2+4),"text-anchor":"middle","font-size":"16","font-weight":"bold","font-family":"sans-serif",fill:"#111827"},u)),h&&E.push(o("text",{key:"x-label",x:String(c+y/2),y:String(i-8),"text-anchor":"middle","font-size":"12","font-family":"sans-serif",fill:"#374151"},h)),p&&E.push(o("text",{key:"y-label",x:String(14),y:String(c+g/2),"text-anchor":"middle","font-size":"12","font-family":"sans-serif",fill:"#374151",transform:`rotate(-90 14 ${c+g/2})`},p)),E},[u,h,p,r,i,c,y,g]),M=S(()=>t.length>0?[]:[o("text",{key:"empty",x:String(r/2),y:String(i/2),"text-anchor":"middle","font-size":"14","font-family":"sans-serif",fill:"#9ca3af"},"No data")],[t.length,r,i]),$=x(),A=v(),I=R(),P=D(),L=M();return o("svg",{width:"100%",viewBox:`0 0 ${r} ${i}`,preserveAspectRatio:"xMidYMid meet",xmlns:"http://www.w3.org/2000/svg",role:"img","aria-label":u??"Histogram",style:{fontFamily:"sans-serif"}},...P,...$,...A,...I,...L)}function Pu(e){if(e<=0)return 1;let t=e/5,n=Math.pow(10,Math.floor(Math.log10(t))),r=t/n;return r<=1.5?n:r<=3.5?2*n:r<=7.5?5*n:10*n}function Vs(e){let{data:t=[],width:n=600,height:r=400,orientation:i="vertical",stemColor:s="#94a3b8",stemWidth:a=2,dotRadius:l=6,dotColor:d="#3b82f6",showGrid:u=!0,showValues:h=!0,title:p,padding:c=60}=e,m=i==="vertical",f=m?30:0,b=n-c*2,y=r-c*2-f,g=m?y:b,x=m?b:y,v=q(()=>{let k=0;for(let w=0;w<t.length;w++)t[w].value>k&&(k=t[w].value);return k>0?k:1},[t]),R=q(()=>t.length===0?0:x/t.length,[t.length,x]),D=S(()=>{if(!u)return[];let k=Pu(v),w=[];for(let T=k;T<=v;T+=k){let C=T/v*g;if(m){let N=c+y-C;w.push(o("line",{key:`grid-${T}`,x1:String(c),y1:String(N),x2:String(c+b),y2:String(N),stroke:"#e5e7eb","stroke-width":"1","stroke-dasharray":"4 2"})),w.push(o("text",{key:`grid-label-${T}`,x:String(c-8),y:String(N+4),"text-anchor":"end","font-size":"11","font-family":"sans-serif",fill:"#6b7280"},String(T)))}else{let N=c+C;w.push(o("line",{key:`grid-${T}`,x1:String(N),y1:String(c),x2:String(N),y2:String(c+y),stroke:"#e5e7eb","stroke-width":"1","stroke-dasharray":"4 2"})),w.push(o("text",{key:`grid-label-${T}`,x:String(N),y:String(c+y+16),"text-anchor":"middle","font-size":"11","font-family":"sans-serif",fill:"#6b7280"},String(T)))}}return w},[u,v,m,c,b,y,g]),M=S(()=>{let k=[];return m?k.push(o("line",{key:"axis-y",x1:String(c),y1:String(c),x2:String(c),y2:String(c+y),stroke:"#374151","stroke-width":"1.5"})):k.push(o("line",{key:"axis-y",x1:String(c),y1:String(c),x2:String(c),y2:String(c+y),stroke:"#374151","stroke-width":"1.5"})),k.push(o("line",{key:"axis-x",x1:String(c),y1:String(c+y),x2:String(c+b),y2:String(c+y),stroke:"#374151","stroke-width":"1.5"})),k},[m,c,b,y]),$=S(()=>{if(t.length===0)return[];let k=[];for(let w=0;w<t.length;w++){let T=t[w],C=T.value/v*g,N=R*w+R/2,F=T.color??d;if(m){let _=c+N,H=c+y,W=c+y-C;k.push(o("line",{key:`stem-${w}`,x1:String(_),y1:String(H),x2:String(_),y2:String(W),stroke:s,"stroke-width":String(a)})),k.push(o("circle",{key:`dot-${w}`,cx:String(_),cy:String(W),r:String(l),fill:F})),h&&k.push(o("text",{key:`val-${w}`,x:String(_),y:String(W-l-4),"text-anchor":"middle","font-size":"11","font-family":"sans-serif",fill:"#374151"},String(T.value)));let V=_,K=c+y+16;k.push(o("text",{key:`cat-${w}`,x:String(V),y:String(K),"text-anchor":"end","font-size":"11","font-family":"sans-serif",fill:"#374151",transform:`rotate(-45, ${V}, ${K})`},T.label))}else{let _=c+N,H=c,W=c+C;k.push(o("line",{key:`stem-${w}`,x1:String(H),y1:String(_),x2:String(W),y2:String(_),stroke:s,"stroke-width":String(a)})),k.push(o("circle",{key:`dot-${w}`,cx:String(W),cy:String(_),r:String(l),fill:F})),h&&k.push(o("text",{key:`val-${w}`,x:String(W+l+4),y:String(_+4),"text-anchor":"start","font-size":"11","font-family":"sans-serif",fill:"#374151"},String(T.value))),k.push(o("text",{key:`cat-${w}`,x:String(c-8),y:String(_+4),"text-anchor":"end","font-size":"11","font-family":"sans-serif",fill:"#374151"},T.label))}}return k},[t,v,R,d,l,s,a,h,m,c,b,y,g]),A=S(()=>p?[o("text",{key:"title",x:String(n/2),y:String(c/2+4),"text-anchor":"middle","font-size":"16","font-weight":"bold","font-family":"sans-serif",fill:"#111827"},p)]:[],[p,n,c]),I=S(()=>t.length>0?[]:[o("text",{key:"empty",x:String(n/2),y:String(r/2),"text-anchor":"middle","font-size":"14","font-family":"sans-serif",fill:"#9ca3af"},"No data")],[t.length,n,r]),P=D(),L=M(),E=$(),B=A(),z=I();return o("svg",{width:"100%",viewBox:`0 0 ${n} ${r}`,preserveAspectRatio:"xMidYMid meet",xmlns:"http://www.w3.org/2000/svg",role:"img","aria-label":p??"Lollipop chart",style:{fontFamily:"sans-serif"}},...B,...P,...L,...E,...z)}function Co(e){let t=e.replace("#",""),n=t.length===3?t[0]+t[0]+t[1]+t[1]+t[2]+t[2]:t,r=parseInt(n,16);return{r:r>>16&255,g:r>>8&255,b:r&255}}function Tu(e,t,n){let r=i=>{let s=Math.max(0,Math.min(255,Math.round(i))).toString(16);return s.length===1?"0"+s:s};return`#${r(e)}${r(t)}${r(n)}`}function Du(e,t){if(t.length===0)return"#000000";if(t.length===1)return t[0];let n=Math.max(0,Math.min(1,e)),r=t.length-1,i=Math.min(Math.floor(n*r),r-1),s=n*r-i,a=Co(t[i]),l=Co(t[i+1]);return Tu(a.r+(l.r-a.r)*s,a.g+(l.g-a.g)*s,a.b+(l.b-a.b)*s)}function $u(e){let{r:t,g:n,b:r}=Co(e);return(.299*t+.587*n+.114*r)/255}var zu=["#f0f9ff","#3b82f6","#1e3a8a"];function Us(e){let{data:t=[],labels:n,rowLabels:r,columnLabels:i,width:s=500,height:a=500,colorScale:l=zu,showValues:d=!0,showDiagonal:u=!0,cellBorderColor:h="#e5e7eb",title:p,padding:c=70,symmetric:m=!1}=e,f=r??n,b=i??n,y=t.length,g=q(()=>{let F=0;for(let _ of t)_.length>F&&(F=_.length);return F},[t]),x=q(()=>{if(!m||y===0)return t;let F=[],_=Math.max(y,g);for(let H=0;H<_;H++){let W=[];for(let V=0;V<_;V++){let K=t[H],Q=K&&V<K.length?K[V]:0,G=t[V],O=G&&H<G.length?G[H]:0;Q!==0?W.push(Q):W.push(O)}F.push(W)}return F},[t,m,y,g]),v=x.length,R=q(()=>{let F=0;for(let _ of x)_.length>F&&(F=_.length);return F},[x]),{minVal:D,maxVal:M}=q(()=>{let F=1/0,_=-1/0;for(let H of x)for(let W of H)W<F&&(F=W),W>_&&(_=W);return F===1/0&&(F=0),_===-1/0&&(_=1),F===_&&(_=F+1),{minVal:F,maxVal:_}},[x]),$=p?30:0,A=f?c:20,I=b?c:20,P=s-A-20,L=a-$-I-20,E=R>0?P/R:0,B=v>0?L/v:0,z=S(()=>{let F=[];for(let _=0;_<v;_++){let H=x[_];for(let W=0;W<R;W++){let V=W<H.length?H[W]:0,K=(V-D)/(M-D),Q=Du(K,l),G=A+W*E,O=$+20+_*B,Y=_===W,X=Y&&u?"currentColor":h,U=Y&&u?"2":"1";if(F.push(o("rect",{key:`cell-${_}-${W}`,x:String(G),y:String(O),width:String(E),height:String(B),fill:Q,stroke:X,"stroke-width":U})),d){let Z=$u(Q)>.5?"#111827":"#ffffff",ee=Math.min(12,E*.3,B*.35);F.push(o("text",{key:`val-${_}-${W}`,x:String(G+E/2),y:String(O+B/2),"text-anchor":"middle","dominant-baseline":"central","font-size":String(Math.max(8,ee)),"font-weight":Y&&u?"bold":"normal","font-family":"sans-serif",fill:Z},String(Math.round(V*100)/100)))}}}return F},[x,v,R,D,M,l,E,B,A,$,d,u,h]),k=S(()=>{let F=[];if(f)for(let _=0;_<v;_++){let H=_<f.length?f[_]:"",W=$+20+_*B+B/2;F.push(o("text",{key:`row-label-${_}`,x:String(A-8),y:String(W),"text-anchor":"end","dominant-baseline":"central","font-size":"11","font-family":"sans-serif",fill:"currentColor"},H))}if(b)for(let _=0;_<R;_++){let H=_<b.length?b[_]:"",W=A+_*E+E/2,V=$+20+v*B+12;F.push(o("text",{key:`col-label-${_}`,x:String(W),y:String(V),"text-anchor":"middle","font-size":"11","font-family":"sans-serif",fill:"currentColor"},H))}return F},[f,b,v,R,E,B,A,$]),w=S(()=>p?[o("text",{key:"title",x:String(s/2),y:"22","text-anchor":"middle","font-size":"16","font-weight":"bold","font-family":"sans-serif",fill:"currentColor"},p)]:[],[p,s]);if(v===0||R===0)return o("svg",{width:"100%",viewBox:`0 0 ${s} ${a}`,preserveAspectRatio:"xMidYMid meet",xmlns:"http://www.w3.org/2000/svg",role:"img","aria-label":p??"Matrix \u2014 no data"},o("text",{x:String(s/2),y:String(a/2),"text-anchor":"middle","font-size":"14","font-family":"sans-serif",fill:"currentColor",opacity:"0.6"},"No data to display."));let T=w(),C=z(),N=k();return o("svg",{width:"100%",viewBox:`0 0 ${s} ${a}`,preserveAspectRatio:"xMidYMid meet",xmlns:"http://www.w3.org/2000/svg",role:"img","aria-label":p??"Matrix visualization",style:{fontFamily:"sans-serif"}},...T,...C,...N)}var Au=["#3b82f6","#22c55e","#f59e0b","#ef4444","#8b5cf6","#ec4899","#14b8a6","#f97316","#6366f1","#84cc16"];function En(e){if(!e.children||e.children.length===0)return Math.max(0,e.value??0);let t=0,n=[e];for(;n.length>0;){let r=n.pop();if(!r.children||r.children.length===0)t+=Math.max(0,r.value??0);else for(let i=r.children.length-1;i>=0;i--)n.push(r.children[i])}return t}function Lu(e){let t=0,n=[{node:e,depth:0}];for(;n.length>0;){let{node:r,depth:i}=n.pop();if(i>t&&(t=i),r.children)for(let s=r.children.length-1;s>=0;s--)n.push({node:r.children[s],depth:i+1})}return t}function Bu(e,t,n,r,i,s,a){let l=[];if(En(e)<=0)return l;let h=Lu(e)+1,p=s==="horizontal",c=p?i/h:r/h,m=[];for(m.push({node:e,depth:0,spanStart:p?t:n,spanEnd:p?t+r:n+i,colorIndex:0});m.length>0;){let f=m.shift(),{node:b,depth:y,spanStart:g,spanEnd:x,colorIndex:v}=f,R=En(b);if(R<=0)continue;let D=x-g,M,$,A,I;if(p?(M=g,$=n+y*c,A=D,I=c):(M=t+y*c,$=g,A=c,I=D),l.push({x:M,y:$,w:A,h:I,label:b.label,value:R,color:b.color??a[v%a.length],depth:y}),b.children&&b.children.length>0){let P=g;for(let L=0;L<b.children.length;L++){let E=b.children[L],B=En(E);if(B<=0)continue;let z=B/R*D;m.push({node:E,depth:y+1,spanStart:P,spanEnd:P+z,colorIndex:y===0?L:v}),P+=z}}}return l}function js(e){let{data:t,width:n=600,height:r=400,orientation:i="horizontal",showLabels:s=!0,showValues:a=!0,colors:l=Au,borderColor:d="#ffffff",borderWidth:u=1,title:h,padding:p=10}=e,c=h?30:0,m=p,f=p+c,b=n-p*2,y=r-p*2-c;if(q(()=>En(t),[t])<=0||b<=0||y<=0)return o("svg",{width:"100%",viewBox:`0 0 ${n} ${r}`,preserveAspectRatio:"xMidYMid meet",xmlns:"http://www.w3.org/2000/svg",role:"img","aria-label":h??"Empty partition diagram"},o("text",{x:String(n/2),y:String(r/2),"text-anchor":"middle","font-size":"14","font-family":"sans-serif",fill:"#9ca3af"},"No data to display"));let x=q(()=>Bu(t,m,f,b,y,i,l),[t,m,f,b,y,i,l]),v=[];h&&v.push(o("text",{key:"title",x:String(n/2),y:String(p+16),"text-anchor":"middle","font-size":"16","font-weight":"bold","font-family":"sans-serif",fill:"#111827"},h));for(let R=0;R<x.length;R++){let D=x[R];if(v.push(o("rect",{key:`cell-${R}`,x:String(D.x),y:String(D.y),width:String(Math.max(0,D.w)),height:String(Math.max(0,D.h)),fill:D.color,stroke:d,"stroke-width":String(u),role:"graphics-symbol","aria-label":`${D.label}: ${D.value}`})),s&&D.w>20&&D.h>14){let M=Math.floor(D.w/7),$=D.label.length>M?D.label.substring(0,Math.max(1,M-2))+"..":D.label;v.push(o("text",{key:`label-${R}`,x:String(D.x+D.w/2),y:String(D.y+D.h/2+(a?-2:4)),"text-anchor":"middle","font-size":"11","font-family":"sans-serif",fill:"#ffffff","pointer-events":"none"},$))}a&&D.w>30&&D.h>28&&v.push(o("text",{key:`value-${R}`,x:String(D.x+D.w/2),y:String(D.y+D.h/2+12),"text-anchor":"middle","font-size":"10","font-family":"sans-serif",fill:"rgba(255,255,255,0.8)","pointer-events":"none"},String(D.value)))}return o("svg",{width:"100%",viewBox:`0 0 ${n} ${r}`,preserveAspectRatio:"xMidYMid meet",xmlns:"http://www.w3.org/2000/svg",role:"img","aria-label":h??"Partition diagram",style:{fontFamily:"sans-serif"}},...v)}function Mo(e,t){let n=[];for(let r of t)n.push(String(e[r]??""));return n.join(" | ")}function Gs(e,t){let n=new Set;for(let i of e)n.add(Mo(i,t));let r=Array.from(n);return r.sort(),r}function In(e,t){if(e.length===0)return 0;switch(t){case"count":return e.length;case"sum":{let n=0;for(let r of e)n+=r;return n}case"avg":{let n=0;for(let r of e)n+=r;return n/e.length}case"min":{let n=e[0];for(let r=1;r<e.length;r++)e[r]<n&&(n=e[r]);return n}case"max":{let n=e[0];for(let r=1;r<e.length;r++)e[r]>n&&(n=e[r]);return n}}}function Rn(e){return Number.isInteger(e)?String(e):e.toFixed(2)}function Fu(e,t,n,r,i){let s=Gs(e,t),a=Gs(e,n),l=new Map;for(let m of e){let f=Mo(m,t),b=Mo(m,n),y=`${f}::${b}`;l.has(y)||l.set(y,[]);let g=l.get(y),x=0;for(let v of r){let R=m[v];if(typeof R=="number")x+=R;else if(typeof R=="string"){let D=parseFloat(R);isNaN(D)||(x+=D)}}g.push(x)}let d=new Map;for(let[m,f]of l)d.set(m,In(f,i));let u=new Map;for(let m of s){let f=[];for(let b of a){let y=d.get(`${m}::${b}`);y!==void 0&&f.push(y)}u.set(m,In(f,i==="count"?"sum":i))}let h=new Map;for(let m of a){let f=[];for(let b of s){let y=d.get(`${b}::${m}`);y!==void 0&&f.push(y)}h.set(m,In(f,i==="count"?"sum":i))}let p=[];for(let m of u.values())p.push(m);let c=In(p,i==="count"?"sum":i);return{rowKeys:s,colKeys:a,cells:d,rowTotals:u,colTotals:h,grandTotal:c}}function Xs(e){let{data:t=[],rows:n=[],columns:r=[],values:i=[],aggregation:s="sum",width:a=600,height:l=400,showTotals:d=!0,title:u,headerColor:h="#3b82f6",cellPadding:p=8}=e;if(t.length===0||n.length===0&&r.length===0||i.length===0)return o("svg",{width:"100%",viewBox:`0 0 ${a} ${l}`,preserveAspectRatio:"xMidYMid meet",xmlns:"http://www.w3.org/2000/svg",role:"table","aria-label":u??"Empty pivot table"},o("text",{x:String(a/2),y:String(l/2),"text-anchor":"middle","font-size":"14","font-family":"sans-serif",fill:"currentColor",opacity:"0.4"},"No data to display"));let c=q(()=>Fu(t,n,r,i,s),[t,n,r,i,s]),{rowKeys:m,colKeys:f,cells:b,rowTotals:y,colTotals:g,grandTotal:x}=c,v=u?30:0,R=f.length+(d?1:0),D=m.length+(d?1:0),M=1+R,$=1+D,A=Math.max(40,(a-p*2)/M),I=Math.max(20,Math.min(36,(l-v-p*2)/$)),P=A*M,L=I*$,E=Math.max(0,(a-P)/2),B=v+Math.max(0,(l-v-L)/2),z=[];u&&z.push(o("text",{key:"title",x:String(a/2),y:String(20),"text-anchor":"middle","font-size":"16","font-weight":"bold","font-family":"sans-serif",fill:"currentColor"},u)),z.push(o("rect",{key:"header-row-bg",x:String(E),y:String(B),width:String(P),height:String(I),fill:h})),z.push(o("rect",{key:"header-col-bg",x:String(E),y:String(B+I),width:String(A),height:String(I*D),fill:h,opacity:"0.85"})),z.push(o("text",{key:"corner",x:String(E+A/2),y:String(B+I/2+4),"text-anchor":"middle","font-size":"10","font-family":"sans-serif","font-weight":"bold",fill:"#ffffff"},s.toUpperCase()));for(let k=0;k<f.length;k++){let w=E+(k+1)*A,T=Math.floor(A/7),C=f[k],N=C.length>T?C.substring(0,Math.max(1,T-2))+"..":C;z.push(o("text",{key:`ch-${k}`,x:String(w+A/2),y:String(B+I/2+4),"text-anchor":"middle","font-size":"11","font-family":"sans-serif","font-weight":"bold",fill:"#ffffff"},N))}d&&z.push(o("text",{key:"ch-total",x:String(E+(f.length+1)*A+A/2),y:String(B+I/2+4),"text-anchor":"middle","font-size":"11","font-family":"sans-serif","font-weight":"bold",fill:"#ffffff"},"Total"));for(let k=0;k<m.length;k++){let w=m[k],T=B+(k+1)*I;k%2===0&&z.push(o("rect",{key:`row-bg-${k}`,x:String(E+A),y:String(T),width:String(A*R),height:String(I),fill:"#f9fafb"}));let C=Math.floor(A/7),N=w.length>C?w.substring(0,Math.max(1,C-2))+"..":w;z.push(o("text",{key:`rh-${k}`,x:String(E+A/2),y:String(T+I/2+4),"text-anchor":"middle","font-size":"11","font-family":"sans-serif","font-weight":"bold",fill:"#ffffff"},N));for(let F=0;F<f.length;F++){let _=f[F],H=`${w}::${_}`,W=b.get(H),V=E+(F+1)*A;z.push(o("rect",{key:`border-${k}-${F}`,x:String(V),y:String(T),width:String(A),height:String(I),fill:"none",stroke:"#e5e7eb","stroke-width":"0.5"})),z.push(o("text",{key:`cell-${k}-${F}`,x:String(V+A/2),y:String(T+I/2+4),"text-anchor":"middle","font-size":"11","font-family":"sans-serif",fill:"currentColor"},W!==void 0?Rn(W):"-"))}if(d){let F=E+(f.length+1)*A,_=y.get(w)??0;z.push(o("rect",{key:`rt-bg-${k}`,x:String(F),y:String(T),width:String(A),height:String(I),fill:"#eff6ff"})),z.push(o("text",{key:`rt-${k}`,x:String(F+A/2),y:String(T+I/2+4),"text-anchor":"middle","font-size":"11","font-family":"sans-serif","font-weight":"bold",fill:"#1e40af"},Rn(_)))}}if(d){let k=B+(m.length+1)*I;z.push(o("rect",{key:"total-row-bg",x:String(E),y:String(k),width:String(P),height:String(I),fill:"#eff6ff"})),z.push(o("text",{key:"total-label",x:String(E+A/2),y:String(k+I/2+4),"text-anchor":"middle","font-size":"11","font-family":"sans-serif","font-weight":"bold",fill:"#1e40af"},"Total"));for(let T=0;T<f.length;T++){let C=f[T],N=g.get(C)??0,F=E+(T+1)*A;z.push(o("text",{key:`ct-${T}`,x:String(F+A/2),y:String(k+I/2+4),"text-anchor":"middle","font-size":"11","font-family":"sans-serif","font-weight":"bold",fill:"#1e40af"},Rn(N)))}let w=E+(f.length+1)*A;z.push(o("text",{key:"grand-total",x:String(w+A/2),y:String(k+I/2+4),"text-anchor":"middle","font-size":"12","font-family":"sans-serif","font-weight":"bold",fill:"#1e3a8a"},Rn(x)))}return z.push(o("rect",{key:"outer-border",x:String(E),y:String(B),width:String(P),height:String(L),fill:"none",stroke:"#d1d5db","stroke-width":"1"})),o("svg",{width:"100%",viewBox:`0 0 ${a} ${l}`,preserveAspectRatio:"xMidYMid meet",xmlns:"http://www.w3.org/2000/svg",role:"table","aria-label":u??"Pivot table",style:{fontFamily:"sans-serif"}},...z)}function Pn(e,t){return Math.PI*2*e/t-Math.PI/2}function Tn(e,t,n,r){return{x:e+n*Math.cos(r),y:t+n*Math.sin(r)}}function Ks(e){let{axes:t=[],series:n=[],width:r=500,height:i=500,levels:s=5,showLabels:a=!0,showValues:l=!1,showLegend:d=!0,showDots:u=!0,gridColor:h="#d1d5db",title:p}=e,c=t.length,m=p?30:0,f=d&&n.length>0?30:0,b=60,y=Math.min((r-b*2)/2,(i-b*2-m-f)/2),g=r/2,x=b+m+y,v=q(()=>{let z=[];for(let k=0;k<c;k++){let w=t[k]?.max;if(w!==void 0&&w>0){z.push(w);continue}let T=0;for(let C of n){let N=C.values[k];N!==void 0&&N>T&&(T=N)}z.push(T>0?T:1)}return z},[t,n,c]),R=S(()=>{if(c<3)return[];let z=[];for(let k=1;k<=s;k++){let w=y*k/s,T=[];for(let C=0;C<c;C++){let N=Pn(C,c),F=Tn(g,x,w,N);T.push(`${F.x},${F.y}`)}z.push(o("polygon",{key:`ring-${k}`,points:T.join(" "),fill:"none",stroke:h,"stroke-width":k===s?"1.5":"0.5","stroke-dasharray":k===s?"none":"3 2"}))}for(let k=0;k<c;k++){let w=Pn(k,c),T=Tn(g,x,y,w);z.push(o("line",{key:`spoke-${k}`,x1:String(g),y1:String(x),x2:String(T.x),y2:String(T.y),stroke:h,"stroke-width":"0.75"}))}return z},[c,s,y,g,x,h]),D=S(()=>{if(!a||c<3)return[];let z=[],k=16;for(let w=0;w<c;w++){let T=Pn(w,c),C=Tn(g,x,y+k,T),N="middle";C.x<g-5?N="end":C.x>g+5&&(N="start");let F=Math.abs(C.y-x)<5?"0.35em":C.y<x?"0em":"0.7em";z.push(o("text",{key:`label-${w}`,x:String(C.x),y:String(C.y),"text-anchor":N,dy:F,"font-size":"12","font-family":"sans-serif",fill:"currentColor"},t[w]?.label??`Axis ${w}`))}return z},[a,c,t,y,g,x]),M=S(()=>{if(c<3||n.length===0)return[];let z=[];for(let k=0;k<n.length;k++){let w=n[k],T=[],C=[],N=[];for(let F=0;F<c;F++){let _=w.values[F]??0,H=v[F],W=Math.min(_/H,1),V=y*W,K=Pn(F,c),Q=Tn(g,x,V,K);T.push(`${Q.x},${Q.y}`),u&&C.push(o("circle",{key:`dot-${k}-${F}`,cx:String(Q.x),cy:String(Q.y),r:"3.5",fill:w.color,stroke:"#fff","stroke-width":"1.5"})),l&&N.push(o("text",{key:`val-${k}-${F}`,x:String(Q.x),y:String(Q.y-8),"text-anchor":"middle","font-size":"10","font-family":"sans-serif",fill:w.color},String(Math.round(_*100)/100)))}z.push(o("polygon",{key:`series-fill-${k}`,points:T.join(" "),fill:w.color,"fill-opacity":String(w.fillOpacity??.15),stroke:"none"})),z.push(o("polygon",{key:`series-line-${k}`,points:T.join(" "),fill:"none",stroke:w.color,"stroke-width":"2","stroke-linejoin":"round"}));for(let F of C)z.push(F);for(let F of N)z.push(F)}return z},[c,n,v,y,g,x,u,l]),$=S(()=>{if(!d||n.length===0)return[];let z=[],k=x+y+40,w=100,T=n.length*w,C=g-T/2;for(let N=0;N<n.length;N++){let F=n[N],_=C+N*w;z.push(o("rect",{key:`legend-swatch-${N}`,x:String(_),y:String(k),width:"12",height:"12",rx:"2",fill:F.color})),z.push(o("text",{key:`legend-text-${N}`,x:String(_+16),y:String(k+10),"font-size":"12","font-family":"sans-serif",fill:"currentColor"},F.label))}return z},[d,n,g,x,y]),A=S(()=>p?[o("text",{key:"title",x:String(r/2),y:"24","text-anchor":"middle","font-size":"16","font-weight":"bold","font-family":"sans-serif",fill:"currentColor"},p)]:[],[p,r]);if(c<3)return o("svg",{width:"100%",viewBox:`0 0 ${r} ${i}`,preserveAspectRatio:"xMidYMid meet",xmlns:"http://www.w3.org/2000/svg",role:"img","aria-label":p??"Radar chart \u2014 insufficient axes"},o("text",{x:String(r/2),y:String(i/2),"text-anchor":"middle","font-size":"14","font-family":"sans-serif",fill:"currentColor",opacity:"0.6"},"Radar chart requires at least 3 axes."));let I=R(),P=D(),L=M(),E=$(),B=A();return o("svg",{width:"100%",viewBox:`0 0 ${r} ${i}`,preserveAspectRatio:"xMidYMid meet",xmlns:"http://www.w3.org/2000/svg",role:"img","aria-label":p??"Radar chart",style:{fontFamily:"sans-serif"}},...B,...I,...P,...L,...E)}var Nu=["#3b82f6","#ef4444","#22c55e","#f59e0b","#8b5cf6","#ec4899","#14b8a6","#f97316","#6366f1","#84cc16"];function Wu(e,t){let n=new Map,r=new Map,i=new Map;for(let l of e)r.set(l,new Set),i.set(l,[]);for(let l of t){if(l.value<=0)continue;let d=r.get(l.target);d&&d.add(l.source);let u=i.get(l.source);u&&u.push(l.target)}let s=[];for(let l of e)r.get(l).size===0&&(n.set(l,0),s.push(l));if(s.length===0){for(let l of e)n.set(l,0);return n}let a=0;for(;a<s.length;){let l=s[a];a++;let d=n.get(l),u=i.get(l)??[];for(let h of u){let p=n.get(h),c=d+1;(p===void 0||c>p)&&n.set(h,c),s.includes(h)||s.push(h)}}for(let l of e)n.has(l)||n.set(l,0);return n}function _u(e,t,n,r,i,s,a,l){if(e.length===0)return{layoutNodes:[],layoutLinks:[]};let d=n-a*2,u=r-a*2,h=t.filter(P=>P.value>0),p=e.map(P=>P.id),c=Wu(p,h),m=new Map,f=new Map;for(let P of p)m.set(P,0),f.set(P,0);for(let P of h)f.set(P.source,(f.get(P.source)??0)+P.value),m.set(P.target,(m.get(P.target)??0)+P.value);let b=0;for(let P of c.values())P>b&&(b=P);let y=new Map;for(let P=0;P<=b;P++)y.set(P,[]);for(let[P,L]of c)y.get(L).push(P);let g=new Map,x=b>0?(d-i)/b:0;for(let P=0;P<=b;P++)g.set(P,a+P*x);let v=new Map;for(let P=0;P<e.length;P++)v.set(e[P].id,e[P]);let R=[],D=new Map;for(let P=0;P<=b;P++){let L=y.get(P);if(L.length===0)continue;let E=0;for(let w of L){let T=m.get(w)??0,C=f.get(w)??0;E+=Math.max(T,C,1)}let B=u-s*(L.length-1),z=E>0?B/E:1,k=a;for(let w=0;w<L.length;w++){let T=L[w],C=v.get(T),N=m.get(T)??0,F=f.get(T)??0,_=Math.max(N,F,1),H=Math.max(4,_*z),W=e.findIndex(K=>K.id===T),V={id:T,label:C.label,color:C.color??l[W%l.length],column:P,x:g.get(P),y:k,height:H,totalIn:N,totalOut:F,totalValue:_};R.push(V),D.set(T,V),k+=H+s}}let M=new Map,$=new Map;for(let P of p)M.set(P,0),$.set(P,0);let A=[...h].sort((P,L)=>L.value-P.value),I=[];for(let P of A){let L=D.get(P.source),E=D.get(P.target);if(!L||!E)continue;let B=L.totalOut||1,z=E.totalIn||1,k=P.value/B*L.height,w=P.value/z*E.height,T=Math.max(1,(k+w)/2),C=M.get(P.source),N=$.get(P.target),F=L.y+C+k/2,_=E.y+N+w/2;M.set(P.source,C+k),$.set(P.target,N+w);let H=v.get(P.source);I.push({source:P.source,target:P.target,value:P.value,color:P.color??H?.color??L.color,sourceY:F,targetY:_,width:T})}return{layoutNodes:R,layoutLinks:I}}function qs(e){let{nodes:t,links:n,width:r=800,height:i=500,nodeWidth:s=20,nodePadding:a=10,showLabels:l=!0,showValues:d=!1,linkOpacity:u=.4,colors:h=Nu,title:p,padding:c=40}=e;if(!t||t.length===0)return o("svg",{width:"100%",viewBox:`0 0 ${r} ${i}`,preserveAspectRatio:"xMidYMid meet",xmlns:"http://www.w3.org/2000/svg",role:"img","aria-label":p??"Empty Sankey diagram"},o("text",{x:String(r/2),y:String(i/2),"text-anchor":"middle","font-size":"14","font-family":"sans-serif",fill:"#6b7280"},"No data"));let m=q(()=>_u(t,n,r,i,s,a,c,h),[t,n,r,i,s,a,c,h]),f=S(()=>{let R=[];for(let D=0;D<m.layoutLinks.length;D++){let M=m.layoutLinks[D],$=m.layoutNodes.find(B=>B.id===M.source),A=m.layoutNodes.find(B=>B.id===M.target);if(!$||!A)continue;let I=$.x+s,P=A.x,L=(I+P)/2,E=`M ${I} ${M.sourceY} C ${L} ${M.sourceY}, ${L} ${M.targetY}, ${P} ${M.targetY}`;R.push(o("path",{key:`link-${D}`,d:E,fill:"none",stroke:M.color,"stroke-width":String(Math.max(1,M.width)),"stroke-opacity":String(u),"stroke-linecap":"butt"})),d&&M.value>0&&R.push(o("text",{key:`link-val-${D}`,x:String(L),y:String((M.sourceY+M.targetY)/2-4),"text-anchor":"middle","font-size":"9","font-family":"sans-serif",fill:"#6b7280","pointer-events":"none"},String(M.value)))}return R},[m,s,u,d]),b=S(()=>{let R=[];for(let D=0;D<m.layoutNodes.length;D++){let M=m.layoutNodes[D];if(R.push(o("rect",{key:`node-${M.id}`,x:String(M.x),y:String(M.y),width:String(s),height:String(M.height),fill:M.color,stroke:"#374151","stroke-width":"0.5",role:"img","aria-label":`${M.label}: ${M.totalValue}`})),l){let $=m.layoutNodes.reduce((z,k)=>Math.max(z,k.column),0),A=M.column===$,I=A?M.x+s+6:M.x-6,P=A?"start":"end",L=M.column===0,E=L?M.x-6:I,B=L?"end":P;R.push(o("text",{key:`label-${M.id}`,x:String(E),y:String(M.y+M.height/2+4),"text-anchor":B,"font-size":"11","font-family":"sans-serif",fill:"#374151","pointer-events":"none"},M.label))}}return R},[m,s,l]),y=S(()=>p?[o("text",{key:"title",x:String(r/2),y:String(c/2+4),"text-anchor":"middle","font-size":"16","font-weight":"bold","font-family":"sans-serif",fill:"#111827"},p)]:[],[p,r,c]),g=f(),x=b(),v=y();return o("svg",{width:"100%",viewBox:`0 0 ${r} ${i}`,preserveAspectRatio:"xMidYMid meet",xmlns:"http://www.w3.org/2000/svg",role:"img","aria-label":p??"Sankey diagram",style:{fontFamily:"sans-serif"}},...v,...g,...x)}var Ou=["#3b82f6","#22c55e","#f59e0b","#ef4444","#8b5cf6","#ec4899","#14b8a6","#f97316","#6366f1","#84cc16"],Eo=2*Math.PI;function Ot(e){if(!e.children||e.children.length===0)return Math.max(0,e.value??0);let t=0,n=[e];for(;n.length>0;){let r=n.pop();if(!r.children||r.children.length===0)t+=Math.max(0,r.value??0);else for(let i=r.children.length-1;i>=0;i--)n.push(r.children[i])}return t}function Hu(e){let t=0,n=[{node:e,depth:0}];for(;n.length>0;){let{node:r,depth:i}=n.pop();if(i>t&&(t=i),r.children)for(let s=r.children.length-1;s>=0;s--)n.push({node:r.children[s],depth:i+1})}return t}function Yu(e,t,n,r,i,s){let a=s-i,l=a>Math.PI?1:0,d=i-Math.PI/2,u=s-Math.PI/2,h=e+r*Math.cos(d),p=t+r*Math.sin(d),c=e+r*Math.cos(u),m=t+r*Math.sin(u),f=e+n*Math.cos(u),b=t+n*Math.sin(u),y=e+n*Math.cos(d),g=t+n*Math.sin(d);if(a>=Eo-.001){let x=d+Math.PI,v=e+r*Math.cos(x),R=t+r*Math.sin(x),D=e+n*Math.cos(x),M=t+n*Math.sin(x);return[`M ${h} ${p}`,`A ${r} ${r} 0 1 1 ${v} ${R}`,`A ${r} ${r} 0 1 1 ${h} ${p}`,`L ${y} ${g}`,`A ${n} ${n} 0 1 0 ${D} ${M}`,`A ${n} ${n} 0 1 0 ${y} ${g}`,"Z"].join(" ")}return[`M ${h} ${p}`,`A ${r} ${r} 0 ${l} 1 ${c} ${m}`,`L ${f} ${b}`,`A ${n} ${n} 0 ${l} 0 ${y} ${g}`,"Z"].join(" ")}function Vu(e,t,n,r){let i=[],s=Ot(e);if(s<=0)return i;let a=Hu(e),l=a>0?(n-t)/(a+1):n-t,d=[];if(e.children&&e.children.length>0){let u=0;for(let h=0;h<e.children.length;h++){let p=e.children[h],c=Ot(p);if(c<=0)continue;let m=c/s*Eo;d.push({node:p,startAngle:u,endAngle:u+m,depth:0,colorIndex:h}),u+=m}}else return i.push({startAngle:0,endAngle:Eo,innerR:t,outerR:t+l,label:e.label,value:s,color:e.color??r[0],depth:0}),i;for(;d.length>0;){let u=d.shift(),{node:h,startAngle:p,endAngle:c,depth:m,colorIndex:f}=u,b=Ot(h);if(b<=0)continue;let y=t+m*l,g=y+l;if(i.push({startAngle:p,endAngle:c,innerR:y,outerR:g,label:h.label,value:b,color:h.color??r[f%r.length],depth:m}),h.children&&h.children.length>0){let x=p,v=c-p;for(let R=0;R<h.children.length;R++){let D=h.children[R],M=Ot(D);if(M<=0)continue;let $=M/b*v;d.push({node:D,startAngle:x,endAngle:x+$,depth:m+1,colorIndex:f}),x+=$}}}return i}function Zs(e){let{data:t,width:n=500,height:r=500,innerRadius:i=40,showLabels:s=!0,colors:a=Ou,strokeColor:l="#ffffff",strokeWidth:d=1,title:u}=e,h=n/2,p=r/2,c=u?20:0,m=Math.min(h,p-c)-10;if(q(()=>Ot(t),[t])<=0)return o("svg",{width:"100%",viewBox:`0 0 ${n} ${r}`,preserveAspectRatio:"xMidYMid meet",xmlns:"http://www.w3.org/2000/svg",role:"img","aria-label":u??"Empty sunburst chart"},o("text",{x:String(h),y:String(p),"text-anchor":"middle","font-size":"14","font-family":"sans-serif",fill:"#9ca3af"},"No data to display"));let b=q(()=>Vu(t,i,m,a),[t,i,m,a]),y=[];u&&y.push(o("text",{key:"title",x:String(h),y:String(20),"text-anchor":"middle","font-size":"16","font-weight":"bold","font-family":"sans-serif",fill:"#111827"},u));let g=p+c/2;for(let x=0;x<b.length;x++){let v=b[x],R=Yu(h,g,v.innerR,v.outerR,v.startAngle,v.endAngle);if(y.push(o("path",{key:`arc-${x}`,d:R,fill:v.color,stroke:l,"stroke-width":String(d),role:"graphics-symbol","aria-label":`${v.label}: ${v.value}`})),s){let D=v.endAngle-v.startAngle,M=v.startAngle+D/2-Math.PI/2,$=(v.innerR+v.outerR)/2,A=v.outerR-v.innerR,I=D*$;if(I>20&&A>14){let P=h+$*Math.cos(M),L=g+$*Math.sin(M),E=Math.floor(Math.min(I,A)/7),B=v.label.length>E?v.label.substring(0,Math.max(1,E-1))+"..":v.label;y.push(o("text",{key:`label-${x}`,x:String(P),y:String(L+4),"text-anchor":"middle","font-size":"10","font-family":"sans-serif",fill:"#ffffff","pointer-events":"none"},B))}}}return o("svg",{width:"100%",viewBox:`0 0 ${n} ${r}`,preserveAspectRatio:"xMidYMid meet",xmlns:"http://www.w3.org/2000/svg",role:"img","aria-label":u??"Sunburst chart",style:{fontFamily:"sans-serif"}},...y)}var Uu=["#3b82f6","#22c55e","#f59e0b","#ef4444","#8b5cf6","#ec4899","#14b8a6","#f97316","#6366f1","#84cc16"];function Dn(e){if(!e.children||e.children.length===0)return Math.max(0,e.value);let t=0,n=[e];for(;n.length>0;){let r=n.pop();if(!r.children||r.children.length===0)t+=Math.max(0,r.value);else for(let i=r.children.length-1;i>=0;i--)n.push(r.children[i])}return t}function Js(e,t){if(e.length===0||t<=0)return 1/0;let n=0;for(let s of e)n+=s;if(n<=0)return 1/0;let r=n/t,i=0;for(let s of e){if(s<=0)continue;let a=s/r,l=Math.max(a/r,r/a);l>i&&(i=l)}return i}function ju(e,t,n,r,i,s){let a=[],l=[],d=Dn(e);if(d<=0||r<=0||i<=0)return a;let u=e.children&&e.children.length>0?e.children:[e],h=r*i,p=[];for(let c=0;c<u.length;c++){let m=u[c],f=Dn(m);f<=0||p.push({label:m.label,value:f,area:f/d*h,color:m.color??s[c%s.length],node:m})}for(p.sort((c,m)=>m.area-c.area),l.push({nodes:p,rect:{x:t,y:n,w:r,h:i},depth:0});l.length>0;){let c=l.shift(),{nodes:m,rect:f,depth:b}=c;if(m.length===0)continue;let y={...f},g=0;for(;g<m.length&&y.w>0&&y.h>0;){let x=y.w>=y.h,v=x?y.h:y.w,R=[],D=[];R.push(m[g]),D.push(m[g].area),g++;let M=Js(D,v);for(;g<m.length;){let P=[...D,m[g].area],L=Js(P,v);if(L>M)break;R.push(m[g]),D.push(m[g].area),M=L,g++}let $=0;for(let P of D)$+=P;let A=v>0?$/v:0,I=0;for(let P=0;P<R.length;P++){let L=R[P],E=A>0?L.area/A:0,B,z,k,w;if(x?(B=y.x,z=y.y+I,k=A,w=E):(B=y.x+I,z=y.y,k=E,w=A),a.push({x:B,y:z,w:k,h:w,label:L.label,value:L.value,color:L.color,depth:b}),L.node.children&&L.node.children.length>0){let C=B+2,N=z+2+14,F=k-4,_=w-4-14;if(F>4&&_>4){let H=[],W=L.value,V=F*_;for(let K=0;K<L.node.children.length;K++){let Q=L.node.children[K],G=Dn(Q);G<=0||H.push({label:Q.label,value:G,area:G/W*V,color:Q.color??s[(K+b+1)%s.length],node:Q})}H.sort((K,Q)=>Q.area-K.area),l.push({nodes:H,rect:{x:C,y:N,w:F,h:_},depth:b+1})}}I+=E}x?y={x:y.x+A,y:y.y,w:y.w-A,h:y.h}:y={x:y.x,y:y.y+A,w:y.w,h:y.h-A}}}return a}function Qs(e){let{data:t,width:n=600,height:r=400,showLabels:i=!0,showValues:s=!0,colors:a=Uu,borderColor:l="#ffffff",borderWidth:d=2,padding:u=2,title:h}=e,p=h?30:0,c=u,m=u+p,f=n-u*2,b=r-u*2-p;if(q(()=>Dn(t),[t])<=0||f<=0||b<=0)return o("svg",{width:"100%",viewBox:`0 0 ${n} ${r}`,preserveAspectRatio:"xMidYMid meet",xmlns:"http://www.w3.org/2000/svg",role:"img","aria-label":h??"Empty treemap"},o("text",{x:String(n/2),y:String(r/2),"text-anchor":"middle","font-size":"14","font-family":"sans-serif",fill:"#9ca3af"},"No data to display"));let g=q(()=>ju(t,c,m,f,b,a),[t,c,m,f,b,a]),x=[];h&&x.push(o("text",{key:"title",x:String(n/2),y:String(u+16),"text-anchor":"middle","font-size":"16","font-weight":"bold","font-family":"sans-serif",fill:"#111827"},h));for(let v=0;v<g.length;v++){let R=g[v];if(x.push(o("rect",{key:`cell-${v}`,x:String(R.x),y:String(R.y),width:String(Math.max(0,R.w)),height:String(Math.max(0,R.h)),fill:R.color,stroke:l,"stroke-width":String(d),role:"graphics-symbol","aria-label":`${R.label}: ${R.value}`})),i&&R.w>20&&R.h>14){let D=Math.floor(R.w/7),M=R.label.length>D?R.label.substring(0,Math.max(1,D-2))+"..":R.label;x.push(o("text",{key:`label-${v}`,x:String(R.x+4),y:String(R.y+12),"font-size":"11","font-family":"sans-serif",fill:"#ffffff","pointer-events":"none"},M))}s&&R.w>30&&R.h>28&&x.push(o("text",{key:`value-${v}`,x:String(R.x+4),y:String(R.y+24),"font-size":"10","font-family":"sans-serif",fill:"rgba(255,255,255,0.8)","pointer-events":"none"},String(R.value)))}return o("svg",{width:"100%",viewBox:`0 0 ${n} ${r}`,preserveAspectRatio:"xMidYMid meet",xmlns:"http://www.w3.org/2000/svg",role:"img","aria-label":h??"Treemap chart",style:{fontFamily:"sans-serif"}},...x)}function ea(e){let t=e.replace("#",""),n,r,i;return t.length===3?(n=parseInt(t[0]+t[0],16),r=parseInt(t[1]+t[1],16),i=parseInt(t[2]+t[2],16)):(n=parseInt(t.substring(0,2),16),r=parseInt(t.substring(2,4),16),i=parseInt(t.substring(4,6),16)),{r:isNaN(n)?0:n,g:isNaN(r)?0:r,b:isNaN(i)?0:i}}function Gu(e,t,n){let r=s=>Math.max(0,Math.min(255,Math.round(s))),i=s=>r(s).toString(16).padStart(2,"0");return"#"+i(e)+i(t)+i(n)}function ta(e,t){if(t.length===0)return"#3b82f6";if(t.length===1)return t[0];let n=Math.max(0,Math.min(1,e)),r=t.length-1,i=n*r,s=Math.floor(i),a=Math.min(s+1,r),l=i-s,d=ea(t[s]),u=ea(t[a]);return Gu(d.r+(u.r-d.r)*l,d.g+(u.g-d.g)*l,d.b+(u.b-d.b)*l)}function $n(e,t){if(e<=0)return 1;let n=e/t,r=Math.pow(10,Math.floor(Math.log10(n))),i=n/r;return i<=1.5?r:i<=3.5?2*r:i<=7.5?5*r:10*r}function Xu(e,t,n,r,i,s,a,l,d,u){if(e&&e.length>0)return e;let h=Math.max(2,Math.min(50,r)),p=d/(h-1),c=u/(h-1);if(n){let f=[];for(let x=0;x<h;x++)for(let v=0;v<h;v++)f.push({x:i+v*p,y:a+x*c});let y=n(f,{gridSize:h,xMin:i,xMax:s,yMin:a,yMax:l}),g=[];for(let x=0;x<f.length;x++){let v=f[x],R=y[x]??{dx:0,dy:0},D=Math.sqrt(R.dx*R.dx+R.dy*R.dy);g.push({x:v.x,y:v.y,dx:R.dx,dy:R.dy,magnitude:D})}return g}if(!t)return[];let m=[];for(let f=0;f<h;f++)for(let b=0;b<h;b++){let y=i+b*p,g=a+f*c,x=t(y,g),v=Math.sqrt(x.dx*x.dx+x.dy*x.dy);m.push({x:y,y:g,dx:x.dx,dy:x.dy,magnitude:v})}return m}function Ku(e,t,n,r,i){let{padding:s,chartWidth:a,chartHeight:l,xMin:d,xMax:u,yMin:h,yMax:p,xSpan:c,ySpan:m,showGrid:f,showAxes:b,colorByMagnitude:y,colorScale:g,arrowColor:x,arrowWidth:v,effectiveArrowScale:R,maxMagnitude:D,title:M,tickFontSize:$}=i,A=L=>s+(L-d)/c*a,I=L=>s+(p-L)/m*l;if(e.clearRect(0,0,t,n),M&&(e.save(),e.font="bold 16px sans-serif",e.fillStyle="#111827",e.textAlign="center",e.textBaseline="middle",e.fillText(M,t/2,s/2+4),e.restore()),f){e.save(),e.strokeStyle="#e5e7eb",e.lineWidth=.5,e.font=`${$}px sans-serif`,e.fillStyle="#6b7280";let L=$n(c,10),E=Math.ceil(d/L)*L;for(let k=E;k<=u;k+=L){let w=A(k);e.beginPath(),e.moveTo(w,s),e.lineTo(w,s+l),e.stroke(),e.textAlign="center",e.textBaseline="top",e.fillText(String(Math.round(k*100)/100),w,s+l+4)}let B=$n(m,10),z=Math.ceil(h/B)*B;for(let k=z;k<=p;k+=B){let w=I(k);e.beginPath(),e.moveTo(s,w),e.lineTo(s+a,w),e.stroke(),e.textAlign="right",e.textBaseline="middle",e.fillText(String(Math.round(k*100)/100),s-6,w)}e.restore()}if(b){if(e.save(),e.strokeStyle="#374151",e.lineWidth=v,h<=0&&p>=0){let L=I(0);e.beginPath(),e.moveTo(s,L),e.lineTo(s+a,L),e.stroke()}if(d<=0&&u>=0){let L=A(0);e.beginPath(),e.moveTo(L,s),e.lineTo(L,s+l),e.stroke()}e.strokeStyle="#d1d5db",e.lineWidth=1,e.strokeRect(s,s,a,l),e.restore()}let P=4;for(let L=0;L<r.length;L++){let E=r[L],B=E.magnitude??Math.sqrt(E.dx*E.dx+E.dy*E.dy);if(B<1e-10)continue;let z=A(E.x),k=I(E.y),w=E.dx*R,T=-E.dy*R,C=z+w,N=k+T,F;if(y){let H=B/D;F=ta(H,g)}else F=x;e.save(),e.strokeStyle=F,e.lineWidth=v,e.lineCap="round",e.beginPath(),e.moveTo(z,k),e.lineTo(C,N),e.stroke();let _=Math.sqrt(w*w+T*T);if(_>2){let H=w/_,W=T/_,V=-W,K=H,Q=Math.min(P,_*.4),G=C-H*Q+V*Q*.5,O=N-W*Q+K*Q*.5,Y=C-H*Q-V*Q*.5,X=N-W*Q-K*Q*.5;e.fillStyle=F,e.beginPath(),e.moveTo(C,N),e.lineTo(G,O),e.lineTo(Y,X),e.closePath(),e.fill()}e.restore()}}function na(e){let{data:t,vectorFunction:n,width:r=600,height:i=600,gridSize:s=15,xRange:a=[-5,5],yRange:l=[-5,5],arrowScale:d=1,arrowColor:u="#3b82f6",showGrid:h=!0,showAxes:p=!0,colorByMagnitude:c=!1,colorScale:m=["#3b82f6","#8b5cf6","#ef4444"],title:f,padding:b=50,tickFontSize:y=10,arrowWidth:g=1.5,renderer:x="svg",useGPU:v=!1,computeWorker:R}=e,D=Math.max(2,Math.min(50,s)),M=r-b*2,$=i-b*2,A=a[0],I=a[1],P=l[0],L=l[1],E=I-A,B=L-P,z=q(()=>G=>b+(G-A)/E*M,[b,A,E,M]),k=q(()=>G=>b+(L-G)/B*$,[b,L,B,$]),w=q(()=>Xu(t,n,R,D,A,I,P,L,E,B),[t,n,R,D,A,I,P,L,E,B]),T=q(()=>{let G=0;for(let O=0;O<w.length;O++){let Y=w[O],X=Y.magnitude??Math.sqrt(Y.dx*Y.dx+Y.dy*Y.dy);X>G&&(G=X)}return G>0?G:1},[w]),C=q(()=>Math.min(M,$)/Math.max(D,2)/(2*T)*d,[M,$,D,T,d]);if(x==="canvas"){let G=te(null),O=te(0);return re(()=>{let Y=G.current;if(!Y)return;let X=Y.getContext("2d");if(X)return O.current&&cancelAnimationFrame(O.current),O.current=requestAnimationFrame(()=>{Ku(X,r,i,w,{padding:b,chartWidth:M,chartHeight:$,xMin:A,xMax:I,yMin:P,yMax:L,xSpan:E,ySpan:B,showGrid:h,showAxes:p,colorByMagnitude:c,colorScale:m,arrowColor:u,arrowWidth:g,effectiveArrowScale:C,maxMagnitude:T,title:f,tickFontSize:y})}),()=>{O.current&&cancelAnimationFrame(O.current)}},[w,r,i,b,M,$,A,I,P,L,E,B,h,p,c,m,u,g,C,T,f,y]),o("canvas",{ref:G,width:r,height:i,role:"img","aria-label":f??"Vector field plot",style:{fontFamily:"sans-serif",maxWidth:"100%"}})}let N=S(()=>{if(!h)return[];let G=[],O=$n(E,10),Y=Math.ceil(A/O)*O;for(let Z=Y;Z<=I;Z+=O){let ee=z(Z);G.push(o("line",{key:`gridv-${Z}`,x1:String(ee),y1:String(b),x2:String(ee),y2:String(b+$),stroke:"#e5e7eb","stroke-width":"0.5"})),G.push(o("text",{key:`xtick-${Z}`,x:String(ee),y:String(b+$+16),"text-anchor":"middle","font-size":String(y),"font-family":"sans-serif",fill:"#6b7280"},String(Math.round(Z*100)/100)))}let X=$n(B,10),U=Math.ceil(P/X)*X;for(let Z=U;Z<=L;Z+=X){let ee=k(Z);G.push(o("line",{key:`gridh-${Z}`,x1:String(b),y1:String(ee),x2:String(b+M),y2:String(ee),stroke:"#e5e7eb","stroke-width":"0.5"})),G.push(o("text",{key:`ytick-${Z}`,x:String(b-6),y:String(ee+4),"text-anchor":"end","font-size":String(y),"font-family":"sans-serif",fill:"#6b7280"},String(Math.round(Z*100)/100)))}return G},[h,A,I,P,L,E,B,z,k,b,M,$]),F=S(()=>{if(!p)return[];let G=[];if(P<=0&&L>=0){let O=k(0);G.push(o("line",{key:"axis-x",x1:String(b),y1:String(O),x2:String(b+M),y2:String(O),stroke:"#374151","stroke-width":String(g)}))}if(A<=0&&I>=0){let O=z(0);G.push(o("line",{key:"axis-y",x1:String(O),y1:String(b),x2:String(O),y2:String(b+$),stroke:"#374151","stroke-width":String(g)}))}return G.push(o("rect",{key:"chart-border",x:String(b),y:String(b),width:String(M),height:String($),fill:"none",stroke:"#d1d5db","stroke-width":"1"})),G},[p,A,I,P,L,z,k,b,M,$]),_=S(()=>{let G=[];for(let Y=0;Y<w.length;Y++){let X=w[Y],U=X.magnitude??Math.sqrt(X.dx*X.dx+X.dy*X.dy);if(U<1e-10)continue;let Z=z(X.x),ee=k(X.y),ae=X.dx*C,J=-X.dy*C,se=Z+ae,ce=ee+J,me;if(c){let ye=U/T;me=ta(ye,m)}else me=u;G.push(o("line",{key:`arrow-line-${Y}`,x1:String(Z),y1:String(ee),x2:String(se),y2:String(ce),stroke:me,"stroke-width":String(g),"stroke-linecap":"round"}));let ge=Math.sqrt(ae*ae+J*J);if(ge>2){let ye=ae/ge,le=J/ge,ne=-le,pe=ye,ie=Math.min(4,ge*.4),he=se-ye*ie+ne*ie*.5,xe=ce-le*ie+pe*ie*.5,Ce=se-ye*ie-ne*ie*.5,de=ce-le*ie-pe*ie*.5;G.push(o("polygon",{key:`arrow-head-${Y}`,points:`${se},${ce} ${he},${xe} ${Ce},${de}`,fill:me}))}}return G},[w,z,k,C,c,T,m,u]),H=S(()=>f?[o("text",{key:"title",x:String(r/2),y:String(b/2+4),"text-anchor":"middle","font-size":"16","font-weight":"bold","font-family":"sans-serif",fill:"#111827"},f)]:[],[f,r,b]),W=N(),V=F(),K=_(),Q=H();return o("svg",{width:"100%",viewBox:`0 0 ${r} ${i}`,preserveAspectRatio:"xMidYMid meet",xmlns:"http://www.w3.org/2000/svg",role:"img","aria-label":f??"Vector field plot",style:{fontFamily:"sans-serif"}},...Q,...W,...V,...K)}function qu(e){let t=[],n=0;for(let r=0;r<e.length;r++){let i=e[r],s=i.type??(i.value>=0?"increase":"decrease");if(s==="total")t.push({label:i.label,value:n,type:"total",start:0,end:n});else{let a=n;n+=i.value,t.push({label:i.label,value:i.value,type:s,start:a,end:n})}}return t}function Zu(e){if(e<=0)return 1;let t=e/5,n=Math.pow(10,Math.floor(Math.log10(t))),r=t/n;return r<=1.5?n:r<=3.5?2*n:r<=7.5?5*n:10*n}function oa(e){let{data:t=[],width:n=600,height:r=400,increaseColor:i="#10b981",decreaseColor:s="#ef4444",totalColor:a="#3b82f6",connectorColor:l="#94a3b8",showValues:d=!0,showGrid:u=!0,showConnectors:h=!0,title:p,padding:c=60}=e,m=n-c*2,f=r-c*2,b=q(()=>qu(t),[t]),{minVal:y,maxVal:g}=q(()=>{let T=0,C=0;for(let N=0;N<b.length;N++){let F=b[N];F.start<T&&(T=F.start),F.end<T&&(T=F.end),F.start>C&&(C=F.start),F.end>C&&(C=F.end)}return T===C&&(C=T+1),{minVal:T,maxVal:C}},[b]),x=g-y,v=S(T=>c+f-(T-y)/x*f,[c,f,y,x]),R=q(()=>b.length===0?0:m/b.length,[b.length,m]),D=6,M=Math.max(1,R-D),$=S(()=>{if(!u)return[];let T=Zu(x),C=[],N=Math.ceil(y/T)*T;for(let F=N;F<=g;F+=T){let _=v(F);C.push(o("line",{key:`grid-${F}`,x1:String(c),y1:String(_),x2:String(c+m),y2:String(_),stroke:"#e5e7eb","stroke-width":"1","stroke-dasharray":"4 2"})),C.push(o("text",{key:`grid-label-${F}`,x:String(c-8),y:String(_+4),"text-anchor":"end","font-size":"11","font-family":"sans-serif",fill:"#6b7280"},String(F)))}return C},[u,x,y,g,v,c,m]),A=S(()=>{let T=[];T.push(o("line",{key:"axis-y",x1:String(c),y1:String(c),x2:String(c),y2:String(c+f),stroke:"#374151","stroke-width":"1.5"}));let C=y<=0&&g>=0?v(0):c+f;return T.push(o("line",{key:"axis-x",x1:String(c),y1:String(C),x2:String(c+m),y2:String(C),stroke:"#374151","stroke-width":"1.5"})),T},[c,m,f,y,g,v]),I=S(()=>{if(b.length===0)return[];let T=[];for(let C=0;C<b.length;C++){let N=b[C],F=c+C*R+D/2,_=Math.max(N.start,N.end),H=Math.min(N.start,N.end),W=v(_),V=v(H),K=Math.max(0,V-W),Q;if(N.type==="total"?Q=a:N.type==="decrease"?Q=s:Q=i,T.push(o("rect",{key:`bar-${C}`,x:String(F),y:String(W),width:String(M),height:String(K),fill:Q,rx:"2",ry:"2"})),d){let G=N.type==="decrease"||N.value<0?V+14:W-4,O=N.type==="total"?String(N.value):(N.value>=0?"+":"")+String(N.value);T.push(o("text",{key:`val-${C}`,x:String(F+M/2),y:String(G),"text-anchor":"middle","font-size":"10","font-family":"sans-serif",fill:"#374151"},O))}if(T.push(o("text",{key:`cat-${C}`,x:String(F+M/2),y:String(c+f+16),"text-anchor":"middle","font-size":"10","font-family":"sans-serif",fill:"#374151"},N.label)),h&&C<b.length-1){let G=b[C+1],O=v(N.end),Y=c+(C+1)*R+D/2;G.type!=="total"&&T.push(o("line",{key:`conn-${C}`,x1:String(F+M),y1:String(O),x2:String(Y),y2:String(O),stroke:l,"stroke-width":"1","stroke-dasharray":"3 2"}))}}return T},[b,R,M,v,i,s,a,l,d,h,c,f]),P=S(()=>p?[o("text",{key:"title",x:String(n/2),y:String(c/2+4),"text-anchor":"middle","font-size":"16","font-weight":"bold","font-family":"sans-serif",fill:"#111827"},p)]:[],[p,n,c]),L=S(()=>t.length>0?[]:[o("text",{key:"empty",x:String(n/2),y:String(r/2),"text-anchor":"middle","font-size":"14","font-family":"sans-serif",fill:"#9ca3af"},"No data")],[t.length,n,r]),E=$(),B=A(),z=I(),k=P(),w=L();return o("svg",{width:"100%",viewBox:`0 0 ${n} ${r}`,preserveAspectRatio:"xMidYMid meet",xmlns:"http://www.w3.org/2000/svg",role:"img","aria-label":p??"Waterfall chart",style:{fontFamily:"sans-serif"}},...k,...E,...B,...z,...w)}var Ju=["#3b82f6","#ef4444","#22c55e","#f59e0b","#8b5cf6","#ec4899","#14b8a6","#f97316","#6366f1","#84cc16"],Qu=[0,-45,45,90];function ep(e,t,n,r,i){let s=t*.6,a=e.length*s,l=t,d=n*Math.PI/180,u=Math.abs(Math.cos(d)),h=Math.abs(Math.sin(d)),p=a*u+l*h,c=a*h+l*u;return{x:r-p/2,y:i-c/2,w:p,h:c}}function tp(e,t){return!(e.x+e.w<t.x||t.x+t.w<e.x||e.y+e.h<t.y||t.y+t.h<e.y)}function np(e,t,n){return e.x>=0&&e.y>=0&&e.x+e.w<=t&&e.y+e.h<=n}function op(e){let t=0;for(let n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n)|0;return Math.abs(t)}function ra(e){let{words:t=[],width:n=600,height:r=400,minFontSize:i=10,maxFontSize:s=64,fontFamily:a="sans-serif",colors:l=Ju,rotations:d=Qu,padding:u=4,spiral:h="archimedean",title:p}=e,c=q(()=>{if(t.length===0)return[];let f=t.map((M,$)=>({...M,originalIndex:$})).filter(M=>M.text.length>0&&M.weight>0).sort((M,$)=>$.weight-M.weight);if(f.length===0)return[];let b=f[f.length-1].weight,g=f[0].weight-b;function x(M){if(g===0)return(i+s)/2;let $=(M-b)/g;return i+$*(s-i)}let v=[],R=n/2,D=r/2;for(let M=0;M<f.length;M++){let $=f[M],A=x($.weight),I=d[op($.text)%d.length],P=$.color??l[M%l.length],L=!1,E=500,B=h==="archimedean"?4:5;for(let z=0;z<E;z++){let k,w;if(h==="archimedean"){let H=z*.1,W=B*H;k=W*Math.cos(H),w=W*Math.sin(H)}else{let H=Math.floor(z/4)+1,W=z%4,V=(z%4===0?0:z)*B;switch(W){case 0:k=H*B*4,w=V;break;case 1:k=-V,w=H*B*4;break;case 2:k=-H*B*4,w=-V;break;default:k=V,w=-H*B*4;break}}let T=R+k,C=D+w,N=ep($.text,A,I,T,C),F={x:N.x-u,y:N.y-u,w:N.w+u*2,h:N.h+u*2};if(!np(F,n,r))continue;let _=!1;for(let H of v)if(tp(F,H.bbox)){_=!0;break}if(!_){v.push({text:$.text,x:T,y:C,fontSize:A,rotation:I,color:P,bbox:F}),L=!0;break}}}return v},[t,n,r,i,s,l,d,u,h]);if(t.length===0||c.length===0)return o("svg",{width:"100%",viewBox:`0 0 ${n} ${r}`,preserveAspectRatio:"xMidYMid meet",xmlns:"http://www.w3.org/2000/svg",role:"img","aria-label":p??"Word cloud \u2014 no data"},o("text",{x:String(n/2),y:String(r/2),"text-anchor":"middle","font-size":"14","font-family":a,fill:"currentColor",opacity:"0.6"},"No words to display."));let m=[];p&&m.push(o("text",{key:"title",x:String(n/2),y:"24","text-anchor":"middle","font-size":"16","font-weight":"bold","font-family":a,fill:"currentColor"},p));for(let f=0;f<c.length;f++){let b=c[f],y=b.rotation!==0?`translate(${b.x},${b.y}) rotate(${b.rotation})`:`translate(${b.x},${b.y})`;m.push(o("text",{key:`word-${f}`,transform:y,"text-anchor":"middle","dominant-baseline":"central","font-size":String(b.fontSize),"font-family":a,fill:b.color,"aria-label":b.text},b.text))}return o("svg",{width:"100%",viewBox:`0 0 ${n} ${r}`,preserveAspectRatio:"xMidYMid meet",xmlns:"http://www.w3.org/2000/svg",role:"img","aria-label":p??"Word cloud",style:{fontFamily:a}},...m)}var rp={0:"#1e293b",1:"#3b82f6"},ip="#666";function ia(e){let{data:t=[],colorMap:n,width:r=600,height:i=600,cellGap:s=1,cellRadius:a=0,showGrid:l=!1,gridColor:d="#334155",showIndices:u=!1,backgroundColor:h="#0f172a",padding:p=10,onCellClick:c,onCellHover:m,title:f}=e,b=n??rp,y=t.length,g=q(()=>{let T=0;for(let C=0;C<t.length;C++){let N=t[C];N!==void 0&&N.length>T&&(T=N.length)}return T},[t]),x=u?20:0,v=f?24:0,R=q(()=>{let T=r-p*2-x,C=i-p*2-x-v;if(y===0||g===0)return{cellWidth:0,cellHeight:0};let N=Math.max(0,(T-s*(g-1))/g),F=Math.max(0,(C-s*(y-1))/y);return{cellWidth:N,cellHeight:F}},[r,i,p,y,g,s,x,v]),D=S(T=>{let C=b[T];return C!==void 0?C:ip},[b]),M=S(()=>o("rect",{key:"bg",x:"0",y:"0",width:String(r),height:String(i),fill:h}),[r,i,h]),$=S(()=>f?[o("text",{key:"title",x:String(r/2),y:String(p+14),"text-anchor":"middle","font-size":"14","font-weight":"bold","font-family":"sans-serif",fill:"#e2e8f0"},f)]:[],[f,r,p]),A=S(()=>{if(!l||y===0||g===0)return[];let{cellWidth:T,cellHeight:C}=R,N=p+x,F=p+x+v,_=g*T+(g-1)*s,H=y*C+(y-1)*s,W=[];for(let V=0;V<=g;V++){let K=N+V*(T+s)-s/2;W.push(o("line",{key:`vgrid-${V}`,x1:String(K),y1:String(F-s/2),x2:String(K),y2:String(F+H+s/2),stroke:d,"stroke-width":"0.5"}))}for(let V=0;V<=y;V++){let K=F+V*(C+s)-s/2;W.push(o("line",{key:`hgrid-${V}`,x1:String(N-s/2),y1:String(K),x2:String(N+_+s/2),y2:String(K),stroke:d,"stroke-width":"0.5"}))}return W},[l,y,g,R,p,x,v,s,d]),I=S(()=>{if(!u||y===0||g===0)return[];let{cellWidth:T,cellHeight:C}=R,N=p+x,F=p+x+v,_=[];for(let H=0;H<g;H++){let W=N+H*(T+s)+T/2,V=F-6;_.push(o("text",{key:`col-idx-${H}`,x:String(W),y:String(V),"text-anchor":"middle","font-size":"10","font-family":"monospace",fill:"#94a3b8"},String(H)))}for(let H=0;H<y;H++){let W=N-6,V=F+H*(C+s)+C/2+3;_.push(o("text",{key:`row-idx-${H}`,x:String(W),y:String(V),"text-anchor":"end","font-size":"10","font-family":"monospace",fill:"#94a3b8"},String(H)))}return _},[u,y,g,R,p,x,v,s]),P=S(()=>{if(y===0||g===0)return[];let{cellWidth:T,cellHeight:C}=R,N=p+x,F=p+x+v,_=[];for(let H=0;H<y;H++){let W=t[H];if(W!==void 0)for(let V=0;V<g;V++){let K=V<W.length?W[V]:0,Q=N+V*(T+s),G=F+H*(C+s),O=D(K),Y={key:`cell-${H}-${V}`,x:String(Q),y:String(G),width:String(T),height:String(C),fill:O,rx:String(a),ry:String(a)};if(c){let X=H,U=V,Z=K;Y.onClick=()=>c(X,U,Z),Y.role="button",Y.tabIndex=0}if(m){let X=H,U=V,Z=K;Y.onMouseEnter=()=>m(X,U,Z)}_.push(o("rect",Y))}}return _},[y,g,t,R,p,x,v,s,a,D,c,m]),L=M(),E=$(),B=A(),z=I(),k=P(),w=f?`${f} \u2014 ${y}x${g} discrete grid`:`${y}x${g} discrete grid`;return o("svg",{width:"100%",viewBox:`0 0 ${r} ${i}`,preserveAspectRatio:"xMidYMid meet",xmlns:"http://www.w3.org/2000/svg",role:"img","aria-label":w},L,...E,...B,...z,...k)}