@jxsuite/studio 10.2.0 → 10.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (271) hide show
  1. package/dist/chunks/{2020-bx702wqa.js → 2020-906vx2dq.js} +3 -3
  2. package/dist/chunks/adapter-hnvad61x.js +4 -0
  3. package/dist/chunks/add-new-flow-3tkn72ey.js +4 -0
  4. package/dist/chunks/cf-account-picker-xb8vvt2h.js +4 -0
  5. package/dist/chunks/cf-settings-mkbcz4z2.js +4 -0
  6. package/dist/chunks/components-w5zqwva1.js +4 -0
  7. package/dist/chunks/content-source-1vzxq1ba.js +4 -0
  8. package/dist/chunks/convert-to-repeater-gwzh9gar.js +4 -0
  9. package/dist/chunks/editor-wvf5e6j9.js +4 -0
  10. package/dist/chunks/entry-commands-mx2whrjx.js +4 -0
  11. package/dist/chunks/extension-sections-338ee35t.js +4 -0
  12. package/dist/chunks/file-ops-9bxvk59j.js +4 -0
  13. package/dist/chunks/files-t07yqqej.js +4 -0
  14. package/dist/chunks/format-host-5ja5gxyk.js +4 -0
  15. package/dist/chunks/fs-events-3424ezp3.js +4 -0
  16. package/dist/chunks/grid-open-1mpq9mzb.js +4 -0
  17. package/dist/chunks/{grid-view-tghcwrrt.js → grid-view-w9nfy203.js} +16 -16
  18. package/dist/chunks/icons-gb967qc8.js +4 -0
  19. package/dist/chunks/iframe-host-wsg0bn73.js +4 -0
  20. package/dist/chunks/image-bake-4afr4y6a.js +4 -0
  21. package/dist/chunks/image-editor-x7t8jbjn.js +4 -0
  22. package/dist/chunks/index-f9qr7kzh.js +4 -0
  23. package/dist/chunks/{index-vr006kbt.js → index-yjrfeks8.js} +3 -3
  24. package/dist/chunks/{javascript-z1g3s9fd.js → javascript-hy2mws8v.js} +3 -3
  25. package/dist/chunks/{jsonMode-7szwg8c4.js → jsonMode-vj30te2h.js} +6 -6
  26. package/dist/chunks/jx-validate-ttr5ewf0.js +4 -0
  27. package/dist/chunks/layers-m49nmwvx.js +4 -0
  28. package/dist/chunks/layers-panel-hvy2e549.js +4 -0
  29. package/dist/chunks/lit-html-k2mb9k0r.js +4 -0
  30. package/dist/chunks/media-library-ae67q4at.js +4 -0
  31. package/dist/chunks/media-open-yp9jm834.js +4 -0
  32. package/dist/chunks/media-picker-s41ngdfr.js +4 -0
  33. package/dist/chunks/{monaco-binding-v42w9c1v.js → monaco-binding-a51py33c.js} +3 -3
  34. package/dist/chunks/monaco-buffer-pa0g6ax7.js +4 -0
  35. package/dist/chunks/{monaco-setup-7bffxd6v.js → monaco-setup-g9kterhx.js} +3 -3
  36. package/dist/chunks/notify-bwehrp7q.js +4 -0
  37. package/dist/chunks/parse-hee7ne9b.js +4 -0
  38. package/dist/chunks/platform-kv0k65cy.js +4 -0
  39. package/dist/chunks/publish-panel-gzfxcm0t.js +4 -0
  40. package/dist/chunks/publish-quick-w3nxd7q4.js +4 -0
  41. package/dist/chunks/publish-workspace-dppd82tc.js +4 -0
  42. package/dist/chunks/quick-search-tdxaam55.js +4 -0
  43. package/dist/chunks/references-vqyr5s9x.js +4 -0
  44. package/dist/chunks/right-panel-0yrw4cgz.js +4 -0
  45. package/dist/chunks/source-control-6fk72me2.js +4 -0
  46. package/dist/chunks/{studio-j3d2fjqz.js → studio-0939t1q1.js} +4 -4
  47. package/dist/chunks/studio-0gvvqj3h.js +5 -0
  48. package/dist/chunks/studio-0khd8xtx.js +4 -0
  49. package/dist/chunks/studio-0w3541dg.js +7 -0
  50. package/dist/chunks/{studio-9b7177jq.js → studio-0x6f3nk9.js} +4 -4
  51. package/dist/chunks/studio-1410q5dw.js +5 -0
  52. package/dist/chunks/{studio-awxwjawq.js → studio-15hwqgd8.js} +4 -4
  53. package/dist/chunks/studio-1ks5d9y4.js +5 -0
  54. package/dist/chunks/{studio-881z1xrx.js → studio-2ggfzrrd.js} +4 -4
  55. package/dist/chunks/{studio-4jhw38b2.js → studio-321ym1tt.js} +4 -4
  56. package/dist/chunks/studio-3c10v2q1.js +5 -0
  57. package/dist/chunks/{studio-bvs9kpst.js → studio-3na1r48j.js} +8 -8
  58. package/dist/chunks/{studio-86r8hp7r.js → studio-3q7mhbgx.js} +5 -5
  59. package/dist/chunks/studio-3qr08sxq.js +4 -0
  60. package/dist/chunks/studio-3xk9zdgb.js +5 -0
  61. package/dist/chunks/{studio-qh8berdz.js → studio-423tfdte.js} +4 -4
  62. package/dist/chunks/{studio-75kcdbsk.js → studio-45mj4jqe.js} +4 -4
  63. package/dist/chunks/studio-4f7thq0p.js +5 -0
  64. package/dist/chunks/studio-4fnb5648.js +5 -0
  65. package/dist/chunks/studio-4zd6an2b.js +5 -0
  66. package/dist/chunks/studio-53wy9ek3.js +5 -0
  67. package/dist/chunks/studio-5n193zqd.js +5 -0
  68. package/dist/chunks/{studio-9rbe2xpw.js → studio-5tet77de.js} +3 -3
  69. package/dist/chunks/{studio-ybnwymxw.js → studio-7rrdbvex.js} +4 -4
  70. package/dist/chunks/studio-8kx6m0rg.js +5 -0
  71. package/dist/chunks/{studio-sxdb9h3q.js → studio-90zkgne5.js} +7 -7
  72. package/dist/chunks/studio-9c6cbq2c.js +4 -0
  73. package/dist/chunks/studio-9dq7rwc7.js +5 -0
  74. package/dist/chunks/{studio-cg1bfyhf.js → studio-9qx1ywbv.js} +8 -8
  75. package/dist/chunks/studio-a65kbs2e.js +9 -0
  76. package/dist/chunks/studio-aam8zt8z.js +5 -0
  77. package/dist/chunks/{studio-er5f383a.js → studio-abh9kfdh.js} +4 -4
  78. package/dist/chunks/studio-b4e0ftkt.js +5 -0
  79. package/dist/chunks/studio-b68k0z00.js +5 -0
  80. package/dist/chunks/{studio-399a25za.js → studio-bct64zmj.js} +4 -4
  81. package/dist/chunks/studio-bz0b5brj.js +6 -0
  82. package/dist/chunks/studio-cfnn70h1.js +5 -0
  83. package/dist/chunks/studio-daksw8kh.js +5 -0
  84. package/dist/chunks/{studio-r7pf0rkv.js → studio-e7vjyp04.js} +7 -7
  85. package/dist/chunks/studio-ea6r1zyr.js +5 -0
  86. package/dist/chunks/studio-egnjpyde.js +9 -0
  87. package/dist/chunks/studio-ejrypvmq.js +5 -0
  88. package/dist/chunks/studio-eqcddvc2.js +928 -0
  89. package/dist/chunks/studio-f8tyeyzt.js +5 -0
  90. package/dist/chunks/studio-fj6c905s.js +5 -0
  91. package/dist/chunks/{studio-646nn2ys.js → studio-fkrr7kgg.js} +5 -5
  92. package/dist/chunks/studio-fspe7m9t.js +5 -0
  93. package/dist/chunks/studio-g0hxtcga.js +5 -0
  94. package/dist/chunks/{studio-th7z3fg7.js → studio-g9brbewz.js} +4 -4
  95. package/dist/chunks/studio-ggx3j7nd.js +5 -0
  96. package/dist/chunks/{studio-43y04qck.js → studio-hfxttkyr.js} +4 -4
  97. package/dist/chunks/studio-hh394phe.js +5 -0
  98. package/dist/chunks/{studio-pjtntksy.js → studio-j0zf5x2x.js} +4 -4
  99. package/dist/chunks/studio-jeb7hth3.js +5 -0
  100. package/dist/chunks/studio-k0xzrse2.js +64 -0
  101. package/dist/chunks/studio-k1xqrgm5.js +5 -0
  102. package/dist/chunks/studio-k2evngrj.js +7 -0
  103. package/dist/chunks/studio-k3we3kqb.js +5 -0
  104. package/dist/chunks/{studio-sevbc3xv.js → studio-n9qba0gx.js} +4 -4
  105. package/dist/chunks/{studio-6hzdjfv0.js → studio-nf8esxxc.js} +4 -4
  106. package/dist/chunks/studio-nn4f9m9c.js +5 -0
  107. package/dist/chunks/studio-nskxe9q1.js +6 -0
  108. package/dist/chunks/{studio-ea74s8c1.js → studio-nvcn2ykc.js} +4 -4
  109. package/dist/chunks/studio-nwynxqtb.js +5 -0
  110. package/dist/chunks/studio-nzemfbkk.js +14 -0
  111. package/dist/chunks/studio-p2a03pgm.js +5 -0
  112. package/dist/chunks/{studio-4g8yb6jn.js → studio-pm17wdc4.js} +4 -4
  113. package/dist/chunks/{studio-71m92v9s.js → studio-q80fg1d6.js} +7 -7
  114. package/dist/chunks/studio-r050sez0.js +6 -0
  115. package/dist/chunks/studio-s7t4vp1d.js +6 -0
  116. package/dist/chunks/studio-s9fng7m8.js +7 -0
  117. package/dist/chunks/studio-sce30r7b.js +4 -0
  118. package/dist/chunks/studio-stahswgb.js +7 -0
  119. package/dist/chunks/studio-swedpd82.js +5 -0
  120. package/dist/chunks/studio-thz5t120.js +5 -0
  121. package/dist/chunks/studio-tpxcryf2.js +5 -0
  122. package/dist/chunks/{studio-wc6za3zs.js → studio-v5wktj6f.js} +4 -4
  123. package/dist/chunks/{studio-kg1abnz0.js → studio-vpevkfxw.js} +4 -4
  124. package/dist/chunks/studio-waekn290.js +5 -0
  125. package/dist/chunks/studio-wfct4h6n.js +5 -0
  126. package/dist/chunks/studio-wgc54sxf.js +5 -0
  127. package/dist/chunks/studio-wqfaqw4m.js +5 -0
  128. package/dist/chunks/studio-wse1rs8t.js +7 -0
  129. package/dist/chunks/studio-x0gsfr1d.js +16 -0
  130. package/dist/chunks/{studio-hhp4x8xf.js → studio-xpx91fby.js} +5 -5
  131. package/dist/chunks/studio-y1b86ast.js +5 -0
  132. package/dist/chunks/studio-yrcrncev.js +5 -0
  133. package/dist/chunks/{studio-rzqaz21g.js → studio-yzpskb0j.js} +4 -4
  134. package/dist/chunks/studio-zfdbmhp3.js +5 -0
  135. package/dist/chunks/{tsMode-f54j66ym.js → tsMode-jg1dtphj.js} +7 -7
  136. package/dist/chunks/workspace-9btkc8tk.js +4 -0
  137. package/dist/chunks/workspace-home-qcc4z5ag.js +4 -0
  138. package/dist/chunks/{ws-client-e8kj684q.js → ws-client-arz2qsy9.js} +3 -3
  139. package/dist/iframe-entry.js +13 -13
  140. package/dist/manifest.json +83 -78
  141. package/dist/studio.js +84 -84
  142. package/package.json +2 -2
  143. package/src/browse/library-pane.ts +44 -29
  144. package/src/browse/library-preview.ts +6 -2
  145. package/src/canvas/asset-refs.ts +13 -4
  146. package/src/canvas/asset-resolve.ts +54 -11
  147. package/src/canvas/canvas-render.ts +25 -0
  148. package/src/canvas/iframe-entry.ts +5 -1
  149. package/src/canvas/iframe-host.ts +16 -6
  150. package/src/canvas/iframe-protocol.ts +9 -1
  151. package/src/commands/context.ts +5 -0
  152. package/src/commands/live-context.ts +5 -2
  153. package/src/editor/shortcuts.ts +3 -0
  154. package/src/files/asset-versions.ts +108 -2
  155. package/src/files/file-ops.ts +11 -1
  156. package/src/files/files.ts +111 -48
  157. package/src/files/media-paths.ts +12 -4
  158. package/src/files/media-upload.ts +195 -21
  159. package/src/files/new-file-name.ts +39 -1
  160. package/src/media/image-bake.ts +164 -0
  161. package/src/media/image-editor.ts +846 -0
  162. package/src/media/image-format.ts +262 -0
  163. package/src/media/image-recipe.ts +651 -0
  164. package/src/media/media-commands.ts +65 -1
  165. package/src/media/media-library-model.ts +1 -1
  166. package/src/media/media-library.ts +175 -15
  167. package/src/media/media-open.ts +156 -3
  168. package/src/media/media-pane.ts +8 -4
  169. package/src/panels/pane-context.ts +6 -1
  170. package/src/panels/tab-strip.ts +12 -3
  171. package/src/studio.ts +13 -2
  172. package/src/surfaces/image-editor.json +1390 -0
  173. package/src/surfaces/image-editor.ts +272 -0
  174. package/src/surfaces/media-library.json +129 -1
  175. package/src/surfaces/media-library.ts +17 -2
  176. package/src/types.ts +2 -1
  177. package/src/workspace/tab-workspace.ts +2 -1
  178. package/src/workspace/workspace-switch.ts +3 -1
  179. package/src/workspace/workspace.ts +22 -1
  180. package/dist/chunks/adapter-pp011m5x.js +0 -4
  181. package/dist/chunks/add-new-flow-ecqmzz76.js +0 -4
  182. package/dist/chunks/cf-account-picker-c07znkqt.js +0 -4
  183. package/dist/chunks/cf-settings-0v2bmqy0.js +0 -4
  184. package/dist/chunks/components-yn0dn2pq.js +0 -4
  185. package/dist/chunks/content-source-g0j41yy6.js +0 -4
  186. package/dist/chunks/convert-to-repeater-sbjk7tgn.js +0 -4
  187. package/dist/chunks/editor-xz02jeh1.js +0 -4
  188. package/dist/chunks/entry-commands-kmt02crp.js +0 -4
  189. package/dist/chunks/extension-sections-0rprf12d.js +0 -4
  190. package/dist/chunks/file-ops-mexj5qed.js +0 -4
  191. package/dist/chunks/files-b2tcppdd.js +0 -4
  192. package/dist/chunks/format-host-btsevv0c.js +0 -4
  193. package/dist/chunks/fs-events-r0apejva.js +0 -4
  194. package/dist/chunks/grid-open-n2a8xkht.js +0 -4
  195. package/dist/chunks/icons-853n6qt3.js +0 -4
  196. package/dist/chunks/iframe-host-gx0ypyh3.js +0 -4
  197. package/dist/chunks/index-bs4k9tr6.js +0 -4
  198. package/dist/chunks/jx-validate-ymf10teh.js +0 -4
  199. package/dist/chunks/layers-p9nfya38.js +0 -4
  200. package/dist/chunks/layers-panel-tt1hzhhf.js +0 -4
  201. package/dist/chunks/lit-html-x18n2sfz.js +0 -4
  202. package/dist/chunks/media-library-0n45gv8r.js +0 -4
  203. package/dist/chunks/media-picker-s09at95z.js +0 -4
  204. package/dist/chunks/monaco-buffer-een2ea0v.js +0 -4
  205. package/dist/chunks/notify-qwb8radt.js +0 -4
  206. package/dist/chunks/parse-v77xtwv7.js +0 -4
  207. package/dist/chunks/platform-8jnez0wr.js +0 -4
  208. package/dist/chunks/publish-panel-aysnj611.js +0 -4
  209. package/dist/chunks/publish-quick-kpbqs9mz.js +0 -4
  210. package/dist/chunks/publish-workspace-nd0a8q99.js +0 -4
  211. package/dist/chunks/quick-search-vg0jkhk2.js +0 -4
  212. package/dist/chunks/references-a7v6a0e2.js +0 -4
  213. package/dist/chunks/right-panel-cvk1vxx5.js +0 -4
  214. package/dist/chunks/source-control-fsqzc6he.js +0 -4
  215. package/dist/chunks/studio-05jfwbmf.js +0 -5
  216. package/dist/chunks/studio-0q5jwddh.js +0 -9
  217. package/dist/chunks/studio-0w2dr0q8.js +0 -5
  218. package/dist/chunks/studio-1tzpds97.js +0 -9
  219. package/dist/chunks/studio-216b27sv.js +0 -4
  220. package/dist/chunks/studio-2ejhqns4.js +0 -5
  221. package/dist/chunks/studio-2r90cts3.js +0 -16
  222. package/dist/chunks/studio-399xknkb.js +0 -6
  223. package/dist/chunks/studio-4ncmwqw5.js +0 -5
  224. package/dist/chunks/studio-5atwjgkj.js +0 -7
  225. package/dist/chunks/studio-5frqk7c0.js +0 -5
  226. package/dist/chunks/studio-6cwj6xrx.js +0 -5
  227. package/dist/chunks/studio-78pywnp2.js +0 -6
  228. package/dist/chunks/studio-886t6ztg.js +0 -5
  229. package/dist/chunks/studio-8wnvtr4z.js +0 -5
  230. package/dist/chunks/studio-8z66jk4z.js +0 -5
  231. package/dist/chunks/studio-b2qpt0xy.js +0 -14
  232. package/dist/chunks/studio-c71806xz.js +0 -7
  233. package/dist/chunks/studio-cbwks69x.js +0 -928
  234. package/dist/chunks/studio-cg710sk9.js +0 -5
  235. package/dist/chunks/studio-cw0wb9qk.js +0 -7
  236. package/dist/chunks/studio-cyheys7k.js +0 -5
  237. package/dist/chunks/studio-ea5m9kg5.js +0 -5
  238. package/dist/chunks/studio-efdxjwyp.js +0 -64
  239. package/dist/chunks/studio-egmw2837.js +0 -5
  240. package/dist/chunks/studio-f746039f.js +0 -5
  241. package/dist/chunks/studio-fmdymd9v.js +0 -5
  242. package/dist/chunks/studio-gcm12z00.js +0 -6
  243. package/dist/chunks/studio-gj98m8gy.js +0 -7
  244. package/dist/chunks/studio-hasbgjah.js +0 -5
  245. package/dist/chunks/studio-hz5n7x27.js +0 -5
  246. package/dist/chunks/studio-jeraxdgv.js +0 -7
  247. package/dist/chunks/studio-jvgek9xt.js +0 -5
  248. package/dist/chunks/studio-jws1a87n.js +0 -5
  249. package/dist/chunks/studio-k2sz13zg.js +0 -5
  250. package/dist/chunks/studio-k3m4jkdk.js +0 -5
  251. package/dist/chunks/studio-kg5ya5r2.js +0 -5
  252. package/dist/chunks/studio-khwbgrtg.js +0 -5
  253. package/dist/chunks/studio-mx6wzh25.js +0 -5
  254. package/dist/chunks/studio-mxs3ar9t.js +0 -5
  255. package/dist/chunks/studio-nm4szey4.js +0 -5
  256. package/dist/chunks/studio-nqxqf8p2.js +0 -4
  257. package/dist/chunks/studio-qn7z4krm.js +0 -5
  258. package/dist/chunks/studio-qyed0ah6.js +0 -5
  259. package/dist/chunks/studio-r4bcdwhq.js +0 -5
  260. package/dist/chunks/studio-rtfnhrdg.js +0 -5
  261. package/dist/chunks/studio-s5tzw84t.js +0 -5
  262. package/dist/chunks/studio-t51y8v1d.js +0 -5
  263. package/dist/chunks/studio-t98vq4r6.js +0 -5
  264. package/dist/chunks/studio-tsxpqvh0.js +0 -6
  265. package/dist/chunks/studio-v1yascv2.js +0 -5
  266. package/dist/chunks/studio-wxq6v5sv.js +0 -5
  267. package/dist/chunks/studio-y60sts62.js +0 -4
  268. package/dist/chunks/studio-zndrqawb.js +0 -5
  269. package/dist/chunks/studio-zwaxn5s2.js +0 -5
  270. package/dist/chunks/workspace-home-x1787wpv.js +0 -4
  271. package/dist/chunks/workspace-zpe1np43.js +0 -4
@@ -1,9 +1,9 @@
1
- import{n,_}from"./studio-8z66jk4z.js";var os=Math.floor;var nt=Math.abs;var ue=(t,e)=>t<e?t:e,Z=(t,e)=>t>e?t:e;var de=(t)=>t!==0?t<0:1/t<0;var cn=1,ln=2,fe=4,pe=8;var dt=32,F=64,D=128;var Vt=31,Mt=63,X=127;var fr=2147483647;var{MAX_SAFE_INTEGER:ft,MIN_SAFE_INTEGER:hn}=Number;var pr=Number.isInteger||((t)=>typeof t==="number"&&isFinite(t)&&os(t)===t);var G=()=>new Set;var ge=(t)=>t[t.length-1];var gr=(t,e)=>{for(let r=0;r<e.length;r++)t.push(e[r])},j=Array.from,me=(t,e)=>{for(let r=0;r<t.length;r++)if(!e(t[r],r,t))return!1;return!0},$t=(t,e)=>{for(let r=0;r<t.length;r++)if(e(t[r],r,t))return!0;return!1};var mr=(t,e)=>{let r=Array(t);for(let s=0;s<t;s++)r[s]=e(s,r);return r};var Q=Array.isArray;var{fromCharCode:fn,fromCodePoint:yi}=String,Zc=fn(65535),bi=(t)=>t.toLowerCase(),ki=/^\s*/g,_i=(t)=>t.replace(ki,""),Si=/([A-Z])/g,pn=(t,e)=>_i(t.replace(Si,(r)=>`${e}${bi(r)}`));var Ei=(t)=>{let e=unescape(encodeURIComponent(t)),r=e.length,s=new Uint8Array(r);for(let i=0;i<r;i++)s[i]=e.codePointAt(i);return s},gt=typeof TextEncoder<"u"?new TextEncoder:null,Ii=(t)=>gt.encode(t),wr=gt?Ii:Ei;var pt=typeof TextDecoder>"u"?null:new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0});if(pt&&pt.decode(new Uint8Array).length===1)pt=null;var xr=(t,e)=>mr(e,()=>t).join("");class wt{constructor(){this.cpos=0,this.cbuf=new Uint8Array(100),this.bufs=[]}}var Za=()=>new wt;var fk=(t)=>{let e=t.cpos;for(let r=0;r<t.bufs.length;r++)e+=t.bufs[r].length;return e};var br=(t)=>{let e=new Uint8Array(fk(t)),r=0;for(let s=0;s<t.bufs.length;s++){let i=t.bufs[s];e.set(i,r),r+=i.length}return e.set(new Uint8Array(t.cbuf.buffer,0,t.cpos),r),e},Ui=(t,e)=>{let r=t.cbuf.length;if(r-t.cpos<e)t.bufs.push(new Uint8Array(t.cbuf.buffer,0,t.cpos)),t.cbuf=new Uint8Array(Z(r,e)*2),t.cpos=0},T=(t,e)=>{let r=t.cbuf.length;if(t.cpos===r)t.bufs.push(t.cbuf),t.cbuf=new Uint8Array(r*2),t.cpos=0;t.cbuf[t.cpos++]=e};var xe=T;var _t=(t,e)=>{while(e>X)T(t,D|X&e),e=os(e/128);T(t,X&e)},ye=(t,e)=>{let r=de(e);if(r)e=-e;T(t,(e>Mt?D:0)|(r?F:0)|Mt&e),e=os(e/64);while(e>0)T(t,(e>X?D:0)|X&e),e=os(e/128)},gn=new Uint8Array(30000),Ti=gn.length/3,Ai=(t,e)=>{if(e.length<Ti){let r=gt.encodeInto(e,gn).written||0;_t(t,r);for(let s=0;s<r;s++)T(t,gn[s])}else zo(t,wr(e))},Ci=(t,e)=>{let r=unescape(encodeURIComponent(e)),s=r.length;_t(t,s);for(let i=0;i<s;i++)T(t,r.codePointAt(i))},Xa=gt&&gt.encodeInto?Ai:Ci;var jt=(t,e)=>{let r=t.cbuf.length,s=t.cpos,i=ue(r-s,e.length),o=e.length-i;if(t.cbuf.set(e.subarray(0,i),s),t.cpos+=i,o>0)t.bufs.push(t.cbuf),t.cbuf=new Uint8Array(Z(r*2,o)),t.cbuf.set(e.subarray(i)),t.cpos=o},zo=(t,e)=>{_t(t,e.byteLength),jt(t,e)},mn=(t,e)=>{Ui(t,e);let r=new DataView(t.cbuf.buffer,t.cpos,e);return t.cpos+=e,r},Di=(t,e)=>mn(t,4).setFloat32(0,e,!1),Bi=(t,e)=>mn(t,8).setFloat64(0,e,!1),Oi=(t,e)=>mn(t,8).setBigInt64(0,e,!1);var yr=new DataView(new ArrayBuffer(4)),vi=(t)=>(yr.setFloat32(0,t),yr.getFloat32(0)===t),mt=(t,e)=>{switch(typeof e){case"string":T(t,119),Xa(t,e);break;case"number":if(pr(e)&&nt(e)<=fr)T(t,125),ye(t,e);else if(vi(e))T(t,124),Di(t,e);else T(t,123),Bi(t,e);break;case"bigint":T(t,122),Oi(t,e);break;case"object":if(e===null)T(t,126);else if(Q(e)){T(t,117),_t(t,e.length);for(let r=0;r<e.length;r++)mt(t,e[r])}else if(e instanceof Uint8Array)T(t,116),zo(t,e);else{T(t,118);let r=Object.keys(e);_t(t,r.length);for(let s=0;s<r.length;s++){let i=r[s];Xa(t,i),mt(t,e[i])}}break;case"boolean":T(t,e?120:121);break;default:T(t,127)}};class be extends wt{constructor(t){super();this.w=t,this.s=null,this.count=0}write(t){if(this.s===t)this.count++;else{if(this.count>0)_t(this,this.count-1);this.count=1,this.w(this,t),this.s=t}}}var kr=(t)=>{if(t.count>0){if(ye(t.encoder,t.count===1?t.s:-t.s),t.count>1)_t(t.encoder,t.count-2)}};class xt{constructor(){this.encoder=new wt,this.s=0,this.count=0}write(t){if(this.s===t)this.count++;else kr(this),this.count=1,this.s=t}toUint8Array(){return kr(this),br(this.encoder)}}var _r=(t)=>{if(t.count>0){let e=t.diff*2+(t.count===1?0:1);if(ye(t.encoder,e),t.count>1)_t(t.encoder,t.count-2)}};class qt{constructor(){this.encoder=new wt,this.s=0,this.count=0,this.diff=0}write(t){if(this.diff===t-this.s)this.s=t,this.count++;else _r(this),this.count=1,this.diff=t-this.s,this.s=t}toUint8Array(){return _r(this),br(this.encoder)}}class wn{constructor(){this.sarr=[],this.s="",this.lensE=new xt}write(t){if(this.s+=t,this.s.length>19)this.sarr.push(this.s),this.s="";this.lensE.write(t.length)}toUint8Array(){let t=new wt;return this.sarr.push(this.s),this.s="",Xa(t,this.sarr.join("")),jt(t,this.lensE.toUint8Array()),br(t)}}var R=(t)=>Error(t),L=()=>{throw R("Method unimplemented")},v=()=>{throw R("Unexpected case")};var ke=R("Unexpected end of array"),Er=R("Integer out of Range"),Ni=(t,e,r)=>{if(e<0||r<0||e+r>t.length)throw ke;return new Uint8Array(t.buffer,t.byteOffset+e,r)},Ri=(t,e,r)=>{if(e<0||r<0||e+r>t.length)throw ke;return new DataView(t.buffer,t.byteOffset+e,r)};class Gt{constructor(t){this.arr=t,this.pos=0}}var Qa=(t)=>new Gt(t),Ir=(t)=>t.pos!==t.arr.length;var Li=(t,e)=>{let r=Ni(t.arr,t.pos,e);return t.pos+=e,r},Xo=(t)=>Li(t,Dt(t));var rt=(t)=>t.arr[t.pos++];var Dt=(t)=>{let e=0,r=1,s=t.arr.length;while(t.pos<s){let i=t.arr[t.pos++];if(e=e+(i&X)*r,r*=128,i<D)return e;if(e>ft)throw Er}throw ke},_e=(t)=>{let e=t.arr[t.pos++],r=e&Mt,s=64,i=(e&F)>0?-1:1;if((e&D)===0)return i*r;let o=t.arr.length;while(t.pos<o){if(e=t.arr[t.pos++],r=r+(e&X)*s,s*=128,e<D)return i*r;if(r>ft)throw Er}throw ke};var Vi=(t)=>{let e=Dt(t);if(e===0)return"";else{let r=String.fromCodePoint(rt(t));if(--e<100)while(e--)r+=String.fromCodePoint(rt(t));else while(e>0){let s=e<1e4?e:1e4,i=t.arr.subarray(t.pos,t.pos+s);t.pos+=s,r+=String.fromCodePoint.apply(null,i),e-=s}return decodeURIComponent(escape(r))}},Mi=(t)=>pt.decode(Xo(t)),el=pt?Mi:Vi;var yn=(t,e)=>{let r=Ri(t.arr,t.pos,e);return t.pos+=e,r},$i=(t)=>yn(t,4).getFloat32(0,!1),Fi=(t)=>yn(t,8).getFloat64(0,!1),ji=(t)=>yn(t,8).getBigInt64(0,!1);var qi=[(t)=>{return},(t)=>null,_e,$i,Fi,ji,(t)=>!1,(t)=>!0,el,(t)=>{let e=Dt(t),r={};for(let s=0;s<e;s++){let i=el(t);r[i]=yt(t)}return r},(t)=>{let e=Dt(t),r=[];for(let s=0;s<e;s++)r.push(yt(t));return r},Xo],yt=(t)=>qi[127-rt(t)](t);class Se extends Gt{constructor(t,e){super(t);this.reader=e,this.s=null,this.count=0}read(){if(this.count===0)if(this.s=this.reader(this),Ir(this))this.count=Dt(this)+1;else this.count=-1;return this.count--,this.s}}class bt extends Gt{constructor(t){super(t);this.s=0,this.count=0}read(){if(this.count===0){this.s=_e(this);let t=de(this.s);if(this.count=1,t)this.s=-this.s,this.count=Dt(this)+2}return this.count--,this.s}}class zt extends Gt{constructor(t){super(t);this.s=0,this.count=0,this.diff=0}read(){if(this.count===0){let t=_e(this),e=t&1;if(this.diff=os(t/2),this.count=1,e)this.count=Dt(this)+2}return this.s+=this.diff,this.count--,this.s}}class bn{constructor(t){this.decoder=new bt(t),this.str=el(this.decoder),this.spos=0}read(){let t=this.spos+this.decoder.read(),e=this.str.slice(this.spos,t);return this.spos=t,e}}var A=()=>new Map,Ee=(t)=>{let e=A();return t.forEach((r,s)=>{e.set(s,r)}),e},q=(t,e,r)=>{let s=t.get(e);if(s===void 0)t.set(e,s=r());return s},Tr=(t,e)=>{let r=[];for(let[s,i]of t)r.push(e(i,s));return r},Ar=(t,e)=>{for(let[r,s]of t)if(e(s,r))return!0;return!1};class Ie{constructor(){this._observers=A()}on(t,e){return q(this._observers,t,G).add(e),e}once(t,e){let r=(...s)=>{this.off(t,r),e(...s)};this.on(t,r)}off(t,e){let r=this._observers.get(t);if(r!==void 0){if(r.delete(e),r.size===0)this._observers.delete(t)}}emit(t,e){return j((this._observers.get(t)||A()).values()).forEach((r)=>r(...e))}destroy(){this._observers=A()}}class pk{constructor(){this._observers=A()}on(t,e){q(this._observers,t,G).add(e)}once(t,e){let r=(...s)=>{this.off(t,r),e(...s)};this.on(t,r)}off(t,e){let r=this._observers.get(t);if(r!==void 0){if(r.delete(e),r.size===0)this._observers.delete(t)}}emit(t,e){return j((this._observers.get(t)||A()).values()).forEach((r)=>r(...e))}destroy(){this._observers=A()}}var tl=crypto.subtle,Cr=crypto.getRandomValues.bind(crypto);var kn=()=>Cr(new Uint32Array(1))[0];var Gi=[1e7]+-1000+-4000+-8000+-100000000000,Dr=()=>Gi.replace(/[018]/g,(t)=>(t^kn()&15>>t/4).toString(16));var Su=Date.now;var _n=(t)=>new Promise(t);var sl=Promise.all.bind(Promise);var Sn=(t)=>t===void 0?null:t;class Or{constructor(){this.map=new Map}setItem(t,e){this.map.set(t,e)}getItem(t){return this.map.get(t)}}var vr=new Or,Pi=!0;try{if(typeof localStorage<"u"&&localStorage)vr=localStorage,Pi=!1}catch(t){}var Nr=vr;var st=Symbol("Equality"),Ue=(t,e)=>t===e||!!t?.[st]?.(e)||!1;var Rr=(t)=>typeof t==="object",{assign:Lr,keys:Wi}=Object;var Vr=(t,e)=>{for(let r in t)e(t[r],r)};var Jt=(t)=>Wi(t).length;var Mr=(t)=>{for(let e in t)return!1;return!0},kt=(t,e)=>{for(let r in t)if(!e(t[r],r))return!1;return!0},Pt=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),In=(t,e)=>t===e||Jt(t)===Jt(e)&&kt(t,(r,s)=>(r!==void 0||Pt(e,s))&&Ue(e[s],r)),Zi=Object.freeze,Un=(t)=>{for(let e in t){let r=t[e];if(typeof r==="object"||typeof r==="function")Un(t[e])}return Zi(t)};var Kt=(t,e,r=0)=>{try{for(;r<t.length;r++)t[r](...e)}finally{if(r<t.length)Kt(t,e,r+1)}};var $r=(t)=>t;var rp=(t,e)=>{if(t===e)return!0;if(t==null||e==null||t.constructor!==e.constructor&&(t.constructor||Object)!==(e.constructor||Object))return!1;if(t[st]!=null)return t[st](e);switch(t.constructor){case ArrayBuffer:t=new Uint8Array(t),e=new Uint8Array(e);case Uint8Array:{if(t.byteLength!==e.byteLength)return!1;for(let r=0;r<t.length;r++)if(t[r]!==e[r])return!1;break}case Set:{if(t.size!==e.size)return!1;for(let r of t)if(!e.has(r))return!1;break}case Map:{if(t.size!==e.size)return!1;for(let r of t.keys())if(!e.has(r)||!rp(t.get(r),e.get(r)))return!1;break}case void 0:case Object:if(Jt(t)!==Jt(e))return!1;for(let r in t)if(!Pt(t,r)||!rp(t[r],e[r]))return!1;break;case Array:if(t.length!==e.length)return!1;for(let r=0;r<t.length;r++)if(!rp(t[r],e[r]))return!1;break;default:return!1}return!0},Fr=(t,e)=>e.includes(t);var Wt=typeof process<"u"&&process.release&&/node|io\.js/.test(process.release.name)&&Object.prototype.toString.call(typeof process<"u"?process:0)==="[object process]";var il=typeof navigator<"u"?/Mac/.test(navigator.platform):!1,z,Xi=[],Qi=()=>{if(z===void 0)if(Wt){z=A();let t=process.argv,e=null;for(let r=0;r<t.length;r++){let s=t[r];if(s[0]==="-"){if(e!==null)z.set(e,"");e=s}else if(e!==null)z.set(e,s),e=null;else Xi.push(s)}if(e!==null)z.set(e,"")}else if(typeof location==="object")z=A(),(location.search||"?").slice(1).split("&").forEach((t)=>{if(t.length!==0){let[e,r]=t.split("=");z.set(`--${pn(e,"-")}`,r),z.set(`-${pn(e,"-")}`,r)}});else z=A();return z},Cn=(t)=>Qi().has(t);var Zt=(t)=>Wt?Sn(process.env[t.toUpperCase().replaceAll("-","_")]):Sn(Nr.getItem(t));var jr=(t)=>Cn("--"+t)||Zt(t)!==null,qr=jr("production"),Yi=Wt&&Fr(process.env.FORCE_COLOR,["true","1","2"]),Gr=Yi||!Cn("--no-colors")&&!jr("no-color")&&(!Wt||process.stdout.isTTY)&&(!Wt||Cn("--color")||Zt("COLORTERM")!==null||(Zt("TERM")||"").includes("color"));var to=(t)=>new Uint8Array(t);var zr=(t)=>{let e=to(t.byteLength);return e.set(t),e};class Hr{constructor(t,e){this.left=t,this.right=e}}var H=(t,e)=>new Hr(t,e);var Bn=(t)=>t.next()>=0.5,Te=(t,e,r)=>os(t.next()*(r+1-e)+e);var On=(t,e,r)=>os(t.next()*(r+1-e)+e);var vn=(t,e,r)=>On(t,e,r);var ro=(t)=>fn(vn(t,97,122)),Jr=(t,e=0,r=20)=>{let s=vn(t,e,r),i="";for(let o=0;o<s;o++)i+=ro(t);return i};var Ae=(t,e)=>e[vn(t,0,e.length-1)];var io=Symbol("0schema");class Kr{constructor(){this._rerrs=[]}extend(t,e,r,s=null){this._rerrs.push({path:t,expected:e,has:r,message:s})}toString(){let t=[];for(let e=this._rerrs.length-1;e>0;e--){let r=this._rerrs[e];t.push(xr(" ",(this._rerrs.length-e)*2)+`${r.path!=null?`[${r.path}] `:""}${r.has} doesn't match ${r.expected}. ${r.message}`)}return t.join(`
2
- `)}}var Nn=(t,e)=>{if(t===e)return!0;if(t==null||e==null||t.constructor!==e.constructor)return!1;if(t[st])return Ue(t,e);if(Q(t))return me(t,(r)=>$t(e,(s)=>Nn(r,s)));else if(Rr(t))return kt(t,(r,s)=>Nn(r,e[s]));return!1};class B{static _dilutes=!1;extends(t){let[e,r]=[this.shape,t.shape];if(this.constructor._dilutes)[r,e]=[e,r];return Nn(e,r)}equals(t){return this.constructor===t.constructor&&rp(this.shape,t.shape)}[io](){return!0}[st](t){return this.equals(t)}validate(t){return this.check(t)}check(t,e){L()}get nullable(){return Ut(this,Ve)}get optional(){return new Rn(this)}cast(t){return Pr(t,this),t}expect(t){return Pr(t,this),t}}class Be extends B{constructor(t,e){super();this.shape=t,this._c=e}check(t,e=void 0){let r=t?.constructor===this.shape&&(this._c==null||this._c(t));return!r&&e?.extend(null,this.shape.name,t?.constructor.name,t?.constructor!==this.shape?"Constructor match failed":"Check failed"),r}}var S=(t,e=null)=>new Be(t,e),cl=S(Be);class Oe extends B{constructor(t){super();this.shape=t}check(t,e){let r=this.shape(t);return!r&&e?.extend(null,"custom prop",t?.constructor.name,"failed to check custom prop"),r}}var E=(t)=>new Oe(t),ll=S(Oe);class Qt extends B{constructor(t){super();this.shape=t}check(t,e){let r=this.shape.some((s)=>s===t);return!r&&e?.extend(null,this.shape.join(" | "),t.toString()),r}}var ve=(...t)=>new Qt(t),Wr=S(Qt),oo=RegExp.escape||((t)=>t.replace(/[().|&,$^[\]]/g,(e)=>"\\"+e)),Zr=(t)=>{if(It.check(t))return[oo(t)];if(Wr.check(t))return t.shape.map((e)=>e+"");if(cs.check(t))return["[+-]?\\d+.?\\d*"];if(ls.check(t))return[".*"];if(Ce.check(t))return t.shape.map(Zr).flat(1);v()};class Xr extends B{constructor(t){super();this.shape=t,this._r=new RegExp("^"+t.map(Zr).map((e)=>`(${e.join("|")})`).join("")+"$")}check(t,e){let r=this._r.exec(t)!=null;return!r&&e?.extend(null,this._r.toString(),t.toString(),"String doesn't match string template."),r}}var al=S(Xr),co=Symbol("optional");class Rn extends B{constructor(t){super();this.shape=t}check(t,e){let r=t===void 0||this.shape.check(t);return!r&&e?.extend(null,"undefined (optional)","()"),r}get[co](){return!0}}var lo=S(Rn);class Ln extends B{check(t,e){return e?.extend(null,"never",typeof t),!1}}var hl=new Ln,ul=S(Ln);class Ne extends B{constructor(t,e=!1){super();this.shape=t,this._isPartial=e}static _dilutes=!0;get partial(){return new Ne(this.shape,!0)}check(t,e){if(t==null)return e?.extend(null,"object","null"),!1;return kt(this.shape,(r,s)=>{let i=this._isPartial&&!Pt(t,s)||r.check(t[s],e);return!i&&e?.extend(s.toString(),r.toString(),typeof t[s],"Object property does not match"),i})}}var ao=(t)=>new Ne(t),ho=S(Ne),uo=E((t)=>t!=null&&(t.constructor===Object||t.constructor==null));class Vn extends B{constructor(t,e){super();this.shape={keys:t,values:e}}check(t,e){return t!=null&&kt(t,(r,s)=>{let i=this.shape.keys.check(s,e);return!i&&e?.extend(s+"","Record",typeof t,i?"Key doesn't match schema":"Value doesn't match value"),i&&this.shape.values.check(r,e)})}}var Qr=(t,e)=>new Vn(t,e),fo=S(Vn);class Mn extends B{constructor(t){super();this.shape=t}check(t,e){return t!=null&&kt(this.shape,(r,s)=>{let i=r.check(t[s],e);return!i&&e?.extend(s.toString(),"Tuple",typeof r),i})}}var po=(...t)=>new Mn(t),dl=S(Mn);class $n extends B{constructor(t){super();this.shape=t.length===1?t[0]:new Re(t)}check(t,e){let r=Q(t)&&me(t,(s)=>this.shape.check(s));return!r&&e?.extend(null,"Array",""),r}}var Yr=(...t)=>new $n(t),go=S($n),mo=E((t)=>Q(t));class Fn extends B{constructor(t,e){super();this.shape=t,this._c=e}check(t,e){let r=t instanceof this.shape&&(this._c==null||this._c(t));return!r&&e?.extend(null,this.shape.name,t?.constructor.name),r}}var wo=(t,e=null)=>new Fn(t,e),fl=S(Fn),xo=wo(B);class ts extends B{constructor(t){super();this.len=t.length-1,this.args=po(...t.slice(-1)),this.res=t[this.len]}check(t,e){let r=t.constructor===Function&&t.length<=this.len;return!r&&e?.extend(null,"function",typeof t),r}}var yo=S(ts),bo=E((t)=>typeof t==="function");class es extends B{constructor(t){super();this.shape=t}check(t,e){let r=me(this.shape,(s)=>s.check(t,e));return!r&&e?.extend(null,"Intersectinon",typeof t),r}}var pl=S(es,(t)=>t.shape.length>0);class Re extends B{static _dilutes=!0;constructor(t){super();this.shape=t}check(t,e){let r=$t(this.shape,(s)=>s.check(t,e));return e?.extend(null,"Union",typeof t),r}}var Ut=(...t)=>t.findIndex((e)=>Ce.check(e))>=0?Ut(...t.map((e)=>Xt(e)).map((e)=>Ce.check(e)?e.shape:[e]).flat(1)):t.length===1?t[0]:new Re(t),Ce=S(Re),ns=()=>!0,De=E(ns),ko=S(Oe,(t)=>t.shape===ns),jn=E((t)=>typeof t==="bigint"),_o=E((t)=>t===jn),is=E((t)=>typeof t==="symbol"),gl=E((t)=>t===is),Et=E((t)=>typeof t==="number"),cs=E((t)=>t===Et),It=E((t)=>typeof t==="string"),ls=E((t)=>t===It),Le=E((t)=>typeof t==="boolean"),So=E((t)=>t===Le),as=ve(void 0),ml=S(Qt,(t)=>t.shape.length===1&&t.shape[0]===void 0),wl=ve(void 0);var Ve=ve(null),Eo=S(Qt,(t)=>t.shape.length===1&&t.shape[0]===null),xl=S(Uint8Array),yl=S(Be,(t)=>t.shape===Uint8Array),Io=Ut(Et,It,Ve,as,jn,Le,is),bl=(()=>{let t=Yr(De),e=Qr(It,De),r=Ut(Et,It,Ve,Le,t,e);return t.shape=r,e.shape.values=r,r})(),Xt=(t)=>{if(xo.check(t))return t;else if(uo.check(t)){let e={};for(let r in t)e[r]=Xt(t[r]);return ao(e)}else if(mo.check(t))return Ut(...t.map(Xt));else if(Io.check(t))return ve(t);else if(bo.check(t))return S(t);v()},Pr=qr?()=>{}:(t,e)=>{let r=new Kr;if(!e.check(t,r))throw R(`Expected value to be of type ${e.constructor.name}.
3
- ${r.toString()}`)};class hs{constructor(t){this.patterns=[],this.$state=t}if(t,e){return this.patterns.push({if:Xt(t),h:e}),this}else(t){return this.if(De,t)}done(){return(t,e)=>{for(let r=0;r<this.patterns.length;r++){let s=this.patterns[r];if(s.if.check(t))return s.h(t,e)}throw R("Unhandled pattern")}}}var Uo=(t)=>new hs(t),us=Uo(De).if(cs,(t,e)=>Te(e,hn,ft)).if(ls,(t,e)=>Jr(e)).if(So,(t,e)=>Bn(e)).if(_o,(t,e)=>BigInt(Te(e,hn,ft))).if(Ce,(t,e)=>St(e,Ae(e,t.shape))).if(ho,(t,e)=>{let r={};for(let s in t.shape){let i=t.shape[s];if(lo.check(i)){if(Bn(e))continue;i=i.shape}r[s]=us(i,e)}return r}).if(go,(t,e)=>{let r=[],s=On(e,0,42);for(let i=0;i<s;i++)r.push(St(e,t.shape));return r}).if(Wr,(t,e)=>Ae(e,t.shape)).if(Eo,(t,e)=>null).if(yo,(t,e)=>{let r=St(e,t.res);return()=>r}).if(ko,(t,e)=>St(e,Ae(e,[Et,It,Ve,as,jn,Le,Yr(Et),Qr(Ut("a","b","c"),Et)]))).if(fo,(t,e)=>{let r={},s=Te(e,0,3);for(let i=0;i<s;i++){let o=St(e,t.shape.keys),c=St(e,t.shape.values);r[o]=c}return r}).done(),St=(t,e)=>us(Xt(e),t);var it=typeof document<"u"?document:{};var kl=E((t)=>t.nodeType===Bo);var _l=typeof DOMParser<"u"?new DOMParser:null;var Sl=E((t)=>t.nodeType===Ao);var El=E((t)=>t.nodeType===Co);var ds=(t)=>Tr(t,(e,r)=>`${r}:${e};`).join("");var{ELEMENT_NODE:Ao,TEXT_NODE:Co,CDATA_SECTION_NODE:Il,COMMENT_NODE:Ul,DOCUMENT_NODE:Do,DOCUMENT_TYPE_NODE:Tl,DOCUMENT_FRAGMENT_NODE:Bo}=it,Al=E((t)=>t.nodeType===Do);var J=Symbol;var Yt=J(),te=J(),qn=J(),Gn=J(),zn=J(),ee=J(),Hn=J(),Tt=J(),Jn=J(),fs=(t)=>{if(t.length===1&&t[0]?.constructor===Function)t=t[0]();let e=[],r=[],s=0;for(;s<t.length;s++){let i=t[s];if(i===void 0)break;else if(i.constructor===String||i.constructor===Number)e.push(i);else if(i.constructor===Object)break}if(s>0)r.push(e.join(""));for(;s<t.length;s++){let i=t[s];if(!(i instanceof Symbol))r.push(i)}return r};var Cl=Su();var Ro={[Yt]:H("font-weight","bold"),[te]:H("font-weight","normal"),[qn]:H("color","blue"),[zn]:H("color","green"),[Gn]:H("color","grey"),[ee]:H("color","red"),[Hn]:H("color","purple"),[Tt]:H("color","orange"),[Jn]:H("color","black")},Lo=(t)=>{if(t.length===1&&t[0]?.constructor===Function)t=t[0]();let e=[],r=[],s=A(),i=[],o=0;for(;o<t.length;o++){let c=t[o],l=Ro[c];if(l!==void 0)s.set(l.left,l.right);else{if(c===void 0)break;if(c.constructor===String||c.constructor===Number){let h=ds(s);if(o>0||h.length>0)e.push("%c"+c),r.push(h);else e.push(c)}else break}}if(o>0)i=r,i.unshift(e.join(""));for(;o<t.length;o++){let c=t[o];if(!(c instanceof Symbol))i.push(c)}return i},ps=Gr?Lo:fs,gs=(...t)=>{console.log(...ps(t)),ms.forEach((e)=>e.print(t))},Pn=(...t)=>{console.warn(...ps(t)),t.unshift(Tt),ms.forEach((e)=>e.print(t))};var ms=G();var ws=(t)=>({[Symbol.iterator](){return this},next:t}),xs=(t,e)=>ws(()=>{let r;do r=t.next();while(!r.done&&!e(r.value));return r}),Me=(t,e)=>ws(()=>{let{done:r,value:s}=t.next();return{done:r,value:r?void 0:e(s)}});class oe{constructor(t,e){this.clock=t,this.len=e}}class ht{constructor(){this.clients=new Map}}var Bt=(t,e,r)=>e.clients.forEach((s,i)=>{let o=t.doc.store.clients.get(i);if(o!=null){let c=o[o.length-1],l=c.id.clock+c.length;for(let h=0,f=s[h];h<s.length&&f.clock<l;f=s[++h])Js(t,o,f.clock,f.len,r)}}),$o=(t,e)=>{let r=0,s=t.length-1;while(r<=s){let i=os((r+s)/2),o=t[i],c=o.clock;if(c<=e){if(e<c+o.len)return i;r=i+1}else s=i-1}return null},ce=(t,e)=>{let r=t.clients.get(e.client);return r!==void 0&&$o(r,e.clock)!==null},Yn=(t)=>{t.clients.forEach((e)=>{e.sort((i,o)=>i.clock-o.clock);let r,s;for(r=1,s=1;r<e.length;r++){let i=e[s-1],o=e[r];if(i.clock+i.len>=o.clock)e[s-1]=new oe(i.clock,Z(i.len,o.clock+o.len-i.clock));else{if(s<r)e[s]=o;s++}}e.length=s})},Wn=(t)=>{let e=new ht;for(let r=0;r<t.length;r++)t[r].clients.forEach((s,i)=>{if(!e.clients.has(i)){let o=s.slice();for(let c=r+1;c<t.length;c++)gr(o,t[c].clients.get(i)||[]);e.clients.set(i,o)}});return Yn(e),e},ne=(t,e,r,s)=>{q(t.clients,e,()=>[]).push(new oe(r,s))},vs=()=>new ht,Fo=(t)=>{let e=vs();return t.clients.forEach((r,s)=>{let i=[];for(let o=0;o<r.length;o++){let c=r[o];if(c.deleted){let l=c.id.clock,h=c.length;if(o+1<r.length)for(let f=r[o+1];o+1<r.length&&f.deleted;f=r[++o+1])h+=f.length;i.push(new oe(l,h))}}if(i.length>0)e.clients.set(s,i)}),e},vt=(t,e)=>{_t(t.restEncoder,e.clients.size),j(e.clients.entries()).sort((r,s)=>s[0]-r[0]).forEach(([r,s])=>{t.resetDsCurVal(),_t(t.restEncoder,r);let i=s.length;_t(t.restEncoder,i);for(let o=0;o<i;o++){let c=s[o];t.writeDsClock(c.clock),t.writeDsLen(c.len)}})},tr=(t)=>{let e=new ht,r=Dt(t.restDecoder);for(let s=0;s<r;s++){t.resetDsCurVal();let i=Dt(t.restDecoder),o=Dt(t.restDecoder);if(o>0){let c=q(e.clients,i,()=>[]);for(let l=0;l<o;l++)c.push(new oe(t.readDsClock(),t.readDsLen()))}}return e},ys=(t,e,r)=>{let s=new ht,i=Dt(t.restDecoder);for(let o=0;o<i;o++){t.resetDsCurVal();let c=Dt(t.restDecoder),l=Dt(t.restDecoder),h=r.clients.get(c)||[],f=b(r,c);for(let a=0;a<l;a++){let u=t.readDsClock(),d=u+t.readDsLen();if(u<f){if(f<d)ne(s,c,f,d-f);let p=P(h,u),g=h[p];if(!g.deleted&&g.id.clock<u)h.splice(p+1,0,Ye(e,g,u-g.id.clock)),p++;while(p<h.length)if(g=h[p++],g.id.clock<d){if(!g.deleted){if(d<g.id.clock+g.length)h.splice(p,0,Ye(e,g,d-g.id.clock));g.delete(e)}}else break}else ne(s,c,u,d-u)}}if(s.clients.size>0){let o=new et;return _t(o.restEncoder,0),vt(o,s),o.toUint8Array()}return null};var Ns=kn;class xd extends Ie{constructor({guid:t=Dr(),collectionid:e=null,gc:r=!0,gcFilter:s=()=>!0,meta:i=null,autoLoad:o=!1,shouldLoad:c=!0}={}){super();this.gc=r,this.gcFilter=s,this.clientID=Ns(),this.guid=t,this.collectionid=e,this.share=new Map,this.store=new or,this._transaction=null,this._transactionCleanups=[],this.subdocs=new Set,this._item=null,this.shouldLoad=c,this.autoLoad=o,this.meta=i,this.isLoaded=!1,this.isSynced=!1,this.isDestroyed=!1,this.whenLoaded=_n((h)=>{this.on("load",()=>{this.isLoaded=!0,h(this)})});let l=()=>_n((h)=>{let f=(a)=>{if(a===void 0||a===!0)this.off("sync",f),h()};this.on("sync",f)});this.on("sync",(h)=>{if(h===!1&&this.isSynced)this.whenSynced=l();if(this.isSynced=h===void 0||h===!0,this.isSynced&&!this.isLoaded)this.emit("load",[this])}),this.whenSynced=l()}load(){let t=this._item;if(t!==null&&!this.shouldLoad)x(t.parent.doc,(e)=>{e.subdocsLoaded.add(this)},null,!0);this.shouldLoad=!0}getSubdocs(){return this.subdocs}getSubdocGuids(){return new Set(j(this.subdocs).map((t)=>t.guid))}transact(t,e=null){return x(this,t,e)}get(t,e=I){let r=q(this.share,t,()=>{let i=new e;return i._integrate(this,null),i}),s=r.constructor;if(e!==I&&s!==e)if(s===I){let i=new e;i._map=r._map,r._map.forEach((o)=>{for(;o!==null;o=o.left)o.parent=i}),i._start=r._start;for(let o=i._start;o!==null;o=o.right)o.parent=i;return i._length=r._length,this.share.set(t,i),i._integrate(this,null),i}else throw Error(`Type with the name ${t} has already been defined with a different constructor`);return r}getArray(t=""){return this.get(t,va)}getText(t=""){return this.get(t,ss)}getMap(t=""){return this.get(t,rs)}getXmlElement(t=""){return this.get(t,Ot)}getXmlFragment(t=""){return this.get(t,lt)}toJSON(){let t={};return this.share.forEach((e,r)=>{t[r]=e.toJSON()}),t}destroy(){this.isDestroyed=!0,j(this.subdocs).forEach((e)=>e.destroy());let t=this._item;if(t!==null){this._item=null;let e=t.content;e.doc=new xd({guid:this.guid,...e.opts,shouldLoad:!1}),e.doc._item=t,x(t.parent.doc,(r)=>{let s=e.doc;if(!t.deleted)r.subdocsAdded.add(s);r.subdocsRemoved.add(this)},null,!0)}this.emit("destroyed",[!0]),this.emit("destroy",[this]),super.destroy()}}class er{constructor(t){this.restDecoder=t}resetDsCurVal(){}readDsClock(){return Dt(this.restDecoder)}readDsLen(){return Dt(this.restDecoder)}}class nr extends er{readLeftID(){return m(Dt(this.restDecoder),Dt(this.restDecoder))}readRightID(){return m(Dt(this.restDecoder),Dt(this.restDecoder))}readClient(){return Dt(this.restDecoder)}readInfo(){return rt(this.restDecoder)}readString(){return el(this.restDecoder)}readParentInfo(){return Dt(this.restDecoder)===1}readTypeRef(){return Dt(this.restDecoder)}readLen(){return Dt(this.restDecoder)}readAny(){return yt(this.restDecoder)}readBuf(){return zr(Xo(this.restDecoder))}readJSON(){return JSON.parse(el(this.restDecoder))}readKey(){return el(this.restDecoder)}}class Rs{constructor(t){this.dsCurrVal=0,this.restDecoder=t}resetDsCurVal(){this.dsCurrVal=0}readDsClock(){return this.dsCurrVal+=Dt(this.restDecoder),this.dsCurrVal}readDsLen(){let t=Dt(this.restDecoder)+1;return this.dsCurrVal+=t,t}}class ct extends Rs{constructor(t){super(t);this.keys=[],Dt(t),this.keyClockDecoder=new zt(Xo(t)),this.clientDecoder=new bt(Xo(t)),this.leftClockDecoder=new zt(Xo(t)),this.rightClockDecoder=new zt(Xo(t)),this.infoDecoder=new Se(Xo(t),rt),this.stringDecoder=new bn(Xo(t)),this.parentInfoDecoder=new Se(Xo(t),rt),this.typeRefDecoder=new bt(Xo(t)),this.lenDecoder=new bt(Xo(t))}readLeftID(){return new ot(this.clientDecoder.read(),this.leftClockDecoder.read())}readRightID(){return new ot(this.clientDecoder.read(),this.rightClockDecoder.read())}readClient(){return this.clientDecoder.read()}readInfo(){return this.infoDecoder.read()}readString(){return this.stringDecoder.read()}readParentInfo(){return this.parentInfoDecoder.read()===1}readTypeRef(){return this.typeRefDecoder.read()}readLen(){return this.lenDecoder.read()}readAny(){return yt(this.restDecoder)}readBuf(){return Xo(this.restDecoder)}readJSON(){return yt(this.restDecoder)}readKey(){let t=this.keyClockDecoder.read();if(t<this.keys.length)return this.keys[t];else{let e=this.stringDecoder.read();return this.keys.push(e),e}}}class rr{constructor(){this.restEncoder=Za()}toUint8Array(){return br(this.restEncoder)}resetDsCurVal(){}writeDsClock(t){_t(this.restEncoder,t)}writeDsLen(t){_t(this.restEncoder,t)}}class Nt extends rr{writeLeftID(t){_t(this.restEncoder,t.client),_t(this.restEncoder,t.clock)}writeRightID(t){_t(this.restEncoder,t.client),_t(this.restEncoder,t.clock)}writeClient(t){_t(this.restEncoder,t)}writeInfo(t){xe(this.restEncoder,t)}writeString(t){Xa(this.restEncoder,t)}writeParentInfo(t){_t(this.restEncoder,t?1:0)}writeTypeRef(t){_t(this.restEncoder,t)}writeLen(t){_t(this.restEncoder,t)}writeAny(t){mt(this.restEncoder,t)}writeBuf(t){zo(this.restEncoder,t)}writeJSON(t){Xa(this.restEncoder,JSON.stringify(t))}writeKey(t){Xa(this.restEncoder,t)}}class sr{constructor(){this.restEncoder=Za(),this.dsCurrVal=0}toUint8Array(){return br(this.restEncoder)}resetDsCurVal(){this.dsCurrVal=0}writeDsClock(t){let e=t-this.dsCurrVal;this.dsCurrVal=t,_t(this.restEncoder,e)}writeDsLen(t){if(t===0)v();_t(this.restEncoder,t-1),this.dsCurrVal+=t}}class et extends sr{constructor(){super();this.keyMap=new Map,this.keyClock=0,this.keyClockEncoder=new qt,this.clientEncoder=new xt,this.leftClockEncoder=new qt,this.rightClockEncoder=new qt,this.infoEncoder=new be(xe),this.stringEncoder=new wn,this.parentInfoEncoder=new be(xe),this.typeRefEncoder=new xt,this.lenEncoder=new xt}toUint8Array(){let t=Za();return _t(t,0),zo(t,this.keyClockEncoder.toUint8Array()),zo(t,this.clientEncoder.toUint8Array()),zo(t,this.leftClockEncoder.toUint8Array()),zo(t,this.rightClockEncoder.toUint8Array()),zo(t,br(this.infoEncoder)),zo(t,this.stringEncoder.toUint8Array()),zo(t,br(this.parentInfoEncoder)),zo(t,this.typeRefEncoder.toUint8Array()),zo(t,this.lenEncoder.toUint8Array()),jt(t,br(this.restEncoder)),br(t)}writeLeftID(t){this.clientEncoder.write(t.client),this.leftClockEncoder.write(t.clock)}writeRightID(t){this.clientEncoder.write(t.client),this.rightClockEncoder.write(t.clock)}writeClient(t){this.clientEncoder.write(t)}writeInfo(t){this.infoEncoder.write(t)}writeString(t){this.stringEncoder.write(t)}writeParentInfo(t){this.parentInfoEncoder.write(t?1:0)}writeTypeRef(t){this.typeRefEncoder.write(t)}writeLen(t){this.lenEncoder.write(t)}writeAny(t){mt(this.restEncoder,t)}writeBuf(t){zo(this.restEncoder,t)}writeJSON(t){mt(this.restEncoder,t)}writeKey(t){let e=this.keyMap.get(t);if(e===void 0)this.keyClockEncoder.write(this.keyClock++),this.stringEncoder.write(t);else this.keyClockEncoder.write(e)}}var jo=(t,e,r,s)=>{s=Z(s,e[0].id.clock);let i=P(e,s);_t(t.restEncoder,e.length-i),t.writeClient(r),_t(t.restEncoder,s);let o=e[i];o.write(t,s-o.id.clock);for(let c=i+1;c<e.length;c++)e[c].write(t,0)},ir=(t,e,r)=>{let s=new Map;r.forEach((i,o)=>{if(b(e,o)>i)s.set(o,i)}),tn(e).forEach((i,o)=>{if(!r.has(o))s.set(o,0)}),_t(t.restEncoder,s.size),j(s.entries()).sort((i,o)=>o[0]-i[0]).forEach(([i,o])=>{jo(t,e.clients.get(i),i,o)})},qo=(t,e)=>{let r=A(),s=Dt(t.restDecoder);for(let i=0;i<s;i++){let o=Dt(t.restDecoder),c=Array(o),l=t.readClient(),h=Dt(t.restDecoder);r.set(l,{i:0,refs:c});for(let f=0;f<o;f++){let a=t.readInfo();switch(Vt&a){case 0:{let u=t.readLen();c[f]=new V(m(l,h),u),h+=u;break}case 10:{let u=Dt(t.restDecoder);c[f]=new M(m(l,h),u),h+=u;break}default:{let u=(a&(F|D))===0,d=new y(m(l,h),null,(a&D)===D?t.readLeftID():null,null,(a&F)===F?t.readRightID():null,u?t.readParentInfo()?e.get(t.readString()):t.readLeftID():null,u&&(a&dt)===dt?t.readString():null,mi(t,a));c[f]=d,h+=d.length}}}}return r},Go=(t,e,r)=>{let s=[],i=j(r.keys()).sort((p,g)=>p-g);if(i.length===0)return null;let o=()=>{if(i.length===0)return null;let p=r.get(i[i.length-1]);while(p.refs.length===p.i)if(i.pop(),i.length>0)p=r.get(i[i.length-1]);else return null;return p},c=o();if(c===null)return null;let l=new or,h=new Map,f=(p,g)=>{let w=h.get(p);if(w==null||w>g)h.set(p,g)},a=c.refs[c.i++],u=new Map,d=()=>{for(let p of s){let g=p.id.client,w=r.get(g);if(w)w.i--,l.clients.set(g,w.refs.slice(w.i)),r.delete(g),w.i=0,w.refs=[];else l.clients.set(g,[p]);i=i.filter((C)=>C!==g)}s.length=0};while(!0){if(a.constructor!==M){let g=q(u,a.id.client,()=>b(e,a.id.client))-a.id.clock;if(g<0)s.push(a),f(a.id.client,a.id.clock-1),d();else{let w=a.getMissing(t,e);if(w!==null){s.push(a);let C=r.get(w)||{refs:[],i:0};if(C.refs.length===C.i)f(w,b(e,w)),d();else{a=C.refs[C.i++];continue}}else if(g===0||g<a.length)a.integrate(t,g),u.set(a.id.client,a.id.clock+a.length)}}if(s.length>0)a=s.pop();else if(c!==null&&c.i<c.refs.length)a=c.refs[c.i++];else if(c=o(),c===null)break;else a=c.refs[c.i++]}if(l.clients.size>0){let p=new et;return ir(p,l,new Map),_t(p.restEncoder,0),{missing:h,update:p.toUint8Array()}}return null},Ho=(t,e)=>ir(t,e.doc.store,e.beforeState),Jo=(t,e,r,s=new ct(t))=>x(e,(i)=>{i.local=!1;let o=!1,c=i.doc,l=c.store,h=qo(s,c),f=Go(i,l,h),a=l.pendingStructs;if(a){for(let[d,p]of a.missing)if(p<b(l,d)){o=!0;break}if(f){for(let[d,p]of f.missing){let g=a.missing.get(d);if(g==null||g>p)a.missing.set(d,p)}a.update=Je([a.update,f.update])}}else l.pendingStructs=f;let u=ys(s,i,l);if(l.pendingDs){let d=new ct(Qa(l.pendingDs));Dt(d.restDecoder);let p=ys(d,i,l);if(u&&p)l.pendingDs=Je([u,p]);else l.pendingDs=u||p}else l.pendingDs=u;if(o){let d=l.pendingStructs.update;l.pendingStructs=null,Ls(i.doc,d)}},r,!1);var Ls=(t,e,r,s=ct)=>{let i=Qa(e);Jo(i,t,r,new s(i))},XI=(t,e,r)=>Ls(t,e,r,nr),Po=(t,e,r=new Map)=>{ir(t,e.store,r),vt(t,Fo(e.store))},Ko=(t,e=new Uint8Array([0]),r=new et)=>{let s=Vs(e);Po(r,t,s);let i=[r.toUint8Array()];if(t.store.pendingDs)i.push(t.store.pendingDs);if(t.store.pendingStructs)i.push(ac(t.store.pendingStructs.update,e));if(i.length>1){if(r.constructor===Nt)return cc(i.map((o,c)=>c===0?o:uc(o)));else if(r.constructor===et)return Je(i)}return i[0]},QI=(t,e)=>Ko(t,e,new Nt),Wo=(t)=>{let e=new Map,r=Dt(t.restDecoder);for(let s=0;s<r;s++){let i=Dt(t.restDecoder),o=Dt(t.restDecoder);e.set(i,o)}return e},Vs=(t)=>Wo(new er(Qa(t))),Ms=(t,e)=>(_t(t.restEncoder,e.size),j(e.entries()).sort((r,s)=>s[0]-r[0]).forEach(([r,s])=>{_t(t.restEncoder,r),_t(t.restEncoder,s)}),t),Zo=(t,e)=>Ms(t,tn(e.store)),Qo=(t,e=new sr)=>{if(t instanceof Map)Ms(e,t);else Zo(e,t);return e.toUint8Array()},eR=(t)=>Qo(t,new rr);class $s{constructor(){this.l=[]}}var bs=()=>new $s,ks=(t,e)=>t.l.push(e),_s=(t,e)=>{let r=t.l,s=r.length;if(t.l=r.filter((i)=>e!==i),s===t.l.length)console.error("[yjs] Tried to remove event handler that doesn't exist.")},Fs=(t,e,r)=>Kt(t.l,[e,r]);class ot{constructor(t,e){this.client=t,this.clock=e}}var $e=(t,e)=>t===e||t!==null&&e!==null&&t.client===e.client&&t.clock===e.clock,m=(t,e)=>new ot(t,e);var js=(t)=>{for(let[e,r]of t.doc.share.entries())if(r===t)return e;throw v()},He=(t,e)=>{while(e!==null){if(e.parent===t)return!0;e=e.parent._item}return!1};class qs{constructor(t,e,r,s=0){this.type=t,this.tname=e,this.item=r,this.assoc=s}}class Gs{constructor(t,e,r=0){this.type=t,this.index=e,this.assoc=r}}var Yo=(t,e,r=0)=>new Gs(t,e,r),Fe=(t,e,r)=>{let s=null,i=null;if(t._item===null)i=js(t);else s=m(t._item.id.client,t._item.id.clock);return new qs(s,i,e,r)},Q0=(t,e,r=0)=>{let s=t._start;if(r<0){if(e===0)return Fe(t,null,r);e--}while(s!==null){if(!s.deleted&&s.countable){if(s.length>e)return Fe(t,m(s.id.client,s.id.clock+e),r);e-=s.length}if(s.right===null&&r<0)return Fe(t,s.lastId,r);s=s.right}return Fe(t,null,r)};var tc=(t,e)=>{let r=Ct(t,e),s=e.clock-r.id.clock;return{item:r,diff:s}},jg=(t,e,r=!0)=>{let s=e.store,{item:i,type:o,tname:c,assoc:l}=t,h=null,f=0;if(i!==null){if(b(s,i.client)<=i.clock)return null;let a=r?Qn(s,i):tc(s,i),u=a.item;if(!(u instanceof y))return null;if(h=u.parent,h._item===null||!h._item.deleted){f=u.deleted||!u.countable?0:a.diff+(l>=0?0:1);let d=u.left;while(d!==null){if(!d.deleted&&d.countable)f+=d.length;d=d.left}}}else{if(c!==null)h=e.get(c);else if(o!==null){if(b(s,o.client)<=o.clock)return null;let{item:a}=r?Qn(s,o):{item:Ct(s,o)};if(a instanceof y&&a.content instanceof W)h=a.content.type;else return null}else throw v();if(l>=0)f=h._length;else f=0}return Yo(h,f,t.assoc)};class zs{constructor(t,e){this.ds=t,this.sv=e}}var ec=(t,e)=>new zs(t,e),Fl=ec(vs(),new Map);var At=(t,e)=>e===void 0?!t.deleted:e.sv.has(t.id.client)&&(e.sv.get(t.id.client)||0)>t.id.clock&&!ce(e.ds,t.id),Zn=(t,e)=>{let r=q(t.meta,Zn,G),s=t.doc.store;if(!r.has(e))e.sv.forEach((i,o)=>{if(i<b(s,o))N(t,m(o,i))}),Bt(t,e.ds,(i)=>{}),r.add(e)};class or{constructor(){this.clients=new Map,this.pendingStructs=null,this.pendingDs=null}}var tn=(t)=>{let e=new Map;return t.clients.forEach((r,s)=>{let i=r[r.length-1];e.set(s,i.id.clock+i.length)}),e},b=(t,e)=>{let r=t.clients.get(e);if(r===void 0)return 0;let s=r[r.length-1];return s.id.clock+s.length},Hs=(t,e)=>{let r=t.clients.get(e.id.client);if(r===void 0)r=[],t.clients.set(e.id.client,r);else{let s=r[r.length-1];if(s.id.clock+s.length!==e.id.clock)throw v()}r.push(e)},P=(t,e)=>{let r=0,s=t.length-1,i=t[s],o=i.id.clock;if(o===e)return s;let c=os(e/(o+i.length-1)*s);while(r<=s){if(i=t[c],o=i.id.clock,o<=e){if(e<o+i.length)return c;r=c+1}else s=c-1;c=os((r+s)/2)}throw v()},nc=(t,e)=>{let r=t.clients.get(e.client);return r[P(r,e.clock)]},Ct=nc,Xn=(t,e,r)=>{let s=P(e,r),i=e[s];if(i.id.clock<r&&i instanceof y)return e.splice(s+1,0,Ye(t,i,r-i.id.clock)),s+1;return s},N=(t,e)=>{let r=t.doc.store.clients.get(e.client);return r[Xn(t,r,e.clock)]},Ss=(t,e,r)=>{let s=e.clients.get(r.client),i=P(s,r.clock),o=s[i];if(r.clock!==o.id.clock+o.length-1&&o.constructor!==V)s.splice(i+1,0,Ye(t,o,r.clock-o.id.clock+1));return o},rc=(t,e,r)=>{let s=t.clients.get(e.id.client);s[P(s,e.id.clock)]=r},Js=(t,e,r,s,i)=>{if(s===0)return;let o=r+s,c=Xn(t,e,r),l;do{if(l=e[c++],o<l.id.clock+l.length)Xn(t,e,o);i(l)}while(c<e.length&&e[c].id.clock<o)};class Ps{constructor(t,e,r){this.doc=t,this.deleteSet=new ht,this.beforeState=tn(t.store),this.afterState=new Map,this.changed=new Map,this.changedParentTypes=new Map,this._mergeStructs=[],this.origin=e,this.meta=new Map,this.local=r,this.subdocsAdded=new Set,this.subdocsRemoved=new Set,this.subdocsLoaded=new Set,this._needFormattingCleanup=!1}}var Es=(t,e)=>{if(e.deleteSet.clients.size===0&&!Ar(e.afterState,(r,s)=>e.beforeState.get(s)!==r))return!1;return Yn(e.deleteSet),Ho(t,e),vt(t,e.deleteSet),!0},Is=(t,e,r)=>{let s=e._item;if(s===null||s.id.clock<(t.beforeState.get(s.id.client)||0)&&!s.deleted)q(t.changed,e,G).add(r)},Ge=(t,e)=>{let r=t[e],s=t[e-1],i=e;for(;i>0;r=s,s=t[--i-1]){if(s.deleted===r.deleted&&s.constructor===r.constructor){if(s.mergeWith(r)){if(r instanceof y&&r.parentSub!==null&&r.parent._map.get(r.parentSub)===r)r.parent._map.set(r.parentSub,s);continue}}break}let o=e-i;if(o)t.splice(e+1-o,o);return o},sc=(t,e,r)=>{for(let[s,i]of t.clients.entries()){let o=e.clients.get(s);for(let c=i.length-1;c>=0;c--){let l=i[c],h=l.clock+l.len;for(let f=P(o,l.clock),a=o[f];f<o.length&&a.id.clock<h;a=o[++f]){let u=o[f];if(l.clock+l.len<=u.id.clock)break;if(u instanceof y&&u.deleted&&!u.keep&&r(u))u.gc(e,!1)}}}},ic=(t,e)=>{t.clients.forEach((r,s)=>{let i=e.clients.get(s);for(let o=r.length-1;o>=0;o--){let c=r[o],l=ue(i.length-1,1+P(i,c.clock+c.len-1));for(let h=l,f=i[h];h>0&&f.id.clock>=c.clock;f=i[h])h-=1+Ge(i,h)}})};var Ks=(t,e)=>{if(e<t.length){let r=t[e],s=r.doc,i=s.store,{deleteSet:o,_mergeStructs:c}=r;try{Yn(o),r.afterState=tn(r.doc.store),s.emit("beforeObserverCalls",[r,s]);let l=[];r.changed.forEach((h,f)=>l.push(()=>{if(f._item===null||!f._item.deleted)f._callObserver(r,h)})),l.push(()=>{r.changedParentTypes.forEach((h,f)=>{if(f._dEH.l.length>0&&(f._item===null||!f._item.deleted))l.push(()=>{h=h.filter((a)=>a.target._item===null||!a.target._item.deleted),h.forEach((a)=>{a.currentTarget=f,a._path=null}),h.sort((a,u)=>a.path.length-u.path.length),Fs(f._dEH,h,r)})}),l.push(()=>s.emit("afterTransaction",[r,s])),l.push(()=>{if(r._needFormattingCleanup)_c(r)})}),Kt(l,[])}finally{if(s.gc)sc(o,i,s.gcFilter);ic(o,i),r.afterState.forEach((a,u)=>{let d=r.beforeState.get(u)||0;if(d!==a){let p=i.clients.get(u),g=Z(P(p,d),1);for(let w=p.length-1;w>=g;)w-=1+Ge(p,w)}});for(let a=c.length-1;a>=0;a--){let{client:u,clock:d}=c[a].id,p=i.clients.get(u),g=P(p,d);if(g+1<p.length){if(Ge(p,g+1)>1)continue}if(g>0)Ge(p,g)}if(!r.local&&r.afterState.get(s.clientID)!==r.beforeState.get(s.clientID))gs(Tt,Yt,"[yjs] ",te,ee,"Changed the client-id because another client seems to be using it."),s.clientID=Ns();if(s.emit("afterTransactionCleanup",[r,s]),s._observers.has("update")){let a=new Nt;if(Es(a,r))s.emit("update",[a.toUint8Array(),r.origin,s,r])}if(s._observers.has("updateV2")){let a=new et;if(Es(a,r))s.emit("updateV2",[a.toUint8Array(),r.origin,s,r])}let{subdocsAdded:l,subdocsLoaded:h,subdocsRemoved:f}=r;if(l.size>0||f.size>0||h.size>0)l.forEach((a)=>{if(a.clientID=s.clientID,a.collectionid==null)a.collectionid=s.collectionid;s.subdocs.add(a)}),f.forEach((a)=>s.subdocs.delete(a)),s.emit("subdocs",[{loaded:h,added:l,removed:f},s,r]),f.forEach((a)=>a.destroy());if(t.length<=e+1)s._transactionCleanups=[],s.emit("afterAllTransactions",[s,t]);else Ks(t,e+1)}}},x=(t,e,r=null,s=!0)=>{let i=t._transactionCleanups,o=!1,c=null;if(t._transaction===null){if(o=!0,t._transaction=new Ps(t,r,s),i.push(t._transaction),i.length===1)t.emit("beforeAllTransactions",[t]);t.emit("beforeTransaction",[t._transaction,t])}try{c=e(t._transaction)}finally{if(o){let l=t._transaction===i[0];if(t._transaction=null,l)Ks(i,0)}}return c};class Ws{constructor(t,e){this.insertions=e,this.deletions=t,this.meta=new Map}}var Us=(t,e,r)=>{Bt(t,r.deletions,(s)=>{if(s instanceof y&&e.scope.some((i)=>i===t.doc||He(i,s)))ur(s,!1)})},Ts=(t,e,r)=>{let s=null,{doc:i,scope:o}=t;x(i,(l)=>{while(e.length>0&&t.currStackItem===null){let h=i.store,f=e.pop(),a=new Set,u=[],d=!1;Bt(l,f.insertions,(p)=>{if(p instanceof y){if(p.redone!==null){let{item:g,diff:w}=Qn(h,p.id);if(w>0)g=N(l,m(g.id.client,g.id.clock+w));p=g}if(!p.deleted&&o.some((g)=>g===l.doc||He(g,p)))u.push(p)}}),Bt(l,f.deletions,(p)=>{if(p instanceof y&&o.some((g)=>g===l.doc||He(g,p))&&!ce(f.insertions,p.id))a.add(p)}),a.forEach((p)=>{d=gi(l,p,a,f.insertions,t.ignoreRemoteMapChanges,t)!==null||d});for(let p=u.length-1;p>=0;p--){let g=u[p];if(t.deleteFilter(g))g.delete(l),d=!0}t.currStackItem=d?f:null}l.changed.forEach((h,f)=>{if(h.has(null)&&f._searchMarker)f._searchMarker.length=0}),s=l},t);let c=t.currStackItem;if(c!=null){let l=s.changedParentTypes;t.emit("stack-item-popped",[{stackItem:c,type:r,changedParentTypes:l,origin:t},t]),t.currStackItem=null}return c};class N2 extends Ie{constructor(t,{captureTimeout:e=500,captureTransaction:r=(l)=>!0,deleteFilter:s=()=>!0,trackedOrigins:i=new Set([null]),ignoreRemoteMapChanges:o=!1,doc:c=Q(t)?t[0].doc:t instanceof xd?t:t.doc}={}){super();this.scope=[],this.doc=c,this.addToScope(t),this.deleteFilter=s,i.add(this),this.trackedOrigins=i,this.captureTransaction=r,this.undoStack=[],this.redoStack=[],this.undoing=!1,this.redoing=!1,this.currStackItem=null,this.lastChange=0,this.ignoreRemoteMapChanges=o,this.captureTimeout=e,this.afterTransactionHandler=(l)=>{if(!this.captureTransaction(l)||!this.scope.some((w)=>l.changedParentTypes.has(w)||w===this.doc)||!this.trackedOrigins.has(l.origin)&&(!l.origin||!this.trackedOrigins.has(l.origin.constructor)))return;let h=this.undoing,f=this.redoing,a=h?this.redoStack:this.undoStack;if(h)this.stopCapturing();else if(!f)this.clear(!1,!0);let u=new ht;l.afterState.forEach((w,C)=>{let k=l.beforeState.get(C)||0,dr=w-k;if(dr>0)ne(u,C,k,dr)});let d=Su(),p=!1;if(this.lastChange>0&&d-this.lastChange<this.captureTimeout&&a.length>0&&!h&&!f){let w=a[a.length-1];w.deletions=Wn([w.deletions,l.deleteSet]),w.insertions=Wn([w.insertions,u])}else a.push(new Ws(l.deleteSet,u)),p=!0;if(!h&&!f)this.lastChange=d;Bt(l,l.deleteSet,(w)=>{if(w instanceof y&&this.scope.some((C)=>C===l.doc||He(C,w)))ur(w,!0)});let g=[{stackItem:a[a.length-1],origin:l.origin,type:h?"redo":"undo",changedParentTypes:l.changedParentTypes},this];if(p)this.emit("stack-item-added",g);else this.emit("stack-item-updated",g)},this.destroy=this.destroy.bind(this),this.doc.on("afterTransaction",this.afterTransactionHandler),this.doc.on("destroy",this.destroy)}addToScope(t){let e=new Set(this.scope);t=Q(t)?t:[t],t.forEach((r)=>{if(!e.has(r)){if(e.add(r),r instanceof I?r.doc!==this.doc:r!==this.doc)Pn("[yjs#509] Not same Y.Doc");this.scope.push(r)}})}addTrackedOrigin(t){this.trackedOrigins.add(t)}removeTrackedOrigin(t){this.trackedOrigins.delete(t)}clear(t=!0,e=!0){if(t&&this.canUndo()||e&&this.canRedo())this.doc.transact((r)=>{if(t)this.undoStack.forEach((s)=>Us(r,this,s)),this.undoStack=[];if(e)this.redoStack.forEach((s)=>Us(r,this,s)),this.redoStack=[];this.emit("stack-cleared",[{undoStackCleared:t,redoStackCleared:e}])})}stopCapturing(){this.lastChange=0}undo(){this.undoing=!0;let t;try{t=Ts(this,this.undoStack,"undo")}finally{this.undoing=!1}return t}redo(){this.redoing=!0;let t;try{t=Ts(this,this.redoStack,"redo")}finally{this.redoing=!1}return t}canUndo(){return this.undoStack.length>0}canRedo(){return this.redoStack.length>0}destroy(){this.trackedOrigins.delete(this),this.doc.off("afterTransaction",this.afterTransactionHandler),this.doc.off("destroy",this.destroy),super.destroy()}}function*oc(t){let e=Dt(t.restDecoder);for(let r=0;r<e;r++){let s=Dt(t.restDecoder),i=t.readClient(),o=Dt(t.restDecoder);for(let c=0;c<s;c++){let l=t.readInfo();if(l===10){let h=Dt(t.restDecoder);yield new M(m(i,o),h),o+=h}else if((Vt&l)!==0){let h=(l&(F|D))===0,f=new y(m(i,o),null,(l&D)===D?t.readLeftID():null,null,(l&F)===F?t.readRightID():null,h?t.readParentInfo()?t.readString():t.readLeftID():null,h&&(l&dt)===dt?t.readString():null,mi(t,l));yield f,o+=f.length}else{let h=t.readLen();yield new V(m(i,o),h),o+=h}}}}class en{constructor(t,e){this.gen=oc(t),this.curr=null,this.done=!1,this.filterSkips=e,this.next()}next(){do this.curr=this.gen.next().value||null;while(this.filterSkips&&this.curr!==null&&this.curr.constructor===M);return this.curr}}class nn{constructor(t){this.currClient=0,this.startClock=0,this.written=0,this.encoder=t,this.clientStructs=[]}}var cc=(t)=>Je(t,nr,Nt);var lc=(t,e)=>{if(t.constructor===V){let{client:r,clock:s}=t.id;return new V(m(r,s+e),t.length-e)}else if(t.constructor===M){let{client:r,clock:s}=t.id;return new M(m(r,s+e),t.length-e)}else{let r=t,{client:s,clock:i}=r.id;return new y(m(s,i+e),null,m(s,i+e-1),null,r.rightOrigin,r.parent,r.parentSub,r.content.splice(e))}},Je=(t,e=ct,r=et)=>{if(t.length===1)return t[0];let s=t.map((a)=>new e(Qa(a))),i=s.map((a)=>new en(a,!0)),o=null,c=new r,l=new nn(c);while(!0){if(i=i.filter((d)=>d.curr!==null),i.sort((d,p)=>{if(d.curr.id.client===p.curr.id.client){let g=d.curr.id.clock-p.curr.id.clock;if(g===0)return d.curr.constructor===p.curr.constructor?0:d.curr.constructor===M?1:-1;else return g}else return p.curr.id.client-d.curr.id.client}),i.length===0)break;let a=i[0],u=a.curr.id.client;if(o!==null){let d=a.curr,p=!1;while(d!==null&&d.id.clock+d.length<=o.struct.id.clock+o.struct.length&&d.id.client>=o.struct.id.client)d=a.next(),p=!0;if(d===null||d.id.client!==u||p&&d.id.clock>o.struct.id.clock+o.struct.length)continue;if(u!==o.struct.id.client)Y(l,o.struct,o.offset),o={struct:d,offset:0},a.next();else if(o.struct.id.clock+o.struct.length<d.id.clock)if(o.struct.constructor===M)o.struct.length=d.id.clock+d.length-o.struct.id.clock;else{Y(l,o.struct,o.offset);let g=d.id.clock-o.struct.id.clock-o.struct.length;o={struct:new M(m(u,o.struct.id.clock+o.struct.length),g),offset:0}}else{let g=o.struct.id.clock+o.struct.length-d.id.clock;if(g>0)if(o.struct.constructor===M)o.struct.length-=g;else d=lc(d,g);if(!o.struct.mergeWith(d))Y(l,o.struct,o.offset),o={struct:d,offset:0},a.next()}}else o={struct:a.curr,offset:0},a.next();for(let d=a.curr;d!==null&&d.id.client===u&&d.id.clock===o.struct.id.clock+o.struct.length&&d.constructor!==M;d=a.next())Y(l,o.struct,o.offset),o={struct:d,offset:0}}if(o!==null)Y(l,o.struct,o.offset),o=null;cr(l);let h=s.map((a)=>tr(a)),f=Wn(h);return vt(c,f),c.toUint8Array()},ac=(t,e,r=ct,s=et)=>{let i=Vs(e),o=new s,c=new nn(o),l=new r(Qa(t)),h=new en(l,!1);while(h.curr){let a=h.curr,u=a.id.client,d=i.get(u)||0;if(h.curr.constructor===M){h.next();continue}if(a.id.clock+a.length>d){Y(c,a,Z(d-a.id.clock,0)),h.next();while(h.curr&&h.curr.id.client===u)Y(c,h.curr,0),h.next()}else while(h.curr&&h.curr.id.client===u&&h.curr.id.clock+h.curr.length<=d)h.next()}cr(c);let f=tr(l);return vt(o,f),o.toUint8Array()};var Zs=(t)=>{if(t.written>0)t.clientStructs.push({written:t.written,restEncoder:br(t.encoder.restEncoder)}),t.encoder.restEncoder=Za(),t.written=0},Y=(t,e,r)=>{if(t.written>0&&t.currClient!==e.id.client)Zs(t);if(t.written===0)t.currClient=e.id.client,t.encoder.writeClient(e.id.client),_t(t.encoder.restEncoder,e.id.clock+r);e.write(t.encoder,r),t.written++},cr=(t)=>{Zs(t);let e=t.encoder.restEncoder;_t(e,t.clientStructs.length);for(let r=0;r<t.clientStructs.length;r++){let s=t.clientStructs[r];_t(e,s.written),jt(e,s.restEncoder)}},hc=(t,e,r,s)=>{let i=new r(Qa(t)),o=new en(i,!1),c=new s,l=new nn(c);for(let f=o.curr;f!==null;f=o.next())Y(l,e(f),0);cr(l);let h=tr(i);return vt(c,h),c.toUint8Array()};var uc=(t)=>hc(t,$r,ct,Nt),As="You must not compute changes after the event-handler fired.";class le{constructor(t,e){this.target=t,this.currentTarget=t,this.transaction=e,this._changes=null,this._keys=null,this._delta=null,this._path=null}get path(){return this._path||(this._path=dc(this.currentTarget,this.target))}deletes(t){return ce(this.transaction.deleteSet,t.id)}get keys(){if(this._keys===null){if(this.transaction.doc._transactionCleanups.length===0)throw R(As);let t=new Map,e=this.target;this.transaction.changed.get(e).forEach((s)=>{if(s!==null){let i=e._map.get(s),o,c;if(this.adds(i)){let l=i.left;while(l!==null&&this.adds(l))l=l.left;if(this.deletes(i))if(l!==null&&this.deletes(l))o="delete",c=ge(l.content.getContent());else return;else if(l!==null&&this.deletes(l))o="update",c=ge(l.content.getContent());else o="add",c=void 0}else if(this.deletes(i))o="delete",c=ge(i.content.getContent());else return;t.set(s,{action:o,oldValue:c})}}),this._keys=t}return this._keys}get delta(){return this.changes.delta}adds(t){return t.id.clock>=(this.transaction.beforeState.get(t.id.client)||0)}get changes(){let t=this._changes;if(t===null){if(this.transaction.doc._transactionCleanups.length===0)throw R(As);let e=this.target,r=G(),s=G(),i=[];if(t={added:r,deleted:s,delta:i,keys:this.keys},this.transaction.changed.get(e).has(null)){let c=null,l=()=>{if(c)i.push(c)};for(let h=e._start;h!==null;h=h.right)if(h.deleted){if(this.deletes(h)&&!this.adds(h)){if(c===null||c.delete===void 0)l(),c={delete:0};c.delete+=h.length,s.add(h)}}else if(this.adds(h)){if(c===null||c.insert===void 0)l(),c={insert:[]};c.insert=c.insert.concat(h.content.getContent()),r.add(h)}else{if(c===null||c.retain===void 0)l(),c={retain:0};c.retain+=h.length}if(c!==null&&c.retain===void 0)l()}this._changes=t}return t}}var dc=(t,e)=>{let r=[];while(e._item!==null&&e!==t){if(e._item.parentSub!==null)r.unshift(e._item.parentSub);else{let s=0,i=e._item.parent._start;while(i!==e._item&&i!==null){if(!i.deleted&&i.countable)s+=i.length;i=i.right}r.unshift(s)}e=e._item.parent}return r},O=()=>{Pn("Invalid access: Add Yjs type to a document before reading data.")},Xs=80,lr=0;class Qs{constructor(t,e){t.marker=!0,this.p=t,this.index=e,this.timestamp=lr++}}var fc=(t)=>{t.timestamp=lr++},Ys=(t,e,r)=>{t.p.marker=!1,t.p=e,e.marker=!0,t.index=r,t.timestamp=lr++},pc=(t,e,r)=>{if(t.length>=Xs){let s=t.reduce((i,o)=>i.timestamp<o.timestamp?i:o);return Ys(s,e,r),s}else{let s=new Qs(e,r);return t.push(s),s}},rn=(t,e)=>{if(t._start===null||e===0||t._searchMarker===null)return null;let r=t._searchMarker.length===0?null:t._searchMarker.reduce((o,c)=>nt(e-o.index)<nt(e-c.index)?o:c),s=t._start,i=0;if(r!==null)s=r.p,i=r.index,fc(r);while(s.right!==null&&i<e){if(!s.deleted&&s.countable){if(e<i+s.length)break;i+=s.length}s=s.right}while(s.left!==null&&i>e)if(s=s.left,!s.deleted&&s.countable)i-=s.length;while(s.left!==null&&s.left.id.client===s.id.client&&s.left.id.clock+s.left.length===s.id.clock)if(s=s.left,!s.deleted&&s.countable)i-=s.length;if(r!==null&&nt(r.index-i)<s.parent.length/Xs)return Ys(r,s,i),r;else return pc(t._searchMarker,s,i)},re=(t,e,r)=>{for(let s=t.length-1;s>=0;s--){let i=t[s];if(r>0){let o=i.p;o.marker=!1;while(o&&(o.deleted||!o.countable))if(o=o.left,o&&!o.deleted&&o.countable)i.index-=o.length;if(o===null||o.marker===!0){t.splice(s,1);continue}i.p=o,o.marker=!0}if(e<i.index||r>0&&e===i.index)i.index=Z(e,i.index+r)}};var sn=(t,e,r)=>{let s=t,i=e.changedParentTypes;while(!0){if(q(i,t,()=>[]).push(r),t._item===null)break;t=t._item.parent}Fs(s._eH,r,e)};class I{constructor(){this._item=null,this._map=new Map,this._start=null,this.doc=null,this._length=0,this._eH=bs(),this._dEH=bs(),this._searchMarker=null}get parent(){return this._item?this._item.parent:null}_integrate(t,e){this.doc=t,this._item=e}_copy(){throw L()}clone(){throw L()}_write(t){}get _first(){let t=this._start;while(t!==null&&t.deleted)t=t.right;return t}_callObserver(t,e){if(!t.local&&this._searchMarker)this._searchMarker.length=0}observe(t){ks(this._eH,t)}observeDeep(t){ks(this._dEH,t)}unobserve(t){_s(this._eH,t)}unobserveDeep(t){_s(this._dEH,t)}toJSON(){}}var ti=(t,e,r)=>{if(t.doc??O(),e<0)e=t._length+e;if(r<0)r=t._length+r;let s=r-e,i=[],o=t._start;while(o!==null&&s>0){if(o.countable&&!o.deleted){let c=o.content.getContent();if(c.length<=e)e-=c.length;else{for(let l=e;l<c.length&&s>0;l++)i.push(c[l]),s--;e=0}}o=o.right}return i},ei=(t)=>{t.doc??O();let e=[],r=t._start;while(r!==null){if(r.countable&&!r.deleted){let s=r.content.getContent();for(let i=0;i<s.length;i++)e.push(s[i])}r=r.right}return e};var se=(t,e)=>{let r=0,s=t._start;t.doc??O();while(s!==null){if(s.countable&&!s.deleted){let i=s.content.getContent();for(let o=0;o<i.length;o++)e(i[o],r++,t)}s=s.right}},ni=(t,e)=>{let r=[];return se(t,(s,i)=>{r.push(e(s,i,t))}),r},gc=(t)=>{let e=t._start,r=null,s=0;return{[Symbol.iterator](){return this},next:()=>{if(r===null){while(e!==null&&e.deleted)e=e.right;if(e===null)return{done:!0,value:void 0};r=e.content.getContent(),s=0,e=e.right}let i=r[s++];if(r.length<=s)r=null;return{done:!1,value:i}}}},ri=(t,e)=>{t.doc??O();let r=rn(t,e),s=t._start;if(r!==null)s=r.p,e-=r.index;for(;s!==null;s=s.right)if(!s.deleted&&s.countable){if(e<s.length)return s.content.getContent()[e];e-=s.length}},Pe=(t,e,r,s)=>{let i=r,o=t.doc,{clientID:c,store:l}=o,h=r===null?e._start:r.right,f=[],a=()=>{if(f.length>0)i=new y(m(c,b(l,c)),i,i&&i.lastId,h,h&&h.id,e,null,new at(f)),i.integrate(t,0),f=[]};s.forEach((u)=>{if(u===null)f.push(u);else switch(u.constructor){case Number:case Object:case Boolean:case Array:case String:f.push(u);break;default:switch(a(),u.constructor){case Uint8Array:case ArrayBuffer:i=new y(m(c,b(l,c)),i,i&&i.lastId,h,h&&h.id,e,null,new ae(new Uint8Array(u))),i.integrate(t,0);break;case xd:i=new y(m(c,b(l,c)),i,i&&i.lastId,h,h&&h.id,e,null,new he(u)),i.integrate(t,0);break;default:if(u instanceof I)i=new y(m(c,b(l,c)),i,i&&i.lastId,h,h&&h.id,e,null,new W(u)),i.integrate(t,0);else throw Error("Unexpected content type in insert operation")}}}),a()},si=()=>R("Length exceeded!"),ii=(t,e,r,s)=>{if(r>e._length)throw si();if(r===0){if(e._searchMarker)re(e._searchMarker,r,s.length);return Pe(t,e,null,s)}let i=r,o=rn(e,r),c=e._start;if(o!==null){if(c=o.p,r-=o.index,r===0)c=c.prev,r+=c&&c.countable&&!c.deleted?c.length:0}for(;c!==null;c=c.right)if(!c.deleted&&c.countable){if(r<=c.length){if(r<c.length)N(t,m(c.id.client,c.id.clock+r));break}r-=c.length}if(e._searchMarker)re(e._searchMarker,i,s.length);return Pe(t,e,c,s)},mc=(t,e,r)=>{let i=(e._searchMarker||[]).reduce((o,c)=>c.index>o.index?c:o,{index:0,p:e._start}).p;if(i)while(i.right)i=i.right;return Pe(t,e,i,r)},oi=(t,e,r,s)=>{if(s===0)return;let i=r,o=s,c=rn(e,r),l=e._start;if(c!==null)l=c.p,r-=c.index;for(;l!==null&&r>0;l=l.right)if(!l.deleted&&l.countable){if(r<l.length)N(t,m(l.id.client,l.id.clock+r));r-=l.length}while(s>0&&l!==null){if(!l.deleted){if(s<l.length)N(t,m(l.id.client,l.id.clock+s));l.delete(t),s-=l.length}l=l.right}if(s>0)throw si();if(e._searchMarker)re(e._searchMarker,i,-o+s)},Ke=(t,e,r)=>{let s=e._map.get(r);if(s!==void 0)s.delete(t)},ar=(t,e,r,s)=>{let i=e._map.get(r)||null,o=t.doc,c=o.clientID,l;if(s==null)l=new at([s]);else switch(s.constructor){case Number:case Object:case Boolean:case Array:case String:case Date:case BigInt:l=new at([s]);break;case Uint8Array:l=new ae(s);break;case xd:l=new he(s);break;default:if(s instanceof I)l=new W(s);else throw Error("Unexpected content type")}new y(m(c,b(o.store,c)),i,i&&i.lastId,null,null,e,r,l).integrate(t,0)},hr=(t,e)=>{t.doc??O();let r=t._map.get(e);return r!==void 0&&!r.deleted?r.content.getContent()[r.length-1]:void 0},ci=(t)=>{let e={};return t.doc??O(),t._map.forEach((r,s)=>{if(!r.deleted)e[s]=r.content.getContent()[r.length-1]}),e},li=(t,e)=>{t.doc??O();let r=t._map.get(e);return r!==void 0&&!r.deleted};var wc=(t,e)=>{let r={};return t._map.forEach((s,i)=>{let o=s;while(o!==null&&(!e.sv.has(o.id.client)||o.id.clock>=(e.sv.get(o.id.client)||0)))o=o.left;if(o!==null&&At(o,e))r[i]=o.content.getContent()[o.length-1]}),r},je=(t)=>(t.doc??O(),xs(t._map.entries(),(e)=>!e[1].deleted));class ky extends le{}class va extends I{constructor(){super();this._prelimContent=[],this._searchMarker=[]}static from(t){let e=new va;return e.push(t),e}_integrate(t,e){super._integrate(t,e),this.insert(0,this._prelimContent),this._prelimContent=null}_copy(){return new va}clone(){let t=new va;return t.insert(0,this.toArray().map((e)=>e instanceof I?e.clone():e)),t}get length(){return this.doc??O(),this._length}_callObserver(t,e){super._callObserver(t,e),sn(this,t,new ky(this,t))}insert(t,e){if(this.doc!==null)x(this.doc,(r)=>{ii(r,this,t,e)});else this._prelimContent.splice(t,0,...e)}push(t){if(this.doc!==null)x(this.doc,(e)=>{mc(e,this,t)});else this._prelimContent.push(...t)}unshift(t){this.insert(0,t)}delete(t,e=1){if(this.doc!==null)x(this.doc,(r)=>{oi(r,this,t,e)});else this._prelimContent.splice(t,e)}get(t){return ri(this,t)}toArray(){return ei(this)}slice(t=0,e=this.length){return ti(this,t,e)}toJSON(){return this.map((t)=>t instanceof I?t.toJSON():t)}map(t){return ni(this,t)}forEach(t){se(this,t)}[Symbol.iterator](){return gc(this)}_write(t){t.writeTypeRef($c)}}var xc=(t)=>new va;class e_ extends le{constructor(t,e,r){super(t,e);this.keysChanged=r}}class rs extends I{constructor(t){super();if(this._prelimContent=null,t===void 0)this._prelimContent=new Map;else this._prelimContent=new Map(t)}_integrate(t,e){super._integrate(t,e),this._prelimContent.forEach((r,s)=>{this.set(s,r)}),this._prelimContent=null}_copy(){return new rs}clone(){let t=new rs;return this.forEach((e,r)=>{t.set(r,e instanceof I?e.clone():e)}),t}_callObserver(t,e){sn(this,t,new e_(this,t,e))}toJSON(){this.doc??O();let t={};return this._map.forEach((e,r)=>{if(!e.deleted){let s=e.content.getContent()[e.length-1];t[r]=s instanceof I?s.toJSON():s}}),t}get size(){return[...je(this)].length}keys(){return Me(je(this),(t)=>t[0])}values(){return Me(je(this),(t)=>t[1].content.getContent()[t[1].length-1])}entries(){return Me(je(this),(t)=>[t[0],t[1].content.getContent()[t[1].length-1]])}forEach(t){this.doc??O(),this._map.forEach((e,r)=>{if(!e.deleted)t(e.content.getContent()[e.length-1],r,this)})}[Symbol.iterator](){return this.entries()}delete(t){if(this.doc!==null)x(this.doc,(e)=>{Ke(e,this,t)});else this._prelimContent.delete(t)}set(t,e){if(this.doc!==null)x(this.doc,(r)=>{ar(r,this,t,e)});else this._prelimContent.set(t,e);return e}get(t){return hr(this,t)}has(t){return li(this,t)}clear(){if(this.doc!==null)x(this.doc,(t)=>{this.forEach(function(e,r,s){Ke(t,s,r)})});else this._prelimContent.clear()}_write(t){t.writeTypeRef(Fc)}}var yc=(t)=>new rs,tt=(t,e)=>t===e||typeof t==="object"&&typeof e==="object"&&t&&e&&In(t,e);class We{constructor(t,e,r,s){this.left=t,this.right=e,this.index=r,this.currentAttributes=s}forward(){if(this.right===null)v();switch(this.right.content.constructor){case U:if(!this.right.deleted)Rt(this.currentAttributes,this.right.content);break;default:if(!this.right.deleted)this.index+=this.right.length;break}this.left=this.right,this.right=this.right.right}}var Cs=(t,e,r)=>{while(e.right!==null&&r>0){switch(e.right.content.constructor){case U:if(!e.right.deleted)Rt(e.currentAttributes,e.right.content);break;default:if(!e.right.deleted){if(r<e.right.length)N(t,m(e.right.id.client,e.right.id.clock+r));e.index+=e.right.length,r-=e.right.length}break}e.left=e.right,e.right=e.right.right}return e},qe=(t,e,r,s)=>{let i=new Map,o=s?rn(e,r):null;if(o){let c=new We(o.p.left,o.p,o.index,i);return Cs(t,c,r-o.index)}else{let c=new We(null,e._start,0,i);return Cs(t,c,r)}},ai=(t,e,r,s)=>{while(r.right!==null&&(r.right.deleted===!0||r.right.content.constructor===U&&tt(s.get(r.right.content.key),r.right.content.value))){if(!r.right.deleted)s.delete(r.right.content.key);r.forward()}let i=t.doc,o=i.clientID;s.forEach((c,l)=>{let{left:h,right:f}=r,a=new y(m(o,b(i.store,o)),h,h&&h.lastId,f,f&&f.id,e,null,new U(l,c));a.integrate(t,0),r.right=a,r.forward()})},Rt=(t,e)=>{let{key:r,value:s}=e;if(s===null)t.delete(r);else t.set(r,s)},hi=(t,e)=>{while(!0){if(t.right===null)break;else if(t.right.deleted||t.right.content.constructor===U&&tt(e[t.right.content.key]??null,t.right.content.value));else break;t.forward()}},ui=(t,e,r,s)=>{let i=t.doc,o=i.clientID,c=new Map;for(let l in s){let h=s[l],f=r.currentAttributes.get(l)??null;if(!tt(f,h)){c.set(l,f);let{left:a,right:u}=r;r.right=new y(m(o,b(i.store,o)),a,a&&a.lastId,u,u&&u.id,e,null,new U(l,h)),r.right.integrate(t,0),r.forward()}}return c},Kn=(t,e,r,s,i)=>{r.currentAttributes.forEach((d,p)=>{if(i[p]===void 0)i[p]=null});let o=t.doc,c=o.clientID;hi(r,i);let l=ui(t,e,r,i),h=s.constructor===String?new K(s):s instanceof I?new W(s):new ut(s),{left:f,right:a,index:u}=r;if(e._searchMarker)re(e._searchMarker,r.index,h.getLength());a=new y(m(c,b(o.store,c)),f,f&&f.lastId,a,a&&a.id,e,null,h),a.integrate(t,0),r.right=a,r.index=u,r.forward(),ai(t,e,r,l)},Ds=(t,e,r,s,i)=>{let o=t.doc,c=o.clientID;hi(r,i);let l=ui(t,e,r,i);t:while(r.right!==null&&(s>0||l.size>0&&(r.right.deleted||r.right.content.constructor===U))){if(!r.right.deleted)switch(r.right.content.constructor){case U:{let{key:h,value:f}=r.right.content,a=i[h];if(a!==void 0){if(tt(a,f))l.delete(h);else{if(s===0)break t;l.set(h,f)}r.right.delete(t)}else r.currentAttributes.set(h,f);break}default:if(s<r.right.length)N(t,m(r.right.id.client,r.right.id.clock+s));s-=r.right.length;break}r.forward()}if(s>0){let h="";for(;s>0;s--)h+=`
4
- `;r.right=new y(m(c,b(o.store,c)),r.left,r.left&&r.left.lastId,r.right,r.right&&r.right.id,e,null,new K(h)),r.right.integrate(t,0),r.forward()}ai(t,e,r,l)},di=(t,e,r,s,i)=>{let o=e,c=A();while(o&&(!o.countable||o.deleted)){if(!o.deleted&&o.content.constructor===U){let f=o.content;c.set(f.key,f)}o=o.right}let l=0,h=!1;while(e!==o){if(r===e)h=!0;if(!e.deleted){let f=e.content;switch(f.constructor){case U:{let{key:a,value:u}=f,d=s.get(a)??null;if(c.get(a)!==f||d===u){if(e.delete(t),l++,!h&&(i.get(a)??null)===u&&d!==u)if(d===null)i.delete(a);else i.set(a,d)}if(!h&&!e.deleted)Rt(i,f);break}}}e=e.right}return l},bc=(t,e)=>{while(e&&e.right&&(e.right.deleted||!e.right.countable))e=e.right;let r=new Set;while(e&&(e.deleted||!e.countable)){if(!e.deleted&&e.content.constructor===U){let s=e.content.key;if(r.has(s))e.delete(t);else r.add(s)}e=e.left}},kc=(t)=>{let e=0;return x(t.doc,(r)=>{let{_start:s,_start:i}=t,o=A(),c=Ee(o);while(i){if(i.deleted===!1)switch(i.content.constructor){case U:Rt(c,i.content);break;default:e+=di(r,s,i,o,c),o=Ee(c),s=i;break}i=i.right}}),e},_c=(t)=>{let e=new Set,r=t.doc;for(let[s,i]of t.afterState.entries()){let o=t.beforeState.get(s)||0;if(i===o)continue;Js(t,r.store.clients.get(s),o,i,(c)=>{if(!c.deleted&&c.content.constructor===U&&c.constructor!==V)e.add(c.parent)})}x(r,(s)=>{Bt(t,t.deleteSet,(i)=>{if(i instanceof V||!i.parent._hasFormatting||e.has(i.parent))return;let o=i.parent;if(i.content.constructor===U)e.add(o);else bc(s,i)});for(let i of e)kc(i)})},Bs=(t,e,r)=>{let s=r,i=Ee(e.currentAttributes),o=e.right;while(r>0&&e.right!==null){if(e.right.deleted===!1)switch(e.right.content.constructor){case W:case ut:case K:if(r<e.right.length)N(t,m(e.right.id.client,e.right.id.clock+r));r-=e.right.length,e.right.delete(t);break}e.forward()}if(o)di(t,o,e.right,i,e.currentAttributes);let c=(e.left||e.right).parent;if(c._searchMarker)re(c._searchMarker,e.index,-s+r);return e};class t_ extends le{constructor(t,e,r){super(t,e);this.childListChanged=!1,this.keysChanged=new Set,r.forEach((s)=>{if(s===null)this.childListChanged=!0;else this.keysChanged.add(s)})}get changes(){if(this._changes===null){let t={keys:this.keys,delta:this.delta,added:new Set,deleted:new Set};this._changes=t}return this._changes}get delta(){if(this._delta===null){let t=this.target.doc,e=[];x(t,(r)=>{let s=new Map,i=new Map,o=this.target._start,c=null,l={},h="",f=0,a=0,u=()=>{if(c!==null){let d=null;switch(c){case"delete":if(a>0)d={delete:a};a=0;break;case"insert":if(typeof h==="object"||h.length>0){if(d={insert:h},s.size>0)d.attributes={},s.forEach((p,g)=>{if(p!==null)d.attributes[g]=p})}h="";break;case"retain":if(f>0){if(d={retain:f},!Mr(l))d.attributes=Lr({},l)}f=0;break}if(d)e.push(d);c=null}};while(o!==null){switch(o.content.constructor){case W:case ut:if(this.adds(o)){if(!this.deletes(o))u(),c="insert",h=o.content.getContent()[0],u()}else if(this.deletes(o)){if(c!=="delete")u(),c="delete";a+=1}else if(!o.deleted){if(c!=="retain")u(),c="retain";f+=1}break;case K:if(this.adds(o)){if(!this.deletes(o)){if(c!=="insert")u(),c="insert";h+=o.content.str}}else if(this.deletes(o)){if(c!=="delete")u(),c="delete";a+=o.length}else if(!o.deleted){if(c!=="retain")u(),c="retain";f+=o.length}break;case U:{let{key:d,value:p}=o.content;if(this.adds(o)){if(!this.deletes(o)){let g=s.get(d)??null;if(!tt(g,p)){if(c==="retain")u();if(tt(p,i.get(d)??null))delete l[d];else l[d]=p}else if(p!==null)o.delete(r)}}else if(this.deletes(o)){i.set(d,p);let g=s.get(d)??null;if(!tt(g,p)){if(c==="retain")u();l[d]=g}}else if(!o.deleted){i.set(d,p);let g=l[d];if(g!==void 0){if(!tt(g,p)){if(c==="retain")u();if(p===null)delete l[d];else l[d]=p}else if(g!==null)o.delete(r)}}if(!o.deleted){if(c==="insert")u();Rt(s,o.content)}break}}o=o.right}u();while(e.length>0){let d=e[e.length-1];if(d.retain!==void 0&&d.attributes===void 0)e.pop();else break}}),this._delta=e}return this._delta}}class ss extends I{constructor(t){super();this._pending=t!==void 0?[()=>this.insert(0,t)]:[],this._searchMarker=[],this._hasFormatting=!1}get length(){return this.doc??O(),this._length}_integrate(t,e){super._integrate(t,e);try{this._pending.forEach((r)=>r())}catch(r){console.error(r)}this._pending=null}_copy(){return new ss}clone(){let t=new ss;return t.applyDelta(this.toDelta()),t}_callObserver(t,e){super._callObserver(t,e);let r=new t_(this,t,e);if(sn(this,t,r),!t.local&&this._hasFormatting)t._needFormattingCleanup=!0}toString(){this.doc??O();let t="",e=this._start;while(e!==null){if(!e.deleted&&e.countable&&e.content.constructor===K)t+=e.content.str;e=e.right}return t}toJSON(){return this.toString()}applyDelta(t,{sanitize:e=!0}={}){if(this.doc!==null)x(this.doc,(r)=>{let s=new We(null,this._start,0,new Map);for(let i=0;i<t.length;i++){let o=t[i];if(o.insert!==void 0){let c=!e&&typeof o.insert==="string"&&i===t.length-1&&s.right===null&&o.insert.slice(-1)===`
5
- `?o.insert.slice(0,-1):o.insert;if(typeof c!=="string"||c.length>0)Kn(r,this,s,c,o.attributes||{})}else if(o.retain!==void 0)Ds(r,this,s,o.retain,o.attributes||{});else if(o.delete!==void 0)Bs(r,s,o.delete)}});else this._pending.push(()=>this.applyDelta(t))}toDelta(t,e,r){this.doc??O();let s=[],i=new Map,o=this.doc,c="",l=this._start;function h(){if(c.length>0){let a={},u=!1;i.forEach((p,g)=>{u=!0,a[g]=p});let d={insert:c};if(u)d.attributes=a;s.push(d),c=""}}let f=()=>{while(l!==null){if(At(l,t)||e!==void 0&&At(l,e))switch(l.content.constructor){case K:{let a=i.get("ychange");if(t!==void 0&&!At(l,t)){if(a===void 0||a.user!==l.id.client||a.type!=="removed")h(),i.set("ychange",r?r("removed",l.id):{type:"removed"})}else if(e!==void 0&&!At(l,e)){if(a===void 0||a.user!==l.id.client||a.type!=="added")h(),i.set("ychange",r?r("added",l.id):{type:"added"})}else if(a!==void 0)h(),i.delete("ychange");c+=l.content.str;break}case W:case ut:{h();let a={insert:l.content.getContent()[0]};if(i.size>0){let u={};a.attributes=u,i.forEach((d,p)=>{u[p]=d})}s.push(a);break}case U:if(At(l,t))h(),Rt(i,l.content);break}l=l.right}h()};if(t||e)x(o,(a)=>{if(t)Zn(a,t);if(e)Zn(a,e);f()},"cleanup");else f();return s}insert(t,e,r){if(e.length<=0)return;let s=this.doc;if(s!==null)x(s,(i)=>{let o=qe(i,this,t,!r);if(!r)r={},o.currentAttributes.forEach((c,l)=>{r[l]=c});Kn(i,this,o,e,r)});else this._pending.push(()=>this.insert(t,e,r))}insertEmbed(t,e,r){let s=this.doc;if(s!==null)x(s,(i)=>{let o=qe(i,this,t,!r);Kn(i,this,o,e,r||{})});else this._pending.push(()=>this.insertEmbed(t,e,r||{}))}delete(t,e){if(e===0)return;let r=this.doc;if(r!==null)x(r,(s)=>{Bs(s,qe(s,this,t,!0),e)});else this._pending.push(()=>this.delete(t,e))}format(t,e,r){if(e===0)return;let s=this.doc;if(s!==null)x(s,(i)=>{let o=qe(i,this,t,!1);if(o.right===null)return;Ds(i,this,o,e,r)});else this._pending.push(()=>this.format(t,e,r))}removeAttribute(t){if(this.doc!==null)x(this.doc,(e)=>{Ke(e,this,t)});else this._pending.push(()=>this.removeAttribute(t))}setAttribute(t,e){if(this.doc!==null)x(this.doc,(r)=>{ar(r,this,t,e)});else this._pending.push(()=>this.setAttribute(t,e))}getAttribute(t){return hr(this,t)}getAttributes(){return ci(this)}_write(t){t.writeTypeRef(jc)}}var Sc=(t)=>new ss;class ze{constructor(t,e=()=>!0){this._filter=e,this._root=t,this._currentNode=t._start,this._firstCall=!0,t.doc??O()}[Symbol.iterator](){return this}next(){let t=this._currentNode,e=t&&t.content&&t.content.type;if(t!==null&&(!this._firstCall||t.deleted||!this._filter(e)))do if(e=t.content.type,!t.deleted&&(e.constructor===Ot||e.constructor===lt)&&e._start!==null)t=e._start;else while(t!==null){let r=t.next;if(r!==null){t=r;break}else if(t.parent===this._root)t=null;else t=t.parent._item}while(t!==null&&(t.deleted||!this._filter(t.content.type)));if(this._firstCall=!1,t===null)return{value:void 0,done:!0};return this._currentNode=t,{value:t.content.type,done:!1}}}class lt extends I{constructor(){super();this._prelimContent=[]}get firstChild(){let t=this._first;return t?t.content.getContent()[0]:null}_integrate(t,e){super._integrate(t,e),this.insert(0,this._prelimContent),this._prelimContent=null}_copy(){return new lt}clone(){let t=new lt;return t.insert(0,this.toArray().map((e)=>e instanceof I?e.clone():e)),t}get length(){return this.doc??O(),this._prelimContent===null?this._length:this._prelimContent.length}createTreeWalker(t){return new ze(this,t)}querySelector(t){t=t.toUpperCase();let r=new ze(this,(s)=>s.nodeName&&s.nodeName.toUpperCase()===t).next();if(r.done)return null;else return r.value}querySelectorAll(t){return t=t.toUpperCase(),j(new ze(this,(e)=>e.nodeName&&e.nodeName.toUpperCase()===t))}_callObserver(t,e){sn(this,t,new fi(this,e,t))}toString(){return ni(this,(t)=>t.toString()).join("")}toJSON(){return this.toString()}toDOM(t=document,e={},r){let s=t.createDocumentFragment();if(r!==void 0)r._createAssociation(s,this);return se(this,(i)=>{s.insertBefore(i.toDOM(t,e,r),null)}),s}insert(t,e){if(this.doc!==null)x(this.doc,(r)=>{ii(r,this,t,e)});else this._prelimContent.splice(t,0,...e)}insertAfter(t,e){if(this.doc!==null)x(this.doc,(r)=>{let s=t&&t instanceof I?t._item:t;Pe(r,this,s,e)});else{let r=this._prelimContent,s=t===null?0:r.findIndex((i)=>i===t)+1;if(s===0&&t!==null)throw R("Reference item not found");r.splice(s,0,...e)}}delete(t,e=1){if(this.doc!==null)x(this.doc,(r)=>{oi(r,this,t,e)});else this._prelimContent.splice(t,e)}toArray(){return ei(this)}push(t){this.insert(this.length,t)}unshift(t){this.insert(0,t)}get(t){return ri(this,t)}slice(t=0,e=this.length){return ti(this,t,e)}forEach(t){se(this,t)}_write(t){t.writeTypeRef(Gc)}}var Ec=(t)=>new lt;class Ot extends lt{constructor(t="UNDEFINED"){super();this.nodeName=t,this._prelimAttrs=new Map}get nextSibling(){let t=this._item?this._item.next:null;return t?t.content.type:null}get prevSibling(){let t=this._item?this._item.prev:null;return t?t.content.type:null}_integrate(t,e){super._integrate(t,e),this._prelimAttrs.forEach((r,s)=>{this.setAttribute(s,r)}),this._prelimAttrs=null}_copy(){return new Ot(this.nodeName)}clone(){let t=new Ot(this.nodeName),e=this.getAttributes();return Vr(e,(r,s)=>{t.setAttribute(s,r)}),t.insert(0,this.toArray().map((r)=>r instanceof I?r.clone():r)),t}toString(){let t=this.getAttributes(),e=[],r=[];for(let c in t)r.push(c);r.sort();let s=r.length;for(let c=0;c<s;c++){let l=r[c];e.push(l+'="'+t[l]+'"')}let i=this.nodeName.toLocaleLowerCase(),o=e.length>0?" "+e.join(" "):"";return`<${i}${o}>${super.toString()}</${i}>`}removeAttribute(t){if(this.doc!==null)x(this.doc,(e)=>{Ke(e,this,t)});else this._prelimAttrs.delete(t)}setAttribute(t,e){if(this.doc!==null)x(this.doc,(r)=>{ar(r,this,t,e)});else this._prelimAttrs.set(t,e)}getAttribute(t){return hr(this,t)}hasAttribute(t){return li(this,t)}getAttributes(t){return t?wc(this,t):ci(this)}toDOM(t=document,e={},r){let s=t.createElement(this.nodeName),i=this.getAttributes();for(let o in i){let c=i[o];if(typeof c==="string")s.setAttribute(o,c)}if(se(this,(o)=>{s.appendChild(o.toDOM(t,e,r))}),r!==void 0)r._createAssociation(s,this);return s}_write(t){t.writeTypeRef(qc),t.writeKey(this.nodeName)}}var Ic=(t)=>new Ot(t.readKey());class fi extends le{constructor(t,e,r){super(t,r);this.childListChanged=!1,this.attributesChanged=new Set,e.forEach((s)=>{if(s===null)this.childListChanged=!0;else this.attributesChanged.add(s)})}}class Ze extends rs{constructor(t){super();this.hookName=t}_copy(){return new Ze(this.hookName)}clone(){let t=new Ze(this.hookName);return this.forEach((e,r)=>{t.set(r,e)}),t}toDOM(t=document,e={},r){let s=e[this.hookName],i;if(s!==void 0)i=s.createDom(this);else i=document.createElement(this.hookName);if(i.setAttribute("data-yjs-hook",this.hookName),r!==void 0)r._createAssociation(i,this);return i}_write(t){t.writeTypeRef(zc),t.writeKey(this.hookName)}}var Uc=(t)=>new Ze(t.readKey());class Xe extends ss{get nextSibling(){let t=this._item?this._item.next:null;return t?t.content.type:null}get prevSibling(){let t=this._item?this._item.prev:null;return t?t.content.type:null}_copy(){return new Xe}clone(){let t=new Xe;return t.applyDelta(this.toDelta()),t}toDOM(t=document,e,r){let s=t.createTextNode(this.toString());if(r!==void 0)r._createAssociation(s,this);return s}toString(){return this.toDelta().map((t)=>{let e=[];for(let s in t.attributes){let i=[];for(let o in t.attributes[s])i.push({key:o,value:t.attributes[s][o]});i.sort((o,c)=>o.key<c.key?-1:1),e.push({nodeName:s,attrs:i})}e.sort((s,i)=>s.nodeName<i.nodeName?-1:1);let r="";for(let s=0;s<e.length;s++){let i=e[s];r+=`<${i.nodeName}`;for(let o=0;o<i.attrs.length;o++){let c=i.attrs[o];r+=` ${c.key}="${c.value}"`}r+=">"}r+=t.insert;for(let s=e.length-1;s>=0;s--)r+=`</${e[s].nodeName}>`;return r}).join("")}toJSON(){return this.toString()}_write(t){t.writeTypeRef(Hc)}}var Tc=(t)=>new Xe;class on{constructor(t,e){this.id=t,this.length=e}get deleted(){throw L()}mergeWith(t){return!1}write(t,e,r){throw L()}integrate(t,e){throw L()}}var Ac=0;class V extends on{get deleted(){return!0}delete(){}mergeWith(t){if(this.constructor!==t.constructor)return!1;return this.length+=t.length,!0}integrate(t,e){if(e>0)this.id.clock+=e,this.length-=e;Hs(t.doc.store,this)}write(t,e){t.writeInfo(Ac),t.writeLen(this.length-e)}getMissing(t,e){return null}}class ae{constructor(t){this.content=t}getLength(){return 1}getContent(){return[this.content]}isCountable(){return!0}copy(){return new ae(this.content)}splice(t){throw L()}mergeWith(t){return!1}integrate(t,e){}delete(t){}gc(t){}write(t,e){t.writeBuf(this.content)}getRef(){return 3}}var Cc=(t)=>new ae(t.readBuf());class ie{constructor(t){this.len=t}getLength(){return this.len}getContent(){return[]}isCountable(){return!1}copy(){return new ie(this.len)}splice(t){let e=new ie(this.len-t);return this.len=t,e}mergeWith(t){return this.len+=t.len,!0}integrate(t,e){ne(t.deleteSet,e.id.client,e.id.clock,this.len),e.markDeleted()}delete(t){}gc(t){}write(t,e){t.writeLen(this.len-e)}getRef(){return 1}}var Dc=(t)=>new ie(t.readLen()),pi=(t,e)=>new xd({guid:t,...e,shouldLoad:e.shouldLoad||e.autoLoad||!1});class he{constructor(t){if(t._item)console.error("This document was already integrated as a sub-document. You should create a second instance instead with the same guid.");this.doc=t;let e={};if(this.opts=e,!t.gc)e.gc=!1;if(t.autoLoad)e.autoLoad=!0;if(t.meta!==null)e.meta=t.meta}getLength(){return 1}getContent(){return[this.doc]}isCountable(){return!0}copy(){return new he(pi(this.doc.guid,this.opts))}splice(t){throw L()}mergeWith(t){return!1}integrate(t,e){if(this.doc._item=e,t.subdocsAdded.add(this.doc),this.doc.shouldLoad)t.subdocsLoaded.add(this.doc)}delete(t){if(t.subdocsAdded.has(this.doc))t.subdocsAdded.delete(this.doc);else t.subdocsRemoved.add(this.doc)}gc(t){}write(t,e){t.writeString(this.doc.guid),t.writeAny(this.opts)}getRef(){return 9}}var Bc=(t)=>new he(pi(t.readString(),t.readAny()));class ut{constructor(t){this.embed=t}getLength(){return 1}getContent(){return[this.embed]}isCountable(){return!0}copy(){return new ut(this.embed)}splice(t){throw L()}mergeWith(t){return!1}integrate(t,e){}delete(t){}gc(t){}write(t,e){t.writeJSON(this.embed)}getRef(){return 5}}var Oc=(t)=>new ut(t.readJSON());class U{constructor(t,e){this.key=t,this.value=e}getLength(){return 1}getContent(){return[]}isCountable(){return!1}copy(){return new U(this.key,this.value)}splice(t){throw L()}mergeWith(t){return!1}integrate(t,e){let r=e.parent;r._searchMarker=null,r._hasFormatting=!0}delete(t){}gc(t){}write(t,e){t.writeKey(this.key),t.writeJSON(this.value)}getRef(){return 6}}var vc=(t)=>new U(t.readKey(),t.readJSON());class Qe{constructor(t){this.arr=t}getLength(){return this.arr.length}getContent(){return this.arr}isCountable(){return!0}copy(){return new Qe(this.arr)}splice(t){let e=new Qe(this.arr.slice(t));return this.arr=this.arr.slice(0,t),e}mergeWith(t){return this.arr=this.arr.concat(t.arr),!0}integrate(t,e){}delete(t){}gc(t){}write(t,e){let r=this.arr.length;t.writeLen(r-e);for(let s=e;s<r;s++){let i=this.arr[s];t.writeString(i===void 0?"undefined":JSON.stringify(i))}}getRef(){return 2}}var Nc=(t)=>{let e=t.readLen(),r=[];for(let s=0;s<e;s++){let i=t.readString();if(i==="undefined")r.push(void 0);else r.push(JSON.parse(i))}return new Qe(r)},Rc=Zt("node_env")==="development";class at{constructor(t){this.arr=t,Rc&&Un(t)}getLength(){return this.arr.length}getContent(){return this.arr}isCountable(){return!0}copy(){return new at(this.arr)}splice(t){let e=new at(this.arr.slice(t));return this.arr=this.arr.slice(0,t),e}mergeWith(t){return this.arr=this.arr.concat(t.arr),!0}integrate(t,e){}delete(t){}gc(t){}write(t,e){let r=this.arr.length;t.writeLen(r-e);for(let s=e;s<r;s++){let i=this.arr[s];t.writeAny(i)}}getRef(){return 8}}var Lc=(t)=>{let e=t.readLen(),r=[];for(let s=0;s<e;s++)r.push(t.readAny());return new at(r)};class K{constructor(t){this.str=t}getLength(){return this.str.length}getContent(){return this.str.split("")}isCountable(){return!0}copy(){return new K(this.str)}splice(t){let e=new K(this.str.slice(t));this.str=this.str.slice(0,t);let r=this.str.charCodeAt(t-1);if(r>=55296&&r<=56319)this.str=this.str.slice(0,t-1)+"�",e.str="�"+e.str.slice(1);return e}mergeWith(t){return this.str+=t.str,!0}integrate(t,e){}delete(t){}gc(t){}write(t,e){t.writeString(e===0?this.str:this.str.slice(e))}getRef(){return 4}}var Vc=(t)=>new K(t.readString()),Mc=[xc,yc,Sc,Ic,Ec,Uc,Tc],$c=0,Fc=1,jc=2,qc=3,Gc=4,zc=5,Hc=6;class W{constructor(t){this.type=t}getLength(){return 1}getContent(){return[this.type]}isCountable(){return!0}copy(){return new W(this.type._copy())}splice(t){throw L()}mergeWith(t){return!1}integrate(t,e){this.type._integrate(t.doc,e)}delete(t){let e=this.type._start;while(e!==null){if(!e.deleted)e.delete(t);else if(e.id.clock<(t.beforeState.get(e.id.client)||0))t._mergeStructs.push(e);e=e.right}this.type._map.forEach((r)=>{if(!r.deleted)r.delete(t);else if(r.id.clock<(t.beforeState.get(r.id.client)||0))t._mergeStructs.push(r)}),t.changed.delete(this.type)}gc(t){let e=this.type._start;while(e!==null)e.gc(t,!0),e=e.right;this.type._start=null,this.type._map.forEach((r)=>{while(r!==null)r.gc(t,!0),r=r.left}),this.type._map=new Map}write(t,e){this.type._write(t)}getRef(){return 7}}var Jc=(t)=>new W(Mc[t.readTypeRef()](t)),Qn=(t,e)=>{let r=e,s=0,i;do{if(s>0)r=m(r.client,r.clock+s);i=Ct(t,r),s=r.clock-i.id.clock,r=i.redone}while(r!==null&&i instanceof y);return{item:i,diff:s}},ur=(t,e)=>{while(t!==null&&t.keep!==e)t.keep=e,t=t.parent._item},Ye=(t,e,r)=>{let{client:s,clock:i}=e.id,o=new y(m(s,i+r),e,m(s,i+r-1),e.right,e.rightOrigin,e.parent,e.parentSub,e.content.splice(r));if(e.deleted)o.markDeleted();if(e.keep)o.keep=!0;if(e.redone!==null)o.redone=m(e.redone.client,e.redone.clock+r);if(e.right=o,o.right!==null)o.right.left=o;if(t._mergeStructs.push(o),o.parentSub!==null&&o.right===null)o.parent._map.set(o.parentSub,o);return e.length=r,o},Os=(t,e)=>$t(t,(r)=>ce(r.deletions,e)),gi=(t,e,r,s,i,o)=>{let c=t.doc,{store:l,clientID:h}=c,f=e.redone;if(f!==null)return N(t,f);let a=e.parent._item,u=null,d;if(a!==null&&a.deleted===!0){if(a.redone===null&&(!r.has(a)||gi(t,a,r,s,i,o)===null))return null;while(a.redone!==null)a=N(t,a.redone)}let p=a===null?e.parent:a.content.type;if(e.parentSub===null){u=e.left,d=e;while(u!==null){let k=u;while(k!==null&&k.parent._item!==a)k=k.redone===null?null:N(t,k.redone);if(k!==null&&k.parent._item===a){u=k;break}u=u.left}while(d!==null){let k=d;while(k!==null&&k.parent._item!==a)k=k.redone===null?null:N(t,k.redone);if(k!==null&&k.parent._item===a){d=k;break}d=d.right}}else{if(d=null,e.right&&!i){u=e;while(u!==null&&u.right!==null&&(u.right.redone||ce(s,u.right.id)||Os(o.undoStack,u.right.id)||Os(o.redoStack,u.right.id))){u=u.right;while(u.redone)u=N(t,u.redone)}if(u&&u.right!==null)return null}else u=p._map.get(e.parentSub)||null;if(u!==null&&u.parent._item!==a)u=p._map.get(e.parentSub)||null}let g=b(l,h),w=m(h,g),C=new y(w,u,u&&u.lastId,d,d&&d.id,p,e.parentSub,e.content.copy());return e.redone=w,ur(C,!0),C.integrate(t,0),C};class y extends on{constructor(t,e,r,s,i,o,c,l){super(t,l.getLength());this.origin=r,this.left=e,this.right=s,this.rightOrigin=i,this.parent=o,this.parentSub=c,this.redone=null,this.content=l,this.info=this.content.isCountable()?ln:0}set marker(t){if((this.info&pe)>0!==t)this.info^=pe}get marker(){return(this.info&pe)>0}get keep(){return(this.info&cn)>0}set keep(t){if(this.keep!==t)this.info^=cn}get countable(){return(this.info&ln)>0}get deleted(){return(this.info&fe)>0}set deleted(t){if(this.deleted!==t)this.info^=fe}markDeleted(){this.info|=fe}getMissing(t,e){if(this.origin&&this.origin.client!==this.id.client&&this.origin.clock>=b(e,this.origin.client))return this.origin.client;if(this.rightOrigin&&this.rightOrigin.client!==this.id.client&&this.rightOrigin.clock>=b(e,this.rightOrigin.client))return this.rightOrigin.client;if(this.parent&&this.parent.constructor===ot&&this.id.client!==this.parent.client&&this.parent.clock>=b(e,this.parent.client))return this.parent.client;if(this.origin)this.left=Ss(t,e,this.origin),this.origin=this.left.lastId;if(this.rightOrigin)this.right=N(t,this.rightOrigin),this.rightOrigin=this.right.id;if(this.left&&this.left.constructor===V||this.right&&this.right.constructor===V)this.parent=null;else if(!this.parent){if(this.left&&this.left.constructor===y)this.parent=this.left.parent,this.parentSub=this.left.parentSub;else if(this.right&&this.right.constructor===y)this.parent=this.right.parent,this.parentSub=this.right.parentSub}else if(this.parent.constructor===ot){let r=Ct(e,this.parent);if(r.constructor===V)this.parent=null;else this.parent=r.content.type}return null}integrate(t,e){if(e>0)this.id.clock+=e,this.left=Ss(t,t.doc.store,m(this.id.client,this.id.clock-1)),this.origin=this.left.lastId,this.content=this.content.splice(e),this.length-=e;if(this.parent){if(!this.left&&(!this.right||this.right.left!==null)||this.left&&this.left.right!==this.right){let r=this.left,s;if(r!==null)s=r.right;else if(this.parentSub!==null){s=this.parent._map.get(this.parentSub)||null;while(s!==null&&s.left!==null)s=s.left}else s=this.parent._start;let i=new Set,o=new Set;while(s!==null&&s!==this.right){if(o.add(s),i.add(s),$e(this.origin,s.origin)){if(s.id.client<this.id.client)r=s,i.clear();else if($e(this.rightOrigin,s.rightOrigin))break}else if(s.origin!==null&&o.has(Ct(t.doc.store,s.origin))){if(!i.has(Ct(t.doc.store,s.origin)))r=s,i.clear()}else break;s=s.right}this.left=r}if(this.left!==null){let r=this.left.right;this.right=r,this.left.right=this}else{let r;if(this.parentSub!==null){r=this.parent._map.get(this.parentSub)||null;while(r!==null&&r.left!==null)r=r.left}else r=this.parent._start,this.parent._start=this;this.right=r}if(this.right!==null)this.right.left=this;else if(this.parentSub!==null){if(this.parent._map.set(this.parentSub,this),this.left!==null)this.left.delete(t)}if(this.parentSub===null&&this.countable&&!this.deleted)this.parent._length+=this.length;if(Hs(t.doc.store,this),this.content.integrate(t,this),Is(t,this.parent,this.parentSub),this.parent._item!==null&&this.parent._item.deleted||this.parentSub!==null&&this.right!==null)this.delete(t)}else new V(this.id,this.length).integrate(t,0)}get next(){let t=this.right;while(t!==null&&t.deleted)t=t.right;return t}get prev(){let t=this.left;while(t!==null&&t.deleted)t=t.left;return t}get lastId(){return this.length===1?this.id:m(this.id.client,this.id.clock+this.length-1)}mergeWith(t){if(this.constructor===t.constructor&&$e(t.origin,this.lastId)&&this.right===t&&$e(this.rightOrigin,t.rightOrigin)&&this.id.client===t.id.client&&this.id.clock+this.length===t.id.clock&&this.deleted===t.deleted&&this.redone===null&&t.redone===null&&this.content.constructor===t.content.constructor&&this.content.mergeWith(t.content)){let e=this.parent._searchMarker;if(e)e.forEach((r)=>{if(r.p===t){if(r.p=this,!this.deleted&&this.countable)r.index-=this.length}});if(t.keep)this.keep=!0;if(this.right=t.right,this.right!==null)this.right.left=this;return this.length+=t.length,!0}return!1}delete(t){if(!this.deleted){let e=this.parent;if(this.countable&&this.parentSub===null)e._length-=this.length;this.markDeleted(),ne(t.deleteSet,this.id.client,this.id.clock,this.length),Is(t,e,this.parentSub),this.content.delete(t)}}gc(t,e){if(!this.deleted)throw v();if(this.content.gc(t),e)rc(t,this,new V(this.id,this.length));else this.content=new ie(this.length)}write(t,e){let r=e>0?m(this.id.client,this.id.clock+e-1):this.origin,s=this.rightOrigin,i=this.parentSub,o=this.content.getRef()&Vt|(r===null?0:D)|(s===null?0:F)|(i===null?0:dt);if(t.writeInfo(o),r!==null)t.writeLeftID(r);if(s!==null)t.writeRightID(s);if(r===null&&s===null){let c=this.parent;if(c._item!==void 0){let l=c._item;if(l===null){let h=js(c);t.writeParentInfo(!0),t.writeString(h)}else t.writeParentInfo(!1),t.writeLeftID(l.id)}else if(c.constructor===String)t.writeParentInfo(!0),t.writeString(c);else if(c.constructor===ot)t.writeParentInfo(!1),t.writeLeftID(c);else v();if(i!==null)t.writeString(i)}this.content.write(t,e)}}var mi=(t,e)=>Pc[e&Vt](t),Pc=[()=>{v()},Dc,Nc,Cc,Vc,Oc,vc,Jc,Lc,Bc,()=>{v()}],Kc=10;class M extends on{get deleted(){return!0}delete(){}mergeWith(t){if(this.constructor!==t.constructor)return!1;return this.length+=t.length,!0}integrate(t,e){v()}write(t,e){t.writeInfo(Kc),_t(t.restEncoder,this.length-e)}getMissing(t,e){return null}}var wi=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:{},xi="__ $YJS$ __";if(wi[xi]===!0)console.error("Yjs was already imported. This breaks constructor checks and will lead to issues! - https://github.com/yjs/yjs/issues/438");wi[xi]=!0;var tR=0,nR=1,iR=2,oR=3;class Hg extends Error{constructor(t){super(t);this.name="EnvelopeError"}}function Wc(t){return _(t)&&"type"in t&&n(t.type)}function mk(t){let e=Za(),{type:r}=t;switch(t.type){case"doc-sync":{_t(e,tR),Xa(e,t.path),_t(e,t.epoch),zo(e,t.body);break}case"awareness":{_t(e,nR),zo(e,t.body);break}case"doc-close":{_t(e,iR),Xa(e,t.path);break}case"control":{_t(e,oR),Xa(e,JSON.stringify(t.message));break}default:throw new Hg(`unknown-frame:${r}`)}return br(e)}function gk(t){try{let e=Qa(t),r=Dt(e);switch(r){case tR:{let s=el(e),i=Dt(e);return{body:Xo(e),epoch:i,path:s,type:"doc-sync"}}case nR:return{body:Xo(e),type:"awareness"};case iR:return{path:el(e),type:"doc-close"};case oR:{let s=JSON.parse(el(e));if(!Wc(s))throw new Hg("malformed-control");return{message:s,type:"control"}}default:throw new Hg(`unknown-frame-type:${r}`)}}catch(e){if(e instanceof Hg)throw e;throw new Hg(`malformed-frame: ${e instanceof Error?e.message:String(e)}`)}}
6
- export{pk,os,Za,fk,br,_t,Xa,zo,Qa,Xo,Dt,el,Su,rp,xd,XI,QI,eR,Q0,jg,N2,ky,va,e_,rs,t_,ss,tR,nR,iR,oR,Hg,mk,gk};
1
+ import{n,_}from"./studio-k3we3kqb.js";var is=Math.floor;var nt=Math.abs;var ue=(t,e)=>t<e?t:e,Z=(t,e)=>t>e?t:e;var de=(t)=>t!==0?t<0:1/t<0;var cn=1,ln=2,fe=4,pe=8;var dt=32,F=64,D=128;var Vt=31,Mt=63,X=127;var fr=2147483647;var{MAX_SAFE_INTEGER:ft,MIN_SAFE_INTEGER:hn}=Number;var pr=Number.isInteger||((t)=>typeof t==="number"&&isFinite(t)&&is(t)===t);var G=()=>new Set;var ge=(t)=>t[t.length-1];var gr=(t,e)=>{for(let r=0;r<e.length;r++)t.push(e[r])},j=Array.from,me=(t,e)=>{for(let r=0;r<t.length;r++)if(!e(t[r],r,t))return!1;return!0},$t=(t,e)=>{for(let r=0;r<t.length;r++)if(e(t[r],r,t))return!0;return!1};var mr=(t,e)=>{let r=Array(t);for(let s=0;s<t;s++)r[s]=e(s,r);return r};var Q=Array.isArray;var{fromCharCode:fn,fromCodePoint:yi}=String,Zc=fn(65535),bi=(t)=>t.toLowerCase(),ki=/^\s*/g,_i=(t)=>t.replace(ki,""),Si=/([A-Z])/g,pn=(t,e)=>_i(t.replace(Si,(r)=>`${e}${bi(r)}`));var Ei=(t)=>{let e=unescape(encodeURIComponent(t)),r=e.length,s=new Uint8Array(r);for(let i=0;i<r;i++)s[i]=e.codePointAt(i);return s},gt=typeof TextEncoder<"u"?new TextEncoder:null,Ii=(t)=>gt.encode(t),wr=gt?Ii:Ei;var pt=typeof TextDecoder>"u"?null:new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0});if(pt&&pt.decode(new Uint8Array).length===1)pt=null;var xr=(t,e)=>mr(e,()=>t).join("");class wt{constructor(){this.cpos=0,this.cbuf=new Uint8Array(100),this.bufs=[]}}var Qa=()=>new wt;var Zk=(t)=>{let e=t.cpos;for(let r=0;r<t.bufs.length;r++)e+=t.bufs[r].length;return e};var br=(t)=>{let e=new Uint8Array(Zk(t)),r=0;for(let s=0;s<t.bufs.length;s++){let i=t.bufs[s];e.set(i,r),r+=i.length}return e.set(new Uint8Array(t.cbuf.buffer,0,t.cpos),r),e},Ui=(t,e)=>{let r=t.cbuf.length;if(r-t.cpos<e)t.bufs.push(new Uint8Array(t.cbuf.buffer,0,t.cpos)),t.cbuf=new Uint8Array(Z(r,e)*2),t.cpos=0},T=(t,e)=>{let r=t.cbuf.length;if(t.cpos===r)t.bufs.push(t.cbuf),t.cbuf=new Uint8Array(r*2),t.cpos=0;t.cbuf[t.cpos++]=e};var xe=T;var _t=(t,e)=>{while(e>X)T(t,D|X&e),e=is(e/128);T(t,X&e)},ye=(t,e)=>{let r=de(e);if(r)e=-e;T(t,(e>Mt?D:0)|(r?F:0)|Mt&e),e=is(e/64);while(e>0)T(t,(e>X?D:0)|X&e),e=is(e/128)},gn=new Uint8Array(30000),Ti=gn.length/3,Ai=(t,e)=>{if(e.length<Ti){let r=gt.encodeInto(e,gn).written||0;_t(t,r);for(let s=0;s<r;s++)T(t,gn[s])}else zo(t,wr(e))},Ci=(t,e)=>{let r=unescape(encodeURIComponent(e)),s=r.length;_t(t,s);for(let i=0;i<s;i++)T(t,r.codePointAt(i))},el=gt&&gt.encodeInto?Ai:Ci;var jt=(t,e)=>{let r=t.cbuf.length,s=t.cpos,i=ue(r-s,e.length),o=e.length-i;if(t.cbuf.set(e.subarray(0,i),s),t.cpos+=i,o>0)t.bufs.push(t.cbuf),t.cbuf=new Uint8Array(Z(r*2,o)),t.cbuf.set(e.subarray(i)),t.cpos=o},zo=(t,e)=>{_t(t,e.byteLength),jt(t,e)},mn=(t,e)=>{Ui(t,e);let r=new DataView(t.cbuf.buffer,t.cpos,e);return t.cpos+=e,r},Di=(t,e)=>mn(t,4).setFloat32(0,e,!1),Bi=(t,e)=>mn(t,8).setFloat64(0,e,!1),Oi=(t,e)=>mn(t,8).setBigInt64(0,e,!1);var yr=new DataView(new ArrayBuffer(4)),vi=(t)=>(yr.setFloat32(0,t),yr.getFloat32(0)===t),mt=(t,e)=>{switch(typeof e){case"string":T(t,119),el(t,e);break;case"number":if(pr(e)&&nt(e)<=fr)T(t,125),ye(t,e);else if(vi(e))T(t,124),Di(t,e);else T(t,123),Bi(t,e);break;case"bigint":T(t,122),Oi(t,e);break;case"object":if(e===null)T(t,126);else if(Q(e)){T(t,117),_t(t,e.length);for(let r=0;r<e.length;r++)mt(t,e[r])}else if(e instanceof Uint8Array)T(t,116),zo(t,e);else{T(t,118);let r=Object.keys(e);_t(t,r.length);for(let s=0;s<r.length;s++){let i=r[s];el(t,i),mt(t,e[i])}}break;case"boolean":T(t,e?120:121);break;default:T(t,127)}};class be extends wt{constructor(t){super();this.w=t,this.s=null,this.count=0}write(t){if(this.s===t)this.count++;else{if(this.count>0)_t(this,this.count-1);this.count=1,this.w(this,t),this.s=t}}}var kr=(t)=>{if(t.count>0){if(ye(t.encoder,t.count===1?t.s:-t.s),t.count>1)_t(t.encoder,t.count-2)}};class xt{constructor(){this.encoder=new wt,this.s=0,this.count=0}write(t){if(this.s===t)this.count++;else kr(this),this.count=1,this.s=t}toUint8Array(){return kr(this),br(this.encoder)}}var _r=(t)=>{if(t.count>0){let e=t.diff*2+(t.count===1?0:1);if(ye(t.encoder,e),t.count>1)_t(t.encoder,t.count-2)}};class qt{constructor(){this.encoder=new wt,this.s=0,this.count=0,this.diff=0}write(t){if(this.diff===t-this.s)this.s=t,this.count++;else _r(this),this.count=1,this.diff=t-this.s,this.s=t}toUint8Array(){return _r(this),br(this.encoder)}}class wn{constructor(){this.sarr=[],this.s="",this.lensE=new xt}write(t){if(this.s+=t,this.s.length>19)this.sarr.push(this.s),this.s="";this.lensE.write(t.length)}toUint8Array(){let t=new wt;return this.sarr.push(this.s),this.s="",el(t,this.sarr.join("")),jt(t,this.lensE.toUint8Array()),br(t)}}var R=(t)=>Error(t),L=()=>{throw R("Method unimplemented")},v=()=>{throw R("Unexpected case")};var ke=R("Unexpected end of array"),Er=R("Integer out of Range"),Ni=(t,e,r)=>{if(e<0||r<0||e+r>t.length)throw ke;return new Uint8Array(t.buffer,t.byteOffset+e,r)},Ri=(t,e,r)=>{if(e<0||r<0||e+r>t.length)throw ke;return new DataView(t.buffer,t.byteOffset+e,r)};class Gt{constructor(t){this.arr=t,this.pos=0}}var tl=(t)=>new Gt(t),Ir=(t)=>t.pos!==t.arr.length;var Li=(t,e)=>{let r=Ni(t.arr,t.pos,e);return t.pos+=e,r},Xo=(t)=>Li(t,Dt(t));var rt=(t)=>t.arr[t.pos++];var Dt=(t)=>{let e=0,r=1,s=t.arr.length;while(t.pos<s){let i=t.arr[t.pos++];if(e=e+(i&X)*r,r*=128,i<D)return e;if(e>ft)throw Er}throw ke},_e=(t)=>{let e=t.arr[t.pos++],r=e&Mt,s=64,i=(e&F)>0?-1:1;if((e&D)===0)return i*r;let o=t.arr.length;while(t.pos<o){if(e=t.arr[t.pos++],r=r+(e&X)*s,s*=128,e<D)return i*r;if(r>ft)throw Er}throw ke};var Vi=(t)=>{let e=Dt(t);if(e===0)return"";else{let r=String.fromCodePoint(rt(t));if(--e<100)while(e--)r+=String.fromCodePoint(rt(t));else while(e>0){let s=e<1e4?e:1e4,i=t.arr.subarray(t.pos,t.pos+s);t.pos+=s,r+=String.fromCodePoint.apply(null,i),e-=s}return decodeURIComponent(escape(r))}},Mi=(t)=>pt.decode(Xo(t)),nl=pt?Mi:Vi;var yn=(t,e)=>{let r=Ri(t.arr,t.pos,e);return t.pos+=e,r},$i=(t)=>yn(t,4).getFloat32(0,!1),Fi=(t)=>yn(t,8).getFloat64(0,!1),ji=(t)=>yn(t,8).getBigInt64(0,!1);var qi=[(t)=>{return},(t)=>null,_e,$i,Fi,ji,(t)=>!1,(t)=>!0,nl,(t)=>{let e=Dt(t),r={};for(let s=0;s<e;s++){let i=nl(t);r[i]=yt(t)}return r},(t)=>{let e=Dt(t),r=[];for(let s=0;s<e;s++)r.push(yt(t));return r},Xo],yt=(t)=>qi[127-rt(t)](t);class Se extends Gt{constructor(t,e){super(t);this.reader=e,this.s=null,this.count=0}read(){if(this.count===0)if(this.s=this.reader(this),Ir(this))this.count=Dt(this)+1;else this.count=-1;return this.count--,this.s}}class bt extends Gt{constructor(t){super(t);this.s=0,this.count=0}read(){if(this.count===0){this.s=_e(this);let t=de(this.s);if(this.count=1,t)this.s=-this.s,this.count=Dt(this)+2}return this.count--,this.s}}class zt extends Gt{constructor(t){super(t);this.s=0,this.count=0,this.diff=0}read(){if(this.count===0){let t=_e(this),e=t&1;if(this.diff=is(t/2),this.count=1,e)this.count=Dt(this)+2}return this.s+=this.diff,this.count--,this.s}}class bn{constructor(t){this.decoder=new bt(t),this.str=nl(this.decoder),this.spos=0}read(){let t=this.spos+this.decoder.read(),e=this.str.slice(this.spos,t);return this.spos=t,e}}var A=()=>new Map,Ee=(t)=>{let e=A();return t.forEach((r,s)=>{e.set(s,r)}),e},q=(t,e,r)=>{let s=t.get(e);if(s===void 0)t.set(e,s=r());return s},Tr=(t,e)=>{let r=[];for(let[s,i]of t)r.push(e(i,s));return r},Ar=(t,e)=>{for(let[r,s]of t)if(e(s,r))return!0;return!1};class Ie{constructor(){this._observers=A()}on(t,e){return q(this._observers,t,G).add(e),e}once(t,e){let r=(...s)=>{this.off(t,r),e(...s)};this.on(t,r)}off(t,e){let r=this._observers.get(t);if(r!==void 0){if(r.delete(e),r.size===0)this._observers.delete(t)}}emit(t,e){return j((this._observers.get(t)||A()).values()).forEach((r)=>r(...e))}destroy(){this._observers=A()}}class Yk{constructor(){this._observers=A()}on(t,e){q(this._observers,t,G).add(e)}once(t,e){let r=(...s)=>{this.off(t,r),e(...s)};this.on(t,r)}off(t,e){let r=this._observers.get(t);if(r!==void 0){if(r.delete(e),r.size===0)this._observers.delete(t)}}emit(t,e){return j((this._observers.get(t)||A()).values()).forEach((r)=>r(...e))}destroy(){this._observers=A()}}var rl=crypto.subtle,Cr=crypto.getRandomValues.bind(crypto);var kn=()=>Cr(new Uint32Array(1))[0];var Gi=[1e7]+-1000+-4000+-8000+-100000000000,Dr=()=>Gi.replace(/[018]/g,(t)=>(t^kn()&15>>t/4).toString(16));var $u=Date.now;var _n=(t)=>new Promise(t);var ol=Promise.all.bind(Promise);var Sn=(t)=>t===void 0?null:t;class Or{constructor(){this.map=new Map}setItem(t,e){this.map.set(t,e)}getItem(t){return this.map.get(t)}}var vr=new Or,Pi=!0;try{if(typeof localStorage<"u"&&localStorage)vr=localStorage,Pi=!1}catch(t){}var Nr=vr;var st=Symbol("Equality"),Ue=(t,e)=>t===e||!!t?.[st]?.(e)||!1;var Rr=(t)=>typeof t==="object",{assign:Lr,keys:Wi}=Object;var Vr=(t,e)=>{for(let r in t)e(t[r],r)};var Jt=(t)=>Wi(t).length;var Mr=(t)=>{for(let e in t)return!1;return!0},kt=(t,e)=>{for(let r in t)if(!e(t[r],r))return!1;return!0},Pt=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),In=(t,e)=>t===e||Jt(t)===Jt(e)&&kt(t,(r,s)=>(r!==void 0||Pt(e,s))&&Ue(e[s],r)),Zi=Object.freeze,Un=(t)=>{for(let e in t){let r=t[e];if(typeof r==="object"||typeof r==="function")Un(t[e])}return Zi(t)};var Kt=(t,e,r=0)=>{try{for(;r<t.length;r++)t[r](...e)}finally{if(r<t.length)Kt(t,e,r+1)}};var $r=(t)=>t;var fp=(t,e)=>{if(t===e)return!0;if(t==null||e==null||t.constructor!==e.constructor&&(t.constructor||Object)!==(e.constructor||Object))return!1;if(t[st]!=null)return t[st](e);switch(t.constructor){case ArrayBuffer:t=new Uint8Array(t),e=new Uint8Array(e);case Uint8Array:{if(t.byteLength!==e.byteLength)return!1;for(let r=0;r<t.length;r++)if(t[r]!==e[r])return!1;break}case Set:{if(t.size!==e.size)return!1;for(let r of t)if(!e.has(r))return!1;break}case Map:{if(t.size!==e.size)return!1;for(let r of t.keys())if(!e.has(r)||!fp(t.get(r),e.get(r)))return!1;break}case void 0:case Object:if(Jt(t)!==Jt(e))return!1;for(let r in t)if(!Pt(t,r)||!fp(t[r],e[r]))return!1;break;case Array:if(t.length!==e.length)return!1;for(let r=0;r<t.length;r++)if(!fp(t[r],e[r]))return!1;break;default:return!1}return!0},Fr=(t,e)=>e.includes(t);var Wt=typeof process<"u"&&process.release&&/node|io\.js/.test(process.release.name)&&Object.prototype.toString.call(typeof process<"u"?process:0)==="[object process]";var cl=typeof navigator<"u"?/Mac/.test(navigator.platform):!1,z,Xi=[],Qi=()=>{if(z===void 0)if(Wt){z=A();let t=process.argv,e=null;for(let r=0;r<t.length;r++){let s=t[r];if(s[0]==="-"){if(e!==null)z.set(e,"");e=s}else if(e!==null)z.set(e,s),e=null;else Xi.push(s)}if(e!==null)z.set(e,"")}else if(typeof location==="object")z=A(),(location.search||"?").slice(1).split("&").forEach((t)=>{if(t.length!==0){let[e,r]=t.split("=");z.set(`--${pn(e,"-")}`,r),z.set(`-${pn(e,"-")}`,r)}});else z=A();return z},Cn=(t)=>Qi().has(t);var Zt=(t)=>Wt?Sn(process.env[t.toUpperCase().replaceAll("-","_")]):Sn(Nr.getItem(t));var jr=(t)=>Cn("--"+t)||Zt(t)!==null,qr=jr("production"),Yi=Wt&&Fr(process.env.FORCE_COLOR,["true","1","2"]),Gr=Yi||!Cn("--no-colors")&&!jr("no-color")&&(!Wt||process.stdout.isTTY)&&(!Wt||Cn("--color")||Zt("COLORTERM")!==null||(Zt("TERM")||"").includes("color"));var to=(t)=>new Uint8Array(t);var zr=(t)=>{let e=to(t.byteLength);return e.set(t),e};class Hr{constructor(t,e){this.left=t,this.right=e}}var H=(t,e)=>new Hr(t,e);var Bn=(t)=>t.next()>=0.5,Te=(t,e,r)=>is(t.next()*(r+1-e)+e);var On=(t,e,r)=>is(t.next()*(r+1-e)+e);var vn=(t,e,r)=>On(t,e,r);var ro=(t)=>fn(vn(t,97,122)),Jr=(t,e=0,r=20)=>{let s=vn(t,e,r),i="";for(let o=0;o<s;o++)i+=ro(t);return i};var Ae=(t,e)=>e[vn(t,0,e.length-1)];var io=Symbol("0schema");class Kr{constructor(){this._rerrs=[]}extend(t,e,r,s=null){this._rerrs.push({path:t,expected:e,has:r,message:s})}toString(){let t=[];for(let e=this._rerrs.length-1;e>0;e--){let r=this._rerrs[e];t.push(xr(" ",(this._rerrs.length-e)*2)+`${r.path!=null?`[${r.path}] `:""}${r.has} doesn't match ${r.expected}. ${r.message}`)}return t.join(`
2
+ `)}}var Nn=(t,e)=>{if(t===e)return!0;if(t==null||e==null||t.constructor!==e.constructor)return!1;if(t[st])return Ue(t,e);if(Q(t))return me(t,(r)=>$t(e,(s)=>Nn(r,s)));else if(Rr(t))return kt(t,(r,s)=>Nn(r,e[s]));return!1};class B{static _dilutes=!1;extends(t){let[e,r]=[this.shape,t.shape];if(this.constructor._dilutes)[r,e]=[e,r];return Nn(e,r)}equals(t){return this.constructor===t.constructor&&fp(this.shape,t.shape)}[io](){return!0}[st](t){return this.equals(t)}validate(t){return this.check(t)}check(t,e){L()}get nullable(){return Ut(this,Ve)}get optional(){return new Rn(this)}cast(t){return Pr(t,this),t}expect(t){return Pr(t,this),t}}class Be extends B{constructor(t,e){super();this.shape=t,this._c=e}check(t,e=void 0){let r=t?.constructor===this.shape&&(this._c==null||this._c(t));return!r&&e?.extend(null,this.shape.name,t?.constructor.name,t?.constructor!==this.shape?"Constructor match failed":"Check failed"),r}}var S=(t,e=null)=>new Be(t,e),al=S(Be);class Oe extends B{constructor(t){super();this.shape=t}check(t,e){let r=this.shape(t);return!r&&e?.extend(null,"custom prop",t?.constructor.name,"failed to check custom prop"),r}}var E=(t)=>new Oe(t),hl=S(Oe);class Qt extends B{constructor(t){super();this.shape=t}check(t,e){let r=this.shape.some((s)=>s===t);return!r&&e?.extend(null,this.shape.join(" | "),t.toString()),r}}var ve=(...t)=>new Qt(t),Wr=S(Qt),oo=RegExp.escape||((t)=>t.replace(/[().|&,$^[\]]/g,(e)=>"\\"+e)),Zr=(t)=>{if(It.check(t))return[oo(t)];if(Wr.check(t))return t.shape.map((e)=>e+"");if(cs.check(t))return["[+-]?\\d+.?\\d*"];if(ls.check(t))return[".*"];if(Ce.check(t))return t.shape.map(Zr).flat(1);v()};class Xr extends B{constructor(t){super();this.shape=t,this._r=new RegExp("^"+t.map(Zr).map((e)=>`(${e.join("|")})`).join("")+"$")}check(t,e){let r=this._r.exec(t)!=null;return!r&&e?.extend(null,this._r.toString(),t.toString(),"String doesn't match string template."),r}}var ul=S(Xr),co=Symbol("optional");class Rn extends B{constructor(t){super();this.shape=t}check(t,e){let r=t===void 0||this.shape.check(t);return!r&&e?.extend(null,"undefined (optional)","()"),r}get[co](){return!0}}var lo=S(Rn);class Ln extends B{check(t,e){return e?.extend(null,"never",typeof t),!1}}var dl=new Ln,fl=S(Ln);class Ne extends B{constructor(t,e=!1){super();this.shape=t,this._isPartial=e}static _dilutes=!0;get partial(){return new Ne(this.shape,!0)}check(t,e){if(t==null)return e?.extend(null,"object","null"),!1;return kt(this.shape,(r,s)=>{let i=this._isPartial&&!Pt(t,s)||r.check(t[s],e);return!i&&e?.extend(s.toString(),r.toString(),typeof t[s],"Object property does not match"),i})}}var ao=(t)=>new Ne(t),ho=S(Ne),uo=E((t)=>t!=null&&(t.constructor===Object||t.constructor==null));class Vn extends B{constructor(t,e){super();this.shape={keys:t,values:e}}check(t,e){return t!=null&&kt(t,(r,s)=>{let i=this.shape.keys.check(s,e);return!i&&e?.extend(s+"","Record",typeof t,i?"Key doesn't match schema":"Value doesn't match value"),i&&this.shape.values.check(r,e)})}}var Qr=(t,e)=>new Vn(t,e),fo=S(Vn);class Mn extends B{constructor(t){super();this.shape=t}check(t,e){return t!=null&&kt(this.shape,(r,s)=>{let i=r.check(t[s],e);return!i&&e?.extend(s.toString(),"Tuple",typeof r),i})}}var po=(...t)=>new Mn(t),pl=S(Mn);class $n extends B{constructor(t){super();this.shape=t.length===1?t[0]:new Re(t)}check(t,e){let r=Q(t)&&me(t,(s)=>this.shape.check(s));return!r&&e?.extend(null,"Array",""),r}}var Yr=(...t)=>new $n(t),go=S($n),mo=E((t)=>Q(t));class Fn extends B{constructor(t,e){super();this.shape=t,this._c=e}check(t,e){let r=t instanceof this.shape&&(this._c==null||this._c(t));return!r&&e?.extend(null,this.shape.name,t?.constructor.name),r}}var wo=(t,e=null)=>new Fn(t,e),gl=S(Fn),xo=wo(B);class ts extends B{constructor(t){super();this.len=t.length-1,this.args=po(...t.slice(-1)),this.res=t[this.len]}check(t,e){let r=t.constructor===Function&&t.length<=this.len;return!r&&e?.extend(null,"function",typeof t),r}}var yo=S(ts),bo=E((t)=>typeof t==="function");class es extends B{constructor(t){super();this.shape=t}check(t,e){let r=me(this.shape,(s)=>s.check(t,e));return!r&&e?.extend(null,"Intersectinon",typeof t),r}}var ml=S(es,(t)=>t.shape.length>0);class Re extends B{static _dilutes=!0;constructor(t){super();this.shape=t}check(t,e){let r=$t(this.shape,(s)=>s.check(t,e));return e?.extend(null,"Union",typeof t),r}}var Ut=(...t)=>t.findIndex((e)=>Ce.check(e))>=0?Ut(...t.map((e)=>Xt(e)).map((e)=>Ce.check(e)?e.shape:[e]).flat(1)):t.length===1?t[0]:new Re(t),Ce=S(Re),ns=()=>!0,De=E(ns),ko=S(Oe,(t)=>t.shape===ns),jn=E((t)=>typeof t==="bigint"),_o=E((t)=>t===jn),ss=E((t)=>typeof t==="symbol"),wl=E((t)=>t===ss),Et=E((t)=>typeof t==="number"),cs=E((t)=>t===Et),It=E((t)=>typeof t==="string"),ls=E((t)=>t===It),Le=E((t)=>typeof t==="boolean"),So=E((t)=>t===Le),as=ve(void 0),xl=S(Qt,(t)=>t.shape.length===1&&t.shape[0]===void 0),yl=ve(void 0);var Ve=ve(null),Eo=S(Qt,(t)=>t.shape.length===1&&t.shape[0]===null),bl=S(Uint8Array),kl=S(Be,(t)=>t.shape===Uint8Array),Io=Ut(Et,It,Ve,as,jn,Le,ss),_l=(()=>{let t=Yr(De),e=Qr(It,De),r=Ut(Et,It,Ve,Le,t,e);return t.shape=r,e.shape.values=r,r})(),Xt=(t)=>{if(xo.check(t))return t;else if(uo.check(t)){let e={};for(let r in t)e[r]=Xt(t[r]);return ao(e)}else if(mo.check(t))return Ut(...t.map(Xt));else if(Io.check(t))return ve(t);else if(bo.check(t))return S(t);v()},Pr=qr?()=>{}:(t,e)=>{let r=new Kr;if(!e.check(t,r))throw R(`Expected value to be of type ${e.constructor.name}.
3
+ ${r.toString()}`)};class hs{constructor(t){this.patterns=[],this.$state=t}if(t,e){return this.patterns.push({if:Xt(t),h:e}),this}else(t){return this.if(De,t)}done(){return(t,e)=>{for(let r=0;r<this.patterns.length;r++){let s=this.patterns[r];if(s.if.check(t))return s.h(t,e)}throw R("Unhandled pattern")}}}var Uo=(t)=>new hs(t),us=Uo(De).if(cs,(t,e)=>Te(e,hn,ft)).if(ls,(t,e)=>Jr(e)).if(So,(t,e)=>Bn(e)).if(_o,(t,e)=>BigInt(Te(e,hn,ft))).if(Ce,(t,e)=>St(e,Ae(e,t.shape))).if(ho,(t,e)=>{let r={};for(let s in t.shape){let i=t.shape[s];if(lo.check(i)){if(Bn(e))continue;i=i.shape}r[s]=us(i,e)}return r}).if(go,(t,e)=>{let r=[],s=On(e,0,42);for(let i=0;i<s;i++)r.push(St(e,t.shape));return r}).if(Wr,(t,e)=>Ae(e,t.shape)).if(Eo,(t,e)=>null).if(yo,(t,e)=>{let r=St(e,t.res);return()=>r}).if(ko,(t,e)=>St(e,Ae(e,[Et,It,Ve,as,jn,Le,Yr(Et),Qr(Ut("a","b","c"),Et)]))).if(fo,(t,e)=>{let r={},s=Te(e,0,3);for(let i=0;i<s;i++){let o=St(e,t.shape.keys),c=St(e,t.shape.values);r[o]=c}return r}).done(),St=(t,e)=>us(Xt(e),t);var it=typeof document<"u"?document:{};var Sl=E((t)=>t.nodeType===Bo);var El=typeof DOMParser<"u"?new DOMParser:null;var Il=E((t)=>t.nodeType===Ao);var Ul=E((t)=>t.nodeType===Co);var ds=(t)=>Tr(t,(e,r)=>`${r}:${e};`).join("");var{ELEMENT_NODE:Ao,TEXT_NODE:Co,CDATA_SECTION_NODE:Tl,COMMENT_NODE:Al,DOCUMENT_NODE:Do,DOCUMENT_TYPE_NODE:Cl,DOCUMENT_FRAGMENT_NODE:Bo}=it,Dl=E((t)=>t.nodeType===Do);var J=Symbol;var Yt=J(),te=J(),qn=J(),Gn=J(),zn=J(),ee=J(),Hn=J(),Tt=J(),Jn=J(),fs=(t)=>{if(t.length===1&&t[0]?.constructor===Function)t=t[0]();let e=[],r=[],s=0;for(;s<t.length;s++){let i=t[s];if(i===void 0)break;else if(i.constructor===String||i.constructor===Number)e.push(i);else if(i.constructor===Object)break}if(s>0)r.push(e.join(""));for(;s<t.length;s++){let i=t[s];if(!(i instanceof Symbol))r.push(i)}return r};var Bl=$u();var Ro={[Yt]:H("font-weight","bold"),[te]:H("font-weight","normal"),[qn]:H("color","blue"),[zn]:H("color","green"),[Gn]:H("color","grey"),[ee]:H("color","red"),[Hn]:H("color","purple"),[Tt]:H("color","orange"),[Jn]:H("color","black")},Lo=(t)=>{if(t.length===1&&t[0]?.constructor===Function)t=t[0]();let e=[],r=[],s=A(),i=[],o=0;for(;o<t.length;o++){let c=t[o],l=Ro[c];if(l!==void 0)s.set(l.left,l.right);else{if(c===void 0)break;if(c.constructor===String||c.constructor===Number){let h=ds(s);if(o>0||h.length>0)e.push("%c"+c),r.push(h);else e.push(c)}else break}}if(o>0)i=r,i.unshift(e.join(""));for(;o<t.length;o++){let c=t[o];if(!(c instanceof Symbol))i.push(c)}return i},ps=Gr?Lo:fs,gs=(...t)=>{console.log(...ps(t)),ms.forEach((e)=>e.print(t))},Pn=(...t)=>{console.warn(...ps(t)),t.unshift(Tt),ms.forEach((e)=>e.print(t))};var ms=G();var ws=(t)=>({[Symbol.iterator](){return this},next:t}),xs=(t,e)=>ws(()=>{let r;do r=t.next();while(!r.done&&!e(r.value));return r}),Me=(t,e)=>ws(()=>{let{done:r,value:s}=t.next();return{done:r,value:r?void 0:e(s)}});class oe{constructor(t,e){this.clock=t,this.len=e}}class ht{constructor(){this.clients=new Map}}var Bt=(t,e,r)=>e.clients.forEach((s,i)=>{let o=t.doc.store.clients.get(i);if(o!=null){let c=o[o.length-1],l=c.id.clock+c.length;for(let h=0,f=s[h];h<s.length&&f.clock<l;f=s[++h])Js(t,o,f.clock,f.len,r)}}),$o=(t,e)=>{let r=0,s=t.length-1;while(r<=s){let i=is((r+s)/2),o=t[i],c=o.clock;if(c<=e){if(e<c+o.len)return i;r=i+1}else s=i-1}return null},ce=(t,e)=>{let r=t.clients.get(e.client);return r!==void 0&&$o(r,e.clock)!==null},Yn=(t)=>{t.clients.forEach((e)=>{e.sort((i,o)=>i.clock-o.clock);let r,s;for(r=1,s=1;r<e.length;r++){let i=e[s-1],o=e[r];if(i.clock+i.len>=o.clock)e[s-1]=new oe(i.clock,Z(i.len,o.clock+o.len-i.clock));else{if(s<r)e[s]=o;s++}}e.length=s})},Wn=(t)=>{let e=new ht;for(let r=0;r<t.length;r++)t[r].clients.forEach((s,i)=>{if(!e.clients.has(i)){let o=s.slice();for(let c=r+1;c<t.length;c++)gr(o,t[c].clients.get(i)||[]);e.clients.set(i,o)}});return Yn(e),e},ne=(t,e,r,s)=>{q(t.clients,e,()=>[]).push(new oe(r,s))},vs=()=>new ht,Fo=(t)=>{let e=vs();return t.clients.forEach((r,s)=>{let i=[];for(let o=0;o<r.length;o++){let c=r[o];if(c.deleted){let l=c.id.clock,h=c.length;if(o+1<r.length)for(let f=r[o+1];o+1<r.length&&f.deleted;f=r[++o+1])h+=f.length;i.push(new oe(l,h))}}if(i.length>0)e.clients.set(s,i)}),e},vt=(t,e)=>{_t(t.restEncoder,e.clients.size),j(e.clients.entries()).sort((r,s)=>s[0]-r[0]).forEach(([r,s])=>{t.resetDsCurVal(),_t(t.restEncoder,r);let i=s.length;_t(t.restEncoder,i);for(let o=0;o<i;o++){let c=s[o];t.writeDsClock(c.clock),t.writeDsLen(c.len)}})},tr=(t)=>{let e=new ht,r=Dt(t.restDecoder);for(let s=0;s<r;s++){t.resetDsCurVal();let i=Dt(t.restDecoder),o=Dt(t.restDecoder);if(o>0){let c=q(e.clients,i,()=>[]);for(let l=0;l<o;l++)c.push(new oe(t.readDsClock(),t.readDsLen()))}}return e},ys=(t,e,r)=>{let s=new ht,i=Dt(t.restDecoder);for(let o=0;o<i;o++){t.resetDsCurVal();let c=Dt(t.restDecoder),l=Dt(t.restDecoder),h=r.clients.get(c)||[],f=b(r,c);for(let a=0;a<l;a++){let u=t.readDsClock(),d=u+t.readDsLen();if(u<f){if(f<d)ne(s,c,f,d-f);let p=P(h,u),g=h[p];if(!g.deleted&&g.id.clock<u)h.splice(p+1,0,Ye(e,g,u-g.id.clock)),p++;while(p<h.length)if(g=h[p++],g.id.clock<d){if(!g.deleted){if(d<g.id.clock+g.length)h.splice(p,0,Ye(e,g,d-g.id.clock));g.delete(e)}}else break}else ne(s,c,u,d-u)}}if(s.clients.size>0){let o=new et;return _t(o.restEncoder,0),vt(o,s),o.toUint8Array()}return null};var Ns=kn;class Td extends Ie{constructor({guid:t=Dr(),collectionid:e=null,gc:r=!0,gcFilter:s=()=>!0,meta:i=null,autoLoad:o=!1,shouldLoad:c=!0}={}){super();this.gc=r,this.gcFilter=s,this.clientID=Ns(),this.guid=t,this.collectionid=e,this.share=new Map,this.store=new or,this._transaction=null,this._transactionCleanups=[],this.subdocs=new Set,this._item=null,this.shouldLoad=c,this.autoLoad=o,this.meta=i,this.isLoaded=!1,this.isSynced=!1,this.isDestroyed=!1,this.whenLoaded=_n((h)=>{this.on("load",()=>{this.isLoaded=!0,h(this)})});let l=()=>_n((h)=>{let f=(a)=>{if(a===void 0||a===!0)this.off("sync",f),h()};this.on("sync",f)});this.on("sync",(h)=>{if(h===!1&&this.isSynced)this.whenSynced=l();if(this.isSynced=h===void 0||h===!0,this.isSynced&&!this.isLoaded)this.emit("load",[this])}),this.whenSynced=l()}load(){let t=this._item;if(t!==null&&!this.shouldLoad)x(t.parent.doc,(e)=>{e.subdocsLoaded.add(this)},null,!0);this.shouldLoad=!0}getSubdocs(){return this.subdocs}getSubdocGuids(){return new Set(j(this.subdocs).map((t)=>t.guid))}transact(t,e=null){return x(this,t,e)}get(t,e=I){let r=q(this.share,t,()=>{let i=new e;return i._integrate(this,null),i}),s=r.constructor;if(e!==I&&s!==e)if(s===I){let i=new e;i._map=r._map,r._map.forEach((o)=>{for(;o!==null;o=o.left)o.parent=i}),i._start=r._start;for(let o=i._start;o!==null;o=o.right)o.parent=i;return i._length=r._length,this.share.set(t,i),i._integrate(this,null),i}else throw Error(`Type with the name ${t} has already been defined with a different constructor`);return r}getArray(t=""){return this.get(t,xa)}getText(t=""){return this.get(t,rs)}getMap(t=""){return this.get(t,os)}getXmlElement(t=""){return this.get(t,Ot)}getXmlFragment(t=""){return this.get(t,lt)}toJSON(){let t={};return this.share.forEach((e,r)=>{t[r]=e.toJSON()}),t}destroy(){this.isDestroyed=!0,j(this.subdocs).forEach((e)=>e.destroy());let t=this._item;if(t!==null){this._item=null;let e=t.content;e.doc=new Td({guid:this.guid,...e.opts,shouldLoad:!1}),e.doc._item=t,x(t.parent.doc,(r)=>{let s=e.doc;if(!t.deleted)r.subdocsAdded.add(s);r.subdocsRemoved.add(this)},null,!0)}this.emit("destroyed",[!0]),this.emit("destroy",[this]),super.destroy()}}class er{constructor(t){this.restDecoder=t}resetDsCurVal(){}readDsClock(){return Dt(this.restDecoder)}readDsLen(){return Dt(this.restDecoder)}}class nr extends er{readLeftID(){return m(Dt(this.restDecoder),Dt(this.restDecoder))}readRightID(){return m(Dt(this.restDecoder),Dt(this.restDecoder))}readClient(){return Dt(this.restDecoder)}readInfo(){return rt(this.restDecoder)}readString(){return nl(this.restDecoder)}readParentInfo(){return Dt(this.restDecoder)===1}readTypeRef(){return Dt(this.restDecoder)}readLen(){return Dt(this.restDecoder)}readAny(){return yt(this.restDecoder)}readBuf(){return zr(Xo(this.restDecoder))}readJSON(){return JSON.parse(nl(this.restDecoder))}readKey(){return nl(this.restDecoder)}}class Rs{constructor(t){this.dsCurrVal=0,this.restDecoder=t}resetDsCurVal(){this.dsCurrVal=0}readDsClock(){return this.dsCurrVal+=Dt(this.restDecoder),this.dsCurrVal}readDsLen(){let t=Dt(this.restDecoder)+1;return this.dsCurrVal+=t,t}}class ct extends Rs{constructor(t){super(t);this.keys=[],Dt(t),this.keyClockDecoder=new zt(Xo(t)),this.clientDecoder=new bt(Xo(t)),this.leftClockDecoder=new zt(Xo(t)),this.rightClockDecoder=new zt(Xo(t)),this.infoDecoder=new Se(Xo(t),rt),this.stringDecoder=new bn(Xo(t)),this.parentInfoDecoder=new Se(Xo(t),rt),this.typeRefDecoder=new bt(Xo(t)),this.lenDecoder=new bt(Xo(t))}readLeftID(){return new ot(this.clientDecoder.read(),this.leftClockDecoder.read())}readRightID(){return new ot(this.clientDecoder.read(),this.rightClockDecoder.read())}readClient(){return this.clientDecoder.read()}readInfo(){return this.infoDecoder.read()}readString(){return this.stringDecoder.read()}readParentInfo(){return this.parentInfoDecoder.read()===1}readTypeRef(){return this.typeRefDecoder.read()}readLen(){return this.lenDecoder.read()}readAny(){return yt(this.restDecoder)}readBuf(){return Xo(this.restDecoder)}readJSON(){return yt(this.restDecoder)}readKey(){let t=this.keyClockDecoder.read();if(t<this.keys.length)return this.keys[t];else{let e=this.stringDecoder.read();return this.keys.push(e),e}}}class rr{constructor(){this.restEncoder=Qa()}toUint8Array(){return br(this.restEncoder)}resetDsCurVal(){}writeDsClock(t){_t(this.restEncoder,t)}writeDsLen(t){_t(this.restEncoder,t)}}class Nt extends rr{writeLeftID(t){_t(this.restEncoder,t.client),_t(this.restEncoder,t.clock)}writeRightID(t){_t(this.restEncoder,t.client),_t(this.restEncoder,t.clock)}writeClient(t){_t(this.restEncoder,t)}writeInfo(t){xe(this.restEncoder,t)}writeString(t){el(this.restEncoder,t)}writeParentInfo(t){_t(this.restEncoder,t?1:0)}writeTypeRef(t){_t(this.restEncoder,t)}writeLen(t){_t(this.restEncoder,t)}writeAny(t){mt(this.restEncoder,t)}writeBuf(t){zo(this.restEncoder,t)}writeJSON(t){el(this.restEncoder,JSON.stringify(t))}writeKey(t){el(this.restEncoder,t)}}class sr{constructor(){this.restEncoder=Qa(),this.dsCurrVal=0}toUint8Array(){return br(this.restEncoder)}resetDsCurVal(){this.dsCurrVal=0}writeDsClock(t){let e=t-this.dsCurrVal;this.dsCurrVal=t,_t(this.restEncoder,e)}writeDsLen(t){if(t===0)v();_t(this.restEncoder,t-1),this.dsCurrVal+=t}}class et extends sr{constructor(){super();this.keyMap=new Map,this.keyClock=0,this.keyClockEncoder=new qt,this.clientEncoder=new xt,this.leftClockEncoder=new qt,this.rightClockEncoder=new qt,this.infoEncoder=new be(xe),this.stringEncoder=new wn,this.parentInfoEncoder=new be(xe),this.typeRefEncoder=new xt,this.lenEncoder=new xt}toUint8Array(){let t=Qa();return _t(t,0),zo(t,this.keyClockEncoder.toUint8Array()),zo(t,this.clientEncoder.toUint8Array()),zo(t,this.leftClockEncoder.toUint8Array()),zo(t,this.rightClockEncoder.toUint8Array()),zo(t,br(this.infoEncoder)),zo(t,this.stringEncoder.toUint8Array()),zo(t,br(this.parentInfoEncoder)),zo(t,this.typeRefEncoder.toUint8Array()),zo(t,this.lenEncoder.toUint8Array()),jt(t,br(this.restEncoder)),br(t)}writeLeftID(t){this.clientEncoder.write(t.client),this.leftClockEncoder.write(t.clock)}writeRightID(t){this.clientEncoder.write(t.client),this.rightClockEncoder.write(t.clock)}writeClient(t){this.clientEncoder.write(t)}writeInfo(t){this.infoEncoder.write(t)}writeString(t){this.stringEncoder.write(t)}writeParentInfo(t){this.parentInfoEncoder.write(t?1:0)}writeTypeRef(t){this.typeRefEncoder.write(t)}writeLen(t){this.lenEncoder.write(t)}writeAny(t){mt(this.restEncoder,t)}writeBuf(t){zo(this.restEncoder,t)}writeJSON(t){mt(this.restEncoder,t)}writeKey(t){let e=this.keyMap.get(t);if(e===void 0)this.keyClockEncoder.write(this.keyClock++),this.stringEncoder.write(t);else this.keyClockEncoder.write(e)}}var jo=(t,e,r,s)=>{s=Z(s,e[0].id.clock);let i=P(e,s);_t(t.restEncoder,e.length-i),t.writeClient(r),_t(t.restEncoder,s);let o=e[i];o.write(t,s-o.id.clock);for(let c=i+1;c<e.length;c++)e[c].write(t,0)},ir=(t,e,r)=>{let s=new Map;r.forEach((i,o)=>{if(b(e,o)>i)s.set(o,i)}),tn(e).forEach((i,o)=>{if(!r.has(o))s.set(o,0)}),_t(t.restEncoder,s.size),j(s.entries()).sort((i,o)=>o[0]-i[0]).forEach(([i,o])=>{jo(t,e.clients.get(i),i,o)})},qo=(t,e)=>{let r=A(),s=Dt(t.restDecoder);for(let i=0;i<s;i++){let o=Dt(t.restDecoder),c=Array(o),l=t.readClient(),h=Dt(t.restDecoder);r.set(l,{i:0,refs:c});for(let f=0;f<o;f++){let a=t.readInfo();switch(Vt&a){case 0:{let u=t.readLen();c[f]=new V(m(l,h),u),h+=u;break}case 10:{let u=Dt(t.restDecoder);c[f]=new M(m(l,h),u),h+=u;break}default:{let u=(a&(F|D))===0,d=new y(m(l,h),null,(a&D)===D?t.readLeftID():null,null,(a&F)===F?t.readRightID():null,u?t.readParentInfo()?e.get(t.readString()):t.readLeftID():null,u&&(a&dt)===dt?t.readString():null,mi(t,a));c[f]=d,h+=d.length}}}}return r},Go=(t,e,r)=>{let s=[],i=j(r.keys()).sort((p,g)=>p-g);if(i.length===0)return null;let o=()=>{if(i.length===0)return null;let p=r.get(i[i.length-1]);while(p.refs.length===p.i)if(i.pop(),i.length>0)p=r.get(i[i.length-1]);else return null;return p},c=o();if(c===null)return null;let l=new or,h=new Map,f=(p,g)=>{let w=h.get(p);if(w==null||w>g)h.set(p,g)},a=c.refs[c.i++],u=new Map,d=()=>{for(let p of s){let g=p.id.client,w=r.get(g);if(w)w.i--,l.clients.set(g,w.refs.slice(w.i)),r.delete(g),w.i=0,w.refs=[];else l.clients.set(g,[p]);i=i.filter((C)=>C!==g)}s.length=0};while(!0){if(a.constructor!==M){let g=q(u,a.id.client,()=>b(e,a.id.client))-a.id.clock;if(g<0)s.push(a),f(a.id.client,a.id.clock-1),d();else{let w=a.getMissing(t,e);if(w!==null){s.push(a);let C=r.get(w)||{refs:[],i:0};if(C.refs.length===C.i)f(w,b(e,w)),d();else{a=C.refs[C.i++];continue}}else if(g===0||g<a.length)a.integrate(t,g),u.set(a.id.client,a.id.clock+a.length)}}if(s.length>0)a=s.pop();else if(c!==null&&c.i<c.refs.length)a=c.refs[c.i++];else if(c=o(),c===null)break;else a=c.refs[c.i++]}if(l.clients.size>0){let p=new et;return ir(p,l,new Map),_t(p.restEncoder,0),{missing:h,update:p.toUint8Array()}}return null},Ho=(t,e)=>ir(t,e.doc.store,e.beforeState),Jo=(t,e,r,s=new ct(t))=>x(e,(i)=>{i.local=!1;let o=!1,c=i.doc,l=c.store,h=qo(s,c),f=Go(i,l,h),a=l.pendingStructs;if(a){for(let[d,p]of a.missing)if(p<b(l,d)){o=!0;break}if(f){for(let[d,p]of f.missing){let g=a.missing.get(d);if(g==null||g>p)a.missing.set(d,p)}a.update=Je([a.update,f.update])}}else l.pendingStructs=f;let u=ys(s,i,l);if(l.pendingDs){let d=new ct(tl(l.pendingDs));Dt(d.restDecoder);let p=ys(d,i,l);if(u&&p)l.pendingDs=Je([u,p]);else l.pendingDs=u||p}else l.pendingDs=u;if(o){let d=l.pendingStructs.update;l.pendingStructs=null,Ls(i.doc,d)}},r,!1);var Ls=(t,e,r,s=ct)=>{let i=tl(e);Jo(i,t,r,new s(i))},WR=(t,e,r)=>Ls(t,e,r,nr),Po=(t,e,r=new Map)=>{ir(t,e.store,r),vt(t,Fo(e.store))},Ko=(t,e=new Uint8Array([0]),r=new et)=>{let s=Vs(e);Po(r,t,s);let i=[r.toUint8Array()];if(t.store.pendingDs)i.push(t.store.pendingDs);if(t.store.pendingStructs)i.push(ac(t.store.pendingStructs.update,e));if(i.length>1){if(r.constructor===Nt)return cc(i.map((o,c)=>c===0?o:uc(o)));else if(r.constructor===et)return Je(i)}return i[0]},VR=(t,e)=>Ko(t,e,new Nt),Wo=(t)=>{let e=new Map,r=Dt(t.restDecoder);for(let s=0;s<r;s++){let i=Dt(t.restDecoder),o=Dt(t.restDecoder);e.set(i,o)}return e},Vs=(t)=>Wo(new er(tl(t))),Ms=(t,e)=>(_t(t.restEncoder,e.size),j(e.entries()).sort((r,s)=>s[0]-r[0]).forEach(([r,s])=>{_t(t.restEncoder,r),_t(t.restEncoder,s)}),t),Zo=(t,e)=>Ms(t,tn(e.store)),Qo=(t,e=new sr)=>{if(t instanceof Map)Ms(e,t);else Zo(e,t);return e.toUint8Array()},UR=(t)=>Qo(t,new rr);class $s{constructor(){this.l=[]}}var bs=()=>new $s,ks=(t,e)=>t.l.push(e),_s=(t,e)=>{let r=t.l,s=r.length;if(t.l=r.filter((i)=>e!==i),s===t.l.length)console.error("[yjs] Tried to remove event handler that doesn't exist.")},Fs=(t,e,r)=>Kt(t.l,[e,r]);class ot{constructor(t,e){this.client=t,this.clock=e}}var $e=(t,e)=>t===e||t!==null&&e!==null&&t.client===e.client&&t.clock===e.clock,m=(t,e)=>new ot(t,e);var js=(t)=>{for(let[e,r]of t.doc.share.entries())if(r===t)return e;throw v()},He=(t,e)=>{while(e!==null){if(e.parent===t)return!0;e=e.parent._item}return!1};class qs{constructor(t,e,r,s=0){this.type=t,this.tname=e,this.item=r,this.assoc=s}}class Gs{constructor(t,e,r=0){this.type=t,this.index=e,this.assoc=r}}var Yo=(t,e,r=0)=>new Gs(t,e,r),Fe=(t,e,r)=>{let s=null,i=null;if(t._item===null)i=js(t);else s=m(t._item.id.client,t._item.id.clock);return new qs(s,i,e,r)},T_=(t,e,r=0)=>{let s=t._start;if(r<0){if(e===0)return Fe(t,null,r);e--}while(s!==null){if(!s.deleted&&s.countable){if(s.length>e)return Fe(t,m(s.id.client,s.id.clock+e),r);e-=s.length}if(s.right===null&&r<0)return Fe(t,s.lastId,r);s=s.right}return Fe(t,null,r)};var tc=(t,e)=>{let r=Ct(t,e),s=e.clock-r.id.clock;return{item:r,diff:s}},Qg=(t,e,r=!0)=>{let s=e.store,{item:i,type:o,tname:c,assoc:l}=t,h=null,f=0;if(i!==null){if(b(s,i.client)<=i.clock)return null;let a=r?Qn(s,i):tc(s,i),u=a.item;if(!(u instanceof y))return null;if(h=u.parent,h._item===null||!h._item.deleted){f=u.deleted||!u.countable?0:a.diff+(l>=0?0:1);let d=u.left;while(d!==null){if(!d.deleted&&d.countable)f+=d.length;d=d.left}}}else{if(c!==null)h=e.get(c);else if(o!==null){if(b(s,o.client)<=o.clock)return null;let{item:a}=r?Qn(s,o):{item:Ct(s,o)};if(a instanceof y&&a.content instanceof W)h=a.content.type;else return null}else throw v();if(l>=0)f=h._length;else f=0}return Yo(h,f,t.assoc)};class zs{constructor(t,e){this.ds=t,this.sv=e}}var ec=(t,e)=>new zs(t,e),ql=ec(vs(),new Map);var At=(t,e)=>e===void 0?!t.deleted:e.sv.has(t.id.client)&&(e.sv.get(t.id.client)||0)>t.id.clock&&!ce(e.ds,t.id),Zn=(t,e)=>{let r=q(t.meta,Zn,G),s=t.doc.store;if(!r.has(e))e.sv.forEach((i,o)=>{if(i<b(s,o))N(t,m(o,i))}),Bt(t,e.ds,(i)=>{}),r.add(e)};class or{constructor(){this.clients=new Map,this.pendingStructs=null,this.pendingDs=null}}var tn=(t)=>{let e=new Map;return t.clients.forEach((r,s)=>{let i=r[r.length-1];e.set(s,i.id.clock+i.length)}),e},b=(t,e)=>{let r=t.clients.get(e);if(r===void 0)return 0;let s=r[r.length-1];return s.id.clock+s.length},Hs=(t,e)=>{let r=t.clients.get(e.id.client);if(r===void 0)r=[],t.clients.set(e.id.client,r);else{let s=r[r.length-1];if(s.id.clock+s.length!==e.id.clock)throw v()}r.push(e)},P=(t,e)=>{let r=0,s=t.length-1,i=t[s],o=i.id.clock;if(o===e)return s;let c=is(e/(o+i.length-1)*s);while(r<=s){if(i=t[c],o=i.id.clock,o<=e){if(e<o+i.length)return c;r=c+1}else s=c-1;c=is((r+s)/2)}throw v()},nc=(t,e)=>{let r=t.clients.get(e.client);return r[P(r,e.clock)]},Ct=nc,Xn=(t,e,r)=>{let s=P(e,r),i=e[s];if(i.id.clock<r&&i instanceof y)return e.splice(s+1,0,Ye(t,i,r-i.id.clock)),s+1;return s},N=(t,e)=>{let r=t.doc.store.clients.get(e.client);return r[Xn(t,r,e.clock)]},Ss=(t,e,r)=>{let s=e.clients.get(r.client),i=P(s,r.clock),o=s[i];if(r.clock!==o.id.clock+o.length-1&&o.constructor!==V)s.splice(i+1,0,Ye(t,o,r.clock-o.id.clock+1));return o},rc=(t,e,r)=>{let s=t.clients.get(e.id.client);s[P(s,e.id.clock)]=r},Js=(t,e,r,s,i)=>{if(s===0)return;let o=r+s,c=Xn(t,e,r),l;do{if(l=e[c++],o<l.id.clock+l.length)Xn(t,e,o);i(l)}while(c<e.length&&e[c].id.clock<o)};class Ps{constructor(t,e,r){this.doc=t,this.deleteSet=new ht,this.beforeState=tn(t.store),this.afterState=new Map,this.changed=new Map,this.changedParentTypes=new Map,this._mergeStructs=[],this.origin=e,this.meta=new Map,this.local=r,this.subdocsAdded=new Set,this.subdocsRemoved=new Set,this.subdocsLoaded=new Set,this._needFormattingCleanup=!1}}var Es=(t,e)=>{if(e.deleteSet.clients.size===0&&!Ar(e.afterState,(r,s)=>e.beforeState.get(s)!==r))return!1;return Yn(e.deleteSet),Ho(t,e),vt(t,e.deleteSet),!0},Is=(t,e,r)=>{let s=e._item;if(s===null||s.id.clock<(t.beforeState.get(s.id.client)||0)&&!s.deleted)q(t.changed,e,G).add(r)},Ge=(t,e)=>{let r=t[e],s=t[e-1],i=e;for(;i>0;r=s,s=t[--i-1]){if(s.deleted===r.deleted&&s.constructor===r.constructor){if(s.mergeWith(r)){if(r instanceof y&&r.parentSub!==null&&r.parent._map.get(r.parentSub)===r)r.parent._map.set(r.parentSub,s);continue}}break}let o=e-i;if(o)t.splice(e+1-o,o);return o},sc=(t,e,r)=>{for(let[s,i]of t.clients.entries()){let o=e.clients.get(s);for(let c=i.length-1;c>=0;c--){let l=i[c],h=l.clock+l.len;for(let f=P(o,l.clock),a=o[f];f<o.length&&a.id.clock<h;a=o[++f]){let u=o[f];if(l.clock+l.len<=u.id.clock)break;if(u instanceof y&&u.deleted&&!u.keep&&r(u))u.gc(e,!1)}}}},ic=(t,e)=>{t.clients.forEach((r,s)=>{let i=e.clients.get(s);for(let o=r.length-1;o>=0;o--){let c=r[o],l=ue(i.length-1,1+P(i,c.clock+c.len-1));for(let h=l,f=i[h];h>0&&f.id.clock>=c.clock;f=i[h])h-=1+Ge(i,h)}})};var Ks=(t,e)=>{if(e<t.length){let r=t[e],s=r.doc,i=s.store,{deleteSet:o,_mergeStructs:c}=r;try{Yn(o),r.afterState=tn(r.doc.store),s.emit("beforeObserverCalls",[r,s]);let l=[];r.changed.forEach((h,f)=>l.push(()=>{if(f._item===null||!f._item.deleted)f._callObserver(r,h)})),l.push(()=>{r.changedParentTypes.forEach((h,f)=>{if(f._dEH.l.length>0&&(f._item===null||!f._item.deleted))l.push(()=>{h=h.filter((a)=>a.target._item===null||!a.target._item.deleted),h.forEach((a)=>{a.currentTarget=f,a._path=null}),h.sort((a,u)=>a.path.length-u.path.length),Fs(f._dEH,h,r)})}),l.push(()=>s.emit("afterTransaction",[r,s])),l.push(()=>{if(r._needFormattingCleanup)_c(r)})}),Kt(l,[])}finally{if(s.gc)sc(o,i,s.gcFilter);ic(o,i),r.afterState.forEach((a,u)=>{let d=r.beforeState.get(u)||0;if(d!==a){let p=i.clients.get(u),g=Z(P(p,d),1);for(let w=p.length-1;w>=g;)w-=1+Ge(p,w)}});for(let a=c.length-1;a>=0;a--){let{client:u,clock:d}=c[a].id,p=i.clients.get(u),g=P(p,d);if(g+1<p.length){if(Ge(p,g+1)>1)continue}if(g>0)Ge(p,g)}if(!r.local&&r.afterState.get(s.clientID)!==r.beforeState.get(s.clientID))gs(Tt,Yt,"[yjs] ",te,ee,"Changed the client-id because another client seems to be using it."),s.clientID=Ns();if(s.emit("afterTransactionCleanup",[r,s]),s._observers.has("update")){let a=new Nt;if(Es(a,r))s.emit("update",[a.toUint8Array(),r.origin,s,r])}if(s._observers.has("updateV2")){let a=new et;if(Es(a,r))s.emit("updateV2",[a.toUint8Array(),r.origin,s,r])}let{subdocsAdded:l,subdocsLoaded:h,subdocsRemoved:f}=r;if(l.size>0||f.size>0||h.size>0)l.forEach((a)=>{if(a.clientID=s.clientID,a.collectionid==null)a.collectionid=s.collectionid;s.subdocs.add(a)}),f.forEach((a)=>s.subdocs.delete(a)),s.emit("subdocs",[{loaded:h,added:l,removed:f},s,r]),f.forEach((a)=>a.destroy());if(t.length<=e+1)s._transactionCleanups=[],s.emit("afterAllTransactions",[s,t]);else Ks(t,e+1)}}},x=(t,e,r=null,s=!0)=>{let i=t._transactionCleanups,o=!1,c=null;if(t._transaction===null){if(o=!0,t._transaction=new Ps(t,r,s),i.push(t._transaction),i.length===1)t.emit("beforeAllTransactions",[t]);t.emit("beforeTransaction",[t._transaction,t])}try{c=e(t._transaction)}finally{if(o){let l=t._transaction===i[0];if(t._transaction=null,l)Ks(i,0)}}return c};class Ws{constructor(t,e){this.insertions=e,this.deletions=t,this.meta=new Map}}var Us=(t,e,r)=>{Bt(t,r.deletions,(s)=>{if(s instanceof y&&e.scope.some((i)=>i===t.doc||He(i,s)))ur(s,!1)})},Ts=(t,e,r)=>{let s=null,{doc:i,scope:o}=t;x(i,(l)=>{while(e.length>0&&t.currStackItem===null){let h=i.store,f=e.pop(),a=new Set,u=[],d=!1;Bt(l,f.insertions,(p)=>{if(p instanceof y){if(p.redone!==null){let{item:g,diff:w}=Qn(h,p.id);if(w>0)g=N(l,m(g.id.client,g.id.clock+w));p=g}if(!p.deleted&&o.some((g)=>g===l.doc||He(g,p)))u.push(p)}}),Bt(l,f.deletions,(p)=>{if(p instanceof y&&o.some((g)=>g===l.doc||He(g,p))&&!ce(f.insertions,p.id))a.add(p)}),a.forEach((p)=>{d=gi(l,p,a,f.insertions,t.ignoreRemoteMapChanges,t)!==null||d});for(let p=u.length-1;p>=0;p--){let g=u[p];if(t.deleteFilter(g))g.delete(l),d=!0}t.currStackItem=d?f:null}l.changed.forEach((h,f)=>{if(h.has(null)&&f._searchMarker)f._searchMarker.length=0}),s=l},t);let c=t.currStackItem;if(c!=null){let l=s.changedParentTypes;t.emit("stack-item-popped",[{stackItem:c,type:r,changedParentTypes:l,origin:t},t]),t.currStackItem=null}return c};class PP extends Ie{constructor(t,{captureTimeout:e=500,captureTransaction:r=(l)=>!0,deleteFilter:s=()=>!0,trackedOrigins:i=new Set([null]),ignoreRemoteMapChanges:o=!1,doc:c=Q(t)?t[0].doc:t instanceof Td?t:t.doc}={}){super();this.scope=[],this.doc=c,this.addToScope(t),this.deleteFilter=s,i.add(this),this.trackedOrigins=i,this.captureTransaction=r,this.undoStack=[],this.redoStack=[],this.undoing=!1,this.redoing=!1,this.currStackItem=null,this.lastChange=0,this.ignoreRemoteMapChanges=o,this.captureTimeout=e,this.afterTransactionHandler=(l)=>{if(!this.captureTransaction(l)||!this.scope.some((w)=>l.changedParentTypes.has(w)||w===this.doc)||!this.trackedOrigins.has(l.origin)&&(!l.origin||!this.trackedOrigins.has(l.origin.constructor)))return;let h=this.undoing,f=this.redoing,a=h?this.redoStack:this.undoStack;if(h)this.stopCapturing();else if(!f)this.clear(!1,!0);let u=new ht;l.afterState.forEach((w,C)=>{let k=l.beforeState.get(C)||0,dr=w-k;if(dr>0)ne(u,C,k,dr)});let d=$u(),p=!1;if(this.lastChange>0&&d-this.lastChange<this.captureTimeout&&a.length>0&&!h&&!f){let w=a[a.length-1];w.deletions=Wn([w.deletions,l.deleteSet]),w.insertions=Wn([w.insertions,u])}else a.push(new Ws(l.deleteSet,u)),p=!0;if(!h&&!f)this.lastChange=d;Bt(l,l.deleteSet,(w)=>{if(w instanceof y&&this.scope.some((C)=>C===l.doc||He(C,w)))ur(w,!0)});let g=[{stackItem:a[a.length-1],origin:l.origin,type:h?"redo":"undo",changedParentTypes:l.changedParentTypes},this];if(p)this.emit("stack-item-added",g);else this.emit("stack-item-updated",g)},this.destroy=this.destroy.bind(this),this.doc.on("afterTransaction",this.afterTransactionHandler),this.doc.on("destroy",this.destroy)}addToScope(t){let e=new Set(this.scope);t=Q(t)?t:[t],t.forEach((r)=>{if(!e.has(r)){if(e.add(r),r instanceof I?r.doc!==this.doc:r!==this.doc)Pn("[yjs#509] Not same Y.Doc");this.scope.push(r)}})}addTrackedOrigin(t){this.trackedOrigins.add(t)}removeTrackedOrigin(t){this.trackedOrigins.delete(t)}clear(t=!0,e=!0){if(t&&this.canUndo()||e&&this.canRedo())this.doc.transact((r)=>{if(t)this.undoStack.forEach((s)=>Us(r,this,s)),this.undoStack=[];if(e)this.redoStack.forEach((s)=>Us(r,this,s)),this.redoStack=[];this.emit("stack-cleared",[{undoStackCleared:t,redoStackCleared:e}])})}stopCapturing(){this.lastChange=0}undo(){this.undoing=!0;let t;try{t=Ts(this,this.undoStack,"undo")}finally{this.undoing=!1}return t}redo(){this.redoing=!0;let t;try{t=Ts(this,this.redoStack,"redo")}finally{this.redoing=!1}return t}canUndo(){return this.undoStack.length>0}canRedo(){return this.redoStack.length>0}destroy(){this.trackedOrigins.delete(this),this.doc.off("afterTransaction",this.afterTransactionHandler),this.doc.off("destroy",this.destroy),super.destroy()}}function*oc(t){let e=Dt(t.restDecoder);for(let r=0;r<e;r++){let s=Dt(t.restDecoder),i=t.readClient(),o=Dt(t.restDecoder);for(let c=0;c<s;c++){let l=t.readInfo();if(l===10){let h=Dt(t.restDecoder);yield new M(m(i,o),h),o+=h}else if((Vt&l)!==0){let h=(l&(F|D))===0,f=new y(m(i,o),null,(l&D)===D?t.readLeftID():null,null,(l&F)===F?t.readRightID():null,h?t.readParentInfo()?t.readString():t.readLeftID():null,h&&(l&dt)===dt?t.readString():null,mi(t,l));yield f,o+=f.length}else{let h=t.readLen();yield new V(m(i,o),h),o+=h}}}}class en{constructor(t,e){this.gen=oc(t),this.curr=null,this.done=!1,this.filterSkips=e,this.next()}next(){do this.curr=this.gen.next().value||null;while(this.filterSkips&&this.curr!==null&&this.curr.constructor===M);return this.curr}}class nn{constructor(t){this.currClient=0,this.startClock=0,this.written=0,this.encoder=t,this.clientStructs=[]}}var cc=(t)=>Je(t,nr,Nt);var lc=(t,e)=>{if(t.constructor===V){let{client:r,clock:s}=t.id;return new V(m(r,s+e),t.length-e)}else if(t.constructor===M){let{client:r,clock:s}=t.id;return new M(m(r,s+e),t.length-e)}else{let r=t,{client:s,clock:i}=r.id;return new y(m(s,i+e),null,m(s,i+e-1),null,r.rightOrigin,r.parent,r.parentSub,r.content.splice(e))}},Je=(t,e=ct,r=et)=>{if(t.length===1)return t[0];let s=t.map((a)=>new e(tl(a))),i=s.map((a)=>new en(a,!0)),o=null,c=new r,l=new nn(c);while(!0){if(i=i.filter((d)=>d.curr!==null),i.sort((d,p)=>{if(d.curr.id.client===p.curr.id.client){let g=d.curr.id.clock-p.curr.id.clock;if(g===0)return d.curr.constructor===p.curr.constructor?0:d.curr.constructor===M?1:-1;else return g}else return p.curr.id.client-d.curr.id.client}),i.length===0)break;let a=i[0],u=a.curr.id.client;if(o!==null){let d=a.curr,p=!1;while(d!==null&&d.id.clock+d.length<=o.struct.id.clock+o.struct.length&&d.id.client>=o.struct.id.client)d=a.next(),p=!0;if(d===null||d.id.client!==u||p&&d.id.clock>o.struct.id.clock+o.struct.length)continue;if(u!==o.struct.id.client)Y(l,o.struct,o.offset),o={struct:d,offset:0},a.next();else if(o.struct.id.clock+o.struct.length<d.id.clock)if(o.struct.constructor===M)o.struct.length=d.id.clock+d.length-o.struct.id.clock;else{Y(l,o.struct,o.offset);let g=d.id.clock-o.struct.id.clock-o.struct.length;o={struct:new M(m(u,o.struct.id.clock+o.struct.length),g),offset:0}}else{let g=o.struct.id.clock+o.struct.length-d.id.clock;if(g>0)if(o.struct.constructor===M)o.struct.length-=g;else d=lc(d,g);if(!o.struct.mergeWith(d))Y(l,o.struct,o.offset),o={struct:d,offset:0},a.next()}}else o={struct:a.curr,offset:0},a.next();for(let d=a.curr;d!==null&&d.id.client===u&&d.id.clock===o.struct.id.clock+o.struct.length&&d.constructor!==M;d=a.next())Y(l,o.struct,o.offset),o={struct:d,offset:0}}if(o!==null)Y(l,o.struct,o.offset),o=null;cr(l);let h=s.map((a)=>tr(a)),f=Wn(h);return vt(c,f),c.toUint8Array()},ac=(t,e,r=ct,s=et)=>{let i=Vs(e),o=new s,c=new nn(o),l=new r(tl(t)),h=new en(l,!1);while(h.curr){let a=h.curr,u=a.id.client,d=i.get(u)||0;if(h.curr.constructor===M){h.next();continue}if(a.id.clock+a.length>d){Y(c,a,Z(d-a.id.clock,0)),h.next();while(h.curr&&h.curr.id.client===u)Y(c,h.curr,0),h.next()}else while(h.curr&&h.curr.id.client===u&&h.curr.id.clock+h.curr.length<=d)h.next()}cr(c);let f=tr(l);return vt(o,f),o.toUint8Array()};var Zs=(t)=>{if(t.written>0)t.clientStructs.push({written:t.written,restEncoder:br(t.encoder.restEncoder)}),t.encoder.restEncoder=Qa(),t.written=0},Y=(t,e,r)=>{if(t.written>0&&t.currClient!==e.id.client)Zs(t);if(t.written===0)t.currClient=e.id.client,t.encoder.writeClient(e.id.client),_t(t.encoder.restEncoder,e.id.clock+r);e.write(t.encoder,r),t.written++},cr=(t)=>{Zs(t);let e=t.encoder.restEncoder;_t(e,t.clientStructs.length);for(let r=0;r<t.clientStructs.length;r++){let s=t.clientStructs[r];_t(e,s.written),jt(e,s.restEncoder)}},hc=(t,e,r,s)=>{let i=new r(tl(t)),o=new en(i,!1),c=new s,l=new nn(c);for(let f=o.curr;f!==null;f=o.next())Y(l,e(f),0);cr(l);let h=tr(i);return vt(c,h),c.toUint8Array()};var uc=(t)=>hc(t,$r,ct,Nt),As="You must not compute changes after the event-handler fired.";class le{constructor(t,e){this.target=t,this.currentTarget=t,this.transaction=e,this._changes=null,this._keys=null,this._delta=null,this._path=null}get path(){return this._path||(this._path=dc(this.currentTarget,this.target))}deletes(t){return ce(this.transaction.deleteSet,t.id)}get keys(){if(this._keys===null){if(this.transaction.doc._transactionCleanups.length===0)throw R(As);let t=new Map,e=this.target;this.transaction.changed.get(e).forEach((s)=>{if(s!==null){let i=e._map.get(s),o,c;if(this.adds(i)){let l=i.left;while(l!==null&&this.adds(l))l=l.left;if(this.deletes(i))if(l!==null&&this.deletes(l))o="delete",c=ge(l.content.getContent());else return;else if(l!==null&&this.deletes(l))o="update",c=ge(l.content.getContent());else o="add",c=void 0}else if(this.deletes(i))o="delete",c=ge(i.content.getContent());else return;t.set(s,{action:o,oldValue:c})}}),this._keys=t}return this._keys}get delta(){return this.changes.delta}adds(t){return t.id.clock>=(this.transaction.beforeState.get(t.id.client)||0)}get changes(){let t=this._changes;if(t===null){if(this.transaction.doc._transactionCleanups.length===0)throw R(As);let e=this.target,r=G(),s=G(),i=[];if(t={added:r,deleted:s,delta:i,keys:this.keys},this.transaction.changed.get(e).has(null)){let c=null,l=()=>{if(c)i.push(c)};for(let h=e._start;h!==null;h=h.right)if(h.deleted){if(this.deletes(h)&&!this.adds(h)){if(c===null||c.delete===void 0)l(),c={delete:0};c.delete+=h.length,s.add(h)}}else if(this.adds(h)){if(c===null||c.insert===void 0)l(),c={insert:[]};c.insert=c.insert.concat(h.content.getContent()),r.add(h)}else{if(c===null||c.retain===void 0)l(),c={retain:0};c.retain+=h.length}if(c!==null&&c.retain===void 0)l()}this._changes=t}return t}}var dc=(t,e)=>{let r=[];while(e._item!==null&&e!==t){if(e._item.parentSub!==null)r.unshift(e._item.parentSub);else{let s=0,i=e._item.parent._start;while(i!==e._item&&i!==null){if(!i.deleted&&i.countable)s+=i.length;i=i.right}r.unshift(s)}e=e._item.parent}return r},O=()=>{Pn("Invalid access: Add Yjs type to a document before reading data.")},Xs=80,lr=0;class Qs{constructor(t,e){t.marker=!0,this.p=t,this.index=e,this.timestamp=lr++}}var fc=(t)=>{t.timestamp=lr++},Ys=(t,e,r)=>{t.p.marker=!1,t.p=e,e.marker=!0,t.index=r,t.timestamp=lr++},pc=(t,e,r)=>{if(t.length>=Xs){let s=t.reduce((i,o)=>i.timestamp<o.timestamp?i:o);return Ys(s,e,r),s}else{let s=new Qs(e,r);return t.push(s),s}},rn=(t,e)=>{if(t._start===null||e===0||t._searchMarker===null)return null;let r=t._searchMarker.length===0?null:t._searchMarker.reduce((o,c)=>nt(e-o.index)<nt(e-c.index)?o:c),s=t._start,i=0;if(r!==null)s=r.p,i=r.index,fc(r);while(s.right!==null&&i<e){if(!s.deleted&&s.countable){if(e<i+s.length)break;i+=s.length}s=s.right}while(s.left!==null&&i>e)if(s=s.left,!s.deleted&&s.countable)i-=s.length;while(s.left!==null&&s.left.id.client===s.id.client&&s.left.id.clock+s.left.length===s.id.clock)if(s=s.left,!s.deleted&&s.countable)i-=s.length;if(r!==null&&nt(r.index-i)<s.parent.length/Xs)return Ys(r,s,i),r;else return pc(t._searchMarker,s,i)},re=(t,e,r)=>{for(let s=t.length-1;s>=0;s--){let i=t[s];if(r>0){let o=i.p;o.marker=!1;while(o&&(o.deleted||!o.countable))if(o=o.left,o&&!o.deleted&&o.countable)i.index-=o.length;if(o===null||o.marker===!0){t.splice(s,1);continue}i.p=o,o.marker=!0}if(e<i.index||r>0&&e===i.index)i.index=Z(e,i.index+r)}};var sn=(t,e,r)=>{let s=t,i=e.changedParentTypes;while(!0){if(q(i,t,()=>[]).push(r),t._item===null)break;t=t._item.parent}Fs(s._eH,r,e)};class I{constructor(){this._item=null,this._map=new Map,this._start=null,this.doc=null,this._length=0,this._eH=bs(),this._dEH=bs(),this._searchMarker=null}get parent(){return this._item?this._item.parent:null}_integrate(t,e){this.doc=t,this._item=e}_copy(){throw L()}clone(){throw L()}_write(t){}get _first(){let t=this._start;while(t!==null&&t.deleted)t=t.right;return t}_callObserver(t,e){if(!t.local&&this._searchMarker)this._searchMarker.length=0}observe(t){ks(this._eH,t)}observeDeep(t){ks(this._dEH,t)}unobserve(t){_s(this._eH,t)}unobserveDeep(t){_s(this._dEH,t)}toJSON(){}}var ti=(t,e,r)=>{if(t.doc??O(),e<0)e=t._length+e;if(r<0)r=t._length+r;let s=r-e,i=[],o=t._start;while(o!==null&&s>0){if(o.countable&&!o.deleted){let c=o.content.getContent();if(c.length<=e)e-=c.length;else{for(let l=e;l<c.length&&s>0;l++)i.push(c[l]),s--;e=0}}o=o.right}return i},ei=(t)=>{t.doc??O();let e=[],r=t._start;while(r!==null){if(r.countable&&!r.deleted){let s=r.content.getContent();for(let i=0;i<s.length;i++)e.push(s[i])}r=r.right}return e};var se=(t,e)=>{let r=0,s=t._start;t.doc??O();while(s!==null){if(s.countable&&!s.deleted){let i=s.content.getContent();for(let o=0;o<i.length;o++)e(i[o],r++,t)}s=s.right}},ni=(t,e)=>{let r=[];return se(t,(s,i)=>{r.push(e(s,i,t))}),r},gc=(t)=>{let e=t._start,r=null,s=0;return{[Symbol.iterator](){return this},next:()=>{if(r===null){while(e!==null&&e.deleted)e=e.right;if(e===null)return{done:!0,value:void 0};r=e.content.getContent(),s=0,e=e.right}let i=r[s++];if(r.length<=s)r=null;return{done:!1,value:i}}}},ri=(t,e)=>{t.doc??O();let r=rn(t,e),s=t._start;if(r!==null)s=r.p,e-=r.index;for(;s!==null;s=s.right)if(!s.deleted&&s.countable){if(e<s.length)return s.content.getContent()[e];e-=s.length}},Pe=(t,e,r,s)=>{let i=r,o=t.doc,{clientID:c,store:l}=o,h=r===null?e._start:r.right,f=[],a=()=>{if(f.length>0)i=new y(m(c,b(l,c)),i,i&&i.lastId,h,h&&h.id,e,null,new at(f)),i.integrate(t,0),f=[]};s.forEach((u)=>{if(u===null)f.push(u);else switch(u.constructor){case Number:case Object:case Boolean:case Array:case String:f.push(u);break;default:switch(a(),u.constructor){case Uint8Array:case ArrayBuffer:i=new y(m(c,b(l,c)),i,i&&i.lastId,h,h&&h.id,e,null,new ae(new Uint8Array(u))),i.integrate(t,0);break;case Td:i=new y(m(c,b(l,c)),i,i&&i.lastId,h,h&&h.id,e,null,new he(u)),i.integrate(t,0);break;default:if(u instanceof I)i=new y(m(c,b(l,c)),i,i&&i.lastId,h,h&&h.id,e,null,new W(u)),i.integrate(t,0);else throw Error("Unexpected content type in insert operation")}}}),a()},si=()=>R("Length exceeded!"),ii=(t,e,r,s)=>{if(r>e._length)throw si();if(r===0){if(e._searchMarker)re(e._searchMarker,r,s.length);return Pe(t,e,null,s)}let i=r,o=rn(e,r),c=e._start;if(o!==null){if(c=o.p,r-=o.index,r===0)c=c.prev,r+=c&&c.countable&&!c.deleted?c.length:0}for(;c!==null;c=c.right)if(!c.deleted&&c.countable){if(r<=c.length){if(r<c.length)N(t,m(c.id.client,c.id.clock+r));break}r-=c.length}if(e._searchMarker)re(e._searchMarker,i,s.length);return Pe(t,e,c,s)},mc=(t,e,r)=>{let i=(e._searchMarker||[]).reduce((o,c)=>c.index>o.index?c:o,{index:0,p:e._start}).p;if(i)while(i.right)i=i.right;return Pe(t,e,i,r)},oi=(t,e,r,s)=>{if(s===0)return;let i=r,o=s,c=rn(e,r),l=e._start;if(c!==null)l=c.p,r-=c.index;for(;l!==null&&r>0;l=l.right)if(!l.deleted&&l.countable){if(r<l.length)N(t,m(l.id.client,l.id.clock+r));r-=l.length}while(s>0&&l!==null){if(!l.deleted){if(s<l.length)N(t,m(l.id.client,l.id.clock+s));l.delete(t),s-=l.length}l=l.right}if(s>0)throw si();if(e._searchMarker)re(e._searchMarker,i,-o+s)},Ke=(t,e,r)=>{let s=e._map.get(r);if(s!==void 0)s.delete(t)},ar=(t,e,r,s)=>{let i=e._map.get(r)||null,o=t.doc,c=o.clientID,l;if(s==null)l=new at([s]);else switch(s.constructor){case Number:case Object:case Boolean:case Array:case String:case Date:case BigInt:l=new at([s]);break;case Uint8Array:l=new ae(s);break;case Td:l=new he(s);break;default:if(s instanceof I)l=new W(s);else throw Error("Unexpected content type")}new y(m(c,b(o.store,c)),i,i&&i.lastId,null,null,e,r,l).integrate(t,0)},hr=(t,e)=>{t.doc??O();let r=t._map.get(e);return r!==void 0&&!r.deleted?r.content.getContent()[r.length-1]:void 0},ci=(t)=>{let e={};return t.doc??O(),t._map.forEach((r,s)=>{if(!r.deleted)e[s]=r.content.getContent()[r.length-1]}),e},li=(t,e)=>{t.doc??O();let r=t._map.get(e);return r!==void 0&&!r.deleted};var wc=(t,e)=>{let r={};return t._map.forEach((s,i)=>{let o=s;while(o!==null&&(!e.sv.has(o.id.client)||o.id.clock>=(e.sv.get(o.id.client)||0)))o=o.left;if(o!==null&&At(o,e))r[i]=o.content.getContent()[o.length-1]}),r},je=(t)=>(t.doc??O(),xs(t._map.entries(),(e)=>!e[1].deleted));class zy extends le{}class xa extends I{constructor(){super();this._prelimContent=[],this._searchMarker=[]}static from(t){let e=new xa;return e.push(t),e}_integrate(t,e){super._integrate(t,e),this.insert(0,this._prelimContent),this._prelimContent=null}_copy(){return new xa}clone(){let t=new xa;return t.insert(0,this.toArray().map((e)=>e instanceof I?e.clone():e)),t}get length(){return this.doc??O(),this._length}_callObserver(t,e){super._callObserver(t,e),sn(this,t,new zy(this,t))}insert(t,e){if(this.doc!==null)x(this.doc,(r)=>{ii(r,this,t,e)});else this._prelimContent.splice(t,0,...e)}push(t){if(this.doc!==null)x(this.doc,(e)=>{mc(e,this,t)});else this._prelimContent.push(...t)}unshift(t){this.insert(0,t)}delete(t,e=1){if(this.doc!==null)x(this.doc,(r)=>{oi(r,this,t,e)});else this._prelimContent.splice(t,e)}get(t){return ri(this,t)}toArray(){return ei(this)}slice(t=0,e=this.length){return ti(this,t,e)}toJSON(){return this.map((t)=>t instanceof I?t.toJSON():t)}map(t){return ni(this,t)}forEach(t){se(this,t)}[Symbol.iterator](){return gc(this)}_write(t){t.writeTypeRef($c)}}var xc=(t)=>new xa;class L_ extends le{constructor(t,e,r){super(t,e);this.keysChanged=r}}class os extends I{constructor(t){super();if(this._prelimContent=null,t===void 0)this._prelimContent=new Map;else this._prelimContent=new Map(t)}_integrate(t,e){super._integrate(t,e),this._prelimContent.forEach((r,s)=>{this.set(s,r)}),this._prelimContent=null}_copy(){return new os}clone(){let t=new os;return this.forEach((e,r)=>{t.set(r,e instanceof I?e.clone():e)}),t}_callObserver(t,e){sn(this,t,new L_(this,t,e))}toJSON(){this.doc??O();let t={};return this._map.forEach((e,r)=>{if(!e.deleted){let s=e.content.getContent()[e.length-1];t[r]=s instanceof I?s.toJSON():s}}),t}get size(){return[...je(this)].length}keys(){return Me(je(this),(t)=>t[0])}values(){return Me(je(this),(t)=>t[1].content.getContent()[t[1].length-1])}entries(){return Me(je(this),(t)=>[t[0],t[1].content.getContent()[t[1].length-1]])}forEach(t){this.doc??O(),this._map.forEach((e,r)=>{if(!e.deleted)t(e.content.getContent()[e.length-1],r,this)})}[Symbol.iterator](){return this.entries()}delete(t){if(this.doc!==null)x(this.doc,(e)=>{Ke(e,this,t)});else this._prelimContent.delete(t)}set(t,e){if(this.doc!==null)x(this.doc,(r)=>{ar(r,this,t,e)});else this._prelimContent.set(t,e);return e}get(t){return hr(this,t)}has(t){return li(this,t)}clear(){if(this.doc!==null)x(this.doc,(t)=>{this.forEach(function(e,r,s){Ke(t,s,r)})});else this._prelimContent.clear()}_write(t){t.writeTypeRef(Fc)}}var yc=(t)=>new os,tt=(t,e)=>t===e||typeof t==="object"&&typeof e==="object"&&t&&e&&In(t,e);class We{constructor(t,e,r,s){this.left=t,this.right=e,this.index=r,this.currentAttributes=s}forward(){if(this.right===null)v();switch(this.right.content.constructor){case U:if(!this.right.deleted)Rt(this.currentAttributes,this.right.content);break;default:if(!this.right.deleted)this.index+=this.right.length;break}this.left=this.right,this.right=this.right.right}}var Cs=(t,e,r)=>{while(e.right!==null&&r>0){switch(e.right.content.constructor){case U:if(!e.right.deleted)Rt(e.currentAttributes,e.right.content);break;default:if(!e.right.deleted){if(r<e.right.length)N(t,m(e.right.id.client,e.right.id.clock+r));e.index+=e.right.length,r-=e.right.length}break}e.left=e.right,e.right=e.right.right}return e},qe=(t,e,r,s)=>{let i=new Map,o=s?rn(e,r):null;if(o){let c=new We(o.p.left,o.p,o.index,i);return Cs(t,c,r-o.index)}else{let c=new We(null,e._start,0,i);return Cs(t,c,r)}},ai=(t,e,r,s)=>{while(r.right!==null&&(r.right.deleted===!0||r.right.content.constructor===U&&tt(s.get(r.right.content.key),r.right.content.value))){if(!r.right.deleted)s.delete(r.right.content.key);r.forward()}let i=t.doc,o=i.clientID;s.forEach((c,l)=>{let{left:h,right:f}=r,a=new y(m(o,b(i.store,o)),h,h&&h.lastId,f,f&&f.id,e,null,new U(l,c));a.integrate(t,0),r.right=a,r.forward()})},Rt=(t,e)=>{let{key:r,value:s}=e;if(s===null)t.delete(r);else t.set(r,s)},hi=(t,e)=>{while(!0){if(t.right===null)break;else if(t.right.deleted||t.right.content.constructor===U&&tt(e[t.right.content.key]??null,t.right.content.value));else break;t.forward()}},ui=(t,e,r,s)=>{let i=t.doc,o=i.clientID,c=new Map;for(let l in s){let h=s[l],f=r.currentAttributes.get(l)??null;if(!tt(f,h)){c.set(l,f);let{left:a,right:u}=r;r.right=new y(m(o,b(i.store,o)),a,a&&a.lastId,u,u&&u.id,e,null,new U(l,h)),r.right.integrate(t,0),r.forward()}}return c},Kn=(t,e,r,s,i)=>{r.currentAttributes.forEach((d,p)=>{if(i[p]===void 0)i[p]=null});let o=t.doc,c=o.clientID;hi(r,i);let l=ui(t,e,r,i),h=s.constructor===String?new K(s):s instanceof I?new W(s):new ut(s),{left:f,right:a,index:u}=r;if(e._searchMarker)re(e._searchMarker,r.index,h.getLength());a=new y(m(c,b(o.store,c)),f,f&&f.lastId,a,a&&a.id,e,null,h),a.integrate(t,0),r.right=a,r.index=u,r.forward(),ai(t,e,r,l)},Ds=(t,e,r,s,i)=>{let o=t.doc,c=o.clientID;hi(r,i);let l=ui(t,e,r,i);t:while(r.right!==null&&(s>0||l.size>0&&(r.right.deleted||r.right.content.constructor===U))){if(!r.right.deleted)switch(r.right.content.constructor){case U:{let{key:h,value:f}=r.right.content,a=i[h];if(a!==void 0){if(tt(a,f))l.delete(h);else{if(s===0)break t;l.set(h,f)}r.right.delete(t)}else r.currentAttributes.set(h,f);break}default:if(s<r.right.length)N(t,m(r.right.id.client,r.right.id.clock+s));s-=r.right.length;break}r.forward()}if(s>0){let h="";for(;s>0;s--)h+=`
4
+ `;r.right=new y(m(c,b(o.store,c)),r.left,r.left&&r.left.lastId,r.right,r.right&&r.right.id,e,null,new K(h)),r.right.integrate(t,0),r.forward()}ai(t,e,r,l)},di=(t,e,r,s,i)=>{let o=e,c=A();while(o&&(!o.countable||o.deleted)){if(!o.deleted&&o.content.constructor===U){let f=o.content;c.set(f.key,f)}o=o.right}let l=0,h=!1;while(e!==o){if(r===e)h=!0;if(!e.deleted){let f=e.content;switch(f.constructor){case U:{let{key:a,value:u}=f,d=s.get(a)??null;if(c.get(a)!==f||d===u){if(e.delete(t),l++,!h&&(i.get(a)??null)===u&&d!==u)if(d===null)i.delete(a);else i.set(a,d)}if(!h&&!e.deleted)Rt(i,f);break}}}e=e.right}return l},bc=(t,e)=>{while(e&&e.right&&(e.right.deleted||!e.right.countable))e=e.right;let r=new Set;while(e&&(e.deleted||!e.countable)){if(!e.deleted&&e.content.constructor===U){let s=e.content.key;if(r.has(s))e.delete(t);else r.add(s)}e=e.left}},kc=(t)=>{let e=0;return x(t.doc,(r)=>{let{_start:s,_start:i}=t,o=A(),c=Ee(o);while(i){if(i.deleted===!1)switch(i.content.constructor){case U:Rt(c,i.content);break;default:e+=di(r,s,i,o,c),o=Ee(c),s=i;break}i=i.right}}),e},_c=(t)=>{let e=new Set,r=t.doc;for(let[s,i]of t.afterState.entries()){let o=t.beforeState.get(s)||0;if(i===o)continue;Js(t,r.store.clients.get(s),o,i,(c)=>{if(!c.deleted&&c.content.constructor===U&&c.constructor!==V)e.add(c.parent)})}x(r,(s)=>{Bt(t,t.deleteSet,(i)=>{if(i instanceof V||!i.parent._hasFormatting||e.has(i.parent))return;let o=i.parent;if(i.content.constructor===U)e.add(o);else bc(s,i)});for(let i of e)kc(i)})},Bs=(t,e,r)=>{let s=r,i=Ee(e.currentAttributes),o=e.right;while(r>0&&e.right!==null){if(e.right.deleted===!1)switch(e.right.content.constructor){case W:case ut:case K:if(r<e.right.length)N(t,m(e.right.id.client,e.right.id.clock+r));r-=e.right.length,e.right.delete(t);break}e.forward()}if(o)di(t,o,e.right,i,e.currentAttributes);let c=(e.left||e.right).parent;if(c._searchMarker)re(c._searchMarker,e.index,-s+r);return e};class $_ extends le{constructor(t,e,r){super(t,e);this.childListChanged=!1,this.keysChanged=new Set,r.forEach((s)=>{if(s===null)this.childListChanged=!0;else this.keysChanged.add(s)})}get changes(){if(this._changes===null){let t={keys:this.keys,delta:this.delta,added:new Set,deleted:new Set};this._changes=t}return this._changes}get delta(){if(this._delta===null){let t=this.target.doc,e=[];x(t,(r)=>{let s=new Map,i=new Map,o=this.target._start,c=null,l={},h="",f=0,a=0,u=()=>{if(c!==null){let d=null;switch(c){case"delete":if(a>0)d={delete:a};a=0;break;case"insert":if(typeof h==="object"||h.length>0){if(d={insert:h},s.size>0)d.attributes={},s.forEach((p,g)=>{if(p!==null)d.attributes[g]=p})}h="";break;case"retain":if(f>0){if(d={retain:f},!Mr(l))d.attributes=Lr({},l)}f=0;break}if(d)e.push(d);c=null}};while(o!==null){switch(o.content.constructor){case W:case ut:if(this.adds(o)){if(!this.deletes(o))u(),c="insert",h=o.content.getContent()[0],u()}else if(this.deletes(o)){if(c!=="delete")u(),c="delete";a+=1}else if(!o.deleted){if(c!=="retain")u(),c="retain";f+=1}break;case K:if(this.adds(o)){if(!this.deletes(o)){if(c!=="insert")u(),c="insert";h+=o.content.str}}else if(this.deletes(o)){if(c!=="delete")u(),c="delete";a+=o.length}else if(!o.deleted){if(c!=="retain")u(),c="retain";f+=o.length}break;case U:{let{key:d,value:p}=o.content;if(this.adds(o)){if(!this.deletes(o)){let g=s.get(d)??null;if(!tt(g,p)){if(c==="retain")u();if(tt(p,i.get(d)??null))delete l[d];else l[d]=p}else if(p!==null)o.delete(r)}}else if(this.deletes(o)){i.set(d,p);let g=s.get(d)??null;if(!tt(g,p)){if(c==="retain")u();l[d]=g}}else if(!o.deleted){i.set(d,p);let g=l[d];if(g!==void 0){if(!tt(g,p)){if(c==="retain")u();if(p===null)delete l[d];else l[d]=p}else if(g!==null)o.delete(r)}}if(!o.deleted){if(c==="insert")u();Rt(s,o.content)}break}}o=o.right}u();while(e.length>0){let d=e[e.length-1];if(d.retain!==void 0&&d.attributes===void 0)e.pop();else break}}),this._delta=e}return this._delta}}class rs extends I{constructor(t){super();this._pending=t!==void 0?[()=>this.insert(0,t)]:[],this._searchMarker=[],this._hasFormatting=!1}get length(){return this.doc??O(),this._length}_integrate(t,e){super._integrate(t,e);try{this._pending.forEach((r)=>r())}catch(r){console.error(r)}this._pending=null}_copy(){return new rs}clone(){let t=new rs;return t.applyDelta(this.toDelta()),t}_callObserver(t,e){super._callObserver(t,e);let r=new $_(this,t,e);if(sn(this,t,r),!t.local&&this._hasFormatting)t._needFormattingCleanup=!0}toString(){this.doc??O();let t="",e=this._start;while(e!==null){if(!e.deleted&&e.countable&&e.content.constructor===K)t+=e.content.str;e=e.right}return t}toJSON(){return this.toString()}applyDelta(t,{sanitize:e=!0}={}){if(this.doc!==null)x(this.doc,(r)=>{let s=new We(null,this._start,0,new Map);for(let i=0;i<t.length;i++){let o=t[i];if(o.insert!==void 0){let c=!e&&typeof o.insert==="string"&&i===t.length-1&&s.right===null&&o.insert.slice(-1)===`
5
+ `?o.insert.slice(0,-1):o.insert;if(typeof c!=="string"||c.length>0)Kn(r,this,s,c,o.attributes||{})}else if(o.retain!==void 0)Ds(r,this,s,o.retain,o.attributes||{});else if(o.delete!==void 0)Bs(r,s,o.delete)}});else this._pending.push(()=>this.applyDelta(t))}toDelta(t,e,r){this.doc??O();let s=[],i=new Map,o=this.doc,c="",l=this._start;function h(){if(c.length>0){let a={},u=!1;i.forEach((p,g)=>{u=!0,a[g]=p});let d={insert:c};if(u)d.attributes=a;s.push(d),c=""}}let f=()=>{while(l!==null){if(At(l,t)||e!==void 0&&At(l,e))switch(l.content.constructor){case K:{let a=i.get("ychange");if(t!==void 0&&!At(l,t)){if(a===void 0||a.user!==l.id.client||a.type!=="removed")h(),i.set("ychange",r?r("removed",l.id):{type:"removed"})}else if(e!==void 0&&!At(l,e)){if(a===void 0||a.user!==l.id.client||a.type!=="added")h(),i.set("ychange",r?r("added",l.id):{type:"added"})}else if(a!==void 0)h(),i.delete("ychange");c+=l.content.str;break}case W:case ut:{h();let a={insert:l.content.getContent()[0]};if(i.size>0){let u={};a.attributes=u,i.forEach((d,p)=>{u[p]=d})}s.push(a);break}case U:if(At(l,t))h(),Rt(i,l.content);break}l=l.right}h()};if(t||e)x(o,(a)=>{if(t)Zn(a,t);if(e)Zn(a,e);f()},"cleanup");else f();return s}insert(t,e,r){if(e.length<=0)return;let s=this.doc;if(s!==null)x(s,(i)=>{let o=qe(i,this,t,!r);if(!r)r={},o.currentAttributes.forEach((c,l)=>{r[l]=c});Kn(i,this,o,e,r)});else this._pending.push(()=>this.insert(t,e,r))}insertEmbed(t,e,r){let s=this.doc;if(s!==null)x(s,(i)=>{let o=qe(i,this,t,!r);Kn(i,this,o,e,r||{})});else this._pending.push(()=>this.insertEmbed(t,e,r||{}))}delete(t,e){if(e===0)return;let r=this.doc;if(r!==null)x(r,(s)=>{Bs(s,qe(s,this,t,!0),e)});else this._pending.push(()=>this.delete(t,e))}format(t,e,r){if(e===0)return;let s=this.doc;if(s!==null)x(s,(i)=>{let o=qe(i,this,t,!1);if(o.right===null)return;Ds(i,this,o,e,r)});else this._pending.push(()=>this.format(t,e,r))}removeAttribute(t){if(this.doc!==null)x(this.doc,(e)=>{Ke(e,this,t)});else this._pending.push(()=>this.removeAttribute(t))}setAttribute(t,e){if(this.doc!==null)x(this.doc,(r)=>{ar(r,this,t,e)});else this._pending.push(()=>this.setAttribute(t,e))}getAttribute(t){return hr(this,t)}getAttributes(){return ci(this)}_write(t){t.writeTypeRef(jc)}}var Sc=(t)=>new rs;class ze{constructor(t,e=()=>!0){this._filter=e,this._root=t,this._currentNode=t._start,this._firstCall=!0,t.doc??O()}[Symbol.iterator](){return this}next(){let t=this._currentNode,e=t&&t.content&&t.content.type;if(t!==null&&(!this._firstCall||t.deleted||!this._filter(e)))do if(e=t.content.type,!t.deleted&&(e.constructor===Ot||e.constructor===lt)&&e._start!==null)t=e._start;else while(t!==null){let r=t.next;if(r!==null){t=r;break}else if(t.parent===this._root)t=null;else t=t.parent._item}while(t!==null&&(t.deleted||!this._filter(t.content.type)));if(this._firstCall=!1,t===null)return{value:void 0,done:!0};return this._currentNode=t,{value:t.content.type,done:!1}}}class lt extends I{constructor(){super();this._prelimContent=[]}get firstChild(){let t=this._first;return t?t.content.getContent()[0]:null}_integrate(t,e){super._integrate(t,e),this.insert(0,this._prelimContent),this._prelimContent=null}_copy(){return new lt}clone(){let t=new lt;return t.insert(0,this.toArray().map((e)=>e instanceof I?e.clone():e)),t}get length(){return this.doc??O(),this._prelimContent===null?this._length:this._prelimContent.length}createTreeWalker(t){return new ze(this,t)}querySelector(t){t=t.toUpperCase();let r=new ze(this,(s)=>s.nodeName&&s.nodeName.toUpperCase()===t).next();if(r.done)return null;else return r.value}querySelectorAll(t){return t=t.toUpperCase(),j(new ze(this,(e)=>e.nodeName&&e.nodeName.toUpperCase()===t))}_callObserver(t,e){sn(this,t,new fi(this,e,t))}toString(){return ni(this,(t)=>t.toString()).join("")}toJSON(){return this.toString()}toDOM(t=document,e={},r){let s=t.createDocumentFragment();if(r!==void 0)r._createAssociation(s,this);return se(this,(i)=>{s.insertBefore(i.toDOM(t,e,r),null)}),s}insert(t,e){if(this.doc!==null)x(this.doc,(r)=>{ii(r,this,t,e)});else this._prelimContent.splice(t,0,...e)}insertAfter(t,e){if(this.doc!==null)x(this.doc,(r)=>{let s=t&&t instanceof I?t._item:t;Pe(r,this,s,e)});else{let r=this._prelimContent,s=t===null?0:r.findIndex((i)=>i===t)+1;if(s===0&&t!==null)throw R("Reference item not found");r.splice(s,0,...e)}}delete(t,e=1){if(this.doc!==null)x(this.doc,(r)=>{oi(r,this,t,e)});else this._prelimContent.splice(t,e)}toArray(){return ei(this)}push(t){this.insert(this.length,t)}unshift(t){this.insert(0,t)}get(t){return ri(this,t)}slice(t=0,e=this.length){return ti(this,t,e)}forEach(t){se(this,t)}_write(t){t.writeTypeRef(Gc)}}var Ec=(t)=>new lt;class Ot extends lt{constructor(t="UNDEFINED"){super();this.nodeName=t,this._prelimAttrs=new Map}get nextSibling(){let t=this._item?this._item.next:null;return t?t.content.type:null}get prevSibling(){let t=this._item?this._item.prev:null;return t?t.content.type:null}_integrate(t,e){super._integrate(t,e),this._prelimAttrs.forEach((r,s)=>{this.setAttribute(s,r)}),this._prelimAttrs=null}_copy(){return new Ot(this.nodeName)}clone(){let t=new Ot(this.nodeName),e=this.getAttributes();return Vr(e,(r,s)=>{t.setAttribute(s,r)}),t.insert(0,this.toArray().map((r)=>r instanceof I?r.clone():r)),t}toString(){let t=this.getAttributes(),e=[],r=[];for(let c in t)r.push(c);r.sort();let s=r.length;for(let c=0;c<s;c++){let l=r[c];e.push(l+'="'+t[l]+'"')}let i=this.nodeName.toLocaleLowerCase(),o=e.length>0?" "+e.join(" "):"";return`<${i}${o}>${super.toString()}</${i}>`}removeAttribute(t){if(this.doc!==null)x(this.doc,(e)=>{Ke(e,this,t)});else this._prelimAttrs.delete(t)}setAttribute(t,e){if(this.doc!==null)x(this.doc,(r)=>{ar(r,this,t,e)});else this._prelimAttrs.set(t,e)}getAttribute(t){return hr(this,t)}hasAttribute(t){return li(this,t)}getAttributes(t){return t?wc(this,t):ci(this)}toDOM(t=document,e={},r){let s=t.createElement(this.nodeName),i=this.getAttributes();for(let o in i){let c=i[o];if(typeof c==="string")s.setAttribute(o,c)}if(se(this,(o)=>{s.appendChild(o.toDOM(t,e,r))}),r!==void 0)r._createAssociation(s,this);return s}_write(t){t.writeTypeRef(qc),t.writeKey(this.nodeName)}}var Ic=(t)=>new Ot(t.readKey());class fi extends le{constructor(t,e,r){super(t,r);this.childListChanged=!1,this.attributesChanged=new Set,e.forEach((s)=>{if(s===null)this.childListChanged=!0;else this.attributesChanged.add(s)})}}class Ze extends os{constructor(t){super();this.hookName=t}_copy(){return new Ze(this.hookName)}clone(){let t=new Ze(this.hookName);return this.forEach((e,r)=>{t.set(r,e)}),t}toDOM(t=document,e={},r){let s=e[this.hookName],i;if(s!==void 0)i=s.createDom(this);else i=document.createElement(this.hookName);if(i.setAttribute("data-yjs-hook",this.hookName),r!==void 0)r._createAssociation(i,this);return i}_write(t){t.writeTypeRef(zc),t.writeKey(this.hookName)}}var Uc=(t)=>new Ze(t.readKey());class Xe extends rs{get nextSibling(){let t=this._item?this._item.next:null;return t?t.content.type:null}get prevSibling(){let t=this._item?this._item.prev:null;return t?t.content.type:null}_copy(){return new Xe}clone(){let t=new Xe;return t.applyDelta(this.toDelta()),t}toDOM(t=document,e,r){let s=t.createTextNode(this.toString());if(r!==void 0)r._createAssociation(s,this);return s}toString(){return this.toDelta().map((t)=>{let e=[];for(let s in t.attributes){let i=[];for(let o in t.attributes[s])i.push({key:o,value:t.attributes[s][o]});i.sort((o,c)=>o.key<c.key?-1:1),e.push({nodeName:s,attrs:i})}e.sort((s,i)=>s.nodeName<i.nodeName?-1:1);let r="";for(let s=0;s<e.length;s++){let i=e[s];r+=`<${i.nodeName}`;for(let o=0;o<i.attrs.length;o++){let c=i.attrs[o];r+=` ${c.key}="${c.value}"`}r+=">"}r+=t.insert;for(let s=e.length-1;s>=0;s--)r+=`</${e[s].nodeName}>`;return r}).join("")}toJSON(){return this.toString()}_write(t){t.writeTypeRef(Hc)}}var Tc=(t)=>new Xe;class on{constructor(t,e){this.id=t,this.length=e}get deleted(){throw L()}mergeWith(t){return!1}write(t,e,r){throw L()}integrate(t,e){throw L()}}var Ac=0;class V extends on{get deleted(){return!0}delete(){}mergeWith(t){if(this.constructor!==t.constructor)return!1;return this.length+=t.length,!0}integrate(t,e){if(e>0)this.id.clock+=e,this.length-=e;Hs(t.doc.store,this)}write(t,e){t.writeInfo(Ac),t.writeLen(this.length-e)}getMissing(t,e){return null}}class ae{constructor(t){this.content=t}getLength(){return 1}getContent(){return[this.content]}isCountable(){return!0}copy(){return new ae(this.content)}splice(t){throw L()}mergeWith(t){return!1}integrate(t,e){}delete(t){}gc(t){}write(t,e){t.writeBuf(this.content)}getRef(){return 3}}var Cc=(t)=>new ae(t.readBuf());class ie{constructor(t){this.len=t}getLength(){return this.len}getContent(){return[]}isCountable(){return!1}copy(){return new ie(this.len)}splice(t){let e=new ie(this.len-t);return this.len=t,e}mergeWith(t){return this.len+=t.len,!0}integrate(t,e){ne(t.deleteSet,e.id.client,e.id.clock,this.len),e.markDeleted()}delete(t){}gc(t){}write(t,e){t.writeLen(this.len-e)}getRef(){return 1}}var Dc=(t)=>new ie(t.readLen()),pi=(t,e)=>new Td({guid:t,...e,shouldLoad:e.shouldLoad||e.autoLoad||!1});class he{constructor(t){if(t._item)console.error("This document was already integrated as a sub-document. You should create a second instance instead with the same guid.");this.doc=t;let e={};if(this.opts=e,!t.gc)e.gc=!1;if(t.autoLoad)e.autoLoad=!0;if(t.meta!==null)e.meta=t.meta}getLength(){return 1}getContent(){return[this.doc]}isCountable(){return!0}copy(){return new he(pi(this.doc.guid,this.opts))}splice(t){throw L()}mergeWith(t){return!1}integrate(t,e){if(this.doc._item=e,t.subdocsAdded.add(this.doc),this.doc.shouldLoad)t.subdocsLoaded.add(this.doc)}delete(t){if(t.subdocsAdded.has(this.doc))t.subdocsAdded.delete(this.doc);else t.subdocsRemoved.add(this.doc)}gc(t){}write(t,e){t.writeString(this.doc.guid),t.writeAny(this.opts)}getRef(){return 9}}var Bc=(t)=>new he(pi(t.readString(),t.readAny()));class ut{constructor(t){this.embed=t}getLength(){return 1}getContent(){return[this.embed]}isCountable(){return!0}copy(){return new ut(this.embed)}splice(t){throw L()}mergeWith(t){return!1}integrate(t,e){}delete(t){}gc(t){}write(t,e){t.writeJSON(this.embed)}getRef(){return 5}}var Oc=(t)=>new ut(t.readJSON());class U{constructor(t,e){this.key=t,this.value=e}getLength(){return 1}getContent(){return[]}isCountable(){return!1}copy(){return new U(this.key,this.value)}splice(t){throw L()}mergeWith(t){return!1}integrate(t,e){let r=e.parent;r._searchMarker=null,r._hasFormatting=!0}delete(t){}gc(t){}write(t,e){t.writeKey(this.key),t.writeJSON(this.value)}getRef(){return 6}}var vc=(t)=>new U(t.readKey(),t.readJSON());class Qe{constructor(t){this.arr=t}getLength(){return this.arr.length}getContent(){return this.arr}isCountable(){return!0}copy(){return new Qe(this.arr)}splice(t){let e=new Qe(this.arr.slice(t));return this.arr=this.arr.slice(0,t),e}mergeWith(t){return this.arr=this.arr.concat(t.arr),!0}integrate(t,e){}delete(t){}gc(t){}write(t,e){let r=this.arr.length;t.writeLen(r-e);for(let s=e;s<r;s++){let i=this.arr[s];t.writeString(i===void 0?"undefined":JSON.stringify(i))}}getRef(){return 2}}var Nc=(t)=>{let e=t.readLen(),r=[];for(let s=0;s<e;s++){let i=t.readString();if(i==="undefined")r.push(void 0);else r.push(JSON.parse(i))}return new Qe(r)},Rc=Zt("node_env")==="development";class at{constructor(t){this.arr=t,Rc&&Un(t)}getLength(){return this.arr.length}getContent(){return this.arr}isCountable(){return!0}copy(){return new at(this.arr)}splice(t){let e=new at(this.arr.slice(t));return this.arr=this.arr.slice(0,t),e}mergeWith(t){return this.arr=this.arr.concat(t.arr),!0}integrate(t,e){}delete(t){}gc(t){}write(t,e){let r=this.arr.length;t.writeLen(r-e);for(let s=e;s<r;s++){let i=this.arr[s];t.writeAny(i)}}getRef(){return 8}}var Lc=(t)=>{let e=t.readLen(),r=[];for(let s=0;s<e;s++)r.push(t.readAny());return new at(r)};class K{constructor(t){this.str=t}getLength(){return this.str.length}getContent(){return this.str.split("")}isCountable(){return!0}copy(){return new K(this.str)}splice(t){let e=new K(this.str.slice(t));this.str=this.str.slice(0,t);let r=this.str.charCodeAt(t-1);if(r>=55296&&r<=56319)this.str=this.str.slice(0,t-1)+"�",e.str="�"+e.str.slice(1);return e}mergeWith(t){return this.str+=t.str,!0}integrate(t,e){}delete(t){}gc(t){}write(t,e){t.writeString(e===0?this.str:this.str.slice(e))}getRef(){return 4}}var Vc=(t)=>new K(t.readString()),Mc=[xc,yc,Sc,Ic,Ec,Uc,Tc],$c=0,Fc=1,jc=2,qc=3,Gc=4,zc=5,Hc=6;class W{constructor(t){this.type=t}getLength(){return 1}getContent(){return[this.type]}isCountable(){return!0}copy(){return new W(this.type._copy())}splice(t){throw L()}mergeWith(t){return!1}integrate(t,e){this.type._integrate(t.doc,e)}delete(t){let e=this.type._start;while(e!==null){if(!e.deleted)e.delete(t);else if(e.id.clock<(t.beforeState.get(e.id.client)||0))t._mergeStructs.push(e);e=e.right}this.type._map.forEach((r)=>{if(!r.deleted)r.delete(t);else if(r.id.clock<(t.beforeState.get(r.id.client)||0))t._mergeStructs.push(r)}),t.changed.delete(this.type)}gc(t){let e=this.type._start;while(e!==null)e.gc(t,!0),e=e.right;this.type._start=null,this.type._map.forEach((r)=>{while(r!==null)r.gc(t,!0),r=r.left}),this.type._map=new Map}write(t,e){this.type._write(t)}getRef(){return 7}}var Jc=(t)=>new W(Mc[t.readTypeRef()](t)),Qn=(t,e)=>{let r=e,s=0,i;do{if(s>0)r=m(r.client,r.clock+s);i=Ct(t,r),s=r.clock-i.id.clock,r=i.redone}while(r!==null&&i instanceof y);return{item:i,diff:s}},ur=(t,e)=>{while(t!==null&&t.keep!==e)t.keep=e,t=t.parent._item},Ye=(t,e,r)=>{let{client:s,clock:i}=e.id,o=new y(m(s,i+r),e,m(s,i+r-1),e.right,e.rightOrigin,e.parent,e.parentSub,e.content.splice(r));if(e.deleted)o.markDeleted();if(e.keep)o.keep=!0;if(e.redone!==null)o.redone=m(e.redone.client,e.redone.clock+r);if(e.right=o,o.right!==null)o.right.left=o;if(t._mergeStructs.push(o),o.parentSub!==null&&o.right===null)o.parent._map.set(o.parentSub,o);return e.length=r,o},Os=(t,e)=>$t(t,(r)=>ce(r.deletions,e)),gi=(t,e,r,s,i,o)=>{let c=t.doc,{store:l,clientID:h}=c,f=e.redone;if(f!==null)return N(t,f);let a=e.parent._item,u=null,d;if(a!==null&&a.deleted===!0){if(a.redone===null&&(!r.has(a)||gi(t,a,r,s,i,o)===null))return null;while(a.redone!==null)a=N(t,a.redone)}let p=a===null?e.parent:a.content.type;if(e.parentSub===null){u=e.left,d=e;while(u!==null){let k=u;while(k!==null&&k.parent._item!==a)k=k.redone===null?null:N(t,k.redone);if(k!==null&&k.parent._item===a){u=k;break}u=u.left}while(d!==null){let k=d;while(k!==null&&k.parent._item!==a)k=k.redone===null?null:N(t,k.redone);if(k!==null&&k.parent._item===a){d=k;break}d=d.right}}else{if(d=null,e.right&&!i){u=e;while(u!==null&&u.right!==null&&(u.right.redone||ce(s,u.right.id)||Os(o.undoStack,u.right.id)||Os(o.redoStack,u.right.id))){u=u.right;while(u.redone)u=N(t,u.redone)}if(u&&u.right!==null)return null}else u=p._map.get(e.parentSub)||null;if(u!==null&&u.parent._item!==a)u=p._map.get(e.parentSub)||null}let g=b(l,h),w=m(h,g),C=new y(w,u,u&&u.lastId,d,d&&d.id,p,e.parentSub,e.content.copy());return e.redone=w,ur(C,!0),C.integrate(t,0),C};class y extends on{constructor(t,e,r,s,i,o,c,l){super(t,l.getLength());this.origin=r,this.left=e,this.right=s,this.rightOrigin=i,this.parent=o,this.parentSub=c,this.redone=null,this.content=l,this.info=this.content.isCountable()?ln:0}set marker(t){if((this.info&pe)>0!==t)this.info^=pe}get marker(){return(this.info&pe)>0}get keep(){return(this.info&cn)>0}set keep(t){if(this.keep!==t)this.info^=cn}get countable(){return(this.info&ln)>0}get deleted(){return(this.info&fe)>0}set deleted(t){if(this.deleted!==t)this.info^=fe}markDeleted(){this.info|=fe}getMissing(t,e){if(this.origin&&this.origin.client!==this.id.client&&this.origin.clock>=b(e,this.origin.client))return this.origin.client;if(this.rightOrigin&&this.rightOrigin.client!==this.id.client&&this.rightOrigin.clock>=b(e,this.rightOrigin.client))return this.rightOrigin.client;if(this.parent&&this.parent.constructor===ot&&this.id.client!==this.parent.client&&this.parent.clock>=b(e,this.parent.client))return this.parent.client;if(this.origin)this.left=Ss(t,e,this.origin),this.origin=this.left.lastId;if(this.rightOrigin)this.right=N(t,this.rightOrigin),this.rightOrigin=this.right.id;if(this.left&&this.left.constructor===V||this.right&&this.right.constructor===V)this.parent=null;else if(!this.parent){if(this.left&&this.left.constructor===y)this.parent=this.left.parent,this.parentSub=this.left.parentSub;else if(this.right&&this.right.constructor===y)this.parent=this.right.parent,this.parentSub=this.right.parentSub}else if(this.parent.constructor===ot){let r=Ct(e,this.parent);if(r.constructor===V)this.parent=null;else this.parent=r.content.type}return null}integrate(t,e){if(e>0)this.id.clock+=e,this.left=Ss(t,t.doc.store,m(this.id.client,this.id.clock-1)),this.origin=this.left.lastId,this.content=this.content.splice(e),this.length-=e;if(this.parent){if(!this.left&&(!this.right||this.right.left!==null)||this.left&&this.left.right!==this.right){let r=this.left,s;if(r!==null)s=r.right;else if(this.parentSub!==null){s=this.parent._map.get(this.parentSub)||null;while(s!==null&&s.left!==null)s=s.left}else s=this.parent._start;let i=new Set,o=new Set;while(s!==null&&s!==this.right){if(o.add(s),i.add(s),$e(this.origin,s.origin)){if(s.id.client<this.id.client)r=s,i.clear();else if($e(this.rightOrigin,s.rightOrigin))break}else if(s.origin!==null&&o.has(Ct(t.doc.store,s.origin))){if(!i.has(Ct(t.doc.store,s.origin)))r=s,i.clear()}else break;s=s.right}this.left=r}if(this.left!==null){let r=this.left.right;this.right=r,this.left.right=this}else{let r;if(this.parentSub!==null){r=this.parent._map.get(this.parentSub)||null;while(r!==null&&r.left!==null)r=r.left}else r=this.parent._start,this.parent._start=this;this.right=r}if(this.right!==null)this.right.left=this;else if(this.parentSub!==null){if(this.parent._map.set(this.parentSub,this),this.left!==null)this.left.delete(t)}if(this.parentSub===null&&this.countable&&!this.deleted)this.parent._length+=this.length;if(Hs(t.doc.store,this),this.content.integrate(t,this),Is(t,this.parent,this.parentSub),this.parent._item!==null&&this.parent._item.deleted||this.parentSub!==null&&this.right!==null)this.delete(t)}else new V(this.id,this.length).integrate(t,0)}get next(){let t=this.right;while(t!==null&&t.deleted)t=t.right;return t}get prev(){let t=this.left;while(t!==null&&t.deleted)t=t.left;return t}get lastId(){return this.length===1?this.id:m(this.id.client,this.id.clock+this.length-1)}mergeWith(t){if(this.constructor===t.constructor&&$e(t.origin,this.lastId)&&this.right===t&&$e(this.rightOrigin,t.rightOrigin)&&this.id.client===t.id.client&&this.id.clock+this.length===t.id.clock&&this.deleted===t.deleted&&this.redone===null&&t.redone===null&&this.content.constructor===t.content.constructor&&this.content.mergeWith(t.content)){let e=this.parent._searchMarker;if(e)e.forEach((r)=>{if(r.p===t){if(r.p=this,!this.deleted&&this.countable)r.index-=this.length}});if(t.keep)this.keep=!0;if(this.right=t.right,this.right!==null)this.right.left=this;return this.length+=t.length,!0}return!1}delete(t){if(!this.deleted){let e=this.parent;if(this.countable&&this.parentSub===null)e._length-=this.length;this.markDeleted(),ne(t.deleteSet,this.id.client,this.id.clock,this.length),Is(t,e,this.parentSub),this.content.delete(t)}}gc(t,e){if(!this.deleted)throw v();if(this.content.gc(t),e)rc(t,this,new V(this.id,this.length));else this.content=new ie(this.length)}write(t,e){let r=e>0?m(this.id.client,this.id.clock+e-1):this.origin,s=this.rightOrigin,i=this.parentSub,o=this.content.getRef()&Vt|(r===null?0:D)|(s===null?0:F)|(i===null?0:dt);if(t.writeInfo(o),r!==null)t.writeLeftID(r);if(s!==null)t.writeRightID(s);if(r===null&&s===null){let c=this.parent;if(c._item!==void 0){let l=c._item;if(l===null){let h=js(c);t.writeParentInfo(!0),t.writeString(h)}else t.writeParentInfo(!1),t.writeLeftID(l.id)}else if(c.constructor===String)t.writeParentInfo(!0),t.writeString(c);else if(c.constructor===ot)t.writeParentInfo(!1),t.writeLeftID(c);else v();if(i!==null)t.writeString(i)}this.content.write(t,e)}}var mi=(t,e)=>Pc[e&Vt](t),Pc=[()=>{v()},Dc,Nc,Cc,Vc,Oc,vc,Jc,Lc,Bc,()=>{v()}],Kc=10;class M extends on{get deleted(){return!0}delete(){}mergeWith(t){if(this.constructor!==t.constructor)return!1;return this.length+=t.length,!0}integrate(t,e){v()}write(t,e){t.writeInfo(Kc),_t(t.restEncoder,this.length-e)}getMissing(t,e){return null}}var wi=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:{},xi="__ $YJS$ __";if(wi[xi]===!0)console.error("Yjs was already imported. This breaks constructor checks and will lead to issues! - https://github.com/yjs/yjs/issues/438");wi[xi]=!0;var qR=0,GR=1,KR=2,JR=3;class eb extends Error{constructor(t){super(t);this.name="EnvelopeError"}}function Wc(t){return _(t)&&"type"in t&&n(t.type)}function Xk(t){let e=Qa(),{type:r}=t;switch(t.type){case"doc-sync":{_t(e,qR),el(e,t.path),_t(e,t.epoch),zo(e,t.body);break}case"awareness":{_t(e,GR),zo(e,t.body);break}case"doc-close":{_t(e,KR),el(e,t.path);break}case"control":{_t(e,JR),el(e,JSON.stringify(t.message));break}default:throw new eb(`unknown-frame:${r}`)}return br(e)}function Qk(t){try{let e=tl(t),r=Dt(e);switch(r){case qR:{let s=nl(e),i=Dt(e);return{body:Xo(e),epoch:i,path:s,type:"doc-sync"}}case GR:return{body:Xo(e),type:"awareness"};case KR:return{path:nl(e),type:"doc-close"};case JR:{let s=JSON.parse(nl(e));if(!Wc(s))throw new eb("malformed-control");return{message:s,type:"control"}}default:throw new eb(`unknown-frame-type:${r}`)}}catch(e){if(e instanceof eb)throw e;throw new eb(`malformed-frame: ${e instanceof Error?e.message:String(e)}`)}}
6
+ export{Yk,is,Qa,Zk,br,_t,el,zo,tl,Xo,Dt,nl,$u,fp,Td,WR,VR,UR,T_,Qg,PP,zy,xa,L_,os,$_,rs,qR,GR,KR,JR,eb,Xk,Qk};
7
7
 
8
- //# debugId=AD65E5AE74941ADD64756E2164756E21
9
- //# sourceMappingURL=studio-bvs9kpst.js.map
8
+ //# debugId=198C109F54CBB45964756E2164756E21
9
+ //# sourceMappingURL=studio-3na1r48j.js.map
@@ -1,7 +1,7 @@
1
- import{ln,sv,h}from"./studio-k2sz13zg.js";import{rt,Eo,Ap,xr}from"./studio-th7z3fg7.js";import{g}from"./studio-y60sts62.js";import{u}from"./studio-2r90cts3.js";import{S}from"./studio-cg710sk9.js";var Tb=["application","project","document","selection"],vN=["global","canvas","caret","grid","code","dock","palette"],yN=["File","Edit","Selection","Insert","View","Document","Project","Source Control","Publish","Assistant","Collaborate","Help"],v=["commandbar/primary","commandbar/overflow","statusbar/project","statusbar/document","statusbar/selection","context/element","context/file","context/layer","context/tab","context/pane","blockbar","blockbar/format","outline/row","settings/menu","palette","never"],P={"commandbar/primary":{admits:["application","document"],note:"document only for Save / Undo / Redo / Open in Browser, by frequency; ≤5 total"},"commandbar/overflow":{admits:["application","project","document"],note:"never selection — the Command Bar is not a selection surface"},"statusbar/project":{admits:["project"],note:"the status bar's left field"},"statusbar/document":{admits:["document"],note:"the status bar's centre field"},"statusbar/selection":{admits:["selection"],note:"the status bar's right field"},"context/element":{admits:["selection"],note:"the canvas element menu acts on a selection"},"context/file":{admits:["project"],note:"a file row addresses the project's file set"},"context/layer":{admits:["selection"],note:"an outline row IS a selection"},"context/tab":{admits:["document"],note:"a tab addresses one document"},"context/pane":{admits:["document"],note:"a pane hosts one document"},blockbar:{admits:["selection"],note:"the floating bar owns selection-scoped verbs"},"blockbar/format":{admits:["selection"],note:"the bar's inline-format cluster — a range inside the selection is still the selection"},"outline/row":{admits:["selection"],note:"row actions act on the row's node"},"settings/menu":{admits:["application","project"],note:"the rail foot's gear menu — the settings family. It is a MENU, not a pinned slot, so it "+"may host two levels for the reason commandbar/overflow does: a menu prints each row's own name, chord and gate, and draws a divider where the level changes. The rail's PINNED groups stay single-level, in PANEL_PLACEMENT_MATRIX"},palette:{admits:["application","project","document","selection"],note:"the level-agnostic surface; it groups rows by level"},never:{admits:["application","project","document","selection"],note:"keyboard- and API-only; no rendered surface to be misplaced in"}},b=["rail/project","rail/document","navigator","inspector","dock.bottom"],x={"rail/project":{admits:["project"],note:"the rail's upper group — Site, and Files with the developer panels on"},"rail/document":{admits:["document"],note:"the rail's lower group — Outline, Data, and Packages with the developer panels on"},navigator:{admits:["project","document"],note:"whichever level the hosted panel declares; the panel header prints it"},inspector:{admits:["document","selection"],note:"Page is the open document's tab, Element the selection's (§6)"},"dock.bottom":{admits:["project","document"],note:"the panel header states which"}};function y(e){return e==="bottom"?"dock.bottom":e}function w(e){let t=[y(e.dock)];if(e.rail!==!1)t.push(`rail/${e.level}`);return t}function E(e){return b.some((t)=>t===e)}function c(e){let t=[];if(!d(e.level))return t.push({panelId:e.id,placement:"—",level:String(e.level),message:`declares unknown level "${String(e.level)}" (expected one of: ${Tb.join(", ")})`}),t;for(let n of w(e)){if(!E(n)){t.push({panelId:e.id,placement:n,level:e.level,message:`is level "${e.level}" and would render in "${n}", which is not a panel `+"placement — the rail has a group for project and one for document, and nothing else"});continue}let o=x[n];if(!o.admits.includes(e.level))t.push({panelId:e.id,placement:n,level:e.level,message:`is level "${e.level}" but "${n}" admits only ${o.admits.join(", ")} — ${o.note}`})}return t}function C(e){return v.some((t)=>t===e)}function d(e){return Tb.some((t)=>t===e)}function wN(e){let t=[];if(!d(e.level))return t.push({commandId:e.id,placement:"—",level:String(e.level),message:`declares unknown level "${String(e.level)}" (expected one of: ${Tb.join(", ")})`}),t;for(let n of e.menus??[]){if(!C(n)){t.push({commandId:e.id,placement:String(n),level:e.level,message:`declares unknown placement "${String(n)}"`});continue}let o=P[n];if(!o.admits.includes(e.level))t.push({commandId:e.id,placement:n,level:e.level,message:`is level "${e.level}" but "${n}" admits only ${o.admits.join(", ")} — ${o.note}`})}return t}var l="true",i=g({on:Eo(rt.developerPanels)===l});Ap((e)=>{if(e.includes(rt.developerPanels.key))i.on=Eo(rt.developerPanels)===l});function CS(){return i.on}function xN(e){i.on=e,xr(rt.developerPanels,e?l:"")}function Gu(){let e=sv();return e.project.open=S!==null,e.project.isMultilingual=(ln(S?.projectConfig??{}).i18n?.locales.length??0)>1,e.git.dirtyCount=u.git.status?.files.length??0,e.workspace.id=u.workspace,e.document.open=h.value!==null,e}var L=/^[a-z][\w-]*$/,a=new Map;function Xn(e){if(!L.test(e.id))throw Error(`Panel id "${e.id}" is malformed — expected /^[a-z][\\w-]*$/, because the id is also `+`the region "navigator/panel:${e.id}" and the value view.setActivity accepts.`);if(a.has(e.id))throw Error(`Panel "${e.id}" is already registered — a second definition site is the defect this `+"registry exists to prevent.");let t=c({id:e.id,level:e.level,dock:e.dock,rail:e.rail});if(t.length>0){let n=t.map((o)=>` ✗ ${e.id} ${o.message}`).join(`
1
+ import{ln,bv,h}from"./studio-yrcrncev.js";import{rt,Eo,Bp,xr}from"./studio-g9brbewz.js";import{u}from"./studio-x0gsfr1d.js";import{C}from"./studio-4f7thq0p.js";import{g}from"./studio-3qr08sxq.js";var Wb=["application","project","document","selection"],TA=["global","canvas","caret","grid","code","dock","palette"],LA=["File","Edit","Selection","Insert","View","Document","Project","Source Control","Publish","Assistant","Collaborate","Help"],v=["commandbar/primary","commandbar/overflow","statusbar/project","statusbar/document","statusbar/selection","context/element","context/file","context/layer","context/tab","context/pane","blockbar","blockbar/format","outline/row","settings/menu","palette","never"],P={"commandbar/primary":{admits:["application","document"],note:"document only for Save / Undo / Redo / Open in Browser, by frequency; ≤5 total"},"commandbar/overflow":{admits:["application","project","document"],note:"never selection — the Command Bar is not a selection surface"},"statusbar/project":{admits:["project"],note:"the status bar's left field"},"statusbar/document":{admits:["document"],note:"the status bar's centre field"},"statusbar/selection":{admits:["selection"],note:"the status bar's right field"},"context/element":{admits:["selection"],note:"the canvas element menu acts on a selection"},"context/file":{admits:["project"],note:"a file row addresses the project's file set"},"context/layer":{admits:["selection"],note:"an outline row IS a selection"},"context/tab":{admits:["document"],note:"a tab addresses one document"},"context/pane":{admits:["document"],note:"a pane hosts one document"},blockbar:{admits:["selection"],note:"the floating bar owns selection-scoped verbs"},"blockbar/format":{admits:["selection"],note:"the bar's inline-format cluster — a range inside the selection is still the selection"},"outline/row":{admits:["selection"],note:"row actions act on the row's node"},"settings/menu":{admits:["application","project"],note:"the rail foot's gear menu — the settings family. It is a MENU, not a pinned slot, so it "+"may host two levels for the reason commandbar/overflow does: a menu prints each row's own name, chord and gate, and draws a divider where the level changes. The rail's PINNED groups stay single-level, in PANEL_PLACEMENT_MATRIX"},palette:{admits:["application","project","document","selection"],note:"the level-agnostic surface; it groups rows by level"},never:{admits:["application","project","document","selection"],note:"keyboard- and API-only; no rendered surface to be misplaced in"}},b=["rail/project","rail/document","navigator","inspector","dock.bottom"],x={"rail/project":{admits:["project"],note:"the rail's upper group — Site, and Files with the developer panels on"},"rail/document":{admits:["document"],note:"the rail's lower group — Outline, Data, and Packages with the developer panels on"},navigator:{admits:["project","document"],note:"whichever level the hosted panel declares; the panel header prints it"},inspector:{admits:["document","selection"],note:"Page is the open document's tab, Element the selection's (§6)"},"dock.bottom":{admits:["project","document"],note:"the panel header states which"}};function y(e){return e==="bottom"?"dock.bottom":e}function w(e){let t=[y(e.dock)];if(e.rail!==!1)t.push(`rail/${e.level}`);return t}function E(e){return b.some((t)=>t===e)}function c(e){let t=[];if(!d(e.level))return t.push({panelId:e.id,placement:"—",level:String(e.level),message:`declares unknown level "${String(e.level)}" (expected one of: ${Wb.join(", ")})`}),t;for(let n of w(e)){if(!E(n)){t.push({panelId:e.id,placement:n,level:e.level,message:`is level "${e.level}" and would render in "${n}", which is not a panel `+"placement — the rail has a group for project and one for document, and nothing else"});continue}let o=x[n];if(!o.admits.includes(e.level))t.push({panelId:e.id,placement:n,level:e.level,message:`is level "${e.level}" but "${n}" admits only ${o.admits.join(", ")} — ${o.note}`})}return t}function S(e){return v.some((t)=>t===e)}function d(e){return Wb.some((t)=>t===e)}function $A(e){let t=[];if(!d(e.level))return t.push({commandId:e.id,placement:"—",level:String(e.level),message:`declares unknown level "${String(e.level)}" (expected one of: ${Wb.join(", ")})`}),t;for(let n of e.menus??[]){if(!S(n)){t.push({commandId:e.id,placement:String(n),level:e.level,message:`declares unknown placement "${String(n)}"`});continue}let o=P[n];if(!o.admits.includes(e.level))t.push({commandId:e.id,placement:n,level:e.level,message:`is level "${e.level}" but "${n}" admits only ${o.admits.join(", ")} — ${o.note}`})}return t}var l="true",i=g({on:Eo(rt.developerPanels)===l});Bp((e)=>{if(e.includes(rt.developerPanels.key))i.on=Eo(rt.developerPanels)===l});function dC(){return i.on}function IA(e){i.on=e,xr(rt.developerPanels,e?l:"")}function th(){let e=bv();return e.project.open=C!==null,e.project.isMultilingual=(ln(C?.projectConfig??{}).i18n?.locales.length??0)>1,e.git.dirtyCount=u.git.status?.files.length??0,e.workspace.id=u.workspace,e.document.open=h.value!==null,e}var L=/^[a-z][\w-]*$/,a=new Map;function ei(e){if(!L.test(e.id))throw Error(`Panel id "${e.id}" is malformed — expected /^[a-z][\\w-]*$/, because the id is also `+`the region "navigator/panel:${e.id}" and the value view.setActivity accepts.`);if(a.has(e.id))throw Error(`Panel "${e.id}" is already registered — a second definition site is the defect this `+"registry exists to prevent.");let t=c({id:e.id,level:e.level,dock:e.dock,rail:e.rail});if(t.length>0){let n=t.map((o)=>` ✗ ${e.id} ${o.message}`).join(`
2
2
  `);throw Error(`Panel "${e.id}" violates the level × placement matrix:
3
- ${n}`)}if(e.railLabel!==void 0&&(e.railLabel.trim()===""||!e.title.startsWith(e.railLabel)))throw Error(`Panel "${e.id}" declares railLabel "${e.railLabel}", which is not a leading part of its title "${e.title}": the rail button's accessible name is the title, and the words on screen must be inside it (WCAG 2.5.3, Label in Name).`);a.set(e.id,e)}function Cp(e){return a.get(e)}function Mw(e){let t=[...a.values()];return e?t.filter((n)=>n.dock===e):t}function Pw(e,t){return e.when?e.when(t):!0}var m=[{level:"project",label:"Project"},{level:"document",label:"Document"}];function p(){return Mw().filter((e)=>e.rail!==!1)}function XT(e){let t=CS(),n=p().filter((o)=>o.rail!=="developer"||t);return m.flatMap(({level:o,label:f})=>{let r=n.filter((s)=>s.level===o&&Pw(s,e));return r.length>0?[{level:o,label:f,panels:r}]:[]})}function _N(){let e=p();return m.flatMap(({level:t})=>e.filter((n)=>n.level===t))}
4
- export{Tb,vN,yN,wN,CS,xN,Gu,Xn,Cp,Mw,Pw,XT,_N};
3
+ ${n}`)}if(e.railLabel!==void 0&&(e.railLabel.trim()===""||!e.title.startsWith(e.railLabel)))throw Error(`Panel "${e.id}" declares railLabel "${e.railLabel}", which is not a leading part of its title "${e.title}": the rail button's accessible name is the title, and the words on screen must be inside it (WCAG 2.5.3, Label in Name).`);a.set(e.id,e)}function Np(e){return a.get(e)}function rx(e){let t=[...a.values()];return e?t.filter((n)=>n.dock===e):t}function sx(e,t){return e.when?e.when(t):!0}var m=[{level:"project",label:"Project"},{level:"document",label:"Document"}];function p(){return rx().filter((e)=>e.rail!==!1)}function VL(e){let t=dC(),n=p().filter((o)=>o.rail!=="developer"||t);return m.flatMap(({level:o,label:f})=>{let r=n.filter((s)=>s.level===o&&sx(s,e));return r.length>0?[{level:o,label:f,panels:r}]:[]})}function RA(){let e=p();return m.flatMap(({level:t})=>e.filter((n)=>n.level===t))}
4
+ export{Wb,TA,LA,$A,dC,IA,th,ei,Np,rx,sx,VL,RA};
5
5
 
6
- //# debugId=A28862769A5B9E6064756E2164756E21
7
- //# sourceMappingURL=studio-86r8hp7r.js.map
6
+ //# debugId=3270154FC82E0DFB64756E2164756E21
7
+ //# sourceMappingURL=studio-3q7mhbgx.js.map
@@ -0,0 +1,4 @@
1
+ function Y(e){let t=Object.create(null);for(let n of e.split(","))t[n]=1;return(n)=>(n in t)}var V=Object.assign;var Ve=Object.prototype.hasOwnProperty,F=(e,t)=>Ve.call(e,t),A=Array.isArray,C=(e)=>pe(e)==="[object Map]";var ue=(e)=>typeof e==="function",Fe=(e)=>typeof e==="string",R=(e)=>typeof e==="symbol",x=(e)=>e!==null&&typeof e==="object";var je=Object.prototype.toString,pe=(e)=>je.call(e),he=(e)=>pe(e).slice(8,-1);var j=(e)=>Fe(e)&&e!=="NaN"&&e[0]!=="-"&&""+parseInt(e,10)===e;var H=(e)=>{let t=Object.create(null);return(n)=>t[n]||(t[n]=e(n))},He=/-\w/g,rt=H((e)=>e.replace(He,(t)=>t.slice(1).toUpperCase())),Ue=/\B([A-Z])/g,st=H((e)=>e.replace(Ue,"-$1").toLowerCase()),de=H((e)=>e.charAt(0).toUpperCase()+e.slice(1)),ot=H((e)=>e?`on${de(e)}`:""),E=(e,t)=>!Object.is(e,t);var Ke="itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,playsinline,readonly";var at=Y(Ke+",async,autofocus,autoplay,controls,default,defer,disabled,inert,loop,open,required,reversed,scoped,seamless,checked,muted,multiple,selected");var h;class ye{constructor(e=!1){if(this.detached=e,this._active=!0,this._on=0,this.effects=[],this.cleanups=[],this._isPaused=!1,this._warnOnRun=!0,this.__v_skip=!0,!e&&h)if(h.active)this.parent=h,this.index=(h.scopes||(h.scopes=[])).push(this)-1;else this._active=!1,this._warnOnRun=!1}get active(){return this._active}pause(){if(this._active){this._isPaused=!0;let e,t;if(this.scopes){let n=this.scopes.slice();for(e=0,t=n.length;e<t;e++)n[e].pause()}for(e=0,t=this.effects.length;e<t;e++)this.effects[e].pause()}}resume(){if(this._active){if(this._isPaused){this._isPaused=!1;let e,t;if(this.scopes){let r=this.scopes.slice();for(e=0,t=r.length;e<t;e++)r[e].resume()}let n=this.effects.slice();for(e=0,t=n.length;e<t;e++)n[e].resume()}}}run(e){if(this._active){let t=h;try{return h=this,e()}finally{h=t}}}on(){if(++this._on===1)this.prevScope=h,h=this}off(){if(this._on>0&&--this._on===0){if(h===this)h=this.prevScope;else{let e=h;while(e){if(e.prevScope===this){e.prevScope=this.prevScope;break}e=e.prevScope}}this.prevScope=void 0}}stop(e){if(this._active){this._active=!1;let t,n;for(t=0,n=this.effects.length;t<n;t++)this.effects[t].stop();this.effects.length=0;for(t=0,n=this.cleanups.length;t<n;t++)this.cleanups[t]();if(this.cleanups.length=0,this.scopes){let r=this.scopes.slice();for(t=0,n=r.length;t<n;t++)r[t].stop(!0);this.scopes.length=0}if(!this.detached&&this.parent&&!e){let r=this.parent.scopes.pop();if(r&&r!==this)this.parent.scopes[this.index]=r,r.index=this.index}this.parent=void 0}}}function me(e){return new ye(e)}function ia(e,t=!1){if(h)h.cleanups.push(e)}var f;var B=new WeakSet;class z{constructor(e){if(this.fn=e,this.deps=void 0,this.depsTail=void 0,this.flags=5,this.next=void 0,this.cleanup=void 0,this.scheduler=void 0,h)if(h.active)h.effects.push(this);else this.flags&=-2}pause(){this.flags|=64}resume(){if(this.flags&64){if(this.flags&=-65,B.has(this))B.delete(this),this.trigger()}}notify(){if(this.flags&2&&!(this.flags&32))return;if(!(this.flags&8))be(this)}run(){if(!(this.flags&1))return this.fn();this.flags|=2,ge(this),Se(this);let e=f,t=m;f=this,m=!0;try{return this.fn()}finally{we(this),f=e,m=t,this.flags&=-3}}stop(){if(this.flags&1){for(let e=this.deps;e;e=e.nextDep)re(e);this.deps=this.depsTail=void 0,ge(this),this.onStop&&this.onStop(),this.flags&=-2}}trigger(){if(this.flags&64)B.add(this);else if(this.scheduler)this.scheduler();else this.runIfDirty()}runIfDirty(){if(J(this))this.run()}get dirty(){return J(this)}}var Ee=0,I,L;function be(e,t=!1){if(e.flags|=8,t){e.next=L,L=e;return}e.next=I,I=e}function ne(){Ee++}function ie(){if(--Ee>0)return;if(L){let t=L;L=void 0;while(t){let n=t.next;t.next=void 0,t.flags&=-9,t=n}}let e;while(I){let t=I;I=void 0;while(t){let n=t.next;if(t.next=void 0,t.flags&=-9,t.flags&1)try{t.trigger()}catch(r){if(!e)e=r}t=n}}if(e)throw e}function Se(e){for(let t=e.deps;t;t=t.nextDep)t.version=-1,t.prevActiveLink=t.dep.activeLink,t.dep.activeLink=t}function we(e){let t,n=e.depsTail,r=n;while(r){let i=r.prevDep;if(r.version===-1){if(r===n)n=i;re(r),ze(r)}else t=r;r.dep.activeLink=r.prevActiveLink,r.prevActiveLink=void 0,r=i}e.deps=t,e.depsTail=n}function J(e){for(let t=e.deps;t;t=t.nextDep)if(t.dep.version!==t.version||t.dep.computed&&(Te(t.dep.computed)||t.dep.version!==t.version))return!0;if(e._dirty)return!0;return!1}function Te(e){if(e.flags&4&&!(e.flags&16))return;if(e.flags&=-17,e.globalVersion===M)return;if(e.globalVersion=M,!e.isSSR&&e.flags&128&&(!e.deps&&!e._dirty||!J(e)))return;e.flags|=2;let t=e.dep,n=f,r=m;f=e,m=!0;try{Se(e);let i=e.fn(e._value);if(t.version===0||E(i,e._value))e.flags|=128,e._value=i,t.version++}catch(i){throw t.version++,i}finally{f=n,m=r,we(e),e.flags&=-3}}function re(e,t=!1){let{dep:n,prevSub:r,nextSub:i}=e;if(r)r.nextSub=i,e.prevSub=void 0;if(i)i.prevSub=r,e.nextSub=void 0;if(n.subs===e){if(n.subs=r,!r&&n.computed){n.computed.flags&=-5;for(let s=n.computed.deps;s;s=s.nextDep)re(s,!0)}}if(!t&&!--n.sc&&n.map)n.map.delete(n.key)}function ze(e){let{prevDep:t,nextDep:n}=e;if(t)t.nextDep=n,e.prevDep=void 0;if(n)n.prevDep=t,e.nextDep=void 0}function te(e,t){if(e.effect instanceof z)e=e.effect.fn;let n=new z(e);if(t)V(n,t);try{n.run()}catch(i){throw n.stop(),i}let r=n.run.bind(n);return r.effect=n,r}var m=!0,Ne=[];function Gr(){Ne.push(m),m=!1}function Kr(){let e=Ne.pop();m=e===void 0?!0:e}function y1(e,t=!1){if(f instanceof z)f.cleanup=e}function ge(e){let{cleanup:t}=e;if(e.cleanup=void 0,t){let n=f;f=void 0;try{t()}finally{f=n}}}var M=0;class Oe{constructor(e,t){this.sub=e,this.dep=t,this.version=t.version,this.nextDep=this.prevDep=this.nextSub=this.prevSub=this.prevActiveLink=void 0}}class G{constructor(e){this.computed=e,this.version=0,this.activeLink=void 0,this.subs=void 0,this.map=void 0,this.key=void 0,this.sc=0,this.__v_skip=!0}track(e){if(!f||!m||f===this.computed)return;let t=this.activeLink;if(t===void 0||t.sub!==f){if(t=this.activeLink=new Oe(f,this),!f.deps)f.deps=f.depsTail=t;else t.prevDep=f.depsTail,f.depsTail.nextDep=t,f.depsTail=t;Ae(t)}else if(t.version===-1){if(t.version=this.version,t.nextDep){let n=t.nextDep;if(n.prevDep=t.prevDep,t.prevDep)t.prevDep.nextDep=n;if(t.prevDep=f.depsTail,t.nextDep=void 0,f.depsTail.nextDep=t,f.depsTail=t,f.deps===t)f.deps=n}}return t}trigger(e){this.version++,M++,this.notify(e)}notify(e){ne();try{for(let t=this.subs;t;t=t.prevSub)if(t.sub.notify())t.sub.dep.notify()}finally{ie()}}}function Ae(e){if(e.dep.sc++,e.sub.flags&4){let t=e.dep.computed;if(t&&!e.dep.subs){t.flags|=20;for(let r=t.deps;r;r=r.nextDep)Ae(r)}let n=e.dep.subs;if(n!==e){if(e.prevSub=n,n)n.nextSub=e}e.dep.subs=e}}var Z=new WeakMap,N=Symbol(""),Q=Symbol(""),P=Symbol("");function d(e,t,n){if(m&&f){let r=Z.get(e);if(!r)Z.set(e,r=new Map);let i=r.get(n);if(!i)r.set(n,i=new G),i.map=r,i.key=n;i.track()}}function w(e,t,n,r,i,s){let o=Z.get(e);if(!o){M++;return}let a=(c)=>{if(c)c.trigger()};if(ne(),t==="clear")o.forEach(a);else{let c=A(e),l=c&&j(n);if(c&&n==="length"){let u=Number(r);o.forEach((p,_)=>{if(_==="length"||_===P||!R(_)&&_>=u)a(p)})}else{if(n!==void 0||o.has(void 0))a(o.get(n));if(l)a(o.get(P));switch(t){case"add":if(!c){if(a(o.get(N)),C(e))a(o.get(Q))}else if(l)a(o.get("length"));break;case"delete":if(!c){if(a(o.get(N)),C(e))a(o.get(Q))}break;case"set":if(C(e))a(o.get(N));break}}}ie()}function D(e){let t=le(e);if(t===e)return t;if(d(t,"iterate",P),T(e))return t;if(!S(e))return t.map(y);return Vv(e)?t.map((n)=>O(y(n))):t.map(O)}function se(e){return d(e=le(e),"iterate",P),e}function v(e,t){if(S(e))return Vv(e)?O(y(t)):O(t);return y(t)}var We={__proto__:null,[Symbol.iterator](){return q(this,Symbol.iterator,(e)=>v(this,e))},concat(...e){return D(this).concat(...e.map((t)=>A(t)?D(t):t))},entries(){return q(this,"entries",(e)=>(e[1]=v(this,e[1]),e))},every(e,t){return b(this,"every",e,t,void 0,arguments)},filter(e,t){return b(this,"filter",e,t,(n)=>n.map((r)=>v(this,r)),arguments)},find(e,t){return b(this,"find",e,t,(n)=>v(this,n),arguments)},findIndex(e,t){return b(this,"findIndex",e,t,void 0,arguments)},findLast(e,t){return b(this,"findLast",e,t,(n)=>v(this,n),arguments)},findLastIndex(e,t){return b(this,"findLastIndex",e,t,void 0,arguments)},forEach(e,t){return b(this,"forEach",e,t,void 0,arguments)},includes(...e){return X(this,"includes",e)},indexOf(...e){return X(this,"indexOf",e)},join(e){return D(this).join(e)},lastIndexOf(...e){return X(this,"lastIndexOf",e)},map(e,t){return b(this,"map",e,t,void 0,arguments)},pop(){return k(this,"pop")},push(...e){return k(this,"push",e)},reduce(e,...t){return ve(this,"reduce",e,t)},reduceRight(e,...t){return ve(this,"reduceRight",e,t)},shift(){return k(this,"shift")},some(e,t){return b(this,"some",e,t,void 0,arguments)},splice(...e){return k(this,"splice",e)},toReversed(){return D(this).toReversed()},toSorted(e){return D(this).toSorted(e)},toSpliced(...e){return D(this).toSpliced(...e)},unshift(...e){return k(this,"unshift",e)},values(){return q(this,"values",(e)=>v(this,e))}};function q(e,t,n){let r=se(e),i=r[t],s=i.call(r);if(r!==e&&!T(e)){if(s[Symbol.toStringTag]==="Array Iterator"){let o=Object.create(Object.getPrototypeOf(s));if(o.next=()=>_e(s.next(),n),i!==Re[t])Object.defineProperties(o,{return:{get(){let a=s.return;return typeof a==="function"?a.bind(s):a}},throw:{get(){let a=s.throw;return typeof a==="function"?a.bind(s):a}}});return o}s._next=s.next,s.next=()=>_e(s._next(),n)}return s}function _e(e,t){if(!e.done)e.value=t(e.value);return e}var Re=Array.prototype;function b(e,t,n,r,i,s){let o=se(e),a=o!==e&&!T(e),c=o[t];if(c!==Re[t]){let p=c.apply(e,s);return a?y(p):p}let l=n;if(o!==e){if(a)l=function(p,_){return n.call(this,v(e,p),_,e)};else if(n.length>2)l=function(p,_){return n.call(this,p,_,e)}}let u=c.call(o,l,r);return a&&i?i(u):u}function ve(e,t,n,r){let i=se(e),s=i!==e&&!T(e),o=n,a=!1;if(i!==e){if(s)a=r.length===0,o=function(l,u,p){if(a)a=!1,l=v(e,l);return n.call(this,l,v(e,u),p,e)};else if(n.length>3)o=function(l,u,p){return n.call(this,l,u,p,e)}}let c=i[t](o,...r);return a?v(e,c):c}function X(e,t,n){let r=le(e);d(r,"iterate",P);let i=r[t](...n);if((i===-1||i===!1)&&it(n[0]))return n[0]=le(n[0]),r[t](...n);return i}function k(e,t,n=[]){Gr(),ne();let r=le(e)[t].apply(e,n);return ie(),Kr(),r}var Ge=Y("__proto__,__v_isRef,__isVue"),xe=new Set(Object.getOwnPropertyNames(Symbol).filter((e)=>e!=="arguments"&&e!=="caller").map((e)=>Symbol[e]).filter(R));function Ye(e){if(!R(e))e=String(e);let t=le(this);return d(t,"has",e),t.hasOwnProperty(e)}class oe{constructor(e=!1,t=!1){this._isReadonly=e,this._isShallow=t}get(e,t,n){if(t==="__v_skip")return e.__v_skip;let r=this._isReadonly,i=this._isShallow;if(t==="__v_isReactive")return!r;else if(t==="__v_isReadonly")return r;else if(t==="__v_isShallow")return i;else if(t==="__v_raw"){if(n===(r?i?tt:Ie:i?ke:Ce).get(e)||Object.getPrototypeOf(e)===Object.getPrototypeOf(n))return e;return}let s=A(e);if(!r){let a;if(s&&(a=We[t]))return a;if(t==="hasOwnProperty")return Ye}let o=Reflect.get(e,t,Oh(e)?e:n);if(R(t)?xe.has(t):Ge(t))return o;if(!r)d(e,"get",t);if(i)return o;if(Oh(o)){let a=s&&j(t)?o:o.value;return r&&x(a)?W(a):a}if(x(o))return r?W(o):g(o);return o}}class ae extends oe{constructor(e=!1){super(!1,e)}set(e,t,n,r){let i=e[t],s=A(e)&&j(t);if(!this._isShallow){let c=S(i);if(!T(n)&&!S(n))i=le(i),n=le(n);if(!s&&Oh(i)&&!Oh(n))if(c)return!0;else return i.value=n,!0}let o=s?Number(t)<e.length:F(e,t),a=Reflect.set(e,t,n,Oh(e)?e:r);if(e===le(r)&&a){if(!o)w(e,"add",t,n);else if(E(n,i))w(e,"set",t,n,i)}return a}deleteProperty(e,t){let n=F(e,t),r=e[t],i=Reflect.deleteProperty(e,t);if(i&&n)w(e,"delete",t,void 0,r);return i}has(e,t){let n=Reflect.has(e,t);if(!R(t)||!xe.has(t))d(e,"has",t);return n}ownKeys(e){return d(e,"iterate",A(e)?"length":N),Reflect.ownKeys(e)}}class De extends oe{constructor(e=!1){super(!0,e)}set(e,t){return!0}deleteProperty(e,t){return!0}}var Be=new ae,$e=new De,qe=new ae(!0);var ee=(e)=>e,U=(e)=>Reflect.getPrototypeOf(e);function Xe(e,t,n){return function(...r){let i=this.__v_raw,s=le(i),o=C(s),a=e==="entries"||e===Symbol.iterator&&o,c=e==="keys"&&o,l=i[e](...r),u=n?ee:t?O:y;return!t&&d(s,"iterate",c?Q:N),V(Object.create(l),{next(){let{value:p,done:_}=l.next();return _?{value:p,done:_}:{value:a?[u(p[0]),u(p[1])]:u(p),done:_}}})}}function K(e){return function(...t){return e==="delete"?!1:e==="clear"?void 0:this}}function Je(e,t){let n={get(i){let s=this.__v_raw,o=le(s),a=le(i);if(!e){if(E(i,a))d(o,"get",i);d(o,"get",a)}let{has:c}=U(o),l=t?ee:e?O:y;if(c.call(o,i))return l(s.get(i));else if(c.call(o,a))return l(s.get(a));else if(s!==o)s.get(i)},get size(){let i=this.__v_raw;return!e&&d(le(i),"iterate",N),i.size},has(i){let s=this.__v_raw,o=le(s),a=le(i);if(!e){if(E(i,a))d(o,"has",i);d(o,"has",a)}return i===a?s.has(i):s.has(i)||s.has(a)},forEach(i,s){let o=this,a=o.__v_raw,c=le(a),l=t?ee:e?O:y;return!e&&d(c,"iterate",N),a.forEach((u,p)=>i.call(s,l(u),l(p),o))}};return V(n,e?{add:K("add"),set:K("set"),delete:K("delete"),clear:K("clear")}:{add(i){let s=le(this),o=U(s),a=le(i),c=!t&&!T(i)&&!S(i)?a:i;if(!(o.has.call(s,c)||E(i,c)&&o.has.call(s,i)||E(a,c)&&o.has.call(s,a)))s.add(c),w(s,"add",c,c);return this},set(i,s){if(!t&&!T(s)&&!S(s))s=le(s);let o=le(this),{has:a,get:c}=U(o),l=a.call(o,i);if(!l)i=le(i),l=a.call(o,i);let u=c.call(o,i);if(o.set(i,s),!l)w(o,"add",i,s);else if(E(s,u))w(o,"set",i,s,u);return this},delete(i){let s=le(this),{has:o,get:a}=U(s),c=o.call(s,i);if(!c)i=le(i),c=o.call(s,i);let l=a?a.call(s,i):void 0,u=s.delete(i);if(c)w(s,"delete",i,void 0,l);return u},clear(){let i=le(this),s=i.size!==0,o=void 0,a=i.clear();if(s)w(i,"clear",void 0,void 0,void 0);return a}}),["keys","values","entries",Symbol.iterator].forEach((i)=>{n[i]=Xe(i,e,t)}),n}function ce(e,t){let n=Je(e,t);return(r,i,s)=>{if(i==="__v_isReactive")return!e;else if(i==="__v_isReadonly")return e;else if(i==="__v_isShallow")return t;else if(i==="__v_raw")return r;return Reflect.get(F(n,i)&&i in r?n:r,i,s)}}var Ze={get:ce(!1,!1)},Qe={get:ce(!1,!0)},et={get:ce(!0,!1)};var Ce=new WeakMap,ke=new WeakMap,Ie=new WeakMap,tt=new WeakMap;function nt(e){switch(e){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function g(e){if(S(e))return e;return fe(e,!1,Be,Ze,Ce)}function Wv(e){return fe(e,!1,qe,Qe,ke)}function W(e){return fe(e,!0,$e,et,Ie)}function fe(e,t,n,r,i){if(!x(e))return e;if(e.__v_raw&&!(t&&e.__v_isReactive))return e;if(e.__v_skip||!Object.isExtensible(e))return e;let s=i.get(e);if(s)return s;let o=nt(he(e));if(o===0)return e;let a=new Proxy(e,o===2?r:n);return i.set(e,a),a}function Vv(e){if(S(e))return Vv(e.__v_raw);return!!(e&&e.__v_isReactive)}function S(e){return!!(e&&e.__v_isReadonly)}function T(e){return!!(e&&e.__v_isShallow)}function it(e){return e?!!e.__v_raw:!1}function le(e){let t=e&&e.__v_raw;return t?le(t):e}var y=(e)=>x(e)?g(e):e,O=(e)=>x(e)?W(e):e;function Oh(e){return e?e.__v_isRef===!0:!1}function Mh(e){return Le(e,!1)}function ja(e){return Le(e,!0)}function Le(e,t){if(Oh(e))return e;return new Me(e,t)}class Me{constructor(e,t){this.dep=new G,this.__v_isRef=!0,this.__v_isShallow=!1,this._rawValue=t?e:le(e),this._value=t?e:y(e),this.__v_isShallow=t}get value(){return this.dep.track(),this._value}set value(e){let t=this._rawValue,n=this.__v_isShallow||T(e)||S(e);if(e=n?e:le(e),E(e,t))this._rawValue=e,this._value=n?e:y(e),this.dep.trigger()}}class Pe{constructor(e,t,n){this.fn=e,this.setter=t,this._value=void 0,this.dep=new G(this),this.__v_isRef=!0,this.deps=void 0,this.depsTail=void 0,this.flags=16,this.globalVersion=M-1,this.next=void 0,this.effect=this,this.__v_isReadonly=!t,this.isSSR=n}notify(){if(this.flags|=16,!(this.flags&8)&&f!==this)return be(this,!0),!0}get value(){let e=this.dep.track();if(Te(this),e)e.version=this.dep.version;return this._value}set value(e){if(this.setter)this.setter(e)}}function Ph(e,t,n=!1){let r,i;if(ue(e))r=e;else r=e.get,i=e.set;return new Pe(r,i,n)}export{me,ia,te,Gr,Kr,y1,g,Wv,Vv,le,Oh,Mh,ja,Ph};
2
+
3
+ //# debugId=69C4DF0D8FE8976A64756E2164756E21
4
+ //# sourceMappingURL=studio-3qr08sxq.js.map
@@ -0,0 +1,5 @@
1
+ import{X}from"./studio-9c6cbq2c.js";import{Oe,ir,Yd,h}from"./studio-yrcrncev.js";import{w}from"./studio-sce30r7b.js";import{p}from"./studio-4fnb5648.js";import{Ne,Ea,qc}from"./studio-n9qba0gx.js";import{Fn}from"./studio-tpxcryf2.js";import{Sw,Cb}from"./studio-321ym1tt.js";import{VS}from"./studio-thz5t120.js";import{Co}from"./studio-x0gsfr1d.js";import{Vt,zi}from"./studio-4f7thq0p.js";import{oe}from"./studio-v5wktj6f.js";import{_,it}from"./studio-k3we3kqb.js";function aw(){let t=h.value,e=Oe(t?.session.selection);if(!t||!e||e.length<2)return null;let o=oe(t.doc.document,e);if(!o||!o.tagName)return null;return{node:o,path:e}}async function dm(){let t=aw();if(!t)return;let e=await b(g(t.node));if(!e)return;await kE(e.toLowerCase())}async function kE(t){let e=h.value,o=aw();if(!e||!o)return null;let{node:m,path:f}=o,l=v(m);l.tagName=t;let r=`components/${t}.json`,c=qc(e.documentPath,r),u=f;if(!Yd(e,(n)=>{let s=Vt(u)??[],d=zi(u),a=n;for(let i of s)a=a[i];if(!Array.isArray(a.children))a.children=[];if(a.children[d]={tagName:t},!n.$elements)n.$elements=[];if(!n.$elements.some((i)=>_(i)&&("$ref"in i)&&i.$ref===c))n.$elements.push({$ref:c})}))return null;try{await p().writeFile(r,Co(l,null)),await Ea();let s=VS(l);if(w.success(`Converted to <${t}>`),s)w.warn(`<${t}> has a slot problem: ${s}`,{path:r,source:"Components",tier:"problem"});return r}catch(n){return w.error(`Could not save the <${t}> component.`,{detail:X(n),path:r,source:"Components"}),null}}function g(t){if(t.$id){let o=Cb(t.$id);if(o!=="")return o}let e=(it(t.tagName)||"div").toLowerCase();return e.includes("-")?e:Cb(e)}function v(t){let e=ir(t);return delete e.$id,delete e.$layout,delete e.$paths,e}function N(t){let e=t.trim().toLowerCase(),o=Sw(e);if(o!=="")return o;return Ne.some((m)=>m.tagName===e)?`Component <${e}> already exists`:""}function b(t){return Fn("Convert to Component",{confirmLabel:"Convert",message:"Enter a hyphenated tag name for the new component.",placeholder:"my-component",validate:N,value:t})}
2
+ export{aw,dm,kE};
3
+
4
+ //# debugId=521446A2AAA2F22C64756E2164756E21
5
+ //# sourceMappingURL=studio-3xk9zdgb.js.map