@jxsuite/studio 10.4.0 → 10.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (346) hide show
  1. package/data/locales/en/elements.json +434 -0
  2. package/data/webdata.json +116 -139
  3. package/dist/chunks/2020-rqm7qrje.js +4 -0
  4. package/dist/chunks/adapter-cyy8vbcx.js +4 -0
  5. package/dist/chunks/add-new-flow-8cgtejv2.js +4 -0
  6. package/dist/chunks/{cf-account-picker-xb8vvt2h.js → cf-account-picker-v3qd2dhw.js} +3 -3
  7. package/dist/chunks/cf-settings-1fnw874z.js +4 -0
  8. package/dist/chunks/{color-area-h8dbasp1.js → color-area-frd9y9q6.js} +2 -2
  9. package/dist/chunks/color-field-rebpbe33.js +4 -0
  10. package/dist/chunks/{color-slider-nz2mrzky.js → color-slider-6bzmk3s7.js} +2 -2
  11. package/dist/chunks/color-t2bnnj8y.js +4 -0
  12. package/dist/chunks/{combobox-6hs00996.js → combobox-c49x7gf1.js} +3 -3
  13. package/dist/chunks/components-y8yhdd7d.js +4 -0
  14. package/dist/chunks/content-source-9e7qvmsf.js +4 -0
  15. package/dist/chunks/convert-to-repeater-pd2w4z21.js +4 -0
  16. package/dist/chunks/editor-mb9jzdrw.js +4 -0
  17. package/dist/chunks/entry-commands-at0wnx3f.js +4 -0
  18. package/dist/chunks/extension-sections-4z9qq0gh.js +4 -0
  19. package/dist/chunks/file-ops-dtdvjmza.js +4 -0
  20. package/dist/chunks/files-8pf70854.js +4 -0
  21. package/dist/chunks/format-host-fd3m2y2a.js +4 -0
  22. package/dist/chunks/fs-events-hrk29vcv.js +4 -0
  23. package/dist/chunks/grid-open-bh74v82z.js +4 -0
  24. package/dist/chunks/{grid-view-2f03wcgw.js → grid-view-a51mgzmq.js} +17 -17
  25. package/dist/chunks/{icons-gb967qc8.js → icons-qp8fn1k8.js} +2 -2
  26. package/dist/chunks/{iframe-entry-btck0e9s.js → iframe-entry-mpwe5pwk.js} +4 -4
  27. package/dist/chunks/{iframe-entry-2x9bn5ng.js → iframe-entry-msd43x9h.js} +4 -4
  28. package/dist/chunks/iframe-entry-rt8jz5t8.js +5 -0
  29. package/dist/chunks/{iframe-entry-b5qgggyp.js → iframe-entry-v40cr813.js} +4 -4
  30. package/dist/chunks/iframe-host-q0s0wwy3.js +4 -0
  31. package/dist/chunks/{image-bake-4afr4y6a.js → image-bake-q9ajdjsj.js} +3 -3
  32. package/dist/chunks/{image-editor-x7t8jbjn.js → image-editor-ke9std9b.js} +3 -3
  33. package/dist/chunks/index-57ang7ma.js +4 -0
  34. package/dist/chunks/index-eytr7av4.js +17 -0
  35. package/dist/chunks/{index-yjrfeks8.js → index-x495reff.js} +3 -3
  36. package/dist/chunks/{javascript-hy2mws8v.js → javascript-qe34bvaz.js} +3 -3
  37. package/dist/chunks/jsonMode-m8rseh31.js +13 -0
  38. package/dist/chunks/jx-validate-bbd1mary.js +4 -0
  39. package/dist/chunks/layers-panel-wcjtdqsa.js +4 -0
  40. package/dist/chunks/layers-yscpys6q.js +4 -0
  41. package/dist/chunks/{listbox-7gka1h86.js → listbox-tktzq5xj.js} +2 -2
  42. package/dist/chunks/lit-html-qm5wbhqz.js +4 -0
  43. package/dist/chunks/media-library-2hfff88g.js +4 -0
  44. package/dist/chunks/media-open-4pb05cne.js +4 -0
  45. package/dist/chunks/media-picker-bzktmmwr.js +4 -0
  46. package/dist/chunks/menu-xc3cbgsd.js +4 -0
  47. package/dist/chunks/{monaco-binding-a51py33c.js → monaco-binding-7t38arh9.js} +3 -3
  48. package/dist/chunks/monaco-buffer-3vz94c9f.js +4 -0
  49. package/dist/chunks/monaco-setup-fstdew02.js +4 -0
  50. package/dist/chunks/notify-gbdcckrh.js +4 -0
  51. package/dist/chunks/parse-fpdzgk4c.js +4 -0
  52. package/dist/chunks/platform-9g72gdqr.js +4 -0
  53. package/dist/chunks/popover-cnmsav6b.js +4 -0
  54. package/dist/chunks/publish-panel-91x1cb5d.js +4 -0
  55. package/dist/chunks/publish-quick-e2dmf7eg.js +4 -0
  56. package/dist/chunks/publish-workspace-1x8mnzrj.js +4 -0
  57. package/dist/chunks/quick-search-2m4y6p1x.js +4 -0
  58. package/dist/chunks/references-yg1g9rwx.js +4 -0
  59. package/dist/chunks/right-panel-7mfyhzrk.js +4 -0
  60. package/dist/chunks/source-control-rrc4jgp5.js +4 -0
  61. package/dist/chunks/{split-m5rwn31z.js → split-d15yencd.js} +2 -2
  62. package/dist/chunks/studio-0jhhznxy.js +9 -0
  63. package/dist/chunks/studio-0nb57pjg.js +7 -0
  64. package/dist/chunks/{studio-s24mhq0z.js → studio-0wa4wv4s.js} +4 -4
  65. package/dist/chunks/studio-0z8kp4xk.js +5 -0
  66. package/dist/chunks/{studio-g0hxtcga.js → studio-18gc5t3v.js} +4 -4
  67. package/dist/chunks/{studio-4fnb5648.js → studio-1b79rpcb.js} +4 -4
  68. package/dist/chunks/studio-211q5j7m.js +4 -0
  69. package/dist/chunks/studio-213pyfxh.js +16 -0
  70. package/dist/chunks/studio-2b1smjvp.js +5 -0
  71. package/dist/chunks/{studio-nwf0c32p.js → studio-2v6tc9jp.js} +4 -4
  72. package/dist/chunks/studio-30j0wz99.js +5 -0
  73. package/dist/chunks/studio-3kmqhwtt.js +5 -0
  74. package/dist/chunks/studio-44drsmhw.js +5 -0
  75. package/dist/chunks/{studio-2pk7kc7z.js → studio-495b6f2r.js} +4 -4
  76. package/dist/chunks/{studio-jma2q8r9.js → studio-4gthb2fd.js} +4 -4
  77. package/dist/chunks/{studio-0gvvqj3h.js → studio-4xadhxj1.js} +4 -4
  78. package/dist/chunks/{studio-nvcn2ykc.js → studio-52mzbxqm.js} +4 -4
  79. package/dist/chunks/{studio-v7a7yb5w.js → studio-56mmnsw8.js} +7 -7
  80. package/dist/chunks/studio-59hz8f4r.js +5 -0
  81. package/dist/chunks/{studio-sce30r7b.js → studio-5k9mfafh.js} +3 -3
  82. package/dist/chunks/{studio-rr00ex23.js → studio-5qez462c.js} +6 -6
  83. package/dist/chunks/studio-6tnpg0vx.js +5 -0
  84. package/dist/chunks/studio-6w8mt734.js +6 -0
  85. package/dist/chunks/studio-7hm04x5z.js +5 -0
  86. package/dist/chunks/studio-8atmfjjm.js +7 -0
  87. package/dist/chunks/{studio-wmjmsw0p.js → studio-8n99z71s.js} +4 -4
  88. package/dist/chunks/studio-8vmad6x2.js +5 -0
  89. package/dist/chunks/studio-93p5k4r4.js +5 -0
  90. package/dist/chunks/{studio-2x972v58.js → studio-9gb0m81w.js} +4 -4
  91. package/dist/chunks/studio-a4ymg4vd.js +5 -0
  92. package/dist/chunks/studio-anc8067x.js +5 -0
  93. package/dist/chunks/{studio-2e4hry72.js → studio-dbdt67kr.js} +5 -5
  94. package/dist/chunks/studio-dbex091t.js +5 -0
  95. package/dist/chunks/{studio-amaz545p.js → studio-dj8ctxey.js} +4 -4
  96. package/dist/chunks/{studio-k2evngrj.js → studio-ed9bz68j.js} +5 -5
  97. package/dist/chunks/{studio-4bgvvzhv.js → studio-fe2d1fp5.js} +4 -4
  98. package/dist/chunks/{studio-45mj4jqe.js → studio-fgp4cyy3.js} +4 -4
  99. package/dist/chunks/studio-ft706q02.js +5 -0
  100. package/dist/chunks/studio-g79s1dyg.js +6 -0
  101. package/dist/chunks/{studio-pj216fmn.js → studio-gahswxp4.js} +4 -4
  102. package/dist/chunks/studio-gbqc12bk.js +5 -0
  103. package/dist/chunks/studio-gxphbetb.js +6 -0
  104. package/dist/chunks/studio-hdf01j7q.js +7 -0
  105. package/dist/chunks/studio-hf259xzd.js +48 -0
  106. package/dist/chunks/studio-jbva4wxw.js +5 -0
  107. package/dist/chunks/studio-jj9gf1qc.js +5 -0
  108. package/dist/chunks/studio-jsjg3mjv.js +5 -0
  109. package/dist/chunks/studio-jtvb8hd7.js +5 -0
  110. package/dist/chunks/{studio-g9brbewz.js → studio-kp4vzrct.js} +4 -4
  111. package/dist/chunks/studio-kpx02gaa.js +7 -0
  112. package/dist/chunks/{studio-3na1r48j.js → studio-kv1728ex.js} +8 -8
  113. package/dist/chunks/studio-m25ry0mf.js +5 -0
  114. package/dist/chunks/studio-mcbwmkyh.js +5 -0
  115. package/dist/chunks/studio-meajkr51.js +5 -0
  116. package/dist/chunks/studio-mkjrjpr2.js +6 -0
  117. package/dist/chunks/{studio-eqcddvc2.js → studio-mr084886.js} +201 -201
  118. package/dist/chunks/studio-mrb10hv3.js +5 -0
  119. package/dist/chunks/{studio-0939t1q1.js → studio-nhpg405j.js} +4 -4
  120. package/dist/chunks/studio-nsec0hxm.js +64 -0
  121. package/dist/chunks/{studio-xx3r3sb0.js → studio-nv0mh0p5.js} +4 -4
  122. package/dist/chunks/studio-pafmb06w.js +5 -0
  123. package/dist/chunks/{studio-pm17wdc4.js → studio-pgftd79b.js} +4 -4
  124. package/dist/chunks/{studio-4zd6an2b.js → studio-pk961xgz.js} +4 -4
  125. package/dist/chunks/studio-pzbr7g05.js +5 -0
  126. package/dist/chunks/studio-qcc5hsw2.js +10 -0
  127. package/dist/chunks/studio-qfq58c8n.js +5 -0
  128. package/dist/chunks/studio-qvb2jr83.js +5 -0
  129. package/dist/chunks/studio-r85zw6ay.js +5 -0
  130. package/dist/chunks/studio-s0kwce5w.js +9 -0
  131. package/dist/chunks/studio-s6ymkf3q.js +14 -0
  132. package/dist/chunks/{studio-0x6f3nk9.js → studio-s7p5ccxa.js} +4 -4
  133. package/dist/chunks/{studio-1410q5dw.js → studio-s9jjap3x.js} +4 -4
  134. package/dist/chunks/{studio-evq47j2z.js → studio-t5hde1ws.js} +4 -4
  135. package/dist/chunks/studio-vj9yv897.js +5 -0
  136. package/dist/chunks/studio-wmak8xjw.js +5 -0
  137. package/dist/chunks/{studio-bnc50f9h.js → studio-wqsmvtqj.js} +4 -4
  138. package/dist/chunks/studio-x3z3rhej.js +5 -0
  139. package/dist/chunks/{studio-bg8pzprg.js → studio-xb55kpmy.js} +4 -4
  140. package/dist/chunks/studio-xxtdajmv.js +12 -0
  141. package/dist/chunks/studio-xxttcym1.js +5 -0
  142. package/dist/chunks/{studio-90zkgne5.js → studio-y2zsnzye.js} +7 -7
  143. package/dist/chunks/{studio-3qr08sxq.js → studio-y3tjh2xb.js} +3 -3
  144. package/dist/chunks/studio-y4f1rdsj.js +5 -0
  145. package/dist/chunks/studio-ybkd5w8k.js +5 -0
  146. package/dist/chunks/{studio-tpxcryf2.js → studio-yetr4gg1.js} +4 -4
  147. package/dist/chunks/studio-z295anhs.js +6 -0
  148. package/dist/chunks/studio-z89e6wpg.js +9 -0
  149. package/dist/chunks/{studio-5tet77de.js → studio-zbwr6prc.js} +3 -3
  150. package/dist/chunks/{studio-daksw8kh.js → studio-zdbsv5q2.js} +4 -4
  151. package/dist/chunks/{studio-abh9kfdh.js → studio-zvthj8hg.js} +4 -4
  152. package/dist/chunks/toast-2kn2vrn4.js +4 -0
  153. package/dist/chunks/{toast-host-g3r2s0kn.js → toast-host-3rxeyj3d.js} +3 -3
  154. package/dist/chunks/{tooltip-dj1pvgz7.js → tooltip-ghkxkasp.js} +3 -3
  155. package/dist/chunks/{tree-j0ebwr5s.js → tree-vw4nc63s.js} +2 -2
  156. package/dist/chunks/tsMode-7gngmamr.js +14 -0
  157. package/dist/chunks/workspace-gv0hxgsm.js +4 -0
  158. package/dist/chunks/workspace-home-j7e0mjy5.js +4 -0
  159. package/dist/chunks/{ws-client-arz2qsy9.js → ws-client-vs11sxc5.js} +3 -3
  160. package/dist/iframe-entry.js +14 -14
  161. package/dist/manifest.json +84 -83
  162. package/dist/studio.js +99 -98
  163. package/dist/workers/ts.worker.js +3 -3
  164. package/package.json +12 -12
  165. package/src/browse/library-layouts.ts +9 -12
  166. package/src/browse/library-pane.ts +22 -16
  167. package/src/browse/library-source.ts +3 -4
  168. package/src/browse/preview-style.ts +2 -1
  169. package/src/canvas/canvas-live-render.ts +2 -5
  170. package/src/canvas/canvas-page-context.ts +5 -0
  171. package/src/canvas/canvas-render.ts +6 -1
  172. package/src/canvas/iframe-drop.ts +84 -1
  173. package/src/canvas/iframe-entry.ts +9 -6
  174. package/src/canvas/iframe-render.ts +13 -0
  175. package/src/collab/collab-session.ts +2 -2
  176. package/src/commands/levels.ts +1 -1
  177. package/src/content/entry-commands.ts +32 -27
  178. package/src/content/entry-editor.ts +46 -44
  179. package/src/content/entry-inspector.ts +15 -12
  180. package/src/content/entry-model.ts +3 -3
  181. package/src/content/entry-summaries.ts +5 -5
  182. package/src/content/hold-state.ts +172 -0
  183. package/src/content/page-summaries.ts +10 -14
  184. package/src/create/add-new-flow.ts +2 -1
  185. package/src/editor/convert-targets.ts +2 -23
  186. package/src/editor/inline-edit.ts +6 -1
  187. package/src/editor/repeater-scope.ts +333 -74
  188. package/src/editor/slash-menu.ts +35 -17
  189. package/src/files/files.ts +18 -0
  190. package/src/format/format-choices.ts +5 -5
  191. package/src/format/format-host.ts +35 -3
  192. package/src/grid/redirects-grid.ts +4 -4
  193. package/src/grid/sources/content-source.ts +42 -66
  194. package/src/locale/element-names.ts +131 -0
  195. package/src/panels/block-action-bar.ts +3 -4
  196. package/src/panels/dnd.ts +3 -1
  197. package/src/panels/elements-panel.ts +93 -36
  198. package/src/panels/events-panel.ts +6 -2
  199. package/src/panels/formula-workspace.ts +9 -0
  200. package/src/panels/imports-panel.ts +3 -2
  201. package/src/panels/navigator-panels.ts +10 -10
  202. package/src/panels/panel-registry.ts +3 -3
  203. package/src/panels/properties-panel.ts +127 -35
  204. package/src/panels/site-panel.ts +2 -1
  205. package/src/panels/statement-editor.ts +4 -0
  206. package/src/panels/style-panel.ts +2 -1
  207. package/src/panels/styles-panel.ts +2 -2
  208. package/src/panels/tab-strip.ts +29 -26
  209. package/src/platforms/cloud.ts +5 -2
  210. package/src/services/ai-command-tools.ts +2 -1
  211. package/src/services/ai-project-tools.ts +21 -8
  212. package/src/services/ai-tools.ts +5 -5
  213. package/src/services/ai-write-report.ts +22 -4
  214. package/src/services/context-manager.ts +110 -2
  215. package/src/services/document-assistant.ts +2 -2
  216. package/src/services/harness/chat-reducer.ts +9 -4
  217. package/src/services/jxn-language.ts +110 -0
  218. package/src/services/model-uri.ts +3 -0
  219. package/src/services/monaco-setup.ts +6 -2
  220. package/src/services/render-critic.ts +234 -12
  221. package/src/services/tool-executor.ts +16 -8
  222. package/src/settings/contributed-section.ts +2 -1
  223. package/src/settings/extension-commands.ts +2 -1
  224. package/src/settings/general-settings.ts +2 -2
  225. package/src/settings/settings-document.ts +5 -5
  226. package/src/shell.ts +1 -1
  227. package/src/studio.ts +28 -11
  228. package/src/style/variables-view.ts +2 -2
  229. package/src/surfaces/collections-panel.json +1 -1
  230. package/src/surfaces/collections-panel.ts +1 -1
  231. package/src/surfaces/entry-editor.json +10 -10
  232. package/src/surfaces/entry-editor.ts +22 -19
  233. package/src/surfaces/entry-inspector.json +11 -11
  234. package/src/surfaces/entry-inspector.ts +17 -10
  235. package/src/surfaces/panel-elements.json +466 -206
  236. package/src/surfaces/panel-elements.ts +61 -25
  237. package/src/surfaces/tab-strip.json +5 -5
  238. package/src/surfaces/tab-strip.ts +2 -2
  239. package/src/tabs/project-config.ts +13 -13
  240. package/src/tabs/tab.ts +7 -2
  241. package/src/types.ts +13 -2
  242. package/src/ui/expression-editor.ts +10 -5
  243. package/src/ui/schema-form.ts +18 -1
  244. package/src/utils/edit-display.ts +27 -1
  245. package/src/view.ts +9 -2
  246. package/src/workspace/tab-workspace.ts +2 -2
  247. package/src/workspace/workspace-back.ts +2 -2
  248. package/dist/chunks/2020-906vx2dq.js +0 -4
  249. package/dist/chunks/adapter-hnvad61x.js +0 -4
  250. package/dist/chunks/add-new-flow-v0pm96mr.js +0 -4
  251. package/dist/chunks/cf-settings-mkbcz4z2.js +0 -4
  252. package/dist/chunks/color-04361ttk.js +0 -4
  253. package/dist/chunks/color-field-qv5r2b16.js +0 -4
  254. package/dist/chunks/components-w5zqwva1.js +0 -4
  255. package/dist/chunks/content-source-g38w0d3f.js +0 -4
  256. package/dist/chunks/convert-to-repeater-r8sfxjjm.js +0 -4
  257. package/dist/chunks/editor-wvf5e6j9.js +0 -4
  258. package/dist/chunks/entry-commands-t13dyw3c.js +0 -4
  259. package/dist/chunks/extension-sections-vjzw46xb.js +0 -4
  260. package/dist/chunks/file-ops-1sghzgcr.js +0 -4
  261. package/dist/chunks/files-zrqtgt41.js +0 -4
  262. package/dist/chunks/format-host-9gy76erh.js +0 -4
  263. package/dist/chunks/fs-events-45rhg3me.js +0 -4
  264. package/dist/chunks/grid-open-t4fq6bbm.js +0 -4
  265. package/dist/chunks/iframe-entry-42hpmwz5.js +0 -5
  266. package/dist/chunks/iframe-host-9aq8ze3q.js +0 -4
  267. package/dist/chunks/index-f9qr7kzh.js +0 -4
  268. package/dist/chunks/jsonMode-vj30te2h.js +0 -13
  269. package/dist/chunks/jx-validate-r4ax11e3.js +0 -4
  270. package/dist/chunks/layers-m49nmwvx.js +0 -4
  271. package/dist/chunks/layers-panel-zr92pwdp.js +0 -4
  272. package/dist/chunks/lit-html-k2mb9k0r.js +0 -4
  273. package/dist/chunks/media-library-j74rt0w4.js +0 -4
  274. package/dist/chunks/media-open-mypr0k6b.js +0 -4
  275. package/dist/chunks/media-picker-pemtbsjv.js +0 -4
  276. package/dist/chunks/menu-d2jxpgma.js +0 -4
  277. package/dist/chunks/monaco-buffer-pa0g6ax7.js +0 -4
  278. package/dist/chunks/monaco-setup-0hw9f835.js +0 -4
  279. package/dist/chunks/notify-bwehrp7q.js +0 -4
  280. package/dist/chunks/parse-hee7ne9b.js +0 -4
  281. package/dist/chunks/platform-kv0k65cy.js +0 -4
  282. package/dist/chunks/popover-9tf4cjrk.js +0 -4
  283. package/dist/chunks/publish-panel-vg1n880b.js +0 -4
  284. package/dist/chunks/publish-quick-4fwngwrw.js +0 -4
  285. package/dist/chunks/publish-workspace-jv4w2bx2.js +0 -4
  286. package/dist/chunks/quick-search-nh29rt8a.js +0 -4
  287. package/dist/chunks/references-vqyr5s9x.js +0 -4
  288. package/dist/chunks/right-panel-3ws9f2w0.js +0 -4
  289. package/dist/chunks/source-control-h3hcs5gy.js +0 -4
  290. package/dist/chunks/studio-0khd8xtx.js +0 -4
  291. package/dist/chunks/studio-1ctnw3xv.js +0 -5
  292. package/dist/chunks/studio-1ks5d9y4.js +0 -5
  293. package/dist/chunks/studio-1y9mab9m.js +0 -5
  294. package/dist/chunks/studio-2kpxm0eh.js +0 -7
  295. package/dist/chunks/studio-2zz4qbv9.js +0 -5
  296. package/dist/chunks/studio-3pz4t5a2.js +0 -5
  297. package/dist/chunks/studio-4f7thq0p.js +0 -5
  298. package/dist/chunks/studio-61rg2cz5.js +0 -5
  299. package/dist/chunks/studio-7rrdbvex.js +0 -5
  300. package/dist/chunks/studio-9c6cbq2c.js +0 -4
  301. package/dist/chunks/studio-9dq7rwc7.js +0 -5
  302. package/dist/chunks/studio-9gr7xs9r.js +0 -6
  303. package/dist/chunks/studio-a88ej93p.js +0 -7
  304. package/dist/chunks/studio-acer0g8w.js +0 -5
  305. package/dist/chunks/studio-az3wvyh2.js +0 -5
  306. package/dist/chunks/studio-brh8d2pr.js +0 -5
  307. package/dist/chunks/studio-c2fa783p.js +0 -9
  308. package/dist/chunks/studio-cfnn70h1.js +0 -5
  309. package/dist/chunks/studio-cqxj4fcy.js +0 -5
  310. package/dist/chunks/studio-cw11h078.js +0 -5
  311. package/dist/chunks/studio-dn56z7sn.js +0 -5
  312. package/dist/chunks/studio-egnjpyde.js +0 -9
  313. package/dist/chunks/studio-ejrypvmq.js +0 -5
  314. package/dist/chunks/studio-frc16j8v.js +0 -10
  315. package/dist/chunks/studio-gnazwtv3.js +0 -5
  316. package/dist/chunks/studio-hfqpfmpk.js +0 -5
  317. package/dist/chunks/studio-hh394phe.js +0 -5
  318. package/dist/chunks/studio-j0zf5x2x.js +0 -5
  319. package/dist/chunks/studio-j5fcp6gj.js +0 -5
  320. package/dist/chunks/studio-jd1qb1st.js +0 -7
  321. package/dist/chunks/studio-k0xzrse2.js +0 -64
  322. package/dist/chunks/studio-k1xqrgm5.js +0 -5
  323. package/dist/chunks/studio-k3we3kqb.js +0 -5
  324. package/dist/chunks/studio-knsjyx7n.js +0 -5
  325. package/dist/chunks/studio-mrjtnm62.js +0 -5
  326. package/dist/chunks/studio-n9qba0gx.js +0 -5
  327. package/dist/chunks/studio-nzemfbkk.js +0 -14
  328. package/dist/chunks/studio-pwctzka3.js +0 -16
  329. package/dist/chunks/studio-q80fg1d6.js +0 -12
  330. package/dist/chunks/studio-q9hx2qp0.js +0 -5
  331. package/dist/chunks/studio-qrzmfaf6.js +0 -5
  332. package/dist/chunks/studio-r6mx7vm5.js +0 -7
  333. package/dist/chunks/studio-swedpd82.js +0 -5
  334. package/dist/chunks/studio-tmfcn347.js +0 -6
  335. package/dist/chunks/studio-v5wktj6f.js +0 -5
  336. package/dist/chunks/studio-vpevkfxw.js +0 -5
  337. package/dist/chunks/studio-wqfaqw4m.js +0 -5
  338. package/dist/chunks/studio-xpx91fby.js +0 -6
  339. package/dist/chunks/studio-xva3hzkv.js +0 -5
  340. package/dist/chunks/studio-z3fztxrp.js +0 -9
  341. package/dist/chunks/studio-z9453ypn.js +0 -6
  342. package/dist/chunks/toast-w11qpkyz.js +0 -4
  343. package/dist/chunks/tsMode-jg1dtphj.js +0 -14
  344. package/dist/chunks/workspace-6ztqcrsh.js +0 -4
  345. package/dist/chunks/workspace-home-rse9h8a0.js +0 -4
  346. package/src/content/draft-state.ts +0 -108
@@ -0,0 +1,5 @@
1
+ import{ft}from"./studio-zbwr6prc.js";import{qo}from"./studio-y2zsnzye.js";import{uL,ml,ry}from"./studio-m25ry0mf.js";import{p,we}from"./studio-1b79rpcb.js";import{ln,Aa,X,Co,Xp,h}from"./studio-ybkd5w8k.js";import{Wy}from"./studio-hf259xzd.js";import{Ud,ea,io}from"./studio-jj9gf1qc.js";import{De,Nx,Ra,Jc}from"./studio-mrb10hv3.js";import{it}from"./studio-yetr4gg1.js";import{ei}from"./studio-0nb57pjg.js";import{jb}from"./studio-qcc5hsw2.js";import{Gu}from"./studio-fe2d1fp5.js";import{vw,qN,bb,Nd,JN,KN,UE,ww,xw}from"./studio-kpx02gaa.js";import{Rw,Iw,Cp}from"./studio-6w8mt734.js";import{Em}from"./studio-z89e6wpg.js";import{x,wn}from"./studio-anc8067x.js";import{E,I}from"./studio-xxttcym1.js";import{b}from"./studio-y3tjh2xb.js";import{Ni}from"./studio-213pyfxh.js";import{n,J,f}from"./studio-0z8kp4xk.js";import{ce}from"./studio-nhpg405j.js";var Z=new Map([["img","src"],["source","src"],["video","poster"]]);function ee(e,t,a=De){if(!e||t!=="image")return{mode:"insert"};let r=Z.get(e.tagName);if(r)return{attr:r,mode:"replace-attr",path:e.path};if(e.tagName.includes("-")){let s=(a.find((l)=>l.tagName===e.tagName)?.props??[]).filter((l)=>Aa(l.format));if(s.length===1)return{mode:"replace-prop",path:e.path,prop:s[0].name}}return{mode:"insert"}}function F(e){switch(e.kind){case"image":return{attributes:{src:e.ref},tagName:"img"};case"video":return{attributes:{controls:"",src:e.ref},tagName:"video"};case"audio":return{attributes:{controls:"",src:e.ref},tagName:"audio"};default:return{attributes:{href:e.ref},tagName:"a",textContent:e.name}}}function te(e,t){let a=[...e.targetPath],r=a.at(-1);if(t===0||!J(r))return a;return a[a.length-1]=r+t,a}async function AN(e,t,a,r){if(!e||t.length===0)return;let o=await ea(t),[s]=o;if(!s)return;let l=ee(a,s.kind);if(l.mode==="replace-attr"){X(e,(m)=>Co(m,l.path,l.attr,s.ref));return}if(l.mode==="replace-prop"){X(e,(m)=>Xp(m,l.path,l.prop,s.ref));return}for(let[m,i]of o.entries()){let u={fragment:F(i),type:"block"};if(r)ry(e,{type:r.instruction},u,te(r,m));else ry(e,{type:"make-child"},u,[])}}var O={$schema:"https://jxsuite.com/schema/v1",$id:"StudioSitePanel",$description:"The Site panel (specs/studio.md §5.7): the project as an author thinks of it, pages by address and then the parts pages are made of. Four sections under a header holding one filter and a + that opens Add new (`file.new`, §9.1.1). `panels/site-panel.ts` keeps every decision: which files are pages, the route order and nesting (`panels/site-model.ts`, over `@jxsuite/site/routes`), how many entries a collection has and how many pages use a template, which media the project holds (the Media section is a short strip of the first few, and the rest are one click away in Media), what a click opens and what a drag inserts. This document draws rows whose every field is already a string, and a section state that is one of loading, empty, nomatch or listed, so a section a filter empties keeps its heading and says why. Component previews are an island the flow fills, and the drag sources are registered by the adapter through `onNodeCreated`.",tagName:"div",attributes:{part:"site"},style:{$description:"The Site panel's own look, keyed on `part`. Rows are native buttons, because a row opens one thing and a button is the element that says so to every reader; the selected row is the one whose `data-selected` is true, which the flow sets from the focused pane's document. A collection heading is not a button: it opens nothing in Design, and its pages are the buttons under it, indented one step. Component cards and media thumbnails are drag sources as well as buttons; the adapter registers the drags through `onNodeCreated`, so nothing here names a drag.",display:"flex",flexDirection:"column",height:"100%",minHeight:"0",fontFamily:"var(--jx-font-sans)",fontSize:"var(--jx-text-md)",color:"var(--fg)",'& [part="header"]':{display:"flex",alignItems:"center",gap:"var(--jx-space-2)",padding:"var(--jx-space-2)",borderBottom:"1px solid var(--border)",flexShrink:"0"},'& [part="filter"]':{flex:"1",minWidth:"0"},'& [part="sections"]':{flex:"1",minHeight:"0",overflowY:"auto",padding:"var(--jx-space-1) 0 var(--jx-space-4)"},'& [part="section"]':{padding:"var(--jx-space-2) 0"},'& [part="section-head"]':{display:"flex",alignItems:"center",gap:"var(--jx-space-2)",padding:"0 var(--jx-space-3) var(--jx-space-1)"},'& [part="section-title"]':{margin:"0",fontSize:"var(--jx-text-sm)",fontWeight:"700",letterSpacing:"0.06em",textTransform:"uppercase",color:"var(--fg-dim)"},'& [part="section-count"]':{fontSize:"var(--jx-text-sm)",color:"var(--fg-dim)"},'& [part="open-media"]':{marginLeft:"auto"},'& [part="no-project"]':{margin:"0",padding:"var(--jx-space-6) var(--jx-space-4)",textAlign:"center",lineHeight:"1.5",color:"var(--fg-dim)"},'& [part="note"]':{margin:"0",padding:"var(--jx-space-1) var(--jx-space-3)",fontSize:"var(--jx-text-sm)",color:"var(--fg-dim)"},'& [part="rows"]':{display:"flex",flexDirection:"column"},'& [part="page-row"], & [part="template-row"], & [part="collection-row"]':{display:"flex",alignItems:"baseline",gap:"var(--jx-space-2)",width:"100%",boxSizing:"border-box",minHeight:"26px",padding:"var(--jx-space-1) var(--jx-space-3)",border:"none",background:"transparent",color:"inherit",font:"inherit",textAlign:"start"},'& [part="page-row"], & [part="template-row"]':{cursor:"pointer",":hover":{background:"var(--hover-bg)"},":focus-visible":{outline:"var(--jx-focus-ring)",outlineOffset:"-2px"}},'& [part="page-row"][data-nested="true"]':{paddingLeft:"calc(var(--jx-space-3) + var(--jx-space-4))"},'& [data-selected="true"]':{background:"var(--accent-15)",color:"var(--fg)"},'& [part="collection-row"]':{color:"var(--fg-dim)"},'& [part="row-label"]':{flex:"1",minWidth:"0",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},'& [part="row-detail"]':{flexShrink:"0",maxWidth:"55%",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",fontFamily:"var(--font-mono)",fontSize:"var(--jx-text-sm)",color:"var(--fg-dim)"},'& [part="cards"]':{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(96px, 1fr))",gap:"var(--jx-space-2)",padding:"0 var(--jx-space-3)"},'& [part="component-card"]':{display:"flex",flexDirection:"column",width:"100%",padding:"0",overflow:"hidden",border:"1px solid var(--border)",borderRadius:"var(--jx-radius-md)",background:"var(--bg-panel)",color:"inherit",font:"inherit",cursor:"grab",":hover":{borderColor:"var(--fg-dim)"},":focus-visible":{outline:"var(--jx-focus-ring)",outlineOffset:"1px"}},'& [part="card-preview"]':{$description:"A live render on the light document surface the Insert panel's element cards use (`--canvas-*` does not follow the theme, because what is drawn here is a page's part, and a site's dark text on the dark chrome read as an empty black box). It is drawn at half size, so a component laid out for a page shows its face rather than a clipped corner of one oversized glyph. The render is in the island's own shadow root (`mountPreview` in `browse/library-preview.ts`), so no rule here can reach its elements: the half size is the island's `zoom`, which lays the render out twice as wide and draws it at half, and the 128px height is the 64px box at that zoom. The broken-image rule went into the root with it.",position:"relative",height:"128px",zoom:"0.5",overflow:"hidden",pointerEvents:"none",background:"white",color:"var(--canvas-fg-2)",fontSize:"var(--jx-text-md)"},'& [part="card-label"]':{padding:"var(--jx-space-1) var(--jx-space-2)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",fontSize:"var(--jx-text-sm)",textAlign:"start"},'& [part="thumbs"]':{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(56px, 1fr))",gap:"var(--jx-space-1)",padding:"0 var(--jx-space-3)"},'& [part="media-strip"]':{display:"flex",flexDirection:"column",gap:"var(--jx-space-2)"},'& [part="media-more"]':{alignSelf:"flex-start",marginInline:"var(--jx-space-3)"},'& [part="media-thumb"]':{display:"flex",alignItems:"center",justifyContent:"center",width:"100%",aspectRatio:"1",padding:"0",overflow:"hidden",border:"1px solid var(--border)",borderRadius:"var(--jx-radius-sm)",background:"var(--bg-panel)",color:"var(--fg-dim)",font:"inherit",cursor:"grab",":focus-visible":{outline:"var(--jx-focus-ring)",outlineOffset:"1px"}},'& [part="thumb-image"]':{width:"100%",height:"100%",objectFit:"cover"},'& [part="thumb-name"]':{padding:"var(--jx-space-1)",overflow:"hidden",fontSize:"var(--jx-text-xs)",wordBreak:"break-all"}},children:[{tagName:"div",attributes:{part:"header"},children:[{tagName:"jx-textfield",attributes:{part:"filter"},$props:{size:"sm",type:"search",clearable:!0,label:"Filter the site",placeholder:"Filter the site…",value:{$ref:"#/state/filter"}},oninput:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setFilter"},value:[{$ref:"event#/target/value"}]}]}},{tagName:"jx-action-button",attributes:{part:"add"},$props:{size:"sm",icon:"plus",label:"Add new",hint:"Add new",haspopup:"dialog"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/add"},value:[]}]}}]},{tagName:"div",attributes:{part:"body-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/body"},cases:{none:{tagName:"p",attributes:{part:"no-project"},textContent:"Open a project to see its pages, templates, components and media."},project:{tagName:"div",attributes:{part:"sections"},children:[{tagName:"section",attributes:{part:"section","data-section":"pages","aria-labelledby":"site-section-pages"},children:[{tagName:"div",attributes:{part:"section-head"},children:[{tagName:"h3",attributes:{part:"section-title",id:"site-section-pages"},textContent:"Pages"},{tagName:"span",attributes:{part:"section-count"},textContent:"${state.pagesCount}"}]},{tagName:"div",attributes:{part:"section-body",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/pagesState"},cases:{loading:{tagName:"p",attributes:{part:"note"},textContent:"Reading the project…"},empty:{tagName:"p",attributes:{part:"note"},textContent:"No pages yet. Add one with +."},nomatch:{tagName:"p",attributes:{part:"note"},textContent:"Nothing here matches the filter."},listed:{tagName:"div",attributes:{part:"rows",role:"list"},children:[{$prototype:"Array",items:{$ref:"#/state/pages"},key:{$ref:"$map/item/key"},map:{tagName:"div",attributes:{part:"page-item",role:"listitem","data-kind":"${$map.item.kind}"},$switch:{$ref:"$map/item/kind"},cases:{collection:{tagName:"div",attributes:{part:"collection-row"},children:[{tagName:"span",attributes:{part:"row-label"},textContent:"${$map.item.label}"},{tagName:"span",attributes:{part:"row-detail"},textContent:"${$map.item.detail}"}]},page:{tagName:"button",attributes:{part:"page-row",type:"button","data-path":"${$map.item.path}","data-selected":"${$map.item.selected}","aria-current":"${$map.item.selected === 'true' ? 'true' : null}",title:"${$map.item.path}"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/open"},value:[{$ref:"$map/item/path"}]}]},children:[{tagName:"span",attributes:{part:"row-label"},textContent:"${$map.item.label}"},{tagName:"span",attributes:{part:"row-detail"},textContent:"${$map.item.detail}"}]},"entry-page":{tagName:"button",attributes:{part:"page-row",type:"button","data-path":"${$map.item.path}","data-selected":"${$map.item.selected}","aria-current":"${$map.item.selected === 'true' ? 'true' : null}",title:"${$map.item.path}","data-nested":"true"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/open"},value:[{$ref:"$map/item/path"}]}]},children:[{tagName:"span",attributes:{part:"row-label"},textContent:"${$map.item.label}"},{tagName:"span",attributes:{part:"row-detail"},textContent:"${$map.item.detail}"}]}}}}]}}}]},{tagName:"section",attributes:{part:"section","data-section":"templates","aria-labelledby":"site-section-templates"},children:[{tagName:"div",attributes:{part:"section-head"},children:[{tagName:"h3",attributes:{part:"section-title",id:"site-section-templates"},textContent:"Templates"},{tagName:"span",attributes:{part:"section-count"},textContent:"${state.templatesCount}"}]},{tagName:"div",attributes:{part:"section-body",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/templatesState"},cases:{loading:{tagName:"p",attributes:{part:"note"},textContent:"Reading the project…"},empty:{tagName:"p",attributes:{part:"note"},textContent:"No templates in layouts/ yet."},nomatch:{tagName:"p",attributes:{part:"note"},textContent:"Nothing here matches the filter."},listed:{tagName:"div",attributes:{part:"rows",role:"list"},children:[{$prototype:"Array",items:{$ref:"#/state/templates"},key:{$ref:"$map/item/key"},map:{tagName:"div",attributes:{part:"template-item",role:"listitem"},children:[{tagName:"button",attributes:{part:"template-row",type:"button","data-path":"${$map.item.path}","data-selected":"${$map.item.selected}","aria-current":"${$map.item.selected === 'true' ? 'true' : null}",title:"${$map.item.path}"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/open"},value:[{$ref:"$map/item/path"}]}]},children:[{tagName:"span",attributes:{part:"row-label"},textContent:"${$map.item.label}"},{tagName:"span",attributes:{part:"row-detail"},textContent:"${$map.item.detail}"}]}]}}]}}}]},{tagName:"section",attributes:{part:"section","data-section":"components","aria-labelledby":"site-section-components"},children:[{tagName:"div",attributes:{part:"section-head"},children:[{tagName:"h3",attributes:{part:"section-title",id:"site-section-components"},textContent:"Components"},{tagName:"span",attributes:{part:"section-count"},textContent:"${state.componentsCount}"}]},{tagName:"div",attributes:{part:"section-body",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/componentsState"},cases:{loading:{tagName:"p",attributes:{part:"note"},textContent:"Reading the project…"},empty:{tagName:"p",attributes:{part:"note"},textContent:"No components yet."},nomatch:{tagName:"p",attributes:{part:"note"},textContent:"Nothing here matches the filter."},listed:{tagName:"div",attributes:{part:"cards",role:"list"},children:[{$prototype:"Array",items:{$ref:"#/state/components"},key:{$ref:"$map/item/key"},map:{tagName:"div",attributes:{part:"card-item",role:"listitem"},children:[{tagName:"button",attributes:{part:"component-card",type:"button","data-tag":"${$map.item.tagName}","data-selected":"${$map.item.selected}","aria-current":"${$map.item.selected === 'true' ? 'true' : null}",title:"${$map.item.hint}"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/openComponent"},value:[{$ref:"$map/item/tagName"}]}]},children:[{$description:'The preview ISLAND: empty here, filled by the flow with the component rendered live from the Library\'s preview cache as the card scrolls into view (specs/studio-ui-guidelines.md §9.4). It is `inert`, not merely `aria-hidden`: a component\'s own links and buttons stay focusable under `aria-hidden`, and Chrome then counts their text into the card\'s name ("Contact Us Today Eer cta", "◀ ▶ Eer reviews"). Inert takes the render out of the accessibility tree, the tab order and the pointer at once, so the card is named by its label alone.',tagName:"div",attributes:{part:"card-preview",inert:""}},{tagName:"span",attributes:{part:"card-label"},textContent:"${$map.item.label}"}]}]}}]}}}]},{tagName:"section",attributes:{part:"section","data-section":"media","aria-labelledby":"site-section-media"},children:[{tagName:"div",attributes:{part:"section-head"},children:[{tagName:"h3",attributes:{part:"section-title",id:"site-section-media"},textContent:"Media"},{tagName:"span",attributes:{part:"section-count"},textContent:"${state.mediaCount}"},{tagName:"jx-button",attributes:{part:"open-media"},$props:{size:"sm",variant:"secondary",quiet:!0},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/openMedia"},value:[]}]},children:[{tagName:"span",textContent:"Open Media"}]}]},{tagName:"div",attributes:{part:"section-body",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/mediaState"},cases:{loading:{tagName:"p",attributes:{part:"note"},textContent:"Reading the project…"},empty:{tagName:"p",attributes:{part:"note"},textContent:"No media in public/ yet."},nomatch:{tagName:"p",attributes:{part:"note"},textContent:"Nothing here matches the filter."},listed:{tagName:"div",attributes:{part:"media-strip"},children:[{tagName:"div",attributes:{part:"thumbs",role:"list"},children:[{$prototype:"Array",items:{$ref:"#/state/media"},key:{$ref:"$map/item/key"},map:{tagName:"div",attributes:{part:"thumb-item",role:"listitem"},children:[{tagName:"button",attributes:{part:"media-thumb",type:"button","data-path":"${$map.item.path}","data-selected":"${$map.item.selected}","aria-current":"${$map.item.selected === 'true' ? 'true' : null}",title:"Open ${$map.item.name} in Media, or drag it onto the canvas","aria-label":"${$map.item.name}"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/open"},value:[{$ref:"$map/item/path"}]}]},children:[{tagName:"span",attributes:{part:"thumb-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"$map/item/thumb"},cases:{image:{tagName:"img",attributes:{part:"thumb-image",src:"${$map.item.src}",alt:"",loading:"lazy",draggable:"false"}},file:{tagName:"span",attributes:{part:"thumb-name"},textContent:"${$map.item.name}"}}}]}]}}]},{tagName:"jx-button",attributes:{part:"media-more",hidden:"${state.mediaMore === '' ? '' : null}"},$props:{size:"sm",variant:"secondary",quiet:!0},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/openMedia"},value:[]}]},children:[{tagName:"span",textContent:"${state.mediaMore}"}]}]}}}]}]}}}]};E("site-panel",O);function A(){return{body:"none",components:[],componentsCount:"",componentsState:"loading",filter:"",media:[],mediaCount:"",mediaMore:"",mediaState:"loading",pages:[],pagesCount:"",pagesState:"loading",templates:[],templatesCount:"",templatesState:"loading"}}function z(e,t){e.body=t.body,e.filter=t.filter,e.pages=t.pages,e.pagesState=t.pagesState,e.pagesCount=t.pagesCount,e.templates=t.templates,e.templatesState=t.templatesState,e.templatesCount=t.templatesCount,e.components=t.components,e.componentsState=t.componentsState,e.componentsCount=t.componentsCount,e.media=t.media,e.mediaState=t.mediaState,e.mediaCount=t.mediaCount,e.mediaMore=t.mediaMore}function ne(e){let t=n(e)?void 0:e.attributes?.part;return n(t)?t:""}function re(e){let t=e?.$map,a=f(t)?t.item:void 0;return f(a)?a:null}function R(e,t){let a=re(e)?.[t];return n(a)?a:""}function _(e,t,a,r){let o=b({...A(),...a});z(o,t);let s=null,l=!1,m=I("site-panel",o,e,{onNodeCreated:(i,u,P,g)=>{if(l||!(i instanceof HTMLElement))return;switch(ne(P)){case"card-preview":{let d=R(g,"tagName");if(d!=="")r.preview(i,d);break}case"component-card":{let d=R(g,"tagName");if(d!=="")r.componentSource(i,d);break}case"media-thumb":{let d=R(g,"path");if(d!=="")r.mediaSource(i,d);break}default:break}}}).then((i)=>{if(l)return i.dispose(),i;return s=i,i});return{connected:()=>!l&&(s===null||s.root.parentNode===e),dispose(){l=!0,s?.dispose(),s=null},ready:m,update:(i)=>{z(o,i)}}}var N=null,D=!1,w=null,y=0;function ie(){return Object.keys(x?.projectConfig?.content??{})}async function oe(e){return(await uL(e)).contentType}async function se(e){let[t,a]=await Promise.all([Em(["pages","layouts"],p()),Wy()]),r=t.files.filter((i)=>i.path.startsWith("pages/")),o=await Promise.all(r.map(async(i)=>({contentType:i.path.includes("[")?await oe(i.path):null,path:i.path})));if(e!==y)return;let s=N?.collections,l=new Map(ie().map((i)=>[i,s?.get(i)??null]));D=!1,N={collections:l,layouts:t.files.flatMap((i)=>i.path.startsWith("layouts/")?[i.path]:[]),pageExtensions:a,pages:o},C();let m=new Set(o.flatMap((i)=>i.contentType&&l.has(i.contentType)?[i.contentType]:[]));if(await Promise.all([...m].map(async(i)=>{let u=await jb(i).catch(()=>null);if(e===y&&u)l.set(i,u.length)})),e===y)C()}function le(){if((!N||D)&&!w&&we()&&x){let e=y;w=se(e).finally(()=>{if(e===y)w=null})}return N}function hb(e){if(y+=1,D=!0,w=null,e===void 0||e.some((t)=>me(t)))T=!0;if(c)C()}var pe=["pages/","layouts/","content/","public/"];function me(e){if(e.startsWith("components/"))return!0;return e.endsWith(".json")&&!Ni(e)&&!pe.some((t)=>e.startsWith(t))}var T=!1,M=!1;function de(){if(M||Nx&&!T||!we())return;M=!0,T=!1,Ra().finally(()=>{M=!1,C()})}function V(e,t){return De.flatMap((a)=>{let r=Nd(a.tagName),o=`<${a.tagName}>`,s=L(a);if(!bb(e,a.tagName,s??"",a.package??""))return[];return[{hint:s?`Open ${o}, or drag it onto the canvas`:`${o} from ${a.package??"a package"}: open Packages, or drag it onto the canvas`,key:a.tagName,label:r,path:s??"",selected:vw(s!==null&&s===t),tagName:a.tagName}]})}function L(e){return e?.path!==void 0&&e.source!=="npm"?e.path:null}var W=8;function ue(e,t){return e>t?`Show all ${e} in Media`:""}function B(e,t,a){return e.flatMap((r)=>bb(t,r.name,r.file)?[{key:r.file,name:r.name,path:r.file,selected:vw(r.file===a),src:r.isImage?io(r.file):"",thumb:r.isImage?"image":"file"}]:[])}function ge(){let e=x?.projectConfig?.defaults?.layout;return n(e)?e.replace(/^\.\//,""):null}var S="";function j(e,t,a){if(e)return"loading";if(t===0)return"empty";return a===0?"nomatch":"listed"}function k(e,t,a){if(a||e===0)return"";return t===e?String(e):`${t} of ${e}`}function U(){if(!x)return{...A(),filter:S};let e=qN(S),t=h.value?.documentPath??null,a=le();de();let r=Gu(),o=a?JN(a.pages,a.collections,t,{extensions:a.pageExtensions,i18n:ln(x.projectConfig??{}).i18n}):[],s=KN(o,e),l=ge(),m=a?UE(a.layouts,t,"",l):[],i=a?UE(a.layouts,t,e,l):[],u=!Nx,P=V("",t),g=V(e,t),d=r?B(r,"",t):[],v=r?B(r,e,t):[],H=(Y)=>Y.filter((Q)=>Q.kind!=="collection").length;return{body:"project",components:g,componentsCount:k(P.length,g.length,u),componentsState:j(u,P.length,g.length),filter:S,media:v.slice(0,W),mediaCount:k(d.length,v.length,r===null),mediaMore:ue(v.length,Math.min(v.length,W)),mediaState:j(r===null,d.length,v.length),pages:s,pagesCount:k(H(o),H(s),a===null),pagesState:j(a===null,o.length,s.length),templates:i,templatesCount:k(m.length,i.length,a===null),templatesState:j(a===null,m.length,i.length)}}function q(e){(ce("8pf70854"),import("./files-8pf70854.js")).then(({openFileInTab:t})=>t(e))}var fe={add:()=>{it("file.new",{},"Site panel")},open:q,openComponent:(e)=>{let t=De.find((r)=>r.tagName===e);if(!t)return;let a=L(t);if(a){q(a);return}it("view.setActivity",{tab:"packages"},"Site panel")},openMedia:()=>{it("view.setWorkspace",{workspace:"media"},"Site panel")},setFilter:(e)=>{S=e,C()}},c=null;async function he(e,t,a){let r=await Iw(a,e.cache);if(r&&c===e&&t.isConnected&&!xw(t))ww(t,r)}function G(e,t,a){let r=qo({element:t,getInitialData:()=>a()??{},onGenerateDragPreview:({nativeSetDragImage:o})=>{ml({nativeSetDragImage:o})}});e.sources.set(t,r)}function be(e){for(let[t,a]of e.sources)if(!t.isConnected)a(),e.sources.delete(t);e.observer.releaseDetached()}function K(e){e.handle?.dispose();for(let t of e.sources.values())t();e.sources.clear(),e.observer.destroy(),e.cache.clear()}function ye(e){let t=De.find((a)=>a.tagName===e);return t?{fragment:Jc(t),type:"block"}:null}function ve(e){let t=Gu()?.find((r)=>r.file===e);if(!t)return null;return{fragment:F({kind:Ud({name:t.name}),name:t.name,path:t.file,ref:t.ref}),type:"block"}}function xe(e){if(c&&(c.host!==e||c.handle?.connected()===!1))K(c),c=null;if(c){c.handle?.update(U()),be(c);return}let t=new Map,a={cache:Rw(),handle:null,host:e,observer:Cp((r)=>{let o=r instanceof HTMLElement?t.get(r):void 0;if(o!==void 0&&r instanceof HTMLElement)t.delete(r),he(a,r,o)}),pending:t,sources:new Map};c=a,a.handle=_(e,U(),fe,{componentSource:(r,o)=>{G(a,r,()=>ye(o))},mediaSource:(r,o)=>{G(a,r,()=>ve(o))},preview:(r,o)=>{let s=L(De.find((l)=>l.tagName===o));if(s)t.set(r,s),a.observer.observe(r)}})}function C(){wn("leftPanel")}function Se(e){return e.querySelector(".panel-content")??e}function PN(){ei({id:"site",title:"Site",level:"project",dock:"navigator",icon:"browser",render:()=>ft,afterRender:(e,t)=>{xe(Se(t))}})}function MN(){if(c)K(c);c=null,S="",y+=1,N=null,D=!1,w=null,T=!0,M=!1}
2
+ export{AN,hb,PN,MN};
3
+
4
+ //# debugId=C265AC8420826AAF64756E2164756E21
5
+ //# sourceMappingURL=studio-y4f1rdsj.js.map
@@ -0,0 +1,5 @@
1
+ import{w}from"./studio-5k9mfafh.js";import{iu}from"./studio-r85zw6ay.js";import{p}from"./studio-1b79rpcb.js";import{zi,fn,co}from"./studio-hf259xzd.js";import{uI,P1,Rr,RM,R_,hI,pI,fI,Xy}from"./studio-52mzbxqm.js";import{Fy,JR,Eo,x}from"./studio-anc8067x.js";import{Ce,re,Uy,qy,I1,ff,N1,sa,mf,pg,C_}from"./studio-ft706q02.js";import{me,Os,te,b,le,Fh}from"./studio-y3tjh2xb.js";import{da,Ni}from"./studio-213pyfxh.js";import{n,J,qe,S,f,Ir,Di,dd,Ef}from"./studio-0z8kp4xk.js";import{ce}from"./studio-nhpg405j.js";var en=new Set(["Adlm","Arab","Aran","Armi","Avst","Cprt","Egyd","Egyh","Elym","Gara","Hatr","Hebr","Hluw","Hung","Khar","Lydi","Mand","Mani","Mend","Merc","Mero","Narb","Nbat","Nkoo","Orkh","Palm","Phli","Phlp","Phnx","Prti","Rohg","Samr","Sarb","Sogd","Sogo","Syrc","Thaa","Todr","Yezi"]),p1="^[A-Za-z]{2,8}(-[A-Za-z0-9]{1,8})*$";function jn(e){if(!n(e)||e.trim()==="")return null;try{return new Intl.Locale(e.trim()).toString()}catch{return null}}function Yx(e){return jn(e)!==null}function Sy(e){let t=jn(e);if(t===null)return"ltr";let o=new Intl.Locale(t),r=o.script??o.maximize().script;return r!==void 0&&en.has(r)?"rtl":"ltr"}function Wt(e){let t=jn(e);if(t===null)return n(e)?e:"";return new Intl.DisplayNames([t],{type:"language"}).of(t)??t}var tn="prefix-except-default";function ln(e){let t=e.i18n,o=[];if(!S(t))return{errors:o,i18n:null};let r=Array.isArray(t.locales)?t.locales:[],i=[];for(let l of r){let c=jn(l);if(c===null){o.push(`i18n.locales: "${String(l)}" is not a well-formed BCP 47 language tag.`);continue}if(!i.includes(c))i.push(c)}let s=jn(t.defaultLocale)??i[0]??null;if(t.defaultLocale!==void 0&&jn(t.defaultLocale)===null)o.push(`i18n.defaultLocale: "${String(t.defaultLocale)}" is not a well-formed BCP 47 language tag.`);if(s===null)return o.push("i18n is declared with no usable locale — set `defaultLocale` or `locales`."),{errors:o,i18n:null};if(!i.includes(s))i.unshift(s);let a=t.routing==="prefix-always"||t.routing==="prefix-except-default"?t.routing:tn;return{errors:o,i18n:{defaultLocale:s,locales:i,routing:a}}}function br(e,t){let o=we(G(e),t);if(o===-1||t===null)return null;return jn(G(e)[o])}function Zx(e,t){let o=br(e,t);if(o!==null||t===null||t.routing!=="prefix-except-default")return o;return G(e)[0]==="pages"?t.defaultLocale:null}function Cy(e,t){let o=G(e),r=we(o,t);return r===-1?o.join("/"):o.filter((i,s)=>s!==r).join("/")}function td(e,t,o){if(o===null)return null;let r=jn(t);if(r===null||!o.locales.includes(r))return null;let i=G(e),s=we(i,o),a=s===-1?nn(i):s;if(a===-1)return null;let l=s===-1?i:i.filter((c,u)=>u!==s);if(r===o.defaultLocale&&o.routing==="prefix-except-default")return l.join("/");return l.toSpliced(a,0,r.toLowerCase()).join("/")}function G(e){return e.replace(/^\.\//,"").split("/").filter(Boolean)}function we(e,t){if(t===null)return-1;return e.findIndex((o)=>{let r=jn(o);return r!==null&&t.locales.includes(r)})}function nn(e){if(e[0]==="pages"&&e.length>1)return 1;if(e[0]==="content"&&e.length>2)return 2;return-1}function fP(e,t){if(t===null)return null;let o=e.split("/").find(Boolean);if(o===void 0)return t.defaultLocale;let r=jn(o);return r!==null&&t.locales.includes(r)?r:t.defaultLocale}var f1=["design","content","media","styles","publish","settings"],Kp="design",Ye=[{icon:"frame-corners",id:"design",switcher:!0,title:"Design"},{icon:"file-text",id:"content",switcher:!0,title:"Content"},{icon:"image",id:"media",switcher:!0,title:"Media"},{icon:"paint-brush",id:"styles",switcher:!0,title:"Styles"},{icon:"paper-plane-tilt",id:"publish",switcher:!0,title:"Publish"},{icon:"gear-six",id:"settings",switcher:!1,title:"Project settings"}],Xx=Ye.filter((e)=>e.switcher);function ER(e){return typeof e==="string"&&f1.some((t)=>t===e)}function vh(e){return Ye.find((t)=>t.id===e)}var Re="workspace://",Qx={content:"content-home",media:"media-home",publish:"publish-home",settings:"settings-home"};function Gp(e){return Object.hasOwn(Qx,e)}function Da(e){return`${Re}${e}`}function vl(e){if(!e.startsWith(Re))return null;let t=e.slice(Re.length);return ER(t)&&Gp(t)?t:null}function ky(e){let t=vl(e);return t?vh(t).title:null}var on=new Map([["design","canvas"],["edit","canvas"],["entry","entry"],["git-diff","diff"],["grid","grid"],["content-home","home"],["media-home","home"],["publish-home","home"],["settings-home","home"],["media","media"],["image","image"],["preview","canvas"],["source","code"],["stylebook","config"],["tokens","tokens"]]),Yp={canvas:"Canvas",code:"Code",config:"Elements",diff:"Diff",entry:"Entry",grid:"Grid",home:"Home",image:"Image",media:"Media",none:"None",tokens:"Variables"};function ia(e){return on.get(e)??"canvas"}var rn=new Map([["design","design"],["edit","edit"],["preview","preview"]]);function mP(e){return rn.get(e)??"design"}var e_=(e)=>e.editor.kind==="canvas",wh=(e)=>e_(e)&&e.selection.count>0,t_=(e)=>wh(e)&&!e.selection.isRoot;function Ey(){return{project:{open:!1,isSite:!1,isRepo:!1,isMultilingual:!1},git:{ahead:0,behind:0,dirtyCount:0},workspace:{id:Kp},document:{open:!1,dirty:!1,mode:"",canUndo:!1,canRedo:!1},editor:{kind:"none"},canvas:{view:"design"},pane:{count:1,derived:!1},selection:{count:0,paths:[],kind:"",isRoot:!1,isComponentInstance:!1,isLayoutNode:!1,isRepeater:!1},caret:{active:!1,inCanvas:!1},focus:{region:"pane"},modal:{open:!1},collab:{attached:!1,readOnly:!1,sourceCanonical:!1},ai:{configured:!1,streaming:!1,waiting:!1},capability:{gitClone:!1,importSite:!1,openProjectInNewWindow:!1,openProject:!1,dataRows:!1,windowControls:!1,findReferences:!1,readFileBytes:!1,publish:!1}}}function m1(e={}){let t=Ey();for(let o of Object.keys(e)){let r=e[o];if(r)Object.assign(t[o],r)}return t}var sn=["palette"],an=["caret","global"],cn=["dock","global"],un=["canvas","global"],dn=["grid","global"],mn=["code","global"],Ze=["global"];function gP(e){if(e.modal.open)return sn;if(e.caret.active)return an;if(e.focus.region!=="pane")return cn;switch(e.editor.kind){case"grid":return dn;case"code":return mn;case"canvas":return e.canvas.view==="preview"?Ze:un;default:return Ze}}var Ae=b(new Set);function Qm(e){Ae.add(e)}function n_(e){Ae.delete(e)}function g1(e){return Ae.has(e)}var TR=()=>({kind:"proceed"});function Ty(e,t){return{success:!0,data:e,summary:t}}function Hn(e){return{success:!1,error:e}}function Ko({name:e,description:t,parameters:o,strict:r=!0,llmStrict:i=!1,interactive:s,title:a,annotations:l,interaction:c,settle:u,execute:d}){let m={name:e,description:t,parameters:o,strict:r,llmStrict:i,execute:d};if(s!==void 0)m.interactive=s;if(a!==void 0)m.title=a;if(l!==void 0)m.annotations=l;if(c!==void 0)m.interaction=c;if(u!==void 0)m.settle=u;return m}function i_(e){let t=[];return{record(o){t.push(o),e?.(o)},writes:t}}function xh(e=null,t={}){let o=new Map(Object.entries(t));return{sessionId:e,get:(r)=>o.get(r),set:(r,i)=>{o.set(r,i)},toJSON:()=>Object.fromEntries(o)}}var gn=new AbortController().signal;function r_(e={}){let t=e.session??xh();return{actor:e.actor??{id:`assistant:${t.sessionId??"local"}:`,kind:"assistant",sessionId:t.sessionId,turnId:""},callId:e.callId??"",ledger:e.ledger??i_(),progress:e.progress??(()=>{}),session:t,signal:e.signal??gn}}function bP(e){let t=new AbortController;if(e.aborted)return t.abort(e.reason),{release:()=>{},signal:t.signal};let o=()=>{t.abort(e.reason)};return e.addEventListener("abort",o,{once:!0}),{release:()=>{e.removeEventListener("abort",o)},signal:t.signal}}function o_(){let e=new Map;return{register(t){if(e.has(t.name))console.warn(`Tool "${t.name}" is being re-registered.`);e.set(t.name,t)},list(){return[...e.values()]},listForLLM(){return[...e.values()].map((t)=>{let o={name:t.name,description:t.description,parameters:t.parameters};if(t.llmStrict===!0)o.strict=!0;return{type:"function",function:o}})},getDefinition(t){return e.get(t)},validate(t,o){let r=e.get(t);if(!r)return{valid:!1,errors:[`Unknown tool: "${t}"`]};if(!r.strict)return{valid:!0};let i=r.parameters;if(!i.properties)return{valid:!0};let s=[],a=i.properties,l=i.required||[];for(let c of l)if(!(c in o)||o[c]===void 0||o[c]===null)s.push(`Missing required argument: "${c}"`);for(let[c,u]of Object.entries(o)){let d=a[c];if(!d)continue;let m=d.type;if(!m)continue;let v=Qe(u);if(m==="number"||m==="integer"){if(Je(u,"number"))continue;if(Je(u,"string")){if(!Number.isNaN(Number(u)))continue;s.push(`Argument "${c}" should be a number, got non-numeric string "${u}"`);continue}s.push(`Argument "${c}" should be a number, got ${v}`);continue}if(m==="string"&&v!=="string")s.push(`Argument "${c}" should be a string, got ${v}`);else if(m==="boolean"&&v!=="boolean")s.push(`Argument "${c}" should be a boolean, got ${v}`);else if(m==="array"&&v!=="array")s.push(`Argument "${c}" should be an array, got ${v}`);else if(m==="object"&&v!=="object")s.push(`Argument "${c}" should be an object, got ${v}`)}return s.length>0?{valid:!1,errors:s}:{valid:!0}},async execute(t,o,r=r_()){let i=e.get(t);if(!i)return Hn(`Unknown tool: "${t}"`);let s=this.validate(t,o);if(!s.valid)return Hn(`Validation failed: ${(s.errors||[]).join("; ")}`);try{return await i.execute(o,r)}catch(a){return Hn(`Tool "${t}" execution error: ${ge(a)}`)}}}}var yn="The author declined this call.";function hn(e){return JSON.parse(JSON.stringify(e))}function ge(e){return e.message}var bn=["string","number","boolean","undefined"];function Je(e,t){return typeof e===t}function Tn(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function Qe(e){if(Array.isArray(e))return"array";return bn.find((t)=>Je(e,t))??"object"}function vn(e){if(!e)return{};let t=JSON.parse(e);if(!Tn(t)){let o=t===null?"null":Qe(t);throw TypeError(`arguments must be a JSON object, got ${o}`)}return t}async function $R(e,t,o,{approval:r=TR,response:i}={}){let s=!1,a;try{let l=vn(t.argumentsText),c=e.getDefinition(t.name),u=c?On(e,c,l,r,i):null;if(u?.status==="needs_input")return u;if(u)({result:a}=u);else s=!0,a=await e.execute(t.name,l,o)}catch(l){a=Hn(`Failed to parse arguments: ${ge(l)}`)}try{return{status:"done",result:hn(a),executed:s}}catch(l){let c=ge(l);return{status:"done",result:Hn(`Tool "${t.name}" returned a result that cannot be serialized: ${c}`),executed:s}}}function On(e,t,o,r,i){let{interaction:s,settle:a}=t;if(s&&a){let c=e.validate(t.name,o);if(!c.valid)return pe(`Validation failed: ${(c.errors||[]).join("; ")}`);if(i)return{status:"done",result:Pn(t.name,a,o,i),executed:!1};let u=s(o);return"refusal"in u?pe(u.refusal):{status:"needs_input",request:u}}let l=r(t,o);if(l.kind==="deny")return pe(l.message);if(l.kind==="confirm"){if(!i)return{status:"needs_input",request:{kind:"approval",reason:l.reason,summary:l.summary,title:t.title??t.name,tool:t.name}};if(i.kind!=="approval"||!i.approved)return pe(yn)}return null}function pe(e){return{status:"done",result:Hn(e),executed:!1}}function Pn(e,t,o,r){try{return t(o,r)}catch(i){return Hn(`Tool "${e}" execution error: ${ge(i)}`)}}function DR(e,t){return et(e,"v",t)}function l_(e,t){return et(e,"r",t)}function et(e,t,o){if(!n(o)||o==="")return e;let r=e.indexOf("#"),i=r===-1?"":e.slice(r),s=r===-1?e:e.slice(0,r),a=s.indexOf("?"),l=a===-1?s:s.slice(0,a),u=(a===-1?[]:s.slice(a+1).split("&")).filter((d)=>d!==""&&!Sn(d,t));return u.push(`${t}=${encodeURIComponent(o)}`),`${l}?${u.join("&")}${i}`}function Sn(e,t){let o=e.indexOf("="),r=o===-1?e:e.slice(0,o);if(r===t)return!0;if(!r.includes("%"))return!1;try{return decodeURIComponent(r)===t}catch{return!1}}function Ie(e,t){if(!e||!Object.hasOwn(e,t))return;let o=e[t];return n(o)?o:void 0}function Ry(e,t,o=[]){if(!e||!t)return null;let r=e.replaceAll("\\","/").replace(/^\.\//,""),i=null,s=(a,l)=>{if(r.startsWith(`${a}/`)&&(!i||a.length>i.dir.length))i={dir:a,urlPrefix:l}};for(let[a,l]of Object.entries(t)){if(!l?.source||!P1.test(a))continue;let c=Cn(l.source);if(c===""||c.startsWith(".."))continue;if(c.includes(Rr)){let u=wn(r,c,a,o);if(u)s(u.dir,u.urlPrefix);continue}if(/\.[a-z0-9]+$/i.test(c))continue;s(c,`/${uI}/${a}`)}return i}function wn(e,t,o,r){let i=t.indexOf(Rr),s=t.slice(0,i),a=t.slice(i+Rr.length);if(!e.startsWith(s))return null;let l=e.slice(s.length).split("/")[0]??"";if(l===""||!P1.test(l))return null;let c=r.find((d)=>d.toLowerCase()===l.toLowerCase());if(c===void 0||!P1.test(c))return null;return{dir:`${s}${l}${a}`.replace(/\/+$/,""),urlPrefix:`/${uI}/${o}/${c}`}}function Cn(e){return e.replaceAll("\\","/").replace(/^\.\//,"").replace(/\/+$/,"")}function Iy(e,t){if(!t||e==="")return null;if(t.space==="repo"){if(!t.fileBaseUrl)return null;let s=fI(e,t.documentDir,t.mounts,t.lanes);if(s===null)return null;let{suffix:a}=R_(e);return l_(DR(`${t.fileBaseUrl}${Xy(s)}${a}`,Ie(t.versions,s)),Ie(t.revisions,s))}let[o]=t.mounts,r=o?An(e,t.documentDir,o):null,i=Rn(e,t);return i===void 0?r:l_(r??e,i)}function Rn(e,t){if(!t.revisions||Object.keys(t.revisions).length===0)return;let o=fI(e,t.documentDir,t.mounts,t.lanes);return o===null?void 0:Ie(t.revisions,o)}function An(e,t,o){if(hI(e))return null;let{path:r,suffix:i}=R_(e),s;try{s=decodeURIComponent(r)}catch{return null}let a=pI(t,s);if(a===null)return null;let l=RM([o],a);if(!l)return null;return`${l}${i}`}function tt(e){return e.replaceAll(/[.*+?^${}()|[\]\\]/g,String.raw`\$&`)}function z(e){return e.replaceAll("\\","/").replace(/^\.\//,"").replace(/\/+$/,"")}function nt(e){return e??x?.projectConfig??null}function ot(e){return e?.content??{}}function In(e){let t=ln(e??{}).i18n?.locales??[];return t.length>0?[...t]:null}function rt(e){if(e.endsWith("/"))return!1;let t=e.slice(e.lastIndexOf("/")+1);return/\.[a-z\d]+$/i.test(t)}function it(e){if(e.format==="json")return{ext:".json",unresolvedFormat:null};if(e.format===void 0||e.format==="")return{ext:co()?.extensions[0]??".json",unresolvedFormat:null};let t=zi(e.format);return t?.extensions[0]===void 0?{ext:null,unresolvedFormat:e.format}:{ext:t.extensions[0],unresolvedFormat:null}}function kn(e,t){let o=t===null?"[^/]+":`(?:${t.map((i)=>tt(i)).join("|")})`,r=z(e).split(Rr).map((i)=>tt(i)).join(o);return new RegExp(`^${r}(?:/|$)`,"i")}function Dn(e,t,o){let r=kn(e,o).exec(t);if(!r)return null;return r[0].replace(/\/$/,"")}function En(e){return z(e).replaceAll(Rr,"").length}function Yd(e,t){if(e===null||e===void 0||e==="")return null;let o=nt(t),r=In(o),i=z(e),s=null,a=-1;for(let[l,c]of Object.entries(ot(o))){let{source:u}=c;if(u===void 0||u===""||rt(u))continue;let d=En(u);if(d<=a)continue;let m=Dn(u,i,r);if(m===null)continue;s={def:c,dir:i,fileBacked:!1,isSourceRoot:i.length===m.length,name:l,...it(c)},a=d}return s}function Jn(e,t){if(e===null||e===void 0||e==="")return null;let o=nt(t),r=z(e),i=r.toLowerCase();for(let[s,a]of Object.entries(ot(o))){let{source:l}=a;if(l===void 0||l===""||!rt(l))continue;let c=z(l).toLowerCase();if(i===c||i.endsWith(`/${c}`))return{def:a,dir:r.includes("/")?r.slice(0,r.lastIndexOf("/")):".",fileBacked:!0,isSourceRoot:!1,name:s,...it(a)}}return Yd(r.includes("/")?r.slice(0,r.lastIndexOf("/")):".",o)}function nd(e){return e.replaceAll(/([A-Z])/g," $1").replace(/^./,(t)=>t.toUpperCase())}function u_(e){return e.replaceAll(/[^a-zA-Z0-9]+(.)?/g,(t,o)=>o?o.toUpperCase():"").replace(/^[A-Z]/,(t)=>t.toLowerCase())}function h_(e){return e.replaceAll(/(^|-)(\w)/g,(t,o,r)=>(o?" ":"")+r.toUpperCase())}function v1(e,t){return e?.$label||nd(t)}function NP(e,t){if(e?.$label)return e.$label;if(t.includes("-"))return t.replaceAll(/(^|-)(\w)/g,(o,r,i)=>(r?" ":"")+i.toUpperCase());return nd(t)}function Aa(e){return e==="image"||e==="uri-reference"}function _h(e){if(e.$shorthand===!0)return"shorthand";if(e.$input==="button-group")return"button-group";if(e.$input==="media")return"media";if(e.format==="color")return"color";if(Aa(e.format))return"media";if(e.$units!==void 0)return"number-unit";if(e.type==="number")return"number";if(Array.isArray(e.enum))return"select";if(Array.isArray(e.examples)||Array.isArray(e.presets))return"combobox";return"text"}function Sh(e,t){if(!e||!t?.content)return null;let o=Jn(e,t);if(!o||!o.def.schema)return null;if(!o.fileBacked){let r=o.ext??co()?.extensions[0]??".json";if(!e.toLowerCase().endsWith(r.toLowerCase()))return null}return{name:o.name,schema:o.def.schema}}function Ny(e,t){let o=e.trim().toLowerCase().replaceAll(/[^a-z0-9\s-]/g,"").replaceAll(/\s+/g,"-").replaceAll(/-+/g,"-").replaceAll(/^-|-$/g,"");if(!o)return"";return`${t}${o}`}function p_(e,t){return e.replace(new RegExp(`^${t.replaceAll(/[.*+?^${}()|[\]\\]/g,String.raw`\$&`)}`),"").replace(/^--/,"").replaceAll("-"," ").replaceAll(/\b\w/g,(o)=>o.toUpperCase())||e}function DP(e){if(!e)return{kind:"text"};let t=e.trim().replaceAll(/\s*\|\s*undefined\b/g,"").trim();if(t==="boolean")return{kind:"boolean"};if(t==="number")return{kind:"number"};if(t.match(/^'[^']*'(\s*\|\s*'[^']*')+$/))return{kind:"combobox",options:[...t.matchAll(/'([^']*)'/g)].map((i)=>i[1])};return{kind:"text"}}function ro(e){return JSON.parse(JSON.stringify(e))}function Pe(e){return e?.at(-1)??null}function wP(e){return e?.[0]??null}function s_(e,t){if(!t||!e)return!1;return e.some((o)=>Eo(o,t))}function Oa(e){return Y(e)}function Y(e){let t=[];for(let o of e)t.push([...o]);return t}function a_(e,t){if(s_(e,t))return Y(e.filter((o)=>!Eo(o,t)));return[...Y(e),[...t]]}function xP(e,t,o){let r=e.findIndex((a)=>Eo(a,o)),i=t?e.findIndex((a)=>Eo(a,t)):-1;if(r===-1||i===-1)return[[...o]];let s=i<=r?e.slice(i,r+1):e.slice(r,i+1).toReversed();return Y(s)}function ye(e,t){return Y(e.filter((o)=>!sa(t,o)))}function _P(e){let t=[];for(let o of e)if(!t.some((r)=>Eo(r,o)))t.push([...o]);return t}function ng(e){if(e.length===0)return{mixed:!1,value:void 0};let[t]=e,o=JSON.stringify(t??null);for(let r=1;r<e.length;r++)if(JSON.stringify(e[r]??null)!==o)return{mixed:!0,value:void 0};return{mixed:!1,value:t}}var st=null;function IP(e){st=e}function at(){return st}var Z=null,Q=null,ee=null,ke=!0;function lt(){Z=[],Q=[],ee=[],ke=!0}function y(e){if(Z)Z.push(e)}function Vi(e){if(Q)Q.push(e)}function ct(e){if(ee)ee.push(e)}function ut(){let e={docOps:Q??[],fmOps:ee??[],invertible:ke,ops:Z??[]};return Z=null,Q=null,ee=null,ke=!0,e}var Mn=100,$n=20;function ne(){try{return typeof localStorage>"u"||!localStorage.getItem("jx-legacy-history")}catch{return!0}}function R(e,t){let o=re(e,t);if(!o)throw TypeError(`No node at path [${t.join(", ")}]`);return o}function C(e,t,o,r){return{forward:{key:t,op:"set-key",path:e,value:r},inverse:{key:t,op:"set-key",path:e,value:o}}}var dt=null;function ft(e){dt=e}var pt=null;function mt(e){pt=e}function Ln(e,t,o,r){for(let i=t.docOps.length-1;i>=0;i--)qy(e.doc.document,le(t.docOps[i].inverse));for(let i=t.fmOps.length-1;i>=0;i--){let s=t.fmOps[i];Me(e,s.field,s.before)}e.doc.document={...le(e.doc.document)},e.session.selection=o,e.doc.dirty=r}function X(e,t,{skipHistory:o=!1,origin:r="user",coalesceKey:i=null,actor:s=null}={}){if(!e)return!1;if(r!=="remote"&&pt?.(e,r))return!1;let a=s??he;if(r!=="remote")Ee(e,a);let l=Oa(e.session.selection),c=e.doc.dirty;lt();let u,d=null;try{t(e)}catch(I){d={error:I}}finally{u=ut()}if(d)throw Ln(e,u,l,c),d.error;let m=le(e.doc.document),v={...m},j=at(),M=j===null?{patchable:!1,reason:"no-patch-consumer"}:u.ops.length===0?{patchable:!1,reason:"unrecorded-mutation"}:j.classify(e,u.ops);if(M.patchable)j.markConsumed(v,e);if(e.doc.document=v,M.patchable)try{j.apply(e,u.ops,u)}catch(I){j.escalate(`patch-apply-failed: ${I instanceof Error?I.message:String(I)}`,e)}if(!o){let I=a?Fn(a):null;if(I)Vn(I,e,u,l);else gt(e,m,u,l,i)}return e.doc.dirty=!0,dt?.(e,u,r),!0}function gt(e,t,o,r,i=null){let s=e.history.snapshots.slice(0,e.history.index+1),a=ne()&&o.invertible&&(o.docOps.length>0||o.fmOps.length>0),l=s.at(-1);if(i&&a&&l&&l.coalesceKey===i&&l.inverseOps){if(l.forwardOps=[...l.forwardOps??[],...o.docOps.map((u)=>u.forward)],l.inverseOps=[...l.inverseOps,...o.docOps.map((u)=>u.inverse)],l.selection=Oa(e.session.selection),l.document)l.document=ro(t);e.history.snapshots=s,e.history.index=s.length-1;return}let c=!a||s.length%$n===0;if(s.push({document:c?ro(t):null,fmOps:a&&o.fmOps.length>0?o.fmOps:null,forwardOps:a?o.docOps.map((u)=>u.forward):null,inverseOps:a?o.docOps.map((u)=>u.inverse):null,coalesceKey:i,selection:Oa(e.session.selection),selectionBefore:r}),s.length>Mn){if(!s[1].document)s[1].document=De(s,1);s.shift()}e.history.snapshots=s,e.history.index=s.length-1}function De(e,t){let o=t;while(o>=0&&!e[o].document)o-=1;let r=o<0?null:e[o].document;if(!r)throw Error("history-missing-checkpoint");let i=ro(r);for(let s=o+1;s<=t;s++)for(let a of e[s].forwardOps??[])qy(i,a);return i}function Zd(e,t,o){return X(e,(r)=>t(r.doc.document),o)}function je(e,t){X(e,(o)=>{for(let r of t)xe(o,r)},{origin:"remote",skipHistory:!0})}function OP(e,t,{actor:o=null,selection:r={kind:"keep"}}={}){if(t.length===0)return"unchanged";return X(e,(s)=>{for(let a of t)xe(s,a,N1(le(s.doc.document),a));Nn(s,r)},{actor:o})?"applied":"refused"}function Nn(e,t){if(t.kind==="prune")for(let o of t.under)e.session.selection=ye(e.session.selection,o);else if(t.kind==="follow"&&Eo(Pe(e.session.selection),t.from))e.session.selection=[[...t.to]]}var _n=new Set(["state","$media","$head","$elements","imports","$layout"]);function xe(e,t,o=t){let r=null;if(t.op==="set-key")r=re(e.doc.document,t.path)?.[t.key];switch(qy(e.doc.document,t),Vi({forward:t,inverse:o}),t.op){case"set-key":{if(_n.has(t.key))y({key:t.key,op:"doc-meta"});else if(t.key==="style")y({op:"set-style",path:t.path});else if(t.key==="textContent")y({op:"set-text",path:t.path});else if(t.key==="attributes"||t.key==="cases"||t.key==="$props")y({op:"replace",path:t.path});else{let i=t.key.startsWith("on")&&(Ef(t.value)||Ef(r));y({isEvent:i,key:t.key,op:"set-prop",path:t.path})}return}case"insert-child":{y({index:t.index,op:"insert",parentPath:t.parentPath});return}case"remove-child":{y({op:"remove",path:[...t.parentPath,"children",t.index]});return}case"set-child":{y({op:"replace",path:[...t.parentPath,"children",t.index]});return}case"move-child":{y({fromPath:[...t.fromParentPath,"children",t.fromIndex],op:"move",toIndex:t.toIndex,toParentPath:t.toParentPath});break}default:break}}var W=new Map,N=new Map,he=null,yt=null;function ht(e){yt=e}function AP(e){let t=W.get(e.id);if(t)be(t);let o={owner:e,receipts:[]};return W.set(e.id,o),{owner:e,flush:()=>be(o),close:()=>{if(be(o),W.get(e.id)===o)W.delete(e.id);return[...o.receipts]}}}function PR(e,t){let o=he;he=e;try{return t()}finally{he=o}}function bt(e,t){let o=N.get(e);return o!==void 0&&(!t||o.lane.owner.id===t.id)}function PP(){for(let e of W.values())be(e)}function Fn(e){return W.get(e.id)??null}function be(e){for(let[t,o]of N)if(o.lane===e)xt(t,o)}function Vn(e,t,o,r){let i=N.get(t);if(!i)i={docOps:[],fmOps:[],invertible:!0,lane:e,selectionBefore:r},N.set(t,i);if(i.docOps.push(...o.docOps),i.fmOps.push(...o.fmOps),!o.invertible||o.docOps.length===0&&o.fmOps.length===0)i.invertible=!1}function Ee(e,t){let o=N.get(e);if(o&&o.lane.owner.id!==t?.id)xt(e,o)}function xt(e,t){N.delete(e);let{owner:o}=t.lane,r=o.turnId??"";if(V.has(e))t.lane.receipts.push({entry:null,tab:e,turnId:r});else{let i={docOps:t.docOps,fmOps:t.fmOps,invertible:t.invertible,ops:[]};gt(e,le(e.doc.document),i,t.selectionBefore);let s=e.history.snapshots[e.history.index];if(s.actor=o.id,o.turnId!==void 0)s.turnId=o.turnId;t.lane.receipts.push({entry:s,tab:e,turnId:r})}yt?.(e)}var V=new WeakMap;function Xd(e,t){if(t)V.set(e,t);else V.delete(e)}function MP(e){let t=V.get(e);return t?t.canUndo(e):e.history.index>0||N.has(e)}function FP(e){let t=V.get(e);return t?t.canRedo(e):!N.has(e)&&e.history.index<e.history.snapshots.length-1}function Tt(e,t){let{snapshots:o}=e.history;e.doc.document=De(o,t);let r=o[t];e.session.selection=Oa(le(r.selection))}function vt(e,t){try{if(typeof localStorage>"u"||!localStorage.getItem("jx-canvas-debug"))return}catch{return}let o=JSON.stringify(De(e.history.snapshots,t)),r=JSON.stringify(ro(le(e.doc.document)));if(o!==r)console.error("jx history: ops-based undo/redo diverged from checkpoint replay",{index:t})}function w1(e){Ee(e,null);let t=V.get(e);if(t){t.undo(e);return}if(e.history.index<=0)return;let o=e.history.snapshots[e.history.index],r=ne()?o.inverseOps:null,i=ne()?o.fmOps:null;if(r&&r.length>0||i&&i.length>0){if(!X(e,(a)=>{if(r)for(let l=r.length-1;l>=0;l--)xe(a,le(r[l]));if(i)for(let l=i.length-1;l>=0;l--){let c=le(i[l]);Me(a,c.field,c.before)}},{origin:"history",skipHistory:!0}))return;e.session.selection=Oa(le(o.selectionBefore??[])),e.history.index-=1,vt(e,e.history.index)}else e.history.index-=1,Tt(e,e.history.index);e.doc.dirty=!0}function jP(e){Ee(e,null);let t=V.get(e);if(t){t.redo(e);return}if(e.history.index>=e.history.snapshots.length-1)return;let o=e.history.snapshots[e.history.index+1],r=ne()?o.forwardOps:null,i=ne()?o.fmOps:null;if(r&&r.length>0||i&&i.length>0){if(!X(e,(a)=>{if(r)for(let l of r)xe(a,le(l));if(i)for(let l of i){let c=le(l);Me(a,c.field,c.after)}},{origin:"history",skipHistory:!0}))return;e.session.selection=Oa(le(o.selection)),e.history.index+=1,vt(e,e.history.index)}else e.history.index+=1,Tt(e,e.history.index);e.doc.dirty=!0}function oo(e,t,o,r){let i=re(e.doc.document,t);if(!i)return;let s=Uy(i),a=ff(o,s.length);s.splice(a,0,structuredClone(r)),y({index:a,op:"insert",parentPath:t}),Vi({forward:{index:a,node:Ce(r),op:"insert-child",parentPath:t},inverse:{index:a,op:"remove-child",parentPath:t}})}function Ch(e,t){let o=mf(t);if(!o)return;let{index:r,parentPath:i}=o,[s]=R(e.doc.document,i).children.splice(r,1);y({op:"remove",path:t}),Vi({forward:{index:r,op:"remove-child",parentPath:i},inverse:{index:r,node:Ce(s),op:"insert-child",parentPath:i}}),e.session.selection=ye(e.session.selection,t)}function MR(e,t){let o=mf(t);if(!o)return;let r=re(e.doc.document,t);if(!r)return;let{index:i,parentPath:s}=o,a=structuredClone(le(r));R(e.doc.document,s).children.splice(i+1,0,a),y({index:i+1,op:"insert",parentPath:s}),Vi({forward:{index:i+1,node:Ce(a),op:"insert-child",parentPath:s},inverse:{index:i+1,op:"remove-child",parentPath:s}}),e.session.selection=[[...s,"children",i+1]]}function ig(e,t){for(let o of pg(t))Ch(e,o)}function f_(e,t){let o=[];for(let r of pg(t)){let i=e.session.selection;MR(e,r);let s=Pe(e.session.selection),a=mf(s);if(!s||!a||e.session.selection===i)continue;o=o.map((l)=>I1(a.parentPath,l,a.index,1,!0)),o.unshift(s)}if(o.length>0)e.session.selection=o}function HP(e,t,o="div"){let r=mf(t);if(!r)return;let i=re(e.doc.document,t);if(!i)return;let{index:s,parentPath:a}=r,l={children:[structuredClone(le(i))],tagName:o},c=Ce(i);R(e.doc.document,a).children.splice(s,1,l),y({op:"replace",path:t}),Vi({forward:{index:s,node:Ce(l),op:"set-child",parentPath:a},inverse:{index:s,node:c,op:"set-child",parentPath:a}}),e.session.selection=[[...a,"children",s]]}function Zp(e,t,o,r){let i=e.doc.document,s=C_(i,t,o,r);if(!s)return;let{forward:a,inverse:l}=s,c=re(i,a.fromParentPath),u=re(i,o),[d]=c.children.splice(a.fromIndex,1);if(Uy(u).splice(a.toIndex,0,d),y({fromPath:t,op:"move",toIndex:a.toIndex,toParentPath:o}),Vi({forward:a,inverse:l}),Eo(Pe(e.session.selection),t))e.session.selection=[[...l.fromParentPath,"children",l.fromIndex]]}function Xe(e,t,o,r){let i=re(e.doc.document,t);if(!i)return;let s=i[o],a=Ce(s);if(r===void 0||r===null||r==="")delete i[o];else i[o]=r;if(Vi(C(t,o,a,Ce(i[o]))),o==="children")e.session.selection=ye(e.session.selection,[...t,"children"]);if(o==="textContent")y({op:"set-text",path:t});else if(o==="style")y({op:"set-style",path:t});else{let l=r===void 0||r===null||r===""?s:r,c=o.startsWith("on")&&Ef(l);y({isEvent:c,key:o,op:"set-prop",path:t})}}function rg(e,t,o,r){let i=R(e.doc.document,t),s=Ce(i.style);if(!i.style)i.style={};if(r===void 0||r==="")delete i.style[o];else i.style[o]=r;if(Object.keys(i.style).length===0)delete i.style;Vi(C(t,"style",s,Ce(i.style))),y({op:"set-style",path:t})}function Co(e,t,o,r){let i=R(e.doc.document,t),s=Ce(i.attributes);if(!i.attributes)i.attributes={};if(r===void 0||r==="")delete i.attributes[o];else i.attributes[o]=r;if(Object.keys(i.attributes).length===0)delete i.attributes;Vi(C(t,"attributes",s,Ce(i.attributes))),y({attr:o,op:"set-attr",path:t})}function BP(e,t,o,r,i){if(!o)return rg(e,t,r,i);let s=R(e.doc.document,t),a=Ce(s.style);if(!s.style)s.style={};let l=`@${o}`,c=dd(s.style,l);if(i===void 0||i===""){if(delete c[r],Object.keys(c).length===0)delete s.style[l]}else c[r]=i;if(Object.keys(s.style).length===0)delete s.style;Vi(C(t,"style",a,Ce(s.style))),y({op:"set-style",path:t})}function m_(e,t,o,r,i){let s=R(e.doc.document,t),a=Ce(s.style);if(!s.style)s.style={};let l=dd(s.style,o);if(i===void 0||i===""){if(delete l[r],Object.keys(l).length===0)delete s.style[o]}else l[r]=i;if(Object.keys(s.style).length===0)delete s.style;Vi(C(t,"style",a,Ce(s.style))),y({op:"set-style",path:t})}function VP(e,t,o,r,i,s){let a=R(e.doc.document,t),l=Ce(a.style);if(!a.style)a.style={};let c=`@${o}`,u=dd(a.style,c),d=dd(u,r);if(s===void 0||s===""){if(delete d[i],Object.keys(d).length===0)delete u[r];if(Object.keys(u).length===0)delete a.style[c]}else d[i]=s;if(Object.keys(a.style).length===0)delete a.style;Vi(C(t,"style",l,Ce(a.style))),y({op:"set-style",path:t})}function Ot(e,t){let o=[e];for(let r of t){let i=Di(o.at(-1),r);if(!i)break;o.push(i)}for(let r=o.length-2;r>=0;r--){let i=o[r],s=t[r],a=Di(i,s);if(a&&Object.keys(a).length===0)delete i[s]}}function g_(e,t,o,r,i){let s=R(e.doc.document,t),a=Ce(s.style);if(!s.style)s.style={};let l=s.style;for(let c of o)l=dd(l,c);if(i===void 0||i==="")delete l[r],Ot(s.style,o);else l[r]=i;if(Object.keys(s.style).length===0)delete s.style;Vi(C(t,"style",a,Ce(s.style))),y({op:"set-style",path:t})}function WP(e,t,o,r,i,s){let a=R(e.doc.document,t),l=Ce(a.style);if(!a.style)a.style={};let c=`@${o}`,u=dd(a.style,c),d=u;for(let m of r)d=dd(d,m);if(s===void 0||s===""){if(delete d[i],Ot(u,r),Object.keys(u).length===0)delete a.style[c]}else d[i]=s;if(Object.keys(a.style).length===0)delete a.style;Vi(C(t,"style",l,Ce(a.style))),y({op:"set-style",path:t})}function zP(e,t,o){let r=R(e.doc.document,t),i=Ce(r.style);if(o&&Object.keys(o).length>0)r.style=o;else delete r.style;Vi(C(t,"style",i,Ce(r.style))),y({op:"set-style",path:t})}function Qd(e,t,o){let r=e.doc.document,i=Ce(r.state);if(!r.state)r.state={};r.state[t]=o,Vi(C([],"state",i,Ce(r.state))),y({key:"state",op:"doc-meta"})}function UP(e,t){let o=e.doc.document;if(o.state){let r=Ce(o.state);if(delete o.state[t],Object.keys(o.state).length===0)delete o.state;Vi(C([],"state",r,Ce(o.state))),y({key:"state",op:"doc-meta"})}}function Go(e,t,o){let r=e.doc.document,i=Ce(r.state);if(!r.state)r.state={};let s=r.state[t],a=s==null?{}:!S(s)||Array.isArray(s)?{default:s}:s;r.state[t]=a,Object.assign(a,o);for(let l of Object.keys(a))if(a[l]===void 0||a[l]===null)delete a[l];Vi(C([],"state",i,Ce(r.state))),y({key:"state",op:"doc-meta"})}function qP(e,t,o){let r=e.doc.document;if(!r.state||!r.state[t])return;let i=Ce(r.state);r.state[o]=r.state[t],delete r.state[t],Vi(C([],"state",i,Ce(r.state))),y({key:"state",op:"doc-meta"})}function Xp(e,t,o,r){let i=R(e.doc.document,t),s=Ce(i.$props);if(!i.$props)i.$props={};if(r===void 0||r===null||r==="")delete i.$props[o];else i.$props[o]=r;if(Object.keys(i.$props).length===0)delete i.$props;Vi(C(t,"$props",s,Ce(i.$props))),y({op:"replace",path:t})}function JP(e,t,o,r){let i=R(e.doc.document,t),s=Ce(i.cases);if(!i.cases)i.cases={};i.cases[o]=r||{tagName:"div",textContent:o},Vi(C(t,"cases",s,Ce(i.cases))),y({op:"replace",path:t})}function KP(e,t,o){let r=R(e.doc.document,t);if(r.cases){let i=Ce(r.cases);delete r.cases[o],Vi(C(t,"cases",i,Ce(r.cases))),y({op:"replace",path:t})}}function GP(e,t,o,r){let i=R(e.doc.document,t);if(!i.cases||!i.cases[o])return;let s=Ce(i.cases);i.cases[r]=i.cases[o],delete i.cases[o],Vi(C(t,"cases",s,Ce(i.cases))),y({op:"replace",path:t})}function eu(e,t,o){let r=e.doc.content.frontmatter,i=Object.hasOwn(r,t)?Ce(r[t]):void 0,s=o===void 0||o===null||o==="";if(s)delete r[t];else r[t]=o;let a=s?void 0:Ce(o);ct({after:a,before:i,field:t}),e.doc.dirty=!0}function Me(e,t,o){if(o===void 0)delete e.doc.content.frontmatter[t];else e.doc.content.frontmatter[t]=o}var B=[],Wn=50;function YP(e){return Object.assign(i_(),{turnId:e})}function ZP(e,t,o=[]){if(t.length===0)return[];let r={batches:[...o],id:e,writes:[...t]};B.push(r);while(B.length>Wn)B.shift();return r.writes}function XP(e){return B.find((t)=>t.id===e)?.writes??[]}function QP(e){let t=B.find((s)=>s.id===e),o="There is no longer a record of what that turn changed.";if(!t)return"There is no longer a record of what that turn changed.";let r=t.writes.filter((s)=>s.disk).map((s)=>s.path);if(r.length>0)return`Cannot restore: ${r.join(", ")} ${r.length===1?"was":"were"} written straight to disk, which undo cannot reach.`;if(t.batches.length===0)return"There is no longer a record of what that turn changed.";let i=new Map;for(let s of t.batches)i.set(s.tab,[...i.get(s.tab)??[],s]);for(let[s,a]of i){let l=Bn(s,a);if(l)return l}for(let[s,a]of i)for(let l of a)w1(s);return[...i.keys()]}function Bn(e,t){let o=e.documentPath??"(untitled)";if(e.scope.active===!1)return`Cannot restore: ${o} was closed after that turn.`;if(t.some((l)=>l.entry===null))return`Cannot restore: ${o} is shared live, and Restore cannot check its undo history. Undo it in the document instead.`;let{index:r,snapshots:i}=e.history,s=i.slice(r-t.length+1,r+1);if(r-t.length>=0&&t.every((l,c)=>s[c]===l.entry))return null;return i.indexOf(t.at(-1).entry)>r?`Cannot restore: that turn's change to ${o} was already undone.`:`Cannot restore: ${o} has edits made since that turn began, which Restore would undo too.`}function eM(e){let t=e.filter((l)=>l.ok),o=new Set(t.map((l)=>l.path)),r=e.length-t.length;if(o.size===0)return r>0?`${r} change${r===1?"":"s"} failed`:"";let i=`Changed ${o.size} file${o.size===1?"":"s"}`,s=new Set(t.flatMap((l)=>l.disk?[l.path]:[])),a=[i];if(s.size>0)a.push(`${s.size} written to disk — undo cannot reach ${s.size===1?"it":"them"}`);if(r>0)a.push(`${r} failed`);return a.join(" · ")}function x1(){B.splice(0)}function tM(e,t){let o=null;for(let r=e.length-1;r>=0;r--){let i=e[r];if(i.id===t)return o;let s=i.role==="assistant"&&(i.content||(i.toolCalls?.length??0)>0);if(o===null&&s)o=i.id}return t===void 0?o:null}function eg(e){let t=new Set,o=new Set;return Fy(e,(r,i)=>{t.add(r),o.add(JSON.stringify(i))}),t.size===0?null:{fingerprints:o,pointers:t}}function yP(e,t){if(!t)return e;return $e(e,"",t)}function $e(e,t,o){if(Array.isArray(e)){let i=null;for(let[s,a]of e.entries()){let l=$e(a,`${t}/${s}`,o);if(l!==a)i??=[...e],i[s]=l}return i??e}if(!f(e))return e;let r=null;for(let[i,s]of Object.entries(e)){let a=$e(s,`${t}/${JR(i)}`,o);if(i==="children"&&Array.isArray(a)&&a.length===1){let[l]=a;if(Ir(l)&&(o.pointers.has(t)||o.fingerprints.has(JSON.stringify(l))))a=l}if(a!==s)r??={...e},r[i]=a}return r??e}function Qt(){return da}function Kn(e,t=!1){return{activeMedia:null,activeSelector:null,openPopover:null,openDialog:null,canvasMode:e,editZoom:1,editingFormula:null,editingFunction:null,featureToggles:{},inspectorSections:{},pendingInlineEdit:null,preview:t,previewColorScheme:"auto",previewLocale:null,previewParams:{},previewProps:null,rightTab:"page",elementTab:"properties",showLayout:!0,styleFilter:"",styleSections:{},dataRows:{},dataLimits:{},styleShorthands:{},zoom:1}}var Un=["edit","design","preview","source","stylebook","git-diff"];function $y({id:e,documentPath:t=null,fileHandle:o=null,document:r,frontmatter:i,sourceFormat:s=null,capabilities:a,openedFrom:l=null,preview:c=!1,layout:u=null,source:d=null,canvasMode:m}){let v=me(),j=eg(r),M=a?.modes??Gn(t,s),I=m??M.find((T)=>T!=="preview")??"edit",ue=M[0]==="preview",L={bareRepeaters:j,content:{frontmatter:i||{}},dirty:!1,document:r,handlersSource:null,layout:u,mode:zn(t,s),source:d,sourceFormat:s},de={index:0,snapshots:[{document:structuredClone(r),selection:[]}]},q={canvas:{refreshing:!1,error:null,livePreviews:null,pendingInlineEdit:null,scope:null,status:"idle"},clipboard:null,hover:null,openedFrom:l,selection:[],ui:Kn(I,ue)};return v.run(()=>({capabilities:{modes:M},doc:b(L),documentPath:t,fileHandle:o,history:b(de),id:e,pinned:!1,preview:c,scope:v,session:b(q)}))}function Gn(e,t){if(Ni(e))return["stylebook","tokens","source"];let o=zi(t)??fn(e);if(o)return o.studio?.modes??["edit","design","preview","source"];return Un}function zn(e,t){let o=zi(t)??fn(e);if(o)return o.studio?.documentMode?.default??"content";return"component"}function b1(e){return ia(e.session.ui.canvasMode)}function LR(e){let t=[];for(let o of e.capabilities.modes){if(o==="preview")continue;let r=ia(o);if(!t.includes(r))t.push(r)}return t}function vP(e,t){return e.capabilities.modes.find((o)=>o!=="preview"&&ia(o)===t)}function tg(e){e.scope.stop()}var Pt=new WeakMap,H=new Map;function xn(e){let t=le(e),o=Pt.get(t);if(!o)o=b({active:!1,attachError:"",peers:[],readOnly:!1,sourceCanonical:!1,status:"unavailable"}),Pt.set(t,o);return o}function wt(e){H.set(e,(H.get(e)??0)+1)}function Ct(e){let t=H.get(e)??0;if(t<=1)H.delete(e);else H.set(e,t-1)}function Ly(e){return H.has(e.replaceAll("\\","/"))}var Yn=8000,Zn=800,Xn=2500,Rt=null;function Qn(){return Rt??=(ce("57ang7ma"),import("./index-57ang7ma.js")),Rt}function Jt(){try{return p()}catch{return null}}var K=null;function SP(e){K=e}var Ne=null;function CP(e){Ne=e}var It=()=>{};function kP(e){It=e??(()=>{})}var _e=new WeakMap;function kt(e){return le(e)}function Ve(e,t){return e.frontmatterMap(t)}function eo(e){return e.synced}function E(e){return _e.get(kt(e))}function He(e){let t=kt(e),o=_e.get(t);if(!o)o={attaching:null,generation:0,optedOut:b({value:!1}),session:null,watcherInstalled:!1},_e.set(t,o);return o}var At=!1;function to(){if(At)return;At=!0,ft(no),ht(io),mt((e)=>{if(E(e)?.session?.synced&&xn(e).sourceCanonical)return It("Source editing in progress — structural edits are paused"),"source-canonical";return null})}function no(e,t,o){let r=E(e)?.session;if(!r||!r.synced)return;if(r.lastSeenRef=le(e.doc.document),o==="remote"){Te(r);return}if(r.canWrite)so(r,t),Te(r)}function io(e){let t=E(e)?.session;if(!t?.synced||t.batchOps===null)return;let{batchOps:o,batchNeedsDiff:r}=t;if(t.batchOps=null,t.batchNeedsDiff=!1,!t.canWrite)return;if(t.undoManager?.stopCapturing(),r)oe(t);else if(o.length>0)try{t.collab.applyDocOpsToY(t.handle.doc,o,t.collab.LOCAL_ORIGIN)}catch{oe(t)}t.undoManager?.stopCapturing()}function so(e,t){let o=t.docOps.map((r)=>r.forward);if(bt(e.tab)){if(e.batchOps??=[],o.length===0)e.batchNeedsDiff=!0;else e.batchOps.push(...o);return}if(o.length===0){oe(e);return}try{e.collab.applyDocOpsToY(e.handle.doc,o,e.collab.LOCAL_ORIGIN)}catch{oe(e)}}function oe(e){let{collab:t,handle:o,tab:r}=e,i=t.yDocToJson(o.doc),s=ro(le(r.doc.document)),a=t.diffDocs(i,s);if(a===null)t.replaceYStructure(o.doc,s,t.LOCAL_ORIGIN);else if(a.length>0)try{t.applyDocOpsToY(o.doc,a,t.LOCAL_ORIGIN)}catch{t.replaceYStructure(o.doc,s,t.LOCAL_ORIGIN)}}function Le(e){let t=e.collab.yDocToJson(e.handle.doc);X(e.tab,(o)=>{let r=o.doc.document;for(let i of Object.keys(r))if(!(i in t))delete r[i];Object.assign(r,t)},{origin:"remote",skipHistory:!0})}function ao(e){if(!e.canWrite)return!1;let{awareness:t}=e.handle,o=t.clientID;for(let[r,i]of t.getStates())if(i.canWrite!==!1&&r<o)o=r;return o===e.handle.awareness.clientID}function Te(e){if(!K||!ao(e))return;if(e.collab.canonicalOf(e.handle.doc)==="source")return;let t=Date.now();if(e.lastMirrorAt??=t,t-e.lastMirrorAt>=Xn){if(e.mirrorTimer)clearTimeout(e.mirrorTimer),e.mirrorTimer=null;e.lastMirrorAt=t,We(e);return}if(e.mirrorTimer)clearTimeout(e.mirrorTimer);e.mirrorTimer=setTimeout(()=>{e.mirrorTimer=null,e.lastMirrorAt=Date.now(),We(e)},Zn)}async function We(e){if(!K||!e.synced)return;try{let t=await K(e.tab);e.collab.updateSourceText(e.handle.doc,t,e.collab.MIRROR_ORIGIN)}catch{}}async function Dt(e){if(!Ne||!e.synced||!e.canWrite)return;let{collab:t,handle:o,tab:r}=e,i=t.canonicalRevOf(o.doc),s=t.sourceText(o.doc).toString(),a;try{a=await Ne(r,s)}catch{return}if(!eo(e)||t.canonicalRevOf(o.doc)!==i)return;let l=t.diffDocs(t.yDocToJson(o.doc),a.document);if(l===null)t.replaceYStructure(o.doc,a.document,t.MIRROR_ORIGIN);else if(l.length>0)try{t.applyDocOpsToY(o.doc,l,t.MIRROR_ORIGIN)}catch{t.replaceYStructure(o.doc,a.document,t.MIRROR_ORIGIN)}let c=Ve(t,o.doc),u=a.frontmatter??{};o.doc.transact(()=>{let d=[...c.keys()];for(let m of d)if(!(m in u))c.delete(m);for(let[m,v]of Object.entries(u))if(!t.deepEqual(c.get(m),v))c.set(m,v)},t.MIRROR_ORIGIN)}function EP(e){let t=E(e)?.session;if(!t?.synced)return null;let{collab:o,handle:r}=t,i=null,s=()=>i!==null&&t.sourceLockOwner===i;return{awareness:r.awareness,enter:async()=>{i={},t.sourceLockOwner=i;let a=r.awareness.getLocalState();if(a)r.awareness.setLocalState({...a,mode:"source"});if(!t.canWrite)return;let l=null;if(K)try{l=await K(e)}catch{l=null}if(!s())return;o.acquireSourceCanonical(r.doc,l??o.sourceText(r.doc).toString(),o.LOCAL_ORIGIN)},leave:()=>{if(!s()){i=null;return}i=null,t.sourceLockOwner=null;let a=r.awareness.getLocalState();if(a)r.awareness.setLocalState({...a,mode:"structure"});if(!t.canWrite)return;if(o.otherSourceEditors(r.awareness,t.path,r.awareness.clientID).filter((c)=>r.awareness.getStates().get(c)?.canWrite!==!1).length===0)Dt(t).then(()=>{o.releaseSourceCanonical(r.doc,o.LOCAL_ORIGIN)})},localOrigin:o.LOCAL_ORIGIN,readOnly:!t.canWrite,text:o.sourceText(r.doc)}}function ra(e){let t=xn(e);return t.active&&t.readOnly}async function RR(e){let t=E(e)?.session;if(!t?.synced||!t.canWrite)return!1;if(t.mirrorTimer)clearTimeout(t.mirrorTimer),t.mirrorTimer=null;return await We(t),await t.handle.flush(),!0}async function TP(){for(let e of Be)if(E(e)?.session?.synced)await RR(e)}var Be=new Set;function ie(e){if(!Jt()?.collab||!e.documentPath||Ni(e.documentPath))return;let o=He(e);if(o.watcherInstalled)return;o.watcherInstalled=!0,to(),Be.add(e),e.scope.run(()=>{te(()=>{if(o.optedOut.value)ve(e);else Ke(e)}),Os(()=>{Be.delete(e),ve(e)})})}function IR(e,t){let o=He(e);if(o.optedOut.value===!t)return;if(o.optedOut.value=!t,!o.watcherInstalled&&t)ie(e)}function NR(e){return E(e)?.optedOut.value!==!0}function jt(e){if(!E(e)?.watcherInstalled){ie(e);return}ve(e),Ke(e)}async function Ke(e){let t=He(e);if(t.session||t.attaching)return;let{documentPath:o}=e,r=Jt();if(!o||!r?.collab){xn(e).status="unavailable";return}let{generation:i}=t,s=xn(e);s.status="connecting",s.attachError="";let a=(async()=>{try{let[l,c]=await Promise.all([Qn(),r.collab(o)]);if(!c){s.status="detached";return}if(t.generation!==i){c.destroy();return}let u,d=new Promise((m,v)=>{u=setTimeout(()=>v(Error("collab-sync-timeout")),Yn)});try{await Promise.race([c.whenSynced,d])}finally{clearTimeout(u)}if(t.generation!==i){c.destroy();return}t.session=lo(e,o,l,c),s.active=!0,s.status="synced",s.readOnly=!t.session.canWrite,s.attachError="",wt(o)}catch(l){s.status="failed",s.active=!1,s.attachError=l instanceof Error?l.message:String(l),w.warn(`Live collaboration is not available for "${o}" — ${s.attachError}`,{key:`collab:${o}`,path:o,source:"Collaboration"})}finally{t.attaching=null}})();t.attaching=a,await a}function ve(e){let t=E(e);if(!t)return;t.generation+=1;let{session:o}=t;t.session=null;let r=xn(e);if(r.active=!1,r.status="detached",r.attachError="",r.peers=[],!o)return;if(Ct(o.path),o.mirrorTimer)clearTimeout(o.mirrorTimer);if(o.sourceParseTimer)clearTimeout(o.sourceParseTimer);for(let i of o.disposers)try{i()}catch{}Xd(e,null),e.history.snapshots=[{document:ro(le(e.doc.document)),selection:Oa(e.session.selection)}],e.history.index=0,o.undoManager?.destroy(),o.handle.destroy()}function lo(e,t,o,r){let i=r.identity(),s={applyingRemoteFrontmatter:!1,batchNeedsDiff:!1,batchOps:null,canWrite:i?i.permission!=="read":!0,collab:o,disposers:[],handle:r,lastSeenRef:le(e.doc.document),mirrorTimer:null,path:t,sourceLockOwner:null,sourceParseTimer:null,synced:!1,tab:e,undoManager:null};if(o.metaMap(r.doc).get("structureSeeded")===!0){let T=o.yDocToJson(r.doc),O=ro(le(e.doc.document));if(!o.deepEqual(T,O)){let k=o.diffDocs(O,T);if(k===null)s.synced=!0,Le(s),s.synced=!1;else if(k.length>0)je(e,k)}s.applyingRemoteFrontmatter=!0;let P=Ve(o,r.doc);for(let[k,F]of P.entries())e.doc.content.frontmatter[k]=F;s.applyingRemoteFrontmatter=!1}else if(s.canWrite)o.seedStructure(r.doc,ro(le(e.doc.document)),{frontmatter:ro(le(e.doc.content.frontmatter)),origin:o.SEED_ORIGIN,sourceFormat:e.doc.sourceFormat});s.lastSeenRef=le(e.doc.document),s.disposers.push(r.onDirty((T)=>{e.doc.dirty=T})),r.awareness.setLocalState({canWrite:s.canWrite,focusedPath:t,structuralSelection:null,user:i?{avatarUrl:i.avatarUrl,color:i.color,login:i.login,name:i.name}:{color:o.colorForKey(String(r.awareness.clientID)),login:`guest-${r.awareness.clientID%1000}`}});let l=new o.UndoManager([o.structureMap(r.doc),o.frontmatterMap(r.doc)],{trackedOrigins:new Set([o.LOCAL_ORIGIN])});s.undoManager=l;let c=({stackItem:T})=>{T.meta.set("selection",Oa(e.session.selection))},u=({stackItem:T})=>{let O=T.meta.get("selection");e.session.selection=Oa(O??[])};l.on("stack-item-added",c),l.on("stack-item-popped",u),s.disposers.push(()=>{l.off("stack-item-added",c),l.off("stack-item-popped",u)}),Xd(e,{canRedo:()=>l.canRedo(),canUndo:()=>l.canUndo(),redo:()=>{l.redo()},undo:()=>{l.undo()}});let d=o.structureMap(r.doc),m=(T,O)=>{if(O.origin===o.LOCAL_ORIGIN||!s.synced)return;let P=o.yEventsToDocOps(T);if(P===null){Le(s);return}if(P.length===0)return;try{je(e,P)}catch{Le(s)}};d.observeDeep(m),s.disposers.push(()=>d.unobserveDeep(m));let v=xn(e);v.sourceCanonical=o.canonicalOf(r.doc)==="source";let j=o.metaMap(r.doc),M=()=>{v.sourceCanonical=o.canonicalOf(r.doc)==="source"};j.observe(M),s.disposers.push(()=>j.unobserve(M));let I=o.sourceText(r.doc),ue=(T,O)=>{if(O.origin===o.MIRROR_ORIGIN||!s.synced)return;if(o.canonicalOf(r.doc)!=="source")return;if(!o.isSourceReconciler(r.awareness,s.path))return;if(s.sourceParseTimer)clearTimeout(s.sourceParseTimer);s.sourceParseTimer=setTimeout(()=>{s.sourceParseTimer=null,Dt(s)},600)};I.observe(ue),s.disposers.push(()=>I.unobserve(ue));let L=Ve(o,r.doc),de=(T,O)=>{if(O.origin===o.LOCAL_ORIGIN||!s.synced)return;s.applyingRemoteFrontmatter=!0;try{for(let[P,k]of T.changes.keys)if(k.action==="delete")delete e.doc.content.frontmatter[P];else e.doc.content.frontmatter[P]=L.get(P)}finally{s.applyingRemoteFrontmatter=!1}};L.observe(de),s.disposers.push(()=>L.unobserve(de)),e.scope.run(()=>{let T=JSON.stringify(e.doc.content.frontmatter);te(()=>{let O=JSON.stringify(e.doc.content.frontmatter);if(O===T)return;if(T=O,s.applyingRemoteFrontmatter||!s.synced||!s.canWrite)return;let P=JSON.parse(O);r.doc.transact(()=>{let k=[...L.keys()];for(let F of k)if(!(F in P))L.delete(F);for(let[F,ze]of Object.entries(P))if(!o.deepEqual(L.get(F),ze))L.set(F,ze)},o.LOCAL_ORIGIN),Te(s)}),te(()=>{let O=e.session.selection.length>0?Oa(e.session.selection):null,P=r.awareness.getLocalState();if(P)r.awareness.setLocalState({...P,structuralSelection:O})}),te(()=>{let O=le(e.doc.document);queueMicrotask(()=>{if(E(e)?.session!==s||!s.synced||!s.canWrite)return;let k=le(e.doc.document);if(k!==O||k===s.lastSeenRef)return;s.lastSeenRef=k,oe(s),Te(s)})})});let q=xn(e),fe=()=>{let T=[];for(let[O,P]of r.awareness.getStates())if(O!==r.awareness.clientID&&P.user)T.push({clientId:O,state:P});q.peers=T};return fe(),r.awareness.on("change",fe),s.disposers.push(()=>r.awareness.off("change",fe),r.onStatus((T)=>{if(T==="offline"||T==="connecting")q.status="offline";else if(s.synced)q.status="synced"}),r.onReset(()=>{ve(e),Ke(e)})),s.synced=!0,s}function D(e,t,o){return RangeError(`command "${e}" argument "${t}": ${o}`)}function uo(e){if(J(e))return"number";if(qe(e))return"boolean";return n(e)?"string":"object"}function A(e){if(e===void 0)return"missing";return n(e)?`"${e}"`:`${uo(e)} ${JSON.stringify(e)}`}function Mt(e){return Array.isArray(e)&&e.every((t)=>n(t)||J(t))}function St(e,t,o){let r=t[o];if(!n(r)||r==="")throw D(e,o,`expected a non-empty string, got ${A(r)}`);return r}function ti(e,t,o){if(t[o]===void 0)return;return St(e,t,o)}function $t(e,t,o){let r=t[o];if(!J(r)||!Number.isFinite(r))throw D(e,o,`expected a finite number, got ${A(r)}`);return r}function Et(e,t,o){let r=t[o];if(!J(r)||!Number.isInteger(r))throw D(e,o,`expected an integer, got ${A(r)}`);return r}function c_(e,t,o,r,i){let s=$t(e,t,o);if(s<r||s>i)throw D(e,o,`${s} is outside the supported range ${r}–${i}`);return s}function Bi(e,t,o){let r=t[o];if(!qe(r))throw D(e,o,`expected a boolean, got ${A(r)}`);return r}function qn(e,t,o,r){let i=t[o],s=n(i)?r.find((a)=>a===i):void 0;if(s===void 0)throw D(e,o,`${A(i)} is not declared — declared: ${r.join(", ")||"none"}`);return s}function y1(e,t,o){let r=t[o];if(!Mt(r))throw D(e,o,`expected an array of path segments (strings or numbers), got ${A(r)}`);return r}function $P(e,t,o){if(t[o]===null)return null;return y1(e,t,o)}function OR(e,t,o){let r=t[o];if(!Array.isArray(r))throw D(e,o,`expected an array of document paths, got ${A(r)}`);return r.map((i,s)=>{if(!Mt(i))throw D(e,o,`entry ${s} is not a document path — expected an array of segments, got ${A(i)}`);return i})}function Se(e,t=Object.keys(e)){return{additionalProperties:!1,properties:e,required:[...t],type:"object"}}function fi(e,t){return{description:t,enum:[...e],type:"string"}}function wl(e,t){return{description:t,get enum(){return[...e()]},type:"string"}}function AR(e,t={}){return{description:e,type:"number",...t}}function $r(e){return{description:e,type:"boolean"}}function d_(e,t=!1){let o={items:{type:["string","number"]},type:"array"};return t?{description:e,oneOf:[o,{type:"null"}]}:{description:e,...o}}function LP(e){return{description:e,items:{items:{type:["string","number"]},type:"array"},type:"array"}}function Fe(e){return{description:e,type:"string"}}function fo(e){return e.length===2&&e.includes("string")&&e.includes("number")}function Ue(e){return n(e)?[e]:e}function Lt(e){let t=e;if("enum"in t)return"enum";if("const"in t)return"const";if(Array.isArray(t.oneOf))return"one-of";if(Array.isArray(t.type))return"typed";switch(t.type){case"boolean":return"boolean";case"number":case"integer":{if(t.minimum!==void 0&&t.maximum!==void 0)return"bounded-number";return t.type==="integer"?"integer":"number"}case"string":return"string";case"array":{let o=t.items?.type;if(Array.isArray(o))return fo(o)?"path":"pass-through";return o==="array"?"path-list":"pass-through"}case"null":case"object":return"typed";default:break}return"pass-through"}function Nt(e,t){switch(e){case"null":return t===null;case"boolean":return qe(t);case"string":return n(t);case"number":return J(t)&&Number.isFinite(t);case"integer":return J(t)&&Number.isInteger(t);case"array":return Array.isArray(t);case"object":return S(t)&&!Array.isArray(t);default:break}return!1}function _t(e){if(e.length<=1)return e.join("");return`${e.slice(0,-1).join(", ")} or ${e.at(-1)}`}function po(e,t,o,r){let i=t[o];if(i===void 0||!r.some((s)=>Nt(s,i)))throw D(e,o,`expected ${_t(r)}, got ${A(i)}`);return i}function Vt(e){switch(Lt(e)){case"enum":return`one of ${(e.enum??[]).map((t)=>A(t)).join(" | ")}`;case"const":return`the constant ${A(e.const)}`;case"one-of":return(e.oneOf??[]).map((t)=>Vt(t)).join(" or ");case"typed":return _t(Ue(e.type??[]));case"boolean":return"a boolean";case"bounded-number":return`a number from ${e.minimum} to ${e.maximum}`;case"number":return"a finite number";case"integer":return"an integer";case"string":return"a non-empty string";case"path":return"a document path";case"path-list":return"a list of document paths";default:return"anything"}}function mo(e,t,o,r){let i=t[o],s=[];for(let a of r){if(a.type!==void 0&&!Ue(a.type).some((l)=>Nt(l,i)))continue;try{return Bt(e,t,o,a)}catch(l){s.push(l)}}if(s.length===1)throw s[0];throw D(e,o,`expected ${r.map((a)=>Vt(a)).join(" or ")}, got ${A(i)}`)}function Bt(e,t,o,r){switch(Lt(r)){case"enum":return qn(e,t,o,r.enum??[]);case"const":{let i=t[o];if(i!==r.const)throw D(e,o,`expected the constant ${A(r.const)}, got ${A(i)}`);return i}case"one-of":return mo(e,t,o,r.oneOf??[]);case"typed":return po(e,t,o,Ue(r.type??[]));case"boolean":return Bi(e,t,o);case"bounded-number":{if(r.type==="integer")Et(e,t,o);return c_(e,t,o,r.minimum,r.maximum)}case"number":return $t(e,t,o);case"integer":return Et(e,t,o);case"string":return St(e,t,o);case"path":return y1(e,t,o);case"path-list":return OR(e,t,o);default:return t[o]}}function RP(e,t,o){let r=t,i=r.properties??{},s=Object.keys(i),a=r.required??[],l={};for(let[c,u]of Object.entries(o)){if(u===void 0||Object.hasOwn(i,c))continue;if(r.additionalProperties===!1)throw D(e,c,`not declared — declared: ${s.join(", ")||"none"}`);l[c]=u}for(let c of s){if(o[c]===void 0&&!a.includes(c))continue;l[c]=Bt(e,o,c,i[c])}return l}var go=20,mi="primary",og="secondary",FR=2,g=b({activePaneId:mi,clipboard:null,closedTabs:[],componentRegistry:[],mruOrder:[],fileTree:{dirs:new Map,expanded:new Set,searchQuery:"",selectedPath:null},panes:[{activeTabId:null,derived:null,id:mi,tabOrder:[]}],projectConfig:null,projectRoot:null,styleClipboard:null,tabs:new Map,ui:{activityBar:"files"},get activeTabId(){let e=Yo();return e.derived?.kind==="lens"?pn(e.derived.sourcePaneId)?.activeTabId??null:e.activeTabId},get tabOrder(){return Yo().tabOrder}}),h=Fh(()=>g.activeTabId?g.tabs.get(g.activeTabId)??null:null);function Yo(){let{panes:e}=g;return e.find((t)=>t.id===g.activePaneId)??e[0]}function pn(e){return g.panes.find((t)=>t.id===e)}function Pa(e){return g.panes.find((t)=>t.tabOrder.includes(e))}function ko(e){let t=pn(e);if(!t||t.id===g.activePaneId)return;g.activePaneId=t.id,_();let{activeTabId:o}=t;if(o){Ge(o);let r=g.tabs.get(o);if(r)zt(r)}}function sg(e){return g.activePaneId===e}function _1(e){let t=e??Yo().activeTabId,o=t?g.tabs.get(t):null;if(!t||!o)return null;let r=Pa(t);if(!r)return null;let i=lc(r.id);return cg(t),kh(i,t),i.activeTabId=t,g.activePaneId=i.id,_(),Ge(t),i}function S1(e){return g.panes.find((t)=>t.id!==e)??yo(og)}function lc(e){let t=S1(e);if(t.derived)t.derived=null;return t}function yo(e){let t=pn(e);if(t)return t;return g.panes=[...g.panes,{activeTabId:null,derived:null,id:e,tabOrder:[]}],pn(e)}function ag(e){if(g.panes.length<2)return;let t=e===mi?g.panes.find((s)=>s.id!==mi)?.id:e,o=t===void 0?void 0:pn(t),r=g.panes.find((s)=>s.id!==t);if(!o||!r)return;for(let s of o.tabOrder)kh(r,s);let i=o.activeTabId!==null&&U(o.activeTabId)?o.activeTabId:null;if(r.activeTabId=g.activePaneId===o.id?i??r.activeTabId??o.activeTabId:r.activeTabId??o.activeTabId,g.activePaneId=r.id,r.derived?.sourcePaneId===o.id)r.derived=null;g.panes=g.panes.filter((s)=>s.id!==o.id),_()}function lg(e){return e.tabOrder.length===0&&e.derived===null}var U=()=>!0;function C1(e){U=e??(()=>!0)}var Ut=null;function k1(e){Ut=e}var qt=null;function E1(e){qt=e}function ho(){let e=0;for(let t of g.tabs.keys())if(U(t))e+=1;return e}function Gt(e){return e.tabOrder.findLast((t)=>U(t))??null}function cg(e){let t=[];for(let o of g.panes){if(!o.tabOrder.includes(e))continue;if(o.tabOrder=o.tabOrder.filter((r)=>r!==e),o.activeTabId===e)o.activeTabId=Gt(o);if(o.id!==mi&&lg(o))t.push(o.id)}for(let o of t)ag(o)}function kh(e,t,o){if(e.tabOrder.includes(t))return;let r=o??xo(e,t);e.tabOrder=[...e.tabOrder.slice(0,r),t,...e.tabOrder.slice(r)]}function bo(e){let t=0;for(let o of e.tabOrder){if(g.tabs.get(o)?.pinned!==!0)break;t+=1}return t}function xo(e,t){return g.tabs.get(t)?.pinned===!0?bo(e):e.tabOrder.length}function cc(e,t=null){if(g.projectRoot&&e!==g.projectRoot)x1();g.projectRoot=e,g.projectConfig=t}function Qp(e){let t=h.value;return e!==null&&t!==null&&le(t)===le(e)}function xl(e){if(!e)return!1;let t=g.tabs.get(e.id);return t!==void 0&&le(t)===le(e)}function Ge(e){g.mruOrder=[e,...g.mruOrder.filter((t)=>t!==e)]}var Oe=null,se=0;function _(){Oe=null,se=0}function zt(e){if(x&&e.documentPath)x.selectedPath=e.documentPath}function T1(e){let t=pn(e);if(t)t.activeTabId=null}function ae(e,t={}){let o=g.tabs.get(e),r=Pa(e);if(!o||!r)return;if(r.activeTabId=e,t.focus===!1)return;if(g.activePaneId=r.id,!t.cycling)_(),Ge(e);zt(o)}function Si(e){if(e.background===!0){let a=g.tabs.get(e.id);if(a)return a;let l=$y({...e,preview:!1}),c=(e.paneId===void 0?void 0:pn(e.paneId))??Yo();return kh(c,l.id),g.tabs.set(l.id,l),l}let t=g.tabs.get(e.id),o=e.preview===!0&&t?.pinned!==!0,r=$y({...e,preview:o}),i=(e.paneId===void 0?void 0:pn(e.paneId))??Yo(),s;if(t)r.pinned=t.pinned,tg(t);else{if(o){let l=Ht(i),c=l?g.tabs.get(l):null;if(c)iu(c);$1()}let a=o?Ht(i):null;if(a)s=i.tabOrder.indexOf(a),tu(a);kh(i,r.id,s)}return g.tabs.set(r.id,r),ae(r.id,{focus:e.focus!==!1}),ie(r),r}function Ht(e){return e.tabOrder.find((t)=>g.tabs.get(t)?.preview===!0)??null}function id(e){let t=g.tabs.get(e);if(t?.preview===!0)t.preview=!1}function $1(){for(let[e,t]of g.tabs)if(t.preview&&(t.doc.dirty||Dy(t)))id(e)}var Yt=null;function jR(e){Yt=e}function Dy(e){return Yt?.(e)??!1}function b_(e,t){let o=g.tabs.get(e),r=Pa(e);if(!o||!r)return;if(o.pinned=t,t)o.preview=!1;let i=r.tabOrder.filter((a)=>a!==e),s=i.filter((a)=>g.tabs.get(a)?.pinned===!0).length;r.tabOrder=[...i.slice(0,s),e,...i.slice(s)]}function HR(e,t){let o=g.tabs.get(e),r=Pa(e);if(!o||!r)return;r.tabOrder=Zt(r,e,t)}function Zt(e,t,o){let r=g.tabs.get(t);if(!r)return e.tabOrder;let i=e.tabOrder.filter((u)=>u!==t),s=i.filter((u)=>g.tabs.get(u)?.pinned===!0).length,a=r.pinned?0:s,l=r.pinned?s:i.length,c=Math.min(Math.max(o,a),l);return[...i.slice(0,c),t,...i.slice(c)]}function tu(e){let t=g.tabs.get(e);if(!t)return;let o=Pa(e),r=o?.activeTabId===e;if(To(t),tg(t),g.tabs.delete(e),n_(e),cg(e),g.mruOrder=g.mruOrder.filter((l)=>l!==e),_(),o&&lg(o))ag(o.id);if(!r)return;let i=Yo(),s=qt?.(i.id)??null,a=(s!==null&&i.tabOrder.includes(s)?s:null)??g.mruOrder.find((l)=>i.tabOrder.includes(l)&&U(l))??Gt(i);if(a)ae(a);else Ut?.(i.id)}function BR(){let e=[...g.tabs.values()];g.tabs.clear(),Xt(),g.mruOrder=[],_();for(let t of e)tg(t)}function Xt(){g.panes=[{activeTabId:null,derived:null,id:mi,tabOrder:[]}],g.activePaneId=mi}function To(e){if(!e.documentPath)return;let t=e.documentPath;g.closedTabs=[{documentPath:t},...g.closedTabs.filter((o)=>o.documentPath!==t)].slice(0,go)}function vo(){let[e]=g.closedTabs;if(!e)return;return g.closedTabs=g.closedTabs.slice(1),e.documentPath}function Kt(e){if(!Oe)Oe=g.mruOrder.filter((r)=>g.tabs.has(r)&&U(r)),se=0;let t=Oe;if(t.length<2)return;se=((se+e)%t.length+t.length)%t.length;let o=t[se];return ae(o,{cycling:!0}),o}function VR(e){let t=[...g.tabs.keys()],o=[...g.tabs.values()],r=$y(e);g.tabs.set(r.id,r),Xt(),g.panes[0].tabOrder=[r.id],g.mruOrder=[],_(),ae(r.id),ie(r);for(let i of t){if(i===r.id)continue;g.tabs.delete(i)}for(let i of o)tg(i);return r}function Ft(e,t={}){ae(e,t)}function Oy(e,t,o){let r=pn(t);if(!r||!g.tabs.has(e))return null;if(r.tabOrder.includes(e)){if(o!==void 0)r.tabOrder=Zt(r,e,o);return r}return cg(e),kh(r,e,o),r}function WR(e,t,o){let r=g.tabs.get(e);if(!r)return;if(r.id=t,r.documentPath=o,g1(e))n_(e),Qm(t);g.tabs.delete(e),g.tabs.set(t,r);for(let i of g.panes)if(i.tabOrder=i.tabOrder.map((s)=>s===e?t:s),i.activeTabId===e)i.activeTabId=t;g.mruOrder=g.mruOrder.map((i)=>i===e?t:i),_(),jt(r)}function zR(e,t){e.registerAll([...Oo(t),...Po(t)])}function Oo(e){let t=()=>ho()>1;return[{id:"document.nextTab",title:"Next Tab",category:"Document",level:"document",keybinding:["ctrl+tab","mod+tab"],menus:["palette"],group:"2_navigate",when:(o)=>o.document.open,enablement:t,requires:"a second open document in this workspace",run:()=>{Kt(1)}},{id:"document.previousTab",title:"Previous Tab",category:"Document",level:"document",keybinding:["ctrl+shift+tab","mod+shift+tab"],menus:["palette"],group:"2_navigate",when:(o)=>o.document.open,enablement:t,requires:"a second open document in this workspace",run:()=>{Kt(-1)}},{args:Se({path:Fe('Project-relative path of the file to open, e.g. "pages/about.json" or "components/nav-bar.json". It must exist.')}),id:"document.open",title:"Open Document",category:"Document",level:"project",menus:["palette"],group:"1_file",when:(o)=>o.project.open,requires:"an open project",aiTool:{description:"Open a project file as the active document; the document tools then operate on it. Use it when the user should SEE the page, or for iterative visual refinement after creating a page or component.",name:"open_document",report:({after:o,args:r})=>{let i=St("document.open",r,"path"),s=h.value?.documentPath??null;if(s!==i)return`Opened "${i}", but the active document is ${s===null?"none":`"${s}"`}.`;let a=o.editor.kind==="canvas"?"on the canvas; the document tools now operate on it":`in the ${Yp[o.editor.kind]} editor, which is not an element tree the document tools can edit`;return`"${i}" is the active document, ${a}.`}},run:async(o,r)=>{let i=St("document.open",r,"path");if(await e.openFile(i),![...g.tabs.values()].some((s)=>s.documentPath===i))throw RangeError(`command "document.open" argument "path": "${i}" could not be opened — it does `+"not exist, or no editor claims its format. Problems has the reason.")}},{args:Se({file:Fe('Project-relative path of the file to open in the other pane, e.g. "pages/about.json". It must exist.')}),id:"document.openToSide",title:"Open to the Side",category:"Document",level:"project",menus:["context/file","palette"],group:"1_file",when:(o)=>o.project.open,requires:"an open project",undo:"none",run:async(o,r)=>{let i=St("document.openToSide",r,"file"),s=lc(Yo().id);if(await e.openFile(i,{paneId:s.id}),![...g.tabs.values()].some((a)=>a.documentPath===i)){if(lg(s)&&s.id!==mi)ag(s.id);throw RangeError(`command "document.openToSide" argument "file": "${i}" could not be opened — it `+"does not exist, or no editor claims its format. Problems has the reason.")}}},{id:"document.reopenClosed",title:"Reopen Closed Document",category:"Document",level:"document",keybinding:"mod+shift+t",menus:["context/tab","palette"],group:"1_file",enablement:()=>g.closedTabs.length>0,requires:"a document closed in this session",run:async()=>{let o=vo();if(o)await e.openFile(o)}},{id:"document.togglePinned",title:"Pin / Unpin Document",category:"Document",level:"document",menus:["context/tab","palette"],group:"1_file",when:(o)=>o.document.open,requires:"an open document",run:()=>{let o=g.activeTabId,r=o?g.tabs.get(o):null;if(o&&r)b_(o,!r.pinned)}},{args:Se({pinned:$r("True to pin the active document's tab, false to unpin it.")}),id:"document.setPinned",title:"Set Document Pinned",category:"Document",level:"document",menus:["palette"],group:"1_file",when:(o)=>o.document.open,requires:"an open document",run:(o,r)=>{let i=g.activeTabId;if(i&&g.tabs.get(i))b_(i,Bi("document.setPinned",r,"pinned"))}},{id:"document.keepOpen",title:"Keep Document Open",category:"Document",level:"document",menus:["context/tab","palette"],group:"1_file",when:(o)=>o.document.open,enablement:()=>{let o=g.activeTabId;return o!==null&&g.tabs.get(o)?.preview===!0},requires:"a preview document — one opened by a single click",run:()=>{let o=g.activeTabId;if(o)id(o)}}]}function Po(e){let t=()=>g.panes.length>1;return[{id:"pane.splitRight",title:"Split Right",category:"View",level:"document",keybinding:"mod+\\",menus:["context/pane","context/tab","palette"],group:"5_pane",when:(o)=>o.document.open,enablement:()=>g.activeTabId!==null,requires:"an open document",undo:"none",run:()=>{_1()}},{args:Se({path:Fe("Project-relative path of the document to open beside this one.")}),id:"pane.compareWith",title:"Compare With…",category:"View",level:"document",menus:["context/pane","context/tab","palette"],group:"5_pane",when:(o)=>o.document.open,enablement:()=>g.activeTabId!==null,requires:"an open document",undo:"none",run:async(o,r)=>{let i=St("pane.compareWith",r,"path"),s=Yo();if((s.activeTabId?g.tabs.get(s.activeTabId):null)?.documentPath===i)throw RangeError(`command "pane.compareWith" argument "path": "${i}" is the document this pane is `+"already showing — name a different one");await e.openFileInPane(lc(s.id).id,i)}},{id:"pane.focusPrimary",title:"Focus Primary Pane",category:"View",level:"document",keybinding:"mod+0",menus:["palette"],group:"5_pane",enablement:t,requires:"a split pane grid",undo:"none",run:()=>{ko(mi)}},{id:"pane.focusSecondary",title:"Focus Side Pane",category:"View",level:"document",keybinding:"mod+alt+0",menus:["palette"],group:"5_pane",enablement:t,requires:"a split pane grid",undo:"none",run:()=>{ko(og)}},{id:"pane.unsplit",title:"Close Side Pane",category:"View",level:"document",menus:["context/pane","palette"],group:"5_pane",enablement:t,requires:"a second pane",undo:"none",run:So}]}function So(){let e=g.panes.find((t)=>t.derived!==null);if(e?.id===mi){if(e.derived=null,!lg(e))return}ag(e?.id??og)}
2
+ export{p1,jn,Yx,Sy,Wt,ln,br,Zx,Cy,td,fP,f1,Kp,Xx,ER,vh,Qx,Gp,Da,vl,ky,Yp,ia,mP,e_,wh,t_,Ey,m1,gP,Qm,n_,g1,TR,Ty,Hn,Ko,i_,xh,r_,bP,o_,$R,eg,yP,Qt,$y,b1,LR,vP,tg,xn,Ly,Pe,wP,s_,Oa,a_,xP,_P,ng,SP,CP,kP,EP,ra,RR,TP,IR,NR,DR,l_,Ry,Iy,St,ti,c_,Bi,qn,y1,$P,OR,Se,fi,wl,AR,$r,d_,LP,Fe,RP,IP,Vi,Yd,Jn,nd,u_,h_,v1,NP,Aa,_h,Sh,Ny,p_,DP,ro,X,Zd,OP,AP,PR,PP,Xd,MP,FP,w1,jP,oo,Ch,MR,ig,f_,HP,Zp,Xe,rg,Co,BP,m_,VP,g_,WP,zP,Qd,UP,Go,qP,Xp,JP,KP,GP,eu,YP,ZP,XP,QP,eM,x1,tM,mi,og,FR,g,h,Yo,pn,Pa,ko,sg,_1,S1,lc,ag,lg,C1,k1,E1,cg,kh,cc,Qp,xl,T1,Si,id,$1,jR,Dy,b_,HR,tu,BR,VR,Ft,Oy,WR,zR};
3
+
4
+ //# debugId=CEF9503BF9D5E82C64756E2164756E21
5
+ //# sourceMappingURL=studio-ybkd5w8k.js.map
@@ -1,5 +1,5 @@
1
- import{ft,io}from"./studio-5tet77de.js";import{Jt,Ut,Nh}from"./studio-nzemfbkk.js";import{iu,w,$h}from"./studio-sce30r7b.js";import{ae}from"./studio-wqfaqw4m.js";import{X}from"./studio-9c6cbq2c.js";import{Ve,vt,E,R}from"./studio-9dq7rwc7.js";import{me,te,g}from"./studio-3qr08sxq.js";import{n,Q}from"./studio-k3we3kqb.js";var B={$schema:"https://jxsuite.com/schema/v1",$id:"StudioDialog",$description:"Studio's confirm, save-or-discard and prompt dialogs: one jx-dialog whose body is projected from the adapter's scope. `message` is a sentence; `choice` is a `jx-select` over the options; `field` is the prompt's jx-textfield with its refusal. The four answers call the host's functions, and the host decides when the dialog closes.",tagName:"jx-dialog",$props:{headline:{$ref:"#/state/headline"},confirmLabel:{$ref:"#/state/confirmLabel"},secondaryLabel:{$ref:"#/state/secondaryLabel"},cancelLabel:{$ref:"#/state/cancelLabel"},destructive:{$ref:"#/state/destructive"},size:{$ref:"#/state/size"}},attributes:{headline:"${state.headline}","confirm-label":"${state.confirmLabel || null}","secondary-label":"${state.secondaryLabel || null}","cancel-label":"${state.cancelLabel || null}",part:"dialog-host"},onconfirm:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/confirm"},value:[]}]},onsecondary:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/secondary"},value:[]}]},oncancel:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/cancel"},value:[]}]},onclose:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/closed"},value:[]}]},style:{'& [part="message"]':{$description:"The one part of a dialog that is text rather than interface, so it opts back in to selection. The root sets `user-select: none` and `styles/tokens.json` restates it on every `dialog`, so the headline, the labels and the buttons around this sentence stay unselectable; a message is often the thing a reader copies into a search or a bug report.",margin:"0 0 var(--jx-space-3)",userSelect:"text"},'& [part="message"]:last-child':{margin:"0"},'& [part="island"] > p, & [part="island"] > span, & [part="island"] > strong, & [part="island"] > em, & [part="island"] > code':{$description:"The island's own prose is the message's other form — a body richer than a sentence, written straight into the island from a lit template (studio-ui-guidelines.md §9.4) — so it is selectable for the same reason `[part=\"message\"]` is. The opt-in stops at those children because the island is ALSO the mount point for a whole document: the Open Grid picker and Push Schema's plan put their surfaces here, and `user-select` inherits, so a rule on the island itself would hand selection to every heading, source row and button they draw, which is the interface the policy exists to keep unselectable. A mounted surface roots a `div`; a message writes paragraphs and text-level spans, so the two forms are told apart by the child that arrives.",userSelect:"text"},'& [part="island"]:empty':{display:"none"},'& [part="message-slot"], & [part="choice-slot"], & [part="field-slot"]':{display:"contents"},'& [part="choice-row"]':{display:"flex",flexDirection:"column",gap:"var(--jx-space-1)",margin:"0 0 var(--jx-space-3)"},'& [part="choice-label"]':{fontSize:"var(--jx-text-sm)",color:"var(--jx-fg-dim)"},"& jx-textfield":{width:"100%"}},children:[{tagName:"div",attributes:{part:"message-slot",role:"none"},$switch:{$ref:"#/state/hasMessage"},cases:{true:{tagName:"p",attributes:{part:"message"},textContent:"${state.message}"}}},{tagName:"div",attributes:{part:"island"}},{tagName:"div",attributes:{part:"choice-slot",role:"none"},$switch:{$ref:"#/state/hasChoice"},cases:{true:{tagName:"div",attributes:{part:"choice-row"},children:[{tagName:"span",attributes:{part:"choice-label"},textContent:"${state.choiceLabel}"},{tagName:"jx-select",$props:{label:{$ref:"#/state/choiceLabel"},options:{$ref:"#/state/options"},value:{$ref:"#/state/chosen"}},attributes:{part:"choice"},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/pick"},value:[{$ref:"event#/target/value"}]}]}}]}}},{tagName:"div",attributes:{part:"field-slot",role:"none"},$switch:{$ref:"#/state/hasField"},cases:{true:{tagName:"jx-textfield",$props:{label:{$ref:"#/state/headline"},value:{$ref:"#/state/value"},placeholder:{$ref:"#/state/placeholder"},invalid:{$ref:"#/state/invalid"},error:{$ref:"#/state/error"},multiline:{$ref:"#/state/multiline"},rows:{$ref:"#/state/rows"},mono:{$ref:"#/state/mono"}},attributes:{part:"field"},oninput:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/input"},value:[{$ref:"event#/target/value"}]}]},onkeydown:{$prototype:"Function",body:[{$switch:{$ref:"#/state/singleLine"},cases:{true:[{$switch:{$ref:"event#/key"},cases:{Enter:[{preventDefault:!0},{operator:"call",target:{$ref:"#/state/confirm"},value:[]}]}}]}}]},$description:"The prompt's one field. `multiline` is what makes it a paste box rather than a line: an import the author copied out of a `_redirects` file is column-aligned, so it also asks for `mono`. A multiline field takes Enter as a newline, which is why the Enter-confirms handler below is guarded on it — a paste box whose second line submits the dialog cannot be typed into."}}}]};E("dialog",B);function sn(e){if(e.querySelector('[part="dialog"]'))return Promise.resolve(e);return new Promise((t)=>{e.addEventListener("jx-ready",function o(r){if(r.target!==e&&!e.querySelector('[part="dialog"]'))return;e.removeEventListener("jx-ready",o),t(e)})})}function Zs(e){let t=document.createElement("div");t.style.pointerEvents="auto",t.setAttribute(Ve,vt("dialog",e.region)),e.layer.append(t);let o=g({cancel:()=>{e.onCancel()},cancelLabel:e.cancelLabel,choiceLabel:e.choice?.label??"",chosen:e.choice?.chosen??"",closed:()=>{e.onClosed()},confirm:()=>{e.onConfirm()},confirmLabel:e.confirmLabel,destructive:e.destructive===!0,error:"",hasChoice:e.choice!==void 0,hasField:e.field!==void 0,mono:e.field?.mono===!0,multiline:e.field?.multiline===!0,rows:e.field?.rows??"3",singleLine:e.field!==void 0&&e.field.multiline!==!0?"true":"false",hasMessage:e.message!==void 0&&e.message!=="",headline:e.headline,input:(a)=>{o.value=a,e.onInput?.(a)},invalid:!1,message:e.message??"",options:e.choice?.options??[],pick:(a)=>{e.onPick?.(a)},placeholder:e.field?.placeholder??"",secondary:()=>{e.onSecondary?.()},secondaryLabel:e.secondaryLabel??"",size:e.size??"sm",value:e.field?.value??""}),r=null,i=!1,s=()=>i,l=()=>{},m=new Promise((a)=>{l=a}),p=R("dialog",o,t).then(async(a)=>{let d=a.root;if(s())return a.dispose(),d;if(r=a,await Promise.race([sn(d),m]),s())return d;if(e.island?.(d.querySelector('[part="island"]')??d),Jt(d),e.field){let x=d.querySelector("jx-textfield");if(x)setTimeout(()=>{if(!i)Nh(x,e.field?.select??"all")},0)}return d});return{close(){if(i)return;i=!0,l();let a=r?.root;if(a instanceof HTMLElement)Ut(a);r?.dispose(),r=null,t.remove()},host:t,ready:p,update(a){if(a.confirmLabel!==void 0)o.confirmLabel=a.confirmLabel;if(a.cancelLabel!==void 0)o.cancelLabel=a.cancelLabel;if(a.secondaryLabel!==void 0)o.secondaryLabel=a.secondaryLabel;if(a.message!==void 0)o.message=a.message,o.hasMessage=a.message!=="";if(a.value!==void 0)o.value=a.value;if(a.placeholder!==void 0)o.placeholder=a.placeholder;if(a.invalid!==void 0)o.invalid=a.invalid;if(a.error!==void 0)if(a.error!==""&&a.error===o.error){o.error="";let d=a.error;queueMicrotask(()=>{o.error=d})}else o.error=a.error;if(a.options!==void 0)o.options=a.options;if(a.chosen!==void 0)o.chosen=a.chosen}}}var G={$schema:"https://jxsuite.com/schema/v1",$id:"StudioToasts",$description:"The toast stack: a rendering of the notification service's toasts, newest last. Each row is projected by ui/layers.ts with its severity glyph and, where a recovery command exists, that command's title and gate; the two buttons call back into the host, which owns the records and their timers.",tagName:"div",attributes:{part:"stack"},style:{position:"absolute",right:"var(--jx-space-4)",bottom:"36px",display:"flex",flexDirection:"column",gap:"var(--jx-space-3)",alignItems:"flex-end",maxWidth:"min(420px, calc(100vw - 24px))",'& [part="toast"]':{display:"flex",alignItems:"center",gap:"var(--jx-space-3)",pointerEvents:"auto",padding:"var(--jx-space-3)",border:"1px solid var(--jx-border)",borderLeft:"3px solid var(--jx-fg-dim)",borderRadius:"var(--jx-radius-md)",background:"var(--jx-bg-panel)",color:"var(--jx-fg)",fontSize:"var(--jx-text-sm)",lineHeight:"var(--jx-leading-sm)",boxShadow:"var(--jx-shadow-popover)"},'& [part="toast"][data-severity="success"]':{borderLeftColor:"var(--jx-success)"},'& [part="toast"][data-severity="info"]':{borderLeftColor:"var(--jx-accent)"},'& [part="toast"][data-severity="warn"]':{borderLeftColor:"var(--jx-warning)"},'& [part="toast"][data-severity="error"]':{borderLeftColor:"var(--jx-danger)"},'& [part="icon"]':{flex:"none",width:"14px",textAlign:"center",fontWeight:"700"},'& [data-severity="success"] [part="icon"]':{color:"var(--jx-success)"},'& [data-severity="info"] [part="icon"]':{color:"var(--jx-accent)"},'& [data-severity="warn"] [part="icon"]':{color:"var(--jx-warning)"},'& [data-severity="error"] [part="icon"]':{color:"var(--jx-danger)"},'& [part="message"]':{flex:"1",minWidth:"0",overflow:"hidden",display:"-webkit-box",WebkitBoxOrient:"vertical",WebkitLineClamp:"3"},'& [part="action-slot"]':{display:"contents"},'& [part="action"] > [part="control"]':{color:"var(--jx-accent)"}},children:[{$prototype:"Array",items:{$ref:"#/state/toasts"},key:{$ref:"$map/item/id"},map:{tagName:"div",attributes:{part:"toast","data-severity":"${$map.item.severity}"},children:[{tagName:"span",attributes:{part:"icon","aria-hidden":"true"},textContent:"${$map.item.icon}"},{tagName:"span",attributes:{part:"message"},textContent:"${$map.item.message}"},{tagName:"span",attributes:{part:"action-slot",role:"none"},$switch:{$ref:"$map/item/hasAction"},cases:{true:{tagName:"jx-button",$props:{size:"sm",quiet:!0,disabled:{$ref:"$map/item/actionDisabled"}},attributes:{part:"action",title:"${$map.item.actionTitle}"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/runAction"},value:[{$ref:"$map/item/id"}]}]},children:[{tagName:"span",textContent:"${$map.item.actionLabel}"}]}}},{tagName:"jx-action-button",$props:{label:"Dismiss notification",hint:"Dismiss notification",icon:"x",size:"sm"},attributes:{part:"dismiss"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/dismissToast"},value:[{$ref:"$map/item/id"}]}]}}]}}]};function re(e){return e instanceof RangeError||e instanceof Error&&e.name==="CommandUnavailableError"}function Tn(e,t,o,r=t){let i=(l)=>{if(!re(l))console.error(`${r}: command "${t}" failed`,l);w.error(X(l),{key:`command.run:${t}`,source:r})},s;try{s=e.run(t,o)}catch(l){return i(l),Promise.resolve()}return Promise.resolve(s).catch(i)}function nt(e,t,o){let r=ae();return r?Tn(r,e,t,o):Promise.resolve()}var Y=null,_=null,q=null,C=null;function dt(e){return(e==="popover"?Y:e==="modal"?_:e==="toast"?C:q)??document.body}function Z$(){Y=document.querySelector("#layer-popover"),_=document.querySelector("#layer-modal"),q=document.querySelector("#layer-dialog"),C=document.querySelector("#layer-toast"),ue()}var U="jx-dialog[data-open], dialog[open]";function sv(){return Boolean(q?.querySelector(U)||_?.querySelector(U))}function X$(){return document.querySelector(":popover-open")!==null}function qo(e,t,o={}){let{confirmLabel:r="Confirm",cancelLabel:i="Cancel",destructive:s=!1}=o;return new Promise((l)=>{let m=!1,c=(a)=>{if(m)return;m=!0,p.close(),l(a)},p=Zs({cancelLabel:i,confirmLabel:r,destructive:s,headline:e,layer:dt("dialog"),...z(t),onCancel:()=>c(!1),onClosed:()=>c(!1),onConfirm:()=>c(!0)})})}function qC(e,t,o={}){let{saveLabel:r="Save",discardLabel:i="Discard",cancelLabel:s="Cancel"}=o;return new Promise((l)=>{let m=!1,c=(a)=>{if(m)return;m=!0,p.close(),l(a)},p=Zs({cancelLabel:s,confirmLabel:r,headline:e,layer:dt("dialog"),...z(t),onCancel:()=>c("cancel"),onClosed:()=>c("cancel"),onConfirm:()=>c("save"),onSecondary:()=>c("discard"),secondaryLabel:i})})}function z(e){if(n(e))return{message:e};return{island:(t)=>{io(e,t)}}}function Fn(e,t={}){let{cancelLabel:o="Cancel",choice:r,confirmLabel:i="OK",message:s,mono:l=!1,multiline:m=!1,placeholder:c="",rows:p="3",select:a="all",size:d,validate:x,value:Z=""}=t,k=(h)=>x?x(h,S):h.trim()?"":"Enter a value.",v=Z,S=r?.initial??"",f="",F=!1,I=()=>Q(c)?c():c,V=()=>r?r.options().map((h)=>({label:h.label,value:h.value})):[];return new Promise((h)=>{let K=!1,H=(u)=>{if(K)return;K=!0,N.close(),h(u)},W=(u)=>{f=u,N.update({error:f,invalid:f!==""})},L={cancelLabel:o,confirmLabel:i,headline:e,layer:dt("dialog"),onCancel:()=>H(null),onClosed:()=>H(null),onConfirm:()=>{let u=k(v);if(u){W(u);return}H(v.trim())},onInput:(u)=>{F=!0,v=u;let T=k(v);if(T!==f)W(T)},onPick:(u)=>{S=u,r?.onChange?.(u);let T=k(v);f=F||f?T:"",N.update({chosen:S,error:f,invalid:f!=="",options:V(),placeholder:I()})}};if(s!==void 0)Object.assign(L,z(s));if(r)L.choice={chosen:S,label:r.label,options:V()};if(L.field={mono:l,multiline:m,placeholder:I(),rows:p,select:a,value:v},d!==void 0)L.size=d;let N=Zs(L)})}var M=new Map;function Xs(e,t){let o=`${e}:${t}`,r=M.get(o);if(r&&r.parentElement)return r;return r=document.createElement("div"),r.style.pointerEvents="auto",r.setAttribute(Ve,vt(e,t)),dt(e).append(r),M.set(o,r),r}function av(e,t){let o=`${e}:${t}`,r=M.get(o);if(r)io(ft,r),r.remove(),M.delete(o)}var ne=180,ie={error:"✕",info:"ℹ",success:"✓",warn:"!"},P=null,y=new Map,b=new Set;function se(){if(!("matchMedia"in globalThis))return!1;return globalThis.matchMedia("(prefers-reduced-motion: reduce)").matches===!0}function le(){try{return new URLSearchParams(globalThis.location.search).get("automation")==="1"}catch{return!1}}function Q$(){return[...b].map((e)=>`overlay: toast ${e} settling in`)}function O(e){let t=y.get(e);if(t!==void 0)clearTimeout(t),y.delete(e);b.delete(e),$h(e)}function ce(e){if(y.has(e.id)||b.has(e.id))return;let t=se()?0:ne;if(t>0)b.add(e.id),setTimeout(()=>b.delete(e.id),t);let o=e.timeoutMs??0;if(o<=0||le())return;y.set(e.id,setTimeout(()=>O(e.id),o))}E("toasts",G);var A=null,D=null,j=null;function J(){return A??=g({dismissToast:(e)=>{O(e)},runAction:(e)=>{let t=iu.find((r)=>r.id===e),o=ae();if(!t?.action||!o)return;O(e),Tn(o,t.action,t.actionArgs,"Notifications")},toasts:[]}),A}function de(e){let t=e.action===void 0?null:ae(),o=e.action,r=t&&o!==void 0?t.get(o):void 0,i=r&&o!==void 0&&t.isVisible(o)?r:null,s=i&&o!==void 0?t.disabledReason(o):void 0;return{actionDisabled:s!==void 0,actionLabel:i?.title??"",actionTitle:i===null?"":s===void 0?i.title:`${i.title} — requires ${s}`,hasAction:i!==null,icon:ie[e.severity],id:e.id,message:e.message,severity:e.severity}}function ue(){if(fe(),!C)return;P=me(),P.run(()=>{te(()=>{iu.length,ae();for(let e of iu)ce(e);J().toasts=iu.map((e)=>de(e))})}),D=R("toasts",J(),C),D.then((e)=>{j=e})}function fe(){P?.stop(),P=null;for(let t of y.values())clearTimeout(t);y.clear(),b.clear();let e=D;if(D=null,j)j.dispose(),j=null;else if(e)e.then((t)=>t.dispose());A=null}
2
- export{sn,Zs,Tn,nt,dt,Z$,sv,X$,qo,qC,Fn,Xs,av,Q$};
1
+ import{ft,rr}from"./studio-zbwr6prc.js";import{Gt,Ut,Oh}from"./studio-s6ymkf3q.js";import{ou,w,Rh}from"./studio-5k9mfafh.js";import{ae}from"./studio-dbex091t.js";import{Z}from"./studio-mkjrjpr2.js";import{ze,yt,E,I}from"./studio-xxttcym1.js";import{me,te,b}from"./studio-y3tjh2xb.js";import{n,Q}from"./studio-0z8kp4xk.js";var B={$schema:"https://jxsuite.com/schema/v1",$id:"StudioDialog",$description:"Studio's confirm, save-or-discard and prompt dialogs: one jx-dialog whose body is projected from the adapter's scope. `message` is a sentence; `choice` is a `jx-select` over the options; `field` is the prompt's jx-textfield with its refusal. The four answers call the host's functions, and the host decides when the dialog closes.",tagName:"jx-dialog",$props:{headline:{$ref:"#/state/headline"},confirmLabel:{$ref:"#/state/confirmLabel"},secondaryLabel:{$ref:"#/state/secondaryLabel"},cancelLabel:{$ref:"#/state/cancelLabel"},destructive:{$ref:"#/state/destructive"},size:{$ref:"#/state/size"}},attributes:{headline:"${state.headline}","confirm-label":"${state.confirmLabel || null}","secondary-label":"${state.secondaryLabel || null}","cancel-label":"${state.cancelLabel || null}",part:"dialog-host"},onconfirm:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/confirm"},value:[]}]},onsecondary:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/secondary"},value:[]}]},oncancel:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/cancel"},value:[]}]},onclose:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/closed"},value:[]}]},style:{'& [part="message"]':{$description:"The one part of a dialog that is text rather than interface, so it opts back in to selection. The root sets `user-select: none` and `styles/tokens.json` restates it on every `dialog`, so the headline, the labels and the buttons around this sentence stay unselectable; a message is often the thing a reader copies into a search or a bug report.",margin:"0 0 var(--jx-space-3)",userSelect:"text"},'& [part="message"]:last-child':{margin:"0"},'& [part="island"] > p, & [part="island"] > span, & [part="island"] > strong, & [part="island"] > em, & [part="island"] > code':{$description:"The island's own prose is the message's other form — a body richer than a sentence, written straight into the island from a lit template (studio-ui-guidelines.md §9.4) — so it is selectable for the same reason `[part=\"message\"]` is. The opt-in stops at those children because the island is ALSO the mount point for a whole document: the Open Grid picker and Push Schema's plan put their surfaces here, and `user-select` inherits, so a rule on the island itself would hand selection to every heading, source row and button they draw, which is the interface the policy exists to keep unselectable. A mounted surface roots a `div`; a message writes paragraphs and text-level spans, so the two forms are told apart by the child that arrives.",userSelect:"text"},'& [part="island"]:empty':{display:"none"},'& [part="message-slot"], & [part="choice-slot"], & [part="field-slot"]':{display:"contents"},'& [part="choice-row"]':{display:"flex",flexDirection:"column",gap:"var(--jx-space-1)",margin:"0 0 var(--jx-space-3)"},'& [part="choice-label"]':{fontSize:"var(--jx-text-sm)",color:"var(--jx-fg-dim)"},"& jx-textfield":{width:"100%"}},children:[{tagName:"div",attributes:{part:"message-slot",role:"none"},$switch:{$ref:"#/state/hasMessage"},cases:{true:{tagName:"p",attributes:{part:"message"},textContent:"${state.message}"}}},{tagName:"div",attributes:{part:"island"}},{tagName:"div",attributes:{part:"choice-slot",role:"none"},$switch:{$ref:"#/state/hasChoice"},cases:{true:{tagName:"div",attributes:{part:"choice-row"},children:[{tagName:"span",attributes:{part:"choice-label"},textContent:"${state.choiceLabel}"},{tagName:"jx-select",$props:{label:{$ref:"#/state/choiceLabel"},options:{$ref:"#/state/options"},value:{$ref:"#/state/chosen"}},attributes:{part:"choice"},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/pick"},value:[{$ref:"event#/target/value"}]}]}}]}}},{tagName:"div",attributes:{part:"field-slot",role:"none"},$switch:{$ref:"#/state/hasField"},cases:{true:{tagName:"jx-textfield",$props:{label:{$ref:"#/state/headline"},value:{$ref:"#/state/value"},placeholder:{$ref:"#/state/placeholder"},invalid:{$ref:"#/state/invalid"},error:{$ref:"#/state/error"},multiline:{$ref:"#/state/multiline"},rows:{$ref:"#/state/rows"},mono:{$ref:"#/state/mono"}},attributes:{part:"field"},oninput:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/input"},value:[{$ref:"event#/target/value"}]}]},onkeydown:{$prototype:"Function",body:[{$switch:{$ref:"#/state/singleLine"},cases:{true:[{$switch:{$ref:"event#/key"},cases:{Enter:[{preventDefault:!0},{operator:"call",target:{$ref:"#/state/confirm"},value:[]}]}}]}}]},$description:"The prompt's one field. `multiline` is what makes it a paste box rather than a line: an import the author copied out of a `_redirects` file is column-aligned, so it also asks for `mono`. A multiline field takes Enter as a newline, which is why the Enter-confirms handler below is guarded on it — a paste box whose second line submits the dialog cannot be typed into."}}}]};E("dialog",B);function an(e){if(e.querySelector('[part="dialog"]'))return Promise.resolve(e);return new Promise((t)=>{e.addEventListener("jx-ready",function o(r){if(r.target!==e&&!e.querySelector('[part="dialog"]'))return;e.removeEventListener("jx-ready",o),t(e)})})}function ta(e){let t=document.createElement("div");t.style.pointerEvents="auto",t.setAttribute(ze,yt("dialog",e.region)),e.layer.append(t);let o=b({cancel:()=>{e.onCancel()},cancelLabel:e.cancelLabel,choiceLabel:e.choice?.label??"",chosen:e.choice?.chosen??"",closed:()=>{e.onClosed()},confirm:()=>{e.onConfirm()},confirmLabel:e.confirmLabel,destructive:e.destructive===!0,error:"",hasChoice:e.choice!==void 0,hasField:e.field!==void 0,mono:e.field?.mono===!0,multiline:e.field?.multiline===!0,rows:e.field?.rows??"3",singleLine:e.field!==void 0&&e.field.multiline!==!0?"true":"false",hasMessage:e.message!==void 0&&e.message!=="",headline:e.headline,input:(a)=>{o.value=a,e.onInput?.(a)},invalid:!1,message:e.message??"",options:e.choice?.options??[],pick:(a)=>{e.onPick?.(a)},placeholder:e.field?.placeholder??"",secondary:()=>{e.onSecondary?.()},secondaryLabel:e.secondaryLabel??"",size:e.size??"sm",value:e.field?.value??""}),r=null,i=!1,s=()=>i,l=()=>{},m=new Promise((a)=>{l=a}),p=I("dialog",o,t).then(async(a)=>{let d=a.root;if(s())return a.dispose(),d;if(r=a,await Promise.race([an(d),m]),s())return d;if(e.island?.(d.querySelector('[part="island"]')??d),Gt(d),e.field){let x=d.querySelector("jx-textfield");if(x)setTimeout(()=>{if(!i)Oh(x,e.field?.select??"all")},0)}return d});return{close(){if(i)return;i=!0,l();let a=r?.root;if(a instanceof HTMLElement)Ut(a);r?.dispose(),r=null,t.remove()},host:t,ready:p,update(a){if(a.confirmLabel!==void 0)o.confirmLabel=a.confirmLabel;if(a.cancelLabel!==void 0)o.cancelLabel=a.cancelLabel;if(a.secondaryLabel!==void 0)o.secondaryLabel=a.secondaryLabel;if(a.message!==void 0)o.message=a.message,o.hasMessage=a.message!=="";if(a.value!==void 0)o.value=a.value;if(a.placeholder!==void 0)o.placeholder=a.placeholder;if(a.invalid!==void 0)o.invalid=a.invalid;if(a.error!==void 0)if(a.error!==""&&a.error===o.error){o.error="";let d=a.error;queueMicrotask(()=>{o.error=d})}else o.error=a.error;if(a.options!==void 0)o.options=a.options;if(a.chosen!==void 0)o.chosen=a.chosen}}}var G={$schema:"https://jxsuite.com/schema/v1",$id:"StudioToasts",$description:"The toast stack: a rendering of the notification service's toasts, newest last. Each row is projected by ui/layers.ts with its severity glyph and, where a recovery command exists, that command's title and gate; the two buttons call back into the host, which owns the records and their timers.",tagName:"div",attributes:{part:"stack"},style:{position:"absolute",right:"var(--jx-space-4)",bottom:"36px",display:"flex",flexDirection:"column",gap:"var(--jx-space-3)",alignItems:"flex-end",maxWidth:"min(420px, calc(100vw - 24px))",'& [part="toast"]':{display:"flex",alignItems:"center",gap:"var(--jx-space-3)",pointerEvents:"auto",padding:"var(--jx-space-3)",border:"1px solid var(--jx-border)",borderLeft:"3px solid var(--jx-fg-dim)",borderRadius:"var(--jx-radius-md)",background:"var(--jx-bg-panel)",color:"var(--jx-fg)",fontSize:"var(--jx-text-sm)",lineHeight:"var(--jx-leading-sm)",boxShadow:"var(--jx-shadow-popover)"},'& [part="toast"][data-severity="success"]':{borderLeftColor:"var(--jx-success)"},'& [part="toast"][data-severity="info"]':{borderLeftColor:"var(--jx-accent)"},'& [part="toast"][data-severity="warn"]':{borderLeftColor:"var(--jx-warning)"},'& [part="toast"][data-severity="error"]':{borderLeftColor:"var(--jx-danger)"},'& [part="icon"]':{flex:"none",width:"14px",textAlign:"center",fontWeight:"700"},'& [data-severity="success"] [part="icon"]':{color:"var(--jx-success)"},'& [data-severity="info"] [part="icon"]':{color:"var(--jx-accent)"},'& [data-severity="warn"] [part="icon"]':{color:"var(--jx-warning)"},'& [data-severity="error"] [part="icon"]':{color:"var(--jx-danger)"},'& [part="message"]':{flex:"1",minWidth:"0",overflow:"hidden",display:"-webkit-box",WebkitBoxOrient:"vertical",WebkitLineClamp:"3"},'& [part="action-slot"]':{display:"contents"},'& [part="action"] > [part="control"]':{color:"var(--jx-accent)"}},children:[{$prototype:"Array",items:{$ref:"#/state/toasts"},key:{$ref:"$map/item/id"},map:{tagName:"div",attributes:{part:"toast","data-severity":"${$map.item.severity}"},children:[{tagName:"span",attributes:{part:"icon","aria-hidden":"true"},textContent:"${$map.item.icon}"},{tagName:"span",attributes:{part:"message"},textContent:"${$map.item.message}"},{tagName:"span",attributes:{part:"action-slot",role:"none"},$switch:{$ref:"$map/item/hasAction"},cases:{true:{tagName:"jx-button",$props:{size:"sm",quiet:!0,disabled:{$ref:"$map/item/actionDisabled"}},attributes:{part:"action",title:"${$map.item.actionTitle}"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/runAction"},value:[{$ref:"$map/item/id"}]}]},children:[{tagName:"span",textContent:"${$map.item.actionLabel}"}]}}},{tagName:"jx-action-button",$props:{label:"Dismiss notification",hint:"Dismiss notification",icon:"x",size:"sm"},attributes:{part:"dismiss"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/dismissToast"},value:[{$ref:"$map/item/id"}]}]}}]}}]};function re(e){return e instanceof RangeError||e instanceof Error&&e.name==="CommandUnavailableError"}function Tn(e,t,o,r=t){let i=(l)=>{if(!re(l))console.error(`${r}: command "${t}" failed`,l);w.error(Z(l),{key:`command.run:${t}`,source:r})},s;try{s=e.run(t,o)}catch(l){return i(l),Promise.resolve()}return Promise.resolve(s).catch(i)}function it(e,t,o){let r=ae();return r?Tn(r,e,t,o):Promise.resolve()}var X=null,A=null,_=null,C=null;function dt(e){return(e==="popover"?X:e==="modal"?A:e==="toast"?C:_)??document.body}function gR(){X=document.querySelector("#layer-popover"),A=document.querySelector("#layer-modal"),_=document.querySelector("#layer-dialog"),C=document.querySelector("#layer-toast"),ue()}var U="jx-dialog[data-open], dialog[open]";function my(){return Boolean(_?.querySelector(U)||A?.querySelector(U))}function bR(){return document.querySelector(":popover-open")!==null}function Kr(e,t,o={}){let{confirmLabel:r="Confirm",cancelLabel:i="Cancel",destructive:s=!1}=o;return new Promise((l)=>{let m=!1,c=(a)=>{if(m)return;m=!0,p.close(),l(a)},p=ta({cancelLabel:i,confirmLabel:r,destructive:s,headline:e,layer:dt("dialog"),...q(t),onCancel:()=>c(!1),onClosed:()=>c(!1),onConfirm:()=>c(!0)})})}function u1(e,t,o={}){let{saveLabel:r="Save",discardLabel:i="Discard",cancelLabel:s="Cancel"}=o;return new Promise((l)=>{let m=!1,c=(a)=>{if(m)return;m=!0,p.close(),l(a)},p=ta({cancelLabel:s,confirmLabel:r,headline:e,layer:dt("dialog"),...q(t),onCancel:()=>c("cancel"),onClosed:()=>c("cancel"),onConfirm:()=>c("save"),onSecondary:()=>c("discard"),secondaryLabel:i})})}function q(e){if(n(e))return{message:e};return{island:(t)=>{rr(e,t)}}}function Fn(e,t={}){let{cancelLabel:o="Cancel",choice:r,confirmLabel:i="OK",message:s,mono:l=!1,multiline:m=!1,placeholder:c="",rows:p="3",select:a="all",size:d,validate:x,value:Y=""}=t,k=(g)=>x?x(g,S):g.trim()?"":"Enter a value.",h=Y,S=r?.initial??"",f="",z=!1,F=()=>Q(c)?c():c,V=()=>r?r.options().map((g)=>({label:g.label,value:g.value})):[];return new Promise((g)=>{let K=!1,H=(u)=>{if(K)return;K=!0,N.close(),g(u)},W=(u)=>{f=u,N.update({error:f,invalid:f!==""})},L={cancelLabel:o,confirmLabel:i,headline:e,layer:dt("dialog"),onCancel:()=>H(null),onClosed:()=>H(null),onConfirm:()=>{let u=k(h);if(u){W(u);return}H(h.trim())},onInput:(u)=>{z=!0,h=u;let T=k(h);if(T!==f)W(T)},onPick:(u)=>{S=u,r?.onChange?.(u);let T=k(h);f=z||f?T:"",N.update({chosen:S,error:f,invalid:f!=="",options:V(),placeholder:F()})}};if(s!==void 0)Object.assign(L,q(s));if(r)L.choice={chosen:S,label:r.label,options:V()};if(L.field={mono:l,multiline:m,placeholder:F(),rows:p,select:a,value:h},d!==void 0)L.size=d;let N=ta(L)})}var M=new Map;function na(e,t){let o=`${e}:${t}`,r=M.get(o);if(r&&r.parentElement)return r;return r=document.createElement("div"),r.style.pointerEvents="auto",r.setAttribute(ze,yt(e,t)),dt(e).append(r),M.set(o,r),r}function gy(e,t){let o=`${e}:${t}`,r=M.get(o);if(r)rr(ft,r),r.remove(),M.delete(o)}var ne=180,ie={error:"✕",info:"ℹ",success:"✓",warn:"!"},P=null,y=new Map,v=new Set;function se(){if(!("matchMedia"in globalThis))return!1;return globalThis.matchMedia("(prefers-reduced-motion: reduce)").matches===!0}function le(){try{return new URLSearchParams(globalThis.location.search).get("automation")==="1"}catch{return!1}}function yR(){return[...v].map((e)=>`overlay: toast ${e} settling in`)}function O(e){let t=y.get(e);if(t!==void 0)clearTimeout(t),y.delete(e);v.delete(e),Rh(e)}function ce(e){if(y.has(e.id)||v.has(e.id))return;let t=se()?0:ne;if(t>0)v.add(e.id),setTimeout(()=>v.delete(e.id),t);let o=e.timeoutMs??0;if(o<=0||le())return;y.set(e.id,setTimeout(()=>O(e.id),o))}E("toasts",G);var R=null,D=null,j=null;function J(){return R??=b({dismissToast:(e)=>{O(e)},runAction:(e)=>{let t=ou.find((r)=>r.id===e),o=ae();if(!t?.action||!o)return;O(e),Tn(o,t.action,t.actionArgs,"Notifications")},toasts:[]}),R}function de(e){let t=e.action===void 0?null:ae(),o=e.action,r=t&&o!==void 0?t.get(o):void 0,i=r&&o!==void 0&&t.isVisible(o)?r:null,s=i&&o!==void 0?t.disabledReason(o):void 0;return{actionDisabled:s!==void 0,actionLabel:i?.title??"",actionTitle:i===null?"":s===void 0?i.title:`${i.title} — requires ${s}`,hasAction:i!==null,icon:ie[e.severity],id:e.id,message:e.message,severity:e.severity}}function ue(){if(fe(),!C)return;P=me(),P.run(()=>{te(()=>{ou.length,ae();for(let e of ou)ce(e);J().toasts=ou.map((e)=>de(e))})}),D=I("toasts",J(),C),D.then((e)=>{j=e})}function fe(){P?.stop(),P=null;for(let t of y.values())clearTimeout(t);y.clear(),v.clear();let e=D;if(D=null,j)j.dispose(),j=null;else if(e)e.then((t)=>t.dispose());R=null}
2
+ export{an,ta,Tn,it,dt,gR,my,bR,Kr,u1,Fn,na,gy,yR};
3
3
 
4
- //# debugId=DB2A0A775E7A8BB064756E2164756E21
5
- //# sourceMappingURL=studio-tpxcryf2.js.map
4
+ //# debugId=55A92DA369E639E864756E2164756E21
5
+ //# sourceMappingURL=studio-yetr4gg1.js.map