@inkeep/open-knowledge 0.49.1 → 0.50.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (290) hide show
  1. package/dist/{acp-harness-probe-C8FhVWZi.mjs → acp-harness-probe-LTFljjjT.mjs} +2 -2
  2. package/dist/cli.mjs +26 -26
  3. package/dist/constants-DKkdtsrQ.mjs +2 -0
  4. package/dist/{git-handle-r3d7s3VF.mjs → git-handle-B9WUn7B2.mjs} +2 -2
  5. package/dist/git-handle-BfyNyc1q.mjs +1 -0
  6. package/dist/index.mjs +192 -192
  7. package/dist/init-CUlzbSqG.mjs +1 -0
  8. package/dist/{init-VslWN3Iz.mjs → init-DoE9fKH8.mjs} +3 -3
  9. package/dist/{launch-json-removal-9-8M5r9e.mjs → launch-json-removal--afgb0jV.mjs} +2 -2
  10. package/dist/{loader-f3tIWlWk.mjs → loader-C00kGDZz.mjs} +2 -2
  11. package/dist/loader-Dd0F_wFU.mjs +1 -0
  12. package/dist/md-manager-DGG55-uN.mjs +2 -0
  13. package/dist/{open-browser-BgReR_t5.mjs → open-browser-BuOrhXvS.mjs} +2 -2
  14. package/dist/parse-worker.mjs +1 -1
  15. package/dist/{preview-CdESX2Ja.mjs → preview-CMjft0ek.mjs} +2 -2
  16. package/dist/preview-D-x1bfxi.mjs +1 -0
  17. package/dist/public/assets/ActivityModeContent-HRSmxB9_.js +1 -0
  18. package/dist/public/assets/{AgentDiffPane-T499-ugv.js → AgentDiffPane-BGYo5UN6.js} +1 -1
  19. package/dist/public/assets/{AgentThreadClientBinder-BlMGv16y.js → AgentThreadClientBinder-0uU00Tq4.js} +1 -1
  20. package/dist/public/assets/{AppMenubar-dik_dmjC.js → AppMenubar-Dk1BEmD9.js} +1 -1
  21. package/dist/public/assets/{BugReportHistory-DymFE_6x.js → BugReportHistory-CRlvJE2K.js} +1 -1
  22. package/dist/public/assets/{BugReportHistoryDialog-D28ahq-6.js → BugReportHistoryDialog-DIqnZXkT.js} +1 -1
  23. package/dist/public/assets/ChangedOutsideBadge-CG45zoCT.js +1 -0
  24. package/dist/public/assets/{CodeMirrorPropInput-3TWUbzXY.js → CodeMirrorPropInput-B__Dqs8P.js} +3 -3
  25. package/dist/public/assets/{ConfigSharingInfoTooltip-Bwt_R43K.js → ConfigSharingInfoTooltip-BNI3Q3Qo.js} +1 -1
  26. package/dist/public/assets/ConsentDialogBody-BlayjFQq.js +2 -0
  27. package/dist/public/assets/{CopyButton-DysciFW5.js → CopyButton-Q-6hSzy6.js} +1 -1
  28. package/dist/public/assets/{DiffView-DY54R06f.js → DiffView-BnNY_4OT.js} +1 -1
  29. package/dist/public/assets/DocumentContext-Dxzqsjf0.js +38 -0
  30. package/dist/public/assets/EditorModeToggle-OACqdrIA.js +1 -0
  31. package/dist/public/assets/EnableSyncConfirmDialog-DBMws9uC.js +1 -0
  32. package/dist/public/assets/FeedbackForm-YQbdmBFL.js +1 -0
  33. package/dist/public/assets/GraphPanel-BlBOG-me.js +44 -0
  34. package/dist/public/assets/ImportSkillDialog-CgeVAxXn.js +1 -0
  35. package/dist/public/assets/{LintConfigEditor-3f4-NF1O.js → LintConfigEditor-v0oqzBfd.js} +1 -1
  36. package/dist/public/assets/ManagedArtifactProperties-BfO4jYnj.js +2 -0
  37. package/dist/public/assets/ManagedArtifactProperties-Dmjq1ugS.js +1 -0
  38. package/dist/public/assets/McpConsentDialogBody-DcaMMYmf.js +1 -0
  39. package/dist/public/assets/{Mermaid-Cr48L9fH.js → Mermaid-cUFqNhzC.js} +1 -1
  40. package/dist/public/assets/{MermaidDocEditor-C30-UfMg.js → MermaidDocEditor-YEj8k0Fj.js} +1 -1
  41. package/dist/public/assets/{RegisteredAgentIcon-Cdt1gfjt.js → RegisteredAgentIcon-CCgDsAUc.js} +1 -1
  42. package/dist/public/assets/{ReportBugDialogBody-BUGec7jk.js → ReportBugDialogBody-f7fl9dVO.js} +1 -1
  43. package/dist/public/assets/SchemaConfigEditor-C_BBar0x.js +1 -0
  44. package/dist/public/assets/SessionsHost-DPObQsYR.js +2 -0
  45. package/dist/public/assets/SettingsDialogBody-C53PpDiP.js +12 -0
  46. package/dist/public/assets/ShareBranchSwitchDialog-DMbjNni-.js +1 -0
  47. package/dist/public/assets/ShareReceiveDialog-DMLSpBoi.js +1 -0
  48. package/dist/public/assets/{ShareReceiveMissDialog-B03ClkaE.js → ShareReceiveMissDialog-TTjnDvC9.js} +1 -1
  49. package/dist/public/assets/{SkillEditBanner-C7z-32HN.js → SkillEditBanner-Dmsi4hSW.js} +1 -1
  50. package/dist/public/assets/{SkillOriginInline-DgWSnmXH.js → SkillOriginInline-BoGssBkU.js} +1 -1
  51. package/dist/public/assets/{SkillToolbarControls-PvRY_LHn.js → SkillToolbarControls-C8yypIJ3.js} +1 -1
  52. package/dist/public/assets/SlidesToolbarControls-CWIkYgNX.js +1 -0
  53. package/dist/public/assets/SourceEditor-D3dXest3.js +1 -0
  54. package/dist/public/assets/{TerminalPanel-Bl3bWVA_.js → TerminalPanel-D_OODFVz.js} +3 -3
  55. package/dist/public/assets/{TerminalWindowApp-CFxcrkfe.js → TerminalWindowApp-Dwoah4yb.js} +1 -1
  56. package/dist/public/assets/{TextDocEditor-CHDC5byq.js → TextDocEditor-DzdzVGmP.js} +1 -1
  57. package/dist/public/assets/ThreadView-DJxvdzfd.js +10 -0
  58. package/dist/public/assets/TimelineDiffPane-D5U46urB.js +2 -0
  59. package/dist/public/assets/{agent-diff-store-B7oQn7l7.js → agent-diff-store-DmpkFUx3.js} +1 -1
  60. package/dist/public/assets/arrow-up-right-CXYxHO7Z.js +1 -0
  61. package/dist/public/assets/auth-state-cache-Dm1J9vyz.js +11 -0
  62. package/dist/public/assets/{braces-Ytg60O62.js → braces-54VO1tdr.js} +1 -1
  63. package/dist/public/assets/{calendar-GynmFVw0.js → calendar-BhCmsdcp.js} +1 -1
  64. package/dist/public/assets/{case-sensitive-DvBZDISP.js → case-sensitive-BpYLDHFG.js} +1 -1
  65. package/dist/public/assets/check-DA6LolTH.js +1 -0
  66. package/dist/public/assets/{checkbox-V0IoPAe3.js → checkbox-gpfWb1pY.js} +1 -1
  67. package/dist/public/assets/{chevron-down-DrpHBSgH.js → chevron-down-Ccgt58N5.js} +1 -1
  68. package/dist/public/assets/chevron-left-DY9flfyc.js +1 -0
  69. package/dist/public/assets/chevron-right-2RK4DD3b.js +1 -0
  70. package/dist/public/assets/{chevron-up-CsH_dTwv.js → chevron-up-DXAtCwKR.js} +1 -1
  71. package/dist/public/assets/client-version-BbTOZkhQ.js +1 -0
  72. package/dist/public/assets/{cm-theme-BJSRL90r.js → cm-theme-DPWSzbOc.js} +1 -1
  73. package/dist/public/assets/comment-chips-CNh6cTT4.js +5 -0
  74. package/dist/public/assets/config-provider-CZ_6SNHv.js +5 -0
  75. package/dist/public/assets/{dialog-eak3pI7G.js → dialog-O4u6_xiQ.js} +1 -1
  76. package/dist/public/assets/{dist-DndwauQ3.js → dist-BpOfJRMm.js} +1 -1
  77. package/dist/public/assets/{dist-hwUYIgzz.js → dist-C1TyNsxp.js} +1 -1
  78. package/dist/public/assets/{dist-BCM06z1D.js → dist-CDMQmWZl.js} +1 -1
  79. package/dist/public/assets/{dist-BDJLSjo2.js → dist-CI5_cNui.js} +1 -1
  80. package/dist/public/assets/{dist-CkHhDuKZ.js → dist-CJuiZAB0.js} +1 -1
  81. package/dist/public/assets/{dist-DvtYFuZI.js → dist-CNm9tACe.js} +1 -1
  82. package/dist/public/assets/{dist-DJ3iQH0N.js → dist-CebtYbHb.js} +1 -1
  83. package/dist/public/assets/{dist--4AcVRue.js → dist-CpwfhxFl.js} +1 -1
  84. package/dist/public/assets/{dist-DNV7r8rH.js → dist-DU2smIGg.js} +1 -1
  85. package/dist/public/assets/{dist-PVtTd_Sj2.js → dist-TVrIGknK2.js} +111 -111
  86. package/dist/public/assets/{dist-Wj2cwRLU.js → dist-hrQOAqN1.js} +1 -1
  87. package/dist/public/assets/{dist-yYRRvtMr.js → dist-wfUjMP-v.js} +1 -1
  88. package/dist/public/assets/{dist-ClczuKkQ.js → dist-y6w4IT08.js} +1 -1
  89. package/dist/public/assets/doc-paths-BKAhPn1c.js +1 -0
  90. package/dist/public/assets/{documents-events-COSAPFkC.js → documents-events-B6nWdFan.js} +1 -1
  91. package/dist/public/assets/{download-Bq4sKAdj.js → download-BuEN0lZf.js} +1 -1
  92. package/dist/public/assets/{dropdown-menu-BhMtMvZp.js → dropdown-menu-CP1RnfZI.js} +1 -1
  93. package/dist/public/assets/{eye-DYUvwA0Z.js → eye-CYj_zi2W.js} +1 -1
  94. package/dist/public/assets/{field-DN11CYjs.js → field-BADrt9_J.js} +1 -1
  95. package/dist/public/assets/{file-tree-adapter-B9dmiTPy.js → file-tree-adapter-Dhf8gmFi.js} +1 -1
  96. package/dist/public/assets/{file-tree-utils-CvsKsHRh.js → file-tree-utils-Cx1c51Ql.js} +1 -1
  97. package/dist/public/assets/{folder-Cnftw7jd.js → folder-CWVPrRtx.js} +1 -1
  98. package/dist/public/assets/folder-config-api-CKhPo3Lt.js +1 -0
  99. package/dist/public/assets/{folder-open-DoQalFip.js → folder-open-BXfoqsrp.js} +1 -1
  100. package/dist/public/assets/{follow-file-BymUhAtT.js → follow-file-BRGwJuKy.js} +1 -1
  101. package/dist/public/assets/{git-branch-BWBPTGqT.js → git-branch-CMN6cdzm.js} +1 -1
  102. package/dist/public/assets/globals-CIRDbOmQ.css +1 -0
  103. package/dist/public/assets/{hash-BZXl_HqD.js → hash-BS4ux6bl.js} +1 -1
  104. package/dist/public/assets/history-CiIvI4I4.js +1 -0
  105. package/dist/public/assets/i18n-iRTrMKQI.js +1 -0
  106. package/dist/public/assets/index-Dask65mE.js +2097 -0
  107. package/dist/public/assets/{info-Jj1j2YxC.js → info-160SNOuG.js} +1 -1
  108. package/dist/public/assets/{input-group-H-ZoGiXT.js → input-group-CPKSxoq5.js} +1 -1
  109. package/dist/public/assets/{lint-config-client-DkwFMG_T.js → lint-config-client-KRlZx1_T.js} +1 -1
  110. package/dist/public/assets/{list-plus-IYEFhKGU.js → list-plus-BPvSuFZX.js} +1 -1
  111. package/dist/public/assets/loader-circle-BbuX0POi.js +1 -0
  112. package/dist/public/assets/{local-menu-action-bus-DLozq_c4.js → local-menu-action-bus-BDB0W02w.js} +1 -1
  113. package/dist/public/assets/markdownlint-rule-browser-BAnqBevm.js +1 -0
  114. package/dist/public/assets/{mcp-consent-store-B_Tog3LX.js → mcp-consent-store-yqsuAEir.js} +1 -1
  115. package/dist/public/assets/messages-52Q73NDn.js +1 -0
  116. package/dist/public/assets/messages-B-LUKCxb.js +1 -0
  117. package/dist/public/assets/messages-Bjt29O_q.js +1 -0
  118. package/dist/public/assets/messages-BzwBNPDu.js +1 -0
  119. package/dist/public/assets/messages-CGjveR2E.js +1 -0
  120. package/dist/public/assets/messages-CkanzrCR.js +1 -0
  121. package/dist/public/assets/messages-Cy75Ipbk.js +1 -0
  122. package/dist/public/assets/messages-D2UntltU.js +1 -0
  123. package/dist/public/assets/messages-D8H0FnV4.js +1 -0
  124. package/dist/public/assets/messages-Dl7JEKLk.js +1 -0
  125. package/dist/public/assets/messages-s-nrsPLp.js +1 -0
  126. package/dist/public/assets/minus-Ba4o_31L.js +1 -0
  127. package/dist/public/assets/{miss-dialog-store--ihxgGwV.js → miss-dialog-store-CdaZpyLg.js} +1 -1
  128. package/dist/public/assets/{navigation-targets-DKe7BSku.js → navigation-targets-BhdJAW-R.js} +1 -1
  129. package/dist/public/assets/open-managed-artifact-tab-CgUiYJiR.js +1 -0
  130. package/dist/public/assets/{panel-right-open-BhUOm1Eq.js → panel-right-open-_nL1w4h-.js} +1 -1
  131. package/dist/public/assets/{paperclip-9gdTBktj.js → paperclip-DV67TMJS.js} +1 -1
  132. package/dist/public/assets/pending-receive-nav-store-Crda7hlg.js +1 -0
  133. package/dist/public/assets/{project-paths-fLhDAPyF.js → project-paths-BWmSfpDI.js} +1 -1
  134. package/dist/public/assets/prop-types-CvU-2DkU.js +1 -0
  135. package/dist/public/assets/{receive-store-BvkW9HUo.js → receive-store--Bc0z-E4.js} +1 -1
  136. package/dist/public/assets/{refresh-cw-REpEMEB2.js → refresh-cw-Bjv-Fpq5.js} +1 -1
  137. package/dist/public/assets/{schema-fields-view-intent-DZFjFt0c.js → schema-fields-view-intent-BMlW8LRz.js} +1 -1
  138. package/dist/public/assets/{select-CRztynyQ.js → select-BaOsrrG7.js} +1 -1
  139. package/dist/public/assets/{selection-context-CSP8zK1H.js → selection-context-CsRnyGFj.js} +1 -1
  140. package/dist/public/assets/{separator-k0mwGcaM.js → separator-BXBsYPiB.js} +1 -1
  141. package/dist/public/assets/skill-actions-B7Cmxryy.js +2 -0
  142. package/dist/public/assets/{skill-scope-Dr7iwSW3.js → skill-scope-CwmLPgmT.js} +1 -1
  143. package/dist/public/assets/{skills-api-qDbnaMmu.js → skills-api-DDfyPLwg.js} +1 -1
  144. package/dist/public/assets/{square-pen-D3oI-YUs.js → square-pen-CW0s3lqC.js} +1 -1
  145. package/dist/public/assets/{src-VcUCSe0b.js → src-DfI4uz3u.js} +1 -1
  146. package/dist/public/assets/{tag-pill-input-pBac7WXR.js → tag-pill-input-DnM-Fz1E.js} +1 -1
  147. package/dist/public/assets/{target-navigation-intent-DAyeqt__.js → target-navigation-intent-D8zAsaUV.js} +1 -1
  148. package/dist/public/assets/{telemetry-impl-C9jF13xo.js → telemetry-impl-DFcgjFFc.js} +1 -1
  149. package/dist/public/assets/{telemetry-startup-1DamiHqT.js → telemetry-startup-0F_AW_hr.js} +1 -1
  150. package/dist/public/assets/terminal-BNdVsbND.js +1 -0
  151. package/dist/public/assets/terminal-cli-display-Djf7X5gE.js +1 -0
  152. package/dist/public/assets/terminal-launch-events-B76nHQ-9.js +1 -0
  153. package/dist/public/assets/terminal-telemetry-CynEAJPS.js +1 -0
  154. package/dist/public/assets/{text-viewer-languages-BTzKrM_y.js → text-viewer-languages-BBrkAtBf.js} +2 -2
  155. package/dist/public/assets/thread-client-CER-baRK.js +1 -0
  156. package/dist/public/assets/{trash-2-BSr7FcE8.js → trash-2-rgduGgZB.js} +1 -1
  157. package/dist/public/assets/{triangle-alert-DNTyNeem.js → triangle-alert-CnW4IElJ.js} +1 -1
  158. package/dist/public/assets/{typing-burst-detector-BOmjXV-P.js → typing-burst-detector-DzIKrNKg.js} +4 -4
  159. package/dist/public/assets/{undo-2-u9f9OoCF.js → undo-2-BmxrL5XS.js} +1 -1
  160. package/dist/public/assets/{uninstall-36twrq5C.js → uninstall-DT91VYMe.js} +1 -1
  161. package/dist/public/assets/{use-activity-panel-BwANCYjg.js → use-activity-panel-CbIsW8Oq.js} +1 -1
  162. package/dist/public/assets/use-apply-config-color-theme-Cd_bVm8F.js +1 -0
  163. package/dist/public/assets/{use-collab-url-TKpnPAW8.js → use-collab-url-DESxkkaS.js} +1 -1
  164. package/dist/public/assets/use-live-xterm-theme-D9HFWiME.js +1 -0
  165. package/dist/public/assets/use-open-skill-DyTRfvTr.js +1 -0
  166. package/dist/public/assets/use-settings-route-BXWhuQbZ.js +1 -0
  167. package/dist/public/assets/{use-skill-directory-D9S5f8By.js → use-skill-directory-BaP9hj7C.js} +1 -1
  168. package/dist/public/assets/use-skill-origin-DBXnPKZS.js +1 -0
  169. package/dist/public/assets/{use-skills-D5kEHDif.js → use-skills-CVci-eTA.js} +1 -1
  170. package/dist/public/assets/use-terminal-enabled-DDthawVX.js +1 -0
  171. package/dist/public/assets/{use-timeline-entry-diff-CB_cI1yy.js → use-timeline-entry-diff-BC2rFPLm.js} +2 -2
  172. package/dist/public/assets/{use-workspace--QTATo27.js → use-workspace-CAcWHNxj.js} +1 -1
  173. package/dist/public/assets/{wrench-BPXVnAE5.js → wrench-DtGaC8XY.js} +1 -1
  174. package/dist/public/assets/x-D8xzRaMT.js +1 -0
  175. package/dist/public/index.html +122 -122
  176. package/dist/public/uninstall.html +14 -14
  177. package/dist/{repair-launch-json-DwJ_yLw4.mjs → repair-launch-json-DWyYbCft.mjs} +2 -2
  178. package/dist/{repair-mcp-configs-Q1hO02co.mjs → repair-mcp-configs-IqhFyLaP.mjs} +2 -2
  179. package/dist/repair-skills-Cl53MdUh.mjs +1 -0
  180. package/dist/{repair-skills-DADI6iaT.mjs → repair-skills-DwcUYwoH.mjs} +2 -2
  181. package/dist/server-lock-C5RpbiEy.mjs +1 -0
  182. package/dist/{server-lock-aXnDVUI8.mjs → server-lock-DQ_whZyH.mjs} +2 -2
  183. package/dist/{skill-teardown-onVYT1VF.mjs → skill-teardown-DzuNnHSF.mjs} +2 -2
  184. package/dist/src-BPPzfDas.mjs +2032 -0
  185. package/dist/src-BmsPBIN0.mjs +20 -0
  186. package/dist/src-CWRDxPCK.mjs +1 -0
  187. package/dist/{src-TKCctdpc.mjs → src-Cb3i1kcm.mjs} +5 -5
  188. package/dist/{src-cRpQSbXB.mjs → src-DpX6KBvU.mjs} +1 -1
  189. package/dist/start-BhtWVSU0.mjs +1 -0
  190. package/dist/{start-DRG6a2sz.mjs → start-CB1ruR88.mjs} +3 -3
  191. package/dist/{write-project-skill-DOogyZge.mjs → write-project-skill-DfjjNq9T.mjs} +2 -2
  192. package/package.json +5 -5
  193. package/dist/constants-BkYBCRUx.mjs +0 -2
  194. package/dist/git-handle-DBSzQutT.mjs +0 -1
  195. package/dist/init-BlCMJ0yB.mjs +0 -1
  196. package/dist/loader-Birwg2h1.mjs +0 -1
  197. package/dist/md-manager-BbSzMHHE.mjs +0 -2
  198. package/dist/preview-gKyXf1a0.mjs +0 -1
  199. package/dist/public/assets/ActivityModeContent-C08FYohG.js +0 -1
  200. package/dist/public/assets/ChangedOutsideBadge-GeQfL_b-.js +0 -1
  201. package/dist/public/assets/ConsentDialogBody-Clb82Qbo.js +0 -2
  202. package/dist/public/assets/DocumentContext-C-Lo65-_.js +0 -38
  203. package/dist/public/assets/EditorModeToggle-BjgmECAn.js +0 -1
  204. package/dist/public/assets/EnableSyncConfirmDialog-B1Eo_sVE.js +0 -1
  205. package/dist/public/assets/FeedbackForm-C_A-lpjC.js +0 -1
  206. package/dist/public/assets/GraphPanel-CxJeFUDp.js +0 -44
  207. package/dist/public/assets/ImportSkillDialog-ChsGV6eb.js +0 -1
  208. package/dist/public/assets/ManagedArtifactProperties-B1ZA0ofn.js +0 -2
  209. package/dist/public/assets/ManagedArtifactProperties-B_ecuboX.js +0 -1
  210. package/dist/public/assets/McpConsentDialogBody-CG5af4os.js +0 -1
  211. package/dist/public/assets/SchemaConfigEditor-DPK5XbMd.js +0 -1
  212. package/dist/public/assets/SessionsHost-BRUQMi7f.js +0 -2
  213. package/dist/public/assets/SettingsDialogBody-COTbFRqi.js +0 -12
  214. package/dist/public/assets/ShareBranchSwitchDialog-C0mAHHVQ.js +0 -1
  215. package/dist/public/assets/ShareReceiveDialog-Coi9tYAP.js +0 -1
  216. package/dist/public/assets/SlidesToolbarControls-8TzXHMwI.js +0 -1
  217. package/dist/public/assets/SourceEditor-Duqpede9.js +0 -1
  218. package/dist/public/assets/ThreadView-CAGruMiN.js +0 -10
  219. package/dist/public/assets/TimelineDiffPane-DnaRcvCk.js +0 -2
  220. package/dist/public/assets/agent-visibility-CHYjRInm.js +0 -1
  221. package/dist/public/assets/arrow-up-right-0IN5lFEX.js +0 -1
  222. package/dist/public/assets/auth-state-cache-BUYyIMUZ.js +0 -11
  223. package/dist/public/assets/check-BLuQ2zvV.js +0 -1
  224. package/dist/public/assets/chevron-left-BUr-yKA4.js +0 -1
  225. package/dist/public/assets/chevron-right-BU8AeJST.js +0 -1
  226. package/dist/public/assets/client-version-DfXcf1Qf.js +0 -1
  227. package/dist/public/assets/comment-chips-BhvfCPCk.js +0 -5
  228. package/dist/public/assets/config-context-DNY4at5d.js +0 -1
  229. package/dist/public/assets/config-provider-B7dMDFNr.js +0 -5
  230. package/dist/public/assets/doc-paths-CH8QyanF.js +0 -1
  231. package/dist/public/assets/folder-config-api-IGZhtkRo.js +0 -1
  232. package/dist/public/assets/globals-D9Q1kf3c.css +0 -1
  233. package/dist/public/assets/history-BNEST2Cx.js +0 -1
  234. package/dist/public/assets/i18n-CIRn0AvV.js +0 -1
  235. package/dist/public/assets/index-B-snLDY1.js +0 -2097
  236. package/dist/public/assets/loader-circle-Coob8S41.js +0 -1
  237. package/dist/public/assets/markdownlint-rule-browser-DY5CRVFm.js +0 -1
  238. package/dist/public/assets/messages-6Fd7I7zn.js +0 -1
  239. package/dist/public/assets/messages-BJIB1I1L.js +0 -1
  240. package/dist/public/assets/messages-BOXmrfhw.js +0 -1
  241. package/dist/public/assets/messages-BeOM8jWl.js +0 -1
  242. package/dist/public/assets/messages-CCWKIebo.js +0 -1
  243. package/dist/public/assets/messages-CQFityfC.js +0 -1
  244. package/dist/public/assets/messages-CzRXVtjz.js +0 -1
  245. package/dist/public/assets/messages-DYiuNk7y.js +0 -1
  246. package/dist/public/assets/messages-Db5U-G1d.js +0 -1
  247. package/dist/public/assets/messages-DohtKbKM.js +0 -1
  248. package/dist/public/assets/messages-WWFblTuV.js +0 -1
  249. package/dist/public/assets/minus-DPAjfzCa.js +0 -1
  250. package/dist/public/assets/open-managed-artifact-tab-DGO7syz6.js +0 -1
  251. package/dist/public/assets/pending-receive-nav-store-SZ8w-xKW.js +0 -1
  252. package/dist/public/assets/prop-types-DoONHMUn.js +0 -1
  253. package/dist/public/assets/skill-actions-98H3SnCL.js +0 -2
  254. package/dist/public/assets/terminal-launch-events-CIULxHeu.js +0 -1
  255. package/dist/public/assets/terminal-mGTI25Qq.js +0 -1
  256. package/dist/public/assets/terminal-telemetry-CqkILJJU.js +0 -1
  257. package/dist/public/assets/thread-client-DSDduEdo.js +0 -1
  258. package/dist/public/assets/use-live-xterm-theme-B8OPZLR3.js +0 -1
  259. package/dist/public/assets/use-open-skill-DCSEJ3jJ.js +0 -1
  260. package/dist/public/assets/use-settings-route-CKMxexs3.js +0 -1
  261. package/dist/public/assets/use-skill-origin-8_nwflm6.js +0 -1
  262. package/dist/public/assets/use-terminal-enabled-Ctosnrg_.js +0 -1
  263. package/dist/public/assets/x-COTyTduF.js +0 -1
  264. package/dist/repair-skills-DKwDAoHc.mjs +0 -1
  265. package/dist/server-lock-U8YDpJpq.mjs +0 -1
  266. package/dist/src-BgeIHNkQ.mjs +0 -1
  267. package/dist/src-DNPRz0-U.mjs +0 -20
  268. package/dist/src-Dt5dAyFQ.mjs +0 -2032
  269. package/dist/start-CWIlNpAT.mjs +0 -1
  270. /package/dist/public/assets/{asset-dispatch-Dst62kKY.js → asset-dispatch-_dEhJuVP.js} +0 -0
  271. /package/dist/public/assets/{auth-prompt-store-B92v76dM.js → auth-prompt-store-CeaWNesV.js} +0 -0
  272. /package/dist/public/assets/{badge-B89o8Vy9.js → badge-CY_v_nGy.js} +0 -0
  273. /package/dist/public/assets/{copilot-qpaFt06v.js → copilot-D0J83lOh.js} +0 -0
  274. /package/dist/public/assets/{createLucideIcon-BbftclCc.js → createLucideIcon-BcLKHslE.js} +0 -0
  275. /package/dist/public/assets/{cursor-Df-vt--2.js → cursor-B6-YoFzF.js} +0 -0
  276. /package/dist/public/assets/{desktop-bridge-types-BjBBs_pU.js → desktop-bridge-types-rBjHIYSI.js} +0 -0
  277. /package/dist/public/assets/{dist-BlH6jxEE.js → dist-BTu6o3T-.js} +0 -0
  278. /package/dist/public/assets/{dist-CEwo98ia.js → dist-Bkx5dDHT2.js} +0 -0
  279. /package/dist/public/assets/{dist-C7IFraT6.js → dist-DoS8xGN6.js} +0 -0
  280. /package/dist/public/assets/{documents-fetch-BTUkzxjd.js → documents-fetch-B8A9IAH3.js} +0 -0
  281. /package/dist/public/assets/{external-link-BkNoUOYg.js → external-link-Bw5EK5AQ.js} +0 -0
  282. /package/dist/public/assets/{file-tree-rename-validation-CEz8MVWM.js → file-tree-rename-validation-Dt6fQYnB.js} +0 -0
  283. /package/dist/public/assets/{globals-C-kRTFCu.js → globals-C9aYStL7.js} +0 -0
  284. /package/dist/public/assets/{input-BKUcczSW.js → input-_CzMpvY9.js} +0 -0
  285. /package/dist/public/assets/{overlay-layers-BqWhClsR.js → overlay-layers-C1Y78Wu8.js} +0 -0
  286. /package/dist/public/assets/{panel-CbGx_cRv.js → panel-DVJ8gssn.js} +0 -0
  287. /package/dist/public/assets/{parse-api-error-Cyn4P6OR.js → parse-api-error-Mgtc4OJu.js} +0 -0
  288. /package/dist/public/assets/{startup-marks-BzFN1cqP.js → startup-marks-BPO-vrjH.js} +0 -0
  289. /package/dist/public/assets/{stex-CyLY7DTo.js → stex-Cj2UNqUe.js} +0 -0
  290. /package/dist/public/assets/{workspace-paths-EgbOaHls.js → workspace-paths-D7hYulMY.js} +0 -0
@@ -1 +1 @@
1
- import{C as e,Ct as t,D as n,Dt as r,Ft as i,Ht as a,It as o,Lt as s,N as c,O as l,P as u,R as d,Rt as f,S as p,St as m,Ut as h,V as g,Vt as ee,X as _,Y as te,j as v,kt as y,n as ne,t as re,wt as ie}from"./dist-BlH6jxEE.js";var ae=e=>{let{state:t}=e,n=t.doc.lineAt(t.selection.main.from),r=x(e.state,n.from);return r.line?oe(e):r.block?ce(e):!1};function b(e,t){return({state:n,dispatch:r})=>{if(n.readOnly)return!1;let i=e(t,n);return i?(r(n.update(i)),!0):!1}}var oe=b(de,0),se=b(C,0),ce=b((e,t)=>C(e,t,ue(t)),0);function x(e,t){let n=e.languageDataAt(`commentTokens`,t,1);return n.length?n[0]:{}}var S=50;function le(e,{open:t,close:n},r,i){let a=e.sliceDoc(r-S,r),o=e.sliceDoc(i,i+S),s=/\s*$/.exec(a)[0].length,c=/^\s*/.exec(o)[0].length,l=a.length-s;if(a.slice(l-t.length,l)==t&&o.slice(c,c+n.length)==n)return{open:{pos:r-s,margin:s&&1},close:{pos:i+c,margin:c&&1}};let u,d;i-r<=2*S?u=d=e.sliceDoc(r,i):(u=e.sliceDoc(r,r+S),d=e.sliceDoc(i-S,i));let f=/^\s*/.exec(u)[0].length,p=/\s*$/.exec(d)[0].length,m=d.length-p-n.length;return u.slice(f,f+t.length)==t&&d.slice(m,m+n.length)==n?{open:{pos:r+f+t.length,margin:+!!/\s/.test(u.charAt(f+t.length))},close:{pos:i-p-n.length,margin:+!!/\s/.test(d.charAt(m-1))}}:null}function ue(e){let t=[];for(let n of e.selection.ranges){let r=e.doc.lineAt(n.from),i=n.to<=r.to?r:e.doc.lineAt(n.to);i.from>r.from&&i.from==n.to&&(i=n.to==r.to+1?r:e.doc.lineAt(n.to-1));let a=t.length-1;a>=0&&t[a].to>r.from?t[a].to=i.to:t.push({from:r.from+/^\s*/.exec(r.text)[0].length,to:i.to})}return t}function C(e,t,n=t.selection.ranges){let r=n.map(e=>x(t,e.from).block);if(!r.every(e=>e))return null;let i=n.map((e,n)=>le(t,r[n],e.from,e.to));if(e!=2&&!i.every(e=>e))return{changes:t.changes(n.map((e,t)=>i[t]?[]:[{from:e.from,insert:r[t].open+` `},{from:e.to,insert:` `+r[t].close}]))};if(e!=1&&i.some(e=>e)){let e=[];for(let t=0,n;t<i.length;t++)if(n=i[t]){let i=r[t],{open:a,close:o}=n;e.push({from:a.pos-i.open.length,to:a.pos+a.margin},{from:o.pos-o.margin,to:o.pos+i.close.length})}return{changes:e}}return null}function de(e,t,n=t.selection.ranges){let r=[],i=-1;ranges:for(let{from:e,to:a}of n){let n=r.length,o=1e9,s;for(let n=e;n<=a;){let c=t.doc.lineAt(n);if(s==null&&(s=x(t,c.from).line,!s))continue ranges;if(c.from>i&&(e==a||a>c.from)){i=c.from;let e=/^\s*/.exec(c.text)[0].length,t=e==c.length,n=c.text.slice(e,e+s.length)==s?e:-1;e<c.text.length&&e<o&&(o=e),r.push({line:c,comment:n,token:s,indent:e,empty:t,single:!1})}n=c.to+1}if(o<1e9)for(let e=n;e<r.length;e++)r[e].indent<r[e].line.text.length&&(r[e].indent=o);r.length==n+1&&(r[n].single=!0)}if(e!=2&&r.some(e=>e.comment<0&&(!e.empty||e.single))){let e=[];for(let{line:t,token:n,indent:i,empty:a,single:o}of r)(o||!a)&&e.push({from:t.from+i,insert:n+` `});let n=t.changes(e);return{changes:n,selection:t.selection.map(n,1)}}else if(e!=1&&r.some(e=>e.comment>=0)){let e=[];for(let{line:t,comment:n,token:i}of r)if(n>=0){let r=t.from+n,a=r+i.length;t.text[a-t.from]==` `&&a++,e.push({from:r,to:a})}return{changes:e}}return null}var w=m.define(),fe=m.define(),pe=y.define(),me=y.define({combine(e){return ee(e,{minDepth:100,newGroupDelay:500,joinToEvent:(e,t)=>t},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(e,t)=>(n,r)=>e(n,r)||t(n,r)})}}),he=o.define({create(){return P.empty},update(e,t){let n=t.state.facet(me),r=t.annotation(w);if(r){let i=O.fromTransaction(t,r.selection),a=r.side,o=a==0?e.undone:e.done;return o=i?k(o,o.length,n.minDepth,i):M(o,t.startState.selection),new P(a==0?r.rest:o,a==0?o:r.rest)}let i=t.annotation(fe);if((i==`full`||i==`before`)&&(e=e.isolate()),t.annotation(f.addToHistory)===!1)return t.changes.empty?e:e.addMapping(t.changes.desc);let a=O.fromTransaction(t),o=t.annotation(f.time),s=t.annotation(f.userEvent);return a?e=e.addChanges(a,o,s,n,t):t.selection&&(e=e.addSelection(t.startState.selection,o,s,n.newGroupDelay)),(i==`full`||i==`after`)&&(e=e.isolate()),e},toJSON(e){return{done:e.done.map(e=>e.toJSON()),undone:e.undone.map(e=>e.toJSON())}},fromJSON(e){return new P(e.done.map(O.fromJSON),e.undone.map(O.fromJSON))}});function ge(e={}){return[he,me.of(e),_.domEventHandlers({beforeinput(e,t){let n=e.inputType==`historyUndo`?E:e.inputType==`historyRedo`?D:null;return n?(e.preventDefault(),n(t)):!1}})]}function T(e,t){return function({state:n,dispatch:r}){if(!t&&n.readOnly)return!1;let i=n.field(he,!1);if(!i)return!1;let a=i.pop(e,n,t);return a?(r(a),!0):!1}}var E=T(0,!1),D=T(1,!1),_e=T(0,!0),ve=T(1,!0),O=class e{constructor(e,t,n,r,i){this.changes=e,this.effects=t,this.mapped=n,this.startSelection=r,this.selectionsAfter=i}setSelAfter(t){return new e(this.changes,this.effects,this.mapped,this.startSelection,t)}toJSON(){return{changes:this.changes?.toJSON(),mapped:this.mapped?.toJSON(),startSelection:this.startSelection?.toJSON(),selectionsAfter:this.selectionsAfter.map(e=>e.toJSON())}}static fromJSON(n){return new e(n.changes&&ie.fromJSON(n.changes),[],n.mapped&&t.fromJSON(n.mapped),n.startSelection&&r.fromJSON(n.startSelection),n.selectionsAfter.map(r.fromJSON))}static fromTransaction(t,n){let r=j;for(let e of t.startState.facet(pe)){let n=e(t);n.length&&(r=r.concat(n))}return!r.length&&t.changes.empty?null:new e(t.changes.invert(t.startState.doc),r,void 0,n||t.startState.selection,j)}static selection(t){return new e(void 0,j,void 0,void 0,t)}};function k(e,t,n,r){let i=t+1>n+20?t-n-1:0,a=e.slice(i,t);return a.push(r),a}function ye(e,t){let n=[],r=!1;return e.iterChangedRanges((e,t)=>n.push(e,t)),t.iterChangedRanges((e,t,i,a)=>{for(let e=0;e<n.length;){let t=n[e++],o=n[e++];a>=t&&i<=o&&(r=!0)}}),r}function be(e,t){return e.ranges.length==t.ranges.length&&e.ranges.filter((e,n)=>e.empty!=t.ranges[n].empty).length===0}function A(e,t){return e.length?t.length?e.concat(t):e:t}var j=[],xe=200;function M(e,t){if(e.length){let n=e[e.length-1],r=n.selectionsAfter.slice(Math.max(0,n.selectionsAfter.length-xe));return r.length&&r[r.length-1].eq(t)?e:(r.push(t),k(e,e.length-1,1e9,n.setSelAfter(r)))}else return[O.selection([t])]}function Se(e){let t=e[e.length-1],n=e.slice();return n[e.length-1]=t.setSelAfter(t.selectionsAfter.slice(0,t.selectionsAfter.length-1)),n}function N(e,t){if(!e.length)return e;let n=e.length,r=j;for(;n;){let i=Ce(e[n-1],t,r);if(i.changes&&!i.changes.empty||i.effects.length){let t=e.slice(0,n);return t[n-1]=i,t}else t=i.mapped,n--,r=i.selectionsAfter}return r.length?[O.selection(r)]:j}function Ce(e,t,n){let r=A(e.selectionsAfter.length?e.selectionsAfter.map(e=>e.map(t)):j,n);if(!e.changes)return O.selection(r);let a=e.changes.map(t),o=t.mapDesc(e.changes,!0),s=e.mapped?e.mapped.composeDesc(o):o;return new O(a,i.mapEffects(e.effects,t),s,e.startSelection.map(o),r)}var we=/^(input\.type|delete)($|\.)/,P=class e{constructor(e,t,n=0,r=void 0){this.done=e,this.undone=t,this.prevTime=n,this.prevUserEvent=r}isolate(){return this.prevTime?new e(this.done,this.undone):this}addChanges(t,n,r,a,o){let s=this.done,c=s[s.length-1];return s=c&&c.changes&&!c.changes.empty&&t.changes&&(!r||we.test(r))&&(!c.selectionsAfter.length&&n-this.prevTime<a.newGroupDelay&&a.joinToEvent(o,ye(c.changes,t.changes))||r==`input.type.compose`)?k(s,s.length-1,a.minDepth,new O(t.changes.compose(c.changes),A(i.mapEffects(t.effects,c.changes),c.effects),c.mapped,c.startSelection,j)):k(s,s.length,a.minDepth,t),new e(s,j,n,r)}addSelection(t,n,r,i){let a=this.done.length?this.done[this.done.length-1].selectionsAfter:j;return a.length>0&&n-this.prevTime<i&&r==this.prevUserEvent&&r&&/^select($|\.)/.test(r)&&be(a[a.length-1],t)?this:new e(M(this.done,t),this.undone,n,r)}addMapping(t){return new e(N(this.done,t),N(this.undone,t),this.prevTime,this.prevUserEvent)}pop(e,t,n){let r=e==0?this.done:this.undone;if(r.length==0)return null;let i=r[r.length-1],a=i.selectionsAfter[0]||(i.startSelection?i.startSelection.map(i.changes.invertedDesc,1):t.selection);if(n&&i.selectionsAfter.length)return t.update({selection:i.selectionsAfter[i.selectionsAfter.length-1],annotations:w.of({side:e,rest:Se(r),selection:a}),userEvent:e==0?`select.undo`:`select.redo`,scrollIntoView:!0});if(i.changes){let n=r.length==1?j:r.slice(0,r.length-1);return i.mapped&&(n=N(n,i.mapped)),t.update({changes:i.changes,selection:i.startSelection,effects:i.effects,annotations:w.of({side:e,rest:n,selection:a}),filter:!1,userEvent:e==0?`undo`:`redo`,scrollIntoView:!0})}else return null}};P.empty=new P(j,j);var Te=[{key:`Mod-z`,run:E,preventDefault:!0},{key:`Mod-y`,mac:`Mod-Shift-z`,run:D,preventDefault:!0},{linux:`Ctrl-Shift-z`,run:D,preventDefault:!0},{key:`Mod-u`,run:_e,preventDefault:!0},{key:`Alt-u`,mac:`Mod-Shift-u`,run:ve,preventDefault:!0}];function F(e,t){return r.create(e.ranges.map(t),e.mainIndex)}function I(e,t){return e.update({selection:t,scrollIntoView:!0,userEvent:`select`})}function L({state:e,dispatch:t},n){let r=F(e.selection,n);return r.eq(e.selection,!0)?!1:(t(I(e,r)),!0)}function R(e,t){return r.cursor(t?e.to:e.from)}function z(e,t){return L(e,n=>n.empty?e.moveByChar(n,t):R(n,t))}function B(e){return e.textDirectionAt(e.state.selection.main.head)==te.LTR}var V=e=>z(e,!B(e)),H=e=>z(e,B(e));function Ee(e,t){return L(e,n=>n.empty?e.moveByGroup(n,t):R(n,t))}var De=e=>Ee(e,!B(e)),Oe=e=>Ee(e,B(e));typeof Intl<`u`&&Intl.Segmenter;function ke(e,t,n){if(t.type.prop(n))return!0;let r=t.to-t.from;return r&&(r>2||/[^\s,.;:]/.test(e.sliceDoc(t.from,t.to)))||t.firstChild}function U(e,t,n){let i=u(e).resolveInner(t.head),a=n?g.closedBy:g.openedBy;for(let r=t.head;;){let t=n?i.childAfter(r):i.childBefore(r);if(!t)break;ke(e,t,a)?i=t:r=n?t.to:t.from}let o=i.type.prop(a),s,c;return c=o&&(s=n?v(e,i.from,1):v(e,i.to,-1))&&s.matched?n?s.end.to:s.end.from:n?i.to:i.from,r.cursor(c,n?-1:1)}var Ae=e=>L(e,t=>U(e.state,t,!B(e))),je=e=>L(e,t=>U(e.state,t,B(e)));function Me(e,t){return L(e,n=>{if(!n.empty)return R(n,t);let r=e.moveVertically(n,t);return r.head==n.head?e.moveToLineBoundary(n,t):r})}var Ne=e=>Me(e,!1),Pe=e=>Me(e,!0);function Fe(e){let t=e.scrollDOM.clientHeight<e.scrollDOM.scrollHeight-2,n=0,r=0,i;if(t){for(let t of e.state.facet(_.scrollMargins)){let i=t(e);i?.top&&(n=Math.max(i?.top,n)),i?.bottom&&(r=Math.max(i?.bottom,r))}i=e.scrollDOM.clientHeight-n-r}else i=(e.dom.ownerDocument.defaultView||window).innerHeight;return{marginTop:n,marginBottom:r,selfScroll:t,height:Math.max(e.defaultLineHeight,i-5)}}function W(e,t){let n=Fe(e),{state:r}=e,i=F(r.selection,r=>r.empty?e.moveVertically(r,t,n.height):R(r,t));if(i.eq(r.selection))return!1;let a;if(n.selfScroll){let t=e.coordsAtPos(r.selection.main.head),o=e.scrollDOM.getBoundingClientRect(),s=o.top+n.marginTop,c=o.bottom-n.marginBottom;t&&t.top>s&&t.bottom<c&&(a=_.scrollIntoView(i.main.head,{y:`start`,yMargin:t.top-s}))}return e.dispatch(I(r,i),{effects:a}),!0}var Ie=e=>W(e,!1),G=e=>W(e,!0);function K(e,t,n){let i=e.lineBlockAt(t.head),a=e.moveToLineBoundary(t,n);if(a.head==t.head&&a.head!=(n?i.to:i.from)&&(a=e.moveToLineBoundary(t,n,!1)),!n&&a.head==i.from&&i.length){let n=/^\s*/.exec(e.state.sliceDoc(i.from,Math.min(i.from+100,i.to)))[0].length;n&&t.head!=i.from+n&&(a=r.cursor(i.from+n))}return a}var Le=e=>L(e,t=>K(e,t,!0)),Re=e=>L(e,t=>K(e,t,!1)),ze=e=>L(e,t=>K(e,t,!B(e))),Be=e=>L(e,t=>K(e,t,B(e))),Ve=e=>L(e,t=>r.cursor(e.lineBlockAt(t.head).from,1)),He=e=>L(e,t=>r.cursor(e.lineBlockAt(t.head).to,-1));function Ue(e,t,n){let i=!1,a=F(e.selection,t=>{let a=v(e,t.head,-1)||v(e,t.head,1)||t.head>0&&v(e,t.head-1,1)||t.head<e.doc.length&&v(e,t.head+1,-1);if(!a||!a.end)return t;i=!0;let o=a.start.from==t.head?a.end.to:a.end.from;return n?r.range(t.anchor,o):r.cursor(o)});return i?(t(I(e,a)),!0):!1}var We=({state:e,dispatch:t})=>Ue(e,t,!1);function q(e,t,n){let i=F(e.state.selection,e=>{e.undirectional&&e.head>=e.anchor!=t&&(e=r.range(e.head,e.anchor));let i=n(e);return r.range(e.anchor,i.head,i.goalColumn,i.bidiLevel||void 0,i.assoc)});return i.eq(e.state.selection)?!1:(e.dispatch(I(e.state,i)),!0)}function Ge(e,t){return q(e,t,n=>e.moveByChar(n,t))}var Ke=e=>Ge(e,!B(e)),qe=e=>Ge(e,B(e));function Je(e,t){return q(e,t,n=>e.moveByGroup(n,t))}var Ye=e=>Je(e,!B(e)),Xe=e=>Je(e,B(e)),Ze=e=>{let t=!B(e);return q(e,t,n=>U(e.state,n,t))},Qe=e=>{let t=B(e);return q(e,t,n=>U(e.state,n,t))};function $e(e,t){return q(e,t,n=>e.moveVertically(n,t))}var et=e=>$e(e,!1),tt=e=>$e(e,!0);function nt(e,t){return q(e,t,n=>e.moveVertically(n,t,Fe(e).height))}var rt=e=>nt(e,!1),it=e=>nt(e,!0),at=e=>q(e,!0,t=>K(e,t,!0)),ot=e=>q(e,!1,t=>K(e,t,!1)),st=e=>{let t=!B(e);return q(e,t,n=>K(e,n,t))},ct=e=>{let t=B(e);return q(e,t,n=>K(e,n,t))},lt=e=>q(e,!1,t=>r.cursor(e.lineBlockAt(t.head).from)),ut=e=>q(e,!0,t=>r.cursor(e.lineBlockAt(t.head).to)),dt=({state:e,dispatch:t})=>(t(I(e,{anchor:0})),!0),ft=({state:e,dispatch:t})=>(t(I(e,{anchor:e.doc.length})),!0),pt=({state:e,dispatch:t})=>(t(I(e,{anchor:e.selection.main.anchor,head:0})),!0),mt=({state:e,dispatch:t})=>(t(I(e,{anchor:e.selection.main.anchor,head:e.doc.length})),!0),ht=({state:e,dispatch:t})=>(t(e.update({selection:{anchor:0,head:e.doc.length},userEvent:`select`})),!0),gt=({state:e,dispatch:t})=>{let n=Z(e).map(({from:t,to:n})=>r.range(t,Math.min(n+1,e.doc.length)));return t(e.update({selection:r.create(n),userEvent:`select`})),!0},_t=({state:e,dispatch:t})=>{let n=F(e.selection,t=>{let n=u(e),i=n.resolveStack(t.from,1);if(t.empty){let e=n.resolveStack(t.from,-1);e.node.from>=i.node.from&&e.node.to<=i.node.to&&(i=e)}for(let e=i;e;e=e.next){let{node:n}=e;if((n.from<t.from&&n.to>=t.to||n.to>t.to&&n.from<=t.from)&&e.next)return r.range(n.to,n.from)}return t});return n.eq(e.selection)?!1:(t(I(e,n)),!0)};function vt(e,t){let{state:n}=e,i=n.selection,a=n.selection.ranges.slice();for(let r of n.selection.ranges){let i=n.doc.lineAt(r.head);if(t?i.to<e.state.doc.length:i.from>0)for(let n=r;;){let r=e.moveVertically(n,t);if(r.head<i.from||r.head>i.to){a.some(e=>e.head==r.head)||a.push(r);break}else if(r.head==n.head)break;else n=r}}return a.length==i.ranges.length?!1:(e.dispatch(I(n,r.create(a,a.length-1))),!0)}var yt=e=>vt(e,!1),bt=e=>vt(e,!0),xt=({state:e,dispatch:t})=>{let n=e.selection,i=null;return n.ranges.length>1?i=r.create([n.main]):n.main.empty||(i=r.create([r.cursor(n.main.head)])),i?(t(I(e,i)),!0):!1};function J(e,t){if(e.state.readOnly)return!1;let n=`delete.selection`,{state:i}=e,a=i.changeByRange(i=>{let{from:a,to:o}=i;if(a==o){let r=t(i);r<a?(n=`delete.backward`,r=Y(e,r,!1)):r>a&&(n=`delete.forward`,r=Y(e,r,!0)),a=Math.min(a,r),o=Math.max(o,r)}else a=Y(e,a,!1),o=Y(e,o,!0);return a==o?{range:i}:{changes:{from:a,to:o},range:r.cursor(a,a<i.head?-1:1)}});return a.changes.empty?!1:(e.dispatch(i.update(a,{scrollIntoView:!0,userEvent:n,effects:n==`delete.selection`?_.announce.of(i.phrase(`Selection deleted`)):void 0})),!0)}function Y(e,t,n){if(e instanceof _)for(let r of e.state.facet(_.atomicRanges).map(t=>t(e)))r.between(t,t,(e,r)=>{e<t&&r>t&&(t=n?r:e)});return t}var St=(e,t,n)=>J(e,r=>{let i=r.from,{state:o}=e,s=o.doc.lineAt(i),c,l;if(n&&!t&&i>s.from&&i<s.from+200&&!/[^ \t]/.test(c=s.text.slice(0,i-s.from))){if(c[c.length-1]==` `)return i-1;let e=a(c,o.tabSize)%p(o)||p(o);for(let t=0;t<e&&c[c.length-1-t]==` `;t++)i--;l=i}else l=h(s.text,i-s.from,t,t)+s.from,l==i&&s.number!=(t?o.doc.lines:1)?l+=t?1:-1:!t&&/[\ufe00-\ufe0f]/.test(s.text.slice(l-s.from,i-s.from))&&(l=h(s.text,l-s.from,!1,!1)+s.from);return l}),X=e=>St(e,!1,!0),Ct=e=>St(e,!0,!1),wt=(e,t)=>J(e,n=>{let r=n.head,{state:i}=e,a=i.doc.lineAt(r),o=i.charCategorizer(r);for(let e=null;;){if(r==(t?a.to:a.from)){r==n.head&&a.number!=(t?i.doc.lines:1)&&(r+=t?1:-1);break}let s=h(a.text,r-a.from,t)+a.from,c=a.text.slice(Math.min(r,s)-a.from,Math.max(r,s)-a.from),l=o(c);if(e!=null&&l!=e)break;(c!=` `||r!=n.head)&&(e=l),r=s}return r}),Tt=e=>wt(e,!1),Et=e=>wt(e,!0),Dt=e=>J(e,t=>{let n=e.lineBlockAt(t.head).to;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)}),Ot=e=>J(e,t=>{let n=e.moveToLineBoundary(t,!1).head;return t.head>n?n:Math.max(0,t.head-1)}),kt=e=>J(e,t=>{let n=e.moveToLineBoundary(t,!0).head;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)}),At=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange(e=>({changes:{from:e.from,to:e.to,insert:s.of([``,``])},range:r.cursor(e.from)}));return t(e.update(n,{scrollIntoView:!0,userEvent:`input`})),!0},jt=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange(t=>{if(!t.empty||t.from==0||t.from==e.doc.length)return{range:t};let n=t.from,i=e.doc.lineAt(n),a=n==i.from?n-1:h(i.text,n-i.from,!1)+i.from,o=n==i.to?n+1:h(i.text,n-i.from,!0)+i.from;return{changes:{from:a,to:o,insert:e.doc.slice(n,o).append(e.doc.slice(a,n))},range:r.cursor(o)}});return n.changes.empty?!1:(t(e.update(n,{scrollIntoView:!0,userEvent:`move.character`})),!0)};function Z(e){let t=[],n=-1;for(let r of e.selection.ranges){let i=e.doc.lineAt(r.from),a=e.doc.lineAt(r.to);if(!r.empty&&r.to==a.from&&(a=e.doc.lineAt(r.to-1)),n>=i.number){let e=t[t.length-1];e.to=a.to,e.ranges.push(r)}else t.push({from:i.from,to:a.to,ranges:[r]});n=a.number+1}return t}function Mt(e,t,n){if(e.readOnly)return!1;let i=[],a=[];for(let t of Z(e)){if(n?t.to==e.doc.length:t.from==0)continue;let o=e.doc.lineAt(n?t.to+1:t.from-1),s=o.length+1;if(n){i.push({from:t.to,to:o.to},{from:t.from,insert:o.text+e.lineBreak});for(let n of t.ranges)a.push(r.range(Math.min(e.doc.length,n.anchor+s),Math.min(e.doc.length,n.head+s)))}else{i.push({from:o.from,to:t.from},{from:t.to,insert:e.lineBreak+o.text});for(let e of t.ranges)a.push(r.range(e.anchor-s,e.head-s))}}return i.length?(t(e.update({changes:i,scrollIntoView:!0,selection:r.create(a,e.selection.mainIndex),userEvent:`move.line`})),!0):!1}var Nt=({state:e,dispatch:t})=>Mt(e,t,!1),Pt=({state:e,dispatch:t})=>Mt(e,t,!0);function Ft(e,t,n){if(e.readOnly)return!1;let r=[];for(let t of Z(e))n?r.push({from:t.from,insert:e.doc.slice(t.from,t.to)+e.lineBreak}):r.push({from:t.to,insert:e.lineBreak+e.doc.slice(t.from,t.to)});let i=e.changes(r);return t(e.update({changes:i,selection:e.selection.map(i,n?1:-1),scrollIntoView:!0,userEvent:`input.copyline`})),!0}var It=({state:e,dispatch:t})=>Ft(e,t,!1),Lt=({state:e,dispatch:t})=>Ft(e,t,!0),Rt=e=>{if(e.state.readOnly)return!1;let{state:t}=e,n=t.changes(Z(t).map(({from:e,to:n})=>(e>0?e--:n<t.doc.length&&n++,{from:e,to:n}))),r=F(t.selection,t=>{let n;if(e.lineWrapping){let r=e.lineBlockAt(t.head),i=e.coordsAtPos(t.head,t.assoc||1);i&&(n=r.bottom+e.documentTop-i.bottom+e.defaultLineHeight/2)}return e.moveVertically(t,!0,n)}).map(n);return e.dispatch({changes:n,selection:r,scrollIntoView:!0,userEvent:`delete.line`}),!0};function zt(e,t){if(/\(\)|\[\]|\{\}/.test(e.sliceDoc(t-1,t+1)))return{from:t,to:t};let n=u(e).resolveInner(t),r=n.childBefore(t),i=n.childAfter(t),a;return r&&i&&r.to<=t&&i.from>=t&&(a=r.type.prop(g.closedBy))&&a.indexOf(i.name)>-1&&e.doc.lineAt(r.to).from==e.doc.lineAt(i.from).from&&!/\S/.test(e.sliceDoc(r.to,i.from))?{from:r.to,to:i.from}:null}var Bt=Ht(!1),Vt=Ht(!0);function Ht(t){return({state:i,dispatch:o})=>{if(i.readOnly)return!1;let c=i.changeByRange(o=>{let{from:c,to:l}=o,u=i.doc.lineAt(c),d=!t&&c==l&&zt(i,c);t&&(c=l=(l<=u.to?u:i.doc.lineAt(l)).to);let f=new ne(i,{simulateBreak:c,simulateDoubleBreak:!!d}),p=e(f,c);for(p??=a(/^\s*/.exec(i.doc.lineAt(c).text)[0],i.tabSize);l<u.to&&/\s/.test(u.text[l-u.from]);)l++;d?{from:c,to:l}=d:c>u.from&&c<u.from+100&&!/\S/.test(u.text.slice(0,c))&&(c=u.from);let m=[``,n(i,p)];return d&&m.push(n(i,f.lineIndent(u.from,-1))),{changes:{from:c,to:l,insert:s.of(m)},range:r.cursor(c+1+m[1].length)}});return o(i.update(c,{scrollIntoView:!0,userEvent:`input`})),!0}}function Q(e,t){let n=-1;return e.changeByRange(i=>{let a=[];for(let r=i.from;r<=i.to;){let o=e.doc.lineAt(r);o.number>n&&(i.empty||i.to>o.from)&&(t(o,a,i),n=o.number),r=o.to+1}let o=e.changes(a);return{changes:a,range:r.range(o.mapPos(i.anchor,1),o.mapPos(i.head,1))}})}var Ut=({state:t,dispatch:r})=>{if(t.readOnly)return!1;let i=Object.create(null),a=new ne(t,{overrideIndentation:e=>i[e]??-1}),o=Q(t,(r,o,s)=>{let c=e(a,r.from);if(c==null)return;/\S/.test(r.text)||(c=0);let l=/^\s*/.exec(r.text)[0],u=n(t,c);(l!=u||s.from<r.from+l.length)&&(i[r.from]=c,o.push({from:r.from,to:r.from+l.length,insert:u}))});return o.changes.empty||r(t.update(o,{userEvent:`indent`})),!0},Wt=({state:e,dispatch:t})=>e.readOnly?!1:(t(e.update(Q(e,(t,n)=>{n.push({from:t.from,insert:e.facet(l)})}),{userEvent:`input.indent`})),!0),$=({state:e,dispatch:t})=>e.readOnly?!1:(t(e.update(Q(e,(t,r)=>{let i=/^\s*/.exec(t.text)[0];if(!i)return;let o=a(i,e.tabSize),s=0,c=n(e,Math.max(0,o-p(e)));for(;s<i.length&&s<c.length&&i.charCodeAt(s)==c.charCodeAt(s);)s++;r.push({from:t.from+s,to:t.from+i.length,insert:c.slice(s)})}),{userEvent:`delete.dedent`})),!0),Gt=e=>(e.setTabFocusMode(),!0),Kt=[{key:`Ctrl-b`,run:V,shift:Ke,preventDefault:!0},{key:`Ctrl-f`,run:H,shift:qe},{key:`Ctrl-p`,run:Ne,shift:et},{key:`Ctrl-n`,run:Pe,shift:tt},{key:`Ctrl-a`,run:Ve,shift:lt},{key:`Ctrl-e`,run:He,shift:ut},{key:`Ctrl-d`,run:Ct},{key:`Ctrl-h`,run:X},{key:`Ctrl-k`,run:Dt},{key:`Ctrl-Alt-h`,run:Tt},{key:`Ctrl-o`,run:At},{key:`Ctrl-t`,run:jt},{key:`Ctrl-v`,run:G}],qt=[{key:`ArrowLeft`,run:V,shift:Ke,preventDefault:!0},{key:`Mod-ArrowLeft`,mac:`Alt-ArrowLeft`,run:De,shift:Ye,preventDefault:!0},{mac:`Cmd-ArrowLeft`,run:ze,shift:st,preventDefault:!0},{key:`ArrowRight`,run:H,shift:qe,preventDefault:!0},{key:`Mod-ArrowRight`,mac:`Alt-ArrowRight`,run:Oe,shift:Xe,preventDefault:!0},{mac:`Cmd-ArrowRight`,run:Be,shift:ct,preventDefault:!0},{key:`ArrowUp`,run:Ne,shift:et,preventDefault:!0},{mac:`Cmd-ArrowUp`,run:dt,shift:pt},{mac:`Ctrl-ArrowUp`,run:Ie,shift:rt},{key:`ArrowDown`,run:Pe,shift:tt,preventDefault:!0},{mac:`Cmd-ArrowDown`,run:ft,shift:mt},{mac:`Ctrl-ArrowDown`,run:G,shift:it},{key:`PageUp`,run:Ie,shift:rt},{key:`PageDown`,run:G,shift:it},{key:`Home`,run:Re,shift:ot,preventDefault:!0},{key:`Mod-Home`,run:dt,shift:pt},{key:`End`,run:Le,shift:at,preventDefault:!0},{key:`Mod-End`,run:ft,shift:mt},{key:`Enter`,run:Bt,shift:Bt},{key:`Mod-a`,run:ht},{key:`Backspace`,run:X,shift:X,preventDefault:!0},{key:`Delete`,run:Ct,preventDefault:!0},{key:`Mod-Backspace`,mac:`Alt-Backspace`,run:Tt,preventDefault:!0},{key:`Mod-Delete`,mac:`Alt-Delete`,run:Et,preventDefault:!0},{mac:`Mod-Backspace`,run:Ot,preventDefault:!0},{mac:`Mod-Delete`,run:kt,preventDefault:!0}].concat(Kt.map(e=>({mac:e.key,run:e.run,shift:e.shift}))),Jt=[{key:`Alt-ArrowLeft`,mac:`Ctrl-ArrowLeft`,run:Ae,shift:Ze},{key:`Alt-ArrowRight`,mac:`Ctrl-ArrowRight`,run:je,shift:Qe},{key:`Alt-ArrowUp`,run:Nt},{key:`Shift-Alt-ArrowUp`,run:It},{key:`Alt-ArrowDown`,run:Pt},{key:`Shift-Alt-ArrowDown`,run:Lt},{key:`Mod-Alt-ArrowUp`,run:yt},{key:`Mod-Alt-ArrowDown`,run:bt},{key:`Escape`,run:xt},{key:`Mod-Enter`,run:Vt},{key:`Alt-l`,mac:`Ctrl-l`,run:gt},{key:`Mod-i`,run:_t,preventDefault:!0},{key:`Mod-[`,run:$},{key:`Mod-]`,run:Wt},{key:`Mod-Alt-\\`,run:Ut},{key:`Shift-Mod-k`,run:Rt},{key:`Shift-Mod-\\`,run:We},{key:`Mod-/`,run:ae},{key:`Alt-A`,run:se},{key:`Ctrl-m`,mac:`Shift-Alt-m`,run:Gt}].concat(qt),Yt={key:`Tab`,run:Wt,shift:$},Xt=re.define([{tag:[d.heading,d.heading1,d.heading2,d.heading3],color:`var(--syntax-func)`,fontWeight:`bold`},{tag:[d.heading4,d.heading5,d.heading6],color:`var(--syntax-func)`},{tag:d.strong,fontWeight:`bold`,color:`var(--foreground)`},{tag:d.emphasis,fontStyle:`italic`,color:`var(--foreground)`},{tag:d.strikethrough,textDecoration:`line-through`},{tag:d.link,color:`var(--link-color)`,textDecoration:`underline`,textUnderlinePosition:`under`},{tag:d.url,color:`var(--syntax-attr)`},{tag:d.monospace,color:`var(--syntax-string)`},{tag:d.quote,color:`var(--syntax-comment)`,fontStyle:`italic`},{tag:d.list,color:`var(--syntax-keyword)`},{tag:d.contentSeparator,color:`var(--syntax-comment)`},{tag:d.processingInstruction,color:`var(--muted-foreground)`},{tag:[d.comment,d.lineComment,d.blockComment],color:`var(--syntax-comment)`,fontStyle:`italic`},{tag:[d.meta,d.annotation,d.namespace],color:`var(--syntax-meta)`},{tag:d.docComment,color:`var(--syntax-comment)`,fontStyle:`italic`},{tag:[d.keyword,d.controlKeyword,d.moduleKeyword,d.operatorKeyword],color:`var(--syntax-keyword)`,fontWeight:`600`},{tag:[d.modifier,d.self],color:`var(--syntax-keyword)`},{tag:d.tagName,color:`var(--syntax-tag)`},{tag:[d.typeName,d.className],color:`var(--syntax-type)`},{tag:[d.attributeName,d.propertyName],color:`var(--syntax-attr)`},{tag:[d.variableName,d.macroName],color:`var(--syntax-var)`},{tag:[d.function(d.variableName),d.definition(d.name),d.labelName],color:`var(--syntax-func)`},{tag:[d.string,d.character,d.special(d.string)],color:`var(--syntax-string)`},{tag:[d.number,d.integer,d.float,d.literal],color:`var(--syntax-number)`},{tag:[d.bool,d.null,d.atom,d.constant(d.name),d.standard(d.name)],color:`var(--syntax-atom)`},{tag:[d.regexp,d.escape],color:`var(--syntax-atom)`},{tag:d.color,color:`var(--syntax-atom)`},{tag:[d.operator,d.punctuation,d.separator,d.bracket,d.brace,d.paren,d.squareBracket,d.angleBracket],color:`var(--syntax-operator)`},{tag:d.inserted,color:`var(--diff-added)`},{tag:d.deleted,color:`var(--diff-removed)`},{tag:d.changed,color:`var(--syntax-number)`},{tag:d.invalid,color:`var(--destructive)`}]);function Zt(e){let t=e.background??`transparent`,n=e.gutterBackground??`transparent`;return _.theme({"&":{color:`var(--foreground)`,backgroundColor:t},".cm-content":{caretColor:`var(--foreground)`},".cm-cursor, .cm-dropCursor":{borderLeftColor:`var(--foreground)`},"&.cm-focused .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:`var(--selection-soft)`},".cm-selectionMatch":{backgroundColor:`color-mix(in oklab, var(--syntax-type) 30%, transparent)`},".cm-gutters":{backgroundColor:n,color:`var(--muted-foreground)`,border:`none`},".cm-activeLine":{backgroundColor:`color-mix(in oklab, var(--foreground) 4%, transparent)`},".cm-activeLineGutter":{backgroundColor:`transparent`,color:`var(--foreground)`},".cm-foldPlaceholder":{backgroundColor:`var(--muted)`,color:`var(--muted-foreground)`,border:`none`},".cm-panels":{backgroundColor:`var(--popover)`,color:`var(--popover-foreground)`},".cm-searchMatch":{backgroundColor:`color-mix(in oklab, var(--syntax-type) 30%, transparent)`},".cm-searchMatch.cm-searchMatch-selected":{backgroundColor:`color-mix(in oklab, var(--primary) 40%, transparent)`}},{dark:e.dark})}function Qt(e){return[Zt(e),c(Xt,{fallback:!0})]}export{Yt as a,Te as i,Jt as n,E as o,ge as r,Qt as t};
1
+ import{C as e,Ct as t,D as n,Dt as r,Ft as i,Ht as a,It as o,Lt as s,N as c,O as l,P as u,R as d,Rt as f,S as p,St as m,Ut as h,V as g,Vt as ee,X as _,Y as te,j as v,kt as y,n as ne,t as re,wt as ie}from"./dist-BTu6o3T-.js";var ae=e=>{let{state:t}=e,n=t.doc.lineAt(t.selection.main.from),r=x(e.state,n.from);return r.line?oe(e):r.block?ce(e):!1};function b(e,t){return({state:n,dispatch:r})=>{if(n.readOnly)return!1;let i=e(t,n);return i?(r(n.update(i)),!0):!1}}var oe=b(de,0),se=b(C,0),ce=b((e,t)=>C(e,t,ue(t)),0);function x(e,t){let n=e.languageDataAt(`commentTokens`,t,1);return n.length?n[0]:{}}var S=50;function le(e,{open:t,close:n},r,i){let a=e.sliceDoc(r-S,r),o=e.sliceDoc(i,i+S),s=/\s*$/.exec(a)[0].length,c=/^\s*/.exec(o)[0].length,l=a.length-s;if(a.slice(l-t.length,l)==t&&o.slice(c,c+n.length)==n)return{open:{pos:r-s,margin:s&&1},close:{pos:i+c,margin:c&&1}};let u,d;i-r<=2*S?u=d=e.sliceDoc(r,i):(u=e.sliceDoc(r,r+S),d=e.sliceDoc(i-S,i));let f=/^\s*/.exec(u)[0].length,p=/\s*$/.exec(d)[0].length,m=d.length-p-n.length;return u.slice(f,f+t.length)==t&&d.slice(m,m+n.length)==n?{open:{pos:r+f+t.length,margin:+!!/\s/.test(u.charAt(f+t.length))},close:{pos:i-p-n.length,margin:+!!/\s/.test(d.charAt(m-1))}}:null}function ue(e){let t=[];for(let n of e.selection.ranges){let r=e.doc.lineAt(n.from),i=n.to<=r.to?r:e.doc.lineAt(n.to);i.from>r.from&&i.from==n.to&&(i=n.to==r.to+1?r:e.doc.lineAt(n.to-1));let a=t.length-1;a>=0&&t[a].to>r.from?t[a].to=i.to:t.push({from:r.from+/^\s*/.exec(r.text)[0].length,to:i.to})}return t}function C(e,t,n=t.selection.ranges){let r=n.map(e=>x(t,e.from).block);if(!r.every(e=>e))return null;let i=n.map((e,n)=>le(t,r[n],e.from,e.to));if(e!=2&&!i.every(e=>e))return{changes:t.changes(n.map((e,t)=>i[t]?[]:[{from:e.from,insert:r[t].open+` `},{from:e.to,insert:` `+r[t].close}]))};if(e!=1&&i.some(e=>e)){let e=[];for(let t=0,n;t<i.length;t++)if(n=i[t]){let i=r[t],{open:a,close:o}=n;e.push({from:a.pos-i.open.length,to:a.pos+a.margin},{from:o.pos-o.margin,to:o.pos+i.close.length})}return{changes:e}}return null}function de(e,t,n=t.selection.ranges){let r=[],i=-1;ranges:for(let{from:e,to:a}of n){let n=r.length,o=1e9,s;for(let n=e;n<=a;){let c=t.doc.lineAt(n);if(s==null&&(s=x(t,c.from).line,!s))continue ranges;if(c.from>i&&(e==a||a>c.from)){i=c.from;let e=/^\s*/.exec(c.text)[0].length,t=e==c.length,n=c.text.slice(e,e+s.length)==s?e:-1;e<c.text.length&&e<o&&(o=e),r.push({line:c,comment:n,token:s,indent:e,empty:t,single:!1})}n=c.to+1}if(o<1e9)for(let e=n;e<r.length;e++)r[e].indent<r[e].line.text.length&&(r[e].indent=o);r.length==n+1&&(r[n].single=!0)}if(e!=2&&r.some(e=>e.comment<0&&(!e.empty||e.single))){let e=[];for(let{line:t,token:n,indent:i,empty:a,single:o}of r)(o||!a)&&e.push({from:t.from+i,insert:n+` `});let n=t.changes(e);return{changes:n,selection:t.selection.map(n,1)}}else if(e!=1&&r.some(e=>e.comment>=0)){let e=[];for(let{line:t,comment:n,token:i}of r)if(n>=0){let r=t.from+n,a=r+i.length;t.text[a-t.from]==` `&&a++,e.push({from:r,to:a})}return{changes:e}}return null}var w=m.define(),fe=m.define(),pe=y.define(),me=y.define({combine(e){return ee(e,{minDepth:100,newGroupDelay:500,joinToEvent:(e,t)=>t},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(e,t)=>(n,r)=>e(n,r)||t(n,r)})}}),he=o.define({create(){return P.empty},update(e,t){let n=t.state.facet(me),r=t.annotation(w);if(r){let i=O.fromTransaction(t,r.selection),a=r.side,o=a==0?e.undone:e.done;return o=i?k(o,o.length,n.minDepth,i):M(o,t.startState.selection),new P(a==0?r.rest:o,a==0?o:r.rest)}let i=t.annotation(fe);if((i==`full`||i==`before`)&&(e=e.isolate()),t.annotation(f.addToHistory)===!1)return t.changes.empty?e:e.addMapping(t.changes.desc);let a=O.fromTransaction(t),o=t.annotation(f.time),s=t.annotation(f.userEvent);return a?e=e.addChanges(a,o,s,n,t):t.selection&&(e=e.addSelection(t.startState.selection,o,s,n.newGroupDelay)),(i==`full`||i==`after`)&&(e=e.isolate()),e},toJSON(e){return{done:e.done.map(e=>e.toJSON()),undone:e.undone.map(e=>e.toJSON())}},fromJSON(e){return new P(e.done.map(O.fromJSON),e.undone.map(O.fromJSON))}});function ge(e={}){return[he,me.of(e),_.domEventHandlers({beforeinput(e,t){let n=e.inputType==`historyUndo`?E:e.inputType==`historyRedo`?D:null;return n?(e.preventDefault(),n(t)):!1}})]}function T(e,t){return function({state:n,dispatch:r}){if(!t&&n.readOnly)return!1;let i=n.field(he,!1);if(!i)return!1;let a=i.pop(e,n,t);return a?(r(a),!0):!1}}var E=T(0,!1),D=T(1,!1),_e=T(0,!0),ve=T(1,!0),O=class e{constructor(e,t,n,r,i){this.changes=e,this.effects=t,this.mapped=n,this.startSelection=r,this.selectionsAfter=i}setSelAfter(t){return new e(this.changes,this.effects,this.mapped,this.startSelection,t)}toJSON(){return{changes:this.changes?.toJSON(),mapped:this.mapped?.toJSON(),startSelection:this.startSelection?.toJSON(),selectionsAfter:this.selectionsAfter.map(e=>e.toJSON())}}static fromJSON(n){return new e(n.changes&&ie.fromJSON(n.changes),[],n.mapped&&t.fromJSON(n.mapped),n.startSelection&&r.fromJSON(n.startSelection),n.selectionsAfter.map(r.fromJSON))}static fromTransaction(t,n){let r=j;for(let e of t.startState.facet(pe)){let n=e(t);n.length&&(r=r.concat(n))}return!r.length&&t.changes.empty?null:new e(t.changes.invert(t.startState.doc),r,void 0,n||t.startState.selection,j)}static selection(t){return new e(void 0,j,void 0,void 0,t)}};function k(e,t,n,r){let i=t+1>n+20?t-n-1:0,a=e.slice(i,t);return a.push(r),a}function ye(e,t){let n=[],r=!1;return e.iterChangedRanges((e,t)=>n.push(e,t)),t.iterChangedRanges((e,t,i,a)=>{for(let e=0;e<n.length;){let t=n[e++],o=n[e++];a>=t&&i<=o&&(r=!0)}}),r}function be(e,t){return e.ranges.length==t.ranges.length&&e.ranges.filter((e,n)=>e.empty!=t.ranges[n].empty).length===0}function A(e,t){return e.length?t.length?e.concat(t):e:t}var j=[],xe=200;function M(e,t){if(e.length){let n=e[e.length-1],r=n.selectionsAfter.slice(Math.max(0,n.selectionsAfter.length-xe));return r.length&&r[r.length-1].eq(t)?e:(r.push(t),k(e,e.length-1,1e9,n.setSelAfter(r)))}else return[O.selection([t])]}function Se(e){let t=e[e.length-1],n=e.slice();return n[e.length-1]=t.setSelAfter(t.selectionsAfter.slice(0,t.selectionsAfter.length-1)),n}function N(e,t){if(!e.length)return e;let n=e.length,r=j;for(;n;){let i=Ce(e[n-1],t,r);if(i.changes&&!i.changes.empty||i.effects.length){let t=e.slice(0,n);return t[n-1]=i,t}else t=i.mapped,n--,r=i.selectionsAfter}return r.length?[O.selection(r)]:j}function Ce(e,t,n){let r=A(e.selectionsAfter.length?e.selectionsAfter.map(e=>e.map(t)):j,n);if(!e.changes)return O.selection(r);let a=e.changes.map(t),o=t.mapDesc(e.changes,!0),s=e.mapped?e.mapped.composeDesc(o):o;return new O(a,i.mapEffects(e.effects,t),s,e.startSelection.map(o),r)}var we=/^(input\.type|delete)($|\.)/,P=class e{constructor(e,t,n=0,r=void 0){this.done=e,this.undone=t,this.prevTime=n,this.prevUserEvent=r}isolate(){return this.prevTime?new e(this.done,this.undone):this}addChanges(t,n,r,a,o){let s=this.done,c=s[s.length-1];return s=c&&c.changes&&!c.changes.empty&&t.changes&&(!r||we.test(r))&&(!c.selectionsAfter.length&&n-this.prevTime<a.newGroupDelay&&a.joinToEvent(o,ye(c.changes,t.changes))||r==`input.type.compose`)?k(s,s.length-1,a.minDepth,new O(t.changes.compose(c.changes),A(i.mapEffects(t.effects,c.changes),c.effects),c.mapped,c.startSelection,j)):k(s,s.length,a.minDepth,t),new e(s,j,n,r)}addSelection(t,n,r,i){let a=this.done.length?this.done[this.done.length-1].selectionsAfter:j;return a.length>0&&n-this.prevTime<i&&r==this.prevUserEvent&&r&&/^select($|\.)/.test(r)&&be(a[a.length-1],t)?this:new e(M(this.done,t),this.undone,n,r)}addMapping(t){return new e(N(this.done,t),N(this.undone,t),this.prevTime,this.prevUserEvent)}pop(e,t,n){let r=e==0?this.done:this.undone;if(r.length==0)return null;let i=r[r.length-1],a=i.selectionsAfter[0]||(i.startSelection?i.startSelection.map(i.changes.invertedDesc,1):t.selection);if(n&&i.selectionsAfter.length)return t.update({selection:i.selectionsAfter[i.selectionsAfter.length-1],annotations:w.of({side:e,rest:Se(r),selection:a}),userEvent:e==0?`select.undo`:`select.redo`,scrollIntoView:!0});if(i.changes){let n=r.length==1?j:r.slice(0,r.length-1);return i.mapped&&(n=N(n,i.mapped)),t.update({changes:i.changes,selection:i.startSelection,effects:i.effects,annotations:w.of({side:e,rest:n,selection:a}),filter:!1,userEvent:e==0?`undo`:`redo`,scrollIntoView:!0})}else return null}};P.empty=new P(j,j);var Te=[{key:`Mod-z`,run:E,preventDefault:!0},{key:`Mod-y`,mac:`Mod-Shift-z`,run:D,preventDefault:!0},{linux:`Ctrl-Shift-z`,run:D,preventDefault:!0},{key:`Mod-u`,run:_e,preventDefault:!0},{key:`Alt-u`,mac:`Mod-Shift-u`,run:ve,preventDefault:!0}];function F(e,t){return r.create(e.ranges.map(t),e.mainIndex)}function I(e,t){return e.update({selection:t,scrollIntoView:!0,userEvent:`select`})}function L({state:e,dispatch:t},n){let r=F(e.selection,n);return r.eq(e.selection,!0)?!1:(t(I(e,r)),!0)}function R(e,t){return r.cursor(t?e.to:e.from)}function z(e,t){return L(e,n=>n.empty?e.moveByChar(n,t):R(n,t))}function B(e){return e.textDirectionAt(e.state.selection.main.head)==te.LTR}var V=e=>z(e,!B(e)),H=e=>z(e,B(e));function Ee(e,t){return L(e,n=>n.empty?e.moveByGroup(n,t):R(n,t))}var De=e=>Ee(e,!B(e)),Oe=e=>Ee(e,B(e));typeof Intl<`u`&&Intl.Segmenter;function ke(e,t,n){if(t.type.prop(n))return!0;let r=t.to-t.from;return r&&(r>2||/[^\s,.;:]/.test(e.sliceDoc(t.from,t.to)))||t.firstChild}function U(e,t,n){let i=u(e).resolveInner(t.head),a=n?g.closedBy:g.openedBy;for(let r=t.head;;){let t=n?i.childAfter(r):i.childBefore(r);if(!t)break;ke(e,t,a)?i=t:r=n?t.to:t.from}let o=i.type.prop(a),s,c;return c=o&&(s=n?v(e,i.from,1):v(e,i.to,-1))&&s.matched?n?s.end.to:s.end.from:n?i.to:i.from,r.cursor(c,n?-1:1)}var Ae=e=>L(e,t=>U(e.state,t,!B(e))),je=e=>L(e,t=>U(e.state,t,B(e)));function Me(e,t){return L(e,n=>{if(!n.empty)return R(n,t);let r=e.moveVertically(n,t);return r.head==n.head?e.moveToLineBoundary(n,t):r})}var Ne=e=>Me(e,!1),Pe=e=>Me(e,!0);function Fe(e){let t=e.scrollDOM.clientHeight<e.scrollDOM.scrollHeight-2,n=0,r=0,i;if(t){for(let t of e.state.facet(_.scrollMargins)){let i=t(e);i?.top&&(n=Math.max(i?.top,n)),i?.bottom&&(r=Math.max(i?.bottom,r))}i=e.scrollDOM.clientHeight-n-r}else i=(e.dom.ownerDocument.defaultView||window).innerHeight;return{marginTop:n,marginBottom:r,selfScroll:t,height:Math.max(e.defaultLineHeight,i-5)}}function W(e,t){let n=Fe(e),{state:r}=e,i=F(r.selection,r=>r.empty?e.moveVertically(r,t,n.height):R(r,t));if(i.eq(r.selection))return!1;let a;if(n.selfScroll){let t=e.coordsAtPos(r.selection.main.head),o=e.scrollDOM.getBoundingClientRect(),s=o.top+n.marginTop,c=o.bottom-n.marginBottom;t&&t.top>s&&t.bottom<c&&(a=_.scrollIntoView(i.main.head,{y:`start`,yMargin:t.top-s}))}return e.dispatch(I(r,i),{effects:a}),!0}var Ie=e=>W(e,!1),G=e=>W(e,!0);function K(e,t,n){let i=e.lineBlockAt(t.head),a=e.moveToLineBoundary(t,n);if(a.head==t.head&&a.head!=(n?i.to:i.from)&&(a=e.moveToLineBoundary(t,n,!1)),!n&&a.head==i.from&&i.length){let n=/^\s*/.exec(e.state.sliceDoc(i.from,Math.min(i.from+100,i.to)))[0].length;n&&t.head!=i.from+n&&(a=r.cursor(i.from+n))}return a}var Le=e=>L(e,t=>K(e,t,!0)),Re=e=>L(e,t=>K(e,t,!1)),ze=e=>L(e,t=>K(e,t,!B(e))),Be=e=>L(e,t=>K(e,t,B(e))),Ve=e=>L(e,t=>r.cursor(e.lineBlockAt(t.head).from,1)),He=e=>L(e,t=>r.cursor(e.lineBlockAt(t.head).to,-1));function Ue(e,t,n){let i=!1,a=F(e.selection,t=>{let a=v(e,t.head,-1)||v(e,t.head,1)||t.head>0&&v(e,t.head-1,1)||t.head<e.doc.length&&v(e,t.head+1,-1);if(!a||!a.end)return t;i=!0;let o=a.start.from==t.head?a.end.to:a.end.from;return n?r.range(t.anchor,o):r.cursor(o)});return i?(t(I(e,a)),!0):!1}var We=({state:e,dispatch:t})=>Ue(e,t,!1);function q(e,t,n){let i=F(e.state.selection,e=>{e.undirectional&&e.head>=e.anchor!=t&&(e=r.range(e.head,e.anchor));let i=n(e);return r.range(e.anchor,i.head,i.goalColumn,i.bidiLevel||void 0,i.assoc)});return i.eq(e.state.selection)?!1:(e.dispatch(I(e.state,i)),!0)}function Ge(e,t){return q(e,t,n=>e.moveByChar(n,t))}var Ke=e=>Ge(e,!B(e)),qe=e=>Ge(e,B(e));function Je(e,t){return q(e,t,n=>e.moveByGroup(n,t))}var Ye=e=>Je(e,!B(e)),Xe=e=>Je(e,B(e)),Ze=e=>{let t=!B(e);return q(e,t,n=>U(e.state,n,t))},Qe=e=>{let t=B(e);return q(e,t,n=>U(e.state,n,t))};function $e(e,t){return q(e,t,n=>e.moveVertically(n,t))}var et=e=>$e(e,!1),tt=e=>$e(e,!0);function nt(e,t){return q(e,t,n=>e.moveVertically(n,t,Fe(e).height))}var rt=e=>nt(e,!1),it=e=>nt(e,!0),at=e=>q(e,!0,t=>K(e,t,!0)),ot=e=>q(e,!1,t=>K(e,t,!1)),st=e=>{let t=!B(e);return q(e,t,n=>K(e,n,t))},ct=e=>{let t=B(e);return q(e,t,n=>K(e,n,t))},lt=e=>q(e,!1,t=>r.cursor(e.lineBlockAt(t.head).from)),ut=e=>q(e,!0,t=>r.cursor(e.lineBlockAt(t.head).to)),dt=({state:e,dispatch:t})=>(t(I(e,{anchor:0})),!0),ft=({state:e,dispatch:t})=>(t(I(e,{anchor:e.doc.length})),!0),pt=({state:e,dispatch:t})=>(t(I(e,{anchor:e.selection.main.anchor,head:0})),!0),mt=({state:e,dispatch:t})=>(t(I(e,{anchor:e.selection.main.anchor,head:e.doc.length})),!0),ht=({state:e,dispatch:t})=>(t(e.update({selection:{anchor:0,head:e.doc.length},userEvent:`select`})),!0),gt=({state:e,dispatch:t})=>{let n=Z(e).map(({from:t,to:n})=>r.range(t,Math.min(n+1,e.doc.length)));return t(e.update({selection:r.create(n),userEvent:`select`})),!0},_t=({state:e,dispatch:t})=>{let n=F(e.selection,t=>{let n=u(e),i=n.resolveStack(t.from,1);if(t.empty){let e=n.resolveStack(t.from,-1);e.node.from>=i.node.from&&e.node.to<=i.node.to&&(i=e)}for(let e=i;e;e=e.next){let{node:n}=e;if((n.from<t.from&&n.to>=t.to||n.to>t.to&&n.from<=t.from)&&e.next)return r.range(n.to,n.from)}return t});return n.eq(e.selection)?!1:(t(I(e,n)),!0)};function vt(e,t){let{state:n}=e,i=n.selection,a=n.selection.ranges.slice();for(let r of n.selection.ranges){let i=n.doc.lineAt(r.head);if(t?i.to<e.state.doc.length:i.from>0)for(let n=r;;){let r=e.moveVertically(n,t);if(r.head<i.from||r.head>i.to){a.some(e=>e.head==r.head)||a.push(r);break}else if(r.head==n.head)break;else n=r}}return a.length==i.ranges.length?!1:(e.dispatch(I(n,r.create(a,a.length-1))),!0)}var yt=e=>vt(e,!1),bt=e=>vt(e,!0),xt=({state:e,dispatch:t})=>{let n=e.selection,i=null;return n.ranges.length>1?i=r.create([n.main]):n.main.empty||(i=r.create([r.cursor(n.main.head)])),i?(t(I(e,i)),!0):!1};function J(e,t){if(e.state.readOnly)return!1;let n=`delete.selection`,{state:i}=e,a=i.changeByRange(i=>{let{from:a,to:o}=i;if(a==o){let r=t(i);r<a?(n=`delete.backward`,r=Y(e,r,!1)):r>a&&(n=`delete.forward`,r=Y(e,r,!0)),a=Math.min(a,r),o=Math.max(o,r)}else a=Y(e,a,!1),o=Y(e,o,!0);return a==o?{range:i}:{changes:{from:a,to:o},range:r.cursor(a,a<i.head?-1:1)}});return a.changes.empty?!1:(e.dispatch(i.update(a,{scrollIntoView:!0,userEvent:n,effects:n==`delete.selection`?_.announce.of(i.phrase(`Selection deleted`)):void 0})),!0)}function Y(e,t,n){if(e instanceof _)for(let r of e.state.facet(_.atomicRanges).map(t=>t(e)))r.between(t,t,(e,r)=>{e<t&&r>t&&(t=n?r:e)});return t}var St=(e,t,n)=>J(e,r=>{let i=r.from,{state:o}=e,s=o.doc.lineAt(i),c,l;if(n&&!t&&i>s.from&&i<s.from+200&&!/[^ \t]/.test(c=s.text.slice(0,i-s.from))){if(c[c.length-1]==` `)return i-1;let e=a(c,o.tabSize)%p(o)||p(o);for(let t=0;t<e&&c[c.length-1-t]==` `;t++)i--;l=i}else l=h(s.text,i-s.from,t,t)+s.from,l==i&&s.number!=(t?o.doc.lines:1)?l+=t?1:-1:!t&&/[\ufe00-\ufe0f]/.test(s.text.slice(l-s.from,i-s.from))&&(l=h(s.text,l-s.from,!1,!1)+s.from);return l}),X=e=>St(e,!1,!0),Ct=e=>St(e,!0,!1),wt=(e,t)=>J(e,n=>{let r=n.head,{state:i}=e,a=i.doc.lineAt(r),o=i.charCategorizer(r);for(let e=null;;){if(r==(t?a.to:a.from)){r==n.head&&a.number!=(t?i.doc.lines:1)&&(r+=t?1:-1);break}let s=h(a.text,r-a.from,t)+a.from,c=a.text.slice(Math.min(r,s)-a.from,Math.max(r,s)-a.from),l=o(c);if(e!=null&&l!=e)break;(c!=` `||r!=n.head)&&(e=l),r=s}return r}),Tt=e=>wt(e,!1),Et=e=>wt(e,!0),Dt=e=>J(e,t=>{let n=e.lineBlockAt(t.head).to;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)}),Ot=e=>J(e,t=>{let n=e.moveToLineBoundary(t,!1).head;return t.head>n?n:Math.max(0,t.head-1)}),kt=e=>J(e,t=>{let n=e.moveToLineBoundary(t,!0).head;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)}),At=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange(e=>({changes:{from:e.from,to:e.to,insert:s.of([``,``])},range:r.cursor(e.from)}));return t(e.update(n,{scrollIntoView:!0,userEvent:`input`})),!0},jt=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange(t=>{if(!t.empty||t.from==0||t.from==e.doc.length)return{range:t};let n=t.from,i=e.doc.lineAt(n),a=n==i.from?n-1:h(i.text,n-i.from,!1)+i.from,o=n==i.to?n+1:h(i.text,n-i.from,!0)+i.from;return{changes:{from:a,to:o,insert:e.doc.slice(n,o).append(e.doc.slice(a,n))},range:r.cursor(o)}});return n.changes.empty?!1:(t(e.update(n,{scrollIntoView:!0,userEvent:`move.character`})),!0)};function Z(e){let t=[],n=-1;for(let r of e.selection.ranges){let i=e.doc.lineAt(r.from),a=e.doc.lineAt(r.to);if(!r.empty&&r.to==a.from&&(a=e.doc.lineAt(r.to-1)),n>=i.number){let e=t[t.length-1];e.to=a.to,e.ranges.push(r)}else t.push({from:i.from,to:a.to,ranges:[r]});n=a.number+1}return t}function Mt(e,t,n){if(e.readOnly)return!1;let i=[],a=[];for(let t of Z(e)){if(n?t.to==e.doc.length:t.from==0)continue;let o=e.doc.lineAt(n?t.to+1:t.from-1),s=o.length+1;if(n){i.push({from:t.to,to:o.to},{from:t.from,insert:o.text+e.lineBreak});for(let n of t.ranges)a.push(r.range(Math.min(e.doc.length,n.anchor+s),Math.min(e.doc.length,n.head+s)))}else{i.push({from:o.from,to:t.from},{from:t.to,insert:e.lineBreak+o.text});for(let e of t.ranges)a.push(r.range(e.anchor-s,e.head-s))}}return i.length?(t(e.update({changes:i,scrollIntoView:!0,selection:r.create(a,e.selection.mainIndex),userEvent:`move.line`})),!0):!1}var Nt=({state:e,dispatch:t})=>Mt(e,t,!1),Pt=({state:e,dispatch:t})=>Mt(e,t,!0);function Ft(e,t,n){if(e.readOnly)return!1;let r=[];for(let t of Z(e))n?r.push({from:t.from,insert:e.doc.slice(t.from,t.to)+e.lineBreak}):r.push({from:t.to,insert:e.lineBreak+e.doc.slice(t.from,t.to)});let i=e.changes(r);return t(e.update({changes:i,selection:e.selection.map(i,n?1:-1),scrollIntoView:!0,userEvent:`input.copyline`})),!0}var It=({state:e,dispatch:t})=>Ft(e,t,!1),Lt=({state:e,dispatch:t})=>Ft(e,t,!0),Rt=e=>{if(e.state.readOnly)return!1;let{state:t}=e,n=t.changes(Z(t).map(({from:e,to:n})=>(e>0?e--:n<t.doc.length&&n++,{from:e,to:n}))),r=F(t.selection,t=>{let n;if(e.lineWrapping){let r=e.lineBlockAt(t.head),i=e.coordsAtPos(t.head,t.assoc||1);i&&(n=r.bottom+e.documentTop-i.bottom+e.defaultLineHeight/2)}return e.moveVertically(t,!0,n)}).map(n);return e.dispatch({changes:n,selection:r,scrollIntoView:!0,userEvent:`delete.line`}),!0};function zt(e,t){if(/\(\)|\[\]|\{\}/.test(e.sliceDoc(t-1,t+1)))return{from:t,to:t};let n=u(e).resolveInner(t),r=n.childBefore(t),i=n.childAfter(t),a;return r&&i&&r.to<=t&&i.from>=t&&(a=r.type.prop(g.closedBy))&&a.indexOf(i.name)>-1&&e.doc.lineAt(r.to).from==e.doc.lineAt(i.from).from&&!/\S/.test(e.sliceDoc(r.to,i.from))?{from:r.to,to:i.from}:null}var Bt=Ht(!1),Vt=Ht(!0);function Ht(t){return({state:i,dispatch:o})=>{if(i.readOnly)return!1;let c=i.changeByRange(o=>{let{from:c,to:l}=o,u=i.doc.lineAt(c),d=!t&&c==l&&zt(i,c);t&&(c=l=(l<=u.to?u:i.doc.lineAt(l)).to);let f=new ne(i,{simulateBreak:c,simulateDoubleBreak:!!d}),p=e(f,c);for(p??=a(/^\s*/.exec(i.doc.lineAt(c).text)[0],i.tabSize);l<u.to&&/\s/.test(u.text[l-u.from]);)l++;d?{from:c,to:l}=d:c>u.from&&c<u.from+100&&!/\S/.test(u.text.slice(0,c))&&(c=u.from);let m=[``,n(i,p)];return d&&m.push(n(i,f.lineIndent(u.from,-1))),{changes:{from:c,to:l,insert:s.of(m)},range:r.cursor(c+1+m[1].length)}});return o(i.update(c,{scrollIntoView:!0,userEvent:`input`})),!0}}function Q(e,t){let n=-1;return e.changeByRange(i=>{let a=[];for(let r=i.from;r<=i.to;){let o=e.doc.lineAt(r);o.number>n&&(i.empty||i.to>o.from)&&(t(o,a,i),n=o.number),r=o.to+1}let o=e.changes(a);return{changes:a,range:r.range(o.mapPos(i.anchor,1),o.mapPos(i.head,1))}})}var Ut=({state:t,dispatch:r})=>{if(t.readOnly)return!1;let i=Object.create(null),a=new ne(t,{overrideIndentation:e=>i[e]??-1}),o=Q(t,(r,o,s)=>{let c=e(a,r.from);if(c==null)return;/\S/.test(r.text)||(c=0);let l=/^\s*/.exec(r.text)[0],u=n(t,c);(l!=u||s.from<r.from+l.length)&&(i[r.from]=c,o.push({from:r.from,to:r.from+l.length,insert:u}))});return o.changes.empty||r(t.update(o,{userEvent:`indent`})),!0},Wt=({state:e,dispatch:t})=>e.readOnly?!1:(t(e.update(Q(e,(t,n)=>{n.push({from:t.from,insert:e.facet(l)})}),{userEvent:`input.indent`})),!0),$=({state:e,dispatch:t})=>e.readOnly?!1:(t(e.update(Q(e,(t,r)=>{let i=/^\s*/.exec(t.text)[0];if(!i)return;let o=a(i,e.tabSize),s=0,c=n(e,Math.max(0,o-p(e)));for(;s<i.length&&s<c.length&&i.charCodeAt(s)==c.charCodeAt(s);)s++;r.push({from:t.from+s,to:t.from+i.length,insert:c.slice(s)})}),{userEvent:`delete.dedent`})),!0),Gt=e=>(e.setTabFocusMode(),!0),Kt=[{key:`Ctrl-b`,run:V,shift:Ke,preventDefault:!0},{key:`Ctrl-f`,run:H,shift:qe},{key:`Ctrl-p`,run:Ne,shift:et},{key:`Ctrl-n`,run:Pe,shift:tt},{key:`Ctrl-a`,run:Ve,shift:lt},{key:`Ctrl-e`,run:He,shift:ut},{key:`Ctrl-d`,run:Ct},{key:`Ctrl-h`,run:X},{key:`Ctrl-k`,run:Dt},{key:`Ctrl-Alt-h`,run:Tt},{key:`Ctrl-o`,run:At},{key:`Ctrl-t`,run:jt},{key:`Ctrl-v`,run:G}],qt=[{key:`ArrowLeft`,run:V,shift:Ke,preventDefault:!0},{key:`Mod-ArrowLeft`,mac:`Alt-ArrowLeft`,run:De,shift:Ye,preventDefault:!0},{mac:`Cmd-ArrowLeft`,run:ze,shift:st,preventDefault:!0},{key:`ArrowRight`,run:H,shift:qe,preventDefault:!0},{key:`Mod-ArrowRight`,mac:`Alt-ArrowRight`,run:Oe,shift:Xe,preventDefault:!0},{mac:`Cmd-ArrowRight`,run:Be,shift:ct,preventDefault:!0},{key:`ArrowUp`,run:Ne,shift:et,preventDefault:!0},{mac:`Cmd-ArrowUp`,run:dt,shift:pt},{mac:`Ctrl-ArrowUp`,run:Ie,shift:rt},{key:`ArrowDown`,run:Pe,shift:tt,preventDefault:!0},{mac:`Cmd-ArrowDown`,run:ft,shift:mt},{mac:`Ctrl-ArrowDown`,run:G,shift:it},{key:`PageUp`,run:Ie,shift:rt},{key:`PageDown`,run:G,shift:it},{key:`Home`,run:Re,shift:ot,preventDefault:!0},{key:`Mod-Home`,run:dt,shift:pt},{key:`End`,run:Le,shift:at,preventDefault:!0},{key:`Mod-End`,run:ft,shift:mt},{key:`Enter`,run:Bt,shift:Bt},{key:`Mod-a`,run:ht},{key:`Backspace`,run:X,shift:X,preventDefault:!0},{key:`Delete`,run:Ct,preventDefault:!0},{key:`Mod-Backspace`,mac:`Alt-Backspace`,run:Tt,preventDefault:!0},{key:`Mod-Delete`,mac:`Alt-Delete`,run:Et,preventDefault:!0},{mac:`Mod-Backspace`,run:Ot,preventDefault:!0},{mac:`Mod-Delete`,run:kt,preventDefault:!0}].concat(Kt.map(e=>({mac:e.key,run:e.run,shift:e.shift}))),Jt=[{key:`Alt-ArrowLeft`,mac:`Ctrl-ArrowLeft`,run:Ae,shift:Ze},{key:`Alt-ArrowRight`,mac:`Ctrl-ArrowRight`,run:je,shift:Qe},{key:`Alt-ArrowUp`,run:Nt},{key:`Shift-Alt-ArrowUp`,run:It},{key:`Alt-ArrowDown`,run:Pt},{key:`Shift-Alt-ArrowDown`,run:Lt},{key:`Mod-Alt-ArrowUp`,run:yt},{key:`Mod-Alt-ArrowDown`,run:bt},{key:`Escape`,run:xt},{key:`Mod-Enter`,run:Vt},{key:`Alt-l`,mac:`Ctrl-l`,run:gt},{key:`Mod-i`,run:_t,preventDefault:!0},{key:`Mod-[`,run:$},{key:`Mod-]`,run:Wt},{key:`Mod-Alt-\\`,run:Ut},{key:`Shift-Mod-k`,run:Rt},{key:`Shift-Mod-\\`,run:We},{key:`Mod-/`,run:ae},{key:`Alt-A`,run:se},{key:`Ctrl-m`,mac:`Shift-Alt-m`,run:Gt}].concat(qt),Yt={key:`Tab`,run:Wt,shift:$},Xt=re.define([{tag:[d.heading,d.heading1,d.heading2,d.heading3],color:`var(--syntax-func)`,fontWeight:`bold`},{tag:[d.heading4,d.heading5,d.heading6],color:`var(--syntax-func)`},{tag:d.strong,fontWeight:`bold`,color:`var(--foreground)`},{tag:d.emphasis,fontStyle:`italic`,color:`var(--foreground)`},{tag:d.strikethrough,textDecoration:`line-through`},{tag:d.link,color:`var(--link-color)`,textDecoration:`underline`,textUnderlinePosition:`under`},{tag:d.url,color:`var(--syntax-attr)`},{tag:d.monospace,color:`var(--syntax-string)`},{tag:d.quote,color:`var(--syntax-comment)`,fontStyle:`italic`},{tag:d.list,color:`var(--syntax-keyword)`},{tag:d.contentSeparator,color:`var(--syntax-comment)`},{tag:d.processingInstruction,color:`var(--muted-foreground)`},{tag:[d.comment,d.lineComment,d.blockComment],color:`var(--syntax-comment)`,fontStyle:`italic`},{tag:[d.meta,d.annotation,d.namespace],color:`var(--syntax-meta)`},{tag:d.docComment,color:`var(--syntax-comment)`,fontStyle:`italic`},{tag:[d.keyword,d.controlKeyword,d.moduleKeyword,d.operatorKeyword],color:`var(--syntax-keyword)`,fontWeight:`600`},{tag:[d.modifier,d.self],color:`var(--syntax-keyword)`},{tag:d.tagName,color:`var(--syntax-tag)`},{tag:[d.typeName,d.className],color:`var(--syntax-type)`},{tag:[d.attributeName,d.propertyName],color:`var(--syntax-attr)`},{tag:[d.variableName,d.macroName],color:`var(--syntax-var)`},{tag:[d.function(d.variableName),d.definition(d.name),d.labelName],color:`var(--syntax-func)`},{tag:[d.string,d.character,d.special(d.string)],color:`var(--syntax-string)`},{tag:[d.number,d.integer,d.float,d.literal],color:`var(--syntax-number)`},{tag:[d.bool,d.null,d.atom,d.constant(d.name),d.standard(d.name)],color:`var(--syntax-atom)`},{tag:[d.regexp,d.escape],color:`var(--syntax-atom)`},{tag:d.color,color:`var(--syntax-atom)`},{tag:[d.operator,d.punctuation,d.separator,d.bracket,d.brace,d.paren,d.squareBracket,d.angleBracket],color:`var(--syntax-operator)`},{tag:d.inserted,color:`var(--diff-added)`},{tag:d.deleted,color:`var(--diff-removed)`},{tag:d.changed,color:`var(--syntax-number)`},{tag:d.invalid,color:`var(--destructive)`}]);function Zt(e){let t=e.background??`transparent`,n=e.gutterBackground??`transparent`;return _.theme({"&":{color:`var(--foreground)`,backgroundColor:t},".cm-content":{caretColor:`var(--foreground)`},".cm-cursor, .cm-dropCursor":{borderLeftColor:`var(--foreground)`},"&.cm-focused .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:`var(--selection-soft)`},".cm-selectionMatch":{backgroundColor:`color-mix(in oklab, var(--syntax-type) 30%, transparent)`},".cm-gutters":{backgroundColor:n,color:`var(--muted-foreground)`,border:`none`},".cm-activeLine":{backgroundColor:`color-mix(in oklab, var(--foreground) 4%, transparent)`},".cm-activeLineGutter":{backgroundColor:`transparent`,color:`var(--foreground)`},".cm-foldPlaceholder":{backgroundColor:`var(--muted)`,color:`var(--muted-foreground)`,border:`none`},".cm-panels":{backgroundColor:`var(--popover)`,color:`var(--popover-foreground)`},".cm-searchMatch":{backgroundColor:`color-mix(in oklab, var(--syntax-type) 30%, transparent)`},".cm-searchMatch.cm-searchMatch-selected":{backgroundColor:`color-mix(in oklab, var(--primary) 40%, transparent)`}},{dark:e.dark})}function Qt(e){return[Zt(e),c(Xt,{fallback:!0})]}export{Yt as a,Te as i,Jt as n,E as o,ge as r,Qt as t};
@@ -0,0 +1,5 @@
1
+ import{t as e}from"./jsx-runtime-BUgB2tll.js";import{Cr as t,Or as n,Qn as r,gn as i,ir as a,mn as o,sr as s,wr as c,yr as l}from"./DocumentContext-Dxzqsjf0.js";import{n as u,r as d}from"./dist-Nvb76hAm.js";import{t as f}from"./compiler-runtime-BfE3aGVn.js";import{c as p}from"./local-menu-action-bus-BDB0W02w.js";import{t as m}from"./utils-CPqDy6Hr.js";import{t as h}from"./button-RQ5o7P7w.js";import{et as g,it as _}from"./CodeMirrorPropInput-B__Dqs8P.js";import{t as v}from"./checkbox-gpfWb1pY.js";import{An as y,Gn as b,Yr as x,gn as S,hn as C}from"./dist-TVrIGknK2.js";import{t as w}from"./createLucideIcon-BcLKHslE.js";import{t as ee}from"./chevron-down-Ccgt58N5.js";import{t as T}from"./x-D8xzRaMT.js";import{f as E}from"./doc-paths-BKAhPn1c.js";var D=w(`message-square`,[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}]]),O=w(`unlink`,[[`path`,{d:`m18.84 12.25 1.72-1.71h-.02a5.004 5.004 0 0 0-.12-7.07 5.006 5.006 0 0 0-6.95 0l-1.72 1.71`,key:`yqzxt4`}],[`path`,{d:`m5.17 11.75-1.71 1.71a5.004 5.004 0 0 0 .12 7.07 5.006 5.006 0 0 0 6.95 0l1.71-1.71`,key:`4qinb0`}],[`line`,{x1:`8`,x2:`8`,y1:`2`,y2:`5`,key:`1041cp`}],[`line`,{x1:`2`,x2:`5`,y1:`8`,y2:`8`,key:`14m1p5`}],[`line`,{x1:`16`,x2:`16`,y1:`19`,y2:`22`,key:`rzdirn`}],[`line`,{x1:`19`,x2:`22`,y1:`16`,y2:`16`,key:`ox905f`}]]),k=f(),A=`245,158,11`,te=A,ne={fill:.22,line:.7},re={fill:.45,line:1},ie=.45;function ae(e,t){let n=te,{fill:r,line:i}=t?re:ne;return[`border-radius:2px`,`padding-bottom:1px`,...e.id===null?[]:[`cursor:pointer`],`background-color:rgba(${n},${r})`,`box-shadow:inset 0 -2px 0 rgba(${n},${i})`,``].join(`;`)}function j(e){return e.map(e=>e.id??`·`).join(`|`)}function M(e){let t=null;for(let n of e)n.id!==null&&(t===null||n.to-n.from<t.to-t.from)&&(t=n);return t?.id??null}function N(e,t){return e.id===null||e.id===t}function oe(e,t=null){let n=[...e].filter(e=>e.from<e.to).sort((e,t)=>e.from-t.from||e.to-t.to||(e.id??``).localeCompare(t.id??``));if(n.length===0)return[];let r=[...new Set(n.flatMap(e=>[e.from,e.to]))].sort((e,t)=>e-t),i=[],a=null,o=()=>{if(a===null)return;let e=a.covering.find(e=>N(e,t));i.push({from:a.from,to:a.to,style:ae(e??a.covering[0],e!==void 0),threadId:M(a.covering)}),a=null};for(let e=0;e<r.length-1;e++){let t=r[e],i=r[e+1],s=n.filter(e=>e.from<=t&&e.to>=i);if(s.length===0){o();continue}if(a!==null&&a.to===t&&j(a.covering)===j(s)){a.to=i;continue}o(),a={from:t,to:i,covering:s}}return o(),i}var P=`data-comment-reveal`;function F(e){return typeof CSS<`u`&&CSS.escape?CSS.escape(e):e}function I(e){return e===``?null:document.querySelector(`[data-testid="property-row"][data-key="${F(e)}"]`)}function se(e){let t=I(e);if(t===null)return null;let n=t.getBoundingClientRect();return n.height===0&&n.width===0?null:n}function ce(e){I(e)?.scrollIntoView({block:`center`,behavior:`smooth`})}function L(e){if(e.quote===``)return!1;let t=e.path.length===0?e.key:e.path[e.path.length-1],n=Array.from(document.querySelectorAll(`[data-testid="property-row"][data-key="${F(String(t))}"]`)),r=Array.from(document.querySelectorAll(`[data-testid="property-row"]`));for(let t of[...n,...r]){let n=t.querySelector(`textarea, input`);if(n===null)continue;let r=le(n.value,e.quote,e.start,e.end);if(r!==null)return t.scrollIntoView({block:`center`,behavior:`smooth`}),n.focus(),n.setSelectionRange(r.start,r.end),ue(n),!0}return!1}function le(e,t,n,r){if(n!==void 0&&r!==void 0&&e.slice(n,r)===t)return{start:n,end:r};let i=e.indexOf(t);return i<0?null:{start:i,end:i+t.length}}function ue(e){e.style.setProperty(`--comment-reveal-fill`,`rgba(${A},${ie})`),e.setAttribute(P,`true`);let t=()=>{e.removeAttribute(P),e.style.removeProperty(`--comment-reveal-fill`)};e.addEventListener(`blur`,t,{once:!0}),e.addEventListener(`pointerdown`,t,{once:!0}),e.addEventListener(`keydown`,t,{once:!0})}function R(e,{includeBlockComponents:t=!1}={}){let n=``,r=[];return e.descendants((e,i)=>{if(e.isText&&e.text){for(let t=0;t<e.text.length;t++)n+=e.text[t],r.push(i+t);return!0}if(e.isBlock&&!t)return!0;let a=C(e);if(a.length>0){let t=i+e.nodeSize-1;for(let e=0;e<a.length;e++)n+=a[e],r.push(e===a.length-1?t:i)}return!0}),{text:n,positions:r}}function z(e,t){let n=[];if(t===``)return n;let r=e.indexOf(t);for(;r!==-1;)n.push(r),r=e.indexOf(t,r+1);return n}function B(e,t,n){let r=n?.prefix??``,i=n?.suffix??``;if(r===``&&i===``)return null;let a=r===``?[0]:b(e,r,{syntaxIn:`needle`}).map(e=>e.end),o=i===``?[e.length]:b(e,i,{syntaxIn:`needle`}).map(e=>e.start);if(a.length!==1||o.length!==1)return null;let s=a[0],c=o[0];for(;s<c&&/\s/.test(e[s]??``);)s+=1;for(;c>s&&/\s/.test(e[c-1]??``);)--c;if(c<=s)return null;let l=x(t.length);return c-s>l?null:{start:s,end:c}}function V(e,t){let n=e.positions[t.start],r=e.positions[t.end-1];return n==null||r==null?null:{from:n,to:r+1}}function H(e,t,n){if(t.length===0)return null;let r=z(e.text,t).map(e=>({start:e,end:e+t.length}));if(r.length===0&&(r=b(e.text,t,{syntaxIn:`needle`})),r.length===0){let r=B(e.text,t,n);return r===null?null:V(e,r)}if(r.length===1)return V(e,r[0]);let i=n?.prefix??``,a=n?.suffix??``,o=[],s=-1;for(let t of r){let n=y(e.text,t,{prefix:i,suffix:a},{syntaxIn:`none`});n>s?(s=n,o=[t]):n===s&&o.push(t)}return V(e,o[0])}var U=64;function de(e,t,n){return{prefix:S(e,Math.max(0,t-U),t),suffix:S(e,n,Math.min(e.content.size,n+U))}}function W(e,t,n){return G(e)(t,n)}function G(e){let t=R(e),n=null;return(r,i)=>{let a=H(t,r,i);return a===null?(n??=R(e,{includeBlockComponents:!0}),H(n,r,i)):a}}var fe=220,pe=24;function me(e){let t=e.viewTop+e.insetTop,n=e.viewBottom-fe;return e.anchorTop>=t&&e.anchorBottom<=n?0:e.anchorTop-(t+pe)}function K(e){let t=e?.parentElement??null;for(;t;){let e=getComputedStyle(t).overflowY;if(e===`auto`||e===`scroll`)return t;t=t.parentElement}return null}function q(e){let t=Number.parseFloat(getComputedStyle(e).scrollPaddingTop);return Number.isFinite(t)?t:0}function J(e,t){let n=g(e);if(!n)return;let r=K(n.dom);if(!r){e.commands.scrollIntoView();return}let i,a;try{i=n.coordsAtPos(t.from),a=n.coordsAtPos(t.to)}catch{return}let o=r.getBoundingClientRect(),s=me({anchorTop:i.top,anchorBottom:Math.max(i.bottom,a.bottom),viewTop:o.top,viewBottom:o.bottom,insetTop:q(r)});if(s===0)return;let c=window.matchMedia?.(`(prefers-reduced-motion: reduce)`).matches;r.scrollTo({top:r.scrollTop+s,behavior:c?`auto`:`smooth`})}var he=1e4;function ge(e){let t=()=>{let t=o(e.docName);if(!t||t.isDestroyed)return!1;let n=W(t.state.doc,e.quote,e.context);return n&&(t.chain().focus().setTextSelection(n).run(),J(t,n)),r(e.threadId),!0};if(n(`comments`),t())return;window.location.assign(E(e.docName));let a=!1,s=()=>{a||(a=!0,c(),window.clearTimeout(l))},c=i(()=>{t()&&s()}),l=window.setTimeout(s,he);t()&&s()}var Y=e();function _e(){let e=(0,k.c)(2),n=t(),r;if(e[0]!==n){r=[];for(let e of n){let t=a(e);t!==null&&r.push(t)}e[0]=n,e[1]=r}else r=e[1];return r}function ve(){return c().length}function ye(e){let t=(0,k.c)(34),{count:n,attached:r,expanded:i,onAttach:a,onToggleExpanded:o,onDismiss:s}=e,{_:c}=d();if(n===0)return null;if(!r){let e;t[0]===c?e=t[1]:(e=c({id:`UpOct_`}),t[0]=c,t[1]=e);let n,r,i;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(n=m(`h-auto min-h-0 gap-1 rounded-md border border-dashed bg-transparent px-1.5 py-0.5`,`text-xs font-normal text-muted-foreground hover:bg-muted/60 hover:text-foreground`),r=(0,Y.jsx)(p,{className:`size-3`}),i=(0,Y.jsx)(u,{id:`VbyRUy`}),t[2]=n,t[3]=r,t[4]=i):(n=t[2],r=t[3],i=t[4]);let o;return t[5]!==a||t[6]!==e?(o=(0,Y.jsxs)(h,{type:`button`,size:`sm`,variant:`ghost`,"aria-pressed":!1,"aria-label":e,onClick:a,"data-testid":`composer-context-chip-comments`,className:n,children:[r,i]}),t[5]=a,t[6]=e,t[7]=o):o=t[7],o}let l;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(l=m(`inline-flex items-center gap-1 rounded-md border bg-muted/60 py-0.5 pr-0.5 pl-1.5`,`text-xs text-muted-foreground`),t[8]=l):l=t[8];let f;t[9]!==c||t[10]!==i?(f=c(i?{id:`kMKqP_`}:{id:`15MMFT`}),t[9]=c,t[10]=i,t[11]=f):f=t[11];let g;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Y.jsx)(D,{className:`size-3`}),t[12]=g):g=t[12];let _;t[13]===n?_=t[14]:(_=(0,Y.jsx)(u,{id:`eiUA4k`,values:{count:n}}),t[13]=n,t[14]=_);let v=i&&`rotate-180`,y;t[15]===v?y=t[16]:(y=m(`size-3 transition-transform`,v),t[15]=v,t[16]=y);let b;t[17]===y?b=t[18]:(b=(0,Y.jsx)(ee,{className:y}),t[17]=y,t[18]=b);let x;t[19]!==i||t[20]!==o||t[21]!==f||t[22]!==_||t[23]!==b?(x=(0,Y.jsxs)(h,{type:`button`,size:`sm`,variant:`ghost`,"aria-expanded":i,"aria-label":f,onClick:o,"data-testid":`composer-comments-peek`,className:`h-auto min-h-0 gap-1 px-0.5 py-0 text-xs font-normal text-muted-foreground hover:text-foreground`,children:[g,_,b]}),t[19]=i,t[20]=o,t[21]=f,t[22]=_,t[23]=b,t[24]=x):x=t[24];let S;t[25]===c?S=t[26]:(S=c({id:`pFRz_E`}),t[25]=c,t[26]=S);let C;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,Y.jsx)(T,{className:`size-3`}),t[27]=C):C=t[27];let w;t[28]!==s||t[29]!==S?(w=(0,Y.jsx)(h,{type:`button`,size:`sm`,variant:`ghost`,"aria-label":S,onClick:s,className:`size-4 p-0 text-muted-foreground hover:text-foreground`,children:C}),t[28]=s,t[29]=S,t[30]=w):w=t[30];let E;return t[31]!==w||t[32]!==x?(E=(0,Y.jsxs)(`span`,{"data-testid":`composer-context-chip-comments`,className:l,children:[x,w]}),t[31]=w,t[32]=x,t[33]=E):E=t[33],E}function X(e){let t=e.lastIndexOf(`/`);return t>=0?e.slice(t+1):e}function Z(e,t){let n=e;for(let e of t)n+=typeof e==`number`?`[${e}]`:`.${e}`;return n}function be(e){let t=(0,k.c)(14),{thread:n,className:r}=e,i=n.anchor?.quote??``;if(n.target.kind===`property`){let e;t[0]!==n.target.key||t[1]!==n.target.path?(e=Z(n.target.key,n.target.path),t[0]=n.target.key,t[1]=n.target.path,t[2]=e):e=t[2];let a=e,o;t[3]===r?o=t[4]:(o=m(`w-full truncate font-mono text-[11px] text-muted-foreground`,r),t[3]=r,t[4]=o);let s=i===``?``:` “${i}”`,c;return t[5]!==a||t[6]!==o||t[7]!==s?(c=(0,Y.jsxs)(`span`,{className:o,children:[a,`:`,s]}),t[5]=a,t[6]=o,t[7]=s,t[8]=c):c=t[8],c}let a;t[9]===r?a=t[10]:(a=m(`w-full truncate font-mono text-[11px] text-muted-foreground`,r),t[9]=r,t[10]=a);let o;return t[11]!==i||t[12]!==a?(o=(0,Y.jsxs)(`span`,{className:a,children:[`“`,i,`”`]}),t[11]=i,t[12]=a,t[13]=o):o=t[13],o}function Q(e){ge({docName:e.docName,quote:e.target.kind===`property`?``:e.anchor?.quote??``,threadId:e.id,context:e.anchor??void 0});let{target:t,anchor:n}=e;if(t.kind!==`property`||n===null)return;let r=0,i=()=>{L({key:t.key,path:t.path,quote:n.quote,start:n.start,end:n.end})||(r+=1,!(r>=xe)&&requestAnimationFrame(i))};requestAnimationFrame(i)}var xe=30;function Se(e){let t=(0,k.c)(9),{threads:n}=e,{_:r}=d(),i=c();if(n.length===0)return null;let a;if(t[0]!==r||t[1]!==i||t[2]!==n){let e;t[4]!==r||t[5]!==i?(e=e=>{let t=e.status===`orphaned`,n=i.includes(e.id);return(0,Y.jsxs)(`li`,{className:m(`flex items-start gap-2 rounded-md border bg-background/60 px-2 py-1.5`,!n&&`opacity-50`),children:[(0,Y.jsx)(v,{checked:n,onCheckedChange:()=>l(e.id),"aria-label":r({id:`Uoux8m`}),className:`mt-0.5`}),(0,Y.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,Y.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,Y.jsxs)(`span`,{className:`inline-flex min-w-0 items-center gap-1 rounded border px-1 py-px text-[10px] text-muted-foreground`,title:e.docName,children:[(0,Y.jsx)(_,{className:`size-2.5 shrink-0`}),(0,Y.jsx)(`span`,{className:`truncate`,children:X(e.docName)})]}),t&&(0,Y.jsxs)(`span`,{className:`inline-flex shrink-0 items-center gap-1 text-[10px] text-amber-600 dark:text-amber-500`,title:r({id:`MBe6TE`}),children:[(0,Y.jsx)(O,{className:`size-2.5`}),(0,Y.jsx)(u,{id:`2UgoBZ`})]})]}),(0,Y.jsxs)(h,{type:`button`,variant:`ghost`,"aria-label":r({id:`rscgd_`,values:{0:X(e.docName)}}),onClick:()=>Q(e),className:`h-auto min-h-0 w-full min-w-0 flex-col items-start gap-1 px-0 py-0 text-left font-normal hover:bg-transparent`,children:[(0,Y.jsx)(be,{thread:e}),(0,Y.jsx)(`span`,{className:`line-clamp-2 w-full text-xs whitespace-normal text-foreground/90`,children:e.body})]})]}),(0,Y.jsx)(h,{type:`button`,size:`sm`,variant:`ghost`,"aria-label":r({id:`1jym2J`}),onClick:()=>s(e.id),className:`size-5 shrink-0 p-0 text-muted-foreground hover:text-foreground`,children:(0,Y.jsx)(T,{className:`size-3`})})]},e.id)},t[4]=r,t[5]=i,t[6]=e):e=t[6],a=n.map(e),t[0]=r,t[1]=i,t[2]=n,t[3]=a}else a=t[3];let o;return t[7]===a?o=t[8]:(o=(0,Y.jsx)(`ul`,{"data-testid":`composer-comments-list`,className:`mt-1 flex max-h-64 basis-full list-none flex-col gap-1 overflow-y-auto subtle-scrollbar`,children:a}),t[7]=a,t[8]=o),o}function Ce(e){return{docName:e.docName,body:e.instruction,propertyKey:e.property,quote:e.passage?.exact??``,anchorLost:e.anchorLost,prefix:e.passage?.prefix??``,suffix:e.passage?.suffix??``,repeats:e.passageRepeats}}var $=48;function we(e){let t=e.replace(/\s+/g,` `).trimStart();return t.length>$?`…${t.slice(-$)}`:t}function Te(e){let t=e.replace(/\s+/g,` `).trimEnd();return t.length>$?`${t.slice(0,$)}…`:t}function Ee(e){if(!e.repeats)return null;let t=we(e.prefix),n=Te(e.suffix);return t===``&&n===``?null:`(This text appears more than once in the file. The one meant is ${t===``?`at the start of the file, followed by "${n}"`:n===``?`at the end of the file, preceded by "${t}"`:`between "${t}" and "${n}"`} — match that context rather than the first occurrence.)`}function De(e,t,n){let r=t.trim(),i=[];if(i.push(r.length>0?r:`Address the following review comments by editing the documents directly.`),i.push(``),i.push(e.length===1?`The comment:`:`The ${e.length} comments:`),e.forEach((e,t)=>{if(i.push(``),e.propertyKey){let n=e.quote.trim();if(n===``)i.push(`${t+1}. In \`${e.docName}\`, on the \`${e.propertyKey}\` property (frontmatter):`),i.push(``),i.push(` ${e.body.trim()}`);else{i.push(`${t+1}. In \`${e.docName}\`, on this text within the \`${e.propertyKey}\` property (frontmatter):`),i.push(``);for(let e of n.split(`
2
+ `))i.push(` > ${e}`);i.push(``),i.push(` ${e.body.trim()}`)}e.anchorLost&&(i.push(``),i.push(n===``?` (Note: \`${e.propertyKey}\` is no longer in this document's frontmatter — it was renamed or removed since the comment was written. Do not apply this to a different property; if you cannot tell what it now refers to, say so instead of guessing.)`:` (Note: that text is no longer in \`${e.propertyKey}\` — the value was edited, reshaped, or removed since the comment was written. Do not apply this to a different property or a different part of the value; if you cannot tell what it now refers to, say so instead of guessing.)`));return}i.push(`${t+1}. In \`${e.docName}\`, on this passage:`),i.push(``);for(let t of e.quote.split(`
3
+ `))i.push(` > ${t}`);i.push(``),i.push(` ${e.body.trim()}`);let n=Ee(e);n!==null&&(i.push(``),i.push(` ${n}`)),e.anchorLost&&(i.push(``),i.push(` (Note: this passage is no longer in the document — it was edited or removed since the comment was written. Do not apply this to a different passage; if you cannot tell what it now refers to, say so instead of guessing.)`))}),n&&n.markdown.trim().length>0){i.push(``),i.push(`Also in scope, selected in \`${n.docName}\` (not a comment):`),i.push(``);for(let e of n.markdown.trim().split(`
4
+ `))i.push(`> ${e}`)}return i.join(`
5
+ `)}export{L as _,Z as a,O as b,_e as c,J as d,q as f,se as g,W as h,X as i,ve as l,G as m,Se as n,Q as o,de as p,De as r,Ce as s,ye as t,K as u,ce as v,D as x,oe as y};
@@ -0,0 +1,5 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./messages-B-LUKCxb.js","./chunk-CYidjpOJ.js"])))=>i.map(i=>d[i]);
2
+ import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./preload-helper-Chd9yIcd.js";import{t as n}from"./jsx-runtime-BUgB2tll.js";import{t as r}from"./react-f2sANaYj.js";import{n as i}from"./dist-PQ5KMVDh.js";import{t as a}from"./compiler-runtime-BfE3aGVn.js";import{$t as o,Ar as s,Ca as c,Do as l,Jr as u,Ko as d,Pr as f,Sa as ee,Wr as te,Yo as ne,Zt as re,ba as ie,oo as ae,xa as oe,yo as se}from"./dist-TVrIGknK2.js";import{t as ce}from"./dist-DoS8xGN6.js";import{n as le}from"./dist-Bkx5dDHT2.js";import{f as ue,p as de,r as fe,s as pe}from"./use-apply-config-color-theme-Cd_bVm8F.js";import"./i18n-iRTrMKQI.js";import{r as me}from"./client-version-BbTOZkhQ.js";var he=a(),p=e(r(),1),ge=null,m=new Set;function _e(){return ge}function ve(e){let t=e!==null&&e.length>0?e:null;if(t!==ge){ge=t;for(let e of m)try{e()}catch(e){console.warn(`[server-instance-store] subscriber threw:`,e)}}}function ye(e){return m.add(e),()=>{m.delete(e)}}function be(){return(0,p.useSyncExternalStore)(ye,_e,_e)}var h=()=>new Map,xe=e=>{let t=h();return e.forEach((e,n)=>{t.set(n,e)}),t},g=(e,t,n)=>{let r=e.get(t);return r===void 0&&e.set(t,r=n()),r},Se=(e,t)=>{let n=[];for(let[r,i]of e)n.push(t(i,r));return n},Ce=(e,t)=>{for(let[n,r]of e)if(t(r,n))return!0;return!1},_=()=>new Set,we=e=>e[e.length-1],Te=(e,t)=>{for(let n=0;n<t.length;n++)e.push(t[n])},v=Array.from,Ee=(e,t)=>{for(let n=0;n<e.length;n++)if(!t(e[n],n,e))return!1;return!0},De=(e,t)=>{for(let n=0;n<e.length;n++)if(t(e[n],n,e))return!0;return!1},Oe=(e,t)=>{let n=Array(e);for(let r=0;r<e;r++)n[r]=t(r,n);return n},y=Array.isArray,ke=class{constructor(){this._observers=h()}on(e,t){return g(this._observers,e,_).add(t),t}once(e,t){let n=(...r)=>{this.off(e,n),t(...r)};this.on(e,n)}off(e,t){let n=this._observers.get(e);n!==void 0&&(n.delete(t),n.size===0&&this._observers.delete(e))}emit(e,t){return v((this._observers.get(e)||h()).values()).forEach(e=>e(...t))}destroy(){this._observers=h()}},Ae=class{constructor(){this._observers=h()}on(e,t){g(this._observers,e,_).add(t)}once(e,t){let n=(...r)=>{this.off(e,n),t(...r)};this.on(e,n)}off(e,t){let n=this._observers.get(e);n!==void 0&&(n.delete(t),n.size===0&&this._observers.delete(e))}emit(e,t){return v((this._observers.get(e)||h()).values()).forEach(e=>e(...t))}destroy(){this._observers=h()}},b=Math.floor,je=Math.abs,Me=(e,t)=>e<t?e:t,Ne=(e,t)=>e>t?e:t;Number.isNaN;var Pe=e=>e===0?1/e<0:e<0,Fe=1<<17,Ie=1<<18,Le=1<<19,Re=1<<20,ze=1<<21,Be=1<<22,Ve=1<<23,He=1<<24,Ue=1<<25,We=1<<26,Ge=1<<27,Ke=1<<28,qe=1<<29;Fe-1,Ie-1,Le-1,Re-1,ze-1,Be-1,Ve-1,He-1,Ue-1,We-1,Ge-1,Ke-1,qe-1;var Je=2**53-1,Ye=-(2**53-1),Xe=Number.isInteger||(e=>typeof e==`number`&&isFinite(e)&&b(e)===e);Number.isNaN,Number.parseInt;var Ze=String.fromCharCode;String.fromCodePoint,Ze(65535);var Qe=e=>e.toLowerCase(),$e=/^\s*/g,et=e=>e.replace($e,``),tt=/([A-Z])/g,nt=(e,t)=>et(e.replace(tt,e=>`${t}${Qe(e)}`)),rt=e=>{let t=unescape(encodeURIComponent(e)),n=t.length,r=new Uint8Array(n);for(let e=0;e<n;e++)r[e]=t.codePointAt(e);return r},it=typeof TextEncoder<`u`?new TextEncoder:null,at=it?e=>it.encode(e):rt,ot=typeof TextDecoder>`u`?null:new TextDecoder(`utf-8`,{fatal:!0,ignoreBOM:!0});ot&&ot.decode(new Uint8Array).length===1&&(ot=null);var st=(e,t)=>Oe(t,()=>e).join(``),ct=class{constructor(){this.cpos=0,this.cbuf=new Uint8Array(100),this.bufs=[]}},lt=()=>new ct,ut=e=>{let t=lt();return e(t),x(t)},dt=e=>{let t=e.cpos;for(let n=0;n<e.bufs.length;n++)t+=e.bufs[n].length;return t},x=e=>{let t=new Uint8Array(dt(e)),n=0;for(let r=0;r<e.bufs.length;r++){let i=e.bufs[r];t.set(i,n),n+=i.length}return t.set(new Uint8Array(e.cbuf.buffer,0,e.cpos),n),t},ft=(e,t)=>{let n=e.cbuf.length;n-e.cpos<t&&(e.bufs.push(new Uint8Array(e.cbuf.buffer,0,e.cpos)),e.cbuf=new Uint8Array(Ne(n,t)*2),e.cpos=0)},S=(e,t)=>{let n=e.cbuf.length;e.cpos===n&&(e.bufs.push(e.cbuf),e.cbuf=new Uint8Array(n*2),e.cpos=0),e.cbuf[e.cpos++]=t},pt=S,C=(e,t)=>{for(;t>127;)S(e,128|127&t),t=b(t/128);S(e,127&t)},mt=(e,t)=>{let n=Pe(t);for(n&&(t=-t),S(e,(t>63?128:0)|(n?64:0)|63&t),t=b(t/64);t>0;)S(e,(t>127?128:0)|127&t),t=b(t/128)},ht=new Uint8Array(3e4),gt=ht.length/3,_t=it&&it.encodeInto?(e,t)=>{if(t.length<gt){let n=it.encodeInto(t,ht).written||0;C(e,n);for(let t=0;t<n;t++)S(e,ht[t])}else w(e,at(t))}:(e,t)=>{let n=unescape(encodeURIComponent(t)),r=n.length;C(e,r);for(let t=0;t<r;t++)S(e,n.codePointAt(t))},vt=(e,t)=>{let n=e.cbuf.length,r=e.cpos,i=Me(n-r,t.length),a=t.length-i;e.cbuf.set(t.subarray(0,i),r),e.cpos+=i,a>0&&(e.bufs.push(e.cbuf),e.cbuf=new Uint8Array(Ne(n*2,a)),e.cbuf.set(t.subarray(i)),e.cpos=a)},w=(e,t)=>{C(e,t.byteLength),vt(e,t)},yt=(e,t)=>{ft(e,t);let n=new DataView(e.cbuf.buffer,e.cpos,t);return e.cpos+=t,n},bt=(e,t)=>yt(e,4).setFloat32(0,t,!1),xt=(e,t)=>yt(e,8).setFloat64(0,t,!1),St=(e,t)=>yt(e,8).setBigInt64(0,t,!1),Ct=new DataView(new ArrayBuffer(4)),wt=e=>(Ct.setFloat32(0,e),Ct.getFloat32(0)===e),Tt=(e,t)=>{switch(typeof t){case`string`:S(e,119),_t(e,t);break;case`number`:Xe(t)&&je(t)<=2147483647?(S(e,125),mt(e,t)):wt(t)?(S(e,124),bt(e,t)):(S(e,123),xt(e,t));break;case`bigint`:S(e,122),St(e,t);break;case`object`:if(t===null)S(e,126);else if(y(t)){S(e,117),C(e,t.length);for(let n=0;n<t.length;n++)Tt(e,t[n])}else if(t instanceof Uint8Array)S(e,116),w(e,t);else{S(e,118);let n=Object.keys(t);C(e,n.length);for(let r=0;r<n.length;r++){let i=n[r];_t(e,i),Tt(e,t[i])}}break;case`boolean`:S(e,t?120:121);break;default:S(e,127)}},Et=class extends ct{constructor(e){super(),this.w=e,this.s=null,this.count=0}write(e){this.s===e?this.count++:(this.count>0&&C(this,this.count-1),this.count=1,this.w(this,e),this.s=e)}},Dt=e=>{e.count>0&&(mt(e.encoder,e.count===1?e.s:-e.s),e.count>1&&C(e.encoder,e.count-2))},Ot=class{constructor(){this.encoder=new ct,this.s=0,this.count=0}write(e){this.s===e?this.count++:(Dt(this),this.count=1,this.s=e)}toUint8Array(){return Dt(this),x(this.encoder)}},kt=e=>{if(e.count>0){let t=e.diff*2+(e.count===1?0:1);mt(e.encoder,t),e.count>1&&C(e.encoder,e.count-2)}},At=class{constructor(){this.encoder=new ct,this.s=0,this.count=0,this.diff=0}write(e){this.diff===e-this.s?(this.s=e,this.count++):(kt(this),this.count=1,this.diff=e-this.s,this.s=e)}toUint8Array(){return kt(this),x(this.encoder)}},jt=class{constructor(){this.sarr=[],this.s=``,this.lensE=new Ot}write(e){this.s+=e,this.s.length>19&&(this.sarr.push(this.s),this.s=``),this.lensE.write(e.length)}toUint8Array(){let e=new ct;return this.sarr.push(this.s),this.s=``,_t(e,this.sarr.join(``)),vt(e,this.lensE.toUint8Array()),x(e)}},T=e=>Error(e),E=()=>{throw T(`Method unimplemented`)},D=()=>{throw T(`Unexpected case`)},Mt=T(`Unexpected end of array`),Nt=T(`Integer out of Range`),Pt=class{constructor(e){this.arr=e,this.pos=0}},Ft=e=>new Pt(e),It=e=>e.pos!==e.arr.length,Lt=(e,t)=>{let n=new Uint8Array(e.arr.buffer,e.pos+e.arr.byteOffset,t);return e.pos+=t,n},O=e=>Lt(e,k(e)),Rt=e=>e.arr[e.pos++],k=e=>{let t=0,n=1,r=e.arr.length;for(;e.pos<r;){let r=e.arr[e.pos++];if(t+=(r&127)*n,n*=128,r<128)return t;if(t>Je)throw Nt}throw Mt},zt=e=>{let t=e.arr[e.pos++],n=t&63,r=64,i=(t&64)>0?-1:1;if(!(t&128))return i*n;let a=e.arr.length;for(;e.pos<a;){if(t=e.arr[e.pos++],n+=(t&127)*r,r*=128,t<128)return i*n;if(n>Je)throw Nt}throw Mt},Bt=ot?e=>ot.decode(O(e)):e=>{let t=k(e);if(t===0)return``;{let n=String.fromCodePoint(Rt(e));if(--t<100)for(;t--;)n+=String.fromCodePoint(Rt(e));else for(;t>0;){let r=t<1e4?t:1e4,i=e.arr.subarray(e.pos,e.pos+r);e.pos+=r,n+=String.fromCodePoint.apply(null,i),t-=r}return decodeURIComponent(escape(n))}},Vt=(e,t)=>{let n=new DataView(e.arr.buffer,e.arr.byteOffset+e.pos,t);return e.pos+=t,n},Ht=[e=>void 0,e=>null,zt,e=>Vt(e,4).getFloat32(0,!1),e=>Vt(e,8).getFloat64(0,!1),e=>Vt(e,8).getBigInt64(0,!1),e=>!1,e=>!0,Bt,e=>{let t=k(e),n={};for(let r=0;r<t;r++){let t=Bt(e);n[t]=Ut(e)}return n},e=>{let t=k(e),n=[];for(let r=0;r<t;r++)n.push(Ut(e));return n},O],Ut=e=>Ht[127-Rt(e)](e),Wt=class extends Pt{constructor(e,t){super(e),this.reader=t,this.s=null,this.count=0}read(){return this.count===0&&(this.s=this.reader(this),It(this)?this.count=k(this)+1:this.count=-1),this.count--,this.s}},Gt=class extends Pt{constructor(e){super(e),this.s=0,this.count=0}read(){if(this.count===0){this.s=zt(this);let e=Pe(this.s);this.count=1,e&&(this.s=-this.s,this.count=k(this)+2)}return this.count--,this.s}},Kt=class extends Pt{constructor(e){super(e),this.s=0,this.count=0,this.diff=0}read(){if(this.count===0){let e=zt(this),t=e&1;this.diff=b(e/2),this.count=1,t&&(this.count=k(this)+2)}return this.s+=this.diff,this.count--,this.s}},qt=class{constructor(e){this.decoder=new Gt(e),this.str=Bt(this.decoder),this.spos=0}read(){let e=this.spos+this.decoder.read(),t=this.str.slice(this.spos,e);return this.spos=e,t}};crypto.subtle;var Jt=crypto.getRandomValues.bind(crypto),Yt=Math.random,Xt=()=>Jt(new Uint32Array(1))[0],Zt=e=>e[b(Yt()*e.length)],Qt=`10000000-1000-4000-8000-100000000000`,$t=()=>Qt.replace(/[018]/g,e=>(e^Xt()&15>>e/4).toString(16)),en=Date.now,tn=e=>new Promise(e);Promise.all.bind(Promise);var nn=e=>e===void 0?null:e,rn=new class{constructor(){this.map=new Map}setItem(e,t){this.map.set(e,t)}getItem(e){return this.map.get(e)}};try{typeof localStorage<`u`&&localStorage&&(rn=localStorage)}catch{}var an=rn,on=Symbol(`Equality`),sn=(e,t)=>e===t||!!e?.[on]?.(t)||!1,cn=e=>typeof e==`object`,ln=Object.assign,un=Object.keys,dn=(e,t)=>{for(let n in e)t(e[n],n)},fn=e=>un(e).length,pn=e=>{for(let t in e)return!1;return!0},mn=(e,t)=>{for(let n in e)if(!t(e[n],n))return!1;return!0},hn=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),gn=(e,t)=>e===t||fn(e)===fn(t)&&mn(e,(e,n)=>(e!==void 0||hn(t,n))&&sn(t[n],e)),_n=Object.freeze,vn=e=>{for(let t in e){let n=e[t];(typeof n==`object`||typeof n==`function`)&&vn(e[t])}return _n(e)},yn=(e,t,n=0)=>{try{for(;n<e.length;n++)e[n](...t)}finally{n<e.length&&yn(e,t,n+1)}},bn=e=>e,xn=(e,t)=>{if(e===t)return!0;if(e==null||t==null||e.constructor!==t.constructor&&(e.constructor||Object)!==(t.constructor||Object))return!1;if(e[on]!=null)return e[on](t);switch(e.constructor){case ArrayBuffer:e=new Uint8Array(e),t=new Uint8Array(t);case Uint8Array:if(e.byteLength!==t.byteLength)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;break;case Set:if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;break;case Map:if(e.size!==t.size)return!1;for(let n of e.keys())if(!t.has(n)||!xn(e.get(n),t.get(n)))return!1;break;case void 0:case Object:if(fn(e)!==fn(t))return!1;for(let n in e)if(!hn(e,n)||!xn(e[n],t[n]))return!1;break;case Array:if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!xn(e[n],t[n]))return!1;break;default:return!1}return!0},Sn=(e,t)=>t.includes(e),Cn=typeof process<`u`&&process.release&&/node|io\.js/.test(process.release.name)&&Object.prototype.toString.call(typeof process<`u`?process:0)===`[object process]`,wn=typeof window<`u`&&typeof document<`u`&&!Cn;typeof navigator<`u`&&/Mac/.test(navigator.platform);var A,Tn=[],En=()=>{if(A===void 0)if(Cn){A=h();let e=process.argv,t=null;for(let n=0;n<e.length;n++){let r=e[n];r[0]===`-`?(t!==null&&A.set(t,``),t=r):t===null?Tn.push(r):(A.set(t,r),t=null)}t!==null&&A.set(t,``)}else typeof location==`object`?(A=h(),(location.search||`?`).slice(1).split(`&`).forEach(e=>{if(e.length!==0){let[t,n]=e.split(`=`);A.set(`--${nt(t,`-`)}`,n),A.set(`-${nt(t,`-`)}`,n)}})):A=h();return A},Dn=e=>En().has(e),On=e=>nn(Cn?{}[e.toUpperCase().replaceAll(`-`,`_`)]:an.getItem(e)),kn=e=>Dn(`--`+e)||On(e)!==null,An=kn(`production`),jn=Cn&&Sn({}.FORCE_COLOR,[`true`,`1`,`2`])||!Dn(`--no-colors`)&&!kn(`no-color`)&&(!Cn||process.stdout.isTTY)&&(!Cn||Dn(`--color`)||On(`COLORTERM`)!==null||(On(`TERM`)||``).includes(`color`)),Mn=e=>new Uint8Array(e),Nn=wn?e=>{let t=``;for(let n=0;n<e.byteLength;n++)t+=Ze(e[n]);return btoa(t)}:e=>Buffer.from(e.buffer,e.byteOffset,e.byteLength).toString(`base64`),Pn=e=>{let t=Mn(e.byteLength);return t.set(e),t},Fn=e=>ut(t=>Tt(t,e)),In=class{constructor(e,t){this.left=e,this.right=t}},j=(e,t)=>new In(e,t),Ln=(e,t)=>e.forEach(e=>t(e.left,e.right)),Rn=e=>e.next()>=.5,zn=(e,t,n)=>b(e.next()*(n+1-t)+t),Bn=(e,t,n)=>b(e.next()*(n+1-t)+t),Vn=(e,t,n)=>Bn(e,t,n),Hn=e=>Ze(Vn(e,97,122)),Un=(e,t=0,n=20)=>{let r=Vn(e,t,n),i=``;for(let t=0;t<r;t++)i+=Hn(e);return i},Wn=(e,t)=>t[Vn(e,0,t.length-1)],Gn=Symbol(`0schema`),Kn=class{constructor(){this._rerrs=[]}extend(e,t,n,r=null){this._rerrs.push({path:e,expected:t,has:n,message:r})}toString(){let e=[];for(let t=this._rerrs.length-1;t>0;t--){let n=this._rerrs[t];e.push(st(` `,(this._rerrs.length-t)*2)+`${n.path==null?``:`[${n.path}] `}${n.has} doesn't match ${n.expected}. ${n.message}`)}return e.join(`
3
+ `)}},qn=(e,t)=>e===t?!0:e==null||t==null||e.constructor!==t.constructor?!1:e[on]?sn(e,t):y(e)?Ee(e,e=>De(t,t=>qn(e,t))):cn(e)?mn(e,(e,n)=>qn(e,t[n])):!1,M=class{static _dilutes=!1;extends(e){let[t,n]=[this.shape,e.shape];return this.constructor._dilutes&&([n,t]=[t,n]),qn(t,n)}equals(e){return this.constructor===e.constructor&&xn(this.shape,e.shape)}[Gn](){return!0}[on](e){return this.equals(e)}validate(e){return this.check(e)}check(e,t){E()}get nullable(){return wr(this,zr)}get optional(){return new nr(this)}cast(e){return Ur(e,this),e}expect(e){return Ur(e,this),e}},Jn=class extends M{constructor(e,t){super(),this.shape=e,this._c=t}check(e,t=void 0){let n=e?.constructor===this.shape&&(this._c==null||this._c(e));return!n&&t?.extend(null,this.shape.name,e?.constructor.name,e?.constructor===this.shape?`Check failed`:`Constructor match failed`),n}},N=(e,t=null)=>new Jn(e,t);N(Jn);var Yn=class extends M{constructor(e){super(),this.shape=e}check(e,t){let n=this.shape(e);return!n&&t?.extend(null,`custom prop`,e?.constructor.name,`failed to check custom prop`),n}},P=e=>new Yn(e);N(Yn);var Xn=class extends M{constructor(e){super(),this.shape=e}check(e,t){let n=this.shape.some(t=>t===e);return!n&&t?.extend(null,this.shape.join(` | `),e.toString()),n}},Zn=(...e)=>new Xn(e),Qn=N(Xn),$n=RegExp.escape||(e=>e.replace(/[().|&,$^[\]]/g,e=>`\\`+e)),er=e=>{if(Pr.check(e))return[$n(e)];if(Qn.check(e))return e.shape.map(e=>e+``);if(Nr.check(e))return[`[+-]?\\d+.?\\d*`];if(Fr.check(e))return[`.*`];if(Tr.check(e))return e.shape.map(er).flat(1);D()};N(class extends M{constructor(e){super(),this.shape=e,this._r=RegExp(`^`+e.map(er).map(e=>`(${e.join(`|`)})`).join(``)+`$`)}check(e,t){let n=this._r.exec(e)!=null;return!n&&t?.extend(null,this._r.toString(),e.toString(),`String doesn't match string template.`),n}});var tr=Symbol(`optional`),nr=class extends M{constructor(e){super(),this.shape=e}check(e,t){let n=e===void 0||this.shape.check(e);return!n&&t?.extend(null,`undefined (optional)`,`()`),n}get[tr](){return!0}},rr=N(nr),ir=class extends M{check(e,t){return t?.extend(null,`never`,typeof e),!1}};new ir,N(ir);var ar=class e extends M{constructor(e,t=!1){super(),this.shape=e,this._isPartial=t}static _dilutes=!0;get partial(){return new e(this.shape,!0)}check(e,t){return e==null?(t?.extend(null,`object`,`null`),!1):mn(this.shape,(n,r)=>{let i=this._isPartial&&!hn(e,r)||n.check(e[r],t);return!i&&t?.extend(r.toString(),n.toString(),typeof e[r],`Object property does not match`),i})}},or=e=>new ar(e),sr=N(ar),cr=P(e=>e!=null&&(e.constructor===Object||e.constructor==null)),lr=class extends M{constructor(e,t){super(),this.shape={keys:e,values:t}}check(e,t){return e!=null&&mn(e,(n,r)=>{let i=this.shape.keys.check(r,t);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)})}},ur=(e,t)=>new lr(e,t),dr=N(lr),fr=class extends M{constructor(e){super(),this.shape=e}check(e,t){return e!=null&&mn(this.shape,(n,r)=>{let i=n.check(e[r],t);return!i&&t?.extend(r.toString(),`Tuple`,typeof n),i})}},pr=(...e)=>new fr(e);N(fr);var mr=class extends M{constructor(e){super(),this.shape=e.length===1?e[0]:new Cr(e)}check(e,t){let n=y(e)&&Ee(e,e=>this.shape.check(e));return!n&&t?.extend(null,`Array`,``),n}},hr=(...e)=>new mr(e),gr=N(mr),_r=P(e=>y(e)),vr=class extends M{constructor(e,t){super(),this.shape=e,this._c=t}check(e,t){let n=e instanceof this.shape&&(this._c==null||this._c(e));return!n&&t?.extend(null,this.shape.name,e?.constructor.name),n}},yr=(e,t=null)=>new vr(e,t);N(vr);var br=yr(M),xr=N(class extends M{constructor(e){super(),this.len=e.length-1,this.args=pr(...e.slice(-1)),this.res=e[this.len]}check(e,t){let n=e.constructor===Function&&e.length<=this.len;return!n&&t?.extend(null,`function`,typeof e),n}}),Sr=P(e=>typeof e==`function`);N(class extends M{constructor(e){super(),this.shape=e}check(e,t){let n=Ee(this.shape,n=>n.check(e,t));return!n&&t?.extend(null,`Intersectinon`,typeof e),n}},e=>e.shape.length>0);var Cr=class extends M{static _dilutes=!0;constructor(e){super(),this.shape=e}check(e,t){let n=De(this.shape,n=>n.check(e,t));return t?.extend(null,`Union`,typeof e),n}},wr=(...e)=>e.findIndex(e=>Tr.check(e))>=0?wr(...e.map(e=>Hr(e)).map(e=>Tr.check(e)?e.shape:[e]).flat(1)):e.length===1?e[0]:new Cr(e),Tr=N(Cr),Er=()=>!0,Dr=P(Er),Or=N(Yn,e=>e.shape===Er),kr=P(e=>typeof e==`bigint`),Ar=P(e=>e===kr),jr=P(e=>typeof e==`symbol`);P(e=>e===jr);var Mr=P(e=>typeof e==`number`),Nr=P(e=>e===Mr),Pr=P(e=>typeof e==`string`),Fr=P(e=>e===Pr),Ir=P(e=>typeof e==`boolean`),Lr=P(e=>e===Ir),Rr=Zn(void 0);N(Xn,e=>e.shape.length===1&&e.shape[0]===void 0),Zn(void 0);var zr=Zn(null),Br=N(Xn,e=>e.shape.length===1&&e.shape[0]===null);N(Uint8Array),N(Jn,e=>e.shape===Uint8Array);var Vr=wr(Mr,Pr,zr,Rr,kr,Ir,jr);(()=>{let e=hr(Dr),t=ur(Pr,Dr),n=wr(Mr,Pr,zr,Ir,e,t);return e.shape=n,t.shape.values=n,n})();var Hr=e=>{if(br.check(e))return e;if(cr.check(e)){let t={};for(let n in e)t[n]=Hr(e[n]);return or(t)}else if(_r.check(e))return wr(...e.map(Hr));else if(Vr.check(e))return Zn(e);else if(Sr.check(e))return N(e);D()},Ur=An?()=>{}:(e,t)=>{let n=new Kn;if(!t.check(e,n))throw T(`Expected value to be of type ${t.constructor.name}.\n${n.toString()}`)},Wr=class{constructor(e){this.patterns=[],this.$state=e}if(e,t){return this.patterns.push({if:Hr(e),h:t}),this}else(e){return this.if(Dr,e)}done(){return(e,t)=>{for(let n=0;n<this.patterns.length;n++){let r=this.patterns[n];if(r.if.check(e))return r.h(e,t)}throw T(`Unhandled pattern`)}}},Gr=(e=>new Wr(e))(Dr).if(Nr,(e,t)=>zn(t,Ye,Je)).if(Fr,(e,t)=>Un(t)).if(Lr,(e,t)=>Rn(t)).if(Ar,(e,t)=>BigInt(zn(t,Ye,Je))).if(Tr,(e,t)=>Kr(t,Wn(t,e.shape))).if(sr,(e,t)=>{let n={};for(let r in e.shape){let i=e.shape[r];if(rr.check(i)){if(Rn(t))continue;i=i.shape}n[r]=Gr(i,t)}return n}).if(gr,(e,t)=>{let n=[],r=Bn(t,0,42);for(let i=0;i<r;i++)n.push(Kr(t,e.shape));return n}).if(Qn,(e,t)=>Wn(t,e.shape)).if(Br,(e,t)=>null).if(xr,(e,t)=>{let n=Kr(t,e.res);return()=>n}).if(Or,(e,t)=>Kr(t,Wn(t,[Mr,Pr,zr,Rr,kr,Ir,hr(Mr),ur(wr(`a`,`b`,`c`),Mr)]))).if(dr,(e,t)=>{let n={},r=zn(t,0,3);for(let i=0;i<r;i++){let r=Kr(t,e.shape.keys);n[r]=Kr(t,e.shape.values)}return n}).done(),Kr=(e,t)=>Gr(Hr(t),e),F=typeof document<`u`?document:{},qr=e=>F.createElement(e),Jr=()=>F.createDocumentFragment();P(e=>e.nodeType===oi);var Yr=e=>F.createTextNode(e);typeof DOMParser<`u`&&new DOMParser;var Xr=(e,t)=>(Ln(t,(t,n)=>{n===!1?e.removeAttribute(t):n===!0?e.setAttribute(t,``):e.setAttribute(t,n)}),e),Zr=e=>{let t=Jr();for(let n=0;n<e.length;n++)ni(t,e[n]);return t},Qr=(e,t)=>(ni(e,Zr(t)),e),$r=(e,t=[],n=[])=>Qr(Xr(qr(e),t),n);P(e=>e.nodeType===ri);var ei=Yr;P(e=>e.nodeType===ii);var ti=e=>Se(e,(e,t)=>`${t}:${e};`).join(``),ni=(e,t)=>e.appendChild(t),ri=F.ELEMENT_NODE,ii=F.TEXT_NODE;F.CDATA_SECTION_NODE,F.COMMENT_NODE;var ai=F.DOCUMENT_NODE;F.DOCUMENT_TYPE_NODE;var oi=F.DOCUMENT_FRAGMENT_NODE;P(e=>e.nodeType===ai);var si=(e=>class{constructor(e){this._=e}destroy(){e(this._)}})(clearTimeout),ci=(e,t)=>new si(setTimeout(t,e)),I=Symbol,li=I(),ui=I(),di=I(),fi=I(),pi=I(),mi=I(),hi=I(),gi=I(),_i=I(),vi=e=>{e.length===1&&e[0]?.constructor===Function&&(e=e[0]());let t=[],n=[],r=0;for(;r<e.length;r++){let n=e[r];if(n===void 0)break;if(n.constructor===String||n.constructor===Number)t.push(n);else if(n.constructor===Object)break}for(r>0&&n.push(t.join(``));r<e.length;r++){let t=e[r];t instanceof Symbol||n.push(t)}return n};en();var yi={[li]:j(`font-weight`,`bold`),[ui]:j(`font-weight`,`normal`),[di]:j(`color`,`blue`),[pi]:j(`color`,`green`),[fi]:j(`color`,`grey`),[mi]:j(`color`,`red`),[hi]:j(`color`,`purple`),[gi]:j(`color`,`orange`),[_i]:j(`color`,`black`)},bi=jn?e=>{e.length===1&&e[0]?.constructor===Function&&(e=e[0]());let t=[],n=[],r=h(),i=[],a=0;for(;a<e.length;a++){let i=e[a],o=yi[i];if(o!==void 0)r.set(o.left,o.right);else{if(i===void 0)break;if(i.constructor===String||i.constructor===Number){let e=ti(r);a>0||e.length>0?(t.push(`%c`+i),n.push(e)):t.push(i)}else break}}for(a>0&&(i=n,i.unshift(t.join(``)));a<e.length;a++){let t=e[a];t instanceof Symbol||i.push(t)}return i}:vi,xi=(...e)=>{console.log(...bi(e)),Ci.forEach(t=>t.print(e))},Si=(...e)=>{console.warn(...bi(e)),e.unshift(gi),Ci.forEach(t=>t.print(e))},Ci=_(),wi=e=>({[Symbol.iterator](){return this},next:e}),Ti=(e,t)=>wi(()=>{let n;do n=e.next();while(!n.done&&!t(n.value));return n}),Ei=(e,t)=>wi(()=>{let{done:n,value:r}=e.next();return{done:n,value:n?void 0:t(r)}}),Di=class{constructor(e,t){this.clock=e,this.len=t}},Oi=class{constructor(){this.clients=new Map}},ki=(e,t,n)=>t.clients.forEach((t,r)=>{let i=e.doc.store.clients.get(r);if(i!=null){let r=i[i.length-1],a=r.id.clock+r.length;for(let r=0,o=t[r];r<t.length&&o.clock<a;o=t[++r])Wa(e,i,o.clock,o.len,n)}}),Ai=(e,t)=>{let n=0,r=e.length-1;for(;n<=r;){let i=b((n+r)/2),a=e[i],o=a.clock;if(o<=t){if(t<o+a.len)return i;n=i+1}else r=i-1}return null},ji=(e,t)=>{let n=e.clients.get(t.client);return n!==void 0&&Ai(n,t.clock)!==null},Mi=e=>{e.clients.forEach(e=>{e.sort((e,t)=>e.clock-t.clock);let t,n;for(t=1,n=1;t<e.length;t++){let r=e[n-1],i=e[t];r.clock+r.len>=i.clock?e[n-1]=new Di(r.clock,Ne(r.len,i.clock+i.len-r.clock)):(n<t&&(e[n]=i),n++)}e.length=n})},Ni=e=>{let t=new Oi;for(let n=0;n<e.length;n++)e[n].clients.forEach((r,i)=>{if(!t.clients.has(i)){let a=r.slice();for(let t=n+1;t<e.length;t++)Te(a,e[t].clients.get(i)||[]);t.clients.set(i,a)}});return Mi(t),t},Pi=(e,t,n,r)=>{g(e.clients,t,()=>[]).push(new Di(n,r))},Fi=()=>new Oi,Ii=e=>{let t=Fi();return e.clients.forEach((e,n)=>{let r=[];for(let t=0;t<e.length;t++){let n=e[t];if(n.deleted){let i=n.id.clock,a=n.length;if(t+1<e.length)for(let n=e[t+1];t+1<e.length&&n.deleted;n=e[++t+1])a+=n.length;r.push(new Di(i,a))}}r.length>0&&t.clients.set(n,r)}),t},Li=(e,t)=>{C(e.restEncoder,t.clients.size),v(t.clients.entries()).sort((e,t)=>t[0]-e[0]).forEach(([t,n])=>{e.resetDsCurVal(),C(e.restEncoder,t);let r=n.length;C(e.restEncoder,r);for(let t=0;t<r;t++){let r=n[t];e.writeDsClock(r.clock),e.writeDsLen(r.len)}})},Ri=e=>{let t=new Oi,n=k(e.restDecoder);for(let r=0;r<n;r++){e.resetDsCurVal();let n=k(e.restDecoder),r=k(e.restDecoder);if(r>0){let i=g(t.clients,n,()=>[]);for(let t=0;t<r;t++)i.push(new Di(e.readDsClock(),e.readDsLen()))}}return t},zi=(e,t,n)=>{let r=new Oi,i=k(e.restDecoder);for(let a=0;a<i;a++){e.resetDsCurVal();let i=k(e.restDecoder),a=k(e.restDecoder),o=n.clients.get(i)||[],s=R(n,i);for(let n=0;n<a;n++){let n=e.readDsClock(),a=n+e.readDsLen();if(n<s){s<a&&Pi(r,i,s,a-s);let e=z(o,n),c=o[e];for(!c.deleted&&c.id.clock<n&&(o.splice(e+1,0,nc(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,nc(t,c,a-c.id.clock)),c.delete(t))}else Pi(r,i,n,a-n)}}if(r.clients.size>0){let e=new Yi;return C(e.restEncoder,0),Li(e,r),e.toUint8Array()}return null},Bi=Xt,Vi=class e extends ke{constructor({guid:e=$t(),collectionid:t=null,gc:n=!0,gcFilter:r=()=>!0,meta:i=null,autoLoad:a=!1,shouldLoad:o=!0}={}){super(),this.gc=n,this.gcFilter=r,this.clientID=Bi(),this.guid=e,this.collectionid=t,this.share=new Map,this.store=new La,this._transaction=null,this._transactionCleanups=[],this.subdocs=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=tn(e=>{this.on(`load`,()=>{this.isLoaded=!0,e(this)})});let s=()=>tn(e=>{let t=n=>{(n===void 0||n===!0)&&(this.off(`sync`,t),e())};this.on(`sync`,t)});this.on(`sync`,e=>{e===!1&&this.isSynced&&(this.whenSynced=s()),this.isSynced=e===void 0||e===!0,this.isSynced&&!this.isLoaded&&this.emit(`load`,[this])}),this.whenSynced=s()}load(){let e=this._item;e!==null&&!this.shouldLoad&&V(e.parent.doc,e=>{e.subdocsLoaded.add(this)},null,!0),this.shouldLoad=!0}getSubdocs(){return this.subdocs}getSubdocGuids(){return new Set(v(this.subdocs).map(e=>e.guid))}transact(e,t=null){return V(this,e,t)}get(e,t=U){let n=g(this.share,e,()=>{let e=new t;return e._integrate(this,null),e}),r=n.constructor;if(t!==U&&r!==t)if(r===U){let r=new t;r._map=n._map,n._map.forEach(e=>{for(;e!==null;e=e.left)e.parent=r}),r._start=n._start;for(let e=r._start;e!==null;e=e.right)e.parent=r;return r._length=n._length,this.share.set(e,r),r._integrate(this,null),r}else throw Error(`Type with the name ${e} has already been defined with a different constructor`);return n}getArray(e=``){return this.get(e,qo)}getText(e=``){return this.get(e,ms)}getMap(e=``){return this.get(e,Xo)}getXmlElement(e=``){return this.get(e,ys)}getXmlFragment(e=``){return this.get(e,_s)}toJSON(){let e={};return this.share.forEach((t,n)=>{e[n]=t.toJSON()}),e}destroy(){this.isDestroyed=!0,v(this.subdocs).forEach(e=>e.destroy());let t=this._item;if(t!==null){this._item=null;let n=t.content;n.doc=new e({guid:this.guid,...n.opts,shouldLoad:!1}),n.doc._item=t,V(t.parent.doc,e=>{let r=n.doc;t.deleted||e.subdocsAdded.add(r),e.subdocsRemoved.add(this)},null,!0)}this.emit(`destroyed`,[!0]),this.emit(`destroy`,[this]),super.destroy()}},Hi=class{constructor(e){this.restDecoder=e}resetDsCurVal(){}readDsClock(){return k(this.restDecoder)}readDsLen(){return k(this.restDecoder)}},Ui=class extends Hi{readLeftID(){return L(k(this.restDecoder),k(this.restDecoder))}readRightID(){return L(k(this.restDecoder),k(this.restDecoder))}readClient(){return k(this.restDecoder)}readInfo(){return Rt(this.restDecoder)}readString(){return Bt(this.restDecoder)}readParentInfo(){return k(this.restDecoder)===1}readTypeRef(){return k(this.restDecoder)}readLen(){return k(this.restDecoder)}readAny(){return Ut(this.restDecoder)}readBuf(){return Pn(O(this.restDecoder))}readJSON(){return JSON.parse(Bt(this.restDecoder))}readKey(){return Bt(this.restDecoder)}},Wi=class{constructor(e){this.dsCurrVal=0,this.restDecoder=e}resetDsCurVal(){this.dsCurrVal=0}readDsClock(){return this.dsCurrVal+=k(this.restDecoder),this.dsCurrVal}readDsLen(){let e=k(this.restDecoder)+1;return this.dsCurrVal+=e,e}},Gi=class extends Wi{constructor(e){super(e),this.keys=[],k(e),this.keyClockDecoder=new Kt(O(e)),this.clientDecoder=new Gt(O(e)),this.leftClockDecoder=new Kt(O(e)),this.rightClockDecoder=new Kt(O(e)),this.infoDecoder=new Wt(O(e),Rt),this.stringDecoder=new qt(O(e)),this.parentInfoDecoder=new Wt(O(e),Rt),this.typeRefDecoder=new Gt(O(e)),this.lenDecoder=new Gt(O(e))}readLeftID(){return new va(this.clientDecoder.read(),this.leftClockDecoder.read())}readRightID(){return new va(this.clientDecoder.read(),this.rightClockDecoder.read())}readClient(){return this.clientDecoder.read()}readInfo(){return this.infoDecoder.read()}readString(){return this.stringDecoder.read()}readParentInfo(){return this.parentInfoDecoder.read()===1}readTypeRef(){return this.typeRefDecoder.read()}readLen(){return this.lenDecoder.read()}readAny(){return Ut(this.restDecoder)}readBuf(){return O(this.restDecoder)}readJSON(){return Ut(this.restDecoder)}readKey(){let e=this.keyClockDecoder.read();if(e<this.keys.length)return this.keys[e];{let e=this.stringDecoder.read();return this.keys.push(e),e}}},Ki=class{constructor(){this.restEncoder=lt()}toUint8Array(){return x(this.restEncoder)}resetDsCurVal(){}writeDsClock(e){C(this.restEncoder,e)}writeDsLen(e){C(this.restEncoder,e)}},qi=class extends Ki{writeLeftID(e){C(this.restEncoder,e.client),C(this.restEncoder,e.clock)}writeRightID(e){C(this.restEncoder,e.client),C(this.restEncoder,e.clock)}writeClient(e){C(this.restEncoder,e)}writeInfo(e){pt(this.restEncoder,e)}writeString(e){_t(this.restEncoder,e)}writeParentInfo(e){C(this.restEncoder,+!!e)}writeTypeRef(e){C(this.restEncoder,e)}writeLen(e){C(this.restEncoder,e)}writeAny(e){Tt(this.restEncoder,e)}writeBuf(e){w(this.restEncoder,e)}writeJSON(e){_t(this.restEncoder,JSON.stringify(e))}writeKey(e){_t(this.restEncoder,e)}},Ji=class{constructor(){this.restEncoder=lt(),this.dsCurrVal=0}toUint8Array(){return x(this.restEncoder)}resetDsCurVal(){this.dsCurrVal=0}writeDsClock(e){let t=e-this.dsCurrVal;this.dsCurrVal=e,C(this.restEncoder,t)}writeDsLen(e){e===0&&D(),C(this.restEncoder,e-1),this.dsCurrVal+=e}},Yi=class extends Ji{constructor(){super(),this.keyMap=new Map,this.keyClock=0,this.keyClockEncoder=new At,this.clientEncoder=new Ot,this.leftClockEncoder=new At,this.rightClockEncoder=new At,this.infoEncoder=new Et(pt),this.stringEncoder=new jt,this.parentInfoEncoder=new Et(pt),this.typeRefEncoder=new Ot,this.lenEncoder=new Ot}toUint8Array(){let e=lt();return C(e,0),w(e,this.keyClockEncoder.toUint8Array()),w(e,this.clientEncoder.toUint8Array()),w(e,this.leftClockEncoder.toUint8Array()),w(e,this.rightClockEncoder.toUint8Array()),w(e,x(this.infoEncoder)),w(e,this.stringEncoder.toUint8Array()),w(e,x(this.parentInfoEncoder)),w(e,this.typeRefEncoder.toUint8Array()),w(e,this.lenEncoder.toUint8Array()),vt(e,x(this.restEncoder)),x(e)}writeLeftID(e){this.clientEncoder.write(e.client),this.leftClockEncoder.write(e.clock)}writeRightID(e){this.clientEncoder.write(e.client),this.rightClockEncoder.write(e.clock)}writeClient(e){this.clientEncoder.write(e)}writeInfo(e){this.infoEncoder.write(e)}writeString(e){this.stringEncoder.write(e)}writeParentInfo(e){this.parentInfoEncoder.write(+!!e)}writeTypeRef(e){this.typeRefEncoder.write(e)}writeLen(e){this.lenEncoder.write(e)}writeAny(e){Tt(this.restEncoder,e)}writeBuf(e){w(this.restEncoder,e)}writeJSON(e){Tt(this.restEncoder,e)}writeKey(e){let t=this.keyMap.get(e);t===void 0?(this.keyClockEncoder.write(this.keyClock++),this.stringEncoder.write(e)):this.keyClockEncoder.write(t)}},Xi=(e,t,n,r)=>{r=Ne(r,t[0].id.clock);let i=z(t,r);C(e.restEncoder,t.length-i),e.writeClient(n),C(e.restEncoder,r);let a=t[i];a.write(e,r-a.id.clock);for(let n=i+1;n<t.length;n++)t[n].write(e,0)},Zi=(e,t,n)=>{let r=new Map;n.forEach((e,n)=>{R(t,n)>e&&r.set(n,e)}),Ra(t).forEach((e,t)=>{n.has(t)||r.set(t,0)}),C(e.restEncoder,r.size),v(r.entries()).sort((e,t)=>t[0]-e[0]).forEach(([n,r])=>{Xi(e,t.clients.get(n),n,r)})},Qi=(e,t)=>{let n=h(),r=k(e.restDecoder);for(let i=0;i<r;i++){let r=k(e.restDecoder),i=Array(r),a=e.readClient(),o=k(e.restDecoder);n.set(a,{i:0,refs:i});for(let n=0;n<r;n++){let r=e.readInfo();switch(31&r){case 0:{let t=e.readLen();i[n]=new W(L(a,o),t),o+=t;break}case 10:{let t=k(e.restDecoder);i[n]=new J(L(a,o),t),o+=t;break}default:{let s=(r&192)==0,c=new q(L(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,ac(e,r));i[n]=c,o+=c.length}}}}return n},$i=(e,t,n)=>{let r=[],i=v(n.keys()).sort((e,t)=>e-t);if(i.length===0)return null;let a=()=>{if(i.length===0)return null;let e=n.get(i[i.length-1]);for(;e.refs.length===e.i;)if(i.pop(),i.length>0)e=n.get(i[i.length-1]);else return null;return e},o=a();if(o===null)return null;let s=new La,c=new Map,l=(e,t)=>{let n=c.get(e);(n==null||n>t)&&c.set(e,t)},u=o.refs[o.i++],d=new Map,f=()=>{for(let e of r){let t=e.id.client,r=n.get(t);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)}r.length=0};for(;;){if(u.constructor!==J){let i=g(d,u.id.client,()=>R(t,u.id.client))-u.id.clock;if(i<0)r.push(u),l(u.id.client,u.id.clock-1),f();else{let a=u.getMissing(e,t);if(a!==null){r.push(u);let e=n.get(a)||{refs:[],i:0};if(e.refs.length===e.i)l(a,R(t,a)),f();else{u=e.refs[e.i++];continue}}else (i===0||i<u.length)&&(u.integrate(e,i),d.set(u.id.client,u.id.clock+u.length))}}if(r.length>0)u=r.pop();else if(o!==null&&o.i<o.refs.length)u=o.refs[o.i++];else{if(o=a(),o===null)break;u=o.refs[o.i++]}}if(s.clients.size>0){let e=new Yi;return Zi(e,s,new Map),C(e.restEncoder,0),{missing:c,update:e.toUint8Array()}}return null},ea=(e,t)=>Zi(e,t.doc.store,t.beforeState),ta=(e,t,n,r=new Gi(e))=>V(t,e=>{e.local=!1;let t=!1,n=e.doc,i=n.store,a=$i(e,i,Qi(r,n)),o=i.pendingStructs;if(o){for(let[e,n]of o.missing)if(n<R(i,e)){t=!0;break}if(a){for(let[e,t]of a.missing){let n=o.missing.get(e);(n==null||n>t)&&o.missing.set(e,t)}o.update=so([o.update,a.update])}}else i.pendingStructs=a;let s=zi(r,e,i);if(i.pendingDs){let t=new Gi(Ft(i.pendingDs));k(t.restDecoder);let n=zi(t,e,i);s&&n?i.pendingDs=so([s,n]):i.pendingDs=s||n}else i.pendingDs=s;if(t){let t=i.pendingStructs.update;i.pendingStructs=null,na(e.doc,t)}},n,!1),na=(e,t,n,r=Gi)=>{let i=Ft(t);ta(i,e,n,new r(i))},ra=(e,t,n)=>na(e,t,n,Ui),ia=(e,t,n=new Map)=>{Zi(e,t.store,n),Li(e,Ii(t.store))},aa=(e,t=new Uint8Array([0]),n=new Yi)=>{ia(n,e,ca(t));let r=[n.toUint8Array()];if(e.store.pendingDs&&r.push(e.store.pendingDs),e.store.pendingStructs&&r.push(co(e.store.pendingStructs.update,t)),r.length>1){if(n.constructor===qi)return ao(r.map((e,t)=>t===0?e:mo(e)));if(n.constructor===Yi)return so(r)}return r[0]},oa=(e,t)=>aa(e,t,new qi),sa=e=>{let t=new Map,n=k(e.restDecoder);for(let r=0;r<n;r++){let n=k(e.restDecoder),r=k(e.restDecoder);t.set(n,r)}return t},ca=e=>sa(new Hi(Ft(e))),la=(e,t)=>(C(e.restEncoder,t.size),v(t.entries()).sort((e,t)=>t[0]-e[0]).forEach(([t,n])=>{C(e.restEncoder,t),C(e.restEncoder,n)}),e),ua=(e,t)=>la(e,Ra(t.store)),da=(e,t=new Ji)=>(e instanceof Map?la(t,e):ua(t,e),t.toUint8Array()),fa=e=>da(e,new Ki),pa=class{constructor(){this.l=[]}},ma=()=>new pa,ha=(e,t)=>e.l.push(t),ga=(e,t)=>{let n=e.l,r=n.length;e.l=n.filter(e=>t!==e),r===e.l.length&&console.error(`[yjs] Tried to remove event handler that doesn't exist.`)},_a=(e,t,n)=>yn(e.l,[t,n]),va=class{constructor(e,t){this.client=e,this.clock=t}},ya=(e,t)=>e===t||e!==null&&t!==null&&e.client===t.client&&e.clock===t.clock,L=(e,t)=>new va(e,t),ba=e=>{for(let[t,n]of e.doc.share.entries())if(n===e)return t;throw D()},xa=(e,t)=>{for(;t!==null;){if(t.parent===e)return!0;t=t.parent._item}return!1},Sa=class{constructor(e,t,n,r=0){this.type=e,this.tname=t,this.item=n,this.assoc=r}},Ca=e=>{let t={};return e.type&&(t.type=e.type),e.tname&&(t.tname=e.tname),e.item&&(t.item=e.item),e.assoc!=null&&(t.assoc=e.assoc),t},wa=e=>new Sa(e.type==null?null:L(e.type.client,e.type.clock),e.tname??null,e.item==null?null:L(e.item.client,e.item.clock),e.assoc==null?0:e.assoc),Ta=class{constructor(e,t,n=0){this.type=e,this.index=t,this.assoc=n}},Ea=(e,t,n=0)=>new Ta(e,t,n),Da=(e,t,n)=>{let r=null,i=null;return e._item===null?i=ba(e):r=L(e._item.id.client,e._item.id.clock),new Sa(r,i,t,n)},Oa=(e,t,n=0)=>{let r=e._start;if(n<0){if(t===0)return Da(e,null,n);t--}for(;r!==null;){if(!r.deleted&&r.countable){if(r.length>t)return Da(e,L(r.id.client,r.id.clock+t),n);t-=r.length}if(r.right===null&&n<0)return Da(e,r.lastId,n);r=r.right}return Da(e,null,n)},ka=(e,t)=>{let n=Ba(e,t);return{item:n,diff:t.clock-n.id.clock}},Aa=(e,t,n=!0)=>{let r=t.store,i=e.item,a=e.type,o=e.tname,s=e.assoc,c=null,l=0;if(i!==null){if(R(r,i.client)<=i.clock)return null;let e=n?ec(r,i):ka(r,i),t=e.item;if(!(t instanceof q))return null;if(c=t.parent,c._item===null||!c._item.deleted){l=t.deleted||!t.countable?0:e.diff+(s>=0?0:1);let n=t.left;for(;n!==null;)!n.deleted&&n.countable&&(l+=n.length),n=n.left}}else{if(o!==null)c=t.get(o);else if(a!==null){if(R(r,a.client)<=a.clock)return null;let{item:e}=n?ec(r,a):{item:Ba(r,a)};if(e instanceof q&&e.content instanceof K)c=e.content.type;else return null}else throw D();l=s>=0?c._length:0}return Ea(c,l,e.assoc)},ja=(e,t)=>e===t||e!==null&&t!==null&&e.tname===t.tname&&ya(e.item,t.item)&&ya(e.type,t.type)&&e.assoc===t.assoc,Ma=class{constructor(e,t){this.ds=e,this.sv=t}},Na=(e,t)=>new Ma(e,t);Na(Fi(),new Map);var Pa=e=>Na(Ii(e.store),Ra(e.store)),Fa=(e,t)=>t===void 0?!e.deleted:t.sv.has(e.id.client)&&(t.sv.get(e.id.client)||0)>e.id.clock&&!ji(t.ds,e.id),Ia=(e,t)=>{let n=g(e.meta,Ia,_),r=e.doc.store;n.has(t)||(t.sv.forEach((t,n)=>{t<R(r,n)&&B(e,L(n,t))}),ki(e,t.ds,e=>{}),n.add(t))},La=class{constructor(){this.clients=new Map,this.pendingStructs=null,this.pendingDs=null}},Ra=e=>{let t=new Map;return e.clients.forEach((e,n)=>{let r=e[e.length-1];t.set(n,r.id.clock+r.length)}),t},R=(e,t)=>{let n=e.clients.get(t);if(n===void 0)return 0;let r=n[n.length-1];return r.id.clock+r.length},za=(e,t)=>{let n=e.clients.get(t.id.client);if(n===void 0)n=[],e.clients.set(t.id.client,n);else{let e=n[n.length-1];if(e.id.clock+e.length!==t.id.clock)throw D()}n.push(t)},z=(e,t)=>{let n=0,r=e.length-1,i=e[r],a=i.id.clock;if(a===t)return r;let o=b(t/(a+i.length-1)*r);for(;n<=r;){if(i=e[o],a=i.id.clock,a<=t){if(t<a+i.length)return o;n=o+1}else r=o-1;o=b((n+r)/2)}throw D()},Ba=(e,t)=>{let n=e.clients.get(t.client);return n[z(n,t.clock)]},Va=(e,t,n)=>{let r=z(t,n),i=t[r];return i.id.clock<n&&i instanceof q?(t.splice(r+1,0,nc(e,i,n-i.id.clock)),r+1):r},B=(e,t)=>{let n=e.doc.store.clients.get(t.client);return n[Va(e,n,t.clock)]},Ha=(e,t,n)=>{let r=t.clients.get(n.client),i=z(r,n.clock),a=r[i];return n.clock!==a.id.clock+a.length-1&&a.constructor!==W&&r.splice(i+1,0,nc(e,a,n.clock-a.id.clock+1)),a},Ua=(e,t,n)=>{let r=e.clients.get(t.id.client);r[z(r,t.id.clock)]=n},Wa=(e,t,n,r,i)=>{if(r===0)return;let a=n+r,o=Va(e,t,n),s;do s=t[o++],a<s.id.clock+s.length&&Va(e,t,a),i(s);while(o<t.length&&t[o].id.clock<a)},Ga=class{constructor(e,t,n){this.doc=e,this.deleteSet=new Oi,this.beforeState=Ra(e.store),this.afterState=new Map,this.changed=new Map,this.changedParentTypes=new Map,this._mergeStructs=[],this.origin=t,this.meta=new Map,this.local=n,this.subdocsAdded=new Set,this.subdocsRemoved=new Set,this.subdocsLoaded=new Set,this._needFormattingCleanup=!1}},Ka=(e,t)=>t.deleteSet.clients.size===0&&!Ce(t.afterState,(e,n)=>t.beforeState.get(n)!==e)?!1:(Mi(t.deleteSet),ea(e,t),Li(e,t.deleteSet),!0),qa=(e,t,n)=>{let r=t._item;(r===null||r.id.clock<(e.beforeState.get(r.id.client)||0)&&!r.deleted)&&g(e.changed,t,_).add(n)},Ja=(e,t)=>{let n=e[t],r=e[t-1],i=t;for(;i>0;n=r,r=e[--i-1]){if(r.deleted===n.deleted&&r.constructor===n.constructor&&r.mergeWith(n)){n instanceof q&&n.parentSub!==null&&n.parent._map.get(n.parentSub)===n&&n.parent._map.set(n.parentSub,r);continue}break}let a=t-i;return a&&e.splice(t+1-a,a),a},Ya=(e,t,n)=>{for(let[r,i]of e.clients.entries()){let e=t.clients.get(r);for(let r=i.length-1;r>=0;r--){let a=i[r],o=a.clock+a.len;for(let r=z(e,a.clock),i=e[r];r<e.length&&i.id.clock<o;i=e[++r]){let i=e[r];if(a.clock+a.len<=i.id.clock)break;i instanceof q&&i.deleted&&!i.keep&&n(i)&&i.gc(t,!1)}}}},Xa=(e,t)=>{e.clients.forEach((e,n)=>{let r=t.clients.get(n);for(let t=e.length-1;t>=0;t--){let n=e[t],i=Me(r.length-1,1+z(r,n.clock+n.len-1));for(let e=i,t=r[e];e>0&&t.id.clock>=n.clock;t=r[e])e-=1+Ja(r,e)}})},Za=(e,t)=>{if(t<e.length){let n=e[t],r=n.doc,i=r.store,a=n.deleteSet,o=n._mergeStructs;try{Mi(a),n.afterState=Ra(n.doc.store),r.emit(`beforeObserverCalls`,[n,r]);let e=[];n.changed.forEach((t,r)=>e.push(()=>{(r._item===null||!r._item.deleted)&&r._callObserver(n,t)})),e.push(()=>{n.changedParentTypes.forEach((t,r)=>{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=>{e.currentTarget=r,e._path=null}),t.sort((e,t)=>e.path.length-t.path.length),e.push(()=>{_a(r._dEH,t,n)}))}),e.push(()=>r.emit(`afterTransaction`,[n,r])),e.push(()=>{n._needFormattingCleanup&&ds(n)})}),yn(e,[])}finally{r.gc&&Ya(a,i,r.gcFilter),Xa(a,i),n.afterState.forEach((e,t)=>{let r=n.beforeState.get(t)||0;if(r!==e){let e=i.clients.get(t),n=Ne(z(e,r),1);for(let t=e.length-1;t>=n;)t-=1+Ja(e,t)}});for(let e=o.length-1;e>=0;e--){let{client:t,clock:n}=o[e].id,r=i.clients.get(t),a=z(r,n);a+1<r.length&&Ja(r,a+1)>1||a>0&&Ja(r,a)}if(!n.local&&n.afterState.get(r.clientID)!==n.beforeState.get(r.clientID)&&(xi(gi,li,`[yjs] `,ui,mi,`Changed the client-id because another client seems to be using it.`),r.clientID=Bi()),r.emit(`afterTransactionCleanup`,[n,r]),r._observers.has(`update`)){let e=new qi;Ka(e,n)&&r.emit(`update`,[e.toUint8Array(),n.origin,r,n])}if(r._observers.has(`updateV2`)){let e=new Yi;Ka(e,n)&&r.emit(`updateV2`,[e.toUint8Array(),n.origin,r,n])}let{subdocsAdded:s,subdocsLoaded:c,subdocsRemoved:l}=n;(s.size>0||l.size>0||c.size>0)&&(s.forEach(e=>{e.clientID=r.clientID,e.collectionid??=r.collectionid,r.subdocs.add(e)}),l.forEach(e=>r.subdocs.delete(e)),r.emit(`subdocs`,[{loaded:c,added:s,removed:l},r,n]),l.forEach(e=>e.destroy())),e.length<=t+1?(r._transactionCleanups=[],r.emit(`afterAllTransactions`,[r,e])):Za(e,t+1)}}},V=(e,t,n=null,r=!0)=>{let i=e._transactionCleanups,a=!1,o=null;e._transaction===null&&(a=!0,e._transaction=new Ga(e,n,r),i.push(e._transaction),i.length===1&&e.emit(`beforeAllTransactions`,[e]),e.emit(`beforeTransaction`,[e._transaction,e]));try{o=t(e._transaction)}finally{if(a){let t=e._transaction===i[0];e._transaction=null,t&&Za(i,0)}}return o},Qa=class{constructor(e,t){this.insertions=t,this.deletions=e,this.meta=new Map}},$a=(e,t,n)=>{ki(e,n.deletions,n=>{n instanceof q&&t.scope.some(t=>t===e.doc||xa(t,n))&&tc(n,!1)})},eo=(e,t,n)=>{let r=null,i=e.doc,a=e.scope;V(i,n=>{for(;t.length>0&&e.currStackItem===null;){let r=i.store,o=t.pop(),s=new Set,c=[],l=!1;ki(n,o.insertions,e=>{if(e instanceof q){if(e.redone!==null){let{item:t,diff:i}=ec(r,e.id);i>0&&(t=B(n,L(t.id.client,t.id.clock+i))),e=t}!e.deleted&&a.some(t=>t===n.doc||xa(t,e))&&c.push(e)}}),ki(n,o.deletions,e=>{e instanceof q&&a.some(t=>t===n.doc||xa(t,e))&&!ji(o.insertions,e.id)&&s.add(e)}),s.forEach(t=>{l=ic(n,t,s,o.insertions,e.ignoreRemoteMapChanges,e)!==null||l});for(let t=c.length-1;t>=0;t--){let r=c[t];e.deleteFilter(r)&&(r.delete(n),l=!0)}e.currStackItem=l?o:null}n.changed.forEach((e,t)=>{e.has(null)&&t._searchMarker&&(t._searchMarker.length=0)}),r=n},e);let o=e.currStackItem;if(o!=null){let t=r.changedParentTypes;e.emit(`stack-item-popped`,[{stackItem:o,type:n,changedParentTypes:t,origin:e},e]),e.currStackItem=null}return o},to=class extends ke{constructor(e,{captureTimeout:t=500,captureTransaction:n=e=>!0,deleteFilter:r=()=>!0,trackedOrigins:i=new Set([null]),ignoreRemoteMapChanges:a=!1,doc:o=y(e)?e[0].doc:e instanceof Vi?e:e.doc}={}){super(),this.scope=[],this.doc=o,this.addToScope(e),this.deleteFilter=r,i.add(this),this.trackedOrigins=i,this.captureTransaction=n,this.undoStack=[],this.redoStack=[],this.undoing=!1,this.redoing=!1,this.currStackItem=null,this.lastChange=0,this.ignoreRemoteMapChanges=a,this.captureTimeout=t,this.afterTransactionHandler=e=>{if(!this.captureTransaction(e)||!this.scope.some(t=>e.changedParentTypes.has(t)||t===this.doc)||!this.trackedOrigins.has(e.origin)&&(!e.origin||!this.trackedOrigins.has(e.origin.constructor)))return;let t=this.undoing,n=this.redoing,r=t?this.redoStack:this.undoStack;t?this.stopCapturing():n||this.clear(!1,!0);let i=new Oi;e.afterState.forEach((t,n)=>{let r=e.beforeState.get(n)||0,a=t-r;a>0&&Pi(i,n,r,a)});let a=en(),o=!1;if(this.lastChange>0&&a-this.lastChange<this.captureTimeout&&r.length>0&&!t&&!n){let t=r[r.length-1];t.deletions=Ni([t.deletions,e.deleteSet]),t.insertions=Ni([t.insertions,i])}else r.push(new Qa(e.deleteSet,i)),o=!0;!t&&!n&&(this.lastChange=a),ki(e,e.deleteSet,t=>{t instanceof q&&this.scope.some(n=>n===e.doc||xa(n,t))&&tc(t,!0)});let s=[{stackItem:r[r.length-1],origin:e.origin,type:t?`redo`:`undo`,changedParentTypes:e.changedParentTypes},this];o?this.emit(`stack-item-added`,s):this.emit(`stack-item-updated`,s)},this.doc.on(`afterTransaction`,this.afterTransactionHandler),this.doc.on(`destroy`,()=>{this.destroy()})}addToScope(e){let t=new Set(this.scope);e=y(e)?e:[e],e.forEach(e=>{t.has(e)||(t.add(e),(e instanceof U?e.doc!==this.doc:e!==this.doc)&&Si(`[yjs#509] Not same Y.Doc`),this.scope.push(e))})}addTrackedOrigin(e){this.trackedOrigins.add(e)}removeTrackedOrigin(e){this.trackedOrigins.delete(e)}clear(e=!0,t=!0){(e&&this.canUndo()||t&&this.canRedo())&&this.doc.transact(n=>{e&&(this.undoStack.forEach(e=>$a(n,this,e)),this.undoStack=[]),t&&(this.redoStack.forEach(e=>$a(n,this,e)),this.redoStack=[]),this.emit(`stack-cleared`,[{undoStackCleared:e,redoStackCleared:t}])})}stopCapturing(){this.lastChange=0}undo(){this.undoing=!0;let e;try{e=eo(this,this.undoStack,`undo`)}finally{this.undoing=!1}return e}redo(){this.redoing=!0;let e;try{e=eo(this,this.redoStack,`redo`)}finally{this.redoing=!1}return e}canUndo(){return this.undoStack.length>0}canRedo(){return this.redoStack.length>0}destroy(){this.trackedOrigins.delete(this),this.doc.off(`afterTransaction`,this.afterTransactionHandler),super.destroy()}};function*no(e){let t=k(e.restDecoder);for(let n=0;n<t;n++){let t=k(e.restDecoder),n=e.readClient(),r=k(e.restDecoder);for(let i=0;i<t;i++){let t=e.readInfo();if(t===10){let t=k(e.restDecoder);yield new J(L(n,r),t),r+=t}else if(31&t){let i=(t&192)==0,a=new q(L(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,ac(e,t));yield a,r+=a.length}else{let t=e.readLen();yield new W(L(n,r),t),r+=t}}}}var ro=class{constructor(e,t){this.gen=no(e),this.curr=null,this.done=!1,this.filterSkips=t,this.next()}next(){do this.curr=this.gen.next().value||null;while(this.filterSkips&&this.curr!==null&&this.curr.constructor===J);return this.curr}},io=class{constructor(e){this.currClient=0,this.startClock=0,this.written=0,this.encoder=e,this.clientStructs=[]}},ao=e=>so(e,Ui,qi),oo=(e,t)=>{if(e.constructor===W){let{client:n,clock:r}=e.id;return new W(L(n,r+t),e.length-t)}else if(e.constructor===J){let{client:n,clock:r}=e.id;return new J(L(n,r+t),e.length-t)}else{let n=e,{client:r,clock:i}=n.id;return new q(L(r,i+t),null,L(r,i+t-1),null,n.rightOrigin,n.parent,n.parentSub,n.content.splice(t))}},so=(e,t=Gi,n=Yi)=>{if(e.length===1)return e[0];let r=e.map(e=>new t(Ft(e))),i=r.map(e=>new ro(e,!0)),a=null,o=new n,s=new io(o);for(;i=i.filter(e=>e.curr!==null),i.sort((e,t)=>{if(e.curr.id.client===t.curr.id.client){let n=e.curr.id.clock-t.curr.id.clock;return n===0?e.curr.constructor===t.curr.constructor?0:e.curr.constructor===J?1:-1:n}else return t.curr.id.client-e.curr.id.client}),i.length!==0;){let e=i[0],t=e.curr.id.client;if(a!==null){let n=e.curr,r=!1;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;if(n===null||n.id.client!==t||r&&n.id.clock>a.struct.id.clock+a.struct.length)continue;if(t!==a.struct.id.client)uo(s,a.struct,a.offset),a={struct:n,offset:0},e.next();else if(a.struct.id.clock+a.struct.length<n.id.clock)if(a.struct.constructor===J)a.struct.length=n.id.clock+n.length-a.struct.id.clock;else{uo(s,a.struct,a.offset);let e=n.id.clock-a.struct.id.clock-a.struct.length;a={struct:new J(L(t,a.struct.id.clock+a.struct.length),e),offset:0}}else{let t=a.struct.id.clock+a.struct.length-n.id.clock;t>0&&(a.struct.constructor===J?a.struct.length-=t:n=oo(n,t)),a.struct.mergeWith(n)||(uo(s,a.struct,a.offset),a={struct:n,offset:0},e.next())}}else a={struct:e.curr,offset:0},e.next();for(let n=e.curr;n!==null&&n.id.client===t&&n.id.clock===a.struct.id.clock+a.struct.length&&n.constructor!==J;n=e.next())uo(s,a.struct,a.offset),a={struct:n,offset:0}}return a!==null&&(uo(s,a.struct,a.offset),a=null),fo(s),Li(o,Ni(r.map(e=>Ri(e)))),o.toUint8Array()},co=(e,t,n=Gi,r=Yi)=>{let i=ca(t),a=new r,o=new io(a),s=new n(Ft(e)),c=new ro(s,!1);for(;c.curr;){let e=c.curr,t=e.id.client,n=i.get(t)||0;if(c.curr.constructor===J){c.next();continue}if(e.id.clock+e.length>n)for(uo(o,e,Ne(n-e.id.clock,0)),c.next();c.curr&&c.curr.id.client===t;)uo(o,c.curr,0),c.next();else for(;c.curr&&c.curr.id.client===t&&c.curr.id.clock+c.curr.length<=n;)c.next()}return fo(o),Li(a,Ri(s)),a.toUint8Array()},lo=e=>{e.written>0&&(e.clientStructs.push({written:e.written,restEncoder:x(e.encoder.restEncoder)}),e.encoder.restEncoder=lt(),e.written=0)},uo=(e,t,n)=>{e.written>0&&e.currClient!==t.id.client&&lo(e),e.written===0&&(e.currClient=t.id.client,e.encoder.writeClient(t.id.client),C(e.encoder.restEncoder,t.id.clock+n)),t.write(e.encoder,n),e.written++},fo=e=>{lo(e);let t=e.encoder.restEncoder;C(t,e.clientStructs.length);for(let n=0;n<e.clientStructs.length;n++){let r=e.clientStructs[n];C(t,r.written),vt(t,r.restEncoder)}},po=(e,t,n,r)=>{let i=new n(Ft(e)),a=new ro(i,!1),o=new r,s=new io(o);for(let e=a.curr;e!==null;e=a.next())uo(s,t(e),0);return fo(s),Li(o,Ri(i)),o.toUint8Array()},mo=e=>po(e,bn,Gi,qi),ho=`You must not compute changes after the event-handler fired.`,go=class{constructor(e,t){this.target=e,this.currentTarget=e,this.transaction=t,this._changes=null,this._keys=null,this._delta=null,this._path=null}get path(){return this._path||=_o(this.currentTarget,this.target)}deletes(e){return ji(this.transaction.deleteSet,e.id)}get keys(){if(this._keys===null){if(this.transaction.doc._transactionCleanups.length===0)throw T(ho);let e=new Map,t=this.target;this.transaction.changed.get(t).forEach(n=>{if(n!==null){let r=t._map.get(n),i,a;if(this.adds(r)){let e=r.left;for(;e!==null&&this.adds(e);)e=e.left;if(this.deletes(r))if(e!==null&&this.deletes(e))i=`delete`,a=we(e.content.getContent());else return;else e!==null&&this.deletes(e)?(i=`update`,a=we(e.content.getContent())):(i=`add`,a=void 0)}else if(this.deletes(r))i=`delete`,a=we(r.content.getContent());else return;e.set(n,{action:i,oldValue:a})}}),this._keys=e}return this._keys}get delta(){return this.changes.delta}adds(e){return e.id.clock>=(this.transaction.beforeState.get(e.id.client)||0)}get changes(){let e=this._changes;if(e===null){if(this.transaction.doc._transactionCleanups.length===0)throw T(ho);let t=this.target,n=_(),r=_(),i=[];if(e={added:n,deleted:r,delta:i,keys:this.keys},this.transaction.changed.get(t).has(null)){let e=null,a=()=>{e&&i.push(e)};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);e!==null&&e.retain===void 0&&a()}this._changes=e}return e}},_o=(e,t)=>{let n=[];for(;t._item!==null&&t!==e;){if(t._item.parentSub!==null)n.unshift(t._item.parentSub);else{let e=0,r=t._item.parent._start;for(;r!==t._item&&r!==null;)!r.deleted&&r.countable&&(e+=r.length),r=r.right;n.unshift(e)}t=t._item.parent}return n},H=()=>{Si(`Invalid access: Add Yjs type to a document before reading data.`)},vo=80,yo=0,bo=class{constructor(e,t){e.marker=!0,this.p=e,this.index=t,this.timestamp=yo++}},xo=e=>{e.timestamp=yo++},So=(e,t,n)=>{e.p.marker=!1,e.p=t,t.marker=!0,e.index=n,e.timestamp=yo++},Co=(e,t,n)=>{if(e.length>=vo){let r=e.reduce((e,t)=>e.timestamp<t.timestamp?e:t);return So(r,t,n),r}else{let r=new bo(t,n);return e.push(r),r}},wo=(e,t)=>{if(e._start===null||t===0||e._searchMarker===null)return null;let n=e._searchMarker.length===0?null:e._searchMarker.reduce((e,n)=>je(t-e.index)<je(t-n.index)?e:n),r=e._start,i=0;for(n!==null&&(r=n.p,i=n.index,xo(n));r.right!==null&&i<t;){if(!r.deleted&&r.countable){if(t<i+r.length)break;i+=r.length}r=r.right}for(;r.left!==null&&i>t;)r=r.left,!r.deleted&&r.countable&&(i-=r.length);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);return n!==null&&je(n.index-i)<r.parent.length/vo?(So(n,r,i),n):Co(e._searchMarker,r,i)},To=(e,t,n)=>{for(let r=e.length-1;r>=0;r--){let i=e[r];if(n>0){let t=i.p;for(t.marker=!1;t&&(t.deleted||!t.countable);)t=t.left,t&&!t.deleted&&t.countable&&(i.index-=t.length);if(t===null||t.marker===!0){e.splice(r,1);continue}i.p=t,t.marker=!0}(t<i.index||n>0&&t===i.index)&&(i.index=Ne(t,i.index+n))}},Eo=(e,t,n)=>{let r=e,i=t.changedParentTypes;for(;g(i,e,()=>[]).push(n),e._item!==null;)e=e._item.parent;_a(r._eH,n,t)},U=class{constructor(){this._item=null,this._map=new Map,this._start=null,this.doc=null,this._length=0,this._eH=ma(),this._dEH=ma(),this._searchMarker=null}get parent(){return this._item?this._item.parent:null}_integrate(e,t){this.doc=e,this._item=t}_copy(){throw E()}clone(){throw E()}_write(e){}get _first(){let e=this._start;for(;e!==null&&e.deleted;)e=e.right;return e}_callObserver(e,t){!e.local&&this._searchMarker&&(this._searchMarker.length=0)}observe(e){ha(this._eH,e)}observeDeep(e){ha(this._dEH,e)}unobserve(e){ga(this._eH,e)}unobserveDeep(e){ga(this._dEH,e)}toJSON(){}},Do=(e,t,n)=>{e.doc??H(),t<0&&(t=e._length+t),n<0&&(n=e._length+n);let r=n-t,i=[],a=e._start;for(;a!==null&&r>0;){if(a.countable&&!a.deleted){let e=a.content.getContent();if(e.length<=t)t-=e.length;else{for(let n=t;n<e.length&&r>0;n++)i.push(e[n]),r--;t=0}}a=a.right}return i},Oo=e=>{e.doc??H();let t=[],n=e._start;for(;n!==null;){if(n.countable&&!n.deleted){let e=n.content.getContent();for(let n=0;n<e.length;n++)t.push(e[n])}n=n.right}return t},ko=(e,t)=>{let n=[],r=e._start;for(;r!==null;){if(r.countable&&Fa(r,t)){let e=r.content.getContent();for(let t=0;t<e.length;t++)n.push(e[t])}r=r.right}return n},Ao=(e,t)=>{let n=0,r=e._start;for(e.doc??H();r!==null;){if(r.countable&&!r.deleted){let i=r.content.getContent();for(let r=0;r<i.length;r++)t(i[r],n++,e)}r=r.right}},jo=(e,t)=>{let n=[];return Ao(e,(r,i)=>{n.push(t(r,i,e))}),n},Mo=e=>{let t=e._start,n=null,r=0;return{[Symbol.iterator](){return this},next:()=>{if(n===null){for(;t!==null&&t.deleted;)t=t.right;if(t===null)return{done:!0,value:void 0};n=t.content.getContent(),r=0,t=t.right}let e=n[r++];return n.length<=r&&(n=null),{done:!1,value:e}}}},No=(e,t)=>{e.doc??H();let n=wo(e,t),r=e._start;for(n!==null&&(r=n.p,t-=n.index);r!==null;r=r.right)if(!r.deleted&&r.countable){if(t<r.length)return r.content.getContent()[t];t-=r.length}},Po=(e,t,n,r)=>{let i=n,a=e.doc,o=a.clientID,s=a.store,c=n===null?t._start:n.right,l=[],u=()=>{l.length>0&&(i=new q(L(o,R(s,o)),i,i&&i.lastId,c,c&&c.id,t,null,new Vs(l)),i.integrate(e,0),l=[])};r.forEach(n=>{if(n===null)l.push(n);else switch(n.constructor){case Number:case Object:case Boolean:case Array:case String:l.push(n);break;default:switch(u(),n.constructor){case Uint8Array:case ArrayBuffer:i=new q(L(o,R(s,o)),i,i&&i.lastId,c,c&&c.id,t,null,new Os(new Uint8Array(n))),i.integrate(e,0);break;case Vi:i=new q(L(o,R(s,o)),i,i&&i.lastId,c,c&&c.id,t,null,new Ns(n)),i.integrate(e,0);break;default:if(n instanceof U)i=new q(L(o,R(s,o)),i,i&&i.lastId,c,c&&c.id,t,null,new K(n)),i.integrate(e,0);else throw Error(`Unexpected content type in insert operation`)}}}),u()},Fo=()=>T(`Length exceeded!`),Io=(e,t,n,r)=>{if(n>t._length)throw Fo();if(n===0)return t._searchMarker&&To(t._searchMarker,n,r.length),Po(e,t,null,r);let i=n,a=wo(t,n),o=t._start;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){if(n<=o.length){n<o.length&&B(e,L(o.id.client,o.id.clock+n));break}n-=o.length}return t._searchMarker&&To(t._searchMarker,i,r.length),Po(e,t,o,r)},Lo=(e,t,n)=>{let r=(t._searchMarker||[]).reduce((e,t)=>t.index>e.index?t:e,{index:0,p:t._start}).p;if(r)for(;r.right;)r=r.right;return Po(e,t,r,n)},Ro=(e,t,n,r)=>{if(r===0)return;let i=n,a=r,o=wo(t,n),s=t._start;for(o!==null&&(s=o.p,n-=o.index);s!==null&&n>0;s=s.right)!s.deleted&&s.countable&&(n<s.length&&B(e,L(s.id.client,s.id.clock+n)),n-=s.length);for(;r>0&&s!==null;)s.deleted||(r<s.length&&B(e,L(s.id.client,s.id.clock+r)),s.delete(e),r-=s.length),s=s.right;if(r>0)throw Fo();t._searchMarker&&To(t._searchMarker,i,-a+r)},zo=(e,t,n)=>{let r=t._map.get(n);r!==void 0&&r.delete(e)},Bo=(e,t,n,r)=>{let i=t._map.get(n)||null,a=e.doc,o=a.clientID,s;if(r==null)s=new Vs([r]);else switch(r.constructor){case Number:case Object:case Boolean:case Array:case String:case Date:case BigInt:s=new Vs([r]);break;case Uint8Array:s=new Os(r);break;case Vi:s=new Ns(r);break;default:if(r instanceof U)s=new K(r);else throw Error(`Unexpected content type`)}new q(L(o,R(a.store,o)),i,i&&i.lastId,null,null,t,n,s).integrate(e,0)},Vo=(e,t)=>{e.doc??H();let n=e._map.get(t);return n!==void 0&&!n.deleted?n.content.getContent()[n.length-1]:void 0},Ho=e=>{let t={};return e.doc??H(),e._map.forEach((e,n)=>{e.deleted||(t[n]=e.content.getContent()[e.length-1])}),t},Uo=(e,t)=>{e.doc??H();let n=e._map.get(t);return n!==void 0&&!n.deleted},Wo=(e,t)=>{let n={};return e._map.forEach((e,r)=>{let i=e;for(;i!==null&&(!t.sv.has(i.id.client)||i.id.clock>=(t.sv.get(i.id.client)||0));)i=i.left;i!==null&&Fa(i,t)&&(n[r]=i.content.getContent()[i.length-1])}),n},Go=e=>(e.doc??H(),Ti(e._map.entries(),e=>!e[1].deleted)),Ko=class extends go{},qo=class e extends U{constructor(){super(),this._prelimContent=[],this._searchMarker=[]}static from(t){let n=new e;return n.push(t),n}_integrate(e,t){super._integrate(e,t),this.insert(0,this._prelimContent),this._prelimContent=null}_copy(){return new e}clone(){let t=new e;return t.insert(0,this.toArray().map(e=>e instanceof U?e.clone():e)),t}get length(){return this.doc??H(),this._length}_callObserver(e,t){super._callObserver(e,t),Eo(this,e,new Ko(this,e))}insert(e,t){this.doc===null?this._prelimContent.splice(e,0,...t):V(this.doc,n=>{Io(n,this,e,t)})}push(e){this.doc===null?this._prelimContent.push(...e):V(this.doc,t=>{Lo(t,this,e)})}unshift(e){this.insert(0,e)}delete(e,t=1){this.doc===null?this._prelimContent.splice(e,t):V(this.doc,n=>{Ro(n,this,e,t)})}get(e){return No(this,e)}toArray(){return Oo(this)}slice(e=0,t=this.length){return Do(this,e,t)}toJSON(){return this.map(e=>e instanceof U?e.toJSON():e)}map(e){return jo(this,e)}forEach(e){Ao(this,e)}[Symbol.iterator](){return Mo(this)}_write(e){e.writeTypeRef(Ks)}},Jo=e=>new qo,Yo=class extends go{constructor(e,t,n){super(e,t),this.keysChanged=n}},Xo=class e extends U{constructor(e){super(),this._prelimContent=null,e===void 0?this._prelimContent=new Map:this._prelimContent=new Map(e)}_integrate(e,t){super._integrate(e,t),this._prelimContent.forEach((e,t)=>{this.set(t,e)}),this._prelimContent=null}_copy(){return new e}clone(){let t=new e;return this.forEach((e,n)=>{t.set(n,e instanceof U?e.clone():e)}),t}_callObserver(e,t){Eo(this,e,new Yo(this,e,t))}toJSON(){this.doc??H();let e={};return this._map.forEach((t,n)=>{if(!t.deleted){let r=t.content.getContent()[t.length-1];e[n]=r instanceof U?r.toJSON():r}}),e}get size(){return[...Go(this)].length}keys(){return Ei(Go(this),e=>e[0])}values(){return Ei(Go(this),e=>e[1].content.getContent()[e[1].length-1])}entries(){return Ei(Go(this),e=>[e[0],e[1].content.getContent()[e[1].length-1]])}forEach(e){this.doc??H(),this._map.forEach((t,n)=>{t.deleted||e(t.content.getContent()[t.length-1],n,this)})}[Symbol.iterator](){return this.entries()}delete(e){this.doc===null?this._prelimContent.delete(e):V(this.doc,t=>{zo(t,this,e)})}set(e,t){return this.doc===null?this._prelimContent.set(e,t):V(this.doc,n=>{Bo(n,this,e,t)}),t}get(e){return Vo(this,e)}has(e){return Uo(this,e)}clear(){this.doc===null?this._prelimContent.clear():V(this.doc,e=>{this.forEach(function(t,n,r){zo(e,r,n)})})}_write(e){e.writeTypeRef(qs)}},Zo=e=>new Xo,Qo=(e,t)=>e===t||typeof e==`object`&&typeof t==`object`&&e&&t&&gn(e,t),$o=class{constructor(e,t,n,r){this.left=e,this.right=t,this.index=n,this.currentAttributes=r}forward(){switch(this.right===null&&D(),this.right.content.constructor){case G:this.right.deleted||rs(this.currentAttributes,this.right.content);break;default:this.right.deleted||(this.index+=this.right.length);break}this.left=this.right,this.right=this.right.right}},es=(e,t,n)=>{for(;t.right!==null&&n>0;){switch(t.right.content.constructor){case G:t.right.deleted||rs(t.currentAttributes,t.right.content);break;default:t.right.deleted||(n<t.right.length&&B(e,L(t.right.id.client,t.right.id.clock+n)),t.index+=t.right.length,n-=t.right.length);break}t.left=t.right,t.right=t.right.right}return t},ts=(e,t,n,r)=>{let i=new Map,a=r?wo(t,n):null;return a?es(e,new $o(a.p.left,a.p,a.index,i),n-a.index):es(e,new $o(null,t._start,0,i),n)},ns=(e,t,n,r)=>{for(;n.right!==null&&(n.right.deleted===!0||n.right.content.constructor===G&&Qo(r.get(n.right.content.key),n.right.content.value));)n.right.deleted||r.delete(n.right.content.key),n.forward();let i=e.doc,a=i.clientID;r.forEach((r,o)=>{let s=n.left,c=n.right,l=new q(L(a,R(i.store,a)),s,s&&s.lastId,c,c&&c.id,t,null,new G(o,r));l.integrate(e,0),n.right=l,n.forward()})},rs=(e,t)=>{let{key:n,value:r}=t;r===null?e.delete(n):e.set(n,r)},is=(e,t)=>{for(;e.right!==null&&(e.right.deleted||e.right.content.constructor===G&&Qo(t[e.right.content.key]??null,e.right.content.value));)e.forward()},as=(e,t,n,r)=>{let i=e.doc,a=i.clientID,o=new Map;for(let s in r){let c=r[s],l=n.currentAttributes.get(s)??null;if(!Qo(l,c)){o.set(s,l);let{left:r,right:u}=n;n.right=new q(L(a,R(i.store,a)),r,r&&r.lastId,u,u&&u.id,t,null,new G(s,c)),n.right.integrate(e,0),n.forward()}}return o},os=(e,t,n,r,i)=>{n.currentAttributes.forEach((e,t)=>{i[t]===void 0&&(i[t]=null)});let a=e.doc,o=a.clientID;is(n,i);let s=as(e,t,n,i),c=r.constructor===String?new Us(r):r instanceof U?new K(r):new Fs(r),{left:l,right:u,index:d}=n;t._searchMarker&&To(t._searchMarker,n.index,c.getLength()),u=new q(L(o,R(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(),ns(e,t,n,s)},ss=(e,t,n,r,i)=>{let a=e.doc,o=a.clientID;is(n,i);let s=as(e,t,n,i);iterationLoop:for(;n.right!==null&&(r>0||s.size>0&&(n.right.deleted||n.right.content.constructor===G));){if(!n.right.deleted)switch(n.right.content.constructor){case G:{let{key:t,value:a}=n.right.content,o=i[t];if(o!==void 0){if(Qo(o,a))s.delete(t);else{if(r===0)break iterationLoop;s.set(t,a)}n.right.delete(e)}else n.currentAttributes.set(t,a);break}default:r<n.right.length&&B(e,L(n.right.id.client,n.right.id.clock+r)),r-=n.right.length;break}n.forward()}if(r>0){let i=``;for(;r>0;r--)i+=`
4
+ `;n.right=new q(L(o,R(a.store,o)),n.left,n.left&&n.left.lastId,n.right,n.right&&n.right.id,t,null,new Us(i)),n.right.integrate(e,0),n.forward()}ns(e,t,n,s)},cs=(e,t,n,r,i)=>{let a=t,o=h();for(;a&&(!a.countable||a.deleted);){if(!a.deleted&&a.content.constructor===G){let e=a.content;o.set(e.key,e)}a=a.right}let s=0,c=!1;for(;t!==a;){if(n===t&&(c=!0),!t.deleted){let n=t.content;switch(n.constructor){case G:{let{key:a,value:l}=n,u=r.get(a)??null;(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&&rs(i,n);break}}}t=t.right}return s},ls=(e,t)=>{for(;t&&t.right&&(t.right.deleted||!t.right.countable);)t=t.right;let n=new Set;for(;t&&(t.deleted||!t.countable);){if(!t.deleted&&t.content.constructor===G){let r=t.content.key;n.has(r)?t.delete(e):n.add(r)}t=t.left}},us=e=>{let t=0;return V(e.doc,n=>{let r=e._start,i=e._start,a=h(),o=xe(a);for(;i;){if(i.deleted===!1)switch(i.content.constructor){case G:rs(o,i.content);break;default:t+=cs(n,r,i,a,o),a=xe(o),r=i;break}i=i.right}}),t},ds=e=>{let t=new Set,n=e.doc;for(let[r,i]of e.afterState.entries()){let a=e.beforeState.get(r)||0;i!==a&&Wa(e,n.store.clients.get(r),a,i,e=>{!e.deleted&&e.content.constructor===G&&e.constructor!==W&&t.add(e.parent)})}V(n,n=>{ki(e,e.deleteSet,e=>{if(e instanceof W||!e.parent._hasFormatting||t.has(e.parent))return;let r=e.parent;e.content.constructor===G?t.add(r):ls(n,e)});for(let e of t)us(e)})},fs=(e,t,n)=>{let r=n,i=xe(t.currentAttributes),a=t.right;for(;n>0&&t.right!==null;){if(t.right.deleted===!1)switch(t.right.content.constructor){case K:case Fs:case Us:n<t.right.length&&B(e,L(t.right.id.client,t.right.id.clock+n)),n-=t.right.length,t.right.delete(e);break}t.forward()}a&&cs(e,a,t.right,i,t.currentAttributes);let o=(t.left||t.right).parent;return o._searchMarker&&To(o._searchMarker,t.index,-r+n),t},ps=class extends go{constructor(e,t,n){super(e,t),this.childListChanged=!1,this.keysChanged=new Set,n.forEach(e=>{e===null?this.childListChanged=!0:this.keysChanged.add(e)})}get changes(){return this._changes===null&&(this._changes={keys:this.keys,delta:this.delta,added:new Set,deleted:new Set}),this._changes}get delta(){if(this._delta===null){let e=this.target.doc,t=[];V(e,e=>{let n=new Map,r=new Map,i=this.target._start,a=null,o={},s=``,c=0,l=0,u=()=>{if(a!==null){let e=null;switch(a){case`delete`:l>0&&(e={delete:l}),l=0;break;case`insert`:(typeof s==`object`||s.length>0)&&(e={insert:s},n.size>0&&(e.attributes={},n.forEach((t,n)=>{t!==null&&(e.attributes[n]=t)}))),s=``;break;case`retain`:c>0&&(e={retain:c},pn(o)||(e.attributes=ln({},o))),c=0;break}e&&t.push(e),a=null}};for(;i!==null;){switch(i.content.constructor){case K:case Fs: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);break;case Us: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);break;case G:{let{key:t,value:s}=i.content;if(this.adds(i))this.deletes(i)||(Qo(n.get(t)??null,s)?s!==null&&i.delete(e):(a===`retain`&&u(),Qo(s,r.get(t)??null)?delete o[t]:o[t]=s));else if(this.deletes(i)){r.set(t,s);let e=n.get(t)??null;Qo(e,s)||(a===`retain`&&u(),o[t]=e)}else if(!i.deleted){r.set(t,s);let n=o[t];n!==void 0&&(Qo(n,s)?n!==null&&i.delete(e):(a===`retain`&&u(),s===null?delete o[t]:o[t]=s))}i.deleted||(a===`insert`&&u(),rs(n,i.content));break}}i=i.right}for(u();t.length>0;){let e=t[t.length-1];if(e.retain!==void 0&&e.attributes===void 0)t.pop();else break}}),this._delta=t}return this._delta}},ms=class e extends U{constructor(e){super(),this._pending=e===void 0?[]:[()=>this.insert(0,e)],this._searchMarker=[],this._hasFormatting=!1}get length(){return this.doc??H(),this._length}_integrate(e,t){super._integrate(e,t);try{this._pending.forEach(e=>e())}catch(e){console.error(e)}this._pending=null}_copy(){return new e}clone(){let t=new e;return t.applyDelta(this.toDelta()),t}_callObserver(e,t){super._callObserver(e,t);let n=new ps(this,e,t);Eo(this,e,n),!e.local&&this._hasFormatting&&(e._needFormattingCleanup=!0)}toString(){this.doc??H();let e=``,t=this._start;for(;t!==null;)!t.deleted&&t.countable&&t.content.constructor===Us&&(e+=t.content.str),t=t.right;return e}toJSON(){return this.toString()}applyDelta(e,{sanitize:t=!0}={}){this.doc===null?this._pending.push(()=>this.applyDelta(e)):V(this.doc,n=>{let r=new $o(null,this._start,0,new Map);for(let i=0;i<e.length;i++){let a=e[i];if(a.insert!==void 0){let o=!t&&typeof a.insert==`string`&&i===e.length-1&&r.right===null&&a.insert.slice(-1)===`
5
+ `?a.insert.slice(0,-1):a.insert;(typeof o!=`string`||o.length>0)&&os(n,this,r,o,a.attributes||{})}else a.retain===void 0?a.delete!==void 0&&fs(n,r,a.delete):ss(n,this,r,a.retain,a.attributes||{})}})}toDelta(e,t,n){this.doc??H();let r=[],i=new Map,a=this.doc,o=``,s=this._start;function c(){if(o.length>0){let e={},t=!1;i.forEach((n,r)=>{t=!0,e[r]=n});let n={insert:o};t&&(n.attributes=e),r.push(n),o=``}}let l=()=>{for(;s!==null;){if(Fa(s,e)||t!==void 0&&Fa(s,t))switch(s.content.constructor){case Us:{let r=i.get(`ychange`);e!==void 0&&!Fa(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&&!Fa(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;break}case K:case Fs:{c();let e={insert:s.content.getContent()[0]};if(i.size>0){let t={};e.attributes=t,i.forEach((e,n)=>{t[n]=e})}r.push(e);break}case G:Fa(s,e)&&(c(),rs(i,s.content));break}s=s.right}c()};return e||t?V(a,n=>{e&&Ia(n,e),t&&Ia(n,t),l()},`cleanup`):l(),r}insert(e,t,n){if(t.length<=0)return;let r=this.doc;r===null?this._pending.push(()=>this.insert(e,t,n)):V(r,r=>{let i=ts(r,this,e,!n);n||(n={},i.currentAttributes.forEach((e,t)=>{n[t]=e})),os(r,this,i,t,n)})}insertEmbed(e,t,n){let r=this.doc;r===null?this._pending.push(()=>this.insertEmbed(e,t,n||{})):V(r,r=>{let i=ts(r,this,e,!n);os(r,this,i,t,n||{})})}delete(e,t){if(t===0)return;let n=this.doc;n===null?this._pending.push(()=>this.delete(e,t)):V(n,n=>{fs(n,ts(n,this,e,!0),t)})}format(e,t,n){if(t===0)return;let r=this.doc;r===null?this._pending.push(()=>this.format(e,t,n)):V(r,r=>{let i=ts(r,this,e,!1);i.right!==null&&ss(r,this,i,t,n)})}removeAttribute(e){this.doc===null?this._pending.push(()=>this.removeAttribute(e)):V(this.doc,t=>{zo(t,this,e)})}setAttribute(e,t){this.doc===null?this._pending.push(()=>this.setAttribute(e,t)):V(this.doc,n=>{Bo(n,this,e,t)})}getAttribute(e){return Vo(this,e)}getAttributes(){return Ho(this)}_write(e){e.writeTypeRef(Js)}},hs=e=>new ms,gs=class{constructor(e,t=()=>!0){this._filter=t,this._root=e,this._currentNode=e._start,this._firstCall=!0,e.doc??H()}[Symbol.iterator](){return this}next(){let e=this._currentNode,t=e&&e.content&&e.content.type;if(e!==null&&(!this._firstCall||e.deleted||!this._filter(t)))do if(t=e.content.type,!e.deleted&&(t.constructor===ys||t.constructor===_s)&&t._start!==null)e=t._start;else for(;e!==null;){let t=e.next;if(t!==null){e=t;break}else e=e.parent===this._root?null:e.parent._item}while(e!==null&&(e.deleted||!this._filter(e.content.type)));return this._firstCall=!1,e===null?{value:void 0,done:!0}:(this._currentNode=e,{value:e.content.type,done:!1})}},_s=class e extends U{constructor(){super(),this._prelimContent=[]}get firstChild(){let e=this._first;return e?e.content.getContent()[0]:null}_integrate(e,t){super._integrate(e,t),this.insert(0,this._prelimContent),this._prelimContent=null}_copy(){return new e}clone(){let t=new e;return t.insert(0,this.toArray().map(e=>e instanceof U?e.clone():e)),t}get length(){return this.doc??H(),this._prelimContent===null?this._length:this._prelimContent.length}createTreeWalker(e){return new gs(this,e)}querySelector(e){e=e.toUpperCase();let t=new gs(this,t=>t.nodeName&&t.nodeName.toUpperCase()===e).next();return t.done?null:t.value}querySelectorAll(e){return e=e.toUpperCase(),v(new gs(this,t=>t.nodeName&&t.nodeName.toUpperCase()===e))}_callObserver(e,t){Eo(this,e,new xs(this,t,e))}toString(){return jo(this,e=>e.toString()).join(``)}toJSON(){return this.toString()}toDOM(e=document,t={},n){let r=e.createDocumentFragment();return n!==void 0&&n._createAssociation(r,this),Ao(this,i=>{r.insertBefore(i.toDOM(e,t,n),null)}),r}insert(e,t){this.doc===null?this._prelimContent.splice(e,0,...t):V(this.doc,n=>{Io(n,this,e,t)})}insertAfter(e,t){if(this.doc!==null)V(this.doc,n=>{let r=e&&e instanceof U?e._item:e;Po(n,this,r,t)});else{let n=this._prelimContent,r=e===null?0:n.findIndex(t=>t===e)+1;if(r===0&&e!==null)throw T(`Reference item not found`);n.splice(r,0,...t)}}delete(e,t=1){this.doc===null?this._prelimContent.splice(e,t):V(this.doc,n=>{Ro(n,this,e,t)})}toArray(){return Oo(this)}push(e){this.insert(this.length,e)}unshift(e){this.insert(0,e)}get(e){return No(this,e)}slice(e=0,t=this.length){return Do(this,e,t)}forEach(e){Ao(this,e)}_write(e){e.writeTypeRef(Xs)}},vs=e=>new _s,ys=class e extends _s{constructor(e=`UNDEFINED`){super(),this.nodeName=e,this._prelimAttrs=new Map}get nextSibling(){let e=this._item?this._item.next:null;return e?e.content.type:null}get prevSibling(){let e=this._item?this._item.prev:null;return e?e.content.type:null}_integrate(e,t){super._integrate(e,t),this._prelimAttrs.forEach((e,t)=>{this.setAttribute(t,e)}),this._prelimAttrs=null}_copy(){return new e(this.nodeName)}clone(){let t=new e(this.nodeName);return dn(this.getAttributes(),(e,n)=>{t.setAttribute(n,e)}),t.insert(0,this.toArray().map(e=>e instanceof U?e.clone():e)),t}toString(){let e=this.getAttributes(),t=[],n=[];for(let t in e)n.push(t);n.sort();let r=n.length;for(let i=0;i<r;i++){let r=n[i];t.push(r+`="`+e[r]+`"`)}let i=this.nodeName.toLocaleLowerCase();return`<${i}${t.length>0?` `+t.join(` `):``}>${super.toString()}</${i}>`}removeAttribute(e){this.doc===null?this._prelimAttrs.delete(e):V(this.doc,t=>{zo(t,this,e)})}setAttribute(e,t){this.doc===null?this._prelimAttrs.set(e,t):V(this.doc,n=>{Bo(n,this,e,t)})}getAttribute(e){return Vo(this,e)}hasAttribute(e){return Uo(this,e)}getAttributes(e){return e?Wo(this,e):Ho(this)}toDOM(e=document,t={},n){let r=e.createElement(this.nodeName),i=this.getAttributes();for(let e in i){let t=i[e];typeof t==`string`&&r.setAttribute(e,t)}return Ao(this,i=>{r.appendChild(i.toDOM(e,t,n))}),n!==void 0&&n._createAssociation(r,this),r}_write(e){e.writeTypeRef(Ys),e.writeKey(this.nodeName)}},bs=e=>new ys(e.readKey()),xs=class extends go{constructor(e,t,n){super(e,n),this.childListChanged=!1,this.attributesChanged=new Set,t.forEach(e=>{e===null?this.childListChanged=!0:this.attributesChanged.add(e)})}},Ss=class e extends Xo{constructor(e){super(),this.hookName=e}_copy(){return new e(this.hookName)}clone(){let t=new e(this.hookName);return this.forEach((e,n)=>{t.set(n,e)}),t}toDOM(e=document,t={},n){let r=t[this.hookName],i;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}_write(e){e.writeTypeRef(Zs),e.writeKey(this.hookName)}},Cs=e=>new Ss(e.readKey()),ws=class e extends ms{get nextSibling(){let e=this._item?this._item.next:null;return e?e.content.type:null}get prevSibling(){let e=this._item?this._item.prev:null;return e?e.content.type:null}_copy(){return new e}clone(){let t=new e;return t.applyDelta(this.toDelta()),t}toDOM(e=document,t,n){let r=e.createTextNode(this.toString());return n!==void 0&&n._createAssociation(r,this),r}toString(){return this.toDelta().map(e=>{let t=[];for(let n in e.attributes){let r=[];for(let t in e.attributes[n])r.push({key:t,value:e.attributes[n][t]});r.sort((e,t)=>e.key<t.key?-1:1),t.push({nodeName:n,attrs:r})}t.sort((e,t)=>e.nodeName<t.nodeName?-1:1);let n=``;for(let e=0;e<t.length;e++){let r=t[e];n+=`<${r.nodeName}`;for(let e=0;e<r.attrs.length;e++){let t=r.attrs[e];n+=` ${t.key}="${t.value}"`}n+=`>`}n+=e.insert;for(let e=t.length-1;e>=0;e--)n+=`</${t[e].nodeName}>`;return n}).join(``)}toJSON(){return this.toString()}_write(e){e.writeTypeRef(Qs)}},Ts=e=>new ws,Es=class{constructor(e,t){this.id=e,this.length=t}get deleted(){throw E()}mergeWith(e){return!1}write(e,t,n){throw E()}integrate(e,t){throw E()}},Ds=0,W=class extends Es{get deleted(){return!0}delete(){}mergeWith(e){return this.constructor===e.constructor?(this.length+=e.length,!0):!1}integrate(e,t){t>0&&(this.id.clock+=t,this.length-=t),za(e.doc.store,this)}write(e,t){e.writeInfo(Ds),e.writeLen(this.length-t)}getMissing(e,t){return null}},Os=class e{constructor(e){this.content=e}getLength(){return 1}getContent(){return[this.content]}isCountable(){return!0}copy(){return new e(this.content)}splice(e){throw E()}mergeWith(e){return!1}integrate(e,t){}delete(e){}gc(e){}write(e,t){e.writeBuf(this.content)}getRef(){return 3}},ks=e=>new Os(e.readBuf()),As=class e{constructor(e){this.len=e}getLength(){return this.len}getContent(){return[]}isCountable(){return!1}copy(){return new e(this.len)}splice(t){let n=new e(this.len-t);return this.len=t,n}mergeWith(e){return this.len+=e.len,!0}integrate(e,t){Pi(e.deleteSet,t.id.client,t.id.clock,this.len),t.markDeleted()}delete(e){}gc(e){}write(e,t){e.writeLen(this.len-t)}getRef(){return 1}},js=e=>new As(e.readLen()),Ms=(e,t)=>new Vi({guid:e,...t,shouldLoad:t.shouldLoad||t.autoLoad||!1}),Ns=class e{constructor(e){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;let t={};this.opts=t,e.gc||(t.gc=!1),e.autoLoad&&(t.autoLoad=!0),e.meta!==null&&(t.meta=e.meta)}getLength(){return 1}getContent(){return[this.doc]}isCountable(){return!0}copy(){return new e(Ms(this.doc.guid,this.opts))}splice(e){throw E()}mergeWith(e){return!1}integrate(e,t){this.doc._item=t,e.subdocsAdded.add(this.doc),this.doc.shouldLoad&&e.subdocsLoaded.add(this.doc)}delete(e){e.subdocsAdded.has(this.doc)?e.subdocsAdded.delete(this.doc):e.subdocsRemoved.add(this.doc)}gc(e){}write(e,t){e.writeString(this.doc.guid),e.writeAny(this.opts)}getRef(){return 9}},Ps=e=>new Ns(Ms(e.readString(),e.readAny())),Fs=class e{constructor(e){this.embed=e}getLength(){return 1}getContent(){return[this.embed]}isCountable(){return!0}copy(){return new e(this.embed)}splice(e){throw E()}mergeWith(e){return!1}integrate(e,t){}delete(e){}gc(e){}write(e,t){e.writeJSON(this.embed)}getRef(){return 5}},Is=e=>new Fs(e.readJSON()),G=class e{constructor(e,t){this.key=e,this.value=t}getLength(){return 1}getContent(){return[]}isCountable(){return!1}copy(){return new e(this.key,this.value)}splice(e){throw E()}mergeWith(e){return!1}integrate(e,t){let n=t.parent;n._searchMarker=null,n._hasFormatting=!0}delete(e){}gc(e){}write(e,t){e.writeKey(this.key),e.writeJSON(this.value)}getRef(){return 6}},Ls=e=>new G(e.readKey(),e.readJSON()),Rs=class e{constructor(e){this.arr=e}getLength(){return this.arr.length}getContent(){return this.arr}isCountable(){return!0}copy(){return new e(this.arr)}splice(t){let n=new e(this.arr.slice(t));return this.arr=this.arr.slice(0,t),n}mergeWith(e){return this.arr=this.arr.concat(e.arr),!0}integrate(e,t){}delete(e){}gc(e){}write(e,t){let n=this.arr.length;e.writeLen(n-t);for(let r=t;r<n;r++){let t=this.arr[r];e.writeString(t===void 0?`undefined`:JSON.stringify(t))}}getRef(){return 2}},zs=e=>{let t=e.readLen(),n=[];for(let r=0;r<t;r++){let t=e.readString();t===`undefined`?n.push(void 0):n.push(JSON.parse(t))}return new Rs(n)},Bs=On(`node_env`)===`development`,Vs=class e{constructor(e){this.arr=e,Bs&&vn(e)}getLength(){return this.arr.length}getContent(){return this.arr}isCountable(){return!0}copy(){return new e(this.arr)}splice(t){let n=new e(this.arr.slice(t));return this.arr=this.arr.slice(0,t),n}mergeWith(e){return this.arr=this.arr.concat(e.arr),!0}integrate(e,t){}delete(e){}gc(e){}write(e,t){let n=this.arr.length;e.writeLen(n-t);for(let r=t;r<n;r++){let t=this.arr[r];e.writeAny(t)}}getRef(){return 8}},Hs=e=>{let t=e.readLen(),n=[];for(let r=0;r<t;r++)n.push(e.readAny());return new Vs(n)},Us=class e{constructor(e){this.str=e}getLength(){return this.str.length}getContent(){return this.str.split(``)}isCountable(){return!0}copy(){return new e(this.str)}splice(t){let n=new e(this.str.slice(t));this.str=this.str.slice(0,t);let r=this.str.charCodeAt(t-1);return r>=55296&&r<=56319&&(this.str=this.str.slice(0,t-1)+`�`,n.str=`�`+n.str.slice(1)),n}mergeWith(e){return this.str+=e.str,!0}integrate(e,t){}delete(e){}gc(e){}write(e,t){e.writeString(t===0?this.str:this.str.slice(t))}getRef(){return 4}},Ws=e=>new Us(e.readString()),Gs=[Jo,Zo,hs,bs,vs,Cs,Ts],Ks=0,qs=1,Js=2,Ys=3,Xs=4,Zs=5,Qs=6,K=class e{constructor(e){this.type=e}getLength(){return 1}getContent(){return[this.type]}isCountable(){return!0}copy(){return new e(this.type._copy())}splice(e){throw E()}mergeWith(e){return!1}integrate(e,t){this.type._integrate(e.doc,t)}delete(e){let t=this.type._start;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;this.type._map.forEach(t=>{t.deleted?t.id.clock<(e.beforeState.get(t.id.client)||0)&&e._mergeStructs.push(t):t.delete(e)}),e.changed.delete(this.type)}gc(e){let t=this.type._start;for(;t!==null;)t.gc(e,!0),t=t.right;this.type._start=null,this.type._map.forEach(t=>{for(;t!==null;)t.gc(e,!0),t=t.left}),this.type._map=new Map}write(e,t){this.type._write(e)}getRef(){return 7}},$s=e=>new K(Gs[e.readTypeRef()](e)),ec=(e,t)=>{let n=t,r=0,i;do r>0&&(n=L(n.client,n.clock+r)),i=Ba(e,n),r=n.clock-i.id.clock,n=i.redone;while(n!==null&&i instanceof q);return{item:i,diff:r}},tc=(e,t)=>{for(;e!==null&&e.keep!==t;)e.keep=t,e=e.parent._item},nc=(e,t,n)=>{let{client:r,clock:i}=t.id,a=new q(L(r,i+n),t,L(r,i+n-1),t.right,t.rightOrigin,t.parent,t.parentSub,t.content.splice(n));return t.deleted&&a.markDeleted(),t.keep&&(a.keep=!0),t.redone!==null&&(a.redone=L(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},rc=(e,t)=>De(e,e=>ji(e.deletions,t)),ic=(e,t,n,r,i,a)=>{let o=e.doc,s=o.store,c=o.clientID,l=t.redone;if(l!==null)return B(e,l);let u=t.parent._item,d=null,f;if(u!==null&&u.deleted===!0){if(u.redone===null&&(!n.has(u)||ic(e,u,n,r,i,a)===null))return null;for(;u.redone!==null;)u=B(e,u.redone)}let ee=u===null?t.parent:u.content.type;if(t.parentSub===null){for(d=t.left,f=t;d!==null;){let t=d;for(;t!==null&&t.parent._item!==u;)t=t.redone===null?null:B(e,t.redone);if(t!==null&&t.parent._item===u){d=t;break}d=d.left}for(;f!==null;){let t=f;for(;t!==null&&t.parent._item!==u;)t=t.redone===null?null:B(e,t.redone);if(t!==null&&t.parent._item===u){f=t;break}f=f.right}}else{if(f=null,t.right&&!i){for(d=t;d!==null&&d.right!==null&&(d.right.redone||ji(r,d.right.id)||rc(a.undoStack,d.right.id)||rc(a.redoStack,d.right.id));)for(d=d.right;d.redone;)d=B(e,d.redone);if(d&&d.right!==null)return null}else d=ee._map.get(t.parentSub)||null;d!==null&&d.parent._item!==u&&(d=ee._map.get(t.parentSub)||null)}let te=L(c,R(s,c)),ne=new q(te,d,d&&d.lastId,f,f&&f.id,ee,t.parentSub,t.content.copy());return t.redone=te,tc(ne,!0),ne.integrate(e,0),ne},q=class e extends Es{constructor(e,t,n,r,i,a,o,s){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}set marker(e){(this.info&8)>0!==e&&(this.info^=8)}get marker(){return(this.info&8)>0}get keep(){return(this.info&1)>0}set keep(e){this.keep!==e&&(this.info^=1)}get countable(){return(this.info&2)>0}get deleted(){return(this.info&4)>0}set deleted(e){this.deleted!==e&&(this.info^=4)}markDeleted(){this.info|=4}getMissing(t,n){if(this.origin&&this.origin.client!==this.id.client&&this.origin.clock>=R(n,this.origin.client))return this.origin.client;if(this.rightOrigin&&this.rightOrigin.client!==this.id.client&&this.rightOrigin.clock>=R(n,this.rightOrigin.client))return this.rightOrigin.client;if(this.parent&&this.parent.constructor===va&&this.id.client!==this.parent.client&&this.parent.clock>=R(n,this.parent.client))return this.parent.client;if(this.origin&&=(this.left=Ha(t,n,this.origin),this.left.lastId),this.rightOrigin&&=(this.right=B(t,this.rightOrigin),this.right.id),this.left&&this.left.constructor===W||this.right&&this.right.constructor===W)this.parent=null;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);else if(this.parent.constructor===va){let e=Ba(n,this.parent);e.constructor===W?this.parent=null:this.parent=e.content.type}return null}integrate(e,t){if(t>0&&(this.id.clock+=t,this.left=Ha(e,e.doc.store,L(this.id.client,this.id.clock-1)),this.origin=this.left.lastId,this.content=this.content.splice(t),this.length-=t),this.parent){if(!this.left&&(!this.right||this.right.left!==null)||this.left&&this.left.right!==this.right){let t=this.left,n;if(t!==null)n=t.right;else if(this.parentSub!==null)for(n=this.parent._map.get(this.parentSub)||null;n!==null&&n.left!==null;)n=n.left;else n=this.parent._start;let r=new Set,i=new Set;for(;n!==null&&n!==this.right;){if(i.add(n),r.add(n),ya(this.origin,n.origin)){if(n.id.client<this.id.client)t=n,r.clear();else if(ya(this.rightOrigin,n.rightOrigin))break}else if(n.origin!==null&&i.has(Ba(e.doc.store,n.origin)))r.has(Ba(e.doc.store,n.origin))||(t=n,r.clear());else break;n=n.right}this.left=t}if(this.left!==null)this.right=this.left.right,this.left.right=this;else{let e;if(this.parentSub!==null)for(e=this.parent._map.get(this.parentSub)||null;e!==null&&e.left!==null;)e=e.left;else e=this.parent._start,this.parent._start=this;this.right=e}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),za(e.doc.store,this),this.content.integrate(e,this),qa(e,this.parent,this.parentSub),(this.parent._item!==null&&this.parent._item.deleted||this.parentSub!==null&&this.right!==null)&&this.delete(e)}else new W(this.id,this.length).integrate(e,0)}get next(){let e=this.right;for(;e!==null&&e.deleted;)e=e.right;return e}get prev(){let e=this.left;for(;e!==null&&e.deleted;)e=e.left;return e}get lastId(){return this.length===1?this.id:L(this.id.client,this.id.clock+this.length-1)}mergeWith(e){if(this.constructor===e.constructor&&ya(e.origin,this.lastId)&&this.right===e&&ya(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)){let t=this.parent._searchMarker;return t&&t.forEach(t=>{t.p===e&&(t.p=this,!this.deleted&&this.countable&&(t.index-=this.length))}),e.keep&&(this.keep=!0),this.right=e.right,this.right!==null&&(this.right.left=this),this.length+=e.length,!0}return!1}delete(e){if(!this.deleted){let t=this.parent;this.countable&&this.parentSub===null&&(t._length-=this.length),this.markDeleted(),Pi(e.deleteSet,this.id.client,this.id.clock,this.length),qa(e,t,this.parentSub),this.content.delete(e)}}gc(e,t){if(!this.deleted)throw D();this.content.gc(e),t?Ua(e,this,new W(this.id,this.length)):this.content=new As(this.length)}write(e,t){let n=t>0?L(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);if(e.writeInfo(a),n!==null&&e.writeLeftID(n),r!==null&&e.writeRightID(r),n===null&&r===null){let t=this.parent;if(t._item!==void 0){let n=t._item;if(n===null){let n=ba(t);e.writeParentInfo(!0),e.writeString(n)}else e.writeParentInfo(!1),e.writeLeftID(n.id)}else t.constructor===String?(e.writeParentInfo(!0),e.writeString(t)):t.constructor===va?(e.writeParentInfo(!1),e.writeLeftID(t)):D();i!==null&&e.writeString(i)}this.content.write(e,t)}},ac=(e,t)=>oc[t&31](e),oc=[()=>{D()},js,zs,ks,Ws,Is,Ls,$s,Hs,Ps,()=>{D()}],sc=10,J=class extends Es{get deleted(){return!0}delete(){}mergeWith(e){return this.constructor===e.constructor?(this.length+=e.length,!0):!1}integrate(e,t){D()}write(e,t){e.writeInfo(sc),C(e.restEncoder,this.length-t)}getMissing(e,t){return null}},cc=typeof globalThis<`u`?globalThis:typeof window<`u`?window:typeof global<`u`?global:{},lc=`__ $YJS$ __`;cc[lc]===!0&&console.error(`Yjs was already imported. This breaks constructor checks and will lead to issues! - https://github.com/yjs/yjs/issues/438`),cc[lc]=!0;var uc=function(e){return e[e.Token=0]=`Token`,e[e.PermissionDenied=1]=`PermissionDenied`,e[e.Authenticated=2]=`Authenticated`,e}({}),dc=(e,t)=>{C(e,uc.Token),_t(e,t)},fc=(e,t,n,r)=>{switch(k(e)){case uc.Token:t();break;case uc.PermissionDenied:n(Bt(e));break;case uc.Authenticated:r(Bt(e));break;default:}},pc=e=>Array.from(e.entries()).map(([e,t])=>({clientId:e,...t})),mc=`\0`;function hc(e,t){return e+mc+t}function gc(e){let t=e.indexOf(mc);return t===-1?{documentName:e,sessionId:null}:{documentName:e.substring(0,t),sessionId:e.substring(t+1)}}var _c=function(e){return e[e.Connecting=0]=`Connecting`,e[e.Open=1]=`Open`,e[e.Closing=2]=`Closing`,e[e.Closed=3]=`Closed`,e}({});function vc(e){return e||={},{delay:e.delay===void 0?200:e.delay,initialDelay:e.initialDelay===void 0?0:e.initialDelay,minDelay:e.minDelay===void 0?0:e.minDelay,maxDelay:e.maxDelay===void 0?0:e.maxDelay,factor:e.factor===void 0?0:e.factor,maxAttempts:e.maxAttempts===void 0?3:e.maxAttempts,timeout:e.timeout===void 0?0:e.timeout,jitter:e.jitter===!0,initialJitter:e.initialJitter===!0,handleError:e.handleError===void 0?null:e.handleError,handleTimeout:e.handleTimeout===void 0?null:e.handleTimeout,beforeAttempt:e.beforeAttempt===void 0?null:e.beforeAttempt,calculateDelay:e.calculateDelay===void 0?null:e.calculateDelay}}async function yc(e){return new Promise(t=>setTimeout(t,e))}function bc(e,t){let n=t.delay;if(n===0)return 0;if(t.factor&&(n*=t.factor**(e.attemptNum-1),t.maxDelay!==0&&(n=Math.min(n,t.maxDelay))),t.jitter){let e=Math.ceil(t.minDelay);n=Math.floor(Math.random()*(Math.floor(n)-e+1))+e}return Math.round(n)}async function xc(e,t){let n=vc(t);for(let e of[`delay`,`initialDelay`,`minDelay`,`maxDelay`,`maxAttempts`,`timeout`]){let t=n[e];if(!Number.isInteger(t)||t<0)throw Error(`Value for ${e} must be an integer greater than or equal to 0`)}if(n.factor.constructor!==Number||n.factor<0)throw Error(`Value for factor must be a number greater than or equal to 0`);if(n.delay<n.minDelay)throw Error(`delay cannot be less than minDelay (delay: ${n.delay}, minDelay: ${n.minDelay}`);let r={attemptNum:0,attemptsRemaining:n.maxAttempts?n.maxAttempts:-1,aborted:!1,abort(){r.aborted=!0}},i=n.calculateDelay||bc;async function a(){if(n.beforeAttempt&&n.beforeAttempt(r,n),r.aborted){let e=Error(`Attempt aborted`);throw e.code=`ATTEMPT_ABORTED`,e}let t=async e=>{if(n.handleError&&await n.handleError(e,r,n),r.aborted||r.attemptsRemaining===0)throw e;r.attemptNum++;let t=i(r,n);return t&&await yc(t),a()};return r.attemptsRemaining>0&&r.attemptsRemaining--,n.timeout?new Promise((i,a)=>{let o=setTimeout(()=>{if(n.handleTimeout)try{i(n.handleTimeout(r,n))}catch(e){a(e)}else{let e=Error(`Retry timeout (attemptNum: ${r.attemptNum}, timeout: ${n.timeout})`);e.code=`ATTEMPT_TIMEOUT`,a(e)}},n.timeout);e(r,n).then(e=>{clearTimeout(o),i(e)}).catch(e=>{clearTimeout(o),t(e).then(i).catch(a)})}):e(r,n).catch(t)}let o=n.calculateDelay?n.calculateDelay(r,n):n.initialDelay;if(o&&await yc(o),r.attemptNum<1&&n.initialJitter){let e=i(r,n);e&&await yc(e)}return a()}var Sc=Math.floor,Cc=(e,t)=>e<t?e:t,wc=(e,t)=>e>t?e:t;Number.isNaN;var Tc=64,Ec=128,Dc=1<<17,Oc=1<<18,kc=1<<19,Ac=1<<20,jc=1<<21,Mc=1<<22,Nc=1<<23,Pc=1<<24,Fc=1<<25,Ic=1<<26,Lc=1<<27,Rc=1<<28,zc=1<<29,Bc=1<<30,Vc=63,Hc=127;Dc-1,Oc-1,kc-1,Ac-1,jc-1,Mc-1,Nc-1,Pc-1,Fc-1,Ic-1,Lc-1,Rc-1,zc-1,Bc-1;var Uc=2**53-1;Number.isInteger,Number.isNaN,Number.parseInt;var Wc=()=>new Set,Gc=Array.from;Array.isArray;var Kc=String.fromCharCode;String.fromCodePoint,Kc(65535);var qc=e=>{let t=unescape(encodeURIComponent(e)),n=t.length,r=new Uint8Array(n);for(let e=0;e<n;e++)r[e]=t.codePointAt(e);return r},Jc=typeof TextEncoder<`u`?new TextEncoder:null,Yc=Jc?e=>Jc.encode(e):qc,Xc=typeof TextDecoder>`u`?null:new TextDecoder(`utf-8`,{fatal:!0,ignoreBOM:!0});Xc&&Xc.decode(new Uint8Array).length===1&&(Xc=null);var Zc=class{constructor(){this.cpos=0,this.cbuf=new Uint8Array(100),this.bufs=[]}},Qc=()=>new Zc,$c=e=>{let t=e.cpos;for(let n=0;n<e.bufs.length;n++)t+=e.bufs[n].length;return t},el=e=>{let t=new Uint8Array($c(e)),n=0;for(let r=0;r<e.bufs.length;r++){let i=e.bufs[r];t.set(i,n),n+=i.length}return t.set(new Uint8Array(e.cbuf.buffer,0,e.cpos),n),t},tl=(e,t)=>{let n=e.cbuf.length;e.cpos===n&&(e.bufs.push(e.cbuf),e.cbuf=new Uint8Array(n*2),e.cpos=0),e.cbuf[e.cpos++]=t},Y=(e,t)=>{for(;t>Hc;)tl(e,Ec|Hc&t),t=Sc(t/128);tl(e,Hc&t)},nl=new Uint8Array(3e4),rl=nl.length/3,X=Jc&&Jc.encodeInto?(e,t)=>{if(t.length<rl){let n=Jc.encodeInto(t,nl).written||0;Y(e,n);for(let t=0;t<n;t++)tl(e,nl[t])}else al(e,Yc(t))}:(e,t)=>{let n=unescape(encodeURIComponent(t)),r=n.length;Y(e,r);for(let t=0;t<r;t++)tl(e,n.codePointAt(t))},il=(e,t)=>{let n=e.cbuf.length,r=e.cpos,i=Cc(n-r,t.length),a=t.length-i;e.cbuf.set(t.subarray(0,i),r),e.cpos+=i,a>0&&(e.bufs.push(e.cbuf),e.cbuf=new Uint8Array(wc(n*2,a)),e.cbuf.set(t.subarray(i)),e.cpos=a)},al=(e,t)=>{Y(e,t.byteLength),il(e,t)},ol=e=>Error(e),sl=ol(`Unexpected end of array`),cl=ol(`Integer out of Range`),ll=class{constructor(e){this.arr=e,this.pos=0}},ul=e=>new ll(e),dl=(e,t)=>{let n=new Uint8Array(e.arr.buffer,e.pos+e.arr.byteOffset,t);return e.pos+=t,n},fl=e=>dl(e,Z(e)),pl=e=>e.arr[e.pos++],Z=e=>{let t=0,n=1,r=e.arr.length;for(;e.pos<r;){let r=e.arr[e.pos++];if(t+=(r&Hc)*n,n*=128,r<Ec)return t;if(t>Uc)throw cl}throw sl},ml=e=>{let t=e.arr[e.pos++],n=t&Vc,r=64,i=(t&Tc)>0?-1:1;if((t&Ec)===0)return i*n;let a=e.arr.length;for(;e.pos<a;){if(t=e.arr[e.pos++],n+=(t&Hc)*r,r*=128,t<Ec)return i*n;if(n>Uc)throw cl}throw sl},hl=Xc?e=>Xc.decode(fl(e)):e=>{let t=Z(e);if(t===0)return``;{let n=String.fromCodePoint(pl(e));if(--t<100)for(;t--;)n+=String.fromCodePoint(pl(e));else for(;t>0;){let r=t<1e4?t:1e4,i=e.arr.subarray(e.pos,e.pos+r);e.pos+=r,n+=String.fromCodePoint.apply(null,i),t-=r}return decodeURIComponent(escape(n))}},gl=e=>{let t=e.pos,n=hl(e);return e.pos=t,n},_l=Date.now,vl=()=>new Map,yl=(e,t,n)=>{let r=e.get(t);return r===void 0&&e.set(t,r=n()),r},bl=class{constructor(){this._observers=vl()}on(e,t){yl(this._observers,e,Wc).add(t)}once(e,t){let n=(...r)=>{this.off(e,n),t(...r)};this.on(e,n)}off(e,t){let n=this._observers.get(e);n!==void 0&&(n.delete(t),n.size===0&&this._observers.delete(e))}emit(e,t){return Gc((this._observers.get(e)||vl()).values()).forEach(e=>e(...t))}destroy(){this._observers=vl()}},xl=Symbol(`Equality`),Sl=Object.keys,Cl=e=>Sl(e).length,wl=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),Tl=(e,t)=>{if(e===t)return!0;if(e==null||t==null||e.constructor!==t.constructor&&(e.constructor||Object)!==(t.constructor||Object))return!1;if(e[xl]!=null)return e[xl](t);switch(e.constructor){case ArrayBuffer:e=new Uint8Array(e),t=new Uint8Array(t);case Uint8Array:if(e.byteLength!==t.byteLength)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;break;case Set:if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;break;case Map:if(e.size!==t.size)return!1;for(let n of e.keys())if(!t.has(n)||!Tl(e.get(n),t.get(n)))return!1;break;case void 0:case Object:if(Cl(e)!==Cl(t))return!1;for(let n in e)if(!wl(e,n)||!Tl(e[n],t[n]))return!1;break;case Array:if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!Tl(e[n],t[n]))return!1;break;default:return!1}return!0},El=3e4,Dl=class extends bl{constructor(e){super(),this.doc=e,this.clientID=e.clientID,this.states=new Map,this.meta=new Map,this._checkInterval=setInterval(()=>{let e=_l();this.getLocalState()!==null&&El/2<=e-this.meta.get(this.clientID).lastUpdated&&this.setLocalState(this.getLocalState());let t=[];this.meta.forEach((n,r)=>{r!==this.clientID&&El<=e-n.lastUpdated&&this.states.has(r)&&t.push(r)}),t.length>0&&Ol(this,t,`timeout`)},Sc(El/10)),e.on(`destroy`,()=>{this.destroy()}),this.setLocalState({})}destroy(){this.emit(`destroy`,[this]),this.setLocalState(null),super.destroy(),clearInterval(this._checkInterval)}getLocalState(){return this.states.get(this.clientID)||null}setLocalState(e){let t=this.clientID,n=this.meta.get(t),r=n===void 0?0:n.clock+1,i=this.states.get(t);e===null?this.states.delete(t):this.states.set(t,e),this.meta.set(t,{clock:r,lastUpdated:_l()});let a=[],o=[],s=[],c=[];e===null?c.push(t):i==null?e!=null&&a.push(t):(o.push(t),Tl(i,e)||s.push(t)),(a.length>0||s.length>0||c.length>0)&&this.emit(`change`,[{added:a,updated:s,removed:c},`local`]),this.emit(`update`,[{added:a,updated:o,removed:c},`local`])}setLocalStateField(e,t){let n=this.getLocalState();n!==null&&this.setLocalState({...n,[e]:t})}getStates(){return this.states}},Ol=(e,t,n)=>{let r=[];for(let n=0;n<t.length;n++){let i=t[n];if(e.states.has(i)){if(e.states.delete(i),i===e.clientID){let t=e.meta.get(i);e.meta.set(i,{clock:t.clock+1,lastUpdated:_l()})}r.push(i)}}r.length>0&&(e.emit(`change`,[{added:[],updated:[],removed:r},n]),e.emit(`update`,[{added:[],updated:[],removed:r},n]))},kl=(e,t,n=e.states)=>{let r=t.length,i=Qc();Y(i,r);for(let a=0;a<r;a++){let r=t[a],o=n.get(r)||null,s=e.meta.get(r).clock;Y(i,r),Y(i,s),X(i,JSON.stringify(o))}return el(i)},Al=(e,t,n)=>{let r=ul(t),i=_l(),a=[],o=[],s=[],c=[],l=Z(r);for(let t=0;t<l;t++){let t=Z(r),n=Z(r),l=JSON.parse(hl(r)),u=e.meta.get(t),d=e.states.get(t),f=u===void 0?0:u.clock;(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,{clock:n,lastUpdated:i}),u===void 0&&l!==null?a.push(t):u!==void 0&&l===null?c.push(t):l!==null&&(Tl(l,d)||s.push(t),o.push(t)))}(a.length>0||s.length>0||c.length>0)&&e.emit(`change`,[{added:a,updated:s,removed:c},n]),(a.length>0||o.length>0||c.length>0)&&e.emit(`update`,[{added:a,updated:o,removed:c},n])},jl=class{constructor(){this.callbacks={}}on(e,t){return this.callbacks[e]||(this.callbacks[e]=[]),this.callbacks[e].push(t),this}emit(e,...t){let n=this.callbacks[e];return n&&n.forEach(e=>e.apply(this,t)),this}off(e,t){let n=this.callbacks[e];return n&&(t?this.callbacks[e]=n.filter(e=>e!==t):delete this.callbacks[e]),this}removeAllListeners(){this.callbacks={}}},Ml=class{constructor(e){this.data=e,this.encoder=Qc(),this.decoder=ul(new Uint8Array(this.data))}peekVarString(){return gl(this.decoder)}readVarUint(){return Z(this.decoder)}readVarString(){return hl(this.decoder)}readVarUint8Array(){return fl(this.decoder)}writeVarUint(e){return Y(this.encoder,e)}writeVarString(e){return X(this.encoder,e)}writeVarUint8Array(e){return al(this.encoder,e)}length(){return $c(this.encoder)}},Q=function(e){return e[e.Sync=0]=`Sync`,e[e.Awareness=1]=`Awareness`,e[e.Auth=2]=`Auth`,e[e.QueryAwareness=3]=`QueryAwareness`,e[e.Stateless=5]=`Stateless`,e[e.CLOSE=7]=`CLOSE`,e[e.SyncStatus=8]=`SyncStatus`,e[e.Ping=9]=`Ping`,e[e.Pong=10]=`Pong`,e}({}),$=function(e){return e.Connecting=`connecting`,e.Connected=`connected`,e.Disconnected=`disconnected`,e}({}),Nl=class{constructor(){this.encoder=Qc()}get(e){return e.encoder}toUint8Array(){return el(this.encoder)}},Pl=class extends Nl{constructor(...e){super(...e),this.type=Q.CLOSE,this.description=`Ask the server to close the connection`}get(e){return X(this.encoder,e.documentName),Y(this.encoder,this.type),this.encoder}},Fl=class e extends jl{static{this.DEDUPLICATABLE_TYPES=new Set([Q.Awareness,Q.QueryAwareness])}constructor(e){super(),this.messageQueue=[],this.configuration={url:``,autoConnect:!0,preserveTrailingSlash:!1,document:void 0,WebSocketPolyfill:void 0,messageReconnectTimeout:3e4,delay:1e3,initialDelay:0,factor:2,maxAttempts:0,minDelay:1e3,maxDelay:3e4,jitter:!0,timeout:0,onOpen:()=>null,onConnect:()=>null,onMessage:()=>null,onOutgoingMessage:()=>null,onStatus:()=>null,onDisconnect:()=>null,onClose:()=>null,onDestroy:()=>null,onAwarenessUpdate:()=>null,onAwarenessChange:()=>null,handleTimeout:null,providerMap:new Map},this.webSocket=null,this.webSocketHandlers={},this.shouldConnect=!0,this.status=$.Disconnected,this.lastMessageReceived=0,this.identifier=0,this.intervals={connectionChecker:null},this.connectionAttempt=null,this.receivedOnOpenPayload=void 0,this.closeTries=0,this.setConfiguration(e),this.configuration.WebSocketPolyfill=e.WebSocketPolyfill?e.WebSocketPolyfill:WebSocket,this.on(`open`,this.configuration.onOpen),this.on(`open`,this.onOpen.bind(this)),this.on(`connect`,this.configuration.onConnect),this.on(`message`,this.configuration.onMessage),this.on(`outgoingMessage`,this.configuration.onOutgoingMessage),this.on(`status`,this.configuration.onStatus),this.on(`disconnect`,this.configuration.onDisconnect),this.on(`close`,this.configuration.onClose),this.on(`destroy`,this.configuration.onDestroy),this.on(`awarenessUpdate`,this.configuration.onAwarenessUpdate),this.on(`awarenessChange`,this.configuration.onAwarenessChange),this.on(`close`,this.onClose.bind(this)),this.on(`message`,this.onMessage.bind(this)),this.intervals.connectionChecker=setInterval(this.checkConnection.bind(this),this.configuration.messageReconnectTimeout/10),this.shouldConnect&&this.connect()}async onOpen(e){this.status=$.Connected,this.emit(`status`,{status:$.Connected}),this.cancelWebsocketRetry=void 0,this.receivedOnOpenPayload=e}attach(e){let t=e.effectiveName,n=this.configuration.providerMap.get(t);if(n&&n!==e&&n.isAuthenticated)throw Error(`Cannot attach two providers with the same effective name "${t}". Use sessionAwareness: true to multiplex providers with the same document name.`);this.configuration.providerMap.set(t,e),this.status===$.Disconnected&&this.shouldConnect&&this.connect(),this.receivedOnOpenPayload&&this.status===$.Connected&&e.onOpen(this.receivedOnOpenPayload)}detach(e){let t=e.effectiveName;this.configuration.providerMap.has(t)&&(e.send(Pl,{documentName:t}),this.configuration.providerMap.delete(t))}setConfiguration(e={}){this.configuration={...this.configuration,...e},this.configuration.autoConnect||(this.shouldConnect=!1)}async connect(){if(this.status===$.Connected)return;this.cancelWebsocketRetry&&=(this.cancelWebsocketRetry(),void 0),this.receivedOnOpenPayload=void 0,this.shouldConnect=!0;let{retryPromise:e,cancelFunc:t}=(()=>{let e=!1;return{retryPromise:xc(this.createWebSocketConnection.bind(this),{delay:this.configuration.delay,initialDelay:this.configuration.initialDelay,factor:this.configuration.factor,maxAttempts:this.configuration.maxAttempts,minDelay:this.configuration.minDelay,maxDelay:this.configuration.maxDelay,jitter:this.configuration.jitter,timeout:this.configuration.timeout,handleTimeout:this.configuration.handleTimeout,beforeAttempt:t=>{(!this.shouldConnect||e)&&t.abort()}}).catch(e=>{if(e&&e.code!==`ATTEMPT_ABORTED`)throw e}),cancelFunc:()=>{e=!0}}})();return this.cancelWebsocketRetry=t,e}attachWebSocketListeners(e,t){let{identifier:n}=e,r=e=>this.emit(`message`,e),i=e=>this.emit(`close`,{event:e}),a=e=>this.emit(`open`,e),o=e=>{t(e)};this.webSocketHandlers[n]={message:r,close:i,open:a,error:o};let s=this.webSocketHandlers[e.identifier];Object.keys(s).forEach(t=>{e.addEventListener(t,s[t])})}cleanupWebSocket(){if(!this.webSocket)return;let{identifier:e}=this.webSocket,t=this.webSocketHandlers[e];Object.keys(t).forEach(n=>{this.webSocket?.removeEventListener(n,t[n]),delete this.webSocketHandlers[e]}),this.webSocket.close(),this.webSocket=null}createWebSocketConnection(){return new Promise((e,t)=>{this.webSocket&&(this.messageQueue=[],this.cleanupWebSocket()),this.lastMessageReceived=0,this.identifier+=1;let n=new this.configuration.WebSocketPolyfill(this.url);n.binaryType=`arraybuffer`,n.identifier=this.identifier,this.attachWebSocketListeners(n,t),this.webSocket=n,this.status=$.Connecting,this.emit(`status`,{status:$.Connecting}),this.connectionAttempt={resolve:e,reject:t}})}onMessage(e){this.resolveConnectionAttempt(),this.lastMessageReceived=_l();let t=new Uint8Array(e.data);if(t.length===1&&t[0]===Q.Ping){this.sendPong();return}let n=new Ml(t).peekVarString();this.configuration.providerMap.get(n)?.onMessage(e)}sendPong(){let e=Qc();Y(e,Q.Pong),this.send(el(e))}resolveConnectionAttempt(){this.connectionAttempt&&(this.connectionAttempt.resolve(),this.connectionAttempt=null,this.status=$.Connected,this.emit(`status`,{status:$.Connected}),this.emit(`connect`),this.messageQueue.forEach(e=>this.send(e)),this.messageQueue=[])}stopConnectionAttempt(){this.connectionAttempt=null}rejectConnectionAttempt(){this.connectionAttempt?.reject(),this.connectionAttempt=null}checkConnection(){this.status===$.Connected&&this.lastMessageReceived&&(this.configuration.messageReconnectTimeout>=_l()-this.lastMessageReceived||(this.closeTries+=1,this.closeTries>2?(this.onClose({event:{code:4408,reason:`forced`}}),this.closeTries=0):(this.webSocket?.close(),this.messageQueue=[])))}get serverUrl(){if(this.configuration.preserveTrailingSlash)return this.configuration.url;let e=this.configuration.url;for(;e[e.length-1]===`/`;)e=e.slice(0,e.length-1);return e}get url(){return this.serverUrl}disconnect(){if(this.shouldConnect=!1,this.webSocket!==null)try{this.webSocket.close(),this.messageQueue=[]}catch(e){console.error(e)}}parseQueuedMessage(e){try{let t=ul(e);return{documentName:hl(t),messageType:Z(t)}}catch{return null}}addToQueue(t){if(t instanceof Uint8Array){let n=this.parseQueuedMessage(t);n&&e.DEDUPLICATABLE_TYPES.has(n.messageType)&&(this.messageQueue=this.messageQueue.filter(e=>{if(!(e instanceof Uint8Array))return!0;let t=this.parseQueuedMessage(e);return t?!(t.documentName===n.documentName&&t.messageType===n.messageType):!0}))}this.messageQueue.push(t)}send(e){this.webSocket?.readyState===_c.Open?this.webSocket.send(e):this.addToQueue(e)}onClose({event:e}){this.closeTries=0,this.cleanupWebSocket(),this.connectionAttempt&&this.rejectConnectionAttempt(),this.status=$.Disconnected,this.emit(`status`,{status:$.Disconnected}),this.emit(`disconnect`,{event:e}),!this.cancelWebsocketRetry&&this.shouldConnect&&setTimeout(()=>{this.connect()},this.configuration.delay)}destroy(){this.emit(`destroy`),clearInterval(this.intervals.connectionChecker),this.stopConnectionAttempt(),this.disconnect(),this.removeAllListeners(),this.cleanupWebSocket()}},Il=0,Ll=1,Rl=2,zl=(e,t)=>{Y(e,Il),al(e,fa(t))},Bl=(e,t,n)=>{Y(e,Ll),al(e,oa(t,n))},Vl=(e,t,n)=>Bl(t,n,fl(e)),Hl=(e,t,n,r)=>{try{ra(t,fl(e),n)}catch(e){r?.(e),console.error(`Caught error while handling a Yjs update`,e)}},Ul=(e,t)=>{Y(e,Rl),al(e,t)},Wl=Hl,Gl=(e,t,n,r,i)=>{let a=Z(e);switch(a){case Il:Vl(e,t,n);break;case Ll:Hl(e,n,r,i);break;case Rl:Wl(e,n,r,i);break;default:throw Error(`Unknown message type`)}return a},Kl=class{constructor(e){this.message=e}apply(e,t){let{message:n}=this,r=n.readVarUint(),i=n.length();switch(r){case Q.Sync:this.applySyncMessage(e,t);break;case Q.Awareness:this.applyAwarenessMessage(e);break;case Q.Auth:this.applyAuthMessage(e);break;case Q.QueryAwareness:this.applyQueryAwarenessMessage(e);break;case Q.Stateless:e.receiveStateless(hl(n.decoder));break;case Q.SyncStatus:this.applySyncStatusMessage(e,ml(n.decoder)===1);break;case Q.CLOSE:let i={code:1e3,reason:hl(n.decoder)};e.onClose(),e.configuration.onClose({event:i}),e.forwardClose({event:i});break;default:console.error(`Can’t apply message of unknown type: ${r}`)}n.length()>i+1&&e.send(Nl,{encoder:n.encoder})}applySyncMessage(e,t){let{message:n}=this;n.writeVarUint(Q.Sync);let r=Gl(n.decoder,n.encoder,e.document,e);t&&r===Ll&&(e.synced=!0)}applySyncStatusMessage(e,t){t&&e.decrementUnsyncedChanges()}applyAwarenessMessage(e){if(!e.awareness)return;let{message:t}=this;Al(e.awareness,t.readVarUint8Array(),e)}applyAuthMessage(e){let{message:t}=this;fc(t.decoder,e.sendToken.bind(e),e.permissionDeniedHandler.bind(e),e.authenticatedHandler.bind(e))}applyQueryAwarenessMessage(e){if(!e.awareness)return;let{message:t}=this;t.writeVarUint(Q.Awareness),t.writeVarUint8Array(kl(e.awareness,Array.from(e.awareness.getStates().keys())))}},ql=class{constructor(e,t={}){this.message=new e,this.encoder=this.message.get(t)}create(){return el(this.encoder)}send(e){e?.send(this.create())}},Jl=`4.0.0-rc.1`,Yl=class extends Nl{constructor(...e){super(...e),this.type=Q.Auth,this.description=`Authentication`}get(e){if(e.token===void 0)throw Error("The authentication message requires `token` as an argument.");return X(this.encoder,e.documentName),Y(this.encoder,this.type),dc(this.encoder,e.token),X(this.encoder,Jl),this.encoder}},Xl=class extends Nl{constructor(...e){super(...e),this.type=Q.Awareness,this.description=`Awareness states update`}get(e){if(e.awareness===void 0)throw Error(`The awareness message requires awareness as an argument`);if(e.clients===void 0)throw Error(`The awareness message requires clients as an argument`);X(this.encoder,e.documentName),Y(this.encoder,this.type);let t;return t=e.states===void 0?kl(e.awareness,e.clients):kl(e.awareness,e.clients,e.states),al(this.encoder,t),this.encoder}},Zl=class extends Nl{constructor(...e){super(...e),this.type=Q.Stateless,this.description=`A stateless message`}get(e){return X(this.encoder,e.documentName),Y(this.encoder,this.type),X(this.encoder,e.payload??``),this.encoder}},Ql=class extends Nl{constructor(...e){super(...e),this.type=Q.Sync,this.description=`First sync step`}get(e){if(e.document===void 0)throw Error(`The sync step one message requires document as an argument`);return X(this.encoder,e.documentName),Y(this.encoder,this.type),zl(this.encoder,e.document),this.encoder}},$l=class extends Nl{constructor(...e){super(...e),this.type=Q.Sync,this.description=`A document update`}get(e){return X(this.encoder,e.documentName),Y(this.encoder,this.type),Ul(this.encoder,e.update),this.encoder}},eu=class extends Error{constructor(...e){super(...e),this.code=1001}},tu=class extends jl{get effectiveName(){return this.configuration.sessionAwareness?hc(this.configuration.name,this.sessionId):this.configuration.name}constructor(e){super(),this.configuration={name:``,document:void 0,awareness:void 0,token:null,sessionAwareness:!0,forceSyncInterval:!1,onAuthenticated:()=>null,onAuthenticationFailed:()=>null,onOpen:()=>null,onConnect:()=>null,onMessage:()=>null,onOutgoingMessage:()=>null,onSynced:()=>null,onStatus:()=>null,onDisconnect:()=>null,onClose:()=>null,onDestroy:()=>null,onAwarenessUpdate:()=>null,onAwarenessChange:()=>null,onStateless:()=>null,onUnsyncedChanges:()=>null},this.isSynced=!1,this.unsyncedChanges=0,this.isAuthenticated=!1,this.authorizedScope=void 0,this.manageSocket=!1,this._isAttached=!1,this.sessionId=Math.random().toString(36).slice(2),this.intervals={forceSync:null},this.boundDocumentUpdateHandler=this.documentUpdateHandler.bind(this),this.boundAwarenessUpdateHandler=this.awarenessUpdateHandler.bind(this),this.boundPageHide=this.pageHide.bind(this),this.boundOnOpen=this.onOpen.bind(this),this.boundOnClose=this.onClose.bind(this),this.forwardConnect=()=>this.emit(`connect`),this.forwardStatus=e=>this.emit(`status`,e),this.forwardClose=e=>this.emit(`close`,e),this.forwardDisconnect=e=>this.emit(`disconnect`,e),this.forwardDestroy=()=>this.emit(`destroy`),this.setConfiguration(e),this.configuration.document=e.document?e.document:new Vi,this.configuration.awareness=e.awareness===void 0?new Dl(this.document):e.awareness,this.on(`open`,this.configuration.onOpen),this.on(`message`,this.configuration.onMessage),this.on(`outgoingMessage`,this.configuration.onOutgoingMessage),this.on(`synced`,this.configuration.onSynced),this.on(`destroy`,this.configuration.onDestroy),this.on(`awarenessUpdate`,this.configuration.onAwarenessUpdate),this.on(`awarenessChange`,this.configuration.onAwarenessChange),this.on(`stateless`,this.configuration.onStateless),this.on(`unsyncedChanges`,this.configuration.onUnsyncedChanges),this.on(`authenticated`,this.configuration.onAuthenticated),this.on(`authenticationFailed`,this.configuration.onAuthenticationFailed),this.awareness?.on(`update`,()=>{this.emit(`awarenessUpdate`,{states:pc(this.awareness.getStates())})}),this.awareness?.on(`change`,()=>{this.emit(`awarenessChange`,{states:pc(this.awareness.getStates())})}),this.document.on(`update`,this.boundDocumentUpdateHandler),this.awareness?.on(`update`,this.boundAwarenessUpdateHandler),this.registerEventListeners(),this.configuration.forceSyncInterval&&typeof this.configuration.forceSyncInterval==`number`&&(this.intervals.forceSync=setInterval(this.forceSync.bind(this),this.configuration.forceSyncInterval)),this.manageSocket&&this.attach()}setConfiguration(e={}){e.websocketProvider||(this.manageSocket=!0,this.configuration.websocketProvider=new Fl(e)),this.configuration={...this.configuration,...e}}get document(){return this.configuration.document}get isAttached(){return this._isAttached}get awareness(){return this.configuration.awareness}get hasUnsyncedChanges(){return this.unsyncedChanges>0}resetUnsyncedChanges(){this.unsyncedChanges=1,this.emit(`unsyncedChanges`,{number:this.unsyncedChanges})}incrementUnsyncedChanges(){this.unsyncedChanges+=1,this.emit(`unsyncedChanges`,{number:this.unsyncedChanges})}decrementUnsyncedChanges(){this.unsyncedChanges>0&&--this.unsyncedChanges,this.unsyncedChanges===0&&(this.synced=!0),this.emit(`unsyncedChanges`,{number:this.unsyncedChanges})}forceSync(){this.resetUnsyncedChanges(),this.send(Ql,{document:this.document,documentName:this.effectiveName})}pageHide(){this.awareness&&Ol(this.awareness,[this.document.clientID],`page hide`)}registerEventListeners(){typeof window>`u`||!(`addEventListener`in window)||window.addEventListener(`pagehide`,this.boundPageHide)}sendStateless(e){this.send(Zl,{documentName:this.effectiveName,payload:e})}async sendToken(){let e;try{e=await this.getToken()}catch(e){this.permissionDeniedHandler(`Failed to get token during sendToken(): ${e}`);return}this.send(Yl,{token:e??``,documentName:this.effectiveName})}documentUpdateHandler(e,t){t!==this&&(this.incrementUnsyncedChanges(),this.send($l,{update:e,documentName:this.effectiveName}))}awarenessUpdateHandler({added:e,updated:t,removed:n},r){let i=e.concat(t).concat(n);this.send(Xl,{awareness:this.awareness,clients:i,documentName:this.effectiveName})}get synced(){return this.isSynced}set synced(e){this.isSynced!==e&&(this.isSynced=e,e&&this.emit(`synced`,{state:e}))}receiveStateless(e){this.emit(`stateless`,{payload:e})}async connect(){if(this.manageSocket)return this.configuration.websocketProvider.connect();console.warn(`HocuspocusProvider::connect() is deprecated and does not do anything. Please connect/disconnect on the websocketProvider, or attach/deattach providers.`)}disconnect(){if(this.manageSocket)return this.configuration.websocketProvider.disconnect();console.warn(`HocuspocusProvider::disconnect() is deprecated and does not do anything. Please connect/disconnect on the websocketProvider, or attach/deattach providers.`)}async onOpen(e){this.isAuthenticated=!1,this.emit(`open`,{event:e}),await this.sendToken(),this.startSync()}async getToken(){return typeof this.configuration.token==`function`?await this.configuration.token():this.configuration.token}startSync(){this.resetUnsyncedChanges(),this.send(Ql,{document:this.document,documentName:this.effectiveName}),this.awareness&&this.awareness.getLocalState()!==null&&this.send(Xl,{awareness:this.awareness,clients:[this.document.clientID],documentName:this.effectiveName})}send(e,t){if(!this._isAttached)return;let n=new ql(e,t);this.emit(`outgoingMessage`,{message:n.message}),n.send(this.configuration.websocketProvider)}onMessage(e){let t=new Ml(e.data),{documentName:n}=gc(t.readVarString());t.writeVarString(this.effectiveName),this.emit(`message`,{event:e,message:new Ml(e.data)}),new Kl(t).apply(this,!0)}onClose(){this.isAuthenticated=!1,this.synced=!1,this.awareness&&Ol(this.awareness,Array.from(this.awareness.getStates().keys()).filter(e=>e!==this.document.clientID),this)}destroy(){this.emit(`destroy`),this.intervals.forceSync&&clearInterval(this.intervals.forceSync),this.awareness&&(Ol(this.awareness,[this.document.clientID],`provider destroy`),this.awareness.off(`update`,this.boundAwarenessUpdateHandler),this.awareness.destroy()),this.document.off(`update`,this.boundDocumentUpdateHandler),this.removeAllListeners(),this.detach(),this.manageSocket&&this.configuration.websocketProvider.destroy(),!(typeof window>`u`||!(`removeEventListener`in window))&&window.removeEventListener(`pagehide`,this.boundPageHide)}detach(){this.configuration.websocketProvider.off(`connect`,this.configuration.onConnect),this.configuration.websocketProvider.off(`connect`,this.forwardConnect),this.configuration.websocketProvider.off(`status`,this.forwardStatus),this.configuration.websocketProvider.off(`status`,this.configuration.onStatus),this.configuration.websocketProvider.off(`open`,this.boundOnOpen),this.configuration.websocketProvider.off(`close`,this.boundOnClose),this.configuration.websocketProvider.off(`close`,this.configuration.onClose),this.configuration.websocketProvider.off(`close`,this.forwardClose),this.configuration.websocketProvider.off(`disconnect`,this.configuration.onDisconnect),this.configuration.websocketProvider.off(`disconnect`,this.forwardDisconnect),this.configuration.websocketProvider.off(`destroy`,this.configuration.onDestroy),this.configuration.websocketProvider.off(`destroy`,this.forwardDestroy),this.configuration.websocketProvider.detach(this),this._isAttached=!1}attach(){this._isAttached||=(this.configuration.websocketProvider.on(`connect`,this.configuration.onConnect),this.configuration.websocketProvider.on(`connect`,this.forwardConnect),this.configuration.websocketProvider.on(`status`,this.configuration.onStatus),this.configuration.websocketProvider.on(`status`,this.forwardStatus),this.configuration.websocketProvider.on(`open`,this.boundOnOpen),this.configuration.websocketProvider.on(`close`,this.boundOnClose),this.configuration.websocketProvider.on(`close`,this.configuration.onClose),this.configuration.websocketProvider.on(`close`,this.forwardClose),this.configuration.websocketProvider.on(`disconnect`,this.configuration.onDisconnect),this.configuration.websocketProvider.on(`disconnect`,this.forwardDisconnect),this.configuration.websocketProvider.on(`destroy`,this.configuration.onDestroy),this.configuration.websocketProvider.on(`destroy`,this.forwardDestroy),this.configuration.websocketProvider.attach(this),!0)}permissionDeniedHandler(e){this.emit(`authenticationFailed`,{reason:e}),this.isAuthenticated=!1}authenticatedHandler(e){this.isAuthenticated=!0,this.authorizedScope=e,this.emit(`authenticated`,{scope:e})}setAwarenessField(e,t){if(!this.awareness)throw new eu(`Cannot set awareness field "${e}" to ${JSON.stringify(t)}. You have disabled Awareness for this provider by explicitly passing awareness: null in the provider configuration.`);this.awareness.setLocalStateField(e,t)}};function nu(e,t,n=null,r=null){let i={...me()};return e!==null&&(i.principalId=e.principalId,i.tabSessionId=e.tabSessionId),t!==null&&t.length>0&&(i.expectedServerInstanceId=t),n!==null&&n.length>0&&(i.expectedBranch=n),r!==null&&r.length>0&&(i.expectedDocLineageEpoch=r),JSON.stringify(i)}function ru(e,t,n){let r=(0,he.c)(5),i,a;r[0]!==e||r[1]!==t||r[2]!==n?(i=()=>{!e||!n||typeof e.setLanguagePreference==`function`&&e.setLanguagePreference(t??`system`).catch(e=>{console.warn(JSON.stringify({event:`language-preference-push-failed`,preference:t??`system`,error:e instanceof Error?e.message:String(e)}))})},a=[e,t,n],r[0]=e,r[1]=t,r[2]=n,r[3]=i,r[4]=a):(i=r[3],a=r[4]),(0,p.useEffect)(i,a)}function iu(e){let t=/^rgba?\(([^)]*)\)$/i.exec(e.trim())?.[1];if(t===void 0)return null;let n=t.split(/[\s,/]+/).filter(Boolean);if(n.length<3)return null;let r=`#`;for(let e=0;e<3;e++){let t=Math.round(Number(n[e]));if(!Number.isFinite(t)||t<0||t>255)return null;r+=t.toString(16).padStart(2,`0`)}return r}function au(e){if(typeof document>`u`)return null;let t=document.createElement(`canvas`).getContext(`2d`);if(!t)return null;t.fillStyle=`#000000`,t.fillStyle=e;let n=t.fillStyle;return t.fillStyle=`#ffffff`,t.fillStyle=e,t.fillStyle===n&&typeof n==`string`&&/^#[0-9a-f]{6}$/i.test(n)?n.toLowerCase():null}function ou(e){return au(e)??iu(e)}function su(e){let t=document.createElement(`span`);t.style.display=`none`,t.style.backgroundColor=`var(${e})`,document.body.appendChild(t);try{let e=getComputedStyle(t).backgroundColor;return!e||e===`rgba(0, 0, 0, 0)`||e.includes(`var(`)?null:ou(e)}finally{t.remove()}}function cu(){if(!(typeof document>`u`))try{let e=su(`--sidebar`),t=su(`--sidebar-foreground`);return!e||!t?void 0:{bg:e,symbol:t}}catch{return}}function lu(e,t,n){let r=(0,he.c)(10),i;r[0]!==e||r[1]!==t?(i=()=>{if(t!==`light`&&t!==`dark`&&t!==`system`||!e)return;let n=!1;return e.setThemeSource(t).catch(e=>{console.warn(JSON.stringify({event:`theme-source-set-failed`,themeValue:t,error:e instanceof Error?e.message:String(e)}))}).finally(()=>{if(n)return;let t=window.matchMedia(`(prefers-reduced-transparency: reduce)`).matches;e.signalThemeApplied({reducedTransparency:t,chrome:cu()})}),()=>{n=!0}},r[0]=e,r[1]=t,r[2]=i):i=r[2];let a;r[3]!==e||r[4]!==n||r[5]!==t?(a=[e,t,n],r[3]=e,r[4]=n,r[5]=t,r[6]=a):a=r[6],(0,p.useEffect)(i,a);let o,s;r[7]===e?(o=r[8],s=r[9]):(o=()=>{if(!e)return;let t=window.matchMedia(`(prefers-reduced-transparency: reduce)`),n=t=>{e.signalThemeApplied({reducedTransparency:t.matches,chrome:cu()})};return t.addEventListener(`change`,n),()=>{t.removeEventListener(`change`,n)}},s=[e],r[7]=e,r[8]=o,r[9]=s),(0,p.useEffect)(o,s)}var uu={en:()=>t(()=>import(`./messages-B-LUKCxb.js`).then(e=>e.n),__vite__mapDeps([0,1]),import.meta.url),"zh-Hans":()=>t(()=>import(`./messages-CkanzrCR.js`),[],import.meta.url),"zh-Hant":()=>t(()=>import(`./messages-52Q73NDn.js`),[],import.meta.url),hi:()=>t(()=>import(`./messages-CGjveR2E.js`),[],import.meta.url),es:()=>t(()=>import(`./messages-Cy75Ipbk.js`),[],import.meta.url),ar:()=>t(()=>import(`./messages-s-nrsPLp.js`),[],import.meta.url),fr:()=>t(()=>import(`./messages-BzwBNPDu.js`),[],import.meta.url),bn:()=>t(()=>import(`./messages-Bjt29O_q.js`),[],import.meta.url),"pt-BR":()=>t(()=>import(`./messages-D8H0FnV4.js`),[],import.meta.url),id:()=>t(()=>import(`./messages-Dl7JEKLk.js`),[],import.meta.url),ur:()=>t(()=>import(`./messages-D2UntltU.js`),[],import.meta.url)},du=new Set([`en`]),fu=`en`;async function pu(e){if(fu=e,!du.has(e)){let{default:t}=await uu[e]();ce.load(e,t.messages),du.add(e)}fu===e&&ce.activate(e)}function mu(){return!1}async function hu(){}var gu=`ok-locale-load-failed`;function _u(){window.location.reload()}function vu({locale:e,reload:t=_u}){let n=new Intl.DisplayNames([ce.locale],{type:`language`}).of(e)??e;le.error(ce._({id:`loE6tM`,values:{language:n}}),{id:gu,description:ce._({id:`GtPGNJ`}),duration:1/0,action:{label:ce._({id:`HpK_8d`}),onClick:t}})}function yu(){le.dismiss(gu)}var bu=`ok-language-v1`;function xu({preference:e,locale:t}){if(typeof document>`u`)return;let n=s(t),r=document.documentElement;r.lang=t,r.dir=n;try{localStorage.setItem(bu,JSON.stringify({pref:e,locale:t,dir:n}))}catch{}}function Su(e){return e===`system`?`system`:se.includes(e)?e:void 0}function Cu(){if(!(typeof localStorage>`u`))try{let e=localStorage.getItem(bu);return e===null?void 0:Su(JSON.parse(e).pref)}catch{return}}function wu(e){let t=(0,he.c)(4),{preference:n,userConfigSynced:r}=e,i,a;t[0]!==n||t[1]!==r?(i=()=>{if(mu()){hu().catch(Tu);return}if(!r)return;let{locale:e}=u({override:void 0,storedPreference:n,preferenceList:te(),supportedLocales:se,autoDetectableLocales:ae}),t=!1;return pu(e).then(()=>{t||(yu(),xu({preference:n??`system`,locale:e}))}).catch(n=>{console.warn(JSON.stringify({event:`ok-locale-activate-failed`,locale:e,error:String(n)})),!t&&vu({locale:e})}),()=>{t=!0}},a=[n,r],t[0]=n,t[1]=r,t[2]=i,t[3]=a):(i=t[2],a=t[3]),(0,p.useEffect)(i,a)}function Tu(e){console.warn(JSON.stringify({event:`ok-pseudo-locale-activate-failed`,error:String(e)}))}function Eu(e){let t=(0,he.c)(5),{setTheme:n}=i(),r;t[0]!==n||t[1]!==e?(r=()=>{(e===`light`||e===`dark`||e===`system`)&&n(e)},t[0]=n,t[1]=e,t[2]=r):r=t[2];let a;t[3]===e?a=t[4]:(a=[e],t[3]=e,t[4]=a),(0,p.useEffect)(r,a)}var Du=n();function Ou(e,t,n,r){console.warn(JSON.stringify({event:`ok-${e}-${n}`,docName:t,code:r?.code,reason:r?.reason??void 0}))}function ku(e,t,n,r){let i=new Vi,a=new tu({url:e,name:t,document:i,token:nu(null,r,null),onDisconnect:({event:e})=>Ou(`config-provider`,t,`disconnect`,e),onClose:({event:e})=>Ou(`config-provider`,t,`close`,e)}),o=re(a,n);return{binding:o,config:o.current(),cleanup:()=>{o.dispose(),a.destroy(),i.destroy()}}}function Au(e,t){let n=new Vi,r=new tu({url:e,name:ie,document:n,token:nu(null,t,null),onDisconnect:({event:e})=>Ou(`okignore-provider`,ie,`disconnect`,e),onClose:({event:e})=>Ou(`okignore-provider`,ie,`close`,e)}),i=o(r);return{binding:i,provider:r,cleanup:()=>{i.dispose(),r.destroy(),n.destroy()}}}function ju(e){let t=(0,he.c)(20),{collabUrl:n,children:r}=e,a=be(),{systemTheme:o}=i(),s=o===`dark`,[u,te]=(0,p.useState)(null),[re,ie]=(0,p.useState)(null),[ae,se]=(0,p.useState)(null),[ce,le]=(0,p.useState)(null),me,ge;t[0]!==n||t[1]!==a?(me=()=>{if(n===null)return;let e=ku(n,c,`user`,a),t=ku(n,oe,`project`,a),r=ku(n,ee,`project-local`,a),i=Au(n,a);te({binding:e.binding,config:e.config,synced:e.binding.hasSynced()}),ie({binding:t.binding,config:t.config,synced:t.binding.hasSynced()}),se({binding:r.binding,config:r.config,synced:r.binding.hasSynced()}),le({binding:i.binding,synced:!1});let o=e.binding.subscribe(t=>{te(n=>n?.binding===e.binding?{...n,config:t}:n)}),s=e.binding.subscribeSynced(()=>{te(t=>t?.binding===e.binding?{...t,synced:!0}:t)}),l=t.binding.subscribe(e=>{ie(n=>n?.binding===t.binding?{...n,config:e}:n)}),u=t.binding.subscribeSynced(()=>{ie(e=>e?.binding===t.binding?{...e,synced:!0}:e)}),d=r.binding.subscribe(e=>{se(t=>t?.binding===r.binding?{...t,config:e}:t)}),f=r.binding.subscribeSynced(()=>{se(e=>e?.binding===r.binding?{...e,synced:!0}:e)}),ne=()=>{le(e=>e?.binding===i.binding?{...e,synced:!0}:e)};return i.provider.on(`synced`,ne),()=>{o(),s(),l(),u(),d(),f(),i.provider.off(`synced`,ne);for(let n of[e,t,r,i])try{n.cleanup()}catch(e){console.warn(JSON.stringify({event:`ok-config-provider-cleanup-error`,error:String(e)}))}te(t=>t?.binding===e.binding?null:t),ie(e=>e?.binding===t.binding?null:e),se(e=>e?.binding===r.binding?null:e),le(e=>e?.binding===i.binding?null:e)}},ge=[n,a],t[0]=n,t[1]=a,t[2]=me,t[3]=ge):(me=t[2],ge=t[3]),(0,p.useEffect)(me,ge);let m=u&&re?f(u.config,re.config,ae?.config):null,_e=m?.appearance?.theme,ve=m?.appearance?.customTheme,ye=m?.appearance?.colorThemeEnabled!==!1,h=d(m?.appearance),xe=ne(_e,s),g=ye?h[xe]:`default`,Se=g===`custom`?pe(ue(ve)):l(g)??_e;Eu(Se),fe({selection:h,modePreference:_e,slotMode:xe,customSeed:ve,enabled:ye}),wu({preference:m?.appearance?.language,userConfigSynced:u?.synced??!1}),ru(typeof window<`u`?window.okDesktop:void 0,m?.appearance?.language,u?.synced??!1),lu(typeof window<`u`?window.okDesktop:void 0,Se??`system`,`${g}:${g===`custom`?JSON.stringify(ve??null):``}`);let Ce=u?.binding??null,_=u?.synced??!1,we=re?.binding??null,Te=ae?.binding??null,v=ce?.binding??null,Ee=ce?.synced??!1,De=u?.config??null,Oe=re?.config??null,y=re?.synced??!1,ke=ae?.config??null,Ae=ae?.synced??!1,b;t[4]!==m||t[5]!==Oe||t[6]!==y||t[7]!==ke||t[8]!==Ae||t[9]!==Ce||t[10]!==_||t[11]!==we||t[12]!==Te||t[13]!==v||t[14]!==Ee||t[15]!==De?(b={userBinding:Ce,userSynced:_,projectBinding:we,projectLocalBinding:Te,okignoreBinding:v,okignoreSynced:Ee,userConfig:De,projectConfig:Oe,projectSynced:y,projectLocalConfig:ke,projectLocalSynced:Ae,merged:m},t[4]=m,t[5]=Oe,t[6]=y,t[7]=ke,t[8]=Ae,t[9]=Ce,t[10]=_,t[11]=we,t[12]=Te,t[13]=v,t[14]=Ee,t[15]=De,t[16]=b):b=t[16];let je=b,Me;return t[17]!==r||t[18]!==je?(Me=(0,Du.jsx)(de,{value:je,children:r}),t[17]=r,t[18]=je,t[19]=Me):Me=t[19],Me}export{E as $,fa as A,ci as B,Fi as C,Na as D,Oa as E,ki as F,Fn as G,$r as H,Ca as I,mn as J,Nn as K,Pa as L,ba as M,ji as N,ca as O,xa as P,T as Q,V as R,Aa as S,wa as T,ei as U,F as V,j as W,tn as X,un as Y,Zt as Z,ys as _,lu as a,_ as at,na as b,G as c,ve as ct,Vi as d,D as et,q as f,ms as g,to as h,wu as i,Ae as it,z as j,oa as k,Us as l,Ma as m,Su as n,Ne as nt,nu as o,h as ot,Sa as p,wn as q,Cu as r,Me as rt,tu as s,g as st,ju as t,qe as tt,K as u,ws as v,L as w,ja as x,ra as y,ko as z};
@@ -1,4 +1,4 @@
1
- import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{t as n}from"./react-f2sANaYj.js";import{n as r}from"./dist-Nvb76hAm.js";import{t as i}from"./compiler-runtime-BfE3aGVn.js";import{t as a}from"./utils-CPqDy6Hr.js";import{t as o}from"./button-RQ5o7P7w.js";import{a as s,n as c}from"./dist-DUWYPul7.js";import{c as l,i as u,l as d,n as f,o as p,r as m,s as h}from"./dist-Bi80hc1t.js";import{n as g,t as _}from"./dist-DY-494HN.js";import{i as v,n as y,r as ee,t as te}from"./es2015-B2hWAwcf.js";import{t as ne}from"./x-COTyTduF.js";var b=e(n(),1),x=t(),S=`Dialog`,[C,re]=l(S),[ie,w]=C(S),T=e=>{let{__scopeDialog:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!0}=e,s=b.useRef(null),c=b.useRef(null),[l,d]=u({prop:r,defaultProp:i??!1,onChange:a,caller:S});return(0,x.jsx)(ie,{scope:t,triggerRef:s,contentRef:c,contentId:f(),titleId:f(),descriptionId:f(),open:l,onOpenChange:d,onOpenToggle:b.useCallback(()=>d(e=>!e),[d]),modal:o,children:n})};T.displayName=S;var E=`DialogTrigger`,D=b.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=w(E,n),a=s(t,i.triggerRef);return(0,x.jsx)(d.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.contentId,"data-state":W(i.open),...r,ref:a,onClick:p(e.onClick,i.onOpenToggle)})});D.displayName=E;var O=`DialogPortal`,[k,A]=C(O,{forceMount:void 0}),j=e=>{let{__scopeDialog:t,forceMount:n,children:r,container:i}=e,a=w(O,t);return(0,x.jsx)(k,{scope:t,forceMount:n,children:b.Children.map(r,e=>(0,x.jsx)(m,{present:n||a.open,children:(0,x.jsx)(_,{asChild:!0,container:i,children:e})}))})};j.displayName=O;var M=`DialogOverlay`,N=b.forwardRef((e,t)=>{let n=A(M,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=w(M,e.__scopeDialog);return a.modal?(0,x.jsx)(m,{present:r||a.open,children:(0,x.jsx)(ae,{...i,ref:t})}):null});N.displayName=M;var P=c(`DialogOverlay.RemoveScroll`),ae=b.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=w(M,n);return(0,x.jsx)(y,{as:P,allowPinchZoom:!0,shards:[i.contentRef],children:(0,x.jsx)(d.div,{"data-state":W(i.open),...r,ref:t,style:{pointerEvents:`auto`,...r.style}})})}),F=`DialogContent`,I=b.forwardRef((e,t)=>{let n=A(F,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=w(F,e.__scopeDialog);return(0,x.jsx)(m,{present:r||a.open,children:a.modal?(0,x.jsx)(oe,{...i,ref:t}):(0,x.jsx)(se,{...i,ref:t})})});I.displayName=F;var oe=b.forwardRef((e,t)=>{let n=w(F,e.__scopeDialog),r=b.useRef(null),i=s(t,n.contentRef,r);return b.useEffect(()=>{let e=r.current;if(e)return te(e)},[]),(0,x.jsx)(L,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:p(e.onCloseAutoFocus,e=>{e.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:p(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;(t.button===2||n)&&e.preventDefault()}),onFocusOutside:p(e.onFocusOutside,e=>e.preventDefault())})}),se=b.forwardRef((e,t)=>{let n=w(F,e.__scopeDialog),r=b.useRef(!1),i=b.useRef(!1);return(0,x.jsx)(L,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})}),L=b.forwardRef((e,t)=>{let{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,...o}=e,c=w(F,n),l=b.useRef(null),u=s(t,l);return ee(),(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(v,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,x.jsx)(g,{role:`dialog`,id:c.contentId,"aria-describedby":c.descriptionId,"aria-labelledby":c.titleId,"data-state":W(c.open),...o,ref:u,onDismiss:()=>c.onOpenChange(!1)})}),(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(le,{titleId:c.titleId}),(0,x.jsx)(de,{contentRef:l,descriptionId:c.descriptionId})]})]})}),R=`DialogTitle`,z=b.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=w(R,n);return(0,x.jsx)(d.h2,{id:i.titleId,...r,ref:t})});z.displayName=R;var B=`DialogDescription`,V=b.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=w(B,n);return(0,x.jsx)(d.p,{id:i.descriptionId,...r,ref:t})});V.displayName=B;var H=`DialogClose`,U=b.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=w(H,n);return(0,x.jsx)(d.button,{type:`button`,...r,ref:t,onClick:p(e.onClick,()=>i.onOpenChange(!1))})});U.displayName=H;function W(e){return e?`open`:`closed`}var G=`DialogTitleWarning`,[ce,K]=h(G,{contentName:F,titleName:R,docsSlug:`dialog`}),le=({titleId:e})=>{let t=K(G),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
1
+ import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{t as n}from"./react-f2sANaYj.js";import{n as r}from"./dist-Nvb76hAm.js";import{t as i}from"./compiler-runtime-BfE3aGVn.js";import{t as a}from"./utils-CPqDy6Hr.js";import{t as o}from"./button-RQ5o7P7w.js";import{a as s,n as c}from"./dist-DUWYPul7.js";import{c as l,i as u,l as d,n as f,o as p,r as m,s as h}from"./dist-Bi80hc1t.js";import{n as g,t as _}from"./dist-DY-494HN.js";import{i as v,n as y,r as ee,t as te}from"./es2015-B2hWAwcf.js";import{t as ne}from"./x-D8xzRaMT.js";var b=e(n(),1),x=t(),S=`Dialog`,[C,re]=l(S),[ie,w]=C(S),T=e=>{let{__scopeDialog:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!0}=e,s=b.useRef(null),c=b.useRef(null),[l,d]=u({prop:r,defaultProp:i??!1,onChange:a,caller:S});return(0,x.jsx)(ie,{scope:t,triggerRef:s,contentRef:c,contentId:f(),titleId:f(),descriptionId:f(),open:l,onOpenChange:d,onOpenToggle:b.useCallback(()=>d(e=>!e),[d]),modal:o,children:n})};T.displayName=S;var E=`DialogTrigger`,D=b.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=w(E,n),a=s(t,i.triggerRef);return(0,x.jsx)(d.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.contentId,"data-state":W(i.open),...r,ref:a,onClick:p(e.onClick,i.onOpenToggle)})});D.displayName=E;var O=`DialogPortal`,[k,A]=C(O,{forceMount:void 0}),j=e=>{let{__scopeDialog:t,forceMount:n,children:r,container:i}=e,a=w(O,t);return(0,x.jsx)(k,{scope:t,forceMount:n,children:b.Children.map(r,e=>(0,x.jsx)(m,{present:n||a.open,children:(0,x.jsx)(_,{asChild:!0,container:i,children:e})}))})};j.displayName=O;var M=`DialogOverlay`,N=b.forwardRef((e,t)=>{let n=A(M,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=w(M,e.__scopeDialog);return a.modal?(0,x.jsx)(m,{present:r||a.open,children:(0,x.jsx)(ae,{...i,ref:t})}):null});N.displayName=M;var P=c(`DialogOverlay.RemoveScroll`),ae=b.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=w(M,n);return(0,x.jsx)(y,{as:P,allowPinchZoom:!0,shards:[i.contentRef],children:(0,x.jsx)(d.div,{"data-state":W(i.open),...r,ref:t,style:{pointerEvents:`auto`,...r.style}})})}),F=`DialogContent`,I=b.forwardRef((e,t)=>{let n=A(F,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=w(F,e.__scopeDialog);return(0,x.jsx)(m,{present:r||a.open,children:a.modal?(0,x.jsx)(oe,{...i,ref:t}):(0,x.jsx)(se,{...i,ref:t})})});I.displayName=F;var oe=b.forwardRef((e,t)=>{let n=w(F,e.__scopeDialog),r=b.useRef(null),i=s(t,n.contentRef,r);return b.useEffect(()=>{let e=r.current;if(e)return te(e)},[]),(0,x.jsx)(L,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:p(e.onCloseAutoFocus,e=>{e.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:p(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;(t.button===2||n)&&e.preventDefault()}),onFocusOutside:p(e.onFocusOutside,e=>e.preventDefault())})}),se=b.forwardRef((e,t)=>{let n=w(F,e.__scopeDialog),r=b.useRef(!1),i=b.useRef(!1);return(0,x.jsx)(L,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})}),L=b.forwardRef((e,t)=>{let{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,...o}=e,c=w(F,n),l=b.useRef(null),u=s(t,l);return ee(),(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(v,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,x.jsx)(g,{role:`dialog`,id:c.contentId,"aria-describedby":c.descriptionId,"aria-labelledby":c.titleId,"data-state":W(c.open),...o,ref:u,onDismiss:()=>c.onOpenChange(!1)})}),(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(le,{titleId:c.titleId}),(0,x.jsx)(de,{contentRef:l,descriptionId:c.descriptionId})]})]})}),R=`DialogTitle`,z=b.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=w(R,n);return(0,x.jsx)(d.h2,{id:i.titleId,...r,ref:t})});z.displayName=R;var B=`DialogDescription`,V=b.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=w(B,n);return(0,x.jsx)(d.p,{id:i.descriptionId,...r,ref:t})});V.displayName=B;var H=`DialogClose`,U=b.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=w(H,n);return(0,x.jsx)(d.button,{type:`button`,...r,ref:t,onClick:p(e.onClick,()=>i.onOpenChange(!1))})});U.displayName=H;function W(e){return e?`open`:`closed`}var G=`DialogTitleWarning`,[ce,K]=h(G,{contentName:F,titleName:R,docsSlug:`dialog`}),le=({titleId:e})=>{let t=K(G),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
2
2
 
3
3
  If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
4
4