@emailmaker/emailmaker 1.0.107-dev.3 → 1.0.107-dev.4

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 (325) hide show
  1. package/README.md +1 -1
  2. package/cli/dist/lib/cli/project.js +2 -16
  3. package/cli/dist/lib/config.js +20 -29
  4. package/cli/dist/lib/local-test.js +3 -19
  5. package/cli/dist/lib/paths.js +11 -0
  6. package/cli/dist/lib/resolveNpmSpawn.d.ts +20 -0
  7. package/cli/dist/lib/resolveNpmSpawn.js +71 -0
  8. package/cli/dist/lib/template-engine/context/pluginPackageJsonData.js +21 -19
  9. package/cli/dist/lib/template-engine/context/standVitePackageJsonData.js +7 -8
  10. package/cli/dist/lib/template-engine/resolveVariantDir.d.ts +5 -1
  11. package/cli/dist/lib/template-engine/resolveVariantDir.js +22 -0
  12. package/cli/dist/lib/templates/shared/i18n.js +2 -2
  13. package/cli/dist/lib/templates/shared/paths.js +3 -4
  14. package/cli/dist/lib/types/package-config.d.ts +1 -0
  15. package/cli/lib/cli/project.ts +2 -18
  16. package/cli/lib/config.ts +19 -30
  17. package/cli/lib/local-test.ts +3 -22
  18. package/cli/lib/paths.ts +15 -0
  19. package/cli/lib/resolveNpmSpawn.ts +72 -0
  20. package/cli/lib/template-engine/buildStandIndexHtml.test.ts +1 -0
  21. package/cli/lib/template-engine/context/pluginPackageJsonData.ts +23 -23
  22. package/cli/lib/template-engine/context/standVitePackageJsonData.ts +7 -12
  23. package/cli/lib/template-engine/pluginEtaParity.test.ts +1 -0
  24. package/cli/lib/template-engine/resolveVariantDir.ts +22 -0
  25. package/cli/lib/template-engine/standAdvancedViteDevHostEta.test.ts +4 -3
  26. package/cli/lib/template-engine/standWebpackDevHostEta.test.ts +7 -6
  27. package/cli/lib/templates/shared/i18n.ts +2 -2
  28. package/cli/lib/templates/shared/paths.ts +3 -4
  29. package/cli/lib/types/package-config.ts +1 -0
  30. package/cli/package.json +1 -1
  31. package/cli/project-templates/plugin/assets/vite/{plugin-build.config.mjs → plugin-build.config.ts} +7 -5
  32. package/cli/project-templates/plugin/assets/vite/{sandbox-build.config.mjs → sandbox-build.config.ts} +7 -5
  33. package/cli/project-templates/plugin/assets/webpack/{plugin-build.legacy.module.cjs → plugin-build.legacy.module.ts} +20 -7
  34. package/cli/project-templates/plugin/assets/webpack/{plugin-build.legacy.umd.cjs → plugin-build.legacy.umd.ts} +20 -7
  35. package/cli/project-templates/plugin/assets/webpack/{plugin-build.modern.module.cjs → plugin-build.modern.module.ts} +9 -4
  36. package/cli/project-templates/plugin/assets/webpack/{plugin-build.modern.umd.cjs → plugin-build.modern.umd.ts} +9 -4
  37. package/cli/project-templates/plugin/assets/webpack/{sandbox-build.config.cjs → sandbox-build.config.ts} +13 -3
  38. package/cli/project-templates/plugin/bundler-vite/release.html.eta +1 -0
  39. package/cli/project-templates/plugin/bundler-webpack/public/release.html.eta +1 -0
  40. package/cli/project-templates/plugin/shared-base/public/demo/product-1.svg +10 -0
  41. package/cli/project-templates/plugin/shared-base/public/demo/product-2.svg +10 -0
  42. package/cli/project-templates/plugin/shared-base/scripts/build-runner.ts +22 -0
  43. package/cli/project-templates/plugin/shared-base/scripts/build-types.ts +17 -0
  44. package/cli/project-templates/plugin/shared-base/scripts/clean.ts +16 -0
  45. package/cli/project-templates/plugin/shared-base/scripts/dev-runner.ts +52 -0
  46. package/cli/project-templates/plugin/shared-base/scripts/npmRun.ts +61 -0
  47. package/cli/project-templates/plugin/shared-base/scripts/release-runner.ts +18 -0
  48. package/cli/project-templates/plugin/shared-base/scripts/scriptRuntime.ts +10 -0
  49. package/cli/project-templates/plugin/shared-base/src/dev/hostApp.tsx.eta +1 -0
  50. package/cli/project-templates/plugin/shared-base/src/dev-release.tsx.eta +1 -0
  51. package/cli/project-templates/plugin/shared-base/src/dev.tsx.eta +1 -1
  52. package/cli/project-templates/shared/partials/plugin-dev-host-app-advanced.eta +93 -0
  53. package/cli/project-templates/shared/partials/plugin-dev-host-app-minimal.eta +54 -0
  54. package/cli/project-templates/shared/partials/plugin-dev-tsx-advanced.eta +3 -2
  55. package/cli/project-templates/shared/partials/plugin-dev-tsx-debug.eta +18 -0
  56. package/cli/project-templates/shared/partials/plugin-dev-tsx-release.eta +33 -0
  57. package/cli/project-templates/shared/partials/plugin-dev-tsx-runtime-helpers.eta +8 -8
  58. package/cli/project-templates/shared/partials/plugin-index-ts.eta +0 -1
  59. package/cli/project-templates/shared/partials/plugin-vite-dev-host.eta +9 -5
  60. package/cli/project-templates/shared/partials/plugin-vite-plugin-build.eta +7 -5
  61. package/cli/project-templates/shared/partials/plugin-vite-release-html.eta +12 -0
  62. package/cli/project-templates/shared/partials/plugin-vite-sandbox-build.eta +7 -5
  63. package/cli/project-templates/shared/partials/plugin-webpack-dev-host-legacy.eta +12 -5
  64. package/cli/project-templates/shared/partials/plugin-webpack-dev-host-modern.eta +13 -6
  65. package/cli/project-templates/shared/partials/plugin-webpack-release-html.eta +12 -0
  66. package/cli/project-templates/shared/partials/plugin-webpack-sandbox-build.eta +13 -3
  67. package/cli/project-templates/shared/partials/plugin-wp-legacy-module.eta +28 -10
  68. package/cli/project-templates/shared/partials/plugin-wp-legacy-umd.eta +28 -10
  69. package/cli/project-templates/shared/partials/plugin-wp-modern-module.eta +9 -4
  70. package/cli/project-templates/shared/partials/plugin-wp-modern-umd.eta +9 -4
  71. package/cli/project-templates/shared/partials/stand-dev-host-vite-memory.eta +3 -3
  72. package/cli/project-templates/shared/partials/stand-dev-host-vite-subpath.eta +8 -4
  73. package/cli/project-templates/shared/partials/stand-dev-host-vite-umd.eta +5 -5
  74. package/cli/project-templates/shared/partials/stand-dev-host-vite.eta +3 -3
  75. package/cli/project-templates/shared/partials/stand-dev-host-webpack-subpath.eta +8 -4
  76. package/cli/project-templates/shared/partials/stand-dev-host-webpack-umd.eta +9 -3
  77. package/cli/project-templates/shared/partials/stand-dev-host-webpack.eta +8 -4
  78. package/cli/project-templates/shared/partials/stand-dev-storage-middleware.eta +370 -0
  79. package/cli/project-templates/shared/stand-vite-base/config/lib/createViteStandConfig.ts +80 -0
  80. package/cli/project-templates/shared/stand-vite-base/scripts/devStorageMiddleware.ts.eta +1 -0
  81. package/cli/project-templates/shared/stand-webpack-base/config/lib/{createWebpackStandConfig.cjs → createWebpackStandConfig.ts} +31 -19
  82. package/cli/project-templates/{stand/advanced/umd/vite/config/lib/umdServeMiddleware.mjs → shared/stand-webpack-base/config/lib/umdServeMiddleware.ts} +19 -11
  83. package/cli/project-templates/shared/stand-webpack-base/scripts/devStorageMiddleware.ts.eta +1 -0
  84. package/cli/project-templates/stand/advanced/memory-usage/vite/config/lib/{createMemoryUsageStandConfig.mjs → createMemoryUsageStandConfig.ts} +25 -20
  85. package/cli/project-templates/stand/advanced/umd/vite/config/lib/umdServeMiddleware.ts +68 -0
  86. package/cli/project-templates/stand/react-adapter/webpack/README.md.eta +1 -0
  87. package/cli/project-templates/stand/react-adapter/webpack/config/dev-host.ts.eta +1 -0
  88. package/cli/project-templates/stand/react-adapter/webpack/package.json.eta +1 -0
  89. package/cli/project-templates/stand/react-adapter/webpack/public/index.html.eta +1 -0
  90. package/cli/project-templates/stand/react-adapter/webpack/src/dev/editorConfig.ts.eta +1 -0
  91. package/cli/project-templates/stand/react-adapter/webpack/src/dev/email.html.eta +1 -0
  92. package/cli/project-templates/stand/react-adapter/webpack/src/dev/getAuthToken.ts.eta +1 -0
  93. package/cli/project-templates/stand/react-adapter/webpack/src/dev/oauthCredentials.ts +9 -0
  94. package/cli/project-templates/stand/react-adapter/webpack/src/dev/storageProvider.ts.eta +1 -0
  95. package/cli/project-templates/stand/react-adapter/webpack/src/index.tsx.eta +1 -0
  96. package/cli/scripts/cli-matrix-smoke.ts +19 -10
  97. package/cli/scripts/verify-global-cli.ts +1 -1
  98. package/cli/scripts/vite-plugin-version-matrix.ts +299 -0
  99. package/cli/tsconfig.json +2 -2
  100. package/emailmaker-core.aa9efbce.js +1 -0
  101. package/emailmaker-esm.js +788 -153
  102. package/emailmaker.d.ts +32 -0
  103. package/emailmaker.js +4 -4
  104. package/iframe/js/amp.BGJMqoms.js +1 -1
  105. package/iframe/js/chunk.oX6nCJbK.js +1 -1
  106. package/iframe/js/iframe-eblock.js +1 -1
  107. package/iframe/js/iframe.js +1 -1
  108. package/iframe/js/rules.BSaCN7eK.js +1 -1
  109. package/iframe/js/sanitize-html.Dy7Uwo8P.js +1 -1
  110. package/images/integrations/activecampaign.svg +4 -0
  111. package/images/integrations/bento.svg +9 -0
  112. package/images/integrations/brevo.svg +7 -0
  113. package/images/integrations/campaign_monitor.svg +10 -0
  114. package/images/integrations/constant_contact.svg +24 -0
  115. package/images/integrations/dotdigital.svg +144 -0
  116. package/images/integrations/getresponse.svg +23 -0
  117. package/images/integrations/hubspot.svg +3 -0
  118. package/images/integrations/klaviyo.svg +10 -0
  119. package/images/integrations/mailchimp.svg +9 -0
  120. package/images/integrations/salesforce.svg +20 -0
  121. package/js/browser-image-compression.js +9 -0
  122. package/package.json +2 -5
  123. package/runtime/@ant-design/cssinjs/index.js +1 -1
  124. package/runtime/@ant-design/icons/index.js +1 -1
  125. package/runtime/@ant-design/pro-layout/index.js +1 -1
  126. package/runtime/README.md +13 -13
  127. package/runtime/antd/index.js +1 -1
  128. package/runtime/app-core/index.js +1 -2
  129. package/runtime/classnames/index.js +1 -1
  130. package/runtime/core/index.js +6 -6
  131. package/runtime/dayjs/index.js +1 -1
  132. package/runtime/di/index.js +1 -2
  133. package/runtime/disposable/index.js +1 -2
  134. package/runtime/errors-runtime/index.js +1 -2
  135. package/runtime/guid/index.js +1 -2
  136. package/runtime/index.js +2 -4
  137. package/runtime/package.json +2 -3
  138. package/runtime/prop-types/index.js +1 -1
  139. package/runtime/react/index.js +1 -1
  140. package/runtime/react/jsx-dev-runtime/index.js +1 -1
  141. package/runtime/react/jsx-runtime/index.js +1 -1
  142. package/runtime/react-dom/client/index.js +1 -1
  143. package/runtime/react-dom/index.js +1 -1
  144. package/runtime/react-router-dom/index.js +1 -1
  145. package/runtime/uuid/index.js +1 -1
  146. package/static/amd/{8fc2a596.js → 19aeb269.js} +88 -88
  147. package/static/core/192ec827.js +1 -0
  148. package/static/core/22c1de2e2.js +1 -0
  149. package/static/core/24faedf0.js +1 -0
  150. package/static/core/29231645.js +1 -0
  151. package/static/core/2a3177fc2.js +1 -0
  152. package/static/core/346aabd2.js +3 -0
  153. package/static/core/3b800ed6.js +1 -0
  154. package/static/core/3e840e90.js +1 -0
  155. package/static/core/40cc9fd7.js +1 -0
  156. package/static/core/421bdec22.js +1 -0
  157. package/static/core/4aaa358b2.js +903 -0
  158. package/static/core/50ff48bc.js +4 -0
  159. package/static/core/5282795d2.js +6 -0
  160. package/static/core/563a283d.js +1 -0
  161. package/static/core/5d47e095.js +47 -0
  162. package/static/core/5f574386.js +1 -0
  163. package/static/core/67a41193.js +1 -0
  164. package/static/core/698dace4.js +7 -0
  165. package/static/core/6b648e2d.js +1 -0
  166. package/static/core/7629adfd.js +1 -0
  167. package/static/core/7717f2932.js +3 -0
  168. package/static/core/776cb34a.js +1 -0
  169. package/static/core/78a1e31e.js +1 -0
  170. package/static/core/7d56d643.js +1 -0
  171. package/static/core/841752212.js +40 -0
  172. package/static/core/8477e97e.js +1 -0
  173. package/static/core/8756d562.js +1 -0
  174. package/static/core/91d328d8.js +1 -0
  175. package/static/core/9270dbb6.js +6 -0
  176. package/static/core/96371334.js +566 -0
  177. package/static/core/9b9ddaef2.js +168 -0
  178. package/static/core/af1da4b4.js +1 -0
  179. package/static/core/b5096b152.js +471 -0
  180. package/static/core/bde6775a.js +1 -0
  181. package/static/core/bf1b888c.js +4 -0
  182. package/static/core/cec8d739.js +11 -0
  183. package/static/core/cf45bf332.js +598 -0
  184. package/static/core/cfac3d32.js +1 -0
  185. package/static/core/d21c95cf2.js +1 -0
  186. package/static/core/dbd9ca52.js +1 -0
  187. package/static/core/dc590181.js +1 -0
  188. package/static/core/e0039d55.js +1 -0
  189. package/static/core/e4071c1a.js +4 -0
  190. package/static/core/ef87b75c.js +41 -0
  191. package/static/core/f47701f32.js +20 -0
  192. package/static/core/f83d7ac42.js +3 -0
  193. package/static/core/fcc67e6b.js +1 -0
  194. package/static/core/fd40d85c.js +1 -0
  195. package/static/core/fe638847.js +1 -0
  196. package/static/esm/{e8401d17.js → 203c9644.js} +3 -3
  197. package/static/esm/4b679053.js +27 -0
  198. package/static/esm/{b273a6c2.js → f31a26c6.js} +1 -1
  199. package/static/runtime/disposable-CD74igiJ.js +1 -0
  200. package/static/runtime/guid-C0wuVR8v.js +1 -0
  201. package/vite/index.d.ts +17 -6
  202. package/vite/index.js +315 -270
  203. package/vite/pluginDev/index.d.ts +10 -19
  204. package/vite/pluginDev/index.js +251 -204
  205. package/webpack/index.d.ts +24 -5
  206. package/webpack/index.js +168 -144
  207. package/webpack/pluginDev/index.d.ts +21 -22
  208. package/webpack/pluginDev/index.js +242 -177
  209. package/cli/dist/lib/template-engine/buildStandIndexHtml.test.d.ts +0 -2
  210. package/cli/dist/lib/template-engine/buildStandIndexHtml.test.js +0 -89
  211. package/cli/dist/lib/template-engine/emitEtaTree.test.d.ts +0 -2
  212. package/cli/dist/lib/template-engine/emitEtaTree.test.js +0 -34
  213. package/cli/dist/lib/template-engine/pluginEtaParity.test.d.ts +0 -2
  214. package/cli/dist/lib/template-engine/pluginEtaParity.test.js +0 -105
  215. package/cli/dist/lib/template-engine/resolveVariantDir.test.d.ts +0 -2
  216. package/cli/dist/lib/template-engine/resolveVariantDir.test.js +0 -52
  217. package/cli/dist/lib/template-engine/standAdvancedViteDevHostEta.test.d.ts +0 -2
  218. package/cli/dist/lib/template-engine/standAdvancedViteDevHostEta.test.js +0 -67
  219. package/cli/dist/lib/template-engine/standWebpackDevHostEta.test.d.ts +0 -2
  220. package/cli/dist/lib/template-engine/standWebpackDevHostEta.test.js +0 -83
  221. package/cli/dist/lib/template-engine/storageProviderEta.test.d.ts +0 -2
  222. package/cli/dist/lib/template-engine/storageProviderEta.test.js +0 -26
  223. package/cli/project-templates/plugin/shared-base/scripts/build-types.cjs +0 -8
  224. package/cli/project-templates/plugin/shared-base/scripts/clean.cjs +0 -6
  225. package/cli/project-templates/plugin/shared-base/scripts/dev-runner.cjs +0 -48
  226. package/cli/project-templates/plugin/shared-base/scripts/release-runner.cjs +0 -63
  227. package/cli/project-templates/shared/stand-vite-base/config/lib/createViteStandConfig.mjs +0 -80
  228. package/cli/project-templates/shared/stand-vite-base/scripts/devStorageMiddleware.cjs +0 -235
  229. package/cli/project-templates/shared/stand-webpack-base/config/lib/umdServeMiddleware.cjs +0 -38
  230. package/cli/project-templates/shared/stand-webpack-base/scripts/devStorageMiddleware.cjs +0 -235
  231. package/emailmaker-core.80d62b88.js +0 -569
  232. package/runtime/_core/app-core/index.js +0 -1
  233. package/runtime/_core/chunks/app-core-DphKKh8f.js +0 -1
  234. package/runtime/_core/chunks/chunk-oqAt0Dze.js +0 -1
  235. package/runtime/_core/chunks/di-BHUzE57z.js +0 -1
  236. package/runtime/_core/chunks/disposable-PhM3rJkj.js +0 -1
  237. package/runtime/_core/chunks/errors-runtime-VjCOXaQX.js +0 -1
  238. package/runtime/_core/chunks/guid-D2-FTZQG.js +0 -1
  239. package/runtime/_core/di/index.js +0 -1
  240. package/runtime/_core/disposable/index.js +0 -1
  241. package/runtime/_core/errors-runtime/index.js +0 -1
  242. package/runtime/_core/guid/index.js +0 -1
  243. package/runtime/_core/index.js +0 -1
  244. package/shared/hostBootstrap.js +0 -47
  245. package/shared/pluginDevOptions.js +0 -31
  246. package/shared/runtimeManifest.js +0 -72
  247. package/shared/stringCase.js +0 -16
  248. package/static/core/2360f32a.js +0 -3
  249. package/static/core/2687db56.js +0 -3
  250. package/static/core/2b250af6.js +0 -1261
  251. package/static/core/3469930c.js +0 -302
  252. package/static/core/34ce9042.js +0 -201
  253. package/static/core/4091ba5b.js +0 -25
  254. package/static/core/41ce3a6a.js +0 -173
  255. package/static/core/4ac4908c.js +0 -2213
  256. package/static/core/519096c1.js +0 -2597
  257. package/static/core/5fa1772b.js +0 -116550
  258. package/static/core/61312909.js +0 -3
  259. package/static/core/62a98c07.js +0 -75301
  260. package/static/core/6309c0f2.js +0 -3
  261. package/static/core/68d9f440.js +0 -3
  262. package/static/core/73b645ab.js +0 -2
  263. package/static/core/81019351.js +0 -280
  264. package/static/core/835b37ef.js +0 -591
  265. package/static/core/91242fb3.js +0 -3
  266. package/static/core/972b15b0.js +0 -92399
  267. package/static/core/974ef468.js +0 -493
  268. package/static/core/a17614422.js +0 -38078
  269. package/static/core/a2fa7b5b.js +0 -4232
  270. package/static/core/a513adfd.js +0 -89857
  271. package/static/core/a7c73a9b.js +0 -3813
  272. package/static/core/b64c7c90.js +0 -228
  273. package/static/core/cdc9ba92.js +0 -4711
  274. package/static/core/d1db685d.js +0 -2193
  275. package/static/core/d661febc.js +0 -3
  276. package/static/core/d6d2d2d0.js +0 -23
  277. package/static/core/df1a1225.js +0 -607
  278. package/static/core/e5bff179.js +0 -1302
  279. package/static/core/e5d602f5.js +0 -2
  280. package/static/core/eb029366.js +0 -1532
  281. package/static/core/f46c035a.js +0 -2
  282. package/static/core/f8b9d89a.js +0 -461
  283. package/static/core/fd897ad7.js +0 -3
  284. package/static/core/fdd890c7.js +0 -6168
  285. package/static/esm/29eb18ff.js +0 -164
  286. package/vite/mime-types.js +0 -179
  287. package/vite/utils.js +0 -44
  288. /package/cli/project-templates/plugin/bundler-vite/config/{dev-host.mjs.eta → dev-host.ts.eta} +0 -0
  289. /package/cli/project-templates/plugin/bundler-vite/config/{plugin-build.mjs.eta → plugin-build.ts.eta} +0 -0
  290. /package/cli/project-templates/plugin/bundler-vite/config/{sandbox-build.mjs.eta → sandbox-build.ts.eta} +0 -0
  291. /package/cli/project-templates/plugin/bundler-webpack/config/{dev-host.cjs.eta → dev-host.ts.eta} +0 -0
  292. /package/cli/project-templates/plugin/bundler-webpack/config/{plugin-build.cjs.eta → plugin-build.ts.eta} +0 -0
  293. /package/cli/project-templates/plugin/bundler-webpack/config/{sandbox-build.cjs.eta → sandbox-build.ts.eta} +0 -0
  294. /package/cli/project-templates/stand/advanced/memory-usage/vite/config/{dev-host.mjs.eta → dev-host.ts.eta} +0 -0
  295. /package/cli/project-templates/stand/advanced/shadow-dom/vite/config/{dev-host.mjs.eta → dev-host.ts.eta} +0 -0
  296. /package/cli/project-templates/stand/advanced/shadow-dom/webpack/config/{dev-host.cjs.eta → dev-host.ts.eta} +0 -0
  297. /package/cli/project-templates/stand/advanced/subpath/vite/config/{dev-host.mjs.eta → dev-host.ts.eta} +0 -0
  298. /package/cli/project-templates/stand/advanced/subpath/webpack/config/{dev-host.cjs.eta → dev-host.ts.eta} +0 -0
  299. /package/cli/project-templates/stand/advanced/umd/vite/config/{dev-host.mjs.eta → dev-host.ts.eta} +0 -0
  300. /package/cli/project-templates/stand/advanced/umd/webpack/config/{dev-host.cjs.eta → dev-host.ts.eta} +0 -0
  301. /package/cli/project-templates/stand/closed-loop/vite/config/{dev-host.mjs.eta → dev-host.ts.eta} +0 -0
  302. /package/cli/project-templates/stand/closed-loop/webpack/config/{dev-host.cjs.eta → dev-host.ts.eta} +0 -0
  303. /package/cli/project-templates/stand/oauth/vite/config/{dev-host.mjs.eta → dev-host.ts.eta} +0 -0
  304. /package/cli/project-templates/stand/oauth/webpack/config/{dev-host.cjs.eta → dev-host.ts.eta} +0 -0
  305. /package/cli/project-templates/stand/react-adapter/vite/config/{dev-host.mjs.eta → dev-host.ts.eta} +0 -0
  306. /package/iframe/{iframe-eblock.80d62b88.html → iframe-eblock.aa9efbce.html} +0 -0
  307. /package/iframe/{iframe.80d62b88.html → iframe.aa9efbce.html} +0 -0
  308. /package/{runtime/chunks → static/runtime}/DownloadOutlined-a2ZUz7zB.js +0 -0
  309. /package/{runtime/chunks → static/runtime}/chunk-D-iEO58U.js +0 -0
  310. /package/{runtime/chunks → static/runtime}/classnames-DBEldvch.js +0 -0
  311. /package/{runtime/chunks → static/runtime}/client-5XqXGmAI.js +0 -0
  312. /package/{runtime/chunks → static/runtime}/dayjs.min-CO3mzOeV.js +0 -0
  313. /package/{runtime/_core/chunks/defineProperty-BGJFuFMq.js → static/runtime/defineProperty-CGNmw-jw.js} +0 -0
  314. /package/{runtime/chunks → static/runtime}/dist-Cns8cA2n.js +0 -0
  315. /package/{runtime/chunks → static/runtime}/dist-Ct0xRt3Y.js +0 -0
  316. /package/{runtime/chunks → static/runtime}/es-0FFT3fCz.js +0 -0
  317. /package/{runtime/chunks → static/runtime}/es-BwJ3eGbx.js +0 -0
  318. /package/{runtime/chunks → static/runtime}/es-D8EsVtRL.js +0 -0
  319. /package/{runtime/chunks → static/runtime}/es-Da4O25Kw.js +0 -0
  320. /package/{runtime/chunks → static/runtime}/jsx-dev-runtime-V4_MuHNS.js +0 -0
  321. /package/{runtime/chunks → static/runtime}/jsx-runtime-DBeCoE0b.js +0 -0
  322. /package/{runtime/chunks → static/runtime}/objectWithoutProperties-Bk0EDksJ.js +0 -0
  323. /package/{runtime/chunks → static/runtime}/prop-types-DxD5wgQ0.js +0 -0
  324. /package/{runtime/chunks → static/runtime}/react-TEeeBWTl.js +0 -0
  325. /package/{runtime/chunks → static/runtime}/react-dom-BKKa1g6U.js +0 -0
@@ -1,3813 +0,0 @@
1
- import { t as e } from "./d6d2d2d0.js";
2
- import { C as t, S as n, b as r, d as i, f as a, u as o, w as s, x as c, y as l } from "./a513adfd.js";
3
- //#region node_modules/lib0/map.js
4
- var u = () => /* @__PURE__ */ new Map(), d = (e) => {
5
- let t = u();
6
- return e.forEach((e, n) => {
7
- t.set(n, e);
8
- }), t;
9
- }, f = (e, t, n) => {
10
- let r = e.get(t);
11
- return r === void 0 && e.set(t, r = n()), r;
12
- }, ee = (e, t) => {
13
- let n = [];
14
- for (let [r, i] of e) n.push(t(i, r));
15
- return n;
16
- }, te = (e, t) => {
17
- for (let [n, r] of e) if (t(r, n)) return !0;
18
- return !1;
19
- }, p = () => /* @__PURE__ */ new Set(), ne = (e) => e[e.length - 1], re = (e, t) => {
20
- for (let n = 0; n < t.length; n++) e.push(t[n]);
21
- }, m = Array.from, ie = (e, t) => {
22
- for (let n = 0; n < e.length; n++) if (!t(e[n], n, e)) return !1;
23
- return !0;
24
- }, ae = (e, t) => {
25
- for (let n = 0; n < e.length; n++) if (t(e[n], n, e)) return !0;
26
- return !1;
27
- }, oe = (e, t) => {
28
- let n = Array(e);
29
- for (let r = 0; r < e; r++) n[r] = t(r, n);
30
- return n;
31
- }, se = Array.isArray, ce = class {
32
- constructor() {
33
- this._observers = u();
34
- }
35
- on(e, t) {
36
- return f(this._observers, e, p).add(t), t;
37
- }
38
- once(e, t) {
39
- let n = (...r) => {
40
- this.off(e, n), t(...r);
41
- };
42
- this.on(e, n);
43
- }
44
- off(e, t) {
45
- let n = this._observers.get(e);
46
- n !== void 0 && (n.delete(t), n.size === 0 && this._observers.delete(e));
47
- }
48
- emit(e, t) {
49
- return m((this._observers.get(e) || u()).values()).forEach((e) => e(...t));
50
- }
51
- destroy() {
52
- this._observers = u();
53
- }
54
- }, le = class {
55
- constructor() {
56
- this._observers = u();
57
- }
58
- on(e, t) {
59
- f(this._observers, e, p).add(t);
60
- }
61
- once(e, t) {
62
- let n = (...r) => {
63
- this.off(e, n), t(...r);
64
- };
65
- this.on(e, n);
66
- }
67
- off(e, t) {
68
- let n = this._observers.get(e);
69
- n !== void 0 && (n.delete(t), n.size === 0 && this._observers.delete(e));
70
- }
71
- emit(e, t) {
72
- return m((this._observers.get(e) || u()).values()).forEach((e) => e(...t));
73
- }
74
- destroy() {
75
- this._observers = u();
76
- }
77
- }, h = Math.floor, ue = Math.abs, de = (e, t) => e < t ? e : t, g = (e, t) => e > t ? e : t;
78
- Number.isNaN;
79
- var fe = Math.pow, pe = (e) => e === 0 ? 1 / e < 0 : e < 0, me = 2 ** 53 - 1, he = -(2 ** 53 - 1), ge = Number.isInteger || ((e) => typeof e == "number" && isFinite(e) && h(e) === e);
80
- Number.isNaN, Number.parseInt;
81
- //#endregion
82
- //#region node_modules/lib0/string.js
83
- var _e = String.fromCharCode;
84
- String.fromCodePoint, _e(65535);
85
- var ve = (e) => e.toLowerCase(), ye = /^\s*/g, be = (e) => e.replace(ye, ""), xe = /([A-Z])/g, Se = (e, t) => be(e.replace(xe, (e) => `${t}${ve(e)}`)), Ce = (e) => {
86
- let t = unescape(encodeURIComponent(e)), n = t.length, r = new Uint8Array(n);
87
- for (let e = 0; e < n; e++) r[e] = t.codePointAt(e);
88
- return r;
89
- }, we = typeof TextEncoder < "u" ? new TextEncoder() : null, Te = we ? (e) => we.encode(e) : Ce, Ee = typeof TextDecoder > "u" ? null : new TextDecoder("utf-8", {
90
- fatal: !0,
91
- ignoreBOM: !0
92
- });
93
- /* c8 ignore start */
94
- Ee && Ee.decode(new Uint8Array()).length === 1 && (Ee = null);
95
- var De = (e, t) => oe(t, () => e).join(""), Oe = class {
96
- constructor() {
97
- this.cpos = 0, this.cbuf = new Uint8Array(100), this.bufs = [];
98
- }
99
- }, _ = () => new Oe(), ke = (e) => {
100
- let t = e.cpos;
101
- for (let n = 0; n < e.bufs.length; n++) t += e.bufs[n].length;
102
- return t;
103
- }, v = (e) => {
104
- let t = new Uint8Array(ke(e)), n = 0;
105
- for (let r = 0; r < e.bufs.length; r++) {
106
- let i = e.bufs[r];
107
- t.set(i, n), n += i.length;
108
- }
109
- return t.set(new Uint8Array(e.cbuf.buffer, 0, e.cpos), n), t;
110
- }, Ae = (e, t) => {
111
- let n = e.cbuf.length;
112
- n - e.cpos < t && (e.bufs.push(new Uint8Array(e.cbuf.buffer, 0, e.cpos)), e.cbuf = new Uint8Array(g(n, t) * 2), e.cpos = 0);
113
- }, y = (e, t) => {
114
- let n = e.cbuf.length;
115
- e.cpos === n && (e.bufs.push(e.cbuf), e.cbuf = new Uint8Array(n * 2), e.cpos = 0), e.cbuf[e.cpos++] = t;
116
- }, je = y, b = (e, t) => {
117
- for (; t > 127;) y(e, 128 | 127 & t), t = h(t / 128);
118
- y(e, 127 & t);
119
- }, Me = (e, t) => {
120
- let n = pe(t);
121
- for (n && (t = -t), y(e, (t > 63 ? 128 : 0) | (n ? 64 : 0) | 63 & t), t = h(t / 64); t > 0;) y(e, (t > 127 ? 128 : 0) | 127 & t), t = h(t / 128);
122
- }, Ne = new Uint8Array(3e4), Pe = Ne.length / 3, x = we && we.encodeInto ? (e, t) => {
123
- if (t.length < Pe) {
124
- /* c8 ignore next */
125
- let n = we.encodeInto(t, Ne).written || 0;
126
- b(e, n);
127
- for (let t = 0; t < n; t++) y(e, Ne[t]);
128
- } else S(e, Te(t));
129
- } : (e, t) => {
130
- let n = unescape(encodeURIComponent(t)), r = n.length;
131
- b(e, r);
132
- for (let t = 0; t < r; t++) y(e, n.codePointAt(t));
133
- }, Fe = (e, t) => {
134
- let n = e.cbuf.length, r = e.cpos, i = de(n - r, t.length), a = t.length - i;
135
- e.cbuf.set(t.subarray(0, i), r), e.cpos += i, a > 0 && (e.bufs.push(e.cbuf), e.cbuf = new Uint8Array(g(n * 2, a)), e.cbuf.set(t.subarray(i)), e.cpos = a);
136
- }, S = (e, t) => {
137
- b(e, t.byteLength), Fe(e, t);
138
- }, Ie = (e, t) => {
139
- Ae(e, t);
140
- let n = new DataView(e.cbuf.buffer, e.cpos, t);
141
- return e.cpos += t, n;
142
- }, Le = (e, t) => Ie(e, 4).setFloat32(0, t, !1), Re = (e, t) => Ie(e, 8).setFloat64(0, t, !1), ze = (e, t) => Ie(e, 8).setBigInt64(0, t, !1), Be = /* @__PURE__ */ new DataView(/* @__PURE__ */ new ArrayBuffer(4)), Ve = (e) => (Be.setFloat32(0, e), Be.getFloat32(0) === e), He = (e, t) => {
143
- switch (typeof t) {
144
- case "string":
145
- y(e, 119), x(e, t);
146
- break;
147
- case "number":
148
- ge(t) && ue(t) <= 2147483647 ? (y(e, 125), Me(e, t)) : Ve(t) ? (y(e, 124), Le(e, t)) : (y(e, 123), Re(e, t));
149
- break;
150
- case "bigint":
151
- y(e, 122), ze(e, t);
152
- break;
153
- case "object":
154
- if (t === null) y(e, 126);
155
- else if (se(t)) {
156
- y(e, 117), b(e, t.length);
157
- for (let n = 0; n < t.length; n++) He(e, t[n]);
158
- } else if (t instanceof Uint8Array) y(e, 116), S(e, t);
159
- else {
160
- y(e, 118);
161
- let n = Object.keys(t);
162
- b(e, n.length);
163
- for (let r = 0; r < n.length; r++) {
164
- let i = n[r];
165
- x(e, i), He(e, t[i]);
166
- }
167
- }
168
- break;
169
- case "boolean":
170
- y(e, t ? 120 : 121);
171
- break;
172
- default: y(e, 127);
173
- }
174
- }, Ue = class extends Oe {
175
- constructor(e) {
176
- super(), this.w = e, this.s = null, this.count = 0;
177
- }
178
- write(e) {
179
- this.s === e ? this.count++ : (this.count > 0 && b(this, this.count - 1), this.count = 1, this.w(this, e), this.s = e);
180
- }
181
- }, We = (e) => {
182
- e.count > 0 && (Me(e.encoder, e.count === 1 ? e.s : -e.s), e.count > 1 && b(e.encoder, e.count - 2));
183
- }, Ge = class {
184
- constructor() {
185
- this.encoder = new Oe(), this.s = 0, this.count = 0;
186
- }
187
- write(e) {
188
- this.s === e ? this.count++ : (We(this), this.count = 1, this.s = e);
189
- }
190
- toUint8Array() {
191
- return We(this), v(this.encoder);
192
- }
193
- }, Ke = (e) => {
194
- if (e.count > 0) {
195
- let t = e.diff * 2 + (e.count === 1 ? 0 : 1);
196
- Me(e.encoder, t), e.count > 1 && b(e.encoder, e.count - 2);
197
- }
198
- }, qe = class {
199
- constructor() {
200
- this.encoder = new Oe(), this.s = 0, this.count = 0, this.diff = 0;
201
- }
202
- write(e) {
203
- this.diff === e - this.s ? (this.s = e, this.count++) : (Ke(this), this.count = 1, this.diff = e - this.s, this.s = e);
204
- }
205
- toUint8Array() {
206
- return Ke(this), v(this.encoder);
207
- }
208
- }, Je = class {
209
- constructor() {
210
- this.sarr = [], this.s = "", this.lensE = new Ge();
211
- }
212
- write(e) {
213
- this.s += e, this.s.length > 19 && (this.sarr.push(this.s), this.s = ""), this.lensE.write(e.length);
214
- }
215
- toUint8Array() {
216
- let e = new Oe();
217
- return this.sarr.push(this.s), this.s = "", x(e, this.sarr.join("")), Fe(e, this.lensE.toUint8Array()), v(e);
218
- }
219
- }, C = (e) => Error(e), w = () => {
220
- throw C("Method unimplemented");
221
- }, T = () => {
222
- throw C("Unexpected case");
223
- }, Ye = C("Unexpected end of array"), Xe = C("Integer out of Range"), Ze = class {
224
- constructor(e) {
225
- this.arr = e, this.pos = 0;
226
- }
227
- }, E = (e) => new Ze(e), Qe = (e) => e.pos !== e.arr.length, $e = (e, t) => {
228
- let n = new Uint8Array(e.arr.buffer, e.pos + e.arr.byteOffset, t);
229
- return e.pos += t, n;
230
- }, D = (e) => $e(e, O(e)), et = (e) => e.arr[e.pos++], O = (e) => {
231
- let t = 0, n = 1, r = e.arr.length;
232
- for (; e.pos < r;) {
233
- let r = e.arr[e.pos++];
234
- if (t += (r & 127) * n, n *= 128, r < 128) return t;
235
- /* c8 ignore start */
236
- if (t > me) throw Xe;
237
- }
238
- throw Ye;
239
- }, tt = (e) => {
240
- let t = e.arr[e.pos++], n = t & 63, r = 64, i = (t & 64) > 0 ? -1 : 1;
241
- if (!(t & 128)) return i * n;
242
- let a = e.arr.length;
243
- for (; e.pos < a;) {
244
- if (t = e.arr[e.pos++], n += (t & 127) * r, r *= 128, t < 128) return i * n;
245
- /* c8 ignore start */
246
- if (n > me) throw Xe;
247
- }
248
- throw Ye;
249
- }, k = Ee ? (e) => Ee.decode(D(e)) : (e) => {
250
- let t = O(e);
251
- if (t === 0) return "";
252
- {
253
- let n = String.fromCodePoint(et(e));
254
- if (--t < 100) for (; t--;) n += String.fromCodePoint(et(e));
255
- else for (; t > 0;) {
256
- let r = t < 1e4 ? t : 1e4, i = e.arr.subarray(e.pos, e.pos + r);
257
- e.pos += r, n += String.fromCodePoint.apply(null, i), t -= r;
258
- }
259
- return decodeURIComponent(escape(n));
260
- }
261
- }, nt = (e, t) => {
262
- let n = new DataView(e.arr.buffer, e.arr.byteOffset + e.pos, t);
263
- return e.pos += t, n;
264
- }, rt = [
265
- (e) => void 0,
266
- (e) => null,
267
- tt,
268
- (e) => nt(e, 4).getFloat32(0, !1),
269
- (e) => nt(e, 8).getFloat64(0, !1),
270
- (e) => nt(e, 8).getBigInt64(0, !1),
271
- (e) => !1,
272
- (e) => !0,
273
- k,
274
- (e) => {
275
- let t = O(e), n = {};
276
- for (let r = 0; r < t; r++) {
277
- let t = k(e);
278
- n[t] = it(e);
279
- }
280
- return n;
281
- },
282
- (e) => {
283
- let t = O(e), n = [];
284
- for (let r = 0; r < t; r++) n.push(it(e));
285
- return n;
286
- },
287
- D
288
- ], it = (e) => rt[127 - et(e)](e), at = class extends Ze {
289
- constructor(e, t) {
290
- super(e), this.reader = t, this.s = null, this.count = 0;
291
- }
292
- read() {
293
- return this.count === 0 && (this.s = this.reader(this), Qe(this) ? this.count = O(this) + 1 : this.count = -1), this.count--, this.s;
294
- }
295
- }, ot = class extends Ze {
296
- constructor(e) {
297
- super(e), this.s = 0, this.count = 0;
298
- }
299
- read() {
300
- if (this.count === 0) {
301
- this.s = tt(this);
302
- let e = pe(this.s);
303
- this.count = 1, e && (this.s = -this.s, this.count = O(this) + 2);
304
- }
305
- return this.count--, this.s;
306
- }
307
- }, st = class extends Ze {
308
- constructor(e) {
309
- super(e), this.s = 0, this.count = 0, this.diff = 0;
310
- }
311
- read() {
312
- if (this.count === 0) {
313
- let e = tt(this), t = e & 1;
314
- this.diff = h(e / 2), this.count = 1, t && (this.count = O(this) + 2);
315
- }
316
- return this.s += this.diff, this.count--, this.s;
317
- }
318
- }, ct = class {
319
- constructor(e) {
320
- this.decoder = new ot(e), this.str = k(this.decoder), this.spos = 0;
321
- }
322
- read() {
323
- let e = this.spos + this.decoder.read(), t = this.str.slice(this.spos, e);
324
- return this.spos = e, t;
325
- }
326
- };
327
- crypto.subtle;
328
- var lt = crypto.getRandomValues.bind(crypto), ut = () => lt(new Uint32Array(1))[0], dt = "10000000-1000-4000-8000-100000000000", ft = () => dt.replace(/[018]/g, (e) => (e ^ ut() & 15 >> e / 4).toString(16)), A = Date.now, pt = (e) => new Promise(e);
329
- Promise.all.bind(Promise);
330
- //#endregion
331
- //#region node_modules/lib0/conditions.js
332
- /* c8 ignore next */
333
- var mt = (e) => e === void 0 ? null : e, ht = new class {
334
- constructor() {
335
- this.map = /* @__PURE__ */ new Map();
336
- }
337
- setItem(e, t) {
338
- this.map.set(e, t);
339
- }
340
- getItem(e) {
341
- return this.map.get(e);
342
- }
343
- }(), gt = !0;
344
- /* c8 ignore start */
345
- try {
346
- typeof localStorage < "u" && localStorage && (ht = localStorage, gt = !1);
347
- } catch {}
348
- /* c8 ignore stop */
349
- /* c8 ignore next */
350
- var _t = ht, vt = (e) => gt || addEventListener("storage", e), yt = (e) => gt || removeEventListener("storage", e), bt = Symbol("Equality"), xt = (e, t) => e === t || !!e?.[bt]?.(t) || !1, St = (e) => typeof e == "object", Ct = Object.assign, wt = Object.keys, Tt = (e, t) => {
351
- for (let n in e) t(e[n], n);
352
- }, Et = (e, t) => {
353
- let n = [];
354
- for (let r in e) n.push(t(e[r], r));
355
- return n;
356
- }, Dt = (e) => wt(e).length, Ot = (e) => {
357
- for (let t in e) return !1;
358
- return !0;
359
- }, kt = (e, t) => {
360
- for (let n in e) if (!t(e[n], n)) return !1;
361
- return !0;
362
- }, At = (e, t) => Object.prototype.hasOwnProperty.call(e, t), jt = (e, t) => e === t || Dt(e) === Dt(t) && kt(e, (e, n) => (e !== void 0 || At(t, n)) && xt(t[n], e)), Mt = Object.freeze, Nt = (e) => {
363
- for (let t in e) {
364
- let n = e[t];
365
- (typeof n == "object" || typeof n == "function") && Nt(e[t]);
366
- }
367
- return Mt(e);
368
- }, Pt = (e, t, n = 0) => {
369
- try {
370
- for (; n < e.length; n++) e[n](...t);
371
- } finally {
372
- n < e.length && Pt(e, t, n + 1);
373
- }
374
- }, Ft = (e) => e, It = (e, t) => {
375
- if (e === t) return !0;
376
- if (e == null || t == null || e.constructor !== t.constructor && (e.constructor || Object) !== (t.constructor || Object)) return !1;
377
- if (e[bt] != null) return e[bt](t);
378
- switch (e.constructor) {
379
- case ArrayBuffer: e = new Uint8Array(e), t = new Uint8Array(t);
380
- case Uint8Array:
381
- if (e.byteLength !== t.byteLength) return !1;
382
- for (let n = 0; n < e.length; n++) if (e[n] !== t[n]) return !1;
383
- break;
384
- case Set:
385
- if (e.size !== t.size) return !1;
386
- for (let n of e) if (!t.has(n)) return !1;
387
- break;
388
- case Map:
389
- if (e.size !== t.size) return !1;
390
- for (let n of e.keys()) if (!t.has(n) || !It(e.get(n), t.get(n))) return !1;
391
- break;
392
- case void 0:
393
- case Object:
394
- if (Dt(e) !== Dt(t)) return !1;
395
- for (let n in e) if (!At(e, n) || !It(e[n], t[n])) return !1;
396
- break;
397
- case Array:
398
- if (e.length !== t.length) return !1;
399
- for (let n = 0; n < e.length; n++) if (!It(e[n], t[n])) return !1;
400
- break;
401
- default: return !1;
402
- }
403
- return !0;
404
- }, Lt = (e, t) => t.includes(e);
405
- //#endregion
406
- //#region node_modules/lib0/environment.js
407
- n(
408
- /* c8 ignore stop */
409
- );
410
- /* c8 ignore next 2 */
411
- var j = c !== void 0 && c.release && /node|io\.js/.test(c.release.name) && Object.prototype.toString.call(c === void 0 ? 0 : c) === "[object process]", Rt = typeof window < "u" && typeof document < "u" && !j;
412
- typeof navigator < "u" && /Mac/.test(navigator.platform);
413
- var M, zt = [], Bt = () => {
414
- if (M === void 0) if (j) {
415
- M = u();
416
- let e = c.argv, t = null;
417
- for (let n = 0; n < e.length; n++) {
418
- let r = e[n];
419
- r[0] === "-" ? (t !== null && M.set(t, ""), t = r) : t === null ? zt.push(r) : (M.set(t, r), t = null);
420
- }
421
- t !== null && M.set(t, "");
422
- } else typeof location == "object" ? (M = u(), (location.search || "?").slice(1).split("&").forEach((e) => {
423
- if (e.length !== 0) {
424
- let [t, n] = e.split("=");
425
- M.set(`--${Se(t, "-")}`, n), M.set(`-${Se(t, "-")}`, n);
426
- }
427
- })) : M = u();
428
- return M;
429
- }, Vt = (e) => Bt().has(e), Ht = (e) => mt(j ? c.env[e.toUpperCase().replaceAll("-", "_")] : _t.getItem(e)), Ut = (e) => Vt("--" + e) || Ht(e) !== null, Wt = Ut("production"), Gt = j && Lt(c.env.FORCE_COLOR, [
430
- "true",
431
- "1",
432
- "2"
433
- ]) || !Vt("--no-colors") && !Ut("no-color") && (!j || c.stdout.isTTY) && (!j || Vt("--color") || Ht("COLORTERM") !== null || (Ht("TERM") || "").includes("color"));
434
- //#endregion
435
- //#region node_modules/lib0/buffer.js
436
- r();
437
- var Kt = (e) => new Uint8Array(e), qt = (e, t, n) => new Uint8Array(e, t, n), Jt = (e) => new Uint8Array(e), Yt = (e) => {
438
- let t = "";
439
- for (let n = 0; n < e.byteLength; n++) t += _e(e[n]);
440
- return btoa(t);
441
- }, Xt = (e) => l.from(e.buffer, e.byteOffset, e.byteLength).toString("base64"), Zt = (e) => {
442
- let t = atob(e), n = Kt(t.length);
443
- for (let e = 0; e < t.length; e++) n[e] = t.charCodeAt(e);
444
- return n;
445
- }, Qt = (e) => {
446
- let t = l.from(e, "base64");
447
- return qt(t.buffer, t.byteOffset, t.byteLength);
448
- }, $t = Rt ? Yt : Xt, en = Rt ? Zt : Qt, tn = (e) => {
449
- let t = Kt(e.byteLength);
450
- return t.set(e), t;
451
- }, nn = class {
452
- constructor(e, t) {
453
- this.left = e, this.right = t;
454
- }
455
- }, N = (e, t) => new nn(e, t), rn = (e) => e.next() >= .5, an = (e, t, n) => h(e.next() * (n + 1 - t) + t), on = (e, t, n) => h(e.next() * (n + 1 - t) + t), sn = (e, t, n) => on(e, t, n), cn = (e) => _e(sn(e, 97, 122)), ln = (e, t = 0, n = 20) => {
456
- let r = sn(e, t, n), i = "";
457
- for (let t = 0; t < r; t++) i += cn(e);
458
- return i;
459
- }, un = (e, t) => t[sn(e, 0, t.length - 1)], dn = Symbol("0schema"), fn = class {
460
- constructor() {
461
- this._rerrs = [];
462
- }
463
- extend(e, t, n, r = null) {
464
- this._rerrs.push({
465
- path: e,
466
- expected: t,
467
- has: n,
468
- message: r
469
- });
470
- }
471
- toString() {
472
- let e = [];
473
- for (let t = this._rerrs.length - 1; t > 0; t--) {
474
- let n = this._rerrs[t];
475
- /* c8 ignore next */
476
- e.push(De(" ", (this._rerrs.length - t) * 2) + `${n.path == null ? "" : `[${n.path}] `}${n.has} doesn't match ${n.expected}. ${n.message}`);
477
- }
478
- return e.join("\n");
479
- }
480
- }, pn = (e, t) => e === t ? !0 : e == null || t == null || e.constructor !== t.constructor ? !1 : e[bt] ? xt(e, t) : se(e) ? ie(e, (e) => ae(t, (t) => pn(e, t))) : St(e) ? kt(e, (e, n) => pn(e, t[n])) : !1, P = class {
481
- static _dilutes = !1;
482
- extends(e) {
483
- let [t, n] = [this.shape, e.shape];
484
- return this.constructor._dilutes && ([n, t] = [t, n]), pn(t, n);
485
- }
486
- equals(e) {
487
- return this.constructor === e.constructor && It(this.shape, e.shape);
488
- }
489
- [dn]() {
490
- return !0;
491
- }
492
- [bt](e) {
493
- return this.equals(e);
494
- }
495
- validate(e) {
496
- return this.check(e);
497
- }
498
- /* c8 ignore start */
499
- check(e, t) {
500
- w();
501
- }
502
- /* c8 ignore stop */
503
- get nullable() {
504
- return Wn(this, ar);
505
- }
506
- get optional() {
507
- return new Sn(this);
508
- }
509
- cast(e) {
510
- return lr(e, this), e;
511
- }
512
- expect(e) {
513
- return lr(e, this), e;
514
- }
515
- }, mn = class extends P {
516
- constructor(e, t) {
517
- super(), this.shape = e, this._c = t;
518
- }
519
- check(e, t = void 0) {
520
- let n = e?.constructor === this.shape && (this._c == null || this._c(e));
521
- return !n && t?.extend(null, this.shape.name, e?.constructor.name, e?.constructor === this.shape ? "Check failed" : "Constructor match failed"), n;
522
- }
523
- }, F = (e, t = null) => new mn(e, t);
524
- F(mn);
525
- var hn = class extends P {
526
- constructor(e) {
527
- super(), this.shape = e;
528
- }
529
- check(e, t) {
530
- let n = this.shape(e);
531
- return !n && t?.extend(null, "custom prop", e?.constructor.name, "failed to check custom prop"), n;
532
- }
533
- }, I = (e) => new hn(e);
534
- F(hn);
535
- var gn = class extends P {
536
- constructor(e) {
537
- super(), this.shape = e;
538
- }
539
- check(e, t) {
540
- let n = this.shape.some((t) => t === e);
541
- return !n && t?.extend(null, this.shape.join(" | "), e.toString()), n;
542
- }
543
- }, _n = (...e) => new gn(e), vn = F(gn), yn = RegExp.escape || ((e) => e.replace(/[().|&,$^[\]]/g, (e) => "\\" + e)), bn = (e) => {
544
- if (er.check(e)) return [yn(e)];
545
- if (vn.check(e)) return e.shape.map((e) => e + "");
546
- if ($n.check(e)) return ["[+-]?\\d+.?\\d*"];
547
- if (tr.check(e)) return [".*"];
548
- if (Gn.check(e)) return e.shape.map(bn).flat(1);
549
- /* c8 ignore next 2 */
550
- T();
551
- };
552
- F(class extends P {
553
- constructor(e) {
554
- super(), this.shape = e, this._r = RegExp("^" + e.map(bn).map((e) => `(${e.join("|")})`).join("") + "$");
555
- }
556
- check(e, t) {
557
- let n = this._r.exec(e) != null;
558
- return !n && t?.extend(null, this._r.toString(), e.toString(), "String doesn't match string template."), n;
559
- }
560
- });
561
- var xn = Symbol("optional"), Sn = class extends P {
562
- constructor(e) {
563
- super(), this.shape = e;
564
- }
565
- check(e, t) {
566
- let n = e === void 0 || this.shape.check(e);
567
- return !n && t?.extend(null, "undefined (optional)", "()"), n;
568
- }
569
- get [xn]() {
570
- return !0;
571
- }
572
- }, Cn = F(Sn), wn = class extends P {
573
- check(e, t) {
574
- return t?.extend(null, "never", typeof e), !1;
575
- }
576
- };
577
- new wn(), F(wn);
578
- var Tn = class e extends P {
579
- constructor(e, t = !1) {
580
- super(), this.shape = e, this._isPartial = t;
581
- }
582
- static _dilutes = !0;
583
- get partial() {
584
- return new e(this.shape, !0);
585
- }
586
- check(e, t) {
587
- return e == null ? (t?.extend(null, "object", "null"), !1) : kt(this.shape, (n, r) => {
588
- let i = this._isPartial && !At(e, r) || n.check(e[r], t);
589
- return !i && t?.extend(r.toString(), n.toString(), typeof e[r], "Object property does not match"), i;
590
- });
591
- }
592
- }, En = (e) => new Tn(e), Dn = F(Tn), On = I((e) => e != null && (e.constructor === Object || e.constructor == null)), kn = class extends P {
593
- constructor(e, t) {
594
- super(), this.shape = {
595
- keys: e,
596
- values: t
597
- };
598
- }
599
- check(e, t) {
600
- return e != null && kt(e, (n, r) => {
601
- let i = this.shape.keys.check(r, t);
602
- return !i && t?.extend(r + "", "Record", typeof e, i ? "Key doesn't match schema" : "Value doesn't match value"), i && this.shape.values.check(n, t);
603
- });
604
- }
605
- }, An = (e, t) => new kn(e, t), jn = F(kn), Mn = class extends P {
606
- constructor(e) {
607
- super(), this.shape = e;
608
- }
609
- check(e, t) {
610
- return e != null && kt(this.shape, (n, r) => {
611
- let i = n.check(e[r], t);
612
- return !i && t?.extend(r.toString(), "Tuple", typeof n), i;
613
- });
614
- }
615
- }, Nn = (...e) => new Mn(e);
616
- F(Mn);
617
- var Pn = class extends P {
618
- constructor(e) {
619
- super(), this.shape = e.length === 1 ? e[0] : new Un(e);
620
- }
621
- check(e, t) {
622
- let n = se(e) && ie(e, (e) => this.shape.check(e));
623
- return !n && t?.extend(null, "Array", ""), n;
624
- }
625
- }, Fn = (...e) => new Pn(e), In = F(Pn), Ln = I((e) => se(e)), Rn = class extends P {
626
- constructor(e, t) {
627
- super(), this.shape = e, this._c = t;
628
- }
629
- check(e, t) {
630
- let n = e instanceof this.shape && (this._c == null || this._c(e));
631
- return !n && t?.extend(null, this.shape.name, e?.constructor.name), n;
632
- }
633
- }, zn = (e, t = null) => new Rn(e, t);
634
- F(Rn);
635
- var Bn = zn(P), Vn = F(class extends P {
636
- constructor(e) {
637
- super(), this.len = e.length - 1, this.args = Nn(...e.slice(-1)), this.res = e[this.len];
638
- }
639
- check(e, t) {
640
- let n = e.constructor === Function && e.length <= this.len;
641
- return !n && t?.extend(null, "function", typeof e), n;
642
- }
643
- }), Hn = I((e) => typeof e == "function");
644
- F(class extends P {
645
- constructor(e) {
646
- super(), this.shape = e;
647
- }
648
- check(e, t) {
649
- let n = ie(this.shape, (n) => n.check(e, t));
650
- return !n && t?.extend(null, "Intersectinon", typeof e), n;
651
- }
652
- }, (e) => e.shape.length > 0);
653
- var Un = class extends P {
654
- static _dilutes = !0;
655
- constructor(e) {
656
- super(), this.shape = e;
657
- }
658
- check(e, t) {
659
- let n = ae(this.shape, (n) => n.check(e, t));
660
- return t?.extend(null, "Union", typeof e), n;
661
- }
662
- }, Wn = (...e) => e.findIndex((e) => Gn.check(e)) >= 0 ? Wn(...e.map((e) => cr(e)).map((e) => Gn.check(e) ? e.shape : [e]).flat(1)) : e.length === 1 ? e[0] : new Un(e), Gn = F(Un), Kn = () => !0, qn = I(Kn), Jn = F(hn, (e) => e.shape === Kn), Yn = I((e) => typeof e == "bigint"), Xn = I((e) => e === Yn), Zn = I((e) => typeof e == "symbol");
663
- I((e) => e === Zn);
664
- var Qn = I((e) => typeof e == "number"), $n = I((e) => e === Qn), er = I((e) => typeof e == "string"), tr = I((e) => e === er), nr = I((e) => typeof e == "boolean"), rr = I((e) => e === nr), ir = _n(void 0);
665
- F(gn, (e) => e.shape.length === 1 && e.shape[0] === void 0), _n(void 0);
666
- var ar = _n(null), or = F(gn, (e) => e.shape.length === 1 && e.shape[0] === null);
667
- F(Uint8Array), F(mn, (e) => e.shape === Uint8Array);
668
- var sr = Wn(Qn, er, ar, ir, Yn, nr, Zn);
669
- (() => {
670
- let e = Fn(qn), t = An(er, qn), n = Wn(Qn, er, ar, nr, e, t);
671
- return e.shape = n, t.shape.values = n, n;
672
- })();
673
- var cr = (e) => {
674
- if (Bn.check(e)) return e;
675
- if (On.check(e)) {
676
- let t = {};
677
- for (let n in e) t[n] = cr(e[n]);
678
- return En(t);
679
- } else if (Ln.check(e)) return Wn(...e.map(cr));
680
- else if (sr.check(e)) return _n(e);
681
- else if (Hn.check(e)) return F(e);
682
- /* c8 ignore next */
683
- T();
684
- }, lr = Wt ? () => {} : (e, t) => {
685
- let n = new fn();
686
- if (!t.check(e, n)) throw C(`Expected value to be of type ${t.constructor.name}.\n${n.toString()}`);
687
- }, ur = class {
688
- constructor(e) {
689
- this.patterns = [], this.$state = e;
690
- }
691
- if(e, t) {
692
- return this.patterns.push({
693
- if: cr(e),
694
- h: t
695
- }), this;
696
- }
697
- else(e) {
698
- return this.if(qn, e);
699
- }
700
- done() {
701
- return (e, t) => {
702
- for (let n = 0; n < this.patterns.length; n++) {
703
- let r = this.patterns[n];
704
- if (r.if.check(e)) return r.h(e, t);
705
- }
706
- throw C("Unhandled pattern");
707
- };
708
- }
709
- }, dr = ((e) => new ur(e))(qn).if($n, (e, t) => an(t, he, me)).if(tr, (e, t) => ln(t)).if(rr, (e, t) => rn(t)).if(Xn, (e, t) => BigInt(an(t, he, me))).if(Gn, (e, t) => fr(t, un(t, e.shape))).if(Dn, (e, t) => {
710
- let n = {};
711
- for (let r in e.shape) {
712
- let i = e.shape[r];
713
- if (Cn.check(i)) {
714
- if (rn(t)) continue;
715
- i = i.shape;
716
- }
717
- n[r] = dr(i, t);
718
- }
719
- return n;
720
- }).if(In, (e, t) => {
721
- let n = [], r = on(t, 0, 42);
722
- for (let i = 0; i < r; i++) n.push(fr(t, e.shape));
723
- return n;
724
- }).if(vn, (e, t) => un(t, e.shape)).if(or, (e, t) => null).if(Vn, (e, t) => {
725
- let n = fr(t, e.res);
726
- return () => n;
727
- }).if(Jn, (e, t) => fr(t, un(t, [
728
- Qn,
729
- er,
730
- ar,
731
- ir,
732
- Yn,
733
- nr,
734
- Fn(Qn),
735
- An(Wn("a", "b", "c"), Qn)
736
- ]))).if(jn, (e, t) => {
737
- let n = {}, r = an(t, 0, 3);
738
- for (let i = 0; i < r; i++) {
739
- let r = fr(t, e.shape.keys);
740
- n[r] = fr(t, e.shape.values);
741
- }
742
- return n;
743
- }).done(), fr = (e, t) => dr(cr(t), e), L = typeof document < "u" ? document : {};
744
- I((e) => e.nodeType === _r), typeof DOMParser < "u" && new DOMParser(), I((e) => e.nodeType === mr), I((e) => e.nodeType === hr);
745
- var pr = (e) => ee(e, (e, t) => `${t}:${e};`).join(""), mr = L.ELEMENT_NODE, hr = L.TEXT_NODE;
746
- L.CDATA_SECTION_NODE, L.COMMENT_NODE;
747
- var gr = L.DOCUMENT_NODE;
748
- L.DOCUMENT_TYPE_NODE;
749
- var _r = L.DOCUMENT_FRAGMENT_NODE;
750
- I((e) => e.nodeType === gr);
751
- /* c8 ignore stop */
752
- //#endregion
753
- //#region node_modules/lib0/symbol.js
754
- var R = Symbol, vr = R(), yr = R(), br = R(), xr = R(), Sr = R(), Cr = R(), wr = R(), Tr = R(), Er = R(), Dr = (e) => {
755
- e.length === 1 && e[0]?.constructor === Function && (e = e[0]());
756
- let t = [], n = [], r = 0;
757
- for (; r < e.length; r++) {
758
- let n = e[r];
759
- if (n === void 0) break;
760
- if (n.constructor === String || n.constructor === Number) t.push(n);
761
- else if (n.constructor === Object) break;
762
- }
763
- for (r > 0 && n.push(t.join("")); r < e.length; r++) {
764
- let t = e[r];
765
- t instanceof Symbol || n.push(t);
766
- }
767
- return n;
768
- };
769
- A();
770
- /* c8 ignore stop */
771
- //#endregion
772
- //#region node_modules/lib0/logging.js
773
- var Or = {
774
- [vr]: N("font-weight", "bold"),
775
- [yr]: N("font-weight", "normal"),
776
- [br]: N("color", "blue"),
777
- [Sr]: N("color", "green"),
778
- [xr]: N("color", "grey"),
779
- [Cr]: N("color", "red"),
780
- [wr]: N("color", "purple"),
781
- [Tr]: N("color", "orange"),
782
- [Er]: N("color", "black")
783
- }, kr = Gt ? (e) => {
784
- e.length === 1 && e[0]?.constructor === Function && (e = e[0]());
785
- let t = [], n = [], r = u(), i = [], a = 0;
786
- for (; a < e.length; a++) {
787
- let i = e[a], o = Or[i];
788
- if (o !== void 0) r.set(o.left, o.right);
789
- else {
790
- if (i === void 0) break;
791
- if (i.constructor === String || i.constructor === Number) {
792
- let e = pr(r);
793
- a > 0 || e.length > 0 ? (t.push("%c" + i), n.push(e)) : t.push(i);
794
- } else break;
795
- }
796
- }
797
- for (a > 0 && (i = n, i.unshift(t.join(""))); a < e.length; a++) {
798
- let t = e[a];
799
- t instanceof Symbol || i.push(t);
800
- }
801
- return i;
802
- } : Dr, Ar = (...e) => {
803
- /* c8 ignore next */
804
- [...kr(e)], Mr.forEach((t) => t.print(e));
805
- }, jr = (...e) => {
806
- [...kr(e)], e.unshift(Tr), Mr.forEach((t) => t.print(e));
807
- }, Mr = p(), Nr = (e) => ({
808
- [Symbol.iterator]() {
809
- return this;
810
- },
811
- next: e
812
- }), Pr = (e, t) => Nr(() => {
813
- let n;
814
- do
815
- n = e.next();
816
- while (!n.done && !t(n.value));
817
- return n;
818
- }), Fr = (e, t) => Nr(() => {
819
- let { done: n, value: r } = e.next();
820
- return {
821
- done: n,
822
- value: n ? void 0 : t(r)
823
- };
824
- });
825
- //#endregion
826
- //#region node_modules/yjs/dist/yjs.mjs
827
- s();
828
- var Ir = class {
829
- constructor(e, t) {
830
- this.clock = e, this.len = t;
831
- }
832
- }, Lr = class {
833
- constructor() {
834
- this.clients = /* @__PURE__ */ new Map();
835
- }
836
- }, Rr = (e, t, n) => t.clients.forEach((t, r) => {
837
- let i = e.doc.store.clients.get(r);
838
- if (i != null) {
839
- let r = i[i.length - 1], a = r.id.clock + r.length;
840
- for (let r = 0, o = t[r]; r < t.length && o.clock < a; o = t[++r]) Ki(e, i, o.clock, o.len, n);
841
- }
842
- }), zr = (e, t) => {
843
- let n = 0, r = e.length - 1;
844
- for (; n <= r;) {
845
- let i = h((n + r) / 2), a = e[i], o = a.clock;
846
- if (o <= t) {
847
- if (t < o + a.len) return i;
848
- n = i + 1;
849
- } else r = i - 1;
850
- }
851
- return null;
852
- }, Br = (e, t) => {
853
- let n = e.clients.get(t.client);
854
- return n !== void 0 && zr(n, t.clock) !== null;
855
- }, Vr = (e) => {
856
- e.clients.forEach((e) => {
857
- e.sort((e, t) => e.clock - t.clock);
858
- let t, n;
859
- for (t = 1, n = 1; t < e.length; t++) {
860
- let r = e[n - 1], i = e[t];
861
- r.clock + r.len >= i.clock ? e[n - 1] = new Ir(r.clock, g(r.len, i.clock + i.len - r.clock)) : (n < t && (e[n] = i), n++);
862
- }
863
- e.length = n;
864
- });
865
- }, Hr = (e) => {
866
- let t = new Lr();
867
- for (let n = 0; n < e.length; n++) e[n].clients.forEach((r, i) => {
868
- if (!t.clients.has(i)) {
869
- let a = r.slice();
870
- for (let t = n + 1; t < e.length; t++) re(a, e[t].clients.get(i) || []);
871
- t.clients.set(i, a);
872
- }
873
- });
874
- return Vr(t), t;
875
- }, Ur = (e, t, n, r) => {
876
- f(e.clients, t, () => []).push(new Ir(n, r));
877
- }, Wr = () => new Lr(), Gr = (e) => {
878
- let t = Wr();
879
- return e.clients.forEach((e, n) => {
880
- let r = [];
881
- for (let t = 0; t < e.length; t++) {
882
- let n = e[t];
883
- if (n.deleted) {
884
- let i = n.id.clock, a = n.length;
885
- if (t + 1 < e.length) for (let n = e[t + 1]; t + 1 < e.length && n.deleted; n = e[++t + 1]) a += n.length;
886
- r.push(new Ir(i, a));
887
- }
888
- }
889
- r.length > 0 && t.clients.set(n, r);
890
- }), t;
891
- }, Kr = (e, t) => {
892
- b(e.restEncoder, t.clients.size), m(t.clients.entries()).sort((e, t) => t[0] - e[0]).forEach(([t, n]) => {
893
- e.resetDsCurVal(), b(e.restEncoder, t);
894
- let r = n.length;
895
- b(e.restEncoder, r);
896
- for (let t = 0; t < r; t++) {
897
- let r = n[t];
898
- e.writeDsClock(r.clock), e.writeDsLen(r.len);
899
- }
900
- });
901
- }, qr = (e) => {
902
- let t = new Lr(), n = O(e.restDecoder);
903
- for (let r = 0; r < n; r++) {
904
- e.resetDsCurVal();
905
- let n = O(e.restDecoder), r = O(e.restDecoder);
906
- if (r > 0) {
907
- let i = f(t.clients, n, () => []);
908
- for (let t = 0; t < r; t++) i.push(new Ir(e.readDsClock(), e.readDsLen()));
909
- }
910
- }
911
- return t;
912
- }, Jr = (e, t, n) => {
913
- let r = new Lr(), i = O(e.restDecoder);
914
- for (let a = 0; a < i; a++) {
915
- e.resetDsCurVal();
916
- let i = O(e.restDecoder), a = O(e.restDecoder), o = n.clients.get(i) || [], s = V(n, i);
917
- for (let n = 0; n < a; n++) {
918
- let n = e.readDsClock(), a = n + e.readDsLen();
919
- if (n < s) {
920
- s < a && Ur(r, i, s, a - s);
921
- let e = H(o, n), c = o[e];
922
- for (!c.deleted && c.id.clock < n && (o.splice(e + 1, 0, Xo(t, c, n - c.id.clock)), e++); e < o.length && (c = o[e++], c.id.clock < a);) c.deleted || (a < c.id.clock + c.length && o.splice(e, 0, Xo(t, c, a - c.id.clock)), c.delete(t));
923
- } else Ur(r, i, n, a - n);
924
- }
925
- }
926
- if (r.clients.size > 0) {
927
- let e = new z();
928
- return b(e.restEncoder, 0), Kr(e, r), e.toUint8Array();
929
- }
930
- return null;
931
- }, Yr = ut, Xr = class e extends ce {
932
- constructor({ guid: e = ft(), collectionid: t = null, gc: n = !0, gcFilter: r = () => !0, meta: i = null, autoLoad: a = !1, shouldLoad: o = !0 } = {}) {
933
- super(), this.gc = n, this.gcFilter = r, this.clientID = Yr(), this.guid = e, this.collectionid = t, this.share = /* @__PURE__ */ new Map(), this.store = new zi(), this._transaction = null, this._transactionCleanups = [], this.subdocs = /* @__PURE__ */ new Set(), this._item = null, this.shouldLoad = o, this.autoLoad = a, this.meta = i, this.isLoaded = !1, this.isSynced = !1, this.isDestroyed = !1, this.whenLoaded = pt((e) => {
934
- this.on("load", () => {
935
- this.isLoaded = !0, e(this);
936
- });
937
- });
938
- let s = () => pt((e) => {
939
- let t = (n) => {
940
- (n === void 0 || n === !0) && (this.off("sync", t), e());
941
- };
942
- this.on("sync", t);
943
- });
944
- this.on("sync", (e) => {
945
- e === !1 && this.isSynced && (this.whenSynced = s()), this.isSynced = e === void 0 || e === !0, this.isSynced && !this.isLoaded && this.emit("load", [this]);
946
- }), this.whenSynced = s();
947
- }
948
- load() {
949
- let e = this._item;
950
- e !== null && !this.shouldLoad && W(e.parent.doc, (e) => {
951
- e.subdocsLoaded.add(this);
952
- }, null, !0), this.shouldLoad = !0;
953
- }
954
- getSubdocs() {
955
- return this.subdocs;
956
- }
957
- getSubdocGuids() {
958
- return new Set(m(this.subdocs).map((e) => e.guid));
959
- }
960
- transact(e, t = null) {
961
- return W(this, e, t);
962
- }
963
- get(e, t = q) {
964
- let n = f(this.share, e, () => {
965
- let e = new t();
966
- return e._integrate(this, null), e;
967
- }), r = n.constructor;
968
- if (t !== q && r !== t) if (r === q) {
969
- let r = new t();
970
- r._map = n._map, n._map.forEach((e) => {
971
- for (; e !== null; e = e.left) e.parent = r;
972
- }), r._start = n._start;
973
- for (let e = r._start; e !== null; e = e.right) e.parent = r;
974
- return r._length = n._length, this.share.set(e, r), r._integrate(this, null), r;
975
- } else throw Error(`Type with the name ${e} has already been defined with a different constructor`);
976
- return n;
977
- }
978
- getArray(e = "") {
979
- return this.get(e, Ha);
980
- }
981
- getText(e = "") {
982
- return this.get(e, co);
983
- }
984
- getMap(e = "") {
985
- return this.get(e, Ga);
986
- }
987
- getXmlElement(e = "") {
988
- return this.get(e, mo);
989
- }
990
- getXmlFragment(e = "") {
991
- return this.get(e, fo);
992
- }
993
- toJSON() {
994
- let e = {};
995
- return this.share.forEach((t, n) => {
996
- e[n] = t.toJSON();
997
- }), e;
998
- }
999
- destroy() {
1000
- this.isDestroyed = !0, m(this.subdocs).forEach((e) => e.destroy());
1001
- let t = this._item;
1002
- if (t !== null) {
1003
- this._item = null;
1004
- let n = t.content;
1005
- n.doc = new e({
1006
- guid: this.guid,
1007
- ...n.opts,
1008
- shouldLoad: !1
1009
- }), n.doc._item = t, W(t.parent.doc, (e) => {
1010
- let r = n.doc;
1011
- t.deleted || e.subdocsAdded.add(r), e.subdocsRemoved.add(this);
1012
- }, null, !0);
1013
- }
1014
- this.emit("destroyed", [!0]), this.emit("destroy", [this]), super.destroy();
1015
- }
1016
- }, Zr = class {
1017
- constructor(e) {
1018
- this.restDecoder = e;
1019
- }
1020
- resetDsCurVal() {}
1021
- readDsClock() {
1022
- return O(this.restDecoder);
1023
- }
1024
- readDsLen() {
1025
- return O(this.restDecoder);
1026
- }
1027
- }, Qr = class extends Zr {
1028
- readLeftID() {
1029
- return B(O(this.restDecoder), O(this.restDecoder));
1030
- }
1031
- readRightID() {
1032
- return B(O(this.restDecoder), O(this.restDecoder));
1033
- }
1034
- readClient() {
1035
- return O(this.restDecoder);
1036
- }
1037
- readInfo() {
1038
- return et(this.restDecoder);
1039
- }
1040
- readString() {
1041
- return k(this.restDecoder);
1042
- }
1043
- readParentInfo() {
1044
- return O(this.restDecoder) === 1;
1045
- }
1046
- readTypeRef() {
1047
- return O(this.restDecoder);
1048
- }
1049
- readLen() {
1050
- return O(this.restDecoder);
1051
- }
1052
- readAny() {
1053
- return it(this.restDecoder);
1054
- }
1055
- readBuf() {
1056
- return tn(D(this.restDecoder));
1057
- }
1058
- readJSON() {
1059
- return JSON.parse(k(this.restDecoder));
1060
- }
1061
- readKey() {
1062
- return k(this.restDecoder);
1063
- }
1064
- }, $r = class {
1065
- constructor(e) {
1066
- this.dsCurrVal = 0, this.restDecoder = e;
1067
- }
1068
- resetDsCurVal() {
1069
- this.dsCurrVal = 0;
1070
- }
1071
- readDsClock() {
1072
- return this.dsCurrVal += O(this.restDecoder), this.dsCurrVal;
1073
- }
1074
- readDsLen() {
1075
- let e = O(this.restDecoder) + 1;
1076
- return this.dsCurrVal += e, e;
1077
- }
1078
- }, ei = class extends $r {
1079
- constructor(e) {
1080
- super(e), this.keys = [], O(e), this.keyClockDecoder = new st(D(e)), this.clientDecoder = new ot(D(e)), this.leftClockDecoder = new st(D(e)), this.rightClockDecoder = new st(D(e)), this.infoDecoder = new at(D(e), et), this.stringDecoder = new ct(D(e)), this.parentInfoDecoder = new at(D(e), et), this.typeRefDecoder = new ot(D(e)), this.lenDecoder = new ot(D(e));
1081
- }
1082
- readLeftID() {
1083
- return new Ei(this.clientDecoder.read(), this.leftClockDecoder.read());
1084
- }
1085
- readRightID() {
1086
- return new Ei(this.clientDecoder.read(), this.rightClockDecoder.read());
1087
- }
1088
- readClient() {
1089
- return this.clientDecoder.read();
1090
- }
1091
- readInfo() {
1092
- return this.infoDecoder.read();
1093
- }
1094
- readString() {
1095
- return this.stringDecoder.read();
1096
- }
1097
- readParentInfo() {
1098
- return this.parentInfoDecoder.read() === 1;
1099
- }
1100
- readTypeRef() {
1101
- return this.typeRefDecoder.read();
1102
- }
1103
- readLen() {
1104
- return this.lenDecoder.read();
1105
- }
1106
- readAny() {
1107
- return it(this.restDecoder);
1108
- }
1109
- readBuf() {
1110
- return D(this.restDecoder);
1111
- }
1112
- readJSON() {
1113
- return it(this.restDecoder);
1114
- }
1115
- readKey() {
1116
- let e = this.keyClockDecoder.read();
1117
- if (e < this.keys.length) return this.keys[e];
1118
- {
1119
- let e = this.stringDecoder.read();
1120
- return this.keys.push(e), e;
1121
- }
1122
- }
1123
- }, ti = class {
1124
- constructor() {
1125
- this.restEncoder = _();
1126
- }
1127
- toUint8Array() {
1128
- return v(this.restEncoder);
1129
- }
1130
- resetDsCurVal() {}
1131
- writeDsClock(e) {
1132
- b(this.restEncoder, e);
1133
- }
1134
- writeDsLen(e) {
1135
- b(this.restEncoder, e);
1136
- }
1137
- }, ni = class extends ti {
1138
- writeLeftID(e) {
1139
- b(this.restEncoder, e.client), b(this.restEncoder, e.clock);
1140
- }
1141
- writeRightID(e) {
1142
- b(this.restEncoder, e.client), b(this.restEncoder, e.clock);
1143
- }
1144
- writeClient(e) {
1145
- b(this.restEncoder, e);
1146
- }
1147
- writeInfo(e) {
1148
- je(this.restEncoder, e);
1149
- }
1150
- writeString(e) {
1151
- x(this.restEncoder, e);
1152
- }
1153
- writeParentInfo(e) {
1154
- b(this.restEncoder, e ? 1 : 0);
1155
- }
1156
- writeTypeRef(e) {
1157
- b(this.restEncoder, e);
1158
- }
1159
- writeLen(e) {
1160
- b(this.restEncoder, e);
1161
- }
1162
- writeAny(e) {
1163
- He(this.restEncoder, e);
1164
- }
1165
- writeBuf(e) {
1166
- S(this.restEncoder, e);
1167
- }
1168
- writeJSON(e) {
1169
- x(this.restEncoder, JSON.stringify(e));
1170
- }
1171
- writeKey(e) {
1172
- x(this.restEncoder, e);
1173
- }
1174
- }, ri = class {
1175
- constructor() {
1176
- this.restEncoder = _(), this.dsCurrVal = 0;
1177
- }
1178
- toUint8Array() {
1179
- return v(this.restEncoder);
1180
- }
1181
- resetDsCurVal() {
1182
- this.dsCurrVal = 0;
1183
- }
1184
- writeDsClock(e) {
1185
- let t = e - this.dsCurrVal;
1186
- this.dsCurrVal = e, b(this.restEncoder, t);
1187
- }
1188
- writeDsLen(e) {
1189
- e === 0 && T(), b(this.restEncoder, e - 1), this.dsCurrVal += e;
1190
- }
1191
- }, z = class extends ri {
1192
- constructor() {
1193
- super(), this.keyMap = /* @__PURE__ */ new Map(), this.keyClock = 0, this.keyClockEncoder = new qe(), this.clientEncoder = new Ge(), this.leftClockEncoder = new qe(), this.rightClockEncoder = new qe(), this.infoEncoder = new Ue(je), this.stringEncoder = new Je(), this.parentInfoEncoder = new Ue(je), this.typeRefEncoder = new Ge(), this.lenEncoder = new Ge();
1194
- }
1195
- toUint8Array() {
1196
- let e = _();
1197
- return b(e, 0), S(e, this.keyClockEncoder.toUint8Array()), S(e, this.clientEncoder.toUint8Array()), S(e, this.leftClockEncoder.toUint8Array()), S(e, this.rightClockEncoder.toUint8Array()), S(e, v(this.infoEncoder)), S(e, this.stringEncoder.toUint8Array()), S(e, v(this.parentInfoEncoder)), S(e, this.typeRefEncoder.toUint8Array()), S(e, this.lenEncoder.toUint8Array()), Fe(e, v(this.restEncoder)), v(e);
1198
- }
1199
- writeLeftID(e) {
1200
- this.clientEncoder.write(e.client), this.leftClockEncoder.write(e.clock);
1201
- }
1202
- writeRightID(e) {
1203
- this.clientEncoder.write(e.client), this.rightClockEncoder.write(e.clock);
1204
- }
1205
- writeClient(e) {
1206
- this.clientEncoder.write(e);
1207
- }
1208
- writeInfo(e) {
1209
- this.infoEncoder.write(e);
1210
- }
1211
- writeString(e) {
1212
- this.stringEncoder.write(e);
1213
- }
1214
- writeParentInfo(e) {
1215
- this.parentInfoEncoder.write(e ? 1 : 0);
1216
- }
1217
- writeTypeRef(e) {
1218
- this.typeRefEncoder.write(e);
1219
- }
1220
- writeLen(e) {
1221
- this.lenEncoder.write(e);
1222
- }
1223
- writeAny(e) {
1224
- He(this.restEncoder, e);
1225
- }
1226
- writeBuf(e) {
1227
- S(this.restEncoder, e);
1228
- }
1229
- writeJSON(e) {
1230
- He(this.restEncoder, e);
1231
- }
1232
- writeKey(e) {
1233
- let t = this.keyMap.get(e);
1234
- t === void 0 ? (this.keyClockEncoder.write(this.keyClock++), this.stringEncoder.write(e)) : this.keyClockEncoder.write(t);
1235
- }
1236
- }, ii = (e, t, n, r) => {
1237
- r = g(r, t[0].id.clock);
1238
- let i = H(t, r);
1239
- b(e.restEncoder, t.length - i), e.writeClient(n), b(e.restEncoder, r);
1240
- let a = t[i];
1241
- a.write(e, r - a.id.clock);
1242
- for (let n = i + 1; n < t.length; n++) t[n].write(e, 0);
1243
- }, ai = (e, t, n) => {
1244
- let r = /* @__PURE__ */ new Map();
1245
- n.forEach((e, n) => {
1246
- V(t, n) > e && r.set(n, e);
1247
- }), Bi(t).forEach((e, t) => {
1248
- n.has(t) || r.set(t, 0);
1249
- }), b(e.restEncoder, r.size), m(r.entries()).sort((e, t) => t[0] - e[0]).forEach(([n, r]) => {
1250
- ii(e, t.clients.get(n), n, r);
1251
- });
1252
- }, oi = (e, t) => {
1253
- let n = u(), r = O(e.restDecoder);
1254
- for (let i = 0; i < r; i++) {
1255
- let r = O(e.restDecoder), i = Array(r), a = e.readClient(), o = O(e.restDecoder);
1256
- n.set(a, {
1257
- i: 0,
1258
- refs: i
1259
- });
1260
- for (let n = 0; n < r; n++) {
1261
- let r = e.readInfo();
1262
- switch (31 & r) {
1263
- case 0: {
1264
- let t = e.readLen();
1265
- i[n] = new Y(B(a, o), t), o += t;
1266
- break;
1267
- }
1268
- case 10: {
1269
- let t = O(e.restDecoder);
1270
- i[n] = new $(B(a, o), t), o += t;
1271
- break;
1272
- }
1273
- default: {
1274
- let s = (r & 192) == 0, c = new Q(B(a, o), null, (r & 128) == 128 ? e.readLeftID() : null, null, (r & 64) == 64 ? e.readRightID() : null, s ? e.readParentInfo() ? t.get(e.readString()) : e.readLeftID() : null, s && (r & 32) == 32 ? e.readString() : null, Zo(e, r));
1275
- i[n] = c, o += c.length;
1276
- }
1277
- }
1278
- }
1279
- }
1280
- return n;
1281
- }, si = (e, t, n) => {
1282
- let r = [], i = m(n.keys()).sort((e, t) => e - t);
1283
- if (i.length === 0) return null;
1284
- let a = () => {
1285
- if (i.length === 0) return null;
1286
- let e = n.get(i[i.length - 1]);
1287
- for (; e.refs.length === e.i;) if (i.pop(), i.length > 0) e = n.get(i[i.length - 1]);
1288
- else return null;
1289
- return e;
1290
- }, o = a();
1291
- if (o === null) return null;
1292
- let s = new zi(), c = /* @__PURE__ */ new Map(), l = (e, t) => {
1293
- let n = c.get(e);
1294
- (n == null || n > t) && c.set(e, t);
1295
- }, u = o.refs[o.i++], d = /* @__PURE__ */ new Map(), ee = () => {
1296
- for (let e of r) {
1297
- let t = e.id.client, r = n.get(t);
1298
- r ? (r.i--, s.clients.set(t, r.refs.slice(r.i)), n.delete(t), r.i = 0, r.refs = []) : s.clients.set(t, [e]), i = i.filter((e) => e !== t);
1299
- }
1300
- r.length = 0;
1301
- };
1302
- for (;;) {
1303
- if (u.constructor !== $) {
1304
- let i = f(d, u.id.client, () => V(t, u.id.client)) - u.id.clock;
1305
- if (i < 0) r.push(u), l(u.id.client, u.id.clock - 1), ee();
1306
- else {
1307
- let a = u.getMissing(e, t);
1308
- if (a !== null) {
1309
- r.push(u);
1310
- let e = n.get(a) || {
1311
- refs: [],
1312
- i: 0
1313
- };
1314
- if (e.refs.length === e.i) l(a, V(t, a)), ee();
1315
- else {
1316
- u = e.refs[e.i++];
1317
- continue;
1318
- }
1319
- } else (i === 0 || i < u.length) && (u.integrate(e, i), d.set(u.id.client, u.id.clock + u.length));
1320
- }
1321
- }
1322
- if (r.length > 0) u = r.pop();
1323
- else if (o !== null && o.i < o.refs.length) u = o.refs[o.i++];
1324
- else {
1325
- if (o = a(), o === null) break;
1326
- u = o.refs[o.i++];
1327
- }
1328
- }
1329
- if (s.clients.size > 0) {
1330
- let e = new z();
1331
- return ai(e, s, /* @__PURE__ */ new Map()), b(e.restEncoder, 0), {
1332
- missing: c,
1333
- update: e.toUint8Array()
1334
- };
1335
- }
1336
- return null;
1337
- }, ci = (e, t) => ai(e, t.doc.store, t.beforeState), li = (e, t, n, r = new ei(e)) => W(t, (e) => {
1338
- e.local = !1;
1339
- let t = !1, n = e.doc, i = n.store, a = si(e, i, oi(r, n)), o = i.pendingStructs;
1340
- if (o) {
1341
- for (let [e, n] of o.missing) if (n < V(i, e)) {
1342
- t = !0;
1343
- break;
1344
- }
1345
- if (a) {
1346
- for (let [e, t] of a.missing) {
1347
- let n = o.missing.get(e);
1348
- (n == null || n > t) && o.missing.set(e, t);
1349
- }
1350
- o.update = aa([o.update, a.update]);
1351
- }
1352
- } else i.pendingStructs = a;
1353
- let s = Jr(r, e, i);
1354
- if (i.pendingDs) {
1355
- let t = new ei(E(i.pendingDs));
1356
- O(t.restDecoder);
1357
- let n = Jr(t, e, i);
1358
- s && n ? i.pendingDs = aa([s, n]) : i.pendingDs = s || n;
1359
- } else i.pendingDs = s;
1360
- if (t) {
1361
- let t = i.pendingStructs.update;
1362
- i.pendingStructs = null, ui(e.doc, t);
1363
- }
1364
- }, n, !1), ui = (e, t, n, r = ei) => {
1365
- let i = E(t);
1366
- li(i, e, n, new r(i));
1367
- }, di = (e, t, n) => ui(e, t, n, Qr), fi = (e, t, n = /* @__PURE__ */ new Map()) => {
1368
- ai(e, t.store, n), Kr(e, Gr(t.store));
1369
- }, pi = (e, t = new Uint8Array([0]), n = new z()) => {
1370
- fi(n, e, gi(t));
1371
- let r = [n.toUint8Array()];
1372
- if (e.store.pendingDs && r.push(e.store.pendingDs), e.store.pendingStructs && r.push(oa(e.store.pendingStructs.update, t)), r.length > 1) {
1373
- if (n.constructor === ni) return ra(r.map((e, t) => t === 0 ? e : ua(e)));
1374
- if (n.constructor === z) return aa(r);
1375
- }
1376
- return r[0];
1377
- }, mi = (e, t) => pi(e, t, new ni()), hi = (e) => {
1378
- let t = /* @__PURE__ */ new Map(), n = O(e.restDecoder);
1379
- for (let r = 0; r < n; r++) {
1380
- let n = O(e.restDecoder), r = O(e.restDecoder);
1381
- t.set(n, r);
1382
- }
1383
- return t;
1384
- }, gi = (e) => hi(new Zr(E(e))), _i = (e, t) => (b(e.restEncoder, t.size), m(t.entries()).sort((e, t) => t[0] - e[0]).forEach(([t, n]) => {
1385
- b(e.restEncoder, t), b(e.restEncoder, n);
1386
- }), e), vi = (e, t) => _i(e, Bi(t.store)), yi = (e, t = new ri()) => (e instanceof Map ? _i(t, e) : vi(t, e), t.toUint8Array()), bi = (e) => yi(e, new ti()), xi = class {
1387
- constructor() {
1388
- this.l = [];
1389
- }
1390
- }, Si = () => new xi(), Ci = (e, t) => e.l.push(t), wi = (e, t) => {
1391
- let n = e.l, r = n.length;
1392
- e.l = n.filter((e) => t !== e), r === e.l.length && console.error("[yjs] Tried to remove event handler that doesn't exist.");
1393
- }, Ti = (e, t, n) => Pt(e.l, [t, n]), Ei = class {
1394
- constructor(e, t) {
1395
- this.client = e, this.clock = t;
1396
- }
1397
- }, Di = (e, t) => e === t || e !== null && t !== null && e.client === t.client && e.clock === t.clock, B = (e, t) => new Ei(e, t), Oi = (e) => {
1398
- for (let [t, n] of e.doc.share.entries()) if (n === e) return t;
1399
- throw T();
1400
- }, ki = class {
1401
- constructor(e, t, n, r = 0) {
1402
- this.type = e, this.tname = t, this.item = n, this.assoc = r;
1403
- }
1404
- }, Ai = class {
1405
- constructor(e, t, n = 0) {
1406
- this.type = e, this.index = t, this.assoc = n;
1407
- }
1408
- }, ji = (e, t, n = 0) => new Ai(e, t, n), Mi = (e, t, n) => {
1409
- let r = null, i = null;
1410
- return e._item === null ? i = Oi(e) : r = B(e._item.id.client, e._item.id.clock), new ki(r, i, t, n);
1411
- }, Ni = (e, t, n = 0) => {
1412
- let r = e._start;
1413
- if (n < 0) {
1414
- if (t === 0) return Mi(e, null, n);
1415
- t--;
1416
- }
1417
- for (; r !== null;) {
1418
- if (!r.deleted && r.countable) {
1419
- if (r.length > t) return Mi(e, B(r.id.client, r.id.clock + t), n);
1420
- t -= r.length;
1421
- }
1422
- if (r.right === null && n < 0) return Mi(e, r.lastId, n);
1423
- r = r.right;
1424
- }
1425
- return Mi(e, null, n);
1426
- }, Pi = (e, t) => {
1427
- let n = Hi(e, t);
1428
- return {
1429
- item: n,
1430
- diff: t.clock - n.id.clock
1431
- };
1432
- }, Fi = (e, t, n = !0) => {
1433
- let r = t.store, i = e.item, a = e.type, o = e.tname, s = e.assoc, c = null, l = 0;
1434
- if (i !== null) {
1435
- if (V(r, i.client) <= i.clock) return null;
1436
- let e = n ? Yo(r, i) : Pi(r, i), t = e.item;
1437
- if (!(t instanceof Q)) return null;
1438
- if (c = t.parent, c._item === null || !c._item.deleted) {
1439
- l = t.deleted || !t.countable ? 0 : e.diff + (s >= 0 ? 0 : 1);
1440
- let n = t.left;
1441
- for (; n !== null;) !n.deleted && n.countable && (l += n.length), n = n.left;
1442
- }
1443
- } else {
1444
- if (o !== null) c = t.get(o);
1445
- else if (a !== null) {
1446
- if (V(r, a.client) <= a.clock) return null;
1447
- let { item: e } = n ? Yo(r, a) : { item: Hi(r, a) };
1448
- if (e instanceof Q && e.content instanceof Z) c = e.content.type;
1449
- else return null;
1450
- } else throw T();
1451
- l = s >= 0 ? c._length : 0;
1452
- }
1453
- return ji(c, l, e.assoc);
1454
- }, Ii = class {
1455
- constructor(e, t) {
1456
- this.ds = e, this.sv = t;
1457
- }
1458
- };
1459
- ((e, t) => new Ii(e, t))(Wr(), /* @__PURE__ */ new Map());
1460
- var Li = (e, t) => t === void 0 ? !e.deleted : t.sv.has(e.id.client) && (t.sv.get(e.id.client) || 0) > e.id.clock && !Br(t.ds, e.id), Ri = (e, t) => {
1461
- let n = f(e.meta, Ri, p), r = e.doc.store;
1462
- n.has(t) || (t.sv.forEach((t, n) => {
1463
- t < V(r, n) && U(e, B(n, t));
1464
- }), Rr(e, t.ds, (e) => {}), n.add(t));
1465
- }, zi = class {
1466
- constructor() {
1467
- this.clients = /* @__PURE__ */ new Map(), this.pendingStructs = null, this.pendingDs = null;
1468
- }
1469
- }, Bi = (e) => {
1470
- let t = /* @__PURE__ */ new Map();
1471
- return e.clients.forEach((e, n) => {
1472
- let r = e[e.length - 1];
1473
- t.set(n, r.id.clock + r.length);
1474
- }), t;
1475
- }, V = (e, t) => {
1476
- let n = e.clients.get(t);
1477
- if (n === void 0) return 0;
1478
- let r = n[n.length - 1];
1479
- return r.id.clock + r.length;
1480
- }, Vi = (e, t) => {
1481
- let n = e.clients.get(t.id.client);
1482
- if (n === void 0) n = [], e.clients.set(t.id.client, n);
1483
- else {
1484
- let e = n[n.length - 1];
1485
- if (e.id.clock + e.length !== t.id.clock) throw T();
1486
- }
1487
- n.push(t);
1488
- }, H = (e, t) => {
1489
- let n = 0, r = e.length - 1, i = e[r], a = i.id.clock;
1490
- if (a === t) return r;
1491
- let o = h(t / (a + i.length - 1) * r);
1492
- for (; n <= r;) {
1493
- if (i = e[o], a = i.id.clock, a <= t) {
1494
- if (t < a + i.length) return o;
1495
- n = o + 1;
1496
- } else r = o - 1;
1497
- o = h((n + r) / 2);
1498
- }
1499
- throw T();
1500
- }, Hi = (e, t) => {
1501
- let n = e.clients.get(t.client);
1502
- return n[H(n, t.clock)];
1503
- }, Ui = (e, t, n) => {
1504
- let r = H(t, n), i = t[r];
1505
- return i.id.clock < n && i instanceof Q ? (t.splice(r + 1, 0, Xo(e, i, n - i.id.clock)), r + 1) : r;
1506
- }, U = (e, t) => {
1507
- let n = e.doc.store.clients.get(t.client);
1508
- return n[Ui(e, n, t.clock)];
1509
- }, Wi = (e, t, n) => {
1510
- let r = t.clients.get(n.client), i = H(r, n.clock), a = r[i];
1511
- return n.clock !== a.id.clock + a.length - 1 && a.constructor !== Y && r.splice(i + 1, 0, Xo(e, a, n.clock - a.id.clock + 1)), a;
1512
- }, Gi = (e, t, n) => {
1513
- let r = e.clients.get(t.id.client);
1514
- r[H(r, t.id.clock)] = n;
1515
- }, Ki = (e, t, n, r, i) => {
1516
- if (r === 0) return;
1517
- let a = n + r, o = Ui(e, t, n), s;
1518
- do
1519
- s = t[o++], a < s.id.clock + s.length && Ui(e, t, a), i(s);
1520
- while (o < t.length && t[o].id.clock < a);
1521
- }, qi = class {
1522
- constructor(e, t, n) {
1523
- this.doc = e, this.deleteSet = new Lr(), this.beforeState = Bi(e.store), this.afterState = /* @__PURE__ */ new Map(), this.changed = /* @__PURE__ */ new Map(), this.changedParentTypes = /* @__PURE__ */ new Map(), this._mergeStructs = [], this.origin = t, this.meta = /* @__PURE__ */ new Map(), this.local = n, this.subdocsAdded = /* @__PURE__ */ new Set(), this.subdocsRemoved = /* @__PURE__ */ new Set(), this.subdocsLoaded = /* @__PURE__ */ new Set(), this._needFormattingCleanup = !1;
1524
- }
1525
- }, Ji = (e, t) => t.deleteSet.clients.size === 0 && !te(t.afterState, (e, n) => t.beforeState.get(n) !== e) ? !1 : (Vr(t.deleteSet), ci(e, t), Kr(e, t.deleteSet), !0), Yi = (e, t, n) => {
1526
- let r = t._item;
1527
- (r === null || r.id.clock < (e.beforeState.get(r.id.client) || 0) && !r.deleted) && f(e.changed, t, p).add(n);
1528
- }, Xi = (e, t) => {
1529
- let n = e[t], r = e[t - 1], i = t;
1530
- for (; i > 0; n = r, r = e[--i - 1]) {
1531
- if (r.deleted === n.deleted && r.constructor === n.constructor && r.mergeWith(n)) {
1532
- n instanceof Q && n.parentSub !== null && n.parent._map.get(n.parentSub) === n && n.parent._map.set(n.parentSub, r);
1533
- continue;
1534
- }
1535
- break;
1536
- }
1537
- let a = t - i;
1538
- return a && e.splice(t + 1 - a, a), a;
1539
- }, Zi = (e, t, n) => {
1540
- for (let [r, i] of e.clients.entries()) {
1541
- let e = t.clients.get(r);
1542
- for (let r = i.length - 1; r >= 0; r--) {
1543
- let a = i[r], o = a.clock + a.len;
1544
- for (let r = H(e, a.clock), i = e[r]; r < e.length && i.id.clock < o; i = e[++r]) {
1545
- let i = e[r];
1546
- if (a.clock + a.len <= i.id.clock) break;
1547
- i instanceof Q && i.deleted && !i.keep && n(i) && i.gc(t, !1);
1548
- }
1549
- }
1550
- }
1551
- }, Qi = (e, t) => {
1552
- e.clients.forEach((e, n) => {
1553
- let r = t.clients.get(n);
1554
- for (let t = e.length - 1; t >= 0; t--) {
1555
- let n = e[t], i = de(r.length - 1, 1 + H(r, n.clock + n.len - 1));
1556
- for (let e = i, t = r[e]; e > 0 && t.id.clock >= n.clock; t = r[e]) e -= 1 + Xi(r, e);
1557
- }
1558
- });
1559
- }, $i = (e, t) => {
1560
- if (t < e.length) {
1561
- let n = e[t], r = n.doc, i = r.store, a = n.deleteSet, o = n._mergeStructs;
1562
- try {
1563
- Vr(a), n.afterState = Bi(n.doc.store), r.emit("beforeObserverCalls", [n, r]);
1564
- let e = [];
1565
- n.changed.forEach((t, r) => e.push(() => {
1566
- (r._item === null || !r._item.deleted) && r._callObserver(n, t);
1567
- })), e.push(() => {
1568
- n.changedParentTypes.forEach((t, r) => {
1569
- r._dEH.l.length > 0 && (r._item === null || !r._item.deleted) && (t = t.filter((e) => e.target._item === null || !e.target._item.deleted), t.forEach((e) => {
1570
- e.currentTarget = r, e._path = null;
1571
- }), t.sort((e, t) => e.path.length - t.path.length), e.push(() => {
1572
- Ti(r._dEH, t, n);
1573
- }));
1574
- }), e.push(() => r.emit("afterTransaction", [n, r])), e.push(() => {
1575
- n._needFormattingCleanup && ao(n);
1576
- });
1577
- }), Pt(e, []);
1578
- } finally {
1579
- r.gc && Zi(a, i, r.gcFilter), Qi(a, i), n.afterState.forEach((e, t) => {
1580
- let r = n.beforeState.get(t) || 0;
1581
- if (r !== e) {
1582
- let e = i.clients.get(t), n = g(H(e, r), 1);
1583
- for (let t = e.length - 1; t >= n;) t -= 1 + Xi(e, t);
1584
- }
1585
- });
1586
- for (let e = o.length - 1; e >= 0; e--) {
1587
- let { client: t, clock: n } = o[e].id, r = i.clients.get(t), a = H(r, n);
1588
- a + 1 < r.length && Xi(r, a + 1) > 1 || a > 0 && Xi(r, a);
1589
- }
1590
- if (!n.local && n.afterState.get(r.clientID) !== n.beforeState.get(r.clientID) && (Ar(Tr, vr, "[yjs] ", yr, Cr, "Changed the client-id because another client seems to be using it."), r.clientID = Yr()), r.emit("afterTransactionCleanup", [n, r]), r._observers.has("update")) {
1591
- let e = new ni();
1592
- Ji(e, n) && r.emit("update", [
1593
- e.toUint8Array(),
1594
- n.origin,
1595
- r,
1596
- n
1597
- ]);
1598
- }
1599
- if (r._observers.has("updateV2")) {
1600
- let e = new z();
1601
- Ji(e, n) && r.emit("updateV2", [
1602
- e.toUint8Array(),
1603
- n.origin,
1604
- r,
1605
- n
1606
- ]);
1607
- }
1608
- let { subdocsAdded: s, subdocsLoaded: c, subdocsRemoved: l } = n;
1609
- (s.size > 0 || l.size > 0 || c.size > 0) && (s.forEach((e) => {
1610
- e.clientID = r.clientID, e.collectionid ??= r.collectionid, r.subdocs.add(e);
1611
- }), l.forEach((e) => r.subdocs.delete(e)), r.emit("subdocs", [
1612
- {
1613
- loaded: c,
1614
- added: s,
1615
- removed: l
1616
- },
1617
- r,
1618
- n
1619
- ]), l.forEach((e) => e.destroy())), e.length <= t + 1 ? (r._transactionCleanups = [], r.emit("afterAllTransactions", [r, e])) : $i(e, t + 1);
1620
- }
1621
- }
1622
- }, W = (e, t, n = null, r = !0) => {
1623
- let i = e._transactionCleanups, a = !1, o = null;
1624
- e._transaction === null && (a = !0, e._transaction = new qi(e, n, r), i.push(e._transaction), i.length === 1 && e.emit("beforeAllTransactions", [e]), e.emit("beforeTransaction", [e._transaction, e]));
1625
- try {
1626
- o = t(e._transaction);
1627
- } finally {
1628
- if (a) {
1629
- let t = e._transaction === i[0];
1630
- e._transaction = null, t && $i(i, 0);
1631
- }
1632
- }
1633
- return o;
1634
- };
1635
- function* ea(e) {
1636
- let t = O(e.restDecoder);
1637
- for (let n = 0; n < t; n++) {
1638
- let t = O(e.restDecoder), n = e.readClient(), r = O(e.restDecoder);
1639
- for (let i = 0; i < t; i++) {
1640
- let t = e.readInfo();
1641
- if (t === 10) {
1642
- let t = O(e.restDecoder);
1643
- yield new $(B(n, r), t), r += t;
1644
- } else if (31 & t) {
1645
- let i = (t & 192) == 0, a = new Q(B(n, r), null, (t & 128) == 128 ? e.readLeftID() : null, null, (t & 64) == 64 ? e.readRightID() : null, i ? e.readParentInfo() ? e.readString() : e.readLeftID() : null, i && (t & 32) == 32 ? e.readString() : null, Zo(e, t));
1646
- yield a, r += a.length;
1647
- } else {
1648
- let t = e.readLen();
1649
- yield new Y(B(n, r), t), r += t;
1650
- }
1651
- }
1652
- }
1653
- }
1654
- var ta = class {
1655
- constructor(e, t) {
1656
- this.gen = ea(e), this.curr = null, this.done = !1, this.filterSkips = t, this.next();
1657
- }
1658
- next() {
1659
- do
1660
- this.curr = this.gen.next().value || null;
1661
- while (this.filterSkips && this.curr !== null && this.curr.constructor === $);
1662
- return this.curr;
1663
- }
1664
- }, na = class {
1665
- constructor(e) {
1666
- this.currClient = 0, this.startClock = 0, this.written = 0, this.encoder = e, this.clientStructs = [];
1667
- }
1668
- }, ra = (e) => aa(e, Qr, ni), ia = (e, t) => {
1669
- if (e.constructor === Y) {
1670
- let { client: n, clock: r } = e.id;
1671
- return new Y(B(n, r + t), e.length - t);
1672
- } else if (e.constructor === $) {
1673
- let { client: n, clock: r } = e.id;
1674
- return new $(B(n, r + t), e.length - t);
1675
- } else {
1676
- let n = e, { client: r, clock: i } = n.id;
1677
- return new Q(B(r, i + t), null, B(r, i + t - 1), null, n.rightOrigin, n.parent, n.parentSub, n.content.splice(t));
1678
- }
1679
- }, aa = (e, t = ei, n = z) => {
1680
- if (e.length === 1) return e[0];
1681
- let r = e.map((e) => new t(E(e))), i = r.map((e) => new ta(e, !0)), a = null, o = new n(), s = new na(o);
1682
- for (; i = i.filter((e) => e.curr !== null), i.sort((e, t) => {
1683
- if (e.curr.id.client === t.curr.id.client) {
1684
- let n = e.curr.id.clock - t.curr.id.clock;
1685
- return n === 0 ? e.curr.constructor === t.curr.constructor ? 0 : e.curr.constructor === $ ? 1 : -1 : n;
1686
- } else return t.curr.id.client - e.curr.id.client;
1687
- }), i.length !== 0;) {
1688
- let e = i[0], t = e.curr.id.client;
1689
- if (a !== null) {
1690
- let n = e.curr, r = !1;
1691
- for (; n !== null && n.id.clock + n.length <= a.struct.id.clock + a.struct.length && n.id.client >= a.struct.id.client;) n = e.next(), r = !0;
1692
- if (n === null || n.id.client !== t || r && n.id.clock > a.struct.id.clock + a.struct.length) continue;
1693
- if (t !== a.struct.id.client) G(s, a.struct, a.offset), a = {
1694
- struct: n,
1695
- offset: 0
1696
- }, e.next();
1697
- else if (a.struct.id.clock + a.struct.length < n.id.clock) if (a.struct.constructor === $) a.struct.length = n.id.clock + n.length - a.struct.id.clock;
1698
- else {
1699
- G(s, a.struct, a.offset);
1700
- let e = n.id.clock - a.struct.id.clock - a.struct.length;
1701
- a = {
1702
- struct: new $(B(t, a.struct.id.clock + a.struct.length), e),
1703
- offset: 0
1704
- };
1705
- }
1706
- else {
1707
- let t = a.struct.id.clock + a.struct.length - n.id.clock;
1708
- t > 0 && (a.struct.constructor === $ ? a.struct.length -= t : n = ia(n, t)), a.struct.mergeWith(n) || (G(s, a.struct, a.offset), a = {
1709
- struct: n,
1710
- offset: 0
1711
- }, e.next());
1712
- }
1713
- } else a = {
1714
- struct: e.curr,
1715
- offset: 0
1716
- }, e.next();
1717
- for (let n = e.curr; n !== null && n.id.client === t && n.id.clock === a.struct.id.clock + a.struct.length && n.constructor !== $; n = e.next()) G(s, a.struct, a.offset), a = {
1718
- struct: n,
1719
- offset: 0
1720
- };
1721
- }
1722
- return a !== null && (G(s, a.struct, a.offset), a = null), ca(s), Kr(o, Hr(r.map((e) => qr(e)))), o.toUint8Array();
1723
- }, oa = (e, t, n = ei, r = z) => {
1724
- let i = gi(t), a = new r(), o = new na(a), s = new n(E(e)), c = new ta(s, !1);
1725
- for (; c.curr;) {
1726
- let e = c.curr, t = e.id.client, n = i.get(t) || 0;
1727
- if (c.curr.constructor === $) {
1728
- c.next();
1729
- continue;
1730
- }
1731
- if (e.id.clock + e.length > n) for (G(o, e, g(n - e.id.clock, 0)), c.next(); c.curr && c.curr.id.client === t;) G(o, c.curr, 0), c.next();
1732
- else for (; c.curr && c.curr.id.client === t && c.curr.id.clock + c.curr.length <= n;) c.next();
1733
- }
1734
- return ca(o), Kr(a, qr(s)), a.toUint8Array();
1735
- }, sa = (e) => {
1736
- e.written > 0 && (e.clientStructs.push({
1737
- written: e.written,
1738
- restEncoder: v(e.encoder.restEncoder)
1739
- }), e.encoder.restEncoder = _(), e.written = 0);
1740
- }, G = (e, t, n) => {
1741
- e.written > 0 && e.currClient !== t.id.client && sa(e), e.written === 0 && (e.currClient = t.id.client, e.encoder.writeClient(t.id.client), b(e.encoder.restEncoder, t.id.clock + n)), t.write(e.encoder, n), e.written++;
1742
- }, ca = (e) => {
1743
- sa(e);
1744
- let t = e.encoder.restEncoder;
1745
- b(t, e.clientStructs.length);
1746
- for (let n = 0; n < e.clientStructs.length; n++) {
1747
- let r = e.clientStructs[n];
1748
- b(t, r.written), Fe(t, r.restEncoder);
1749
- }
1750
- }, la = (e, t, n, r) => {
1751
- let i = new n(E(e)), a = new ta(i, !1), o = new r(), s = new na(o);
1752
- for (let e = a.curr; e !== null; e = a.next()) G(s, t(e), 0);
1753
- return ca(s), Kr(o, qr(i)), o.toUint8Array();
1754
- }, ua = (e) => la(e, Ft, ei, ni), da = "You must not compute changes after the event-handler fired.", fa = class {
1755
- constructor(e, t) {
1756
- this.target = e, this.currentTarget = e, this.transaction = t, this._changes = null, this._keys = null, this._delta = null, this._path = null;
1757
- }
1758
- get path() {
1759
- return this._path ||= pa(this.currentTarget, this.target);
1760
- }
1761
- deletes(e) {
1762
- return Br(this.transaction.deleteSet, e.id);
1763
- }
1764
- get keys() {
1765
- if (this._keys === null) {
1766
- if (this.transaction.doc._transactionCleanups.length === 0) throw C(da);
1767
- let e = /* @__PURE__ */ new Map(), t = this.target;
1768
- this.transaction.changed.get(t).forEach((n) => {
1769
- if (n !== null) {
1770
- let r = t._map.get(n), i, a;
1771
- if (this.adds(r)) {
1772
- let e = r.left;
1773
- for (; e !== null && this.adds(e);) e = e.left;
1774
- if (this.deletes(r)) if (e !== null && this.deletes(e)) i = "delete", a = ne(e.content.getContent());
1775
- else return;
1776
- else e !== null && this.deletes(e) ? (i = "update", a = ne(e.content.getContent())) : (i = "add", a = void 0);
1777
- } else if (this.deletes(r)) i = "delete", a = ne(r.content.getContent());
1778
- else return;
1779
- e.set(n, {
1780
- action: i,
1781
- oldValue: a
1782
- });
1783
- }
1784
- }), this._keys = e;
1785
- }
1786
- return this._keys;
1787
- }
1788
- get delta() {
1789
- return this.changes.delta;
1790
- }
1791
- adds(e) {
1792
- return e.id.clock >= (this.transaction.beforeState.get(e.id.client) || 0);
1793
- }
1794
- get changes() {
1795
- let e = this._changes;
1796
- if (e === null) {
1797
- if (this.transaction.doc._transactionCleanups.length === 0) throw C(da);
1798
- let t = this.target, n = p(), r = p(), i = [];
1799
- if (e = {
1800
- added: n,
1801
- deleted: r,
1802
- delta: i,
1803
- keys: this.keys
1804
- }, this.transaction.changed.get(t).has(null)) {
1805
- let e = null, a = () => {
1806
- e && i.push(e);
1807
- };
1808
- for (let i = t._start; i !== null; i = i.right) i.deleted ? this.deletes(i) && !this.adds(i) && ((e === null || e.delete === void 0) && (a(), e = { delete: 0 }), e.delete += i.length, r.add(i)) : this.adds(i) ? ((e === null || e.insert === void 0) && (a(), e = { insert: [] }), e.insert = e.insert.concat(i.content.getContent()), n.add(i)) : ((e === null || e.retain === void 0) && (a(), e = { retain: 0 }), e.retain += i.length);
1809
- e !== null && e.retain === void 0 && a();
1810
- }
1811
- this._changes = e;
1812
- }
1813
- return e;
1814
- }
1815
- }, pa = (e, t) => {
1816
- let n = [];
1817
- for (; t._item !== null && t !== e;) {
1818
- if (t._item.parentSub !== null) n.unshift(t._item.parentSub);
1819
- else {
1820
- let e = 0, r = t._item.parent._start;
1821
- for (; r !== t._item && r !== null;) !r.deleted && r.countable && (e += r.length), r = r.right;
1822
- n.unshift(e);
1823
- }
1824
- t = t._item.parent;
1825
- }
1826
- return n;
1827
- }, K = () => {
1828
- jr("Invalid access: Add Yjs type to a document before reading data.");
1829
- }, ma = 80, ha = 0, ga = class {
1830
- constructor(e, t) {
1831
- e.marker = !0, this.p = e, this.index = t, this.timestamp = ha++;
1832
- }
1833
- }, _a = (e) => {
1834
- e.timestamp = ha++;
1835
- }, va = (e, t, n) => {
1836
- e.p.marker = !1, e.p = t, t.marker = !0, e.index = n, e.timestamp = ha++;
1837
- }, ya = (e, t, n) => {
1838
- if (e.length >= ma) {
1839
- let r = e.reduce((e, t) => e.timestamp < t.timestamp ? e : t);
1840
- return va(r, t, n), r;
1841
- } else {
1842
- let r = new ga(t, n);
1843
- return e.push(r), r;
1844
- }
1845
- }, ba = (e, t) => {
1846
- if (e._start === null || t === 0 || e._searchMarker === null) return null;
1847
- let n = e._searchMarker.length === 0 ? null : e._searchMarker.reduce((e, n) => ue(t - e.index) < ue(t - n.index) ? e : n), r = e._start, i = 0;
1848
- for (n !== null && (r = n.p, i = n.index, _a(n)); r.right !== null && i < t;) {
1849
- if (!r.deleted && r.countable) {
1850
- if (t < i + r.length) break;
1851
- i += r.length;
1852
- }
1853
- r = r.right;
1854
- }
1855
- for (; r.left !== null && i > t;) r = r.left, !r.deleted && r.countable && (i -= r.length);
1856
- for (; r.left !== null && r.left.id.client === r.id.client && r.left.id.clock + r.left.length === r.id.clock;) r = r.left, !r.deleted && r.countable && (i -= r.length);
1857
- return n !== null && ue(n.index - i) < r.parent.length / ma ? (va(n, r, i), n) : ya(e._searchMarker, r, i);
1858
- }, xa = (e, t, n) => {
1859
- for (let r = e.length - 1; r >= 0; r--) {
1860
- let i = e[r];
1861
- if (n > 0) {
1862
- let t = i.p;
1863
- for (t.marker = !1; t && (t.deleted || !t.countable);) t = t.left, t && !t.deleted && t.countable && (i.index -= t.length);
1864
- if (t === null || t.marker === !0) {
1865
- e.splice(r, 1);
1866
- continue;
1867
- }
1868
- i.p = t, t.marker = !0;
1869
- }
1870
- (t < i.index || n > 0 && t === i.index) && (i.index = g(t, i.index + n));
1871
- }
1872
- }, Sa = (e, t, n) => {
1873
- let r = e, i = t.changedParentTypes;
1874
- for (; f(i, e, () => []).push(n), e._item !== null;) e = e._item.parent;
1875
- Ti(r._eH, n, t);
1876
- }, q = class {
1877
- constructor() {
1878
- this._item = null, this._map = /* @__PURE__ */ new Map(), this._start = null, this.doc = null, this._length = 0, this._eH = Si(), this._dEH = Si(), this._searchMarker = null;
1879
- }
1880
- get parent() {
1881
- return this._item ? this._item.parent : null;
1882
- }
1883
- _integrate(e, t) {
1884
- this.doc = e, this._item = t;
1885
- }
1886
- _copy() {
1887
- throw w();
1888
- }
1889
- clone() {
1890
- throw w();
1891
- }
1892
- _write(e) {}
1893
- get _first() {
1894
- let e = this._start;
1895
- for (; e !== null && e.deleted;) e = e.right;
1896
- return e;
1897
- }
1898
- _callObserver(e, t) {
1899
- !e.local && this._searchMarker && (this._searchMarker.length = 0);
1900
- }
1901
- observe(e) {
1902
- Ci(this._eH, e);
1903
- }
1904
- observeDeep(e) {
1905
- Ci(this._dEH, e);
1906
- }
1907
- unobserve(e) {
1908
- wi(this._eH, e);
1909
- }
1910
- unobserveDeep(e) {
1911
- wi(this._dEH, e);
1912
- }
1913
- toJSON() {}
1914
- }, Ca = (e, t, n) => {
1915
- e.doc ?? K(), t < 0 && (t = e._length + t), n < 0 && (n = e._length + n);
1916
- let r = n - t, i = [], a = e._start;
1917
- for (; a !== null && r > 0;) {
1918
- if (a.countable && !a.deleted) {
1919
- let e = a.content.getContent();
1920
- if (e.length <= t) t -= e.length;
1921
- else {
1922
- for (let n = t; n < e.length && r > 0; n++) i.push(e[n]), r--;
1923
- t = 0;
1924
- }
1925
- }
1926
- a = a.right;
1927
- }
1928
- return i;
1929
- }, wa = (e) => {
1930
- e.doc ?? K();
1931
- let t = [], n = e._start;
1932
- for (; n !== null;) {
1933
- if (n.countable && !n.deleted) {
1934
- let e = n.content.getContent();
1935
- for (let n = 0; n < e.length; n++) t.push(e[n]);
1936
- }
1937
- n = n.right;
1938
- }
1939
- return t;
1940
- }, Ta = (e, t) => {
1941
- let n = 0, r = e._start;
1942
- for (e.doc ?? K(); r !== null;) {
1943
- if (r.countable && !r.deleted) {
1944
- let i = r.content.getContent();
1945
- for (let r = 0; r < i.length; r++) t(i[r], n++, e);
1946
- }
1947
- r = r.right;
1948
- }
1949
- }, Ea = (e, t) => {
1950
- let n = [];
1951
- return Ta(e, (r, i) => {
1952
- n.push(t(r, i, e));
1953
- }), n;
1954
- }, Da = (e) => {
1955
- let t = e._start, n = null, r = 0;
1956
- return {
1957
- [Symbol.iterator]() {
1958
- return this;
1959
- },
1960
- next: () => {
1961
- if (n === null) {
1962
- for (; t !== null && t.deleted;) t = t.right;
1963
- if (t === null) return {
1964
- done: !0,
1965
- value: void 0
1966
- };
1967
- n = t.content.getContent(), r = 0, t = t.right;
1968
- }
1969
- let e = n[r++];
1970
- return n.length <= r && (n = null), {
1971
- done: !1,
1972
- value: e
1973
- };
1974
- }
1975
- };
1976
- }, Oa = (e, t) => {
1977
- e.doc ?? K();
1978
- let n = ba(e, t), r = e._start;
1979
- for (n !== null && (r = n.p, t -= n.index); r !== null; r = r.right) if (!r.deleted && r.countable) {
1980
- if (t < r.length) return r.content.getContent()[t];
1981
- t -= r.length;
1982
- }
1983
- }, ka = (e, t, n, r) => {
1984
- let i = n, a = e.doc, o = a.clientID, s = a.store, c = n === null ? t._start : n.right, l = [], u = () => {
1985
- l.length > 0 && (i = new Q(B(o, V(s, o)), i, i && i.lastId, c, c && c.id, t, null, new Io(l)), i.integrate(e, 0), l = []);
1986
- };
1987
- r.forEach((n) => {
1988
- if (n === null) l.push(n);
1989
- else switch (n.constructor) {
1990
- case Number:
1991
- case Object:
1992
- case Boolean:
1993
- case Array:
1994
- case String:
1995
- l.push(n);
1996
- break;
1997
- default: switch (u(), n.constructor) {
1998
- case Uint8Array:
1999
- case ArrayBuffer:
2000
- i = new Q(B(o, V(s, o)), i, i && i.lastId, c, c && c.id, t, null, new Co(new Uint8Array(n))), i.integrate(e, 0);
2001
- break;
2002
- case Xr:
2003
- i = new Q(B(o, V(s, o)), i, i && i.lastId, c, c && c.id, t, null, new Oo(n)), i.integrate(e, 0);
2004
- break;
2005
- default: if (n instanceof q) i = new Q(B(o, V(s, o)), i, i && i.lastId, c, c && c.id, t, null, new Z(n)), i.integrate(e, 0);
2006
- else throw Error("Unexpected content type in insert operation");
2007
- }
2008
- }
2009
- }), u();
2010
- }, Aa = () => C("Length exceeded!"), ja = (e, t, n, r) => {
2011
- if (n > t._length) throw Aa();
2012
- if (n === 0) return t._searchMarker && xa(t._searchMarker, n, r.length), ka(e, t, null, r);
2013
- let i = n, a = ba(t, n), o = t._start;
2014
- for (a !== null && (o = a.p, n -= a.index, n === 0 && (o = o.prev, n += o && o.countable && !o.deleted ? o.length : 0)); o !== null; o = o.right) if (!o.deleted && o.countable) {
2015
- if (n <= o.length) {
2016
- n < o.length && U(e, B(o.id.client, o.id.clock + n));
2017
- break;
2018
- }
2019
- n -= o.length;
2020
- }
2021
- return t._searchMarker && xa(t._searchMarker, i, r.length), ka(e, t, o, r);
2022
- }, Ma = (e, t, n) => {
2023
- let r = (t._searchMarker || []).reduce((e, t) => t.index > e.index ? t : e, {
2024
- index: 0,
2025
- p: t._start
2026
- }).p;
2027
- if (r) for (; r.right;) r = r.right;
2028
- return ka(e, t, r, n);
2029
- }, Na = (e, t, n, r) => {
2030
- if (r === 0) return;
2031
- let i = n, a = r, o = ba(t, n), s = t._start;
2032
- for (o !== null && (s = o.p, n -= o.index); s !== null && n > 0; s = s.right) !s.deleted && s.countable && (n < s.length && U(e, B(s.id.client, s.id.clock + n)), n -= s.length);
2033
- for (; r > 0 && s !== null;) s.deleted || (r < s.length && U(e, B(s.id.client, s.id.clock + r)), s.delete(e), r -= s.length), s = s.right;
2034
- if (r > 0) throw Aa();
2035
- t._searchMarker && xa(t._searchMarker, i, -a + r);
2036
- }, Pa = (e, t, n) => {
2037
- let r = t._map.get(n);
2038
- r !== void 0 && r.delete(e);
2039
- }, Fa = (e, t, n, r) => {
2040
- let i = t._map.get(n) || null, a = e.doc, o = a.clientID, s;
2041
- if (r == null) s = new Io([r]);
2042
- else switch (r.constructor) {
2043
- case Number:
2044
- case Object:
2045
- case Boolean:
2046
- case Array:
2047
- case String:
2048
- case Date:
2049
- case BigInt:
2050
- s = new Io([r]);
2051
- break;
2052
- case Uint8Array:
2053
- s = new Co(r);
2054
- break;
2055
- case Xr:
2056
- s = new Oo(r);
2057
- break;
2058
- default: if (r instanceof q) s = new Z(r);
2059
- else throw Error("Unexpected content type");
2060
- }
2061
- new Q(B(o, V(a.store, o)), i, i && i.lastId, null, null, t, n, s).integrate(e, 0);
2062
- }, Ia = (e, t) => {
2063
- e.doc ?? K();
2064
- let n = e._map.get(t);
2065
- return n !== void 0 && !n.deleted ? n.content.getContent()[n.length - 1] : void 0;
2066
- }, La = (e) => {
2067
- let t = {};
2068
- return e.doc ?? K(), e._map.forEach((e, n) => {
2069
- e.deleted || (t[n] = e.content.getContent()[e.length - 1]);
2070
- }), t;
2071
- }, Ra = (e, t) => {
2072
- e.doc ?? K();
2073
- let n = e._map.get(t);
2074
- return n !== void 0 && !n.deleted;
2075
- }, za = (e, t) => {
2076
- let n = {};
2077
- return e._map.forEach((e, r) => {
2078
- let i = e;
2079
- for (; i !== null && (!t.sv.has(i.id.client) || i.id.clock >= (t.sv.get(i.id.client) || 0));) i = i.left;
2080
- i !== null && Li(i, t) && (n[r] = i.content.getContent()[i.length - 1]);
2081
- }), n;
2082
- }, Ba = (e) => (e.doc ?? K(), Pr(e._map.entries(), (e) => !e[1].deleted)), Va = class extends fa {}, Ha = class e extends q {
2083
- constructor() {
2084
- super(), this._prelimContent = [], this._searchMarker = [];
2085
- }
2086
- static from(t) {
2087
- let n = new e();
2088
- return n.push(t), n;
2089
- }
2090
- _integrate(e, t) {
2091
- super._integrate(e, t), this.insert(0, this._prelimContent), this._prelimContent = null;
2092
- }
2093
- _copy() {
2094
- return new e();
2095
- }
2096
- clone() {
2097
- let t = new e();
2098
- return t.insert(0, this.toArray().map((e) => e instanceof q ? e.clone() : e)), t;
2099
- }
2100
- get length() {
2101
- return this.doc ?? K(), this._length;
2102
- }
2103
- _callObserver(e, t) {
2104
- super._callObserver(e, t), Sa(this, e, new Va(this, e));
2105
- }
2106
- insert(e, t) {
2107
- this.doc === null ? this._prelimContent.splice(e, 0, ...t) : W(this.doc, (n) => {
2108
- ja(n, this, e, t);
2109
- });
2110
- }
2111
- push(e) {
2112
- this.doc === null ? this._prelimContent.push(...e) : W(this.doc, (t) => {
2113
- Ma(t, this, e);
2114
- });
2115
- }
2116
- unshift(e) {
2117
- this.insert(0, e);
2118
- }
2119
- delete(e, t = 1) {
2120
- this.doc === null ? this._prelimContent.splice(e, t) : W(this.doc, (n) => {
2121
- Na(n, this, e, t);
2122
- });
2123
- }
2124
- get(e) {
2125
- return Oa(this, e);
2126
- }
2127
- toArray() {
2128
- return wa(this);
2129
- }
2130
- slice(e = 0, t = this.length) {
2131
- return Ca(this, e, t);
2132
- }
2133
- toJSON() {
2134
- return this.map((e) => e instanceof q ? e.toJSON() : e);
2135
- }
2136
- map(e) {
2137
- return Ea(this, e);
2138
- }
2139
- forEach(e) {
2140
- Ta(this, e);
2141
- }
2142
- [Symbol.iterator]() {
2143
- return Da(this);
2144
- }
2145
- _write(e) {
2146
- e.writeTypeRef(Vo);
2147
- }
2148
- }, Ua = (e) => new Ha(), Wa = class extends fa {
2149
- constructor(e, t, n) {
2150
- super(e, t), this.keysChanged = n;
2151
- }
2152
- }, Ga = class e extends q {
2153
- constructor(e) {
2154
- super(), this._prelimContent = null, e === void 0 ? this._prelimContent = /* @__PURE__ */ new Map() : this._prelimContent = new Map(e);
2155
- }
2156
- _integrate(e, t) {
2157
- super._integrate(e, t), this._prelimContent.forEach((e, t) => {
2158
- this.set(t, e);
2159
- }), this._prelimContent = null;
2160
- }
2161
- _copy() {
2162
- return new e();
2163
- }
2164
- clone() {
2165
- let t = new e();
2166
- return this.forEach((e, n) => {
2167
- t.set(n, e instanceof q ? e.clone() : e);
2168
- }), t;
2169
- }
2170
- _callObserver(e, t) {
2171
- Sa(this, e, new Wa(this, e, t));
2172
- }
2173
- toJSON() {
2174
- this.doc ?? K();
2175
- let e = {};
2176
- return this._map.forEach((t, n) => {
2177
- if (!t.deleted) {
2178
- let r = t.content.getContent()[t.length - 1];
2179
- e[n] = r instanceof q ? r.toJSON() : r;
2180
- }
2181
- }), e;
2182
- }
2183
- get size() {
2184
- return [...Ba(this)].length;
2185
- }
2186
- keys() {
2187
- return Fr(Ba(this), (e) => e[0]);
2188
- }
2189
- values() {
2190
- return Fr(Ba(this), (e) => e[1].content.getContent()[e[1].length - 1]);
2191
- }
2192
- entries() {
2193
- return Fr(Ba(this), (e) => [e[0], e[1].content.getContent()[e[1].length - 1]]);
2194
- }
2195
- forEach(e) {
2196
- this.doc ?? K(), this._map.forEach((t, n) => {
2197
- t.deleted || e(t.content.getContent()[t.length - 1], n, this);
2198
- });
2199
- }
2200
- [Symbol.iterator]() {
2201
- return this.entries();
2202
- }
2203
- delete(e) {
2204
- this.doc === null ? this._prelimContent.delete(e) : W(this.doc, (t) => {
2205
- Pa(t, this, e);
2206
- });
2207
- }
2208
- set(e, t) {
2209
- return this.doc === null ? this._prelimContent.set(e, t) : W(this.doc, (n) => {
2210
- Fa(n, this, e, t);
2211
- }), t;
2212
- }
2213
- get(e) {
2214
- return Ia(this, e);
2215
- }
2216
- has(e) {
2217
- return Ra(this, e);
2218
- }
2219
- clear() {
2220
- this.doc === null ? this._prelimContent.clear() : W(this.doc, (e) => {
2221
- this.forEach(function(t, n, r) {
2222
- Pa(e, r, n);
2223
- });
2224
- });
2225
- }
2226
- _write(e) {
2227
- e.writeTypeRef(Ho);
2228
- }
2229
- }, Ka = (e) => new Ga(), J = (e, t) => e === t || typeof e == "object" && typeof t == "object" && e && t && jt(e, t), qa = class {
2230
- constructor(e, t, n, r) {
2231
- this.left = e, this.right = t, this.index = n, this.currentAttributes = r;
2232
- }
2233
- forward() {
2234
- switch (this.right === null && T(), this.right.content.constructor) {
2235
- case X:
2236
- this.right.deleted || Za(this.currentAttributes, this.right.content);
2237
- break;
2238
- default:
2239
- this.right.deleted || (this.index += this.right.length);
2240
- break;
2241
- }
2242
- this.left = this.right, this.right = this.right.right;
2243
- }
2244
- }, Ja = (e, t, n) => {
2245
- for (; t.right !== null && n > 0;) {
2246
- switch (t.right.content.constructor) {
2247
- case X:
2248
- t.right.deleted || Za(t.currentAttributes, t.right.content);
2249
- break;
2250
- default:
2251
- t.right.deleted || (n < t.right.length && U(e, B(t.right.id.client, t.right.id.clock + n)), t.index += t.right.length, n -= t.right.length);
2252
- break;
2253
- }
2254
- t.left = t.right, t.right = t.right.right;
2255
- }
2256
- return t;
2257
- }, Ya = (e, t, n, r) => {
2258
- let i = /* @__PURE__ */ new Map(), a = r ? ba(t, n) : null;
2259
- return a ? Ja(e, new qa(a.p.left, a.p, a.index, i), n - a.index) : Ja(e, new qa(null, t._start, 0, i), n);
2260
- }, Xa = (e, t, n, r) => {
2261
- for (; n.right !== null && (n.right.deleted === !0 || n.right.content.constructor === X && J(r.get(n.right.content.key), n.right.content.value));) n.right.deleted || r.delete(n.right.content.key), n.forward();
2262
- let i = e.doc, a = i.clientID;
2263
- r.forEach((r, o) => {
2264
- let s = n.left, c = n.right, l = new Q(B(a, V(i.store, a)), s, s && s.lastId, c, c && c.id, t, null, new X(o, r));
2265
- l.integrate(e, 0), n.right = l, n.forward();
2266
- });
2267
- }, Za = (e, t) => {
2268
- let { key: n, value: r } = t;
2269
- r === null ? e.delete(n) : e.set(n, r);
2270
- }, Qa = (e, t) => {
2271
- for (; e.right !== null && (e.right.deleted || e.right.content.constructor === X && J(t[e.right.content.key] ?? null, e.right.content.value));) e.forward();
2272
- }, $a = (e, t, n, r) => {
2273
- let i = e.doc, a = i.clientID, o = /* @__PURE__ */ new Map();
2274
- for (let s in r) {
2275
- let c = r[s], l = n.currentAttributes.get(s) ?? null;
2276
- if (!J(l, c)) {
2277
- o.set(s, l);
2278
- let { left: r, right: u } = n;
2279
- n.right = new Q(B(a, V(i.store, a)), r, r && r.lastId, u, u && u.id, t, null, new X(s, c)), n.right.integrate(e, 0), n.forward();
2280
- }
2281
- }
2282
- return o;
2283
- }, eo = (e, t, n, r, i) => {
2284
- n.currentAttributes.forEach((e, t) => {
2285
- i[t] === void 0 && (i[t] = null);
2286
- });
2287
- let a = e.doc, o = a.clientID;
2288
- Qa(n, i);
2289
- let s = $a(e, t, n, i), c = r.constructor === String ? new Ro(r) : r instanceof q ? new Z(r) : new Ao(r), { left: l, right: u, index: d } = n;
2290
- t._searchMarker && xa(t._searchMarker, n.index, c.getLength()), u = new Q(B(o, V(a.store, o)), l, l && l.lastId, u, u && u.id, t, null, c), u.integrate(e, 0), n.right = u, n.index = d, n.forward(), Xa(e, t, n, s);
2291
- }, to = (e, t, n, r, i) => {
2292
- let a = e.doc, o = a.clientID;
2293
- Qa(n, i);
2294
- let s = $a(e, t, n, i);
2295
- iterationLoop: for (; n.right !== null && (r > 0 || s.size > 0 && (n.right.deleted || n.right.content.constructor === X));) {
2296
- if (!n.right.deleted) switch (n.right.content.constructor) {
2297
- case X: {
2298
- let { key: t, value: a } = n.right.content, o = i[t];
2299
- if (o !== void 0) {
2300
- if (J(o, a)) s.delete(t);
2301
- else {
2302
- if (r === 0) break iterationLoop;
2303
- s.set(t, a);
2304
- }
2305
- n.right.delete(e);
2306
- } else n.currentAttributes.set(t, a);
2307
- break;
2308
- }
2309
- default:
2310
- r < n.right.length && U(e, B(n.right.id.client, n.right.id.clock + r)), r -= n.right.length;
2311
- break;
2312
- }
2313
- n.forward();
2314
- }
2315
- if (r > 0) {
2316
- let i = "";
2317
- for (; r > 0; r--) i += "\n";
2318
- n.right = new Q(B(o, V(a.store, o)), n.left, n.left && n.left.lastId, n.right, n.right && n.right.id, t, null, new Ro(i)), n.right.integrate(e, 0), n.forward();
2319
- }
2320
- Xa(e, t, n, s);
2321
- }, no = (e, t, n, r, i) => {
2322
- let a = t, o = u();
2323
- for (; a && (!a.countable || a.deleted);) {
2324
- if (!a.deleted && a.content.constructor === X) {
2325
- let e = a.content;
2326
- o.set(e.key, e);
2327
- }
2328
- a = a.right;
2329
- }
2330
- let s = 0, c = !1;
2331
- for (; t !== a;) {
2332
- if (n === t && (c = !0), !t.deleted) {
2333
- let n = t.content;
2334
- switch (n.constructor) {
2335
- case X: {
2336
- let { key: a, value: l } = n, u = r.get(a) ?? null;
2337
- (o.get(a) !== n || u === l) && (t.delete(e), s++, !c && (i.get(a) ?? null) === l && u !== l && (u === null ? i.delete(a) : i.set(a, u))), !c && !t.deleted && Za(i, n);
2338
- break;
2339
- }
2340
- }
2341
- }
2342
- t = t.right;
2343
- }
2344
- return s;
2345
- }, ro = (e, t) => {
2346
- for (; t && t.right && (t.right.deleted || !t.right.countable);) t = t.right;
2347
- let n = /* @__PURE__ */ new Set();
2348
- for (; t && (t.deleted || !t.countable);) {
2349
- if (!t.deleted && t.content.constructor === X) {
2350
- let r = t.content.key;
2351
- n.has(r) ? t.delete(e) : n.add(r);
2352
- }
2353
- t = t.left;
2354
- }
2355
- }, io = (e) => {
2356
- let t = 0;
2357
- return W(e.doc, (n) => {
2358
- let r = e._start, i = e._start, a = u(), o = d(a);
2359
- for (; i;) {
2360
- if (i.deleted === !1) switch (i.content.constructor) {
2361
- case X:
2362
- Za(o, i.content);
2363
- break;
2364
- default:
2365
- t += no(n, r, i, a, o), a = d(o), r = i;
2366
- break;
2367
- }
2368
- i = i.right;
2369
- }
2370
- }), t;
2371
- }, ao = (e) => {
2372
- let t = /* @__PURE__ */ new Set(), n = e.doc;
2373
- for (let [r, i] of e.afterState.entries()) {
2374
- let a = e.beforeState.get(r) || 0;
2375
- i !== a && Ki(e, n.store.clients.get(r), a, i, (e) => {
2376
- !e.deleted && e.content.constructor === X && e.constructor !== Y && t.add(e.parent);
2377
- });
2378
- }
2379
- W(n, (n) => {
2380
- Rr(e, e.deleteSet, (e) => {
2381
- if (e instanceof Y || !e.parent._hasFormatting || t.has(e.parent)) return;
2382
- let r = e.parent;
2383
- e.content.constructor === X ? t.add(r) : ro(n, e);
2384
- });
2385
- for (let e of t) io(e);
2386
- });
2387
- }, oo = (e, t, n) => {
2388
- let r = n, i = d(t.currentAttributes), a = t.right;
2389
- for (; n > 0 && t.right !== null;) {
2390
- if (t.right.deleted === !1) switch (t.right.content.constructor) {
2391
- case Z:
2392
- case Ao:
2393
- case Ro:
2394
- n < t.right.length && U(e, B(t.right.id.client, t.right.id.clock + n)), n -= t.right.length, t.right.delete(e);
2395
- break;
2396
- }
2397
- t.forward();
2398
- }
2399
- a && no(e, a, t.right, i, t.currentAttributes);
2400
- let o = (t.left || t.right).parent;
2401
- return o._searchMarker && xa(o._searchMarker, t.index, -r + n), t;
2402
- }, so = class extends fa {
2403
- constructor(e, t, n) {
2404
- super(e, t), this.childListChanged = !1, this.keysChanged = /* @__PURE__ */ new Set(), n.forEach((e) => {
2405
- e === null ? this.childListChanged = !0 : this.keysChanged.add(e);
2406
- });
2407
- }
2408
- get changes() {
2409
- return this._changes === null && (this._changes = {
2410
- keys: this.keys,
2411
- delta: this.delta,
2412
- added: /* @__PURE__ */ new Set(),
2413
- deleted: /* @__PURE__ */ new Set()
2414
- }), this._changes;
2415
- }
2416
- get delta() {
2417
- if (this._delta === null) {
2418
- let e = this.target.doc, t = [];
2419
- W(e, (e) => {
2420
- let n = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map(), i = this.target._start, a = null, o = {}, s = "", c = 0, l = 0, u = () => {
2421
- if (a !== null) {
2422
- let e = null;
2423
- switch (a) {
2424
- case "delete":
2425
- l > 0 && (e = { delete: l }), l = 0;
2426
- break;
2427
- case "insert":
2428
- (typeof s == "object" || s.length > 0) && (e = { insert: s }, n.size > 0 && (e.attributes = {}, n.forEach((t, n) => {
2429
- t !== null && (e.attributes[n] = t);
2430
- }))), s = "";
2431
- break;
2432
- case "retain":
2433
- c > 0 && (e = { retain: c }, Ot(o) || (e.attributes = Ct({}, o))), c = 0;
2434
- break;
2435
- }
2436
- e && t.push(e), a = null;
2437
- }
2438
- };
2439
- for (; i !== null;) {
2440
- switch (i.content.constructor) {
2441
- case Z:
2442
- case Ao:
2443
- this.adds(i) ? this.deletes(i) || (u(), a = "insert", s = i.content.getContent()[0], u()) : this.deletes(i) ? (a !== "delete" && (u(), a = "delete"), l += 1) : i.deleted || (a !== "retain" && (u(), a = "retain"), c += 1);
2444
- break;
2445
- case Ro:
2446
- this.adds(i) ? this.deletes(i) || (a !== "insert" && (u(), a = "insert"), s += i.content.str) : this.deletes(i) ? (a !== "delete" && (u(), a = "delete"), l += i.length) : i.deleted || (a !== "retain" && (u(), a = "retain"), c += i.length);
2447
- break;
2448
- case X: {
2449
- let { key: t, value: s } = i.content;
2450
- if (this.adds(i)) this.deletes(i) || (J(n.get(t) ?? null, s) ? s !== null && i.delete(e) : (a === "retain" && u(), J(s, r.get(t) ?? null) ? delete o[t] : o[t] = s));
2451
- else if (this.deletes(i)) {
2452
- r.set(t, s);
2453
- let e = n.get(t) ?? null;
2454
- J(e, s) || (a === "retain" && u(), o[t] = e);
2455
- } else if (!i.deleted) {
2456
- r.set(t, s);
2457
- let n = o[t];
2458
- n !== void 0 && (J(n, s) ? n !== null && i.delete(e) : (a === "retain" && u(), s === null ? delete o[t] : o[t] = s));
2459
- }
2460
- i.deleted || (a === "insert" && u(), Za(n, i.content));
2461
- break;
2462
- }
2463
- }
2464
- i = i.right;
2465
- }
2466
- for (u(); t.length > 0;) {
2467
- let e = t[t.length - 1];
2468
- if (e.retain !== void 0 && e.attributes === void 0) t.pop();
2469
- else break;
2470
- }
2471
- }), this._delta = t;
2472
- }
2473
- return this._delta;
2474
- }
2475
- }, co = class e extends q {
2476
- constructor(e) {
2477
- super(), this._pending = e === void 0 ? [] : [() => this.insert(0, e)], this._searchMarker = [], this._hasFormatting = !1;
2478
- }
2479
- get length() {
2480
- return this.doc ?? K(), this._length;
2481
- }
2482
- _integrate(e, t) {
2483
- super._integrate(e, t);
2484
- try {
2485
- this._pending.forEach((e) => e());
2486
- } catch (e) {
2487
- console.error(e);
2488
- }
2489
- this._pending = null;
2490
- }
2491
- _copy() {
2492
- return new e();
2493
- }
2494
- clone() {
2495
- let t = new e();
2496
- return t.applyDelta(this.toDelta()), t;
2497
- }
2498
- _callObserver(e, t) {
2499
- super._callObserver(e, t);
2500
- let n = new so(this, e, t);
2501
- Sa(this, e, n), !e.local && this._hasFormatting && (e._needFormattingCleanup = !0);
2502
- }
2503
- toString() {
2504
- this.doc ?? K();
2505
- let e = "", t = this._start;
2506
- for (; t !== null;) !t.deleted && t.countable && t.content.constructor === Ro && (e += t.content.str), t = t.right;
2507
- return e;
2508
- }
2509
- toJSON() {
2510
- return this.toString();
2511
- }
2512
- applyDelta(e, { sanitize: t = !0 } = {}) {
2513
- this.doc === null ? this._pending.push(() => this.applyDelta(e)) : W(this.doc, (n) => {
2514
- let r = new qa(null, this._start, 0, /* @__PURE__ */ new Map());
2515
- for (let i = 0; i < e.length; i++) {
2516
- let a = e[i];
2517
- if (a.insert !== void 0) {
2518
- let o = !t && typeof a.insert == "string" && i === e.length - 1 && r.right === null && a.insert.slice(-1) === "\n" ? a.insert.slice(0, -1) : a.insert;
2519
- (typeof o != "string" || o.length > 0) && eo(n, this, r, o, a.attributes || {});
2520
- } else a.retain === void 0 ? a.delete !== void 0 && oo(n, r, a.delete) : to(n, this, r, a.retain, a.attributes || {});
2521
- }
2522
- });
2523
- }
2524
- toDelta(e, t, n) {
2525
- this.doc ?? K();
2526
- let r = [], i = /* @__PURE__ */ new Map(), a = this.doc, o = "", s = this._start;
2527
- function c() {
2528
- if (o.length > 0) {
2529
- let e = {}, t = !1;
2530
- i.forEach((n, r) => {
2531
- t = !0, e[r] = n;
2532
- });
2533
- let n = { insert: o };
2534
- t && (n.attributes = e), r.push(n), o = "";
2535
- }
2536
- }
2537
- let l = () => {
2538
- for (; s !== null;) {
2539
- if (Li(s, e) || t !== void 0 && Li(s, t)) switch (s.content.constructor) {
2540
- case Ro: {
2541
- let r = i.get("ychange");
2542
- e !== void 0 && !Li(s, e) ? (r === void 0 || r.user !== s.id.client || r.type !== "removed") && (c(), i.set("ychange", n ? n("removed", s.id) : { type: "removed" })) : t !== void 0 && !Li(s, t) ? (r === void 0 || r.user !== s.id.client || r.type !== "added") && (c(), i.set("ychange", n ? n("added", s.id) : { type: "added" })) : r !== void 0 && (c(), i.delete("ychange")), o += s.content.str;
2543
- break;
2544
- }
2545
- case Z:
2546
- case Ao: {
2547
- c();
2548
- let e = { insert: s.content.getContent()[0] };
2549
- if (i.size > 0) {
2550
- let t = {};
2551
- e.attributes = t, i.forEach((e, n) => {
2552
- t[n] = e;
2553
- });
2554
- }
2555
- r.push(e);
2556
- break;
2557
- }
2558
- case X:
2559
- Li(s, e) && (c(), Za(i, s.content));
2560
- break;
2561
- }
2562
- s = s.right;
2563
- }
2564
- c();
2565
- };
2566
- return e || t ? W(a, (n) => {
2567
- e && Ri(n, e), t && Ri(n, t), l();
2568
- }, "cleanup") : l(), r;
2569
- }
2570
- insert(e, t, n) {
2571
- if (t.length <= 0) return;
2572
- let r = this.doc;
2573
- r === null ? this._pending.push(() => this.insert(e, t, n)) : W(r, (r) => {
2574
- let i = Ya(r, this, e, !n);
2575
- n || (n = {}, i.currentAttributes.forEach((e, t) => {
2576
- n[t] = e;
2577
- })), eo(r, this, i, t, n);
2578
- });
2579
- }
2580
- insertEmbed(e, t, n) {
2581
- let r = this.doc;
2582
- r === null ? this._pending.push(() => this.insertEmbed(e, t, n || {})) : W(r, (r) => {
2583
- let i = Ya(r, this, e, !n);
2584
- eo(r, this, i, t, n || {});
2585
- });
2586
- }
2587
- delete(e, t) {
2588
- if (t === 0) return;
2589
- let n = this.doc;
2590
- n === null ? this._pending.push(() => this.delete(e, t)) : W(n, (n) => {
2591
- oo(n, Ya(n, this, e, !0), t);
2592
- });
2593
- }
2594
- format(e, t, n) {
2595
- if (t === 0) return;
2596
- let r = this.doc;
2597
- r === null ? this._pending.push(() => this.format(e, t, n)) : W(r, (r) => {
2598
- let i = Ya(r, this, e, !1);
2599
- i.right !== null && to(r, this, i, t, n);
2600
- });
2601
- }
2602
- removeAttribute(e) {
2603
- this.doc === null ? this._pending.push(() => this.removeAttribute(e)) : W(this.doc, (t) => {
2604
- Pa(t, this, e);
2605
- });
2606
- }
2607
- setAttribute(e, t) {
2608
- this.doc === null ? this._pending.push(() => this.setAttribute(e, t)) : W(this.doc, (n) => {
2609
- Fa(n, this, e, t);
2610
- });
2611
- }
2612
- getAttribute(e) {
2613
- return Ia(this, e);
2614
- }
2615
- getAttributes() {
2616
- return La(this);
2617
- }
2618
- _write(e) {
2619
- e.writeTypeRef(Uo);
2620
- }
2621
- }, lo = (e) => new co(), uo = class {
2622
- constructor(e, t = () => !0) {
2623
- this._filter = t, this._root = e, this._currentNode = e._start, this._firstCall = !0, e.doc ?? K();
2624
- }
2625
- [Symbol.iterator]() {
2626
- return this;
2627
- }
2628
- next() {
2629
- let e = this._currentNode, t = e && e.content && e.content.type;
2630
- if (e !== null && (!this._firstCall || e.deleted || !this._filter(t))) do
2631
- if (t = e.content.type, !e.deleted && (t.constructor === mo || t.constructor === fo) && t._start !== null) e = t._start;
2632
- else for (; e !== null;) {
2633
- let t = e.next;
2634
- if (t !== null) {
2635
- e = t;
2636
- break;
2637
- } else e = e.parent === this._root ? null : e.parent._item;
2638
- }
2639
- while (e !== null && (e.deleted || !this._filter(e.content.type)));
2640
- return this._firstCall = !1, e === null ? {
2641
- value: void 0,
2642
- done: !0
2643
- } : (this._currentNode = e, {
2644
- value: e.content.type,
2645
- done: !1
2646
- });
2647
- }
2648
- }, fo = class e extends q {
2649
- constructor() {
2650
- super(), this._prelimContent = [];
2651
- }
2652
- get firstChild() {
2653
- let e = this._first;
2654
- return e ? e.content.getContent()[0] : null;
2655
- }
2656
- _integrate(e, t) {
2657
- super._integrate(e, t), this.insert(0, this._prelimContent), this._prelimContent = null;
2658
- }
2659
- _copy() {
2660
- return new e();
2661
- }
2662
- clone() {
2663
- let t = new e();
2664
- return t.insert(0, this.toArray().map((e) => e instanceof q ? e.clone() : e)), t;
2665
- }
2666
- get length() {
2667
- return this.doc ?? K(), this._prelimContent === null ? this._length : this._prelimContent.length;
2668
- }
2669
- createTreeWalker(e) {
2670
- return new uo(this, e);
2671
- }
2672
- querySelector(e) {
2673
- e = e.toUpperCase();
2674
- let t = new uo(this, (t) => t.nodeName && t.nodeName.toUpperCase() === e).next();
2675
- return t.done ? null : t.value;
2676
- }
2677
- querySelectorAll(e) {
2678
- return e = e.toUpperCase(), m(new uo(this, (t) => t.nodeName && t.nodeName.toUpperCase() === e));
2679
- }
2680
- _callObserver(e, t) {
2681
- Sa(this, e, new go(this, t, e));
2682
- }
2683
- toString() {
2684
- return Ea(this, (e) => e.toString()).join("");
2685
- }
2686
- toJSON() {
2687
- return this.toString();
2688
- }
2689
- toDOM(e = document, t = {}, n) {
2690
- let r = e.createDocumentFragment();
2691
- return n !== void 0 && n._createAssociation(r, this), Ta(this, (i) => {
2692
- r.insertBefore(i.toDOM(e, t, n), null);
2693
- }), r;
2694
- }
2695
- insert(e, t) {
2696
- this.doc === null ? this._prelimContent.splice(e, 0, ...t) : W(this.doc, (n) => {
2697
- ja(n, this, e, t);
2698
- });
2699
- }
2700
- insertAfter(e, t) {
2701
- if (this.doc !== null) W(this.doc, (n) => {
2702
- let r = e && e instanceof q ? e._item : e;
2703
- ka(n, this, r, t);
2704
- });
2705
- else {
2706
- let n = this._prelimContent, r = e === null ? 0 : n.findIndex((t) => t === e) + 1;
2707
- if (r === 0 && e !== null) throw C("Reference item not found");
2708
- n.splice(r, 0, ...t);
2709
- }
2710
- }
2711
- delete(e, t = 1) {
2712
- this.doc === null ? this._prelimContent.splice(e, t) : W(this.doc, (n) => {
2713
- Na(n, this, e, t);
2714
- });
2715
- }
2716
- toArray() {
2717
- return wa(this);
2718
- }
2719
- push(e) {
2720
- this.insert(this.length, e);
2721
- }
2722
- unshift(e) {
2723
- this.insert(0, e);
2724
- }
2725
- get(e) {
2726
- return Oa(this, e);
2727
- }
2728
- slice(e = 0, t = this.length) {
2729
- return Ca(this, e, t);
2730
- }
2731
- forEach(e) {
2732
- Ta(this, e);
2733
- }
2734
- _write(e) {
2735
- e.writeTypeRef(Go);
2736
- }
2737
- }, po = (e) => new fo(), mo = class e extends fo {
2738
- constructor(e = "UNDEFINED") {
2739
- super(), this.nodeName = e, this._prelimAttrs = /* @__PURE__ */ new Map();
2740
- }
2741
- get nextSibling() {
2742
- let e = this._item ? this._item.next : null;
2743
- return e ? e.content.type : null;
2744
- }
2745
- get prevSibling() {
2746
- let e = this._item ? this._item.prev : null;
2747
- return e ? e.content.type : null;
2748
- }
2749
- _integrate(e, t) {
2750
- super._integrate(e, t), this._prelimAttrs.forEach((e, t) => {
2751
- this.setAttribute(t, e);
2752
- }), this._prelimAttrs = null;
2753
- }
2754
- _copy() {
2755
- return new e(this.nodeName);
2756
- }
2757
- clone() {
2758
- let t = new e(this.nodeName);
2759
- return Tt(this.getAttributes(), (e, n) => {
2760
- t.setAttribute(n, e);
2761
- }), t.insert(0, this.toArray().map((e) => e instanceof q ? e.clone() : e)), t;
2762
- }
2763
- toString() {
2764
- let e = this.getAttributes(), t = [], n = [];
2765
- for (let t in e) n.push(t);
2766
- n.sort();
2767
- let r = n.length;
2768
- for (let i = 0; i < r; i++) {
2769
- let r = n[i];
2770
- t.push(r + "=\"" + e[r] + "\"");
2771
- }
2772
- let i = this.nodeName.toLocaleLowerCase();
2773
- return `<${i}${t.length > 0 ? " " + t.join(" ") : ""}>${super.toString()}</${i}>`;
2774
- }
2775
- removeAttribute(e) {
2776
- this.doc === null ? this._prelimAttrs.delete(e) : W(this.doc, (t) => {
2777
- Pa(t, this, e);
2778
- });
2779
- }
2780
- setAttribute(e, t) {
2781
- this.doc === null ? this._prelimAttrs.set(e, t) : W(this.doc, (n) => {
2782
- Fa(n, this, e, t);
2783
- });
2784
- }
2785
- getAttribute(e) {
2786
- return Ia(this, e);
2787
- }
2788
- hasAttribute(e) {
2789
- return Ra(this, e);
2790
- }
2791
- getAttributes(e) {
2792
- return e ? za(this, e) : La(this);
2793
- }
2794
- toDOM(e = document, t = {}, n) {
2795
- let r = e.createElement(this.nodeName), i = this.getAttributes();
2796
- for (let e in i) {
2797
- let t = i[e];
2798
- typeof t == "string" && r.setAttribute(e, t);
2799
- }
2800
- return Ta(this, (i) => {
2801
- r.appendChild(i.toDOM(e, t, n));
2802
- }), n !== void 0 && n._createAssociation(r, this), r;
2803
- }
2804
- _write(e) {
2805
- e.writeTypeRef(Wo), e.writeKey(this.nodeName);
2806
- }
2807
- }, ho = (e) => new mo(e.readKey()), go = class extends fa {
2808
- constructor(e, t, n) {
2809
- super(e, n), this.childListChanged = !1, this.attributesChanged = /* @__PURE__ */ new Set(), t.forEach((e) => {
2810
- e === null ? this.childListChanged = !0 : this.attributesChanged.add(e);
2811
- });
2812
- }
2813
- }, _o = class e extends Ga {
2814
- constructor(e) {
2815
- super(), this.hookName = e;
2816
- }
2817
- _copy() {
2818
- return new e(this.hookName);
2819
- }
2820
- clone() {
2821
- let t = new e(this.hookName);
2822
- return this.forEach((e, n) => {
2823
- t.set(n, e);
2824
- }), t;
2825
- }
2826
- toDOM(e = document, t = {}, n) {
2827
- let r = t[this.hookName], i;
2828
- return i = r === void 0 ? document.createElement(this.hookName) : r.createDom(this), i.setAttribute("data-yjs-hook", this.hookName), n !== void 0 && n._createAssociation(i, this), i;
2829
- }
2830
- _write(e) {
2831
- e.writeTypeRef(Ko), e.writeKey(this.hookName);
2832
- }
2833
- }, vo = (e) => new _o(e.readKey()), yo = class e extends co {
2834
- get nextSibling() {
2835
- let e = this._item ? this._item.next : null;
2836
- return e ? e.content.type : null;
2837
- }
2838
- get prevSibling() {
2839
- let e = this._item ? this._item.prev : null;
2840
- return e ? e.content.type : null;
2841
- }
2842
- _copy() {
2843
- return new e();
2844
- }
2845
- clone() {
2846
- let t = new e();
2847
- return t.applyDelta(this.toDelta()), t;
2848
- }
2849
- toDOM(e = document, t, n) {
2850
- let r = e.createTextNode(this.toString());
2851
- return n !== void 0 && n._createAssociation(r, this), r;
2852
- }
2853
- toString() {
2854
- return this.toDelta().map((e) => {
2855
- let t = [];
2856
- for (let n in e.attributes) {
2857
- let r = [];
2858
- for (let t in e.attributes[n]) r.push({
2859
- key: t,
2860
- value: e.attributes[n][t]
2861
- });
2862
- r.sort((e, t) => e.key < t.key ? -1 : 1), t.push({
2863
- nodeName: n,
2864
- attrs: r
2865
- });
2866
- }
2867
- t.sort((e, t) => e.nodeName < t.nodeName ? -1 : 1);
2868
- let n = "";
2869
- for (let e = 0; e < t.length; e++) {
2870
- let r = t[e];
2871
- n += `<${r.nodeName}`;
2872
- for (let e = 0; e < r.attrs.length; e++) {
2873
- let t = r.attrs[e];
2874
- n += ` ${t.key}="${t.value}"`;
2875
- }
2876
- n += ">";
2877
- }
2878
- n += e.insert;
2879
- for (let e = t.length - 1; e >= 0; e--) n += `</${t[e].nodeName}>`;
2880
- return n;
2881
- }).join("");
2882
- }
2883
- toJSON() {
2884
- return this.toString();
2885
- }
2886
- _write(e) {
2887
- e.writeTypeRef(qo);
2888
- }
2889
- }, bo = (e) => new yo(), xo = class {
2890
- constructor(e, t) {
2891
- this.id = e, this.length = t;
2892
- }
2893
- get deleted() {
2894
- throw w();
2895
- }
2896
- mergeWith(e) {
2897
- return !1;
2898
- }
2899
- write(e, t, n) {
2900
- throw w();
2901
- }
2902
- integrate(e, t) {
2903
- throw w();
2904
- }
2905
- }, So = 0, Y = class extends xo {
2906
- get deleted() {
2907
- return !0;
2908
- }
2909
- delete() {}
2910
- mergeWith(e) {
2911
- return this.constructor === e.constructor ? (this.length += e.length, !0) : !1;
2912
- }
2913
- integrate(e, t) {
2914
- t > 0 && (this.id.clock += t, this.length -= t), Vi(e.doc.store, this);
2915
- }
2916
- write(e, t) {
2917
- e.writeInfo(So), e.writeLen(this.length - t);
2918
- }
2919
- getMissing(e, t) {
2920
- return null;
2921
- }
2922
- }, Co = class e {
2923
- constructor(e) {
2924
- this.content = e;
2925
- }
2926
- getLength() {
2927
- return 1;
2928
- }
2929
- getContent() {
2930
- return [this.content];
2931
- }
2932
- isCountable() {
2933
- return !0;
2934
- }
2935
- copy() {
2936
- return new e(this.content);
2937
- }
2938
- splice(e) {
2939
- throw w();
2940
- }
2941
- mergeWith(e) {
2942
- return !1;
2943
- }
2944
- integrate(e, t) {}
2945
- delete(e) {}
2946
- gc(e) {}
2947
- write(e, t) {
2948
- e.writeBuf(this.content);
2949
- }
2950
- getRef() {
2951
- return 3;
2952
- }
2953
- }, wo = (e) => new Co(e.readBuf()), To = class e {
2954
- constructor(e) {
2955
- this.len = e;
2956
- }
2957
- getLength() {
2958
- return this.len;
2959
- }
2960
- getContent() {
2961
- return [];
2962
- }
2963
- isCountable() {
2964
- return !1;
2965
- }
2966
- copy() {
2967
- return new e(this.len);
2968
- }
2969
- splice(t) {
2970
- let n = new e(this.len - t);
2971
- return this.len = t, n;
2972
- }
2973
- mergeWith(e) {
2974
- return this.len += e.len, !0;
2975
- }
2976
- integrate(e, t) {
2977
- Ur(e.deleteSet, t.id.client, t.id.clock, this.len), t.markDeleted();
2978
- }
2979
- delete(e) {}
2980
- gc(e) {}
2981
- write(e, t) {
2982
- e.writeLen(this.len - t);
2983
- }
2984
- getRef() {
2985
- return 1;
2986
- }
2987
- }, Eo = (e) => new To(e.readLen()), Do = (e, t) => new Xr({
2988
- guid: e,
2989
- ...t,
2990
- shouldLoad: t.shouldLoad || t.autoLoad || !1
2991
- }), Oo = class e {
2992
- constructor(e) {
2993
- e._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 = e;
2994
- let t = {};
2995
- this.opts = t, e.gc || (t.gc = !1), e.autoLoad && (t.autoLoad = !0), e.meta !== null && (t.meta = e.meta);
2996
- }
2997
- getLength() {
2998
- return 1;
2999
- }
3000
- getContent() {
3001
- return [this.doc];
3002
- }
3003
- isCountable() {
3004
- return !0;
3005
- }
3006
- copy() {
3007
- return new e(Do(this.doc.guid, this.opts));
3008
- }
3009
- splice(e) {
3010
- throw w();
3011
- }
3012
- mergeWith(e) {
3013
- return !1;
3014
- }
3015
- integrate(e, t) {
3016
- this.doc._item = t, e.subdocsAdded.add(this.doc), this.doc.shouldLoad && e.subdocsLoaded.add(this.doc);
3017
- }
3018
- delete(e) {
3019
- e.subdocsAdded.has(this.doc) ? e.subdocsAdded.delete(this.doc) : e.subdocsRemoved.add(this.doc);
3020
- }
3021
- gc(e) {}
3022
- write(e, t) {
3023
- e.writeString(this.doc.guid), e.writeAny(this.opts);
3024
- }
3025
- getRef() {
3026
- return 9;
3027
- }
3028
- }, ko = (e) => new Oo(Do(e.readString(), e.readAny())), Ao = class e {
3029
- constructor(e) {
3030
- this.embed = e;
3031
- }
3032
- getLength() {
3033
- return 1;
3034
- }
3035
- getContent() {
3036
- return [this.embed];
3037
- }
3038
- isCountable() {
3039
- return !0;
3040
- }
3041
- copy() {
3042
- return new e(this.embed);
3043
- }
3044
- splice(e) {
3045
- throw w();
3046
- }
3047
- mergeWith(e) {
3048
- return !1;
3049
- }
3050
- integrate(e, t) {}
3051
- delete(e) {}
3052
- gc(e) {}
3053
- write(e, t) {
3054
- e.writeJSON(this.embed);
3055
- }
3056
- getRef() {
3057
- return 5;
3058
- }
3059
- }, jo = (e) => new Ao(e.readJSON()), X = class e {
3060
- constructor(e, t) {
3061
- this.key = e, this.value = t;
3062
- }
3063
- getLength() {
3064
- return 1;
3065
- }
3066
- getContent() {
3067
- return [];
3068
- }
3069
- isCountable() {
3070
- return !1;
3071
- }
3072
- copy() {
3073
- return new e(this.key, this.value);
3074
- }
3075
- splice(e) {
3076
- throw w();
3077
- }
3078
- mergeWith(e) {
3079
- return !1;
3080
- }
3081
- integrate(e, t) {
3082
- let n = t.parent;
3083
- n._searchMarker = null, n._hasFormatting = !0;
3084
- }
3085
- delete(e) {}
3086
- gc(e) {}
3087
- write(e, t) {
3088
- e.writeKey(this.key), e.writeJSON(this.value);
3089
- }
3090
- getRef() {
3091
- return 6;
3092
- }
3093
- }, Mo = (e) => new X(e.readKey(), e.readJSON()), No = class e {
3094
- constructor(e) {
3095
- this.arr = e;
3096
- }
3097
- getLength() {
3098
- return this.arr.length;
3099
- }
3100
- getContent() {
3101
- return this.arr;
3102
- }
3103
- isCountable() {
3104
- return !0;
3105
- }
3106
- copy() {
3107
- return new e(this.arr);
3108
- }
3109
- splice(t) {
3110
- let n = new e(this.arr.slice(t));
3111
- return this.arr = this.arr.slice(0, t), n;
3112
- }
3113
- mergeWith(e) {
3114
- return this.arr = this.arr.concat(e.arr), !0;
3115
- }
3116
- integrate(e, t) {}
3117
- delete(e) {}
3118
- gc(e) {}
3119
- write(e, t) {
3120
- let n = this.arr.length;
3121
- e.writeLen(n - t);
3122
- for (let r = t; r < n; r++) {
3123
- let t = this.arr[r];
3124
- e.writeString(t === void 0 ? "undefined" : JSON.stringify(t));
3125
- }
3126
- }
3127
- getRef() {
3128
- return 2;
3129
- }
3130
- }, Po = (e) => {
3131
- let t = e.readLen(), n = [];
3132
- for (let r = 0; r < t; r++) {
3133
- let t = e.readString();
3134
- t === "undefined" ? n.push(void 0) : n.push(JSON.parse(t));
3135
- }
3136
- return new No(n);
3137
- }, Fo = Ht("node_env") === "development", Io = class e {
3138
- constructor(e) {
3139
- this.arr = e, Fo && Nt(e);
3140
- }
3141
- getLength() {
3142
- return this.arr.length;
3143
- }
3144
- getContent() {
3145
- return this.arr;
3146
- }
3147
- isCountable() {
3148
- return !0;
3149
- }
3150
- copy() {
3151
- return new e(this.arr);
3152
- }
3153
- splice(t) {
3154
- let n = new e(this.arr.slice(t));
3155
- return this.arr = this.arr.slice(0, t), n;
3156
- }
3157
- mergeWith(e) {
3158
- return this.arr = this.arr.concat(e.arr), !0;
3159
- }
3160
- integrate(e, t) {}
3161
- delete(e) {}
3162
- gc(e) {}
3163
- write(e, t) {
3164
- let n = this.arr.length;
3165
- e.writeLen(n - t);
3166
- for (let r = t; r < n; r++) {
3167
- let t = this.arr[r];
3168
- e.writeAny(t);
3169
- }
3170
- }
3171
- getRef() {
3172
- return 8;
3173
- }
3174
- }, Lo = (e) => {
3175
- let t = e.readLen(), n = [];
3176
- for (let r = 0; r < t; r++) n.push(e.readAny());
3177
- return new Io(n);
3178
- }, Ro = class e {
3179
- constructor(e) {
3180
- this.str = e;
3181
- }
3182
- getLength() {
3183
- return this.str.length;
3184
- }
3185
- getContent() {
3186
- return this.str.split("");
3187
- }
3188
- isCountable() {
3189
- return !0;
3190
- }
3191
- copy() {
3192
- return new e(this.str);
3193
- }
3194
- splice(t) {
3195
- let n = new e(this.str.slice(t));
3196
- this.str = this.str.slice(0, t);
3197
- let r = this.str.charCodeAt(t - 1);
3198
- return r >= 55296 && r <= 56319 && (this.str = this.str.slice(0, t - 1) + "�", n.str = "�" + n.str.slice(1)), n;
3199
- }
3200
- mergeWith(e) {
3201
- return this.str += e.str, !0;
3202
- }
3203
- integrate(e, t) {}
3204
- delete(e) {}
3205
- gc(e) {}
3206
- write(e, t) {
3207
- e.writeString(t === 0 ? this.str : this.str.slice(t));
3208
- }
3209
- getRef() {
3210
- return 4;
3211
- }
3212
- }, zo = (e) => new Ro(e.readString()), Bo = [
3213
- Ua,
3214
- Ka,
3215
- lo,
3216
- ho,
3217
- po,
3218
- vo,
3219
- bo
3220
- ], Vo = 0, Ho = 1, Uo = 2, Wo = 3, Go = 4, Ko = 5, qo = 6, Z = class e {
3221
- constructor(e) {
3222
- this.type = e;
3223
- }
3224
- getLength() {
3225
- return 1;
3226
- }
3227
- getContent() {
3228
- return [this.type];
3229
- }
3230
- isCountable() {
3231
- return !0;
3232
- }
3233
- copy() {
3234
- return new e(this.type._copy());
3235
- }
3236
- splice(e) {
3237
- throw w();
3238
- }
3239
- mergeWith(e) {
3240
- return !1;
3241
- }
3242
- integrate(e, t) {
3243
- this.type._integrate(e.doc, t);
3244
- }
3245
- delete(e) {
3246
- let t = this.type._start;
3247
- for (; t !== null;) t.deleted ? t.id.clock < (e.beforeState.get(t.id.client) || 0) && e._mergeStructs.push(t) : t.delete(e), t = t.right;
3248
- this.type._map.forEach((t) => {
3249
- t.deleted ? t.id.clock < (e.beforeState.get(t.id.client) || 0) && e._mergeStructs.push(t) : t.delete(e);
3250
- }), e.changed.delete(this.type);
3251
- }
3252
- gc(e) {
3253
- let t = this.type._start;
3254
- for (; t !== null;) t.gc(e, !0), t = t.right;
3255
- this.type._start = null, this.type._map.forEach((t) => {
3256
- for (; t !== null;) t.gc(e, !0), t = t.left;
3257
- }), this.type._map = /* @__PURE__ */ new Map();
3258
- }
3259
- write(e, t) {
3260
- this.type._write(e);
3261
- }
3262
- getRef() {
3263
- return 7;
3264
- }
3265
- }, Jo = (e) => new Z(Bo[e.readTypeRef()](e)), Yo = (e, t) => {
3266
- let n = t, r = 0, i;
3267
- do
3268
- r > 0 && (n = B(n.client, n.clock + r)), i = Hi(e, n), r = n.clock - i.id.clock, n = i.redone;
3269
- while (n !== null && i instanceof Q);
3270
- return {
3271
- item: i,
3272
- diff: r
3273
- };
3274
- }, Xo = (e, t, n) => {
3275
- let { client: r, clock: i } = t.id, a = new Q(B(r, i + n), t, B(r, i + n - 1), t.right, t.rightOrigin, t.parent, t.parentSub, t.content.splice(n));
3276
- return t.deleted && a.markDeleted(), t.keep && (a.keep = !0), t.redone !== null && (a.redone = B(t.redone.client, t.redone.clock + n)), t.right = a, a.right !== null && (a.right.left = a), e._mergeStructs.push(a), a.parentSub !== null && a.right === null && a.parent._map.set(a.parentSub, a), t.length = n, a;
3277
- }, Q = class e extends xo {
3278
- constructor(e, t, n, r, i, a, o, s) {
3279
- super(e, s.getLength()), this.origin = n, this.left = t, this.right = r, this.rightOrigin = i, this.parent = a, this.parentSub = o, this.redone = null, this.content = s, this.info = this.content.isCountable() ? 2 : 0;
3280
- }
3281
- set marker(e) {
3282
- (this.info & 8) > 0 !== e && (this.info ^= 8);
3283
- }
3284
- get marker() {
3285
- return (this.info & 8) > 0;
3286
- }
3287
- get keep() {
3288
- return (this.info & 1) > 0;
3289
- }
3290
- set keep(e) {
3291
- this.keep !== e && (this.info ^= 1);
3292
- }
3293
- get countable() {
3294
- return (this.info & 2) > 0;
3295
- }
3296
- get deleted() {
3297
- return (this.info & 4) > 0;
3298
- }
3299
- set deleted(e) {
3300
- this.deleted !== e && (this.info ^= 4);
3301
- }
3302
- markDeleted() {
3303
- this.info |= 4;
3304
- }
3305
- getMissing(t, n) {
3306
- if (this.origin && this.origin.client !== this.id.client && this.origin.clock >= V(n, this.origin.client)) return this.origin.client;
3307
- if (this.rightOrigin && this.rightOrigin.client !== this.id.client && this.rightOrigin.clock >= V(n, this.rightOrigin.client)) return this.rightOrigin.client;
3308
- if (this.parent && this.parent.constructor === Ei && this.id.client !== this.parent.client && this.parent.clock >= V(n, this.parent.client)) return this.parent.client;
3309
- if (this.origin &&= (this.left = Wi(t, n, this.origin), this.left.lastId), this.rightOrigin &&= (this.right = U(t, this.rightOrigin), this.right.id), this.left && this.left.constructor === Y || this.right && this.right.constructor === Y) this.parent = null;
3310
- else if (!this.parent) this.left && this.left.constructor === e ? (this.parent = this.left.parent, this.parentSub = this.left.parentSub) : this.right && this.right.constructor === e && (this.parent = this.right.parent, this.parentSub = this.right.parentSub);
3311
- else if (this.parent.constructor === Ei) {
3312
- let e = Hi(n, this.parent);
3313
- e.constructor === Y ? this.parent = null : this.parent = e.content.type;
3314
- }
3315
- return null;
3316
- }
3317
- integrate(e, t) {
3318
- if (t > 0 && (this.id.clock += t, this.left = Wi(e, e.doc.store, B(this.id.client, this.id.clock - 1)), this.origin = this.left.lastId, this.content = this.content.splice(t), this.length -= t), this.parent) {
3319
- if (!this.left && (!this.right || this.right.left !== null) || this.left && this.left.right !== this.right) {
3320
- let t = this.left, n;
3321
- if (t !== null) n = t.right;
3322
- else if (this.parentSub !== null) for (n = this.parent._map.get(this.parentSub) || null; n !== null && n.left !== null;) n = n.left;
3323
- else n = this.parent._start;
3324
- let r = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Set();
3325
- for (; n !== null && n !== this.right;) {
3326
- if (i.add(n), r.add(n), Di(this.origin, n.origin)) {
3327
- if (n.id.client < this.id.client) t = n, r.clear();
3328
- else if (Di(this.rightOrigin, n.rightOrigin)) break;
3329
- } else if (n.origin !== null && i.has(Hi(e.doc.store, n.origin))) r.has(Hi(e.doc.store, n.origin)) || (t = n, r.clear());
3330
- else break;
3331
- n = n.right;
3332
- }
3333
- this.left = t;
3334
- }
3335
- if (this.left !== null) this.right = this.left.right, this.left.right = this;
3336
- else {
3337
- let e;
3338
- if (this.parentSub !== null) for (e = this.parent._map.get(this.parentSub) || null; e !== null && e.left !== null;) e = e.left;
3339
- else e = this.parent._start, this.parent._start = this;
3340
- this.right = e;
3341
- }
3342
- this.right === null ? this.parentSub !== null && (this.parent._map.set(this.parentSub, this), this.left !== null && this.left.delete(e)) : this.right.left = this, this.parentSub === null && this.countable && !this.deleted && (this.parent._length += this.length), Vi(e.doc.store, this), this.content.integrate(e, this), Yi(e, this.parent, this.parentSub), (this.parent._item !== null && this.parent._item.deleted || this.parentSub !== null && this.right !== null) && this.delete(e);
3343
- } else new Y(this.id, this.length).integrate(e, 0);
3344
- }
3345
- get next() {
3346
- let e = this.right;
3347
- for (; e !== null && e.deleted;) e = e.right;
3348
- return e;
3349
- }
3350
- get prev() {
3351
- let e = this.left;
3352
- for (; e !== null && e.deleted;) e = e.left;
3353
- return e;
3354
- }
3355
- get lastId() {
3356
- return this.length === 1 ? this.id : B(this.id.client, this.id.clock + this.length - 1);
3357
- }
3358
- mergeWith(e) {
3359
- if (this.constructor === e.constructor && Di(e.origin, this.lastId) && this.right === e && Di(this.rightOrigin, e.rightOrigin) && this.id.client === e.id.client && this.id.clock + this.length === e.id.clock && this.deleted === e.deleted && this.redone === null && e.redone === null && this.content.constructor === e.content.constructor && this.content.mergeWith(e.content)) {
3360
- let t = this.parent._searchMarker;
3361
- return t && t.forEach((t) => {
3362
- t.p === e && (t.p = this, !this.deleted && this.countable && (t.index -= this.length));
3363
- }), e.keep && (this.keep = !0), this.right = e.right, this.right !== null && (this.right.left = this), this.length += e.length, !0;
3364
- }
3365
- return !1;
3366
- }
3367
- delete(e) {
3368
- if (!this.deleted) {
3369
- let t = this.parent;
3370
- this.countable && this.parentSub === null && (t._length -= this.length), this.markDeleted(), Ur(e.deleteSet, this.id.client, this.id.clock, this.length), Yi(e, t, this.parentSub), this.content.delete(e);
3371
- }
3372
- }
3373
- gc(e, t) {
3374
- if (!this.deleted) throw T();
3375
- this.content.gc(e), t ? Gi(e, this, new Y(this.id, this.length)) : this.content = new To(this.length);
3376
- }
3377
- write(e, t) {
3378
- let n = t > 0 ? B(this.id.client, this.id.clock + t - 1) : this.origin, r = this.rightOrigin, i = this.parentSub, a = this.content.getRef() & 31 | (n === null ? 0 : 128) | (r === null ? 0 : 64) | (i === null ? 0 : 32);
3379
- if (e.writeInfo(a), n !== null && e.writeLeftID(n), r !== null && e.writeRightID(r), n === null && r === null) {
3380
- let t = this.parent;
3381
- if (t._item !== void 0) {
3382
- let n = t._item;
3383
- if (n === null) {
3384
- let n = Oi(t);
3385
- e.writeParentInfo(!0), e.writeString(n);
3386
- } else e.writeParentInfo(!1), e.writeLeftID(n.id);
3387
- } else t.constructor === String ? (e.writeParentInfo(!0), e.writeString(t)) : t.constructor === Ei ? (e.writeParentInfo(!1), e.writeLeftID(t)) : T();
3388
- i !== null && e.writeString(i);
3389
- }
3390
- this.content.write(e, t);
3391
- }
3392
- }, Zo = (e, t) => Qo[t & 31](e), Qo = [
3393
- () => {
3394
- T();
3395
- },
3396
- Eo,
3397
- Po,
3398
- wo,
3399
- zo,
3400
- jo,
3401
- Mo,
3402
- Jo,
3403
- Lo,
3404
- ko,
3405
- () => {
3406
- T();
3407
- }
3408
- ], $o = 10, $ = class extends xo {
3409
- get deleted() {
3410
- return !0;
3411
- }
3412
- delete() {}
3413
- mergeWith(e) {
3414
- return this.constructor === e.constructor ? (this.length += e.length, !0) : !1;
3415
- }
3416
- integrate(e, t) {
3417
- T();
3418
- }
3419
- write(e, t) {
3420
- e.writeInfo($o), b(e.restEncoder, this.length - t);
3421
- }
3422
- getMissing(e, t) {
3423
- return null;
3424
- }
3425
- }, es = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : t === void 0 ? {} : t, ts = "__ $YJS$ __";
3426
- es[ts] === !0 && console.error("Yjs was already imported. This breaks constructor checks and will lead to issues! - https://github.com/yjs/yjs/issues/438"), es[ts] = !0;
3427
- //#endregion
3428
- //#region node_modules/lib0/broadcastchannel.js
3429
- var ns = /* @__PURE__ */ new Map(), rs = class {
3430
- constructor(e) {
3431
- this.room = e, this.onmessage = null, this._onChange = (t) => t.key === e && this.onmessage !== null && this.onmessage({ data: en(t.newValue || "") }), vt(this._onChange);
3432
- }
3433
- postMessage(e) {
3434
- _t.setItem(this.room, $t(Jt(e)));
3435
- }
3436
- close() {
3437
- yt(this._onChange);
3438
- }
3439
- }, is = typeof BroadcastChannel > "u" ? rs : BroadcastChannel, as = (e) => f(ns, e, () => {
3440
- let t = p(), n = new is(e);
3441
- return n.onmessage = (e) => t.forEach((t) => t(e.data, "broadcastchannel")), {
3442
- bc: n,
3443
- subs: t
3444
- };
3445
- }), os = (e, t) => (as(e).subs.add(t), t), ss = (e, t) => {
3446
- let n = as(e), r = n.subs.delete(t);
3447
- return r && n.subs.size === 0 && (n.bc.close(), ns.delete(e)), r;
3448
- }, cs = (e, t, n = null) => {
3449
- let r = as(e);
3450
- r.bc.postMessage(t), r.subs.forEach((e) => e(t, n));
3451
- }, ls = (e, t) => {
3452
- b(e, 0), S(e, bi(t));
3453
- }, us = (e, t, n) => {
3454
- b(e, 1), S(e, mi(t, n));
3455
- }, ds = (e, t, n) => us(t, n, D(e)), fs = (e, t, n, r) => {
3456
- try {
3457
- di(t, D(e), n);
3458
- } catch (e) {
3459
- r?.(e), console.error("Caught error while handling a Yjs update", e);
3460
- }
3461
- }, ps = (e, t) => {
3462
- b(e, 2), S(e, t);
3463
- }, ms = fs, hs = (e, t, n, r, i) => {
3464
- let a = O(e);
3465
- switch (a) {
3466
- case 0:
3467
- ds(e, t, n);
3468
- break;
3469
- case 1:
3470
- fs(e, n, r, i);
3471
- break;
3472
- case 2:
3473
- ms(e, n, r, i);
3474
- break;
3475
- default: throw Error("Unknown message type");
3476
- }
3477
- return a;
3478
- }, gs = (e, t, n) => {
3479
- switch (O(e)) {
3480
- case 0: n(t, k(e));
3481
- }
3482
- }, _s = 3e4, vs = class extends le {
3483
- constructor(e) {
3484
- super(), this.doc = e, this.clientID = e.clientID, this.states = /* @__PURE__ */ new Map(), this.meta = /* @__PURE__ */ new Map(), this._checkInterval = setInterval(() => {
3485
- let e = A();
3486
- this.getLocalState() !== null && 3e4 / 2 <= e - this.meta.get(this.clientID).lastUpdated && this.setLocalState(this.getLocalState());
3487
- let t = [];
3488
- this.meta.forEach((n, r) => {
3489
- r !== this.clientID && 3e4 <= e - n.lastUpdated && this.states.has(r) && t.push(r);
3490
- }), t.length > 0 && ys(this, t, "timeout");
3491
- }, h(_s / 10)), e.on("destroy", () => {
3492
- this.destroy();
3493
- }), this.setLocalState({});
3494
- }
3495
- destroy() {
3496
- this.emit("destroy", [this]), this.setLocalState(null), super.destroy(), clearInterval(this._checkInterval);
3497
- }
3498
- getLocalState() {
3499
- return this.states.get(this.clientID) || null;
3500
- }
3501
- setLocalState(e) {
3502
- let t = this.clientID, n = this.meta.get(t), r = n === void 0 ? 0 : n.clock + 1, i = this.states.get(t);
3503
- e === null ? this.states.delete(t) : this.states.set(t, e), this.meta.set(t, {
3504
- clock: r,
3505
- lastUpdated: A()
3506
- });
3507
- let a = [], o = [], s = [], c = [];
3508
- e === null ? c.push(t) : i == null ? e != null && a.push(t) : (o.push(t), It(i, e) || s.push(t)), (a.length > 0 || s.length > 0 || c.length > 0) && this.emit("change", [{
3509
- added: a,
3510
- updated: s,
3511
- removed: c
3512
- }, "local"]), this.emit("update", [{
3513
- added: a,
3514
- updated: o,
3515
- removed: c
3516
- }, "local"]);
3517
- }
3518
- setLocalStateField(e, t) {
3519
- let n = this.getLocalState();
3520
- n !== null && this.setLocalState({
3521
- ...n,
3522
- [e]: t
3523
- });
3524
- }
3525
- getStates() {
3526
- return this.states;
3527
- }
3528
- }, ys = (e, t, n) => {
3529
- let r = [];
3530
- for (let n = 0; n < t.length; n++) {
3531
- let i = t[n];
3532
- if (e.states.has(i)) {
3533
- if (e.states.delete(i), i === e.clientID) {
3534
- let t = e.meta.get(i);
3535
- e.meta.set(i, {
3536
- clock: t.clock + 1,
3537
- lastUpdated: A()
3538
- });
3539
- }
3540
- r.push(i);
3541
- }
3542
- }
3543
- r.length > 0 && (e.emit("change", [{
3544
- added: [],
3545
- updated: [],
3546
- removed: r
3547
- }, n]), e.emit("update", [{
3548
- added: [],
3549
- updated: [],
3550
- removed: r
3551
- }, n]));
3552
- }, bs = (e, t, n = e.states) => {
3553
- let r = t.length, i = _();
3554
- b(i, r);
3555
- for (let a = 0; a < r; a++) {
3556
- let r = t[a], o = n.get(r) || null, s = e.meta.get(r).clock;
3557
- b(i, r), b(i, s), x(i, JSON.stringify(o));
3558
- }
3559
- return v(i);
3560
- }, xs = (e, t, n) => {
3561
- let r = E(t), i = A(), a = [], o = [], s = [], c = [], l = O(r);
3562
- for (let t = 0; t < l; t++) {
3563
- let t = O(r), n = O(r), l = JSON.parse(k(r)), u = e.meta.get(t), d = e.states.get(t), f = u === void 0 ? 0 : u.clock;
3564
- (f < n || f === n && l === null && e.states.has(t)) && (l === null ? t === e.clientID && e.getLocalState() != null ? n++ : e.states.delete(t) : e.states.set(t, l), e.meta.set(t, {
3565
- clock: n,
3566
- lastUpdated: i
3567
- }), u === void 0 && l !== null ? a.push(t) : u !== void 0 && l === null ? c.push(t) : l !== null && (It(l, d) || s.push(t), o.push(t)));
3568
- }
3569
- (a.length > 0 || s.length > 0 || c.length > 0) && e.emit("change", [{
3570
- added: a,
3571
- updated: s,
3572
- removed: c
3573
- }, n]), (a.length > 0 || o.length > 0 || c.length > 0) && e.emit("update", [{
3574
- added: a,
3575
- updated: o,
3576
- removed: c
3577
- }, n]);
3578
- }, Ss = (e) => Et(e, (e, t) => `${encodeURIComponent(t)}=${encodeURIComponent(e)}`).join("&");
3579
- //#endregion
3580
- //#region node_modules/y-websocket/src/y-websocket.js
3581
- n();
3582
- var Cs = [];
3583
- Cs[0] = (e, t, n, r, i) => {
3584
- b(e, 0);
3585
- let a = hs(t, e, n.doc, n);
3586
- r && a === 1 && !n.synced && (n.synced = !0);
3587
- }, Cs[3] = (e, t, n, r, i) => {
3588
- b(e, 1), S(e, bs(n.awareness, Array.from(n.awareness.getStates().keys())));
3589
- }, Cs[1] = (e, t, n, r, i) => {
3590
- xs(n.awareness, D(t), n);
3591
- }, Cs[2] = (e, t, n, r, i) => {
3592
- gs(t, n.doc, (e, t) => Ts(n, t));
3593
- };
3594
- var ws = 3e4, Ts = (e, t) => console.warn(`Permission denied to access ${e.url}.\n${t}`), Es = (e, t, n) => {
3595
- let r = E(t), i = _(), a = O(r), o = e.messageHandlers[a];
3596
- return o ? o(i, r, e, n, a) : console.error("Unable to compute message"), i;
3597
- }, Ds = (e, t, n) => {
3598
- t === e.ws && (e.emit("connection-close", [n, e]), e.ws = null, t.close(), e.wsconnecting = !1, e.wsconnected ? (e.wsconnected = !1, e.synced = !1, ys(e.awareness, Array.from(e.awareness.getStates().keys()).filter((t) => t !== e.doc.clientID), e), e.emit("status", [{ status: "disconnected" }])) : e.wsUnsuccessfulReconnects++, setTimeout(Os, de(fe(2, e.wsUnsuccessfulReconnects) * 100, e.maxBackoffTime), e));
3599
- }, Os = (e) => {
3600
- if (e.shouldConnect && e.ws === null) {
3601
- let t = new e._WS(e.url, e.protocols);
3602
- t.binaryType = "arraybuffer", e.ws = t, e.wsconnecting = !0, e.wsconnected = !1, e.synced = !1, t.onmessage = (n) => {
3603
- e.wsLastMessageReceived = A();
3604
- let r = Es(e, new Uint8Array(n.data), !0);
3605
- ke(r) > 1 && t.send(v(r));
3606
- }, t.onerror = (t) => {
3607
- e.emit("connection-error", [t, e]);
3608
- }, t.onclose = (n) => {
3609
- Ds(e, t, n);
3610
- }, t.onopen = () => {
3611
- e.wsLastMessageReceived = A(), e.wsconnecting = !1, e.wsconnected = !0, e.wsUnsuccessfulReconnects = 0, e.emit("status", [{ status: "connected" }]);
3612
- let n = _();
3613
- if (b(n, 0), ls(n, e.doc), t.send(v(n)), e.awareness.getLocalState() !== null) {
3614
- let n = _();
3615
- b(n, 1), S(n, bs(e.awareness, [e.doc.clientID])), t.send(v(n));
3616
- }
3617
- }, e.emit("status", [{ status: "connecting" }]);
3618
- }
3619
- }, ks = (e, t) => {
3620
- let n = e.ws;
3621
- e.wsconnected && n && n.readyState === n.OPEN && n.send(t), e.bcconnected && cs(e.bcChannel, t, e);
3622
- }, As = class extends ce {
3623
- constructor(e, t, n, { connect: r = !0, awareness: i = new vs(n), params: a = {}, protocols: o = [], WebSocketPolyfill: s = WebSocket, resyncInterval: l = -1, maxBackoffTime: u = 2500, disableBc: d = !1 } = {}) {
3624
- for (super(); e[e.length - 1] === "/";) e = e.slice(0, e.length - 1);
3625
- this.serverUrl = e, this.bcChannel = e + "/" + t, this.maxBackoffTime = u, this.params = a, this.protocols = o, this.roomname = t, this.doc = n, this._WS = s, this.awareness = i, this.wsconnected = !1, this.wsconnecting = !1, this.bcconnected = !1, this.disableBc = d, this.wsUnsuccessfulReconnects = 0, this.messageHandlers = Cs.slice(), this._synced = !1, this.ws = null, this.wsLastMessageReceived = 0, this.shouldConnect = r, this._resyncInterval = 0, l > 0 && (this._resyncInterval = setInterval(() => {
3626
- if (this.ws && this.ws.readyState === WebSocket.OPEN) {
3627
- let e = _();
3628
- b(e, 0), ls(e, n), this.ws.send(v(e));
3629
- }
3630
- }, l)), this._bcSubscriber = (e, t) => {
3631
- if (t !== this) {
3632
- let t = Es(this, new Uint8Array(e), !1);
3633
- ke(t) > 1 && cs(this.bcChannel, v(t), this);
3634
- }
3635
- }, this._updateHandler = (e, t) => {
3636
- if (t !== this) {
3637
- let t = _();
3638
- b(t, 0), ps(t, e), ks(this, v(t));
3639
- }
3640
- }, this.doc.on("update", this._updateHandler), this._awarenessUpdateHandler = ({ added: e, updated: t, removed: n }, r) => {
3641
- let a = e.concat(t).concat(n), o = _();
3642
- b(o, 1), S(o, bs(i, a)), ks(this, v(o));
3643
- }, this._exitHandler = () => {
3644
- ys(this.awareness, [n.clientID], "app closed");
3645
- }, j && c !== void 0 && c.on("exit", this._exitHandler), i.on("update", this._awarenessUpdateHandler), this._checkInterval = setInterval(() => {
3646
- this.wsconnected && ws < A() - this.wsLastMessageReceived && Ds(this, this.ws, null);
3647
- }, ws / 10), r && this.connect();
3648
- }
3649
- get url() {
3650
- let e = Ss(this.params);
3651
- return this.serverUrl + "/" + this.roomname + (e.length === 0 ? "" : "?" + e);
3652
- }
3653
- get synced() {
3654
- return this._synced;
3655
- }
3656
- set synced(e) {
3657
- this._synced !== e && (this._synced = e, this.emit("synced", [e]), this.emit("sync", [e]));
3658
- }
3659
- destroy() {
3660
- this._resyncInterval !== 0 && clearInterval(this._resyncInterval), clearInterval(this._checkInterval), this.disconnect(), j && c !== void 0 && c.off("exit", this._exitHandler), this.awareness.off("update", this._awarenessUpdateHandler), this.doc.off("update", this._updateHandler), super.destroy();
3661
- }
3662
- connectBc() {
3663
- if (this.disableBc) return;
3664
- this.bcconnected ||= (os(this.bcChannel, this._bcSubscriber), !0);
3665
- let e = _();
3666
- b(e, 0), ls(e, this.doc), cs(this.bcChannel, v(e), this);
3667
- let t = _();
3668
- b(t, 0), us(t, this.doc), cs(this.bcChannel, v(t), this);
3669
- let n = _();
3670
- b(n, 3), cs(this.bcChannel, v(n), this);
3671
- let r = _();
3672
- b(r, 1), S(r, bs(this.awareness, [this.doc.clientID])), cs(this.bcChannel, v(r), this);
3673
- }
3674
- disconnectBc() {
3675
- let e = _();
3676
- b(e, 1), S(e, bs(this.awareness, [this.doc.clientID], /* @__PURE__ */ new Map())), ks(this, v(e)), this.bcconnected &&= (ss(this.bcChannel, this._bcSubscriber), !1);
3677
- }
3678
- disconnect() {
3679
- this.shouldConnect = !1, this.disconnectBc(), this.ws !== null && Ds(this, this.ws, null);
3680
- }
3681
- connect() {
3682
- this.shouldConnect = !0, !this.wsconnected && this.ws === null && (Os(this), this.connectBc());
3683
- }
3684
- }, js = () => {
3685
- let e = !0;
3686
- return (t, n) => {
3687
- if (e) {
3688
- e = !1;
3689
- try {
3690
- t();
3691
- } finally {
3692
- e = !0;
3693
- }
3694
- } else n !== void 0 && n();
3695
- };
3696
- }, Ms = class {
3697
- constructor(e, t, n) {
3698
- this.start = e, this.end = t, this.direction = n;
3699
- }
3700
- }, Ns = (e, t, n) => {
3701
- let r = e.getSelection();
3702
- if (r !== null) {
3703
- let e = r.getStartPosition(), i = r.getEndPosition();
3704
- return new Ms(Ni(n, t.getOffsetAt(e)), Ni(n, t.getOffsetAt(i)), r.getDirection());
3705
- }
3706
- return null;
3707
- }, Ps = (e, t, n, r) => {
3708
- let a = Fi(n.start, r), o = Fi(n.end, r);
3709
- if (a !== null && o !== null && a.type === t && o.type === t) {
3710
- let t = e.getModel(), r = t.getPositionAt(a.index), s = t.getPositionAt(o.index);
3711
- return i.createWithDirection(r.lineNumber, r.column, s.lineNumber, s.column, n.direction);
3712
- }
3713
- return null;
3714
- }, Fs = class {
3715
- constructor(e, t, n = /* @__PURE__ */ new Set(), r = null) {
3716
- this.doc = e.doc, this.ytext = e, this.monacoModel = t, this.editors = n, this.mux = js(), this._savedSelections = /* @__PURE__ */ new Map(), this._beforeTransaction = () => {
3717
- this.mux(() => {
3718
- this._savedSelections = /* @__PURE__ */ new Map(), n.forEach((n) => {
3719
- if (n.getModel() === t) {
3720
- let r = Ns(n, t, e);
3721
- r !== null && this._savedSelections.set(n, r);
3722
- }
3723
- });
3724
- });
3725
- }, this.doc.on("beforeAllTransactions", this._beforeTransaction), this._decorations = /* @__PURE__ */ new Map(), this._rerenderDecorations = () => {
3726
- n.forEach((n) => {
3727
- if (r && n.getModel() === t) {
3728
- let i = this._decorations.get(n) || [], a = [];
3729
- r.getStates().forEach((n, r) => {
3730
- if (r !== this.doc.clientID && n.selection != null && n.selection.anchor != null && n.selection.head != null) {
3731
- let i = Fi(n.selection.anchor, this.doc), s = Fi(n.selection.head, this.doc);
3732
- if (i !== null && s !== null && i.type === e && s.type === e) {
3733
- let e, n, c, l;
3734
- i.index < s.index ? (e = t.getPositionAt(i.index), n = t.getPositionAt(s.index), c = "yRemoteSelectionHead yRemoteSelectionHead-" + r, l = null) : (e = t.getPositionAt(s.index), n = t.getPositionAt(i.index), c = null, l = "yRemoteSelectionHead yRemoteSelectionHead-" + r), a.push({
3735
- range: new o(e.lineNumber, e.column, n.lineNumber, n.column),
3736
- options: {
3737
- className: "yRemoteSelection yRemoteSelection-" + r,
3738
- afterContentClassName: c,
3739
- beforeContentClassName: l
3740
- }
3741
- });
3742
- }
3743
- }
3744
- }), this._decorations.set(n, n.deltaDecorations(i, a));
3745
- } else this._decorations.delete(n);
3746
- });
3747
- }, this._ytextObserver = (n) => {
3748
- this.mux(() => {
3749
- let r = 0;
3750
- n.delta.forEach((e) => {
3751
- if (e.retain !== void 0) r += e.retain;
3752
- else if (e.insert !== void 0) {
3753
- let n = t.getPositionAt(r), a = new i(n.lineNumber, n.column, n.lineNumber, n.column), o = e.insert;
3754
- t.applyEdits([{
3755
- range: a,
3756
- text: o
3757
- }]), r += o.length;
3758
- } else if (e.delete !== void 0) {
3759
- let n = t.getPositionAt(r), a = t.getPositionAt(r + e.delete), o = new i(n.lineNumber, n.column, a.lineNumber, a.column);
3760
- t.applyEdits([{
3761
- range: o,
3762
- text: ""
3763
- }]);
3764
- } else throw T();
3765
- }), this._savedSelections.forEach((t, n) => {
3766
- let r = Ps(n, e, t, this.doc);
3767
- r !== null && n.setSelection(r);
3768
- });
3769
- }), this._rerenderDecorations();
3770
- }, e.observe(this._ytextObserver);
3771
- {
3772
- let n = e.toString();
3773
- t.getValue() !== n && t.setValue(n);
3774
- }
3775
- this._monacoChangeHandler = t.onDidChangeContent((t) => {
3776
- this.mux(() => {
3777
- this.doc.transact(() => {
3778
- t.changes.sort((e, t) => t.rangeOffset - e.rangeOffset).forEach((t) => {
3779
- e.delete(t.rangeOffset, t.rangeLength), e.insert(t.rangeOffset, t.text);
3780
- });
3781
- }, this);
3782
- });
3783
- }), this._monacoDisposeHandler = t.onWillDispose(() => {
3784
- this.destroy();
3785
- }), r && (n.forEach((n) => {
3786
- n.onDidChangeCursorSelection(() => {
3787
- if (n.getModel() === t) {
3788
- let i = n.getSelection();
3789
- if (i === null) return;
3790
- let o = t.getOffsetAt(i.getStartPosition()), s = t.getOffsetAt(i.getEndPosition());
3791
- if (i.getDirection() === a.RTL) {
3792
- let e = o;
3793
- o = s, s = e;
3794
- }
3795
- r.setLocalStateField("selection", {
3796
- anchor: Ni(e, o),
3797
- head: Ni(e, s)
3798
- });
3799
- }
3800
- }), r.on("change", this._rerenderDecorations);
3801
- }), this.awareness = r);
3802
- }
3803
- destroy() {
3804
- this._monacoChangeHandler.dispose(), this._monacoDisposeHandler.dispose(), this.ytext.unobserve(this._ytextObserver), this.doc.off("beforeAllTransactions", this._beforeTransaction), this.awareness && this.awareness.off("change", this._rerenderDecorations);
3805
- }
3806
- }, Is = /* @__PURE__ */ e(((e) => {
3807
- var t = window.__emailmaker__.modules.Dayjs;
3808
- Object.keys(t).forEach(function(n) {
3809
- n !== "default" && n !== "__esModule" && (e[n] = t[n]);
3810
- }), e.__esModule = !0, e.default = t.default === void 0 ? t : t.default;
3811
- }));
3812
- //#endregion
3813
- export { Xr as i, Fs as n, As as r, Is as t };