@jxsuite/studio 10.2.0 → 10.4.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 (272) hide show
  1. package/dist/chunks/{2020-bx702wqa.js → 2020-906vx2dq.js} +3 -3
  2. package/dist/chunks/adapter-hnvad61x.js +4 -0
  3. package/dist/chunks/add-new-flow-v0pm96mr.js +4 -0
  4. package/dist/chunks/cf-account-picker-xb8vvt2h.js +4 -0
  5. package/dist/chunks/cf-settings-mkbcz4z2.js +4 -0
  6. package/dist/chunks/components-w5zqwva1.js +4 -0
  7. package/dist/chunks/content-source-g38w0d3f.js +4 -0
  8. package/dist/chunks/convert-to-repeater-r8sfxjjm.js +4 -0
  9. package/dist/chunks/editor-wvf5e6j9.js +4 -0
  10. package/dist/chunks/entry-commands-t13dyw3c.js +4 -0
  11. package/dist/chunks/extension-sections-vjzw46xb.js +4 -0
  12. package/dist/chunks/file-ops-1sghzgcr.js +4 -0
  13. package/dist/chunks/files-zrqtgt41.js +4 -0
  14. package/dist/chunks/format-host-9gy76erh.js +4 -0
  15. package/dist/chunks/fs-events-45rhg3me.js +4 -0
  16. package/dist/chunks/grid-open-t4fq6bbm.js +4 -0
  17. package/dist/chunks/{grid-view-tghcwrrt.js → grid-view-2f03wcgw.js} +16 -16
  18. package/dist/chunks/icons-gb967qc8.js +4 -0
  19. package/dist/chunks/iframe-host-9aq8ze3q.js +4 -0
  20. package/dist/chunks/image-bake-4afr4y6a.js +4 -0
  21. package/dist/chunks/image-editor-x7t8jbjn.js +4 -0
  22. package/dist/chunks/index-f9qr7kzh.js +4 -0
  23. package/dist/chunks/{index-vr006kbt.js → index-yjrfeks8.js} +3 -3
  24. package/dist/chunks/{javascript-z1g3s9fd.js → javascript-hy2mws8v.js} +3 -3
  25. package/dist/chunks/{jsonMode-7szwg8c4.js → jsonMode-vj30te2h.js} +6 -6
  26. package/dist/chunks/jx-validate-r4ax11e3.js +4 -0
  27. package/dist/chunks/layers-m49nmwvx.js +4 -0
  28. package/dist/chunks/layers-panel-zr92pwdp.js +4 -0
  29. package/dist/chunks/lit-html-k2mb9k0r.js +4 -0
  30. package/dist/chunks/media-library-j74rt0w4.js +4 -0
  31. package/dist/chunks/media-open-mypr0k6b.js +4 -0
  32. package/dist/chunks/media-picker-pemtbsjv.js +4 -0
  33. package/dist/chunks/{monaco-binding-v42w9c1v.js → monaco-binding-a51py33c.js} +3 -3
  34. package/dist/chunks/monaco-buffer-pa0g6ax7.js +4 -0
  35. package/dist/chunks/{monaco-setup-7bffxd6v.js → monaco-setup-0hw9f835.js} +3 -3
  36. package/dist/chunks/notify-bwehrp7q.js +4 -0
  37. package/dist/chunks/parse-hee7ne9b.js +4 -0
  38. package/dist/chunks/platform-kv0k65cy.js +4 -0
  39. package/dist/chunks/publish-panel-vg1n880b.js +4 -0
  40. package/dist/chunks/publish-quick-4fwngwrw.js +4 -0
  41. package/dist/chunks/publish-workspace-jv4w2bx2.js +4 -0
  42. package/dist/chunks/quick-search-nh29rt8a.js +4 -0
  43. package/dist/chunks/references-vqyr5s9x.js +4 -0
  44. package/dist/chunks/right-panel-3ws9f2w0.js +4 -0
  45. package/dist/chunks/source-control-h3hcs5gy.js +4 -0
  46. package/dist/chunks/{studio-j3d2fjqz.js → studio-0939t1q1.js} +4 -4
  47. package/dist/chunks/studio-0gvvqj3h.js +5 -0
  48. package/dist/chunks/studio-0khd8xtx.js +4 -0
  49. package/dist/chunks/{studio-9b7177jq.js → studio-0x6f3nk9.js} +4 -4
  50. package/dist/chunks/studio-1410q5dw.js +5 -0
  51. package/dist/chunks/studio-1ctnw3xv.js +5 -0
  52. package/dist/chunks/studio-1ks5d9y4.js +5 -0
  53. package/dist/chunks/{studio-awxwjawq.js → studio-1y9mab9m.js} +4 -4
  54. package/dist/chunks/studio-2e4hry72.js +6 -0
  55. package/dist/chunks/studio-2kpxm0eh.js +7 -0
  56. package/dist/chunks/studio-2pk7kc7z.js +5 -0
  57. package/dist/chunks/studio-2x972v58.js +5 -0
  58. package/dist/chunks/studio-2zz4qbv9.js +5 -0
  59. package/dist/chunks/{studio-bvs9kpst.js → studio-3na1r48j.js} +8 -8
  60. package/dist/chunks/studio-3pz4t5a2.js +5 -0
  61. package/dist/chunks/studio-3qr08sxq.js +4 -0
  62. package/dist/chunks/{studio-75kcdbsk.js → studio-45mj4jqe.js} +4 -4
  63. package/dist/chunks/studio-4bgvvzhv.js +5 -0
  64. package/dist/chunks/studio-4f7thq0p.js +5 -0
  65. package/dist/chunks/studio-4fnb5648.js +5 -0
  66. package/dist/chunks/studio-4zd6an2b.js +5 -0
  67. package/dist/chunks/{studio-9rbe2xpw.js → studio-5tet77de.js} +3 -3
  68. package/dist/chunks/studio-61rg2cz5.js +5 -0
  69. package/dist/chunks/{studio-ybnwymxw.js → studio-7rrdbvex.js} +4 -4
  70. package/dist/chunks/{studio-sxdb9h3q.js → studio-90zkgne5.js} +7 -7
  71. package/dist/chunks/studio-9c6cbq2c.js +4 -0
  72. package/dist/chunks/studio-9dq7rwc7.js +5 -0
  73. package/dist/chunks/studio-9gr7xs9r.js +6 -0
  74. package/dist/chunks/studio-a88ej93p.js +7 -0
  75. package/dist/chunks/{studio-er5f383a.js → studio-abh9kfdh.js} +4 -4
  76. package/dist/chunks/studio-acer0g8w.js +5 -0
  77. package/dist/chunks/{studio-qh8berdz.js → studio-amaz545p.js} +4 -4
  78. package/dist/chunks/studio-az3wvyh2.js +5 -0
  79. package/dist/chunks/studio-bg8pzprg.js +5 -0
  80. package/dist/chunks/{studio-399a25za.js → studio-bnc50f9h.js} +4 -4
  81. package/dist/chunks/studio-brh8d2pr.js +5 -0
  82. package/dist/chunks/{studio-646nn2ys.js → studio-c2fa783p.js} +5 -5
  83. package/dist/chunks/studio-cfnn70h1.js +5 -0
  84. package/dist/chunks/{studio-rzqaz21g.js → studio-cqxj4fcy.js} +4 -4
  85. package/dist/chunks/studio-cw11h078.js +5 -0
  86. package/dist/chunks/studio-daksw8kh.js +5 -0
  87. package/dist/chunks/studio-dn56z7sn.js +5 -0
  88. package/dist/chunks/studio-egnjpyde.js +9 -0
  89. package/dist/chunks/studio-ejrypvmq.js +5 -0
  90. package/dist/chunks/studio-eqcddvc2.js +928 -0
  91. package/dist/chunks/studio-evq47j2z.js +5 -0
  92. package/dist/chunks/{studio-r7pf0rkv.js → studio-frc16j8v.js} +7 -7
  93. package/dist/chunks/studio-g0hxtcga.js +5 -0
  94. package/dist/chunks/{studio-th7z3fg7.js → studio-g9brbewz.js} +4 -4
  95. package/dist/chunks/studio-gnazwtv3.js +5 -0
  96. package/dist/chunks/studio-hfqpfmpk.js +5 -0
  97. package/dist/chunks/studio-hh394phe.js +5 -0
  98. package/dist/chunks/{studio-pjtntksy.js → studio-j0zf5x2x.js} +4 -4
  99. package/dist/chunks/studio-j5fcp6gj.js +5 -0
  100. package/dist/chunks/studio-jd1qb1st.js +7 -0
  101. package/dist/chunks/studio-jma2q8r9.js +5 -0
  102. package/dist/chunks/studio-k0xzrse2.js +64 -0
  103. package/dist/chunks/studio-k1xqrgm5.js +5 -0
  104. package/dist/chunks/studio-k2evngrj.js +7 -0
  105. package/dist/chunks/studio-k3we3kqb.js +5 -0
  106. package/dist/chunks/studio-knsjyx7n.js +5 -0
  107. package/dist/chunks/studio-mrjtnm62.js +5 -0
  108. package/dist/chunks/{studio-sevbc3xv.js → studio-n9qba0gx.js} +4 -4
  109. package/dist/chunks/{studio-ea74s8c1.js → studio-nvcn2ykc.js} +4 -4
  110. package/dist/chunks/studio-nwf0c32p.js +5 -0
  111. package/dist/chunks/studio-nzemfbkk.js +14 -0
  112. package/dist/chunks/{studio-43y04qck.js → studio-pj216fmn.js} +4 -4
  113. package/dist/chunks/{studio-4g8yb6jn.js → studio-pm17wdc4.js} +4 -4
  114. package/dist/chunks/studio-pwctzka3.js +16 -0
  115. package/dist/chunks/{studio-71m92v9s.js → studio-q80fg1d6.js} +7 -7
  116. package/dist/chunks/studio-q9hx2qp0.js +5 -0
  117. package/dist/chunks/studio-qrzmfaf6.js +5 -0
  118. package/dist/chunks/{studio-86r8hp7r.js → studio-r6mx7vm5.js} +5 -5
  119. package/dist/chunks/studio-rr00ex23.js +7 -0
  120. package/dist/chunks/{studio-4jhw38b2.js → studio-s24mhq0z.js} +4 -4
  121. package/dist/chunks/studio-sce30r7b.js +4 -0
  122. package/dist/chunks/studio-swedpd82.js +5 -0
  123. package/dist/chunks/studio-tmfcn347.js +6 -0
  124. package/dist/chunks/studio-tpxcryf2.js +5 -0
  125. package/dist/chunks/{studio-wc6za3zs.js → studio-v5wktj6f.js} +4 -4
  126. package/dist/chunks/studio-v7a7yb5w.js +9 -0
  127. package/dist/chunks/{studio-kg1abnz0.js → studio-vpevkfxw.js} +4 -4
  128. package/dist/chunks/{studio-881z1xrx.js → studio-wmjmsw0p.js} +4 -4
  129. package/dist/chunks/studio-wqfaqw4m.js +5 -0
  130. package/dist/chunks/{studio-hhp4x8xf.js → studio-xpx91fby.js} +5 -5
  131. package/dist/chunks/studio-xva3hzkv.js +5 -0
  132. package/dist/chunks/{studio-6hzdjfv0.js → studio-xx3r3sb0.js} +4 -4
  133. package/dist/chunks/{studio-cg1bfyhf.js → studio-z3fztxrp.js} +8 -8
  134. package/dist/chunks/studio-z9453ypn.js +6 -0
  135. package/dist/chunks/{tsMode-f54j66ym.js → tsMode-jg1dtphj.js} +7 -7
  136. package/dist/chunks/workspace-6ztqcrsh.js +4 -0
  137. package/dist/chunks/workspace-home-rse9h8a0.js +4 -0
  138. package/dist/chunks/{ws-client-e8kj684q.js → ws-client-arz2qsy9.js} +3 -3
  139. package/dist/iframe-entry.js +13 -13
  140. package/dist/manifest.json +83 -78
  141. package/dist/studio.js +84 -84
  142. package/package.json +11 -11
  143. package/src/browse/library-pane.ts +44 -29
  144. package/src/browse/library-preview.ts +6 -2
  145. package/src/canvas/asset-refs.ts +13 -4
  146. package/src/canvas/asset-resolve.ts +54 -11
  147. package/src/canvas/canvas-render.ts +25 -0
  148. package/src/canvas/iframe-entry.ts +5 -1
  149. package/src/canvas/iframe-host.ts +16 -6
  150. package/src/canvas/iframe-protocol.ts +9 -1
  151. package/src/commands/context.ts +5 -0
  152. package/src/commands/live-context.ts +5 -2
  153. package/src/editor/shortcuts.ts +3 -0
  154. package/src/files/asset-versions.ts +108 -2
  155. package/src/files/file-ops.ts +11 -1
  156. package/src/files/files.ts +111 -48
  157. package/src/files/media-paths.ts +12 -4
  158. package/src/files/media-upload.ts +195 -21
  159. package/src/files/new-file-name.ts +39 -1
  160. package/src/media/image-bake.ts +164 -0
  161. package/src/media/image-editor.ts +846 -0
  162. package/src/media/image-format.ts +262 -0
  163. package/src/media/image-recipe.ts +651 -0
  164. package/src/media/media-commands.ts +65 -1
  165. package/src/media/media-library-model.ts +1 -1
  166. package/src/media/media-library.ts +175 -15
  167. package/src/media/media-open.ts +156 -3
  168. package/src/media/media-pane.ts +8 -4
  169. package/src/panels/pane-context.ts +6 -1
  170. package/src/panels/tab-strip.ts +12 -3
  171. package/src/studio.ts +13 -2
  172. package/src/surfaces/image-editor.json +1390 -0
  173. package/src/surfaces/image-editor.ts +272 -0
  174. package/src/surfaces/inspector-dock.json +3 -3
  175. package/src/surfaces/media-library.json +129 -1
  176. package/src/surfaces/media-library.ts +17 -2
  177. package/src/types.ts +2 -1
  178. package/src/workspace/tab-workspace.ts +2 -1
  179. package/src/workspace/workspace-switch.ts +3 -1
  180. package/src/workspace/workspace.ts +22 -1
  181. package/dist/chunks/adapter-pp011m5x.js +0 -4
  182. package/dist/chunks/add-new-flow-ecqmzz76.js +0 -4
  183. package/dist/chunks/cf-account-picker-c07znkqt.js +0 -4
  184. package/dist/chunks/cf-settings-0v2bmqy0.js +0 -4
  185. package/dist/chunks/components-yn0dn2pq.js +0 -4
  186. package/dist/chunks/content-source-g0j41yy6.js +0 -4
  187. package/dist/chunks/convert-to-repeater-sbjk7tgn.js +0 -4
  188. package/dist/chunks/editor-xz02jeh1.js +0 -4
  189. package/dist/chunks/entry-commands-kmt02crp.js +0 -4
  190. package/dist/chunks/extension-sections-0rprf12d.js +0 -4
  191. package/dist/chunks/file-ops-mexj5qed.js +0 -4
  192. package/dist/chunks/files-b2tcppdd.js +0 -4
  193. package/dist/chunks/format-host-btsevv0c.js +0 -4
  194. package/dist/chunks/fs-events-r0apejva.js +0 -4
  195. package/dist/chunks/grid-open-n2a8xkht.js +0 -4
  196. package/dist/chunks/icons-853n6qt3.js +0 -4
  197. package/dist/chunks/iframe-host-gx0ypyh3.js +0 -4
  198. package/dist/chunks/index-bs4k9tr6.js +0 -4
  199. package/dist/chunks/jx-validate-ymf10teh.js +0 -4
  200. package/dist/chunks/layers-p9nfya38.js +0 -4
  201. package/dist/chunks/layers-panel-tt1hzhhf.js +0 -4
  202. package/dist/chunks/lit-html-x18n2sfz.js +0 -4
  203. package/dist/chunks/media-library-0n45gv8r.js +0 -4
  204. package/dist/chunks/media-picker-s09at95z.js +0 -4
  205. package/dist/chunks/monaco-buffer-een2ea0v.js +0 -4
  206. package/dist/chunks/notify-qwb8radt.js +0 -4
  207. package/dist/chunks/parse-v77xtwv7.js +0 -4
  208. package/dist/chunks/platform-8jnez0wr.js +0 -4
  209. package/dist/chunks/publish-panel-aysnj611.js +0 -4
  210. package/dist/chunks/publish-quick-kpbqs9mz.js +0 -4
  211. package/dist/chunks/publish-workspace-nd0a8q99.js +0 -4
  212. package/dist/chunks/quick-search-vg0jkhk2.js +0 -4
  213. package/dist/chunks/references-a7v6a0e2.js +0 -4
  214. package/dist/chunks/right-panel-cvk1vxx5.js +0 -4
  215. package/dist/chunks/source-control-fsqzc6he.js +0 -4
  216. package/dist/chunks/studio-05jfwbmf.js +0 -5
  217. package/dist/chunks/studio-0q5jwddh.js +0 -9
  218. package/dist/chunks/studio-0w2dr0q8.js +0 -5
  219. package/dist/chunks/studio-1tzpds97.js +0 -9
  220. package/dist/chunks/studio-216b27sv.js +0 -4
  221. package/dist/chunks/studio-2ejhqns4.js +0 -5
  222. package/dist/chunks/studio-2r90cts3.js +0 -16
  223. package/dist/chunks/studio-399xknkb.js +0 -6
  224. package/dist/chunks/studio-4ncmwqw5.js +0 -5
  225. package/dist/chunks/studio-5atwjgkj.js +0 -7
  226. package/dist/chunks/studio-5frqk7c0.js +0 -5
  227. package/dist/chunks/studio-6cwj6xrx.js +0 -5
  228. package/dist/chunks/studio-78pywnp2.js +0 -6
  229. package/dist/chunks/studio-886t6ztg.js +0 -5
  230. package/dist/chunks/studio-8wnvtr4z.js +0 -5
  231. package/dist/chunks/studio-8z66jk4z.js +0 -5
  232. package/dist/chunks/studio-b2qpt0xy.js +0 -14
  233. package/dist/chunks/studio-c71806xz.js +0 -7
  234. package/dist/chunks/studio-cbwks69x.js +0 -928
  235. package/dist/chunks/studio-cg710sk9.js +0 -5
  236. package/dist/chunks/studio-cw0wb9qk.js +0 -7
  237. package/dist/chunks/studio-cyheys7k.js +0 -5
  238. package/dist/chunks/studio-ea5m9kg5.js +0 -5
  239. package/dist/chunks/studio-efdxjwyp.js +0 -64
  240. package/dist/chunks/studio-egmw2837.js +0 -5
  241. package/dist/chunks/studio-f746039f.js +0 -5
  242. package/dist/chunks/studio-fmdymd9v.js +0 -5
  243. package/dist/chunks/studio-gcm12z00.js +0 -6
  244. package/dist/chunks/studio-gj98m8gy.js +0 -7
  245. package/dist/chunks/studio-hasbgjah.js +0 -5
  246. package/dist/chunks/studio-hz5n7x27.js +0 -5
  247. package/dist/chunks/studio-jeraxdgv.js +0 -7
  248. package/dist/chunks/studio-jvgek9xt.js +0 -5
  249. package/dist/chunks/studio-jws1a87n.js +0 -5
  250. package/dist/chunks/studio-k2sz13zg.js +0 -5
  251. package/dist/chunks/studio-k3m4jkdk.js +0 -5
  252. package/dist/chunks/studio-kg5ya5r2.js +0 -5
  253. package/dist/chunks/studio-khwbgrtg.js +0 -5
  254. package/dist/chunks/studio-mx6wzh25.js +0 -5
  255. package/dist/chunks/studio-mxs3ar9t.js +0 -5
  256. package/dist/chunks/studio-nm4szey4.js +0 -5
  257. package/dist/chunks/studio-nqxqf8p2.js +0 -4
  258. package/dist/chunks/studio-qn7z4krm.js +0 -5
  259. package/dist/chunks/studio-qyed0ah6.js +0 -5
  260. package/dist/chunks/studio-r4bcdwhq.js +0 -5
  261. package/dist/chunks/studio-rtfnhrdg.js +0 -5
  262. package/dist/chunks/studio-s5tzw84t.js +0 -5
  263. package/dist/chunks/studio-t51y8v1d.js +0 -5
  264. package/dist/chunks/studio-t98vq4r6.js +0 -5
  265. package/dist/chunks/studio-tsxpqvh0.js +0 -6
  266. package/dist/chunks/studio-v1yascv2.js +0 -5
  267. package/dist/chunks/studio-wxq6v5sv.js +0 -5
  268. package/dist/chunks/studio-y60sts62.js +0 -4
  269. package/dist/chunks/studio-zndrqawb.js +0 -5
  270. package/dist/chunks/studio-zwaxn5s2.js +0 -5
  271. package/dist/chunks/workspace-home-x1787wpv.js +0 -4
  272. package/dist/chunks/workspace-zpe1np43.js +0 -4
@@ -0,0 +1,5 @@
1
+ import{rt,Eo,xr,zp}from"./studio-g9brbewz.js";function hb(){return Eo(rt.cfToken)}function AE(t){xr(rt.cfToken,t||"")}function OE(){return Eo(rt.cfAccountId)}function dF(t){xr(rt.cfAccountId,t||"")}function ME(){zp([rt.cfToken,rt.cfAccountId])}
2
+ export{hb,AE,OE,dF,ME};
3
+
4
+ //# debugId=C45832926A8EF0DB64756E2164756E21
5
+ //# sourceMappingURL=studio-k1xqrgm5.js.map
@@ -0,0 +1,7 @@
1
+ import{X}from"./studio-9c6cbq2c.js";import{w}from"./studio-sce30r7b.js";import{Jt,Ut}from"./studio-nzemfbkk.js";import{sn,dt}from"./studio-tpxcryf2.js";import{Ve,vt,E,R}from"./studio-9dq7rwc7.js";import{g}from"./studio-3qr08sxq.js";var _={$schema:"https://jxsuite.com/schema/v1",$id:"StudioGithubAuth",$description:"The RFC 8628 device flow's waiting room: the code GitHub minted, the page to type it into, and a Cancel. A `jx-dialog`, so the platform owns modality, Escape, focus restoration and the backdrop — and it is the reason the dialog has no confirm button at all: the answer arrives from GitHub over a poll rather than from anything the reader can press here, so a primary button would be a control with nothing to do. Nothing in this document talks to GitHub: `github/github-auth.ts` keeps the client id, the poll loop, its failure budget and every report the three outcomes raise.",tagName:"jx-dialog",$props:{headline:"Sign in to GitHub",confirmLabel:"",cancelLabel:"Cancel",size:"sm"},attributes:{part:"github-auth"},oncancel:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/cancel"},value:[]}]},onclose:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/closed"},value:[]}]},style:{$description:"Four `.github-auth-*` rules in `styles/overlays.css` become the parts below, and two things in them do not travel. `.github-auth-dialog`'s `padding: 16px 0` was the card's own body padding drawn by hand, and `jx-dialog` already pads its body; `.github-auth-dialog p { font-size: 13px }` was a body size this surface picked for itself, and what the paragraphs now inherit is the dialog's own `--jx-text-md`. The `8px 0` margins go with them — the column is a flex column with a gap, so a margin between two rows would be a second opinion about the same space. The code keeps its 24px, which is above the token scale on purpose: it is a string the reader has to copy onto another screen, and reading it out loud is the whole job of this dialog.",'& [part="device"]':{display:"flex",flexDirection:"column",alignItems:"center",gap:"var(--jx-space-3)",textAlign:"center"},'& [part="lede"], & [part="waiting"]':{margin:"0"},'& [part="code"]':{$description:"`<code>`, not a styled `<div>`: this is a literal string to be transcribed, and the element that says so is also the one a reader's own stylesheet and a screen reader's character-by-character mode already know about. It is this dialog's message, and the one string in it the reader must carry to another screen, so it opts back in to selection against the root's `user-select: none`. `all` rather than `text`: one click selects the whole code, so a copy never leaves a character behind.",userSelect:"all",fontFamily:"var(--font-mono)",fontSize:"24px",fontWeight:"700",letterSpacing:"2px",padding:"var(--jx-space-3) var(--jx-space-4)",background:"var(--hover-bg)",borderRadius:"var(--radius)"},'& [part="link"]':{$description:"The blue this carried as a `var(--accent, …)` fallback is gone: `--accent` is declared on `:root` in `styles/tokens.css`, so the fallback could only ever have painted when the token was missing — which is a theme fault to fix rather than a colour to hard-code.",color:"var(--accent)",textDecoration:"underline"},'& [part="waiting"]':{color:"var(--fg-dim)",fontStyle:"italic"}},children:[{tagName:"div",attributes:{part:"device"},children:[{tagName:"p",attributes:{part:"lede"},textContent:"Enter this code on GitHub to authorize Jx Studio:"},{tagName:"code",attributes:{part:"code"},textContent:"${state.userCode}"},{tagName:"a",attributes:{part:"link",href:"${state.verificationUri}",target:"_blank",rel:"noreferrer"},textContent:"Open ${state.verificationUri}"},{tagName:"p",attributes:{part:"waiting"},textContent:"Waiting for authorization…"}]}]};E("github-auth",_);function A(e){let t=document.createElement("div");t.style.pointerEvents="auto",t.setAttribute(Ve,vt("dialog","github-auth")),e.layer.append(t);let s=!1,l=()=>{if(s)return;s=!0,e.onClosed()},u=()=>s,b=g({cancel:()=>{e.onCancel()},closed:l,userCode:e.userCode,verificationUri:e.verificationUri}),n=null,r=R("github-auth",b,t).then(async(i)=>{n=i;let o=i.root;if(u())return i.dispose(),o;if(await sn(o),u())return o;return Jt(o),o});return{close(){let i=n?.root;if(i instanceof HTMLElement)Ut(i);n?.dispose(),n=null,t.remove(),l()},host:t,ready:r}}var S="jx_github_token",v="Ov23liYVlMFpgjOEPXJH";function P(e){return typeof e==="object"&&e!==null&&"githubAuth"in e&&e.githubAuth!=null}function p(){let e=globalThis,t="__jxPlatform"in e?e.__jxPlatform:void 0;return P(t)?t.githubAuth:null}var f=null,C=!1;function H(e){f=e}function vL(){return f!==null||C||localStorage.getItem("jx_github_token")!==null}function yL(){return p()?"desktop":"browser"}function y(){return f??localStorage.getItem("jx_github_token")}function wL(){f=null,C=!1,localStorage.removeItem("jx_github_token"),p()?.signOut().catch(()=>{})}var O="github.auth",j="Source Control",N="git.signInToGithub",Y=3,z="The request never reached GitHub. GitHub's device-flow endpoints send no CORS headers, so a "+"browser cannot call them directly — the desktop app can. A machine that is offline fails "+"identically, and the browser does not say which happened.";function I(e){w.error("Could not reach GitHub to sign in.",{action:N,detail:`${z}
2
+
3
+ ${X(e)}`,key:O,source:j})}function T(e,t){w.warn(e,{action:N,detail:t,key:O,source:j})}async function F(){let e;try{e=await fetch("https://github.com/login/device/code",{body:JSON.stringify({client_id:v,scope:"repo"}),headers:{Accept:"application/json","Content-Type":"application/json"},method:"POST"})}catch(t){return I(t),null}if(!e.ok)return T("GitHub refused to start the sign-in.",`GitHub answered ${e.status}${e.statusText?` ${e.statusText}`:""}.`),null;return await e.json()}async function ZS(){let e=y();if(e)return e;let t=p();if(t)try{let{token:r}=await t.signIn();return H(r),r}catch(r){return T("GitHub sign-in was not completed.",X(r)),null}let s=await F();if(!s)return null;let{device_code:l,user_code:u,verification_uri:b,interval:n=5}=s;return new Promise((r)=>{let i=!1,o=null,m=0,k=!1,L=(c)=>{if(k)return;if(k=!0,i=!0,o)clearTimeout(o),o=null;r(c)},x=!1,G=()=>{if(x)return;x=!0,D.close()},d=(c)=>{L(c),G()},h=async()=>{if(i)return;try{let a=await(await fetch("https://github.com/login/oauth/access_token",{body:JSON.stringify({client_id:v,device_code:l,grant_type:"urn:ietf:params:oauth:grant-type:device_code"}),headers:{Accept:"application/json","Content-Type":"application/json"},method:"POST"})).json();if(m=0,a.access_token){localStorage.setItem(S,a.access_token),d(a.access_token);return}if(a.error==="authorization_pending"){o=setTimeout(h,n*1000);return}if(a.error==="slow_down"){o=setTimeout(h,(n+5)*1000);return}T("GitHub sign-in was not completed.",a.error==="access_denied"?"The authorization was declined on GitHub.":a.error==="expired_token"?"The device code expired before it was entered.":`GitHub answered "${a.error??"an unrecognised response"}".`),d(null)}catch(c){if(m+=1,m>=Y){I(c),d(null);return}o=setTimeout(h,n*1000)}},D=A({layer:dt("dialog"),onCancel:()=>{G()},onClosed:()=>{d(null)},userCode:u,verificationUri:b});o=setTimeout(h,n*1000)})}
4
+ export{vL,yL,wL,ZS};
5
+
6
+ //# debugId=A116AF93B212CC5864756E2164756E21
7
+ //# sourceMappingURL=studio-k2evngrj.js.map
@@ -0,0 +1,5 @@
1
+ function n(e){return typeof e==="string"}function Y(e){return typeof e==="number"}function Ze(e){return typeof e==="boolean"}function x2(e){return typeof e==="bigint"}function Gv(e){return typeof e==="symbol"}function Q(e){return typeof e==="function"}function _(e){return typeof e==="object"&&e!==null}function wf(e){return e===null||n(e)||Y(e)||Ze(e)}function v(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function Pe(e){return v(e)&&typeof e.$ref==="string"}function Ha(e){return v(e)&&e.$prototype==="Function"}function lc(e){return v(e)&&v(e.$expression)}function E0(e){return lc(e)&&Array.isArray(e.parameters)&&e.parameters.length>0}function oR(e){return Ha(e)&&Array.isArray(e.body)}function Kv(e){return v(e)&&typeof e.$prototype==="string"&&e.$prototype!=="Function"}function rR(e){return v(e)&&e.timing==="server"&&typeof e.$src==="string"&&typeof e.$export==="string"&&!e.$prototype}function Go(e){return v(e)&&e.$prototype==="Array"}function Jn(e){return v(e)}function Ba(e){return typeof e==="string"&&e.includes("${")}function sR(e){return/\breturn\b[^\S\n]*(?![;}\s]|$)/.test(e)}function xl(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function Di(e,t){let r=e?.[t];return xl(r)?r:void 0}function ld(e,t){let r=e[t];if(xl(r))return r;let o={};return e[t]=o,o}function xf(e){return Pe(e)||Ha(e)||lc(e)}function pg(e,t){let r=e[t];return xf(r)?r:void 0}function T0(e){if(!e)return[];return e.map((t)=>n(t)?t:t.name)}function i(e){return typeof e==="string"}function jh(e){if(typeof e!=="object"||e===null||Array.isArray(e)||!v(e.$expression))return!1;let t=e.$expression;if(t.operator==="?:")return typeof t.value==="string"&&typeof t.initial==="string";if(t.operator==="switch")return v(t.cases)&&Object.values(t.cases).every((r)=>n(r))&&typeof t.default==="string";return!1}function aR(e){if(i(e))return[e];if(!jh(e))return[];let t=e.$expression;if(t.operator==="?:")return[...new Set([t.value,t.initial])];return[...new Set([...Object.values(t.cases),t.default])]}function it(e){return i(e)?e:aR(e).join("|")}function cd(e){return e.startsWith("#")}
2
+ export{n,Y,Ze,x2,Gv,Q,_,wf,v,Pe,Ha,lc,E0,oR,Kv,rR,Go,Jn,Ba,sR,xl,Di,ld,xf,pg,T0,jh,aR,it,cd};
3
+
4
+ //# debugId=A0E20505ACB400C964756E2164756E21
5
+ //# sourceMappingURL=studio-k3we3kqb.js.map
@@ -0,0 +1,5 @@
1
+ import{w}from"./studio-sce30r7b.js";import{nu}from"./studio-swedpd82.js";import{p}from"./studio-4fnb5648.js";import{Wi,fn,lr}from"./studio-q9hx2qp0.js";import{qI,b1,$o,o2,g0,GI,KI,JI,zv}from"./studio-nvcn2ykc.js";import{$v,LI,Cr,C}from"./studio-4f7thq0p.js";import{Ce,oe,Ov,Mv,h1,df,p1,na,uf,sg,d0}from"./studio-v5wktj6f.js";import{me,ia,te,g,le,Ph}from"./studio-3qr08sxq.js";import{n,Y,Ze,_,v,Go,Di,ld,xf}from"./studio-k3we3kqb.js";import{ce}from"./studio-0939t1q1.js";var we=g(new Set);function qm(e){we.add(e)}function Vx(e){we.delete(e)}function ZC(e){return we.has(e)}var lI=()=>({kind:"proceed"});function vv(e,t){return{success:!0,data:e,summary:t}}function Hn(e){return{success:!1,error:e}}function Vr({name:e,description:t,parameters:o,strict:r=!0,llmStrict:i=!1,interactive:s,title:a,annotations:l,interaction:c,settle:u,execute:d}){let f={name:e,description:t,parameters:o,strict:r,llmStrict:i,execute:d};if(s!==void 0)f.interactive=s;if(a!==void 0)f.title=a;if(l!==void 0)f.annotations=l;if(c!==void 0)f.interaction=c;if(u!==void 0)f.settle=u;return f}function Ux(e){let t=[];return{record(o){t.push(o),e?.(o)},writes:t}}function yh(e=null,t={}){let o=new Map(Object.entries(t));return{sessionId:e,get:(r)=>o.get(r),set:(r,i)=>{o.set(r,i)},toJSON:()=>Object.fromEntries(o)}}var Qt=new AbortController().signal;function qx(e={}){let t=e.session??yh();return{actor:e.actor??{id:`assistant:${t.sessionId??"local"}:`,kind:"assistant",sessionId:t.sessionId,turnId:""},callId:e.callId??"",ledger:e.ledger??Ux(),progress:e.progress??(()=>{}),session:t,signal:e.signal??Qt}}function GO(e){let t=new AbortController;if(e.aborted)return t.abort(e.reason),{release:()=>{},signal:t.signal};let o=()=>{t.abort(e.reason)};return e.addEventListener("abort",o,{once:!0}),{release:()=>{e.removeEventListener("abort",o)},signal:t.signal}}function Gx(){let e=new Map;return{register(t){if(e.has(t.name))console.warn(`Tool "${t.name}" is being re-registered.`);e.set(t.name,t)},list(){return[...e.values()]},listForLLM(){return[...e.values()].map((t)=>{let o={name:t.name,description:t.description,parameters:t.parameters};if(t.llmStrict===!0)o.strict=!0;return{type:"function",function:o}})},getDefinition(t){return e.get(t)},validate(t,o){let r=e.get(t);if(!r)return{valid:!1,errors:[`Unknown tool: "${t}"`]};if(!r.strict)return{valid:!0};let i=r.parameters;if(!i.properties)return{valid:!0};let s=[],a=i.properties,l=i.required||[];for(let c of l)if(!(c in o)||o[c]===void 0||o[c]===null)s.push(`Missing required argument: "${c}"`);for(let[c,u]of Object.entries(o)){let d=a[c];if(!d)continue;let f=d.type;if(!f)continue;let x=ze(u);if(f==="number"||f==="integer"){if(Re(u,"number"))continue;if(Re(u,"string")){if(!Number.isNaN(Number(u)))continue;s.push(`Argument "${c}" should be a number, got non-numeric string "${u}"`);continue}s.push(`Argument "${c}" should be a number, got ${x}`);continue}if(f==="string"&&x!=="string")s.push(`Argument "${c}" should be a string, got ${x}`);else if(f==="boolean"&&x!=="boolean")s.push(`Argument "${c}" should be a boolean, got ${x}`);else if(f==="array"&&x!=="array")s.push(`Argument "${c}" should be an array, got ${x}`);else if(f==="object"&&x!=="object")s.push(`Argument "${c}" should be an object, got ${x}`)}return s.length>0?{valid:!1,errors:s}:{valid:!0}},async execute(t,o,r=qx()){let i=e.get(t);if(!i)return Hn(`Unknown tool: "${t}"`);let s=this.validate(t,o);if(!s.valid)return Hn(`Validation failed: ${(s.errors||[]).join("; ")}`);try{return await i.execute(o,r)}catch(a){return Hn(`Tool "${t}" execution error: ${ge(a)}`)}}}}var en="The author declined this call.";function tn(e){return JSON.parse(JSON.stringify(e))}function ge(e){return e.message}var nn=["string","number","boolean","undefined"];function Re(e,t){return typeof e===t}function on(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function ze(e){if(Array.isArray(e))return"array";return nn.find((t)=>Re(e,t))??"object"}function rn(e){if(!e)return{};let t=JSON.parse(e);if(!on(t)){let o=t===null?"null":ze(t);throw TypeError(`arguments must be a JSON object, got ${o}`)}return t}async function cI(e,t,o,{approval:r=lI,response:i}={}){let s=!1,a;try{let l=rn(t.argumentsText),c=e.getDefinition(t.name),u=c?sn(e,c,l,r,i):null;if(u?.status==="needs_input")return u;if(u)({result:a}=u);else s=!0,a=await e.execute(t.name,l,o)}catch(l){a=Hn(`Failed to parse arguments: ${ge(l)}`)}try{return{status:"done",result:tn(a),executed:s}}catch(l){let c=ge(l);return{status:"done",result:Hn(`Tool "${t.name}" returned a result that cannot be serialized: ${c}`),executed:s}}}function sn(e,t,o,r,i){let{interaction:s,settle:a}=t;if(s&&a){let c=e.validate(t.name,o);if(!c.valid)return pe(`Validation failed: ${(c.errors||[]).join("; ")}`);if(i)return{status:"done",result:cn(t.name,a,o,i),executed:!1};let u=s(o);return"refusal"in u?pe(u.refusal):{status:"needs_input",request:u}}let l=r(t,o);if(l.kind==="deny")return pe(l.message);if(l.kind==="confirm"){if(!i)return{status:"needs_input",request:{kind:"approval",reason:l.reason,summary:l.summary,title:t.title??t.name,tool:t.name}};if(i.kind!=="approval"||!i.approved)return pe(en)}return null}function pe(e){return{status:"done",result:Hn(e),executed:!1}}function cn(e,t,o,r){try{return t(o,r)}catch(i){return Hn(`Tool "${e}" execution error: ${ge(i)}`)}}var un=new Set(["Adlm","Arab","Aran","Armi","Avst","Cprt","Egyd","Egyh","Elym","Gara","Hatr","Hebr","Hluw","Hung","Khar","Lydi","Mand","Mani","Mend","Merc","Mero","Narb","Nbat","Nkoo","Orkh","Palm","Phli","Phlp","Phnx","Prti","Rohg","Samr","Sarb","Sogd","Sogo","Syrc","Thaa","Todr","Yezi"]),KC="^[A-Za-z]{2,8}(-[A-Za-z0-9]{1,8})*$";function jn(e){if(!n(e)||e.trim()==="")return null;try{return new Intl.Locale(e.trim()).toString()}catch{return null}}function Fx(e){return jn(e)!==null}function fv(e){let t=jn(e);if(t===null)return"ltr";let o=new Intl.Locale(t),r=o.script??o.maximize().script;return r!==void 0&&un.has(r)?"rtl":"ltr"}function Wt(e){let t=jn(e);if(t===null)return n(e)?e:"";return new Intl.DisplayNames([t],{type:"language"}).of(t)??t}var dn="prefix-except-default";function ln(e){let t=e.i18n,o=[];if(!_(t))return{errors:o,i18n:null};let r=Array.isArray(t.locales)?t.locales:[],i=[];for(let l of r){let c=jn(l);if(c===null){o.push(`i18n.locales: "${String(l)}" is not a well-formed BCP 47 language tag.`);continue}if(!i.includes(c))i.push(c)}let s=jn(t.defaultLocale)??i[0]??null;if(t.defaultLocale!==void 0&&jn(t.defaultLocale)===null)o.push(`i18n.defaultLocale: "${String(t.defaultLocale)}" is not a well-formed BCP 47 language tag.`);if(s===null)return o.push("i18n is declared with no usable locale — set `defaultLocale` or `locales`."),{errors:o,i18n:null};if(!i.includes(s))i.unshift(s);let a=t.routing==="prefix-always"||t.routing==="prefix-except-default"?t.routing:dn;return{errors:o,i18n:{defaultLocale:s,locales:i,routing:a}}}function go(e,t){let o=Ae(q(e),t);if(o===-1||t===null)return null;return jn(q(e)[o])}function jx(e,t){let o=go(e,t);if(o!==null||t===null||t.routing!=="prefix-except-default")return o;return q(e)[0]==="pages"?t.defaultLocale:null}function mv(e,t){let o=q(e),r=Ae(o,t);return r===-1?o.join("/"):o.filter((i,s)=>s!==r).join("/")}function Qc(e,t,o){if(o===null)return null;let r=jn(t);if(r===null||!o.locales.includes(r))return null;let i=q(e),s=Ae(i,o),a=s===-1?mn(i):s;if(a===-1)return null;let l=s===-1?i:i.filter((c,u)=>u!==s);if(r===o.defaultLocale&&o.routing==="prefix-except-default")return l.join("/");return l.toSpliced(a,0,r.toLowerCase()).join("/")}function q(e){return e.replace(/^\.\//,"").split("/").filter(Boolean)}function Ae(e,t){if(t===null)return-1;return e.findIndex((o)=>{let r=jn(o);return r!==null&&t.locales.includes(r)})}function mn(e){if(e[0]==="pages"&&e.length>1)return 1;if(e[0]==="content"&&e.length>2)return 2;return-1}function VO(e,t){if(t===null)return null;let o=e.split("/").find(Boolean);if(o===void 0)return t.defaultLocale;let r=jn(o);return r!==null&&t.locales.includes(r)?r:t.defaultLocale}function fI(e,t){return Ye(e,"v",t)}function Yx(e,t){return Ye(e,"r",t)}function Ye(e,t,o){if(!n(o)||o==="")return e;let r=e.indexOf("#"),i=r===-1?"":e.slice(r),s=r===-1?e:e.slice(0,r),a=s.indexOf("?"),l=a===-1?s:s.slice(0,a),u=(a===-1?[]:s.slice(a+1).split("&")).filter((d)=>d!==""&&!gn(d,t));return u.push(`${t}=${encodeURIComponent(o)}`),`${l}?${u.join("&")}${i}`}function gn(e,t){let o=e.indexOf("="),r=o===-1?e:e.slice(0,o);if(r===t)return!0;if(!r.includes("%"))return!1;try{return decodeURIComponent(r)===t}catch{return!1}}function Je(e,t){if(!e||!Object.hasOwn(e,t))return;let o=e[t];return n(o)?o:void 0}function xv(e,t,o=[]){if(!e||!t)return null;let r=e.replaceAll("\\","/").replace(/^\.\//,""),i=null,s=(a,l)=>{if(r.startsWith(`${a}/`)&&(!i||a.length>i.dir.length))i={dir:a,urlPrefix:l}};for(let[a,l]of Object.entries(t)){if(!l?.source||!b1.test(a))continue;let c=bn(l.source);if(c===""||c.startsWith(".."))continue;if(c.includes($o)){let u=yn(r,c,a,o);if(u)s(u.dir,u.urlPrefix);continue}if(/\.[a-z0-9]+$/i.test(c))continue;s(c,`/${qI}/${a}`)}return i}function yn(e,t,o,r){let i=t.indexOf($o),s=t.slice(0,i),a=t.slice(i+$o.length);if(!e.startsWith(s))return null;let l=e.slice(s.length).split("/")[0]??"";if(l===""||!b1.test(l))return null;let c=r.find((d)=>d.toLowerCase()===l.toLowerCase());if(c===void 0||!b1.test(c))return null;return{dir:`${s}${l}${a}`.replace(/\/+$/,""),urlPrefix:`/${qI}/${o}/${c}`}}function bn(e){return e.replaceAll("\\","/").replace(/^\.\//,"").replace(/\/+$/,"")}function _v(e,t){if(!t||e==="")return null;if(t.space==="repo"){if(!t.fileBaseUrl)return null;let s=JI(e,t.documentDir,t.mounts,t.lanes);if(s===null)return null;let{suffix:a}=g0(e);return Yx(fI(`${t.fileBaseUrl}${zv(s)}${a}`,Je(t.versions,s)),Je(t.revisions,s))}let[o]=t.mounts,r=o?Tn(e,t.documentDir,o):null,i=hn(e,t);return i===void 0?r:Yx(r??e,i)}function hn(e,t){if(!t.revisions||Object.keys(t.revisions).length===0)return;let o=JI(e,t.documentDir,t.mounts,t.lanes);return o===null?void 0:Je(t.revisions,o)}function Tn(e,t,o){if(GI(e))return null;let{path:r,suffix:i}=g0(e),s;try{s=decodeURIComponent(r)}catch{return null}let a=KI(t,s);if(a===null)return null;let l=o2([o],a);if(!l)return null;return`${l}${i}`}function Xe(e){return e.replaceAll(/[.*+?^${}()|[\]\\]/g,String.raw`\$&`)}function G(e){return e.replaceAll("\\","/").replace(/^\.\//,"").replace(/\/+$/,"")}function et(e){return e??C?.projectConfig??null}function tt(e){return e?.content??{}}function vn(e){let t=ln(e??{}).i18n?.locales??[];return t.length>0?[...t]:null}function nt(e){if(e.endsWith("/"))return!1;let t=e.slice(e.lastIndexOf("/")+1);return/\.[a-z\d]+$/i.test(t)}function ot(e){if(e.format==="json")return{ext:".json",unresolvedFormat:null};if(e.format===void 0||e.format==="")return{ext:lr()?.extensions[0]??".json",unresolvedFormat:null};let t=Wi(e.format);return t?.extensions[0]===void 0?{ext:null,unresolvedFormat:e.format}:{ext:t.extensions[0],unresolvedFormat:null}}function On(e,t){let o=t===null?"[^/]+":`(?:${t.map((i)=>Xe(i)).join("|")})`,r=G(e).split($o).map((i)=>Xe(i)).join(o);return new RegExp(`^${r}(?:/|$)`,"i")}function Pn(e,t,o){let r=On(e,o).exec(t);if(!r)return null;return r[0].replace(/\/$/,"")}function Sn(e){return G(e).replaceAll($o,"").length}function Jd(e,t){if(e===null||e===void 0||e==="")return null;let o=et(t),r=vn(o),i=G(e),s=null,a=-1;for(let[l,c]of Object.entries(tt(o))){let{source:u}=c;if(u===void 0||u===""||nt(u))continue;let d=Sn(u);if(d<=a)continue;let f=Pn(u,i,r);if(f===null)continue;s={def:c,dir:i,fileBacked:!1,isSourceRoot:i.length===f.length,name:l,...ot(c)},a=d}return s}function Gn(e,t){if(e===null||e===void 0||e==="")return null;let o=et(t),r=G(e),i=r.toLowerCase();for(let[s,a]of Object.entries(tt(o))){let{source:l}=a;if(l===void 0||l===""||!nt(l))continue;let c=G(l).toLowerCase();if(i===c||i.endsWith(`/${c}`))return{def:a,dir:r.includes("/")?r.slice(0,r.lastIndexOf("/")):".",fileBacked:!0,isSourceRoot:!1,name:s,...ot(a)}}return Jd(r.includes("/")?r.slice(0,r.lastIndexOf("/")):".",o)}function ed(e){return e.replaceAll(/([A-Z])/g," $1").replace(/^./,(t)=>t.toUpperCase())}function Qx(e){return e.replaceAll(/[^a-zA-Z0-9]+(.)?/g,(t,o)=>o?o.toUpperCase():"").replace(/^[A-Z]/,(t)=>t.toLowerCase())}function e0(e){return e.replaceAll(/(^|-)(\w)/g,(t,o,r)=>(o?" ":"")+r.toUpperCase())}function e1(e,t){return e?.$label||ed(t)}function lM(e,t){if(e?.$label)return e.$label;if(t.includes("-"))return t.replaceAll(/(^|-)(\w)/g,(o,r,i)=>(r?" ":"")+i.toUpperCase());return ed(t)}function Ra(e){return e==="image"||e==="uri-reference"}function wh(e){if(e.$shorthand===!0)return"shorthand";if(e.$input==="button-group")return"button-group";if(e.$input==="media")return"media";if(e.format==="color")return"color";if(Ra(e.format))return"media";if(e.$units!==void 0)return"number-unit";if(e.type==="number")return"number";if(Array.isArray(e.enum))return"select";if(Array.isArray(e.examples)||Array.isArray(e.presets))return"combobox";return"text"}function xh(e,t){if(!e||!t?.content)return null;let o=Gn(e,t);if(!o||!o.def.schema)return null;if(!o.fileBacked){let r=o.ext??lr()?.extensions[0]??".json";if(!e.toLowerCase().endsWith(r.toLowerCase()))return null}return{name:o.name,schema:o.def.schema}}function Sv(e,t){let o=e.trim().toLowerCase().replaceAll(/[^a-z0-9\s-]/g,"").replaceAll(/\s+/g,"-").replaceAll(/-+/g,"-").replaceAll(/^-|-$/g,"");if(!o)return"";return`${t}${o}`}function t0(e,t){return e.replace(new RegExp(`^${t.replaceAll(/[.*+?^${}()|[\]\\]/g,String.raw`\$&`)}`),"").replace(/^--/,"").replaceAll("-"," ").replaceAll(/\b\w/g,(o)=>o.toUpperCase())||e}function cM(e){if(!e)return{kind:"text"};let t=e.trim().replaceAll(/\s*\|\s*undefined\b/g,"").trim();if(t==="boolean")return{kind:"boolean"};if(t==="number")return{kind:"number"};if(t.match(/^'[^']*'(\s*\|\s*'[^']*')+$/))return{kind:"combobox",options:[...t.matchAll(/'([^']*)'/g)].map((i)=>i[1])};return{kind:"text"}}function ir(e){return JSON.parse(JSON.stringify(e))}function Oe(e){return e?.at(-1)??null}function YO(e){return e?.[0]??null}function Kx(e,t){if(!t||!e)return!1;return e.some((o)=>Cr(o,t))}function Ia(e){return z(e)}function z(e){let t=[];for(let o of e)t.push([...o]);return t}function Jx(e,t){if(Kx(e,t))return z(e.filter((o)=>!Cr(o,t)));return[...z(e),[...t]]}function ZO(e,t,o){let r=e.findIndex((a)=>Cr(a,o)),i=t?e.findIndex((a)=>Cr(a,t)):-1;if(r===-1||i===-1)return[[...o]];let s=i<=r?e.slice(i,r+1):e.slice(r,i+1).toReversed();return z(s)}function ye(e,t){return z(e.filter((o)=>!na(t,o)))}function XO(e){let t=[];for(let o of e)if(!t.some((r)=>Cr(r,o)))t.push([...o]);return t}function Jm(e){if(e.length===0)return{mixed:!1,value:void 0};let[t]=e,o=JSON.stringify(t??null);for(let r=1;r<e.length;r++)if(JSON.stringify(e[r]??null)!==o)return{mixed:!0,value:void 0};return{mixed:!1,value:t}}var rt=null;function aM(e){rt=e}function it(){return rt}var X=null,Q=null,ee=null,Ie=!0;function st(){X=[],Q=[],ee=[],Ie=!0}function y(e){if(X)X.push(e)}function Bi(e){if(Q)Q.push(e)}function at(e){if(ee)ee.push(e)}function lt(){let e={docOps:Q??[],fmOps:ee??[],invertible:Ie,ops:X??[]};return X=null,Q=null,ee=null,Ie=!0,e}var wn=100,Cn=20;function ne(){try{return typeof localStorage>"u"||!localStorage.getItem("jx-legacy-history")}catch{return!0}}function S(e,t){let o=oe(e,t);if(!o)throw TypeError(`No node at path [${t.join(", ")}]`);return o}function P(e,t,o,r){return{forward:{key:t,op:"set-key",path:e,value:r},inverse:{key:t,op:"set-key",path:e,value:o}}}var ct=null;function ut(e){ct=e}var dt=null;function ft(e){dt=e}function Rn(e,t,o,r){for(let i=t.docOps.length-1;i>=0;i--)Mv(e.doc.document,le(t.docOps[i].inverse));for(let i=t.fmOps.length-1;i>=0;i--){let s=t.fmOps[i];Ee(e,s.field,s.before)}e.doc.document={...le(e.doc.document)},e.session.selection=o,e.doc.dirty=r}function Z(e,t,{skipHistory:o=!1,origin:r="user",coalesceKey:i=null,actor:s=null}={}){if(!e)return!1;if(r!=="remote"&&dt?.(e,r))return!1;let a=s??be;if(r!=="remote")je(e,a);let l=Ia(e.session.selection),c=e.doc.dirty;st();let u,d=null;try{t(e)}catch(A){d={error:A}}finally{u=lt()}if(d)throw Rn(e,u,l,c),d.error;let f=le(e.doc.document),x={...f},k=it(),j=k===null?{patchable:!1,reason:"no-patch-consumer"}:u.ops.length===0?{patchable:!1,reason:"unrecorded-mutation"}:k.classify(e,u.ops);if(j.patchable)k.markConsumed(x,e);if(e.doc.document=x,j.patchable)try{k.apply(e,u.ops,u)}catch(A){k.escalate(`patch-apply-failed: ${A instanceof Error?A.message:String(A)}`,e)}if(!o){let A=a?In(a):null;if(A)kn(A,e,u,l);else pt(e,f,u,l,i)}return e.doc.dirty=!0,ct?.(e,u,r),!0}function pt(e,t,o,r,i=null){let s=e.history.snapshots.slice(0,e.history.index+1),a=ne()&&o.invertible&&(o.docOps.length>0||o.fmOps.length>0),l=s.at(-1);if(i&&a&&l&&l.coalesceKey===i&&l.inverseOps){if(l.forwardOps=[...l.forwardOps??[],...o.docOps.map((u)=>u.forward)],l.inverseOps=[...l.inverseOps,...o.docOps.map((u)=>u.inverse)],l.selection=Ia(e.session.selection),l.document)l.document=ir(t);e.history.snapshots=s,e.history.index=s.length-1;return}let c=!a||s.length%Cn===0;if(s.push({document:c?ir(t):null,fmOps:a&&o.fmOps.length>0?o.fmOps:null,forwardOps:a?o.docOps.map((u)=>u.forward):null,inverseOps:a?o.docOps.map((u)=>u.inverse):null,coalesceKey:i,selection:Ia(e.session.selection),selectionBefore:r}),s.length>wn){if(!s[1].document)s[1].document=ke(s,1);s.shift()}e.history.snapshots=s,e.history.index=s.length-1}function ke(e,t){let o=t;while(o>=0&&!e[o].document)o-=1;let r=o<0?null:e[o].document;if(!r)throw Error("history-missing-checkpoint");let i=ir(r);for(let s=o+1;s<=t;s++)for(let a of e[s].forwardOps??[])Mv(i,a);return i}function Yd(e,t,o){return Z(e,(r)=>t(r.doc.document),o)}function De(e,t){Z(e,(o)=>{for(let r of t)xe(o,r)},{origin:"remote",skipHistory:!0})}function dM(e,t,{actor:o=null,selection:r={kind:"keep"}}={}){if(t.length===0)return"unchanged";return Z(e,(s)=>{for(let a of t)xe(s,a,p1(le(s.doc.document),a));An(s,r)},{actor:o})?"applied":"refused"}function An(e,t){if(t.kind==="prune")for(let o of t.under)e.session.selection=ye(e.session.selection,o);else if(t.kind==="follow"&&Cr(Oe(e.session.selection),t.from))e.session.selection=[[...t.to]]}var Jn=new Set(["state","$media","$head","$elements","imports","$layout"]);function xe(e,t,o=t){let r=null;if(t.op==="set-key")r=oe(e.doc.document,t.path)?.[t.key];switch(Mv(e.doc.document,t),Bi({forward:t,inverse:o}),t.op){case"set-key":{if(Jn.has(t.key))y({key:t.key,op:"doc-meta"});else if(t.key==="style")y({op:"set-style",path:t.path});else if(t.key==="textContent")y({op:"set-text",path:t.path});else if(t.key==="attributes"||t.key==="cases"||t.key==="$props")y({op:"replace",path:t.path});else{let i=t.key.startsWith("on")&&(xf(t.value)||xf(r));y({isEvent:i,key:t.key,op:"set-prop",path:t.path})}return}case"insert-child":{y({index:t.index,op:"insert",parentPath:t.parentPath});return}case"remove-child":{y({op:"remove",path:[...t.parentPath,"children",t.index]});return}case"set-child":{y({op:"replace",path:[...t.parentPath,"children",t.index]});return}case"move-child":{y({fromPath:[...t.fromParentPath,"children",t.fromIndex],op:"move",toIndex:t.toIndex,toParentPath:t.toParentPath});break}default:break}}var V=new Map,M=new Map,be=null,mt=null;function gt(e){mt=e}function uM(e){let t=V.get(e.id);if(t)he(t);let o={owner:e,receipts:[]};return V.set(e.id,o),{owner:e,flush:()=>he(o),close:()=>{if(he(o),V.get(e.id)===o)V.delete(e.id);return[...o.receipts]}}}function bI(e,t){let o=be;be=e;try{return t()}finally{be=o}}function yt(e,t){let o=M.get(e);return o!==void 0&&(!t||o.lane.owner.id===t.id)}function hM(){for(let e of V.values())he(e)}function In(e){return V.get(e.id)??null}function he(e){for(let[t,o]of M)if(o.lane===e)bt(t,o)}function kn(e,t,o,r){let i=M.get(t);if(!i)i={docOps:[],fmOps:[],invertible:!0,lane:e,selectionBefore:r},M.set(t,i);if(i.docOps.push(...o.docOps),i.fmOps.push(...o.fmOps),!o.invertible||o.docOps.length===0&&o.fmOps.length===0)i.invertible=!1}function je(e,t){let o=M.get(e);if(o&&o.lane.owner.id!==t?.id)bt(e,o)}function bt(e,t){M.delete(e);let{owner:o}=t.lane,r=o.turnId??"";if(F.has(e))t.lane.receipts.push({entry:null,tab:e,turnId:r});else{let i={docOps:t.docOps,fmOps:t.fmOps,invertible:t.invertible,ops:[]};pt(e,le(e.doc.document),i,t.selectionBefore);let s=e.history.snapshots[e.history.index];if(s.actor=o.id,o.turnId!==void 0)s.turnId=o.turnId;t.lane.receipts.push({entry:s,tab:e,turnId:r})}mt?.(e)}var F=new WeakMap;function Zd(e,t){if(t)F.set(e,t);else F.delete(e)}function pM(e){let t=F.get(e);return t?t.canUndo(e):e.history.index>0||M.has(e)}function fM(e){let t=F.get(e);return t?t.canRedo(e):!M.has(e)&&e.history.index<e.history.snapshots.length-1}function ht(e,t){let{snapshots:o}=e.history;e.doc.document=ke(o,t);let r=o[t];e.session.selection=Ia(le(r.selection))}function xt(e,t){try{if(typeof localStorage>"u"||!localStorage.getItem("jx-canvas-debug"))return}catch{return}let o=JSON.stringify(ke(e.history.snapshots,t)),r=JSON.stringify(ir(le(e.doc.document)));if(o!==r)console.error("jx history: ops-based undo/redo diverged from checkpoint replay",{index:t})}function t1(e){je(e,null);let t=F.get(e);if(t){t.undo(e);return}if(e.history.index<=0)return;let o=e.history.snapshots[e.history.index],r=ne()?o.inverseOps:null,i=ne()?o.fmOps:null;if(r&&r.length>0||i&&i.length>0){if(!Z(e,(a)=>{if(r)for(let l=r.length-1;l>=0;l--)xe(a,le(r[l]));if(i)for(let l=i.length-1;l>=0;l--){let c=le(i[l]);Ee(a,c.field,c.before)}},{origin:"history",skipHistory:!0}))return;e.session.selection=Ia(le(o.selectionBefore??[])),e.history.index-=1,xt(e,e.history.index)}else e.history.index-=1,ht(e,e.history.index);e.doc.dirty=!0}function mM(e){je(e,null);let t=F.get(e);if(t){t.redo(e);return}if(e.history.index>=e.history.snapshots.length-1)return;let o=e.history.snapshots[e.history.index+1],r=ne()?o.forwardOps:null,i=ne()?o.fmOps:null;if(r&&r.length>0||i&&i.length>0){if(!Z(e,(a)=>{if(r)for(let l of r)xe(a,le(l));if(i)for(let l of i){let c=le(l);Ee(a,c.field,c.after)}},{origin:"history",skipHistory:!0}))return;e.session.selection=Ia(le(o.selection)),e.history.index+=1,xt(e,e.history.index)}else e.history.index+=1,ht(e,e.history.index);e.doc.dirty=!0}function or(e,t,o,r){let i=oe(e.doc.document,t);if(!i)return;let s=Ov(i),a=df(o,s.length);s.splice(a,0,structuredClone(r)),y({index:a,op:"insert",parentPath:t}),Bi({forward:{index:a,node:Ce(r),op:"insert-child",parentPath:t},inverse:{index:a,op:"remove-child",parentPath:t}})}function _h(e,t){let o=uf(t);if(!o)return;let{index:r,parentPath:i}=o,[s]=S(e.doc.document,i).children.splice(r,1);y({op:"remove",path:t}),Bi({forward:{index:r,op:"remove-child",parentPath:i},inverse:{index:r,node:Ce(s),op:"insert-child",parentPath:i}}),e.session.selection=ye(e.session.selection,t)}function vI(e,t){let o=uf(t);if(!o)return;let r=oe(e.doc.document,t);if(!r)return;let{index:i,parentPath:s}=o,a=structuredClone(le(r));S(e.doc.document,s).children.splice(i+1,0,a),y({index:i+1,op:"insert",parentPath:s}),Bi({forward:{index:i+1,node:Ce(a),op:"insert-child",parentPath:s},inverse:{index:i+1,op:"remove-child",parentPath:s}}),e.session.selection=[[...s,"children",i+1]]}function Ym(e,t){for(let o of sg(t))_h(e,o)}function n0(e,t){let o=[];for(let r of sg(t)){let i=e.session.selection;vI(e,r);let s=Oe(e.session.selection),a=uf(s);if(!s||!a||e.session.selection===i)continue;o=o.map((l)=>h1(a.parentPath,l,a.index,1,!0)),o.unshift(s)}if(o.length>0)e.session.selection=o}function gM(e,t,o="div"){let r=uf(t);if(!r)return;let i=oe(e.doc.document,t);if(!i)return;let{index:s,parentPath:a}=r,l={children:[structuredClone(le(i))],tagName:o},c=Ce(i);S(e.doc.document,a).children.splice(s,1,l),y({op:"replace",path:t}),Bi({forward:{index:s,node:Ce(l),op:"set-child",parentPath:a},inverse:{index:s,node:c,op:"set-child",parentPath:a}}),e.session.selection=[[...a,"children",s]]}function Kp(e,t,o,r){let i=e.doc.document,s=d0(i,t,o,r);if(!s)return;let{forward:a,inverse:l}=s,c=oe(i,a.fromParentPath),u=oe(i,o),[d]=c.children.splice(a.fromIndex,1);if(Ov(u).splice(a.toIndex,0,d),y({fromPath:t,op:"move",toIndex:a.toIndex,toParentPath:o}),Bi({forward:a,inverse:l}),Cr(Oe(e.session.selection),t))e.session.selection=[[...l.fromParentPath,"children",l.fromIndex]]}function Qe(e,t,o,r){let i=oe(e.doc.document,t);if(!i)return;let s=i[o],a=Ce(s);if(r===void 0||r===null||r==="")delete i[o];else i[o]=r;if(Bi(P(t,o,a,Ce(i[o]))),o==="children")e.session.selection=ye(e.session.selection,[...t,"children"]);if(o==="textContent")y({op:"set-text",path:t});else if(o==="style")y({op:"set-style",path:t});else{let l=r===void 0||r===null||r===""?s:r,c=o.startsWith("on")&&xf(l);y({isEvent:c,key:o,op:"set-prop",path:t})}}function Zm(e,t,o,r){let i=S(e.doc.document,t),s=Ce(i.style);if(!i.style)i.style={};if(r===void 0||r==="")delete i.style[o];else i.style[o]=r;if(Object.keys(i.style).length===0)delete i.style;Bi(P(t,"style",s,Ce(i.style))),y({op:"set-style",path:t})}function _r(e,t,o,r){let i=S(e.doc.document,t),s=Ce(i.attributes);if(!i.attributes)i.attributes={};if(r===void 0||r==="")delete i.attributes[o];else i.attributes[o]=r;if(Object.keys(i.attributes).length===0)delete i.attributes;Bi(P(t,"attributes",s,Ce(i.attributes))),y({attr:o,op:"set-attr",path:t})}function bM(e,t,o,r,i){if(!o)return Zm(e,t,r,i);let s=S(e.doc.document,t),a=Ce(s.style);if(!s.style)s.style={};let l=`@${o}`,c=ld(s.style,l);if(i===void 0||i===""){if(delete c[r],Object.keys(c).length===0)delete s.style[l]}else c[r]=i;if(Object.keys(s.style).length===0)delete s.style;Bi(P(t,"style",a,Ce(s.style))),y({op:"set-style",path:t})}function i0(e,t,o,r,i){let s=S(e.doc.document,t),a=Ce(s.style);if(!s.style)s.style={};let l=ld(s.style,o);if(i===void 0||i===""){if(delete l[r],Object.keys(l).length===0)delete s.style[o]}else l[r]=i;if(Object.keys(s.style).length===0)delete s.style;Bi(P(t,"style",a,Ce(s.style))),y({op:"set-style",path:t})}function vM(e,t,o,r,i,s){let a=S(e.doc.document,t),l=Ce(a.style);if(!a.style)a.style={};let c=`@${o}`,u=ld(a.style,c),d=ld(u,r);if(s===void 0||s===""){if(delete d[i],Object.keys(d).length===0)delete u[r];if(Object.keys(u).length===0)delete a.style[c]}else d[i]=s;if(Object.keys(a.style).length===0)delete a.style;Bi(P(t,"style",l,Ce(a.style))),y({op:"set-style",path:t})}function Tt(e,t){let o=[e];for(let r of t){let i=Di(o.at(-1),r);if(!i)break;o.push(i)}for(let r=o.length-2;r>=0;r--){let i=o[r],s=t[r],a=Di(i,s);if(a&&Object.keys(a).length===0)delete i[s]}}function o0(e,t,o,r,i){let s=S(e.doc.document,t),a=Ce(s.style);if(!s.style)s.style={};let l=s.style;for(let c of o)l=ld(l,c);if(i===void 0||i==="")delete l[r],Tt(s.style,o);else l[r]=i;if(Object.keys(s.style).length===0)delete s.style;Bi(P(t,"style",a,Ce(s.style))),y({op:"set-style",path:t})}function yM(e,t,o,r,i,s){let a=S(e.doc.document,t),l=Ce(a.style);if(!a.style)a.style={};let c=`@${o}`,u=ld(a.style,c),d=u;for(let f of r)d=ld(d,f);if(s===void 0||s===""){if(delete d[i],Tt(u,r),Object.keys(u).length===0)delete a.style[c]}else d[i]=s;if(Object.keys(a.style).length===0)delete a.style;Bi(P(t,"style",l,Ce(a.style))),y({op:"set-style",path:t})}function wM(e,t,o){let r=S(e.doc.document,t),i=Ce(r.style);if(o&&Object.keys(o).length>0)r.style=o;else delete r.style;Bi(P(t,"style",i,Ce(r.style))),y({op:"set-style",path:t})}function Xd(e,t,o){let r=e.doc.document,i=Ce(r.state);if(!r.state)r.state={};r.state[t]=o,Bi(P([],"state",i,Ce(r.state))),y({key:"state",op:"doc-meta"})}function xM(e,t){let o=e.doc.document;if(o.state){let r=Ce(o.state);if(delete o.state[t],Object.keys(o.state).length===0)delete o.state;Bi(P([],"state",r,Ce(o.state))),y({key:"state",op:"doc-meta"})}}function Ur(e,t,o){let r=e.doc.document,i=Ce(r.state);if(!r.state)r.state={};let s=r.state[t],a=s==null?{}:!_(s)||Array.isArray(s)?{default:s}:s;r.state[t]=a,Object.assign(a,o);for(let l of Object.keys(a))if(a[l]===void 0||a[l]===null)delete a[l];Bi(P([],"state",i,Ce(r.state))),y({key:"state",op:"doc-meta"})}function _M(e,t,o){let r=e.doc.document;if(!r.state||!r.state[t])return;let i=Ce(r.state);r.state[o]=r.state[t],delete r.state[t],Bi(P([],"state",i,Ce(r.state))),y({key:"state",op:"doc-meta"})}function Jp(e,t,o,r){let i=S(e.doc.document,t),s=Ce(i.$props);if(!i.$props)i.$props={};if(r===void 0||r===null||r==="")delete i.$props[o];else i.$props[o]=r;if(Object.keys(i.$props).length===0)delete i.$props;Bi(P(t,"$props",s,Ce(i.$props))),y({op:"replace",path:t})}function SM(e,t,o,r){let i=S(e.doc.document,t),s=Ce(i.cases);if(!i.cases)i.cases={};i.cases[o]=r||{tagName:"div",textContent:o},Bi(P(t,"cases",s,Ce(i.cases))),y({op:"replace",path:t})}function CM(e,t,o){let r=S(e.doc.document,t);if(r.cases){let i=Ce(r.cases);delete r.cases[o],Bi(P(t,"cases",i,Ce(r.cases))),y({op:"replace",path:t})}}function kM(e,t,o,r){let i=S(e.doc.document,t);if(!i.cases||!i.cases[o])return;let s=Ce(i.cases);i.cases[r]=i.cases[o],delete i.cases[o],Bi(P(t,"cases",s,Ce(i.cases))),y({op:"replace",path:t})}function Qd(e,t,o){let r=e.doc.content.frontmatter,i=Object.hasOwn(r,t)?Ce(r[t]):void 0,s=o===void 0||o===null||o==="";if(s)delete r[t];else r[t]=o;let a=s?void 0:Ce(o);at({after:a,before:i,field:t}),e.doc.dirty=!0}function Ee(e,t,o){if(o===void 0)delete e.doc.content.frontmatter[t];else e.doc.content.frontmatter[t]=o}var W=[],Dn=50;function EM(e){return Object.assign(Ux(),{turnId:e})}function TM(e,t,o=[]){if(t.length===0)return[];let r={batches:[...o],id:e,writes:[...t]};W.push(r);while(W.length>Dn)W.shift();return r.writes}function LM(e){return W.find((t)=>t.id===e)?.writes??[]}function $M(e){let t=W.find((s)=>s.id===e),o="There is no longer a record of what that turn changed.";if(!t)return"There is no longer a record of what that turn changed.";let r=t.writes.filter((s)=>s.disk).map((s)=>s.path);if(r.length>0)return`Cannot restore: ${r.join(", ")} ${r.length===1?"was":"were"} written straight to disk, which undo cannot reach.`;if(t.batches.length===0)return"There is no longer a record of what that turn changed.";let i=new Map;for(let s of t.batches)i.set(s.tab,[...i.get(s.tab)??[],s]);for(let[s,a]of i){let l=En(s,a);if(l)return l}for(let[s,a]of i)for(let l of a)t1(s);return[...i.keys()]}function En(e,t){let o=e.documentPath??"(untitled)";if(e.scope.active===!1)return`Cannot restore: ${o} was closed after that turn.`;if(t.some((l)=>l.entry===null))return`Cannot restore: ${o} is shared live, and Restore cannot check its undo history. Undo it in the document instead.`;let{index:r,snapshots:i}=e.history,s=i.slice(r-t.length+1,r+1);if(r-t.length>=0&&t.every((l,c)=>s[c]===l.entry))return null;return i.indexOf(t.at(-1).entry)>r?`Cannot restore: that turn's change to ${o} was already undone.`:`Cannot restore: ${o} has edits made since that turn began, which Restore would undo too.`}function IM(e){let t=e.filter((l)=>l.ok),o=new Set(t.map((l)=>l.path)),r=e.length-t.length;if(o.size===0)return r>0?`${r} change${r===1?"":"s"} failed`:"";let i=`Changed ${o.size} file${o.size===1?"":"s"}`,s=new Set(t.flatMap((l)=>l.disk?[l.path]:[])),a=[i];if(s.size>0)a.push(`${s.size} written to disk — undo cannot reach ${s.size===1?"it":"them"}`);if(r>0)a.push(`${r} failed`);return a.join(" · ")}function n1(){W.splice(0)}function RM(e,t){let o=null;for(let r=e.length-1;r>=0;r--){let i=e[r];if(i.id===t)return o;let s=i.role==="assistant"&&(i.content||(i.toolCalls?.length??0)>0);if(o===null&&s)o=i.id}return t===void 0?o:null}function Gm(e){let t=new Set,o=new Set;return $v(e,(r,i)=>{t.add(r),o.add(JSON.stringify(i))}),t.size===0?null:{fingerprints:o,pointers:t}}function KO(e,t){if(!t)return e;return Me(e,"",t)}function Me(e,t,o){if(Array.isArray(e)){let i=null;for(let[s,a]of e.entries()){let l=Me(a,`${t}/${s}`,o);if(l!==a)i??=[...e],i[s]=l}return i??e}if(!v(e))return e;let r=null;for(let[i,s]of Object.entries(e)){let a=Me(s,`${t}/${LI(i)}`,o);if(i==="children"&&Array.isArray(a)&&a.length===1){let[l]=a;if(Go(l)&&(o.pointers.has(t)||o.fingerprints.has(JSON.stringify(l))))a=l}if(a!==s)r??={...e},r[i]=a}return r??e}var JC=["design","content","media","styles","publish","settings"],Up="design",vt=[{icon:"frame-corners",id:"design",switcher:!0,title:"Design"},{icon:"file-text",id:"content",switcher:!0,title:"Content"},{icon:"image",id:"media",switcher:!0,title:"Media"},{icon:"paint-brush",id:"styles",switcher:!0,title:"Styles"},{icon:"paper-plane-tilt",id:"publish",switcher:!0,title:"Publish"},{icon:"gear-six",id:"settings",switcher:!1,title:"Project settings"}],Hx=vt.filter((e)=>e.switcher);function aI(e){return typeof e==="string"&&JC.some((t)=>t===e)}function bh(e){return vt.find((t)=>t.id===e)}var $e="workspace://",Bx={content:"content-home",media:"media-home",publish:"publish-home",settings:"settings-home"};function qp(e){return Object.hasOwn(Bx,e)}function $a(e){return`${$e}${e}`}function ml(e){if(!e.startsWith($e))return null;let t=e.slice($e.length);return aI(t)&&qp(t)?t:null}function gv(e){let t=ml(e);return t?bh(t).title:null}var Mn=new Map([["design","canvas"],["edit","canvas"],["entry","entry"],["git-diff","diff"],["grid","grid"],["content-home","home"],["media-home","home"],["publish-home","home"],["settings-home","home"],["media","media"],["image","image"],["preview","canvas"],["source","code"],["stylebook","config"],["tokens","tokens"]]),Gp={canvas:"Canvas",code:"Code",config:"Elements",diff:"Diff",entry:"Entry",grid:"Grid",home:"Home",image:"Image",media:"Media",none:"None",tokens:"Variables"};function Qs(e){return Mn.get(e)??"canvas"}var $n=new Map([["design","design"],["edit","edit"],["preview","preview"]]);function UO(e){return $n.get(e)??"design"}var zx=(e)=>e.editor.kind==="canvas",vh=(e)=>zx(e)&&e.selection.count>0,Wx=(e)=>vh(e)&&!e.selection.isRoot;function bv(){return{project:{open:!1,isSite:!1,isRepo:!1,isMultilingual:!1},git:{ahead:0,behind:0,dirtyCount:0},workspace:{id:Up},document:{open:!1,dirty:!1,mode:"",canUndo:!1,canRedo:!1},editor:{kind:"none"},canvas:{view:"design"},pane:{count:1,derived:!1},selection:{count:0,paths:[],kind:"",isRoot:!1,isComponentInstance:!1,isLayoutNode:!1,isRepeater:!1},caret:{active:!1,inCanvas:!1},focus:{region:"pane"},modal:{open:!1},collab:{attached:!1,readOnly:!1,sourceCanonical:!1},ai:{configured:!1,streaming:!1,waiting:!1},capability:{gitClone:!1,importSite:!1,openProjectInNewWindow:!1,openProject:!1,dataRows:!1,windowControls:!1,findReferences:!1,readFileBytes:!1,publish:!1}}}function YC(e={}){let t=bv();for(let o of Object.keys(e)){let r=e[o];if(r)Object.assign(t[o],r)}return t}var Ln=["palette"],Nn=["caret","global"],_n=["dock","global"],Fn=["canvas","global"],Vn=["grid","global"],Wn=["code","global"],Ot=["global"];function qO(e){if(e.modal.open)return Ln;if(e.caret.active)return Nn;if(e.focus.region!=="pane")return _n;switch(e.editor.kind){case"grid":return Vn;case"code":return Wn;case"canvas":return e.canvas.view==="preview"?Ot:Fn;default:return Ot}}var an="project.json";function Bn(e,t=!1){return{activeMedia:null,activeSelector:null,openPopover:null,openDialog:null,canvasMode:e,editZoom:1,editingFormula:null,editingFunction:null,featureToggles:{},inspectorSections:{},pendingInlineEdit:null,preview:t,previewColorScheme:"auto",previewLocale:null,previewParams:{},previewProps:null,rightTab:"page",elementTab:"properties",showLayout:!0,styleFilter:"",styleSections:{},dataRows:{},dataLimits:{},styleShorthands:{},zoom:1}}var Kn=["edit","design","preview","source","stylebook","git-diff"];function yv({id:e,documentPath:t=null,fileHandle:o=null,document:r,frontmatter:i,sourceFormat:s=null,capabilities:a,openedFrom:l=null,preview:c=!1,layout:u=null,source:d=null,canvasMode:f}){let x=me(),k=Gm(r),j=a?.modes??Un(t,s),A=f??j.find((b)=>b!=="preview")??"edit",ue=j[0]==="preview",E={bareRepeaters:k,content:{frontmatter:i||{}},dirty:!1,document:r,handlersSource:null,layout:u,mode:zn(t,s),source:d,sourceFormat:s},de={index:0,snapshots:[{document:structuredClone(r),selection:[]}]},U={canvas:{refreshing:!1,error:null,livePreviews:null,pendingInlineEdit:null,scope:null,status:"idle"},clipboard:null,hover:null,openedFrom:l,selection:[],ui:Bn(A,ue)};return x.run(()=>({capabilities:{modes:j},doc:g(E),documentPath:t,fileHandle:o,history:g(de),id:e,pinned:!1,preview:c,scope:x,session:g(U)}))}function Un(e,t){if(e===an)return["stylebook","tokens","source"];let o=Wi(t)??fn(e);if(o)return o.studio?.modes??["edit","design","preview","source"];return Kn}function zn(e,t){let o=Wi(t)??fn(e);if(o)return o.studio?.documentMode?.default??"content";return"component"}function XC(e){return Qs(e.session.ui.canvasMode)}function dI(e){let t=[];for(let o of e.capabilities.modes){if(o==="preview")continue;let r=Qs(o);if(!t.includes(r))t.push(r)}return t}function JO(e,t){return e.capabilities.modes.find((o)=>o!=="preview"&&Qs(o)===t)}function Km(e){e.scope.stop()}var Pt=new WeakMap,B=new Map;function xn(e){let t=le(e),o=Pt.get(t);if(!o)o=g({active:!1,attachError:"",peers:[],readOnly:!1,sourceCanonical:!1,status:"unavailable"}),Pt.set(t,o);return o}function wt(e){B.set(e,(B.get(e)??0)+1)}function Ct(e){let t=B.get(e)??0;if(t<=1)B.delete(e);else B.set(e,t-1)}function wv(e){return B.has(e.replaceAll("\\","/"))}var Yn=8000,Zn=800,Xn=2500,Rt=null;function Qn(){return Rt??=(ce("f9qr7kzh"),import("./index-f9qr7kzh.js")),Rt}function Jt(){try{return p()}catch{return null}}var H=null;function QO(e){H=e}var Ne=null;function eM(e){Ne=e}var It=()=>{};function tM(e){It=e??(()=>{})}var _e=new WeakMap;function kt(e){return le(e)}function Ve(e,t){return e.frontmatterMap(t)}function eo(e){return e.synced}function D(e){return _e.get(kt(e))}function He(e){let t=kt(e),o=_e.get(t);if(!o)o={attaching:null,generation:0,optedOut:g({value:!1}),session:null,watcherInstalled:!1},_e.set(t,o);return o}var At=!1;function to(){if(At)return;At=!0,ut(no),gt(oo),ft((e)=>{if(D(e)?.session?.synced&&xn(e).sourceCanonical)return It("Source editing in progress — structural edits are paused"),"source-canonical";return null})}function no(e,t,o){let r=D(e)?.session;if(!r||!r.synced)return;if(r.lastSeenRef=le(e.doc.document),o==="remote"){Te(r);return}if(r.canWrite)ro(r,t),Te(r)}function oo(e){let t=D(e)?.session;if(!t?.synced||t.batchOps===null)return;let{batchOps:o,batchNeedsDiff:r}=t;if(t.batchOps=null,t.batchNeedsDiff=!1,!t.canWrite)return;if(t.undoManager?.stopCapturing(),r)re(t);else if(o.length>0)try{t.collab.applyDocOpsToY(t.handle.doc,o,t.collab.LOCAL_ORIGIN)}catch{re(t)}t.undoManager?.stopCapturing()}function ro(e,t){let o=t.docOps.map((r)=>r.forward);if(yt(e.tab)){if(e.batchOps??=[],o.length===0)e.batchNeedsDiff=!0;else e.batchOps.push(...o);return}if(o.length===0){re(e);return}try{e.collab.applyDocOpsToY(e.handle.doc,o,e.collab.LOCAL_ORIGIN)}catch{re(e)}}function re(e){let{collab:t,handle:o,tab:r}=e,i=t.yDocToJson(o.doc),s=ir(le(r.doc.document)),a=t.diffDocs(i,s);if(a===null)t.replaceYStructure(o.doc,s,t.LOCAL_ORIGIN);else if(a.length>0)try{t.applyDocOpsToY(o.doc,a,t.LOCAL_ORIGIN)}catch{t.replaceYStructure(o.doc,s,t.LOCAL_ORIGIN)}}function Le(e){let t=e.collab.yDocToJson(e.handle.doc);Z(e.tab,(o)=>{let r=o.doc.document;for(let i of Object.keys(r))if(!(i in t))delete r[i];Object.assign(r,t)},{origin:"remote",skipHistory:!0})}function io(e){if(!e.canWrite)return!1;let{awareness:t}=e.handle,o=t.clientID;for(let[r,i]of t.getStates())if(i.canWrite!==!1&&r<o)o=r;return o===e.handle.awareness.clientID}function Te(e){if(!H||!io(e))return;if(e.collab.canonicalOf(e.handle.doc)==="source")return;let t=Date.now();if(e.lastMirrorAt??=t,t-e.lastMirrorAt>=Xn){if(e.mirrorTimer)clearTimeout(e.mirrorTimer),e.mirrorTimer=null;e.lastMirrorAt=t,We(e);return}if(e.mirrorTimer)clearTimeout(e.mirrorTimer);e.mirrorTimer=setTimeout(()=>{e.mirrorTimer=null,e.lastMirrorAt=Date.now(),We(e)},Zn)}async function We(e){if(!H||!e.synced)return;try{let t=await H(e.tab);e.collab.updateSourceText(e.handle.doc,t,e.collab.MIRROR_ORIGIN)}catch{}}async function Dt(e){if(!Ne||!e.synced||!e.canWrite)return;let{collab:t,handle:o,tab:r}=e,i=t.canonicalRevOf(o.doc),s=t.sourceText(o.doc).toString(),a;try{a=await Ne(r,s)}catch{return}if(!eo(e)||t.canonicalRevOf(o.doc)!==i)return;let l=t.diffDocs(t.yDocToJson(o.doc),a.document);if(l===null)t.replaceYStructure(o.doc,a.document,t.MIRROR_ORIGIN);else if(l.length>0)try{t.applyDocOpsToY(o.doc,l,t.MIRROR_ORIGIN)}catch{t.replaceYStructure(o.doc,a.document,t.MIRROR_ORIGIN)}let c=Ve(t,o.doc),u=a.frontmatter??{};o.doc.transact(()=>{let d=[...c.keys()];for(let f of d)if(!(f in u))c.delete(f);for(let[f,x]of Object.entries(u))if(!t.deepEqual(c.get(f),x))c.set(f,x)},t.MIRROR_ORIGIN)}function nM(e){let t=D(e)?.session;if(!t?.synced)return null;let{collab:o,handle:r}=t,i=null,s=()=>i!==null&&t.sourceLockOwner===i;return{awareness:r.awareness,enter:async()=>{i={},t.sourceLockOwner=i;let a=r.awareness.getLocalState();if(a)r.awareness.setLocalState({...a,mode:"source"});if(!t.canWrite)return;let l=null;if(H)try{l=await H(e)}catch{l=null}if(!s())return;o.acquireSourceCanonical(r.doc,l??o.sourceText(r.doc).toString(),o.LOCAL_ORIGIN)},leave:()=>{if(!s()){i=null;return}i=null,t.sourceLockOwner=null;let a=r.awareness.getLocalState();if(a)r.awareness.setLocalState({...a,mode:"structure"});if(!t.canWrite)return;if(o.otherSourceEditors(r.awareness,t.path,r.awareness.clientID).filter((c)=>r.awareness.getStates().get(c)?.canWrite!==!1).length===0)Dt(t).then(()=>{o.releaseSourceCanonical(r.doc,o.LOCAL_ORIGIN)})},localOrigin:o.LOCAL_ORIGIN,readOnly:!t.canWrite,text:o.sourceText(r.doc)}}function ea(e){let t=xn(e);return t.active&&t.readOnly}async function uI(e){let t=D(e)?.session;if(!t?.synced||!t.canWrite)return!1;if(t.mirrorTimer)clearTimeout(t.mirrorTimer),t.mirrorTimer=null;return await We(t),await t.handle.flush(),!0}async function iM(){for(let e of Be)if(D(e)?.session?.synced)await uI(e)}var Be=new Set;function ie(e){if(!Jt()?.collab||!e.documentPath||e.documentPath===an)return;let o=He(e);if(o.watcherInstalled)return;o.watcherInstalled=!0,to(),Be.add(e),e.scope.run(()=>{te(()=>{if(o.optedOut.value)ve(e);else Ke(e)}),ia(()=>{Be.delete(e),ve(e)})})}function hI(e,t){let o=He(e);if(o.optedOut.value===!t)return;if(o.optedOut.value=!t,!o.watcherInstalled&&t)ie(e)}function pI(e){return D(e)?.optedOut.value!==!0}function jt(e){if(!D(e)?.watcherInstalled){ie(e);return}ve(e),Ke(e)}async function Ke(e){let t=He(e);if(t.session||t.attaching)return;let{documentPath:o}=e,r=Jt();if(!o||!r?.collab){xn(e).status="unavailable";return}let{generation:i}=t,s=xn(e);s.status="connecting",s.attachError="";let a=(async()=>{try{let[l,c]=await Promise.all([Qn(),r.collab(o)]);if(!c){s.status="detached";return}if(t.generation!==i){c.destroy();return}let u,d=new Promise((f,x)=>{u=setTimeout(()=>x(Error("collab-sync-timeout")),Yn)});try{await Promise.race([c.whenSynced,d])}finally{clearTimeout(u)}if(t.generation!==i){c.destroy();return}t.session=so(e,o,l,c),s.active=!0,s.status="synced",s.readOnly=!t.session.canWrite,s.attachError="",wt(o)}catch(l){s.status="failed",s.active=!1,s.attachError=l instanceof Error?l.message:String(l),w.warn(`Live collaboration is not available for "${o}" — ${s.attachError}`,{key:`collab:${o}`,path:o,source:"Collaboration"})}finally{t.attaching=null}})();t.attaching=a,await a}function ve(e){let t=D(e);if(!t)return;t.generation+=1;let{session:o}=t;t.session=null;let r=xn(e);if(r.active=!1,r.status="detached",r.attachError="",r.peers=[],!o)return;if(Ct(o.path),o.mirrorTimer)clearTimeout(o.mirrorTimer);if(o.sourceParseTimer)clearTimeout(o.sourceParseTimer);for(let i of o.disposers)try{i()}catch{}Zd(e,null),e.history.snapshots=[{document:ir(le(e.doc.document)),selection:Ia(e.session.selection)}],e.history.index=0,o.undoManager?.destroy(),o.handle.destroy()}function so(e,t,o,r){let i=r.identity(),s={applyingRemoteFrontmatter:!1,batchNeedsDiff:!1,batchOps:null,canWrite:i?i.permission!=="read":!0,collab:o,disposers:[],handle:r,lastSeenRef:le(e.doc.document),mirrorTimer:null,path:t,sourceLockOwner:null,sourceParseTimer:null,synced:!1,tab:e,undoManager:null};if(o.metaMap(r.doc).get("structureSeeded")===!0){let b=o.yDocToJson(r.doc),T=ir(le(e.doc.document));if(!o.deepEqual(b,T)){let J=o.diffDocs(T,b);if(J===null)s.synced=!0,Le(s),s.synced=!1;else if(J.length>0)De(e,J)}s.applyingRemoteFrontmatter=!0;let O=Ve(o,r.doc);for(let[J,N]of O.entries())e.doc.content.frontmatter[J]=N;s.applyingRemoteFrontmatter=!1}else if(s.canWrite)o.seedStructure(r.doc,ir(le(e.doc.document)),{frontmatter:ir(le(e.doc.content.frontmatter)),origin:o.SEED_ORIGIN,sourceFormat:e.doc.sourceFormat});s.lastSeenRef=le(e.doc.document),s.disposers.push(r.onDirty((b)=>{e.doc.dirty=b})),r.awareness.setLocalState({canWrite:s.canWrite,focusedPath:t,structuralSelection:null,user:i?{avatarUrl:i.avatarUrl,color:i.color,login:i.login,name:i.name}:{color:o.colorForKey(String(r.awareness.clientID)),login:`guest-${r.awareness.clientID%1000}`}});let l=new o.UndoManager([o.structureMap(r.doc),o.frontmatterMap(r.doc)],{trackedOrigins:new Set([o.LOCAL_ORIGIN])});s.undoManager=l;let c=({stackItem:b})=>{b.meta.set("selection",Ia(e.session.selection))},u=({stackItem:b})=>{let T=b.meta.get("selection");e.session.selection=Ia(T??[])};l.on("stack-item-added",c),l.on("stack-item-popped",u),s.disposers.push(()=>{l.off("stack-item-added",c),l.off("stack-item-popped",u)}),Zd(e,{canRedo:()=>l.canRedo(),canUndo:()=>l.canUndo(),redo:()=>{l.redo()},undo:()=>{l.undo()}});let d=o.structureMap(r.doc),f=(b,T)=>{if(T.origin===o.LOCAL_ORIGIN||!s.synced)return;let O=o.yEventsToDocOps(b);if(O===null){Le(s);return}if(O.length===0)return;try{De(e,O)}catch{Le(s)}};d.observeDeep(f),s.disposers.push(()=>d.unobserveDeep(f));let x=xn(e);x.sourceCanonical=o.canonicalOf(r.doc)==="source";let k=o.metaMap(r.doc),j=()=>{x.sourceCanonical=o.canonicalOf(r.doc)==="source"};k.observe(j),s.disposers.push(()=>k.unobserve(j));let A=o.sourceText(r.doc),ue=(b,T)=>{if(T.origin===o.MIRROR_ORIGIN||!s.synced)return;if(o.canonicalOf(r.doc)!=="source")return;if(!o.isSourceReconciler(r.awareness,s.path))return;if(s.sourceParseTimer)clearTimeout(s.sourceParseTimer);s.sourceParseTimer=setTimeout(()=>{s.sourceParseTimer=null,Dt(s)},600)};A.observe(ue),s.disposers.push(()=>A.unobserve(ue));let E=Ve(o,r.doc),de=(b,T)=>{if(T.origin===o.LOCAL_ORIGIN||!s.synced)return;s.applyingRemoteFrontmatter=!0;try{for(let[O,J]of b.changes.keys)if(J.action==="delete")delete e.doc.content.frontmatter[O];else e.doc.content.frontmatter[O]=E.get(O)}finally{s.applyingRemoteFrontmatter=!1}};E.observe(de),s.disposers.push(()=>E.unobserve(de)),e.scope.run(()=>{let b=JSON.stringify(e.doc.content.frontmatter);te(()=>{let T=JSON.stringify(e.doc.content.frontmatter);if(T===b)return;if(b=T,s.applyingRemoteFrontmatter||!s.synced||!s.canWrite)return;let O=JSON.parse(T);r.doc.transact(()=>{let J=[...E.keys()];for(let N of J)if(!(N in O))E.delete(N);for(let[N,Ge]of Object.entries(O))if(!o.deepEqual(E.get(N),Ge))E.set(N,Ge)},o.LOCAL_ORIGIN),Te(s)}),te(()=>{let T=e.session.selection.length>0?Ia(e.session.selection):null,O=r.awareness.getLocalState();if(O)r.awareness.setLocalState({...O,structuralSelection:T})}),te(()=>{let T=le(e.doc.document);queueMicrotask(()=>{if(D(e)?.session!==s||!s.synced||!s.canWrite)return;let J=le(e.doc.document);if(J!==T||J===s.lastSeenRef)return;s.lastSeenRef=J,re(s),Te(s)})})});let U=xn(e),fe=()=>{let b=[];for(let[T,O]of r.awareness.getStates())if(T!==r.awareness.clientID&&O.user)b.push({clientId:T,state:O});U.peers=b};return fe(),r.awareness.on("change",fe),s.disposers.push(()=>r.awareness.off("change",fe),r.onStatus((b)=>{if(b==="offline"||b==="connecting")U.status="offline";else if(s.synced)U.status="synced"}),r.onReset(()=>{ve(e),Ke(e)})),s.synced=!0,s}function I(e,t,o){return RangeError(`command "${e}" argument "${t}": ${o}`)}function ao(e){if(Y(e))return"number";if(Ze(e))return"boolean";return n(e)?"string":"object"}function R(e){if(e===void 0)return"missing";return n(e)?`"${e}"`:`${ao(e)} ${JSON.stringify(e)}`}function Mt(e){return Array.isArray(e)&&e.every((t)=>n(t)||Y(t))}function St(e,t,o){let r=t[o];if(!n(r)||r==="")throw I(e,o,`expected a non-empty string, got ${R(r)}`);return r}function ti(e,t,o){if(t[o]===void 0)return;return St(e,t,o)}function $t(e,t,o){let r=t[o];if(!Y(r)||!Number.isFinite(r))throw I(e,o,`expected a finite number, got ${R(r)}`);return r}function Et(e,t,o){let r=t[o];if(!Y(r)||!Number.isInteger(r))throw I(e,o,`expected an integer, got ${R(r)}`);return r}function Zx(e,t,o,r,i){let s=$t(e,t,o);if(s<r||s>i)throw I(e,o,`${s} is outside the supported range ${r}–${i}`);return s}function Hi(e,t,o){let r=t[o];if(!Ze(r))throw I(e,o,`expected a boolean, got ${R(r)}`);return r}function qn(e,t,o,r){let i=t[o],s=n(i)?r.find((a)=>a===i):void 0;if(s===void 0)throw I(e,o,`${R(i)} is not declared — declared: ${r.join(", ")||"none"}`);return s}function QC(e,t,o){let r=t[o];if(!Mt(r))throw I(e,o,`expected an array of path segments (strings or numbers), got ${R(r)}`);return r}function oM(e,t,o){if(t[o]===null)return null;return QC(e,t,o)}function mI(e,t,o){let r=t[o];if(!Array.isArray(r))throw I(e,o,`expected an array of document paths, got ${R(r)}`);return r.map((i,s)=>{if(!Mt(i))throw I(e,o,`entry ${s} is not a document path — expected an array of segments, got ${R(i)}`);return i})}function Se(e,t=Object.keys(e)){return{additionalProperties:!1,properties:e,required:[...t],type:"object"}}function pi(e,t){return{description:t,enum:[...e],type:"string"}}function gl(e,t){return{description:t,get enum(){return[...e()]},type:"string"}}function gI(e,t={}){return{description:e,type:"number",...t}}function To(e){return{description:e,type:"boolean"}}function Xx(e,t=!1){let o={items:{type:["string","number"]},type:"array"};return t?{description:e,oneOf:[o,{type:"null"}]}:{description:e,...o}}function rM(e){return{description:e,items:{items:{type:["string","number"]},type:"array"},type:"array"}}function Fe(e){return{description:e,type:"string"}}function lo(e){return e.length===2&&e.includes("string")&&e.includes("number")}function Ue(e){return n(e)?[e]:e}function Lt(e){let t=e;if("enum"in t)return"enum";if("const"in t)return"const";if(Array.isArray(t.oneOf))return"one-of";if(Array.isArray(t.type))return"typed";switch(t.type){case"boolean":return"boolean";case"number":case"integer":{if(t.minimum!==void 0&&t.maximum!==void 0)return"bounded-number";return t.type==="integer"?"integer":"number"}case"string":return"string";case"array":{let o=t.items?.type;if(Array.isArray(o))return lo(o)?"path":"pass-through";return o==="array"?"path-list":"pass-through"}case"null":case"object":return"typed";default:break}return"pass-through"}function Nt(e,t){switch(e){case"null":return t===null;case"boolean":return Ze(t);case"string":return n(t);case"number":return Y(t)&&Number.isFinite(t);case"integer":return Y(t)&&Number.isInteger(t);case"array":return Array.isArray(t);case"object":return _(t)&&!Array.isArray(t);default:break}return!1}function _t(e){if(e.length<=1)return e.join("");return`${e.slice(0,-1).join(", ")} or ${e.at(-1)}`}function co(e,t,o,r){let i=t[o];if(i===void 0||!r.some((s)=>Nt(s,i)))throw I(e,o,`expected ${_t(r)}, got ${R(i)}`);return i}function Vt(e){switch(Lt(e)){case"enum":return`one of ${(e.enum??[]).map((t)=>R(t)).join(" | ")}`;case"const":return`the constant ${R(e.const)}`;case"one-of":return(e.oneOf??[]).map((t)=>Vt(t)).join(" or ");case"typed":return _t(Ue(e.type??[]));case"boolean":return"a boolean";case"bounded-number":return`a number from ${e.minimum} to ${e.maximum}`;case"number":return"a finite number";case"integer":return"an integer";case"string":return"a non-empty string";case"path":return"a document path";case"path-list":return"a list of document paths";default:return"anything"}}function uo(e,t,o,r){let i=t[o],s=[];for(let a of r){if(a.type!==void 0&&!Ue(a.type).some((l)=>Nt(l,i)))continue;try{return Bt(e,t,o,a)}catch(l){s.push(l)}}if(s.length===1)throw s[0];throw I(e,o,`expected ${r.map((a)=>Vt(a)).join(" or ")}, got ${R(i)}`)}function Bt(e,t,o,r){switch(Lt(r)){case"enum":return qn(e,t,o,r.enum??[]);case"const":{let i=t[o];if(i!==r.const)throw I(e,o,`expected the constant ${R(r.const)}, got ${R(i)}`);return i}case"one-of":return uo(e,t,o,r.oneOf??[]);case"typed":return co(e,t,o,Ue(r.type??[]));case"boolean":return Hi(e,t,o);case"bounded-number":{if(r.type==="integer")Et(e,t,o);return Zx(e,t,o,r.minimum,r.maximum)}case"number":return $t(e,t,o);case"integer":return Et(e,t,o);case"string":return St(e,t,o);case"path":return QC(e,t,o);case"path-list":return mI(e,t,o);default:return t[o]}}function sM(e,t,o){let r=t,i=r.properties??{},s=Object.keys(i),a=r.required??[],l={};for(let[c,u]of Object.entries(o)){if(u===void 0||Object.hasOwn(i,c))continue;if(r.additionalProperties===!1)throw I(e,c,`not declared — declared: ${s.join(", ")||"none"}`);l[c]=u}for(let c of s){if(o[c]===void 0&&!a.includes(c))continue;l[c]=Bt(e,o,c,i[c])}return l}var fo=20,fi="primary",Xm="secondary",yI=2,m=g({activePaneId:fi,clipboard:null,closedTabs:[],componentRegistry:[],mruOrder:[],fileTree:{dirs:new Map,expanded:new Set,searchQuery:"",selectedPath:null},panes:[{activeTabId:null,derived:null,id:fi,tabOrder:[]}],projectConfig:null,projectRoot:null,styleClipboard:null,tabs:new Map,ui:{activityBar:"files"},get activeTabId(){let e=qr();return e.derived?.kind==="lens"?pn(e.derived.sourcePaneId)?.activeTabId??null:e.activeTabId},get tabOrder(){return qr().tabOrder}}),h=Ph(()=>m.activeTabId?m.tabs.get(m.activeTabId)??null:null);function qr(){let{panes:e}=m;return e.find((t)=>t.id===m.activePaneId)??e[0]}function pn(e){return m.panes.find((t)=>t.id===e)}function Da(e){return m.panes.find((t)=>t.tabOrder.includes(e))}function Sr(e){let t=pn(e);if(!t||t.id===m.activePaneId)return;m.activePaneId=t.id,L();let{activeTabId:o}=t;if(o){qe(o);let r=m.tabs.get(o);if(r)zt(r)}}function Qm(e){return m.activePaneId===e}function i1(e){let t=e??qr().activeTabId,o=t?m.tabs.get(t):null;if(!t||!o)return null;let r=Da(t);if(!r)return null;let i=oc(r.id);return ng(t),Sh(i,t),i.activeTabId=t,m.activePaneId=i.id,L(),qe(t),i}function o1(e){return m.panes.find((t)=>t.id!==e)??po(Xm)}function oc(e){let t=o1(e);if(t.derived)t.derived=null;return t}function po(e){let t=pn(e);if(t)return t;return m.panes=[...m.panes,{activeTabId:null,derived:null,id:e,tabOrder:[]}],pn(e)}function eg(e){if(m.panes.length<2)return;let t=e===fi?m.panes.find((s)=>s.id!==fi)?.id:e,o=t===void 0?void 0:pn(t),r=m.panes.find((s)=>s.id!==t);if(!o||!r)return;for(let s of o.tabOrder)Sh(r,s);let i=o.activeTabId!==null&&K(o.activeTabId)?o.activeTabId:null;if(r.activeTabId=m.activePaneId===o.id?i??r.activeTabId??o.activeTabId:r.activeTabId??o.activeTabId,m.activePaneId=r.id,r.derived?.sourcePaneId===o.id)r.derived=null;m.panes=m.panes.filter((s)=>s.id!==o.id),L()}function tg(e){return e.tabOrder.length===0&&e.derived===null}var K=()=>!0;function r1(e){K=e??(()=>!0)}var Ut=null;function s1(e){Ut=e}var qt=null;function a1(e){qt=e}function mo(){let e=0;for(let t of m.tabs.keys())if(K(t))e+=1;return e}function Gt(e){return e.tabOrder.findLast((t)=>K(t))??null}function ng(e){let t=[];for(let o of m.panes){if(!o.tabOrder.includes(e))continue;if(o.tabOrder=o.tabOrder.filter((r)=>r!==e),o.activeTabId===e)o.activeTabId=Gt(o);if(o.id!==fi&&tg(o))t.push(o.id)}for(let o of t)eg(o)}function Sh(e,t,o){if(e.tabOrder.includes(t))return;let r=o??bo(e,t);e.tabOrder=[...e.tabOrder.slice(0,r),t,...e.tabOrder.slice(r)]}function yo(e){let t=0;for(let o of e.tabOrder){if(m.tabs.get(o)?.pinned!==!0)break;t+=1}return t}function bo(e,t){return m.tabs.get(t)?.pinned===!0?yo(e):e.tabOrder.length}function rc(e,t=null){if(m.projectRoot&&e!==m.projectRoot)n1();m.projectRoot=e,m.projectConfig=t}function Yp(e){let t=h.value;return e!==null&&t!==null&&le(t)===le(e)}function bl(e){if(!e)return!1;let t=m.tabs.get(e.id);return t!==void 0&&le(t)===le(e)}function qe(e){m.mruOrder=[e,...m.mruOrder.filter((t)=>t!==e)]}var Pe=null,se=0;function L(){Pe=null,se=0}function zt(e){if(C&&e.documentPath)C.selectedPath=e.documentPath}function l1(e){let t=pn(e);if(t)t.activeTabId=null}function ae(e,t={}){let o=m.tabs.get(e),r=Da(e);if(!o||!r)return;if(r.activeTabId=e,t.focus===!1)return;if(m.activePaneId=r.id,!t.cycling)L(),qe(e);zt(o)}function Si(e){if(e.background===!0){let a=m.tabs.get(e.id);if(a)return a;let l=yv({...e,preview:!1}),c=(e.paneId===void 0?void 0:pn(e.paneId))??qr();return Sh(c,l.id),m.tabs.set(l.id,l),l}let t=m.tabs.get(e.id),o=e.preview===!0&&t?.pinned!==!0,r=yv({...e,preview:o}),i=(e.paneId===void 0?void 0:pn(e.paneId))??qr(),s;if(t)r.pinned=t.pinned,Km(t);else{if(o){let l=Ht(i),c=l?m.tabs.get(l):null;if(c)nu(c);c1()}let a=o?Ht(i):null;if(a)s=i.tabOrder.indexOf(a),eu(a);Sh(i,r.id,s)}return m.tabs.set(r.id,r),ae(r.id,{focus:e.focus!==!1}),ie(r),r}function Ht(e){return e.tabOrder.find((t)=>m.tabs.get(t)?.preview===!0)??null}function td(e){let t=m.tabs.get(e);if(t?.preview===!0)t.preview=!1}function c1(){for(let[e,t]of m.tabs)if(t.preview&&(t.doc.dirty||Cv(t)))td(e)}var Yt=null;function wI(e){Yt=e}function Cv(e){return Yt?.(e)??!1}function r0(e,t){let o=m.tabs.get(e),r=Da(e);if(!o||!r)return;if(o.pinned=t,t)o.preview=!1;let i=r.tabOrder.filter((a)=>a!==e),s=i.filter((a)=>m.tabs.get(a)?.pinned===!0).length;r.tabOrder=[...i.slice(0,s),e,...i.slice(s)]}function xI(e,t){let o=m.tabs.get(e),r=Da(e);if(!o||!r)return;r.tabOrder=Zt(r,e,t)}function Zt(e,t,o){let r=m.tabs.get(t);if(!r)return e.tabOrder;let i=e.tabOrder.filter((u)=>u!==t),s=i.filter((u)=>m.tabs.get(u)?.pinned===!0).length,a=r.pinned?0:s,l=r.pinned?s:i.length,c=Math.min(Math.max(o,a),l);return[...i.slice(0,c),t,...i.slice(c)]}function eu(e){let t=m.tabs.get(e);if(!t)return;let o=Da(e),r=o?.activeTabId===e;if(ho(t),Km(t),m.tabs.delete(e),Vx(e),ng(e),m.mruOrder=m.mruOrder.filter((l)=>l!==e),L(),o&&tg(o))eg(o.id);if(!r)return;let i=qr(),s=qt?.(i.id)??null,a=(s!==null&&i.tabOrder.includes(s)?s:null)??m.mruOrder.find((l)=>i.tabOrder.includes(l)&&K(l))??Gt(i);if(a)ae(a);else Ut?.(i.id)}function _I(){let e=[...m.tabs.values()];m.tabs.clear(),Xt(),m.mruOrder=[],L();for(let t of e)Km(t)}function Xt(){m.panes=[{activeTabId:null,derived:null,id:fi,tabOrder:[]}],m.activePaneId=fi}function ho(e){if(!e.documentPath)return;let t=e.documentPath;m.closedTabs=[{documentPath:t},...m.closedTabs.filter((o)=>o.documentPath!==t)].slice(0,fo)}function xo(){let[e]=m.closedTabs;if(!e)return;return m.closedTabs=m.closedTabs.slice(1),e.documentPath}function Kt(e){if(!Pe)Pe=m.mruOrder.filter((r)=>m.tabs.has(r)&&K(r)),se=0;let t=Pe;if(t.length<2)return;se=((se+e)%t.length+t.length)%t.length;let o=t[se];return ae(o,{cycling:!0}),o}function SI(e){let t=[...m.tabs.keys()],o=[...m.tabs.values()],r=yv(e);m.tabs.set(r.id,r),Xt(),m.panes[0].tabOrder=[r.id],m.mruOrder=[],L(),ae(r.id),ie(r);for(let i of t){if(i===r.id)continue;m.tabs.delete(i)}for(let i of o)Km(i);return r}function Ft(e,t={}){ae(e,t)}function kv(e,t,o){let r=pn(t);if(!r||!m.tabs.has(e))return null;if(r.tabOrder.includes(e)){if(o!==void 0)r.tabOrder=Zt(r,e,o);return r}return ng(e),Sh(r,e,o),r}function CI(e,t,o){let r=m.tabs.get(e);if(!r)return;if(r.id=t,r.documentPath=o,ZC(e))Vx(e),qm(t);m.tabs.delete(e),m.tabs.set(t,r);for(let i of m.panes)if(i.tabOrder=i.tabOrder.map((s)=>s===e?t:s),i.activeTabId===e)i.activeTabId=t;m.mruOrder=m.mruOrder.map((i)=>i===e?t:i),L(),jt(r)}function kI(e,t){e.registerAll([...vo(t),...Oo(t)])}function vo(e){let t=()=>mo()>1;return[{id:"document.nextTab",title:"Next Tab",category:"Document",level:"document",keybinding:["ctrl+tab","mod+tab"],menus:["palette"],group:"2_navigate",when:(o)=>o.document.open,enablement:t,requires:"a second open document in this workspace",run:()=>{Kt(1)}},{id:"document.previousTab",title:"Previous Tab",category:"Document",level:"document",keybinding:["ctrl+shift+tab","mod+shift+tab"],menus:["palette"],group:"2_navigate",when:(o)=>o.document.open,enablement:t,requires:"a second open document in this workspace",run:()=>{Kt(-1)}},{args:Se({path:Fe('Project-relative path of the file to open, e.g. "pages/about.json" or "components/nav-bar.json". It must exist.')}),id:"document.open",title:"Open Document",category:"Document",level:"project",menus:["palette"],group:"1_file",when:(o)=>o.project.open,requires:"an open project",aiTool:{description:"Open a project file as the active document; the document tools then operate on it. Use it when the user should SEE the page, or for iterative visual refinement after creating a page or component.",name:"open_document",report:({after:o,args:r})=>{let i=St("document.open",r,"path"),s=h.value?.documentPath??null;if(s!==i)return`Opened "${i}", but the active document is ${s===null?"none":`"${s}"`}.`;let a=o.editor.kind==="canvas"?"on the canvas; the document tools now operate on it":`in the ${Gp[o.editor.kind]} editor, which is not an element tree the document tools can edit`;return`"${i}" is the active document, ${a}.`}},run:async(o,r)=>{let i=St("document.open",r,"path");if(await e.openFile(i),![...m.tabs.values()].some((s)=>s.documentPath===i))throw RangeError(`command "document.open" argument "path": "${i}" could not be opened — it does `+"not exist, or no editor claims its format. Problems has the reason.")}},{args:Se({file:Fe('Project-relative path of the file to open in the other pane, e.g. "pages/about.json". It must exist.')}),id:"document.openToSide",title:"Open to the Side",category:"Document",level:"project",menus:["context/file","palette"],group:"1_file",when:(o)=>o.project.open,requires:"an open project",undo:"none",run:async(o,r)=>{let i=St("document.openToSide",r,"file"),s=oc(qr().id);if(await e.openFile(i,{paneId:s.id}),![...m.tabs.values()].some((a)=>a.documentPath===i)){if(tg(s)&&s.id!==fi)eg(s.id);throw RangeError(`command "document.openToSide" argument "file": "${i}" could not be opened — it `+"does not exist, or no editor claims its format. Problems has the reason.")}}},{id:"document.reopenClosed",title:"Reopen Closed Document",category:"Document",level:"document",keybinding:"mod+shift+t",menus:["context/tab","palette"],group:"1_file",enablement:()=>m.closedTabs.length>0,requires:"a document closed in this session",run:async()=>{let o=xo();if(o)await e.openFile(o)}},{id:"document.togglePinned",title:"Pin / Unpin Document",category:"Document",level:"document",menus:["context/tab","palette"],group:"1_file",when:(o)=>o.document.open,requires:"an open document",run:()=>{let o=m.activeTabId,r=o?m.tabs.get(o):null;if(o&&r)r0(o,!r.pinned)}},{args:Se({pinned:To("True to pin the active document's tab, false to unpin it.")}),id:"document.setPinned",title:"Set Document Pinned",category:"Document",level:"document",menus:["palette"],group:"1_file",when:(o)=>o.document.open,requires:"an open document",run:(o,r)=>{let i=m.activeTabId;if(i&&m.tabs.get(i))r0(i,Hi("document.setPinned",r,"pinned"))}},{id:"document.keepOpen",title:"Keep Document Open",category:"Document",level:"document",menus:["context/tab","palette"],group:"1_file",when:(o)=>o.document.open,enablement:()=>{let o=m.activeTabId;return o!==null&&m.tabs.get(o)?.preview===!0},requires:"a preview document — one opened by a single click",run:()=>{let o=m.activeTabId;if(o)td(o)}}]}function Oo(e){let t=()=>m.panes.length>1;return[{id:"pane.splitRight",title:"Split Right",category:"View",level:"document",keybinding:"mod+\\",menus:["context/pane","context/tab","palette"],group:"5_pane",when:(o)=>o.document.open,enablement:()=>m.activeTabId!==null,requires:"an open document",undo:"none",run:()=>{i1()}},{args:Se({path:Fe("Project-relative path of the document to open beside this one.")}),id:"pane.compareWith",title:"Compare With…",category:"View",level:"document",menus:["context/pane","context/tab","palette"],group:"5_pane",when:(o)=>o.document.open,enablement:()=>m.activeTabId!==null,requires:"an open document",undo:"none",run:async(o,r)=>{let i=St("pane.compareWith",r,"path"),s=qr();if((s.activeTabId?m.tabs.get(s.activeTabId):null)?.documentPath===i)throw RangeError(`command "pane.compareWith" argument "path": "${i}" is the document this pane is `+"already showing — name a different one");await e.openFileInPane(oc(s.id).id,i)}},{id:"pane.focusPrimary",title:"Focus Primary Pane",category:"View",level:"document",keybinding:"mod+0",menus:["palette"],group:"5_pane",enablement:t,requires:"a split pane grid",undo:"none",run:()=>{Sr(fi)}},{id:"pane.focusSecondary",title:"Focus Side Pane",category:"View",level:"document",keybinding:"mod+alt+0",menus:["palette"],group:"5_pane",enablement:t,requires:"a split pane grid",undo:"none",run:()=>{Sr(Xm)}},{id:"pane.unsplit",title:"Close Side Pane",category:"View",level:"document",menus:["context/pane","palette"],group:"5_pane",enablement:t,requires:"a second pane",undo:"none",run:Po}]}function Po(){let e=m.panes.find((t)=>t.derived!==null);if(e?.id===fi){if(e.derived=null,!tg(e))return}eg(e?.id??Xm)}
2
+ export{KC,jn,Fx,fv,Wt,ln,go,jx,mv,Qc,VO,JC,Up,Hx,aI,bh,Bx,qp,$a,ml,gv,Gp,Qs,UO,zx,vh,Wx,bv,YC,qO,qm,Vx,ZC,lI,vv,Hn,Vr,Ux,yh,qx,GO,Gx,cI,Gm,KO,an,yv,XC,dI,JO,Km,xn,wv,Oe,YO,Kx,Ia,Jx,ZO,XO,Jm,QO,eM,tM,nM,ea,uI,iM,hI,pI,fI,Yx,xv,_v,St,ti,Zx,Hi,qn,QC,oM,mI,Se,pi,gl,gI,To,Xx,rM,Fe,sM,aM,Bi,Jd,Gn,ed,Qx,e0,e1,lM,Ra,wh,xh,Sv,t0,cM,ir,Z,Yd,dM,uM,bI,hM,Zd,pM,fM,t1,mM,or,_h,vI,Ym,n0,gM,Kp,Qe,Zm,_r,bM,i0,vM,o0,yM,wM,Xd,xM,Ur,_M,Jp,SM,CM,kM,Qd,EM,TM,LM,$M,IM,n1,RM,fi,Xm,yI,m,h,qr,pn,Da,Sr,Qm,i1,o1,oc,eg,tg,r1,s1,a1,ng,Sh,rc,Yp,bl,l1,Si,td,c1,wI,Cv,r0,xI,eu,_I,SI,Ft,kv,CI,kI};
3
+
4
+ //# debugId=2896DE7491A37F0564756E2164756E21
5
+ //# sourceMappingURL=studio-knsjyx7n.js.map
@@ -0,0 +1,5 @@
1
+ import{X}from"./studio-9c6cbq2c.js";import{PI,p,ye}from"./studio-4fnb5648.js";import{ra,At}from"./studio-1ks5d9y4.js";import{fn}from"./studio-q9hx2qp0.js";import{xn,m,h,Si,Ft}from"./studio-knsjyx7n.js";import{ar,w}from"./studio-sce30r7b.js";import{Jt,Ut}from"./studio-nzemfbkk.js";import{jb}from"./studio-jma2q8r9.js";import{u}from"./studio-pwctzka3.js";import{sn,dt,qo,Fn,Q$}from"./studio-tpxcryf2.js";import{ZS}from"./studio-k2evngrj.js";import{qs,tA,sl}from"./studio-v7a7yb5w.js";import{hi,Om,ec,l$,d$,Xb}from"./studio-xva3hzkv.js";import{eA}from"./studio-ejrypvmq.js";import{MM,C,jM,sr}from"./studio-4f7thq0p.js";import{Ve,vt,E,R}from"./studio-9dq7rwc7.js";import{g}from"./studio-3qr08sxq.js";import{n,Q,_,v}from"./studio-k3we3kqb.js";import{ce}from"./studio-0939t1q1.js";var wt={children:[],tagName:"div"},xt=new Set(["bunfig.json","jsconfig.json","package-lock.json","package.json","tsconfig.json","wrangler.json"]);function Mb(t){let e=t.slice(t.lastIndexOf("/")+1);if(xt.has(e)||e.endsWith(".schema.json"))return!1;return t.endsWith(".json")||Boolean(fn(t))}function B(t,e){if(t.startsWith("../")||t.includes("/../"))return`"${t}" is outside this project, so its comparison belongs to the project that owns it.`;if(e==="R")return"A renamed file's comparison needs both paths, and Studio does not model the old name yet.";if(jb(t))return`"${t}" is an image or media file, and a comparison of one is not text.`;return null}function Pt(){return["git-diff"]}function St(t){let e=m.tabs.get(t);if(e)return Ft(t),e;return Si({capabilities:{modes:Pt()},document:structuredClone(wt),documentPath:t,id:t,sourceFormat:null})}async function V(t){if(!Mb(t))return St(t);let e=await (ce("zrqtgt41"),import("./files-zrqtgt41.js"));return await e.openFileInTab(t,{canvasMode:"git-diff"}),[...m.tabs.values()].find((o)=>o.documentPath===t)??null}var W={$schema:"https://jxsuite.com/schema/v1",$id:"StudioGithubPublish",$description:"Create GitHub Repository: the three things the flow needs before it calls the API — the repository's name, an optional description, and whether it is private. A `jx-dialog`, so the platform owns modality, Escape, focus restoration and the backdrop, and the kit draws both answer buttons. Nothing here reaches GitHub: `github/github-publish.ts` keeps the token, the request and the activity, and this document only collects.",tagName:"jx-dialog",$props:{headline:"Create GitHub Repository",confirmLabel:"Create Repository",cancelLabel:"Cancel",size:"sm"},attributes:{part:"github-publish"},onconfirm:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/confirm"},value:[]}]},oncancel:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/cancel"},value:[]}]},onclose:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/closed"},value:[]}]},style:{$description:'What is NOT here is most of the conversion. `.github-publish-dialog` was a flex column with an 8px gap and `8px 0` of padding: the gap is the one thing it said that nothing else draws, and `jx-dialog`\'s own body already pads the content, so only the gap survives. `.github-publish-dialog sp-textfield { width: 100% }` had nothing to transcribe either — a `jx-field` row is a grid whose control cell stretches, so the field fills the row without being told to. The three `sp-field-label`s are gone with them, because `jx-field` draws the label AND names the control from it; the third of them carried no `for` at all, so "Visibility" was text beside a switch rather than a name for it.','& [part="rows"]':{display:"flex",flexDirection:"column",gap:"var(--jx-space-3)"}},children:[{tagName:"div",attributes:{part:"rows"},children:[{tagName:"jx-field",$props:{span:!0,label:"Repository name"},attributes:{part:"row","data-field":"name"},children:[{tagName:"jx-textfield",$props:{placeholder:"my-project",value:{$ref:"#/state/name"}},attributes:{part:"field"},oninput:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setName"},value:[{$ref:"event#/target/value"}]}]}}]},{tagName:"jx-field",$props:{span:!0,label:"Description (optional)"},attributes:{part:"row","data-field":"description"},children:[{tagName:"jx-textfield",$props:{placeholder:"A brief description",value:{$ref:"#/state/description"}},attributes:{part:"field"},oninput:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setDescription"},value:[{$ref:"event#/target/value"}]}]}}]},{tagName:"jx-field",$props:{span:!0,label:"Visibility"},attributes:{part:"row","data-field":"visibility"},children:[{tagName:"div",$description:'The row opens with a plain `div`, and that is the whole reason it exists: `jx-field` names the first thing slotted into it that observes `labelledby`, so a switch slotted straight in would be announced "Visibility" over the top of the words printed beside it. A `div` observes no naming, so the switch keeps the name its own label gives it.',attributes:{part:"visibility-row"},children:[{tagName:"jx-switch",attributes:{part:"toggle"},$props:{checked:{$ref:"#/state/isPrivate"}},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setPrivate"},value:[{$ref:"event#/target/checked"}]}]},children:[{tagName:"span",textContent:"Private repository"}]}]}]}]}]};E("github-publish",W);function q(t){let e=document.createElement("div");e.style.pointerEvents="auto",e.setAttribute(Ve,vt("dialog","github-publish")),t.layer.append(e);let o=!1,r=()=>{if(o)return;o=!0,t.onClosed()},i=()=>o,a=g({cancel:()=>{t.onCancel()},closed:r,confirm:()=>{t.onConfirm({description:a.description,isPrivate:a.isPrivate,name:a.name})},description:"",isPrivate:!0,name:t.name,setDescription:(l)=>{a.description=l},setName:(l)=>{a.name=l},setPrivate:(l)=>{a.isPrivate=l}}),s=null,d=R("github-publish",a,e).then(async(l)=>{s=l;let f=l.root;if(i())return l.dispose(),f;if(await sn(f),i())return f;return Jt(f),f});return{close(){if(o)return;let l=s?.root;if(l instanceof HTMLElement)Ut(l);s?.dispose(),s=null,e.remove(),r()},host:e,ready:d}}var k=["Create the repository","Add the remote","Push"];function kt(t){return new Promise((e)=>{let o=!1,r=(a)=>{if(o)return;o=!0,e(a)},i=q({layer:dt("dialog"),name:t,onCancel:()=>{i.close()},onClosed:()=>{r(null)},onConfirm:(a)=>{r({...a,name:a.name||t}),i.close()}})})}async function z({projectName:t}){let e=await ZS();if(!e)return!1;let o=await kt(t);if(!o)return!1;let r=qs({source:"Source Control",status:`Creating ${o.name}…`,steps:[...k],title:"Create GitHub repository"});r.step(k[0]);let i;try{i=await fetch("https://api.github.com/user/repos",{body:JSON.stringify({auto_init:!1,description:o.description,name:o.name,private:o.isPrivate}),headers:{Accept:"application/vnd.github+json",Authorization:`Bearer ${e}`,"Content-Type":"application/json"},method:"POST"})}catch(c){return r.log(X(c)),r.fail("Could not reach GitHub to create the repository.",{action:"git.createGithubRepository"}),!1}if(!i.ok){let c=await i.json();return r.log(c.errors?.[0]?.message||c.message||`GitHub answered ${i.status}.`),r.fail("Could not create the GitHub repository.",{action:"git.createGithubRepository"}),!1}let a=await i.json();r.log(`Created ${a.html_url}`);let s=p();r.step(k[1]);try{await s.gitAddRemote("origin",a.clone_url)}catch(c){return r.log(X(c)),r.fail("The repository was created, but the remote could not be added.",{action:"view.setWorkspace",actionArgs:{workspace:"publish"}}),!1}r.step(k[2]);try{await s.gitPush({setUpstream:!0})}catch(c){return r.log(X(c)),r.fail("The repository was created, but the push failed.",{action:"git.push"}),!1}let{refreshGitStatus:d}=await (ce("h3hcs5gy"),import("./source-control-h3hcs5gy.js"));return await d(),r.done(a.html_url),w.success(`Repository created: ${a.html_url}`,{key:"github.repo"}),!0}var x=[];function jt(){return ye()&&Q(p().listProjects)}async function qS(){if(!jt()){x=[];return}try{x=await p().listProjects?.()??[]}catch{x=[]}}function YN(){return x}function K(t){x=t}var Z=2,Rt=1e4;class Y extends Error{blockedBy;constructor(t,e){super(t.length===0?`Studio did not report ${Z} consecutive quiet frames within ${e}ms`:`Studio was not idle after ${e}ms — blocked by ${t.join("; ")}`);this.name="NotIdleError",this.blockedBy=t}}function tt(){return[{blockers:()=>{let t=jM();return t>0?[`render: ${t} renderer(s) mid-paint`]:[]},name:"render"},{blockers:l$,name:"canvas"},{blockers:()=>{let t=PI();if(t.length===0)return[];return[`platform: ${t.length} in-flight (${[...new Set(t)].join(", ")})`]},name:"platform"},{blockers:Q$,name:"overlay"},{blockers:tA,name:"activity"},{blockers:eA,name:"grid"}]}function $t(t=tt()){let e=[];for(let o of t)e.push(...o.blockers());return e}function et(t={}){let{frames:e=Z,now:o=()=>Date.now(),raf:r=(s)=>{requestAnimationFrame(()=>s())},sources:i=tt(),timeoutMs:a=Rt}=t;return new Promise((s,d)=>{let c=o()+a,l=0,f=!1,J=[],H=()=>{if(f)return;let S=$t(i);if(S.length>0)J=S,l=0;else if(l+=1,l>=e){f=!0,s();return}if(o()>=c){f=!0,d(new Y(S.length>0?S:J,a));return}r(H)};r(H)})}var ot=/\.toggle[A-Z]/;function Dt(t){return t.replace(/\.toggle([A-Z])/,(e,o)=>`.set${o}`)}function rt(t){return!ot.test(t.id)}var Et={"file.contextMenu":{disposition:"refused",note:"opening a menu to press an item names a control; the ITEM is the command"},"layers.contextMenu":{disposition:"refused",note:"matched RENDERED TEXT, which R1 of scripts/screenshots/README.md forbids; a row is addressed by its data-jx-path"},"project.showWelcome":{disposition:"refused",note:"cold start is a startup profile (?profile=fresh), not an action"},"settings.setSection":{disposition:"refused",note:`mirrored the section registry's LABELS; say settings.open { section: "contexts" }`},"view.setStatus":{disposition:"refused",note:"the status bar is not staged — if a capture needs a calm shell, the app must BE calm"}},Tt=new Map(Object.entries(Et)),Gt={openSettings:'a user opens Settings — run("settings.open")',select:'a user selects a node — run("selection.set", { path })',setActivity:'a user picks a Navigator panel — run("navigator.showPanel", { panel })',setRightTab:'a user picks an Inspector tab — run("inspector.setTab", { tab })',setStatus:"the status bar reports what the app just did; staging it is the one lie the Remote Rule (studio.md §13.5) names outright",setZoom:'a user zooms — run("canvas.setZoom", { zoom })'},It=new Map(Object.entries(Gt));function I(t,e){let o=t[e];if(o===void 0)return[];if(!Array.isArray(o))throw TypeError(`seed argument "${e}" must be an array`);return o}function Lt(t,e){let o=t[e];if(!_(o))throw TypeError(`seed argument "${e}" must be an object`);return o}function Mt(t,e){let o=t[e];if(o===void 0)return;if(!n(o))throw TypeError(`seed argument "${e}" must be a string`);return o}function Nt(t){return[{boundary:"the assistant's model stream",id:"seed.assistant",run:(e)=>{t.seedAssistantMessages(I(e,"messages"))}},{boundary:"the collaboration websocket (awareness + sync)",id:"seed.collab",run:(e)=>{let o=h.value;if(!o)return;let r=xn(o);r.status="synced",r.active=!0;let i=[];for(let a of I(e,"peers")){let s={...a.state};s.focusedPath??=o.documentPath,i.push({...a,state:s})}r.peers=i,sr()}},{boundary:"the Cloudflare Pages API",id:"seed.publish",run:(e)=>{let o=Mt(e,"accountId"),r={deployment:Lt(e,"deployment")};if(o)r.accountId=o;t.seedPublishConnected(r)}},{boundary:"the platform's git routes (`gitStatus` / `gitBranches` / `gitLog`)",id:"seed.git",run:(e)=>{let{status:o,branches:r,log:i}=e;u.git.status=o??null,u.git.branches=r??null,u.git.logEntries=i??null,u.git.loading=!1,u.git.error=null,sr()}},{boundary:"the platform's recent-projects store (desktop IPC / cloud API)",id:"seed.projectList",run:(e)=>{K(I(e,"projects")),sr()}}]}class U extends Error{id;constructor(t,e){super(`automation refuses "${t}" — ${e}`);this.name="AutomationRefusedError",this.id=t}}function Ot(t){let e=[];for(let o of t.visible()){if(!rt(o))continue;let r=t.disabledReason(o.id),i={enabled:r===void 0,id:o.id,title:o.title};if(o.args)i.args=o.args;if(r!==void 0)i.requires=r;e.push(i)}return e}function _t(t,e,o){if(o.has(t))return`"${t}" is a seed, not a command — call seed("${t}", …)`;let r=Tt.get(t);if(r)return`"${t}" is refused by spec §13.5: ${r.note}`;let i=e.list().filter((a)=>rt(a)).map((a)=>a.id);return`unknown command "${t}" — the registry declares ${i.length} scriptable id(s)`}function Ht(t){let e=new Map(Nt(t).map((r)=>[r.id,r])),o=new Set(e.keys());return{probe:{commands:()=>Ot(t.registry),idle:(r={})=>et(r),pointAt:(r)=>d$(r.path),revealPath:(r)=>Xb(r),seeds:()=>[...e.values()].map((r)=>({boundary:r.boundary,id:r.id})),state:()=>t.registry.context()},async run(r,i={}){if(ot.test(r))throw new U(r,`it names a delta against state the caller cannot observe; call "${Dt(r)}"`);let{registry:a}=t;if(!a.get(r))throw Error(_t(r,a,o));await a.run(r,i)},async seed(r,i={}){let a=r.startsWith("seed.")?r.slice(5):r,s=It.get(a);if(s)throw new U(r,`a seed stands in for a remote, never for a user: ${s}`);let d=e.get(r.startsWith("seed.")?r:`seed.${r}`);if(!d)throw Error(`unknown seed "${r}" — declared seeds are ${[...e.keys()].join(", ")}`);await d.run(i)}}}function Kw(t){return new URLSearchParams(t).get("automation")==="1"}function ZN(t){if(!Kw(location.search))return!1;return globalThis.__jxAutomation=Ht(t),!0}var nt={$schema:"https://jxsuite.com/schema/v1",$id:"StudioJxsuiteUpdate",$description:"The on-open offer to bring a project's `@jxsuite/*` dependencies up to their newest published versions: one sentence, and the packages that would move. A `jx-dialog`, so the platform owns modality, Escape, focus restoration and the backdrop, and the kit draws both answers. Nothing here asks the registry or writes a manifest: `packages/jxsuite-update.ts` keeps the lookup, the dismissal key and the install, and this document only says what is on offer.",tagName:"jx-dialog",$props:{headline:"Update @jxsuite packages?",confirmLabel:"Update",cancelLabel:"Not now",size:"sm"},attributes:{part:"jxsuite-update"},onconfirm:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/confirm"},value:[]}]},oncancel:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/cancel"},value:[]}]},onclose:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/closed"},value:[]}]},style:{$description:'The old body was a lit template with no stylesheet at all, which is why the conversion is mostly a deletion. Two `<br />`s stood in for a paragraph break, and one `<span style="white-space: pre-line">` held every package as a single `\\n`-joined string — a list spelled as whitespace. Neither is addressable and neither announces as what it is, so a screen reader read one run-on line and a test could only match a substring of it. It is a `<ul>` of keyed rows now: the list says how many packages there are, and each row is `[data-package]`. The one token repair travels with it — that span asked for `--spectrum-font-size-75`, which resolves only inside `<sp-theme>`, and a document mounted in the dialog layer is outside it, so the size silently fell back to the hard-coded `12px` written beside it.','& [part="offer"]':{display:"flex",flexDirection:"column",gap:"var(--jx-space-3)"},'& [part="lede"]':{margin:"0"},'& [part="list"]':{$description:"Capped and scrolling, because the count is the registry's rather than this dialog's: a project that has not been opened in a year can have every `@jxsuite/*` package behind at once, and a dialog that grows past the viewport puts its own Update button off screen.",listStyle:"none",margin:"0",padding:"0",display:"flex",flexDirection:"column",gap:"var(--jx-space-1)",maxHeight:"240px",overflowY:"auto"},'& [part="package"]':{display:"flex",justifyContent:"space-between",alignItems:"baseline",gap:"var(--jx-space-3)",fontSize:"var(--jx-text-sm)"},'& [part="package-name"]':{color:"var(--fg)"},'& [part="package-move"]':{$description:"Tabular figures, so a column of versions does not jitter between rows of different widths.",color:"var(--fg-dim)",fontVariantNumeric:"tabular-nums",whiteSpace:"nowrap"}},children:[{tagName:"div",attributes:{part:"offer"},children:[{tagName:"p",attributes:{part:"lede"},textContent:"Newer versions of these packages have been published. Update the project to them?"},{tagName:"ul",attributes:{part:"list"},children:[{$prototype:"Array",items:{$ref:"#/state/packages"},key:{$ref:"$map/item/name"},map:{tagName:"li",attributes:{part:"package","data-package":"${$map.item.name}"},children:[{tagName:"span",attributes:{part:"package-name"},textContent:"${$map.item.name}"},{tagName:"span",attributes:{part:"package-move"},textContent:"${$map.item.current} → ${$map.item.target}"}]}}]}]}]};E("jxsuite-update",nt);function it(t){let e=document.createElement("div");e.style.pointerEvents="auto",e.setAttribute(Ve,vt("dialog","jxsuite-update")),t.layer.append(e);let o=!1,r=()=>{if(o)return;o=!0,t.onClosed()},i=()=>o,a=g({cancel:()=>{t.onCancel()},closed:r,confirm:()=>{t.onConfirm()},packages:t.packages}),s=null,d=R("jxsuite-update",a,e).then(async(c)=>{s=c;let l=c.root;if(i())return c.dispose(),l;if(await sn(l),i())return l;return Jt(l),l});return{close(){let c=s?.root;if(c instanceof HTMLElement)Ut(c);s?.dispose(),s=null,e.remove(),r()},host:e,ready:d}}function Jw(t){return t.replace(/^[\^~>=<v\s]+/,"").trim().split(/\s+/)[0]??""}function at(t){if(t.includes(":"))return!1;return/^\d+\.\d+/.test(Jw(t))}function st(t){let e=Jw(t).split(/[-+]/)[0]??"",[o=0,r=0,i=0]=e.split(".").map((a)=>Math.trunc(Number(a))||0);return[o,r,i]}function Vt(t,e){let o=st(t),r=st(e);for(let i=0;i<3;i++){let a=o[i]??0,s=r[i]??0;if(a!==s)return a<s?-1:1}return 0}function GS(t,e){if(!at(t)||!at(e))return!1;return Vt(e,t)>0}var L="@jxsuite/";async function M(){let t=p();if(!t.packageVersions)return[];let e;try{e=await t.packageVersions()}catch{return[]}let o=[];for(let r of e)if(r.name.startsWith(L)&&GS(r.current,r.latest))o.push({current:r.current,dev:Boolean(r.dev),latest:r.latest,name:r.name});return o}function ct(t,e){let o=e.map((r)=>`${r.name}@${r.latest}`).toSorted().join(",");return`jx:jxsuite-update-dismissed:${t}:${o}`}function Wt(t,e){try{return localStorage.getItem(ct(t,e))==="1"}catch{return!1}}function qt(t,e){try{localStorage.setItem(ct(t,e),"1")}catch{}}async function N(t){let e=p();if(!e.setPackageVersions||t.length===0)return;let o=sl({status:"Updating @jxsuite packages…",title:"Updating dependencies"});try{let r=await e.setPackageVersions(t.map((i)=>({dev:i.dev,name:i.name,version:`^${i.latest}`})));if(r.ok)o.done(),w.success(`Updated ${t.length} @jxsuite package(s) to their latest versions.`);else o.fail(r.log??"Update failed")}catch(r){o.fail(r instanceof Error?r.message:String(r))}}function zt(t){return new Promise((e)=>{let o=!1,r=(d)=>{if(o)return;o=!0,e(d)},i=!1,a=()=>{if(i)return;i=!0,s.close()},s=it({layer:dt("dialog"),onCancel:()=>{a()},onClosed:()=>{r(!1),a()},onConfirm:()=>{r(!0),a()},packages:t.map((d)=>({current:d.current,name:d.name,target:`^${d.latest}`}))})})}async function Im(t){if(Kw(location.search))return;if(!p().setPackageVersions)return;let o=await M();if(o.length===0||Wt(t,o))return;if(!await zt(o)){qt(t,o);return}await N(o)}var j=["package.json","bun.lock","bun.lockb"],Xt=new Set(["??","U"]),Kt=25;function A(t){if(Array.isArray(t))return t.map((e)=>A(e));if(v(t)){let e={};for(let[o,r]of Object.entries(t).toSorted(([i],[a])=>i<a?-1:1))e[o]=A(r);return e}return t}function lt(t){let e={...t};for(let o of["dependencies","devDependencies"]){let r=e[o];if(!v(r))continue;let i={...r};for(let a of Object.keys(i))if(a.startsWith(L))i[a]="*";e[o]=i}return e}function Zt(t,e){if(t===null||e===null)return!1;let o,r;try{o=JSON.parse(t),r=JSON.parse(e)}catch{return!1}if(!v(o)||!v(r))return!1;return JSON.stringify(A(lt(o)))===JSON.stringify(A(lt(r)))}async function D(t,e){try{return await p().gitShow({path:t,ref:e})}catch{return null}}async function pt(t){try{return await p().readFile(t)}catch{return null}}async function mt(t){let e=[],o=[],r=!0;for(let i of j){let a=t.files.filter((c)=>c.path===i);if(a.length===0)continue;let s=await D(i,"@{u}");if(a.every((c)=>Xt.has(c.status))){if(s!==null)o.push(i);continue}let d=await D(i,"HEAD");if(s===null||s===d)continue;if(e.push(i),i==="package.json")r&&=Zt(d,await pt(i))}return{automated:r,discard:e,removeUntracked:o}}function ft(t){return t.discard.length===0&&t.removeUntracked.length===0}async function Qt(t){let e=[...new Set(t.files.filter((o)=>!j.includes(o.path)).map((o)=>o.path))];if(e.length>Kt)return!0;for(let o of e){let r=await D(o,"@{u}");if(r!==null&&r!==await D(o,"HEAD"))return!0}return!1}async function Yt(t){let e=p();if(t.discard.length>0)await e.gitUnstage(t.discard),await e.gitDiscard(t.discard);for(let o of t.removeUntracked)await e.deleteFile(o)}async function O(){let t=p(),e=[];try{e=await M()}catch{e=[]}if(e.length>0&&t.setPackageVersions){await N(e);return}if(!t.installDependencies)return;let o=sl({status:"Installing dependencies…",title:"Syncing dependencies"});try{let r=await t.installDependencies();if(r.ok)o.done();else o.fail(r.log??"Install failed")}catch(r){o.fail(X(r))}}async function gt(t){let e=p();try{await Yt(t)}catch(o){throw Error(`Could not reset local package files: ${X(o)}`,{cause:o})}try{await e.gitPull()}catch(o){throw await O(),o}w.warn("Local package updates were superseded by pulled changes.",{source:"Source Control"}),await O()}async function te(t){let e=p(),o;try{o=await e.gitStatus()}catch{throw t}if(!(o.behind>0))throw t;let r=await mt(o);if(ft(r)||await Qt(o))throw t;if(!r.automated){if(!await qo("Discard local package changes?","package.json / bun.lock have local edits that conflict with incoming changes. Discard them, pull, and re-sync packages?",{confirmLabel:"Discard and pull",destructive:!0}))throw t}await gt(r)}async function ut(){let t;try{let e=await p().listDirectory("");t=new Set(e.filter((o)=>o.type==="file").map((o)=>o.name))}catch{t=new Set(j)}return Promise.all(j.map((e)=>t.has(e)?pt(e):Promise.resolve(null)))}async function F(){let t=p(),e=await ut(),o=null;try{await t.gitFetch(),o=await t.gitStatus()}catch{o=null}if(o&&o.behind>0){let i=await mt(o);if(!ft(i)&&i.automated){await gt(i);return}}try{await t.gitPull()}catch(i){await te(i);return}let r=await ut();if(e.some((i,a)=>i!==r[a]))await O()}async function Rm(){let t=p();try{let e=await t.gitStatus();if(!e.isRepo||!Array.isArray(e.remotes)||e.remotes.length===0)return}catch{return}w.info("Syncing project…",{key:"project.sync",source:"Source Control"});try{await F()}catch(e){w.warn("The project could not be synced with its remote.",{detail:X(e),key:"project.sync",source:"Source Control",tier:"problem"})}}async function ee(){let t=p(),{git:e}=u,o;try{o=await t.gitStatus()}catch(r){e.error=X(r);return}if(e.status=o,!o.isRepo){e.branches=null;return}try{e.branches=await t.gitBranches()}catch(r){e.error=X(r)}}async function ks(){if(!C)return;let{git:t}=u;t.loading=!0,t.error=null;try{if(await ee(),t.lastUpdated=ar(),t.rev+=1,await oe(),t.logEntries!==null)await KS()}catch(e){t.error=X(e)}finally{t.loading=!1}}async function oe(){let t=u.git.diffState;if(!t)return;let e=u.git.status?.files.find((o)=>o.path===t.filePath);if(!e||!ht(e.status)){u.git.diffState=null;return}try{u.git.diffState=await G(t.filePath,e.status)}catch{}}async function XT(t){if(u.git.rev+=1,!u.git.loading)ks();let e=u.git.diffState;if(!t||e?.filePath!==t)return;try{u.git.diffState=await G(t,e.fileStatus)}catch{}}async function KS(){try{u.git.logEntries=await p().gitLog(30)}catch(t){u.git.error=X(t)}}async function JS(t){let e=p();if(!e.gitClone){w.warn("Cloning is not supported on this platform.",{source:"Source Control"});return}let o=await Fn("Clone Git Repository",{confirmLabel:"Clone",message:"Repository URL",placeholder:"https://github.com/user/repo.git",validate:(r)=>r.trim()?"":"Enter a repository URL."});if(!o)return;try{w.info("Cloning repository…",{key:"git.clone",source:"Source Control"});let r=await e.gitClone(o);if(r.root)w.success("Clone complete.",{key:"git.clone"}),await t.openRecentProject(r.root)}catch(r){w.error("Could not clone the repository.",{detail:X(r),key:"git.clone",source:"Source Control"})}}function Pb(){return ye()&&Boolean(p().gitClone)}function Us(){return ye()&&p().gitHosted===!0}function QT(){return ye()&&Q(p().createPullRequest)}var re=new Map([["A","added"],["D","deleted"],["M","modified"],["R","renamed"],["U","untracked"]]);function ne(t){return re.get(t)??"changed"}var ie=new Map([["A","NEW"],["D","DELETED"],["M","EDIT"],["R","RENAMED"],["U","NEW"]]);function eL(t){return ie.get(t)??"EDIT"}var ae=new Set(["M","A","U","D"]);function ht(t){return ae.has(t)}async function G(t,e){let o=p(),r=e!=="A"&&e!=="U",i=e!=="D",[a,s]=await Promise.all([r?o.gitShow({path:t,ref:"HEAD"}):Promise.resolve(""),i?o.readFile(t):Promise.resolve("")]);return{currentContent:s,filePath:t,fileStatus:e,originalContent:a}}async function tL(t,e){try{return await G(t,e)}catch(o){return console.warn("loadDiffForLens:",X(o)),null}}var T={};function nL(t){T=t}function iL(){T.cloneRepository?.()}function yt(t){return u.git.status?.files.find((e)=>e.path===t)}async function oL(t){let e=yt(t);if(!e)return;let o=ht(e.status)?B(e.path,e.status):`"${e.path}" has no change this view can open.`;if(o){u.git.error=o;return}try{u.git.loading=!0;let r=await G(e.path,e.status);u.git.diffState=r,T.setGitDiffState?.(r);let i=await V(e.path);if(i)T.setCanvasMode?.(i,"git-diff")}catch(r){u.git.error=`Failed to load diff: ${X(r)}`}finally{u.git.loading=!1}}async function y(t){let e=p();u.git.loading=!0,u.git.error=null;try{return await t(e),await ks(),!0}catch(o){return u.git.error=X(o),u.git.loading=!1,!1}}async function se(){try{w.info("Initializing repository…",{key:"git.init"}),await p().gitInit(),w.success("Repository initialized.",{key:"git.init"})}catch(t){w.error("Could not initialize the repository.",{action:"git.init",detail:X(t),key:"git.init",source:"Source Control"});return}await ks()}async function le(){await y((t)=>t.gitPush())}async function rL(){await y((t)=>t.gitFetch())}async function sL(){u.git.loading=!0,u.git.error=null;try{await F(),await ks()}catch(t){u.git.error=X(t),u.git.loading=!1}}async function ue(){await z({projectName:C?.name||"my-project"})}async function pe(){if(await ZS())w.success("Signed in to GitHub.",{key:"github.auth"})}async function aL(t,e){await y((o)=>e?o.gitStage([t]):o.gitUnstage([t]))}async function lL(t){let e=(u.git.status?.files??[]).filter((o)=>Boolean(o.staged)!==t).map((o)=>o.path);if(e.length===0)return;await y((o)=>t?o.gitStage(e):o.gitUnstage(e))}var b={paths:new Set,root:""};function de(){let t=C?.projectRoot??"";if(b.root!==t)b={paths:new Set,root:t};let e=u.git.status?.files??[],o=new Set(e.map((i)=>i.path));for(let i of b.paths)if(!o.has(i))b.paths.delete(i);let r=e.filter((i)=>!b.paths.has(i.path));for(let i of r)b.paths.add(i.path);return r.filter((i)=>!i.staged).map((i)=>i.path)}async function cL(){if(u.git.loading||!u.git.status?.isRepo)return;let t=de();if(t.length>0)await y((e)=>e.gitStage(t))}async function dL(t){if(yt(t)?.status==="U")return;if(!await qo("Discard Changes",`Discard changes to ${t}?`,{confirmLabel:"Discard",destructive:!0}))return;await y((o)=>o.gitDiscard([t]))}async function uL(){let{branches:t,status:e}=u.git,o=await Fn("New Branch",{confirmLabel:"Create",message:`Branching from ${t?.current||e?.branch||"the current branch"}.`,placeholder:"feature/my-change",validate:(r)=>r.trim()?"":"Enter a branch name."});if(o)await y((r)=>r.gitCreateBranch(o.trim()))}async function hL(t){if(t===u.git.branches?.current)return;if(Us()){if(!await qo("Switch Branch",`Each branch opens in its own session, so switching to ${t} reloads Studio on that branch.`,{confirmLabel:"Switch and reload"}))return}await y((e)=>e.gitCheckout(t))}function YS(t){let e=t.path.split("/"),o=e.pop()??t.path,r=e.join("/"),i=ne(t.status);return{cannotDiscard:t.status==="U",dir:r,hasDir:r!=="",included:Boolean(t.staged),key:t.path,label:`${t.path}, ${i}`,name:o,path:t.path,status:t.status,statusWord:i}}var bt=[["components","Components"],["layouts","Layouts"],["styles","Styles"]];function me(t){let e=ec(t);if(e!==null)return e;let[o]=t.split("/");if(o==="pages")return hi;if(bt.some(([r])=>r===o))return`folder:${o}`;return ra.has(At(t))?"media":"other"}function pL(t){let e=[...Om().map((r)=>[r.key,r.title]),...bt.map(([r,i])=>[`folder:${r}`,i]),["media","Media"],["other","Other"]],o=new Map;for(let r of t){let i=me(r.path);o.set(i,[...o.get(i)??[],r])}return e.flatMap(([r,i])=>{let a=o.get(r);return a?[{files:a.map((s)=>YS(s)),key:r,name:i}]:[]})}function fL(t){return{hash:t.hash.slice(0,7),key:t.hash,message:t.message,meta:`${t.author} · ${Yw(t.date)}`}}function Yw(t){let e=new Date(t),o=ar()-e.getTime(),r=Math.floor(o/60000);if(r<1)return"just now";if(r<60)return`${r}m ago`;let i=Math.floor(r/60);if(i<24)return`${i}h ago`;let a=Math.floor(i/24);if(a<30)return`${a}d ago`;return e.toLocaleDateString()}function mL(t){return t?`Last updated ${new Date(t).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}`:""}var P=null;function gL(){if(P)return;P=setInterval(()=>{if(u.workspace==="publish"&&!u.git.loading)ks()},MM)}function Fb(){if(P)clearInterval(P),P=null;b={paths:new Set,root:""}}function fe(){return[{category:"Source Control",id:"git.init",level:"project",menus:["commandbar/overflow","palette"],group:"7_scm",requires:"an open project that git is not already tracking",when:(t)=>t.project.open,enablement:(t)=>!t.project.isRepo,run:async()=>{await se()},title:"Initialize Repository"},{category:"Source Control",id:"git.createGithubRepository",level:"project",menus:["commandbar/overflow","palette"],group:"7_scm",requires:"a project tracked by git",when:(t)=>t.project.open,enablement:(t)=>t.project.isRepo,run:async()=>{await ue()},title:"Create GitHub Repository"},{category:"Source Control",id:"git.push",level:"project",menus:["commandbar/overflow","palette"],group:"7_scm",requires:"a project tracked by git",when:(t)=>t.project.open,enablement:(t)=>t.project.isRepo,run:async()=>{await le()},title:"Push"},{category:"Source Control",id:"git.signInToGithub",level:"application",menus:["palette"],group:"7_scm",run:async()=>{await pe()},title:"Sign In to GitHub"}]}function bL(t){t.registerAll(fe())}
2
+ export{qS,YN,Kw,ZN,Jw,GS,Im,Rm,Mb,ks,XT,KS,JS,Pb,Us,QT,eL,tL,nL,iL,oL,rL,sL,aL,lL,cL,dL,uL,hL,YS,pL,fL,Yw,mL,gL,Fb,bL};
3
+
4
+ //# debugId=37ADC77F11A40A7C64756E2164756E21
5
+ //# sourceMappingURL=studio-mrjtnm62.js.map
@@ -1,5 +1,5 @@
1
- import{p}from"./studio-jws1a87n.js";import{S}from"./studio-cg710sk9.js";import{n,Z,_,v}from"./studio-8z66jk4z.js";function y(e,o=[]){if(!v(e))return o;let{children:t}=e;if(e.tagName==="slot"){let s=e.attributes,r=v(s)?s.name:void 0,l={name:n(r)?r.trim():""};if(Array.isArray(t)&&t.length>0)l.fallback=t;o.push(l)}if(Array.isArray(t))for(let s of t)y(s,o);return o}function YS(e,o=new Set){if(!v(e))return o;let t=(i)=>{if(v(i)){if(n(i.tagName)&&i.tagName.includes("-"))o.add(i.tagName);YS(i,o)}},{cases:s,children:r,map:l}=e,a=[...Array.isArray(r)?r:[r],l];if(v(s))a.push(...Object.values(s));for(let i of a)t(i);return o}function h(e){if(n(e))return"string";return Z(e)?"number":"boolean"}function x(e,o){if(o==null)return null;if(!_(o))return{default:o,name:e,type:h(o)};let t=v(o)?o:{};if(t.$prototype||t.$handler||t.$compute)return null;return{default:t.default,format:t.format,name:e,type:t.type}}function ZS(e,o){if(!v(e))return null;let{tagName:t}=e;if(!n(t)||!t.includes("-"))return null;let s=y(e),r=e.state,l=v(r)||Array.isArray(r)||n(r)?Object.entries(r):[],a={$id:n(e.$id)&&e.$id?e.$id:null,hasElements:Array.isArray(e.$elements)&&e.$elements.length>0,path:o,props:l.flatMap(([u,f])=>{let m=x(u,f);return m===null?[]:[m]})};if(s.length>0)a.slots=s;let i=[...YS(e)].filter((u)=>u!==t).toSorted();if(i.length>0)a.uses=i;return{...a,tagName:t}}var Ne=[],Zw=!1,g=0,b=Promise.resolve();function xa(){g+=1;let e=g,o=(async()=>{let t=null;try{t=await p().discoverComponents(S?.projectRoot||void 0)}catch{t=null}if(e!==g){await b;return}if(t)Ne=t;Zw=!0})();return b=o,o}function Fb(e,o){if(!e)return!1;let t=Ne.findIndex((l)=>l.path===e),s=ZS(o,e);if(!s){if(t===-1)return!1;return Ne.splice(t,1),!0}let r=s;if(t===-1)Ne.push(r);else Ne[t]=r;return!0}function Hc(e){let o=Object.fromEntries((e.props??[]).map((r)=>[r.name,r.default!==void 0?r.default:""])),t=[];for(let r of e.slots??[])for(let l of structuredClone(r.fallback??[]))if(!r.name)t.push(l);else if(_(l)&&n(l.tagName))l.attributes={slot:r.name,...l.attributes},t.push(l);else t.push({attributes:{slot:r.name},children:[l],tagName:"span"});let s={$props:o,tagName:e.tagName};if(t.length>0)s.children=t;return s}function c(e){let o=[];for(let t of e){if(t===".")continue;if(t===".."&&o.length>0&&o.at(-1)!=="..")o.pop();else o.push(t)}return o}function Bc(e,o,t=S?.projectRoot??null){if(!e)return`./${o}`;let s=e.replaceAll("\\","/"),r=o.replaceAll("\\","/"),l=s.includes("/")?s.slice(0,s.lastIndexOf("/")):"",a=c(l.split("/").filter(Boolean)),i=c(r.split("/").filter(Boolean));if(a[0]===".."&&t){let d=t.replaceAll("\\","/").split("/").filter(Boolean);a=c([...d,...a]),i=c([...d,...i])}let u=0;while(u<a.length&&u<i.length&&a[u]===i[u])u+=1;let f=a.length-u,m=i.slice(u);return(f>0?"../".repeat(f):"./")+m.join("/")}
2
- export{YS,ZS,Ne,Zw,xa,Fb,Hc,Bc};
1
+ import{p}from"./studio-4fnb5648.js";import{C}from"./studio-4f7thq0p.js";import{n,Y,_,v}from"./studio-k3we3kqb.js";function y(e,o=[]){if(!v(e))return o;let{children:t}=e;if(e.tagName==="slot"){let s=e.attributes,r=v(s)?s.name:void 0,l={name:n(r)?r.trim():""};if(Array.isArray(t)&&t.length>0)l.fallback=t;o.push(l)}if(Array.isArray(t))for(let s of t)y(s,o);return o}function MC(e,o=new Set){if(!v(e))return o;let t=(i)=>{if(v(i)){if(n(i.tagName)&&i.tagName.includes("-"))o.add(i.tagName);MC(i,o)}},{cases:s,children:r,map:l}=e,a=[...Array.isArray(r)?r:[r],l];if(v(s))a.push(...Object.values(s));for(let i of a)t(i);return o}function h(e){if(n(e))return"string";return Y(e)?"number":"boolean"}function x(e,o){if(o==null)return null;if(!_(o))return{default:o,name:e,type:h(o)};let t=v(o)?o:{};if(t.$prototype||t.$handler||t.$compute)return null;return{default:t.default,format:t.format,name:e,type:t.type}}function PC(e,o){if(!v(e))return null;let{tagName:t}=e;if(!n(t)||!t.includes("-"))return null;let s=y(e),r=e.state,l=v(r)||Array.isArray(r)||n(r)?Object.entries(r):[],a={$id:n(e.$id)&&e.$id?e.$id:null,hasElements:Array.isArray(e.$elements)&&e.$elements.length>0,path:o,props:l.flatMap(([u,f])=>{let m=x(u,f);return m===null?[]:[m]})};if(s.length>0)a.slots=s;let i=[...MC(e)].filter((u)=>u!==t).toSorted();if(i.length>0)a.uses=i;return{...a,tagName:t}}var Ne=[],wx=!1,g=0,b=Promise.resolve();function Ea(){g+=1;let e=g,o=(async()=>{let t=null;try{t=await p().discoverComponents(C?.projectRoot||void 0)}catch{t=null}if(e!==g){await b;return}if(t)Ne=t;wx=!0})();return b=o,o}function ev(e,o){if(!e)return!1;let t=Ne.findIndex((l)=>l.path===e),s=PC(o,e);if(!s){if(t===-1)return!1;return Ne.splice(t,1),!0}let r=s;if(t===-1)Ne.push(r);else Ne[t]=r;return!0}function Uc(e){let o=Object.fromEntries((e.props??[]).map((r)=>[r.name,r.default!==void 0?r.default:""])),t=[];for(let r of e.slots??[])for(let l of structuredClone(r.fallback??[]))if(!r.name)t.push(l);else if(_(l)&&n(l.tagName))l.attributes={slot:r.name,...l.attributes},t.push(l);else t.push({attributes:{slot:r.name},children:[l],tagName:"span"});let s={$props:o,tagName:e.tagName};if(t.length>0)s.children=t;return s}function c(e){let o=[];for(let t of e){if(t===".")continue;if(t===".."&&o.length>0&&o.at(-1)!=="..")o.pop();else o.push(t)}return o}function qc(e,o,t=C?.projectRoot??null){if(!e)return`./${o}`;let s=e.replaceAll("\\","/"),r=o.replaceAll("\\","/"),l=s.includes("/")?s.slice(0,s.lastIndexOf("/")):"",a=c(l.split("/").filter(Boolean)),i=c(r.split("/").filter(Boolean));if(a[0]===".."&&t){let d=t.replaceAll("\\","/").split("/").filter(Boolean);a=c([...d,...a]),i=c([...d,...i])}let u=0;while(u<a.length&&u<i.length&&a[u]===i[u])u+=1;let f=a.length-u,m=i.slice(u);return(f>0?"../".repeat(f):"./")+m.join("/")}
2
+ export{MC,PC,Ne,wx,Ea,ev,Uc,qc};
3
3
 
4
- //# debugId=049116082B36BF1564756E2164756E21
5
- //# sourceMappingURL=studio-sevbc3xv.js.map
4
+ //# debugId=78FC07363A98994D64756E2164756E21
5
+ //# sourceMappingURL=studio-n9qba0gx.js.map
@@ -1,5 +1,5 @@
1
- var rI="content",OC=/^[\w.~-]+$/,$o="{locale}";function u(t){let n=t.replaceAll("\\","/");return n.length>1&&n.endsWith("/")?n.slice(0,-1):n}function p(t){let n=u(t);return n.startsWith("/")?n:`/${n}`}function f(t,n){return[...t].toSorted((e,s)=>s[n].length-e[n].length)}function g(t,n){return t===n||t.startsWith(`${n}/`)}function aM(t,n){let e=u(n);for(let s of f(t,"dir")){let r=u(s.dir);if(!g(e,r)||e===r)continue;let o=e.slice(r.length+1),{filter:i}=s;if(i&&!i(o))return null;let l=o.split("/").map((c)=>encodeURIComponent(c)).join("/");return`${p(s.urlPrefix)}/${l}`}return null}function h(t,n){let e=n.split("#")[0].split("?")[0];if(!e.startsWith("/"))return null;let s;try{s=decodeURIComponent(e)}catch{return null}if(/%2e|%2f/i.test(s))return null;for(let r of f(t,"urlPrefix")){let o=p(r.urlPrefix);if(!s.startsWith(`${o}/`))continue;let l=s.slice(o.length+1).split("/");if(l.some((a)=>a===""||a==="."||a===".."))return null;let{filter:c}=r;if(c&&!c(l.join("/")))return null;return`${u(r.dir)}/${l.join("/")}`}return null}var m=String.raw`"'\s<>()\\`;var MC="public";var lM=["mounts","public"];function Wx(t){let n=t.search(/[#?]/);return n===-1?{path:t,suffix:""}:{path:t.slice(0,n),suffix:t.slice(n)}}function sI(t){return t===""||t.startsWith("/")||t.startsWith("#")||t.includes("${")||/^[a-z][\w+.-]*:/i.test(t)}function Si(t){return t.replaceAll("\\","/").replace(/^\.\//,"").replace(/^\/+/,"").replace(/\/+$/,"")}function cM(t){let n=Si(t),e=n.lastIndexOf("/");return e===-1?"":n.slice(0,e)}function aI(t,n){let s=(t===""||t==="."?[]:Si(t).split("/")).filter((r)=>r!==""&&r!==".");for(let r of n.replaceAll("\\","/").split("/")){if(r===""||r===".")continue;if(r===".."){if(s.length===0)return null;s.pop();continue}s.push(r)}return s.join("/")}function d(t,n,e){let{path:s}=Wx(t);if(!s.startsWith("/"))return[];let r;try{r=decodeURIComponent(s)}catch{return[]}if(/%2e|%2f/i.test(r))return[];let o=r.replace(/^\/+/,"");if(o===""||o.split("/").some((l)=>l==="."||l===".."))return[];let i=[];for(let l of e){if(l==="mounts"){let c=h(n,s);if(c!==null&&!c.startsWith("/")&&!/^[A-Za-z]:/.test(c))i.push(Si(c));continue}i.push(l==="root"?o:`${MC}/${o}`)}return[...new Set(i)]}function dM(t,n,e,s){let{path:r}=Wx(t);if(r==="")return null;if(sI(t))return r.startsWith("/")?d(r,e,s)[0]??null:null;if(r.endsWith("/"))return null;let o;try{o=decodeURIComponent(r)}catch{return null}let i=aI(n,o);if(i===null||i===""||i===Si(n))return null;return i}function wv(t){return t.split("/").map((n)=>encodeURIComponent(n)).join("/")}function uM(t){let n=[],e=0;while(e<t.length){while(e<t.length&&(/\s/.test(t[e])||t[e]===","))e+=1;if(e>=t.length)break;let s=e;while(e<t.length&&!/\s/.test(t[e]))e+=1;let r=t.slice(s,e);if(r.endsWith(",")){n.push({descriptor:"",url:r.replace(/,+$/,"")});continue}while(e<t.length&&/\s/.test(t[e]))e+=1;let o=e;while(e<t.length&&t[e]!==",")e+=1;let i=t.slice(o,e).trim();if(e+=1,r=r.replace(/,+$/,""),r!=="")n.push({descriptor:i,url:r})}return n}function hM(t){return t.map(({url:n,descriptor:e})=>e?`${n} ${e}`:n).join(", ")}
2
- export{rI,OC,$o,aM,MC,lM,Wx,sI,Si,cM,aI,dM,wv,uM,hM};
1
+ var qI="content",b1=/^[\w.~-]+$/,$o="{locale}";function u(t){let n=t.replaceAll("\\","/");return n.length>1&&n.endsWith("/")?n.slice(0,-1):n}function p(t){let n=u(t);return n.startsWith("/")?n:`/${n}`}function f(t,n){return[...t].toSorted((e,s)=>s[n].length-e[n].length)}function g(t,n){return t===n||t.startsWith(`${n}/`)}function o2(t,n){let e=u(n);for(let s of f(t,"dir")){let r=u(s.dir);if(!g(e,r)||e===r)continue;let o=e.slice(r.length+1),{filter:i}=s;if(i&&!i(o))return null;let l=o.split("/").map((c)=>encodeURIComponent(c)).join("/");return`${p(s.urlPrefix)}/${l}`}return null}function h(t,n){let e=n.split("#")[0].split("?")[0];if(!e.startsWith("/"))return null;let s;try{s=decodeURIComponent(e)}catch{return null}if(/%2e|%2f/i.test(s))return null;for(let r of f(t,"urlPrefix")){let o=p(r.urlPrefix);if(!s.startsWith(`${o}/`))continue;let l=s.slice(o.length+1).split("/");if(l.some((a)=>a===""||a==="."||a===".."))return null;let{filter:c}=r;if(c&&!c(l.join("/")))return null;return`${u(r.dir)}/${l.join("/")}`}return null}var m=String.raw`"'\s<>()\\`;var v1="public";var r2=["mounts","public"];function g0(t){let n=t.search(/[#?]/);return n===-1?{path:t,suffix:""}:{path:t.slice(0,n),suffix:t.slice(n)}}function GI(t){return t===""||t.startsWith("/")||t.startsWith("#")||t.includes("${")||/^[a-z][\w+.-]*:/i.test(t)}function mi(t){return t.replaceAll("\\","/").replace(/^\.\//,"").replace(/^\/+/,"").replace(/\/+$/,"")}function s2(t){let n=mi(t),e=n.lastIndexOf("/");return e===-1?"":n.slice(0,e)}function KI(t,n){let s=(t===""||t==="."?[]:mi(t).split("/")).filter((r)=>r!==""&&r!==".");for(let r of n.replaceAll("\\","/").split("/")){if(r===""||r===".")continue;if(r===".."){if(s.length===0)return null;s.pop();continue}s.push(r)}return s.join("/")}function d(t,n,e){let{path:s}=g0(t);if(!s.startsWith("/"))return[];let r;try{r=decodeURIComponent(s)}catch{return[]}if(/%2e|%2f/i.test(r))return[];let o=r.replace(/^\/+/,"");if(o===""||o.split("/").some((l)=>l==="."||l===".."))return[];let i=[];for(let l of e){if(l==="mounts"){let c=h(n,s);if(c!==null&&!c.startsWith("/")&&!/^[A-Za-z]:/.test(c))i.push(mi(c));continue}i.push(l==="root"?o:`${v1}/${o}`)}return[...new Set(i)]}function JI(t,n,e,s){let{path:r}=g0(t);if(r==="")return null;if(GI(t))return r.startsWith("/")?d(r,e,s)[0]??null:null;if(r.endsWith("/"))return null;let o;try{o=decodeURIComponent(r)}catch{return null}let i=KI(n,o);if(i===null||i===""||i===mi(n))return null;return i}function zv(t){return t.split("/").map((n)=>encodeURIComponent(n)).join("/")}function a2(t){let n=[],e=0;while(e<t.length){while(e<t.length&&(/\s/.test(t[e])||t[e]===","))e+=1;if(e>=t.length)break;let s=e;while(e<t.length&&!/\s/.test(t[e]))e+=1;let r=t.slice(s,e);if(r.endsWith(",")){n.push({descriptor:"",url:r.replace(/,+$/,"")});continue}while(e<t.length&&/\s/.test(t[e]))e+=1;let o=e;while(e<t.length&&t[e]!==",")e+=1;let i=t.slice(o,e).trim();if(e+=1,r=r.replace(/,+$/,""),r!=="")n.push({descriptor:i,url:r})}return n}function l2(t){return t.map(({url:n,descriptor:e})=>e?`${n} ${e}`:n).join(", ")}
2
+ export{qI,b1,$o,o2,v1,r2,g0,GI,mi,s2,KI,JI,zv,a2,l2};
3
3
 
4
- //# debugId=8B0E5D9A7CE7D29964756E2164756E21
5
- //# sourceMappingURL=studio-ea74s8c1.js.map
4
+ //# debugId=0A0570EA38F8398464756E2164756E21
5
+ //# sourceMappingURL=studio-nvcn2ykc.js.map
@@ -0,0 +1,5 @@
1
+ import{ae}from"./studio-wqfaqw4m.js";import{X}from"./studio-9c6cbq2c.js";import{Up,bh}from"./studio-knsjyx7n.js";import{vO}from"./studio-pwctzka3.js";import{nt}from"./studio-tpxcryf2.js";import{Ln,E,R}from"./studio-9dq7rwc7.js";import{g}from"./studio-3qr08sxq.js";import{n}from"./studio-k3we3kqb.js";var L=[{id:"general",intro:"",label:"General",note:""},{id:"integrations",intro:"Turn on what your site needs. Each one adds its own options where you use it.",label:"Integrations",note:""},{id:"advanced",intro:"Changes here affect every page. Most sites never need them.",label:"Advanced",note:"For developers"}],_N="integrations";function SN(e){return L.some((t)=>t.id===e)}var U="overview",f=new Map,T=new Set;function k(){for(let e of T)e()}function Ad(){k()}function _S(e){return T.add(e),()=>{T.delete(e)}}function ql(e){f.set(e.key,e),k()}function CN(e){if(f.delete(e))k()}function q(){return[...f.values()].toSorted((e,t)=>e.order-t.order)}function Lw(){let e=q();return L.flatMap((t)=>{let a=e.filter((r)=>(r.group??"integrations")===t.id);return a.length===0?[]:[{id:t.id,intro:t.intro,label:t.label,note:t.note,sections:a}]})}function vT(){return Lw().flatMap((e)=>e.sections.map((t)=>t.key))}function w(e){return f.get(e)}var b=null,h=U;function I(){if(b!==null&&f.has(b))return h=b,b=null,h;if(f.has(h))return h;return vT()[0]??h}function SS(e){if(f.has(e))h=e,b=null;else b=e;k()}var C={$schema:"https://jxsuite.com/schema/v1",$id:"StudioSettingsPane",$description:"Project Settings' home (§17.1, §22.9): the Settings workspace's surface, filling a pane's stage. A head names the workspace and carries the Back control, which says where it goes; under it, the settings editor's two columns, the grouped section list and the section body. It draws no section: `panels/settings-pane.ts` keeps the registry, decides which section is current, and renders whichever one that is into the one empty `[part=\"section-host\"]` island this document leaves for it (studio-ui-guidelines.md §9.4), because a section renderer may be a lit template or a mounted document and neither can share a container with this one. The list is three vertical `tablist`s, one per group (General, Integrations, Advanced), each named by its group heading: a tablist may own only tabs, so a heading between two runs of rows has to END one list rather than sit inside it. Each group is one tab stop and the arrow keys move within it. Under the groups, a Moved footnote names what left Project Settings for a workspace, each with a button that goes there.",tagName:"div",attributes:{part:"settings","data-jx-region":"${state.region}",role:"region","aria-labelledby":"settings-pane-heading"},style:{$description:"Fills the pane's stage by its own geometry, as the Publish and Media homes do: the stage is `position: relative`, so the home takes the whole of it, and each column scrolls itself. No part below is named `body`, `field`, `label`, `error`, `text` or `actions`: sections mount kit controls and documents of their own inside this one, the kit is light DOM, and a rule keyed on one of their part names here would reach into them.",position:"absolute",inset:"0",display:"flex",flexDirection:"column",boxSizing:"border-box",minHeight:"0",background:"var(--bg)",color:"var(--fg)",fontFamily:"var(--jx-font-sans)",textAlign:"initial",'& [part="head"]':{display:"flex",alignItems:"center",gap:"var(--jx-space-3)",padding:"var(--jx-space-3) var(--jx-space-5)",borderBottom:"1px solid var(--border)"},'& [part="heading"]':{flex:"1",margin:"0",fontSize:"var(--jx-text-lg)",fontWeight:"600"},'& [part="columns"]':{display:"flex",flex:"1",minHeight:"0"},'& [part="nav"]':{display:"flex",flexDirection:"column",gap:"var(--jx-space-4)",width:"220px",minWidth:"220px",flexShrink:"0",padding:"var(--jx-space-3) var(--jx-space-3) var(--jx-space-3) var(--jx-space-2)",borderRight:"1px solid var(--border)",overflowY:"auto",fontSize:"13px"},'& [part="group"]':{display:"flex",flexDirection:"column",gap:"var(--jx-space-1)"},'& [part="group-title"]':{display:"flex",alignItems:"baseline",gap:"var(--jx-space-2)",margin:"0",padding:"0 var(--jx-space-3)",color:"var(--fg-dim)",fontSize:"var(--jx-text-sm)",fontWeight:"600",letterSpacing:"0.04em",textTransform:"uppercase"},'& [part="group-note"]':{$description:`The Advanced group's "For developers": a qualifier on the heading, not a second heading, so it reads at the heading's size without its weight.`,fontWeight:"400",letterSpacing:"0",textTransform:"none"},'& [part="group-note"]:empty':{display:"none"},'& [part="group-tabs"]':{$description:"The rule a vertical strip draws on its trailing edge is the column's own here: the nav draws one border for all three groups, so each strip drawing its own would stack three short rules beside it.",borderInlineEnd:"0"},'& [part="nav-item"]':{$description:"Full-bleed rows, which a tab is not by default: `jx-tab` centres its label and caps itself at 220px because a horizontal strip is a row of chips. In the nav column the row IS the target, so the label goes to the leading edge and the cap comes off.",maxWidth:"none",justifyContent:"flex-start",padding:"var(--jx-space-2) var(--jx-space-3)"},'& [part="moved"]':{display:"flex",flexDirection:"column",gap:"var(--jx-space-1)",marginTop:"auto",padding:"var(--jx-space-3)",borderTop:"1px solid var(--border)",color:"var(--fg-dim)",fontSize:"var(--jx-text-md)"},'& [part="moved-title"]':{margin:"0",fontWeight:"600",color:"var(--fg)"},'& [part="moved-row"]':{display:"flex",alignItems:"center",flexWrap:"wrap",gap:"var(--jx-space-1)"},'& [part="content"]':{flex:"1",minWidth:"0",overflowY:"auto",padding:"var(--jx-space-4) var(--jx-space-5) var(--jx-space-6)"},'& [part="group-intro"]':{margin:"0 0 var(--jx-space-3)",color:"var(--fg-dim)",fontSize:"13px",maxWidth:"1200px"},'& [part="group-intro"]:empty':{display:"none"},'& [part="section-host"]':{$description:"Wide enough for a map-layout section's list and editor side by side, and no wider: on a large monitor a form stretched to the stage's full width is a line too long to read.",display:"block",minWidth:"0",maxWidth:"1200px"},'& [part="empty"]':{$description:"What the body says when the active section is registered by nobody: every section unregistering at once, which is a project closing while Settings is on screen. A blank column beside a list reads as a broken surface, so it says which it is.",display:"flex",alignItems:"center",justifyContent:"center",minHeight:"120px",margin:"0",color:"var(--fg-dim)",fontSize:"13px"},'& [part="failure"]':{$description:"A section whose renderer threw or rejected. It is said where the section would have been, in the reader's line of sight, because a section that silently draws nothing is indistinguishable from one with nothing to say.",margin:"0",padding:"var(--jx-space-3)",border:"1px solid var(--danger)",borderRadius:"var(--radius)",color:"var(--fg)",fontSize:"13px"}},children:[{tagName:"div",attributes:{part:"head"},children:[{tagName:"jx-action-button",attributes:{part:"back"},$props:{size:"sm",quiet:!0,icon:"arrow-left"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/back"},value:[]}]},children:[{tagName:"span",textContent:"${state.backLabel}"}],$description:"Back to the workspace Settings was opened from, named, as the pane context bar's Back is in a workspace with no tab strip (§22.1): the top bar draws no tab for Settings, so nothing else on screen says where the author came from."},{tagName:"h2",attributes:{part:"heading",id:"settings-pane-heading"},textContent:"${state.heading}"}]},{tagName:"div",attributes:{part:"columns",role:"none"},children:[{tagName:"div",attributes:{part:"nav",role:"none"},children:[{$prototype:"Array",items:{$ref:"#/state/groups"},key:{$ref:"$map/item/id"},map:{tagName:"div",attributes:{part:"group",role:"none","data-group":"${$map.item.id}"},children:[{tagName:"h3",attributes:{part:"group-title",id:"${$map.item.titleId}"},children:[{tagName:"span",textContent:"${$map.item.label}"},{tagName:"span",attributes:{part:"group-note"},textContent:"${$map.item.note}"}]},{tagName:"jx-tabs",attributes:{part:"group-tabs",selected:"${state.active}",orientation:"vertical"},$props:{label:{$ref:"$map/item/tabsLabel"}},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/selectSection"},value:[{$ref:"event#/detail"}]}]},children:[{$prototype:"Array",items:{$ref:"$map/item/sections"},key:{$ref:"$map/item/key"},map:{tagName:"jx-tab",attributes:{part:"nav-item",id:"${$map.item.tabId}","data-section":"${$map.item.key}",value:"${$map.item.key}",label:"${$map.item.label}",panel:"settings-pane-panel"}}}]}]}},{tagName:"div",attributes:{part:"moved",role:"group","aria-labelledby":"settings-pane-moved"},children:[{tagName:"p",attributes:{part:"moved-title",id:"settings-pane-moved"},textContent:"Moved"},{$prototype:"Array",items:{$ref:"#/state/moved"},key:{$ref:"$map/item/workspace"},map:{tagName:"div",attributes:{part:"moved-row","data-moved":"${$map.item.workspace}"},children:[{tagName:"span",textContent:"${$map.item.what} →"},{tagName:"jx-button",attributes:{part:"moved-link"},$props:{size:"sm",quiet:!0,label:{$ref:"$map/item/linkLabel"}},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/openMoved"},value:[{$ref:"$map/item/workspace"}]}]},children:[{tagName:"span",textContent:"${$map.item.place}"}]}]}}]}]},{tagName:"jx-tab-panel",attributes:{part:"content",id:"settings-pane-panel"},$props:{active:!0,labelledby:{$ref:"#/state/activeTabId"}},children:[{$description:`The current group's intro ("Changes here affect every page. Most sites never need them."), above whichever of its sections is showing. General has none, and an empty sentence draws nothing.`,tagName:"p",attributes:{part:"group-intro"},textContent:"${state.intro}"},{$description:"The island, and it stays empty: a settings section renders itself, into a host this document never writes into and never reads back (studio-ui-guidelines.md §9.4).",tagName:"div",attributes:{part:"section-host"}},{tagName:"div",attributes:{part:"empty-slot",role:"none"},$switch:{$ref:"#/state/hasSection"},cases:{false:{tagName:"p",attributes:{part:"empty"},textContent:"${state.empty}"}}},{tagName:"div",attributes:{part:"failure-slot",role:"none"},$switch:{$ref:"#/state/failureState"},cases:{failed:{tagName:"p",attributes:{part:"failure",role:"alert"},textContent:"${state.failure}"}}}]}]}]};E("settings-pane",C);function J(e){let t=n(e)?void 0:e.attributes?.part;return n(t)?t:""}function A(e){return e===""?"ok":"failed"}function H(e,t,a){let r=g({...t,...a,failureState:A(t.failure)});e.textContent="",delete e._$litPart$;let o=null,s=!1,p=null,S=R("settings-pane",r,e,{onNodeCreated:(i,d,m)=>{if(!s&&i instanceof HTMLElement&&J(m)==="section-host")p=i}}).then((i)=>{if(s){i.dispose();return}o=i});return{attached:()=>{if(s)return!1;let i=o?.root;return i===void 0?!0:i instanceof HTMLElement&&e.contains(i)},body:()=>p,dispose(){s=!0,o?.dispose(),o=null,p=null},async focusActive(){let i=o?.root,d=i instanceof HTMLElement?[...i.querySelectorAll('[part="nav-item"]')].find((y)=>y.dataset.section===r.active):void 0;if(!d)return;let m=d.closest("jx-tabs");if(m&&d.getAttribute("aria-selected")!=="true")await new Promise((y)=>{m.addEventListener("jx-ready",()=>{y()},{once:!0})});if(!s)d.focus()},ready:S,update(i){r.region=i.region,r.heading=i.heading,r.backLabel=i.backLabel,r.groups=i.groups,r.moved=i.moved,r.activeTabId=i.activeTabId,r.empty=i.empty,r.intro=i.intro,r.hasSection=i.hasSection,r.failure=i.failure,r.failureState=A(i.failure),r.active=i.active}}}var K=bh("settings").title,Y="No settings sections.",G=[{place:"Styles › Variables",view:"variables",what:"Colors and fonts",workspace:"styles"},{place:"Publish › Hosting",publishTab:"hosting",what:"Hosting and domain",workspace:"publish"},{inspector:"page",place:"Page tab",what:"Head and SEO defaults",workspace:"design"}];function W(e){return`settings-nav-${e}`}function Q(e){return G.find((t)=>t.workspace===e)??null}function P(e,t){let a=I(),r=Lw();return{active:a,backLabel:e.backLabel(),activeTabId:W(a),empty:Y,failure:t,groups:r.map((o)=>({id:o.id,label:o.label,note:o.note,sections:o.sections.map((s)=>({key:s.key,label:s.label,tabId:W(s.key)})),tabsLabel:o.note===""?o.label:`${o.label}, ${o.note.toLowerCase()}`,titleId:`settings-group-${o.id}`})),hasSection:w(a)!==void 0,heading:K,intro:w(a)?.intro||(r.find((o)=>o.sections.some((s)=>s.key===a))?.intro??""),moved:G.map((o)=>{let{title:s}=bh(o.workspace),p=o.place??s;return{linkLabel:`${o.what}: ${p}. Go to ${s}`,place:p,what:o.what,workspace:o.workspace}}),region:e.region}}function O(e,t){let a=!1,r=null,o=null,s=null,p="",S=0,i=H(e,P(t,p),{back:()=>{t.back()},openMoved:(l)=>{let c=Q(l);if(c!==null)t.openMoved(c.workspace,c.inspector,c.view,c.publishTab)},selectSection:(l)=>{SS(l)}});function d(l,c,u){if(a||u!==S)return;p=`Could not show ${w(l)?.label??l}: ${c}`,i.update(P(t,p))}function m(l){if(a)return;let c=I(),u=i.body();if(u!==r)r=u,s=null;if(!u||!l&&s===c){i.update(P(t,p));return}let M=s!==c;s=c,p="",i.update(P(t,p));let j=w(c);if(!j){o=null,u.replaceChildren();return}if(M||!o||o.parentElement!==u)o=document.createElement("div"),u.replaceChildren(o);S+=1;let N=S;try{let x=j.render(o);if(x instanceof Promise)x.catch((z)=>{d(c,X(z),N)})}catch(x){d(c,X(x),N)}}let y=_S(()=>{m(!0)}),F=i.ready.then(()=>{m(!0)});return{attached:()=>i.attached(),dispose(){if(a)return;a=!0,y(),i.dispose()},focusActive:()=>i.focusActive(),ready:F}}var Z="settings";function yT(e){return Ln(e,Z)}var v=new Map,D=new Set;function _(){let e=vO();return e===null||e==="settings"?Up:e}async function ee(){await nt("view.setWorkspace",{workspace:_()},"Settings")}async function te(e,t,a,r){if(a!==void 0){await nt("styles.open",{view:a},"Settings");return}if(r!==void 0){await nt("publish.open",{tab:r},"Settings");return}if(await nt("view.setWorkspace",{workspace:e},"Settings"),t===void 0)return;if(await nt("view.setRightPanel",{open:!0},"Settings"),ae()?.isEnabled("view.setRightTab")===!0)await nt("view.setRightTab",{tab:t},"Settings")}function wT(e,t){let a=v.get(e);return a!==void 0&&a.tabId===t.id&&a.wrap.isConnected&&a.pane.attached()}function xT(e){let t=v.get(e);if(!t)return;v.delete(e),t.pane.dispose()}async function V(e,t){if(await t.pane.ready,v.get(e)===t)await t.pane.focusActive()}async function kN(e){let t=v.get(e);if(t?.wrap.isConnected===!0&&t.pane.attached()){await V(e,t);return}D.add(e)}var ne={back:()=>{ee()},backLabel:()=>`Back to ${bh(_()).title}`,openMoved:(e,t,a,r)=>{te(e,t,a,r)}};function EN(e,t){let{paneId:a,wrap:r}=e;if(wT(a,t))return;xT(a);let s={pane:O(r,{...ne,region:yT(a)}),tabId:t.id,wrap:r};if(v.set(a,s),D.delete(a))V(a,s)}
2
+ export{_N,SN,Ad,_S,ql,CN,Lw,vT,SS,yT,wT,xT,kN,EN};
3
+
4
+ //# debugId=D431B1A1C0DB10F264756E2164756E21
5
+ //# sourceMappingURL=studio-nwf0c32p.js.map