@jxsuite/studio 6.1.2 → 8.0.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 (522) hide show
  1. package/README.md +5 -5
  2. package/dist/chunks/2020-5wtzce5g.js +4 -0
  3. package/dist/chunks/adapter-5tphg7xe.js +4 -0
  4. package/dist/chunks/add-new-flow-psym14sn.js +4 -0
  5. package/dist/chunks/cf-account-picker-haqazq5r.js +4 -0
  6. package/dist/chunks/cf-settings-h2wrh6hq.js +4 -0
  7. package/dist/chunks/{color-area-0fj8a4ga.js → color-area-6rbra5dy.js} +2 -2
  8. package/dist/chunks/{color-field-xch8kx2g.js → color-field-gy56c94g.js} +3 -3
  9. package/dist/chunks/color-m7r1vk54.js +4 -0
  10. package/dist/chunks/{color-slider-jxd8v350.js → color-slider-sqqdyf6c.js} +2 -2
  11. package/dist/chunks/{combobox-p0efwjke.js → combobox-72h32ejk.js} +3 -3
  12. package/dist/chunks/components-r22xca09.js +4 -0
  13. package/dist/chunks/content-source-mmppmcyg.js +4 -0
  14. package/dist/chunks/convert-to-repeater-he70fc2b.js +4 -0
  15. package/dist/chunks/editor-ccd9jwsa.js +4 -0
  16. package/dist/chunks/entry-commands-6qxz9e8p.js +4 -0
  17. package/dist/chunks/extension-sections-0egb88dm.js +4 -0
  18. package/dist/chunks/file-ops-qnab36ek.js +4 -0
  19. package/dist/chunks/files-rcn56qvm.js +4 -0
  20. package/dist/chunks/format-host-yxz0kjjs.js +4 -0
  21. package/dist/chunks/fs-events-d1qxq4z4.js +4 -0
  22. package/dist/chunks/grid-open-4z1g062t.js +4 -0
  23. package/dist/chunks/{grid-view-d2wq9ezg.js → grid-view-qg1b5eqx.js} +25 -25
  24. package/dist/chunks/{icons-pnfz478q.js → icons-63bjtbs7.js} +2 -2
  25. package/dist/chunks/{iframe-entry-jdcktez8.js → iframe-entry-2zggzajv.js} +4 -4
  26. package/dist/chunks/{iframe-entry-zap785cw.js → iframe-entry-76j8vwwx.js} +4 -4
  27. package/dist/chunks/iframe-entry-99nr5zfb.js +5 -0
  28. package/dist/chunks/{iframe-entry-x0ygf2yr.js → iframe-entry-pkgmcgp0.js} +4 -4
  29. package/dist/chunks/iframe-host-ssv7kyj0.js +4 -0
  30. package/dist/chunks/{index-zpjmzqfk.js → index-32eqzv1k.js} +3 -3
  31. package/dist/chunks/index-f0jn7nnp.js +4 -0
  32. package/dist/chunks/{javascript-m54mnwp6.js → javascript-pjp734q4.js} +3 -3
  33. package/dist/chunks/jsonMode-njkvsa02.js +13 -0
  34. package/dist/chunks/jx-validate-ttasrbh7.js +4 -0
  35. package/dist/chunks/layers-bgyr11tr.js +4 -0
  36. package/dist/chunks/layers-panel-7ez66zeq.js +4 -0
  37. package/dist/chunks/{listbox-e74qjyq6.js → listbox-c421cf8c.js} +2 -2
  38. package/dist/chunks/lit-html-v9gh687x.js +4 -0
  39. package/dist/chunks/media-library-sq468wts.js +4 -0
  40. package/dist/chunks/media-picker-shfe59pt.js +4 -0
  41. package/dist/chunks/{menu-n6yzswmy.js → menu-bdpzbfvs.js} +2 -2
  42. package/dist/chunks/{monaco-binding-7gx83x3r.js → monaco-binding-vq1hgnn0.js} +3 -3
  43. package/dist/chunks/monaco-buffer-3afgwvbp.js +4 -0
  44. package/dist/chunks/monaco-setup-xrd2cbkp.js +4 -0
  45. package/dist/chunks/notify-kzrjr3fv.js +4 -0
  46. package/dist/chunks/parse-v77xtwv7.js +4 -0
  47. package/dist/chunks/platform-7v4rtd7m.js +4 -0
  48. package/dist/chunks/popover-b89sfej7.js +4 -0
  49. package/dist/chunks/publish-panel-2z9gw8ee.js +4 -0
  50. package/dist/chunks/publish-quick-qx2455cj.js +4 -0
  51. package/dist/chunks/publish-workspace-wrc1dgwx.js +4 -0
  52. package/dist/chunks/quick-search-n0t0eqxb.js +4 -0
  53. package/dist/chunks/references-9547rg5s.js +4 -0
  54. package/dist/chunks/right-panel-wsgnr9pn.js +4 -0
  55. package/dist/chunks/source-control-kwktr9y6.js +4 -0
  56. package/dist/chunks/{split-n2gfpm5m.js → split-c9zfdgxf.js} +2 -2
  57. package/dist/chunks/studio-03ct6yfv.js +9 -0
  58. package/dist/chunks/studio-07rcfje3.js +5 -0
  59. package/dist/chunks/studio-3e54qh39.js +7 -0
  60. package/dist/chunks/studio-3exxhz5g.js +5 -0
  61. package/dist/chunks/studio-3q40e3rj.js +5 -0
  62. package/dist/chunks/studio-3qeh9t0h.js +6 -0
  63. package/dist/chunks/studio-3qqjeep5.js +6 -0
  64. package/dist/chunks/studio-43sd2mam.js +4 -0
  65. package/dist/chunks/studio-4hp8pkyt.js +5 -0
  66. package/dist/chunks/studio-58xg6j2q.js +9 -0
  67. package/dist/chunks/studio-5g0rprdt.js +7 -0
  68. package/dist/chunks/{studio-2j1cb95x.js → studio-6m380wp7.js} +4 -4
  69. package/dist/chunks/studio-80jyh1xh.js +4 -0
  70. package/dist/chunks/studio-83mk4bgg.js +9 -0
  71. package/dist/chunks/{studio-v0jzqdjm.js → studio-881z1xrx.js} +4 -4
  72. package/dist/chunks/studio-8m0y2qe7.js +5 -0
  73. package/dist/chunks/{studio-d81xfh1g.js → studio-8tr6cfrc.js} +4 -4
  74. package/dist/chunks/studio-8vcvfs7r.js +6 -0
  75. package/dist/chunks/studio-9tmebf0s.js +5 -0
  76. package/dist/chunks/studio-a2bvaptz.js +5 -0
  77. package/dist/chunks/studio-b7y5mr30.js +5 -0
  78. package/dist/chunks/studio-bavb31r0.js +5 -0
  79. package/dist/chunks/{studio-dgz8d0c1.js → studio-bbe4c90a.js} +4 -4
  80. package/dist/chunks/studio-c05wdnt3.js +5 -0
  81. package/dist/chunks/studio-ccv2svc6.js +5 -0
  82. package/dist/chunks/studio-d5grtb9e.js +16 -0
  83. package/dist/chunks/studio-df0baea9.js +5 -0
  84. package/dist/chunks/studio-dgk4dqtx.js +7 -0
  85. package/dist/chunks/studio-e1g64q43.js +5 -0
  86. package/dist/chunks/studio-ed1hp6zf.js +6 -0
  87. package/dist/chunks/studio-ed3xx40h.js +7 -0
  88. package/dist/chunks/studio-f14e1zdj.js +5 -0
  89. package/dist/chunks/studio-fbhxxc5f.js +5 -0
  90. package/dist/chunks/studio-fyh0jc96.js +5 -0
  91. package/dist/chunks/studio-gcxk20n7.js +5 -0
  92. package/dist/chunks/studio-jaaz8ce9.js +5 -0
  93. package/dist/chunks/{studio-90pq9km1.js → studio-jcnsdaep.js} +4 -4
  94. package/dist/chunks/studio-jsgf2q5k.js +7 -0
  95. package/dist/chunks/{studio-0q988f9w.js → studio-k3xxbagr.js} +3 -3
  96. package/dist/chunks/{studio-5ve6bbep.js → studio-k7evxqh4.js} +4 -4
  97. package/dist/chunks/studio-kt3pjkwd.js +5 -0
  98. package/dist/chunks/studio-m8g16bgz.js +5 -0
  99. package/dist/chunks/studio-mn0476ag.js +5 -0
  100. package/dist/chunks/studio-mx1smyq0.js +5 -0
  101. package/dist/chunks/studio-n0c5h6mf.js +5 -0
  102. package/dist/chunks/{studio-485046te.js → studio-nh6d342n.js} +7 -7
  103. package/dist/chunks/studio-nqxqf8p2.js +4 -0
  104. package/dist/chunks/studio-p4nrkvqr.js +5 -0
  105. package/dist/chunks/{studio-1fxkaaea.js → studio-pbxa5fpc.js} +4 -4
  106. package/dist/chunks/studio-pgmvdv7z.js +7 -0
  107. package/dist/chunks/studio-ph84avkf.js +5 -0
  108. package/dist/chunks/{studio-tq0rtfwj.js → studio-q0mvbaq6.js} +4 -4
  109. package/dist/chunks/studio-q0tccd43.js +5 -0
  110. package/dist/chunks/studio-q7rtx6zq.js +14 -0
  111. package/dist/chunks/{studio-a3g98wjr.js → studio-qgh13jtz.js} +4 -4
  112. package/dist/chunks/studio-qmn1xc24.js +5 -0
  113. package/dist/chunks/studio-qwdqwkj0.js +5 -0
  114. package/dist/chunks/studio-r5qy30vx.js +5 -0
  115. package/dist/chunks/studio-rj9eamf8.js +5 -0
  116. package/dist/chunks/studio-rptgsk96.js +5 -0
  117. package/dist/chunks/studio-rthyg42z.js +928 -0
  118. package/dist/chunks/studio-s19tp1xr.js +5 -0
  119. package/dist/chunks/studio-s32578pn.js +5 -0
  120. package/dist/chunks/studio-svb7yyve.js +5 -0
  121. package/dist/chunks/studio-syreb644.js +5 -0
  122. package/dist/chunks/studio-tf9jryb1.js +10 -0
  123. package/dist/chunks/studio-tfkznv39.js +5 -0
  124. package/dist/chunks/studio-tft6r105.js +5 -0
  125. package/dist/chunks/studio-txf2kysx.js +5 -0
  126. package/dist/chunks/studio-v8867ddv.js +12 -0
  127. package/dist/chunks/studio-vxq7fcvv.js +5 -0
  128. package/dist/chunks/studio-w4rz9hdk.js +5 -0
  129. package/dist/chunks/studio-wbcjbhy1.js +9 -0
  130. package/dist/chunks/studio-wc649wss.js +5 -0
  131. package/dist/chunks/studio-wys23mxz.js +5 -0
  132. package/dist/chunks/studio-x1x167jh.js +5 -0
  133. package/dist/chunks/studio-x9hsze61.js +5 -0
  134. package/dist/chunks/studio-y0n7yxea.js +9 -0
  135. package/dist/chunks/studio-y3ahhdpx.js +5 -0
  136. package/dist/chunks/studio-z97c48fk.js +5 -0
  137. package/dist/chunks/studio-zat62m0c.js +5 -0
  138. package/dist/chunks/studio-zcd2e7yz.js +5 -0
  139. package/dist/chunks/studio-zz9qe3rw.js +64 -0
  140. package/dist/chunks/toast-1gv0h53h.js +4 -0
  141. package/dist/chunks/{toast-host-ke5z4ng7.js → toast-host-1yg5ar8d.js} +3 -3
  142. package/dist/chunks/{tooltip-5v8ngwj2.js → tooltip-yypz28gq.js} +3 -3
  143. package/dist/chunks/{tree-mdq3v5cw.js → tree-9xa4hm7n.js} +2 -2
  144. package/dist/chunks/tsMode-epyfz1hv.js +14 -0
  145. package/dist/chunks/workspace-dz7nxfhv.js +4 -0
  146. package/dist/chunks/workspace-home-xsd7hkjw.js +4 -0
  147. package/dist/chunks/{ws-client-nze0k6mv.js → ws-client-bv552sfx.js} +3 -3
  148. package/dist/iframe-entry.js +20 -16
  149. package/dist/manifest.json +77 -63
  150. package/dist/studio.js +103 -104
  151. package/dist/workers/ts.worker.js +3 -3
  152. package/package.json +12 -11
  153. package/src/browse/component-examples.ts +272 -0
  154. package/src/browse/library-commands.ts +64 -104
  155. package/src/browse/library-layouts.ts +263 -49
  156. package/src/browse/library-model.ts +181 -133
  157. package/src/browse/library-pane.ts +738 -446
  158. package/src/browse/library-preview.ts +149 -19
  159. package/src/browse/library-source.ts +308 -41
  160. package/src/browse/preview-root.ts +78 -0
  161. package/src/browse/preview-style.ts +155 -0
  162. package/src/canvas/asset-refs.ts +16 -1
  163. package/src/canvas/canvas-live-render.ts +222 -30
  164. package/src/canvas/canvas-origin.ts +37 -12
  165. package/src/canvas/canvas-page-context.ts +112 -0
  166. package/src/canvas/canvas-render.ts +113 -107
  167. package/src/canvas/canvas-utils.ts +57 -12
  168. package/src/canvas/iframe-drop.ts +107 -0
  169. package/src/canvas/iframe-entry.ts +24 -12
  170. package/src/canvas/iframe-host.ts +134 -62
  171. package/src/canvas/iframe-keys.ts +11 -0
  172. package/src/canvas/iframe-patch.ts +8 -7
  173. package/src/canvas/iframe-protocol.ts +24 -5
  174. package/src/canvas/iframe-render.ts +48 -1
  175. package/src/canvas/iframe-subtree.ts +5 -2
  176. package/src/canvas/npm-modules.ts +22 -0
  177. package/src/canvas/preview-navigate.ts +16 -0
  178. package/src/canvas/repeater-sources.ts +200 -0
  179. package/src/canvas/stage-scrollbar.ts +5 -1
  180. package/src/canvas/surface-registry.ts +6 -0
  181. package/src/commands/app-commands.ts +16 -6
  182. package/src/commands/budget.ts +10 -8
  183. package/src/commands/context.ts +35 -10
  184. package/src/commands/defaults.ts +69 -45
  185. package/src/commands/keymap.ts +9 -0
  186. package/src/commands/levels.ts +11 -5
  187. package/src/commands/live-context.ts +2 -0
  188. package/src/commands/registry.ts +10 -1
  189. package/src/content/collection-match.ts +6 -5
  190. package/src/content/collection-pages.ts +412 -0
  191. package/src/content/content-collections.ts +270 -0
  192. package/src/content/entry-commands.ts +51 -60
  193. package/src/content/entry-editor.ts +111 -18
  194. package/src/content/entry-fields.ts +13 -1
  195. package/src/content/entry-inspector.ts +225 -0
  196. package/src/content/entry-model.ts +17 -3
  197. package/src/content/entry-open.ts +80 -0
  198. package/src/content/entry-summaries.ts +440 -0
  199. package/src/content/file-record-ids.ts +80 -0
  200. package/src/content/file-records.ts +125 -0
  201. package/src/content/page-summaries.ts +129 -0
  202. package/src/content/record-entry.ts +201 -0
  203. package/src/content/writing-banner.ts +177 -0
  204. package/src/create/add-new-commands.ts +185 -0
  205. package/src/create/add-new-flow.ts +1116 -0
  206. package/src/create/add-new.ts +1014 -0
  207. package/src/create/element-name.ts +121 -0
  208. package/src/editor/convert-to-component.ts +67 -43
  209. package/src/editor/file-drop-action.ts +9 -1
  210. package/src/editor/inline-edit-apply.ts +44 -0
  211. package/src/editor/inline-edit.ts +10 -0
  212. package/src/editor/insert-component.ts +91 -0
  213. package/src/editor/insert-zone-action.ts +13 -4
  214. package/src/editor/shortcuts.ts +44 -22
  215. package/src/editor/slash-menu.ts +51 -8
  216. package/src/files/components.ts +74 -10
  217. package/src/files/file-ops.ts +15 -5
  218. package/src/files/files.ts +164 -150
  219. package/src/files/fs-events.ts +18 -7
  220. package/src/files/media-meta.ts +95 -1
  221. package/src/files/media-types.ts +55 -0
  222. package/src/files/media-upload.ts +209 -52
  223. package/src/files/new-file-name.ts +156 -0
  224. package/src/files/serialize-document.ts +13 -3
  225. package/src/format/format-host.ts +15 -0
  226. package/src/github/github-auth.ts +2 -2
  227. package/src/github/github-publish.ts +4 -3
  228. package/src/grid/grid-controller.ts +5 -1
  229. package/src/grid/grid-open.ts +0 -27
  230. package/src/grid/grid-panel.ts +54 -2
  231. package/src/grid/grid-reveal.ts +34 -0
  232. package/src/grid/grid-source.ts +3 -25
  233. package/src/grid/grid-view.ts +31 -6
  234. package/src/grid/sources/content-source.ts +75 -7
  235. package/src/grid/tabulator-tables.d.ts +6 -0
  236. package/src/hosting/document.ts +2 -2
  237. package/src/i18n/i18n-commands.ts +2 -1
  238. package/src/media/media-commands.ts +181 -0
  239. package/src/media/media-library-model.ts +232 -0
  240. package/src/media/media-library.ts +1283 -0
  241. package/src/media/media-pane.ts +47 -19
  242. package/src/packages/pull-package-sync.ts +1 -1
  243. package/src/panels/activity-panel.ts +21 -5
  244. package/src/panels/ai-chat/chat-markdown.ts +8 -8
  245. package/src/panels/block-action-bar.ts +11 -11
  246. package/src/panels/canvas-dnd-bridge.ts +5 -2
  247. package/src/panels/chat-panel.ts +6 -6
  248. package/src/panels/collections-panel.ts +306 -0
  249. package/src/panels/component-preview.ts +35 -13
  250. package/src/panels/data-explorer.ts +1 -1
  251. package/src/panels/data-grid.ts +4 -0
  252. package/src/panels/dnd.ts +17 -30
  253. package/src/panels/elements-panel.ts +9 -2
  254. package/src/panels/empty-state.ts +2 -2
  255. package/src/panels/formula-workspace.ts +2 -3
  256. package/src/panels/frontmatter-fields.ts +9 -9
  257. package/src/panels/git-diff-open.ts +9 -5
  258. package/src/panels/head-panel.ts +369 -103
  259. package/src/panels/i18n-panel.ts +11 -10
  260. package/src/panels/imports-panel.ts +2 -0
  261. package/src/panels/jump-bar.ts +27 -2
  262. package/src/panels/layers-panel.ts +36 -30
  263. package/src/panels/left-panel.ts +22 -8
  264. package/src/panels/navigator-panels.ts +23 -11
  265. package/src/panels/pane-context.ts +111 -29
  266. package/src/panels/pane-grid.ts +6 -6
  267. package/src/panels/panel-registry.ts +14 -9
  268. package/src/panels/properties-panel.ts +7 -3
  269. package/src/panels/right-panel.ts +199 -43
  270. package/src/panels/seo-modal.ts +41 -108
  271. package/src/panels/settings-menu.ts +52 -50
  272. package/src/panels/settings-pane.ts +268 -162
  273. package/src/panels/signals-panel.ts +3 -4
  274. package/src/panels/site-model.ts +367 -0
  275. package/src/panels/site-panel.ts +638 -0
  276. package/src/panels/style-panel.ts +37 -3
  277. package/src/panels/stylebook-doc.ts +142 -10
  278. package/src/panels/stylebook-layers-panel.ts +39 -80
  279. package/src/panels/stylebook-panel.ts +47 -10
  280. package/src/panels/styles-panel.ts +327 -0
  281. package/src/panels/tab-strip.ts +109 -25
  282. package/src/platform.ts +1 -1
  283. package/src/platforms/cloud.ts +28 -1
  284. package/src/platforms/default-platform.ts +4 -4
  285. package/src/platforms/devserver.ts +51 -25
  286. package/src/publish/deploy-checklist.ts +12 -7
  287. package/src/publish/pages-service.ts +38 -14
  288. package/src/publish/publish-changes.ts +491 -0
  289. package/src/publish/publish-commands.ts +83 -18
  290. package/src/publish/publish-ids.ts +49 -0
  291. package/src/publish/publish-quick.ts +148 -0
  292. package/src/publish/publish-workspace.ts +926 -0
  293. package/src/publish/source-control.ts +907 -0
  294. package/src/services/automation.ts +16 -20
  295. package/src/services/cf-settings.ts +4 -4
  296. package/src/services/connection.ts +2 -2
  297. package/src/services/directory-picker.ts +2 -2
  298. package/src/services/references.ts +0 -0
  299. package/src/services/render-critic.ts +21 -2
  300. package/src/services/settings/definitions.ts +25 -14
  301. package/src/settings/contributed-section.ts +49 -10
  302. package/src/settings/css-vars-editor.ts +93 -27
  303. package/src/settings/developer-panels.ts +43 -0
  304. package/src/settings/extension-sections.ts +20 -2
  305. package/src/settings/general-settings.ts +91 -21
  306. package/src/settings/preferences-dialog.ts +8 -1
  307. package/src/settings/project-sections.ts +27 -10
  308. package/src/settings/schema-field-ui.ts +3 -1
  309. package/src/settings/section-registry.ts +116 -11
  310. package/src/settings/settings-dialog.ts +192 -0
  311. package/src/settings/settings-document.ts +182 -162
  312. package/src/shell.ts +467 -431
  313. package/src/site-context.ts +64 -10
  314. package/src/state.ts +28 -9
  315. package/src/studio.ts +194 -41
  316. package/src/style/project-styles.ts +34 -0
  317. package/src/style/stylebook-specimens.ts +89 -0
  318. package/src/style/stylebook-target.ts +26 -0
  319. package/src/style/tag-inheritance.ts +105 -0
  320. package/src/style/variables-focus.ts +61 -0
  321. package/src/style/variables-view.ts +235 -0
  322. package/src/surfaces/add-new.json +1482 -0
  323. package/src/surfaces/add-new.ts +325 -0
  324. package/src/surfaces/ai-chat.ts +2 -2
  325. package/src/surfaces/boot-failure.json +4 -3
  326. package/src/surfaces/bottom-dock.json +1 -1
  327. package/src/surfaces/canvas-stage.json +30 -19
  328. package/src/surfaces/canvas-stage.ts +5 -5
  329. package/src/surfaces/collections-panel.json +615 -0
  330. package/src/surfaces/collections-panel.ts +168 -0
  331. package/src/surfaces/commandbar.json +241 -96
  332. package/src/surfaces/commandbar.ts +134 -99
  333. package/src/surfaces/empty-state.json +1 -1
  334. package/src/surfaces/entry-editor.json +136 -0
  335. package/src/surfaces/entry-editor.ts +21 -0
  336. package/src/surfaces/entry-inspector.json +371 -0
  337. package/src/surfaces/entry-inspector.ts +143 -0
  338. package/src/surfaces/inspector-dock.json +162 -14
  339. package/src/surfaces/inspector-dock.ts +46 -19
  340. package/src/surfaces/library-pane.json +670 -437
  341. package/src/surfaces/library-pane.ts +94 -59
  342. package/src/surfaces/media-browser.json +62 -6
  343. package/src/surfaces/media-browser.ts +15 -1
  344. package/src/surfaces/media-field.json +1 -1
  345. package/src/surfaces/media-library.json +1586 -0
  346. package/src/surfaces/media-library.ts +282 -0
  347. package/src/surfaces/media-pick-dialog.json +71 -0
  348. package/src/surfaces/media-pick-dialog.ts +132 -0
  349. package/src/surfaces/menu.ts +18 -0
  350. package/src/surfaces/pane-context.json +144 -77
  351. package/src/surfaces/pane-context.ts +24 -0
  352. package/src/surfaces/panel-deploy-checklist.json +12 -6
  353. package/src/surfaces/panel-deploy-checklist.ts +3 -1
  354. package/src/surfaces/panel-page.json +72 -2
  355. package/src/surfaces/panel-page.ts +38 -7
  356. package/src/surfaces/panel-signals.json +1 -1
  357. package/src/surfaces/panel-signals.ts +5 -5
  358. package/src/surfaces/panel-stylebook-layers.json +71 -204
  359. package/src/surfaces/panel-stylebook-layers.ts +0 -21
  360. package/src/surfaces/preferences.json +120 -48
  361. package/src/surfaces/preferences.ts +8 -0
  362. package/src/surfaces/publish-quick.json +428 -0
  363. package/src/surfaces/publish-quick.ts +165 -0
  364. package/src/surfaces/publish-workspace.json +2892 -0
  365. package/src/surfaces/publish-workspace.ts +391 -0
  366. package/src/surfaces/rail.json +1 -159
  367. package/src/surfaces/rail.ts +18 -75
  368. package/src/surfaces/schema-form.json +10 -2
  369. package/src/surfaces/schema-form.ts +2 -0
  370. package/src/surfaces/seo.json +1 -1
  371. package/src/surfaces/settings-contributed.json +5 -5
  372. package/src/surfaces/settings-contributed.ts +18 -2
  373. package/src/surfaces/settings-css-vars.json +44 -36
  374. package/src/surfaces/settings-css-vars.ts +77 -4
  375. package/src/surfaces/settings-deploy.json +2 -15
  376. package/src/surfaces/settings-deploy.ts +1 -1
  377. package/src/surfaces/settings-dialog.json +51 -0
  378. package/src/surfaces/settings-dialog.ts +169 -0
  379. package/src/surfaces/settings-overview.json +3 -3
  380. package/src/surfaces/settings-overview.ts +9 -2
  381. package/src/surfaces/settings-pane.json +269 -46
  382. package/src/surfaces/settings-pane.ts +85 -24
  383. package/src/surfaces/shell.json +2 -1
  384. package/src/surfaces/site-panel.json +1029 -0
  385. package/src/surfaces/site-panel.ts +233 -0
  386. package/src/surfaces/slash-menu.json +63 -21
  387. package/src/surfaces/slash-menu.ts +23 -0
  388. package/src/surfaces/statusbar.ts +39 -15
  389. package/src/surfaces/styles-panel.json +735 -0
  390. package/src/surfaces/styles-panel.ts +195 -0
  391. package/src/surfaces/styles-variables.json +149 -0
  392. package/src/surfaces/styles-variables.ts +145 -0
  393. package/src/surfaces/tab-strip.json +4 -4
  394. package/src/surfaces/welcome.ts +1 -1
  395. package/src/surfaces/writing-banner.json +94 -0
  396. package/src/surfaces/writing-banner.ts +80 -0
  397. package/src/tabs/bare-repeaters.ts +101 -0
  398. package/src/tabs/tab.ts +47 -7
  399. package/src/types.ts +21 -26
  400. package/src/ui/form-controls.ts +47 -8
  401. package/src/ui/layers.ts +13 -0
  402. package/src/ui/media-picker.ts +284 -40
  403. package/src/ui/regions.ts +7 -6
  404. package/src/ui/schema-form.ts +259 -27
  405. package/src/ui/virtual-window.ts +26 -1
  406. package/src/utils/base64.ts +3 -3
  407. package/src/utils/edit-display.ts +322 -67
  408. package/src/utils/local-day.ts +18 -0
  409. package/src/workspace/pane-derive.ts +4 -4
  410. package/src/workspace/session.ts +28 -7
  411. package/src/workspace/tab-workspace.ts +137 -0
  412. package/src/workspace/workspace-back.ts +189 -0
  413. package/src/workspace/workspace-home.ts +133 -0
  414. package/src/workspace/workspace-ids.ts +129 -0
  415. package/src/workspace/workspace-switch.ts +372 -0
  416. package/src/workspace/workspace.ts +125 -11
  417. package/styles/shell-frame.css +30 -7
  418. package/styles/shell-frame.json +15 -3
  419. package/dist/chunks/2020-f2gkpy8d.js +0 -4
  420. package/dist/chunks/adapter-4912g339.js +0 -4
  421. package/dist/chunks/cf-account-picker-wccaenh6.js +0 -4
  422. package/dist/chunks/cf-settings-br6105tr.js +0 -4
  423. package/dist/chunks/color-28ksk2qm.js +0 -4
  424. package/dist/chunks/components-db68vsn7.js +0 -4
  425. package/dist/chunks/content-source-1449qesq.js +0 -4
  426. package/dist/chunks/convert-to-repeater-5h457egj.js +0 -4
  427. package/dist/chunks/editor-x9jn86a7.js +0 -4
  428. package/dist/chunks/entry-commands-may24cpt.js +0 -4
  429. package/dist/chunks/extension-sections-pvr14vxr.js +0 -4
  430. package/dist/chunks/file-ops-x9v54pcj.js +0 -4
  431. package/dist/chunks/files-j3knqf0s.js +0 -4
  432. package/dist/chunks/format-host-tyre2trb.js +0 -4
  433. package/dist/chunks/fs-events-64ma9htc.js +0 -4
  434. package/dist/chunks/git-panel-84ps5dex.js +0 -4
  435. package/dist/chunks/iframe-entry-fvbk89gm.js +0 -5
  436. package/dist/chunks/iframe-host-ck6vejt5.js +0 -4
  437. package/dist/chunks/index-b8xw3vy9.js +0 -4
  438. package/dist/chunks/jsonMode-w15cmrcm.js +0 -13
  439. package/dist/chunks/jx-validate-at3zn8wa.js +0 -4
  440. package/dist/chunks/layers-h4xp1pss.js +0 -4
  441. package/dist/chunks/layers-panel-m5hw1d7g.js +0 -4
  442. package/dist/chunks/lit-html-8t8t3dnr.js +0 -4
  443. package/dist/chunks/media-picker-2cweexc5.js +0 -4
  444. package/dist/chunks/menu-ynw13y0s.js +0 -4
  445. package/dist/chunks/monaco-buffer-qzxn567r.js +0 -4
  446. package/dist/chunks/monaco-setup-gxf6656g.js +0 -4
  447. package/dist/chunks/notify-cj5zbrs2.js +0 -4
  448. package/dist/chunks/parse-b7ddhr8m.js +0 -4
  449. package/dist/chunks/platform-3dfws9js.js +0 -4
  450. package/dist/chunks/popover-jt2gxmzs.js +0 -4
  451. package/dist/chunks/publish-panel-1gvxbj21.js +0 -4
  452. package/dist/chunks/quick-search-0dajrwqg.js +0 -4
  453. package/dist/chunks/references-49qgt404.js +0 -4
  454. package/dist/chunks/right-panel-jm1bwe53.js +0 -4
  455. package/dist/chunks/section-registry-6kwc4fky.js +0 -4
  456. package/dist/chunks/studio-0rt52vpq.js +0 -5
  457. package/dist/chunks/studio-18vgbhs5.js +0 -5
  458. package/dist/chunks/studio-24mccdrj.js +0 -5
  459. package/dist/chunks/studio-2eh507zk.js +0 -9
  460. package/dist/chunks/studio-2hcbccfv.js +0 -5
  461. package/dist/chunks/studio-2jbs3rxv.js +0 -5
  462. package/dist/chunks/studio-4h8k4dw9.js +0 -5
  463. package/dist/chunks/studio-5f6n18kx.js +0 -5
  464. package/dist/chunks/studio-5gthpky6.js +0 -5
  465. package/dist/chunks/studio-6ep3js6b.js +0 -9
  466. package/dist/chunks/studio-6wkmf3wz.js +0 -9
  467. package/dist/chunks/studio-841rf3cg.js +0 -5
  468. package/dist/chunks/studio-8gmwgheg.js +0 -5
  469. package/dist/chunks/studio-8qm0ep50.js +0 -5
  470. package/dist/chunks/studio-924p1tm1.js +0 -6
  471. package/dist/chunks/studio-a3shpz9y.js +0 -5
  472. package/dist/chunks/studio-amsbaaar.js +0 -6
  473. package/dist/chunks/studio-at5spjbc.js +0 -7
  474. package/dist/chunks/studio-b2xv945e.js +0 -5
  475. package/dist/chunks/studio-bn5nkafw.js +0 -5
  476. package/dist/chunks/studio-bw6q5xjf.js +0 -9
  477. package/dist/chunks/studio-c7q0t9x1.js +0 -5
  478. package/dist/chunks/studio-camnhc96.js +0 -6
  479. package/dist/chunks/studio-cffqvnzd.js +0 -5
  480. package/dist/chunks/studio-efvfrsf8.js +0 -5
  481. package/dist/chunks/studio-er30bpcx.js +0 -5
  482. package/dist/chunks/studio-ezscgr64.js +0 -5
  483. package/dist/chunks/studio-ffrrncvz.js +0 -5
  484. package/dist/chunks/studio-fpphgn8y.js +0 -10
  485. package/dist/chunks/studio-j1kvhdjk.js +0 -4
  486. package/dist/chunks/studio-j430n16g.js +0 -7
  487. package/dist/chunks/studio-jjkg84nj.js +0 -5
  488. package/dist/chunks/studio-m0q32ars.js +0 -4
  489. package/dist/chunks/studio-m6bdst11.js +0 -5
  490. package/dist/chunks/studio-nv2cptd4.js +0 -64
  491. package/dist/chunks/studio-nwfrc98n.js +0 -5
  492. package/dist/chunks/studio-p1wgvp7r.js +0 -5
  493. package/dist/chunks/studio-pag2wncm.js +0 -5
  494. package/dist/chunks/studio-qvanvzfd.js +0 -5
  495. package/dist/chunks/studio-qwa64kt7.js +0 -5
  496. package/dist/chunks/studio-rk1zc4x3.js +0 -928
  497. package/dist/chunks/studio-se2r3ptc.js +0 -5
  498. package/dist/chunks/studio-sg2a0dh0.js +0 -5
  499. package/dist/chunks/studio-tjzjhe68.js +0 -5
  500. package/dist/chunks/studio-v2w7q8r1.js +0 -7
  501. package/dist/chunks/studio-v5vjq1h0.js +0 -4
  502. package/dist/chunks/studio-v8aga3vp.js +0 -14
  503. package/dist/chunks/studio-vfcdrfmv.js +0 -5
  504. package/dist/chunks/studio-vmfkgdjf.js +0 -5
  505. package/dist/chunks/studio-wt1816jj.js +0 -5
  506. package/dist/chunks/studio-wz73q5kq.js +0 -4
  507. package/dist/chunks/studio-y04qtxvp.js +0 -7
  508. package/dist/chunks/studio-y21g8zzg.js +0 -5
  509. package/dist/chunks/studio-y64hrt8p.js +0 -12
  510. package/dist/chunks/studio-ynn90f58.js +0 -16
  511. package/dist/chunks/studio-yxz682sx.js +0 -5
  512. package/dist/chunks/studio-zp7snvkq.js +0 -5
  513. package/dist/chunks/studio-zq4z6tm6.js +0 -5
  514. package/dist/chunks/toast-c9fn075p.js +0 -4
  515. package/dist/chunks/tsMode-sf49ee9x.js +0 -14
  516. package/dist/chunks/workspace-jtfahpee.js +0 -4
  517. package/src/panels/frontmatter-panel.ts +0 -711
  518. package/src/panels/git-panel.ts +0 -1108
  519. package/src/surfaces/doc-header.json +0 -776
  520. package/src/surfaces/doc-header.ts +0 -222
  521. package/src/surfaces/git-panel.json +0 -1880
  522. package/src/surfaces/git-panel.ts +0 -264
@@ -0,0 +1,5 @@
1
+ import{ge,ta,ne,g,he,Th,C}from"./studio-43sd2mam.js";import{Qd}from"./studio-kt3pjkwd.js";import{p}from"./studio-w4rz9hdk.js";import{Wi,cn,ur}from"./studio-z97c48fk.js";import{iI,BC,Io,JO,Ux,oI,rI,XO,wv}from"./studio-8tr6cfrc.js";import{bv,Y$,At,hi,$r,nc,x}from"./studio-gcxk20n7.js";import{$e,oe,vv,yv,nI}from"./studio-p4nrkvqr.js";import{n,Z,Xe,S,v,Yo,Ni,rd,rf}from"./studio-vxq7fcvv.js";import{le}from"./studio-qgh13jtz.js";var be=g(new Set);function Nm(e){be.add(e)}function Cx(e){be.delete(e)}function CC(e){return be.has(e)}function rv(e,t){return{success:!0,data:e,summary:t}}function ho(e){return{success:!1,error:e}}function bo({name:e,description:t,parameters:o,strict:r=!0,llmStrict:i=!1,interactive:s,execute:a}){let l={name:e,description:t,parameters:o,strict:r,llmStrict:i,execute:a};if(s!==void 0)l.interactive=s;return l}function kx(e){let t=[];return{record(o){t.push(o),e?.(o)},writes:t}}function gh(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 Kt=new AbortController().signal;function Ex(e={}){let t=e.session??gh();return{actor:e.actor??{id:`assistant:${t.sessionId??"local"}:`,kind:"assistant",sessionId:t.sessionId,turnId:""},callId:e.callId??"",ledger:e.ledger??kx(),progress:e.progress??(()=>{}),session:t,signal:e.signal??Kt}}function rO(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 A$(){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,d]of Object.entries(o)){let b=a[c];if(!b)continue;let y=b.type;if(!y)continue;let h=Ke(d);if(y==="number"||y==="integer"){if(xe(d,"number"))continue;if(xe(d,"string")){if(!Number.isNaN(Number(d)))continue;s.push(`Argument "${c}" should be a number, got non-numeric string "${d}"`);continue}s.push(`Argument "${c}" should be a number, got ${h}`);continue}if(y==="string"&&h!=="string")s.push(`Argument "${c}" should be a string, got ${h}`);else if(y==="boolean"&&h!=="boolean")s.push(`Argument "${c}" should be a boolean, got ${h}`);else if(y==="array"&&h!=="array")s.push(`Argument "${c}" should be an array, got ${h}`);else if(y==="object"&&h!=="object")s.push(`Argument "${c}" should be an object, got ${h}`)}return s.length>0?{valid:!1,errors:s}:{valid:!0}},async execute(t,o,r=Ex()){let i=e.get(t);if(!i)return ho(`Unknown tool: "${t}"`);let s=this.validate(t,o);if(!s.valid)return ho(`Validation failed: ${(s.errors||[]).join("; ")}`);try{return await i.execute(o,r)}catch(a){return ho(`Tool "${t}" execution error: ${ye(a)}`)}}}}function Ut(e){return JSON.parse(JSON.stringify(e))}function ye(e){return e.message}var Ht=["string","number","boolean","undefined"];function xe(e,t){return typeof e===t}function Gt(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function Ke(e){if(Array.isArray(e))return"array";return Ht.find((t)=>xe(e,t))??"object"}function zt(e){if(!e)return{};let t=JSON.parse(e);if(!Gt(t)){let o=t===null?"null":Ke(t);throw TypeError(`arguments must be a JSON object, got ${o}`)}return t}async function sO(e,t,o){let r=!1,i;try{let s=zt(t.argumentsText);r=!0,i=await e.execute(t.name,s,o)}catch(s){i=ho(`Failed to parse arguments: ${ye(s)}`)}try{return{status:"done",result:Ut(i),executed:r}}catch(s){let a=ye(s);return{status:"done",result:ho(`Tool "${t.name}" returned a result that cannot be serialized: ${a}`),executed:r}}}var G=[],Yt=50;function aO(e){return Object.assign(kx(),{turnId:e})}function lO(e,t){if(t.length===0)return[];let o={id:e,writes:[...t]};G.push(o);while(G.length>Yt)G.shift();return o.writes}function kC(e){return G.find((t)=>t.id===e)?.writes??[]}function cO(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 EC(){G.splice(0)}function dO(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}var qt=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"]),xC="^[A-Za-z]{2,8}(-[A-Za-z0-9]{1,8})*$";function Fn(e){if(!n(e)||e.trim()==="")return null;try{return new Intl.Locale(e.trim()).toString()}catch{return null}}function vx(e){return Fn(e)!==null}function Qb(e){let t=Fn(e);if(t===null)return"ltr";let o=new Intl.Locale(t),r=o.script??o.maximize().script;return r!==void 0&&qt.has(r)?"rtl":"ltr"}function Vt(e){let t=Fn(e);if(t===null)return n(e)?e:"";return new Intl.DisplayNames([t],{type:"language"}).of(t)??t}var Zt="prefix-except-default";function Qt(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=Fn(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=Fn(t.defaultLocale)??i[0]??null;if(t.defaultLocale!==void 0&&Fn(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:Zt;return{errors:o,i18n:{defaultLocale:s,locales:i,routing:a}}}function Hi(e,t){let o=Te(z(e),t);if(o===-1||t===null)return null;return Fn(z(e)[o])}function yx(e,t){let o=Hi(e,t);if(o!==null||t===null||t.routing!=="prefix-except-default")return o;return z(e)[0]==="pages"?t.defaultLocale:null}function ev(e,t){let o=z(e),r=Te(o,t);return r===-1?o.join("/"):o.filter((i,s)=>s!==r).join("/")}function Xc(e,t,o){if(o===null)return null;let r=Fn(t);if(r===null||!o.locales.includes(r))return null;let i=z(e),s=Te(i,o),a=s===-1?Xt(i):s;if(a===-1)return null;let l=s===-1?i:i.filter((c,d)=>d!==s);if(r===o.defaultLocale&&o.routing==="prefix-except-default")return l.join("/");return l.toSpliced(a,0,r.toLowerCase()).join("/")}function z(e){return e.replace(/^\.\//,"").split("/").filter(Boolean)}function Te(e,t){if(t===null)return-1;return e.findIndex((o)=>{let r=Fn(o);return r!==null&&t.locales.includes(r)})}function Xt(e){if(e[0]==="pages"&&e.length>1)return 1;if(e[0]==="content"&&e.length>2)return 2;return-1}function nO(e,t){if(t===null)return null;let o=e.split("/").find(Boolean);if(o===void 0)return t.defaultLocale;let r=Fn(o);return r!==null&&t.locales.includes(r)?r:t.defaultLocale}function P$(e,t){if(!n(t)||t==="")return e;let o=e.indexOf("#"),r=o===-1?"":e.slice(o),i=o===-1?e:e.slice(0,o),s=i.indexOf("?"),a=s===-1?i:i.slice(0,s),c=(s===-1?[]:i.slice(s+1).split("&")).filter((d)=>d!==""&&!en(d));return c.push(`v=${encodeURIComponent(t)}`),`${a}?${c.join("&")}${r}`}function en(e){let t=e.indexOf("="),o=t===-1?e:e.slice(0,t);if(o==="v")return!0;if(!o.includes("%"))return!1;try{return decodeURIComponent(o)==="v"}catch{return!1}}function tn(e,t){if(!e||!Object.hasOwn(e,t))return;let o=e[t];return n(o)?o:void 0}function cv(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||!BC.test(a))continue;let c=on(l.source);if(c===""||c.startsWith(".."))continue;if(c.includes(Io)){let d=nn(r,c,a,o);if(d)s(d.dir,d.urlPrefix);continue}if(/\.[a-z0-9]+$/i.test(c))continue;s(c,`/${iI}/${a}`)}return i}function nn(e,t,o,r){let i=t.indexOf(Io),s=t.slice(0,i),a=t.slice(i+Io.length);if(!e.startsWith(s))return null;let l=e.slice(s.length).split("/")[0]??"";if(l===""||!BC.test(l))return null;let c=r.find((b)=>b.toLowerCase()===l.toLowerCase());if(c===void 0||!BC.test(c))return null;return{dir:`${s}${l}${a}`.replace(/\/+$/,""),urlPrefix:`/${iI}/${o}/${c}`}}function on(e){return e.replaceAll("\\","/").replace(/^\.\//,"").replace(/\/+$/,"")}function dv(e,t){if(!t||e==="")return null;if(t.space==="repo"){if(!t.fileBaseUrl)return null;let r=XO(e,t.documentDir,t.mounts,t.lanes);if(r===null)return null;let{suffix:i}=Ux(e);return P$(`${t.fileBaseUrl}${wv(r)}${i}`,tn(t.versions,r))}let[o]=t.mounts;return o?rn(e,t.documentDir,o):null}function rn(e,t,o){if(oI(e))return null;let{path:r,suffix:i}=Ux(e),s;try{s=decodeURIComponent(r)}catch{return null}let a=rI(t,s);if(a===null)return null;let l=JO([o],a);if(!l)return null;return`${l}${i}`}function Ue(e){return e.replaceAll(/[.*+?^${}()|[\]\\]/g,String.raw`\$&`)}function q(e){return e.replaceAll("\\","/").replace(/^\.\//,"").replace(/\/+$/,"")}function He(e){return e??x?.projectConfig??null}function Ge(e){return e?.content??{}}function sn(e){let t=Qt(e??{}).i18n?.locales??[];return t.length>0?[...t]:null}function ze(e){if(e.endsWith("/"))return!1;let t=e.slice(e.lastIndexOf("/")+1);return/\.[a-z\d]+$/i.test(t)}function Ye(e){if(e.format==="json")return{ext:".json",unresolvedFormat:null};if(e.format===void 0||e.format==="")return{ext:ur()?.extensions[0]??".json",unresolvedFormat:null};let t=Wi(e.format);return t?.extensions[0]===void 0?{ext:null,unresolvedFormat:e.format}:{ext:t.extensions[0],unresolvedFormat:null}}function an(e,t){let o=t===null?"[^/]+":`(?:${t.map((i)=>Ue(i)).join("|")})`,r=q(e).split(Io).map((i)=>Ue(i)).join(o);return new RegExp(`^${r}(?:/|$)`,"i")}function un(e,t,o){let r=an(e,o).exec(t);if(!r)return null;return r[0].replace(/\/$/,"")}function dn(e){return q(e).replaceAll(Io,"").length}function Jd(e,t){if(e===null||e===void 0||e==="")return null;let o=He(t),r=sn(o),i=q(e),s=null,a=-1;for(let[l,c]of Object.entries(Ge(o))){let{source:d}=c;if(d===void 0||d===""||ze(d))continue;let b=dn(d);if(b<=a)continue;let y=un(d,i,r);if(y===null)continue;s={def:c,dir:i,fileBacked:!1,isSourceRoot:i.length===y.length,name:l,...Ye(c)},a=b}return s}function Un(e,t){if(e===null||e===void 0||e==="")return null;let o=He(t),r=q(e),i=r.toLowerCase();for(let[s,a]of Object.entries(Ge(o))){let{source:l}=a;if(l===void 0||l===""||!ze(l))continue;let c=q(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,...Ye(a)}}return Jd(r.includes("/")?r.slice(0,r.lastIndexOf("/")):".",o)}function ed(e){return e.replaceAll(/([A-Z])/g," $1").replace(/^./,(t)=>t.toUpperCase())}function Fx(e){return e.replaceAll(/[^a-zA-Z0-9]+(.)?/g,(t,o)=>o?o.toUpperCase():"").replace(/^[A-Z]/,(t)=>t.toLowerCase())}function jx(e){return e.replaceAll(/(^|-)(\w)/g,(t,o,r)=>(o?" ":"")+r.toUpperCase())}function RC(e,t){return e?.$label||ed(t)}function NO(e,t){if(e?.$label)return e.$label;if(t.includes("-"))return t.replaceAll(/(^|-)(\w)/g,(o,r,i)=>(r?" ":"")+i.toUpperCase());return ed(t)}function Ra(e){return e==="image"||e==="uri-reference"}function vh(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(Ra(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 yh(e,t){if(!e||!t?.content)return null;let o=Un(e,t);if(!o||!o.def.schema)return null;if(!o.fileBacked){let r=o.ext??ur()?.extensions[0]??".json";if(!e.toLowerCase().endsWith(r.toLowerCase()))return null}return{name:o.name,schema:o.def.schema}}function uv(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 Hx(e,t){return e.replace(new RegExp(`^${t.replaceAll(/[.*+?^${}()|[\]\\]/g,String.raw`\$&`)}`),"").replace(/^--/,"").replaceAll("-"," ").replaceAll(/\b\w/g,(o)=>o.toUpperCase())||e}function AO(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 Jo(e){return JSON.parse(JSON.stringify(e))}function Me(e){return e?.at(-1)??null}function pO(e){return e?.[0]??null}function Tx(e,t){if(!t||!e)return!1;return e.some((o)=>$r(o,t))}function ea(e){return _(e)}function _(e){let t=[];for(let o of e)t.push([...o]);return t}function Lx(e,t){if(Tx(e,t))return _(e.filter((o)=>!$r(o,t)));return[..._(e),[...t]]}function fO(e,t,o){let r=e.findIndex((a)=>$r(a,o)),i=t?e.findIndex((a)=>$r(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 _(s)}function qe(e,t){return _(e.filter((o)=>!nc(t,o)))}function pn(e,t){let o=Math.min(e.length,t.length);for(let r=0;r<o;r++){let i=e[r],s=t[r];if(i===s)continue;if(Z(i)&&Z(s))return i-s;return String(i)<String(s)?-1:1}return e.length-t.length}function mn(e){return _(e.filter((t)=>!e.some((o)=>!$r(o,t)&&nc(o,t))))}function Mm(e){return V(e)!==null}function V(e){let t=e?.at(-1);return e&&e.at(-2)==="children"&&Z(t)?{index:t,parentPath:e.slice(0,-2)}:null}function $x(e){return mn(e).filter((t)=>Mm(t)).toSorted((t,o)=>pn(o,t))}function mO(e){let t=[];for(let o of e)if(!t.some((r)=>$r(r,o)))t.push([...o]);return t}function Pm(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 Ze=null;function gO(e){Ze=e}function Qe(){return Ze}var X=null,Q=null,ee=null,ve=!0;function et(){X=[],Q=[],ee=[],ve=!0}function f(e){if(X)X.push(e)}function Bi(e){if(Q)Q.push(e)}function tt(e){if(ee)ee.push(e)}function nt(){let e={docOps:Q??[],fmOps:ee??[],invertible:ve,ops:X??[]};return X=null,Q=null,ee=null,ve=!0,e}var ot=100,gn=20;function te(){try{return typeof localStorage>"u"||!localStorage.getItem("jx-legacy-history")}catch{return!0}}function R(e,t){let o=oe(e,t);if(!o)throw TypeError(`No node at path [${t.join(", ")}]`);return o}function w(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}}}function bn(e,t,o,r,i){let s=e.length,a=s<t.length&&e.every((d,b)=>d===t[b]),l=t[s+1];if(!a||t[s]!=="children"||!Z(l))return t;if(i?l<o:l<=o)return t;let c=[...t];return c[s+1]=l+r,c}var rt=null;function it(e){rt=e}var st=null;function at(e){st=e}function yn(e,t,o,r){for(let i=t.docOps.length-1;i>=0;i--)yv(e.doc.document,he(t.docOps[i].inverse));for(let i=t.fmOps.length-1;i>=0;i--){let s=t.fmOps[i];we(e,s.field,s.before)}e.doc.document={...he(e.doc.document)},e.session.selection=o,e.doc.dirty=r}function Y(e,t,{skipHistory:o=!1,origin:r="user",coalesceKey:i=null}={}){if(!e)return!1;if(r!=="remote"&&st?.(e,r))return!1;let s=ea(e.session.selection),a=e.doc.dirty;et();let l,c=null;try{t(e)}catch(J){c={error:J}}finally{l=nt()}if(c)throw yn(e,l,s,a),c.error;let d=he(e.doc.document),b={...d},y=Qe(),h=y===null?{patchable:!1,reason:"no-patch-consumer"}:l.ops.length===0?{patchable:!1,reason:"unrecorded-mutation"}:y.classify(e,l.ops);if(h.patchable)y.markConsumed(b,e);if(e.doc.document=b,h.patchable)try{y.apply(e,l.ops,l)}catch(J){y.escalate(`patch-apply-failed: ${J instanceof Error?J.message:String(J)}`,e)}if(!o&&!W)hn(e,d,l,s,i);return e.doc.dirty=!0,rt?.(e,l,r),!0}function hn(e,t,o,r,i=null){let s=e.history.snapshots.slice(0,e.history.index+1),a=te()&&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((d)=>d.forward)],l.inverseOps=[...l.inverseOps,...o.docOps.map((d)=>d.inverse)],l.selection=ea(e.session.selection),l.document)l.document=Jo(t);e.history.snapshots=s,e.history.index=s.length-1;return}let c=!a||s.length%gn===0;if(s.push({document:c?Jo(t):null,fmOps:a&&o.fmOps.length>0?o.fmOps:null,forwardOps:a?o.docOps.map((d)=>d.forward):null,inverseOps:a?o.docOps.map((d)=>d.inverse):null,coalesceKey:i,selection:ea(e.session.selection),selectionBefore:r}),s.length>ot){if(!s[1].document)s[1].document=Oe(s,1);s.shift()}e.history.snapshots=s,e.history.index=s.length-1}function Oe(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=Jo(r);for(let s=o+1;s<=t;s++)for(let a of e[s].forwardOps??[])yv(i,a);return i}function qd(e,t,o){return Y(e,(r)=>t(r.doc.document),o)}function Pe(e,t){Y(e,(o)=>{for(let r of t)Ce(o,r)},{origin:"remote",skipHistory:!0})}var xn=new Set(["state","$media","$head","$elements","imports","$layout"]);function Ce(e,t){let o=null;if(t.op==="set-key")o=oe(e.doc.document,t.path)?.[t.key];switch(yv(e.doc.document,t),Bi({forward:t,inverse:t}),t.op){case"set-key":{if(xn.has(t.key))f({key:t.key,op:"doc-meta"});else if(t.key==="style")f({op:"set-style",path:t.path});else if(t.key==="textContent")f({op:"set-text",path:t.path});else if(t.key==="attributes"||t.key==="cases"||t.key==="$props")f({op:"replace",path:t.path});else{let r=t.key.startsWith("on")&&(rf(t.value)||rf(o));f({isEvent:r,key:t.key,op:"set-prop",path:t.path})}return}case"insert-child":{f({index:t.index,op:"insert",parentPath:t.parentPath});return}case"remove-child":{f({op:"remove",path:[...t.parentPath,"children",t.index]});return}case"set-child":{f({op:"replace",path:[...t.parentPath,"children",t.index]});return}case"move-child":{f({fromPath:[...t.fromParentPath,"children",t.fromIndex],op:"move",toIndex:t.toIndex,toParentPath:t.toParentPath});break}default:break}}var W=null,lt=null;function ct(e){lt=e}function Ix(e){W=e}function Rx(){let e=W;if(e&&!L.has(e)){let t=he(e.doc.document),o={document:Jo(t),selection:ea(e.session.selection)},r=e.history.snapshots.slice(0,e.history.index+1);if(r.push(o),r.length>ot)r.shift();e.history.snapshots=r,e.history.index=r.length-1}if(W=null,e)lt?.(e)}function LC(){return W!==null}function bO(){return W}var L=new WeakMap;function av(e,t){if(t)L.set(e,t);else L.delete(e)}function vO(e){let t=L.get(e);return t?t.canUndo(e):e.history.index>0}function yO(e){let t=L.get(e);return t?t.canRedo(e):e.history.index<e.history.snapshots.length-1}function ut(e,t){let{snapshots:o}=e.history;e.doc.document=Oe(o,t);let r=o[t];e.session.selection=ea(he(r.selection))}function dt(e,t){try{if(typeof localStorage>"u"||!localStorage.getItem("jx-canvas-debug"))return}catch{return}let o=JSON.stringify(Oe(e.history.snapshots,t)),r=JSON.stringify(Jo(he(e.doc.document)));if(o!==r)console.error("jx history: ops-based undo/redo diverged from checkpoint replay",{index:t})}function $C(e){let t=L.get(e);if(t){t.undo(e);return}if(e.history.index<=0)return;let o=e.history.snapshots[e.history.index],r=te()?o.inverseOps:null,i=te()?o.fmOps:null;if(r&&r.length>0||i&&i.length>0){if(!Y(e,(a)=>{if(r)for(let l=r.length-1;l>=0;l--)Ce(a,he(r[l]));if(i)for(let l=i.length-1;l>=0;l--){let c=he(i[l]);we(a,c.field,c.before)}},{origin:"history",skipHistory:!0}))return;e.session.selection=ea(he(o.selectionBefore??[])),e.history.index-=1,dt(e,e.history.index)}else e.history.index-=1,ut(e,e.history.index);e.doc.dirty=!0}function wO(e){let t=L.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=te()?o.forwardOps:null,i=te()?o.fmOps:null;if(r&&r.length>0||i&&i.length>0){if(!Y(e,(a)=>{if(r)for(let l of r)Ce(a,he(l));if(i)for(let l of i){let c=he(l);we(a,c.field,c.after)}},{origin:"history",skipHistory:!0}))return;e.session.selection=ea(he(o.selection)),e.history.index+=1,dt(e,e.history.index)}else e.history.index+=1,ut(e,e.history.index);e.doc.dirty=!0}function Lo(e,t,o,r){let i=oe(e.doc.document,t);if(!i)return;vv(i).splice(o,0,structuredClone(r)),f({index:o,op:"insert",parentPath:t}),Bi({forward:{index:o,node:$e(r),op:"insert-child",parentPath:t},inverse:{index:o,op:"remove-child",parentPath:t}})}function bh(e,t){let o=V(t);if(!o)return;let{index:r,parentPath:i}=o,[s]=R(e.doc.document,i).children.splice(r,1);f({op:"remove",path:t}),Bi({forward:{index:r,op:"remove-child",parentPath:i},inverse:{index:r,node:$e(s),op:"insert-child",parentPath:i}}),e.session.selection=qe(e.session.selection,t)}function M$(e,t){let o=V(t);if(!o)return;let r=oe(e.doc.document,t);if(!r)return;let{index:i,parentPath:s}=o,a=structuredClone(he(r));R(e.doc.document,s).children.splice(i+1,0,a),f({index:i+1,op:"insert",parentPath:s}),Bi({forward:{index:i+1,node:$e(a),op:"insert-child",parentPath:s},inverse:{index:i+1,op:"remove-child",parentPath:s}}),e.session.selection=[[...s,"children",i+1]]}function Fm(e,t){for(let o of $x(t))bh(e,o)}function Dx(e,t){let o=[];for(let r of $x(t)){let i=e.session.selection;M$(e,r);let s=Me(e.session.selection),a=V(s);if(!s||!a||e.session.selection===i)continue;o=o.map((l)=>bn(a.parentPath,l,a.index,1,!0)),o.unshift(s)}if(o.length>0)e.session.selection=o}function xO(e,t,o="div"){let r=V(t);if(!r)return;let i=oe(e.doc.document,t);if(!i)return;let{index:s,parentPath:a}=r,l={children:[structuredClone(he(i))],tagName:o},c=$e(i);R(e.doc.document,a).children.splice(s,1,l),f({op:"replace",path:t}),Bi({forward:{index:s,node:$e(l),op:"set-child",parentPath:a},inverse:{index:s,node:c,op:"set-child",parentPath:a}}),e.session.selection=[[...a,"children",s]]}function Qc(e,t,o,r){let i=e.doc.document,s=At(t),a=hi(t);if(!s||!Z(a))return;let l=oe(i,s),c=oe(i,o);if(!l||!Array.isArray(l.children)||!c)return;if(l.children[a]===void 0)return;let d=r;if(l===c&&a<r)d-=1;let b={fromIndex:a,fromParentPath:s,op:"move-child",toIndex:d,toParentPath:o},y=nI(i,b),[h]=l.children.splice(a,1);if(vv(c).splice(d,0,h),f({fromPath:t,op:"move",toIndex:d,toParentPath:o}),Bi({forward:b,inverse:y}),$r(Me(e.session.selection),t)){let J=r;if(s.length===o.length&&s.every((E,F)=>E===o[F])&&a<r)J=r-1;e.session.selection=[[...o,"children",J]]}}function Ve(e,t,o,r){let i=oe(e.doc.document,t);if(!i)return;let s=i[o],a=$e(s);if(r===void 0||r===null||r==="")delete i[o];else i[o]=r;if(Bi(w(t,o,a,$e(i[o]))),o==="textContent")f({op:"set-text",path:t});else if(o==="style")f({op:"set-style",path:t});else{let l=r===void 0||r===null||r===""?s:r,c=o.startsWith("on")&&rf(l);f({isEvent:c,key:o,op:"set-prop",path:t})}}function Gd(e,t,o,r){let i=R(e.doc.document,t),s=$e(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;Bi(w(t,"style",s,$e(i.style))),f({op:"set-style",path:t})}function Tr(e,t,o,r){let i=R(e.doc.document,t),s=$e(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;Bi(w(t,"attributes",s,$e(i.attributes))),f({attr:o,op:"set-attr",path:t})}function _O(e,t,o,r,i){if(!o)return Gd(e,t,r,i);let s=R(e.doc.document,t),a=$e(s.style);if(!s.style)s.style={};let l=`@${o}`,c=rd(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;Bi(w(t,"style",a,$e(s.style))),f({op:"set-style",path:t})}function Nx(e,t,o,r,i){let s=R(e.doc.document,t),a=$e(s.style);if(!s.style)s.style={};let l=rd(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;Bi(w(t,"style",a,$e(s.style))),f({op:"set-style",path:t})}function SO(e,t,o,r,i,s){let a=R(e.doc.document,t),l=$e(a.style);if(!a.style)a.style={};let c=`@${o}`,d=rd(a.style,c),b=rd(d,r);if(s===void 0||s===""){if(delete b[i],Object.keys(b).length===0)delete d[r];if(Object.keys(d).length===0)delete a.style[c]}else b[i]=s;if(Object.keys(a.style).length===0)delete a.style;Bi(w(t,"style",l,$e(a.style))),f({op:"set-style",path:t})}function ft(e,t){let o=[e];for(let r of t){let i=Ni(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=Ni(i,s);if(a&&Object.keys(a).length===0)delete i[s]}}function Ax(e,t,o,r,i){let s=R(e.doc.document,t),a=$e(s.style);if(!s.style)s.style={};let l=s.style;for(let c of o)l=rd(l,c);if(i===void 0||i==="")delete l[r],ft(s.style,o);else l[r]=i;if(Object.keys(s.style).length===0)delete s.style;Bi(w(t,"style",a,$e(s.style))),f({op:"set-style",path:t})}function CO(e,t,o,r,i,s){let a=R(e.doc.document,t),l=$e(a.style);if(!a.style)a.style={};let c=`@${o}`,d=rd(a.style,c),b=d;for(let y of r)b=rd(b,y);if(s===void 0||s===""){if(delete b[i],ft(d,r),Object.keys(d).length===0)delete a.style[c]}else b[i]=s;if(Object.keys(a.style).length===0)delete a.style;Bi(w(t,"style",l,$e(a.style))),f({op:"set-style",path:t})}function kO(e,t,o){let r=R(e.doc.document,t),i=$e(r.style);if(o&&Object.keys(o).length>0)r.style=o;else delete r.style;Bi(w(t,"style",i,$e(r.style))),f({op:"set-style",path:t})}function Ia(e,t,o){let r=e.doc.document,i=$e(r.state);if(!r.state)r.state={};r.state[t]=o,Bi(w([],"state",i,$e(r.state))),f({key:"state",op:"doc-meta"})}function Ox(e,t){let o=e.doc.document;if(o.state){let r=$e(o.state);if(delete o.state[t],Object.keys(o.state).length===0)delete o.state;Bi(w([],"state",r,$e(o.state))),f({key:"state",op:"doc-meta"})}}function Gr(e,t,o){let r=e.doc.document,i=$e(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];Bi(w([],"state",i,$e(r.state))),f({key:"state",op:"doc-meta"})}function EO(e,t,o){let r=e.doc.document;if(!r.state||!r.state[t])return;let i=$e(r.state);r.state[o]=r.state[t],delete r.state[t],Bi(w([],"state",i,$e(r.state))),f({key:"state",op:"doc-meta"})}function Vp(e,t,o,r){let i=R(e.doc.document,t),s=$e(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;Bi(w(t,"$props",s,$e(i.$props))),f({op:"replace",path:t})}function TO(e,t,o,r){let i=R(e.doc.document,t),s=$e(i.cases);if(!i.cases)i.cases={};i.cases[o]=r||{tagName:"div",textContent:o},Bi(w(t,"cases",s,$e(i.cases))),f({op:"replace",path:t})}function LO(e,t,o){let r=R(e.doc.document,t);if(r.cases){let i=$e(r.cases);delete r.cases[o],Bi(w(t,"cases",i,$e(r.cases))),f({op:"replace",path:t})}}function $O(e,t,o,r){let i=R(e.doc.document,t);if(!i.cases||!i.cases[o])return;let s=$e(i.cases);i.cases[r]=i.cases[o],delete i.cases[o],Bi(w(t,"cases",s,$e(i.cases))),f({op:"replace",path:t})}function Kd(e,t,o){let r=e.doc.content.frontmatter,i=Object.hasOwn(r,t)?$e(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:$e(o);tt({after:a,before:i,field:t}),e.doc.dirty=!0}function we(e,t,o){if(o===void 0)delete e.doc.content.frontmatter[t];else e.doc.content.frontmatter[t]=o}function Am(e){let t=new Set,o=new Set;return bv(e,(r,i)=>{t.add(r),o.add(JSON.stringify(i))}),t.size===0?null:{fingerprints:o,pointers:t}}function uO(e,t){if(!t)return e;return Re(e,"",t)}function Re(e,t,o){if(Array.isArray(e)){let i=null;for(let[s,a]of e.entries()){let l=Re(a,`${t}/${s}`,o);if(l!==a)i??=[...e],i[s]=l}return i??e}if(!v(e))return e;let r=null;for(let[i,s]of Object.entries(e)){let a=Re(s,`${t}/${Y$(i)}`,o);if(i==="children"&&Array.isArray(a)&&a.length===1){let[l]=a;if(Yo(l)&&(o.pointers.has(t)||o.fingerprints.has(JSON.stringify(l))))a=l}if(a!==s)r??={...e},r[i]=a}return r??e}var _C=["design","content","media","styles","publish"],wx="design",tv=[{icon:"frame-corners",id:"design",title:"Design"},{icon:"file-text",id:"content",title:"Content"},{icon:"image",id:"media",title:"Media"},{icon:"paint-brush",id:"styles",title:"Styles"},{icon:"paper-plane-tilt",id:"publish",title:"Publish"}];function N$(e){return typeof e==="string"&&_C.some((t)=>t===e)}function nv(e){return tv.find((t)=>t.id===e)}var Ae="workspace://",xx={content:"content-home",media:"media-home",publish:"publish-home"};function Wp(e){return Object.hasOwn(xx,e)}function Xl(e){return`${Ae}${e}`}function ll(e){if(!e.startsWith(Ae))return null;let t=e.slice(Ae.length);return N$(t)&&Wp(t)?t:null}function iv(e){let t=ll(e);return t?nv(t).title:null}var Tn=new Map([["design","canvas"],["edit","canvas"],["entry","entry"],["git-diff","diff"],["grid","grid"],["content-home","home"],["media-home","home"],["publish-home","home"],["media","media"],["preview","canvas"],["source","code"],["stylebook","config"],["tokens","tokens"]]),Dm={canvas:"Canvas",code:"Code",config:"Elements",diff:"Diff",entry:"Entry",grid:"Grid",home:"Home",media:"Media",none:"None",tokens:"Variables"};function Qs(e){return Tn.get(e)??"canvas"}var vn=new Map([["design","design"],["edit","edit"],["preview","preview"]]);function iO(e){return vn.get(e)??"design"}var _x=(e)=>e.editor.kind==="canvas",mh=(e)=>_x(e)&&e.selection.count>0,Sx=(e)=>mh(e)&&!e.selection.isRoot;function ov(){return{project:{open:!1,isSite:!1,isRepo:!1,isMultilingual:!1},git:{ahead:0,behind:0,dirtyCount:0},workspace:{id:wx},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,dataRows:!1,windowControls:!1,findReferences:!1,readFileBytes:!1,publish:!1}}}function SC(e={}){let t=ov();for(let o of Object.keys(e)){let r=e[o];if(r)Object.assign(t[o],r)}return t}var On=["palette"],Pn=["caret","global"],Sn=["dock","global"],Cn=["canvas","global"],wn=["grid","global"],Rn=["code","global"],pt=["global"];function oO(e){if(e.modal.open)return On;if(e.caret.active)return Pn;if(e.focus.region!=="pane")return Sn;switch(e.editor.kind){case"grid":return wn;case"code":return Rn;case"canvas":return e.canvas.view==="preview"?pt:Cn;default:return pt}}var ln="project.json";function An(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 Jn=["edit","design","preview","source","stylebook","git-diff"];function sv({id:e,documentPath:t=null,fileHandle:o=null,document:r,frontmatter:i,sourceFormat:s=null,capabilities:a,openedFrom:l=null,preview:c=!1,layout:d=null,source:b=null,canvasMode:y}){let h=ge(),J=Am(r),E=a?.modes??In(t,s),F=y??E.find((T)=>T!=="preview")??"edit",ce=E[0]==="preview",j={bareRepeaters:J,content:{frontmatter:i||{}},dirty:!1,document:r,handlersSource:null,layout:d,mode:kn(t,s),source:b,sourceFormat:s},ue={index:0,snapshots:[{document:structuredClone(r),selection:[]}]},H={canvas:{refreshing:!1,error:null,livePreviews:null,pendingInlineEdit:null,scope:null,status:"idle"},clipboard:null,hover:null,openedFrom:l,selection:[],ui:An(F,ce)};return h.run(()=>({capabilities:{modes:E},doc:g(j),documentPath:t,fileHandle:o,history:g(ue),id:e,pinned:!1,preview:c,scope:h,session:g(H)}))}function In(e,t){if(e===ln)return["stylebook","tokens","source"];let o=Wi(t)??cn(e);if(o)return o.studio?.modes??["edit","design","preview","source"];return Jn}function kn(e,t){let o=Wi(t)??cn(e);if(o)return o.studio?.documentMode?.default??"content";return"component"}function TC(e){return Qs(e.session.ui.canvasMode)}function O$(e){let t=[];for(let o of e.capabilities.modes){if(o==="preview")continue;let r=Qs(o);if(!t.includes(r))t.push(r)}return t}function hO(e,t){return e.capabilities.modes.find((o)=>o!=="preview"&&Qs(o)===t)}function Om(e){e.scope.stop()}var mt=new WeakMap,B=new Map;function Ln(e){let t=he(e),o=mt.get(t);if(!o)o=g({active:!1,attachError:"",peers:[],readOnly:!1,sourceCanonical:!1,status:"unavailable"}),mt.set(t,o);return o}function gt(e){B.set(e,(B.get(e)??0)+1)}function bt(e){let t=B.get(e)??0;if(t<=1)B.delete(e);else B.set(e,t-1)}function lv(e){return B.has(e.replaceAll("\\","/"))}var Dn=8000,jn=800,En=2500,yt=null;function Mn(){return yt??=(le("f0jn7nnp"),import("./index-f0jn7nnp.js")),yt}function xt(){try{return p()}catch{return null}}var K=null;function OO(e){K=e}var Ie=null;function MO(e){Ie=e}var Tt=()=>{};function PO(e){Tt=e??(()=>{})}var ke=new WeakMap;function vt(e){return he(e)}function De(e,t){return e.frontmatterMap(t)}function Nn(e){return e.synced}function D(e){return ke.get(vt(e))}function Ne(e){let t=vt(e),o=ke.get(t);if(!o)o={attaching:null,generation:0,optedOut:g({value:!1}),session:null,watcherInstalled:!1},ke.set(t,o);return o}var ht=!1;function $n(){if(ht)return;ht=!0,it(_n),ct(Wn),at((e)=>{if(D(e)?.session?.synced&&Ln(e).sourceCanonical)return Tt("Source editing in progress — structural edits are paused"),"source-canonical";return null})}function _n(e,t,o){let r=D(e)?.session;if(!r||!r.synced)return;if(r.lastSeenRef=he(e.doc.document),o==="remote"){fe(r);return}if(r.canWrite)Bn(r,t),fe(r)}function Wn(e){let t=D(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)re(t);else if(o.length>0)try{t.collab.applyDocOpsToY(t.handle.doc,o,t.collab.LOCAL_ORIGIN)}catch{re(t)}t.undoManager?.stopCapturing()}function Bn(e,t){let o=t.docOps.map((r)=>r.forward);if(LC()){if(e.batchOps??=[],o.length===0)e.batchNeedsDiff=!0;else e.batchOps.push(...o);return}if(o.length===0){re(e);return}try{e.collab.applyDocOpsToY(e.handle.doc,o,e.collab.LOCAL_ORIGIN)}catch{re(e)}}function re(e){let{collab:t,handle:o,tab:r}=e,i=t.yDocToJson(o.doc),s=Jo(he(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 Je(e){let t=e.collab.yDocToJson(e.handle.doc);Y(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 Kn(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 fe(e){if(!K||!Kn(e))return;if(e.collab.canonicalOf(e.handle.doc)==="source")return;let t=Date.now();if(e.lastMirrorAt??=t,t-e.lastMirrorAt>=En){if(e.mirrorTimer)clearTimeout(e.mirrorTimer),e.mirrorTimer=null;e.lastMirrorAt=t,je(e);return}if(e.mirrorTimer)clearTimeout(e.mirrorTimer);e.mirrorTimer=setTimeout(()=>{e.mirrorTimer=null,e.lastMirrorAt=Date.now(),je(e)},jn)}async function je(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 Ot(e){if(!Ie||!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 Ie(r,s)}catch{return}if(!Nn(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=De(t,o.doc),d=a.frontmatter??{};o.doc.transact(()=>{let b=[...c.keys()];for(let y of b)if(!(y in d))c.delete(y);for(let[y,h]of Object.entries(d))if(!t.deepEqual(c.get(y),h))c.set(y,h)},t.MIRROR_ORIGIN)}function FO(e){let t=D(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)Ot(t).then(()=>{o.releaseSourceCanonical(r.doc,o.LOCAL_ORIGIN)})},localOrigin:o.LOCAL_ORIGIN,readOnly:!t.canWrite,text:o.sourceText(r.doc)}}function hv(e){let t=Ln(e);return t.active&&t.readOnly}async function H$(e){let t=D(e)?.session;if(!t?.synced||!t.canWrite)return!1;if(t.mirrorTimer)clearTimeout(t.mirrorTimer),t.mirrorTimer=null;return await je(t),await t.handle.flush(),!0}async function jO(){for(let e of Ee)if(D(e)?.session?.synced)await H$(e)}var Ee=new Set;function ie(e){if(!xt()?.collab||!e.documentPath||e.documentPath===ln)return;let o=Ne(e);if(o.watcherInstalled)return;o.watcherInstalled=!0,$n(),Ee.add(e),e.scope.run(()=>{ne(()=>{if(o.optedOut.value)pe(e);else Le(e)}),ta(()=>{Ee.delete(e),pe(e)})})}function B$(e,t){let o=Ne(e);if(o.optedOut.value===!t)return;if(o.optedOut.value=!t,!o.watcherInstalled&&t)ie(e)}function z$(e){return D(e)?.optedOut.value!==!0}function Pt(e){if(!D(e)?.watcherInstalled){ie(e);return}pe(e),Le(e)}async function Le(e){let t=Ne(e);if(t.session||t.attaching)return;let{documentPath:o}=e,r=xt();if(!o||!r?.collab){Ln(e).status="unavailable";return}let{generation:i}=t,s=Ln(e);s.status="connecting",s.attachError="";let a=(async()=>{try{let[l,c]=await Promise.all([Mn(),r.collab(o)]);if(!c){s.status="detached";return}if(t.generation!==i){c.destroy();return}let d,b=new Promise((y,h)=>{d=setTimeout(()=>h(Error("collab-sync-timeout")),Dn)});try{await Promise.race([c.whenSynced,b])}finally{clearTimeout(d)}if(t.generation!==i){c.destroy();return}t.session=Hn(e,o,l,c),s.active=!0,s.status="synced",s.readOnly=!t.session.canWrite,s.attachError="",gt(o)}catch(l){s.status="failed",s.active=!1,s.attachError=l instanceof Error?l.message:String(l),C.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 pe(e){let t=D(e);if(!t)return;t.generation+=1;let{session:o}=t;t.session=null;let r=Ln(e);if(r.active=!1,r.status="detached",r.attachError="",r.peers=[],!o)return;if(bt(o.path),o.mirrorTimer)clearTimeout(o.mirrorTimer);if(o.sourceParseTimer)clearTimeout(o.sourceParseTimer);for(let i of o.disposers)try{i()}catch{}av(e,null),e.history.snapshots=[{document:Jo(he(e.doc.document)),selection:ea(e.session.selection)}],e.history.index=0,o.undoManager?.destroy(),o.handle.destroy()}function Hn(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:he(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=Jo(he(e.doc.document));if(!o.deepEqual(T,O)){let I=o.diffDocs(O,T);if(I===null)s.synced=!0,Je(s),s.synced=!1;else if(I.length>0)Pe(e,I)}s.applyingRemoteFrontmatter=!0;let P=De(o,r.doc);for(let[I,N]of P.entries())e.doc.content.frontmatter[I]=N;s.applyingRemoteFrontmatter=!1}else if(s.canWrite)o.seedStructure(r.doc,Jo(he(e.doc.document)),{frontmatter:Jo(he(e.doc.content.frontmatter)),origin:o.SEED_ORIGIN,sourceFormat:e.doc.sourceFormat});s.lastSeenRef=he(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",ea(e.session.selection))},d=({stackItem:T})=>{let O=T.meta.get("selection");e.session.selection=ea(O??[])};l.on("stack-item-added",c),l.on("stack-item-popped",d),s.disposers.push(()=>{l.off("stack-item-added",c),l.off("stack-item-popped",d)}),av(e,{canRedo:()=>l.canRedo(),canUndo:()=>l.canUndo(),redo:()=>{l.redo()},undo:()=>{l.undo()}});let b=o.structureMap(r.doc),y=(T,O)=>{if(O.origin===o.LOCAL_ORIGIN||!s.synced)return;let P=o.yEventsToDocOps(T);if(P===null){Je(s);return}if(P.length===0)return;try{Pe(e,P)}catch{Je(s)}};b.observeDeep(y),s.disposers.push(()=>b.unobserveDeep(y));let h=Ln(e);h.sourceCanonical=o.canonicalOf(r.doc)==="source";let J=o.metaMap(r.doc),E=()=>{h.sourceCanonical=o.canonicalOf(r.doc)==="source"};J.observe(E),s.disposers.push(()=>J.unobserve(E));let F=o.sourceText(r.doc),ce=(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,Ot(s)},600)};F.observe(ce),s.disposers.push(()=>F.unobserve(ce));let j=De(o,r.doc),ue=(T,O)=>{if(O.origin===o.LOCAL_ORIGIN||!s.synced)return;s.applyingRemoteFrontmatter=!0;try{for(let[P,I]of T.changes.keys)if(I.action==="delete")delete e.doc.content.frontmatter[P];else e.doc.content.frontmatter[P]=j.get(P)}finally{s.applyingRemoteFrontmatter=!1}};j.observe(ue),s.disposers.push(()=>j.unobserve(ue)),e.scope.run(()=>{let T=JSON.stringify(e.doc.content.frontmatter);ne(()=>{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 I=[...j.keys()];for(let N of I)if(!(N in P))j.delete(N);for(let[N,Be]of Object.entries(P))if(!o.deepEqual(j.get(N),Be))j.set(N,Be)},o.LOCAL_ORIGIN),fe(s)}),ne(()=>{let O=e.session.selection.length>0?ea(e.session.selection):null,P=r.awareness.getLocalState();if(P)r.awareness.setLocalState({...P,structuralSelection:O})}),ne(()=>{let O=he(e.doc.document);queueMicrotask(()=>{if(D(e)?.session!==s||!s.synced||!s.canWrite)return;let I=he(e.doc.document);if(I!==O||I===s.lastSeenRef)return;s.lastSeenRef=I,re(s),fe(s)})})});let H=Ln(e),de=()=>{let T=[];for(let[O,P]of r.awareness.getStates())if(O!==r.awareness.clientID&&P.user)T.push({clientId:O,state:P});H.peers=T};return de(),r.awareness.on("change",de),s.disposers.push(()=>r.awareness.off("change",de),r.onStatus((T)=>{if(T==="offline"||T==="connecting")H.status="offline";else if(s.synced)H.status="synced"}),r.onReset(()=>{pe(e),Le(e)})),s.synced=!0,s}function k(e,t,o){return RangeError(`command "${e}" argument "${t}": ${o}`)}function Gn(e){if(Z(e))return"number";if(Xe(e))return"boolean";return n(e)?"string":"object"}function A(e){if(e===void 0)return"missing";return n(e)?`"${e}"`:`${Gn(e)} ${JSON.stringify(e)}`}function wt(e){return Array.isArray(e)&&e.every((t)=>n(t)||Z(t))}function St(e,t,o){let r=t[o];if(!n(r)||r==="")throw k(e,o,`expected a non-empty string, got ${A(r)}`);return r}function Xn(e,t,o){if(t[o]===void 0)return;return St(e,t,o)}function Rt(e,t,o){let r=t[o];if(!Z(r)||!Number.isFinite(r))throw k(e,o,`expected a finite number, got ${A(r)}`);return r}function Ct(e,t,o){let r=t[o];if(!Z(r)||!Number.isInteger(r))throw k(e,o,`expected an integer, got ${A(r)}`);return r}function Mx(e,t,o,r,i){let s=Rt(e,t,o);if(s<r||s>i)throw k(e,o,`${s} is outside the supported range ${r}–${i}`);return s}function zi(e,t,o){let r=t[o];if(!Xe(r))throw k(e,o,`expected a boolean, got ${A(r)}`);return r}function Vn(e,t,o,r){let i=t[o],s=n(i)?r.find((a)=>a===i):void 0;if(s===void 0)throw k(e,o,`${A(i)} is not declared — declared: ${r.join(", ")||"none"}`);return s}function IC(e,t,o){let r=t[o];if(!wt(r))throw k(e,o,`expected an array of path segments (strings or numbers), got ${A(r)}`);return r}function IO(e,t,o){if(t[o]===null)return null;return IC(e,t,o)}function F$(e,t,o){let r=t[o];if(!Array.isArray(r))throw k(e,o,`expected an array of document paths, got ${A(r)}`);return r.map((i,s)=>{if(!wt(i))throw k(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 di(e,t){return{description:t,enum:[...e],type:"string"}}function cl(e,t){return{description:t,get enum(){return[...e()]},type:"string"}}function j$(e,t={}){return{description:e,type:"number",...t}}function $o(e){return{description:e,type:"boolean"}}function Px(e,t=!1){let o={items:{type:["string","number"]},type:"array"};return t?{description:e,oneOf:[o,{type:"null"}]}:{description:e,...o}}function RO(e){return{description:e,items:{items:{type:["string","number"]},type:"array"},type:"array"}}function We(e){return{description:e,type:"string"}}function zn(e){return e.length===2&&e.includes("string")&&e.includes("number")}function Fe(e){return n(e)?[e]:e}function Jt(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 zn(o)?"path":"pass-through";return o==="array"?"path-list":"pass-through"}case"null":case"object":return"typed";default:break}return"pass-through"}function It(e,t){switch(e){case"null":return t===null;case"boolean":return Xe(t);case"string":return n(t);case"number":return Z(t)&&Number.isFinite(t);case"integer":return Z(t)&&Number.isInteger(t);case"array":return Array.isArray(t);case"object":return S(t)&&!Array.isArray(t);default:break}return!1}function kt(e){if(e.length<=1)return e.join("");return`${e.slice(0,-1).join(", ")} or ${e.at(-1)}`}function Yn(e,t,o,r){let i=t[o];if(i===void 0||!r.some((s)=>It(s,i)))throw k(e,o,`expected ${kt(r)}, got ${A(i)}`);return i}function Dt(e){switch(Jt(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)=>Dt(t)).join(" or ");case"typed":return kt(Fe(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 qn(e,t,o,r){let i=t[o],s=[];for(let a of r){if(a.type!==void 0&&!Fe(a.type).some((l)=>It(l,i)))continue;try{return jt(e,t,o,a)}catch(l){s.push(l)}}if(s.length===1)throw s[0];throw k(e,o,`expected ${r.map((a)=>Dt(a)).join(" or ")}, got ${A(i)}`)}function jt(e,t,o,r){switch(Jt(r)){case"enum":return Vn(e,t,o,r.enum??[]);case"const":{let i=t[o];if(i!==r.const)throw k(e,o,`expected the constant ${A(r.const)}, got ${A(i)}`);return i}case"one-of":return qn(e,t,o,r.oneOf??[]);case"typed":return Yn(e,t,o,Fe(r.type??[]));case"boolean":return zi(e,t,o);case"bounded-number":{if(r.type==="integer")Ct(e,t,o);return Mx(e,t,o,r.minimum,r.maximum)}case"number":return Rt(e,t,o);case"integer":return Ct(e,t,o);case"string":return St(e,t,o);case"path":return IC(e,t,o);case"path-list":return F$(e,t,o);default:return t[o]}}function DO(e,t,o){let r=t,i=r.properties??{},s=Object.keys(i),a=r.required??[],l={};for(let[c,d]of Object.entries(o)){if(d===void 0||Object.hasOwn(i,c))continue;if(r.additionalProperties===!1)throw k(e,c,`not declared — declared: ${s.join(", ")||"none"}`);l[c]=d}for(let c of s){if(o[c]===void 0&&!a.includes(c))continue;l[c]=jt(e,o,c,i[c])}return l}var Zn=20,ui="primary",jm="secondary",W$=2,m=g({activePaneId:ui,clipboard:null,closedTabs:[],componentRegistry:[],mruOrder:[],fileTree:{dirs:new Map,expanded:new Set,searchQuery:"",selectedPath:null},panes:[{activeTabId:null,derived:null,id:ui,tabOrder:[]}],projectConfig:null,projectRoot:null,styleClipboard:null,tabs:new Map,ui:{activityBar:"files"},get activeTabId(){let e=Kr();return e.derived?.kind==="lens"?fn(e.derived.sourcePaneId)?.activeTabId??null:e.activeTabId},get tabOrder(){return Kr().tabOrder}}),u=Th(()=>m.activeTabId?m.tabs.get(m.activeTabId)??null:null);function Kr(){let{panes:e}=m;return e.find((t)=>t.id===m.activePaneId)??e[0]}function fn(e){return m.panes.find((t)=>t.id===e)}function Ql(e){return m.panes.find((t)=>t.tabOrder.includes(e))}function Lr(e){let t=fn(e);if(!t||t.id===m.activePaneId)return;m.activePaneId=t.id,M();let{activeTabId:o}=t;if(o){_e(o);let r=m.tabs.get(o);if(r)Ft(r)}}function Hm(e){return m.activePaneId===e}function DC(e){let t=e??Kr().activeTabId,o=t?m.tabs.get(t):null;if(!t||!o)return null;let r=Ql(t);if(!r)return null;let i=ec(r.id);return Wm(t),wh(i,t),i.activeTabId=t,m.activePaneId=i.id,M(),_e(t),i}function NC(e){return m.panes.find((t)=>t.id!==e)??Qn(jm)}function ec(e){let t=NC(e);if(t.derived)t.derived=null;return t}function Qn(e){let t=fn(e);if(t)return t;return m.panes=[...m.panes,{activeTabId:null,derived:null,id:e,tabOrder:[]}],fn(e)}function Bm(e){if(m.panes.length<2)return;let t=e===ui?m.panes.find((s)=>s.id!==ui)?.id:e,o=t===void 0?void 0:fn(t),r=m.panes.find((s)=>s.id!==t);if(!o||!r)return;for(let s of o.tabOrder)wh(r,s);let i=o.activeTabId!==null&&U(o.activeTabId)?o.activeTabId:null;if(r.activeTabId=m.activePaneId===o.id?i??r.activeTabId??o.activeTabId:r.activeTabId??o.activeTabId,m.activePaneId=r.id,r.derived?.sourcePaneId===o.id)r.derived=null;m.panes=m.panes.filter((s)=>s.id!==o.id),M()}function zm(e){return e.tabOrder.length===0&&e.derived===null}var U=()=>!0;function AC(e){U=e??(()=>!0)}var Nt=null;function OC(e){Nt=e}var $t=null;function MC(e){$t=e}function eo(){let e=0;for(let t of m.tabs.keys())if(U(t))e+=1;return e}function Lt(e){return e.tabOrder.findLast((t)=>U(t))??null}function Wm(e){let t=[];for(let o of m.panes){if(!o.tabOrder.includes(e))continue;if(o.tabOrder=o.tabOrder.filter((r)=>r!==e),o.activeTabId===e)o.activeTabId=Lt(o);if(o.id!==ui&&zm(o))t.push(o.id)}for(let o of t)Bm(o)}function wh(e,t,o){if(e.tabOrder.includes(t))return;let r=o??no(e,t);e.tabOrder=[...e.tabOrder.slice(0,r),t,...e.tabOrder.slice(r)]}function to(e){let t=0;for(let o of e.tabOrder){if(m.tabs.get(o)?.pinned!==!0)break;t+=1}return t}function no(e,t){return m.tabs.get(t)?.pinned===!0?to(e):e.tabOrder.length}function tc(e,t=null){if(m.projectRoot&&e!==m.projectRoot)EC();m.projectRoot=e,m.projectConfig=t}function Up(e){let t=u.value;return e!==null&&t!==null&&he(t)===he(e)}function Yd(e){if(!e)return!1;let t=m.tabs.get(e.id);return t!==void 0&&he(t)===he(e)}function _e(e){m.mruOrder=[e,...m.mruOrder.filter((t)=>t!==e)]}var me=null,se=0;function M(){me=null,se=0}function Ft(e){if(x&&e.documentPath)x.selectedPath=e.documentPath}function PC(e){let t=fn(e);if(t)t.activeTabId=null}function ae(e,t={}){let o=m.tabs.get(e),r=Ql(e);if(!o||!r)return;if(r.activeTabId=e,t.focus===!1)return;if(m.activePaneId=r.id,!t.cycling)M(),_e(e);Ft(o)}function _i(e){if(e.background===!0){let a=m.tabs.get(e.id);if(a)return a;let l=sv({...e,preview:!1}),c=(e.paneId===void 0?void 0:fn(e.paneId))??Kr();return wh(c,l.id),m.tabs.set(l.id,l),l}let t=m.tabs.get(e.id),o=e.preview===!0&&t?.pinned!==!0,r=sv({...e,preview:o}),i=(e.paneId===void 0?void 0:fn(e.paneId))??Kr(),s;if(t)r.pinned=t.pinned,Om(t);else{if(o){let l=Et(i),c=l?m.tabs.get(l):null;if(c)Qd(c);FC()}let a=o?Et(i):null;if(a)s=i.tabOrder.indexOf(a),Zd(a);wh(i,r.id,s)}return m.tabs.set(r.id,r),ae(r.id,{focus:e.focus!==!1}),ie(r),r}function Et(e){return e.tabOrder.find((t)=>m.tabs.get(t)?.preview===!0)??null}function td(e){let t=m.tabs.get(e);if(t?.preview===!0)t.preview=!1}function FC(){for(let[e,t]of m.tabs)if(t.preview&&t.doc.dirty)td(e)}function Bx(e,t){let o=m.tabs.get(e),r=Ql(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)=>m.tabs.get(a)?.pinned===!0).length;r.tabOrder=[...i.slice(0,s),e,...i.slice(s)]}function V$(e,t){let o=m.tabs.get(e),r=Ql(e);if(!o||!r)return;r.tabOrder=_t(r,e,t)}function _t(e,t,o){let r=m.tabs.get(t);if(!r)return e.tabOrder;let i=e.tabOrder.filter((d)=>d!==t),s=i.filter((d)=>m.tabs.get(d)?.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 Zd(e){let t=m.tabs.get(e);if(!t)return;let o=Ql(e),r=o?.activeTabId===e;if(oo(t),Om(t),m.tabs.delete(e),Cx(e),Wm(e),m.mruOrder=m.mruOrder.filter((l)=>l!==e),M(),o&&zm(o))Bm(o.id);if(!r)return;let i=Kr(),s=$t?.(i.id)??null,a=(s!==null&&i.tabOrder.includes(s)?s:null)??m.mruOrder.find((l)=>i.tabOrder.includes(l)&&U(l))??Lt(i);if(a)ae(a);else Nt?.(i.id)}function U$(){let e=[...m.tabs.values()];m.tabs.clear(),Wt(),m.mruOrder=[],M();for(let t of e)Om(t)}function Wt(){m.panes=[{activeTabId:null,derived:null,id:ui,tabOrder:[]}],m.activePaneId=ui}function oo(e){if(!e.documentPath)return;let t=e.documentPath;m.closedTabs=[{documentPath:t},...m.closedTabs.filter((o)=>o.documentPath!==t)].slice(0,Zn)}function ro(){let[e]=m.closedTabs;if(!e)return;return m.closedTabs=m.closedTabs.slice(1),e.documentPath}function Mt(e){if(!me)me=m.mruOrder.filter((r)=>m.tabs.has(r)&&U(r)),se=0;let t=me;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 q$(e){let t=[...m.tabs.keys()],o=[...m.tabs.values()],r=sv(e);m.tabs.set(r.id,r),Wt(),m.panes[0].tabOrder=[r.id],m.mruOrder=[],M(),ae(r.id),ie(r);for(let i of t){if(i===r.id)continue;m.tabs.delete(i)}for(let i of o)Om(i);return r}function Bt(e,t={}){ae(e,t)}function pv(e,t,o){let r=fn(t);if(!r||!m.tabs.has(e))return null;if(r.tabOrder.includes(e)){if(o!==void 0)r.tabOrder=_t(r,e,o);return r}return Wm(e),wh(r,e,o),r}function zx(e,t,o){let r=m.tabs.get(e);if(!r)return;if(r.id=t,r.documentPath=o,CC(e))Cx(e),Nm(t);m.tabs.delete(e),m.tabs.set(t,r);for(let i of m.panes)if(i.tabOrder=i.tabOrder.map((s)=>s===e?t:s),i.activeTabId===e)i.activeTabId=t;m.mruOrder=m.mruOrder.map((i)=>i===e?t:i),M(),Pt(r)}function G$(e,t){e.registerAll([...io(t),...so(t)])}function io(e){let t=()=>eo()>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:()=>{Mt(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:()=>{Mt(-1)}},{args:Se({path:We('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=u.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 ${Dm[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),![...m.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:We('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=ec(Kr().id);if(await e.openFile(i,{paneId:s.id}),![...m.tabs.values()].some((a)=>a.documentPath===i)){if(zm(s)&&s.id!==ui)Bm(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:()=>m.closedTabs.length>0,requires:"a document closed in this session",run:async()=>{let o=ro();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=m.activeTabId,r=o?m.tabs.get(o):null;if(o&&r)Bx(o,!r.pinned)}},{args:Se({pinned:$o("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=m.activeTabId;if(i&&m.tabs.get(i))Bx(i,zi("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=m.activeTabId;return o!==null&&m.tabs.get(o)?.preview===!0},requires:"a preview document — one opened by a single click",run:()=>{let o=m.activeTabId;if(o)td(o)}}]}function so(e){let t=()=>m.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:()=>m.activeTabId!==null,requires:"an open document",undo:"none",run:()=>{DC()}},{args:Se({path:We("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:()=>m.activeTabId!==null,requires:"an open document",undo:"none",run:async(o,r)=>{let i=St("pane.compareWith",r,"path"),s=Kr();if((s.activeTabId?m.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(ec(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:()=>{Lr(ui)}},{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:()=>{Lr(jm)}},{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:ao}]}function ao(){let e=m.panes.find((t)=>t.derived!==null);if(e?.id===ui){if(e.derived=null,!zm(e))return}Bm(e?.id??jm)}
2
+ export{xC,Fn,vx,Qb,Vt,Qt,Hi,yx,ev,Xc,nO,_C,wx,tv,N$,nv,xx,Wp,Xl,ll,iv,Dm,Qs,iO,_x,mh,Sx,ov,SC,oO,Nm,Cx,CC,rv,ho,bo,kx,gh,Ex,rO,A$,sO,aO,lO,kC,cO,EC,dO,Am,uO,ln,sv,TC,O$,hO,Om,Me,pO,Tx,ea,Lx,fO,Mm,$x,mO,Pm,gO,Bi,Y,qd,Ix,Rx,LC,bO,av,vO,yO,$C,wO,Lo,bh,M$,Fm,Dx,xO,Qc,Ve,Gd,Tr,_O,Nx,SO,Ax,CO,kO,Ia,Ox,Gr,EO,Vp,TO,LO,$O,Kd,Ln,lv,P$,cv,dv,St,Xn,Mx,zi,Vn,IC,IO,F$,Se,di,cl,j$,$o,Px,RO,We,DO,Jd,Un,ed,Fx,jx,RC,NO,Ra,vh,yh,uv,Hx,AO,Jo,OO,MO,PO,FO,hv,H$,jO,B$,z$,ui,jm,W$,m,u,Kr,fn,Ql,Lr,Hm,DC,NC,ec,Bm,zm,AC,OC,MC,Wm,wh,tc,Up,Yd,PC,_i,td,FC,Bx,V$,Zd,U$,q$,Bt,pv,zx,G$};
3
+
4
+ //# debugId=505DA9B0E78C771F64756E2164756E21
5
+ //# sourceMappingURL=studio-c05wdnt3.js.map
@@ -0,0 +1,5 @@
1
+ import{ls}from"./studio-tft6r105.js";var r="site-",f=new Set(["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),o=[[183,183],[192,214],[216,246],[248,893],[895,8191],[8204,8205],[8255,8256],[8304,8591],[11264,12271],[12289,55295],[63744,64975],[65008,65533],[65536,983039]];function n(e){return`${String.fromCodePoint(92)}u{${e.toString(16)}}`}var a=[String.raw`\-.0-9_a-z`,...o.map(([e,t])=>`${n(e)}-${n(t)}`)].join(""),s=new RegExp(`^[${a}]$`,"u");function sw(e){if(e==="")return"Enter a tag name.";if(!/^[a-z]/.test(e))return"A tag name starts with a lower-case letter.";for(let t of e.slice(1))if(!s.test(t))return/[A-Z]/.test(t)?"A tag name is lower case.":`“${t}” cannot appear in a tag name.`;if(!e.includes("-"))return"A tag name needs a hyphen, such as my-card.";if(f.has(e))return`<${e}> is reserved by HTML.`;return""}function ob(e){let t=ls(e).replaceAll(/-+/g,"-").replaceAll(/^-|-$/g,"");if(t==="")return"";return/^[a-z]/.test(t)&&t.includes("-")?t:`${r}${t}`}
2
+ export{sw,ob};
3
+
4
+ //# debugId=A0DB4B9EAE26124E64756E2164756E21
5
+ //# sourceMappingURL=studio-ccv2svc6.js.map
@@ -0,0 +1,16 @@
1
+ import{Q}from"./studio-nqxqf8p2.js";import{p}from"./studio-w4rz9hdk.js";import{ge,ne,Jr,Yr,g,he,tM,C}from"./studio-43sd2mam.js";import{Fn,vx,Qt,Hi,_C,wx,tv,N$,ln,sv,Om,Y,zi,Vn,Se,di,$o,ui,jm,m,Lr,tc,Bt}from"./studio-c05wdnt3.js";import{tf}from"./studio-z97c48fk.js";import{pt,Go,Cr}from"./studio-s32578pn.js";import{x,id,wn}from"./studio-gcxk20n7.js";import{n,Z,Xe,Lv,te,S,v}from"./studio-vxq7fcvv.js";import{le}from"./studio-qgh13jtz.js";function F(e){return e.replaceAll("~","~0").replaceAll("/","~1")}var Ue=100;function H(e){let t={blankAfter:new Set,escaped:new Map,inline:new Map},o=0,r=()=>{let l=0;while(o<e.length&&(e[o]===" "||e[o]==="\t"||e[o]==="\r"||e[o]===`
2
+ `)){if(e[o]===`
3
+ `)l+=1;o+=1}return l},s=()=>{let l=o,u=new Set;o+=1;while(o<e.length&&e[o]!=='"')if(e[o]==="\\")if(e[o+1]==="u"){let d=Number.parseInt(e.slice(o+2,o+6),16);if(d>=128)u.add(d);o+=6}else o+=2;else o+=1;return o+=1,{escaped:u,raw:e.slice(l,o)}},i=(l,u)=>{let d=r();if(e[o]===u)return o+=1,!0;if(o+=1,d+=r(),d>=2)t.blankAfter.add(l);return!1},a=(l)=>{r();let u=e[o];if(u==="{"){o+=1;let d=r()>0;if(e[o]==="}"){o+=1;return}t.inline.set(l,!d);while(o<e.length){let c=JSON.parse(s().raw);r(),o+=1;let f=`${l}/${F(c)}`;if(a(f),i(f,"}"))return}}else if(u==="["){if(o+=1,r(),e[o]==="]"){o+=1;return}for(let d=0;o<e.length;d+=1){let c=`${l}/${d}`;if(a(c),i(c,"]"))return}}else if(u==='"'){let{escaped:d}=s();if(d.size>0)t.escaped.set(l,d)}else while(o<e.length&&!`,]} \r
4
+ `.includes(e[o]))o+=1};return a(""),t}function Es(e){return{document:JSON.parse(e),layout:H(e)}}var Ve=/[^\u0020-\u007E]/,He=/^[\p{Mn}\p{Me}\p{Cf}]$/u,Ge=/^\p{Emoji_Presentation}$/u;function Ke(e){return e>=4352&&(e<=4447||e===9001||e===9002||e>=11904&&e<=12871&&e!==12351||e>=12880&&e<=19903||e>=19968&&e<=42182||e>=43360&&e<=43388||e>=44032&&e<=55203||e>=63744&&e<=64255||e>=65040&&e<=65049||e>=65072&&e<=65131||e>=65281&&e<=65376||e>=65504&&e<=65510||e>=110592&&e<=110593||e>=127488&&e<=127569||e>=131072&&e<=262141)}function de(e){if(!Ve.test(e))return e.length;let t=0;for(let o of e){if(He.test(o))continue;t+=Ke(o.codePointAt(0))||Ge.test(o)?2:1}return t}function me(e){return e===void 0||te(e)||Lv(e)}function U(e){return Object.entries(e).filter(([,t])=>!me(t))}function M(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function Ze(e){if(e.length<2)return!1;let t=Array.isArray(e[0])?"array":M(e[0])?"object":null;if(t===null)return!1;return e.every((o)=>t==="array"?Array.isArray(o)&&o.length>1:M(o)&&U(o).length>1)}function qe(e){return e.length>1&&e.every((t)=>Z(t))}function V(e,t){let o=me(e)?"null":JSON.stringify(e);return t===void 0?o:o.replaceAll(/[\u0080-\uFFFF]/g,(r)=>{let s=r.codePointAt(0);return t.has(s)?`\\u${s.toString(16).padStart(4,"0")}`:r})}function ko(e,t,o=Ue){let r=t?.inline??new Map,s=t?.blankAfter??new Set,i=t?.escaped??new Map,a=(c,f)=>r.get(c)??f,l=(c,f,b)=>{if(Array.isArray(c)){if(c.length===0)return"[]";if(Ze(c))return null;let y=[];for(let[P,T]of c.entries()){let k=`${f}/${P}`,w=s.has(k)?null:l(T,k,b);if(w===null)return null;y.push(w)}return`[${y.join(", ")}]`}if(M(c)){let y=U(c);if(y.length===0)return"{}";if(!a(f,b))return null;let P=[];for(let[T,k]of y){let w=`${f}/${F(T)}`,E=s.has(w)?null:l(k,w,!0);if(E===null)return null;P.push(`${JSON.stringify(T)}: ${E}`)}return`{ ${P.join(", ")} }`}return V(c,i.get(f))},u=(c)=>c.map(({path:f,text:b},y)=>y===c.length-1?b:`${b},
5
+ ${s.has(f)?`
6
+ `:""}`).join(""),d=(c,f,b,y,P,T)=>{if(!Array.isArray(c)&&!M(c))return V(c,i.get(f));let k=l(c,f,P);if(k!==null&&y+de(k)+T<=o)return k;let w=" ".repeat(b+2),E=`
7
+ ${" ".repeat(b)}`;if(Array.isArray(c)){if(qe(c))return`[
8
+ ${Ye(c,w,o,(A)=>s.has(`${f}/${A}`))}${E}]`;let L=c.map((R,A)=>{let O=`${f}/${A}`,J=A===c.length-1,z=d(R,O,b+2,w.length,P,J?0:1);return{path:O,text:`${w}${z}`}});return`[
9
+ ${u(L)}${E}]`}let pe=U(c),Be=a(f,P),We=pe.map(([L,R],A)=>{let O=`${f}/${F(L)}`,J=`${JSON.stringify(L)}: `,z=A===pe.length-1,ze=w.length+de(J),Fe=d(R,O,b+2,ze,Be,z?0:1);return{path:O,text:`${w}${J}${Fe}`}});return`{
10
+ ${u(We)}${E}}`};return`${d(e,"",0,0,!1,0)}
11
+ `}function Ye(e,t,o,r){let s=[],i="";for(let[a,l]of e.entries()){let u=`${V(l)}${a===e.length-1?"":","}`;if(i==="")i=`${t}${u}`;else if(i.length+1+u.length<=o)i=`${i} ${u}`;else s.push(i),i=`${t}${u}`;if(r(a)&&a<e.length-1)s.push(i,""),i=""}return s.push(i),s.join(`
12
+ `)}function wm(e){return ko(e,we())}var I=null,j=null,N=null,_=null;function we(){return ve()?.doc.layout??_}var G=null;function ve(){let e=m.tabs.get(ln);return e?he(e):null}function Qe(){if(j)Om(j),j=null;I=null,N=null,_=null,G=null}function xe(){return G??=(async()=>{try{let e=await p().readFile(ln),{document:t,layout:o}=Es(e);_=o,N=ko(t,we())}catch{N=null}})(),G}async function WL(e){if(await xe(),e.doc.layout===null&&_!==null)e.doc.layout=_}function et(e){let t=wn();if(t.projectConfig===e)return;id({...t,projectConfig:e}),tc(m.projectRoot,e)}function tt(){let e=x?.projectConfig;return e?he(e):null}function K(e){return he(e)}function Pe(e,t){for(let o of Object.keys(e))delete e[o];Object.assign(e,t)}function be(e){return I=e,e.scope.run(()=>{ne(()=>{let t=e.doc.document;if(I!==e||!x)return;et(K(t))})}),e}function eC(){let e=wn(),t=ve();if(I&&(I!==(t??j)||he(I.doc.document)!==e.projectConfig))Qe();if(I)return I;if(t)return be(t);return j=sv({document:e.projectConfig??{},documentPath:ln,id:ln}),be(j)}function ye(e){return JSON.stringify(e.extensions??null)}async function ot(){let{loadFormats:e,refreshExtensionUi:t,refreshFormats:o}=await (le("yxz0kjjs"),import("./format-host-yxz0kjjs.js"));o(),e(),t(p())}async function Kl(e){let t=tt(),o=eC();await WL(o);let r=K(o.doc.document),s=wm(r),i=t&&t!==r&&wm(t)!==s?t:null;if(i&&o.doc.dirty){let b=Error(`${ln} has unsaved changes in its editor tab`);return C.error(`Could not save ${ln} — the file is open with unsaved changes. Save or `+"revert that tab, then make the settings change again.",{key:`save:${ln}`,path:ln,source:"Settings"}),{error:b,ok:!1}}let a=i??r,l=e?{...a,...e}:a,u=wm(l);if(!i&&!o.doc.dirty&&u===N)return{ok:!0};let d=ye(r);Y(o,(b)=>{let y=b.doc.document;if(i)Pe(y,i);for(let[P,T]of Object.entries(e??{}))y[P]=T});let c=K(o.doc.document),f=wm(c);try{await p().writeFile(ln,f)}catch(b){return C.error(`Could not save ${ln} — ${Q(b)}`,{key:`save:${ln}`,path:ln,source:"Settings"}),{error:b,ok:!1}}if(N=f,o.doc.dirty=!1,ye(c)!==d)await ot();return{ok:!0}}async function XN(e,t){if(!x){tc(m.projectRoot,e);return}let o=eC();Y(o,(r)=>Pe(r.doc.document,e),{skipHistory:!0}),o.doc.dirty=!1,await xe(),_=H(t),o.doc.layout=_,N=wm(e)}function to(e){let t=x?.projectConfig?.$media;if(!t)return e||{};if(!e)return{...t};return{...t,...e}}function Sr(e){let t=x?.projectConfig?.style;if(!t)return e||{};if(!e)return{...t};let o={...t};for(let[r,s]of Object.entries(e)){let i=o[r];o[r]=S(s)&&S(i)?{...i,...s}:s}return o}function QN(e,t=[]){return{...VL(t),...x?.projectConfig?.imports,...e}}function VL(e){let t=e.flatMap((o)=>(o.classes??[]).filter((r)=>r.path.endsWith(".class.json")).map((r)=>[r.name,r.path]));return Object.fromEntries(t.toReversed())}function Zw(e){let t=x?.projectConfig?.$elements;if(!t?.length)return e||[];if(!e?.length)return[...t];let o=new Set,r=[];for(let s of[...t,...e]){let i=n(s)?s:S(s)?s.$ref:void 0;if(i&&!o.has(i))o.add(i),r.push(s)}return r}function Xw(e){let t=x?.projectConfig?.$head;if(!t?.length)return e||[];if(!e?.length)return[...t];let o=new Set,r=[];for(let s of[...t,...e]){let i=S(s)?s.attributes:void 0,a=String(i?.href||i?.src||"")||JSON.stringify(s);if(!o.has(a))o.add(a),r.push(s)}return r}function Ts(){let e=x?.projectConfig;return e?Qt(e).i18n:null}function Rp(e,t){let o=Ts();if(o===null)return null;let r=Fn(e);if(r!==null&&o.locales.includes(r))return r;return Hi(t??"",o)??o.defaultLocale}var q=new Map;function eA(){q.clear()}function ol(e){if(e===!1)return null;let t=x?.projectConfig?.defaults?.layout;return e||t||null}async function Qw(e){let t=e.replace(/^\.\//,""),o=q.get(t);if(o!==void 0)return structuredClone(o);try{let s=await p().readFile(t),i=JSON.parse(s);return q.set(t,i),structuredClone(i)}catch{return null}}function UL(e,t){let o=t.children??[],r=Array.isArray(o)?o:[],s=new Map,i=[];for(let a of r){let l=n(a)?void 0:a.attributes?.slot;if(!n(a)&&n(l)&&l){if(!s.has(l))s.set(l,[]);s.get(l).push(a)}else i.push(a)}if(Te(e,s,i),t.state)e.state={...e.state,...t.state};if(t.$media)e.$media={...e.$media,...t.$media};if(t.style)e.style={...e.style,...t.style};if(t.attributes)e.attributes={...e.attributes,...t.attributes};return e}function Te(e,t,o){if(!Array.isArray(e.children))return;let r=[];for(let s of e.children)if(S(s)&&s.tagName==="slot"){let i=s.attributes?.name;if(n(i)&&i&&t.has(i))r.push(...t.get(i)),t.delete(i);else if(!i&&o.length>0)r.push(...o);else if(Array.isArray(s.children))r.push(...s.children)}else{if(S(s))Te(s,t,o);r.push(s)}e.children=r}async function no(e){let t=await Kl(e);if(!t.ok)throw t.error}var ke=new Set([ui,jm]),nt=new Set(["auto","light","dark"]);function rt(e){return n(e)&&nt.has(e)}function it(e){let{ui:t}=e.session;return{activeMedia:t.activeMedia,canvasMode:t.canvasMode,editZoom:t.editZoom,preview:t.preview,previewColorScheme:t.previewColorScheme,previewLocale:t.previewLocale,showLayout:t.showLayout,zoom:t.zoom}}function Ie(){let e={},t=[];for(let o of m.panes){if(o.derived)continue;let r=[];for(let i of o.tabOrder){let a=m.tabs.get(i);if(!a?.documentPath)continue;r.push(a.documentPath),e[a.documentPath]=it(a)}if(r.length===0)continue;let s=o.activeTabId?m.tabs.get(o.activeTabId):null;t.push({activeFile:s?.documentPath??null,files:r,id:o.id})}return{focusedPane:m.activePaneId,panes:t,ui:e}}function st(e){if(!v(e))return{};let t={};if(n(e.canvasMode))t.canvasMode=e.canvasMode;if(Xe(e.preview))t.preview=e.preview;if(Z(e.zoom)&&Number.isFinite(e.zoom))t.zoom=e.zoom;if(Z(e.editZoom)&&Number.isFinite(e.editZoom))t.editZoom=e.editZoom;if(e.activeMedia===null||n(e.activeMedia))t.activeMedia=e.activeMedia;if(rt(e.previewColorScheme))t.previewColorScheme=e.previewColorScheme;if(e.previewLocale===null||n(e.previewLocale)&&vx(e.previewLocale))t.previewLocale=e.previewLocale;if(Xe(e.showLayout))t.showLayout=e.showLayout;return t}function _e(e){if(!v(e)||!Array.isArray(e.panes))return null;let t=[];for(let r of e.panes){if(!v(r)||!n(r.id)||!ke.has(r.id))continue;let s=Array.isArray(r.files)?r.files.filter((i)=>n(i)&&i!==""):[];if(s.length===0)continue;t.push({activeFile:n(r.activeFile)&&s.includes(r.activeFile)?r.activeFile:null,files:s,id:r.id})}if(t.length===0)return null;let o={};if(S(e.ui))for(let[r,s]of Object.entries(e.ui))o[r]=st(s);return{focusedPane:n(e.focusedPane)&&ke.has(e.focusedPane)?e.focusedPane:ui,panes:t,ui:o}}async function tA(e,t){let o=0;if(e.panes.some((i)=>i.id===jm))t.ensureSecondPane();for(let i of e.panes)for(let a of i.files){try{await t.openFile(a,i.id)}catch{}if([...m.tabs.values()].some((l)=>l.documentPath===a))o+=1}if(o===0)return 0;for(let i of m.tabs.values()){let a=i.documentPath?e.ui[i.documentPath]:void 0;if(!a)continue;let{ui:l}=i.session;if(a.canvasMode&&i.capabilities.modes.includes(a.canvasMode))l.canvasMode=a.canvasMode;if(a.preview!==void 0)l.preview=a.preview;if(a.zoom!==void 0)l.zoom=a.zoom;if(a.editZoom!==void 0)l.editZoom=a.editZoom;if(a.activeMedia!==void 0)l.activeMedia=a.activeMedia;if(a.previewColorScheme!==void 0)l.previewColorScheme=a.previewColorScheme;if(a.previewLocale!==void 0)l.previewLocale=a.previewLocale;if(a.showLayout!==void 0)l.showLayout=a.showLayout}let r=m.panes.some((i)=>i.id===e.focusedPane)?e.focusedPane:null,s=null;for(let i of e.panes){let a=m.panes.find((u)=>u.id===i.id);if(!a||!i.activeFile)continue;let l=a.tabOrder.find((u)=>m.tabs.get(u)?.documentPath===i.activeFile);if(!l)continue;if(a.id===r)s=l;else Bt(l,{focus:!1})}if(s)Bt(s);else if(r)Lr(r);return o}var xm=["review","deploys","branches","hosting"],tC={branches:"Branches",deploys:"Deploys",hosting:"Hosting",review:"Review changes"},at=["live","review"],Ee="review",Ce="live",lt=new Set(xm),ct=new Set(at);function nA(e){return typeof e==="string"&&lt.has(e)}function ex(e){return typeof e==="string"&&ct.has(e)}var ut={default:{description:"Resume whatever was persisted — layout, recents, settings, chat history.",id:"default",reset:"none"},fresh:{description:"A first-run app: no layout, no recents, no settings, no history.",id:"fresh",reset:"app-state"}},Ae=new Map(Object.entries(ut)),ft="default",dt=/^jx[-._:]/;function mt(e){return dt.test(e)}function gt(){let e=typeof localStorage>"u"?void 0:localStorage;if(!e)return[];let t=[];try{for(let o=0;o<e.length;o++){let r=e.key(o);if(r&&mt(r))t.push(r)}for(let o of t)e.removeItem(o)}catch{}return t}function bt(e){let t=Ae.get(e);if(!t)throw RangeError(`unknown startup profile "${e}"; declared: ${[...Ae.keys()].join(", ")}`);if(t.reset==="app-state")gt();return t}var B=null;function je(e){if(B)return B;let t=new URLSearchParams(e??(typeof location>"u"?"":location.search)),o=bt(t.get("profile")??ft),r=t.get("clock");return B={clock:r===null?null:tM(r),profile:o},B}var W=["site","collections","styles","files","search","i18n","layers","data","packages","insert"],ht=new Set(["collections","styles"]);function Oe(e){return e&&!ht.has(e)?e:yt}var St=new Map([["blocks","insert"],["head","site"],["page","site"],["imports","packages"],["git","site"],["state","data"]]),yt="site";function nC(e,t){let o=W.find((r)=>r===e);if(o===void 0)throw Error(`${t}: "${e}" is not a declared Navigator panel id.`);return o}function se(e){if(!n(e))return null;let t=St.get(e);if(t)return t;return W.find((o)=>o===e)??null}var oe=["page","properties","style","events","assistant"],tx="page",wt=["properties","style","events"],iC="properties";function nx(e){return typeof e==="string"&&wt.some((t)=>t===e)}function qL(e){return typeof e==="string"&&oe.some((t)=>t===e)}var ix=["problems","logic","activity"],GL="problems";function KL(e){return typeof e==="string"&&ix.some((t)=>t===e)}var ox=["light","dark"],Vc={content:{id:"content",inspector:{open:!1,whileWriting:!0},navigator:{open:!0,panel:"collections"},rail:!1,tabStrip:!0},design:{id:"design",inspector:{open:!0},navigator:{initial:"site",open:!0},rail:!0,tabStrip:!0},media:{id:"media",inspector:{open:!1},navigator:{open:!1},rail:!1,tabStrip:!1},publish:{id:"publish",inspector:{open:!1},navigator:{open:!1},rail:!1,tabStrip:!1},styles:{id:"styles",inspector:{open:!1,tab:"style",whileWriting:!0},navigator:{open:!0,panel:"styles"},rail:!1,tabStrip:!1}},De="jx-studio-panel-widths",Le="jx-studio-project::",vt="dark";function JL(e){return typeof e==="string"&&ox.some((t)=>t===e)}function xt(){let e=Go(pt.theme);return JL(e)?e:vt}var rx=["left","right","bottom"],D={bottom:{collapsed:!0,size:220},left:{collapsed:!1,size:240},right:{collapsed:!1,size:280}},iA={bottom:D.bottom.size,left:D.left.size,right:D.right.size},Pt={bottom:"--dock-h-bottom",left:"--panel-w-left",right:"--panel-w-right"},Tt={bottom:"bottom-collapsed",left:"left-collapsed",right:"right-collapsed"},YL=0.5,oC=0.2,rC=0.8;function kt(e){return Z(e)&&e>=oC&&e<=rC?e:YL}function oA(e){h.paneSplit=Math.min(rC,Math.max(oC,e))}function It(){try{let e=JSON.parse(localStorage.getItem(De)||"{}");return v(e)?e:{}}catch{return{}}}function _t(e){return{left:e("left"),right:e("right"),bottom:e("bottom")}}function Re(){return{branches:null,commitMessage:"",diffState:null,error:null,lastUpdated:null,loading:!1,logEntries:null,rev:0,status:null}}function $e(){return{build:{for:"",state:"idle",text:""},deploys:{error:"",project:"",rows:[],state:"idle"},destination:Ce,review:{number:0,url:""},tab:Ee}}var Et="tokens";function Je(){return{customizedOnly:!1,filter:"",selection:null,variable:null,view:Et}}function Ct(){let e=It(),t=_t((o)=>{let r=e[o],s=e[`${o}Collapsed`];return{collapsed:Xe(s)?s:D[o].collapsed,size:Z(r)&&r>0?r:D[o].size}});return{bottomTab:KL(e.bottomTab)?e.bottomTab:GL,docks:t,focusRegion:"pane",paneSplit:kt(e.paneSplit),git:Re(),publish:$e(),layoutSelection:null,leftTab:Oe(se(e.leftTab)),stylebook:Je(),theme:xt(),workspace:wx}}je();var At=["jx-studio-doc-header-expanded"];function jt(){try{for(let e of At)localStorage.removeItem(e)}catch{}}jt();var h=g(Ct());function Fd(){try{localStorage.setItem(De,JSON.stringify({bottom:h.docks.bottom.size,bottomCollapsed:h.docks.bottom.collapsed,bottomTab:h.bottomTab,left:h.docks.left.size,leftCollapsed:h.docks.left.collapsed,leftTab:h.leftTab,paneSplit:h.paneSplit,right:h.docks.right.size,rightCollapsed:h.docks.right.collapsed}))}catch{}}var re,ae={};function ce(e){if(!e)return{};try{let t=JSON.parse(localStorage.getItem(`${Le}${e}`)||"{}");return v(t)?t:{}}catch{return{}}}function ZL(e){let t=ce(e).workspace;return N$(t)?t:wx}function rA(e){return _e(ce(e).session)}var ue=null;function sx(e){ue=e}function sA(){fe()}function fe(){let e=m.projectRoot;if(!e)return;try{localStorage.setItem(`${Le}${e}`,JSON.stringify({session:e===ue?Ie():ce(e).session,workspace:h.workspace}))}catch{}}function Nt(e){if(e===re)return;if(re=e,ae={},h.workspace=ZL(e),e===null){h.leftTab=Oe(se(h.leftTab));return}Jr();try{Me(h.workspace),Fd()}finally{Yr()}}function XL(e,t){let{inspector:o}=Vc[e];return o.open||o.whileWriting===!0&&t}function Me(e,t){let o=Vc[e],r=se(o.navigator.panel??ae[e]??o.navigator.initial??h.leftTab);if(r)h.leftTab=r;if(h.docks.left.collapsed=!o.navigator.open,h.docks.right.collapsed=!XL(e,t?.writingOnCanvas?.()===!0),o.inspector.tab&&t)t.setInspectorTab(o.inspector.tab)}function sC(e,t){if(h.workspace===e)return!1;if(!Vc[h.workspace].navigator.panel)ae[h.workspace]=h.leftTab;return h.workspace=e,Me(e,t),Fd(),fe(),!0}function _m(e=h.theme){return e==="light"?"vs":"vs-dark"}function Ot(){document.documentElement.dataset.theme=h.theme,tf()?.editor.setTheme(_m())}var Dt="rail-hidden",Lt="tabs-hidden";function Ob(e=h.workspace){return Vc[e].tabStrip}function Rt(){let e=document.documentElement;for(let o of rx)e.style.setProperty(Pt[o],`${h.docks[o].size}px`);let t=document.querySelector("#app");if(!t)return;for(let o of rx)t.classList.toggle(Tt[o],h.docks[o].collapsed);t.classList.toggle(Dt,!Vc[h.workspace].rail),t.classList.toggle(Lt,!Vc[h.workspace].tabStrip)}var X=null,ie=[];function Mb(e){if(!ie.includes(e))ie.push(e)}function aA(){if(X)return;for(let e of ie)e.mount();X=ge(),X.run(()=>{ne(()=>{Rt()}),ne(()=>{Ot()}),ne(()=>{Nt(m.projectRoot)}),ne(()=>{let e=m.projectRoot;m.activePaneId;for(let t of m.panes)t.id,t.activeTabId,t.tabOrder.join("\x00");if(e)fe()})})}function Eo(e,t){if(h.docks[e].collapsed===t){Fd();return}h.docks[e].collapsed=t,Fd()}function $t(e){Eo(e,!h.docks[e].collapsed)}function lA(e,t){h.docks[e].size=t}function Uc(e){h.leftTab=e,Eo("left",!1),Fd()}function sh(e){h.bottomTab=e,Eo("bottom",!1),Fd()}function QL(e){if(h.theme===e)return;h.theme=e,Cr(pt.theme,e)}function cA(e){if(e===h.leftTab&&!h.docks.left.collapsed){Eo("left",!0);return}Uc(e)}function e$(e){h.layoutSelection=e}function ax(){Object.assign(h.git,Re()),Object.assign(h.publish,$e()),Object.assign(h.stylebook,Je()),h.layoutSelection=null,ue=null,re=void 0}function Ne(e,t){if(t.showWorkspace){t.showWorkspace(e);return}sC(e,t)}var ee=(e)=>e.project.open;function Jt(e){return[{args:Se({tab:di(W,"Which Navigator panel to show.")}),category:"View",id:"view.setActivity",level:"application",menus:["commandbar/overflow","palette"],group:"4_docks",requires:"an open project",when:ee,run:(t,o)=>{let r=Vn("view.setActivity",o,"tab",W);if(e.panelAvailable&&!e.panelAvailable(r))throw RangeError(`command "view.setActivity" argument "tab": "${r}" names a panel that is registered but not available right now, so showing it would persist a Navigator tab nothing can draw`);Uc(r)},title:"Show Navigator Panel"},{args:Se({tab:di(oe,"Which Inspector tab to show.")}),category:"View",id:"view.setRightTab",level:"document",menus:["palette"],group:"4_docks",requires:"an open document",when:(t)=>t.document.open,run:(t,o)=>{e.setInspectorTab(Vn("view.setRightTab",o,"tab",oe))},title:"Show Inspector Tab"},{args:Se({open:$o("True to show the Navigator dock, false to collapse it.")}),category:"View",id:"view.setNavigator",level:"application",menus:["palette"],group:"4_docks",run:(t,o)=>{Eo("left",!zi("view.setNavigator",o,"open"))},title:"Show Navigator Dock"},{args:Se({open:$o("True to show the Inspector dock, false to collapse it.")}),category:"View",id:"view.setRightPanel",level:"application",menus:["palette"],group:"4_docks",run:(t,o)=>{Eo("right",!zi("view.setRightPanel",o,"open"))},title:"Show Inspector Dock"},{args:Se({open:$o("True to show the Bottom dock, false to collapse it.")}),category:"View",id:"view.setBottomDock",level:"application",menus:["palette"],group:"4_docks",run:(t,o)=>{Eo("bottom",!zi("view.setBottomDock",o,"open"))},title:"Show Bottom Dock"},{category:"View",id:"view.toggleBottomDock",keybinding:"mod+j",level:"application",menus:["commandbar/overflow","palette"],group:"4_docks",run:()=>{$t("bottom")},title:"Toggle Bottom Dock"},{args:Se({tab:di(ix,"Which Bottom dock tab to show.")}),category:"View",id:"view.setBottomTab",level:"application",menus:["palette"],group:"4_docks",run:(t,o)=>{let r=Vn("view.setBottomTab",o,"tab",ix);if(e.panelAvailable&&!e.panelAvailable(r))throw RangeError(`command "view.setBottomTab" argument "tab": "${r}" names a panel that is registered but not available right now, so showing it would persist a Bottom dock tab nothing can draw`);sh(r)},title:"Show Bottom Dock Tab"},{args:Se({open:$o("True to show the Assistant tab, false to step off it.")}),category:"View",id:"view.setAssistant",level:"application",menus:["never"],group:"4_docks",run:(t,o)=>{if(zi("view.setAssistant",o,"open")){Eo("right",!1),e.setInspectorTab("assistant");return}if(e.inspectorTab()==="assistant")e.setInspectorTab(e.restingInspectorTab?.()??tx)},title:"Show Assistant"},{args:Se({workspace:di(_C,"Which workspace to show.")}),category:"View",id:"view.setWorkspace",level:"application",menus:["never"],group:"4_workspaces",requires:"an open project",when:ee,run:(t,o)=>{Ne(Vn("view.setWorkspace",o,"workspace",_C),e)},title:"Switch Workspace"},...tv.map((t,o)=>({category:"View",id:`workspace.focus.${t.id}`,keybinding:`mod+${o+1}`,level:"application",menus:["palette"],group:"4_workspaces",requires:"an open project",when:ee,run:()=>{Ne(t.id,e)},title:`Go to ${t.title}`})),{args:Se({color:di(ox,"The Studio chrome's theme.")}),category:"View",id:"view.setTheme",level:"application",menus:["palette"],group:"6_appearance",run:(t,o)=>{QL(Vn("view.setTheme",o,"color",ox))},title:"Set Theme"}]}function dA(e,t){e.registerAll(Jt(t))}
13
+ export{Es,ko,wm,WL,eC,Kl,XN,to,Sr,QN,VL,Zw,Xw,Ts,Rp,eA,ol,Qw,UL,no,tA,xm,tC,nA,ex,nC,tx,iC,nx,qL,ix,GL,KL,ox,Vc,JL,rx,iA,YL,oC,rC,oA,h,Fd,ZL,rA,sx,sA,XL,sC,_m,Ob,Mb,aA,Eo,lA,Uc,sh,QL,cA,e$,ax,dA};
14
+
15
+ //# debugId=4E96D1FA4E6D2FBE64756E2164756E21
16
+ //# sourceMappingURL=studio-d5grtb9e.js.map
@@ -0,0 +1,5 @@
1
+ import{Q}from"./studio-nqxqf8p2.js";import{lw,zu}from"./studio-07rcfje3.js";import{T,R}from"./studio-x9hsze61.js";import{g}from"./studio-43sd2mam.js";import{ed,Fx}from"./studio-c05wdnt3.js";import{Hl,pm}from"./studio-n0c5h6mf.js";import{n,v}from"./studio-vxq7fcvv.js";import{le}from"./studio-qgh13jtz.js";var W_=["string","number","boolean","array","object","reference"],V_=["","image","date","color"],Id={format:"",name:"",required:!1,type:"string"};function eb(e){if(e.$ref)return"reference";return e.type||"string"}function Rd(e){if(e.type==="array"&&e.items?.format)return e.items.format;return e.format||""}function ya(e,s){switch(e){case"number":return{type:"number"};case"boolean":return{type:"boolean"};case"array":return s?{items:{format:s,type:"string"},type:"array"}:{items:{type:"string"},type:"array"};case"object":return{properties:{},required:[],type:"object"};case"reference":return{$ref:"#/content/"};default:return s?{format:s,type:"string"}:{type:"string"}}}var B={$schema:"https://jxsuite.com/schema/v1",$id:"StudioSchemaBuilder",$description:'The `schema-builder` form control (specs/extensions.md §9.1): the visual editor for a JSON Schema object, drawn as one card per property. A descriptor names it with `"ui": { "<prop>": { "control": "schema-builder" } }`, and `ui/schema-form.ts` mounts it into the empty host its own document announces for that field. The adapter (`surfaces/schema-builder.ts`) hands in the fields already classified and every draft the reader is part-way through typing; `ui/form-controls.ts` decides what a field may be renamed to and what reaches the host\'s `onChange`. Nothing here reads a schema: a document that re-derived a field\'s type while drawing would be a second opinion about what one module already owns. **The card is `surfaces/settings-defs.json`\'s, part for part.** Data Shapes edits the project\'s `$defs` and this edits a content type\'s `schema`; they are the same object with the same six controls per row, so the row vocabulary — `card`, `field-row`, `field-label`, `field-name`, `field-type`, `field-format`, `field-required`, `field-delete`, `nested`, `nested-card`, `nested-add-name`/`-type`/`-button`, `ref-target`, `add-form` — is ONE vocabulary, and the row views it is drawn from are that surface\'s own types rather than a second declaration of them. What differs is only what encloses it: Data Shapes carries the two-column chrome that chooses WHICH shape is being edited, and this one is handed the object to edit.',tagName:"div",attributes:{part:"builder"},style:{$description:"What `.schema-builder`, `.schema-field-list`, `.schema-field-card`, `.schema-field-row`, `.schema-field-nested`, `.schema-field-name-input`, `.schema-nested-add`, `.schema-nested-add-name` and `.schema-add-field` said in `styles/overlays.css`, keyed on `part` and re-pointed at the studio token layer — the same translation `surfaces/settings-defs.json` carries, because it is the same card. Two values could not come with them. `.schema-field-card--nested` read `var(--spectrum-gray-300, #444)`, and the caption was an `sp-field-label` at whatever size Spectrum drew it; a document is mounted in the pane rather than inside `<sp-theme>`, so both would have taken their hard-coded fallback every time. The nested card takes the studio layer's `--border`, and the caption says what it is in the type ramp instead.",display:"block",'& [part="fields"]':{display:"flex",flexDirection:"column",gap:"4px",marginBottom:"12px"},'& [part="card"], & [part="nested-card"]':{border:"1px solid var(--border)",borderRadius:"var(--radius)",padding:"6px 10px"},'& [part="field-row"]':{display:"flex",alignItems:"center",gap:"8px"},'& [part="field-label"]':{$description:"The field's name in words: a caption on the row rather than a label for a control, since the raw key beside it is what the reader edits and what carries the accessible name.",flex:"none",minWidth:"84px",fontSize:"var(--jx-text-sm)",color:"var(--fg-dim)",overflowWrap:"anywhere"},'& [part="field-name"]':{flex:"1",maxWidth:"140px"},'& [part="nested"]':{marginLeft:"16px",marginTop:"6px",paddingLeft:"8px",borderLeft:"2px solid var(--border)",display:"flex",flexDirection:"column",gap:"4px"},'& [part="ref-target"]':{display:"flex",marginTop:"6px",maxWidth:"220px"},'& [part="nested-add"]':{display:"flex",alignItems:"center",gap:"6px",padding:"4px 0"},'& [part="nested-add-name"]':{flex:"1",maxWidth:"120px"},'& [part="add-form"]':{display:"flex",alignItems:"center",gap:"8px",padding:"8px 0"}},children:[{tagName:"div",attributes:{part:"fields"},children:[{$prototype:"Array",items:{$ref:"#/state/fields"},key:{$ref:"$map/item/key"},map:{tagName:"div",attributes:{part:"card","data-field":"${$map.item.key}"},children:[{tagName:"div",attributes:{part:"field-row"},children:[{tagName:"span",attributes:{part:"field-label"},textContent:"${$map.item.label}"},{tagName:"jx-textfield",attributes:{part:"field-name"},$props:{label:"Name for ${$map.item.label}",size:"sm",value:{$ref:"$map/item/name"}},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/renameField"},value:[{$ref:"$map/item/key"},{$ref:"event#/target/value"}]}]}},{tagName:"jx-select",attributes:{part:"field-type"},$props:{label:"Type for ${$map.item.label}",size:"sm",options:{$ref:"#/state/typeOptions"},value:{$ref:"$map/item/type"}},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setType"},value:[{$ref:"$map/item/key"},{$ref:"event#/target/value"}]}]}},{tagName:"div",attributes:{part:"format-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"$map/item/hasFormat"},cases:{true:{tagName:"jx-select",attributes:{part:"field-format"},$props:{label:"Format for ${$map.item.label}",size:"sm",options:{$ref:"#/state/formatOptions"},value:{$ref:"$map/item/format"}},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setFormat"},value:[{$ref:"$map/item/key"},{$ref:"event#/target/value"}]}]}}}},{tagName:"jx-switch",$description:"Whether the object requires this field. The word on screen is the name: `Req` is slotted rather than passed as `label`, because the kit's switch wraps its control in the label the slot lands in, and a second name would be announced over the top of it. Which row it belongs to is the tooltip's job instead, which is what `hint` is.",attributes:{part:"field-required"},$props:{hint:"Require ${$map.item.label}",size:"sm",checked:{$ref:"$map/item/required"}},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setRequired"},value:[{$ref:"$map/item/key"},{$ref:"event#/target/checked"}]}]},children:[{tagName:"span",textContent:"Req"}]},{tagName:"jx-action-button",attributes:{part:"field-delete"},$props:{label:"Delete ${$map.item.label}",hint:"Delete ${$map.item.label}",icon:"trash",quiet:!0,size:"sm"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/removeField"},value:[{$ref:"$map/item/key"}]}]}}]},{tagName:"div",attributes:{part:"extra-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"$map/item/extra"},cases:{reference:{tagName:"div",attributes:{part:"ref-target"},children:[{tagName:"jx-select",attributes:{part:"ref-target-select"},$props:{label:"Target for ${$map.item.label}",size:"sm",options:{$ref:"#/state/targets"},value:{$ref:"$map/item/refTarget"}},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setTarget"},value:[{$ref:"$map/item/key"},{$ref:"event#/target/value"}]}]}}]},nested:{tagName:"div",attributes:{part:"nested"},children:[{$prototype:"Array",items:{$ref:"$map/item/children"},key:{$ref:"$map/item/key"},map:{tagName:"div",attributes:{part:"nested-card","data-nested":"${$map.item.key}"},children:[{tagName:"div",attributes:{part:"field-row"},children:[{tagName:"jx-textfield",attributes:{part:"field-name"},$props:{label:"Name for ${$map.item.parent}.${$map.item.key}",size:"sm",value:{$ref:"$map/item/name"}},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/renameNested"},value:[{$ref:"$map/item/parent"},{$ref:"$map/item/key"},{$ref:"event#/target/value"}]}]}},{tagName:"jx-select",attributes:{part:"field-type"},$props:{label:"Type for ${$map.item.parent}.${$map.item.key}",size:"sm",options:{$ref:"#/state/typeOptions"},value:{$ref:"$map/item/type"}},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setNestedType"},value:[{$ref:"$map/item/parent"},{$ref:"$map/item/key"},{$ref:"event#/target/value"}]}]}},{tagName:"div",attributes:{part:"format-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"$map/item/hasFormat"},cases:{true:{tagName:"jx-select",attributes:{part:"field-format"},$props:{label:"Format for ${$map.item.parent}.${$map.item.key}",size:"sm",options:{$ref:"#/state/formatOptions"},value:{$ref:"$map/item/format"}},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setNestedFormat"},value:[{$ref:"$map/item/parent"},{$ref:"$map/item/key"},{$ref:"event#/target/value"}]}]}}}},{tagName:"jx-switch",attributes:{part:"field-required"},$props:{hint:"Require ${$map.item.parent}.${$map.item.key}",size:"sm",checked:{$ref:"$map/item/required"}},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setNestedRequired"},value:[{$ref:"$map/item/parent"},{$ref:"$map/item/key"},{$ref:"event#/target/checked"}]}]},children:[{tagName:"span",textContent:"Req"}]},{tagName:"jx-action-button",attributes:{part:"field-delete"},$props:{label:"Delete ${$map.item.parent}.${$map.item.key}",hint:"Delete ${$map.item.parent}.${$map.item.key}",icon:"trash",quiet:!0,size:"sm"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/removeNested"},value:[{$ref:"$map/item/parent"},{$ref:"$map/item/key"}]}]}}]}]}},{tagName:"div",attributes:{part:"nested-add"},children:[{tagName:"jx-textfield",attributes:{part:"nested-add-name"},$props:{label:"New field in ${$map.item.label}",placeholder:"field name",size:"sm",value:{$ref:"$map/item/draftName"}},oninput:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/editDraftName"},value:[{$ref:"$map/item/key"},{$ref:"event#/target/value"}]}]},onkeydown:{$prototype:"Function",body:[{$switch:{$ref:"event#/key"},cases:{Enter:[{preventDefault:!0},{operator:"call",target:{$ref:"#/state/addNested"},value:[{$ref:"$map/item/key"}]}]}}]}},{tagName:"jx-select",attributes:{part:"nested-add-type"},$props:{label:"Type of the new field in ${$map.item.label}",size:"sm",options:{$ref:"#/state/typeOptions"},value:{$ref:"$map/item/draftType"}},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/editDraftType"},value:[{$ref:"$map/item/key"},{$ref:"event#/target/value"}]}]}},{tagName:"jx-action-button",attributes:{part:"nested-add-button"},$props:{label:"Add a field to ${$map.item.label}",hint:"Add a field to ${$map.item.label}",icon:"plus",quiet:!0,size:"sm"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/addNested"},value:[{$ref:"$map/item/key"}]}]}}]}]}}}]}}]},{tagName:"div",attributes:{part:"add-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/addState"},cases:{closed:{tagName:"jx-action-button",attributes:{part:"add-open"},$props:{label:"Add Field",icon:"plus",quiet:!0,size:"sm"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/openAdd"},value:[]}]},children:[{tagName:"span",textContent:"Add Field"}]},open:{tagName:"div",attributes:{part:"add-form"},children:[{tagName:"jx-textfield",attributes:{part:"add-name"},$props:{label:"New field name",placeholder:"Field name",size:"sm",value:{$ref:"#/state/addName"}},oninput:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/editAddName"},value:[{$ref:"event#/target/value"}]}]},onkeydown:{$prototype:"Function",body:[{$switch:{$ref:"event#/key"},cases:{Enter:[{preventDefault:!0},{operator:"call",target:{$ref:"#/state/confirmAdd"},value:[]}],Escape:[{preventDefault:!0},{operator:"call",target:{$ref:"#/state/cancelAdd"},value:[]}]}}]}},{tagName:"jx-select",attributes:{part:"add-type"},$props:{label:"Type of the new field",size:"sm",options:{$ref:"#/state/typeOptions"},value:{$ref:"#/state/addType"}},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/editAddType"},value:[{$ref:"event#/target/value"}]}]}},{tagName:"div",attributes:{part:"add-format-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/addHasFormat"},cases:{true:{tagName:"jx-select",attributes:{part:"add-format"},$props:{label:"Format of the new field",size:"sm",options:{$ref:"#/state/formatOptions"},value:{$ref:"#/state/addFormat"}},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/editAddFormat"},value:[{$ref:"event#/target/value"}]}]}}}},{tagName:"jx-switch",attributes:{part:"add-required"},$props:{hint:"Require the new field",size:"sm",checked:{$ref:"#/state/addRequired"}},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/editAddRequired"},value:[{$ref:"event#/target/checked"}]}]},children:[{tagName:"span",textContent:"Required"}]},{tagName:"jx-button",attributes:{part:"add-confirm"},$props:{size:"sm"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/confirmAdd"},value:[]}]},children:[{tagName:"span",textContent:"Add"}]},{tagName:"jx-button",attributes:{part:"add-cancel"},$props:{size:"sm",quiet:!0},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/cancelAdd"},value:[]}]},children:[{tagName:"span",textContent:"Cancel"}]}]}}}]};T("schema-builder",B);function _(){return{addFormat:"",addHasFormat:!0,addName:"",addRequired:!1,addState:"closed",addType:"string",fields:[],formatOptions:[],targets:[],typeOptions:[]}}function E(e,s){e.textContent="";let t=g({..._(),...s}),o=null,r=!0,l=!1,p=()=>R("schema-builder",t,e).then((d)=>{let y=d.root;if(r=!1,l)return d.dispose(),y;return o=d,y}),u=p();return{dispose(){l=!0,o?.dispose(),o=null,e.textContent=""},host:e,ready:u,update(d){if(t.addFormat=d.addFormat,t.addHasFormat=d.addHasFormat,t.addName=d.addName,t.addRequired=d.addRequired,t.addState=d.addState,t.addType=d.addType,t.fields=d.fields,t.formatOptions=d.formatOptions,t.targets=d.targets,t.typeOptions=d.typeOptions,l||r||o!==null&&e.contains(o.root))return;o?.dispose(),o=null,r=!0,e.textContent="",p()}}}var M={$schema:"https://jxsuite.com/schema/v1",$id:"StudioReferenceField",$description:'The `reference` form control — site-architecture.md §6.1\'s `{ "$ref": "#/content/x" }` and site-architecture.md §7.4\'s entry picker. Registered once and dispatched to by `ui/schema-form.ts` for any property whose `$ref` names a collection, so the settings forms, the entry editor and an array-of-objects cell all draw the same control without any of them knowing it exists. `ui/form-controls.ts` decides which of the three states the field is in and what each gesture commits; nothing here reads a schema or lists a directory. The three states are drawn as three different controls on purpose: a picker while the entries are known, a TEXT field while they are not — a failed read leaves the value editable with the reason beside it, because swapping it for an empty dropdown would present "no entries" and "could not find out" as the same screen — and a disabled picker saying so while the read is in flight.',tagName:"div",attributes:{part:"reference",role:"none"},style:{$description:"The five `.reference-*` rules from `styles/inspector.css`, keyed on `part` and re-pointed at the studio token layer. Two values could not come with them. The note read `var(--spectrum-font-size-50, 11px)`, which resolves only inside `<sp-theme>` — this document is mounted in a settings pane, an entry editor or a frontmatter card, all outside that element, so it would silently have taken its hard-coded fallback every time. And `.reference-missing` coloured ONE row of the dropdown red; the kit's select offers a row a face, a swatch and a border style but no tone, so the dangling entry says what it is in words (\"— not found\") and the colour is not replaced by a second channel. The 6px gap comes onto the kit's spacing scale.",display:"flex",flex:"1",minWidth:"0",alignItems:"center",gap:"var(--jx-space-2)",'& [part="picker"], & [part="text"]':{flex:"1",minWidth:"0"},'& [part="note"]':{margin:"0",color:"var(--fg-dim)",fontSize:"var(--jx-text-sm)",lineHeight:"1.4"},'& [part="note"][data-tone="danger"]':{$description:"A listing that failed is a FAULT rather than a fact about the project, and the two notes this control draws are otherwise the same sentence in the same place.",color:"var(--danger)"},'& [part="retry"]':{flex:"none"}},children:[{tagName:"div",attributes:{part:"control-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/kind"},cases:{picker:{$description:"The collection's entries. The empty row is `\"\"` rather than a sentinel, because the kit's select treats the empty string as a legal value a reader can arrow to; a dangling reference is kept in the list and marked, since blanking the field would delete the evidence and the value in one repaint. While the read is in flight the same control is disabled and offers one row saying so.",tagName:"jx-select",attributes:{part:"picker"},$props:{size:"sm",label:{$ref:"#/state/label"},options:{$ref:"#/state/options"},value:{$ref:"#/state/value"},disabled:{$ref:"#/state/disabled"}},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/choose"},value:[{$ref:"event#/target/value"}]}]}},text:{$description:"The id as the string it is: what a reader gets when the choices could not be listed, and when the control was named by a `ui.control` override on a property that references nothing. Refusing to draw anything would lose the value that is already there.",tagName:"jx-textfield",attributes:{part:"text"},$props:{size:"sm",label:{$ref:"#/state/label"},value:{$ref:"#/state/value"}},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/edit"},value:[{$ref:"event#/target/value"}]}]}}}},{tagName:"div",attributes:{part:"note-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/hasNote"},cases:{true:{tagName:"p",attributes:{part:"note","data-tone":"${state.noteTone}",role:"status"},textContent:"${state.note}"}}},{tagName:"div",attributes:{part:"retry-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/canRetry"},cases:{true:{$description:"Offered only where there is something to try again — a listing that failed. It used to be offered only where the HOST passed a repaint hook, because a template control cannot draw a second frame of its own and a button that cannot do the thing it is named after is worse than its absence. A mounted control redraws itself, so the condition is now the failure rather than the host.",tagName:"jx-action-button",attributes:{part:"retry"},$props:{size:"sm",quiet:!0,label:"Retry listing entries"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/retry"},value:[]}]},children:[{tagName:"span",textContent:"Retry"}]}}}]};T("reference-field",M);function Y(){return{canRetry:!1,disabled:!0,hasNote:!1,kind:"picker",label:"",note:"",noteTone:"dim",options:[],value:""}}function L(e,s){e.textContent="";let t=g({...Y(),...s}),o=null,r=!0,l=!1,p=()=>R("reference-field",t,e).then((d)=>{let y=d.root;if(r=!1,l)return d.dispose(),y;return o=d,y}),u=p();return{dispose(){l=!0,o?.dispose(),o=null,e.textContent=""},host:e,ready:u,update(d){if(t.canRetry=d.canRetry,t.disabled=d.disabled,t.hasNote=d.hasNote,t.kind=d.kind,t.label=d.label,t.note=d.note,t.noteTone=d.noteTone,t.options=d.options,t.value=d.value,l||r||o!==null&&e.contains(o.root))return;o?.dispose(),o=null,r=!0,e.textContent="",p()}}}var V={$schema:"https://jxsuite.com/schema/v1",$id:"StudioSecretField",$description:'The `secret` form control (specs/extensions.md §9.1, §13): one password field whose VALUE goes to the platform\'s secret store and never to project.json. A descriptor names it with `"ui": { "<field>": { "control": "secret" } }`, and `ui/schema-form.ts` mounts it into the empty host its own document announces for that field. **A surface never renders back the secret it describes, and this document is where that is visible rather than remembered**: the only thing bound to the field\'s value is `#/state/shown`, a scope path whose whole purpose is to hold nothing. What the field is worth is said in the placeholder instead — the env NAME the store gave it, which is the only half of a secret a screen may carry. `ui/form-controls.ts` decides everything else: whether the host has a secret store at all, what the placeholder says, what a commit is worth and what the field persists.',tagName:"div",attributes:{part:"secret",role:"none"},style:{$description:"`.secret-field` carried no rule anywhere — it was one of `check-styles.ts`'s ALLOWED_ORPHANS, a class emitted only so a test could find the control — so there is nothing to translate and the wrapper takes no box of its own. The field takes the width of the control host the form drew, which is the flex item; a kit field is inline-flex by default and would otherwise sit at its intrinsic width in a row sized for it.",display:"contents",'& [part="field"]':{width:"100%"}},children:[{$description:"`autocomplete: new-password` because this is a place to PUT a secret rather than to prove one: without it a password manager offers to fill the field with a credential belonging to whatever site the reader last logged in to, and the offer is the manager's own UI drawn over an editor. The value binding is `#/state/shown` and nothing else ever writes to it — see the document description.",tagName:"jx-textfield",attributes:{part:"field"},$props:{type:"password",size:"sm",autocomplete:"new-password",label:{$ref:"#/state/label"},placeholder:{$ref:"#/state/placeholder"},disabled:{$ref:"#/state/disabled"},value:{$ref:"#/state/shown"}},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/commit"},value:[{$ref:"event#/target/value"}]}],description:"The change bubbles out of the field's own input, so what the reader typed is read off the event rather than off the element — and it is read here, handed to the flow, and never written back onto the scope."}}]};T("secret-field",V);function G(){return{disabled:!0,label:"",placeholder:"Not set"}}function z(e,s){e.textContent="";let t=g({...G(),...s,shown:""}),o=null,r=!0,l=!1,p=()=>R("secret-field",t,e).then((d)=>{let y=d.root;if(r=!1,l)return d.dispose(),y;return o=d,y}),u=p();return{clear(){t.shown=" ",t.shown=""},dispose(){l=!0,o?.dispose(),o=null,e.textContent=""},host:e,ready:u,update(d){if(t.disabled=d.disabled,t.label=d.label,t.placeholder=d.placeholder,l||r||o!==null&&e.contains(o.root))return;o?.dispose(),o=null,r=!0,e.textContent="",p()}}}var Z=W_.map((e)=>({label:e,value:e})),ee=V_.map((e)=>({label:e||"(none)",value:e})),P=[],I=" ";function te(e){let s=e.resolvePointer("#/$context/content"),t=v(s)?Object.keys(s):[],o=t.join(" ");if(o!==I)I=o,P=t.map((r)=>({label:r,value:r}));return P}function S(e){return e==="string"||e==="array"}function re(e){if(!v(e))return{properties:{},required:[],type:"object"};return e}function ae(e){return JSON.parse(JSON.stringify(e))}function ne(e){let s=e;return s.type??="object",s.properties??={},s.required??=[],s}function k(e){return`name:${e}`}function q(e){return`required:${e}`}function H(e,s){return`${e} ${s}`}function O(e,s,t){return e.echo?.id===s?e.echo.value:t}function oe(e,s,t,o,r){let l=H(s,t),p=eb(o);return{format:Rd(o),hasFormat:S(p),key:t,name:O(e,k(l),t),parent:s,required:O(e,q(l),r),type:p}}function ie(e,s,t,o,r){let l=eb(t),p=l==="object",u=e.drafts.get(s),d=t.required??[];return{children:p?Object.entries(t.properties??{}).map(([y,h])=>oe(e,s,y,h,d.includes(y))):[],draftName:u?.name??"",draftType:u?.type??"string",extra:l==="reference"&&r?"reference":p?"nested":"none",format:Rd(t),hasFormat:S(l),key:s,label:ed(s),name:O(e,k(s),s),refTarget:t.$ref?t.$ref.replace(/^#\/[^/]+\//,""):"",required:O(e,q(s),o),type:l}}function W(e,s,t){let o={};for(let[r,l]of Object.entries(e))o[r===s?t:r]=l,delete e[r];Object.assign(e,o)}function C(e,s,t){e.required??=[];let o=e.required.indexOf(s);if(t&&o===-1)e.required.push(s);if(!t&&o!==-1)e.required.splice(o,1)}function se(e,s){let t=s,o=null,r={add:{...Id},addOpen:!1,drafts:new Map,echo:null},l=()=>o??re(t.value),p=()=>{let a=l(),i=a.required??[],c=te(t.ctx);return{addFormat:r.add.format,addHasFormat:S(r.add.type),addName:r.add.name,addRequired:r.add.required,addState:r.addOpen?"open":"closed",addType:r.add.type,fields:Object.entries(a.properties??{}).map(([m,f])=>ie(r,m,f,i.includes(m),c.length>0)),formatOptions:ee,targets:c,typeOptions:Z}},u=()=>D.update(p()),d=(a,i)=>{r.echo={id:a,value:i},u()},y=()=>{r.echo=null,u()},h=(a)=>{let i=ae(l()),c=ne(i);if(!a(c)){y();return}o=c,r.echo=null,t.onChange(i),u()},w=(a,i)=>a.properties[i],A=(a)=>{let i=r.drafts.get(a);if(!i)i={name:"",type:"string"},r.drafts.set(a,i);return i},D=E(e,{addNested(a){let i=A(a),c=Fx(i.name.trim());if(!c)return;h((m)=>{let f=w(m,a);if(!f)return!1;return f.properties??={},f.properties[c]=ya(i.type||"string"),i.name="",!0})},cancelAdd(){r.addOpen=!1,r.add={...Id},u()},confirmAdd(){let a=Fx(r.add.name.trim());if(!a)return;let{format:i,required:c,type:m}=r.add;r.addOpen=!1,r.add={...Id},h((f)=>{if(f.properties[a]=ya(m,i||void 0),c)C(f,a,!0);return!0})},editAddFormat(a){r.add.format=a,u()},editAddName(a){r.add.name=a,u()},editAddRequired(a){r.add.required=a,u()},editAddType(a){r.add.type=a,u()},editDraftName(a,i){A(a).name=i,u()},editDraftType(a,i){A(a).type=i,u()},openAdd(){r.addOpen=!0,r.add={...Id},u()},removeField(a){h((i)=>{if(!i.properties[a])return!1;return delete i.properties[a],i.required=i.required.filter((c)=>c!==a),!0})},removeNested(a,i){h((c)=>{let m=w(c,a);if(!m?.properties?.[i])return!1;if(delete m.properties[i],m.required)m.required=m.required.filter((f)=>f!==i);return!0})},renameField(a,i){d(k(a),i);let c=Fx(i.trim());h((m)=>{if(!m.properties[a]||!c||c===a||m.properties[c])return!1;return W(m.properties,a,c),m.required=m.required.map((f)=>f===a?c:f),!0})},renameNested(a,i,c){d(k(H(a,i)),c);let m=Fx(c.trim());h((f)=>{let b=w(f,a);if(!b?.properties?.[i]||!m||m===i||b.properties[m])return!1;if(W(b.properties,i,m),b.required)b.required=b.required.map((N)=>N===i?m:N);return!0})},setFormat(a,i){h((c)=>{let m=c.properties[a];if(!m)return!1;return c.properties[a]=ya(m.type||"string",i||void 0),!0})},setNestedFormat(a,i,c){h((m)=>{let f=w(m,a),b=f?.properties?.[i];if(!f?.properties||!b)return!1;return f.properties[i]=ya(b.type||"string",c||void 0),!0})},setNestedRequired(a,i,c){d(q(H(a,i)),c),h((m)=>{let f=w(m,a);if(!f)return!1;return C(f,i,c),!0})},setNestedType(a,i,c){h((m)=>{let f=w(m,a),b=f?.properties?.[i];if(!f?.properties||!b)return!1;let N=S(c)?Rd(b):void 0;return f.properties[i]=ya(c,N||void 0),!0})},setRequired(a,i){d(q(a),i),h((c)=>{if(!c.properties[a])return!1;return C(c,a,i),!0})},setTarget(a,i){h((c)=>{if(!c.properties[a])return!1;return c.properties[a]={$ref:`#/content/${i}`},!0})},setType(a,i){h((c)=>{let m=c.properties[a];if(!m)return!1;let f=S(i)?Rd(m):void 0;return c.properties[a]=ya(i,f||void 0),!0})}});return u(),{dispose:()=>D.dispose(),update(a){t=a,o=null,r.echo=null,u()}}}var de={mount:se};lw("schema-builder",de);function J(e){return n(e)&&e?e:null}function ce(e,s){let t=s,o=()=>{let l=J(t.value);r.update({disabled:!t.ctx.commitSecret,label:t.key,placeholder:l?`Stored as ${l}`:"Not set"})},r=z(e,{commit(l){let{commitSecret:p}=t.ctx;if(!p||!l)return;r.clear();let{key:u,onChange:d}=t,y=J(t.value);Promise.resolve(p(u,l)).then((h)=>{if(n(h)&&h&&h!==y)d(h)})}});return o(),{dispose:()=>r.dispose(),update(l){t=l,o()}}}var pe={mount:ce};lw("secret",pe);function me(e,s){let t=s,o=()=>{Hl(e,t.key,n(t.value)?t.value:"",(r)=>t.onChange(r===""?void 0:r),{images:!0})};return o(),{dispose:()=>pm(e),update(r){t=r,o()}}}var ue={mount:me};lw("media",ue);var F=new Map,j=new Map,x=new Map;function om(e){if(e===void 0)F.clear(),j.clear(),x.clear();else F.delete(e),j.delete(e),x.delete(e)}function fe(e){let s=F.get(e);if(s)return s;let t=(le("mmppmcyg"),import("./content-source-mmppmcyg.js")).then((o)=>o.listCollectionEntryIds(e));return F.set(e,t),t}function _E(e,s){let t=j.get(e);if(t)return t;let o=fe(e),r=x.get(e);if(r){if(s)r.add(s);return null}x.set(e,new Set(s?[s]:[]));let l=(p)=>{if(F.get(e)!==o)return;let u=x.get(e);x.delete(e),j.set(e,p);for(let d of u??[])d()};return o.then((p)=>l({ids:p}),(p)=>l({error:Q(p)})),null}function he(e,s){let t=n(e.value)?e.value:"",o={canRetry:!1,disabled:!1,hasNote:!1,label:e.key,note:"",noteTone:"dim",options:[],value:t},r=zu(e.schema);if(r===null)return{...o,hasNote:!0,kind:"text",note:'No collection referenced — add "$ref": "#/content/<type>" to this field.'};let l=_E(r,s);if(l===null)return{...o,disabled:!0,kind:"picker",options:[{label:"Loading…",value:t}]};if("error"in l)return{...o,canRetry:!0,hasNote:!0,kind:"text",note:`Could not list ${r} entries — ${l.error}`,noteTone:"danger"};let p=t!==""&&!l.ids.includes(t);return{...o,hasNote:l.ids.length===0,kind:"picker",note:l.ids.length===0?`No ${r} entries yet.`:"",options:[{label:"—",value:""},...p?[{label:`${t} — not found`,value:t}]:[],...l.ids.map((u)=>({label:u,value:u}))]}}function ge(e,s){let t=s,o=!1,r=()=>{if(!o)l.update(he(t,r))},l=L(e,{choose(p){t.onChange(p===""?void 0:p)},edit(p){t.onChange(p.trim()||void 0)},retry(){let p=zu(t.schema);if(p!==null)om(p);r()}});return r(),{dispose(){o=!0,l.dispose()},update(p){t=p,r()}}}var ye={mount:ge};lw("reference",ye);
2
+ export{W_,V_,Id,eb,Rd,ya,om,_E};
3
+
4
+ //# debugId=0B11C06C7241538864756E2164756E21
5
+ //# sourceMappingURL=studio-df0baea9.js.map
@@ -0,0 +1,7 @@
1
+ import{Q}from"./studio-nqxqf8p2.js";import{g,C}from"./studio-43sd2mam.js";import{Pt,Nt}from"./studio-q7rtx6zq.js";import{qe,ft,T,R,Jt,tt}from"./studio-x9hsze61.js";var _={$schema:"https://jxsuite.com/schema/v1",$id:"StudioGithubAuth",$description:"The RFC 8628 device flow's waiting room: the code GitHub minted, the page to type it into, and a Cancel. A `jx-dialog`, so the platform owns modality, Escape, focus restoration and the backdrop — and it is the reason the dialog has no confirm button at all: the answer arrives from GitHub over a poll rather than from anything the reader can press here, so a primary button would be a control with nothing to do. Nothing in this document talks to GitHub: `github/github-auth.ts` keeps the client id, the poll loop, its failure budget and every report the three outcomes raise.",tagName:"jx-dialog",$props:{headline:"Sign in to GitHub",confirmLabel:"",cancelLabel:"Cancel",size:"sm"},attributes:{part:"github-auth"},oncancel:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/cancel"},value:[]}]},onclose:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/closed"},value:[]}]},style:{$description:"Four `.github-auth-*` rules in `styles/overlays.css` become the parts below, and two things in them do not travel. `.github-auth-dialog`'s `padding: 16px 0` was the card's own body padding drawn by hand, and `jx-dialog` already pads its body; `.github-auth-dialog p { font-size: 13px }` was a body size this surface picked for itself, and what the paragraphs now inherit is the dialog's own `--jx-text-md`. The `8px 0` margins go with them — the column is a flex column with a gap, so a margin between two rows would be a second opinion about the same space. The code keeps its 24px, which is above the token scale on purpose: it is a string the reader has to copy onto another screen, and reading it out loud is the whole job of this dialog.",'& [part="device"]':{display:"flex",flexDirection:"column",alignItems:"center",gap:"var(--jx-space-3)",textAlign:"center"},'& [part="lede"], & [part="waiting"]':{margin:"0"},'& [part="code"]':{$description:"`<code>`, not a styled `<div>`: this is a literal string to be transcribed, and the element that says so is also the one a reader's own stylesheet and a screen reader's character-by-character mode already know about. It is this dialog's message, and the one string in it the reader must carry to another screen, so it opts back in to selection against the root's `user-select: none`. `all` rather than `text`: one click selects the whole code, so a copy never leaves a character behind.",userSelect:"all",fontFamily:"var(--font-mono)",fontSize:"24px",fontWeight:"700",letterSpacing:"2px",padding:"var(--jx-space-3) var(--jx-space-4)",background:"var(--hover-bg)",borderRadius:"var(--radius)"},'& [part="link"]':{$description:"The blue this carried as a `var(--accent, …)` fallback is gone: `--accent` is declared on `:root` in `styles/tokens.css`, so the fallback could only ever have painted when the token was missing — which is a theme fault to fix rather than a colour to hard-code.",color:"var(--accent)",textDecoration:"underline"},'& [part="waiting"]':{color:"var(--fg-dim)",fontStyle:"italic"}},children:[{tagName:"div",attributes:{part:"device"},children:[{tagName:"p",attributes:{part:"lede"},textContent:"Enter this code on GitHub to authorize Jx Studio:"},{tagName:"code",attributes:{part:"code"},textContent:"${state.userCode}"},{tagName:"a",attributes:{part:"link",href:"${state.verificationUri}",target:"_blank",rel:"noreferrer"},textContent:"Open ${state.verificationUri}"},{tagName:"p",attributes:{part:"waiting"},textContent:"Waiting for authorization…"}]}]};T("github-auth",_);function A(e){let t=document.createElement("div");t.style.pointerEvents="auto",t.setAttribute(qe,ft("dialog","github-auth")),e.layer.append(t);let s=!1,l=()=>{if(s)return;s=!0,e.onClosed()},u=()=>s,b=g({cancel:()=>{e.onCancel()},closed:l,userCode:e.userCode,verificationUri:e.verificationUri}),n=null,r=R("github-auth",b,t).then(async(i)=>{n=i;let o=i.root;if(u())return i.dispose(),o;if(await Jt(o),u())return o;return Pt(o),o});return{close(){let i=n?.root;if(i instanceof HTMLElement)Nt(i);n?.dispose(),n=null,t.remove(),l()},host:t,ready:r}}var S="jx_github_token",v="Ov23liYVlMFpgjOEPXJH";function P(e){return typeof e==="object"&&e!==null&&"githubAuth"in e&&e.githubAuth!=null}function p(){let e=globalThis,t="__jxPlatform"in e?e.__jxPlatform:void 0;return P(t)?t.githubAuth:null}var f=null,H=!1;function E(e){f=e}function kT(){return f!==null||H||localStorage.getItem("jx_github_token")!==null}function ET(){return p()?"desktop":"browser"}function y(){return f??localStorage.getItem("jx_github_token")}function TT(){f=null,H=!1,localStorage.removeItem("jx_github_token"),p()?.signOut().catch(()=>{})}var O="github.auth",j="Source Control",N="git.signInToGithub",Y=3,z="The request never reached GitHub. GitHub's device-flow endpoints send no CORS headers, so a "+"browser cannot call them directly — the desktop app can. A machine that is offline fails "+"identically, and the browser does not say which happened.";function I(e){C.error("Could not reach GitHub to sign in.",{action:N,detail:`${z}
2
+
3
+ ${Q(e)}`,key:O,source:j})}function w(e,t){C.warn(e,{action:N,detail:t,key:O,source:j})}async function F(){let e;try{e=await fetch("https://github.com/login/device/code",{body:JSON.stringify({client_id:v,scope:"repo"}),headers:{Accept:"application/json","Content-Type":"application/json"},method:"POST"})}catch(t){return I(t),null}if(!e.ok)return w("GitHub refused to start the sign-in.",`GitHub answered ${e.status}${e.statusText?` ${e.statusText}`:""}.`),null;return await e.json()}async function dS(){let e=y();if(e)return e;let t=p();if(t)try{let{token:r}=await t.signIn();return E(r),r}catch(r){return w("GitHub sign-in was not completed.",Q(r)),null}let s=await F();if(!s)return null;let{device_code:l,user_code:u,verification_uri:b,interval:n=5}=s;return new Promise((r)=>{let i=!1,o=null,m=0,k=!1,L=(c)=>{if(k)return;if(k=!0,i=!0,o)clearTimeout(o),o=null;r(c)},x=!1,G=()=>{if(x)return;x=!0,D.close()},d=(c)=>{L(c),G()},h=async()=>{if(i)return;try{let a=await(await fetch("https://github.com/login/oauth/access_token",{body:JSON.stringify({client_id:v,device_code:l,grant_type:"urn:ietf:params:oauth:grant-type:device_code"}),headers:{Accept:"application/json","Content-Type":"application/json"},method:"POST"})).json();if(m=0,a.access_token){localStorage.setItem(S,a.access_token),d(a.access_token);return}if(a.error==="authorization_pending"){o=setTimeout(h,n*1000);return}if(a.error==="slow_down"){o=setTimeout(h,(n+5)*1000);return}w("GitHub sign-in was not completed.",a.error==="access_denied"?"The authorization was declined on GitHub.":a.error==="expired_token"?"The device code expired before it was entered.":`GitHub answered "${a.error??"an unrecognised response"}".`),d(null)}catch(c){if(m+=1,m>=Y){I(c),d(null);return}o=setTimeout(h,n*1000)}},D=A({layer:tt("dialog"),onCancel:()=>{G()},onClosed:()=>{d(null)},userCode:u,verificationUri:b});o=setTimeout(h,n*1000)})}
4
+ export{kT,ET,TT,dS};
5
+
6
+ //# debugId=8B8FD45B9B403A6964756E2164756E21
7
+ //# sourceMappingURL=studio-dgk4dqtx.js.map
@@ -0,0 +1,5 @@
1
+ function vp(t){if(Number.isNaN(t.getTime()))return"";let r=String(t.getMonth()+1).padStart(2,"0"),n=String(t.getDate()).padStart(2,"0");return`${String(t.getFullYear()).padStart(4,"0")}-${r}-${n}`}
2
+ export{vp};
3
+
4
+ //# debugId=D6CF776C927535C764756E2164756E21
5
+ //# sourceMappingURL=studio-e1g64q43.js.map