@jxsuite/studio 10.5.0 → 10.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (279) hide show
  1. package/data/locales/en/elements.json +434 -0
  2. package/data/webdata.json +116 -139
  3. package/dist/chunks/{2020-7sx2vexa.js → 2020-rqm7qrje.js} +3 -3
  4. package/dist/chunks/adapter-cyy8vbcx.js +4 -0
  5. package/dist/chunks/add-new-flow-8cgtejv2.js +4 -0
  6. package/dist/chunks/{cf-account-picker-ajh60k54.js → cf-account-picker-v3qd2dhw.js} +3 -3
  7. package/dist/chunks/cf-settings-1fnw874z.js +4 -0
  8. package/dist/chunks/{color-area-gbcftzh3.js → color-area-frd9y9q6.js} +2 -2
  9. package/dist/chunks/{color-field-85136598.js → color-field-rebpbe33.js} +3 -3
  10. package/dist/chunks/{color-slider-w1s3ndd8.js → color-slider-6bzmk3s7.js} +2 -2
  11. package/dist/chunks/color-t2bnnj8y.js +4 -0
  12. package/dist/chunks/{combobox-dk98wc5x.js → combobox-c49x7gf1.js} +2 -2
  13. package/dist/chunks/components-y8yhdd7d.js +4 -0
  14. package/dist/chunks/content-source-9e7qvmsf.js +4 -0
  15. package/dist/chunks/convert-to-repeater-pd2w4z21.js +4 -0
  16. package/dist/chunks/editor-mb9jzdrw.js +4 -0
  17. package/dist/chunks/entry-commands-at0wnx3f.js +4 -0
  18. package/dist/chunks/extension-sections-4z9qq0gh.js +4 -0
  19. package/dist/chunks/file-ops-dtdvjmza.js +4 -0
  20. package/dist/chunks/files-8pf70854.js +4 -0
  21. package/dist/chunks/format-host-fd3m2y2a.js +4 -0
  22. package/dist/chunks/fs-events-hrk29vcv.js +4 -0
  23. package/dist/chunks/grid-open-bh74v82z.js +4 -0
  24. package/dist/chunks/{grid-view-0v4hjspb.js → grid-view-a51mgzmq.js} +10 -10
  25. package/dist/chunks/{icons-j9eksgew.js → icons-qp8fn1k8.js} +2 -2
  26. package/dist/chunks/{iframe-entry-4zqtn3ry.js → iframe-entry-mpwe5pwk.js} +4 -4
  27. package/dist/chunks/{iframe-entry-2x9bn5ng.js → iframe-entry-msd43x9h.js} +4 -4
  28. package/dist/chunks/iframe-entry-rt8jz5t8.js +5 -0
  29. package/dist/chunks/{iframe-entry-54kwwhmg.js → iframe-entry-v40cr813.js} +2 -2
  30. package/dist/chunks/iframe-host-q0s0wwy3.js +4 -0
  31. package/dist/chunks/{image-bake-m8gzaan9.js → image-bake-q9ajdjsj.js} +3 -3
  32. package/dist/chunks/{image-editor-0afyws7c.js → image-editor-ke9std9b.js} +2 -2
  33. package/dist/chunks/index-57ang7ma.js +4 -0
  34. package/dist/chunks/index-eytr7av4.js +17 -0
  35. package/dist/chunks/{index-2q88g57p.js → index-x495reff.js} +3 -3
  36. package/dist/chunks/{javascript-5sxtr1g7.js → javascript-qe34bvaz.js} +3 -3
  37. package/dist/chunks/{jsonMode-m6sf47hq.js → jsonMode-m8rseh31.js} +8 -8
  38. package/dist/chunks/jx-validate-bbd1mary.js +4 -0
  39. package/dist/chunks/layers-panel-wcjtdqsa.js +4 -0
  40. package/dist/chunks/layers-yscpys6q.js +4 -0
  41. package/dist/chunks/{listbox-k5p41049.js → listbox-tktzq5xj.js} +2 -2
  42. package/dist/chunks/lit-html-qm5wbhqz.js +4 -0
  43. package/dist/chunks/media-library-2hfff88g.js +4 -0
  44. package/dist/chunks/media-open-4pb05cne.js +4 -0
  45. package/dist/chunks/media-picker-bzktmmwr.js +4 -0
  46. package/dist/chunks/{menu-26nez152.js → menu-xc3cbgsd.js} +2 -2
  47. package/dist/chunks/{monaco-binding-1s2b8snq.js → monaco-binding-7t38arh9.js} +3 -3
  48. package/dist/chunks/monaco-buffer-3vz94c9f.js +4 -0
  49. package/dist/chunks/monaco-setup-fstdew02.js +4 -0
  50. package/dist/chunks/notify-gbdcckrh.js +4 -0
  51. package/dist/chunks/parse-fpdzgk4c.js +4 -0
  52. package/dist/chunks/platform-9g72gdqr.js +4 -0
  53. package/dist/chunks/{popover-fhdnt4be.js → popover-cnmsav6b.js} +2 -2
  54. package/dist/chunks/publish-panel-91x1cb5d.js +4 -0
  55. package/dist/chunks/publish-quick-e2dmf7eg.js +4 -0
  56. package/dist/chunks/publish-workspace-1x8mnzrj.js +4 -0
  57. package/dist/chunks/quick-search-2m4y6p1x.js +4 -0
  58. package/dist/chunks/references-yg1g9rwx.js +4 -0
  59. package/dist/chunks/right-panel-7mfyhzrk.js +4 -0
  60. package/dist/chunks/source-control-rrc4jgp5.js +4 -0
  61. package/dist/chunks/{split-qh21j2b0.js → split-d15yencd.js} +2 -2
  62. package/dist/chunks/{studio-r5g7fx7q.js → studio-0jhhznxy.js} +6 -6
  63. package/dist/chunks/studio-0nb57pjg.js +7 -0
  64. package/dist/chunks/{studio-bpzwhn88.js → studio-0wa4wv4s.js} +4 -4
  65. package/dist/chunks/studio-0z8kp4xk.js +5 -0
  66. package/dist/chunks/{studio-jqvke4ac.js → studio-18gc5t3v.js} +4 -4
  67. package/dist/chunks/{studio-xh6rf05g.js → studio-1b79rpcb.js} +4 -4
  68. package/dist/chunks/studio-211q5j7m.js +4 -0
  69. package/dist/chunks/studio-213pyfxh.js +16 -0
  70. package/dist/chunks/studio-2b1smjvp.js +5 -0
  71. package/dist/chunks/{studio-dst8y8vh.js → studio-2v6tc9jp.js} +4 -4
  72. package/dist/chunks/studio-30j0wz99.js +5 -0
  73. package/dist/chunks/studio-3kmqhwtt.js +5 -0
  74. package/dist/chunks/studio-44drsmhw.js +5 -0
  75. package/dist/chunks/{studio-d5f7sskn.js → studio-495b6f2r.js} +4 -4
  76. package/dist/chunks/{studio-g65t6svn.js → studio-4gthb2fd.js} +4 -4
  77. package/dist/chunks/{studio-bmwgj8ez.js → studio-4xadhxj1.js} +4 -4
  78. package/dist/chunks/{studio-zav9hgb3.js → studio-52mzbxqm.js} +4 -4
  79. package/dist/chunks/{studio-thgexj3w.js → studio-56mmnsw8.js} +7 -7
  80. package/dist/chunks/studio-59hz8f4r.js +5 -0
  81. package/dist/chunks/{studio-bk0anq3b.js → studio-5k9mfafh.js} +3 -3
  82. package/dist/chunks/{studio-qarg1xf9.js → studio-5qez462c.js} +5 -5
  83. package/dist/chunks/studio-6tnpg0vx.js +5 -0
  84. package/dist/chunks/studio-6w8mt734.js +6 -0
  85. package/dist/chunks/studio-7hm04x5z.js +5 -0
  86. package/dist/chunks/studio-8atmfjjm.js +7 -0
  87. package/dist/chunks/{studio-69g6a0jn.js → studio-8n99z71s.js} +4 -4
  88. package/dist/chunks/{studio-ep1384t9.js → studio-8vmad6x2.js} +4 -4
  89. package/dist/chunks/{studio-6sxnqqw8.js → studio-93p5k4r4.js} +4 -4
  90. package/dist/chunks/{studio-hy936516.js → studio-9gb0m81w.js} +4 -4
  91. package/dist/chunks/{studio-ek4fb4eb.js → studio-a4ymg4vd.js} +4 -4
  92. package/dist/chunks/studio-anc8067x.js +5 -0
  93. package/dist/chunks/{studio-ketrgtph.js → studio-dbdt67kr.js} +5 -5
  94. package/dist/chunks/studio-dbex091t.js +5 -0
  95. package/dist/chunks/{studio-nngc45ct.js → studio-dj8ctxey.js} +4 -4
  96. package/dist/chunks/{studio-pgze9p34.js → studio-ed9bz68j.js} +5 -5
  97. package/dist/chunks/{studio-4ncxzw5m.js → studio-fe2d1fp5.js} +4 -4
  98. package/dist/chunks/{studio-m8hesdrw.js → studio-fgp4cyy3.js} +4 -4
  99. package/dist/chunks/{studio-151kgn69.js → studio-ft706q02.js} +4 -4
  100. package/dist/chunks/{studio-pv1ts08p.js → studio-g79s1dyg.js} +5 -5
  101. package/dist/chunks/{studio-zkkt13qd.js → studio-gahswxp4.js} +4 -4
  102. package/dist/chunks/{studio-x5ffyssw.js → studio-gbqc12bk.js} +4 -4
  103. package/dist/chunks/{studio-4jy967rj.js → studio-gxphbetb.js} +5 -5
  104. package/dist/chunks/studio-hdf01j7q.js +7 -0
  105. package/dist/chunks/studio-hf259xzd.js +48 -0
  106. package/dist/chunks/studio-jbva4wxw.js +5 -0
  107. package/dist/chunks/{studio-td3h1644.js → studio-jj9gf1qc.js} +4 -4
  108. package/dist/chunks/studio-jsjg3mjv.js +5 -0
  109. package/dist/chunks/studio-jtvb8hd7.js +5 -0
  110. package/dist/chunks/{studio-c72v1kwc.js → studio-kp4vzrct.js} +4 -4
  111. package/dist/chunks/{studio-s4k1v7dt.js → studio-kpx02gaa.js} +6 -6
  112. package/dist/chunks/{studio-3yr1zdp9.js → studio-kv1728ex.js} +8 -8
  113. package/dist/chunks/studio-m25ry0mf.js +5 -0
  114. package/dist/chunks/studio-mcbwmkyh.js +5 -0
  115. package/dist/chunks/studio-meajkr51.js +5 -0
  116. package/dist/chunks/studio-mkjrjpr2.js +6 -0
  117. package/dist/chunks/{studio-nv5eq0f7.js → studio-mr084886.js} +181 -181
  118. package/dist/chunks/{studio-43pynnhz.js → studio-mrb10hv3.js} +4 -4
  119. package/dist/chunks/{studio-7qqb7hb8.js → studio-nhpg405j.js} +4 -4
  120. package/dist/chunks/{studio-n271vdsg.js → studio-nsec0hxm.js} +41 -41
  121. package/dist/chunks/{studio-ztzf8mce.js → studio-nv0mh0p5.js} +4 -4
  122. package/dist/chunks/studio-pafmb06w.js +5 -0
  123. package/dist/chunks/{studio-4s5bka8t.js → studio-pgftd79b.js} +4 -4
  124. package/dist/chunks/{studio-wn2cmf9q.js → studio-pk961xgz.js} +4 -4
  125. package/dist/chunks/studio-pzbr7g05.js +5 -0
  126. package/dist/chunks/{studio-15mfah02.js → studio-qcc5hsw2.js} +6 -6
  127. package/dist/chunks/studio-qfq58c8n.js +5 -0
  128. package/dist/chunks/{studio-j3bq30yz.js → studio-qvb2jr83.js} +4 -4
  129. package/dist/chunks/studio-r85zw6ay.js +5 -0
  130. package/dist/chunks/{studio-f69wcajk.js → studio-s0kwce5w.js} +5 -5
  131. package/dist/chunks/studio-s6ymkf3q.js +14 -0
  132. package/dist/chunks/{studio-8ncm9zwx.js → studio-s7p5ccxa.js} +4 -4
  133. package/dist/chunks/{studio-zzgp5yka.js → studio-s9jjap3x.js} +4 -4
  134. package/dist/chunks/{studio-ber1dgte.js → studio-t5hde1ws.js} +4 -4
  135. package/dist/chunks/studio-vj9yv897.js +5 -0
  136. package/dist/chunks/{studio-ajfq4fmr.js → studio-wmak8xjw.js} +4 -4
  137. package/dist/chunks/{studio-k05g7efh.js → studio-wqsmvtqj.js} +4 -4
  138. package/dist/chunks/studio-x3z3rhej.js +5 -0
  139. package/dist/chunks/{studio-7qr8k0v2.js → studio-xb55kpmy.js} +4 -4
  140. package/dist/chunks/{studio-f3awr5nc.js → studio-xxtdajmv.js} +7 -7
  141. package/dist/chunks/{studio-1a7zshnv.js → studio-xxttcym1.js} +4 -4
  142. package/dist/chunks/{studio-czpmzs9r.js → studio-y2zsnzye.js} +7 -7
  143. package/dist/chunks/{studio-9f5vcb4w.js → studio-y3tjh2xb.js} +3 -3
  144. package/dist/chunks/studio-y4f1rdsj.js +5 -0
  145. package/dist/chunks/studio-ybkd5w8k.js +5 -0
  146. package/dist/chunks/{studio-cv6gnjqd.js → studio-yetr4gg1.js} +4 -4
  147. package/dist/chunks/{studio-ehj3csbm.js → studio-z295anhs.js} +5 -5
  148. package/dist/chunks/{studio-pte5w7rf.js → studio-z89e6wpg.js} +8 -8
  149. package/dist/chunks/{studio-4z0cdh16.js → studio-zbwr6prc.js} +3 -3
  150. package/dist/chunks/{studio-w3aafbpk.js → studio-zdbsv5q2.js} +3 -3
  151. package/dist/chunks/{studio-eq5vqn1q.js → studio-zvthj8hg.js} +4 -4
  152. package/dist/chunks/toast-2kn2vrn4.js +4 -0
  153. package/dist/chunks/{toast-host-g3r2s0kn.js → toast-host-3rxeyj3d.js} +3 -3
  154. package/dist/chunks/{tooltip-gtx40bjg.js → tooltip-ghkxkasp.js} +2 -2
  155. package/dist/chunks/{tree-a19s1c05.js → tree-vw4nc63s.js} +2 -2
  156. package/dist/chunks/{tsMode-3f116hth.js → tsMode-7gngmamr.js} +7 -7
  157. package/dist/chunks/workspace-gv0hxgsm.js +4 -0
  158. package/dist/chunks/workspace-home-j7e0mjy5.js +4 -0
  159. package/dist/chunks/{ws-client-cb49m87s.js → ws-client-vs11sxc5.js} +3 -3
  160. package/dist/iframe-entry.js +14 -14
  161. package/dist/manifest.json +84 -83
  162. package/dist/studio.js +80 -80
  163. package/package.json +12 -12
  164. package/src/browse/preview-style.ts +2 -1
  165. package/src/canvas/canvas-render.ts +6 -1
  166. package/src/canvas/iframe-drop.ts +84 -1
  167. package/src/canvas/iframe-entry.ts +9 -6
  168. package/src/canvas/iframe-render.ts +13 -0
  169. package/src/collab/collab-session.ts +2 -2
  170. package/src/commands/levels.ts +1 -1
  171. package/src/create/add-new-flow.ts +2 -1
  172. package/src/editor/convert-targets.ts +2 -23
  173. package/src/editor/slash-menu.ts +35 -17
  174. package/src/files/files.ts +18 -0
  175. package/src/format/format-choices.ts +5 -5
  176. package/src/format/format-host.ts +35 -3
  177. package/src/grid/redirects-grid.ts +4 -4
  178. package/src/locale/element-names.ts +131 -0
  179. package/src/panels/dnd.ts +3 -1
  180. package/src/panels/elements-panel.ts +93 -36
  181. package/src/panels/imports-panel.ts +3 -2
  182. package/src/panels/navigator-panels.ts +10 -10
  183. package/src/panels/panel-registry.ts +3 -3
  184. package/src/panels/site-panel.ts +2 -1
  185. package/src/panels/style-panel.ts +2 -1
  186. package/src/panels/styles-panel.ts +2 -2
  187. package/src/platforms/cloud.ts +5 -2
  188. package/src/services/ai-command-tools.ts +2 -1
  189. package/src/services/ai-project-tools.ts +18 -5
  190. package/src/services/jxn-language.ts +110 -0
  191. package/src/services/model-uri.ts +3 -0
  192. package/src/services/monaco-setup.ts +6 -2
  193. package/src/settings/contributed-section.ts +2 -1
  194. package/src/settings/extension-commands.ts +2 -1
  195. package/src/settings/general-settings.ts +2 -2
  196. package/src/settings/settings-document.ts +5 -5
  197. package/src/shell.ts +1 -1
  198. package/src/studio.ts +28 -11
  199. package/src/style/variables-view.ts +2 -2
  200. package/src/surfaces/panel-elements.json +466 -206
  201. package/src/surfaces/panel-elements.ts +61 -25
  202. package/src/tabs/project-config.ts +13 -13
  203. package/src/tabs/tab.ts +7 -2
  204. package/src/types.ts +11 -2
  205. package/src/view.ts +9 -2
  206. package/src/workspace/tab-workspace.ts +2 -2
  207. package/src/workspace/workspace-back.ts +2 -2
  208. package/dist/chunks/adapter-12dxr3z7.js +0 -4
  209. package/dist/chunks/add-new-flow-any4pw2q.js +0 -4
  210. package/dist/chunks/cf-settings-hbj16kh3.js +0 -4
  211. package/dist/chunks/color-thzpppyc.js +0 -4
  212. package/dist/chunks/components-a98hzqw9.js +0 -4
  213. package/dist/chunks/content-source-jq3fjs3w.js +0 -4
  214. package/dist/chunks/convert-to-repeater-g66r6qp1.js +0 -4
  215. package/dist/chunks/editor-rth1rzj8.js +0 -4
  216. package/dist/chunks/entry-commands-02j0s19w.js +0 -4
  217. package/dist/chunks/extension-sections-rqrs7dr0.js +0 -4
  218. package/dist/chunks/file-ops-6a49er4c.js +0 -4
  219. package/dist/chunks/files-b2p9y0yz.js +0 -4
  220. package/dist/chunks/format-host-7xe57k1s.js +0 -4
  221. package/dist/chunks/fs-events-0xsy168g.js +0 -4
  222. package/dist/chunks/grid-open-h3q4fjy5.js +0 -4
  223. package/dist/chunks/iframe-entry-m24fza30.js +0 -5
  224. package/dist/chunks/iframe-host-8jcmaktg.js +0 -4
  225. package/dist/chunks/index-7nj2375a.js +0 -4
  226. package/dist/chunks/jx-validate-808zgbgy.js +0 -4
  227. package/dist/chunks/layers-0ffdtqjn.js +0 -4
  228. package/dist/chunks/layers-panel-rw62wtvf.js +0 -4
  229. package/dist/chunks/lit-html-9bz9rcfv.js +0 -4
  230. package/dist/chunks/media-library-2a5hdbek.js +0 -4
  231. package/dist/chunks/media-open-069kzhj4.js +0 -4
  232. package/dist/chunks/media-picker-4p4pd28y.js +0 -4
  233. package/dist/chunks/monaco-buffer-m9fd2dka.js +0 -4
  234. package/dist/chunks/monaco-setup-e0crh3v6.js +0 -4
  235. package/dist/chunks/notify-re3js157.js +0 -4
  236. package/dist/chunks/parse-hee7ne9b.js +0 -4
  237. package/dist/chunks/platform-rywy3tkg.js +0 -4
  238. package/dist/chunks/publish-panel-czkpg8m4.js +0 -4
  239. package/dist/chunks/publish-quick-b9wbhqj6.js +0 -4
  240. package/dist/chunks/publish-workspace-yy6d23b7.js +0 -4
  241. package/dist/chunks/quick-search-tp7pjnmv.js +0 -4
  242. package/dist/chunks/references-wd2yj8s1.js +0 -4
  243. package/dist/chunks/right-panel-x971k0zc.js +0 -4
  244. package/dist/chunks/source-control-k4p00hpe.js +0 -4
  245. package/dist/chunks/studio-1d8m5s38.js +0 -16
  246. package/dist/chunks/studio-35pmfjtx.js +0 -5
  247. package/dist/chunks/studio-44xqe0b7.js +0 -4
  248. package/dist/chunks/studio-48yzqzqr.js +0 -5
  249. package/dist/chunks/studio-5rq3e4q5.js +0 -5
  250. package/dist/chunks/studio-6hcfm9q3.js +0 -5
  251. package/dist/chunks/studio-6mf31e16.js +0 -5
  252. package/dist/chunks/studio-8w5pa88p.js +0 -7
  253. package/dist/chunks/studio-9c6cbq2c.js +0 -4
  254. package/dist/chunks/studio-aaw7wxv8.js +0 -5
  255. package/dist/chunks/studio-afx9brsc.js +0 -5
  256. package/dist/chunks/studio-dmgh2rrj.js +0 -5
  257. package/dist/chunks/studio-erjccagy.js +0 -5
  258. package/dist/chunks/studio-ex1644g2.js +0 -5
  259. package/dist/chunks/studio-gw83z798.js +0 -7
  260. package/dist/chunks/studio-j52ks8q7.js +0 -5
  261. package/dist/chunks/studio-kefs4sz4.js +0 -5
  262. package/dist/chunks/studio-m3jrjfhy.js +0 -14
  263. package/dist/chunks/studio-n4pnf0sw.js +0 -5
  264. package/dist/chunks/studio-ncwx602y.js +0 -5
  265. package/dist/chunks/studio-nzp0sqjg.js +0 -5
  266. package/dist/chunks/studio-ph17an19.js +0 -5
  267. package/dist/chunks/studio-q509sqt8.js +0 -5
  268. package/dist/chunks/studio-s49y6m5b.js +0 -5
  269. package/dist/chunks/studio-t46rt6gx.js +0 -5
  270. package/dist/chunks/studio-veh91hjv.js +0 -5
  271. package/dist/chunks/studio-vswmz40d.js +0 -6
  272. package/dist/chunks/studio-w4mfaaam.js +0 -5
  273. package/dist/chunks/studio-x5py815g.js +0 -5
  274. package/dist/chunks/studio-z6s56dzz.js +0 -5
  275. package/dist/chunks/studio-ze1sm147.js +0 -7
  276. package/dist/chunks/studio-zn7ysyzb.js +0 -5
  277. package/dist/chunks/toast-w11qpkyz.js +0 -4
  278. package/dist/chunks/workspace-home-61n1jz3q.js +0 -4
  279. package/dist/chunks/workspace-sheek6zw.js +0 -4
@@ -1,5 +0,0 @@
1
- import{Gx,Ia,bl,g,Si,Ft}from"./studio-s49y6m5b.js";import{m0,Cw,oT}from"./studio-hy936516.js";import{BE,VE,jN}from"./studio-s4k1v7dt.js";import{n0,i0,JE}from"./studio-d5f7sskn.js";import{RT,IT,MD}from"./studio-dst8y8vh.js";var n={children:[],tagName:"div"},Q2=new Set(Object.values(Gx));function GS(e){return Q2.has(e)}function _E(e){let r=Ia(e),o=g.tabs.get(r);if(o)return Ft(r),o;return Si({capabilities:{modes:[Gx[e]]},document:structuredClone(n),documentPath:null,id:r})}function SE(e,r){Si({background:!0,capabilities:{modes:[Gx[e]]},document:structuredClone(n),documentPath:null,id:Ia(e),paneId:r})}function JS(e,r){let o=bl(r.id);if(o==="media")return m0(e,r);if(o==="content")return BE(e,r);if(o==="settings")return RT(e,r);return n0(e,r)}function ab(e){Cw(e),VE(e),i0(e),IT(e)}function CE(e,r){let{paneId:o}=e;if(JS(o,r))return;ab(o);let t=bl(r.id);if(t==="media"){oT(e,r);return}if(t==="content"){jN(e,r);return}if(t==="settings"){MD(e,r);return}JE(e,r)}
2
- export{Q2,GS,_E,SE,JS,ab,CE};
3
-
4
- //# debugId=29AD5D25348E5BAA64756E2164756E21
5
- //# sourceMappingURL=studio-n4pnf0sw.js.map
@@ -1,5 +0,0 @@
1
- import{X}from"./studio-9c6cbq2c.js";import{p}from"./studio-xh6rf05g.js";import{w}from"./studio-bk0anq3b.js";import{Jl,kp}from"./studio-ep1384t9.js";import{Gu}from"./studio-kefs4sz4.js";import{LT}from"./studio-dst8y8vh.js";import{rc}from"./studio-1d8m5s38.js";import{ZD}from"./studio-6sxnqqw8.js";import{x}from"./studio-zn7ysyzb.js";import{ze,E,I}from"./studio-1a7zshnv.js";import{b}from"./studio-9f5vcb4w.js";import{n,Q,S,m}from"./studio-erjccagy.js";var H={$schema:"https://jxsuite.com/schema/v1",$id:"StudioSettingsContributed",$description:'The generic settings section behind `$studio.settings` (specs/extensions.md §9.1), as a Jx document over the kit. One document serves both layouts an extension may declare: "form" is a single schema form over the whole section value, "map" is master-detail — the entry keys on the left, the selected entry\'s form on the right. The adapter (`surfaces/settings-contributed.ts`) hands in the title, the layout, the entry rows already marked as selected, and whatever the reader is part-way through typing; `settings/contributed-section.ts` decides what an entry may be named, what reaches `project.json`, and what the validator said about it. The schema form itself is an ISLAND: this document renders `form-host` and nothing inside it, because a form built from a JSON Schema is `ui/schema-form.ts`\'s surface rather than this one\'s — the section places the element that surface hands back. The actions row is the second island: `panels/data-grid.ts` contributes it, and that one is still lit over Spectrum.',tagName:"section",attributes:{part:"contributed"},style:{$description:"What `.settings-section-title`, `.settings-two-col`, `.settings-list-panel`, `.settings-editor-panel`, `.settings-editor-header`, `.settings-empty-state` and `.settings-inline-form` said in `styles/overlays.css`, keyed on `part` and re-pointed at the studio token layer. This section was the LAST emitter of every one of them except `.settings-empty-state`, which `panels/settings-pane.ts` still writes when a project closes with the editor open — so those rules are dead in the stylesheet from here, and a central sweep removes them rather than this change, which owns no stylesheet. Two values could not come across. `.settings-editor-header h3` read `var(--spectrum-font-size-100, 14px)`, and a document is mounted in the pane rather than inside `<sp-theme>`, so it would have taken its hard-coded fallback every time; the entry name is a kit textfield now and carries the kit's own type ramp. And `.entry-name-input`, `.settings-form-panel`, `.settings-section` and `.contributed-section` had no rule anywhere at all — they were four entries on `check-styles.ts`'s orphan ledger, which is the ledger's point.",display:"block",'& [part="title"]':{margin:"0 0 16px",fontSize:"16px",fontWeight:"600",color:"var(--fg)"},'& [part="actions"]':{$description:"The host-contributed actions row — Test Connection, Push Schema, Open Data Grid on the data sections. `.data-section-actions` never had a rule anywhere, so the row was whatever the buttons stacked up to; it is a row with a gap under it now.",display:"flex",alignItems:"center",flexWrap:"wrap",gap:"8px",marginBottom:"12px"},'& [part="columns"]':{$description:"The 1px gap over the border colour is the divider between the two columns: two panels on the page's own `--bg` with `--border` showing through the gap, so nothing draws a rule of its own. The panels are `--bg`, not `--bg-panel`, because the section is drawn on the Settings home, whose background is `--bg`: a second shade under one section of the form reads as a box nobody asked for.",display:"flex",height:"100%",gap:"1px",background:"var(--border)"},'& [part="list"]':{display:"flex",flexDirection:"column",gap:"4px",padding:"12px",width:"200px",minWidth:"200px",background:"var(--bg)",overflowY:"auto"},'& [part="entry"], & [part="new-open"]':{width:"100%"},'& [part="entry"] > [part="control"], & [part="new-open"] > [part="control"]':{$description:"`.settings-list-panel sp-action-button` said `width: 100%; justify-content: flex-start`, and both halves belong to the button the row is made of rather than to the row: a kit action button centres its glyph and its label, which reads as a list of centred names.",width:"100%",justifyContent:"flex-start"},'& [part="new-form"]':{display:"flex",alignItems:"center",gap:"6px"},'& [part="new-field"]':{flex:"1",minWidth:"0"},'& [part="empty"]':{flex:"1",display:"flex",alignItems:"center",justifyContent:"center",background:"var(--bg)",color:"var(--fg-dim)",fontSize:"13px"},'& [part="editor"]':{$description:"`min-width: 0` is the one line `.settings-editor-panel` did not have and needed: a flex child's floor is its content, and the schema form inside this one is a whole form rather than the short cards Data Shapes puts here — so a long pointer or a wide row pushed the column past the right edge of the pane instead of scrolling inside it.",flex:"1",padding:"16px",background:"var(--bg)",overflowY:"auto",minWidth:"0"},'& [part="editor-header"]':{display:"flex",alignItems:"center",gap:"12px",marginBottom:"16px"},'& [part="entry-name"]':{flex:"1",minWidth:"0",maxWidth:"220px"}},children:[{tagName:"h3",attributes:{part:"title"},textContent:"${state.title}"},{tagName:"div",attributes:{part:"actions-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/actionsState"},cases:{slot:{$description:"An island: the host renders its own actions into this node and the document renders nothing inside it.",tagName:"div",attributes:{part:"actions"}}}},{tagName:"div",attributes:{part:"body-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/layout"},cases:{form:{$description:"An island: `ui/schema-form.ts` draws the whole section value into this node.",tagName:"div",attributes:{part:"form-host"}},map:{tagName:"div",attributes:{part:"columns"},children:[{tagName:"div",attributes:{part:"list"},children:[{$prototype:"Array",items:{$ref:"#/state/entries"},key:{$ref:"$map/item/key"},map:{tagName:"jx-action-button",attributes:{part:"entry","data-entry":"${$map.item.key}","data-jx-region":"${$map.item.region}"},$props:{label:"${$map.item.key}",selected:{$ref:"$map/item/selected"},quiet:!0,size:"sm"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/select"},value:[{$ref:"$map/item/key"}]}]},children:[{tagName:"span",textContent:"${$map.item.key}"}]}},{tagName:"div",attributes:{part:"new-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/newState"},cases:{closed:{tagName:"jx-action-button",attributes:{part:"new-open"},$props:{label:"${state.newLabel}",icon:"plus",quiet:!0,size:"sm"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/openNew"},value:[]}]},children:[{tagName:"span",textContent:"${state.newLabel}"}]},open:{tagName:"div",attributes:{part:"new-form"},children:[{tagName:"jx-textfield",attributes:{part:"new-field"},$props:{label:"${state.newFieldLabel}",placeholder:"${state.newPlaceholder}",size:"sm",value:{$ref:"#/state/newName"}},oninput:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/editNew"},value:[{$ref:"event#/target/value"}]}]},onkeydown:{$prototype:"Function",body:[{$switch:{$ref:"event#/key"},cases:{Enter:[{preventDefault:!0},{operator:"call",target:{$ref:"#/state/createNew"},value:[]}],Escape:[{preventDefault:!0},{operator:"call",target:{$ref:"#/state/cancelNew"},value:[]}]}}]}},{tagName:"jx-button",attributes:{part:"new-create"},$props:{size:"sm"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/createNew"},value:[]}]},children:[{tagName:"span",textContent:"Create"}]}]}}}]},{tagName:"div",attributes:{part:"editor-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/editorState"},cases:{empty:{tagName:"div",attributes:{part:"empty"},textContent:"${state.emptyText}"},editing:{tagName:"div",attributes:{part:"editor","data-jx-region":"${state.editorRegion}"},children:[{tagName:"div",attributes:{part:"editor-header"},children:[{tagName:"jx-textfield",attributes:{part:"entry-name"},$props:{label:"Entry name",size:"sm",value:{$ref:"#/state/entryName"}},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/renameEntry"},value:[{$ref:"event#/target/value"}]}]},onkeydown:{$prototype:"Function",body:[{$switch:{$ref:"event#/key"},cases:{Enter:[{operator:"call",target:{$ref:"#/state/renameEntry"},value:[{$ref:"event#/target/value"}]}],Escape:[{operator:"call",target:{$ref:"#/state/cancelRename"},value:[{$ref:"event#/target/value"}]}]}}]}},{tagName:"jx-action-button",attributes:{part:"delete-entry"},$props:{label:"Delete entry",hint:"Delete entry",icon:"trash",quiet:!0,size:"sm"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/removeEntry"},value:[]}]}}]},{$description:"An island: `ui/schema-form.ts` draws the selected entry into this node.",tagName:"div",attributes:{part:"form-host"}}]}}}]}}}]};E("settings-contributed",H);function K(){return{actionsState:"none",editorRegion:"",editorState:"empty",entries:[],entryName:"",layout:"form",newName:"",newState:"closed",title:"",emptyText:"",newFieldLabel:"",newLabel:"",newPlaceholder:""}}function _(t){let r=n(t)?void 0:t.attributes?.part;return n(r)?r:""}function M(t,r,a){t.textContent="";let o=b({...K(),...r}),e=null,i=!1,c=I("settings-contributed",o,t,{onNodeCreated:(s,l,d)=>{if(!(s instanceof HTMLElement))return;let u=_(d);if(u==="form-host")a.formSlot(s);else if(u==="actions")a.actionsSlot(s)}}).then((s)=>{let l=s.root;if(i)return s.dispose(),l;return e=s,l});return{attached:()=>{if(i)return!1;let s=e?.root;return s===void 0?!0:s instanceof HTMLElement&&t.contains(s)},dispose(){i=!0,e?.dispose(),e=null},host:t,ready:c,update(s){o.actionsState=s.actionsState,o.editorRegion=s.editorRegion,o.editorState=s.editorState,o.entries=s.entries,o.entryName=s.entryName,o.layout=s.layout,o.newName=s.newName,o.newState=s.newState,o.title=s.title,o.emptyText=s.emptyText,o.newFieldLabel=s.newFieldLabel,o.newLabel=s.newLabel,o.newPlaceholder=s.newPlaceholder}}}var g=new Map,j=new Set,N=new Map;function ND(t,r){let a=x?.projectConfig?.[t],o=m(a)?a:{};if(!Object.hasOwn(o,r))return Object.keys(o);return g.set(t,r),null}var k=new Map;function q(t,r){let a={},o=[];for(let e of r){let i=e.indexOf(": "),c=i===-1?"":e.slice(0,i),s=i===-1?e:e.slice(i+2);if(c===t){o.push(s);continue}if(!c.startsWith(`${t}/`))continue;let[l]=c.slice(t.length+1).split("/");if(l&&a[l]===void 0)a[l]=s}return{fields:a,section:o}}async function O(t,r){let a=x?.projectConfig;if(!a)return;if(!(await rc()).ok)return;let e=[];try{e=await Gu(a)}catch(i){w.warn(`Could not validate project.json — ${X(i)}`,{key:"settings:validator",path:"project.json",source:"Settings",tier:"problem"});return}k.set(t,q(t,e).fields),r()}function A(t,r){for(let[a,o]of Object.entries(r))if(o===void 0)delete t[a];else t[a]=o}function T(t){return t.toLowerCase().replaceAll(/\s+/g,"-").replaceAll(/[^a-z0-9-]/g,"")}function U(t,r){if(!t)return{};let a=(e)=>{let i={};for(let[c,s]of Object.entries(e))i[c]=o(s);return i},o=(e)=>{if(n(e))return e.replaceAll("${key}",r);if(Array.isArray(e))return e.map((i)=>o(i));if(m(e))return a(e);return e};return a(t)}function R(t,r,a=null){let o=p(),e={fieldKeyPrefix:`$settings.${t}`,resolvePointer:(i,c)=>{let s={projectConfig:x?.projectConfig??{}};if(m(c))s.scope=c;if(r.formats!==void 0)s.formats=r.formats;return kp(i,s)}};if(Q(o.setSecrets))e.commitSecret=async(i,c)=>{let s=ZD(t,a,i);return await o.setSecrets({set:{[s]:c}}),s};return e}function v(t){let r=x?.projectConfig;if(!r)return null;let a=r[t];if(m(a))return a;let o={};return r[t]=o,o}function F(t,r){return`${t.closest(`[${ze}]`)?.getAttribute(ze)??LT("primary")}/${r}`}var J=new WeakMap;function f(t){TT(t.container,t.contribution,t.opts)}function P(t,r){t.echo=r,f(t)}var Y="entry";function B(t){let r=t?.trim().toLowerCase()||Y,a=`${r.charAt(0).toUpperCase()}${r.slice(1)}`;return{emptyText:`Select ${/^[aeiou]/u.test(r)?"an":"a"} ${r} or create one`,newFieldLabel:`${a} name`,newLabel:`New ${r}`,newPlaceholder:`${T(r)}-name`}}function G(t){let{contribution:r,opts:a}=t,o=r.key,e=r.title??o,i=a.actions?"slot":"none",c=F(t.container,"editor"),s=B(r.settings.entry?.noun);if((r.settings.layout??"form")!=="map")return{actionsState:i,editorRegion:c,editorState:"empty",entries:[],entryName:"",layout:"form",newName:"",newState:"closed",title:e,...s};let l=v(o)??{},d=g.get(o)??null,u=d===null?void 0:l[d],h=d!==null&&S(u);return{actionsState:i,editorRegion:c,editorState:h?"editing":"empty",entries:Object.keys(l).map((C)=>({key:C,region:F(t.container,`entry:${C}`),selected:C===d})),entryName:t.echo??(h?d:""),layout:"map",newName:N.get(o)??"",newState:j.has(o)?"open":"closed",title:e,...s}}function V(t){let r=t.formHost;if(!r)return;let{contribution:a,opts:o}=t,e=a.key,i=a.settings.entry?.ui,c=()=>f(t),s=(y)=>{if(y.parentNode!==r)r.replaceChildren(y)};if((a.settings.layout??"form")!=="map"){let y=`/${e}`;s(Jl(`section:${e}`,a.entrySchema,v(e)??{},{context:R(e,o,null),errors:k.get(y)??{},onChange:(W)=>{let L=v(e);if(!L)return;A(L,W),c(),O(y,c)},rerender:c,...i!==void 0&&{ui:i}}));return}let l=v(e)??{},d=g.get(e)??null,u=d===null?void 0:l[d];if(d===null||!S(u)){r.replaceChildren();return}let h=u,C=`/${e}/${d}`;s(Jl(`section:${e}:${d}`,a.entrySchema,h,{context:R(e,o,d),errors:k.get(C)??{},onChange:(y)=>{A(h,y),c(),O(C,c)},rerender:c,...i!==void 0&&{ui:i}}))}function D(t){let r=t.actionsHost,{actions:a}=t.opts;if(!r)return;if(!a){r.replaceChildren();return}let o=t.contribution.key,e=(t.contribution.settings.layout??"form")==="map"?g.get(o)??null:null;a(r,{rerender:()=>f(t),sectionKey:o,selected:e})}function Z(t){let r=(e)=>{t.echo=null,f(t),O(e,()=>f(t))},a=()=>{t.echo=null,f(t)},o=()=>t.contribution.key;return{cancelNew(){j.delete(o()),N.delete(o()),f(t)},cancelRename(e){P(t,e),a()},createNew(){let e=o(),i=T(N.get(e)??""),c=v(e);if(!i||!c||c[i])return;c[i]=U(t.contribution.settings.entry?.newEntry,i),g.set(e,i),j.delete(e),N.delete(e),r(`/${e}`)},editNew(e){N.set(o(),e),f(t)},openNew(){j.add(o()),f(t)},removeEntry(){let e=o(),i=g.get(e)??null,c=v(e);if(!i||!c?.[i])return;delete c[i],g.set(e,null),r(`/${e}`)},renameEntry(e){P(t,e);let i=o(),c=g.get(i)??null,s=v(i),l=T(e.trim());if(!c||!s||!l||l===c||s[l]){a();return}let d={};for(let[u,h]of Object.entries(s))d[u===c?l:u]=h,delete s[u];Object.assign(s,d),g.set(i,l),r(`/${i}`)},select(e){g.set(o(),e),t.echo=null,f(t)}}}function TT(t,r,a={}){let o=J.get(t);if(o)o.contribution=r,o.opts=a;let e=o?.handle??null;if(!o||!e?.attached()){e?.dispose();let i={actionsHost:null,container:t,contribution:r,echo:null,formHost:null,handle:null,opts:a};J.set(t,i),e=M(t,Z(i),{actionsSlot:(c)=>{i.actionsHost=c,D(i)},formSlot:(c)=>{i.formHost=c,V(i)}}),i.handle=e,o=i}e.update(G(o)),D(o),V(o)}
2
- export{ND,TT};
3
-
4
- //# debugId=12439710B6EB37A564756E2164756E21
5
- //# sourceMappingURL=studio-ncwx602y.js.map
@@ -1,5 +0,0 @@
1
- import{ft}from"./studio-4z0cdh16.js";import{Uo}from"./studio-czpmzs9r.js";import{nL,pl,ey}from"./studio-aaw7wxv8.js";import{p,ve}from"./studio-xh6rf05g.js";import{ln,Da,Z,So,Jp,h}from"./studio-s49y6m5b.js";import{Fy}from"./studio-ex1644g2.js";import{Wd,Qs,no}from"./studio-td3h1644.js";import{De,Tx,$a,Uc}from"./studio-43pynnhz.js";import{nt}from"./studio-cv6gnjqd.js";import{ei}from"./studio-gw83z798.js";import{Ab}from"./studio-15mfah02.js";import{Ku}from"./studio-4ncxzw5m.js";import{fw,AN,pb,Rd,PN,MN,ME,mw,gw}from"./studio-s4k1v7dt.js";import{kw,Ew,xp}from"./studio-vswmz40d.js";import{_m}from"./studio-pte5w7rf.js";import{x,wn}from"./studio-zn7ysyzb.js";import{E,I}from"./studio-1a7zshnv.js";import{b}from"./studio-9f5vcb4w.js";import{n,J,m}from"./studio-erjccagy.js";import{ce}from"./studio-7qqb7hb8.js";var X=new Map([["img","src"],["source","src"],["video","poster"]]);function ee(e,t,a=De){if(!e||t!=="image")return{mode:"insert"};let r=X.get(e.tagName);if(r)return{attr:r,mode:"replace-attr",path:e.path};if(e.tagName.includes("-")){let s=(a.find((l)=>l.tagName===e.tagName)?.props??[]).filter((l)=>Da(l.format));if(s.length===1)return{mode:"replace-prop",path:e.path,prop:s[0].name}}return{mode:"insert"}}function F(e){switch(e.kind){case"image":return{attributes:{src:e.ref},tagName:"img"};case"video":return{attributes:{controls:"",src:e.ref},tagName:"video"};case"audio":return{attributes:{controls:"",src:e.ref},tagName:"audio"};default:return{attributes:{href:e.ref},tagName:"a",textContent:e.name}}}function te(e,t){let a=[...e.targetPath],r=a.at(-1);if(t===0||!J(r))return a;return a[a.length-1]=r+t,a}async function CN(e,t,a,r){if(!e||t.length===0)return;let o=await Qs(t),[s]=o;if(!s)return;let l=ee(a,s.kind);if(l.mode==="replace-attr"){Z(e,(d)=>So(d,l.path,l.attr,s.ref));return}if(l.mode==="replace-prop"){Z(e,(d)=>Jp(d,l.path,l.prop,s.ref));return}for(let[d,i]of o.entries()){let g={fragment:F(i),type:"block"};if(r)ey(e,{type:r.instruction},g,te(r,d));else ey(e,{type:"make-child"},g,[])}}var O={$schema:"https://jxsuite.com/schema/v1",$id:"StudioSitePanel",$description:"The Site panel (specs/studio.md §5.7): the project as an author thinks of it, pages by address and then the parts pages are made of. Four sections under a header holding one filter and a + that opens Add new (`file.new`, §9.1.1). `panels/site-panel.ts` keeps every decision: which files are pages, the route order and nesting (`panels/site-model.ts`, over `@jxsuite/site/routes`), how many entries a collection has and how many pages use a template, which media the project holds (the Media section is a short strip of the first few, and the rest are one click away in Media), what a click opens and what a drag inserts. This document draws rows whose every field is already a string, and a section state that is one of loading, empty, nomatch or listed, so a section a filter empties keeps its heading and says why. Component previews are an island the flow fills, and the drag sources are registered by the adapter through `onNodeCreated`.",tagName:"div",attributes:{part:"site"},style:{$description:"The Site panel's own look, keyed on `part`. Rows are native buttons, because a row opens one thing and a button is the element that says so to every reader; the selected row is the one whose `data-selected` is true, which the flow sets from the focused pane's document. A collection heading is not a button: it opens nothing in Design, and its pages are the buttons under it, indented one step. Component cards and media thumbnails are drag sources as well as buttons; the adapter registers the drags through `onNodeCreated`, so nothing here names a drag.",display:"flex",flexDirection:"column",height:"100%",minHeight:"0",fontFamily:"var(--jx-font-sans)",fontSize:"var(--jx-text-md)",color:"var(--fg)",'& [part="header"]':{display:"flex",alignItems:"center",gap:"var(--jx-space-2)",padding:"var(--jx-space-2)",borderBottom:"1px solid var(--border)",flexShrink:"0"},'& [part="filter"]':{flex:"1",minWidth:"0"},'& [part="sections"]':{flex:"1",minHeight:"0",overflowY:"auto",padding:"var(--jx-space-1) 0 var(--jx-space-4)"},'& [part="section"]':{padding:"var(--jx-space-2) 0"},'& [part="section-head"]':{display:"flex",alignItems:"center",gap:"var(--jx-space-2)",padding:"0 var(--jx-space-3) var(--jx-space-1)"},'& [part="section-title"]':{margin:"0",fontSize:"var(--jx-text-sm)",fontWeight:"700",letterSpacing:"0.06em",textTransform:"uppercase",color:"var(--fg-dim)"},'& [part="section-count"]':{fontSize:"var(--jx-text-sm)",color:"var(--fg-dim)"},'& [part="open-media"]':{marginLeft:"auto"},'& [part="no-project"]':{margin:"0",padding:"var(--jx-space-6) var(--jx-space-4)",textAlign:"center",lineHeight:"1.5",color:"var(--fg-dim)"},'& [part="note"]':{margin:"0",padding:"var(--jx-space-1) var(--jx-space-3)",fontSize:"var(--jx-text-sm)",color:"var(--fg-dim)"},'& [part="rows"]':{display:"flex",flexDirection:"column"},'& [part="page-row"], & [part="template-row"], & [part="collection-row"]':{display:"flex",alignItems:"baseline",gap:"var(--jx-space-2)",width:"100%",boxSizing:"border-box",minHeight:"26px",padding:"var(--jx-space-1) var(--jx-space-3)",border:"none",background:"transparent",color:"inherit",font:"inherit",textAlign:"start"},'& [part="page-row"], & [part="template-row"]':{cursor:"pointer",":hover":{background:"var(--hover-bg)"},":focus-visible":{outline:"var(--jx-focus-ring)",outlineOffset:"-2px"}},'& [part="page-row"][data-nested="true"]':{paddingLeft:"calc(var(--jx-space-3) + var(--jx-space-4))"},'& [data-selected="true"]':{background:"var(--accent-15)",color:"var(--fg)"},'& [part="collection-row"]':{color:"var(--fg-dim)"},'& [part="row-label"]':{flex:"1",minWidth:"0",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},'& [part="row-detail"]':{flexShrink:"0",maxWidth:"55%",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",fontFamily:"var(--font-mono)",fontSize:"var(--jx-text-sm)",color:"var(--fg-dim)"},'& [part="cards"]':{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(96px, 1fr))",gap:"var(--jx-space-2)",padding:"0 var(--jx-space-3)"},'& [part="component-card"]':{display:"flex",flexDirection:"column",width:"100%",padding:"0",overflow:"hidden",border:"1px solid var(--border)",borderRadius:"var(--jx-radius-md)",background:"var(--bg-panel)",color:"inherit",font:"inherit",cursor:"grab",":hover":{borderColor:"var(--fg-dim)"},":focus-visible":{outline:"var(--jx-focus-ring)",outlineOffset:"1px"}},'& [part="card-preview"]':{$description:"A live render on the light document surface the Insert panel's element cards use (`--canvas-*` does not follow the theme, because what is drawn here is a page's part, and a site's dark text on the dark chrome read as an empty black box). It is drawn at half size, so a component laid out for a page shows its face rather than a clipped corner of one oversized glyph. The render is in the island's own shadow root (`mountPreview` in `browse/library-preview.ts`), so no rule here can reach its elements: the half size is the island's `zoom`, which lays the render out twice as wide and draws it at half, and the 128px height is the 64px box at that zoom. The broken-image rule went into the root with it.",position:"relative",height:"128px",zoom:"0.5",overflow:"hidden",pointerEvents:"none",background:"white",color:"var(--canvas-fg-2)",fontSize:"var(--jx-text-md)"},'& [part="card-label"]':{padding:"var(--jx-space-1) var(--jx-space-2)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",fontSize:"var(--jx-text-sm)",textAlign:"start"},'& [part="thumbs"]':{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(56px, 1fr))",gap:"var(--jx-space-1)",padding:"0 var(--jx-space-3)"},'& [part="media-strip"]':{display:"flex",flexDirection:"column",gap:"var(--jx-space-2)"},'& [part="media-more"]':{alignSelf:"flex-start",marginInline:"var(--jx-space-3)"},'& [part="media-thumb"]':{display:"flex",alignItems:"center",justifyContent:"center",width:"100%",aspectRatio:"1",padding:"0",overflow:"hidden",border:"1px solid var(--border)",borderRadius:"var(--jx-radius-sm)",background:"var(--bg-panel)",color:"var(--fg-dim)",font:"inherit",cursor:"grab",":focus-visible":{outline:"var(--jx-focus-ring)",outlineOffset:"1px"}},'& [part="thumb-image"]':{width:"100%",height:"100%",objectFit:"cover"},'& [part="thumb-name"]':{padding:"var(--jx-space-1)",overflow:"hidden",fontSize:"var(--jx-text-xs)",wordBreak:"break-all"}},children:[{tagName:"div",attributes:{part:"header"},children:[{tagName:"jx-textfield",attributes:{part:"filter"},$props:{size:"sm",type:"search",clearable:!0,label:"Filter the site",placeholder:"Filter the site…",value:{$ref:"#/state/filter"}},oninput:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setFilter"},value:[{$ref:"event#/target/value"}]}]}},{tagName:"jx-action-button",attributes:{part:"add"},$props:{size:"sm",icon:"plus",label:"Add new",hint:"Add new",haspopup:"dialog"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/add"},value:[]}]}}]},{tagName:"div",attributes:{part:"body-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/body"},cases:{none:{tagName:"p",attributes:{part:"no-project"},textContent:"Open a project to see its pages, templates, components and media."},project:{tagName:"div",attributes:{part:"sections"},children:[{tagName:"section",attributes:{part:"section","data-section":"pages","aria-labelledby":"site-section-pages"},children:[{tagName:"div",attributes:{part:"section-head"},children:[{tagName:"h3",attributes:{part:"section-title",id:"site-section-pages"},textContent:"Pages"},{tagName:"span",attributes:{part:"section-count"},textContent:"${state.pagesCount}"}]},{tagName:"div",attributes:{part:"section-body",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/pagesState"},cases:{loading:{tagName:"p",attributes:{part:"note"},textContent:"Reading the project…"},empty:{tagName:"p",attributes:{part:"note"},textContent:"No pages yet. Add one with +."},nomatch:{tagName:"p",attributes:{part:"note"},textContent:"Nothing here matches the filter."},listed:{tagName:"div",attributes:{part:"rows",role:"list"},children:[{$prototype:"Array",items:{$ref:"#/state/pages"},key:{$ref:"$map/item/key"},map:{tagName:"div",attributes:{part:"page-item",role:"listitem","data-kind":"${$map.item.kind}"},$switch:{$ref:"$map/item/kind"},cases:{collection:{tagName:"div",attributes:{part:"collection-row"},children:[{tagName:"span",attributes:{part:"row-label"},textContent:"${$map.item.label}"},{tagName:"span",attributes:{part:"row-detail"},textContent:"${$map.item.detail}"}]},page:{tagName:"button",attributes:{part:"page-row",type:"button","data-path":"${$map.item.path}","data-selected":"${$map.item.selected}","aria-current":"${$map.item.selected === 'true' ? 'true' : null}",title:"${$map.item.path}"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/open"},value:[{$ref:"$map/item/path"}]}]},children:[{tagName:"span",attributes:{part:"row-label"},textContent:"${$map.item.label}"},{tagName:"span",attributes:{part:"row-detail"},textContent:"${$map.item.detail}"}]},"entry-page":{tagName:"button",attributes:{part:"page-row",type:"button","data-path":"${$map.item.path}","data-selected":"${$map.item.selected}","aria-current":"${$map.item.selected === 'true' ? 'true' : null}",title:"${$map.item.path}","data-nested":"true"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/open"},value:[{$ref:"$map/item/path"}]}]},children:[{tagName:"span",attributes:{part:"row-label"},textContent:"${$map.item.label}"},{tagName:"span",attributes:{part:"row-detail"},textContent:"${$map.item.detail}"}]}}}}]}}}]},{tagName:"section",attributes:{part:"section","data-section":"templates","aria-labelledby":"site-section-templates"},children:[{tagName:"div",attributes:{part:"section-head"},children:[{tagName:"h3",attributes:{part:"section-title",id:"site-section-templates"},textContent:"Templates"},{tagName:"span",attributes:{part:"section-count"},textContent:"${state.templatesCount}"}]},{tagName:"div",attributes:{part:"section-body",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/templatesState"},cases:{loading:{tagName:"p",attributes:{part:"note"},textContent:"Reading the project…"},empty:{tagName:"p",attributes:{part:"note"},textContent:"No templates in layouts/ yet."},nomatch:{tagName:"p",attributes:{part:"note"},textContent:"Nothing here matches the filter."},listed:{tagName:"div",attributes:{part:"rows",role:"list"},children:[{$prototype:"Array",items:{$ref:"#/state/templates"},key:{$ref:"$map/item/key"},map:{tagName:"div",attributes:{part:"template-item",role:"listitem"},children:[{tagName:"button",attributes:{part:"template-row",type:"button","data-path":"${$map.item.path}","data-selected":"${$map.item.selected}","aria-current":"${$map.item.selected === 'true' ? 'true' : null}",title:"${$map.item.path}"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/open"},value:[{$ref:"$map/item/path"}]}]},children:[{tagName:"span",attributes:{part:"row-label"},textContent:"${$map.item.label}"},{tagName:"span",attributes:{part:"row-detail"},textContent:"${$map.item.detail}"}]}]}}]}}}]},{tagName:"section",attributes:{part:"section","data-section":"components","aria-labelledby":"site-section-components"},children:[{tagName:"div",attributes:{part:"section-head"},children:[{tagName:"h3",attributes:{part:"section-title",id:"site-section-components"},textContent:"Components"},{tagName:"span",attributes:{part:"section-count"},textContent:"${state.componentsCount}"}]},{tagName:"div",attributes:{part:"section-body",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/componentsState"},cases:{loading:{tagName:"p",attributes:{part:"note"},textContent:"Reading the project…"},empty:{tagName:"p",attributes:{part:"note"},textContent:"No components yet."},nomatch:{tagName:"p",attributes:{part:"note"},textContent:"Nothing here matches the filter."},listed:{tagName:"div",attributes:{part:"cards",role:"list"},children:[{$prototype:"Array",items:{$ref:"#/state/components"},key:{$ref:"$map/item/key"},map:{tagName:"div",attributes:{part:"card-item",role:"listitem"},children:[{tagName:"button",attributes:{part:"component-card",type:"button","data-tag":"${$map.item.tagName}","data-selected":"${$map.item.selected}","aria-current":"${$map.item.selected === 'true' ? 'true' : null}",title:"${$map.item.hint}"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/openComponent"},value:[{$ref:"$map/item/tagName"}]}]},children:[{$description:'The preview ISLAND: empty here, filled by the flow with the component rendered live from the Library\'s preview cache as the card scrolls into view (specs/studio-ui-guidelines.md §9.4). It is `inert`, not merely `aria-hidden`: a component\'s own links and buttons stay focusable under `aria-hidden`, and Chrome then counts their text into the card\'s name ("Contact Us Today Eer cta", "◀ ▶ Eer reviews"). Inert takes the render out of the accessibility tree, the tab order and the pointer at once, so the card is named by its label alone.',tagName:"div",attributes:{part:"card-preview",inert:""}},{tagName:"span",attributes:{part:"card-label"},textContent:"${$map.item.label}"}]}]}}]}}}]},{tagName:"section",attributes:{part:"section","data-section":"media","aria-labelledby":"site-section-media"},children:[{tagName:"div",attributes:{part:"section-head"},children:[{tagName:"h3",attributes:{part:"section-title",id:"site-section-media"},textContent:"Media"},{tagName:"span",attributes:{part:"section-count"},textContent:"${state.mediaCount}"},{tagName:"jx-button",attributes:{part:"open-media"},$props:{size:"sm",variant:"secondary",quiet:!0},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/openMedia"},value:[]}]},children:[{tagName:"span",textContent:"Open Media"}]}]},{tagName:"div",attributes:{part:"section-body",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/mediaState"},cases:{loading:{tagName:"p",attributes:{part:"note"},textContent:"Reading the project…"},empty:{tagName:"p",attributes:{part:"note"},textContent:"No media in public/ yet."},nomatch:{tagName:"p",attributes:{part:"note"},textContent:"Nothing here matches the filter."},listed:{tagName:"div",attributes:{part:"media-strip"},children:[{tagName:"div",attributes:{part:"thumbs",role:"list"},children:[{$prototype:"Array",items:{$ref:"#/state/media"},key:{$ref:"$map/item/key"},map:{tagName:"div",attributes:{part:"thumb-item",role:"listitem"},children:[{tagName:"button",attributes:{part:"media-thumb",type:"button","data-path":"${$map.item.path}","data-selected":"${$map.item.selected}","aria-current":"${$map.item.selected === 'true' ? 'true' : null}",title:"Open ${$map.item.name} in Media, or drag it onto the canvas","aria-label":"${$map.item.name}"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/open"},value:[{$ref:"$map/item/path"}]}]},children:[{tagName:"span",attributes:{part:"thumb-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"$map/item/thumb"},cases:{image:{tagName:"img",attributes:{part:"thumb-image",src:"${$map.item.src}",alt:"",loading:"lazy",draggable:"false"}},file:{tagName:"span",attributes:{part:"thumb-name"},textContent:"${$map.item.name}"}}}]}]}}]},{tagName:"jx-button",attributes:{part:"media-more",hidden:"${state.mediaMore === '' ? '' : null}"},$props:{size:"sm",variant:"secondary",quiet:!0},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/openMedia"},value:[]}]},children:[{tagName:"span",textContent:"${state.mediaMore}"}]}]}}}]}]}}}]};E("site-panel",O);function A(){return{body:"none",components:[],componentsCount:"",componentsState:"loading",filter:"",media:[],mediaCount:"",mediaMore:"",mediaState:"loading",pages:[],pagesCount:"",pagesState:"loading",templates:[],templatesCount:"",templatesState:"loading"}}function z(e,t){e.body=t.body,e.filter=t.filter,e.pages=t.pages,e.pagesState=t.pagesState,e.pagesCount=t.pagesCount,e.templates=t.templates,e.templatesState=t.templatesState,e.templatesCount=t.templatesCount,e.components=t.components,e.componentsState=t.componentsState,e.componentsCount=t.componentsCount,e.media=t.media,e.mediaState=t.mediaState,e.mediaCount=t.mediaCount,e.mediaMore=t.mediaMore}function ne(e){let t=n(e)?void 0:e.attributes?.part;return n(t)?t:""}function re(e){let t=e?.$map,a=m(t)?t.item:void 0;return m(a)?a:null}function R(e,t){let a=re(e)?.[t];return n(a)?a:""}function _(e,t,a,r){let o=b({...A(),...a});z(o,t);let s=null,l=!1,d=I("site-panel",o,e,{onNodeCreated:(i,g,P,f)=>{if(l||!(i instanceof HTMLElement))return;switch(ne(P)){case"card-preview":{let u=R(f,"tagName");if(u!=="")r.preview(i,u);break}case"component-card":{let u=R(f,"tagName");if(u!=="")r.componentSource(i,u);break}case"media-thumb":{let u=R(f,"path");if(u!=="")r.mediaSource(i,u);break}default:break}}}).then((i)=>{if(l)return i.dispose(),i;return s=i,i});return{connected:()=>!l&&(s===null||s.root.parentNode===e),dispose(){l=!0,s?.dispose(),s=null},ready:d,update:(i)=>{z(o,i)}}}var N=null,D=!1,w=null,y=0;function ie(){return Object.keys(x?.projectConfig?.content??{})}async function oe(e){return(await nL(e)).contentType}async function se(e){let[t,a]=await Promise.all([_m(["pages","layouts"],p()),Fy()]),r=t.files.filter((i)=>i.path.startsWith("pages/")),o=await Promise.all(r.map(async(i)=>({contentType:i.path.includes("[")?await oe(i.path):null,path:i.path})));if(e!==y)return;let s=N?.collections,l=new Map(ie().map((i)=>[i,s?.get(i)??null]));D=!1,N={collections:l,layouts:t.files.flatMap((i)=>i.path.startsWith("layouts/")?[i.path]:[]),pageExtensions:a,pages:o},C();let d=new Set(o.flatMap((i)=>i.contentType&&l.has(i.contentType)?[i.contentType]:[]));if(await Promise.all([...d].map(async(i)=>{let g=await Ab(i).catch(()=>null);if(e===y&&g)l.set(i,g.length)})),e===y)C()}function le(){if((!N||D)&&!w&&ve()&&x){let e=y;w=se(e).finally(()=>{if(e===y)w=null})}return N}function lb(e){if(y+=1,D=!0,w=null,e===void 0||e.some((t)=>me(t)))T=!0;if(c)C()}var pe=["pages/","layouts/","content/","public/"];function me(e){if(e.startsWith("components/"))return!0;return e.endsWith(".json")&&e!=="project.json"&&!pe.some((t)=>e.startsWith(t))}var T=!1,M=!1;function de(){if(M||Tx&&!T||!ve())return;M=!0,T=!1,$a().finally(()=>{M=!1,C()})}function V(e,t){return De.flatMap((a)=>{let r=Rd(a.tagName),o=`<${a.tagName}>`,s=L(a);if(!pb(e,a.tagName,s??"",a.package??""))return[];return[{hint:s?`Open ${o}, or drag it onto the canvas`:`${o} from ${a.package??"a package"}: open Packages, or drag it onto the canvas`,key:a.tagName,label:r,path:s??"",selected:fw(s!==null&&s===t),tagName:a.tagName}]})}function L(e){return e?.path!==void 0&&e.source!=="npm"?e.path:null}var W=8;function ue(e,t){return e>t?`Show all ${e} in Media`:""}function B(e,t,a){return e.flatMap((r)=>pb(t,r.name,r.file)?[{key:r.file,name:r.name,path:r.file,selected:fw(r.file===a),src:r.isImage?no(r.file):"",thumb:r.isImage?"image":"file"}]:[])}function ge(){let e=x?.projectConfig?.defaults?.layout;return n(e)?e.replace(/^\.\//,""):null}var S="";function j(e,t,a){if(e)return"loading";if(t===0)return"empty";return a===0?"nomatch":"listed"}function k(e,t,a){if(a||e===0)return"";return t===e?String(e):`${t} of ${e}`}function U(){if(!x)return{...A(),filter:S};let e=AN(S),t=h.value?.documentPath??null,a=le();de();let r=Ku(),o=a?PN(a.pages,a.collections,t,{extensions:a.pageExtensions,i18n:ln(x.projectConfig??{}).i18n}):[],s=MN(o,e),l=ge(),d=a?ME(a.layouts,t,"",l):[],i=a?ME(a.layouts,t,e,l):[],g=!Tx,P=V("",t),f=V(e,t),u=r?B(r,"",t):[],v=r?B(r,e,t):[],H=(Y)=>Y.filter((Q)=>Q.kind!=="collection").length;return{body:"project",components:f,componentsCount:k(P.length,f.length,g),componentsState:j(g,P.length,f.length),filter:S,media:v.slice(0,W),mediaCount:k(u.length,v.length,r===null),mediaMore:ue(v.length,Math.min(v.length,W)),mediaState:j(r===null,u.length,v.length),pages:s,pagesCount:k(H(o),H(s),a===null),pagesState:j(a===null,o.length,s.length),templates:i,templatesCount:k(d.length,i.length,a===null),templatesState:j(a===null,d.length,i.length)}}function q(e){(ce("b2p9y0yz"),import("./files-b2p9y0yz.js")).then(({openFileInTab:t})=>t(e))}var fe={add:()=>{nt("file.new",{},"Site panel")},open:q,openComponent:(e)=>{let t=De.find((r)=>r.tagName===e);if(!t)return;let a=L(t);if(a){q(a);return}nt("view.setActivity",{tab:"packages"},"Site panel")},openMedia:()=>{nt("view.setWorkspace",{workspace:"media"},"Site panel")},setFilter:(e)=>{S=e,C()}},c=null;async function he(e,t,a){let r=await Ew(a,e.cache);if(r&&c===e&&t.isConnected&&!gw(t))mw(t,r)}function G(e,t,a){let r=Uo({element:t,getInitialData:()=>a()??{},onGenerateDragPreview:({nativeSetDragImage:o})=>{pl({nativeSetDragImage:o})}});e.sources.set(t,r)}function be(e){for(let[t,a]of e.sources)if(!t.isConnected)a(),e.sources.delete(t);e.observer.releaseDetached()}function K(e){e.handle?.dispose();for(let t of e.sources.values())t();e.sources.clear(),e.observer.destroy(),e.cache.clear()}function ye(e){let t=De.find((a)=>a.tagName===e);return t?{fragment:Uc(t),type:"block"}:null}function xe(e){let t=Ku()?.find((r)=>r.file===e);if(!t)return null;return{fragment:F({kind:Wd({name:t.name}),name:t.name,path:t.file,ref:t.ref}),type:"block"}}function we(e){if(c&&(c.host!==e||c.handle?.connected()===!1))K(c),c=null;if(c){c.handle?.update(U()),be(c);return}let t=new Map,a={cache:kw(),handle:null,host:e,observer:xp((r)=>{let o=r instanceof HTMLElement?t.get(r):void 0;if(o!==void 0&&r instanceof HTMLElement)t.delete(r),he(a,r,o)}),pending:t,sources:new Map};c=a,a.handle=_(e,U(),fe,{componentSource:(r,o)=>{G(a,r,()=>ye(o))},mediaSource:(r,o)=>{G(a,r,()=>xe(o))},preview:(r,o)=>{let s=L(De.find((l)=>l.tagName===o));if(s)t.set(r,s),a.observer.observe(r)}})}function C(){wn("leftPanel")}function Se(e){return e.querySelector(".panel-content")??e}function kN(){ei({id:"site",title:"Site",level:"project",dock:"navigator",icon:"browser",render:()=>ft,afterRender:(e,t)=>{we(Se(t))}})}function EN(){if(c)K(c);c=null,S="",y+=1,N=null,D=!1,w=null,T=!0,M=!1}
2
- export{CN,lb,kN,EN};
3
-
4
- //# debugId=258B948FFF44175364756E2164756E21
5
- //# sourceMappingURL=studio-nzp0sqjg.js.map
@@ -1,5 +0,0 @@
1
- import{Kn,g,Ft}from"./studio-s49y6m5b.js";import{ID}from"./studio-pte5w7rf.js";import{rh}from"./studio-aaw7wxv8.js";import{ce}from"./studio-7qqb7hb8.js";var e="edit",a=new Set(["edit","design"]);function r(t){for(let i of g.tabs.values())if(i.documentPath===t)return i;return null}async function ql(t){if(!rh(t)){let o=Kn(t);if(o&&!o.fileBacked)return ID(t);let{openFileInTab:s}=await (ce("b2p9y0yz"),import("./files-b2p9y0yz.js"));return await s(t),r(t)}let{openFileInTab:i}=await (ce("b2p9y0yz"),import("./files-b2p9y0yz.js"));await i(t);let n=r(t);if(!n)return null;if(!a.has(n.session.ui.canvasMode)&&n.capabilities.modes.includes(e))n.session.ui.canvasMode=e,n.session.ui.preview=!1;return Ft(n.id),n}
2
- export{ql};
3
-
4
- //# debugId=348E70D4BF4EDB5E64756E2164756E21
5
- //# sourceMappingURL=studio-ph17an19.js.map
@@ -1,5 +0,0 @@
1
- import{Ha}from"./studio-9f5vcb4w.js";var t=Ha(null);function YA(e){t.value=e}function ae(){return t.value}
2
- export{YA,ae};
3
-
4
- //# debugId=AF6962FDD210561A64756E2164756E21
5
- //# sourceMappingURL=studio-q509sqt8.js.map
@@ -1,5 +0,0 @@
1
- import{w}from"./studio-bk0anq3b.js";import{tu}from"./studio-x5py815g.js";import{p}from"./studio-xh6rf05g.js";import{Wi,fn,lo}from"./studio-ex1644g2.js";import{nI,$1,Lr,bM,S_,iI,rI,oI,Ky}from"./studio-zav9hgb3.js";import{Oy,FR,ko,x}from"./studio-zn7ysyzb.js";import{Ce,re,Hy,By,S1,df,C1,oa,uf,cg,b_}from"./studio-151kgn69.js";import{me,Ds,te,b,le,Ah}from"./studio-9f5vcb4w.js";import{n,J,qe,S,m,Rr,Ni,ld,_f}from"./studio-erjccagy.js";import{ce}from"./studio-7qqb7hb8.js";var Qt=new Set(["Adlm","Arab","Aran","Armi","Avst","Cprt","Egyd","Egyh","Elym","Gara","Hatr","Hebr","Hluw","Hung","Khar","Lydi","Mand","Mani","Mend","Merc","Mero","Narb","Nbat","Nkoo","Orkh","Palm","Phli","Phlp","Phnx","Prti","Rohg","Samr","Sarb","Sogd","Sogo","Syrc","Thaa","Todr","Yezi"]),o1="^[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 Ux(e){return jn(e)!==null}function vy(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&&Qt.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 en="prefix-except-default";function ln(e){let t=e.i18n,o=[];if(!S(t))return{errors:o,i18n:null};let r=Array.isArray(t.locales)?t.locales:[],i=[];for(let l of r){let c=jn(l);if(c===null){o.push(`i18n.locales: "${String(l)}" is not a well-formed BCP 47 language tag.`);continue}if(!i.includes(c))i.push(c)}let s=jn(t.defaultLocale)??i[0]??null;if(t.defaultLocale!==void 0&&jn(t.defaultLocale)===null)o.push(`i18n.defaultLocale: "${String(t.defaultLocale)}" is not a well-formed BCP 47 language tag.`);if(s===null)return o.push("i18n is declared with no usable locale — set `defaultLocale` or `locales`."),{errors:o,i18n:null};if(!i.includes(s))i.unshift(s);let a=t.routing==="prefix-always"||t.routing==="prefix-except-default"?t.routing:en;return{errors:o,i18n:{defaultLocale:s,locales:i,routing:a}}}function gr(e,t){let o=we(G(e),t);if(o===-1||t===null)return null;return jn(G(e)[o])}function qx(e,t){let o=gr(e,t);if(o!==null||t===null||t.routing!=="prefix-except-default")return o;return G(e)[0]==="pages"?t.defaultLocale:null}function wy(e,t){let o=G(e),r=we(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=G(e),s=we(i,o),a=s===-1?tn(i):s;if(a===-1)return null;let l=s===-1?i:i.filter((c,u)=>u!==s);if(r===o.defaultLocale&&o.routing==="prefix-except-default")return l.join("/");return l.toSpliced(a,0,r.toLowerCase()).join("/")}function G(e){return e.replace(/^\.\//,"").split("/").filter(Boolean)}function we(e,t){if(t===null)return-1;return e.findIndex((o)=>{let r=jn(o);return r!==null&&t.locales.includes(r)})}function tn(e){if(e[0]==="pages"&&e.length>1)return 1;if(e[0]==="content"&&e.length>2)return 2;return-1}function tP(e,t){if(t===null)return null;let o=e.split("/").find(Boolean);if(o===void 0)return t.defaultLocale;let r=jn(o);return r!==null&&t.locales.includes(r)?r:t.defaultLocale}var s1=["design","content","media","styles","publish","settings"],Up="design",Ye=[{icon:"frame-corners",id:"design",switcher:!0,title:"Design"},{icon:"file-text",id:"content",switcher:!0,title:"Content"},{icon:"image",id:"media",switcher:!0,title:"Media"},{icon:"paint-brush",id:"styles",switcher:!0,title:"Styles"},{icon:"paper-plane-tilt",id:"publish",switcher:!0,title:"Publish"},{icon:"gear-six",id:"settings",switcher:!1,title:"Project settings"}],Kx=Ye.filter((e)=>e.switcher);function bR(e){return typeof e==="string"&&s1.some((t)=>t===e)}function gh(e){return Ye.find((t)=>t.id===e)}var Re="workspace://",Gx={content:"content-home",media:"media-home",publish:"publish-home",settings:"settings-home"};function qp(e){return Object.hasOwn(Gx,e)}function Ia(e){return`${Re}${e}`}function bl(e){if(!e.startsWith(Re))return null;let t=e.slice(Re.length);return bR(t)&&qp(t)?t:null}function xy(e){let t=bl(e);return t?gh(t).title:null}var nn=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"]]),Kp={canvas:"Canvas",code:"Code",config:"Elements",diff:"Diff",entry:"Entry",grid:"Grid",home:"Home",image:"Image",media:"Media",none:"None",tokens:"Variables"};function na(e){return nn.get(e)??"canvas"}var on=new Map([["design","design"],["edit","edit"],["preview","preview"]]);function nP(e){return on.get(e)??"design"}var Jx=(e)=>e.editor.kind==="canvas",bh=(e)=>Jx(e)&&e.selection.count>0,Yx=(e)=>bh(e)&&!e.selection.isRoot;function _y(){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 a1(e={}){let t=_y();for(let o of Object.keys(e)){let r=e[o];if(r)Object.assign(t[o],r)}return t}var rn=["palette"],sn=["caret","global"],cn=["dock","global"],un=["canvas","global"],dn=["grid","global"],mn=["code","global"],Ze=["global"];function iP(e){if(e.modal.open)return rn;if(e.caret.active)return sn;if(e.focus.region!=="pane")return cn;switch(e.editor.kind){case"grid":return dn;case"code":return mn;case"canvas":return e.canvas.view==="preview"?Ze:un;default:return Ze}}var Ae=b(new Set);function Jm(e){Ae.add(e)}function Zx(e){Ae.delete(e)}function l1(e){return Ae.has(e)}var yR=()=>({kind:"proceed"});function Sy(e,t){return{success:!0,data:e,summary:t}}function Hn(e){return{success:!1,error:e}}function Ko({name:e,description:t,parameters:o,strict:r=!0,llmStrict:i=!1,interactive:s,title:a,annotations:l,interaction:c,settle:u,execute:d}){let 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 Xx(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 gn=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??Xx(),progress:e.progress??(()=>{}),session:t,signal:e.signal??gn}}function rP(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 e_(){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 v=Qe(u);if(f==="number"||f==="integer"){if(Je(u,"number"))continue;if(Je(u,"string")){if(!Number.isNaN(Number(u)))continue;s.push(`Argument "${c}" should be a number, got non-numeric string "${u}"`);continue}s.push(`Argument "${c}" should be a number, got ${v}`);continue}if(f==="string"&&v!=="string")s.push(`Argument "${c}" should be a string, got ${v}`);else if(f==="boolean"&&v!=="boolean")s.push(`Argument "${c}" should be a boolean, got ${v}`);else if(f==="array"&&v!=="array")s.push(`Argument "${c}" should be an array, got ${v}`);else if(f==="object"&&v!=="object")s.push(`Argument "${c}" should be an object, got ${v}`)}return s.length>0?{valid:!1,errors:s}:{valid:!0}},async execute(t,o,r=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 yn="The author declined this call.";function bn(e){return JSON.parse(JSON.stringify(e))}function ge(e){return e.message}var hn=["string","number","boolean","undefined"];function Je(e,t){return typeof e===t}function Tn(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function Qe(e){if(Array.isArray(e))return"array";return hn.find((t)=>Je(e,t))??"object"}function vn(e){if(!e)return{};let t=JSON.parse(e);if(!Tn(t)){let o=t===null?"null":Qe(t);throw TypeError(`arguments must be a JSON object, got ${o}`)}return t}async function vR(e,t,o,{approval:r=yR,response:i}={}){let s=!1,a;try{let l=vn(t.argumentsText),c=e.getDefinition(t.name),u=c?On(e,c,l,r,i):null;if(u?.status==="needs_input")return u;if(u)({result:a}=u);else s=!0,a=await e.execute(t.name,l,o)}catch(l){a=Hn(`Failed to parse arguments: ${ge(l)}`)}try{return{status:"done",result:bn(a),executed:s}}catch(l){let c=ge(l);return{status:"done",result:Hn(`Tool "${t.name}" returned a result that cannot be serialized: ${c}`),executed:s}}}function On(e,t,o,r,i){let{interaction:s,settle:a}=t;if(s&&a){let c=e.validate(t.name,o);if(!c.valid)return pe(`Validation failed: ${(c.errors||[]).join("; ")}`);if(i)return{status:"done",result:Pn(t.name,a,o,i),executed:!1};let u=s(o);return"refusal"in u?pe(u.refusal):{status:"needs_input",request:u}}let l=r(t,o);if(l.kind==="deny")return pe(l.message);if(l.kind==="confirm"){if(!i)return{status:"needs_input",request:{kind:"approval",reason:l.reason,summary:l.summary,title:t.title??t.name,tool:t.name}};if(i.kind!=="approval"||!i.approved)return pe(yn)}return null}function pe(e){return{status:"done",result:Hn(e),executed:!1}}function Pn(e,t,o,r){try{return t(o,r)}catch(i){return Hn(`Tool "${e}" execution error: ${ge(i)}`)}}function CR(e,t){return et(e,"v",t)}function i_(e,t){return et(e,"r",t)}function et(e,t,o){if(!n(o)||o==="")return e;let r=e.indexOf("#"),i=r===-1?"":e.slice(r),s=r===-1?e:e.slice(0,r),a=s.indexOf("?"),l=a===-1?s:s.slice(0,a),u=(a===-1?[]:s.slice(a+1).split("&")).filter((d)=>d!==""&&!Sn(d,t));return u.push(`${t}=${encodeURIComponent(o)}`),`${l}?${u.join("&")}${i}`}function Sn(e,t){let o=e.indexOf("="),r=o===-1?e:e.slice(0,o);if(r===t)return!0;if(!r.includes("%"))return!1;try{return decodeURIComponent(r)===t}catch{return!1}}function Ie(e,t){if(!e||!Object.hasOwn(e,t))return;let o=e[t];return n(o)?o:void 0}function Ey(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||!$1.test(a))continue;let c=Cn(l.source);if(c===""||c.startsWith(".."))continue;if(c.includes(Lr)){let u=wn(r,c,a,o);if(u)s(u.dir,u.urlPrefix);continue}if(/\.[a-z0-9]+$/i.test(c))continue;s(c,`/${nI}/${a}`)}return i}function wn(e,t,o,r){let i=t.indexOf(Lr),s=t.slice(0,i),a=t.slice(i+Lr.length);if(!e.startsWith(s))return null;let l=e.slice(s.length).split("/")[0]??"";if(l===""||!$1.test(l))return null;let c=r.find((d)=>d.toLowerCase()===l.toLowerCase());if(c===void 0||!$1.test(c))return null;return{dir:`${s}${l}${a}`.replace(/\/+$/,""),urlPrefix:`/${nI}/${o}/${c}`}}function Cn(e){return e.replaceAll("\\","/").replace(/^\.\//,"").replace(/\/+$/,"")}function Ty(e,t){if(!t||e==="")return null;if(t.space==="repo"){if(!t.fileBaseUrl)return null;let s=oI(e,t.documentDir,t.mounts,t.lanes);if(s===null)return null;let{suffix:a}=S_(e);return i_(CR(`${t.fileBaseUrl}${Ky(s)}${a}`,Ie(t.versions,s)),Ie(t.revisions,s))}let[o]=t.mounts,r=o?An(e,t.documentDir,o):null,i=Rn(e,t);return i===void 0?r:i_(r??e,i)}function Rn(e,t){if(!t.revisions||Object.keys(t.revisions).length===0)return;let o=oI(e,t.documentDir,t.mounts,t.lanes);return o===null?void 0:Ie(t.revisions,o)}function An(e,t,o){if(iI(e))return null;let{path:r,suffix:i}=S_(e),s;try{s=decodeURIComponent(r)}catch{return null}let a=rI(t,s);if(a===null)return null;let l=bM([o],a);if(!l)return null;return`${l}${i}`}function tt(e){return e.replaceAll(/[.*+?^${}()|[\]\\]/g,String.raw`\$&`)}function z(e){return e.replaceAll("\\","/").replace(/^\.\//,"").replace(/\/+$/,"")}function nt(e){return e??x?.projectConfig??null}function ot(e){return e?.content??{}}function Jn(e){let t=ln(e??{}).i18n?.locales??[];return t.length>0?[...t]:null}function rt(e){if(e.endsWith("/"))return!1;let t=e.slice(e.lastIndexOf("/")+1);return/\.[a-z\d]+$/i.test(t)}function it(e){if(e.format==="json")return{ext:".json",unresolvedFormat:null};if(e.format===void 0||e.format==="")return{ext:lo()?.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 In(e,t){let o=t===null?"[^/]+":`(?:${t.map((i)=>tt(i)).join("|")})`,r=z(e).split(Lr).map((i)=>tt(i)).join(o);return new RegExp(`^${r}(?:/|$)`,"i")}function kn(e,t,o){let r=In(e,o).exec(t);if(!r)return null;return r[0].replace(/\/$/,"")}function Dn(e){return z(e).replaceAll(Lr,"").length}function Gd(e,t){if(e===null||e===void 0||e==="")return null;let o=nt(t),r=Jn(o),i=z(e),s=null,a=-1;for(let[l,c]of Object.entries(ot(o))){let{source:u}=c;if(u===void 0||u===""||rt(u))continue;let d=Dn(u);if(d<=a)continue;let f=kn(u,i,r);if(f===null)continue;s={def:c,dir:i,fileBacked:!1,isSourceRoot:i.length===f.length,name:l,...it(c)},a=d}return s}function Kn(e,t){if(e===null||e===void 0||e==="")return null;let o=nt(t),r=z(e),i=r.toLowerCase();for(let[s,a]of Object.entries(ot(o))){let{source:l}=a;if(l===void 0||l===""||!rt(l))continue;let c=z(l).toLowerCase();if(i===c||i.endsWith(`/${c}`))return{def:a,dir:r.includes("/")?r.slice(0,r.lastIndexOf("/")):".",fileBacked:!0,isSourceRoot:!1,name:s,...it(a)}}return Gd(r.includes("/")?r.slice(0,r.lastIndexOf("/")):".",o)}function ed(e){return e.replaceAll(/([A-Z])/g," $1").replace(/^./,(t)=>t.toUpperCase())}function s_(e){return e.replaceAll(/[^a-zA-Z0-9]+(.)?/g,(t,o)=>o?o.toUpperCase():"").replace(/^[A-Z]/,(t)=>t.toLowerCase())}function a_(e){return e.replaceAll(/(^|-)(\w)/g,(t,o,r)=>(o?" ":"")+r.toUpperCase())}function u1(e,t){return e?.$label||ed(t)}function vP(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 Da(e){return e==="image"||e==="uri-reference"}function vh(e){if(e.$shorthand===!0)return"shorthand";if(e.$input==="button-group")return"button-group";if(e.$input==="media")return"media";if(e.format==="color")return"color";if(Da(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 wh(e,t){if(!e||!t?.content)return null;let o=Kn(e,t);if(!o||!o.def.schema)return null;if(!o.fileBacked){let r=o.ext??lo()?.extensions[0]??".json";if(!e.toLowerCase().endsWith(r.toLowerCase()))return null}return{name:o.name,schema:o.def.schema}}function $y(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 l_(e,t){return e.replace(new RegExp(`^${t.replaceAll(/[.*+?^${}()|[\]\\]/g,String.raw`\$&`)}`),"").replace(/^--/,"").replaceAll("-"," ").replaceAll(/\b\w/g,(o)=>o.toUpperCase())||e}function wP(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 io(e){return JSON.parse(JSON.stringify(e))}function Pe(e){return e?.at(-1)??null}function aP(e){return e?.[0]??null}function t_(e,t){if(!t||!e)return!1;return e.some((o)=>ko(o,t))}function Na(e){return Y(e)}function Y(e){let t=[];for(let o of e)t.push([...o]);return t}function n_(e,t){if(t_(e,t))return Y(e.filter((o)=>!ko(o,t)));return[...Y(e),[...t]]}function lP(e,t,o){let r=e.findIndex((a)=>ko(a,o)),i=t?e.findIndex((a)=>ko(a,t)):-1;if(r===-1||i===-1)return[[...o]];let s=i<=r?e.slice(i,r+1):e.slice(r,i+1).toReversed();return Y(s)}function ye(e,t){return Y(e.filter((o)=>!oa(t,o)))}function cP(e){let t=[];for(let o of e)if(!t.some((r)=>ko(r,o)))t.push([...o]);return t}function Xm(e){if(e.length===0)return{mixed:!1,value:void 0};let[t]=e,o=JSON.stringify(t??null);for(let r=1;r<e.length;r++)if(JSON.stringify(e[r]??null)!==o)return{mixed:!0,value:void 0};return{mixed:!1,value:t}}var st=null;function yP(e){st=e}function at(){return st}var X=null,Q=null,ee=null,ke=!0;function lt(){X=[],Q=[],ee=[],ke=!0}function y(e){if(X)X.push(e)}function Bi(e){if(Q)Q.push(e)}function ct(e){if(ee)ee.push(e)}function ut(){let e={docOps:Q??[],fmOps:ee??[],invertible:ke,ops:X??[]};return X=null,Q=null,ee=null,ke=!0,e}var En=100,Mn=20;function ne(){try{return typeof localStorage>"u"||!localStorage.getItem("jx-legacy-history")}catch{return!0}}function R(e,t){let o=re(e,t);if(!o)throw TypeError(`No node at path [${t.join(", ")}]`);return o}function C(e,t,o,r){return{forward:{key:t,op:"set-key",path:e,value:r},inverse:{key:t,op:"set-key",path:e,value:o}}}var dt=null;function ft(e){dt=e}var pt=null;function mt(e){pt=e}function $n(e,t,o,r){for(let i=t.docOps.length-1;i>=0;i--)By(e.doc.document,le(t.docOps[i].inverse));for(let i=t.fmOps.length-1;i>=0;i--){let s=t.fmOps[i];Me(e,s.field,s.before)}e.doc.document={...le(e.doc.document)},e.session.selection=o,e.doc.dirty=r}function Z(e,t,{skipHistory:o=!1,origin:r="user",coalesceKey:i=null,actor:s=null}={}){if(!e)return!1;if(r!=="remote"&&pt?.(e,r))return!1;let a=s??be;if(r!=="remote")Ee(e,a);let l=Na(e.session.selection),c=e.doc.dirty;lt();let u,d=null;try{t(e)}catch(I){d={error:I}}finally{u=ut()}if(d)throw $n(e,u,l,c),d.error;let f=le(e.doc.document),v={...f},j=at(),M=j===null?{patchable:!1,reason:"no-patch-consumer"}:u.ops.length===0?{patchable:!1,reason:"unrecorded-mutation"}:j.classify(e,u.ops);if(M.patchable)j.markConsumed(v,e);if(e.doc.document=v,M.patchable)try{j.apply(e,u.ops,u)}catch(I){j.escalate(`patch-apply-failed: ${I instanceof Error?I.message:String(I)}`,e)}if(!o){let I=a?_n(a):null;if(I)Fn(I,e,u,l);else gt(e,f,u,l,i)}return e.doc.dirty=!0,dt?.(e,u,r),!0}function gt(e,t,o,r,i=null){let s=e.history.snapshots.slice(0,e.history.index+1),a=ne()&&o.invertible&&(o.docOps.length>0||o.fmOps.length>0),l=s.at(-1);if(i&&a&&l&&l.coalesceKey===i&&l.inverseOps){if(l.forwardOps=[...l.forwardOps??[],...o.docOps.map((u)=>u.forward)],l.inverseOps=[...l.inverseOps,...o.docOps.map((u)=>u.inverse)],l.selection=Na(e.session.selection),l.document)l.document=io(t);e.history.snapshots=s,e.history.index=s.length-1;return}let c=!a||s.length%Mn===0;if(s.push({document:c?io(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:Na(e.session.selection),selectionBefore:r}),s.length>En){if(!s[1].document)s[1].document=De(s,1);s.shift()}e.history.snapshots=s,e.history.index=s.length-1}function De(e,t){let o=t;while(o>=0&&!e[o].document)o-=1;let r=o<0?null:e[o].document;if(!r)throw Error("history-missing-checkpoint");let i=io(r);for(let s=o+1;s<=t;s++)for(let a of e[s].forwardOps??[])By(i,a);return i}function Jd(e,t,o){return Z(e,(r)=>t(r.doc.document),o)}function je(e,t){Z(e,(o)=>{for(let r of t)xe(o,r)},{origin:"remote",skipHistory:!0})}function xP(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,C1(le(s.doc.document),a));Ln(s,r)},{actor:o})?"applied":"refused"}function Ln(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"&&ko(Pe(e.session.selection),t.from))e.session.selection=[[...t.to]]}var Nn=new Set(["state","$media","$head","$elements","imports","$layout"]);function xe(e,t,o=t){let r=null;if(t.op==="set-key")r=re(e.doc.document,t.path)?.[t.key];switch(By(e.doc.document,t),Bi({forward:t,inverse:o}),t.op){case"set-key":{if(Nn.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")&&(_f(t.value)||_f(r));y({isEvent:i,key:t.key,op:"set-prop",path:t.path})}return}case"insert-child":{y({index:t.index,op:"insert",parentPath:t.parentPath});return}case"remove-child":{y({op:"remove",path:[...t.parentPath,"children",t.index]});return}case"set-child":{y({op:"replace",path:[...t.parentPath,"children",t.index]});return}case"move-child":{y({fromPath:[...t.fromParentPath,"children",t.fromIndex],op:"move",toIndex:t.toIndex,toParentPath:t.toParentPath});break}default:break}}var W=new Map,N=new Map,be=null,yt=null;function bt(e){yt=e}function _P(e){let t=W.get(e.id);if(t)he(t);let o={owner:e,receipts:[]};return W.set(e.id,o),{owner:e,flush:()=>he(o),close:()=>{if(he(o),W.get(e.id)===o)W.delete(e.id);return[...o.receipts]}}}function TR(e,t){let o=be;be=e;try{return t()}finally{be=o}}function ht(e,t){let o=N.get(e);return o!==void 0&&(!t||o.lane.owner.id===t.id)}function SP(){for(let e of W.values())he(e)}function _n(e){return W.get(e.id)??null}function he(e){for(let[t,o]of N)if(o.lane===e)xt(t,o)}function Fn(e,t,o,r){let i=N.get(t);if(!i)i={docOps:[],fmOps:[],invertible:!0,lane:e,selectionBefore:r},N.set(t,i);if(i.docOps.push(...o.docOps),i.fmOps.push(...o.fmOps),!o.invertible||o.docOps.length===0&&o.fmOps.length===0)i.invertible=!1}function Ee(e,t){let o=N.get(e);if(o&&o.lane.owner.id!==t?.id)xt(e,o)}function xt(e,t){N.delete(e);let{owner:o}=t.lane,r=o.turnId??"";if(V.has(e))t.lane.receipts.push({entry:null,tab:e,turnId:r});else{let i={docOps:t.docOps,fmOps:t.fmOps,invertible:t.invertible,ops:[]};gt(e,le(e.doc.document),i,t.selectionBefore);let s=e.history.snapshots[e.history.index];if(s.actor=o.id,o.turnId!==void 0)s.turnId=o.turnId;t.lane.receipts.push({entry:s,tab:e,turnId:r})}yt?.(e)}var V=new WeakMap;function Yd(e,t){if(t)V.set(e,t);else V.delete(e)}function CP(e){let t=V.get(e);return t?t.canUndo(e):e.history.index>0||N.has(e)}function kP(e){let t=V.get(e);return t?t.canRedo(e):!N.has(e)&&e.history.index<e.history.snapshots.length-1}function Tt(e,t){let{snapshots:o}=e.history;e.doc.document=De(o,t);let r=o[t];e.session.selection=Na(le(r.selection))}function vt(e,t){try{if(typeof localStorage>"u"||!localStorage.getItem("jx-canvas-debug"))return}catch{return}let o=JSON.stringify(De(e.history.snapshots,t)),r=JSON.stringify(io(le(e.doc.document)));if(o!==r)console.error("jx history: ops-based undo/redo diverged from checkpoint replay",{index:t})}function h1(e){Ee(e,null);let t=V.get(e);if(t){t.undo(e);return}if(e.history.index<=0)return;let o=e.history.snapshots[e.history.index],r=ne()?o.inverseOps:null,i=ne()?o.fmOps:null;if(r&&r.length>0||i&&i.length>0){if(!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]);Me(a,c.field,c.before)}},{origin:"history",skipHistory:!0}))return;e.session.selection=Na(le(o.selectionBefore??[])),e.history.index-=1,vt(e,e.history.index)}else e.history.index-=1,Tt(e,e.history.index);e.doc.dirty=!0}function EP(e){Ee(e,null);let t=V.get(e);if(t){t.redo(e);return}if(e.history.index>=e.history.snapshots.length-1)return;let o=e.history.snapshots[e.history.index+1],r=ne()?o.forwardOps:null,i=ne()?o.fmOps:null;if(r&&r.length>0||i&&i.length>0){if(!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);Me(a,c.field,c.after)}},{origin:"history",skipHistory:!0}))return;e.session.selection=Na(le(o.selection)),e.history.index+=1,vt(e,e.history.index)}else e.history.index+=1,Tt(e,e.history.index);e.doc.dirty=!0}function ro(e,t,o,r){let i=re(e.doc.document,t);if(!i)return;let s=Hy(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 xh(e,t){let o=uf(t);if(!o)return;let{index:r,parentPath:i}=o,[s]=R(e.doc.document,i).children.splice(r,1);y({op:"remove",path:t}),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 $R(e,t){let o=uf(t);if(!o)return;let r=re(e.doc.document,t);if(!r)return;let{index:i,parentPath:s}=o,a=structuredClone(le(r));R(e.doc.document,s).children.splice(i+1,0,a),y({index:i+1,op:"insert",parentPath:s}),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 Qm(e,t){for(let o of cg(t))xh(e,o)}function c_(e,t){let o=[];for(let r of cg(t)){let i=e.session.selection;$R(e,r);let s=Pe(e.session.selection),a=uf(s);if(!s||!a||e.session.selection===i)continue;o=o.map((l)=>S1(a.parentPath,l,a.index,1,!0)),o.unshift(s)}if(o.length>0)e.session.selection=o}function TP(e,t,o="div"){let r=uf(t);if(!r)return;let i=re(e.doc.document,t);if(!i)return;let{index:s,parentPath:a}=r,l={children:[structuredClone(le(i))],tagName:o},c=Ce(i);R(e.doc.document,a).children.splice(s,1,l),y({op:"replace",path:t}),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 Gp(e,t,o,r){let i=e.doc.document,s=b_(i,t,o,r);if(!s)return;let{forward:a,inverse:l}=s,c=re(i,a.fromParentPath),u=re(i,o),[d]=c.children.splice(a.fromIndex,1);if(Hy(u).splice(a.toIndex,0,d),y({fromPath:t,op:"move",toIndex:a.toIndex,toParentPath:o}),Bi({forward:a,inverse:l}),ko(Pe(e.session.selection),t))e.session.selection=[[...l.fromParentPath,"children",l.fromIndex]]}function Xe(e,t,o,r){let i=re(e.doc.document,t);if(!i)return;let s=i[o],a=Ce(s);if(r===void 0||r===null||r==="")delete i[o];else i[o]=r;if(Bi(C(t,o,a,Ce(i[o]))),o==="children")e.session.selection=ye(e.session.selection,[...t,"children"]);if(o==="textContent")y({op:"set-text",path:t});else if(o==="style")y({op:"set-style",path:t});else{let l=r===void 0||r===null||r===""?s:r,c=o.startsWith("on")&&_f(l);y({isEvent:c,key:o,op:"set-prop",path:t})}}function eg(e,t,o,r){let i=R(e.doc.document,t),s=Ce(i.style);if(!i.style)i.style={};if(r===void 0||r==="")delete i.style[o];else i.style[o]=r;if(Object.keys(i.style).length===0)delete i.style;Bi(C(t,"style",s,Ce(i.style))),y({op:"set-style",path:t})}function So(e,t,o,r){let i=R(e.doc.document,t),s=Ce(i.attributes);if(!i.attributes)i.attributes={};if(r===void 0||r==="")delete i.attributes[o];else i.attributes[o]=r;if(Object.keys(i.attributes).length===0)delete i.attributes;Bi(C(t,"attributes",s,Ce(i.attributes))),y({attr:o,op:"set-attr",path:t})}function $P(e,t,o,r,i){if(!o)return eg(e,t,r,i);let s=R(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(C(t,"style",a,Ce(s.style))),y({op:"set-style",path:t})}function d_(e,t,o,r,i){let s=R(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(C(t,"style",a,Ce(s.style))),y({op:"set-style",path:t})}function LP(e,t,o,r,i,s){let a=R(e.doc.document,t),l=Ce(a.style);if(!a.style)a.style={};let c=`@${o}`,u=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(C(t,"style",l,Ce(a.style))),y({op:"set-style",path:t})}function Ot(e,t){let o=[e];for(let r of t){let i=Ni(o.at(-1),r);if(!i)break;o.push(i)}for(let r=o.length-2;r>=0;r--){let i=o[r],s=t[r],a=Ni(i,s);if(a&&Object.keys(a).length===0)delete i[s]}}function u_(e,t,o,r,i){let s=R(e.doc.document,t),a=Ce(s.style);if(!s.style)s.style={};let l=s.style;for(let c of o)l=ld(l,c);if(i===void 0||i==="")delete l[r],Ot(s.style,o);else l[r]=i;if(Object.keys(s.style).length===0)delete s.style;Bi(C(t,"style",a,Ce(s.style))),y({op:"set-style",path:t})}function RP(e,t,o,r,i,s){let a=R(e.doc.document,t),l=Ce(a.style);if(!a.style)a.style={};let c=`@${o}`,u=ld(a.style,c),d=u;for(let f of r)d=ld(d,f);if(s===void 0||s===""){if(delete d[i],Ot(u,r),Object.keys(u).length===0)delete a.style[c]}else d[i]=s;if(Object.keys(a.style).length===0)delete a.style;Bi(C(t,"style",l,Ce(a.style))),y({op:"set-style",path:t})}function IP(e,t,o){let r=R(e.doc.document,t),i=Ce(r.style);if(o&&Object.keys(o).length>0)r.style=o;else delete r.style;Bi(C(t,"style",i,Ce(r.style))),y({op:"set-style",path:t})}function Zd(e,t,o){let r=e.doc.document,i=Ce(r.state);if(!r.state)r.state={};r.state[t]=o,Bi(C([],"state",i,Ce(r.state))),y({key:"state",op:"doc-meta"})}function NP(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(C([],"state",r,Ce(o.state))),y({key:"state",op:"doc-meta"})}}function Go(e,t,o){let r=e.doc.document,i=Ce(r.state);if(!r.state)r.state={};let s=r.state[t],a=s==null?{}:!S(s)||Array.isArray(s)?{default:s}:s;r.state[t]=a,Object.assign(a,o);for(let l of Object.keys(a))if(a[l]===void 0||a[l]===null)delete a[l];Bi(C([],"state",i,Ce(r.state))),y({key:"state",op:"doc-meta"})}function DP(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(C([],"state",i,Ce(r.state))),y({key:"state",op:"doc-meta"})}function Jp(e,t,o,r){let i=R(e.doc.document,t),s=Ce(i.$props);if(!i.$props)i.$props={};if(r===void 0||r===null||r==="")delete i.$props[o];else i.$props[o]=r;if(Object.keys(i.$props).length===0)delete i.$props;Bi(C(t,"$props",s,Ce(i.$props))),y({op:"replace",path:t})}function OP(e,t,o,r){let i=R(e.doc.document,t),s=Ce(i.cases);if(!i.cases)i.cases={};i.cases[o]=r||{tagName:"div",textContent:o},Bi(C(t,"cases",s,Ce(i.cases))),y({op:"replace",path:t})}function AP(e,t,o){let r=R(e.doc.document,t);if(r.cases){let i=Ce(r.cases);delete r.cases[o],Bi(C(t,"cases",i,Ce(r.cases))),y({op:"replace",path:t})}}function PP(e,t,o,r){let i=R(e.doc.document,t);if(!i.cases||!i.cases[o])return;let s=Ce(i.cases);i.cases[r]=i.cases[o],delete i.cases[o],Bi(C(t,"cases",s,Ce(i.cases))),y({op:"replace",path:t})}function Xd(e,t,o){let r=e.doc.content.frontmatter,i=Object.hasOwn(r,t)?Ce(r[t]):void 0,s=o===void 0||o===null||o==="";if(s)delete r[t];else r[t]=o;let a=s?void 0:Ce(o);ct({after:a,before:i,field:t}),e.doc.dirty=!0}function Me(e,t,o){if(o===void 0)delete e.doc.content.frontmatter[t];else e.doc.content.frontmatter[t]=o}var B=[],Vn=50;function MP(e){return Object.assign(Xx(),{turnId:e})}function FP(e,t,o=[]){if(t.length===0)return[];let r={batches:[...o],id:e,writes:[...t]};B.push(r);while(B.length>Vn)B.shift();return r.writes}function jP(e){return B.find((t)=>t.id===e)?.writes??[]}function HP(e){let t=B.find((s)=>s.id===e),o="There is no longer a record of what that turn changed.";if(!t)return"There is no longer a record of what that turn changed.";let r=t.writes.filter((s)=>s.disk).map((s)=>s.path);if(r.length>0)return`Cannot restore: ${r.join(", ")} ${r.length===1?"was":"were"} written straight to disk, which undo cannot reach.`;if(t.batches.length===0)return"There is no longer a record of what that turn changed.";let i=new Map;for(let s of t.batches)i.set(s.tab,[...i.get(s.tab)??[],s]);for(let[s,a]of i){let l=Wn(s,a);if(l)return l}for(let[s,a]of i)for(let l of a)h1(s);return[...i.keys()]}function Wn(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 BP(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 p1(){B.splice(0)}function VP(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 Ym(e){let t=new Set,o=new Set;return Oy(e,(r,i)=>{t.add(r),o.add(JSON.stringify(i))}),t.size===0?null:{fingerprints:o,pointers:t}}function oP(e,t){if(!t)return e;return $e(e,"",t)}function $e(e,t,o){if(Array.isArray(e)){let i=null;for(let[s,a]of e.entries()){let l=$e(a,`${t}/${s}`,o);if(l!==a)i??=[...e],i[s]=l}return i??e}if(!m(e))return e;let r=null;for(let[i,s]of Object.entries(e)){let a=$e(s,`${t}/${FR(i)}`,o);if(i==="children"&&Array.isArray(a)&&a.length===1){let[l]=a;if(Rr(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 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 Un=["edit","design","preview","source","stylebook","git-diff"];function Cy({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 v=me(),j=Ym(r),M=a?.modes??Gn(t,s),I=f??M.find((T)=>T!=="preview")??"edit",ue=M[0]==="preview",L={bareRepeaters:j,content:{frontmatter:i||{}},dirty:!1,document:r,handlersSource:null,layout:u,mode:zn(t,s),source:d,sourceFormat:s},de={index:0,snapshots:[{document:structuredClone(r),selection:[]}]},q={canvas:{refreshing:!1,error:null,livePreviews:null,pendingInlineEdit:null,scope:null,status:"idle"},clipboard:null,hover:null,openedFrom:l,selection:[],ui:Bn(I,ue)};return v.run(()=>({capabilities:{modes:M},doc:b(L),documentPath:t,fileHandle:o,history:b(de),id:e,pinned:!1,preview:c,scope:v,session:b(q)}))}function Gn(e,t){if(e===an)return["stylebook","tokens","source"];let o=Wi(t)??fn(e);if(o)return o.studio?.modes??["edit","design","preview","source"];return Un}function zn(e,t){let o=Wi(t)??fn(e);if(o)return o.studio?.documentMode?.default??"content";return"component"}function c1(e){return na(e.session.ui.canvasMode)}function wR(e){let t=[];for(let o of e.capabilities.modes){if(o==="preview")continue;let r=na(o);if(!t.includes(r))t.push(r)}return t}function sP(e,t){return e.capabilities.modes.find((o)=>o!=="preview"&&na(o)===t)}function Zm(e){e.scope.stop()}var Pt=new WeakMap,H=new Map;function xn(e){let t=le(e),o=Pt.get(t);if(!o)o=b({active:!1,attachError:"",peers:[],readOnly:!1,sourceCanonical:!1,status:"unavailable"}),Pt.set(t,o);return o}function wt(e){H.set(e,(H.get(e)??0)+1)}function Ct(e){let t=H.get(e)??0;if(t<=1)H.delete(e);else H.set(e,t-1)}function ky(e){return H.has(e.replaceAll("\\","/"))}var Yn=8000,Zn=800,Xn=2500,Rt=null;function Qn(){return Rt??=(ce("7nj2375a"),import("./index-7nj2375a.js")),Rt}function Jt(){try{return p()}catch{return null}}var K=null;function dP(e){K=e}var Ne=null;function uP(e){Ne=e}var It=()=>{};function hP(e){It=e??(()=>{})}var _e=new WeakMap;function kt(e){return le(e)}function Ve(e,t){return e.frontmatterMap(t)}function eo(e){return e.synced}function E(e){return _e.get(kt(e))}function He(e){let t=kt(e),o=_e.get(t);if(!o)o={attaching:null,generation:0,optedOut:b({value:!1}),session:null,watcherInstalled:!1},_e.set(t,o);return o}var At=!1;function to(){if(At)return;At=!0,ft(no),bt(oo),mt((e)=>{if(E(e)?.session?.synced&&xn(e).sourceCanonical)return It("Source editing in progress — structural edits are paused"),"source-canonical";return null})}function no(e,t,o){let r=E(e)?.session;if(!r||!r.synced)return;if(r.lastSeenRef=le(e.doc.document),o==="remote"){Te(r);return}if(r.canWrite)so(r,t),Te(r)}function oo(e){let t=E(e)?.session;if(!t?.synced||t.batchOps===null)return;let{batchOps:o,batchNeedsDiff:r}=t;if(t.batchOps=null,t.batchNeedsDiff=!1,!t.canWrite)return;if(t.undoManager?.stopCapturing(),r)oe(t);else if(o.length>0)try{t.collab.applyDocOpsToY(t.handle.doc,o,t.collab.LOCAL_ORIGIN)}catch{oe(t)}t.undoManager?.stopCapturing()}function so(e,t){let o=t.docOps.map((r)=>r.forward);if(ht(e.tab)){if(e.batchOps??=[],o.length===0)e.batchNeedsDiff=!0;else e.batchOps.push(...o);return}if(o.length===0){oe(e);return}try{e.collab.applyDocOpsToY(e.handle.doc,o,e.collab.LOCAL_ORIGIN)}catch{oe(e)}}function oe(e){let{collab:t,handle:o,tab:r}=e,i=t.yDocToJson(o.doc),s=io(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 ao(e){if(!e.canWrite)return!1;let{awareness:t}=e.handle,o=t.clientID;for(let[r,i]of t.getStates())if(i.canWrite!==!1&&r<o)o=r;return o===e.handle.awareness.clientID}function Te(e){if(!K||!ao(e))return;if(e.collab.canonicalOf(e.handle.doc)==="source")return;let t=Date.now();if(e.lastMirrorAt??=t,t-e.lastMirrorAt>=Xn){if(e.mirrorTimer)clearTimeout(e.mirrorTimer),e.mirrorTimer=null;e.lastMirrorAt=t,We(e);return}if(e.mirrorTimer)clearTimeout(e.mirrorTimer);e.mirrorTimer=setTimeout(()=>{e.mirrorTimer=null,e.lastMirrorAt=Date.now(),We(e)},Zn)}async function We(e){if(!K||!e.synced)return;try{let t=await K(e.tab);e.collab.updateSourceText(e.handle.doc,t,e.collab.MIRROR_ORIGIN)}catch{}}async function Dt(e){if(!Ne||!e.synced||!e.canWrite)return;let{collab:t,handle:o,tab:r}=e,i=t.canonicalRevOf(o.doc),s=t.sourceText(o.doc).toString(),a;try{a=await Ne(r,s)}catch{return}if(!eo(e)||t.canonicalRevOf(o.doc)!==i)return;let l=t.diffDocs(t.yDocToJson(o.doc),a.document);if(l===null)t.replaceYStructure(o.doc,a.document,t.MIRROR_ORIGIN);else if(l.length>0)try{t.applyDocOpsToY(o.doc,l,t.MIRROR_ORIGIN)}catch{t.replaceYStructure(o.doc,a.document,t.MIRROR_ORIGIN)}let c=Ve(t,o.doc),u=a.frontmatter??{};o.doc.transact(()=>{let d=[...c.keys()];for(let f of d)if(!(f in u))c.delete(f);for(let[f,v]of Object.entries(u))if(!t.deepEqual(c.get(f),v))c.set(f,v)},t.MIRROR_ORIGIN)}function pP(e){let t=E(e)?.session;if(!t?.synced)return null;let{collab:o,handle:r}=t,i=null,s=()=>i!==null&&t.sourceLockOwner===i;return{awareness:r.awareness,enter:async()=>{i={},t.sourceLockOwner=i;let a=r.awareness.getLocalState();if(a)r.awareness.setLocalState({...a,mode:"source"});if(!t.canWrite)return;let l=null;if(K)try{l=await K(e)}catch{l=null}if(!s())return;o.acquireSourceCanonical(r.doc,l??o.sourceText(r.doc).toString(),o.LOCAL_ORIGIN)},leave:()=>{if(!s()){i=null;return}i=null,t.sourceLockOwner=null;let a=r.awareness.getLocalState();if(a)r.awareness.setLocalState({...a,mode:"structure"});if(!t.canWrite)return;if(o.otherSourceEditors(r.awareness,t.path,r.awareness.clientID).filter((c)=>r.awareness.getStates().get(c)?.canWrite!==!1).length===0)Dt(t).then(()=>{o.releaseSourceCanonical(r.doc,o.LOCAL_ORIGIN)})},localOrigin:o.LOCAL_ORIGIN,readOnly:!t.canWrite,text:o.sourceText(r.doc)}}function ia(e){let t=xn(e);return t.active&&t.readOnly}async function xR(e){let t=E(e)?.session;if(!t?.synced||!t.canWrite)return!1;if(t.mirrorTimer)clearTimeout(t.mirrorTimer),t.mirrorTimer=null;return await We(t),await t.handle.flush(),!0}async function fP(){for(let e of Be)if(E(e)?.session?.synced)await xR(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)}),Ds(()=>{Be.delete(e),ve(e)})})}function _R(e,t){let o=He(e);if(o.optedOut.value===!t)return;if(o.optedOut.value=!t,!o.watcherInstalled&&t)ie(e)}function SR(e){return E(e)?.optedOut.value!==!0}function jt(e){if(!E(e)?.watcherInstalled){ie(e);return}ve(e),Ke(e)}async function Ke(e){let t=He(e);if(t.session||t.attaching)return;let{documentPath:o}=e,r=Jt();if(!o||!r?.collab){xn(e).status="unavailable";return}let{generation:i}=t,s=xn(e);s.status="connecting",s.attachError="";let a=(async()=>{try{let[l,c]=await Promise.all([Qn(),r.collab(o)]);if(!c){s.status="detached";return}if(t.generation!==i){c.destroy();return}let u,d=new Promise((f,v)=>{u=setTimeout(()=>v(Error("collab-sync-timeout")),Yn)});try{await Promise.race([c.whenSynced,d])}finally{clearTimeout(u)}if(t.generation!==i){c.destroy();return}t.session=co(e,o,l,c),s.active=!0,s.status="synced",s.readOnly=!t.session.canWrite,s.attachError="",wt(o)}catch(l){s.status="failed",s.active=!1,s.attachError=l instanceof Error?l.message:String(l),w.warn(`Live collaboration is not available for "${o}" — ${s.attachError}`,{key:`collab:${o}`,path:o,source:"Collaboration"})}finally{t.attaching=null}})();t.attaching=a,await a}function ve(e){let t=E(e);if(!t)return;t.generation+=1;let{session:o}=t;t.session=null;let r=xn(e);if(r.active=!1,r.status="detached",r.attachError="",r.peers=[],!o)return;if(Ct(o.path),o.mirrorTimer)clearTimeout(o.mirrorTimer);if(o.sourceParseTimer)clearTimeout(o.sourceParseTimer);for(let i of o.disposers)try{i()}catch{}Yd(e,null),e.history.snapshots=[{document:io(le(e.doc.document)),selection:Na(e.session.selection)}],e.history.index=0,o.undoManager?.destroy(),o.handle.destroy()}function co(e,t,o,r){let i=r.identity(),s={applyingRemoteFrontmatter:!1,batchNeedsDiff:!1,batchOps:null,canWrite:i?i.permission!=="read":!0,collab:o,disposers:[],handle:r,lastSeenRef:le(e.doc.document),mirrorTimer:null,path:t,sourceLockOwner:null,sourceParseTimer:null,synced:!1,tab:e,undoManager:null};if(o.metaMap(r.doc).get("structureSeeded")===!0){let T=o.yDocToJson(r.doc),O=io(le(e.doc.document));if(!o.deepEqual(T,O)){let k=o.diffDocs(O,T);if(k===null)s.synced=!0,Le(s),s.synced=!1;else if(k.length>0)je(e,k)}s.applyingRemoteFrontmatter=!0;let P=Ve(o,r.doc);for(let[k,F]of P.entries())e.doc.content.frontmatter[k]=F;s.applyingRemoteFrontmatter=!1}else if(s.canWrite)o.seedStructure(r.doc,io(le(e.doc.document)),{frontmatter:io(le(e.doc.content.frontmatter)),origin:o.SEED_ORIGIN,sourceFormat:e.doc.sourceFormat});s.lastSeenRef=le(e.doc.document),s.disposers.push(r.onDirty((T)=>{e.doc.dirty=T})),r.awareness.setLocalState({canWrite:s.canWrite,focusedPath:t,structuralSelection:null,user:i?{avatarUrl:i.avatarUrl,color:i.color,login:i.login,name:i.name}:{color:o.colorForKey(String(r.awareness.clientID)),login:`guest-${r.awareness.clientID%1000}`}});let l=new o.UndoManager([o.structureMap(r.doc),o.frontmatterMap(r.doc)],{trackedOrigins:new Set([o.LOCAL_ORIGIN])});s.undoManager=l;let c=({stackItem:T})=>{T.meta.set("selection",Na(e.session.selection))},u=({stackItem:T})=>{let O=T.meta.get("selection");e.session.selection=Na(O??[])};l.on("stack-item-added",c),l.on("stack-item-popped",u),s.disposers.push(()=>{l.off("stack-item-added",c),l.off("stack-item-popped",u)}),Yd(e,{canRedo:()=>l.canRedo(),canUndo:()=>l.canUndo(),redo:()=>{l.redo()},undo:()=>{l.undo()}});let d=o.structureMap(r.doc),f=(T,O)=>{if(O.origin===o.LOCAL_ORIGIN||!s.synced)return;let P=o.yEventsToDocOps(T);if(P===null){Le(s);return}if(P.length===0)return;try{je(e,P)}catch{Le(s)}};d.observeDeep(f),s.disposers.push(()=>d.unobserveDeep(f));let v=xn(e);v.sourceCanonical=o.canonicalOf(r.doc)==="source";let j=o.metaMap(r.doc),M=()=>{v.sourceCanonical=o.canonicalOf(r.doc)==="source"};j.observe(M),s.disposers.push(()=>j.unobserve(M));let I=o.sourceText(r.doc),ue=(T,O)=>{if(O.origin===o.MIRROR_ORIGIN||!s.synced)return;if(o.canonicalOf(r.doc)!=="source")return;if(!o.isSourceReconciler(r.awareness,s.path))return;if(s.sourceParseTimer)clearTimeout(s.sourceParseTimer);s.sourceParseTimer=setTimeout(()=>{s.sourceParseTimer=null,Dt(s)},600)};I.observe(ue),s.disposers.push(()=>I.unobserve(ue));let L=Ve(o,r.doc),de=(T,O)=>{if(O.origin===o.LOCAL_ORIGIN||!s.synced)return;s.applyingRemoteFrontmatter=!0;try{for(let[P,k]of T.changes.keys)if(k.action==="delete")delete e.doc.content.frontmatter[P];else e.doc.content.frontmatter[P]=L.get(P)}finally{s.applyingRemoteFrontmatter=!1}};L.observe(de),s.disposers.push(()=>L.unobserve(de)),e.scope.run(()=>{let T=JSON.stringify(e.doc.content.frontmatter);te(()=>{let O=JSON.stringify(e.doc.content.frontmatter);if(O===T)return;if(T=O,s.applyingRemoteFrontmatter||!s.synced||!s.canWrite)return;let P=JSON.parse(O);r.doc.transact(()=>{let k=[...L.keys()];for(let F of k)if(!(F in P))L.delete(F);for(let[F,ze]of Object.entries(P))if(!o.deepEqual(L.get(F),ze))L.set(F,ze)},o.LOCAL_ORIGIN),Te(s)}),te(()=>{let O=e.session.selection.length>0?Na(e.session.selection):null,P=r.awareness.getLocalState();if(P)r.awareness.setLocalState({...P,structuralSelection:O})}),te(()=>{let O=le(e.doc.document);queueMicrotask(()=>{if(E(e)?.session!==s||!s.synced||!s.canWrite)return;let k=le(e.doc.document);if(k!==O||k===s.lastSeenRef)return;s.lastSeenRef=k,oe(s),Te(s)})})});let q=xn(e),fe=()=>{let T=[];for(let[O,P]of r.awareness.getStates())if(O!==r.awareness.clientID&&P.user)T.push({clientId:O,state:P});q.peers=T};return fe(),r.awareness.on("change",fe),s.disposers.push(()=>r.awareness.off("change",fe),r.onStatus((T)=>{if(T==="offline"||T==="connecting")q.status="offline";else if(s.synced)q.status="synced"}),r.onReset(()=>{ve(e),Ke(e)})),s.synced=!0,s}function D(e,t,o){return RangeError(`command "${e}" argument "${t}": ${o}`)}function uo(e){if(J(e))return"number";if(qe(e))return"boolean";return n(e)?"string":"object"}function A(e){if(e===void 0)return"missing";return n(e)?`"${e}"`:`${uo(e)} ${JSON.stringify(e)}`}function Mt(e){return Array.isArray(e)&&e.every((t)=>n(t)||J(t))}function St(e,t,o){let r=t[o];if(!n(r)||r==="")throw D(e,o,`expected a non-empty string, got ${A(r)}`);return r}function ti(e,t,o){if(t[o]===void 0)return;return St(e,t,o)}function $t(e,t,o){let r=t[o];if(!J(r)||!Number.isFinite(r))throw D(e,o,`expected a finite number, got ${A(r)}`);return r}function Et(e,t,o){let r=t[o];if(!J(r)||!Number.isInteger(r))throw D(e,o,`expected an integer, got ${A(r)}`);return r}function r_(e,t,o,r,i){let s=$t(e,t,o);if(s<r||s>i)throw D(e,o,`${s} is outside the supported range ${r}–${i}`);return s}function Hi(e,t,o){let r=t[o];if(!qe(r))throw D(e,o,`expected a boolean, got ${A(r)}`);return r}function qn(e,t,o,r){let i=t[o],s=n(i)?r.find((a)=>a===i):void 0;if(s===void 0)throw D(e,o,`${A(i)} is not declared — declared: ${r.join(", ")||"none"}`);return s}function d1(e,t,o){let r=t[o];if(!Mt(r))throw D(e,o,`expected an array of path segments (strings or numbers), got ${A(r)}`);return r}function mP(e,t,o){if(t[o]===null)return null;return d1(e,t,o)}function kR(e,t,o){let r=t[o];if(!Array.isArray(r))throw D(e,o,`expected an array of document paths, got ${A(r)}`);return r.map((i,s)=>{if(!Mt(i))throw D(e,o,`entry ${s} is not a document path — expected an array of segments, got ${A(i)}`);return i})}function Se(e,t=Object.keys(e)){return{additionalProperties:!1,properties:e,required:[...t],type:"object"}}function pi(e,t){return{description:t,enum:[...e],type:"string"}}function yl(e,t){return{description:t,get enum(){return[...e()]},type:"string"}}function ER(e,t={}){return{description:e,type:"number",...t}}function Tr(e){return{description:e,type:"boolean"}}function o_(e,t=!1){let o={items:{type:["string","number"]},type:"array"};return t?{description:e,oneOf:[o,{type:"null"}]}:{description:e,...o}}function gP(e){return{description:e,items:{items:{type:["string","number"]},type:"array"},type:"array"}}function Fe(e){return{description:e,type:"string"}}function fo(e){return e.length===2&&e.includes("string")&&e.includes("number")}function Ue(e){return n(e)?[e]:e}function Lt(e){let t=e;if("enum"in t)return"enum";if("const"in t)return"const";if(Array.isArray(t.oneOf))return"one-of";if(Array.isArray(t.type))return"typed";switch(t.type){case"boolean":return"boolean";case"number":case"integer":{if(t.minimum!==void 0&&t.maximum!==void 0)return"bounded-number";return t.type==="integer"?"integer":"number"}case"string":return"string";case"array":{let o=t.items?.type;if(Array.isArray(o))return fo(o)?"path":"pass-through";return o==="array"?"path-list":"pass-through"}case"null":case"object":return"typed";default:break}return"pass-through"}function Nt(e,t){switch(e){case"null":return t===null;case"boolean":return qe(t);case"string":return n(t);case"number":return J(t)&&Number.isFinite(t);case"integer":return J(t)&&Number.isInteger(t);case"array":return Array.isArray(t);case"object":return S(t)&&!Array.isArray(t);default:break}return!1}function _t(e){if(e.length<=1)return e.join("");return`${e.slice(0,-1).join(", ")} or ${e.at(-1)}`}function po(e,t,o,r){let i=t[o];if(i===void 0||!r.some((s)=>Nt(s,i)))throw D(e,o,`expected ${_t(r)}, got ${A(i)}`);return i}function Vt(e){switch(Lt(e)){case"enum":return`one of ${(e.enum??[]).map((t)=>A(t)).join(" | ")}`;case"const":return`the constant ${A(e.const)}`;case"one-of":return(e.oneOf??[]).map((t)=>Vt(t)).join(" or ");case"typed":return _t(Ue(e.type??[]));case"boolean":return"a boolean";case"bounded-number":return`a number from ${e.minimum} to ${e.maximum}`;case"number":return"a finite number";case"integer":return"an integer";case"string":return"a non-empty string";case"path":return"a document path";case"path-list":return"a list of document paths";default:return"anything"}}function mo(e,t,o,r){let i=t[o],s=[];for(let a of r){if(a.type!==void 0&&!Ue(a.type).some((l)=>Nt(l,i)))continue;try{return Bt(e,t,o,a)}catch(l){s.push(l)}}if(s.length===1)throw s[0];throw D(e,o,`expected ${r.map((a)=>Vt(a)).join(" or ")}, got ${A(i)}`)}function Bt(e,t,o,r){switch(Lt(r)){case"enum":return qn(e,t,o,r.enum??[]);case"const":{let i=t[o];if(i!==r.const)throw D(e,o,`expected the constant ${A(r.const)}, got ${A(i)}`);return i}case"one-of":return mo(e,t,o,r.oneOf??[]);case"typed":return po(e,t,o,Ue(r.type??[]));case"boolean":return Hi(e,t,o);case"bounded-number":{if(r.type==="integer")Et(e,t,o);return r_(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 d1(e,t,o);case"path-list":return kR(e,t,o);default:return t[o]}}function bP(e,t,o){let r=t,i=r.properties??{},s=Object.keys(i),a=r.required??[],l={};for(let[c,u]of Object.entries(o)){if(u===void 0||Object.hasOwn(i,c))continue;if(r.additionalProperties===!1)throw D(e,c,`not declared — declared: ${s.join(", ")||"none"}`);l[c]=u}for(let c of s){if(o[c]===void 0&&!a.includes(c))continue;l[c]=Bt(e,o,c,i[c])}return l}var go=20,fi="primary",tg="secondary",LR=2,g=b({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=Jo();return e.derived?.kind==="lens"?pn(e.derived.sourcePaneId)?.activeTabId??null:e.activeTabId},get tabOrder(){return Jo().tabOrder}}),h=Ah(()=>g.activeTabId?g.tabs.get(g.activeTabId)??null:null);function Jo(){let{panes:e}=g;return e.find((t)=>t.id===g.activePaneId)??e[0]}function pn(e){return g.panes.find((t)=>t.id===e)}function Oa(e){return g.panes.find((t)=>t.tabOrder.includes(e))}function Co(e){let t=pn(e);if(!t||t.id===g.activePaneId)return;g.activePaneId=t.id,_();let{activeTabId:o}=t;if(o){Ge(o);let r=g.tabs.get(o);if(r)zt(r)}}function ng(e){return g.activePaneId===e}function f1(e){let t=e??Jo().activeTabId,o=t?g.tabs.get(t):null;if(!t||!o)return null;let r=Oa(t);if(!r)return null;let i=sc(r.id);return og(t),_h(i,t),i.activeTabId=t,g.activePaneId=i.id,_(),Ge(t),i}function m1(e){return g.panes.find((t)=>t.id!==e)??yo(tg)}function sc(e){let t=m1(e);if(t.derived)t.derived=null;return t}function yo(e){let t=pn(e);if(t)return t;return g.panes=[...g.panes,{activeTabId:null,derived:null,id:e,tabOrder:[]}],pn(e)}function ig(e){if(g.panes.length<2)return;let t=e===fi?g.panes.find((s)=>s.id!==fi)?.id:e,o=t===void 0?void 0:pn(t),r=g.panes.find((s)=>s.id!==t);if(!o||!r)return;for(let s of o.tabOrder)_h(r,s);let i=o.activeTabId!==null&&U(o.activeTabId)?o.activeTabId:null;if(r.activeTabId=g.activePaneId===o.id?i??r.activeTabId??o.activeTabId:r.activeTabId??o.activeTabId,g.activePaneId=r.id,r.derived?.sourcePaneId===o.id)r.derived=null;g.panes=g.panes.filter((s)=>s.id!==o.id),_()}function rg(e){return e.tabOrder.length===0&&e.derived===null}var U=()=>!0;function g1(e){U=e??(()=>!0)}var Ut=null;function b1(e){Ut=e}var qt=null;function y1(e){qt=e}function bo(){let e=0;for(let t of g.tabs.keys())if(U(t))e+=1;return e}function Gt(e){return e.tabOrder.findLast((t)=>U(t))??null}function og(e){let t=[];for(let o of g.panes){if(!o.tabOrder.includes(e))continue;if(o.tabOrder=o.tabOrder.filter((r)=>r!==e),o.activeTabId===e)o.activeTabId=Gt(o);if(o.id!==fi&&rg(o))t.push(o.id)}for(let o of t)ig(o)}function _h(e,t,o){if(e.tabOrder.includes(t))return;let r=o??xo(e,t);e.tabOrder=[...e.tabOrder.slice(0,r),t,...e.tabOrder.slice(r)]}function ho(e){let t=0;for(let o of e.tabOrder){if(g.tabs.get(o)?.pinned!==!0)break;t+=1}return t}function xo(e,t){return g.tabs.get(t)?.pinned===!0?ho(e):e.tabOrder.length}function ac(e,t=null){if(g.projectRoot&&e!==g.projectRoot)p1();g.projectRoot=e,g.projectConfig=t}function Yp(e){let t=h.value;return e!==null&&t!==null&&le(t)===le(e)}function vl(e){if(!e)return!1;let t=g.tabs.get(e.id);return t!==void 0&&le(t)===le(e)}function Ge(e){g.mruOrder=[e,...g.mruOrder.filter((t)=>t!==e)]}var Oe=null,se=0;function _(){Oe=null,se=0}function zt(e){if(x&&e.documentPath)x.selectedPath=e.documentPath}function v1(e){let t=pn(e);if(t)t.activeTabId=null}function ae(e,t={}){let o=g.tabs.get(e),r=Oa(e);if(!o||!r)return;if(r.activeTabId=e,t.focus===!1)return;if(g.activePaneId=r.id,!t.cycling)_(),Ge(e);zt(o)}function Si(e){if(e.background===!0){let a=g.tabs.get(e.id);if(a)return a;let l=Cy({...e,preview:!1}),c=(e.paneId===void 0?void 0:pn(e.paneId))??Jo();return _h(c,l.id),g.tabs.set(l.id,l),l}let t=g.tabs.get(e.id),o=e.preview===!0&&t?.pinned!==!0,r=Cy({...e,preview:o}),i=(e.paneId===void 0?void 0:pn(e.paneId))??Jo(),s;if(t)r.pinned=t.pinned,Zm(t);else{if(o){let l=Ht(i),c=l?g.tabs.get(l):null;if(c)tu(c);w1()}let a=o?Ht(i):null;if(a)s=i.tabOrder.indexOf(a),Qd(a);_h(i,r.id,s)}return g.tabs.set(r.id,r),ae(r.id,{focus:e.focus!==!1}),ie(r),r}function Ht(e){return e.tabOrder.find((t)=>g.tabs.get(t)?.preview===!0)??null}function td(e){let t=g.tabs.get(e);if(t?.preview===!0)t.preview=!1}function w1(){for(let[e,t]of g.tabs)if(t.preview&&(t.doc.dirty||Ly(t)))td(e)}var Yt=null;function RR(e){Yt=e}function Ly(e){return Yt?.(e)??!1}function h_(e,t){let o=g.tabs.get(e),r=Oa(e);if(!o||!r)return;if(o.pinned=t,t)o.preview=!1;let i=r.tabOrder.filter((a)=>a!==e),s=i.filter((a)=>g.tabs.get(a)?.pinned===!0).length;r.tabOrder=[...i.slice(0,s),e,...i.slice(s)]}function IR(e,t){let o=g.tabs.get(e),r=Oa(e);if(!o||!r)return;r.tabOrder=Zt(r,e,t)}function Zt(e,t,o){let r=g.tabs.get(t);if(!r)return e.tabOrder;let i=e.tabOrder.filter((u)=>u!==t),s=i.filter((u)=>g.tabs.get(u)?.pinned===!0).length,a=r.pinned?0:s,l=r.pinned?s:i.length,c=Math.min(Math.max(o,a),l);return[...i.slice(0,c),t,...i.slice(c)]}function Qd(e){let t=g.tabs.get(e);if(!t)return;let o=Oa(e),r=o?.activeTabId===e;if(To(t),Zm(t),g.tabs.delete(e),Zx(e),og(e),g.mruOrder=g.mruOrder.filter((l)=>l!==e),_(),o&&rg(o))ig(o.id);if(!r)return;let i=Jo(),s=qt?.(i.id)??null,a=(s!==null&&i.tabOrder.includes(s)?s:null)??g.mruOrder.find((l)=>i.tabOrder.includes(l)&&U(l))??Gt(i);if(a)ae(a);else Ut?.(i.id)}function NR(){let e=[...g.tabs.values()];g.tabs.clear(),Xt(),g.mruOrder=[],_();for(let t of e)Zm(t)}function Xt(){g.panes=[{activeTabId:null,derived:null,id:fi,tabOrder:[]}],g.activePaneId=fi}function To(e){if(!e.documentPath)return;let t=e.documentPath;g.closedTabs=[{documentPath:t},...g.closedTabs.filter((o)=>o.documentPath!==t)].slice(0,go)}function vo(){let[e]=g.closedTabs;if(!e)return;return g.closedTabs=g.closedTabs.slice(1),e.documentPath}function Kt(e){if(!Oe)Oe=g.mruOrder.filter((r)=>g.tabs.has(r)&&U(r)),se=0;let t=Oe;if(t.length<2)return;se=((se+e)%t.length+t.length)%t.length;let o=t[se];return ae(o,{cycling:!0}),o}function DR(e){let t=[...g.tabs.keys()],o=[...g.tabs.values()],r=Cy(e);g.tabs.set(r.id,r),Xt(),g.panes[0].tabOrder=[r.id],g.mruOrder=[],_(),ae(r.id),ie(r);for(let i of t){if(i===r.id)continue;g.tabs.delete(i)}for(let i of o)Zm(i);return r}function Ft(e,t={}){ae(e,t)}function Ry(e,t,o){let r=pn(t);if(!r||!g.tabs.has(e))return null;if(r.tabOrder.includes(e)){if(o!==void 0)r.tabOrder=Zt(r,e,o);return r}return og(e),_h(r,e,o),r}function OR(e,t,o){let r=g.tabs.get(e);if(!r)return;if(r.id=t,r.documentPath=o,l1(e))Zx(e),Jm(t);g.tabs.delete(e),g.tabs.set(t,r);for(let i of g.panes)if(i.tabOrder=i.tabOrder.map((s)=>s===e?t:s),i.activeTabId===e)i.activeTabId=t;g.mruOrder=g.mruOrder.map((i)=>i===e?t:i),_(),jt(r)}function AR(e,t){e.registerAll([...Oo(t),...Po(t)])}function Oo(e){let t=()=>bo()>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 ${Kp[o.editor.kind]} editor, which is not an element tree the document tools can edit`;return`"${i}" is the active document, ${a}.`}},run:async(o,r)=>{let i=St("document.open",r,"path");if(await e.openFile(i),![...g.tabs.values()].some((s)=>s.documentPath===i))throw RangeError(`command "document.open" argument "path": "${i}" could not be opened — it does `+"not exist, or no editor claims its format. Problems has the reason.")}},{args:Se({file:Fe('Project-relative path of the file to open in the other pane, e.g. "pages/about.json". It must exist.')}),id:"document.openToSide",title:"Open to the Side",category:"Document",level:"project",menus:["context/file","palette"],group:"1_file",when:(o)=>o.project.open,requires:"an open project",undo:"none",run:async(o,r)=>{let i=St("document.openToSide",r,"file"),s=sc(Jo().id);if(await e.openFile(i,{paneId:s.id}),![...g.tabs.values()].some((a)=>a.documentPath===i)){if(rg(s)&&s.id!==fi)ig(s.id);throw RangeError(`command "document.openToSide" argument "file": "${i}" could not be opened — it `+"does not exist, or no editor claims its format. Problems has the reason.")}}},{id:"document.reopenClosed",title:"Reopen Closed Document",category:"Document",level:"document",keybinding:"mod+shift+t",menus:["context/tab","palette"],group:"1_file",enablement:()=>g.closedTabs.length>0,requires:"a document closed in this session",run:async()=>{let o=vo();if(o)await e.openFile(o)}},{id:"document.togglePinned",title:"Pin / Unpin Document",category:"Document",level:"document",menus:["context/tab","palette"],group:"1_file",when:(o)=>o.document.open,requires:"an open document",run:()=>{let o=g.activeTabId,r=o?g.tabs.get(o):null;if(o&&r)h_(o,!r.pinned)}},{args:Se({pinned:Tr("True to pin the active document's tab, false to unpin it.")}),id:"document.setPinned",title:"Set Document Pinned",category:"Document",level:"document",menus:["palette"],group:"1_file",when:(o)=>o.document.open,requires:"an open document",run:(o,r)=>{let i=g.activeTabId;if(i&&g.tabs.get(i))h_(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=g.activeTabId;return o!==null&&g.tabs.get(o)?.preview===!0},requires:"a preview document — one opened by a single click",run:()=>{let o=g.activeTabId;if(o)td(o)}}]}function Po(e){let t=()=>g.panes.length>1;return[{id:"pane.splitRight",title:"Split Right",category:"View",level:"document",keybinding:"mod+\\",menus:["context/pane","context/tab","palette"],group:"5_pane",when:(o)=>o.document.open,enablement:()=>g.activeTabId!==null,requires:"an open document",undo:"none",run:()=>{f1()}},{args:Se({path:Fe("Project-relative path of the document to open beside this one.")}),id:"pane.compareWith",title:"Compare With…",category:"View",level:"document",menus:["context/pane","context/tab","palette"],group:"5_pane",when:(o)=>o.document.open,enablement:()=>g.activeTabId!==null,requires:"an open document",undo:"none",run:async(o,r)=>{let i=St("pane.compareWith",r,"path"),s=Jo();if((s.activeTabId?g.tabs.get(s.activeTabId):null)?.documentPath===i)throw RangeError(`command "pane.compareWith" argument "path": "${i}" is the document this pane is `+"already showing — name a different one");await e.openFileInPane(sc(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:()=>{Co(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:()=>{Co(tg)}},{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:wo}]}function wo(){let e=g.panes.find((t)=>t.derived!==null);if(e?.id===fi){if(e.derived=null,!rg(e))return}ig(e?.id??tg)}
2
- export{o1,jn,Ux,vy,Wt,ln,gr,qx,wy,Qc,tP,s1,Up,Kx,bR,gh,Gx,qp,Ia,bl,xy,Kp,na,nP,Jx,bh,Yx,_y,a1,iP,Jm,Zx,l1,yR,Sy,Hn,Ko,Xx,yh,Qx,rP,e_,vR,Ym,oP,an,Cy,c1,wR,sP,Zm,xn,ky,Pe,aP,t_,Na,n_,lP,cP,Xm,dP,uP,hP,pP,ia,xR,fP,_R,SR,CR,i_,Ey,Ty,St,ti,r_,Hi,qn,d1,mP,kR,Se,pi,yl,ER,Tr,o_,gP,Fe,bP,yP,Bi,Gd,Kn,ed,s_,a_,u1,vP,Da,vh,wh,$y,l_,wP,io,Z,Jd,xP,_P,TR,SP,Yd,CP,kP,h1,EP,ro,xh,$R,Qm,c_,TP,Gp,Xe,eg,So,$P,d_,LP,u_,RP,IP,Zd,NP,Go,DP,Jp,OP,AP,PP,Xd,MP,FP,jP,HP,BP,p1,VP,fi,tg,LR,g,h,Jo,pn,Oa,Co,ng,f1,m1,sc,ig,rg,g1,b1,y1,og,_h,ac,Yp,vl,v1,Si,td,w1,RR,Ly,h_,IR,Qd,NR,DR,Ft,Ry,OR,AR};
3
-
4
- //# debugId=B693D967BCF4DB1C64756E2164756E21
5
- //# sourceMappingURL=studio-s49y6m5b.js.map
@@ -1,5 +0,0 @@
1
- function Ip(t){if(Number.isNaN(t.getTime()))return"";let r=String(t.getMonth()+1).padStart(2,"0"),n=String(t.getDate()).padStart(2,"0");return`${String(t.getFullYear()).padStart(4,"0")}-${r}-${n}`}
2
- export{Ip};
3
-
4
- //# debugId=6082A299D0C404CC64756E2164756E21
5
- //# sourceMappingURL=studio-t46rt6gx.js.map
@@ -1,5 +0,0 @@
1
- var s=new Set(["project.schema.json","document.schema.json"]);function pI(e){return s.has(e)?`file:///.jx/generated/${e}`:`file:///${e}`}function IM(e,r){return{head:`file:///.jx/diff/${e}/head/${r}`,work:`file:///.jx/diff/${e}/work/${r}`}}function NM(e){switch(e.slice(e.lastIndexOf(".")+1).toLowerCase()){case"cjs":case"js":case"mjs":return"javascript";case"css":return"css";case"htm":case"html":return"html";case"json":return"json";case"md":return"markdown";case"cts":case"mts":case"ts":return"typescript";case"yaml":case"yml":return"yaml";default:return"plaintext"}}
2
- export{pI,IM,NM};
3
-
4
- //# debugId=4130EE0D8A36BEA364756E2164756E21
5
- //# sourceMappingURL=studio-veh91hjv.js.map
@@ -1,6 +0,0 @@
1
- import{w_,pf,ff,mf,x_,dg,su,Wy,bf,XR,Lh,hg,uM,sa}from"./studio-m3jrjfhy.js";import{p}from"./studio-xh6rf05g.js";import{mh,zp}from"./studio-48yzqzqr.js";import{Ty}from"./studio-s49y6m5b.js";import{jt,fn}from"./studio-ex1644g2.js";import{De}from"./studio-43pynnhz.js";import{_x}from"./studio-aaw7wxv8.js";import{Bo}from"./studio-ek4fb4eb.js";import{ph,my,oc,gy,by,fh}from"./studio-w4mfaaam.js";import{x}from"./studio-zn7ysyzb.js";import{n,Q,S,m,cd}from"./studio-erjccagy.js";function R(e,t){return new URL(`/node_modules/${e}`,t).href}function b(e){if(e===void 0)return!1;if(n(e))return!e.includes("${");if(Array.isArray(e))return e.every((t)=>b(t));if(m(e))return!("$ref"in e)&&!("$prototype"in e)&&!("$expression"in e)&&Object.values(e).every((t)=>b(t));return!0}function b0(e){let t=new Map;for(let[s,r]of Object.entries(e.state??{})){if(cd(s)||!m(r)||!Array.isArray(r.examples))continue;let[o]=r.examples;if(b(o))t.set(s,o)}return t}var T={body:"body",root:":root"};function P(e,t,s,r,o=T){let l=[],a=(i,c)=>{let y={mediaQueries:t,scope:c,transposeValue:s};if(r)y.resolveValue=(d,v)=>r(d,v,c);for(let d of dg(i,y))l.push(d.text)},h={},g={},w=[],C=[];for(let[i,c]of Object.entries(e)){if(S(c)&&!Array.isArray(c)){if(i.startsWith("@"))w.push([i,c]);else if(!i.startsWith("--"))C.push([i,c]);continue}if(x_(i)||i.startsWith("@"))continue;if(i.startsWith("--")||i==="colorScheme"||i==="color-scheme")h[i]=c;else g[i]=c}a(h,o.root),a(g,o.body);for(let[i,c]of C)if(i.startsWith("&"))a({[i]:c},o.root);else a(c,i);for(let[i,c]of w){if(w_(i)||pf(i)){a({[i]:c},null);continue}let y={},d={},v=[];for(let[u,f]of Object.entries(c)){if(S(f)&&!Array.isArray(f)){if(!u.startsWith("@"))v.push([u,f]);continue}if(u.startsWith("--"))y[u]=f;else d[u]=f}a({[i]:y},o.root),a({[i]:d},o.body);for(let[u,f]of v)a({[i]:f},u)}if(Object.values(t).some((i)=>mf(i)!==null)&&!("colorScheme"in e))l.push(`${o.root} { color-scheme: light dark }`,`${o.root}:where([${ff}="light"]) { color-scheme: light }`,`${o.root}:where([${ff}="dark"]) { color-scheme: dark }`);return l.join(`
2
- `)}var A={body:":host",root:":host"},J=new WeakMap,j=new WeakMap;function D(e){let t=e.replaceAll(/:root\b/g,":host").replaceAll(/(^|[\s,>+~(])(?:html|body)(?![\w-])/g,"$1:host").replaceAll(/:host(?:\s*>?\s*:host)+/g,":host");return t===e?null:t}function E(e){for(let t=0;t<e.cssRules.length;t+=1){let s=e.cssRules[t],r=s instanceof CSSStyleRule?D(s.selectorText):null;if(s instanceof CSSStyleRule&&r!==null){let l=`${r}${s.cssText.slice(s.cssText.indexOf("{"))}`;try{e.insertRule(l,t),e.deleteRule(t+1)}catch{}}let o=e.cssRules[t];if(o instanceof CSSGroupingRule)E(o)}}function M(e){let t=[];for(let s of e??[]){if(!S(s)||String(s.tagName).toLowerCase()!=="link")continue;let{href:r,rel:o}=s.attributes??{};if(n(r)&&r!==""&&n(o)&&o.split(/\s+/).includes("stylesheet"))t.push(r)}return t}async function L(e){let t=by(e,"project.json");try{let s=await fetch(t);if(!s.ok)return null;let r=new URL(t,location.href).href,o=new CSSStyleSheet({baseURL:r});return o.replaceSync(await s.text()),E(o),o}catch{return null}}async function H(e){let s=(await Promise.all(M(e.$head).map((o)=>L(o)))).filter((o)=>o!==null),{style:r}=e;if(S(r)){let o=new CSSStyleSheet;o.replaceSync(P(r,e.$media??{},(l)=>l,void 0,A)),s.push(o)}return s}function O(){let e=x?.projectConfig;if(!e||!Q(globalThis.CSSStyleSheet))return Promise.resolve([]);let t=J.get(e);if(!t)t=H(e).then((s)=>(j.set(e,s),s)),J.set(e,t);return t}function fD(){let e=x?.projectConfig;return(e&&j.get(e))??[]}var N=150;function kw(e=N){let t=new Map;function s(){for(let[r,o]of t){if(t.size<=e)break;t.delete(r),o.remove()}}return{clear(){for(let r of t.values())r.remove();t.clear()},get(r){let o=t.get(r);if(o!==void 0)t.delete(r),t.set(r,o);return o},has:(r)=>t.has(r),keys:()=>[...t.keys()],set(r,o){t.delete(r),t.set(r,o),s()},size:()=>t.size}}function k(e){let t=oc(x?.projectRoot);return URL.canParse(t)?new URL(e,t).href:location.href}async function F(e){try{let t=await p().readFile(e);su(!0);let s=gy(e,fh());await jt();let r;if(fn(e))r=(await Bo(e,t)).document;else r=JSON.parse(t);return await W(r,e,s)}catch{return null}}async function W(e,t,s){su(!0),Wy(my());let r=await Lh(e,{},k(t)),o=s&&{...s,revisions:zp(),versions:mh()};XR((l)=>Ty(l,o));try{let l=sa(e,r);return l instanceof HTMLElement?l:null}finally{XR(null)}}async function V(e,t){let s=await lT(t);if(!s)return null;let r=b0(s);return await y0(s,t,r)?_x(e,r):null}async function lT(e){try{let t=JSON.parse(await p().readFile(e));return S(t)&&!Array.isArray(t)?t:null}catch{return null}}async function y0(e,t,s){let r=null;try{su(!0),Wy(my());let o=await Lh(e,{},k(t));for(let[h,g]of s)o[h]=g;let l=!1;hg(()=>{l=!0});let{stop:a}=bf(()=>sa({...e,tagName:"div"},o));return r=a,!l}catch{return!1}finally{hg(null),r?.()}}function _(e){return e.source!=="npm"&&(e.path?.endsWith(".json")??!1)}async function Ew(e,t){let s=t.get(e);if(s)return s;let r;try{uM((l)=>R(l,`${ph()}/`)),await O();let o=De.find((l)=>l.path===e);if(o&&_(o))r=await V(o,e);else r=o?await _x(o):await F(e)}catch{return}if(!r)return;return t.set(e,r),r}function xp(e){if(!Q(globalThis.IntersectionObserver))return{destroy(){},observe:(r)=>e(r),releaseDetached:()=>0};let t=new Set,s=new IntersectionObserver((r)=>{for(let o of r)if(o.isIntersecting)t.delete(o.target),s.unobserve(o.target),e(o.target)},{rootMargin:"200px"});return{destroy(){s.disconnect(),t.clear()},observe(r){if(t.has(r))return;t.add(r),s.observe(r)},releaseDetached(){let r=0;for(let o of t)if(!o.isConnected)t.delete(o),s.unobserve(o),r+=1;return r}}}
3
- export{b0,fD,kw,lT,y0,Ew,xp};
4
-
5
- //# debugId=D9CD7D01FDC77CBF64756E2164756E21
6
- //# sourceMappingURL=studio-vswmz40d.js.map
@@ -1,5 +0,0 @@
1
- import{yM,vM}from"./studio-zav9hgb3.js";import{p,ve}from"./studio-xh6rf05g.js";import{mh,eP,zp}from"./studio-48yzqzqr.js";import{ln,Ey,Ty,h}from"./studio-s49y6m5b.js";import{x}from"./studio-zn7ysyzb.js";function ph(){let t=ve()?p().canvasUrl:void 0;if(t)return new URL(t,location.href).origin;return location.origin}function my(){let t=ve()?p().canvasUrl:void 0;if(!t)return null;let e=new URL(t,location.href);return e.origin===location.origin?e.searchParams.get("rpcToken"):null}function oc(t){let e=ph(),n=ve()?p().documentBaseUrl:void 0;if(n){let o=n.endsWith("/")?n:`${n}/`;return new URL(o,`${e}/`).href}let r=t||"";return`${e}/${r?`${r}/`:""}`}function r1(t){if(t.startsWith("data:")||t.startsWith("blob:")||t.startsWith("http")||t.startsWith("views://"))return t;let e=ph();if((e.startsWith("http:")||e.startsWith("https:"))&&e!==location.origin)return`${e}/${t.replace(/^\.?\//,"")}`;return t}function mR(){return ln(x?.projectConfig??{}).i18n?.locales??[]}function gy(t,e){let n=e?.space??"site",r=Ey(t,x?.projectConfig?.content,mR());if(n==="site"&&!r&&!eP())return null;let o={documentDir:vM(t??""),lanes:yM,mounts:r?[r]:[],space:n};if(e?.fileBaseUrl!==void 0)o.fileBaseUrl=e.fileBaseUrl;return o}function Xc(t){return by(t,h.value?.documentPath)}function by(t,e){if(!t)return t;let n=gy(e,fh()),r=n&&{...n,revisions:zp(),versions:mh()};return r1(Ty(t,r)??t)}function fh(){let t={fileBaseUrl:oc(x?.projectRoot)};if(ve())t.space=p().assetSpace;return t}
2
- export{ph,my,oc,r1,mR,gy,Xc,by,fh};
3
-
4
- //# debugId=DC850CCD352EB61864756E2164756E21
5
- //# sourceMappingURL=studio-w4mfaaam.js.map
@@ -1,5 +0,0 @@
1
- import{w}from"./studio-bk0anq3b.js";import{le}from"./studio-9f5vcb4w.js";import{Q,S}from"./studio-erjccagy.js";var st={functionEditor:null,blockActionBarEl:null,selDragCleanup:null,dndCleanups:[],elementsCollapsed:new Set,elementsFilter:"",_currentDropTargetRow:null,layerDragSourceHeight:0,_completionRegistered:!1,_layersCollapsed:null};var m=0;function WP(){return m+=1,m}var l=new Map;function br(e){let r=l.get(e);if(!r)r=v(e),l.set(e,r);return r}function v(e){return{centerObserver:null,monacoDiffEditor:null,monacoEditor:null,needsCenter:!0,panX:0,panY:0,panels:[],paneId:e,panzoomWrap:null,stage:null,prevCanvasMode:null,prevStylebookCustomizedOnly:null,prevStylebookFilter:null,renderGeneration:0,sourceCollabCleanup:null,stageScrollbar:null,wrap:null}}function Sh(e){return e.wrap}function Zp(){return[...l.values()]}function nd(e){if(!e)return null;for(let r of l.values())if(Sh(r)?.contains(e))return r;return null}function g(e){for(let r of e.panels)r.renderScope?.stop(),r.renderScope=null;e.panels.length=0,e.prevCanvasMode=null}function zP(e,r){let t=br(e);return t.wrap=r,g(t),t}function UP(e){if(l.get(e))PR(e);let t=v(e);return l.set(e,t),t}var b=null;function qP(e){b=e}function PR(e){let r=l.get(e);if(!r)return;b?.(r),g(r),T(e)}function T(e){l.delete(e)}var Xp="commit";function h(e){return S(e)&&Q(e.then)}function Iy(e){let r=new Map,t=new Map,o=new Map,a=!1,u=!1,c=!1;function f(n,i){if(!h(i))return i;let s=i.finally(()=>{if(o.get(n)===s)o.delete(n)});return o.set(n,s),s}let d={arm(n,i,s){clearTimeout(r.get(n)),t.set(n,s),r.set(n,setTimeout(()=>{r.delete(n),t.delete(n),f(n,s())},i))},cancel(){for(let n of r.values())clearTimeout(n);r.clear(),t.clear()},flush(n){let i=t.get(n);if(!i)return o.get(n);return clearTimeout(r.get(n)),r.delete(n),t.delete(n),f(n,i())},ahead:()=>a,markAhead(){a=!0},typed:()=>u,markTyped(){a=!0,u=!0},markSettled(){a=!1,u=!1},shared:()=>c,markShared(){c=!0}};return e._writes=d,d}var M={logic:{holds:"The handler you were typing",reached:"written into",source:"Logic"},source:{holds:"The source you were typing",reached:"parsed into",source:"Editor"}};function p(e,r,t){if(e._writes?.typed()!==!0)return!0;let a=e._editingTab??null,u=a?.documentPath??"Untitled",{holds:c,reached:f,source:d}=M[r],n=t?{detail:C(t.error)}:{};if(n.key=`buffer-discarded:${r}:${a?.id??"none"}`,n.source=d,a?.documentPath)n.path=a.documentPath;return w.warn(`${c} was discarded — it was never ${f} "${u}".`,n),!1}function C(e){return e instanceof Error?e.stack??e.message:String(e)}function Ny(e,r){let t=e?._writes;if(!e||!t)return!0;let o;try{o=t.flush(Xp)}catch(a){return t.cancel(),p(e,r,{error:a})}if(t.cancel(),h(o))return o.then(()=>p(e,r,null),(a)=>p(e,r,{error:a})),!0;return p(e,r,null)}function MR(e){e?._writes?.cancel()}function eu(e){return Boolean(e?.getModel())}function Qp(e,r){if(!eu(e)||e.hasTextFocus()||e._writes?.ahead()||e._writes?.shared())return!0;return r!==void 0&&e.getValue()!==r}function y(e){let r=le(e);return[...Zp().map((o)=>o.monacoEditor),st.functionEditor].filter((o)=>o!=null&&o._editingTab!=null&&le(o._editingTab)===r&&eu(o))}async function tu(e){for(let r of y(e)){if(!eu(r))continue;try{await r._writes?.flush(Xp)}catch(t){let o={detail:C(t),key:`buffer-commit:${e.id}`,source:"Editor"};if(e.documentPath)o.path=e.documentPath;w.error(`Could not save the editor's contents into "${e.documentPath??"Untitled"}".`,o)}}}function ef(e){return y(e).some((r)=>r._writes?.typed()===!0)}
2
- export{st,WP,br,Sh,Zp,nd,zP,UP,qP,PR,Xp,Iy,Ny,MR,eu,Qp,tu,ef};
3
-
4
- //# debugId=C870C8E1FA9AC47B64756E2164756E21
5
- //# sourceMappingURL=studio-x5py815g.js.map
@@ -1,5 +0,0 @@
1
- var aa=new Set([".jpg",".jpeg",".png",".gif",".svg",".webp",".avif",".ico"]),uI=new Set([".mp4",".webm",".mov",".m4v"]),hI=new Set([".mp3",".wav",".ogg",".m4a",".flac"]),la=new Set([...aa,...uI,...hI,".pdf",".woff",".woff2",".ttf",".otf"]);function Ot(t){let o=t.lastIndexOf(".");return o>0?t.slice(o).toLowerCase():""}function wf(t){return aa.has(t.startsWith(".")?t.toLowerCase():`.${t.toLowerCase()}`)}
2
- export{aa,uI,hI,la,Ot,wf};
3
-
4
- //# debugId=1381C0AD25E51E5764756E2164756E21
5
- //# sourceMappingURL=studio-z6s56dzz.js.map
@@ -1,7 +0,0 @@
1
- import{ft}from"./studio-4z0cdh16.js";import{X}from"./studio-9c6cbq2c.js";import{Tn,nt,Fn}from"./studio-cv6gnjqd.js";import{ao,w}from"./studio-bk0anq3b.js";import{ae}from"./studio-q509sqt8.js";import{cf,p,ve}from"./studio-xh6rf05g.js";import{jt,$h,lc,ru,Pa,lf,fn,_l}from"./studio-ex1644g2.js";import{hs}from"./studio-wn2cmf9q.js";import{Rs,Gm}from"./studio-48yzqzqr.js";import{Wt,ln,gr,Ym,ky,Gd,Kn,fi,g,Oa,sc,ac,Si,DR,Ft,Ry,OR}from"./studio-s49y6m5b.js";import{Wp,GA,JA,Ls}from"./studio-k05g7efh.js";import{ot,Er,_o}from"./studio-c72v1kwc.js";import{Ts,kA,XL,RA,Mx,Fx}from"./studio-1d8m5s38.js";import{al}from"./studio-thgexj3w.js";import{ei}from"./studio-gw83z798.js";import{$a}from"./studio-43pynnhz.js";import{wf}from"./studio-z6s56dzz.js";import{zo,Zs,Xs,Uo}from"./studio-czpmzs9r.js";import{tx,Dm,Om,Bb}from"./studio-ajfq4fmr.js";import{n1,nR,iR,ly,qm,Jc,Qs}from"./studio-td3h1644.js";import{YT,q0}from"./studio-6sxnqqw8.js";import{sx}from"./studio-j3bq30yz.js";import{rO,Bo,Mb,Fb}from"./studio-ek4fb4eb.js";import{Vb,Zu}from"./studio-g65t6svn.js";import{Vt}from"./studio-w3aafbpk.js";import{zw,Uw,qw}from"./studio-jqvke4ac.js";import{sl}from"./studio-6mf31e16.js";import{Ks}from"./studio-6hcfm9q3.js";import{x,id,_n}from"./studio-zn7ysyzb.js";import{E,I}from"./studio-1a7zshnv.js";import{b}from"./studio-9f5vcb4w.js";import{n,S}from"./studio-erjccagy.js";import{ce}from"./studio-7qqb7hb8.js";async function Nb(){if(tx(location.search))return!1;let e=p();if(!e.dependenciesNeedInstall||!e.installDependencies)return!1;let t=!1;try{t=await e.dependenciesNeedInstall()}catch{return!1}if(!t)return!1;let o=al({status:"Installing dependencies…",title:"Installing dependencies"});try{let r=await e.installDependencies();if(r.ok)return o.done(),!0;o.fail(r.log??"Install failed")}catch(r){o.fail(r instanceof Error?r.message:String(r))}return!1}var Le=["page","component"],Me={components:"component",pages:"page"};function M(e){return e.replaceAll("\\","/").replace(/^\.\//,"")}function Ae(e){let t=M(e).toLowerCase();for(let[o,r]of Object.entries(Me))if(t.startsWith(`${o}/`))return r;return null}function K(e){return Le.some((t)=>e.includes(t))}function He(e){let t=x?.projectConfig?.layout;if(!n(t))return!1;return M(t).toLowerCase()===M(e).toLowerCase()}function A0(e){let t=[{ext:".json",label:"JSON (.json)"}];for(let o of _l(e)){let r=Pa(o,"parse");if(r&&Pa(o,"serialize"))t.push({ext:o,label:`${r.name} (${o})`})}return t}function ie(){return new Set([".json",...ru().flatMap((e)=>e.extensions)])}function P0(e){if(e===null||e===void 0||e==="")return[];let t=Ae(e);if(t===null||He(e)||Kn(e))return[];let o=fn(e);if(!(o?Boolean(o.capabilities.parse)&&K(o.documentKinds):M(e).toLowerCase().endsWith(".json")))return[];let a=[];if(o)a.push({ext:".json",label:"JSON (.json)"});for(let i of _l()){let s=Pa(i,"serialize");if(!s||s.name===o?.name||!K(s.documentKinds)||!s.documentKinds.includes(t))continue;a.push({ext:i,label:`${s.name} (${i})`})}return a}function VD(){let e=new Set([".json"]);for(let t of ru()){if(!t.capabilities.serialize||!K(t.documentKinds))continue;for(let o of t.extensions)e.add(o)}return[...e].toSorted()}var Y="jx-studio-recent-projects",le="jx-studio-recent-files",se=8,We=10,D=[];function A(){if(!ve())return null;let e=p();return ze(e)?e:null}function ze(e){return Boolean(e.getRecentProjects&&e.saveRecentProjects)}function _e(){try{let e=localStorage.getItem(Y);if(!e)return[];let t=JSON.parse(e);return Array.isArray(t)?t:[]}catch{return[]}}function Q(){return A()?D:_e()}function de(e){D=e;let t=A();if(t)t.saveRecentProjects(e);else try{localStorage.setItem(Y,JSON.stringify(e))}catch{}}async function WD(){let e=A();if(!e)return;try{D=await e.getRecentProjects()}catch{D=[]}}function jw(){return Q().toSorted((e,t)=>t.timestamp-e.timestamp)}function Hw(e,t){let o=Q().filter((r)=>r.root!==t);if(o.unshift({name:e,root:t,timestamp:ao()}),o.length>se)o.length=se;de(o)}function M0(e){de(Q().filter((t)=>t.root!==e))}function zD(){D=[];let e=A();if(e)e.saveRecentProjects([]);else localStorage.removeItem(Y)}function pe(){try{let e=localStorage.getItem(le);if(!e)return[];let t=JSON.parse(e);return Array.isArray(t)?t:[]}catch{return[]}}function UD(e){let t=pe().toSorted((o,r)=>r.timestamp-o.timestamp);return e==null?t:t.filter((o)=>o.root===e)}function Db(e){let t=pe().filter((a)=>!(a.root===e.root&&a.path===e.path));t.unshift({name:e.name,path:e.path,root:e.root,timestamp:ao()});let o=new Map,r=[];for(let a of t.toSorted((i,s)=>s.timestamp-i.timestamp)){let i=(o.get(a.root)??0)+1;if(o.set(a.root,i),i<=We)r.push(a)}localStorage.setItem(le,JSON.stringify(r))}var ue={$schema:"https://jxsuite.com/schema/v1",$id:"StudioFilesPanel",$description:'The Navigator\'s Files tree, as a Jx document over the kit. `files/files.ts` keeps every decision — which directories are listed, which entries `.gitignore` masks, which rows the window draws, what a click on a row means, what the context menu offers and what each verb does to the filesystem — and hands this document one projection: a word saying which of three things to draw, a toolbar whose state is already resolved, and rows whose every field is already a string. Nothing here asks what a file is, how tall the Navigator is, or whether a directory has been read. THE TREE IS `jx-tree`, and that is what this document no longer says: `role="tree"`, `role="treeitem"`, `aria-level`, `aria-posinset`, `aria-setsize`, the roving `tabindex` and the five arrow-key cases were each written out here and written out again in `panel-outline.json`, two copies of one keyboard contract with nothing holding them in agreement. The element owns all of it; what is left here is what this tree IS — a flat projection of rows, each already carrying its own level and set counts, because the DOM holds a WINDOW onto the model and an expanded `node_modules` is eleven rows rather than ten thousand. The window reaches the element as `padtop`/`padbottom`, and a caret move past either comes back as `move` for the flow to scroll and repaint. Four facts a row carries are bound against ONE scope field each — the current path, the selected path, the dragged path and the drop target — so moving the caret or dragging a file re-evaluates an attribute per drawn row instead of rebuilding the list under the reader\'s pointer. The pragmatic-drag-and-drop handles are an ISLAND: the document draws the rows and the tree, and the adapter attaches sources and targets to them through `onNodeCreated` (specs/studio-ui-guidelines.md §9.4).',tagName:"div",attributes:{part:"files"},style:{$description:"What the twenty `.file-tree*`, `.files-toolbar`, `.project-header` and `.project-name` rules in `styles/panels.css` said, keyed on `part` and re-pointed at the studio token layer. Three names could not come with the declarations. The five `var(--spectrum-font-size-50 | -75, …)` reads are the kit's `--jx-text-sm` and `--jx-text-md`, which are the same 11px and 12px — a `--spectrum-*` name is declared by `<sp-theme>` and by nothing else in this package, so a document that reads one is a document whose type size changes when a component it does not use is removed. The `.selected`, `.dragging`, `.drag-over` and `.drag-over-root` classes are `data-` attributes on a part, because a part is the handle now and because a state a handler adds and forgets to take off is exactly the defect a cancelled drag used to leave on screen. MOST OF THE ROW'S OWN RULES ARE GONE, and that is the point of the element rather than an omission: `jx-tree-item` declares the flex line, the one-control-height box the window reserves scroll by, the indent (`--jx-tree-indent` times one less than `level` — exactly the `8 + depth * 16` this file composed per row), the hover and focus states, the selected wash and the faded dragged row. What is left here is what is TRUE OF THIS TREE and not of trees in general: it owns its own scrollbar, a click on a row opens it, and the row a drag is over wears the drop mark this file draws.",display:"flex",flexDirection:"column",height:"100%",minHeight:"0",overflow:"hidden",fontFamily:"var(--jx-font-sans)",fontSize:"var(--jx-text-md)",color:"var(--fg)",'& [part="empty"]':{$description:"The two states that are not a tree. They are two states and not one sentence: a window with no project at all and a monorepo root that has not been pointed at a site are different situations, and only the second has anything to offer (studio-ui-guidelines.md §11).",padding:"var(--jx-space-6)",textAlign:"center",color:"var(--fg-dim)",fontSize:"var(--jx-text-md)",display:"flex",flexDirection:"column",alignItems:"center",gap:"var(--jx-space-4)"},'& [part="empty"] p':{margin:"0"},'& [part="frame"]':{display:"flex",flexDirection:"column",height:"100%",minHeight:"0"},'& [part="project-header"]':{display:"flex",alignItems:"center",gap:"var(--jx-space-3)",padding:"var(--jx-space-3) var(--jx-space-4)",borderBottom:"1px solid var(--border)",flexShrink:"0"},'& [part="project-name"]':{fontSize:"var(--jx-text-md)",fontWeight:"600",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},'& [part="toolbar"]':{display:"flex",gap:"var(--jx-space-2)",padding:"var(--jx-space-2) var(--jx-space-3)",borderBottom:"1px solid var(--border)",alignItems:"center",flexShrink:"0"},'& [part="search"]':{flex:"1",minWidth:"0"},'& [part="tree"]':{$description:"The scroller as well as the list. `ui/virtual-window.ts` walks up from the element it is given looking for the nearest thing that scrolls, and finding itself is the shortest answer — which is why the element declares no `overflow` of its own and leaves the question to the two trees that answer it differently. The colour is re-declared because `jx-tree` sets `--jx-fg` on itself, and this panel's text colour is the studio alias of it.",flex:"1",minHeight:"0",overflowY:"auto",color:"var(--fg)"},'& [part="tree"][data-drop="true"]':{background:"var(--hover-bg)"},'& [part="row"]':{$description:"What the element does not decide. A click on a row OPENS it here — a directory unfolds, a file takes a tab — so the pointer is a pointer rather than the element's default arrow; and the gap is the wider one this tree has always drawn between a 16px file glyph and its name.",gap:"var(--jx-space-3)",cursor:"pointer"},'& [part="loading-row"]':{$description:"A directory whose listing has not arrived yet. It holds the place and it is NOT a row: it is not a `jx-tree-item`, so the caret cannot land on it, the set counts do not include it and typeahead cannot match it — and it is replaced by the real rows on the repaint the listing provokes. It draws the same box by hand because it is the only line in this tree the element does not draw, and a placeholder of a different height would desynchronise the window's scroll reservation from the rows it reserves for.",display:"flex",alignItems:"center",boxSizing:"border-box",blockSize:"var(--jx-control-h)",paddingInline:"calc(var(--jx-space-3) + var(--depth, 0) * 16px) var(--jx-space-3)",color:"var(--fg-dim)",fontStyle:"italic",cursor:"default",userSelect:"none",whiteSpace:"nowrap"},'& [part="row-icon"]':{flexShrink:"0",display:"flex",alignItems:"center","--jx-icon-size":"16px"},'& [part="locale"]':{$description:"The language chip. Deliberately declares no block size, no padding and no line height: the row above is one control-height by contract, and a chip that grew the box would desynchronise the window's scroll reservation from the height it reserves by. It only ever shrinks the text. A chip, not a filter term: the search matches the file's name alone, because a query that silently also matched a language would make “why is this file here” unanswerable from what is on screen.",marginInlineStart:"auto",flexShrink:"0",fontSize:"var(--jx-text-sm)",color:"var(--fg-dim)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",maxInlineSize:"6em"},'& [part="view-slot"], & [part="header-slot"], & [part="locale-slot"]':{$description:"A `$switch` renders its own container, and none of these three is a box: each stands exactly where its case does, so the case's own rule is the only one that lays anything out.",display:"contents"}},children:[{tagName:"div",attributes:{part:"view-slot",role:"none"},$switch:{$ref:"#/state/view"},cases:{none:{tagName:"div",attributes:{part:"empty"},children:[{tagName:"p",textContent:"No project loaded"}]},address:{tagName:"div",attributes:{part:"empty"},children:[{tagName:"p",textContent:"Add ?project= and a project folder's absolute path to this page's address to open it."}]},welcome:{tagName:"div",attributes:{part:"empty"},children:[{tagName:"p",textContent:"Open a project folder to get started."},{tagName:"jx-button",attributes:{part:"open-project"},$props:{variant:"accent",size:"sm"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/openProject"},value:[]}],description:"The declared `project.open` command, run through the registry — not a second opener of this surface's own. It is the one the chord, the palette and the status bar's PROJECT field already run, so a window that opens a project from here reports the outcome the same way they do (studio-ui-guidelines.md §12.5)."},children:[{tagName:"span",textContent:"Open Project"}]}]},tree:{tagName:"div",attributes:{part:"frame"},children:[{tagName:"div",attributes:{part:"header-slot",role:"none"},$switch:{$ref:"#/state/headerState"},cases:{shown:{tagName:"div",attributes:{part:"project-header"},children:[{tagName:"span",attributes:{part:"project-name",title:"${state.projectName}"},textContent:"${state.projectName}"}]}}},{tagName:"div",attributes:{part:"toolbar"},children:[{$description:"A row of quiet tools, so NOT compact. A compact group draws every member's frame and fill whatever its quiet says, which is the segmented look a choice wants and not the borderless one a toolbar wants; Spectrum's group here was `compact quiet`, a combination the kit spells as compact=false with its members' default quiet.",tagName:"jx-action-group",attributes:{part:"toolbar-actions"},$props:{compact:!1,label:"File tree actions"},children:[{tagName:"jx-action-button",attributes:{part:"new-file"},$props:{size:"sm",icon:"plus",label:"New File",hint:"New File"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/newFile"},value:[]}]}},{tagName:"jx-action-button",attributes:{part:"refresh"},$props:{size:"sm",icon:"arrows-clockwise",label:"Refresh",hint:"Refresh"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/refresh"},value:[]}],description:"The rules go with the listings. Refresh is what an author reaches for after editing a `.gitignore` by hand, and a tree that came back still hiding by the old rules would read as the button not having worked."}},{tagName:"jx-action-button",attributes:{part:"show-ignored"},$props:{size:"sm",icon:{$ref:"#/state/ignoredIcon"},label:{$ref:"#/state/ignoredLabel"},hint:{$ref:"#/state/ignoredLabel"},selected:{$ref:"#/state/ignoredSelected"}},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/toggleIgnored"},value:[]}],description:"A repaint and nothing else: the ignored entries were never dropped from the cached listings, only from the rows built out of them."}}]},{tagName:"jx-textfield",attributes:{part:"search"},$props:{label:"Filter files",placeholder:"Filter files…",size:"sm",value:{$ref:"#/state/query"}},oninput:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/search"},value:[{$ref:"event#/target/value"}]}],description:"The query matches a file's NAME and nothing else. A directory is kept whatever it says, because hiding the folder a match sits in would leave the match with nowhere to be drawn."}}]},{$description:'The `role="tree"`, and everything that used to be spelled out under it. The element writes the role, the name, the roving tab stop and every row\'s `aria-level` / `aria-posinset` / `aria-setsize`, and it owns the whole ARIA keyboard: the arrows walk the drawn rows without wrapping, `Home` and `End` reach the ends of the MODEL by way of the pads, `ArrowRight` opens a directory and steps into an open one, `ArrowLeft` closes one and otherwise steps out to its parent, `Enter` activates and a printable character is typeahead. Every chord it does not own — cut, copy, paste, delete, rename — passes straight through to the flow, which is the WCAG 2.5.7 obligation this tree carries because dragging a file is the other way to move it. What reaches this document is five events, and each of them is a decision `files.ts` already owned.',tagName:"jx-tree",attributes:{part:"tree",label:"Project files",current:"${state.currentPath}",padtop:"${state.padTop}",padbottom:"${state.padBottom}","data-drop":"${state.rootDrop || null}"},onselect:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/select"},value:[{$ref:"event#/detail/value"}]}],description:"The reader meant that row. This tree is single-select, so the element resolves every modifier to `replace` before it gets here and the detail's `mode` and `anchor` are answers to a question this tree does not ask. There is no `change` handler beside it on purpose: the element OWNS the caret and keeps it across every repaint that does not change `current`, so a second copy of it in the flow would be a variable that only ever went stale."},onactivate:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/activate"},value:[{$ref:"event#/detail"}]}],description:"`Enter` or a double click. The same verb a single click reaches, by the same name."},onexpand:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/expand"},value:[{$ref:"event#/detail/value"},{$ref:"event#/detail/expanded"}]}],description:"`ArrowRight`, `ArrowLeft` or the twisty, with ONE dispatcher between them: the detail says the state the row should be PUT INTO, so the flow never has to work out which way a toggle was going."},onmove:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/move"},value:[{$ref:"event#/detail/from"},{$ref:"event#/detail/key"}]}],description:"The caret has to reach a row the window did not draw. The element knows only that the pad on that side is not zero; where the row is in the model, and how far to scroll to bring it into view, is the flow's — which is why this is an event and not a `scrollIntoView`."},ontypeahead:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/typeahead"},value:[{$ref:"event#/detail/from"},{$ref:"event#/detail/char"}]}],description:"A printable character, on a windowed tree. The same hand-off as `onmove` and for a sharper reason: a move off the end of the slice announces itself, and a letter never does — the element's own search over the drawn rows always answers, and over a `node_modules` of ten thousand entries the answer is whichever of the eleven painted rows happened to start with that letter. So the element dispatches EVERY such character and the flow answers it over the model."},children:[{$prototype:"Array",items:{$ref:"#/state/rows"},key:{$ref:"$map/item/key"},map:{tagName:"div",attributes:{part:"row-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"$map/item/kind"},cases:{item:{tagName:"jx-tree-item",attributes:{part:"row",value:"${$map.item.path}",label:"${$map.item.name}",level:"${$map.item.level}",posinset:"${$map.item.posInSet}",setsize:"${$map.item.setSize}",expanded:"${$map.item.ariaExpanded}",selected:"${state.selectedPath === $map.item.path ? 'true' : 'false'}","data-type":"${$map.item.type}","data-dragging":"${state.dragPath === $map.item.path ? '' : null}","data-drop":"${state.dropPath === $map.item.path ? '' : null}"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/activate"},value:[{$ref:"$map/item/path"}]}],description:"A single click OPENS the row, which is this tree's own answer and not the element's. `jx-tree` answers a click with `change` and `select`, exactly as it answers an arrow key, and a tree that opened on `select` would open every file the reader arrowed past. So the opening verb is bound here, where a click is a click; what a click MEANS — unfold this directory, take a tab for that file — stays the flow's, and Enter reaches the same verb through `activate`. It does NOT stop the event, which is the correction: the tree's delegated click is what moves the caret and the selection onto the row, so a `stopPropagation` here would leave a reader who clicked a folder with the tab stop still on whatever they had open last. The twisty stops its own click, so opening a directory from the chevron does not also activate the row."},oncontextmenu:{$prototype:"Function",body:[{preventDefault:!0},{stopPropagation:!0},{operator:"call",target:{$ref:"#/state/contextMenu"},value:[{$ref:"$map/item/path"},{$ref:"event#/clientX"},{$ref:"event#/clientY"}]}]},children:[{tagName:"jx-icon",attributes:{slot:"icon",part:"row-icon","aria-hidden":"true"},$props:{name:{$ref:"$map/item/icon"}}},{tagName:"div",attributes:{slot:"status",part:"locale-slot",role:"none"},$switch:{$ref:"$map/item/localeState"},cases:{shown:{tagName:"span",attributes:{part:"locale"},textContent:"${$map.item.locale}"}}}]},loading:{$description:"A directory whose listing has not arrived yet. Deliberately not a `jx-tree-item`: there is no file there to select, open, rename or drag, and a row the caret could land on that answers to none of the verbs the caret offers is a stop in the walk with nothing behind it.",tagName:"div",attributes:{part:"loading-row",role:"none","data-loading":"true",style:"--depth:${$map.item.depth}"},textContent:"Loading…"}}}}]}]}}}]};E("files-panel",ue);function fe(e,t){e.view=t.view,e.headerState=t.headerState,e.projectName=t.projectName,e.query=t.query,e.ignoredLabel=t.ignoredLabel,e.ignoredIcon=t.ignoredIcon,e.ignoredSelected=t.ignoredSelected,e.padTop=t.padTop,e.padBottom=t.padBottom,e.rows=t.rows,e.selectedPath=t.selectedPath,e.dragPath=t.dragPath,e.dropPath=t.dropPath,e.rootDrop=t.rootDrop,e.currentPath=t.currentPath}function H(){return{currentPath:"",dragPath:"",dropPath:"",headerState:"hidden",ignoredIcon:"eye-slash",ignoredLabel:"Show ignored files",ignoredSelected:!1,padBottom:0,padTop:0,projectName:"",query:"",rootDrop:"",rows:[],selectedPath:"",view:"none"}}function Je(e){let t=n(e)?void 0:e.attributes?.part;return n(t)?t:""}function qe(e){let t=e?.$map,o=S(t)&&"item"in t?t.item:void 0;if(!S(o)||!("path"in o)||!n(o.path)||!("type"in o)||!n(o.type))return null;return{path:o.path,type:o.type}}function me(e,t,o){let r=b({...H(),...o});fe(r,t);let a=null,i=!1,s=I("files-panel",r,e,{onNodeCreated:(l,c,d,u)=>{if(i||!(l instanceof HTMLElement))return;let P=Je(d);if(P==="tree"){o.treeHost(l);return}if(P!=="row")return;let v=qe(u);if(v)o.rowHost(l,v.path,v.type)}}).then((l)=>{if(i){l.dispose();return}a=l});return{connected:()=>!i&&(a===null||a.root.parentNode===e),dispose(){i=!0,a?.dispose(),a=null},ready:s,update:(l)=>{fe(r,l)}}}async function ol(e){if(!x)return;try{let t=p(),[o]=await Promise.all([Rs(()=>t.listDirectory(e)),GA(e)]);x.dirs.set(e,o)}catch{x.dirs.set(e,[])}}var he=new Set(["pages","layouts","components","content","data","public","styles"]);async function Tm(){if(!x)return;await ol(".");let e=[];for(let t of x.dirs.get(".")??[])if(t.type==="directory"&&he.has(t.name))e.push(t.name),x.expanded.add(t.path||t.name),await ol(t.path||t.name);x.projectDirs=e}async function MT(e){let t=new Set(x?.projectDirs);if(!e.some((r)=>{let a=r.replaceAll("\\","/").replace(/^\.\//,"").split("/")[0]??"";return r.includes("/")&&he.has(a)&&!t.has(a)}))return!1;return await Tm(),!0}function FT(){return Er(ot.showIgnoredFiles)==="true"}function rF(e){_o(ot.showIgnoredFiles,e?"true":"")}async function jT(){try{let e=p(),t=await e.probeRootProject();if(!t)return;let{meta:o,info:r}=t;if($h(),jt(),lc(e),Wp(),Gm(),id({dirs:new Map,expanded:new Set,isSiteProject:r.isSiteProject,name:r.isSiteProject?r.projectConfig?.name||o.name:o.name,projectConfig:(r.isSiteProject?r.projectConfig:null)||null,projectDirs:r.directories||[],projectRoot:".",root:o.root,searchQuery:"",selectedPath:null}),r.isSiteProject)ac(o.root||".",r.projectConfig||null);if(r.isSiteProject){if(Hw(_n().name,o.root),await Om(),await Nb())$h(),await jt(),lc(e);await Tm(),await $a(),await Ob(),Dm(o.root)}}catch{}}async function HT({renderLeftPanel:e,resetProjectCaches:t}){try{let o=p(),r=await o.openProject?.();if(!r)return!1;let{config:a,handle:i}=r;if(DR({document:{children:[],tagName:"div"},id:"initial"}),rO(),$h(),jt(),lc(o),Wp(),Gm(),id({...x,dirs:new Map,expanded:new Set,isSiteProject:!0,name:a.name||i.name,projectConfig:a,projectRoot:i.root,searchQuery:"",selectedPath:null}),ac(i.root,a),await Om(),await Nb())$h(),await jt(),lc(o);return await Tm(),await $a(),Bb(),Fx(),t?.(),Hw(_n().name,_n().projectRoot),e(),await Ob(),Dm(_n().projectRoot),!0}catch(o){return w.error("Could not open the project.",{detail:X(o),source:"Open Project"}),!1}}async function BT(e){let t=p();if(t.createDestination!=="path")return!1;try{if(await t.activate(e),(await t.gitStatus()).isRepo)return!1;return await t.gitInit(),w.success("Initialized a git repository for this project."),!0}catch(o){return w.warn("Could not initialize a git repository — the project itself was written.",{detail:X(o),source:"Source Control"}),!1}}async function F0(){await jt();let e=[..._l("page"),".json"],t;try{t=await p().listDirectory("pages")}catch{return null}let o=new Set(t.filter((r)=>r.type==="file").map((r)=>r.name));for(let r of e)if(o.has(`index${r}`))return`pages/index${r}`;return null}async function oF(){let e=await F0();if(e)await _i(e)}async function Ob(){let e=RA(g.projectRoot),t=XL(g.projectRoot),o=await Be(e);return ge?.(t),o}var ge=null;function VT(e){ge=e}async function Be(e){if(Mx(g.projectRoot),e){if(await kA(e,{ensureSecondPane:()=>{sc(fi)},openFile:(o,r)=>_i(o,{focus:!1,paneId:r})})>0)return!0}return await oF(),!1}function Ue(e,t,o){if(t==="directory")return o?"folder-open":"folder";let r=e.split(".").pop()?.toLowerCase();switch(r){case"css":case"js":case"json":case"ts":return"file-code";case"md":return"file-text";default:return r!==void 0&&wf(r)?"image":"file"}}var sF=24,f=[],T=null,R=new Map,_=null,we=null;function oe(){for(let e of R.values())if(e.isConnected&&e.offsetHeight>0)return e.offsetHeight;return sF}function Ge(){for(let[e,t]of R)if(!t.isConnected)R.delete(e),Re(t)}function ye(e){let t=R.get(e);return t?.isConnected===!0?t:null}function B(e){return f.find((t)=>!t.loading&&t.path===e)}function be(e,t,o,r){let a=_n().dirs.get(e);if(!a){ol(e).then(()=>m()),o.push({depth:t,expanded:!1,key:`loading:${e}`,loading:!0,name:"Loading…",path:e,posInSet:1,setSize:1,type:"file"});return}let i=[...a].toSorted((d,u)=>{if(d.type==="directory"&&u.type!=="directory")return-1;if(d.type!=="directory"&&u.type==="directory")return 1;return d.name.localeCompare(u.name)}),s=FT()?i:i.filter((d)=>!JA(e,d.path,d.type==="directory")),l=_n().searchQuery.toLowerCase(),c=l?s.filter((d)=>d.type==="directory"||d.name.toLowerCase().includes(l)):s;for(let[d,u]of c.entries()){let v=u.type==="directory"&&_n().expanded.has(u.path);if(o.push({depth:t,expanded:v,key:u.path,loading:!1,name:u.name,path:u.path,locale:gr(u.path,r)??void 0,posInSet:d+1,setSize:c.length,type:u.type}),v)be(u.path,t+1,o,r)}}function xe(e){return e===void 0?-1:f.findIndex((t)=>!t.loading&&t.path===e)}function W(e,t){for(let o=e+t;o>=0&&o<f.length;o+=t)if(!f[o].loading)return o;return-1}function Ke(e){let t=f[e];if(!t)return-1;for(let o=e-1;o>=0;o--){let r=f[o];if(!r.loading&&r.depth<t.depth)return o}return-1}function Ye(){if(T?.isConnected!==!0||k!=="")return;queueMicrotask(m)}function ee(){let e=T;if(e===null)return;_=qw(_,e,{count:()=>f.length,onChange:Ye,rowHeight:oe})}function Qe(e){let t=String(e.depth+1);if(e.loading)return{ariaExpanded:"",depth:String(e.depth),icon:"",key:e.key,kind:"loading",level:t,locale:"",localeState:"hidden",name:e.name,path:e.path,posInSet:"",setSize:"",type:e.type};return{ariaExpanded:e.type==="directory"?String(e.expanded):"",depth:String(e.depth),icon:Ue(e.path,e.type,e.expanded),key:e.key,kind:"item",level:t,locale:e.locale===void 0?"":Wt(e.locale),localeState:e.locale===void 0?"hidden":"shown",name:e.name,path:e.path,posInSet:String(e.posInSet),setSize:String(e.setSize),type:e.type}}function Xe(){if(Ge(),!x){f=[];let l={...H(),view:"none"};return y=l,l}if(!x.isSiteProject&&x.projectRoot==="."){f=[];let l=cf(p())?"welcome":"address",c={...H(),view:l};return y=c,c}let e=_n();f=[];let{i18n:t}=ln(e.projectConfig??{});be(".",0,f,t);let o=zw(T,{count:f.length,rowHeight:oe()}),r=f.slice(o.start,o.end),a=(e.selectedPath!==null&&B(e.selectedPath)?e.selectedPath:"")||r.find((l)=>!l.loading)?.path||"",i=FT(),s={currentPath:a,dragPath:k,dropPath:O,headerState:e.isSiteProject?"shown":"hidden",ignoredIcon:i?"eye":"eye-slash",ignoredLabel:i?"Hide ignored files":"Show ignored files",ignoredSelected:i,padBottom:o.padBottom,padTop:o.padTop,projectName:e.projectConfig?.name||e.name,query:e.searchQuery,rootDrop:U,rows:r.map((l)=>Qe(l)),selectedPath:e.selectedPath??"",view:"tree"};return y=s,s}function te(){if(!h||!y)return;y={...y,dragPath:k,dropPath:O,rootDrop:U},h.handle.update(y)}function m(){we?.()}async function Ze(){let e=_n();e.dirs.clear(),Wp(),await ol(".");for(let t of e.expanded)await ol(t);m()}function et(e){let t=B(e);if(!t)return;if(t.type==="directory"){je(e).then(()=>m());return}_i(e)}function tt(e,t){let o=_n();if(B(e)?.type!=="directory"||o.expanded.has(e)===t)return;if(!t){o.expanded.delete(e),m();return}je(e).then(()=>m())}function Pe(e){if(!x||_n().selectedPath===e)return;_n().selectedPath=e,m()}function rt(e,t){let o=xe(e),r;switch(t){case"Home":{r=W(-1,1);break}case"End":{r=W(f.length,-1);break}case"ArrowUp":{r=W(o,-1);break}case"ArrowLeft":{r=Ke(o);break}case"ArrowDown":case"ArrowRight":{r=W(o,1);break}default:return}Fe(r)}function at(e,t){let o=xe(e),r=f.length;for(let a=1;a<=r;a++){let i=(o+a+r)%r,s=f[i];if(s&&!s.loading&&s.name.trim().toLowerCase().startsWith(t)){Fe(i);return}}}function Fe(e){let t=f[e];if(!t)return;if(Pe(t.path),ye(t.path))return;Uw(T,e,oe()),m()}async function je(e){let t=_n();if(t.expanded.has(e)){t.expanded.delete(e);return}if(t.expanded.add(e),!t.dirs.has(e))await ol(e)}var C=new Map,V=null,k="",J="",O="",q=!1,U="";function aF(e){return[...e.dataTransfer?.types??[]].includes("Files")}function Se(e,t,o){let r=(s)=>{if(!aF(s))return;if(s.preventDefault(),s.stopPropagation(),s.dataTransfer)s.dataTransfer.dropEffect="copy";o(!0)},a=()=>o(!1),i=(s)=>{o(!1);let l=s.dataTransfer?.files;if(!l?.length)return;s.preventDefault(),s.stopPropagation(),qD(l,t,m)};return e.addEventListener("dragover",r),e.addEventListener("dragleave",a),e.addEventListener("drop",i),()=>{e.removeEventListener("dragover",r),e.removeEventListener("dragleave",a),e.removeEventListener("drop",i)}}function WT(e,t){let o=e.replaceAll("\\","/"),r=t.replaceAll("\\","/");if(!o||o===r)return!1;if(o.startsWith(`${r}/`)||r.startsWith(`${o}/`))return!1;return ne(o)!==r}function Z(e,t,o){let r=e.data.path;return o==="directory"&&n(r)&&WT(r,t)}function j(e,t){let o=t?e:"";if(J===e&&O===o)return;J=e,O=o,$e()}function z(e){if(q===e)return;q=e,$e()}function $e(){U=q&&J===""?"true":"",te()}async function qD(e,t,o){if((await Qs([...e],{dir:t})).length===0)return;if(t!==".")_n().expanded.add(t);o()}function lF(e,t){let o=document.createElement("input");o.type="file",o.multiple=!0,o.accept=Jc(),o.addEventListener("change",()=>{if(o.files?.length)qD(o.files,e,t)}),o.click()}function it(e,t,o){Re(e),R.set(t,e);let r=[Uo({element:e,getInitialData(){return{entryType:o,path:t,type:"file-tree"}},onDragStart(){k=t,te()},onDrop(){k="",j("",!1),te()}}),Se(e,o==="directory"?t:ne(t),(a)=>{j(a?t:"",a)}),Zs({canDrop({source:a}){return a.data.type==="file-tree"},element:e,getData({source:a}){return Z(a,t,o)?{targetDir:t,type:"file-tree-target"}:{type:"file-tree-refused"}},onDrag({source:a}){j(t,Z(a,t,o))},onDragEnter({source:a}){j(t,Z(a,t,o))},onDragLeave(){j("",!1)},onDrop(){j("",!1)}})];C.set(e,zo(...r))}function Re(e){let t=C.get(e);if(t)t(),C.delete(e)}function st(e){if(V?.element===e)return;ke(),T=e;let t=Zs({canDrop({source:r}){let a=r.data.path;return r.data.type==="file-tree"&&n(a)&&WT(a,".")},element:e,getData(){return{targetDir:".",type:"file-tree-target"}},onDragEnter(){z(!0)},onDragLeave(){z(!1)},onDrop(){z(!1)}}),o=Xs({onDrop({source:r,location:a}){let[i]=a.current.dropTargets;if(!i)return;if(r.data.type!=="file-tree")return;if(i.data.type!=="file-tree-target")return;let s=r.data.path,l=i.data.targetDir;if(!n(s)||!n(l)||!WT(s,l))return;let c=s.split("/").pop(),d=l==="."?c:`${l}/${c}`;lt(s,d,m)}});V={cleanup:zo(t,o,Se(e,".",z)),element:e},ee()}function ke(){V?.cleanup(),V=null;for(let e of C.values())e();C.clear(),_?.window.destroy(),_=null,T=null,k="",J="",O="",q=!1,U=""}async function lt(e,t,o){let r=t.split("/").pop()??t,a=ne(t),i={path:e,source:"Files"},s;try{s=await p().listDirectory(a)}catch(d){w.error(`Could not move ${e}.`,{...i,detail:`The folder could not be read to check for ${r}: ${X(d)}`});return}let l=r.toLowerCase(),c=s.find((d)=>d.name.toLowerCase()===l);if(c!==void 0){let d=a==="."?"The project root":`${a}/`;w.error(`Could not move ${e}.`,{...i,detail:`${d} already has ${c.name}, and a move would replace it.`});return}try{let d=await Ww(e,t);if(a!==".")_n().expanded.add(a);o(),Vw(`Moved to ${t}`,d,t)}catch(d){w.error(`Could not move ${e}.`,{...i,detail:X(d)})}}function ne(e){let t=e.replaceAll("\\","/"),o=t.lastIndexOf("/");return o===-1?".":t.slice(0,o)}var N=null;function Ee(){N?.close(),N=null}function ct(e){let t={};if(e.type==="directory"){let o=Gd(e.path);if(o?.isSourceRoot===!0&&!o.fileBacked)t.name=o.name;return t}if(t.file=e.path,sl(e.path))t.path=e.path;if(P0(e.path).length>0)t.source=e.path;return t}function F(e,t,o,r={}){return{destructive:!1,disabled:!1,dividerAbove:!1,id:e,run:o,title:t,...r}}function dt(e){let t=ae();if(!t)return[];let o=ct(e),r=[];for(let a of t.forPlacement("context/file")){let i=a.args;if(!(i?.required??[]).every((c)=>(c in o)))continue;let s={};for(let c of Object.keys(i?.properties??{}))if(c in o)s[c]=o[c];let l=t.disabledReason(a.id);r.push(l===void 0?F(a.id,a.title,()=>{Tn(t,a.id,s,"Files")}):{destructive:!1,disabled:!0,dividerAbove:!1,id:a.id,requires:l,title:a.title})}return r}function pt(e){let t=e.type==="directory",o=[];if(t){if(o.push(F("files.newFile","New File…",()=>{Te(e.path,m)}),F("files.upload","Upload Files…",()=>{lF(e.path,m)})),e.path==="pages"||e.path.endsWith("/pages"))o.push(F("files.pagesGrid","Edit Pages in Grid",()=>{q0()}))}else o.push(F("files.open","Open",()=>{_i(e.path)}));return o.push(...dt(e),F("files.rename","Rename…",()=>{yt(e,m)},{dividerAbove:!0}),F("files.delete","Delete",()=>{bt(e,m)},{destructive:!0})),o}function ut(e,t,o){let r=B(e);if(!r)return;Ee();let a=ye(e);N=Vt({label:"File actions",onClosed:(i)=>{if(N===i)N=null},opener:a,origin:{x:t,y:o},region:"files",rows:pt({name:r.name,path:r.path,type:r.type})})}var mt=JSON.stringify({children:[{children:[],tagName:"p"}],tagName:"div"},null,2);function ht(e){return[...(e.kind==="locked"?[{ext:e.ext,label:`${Pa(e.ext)?.name??e.ext} (${e.ext})`}]:A0(e.docKind)).map((o)=>({label:o.label,value:o.ext})),{dividerBefore:!0,label:"Other…",value:n1}]}function gt(e,t,o){let r=e.kind==="choose"?e.defaultExt:e.ext;if(r!==void 0&&t.some((i)=>i.value===r))return r;let a=nR(o);if(a!==""&&t.some((i)=>i.value===a))return a;return t[0]?.value??n1}async function cF(e){let{dir:t,format:o,source:r="Files"}=e;await jt();let a=await Bw(t),i=o!==void 0&&o.kind!=="fixed"?o:null,s=i===null?null:ht(i),l=i===null||s===null?"":gt(i,s,e.suggestedName??""),c={choice:o,dir:t,known:ie(),rows:s,taken:a},d=(G,Oe)=>ly(G,Oe,c),u=l,P={confirmLabel:"Create",message:t==="."?"Creating in the project root.":`Creating in ${t}/`,select:s===null?"stem":"all",validate:d,value:e.suggestedName??"untitled.json"};if(s!==null)P.choice={initial:l,label:"Format",onChange:(G)=>{u=G},options:()=>s};if(e.suggestedName!==void 0)P.placeholder=e.suggestedName;let v=await Fn(e.title??"New File",P);if(!v)return null;let L=iR(v,u,o),De=t==="."?L:`${t}/${L}`,re=fn(L),Ne=e.content,Ce=o!==void 0&&u!==n1,Ie=Ne??re?.studio?.newFileTemplate??(re?"":L.toLowerCase().endsWith(".json")?Ce?mt:`{}
2
- `:"");return j0(De,Ie,{dir:t,source:r})}async function Bw(e){try{let t=await p().listDirectory(e);return new Set(t.map((o)=>o.name.toLowerCase()))}catch{return new Set}}async function j0(e,t,o={}){let r=o.dir??(e.includes("/")?e.slice(0,e.lastIndexOf("/")):".");Ls(e);try{if(await p().writeFile(e,t),await ol(r),o.quiet!==!0)w.success(`Created ${e}`);return e}catch(a){return w.error(`Could not create ${e}.`,{detail:X(a),path:e,source:o.source??"Files"}),null}}async function Te(e,t){await jt();let o=Gd(e);if(o?.unresolvedFormat!=null)w.error(`New files in ${e}/ cannot be constrained to the collection's format.`,{detail:`The "${o.name}" content type declares format "${o.unresolvedFormat}", which no installed extension provides. Install the extension that supplies it, or correct `+"the name in Project Settings › Content Types.",path:e,source:"Files"});let r=o?.ext!=null&&o.unresolvedFormat===null,a=r&&o.isSourceRoot&&o.def.schema!==void 0,i;if(a){let{createEntry:s}=await (ce("02j0s19w"),import("./entry-commands-02j0s19w.js"));i=await s(o.name,{dir:e})}else i=await cF({dir:e,format:r&&o.ext!==null?{because:`${o.name} entries are ${o.ext} files, so a document of another format here would not be one.`,ext:o.ext,kind:"locked"}:{defaultExt:".json",kind:"choose"},suggestedName:"untitled"});if(i!==null)t()}async function wt(e,t,o){let r=await Fb(t),a={confirmLabel:"Rename",select:"stem",validate:(i)=>qm(t,i,o),value:e};if(r!==void 0)a.message=r;return Fn("Rename",a)}function H0(e,t){let o=t.references,r=t.tag?`; tag → <${t.tag.to}> (${t.tag.refsUpdated})`:"";if(o&&o.refsUpdated>0)return`Renamed to ${e}; updated ${o.refsUpdated} reference(s) in ${o.filesChanged} file(s)${r}`;if(r)return`Renamed to ${e}${r}`;return`Renamed to ${e}`}function Vw(e,t,o){let r=t.errors??[];if(r.length===0){w.success(e);return}let a=r.length===1?"1 file":`${r.length} files`;w.warn(`${e} — references in ${a} could not be updated`,{detail:r.map((i)=>`${i.path}: ${i.error}`).join(`
3
- `),path:o,source:"Files"})}function vt(e,t){for(let o of e.references?.files??[])if(o.path!==t&&g.tabs.has(o.path))Lm(o.path)}function $m(e){let t=e.replaceAll("\\","/");return t.includes("/")?t.slice(0,t.lastIndexOf("/")):"."}async function dF(e,t,o){hs();let r=$m(e),a=$m(t);if(await ol(r),a!==r)await ol(a);let i=_n();if(i.selectedPath===e)i.selectedPath=t;else if(i.selectedPath?.startsWith(`${e}/`))i.selectedPath=t+i.selectedPath.slice(e.length);vt(o,t)}async function Ww(e,t){Ls(e,t);let o=await p().renameFile(e,t),r=[...g.tabs.keys()];for(let a of r)if(a===e||a.startsWith(`${e}/`)){let i=t+a.slice(e.length);OR(a,i,i)}return await dF(e,t,o),o}async function B0(e,t){try{let o=await p().listDirectory($m(e));return new Set(o.map((r)=>r.name))}catch(o){return w.error(`Could not rename ${e.split("/").pop()??e}.`,{detail:`The folder could not be read to check the new name: ${X(o)}`,path:e,source:t}),null}}async function yt(e,t){let o=$m(e.path),r=await B0(e.path,"Files");if(r===null)return;let a=await wt(e.name,e.path,r);if(!a||a===e.name)return;let i=o==="."?a:`${o}/${a}`;try{let s=await Ww(e.path,i);t(),Vw(H0(a,s),s,i)}catch(s){w.error(`Could not rename ${e.name}.`,{detail:X(s),path:e.path,source:"Files"})}}async function bt(e,t){if(!await Mb(e))return;try{let r=p();Ls(e.path),await r.deleteFile(e.path),hs();let a=e.path.replaceAll("\\","/"),i=a.includes("/")?a.slice(0,a.lastIndexOf("/")):".";if(await ol(i),_n().selectedPath===e.path)_n().selectedPath=null;t(),w.success(`Deleted ${e.name}`)}catch(r){w.error(`Could not delete ${e.name}.`,{detail:X(r),path:e.path,source:"Files"})}}function xt(e,t){let o=t.paneId,r=Oa(e);if(o!==void 0&&r){if(r.activeTabId===e&&t.focus===!1)return;Ry(e,o)}Ft(e,{focus:t.focus!==!1})}async function _i(e,t={}){let o=t.focus!==!1;for(let[a,i]of g.tabs.entries())if(i.documentPath===e){if(t.canvasMode!==void 0)i.session.ui.canvasMode=t.canvasMode;if(xt(a,t),o)_n().selectedPath=e;return}if(Vb(e)){if(Zu(e,t),o)_n().selectedPath=e;Db({name:e.split("/").pop()||e,path:e,root:_n().projectRoot});return}if(e.toLowerCase().endsWith(".csv")){try{if(await YT(e,t),o)_n().selectedPath=e;Db({name:e.split("/").pop()||e,path:e,root:_n().projectRoot})}catch(a){w.error(`Could not open ${e}.`,{detail:X(a),path:e,source:"Open File"})}return}let r=p();try{let a=await r.readFile(e);if(!a){if(await jt(),!fn(e)&&!e.toLowerCase().endsWith(".json"))throw lf(e);return}await jt();let i,s,l=null,c=fn(e);if(c){let u=await Bo(e,a);({document:i}=u),{frontmatter:s}=u}else if(e.endsWith(".json"))({document:i,layout:l}=Ts(a));else throw lf(e);if(Si({id:e,documentPath:e,document:i,...s!=null&&{frontmatter:s},layout:l,source:c?a:null,sourceFormat:c?.name??null,...t.paneId!==void 0&&{paneId:t.paneId},...t.preview===!0&&{preview:!0},...t.focus===!1&&{focus:!1},...t.canvasMode!==void 0&&{canvasMode:t.canvasMode}}),o)_n().selectedPath=e;Db({name:e.split("/").pop()||e,path:e,root:_n().projectRoot})}catch(a){w.error(`Could not open ${e}.`,{detail:X(a),path:e,source:"Open File"})}}async function V0(e,t){await _i(t,{focus:!1,paneId:e,preview:!0})}function zT(e){if(ky(e))return;sx(e);for(let[,t]of g.tabs.entries())if(t.documentPath===e&&!t.doc.dirty){Lm(e);return}}function UT(e){for(let t of e)Lm(t,{onlyIfChanged:!0})}async function Lm(e,t={}){for(let[,o]of g.tabs.entries())if(o.documentPath===e){let r=p(),a=o.doc.dirty,i=()=>!a&&o.doc.dirty||ky(e);try{let s=await r.readFile(e);if(!s)return;if(await jt(),i())return;if(fn(e)){let{document:l,frontmatter:c}=await Bo(e,s);if(i())return;if(t.onlyIfChanged&&Ks(l,o.doc.document)&&Ks(c,o.doc.content.frontmatter))return;o.doc.document=l,o.doc.content.frontmatter=c,o.doc.source=s}else if(e.endsWith(".json")){let l=Ts(s);o.doc.layout=l.layout;let c=l.document;if(o.doc.bareRepeaters=Ym(c),t.onlyIfChanged&&Ks(c,o.doc.document))return;o.doc.document=c}o.doc.dirty=!1}catch(s){w.error(`Could not reload ${e} after it changed on disk.`,{detail:X(s),key:`reload:${e}`,path:e,source:"Files"})}return}}function qT(){ei({id:"files",title:"Files",level:"project",dock:"navigator",icon:"folder",rail:"developer",render:()=>ft,afterRender:(e,t)=>{uF(t,e.rerender)}})}var Pt={activate:et,contextMenu:ut,expand:tt,move:rt,newFile:()=>{Te(".",m)},openProject:()=>{nt("project.open",void 0,"Files")},refresh:()=>{Ze()},rowHost:it,search:(e)=>{_n().searchQuery=e,m()},select:Pe,toggleIgnored:()=>{rF(!FT()),m()},treeHost:st,typeahead:at},h=null,y=null;function uF(e,t){let o=e.querySelector(".panel-content")??e;if(we=t,h&&(h.host!==o||!h.handle.connected()))hF();let r=Xe();if(h)h.handle.update(r);else{let a=me(o,r,Pt);h={handle:a,host:o},a.ready.then(ee)}queueMicrotask(ee)}function hF(){Ee(),h?.handle.dispose(),h=null,y=null,ke(),R.clear(),f=[]}
4
- export{Nb,A0,P0,VD,WD,jw,Hw,M0,zD,UD,Db,ol,Tm,MT,FT,rF,jT,HT,BT,F0,oF,Ob,VT,sF,aF,WT,qD,lF,cF,Bw,j0,H0,Vw,$m,dF,Ww,B0,_i,V0,zT,UT,Lm,qT,uF,hF};
5
-
6
- //# debugId=04271C1940481F1B64756E2164756E21
7
- //# sourceMappingURL=studio-ze1sm147.js.map
@@ -1,5 +0,0 @@
1
- import{n,J,qe,Q,S,m,Oe,Rr,Jn,_f,it}from"./studio-erjccagy.js";var Dy=400;var tf=350,x1=300,KP=30000;function oo(e){return Array.isArray(e?.children)?e.children:[]}function Oy(e,t,i=""){if(!S(e))return e;if(Array.isArray(e)){for(let[l,s]of e.entries())Oy(s,t,`${i}/${l}`);return e}let r=e,{children:o}=r;if(Rr(o)){let l=o;t?.(i,l),r.children=[l]}if(Array.isArray(r.children))for(let[l,s]of r.children.entries())Oy(s,t,`${i}/children/${l}`);if(r.$prototype==="Array"&&S(r.map))Oy(r.map,t,`${i}/map`);if(S(r.cases))for(let[l,s]of Object.entries(r.cases))Oy(s,t,`${i}/cases/${FR(l)}`);return e}function FR(e){return String(e).replaceAll("~","~0").replaceAll("/","~1")}function zt(e){return e.length>=2?e.slice(0,-2):null}function Vi(e){return e.at(-1)}function jR(e){return e.join("/")}function ko(e,t){if(e===t)return!0;if(!e||!t||e.length!==t.length)return!1;return e.every((i,r)=>i===t[r])}function Ch(e,t=[],i=0){let r=[];return u(e,t,i,r,!1),r}function u(e,t,i,r,o){if(n(e)||J(e)||qe(e)){if(!o)r.push({depth:i,node:e,nodeType:"text",path:t});return}if(e.$prototype==="Array"){if(!o)r.push({depth:i,node:e,nodeType:"map",path:t});let s=e.map;if(S(s))u(s,[...t,"map"],i+1,r,!1);return}if(!o)r.push({depth:i,node:e,nodeType:"element",path:t});if(e.$props&&it(e.tagName).includes("-")&&!Array.isArray(e.children))return;let{children:l}=e;if(Array.isArray(l))for(let s=0;s<l.length;s++){let a=[...t,"children",s];u(l[s],a,i+1,r,!1)}else if(Rr(l))u(l,[...t,"children"],i+1,r,!1);if(e.$switch&&S(e.cases))for(let[s,a]of Object.entries(e.cases)){let p=[...t,"cases",s];if(S(a)&&a.$ref)r.push({depth:i+1,node:a,nodeType:"case-ref",path:p});else if(S(a))r.push({depth:i+1,node:a,nodeType:"case",path:p}),u(a,p,i+2,r,!0)}}function Eo(e){if(!e)return"?";if(e.$prototype==="Array"){let{items:r}=e;return`Repeater → ${(Oe(r)?r.$ref:void 0)||"items"}`}if(e.$title)return e.$title;if(e.$id)return e.$id;if(e.tagName==="slot"){let r=e.attributes?.name;return n(r)&&r.trim()?`slot: ${r.trim()}`:"slot"}let t=it(e.tagName)||"div",i=e.$switch?" ⇆":"";if(n(e.textContent)&&e.textContent.length>0)return`${t} — ${e.textContent.slice(0,24)}${i}`;return t+i}var x=null;function id(e){x=e}function _n(){return x}function nu(e){return S(e)}function nf(e){if(Array.isArray(e))return e.map((i)=>nf(i));if(!Jn(e))return e;let t={};for(let[i,r]of Object.entries(e)){if(i.startsWith("on")&&_f(r))continue;if(i==="children")t.children=Array.isArray(r)?r.map((o)=>nf(o)):nf(r);else if(i==="cases"&&nu(r)){let o={};for(let[l,s]of Object.entries(r))o[l]=nf(s);t.cases=o}else if(i==="state"&&nu(r)){let o={};for(let[l,s]of Object.entries(r)){if(m(s)&&s.timing==="server")continue;o[l]=s}t.state=o}else t[i]=r}return t}var _1=null,kh=null,HR=null,BR=null,VR=null;function c(e){let t=document.querySelector(`#${e}`);return t instanceof HTMLElement?t:null}function GP(){_1=c("activity-bar"),kh=c("left-panel"),HR=c("right-panel"),BR=c("toolbar"),VR=c("statusbar")}function rf(e,t){if(!e)throw TypeError(`#${t} is not in the shell yet; initShellRefs() has not found it`);return e}var sg=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),WR=[":hover",":focus",":active",":focus-within",":focus-visible",":disabled",":first-child",":last-child","::before","::after","::placeholder"];function p_(e){return e.startsWith(":")||e.startsWith(".")||e.startsWith("&")||e.startsWith("[")}var f=new Map;function f_(e,t,i){let r=t??Dy;return(...o)=>{clearTimeout(f.get(e)),f.set(e,setTimeout(()=>{f.delete(e),i(...o)},r))}}function JP(e){clearTimeout(f.get(e)),f.delete(e)}var b=new Map;function T(e){return(S(e)||Q(e))&&"then"in e&&Q(e.then)}var d=0;function YP(){return d}function h(e,t){d+=1;let i=()=>{d-=1},r=null;try{let o=t();if(T(o))r=o}catch(o){console.error(`Renderer "${e}" failed:`,o)}if(!r){i();return}r.then(i,(o)=>{console.error(`Renderer "${e}" failed:`,o),i()})}function ag(e,t){b.set(e,t)}function so(){for(let[e,t]of b.entries())h(e,t)}function wn(...e){for(let t of e){let i=b.get(t);if(!i)continue;h(t,i)}}function wl(e,t){if(e){if(t.selection!==void 0)e.session.selection=t.selection;if(t.hover!==void 0)e.session.hover=t.hover;if(t.clipboard!==void 0)e.session.clipboard=t.clipboard;if(t.ui)Object.assign(e.session.ui,t.ui);if(t.canvas)Object.assign(e.session.canvas,t.canvas)}}function Aa(e,t,i){if(e)e.session.ui[t]=i}function ZP(e,t){if(e)Object.assign(e.session.canvas,t)}
2
- export{Dy,tf,x1,KP,oo,Oy,FR,zt,Vi,jR,ko,Ch,Eo,x,id,_n,nu,nf,_1,kh,HR,BR,VR,GP,rf,sg,WR,p_,f_,JP,YP,ag,so,wn,wl,Aa,ZP};
3
-
4
- //# debugId=BE5C82A6F6BB5B2764756E2164756E21
5
- //# sourceMappingURL=studio-zn7ysyzb.js.map
@@ -1,4 +0,0 @@
1
- import{L,C,A,P,q,z,G,Y,X,Q}from"./iframe-entry-2x9bn5ng.js";export{L as TOAST_PAUSE,C as TOAST_RESUME,P as closeToast,Q as onToastAction,X as onToastDismiss,G as onToastHold,q as onToastMount,Y as onToastRelease,z as onToastUnmount,A as staysInside};
2
-
3
- //# debugId=CA76A88119B868B264756E2164756E21
4
- //# sourceMappingURL=toast-w11qpkyz.js.map
@@ -1,4 +0,0 @@
1
- import{Q2,GS,_E,SE,JS,ab,CE}from"./studio-n4pnf0sw.js";import"./studio-s4k1v7dt.js";import"./studio-d5f7sskn.js";import"./studio-ztzf8mce.js";import"./studio-hy936516.js";import"./studio-vswmz40d.js";import"./studio-ph17an19.js";import"./studio-pte5w7rf.js";import"./studio-dst8y8vh.js";import"./studio-ep1384t9.js";import"./studio-4ncxzw5m.js";import"./studio-ze1sm147.js";import"./studio-6mf31e16.js";import"./studio-6sxnqqw8.js";import"./studio-w3aafbpk.js";import"./studio-15mfah02.js";import"./studio-ek4fb4eb.js";import"./studio-4jy967rj.js";import"./studio-ajfq4fmr.js";import"./studio-pgze9p34.js";import"./studio-g65t6svn.js";import"./studio-thgexj3w.js";import"./studio-j3bq30yz.js";import"./studio-qarg1xf9.js";import"./studio-pv1ts08p.js";import"./studio-gw83z798.js";import"./studio-aaw7wxv8.js";import"./studio-43pynnhz.js";import"./studio-1d8m5s38.js";import"./studio-c72v1kwc.js";import"./studio-czpmzs9r.js";import"./studio-td3h1644.js";import"./studio-cv6gnjqd.js";import"./studio-4z0cdh16.js";import"./studio-k05g7efh.js";import"./studio-wn2cmf9q.js";import"./studio-w4mfaaam.js";import"./studio-q509sqt8.js";import"./studio-48yzqzqr.js";import"./studio-s49y6m5b.js";import"./studio-x5py815g.js";import"./studio-9c6cbq2c.js";import"./studio-bk0anq3b.js";import"./studio-ex1644g2.js";import"./studio-xh6rf05g.js";import"./studio-1a7zshnv.js";import"./studio-m3jrjfhy.js";import"./studio-zav9hgb3.js";import"./studio-zzgp5yka.js";import"./studio-z6s56dzz.js";import"./studio-k1wvtp03.js";export{Q2 as WORKSPACE_HOME_MODE_SET,ab as detachWorkspaceHome,GS as isWorkspaceHomeMode,_E as openWorkspaceHome,SE as placeWorkspaceHome,CE as renderWorkspaceHome,JS as workspaceHomeMounted};
2
-
3
- //# debugId=82D985F70C41F82864756E2164756E21
4
- //# sourceMappingURL=workspace-home-61n1jz3q.js.map
@@ -1,4 +0,0 @@
1
- import{fi,tg,LR,g,h,Jo,pn,Oa,Co,ng,f1,m1,sc,ig,rg,g1,b1,y1,og,_h,ac,Yp,vl,v1,Si,td,w1,RR,Ly,h_,IR,Qd,NR,DR,Ft,Ry,OR,AR}from"./studio-s49y6m5b.js";import"./studio-x5py815g.js";import"./studio-bk0anq3b.js";import"./studio-ex1644g2.js";import"./studio-xh6rf05g.js";import"./studio-zav9hgb3.js";export{LR as MAX_PANES,fi as PRIMARY_PANE,tg as SECONDARY_PANE,Ft as activateTab,Jo as activePane,h as activeTab,v1 as clearPaneActiveTab,NR as closeAllTabs,ig as closePane,Qd as closeTab,og as detachTab,Co as focusPane,_h as insertIntoPane,ng as isPaneFocused,Yp as isTabActive,IR as moveTab,Ry as moveTabToPane,Si as openTab,m1 as paneBeside,pn as paneById,rg as paneIsEmpty,Oa as paneOfTab,w1 as promoteDirtyPreviewTabs,td as promoteTab,sc as receivingPane,AR as registerTabCommands,OR as renameTab,DR as replaceAllTabs,y1 as setCloseLanding,RR as setEditBesideDocument,b1 as setEmptyPaneFallback,h_ as setTabPinned,g1 as setTabScope,ac as setWorkspaceProject,f1 as splitRight,Ly as tabHoldsEditBesideDocument,vl as tabIsLive,g as workspace};
2
-
3
- //# debugId=BE9C8F8FC55CED1C64756E2164756E21
4
- //# sourceMappingURL=workspace-sheek6zw.js.map