@jxsuite/studio 8.1.0 → 9.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (247) hide show
  1. package/dist/chunks/{2020-dg097k3e.js → 2020-89fz3pfy.js} +3 -3
  2. package/dist/chunks/adapter-ay13gema.js +4 -0
  3. package/dist/chunks/add-new-flow-nmkqpjym.js +4 -0
  4. package/dist/chunks/cf-account-picker-2e06qxey.js +4 -0
  5. package/dist/chunks/cf-settings-5y04810c.js +4 -0
  6. package/dist/chunks/color-04361ttk.js +4 -0
  7. package/dist/chunks/{color-area-vh9cew51.js → color-area-h8dbasp1.js} +2 -2
  8. package/dist/chunks/{color-field-e78f16bs.js → color-field-qv5r2b16.js} +3 -3
  9. package/dist/chunks/{color-slider-fg4yhvk6.js → color-slider-nz2mrzky.js} +2 -2
  10. package/dist/chunks/components-3vf75n83.js +4 -0
  11. package/dist/chunks/content-source-4f2raf4a.js +4 -0
  12. package/dist/chunks/{convert-to-repeater-grnmea6c.js → convert-to-repeater-j9hfcj4f.js} +3 -3
  13. package/dist/chunks/editor-645krvtz.js +4 -0
  14. package/dist/chunks/entry-commands-3qmv8wkr.js +4 -0
  15. package/dist/chunks/{extension-sections-rp7fkega.js → extension-sections-thfke054.js} +3 -3
  16. package/dist/chunks/file-ops-kkhp9ma7.js +4 -0
  17. package/dist/chunks/files-yswdhxrf.js +4 -0
  18. package/dist/chunks/format-host-4g8ex6bz.js +4 -0
  19. package/dist/chunks/fs-events-z9gpvc6t.js +4 -0
  20. package/dist/chunks/grid-open-fm4j183c.js +4 -0
  21. package/dist/chunks/{grid-view-x26rfpz1.js → grid-view-7d2nx83y.js} +10 -10
  22. package/dist/chunks/{iframe-entry-pkgmcgp0.js → iframe-entry-2x9bn5ng.js} +4 -4
  23. package/dist/chunks/{iframe-entry-02wzcyvy.js → iframe-entry-btck0e9s.js} +4 -4
  24. package/dist/chunks/iframe-host-q7fedsmr.js +4 -0
  25. package/dist/chunks/{index-203h71wy.js → index-jxmt7vh8.js} +3 -3
  26. package/dist/chunks/index-pt4wh98x.js +4 -0
  27. package/dist/chunks/{javascript-ww5pv5ae.js → javascript-vmqp56ke.js} +2 -2
  28. package/dist/chunks/{jsonMode-vwbdwwq3.js → jsonMode-n3wmpant.js} +6 -6
  29. package/dist/chunks/jx-validate-19y62knt.js +4 -0
  30. package/dist/chunks/layers-panel-1qvc83y9.js +4 -0
  31. package/dist/chunks/layers-qf0bc7ze.js +4 -0
  32. package/dist/chunks/lit-html-wyqw04y2.js +4 -0
  33. package/dist/chunks/media-library-f9d5qcjb.js +4 -0
  34. package/dist/chunks/media-picker-rsb1fmk2.js +4 -0
  35. package/dist/chunks/{monaco-binding-63tqze27.js → monaco-binding-wfhmz89d.js} +3 -3
  36. package/dist/chunks/monaco-buffer-ak0raadw.js +4 -0
  37. package/dist/chunks/{monaco-setup-zyyynnj8.js → monaco-setup-fty7a8vg.js} +3 -3
  38. package/dist/chunks/notify-4qj70q0x.js +4 -0
  39. package/dist/chunks/parse-n8dfxnqf.js +4 -0
  40. package/dist/chunks/platform-ehg6t9vd.js +4 -0
  41. package/dist/chunks/publish-panel-yhmda3cd.js +4 -0
  42. package/dist/chunks/{publish-quick-ajzdhhs6.js → publish-quick-12hh8926.js} +3 -3
  43. package/dist/chunks/publish-workspace-hx8qdv9p.js +4 -0
  44. package/dist/chunks/quick-search-r955m3q1.js +4 -0
  45. package/dist/chunks/references-8gxv0x7t.js +4 -0
  46. package/dist/chunks/right-panel-jarwqjpy.js +4 -0
  47. package/dist/chunks/source-control-84qt25m9.js +4 -0
  48. package/dist/chunks/studio-0nefxhar.js +7 -0
  49. package/dist/chunks/studio-0rg30pvs.js +5 -0
  50. package/dist/chunks/{studio-3q6n9qvq.js → studio-14hh60j8.js} +4 -4
  51. package/dist/chunks/studio-1cfyd1ys.js +5 -0
  52. package/dist/chunks/studio-2bq7hheq.js +5 -0
  53. package/dist/chunks/{studio-mmqr9awv.js → studio-32d8wyxq.js} +33 -33
  54. package/dist/chunks/studio-3hpcawh8.js +4 -0
  55. package/dist/chunks/{studio-zm7dnr9g.js → studio-4j35hgsw.js} +4 -4
  56. package/dist/chunks/{studio-bqgs90r8.js → studio-4qg61g9j.js} +4 -4
  57. package/dist/chunks/studio-4rgem12q.js +5 -0
  58. package/dist/chunks/studio-6k9djnxw.js +5 -0
  59. package/dist/chunks/studio-6rbaedw2.js +9 -0
  60. package/dist/chunks/studio-732mw0g8.js +5 -0
  61. package/dist/chunks/studio-79r8msnr.js +7 -0
  62. package/dist/chunks/studio-7q6jdd4h.js +5 -0
  63. package/dist/chunks/{studio-jqrg9xxg.js → studio-881z1xrx.js} +4 -4
  64. package/dist/chunks/{studio-9wyqyfqy.js → studio-8hf8qcm1.js} +4 -4
  65. package/dist/chunks/{studio-6vrxzkba.js → studio-8pne0rx4.js} +4 -4
  66. package/dist/chunks/{studio-wcakp5bt.js → studio-9179bsm7.js} +7 -7
  67. package/dist/chunks/{studio-xddgbwhe.js → studio-9ff0vqff.js} +3 -3
  68. package/dist/chunks/{studio-25a5by3h.js → studio-9gzvypw4.js} +4 -4
  69. package/dist/chunks/studio-9ndgd55w.js +5 -0
  70. package/dist/chunks/studio-9ra9e7m4.js +5 -0
  71. package/dist/chunks/studio-a6e5fzve.js +5 -0
  72. package/dist/chunks/studio-a9k86nq6.js +5 -0
  73. package/dist/chunks/studio-ae7a69jc.js +6 -0
  74. package/dist/chunks/studio-aghsg0ds.js +7 -0
  75. package/dist/chunks/{studio-2b8443ms.js → studio-ajw4k8hp.js} +3 -3
  76. package/dist/chunks/{studio-957jg8g3.js → studio-apapy17g.js} +4 -4
  77. package/dist/chunks/{studio-hnx1h1pr.js → studio-by8x0jvc.js} +4 -4
  78. package/dist/chunks/{studio-hxq1ebp0.js → studio-c88gq88j.js} +6 -6
  79. package/dist/chunks/{studio-a6x058ew.js → studio-cg54vtet.js} +4 -4
  80. package/dist/chunks/studio-dvhxxxbd.js +5 -0
  81. package/dist/chunks/{studio-1meqbxns.js → studio-e4rq6x0q.js} +4 -4
  82. package/dist/chunks/{studio-v2ek69cb.js → studio-ekzbgnjp.js} +4 -4
  83. package/dist/chunks/{studio-2dtc90zs.js → studio-fg4fj9ec.js} +6 -6
  84. package/dist/chunks/studio-fj6jzgxw.js +5 -0
  85. package/dist/chunks/{studio-txkx6586.js → studio-g45r5vm8.js} +7 -7
  86. package/dist/chunks/{studio-v0gsjav0.js → studio-gczve8zf.js} +4 -4
  87. package/dist/chunks/studio-ge08zwpv.js +5 -0
  88. package/dist/chunks/{studio-1gdfsr49.js → studio-gk9yk8dj.js} +7 -7
  89. package/dist/chunks/{studio-cpdzrdgp.js → studio-gskkgfe3.js} +4 -4
  90. package/dist/chunks/{studio-94ppxeqy.js → studio-h4jbgne2.js} +8 -8
  91. package/dist/chunks/{studio-kdseew9m.js → studio-hcy9zeac.js} +4 -4
  92. package/dist/chunks/studio-ht81xjkr.js +5 -0
  93. package/dist/chunks/{studio-73wz63nn.js → studio-jr30g4ae.js} +4 -4
  94. package/dist/chunks/{studio-fqs1a22a.js → studio-k5n4es74.js} +4 -4
  95. package/dist/chunks/{studio-j5jqvyn3.js → studio-k6hbx2fc.js} +4 -4
  96. package/dist/chunks/{studio-332hesdk.js → studio-kqh7fxn6.js} +4 -4
  97. package/dist/chunks/{studio-8nyw10dp.js → studio-kyw47pet.js} +4 -4
  98. package/dist/chunks/studio-mkw17ngg.js +5 -0
  99. package/dist/chunks/{studio-02phtmqn.js → studio-myb4mf0h.js} +4 -4
  100. package/dist/chunks/{studio-d140sy8e.js → studio-n4qq1n57.js} +4 -4
  101. package/dist/chunks/{studio-bf0rgyf7.js → studio-nfmpmkqb.js} +4 -4
  102. package/dist/chunks/studio-nfwacw31.js +5 -0
  103. package/dist/chunks/{studio-z42kysg7.js → studio-nm86874b.js} +136 -136
  104. package/dist/chunks/studio-nqexty8x.js +16 -0
  105. package/dist/chunks/studio-nr0kcqc6.js +5 -0
  106. package/dist/chunks/{studio-dmn7gpba.js → studio-nvfa137z.js} +5 -5
  107. package/dist/chunks/studio-psh8mwnw.js +4 -0
  108. package/dist/chunks/{studio-4dsdnan2.js → studio-qd0cycm4.js} +5 -5
  109. package/dist/chunks/{studio-zht0x0v3.js → studio-qevf5z9d.js} +4 -4
  110. package/dist/chunks/studio-qs5fmhtj.js +14 -0
  111. package/dist/chunks/studio-ry4789ng.js +7 -0
  112. package/dist/chunks/studio-s4fq9jht.js +5 -0
  113. package/dist/chunks/studio-sc35ttdk.js +5 -0
  114. package/dist/chunks/studio-sm2f0sc6.js +6 -0
  115. package/dist/chunks/{studio-rdnezzkd.js → studio-spza69tb.js} +5 -5
  116. package/dist/chunks/studio-t6dqnnft.js +5 -0
  117. package/dist/chunks/{studio-hw60n5dh.js → studio-tfmhnwyr.js} +3 -3
  118. package/dist/chunks/studio-tn7v8gey.js +6 -0
  119. package/dist/chunks/{studio-nsv7g1qn.js → studio-trcfer2b.js} +4 -4
  120. package/dist/chunks/studio-tyw7tk0x.js +5 -0
  121. package/dist/chunks/{studio-533py3yy.js → studio-tyzgte21.js} +4 -4
  122. package/dist/chunks/studio-vtey9w98.js +5 -0
  123. package/dist/chunks/studio-ws2r1d7e.js +5 -0
  124. package/dist/chunks/studio-x2trkhk5.js +5 -0
  125. package/dist/chunks/{studio-c5dj3dzk.js → studio-xzgp0cp7.js} +4 -4
  126. package/dist/chunks/studio-y47090vq.js +5 -0
  127. package/dist/chunks/{studio-nm9qev4p.js → studio-yjh9gddd.js} +5 -5
  128. package/dist/chunks/studio-ywf9y1e2.js +5 -0
  129. package/dist/chunks/{studio-x3ge4rts.js → studio-z1p91z5a.js} +4 -4
  130. package/dist/chunks/studio-ztppbam0.js +5 -0
  131. package/dist/chunks/{toast-host-1yg5ar8d.js → toast-host-g3r2s0kn.js} +2 -2
  132. package/dist/chunks/toast-w11qpkyz.js +4 -0
  133. package/dist/chunks/{tsMode-vra2hh7y.js → tsMode-byje4a01.js} +5 -5
  134. package/dist/chunks/workspace-7q4arnt3.js +4 -0
  135. package/dist/chunks/workspace-home-ge027kr6.js +4 -0
  136. package/dist/chunks/{ws-client-72x5n99j.js → ws-client-h09h6sqg.js} +3 -3
  137. package/dist/iframe-entry.js +13 -13
  138. package/dist/manifest.json +77 -77
  139. package/dist/studio.js +89 -89
  140. package/package.json +11 -12
  141. package/src/collab/collab-session.ts +6 -2
  142. package/src/commands/context.ts +4 -0
  143. package/src/commands/defaults.ts +2 -0
  144. package/src/commands/live-context.ts +2 -0
  145. package/src/files/files.ts +6 -3
  146. package/src/new-project/new-project-modal.ts +1 -4
  147. package/src/panels/ai-panel.ts +27 -34
  148. package/src/platform.ts +20 -0
  149. package/src/platforms/devserver.ts +2 -120
  150. package/src/services/ai-ask.ts +29 -171
  151. package/src/services/ai-command-tools.ts +40 -50
  152. package/src/services/ai-import-tools.ts +4 -5
  153. package/src/services/ai-project-tools.ts +13 -3
  154. package/src/services/ai-tools.ts +26 -564
  155. package/src/services/ai-writes.ts +84 -2
  156. package/src/services/document-assistant.ts +29 -58
  157. package/src/services/harness/assistant-tools.ts +68 -0
  158. package/src/services/harness/interaction-store.ts +118 -0
  159. package/src/services/harness/studio-documents.ts +105 -0
  160. package/src/services/harness/turn-hooks.ts +1 -6
  161. package/src/services/project-adoption.ts +8 -16
  162. package/src/services/tool-executor.ts +25 -22
  163. package/src/state.ts +3 -13
  164. package/src/surfaces/files-panel.json +12 -0
  165. package/src/surfaces/files-panel.ts +5 -2
  166. package/src/surfaces/welcome.ts +4 -1
  167. package/src/tabs/selection.ts +14 -109
  168. package/src/tabs/tab.ts +10 -1
  169. package/src/tabs/transact.ts +316 -124
  170. package/src/types.ts +13 -8
  171. package/dist/chunks/adapter-tck81zft.js +0 -4
  172. package/dist/chunks/add-new-flow-a1w0bnm6.js +0 -4
  173. package/dist/chunks/cf-account-picker-ce3kp3x1.js +0 -4
  174. package/dist/chunks/cf-settings-7ye6x7g2.js +0 -4
  175. package/dist/chunks/color-4gj49xq6.js +0 -4
  176. package/dist/chunks/components-qce0v93f.js +0 -4
  177. package/dist/chunks/content-source-jjx8kgzr.js +0 -4
  178. package/dist/chunks/editor-bkja5dbv.js +0 -4
  179. package/dist/chunks/entry-commands-1wh0btvg.js +0 -4
  180. package/dist/chunks/file-ops-6pe4z7an.js +0 -4
  181. package/dist/chunks/files-ybpp3j38.js +0 -4
  182. package/dist/chunks/format-host-3mtbhxk1.js +0 -4
  183. package/dist/chunks/fs-events-xfanfxds.js +0 -4
  184. package/dist/chunks/grid-open-dg5qmnaj.js +0 -4
  185. package/dist/chunks/iframe-host-j2bk2xkc.js +0 -4
  186. package/dist/chunks/index-fkrm7pdk.js +0 -4
  187. package/dist/chunks/jx-validate-w7v32f6a.js +0 -4
  188. package/dist/chunks/layers-g7j732cm.js +0 -4
  189. package/dist/chunks/layers-panel-gjrsxcck.js +0 -4
  190. package/dist/chunks/lit-html-jdfz9rhc.js +0 -4
  191. package/dist/chunks/media-library-9j0v4wmk.js +0 -4
  192. package/dist/chunks/media-picker-cpyyt2m0.js +0 -4
  193. package/dist/chunks/monaco-buffer-9wcme176.js +0 -4
  194. package/dist/chunks/notify-rahnnnv4.js +0 -4
  195. package/dist/chunks/parse-v77xtwv7.js +0 -4
  196. package/dist/chunks/platform-b2aqv7v5.js +0 -4
  197. package/dist/chunks/publish-panel-4yk2461b.js +0 -4
  198. package/dist/chunks/publish-workspace-mxestzcf.js +0 -4
  199. package/dist/chunks/quick-search-9g6z65b0.js +0 -4
  200. package/dist/chunks/references-c26enpxs.js +0 -4
  201. package/dist/chunks/right-panel-9d0e0yg7.js +0 -4
  202. package/dist/chunks/source-control-xyn3a8ds.js +0 -4
  203. package/dist/chunks/studio-0khd0xdw.js +0 -5
  204. package/dist/chunks/studio-1fvzq9vs.js +0 -5
  205. package/dist/chunks/studio-1yhz0s8p.js +0 -5
  206. package/dist/chunks/studio-2c2mjyzj.js +0 -6
  207. package/dist/chunks/studio-3pndhat0.js +0 -9
  208. package/dist/chunks/studio-4fjqdzrb.js +0 -6
  209. package/dist/chunks/studio-5abge3wy.js +0 -5
  210. package/dist/chunks/studio-74nzv280.js +0 -5
  211. package/dist/chunks/studio-7cg75gtj.js +0 -14
  212. package/dist/chunks/studio-89cwmnae.js +0 -5
  213. package/dist/chunks/studio-8m1t83kn.js +0 -7
  214. package/dist/chunks/studio-a3evp7f6.js +0 -6
  215. package/dist/chunks/studio-ana67wax.js +0 -5
  216. package/dist/chunks/studio-b4xhpcwy.js +0 -4
  217. package/dist/chunks/studio-c4rcaftm.js +0 -5
  218. package/dist/chunks/studio-cgjt1zce.js +0 -5
  219. package/dist/chunks/studio-cq87hree.js +0 -5
  220. package/dist/chunks/studio-e1g64q43.js +0 -5
  221. package/dist/chunks/studio-e8pzjjhf.js +0 -5
  222. package/dist/chunks/studio-f8kz3krj.js +0 -7
  223. package/dist/chunks/studio-fw3jp9m7.js +0 -5
  224. package/dist/chunks/studio-g6ysm05p.js +0 -7
  225. package/dist/chunks/studio-gmhd0j3f.js +0 -5
  226. package/dist/chunks/studio-gqpty626.js +0 -5
  227. package/dist/chunks/studio-grp684wx.js +0 -5
  228. package/dist/chunks/studio-h98520qr.js +0 -5
  229. package/dist/chunks/studio-hvxt8z79.js +0 -5
  230. package/dist/chunks/studio-j4e627w1.js +0 -5
  231. package/dist/chunks/studio-kt2j51sa.js +0 -5
  232. package/dist/chunks/studio-m4w6sygj.js +0 -16
  233. package/dist/chunks/studio-nqxqf8p2.js +0 -4
  234. package/dist/chunks/studio-p89w12s2.js +0 -7
  235. package/dist/chunks/studio-pbagym4j.js +0 -5
  236. package/dist/chunks/studio-pr23qhrw.js +0 -5
  237. package/dist/chunks/studio-r4ya3sb2.js +0 -5
  238. package/dist/chunks/studio-rm9m3z60.js +0 -5
  239. package/dist/chunks/studio-tpmnbgmt.js +0 -5
  240. package/dist/chunks/studio-ttxhq5yt.js +0 -5
  241. package/dist/chunks/studio-y1x65h5r.js +0 -5
  242. package/dist/chunks/studio-zf188hnd.js +0 -5
  243. package/dist/chunks/toast-1gv0h53h.js +0 -4
  244. package/dist/chunks/workspace-3nt93k48.js +0 -4
  245. package/dist/chunks/workspace-home-zbgyqqws.js +0 -4
  246. package/src/services/directory-picker.ts +0 -187
  247. package/src/services/gated-registry.ts +0 -77
@@ -0,0 +1,4 @@
1
+ import{Sk,Bg}from"./studio-z1p91z5a.js";import"./studio-ry4789ng.js";import"./studio-s4fq9jht.js";import"./studio-n4qq1n57.js";import"./studio-1cfyd1ys.js";import"./studio-9ff0vqff.js";import"./studio-fg4fj9ec.js";import"./studio-ws2r1d7e.js";import"./studio-79r8msnr.js";import"./studio-x2trkhk5.js";import"./studio-spza69tb.js";import"./studio-4qg61g9j.js";import"./studio-kqh7fxn6.js";import"./studio-9179bsm7.js";import"./studio-0nefxhar.js";import"./studio-yjh9gddd.js";import"./studio-0rg30pvs.js";import"./studio-ekzbgnjp.js";import"./studio-nqexty8x.js";import"./studio-g45r5vm8.js";import"./studio-vtey9w98.js";import"./studio-t6dqnnft.js";import"./studio-y47090vq.js";import"./studio-14hh60j8.js";import"./studio-myb4mf0h.js";import"./studio-ajw4k8hp.js";import"./studio-qs5fmhtj.js";import"./studio-8hf8qcm1.js";import"./studio-7q6jdd4h.js";import"./studio-by8x0jvc.js";import"./studio-ztppbam0.js";import"./studio-4rgem12q.js";import"./studio-8pne0rx4.js";import"./studio-tfmhnwyr.js";import"./studio-psh8mwnw.js";import"./studio-a6e5fzve.js";import"./studio-9ndgd55w.js";export{Sk as initQuickSearch,Bg as openQuickSearch};
2
+
3
+ //# debugId=3681C735EE63CC3764756E2164756E21
4
+ //# sourceMappingURL=quick-search-r955m3q1.js.map
@@ -0,0 +1,4 @@
1
+ import{hh,Bd,La,k$,Sr,E$,Xb,T$,Qb}from"./studio-7q6jdd4h.js";import"./studio-psh8mwnw.js";import"./studio-9ndgd55w.js";export{Sr as invalidateUsages,La as loadUsages,E$ as onUsagesInvalidated,Bd as peekUsages,k$ as retryUsages,Qb as usageFiles,Xb as usageHeadline,T$ as usageWarning,hh as usagesSupported};
2
+
3
+ //# debugId=620C7A34ED0773A364756E2164756E21
4
+ //# sourceMappingURL=references-8gxv0x7t.js.map
@@ -0,0 +1,4 @@
1
+ import{dR,Ck,J2,kk,zg,Dl,Su}from"./studio-hcy9zeac.js";import"./studio-qd0cycm4.js";import"./studio-sm2f0sc6.js";import"./studio-nvfa137z.js";import"./studio-xzgp0cp7.js";import"./studio-ht81xjkr.js";import"./studio-6rbaedw2.js";import"./studio-nfmpmkqb.js";import"./studio-ry4789ng.js";import"./studio-s4fq9jht.js";import"./studio-n4qq1n57.js";import"./studio-1cfyd1ys.js";import"./studio-9ff0vqff.js";import"./studio-fg4fj9ec.js";import"./studio-ws2r1d7e.js";import"./studio-79r8msnr.js";import"./studio-ae7a69jc.js";import"./studio-cg54vtet.js";import"./studio-x2trkhk5.js";import"./studio-spza69tb.js";import"./studio-4qg61g9j.js";import"./studio-kqh7fxn6.js";import"./studio-9179bsm7.js";import"./studio-0nefxhar.js";import"./studio-yjh9gddd.js";import"./studio-0rg30pvs.js";import"./studio-ekzbgnjp.js";import"./studio-nqexty8x.js";import"./studio-g45r5vm8.js";import"./studio-vtey9w98.js";import"./studio-t6dqnnft.js";import"./studio-y47090vq.js";import"./studio-14hh60j8.js";import"./studio-myb4mf0h.js";import"./studio-ajw4k8hp.js";import"./studio-qs5fmhtj.js";import"./studio-8hf8qcm1.js";import"./studio-7q6jdd4h.js";import"./studio-by8x0jvc.js";import"./studio-ztppbam0.js";import"./studio-4rgem12q.js";import"./studio-8pne0rx4.js";import"./studio-tfmhnwyr.js";import"./studio-psh8mwnw.js";import"./studio-a6e5fzve.js";import"./studio-9ndgd55w.js";import"./studio-k1wvtp03.js";export{Dl as inspectorTab,Ck as mount,zg as render,kk as restingInspectorTab,Su as setInspectorTab,dR as stripOf,J2 as unmount};
2
+
3
+ //# debugId=7DCA18538EC5265964756E2164756E21
4
+ //# sourceMappingURL=right-panel-jarwqjpy.js.map
@@ -0,0 +1,4 @@
1
+ import{Ws,rT,cS,dS,bb,wa,sT,aT,lT,cT,dT,uT,hT,pT,fT,mT,gT,bT,vT,yT,uS,wT,xT,ww,_T,ST,vb,CT}from"./studio-ws2r1d7e.js";import"./studio-79r8msnr.js";import"./studio-4qg61g9j.js";import"./studio-kqh7fxn6.js";import"./studio-9179bsm7.js";import"./studio-0nefxhar.js";import"./studio-yjh9gddd.js";import"./studio-0rg30pvs.js";import"./studio-ekzbgnjp.js";import"./studio-nqexty8x.js";import"./studio-g45r5vm8.js";import"./studio-vtey9w98.js";import"./studio-t6dqnnft.js";import"./studio-y47090vq.js";import"./studio-14hh60j8.js";import"./studio-myb4mf0h.js";import"./studio-ajw4k8hp.js";import"./studio-qs5fmhtj.js";import"./studio-7q6jdd4h.js";import"./studio-by8x0jvc.js";import"./studio-ztppbam0.js";import"./studio-4rgem12q.js";import"./studio-8pne0rx4.js";import"./studio-tfmhnwyr.js";import"./studio-psh8mwnw.js";import"./studio-a6e5fzve.js";import"./studio-9ndgd55w.js";export{ST as armGitPoll,uS as changeRow,yT as checkoutBranch,vb as cleanupSourceControl,dS as cloneRepository,xT as commitRow,vT as createBranch,bT as discardFile,cS as fetchGitLog,hT as fetchRemote,wT as groupFilesByComponent,gT as includeNewChanges,_T as lastUpdatedLabel,lT as loadDiffForLens,rT as noteFileSaved,uT as openFileComparison,wa as platformHostsGit,sT as platformOpensPullRequests,bb as platformSupportsClone,pT as pullRemote,Ws as refreshGitStatus,CT as registerSourceControlCommands,ww as relativeDate,dT as runCloneRepository,mT as setAllIncluded,fT as setIncluded,cT as setSourceControlDeps,aT as statusTag};
2
+
3
+ //# debugId=DB3FA1E26A1C157464756E2164756E21
4
+ //# sourceMappingURL=source-control-84qt25m9.js.map
@@ -0,0 +1,7 @@
1
+ import{p}from"./studio-9ndgd55w.js";import{$m}from"./studio-y47090vq.js";import{ge,ne,g,wv}from"./studio-tfmhnwyr.js";import{ae}from"./studio-qs5fmhtj.js";import{T,R}from"./studio-myb4mf0h.js";import{no,h}from"./studio-nqexty8x.js";import{S}from"./studio-9ra9e7m4.js";import{Q}from"./studio-ywf9y1e2.js";function j(e){return JSON.parse(e)}function k(e){return e!==null&&typeof e==="object"&&!Array.isArray(e)}function C(e){try{let t=j(e);return k(t)?t:void 0}catch{return}}function P({slug:e,adapter:t}){let o=new Date().toISOString().slice(0,10);return`${JSON.stringify(t==="cloudflare-workers"?{assets:{binding:"ASSETS",directory:"./dist"},compatibility_date:o,compatibility_flags:["nodejs_compat"],main:"./dist/worker.js",name:e}:{compatibility_date:o,compatibility_flags:["nodejs_compat"],name:e,pages_build_output_dir:"./dist"},null,"\t")}
2
+ `}function m(e,{slug:t,adapter:o}){if(!e)return{content:P({adapter:o,slug:t}),patched:!0};let n=C(e);if(n===void 0)return{content:e,patched:!1};if(n.name=t,o==="cloudflare-workers")delete n.pages_build_output_dir,n.main="./dist/worker.js",n.assets={binding:"ASSETS",directory:"./dist"};else delete n.main,delete n.assets,n.pages_build_output_dir="./dist";return{content:`${JSON.stringify(n,null,"\t")}
3
+ `,patched:!0}}function zl(){try{return Q(p().cfApi)}catch{return!1}}async function l(e,t){let o=p().cfApi;if(!o)throw Error("This platform cannot reach the Cloudflare API");try{return await o(e,t)}catch(n){throw $m(n),n}}async function lN(){return l("/accounts")}async function A(e,t){try{return await l(`/accounts/${e}/pages/projects/${t}`)}catch{return null}}async function I(e){let t={build_command:"bunx jx build",destination_dir:"dist"};if(e.rootDir)t.root_dir=e.rootDir;return l(`/accounts/${e.accountId}/pages/projects`,{method:"POST",body:{name:e.projectName,production_branch:e.productionBranch,build_config:t,source:{type:"github",config:{owner:e.owner,repo_name:e.repo,production_branch:e.productionBranch,deployments_enabled:!0}}}})}function _(e){let t={id:e.id,url:e.url,environment:e.environment,stage:e.latest_stage?.name??"unknown",status:e.latest_stage?.status??"unknown",createdOn:e.created_on},o=e.deployment_trigger?.metadata?.branch;if(o)t.branch=o;return t}async function UT(e){return(await l(`/accounts/${e.accountId}/pages/projects/${e.projectName}/deployments`)).map((o)=>_(o))}async function Sb(e){let[t]=await UT(e);return t??null}async function qT(e,t){let o={...e.build};if(t===null)delete o.deploy;else o.deploy=t;if(await no({build:o}),t!==null){let n=p(),i=null;try{i=await n.readFile("wrangler.jsonc")}catch{i=null}let x=o.adapter==="cloudflare-workers"?"cloudflare-workers":"cloudflare-pages",{content:v,patched:D}=m(i,{adapter:x,slug:t.projectName});if(D)await n.writeFile("wrangler.jsonc",v)}}async function cN(e,t){let n=await A(t.accountId,t.projectName)??await I(t),i={provider:"cloudflare-pages",accountId:t.accountId,projectName:t.projectName};if(n.subdomain)i.productionUrl=`https://${n.subdomain}`;return await qT(e,i),i}var f={$schema:"https://jxsuite.com/schema/v1",$id:"StudioPanelDeployChecklist",$description:"The deploy checklist, drawn above the Activity feed in the Bottom dock's Activity tab: what is MISSING before this project can ship, as one row with the chain of prerequisites under it. `publish/deploy-checklist.ts` owns the chain — which link is forged, which is merely unasked, and which command forges the next one — and hands this document a row, four steps and at most one action. Nothing here reads source control, the project config or the command registry. It draws in the Activity tab's own vocabulary because a deploy is an ordered list of stages that finish, which is exactly what a row of that feed already is; a fifth visual idiom for it would be a second design of a thing the tab has.",tagName:"div",attributes:{part:"checklist"},style:{$description:"What `.activity-list`, `.activity-row`, `.activity-row--running`, `.activity-row--done`, `.activity-icon`, `.activity-body`, `.activity-head`, `.activity-title`, `.activity-source`, `.activity-status`, `.activity-steps`, `.activity-step`, `.activity-step--done` and `.activity-step-icon` said in `styles/panels.css`, keyed on `part`. This is the LAST reader of those rules — `surfaces/panel-activity.json` carried its own copy when the feed converted, and left the stylesheet standing because this file still drew from it — so the whole `.problem-*, .activity-*` block is dead once this lands. Three token names could not travel: `--spectrum-font-size-50`, `--spectrum-font-size-75` and `--spectrum-corner-radius-75` resolve only inside `<sp-theme>`, and a document mounted into the dock body is outside it, so each would silently have taken its hard-coded px fallback. They are the kit's own scale here. One thing changed meaning on purpose: the step's `data-state` is the checklist's own three-valued state rather than the two CSS classes it used to collapse into, so `unknown` — \"nobody has asked\" — is a state the styling can tell apart from `todo` the day it should.",display:"block",minWidth:"0",fontFamily:"var(--jx-font-sans)",color:"var(--fg)",'& [part="list"]':{display:"flex",flexDirection:"column",gap:"var(--jx-space-1)",margin:"0",padding:"0",listStyle:"none"},'& [part="row"]':{$description:"The left border is the state, at 3px, which is the one thing that must be legible without reading the row. Its default is the dim foreground so a state nobody has a colour for still draws a border rather than a gap.",display:"flex",alignItems:"flex-start",gap:"var(--jx-space-2)",padding:"6px var(--jx-space-2)",border:"1px solid var(--border)",borderLeft:"3px solid var(--fg-dim)",borderRadius:"var(--radius)",background:"var(--bg-panel)",color:"var(--fg)",fontSize:"var(--jx-text-md)"},'& [part="row"][data-state="running"]':{borderLeftColor:"var(--accent)"},'& [part="row"][data-state="done"]':{borderLeftColor:"var(--success)"},'& [part="state-icon"]':{$description:'Named `state-icon` rather than `icon`: `jx-button` puts `part="icon"` on the glyph slot of every button it draws, and the action button below is inside this same light-DOM tree — a rule on the bare name would reach into the kit\'s own drawing and a devtools query could not tell the two apart.',flex:"none",width:"14px",textAlign:"center",fontWeight:"700",lineHeight:"1.5"},'& [part="row"][data-state="running"] > [part="state-icon"]':{color:"var(--accent)"},'& [part="row"][data-state="done"] > [part="state-icon"]':{color:"var(--success)"},'& [part="row-body"]':{flex:"1",minWidth:"0",display:"flex",flexDirection:"column",alignItems:"flex-start",gap:"2px"},'& [part="head"]':{display:"flex",alignItems:"baseline",gap:"var(--jx-space-2)",alignSelf:"stretch",minWidth:"0"},'& [part="row-title"]':{fontWeight:"700",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},'& [part="source"]':{$description:"Pushed to the far edge, so the tab reads as a column of who raised what.",flex:"none",marginLeft:"auto",color:"var(--fg-dim)",fontSize:"var(--jx-text-sm)"},'& [part="summary"]':{color:"var(--fg-dim)",overflowWrap:"anywhere"},'& [part="steps"]':{$description:'The chain, declared up front, so "which link is missing" is answered by looking rather than by reading the summary and remembering what came before it.',display:"flex",flexDirection:"column",gap:"1px",margin:"2px 0 0",padding:"0",listStyle:"none",fontSize:"var(--jx-text-sm)"},'& [part="step"]':{display:"flex",gap:"6px",color:"var(--fg-dim)"},'& [part="step"][data-state="done"] > [part="step-icon"]':{color:"var(--success)"},'& [part="step-icon"]':{flex:"none","--jx-icon-size":"1em",marginBlockEnd:"-0.15em"},'& [part="action"]':{marginTop:"var(--jx-space-1)"}},children:[{tagName:"div",attributes:{part:"body-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/hasProject"},cases:{true:{tagName:"ul",attributes:{part:"list"},children:[{tagName:"li",attributes:{part:"row","data-state":"${state.rowState}"},children:[{tagName:"span",attributes:{part:"state-icon","aria-hidden":"true"},textContent:"${state.rowIcon}"},{tagName:"div",attributes:{part:"row-body"},children:[{tagName:"div",attributes:{part:"head"},children:[{tagName:"span",attributes:{part:"row-title"},textContent:"Deploy checklist"},{tagName:"span",attributes:{part:"source"},textContent:"Publish"}]},{tagName:"div",attributes:{part:"summary"},textContent:"${state.summary}"},{tagName:"ol",attributes:{part:"steps"},children:[{$prototype:"Array",items:{$ref:"#/state/steps"},key:{$ref:"$map/item/id"},map:{tagName:"li",attributes:{part:"step","data-step":"${$map.item.id}","data-state":"${$map.item.state}"},children:[{tagName:"jx-icon",attributes:{part:"step-icon"},$props:{name:{$ref:"$map/item/icon"},label:{$ref:"$map/item/iconLabel"}}},{tagName:"span",attributes:{part:"step-text"},textContent:"${$map.item.text}"}]}}]},{tagName:"span",attributes:{part:"action-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/hasAction"},cases:{true:{tagName:"jx-button",$description:"The recovery button wears the command's own title, so it reads as a verb rather than as a decoration, and a refused command is dimmed with the reason it names in its tooltip. A command the registry does not have, or whose `when` is false, draws NOTHING rather than a dead label — a surface may choose whether to show a command, never whether it exists (§13).",$props:{size:"sm",disabled:{$ref:"#/state/actionDisabled"}},attributes:{part:"action",title:"${state.actionTitle}"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/runAction"},value:[]}]},children:[{tagName:"span",textContent:"${state.actionLabel}"}]}}}]}]}]}}}]};T("panel-deploy-checklist",f);var d=null,c=null,s=null,r=null;function O(e,t){e.hasProject=t.hasProject,e.rowState=t.rowState,e.rowIcon=t.rowIcon,e.summary=t.summary,e.steps=t.steps,e.hasAction=t.hasAction,e.actionLabel=t.actionLabel,e.actionTitle=t.actionTitle,e.actionDisabled=t.actionDisabled}function J(e){if(d!==e)return!1;return r===null?s!==null:r.root.parentNode===e}function y(e,t){if(J(e))return;u(),d=e;let o=g({actionDisabled:!1,actionLabel:"",actionTitle:"",hasAction:!1,hasProject:!1,rowIcon:"",rowState:"running",runAction:t.runAction,steps:[],summary:""});c=ge(),c.run(()=>{ne(()=>{O(o,t.project())})});let n=R("panel-deploy-checklist",o,e);s=n,n.then((i)=>{if(s===n)r=i;else i.dispose()})}function u(){c?.stop(),c=null;let e=s;if(s=null,r)r.dispose(),r=null;else if(e)e.then((t)=>t.dispose());d=null}function L(){return S?.projectConfig??null}function Ri(){return L()?.build?.deploy}var a=wv({asked:!1,observed:null});function Nd(e){a.observed=e,a.asked=!0}function GT(){return a.observed}function V(){let{status:e}=h.git;if(e===null)return{command:"git.init",detail:"Source control has not reported on this project yet.",id:"repo",label:"Track this project with git",state:"unknown"};return e.isRepo?{command:"git.init",detail:`Tracked${e.branch?` — on branch ${e.branch}`:""}.`,id:"repo",label:"Track this project with git",state:"done"}:{command:"git.init",detail:"A deploy ships what the repository holds, so the repository comes first.",id:"repo",label:"Track this project with git",state:"todo"}}function W(){let{status:e}=h.git;if(e===null||!e.isRepo)return{command:"git.createGithubRepository",detail:"A remote is where the provider builds from.",id:"remote",label:"Push to a remote",state:e===null?"unknown":"todo"};if((e.remotes??[]).length===0)return{command:"git.createGithubRepository",detail:"This repository is local only — nothing outside this machine can build it.",id:"remote",label:"Push to a remote",state:"todo"};return e.ahead>0?{command:"git.push",detail:`${e.ahead} commit(s) are not on ${e.remotes[0]} yet, so a build would ship the older tree.`,id:"remote",label:"Push to a remote",state:"todo"}:{command:"git.push",detail:`Up to date with ${e.remotes[0]}.`,id:"remote",label:"Push to a remote",state:"done"}}function E(){let e=Ri();if(e)return{command:"publish.setUp",detail:`Cloudflare Pages project ${e.projectName}.`,id:"provider",label:"Connect a deploy provider",state:"done"};return zl()?{command:"publish.setUp",detail:"Connecting one makes every commit build and publish on its own.",id:"provider",label:"Connect a deploy provider",state:"todo"}:{command:"publish.setUp",detail:"This platform cannot reach the Cloudflare API. Commit and push instead — your host "+"runs bunx jx build and serves dist/.",id:"provider",label:"Connect a deploy provider",state:"unknown"}}function B(){if(!Ri())return{command:"publish.deploy",detail:"Nothing has been deployed, because no provider is connected.",id:"deployed",label:"Deploy",state:"todo"};if(!a.asked)return{command:"publish.deploy",detail:"Cloudflare has not been asked yet, so this is not a claim that nothing shipped.",id:"deployed",label:"Deploy",state:"unknown"};if(a.observed===null)return{command:"publish.deploy",detail:"Cloudflare reports no deployments for this project.",id:"deployed",label:"Deploy",state:"todo"};let{observed:e}=a;return e.status==="success"?{command:"publish.deploy",detail:`${e.environment} — ${e.url}`,id:"deployed",label:"Deploy",state:"done"}:{command:"publish.deploy",detail:`Last deployment ${e.stage}: ${e.status}.`,id:"deployed",label:"Deploy",state:"todo"}}function w(){return[V(),W(),E(),B()]}function SS(){return w().find((e)=>e.state!=="done")??null}function dN(){if(!S)return null;let e=SS();if(e)return{command:e.command,label:e.label,title:e.detail};return{command:"publish.openDashboard",label:"Deployed",title:Ri()?.productionUrl??"Everything this project needs to ship is in place."}}var b={done:{icon:"check",label:"Done"},todo:{icon:"warning-circle",label:"To do"},unknown:{icon:"question",label:"Not checked yet"}};function H(e){return{icon:b[e.state].icon,iconLabel:b[e.state].label,id:e.id,state:e.state,text:e.state==="done"?e.label:`${e.label} — ${e.detail}`}}function F(e){let t={actionDisabled:!1,actionLabel:"",actionTitle:"",hasAction:!1};if(!e)return t;let o=ae(),n=o?.get(e.command);if(!o||!n||!o.isVisible(e.command))return t;let i=o.disabledReason(e.command);return{actionDisabled:i!==void 0,actionLabel:n.title,actionTitle:i?`${n.title} — requires ${i}`:n.title,hasAction:!0}}function KT(){if(!S)return{actionDisabled:!1,actionLabel:"",actionTitle:"",hasAction:!1,hasProject:!1,rowIcon:"",rowState:"running",steps:[],summary:""};let e=w(),t=e.find((o)=>o.state!=="done")??null;return{...F(t),hasProject:!0,rowIcon:t?"⋯":"✓",rowState:t?"running":"done",steps:e.map((o)=>H(o)),summary:t?t.detail:"Everything this project needs to ship is in place."}}function z(){let e=SS();if(!e)return;ae()?.run(e.command)}var M={project:KT,runAction:z};function uN(e){let t=e.querySelector("[data-deploy-checklist]");if(!t){u();return}y(t,M)}
4
+ export{zl,lN,UT,Sb,qT,cN,Ri,Nd,GT,SS,dN,KT,uN};
5
+
6
+ //# debugId=F9C47B594459B6BE64756E2164756E21
7
+ //# sourceMappingURL=studio-0nefxhar.js.map
@@ -0,0 +1,5 @@
1
+ import{p,_e}from"./studio-9ndgd55w.js";import{Pn,ev,Wt,ln,go,wx,eO,Tn,Oe,$a,Ix,St,Rx,Hi,Vn,Ce,ui,j$,To,We,Un,Y,or,vh,Vp,Qe,Up,hi,m,u,pn,kr,qp}from"./studio-ztppbam0.js";import{ge,ne,de,C}from"./studio-tfmhnwyr.js";import{st,bo,Gp,Zc}from"./studio-4rgem12q.js";import{Qc,Wi}from"./studio-a6e5fzve.js";import{YS,Ne,Fc,jc}from"./studio-ekzbgnjp.js";import{L$,ph}from"./studio-by8x0jvc.js";import{He,cx,Js,nn,rh,Md,Bb,sh}from"./studio-t6dqnnft.js";import{Fp,jd,Jb,Gc,Ts,Eo,Ls,Ea,Hp,Jl,Yb,qA,_r,oo,uh,Zb,ae}from"./studio-qs5fmhtj.js";import{ol,zr,qs,Gs,Wr}from"./studio-g45r5vm8.js";import{to,ZN,HL,Xw,Qw,Es,Ip,il,ex,BL,h,YL}from"./studio-nqexty8x.js";import{rr,Vt,zi,Er,S,_h,Xp,Sh,xn}from"./studio-9ra9e7m4.js";import{oe,ta}from"./studio-nfwacw31.js";import{Zx}from"./studio-tyzgte21.js";import{n,Z,Q,_,v,Me,Go,Gn,it,td}from"./studio-ywf9y1e2.js";import{le}from"./studio-k5n4es74.js";var at="jx:canvas";function Qt(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 en(){return lt}function kb(e){if(lt){lt(e);return}window.open(e,"_blank","noopener,noreferrer")}function vr(){return bo(m.activePaneId)}function vt(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 Hr(e){return pn(e)?.derived??null}function kS(e){if(!e)return[];let t=[];for(let o of m.panes)if(vt(o.id)?.id===e.id)t.push(bo(o.id));return t}function W(e){for(let t of Gp()){let o=t.panels.find((r)=>r.canvas===e);if(o)return{panel:o,surface:t}}return null}function tn(e){let t=e.canvas,o=t?W(t):null;return o?vt(o.surface.paneId):null}function Nc(e){let t=e?.session.ui,o=t?.canvasMode??"design";return t?.preview&&(o==="edit"||o==="design")?"preview":o}function Wo(e){let t=Hr(e);if(t?.kind==="lens"){let o=t.mode;return vt(e)?.session.ui?.preview&&(o==="edit"||o==="design")?"preview":o}return Nc(vt(e))}function tl(e){let t=Hr(e);if(t?.kind==="lens"&&t.preset==="breakpoint")return t.media;return vt(e)?.session.ui.activeMedia??null}function ct(e){return Zc(e)?.paneId??hi}function ce(e){return vt(ct(e))}function Se(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)??eO(o.urlPattern,i)??t.defaults?.lang,c=a.map((f)=>({code:f.locale,current:f.urlPattern===o.urlPattern,dir:ev(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=ev(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 Ar=/\[\.\.\.(\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(Ar,(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 Ju(e){if(!e)return"/";return yr(e).urlPattern}function Ac(e){if(!e)return[];return yr(e).params}function Yu(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 ES(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 $r=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 vN(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 Ir=/(src|poster|image|bg|background|icon|logo|photo|avatar|thumbnail|cover|banner)$/i;function an(e){return Ir.test(e)}var Dr=/(?<![\w$.])(?:item|index|\$map)\b/u;function B(e){if(n(e))return e.includes("${")&&Dr.test(e);return Gn(e)&&n(e.$ref)&&/^(?:#\/)?\$map\//u.test(e.$ref)}function we(e,t){if(e==="href"||e==="action")return"";if(an(e))return ut;if(n(t))return dt(t);return Gn(t)&&n(t.$ref)?fn(t.$ref):""}var Jr=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"]),Lr=new Set(["div","section","article","aside","header","footer","main","nav","figure","figcaption","details","fieldset","form","ul","ol","dl","table"]);var jr=["width","height","inlineSize","blockSize"];function Fr(e){let{style:t}=e;if(!_(t))return!1;return jr.some((o)=>{let r=t[o],i=Z(r)?String(r):n(r)?r.trim():"";return i!==""&&i!=="auto"})}function Vr(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(Fr(e))return null;if(Jr.has(it(e.tagName)))return"empty-text-placeholder";if(Lr.has(it(e.tagName)))return"empty-container-placeholder";return null}function dt(e){return e.replaceAll(/\$\{([^}]+)\}/g,"❪ $1 ❫")}function qr(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(Me(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(!Gn(e))return e;if(e.$prototype==="Array")return qr(e,t);let o=e,r={},i=!1,a=n(o.tagName)&&$r.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"&&_h(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"?we(f,g):dn(g,t);else if(Me(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(Gn(c)&&c.$prototype==="Array")r.children=[F(c,t)];else r.children=F(c,t);else if(s==="cases"&&o.$switch&&_h(c)){let[d]=Object.entries(c);if(d){let[,f]=d;r.children=_h(f)&&!(Gn(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&&_h(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)?we(f,g):g;r.attributes=d}else if(s==="attributes"&&_h(c)){let d={};for(let[f,g]of Object.entries(c))d[f]=B(g)?we(f,g):g;r.attributes=d}else if(s==="style")if(_h(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"&&Gn(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]=we(s,c);else if(n(c)||Gn(c)&&c.$ref)r[s]=c;else r[s]=F(c,t);let l=Vr(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 TS(e){let t=e.document?.$paths,o=e.frontmatter?.$paths;return t??o??null}var Te=new Map;function yN(){Te.clear()}function wN(e,t){if(!t)return Promise.resolve({});let o=`${e??""}::${JSON.stringify(t)}`,r=Te.get(o);if(!r)r=Zr(t).catch((i)=>(Te.delete(o),console.warn("page-params: failed to enumerate $paths values:",i),{})),Te.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))Ee(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)Ee(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)Ee(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)Ee(a,t,v(l)?l[o]??l.id??l:l);return a}return{}}async function Yr(){let e=await Qc();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 Ee(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:Ju(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(!Me(e)||!e.$ref.startsWith("#/$params/"))return null;return t[e.$ref.slice(10)]??null}function LS(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 xN(e){let t=e?.state??{},o=[];for(let[r,i]of Object.entries(t)){if(td(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 $S(e){return e.replaceAll(/[_-]+/g," ").replaceAll(/([a-z\d])([A-Z])/g,"$1 $2").trim().replaceAll(/\s+/g," ").toLowerCase()}function Zu(e){let t=/[_-]|[a-z\d][A-Z]/.test(e)?$S(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 Eb(e){return e.charAt(0).toUpperCase()+e.slice(1)}function Tb(e){return(e.replaceAll("\\","/").split("/").pop()??e).replace(/\.[^.]+$/,"").replaceAll(/[-_]+/g," ").replaceAll(/\b\w/g,(o)=>o.toUpperCase())}var di="pages";function mt(){return S?.projectConfig?.content??{}}function Sn(e){return e!==void 0&&/\.[\da-z]+$/i.test(e.replace(/\/+$/,""))}var ri={fileBacked:!1,item:"page",key:di,kind:"pages",title:"Pages"};function ym(){let e=Object.entries(mt()).map(([t,o])=>({fileBacked:Sn(o.source),item:Zu(t),key:t,kind:"collection",title:Eb($S(t))}));return[ri,...e]}function YT(){return ym().map((e)=>e.key)}function Fw(e){let t=mt()[e]?.source;return t!==void 0&&Sn(t)?t.replace(/^\.\//,""):null}function _N(e){return mt()[e]?.schema??null}function Wl(e){return ym().find((t)=>t.key===e)??null}function Vl(e){if(!e)return null;let t=e.replaceAll("\\","/").replace(/^\.\//,"");if(Js.has(nn(t)))return null;if(t.startsWith("pages/"))return Yu(t)?di:null;return Un(t)?.name??null}function Xu(e){if(!e)return!1;let t=Un(e);if(!t||t.fileBacked)return!1;let o=nn(e);return o!==".json"&&o!==".csv"}function SN(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=Vl(r);return i!==null&&i!==di}),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 IS(e,t){let o=TS({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 ZT(e){let t={contentType:null,field:null,layout:void 0,param:null};try{let o=await p().readFile(e);if(e.endsWith(".json"))return IS(JSON.parse(o),null);let{parseSourceForPath:r}=await (le("kkhp9ma7"),import("./file-ops-kkhp9ma7.js")),i=await r(e,o);return IS(i.document,i.frontmatter)}catch{return t}}var V=null,ue=null,gt=0,Re=new Set;async function wn(e,t){let o;try{o=await p().listDirectory(e)}catch{return}await Promise.all(o.map(async(r)=>{if(r.type==="directory")await wn(r.path,t);else t.push(r.path)}))}async function ai(){let e=[];await wn("pages",e);let t=e.filter((a)=>a.includes("[")&&Yu(a)).toSorted(),o=await Promise.all(t.map(async(a)=>[a,await ZT(a)])),{i18n:r}=ln(S?.projectConfig??{}),i=new Map;for(let[a,l]of o)if(l.contentType){let s={field:l.field,layout:l.layout,locale:wx(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 yt(){if(V)return Promise.resolve(V);if(!_e()||!S)return Promise.resolve(new Map);if(!ue){let e=gt;ue=ai().then((t)=>{if(e===gt){V=t,ue=null;for(let o of Re)o()}return t})}return ue}function En(e,t){if(!e||e.length===0)return null;let o=Pn(t),r=ln(S?.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 Oc(e){if(!e)return null;return go(e,ln(S?.projectConfig??{}).i18n)}function Qu(e,t){if(!V){yt();return}return En(V.get(e),t)}function CN(e){if(!V){yt();return}return V.get(e)??[]}async function Ae(e,t){let o=await yt();return En(o.get(e),t)}function Lb(){gt+=1,V=null,ue=null}function Cp(e){return Re.add(e),()=>{Re.delete(e)}}function ht(e){if(n(e)&&e!=="")return e;return Z(e)&&Number.isFinite(e)?String(e):null}function RS(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 DS(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 S?.projectConfig?.defaults?.layout??null}function kN(){Lb(),Re.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:Ju(t)};let a=Un(t),l=a?await Ae(a.name,Oc(t)):null,s=RS(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 Mn(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=Se(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 $e=new Map;function NS(){$e=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 xt(e){if(n(e))return e.includes("${");if(Array.isArray(e))return e.some((t)=>xt(t));return v(e)&&Object.values(e).some((t)=>xt(t))}function Nn(e,t){if(n(e.$src))return e.$src;return n(e.$prototype)&&Object.hasOwn(t,e.$prototype)?t[e.$prototype]??null:null}function bt(e,t={}){return v(e)&&n(e.$prototype)&&Nn(e,t)!==null&&!xt(e)}function On(e,t){return Object.entries(e.state??{}).filter(([,o])=>v(o)&&!n(o.$src)&&bt(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(!Gn(i))return;if(i.$prototype==="Array"&&Me(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)=>bt(r[i]))}function pi(e,t){return console.warn(`canvas: could not resolve state.${e} before the render:`,t),null}async function An(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(!bt(d,r))return;let f={...d,$src:Nn(d,r)};if(o)f.$base=o;let g=JSON.stringify(f),y=$e.get(g);if(!y)y=a.call(i,f).then((T)=>T??null,(T)=>($e.delete(g),pi(c,T))),$e.set(g,y);let b=await y;if(b!==null)s[c]=b})),{...e,state:s}}function $n(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=$n(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 In(e,t=new Set){let o=e.replace(/^\.\//,"");if(t.has(o))return null;t.add(o);let r=await ex(e);if(!r)return null;Ct(r,o);let i=r.$layout;if(!n(i)||!i)return r;let a=await In(i,t);if(!a)return r;let l=BL(a,r);return delete l.$layout,l}function fi(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=jc(t,i)}}function Dn(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=Dn(e,t),i=o?Un(o):null,a=i?await Ae(i.name,Oc(o)):null;return DS(r,a)}async function kn(e,t,o=null){let r={documentPath:t?.documentPath,mode:t?.doc.mode},i=o??Nc(t),a=i==="preview"?structuredClone(de(e)):ft(Xp(e)),l=!1,s=r.documentPath&&S?.isSiteProject&&(r.documentPath.startsWith("pages/")||r.documentPath.startsWith("./pages/")),c=!s&&Boolean(S?.isSiteProject)&&Xu(r.documentPath),d=null,f=0;if((s||c)&&t?.session.ui.showLayout!==!1){let w=c?await mi(e,t,r.documentPath):il(Dn(e,t));if(w){let M=await In(w);if(M){let D=i==="preview"?structuredClone(de(e)):a,P=BL(M,D);if(a=i==="preview"?P:ft(Xp(P)),l=!0,r.documentPath)fi(a.$elements,r.documentPath);let O=$n(P);d=O?.prefix??null,f=O?.offset??0}}}let g=S?.projectConfig;if(s&&g){if(a={...a,state:{...a.state}},a.imports)a.imports={...a.imports};Se(a,g,{urlPattern:Ju(r.documentPath)})}let y=Md(S?.projectRoot),b=r.documentPath?new URL(r.documentPath,y).href:void 0,T=Bb(r.documentPath,sh());if(s&&t){let{previewParams:w}=t.session.ui;if(Object.keys(w).length>0){let M=gn(e.state??null);a=mn(a,w,r.documentPath),await hn(a,M,b)}}if((s||c)&&r.documentPath){let w=await Mn({documentPath:r.documentPath,fields:c?t?.doc.content.frontmatter??null:null,isEntry:c,lang:e.$lang,params:t?.session.ui.previewParams??{},title:e.title},S?.projectConfig);if(w)a={...a,state:{...a.state,...w}}}let k=await Qc(),I=HL(k),J=On(a,I);if(i!=="preview")J.push(...Rn(e));if(a=await An(a,[...new Set(J)],b,I),!s&&t&&LS(a)){let{previewProps:w}=t.session.ui;if(w&&Object.keys(w).length>0)a=Cn(a,w)}let te=new Set;if(i!=="preview")(function w(M,D){if(!_(M))return;if(M.$prototype==="Array"){te.add(D.join("/"));let P=M.map;if(_(P))w(P,[...D,"map"]);return}if(Array.isArray(M.children))for(let[P,O]of M.children.entries()){if(n(O))continue;w(O,[...D,"children",P])}else if(Go(M.children))w(M.children,[...D,"children"]);if(M.$switch&&M.cases)for(let[P,O]of Object.entries(M.cases))w(O,[...D,"cases",P])})(e,[]);let ot=r.documentPath!=null&&(r.documentPath.startsWith("layouts/")||r.documentPath.startsWith("./layouts/")),Pe=Xw(a.$elements);if((r.mode==="content"||l||ot)&&Ne.length>0){let w=new Set(Pe.map((P)=>_(P)?P.$ref:P)),M=new Map(Ne.map((P)=>[P.tagName,P])),D=YS(a);if(a.tagName)D.add(it(a.tagName));for(let P of D)for(let O of M.get(P)?.uses??[])D.add(O);for(let P of D){let O=M.get(P);if(O&&O.source!=="npm"&&O.path){let rt=jc(r.documentPath??null,O.path);if(!w.has(rt))Pe.push({$ref:rt}),w.add(rt)}}}if(Pe.length>0)a.$elements=Pe;return a.imports=ZN(a.imports,k),a.$media=to(a.$media),a.$head=Qw(a.$head),{assets:T,docBase:b,mapperCtx:{arrayPaths:[...te],canvasMode:i,layoutWrapped:l,pageContentOffset:f,pageContentPrefix:d},renderDoc:a,siteStyle:S?.projectConfig?.style??null}}var gi=128,XT="fullRender",EN="mountCanvas",TN="patchBatch",Ln="prepareRender",Vo={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=Vo;var Jn=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 jn(e,t){if(_n())console.debug(`[jx-canvas] ${e}`,t??"")}function jw(e){Vo.escalations+=1,Vo.lastEscalationReason=e,jn("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=Jn.get(e);if(!r)r=[],Jn.set(e,r);if(r.push(o),r.length>gi)r.shift();let i=Vo.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(Vo.timings[e]=a,e===XT)Vo.lastFullRenderMs=a.lastMs,Vo.p95FullRenderMs=a.p95Ms;jn(`span:${e}`,`${o.toFixed(2)}ms`)}function Fn(e){let t=Hn(),o=_n(),r=`jx-${e}-start`;if(o)try{performance.mark(r)}catch{}let i=!1;return()=>{if(i)return Vo.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 AS(e,t){let o=Fn(e);try{return t()}finally{o()}}async function OS(e,t){let o=Fn(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 qn=new Set(["script","style","link","iframe","object","embed"]);function eh(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 Ie(e){if(e.source!=="npm"||!e.package)return null;return e.modulePath?`${e.package}/${e.modulePath}`:e.package}function xi(e,t){let o=Ie(e);if(o)return o;return e.path?{$ref:jc(t,e.path)}:null}function QT(e,t,o){let r=Ie(t);if(r)return e.some((a)=>n(a)&&(a===r||a===t.package));if(!t.path)return!1;let i=re(jc(o,t.path));return e.some((a)=>{let l=Pt(a);return l!==null&&re(l)===i})}function re(e){return e.replace(/^(?:\.\/)+/,"")}function $b(e,t,o){let r=xi(t,o);if(!r)return[...e];let a=Ie(t)&&t.modulePath?e.filter((l)=>l!==t.package):[...e];return QT(a,t,o)?a:[...a,r]}function eL(e,t,o){let r=Ie(t);if(r)return e.filter((a)=>!(n(a)&&(a===r||a===t.package)));if(!t.path)return[...e];let i=re(jc(o,t.path));return e.filter((a)=>{let l=Pt(a);return l===null||re(l)!==i})}function LN(e,t){return e.filter((o)=>!n(o)||!(o===t||o.startsWith(`${t}/`)))}function $N(e,t){let o=re(t);return e.filter((r)=>{let i=Pt(r);return i===null||re(i)!==o})}var bi="Components";function kp(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=$b(r,o,e.documentPath??null);return i.length===r.length?null:i}function MS(e){let t=Ne.find((o)=>o.tagName===e);return t?Fc(t):null}function IN(){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 Wn(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 Bn(e,t,o,r,i=""){return Wn([...wt(e,0,t),...i?[i]:[],...wt(o,r,pe(o))])}function Et(e){let t=Wn(e);if(t.length===0)return{textContent:""};if(t.length===1&&n(t[0]))return{textContent:t[0]};return{children:t}}function zn(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 Kn(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;Y(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;Y(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 Y(e,(l)=>{Up(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(ta(t,o)||ta(o,t))return null;let a=z(i),l=z(r),s=pe(a),c=Et([...a,...l]);return Y(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(vh(d,t),Xn(d,Vt(t)),qp(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(vh(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 Y(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),qp(e))c.session.selection=[l]}),l}function Si(e,t,o,r){let{parentPath:i,index:a}=Tt(t),l=zn(r),s=l?a:a+1,c=[...i,"children",s];if(!e)return c;return Y(e,(d)=>{if(l)vh(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),kp(d,o.tagName),qp(e))d.session.selection=[c]}),c}function eo(e,t,o,r){let i=o.component===!0?MS(o.tag):null;if(i)return Si(e,t,i,r);if(zn(r)){if(!e)return t;return Y(e,(d)=>{Qe(d,t,"tagName",o.tag),Qe(d,t,"children");let f=eh(o.tag);if(f.textContent&&f.textContent!=="Paragraph text")Qe(d,t,"textContent",f.textContent);else Qe(d,t,"textContent");if(qp(e))d.session.selection=[t]}),t}let{parentPath:a,index:l}=Tt(t),s=[...a,"children",l+1];if(!e)return s;let c=eh(o.tag);return Y(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)),qp(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(ta(t.path,o.path)||ta(o.path,t.path))return null;let s=Et(Bn(z(a),t.offset,z(l),o.offset,i)),c=[...r,o.path].toSorted(wi);return Y(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))vh(d,f),Xn(d,Vt(f));if(qp(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(Z(i)&&Z(a))return a-i;return String(a).localeCompare(String(i))}return t.length-e.length}function R(e,t=1){return{height:e.height*t,left:e.x*t,top:e.y*t,width:e.width*t}}function RN(e,t,o=1){return{x:(e.x-t.left)/o,y:(e.y-t.top)/o}}function De(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)=>De(i,f),setInsertZone:(f,g="center")=>Ei(l,f,g),setReplaceTarget:(f)=>De(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",De(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(De(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 Mc(e){return JSON.stringify(e)}var PS={$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 wm=PS.$defs,Oi=new Set(["pre"]),pc=new Set(Object.entries(wm).filter(([e,t])=>!Oi.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=wm[t];if(!o||!o.$inlineChildren)return!1;return o.$inlineChildren.includes(e)}function DN(e){let t=wm[e];if(!t)return null;let o=t.$inlineActions;if(n(o))o=wm[o]?.$inlineActions??void 0;if(!Array.isArray(o))return null;return o}var Ri=null;function Hw(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 NN(){return Ri!==null}function ke(e){return!e||e==="base"?null:e}function Bw(e){let t=e.panels;if(t.length===0)return null;if(t.length===1)return t[0];let o=tl(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 Bw(vr())}function AN(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 zw(e){return Fp(e)!==null}function Ep(e){return Fp(e)}function Br(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 ON(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 xm=240,MN=8,PN=16,Je=new Map;function Nt(e){return Br(to(e.doc.document.$media))}function FS(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=Je.get(e);if(!o)return null;if(!t||o.tabId!==t.id||o.media!==t.session.ui.activeMedia)return Je.delete(e),null;return o.width}function FN(e,t){let o=t?FS(t):0;return $i(e.paneId,t)??o}function jS(e){Je.delete(e)}function jN(e){let{baseWidth:t,sizeBreakpoints:o}=Nt(e);return[t,...o.map((r)=>r.width)]}function HS(e,t,o){let{sizeBreakpoints:r}=Nt(t),i=so(r,o);return t.session.ui.activeMedia=i,Je.set(e,{media:i,tabId:t.id,width:o}),i}var Ot={invokerTags:Zb,popoverTags:uh};function tL(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)&&Ea(i,Ot))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)&&Ea(r,Ot)?t:null}return tL(o,Oe(e.session.selection))}function co(){let e=u.value?.doc.document;return e?qA(e,Ot):!1}var po=["toggle-popover","show-popover","hide-popover","show-modal","close","request-close"],Rt=new Set(["show-modal","close","request-close"]),At=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 Eo(e)==="dialog"}function uo(e){return e.startsWith("--")}function Li(e){let t=[];for(let{node:o}of Jl(e)){let r=Hp(o);if(H(o)&&r!==null&&!t.includes(r))t.push(r)}return t}function fo(e){for(let{node:t}of Jl(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 Jl(e)){if(o===e)continue;let r=Eo(o);if(r==="button"){let i=Ts(o,"command"),a=Ts(o,"commandfor");if(i!==null&&(i==="close"||i==="request-close")&&(a===null||a===t))return!0}if(r==="form"&&Ts(o,"method")?.toLowerCase()==="dialog")return!0}return!1}function bN(e,t){let o=[...Jl(e,[],null,t)],r=Li(e),i=Yb(e,t),a=r.length>0||i.length>0,l=new Map,s=new Map;for(let{node:d}of o){let f=Hp(d);if(f!==null&&!l.has(f))l.set(f,d);if(Eo(d)==="button"){let g=Ts(d,"commandfor"),y=Ts(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=Eo(e),d=l?.invokerTags?.has(c)??!1,f=Ts(e,"command"),g=Ts(e,"commandfor");if(!(f!==null||g!==null||("command"in Gc(e))||("commandfor"in Gc(e))))return s;let b=Ls(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((te)=>`"${te}"`).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(Rt.has(f)&&!H(T))s.push({detail:`\`${f}\` acts on a <dialog>, and "${g}" is ${I?"a popover":`a <${Eo(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(At.has(f)&&!Ea(T,l))s.push({detail:`\`${f}\` acts on a popover, and "${g}" is ${k?"a dialog":`a <${Eo(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=Ls(e,"the dialog"),a=Hp(e),{style:l}=e,s=Ts(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(_r(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=Ts(e,"open")!==null||Gc(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 nL(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 BS(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 nL(o,Oe(e.session.selection))}function mo(){let e=u.value?.doc.document;return e?fo(e):!1}function G(e){return vt(e.paneId)}function fe(e){let t=Hr(e.paneId);if(t?.kind==="lens")return t.zoom;return G(e)?.session.ui.zoom??1}function _m(e=vr()){return fe(e)}function Le(e,t){let o=Hr(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 Tp(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 HN(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 BN(e,t){let o=e.find((i)=>i.item.key===t);if(!o)return;let r=tn(o.panel);if(r)r.session.ui.activeMedia=ke(o.item.mediaAttr)}function kt(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 Ww(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}kt(e),Us(e)}),e.centerObserver.observe(e.panzoomWrap),kt(e)}function Us(e){if(!e.panzoomWrap)return;let t=fe(e);e.panzoomWrap.style.transform=`translate(${e.panX}px, ${e.panY}px) scale(${t})`,xn("overlays")}var Jt=0.25,Ht=3;function yo(e){return Math.min(Ht,Math.max(Jt,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?He(a).width:0,s=t&&l>0?l/t:1,c=o;if(c===null){let d=He(r);c=d.top+d.height/2}return{layoutY:Math.max(0,(c-He(i).top)/s),scroller:r,zoom:s}}function th(e=vr(),t=null){if(Wo(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=He(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);xn("overlays")}function Lp(e,t=vr()){let o=G(t);if(!o)return;o.session.ui.editZoom=yo(e),th(t)}var $t=new Map,It=new Map;function zN(e,t=vr(),o=null){let r=G(t);if(!r)return;if(r.session.ui.editZoom=yo(e),It.set(t.paneId,o),$t.has(t.paneId))return;$t.set(t.paneId,requestAnimationFrame(()=>{$t.delete(t.paneId);let i=It.get(t.paneId)??null;It.delete(t.paneId),th(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=He(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));Le(e,I);let J=s*I,te=y*I;e.panX=Math.max(0,(r-J)/2),e.panY=Math.max(0,(i-te)/2),Us(e)}function WN({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",Lt=["width","page","none"];function Zi(e,t,o){let r=t[o];if(Yi(r))return r;if(Z(r)&&r>=K&&r<=U)return r;throw RangeError(`command "${e}" argument "${o}": expected ${Lt.map((i)=>`"${i}"`).join(" | ")} or a number in [${K}, ${U}], got ${JSON.stringify(r)}`)}function Yi(e){return n(e)&&Lt.includes(e)}var Po=new Map;function So(e){let t=G(e);if(!t)return null;let o=Hr(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 zS(e=vr()){let t=So(e);return(t===null?void 0:Po.get(t))??Gi}function wo(e,t=vr()){let o=e??zS(t);if(o==="none"){Us(t);return}if(Z(o)){Le(t,Co(o)),Us(t);return}xo(t,o,1)}function iL(e,t=vr()){je(e,t),wo(e,t)}function Sm(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=He(t.panzoomWrap),s=He(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}Le(t,i),Us(t)}function WS(e){if(e.wrap.clientWidth<=0){Us(e);return}wo(zS(e),e)}function VN(e=vr()){if(je(1,e),!e.panzoomWrap)return;Le(e,1),kt(e),Us(e)}function Mo(e,t){let o=He(No(e)??e.wrap),r=t.top+t.height/2-o.top;return o.height/2-r}function No(e){return Bw(e)?.scrollContainer??null}function Xi(e,t,o){let r=No(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 VS(e,t=vr()){Xi(t,Mo(t,e),!1)}function Oo(e,t=vr()){let o=He(t.wrap);if(e.top>=o.top&&e.top+e.height<=o.top+o.height)return;let r=Mo(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,Us(e),c<1)requestAnimationFrame(l)};requestAnimationFrame(l)}var Qi=["edit","design","preview","source","stylebook","tokens","grid","git-diff"],Dt=Qi.filter((e)=>e!=="git-diff"),Fe=new Set(["edit","design"]);function ea(e){return Fe.has(e)}var oL=["edit","design","preview"];function na(e){return oL.filter((t)=>e.capabilities.modes.includes(t))}function UN(e){return na(e).filter((t)=>t!=="preview")}function rL(e){let t=e.session.ui.canvasMode;return ea(t)?t:null}function sL(e){return{available:e.capabilities.modes.includes("preview")&&Fe.has(e.session.ui.canvasMode),on:e.session.ui.preview===!0}}function aL(e,t,o){if(t==="preview"){if(Fe.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=u.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=vt(d);if(!f)throw RangeError(`command "${l}" argument "pane": "${d}" has no open document`);return f}let r={pane:We("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:Ce({mode:ui(Dt,"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=Vn("canvas.setMode",s,"mode",Dt),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=Vn("canvas.setMode",s,"mode",Dt),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(!Fe.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:Ce({zoom:j$("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"),Sm(Rx("canvas.setZoom",s,"zoom",K,U))},title:"Set Zoom"},{args:Ce({fit:{description:'How the document is framed: "width" | "page" | "none", or a numeric pan-zoom scale.',oneOf:[{enum:[...Lt],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"),iL(Zi("canvas.setFit",s,"fit"))},title:"Set Fit"},{args:Ce({zoom:j$("Edit-mode content zoom, 1 = 100%.",{maximum:Ht,minimum:Jt})}),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"),Lp(Rx("canvas.setEditZoom",s,"zoom",Jt,Ht))},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){jS(a(s)),i(s);return}HS(a(s),c,Rx("canvas.setEditWidth",s,"width",xm,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:Ce({...r,scheme:ui(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=Vn("canvas.setColorScheme",s,"scheme",vo),i(s)},title:"Set Color Scheme"},{args:Ce({...r,locale:We("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=Es();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:Ce({...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:Ce({...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:Ce({...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=BS(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:We("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:We("The route parameter's name, without brackets."),value:We("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=Ac(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 qN(e,t){e.registerAll(oa(t))}function Vw(e=vr()){let t=tl(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 ra(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 lL(e,t,o,r=document){let i=ra(r);i.textContent=e,i.style.left=`${t}px`,i.style.top=`${o}px`,i.style.display="block"}function US(e,t){if(!L||L.style.display==="none")return;L.style.left=`${e}px`,L.style.top=`${t}px`}function nh(){if(L)L.style.display="none"}var Ao=function(){if(typeof window>"u")return null;var e=new Image;return e.src="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==",e}();function nl(e){var t=e.nativeSetDragImage;if(t&&Ao)t(Ao,0,0)}function $o(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 Io(e,t){if(e==null)return{};var o,r,i=$o(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 Ve(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 Do(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Ve,t=null;return function(o){if(t&&e(t.value,o))return t.value;return t={value:o},t.value}}var ia=["block"];function ko(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 Jo(e){for(var t=1;t<arguments.length;t++){var o=arguments[t]!=null?arguments[t]:{};t%2?ko(Object(o),!0).forEach(function(r){ol(e,r,o[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):ko(Object(o)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(o,r))})}return e}function aa(e){return{x:(e.right+e.left)/2,y:(e.bottom+e.top)/2}}function _t(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 sa(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=_t({borderBox:s,client:l});return{type:c,indentPerLevel:i,currentLevel:r}}var d=aa(s);if(a==="expanded"){var f=_t({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:_t({borderBox:s,client:l}),indentPerLevel:i,currentLevel:r}}function Ho(e,t){if(e.type!==t.type)return!1;if(e.type==="instruction-blocked"&&t.type==="instruction-blocked")return Ho(e.desired,t.desired);return Ve(e,t)}var la=Do(Ho);function ca(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 Uw(e,t){var o=t.block,r=Io(t,ia),i=sa(r),a=ca({desired:i,block:o}),l=la(a);return Jo(Jo({},e),{},ol({},qe,l))}function $p(e){var t;return(t=e[qe])!==null&&t!==void 0?t:null}var qe=Symbol("tree-item-instruction");var Lo=`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 ua(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 jt(e){if(ua(e))e.setAttribute("data-jx-image-placeholder",""),e.setAttribute("src",Lo);else if(e.hasAttribute("data-jx-image-placeholder")&&e.getAttribute("src")!==Lo)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))jt(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))jt(l)}continue}for(let a of i.addedNodes)for(let l of _o(a))jt(l)}});return o.observe(e,{attributeFilter:["src","srcset"],attributes:!0,childList:!0,subtree:!0}),()=>o.disconnect()}async function qw(e,t=new Map){jd(!0);try{if(!await da(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 da(e){if(e.source==="npm")return Boolean(customElements.get(e.tagName));if(e.path&&!e.path.endsWith(".json"))return!1;let t=S?.projectRoot;return await Jb(`${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 pa='[part="outline"]',Ft='[part="row"]',fa='[part="verbs"]',Be=null;function GN(){if(Be!==null)cancelAnimationFrame(Be);for(let e of st.dndCleanups)e();st.dndCleanups=[],Be=requestAnimationFrame(()=>{Be=null;let e=Sh?.querySelector(pa);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=zr(Wr({canDrag({element:c,input:d}){if(cx(d.clientX,d.clientY)?.closest(fa))return!1;return!0},element:o,getInitialData(){return{path:r,type:"tree-node"}},onGenerateDragPreview({nativeSetDragImage:c}){nl({nativeSetDragImage:c})},onDragStart(){if(o.dataset.dragging="",st.layerDragSourceHeight=o.offsetHeight,l)ma(o,e)},onDrop(){if(delete o.dataset.dragging,l)xn("leftPanel")}}),qs({element:o,canDrop({source:c}){let d=c.data.path;if(Array.isArray(d)&&ta(d,r))return!1;return!0},getData({input:c,element:d}){return Uw({path:r},{block:a?["make-child"]:[],currentLevel:i,element:d,indentPerLevel:16,input:c,mode:l?"expanded":"standard"})},onDragEnter({self:c}){Bo(o,c.data,e)},onDrag({self:c}){Bo(o,c.data,e)},onDrop(){me(e)}}));st.dndCleanups.push(s)}let t=Gs({onDrop({source:o,location:r}){me(e);let[i]=r.current.dropTargets;if(!i)return;let a=$p(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(Ib(u.value,a,l,s),d){let f=u.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&&!$p(r.data))me(e)}});st.dndCleanups.push(t)})}function KN(){requestAnimationFrame(()=>{let e=Sh?.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))qw(r).then((s)=>{i.textContent="",i.append(s)});let a=Fc(r),l=Wr({element:t,getInitialData(){return{fragment:structuredClone(a),type:"block"}},onGenerateDragPreview({nativeSetDragImage:s}){nl({nativeSetDragImage:s})}});st.dndCleanups.push(l)}})}function JN(){requestAnimationFrame(()=>{let e=Sh?.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(qn.has(o)?"span":o);l.textContent=o,r.append(l)}let i=eh(o),a=Wr({element:t,getInitialData(){return{fragment:structuredClone(i),type:"block"}},onGenerateDragPreview({nativeSetDragImage:l}){nl({nativeSetDragImage:l})}});st.dndCleanups.push(a)}})}function ma(e,t){let o=`${e.dataset.value}/`,r=t.querySelectorAll(Ft);for(let i of r)if(i.dataset.value?.startsWith(o))i.style.display="none"}function Bo(e,t,o){let r=$p(t);if(st._currentDropTargetRow&&st._currentDropTargetRow!==e)delete st._currentDropTargetRow.dataset.drop;if(!r||r.type==="instruction-blocked"){me(o);return}if(r.type==="make-child"){me(o),e.dataset.drop="",st._currentDropTargetRow=e;return}delete e.dataset.drop,st._currentDropTargetRow=e;let i=[...o.querySelectorAll(Ft)],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 me(e){if(st._currentDropTargetRow)delete st._currentDropTargetRow.dataset.drop,st._currentDropTargetRow=null;let t=e.querySelectorAll(Ft);for(let o of t)o.style.transform="",o.style.display=""}function zo(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||!Z(i))return;if(t==="reorder-above")return{index:i,parent:r};if(t==="reorder-below")return{index:i+1,parent:r};return null}function Ib(e,t,o,r){if(!e)return;if(o.type==="tree-node"){let i=o.path,a=zo(e.doc.document,t.type,r);if(a)Y(e,(l)=>Vp(l,i,a.parent,a.index))}else if(o.type==="block"){let i=zo(e.doc.document,t.type,r);if(i===void 0)return;let a=o.fragment;if(i)Y(e,(l)=>{or(l,i.parent,i.index,structuredClone(a)),kp(l,a.tagName),l.session.selection=[[...i.parent,"children",i.index]]})}}function Ko(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,ga=600;function cL(e){return lr===e&&Date.now()-cr<=ga}var Uo=0,ur=new Set;function ha(e,t){let o;try{o=new URL(e,t.iframe.src||rh())}catch{return}if(!["http:","https:","mailto:","tel:"].includes(o.protocol))return;let r=o.href,i=en();if(i){i(r);return}window.open(r,"_blank","noopener,noreferrer")}function dL(e){ur.add(e)}function va(e){return ur.delete(e)}var q=new Map,ie=new Map,ye=new Map,ya=300;function uL(e,t,o,r=ya){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);Uo+=1;let a=Uo,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,xa=250;function hL(e,t=xa){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),ye.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),ye.set(d,c),c.channel.post({kind:"flushEdits",reqId:d})}})}function qS(e){return Xe.get(e)??null}function Rb(e){for(let t of x){if(!t.iframe.isConnected)continue;let o=He(t.iframe);if(e.x>=o.left&&e.x<=o.right&&e.y>=o.top&&e.y<=o.bottom)return t}return null}function Db(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 GS(){return ee}function Ul(e){let t=He(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 pL(){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 ba=500,Ca=2,Pa=40;function pr(){let e=u.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}=Ul(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 xe(e,t){return new Promise((o)=>{e.measureSeq+=1;let r=e.measureSeq,i=setTimeout(()=>{e.pendingMeasures.delete(r),o(null)},ba);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 fL(e){let t=qS(e),o=t?.lastHover;if(!t||!o)return null;return{settle:async()=>(await xe(t,o.path))?.top??null,top:fr(t,o.rect).top}}function mL(e){let t=pr();return t?xe(t,e):Promise.resolve(null)}function Sa(e){return new Promise((t)=>{let o=Number.NaN,r=0,i=0,a=()=>{let{top:l}=He(e.iframe);if(r=l===o?r+1:0,o=l,i+=1,r>=Ca||i>=Pa){t();return}requestAnimationFrame(a)};requestAnimationFrame(a)})}async function Nb(e){let t=pr();return t?j2(t,e):null}async function j2(e,t){let o=await xe(e,t);if(!o)return null;let r=W(e.canvasEl)?.surface;return VS({height:o.height,top:o.top},r),await Sa(e),xe(e,t)}function sP(e,t){let o=qS(e);return o?xe(o,t):Promise.resolve(null)}function wa(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",wa(e)}function Ut(e,t){if(e.preview=t,e.overlay.setSuppressed(t),t)e.pendingEnterEdit=null;mr(e)}function gL(e,t){Ut(Zt(e),t)}function Pc(e,t){if(!e.iframe.isConnected)return;e.channel.post(t)}function Gw(e){ve.delete(e)}function Kw(e){e.overlay.setDropIndicator(null)}var gr=null;function bL(e){gr=e}var Ta=300,hr=null;function vL(e){hr=e}var Gt=null;function yL(e){Gt=e}function Ma(e,t,o){if((t?Na(t.tagName):!1)&&t){e.overlay.setDropIndicator(null),e.overlay.setReplaceTarget(R(t.rect));return}e.overlay.setReplaceTarget(null),e.overlay.setDropIndicator(o?R(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 Oa(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(),Gt?.(E(i),[...r],null,null)})}var Ue=null;function wL(e){Ue=e}var Ge=null;function xL(e){Ge=e}var xr=null;function _L(e){xr=e}function Xo(e,t){let o=[...t];for(;;){let r=e.get(Mc(o));if(r)return r;if(o.length<2)return null;o=o.slice(0,-2)}}var N=null;function SL(){let e=N;return Boolean(e?.editing&&e.iframe.isConnected)}var Ze=null;function CL(e){Ze=e}var Kt=null;function kL(e){Kt=e}var Qo=null,br=null;function EL(e){br=e}function TL(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 LL(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 KS(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){jw("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,Ra=0;function er(e,t,o){et={host:e,paths:t};try{o()}finally{et=null}}var qt=null,Bt=null;function Aa(e,t,o){return!e&&t===o}function Ia(e,t){let o=E(e);if(!o)return;let r=oe(o.doc.document,t);if(!r)return;KS([{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 $L(e){return E(e)}function ze(e){let t=W(e.canvasEl)?.surface.paneId;if(t)kr(t)}var Da=Object.freeze([]);function ka(){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 Ja(){if(Qo)return;let e=ge(!0);e.run(()=>{ne(()=>{let t=ka();h.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=ph();if(t===e.postedVersions)return;if(e.postedVersions===null&&Object.keys(t).length===0){e.postedVersions=t;return}e.postedVersions=t,e.channel.post({kind:"assetVersions",versions:t})}var tr=!1,zt=!1;function Ha(){if(tr)return;tr=!0,ge(!0).run(()=>{ne(()=>{if(L$.value,zt)return;zt=!0,queueMicrotask(()=>{zt=!1,La()})})})}function La(){for(let e of x){if(!e.iframe.isConnected){x.delete(e);continue}tt(e)}}var nr=!1,Ke=null;function _a(){if(nr)return;nr=!0,ge(!0).run(()=>{ne(()=>{for(let t of m.panes){let o=t.activeTabId?m.tabs.get(t.activeTabId):null;if(!o)continue;let{peers:r}=Tn(o);r.map((i)=>JSON.stringify(i.state.structuralSelection??null)).join("|")}if(Ke)clearTimeout(Ke);Ke=setTimeout(()=>{Ke=null;for(let t of x)Cr(t)},100)})})}function Cr(e){if(e.stylebook||!e.ready||!e.iframe.isConnected)return;let t=E(e),o=t?Tn(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){ja(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=$a(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 ja(e){if(!e.iframe.isConnected){x.delete(e);return}let t=h.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 Zx("../canvas.html")}function Pr(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(ye.get(t)===e)se.delete(t),ye.delete(t),o();for(let[,t]of e.pendingMeasures)t([]);if(e.pendingMeasures.clear(),e.pendingTabIds.clear(),be(e),N===e)N=null;e.overlay.root.remove(),e.iframe.remove(),Xe.delete(e.canvasEl),x.delete(e)}function Fa(){if(!_e())return ir();return p().canvasUrl||ir()}function Ab(e){let t=0;for(let o of new Set(x))if(e.contains(o.canvasEl))Pr(o),t+=1;return t}function Zt(e){let t=Fa(),o=Xe.get(e);if(o){if(o.canvasUrl===t)return o;Pr(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),Oa(e,()=>qS(e));let d=Qt({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,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)=>Wa(f,g)),c.insertButton.addEventListener("mouseenter",()=>{f.insertHover=!0,be(f)}),c.insertButton.addEventListener("mouseleave",()=>{f.insertHover=!1,wr(f)}),d.onMessage((g)=>za(f,g)),Xe.set(e,f),x.add(f),Ja(),_a(),Ha(),f}function Va(e,t){be(e),e.insertZone=t,e.overlay.setInsertZone(R(t.rect),t.edge)}function Sr(e){be(e),e.insertZone=null,e.insertHover=!1,e.overlay.setInsertZone(null)}function qa(e){let t=e.overlay.insertButton;return e.insertHover||t.matches(":hover")}function wr(e){be(e),e.insertHideTimer=setTimeout(()=>{if(e.insertHideTimer=null,qa(e))return;Sr(e)},Ta)}function be(e){if(e.insertHideTimer!==null)clearTimeout(e.insertHideTimer),e.insertHideTimer=null}function Wa(e,t){t.stopPropagation(),t.preventDefault();let o=e.insertZone;if(!o)return;hr?.(e.overlay.insertButton,o)}var Ba=new Set(["contextMenu","dragOver","dropResult","editCommit","editCommitProp","editInput","editInsert","editMerge","editRangeReplace","editSplit","editStart","fileDragOver","fileDrop","hit","hover","insertZones","layoutHit","nativeDragEnter"]);function za(e,t){if(e.preview&&Ba.has(t.kind))return;switch(t.kind){case"ready":{e.ready=!0;let o=Yt?.();if(o)e.channel.post({chords:o.chords,kind:"keymap",mac:o.mac});if(e.postedVersions=null,tt(e),e.pending)e.channel.post(e.pending),e.pending=null;nt(e,e.selectionPaths);return}case"paneFocus":{ze(e),Kt?.();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(!Gn(i))return;if(At.has(t.command)){if(!Ea(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(Rt.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),Kt?.(),YL(null);let o=null,r=W(e.canvasEl)?.panel;if(r?.mediaName&&!r.mediaName.startsWith("git-diff")){o=ke(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=R(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?Ix(i.session.selection,t.hit.path):[t.hit.path];{let a=R(t.hit.rect);e.overlay.setSelection(a),e.lastSelectionRect=a}return}case"layoutHit":{if(e.stylebook)return;ze(e),Ge?.dismiss(),YL(t.hit),e.selectionPath=null,e.selectionPaths=[];let o=E(e);if(o)o.session.selection=[];let r=R(t.hit.rect);e.overlay.setSelection(r,`LAYOUT · ${t.hit.layoutFile}`),e.lastSelectionRect=r,xn("rightPanel");return}case"hover":{if(e.stylebook){let o=t.hit?Xo(e.stylebook.pathToTag,t.hit.path):null,r=h.stylebook.selection;if(t.hit&&o&&o!==r)e.overlay.setHover(R(t.hit.rect));else e.overlay.setHover(null);return}e.lastHover=t.hit,Za(e,t.hit);return}case"insertZones":{if(e.stylebook)return;let o=t.zones?.[0]??null;if(o)Va(e,o);else wr(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:R(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}=Ul(e);Oo({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?R(s.rect):null}else for(let s of t.hits){let c=JSON.stringify(s.path);if(c===r)a=R(s.rect);else if(e.coSelectionKeys.has(c))i.push(R(s.rect))}let l=e.stylebook?h.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,xn("leftPanel");C.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;xn("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(R(t.preview.referenceRect),t.preview.edge);else e.overlay.setDropIndicator(null);if(t.cursor){let o=Ul(e);US(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),nh(),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)Ib(E(e),{type:t.instruction},o,t.targetPath)}ve.delete(t.dragSeq),e.overlay.setDropIndicator(null),nh();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;Gt?.(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":{Ga(t.event);return}case"forwardWheel":{Ua(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&&Bt===Mc(t.path))he(e,t.path,void 0,t.prop);Bt=null,Ra+=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),ye.delete(t.reqId),o();return}case"editInput":{let o=E(e);if(o)o.doc.dirty=!0;return}case"editCommit":{let o=()=>Kn(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),qt=Mc(t.path);return}let r=o();if(Aa(r,qt,Mc(t.path)))Ia(e,t.path);qt=null,Bt=r?Mc(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}=Ul(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":{ha(t.href,e);return}case"contextMenu":{if(e.stylebook)return;ze(e);let{rect:o,scale:r}=Ul(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),Cr(e),Sr(e),es(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===ce(e.canvasEl)?.id)Ka(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 Ka(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 Ua(e,t){let{rect:o,scale:r}=Ul(e),i=Zc(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 Ga(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 Za(e,t){if(!t||Er(t.path,e.selectionPath)){e.overlay.setHover(null);return}e.overlay.setHover(R(t.rect))}var Ya=4,X=new Map;function Xa(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<=Ya)break;X.delete(r)}return o}function Qa(e,t,o,r,i,a=null){let l=Xa(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=va(i),f=OS(Ln,async()=>{Vo.renderPreparations+=1;let g=await kn(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?Ko(k):void 0,J={assets:g.assets,doc:y,docBase:g.docBase??`${rh()}/`,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 IL(e,t,o,r,i=null,a=ce(o),l=null,s=null){let c=Zt(o);c.pendingTabIds.set(e,i),c.stylebook=null,c.iframe.style.width=r?`${r}px`:"100%";let f={...await Qa(e,t,i,a,ct(o),l),colorScheme:Mr(a),gen:e,kind:"render",locale:Or(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,Ut(c,f.mode==="preview"),Tr(c,f)}function Tr(e,t){if(Vo.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 RL(e,t,o,r){let i=Zt(o);i.pendingTabIds.set(e,null),i.stylebook={pathToTag:t.pathToTag,tagToCardPath:t.tagToCardPath},Ut(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:Mr(ce(o)),locale:Or(ce(o)),doc:a,docBase:`${rh()}/`,gen:e,kind:"render",mapperCtx:{arrayPaths:[],canvasMode:"stylebook",layoutWrapped:!1,pageContentOffset:null,pageContentPrefix:null},mode:"stylebook",shadowDoc:l,siteStyle:null};Tr(i,s)}function Mr(e){let t=e?.session.ui.previewColorScheme;return t==="light"||t==="dark"?t:null}function DL(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 Nr(e){return e===null?null:{dir:ev(e),locale:e}}function Or(e){return Nr(e?Ip(e.session.ui.previewLocale,e.documentPath):null)}function NL(e,t){let o=ev(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:Nr(e)}}}function AL(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 OL(){let e=S?.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 Jw(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 Rr(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 ML(e){Ye=Rr(Xt(),e)?null:e}function es(e){let t=Ye;if(t===null||!e.stylebook)return;if(h.stylebook.selection!==t){Ye=null;return}if(e===Xt()&&Rr(e,t))Ye=null}function ql(){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 Yt=null;function PL(e,t){Yt=e,t?.(()=>sr()),sr()}function sr(){let e=Yt?.();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 ih(e){let t=N;if(!t||!t.ready)return;t.channel.post({intent:e,kind:"applyFormat"})}function FL(){let e=N;if(!e||!e.ready)return;e.channel.post({kind:"openSlash"})}function Yw(){let e=N;if(e?.editing&&e.ready&&e.iframe.isConnected)e.channel.post({kind:"endEdit"})}function Xt(){let e=ao();return e?qS(e.canvas):null}function JS(){let e=N,t=e??Xt();if(!t)return null;let{rect:o,scale:r}=Ul(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{bN,kb,vr,vt,Hr,kS,Nc,Wo,tl,yr,Ju,Ac,Yu,ES,vN,TS,yN,wN,LS,xN,$S,Zu,Eb,Tb,di,ym,YT,Fw,_N,Wl,Vl,Xu,SN,IS,ZT,Oc,Qu,CN,Lb,Cp,RS,DS,kN,NS,XT,EN,TN,Vo,jw,AS,OS,ji,eh,QT,$b,eL,LN,$N,kp,MS,IN,RN,Mc,PS,wm,DN,Hw,NN,Bw,AN,zw,Ep,Br,ON,xm,MN,PN,FS,FN,jS,jN,HS,tL,nL,BS,_m,Tp,HN,BN,Ww,Us,th,Lp,zN,WN,zS,iL,Sm,WS,VN,VS,oL,UN,rL,sL,aL,qN,Vw,lL,US,nh,nl,Uw,$p,qw,GN,KN,JN,Ib,cL,dL,uL,hL,qS,Rb,Db,GS,Ul,pL,fL,mL,Nb,j2,sP,gL,Pc,Gw,Kw,bL,vL,yL,wL,xL,_L,SL,CL,kL,EL,TL,LL,KS,$L,Ab,IL,RL,DL,NL,AL,OL,Jw,ML,ql,PL,ih,FL,Yw,JS};
3
+
4
+ //# debugId=D3E17BBC7582B01E64756E2164756E21
5
+ //# sourceMappingURL=studio-0rg30pvs.js.map
@@ -1,5 +1,5 @@
1
- import{p,_e}from"./studio-pr23qhrw.js";import{C}from"./studio-hw60n5dh.js";function v(e){return e.trim().replace(/\/+$/,"")}function u(e){return e.trim()}var pt={aiBaseUrl:{default:"",key:"jx.ai.baseUrl",normalize:v,scope:"user"},aiOpenAiKey:{default:"",key:"jx.ai.openaiKey",normalize:u,scope:"user",secret:!0},aiModel:{default:"gpt-4o",key:"jx.ai.model",normalize:u,scope:"user"},keybindings:{default:"",key:"jx.keybindings",normalize:(e)=>e.trim()==="{}"?"":e.trim(),scope:"user"},theme:{default:"",key:"jx-studio-theme",normalize:u,scope:"user"},showIgnoredFiles:{default:"",key:"jx.files.showIgnored",normalize:u,scope:"user"},developerPanels:{default:"",key:"jx.panels.developer",normalize:u,scope:"user"},cfAccountId:{default:"",key:"jx.cf.accountId",normalize:u,scope:"user"},cfToken:{default:"",key:"jx.cf.token",normalize:u,scope:"user",secret:!0}},S=Object.values(pt),f=S.filter((e)=>e.scope==="user"),P=f.map((e)=>e.key);function h(e){let t=e.schedule??queueMicrotask,n=null,i=Promise.resolve(),r=Promise.resolve();function s(){let o=n;if(n=null,!o)return i;return i=i.then(()=>e.send(o)).catch((a)=>{e.onError?.(a,o)}),i}return{enqueue(o){if(n){Object.assign(n,o);return}n={...o},r=new Promise((a)=>{t(()=>{s().then(a)})})},settled(){return r}}}var c=new Map;function m(){return typeof localStorage>"u"?void 0:localStorage}function k(e,t){try{if(t===null)m()?.removeItem(e);else m()?.setItem(e,t)}catch{}}try{for(let e of S){let t=m()?.getItem(e.key);if(t!==null&&t!==void 0)c.set(e.key,t)}}catch{}function Go(e){return c.get(e.key)??""}function EA(e){return(c.get(e.key)??"")!==""}var y=new Set;function Ap(e){return y.add(e),()=>{y.delete(e)}}function l(e){for(let t of y)t(e)}var g=h({onError(e){C("error","Your settings could not be saved.",{detail:e instanceof Error?e.message:String(e),key:"settings-write",source:"Settings"})},async send(e){if(!_e())return;let t=p();if(!t.patchSettings)return;let n={},i=[];for(let[r,s]of Object.entries(e))if(s)n[r]=s;else i.push(r);await t.patchSettings({remove:i,set:n})}});function TA(){return g.settled()}function d(e){let t=[];for(let[n,i]of Object.entries(e)){if((c.get(n)??null)===i)continue;if(i===null)c.delete(n);else c.set(n,i);k(n,i),t.push(n)}return t}function dx(e,t){return e.normalize?e.normalize(t):t}function _r(e,t){let n=dx(e,t),i=d({[e.key]:n});if(i.length>0)g.enqueue({[e.key]:n}),l(i)}function LA(e){let t={};for(let[i,r]of e)t[i.key]=dx(i,r);let n=d(t);if(n.length>0)g.enqueue(t),l(n)}function Op(e){let t={};for(let i of e)t[i.key]=null;let n=d(t);if(n.length>0)g.enqueue(t),l(n)}async function $A(){if(!_e())return;let e=p();if(!e.getSettings)return;let t;try{t=await e.getSettings()}catch{return}let n={},i=!1;for(let s of f){let o=t[s.key];if(o)n[s.key]=o;else if(c.get(s.key))i=!0}let r=d(n);if(r.length>0)l(r);if(i){let s={};for(let o of f){let a=c.get(o.key);if(a&&!t[o.key])s[o.key]=a}g.enqueue(s)}}function x(e){let t={};for(let i of f)t[i.key]=e[i.key]??null;let n=d(t);if(n.length>0)l(n)}function IA(){if(!_e())return;p().subscribeSettings?.(x)}
2
- export{pt,Go,EA,Ap,TA,dx,_r,LA,Op,$A,IA};
1
+ import{p,_e}from"./studio-9ndgd55w.js";import{C}from"./studio-tfmhnwyr.js";function v(e){return e.trim().replace(/\/+$/,"")}function u(e){return e.trim()}var pt={aiBaseUrl:{default:"",key:"jx.ai.baseUrl",normalize:v,scope:"user"},aiOpenAiKey:{default:"",key:"jx.ai.openaiKey",normalize:u,scope:"user",secret:!0},aiModel:{default:"gpt-4o",key:"jx.ai.model",normalize:u,scope:"user"},keybindings:{default:"",key:"jx.keybindings",normalize:(e)=>e.trim()==="{}"?"":e.trim(),scope:"user"},theme:{default:"",key:"jx-studio-theme",normalize:u,scope:"user"},showIgnoredFiles:{default:"",key:"jx.files.showIgnored",normalize:u,scope:"user"},developerPanels:{default:"",key:"jx.panels.developer",normalize:u,scope:"user"},cfAccountId:{default:"",key:"jx.cf.accountId",normalize:u,scope:"user"},cfToken:{default:"",key:"jx.cf.token",normalize:u,scope:"user",secret:!0}},S=Object.values(pt),f=S.filter((e)=>e.scope==="user"),P=f.map((e)=>e.key);function h(e){let t=e.schedule??queueMicrotask,n=null,i=Promise.resolve(),r=Promise.resolve();function s(){let o=n;if(n=null,!o)return i;return i=i.then(()=>e.send(o)).catch((a)=>{e.onError?.(a,o)}),i}return{enqueue(o){if(n){Object.assign(n,o);return}n={...o},r=new Promise((a)=>{t(()=>{s().then(a)})})},settled(){return r}}}var c=new Map;function m(){return typeof localStorage>"u"?void 0:localStorage}function k(e,t){try{if(t===null)m()?.removeItem(e);else m()?.setItem(e,t)}catch{}}try{for(let e of S){let t=m()?.getItem(e.key);if(t!==null&&t!==void 0)c.set(e.key,t)}}catch{}function Uo(e){return c.get(e.key)??""}function $A(e){return(c.get(e.key)??"")!==""}var y=new Set;function Np(e){return y.add(e),()=>{y.delete(e)}}function l(e){for(let t of y)t(e)}var g=h({onError(e){C("error","Your settings could not be saved.",{detail:e instanceof Error?e.message:String(e),key:"settings-write",source:"Settings"})},async send(e){if(!_e())return;let t=p();if(!t.patchSettings)return;let n={},i=[];for(let[r,s]of Object.entries(e))if(s)n[r]=s;else i.push(r);await t.patchSettings({remove:i,set:n})}});function IA(){return g.settled()}function d(e){let t=[];for(let[n,i]of Object.entries(e)){if((c.get(n)??null)===i)continue;if(i===null)c.delete(n);else c.set(n,i);k(n,i),t.push(n)}return t}function fx(e,t){return e.normalize?e.normalize(t):t}function xr(e,t){let n=fx(e,t),i=d({[e.key]:n});if(i.length>0)g.enqueue({[e.key]:n}),l(i)}function RA(e){let t={};for(let[i,r]of e)t[i.key]=fx(i,r);let n=d(t);if(n.length>0)g.enqueue(t),l(n)}function Ap(e){let t={};for(let i of e)t[i.key]=null;let n=d(t);if(n.length>0)g.enqueue(t),l(n)}async function DA(){if(!_e())return;let e=p();if(!e.getSettings)return;let t;try{t=await e.getSettings()}catch{return}let n={},i=!1;for(let s of f){let o=t[s.key];if(o)n[s.key]=o;else if(c.get(s.key))i=!0}let r=d(n);if(r.length>0)l(r);if(i){let s={};for(let o of f){let a=c.get(o.key);if(a&&!t[o.key])s[o.key]=a}g.enqueue(s)}}function x(e){let t={};for(let i of f)t[i.key]=e[i.key]??null;let n=d(t);if(n.length>0)l(n)}function NA(){if(!_e())return;p().subscribeSettings?.(x)}
2
+ export{pt,Uo,$A,Np,IA,fx,xr,RA,Ap,DA,NA};
3
3
 
4
- //# debugId=0D206F434DC20E5564756E2164756E21
5
- //# sourceMappingURL=studio-3q6n9qvq.js.map
4
+ //# debugId=5CC76FAC3845294D64756E2164756E21
5
+ //# sourceMappingURL=studio-14hh60j8.js.map
@@ -0,0 +1,5 @@
1
+ import{St,Qn,Ce,We,bh,m,_i,jt}from"./studio-ztppbam0.js";import{g}from"./studio-tfmhnwyr.js";import{p}from"./studio-9ndgd55w.js";import{Ht,fn}from"./studio-a6e5fzve.js";import{T,R,Ys,tt}from"./studio-myb4mf0h.js";import{Ta,Hd}from"./studio-8hf8qcm1.js";import{Id,eT,rS,nT,iT}from"./studio-fg4fj9ec.js";import{yb,ls,Bl,Tw,Lw,vp,Qo,yp}from"./studio-x2trkhk5.js";import{S}from"./studio-9ra9e7m4.js";import{n,Z,Q,lf}from"./studio-ywf9y1e2.js";var j={$schema:"https://jxsuite.com/schema/v1",$id:"StudioGridOpen",$description:"Every grid-able source a project has, grouped by where it comes from: the project's own pages and content collections first, then each connection's tables. It is the ISLAND of a confirm dialog rather than a dialog of its own — `ui/layers.ts`'s dialog owns the headline, the cancel button, modality and focus, and this document is only the list — because a second answer to \"what is a dialog\" is a defect (studio-ui-guidelines.md §12.5). Group headings are why it is not the kit menu: a menu row can carry a divider above it and cannot carry a name for the run it opens.",tagName:"div",attributes:{part:"sources"},style:{display:"flex",flexDirection:"column",gap:"var(--jx-space-3)",minWidth:"280px",fontFamily:"var(--jx-font-sans)",fontSize:"var(--jx-text-md)",color:"var(--fg)",'& [part="group-title"]':{margin:"0",fontSize:"var(--jx-text-xs)",fontWeight:"600",textTransform:"uppercase",letterSpacing:"0.04em",color:"var(--fg-dim)"},'& [part="rows"]':{display:"flex",flexDirection:"column",gap:"1px",marginTop:"var(--jx-space-1)"},'& [part="source"]':{textAlign:"left",background:"none",border:"none",color:"var(--fg)",font:"inherit",padding:"var(--jx-space-2) var(--jx-space-2)",borderRadius:"var(--jx-radius-sm)",cursor:"pointer"},'& [part="source"]:hover':{background:"var(--bg-hover)"},'& [part="source"]:focus-visible':{outline:"var(--jx-focus-ring)",outlineOffset:"-2px"},'& [part="group-empty"]':{margin:"0",padding:"var(--jx-space-2)",color:"var(--fg-dim)",fontSize:"var(--jx-text-sm)"}},children:[{$prototype:"Array",items:{$ref:"#/state/groups"},key:{$ref:"$map/item/key"},map:{$description:"One origin of grid-able sources. A connection with no tables says why it has none instead of drawing an empty box — an author who has not pushed a schema yet is exactly the reader who needs the sentence.",tagName:"section",attributes:{part:"group","data-group":"${$map.item.key}"},children:[{tagName:"h3",attributes:{part:"group-title"},textContent:"${$map.item.title}"},{tagName:"div",attributes:{part:"rows"},$switch:{$ref:"$map/item/state"},cases:{listed:{tagName:"div",attributes:{part:"rows-list",role:"none"},style:{display:"contents"},children:[{$prototype:"Array",items:{$ref:"$map/item/rows"},key:{$ref:"$map/item/id"},map:{tagName:"button",attributes:{part:"source",type:"button","data-source":"${$map.item.id}"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/open"},value:[{$ref:"$map/item/id"}]}]},textContent:"${$map.item.label}"}}]},empty:{tagName:"p",attributes:{part:"group-empty"},textContent:"${$map.item.emptyMessage}"}}}]}}]};T("grid-open",j);function I(e,r,t){let o=g({groups:r,open:t}),i=null,s=!1,c=R("grid-open",o,e).then((y)=>{let a=y.root;if(s)return y.dispose(),a;return i=y,a});return{dispose(){s=!0,i?.dispose(),i=null},ready:c}}function x(){try{return p()}catch{return null}}function nS(){return Q(x()?.dataRows)}async function K(){let e=x();if(!Q(e?.dataConnections))return null;return e.dataConnections()}async function HD(e){let r=x();if(!Q(r?.dataConnectionTest))return{error:"Connection tests are not supported by this backend",ok:!1};try{return await r.dataConnectionTest(e)}catch(t){return{error:t instanceof Error?t.message:String(t),ok:!1}}}async function YE(e){let r=x();if(!Q(r?.dataPush))return{applied:!1,errors:["Schema push is not supported by this backend"],plan:[]};try{return await r.dataPush(e)}catch(t){return{applied:!1,errors:[t instanceof Error?t.message:String(t)],plan:[]}}}function k(e){let t=x()?.[e];if(t===void 0)throw Error(`The ${String(e)} surface is not supported by this backend`);return t}function v(e){return k("dataRows")(e)}function M(e){return k("dataInsertRow")(e)}function E(e){return k("dataUpdateRow")(e)}function O(e){return k("dataDeleteRow")(e)}function BD(e,r,t){let o=(c)=>c.replaceAll(/([a-z0-9])([A-Z])/g,"$1_$2").replaceAll(/[^A-Za-z0-9]+/g,"_").replaceAll(/^_+|_+$/g,"").toUpperCase(),s=[r??e,t.replace(/Env$/,"")].flatMap((c)=>{let y=o(c);return y?[y]:[]}).join("_")||"SECRET";return/^\d/.test(s)?`JX_${s}`:s}var H=["id","sku","slug","Slug"];function L(e){let r=new Set;return e.map((t,o)=>{let i=t.trim()===""?`column${o+1}`:t;if(r.has(i))i=`${i}__${o+1}`;return r.add(i),i})}function J(e,r){for(let t of H){let o=e.indexOf(t);if(o===-1)continue;let i=r.rows.map((s)=>s[o]??"");if(i.every((s)=>s!=="")&&new Set(i).size===i.length)return t}return null}function A(e,r){let t=Id(e),o=L(t.headers),i=J(o,t),s=i?o.indexOf(i):-1,c=t.rows.map((d,u)=>s===-1?String(u):d[s]),y=new Map(c.map((d,u)=>[d,u])),a=bh(r,S?.projectConfig),l=a?.schema.properties??{},b=t.rows.slice(0,50).map((d)=>{let u={};for(let[C,G]of o.entries())u[G]=d[C]??"";return u}),f=new Map(Lw(b).map((d)=>[d.field,d])),w=new Map(Tw(a?.schema,{idField:i??void 0}).map((d)=>[d.field,d]));return{columns:o.map((d,u)=>{let G=(d in l?w.get(d):void 0)??f.get(d)??{editable:!0,field:d,kind:"string",title:t.headers[u]||d};return{...G,pk:d===i,title:t.headers[u]?.trim()||G.title}}),doc:t,fields:o,keys:c,keyToIndex:y,loadText:e}}function z(e,r){let t={},o=e.doc.rows[r]??[];for(let[i,s]of e.fields.entries()){let c=e.columns[i],y=o[i]??"";t[s]=c.kind==="string"||c.kind==="text"||c.kind==="readonly"?y:vp(y,c)}return t}function F(e,r){let t=e.doc.rows.map((s)=>[...s]),o=(s)=>e.fields.indexOf(s);for(let s of r.cells){let c=e.keyToIndex.get(s.rowKey),y=o(s.field);if(c===void 0||y===-1)continue;t[c][y]=Qo(s.value)}for(let s of r.inserts){let c=e.fields.map((y)=>Qo(s.cells[y]??null));t.push(c)}let i=r.deletes.map((s)=>e.keyToIndex.get(s.rowKey)).filter((s)=>s!==void 0).toSorted((s,c)=>c-s);for(let s of i)t.splice(s,1);return{...e.doc,rows:t}}function _(e,r){return{cells:e.cells.map((t)=>({field:t.field,rowKey:t.rowKey,...r})),deletes:e.deletes.map((t)=>({rowKey:t.rowKey,...r})),inserts:e.inserts.map((t)=>({error:r.error,ok:r.ok,tempKey:t.tempKey}))}}function iS(e){let r=null,t=(o=!1)=>{if(!o&&r)return r;return r=p().readFile(e).then((i)=>A(i,e)),r};return{backingPaths:()=>new Map([[e,"*"]]),capabilities:{delete:!0,insert:!0,remotePaging:!1,remoteSort:!1},async columns(){return(await t()).columns},async commit(o){let i=await t(),s=p(),c=null;try{c=await s.readFile(e)}catch{c=null}if(c!==i.loadText&&!Hd(e))return _(o,{error:"File changed on disk — refresh to reload",ok:!1,stale:!0});let y=F(i,o),a=eT(y);return Ta(e),await s.writeFile(e,a),r=Promise.resolve(A(a,e)),_(o,{ok:!0})},id:e,label:e.split("/").pop()??e,async refresh(){await t(!0)},async rows(){let o=await t(),i=o.doc.rows.map((s,c)=>({cells:z(o,c),key:o.keys[c]}));return{rows:i,total:i.length}},async serializeForSource(o){let i=await t();return eT(F(i,o))}}}var U=50;function q(e){let r=e.toLowerCase();if(/(int|real|floa|doub|num|dec)/.test(r))return"number";if(r.includes("bool"))return"boolean";if(/(timestamp|datetime|date)/.test(r))return"date";return"string"}function W(e){return!e.pk&&e.name!=="created_at"&&e.name!=="updated_at"}function X(e){if(e===void 0)return null;if(lf(e))return e;return JSON.stringify(e)}function N(e,r){let t=[],o="id",i=new Map,s=(a)=>{if(a.length>0)t=a,o=a.find((l)=>l.pk)?.name??"id"},c=(a)=>{let l={table:r};if(e)l.connection=e;if(l.limit=a?.limit??U,l.offset=a?.offset??0,a?.orderBy)l.dir=a.dir??"asc",l.orderBy=a.orderBy;return l},y=(a,l)=>{let b=a[o];if(n(b)||Z(b))return i.set(String(b),b),String(b);return`row-${l}`};return{capabilities:{delete:!0,insert:!0,remotePaging:!0,remoteSort:!0},async columns(){if(t.length===0){let a=await v(c({limit:1,offset:0}));s(a.columns)}return t.map((a)=>{let l=W(a)?q(a.type):"readonly";return{editable:l!=="readonly",field:a.name,kind:l,pk:a.pk===!0,title:a.name,widthHint:a.pk?80:void 0}})},async commit(a){let l={cells:[],deletes:[],inserts:[]},b=new Map;for(let f of a.cells){let w=b.get(f.rowKey)??[];w.push({field:f.field,value:f.value}),b.set(f.rowKey,w)}for(let[f,w]of b){let h=i.get(f),d=(u,C)=>{for(let G of w)l.cells.push({error:C,field:G.field,ok:u,rowKey:f})};if(h===void 0){d(!1,"Row has no primary key — refresh the grid");continue}try{let u={};for(let G of w)u[G.field]=G.value;let C={pk:h,set:u,table:r};if(e)C.connection=e;await E(C),d(!0)}catch(u){d(!1,u instanceof Error?u.message:String(u))}}for(let f of a.inserts)try{let w={};for(let[G,P]of Object.entries(f.cells))if(P!==null)w[G]=P;let h={table:r,values:w};if(e)h.connection=e;let{row:d}=await M(h),u=d[o],C;if(n(u)||Z(u))C=String(u),i.set(C,u);l.inserts.push({newKey:C,ok:!0,tempKey:f.tempKey})}catch(w){l.inserts.push({error:w instanceof Error?w.message:String(w),ok:!1,tempKey:f.tempKey})}for(let f of a.deletes){let w=i.get(f.rowKey);if(w===void 0){l.deletes.push({error:"Row has no primary key — refresh the grid",ok:!1,rowKey:f.rowKey});continue}try{let h={pk:w,table:r};if(e)h.connection=e;await O(h),l.deletes.push({ok:!0,rowKey:f.rowKey})}catch(h){l.deletes.push({error:h instanceof Error?h.message:String(h),ok:!1,rowKey:f.rowKey})}}return l},id:ls({connection:e??"default",kind:"data",table:r}),label:r,async refresh(){t=[],i.clear()},async rows(a){let l=await v(c(a));return s(l.columns),{rows:l.rows.map((f,w)=>{let h=y(f,w),d={};for(let u of t)d[u.name]=X(f[u.name]);return{cells:d,key:h}}),total:l.total}}}}async function ZE(e,r={}){let t=m.tabs.get(e);if(t)return jt(e,{focus:r.focus!==!1}),t;try{await Ht()}catch{}let o=iS(e),i=_i({capabilities:{modes:["grid","source"]},document:structuredClone(yb),documentPath:e,id:e,sourceFormat:fn(e)?.name??null,...r.paneId!==void 0&&{paneId:r.paneId},...r.preview===!0&&{preview:!0},...r.focus===!1&&{focus:!1}});return yp(i,o).load(),i}function D(e){let r=_i({capabilities:{modes:["grid"]},document:structuredClone(yb),documentPath:null,id:e.id});return yp(r,e).load(),r}function zD(e){let r=ls({kind:"collection",name:e}),t=m.tabs.get(r);if(t)return jt(r),t;return D(nT(e))}function oS(){let e=ls({kind:"pages"}),r=m.tabs.get(e);if(r)return jt(e),r;return D(iT())}function V(e,r){let t=ls({connection:e??"default",kind:"data",table:r}),o=m.tabs.get(t);if(o)return jt(t),o;return D(N(e,r))}function Y(e){let r=Bl(e);if(r?.kind==="pages")oS();else if(r?.kind==="collection")zD(r.name);else if(r?.kind==="data")V(r.connection,r.table)}function ee(e,r){return[{emptyMessage:"",key:"project",rows:[{id:ls({kind:"pages"}),label:"Pages"},...e.map(({name:t})=>({id:ls({kind:"collection",name:t}),label:`Collection: ${t}`}))],state:"listed",title:"Project"},...r.map((t)=>({emptyMessage:"No tables — push a schema first.",key:`data:${t.name}`,rows:t.tables.map((o)=>({id:ls({connection:t.name,kind:"data",table:o}),label:o})),state:t.tables.length===0?"empty":"listed",title:`Data · ${t.name}`}))]}async function XE(){let e=rS(),r=[];if(nS())r=(await K().catch(()=>null))?.connections??[];let t=null,o=Ys({cancelLabel:"Cancel",confirmLabel:"",headline:"Open Grid",island:(i)=>{t=I(i,ee(e,r),(s)=>{o.close(),Y(s)})},layer:tt("dialog"),onCancel:()=>o.close(),onClosed:()=>{t?.dispose(),t=null},onConfirm:()=>{},region:"grid/open"});o.ready}function te(){return[{args:Ce({name:We("The content collection's name, as project.json declares it.")}),category:"Project",id:"collection.editInGrid",level:"project",menus:["context/file","palette"],group:"5_data",requires:"a project that declares content collections",when:(e)=>e.project.open,run:(e,r)=>{let t=St("collection.editInGrid",r,"name"),o=rS().map((i)=>i.name);if(!o.includes(t))throw RangeError(`command "collection.editInGrid" argument "name": "${t}" is not a content `+"collection this project declares — it declares: "+`${o.length>0?o.join(", "):"none"}`);zD(t)},title:"Edit Collection in Grid"},{args:{additionalProperties:!1,properties:{connection:We('The connection name from project.json. Defaults to "default".'),table:We("The table to open.")},required:["table"],type:"object"},category:"Project",id:"data.openGrid",level:"project",menus:["palette"],group:"5_data",requires:"a platform that serves the data routes",when:(e)=>e.project.open,enablement:(e)=>e.capability.dataRows,run:(e,r)=>{let t=St("data.openGrid",r,"table");V(Qn("data.openGrid",r,"connection"),t)},title:"Open Data Grid"}]}function QE(e){e.registerAll(te())}
2
+ export{nS,HD,YE,BD,iS,ZE,zD,oS,XE,QE};
3
+
4
+ //# debugId=A250AC8F935882B064756E2164756E21
5
+ //# sourceMappingURL=studio-1cfyd1ys.js.map
@@ -0,0 +1,5 @@
1
+ import{_x,Yl,al,m,_i,jt}from"./studio-ztppbam0.js";import{fS,_w,LT}from"./studio-dvhxxxbd.js";import{Yk,Zk,ZR}from"./studio-aghsg0ds.js";import{o_,r_,_k}from"./studio-gczve8zf.js";var n={children:[],tagName:"div"},C2=new Set(Object.values(_x));function n_(e){return C2.has(e)}function bk(e){let o=Yl(e),r=m.tabs.get(o);if(r)return jt(o),r;return _i({capabilities:{modes:[_x[e]]},document:structuredClone(n),documentPath:null,id:o})}function vk(e,o){_i({background:!0,capabilities:{modes:[_x[e]]},document:structuredClone(n),documentPath:null,id:Yl(e),paneId:o})}function i_(e,o){let r=al(o.id);if(r==="media")return fS(e,o);if(r==="content")return Yk(e,o);return o_(e,o)}function Fg(e){_w(e),Zk(e),r_(e)}function yk(e,o){let{paneId:r}=e;if(i_(r,o))return;Fg(r);let t=al(o.id);if(t==="media"){LT(e,o);return}if(t==="content"){ZR(e,o);return}_k(e,o)}
2
+ export{C2,n_,bk,vk,i_,Fg,yk};
3
+
4
+ //# debugId=20CAC9A67B2FAB9564756E2164756E21
5
+ //# sourceMappingURL=studio-2bq7hheq.js.map