@jxsuite/studio 10.2.0 → 10.3.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 (271) hide show
  1. package/dist/chunks/{2020-bx702wqa.js → 2020-906vx2dq.js} +3 -3
  2. package/dist/chunks/adapter-hnvad61x.js +4 -0
  3. package/dist/chunks/add-new-flow-3tkn72ey.js +4 -0
  4. package/dist/chunks/cf-account-picker-xb8vvt2h.js +4 -0
  5. package/dist/chunks/cf-settings-mkbcz4z2.js +4 -0
  6. package/dist/chunks/components-w5zqwva1.js +4 -0
  7. package/dist/chunks/content-source-1vzxq1ba.js +4 -0
  8. package/dist/chunks/convert-to-repeater-gwzh9gar.js +4 -0
  9. package/dist/chunks/editor-wvf5e6j9.js +4 -0
  10. package/dist/chunks/entry-commands-mx2whrjx.js +4 -0
  11. package/dist/chunks/extension-sections-338ee35t.js +4 -0
  12. package/dist/chunks/file-ops-9bxvk59j.js +4 -0
  13. package/dist/chunks/files-t07yqqej.js +4 -0
  14. package/dist/chunks/format-host-5ja5gxyk.js +4 -0
  15. package/dist/chunks/fs-events-3424ezp3.js +4 -0
  16. package/dist/chunks/grid-open-1mpq9mzb.js +4 -0
  17. package/dist/chunks/{grid-view-tghcwrrt.js → grid-view-w9nfy203.js} +16 -16
  18. package/dist/chunks/icons-gb967qc8.js +4 -0
  19. package/dist/chunks/iframe-host-wsg0bn73.js +4 -0
  20. package/dist/chunks/image-bake-4afr4y6a.js +4 -0
  21. package/dist/chunks/image-editor-x7t8jbjn.js +4 -0
  22. package/dist/chunks/index-f9qr7kzh.js +4 -0
  23. package/dist/chunks/{index-vr006kbt.js → index-yjrfeks8.js} +3 -3
  24. package/dist/chunks/{javascript-z1g3s9fd.js → javascript-hy2mws8v.js} +3 -3
  25. package/dist/chunks/{jsonMode-7szwg8c4.js → jsonMode-vj30te2h.js} +6 -6
  26. package/dist/chunks/jx-validate-ttr5ewf0.js +4 -0
  27. package/dist/chunks/layers-m49nmwvx.js +4 -0
  28. package/dist/chunks/layers-panel-hvy2e549.js +4 -0
  29. package/dist/chunks/lit-html-k2mb9k0r.js +4 -0
  30. package/dist/chunks/media-library-ae67q4at.js +4 -0
  31. package/dist/chunks/media-open-yp9jm834.js +4 -0
  32. package/dist/chunks/media-picker-s41ngdfr.js +4 -0
  33. package/dist/chunks/{monaco-binding-v42w9c1v.js → monaco-binding-a51py33c.js} +3 -3
  34. package/dist/chunks/monaco-buffer-pa0g6ax7.js +4 -0
  35. package/dist/chunks/{monaco-setup-7bffxd6v.js → monaco-setup-g9kterhx.js} +3 -3
  36. package/dist/chunks/notify-bwehrp7q.js +4 -0
  37. package/dist/chunks/parse-hee7ne9b.js +4 -0
  38. package/dist/chunks/platform-kv0k65cy.js +4 -0
  39. package/dist/chunks/publish-panel-gzfxcm0t.js +4 -0
  40. package/dist/chunks/publish-quick-w3nxd7q4.js +4 -0
  41. package/dist/chunks/publish-workspace-dppd82tc.js +4 -0
  42. package/dist/chunks/quick-search-tdxaam55.js +4 -0
  43. package/dist/chunks/references-vqyr5s9x.js +4 -0
  44. package/dist/chunks/right-panel-0yrw4cgz.js +4 -0
  45. package/dist/chunks/source-control-6fk72me2.js +4 -0
  46. package/dist/chunks/{studio-j3d2fjqz.js → studio-0939t1q1.js} +4 -4
  47. package/dist/chunks/studio-0gvvqj3h.js +5 -0
  48. package/dist/chunks/studio-0khd8xtx.js +4 -0
  49. package/dist/chunks/studio-0w3541dg.js +7 -0
  50. package/dist/chunks/{studio-9b7177jq.js → studio-0x6f3nk9.js} +4 -4
  51. package/dist/chunks/studio-1410q5dw.js +5 -0
  52. package/dist/chunks/{studio-awxwjawq.js → studio-15hwqgd8.js} +4 -4
  53. package/dist/chunks/studio-1ks5d9y4.js +5 -0
  54. package/dist/chunks/{studio-881z1xrx.js → studio-2ggfzrrd.js} +4 -4
  55. package/dist/chunks/{studio-4jhw38b2.js → studio-321ym1tt.js} +4 -4
  56. package/dist/chunks/studio-3c10v2q1.js +5 -0
  57. package/dist/chunks/{studio-bvs9kpst.js → studio-3na1r48j.js} +8 -8
  58. package/dist/chunks/{studio-86r8hp7r.js → studio-3q7mhbgx.js} +5 -5
  59. package/dist/chunks/studio-3qr08sxq.js +4 -0
  60. package/dist/chunks/studio-3xk9zdgb.js +5 -0
  61. package/dist/chunks/{studio-qh8berdz.js → studio-423tfdte.js} +4 -4
  62. package/dist/chunks/{studio-75kcdbsk.js → studio-45mj4jqe.js} +4 -4
  63. package/dist/chunks/studio-4f7thq0p.js +5 -0
  64. package/dist/chunks/studio-4fnb5648.js +5 -0
  65. package/dist/chunks/studio-4zd6an2b.js +5 -0
  66. package/dist/chunks/studio-53wy9ek3.js +5 -0
  67. package/dist/chunks/studio-5n193zqd.js +5 -0
  68. package/dist/chunks/{studio-9rbe2xpw.js → studio-5tet77de.js} +3 -3
  69. package/dist/chunks/{studio-ybnwymxw.js → studio-7rrdbvex.js} +4 -4
  70. package/dist/chunks/studio-8kx6m0rg.js +5 -0
  71. package/dist/chunks/{studio-sxdb9h3q.js → studio-90zkgne5.js} +7 -7
  72. package/dist/chunks/studio-9c6cbq2c.js +4 -0
  73. package/dist/chunks/studio-9dq7rwc7.js +5 -0
  74. package/dist/chunks/{studio-cg1bfyhf.js → studio-9qx1ywbv.js} +8 -8
  75. package/dist/chunks/studio-a65kbs2e.js +9 -0
  76. package/dist/chunks/studio-aam8zt8z.js +5 -0
  77. package/dist/chunks/{studio-er5f383a.js → studio-abh9kfdh.js} +4 -4
  78. package/dist/chunks/studio-b4e0ftkt.js +5 -0
  79. package/dist/chunks/studio-b68k0z00.js +5 -0
  80. package/dist/chunks/{studio-399a25za.js → studio-bct64zmj.js} +4 -4
  81. package/dist/chunks/studio-bz0b5brj.js +6 -0
  82. package/dist/chunks/studio-cfnn70h1.js +5 -0
  83. package/dist/chunks/studio-daksw8kh.js +5 -0
  84. package/dist/chunks/{studio-r7pf0rkv.js → studio-e7vjyp04.js} +7 -7
  85. package/dist/chunks/studio-ea6r1zyr.js +5 -0
  86. package/dist/chunks/studio-egnjpyde.js +9 -0
  87. package/dist/chunks/studio-ejrypvmq.js +5 -0
  88. package/dist/chunks/studio-eqcddvc2.js +928 -0
  89. package/dist/chunks/studio-f8tyeyzt.js +5 -0
  90. package/dist/chunks/studio-fj6c905s.js +5 -0
  91. package/dist/chunks/{studio-646nn2ys.js → studio-fkrr7kgg.js} +5 -5
  92. package/dist/chunks/studio-fspe7m9t.js +5 -0
  93. package/dist/chunks/studio-g0hxtcga.js +5 -0
  94. package/dist/chunks/{studio-th7z3fg7.js → studio-g9brbewz.js} +4 -4
  95. package/dist/chunks/studio-ggx3j7nd.js +5 -0
  96. package/dist/chunks/{studio-43y04qck.js → studio-hfxttkyr.js} +4 -4
  97. package/dist/chunks/studio-hh394phe.js +5 -0
  98. package/dist/chunks/{studio-pjtntksy.js → studio-j0zf5x2x.js} +4 -4
  99. package/dist/chunks/studio-jeb7hth3.js +5 -0
  100. package/dist/chunks/studio-k0xzrse2.js +64 -0
  101. package/dist/chunks/studio-k1xqrgm5.js +5 -0
  102. package/dist/chunks/studio-k2evngrj.js +7 -0
  103. package/dist/chunks/studio-k3we3kqb.js +5 -0
  104. package/dist/chunks/{studio-sevbc3xv.js → studio-n9qba0gx.js} +4 -4
  105. package/dist/chunks/{studio-6hzdjfv0.js → studio-nf8esxxc.js} +4 -4
  106. package/dist/chunks/studio-nn4f9m9c.js +5 -0
  107. package/dist/chunks/studio-nskxe9q1.js +6 -0
  108. package/dist/chunks/{studio-ea74s8c1.js → studio-nvcn2ykc.js} +4 -4
  109. package/dist/chunks/studio-nwynxqtb.js +5 -0
  110. package/dist/chunks/studio-nzemfbkk.js +14 -0
  111. package/dist/chunks/studio-p2a03pgm.js +5 -0
  112. package/dist/chunks/{studio-4g8yb6jn.js → studio-pm17wdc4.js} +4 -4
  113. package/dist/chunks/{studio-71m92v9s.js → studio-q80fg1d6.js} +7 -7
  114. package/dist/chunks/studio-r050sez0.js +6 -0
  115. package/dist/chunks/studio-s7t4vp1d.js +6 -0
  116. package/dist/chunks/studio-s9fng7m8.js +7 -0
  117. package/dist/chunks/studio-sce30r7b.js +4 -0
  118. package/dist/chunks/studio-stahswgb.js +7 -0
  119. package/dist/chunks/studio-swedpd82.js +5 -0
  120. package/dist/chunks/studio-thz5t120.js +5 -0
  121. package/dist/chunks/studio-tpxcryf2.js +5 -0
  122. package/dist/chunks/{studio-wc6za3zs.js → studio-v5wktj6f.js} +4 -4
  123. package/dist/chunks/{studio-kg1abnz0.js → studio-vpevkfxw.js} +4 -4
  124. package/dist/chunks/studio-waekn290.js +5 -0
  125. package/dist/chunks/studio-wfct4h6n.js +5 -0
  126. package/dist/chunks/studio-wgc54sxf.js +5 -0
  127. package/dist/chunks/studio-wqfaqw4m.js +5 -0
  128. package/dist/chunks/studio-wse1rs8t.js +7 -0
  129. package/dist/chunks/studio-x0gsfr1d.js +16 -0
  130. package/dist/chunks/{studio-hhp4x8xf.js → studio-xpx91fby.js} +5 -5
  131. package/dist/chunks/studio-y1b86ast.js +5 -0
  132. package/dist/chunks/studio-yrcrncev.js +5 -0
  133. package/dist/chunks/{studio-rzqaz21g.js → studio-yzpskb0j.js} +4 -4
  134. package/dist/chunks/studio-zfdbmhp3.js +5 -0
  135. package/dist/chunks/{tsMode-f54j66ym.js → tsMode-jg1dtphj.js} +7 -7
  136. package/dist/chunks/workspace-9btkc8tk.js +4 -0
  137. package/dist/chunks/workspace-home-qcc4z5ag.js +4 -0
  138. package/dist/chunks/{ws-client-e8kj684q.js → ws-client-arz2qsy9.js} +3 -3
  139. package/dist/iframe-entry.js +13 -13
  140. package/dist/manifest.json +83 -78
  141. package/dist/studio.js +84 -84
  142. package/package.json +2 -2
  143. package/src/browse/library-pane.ts +44 -29
  144. package/src/browse/library-preview.ts +6 -2
  145. package/src/canvas/asset-refs.ts +13 -4
  146. package/src/canvas/asset-resolve.ts +54 -11
  147. package/src/canvas/canvas-render.ts +25 -0
  148. package/src/canvas/iframe-entry.ts +5 -1
  149. package/src/canvas/iframe-host.ts +16 -6
  150. package/src/canvas/iframe-protocol.ts +9 -1
  151. package/src/commands/context.ts +5 -0
  152. package/src/commands/live-context.ts +5 -2
  153. package/src/editor/shortcuts.ts +3 -0
  154. package/src/files/asset-versions.ts +108 -2
  155. package/src/files/file-ops.ts +11 -1
  156. package/src/files/files.ts +111 -48
  157. package/src/files/media-paths.ts +12 -4
  158. package/src/files/media-upload.ts +195 -21
  159. package/src/files/new-file-name.ts +39 -1
  160. package/src/media/image-bake.ts +164 -0
  161. package/src/media/image-editor.ts +846 -0
  162. package/src/media/image-format.ts +262 -0
  163. package/src/media/image-recipe.ts +651 -0
  164. package/src/media/media-commands.ts +65 -1
  165. package/src/media/media-library-model.ts +1 -1
  166. package/src/media/media-library.ts +175 -15
  167. package/src/media/media-open.ts +156 -3
  168. package/src/media/media-pane.ts +8 -4
  169. package/src/panels/pane-context.ts +6 -1
  170. package/src/panels/tab-strip.ts +12 -3
  171. package/src/studio.ts +13 -2
  172. package/src/surfaces/image-editor.json +1390 -0
  173. package/src/surfaces/image-editor.ts +272 -0
  174. package/src/surfaces/media-library.json +129 -1
  175. package/src/surfaces/media-library.ts +17 -2
  176. package/src/types.ts +2 -1
  177. package/src/workspace/tab-workspace.ts +2 -1
  178. package/src/workspace/workspace-switch.ts +3 -1
  179. package/src/workspace/workspace.ts +22 -1
  180. package/dist/chunks/adapter-pp011m5x.js +0 -4
  181. package/dist/chunks/add-new-flow-ecqmzz76.js +0 -4
  182. package/dist/chunks/cf-account-picker-c07znkqt.js +0 -4
  183. package/dist/chunks/cf-settings-0v2bmqy0.js +0 -4
  184. package/dist/chunks/components-yn0dn2pq.js +0 -4
  185. package/dist/chunks/content-source-g0j41yy6.js +0 -4
  186. package/dist/chunks/convert-to-repeater-sbjk7tgn.js +0 -4
  187. package/dist/chunks/editor-xz02jeh1.js +0 -4
  188. package/dist/chunks/entry-commands-kmt02crp.js +0 -4
  189. package/dist/chunks/extension-sections-0rprf12d.js +0 -4
  190. package/dist/chunks/file-ops-mexj5qed.js +0 -4
  191. package/dist/chunks/files-b2tcppdd.js +0 -4
  192. package/dist/chunks/format-host-btsevv0c.js +0 -4
  193. package/dist/chunks/fs-events-r0apejva.js +0 -4
  194. package/dist/chunks/grid-open-n2a8xkht.js +0 -4
  195. package/dist/chunks/icons-853n6qt3.js +0 -4
  196. package/dist/chunks/iframe-host-gx0ypyh3.js +0 -4
  197. package/dist/chunks/index-bs4k9tr6.js +0 -4
  198. package/dist/chunks/jx-validate-ymf10teh.js +0 -4
  199. package/dist/chunks/layers-p9nfya38.js +0 -4
  200. package/dist/chunks/layers-panel-tt1hzhhf.js +0 -4
  201. package/dist/chunks/lit-html-x18n2sfz.js +0 -4
  202. package/dist/chunks/media-library-0n45gv8r.js +0 -4
  203. package/dist/chunks/media-picker-s09at95z.js +0 -4
  204. package/dist/chunks/monaco-buffer-een2ea0v.js +0 -4
  205. package/dist/chunks/notify-qwb8radt.js +0 -4
  206. package/dist/chunks/parse-v77xtwv7.js +0 -4
  207. package/dist/chunks/platform-8jnez0wr.js +0 -4
  208. package/dist/chunks/publish-panel-aysnj611.js +0 -4
  209. package/dist/chunks/publish-quick-kpbqs9mz.js +0 -4
  210. package/dist/chunks/publish-workspace-nd0a8q99.js +0 -4
  211. package/dist/chunks/quick-search-vg0jkhk2.js +0 -4
  212. package/dist/chunks/references-a7v6a0e2.js +0 -4
  213. package/dist/chunks/right-panel-cvk1vxx5.js +0 -4
  214. package/dist/chunks/source-control-fsqzc6he.js +0 -4
  215. package/dist/chunks/studio-05jfwbmf.js +0 -5
  216. package/dist/chunks/studio-0q5jwddh.js +0 -9
  217. package/dist/chunks/studio-0w2dr0q8.js +0 -5
  218. package/dist/chunks/studio-1tzpds97.js +0 -9
  219. package/dist/chunks/studio-216b27sv.js +0 -4
  220. package/dist/chunks/studio-2ejhqns4.js +0 -5
  221. package/dist/chunks/studio-2r90cts3.js +0 -16
  222. package/dist/chunks/studio-399xknkb.js +0 -6
  223. package/dist/chunks/studio-4ncmwqw5.js +0 -5
  224. package/dist/chunks/studio-5atwjgkj.js +0 -7
  225. package/dist/chunks/studio-5frqk7c0.js +0 -5
  226. package/dist/chunks/studio-6cwj6xrx.js +0 -5
  227. package/dist/chunks/studio-78pywnp2.js +0 -6
  228. package/dist/chunks/studio-886t6ztg.js +0 -5
  229. package/dist/chunks/studio-8wnvtr4z.js +0 -5
  230. package/dist/chunks/studio-8z66jk4z.js +0 -5
  231. package/dist/chunks/studio-b2qpt0xy.js +0 -14
  232. package/dist/chunks/studio-c71806xz.js +0 -7
  233. package/dist/chunks/studio-cbwks69x.js +0 -928
  234. package/dist/chunks/studio-cg710sk9.js +0 -5
  235. package/dist/chunks/studio-cw0wb9qk.js +0 -7
  236. package/dist/chunks/studio-cyheys7k.js +0 -5
  237. package/dist/chunks/studio-ea5m9kg5.js +0 -5
  238. package/dist/chunks/studio-efdxjwyp.js +0 -64
  239. package/dist/chunks/studio-egmw2837.js +0 -5
  240. package/dist/chunks/studio-f746039f.js +0 -5
  241. package/dist/chunks/studio-fmdymd9v.js +0 -5
  242. package/dist/chunks/studio-gcm12z00.js +0 -6
  243. package/dist/chunks/studio-gj98m8gy.js +0 -7
  244. package/dist/chunks/studio-hasbgjah.js +0 -5
  245. package/dist/chunks/studio-hz5n7x27.js +0 -5
  246. package/dist/chunks/studio-jeraxdgv.js +0 -7
  247. package/dist/chunks/studio-jvgek9xt.js +0 -5
  248. package/dist/chunks/studio-jws1a87n.js +0 -5
  249. package/dist/chunks/studio-k2sz13zg.js +0 -5
  250. package/dist/chunks/studio-k3m4jkdk.js +0 -5
  251. package/dist/chunks/studio-kg5ya5r2.js +0 -5
  252. package/dist/chunks/studio-khwbgrtg.js +0 -5
  253. package/dist/chunks/studio-mx6wzh25.js +0 -5
  254. package/dist/chunks/studio-mxs3ar9t.js +0 -5
  255. package/dist/chunks/studio-nm4szey4.js +0 -5
  256. package/dist/chunks/studio-nqxqf8p2.js +0 -4
  257. package/dist/chunks/studio-qn7z4krm.js +0 -5
  258. package/dist/chunks/studio-qyed0ah6.js +0 -5
  259. package/dist/chunks/studio-r4bcdwhq.js +0 -5
  260. package/dist/chunks/studio-rtfnhrdg.js +0 -5
  261. package/dist/chunks/studio-s5tzw84t.js +0 -5
  262. package/dist/chunks/studio-t51y8v1d.js +0 -5
  263. package/dist/chunks/studio-t98vq4r6.js +0 -5
  264. package/dist/chunks/studio-tsxpqvh0.js +0 -6
  265. package/dist/chunks/studio-v1yascv2.js +0 -5
  266. package/dist/chunks/studio-wxq6v5sv.js +0 -5
  267. package/dist/chunks/studio-y60sts62.js +0 -4
  268. package/dist/chunks/studio-zndrqawb.js +0 -5
  269. package/dist/chunks/studio-zwaxn5s2.js +0 -5
  270. package/dist/chunks/workspace-home-x1787wpv.js +0 -4
  271. package/dist/chunks/workspace-zpe1np43.js +0 -4
@@ -1,5 +1,5 @@
1
- import{Q}from"./studio-nqxqf8p2.js";import{dw,ju}from"./studio-rzqaz21g.js";import{L,R}from"./studio-0w2dr0q8.js";import{g}from"./studio-y60sts62.js";import{Zc,Nx}from"./studio-k2sz13zg.js";import{Wl,ym}from"./studio-egmw2837.js";import{n,v}from"./studio-8z66jk4z.js";import{le}from"./studio-j3d2fjqz.js";var z_=["string","number","boolean","array","object","reference"],W_=["","image","date","color"],Ld={format:"",name:"",required:!1,type:"string"};function sb(e){if(e.$ref)return"reference";return e.type||"string"}function $d(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 D={$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"}]}]}}}]};L("schema-builder",D);function _(){return{addFormat:"",addHasFormat:!0,addName:"",addRequired:!1,addState:"closed",addType:"string",fields:[],formatOptions:[],targets:[],typeOptions:[]}}function B(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 E={$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"}]}}}]};L("reference-field",E);function Y(){return{canRetry:!1,disabled:!0,hasNote:!1,kind:"picker",label:"",note:"",noteTone:"dim",options:[],value:""}}function M(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."}}]};L("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=z_.map((e)=>({label:e,value:e})),ee=W_.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 T(e){return`name:${e}`}function k(e){return`required:${e}`}function C(e,s){return`${e} ${s}`}function q(e,s,t){return e.echo?.id===s?e.echo.value:t}function oe(e,s,t,o,r){let l=C(s,t),p=sb(o);return{format:$d(o),hasFormat:S(p),key:t,name:q(e,T(l),t),parent:s,required:q(e,k(l),r),type:p}}function ie(e,s,t,o,r){let l=sb(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:$d(t),hasFormat:S(l),key:s,label:Zc(s),name:q(e,T(s),s),refTarget:t.$ref?t.$ref.replace(/^#\/[^/]+\//,""):"",required:q(e,k(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 A(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:{...Ld},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=()=>H.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],j=(a)=>{let i=r.drafts.get(a);if(!i)i={name:"",type:"string"},r.drafts.set(a,i);return i},H=B(e,{addNested(a){let i=j(a),c=Nx(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={...Ld},u()},confirmAdd(){let a=Nx(r.add.name.trim());if(!a)return;let{format:i,required:c,type:m}=r.add;r.addOpen=!1,r.add={...Ld},h((f)=>{if(f.properties[a]=ya(m,i||void 0),c)A(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){j(a).name=i,u()},editDraftType(a,i){j(a).type=i,u()},openAdd(){r.addOpen=!0,r.add={...Ld},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(T(a),i);let c=Nx(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(T(C(a,i)),c);let m=Nx(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(k(C(a,i)),c),h((m)=>{let f=w(m,a);if(!f)return!1;return A(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)?$d(b):void 0;return f.properties[i]=ya(c,N||void 0),!0})},setRequired(a,i){d(k(a),i),h((c)=>{if(!c.properties[a])return!1;return A(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)?$d(m):void 0;return c.properties[a]=ya(i,f||void 0),!0})}});return u(),{dispose:()=>H.dispose(),update(a){t=a,o=null,r.echo=null,u()}}}var de={mount:se};dw("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};dw("secret",pe);function me(e,s){let t=s,o=()=>{Wl(e,t.key,n(t.value)?t.value:"",(r)=>t.onChange(r===""?void 0:r),{images:!0})};return o(),{dispose:()=>ym(e),update(r){t=r,o()}}}var ue={mount:me};dw("media",ue);var F=new Map,O=new Map,x=new Map;function dm(e){if(e===void 0)F.clear(),O.clear(),x.clear();else F.delete(e),O.delete(e),x.delete(e)}function fe(e){let s=F.get(e);if(s)return s;let t=(le("g0j41yy6"),import("./content-source-g0j41yy6.js")).then((o)=>o.listCollectionEntryIds(e));return F.set(e,t),t}function xE(e,s){let t=O.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),O.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=ju(e.schema);if(r===null)return{...o,hasNote:!0,kind:"text",note:'No collection referenced — add "$ref": "#/content/<type>" to this field.'};let l=xE(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=M(e,{choose(p){t.onChange(p===""?void 0:p)},edit(p){t.onChange(p.trim()||void 0)},retry(){let p=ju(t.schema);if(p!==null)dm(p);r()}});return r(),{dispose(){o=!0,l.dispose()},update(p){t=p,r()}}}var ye={mount:ge};dw("reference",ye);
2
- export{z_,W_,Ld,sb,$d,ya,dm,xE};
1
+ import{X}from"./studio-9c6cbq2c.js";import{Iw,Vu}from"./studio-yzpskb0j.js";import{ed,Qx}from"./studio-yrcrncev.js";import{Kl,Cm}from"./studio-waekn290.js";import{E,R}from"./studio-9dq7rwc7.js";import{g}from"./studio-3qr08sxq.js";import{n,v}from"./studio-k3we3kqb.js";import{ce}from"./studio-0939t1q1.js";var vS=["string","number","boolean","array","object","reference"],yS=["","image","date","color"],Dd={format:"",name:"",required:!1,type:"string"};function Sb(e){if(e.$ref)return"reference";return e.type||"string"}function Nd(e){if(e.type==="array"&&e.items?.format)return e.items.format;return e.format||""}function _a(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 D={$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"}]}]}}}]};E("schema-builder",D);function _(){return{addFormat:"",addHasFormat:!0,addName:"",addRequired:!1,addState:"closed",addType:"string",fields:[],formatOptions:[],targets:[],typeOptions:[]}}function B(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"}]}}}]};E("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."}}]};E("secret-field",V);function Q(){return{disabled:!0,label:"",placeholder:"Not set"}}function z(e,s){e.textContent="";let t=g({...Q(),...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=vS.map((e)=>({label:e,value:e})),ee=yS.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 T(e){return`name:${e}`}function k(e){return`required:${e}`}function C(e,s){return`${e} ${s}`}function q(e,s,t){return e.echo?.id===s?e.echo.value:t}function oe(e,s,t,o,r){let l=C(s,t),p=Sb(o);return{format:Nd(o),hasFormat:S(p),key:t,name:q(e,T(l),t),parent:s,required:q(e,k(l),r),type:p}}function ie(e,s,t,o,r){let l=Sb(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:Nd(t),hasFormat:S(l),key:s,label:ed(s),name:q(e,T(s),s),refTarget:t.$ref?t.$ref.replace(/^#\/[^/]+\//,""):"",required:q(e,k(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 A(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:{...Dd},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=()=>H.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],j=(a)=>{let i=r.drafts.get(a);if(!i)i={name:"",type:"string"},r.drafts.set(a,i);return i},H=B(e,{addNested(a){let i=j(a),c=Qx(i.name.trim());if(!c)return;h((m)=>{let f=w(m,a);if(!f)return!1;return f.properties??={},f.properties[c]=_a(i.type||"string"),i.name="",!0})},cancelAdd(){r.addOpen=!1,r.add={...Dd},u()},confirmAdd(){let a=Qx(r.add.name.trim());if(!a)return;let{format:i,required:c,type:m}=r.add;r.addOpen=!1,r.add={...Dd},h((f)=>{if(f.properties[a]=_a(m,i||void 0),c)A(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){j(a).name=i,u()},editDraftType(a,i){j(a).type=i,u()},openAdd(){r.addOpen=!0,r.add={...Dd},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(T(a),i);let c=Qx(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(T(C(a,i)),c);let m=Qx(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]=_a(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]=_a(b.type||"string",c||void 0),!0})},setNestedRequired(a,i,c){d(k(C(a,i)),c),h((m)=>{let f=w(m,a);if(!f)return!1;return A(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)?Nd(b):void 0;return f.properties[i]=_a(c,N||void 0),!0})},setRequired(a,i){d(k(a),i),h((c)=>{if(!c.properties[a])return!1;return A(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)?Nd(m):void 0;return c.properties[a]=_a(i,f||void 0),!0})}});return u(),{dispose:()=>H.dispose(),update(a){t=a,o=null,r.echo=null,u()}}}var de={mount:se};Iw("schema-builder",de);function J(e){return n(e)&&e?e:null}function le(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:le};Iw("secret",pe);function me(e,s){let t=s,o=()=>{Kl(e,t.key,n(t.value)?t.value:"",(r)=>t.onChange(r===""?void 0:r),{images:!0})};return o(),{dispose:()=>Cm(e),update(r){t=r,o()}}}var ue={mount:me};Iw("media",ue);var F=new Map,O=new Map,x=new Map;function wm(e){if(e===void 0)F.clear(),O.clear(),x.clear();else F.delete(e),O.delete(e),x.delete(e)}function fe(e){let s=F.get(e);if(s)return s;let t=(ce("1vzxq1ba"),import("./content-source-1vzxq1ba.js")).then((o)=>o.listCollectionEntryIds(e));return F.set(e,t),t}function rT(e,s){let t=O.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),O.set(e,p);for(let d of u??[])d()};return o.then((p)=>l({ids:p}),(p)=>l({error:X(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=Vu(e.schema);if(r===null)return{...o,hasNote:!0,kind:"text",note:'No collection referenced — add "$ref": "#/content/<type>" to this field.'};let l=rT(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=Vu(t.schema);if(p!==null)wm(p);r()}});return r(),{dispose(){o=!0,l.dispose()},update(p){t=p,r()}}}var ye={mount:ge};Iw("reference",ye);
2
+ export{vS,yS,Dd,Sb,Nd,_a,wm,rT};
3
3
 
4
- //# debugId=D001B4983A2AA7A664756E2164756E21
5
- //# sourceMappingURL=studio-qh8berdz.js.map
4
+ //# debugId=FE884CA0C1833B7B64756E2164756E21
5
+ //# sourceMappingURL=studio-423tfdte.js.map
@@ -1,5 +1,5 @@
1
- import{n,_}from"./studio-8z66jk4z.js";var w=["order","widths","hidden","sort","groupBy","filter"],g="jx-grid-layout:";function c(){try{return typeof localStorage>"u"?null:localStorage}catch{return null}}function u(e){let t=c()?.getItem(g+e);if(!t)return null;try{let r=JSON.parse(t);return _(r)?r:null}catch{return null}}function f(e,t){c()?.setItem(g+e,JSON.stringify(t))}function a(e){let t={};for(let r of w)if(e[r]!==void 0)Object.assign(t,{[r]:e[r]});return t}function v(e){return JSON.stringify(w.map((t)=>e[t]??null))}function Cd(e){let t=u(e);return t?a(t):null}function rm(e,t){if(!c())return;let o=u(e)??{},s={...o,widths:{...o.widths,...t.widths}};for(let i of w)if(i!=="widths"&&t[i]!==void 0)Object.assign(s,{[i]:t[i]});f(e,s)}function Gk(e){let t=u(e);if(!t)return;let r={active:null};if(t.views)r.views=t.views;f(e,r)}function Iu(e){let t=u(e)?.views;return Array.isArray(t)?t.filter((r)=>G(r)):[]}function G(e){return _(e)&&"name"in e&&n(e.name)}function L_(e){return u(e)?.active??null}function qR(e){let t=u(e),r=t?.active;if(!t||!r)return!1;let o=Iu(e).find((s)=>s.name===r);return o?v(a(o))!==v(a(t)):!1}function GR(e,t){let r=t.trim(),o=c();if(r===""||!o)return null;let s=u(e)??{},i={name:r,...a(s)},d=Iu(e).filter((l)=>l.name!==r);return d.push(i),f(e,{...s,active:r,views:d}),i}function Wy(e,t){let r=Iu(e).find((i)=>i.name===t);if(!r||!c())return null;let o=u(e)??{},s=a(r);return f(e,{active:r.name,views:o.views??[],...s}),s}function Kk(e,t){let r=u(e);if(!r||!c())return!1;let o=Iu(e),s=o.filter((i)=>i.name!==t);if(s.length===o.length)return!1;return f(e,{...r,active:r.active===t?null:r.active??null,views:s}),!0}function KR(e,t){if(!t)return e;let r=new Set(t.hidden),o=[];for(let i of e){if(i.field!==void 0&&r.has(i.field))continue;let d=i.field?t.widths?.[i.field]:void 0;o.push(d?{...i,width:d}:i)}if(!t.order?.length)return o;let s=new Map(t.order.map((i,d)=>[i,d]));return o.map((i,d)=>({def:i,index:d})).toSorted((i,d)=>{let l=s.get(i.def.field??"")??t.order.length+i.index,p=s.get(d.def.field??"")??t.order.length+d.index;return l-p}).map(({def:i})=>i)}
2
- export{Cd,rm,Gk,Iu,L_,qR,GR,Wy,Kk,KR};
1
+ import{n,_}from"./studio-k3we3kqb.js";var w=["order","widths","hidden","sort","groupBy","filter"],g="jx-grid-layout:";function c(){try{return typeof localStorage>"u"?null:localStorage}catch{return null}}function u(e){let t=c()?.getItem(g+e);if(!t)return null;try{let r=JSON.parse(t);return _(r)?r:null}catch{return null}}function f(e,t){c()?.setItem(g+e,JSON.stringify(t))}function a(e){let t={};for(let r of w)if(e[r]!==void 0)Object.assign(t,{[r]:e[r]});return t}function v(e){return JSON.stringify(w.map((t)=>e[t]??null))}function Pd(e){let t=u(e);return t?a(t):null}function Sm(e,t){if(!c())return;let o=u(e)??{},s={...o,widths:{...o.widths,...t.widths}};for(let i of w)if(i!=="widths"&&t[i]!==void 0)Object.assign(s,{[i]:t[i]});f(e,s)}function ST(e){let t=u(e);if(!t)return;let r={active:null};if(t.views)r.views=t.views;f(e,r)}function Uu(e){let t=u(e)?.views;return Array.isArray(t)?t.filter((r)=>G(r)):[]}function G(e){return _(e)&&"name"in e&&n(e.name)}function kS(e){return u(e)?.active??null}function LN(e){let t=u(e),r=t?.active;if(!t||!r)return!1;let o=Uu(e).find((s)=>s.name===r);return o?v(a(o))!==v(a(t)):!1}function $N(e,t){let r=t.trim(),o=c();if(r===""||!o)return null;let s=u(e)??{},i={name:r,...a(s)},d=Uu(e).filter((l)=>l.name!==r);return d.push(i),f(e,{...s,active:r,views:d}),i}function Rw(e,t){let r=Uu(e).find((i)=>i.name===t);if(!r||!c())return null;let o=u(e)??{},s=a(r);return f(e,{active:r.name,views:o.views??[],...s}),s}function CT(e,t){let r=u(e);if(!r||!c())return!1;let o=Uu(e),s=o.filter((i)=>i.name!==t);if(s.length===o.length)return!1;return f(e,{...r,active:r.active===t?null:r.active??null,views:s}),!0}function IN(e,t){if(!t)return e;let r=new Set(t.hidden),o=[];for(let i of e){if(i.field!==void 0&&r.has(i.field))continue;let d=i.field?t.widths?.[i.field]:void 0;o.push(d?{...i,width:d}:i)}if(!t.order?.length)return o;let s=new Map(t.order.map((i,d)=>[i,d]));return o.map((i,d)=>({def:i,index:d})).toSorted((i,d)=>{let l=s.get(i.def.field??"")??t.order.length+i.index,p=s.get(d.def.field??"")??t.order.length+d.index;return l-p}).map(({def:i})=>i)}
2
+ export{Pd,Sm,ST,Uu,kS,LN,$N,Rw,CT,IN};
3
3
 
4
- //# debugId=E7D07D86860F64A764756E2164756E21
5
- //# sourceMappingURL=studio-75kcdbsk.js.map
4
+ //# debugId=318ED8B7FAE7E41F64756E2164756E21
5
+ //# sourceMappingURL=studio-45mj4jqe.js.map
@@ -0,0 +1,5 @@
1
+ import{n,Y,Ze,Q,_,v,Pe,Go,Jn,xf,it}from"./studio-k3we3kqb.js";var Lv=400;var tf=350,d1=300,MM=30000;function rr(e){return Array.isArray(e?.children)?e.children:[]}function $v(e,t,i=""){if(!_(e))return e;if(Array.isArray(e)){for(let[l,s]of e.entries())$v(s,t,`${i}/${l}`);return e}let r=e,{children:o}=r;if(Go(o)){let l=o;t?.(i,l),r.children=[l]}if(Array.isArray(r.children))for(let[l,s]of r.children.entries())$v(s,t,`${i}/children/${l}`);if(r.$prototype==="Array"&&_(r.map))$v(r.map,t,`${i}/map`);if(_(r.cases))for(let[l,s]of Object.entries(r.cases))$v(s,t,`${i}/cases/${LI(l)}`);return e}function LI(e){return String(e).replaceAll("~","~0").replaceAll("/","~1")}function Vt(e){return e.length>=2?e.slice(0,-2):null}function zi(e){return e.at(-1)}function $I(e){return e.join("/")}function Cr(e,t){if(e===t)return!0;if(!e||!t||e.length!==t.length)return!1;return e.every((i,r)=>i===t[r])}function kh(e,t=[],i=0){let r=[];return u(e,t,i,r,!1),r}function u(e,t,i,r,o){if(n(e)||Y(e)||Ze(e)){if(!o)r.push({depth:i,node:e,nodeType:"text",path:t});return}if(e.$prototype==="Array"){if(!o)r.push({depth:i,node:e,nodeType:"map",path:t});let s=e.map;if(_(s))u(s,[...t,"map"],i+1,r,!1);return}if(!o)r.push({depth:i,node:e,nodeType:"element",path:t});if(e.$props&&it(e.tagName).includes("-")&&!Array.isArray(e.children))return;let{children:l}=e;if(Array.isArray(l))for(let s=0;s<l.length;s++){let a=[...t,"children",s];u(l[s],a,i+1,r,!1)}else if(Go(l))u(l,[...t,"children"],i+1,r,!1);if(e.$switch&&_(e.cases))for(let[s,a]of Object.entries(e.cases)){let p=[...t,"cases",s];if(_(a)&&a.$ref)r.push({depth:i+1,node:a,nodeType:"case-ref",path:p});else if(_(a))r.push({depth:i+1,node:a,nodeType:"case",path:p}),u(a,p,i+2,r,!0)}}function kr(e){if(!e)return"?";if(e.$prototype==="Array"){let{items:r}=e;return`Repeater → ${(Pe(r)?r.$ref:void 0)||"items"}`}if(e.$title)return e.$title;if(e.$id)return e.$id;if(e.tagName==="slot"){let r=e.attributes?.name;return n(r)&&r.trim()?`slot: ${r.trim()}`:"slot"}let t=it(e.tagName)||"div",i=e.$switch?" ⇆":"";if(n(e.textContent)&&e.textContent.length>0)return`${t} — ${e.textContent.slice(0,24)}${i}`;return t+i}var C=null;function id(e){C=e}function _n(){return C}function Eh(e){return _(e)}function nf(e){if(Array.isArray(e))return e.map((i)=>nf(i));if(!Jn(e))return e;let t={};for(let[i,r]of Object.entries(e)){if(i.startsWith("on")&&xf(r))continue;if(i==="children")t.children=Array.isArray(r)?r.map((o)=>nf(o)):nf(r);else if(i==="cases"&&Eh(r)){let o={};for(let[l,s]of Object.entries(r))o[l]=nf(s);t.cases=o}else if(i==="state"&&Eh(r)){let o={};for(let[l,s]of Object.entries(r)){if(v(s)&&s.timing==="server")continue;o[l]=s}t.state=o}else t[i]=r}return t}var u1=null,Th=null,II=null,RI=null,DI=null;function c(e){let t=document.querySelector(`#${e}`);return t instanceof HTMLElement?t:null}function PM(){u1=c("activity-bar"),Th=c("left-panel"),II=c("right-panel"),RI=c("toolbar"),DI=c("statusbar")}function of(e,t){if(!e)throw TypeError(`#${t} is not in the shell yet; initShellRefs() has not found it`);return e}var ig=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),NI=[":hover",":focus",":active",":focus-within",":focus-visible",":disabled",":first-child",":last-child","::before","::after","::placeholder"];function s0(e){return e.startsWith(":")||e.startsWith(".")||e.startsWith("&")||e.startsWith("[")}var f=new Map;function a0(e,t,i){let r=t??Lv;return(...o)=>{clearTimeout(f.get(e)),f.set(e,setTimeout(()=>{f.delete(e),i(...o)},r))}}function FM(e){clearTimeout(f.get(e)),f.delete(e)}var x=new Map;function y(e){return(_(e)||Q(e))&&"then"in e&&Q(e.then)}var d=0;function jM(){return d}function m(e,t){d+=1;let i=()=>{d-=1},r=null;try{let o=t();if(y(o))r=o}catch(o){console.error(`Renderer "${e}" failed:`,o)}if(!r){i();return}r.then(i,(o)=>{console.error(`Renderer "${e}" failed:`,o),i()})}function og(e,t){x.set(e,t)}function sr(){for(let[e,t]of x.entries())m(e,t)}function wn(...e){for(let t of e){let i=x.get(t);if(!i)continue;m(t,i)}}function vl(e,t){if(e){if(t.selection!==void 0)e.session.selection=t.selection;if(t.hover!==void 0)e.session.hover=t.hover;if(t.clipboard!==void 0)e.session.clipboard=t.clipboard;if(t.ui)Object.assign(e.session.ui,t.ui);if(t.canvas)Object.assign(e.session.canvas,t.canvas)}}function Na(e,t,i){if(e)e.session.ui[t]=i}function HM(e,t){if(e)Object.assign(e.session.canvas,t)}
2
+ export{Lv,tf,d1,MM,rr,$v,LI,Vt,zi,$I,Cr,kh,kr,C,id,_n,Eh,nf,u1,Th,II,RI,DI,PM,of,ig,NI,s0,a0,FM,jM,og,sr,wn,vl,Na,HM};
3
+
4
+ //# debugId=C365A06DD248F72464756E2164756E21
5
+ //# sourceMappingURL=studio-4f7thq0p.js.map
@@ -0,0 +1,5 @@
1
+ import{n,Q,_}from"./studio-k3we3kqb.js";function cf(r){if(!r)return!1;if(Q(r.openProject))return!0;return r.openProjectPicker==="repo-list"&&Q(r.listRepos)&&Q(r.importProject)}function MI(r){globalThis.__jxPlatform=r}function Av(){return globalThis.__jxLauncher}var a=new Map;function PI(){let r=[];for(let[o,i]of a)for(let t=0;t<i;t++)r.push(o);return r}function s(r){a.set(r,(a.get(r)??0)+1)}function c(r){let o=(a.get(r)??1)-1;if(o>0)a.set(r,o);else a.delete(r)}function g(r){return(_(r)||Q(r))&&"then"in r&&Q(r.then)}function d(r,o,i){return(...t)=>{let e=o.apply(i,t);if(!g(e))return e;s(r);let u=()=>{c(r)};return e.then(u,u),e}}function P(r){let o=new Map;return new Proxy(r,{get(i,t){let e=i[t];if(!Q(e)||!n(t))return e;let u=o.get(t);if(u&&u.raw===e)return u.wrapper;let f=d(t,e,i);return o.set(t,{raw:e,wrapper:f}),f}})}var l=null;function p(){let r=globalThis.__jxPlatform;if(!r)throw Error("No platform registered. Call registerPlatform() before starting Studio.");if(l?.raw!==r)l={raw:r,wrapped:P(r)};return l.wrapped}function ye(){return globalThis.__jxPlatform!=null}
2
+ export{cf,MI,Av,PI,p,ye};
3
+
4
+ //# debugId=0FF027347A2E50BA64756E2164756E21
5
+ //# sourceMappingURL=studio-4fnb5648.js.map
@@ -0,0 +1,5 @@
1
+ import{p,ye}from"./studio-4fnb5648.js";import{X}from"./studio-9c6cbq2c.js";import{Q}from"./studio-k3we3kqb.js";function ph(){return ye()&&Q(p().findReferences)}function u(e){return`${e.path??""}\x00${e.tagName??""}`}var i=new Map,o=new Map;function qd(e){if(!ph())return{status:"unsupported"};return i.get(u(e))??(o.has(u(e))?{status:"pending"}:null)}async function La(e){if(!ph())return{status:"unsupported"};if(!e.path&&!e.tagName)return{status:"failed",message:"no target to look for"};let t=u(e),s=i.get(t);if(s)return s;let r=o.get(t);if(r)return r;let n={};if(e.path!==void 0)n.path=e.path;if(e.tagName!==void 0)n.tagName=e.tagName;let a=(async()=>{try{return{result:await p().findReferences(n),status:"ready"}}catch(c){return{message:X(c),status:"failed"}}})();o.set(t,a);let d=f,l=await a;if(o.get(t)===a)o.delete(t);if(d!==f)return l;return i.set(t,l),l}function nI(e){return i.delete(u(e)),La(e)}var f=0,g=new Set;function us(){f+=1,i.clear(),o.clear();for(let e of g)e()}function iI(e){return g.add(e),()=>{g.delete(e)}}function h(e){let t=0;for(let s of e.files)if(s.path.startsWith("pages/"))t+=1;return{others:e.files.length-t,pages:t}}function lv(e){let{others:t,pages:s}=h(e);if(s===0&&t===0)return"Not used yet";let r=t===1?"file":"files";if(s===0)return`Used in ${t} ${r}`;let n=`Used on ${s} page${s===1?"":"s"}`;return t===0?n:`${n} and ${t} other ${r}`}function oI(e,t){if(e.status==="unsupported")return null;if(e.status==="pending")return"Counting references…";if(e.status==="failed")return`References could not be counted (${e.message}) — this may break more than it appears to.`;let{files:s,refsTotal:r}=e.result;if(s.length===0)return t==="delete"?"Nothing else in this project refers to it.":"Nothing else in this project refers to it, so nothing needs updating.";let n=`${r} reference${r===1?"":"s"} in ${s.length} file${s.length===1?"":"s"}`,a=e.result.errors.length>0?" (at least — some documents could not be read)":"";if(t==="delete")return`${n}${a} will break. Those files stay on disk; the references in them stop resolving.`;if(t==="convert")return`${n}${a} will be updated automatically to point at the new file.`;return`${n}${a} will be updated automatically. Nothing else changes.`}function cv(e){return e.files.toSorted((t,s)=>s.count-t.count||t.path.localeCompare(s.path))}
2
+ export{ph,qd,La,nI,us,iI,lv,oI,cv};
3
+
4
+ //# debugId=CFBB8E3997E1C26E64756E2164756E21
5
+ //# sourceMappingURL=studio-4zd6an2b.js.map
@@ -0,0 +1,5 @@
1
+ import{p,ye}from"./studio-4fnb5648.js";import{jn,fv,Wt,ln,go,jx,VO,xn,Oe,Ia,Jx,St,Zx,Hi,qn,Se,pi,gI,To,Fe,Gn,Z,or,_h,Kp,Qe,Jp,fi,m,h,pn,Sr,Yp}from"./studio-yrcrncev.js";import{w}from"./studio-sce30r7b.js";import{st,bo,Zp,nd}from"./studio-swedpd82.js";import{od,Wi}from"./studio-aam8zt8z.js";import{MC,Ne,Uc,qc}from"./studio-n9qba0gx.js";import{pv,gh,Vp}from"./studio-hh394phe.js";import{ra,At}from"./studio-1ks5d9y4.js";import{mf,su,jv,sd,Is,Lo,Rs,Fa,bf,ac,Hv,e2,Er,oo,Ah,Bv}from"./studio-nzemfbkk.js";import{pl,Br,Ks,Js,zr}from"./studio-90zkgne5.js";import{ae}from"./studio-wqfaqw4m.js";import{to,hO,O$,xx,_x,Ts,Hp,hl,Sx,M$,u,U$}from"./studio-x0gsfr1d.js";import{fh,Gd,uv,mh}from"./studio-zfdbmhp3.js";import{rr,Vt,zi,Cr,C,Eh,nf,Th,wn}from"./studio-4f7thq0p.js";import{oe,na}from"./studio-v5wktj6f.js";import{Me,h0}from"./studio-0gvvqj3h.js";import{me,te,le}from"./studio-3qr08sxq.js";import{k0}from"./studio-abh9kfdh.js";import{n,Y,Q,_,v,Pe,Go,Jn,it,cd}from"./studio-k3we3kqb.js";import{ce}from"./studio-0939t1q1.js";var at="jx:canvas";function en(e){let{target:t,source:o,targetOrigin:r,acceptOrigin:i,token:a}=e,l=new Set,s=(c)=>{if(i!=="*"&&c.origin!==i)return;let d=c.data;if(!_(d)||!(at in d)||d[at]!==a)return;let f="payload"in d?d.payload:void 0;for(let g of l)g(f)};return o.addEventListener("message",s),{dispose(){l.clear(),o.removeEventListener("message",s)},onMessage(c){return l.add(c),()=>l.delete(c)},post(c){t.postMessage({[at]:a,payload:c},r)}}}var lt=null;function tn(){return lt}function Vb(e){if(lt){lt(e);return}window.open(e,"_blank","noopener,noreferrer")}function vr(){return bo(m.activePaneId)}function bt(e){let t=pn(e),o=t?.derived,r=o?.kind==="lens"?pn(o.sourcePaneId)?.activeTabId:t?.activeTabId;return r?m.tabs.get(r)??null:null}function jr(e){return pn(e)?.derived??null}function uC(e){if(!e)return[];let t=[];for(let o of m.panes)if(bt(o.id)?.id===e.id)t.push(bo(o.id));return t}function W(e){for(let t of Zp()){let o=t.panels.find((r)=>r.canvas===e);if(o)return{panel:o,surface:t}}return null}function nn(e){let t=e.canvas,o=t?W(t):null;return o?bt(o.surface.paneId):null}function ka(e){let t=e?.session.ui,o=t?.canvasMode??"design";return t?.preview&&(o==="edit"||o==="design")?"preview":o}function Vo(e){let t=jr(e);if(t?.kind==="lens"){let o=t.mode;return bt(e)?.session.ui?.preview&&(o==="edit"||o==="design")?"preview":o}return ka(bt(e))}function dl(e){let t=jr(e);if(t?.kind==="lens"&&t.preset==="breakpoint")return t.media;return bt(e)?.session.ui.activeMedia??null}function ct(e){return nd(e)?.paneId??fi}function ue(e){return bt(ct(e))}function Ee(e,t,o,r=null,i=null,a=[]){if(!e.state)e.state={};let l={};if(i!==null)l.defaultLocale=i.defaultLocale,l.locales=i.locales;e.state.$site={name:t.name??"Jx Site",url:t.url??"",...l,...t.state};let s=(n(e.$lang)?e.$lang:void 0)??VO(o.urlPattern,i)??t.defaults?.lang,c=a.map((f)=>({code:f.locale,current:f.urlPattern===o.urlPattern,dir:fv(f.locale),label:Wt(f.locale),url:f.urlPattern})),d={params:o._pathParams??{},title:e.title??e._pageTitle??t.name??"",url:o.urlPattern};if(c.length>0)d.alternates=c;if(s!==void 0)d.dir=fv(s),d.locale=s;if(e.state.$page=d,t.state){for(let[f,g]of Object.entries(t.state))if(f!=="$site"&&f!=="$page"&&!(f in e.state))e.state[f]=g}if(t.$media)e.$media={...t.$media,...e.$media};if(t.imports&&Object.keys(t.imports).length>0){if(!e.imports)e.imports={};for(let[f,g]of Object.entries(t.imports))if(!(f in e.imports))e.imports[f]=r&&(g.startsWith("./")||g.startsWith("../"))?r(g,o):g}if(t.$elements?.length)if(!e.$elements?.length)e.$elements=[...t.$elements];else{let f=new Set,g=[];for(let y of[...t.$elements,...e.$elements]){let b=n(y)?y:_(y)?y.$ref:void 0;if(b&&!f.has(b))f.add(b),g.push(y)}e.$elements=g}return e}var Ir=/\[\.\.\.(\w+)\]|\[(\w+)\]/g;function on(e){return e.split("\\").join("/").replace(/^\.\//,"").replace(/^\//,"").replace(/^pages\//,"")}function yr(e){let t=on(e),o=t.slice(t.lastIndexOf("/")+1),r=o.lastIndexOf(".");if(r>0)t=t.slice(0,t.length-(o.length-r));if(t.endsWith("/index"))t=t.slice(0,-6)||"/";else if(t==="index")t="/";if(!t.startsWith("/"))t=`/${t}`;let i=[],a=!1,l=!1,s=t.replaceAll(Ir,(c,d,f)=>{if(a=!0,d)return l=!0,i.push(d),"*";return i.push(f),`:${f}`});return{isCatchAll:l,isDynamic:a,params:i,urlPattern:s}}function nh(e){if(!e)return"/";return yr(e).urlPattern}function Bc(e){if(!e)return[];return yr(e).params}function ih(e,t){let o=on(e).split("/");if(!o.every((l)=>l!==""&&l[0]!=="_"))return!1;if(t===void 0)return!0;let r=o.at(-1)??"",i=r.lastIndexOf("."),a=i>0?r.slice(i).toLowerCase():"";return a!==""&&new Set(t).has(a)}function hC(e,t){if(e.isDynamic!==t.isDynamic)return e.isDynamic?1:-1;if(e.isCatchAll!==t.isCatchAll)return e.isCatchAll?1:-1;return e.urlPattern.localeCompare(t.urlPattern)}var Dr=new Set(["img","video","source","iframe","audio"]),rn="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",ut="data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20width='32'%20height='32'%3E%3Crect%20width='32'%20height='32'%20fill='%23d0d0d0'/%3E%3C/svg%3E";function NA(e,t){e.addEventListener("error",(o)=>{let{target:r}=o;if(r instanceof HTMLImageElement&&r.getAttribute("src")!==ut)r.setAttribute("src",ut),r.removeAttribute("srcset"),r.dataset.placeholder=""},{capture:!0,signal:t})}var kr=/(src|poster|image|bg|background|icon|logo|photo|avatar|thumbnail|cover|banner)$/i;function an(e){return kr.test(e)}var Jr=/(?<![\w$.])(?:item|index|\$map)\b/u;function B(e){if(n(e))return e.includes("${")&&Jr.test(e);return Jn(e)&&n(e.$ref)&&/^(?:#\/)?\$map\//u.test(e.$ref)}function Te(e,t){if(e==="href"||e==="action")return"";if(an(e))return ut;if(n(t))return dt(t);return Jn(t)&&n(t.$ref)?fn(t.$ref):""}var Lr=new Set(["p","h1","h2","h3","h4","h5","h6","blockquote","li","dt","dd","th","td","span","strong","em","small","mark","code","abbr","q","sub","sup","time","a","button","label","legend","caption","summary","pre","option"]),_r=new Set(["div","section","article","aside","header","footer","main","nav","figure","figcaption","details","fieldset","form","ul","ol","dl","table"]);var Fr=["width","height","inlineSize","blockSize"];function Vr(e){let{style:t}=e;if(!_(t))return!1;return Fr.some((o)=>{let r=t[o],i=Y(r)?String(r):n(r)?r.trim():"";return i!==""&&i!=="auto"})}function qr(e){if(!e.tagName||e.textContent||e.innerHTML)return null;if(e.$__layout)return null;if(Array.isArray(e.children)&&e.children.length>0)return null;if(Vr(e))return null;if(Lr.has(it(e.tagName)))return"empty-text-placeholder";if(_r.has(it(e.tagName)))return"empty-container-placeholder";return null}function dt(e){return e.replaceAll(/\$\{([^}]+)\}/g,"❪ $1 ❫")}function Wr(e,t){let o=e.map;return{children:_(o)?[F(o,Kr(e.items,t))]:[],className:"repeater-perimeter",tagName:"div"}}function sn(e){return JSON.stringify(e)}function cn(e){let t=e.startsWith("#/")?e.slice(2):e,[o,...r]=t.split("/"),i=o==="state"||o==="$map"?o:null;if(i===null)return null;let a=r.map((l)=>l.replaceAll("~1","/").replaceAll("~0","~"));return i+a.map((l)=>`?.[${sn(l)}]`).join("")}function pt(e,t){if(t===null)return`(${e})`;return`((r) => ((item, index, $map) => (${e}))(r, 0, { index: 0, item: r }))(${t})`}function Kr(e,t){if(Array.isArray(e))return`${sn(e)}[0]`;if(Pe(e)){let r=cn(e.$ref);return r===null?null:`${pt(r,t)}?.[0]`}let o=n(e)?un(e):[];if(n(e)&&o.length===1&&Ur(e,o[0]))return`${pt(o[0].expr,t)}?.[0]`;return null}function Ur(e,t){return t.start===0&&t.end===e.length-1}function un(e){let t=[],o=e.indexOf("${");while(o!==-1){let r=0,i=-1;for(let a=o+1;a<e.length;a+=1)if(e[a]==="{")r+=1;else if(e[a]==="}"){if(r-=1,r===0){i=a;break}}if(i===-1)break;t.push({end:i,expr:e.slice(o+2,i),start:o}),o=e.indexOf("${",i+1)}return t}function dn(e,t=null){let o=un(e);if(o.length===0)return e;let r="",i=0;for(let{start:a,end:l,expr:s}of o)r+=e.slice(i,a),r+=`\${(() => { try { return ${pt(s,t)}; } catch { return ""; } })()}`,i=l+1;return r+e.slice(i)}function Gr(e,t){let o=e.startsWith("#/")?e.slice(2):e;if(o!=="$map"&&!o.startsWith("$map/"))return{$ref:e};let r=cn(e);return t===null||r===null?void 0:dn(`\${${r}}`,t)}function fn(e){return`{${e.startsWith("#/state/")?e.slice(8):e}}`}function ft(e,t=null){return F(e,t)}function F(e,t){if(Array.isArray(e))return e.map((s)=>F(s,t));if(!Jn(e))return e;if(e.$prototype==="Array")return Wr(e,t);let o=e,r={},i=!1,a=n(o.tagName)&&Dr.has(o.tagName);if(a){let{attributes:s,src:c}=o,d=s?.src,f=o.poster,g=s?.poster;if(!(c&&c!==""||d&&d!=="")&&!(f&&f!==""||g&&g!==""))i=!0}for(let[s,c]of Object.entries(o))if(s==="state"||s==="$media"||s==="$elements")r[s]=c;else if(s==="$props"&&Eh(c)){let d={};for(let[f,g]of Object.entries(c))if(!B(g))d[f]=g;else if(n(g))d[f]=an(f)||f==="href"||f==="action"?Te(f,g):dn(g,t);else if(Pe(g)){let y=Gr(g.$ref,t);if(y!==void 0)d[f]=y}else d[f]=g;r[s]=d}else if(s==="children")if(Array.isArray(c))r.children=c.map((d)=>F(d,t));else if(Jn(c)&&c.$prototype==="Array")r.children=[F(c,t)];else r.children=F(c,t);else if(s==="cases"&&o.$switch&&Eh(c)){let[d]=Object.entries(c);if(d){let[,f]=d;r.children=Eh(f)&&!(Jn(f)&&f.$ref)?[F(f,t)]:[{style:{background:"color-mix(in srgb, var(--danger) 8%, transparent)",border:"1px dashed color-mix(in srgb, var(--danger) 40%, transparent)",borderRadius:"4px",color:"var(--danger)",fontFamily:"'JetBrains Mono', 'SF Mono', 'Fira Code', monospace",fontSize:"11px",fontStyle:"italic",padding:"6px 10px"},tagName:"div",textContent:`[$switch: ${Object.keys(c).join(" | ")}]`}]}}else if(s==="attributes"&&a&&Eh(c)){let d={};for(let[f,g]of Object.entries(c))if((f==="src"||f==="poster")&&(g===""||g==null||B(g)))i=!0,d[f]=rn;else d[f]=B(g)?Te(f,g):g;r.attributes=d}else if(s==="attributes"&&Eh(c)){let d={};for(let[f,g]of Object.entries(c))d[f]=B(g)?Te(f,g):g;r.attributes=d}else if(s==="style")if(Eh(c)){let d={};for(let[f,g]of Object.entries(c))if(!B(g))d[f]=g;r.style=d}else r.style=c;else if(s==="$switch"&&n(c)&&c.includes("${"))r[s]=dt(c);else if(s==="textContent"&&n(c)&&c.includes("${"))r[s]=dt(c);else if(s==="textContent"&&Jn(c)&&c.$ref)r[s]=fn(c.$ref);else if(a&&(s==="src"||s==="poster"))if(c===""||c==null||B(c))i=!0,r[s]=rn;else r[s]=c;else if(B(c))r[s]=Te(s,c);else if(n(c)||Jn(c)&&c.$ref)r[s]=c;else r[s]=F(c,t);let l=qr(r);if(l)r.className=r.className?`${r.className} ${l}`:l;if(i){let s=n(r.className)?r.className:"";if(!s.includes("empty-media-placeholder"))r.className=s?`${s} empty-media-placeholder`:"empty-media-placeholder"}return r}function pC(e){let t=e.document?.$paths,o=e.frontmatter?.$paths;return t??o??null}var Ae=new Map;function AA(){Ae.clear()}function OA(e,t){if(!t)return Promise.resolve({});let o=`${e??""}::${JSON.stringify(t)}`,r=Ae.get(o);if(!r)r=Zr(t).catch((i)=>(Ae.delete(o),console.warn("page-params: failed to enumerate $paths values:",i),{})),Ae.set(o,r);return r}async function Zr(e){if(Array.isArray(e)){let t={};for(let o of e)for(let[r,i]of Object.entries(o))Re(t,r,i);return t}if("contentType"in e&&n(e.contentType)&&e.contentType){let t=e.param??"slug",o=e.field??"id",r=await Xr(e.contentType),i={[t]:[]};if(!Array.isArray(r))return i;let a=r;for(let l of a)Re(i,t,o==="id"?l.id:l.data?.[o]??l.id);return i}if("values"in e&&Array.isArray(e.values)){let t=e.param??"value",o={[t]:[]};for(let r of e.values)Re(o,t,r);return o}if("$ref"in e&&n(e.$ref)&&e.$ref){let t=e.param??"id",o=e.field??"id",r=await p().readFile(e.$ref.replace(/^\.\//,"")),i=JSON.parse(r),a={[t]:[]};if(!Array.isArray(i))return a;for(let l of i)Re(a,t,v(l)?l[o]??l.id??l:l);return a}return{}}async function Yr(){let e=await od();for(let t of e){let o=t.classes?.find((r)=>r.name==="ContentCollection");if(o)return o.path}return"@jxsuite/parser/ContentCollection.class.json"}async function Xr(e){let t={$prototype:"ContentCollection",$src:await Yr(),contentType:e},o=p();if(o.resolveClass)return o.resolveClass(t);return fetch("/__jx_resolve__",{body:JSON.stringify(t),headers:{"content-type":"application/json"},method:"POST"}).then((r)=>{if(!r.ok)throw Error(`Class resolution failed: ${r.status}`);return r.json()})}function Re(e,t,o){if(o===null||o===void 0||o==="")return;let r=String(o);e[t]??=[];let i=e[t];if(!i.includes(r))i.push(r)}function mn(e,t,o){if(Object.keys(t).length===0)return e;let r=yn(e,t);return r.state??={},r.state.$page={params:{...t},title:n(r.title)?r.title:"",url:nh(o)},r}function gn(e){if(!e)return[];return Object.keys(e).filter((t)=>{let o=e[t];return v(o)&&n(o.$prototype)&&n(o.$src)&&JSON.stringify(o).includes('"#/$params/')})}async function hn(e,t,o){if(t.length===0)return;let r=p(),{resolveClass:i}=r;if(!i)return;let{state:a}=e;if(!a)return;await Promise.all(t.map(async(l)=>{let s=a[l];if(!v(s))return;let c={...s};if(o)c.$base=o;try{a[l]=await i.call(r,c)}catch(d){console.warn(`page-params: failed to resolve state.${l} for preview:`,d)}}))}function vn(e,t){let o=Qr(e,t);if(o!==null)return o;if(Array.isArray(e))return e.map((r)=>vn(r,t));return v(e)?yn(e,t):e}function yn(e,t){let o={};for(let[r,i]of Object.entries(e))o[r]=vn(i,t);return o}function Qr(e,t){if(!Pe(e)||!e.$ref.startsWith("#/$params/"))return null;return t[e.$ref.slice(10)]??null}function fC(e){let t=e?.tagName;return n(t)&&t.includes("-")}function ei(e){return _(e)&&!Array.isArray(e)}function bn(e){if(e===void 0)return null;if(ei(e)){if(e.$expression||e.$compute||e.$prototype||e.$handler)return null;return"default"in e||"type"in e?"signal":"literal"}return n(e)&&e.includes("${")?null:"literal"}function MA(e){let t=e?.state??{},o=[];for(let[r,i]of Object.entries(t)){if(cd(r))continue;let a=bn(i);if(!a)continue;let l=a==="signal"?i.default:i;o.push({name:r,value:l})}return o}function Cn(e,t){let o={...e.state},r=!1;for(let[i,a]of Object.entries(t)){let l=o[i],s=bn(l);if(!s)continue;o[i]=s==="signal"?{...l,default:a}:a,r=!0}if(!r)return e;return{...e,state:o}}var ti=new Set(["data","media","metadata","news","series","species"]),ni=new Set(["archive","catalog","catalogue","collection","directory","faq","gallery","inventory","library","menu","portfolio","showcase"]);function mC(e){return e.replaceAll(/[_-]+/g," ").replaceAll(/([a-z\d])([A-Z])/g,"$1 $2").trim().replaceAll(/\s+/g," ").toLowerCase()}function oh(e){let t=/[_-]|[a-z\d][A-Z]/.test(e)?mC(e):e,o=t.lastIndexOf(" "),r=t.slice(o+1);if(ni.has(r.toLowerCase()))return`${t} item`;return`${t.slice(0,o+1)}${oi(r)}`}function oi(e){if(ti.has(e.toLowerCase()))return e;if(/[^aeiou]ies$/.test(e))return`${e.slice(0,-3)}y`;if(/(?:ss|x|ch|sh|z)es$/.test(e))return e.slice(0,-2);if(/(?:us|is|ss)$/.test(e))return e;if(e.endsWith("s"))return e.slice(0,-1);return e}function Ub(e){return e.charAt(0).toUpperCase()+e.slice(1)}function qb(e){return(e.replaceAll("\\","/").split("/").pop()??e).replace(/\.[^.]+$/,"").replaceAll(/[-_]+/g," ").replaceAll(/\b\w/g,(o)=>o.toUpperCase())}var hi="pages";function mt(){return C?.projectConfig?.content??{}}function Pn(e){return e!==void 0&&/\.[\da-z]+$/i.test(e.replace(/\/+$/,""))}var ri={fileBacked:!1,item:"page",key:hi,kind:"pages",title:"Pages"};function Om(){let e=Object.entries(mt()).map(([t,o])=>({fileBacked:Pn(o.source),item:oh(t),key:t,kind:"collection",title:Ub(mC(t))}));return[ri,...e]}function UL(){return Om().map((e)=>e.key)}function ax(e){let t=mt()[e]?.source;return t!==void 0&&Pn(t)?t.replace(/^\.\//,""):null}function PA(e){return mt()[e]?.schema??null}function Ql(e){return Om().find((t)=>t.key===e)??null}function ec(e){if(!e)return null;let t=e.replaceAll("\\","/").replace(/^\.\//,"");if(ra.has(At(t)))return null;if(t.startsWith("pages/"))return ih(t)?hi:null;return Gn(t)?.name??null}function rh(e){if(!e)return!1;let t=Gn(e);if(!t||t.fileBacked)return!1;let o=At(e);return o!==".json"&&o!==".csv"}function FA(e,t){if(e===void 0||t)return{entries:!0,pages:!0,scan:!0};let o=e.map((r)=>r.replaceAll("\\","/").replace(/^\.\//,""));return{entries:o.some((r)=>{let i=ec(r);return i!==null&&i!==hi}),pages:o.some((r)=>r.startsWith("pages/")),scan:!1}}function ii(e,t,o){let r=e?.state??t?.state,i=`#/$params/${o}`;for(let a of Object.values(v(r)?r:{})){if(!v(a)||a.$prototype!=="ContentEntry")continue;let{contentType:l,id:s}=a;if(v(s)&&s.$ref===i&&n(l)&&l!=="")return l}return null}function gC(e,t){let o=pC({document:e,frontmatter:t}),r=null,i=null,a=null,l=null;if(o&&!Array.isArray(o)&&"contentType"in o){let d=o.contentType;r=n(d)&&d!==""?d:null;let f="param"in o?o.param:void 0;i=n(f)&&f!==""?f:null;let g="field"in o?o.field:void 0;a=n(g)&&g!==""&&g!=="id"?g:null}else if(o&&!Array.isArray(o)&&"values"in o){let d="param"in o?o.param:void 0,f=n(d)&&d!==""?d:null;r=f===null?null:ii(e,t,f),i=r===null?null:f;let g=o.values;l=r!==null&&Array.isArray(g)?g.flatMap((y)=>{let b=ht(y);return b===null?[]:[b]}):null}let s=e?.$layout??t?.$layout,c=n(s)||s===!1?s:void 0;return{contentType:r,field:a,layout:c,param:i,...l!==null&&{values:l}}}async function qL(e){let t={contentType:null,field:null,layout:void 0,param:null};try{let o=await p().readFile(e);if(e.endsWith(".json"))return gC(JSON.parse(o),null);let{parseSourceForPath:r}=await (ce("9bxvk59j"),import("./file-ops-9bxvk59j.js")),i=await r(e,o);return gC(i.document,i.frontmatter)}catch{return t}}var V=null,de=null,gt=0,$e=new Set;async function Sn(e,t){let o;try{o=await p().listDirectory(e)}catch{return}await Promise.all(o.map(async(r)=>{if(r.type==="directory")await Sn(r.path,t);else t.push(r.path)}))}async function ai(){let e=[];await Sn("pages",e);let t=e.filter((a)=>a.includes("[")&&ih(a)).toSorted(),o=await Promise.all(t.map(async(a)=>[a,await qL(a)])),{i18n:r}=ln(C?.projectConfig??{}),i=new Map;for(let[a,l]of o)if(l.contentType){let s={field:l.field,layout:l.layout,locale:jx(a,r),param:l.param,path:a,pattern:yr(a).urlPattern,...l.values&&{values:l.values}};i.set(l.contentType,[...i.get(l.contentType)??[],s])}return i}function vt(){if(V)return Promise.resolve(V);if(!ye()||!C)return Promise.resolve(new Map);if(!de){let e=gt;de=ai().then((t)=>{if(e===gt){V=t,de=null;for(let o of $e)o()}return t})}return de}function En(e,t){if(!e||e.length===0)return null;let o=jn(t),r=ln(C?.projectConfig??{}).i18n?.defaultLocale??null;return(o===null?void 0:e.find((i)=>i.locale===o))??(r===null?void 0:e.find((i)=>i.locale===r))??e.find((i)=>i.locale===null)??e[0]}function zc(e){if(!e)return null;return go(e,ln(C?.projectConfig??{}).i18n)}function sh(e,t){if(!V){vt();return}return En(V.get(e),t)}function jA(e){if(!V){vt();return}return V.get(e)??[]}async function Ie(e,t){let o=await vt();return En(o.get(e),t)}function Gb(){gt+=1,V=null,de=null}function Ap(e){return $e.add(e),()=>{$e.delete(e)}}function ht(e){if(n(e)&&e!=="")return e;return Y(e)&&Number.isFinite(e)?String(e):null}function bC(e,t,o){if(!e)return null;let r=t.split("/").pop()??t,i=r.lastIndexOf("."),a=i>0?r.slice(0,i):r,l=e.field===null?null:ht(o?.[e.field]),s=t.endsWith(".json")?ht(o?.id):null,c=l??s??a;if(e.values&&!e.values.includes(c))return null;if(e.param)return e.pattern.replace(`:${e.param}`,c);return e.pattern.replace(/:[A-Za-z_]\w*/,c)}function vC(e,t){if(e===!1)return null;if(n(e)&&e!=="")return e;if(t?.layout===!1)return null;if(n(t?.layout)&&t.layout!=="")return t.layout;return C?.projectConfig?.defaults?.layout??null}function HA(){Gb(),$e.clear()}function si(e,t){let o=t.split("/"),r={};for(let[i,a]of e.split("/").entries()){let l=o[i];if(a.startsWith(":")&&l!==void 0)r[a.slice(1)]=l}return r}async function li(e){let{documentPath:t,fields:o,isEntry:r,params:i}=e;if(!r)return{_pathParams:{...i},sourcePath:t,urlPattern:nh(t)};let a=Gn(t),l=a?await Ie(a.name,zc(t)):null,s=bC(l,t,o);if(!l||s===null)return{_pathParams:{},sourcePath:t,urlPattern:l?.pattern??"/"};return{_pathParams:si(l.pattern,s),sourcePath:l.path,urlPattern:s}}async function Tn(e,t){if(!t)return null;let o=await li(e),r=e.fields?.title,i=n(e.title)?e.title:n(r)?r:null,a={state:{}};if(i!==null)a.title=i;if(n(e.lang))a.$lang=e.lang;let l=Ee(a,t,o,null,ln(t).i18n),{$page:s,$site:c}=l.state??{};return s===void 0||c===void 0?null:{$page:s,$site:c}}var De=new Map;function yC(){De=new Map}function ci(e){if(!e.startsWith("#/state/"))return null;let[t]=e.slice(8).split("/");return t?t.replaceAll("~1","/").replaceAll("~0","~"):null}function yt(e){if(n(e))return e.includes("${");if(Array.isArray(e))return e.some((t)=>yt(t));return v(e)&&Object.values(e).some((t)=>yt(t))}function Mn(e,t){if(n(e.$src))return e.$src;return n(e.$prototype)&&Object.hasOwn(t,e.$prototype)?t[e.$prototype]??null:null}function xt(e,t={}){return v(e)&&n(e.$prototype)&&Mn(e,t)!==null&&!yt(e)}function Nn(e,t){return Object.entries(e.state??{}).filter(([,o])=>v(o)&&!n(o.$src)&&xt(o,t)).map(([o])=>o)}function Rn(e){let t=new Set,o=(i)=>{if(Array.isArray(i)){for(let a of i)o(a);return}if(!Jn(i))return;if(i.$prototype==="Array"&&Pe(i.items)){let a=ci(i.items.$ref);if(a)t.add(a)}o(i.map),o(i.children);for(let a of Object.values(i.cases??{}))o(a)};o(e.children);let r=e.state??{};return[...t].filter((i)=>xt(r[i]))}function ui(e,t){return console.warn(`canvas: could not resolve state.${e} before the render:`,t),null}async function On(e,t,o,r={}){let i=p(),{resolveClass:a}=i,l=e.state;if(t.length===0||!a||!l)return e;let s={...l};return await Promise.all(t.map(async(c)=>{let d=s[c];if(!xt(d,r))return;let f={...d,$src:Mn(d,r)};if(o)f.$base=o;let g=JSON.stringify(f),y=De.get(g);if(!y)y=a.call(i,f).then((T)=>T??null,(T)=>(De.delete(g),ui(c,T))),De.set(g,y);let b=await y;if(b!==null)s[c]=b})),{...e,state:s}}function An(e,t=[]){if(!_(e))return null;if(Array.isArray(e.children)){let o=e.children.findIndex((r)=>_(r)&&!r.$__layout);if(o!==-1)return{offset:o,prefix:[...t,"children"]};for(let r=0;r<e.children.length;r++){let i=e.children[r];if(_(i)&&i.$__layout){let a=An(i,[...t,"children",r]);if(a)return a}}}return null}function Ct(e,t,o=[]){if(!_(e))return;if(e.$__layout={file:t,path:o},Array.isArray(e.children))for(let[r,i]of e.children.entries()){if(n(i))continue;Ct(i,t,[...o,"children",r])}if(Array.isArray(e.$elements)){for(let[r,i]of e.$elements.entries())if(!n(i))Ct(i,t,[...o,"$elements",r])}}async function $n(e,t=new Set){let o=e.replace(/^\.\//,"");if(t.has(o))return null;t.add(o);let r=await Sx(e);if(!r)return null;Ct(r,o);let i=r.$layout;if(!n(i)||!i)return r;let a=await $n(i,t);if(!a)return r;let l=M$(a,r);return delete l.$layout,l}function di(e,t){for(let o of e??[]){if(!_(o)||!n(o.$ref)||!/^\.\.?\//.test(o.$ref))continue;let r=o.$__layout;if(!v(r)||!n(r.file))continue;let i=new URL(o.$ref,`jx-project:/${r.file}`).pathname.replace(/^\//,"");o.$ref=qc(t,i)}}function In(e,t){if(e.$layout!==void 0)return e.$layout;let o=t?.doc.content.frontmatter.$layout;return n(o)||o===!1?o:void 0}async function mi(e,t,o){let r=In(e,t),i=o?Gn(o):null,a=i?await Ie(i.name,zc(o)):null;return vC(r,a)}async function Dn(e,t,o=null){let r={documentPath:t?.documentPath,mode:t?.doc.mode},i=o??ka(t),a=i==="preview"?structuredClone(le(e)):ft(nf(e)),l=!1,s=r.documentPath&&C?.isSiteProject&&(r.documentPath.startsWith("pages/")||r.documentPath.startsWith("./pages/")),c=!s&&Boolean(C?.isSiteProject)&&rh(r.documentPath),d=null,f=0;if((s||c)&&t?.session.ui.showLayout!==!1){let S=c?await mi(e,t,r.documentPath):hl(In(e,t));if(S){let M=await $n(S);if(M){let D=i==="preview"?structuredClone(le(e)):a,P=M$(M,D);if(a=i==="preview"?P:ft(nf(P)),l=!0,r.documentPath)di(a.$elements,r.documentPath);let R=An(P);d=R?.prefix??null,f=R?.offset??0}}}let g=C?.projectConfig;if(s&&g){if(a={...a,state:{...a.state}},a.imports)a.imports={...a.imports};Ee(a,g,{urlPattern:nh(r.documentPath)})}let y=Gd(C?.projectRoot),b=r.documentPath?new URL(r.documentPath,y).href:void 0,T=uv(r.documentPath,mh());if(s&&t){let{previewParams:S}=t.session.ui;if(Object.keys(S).length>0){let M=gn(e.state??null);a=mn(a,S,r.documentPath),await hn(a,M,b)}}if((s||c)&&r.documentPath){let S=await Tn({documentPath:r.documentPath,fields:c?t?.doc.content.frontmatter??null:null,isEntry:c,lang:e.$lang,params:t?.session.ui.previewParams??{},title:e.title},C?.projectConfig);if(S)a={...a,state:{...a.state,...S}}}let k=await od(),I=O$(k),J=Nn(a,I);if(i!=="preview")J.push(...Rn(e));if(a=await On(a,[...new Set(J)],b,I),!s&&t&&fC(a)){let{previewProps:S}=t.session.ui;if(S&&Object.keys(S).length>0)a=Cn(a,S)}let ne=new Set;if(i!=="preview")(function S(M,D){if(!_(M))return;if(M.$prototype==="Array"){ne.add(D.join("/"));let P=M.map;if(_(P))S(P,[...D,"map"]);return}if(Array.isArray(M.children))for(let[P,R]of M.children.entries()){if(n(R))continue;S(R,[...D,"children",P])}else if(Go(M.children))S(M.children,[...D,"children"]);if(M.$switch&&M.cases)for(let[P,R]of Object.entries(M.cases))S(R,[...D,"cases",P])})(e,[]);let ot=r.documentPath!=null&&(r.documentPath.startsWith("layouts/")||r.documentPath.startsWith("./layouts/")),we=xx(a.$elements);if((r.mode==="content"||l||ot)&&Ne.length>0){let S=new Set(we.map((P)=>_(P)?P.$ref:P)),M=new Map(Ne.map((P)=>[P.tagName,P])),D=MC(a);if(a.tagName)D.add(it(a.tagName));for(let P of D)for(let R of M.get(P)?.uses??[])D.add(R);for(let P of D){let R=M.get(P);if(R&&R.source!=="npm"&&R.path){let rt=qc(r.documentPath??null,R.path);if(!S.has(rt))we.push({$ref:rt}),S.add(rt)}}}if(we.length>0)a.$elements=we;return a.imports=hO(a.imports,k),a.$media=to(a.$media),a.$head=_x(a.$head),{assets:T,docBase:b,mapperCtx:{arrayPaths:[...ne],canvasMode:i,layoutWrapped:l,pageContentOffset:f,pageContentPrefix:d},renderDoc:a,siteStyle:C?.projectConfig?.style??null}}var gi=128,GL="fullRender",BA="mountCanvas",zA="patchBatch",Ln="prepareRender",Uo={derivedResolves:0,derivedRetargets:0,escalations:0,fullRenders:0,hostRenderPosts:0,lastEscalationReason:"",lastFullRenderMs:0,p95FullRenderMs:0,panelRenders:0,patchedOps:0,renderPreparations:0,skippedFullRenders:0,timings:{}};globalThis.__jxCanvasPerf=Uo;var kn=new Map;function _n(){try{return typeof localStorage<"u"&&Boolean(localStorage.getItem("jx-canvas-debug"))}catch{return!1}}function Hn(){return typeof performance<"u"&&Q(performance.now)?performance.now():0}function Fn(e,t){if(_n())console.debug(`[jx-canvas] ${e}`,t??"")}function lx(e){Uo.escalations+=1,Uo.lastEscalationReason=e,Fn("escalation",e)}function vi(e){if(e.length===0)return 0;let t=e.toSorted((r,i)=>r-i),o=Math.min(t.length-1,Math.ceil(t.length*0.95)-1);return t[Math.max(0,o)]??0}function yi(e,t){let o=Number.isFinite(t)&&t>0?t:0,r=kn.get(e);if(!r)r=[],kn.set(e,r);if(r.push(o),r.length>gi)r.shift();let i=Uo.timings[e],a={count:(i?.count??0)+1,lastMs:o,maxMs:Math.max(i?.maxMs??0,o),p95Ms:vi(r),totalMs:(i?.totalMs??0)+o};if(Uo.timings[e]=a,e===GL)Uo.lastFullRenderMs=a.lastMs,Uo.p95FullRenderMs=a.p95Ms;Fn(`span:${e}`,`${o.toFixed(2)}ms`)}function Vn(e){let t=Hn(),o=_n(),r=`jx-${e}-start`;if(o)try{performance.mark(r)}catch{}let i=!1;return()=>{if(i)return Uo.timings[e]?.lastMs??0;i=!0;let a=Hn()-t;if(o)try{performance.measure(`jx-${e}`,r),performance.clearMarks(r)}catch{}return yi(e,a),a}}function wC(e,t){let o=Vn(e);try{return t()}finally{o()}}async function xC(e,t){let o=Vn(e);try{return await t()}finally{o()}}function ji(e){if(e==="--")return"Base";return e.replace(/^--/,"").replaceAll("-"," ").replaceAll(/\b\w/g,(t)=>t.toUpperCase())||e}var Wn=new Set(["script","style","link","iframe","object","embed"]);function ah(e){let t={tagName:e};if(/^h[1-6]$/.test(e))t.textContent="Heading";else if(e==="p")t.textContent="Paragraph text";else if(e==="span"||e==="strong"||e==="em"||e==="small"||e==="mark"||e==="code"||e==="abbr"||e==="q"||e==="sub"||e==="sup"||e==="time")t.textContent="Text";else if(e==="a")t.textContent="Link",t.attributes={href:"#"};else if(e==="button")t.textContent="Button";else if(e==="label")t.textContent="Label";else if(e==="legend")t.textContent="Legend";else if(e==="caption")t.textContent="Caption";else if(e==="summary")t.textContent="Summary";else if(e==="li"||e==="dt"||e==="dd"||e==="th"||e==="td"||e==="option")t.textContent="Item";else if(e==="blockquote")t.textContent="Quote";else if(e==="pre")t.textContent="Preformatted text";else if(e==="input")t.attributes={placeholder:"Enter text...",type:"text"};else if(e==="img")t.attributes={alt:"Image"};else if(e==="iframe")t.attributes={src:""};else if(e==="slot")t.children=[{tagName:"p",textContent:"Slot content"}];else if(e==="select")t.children=[{tagName:"option",textContent:"Option 1"}];else if(e==="ul"||e==="ol")t.children=[{tagName:"li",textContent:"Item"}];else if(e==="dl")t.children=[{tagName:"dt",textContent:"Term"},{tagName:"dd",textContent:"Definition"}];else if(e==="table")t.children=[{children:[{children:[{tagName:"th",textContent:"Header"}],tagName:"tr"}],tagName:"thead"},{children:[{children:[{tagName:"td",textContent:"Cell"}],tagName:"tr"}],tagName:"tbody"}];else if(e==="details")t.children=[{tagName:"summary",textContent:"Summary"},{tagName:"p",textContent:"Detail content"}];return t}function Pt(e){return _(e)&&n(e.$ref)?e.$ref:null}function ke(e){if(e.source!=="npm"||!e.package)return null;return e.modulePath?`${e.package}/${e.modulePath}`:e.package}function xi(e,t){let o=ke(e);if(o)return o;return e.path?{$ref:qc(t,e.path)}:null}function KL(e,t,o){let r=ke(t);if(r)return e.some((a)=>n(a)&&(a===r||a===t.package));if(!t.path)return!1;let i=re(qc(o,t.path));return e.some((a)=>{let l=Pt(a);return l!==null&&re(l)===i})}function re(e){return e.replace(/^(?:\.\/)+/,"")}function Kb(e,t,o){let r=xi(t,o);if(!r)return[...e];let a=ke(t)&&t.modulePath?e.filter((l)=>l!==t.package):[...e];return KL(a,t,o)?a:[...a,r]}function JL(e,t,o){let r=ke(t);if(r)return e.filter((a)=>!(n(a)&&(a===r||a===t.package)));if(!t.path)return[...e];let i=re(qc(o,t.path));return e.filter((a)=>{let l=Pt(a);return l===null||re(l)!==i})}function WA(e,t){return e.filter((o)=>!n(o)||!(o===t||o.startsWith(`${t}/`)))}function VA(e,t){let o=re(t);return e.filter((r)=>{let i=Pt(r);return i===null||re(i)!==o})}var bi="Components";function Op(e,t){let o=Ci(e,t);if(o)Qe(e,[],"$elements",o)}function Ci(e,t){if(!n(t)||!t.includes("-"))return null;let o=Ne.find((a)=>a.tagName===t);if(!o)return null;let r=e.doc.document.$elements??[],i=Kb(r,o,e.documentPath??null);return i.length===r.length?null:i}function _C(e){let t=Ne.find((o)=>o.tagName===e);return t?Uc(t):null}function UA(){return Ne.map((e)=>({component:!0,description:(e.source==="npm"?e.package:e.path)??"",group:bi,label:`<${e.tagName}>`,tag:e.tagName}))}function z(e){if(!e)return[];if(Array.isArray(e.children))return e.children;return n(e.textContent)&&e.textContent.length>0?[e.textContent]:[]}function pe(e){let t=0;for(let o of e)t+=n(o)?o.length:pe(z(o));return t}function wt(e,t,o){let r=[],i=0;for(let a of e){if(i>=o)break;if(n(a)){let d=i+a.length;if(d>t){let f=a.slice(Math.max(0,t-i),Math.max(0,Math.min(o,d)-i));if(f)r.push(f)}i=d;continue}let l=z(a),s=pe(l),c=i+s;if(s===0){if(i>=t&&i<o)r.push({...a})}else if(c>t){let d=wt(l,Math.max(0,t-i),Math.min(o,c)-i);if(d.length>0)r.push(Pi(a,d))}i=c}return r}function Pi(e,t){let{children:o,textContent:r,...i}=e;if(t.length===0)return{...i,textContent:""};if(t.length===1&&n(t[0]))return{...i,textContent:t[0]};return{...i,children:t}}function Bn(e){let t=[];for(let o of e){if(n(o)){if(o.length===0)continue;let r=t.at(-1);if(n(r)){t[t.length-1]=r+o;continue}}t.push(o)}return t}function zn(e,t,o,r,i=""){return Bn([...wt(e,0,t),...i?[i]:[],...wt(o,r,pe(o))])}function Et(e){let t=Bn(e);if(t.length===0)return{textContent:""};if(t.length===1&&n(t[0]))return{textContent:t[0]};return{children:t}}function Kn(e){if(!e)return!0;if(e.textContent!=null&&e.textContent.trim()==="")return!0;let t=e.children;if(!t)return!1;if(t.length===0)return!0;let[o]=t;if(t.length===1&&n(o)&&o.trim()==="")return!0;return t.length===1&&_(o)&&o.tagName==="br"}function Tt(e){return{index:zi(e),parentPath:Vt(e)}}function Un(e,t,o,r,i={}){if(!e)return;let a=oe(e.doc.document,t);if(o){if(a&&JSON.stringify(a.children)===JSON.stringify(o))return;Z(e,(l)=>{if(a?.textContent!=null)Qe(l,t,"textContent");Qe(l,t,"children",o)},{coalesceKey:i.coalesceKey??null})}else if(r!=null){if(a&&a.textContent===r&&!a.children)return;Z(e,(l)=>{if(a?.children)Qe(l,t,"children");Qe(l,t,"textContent",r)},{coalesceKey:i.coalesceKey??null})}}function Zn(e,t,o,r){if(!e)return!1;let i=oe(e.doc.document,t);if(!i)return!1;if(`${i.$props?.[o]??""}`===r)return!1;return Z(e,(l)=>{Jp(l,t,o,r)}),!0}function Yn(e,t,o){if(!e)return null;let r=oe(e.doc.document,t),i=oe(e.doc.document,o);if(!r||!i)return null;if(na(t,o)||na(o,t))return null;let a=z(i),l=z(r),s=pe(a),c=Et([...a,...l]);return Z(e,(d)=>{if(c.children){if(i.textContent!=null)Qe(d,o,"textContent");Qe(d,o,"children",c.children)}else{if(i.children)Qe(d,o,"children");Qe(d,o,"textContent",c.textContent??"")}if(_h(d,t),Xn(d,Vt(t)),Yp(e))d.session.selection=[o]}),{offset:s,path:o}}function Xn(e,t){let o=t;while(o.length>0){let r=oe(e.doc.document,o),i=r?.children;if(!r||!Array.isArray(i)||i.length>0)return;let a=Vt(o);if(_h(e,o),!a)return;o=a}}function Qn(e,t,o,r){let{parentPath:i,index:a}=Tt(t),l=[...i,"children",a+1];if(!e)return l;let s={tagName:"p"};if(r.textContent!=null)s.textContent=r.textContent;else if(r.children)s.children=r.children;else s.textContent="";return Z(e,(c)=>{if(o.textContent!=null)Qe(c,t,"children"),Qe(c,t,"textContent",o.textContent);else if(o.children)Qe(c,t,"textContent"),Qe(c,t,"children",o.children);if(or(c,i,a+1,s),Yp(e))c.session.selection=[l]}),l}function Si(e,t,o,r){let{parentPath:i,index:a}=Tt(t),l=Kn(r),s=l?a:a+1,c=[...i,"children",s];if(!e)return c;return Z(e,(d)=>{if(l)_h(d,t);else if(r?.children)Qe(d,t,"textContent"),Qe(d,t,"children",r.children);else if(r?.textContent!=null)Qe(d,t,"children"),Qe(d,t,"textContent",r.textContent);if(or(d,i,s,o),Op(d,o.tagName),Yp(e))d.session.selection=[c]}),c}function eo(e,t,o,r){let i=o.component===!0?_C(o.tag):null;if(i)return Si(e,t,i,r);if(Kn(r)){if(!e)return t;return Z(e,(d)=>{Qe(d,t,"tagName",o.tag),Qe(d,t,"children");let f=ah(o.tag);if(f.textContent&&f.textContent!=="Paragraph text")Qe(d,t,"textContent",f.textContent);else Qe(d,t,"textContent");if(Yp(e))d.session.selection=[t]}),t}let{parentPath:a,index:l}=Tt(t),s=[...a,"children",l+1];if(!e)return s;let c=ah(o.tag);return Z(e,(d)=>{if(r?.children)Qe(d,t,"textContent"),Qe(d,t,"children",r.children);else if(r?.textContent!=null)Qe(d,t,"children"),Qe(d,t,"textContent",r.textContent);if(or(d,a,l+1,structuredClone(c)),Yp(e))d.session.selection=[s]}),s}function no(e,t,o,r,i){if(!e)return null;let a=oe(e.doc.document,t.path),l=oe(e.doc.document,o.path);if(!a||!l)return null;if(na(t.path,o.path)||na(o.path,t.path))return null;let s=Et(zn(z(a),t.offset,z(l),o.offset,i)),c=[...r,o.path].toSorted(wi);return Z(e,(d)=>{if(s.children){if(a.textContent!=null)Qe(d,t.path,"textContent");Qe(d,t.path,"children",s.children)}else{if(a.children)Qe(d,t.path,"children");Qe(d,t.path,"textContent",s.textContent??"")}for(let f of c)if(oe(d.doc.document,f))_h(d,f),Xn(d,Vt(f));if(Yp(e))d.session.selection=[t.path]}),{offset:t.offset+i.length,path:t.path}}function wi(e,t){let o=Math.min(e.length,t.length);for(let r=0;r<o;r++){let i=e[r],a=t[r];if(i===a)continue;if(Y(i)&&Y(a))return a-i;return String(a).localeCompare(String(i))}return t.length-e.length}function O(e,t=1){return{height:e.height*t,left:e.x*t,top:e.y*t,width:e.width*t}}function qA(e,t,o=1){return{x:(e.x-t.left)/o,y:(e.y-t.top)/o}}function Je(e,t){if(!t){e.style.display="none";return}e.style.display="block",e.style.left=`${t.left}px`,e.style.top=`${t.top}px`,e.style.width=`${t.width}px`,e.style.height=`${t.height}px`}function ro(e=document){let t=e.createElement("div");t.className="jx-canvas-iframe-overlay",t.style.cssText="position:absolute;inset:0;pointer-events:none;overflow:hidden;z-index:2";let o=e.createElement("div");o.className="overlay-box overlay-selection",o.style.display="none";let r=e.createElement("div");r.className="overlay-label",r.style.display="none",o.append(r);let i=e.createElement("div");i.className="overlay-box overlay-hover",i.style.display="none";let a=e.createElement("div");a.className="canvas-drop-indicator",a.style.display="none";let l=e.createElement("button");l.className="insertion-helper",l.textContent="+",l.style.pointerEvents="auto",l.style.display="none";let s=e.createElement("div");s.className="canvas-replace-target",s.style.display="none";let c=e.createElement("div");c.className="overlay-presence-group";let d=e.createElement("div");return d.className="overlay-coselection-group",t.append(i,o,d,a,s,l,c),{dispose:()=>t.remove(),insertButton:l,root:t,setDropIndicator:(f,g="inside")=>Ti(a,f,g),setHover:(f)=>Je(i,f),setInsertZone:(f,g="center")=>Ei(l,f,g),setReplaceTarget:(f)=>Je(s,f),setSuppressed:(f)=>{t.style.display=f?"none":""},setCoSelection:(f)=>{d.replaceChildren();for(let g of f){let y=e.createElement("div");y.className="overlay-box overlay-selection overlay-coselection",Je(y,g),d.append(y)}},setPresence:(f)=>{c.replaceChildren();for(let g of f){let y=e.createElement("div");y.className="overlay-box overlay-presence",y.style.cssText=`position:absolute;display:block;pointer-events:none;outline:1.5px solid ${g.color};outline-offset:1px;left:${g.placement.left}px;top:${g.placement.top}px;width:${g.placement.width}px;height:${g.placement.height}px`;let b=e.createElement("div");b.className="overlay-presence-tag",b.textContent=g.label,b.style.cssText=`position:absolute;top:-18px;left:-2px;padding:1px 5px;border-radius:3px;font:10px/1.4 sans-serif;color:#fff;white-space:nowrap;background:${g.color}`,y.append(b),c.append(y)}},setSelection:(f,g=null)=>{if(Je(o,f),f&&g)r.textContent=g,r.style.display="block";else r.style.display="none"}}}function Ei(e,t,o){if(!t){e.style.display="none",e.classList.remove("visible");return}e.dataset.edge=o,e.classList.add("visible"),e.style.display="grid",e.style.left=`${t.left+t.width/2}px`,e.style.top=`${t.top+t.height/2}px`,e.style.translate="-50% -50%"}function Ti(e,t,o){if(!t){e.style.display="none";return}if(e.style.display="block",e.style.left=`${t.left}px`,e.style.width=`${t.width}px`,o==="inside"){e.className="canvas-drop-indicator inside",e.style.top=`${t.top}px`,e.style.height=`${t.height}px`;return}e.className="canvas-drop-indicator line",e.style.height="",e.style.top=`${o==="top"?t.top:t.top+t.height}px`}function Wc(e){return JSON.stringify(e)}var SC={$id:"elements-meta",title:"HTML Element Metadata",description:"Inline scoping and inline toolbar action metadata for HTML elements.",$convertGroups:{text:["p","h1","h2","h3","h4","h5","h6","blockquote"],container:["div","section","article","aside","main","header","footer","nav","search"],list:["ul","ol"]},$defs:{p:{$convertTo:"text",$convertToWhenEmpty:["text","container"],$inlineChildren:["em","strong","del","code","a","span","br","img","b","i","u","sub","sup","s"],$inlineActions:[{tag:"strong",label:"Bold",command:"bold"},{tag:"em",label:"Italic",command:"italic"},{tag:"u",label:"Underline",command:"underline"},{tag:"del",label:"Strikethrough",command:"strikethrough"},{tag:"sup",label:"Superscript",command:"superscript"},{tag:"sub",label:"Subscript",command:"subscript"},{tag:"code",label:"Code",command:"code"},{tag:"a",label:"Link",command:"link"}]},h1:{$convertTo:"text",$inlineChildren:["em","strong","code","a","span","br","b","i","u","sub","sup"],$inlineActions:[{tag:"strong",label:"Bold",command:"bold"},{tag:"em",label:"Italic",command:"italic"},{tag:"code",label:"Code",command:"code"},{tag:"a",label:"Link",command:"link"}]},h2:{$convertTo:"text",$inlineChildren:["em","strong","code","a","span","br","b","i","u","sub","sup"],$inlineActions:"h1"},h3:{$convertTo:"text",$inlineChildren:["em","strong","code","a","span","br","b","i","u","sub","sup"],$inlineActions:"h1"},h4:{$convertTo:"text",$inlineChildren:["em","strong","code","a","span","br","b","i","u","sub","sup"],$inlineActions:"h1"},h5:{$convertTo:"text",$inlineChildren:["em","strong","code","a","span","br","b","i","u","sub","sup"],$inlineActions:"h1"},h6:{$convertTo:"text",$inlineChildren:["em","strong","code","a","span","br","b","i","u","sub","sup"],$inlineActions:"h1"},li:{$inlineChildren:["em","strong","del","code","a","span","br","img","b","i","u","sub","sup","s"],$inlineActions:"p"},td:{$inlineChildren:["em","strong","del","code","a","span","br","b","i","u","sub","sup","s"],$inlineActions:"p"},th:{$inlineChildren:["em","strong","del","code","a","span","br","b","i","u","sub","sup","s"],$inlineActions:"p"},blockquote:{$convertTo:"text",$inlineChildren:["em","strong","del","code","a","span","br","img","b","i","u","sub","sup","s"],$inlineActions:"p"},figcaption:{$inlineChildren:["em","strong","del","code","a","span","br","img","b","i","u","sub","sup","s"],$inlineActions:"p"},caption:{$inlineChildren:["em","strong","del","code","a","span","br","img","b","i","u","sub","sup","s"],$inlineActions:"p"},summary:{$inlineChildren:["em","strong","del","code","a","span","br","img","b","i","u","sub","sup","s"],$inlineActions:"p"},dt:{$inlineChildren:["em","strong","del","code","a","span","br","img","b","i","u","sub","sup","s"],$inlineActions:"p"},dd:{$inlineChildren:["em","strong","del","code","a","span","br","img","b","i","u","sub","sup","s"],$inlineActions:"p"},label:{$inlineChildren:["em","strong","del","code","a","span","br","img","b","i","u","sub","sup","s"],$inlineActions:"p"},a:{$inlineChildren:["em","strong","code","span","br","b","i","u","sub","sup"],$inlineActions:[{tag:"strong",label:"Bold",command:"bold"},{tag:"em",label:"Italic",command:"italic"},{tag:"code",label:"Code",command:"code"}]},span:{$inlineChildren:["em","strong","del","code","a","br","b","i","u","sub","sup","s"],$inlineActions:"p"},div:{$convertTo:"container",$convertToWhenEmpty:["container","text"],$inlineChildren:[]},section:{$convertTo:"container",$inlineChildren:[]},article:{$convertTo:"container",$inlineChildren:[]},nav:{$convertTo:"container",$inlineChildren:[]},main:{$convertTo:"container",$inlineChildren:[]},header:{$convertTo:"container",$inlineChildren:[]},footer:{$convertTo:"container",$inlineChildren:[]},aside:{$convertTo:"container",$inlineChildren:[]},ul:{$convertTo:"list",$inlineChildren:[]},ol:{$convertTo:"list",$inlineChildren:[]},pre:{$inlineChildren:["code"]},table:{$inlineChildren:[]},thead:{$inlineChildren:[]},tbody:{$inlineChildren:[]},tr:{$inlineChildren:[]}}};var Mm=SC.$defs,Ri=new Set(["pre"]),fc=new Set(Object.entries(Mm).filter(([e,t])=>!Ri.has(e)&&(t.$inlineChildren?.length??0)>0).map(([e])=>e));var io=new Set(["em","strong","del","code","a","span","br","img","b","i","u","sub","sup","s"]);function Mt(e,t){if(!t)return io.has(e);let o=Mm[t];if(!o||!o.$inlineChildren)return!1;return o.$inlineChildren.includes(e)}function GA(e){let t=Mm[e];if(!t)return null;let o=t.$inlineActions;if(n(o))o=Mm[o]?.$inlineActions??void 0;if(!Array.isArray(o))return null;return o}var Oi=null;function cx(e,t){if(!_(e))return!1;let o=(it(e.tagName)||"div").toLowerCase();if(t){let r=(it(t.tagName)||"div").toLowerCase();return Mt(o,r)}return io.has(o)}function KA(){return Oi!==null}function He(e){return!e||e==="base"?null:e}function dx(e){let t=e.panels;if(t.length===0)return null;if(t.length===1)return t[0];let o=dl(e.paneId);for(let r of t){if(o===null&&r.mediaName==="base")return r;if(r.mediaName===o)return r}return t[0]}function ao(){return dx(vr())}function JA(e,t){if(!e)return t;let o=t;for(let r=Vt(o);r;r=Vt(o)){let i=oe(e,o),a=oe(e,r);if(!i||!a)break;let l=(it(i.tagName)||"div").toLowerCase(),s=(it(a.tagName)||"div").toLowerCase();if(!Mt(l,s))break;o=r}return o}function ux(e){return mf(e)!==null}function Mp(e){return mf(e)}function Hr(e){if(!e)return{baseWidth:320,featureQueries:[],sizeBreakpoints:[]};let t=[],o=[],r=320;for(let[i,a]of Object.entries(e)){if(i==="--"){let c=String(a).match(/^(\d+)\s*px$/);r=c?Number(c[1]):320;continue}let l=a.match(/min-width:\s*([\d.]+)px/),s=a.match(/max-width:\s*([\d.]+)px/);if(l)o.push({name:i,query:a,type:"min",width:Number(l[1])});else if(s)o.push({name:i,query:a,type:"max",width:Number(s[1])});else t.push({name:i,query:a})}return o.sort((i,a)=>i.type==="min"?i.width-a.width:a.width-i.width),{baseWidth:r,featureQueries:t,sizeBreakpoints:o}}function Ai(e,t){let o=new Set;for(let r of e)if(r.type==="min"&&t>=r.width)o.add(r.name);else if(r.type==="max"&&t<=r.width)o.add(r.name);return o}function so(e,t){let o=Ai(e,t),r=null;for(let i of e){if(!o.has(i.name))continue;let a=Math.abs(i.width-t);if(r===null){r=i;continue}let l=Math.abs(r.width-t);if(a<l||a===l&&i.width<r.width)r=i}return r?.name??null}function YA(e,t,o=8){let r=null;for(let i of t){let a=Math.abs(i-e);if(a>o)continue;if(r===null||a<Math.abs(r-e))r=i}return r??e}var Pm=240,ZA=8,XA=16,Le=new Map;function Nt(e){return Hr(to(e.doc.document.$media))}function CC(e){let{baseWidth:t,sizeBreakpoints:o}=Nt(e),r=e.session.ui.activeMedia;return o.find((i)=>i.name===r)?.width??t}function $i(e,t){let o=Le.get(e);if(!o)return null;if(!t||o.tabId!==t.id||o.media!==t.session.ui.activeMedia)return Le.delete(e),null;return o.width}function QA(e,t){let o=t?CC(t):0;return $i(e.paneId,t)??o}function kC(e){Le.delete(e)}function eO(e){let{baseWidth:t,sizeBreakpoints:o}=Nt(e);return[t,...o.map((r)=>r.width)]}function EC(e,t,o){let{sizeBreakpoints:r}=Nt(t),i=so(r,o);return t.session.ui.activeMedia=i,Le.set(e,{media:i,tabId:t.id,width:o}),i}var Rt={invokerTags:Bv,popoverTags:Ah};function YL(e,t){if(!e||!t)return null;for(let o=t.length;o>=0;o-=1){let r=t.slice(0,o),i=oe(e,r);if(_(i)&&Fa(i,Rt))return r}return null}function lo(e,t){let o=e.doc.document;if(!o)return null;if(t){let r=oe(o,t);return _(r)&&Fa(r,Rt)?t:null}return YL(o,Oe(e.session.selection))}function co(){let e=h.value?.doc.document;return e?e2(e,Rt):!1}var po=["toggle-popover","show-popover","hide-popover","show-modal","close","request-close"],Ot=new Set(["show-modal","close","request-close"]),$t=new Set(["toggle-popover","show-popover","hide-popover"]),Ii=["any","closerequest","none"],Di=new Set(po),ki=new Set(Ii),Ji=new Set(["button"]);function H(e){return Lo(e)==="dialog"}function uo(e){return e.startsWith("--")}function Li(e){let t=[];for(let{node:o}of ac(e)){let r=bf(o);if(H(o)&&r!==null&&!t.includes(r))t.push(r)}return t}function fo(e){for(let{node:t}of ac(e))if(H(t))return!0;return!1}function _i(e){let t=e.oncommand;return t!==void 0&&t!==null}function Fi(e,t){for(let{node:o}of ac(e)){if(o===e)continue;let r=Lo(o);if(r==="button"){let i=Is(o,"command"),a=Is(o,"commandfor");if(i!==null&&(i==="close"||i==="request-close")&&(a===null||a===t))return!0}if(r==="form"&&Is(o,"method")?.toLowerCase()==="dialog")return!0}return!1}function DA(e,t){let o=[...ac(e,[],null,t)],r=Li(e),i=Hv(e,t),a=r.length>0||i.length>0,l=new Map,s=new Map;for(let{node:d}of o){let f=bf(d);if(f!==null&&!l.has(f))l.set(f,d);if(Lo(d)==="button"){let g=Is(d,"commandfor"),y=Is(d,"command");if(g!==null){let b=s.get(g)??new Set;b.add(y??""),s.set(g,b)}}}let c=[];for(let{node:d,path:f}of o)if(c.push(...Vi(d,f,l,r,i,a,t)),H(d))c.push(...qi(d,f,s));return c}function Vi(e,t,o,r,i,a,l){let s=[],c=Lo(e),d=l?.invokerTags?.has(c)??!1,f=Is(e,"command"),g=Is(e,"commandfor");if(!(f!==null||g!==null||("command"in sd(e))||("commandfor"in sd(e))))return s;let b=Rs(e,"the element");if(!Ji.has(c)&&!d)return s.push({detail:"`command` and `commandfor` are attributes of `HTMLButtonElement` and of no other "+"interface — not even `<input>`, which `popovertarget` does allow. Elsewhere they parse "+`and do nothing. Make it a <button>, or remove both attributes. ${oo}`,fix:"invoker",message:`<${c||"element"}> carries command/commandfor, which only <button> supports.`,path:t,rule:"invoker-not-button",severity:"error"}),s;if(f!==null&&!Di.has(f)&&!uo(f))return s.push({detail:`\`command\` is an enumerated attribute taking ${po.map((T)=>`\`${T}\``).join(", ")}, or a custom command starting with \`--\`. Anything else is the invalid-value state, and a button in that state does nothing when clicked. ${oo}`,message:`${b} declares command="${f}", which is not a built-in or --custom command.`,path:t,rule:"command-invalid",severity:"error"}),s;if(g!==null){let T=o.get(g),k=r.includes(g),I=i.includes(g);if(!T&&a){let J=[...r,...i].map((ne)=>`"${ne}"`).join(", ");return s.push({detail:`No element in this document has the id "${g}". The dialogs and popovers here are: ${J}. A commandfor that names nothing does nothing, silently. ${oo}`,message:`commandfor="${g}" names nothing in this document.`,path:t,rule:"command-target-missing",severity:"error"}),s}if(f!==null&&T){if(Ot.has(f)&&!H(T))s.push({detail:`\`${f}\` acts on a <dialog>, and "${g}" is ${I?"a popover":`a <${Lo(T)||"element"}>`}. The click is ignored. ${I?"Use `toggle-popover`, `show-popover` or `hide-popover` for a popover.":"Point it at a dialog, or make the target one."} ${oo}`,message:`${b} sends ${f} to "${g}", which is not a dialog.`,path:t,rule:"command-target-mismatch",severity:"error"});else if($t.has(f)&&!Fa(T,l))s.push({detail:`\`${f}\` acts on a popover, and "${g}" is ${k?"a dialog":`a <${Lo(T)||"element"}>`} that declares no \`popover\`. The click is ignored. ${k?"Use `show-modal`, `close` or `request-close` for a dialog.":"Give the target a `popover` attribute, or point the button elsewhere."} ${oo}`,message:`${b} sends ${f} to "${g}", which is not a popover.`,path:t,rule:"command-target-mismatch",severity:"error"});else if(uo(f)&&!_i(T))s.push({detail:`A custom command is a \`CommandEvent\` dispatched at its target, and "${g}" has no `+"`oncommand` handler to answer it — so the click does nothing. Add one that switches on "+`\`event#/command\`, or use a built-in command. ${oo}`,message:`${b} sends ${f} to "${g}", which handles no command.`,path:t,rule:"custom-command-unhandled",severity:"warn"})}}return s}function qi(e,t,o){let r=[],i=Rs(e,"the dialog"),a=bf(e),{style:l}=e,s=Is(e,"closedby");if(s!==null&&!ki.has(s))r.push({detail:`\`closedby\` is an enumerated attribute taking \`any\` (light dismiss and Escape), \`closerequest\` (Escape only, the default for a modal) or \`none\`. Anything else is the invalid-value default, \`auto\`, which is the same as leaving it out. ${oo}`,message:`${i} declares closedby="${s}", which is not any, closerequest or none.`,path:t,rule:"dialog-closedby-invalid",severity:"error"});if(Er(l,"display")!==null)r.push({detail:`A closed dialog is hidden by the browser's own \`dialog:not([open]) { display: none }\`. That rule is UA-origin, so any author \`display\` beats it, and the dialog is laid out on every page whether or not anyone opened it. \`display\` belongs in the \`&[open]\` rule and nowhere else. ${oo}`,fix:"display",message:`${i} sets display in its base rule.`,path:t,rule:"dialog-display",severity:"error"});let c=a===null?void 0:o.get(a),d=Is(e,"open")!==null||sd(e).open===!0||e.open===!0;if(a!==null&&!c?.has("show-modal")&&!d)r.push({detail:`No <button> in this document opens it with \`command="show-modal"\`. If it is opened from another file or from a function that calls \`showModal()\`, this is fine; otherwise there is no way for a reader to open it. ${oo}`,message:`${i} has no invoker in this document.`,path:t,rule:"dialog-no-invoker",severity:"warn"});if(c?.has("show-modal")&&s==="none"&&!Fi(e,a))r.push({detail:`A modal dialog makes everything outside it inert, so the only ways out are the ones it offers: \`closedby="none"\` turns off Escape and light dismiss, and nothing inside it closes it. A reader who opens it cannot leave. Add a <button command="close"> inside, or drop \`closedby="none"\`. ${oo}`,message:`${i} opens modally, closes on nothing, and has no close button.`,path:t,rule:"modal-without-close",severity:"error"});return r}function ZL(e,t){if(!e||!t)return null;for(let o=t.length;o>=0;o-=1){let r=t.slice(0,o),i=oe(e,r);if(_(i)&&H(i))return r}return null}function TC(e,t){let o=e.doc.document;if(!o)return null;if(t){let r=oe(o,t);return _(r)&&H(r)?t:null}return ZL(o,Oe(e.session.selection))}function mo(){let e=h.value?.doc.document;return e?fo(e):!1}function G(e){return bt(e.paneId)}function fe(e){let t=jr(e.paneId);if(t?.kind==="lens")return t.zoom;return G(e)?.session.ui.zoom??1}function Fm(e=vr()){return fe(e)}function _e(e,t){let o=jr(e.paneId);if(o?.kind==="lens"){o.zoom=t;return}let r=G(e);if(r)r.session.ui.zoom=t}function Bi(e){return Boolean(e.canvas&&e.viewport)}function Pp(e,t,o,r=null){let a={_width:r||null,canvas:null,element:null,mediaName:e||"",ready:!1,renderScope:null,scrollContainer:null,viewport:null},l=[];if(r&&!o)l.push(`--panel-viewport-w:${r}px`);if(r)l.push(`--panel-canvas-w:${r}px`);return{item:{fullWidth:o,header:t?"shown":"hidden",key:e??"",label:t??"",mediaAttr:e,widthVars:l.join(";")},panel:a}}function tO(e,t){for(let{item:o,panel:r}of e){let i=(a)=>t.panelNode(o.key,a);r.element=i("panel"),r.viewport=i("panel-viewport"),r.canvas=i("panel-canvas")}}function nO(e,t){let o=e.find((i)=>i.item.key===t);if(!o)return;let r=nn(o.panel);if(r)r.session.ui.activeMedia=He(o.item.mediaAttr)}function Jt(e){if(!e.panzoomWrap)return;let t=e.wrap.clientWidth,o=e.panzoomWrap.scrollWidth,r=fe(e),i=t-o*r;e.panX=i>=0?i/2:16,e.panY=0}function hx(e){if(e.centerObserver)e.centerObserver.disconnect(),e.centerObserver=null;if(!e.panzoomWrap)return;e.needsCenter=!0,e.centerObserver=new ResizeObserver(()=>{if(!e.needsCenter){e.centerObserver?.disconnect(),e.centerObserver=null;return}Jt(e),Gs(e)}),e.centerObserver.observe(e.panzoomWrap),Jt(e)}function Gs(e){if(!e.panzoomWrap)return;let t=fe(e);e.panzoomWrap.style.transform=`translate(${e.panX}px, ${e.panY}px) scale(${t})`,wn("overlays")}var Ht=0.25,Lt=3;function yo(e){return Math.min(Lt,Math.max(Ht,e))}function Ki(e,t,o){let r=e.wrap.querySelector('[part="edit-canvas"]'),i=e.panels[0]?.canvas;if(!r||!i)return null;let a=e.wrap.querySelector('[part="edit-column"]'),l=a?Me(a).width:0,s=t&&l>0?l/t:1,c=o;if(c===null){let d=Me(r);c=d.top+d.height/2}return{layoutY:Math.max(0,(c-Me(i).top)/s),scroller:r,zoom:s}}function lh(e=vr(),t=null){if(Vo(e.paneId)!=="edit")return;let[o]=e.panels;if(!o||!Bi(o))return;let r=o.canvas,i=r.querySelector("iframe"),a=G(e)?.session.ui.editZoom??1,l=Ki(e,o._width??null,t);if(a===1){if(o._width=null,r.style.width="",r.style.transform="",r.style.transformOrigin="",i)i.style.width="100%";o.viewport.style.height=""}else{let s=e.wrap.querySelector('[part="edit-column"]');if(!s)return;let c=Me(s).width;if(c<=0)return;let d=c/a;if(o._width=d,r.style.width=`${d}px`,r.style.transform=`scale(${a})`,r.style.transformOrigin="top left",i)i.style.width=`${d}px`,o.viewport.style.height=`${i.offsetHeight*a}px`}if(l)l.scroller.scrollTop+=l.layoutY*(a-l.zoom);wn("overlays")}function Fp(e,t=vr()){let o=G(t);if(!o)return;o.session.ui.editZoom=yo(e),lh(t)}var It=new Map,Dt=new Map;function iO(e,t=vr(),o=null){let r=G(t);if(!r)return;if(r.session.ui.editZoom=yo(e),Dt.set(t.paneId,o),It.has(t.paneId))return;It.set(t.paneId,requestAnimationFrame(()=>{It.delete(t.paneId);let i=Dt.get(t.paneId)??null;Dt.delete(t.paneId),lh(t,i)}))}function Ui(e){let t=getComputedStyle(e).getPropertyValue("--boards-inset").trim(),o=Number(t.replace(/px$/,""));return Number.isFinite(o)?o:0}function xo(e,t,o){if(!e.panzoomWrap)return;let r=e.wrap.clientWidth,i=e.wrap.clientHeight-Ui(e.panzoomWrap),a=24,l=32,s=0,{panels:c}=e;for(let ot of c)s+=ot._width||800;s+=a*Math.max(0,c.length-1)+l;let d=fe(e),y=Me(e.panzoomWrap).height/d+l,b=r/s,T=i/y,k=t==="width"?b:Math.min(b,T),I=Math.min(o,Math.max(K,k));_e(e,I);let J=s*I,ne=y*I;e.panX=Math.max(0,(r-J)/2),e.panY=Math.max(0,(i-ne)/2),Gs(e)}function oO({maxZoom:e=U,surface:t=vr()}={}){je("page",t),xo(t,"page",e)}var K=0.05,U=5;function Co(e){return Math.min(U,Math.max(K,e))}var Gi="page",_t=["width","page","none"];function Zi(e,t,o){let r=t[o];if(Yi(r))return r;if(Y(r)&&r>=K&&r<=U)return r;throw RangeError(`command "${e}" argument "${o}": expected ${_t.map((i)=>`"${i}"`).join(" | ")} or a number in [${K}, ${U}], got ${JSON.stringify(r)}`)}function Yi(e){return n(e)&&_t.includes(e)}var Po=new Map;function So(e){let t=G(e);if(!t)return null;let o=jr(e.paneId)?.kind==="lens"?`::${e.paneId}`:"";return`${t.id}::${t.documentPath??""}${o}`}function je(e,t){let o=So(t);if(o)Po.set(o,e)}function LC(e=vr()){let t=So(e);return(t===null?void 0:Po.get(t))??Gi}function wo(e,t=vr()){let o=e??LC(t);if(o==="none"){Gs(t);return}if(Y(o)){_e(t,Co(o)),Gs(t);return}xo(t,o,1)}function XL(e,t=vr()){je(e,t),wo(e,t)}function jm(e,t=vr(),o=null){if(!G(t))return;let i=Co(e),a=i/fe(t);if(je(i,t),t.panzoomWrap&&a!==1){let l=Me(t.panzoomWrap),s=Me(t.wrap),c=o?.clientX??s.left+s.width/2,d=o?.clientY??s.top+s.height/2;t.panX+=(c-l.left)*(1-a),t.panY+=(d-l.top)*(1-a),t.needsCenter=!1}_e(t,i),Gs(t)}function $C(e){if(e.wrap.clientWidth<=0){Gs(e);return}wo(LC(e),e)}function rO(e=vr()){if(je(1,e),!e.panzoomWrap)return;_e(e,1),Jt(e),Gs(e)}function Eo(e,t){let o=Me(Mo(e)??e.wrap),r=t.top+t.height/2-o.top;return o.height/2-r}function Mo(e){return dx(e)?.scrollContainer??null}function Xi(e,t,o){let r=Mo(e);if(!r){Ro(e,t);return}let i=r.scrollTop-t;if(o){r.scrollTo({behavior:"smooth",top:i});return}r.scrollTop=i}function IC(e,t=vr()){Xi(t,Eo(t,e),!1)}function No(e,t=vr()){let o=Me(t.wrap);if(e.top>=o.top&&e.top+e.height<=o.top+o.height)return;let r=Eo(t,e),i=Math.max(t.panY,0)-t.panY,a=Math.min(r,i);if(a!==0)t.needsCenter=!1,Ro(t,a)}function Ro(e,t){let o=e.panY,r=o+t,i=performance.now(),a=250,l=(s)=>{let c=Math.min((s-i)/250,1),d=c*(2-c);if(e.panY=o+(r-o)*d,Gs(e),c<1)requestAnimationFrame(l)};requestAnimationFrame(l)}var Qi=["edit","design","preview","source","stylebook","tokens","grid","git-diff"],kt=Qi.filter((e)=>e!=="git-diff"),Ve=new Set(["edit","design"]);function ea(e){return Ve.has(e)}var QL=["edit","design","preview"];function ta(e){return QL.filter((t)=>e.capabilities.modes.includes(t))}function sO(e){return ta(e).filter((t)=>t!=="preview")}function e$(e){let t=e.session.ui.canvasMode;return ea(t)?t:null}function t$(e){return{available:e.capabilities.modes.includes("preview")&&Ve.has(e.session.ui.canvasMode),on:e.session.ui.preview===!0}}function n$(e,t,o){if(t==="preview"){if(Ve.has(e.session.ui.canvasMode))e.session.ui.preview=!0;return}if(e.session.ui.preview=!1,e.session.ui.canvasMode!==t)o(e,t)}var ho=new Set(["design","stylebook","git-diff"]),A=(e)=>e.document.open,vo=["auto","light","dark"];function oa(e){function t(l){let s=h.value;if(!s)throw RangeError(`command "${l}" needs an open document; no tab is active`);return s}function o(l,s){let{pane:c}=s;if(c===void 0)return t(l);let d=St(l,s,"pane"),f=bt(d);if(!f)throw RangeError(`command "${l}" argument "pane": "${d}" has no open document`);return f}let r={pane:Fe("Which pane to render this way. Defaults to the focused one.")};function i(l){e.renderPane(a(l))}function a(l){let{pane:s}=l;return n(s)?s:m.activePaneId}return[{args:Se({mode:pi(kt,"The canvas mode to switch the active pane to.")}),category:"View",id:"canvas.setMode",level:"document",menus:["palette"],group:"3_canvas",requires:"an open document",when:A,aiTool:{description:"Switch the active document's editor mode. edit and design put its element tree on the canvas, where the document tools work; preview renders it as a visitor sees it; source shows the JSON; stylebook, tokens and grid open other editors. Use it to return a document to edit or design when the tree tools are refused.",name:"set_canvas_mode",report:({after:l,args:s})=>{let c=qn("canvas.setMode",s,"mode",kt),d=l.editor.kind==="canvas"?"the document tools address its element tree":"the tree-editing tools are unavailable until it returns to edit or design";return`The active document is in ${c} mode; ${d}.`}},run:(l,s)=>{let c=qn("canvas.setMode",s,"mode",kt),d=t("canvas.setMode"),{modes:f}=d.capabilities;if(!f.includes(c))throw RangeError(`command "canvas.setMode" argument "mode": "${c}" is not a mode this document `+`supports — it declares: ${f.join(", ")}`);if(c==="preview"){let g=d.session.ui.canvasMode;if(!Ve.has(g))throw RangeError(`command "canvas.setMode" argument "mode": "preview" composes with the edit and design base modes; this pane is in "${g}"`);d.session.ui.preview=!0;return}d.session.ui.preview=!1,e.setCanvasMode(d,c)},title:"Set Canvas Mode"},{args:Se({zoom:gI("Pan-zoom scale, 1 = 100%.",{maximum:U,minimum:K})}),category:"View",id:"canvas.setZoom",level:"document",menus:["palette"],group:"3_canvas",requires:"a document on the pan-zoom surface",when:A,enablement:()=>ho.has(e.getCanvasMode()),run:(l,s)=>{t("canvas.setZoom"),jm(Zx("canvas.setZoom",s,"zoom",K,U))},title:"Set Zoom"},{args:Se({fit:{description:'How the document is framed: "width" | "page" | "none", or a numeric pan-zoom scale.',oneOf:[{enum:[..._t],type:"string"},{maximum:U,minimum:K,type:"number"}]}}),category:"View",id:"canvas.setFit",level:"document",menus:["palette"],group:"3_canvas",requires:"a document on the pan-zoom surface",when:A,enablement:()=>ho.has(e.getCanvasMode()),run:(l,s)=>{t("canvas.setFit"),XL(Zi("canvas.setFit",s,"fit"))},title:"Set Fit"},{args:Se({zoom:gI("Edit-mode content zoom, 1 = 100%.",{maximum:Lt,minimum:Ht})}),category:"View",id:"canvas.setEditZoom",level:"document",menus:["palette"],group:"3_canvas",requires:"a document in edit mode",when:A,enablement:()=>e.getCanvasMode()==="edit",run:(l,s)=>{t("canvas.setEditZoom"),Fp(Zx("canvas.setEditZoom",s,"zoom",Ht,Lt))},title:"Set Edit Zoom"},{args:{additionalProperties:!1,properties:{...r,width:{description:"How wide the Edit column should render, in CSS pixels, or null to go back to the chosen breakpoint's own width.",type:["number","null"]}},required:["width"],type:"object"},category:"View",id:"canvas.setEditWidth",level:"document",menus:["palette"],group:"3_canvas",requires:"a document in edit mode",when:A,enablement:()=>e.getCanvasMode()==="edit",run:(l,s)=>{let c=o("canvas.setEditWidth",s),{width:d}=s;if(d===null){kC(a(s)),i(s);return}EC(a(s),c,Zx("canvas.setEditWidth",s,"width",Pm,1e4)),i(s)},title:"Set Edit Width"},{args:{additionalProperties:!1,properties:{...r,media:{description:"A breakpoint key the document renders under, or null for the base rendering.",type:["string","null"]}},required:["media"],type:"object"},category:"View",id:"canvas.setBreakpoint",level:"document",menus:["palette"],group:"3_canvas",requires:"an open document",when:A,run:(l,s)=>{let c=o("canvas.setBreakpoint",s),{media:d}=s;if(d!==null&&!n(d))throw RangeError('command "canvas.setBreakpoint" argument "media": expected a breakpoint key or null');let f=Object.keys(to(c.doc.document.$media));if(d!==null&&!f.includes(d))throw RangeError(`command "canvas.setBreakpoint" argument "media": "${d}" is not a breakpoint this `+`document defines — it defines: ${f.length>0?f.join(", "):"nothing"}`);c.session.ui.activeMedia=d,i(s)},title:"Set Breakpoint"},{args:Se({...r,scheme:pi(vo,"Which color scheme the canvas renders in.")},["scheme"]),category:"View",id:"canvas.setColorScheme",level:"document",menus:["palette"],group:"3_canvas",requires:"an open document",when:A,run:(l,s)=>{let c=o("canvas.setColorScheme",s);c.session.ui.previewColorScheme=qn("canvas.setColorScheme",s,"scheme",vo),i(s)},title:"Set Color Scheme"},{args:Se({...r,locale:Fe("BCP 47 tag this pane renders as.")},["locale"]),category:"View",id:"i18n.switchLocale",level:"document",menus:["palette"],group:"3_canvas",requires:"an open document in a project that declares more than one locale",when:(l)=>l.document.open&&l.project.isMultilingual,run:(l,s)=>{let c=o("i18n.switchLocale",s),d=St("i18n.switchLocale",s,"locale"),f=Ts();if(f===null||!f.locales.includes(d))throw RangeError(`command "i18n.switchLocale" argument "locale": "${d}" is not a locale this `+`project declares — it declares: ${f===null?"nothing":f.locales.join(", ")}`);c.session.ui.previewLocale=d,i(s)},title:"Set Rendering Language"},{args:Se({...r,visible:To("True to draw the page's layout elements, false to hide them.")},["visible"]),category:"View",id:"canvas.setLayoutVisible",level:"document",menus:["palette"],group:"3_canvas",requires:"an open document",when:A,run:(l,s)=>{let c=o("canvas.setLayoutVisible",s);c.session.ui.showLayout=Hi("canvas.setLayoutVisible",s,"visible"),i(s)},title:"Show Layout Elements"},{args:Se({...r,open:To("True to draw the popover open, false to close it."),path:{description:"Document path of the popover. Defaults to the popover the selection is in or at.",items:{type:["string","number"]},type:"array"}},[]),category:"View",enablement:()=>co(),group:"3_canvas",id:"canvas.setPopoverOpen",level:"document",menus:["palette"],requires:"a popover in the open document",run:(l,s)=>{let c=o("canvas.setPopoverOpen",s),d=s.path,f=s.open===void 0?!0:Hi("canvas.setPopoverOpen",s,"open");if(!f&&d===void 0){e.setOpenPopover(c,null);return}let g=lo(c,d);if(g===null)throw RangeError('command "canvas.setPopoverOpen" argument "path": names no popover in this document — '+"a popover is an element with a `popover` attribute, and <dialog> is not one");e.setOpenPopover(c,f?g:null)},title:"Show Popover",when:A},{args:Se({...r,open:To("True to draw the dialog open, false to close it."),path:{description:"Document path of the dialog. Defaults to the dialog the selection is in or at.",items:{type:["string","number"]},type:"array"}},[]),category:"View",enablement:()=>mo(),group:"3_canvas",id:"canvas.setDialogOpen",level:"document",menus:["palette"],requires:"a dialog in the open document",run:(l,s)=>{let c=o("canvas.setDialogOpen",s),d=s.path,f=s.open===void 0?!0:Hi("canvas.setDialogOpen",s,"open");if(!f&&d===void 0){e.setOpenDialog(c,null);return}let g=TC(c,d);if(g===null)throw RangeError('command "canvas.setDialogOpen" argument "path": names no dialog in this document — '+"a dialog is a <dialog> element, and a popover is not one");e.setOpenDialog(c,f?g:null)},title:"Show Dialog",when:A},{args:{additionalProperties:!1,properties:{...r,open:{default:!0,description:"True to open the resolving-with popover, false to close it.",type:"boolean"}},required:[],type:"object"},category:"View",id:"canvas.setResolvingOpen",level:"document",menus:["palette"],group:"3_canvas",requires:"an open document",when:A,run:(l,s)=>{o("canvas.setResolvingOpen",s);let{open:c,pane:d}=s;e.setResolvingOpen(n(d)?d:m.activePaneId,c===void 0||Hi("canvas.setResolvingOpen",s,"open"))},title:"Show Resolving Values"},{args:{additionalProperties:!1,properties:{...r,name:Fe("The prop's name, as the component's state declares it."),value:{description:"The test value — any JSON. Null clears it and the prop returns to its default.",type:["string","number","boolean","array","object","null"]}},required:["name"],type:"object"},category:"View",id:"canvas.setTestProp",level:"document",menus:["palette"],group:"3_canvas",requires:"an open component document",when:A,run:(l,s)=>{let c=o("canvas.setTestProp",s),d=St("canvas.setTestProp",s,"name"),f=Object.keys(c.doc.document.state??{});if(!f.includes(d))throw RangeError(`command "canvas.setTestProp" argument "name": "${d}" is not a prop this component `+`declares — it declares: ${f.length>0?f.join(", "):"nothing"}`);let{value:g}=s,y={...c.session.ui.previewProps};if(g===null||g===void 0)delete y[d];else y[d]=g;c.session.ui.previewProps=Object.keys(y).length>0?y:null,i(s)},title:"Set Test Value"},{args:{additionalProperties:!1,properties:{...r,name:Fe("The route parameter's name, without brackets."),value:Fe("The value to preview the route with. Empty clears it.")},required:["name","value"],type:"object"},category:"View",id:"canvas.setRouteParam",level:"document",menus:["palette"],group:"3_canvas",requires:"an open page with a dynamic route",when:A,run:(l,s)=>{let c=o("canvas.setRouteParam",s),d=St("canvas.setRouteParam",s,"name"),f=Bc(c.documentPath);if(!f.includes(d))throw RangeError(`command "canvas.setRouteParam" argument "name": "${d}" is not a parameter of this `+`route — it has: ${f.length>0?f.join(", "):"none"}`);c.session.ui.previewParams={...c.session.ui.previewParams,[d]:St("canvas.setRouteParam",s,"value")},i(s)},title:"Set Route Parameter"}]}function aO(e,t){e.registerAll(oa(t))}function px(e=vr()){let t=dl(e.paneId),o=e.panels;for(let r of o){let i=r.element?.querySelector('[part="panel-header"]');if(i){let a=t===null&&r.mediaName==="base"||t===r.mediaName;i.toggleAttribute("data-active",a)}}}var L=null;function ia(e){if(L?.isConnected)return L;let t=e.createElement("div");return t.className="jx-drag-ghost",t.style.cssText="position:fixed;left:0;top:0;z-index:9999;pointer-events:none;display:none;padding:2px 8px;border-radius:4px;font-size:12px;line-height:1.4;white-space:nowrap;background:var(--accent,#3b82f6);color:var(--accent-fg,#fff);box-shadow:0 2px 8px rgba(0,0,0,0.25);transform:translate(8px,8px)",e.body.append(t),L=t,t}function i$(e,t,o,r=document){let i=ia(r);i.textContent=e,i.style.left=`${t}px`,i.style.top=`${o}px`,i.style.display="block"}function RC(e,t){if(!L||L.style.display==="none")return;L.style.left=`${e}px`,L.style.top=`${t}px`}function ch(){if(L)L.style.display="none"}var Oo=function(){if(typeof window>"u")return null;var e=new Image;return e.src="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==",e}();function ul(e){var t=e.nativeSetDragImage;if(t&&Oo)t(Oo,0,0)}function Ao(e,t){if(e==null)return{};var o={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;o[r]=e[r]}return o}function $o(e,t){if(e==null)return{};var o,r,i=Ao(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)o=a[r],t.indexOf(o)===-1&&{}.propertyIsEnumerable.call(e,o)&&(i[o]=e[o])}return i}function qe(e,t){var o=Object.keys(e),r=Object.keys(t);if(o.length!==r.length)return!1;return o.every(function(i){return Object.is(e[i],t[i])})}function Io(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:qe,t=null;return function(o){if(t&&e(t.value,o))return t.value;return t={value:o},t.value}}var aa=["block"];function Do(e,t){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),o.push.apply(o,r)}return o}function ko(e){for(var t=1;t<arguments.length;t++){var o=arguments[t]!=null?arguments[t]:{};t%2?Do(Object(o),!0).forEach(function(r){pl(e,r,o[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):Do(Object(o)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(o,r))})}return e}function sa(e){return{x:(e.right+e.left)/2,y:(e.bottom+e.top)/2}}function jt(e){var{client:t,borderBox:o}=e,r=o.height/4;if(t.y<=o.top+r)return"reorder-above";if(t.y>=o.bottom-r)return"reorder-below";return"make-child"}function la(e){var{element:t,input:o,currentLevel:r,indentPerLevel:i,mode:a}=e,l={x:o.clientX,y:o.clientY},s=t.getBoundingClientRect();if(a==="standard"){var c=jt({borderBox:s,client:l});return{type:c,indentPerLevel:i,currentLevel:r}}var d=sa(s);if(a==="expanded"){var f=jt({borderBox:s,client:l});return{type:f==="reorder-above"?f:"make-child",indentPerLevel:i,currentLevel:r}}var g=i*r;if(l.x<s.left+g){if(l.y<d.y)return{type:"reorder-above",indentPerLevel:i,currentLevel:r};var y=(l.x-s.left)/i,b=Math.max(Math.floor(y),0);return{type:"reparent",desiredLevel:b,indentPerLevel:i,currentLevel:r}}return{type:jt({borderBox:s,client:l}),indentPerLevel:i,currentLevel:r}}function Jo(e,t){if(e.type!==t.type)return!1;if(e.type==="instruction-blocked"&&t.type==="instruction-blocked")return Jo(e.desired,t.desired);return qe(e,t)}var ca=Io(Jo);function ua(e){var{desired:t,block:o}=e;if(o!==null&&o!==void 0&&o.includes(t.type)&&t.type!=="instruction-blocked"){var r={type:"instruction-blocked",desired:t};return r}return t}function fx(e,t){var o=t.block,r=$o(t,aa),i=la(r),a=ua({desired:i,block:o}),l=ca(a);return ko(ko({},e),{},pl({},We,l))}function jp(e){var t;return(t=e[We])!==null&&t!==void 0?t:null}var We=Symbol("tree-item-instruction");var Ho=`data:image/svg+xml,${encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" width="320" height="180" viewBox="0 0 320 180"><rect width="320" height="180" fill="#808080" fill-opacity="0.16"/><g fill="#808080" fill-opacity="0.38"><circle cx="118" cy="64" r="14"/><path d="M60 140l52-50 34 30 38-46 76 66z"/></g></svg>')}`;function da(e){let t=e.getAttribute("src")?.trim()??"",o=e.getAttribute("srcset")?.trim()??"";if(t!==""||o!=="")return!1;return!(e.parentElement?.localName==="picture"?e.parentElement:null)?.querySelector("source[srcset]:not([srcset=''])")}function Ft(e){if(da(e))e.setAttribute("data-jx-image-placeholder",""),e.setAttribute("src",Ho);else if(e.hasAttribute("data-jx-image-placeholder")&&e.getAttribute("src")!==Ho)e.removeAttribute("data-jx-image-placeholder")}function jo(e){return e.localName==="img"}function _o(e){if(e.nodeType!==e.ELEMENT_NODE||!("querySelectorAll"in e))return[];let t=e,o=[...t.querySelectorAll("img")];return jo(t)?[t,...o]:o}function Fo(e){for(let r of _o(e))Ft(r);let o=new(e.ownerDocument.defaultView?.MutationObserver??MutationObserver)((r)=>{for(let i of r){if(i.type==="attributes"){let{target:a}=i;if(a.nodeType===a.ELEMENT_NODE&&"localName"in a){let l=a;if(jo(l))Ft(l)}continue}for(let a of i.addedNodes)for(let l of _o(a))Ft(l)}});return o.observe(e,{attributeFilter:["src","srcset"],attributes:!0,childList:!0,subtree:!0}),()=>o.disconnect()}async function mx(e,t=new Map){su(!0);try{if(!await pa(e))return qo(e.tagName);let o=document.createElement(e.tagName);for(let i of e.props||[])if(i.default!==void 0&&i.default!=="false"&&i.default!=="''"){let a=String(i.default).replaceAll(/^'|'$/g,"");o.setAttribute(i.name,a)}let r=o;for(let[i,a]of t)r[i]=a;return Fo(o),o}catch(o){return console.warn("Component preview failed:",e.tagName,o),qo(e.tagName)}}async function pa(e){if(e.source==="npm")return Boolean(customElements.get(e.tagName));if(e.path&&!e.path.endsWith(".json"))return!1;let t=C?.projectRoot;return await jv(`${location.origin}/${t?`${t}/`:""}${e.path}`),!0}function qo(e){let t=document.createElement("div");return t.style.cssText="padding:12px;border:1px dashed var(--border);border-radius:var(--radius);color:var(--fg-dim)",t.textContent=`<${e}>`,t}var fa='[part="outline"]',qt='[part="row"]',ma='[part="verbs"]',Be=null;function lO(){if(Be!==null)cancelAnimationFrame(Be);for(let e of st.dndCleanups)e();st.dndCleanups=[],Be=requestAnimationFrame(()=>{Be=null;let e=Th?.querySelector(fa);if(!e)return;for(let o of e.querySelectorAll("[data-dnd-row]")){let r=o.dataset.value.split("/").map((c)=>/^\d+$/.test(c)?Math.trunc(Number(c)):c),i=Math.trunc(Number(o.dataset.dndDepth))||0,a=Object.hasOwn(o.dataset,"dndVoid"),l=Object.hasOwn(o.dataset,"dndExpanded"),s=Br(zr({canDrag({element:c,input:d}){if(h0(d.clientX,d.clientY)?.closest(ma))return!1;return!0},element:o,getInitialData(){return{path:r,type:"tree-node"}},onGenerateDragPreview({nativeSetDragImage:c}){ul({nativeSetDragImage:c})},onDragStart(){if(o.dataset.dragging="",st.layerDragSourceHeight=o.offsetHeight,l)ga(o,e)},onDrop(){if(delete o.dataset.dragging,l)wn("leftPanel")}}),Ks({element:o,canDrop({source:c}){let d=c.data.path;if(Array.isArray(d)&&na(d,r))return!1;return!0},getData({input:c,element:d}){return fx({path:r},{block:a?["make-child"]:[],currentLevel:i,element:d,indentPerLevel:16,input:c,mode:l?"expanded":"standard"})},onDragEnter({self:c}){Wo(o,c.data,e)},onDrag({self:c}){Wo(o,c.data,e)},onDrop(){ge(e)}}));st.dndCleanups.push(s)}let t=Js({onDrop({source:o,location:r}){ge(e);let[i]=r.current.dropTargets;if(!i)return;let a=jp(i.data);if(!a||a.type==="instruction-blocked")return;let l=o.data,s=i.data.path;if(!Array.isArray(s))return;let c=l.type==="tree-node"&&o.element,d=c&&Object.hasOwn(c.dataset,"dndExpanded");if(Jb(h.value,a,l,s),d){let f=h.value,g=Oe(f?.session.selection);if(g)st._layersCollapsed||=new Set,st._layersCollapsed.add(g.join("/"))}},onDropTargetChange({location:o}){let[r]=o.current.dropTargets;if(r&&!jp(r.data))ge(e)}});st.dndCleanups.push(t)})}function cO(){requestAnimationFrame(()=>{let e=Th?.querySelector(".components-section");if(!e)return;for(let t of e.querySelectorAll("[data-component-tag]")){let o=t.dataset.componentTag;if(!o)continue;let r=Ne.find((s)=>s.tagName===o);if(!r)continue;let i=t.querySelector(".element-card-preview");if(i&&!i.querySelector(o))mx(r).then((s)=>{i.textContent="",i.append(s)});let a=Uc(r),l=zr({element:t,getInitialData(){return{fragment:structuredClone(a),type:"block"}},onGenerateDragPreview({nativeSetDragImage:s}){ul({nativeSetDragImage:s})}});st.dndCleanups.push(l)}})}function dO(){requestAnimationFrame(()=>{let e=Th?.querySelector('[part="content"]');if(!e)return;for(let t of e.querySelectorAll("[data-block-tag]")){let o=t.dataset.blockTag,r=t.querySelector(".element-card-preview");if(r&&!r.firstChild){let l=document.createElement(Wn.has(o)?"span":o);l.textContent=o,r.append(l)}let i=ah(o),a=zr({element:t,getInitialData(){return{fragment:structuredClone(i),type:"block"}},onGenerateDragPreview({nativeSetDragImage:l}){ul({nativeSetDragImage:l})}});st.dndCleanups.push(a)}})}function ga(e,t){let o=`${e.dataset.value}/`,r=t.querySelectorAll(qt);for(let i of r)if(i.dataset.value?.startsWith(o))i.style.display="none"}function Wo(e,t,o){let r=jp(t);if(st._currentDropTargetRow&&st._currentDropTargetRow!==e)delete st._currentDropTargetRow.dataset.drop;if(!r||r.type==="instruction-blocked"){ge(o);return}if(r.type==="make-child"){ge(o),e.dataset.drop="",st._currentDropTargetRow=e;return}delete e.dataset.drop,st._currentDropTargetRow=e;let i=[...o.querySelectorAll(qt)],a=i.indexOf(e),l=st.layerDragSourceHeight;for(let[s,c]of i.entries()){if(c.dataset.dragging!==void 0)continue;if(r.type==="reorder-above")c.style.transform=s>=a?`translateY(${l}px)`:"";else c.style.transform=s>a?`translateY(${l}px)`:""}}function ge(e){if(st._currentDropTargetRow)delete st._currentDropTargetRow.dataset.drop,st._currentDropTargetRow=null;let t=e.querySelectorAll(qt);for(let o of t)o.style.transform="",o.style.display=""}function Bo(e,t,o){if(t==="make-child")return{index:rr(oe(e,o)).length,parent:o};let r=Vt(o),i=zi(o);if(!r||!Y(i))return;if(t==="reorder-above")return{index:i,parent:r};if(t==="reorder-below")return{index:i+1,parent:r};return null}function Jb(e,t,o,r){if(!e)return;if(o.type==="tree-node"){let i=o.path,a=Bo(e.doc.document,t.type,r);if(a)Z(e,(l)=>Kp(l,i,a.parent,a.index))}else if(o.type==="block"){let i=Bo(e.doc.document,t.type,r);if(i===void 0)return;let a=o.fragment;if(i)Z(e,(l)=>{or(l,i.parent,i.index,structuredClone(a)),Op(l,a.tagName),l.session.selection=[[...i.parent,"children",i.index]]})}}function zo(e){let t={};for(let[o,r]of Object.entries(e?.nesting??{}))if(o!=="_root")t[o]=r?.inline===!0;for(let o of e?.inline??[])t[o]=!1;return t}function j(e){return JSON.parse(JSON.stringify(e))}var Xe=new WeakMap,x=new Set,ee=0,ve=new Map,lr=-1,cr=0,ha=600;function o$(e){return lr===e&&Date.now()-cr<=ha}var Ko=0,ur=new Set;function va(e,t){let o;try{o=new URL(e,t.iframe.src||fh())}catch{return}if(!["http:","https:","mailto:","tel:"].includes(o.protocol))return;let r=o.href,i=tn();if(i){i(r);return}window.open(r,"_blank","noopener,noreferrer")}function r$(e){ur.add(e)}function ya(e){return ur.delete(e)}var q=new Map,ie=new Map,xe=new Map,xa=300;function s$(e,t,o,r=xa){let i=null;for(let s of x){if(!s.iframe.isConnected){x.delete(s);continue}if(s.ready&&!s.stylebook&&e!==null&&s.tabId===e){i=s;break}}if(!i)return Promise.resolve(null);Ko+=1;let a=Ko,l=j(t);return i.channel.post({contextPath:o?[...o]:null,exprs:l,gen:i.lastRenderedGen,kind:"evalExpr",reqId:a}),new Promise((s)=>{let c=setTimeout(()=>{q.delete(a),ie.delete(a),s(null)},r);ie.set(a,i),q.set(a,(d)=>{clearTimeout(c),ie.delete(a),s(d)})})}var Zo=0,se=new Map,ba=250;function a$(e,t=ba){let o=[];for(let r of x){if(!r.iframe.isConnected){x.delete(r);continue}if(r.ready&&!r.stylebook&&e!==null&&r.tabId===e)o.push(r)}if(o.length===0)return Promise.resolve();return new Promise((r)=>{let i=o.length,a=setTimeout(()=>{for(let c of s)se.delete(c),xe.delete(c);r()},t),l=()=>{if(i-=1,i===0)clearTimeout(a),r()},s=[];for(let c of o){Zo+=1;let d=Zo;s.push(d),se.set(d,l),xe.set(d,c),c.channel.post({kind:"flushEdits",reqId:d})}})}function DC(e){return Xe.get(e)??null}function Yb(e){for(let t of x){if(!t.iframe.isConnected)continue;let o=Me(t.iframe);if(e.x>=o.left&&e.x<=o.right&&e.y>=o.top&&e.y<=o.bottom)return t}return null}function Zb(e,t,o){ee+=1,ve.set(ee,o);let r=t.type==="tree-node"?{path:[...t.path],type:"tree-node"}:{type:t.type};return e.channel.post({dragSeq:ee,gen:e.lastRenderedGen,kind:"dragStart",src:r}),ee}function NC(){return ee}function tc(e){let t=Me(e.iframe),o=e.iframe.clientWidth>0?t.width/e.iframe.clientWidth:1;return{rect:t,scale:o}}function dr(e){if(e.stylebook)return"stylebook";return e.tabId??"unbound"}function l$(){let e=[];for(let t of x){if(!t.iframe.isConnected){x.delete(t);continue}let o=`canvas[${dr(t)}]`;if(!t.ready){e.push(`${o}: frame has not handshaked`);continue}let r=[...t.pendingTabIds.keys()];if(r.length>0)e.push(`${o}: gen ${r.join(", ")} unacked`);if(t.pendingPatches>0)e.push(`${o}: ${t.pendingPatches} unacked patch(es)`);if(t.pendingMeasures.size>0)e.push(`${o}: ${t.pendingMeasures.size} measure(s) in flight`);let{idle:i}=t;if(!i){e.push(`${o}: no quiescence report yet`);continue}if(i.gen!==t.lastRenderedGen)e.push(`${o}: quiescence is for gen ${i.gen}, DOM is gen ${t.lastRenderedGen}`);if(!i.fonts)e.push(`${o}: fonts still loading`);if(i.animations>0)e.push(`${o}: ${i.animations} running animation(s)`);if(i.images>0)e.push(`${o}: ${i.images} pending image retry(ies)`)}if(q.size>0)e.push(`canvas: ${q.size} expression eval(s) in flight`);return e}var Ca=500,Pa=2,Sa=40;function pr(){let e=h.value?.id??null,t=null;for(let o of x){if(!o.iframe.isConnected){x.delete(o);continue}if(!o.ready||o.stylebook)continue;if(o.tabId===e)return o;t??=o}return t}function fr(e,t){let{rect:o,scale:r}=tc(e),i=o.left+t.x*r,a=o.top+t.y*r,l=t.width*r,s=t.height*r;return{height:s,left:i,top:a,width:l,x:i+l/2,y:a+s/2}}function be(e,t){return new Promise((o)=>{e.measureSeq+=1;let r=e.measureSeq,i=setTimeout(()=>{e.pendingMeasures.delete(r),o(null)},Ca);e.pendingMeasures.set(r,(a)=>{clearTimeout(i);let[l]=a;o(l?fr(e,l.rect):null)}),e.channel.post({kind:"measure",paths:[[...t]],reqId:r})})}function c$(e){let t=DC(e),o=t?.lastHover;if(!t||!o)return null;return{settle:async()=>(await be(t,o.path))?.top??null,top:fr(t,o.rect).top}}function d$(e){let t=pr();return t?be(t,e):Promise.resolve(null)}function wa(e){return new Promise((t)=>{let o=Number.NaN,r=0,i=0,a=()=>{let{top:l}=Me(e.iframe);if(r=l===o?r+1:0,o=l,i+=1,r>=Pa||i>=Sa){t();return}requestAnimationFrame(a)};requestAnimationFrame(a)})}async function Xb(e){let t=pr();return t?QP(t,e):null}async function QP(e,t){let o=await be(e,t);if(!o)return null;let r=W(e.canvasEl)?.surface;return IC({height:o.height,top:o.top},r),await wa(e),be(e,t)}function yF(e,t){let o=DC(e);return o?be(o,t):Promise.resolve(null)}function Ea(e){let t=e.canvasEl.parentElement;if(!t)return;let o=/scale\(([\d.]+)\)/.exec(e.canvasEl.style.transform),r=o?Number(o[1]):1;t.style.height=r===1?"":`${e.iframe.offsetHeight*r}px`}function mr(e){if(e.preview){e.iframe.style.height="100%",e.iframe.style.minHeight="0px";return}if(e.contentHeight===null)return;e.iframe.style.height=`${e.contentHeight}px`,e.iframe.style.minHeight=e.contentFragment?"0px":"480px",Ea(e)}function Gt(e,t){if(e.preview=t,e.overlay.setSuppressed(t),t)e.pendingEnterEdit=null;mr(e)}function u$(e,t){Gt(Yt(e),t)}function Vc(e,t){if(!e.iframe.isConnected)return;e.channel.post(t)}function gx(e){ve.delete(e)}function bx(e){e.overlay.setDropIndicator(null)}var gr=null;function h$(e){gr=e}var Ta=300,hr=null;function p$(e){hr=e}var Zt=null;function f$(e){Zt=e}function Ma(e,t,o){if((t?Na(t.tagName):!1)&&t){e.overlay.setDropIndicator(null),e.overlay.setReplaceTarget(O(t.rect));return}e.overlay.setReplaceTarget(null),e.overlay.setDropIndicator(o?O(o.referenceRect):null,o?.edge)}function Yo(e){e.overlay.setReplaceTarget(null),e.overlay.setDropIndicator(null)}function Na(e){return e==="img"||e==="video"||e==="source"}function Ra(e,t){if(e.dataset.jxGutterDrop==="1")return;e.dataset.jxGutterDrop="1",e.addEventListener("dragover",(o)=>{if(![...o.dataTransfer?.types??[]].includes("Files"))return;if(o.preventDefault(),o.dataTransfer)o.dataTransfer.dropEffect="copy"}),e.addEventListener("drop",(o)=>{let r=o.dataTransfer?.files,i=t();if(!r?.length||!i||i.stylebook)return;o.preventDefault(),Zt?.(E(i),[...r],null,null)})}var Ue=null;function m$(e){Ue=e}var Ge=null;function g$(e){Ge=e}var xr=null;function b$(e){xr=e}function Xo(e,t){let o=[...t];for(;;){let r=e.get(Wc(o));if(r)return r;if(o.length<2)return null;o=o.slice(0,-2)}}var N=null;function v$(){let e=N;return Boolean(e?.editing&&e.iframe.isConnected)}var Ze=null;function y$(e){Ze=e}var Ut=null;function w$(e){Ut=e}var Qo=null,br=null;function x$(e){br=e}function _$(e,t){for(let o of x){if(!o.iframe.isConnected){x.delete(o);continue}if(o.ready&&o.tabId===e.id&&!o.preview)o.popoverOpen=t,o.channel.post({kind:"setPopoverOpen",path:t})}}function S$(e,t){for(let o of x){if(!o.iframe.isConnected){x.delete(o);continue}if(o.ready&&o.tabId===e.id&&!o.preview)o.dialogOpen=t,o.channel.post({kind:"setDialogOpen",path:t})}}function AC(e,t){let o=0;for(let r of x){if(!r.iframe.isConnected){x.delete(r);continue}if(r.ready&&r.tabId===t){let i=W(r.canvasEl)?.surface;if(!i){lx("host-stage-unresolved");continue}let a=i.renderGeneration,l=et?.host===r?et.paths:void 0;tt(r),r.channel.post(l?{echoPaths:l,forwardOps:e,gen:a,kind:"patch"}:{forwardOps:e,gen:a,kind:"patch"}),r.pendingPatches+=1,o+=1}}return o}var et=null,Oa=0;function er(e,t,o){et={host:e,paths:t};try{o()}finally{et=null}}var Bt=null,zt=null;function Aa(e,t,o){return!e&&t===o}function $a(e,t){let o=E(e);if(!o)return;let r=oe(o.doc.document,t);if(!r)return;AC([{key:"$props",op:"set-key",path:t,value:r.$props}],o.id)}function E(e){return e.tabId?m.tabs.get(e.tabId)??null:null}function C$(e){return E(e)}function ze(e){let t=W(e.canvasEl)?.surface.paneId;if(t)Sr(t)}var Da=Object.freeze([]);function Ja(){let e=new Map;for(let t of m.panes){let o=t.activeTabId?m.tabs.get(t.activeTabId):null;if(!o)continue;let r=o.session.selection;r.map((i)=>i.join("/")).join("|"),e.set(o.id,r)}return e}function Ha(){if(Qo)return;let e=me(!0);e.run(()=>{te(()=>{let t=Ja();u.stylebook.selection;for(let o of x)nt(o,(o.tabId?t.get(o.tabId):null)??Da)})}),Qo={stop:()=>e.stop()}}function tt(e){if(!e.ready)return;let t=gh(),o=Vp();if(t===e.postedVersions&&o===e.postedRevisions)return;let r=e.postedVersions===null;if(e.postedVersions=t,e.postedRevisions=o,r&&Object.keys(t).length===0&&Object.keys(o).length===0)return;e.channel.post({kind:"assetVersions",revisions:o,versions:t})}var tr=!1,Kt=!1;function La(){if(tr)return;tr=!0,me(!0).run(()=>{te(()=>{if(pv.value,Kt)return;Kt=!0,queueMicrotask(()=>{Kt=!1,_a()})})})}function _a(){for(let e of x){if(!e.iframe.isConnected){x.delete(e);continue}tt(e)}}var nr=!1,Ke=null;function ja(){if(nr)return;nr=!0,me(!0).run(()=>{te(()=>{for(let t of m.panes){let o=t.activeTabId?m.tabs.get(t.activeTabId):null;if(!o)continue;let{peers:r}=xn(o);r.map((i)=>JSON.stringify(i.state.structuralSelection??null)).join("|")}if(Ke)clearTimeout(Ke);Ke=setTimeout(()=>{Ke=null;for(let t of x)Pr(t)},100)})})}function Pr(e){if(e.stylebook||!e.ready||!e.iframe.isConnected)return;let t=E(e),o=t?xn(t).peers:[];e.presenceMeta.clear();let r=[];for(let i of o){let{structuralSelection:a}=i.state;if(!a||i.state.focusedPath!==t?.documentPath)continue;for(let l of a){let s=[...l];r.push(s),e.presenceMeta.set(JSON.stringify(s),{color:i.state.user.color,label:i.state.user.name??i.state.user.login})}}if(r.length===0){e.presenceReqId=-1,e.overlay.setPresence([]);return}e.measureSeq+=1,e.presenceReqId=e.measureSeq,e.channel.post({kind:"measure",paths:r,reqId:e.presenceReqId})}function nt(e,t){if(e.stylebook){Va(e);return}let o=Oe(t);if(e.selectionPath=o,e.selectionPaths=t,!e.iframe.isConnected){x.delete(e);return}if(!o){e.selReqId=-1,e.coSelectionKeys.clear(),e.overlay.setSelection(null),e.overlay.setCoSelection([]);return}if(!e.ready)return;let r=Ia(t.slice(0,-1));e.coSelectionKeys=new Set(r.map((i)=>JSON.stringify(i))),e.measureSeq+=1,e.selReqId=e.measureSeq,e.channel.post({kind:"measure",paths:[[...o],...r],reqId:e.selReqId})}function Va(e){if(!e.iframe.isConnected){x.delete(e);return}let t=u.stylebook.selection,o=t?e.stylebook?.tagToCardPath.get(t):void 0;if(!t||!o){e.selReqId=-1,e.overlay.setSelection(null);return}if(!e.ready)return;e.measureSeq+=1,e.selReqId=e.measureSeq,e.channel.post({kind:"measure",paths:[[...o]],reqId:e.selReqId})}function ir(){return k0("../canvas.html")}function wr(e){e.channel.dispose();for(let[t,o]of q)if(ie.get(t)===e)q.delete(t),ie.delete(t),o(null);for(let[t,o]of se)if(xe.get(t)===e)se.delete(t),xe.delete(t),o();for(let[,t]of e.pendingMeasures)t([]);if(e.pendingMeasures.clear(),e.pendingTabIds.clear(),Ce(e),N===e)N=null;e.overlay.root.remove(),e.iframe.remove(),Xe.delete(e.canvasEl),x.delete(e)}function qa(){if(!ye())return ir();return p().canvasUrl||ir()}function Qb(e){let t=0;for(let o of new Set(x))if(e.contains(o.canvasEl))wr(o),t+=1;return t}function Yt(e){let t=qa(),o=Xe.get(e);if(o){if(o.canvasUrl===t)return o;wr(o)}let r=location.origin,i=crypto.randomUUID(),a=new URL(t,location.href).origin,l=document.createElement("iframe");l.className="jx-canvas-iframe",l.title="Canvas — live page render",l.style.cssText="width:100%;min-height:480px;height:100%;border:0;display:block;background:#fff";let s=new URL(t,location.href);if(s.searchParams.set("token",i),location.protocol==="http:"||location.protocol==="https:")s.searchParams.set("parentOrigin",r);if(l.src=a===r?`${s.pathname}${s.search}`:s.href,!e.style.position)e.style.position="relative";let c=ro(document);e.replaceChildren(l,c.root),Ra(e,()=>DC(e));let d=en({acceptOrigin:a,source:window,target:{postMessage:(g,y)=>l.contentWindow?.postMessage(g,y)},targetOrigin:a,token:i}),f={canvasEl:e,canvasUrl:t,channel:d,contentFragment:!1,contentHeight:null,hiddenPaths:new Set,popoverOpen:null,dialogOpen:null,editing:!1,editingProp:null,iframe:l,insertHideTimer:null,insertHover:!1,coSelectionKeys:new Set,insertZone:null,lastRenderedGen:-1,lastHover:null,lastSelectionRect:null,lastSnapshotSeq:0,measureSeq:0,overlay:c,panReqId:-1,pending:null,postedVersions:null,postedRevisions:null,idle:null,pendingEnterEdit:null,pendingMeasures:new Map,pendingPatches:0,pendingTabIds:new Map,presenceMeta:new Map,presenceReqId:-1,preview:!1,ready:!1,selectionPath:null,selectionPaths:[],selReqId:-1,snapshot:null,stylebook:null,tabId:null};return c.insertButton.addEventListener("click",(g)=>za(f,g)),c.insertButton.addEventListener("mouseenter",()=>{f.insertHover=!0,Ce(f)}),c.insertButton.addEventListener("mouseleave",()=>{f.insertHover=!1,Mr(f)}),d.onMessage((g)=>Ua(f,g)),Xe.set(e,f),x.add(f),Ha(),ja(),La(),f}function Wa(e,t){Ce(e),e.insertZone=t,e.overlay.setInsertZone(O(t.rect),t.edge)}function Tr(e){Ce(e),e.insertZone=null,e.insertHover=!1,e.overlay.setInsertZone(null)}function Ba(e){let t=e.overlay.insertButton;return e.insertHover||t.matches(":hover")}function Mr(e){Ce(e),e.insertHideTimer=setTimeout(()=>{if(e.insertHideTimer=null,Ba(e))return;Tr(e)},Ta)}function Ce(e){if(e.insertHideTimer!==null)clearTimeout(e.insertHideTimer),e.insertHideTimer=null}function za(e,t){t.stopPropagation(),t.preventDefault();let o=e.insertZone;if(!o)return;hr?.(e.overlay.insertButton,o)}var Ka=new Set(["contextMenu","dragOver","dropResult","editCommit","editCommitProp","editInput","editInsert","editMerge","editRangeReplace","editSplit","editStart","fileDragOver","fileDrop","hit","hover","insertZones","layoutHit","nativeDragEnter"]);function Ua(e,t){if(e.preview&&Ka.has(t.kind))return;switch(t.kind){case"ready":{e.ready=!0;let o=Xt?.();if(o)e.channel.post({chords:o.chords,kind:"keymap",mac:o.mac});if(e.postedVersions=null,e.postedRevisions=null,tt(e),e.pending)e.channel.post(e.pending),e.pending=null;nt(e,e.selectionPaths);return}case"paneFocus":{ze(e),Ut?.();return}case"popoverTargetClick":{let o=E(e);if(!o||e.preview)return;let r=JSON.stringify(o.session.ui.openPopover)===JSON.stringify(t.targetPath),i=t.action==="show"||t.action==="toggle"&&!r;if(i||r)ae()?.run("canvas.setPopoverOpen",{open:i,path:t.targetPath});return}case"commandTargetClick":{let o=E(e);if(!o||e.preview)return;let r=(a)=>JSON.stringify(a)===JSON.stringify(t.targetPath),i=oe(o.doc.document,t.targetPath);if(!Jn(i))return;if($t.has(t.command)){if(!Fa(i))return;let a=t.command==="show-popover"||t.command==="toggle-popover"&&!r(o.session.ui.openPopover);if(a||r(o.session.ui.openPopover))ae()?.run("canvas.setPopoverOpen",{open:a,path:t.targetPath})}else if(Ot.has(t.command)){if(!H(i))return;let a=t.command==="show-modal";if(a||r(o.session.ui.openDialog))ae()?.run("canvas.setDialogOpen",{open:a,path:t.targetPath})}return}case"hit":{ze(e),Ut?.(),U$(null);let o=null,r=W(e.canvasEl)?.panel;if(r?.mediaName&&!r.mediaName.startsWith("git-diff")){o=He(r.mediaName);let a=E(e);if(a)a.session.ui.activeMedia=o}if(Ge?.dismiss(),e.stylebook){let a=Xo(e.stylebook.pathToTag,t.hit.path);if(xr?.(a,o),a){let l=O(t.hit.rect);e.overlay.setSelection(l,`<${a}>`),e.lastSelectionRect=l}else e.overlay.setSelection(null);return}e.selectionPath=t.hit.path,e.selectionPaths=[t.hit.path];let i=E(e);if(i)i.session.selection=t.additive?Jx(i.session.selection,t.hit.path):[t.hit.path];{let a=O(t.hit.rect);e.overlay.setSelection(a),e.lastSelectionRect=a}return}case"layoutHit":{if(e.stylebook)return;ze(e),Ge?.dismiss(),U$(t.hit),e.selectionPath=null,e.selectionPaths=[];let o=E(e);if(o)o.session.selection=[];let r=O(t.hit.rect);e.overlay.setSelection(r,`LAYOUT · ${t.hit.layoutFile}`),e.lastSelectionRect=r,wn("rightPanel");return}case"hover":{if(e.stylebook){let o=t.hit?Xo(e.stylebook.pathToTag,t.hit.path):null,r=u.stylebook.selection;if(t.hit&&o&&o!==r)e.overlay.setHover(O(t.hit.rect));else e.overlay.setHover(null);return}e.lastHover=t.hit,Xa(e,t.hit);return}case"insertZones":{if(e.stylebook)return;let o=t.zones?.[0]??null;if(o)Wa(e,o);else Mr(e);return}case"geometry":{let o=e.pendingMeasures.get(t.reqId);if(o){e.pendingMeasures.delete(t.reqId),o(t.hits);return}if(t.reqId===e.presenceReqId){e.presenceReqId=-1;let r=[];for(let i of t.hits){let a=e.presenceMeta.get(JSON.stringify(i.path));if(a)r.push({...a,placement:O(i.rect)})}e.overlay.setPresence(r);return}if(t.reqId===e.panReqId){e.panReqId=-1;let[r]=t.hits;if(r){let{rect:i,scale:a}=tc(e);No({height:r.rect.height*a,top:r.rect.y*a+i.top})}return}if(t.reqId===e.selReqId){let r=JSON.stringify(e.selectionPath),i=[],a=null;if(e.stylebook){let[s]=t.hits;a=s?O(s.rect):null}else for(let s of t.hits){let c=JSON.stringify(s.path);if(c===r)a=O(s.rect);else if(e.coSelectionKeys.has(c))i.push(O(s.rect))}let l=e.stylebook?u.stylebook.selection:null;e.overlay.setSelection(a,l?`<${l}>`:null),e.overlay.setCoSelection(i),e.lastSelectionRect=a,e.hiddenPaths=new Set((t.hidden??[]).map((s)=>JSON.stringify(s)))}return}case"evalResult":{let o=q.get(t.reqId);if(!o)return;q.delete(t.reqId),ie.delete(t.reqId),o(t.gen===e.lastRenderedGen?t.results:null);return}case"renderComplete":{if(e.pendingTabIds.has(t.gen))e.tabId=e.pendingTabIds.get(t.gen)??null;for(let o of e.pendingTabIds.keys())if(o<=t.gen)e.pendingTabIds.delete(o);ar(e,t.gen);return}case"patchComplete":{e.pendingPatches=Math.max(0,e.pendingPatches-1),ar(e,t.gen);return}case"idle":{e.idle={animations:t.animations,fonts:t.fonts,gen:t.gen,images:t.images};return}case"renderError":{e.pendingTabIds.delete(t.gen);let o=E(e);if(o)o.session.canvas.refreshing=!1,wn("leftPanel");w.error("The page could not be rendered.",{detail:t.message,key:`canvas.render:${dr(e)}`,source:"Canvas"});return}case"dataScope":{if(t.gen!==e.lastRenderedGen)return;let o=E(e);if(o)o.session.canvas.scope=t.scope,o.session.canvas.refreshing=!1;wn("leftPanel");return}case"contentHeight":{e.contentHeight=t.height,e.contentFragment=t.fragment,mr(e);return}case"dragOver":{if(t.dragSeq!==ee)return;if(t.cursor)lr=t.dragSeq,cr=Date.now();if(t.gen!==e.lastRenderedGen)return;if(t.preview)e.overlay.setDropIndicator(O(t.preview.referenceRect),t.preview.edge);else e.overlay.setDropIndicator(null);if(t.cursor){let o=tc(e);RC(t.cursor.x*o.scale+o.rect.left,t.cursor.y*o.scale+o.rect.top)}return}case"nativeDragEnter":{if(e.stylebook)return;gr?.(e);return}case"dragEnd":{e.overlay.setDropIndicator(null),ch(),ve.delete(t.dragSeq);return}case"dropResult":{if(t.dragSeq!==ee||t.gen!==e.lastRenderedGen)return;if(t.instruction&&t.targetPath){let o=ve.get(t.dragSeq);if(o)Jb(E(e),{type:t.instruction},o,t.targetPath)}ve.delete(t.dragSeq),e.overlay.setDropIndicator(null),ch();return}case"fileDragOver":{if(e.stylebook)return;Ma(e,t.hit,t.preview);return}case"fileDragLeave":{Yo(e);return}case"fileDrop":{if(Yo(e),e.stylebook)return;Zt?.(E(e),t.files,t.hit,t.preview);return}case"patchError":{e.pendingPatches=Math.max(0,e.pendingPatches-1);let o=W(e.canvasEl)?.surface;if(o)br?.(o.paneId);return}case"forwardKey":{Ya(t.event);return}case"forwardWheel":{Za(e,t);return}case"editStart":{if(N&&N!==e)N.editing=!1,N.editingProp=null,N.snapshot=null;if(N=e,t.prop!==void 0&&zt===Wc(t.path))he(e,t.path,void 0,t.prop);zt=null,Oa+=1,e.editing=!0,e.editingProp=t.prop??null,e.snapshot=null,e.lastSnapshotSeq=0,Ze?.();return}case"selectionChanged":{if(t.seq<=e.lastSnapshotSeq)return;if(e.lastSnapshotSeq=t.seq,e.snapshot=t,!e.editing)e.editing=!0,N=e;Ze?.();return}case"flushComplete":{let o=se.get(t.reqId);if(o)se.delete(t.reqId),xe.delete(t.reqId),o();return}case"editInput":{let o=E(e);if(o)o.doc.dirty=!0;return}case"editCommit":{let o=()=>Un(E(e),t.path,t.children,t.textContent);if(t.inPlace)er(e,[t.path],o);else o();return}case"editCommitProp":{let o=()=>Zn(E(e),t.path,t.prop,t.value);if(t.inPlace){er(e,[t.path],o),Bt=Wc(t.path);return}let r=o();if(Aa(r,Bt,Wc(t.path)))$a(e,t.path);Bt=null,zt=r?Wc(t.path):null;return}case"editMerge":{let o=Yn(E(e),t.fromPath,t.intoPath);if(o)he(e,o.path,o.offset);return}case"editRangeReplace":{let o=no(E(e),t.from,t.to,t.between,t.text);if(o)he(e,o.path,o.offset);return}case"editSplit":{he(e,Qn(E(e),t.path,t.before,t.after));return}case"editInsert":{he(e,eo(E(e),t.path,t.cmd,t.commitData));return}case"slashShow":{let{rect:o,scale:r}=tc(e),i=t.rect.x*r+o.left,a=t.rect.y*r+o.top,l={filter:t.filter,onDismiss:()=>e.channel.post({kind:"slashDismissed"}),onSelect:(s)=>e.channel.post({cmd:{...s},kind:"slashSelect"}),rect:{bottom:a+t.rect.height*r,height:t.rect.height*r,left:i,top:a,width:t.rect.width*r}};if(t.showFilter===!0)l.showFilter=!0;Ue?.show(l);return}case"slashNav":{Ue?.nav(t.key);return}case"slashDismiss":{Ue?.dismiss();return}case"previewNavigate":{va(t.href,e);return}case"contextMenu":{if(e.stylebook)return;ze(e);let{rect:o,scale:r}=tc(e);Ge?.show({clientX:t.x*r+o.left,clientY:t.y*r+o.top,path:t.path?[...t.path]:null});return}case"editEnd":{if(!e.editing)return;if(e.editing=!1,e.editingProp=null,e.snapshot=null,N===e)N=null;Ze?.();break}default:break}}function ar(e,t){if(e.lastRenderedGen=t,nt(e,e.selectionPaths),Pr(e),Tr(e),ns(e),e.pendingEnterEdit&&t>=e.pendingEnterEdit.minGen){let{offset:o,path:r,prop:i}=e.pendingEnterEdit;if(e.pendingEnterEdit=null,e.tabId!==null&&e.tabId===ue(e.canvasEl)?.id)Ga(e,r,o,i)}}function he(e,t,o,r){let i={minGen:e.lastRenderedGen,path:[...t]};if(o!==void 0)i.offset=o;if(r!==void 0)i.prop=r;e.pendingEnterEdit=i}function Ga(e,t,o,r){let i={kind:"enterEdit",path:[...t]};if(o!==void 0)i.offset=o;if(r!==void 0)i.prop=r;e.channel.post(i)}function Za(e,t){let{rect:o,scale:r}=tc(e),i=nd(e.canvasEl)?.wrap;if(!i)return;i.dispatchEvent(new WheelEvent("wheel",{bubbles:!0,cancelable:!0,clientX:o.left+t.x*r,clientY:o.top+t.y*r,ctrlKey:t.ctrlKey,deltaX:t.deltaX,deltaY:t.deltaY,metaKey:t.metaKey,shiftKey:t.shiftKey}))}function Ya(e){document.dispatchEvent(new KeyboardEvent("keydown",{altKey:e.altKey,bubbles:!0,cancelable:!0,code:e.code,ctrlKey:e.ctrlKey,key:e.key,metaKey:e.metaKey,shiftKey:e.shiftKey}))}function Xa(e,t){if(!t||Cr(t.path,e.selectionPath)){e.overlay.setHover(null);return}e.overlay.setHover(O(t.rect))}var Qa=4,X=new Map;function es(e){let t=X.get(e);if(t)return X.delete(e),X.set(e,t),t;let o=new Map;X.set(e,o);for(let r of X.keys()){if(X.size<=Qa)break;X.delete(r)}return o}function ts(e,t,o,r,i,a=null){let l=es(e),s=r?.id??null,c=l.get(t);if(c&&c.tabId===o&&c.viewTabId===s&&c.mode===a)return c.payload;let d=ya(i),f=xC(Ln,async()=>{Uo.renderPreparations+=1;let g=await Dn(t,r,a),y=j(g.renderDoc),b=j(t),T=o?m.tabs.get(o)??null:null,k=Wi(T?.doc.sourceFormat)?.studio?.elements,I=k?zo(k):void 0,J={assets:g.assets,doc:y,docBase:g.docBase??`${fh()}/`,mapperCtx:g.mapperCtx,mode:g.mapperCtx.canvasMode,shadowDoc:b,siteStyle:g.siteStyle};if(I)J.editableTags=I;if(d)J.allowAutoRequests=!0;return J});return l.set(t,{mode:a,payload:f,tabId:o,viewTabId:s}),f}async function k$(e,t,o,r,i=null,a=ue(o),l=null,s=null){let c=Yt(o);c.pendingTabIds.set(e,i),c.stylebook=null,c.iframe.style.width=r?`${r}px`:"100%";let f={...await ts(e,t,i,a,ct(o),l),colorScheme:Rr(a),gen:e,kind:"render",locale:Ar(a),popoverOpen:a?.session.ui.openPopover??null,dialogOpen:a?.session.ui.openDialog??null};if(s)f.diffMarks=s;c.popoverOpen=f.popoverOpen??null,c.dialogOpen=f.dialogOpen??null,Gt(c,f.mode==="preview"),Nr(c,f)}function Nr(e,t){if(Uo.hostRenderPosts+=1,e.ready){tt(e),e.channel.post(t);return}let o=e.pending;if(o?.kind==="render"&&o.gen>t.gen){e.pendingTabIds.delete(t.gen);return}e.pending=t}function E$(e,t,o,r){let i=Yt(o);i.pendingTabIds.set(e,null),i.stylebook={pathToTag:t.pathToTag,tagToCardPath:t.tagToCardPath},Gt(i,!1),i.pendingEnterEdit=null,i.iframe.style.width=r?`${r}px`:"100%";let a=j(t.doc),l=j(t.doc),s={assets:null,colorScheme:Rr(ue(o)),locale:Ar(ue(o)),doc:a,docBase:`${fh()}/`,gen:e,kind:"render",mapperCtx:{arrayPaths:[],canvasMode:"stylebook",layoutWrapped:!1,pageContentOffset:null,pageContentPrefix:null},mode:"stylebook",shadowDoc:l,siteStyle:null};Nr(i,s)}function Rr(e){let t=e?.session.ui.previewColorScheme;return t==="light"||t==="dark"?t:null}function T$(e,t){for(let o of x){if(!o.iframe.isConnected){x.delete(o);continue}if(t&&!t.contains(o.iframe))continue;if(o.ready)o.channel.post({kind:"setColorScheme",scheme:e})}}function Or(e){return e===null?null:{dir:fv(e),locale:e}}function Ar(e){return Or(e?Hp(e.session.ui.previewLocale,e.documentPath):null)}function L$(e,t){let o=fv(e);for(let r of x){if(!r.iframe.isConnected){x.delete(r);continue}if(t&&!t.contains(r.iframe))continue;if(r.ready)r.channel.post({dir:o,kind:"setLocale",locale:e});else if(r.pending?.kind==="render")r.pending={...r.pending,locale:Or(e)}}}function $$(e,t){let o=j(e),r=0;for(let i of x){if(!i.iframe.isConnected){x.delete(i);continue}if(i.ready)i.channel.post({base:t,doc:o,kind:"redefineElement"}),r+=1}return r}function I$(){let e=C?.projectConfig;if(!e)return;let t=j(e.style??null),o=j(e.$media??{});for(let r of x){if(!r.iframe.isConnected){x.delete(r);continue}if(r.ready&&!r.stylebook)r.channel.post({kind:"siteStyleUpdate",media:o,siteStyle:t})}}function vx(e){let t=0,o=j(e);for(let r of x){if(!r.iframe.isConnected){x.delete(r);continue}if(r.ready&&r.stylebook)r.channel.post({gen:r.lastRenderedGen,kind:"styleUpdate",style:o}),t+=1,nt(r,r.selectionPaths)}return t}var Ye=null;function $r(e,t){if(!e?.stylebook||!e.ready)return!1;let o=e.stylebook.tagToCardPath.get(t);if(!o)return!1;return e.measureSeq+=1,e.panReqId=e.measureSeq,e.channel.post({kind:"measure",paths:[[...o]],reqId:e.panReqId}),!0}function R$(e){Ye=$r(Qt(),e)?null:e}function ns(e){let t=Ye;if(t===null||!e.stylebook)return;if(u.stylebook.selection!==t){Ye=null;return}if(e===Qt()&&$r(e,t))Ye=null}function nc(){let e=N;if(!e||!e.iframe.isConnected)return{editing:!1,editingProp:null,snapshot:null};return{editing:e.editing,editingProp:e.editingProp,snapshot:e.snapshot}}var Xt=null;function D$(e,t){Xt=e,t?.(()=>sr()),sr()}function sr(){let e=Xt?.();if(!e)return;for(let t of x){if(!t.iframe.isConnected){x.delete(t);continue}if(t.ready)t.channel.post({chords:e.chords,kind:"keymap",mac:e.mac})}}function dh(e){let t=N;if(!t||!t.ready)return;t.channel.post({intent:e,kind:"applyFormat"})}function N$(){let e=N;if(!e||!e.ready)return;e.channel.post({kind:"openSlash"})}function yx(){let e=N;if(e?.editing&&e.ready&&e.iframe.isConnected)e.channel.post({kind:"endEdit"})}function Qt(){let e=ao();return e?DC(e.canvas):null}function OC(){let e=N,t=e??Qt();if(!t)return null;let{rect:o,scale:r}=tc(t);if(t.lastSelectionRect)return{height:t.lastSelectionRect.height*r,left:t.lastSelectionRect.left*r+o.left,top:t.lastSelectionRect.top*r+o.top,width:t.lastSelectionRect.width*r};let i=t===e?t.snapshot?.rect:null;if(i)return{height:i.height*r,left:i.x*r+o.left,top:i.y*r+o.top,width:i.width*r};return null}
2
+ export{vr,bt,jr,uC,ka,Vo,dl,DA,Vb,yr,nh,Bc,ih,hC,NA,pC,AA,OA,fC,MA,mC,oh,Ub,qb,hi,Om,UL,ax,PA,Ql,ec,rh,FA,gC,qL,zc,sh,jA,Gb,Ap,bC,vC,HA,yC,GL,BA,zA,Uo,lx,wC,xC,ji,ah,KL,Kb,JL,WA,VA,Op,_C,UA,qA,Wc,SC,Mm,GA,cx,KA,dx,JA,ux,Mp,Hr,YA,Pm,ZA,XA,CC,QA,kC,eO,EC,YL,ZL,TC,Fm,Pp,tO,nO,hx,Gs,lh,Fp,iO,oO,LC,XL,jm,$C,rO,IC,QL,sO,e$,t$,n$,aO,px,i$,RC,ch,ul,fx,jp,mx,lO,cO,dO,Jb,o$,r$,s$,a$,DC,Yb,Zb,NC,tc,l$,c$,d$,Xb,QP,yF,u$,Vc,gx,bx,h$,p$,f$,m$,g$,b$,v$,y$,w$,x$,_$,S$,AC,C$,Qb,k$,E$,T$,L$,$$,I$,vx,R$,nc,D$,dh,N$,yx,OC};
3
+
4
+ //# debugId=87CF49A9BEEC7AB864756E2164756E21
5
+ //# sourceMappingURL=studio-53wy9ek3.js.map
@@ -0,0 +1,5 @@
1
+ import{p}from"./studio-4fnb5648.js";import{jt,Aa,wl}from"./studio-aam8zt8z.js";import{Tn,nt,Xs}from"./studio-tpxcryf2.js";import{ae}from"./studio-wqfaqw4m.js";import{h}from"./studio-yrcrncev.js";import{Nw,AN,$b,_i}from"./studio-wse1rs8t.js";import{kh,kr,C}from"./studio-4f7thq0p.js";import{E,R}from"./studio-9dq7rwc7.js";import{g}from"./studio-3qr08sxq.js";import{n,wf}from"./studio-k3we3kqb.js";var I={$schema:"https://jxsuite.com/schema/v1",$id:"StudioPalette",$description:'The command palette: a `role="combobox"` field over the kit\'s `jx-listbox`, whose rows are `jx-option`s the host projects. `rows` is the ranked set for the current mode and query; `activeId` is the highlight, and it is ONE string — the id the field points `aria-activedescendant` at and the id the listbox is handed as `active`, so a key moves the caret without the rows reconciling and no row re-decides its own flag. The FIELD is not a `jx-combobox`: this one carries a mode chip inside its box, its Enter runs a command rather than committing a value, and its panel is a centred scrim rather than a popover under a control. Every gesture calls back into panels/quick-search.ts, which owns the modes, the ranking, the recents and what a row does.',tagName:"div",attributes:{part:"palette"},style:{display:"contents",'& [part="overlay"]':{position:"fixed",inset:"0",zIndex:"1000",display:"flex",justifyContent:"center",paddingTop:"60px",background:"rgba(0, 0, 0, 0.4)"},'& [part="overlay"][hidden]':{display:"none"},'& [part="panel"]':{width:"560px",maxWidth:"calc(100vw - 32px)",maxHeight:"420px",display:"flex",flexDirection:"column",alignSelf:"flex-start",background:"var(--jx-bg-overlay)",border:"1px solid var(--jx-border)",borderRadius:"var(--jx-radius-md)",boxShadow:"var(--jx-shadow-dialog)",color:"var(--jx-fg)",fontFamily:"var(--jx-font-sans)",overflow:"hidden"},'& [part="input-row"]':{display:"flex",alignItems:"center",gap:"var(--jx-space-3)",paddingLeft:"var(--jx-space-4)",background:"var(--jx-bg-input)",borderBottom:"1px solid var(--jx-border)"},'& [part="chip-slot"], & [part="empty-slot"], & [part="section-slot"], & [part="trailing-slot"]':{display:"contents"},'& [part="chip"]':{display:"inline-flex",alignItems:"center",gap:"var(--jx-space-1)",flexShrink:"0",padding:"2px var(--jx-space-1) 2px var(--jx-space-3)",borderRadius:"var(--jx-radius-sm)",background:"var(--jx-accent-solid)",color:"var(--jx-accent-fg)",fontSize:"var(--jx-text-sm)"},'& [part="chip-remove"] > [part="control"]':{color:"inherit",opacity:"0.8",":hover":{opacity:"1",background:"transparent"}},'& [part="input"]':{flex:"1",minWidth:"0",padding:"var(--jx-space-4) var(--jx-space-5) var(--jx-space-4) var(--jx-space-1)",font:"inherit",fontSize:"var(--jx-text-lg)",border:"none",outline:"none",background:"none",color:"var(--jx-fg)","::placeholder":{color:"var(--jx-fg-muted)"},":focus-visible":{outline:"var(--jx-focus-ring)",outlineOffset:"-2px"}},'& [part="results"]':{$description:"The list is the kit's: a `jx-listbox` of `jx-option`, so the highlight is ONE id — `active`, the same string the field points `aria-activedescendant` at — and the listbox's sidecar is the single writer of every row's `selected`. What this surface still decides is density. The kit's row pads itself by `--jx-space-3`; the other half of the 16px optical margin the panel has always had sits here, on the list, so the heading, the rows and the empty sentence line up on one edge instead of each naming it.",flex:"1",paddingInline:"var(--jx-space-3)"},'& [part="option"] [part="label"]':{fontWeight:"500"},'& [part="option"] [part="description"]':{$description:"A `jx-select` row's note is a category at the END of the row, so the kit pushes it there with an auto margin. A palette row's note is a CONTINUATION of its name — the file's directory, the command's category — and the far edge belongs to the chord, which is how this surface teaches the keyboard it replaced. So the auto margin moves to the end slot.",marginInlineStart:"0"},'& [part="option"] [part="end"]':{marginInlineStart:"auto"},'& [part="option"][aria-disabled="true"]':{$description:"An unavailable command is greyed with its `requires` sentence as the subtitle, and that sentence is the reason the row is on screen at all. The kit fades the whole row to 0.45, which would take a muted grey below any readable contrast — so the row keeps its ink and only the name and the glyph dim.",opacity:"1"},'& [part="option"][aria-disabled="true"] [part="label"], & [part="option"][aria-disabled="true"] [part="icon"]':{opacity:"0.45"},'& [part="chord"]':{flexShrink:"0",fontFamily:"inherit",fontSize:"var(--jx-text-xs)",color:"var(--jx-fg-muted)",border:"1px solid var(--jx-border)",borderRadius:"var(--jx-radius-sm)",padding:"0 5px"},'& [part="option"][aria-selected="true"] [part="chord"]':{color:"inherit",borderColor:"currentColor"},'& [part="badge"]':{fontSize:"var(--jx-text-xs)",padding:"1px var(--jx-space-2)",borderRadius:"var(--jx-radius-sm)",background:"var(--jx-border)",color:"var(--jx-fg-dim)"},'& [part="hint"]':{padding:"var(--jx-space-2) var(--jx-space-5)",borderTop:"1px solid var(--jx-border)",color:"var(--jx-fg-muted)",fontSize:"var(--jx-text-xs)"},'& [part="hint"] kbd':{fontFamily:"inherit",color:"var(--jx-fg-dim)"}},children:[{tagName:"div",attributes:{part:"overlay",hidden:"${state.open ? null : ''}"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/close"},value:[]}]},children:[{tagName:"div",attributes:{part:"panel"},onclick:{$prototype:"Function",body:[{stopPropagation:!0}]},children:[{tagName:"div",attributes:{part:"input-row"},children:[{tagName:"span",attributes:{part:"chip-slot",role:"none"},$switch:{$ref:"#/state/hasChip"},cases:{true:{tagName:"span",attributes:{part:"chip"},children:[{tagName:"span",attributes:{part:"chip-label"},textContent:"${state.chipLabel}"},{tagName:"jx-action-button",$props:{label:"Clear mode",hint:"Clear mode (Backspace)",icon:"x",size:"sm"},attributes:{part:"chip-remove"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/clearMode"},value:[]}]}}]}}},{tagName:"input",attributes:{part:"input",type:"text",role:"combobox","aria-controls":"quick-search-listbox","aria-expanded":"${state.expanded ? 'true' : 'false'}","aria-activedescendant":"${state.activeId || null}","aria-autocomplete":"list","aria-label":"${state.placeholder}",placeholder:"${state.placeholder}"},value:{$ref:"#/state/query"},oninput:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/input"},value:[{$ref:"event#/target/value"}]}]},onkeydown:{$prototype:"Function",body:[{$switch:{$ref:"event#/key"},cases:{ArrowDown:[{preventDefault:!0},{operator:"call",target:{$ref:"#/state/move"},value:[1]}],ArrowUp:[{preventDefault:!0},{operator:"call",target:{$ref:"#/state/move"},value:[-1]}],Enter:[{preventDefault:!0},{operator:"call",target:{$ref:"#/state/activate"},value:[]}],Escape:[{preventDefault:!0},{operator:"call",target:{$ref:"#/state/close"},value:[]}],Backspace:[{$switch:{$ref:"#/state/canClearMode"},cases:{true:[{preventDefault:!0},{operator:"call",target:{$ref:"#/state/clearMode"},value:[]}]}}]}}]}}]},{tagName:"jx-listbox",attributes:{part:"results",id:"quick-search-listbox"},$props:{label:"Results",active:"${state.activeId}"},onselect:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/activateRow"},value:[{$ref:"event#/detail"}]}],description:"One handler for every row, because a row's `select` bubbles. The detail is the row's `value`, which is the index it occupies in `rows` — the same number a hover names, and the number the id is built from."},children:[{tagName:"div",attributes:{part:"empty-slot",role:"none"},$switch:{$ref:"#/state/isEmpty"},cases:{true:{tagName:"div",attributes:{part:"empty"},textContent:"${state.emptyHint}"}}},{tagName:"div",attributes:{part:"section-slot",role:"none"},$switch:{$ref:"#/state/showSection"},cases:{true:{tagName:"div",attributes:{part:"group-heading"},textContent:"${state.sectionLabel}"}}},{$prototype:"Array",items:{$ref:"#/state/rows"},key:{$ref:"$map/item/key"},map:{tagName:"jx-option",attributes:{part:"option",id:"quick-search-option-${$map.index}","data-kind":"${$map.item.kind}"},$props:{value:"${$map.index}",label:{$ref:"$map/item/name"},description:{$ref:"$map/item/detail"},disabled:{$ref:"$map/item/disabled"}},onmouseenter:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/hover"},value:[{$ref:"$map/index"}]}]},children:[{tagName:"jx-icon",attributes:{slot:"icon"},$props:{name:{$ref:"$map/item/icon"}}},{tagName:"span",attributes:{slot:"end",part:"trailing-slot"},$switch:{$ref:"$map/item/trailing"},cases:{chord:{tagName:"kbd",attributes:{part:"chord"},textContent:"${$map.item.chord}"},recent:{tagName:"span",attributes:{part:"badge"},textContent:"recent"}}}]}}]},{tagName:"div",attributes:{part:"hint"},children:[{tagName:"kbd",textContent:"↑↓"}," move · ",{tagName:"kbd",textContent:"↵"}," run · ",{tagName:"kbd",textContent:"?"}," modes · ",{tagName:"kbd",textContent:">"}," commands · ",{tagName:"kbd",textContent:"@"}," elements"]}]}]}]};var S=[{mode:"files",prefix:"",chip:"Files",placeholder:"Go to a file…",description:"Open a file by any part of its path — pgblog finds pages/blog/index.md."},{mode:"commands",prefix:">",chip:"Commands",placeholder:"Run a command…",description:"Run anything Studio can do, with its keyboard shortcut printed beside it."},{mode:"nodes",prefix:"@",chip:"Symbols",placeholder:"Go to an element in this document…",description:"Select an element in the open document by its Outline name."},{mode:"projects",prefix:"",chip:"Recent Projects",placeholder:"Open a recent project…",description:"Reopen a project you have had open before."},{mode:"picker",prefix:"?",chip:"Modes",placeholder:"Type ? for modes, > for commands, @ for elements…",description:"List these modes."}],X=new Map(S.map((e)=>[e.mode,e])),O=S.filter((e)=>e.prefix!=="");function _(e){return X.get(e)??S[0]}function L(e,t,o){let a=O.find((s)=>t.startsWith(s.prefix));if(a)return L(a.mode,t.slice(1),o);let i=e;if(i==="picker"&&t.trim()!=="")i="files";if(i==="files"&&!o)i="projects";return{mode:i,query:t}}var Y=new Set(["/","-","_","."," "]);function Z(e,t){if(t==="")return 0;let o=e.toLowerCase(),a=t.toLowerCase(),i=o.lastIndexOf("/")+1,s=0,r=0,v=-2;for(let K of a){let u=o.indexOf(K,r);if(u===-1)return null;if(u===v+1)s+=8;if(u===0||Y.has(o[u-1]??""))s+=6;if(u>=i)s+=4;v=u,r=u+1}return s-v*0.01-o.length*0.001}function w(e,t,o){let a=[];for(let[i,s]of e.entries()){let r=Z(o(s),t);if(r!==null)a.push({index:i,item:s,score:r})}return a.toSorted((i,s)=>s.score-i.score||i.index-s.index).map((i)=>i.item)}function q(e){let t=e.args,o=t?.properties;if(!t||!o)return{kind:"none"};let a=Object.keys(o);if(a.length!==1)return{kind:"unsupported"};let i=a[0],s=o[i];if(s.enum)return{kind:"choice",name:i,choices:s.enum.map((r)=>({label:String(r),value:r}))};if(s.type==="boolean")return{kind:"choice",name:i,choices:[{label:"on",value:!0},{label:"off",value:!1}]};return{kind:"unsupported"}}function N(e){return`quick-search-option-${e}`}var D="jx-studio-recent-commands",ee=6;function H(){try{let e=JSON.parse(localStorage.getItem(D)||"[]");return Array.isArray(e)?e.filter((t)=>n(t)):[]}catch{return[]}}function te(e){let t=[e,...H().filter((o)=>o!==e)].slice(0,ee);try{localStorage.setItem(D,JSON.stringify(t))}catch{}}var z=null,x=!1,b="picker",l="",d=0,y=null,j=!1,c=null;function B(){return Xs("popover","quick-search")}function jE(e){z=e??null}function mb(e="files"){x=!0,b=e,l="",d=0,c=null,y=null,m(),ye(),M()}function k(){x=!1,c=null,m()}function Q(){return C?C.projectRoot:null}function W(){return C!=null}function J(){return L(b,l,W())}function U(e){let t=e.split("/");return t.pop(),t.length>0?t.join("/"):""}function ne(e){if(e.startsWith("/home/"))return`~/${e.split("/").slice(3).join("/")}`;return e}async function M(){if(!x||y!==null||j||!W())return;j=!0,m();try{await jt(),y=(await p().searchFiles("",wl())).map((t)=>({kind:"file",path:t.path,name:t.name??t.path.split("/").pop()??"",detail:U(t.path),recent:!1}))}catch{y=[]}j=!1,m()}function oe(e){if(e.trim()==="")return AN(Q()??void 0).map((t)=>({kind:"file",path:t.path,name:t.name,detail:U(t.path),recent:!0}));return w(y??[],e.trim(),(t)=>t.path)}function re(e){let t=Nw().map((o)=>({kind:"project",root:o.root,name:o.name,detail:ne(o.root)}));return w(t,e.trim(),(o)=>`${o.name}/${o.root}`)}function ie(e,t){let o=H(),a=[];for(let r of e.visible()){if(q(r).kind==="unsupported")continue;if(!(r.menus??["palette"]).includes("palette"))continue;a.push({kind:"command",id:r.id,name:`${r.category}: ${r.title}`,detail:e.disabledReason(r.id)??"",chord:e.keymap.formatBinding(r.id)??"",enabled:e.isEnabled(r.id),recent:o.includes(r.id)})}let i=w(a,t.trim(),(r)=>r.name);if(t.trim()!=="")return i;let s=o.map((r)=>i.find((v)=>v.id===r)).filter((r)=>r!==void 0);return[...s,...i.filter((r)=>!s.includes(r))]}function se(e){let t=h.value;if(!t)return[];let o=kh(t.doc.document).map((a)=>({kind:"node",path:a.path,name:wf(a.node)?String(a.node).slice(0,60):kr(a.node),detail:a.nodeType}));return w(o,e.trim(),(a)=>a.name)}function ce(){return S.flatMap((e)=>e.mode==="picker"?[]:[{kind:"mode",mode:e.mode,name:e.chip,detail:e.description,chord:e.prefix}])}function de(e){let t=c,o=t.choices.map((a)=>({kind:"arg",commandId:t.command.id,argName:t.name,value:a.value,name:a.label,detail:`${t.command.title} → ${t.name}`}));return w(o,e.trim(),(a)=>a.name)}function le(){let{mode:e,query:t}=J();if(c)return{rows:de(t),showingRecent:!1};switch(e){case"commands":{let o=ae();return{rows:o?ie(o,t):[],showingRecent:t.trim()===""}}case"nodes":return{rows:se(t),showingRecent:!1};case"projects":return{rows:re(t),showingRecent:t.trim()===""};case"picker":return{rows:ce(),showingRecent:!1};default:return{rows:oe(t),showingRecent:t.trim()===""}}}function pe(e){let t=O.find((o)=>e.startsWith(o.prefix));if(t)b=t.mode,l=e.slice(1);else l=e;if(d=0,e!==l)P().query=e;m(),M()}function me(){b="picker",c=null,d=0,m()}function ue(e){b=e,l="",d=0,m(),M()}function G(e,t){let o=ae();if(!o)return;te(e.id),k(),Tn(o,e.id,t,"Palette")}function A(e){switch(e.kind){case"project":{k(),z?.openRecentProject(e.root);return}case"file":{k(),$b({name:e.name,path:e.path,root:Q()??""}),_i(e.path);return}case"mode":{ue(e.mode);return}case"node":{k(),nt("selection.set",{path:e.path},"Palette");return}case"arg":{G(c.command,{[e.argName]:e.value});return}default:he(e)}}function he(e){let t=ae(),o=t?.get(e.id);if(!t||!o||!e.enabled)return;let a=q(o);if(a.kind==="choice"){c={choices:a.choices,command:o,name:a.name},l="",d=0,m();return}G(o)}function fe(e){let t=e.split(".").pop()?.toLowerCase();if(t==="json")return"file-code";if(t&&Aa(t))return"file-text";return"file"}function ge(e){switch(e.kind){case"project":return"folder-open";case"file":return fe(e.name);case"command":return"play";case"node":return"stack";default:return"caret-right"}}function xe(e,t){if((e.kind==="command"||e.kind==="mode")&&e.chord)return"chord";if(e.kind==="command"&&e.recent)return"recent";return t?"recent":"none"}function be(e){switch(e.kind){case"project":return`project:${e.root}`;case"file":return`file:${e.path}`;case"command":return`command:${e.id}`;case"node":return`node:${e.path.join("/")}`;case"mode":return`mode:${e.mode}`;default:return`arg:${e.value}`}}function ve(e,t){if(j)return"Reading the project's files…";if(t.trim()!=="")return"No results";switch(e){case"projects":return"No recent projects — open one to get started";case"nodes":return"Open a document to jump to its elements";case"commands":return"Type to find any command in Studio";default:return _(e).placeholder}}E("palette",I);var T=null,F=null,f=[];function P(){return T??=g({activate:()=>{let e=f[d];if(e)A(e)},activateRow:(e)=>{let t=f[Number(e)];if(t)A(t)},activeId:"",canClearMode:!1,chipLabel:"",clearMode:me,close:k,emptyHint:"",expanded:!1,hasChip:!1,hover:(e)=>{d=e,P().activeId=N(e)},input:pe,isEmpty:!0,move:(e)=>{if(f.length===0)return;d=Math.max(0,Math.min(d+e,f.length-1)),P().activeId=N(d)},open:!1,placeholder:"",query:"",rows:[],sectionLabel:"",showSection:!1}),T}function ye(){setTimeout(()=>{if(x)B().querySelector('[part="input"]')?.focus()},0)}function m(){let e=P();if(!F)F=R("palette",e,B());if(e.open=x,!x){f=[];return}let{mode:t,query:o}=J(),{rows:a,showingRecent:i}=le(),s=_(t);f=a,e.placeholder=c?`Choose a ${c.name}…`:s.placeholder,e.hasChip=c!==null||t!=="picker",e.chipLabel=c?c.command.title:s.chip,e.query=l,e.canClearMode=l===""&&(c!==null||b!=="picker"),e.rows=a.map((r)=>({chord:(r.kind==="command"||r.kind==="mode")&&r.chord?r.chord:"",detail:r.detail,disabled:r.kind==="command"&&!r.enabled,icon:ge(r),key:be(r),kind:r.kind,name:r.name,trailing:xe(r,i)})),e.expanded=a.length>0,e.activeId=a.length>0?N(d):"",e.isEmpty=a.length===0,e.emptyHint=ve(t,o),e.showSection=i&&a.length>0,e.sectionLabel=c?`${c.command.title} — ${c.name}`:t==="projects"?"Recent projects":t==="commands"?"Recently used":"Recently opened"}
2
+ export{jE,mb};
3
+
4
+ //# debugId=F78126B5DB3BC80364756E2164756E21
5
+ //# sourceMappingURL=studio-5n193zqd.js.map