@jxsuite/studio 8.1.0 → 10.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (266) hide show
  1. package/dist/chunks/{2020-dg097k3e.js → 2020-j56903f1.js} +3 -3
  2. package/dist/chunks/adapter-wc5zvg9a.js +4 -0
  3. package/dist/chunks/add-new-flow-snx1s4b0.js +4 -0
  4. package/dist/chunks/cf-account-picker-xyqw0jex.js +4 -0
  5. package/dist/chunks/cf-settings-hp1pjm0n.js +4 -0
  6. package/dist/chunks/color-04361ttk.js +4 -0
  7. package/dist/chunks/{color-area-vh9cew51.js → color-area-h8dbasp1.js} +2 -2
  8. package/dist/chunks/{color-field-e78f16bs.js → color-field-qv5r2b16.js} +3 -3
  9. package/dist/chunks/{color-slider-fg4yhvk6.js → color-slider-nz2mrzky.js} +2 -2
  10. package/dist/chunks/components-nkwphrx3.js +4 -0
  11. package/dist/chunks/content-source-6a253wmk.js +4 -0
  12. package/dist/chunks/{convert-to-repeater-grnmea6c.js → convert-to-repeater-fhdwyg14.js} +3 -3
  13. package/dist/chunks/editor-wqrc68ca.js +4 -0
  14. package/dist/chunks/entry-commands-nef0wrmp.js +4 -0
  15. package/dist/chunks/{extension-sections-rp7fkega.js → extension-sections-8ez2rrk8.js} +3 -3
  16. package/dist/chunks/file-ops-y3w71k1n.js +4 -0
  17. package/dist/chunks/files-de90apn9.js +4 -0
  18. package/dist/chunks/format-host-zfjz4rzm.js +4 -0
  19. package/dist/chunks/fs-events-77c0mr0x.js +4 -0
  20. package/dist/chunks/grid-open-4n4fjfpf.js +4 -0
  21. package/dist/chunks/{grid-view-x26rfpz1.js → grid-view-ka55z38f.js} +10 -10
  22. package/dist/chunks/{iframe-entry-pkgmcgp0.js → iframe-entry-2x9bn5ng.js} +4 -4
  23. package/dist/chunks/{iframe-entry-02wzcyvy.js → iframe-entry-btck0e9s.js} +4 -4
  24. package/dist/chunks/iframe-host-na2mywz4.js +4 -0
  25. package/dist/chunks/index-ewmgdb7c.js +4 -0
  26. package/dist/chunks/{index-203h71wy.js → index-qb98xhse.js} +3 -3
  27. package/dist/chunks/{javascript-ww5pv5ae.js → javascript-ces13wny.js} +2 -2
  28. package/dist/chunks/{jsonMode-vwbdwwq3.js → jsonMode-6md16d4v.js} +6 -6
  29. package/dist/chunks/jx-validate-b309c020.js +4 -0
  30. package/dist/chunks/layers-8rn8y6qv.js +4 -0
  31. package/dist/chunks/layers-panel-eyah7h9z.js +4 -0
  32. package/dist/chunks/lit-html-wyqw04y2.js +4 -0
  33. package/dist/chunks/media-library-gs3np47y.js +4 -0
  34. package/dist/chunks/media-picker-tt7dk4tb.js +4 -0
  35. package/dist/chunks/{monaco-binding-63tqze27.js → monaco-binding-p8j80s4w.js} +3 -3
  36. package/dist/chunks/monaco-buffer-wsf6cmnq.js +4 -0
  37. package/dist/chunks/{monaco-setup-zyyynnj8.js → monaco-setup-wasktzfg.js} +3 -3
  38. package/dist/chunks/notify-qwst108r.js +4 -0
  39. package/dist/chunks/parse-n8dfxnqf.js +4 -0
  40. package/dist/chunks/platform-c16mqvmp.js +4 -0
  41. package/dist/chunks/publish-panel-d34bhvwj.js +4 -0
  42. package/dist/chunks/{publish-quick-ajzdhhs6.js → publish-quick-vr695j26.js} +3 -3
  43. package/dist/chunks/publish-workspace-2yr60mt4.js +4 -0
  44. package/dist/chunks/quick-search-e6xsdv0d.js +4 -0
  45. package/dist/chunks/references-gsj6trdv.js +4 -0
  46. package/dist/chunks/right-panel-33jv1knc.js +4 -0
  47. package/dist/chunks/source-control-bj9bejjv.js +4 -0
  48. package/dist/chunks/studio-03mqh8ax.js +5 -0
  49. package/dist/chunks/{studio-957jg8g3.js → studio-06j4en5h.js} +4 -4
  50. package/dist/chunks/studio-0ydxv2mr.js +7 -0
  51. package/dist/chunks/{studio-v2ek69cb.js → studio-1e8dw2w2.js} +4 -4
  52. package/dist/chunks/studio-2hsqbq7b.js +7 -0
  53. package/dist/chunks/studio-2j86y34y.js +6 -0
  54. package/dist/chunks/studio-2ks6ka4g.js +5 -0
  55. package/dist/chunks/studio-34jrz12k.js +5 -0
  56. package/dist/chunks/{studio-1meqbxns.js → studio-35vrtpdq.js} +4 -4
  57. package/dist/chunks/studio-38g0jdz7.js +5 -0
  58. package/dist/chunks/{studio-25a5by3h.js → studio-396srjbk.js} +4 -4
  59. package/dist/chunks/{studio-zm7dnr9g.js → studio-3c8pp7pb.js} +4 -4
  60. package/dist/chunks/{studio-x3ge4rts.js → studio-3v5cagy9.js} +4 -4
  61. package/dist/chunks/studio-3w35qvay.js +5 -0
  62. package/dist/chunks/studio-3zge48z4.js +7 -0
  63. package/dist/chunks/studio-45gyxpcq.js +5 -0
  64. package/dist/chunks/{studio-hw60n5dh.js → studio-4kzbrr5t.js} +3 -3
  65. package/dist/chunks/{studio-533py3yy.js → studio-5tzgq6fx.js} +4 -4
  66. package/dist/chunks/studio-5wzdy1jc.js +16 -0
  67. package/dist/chunks/studio-732mw0g8.js +5 -0
  68. package/dist/chunks/{studio-3q6n9qvq.js → studio-771k2n12.js} +4 -4
  69. package/dist/chunks/{studio-z42kysg7.js → studio-7dzyz9n8.js} +137 -137
  70. package/dist/chunks/{studio-fqs1a22a.js → studio-7xag4na8.js} +4 -4
  71. package/dist/chunks/{studio-jqrg9xxg.js → studio-881z1xrx.js} +4 -4
  72. package/dist/chunks/studio-88bmt9rh.js +5 -0
  73. package/dist/chunks/{studio-8nyw10dp.js → studio-9b7177jq.js} +4 -4
  74. package/dist/chunks/{studio-nm9qev4p.js → studio-9cxmp61c.js} +5 -5
  75. package/dist/chunks/{studio-4dsdnan2.js → studio-9dz76yqc.js} +5 -5
  76. package/dist/chunks/{studio-a6x058ew.js → studio-agyvzfm4.js} +4 -4
  77. package/dist/chunks/{studio-2b8443ms.js → studio-ajw4k8hp.js} +3 -3
  78. package/dist/chunks/studio-c1pxszat.js +5 -0
  79. package/dist/chunks/studio-cpkamjdn.js +14 -0
  80. package/dist/chunks/studio-d038kqbs.js +5 -0
  81. package/dist/chunks/studio-d83m0wyq.js +5 -0
  82. package/dist/chunks/studio-dbxv7w4s.js +5 -0
  83. package/dist/chunks/studio-de1s2x9v.js +5 -0
  84. package/dist/chunks/{studio-94ppxeqy.js → studio-dx73md4n.js} +8 -8
  85. package/dist/chunks/studio-ekgtrndg.js +5 -0
  86. package/dist/chunks/studio-epenqmvk.js +7 -0
  87. package/dist/chunks/studio-et2q4s8n.js +5 -0
  88. package/dist/chunks/{studio-txkx6586.js → studio-ewarnzm4.js} +7 -7
  89. package/dist/chunks/{studio-bf0rgyf7.js → studio-fy7jzj9j.js} +4 -4
  90. package/dist/chunks/{studio-332hesdk.js → studio-gr36vnte.js} +4 -4
  91. package/dist/chunks/{studio-rdnezzkd.js → studio-gwrhcrss.js} +5 -5
  92. package/dist/chunks/{studio-9wyqyfqy.js → studio-h310mbqm.js} +4 -4
  93. package/dist/chunks/{studio-zht0x0v3.js → studio-h5tpz5ke.js} +4 -4
  94. package/dist/chunks/studio-h7weqf2q.js +5 -0
  95. package/dist/chunks/{studio-1gdfsr49.js → studio-hcsba201.js} +7 -7
  96. package/dist/chunks/studio-hwejq03c.js +5 -0
  97. package/dist/chunks/{studio-wcakp5bt.js → studio-hy4ye0dx.js} +7 -7
  98. package/dist/chunks/{studio-02phtmqn.js → studio-jttyqrmh.js} +4 -4
  99. package/dist/chunks/{studio-j5jqvyn3.js → studio-jw0q5j6k.js} +4 -4
  100. package/dist/chunks/studio-k3a8rp3d.js +5 -0
  101. package/dist/chunks/{studio-hnx1h1pr.js → studio-k3bcy02e.js} +4 -4
  102. package/dist/chunks/studio-m48v13s3.js +4 -0
  103. package/dist/chunks/{studio-bqgs90r8.js → studio-ndskgqef.js} +4 -4
  104. package/dist/chunks/studio-p1n2xjda.js +5 -0
  105. package/dist/chunks/studio-pgm83a2f.js +6 -0
  106. package/dist/chunks/studio-pqqq6v85.js +5 -0
  107. package/dist/chunks/studio-psh8mwnw.js +4 -0
  108. package/dist/chunks/{studio-cpdzrdgp.js → studio-r17asgs0.js} +4 -4
  109. package/dist/chunks/{studio-6vrxzkba.js → studio-ry81j4q1.js} +4 -4
  110. package/dist/chunks/studio-rzg8hnkf.js +5 -0
  111. package/dist/chunks/{studio-nsv7g1qn.js → studio-s0fg2wav.js} +4 -4
  112. package/dist/chunks/{studio-v0gsjav0.js → studio-tj2s0tks.js} +4 -4
  113. package/dist/chunks/studio-tyw7tk0x.js +5 -0
  114. package/dist/chunks/studio-v9ywz2se.js +6 -0
  115. package/dist/chunks/{studio-dmn7gpba.js → studio-vswcpzk7.js} +5 -5
  116. package/dist/chunks/studio-vzgmyt0v.js +5 -0
  117. package/dist/chunks/{studio-2dtc90zs.js → studio-wxdcd42g.js} +6 -6
  118. package/dist/chunks/{studio-c5dj3dzk.js → studio-wxhy1yh7.js} +4 -4
  119. package/dist/chunks/studio-x08a3m0a.js +5 -0
  120. package/dist/chunks/studio-x3mjr5cc.js +5 -0
  121. package/dist/chunks/{studio-xddgbwhe.js → studio-x97ay0v4.js} +4 -4
  122. package/dist/chunks/{studio-mmqr9awv.js → studio-xdpz9rpe.js} +33 -33
  123. package/dist/chunks/studio-xh683qzy.js +5 -0
  124. package/dist/chunks/{studio-hxq1ebp0.js → studio-xkxetm65.js} +6 -6
  125. package/dist/chunks/{studio-73wz63nn.js → studio-y26hx9re.js} +4 -4
  126. package/dist/chunks/{studio-kdseew9m.js → studio-yg3djpnm.js} +4 -4
  127. package/dist/chunks/studio-yx8hzqja.js +5 -0
  128. package/dist/chunks/studio-zg16eeq1.js +5 -0
  129. package/dist/chunks/studio-zgx7svjd.js +9 -0
  130. package/dist/chunks/studio-zkq3r91p.js +5 -0
  131. package/dist/chunks/{toast-host-1yg5ar8d.js → toast-host-g3r2s0kn.js} +2 -2
  132. package/dist/chunks/toast-w11qpkyz.js +4 -0
  133. package/dist/chunks/{tsMode-vra2hh7y.js → tsMode-h6tkz0ea.js} +5 -5
  134. package/dist/chunks/workspace-home-zkkrxq3r.js +4 -0
  135. package/dist/chunks/workspace-tdqqjqaa.js +4 -0
  136. package/dist/chunks/{ws-client-72x5n99j.js → ws-client-e951my95.js} +3 -3
  137. package/dist/iframe-entry.js +13 -13
  138. package/dist/manifest.json +77 -77
  139. package/dist/studio.js +91 -92
  140. package/package.json +11 -12
  141. package/src/canvas/iframe-editable-root.ts +32 -2
  142. package/src/collab/collab-session.ts +6 -2
  143. package/src/commands/context.ts +4 -0
  144. package/src/commands/defaults.ts +2 -0
  145. package/src/commands/live-context.ts +2 -0
  146. package/src/files/files.ts +6 -3
  147. package/src/format/format-host.ts +1 -1
  148. package/src/github/github-auth-status.ts +2 -2
  149. package/src/media/media-library.ts +73 -3
  150. package/src/new-project/new-project-modal.ts +1 -4
  151. package/src/packages/ensure-deps.ts +5 -5
  152. package/src/packages/pull-package-sync.ts +4 -4
  153. package/src/panels/activity-panel.ts +1 -1
  154. package/src/panels/ai-panel.ts +27 -34
  155. package/src/platform.ts +20 -0
  156. package/src/platforms/cloud.ts +48 -34
  157. package/src/platforms/devserver.ts +2 -120
  158. package/src/services/ai-ask.ts +29 -171
  159. package/src/services/ai-command-tools.ts +40 -50
  160. package/src/services/ai-import-tools.ts +4 -5
  161. package/src/services/ai-project-tools.ts +13 -3
  162. package/src/services/ai-tools.ts +26 -564
  163. package/src/services/ai-writes.ts +84 -2
  164. package/src/services/document-assistant.ts +29 -58
  165. package/src/services/harness/assistant-tools.ts +68 -0
  166. package/src/services/harness/interaction-store.ts +118 -0
  167. package/src/services/harness/studio-documents.ts +105 -0
  168. package/src/services/harness/turn-hooks.ts +1 -6
  169. package/src/services/project-adoption.ts +8 -16
  170. package/src/services/tool-executor.ts +25 -22
  171. package/src/settings/extension-commands.ts +1 -1
  172. package/src/settings/extension-rows.ts +1 -6
  173. package/src/settings/extensions-section.ts +3 -6
  174. package/src/state.ts +3 -13
  175. package/src/surfaces/block-action-bar.json +1 -3
  176. package/src/surfaces/files-panel.json +12 -0
  177. package/src/surfaces/files-panel.ts +5 -2
  178. package/src/surfaces/media-library.json +35 -0
  179. package/src/surfaces/media-library.ts +2 -0
  180. package/src/surfaces/menu.ts +62 -1
  181. package/src/surfaces/settings-packages.ts +1 -1
  182. package/src/surfaces/welcome.ts +4 -1
  183. package/src/tabs/selection.ts +14 -109
  184. package/src/tabs/tab.ts +10 -1
  185. package/src/tabs/transact.ts +316 -124
  186. package/src/types.ts +23 -16
  187. package/src/ui/layers.ts +1 -1
  188. package/src/ui/progress-modal.ts +3 -3
  189. package/dist/chunks/adapter-tck81zft.js +0 -4
  190. package/dist/chunks/add-new-flow-a1w0bnm6.js +0 -4
  191. package/dist/chunks/cf-account-picker-ce3kp3x1.js +0 -4
  192. package/dist/chunks/cf-settings-7ye6x7g2.js +0 -4
  193. package/dist/chunks/color-4gj49xq6.js +0 -4
  194. package/dist/chunks/components-qce0v93f.js +0 -4
  195. package/dist/chunks/content-source-jjx8kgzr.js +0 -4
  196. package/dist/chunks/editor-bkja5dbv.js +0 -4
  197. package/dist/chunks/entry-commands-1wh0btvg.js +0 -4
  198. package/dist/chunks/file-ops-6pe4z7an.js +0 -4
  199. package/dist/chunks/files-ybpp3j38.js +0 -4
  200. package/dist/chunks/format-host-3mtbhxk1.js +0 -4
  201. package/dist/chunks/fs-events-xfanfxds.js +0 -4
  202. package/dist/chunks/grid-open-dg5qmnaj.js +0 -4
  203. package/dist/chunks/iframe-host-j2bk2xkc.js +0 -4
  204. package/dist/chunks/index-fkrm7pdk.js +0 -4
  205. package/dist/chunks/jx-validate-w7v32f6a.js +0 -4
  206. package/dist/chunks/layers-g7j732cm.js +0 -4
  207. package/dist/chunks/layers-panel-gjrsxcck.js +0 -4
  208. package/dist/chunks/lit-html-jdfz9rhc.js +0 -4
  209. package/dist/chunks/media-library-9j0v4wmk.js +0 -4
  210. package/dist/chunks/media-picker-cpyyt2m0.js +0 -4
  211. package/dist/chunks/monaco-buffer-9wcme176.js +0 -4
  212. package/dist/chunks/notify-rahnnnv4.js +0 -4
  213. package/dist/chunks/parse-v77xtwv7.js +0 -4
  214. package/dist/chunks/platform-b2aqv7v5.js +0 -4
  215. package/dist/chunks/publish-panel-4yk2461b.js +0 -4
  216. package/dist/chunks/publish-workspace-mxestzcf.js +0 -4
  217. package/dist/chunks/quick-search-9g6z65b0.js +0 -4
  218. package/dist/chunks/references-c26enpxs.js +0 -4
  219. package/dist/chunks/right-panel-9d0e0yg7.js +0 -4
  220. package/dist/chunks/source-control-xyn3a8ds.js +0 -4
  221. package/dist/chunks/studio-0khd0xdw.js +0 -5
  222. package/dist/chunks/studio-1fvzq9vs.js +0 -5
  223. package/dist/chunks/studio-1yhz0s8p.js +0 -5
  224. package/dist/chunks/studio-2c2mjyzj.js +0 -6
  225. package/dist/chunks/studio-3pndhat0.js +0 -9
  226. package/dist/chunks/studio-4fjqdzrb.js +0 -6
  227. package/dist/chunks/studio-5abge3wy.js +0 -5
  228. package/dist/chunks/studio-74nzv280.js +0 -5
  229. package/dist/chunks/studio-7cg75gtj.js +0 -14
  230. package/dist/chunks/studio-89cwmnae.js +0 -5
  231. package/dist/chunks/studio-8m1t83kn.js +0 -7
  232. package/dist/chunks/studio-a3evp7f6.js +0 -6
  233. package/dist/chunks/studio-ana67wax.js +0 -5
  234. package/dist/chunks/studio-b4xhpcwy.js +0 -4
  235. package/dist/chunks/studio-c4rcaftm.js +0 -5
  236. package/dist/chunks/studio-cgjt1zce.js +0 -5
  237. package/dist/chunks/studio-cq87hree.js +0 -5
  238. package/dist/chunks/studio-d140sy8e.js +0 -5
  239. package/dist/chunks/studio-e1g64q43.js +0 -5
  240. package/dist/chunks/studio-e8pzjjhf.js +0 -5
  241. package/dist/chunks/studio-f8kz3krj.js +0 -7
  242. package/dist/chunks/studio-fw3jp9m7.js +0 -5
  243. package/dist/chunks/studio-g6ysm05p.js +0 -7
  244. package/dist/chunks/studio-gmhd0j3f.js +0 -5
  245. package/dist/chunks/studio-gqpty626.js +0 -5
  246. package/dist/chunks/studio-grp684wx.js +0 -5
  247. package/dist/chunks/studio-h98520qr.js +0 -5
  248. package/dist/chunks/studio-hvxt8z79.js +0 -5
  249. package/dist/chunks/studio-j4e627w1.js +0 -5
  250. package/dist/chunks/studio-kt2j51sa.js +0 -5
  251. package/dist/chunks/studio-m4w6sygj.js +0 -16
  252. package/dist/chunks/studio-nqxqf8p2.js +0 -4
  253. package/dist/chunks/studio-p89w12s2.js +0 -7
  254. package/dist/chunks/studio-pbagym4j.js +0 -5
  255. package/dist/chunks/studio-pr23qhrw.js +0 -5
  256. package/dist/chunks/studio-r4ya3sb2.js +0 -5
  257. package/dist/chunks/studio-rm9m3z60.js +0 -5
  258. package/dist/chunks/studio-tpmnbgmt.js +0 -5
  259. package/dist/chunks/studio-ttxhq5yt.js +0 -5
  260. package/dist/chunks/studio-y1x65h5r.js +0 -5
  261. package/dist/chunks/studio-zf188hnd.js +0 -5
  262. package/dist/chunks/toast-1gv0h53h.js +0 -4
  263. package/dist/chunks/workspace-3nt93k48.js +0 -4
  264. package/dist/chunks/workspace-home-zbgyqqws.js +0 -4
  265. package/src/services/directory-picker.ts +0 -187
  266. package/src/services/gated-registry.ts +0 -77
@@ -1,5 +0,0 @@
1
- import{p,_e}from"./studio-pr23qhrw.js";import{Q}from"./studio-nqxqf8p2.js";import{$a,k$}from"./studio-cq87hree.js";import{ge,ea,ne,g,he,C,dl,tf}from"./studio-hw60n5dh.js";import{sO,Y,ov,qd,kr,Ix,Rx,Ra,cv,O$,m,u,_i}from"./studio-y1x65h5r.js";import{Bt,eu,zi,of,fn,cr,tI,Oa,nI}from"./studio-tpmnbgmt.js";import{Pd}from"./studio-hvxt8z79.js";import{x$,VA,UA,hh,Gb}from"./studio-7cg75gtj.js";import{Ko}from"./studio-02phtmqn.js";import{fN,dL}from"./studio-5abge3wy.js";import{zd}from"./studio-9wyqyfqy.js";import{ks,ko}from"./studio-m4w6sygj.js";import{tl,Ku}from"./studio-wcakp5bt.js";import{eN}from"./studio-rdnezzkd.js";import{oe}from"./studio-gqpty626.js";import{n,Z,Xe,_,v}from"./studio-kt2j51sa.js";function ie(e,o=[]){if(e?.tagName==="slot"){let s=e.attributes?.name;o.push(n(s)?s.trim():"")}if(Array.isArray(e?.children))for(let s of e.children)ie(n(s)?void 0:s,o);return o}function vS(e){let o=ie(e),s=o.filter((r)=>r==="").length;if(s>1)return`Component has ${s} unnamed <slot> elements — only one default slot is allowed. Give extra slots a name attribute.`;let l=new Set;for(let r of o){if(r&&l.has(r))return`Duplicate slot name "${r}" — slot names must be unique within a component.`;l.add(r)}return null}var se={invokerTags:Gb,popoverTags:hh},D="Popover",ke={display:"document.repairPopoverDisplay","open-display":"document.repairPopoverDisplay",invoker:"document.repairPopoverInvoker",mode:"document.repairPopoverMode"};function ae(e,o,s,l){let r=`${o}.${s}.${l.join("/")}`,d=e.get(r)??0;return e.set(r,d+1),d===0?r:`${r}#${d}`}function W(e,o){dl((d)=>d.source===D);let s=new Map,l=VA(e,se);for(let d of l){let c=d.fix===void 0?void 0:ke[d.fix],b={detail:d.detail,key:ae(s,"popover",d.rule,d.path),source:D,tier:"problem"};if(c!==void 0)b.action=c,b.actionArgs={path:d.path};if(o!==void 0)b.path=o;C(d.severity,d.message,b)}let r=fN(e,se);for(let d of r){let c={detail:d.detail,key:ae(s,"dialog",d.rule,d.path),source:D,tier:"problem"};if(o!==void 0)c.path=o;C(d.severity,d.message,c)}return l.length+r.length}function z(e,o){let s=o?.path;if(!Array.isArray(s))throw RangeError(`command "${e}" needs a "path" argument naming the popover`);return s}function J(e){let o=u.value;if(!o)throw RangeError(`command "${e}" needs an open document`);return o}function Se(){return[{category:"Document",group:"2_document",id:"document.checkPopovers",level:"document",menus:["palette"],requires:"an open document",run:()=>{let e=J("document.checkPopovers"),o=W(e.doc.document,e.documentPath??void 0);C.success(o===0?"No popover problems found in this document.":`${o} popover problem(s) filed.`,{key:"popover.run",source:D})},title:"Check Popovers",when:(e)=>e.document.open,aiTool:{description:"Check the open document for popover defects an author can fix — a base-rule `display` "+"that defeats the browser's own hiding of a closed popover, `popovertarget` on an "+"element that cannot invoke, a target naming no popover, a cut exit animation — and "+"file each as a Problem. The findings come back as data.",name:"check_popovers",report:()=>{let e=tf(D),o=e.length;return{data:e,summary:o===0?"No popover problems found in this document.":`Filed ${o} popover problem${o===1?"":"s"} in Problems.`}}}},{args:{additionalProperties:!1,properties:{path:{items:{type:["string","number"]},type:"array"}},required:["path"],type:"object"},category:"Document",group:"2_document",id:"document.repairPopoverDisplay",level:"document",menus:[],requires:"a popover whose base rule sets display",run:(e,o)=>{let l=J("document.repairPopoverDisplay"),r=z("document.repairPopoverDisplay",o),d=oe(l.doc.document,r),c=UA(d?.style);if(!c)throw RangeError(`command "${"document.repairPopoverDisplay"}": nothing to move — this popover sets no display`);Y(l,(b)=>{for(let w of c.base)qd(b,r,w,"");for(let w of c.breakpoints)Rx(b,r,[w],"display","");if(c.openDisplay!==null)Ix(b,r,":popover-open","display",c.openDisplay)}),C.success("Moved `display` into `:popover-open`.",{key:"popover.repaired.display",source:D})},title:"Move display into :popover-open",when:(e)=>e.document.open},{args:{additionalProperties:!1,properties:{path:{items:{type:["string","number"]},type:"array"}},required:["path"],type:"object"},category:"Document",group:"2_document",id:"document.repairPopoverInvoker",level:"document",menus:[],requires:"an element carrying popovertarget that cannot invoke",run:(e,o)=>{let l=J("document.repairPopoverInvoker"),r=z("document.repairPopoverInvoker",o);Y(l,(d)=>{kr(d,r,"popovertarget"),kr(d,r,"popovertargetaction")}),C.success("Removed the attributes, which did nothing on this element.",{key:"popover.repaired.invoker",source:D})},title:"Remove the inert popover attributes",when:(e)=>e.document.open},{args:{additionalProperties:!1,properties:{path:{items:{type:["string","number"]},type:"array"}},required:["path"],type:"object"},category:"Document",group:"2_document",id:"document.repairPopoverMode",level:"document",menus:[],requires:"a popover whose mode is not one of the three keywords",run:(e,o)=>{let l=J("document.repairPopoverMode"),r=z("document.repairPopoverMode",o);Y(l,(d)=>{kr(d,r,"popover",x$)}),C.success(`Set \`popover\` to "${x$}".`,{key:"popover.repaired.mode",source:D})},title:"Set popover to auto",when:(e)=>e.document.open}]}function JD(e){e.registerAll(Se())}function kw(e,o){if(e===o)return!0;if(Array.isArray(e)&&Array.isArray(o))return e.length===o.length&&e.every((s,l)=>s===o[l]);if(_(e)&&_(o)&&!Array.isArray(e)&&!Array.isArray(o))return e.$ref===o.$ref;return!1}var N="grid://",gb={children:[],tagName:"div"};function ls(e){switch(e.kind){case"pages":return`${N}pages`;case"collection":return`${N}collection/${encodeURIComponent(e.name)}`;default:return`${N}data/${encodeURIComponent(e.connection)}/${encodeURIComponent(e.table)}`}}function xe(e){return e.startsWith(N)}function Bl(e){if(!xe(e))return null;let o=e.slice(N.length).split("/");if(o[0]==="pages"&&o.length===1)return{kind:"pages"};if(o[0]==="collection"&&o.length===2&&o[1])return{kind:"collection",name:decodeURIComponent(o[1])};if(o[0]==="data"&&o.length===3&&o[1]&&o[2])return{connection:decodeURIComponent(o[1]),kind:"data",table:decodeURIComponent(o[2])};return null}function mm(e){let o=Bl(e);if(!o)return null;switch(o.kind){case"pages":return"Pages · grid";case"collection":return`${o.name} · grid`;default:return`${o.table} @ ${o.connection} · grid`}}var le=0;function ce(e){let o=e.coalesceMs??800,s=e.now??(()=>Date.now()),r=g({deletes:new Set,errors:new Map,inserts:new Map,pending:new Map,redoStack:[],stale:new Set,undoStack:[]}),d=null,c=(t,i,a)=>{let f=r.errors.get(t);if(f)f.set(i,a);else r.errors.set(t,new Map([[i,a]]))},b=(t,i)=>{let a=r.errors.get(t);if(a?.delete(i),a?.size===0)r.errors.delete(t)},w=(t)=>{if(r.redoStack.length=0,d){d.push(t);return}let i=r.undoStack.at(-1);if(t.kind==="cell"&&i?.kind==="cell"&&i.rowKey===t.rowKey&&i.field===t.field&&t.at-i.at<=o){i.after=t.after,i.at=t.at;return}r.undoStack.push(t)},k=(t,i,a)=>{let f=r.inserts.get(t);if(f){if(a===null)delete f[i];else f[i]=a;return}if(kw(a,e.resolveBaseline(t,i))){let y=r.pending.get(t);if(y?.delete(i),y?.size===0)r.pending.delete(t);return}let h=r.pending.get(t);if(h)h.set(i,{value:a});else r.pending.set(t,new Map([[i,{value:a}]]))},P=(t,i)=>{let a=r.inserts.get(t);if(a)return a[i]??null;let f=r.pending.get(t)?.get(i);return f?f.value:e.resolveBaseline(t,i)},O=(t,i)=>{let a=r.errors.get(t);return a?.get(i)??a?.get("*")??null},M=(t,i)=>{switch(t.kind){case"cell":{k(t.rowKey,t.field,i==="undo"?t.before:t.after);break}case"insert":{if(i==="undo")r.inserts.delete(t.tempKey);else r.inserts.set(t.tempKey,{...t.cells});break}case"drop-insert":{if(i==="undo")r.inserts.set(t.tempKey,{...t.cells});else r.inserts.delete(t.tempKey);break}case"delete":{if(i==="undo")r.deletes.delete(t.rowKey);else r.deletes.add(t.rowKey);break}default:{let a=i==="undo"?t.ops.toReversed():t.ops;for(let f of a)M(f,i);break}}},F=()=>{if(d)throw Error("edit-buffer: groups may not nest");d=[]},x=()=>{let t=d;if(d=null,!t)return;if(t.length===1)r.undoStack.push(t[0]);else if(t.length>1)r.undoStack.push({kind:"group",ops:t})},E=(t)=>{let i=(a)=>{switch(a.kind){case"cell":return t(a.rowKey)?null:a;case"insert":case"drop-insert":return t(a.tempKey)?null:a;case"delete":return t(a.rowKey)?null:a;default:{let f=a.ops.map((h)=>i(h)).filter((h)=>h!==null);return f.length>0?{kind:"group",ops:f}:null}}};r.undoStack=r.undoStack.map(i).filter((a)=>a!==null),r.redoStack=r.redoStack.map(i).filter((a)=>a!==null)};return{applyCommitResult(t){let i=new Set;for(let a of t.cells)if(a.ok){let f=r.pending.get(a.rowKey);if(f?.delete(a.field),f?.size===0)r.pending.delete(a.rowKey);b(a.rowKey,a.field)}else if(c(a.rowKey,a.field,a.error??"Save failed"),a.stale)r.stale.add(a.rowKey);for(let a of t.inserts)if(a.ok)r.inserts.delete(a.tempKey),r.errors.delete(a.tempKey),i.add(a.tempKey);else c(a.tempKey,"*",a.error??"Insert failed");for(let a of t.deletes)if(a.ok)r.deletes.delete(a.rowKey),r.pending.delete(a.rowKey),r.errors.delete(a.rowKey),i.add(a.rowKey);else if(c(a.rowKey,"*",a.error??"Delete failed"),a.stale)r.stale.add(a.rowKey);for(let a of i)r.stale.delete(a);if(i.size>0)E((a)=>i.has(a))},buildBatch(){let t=[];for(let[i,a]of r.pending){if(r.deletes.has(i))continue;for(let[f,h]of a)t.push({baseline:e.resolveBaseline(i,f),field:f,rowKey:i,value:h.value})}return{cells:t,deletes:[...r.deletes].map((i)=>({rowKey:i})),inserts:[...r.inserts].map(([i,a])=>({cells:{...a},tempKey:i}))}},canRedo:()=>r.redoStack.length>0,canUndo:()=>r.undoStack.length>0,cellError:O,cellState(t,i){if(O(t,i)!==null)return"error";if(r.stale.has(t))return"stale";if(r.inserts.has(t)||r.pending.get(t)?.has(i))return"dirty";return"clean"},deleteRow(t){if(r.deletes.has(t))return;let i=r.inserts.get(t);if(i){let a={...i};r.inserts.delete(t),r.errors.delete(t),r.stale.delete(t),w({cells:a,kind:"drop-insert",tempKey:t});return}r.deletes.add(t),w({kind:"delete",rowKey:t})},dirtyCount(){let t=r.inserts.size+r.deletes.size;for(let[i,a]of r.pending)if(!r.deletes.has(i))t+=a.size;return t},discardRow(t){r.pending.delete(t),r.deletes.delete(t),r.inserts.delete(t),r.errors.delete(t),r.stale.delete(t),E((i)=>i===t)},effectiveValue:P,beginGroup:F,endGroup:x,group(t){F();try{t()}finally{x()}},insertRow(t={}){le+=1;let i=`__new-${le}`;return r.inserts.set(i,{...t}),w({cells:{...t},kind:"insert",tempKey:i}),i},isDirty:()=>r.pending.size>0||r.inserts.size>0||r.deletes.size>0,isInsertKey:(t)=>r.inserts.has(t),markStale(t){for(let i of t)r.stale.add(i)},redo(){let t=r.redoStack.pop();if(!t)return!1;return M(t,"redo"),r.undoStack.push(t),!0},reset(){r.pending.clear(),r.inserts.clear(),r.deletes.clear(),r.errors.clear(),r.stale.clear(),r.undoStack.length=0,r.redoStack.length=0},rowState(t){if(r.deletes.has(t))return"pending-delete";if(r.inserts.has(t))return"pending-insert";if(r.stale.has(t))return"stale";if(r.pending.has(t)||r.errors.has(t))return"dirty";return"clean"},setCell(t,i,a){let f=P(t,i);if(kw(f,a))return;k(t,i,a),w({after:a,at:s(),before:f,field:i,kind:"cell",rowKey:t})},state:r,undo(){let t=r.undoStack.pop();if(!t)return!1;return M(t,"undo"),r.redoStack.push(t),!0}}}var de={array:220,boolean:70,date:130,enum:140,image:180,number:110,readonly:200,reference:200,string:180,text:340};function ue(e){return Math.min(340,Math.max(90,Math.round(e*7.5)))}function Pe(e){if(e.$ref)return"reference";if(e.enum!==void 0&&Array.isArray(e.enum))return"enum";let o=e.type==="array"?void 0:e.format;if(Ra(o))return"image";if(o==="date"||o==="date-time")return"date";switch(e.type){case"number":case"integer":return"number";case"boolean":return"boolean";case"array":return"array";case"object":return"readonly";default:return(e.maxLength??0)>200||e.format==="markdown"?"text":"string"}}function fe(e){let o=e.replaceAll(/([a-z0-9])([A-Z])/g,"$1 $2").replaceAll(/[_-]+/g," ").trim();return o.charAt(0).toUpperCase()+o.slice(1)}function Ew(e,o={}){let s=Object.entries(e?.properties??{}),l=new Set(e?.required),r=new Set(o.readonlyFields),d=s.map(([c,b])=>{let w=r.has(c)?"readonly":Pe(b),k=Array.isArray(b.enum)?Math.max(...b.enum.map((P)=>String(P).length),4):0;return{editable:w!=="readonly",field:c,kind:w,pk:c===o.idField,required:l.has(c),schema:b,title:fe(c),widthHint:w==="enum"?ue(k+3):de[w]}});return d.sort((c,b)=>{let w=(P)=>P.pk?0:P.required?1:2,k=w(c)-w(b);return k===0?0:k}),d}function Tw(e,o=50){let s=e.slice(0,o),l=[];for(let r of s)for(let d of Object.keys(r))if(!l.includes(d))l.push(d);return l.map((r)=>{let d=s.flatMap((w)=>{let k=w[r];return k===null||k===void 0||k===""?[]:[k]}),c=Ge(d),b=Math.max(...d.map((w)=>nr(w).length),r.length,4);return{editable:!0,field:r,kind:c,title:fe(r),widthHint:c==="string"||c==="text"?ue(b):de[c]}})}function Ge(e){if(e.length===0)return"string";if(e.some((s)=>Array.isArray(s)))return"array";let o=e.map(String);if(e.every((s)=>Xe(s))||o.every((s)=>/^(true|false)$/i.test(s)))return"boolean";if(e.every((s)=>Z(s))||o.every((s)=>s.trim()!==""&&!Number.isNaN(Number(s.replaceAll(/[$€£¥,\s]/g,"")))))return"number";if(o.every((s)=>/^\d{4}-\d{2}-\d{2}([T ].*)?$/.test(s)))return"date";if(o.some((s)=>s.length>200))return"text";return"string"}function xp(e,o){if(e===null||e===void 0)return null;switch(o.kind){case"number":{if(Z(e))return Number.isNaN(e)?null:e;let s=String(e).trim().replaceAll(/[$€£¥,\s]/g,"");if(s==="")return null;let l=Number(s);return Number.isNaN(l)?null:l}case"boolean":{if(Xe(e))return e;return String(e).trim().toLowerCase()==="true"}case"array":{if(Array.isArray(e))return e.map(String);let s=String(e).trim();return s===""?[]:s.split(",").map((l)=>l.trim()).filter(Boolean)}case"reference":{if(v(e)&&"$ref"in e){let l=e.$ref;return n(l)&&l!==""?l:null}let s=String(e).trim();return s===""?null:s}default:{let s=String(e);return s===""?null:s}}}function nr(e){if(e===null||e===void 0)return"";if(Array.isArray(e))return e.join(", ");if(_(e))return e.$ref;return String(e)}var bS="__key",H=new WeakMap;function ir(e){return e?H.get(he(e))??null:null}function _p(e,o){let l=g({columns:[],error:null,grouping:null,loading:!1,query:{},rows:[],saving:!1,total:0}),r=new Map,d=(t)=>{r=new Map(t.map((i)=>[i.key,i]))},c=ce({resolveBaseline:(t,i)=>r.get(t)?.cells[i]??null}),b=async()=>{let t=await o.rows(l.query);d(t.rows),l.rows=t.rows,l.total=t.total},w=(t)=>{let i=l.columns.filter((h)=>h.required&&h.editable);if(i.length===0)return null;let a=t.cells.filter((h)=>h.value===null&&i.some((y)=>y.field===h.field)).map((h)=>({error:"Required",field:h.field,ok:!1,rowKey:h.rowKey})),f=t.inserts.filter((h)=>i.some((y)=>h.cells[y.field]===null||h.cells[y.field]===void 0)).map((h)=>({error:`Missing required: ${i.filter((G)=>h.cells[G.field]===null||h.cells[G.field]===void 0).map((G)=>G.field).join(", ")}`,ok:!1,tempKey:h.tempKey}));if(a.length===0&&f.length===0)return null;return{cells:a,deletes:[],inserts:f}},k=(t)=>t===null||t===""||Array.isArray(t)&&t.length===0,P=(t,i,a)=>{if(a==="number")return(Z(t)?t:0)-(Z(i)?i:0);if(a==="boolean")return(t===!0?1:0)-(i===!0?1:0);return nr(t).localeCompare(nr(i))},O=()=>{let t=l.rows.map((f)=>f.key),{dir:i,orderBy:a}=l.query;if(a&&!o.capabilities.remoteSort){let f=l.columns.find((y)=>y.field===a)?.kind,h=i==="desc"?-1:1;t=t.toSorted((y,G)=>{let R=c.effectiveValue(y,a),U=c.effectiveValue(G,a);if(k(R)!==k(U))return k(R)?1:-1;return h*P(R,U,f)})}return l.grouping?[...M(t).values()].flat():t},M=(t)=>{let i=new Map;for(let a of t){let f=nr(c.effectiveValue(a,l.grouping)),h=i.get(f);if(h)h.push(a);else i.set(f,[a])}return i},F=null,x=()=>F?.refreshData(),E={addRow(t={}){let i=c.insertRow(t);return x(),i},bindView(t){F=t},buffer:c,deleteRows(t){if(t.length===0)return;c.group(()=>{for(let i of t)c.deleteRow(i)}),x()},discardRow(t){c.discardRow(t),x()},replaceAll(t,i){if(t==="")return 0;let a=l.columns.filter((y)=>y.editable&&(y.kind==="string"||y.kind==="text")),f=[...l.rows.map((y)=>y.key),...c.state.inserts.keys()],h=0;if(c.group(()=>{for(let y of f){if(c.rowState(y)==="pending-delete")continue;for(let G of a){let R=c.effectiveValue(y,G.field);if(n(R)&&R.includes(t))c.setCell(y,G.field,R.replaceAll(t,i)),h+=1}}}),h>0)x();return h},effectiveRows(){let t=(f)=>Array.isArray(f)?[...f]:_(f)?{$ref:f.$ref}:f,i=(f)=>{let h=[[bS,f]];for(let y of l.columns)h.push([y.field,t(c.effectiveValue(f,y.field))]);return Object.fromEntries(h)},a=O().map((f)=>i(f));for(let[f]of c.state.inserts)a.push(i(f));return a},groups(){if(!l.grouping)return[];return[...M(O())].map(([t,i])=>({count:i.length,value:t}))},async load(){l.loading=!0,l.error=null;try{l.columns=await o.columns(),await b()}catch(t){l.error=Q(t)}finally{l.loading=!1}x()},async refresh(){if(c.isDirty()){if(!await Ko("Refresh Grid",`Discard ${c.dirtyCount()} pending change(s) and reload?`,{confirmLabel:"Discard & Reload",destructive:!0}))return}c.reset(),await o.refresh?.(),await this.load()},async save(){if(l.saving)return;let t=c.buildBatch(),i=t.cells.length+t.inserts.length+t.deletes.length;if(i===0){C.info("No grid changes to save.",{key:"grid.save"});return}let a=w(t);if(a){c.applyCommitResult(a),C.warn("Required cells are empty — fix the marked rows, then save again.",{key:"grid.save",source:"Data",tier:"problem"});return}if(t.deletes.length>0){if(!await Ko("Delete Rows",`Save will permanently delete ${t.deletes.length} row(s). Continue?`,{confirmLabel:"Delete & Save",destructive:!0}))return}let h=new Set(t.cells.map((y)=>y.rowKey)).size+t.inserts.length+t.deletes.length>5?tl({title:"Saving grid"}):null;l.saving=!0;try{let y=await o.commit(t),G=(S,j)=>`${S}\x00${j}`,R=new Map(t.cells.map((S)=>[G(S.rowKey,S.field),S]));for(let S of y.cells){let j=R.get(G(S.rowKey,S.field));if(S.ok&&j){let re=r.get(S.rowKey);if(re)re.cells[S.field]=j.value}}if(c.applyCommitResult(y),y.inserts.some((S)=>S.ok)||y.deletes.some((S)=>S.ok))await b();let L=y.cells.filter((S)=>S.ok).length+y.inserts.filter((S)=>S.ok).length+y.deletes.filter((S)=>S.ok).length,ee=i-L,te=y.cells.filter((S)=>S.stale).length+y.deletes.filter((S)=>S.stale).length;if(ee===0)C.success(`Saved ${L} change(s).`,{key:"grid.save"});else C.error(`Saved ${L} · ${ee} failed${te?` (${te} stale)`:""} — kept pending.`,{action:"file.save",key:"grid.save",source:"Data"})}catch(y){C.error("Could not save the grid.",{action:"file.save",detail:Q(y),key:"grid.save",source:"Data"})}finally{l.saving=!1,h?.done(),x()}},serializeForSource(){if(!o.serializeForSource)return null;return o.serializeForSource(c.buildBatch())},async setQuery(t){l.query=t,l.loading=!0;try{await b()}catch(i){l.error=Q(i)}finally{l.loading=!1}x()},setGrouping(t){l.grouping=t,x()},async setSort(t){let i={...l.query};if(t)i.orderBy=t.field,i.dir=t.dir;else delete i.orderBy,delete i.dir;if(!o.capabilities.remoteSort){l.query=i,x();return}await this.setQuery(i)},source:o,state:l,tab:e};return e.scope.run(()=>{ne(()=>{e.doc.dirty=c.isDirty()}),ov(e,{canRedo:()=>c.canRedo(),canUndo:()=>c.canUndo(),redo:()=>{c.redo(),x()},undo:()=>{c.undo(),x()}});let t=p();if(t.subscribeFileEvents&&o.backingPaths){let i=t.subscribeFileEvents((a)=>{let f=o.backingPaths(),h=new Set;for(let y of a){if(y.isDir)continue;let G=y.path.replaceAll("\\","/"),R=f.get(G);if(R!==void 0&&!zd(G))h.add(R)}if(h.size===0)return;if(c.isDirty()){let y=h.has("*")?l.rows.map((G)=>G.key):[...h];c.markStale(y),C.warn("Grid rows changed on disk — marked stale; refresh to reload.",{key:"grid.stale",source:"Data"}),x()}else E.refresh()});ea(i)}ea(()=>{ov(e,null),H.delete(he(e)),o.dispose?.()})}),H.set(he(e),E),E}async function qu(e){let s=ir(e)?.serializeForSource();if(s)return s;await Bt();let l=zi(e.doc.sourceFormat);if(l?.capabilities.serialize){let r=e.doc.content.frontmatter,d=e.doc.document,c={...r,...d,children:d.children??[]};return Oa(l.name,c,{mode:"roundtrip",...e.doc.source!==null&&{source:e.doc.source}})}if(e.doc.mode==="content"){let r=cr();if(r){let d=e.doc.content.frontmatter,c=Object.keys(d).length>0,b={...d,...e.doc.document};return Oa(r.name,b,{frontmatter:c,mode:"roundtrip"})}}return ko(sO(e.doc.document,e.doc.bareRepeaters??null),e.doc.layout??null)}var Re=200,Ee=500,Te=2097152,A=new Map,V=!1,I=null,T=null,B=null,X=null;function Oe(){let e=[];for(let o of m.tabs.values())if(o.doc.dirty&&o.documentPath)e.push(o);return e}async function me(){if(!_e())return;let e=p();if(!e.setPreviewOverlay||!e.clearPreviewOverlay)return;let o=new Set;for(let s of Oe()){let l=s.documentPath.replace(/^\.\//,""),r;try{r=await qu(s)}catch{continue}if(r.length>Te)continue;if(o.add(l),A.get(l)===r)continue;A.set(l,r),await e.setPreviewOverlay(l,r)}for(let s of A.keys())if(!o.has(s))A.delete(s),await e.clearPreviewOverlay(s)}function pe(){if(!V)return;let e=Date.now();if(B??=e,T)clearTimeout(T);let o=e-B,s=Math.max(0,Math.min(Re,Ee-o));T=setTimeout(()=>{T=null,B=null,X=me().finally(()=>{X=null})},s)}function YD(){pe()}function ZD(){if(V)return;V=!0,I=ge(),I.run(()=>{ne(()=>{for(let e of m.tabs.values())e.doc.dirty,e.doc.document;pe()})})}function XD(){if(V=!1,T)clearTimeout(T),T=null;B=null,I?.stop(),I=null,A.clear()}async function yS(){if(!V)return;if(T)clearTimeout(T),T=null,B=null;await X,await me()}var ye=/^[A-Za-z0-9][A-Za-z0-9!#$&^_.+-]{0,126}$/,Me=new Set(["vnd","prs","x"]);function $e(e){if(!n(e))return null;let[o,...s]=e.split(";"),l=(o??"").indexOf("/");if(l===-1)return null;let r=(o??"").slice(0,l).trim().toLowerCase(),d=(o??"").slice(l+1).trim().toLowerCase();if(!ye.test(r)||!ye.test(d))return null;let c=d.lastIndexOf("+"),b=c===-1?null:d.slice(c+1),w=c===-1?d:d.slice(0,c);if(b==="")return null;let k=w.indexOf("."),P=k===-1?null:w.slice(0,k),O=P!==null&&Me.has(P)?P:null,M=O===null?w:w.slice(O.length+1);if(M==="")return null;let F={};for(let x of s){let E=x.indexOf("=");if(E===-1)return null;let t=x.slice(0,E).trim().toLowerCase(),i=x.slice(E+1).trim();if(t==="")return null;if(i.startsWith('"')&&i.endsWith('"')&&i.length>=2)i=i.slice(1,-1);F[t]=i}return{parameters:F,subtype:M,suffix:b,tree:O,type:r}}function Lw(e){let o=$e(e);if(o===null)return null;let s=o.tree===null?"":`${o.tree}.`,l=o.suffix===null?"":`+${o.suffix}`;return`${o.type}/${s}${o.subtype}${l}`}var we="text/markdown; variant=GFM",be="application/yaml",Tt={".markdown":`${we}; charset=utf-8`,".md":`${we}; charset=utf-8`,".yaml":`${be}; charset=utf-8`,".yml":`${be}; charset=utf-8`};async function QD(e,o){let s=await tI(e.name,o);return nI(e,s)}async function Hr(e,o){await Bt();let s=fn(e);if(!s||!s.capabilities.parse)throw of(e);return{...await QD(s,o),format:s}}var FT=async(e,o)=>{if(e.documentPath&&fn(e.documentPath)){let l=await Hr(e.documentPath,o);return e.doc.source=o,{document:l.document,frontmatter:l.frontmatter}}let s=ks(o);return e.doc.layout=s.layout,{document:s.document}};function Fe(e){return"showOpenFilePicker"in e}function De(e){return"showSaveFilePicker"in e}function q(e,o){if(e.documentPath!==null)o.path=e.documentPath;return o}async function X2(){try{await Bt();let e=eu(),o=[{accept:{"application/json":[".json"]},description:"Jx Component"},...e.filter((r)=>r.capabilities.parse).map((r)=>({accept:{[Lw(r.mediaType)??"text/plain"]:r.extensions},description:r.name}))],s=[".json",...e.flatMap((r)=>r.extensions)].join(","),l=async(r,d,c=null)=>{let b=c?await eN(r):null,w=fn(r);if(w){let{document:k,frontmatter:P}=await QD(w,d);_i({document:k,documentPath:b,fileHandle:c,frontmatter:P,id:r,source:d,sourceFormat:w.name})}else if(r.endsWith(".json")){let{document:k,layout:P}=ks(d);_i({document:k,documentPath:b,fileHandle:c,id:r,layout:P})}else throw of(r)};if(Fe(window)){let[r]=await window.showOpenFilePicker({types:o}),d=await r.getFile();await l(r.name,await d.text(),r)}else{let r=document.createElement("input");r.type="file",r.accept=s,r.addEventListener("change",async()=>{let d=r.files?.[0];if(!d)return;await l(d.name,await d.text())}),r.click()}}catch(e){if(!(e instanceof Error&&e.name==="AbortError"))C.error("Could not open the file.",{detail:Q(e),source:"Open File"})}}var ve=()=>{};function jT(e){ve=e}function K(e){let o=e.doc.document;ve(e.documentPath,o,e);let s=n(o.tagName)&&o.tagName.includes("-")?vS(o):null;if(s)C.warn(s,q(e,{key:`slots:${e.documentPath??e.id}`,source:"Components",tier:"problem"}));W(o,e.documentPath??void 0)}function Ne(e){return!Pd(e.documentPath??"")}async function Sp(e=u.value){if(!e)return!1;if(await dL(e.id),cv(e))return C.warn(`You have read access to this session — changes to ${e.documentPath??"this document"} stay in your browser and cannot be saved.`,q(e,{action:"file.save",key:`save.readOnly:${e.documentPath??e.id}`,source:"Collaboration"})),!1;if(!Ne(e))return C.warn(`${e.documentPath??"This file"} is a media file, so there is no document for Save to write.`,q(e,{key:`save.notADocument:${e.documentPath??e.id}`,source:"Save"})),!1;let o=ir(e);if(o)return await o.save(),!e.doc.dirty;try{if(await O$(e))return K(e),!0;let s=await qu(e);if(e.documentPath){if(await p().writeFile(e.documentPath,s),e.doc.dirty=!1,e.doc.sourceFormat!==null)e.doc.source=s;return yS(),K(e),!0}if(e.fileHandle&&"createWritable"in e.fileHandle){let l=await e.fileHandle.createWritable();if(await l.write(s),await l.close(),e.doc.dirty=!1,e.doc.sourceFormat!==null)e.doc.source=s;return K(e),!0}C.warn("This document has no save target — use Export.",{key:"save.noTarget"})}catch(s){if(!(s instanceof Error&&s.name==="AbortError"))C.error(`Could not save ${e.documentPath??e.id}.`,q(e,{action:"file.save",detail:Q(s),key:`save:${e.documentPath??e.id}`,source:"Save"}))}return!1}function Ae(e){return zi(e.doc.sourceFormat)??(e.doc.mode==="content"?cr():void 0)}async function HT(){let e=u.value;if(!e)return;try{await Bt();let o=Ae(e),s=await qu(e),l=o?Lw(o.mediaType)??"text/plain":"application/json",r=o?o.extensions[0]:".json",d=o?o.name:"Jx Component",c=o?`content${r}`:"component.json";if(De(window)){let b=e.documentPath?e.documentPath.split("/").pop():c,w=await window.showSaveFilePicker({suggestedName:b,types:[{accept:{[l]:[r]},description:d}]}),k=await w.createWritable();await k.write(s),await k.close(),e.doc.dirty=!1,K(e),C.success(`Exported as ${w.name}.`)}else{let b=new Blob([s],{type:l}),w=URL.createObjectURL(b),k=document.createElement("a");k.href=w,k.download=c,k.click(),URL.revokeObjectURL(w),e.doc.dirty=!1,K(e),C.success(`Downloaded ${c}.`)}}catch(o){if(!(o instanceof Error&&o.name==="AbortError"))C.error("Could not export the document.",{detail:Q(o),source:"Export"})}}async function Ce(e,o){let s=Pd(e)?await Ku(e):await $a({path:e});return k$(s,o)??""}async function bb(e){let o=await Ce(e.path,"delete"),s=`Delete ${e.name}? This cannot be undone.`;return Boolean(await Ko("Delete File",o===""?s:`${s} ${o}`,{confirmLabel:"Delete",destructive:!0}))}async function vb(e,o="rename"){let s=await Ce(e,o);return s===""?void 0:s}
2
- export{kw,gb,ls,Bl,mm,Ew,Tw,xp,nr,bS,ir,_p,vS,JD,qu,YD,ZD,XD,yS,Lw,QD,Hr,FT,X2,jT,Sp,HT,bb,vb};
3
-
4
- //# debugId=41C934FE2B14C01C64756E2164756E21
5
- //# sourceMappingURL=studio-1yhz0s8p.js.map