kritzel-stencil 0.3.34 → 0.3.35

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 (142) hide show
  1. package/dist/cjs/index-Xav9JFHg.js +2 -2
  2. package/dist/cjs/index.cjs.js +1 -1
  3. package/dist/cjs/{kritzel-active-users_45.cjs.entry.js → kritzel-active-users_46.cjs.entry.js} +107 -74
  4. package/dist/cjs/loader.cjs.js +1 -1
  5. package/dist/cjs/{schema.constants-D7Z8ELAd.js → schema.constants-Di56GD6q.js} +14 -3
  6. package/dist/cjs/stencil.cjs.js +1 -1
  7. package/dist/collection/classes/objects/shape.class.js +14 -3
  8. package/dist/collection/collection-manifest.json +1 -0
  9. package/dist/collection/components/core/kritzel-editor/kritzel-editor.css +5 -0
  10. package/dist/collection/components/core/kritzel-editor/kritzel-editor.js +26 -18
  11. package/dist/collection/components/core/kritzel-engine/kritzel-engine.css +0 -41
  12. package/dist/collection/components/core/kritzel-engine/kritzel-engine.js +20 -2
  13. package/dist/collection/components/core/kritzel-watermark/kritzel-watermark.js +1 -1
  14. package/dist/collection/components/shared/kritzel-avatar/kritzel-avatar.js +3 -3
  15. package/dist/collection/components/shared/kritzel-button/kritzel-button.css +1 -0
  16. package/dist/collection/components/shared/kritzel-button/kritzel-button.js +2 -2
  17. package/dist/collection/components/shared/kritzel-color/kritzel-color.js +2 -2
  18. package/dist/collection/components/shared/kritzel-color-palette/kritzel-color-palette.js +1 -1
  19. package/dist/collection/components/shared/kritzel-font/kritzel-font.js +1 -1
  20. package/dist/collection/components/shared/kritzel-font-size/kritzel-font-size.js +1 -1
  21. package/dist/collection/components/shared/kritzel-input/kritzel-input.js +1 -1
  22. package/dist/collection/components/shared/kritzel-master-detail/kritzel-master-detail.js +3 -3
  23. package/dist/collection/components/shared/kritzel-menu/kritzel-menu.js +1 -1
  24. package/dist/collection/components/shared/kritzel-menu-item/kritzel-menu-item.js +2 -2
  25. package/dist/collection/components/shared/kritzel-numeric-input/kritzel-numeric-input.js +1 -1
  26. package/dist/collection/components/shared/kritzel-opacity-slider/kritzel-opacity-slider.js +1 -1
  27. package/dist/collection/components/shared/kritzel-portal/kritzel-portal.js +1 -1
  28. package/dist/collection/components/shared/kritzel-slide-toggle/kritzel-slide-toggle.js +1 -1
  29. package/dist/collection/components/shared/kritzel-split-button/kritzel-split-button.js +1 -1
  30. package/dist/collection/components/shared/kritzel-stroke-size/kritzel-stroke-size.js +1 -1
  31. package/dist/collection/components/shared/kritzel-tooltip/kritzel-tooltip.js +2 -2
  32. package/dist/collection/components/ui/kritzel-back-to-content/kritzel-back-to-content.js +1 -1
  33. package/dist/collection/components/ui/kritzel-controls/kritzel-controls.js +6 -6
  34. package/dist/collection/components/ui/kritzel-current-user/kritzel-current-user.js +1 -8
  35. package/dist/collection/components/ui/kritzel-current-user-dialog/kritzel-current-user-dialog.css +10 -0
  36. package/dist/collection/components/ui/kritzel-current-user-dialog/kritzel-current-user-dialog.js +25 -1
  37. package/dist/collection/components/ui/kritzel-export/kritzel-export.js +1 -1
  38. package/dist/collection/components/ui/kritzel-loading-overlay/kritzel-loading-overlay.css +50 -0
  39. package/dist/collection/components/ui/kritzel-loading-overlay/kritzel-loading-overlay.js +70 -0
  40. package/dist/collection/components/ui/kritzel-login-dialog/kritzel-login-dialog.js +1 -1
  41. package/dist/collection/components/ui/kritzel-more-menu/kritzel-more-menu.js +1 -1
  42. package/dist/collection/components/ui/kritzel-settings/kritzel-settings.js +1 -1
  43. package/dist/collection/components/ui/kritzel-share-dialog/kritzel-share-dialog.js +2 -2
  44. package/dist/collection/components/ui/kritzel-utility-panel/kritzel-utility-panel.js +1 -1
  45. package/dist/collection/components/ui/kritzel-zoom-panel/kritzel-zoom-panel.js +1 -1
  46. package/dist/collection/constants/version.js +1 -1
  47. package/dist/components/index.d.ts +2 -0
  48. package/dist/components/index.js +1 -1
  49. package/dist/components/kritzel-active-users.js +1 -1
  50. package/dist/components/kritzel-avatar.js +1 -1
  51. package/dist/components/kritzel-back-to-content.js +1 -1
  52. package/dist/components/kritzel-button.js +1 -1
  53. package/dist/components/kritzel-color-palette.js +1 -1
  54. package/dist/components/kritzel-color.js +1 -1
  55. package/dist/components/kritzel-controls.js +1 -1
  56. package/dist/components/kritzel-current-user-dialog.js +1 -1
  57. package/dist/components/kritzel-current-user.js +1 -1
  58. package/dist/components/kritzel-editor.js +1 -1
  59. package/dist/components/kritzel-engine.js +1 -1
  60. package/dist/components/kritzel-export.js +1 -1
  61. package/dist/components/kritzel-font-size.js +1 -1
  62. package/dist/components/kritzel-font.js +1 -1
  63. package/dist/components/kritzel-input.js +1 -1
  64. package/dist/components/kritzel-loading-overlay.d.ts +11 -0
  65. package/dist/components/kritzel-loading-overlay.js +1 -0
  66. package/dist/components/kritzel-login-dialog.js +1 -1
  67. package/dist/components/kritzel-master-detail.js +1 -1
  68. package/dist/components/kritzel-menu-item.js +1 -1
  69. package/dist/components/kritzel-menu.js +1 -1
  70. package/dist/components/kritzel-more-menu.js +1 -1
  71. package/dist/components/kritzel-numeric-input.js +1 -1
  72. package/dist/components/kritzel-opacity-slider.js +1 -1
  73. package/dist/components/kritzel-portal.js +1 -1
  74. package/dist/components/kritzel-settings.js +1 -1
  75. package/dist/components/kritzel-share-dialog.js +1 -1
  76. package/dist/components/kritzel-slide-toggle.js +1 -1
  77. package/dist/components/kritzel-split-button.js +1 -1
  78. package/dist/components/kritzel-stroke-size.js +1 -1
  79. package/dist/components/kritzel-tool-config.js +1 -1
  80. package/dist/components/kritzel-tooltip.js +1 -1
  81. package/dist/components/kritzel-utility-panel.js +1 -1
  82. package/dist/components/kritzel-watermark.js +1 -1
  83. package/dist/components/kritzel-workspace-manager.js +1 -1
  84. package/dist/components/kritzel-zoom-panel.js +1 -1
  85. package/dist/components/{p-wl9BhN6s.js → p-1nG2hxfJ.js} +1 -1
  86. package/dist/components/{p-Cb5YwXbC.js → p-8xkoVMfO.js} +1 -1
  87. package/dist/components/{p-BeHVCJ7n.js → p-BH4AasB1.js} +1 -1
  88. package/dist/components/{p-BVu03tNB.js → p-BJlf4iHH.js} +1 -1
  89. package/dist/components/{p-BntMEYss.js → p-BKOsmXB5.js} +1 -1
  90. package/dist/components/{p-DSd5xTAH.js → p-BLOPBDUF.js} +1 -1
  91. package/dist/components/p-B_6RNask.js +1 -0
  92. package/dist/components/{p-8p1DKytO.js → p-Bd_yPNfg.js} +1 -1
  93. package/dist/components/{p-BUc0GFPj.js → p-BlozPPKi.js} +1 -1
  94. package/dist/components/{p-7ZnANv7C.js → p-Bm_BWQa4.js} +1 -1
  95. package/dist/components/{p-BixEMVtW.js → p-BulDbBWB.js} +1 -1
  96. package/dist/components/{p-D0RYktBV.js → p-BzJEwFtn.js} +1 -1
  97. package/dist/components/{p-CdkNxxut.js → p-BzrxIesp.js} +1 -1
  98. package/dist/components/{p-CfS-5J9k.js → p-CMphprF1.js} +1 -1
  99. package/dist/components/{p-D0v9WP5w.js → p-CVhcOiEA.js} +1 -1
  100. package/dist/components/{p-CC0J_kEP.js → p-CwuGA058.js} +1 -1
  101. package/dist/components/p-D52oKO_e.js +1 -0
  102. package/dist/components/{p-M9m9-OEY.js → p-D8TOEhPY.js} +1 -1
  103. package/dist/components/p-D9BugXUi.js +9 -0
  104. package/dist/components/{p-DJVRW9So.js → p-DEqpY4K2.js} +1 -1
  105. package/dist/components/{p-BrAeYciD.js → p-DIMNEOTW.js} +1 -1
  106. package/dist/components/{p-DeqALrzV.js → p-DMAScsJF.js} +1 -1
  107. package/dist/components/{p-DYLBjStF.js → p-DPpPd5GI.js} +1 -1
  108. package/dist/components/{p-Bg0xIZiR.js → p-DSOc0eIT.js} +1 -1
  109. package/dist/components/{p-W1ZwImdd.js → p-DXcjIb_a.js} +1 -1
  110. package/dist/components/{p-DPlEzPKO.js → p-DZcwchEg.js} +1 -1
  111. package/dist/components/{p-BX-nQAyH.js → p-DgnK50xO.js} +1 -1
  112. package/dist/components/p-Di5dpXrF.js +1 -0
  113. package/dist/components/{p-CZQz_mul.js → p-Ds-P2bYH.js} +1 -1
  114. package/dist/components/{p-meY80XnF.js → p-jzuGPW5o.js} +1 -1
  115. package/dist/components/p-oGAPPwAL.js +1 -0
  116. package/dist/components/{p-DZ8yfhhf.js → p-sLHApVnR.js} +1 -1
  117. package/dist/components/{p-DEpnJBA3.js → p-yD_3Z3K1.js} +1 -1
  118. package/dist/components/{p-BcB97x3U.js → p-zd7zXld8.js} +1 -1
  119. package/dist/esm/index-Dhio9uis.js +2 -2
  120. package/dist/esm/index.js +2 -2
  121. package/dist/esm/{kritzel-active-users_45.entry.js → kritzel-active-users_46.entry.js} +107 -75
  122. package/dist/esm/loader.js +1 -1
  123. package/dist/esm/{schema.constants-CDQonV1J.js → schema.constants-Cphx5M7a.js} +14 -3
  124. package/dist/esm/stencil.js +1 -1
  125. package/dist/stencil/index.esm.js +1 -1
  126. package/dist/stencil/{p-CDQonV1J.js → p-Cphx5M7a.js} +1 -1
  127. package/dist/stencil/p-ac77b486.entry.js +9 -0
  128. package/dist/stencil/stencil.esm.js +1 -1
  129. package/dist/types/components/core/kritzel-editor/kritzel-editor.d.ts +5 -0
  130. package/dist/types/components/core/kritzel-engine/kritzel-engine.d.ts +2 -0
  131. package/dist/types/components/ui/kritzel-current-user/kritzel-current-user.d.ts +0 -3
  132. package/dist/types/components/ui/kritzel-current-user-dialog/kritzel-current-user-dialog.d.ts +4 -0
  133. package/dist/types/components/ui/kritzel-loading-overlay/kritzel-loading-overlay.d.ts +11 -0
  134. package/dist/types/components.d.ts +61 -0
  135. package/dist/types/constants/version.d.ts +1 -1
  136. package/dist/types/interfaces/theme.interface.d.ts +7 -0
  137. package/package.json +1 -1
  138. package/dist/components/p-COdwK_mi.js +0 -1
  139. package/dist/components/p-XDNjFYRB.js +0 -1
  140. package/dist/components/p-X_pyPCe8.js +0 -1
  141. package/dist/components/p-vLVZEJXX.js +0 -9
  142. package/dist/stencil/p-3289cc4e.entry.js +0 -9
@@ -123,9 +123,9 @@ export class KritzelShareDialog {
123
123
  this.dialogClosed.emit();
124
124
  };
125
125
  render() {
126
- return (h(Host, { key: '11d8762a3edf2c0563b70b863edbbb413ee8255e' }, h("kritzel-dialog", { key: 'f54de9dc8cc3e88ab0efd13e52bc78f9b84f2efa', dialogTitle: this.terms['share.dialogTitle'] ?? 'Share Workspace', size: "small", isOpen: this.isDialogOpen, onDialogClose: this.closeDialog, contained: true }, h("div", { key: '6a81278ab1d8e5ad10f2139232bc3baf039f03a8', class: "share-content" }, h("div", { key: '6c94cce83aec9f3777936c6e845e698b1013f240', class: "share-section" }, h("div", { key: '051672c0abbd0999889ef570a733921384c35076', class: "share-row" }, h("div", { key: '3200e9d96cd859ffc231a86895186cc0d0cc9f66', class: "share-label-group" }, h("label", { key: '14c3ed49917864fe92b7d1fdd6b2ee33526cbe30', class: "share-label" }, this.terms['share.linkSharing.label'] ?? 'Link sharing'), h("p", { key: 'b96763875cfda2a638df12857e14c06ac6b1945c', class: "share-description" }, this.internalIsPublic
126
+ return (h(Host, { key: 'b96c4cc6a9e4778715f496574f307a540285f70c' }, h("kritzel-dialog", { key: '9a9cead56cc50042f59f677c0a846fc9fff01a8b', dialogTitle: this.terms['share.dialogTitle'] ?? 'Share Workspace', size: "small", isOpen: this.isDialogOpen, onDialogClose: this.closeDialog, contained: true }, h("div", { key: 'f1ffe37126343d84f9cb70f85530596d594c6e04', class: "share-content" }, h("div", { key: 'e1b20fccdb127eb30d240a2812742977b6512113', class: "share-section" }, h("div", { key: 'fb0d4226d638309fd5696dace0cc0c73d82150fc', class: "share-row" }, h("div", { key: '301a27b975bb63610d94e1140aef39aa0594dda6', class: "share-label-group" }, h("label", { key: 'acf694843423d42414951ae88ec7eee541dd8f7f', class: "share-label" }, this.terms['share.linkSharing.label'] ?? 'Link sharing'), h("p", { key: '4c29b6448a27c69fceadb4166bc878216010475f', class: "share-description" }, this.internalIsPublic
127
127
  ? (this.terms['share.linkSharing.enabledDescription'] ?? 'Anyone with the link can access this workspace.')
128
- : (this.terms['share.linkSharing.disabledDescription'] ?? 'Link sharing is disabled. Only you can access this workspace.'))), h("kritzel-slide-toggle", { key: '4a476a3d323ee0932ca26bc59893eaf42fffc5af', checked: this.internalIsPublic, onCheckedChange: this.handleToggleChange, label: this.terms['share.linkSharing.toggleLabel'] ?? 'Enable link sharing' }))), this.internalIsPublic && (h("div", { key: 'c7da6b5d2dfaf0679e1d2a337f7a266a37d4792c', class: "share-section" }, h("div", { key: '2c8591b80e5742a6b1851feef438097c62d7a1b8', class: "share-url-container" }, h("input", { key: '4af045aa7ceb8e4878946c41da0362a58ec7c84d', type: "text", class: "share-url-input", value: this.getShareUrl(), readOnly: true, onClick: (e) => e.target.select() }), h("button", { key: '46123f1fdf1b4f4b56fd20d19d4c73ba27b32481', class: { 'copy-button': true, 'copy-success': this.copySuccess }, onClick: this.handleCopyUrl, title: this.copySuccess ? (this.terms['share.copyLink.copied'] ?? 'Copied!') : (this.terms['share.copyLink.title'] ?? 'Copy link') }, h("kritzel-icon", { key: '43f8574de6559ef62894b4e8e5bc9949474d2e20', name: this.copySuccess ? 'check' : 'copy', size: 18 }))), this.qrCodeDataUrl && (h("div", { key: 'dab1b497586b5a603c8de0f0e9d2637dc5b37971', class: "share-qr-container" }, h("img", { key: '3ea38e75688daa158c90aa337a91f58b758722c0', class: "share-qr-image", src: this.qrCodeDataUrl, alt: "QR code for share link" })))))))));
128
+ : (this.terms['share.linkSharing.disabledDescription'] ?? 'Link sharing is disabled. Only you can access this workspace.'))), h("kritzel-slide-toggle", { key: 'c813213e7cf53125993de209e15c921779c019b6', checked: this.internalIsPublic, onCheckedChange: this.handleToggleChange, label: this.terms['share.linkSharing.toggleLabel'] ?? 'Enable link sharing' }))), this.internalIsPublic && (h("div", { key: 'af32cbadc775ce4ca3c79bdc0f8b4351c8723b28', class: "share-section" }, h("div", { key: 'd5c4e2b8a77306a141cc73c37dc6c57b1dc9daa5', class: "share-url-container" }, h("input", { key: 'f2f364c3fabd7f693247f5ad05594bd089a194ea', type: "text", class: "share-url-input", value: this.getShareUrl(), readOnly: true, onClick: (e) => e.target.select() }), h("button", { key: 'd27a6f00e6b14bff3f4c8d1694cc8a38eebc5ec0', class: { 'copy-button': true, 'copy-success': this.copySuccess }, onClick: this.handleCopyUrl, title: this.copySuccess ? (this.terms['share.copyLink.copied'] ?? 'Copied!') : (this.terms['share.copyLink.title'] ?? 'Copy link') }, h("kritzel-icon", { key: '60c72ee8d789dc14baa4c169f70c78837b0cbd0c', name: this.copySuccess ? 'check' : 'copy', size: 18 }))), this.qrCodeDataUrl && (h("div", { key: 'f5d361b7ed145ab5f4f7b89f9c63046ce831220b', class: "share-qr-container" }, h("img", { key: '5f2d4650dffab907f5a53dfb2fd4c337da3e51ee', class: "share-qr-image", src: this.qrCodeDataUrl, alt: "QR code for share link" })))))))));
129
129
  }
130
130
  static get is() { return "kritzel-share-dialog"; }
131
131
  static get encapsulation() { return "shadow"; }
@@ -19,7 +19,7 @@ export class KritzelUtilityPanel {
19
19
  this.redo.emit();
20
20
  }
21
21
  render() {
22
- return (h(Host, { key: '40aeb81be7e767bf6565dd691d17b5dd283d997b' }, h("button", { key: '80bb960bf04d5e0bea09960e3bc5e0d999a8cb84', class: "utility-button", "data-testid": "utility-undo", disabled: !this.undoState?.canUndo, onClick: event => this.handleUndo(event), "aria-label": this.terms['utility.undo'] ?? 'Undo' }, h("kritzel-icon", { key: '7ab3d89a60f247cfb040fa1ff77aed7a4e616a0a', name: "undo" })), h("button", { key: 'fb5b7ee68a7488192bc053808f338fca72a22d79', class: "utility-button", "data-testid": "utility-redo", disabled: !this.undoState?.canRedo, onClick: event => this.handleRedo(event), "aria-label": this.terms['utility.redo'] ?? 'Redo' }, h("kritzel-icon", { key: '4da4fe3a445a9ae03981af51e73291c3f6b0fbbb', name: "redo" })), h("div", { key: '6144f7c81f06c6b1215230394e62df2120e5853a', class: "utility-separator" }), h("button", { key: '92839ee1dfb039a2f669326adce8d623dafe1aed', class: "utility-button", "data-testid": "utility-delete", onClick: () => this.delete.emit(), "aria-label": this.terms['utility.delete'] ?? 'Delete selected items' }, h("kritzel-icon", { key: '4071b04d37ddd033545ba92d2cedb164e6e96fdd', name: "delete" }))));
22
+ return (h(Host, { key: '90b96b2f4693016650394e085c1ccf5c61759713' }, h("button", { key: '325e3a869061ce7fda2d86e74250f4ea7414da8e', class: "utility-button", "data-testid": "utility-undo", disabled: !this.undoState?.canUndo, onClick: event => this.handleUndo(event), "aria-label": this.terms['utility.undo'] ?? 'Undo' }, h("kritzel-icon", { key: '70335427bc3a9a54a994ad22935bde4010d8f96b', name: "undo" })), h("button", { key: 'cf3000675d594ffe64f947b57e5aabe084be32a7', class: "utility-button", "data-testid": "utility-redo", disabled: !this.undoState?.canRedo, onClick: event => this.handleRedo(event), "aria-label": this.terms['utility.redo'] ?? 'Redo' }, h("kritzel-icon", { key: 'b33336374abb36a7cdb685fb970805ec1f4073e2', name: "redo" })), h("div", { key: '34323fd33574ba65c825687fec5b772facbd2c62', class: "utility-separator" }), h("button", { key: 'aff157ab166ed15b8f9172b5b63f62996ed51c6e', class: "utility-button", "data-testid": "utility-delete", onClick: () => this.delete.emit(), "aria-label": this.terms['utility.delete'] ?? 'Delete selected items' }, h("kritzel-icon", { key: '413104d9d493fc47ad5ae8e61af514dfd530f6ee', name: "delete" }))));
23
23
  }
24
24
  static get is() { return "kritzel-utility-panel"; }
25
25
  static get encapsulation() { return "shadow"; }
@@ -26,7 +26,7 @@ export class KritzelZoomPanel {
26
26
  return Number.isFinite(this.zoomPercent) ? Math.max(1, Math.round(this.zoomPercent)) : 100;
27
27
  }
28
28
  render() {
29
- return (h(Host, { key: '1535c002e9e93788c82c244b865ee2d78f850781' }, h("div", { key: '6f91dd43e5e871aa570b46c249b76b27cb392668', class: { panel: true, visible: this.visible } }, h("button", { key: '48eeff98207ee571b4d8636afaf951827181f7b4', class: "zoom-button", type: "button", "aria-label": this.terms['zoom.zoomOut'] ?? 'Zoom out', disabled: this.disabled, onClick: this.handleZoomOut }, h("kritzel-icon", { key: '8f8fb4adf11ad79d670ae0aa58944df0078373f7', name: "minus" })), h("span", { key: '382b1017593a3df8b902711380b211253aaf08d8', class: "zoom-level", "aria-live": "polite" }, this.normalizedZoomPercent, "%"), h("button", { key: '322aac46173ad6d0a2a74f3c45acd1e5936d5b6a', class: "zoom-button", type: "button", "aria-label": this.terms['zoom.zoomIn'] ?? 'Zoom in', disabled: this.disabled, onClick: this.handleZoomIn }, h("kritzel-icon", { key: '00ef24238db19388021ca1757b4e981339ce066a', name: "plus" })))));
29
+ return (h(Host, { key: '56b65a376d4bd94553416e07f2621192c4457bc2' }, h("div", { key: 'bdbfea3b3ee7e37eeb5c5f03388eb92ed8af9962', class: { panel: true, visible: this.visible } }, h("button", { key: 'de5ad152aaf7965f731bee95170b67e62af94ea2', class: "zoom-button", type: "button", "aria-label": this.terms['zoom.zoomOut'] ?? 'Zoom out', disabled: this.disabled, onClick: this.handleZoomOut }, h("kritzel-icon", { key: '104eb632666c55c032a40e6df2097aaa643fd23b', name: "minus" })), h("span", { key: 'd601b324e26a6c2737138b8f151b13dcdb2d20ab', class: "zoom-level", "aria-live": "polite" }, this.normalizedZoomPercent, "%"), h("button", { key: 'c976d03c69978f2d5cedf2a94b38419ed81088f6', class: "zoom-button", type: "button", "aria-label": this.terms['zoom.zoomIn'] ?? 'Zoom in', disabled: this.disabled, onClick: this.handleZoomIn }, h("kritzel-icon", { key: '844105bd53f3307425789aa6baf0ac3c25407414', name: "plus" })))));
30
30
  }
31
31
  static get is() { return "kritzel-zoom-panel"; }
32
32
  static get encapsulation() { return "shadow"; }
@@ -3,4 +3,4 @@
3
3
  * This file is auto-generated by the version bump scripts.
4
4
  * Do not modify manually.
5
5
  */
6
- export const KRITZEL_VERSION = '0.3.34';
6
+ export const KRITZEL_VERSION = '0.3.35';
@@ -47,6 +47,8 @@ export { KritzelInput as KritzelInput } from '../types/components/shared/kritzel
47
47
  export { defineCustomElement as defineCustomElementKritzelInput } from './kritzel-input';
48
48
  export { KritzelLineEndings as KritzelLineEndings } from '../types/components/shared/kritzel-line-endings/kritzel-line-endings';
49
49
  export { defineCustomElement as defineCustomElementKritzelLineEndings } from './kritzel-line-endings';
50
+ export { KritzelLoadingOverlay as KritzelLoadingOverlay } from '../types/components/ui/kritzel-loading-overlay/kritzel-loading-overlay';
51
+ export { defineCustomElement as defineCustomElementKritzelLoadingOverlay } from './kritzel-loading-overlay';
50
52
  export { KritzelLoginDialog as KritzelLoginDialog } from '../types/components/ui/kritzel-login-dialog/kritzel-login-dialog';
51
53
  export { defineCustomElement as defineCustomElementKritzelLoginDialog } from './kritzel-login-dialog';
52
54
  export { KritzelMasterDetail as KritzelMasterDetail } from '../types/components/shared/kritzel-master-detail/kritzel-master-detail';
@@ -1 +1 @@
1
- export{g as getAssetPath,r as render,s as setAssetPath,a as setNonce,b as setPlatformOptions}from"./p-B43upypT.js";export{K as KritzelBaseObject,b as KritzelLine,a as KritzelPath}from"./p-2Swq9rEm.js";export{A as AssetNotFoundError,I as IndexedDBAssetProvider,g as KritzelAssetResolver,d as KritzelBaseTool,b as KritzelGroup,a as KritzelImage,f as KritzelSelectionTool,c as KritzelShape,K as KritzelText,e as KritzelTextTool,S as ShapeType}from"./p-BVu03tNB.js";export{A as APP_STATE_MIGRATIONS,D as DE_LOCALE,E as EN_LOCALE,F as FR_LOCALE,k as KritzelAlignment,g as KritzelAnchorManager,a as KritzelBrushTool,f as KritzelCursorHelper,K as KritzelCustomElement,j as KritzelCustomElementRendererRegistry,c as KritzelEraserTool,d as KritzelImageTool,i as KritzelLicenseManager,b as KritzelLineTool,h as KritzelLocalizationManager,e as KritzelShapeTool,W as WORKSPACE_MIGRATIONS,r as runMigrations}from"./p-vLVZEJXX.js";import*as t from"yjs";import{IndexeddbPersistence as n}from"y-indexeddb";import{WebsocketProvider as o}from"y-websocket";import{H as m,a as u}from"./kritzel-editor.js";export{d as DEFAULT_ASSET_STORAGE_CONFIG,D as DEFAULT_BRUSH_CONFIG,c as DEFAULT_LINE_TOOL_CONFIG,b as DEFAULT_TEXT_CONFIG,KritzelEditor,defineCustomElement as defineCustomElementKritzelEditor}from"./kritzel-editor.js";export{K as KritzelWorkspace,W as WORKSPACE_EXPORT_VERSION}from"./p-DhMlShij.js";export{K as KritzelThemeManager,d as darkTheme,l as lightTheme}from"./p-BmyTdQGy.js";export{C as CURRENT_APP_STATE_SCHEMA_VERSION,a as CURRENT_WORKSPACE_SCHEMA_VERSION}from"./p-CW-VyJgK.js";export{KritzelActiveUsers,defineCustomElement as defineCustomElementKritzelActiveUsers}from"./kritzel-active-users.js";export{KritzelAvatar,defineCustomElement as defineCustomElementKritzelAvatar}from"./kritzel-avatar.js";export{KritzelAwarenessCursors,defineCustomElement as defineCustomElementKritzelAwarenessCursors}from"./kritzel-awareness-cursors.js";export{KritzelBackToContent,defineCustomElement as defineCustomElementKritzelBackToContent}from"./kritzel-back-to-content.js";export{KritzelBrushStyle,defineCustomElement as defineCustomElementKritzelBrushStyle}from"./kritzel-brush-style.js";export{KritzelButton,defineCustomElement as defineCustomElementKritzelButton}from"./kritzel-button.js";export{KritzelColor,defineCustomElement as defineCustomElementKritzelColor}from"./kritzel-color.js";export{KritzelColorPalette,defineCustomElement as defineCustomElementKritzelColorPalette}from"./kritzel-color-palette.js";export{KritzelContextMenu,defineCustomElement as defineCustomElementKritzelContextMenu}from"./kritzel-context-menu.js";export{KritzelControls,defineCustomElement as defineCustomElementKritzelControls}from"./kritzel-controls.js";export{KritzelCurrentUser,defineCustomElement as defineCustomElementKritzelCurrentUser}from"./kritzel-current-user.js";export{KritzelCurrentUserDialog,defineCustomElement as defineCustomElementKritzelCurrentUserDialog}from"./kritzel-current-user-dialog.js";export{KritzelCursorTrail,defineCustomElement as defineCustomElementKritzelCursorTrail}from"./kritzel-cursor-trail.js";export{KritzelDialog,defineCustomElement as defineCustomElementKritzelDialog}from"./kritzel-dialog.js";export{KritzelDropdown,defineCustomElement as defineCustomElementKritzelDropdown}from"./kritzel-dropdown.js";export{KritzelEngine,defineCustomElement as defineCustomElementKritzelEngine}from"./kritzel-engine.js";export{KritzelExport,defineCustomElement as defineCustomElementKritzelExport}from"./kritzel-export.js";export{KritzelFont,defineCustomElement as defineCustomElementKritzelFont}from"./kritzel-font.js";export{KritzelFontFamily,defineCustomElement as defineCustomElementKritzelFontFamily}from"./kritzel-font-family.js";export{KritzelFontSize,defineCustomElement as defineCustomElementKritzelFontSize}from"./kritzel-font-size.js";export{KritzelIcon,defineCustomElement as defineCustomElementKritzelIcon}from"./kritzel-icon.js";export{KritzelInput,defineCustomElement as defineCustomElementKritzelInput}from"./kritzel-input.js";export{KritzelLineEndings,defineCustomElement as defineCustomElementKritzelLineEndings}from"./kritzel-line-endings.js";export{KritzelLoginDialog,defineCustomElement as defineCustomElementKritzelLoginDialog}from"./kritzel-login-dialog.js";export{KritzelMasterDetail,defineCustomElement as defineCustomElementKritzelMasterDetail}from"./kritzel-master-detail.js";export{KritzelMenu,defineCustomElement as defineCustomElementKritzelMenu}from"./kritzel-menu.js";export{KritzelMenuItem,defineCustomElement as defineCustomElementKritzelMenuItem}from"./kritzel-menu-item.js";export{KritzelMoreMenu,defineCustomElement as defineCustomElementKritzelMoreMenu}from"./kritzel-more-menu.js";export{KritzelNotificationCard,defineCustomElement as defineCustomElementKritzelNotificationCard}from"./kritzel-notification-card.js";export{KritzelNumericInput,defineCustomElement as defineCustomElementKritzelNumericInput}from"./kritzel-numeric-input.js";export{KritzelOpacitySlider,defineCustomElement as defineCustomElementKritzelOpacitySlider}from"./kritzel-opacity-slider.js";export{KritzelPillTabs,defineCustomElement as defineCustomElementKritzelPillTabs}from"./kritzel-pill-tabs.js";export{KritzelPortal,defineCustomElement as defineCustomElementKritzelPortal}from"./kritzel-portal.js";export{KritzelSettings,defineCustomElement as defineCustomElementKritzelSettings}from"./kritzel-settings.js";export{KritzelShapeFill,defineCustomElement as defineCustomElementKritzelShapeFill}from"./kritzel-shape-fill.js";export{KritzelShareDialog,defineCustomElement as defineCustomElementKritzelShareDialog}from"./kritzel-share-dialog.js";export{KritzelSlideToggle,defineCustomElement as defineCustomElementKritzelSlideToggle}from"./kritzel-slide-toggle.js";export{KritzelSplitButton,defineCustomElement as defineCustomElementKritzelSplitButton}from"./kritzel-split-button.js";export{KritzelStrokeSize,defineCustomElement as defineCustomElementKritzelStrokeSize}from"./kritzel-stroke-size.js";export{KritzelToolConfig,defineCustomElement as defineCustomElementKritzelToolConfig}from"./kritzel-tool-config.js";export{KritzelTooltip,defineCustomElement as defineCustomElementKritzelTooltip}from"./kritzel-tooltip.js";export{KritzelUtilityPanel,defineCustomElement as defineCustomElementKritzelUtilityPanel}from"./kritzel-utility-panel.js";export{KritzelWatermark,defineCustomElement as defineCustomElementKritzelWatermark}from"./kritzel-watermark.js";export{KritzelWorkspaceManager,defineCustomElement as defineCustomElementKritzelWorkspaceManager}from"./kritzel-workspace-manager.js";export{KritzelZoomPanel,defineCustomElement as defineCustomElementKritzelZoomPanel}from"./kritzel-zoom-panel.js";const z=Math.floor,p=127,y=Number.MAX_SAFE_INTEGER;class w{constructor(){this.cpos=0,this.cbuf=new Uint8Array(100),this.bufs=[]}}const x=()=>new w,T=e=>{const t=new Uint8Array((e=>{let t=e.cpos;for(let s=0;s<e.bufs.length;s++)t+=e.bufs[s].length;return t})(e));let s=0;for(let i=0;i<e.bufs.length;i++){const n=e.bufs[i];t.set(n,s),s+=n.length}return t.set(new Uint8Array(e.cbuf.buffer,0,e.cpos),s),t},P=(e,t)=>{const s=e.cbuf.length;e.cpos===s&&(e.bufs.push(e.cbuf),e.cbuf=new Uint8Array(2*s),e.cpos=0),e.cbuf[e.cpos++]=t},v=(e,t)=>{for(;t>p;)P(e,128|p&t),t=z(t/128);P(e,p&t)},M=(e,t)=>{v(e,t.byteLength),((e,t)=>{const s=e.cbuf.length,i=e.cpos,n=((e,t)=>e<t?e:t)(s-i,t.length),o=t.length-n;e.cbuf.set(t.subarray(0,n),i),e.cpos+=n,o>0&&(e.bufs.push(e.cbuf),e.cbuf=new Uint8Array(((e,t)=>e>t?e:t)(2*s,o)),e.cbuf.set(t.subarray(n)),e.cpos=o)})(e,t)},U=e=>Error(e),_=U("Unexpected end of array"),O=U("Integer out of Range");class L{constructor(e){this.arr=e,this.pos=0}}const R=e=>((e,t)=>{const s=new Uint8Array(e.arr.buffer,e.pos+e.arr.byteOffset,t);return e.pos+=t,s})(e,$(e)),$=e=>{let t=0,s=1;const i=e.arr.length;for(;e.pos<i;){const i=e.arr[e.pos++];if(t+=(i&p)*s,s*=128,i<128)return t;if(t>y)throw O}throw _};class B{type="local";doc;channel;_synced=!1;constructor(e,t,s){this.doc=t,this.channel=new BroadcastChannel(e),this.channel.onmessage=e=>{this.handleMessage(e.data)},this.doc.on("update",this.handleDocUpdate),this.broadcastSync(),setTimeout((()=>{this._synced=!0}),100),s?.quiet||console.info("BroadcastChannel Provider initialized: "+e)}handleDocUpdate=(e,t)=>{if(t!==this){const t=x();v(t,0),M(t,e),this.channel.postMessage(T(t))}};handleMessage(e){const s=(e=>new L(e))(new Uint8Array(e));switch($(s)){case 0:const e=R(s);t.applyUpdate(this.doc,e,this);break;case 1:this.broadcastSync();break;case 2:const i=R(s),n=t.encodeStateAsUpdate(this.doc,i);if(n.length>0){const e=x();v(e,0),M(e,n),this.channel.postMessage(T(e))}}}broadcastSync(){const e=x();v(e,2),M(e,t.encodeStateVector(this.doc)),this.channel.postMessage(T(e))}async connect(){if(!this._synced)return new Promise((e=>{const t=()=>{this._synced?e():setTimeout(t,50)};t()}))}disconnect(){}async reconnect(){return this.disconnect(),this.connect()}destroy(){this.doc.off("update",this.handleDocUpdate),this.channel.close()}}const N=new Map;class H{type="local";doc;cacheKey;isConnected=!1;constructor(e,t,s){this.doc=t,this.cacheKey=s?.name??e}handleUpdate=(e,s)=>{s!==this&&N.set(this.cacheKey,t.encodeStateAsUpdate(this.doc))};async connect(){if(this.isConnected)return;const e=N.get(this.cacheKey);e&&t.applyUpdate(this.doc,e,this),this.doc.on("update",this.handleUpdate),this.isConnected=!0}disconnect(){this.isConnected=!1}async reconnect(){return this.disconnect(),this.connect()}destroy(){this.doc.off("update",this.handleUpdate),this.isConnected=!1}static clear(e){void 0!==e?N.delete(e):N.clear()}}class G{type="local";provider;isConnected=!1;constructor(e,t,s){this.provider=new n(s?.name||e,t)}async connect(){if(!this.isConnected)return new Promise((e=>{this.provider.on("synced",(()=>{this.isConnected=!0,e()}))}))}disconnect(){this.isConnected=!1}async reconnect(){return this.disconnect(),this.connect()}destroy(){this.provider&&this.provider.destroy(),this.isConnected=!1}}class V{type="network";provider;isConnected=!1;_quiet=!1;get awareness(){return this.provider.awareness}constructor(e,t,s){const i=s?.url||"ws://localhost:1234",n=s?.roomName||e;this.provider=new o(i,n,t,{params:s?.params,protocols:s?.protocols,WebSocketPolyfill:s?.WebSocketPolyfill,awareness:s?.awareness,maxBackoffTime:s?.maxBackoffTime,disableBc:!0}),this._quiet=s?.quiet??!1,this.setupEventListeners(),this._quiet||console.info(`WebSocket Provider initialized: ${i}/${n}`)}static with(e){return{create:(t,s,i)=>{const n=i?{...e,...i}:e;return new V(t,s,n)}}}setupEventListeners(){this.provider.on("status",(({status:e})=>{"connected"===e?(this.isConnected=!0,this._quiet||console.info("WebSocket connected")):"disconnected"===e&&(this.isConnected=!1,this._quiet||console.info("WebSocket disconnected"))})),this.provider.on("sync",(e=>{e&&!this._quiet&&console.info("WebSocket synced")}))}async connect(){if(!this.isConnected)return new Promise(((e,t)=>{const s=setTimeout((()=>{t(Error("WebSocket connection timeout"))}),1e4),i=({status:t})=>{"connected"===t&&(clearTimeout(s),this.provider.off("status",i),this.isConnected=!0,e())};this.provider.on("status",i),this.provider.wsconnected&&(clearTimeout(s),this.provider.off("status",i),this.isConnected=!0,e())}))}disconnect(){this.provider&&this.provider.disconnect(),this.isConnected=!1}async reconnect(){return this.disconnect(),this.connect()}destroy(){this.provider&&this.provider.destroy(),this.isConnected=!1}}class X{type="network";provider;isConnected=!1;isSynced=!1;usesSharedSocket=!1;isDestroyed=!1;connectTimeout=null;pendingConnectReject=null;connectionTimeoutMs;_connectionStatus="disconnected";visibilityHandler=null;onlineHandler=null;get awareness(){return this.provider.awareness}get connectionStatus(){return this._connectionStatus}static sharedWebSocketProvider=null;constructor(e,t,s){const i=s?.name||e,n=s?.url||"ws://localhost:1234";this.connectionTimeoutMs=s?.connectionTimeout??1e4;const o=s?.websocketProvider||X.sharedWebSocketProvider,r={};void 0!==s?.delay&&(r.delay=s.delay),void 0!==s?.factor&&(r.factor=s.factor),void 0!==s?.maxAttempts&&(r.maxAttempts=s.maxAttempts),void 0!==s?.minDelay&&(r.minDelay=s.minDelay),void 0!==s?.maxDelay&&(r.maxDelay=s.maxDelay);const l=()=>{this.isDestroyed||(this.isConnected=!0,this._connectionStatus="connected",s?.quiet||console.info("Hocuspocus connected: "+i),s?.onConnect&&s.onConnect())},a=()=>{this.isDestroyed||(this.isConnected=!1,this.isSynced=!1,this._connectionStatus="disconnected",s?.quiet||console.info("Hocuspocus disconnected: "+i),s?.onDisconnect&&s.onDisconnect())},c=()=>{this.isDestroyed||(this.isSynced=!0,this._connectionStatus="synced",s?.quiet||console.info("Hocuspocus synced: "+i),s?.onSynced&&s.onSynced())},d=e=>{this.isDestroyed||("connecting"===e.status&&(this._connectionStatus="connecting"),s?.onStatus&&s.onStatus(e))};if(o){this.usesSharedSocket=!0;const e={websocketProvider:o,name:i,document:t,token:s?.token||null,onStatus:d,onConnect:l,onDisconnect:a,onSynced:c,...r};void 0!==s?.forceSyncInterval&&(e.forceSyncInterval=s.forceSyncInterval),s?.onAuthenticationFailed&&(e.onAuthenticationFailed=s.onAuthenticationFailed),this.provider=new m(e),this.provider.attach(),s?.quiet||console.info("Hocuspocus Provider initialized (multiplexed): "+i)}else{this.usesSharedSocket=!1;const e={url:n,name:i,document:t,token:s?.token||null,autoConnect:!1,onStatus:d,onConnect:l,onDisconnect:a,onSynced:c,...r};void 0!==s?.forceSyncInterval&&(e.forceSyncInterval=s.forceSyncInterval),s?.onAuthenticationFailed&&(e.onAuthenticationFailed=s.onAuthenticationFailed),s?.WebSocketPolyfill&&(e.WebSocketPolyfill=s.WebSocketPolyfill),this.provider=new m(e),s?.quiet||console.info(`Hocuspocus Provider initialized: ${n}/${i}`)}this.setupBrowserEventListeners()}setupBrowserEventListeners(){"undefined"!=typeof document&&(this.visibilityHandler=()=>{"visible"!==document.visibilityState||this.isConnected||this.isDestroyed||this.provider.connect()},document.addEventListener("visibilitychange",this.visibilityHandler)),"undefined"!=typeof window&&(this.onlineHandler=()=>{this.isConnected||this.isDestroyed||this.provider.connect()},window.addEventListener("online",this.onlineHandler))}removeBrowserEventListeners(){this.visibilityHandler&&"undefined"!=typeof document&&(document.removeEventListener("visibilitychange",this.visibilityHandler),this.visibilityHandler=null),this.onlineHandler&&"undefined"!=typeof window&&(window.removeEventListener("online",this.onlineHandler),this.onlineHandler=null)}static createSharedWebSocket(e){if(X.sharedWebSocketProvider)return console.warn("Shared WebSocket already exists. Returning existing instance."),X.sharedWebSocketProvider;const t={url:e.url};return e.WebSocketPolyfill&&(t.WebSocketPolyfill=e.WebSocketPolyfill),e.onConnect&&(t.onConnect=e.onConnect),e.onDisconnect&&(t.onDisconnect=e.onDisconnect),e.onStatus&&(t.onStatus=e.onStatus),X.sharedWebSocketProvider=new u(t),console.info("Shared Hocuspocus WebSocket created: "+e.url),X.sharedWebSocketProvider}static destroySharedWebSocket(){X.sharedWebSocketProvider&&(X.sharedWebSocketProvider.destroy(),X.sharedWebSocketProvider=null,console.info("Shared Hocuspocus WebSocket destroyed"))}static getSharedWebSocket(){return X.sharedWebSocketProvider}static with(e){return{create:(t,s,i)=>{const n=i?{...e,...i}:e;return new X(t,s,n)}}}async connect(){if(!this.isSynced&&!this.isDestroyed)return this._connectionStatus="connecting",new Promise(((e,t)=>{this.pendingConnectReject=t,this.connectTimeout=setTimeout((()=>{this.pendingConnectReject=null,this.connectTimeout=null,t(Error("Hocuspocus connection timeout"))}),this.connectionTimeoutMs);const s=()=>{this.connectTimeout&&(clearTimeout(this.connectTimeout),this.connectTimeout=null),this.pendingConnectReject=null,this.provider.off("synced",s),this.isDestroyed||e()};if(this.provider.on("synced",s),this.provider.isSynced)return this.connectTimeout&&(clearTimeout(this.connectTimeout),this.connectTimeout=null),this.pendingConnectReject=null,this.provider.off("synced",s),void e();this.isConnected||this.usesSharedSocket||this.provider.connect()}))}async reconnect(){return this.disconnect(),this.connect()}disconnect(){this.connectTimeout&&(clearTimeout(this.connectTimeout),this.connectTimeout=null),this.pendingConnectReject&&(this.pendingConnectReject=null),this.provider&&(this.usesSharedSocket?this.provider.detach():this.provider.disconnect()),this.isConnected=!1,this.isSynced=!1,this._connectionStatus="disconnected"}destroy(){this.isDestroyed=!0,this.connectTimeout&&(clearTimeout(this.connectTimeout),this.connectTimeout=null),this.pendingConnectReject&&(this.pendingConnectReject=null),this.removeBrowserEventListeners(),this.provider&&this.provider.destroy(),this.isConnected=!1,this.isSynced=!1,this._connectionStatus="disconnected"}}class J{type="remote";name="HttpAssetProvider";_options;constructor(e){this._options=e}static with(e){return{create:()=>new J(e)}}async init(){this._options.quiet||console.info("HttpAssetProvider initialized")}destroy(){}canResolve(e){return!0}async put(e,t){const s=t.id??this.generateUuid(),i={...t,id:s},n=await(this._options.headers?.())??{},o=await this._options.uploadUrl(i),r=this._options.upload??this.defaultUpload;return{id:(await r(o,e,i,n)).id??s,kind:t.kind??"file",mimeType:t.mimeType,size:e.size,createdAt:Date.now(),width:t.width,height:t.height,durationMs:t.durationMs,originalFilename:t.originalFilename}}async resolve(e){return this._options.resolveUrl(e)}async fetch(e){const t=await this._options.resolveUrl(e),s=await(this._options.headers?.())??{},i=await fetch(t,{headers:s});if(!i.ok)throw Error(`[HttpAssetProvider] Failed to fetch asset ${e}: ${i.status} ${i.statusText}`);return i.blob()}async delete(e){if(!this._options.deleteUrl)return;const t=await this._options.deleteUrl(e),s=await(this._options.headers?.())??{},i=await fetch(t,{method:"DELETE",headers:s});if(!i.ok)throw Error(`[HttpAssetProvider] Failed to delete asset ${e}: ${i.status} ${i.statusText}`);this._options.quiet||console.info("HttpAssetProvider: deleted asset "+e)}defaultUpload=async(e,t,s,i)=>{const n=new FormData;n.append("metadata",JSON.stringify(s)),n.append("file",t,s.originalFilename||`${s.id}.${this.extensionFromMime(s.mimeType)}`);const o=await fetch(e,{method:"POST",headers:i,body:n});if(!o.ok)throw Error(`[HttpAssetProvider] Upload failed: ${o.status} ${o.statusText}`);return(o.headers.get("content-type")||"").includes("application/json")?await o.json():{}};extensionFromMime(e){const t=e.indexOf("/");return t>=0?e.slice(t+1):"bin"}generateUuid(){if("undefined"!=typeof crypto&&"function"==typeof crypto.randomUUID)return crypto.randomUUID();const e=crypto.getRandomValues(new Uint8Array(16));e[6]=15&e[6]|64,e[8]=63&e[8]|128;const t=Array.from(e,(e=>e.toString(16).padStart(2,"0"))).join("");return`${t.slice(0,8)}-${t.slice(8,12)}-${t.slice(12,16)}-${t.slice(16,20)}-${t.slice(20)}`}}class Z{type="remote";name="PresignedAssetProvider";_options;constructor(e){this._options=e}static with(e){return{create:()=>new Z(e)}}async init(){this._options.quiet||console.info("PresignedAssetProvider initialized")}destroy(){}canResolve(e){return!0}async put(e,t){const s=await this._options.getUploadDescriptor(t),i=s.method??"PUT",n={...s.headers??{}};let o;if(n["Content-Type"]||n["content-type"]||(n["Content-Type"]=t.mimeType),"POST"===i&&s.fields){const t=new FormData;for(const[e,i]of Object.entries(s.fields))t.append(e,i);t.append("file",e),o=t,delete n["Content-Type"],delete n["content-type"]}else o=e;const r=await fetch(s.url,{method:i,headers:n,body:o});if(!r.ok)throw Error(`[PresignedAssetProvider] Upload failed: ${r.status} ${r.statusText}`);return{id:s.id,kind:t.kind??"file",mimeType:t.mimeType,size:e.size,createdAt:Date.now(),width:t.width,height:t.height,durationMs:t.durationMs,originalFilename:t.originalFilename}}async resolve(e){return this._options.getDownloadUrl(e)}async fetch(e){const t=await this._options.getDownloadUrl(e),s=await fetch(t);if(!s.ok)throw Error(`[PresignedAssetProvider] Failed to fetch asset ${e}: ${s.status} ${s.statusText}`);return s.blob()}async delete(e){this._options.deleteAsset&&(await this._options.deleteAsset(e),this._options.quiet||console.info("PresignedAssetProvider: deleted asset "+e))}}export{B as BroadcastSyncProvider,X as HocuspocusSyncProvider,J as HttpAssetProvider,H as InMemorySyncProvider,G as IndexedDBSyncProvider,Z as PresignedAssetProvider,V as WebSocketSyncProvider}
1
+ export{g as getAssetPath,r as render,s as setAssetPath,a as setNonce,b as setPlatformOptions}from"./p-B43upypT.js";export{K as KritzelBaseObject,b as KritzelLine,a as KritzelPath}from"./p-2Swq9rEm.js";export{A as AssetNotFoundError,I as IndexedDBAssetProvider,g as KritzelAssetResolver,d as KritzelBaseTool,b as KritzelGroup,a as KritzelImage,f as KritzelSelectionTool,c as KritzelShape,K as KritzelText,e as KritzelTextTool,S as ShapeType}from"./p-BJlf4iHH.js";export{A as APP_STATE_MIGRATIONS,D as DE_LOCALE,E as EN_LOCALE,F as FR_LOCALE,k as KritzelAlignment,g as KritzelAnchorManager,a as KritzelBrushTool,f as KritzelCursorHelper,K as KritzelCustomElement,j as KritzelCustomElementRendererRegistry,c as KritzelEraserTool,d as KritzelImageTool,i as KritzelLicenseManager,b as KritzelLineTool,h as KritzelLocalizationManager,e as KritzelShapeTool,W as WORKSPACE_MIGRATIONS,r as runMigrations}from"./p-D9BugXUi.js";import*as t from"yjs";import{IndexeddbPersistence as n}from"y-indexeddb";import{WebsocketProvider as o}from"y-websocket";import{H as m,a as u}from"./kritzel-editor.js";export{d as DEFAULT_ASSET_STORAGE_CONFIG,D as DEFAULT_BRUSH_CONFIG,c as DEFAULT_LINE_TOOL_CONFIG,b as DEFAULT_TEXT_CONFIG,KritzelEditor,defineCustomElement as defineCustomElementKritzelEditor}from"./kritzel-editor.js";export{K as KritzelWorkspace,W as WORKSPACE_EXPORT_VERSION}from"./p-DhMlShij.js";export{K as KritzelThemeManager,d as darkTheme,l as lightTheme}from"./p-BmyTdQGy.js";export{C as CURRENT_APP_STATE_SCHEMA_VERSION,a as CURRENT_WORKSPACE_SCHEMA_VERSION}from"./p-CW-VyJgK.js";export{KritzelActiveUsers,defineCustomElement as defineCustomElementKritzelActiveUsers}from"./kritzel-active-users.js";export{KritzelAvatar,defineCustomElement as defineCustomElementKritzelAvatar}from"./kritzel-avatar.js";export{KritzelAwarenessCursors,defineCustomElement as defineCustomElementKritzelAwarenessCursors}from"./kritzel-awareness-cursors.js";export{KritzelBackToContent,defineCustomElement as defineCustomElementKritzelBackToContent}from"./kritzel-back-to-content.js";export{KritzelBrushStyle,defineCustomElement as defineCustomElementKritzelBrushStyle}from"./kritzel-brush-style.js";export{KritzelButton,defineCustomElement as defineCustomElementKritzelButton}from"./kritzel-button.js";export{KritzelColor,defineCustomElement as defineCustomElementKritzelColor}from"./kritzel-color.js";export{KritzelColorPalette,defineCustomElement as defineCustomElementKritzelColorPalette}from"./kritzel-color-palette.js";export{KritzelContextMenu,defineCustomElement as defineCustomElementKritzelContextMenu}from"./kritzel-context-menu.js";export{KritzelControls,defineCustomElement as defineCustomElementKritzelControls}from"./kritzel-controls.js";export{KritzelCurrentUser,defineCustomElement as defineCustomElementKritzelCurrentUser}from"./kritzel-current-user.js";export{KritzelCurrentUserDialog,defineCustomElement as defineCustomElementKritzelCurrentUserDialog}from"./kritzel-current-user-dialog.js";export{KritzelCursorTrail,defineCustomElement as defineCustomElementKritzelCursorTrail}from"./kritzel-cursor-trail.js";export{KritzelDialog,defineCustomElement as defineCustomElementKritzelDialog}from"./kritzel-dialog.js";export{KritzelDropdown,defineCustomElement as defineCustomElementKritzelDropdown}from"./kritzel-dropdown.js";export{KritzelEngine,defineCustomElement as defineCustomElementKritzelEngine}from"./kritzel-engine.js";export{KritzelExport,defineCustomElement as defineCustomElementKritzelExport}from"./kritzel-export.js";export{KritzelFont,defineCustomElement as defineCustomElementKritzelFont}from"./kritzel-font.js";export{KritzelFontFamily,defineCustomElement as defineCustomElementKritzelFontFamily}from"./kritzel-font-family.js";export{KritzelFontSize,defineCustomElement as defineCustomElementKritzelFontSize}from"./kritzel-font-size.js";export{KritzelIcon,defineCustomElement as defineCustomElementKritzelIcon}from"./kritzel-icon.js";export{KritzelInput,defineCustomElement as defineCustomElementKritzelInput}from"./kritzel-input.js";export{KritzelLineEndings,defineCustomElement as defineCustomElementKritzelLineEndings}from"./kritzel-line-endings.js";export{KritzelLoadingOverlay,defineCustomElement as defineCustomElementKritzelLoadingOverlay}from"./kritzel-loading-overlay.js";export{KritzelLoginDialog,defineCustomElement as defineCustomElementKritzelLoginDialog}from"./kritzel-login-dialog.js";export{KritzelMasterDetail,defineCustomElement as defineCustomElementKritzelMasterDetail}from"./kritzel-master-detail.js";export{KritzelMenu,defineCustomElement as defineCustomElementKritzelMenu}from"./kritzel-menu.js";export{KritzelMenuItem,defineCustomElement as defineCustomElementKritzelMenuItem}from"./kritzel-menu-item.js";export{KritzelMoreMenu,defineCustomElement as defineCustomElementKritzelMoreMenu}from"./kritzel-more-menu.js";export{KritzelNotificationCard,defineCustomElement as defineCustomElementKritzelNotificationCard}from"./kritzel-notification-card.js";export{KritzelNumericInput,defineCustomElement as defineCustomElementKritzelNumericInput}from"./kritzel-numeric-input.js";export{KritzelOpacitySlider,defineCustomElement as defineCustomElementKritzelOpacitySlider}from"./kritzel-opacity-slider.js";export{KritzelPillTabs,defineCustomElement as defineCustomElementKritzelPillTabs}from"./kritzel-pill-tabs.js";export{KritzelPortal,defineCustomElement as defineCustomElementKritzelPortal}from"./kritzel-portal.js";export{KritzelSettings,defineCustomElement as defineCustomElementKritzelSettings}from"./kritzel-settings.js";export{KritzelShapeFill,defineCustomElement as defineCustomElementKritzelShapeFill}from"./kritzel-shape-fill.js";export{KritzelShareDialog,defineCustomElement as defineCustomElementKritzelShareDialog}from"./kritzel-share-dialog.js";export{KritzelSlideToggle,defineCustomElement as defineCustomElementKritzelSlideToggle}from"./kritzel-slide-toggle.js";export{KritzelSplitButton,defineCustomElement as defineCustomElementKritzelSplitButton}from"./kritzel-split-button.js";export{KritzelStrokeSize,defineCustomElement as defineCustomElementKritzelStrokeSize}from"./kritzel-stroke-size.js";export{KritzelToolConfig,defineCustomElement as defineCustomElementKritzelToolConfig}from"./kritzel-tool-config.js";export{KritzelTooltip,defineCustomElement as defineCustomElementKritzelTooltip}from"./kritzel-tooltip.js";export{KritzelUtilityPanel,defineCustomElement as defineCustomElementKritzelUtilityPanel}from"./kritzel-utility-panel.js";export{KritzelWatermark,defineCustomElement as defineCustomElementKritzelWatermark}from"./kritzel-watermark.js";export{KritzelWorkspaceManager,defineCustomElement as defineCustomElementKritzelWorkspaceManager}from"./kritzel-workspace-manager.js";export{KritzelZoomPanel,defineCustomElement as defineCustomElementKritzelZoomPanel}from"./kritzel-zoom-panel.js";const z=Math.floor,p=127,y=Number.MAX_SAFE_INTEGER;class w{constructor(){this.cpos=0,this.cbuf=new Uint8Array(100),this.bufs=[]}}const x=()=>new w,T=e=>{const t=new Uint8Array((e=>{let t=e.cpos;for(let s=0;s<e.bufs.length;s++)t+=e.bufs[s].length;return t})(e));let s=0;for(let i=0;i<e.bufs.length;i++){const n=e.bufs[i];t.set(n,s),s+=n.length}return t.set(new Uint8Array(e.cbuf.buffer,0,e.cpos),s),t},P=(e,t)=>{const s=e.cbuf.length;e.cpos===s&&(e.bufs.push(e.cbuf),e.cbuf=new Uint8Array(2*s),e.cpos=0),e.cbuf[e.cpos++]=t},v=(e,t)=>{for(;t>p;)P(e,128|p&t),t=z(t/128);P(e,p&t)},U=(e,t)=>{v(e,t.byteLength),((e,t)=>{const s=e.cbuf.length,i=e.cpos,n=((e,t)=>e<t?e:t)(s-i,t.length),o=t.length-n;e.cbuf.set(t.subarray(0,n),i),e.cpos+=n,o>0&&(e.bufs.push(e.cbuf),e.cbuf=new Uint8Array(((e,t)=>e>t?e:t)(2*s,o)),e.cbuf.set(t.subarray(n)),e.cpos=o)})(e,t)},M=e=>Error(e),_=M("Unexpected end of array"),O=M("Integer out of Range");class L{constructor(e){this.arr=e,this.pos=0}}const R=e=>((e,t)=>{const s=new Uint8Array(e.arr.buffer,e.pos+e.arr.byteOffset,t);return e.pos+=t,s})(e,$(e)),$=e=>{let t=0,s=1;const i=e.arr.length;for(;e.pos<i;){const i=e.arr[e.pos++];if(t+=(i&p)*s,s*=128,i<128)return t;if(t>y)throw O}throw _};class B{type="local";doc;channel;_synced=!1;constructor(e,t,s){this.doc=t,this.channel=new BroadcastChannel(e),this.channel.onmessage=e=>{this.handleMessage(e.data)},this.doc.on("update",this.handleDocUpdate),this.broadcastSync(),setTimeout((()=>{this._synced=!0}),100),s?.quiet||console.info("BroadcastChannel Provider initialized: "+e)}handleDocUpdate=(e,t)=>{if(t!==this){const t=x();v(t,0),U(t,e),this.channel.postMessage(T(t))}};handleMessage(e){const s=(e=>new L(e))(new Uint8Array(e));switch($(s)){case 0:const e=R(s);t.applyUpdate(this.doc,e,this);break;case 1:this.broadcastSync();break;case 2:const i=R(s),n=t.encodeStateAsUpdate(this.doc,i);if(n.length>0){const e=x();v(e,0),U(e,n),this.channel.postMessage(T(e))}}}broadcastSync(){const e=x();v(e,2),U(e,t.encodeStateVector(this.doc)),this.channel.postMessage(T(e))}async connect(){if(!this._synced)return new Promise((e=>{const t=()=>{this._synced?e():setTimeout(t,50)};t()}))}disconnect(){}async reconnect(){return this.disconnect(),this.connect()}destroy(){this.doc.off("update",this.handleDocUpdate),this.channel.close()}}const H=new Map;class N{type="local";doc;cacheKey;isConnected=!1;constructor(e,t,s){this.doc=t,this.cacheKey=s?.name??e}handleUpdate=(e,s)=>{s!==this&&H.set(this.cacheKey,t.encodeStateAsUpdate(this.doc))};async connect(){if(this.isConnected)return;const e=H.get(this.cacheKey);e&&t.applyUpdate(this.doc,e,this),this.doc.on("update",this.handleUpdate),this.isConnected=!0}disconnect(){this.isConnected=!1}async reconnect(){return this.disconnect(),this.connect()}destroy(){this.doc.off("update",this.handleUpdate),this.isConnected=!1}static clear(e){void 0!==e?H.delete(e):H.clear()}}class G{type="local";provider;isConnected=!1;constructor(e,t,s){this.provider=new n(s?.name||e,t)}async connect(){if(!this.isConnected)return new Promise((e=>{this.provider.on("synced",(()=>{this.isConnected=!0,e()}))}))}disconnect(){this.isConnected=!1}async reconnect(){return this.disconnect(),this.connect()}destroy(){this.provider&&this.provider.destroy(),this.isConnected=!1}}class V{type="network";provider;isConnected=!1;_quiet=!1;get awareness(){return this.provider.awareness}constructor(e,t,s){const i=s?.url||"ws://localhost:1234",n=s?.roomName||e;this.provider=new o(i,n,t,{params:s?.params,protocols:s?.protocols,WebSocketPolyfill:s?.WebSocketPolyfill,awareness:s?.awareness,maxBackoffTime:s?.maxBackoffTime,disableBc:!0}),this._quiet=s?.quiet??!1,this.setupEventListeners(),this._quiet||console.info(`WebSocket Provider initialized: ${i}/${n}`)}static with(e){return{create:(t,s,i)=>{const n=i?{...e,...i}:e;return new V(t,s,n)}}}setupEventListeners(){this.provider.on("status",(({status:e})=>{"connected"===e?(this.isConnected=!0,this._quiet||console.info("WebSocket connected")):"disconnected"===e&&(this.isConnected=!1,this._quiet||console.info("WebSocket disconnected"))})),this.provider.on("sync",(e=>{e&&!this._quiet&&console.info("WebSocket synced")}))}async connect(){if(!this.isConnected)return new Promise(((e,t)=>{const s=setTimeout((()=>{t(Error("WebSocket connection timeout"))}),1e4),i=({status:t})=>{"connected"===t&&(clearTimeout(s),this.provider.off("status",i),this.isConnected=!0,e())};this.provider.on("status",i),this.provider.wsconnected&&(clearTimeout(s),this.provider.off("status",i),this.isConnected=!0,e())}))}disconnect(){this.provider&&this.provider.disconnect(),this.isConnected=!1}async reconnect(){return this.disconnect(),this.connect()}destroy(){this.provider&&this.provider.destroy(),this.isConnected=!1}}class J{type="network";provider;isConnected=!1;isSynced=!1;usesSharedSocket=!1;isDestroyed=!1;connectTimeout=null;pendingConnectReject=null;connectionTimeoutMs;_connectionStatus="disconnected";visibilityHandler=null;onlineHandler=null;get awareness(){return this.provider.awareness}get connectionStatus(){return this._connectionStatus}static sharedWebSocketProvider=null;constructor(e,t,s){const i=s?.name||e,n=s?.url||"ws://localhost:1234";this.connectionTimeoutMs=s?.connectionTimeout??1e4;const o=s?.websocketProvider||J.sharedWebSocketProvider,r={};void 0!==s?.delay&&(r.delay=s.delay),void 0!==s?.factor&&(r.factor=s.factor),void 0!==s?.maxAttempts&&(r.maxAttempts=s.maxAttempts),void 0!==s?.minDelay&&(r.minDelay=s.minDelay),void 0!==s?.maxDelay&&(r.maxDelay=s.maxDelay);const l=()=>{this.isDestroyed||(this.isConnected=!0,this._connectionStatus="connected",s?.quiet||console.info("Hocuspocus connected: "+i),s?.onConnect&&s.onConnect())},a=()=>{this.isDestroyed||(this.isConnected=!1,this.isSynced=!1,this._connectionStatus="disconnected",s?.quiet||console.info("Hocuspocus disconnected: "+i),s?.onDisconnect&&s.onDisconnect())},c=()=>{this.isDestroyed||(this.isSynced=!0,this._connectionStatus="synced",s?.quiet||console.info("Hocuspocus synced: "+i),s?.onSynced&&s.onSynced())},d=e=>{this.isDestroyed||("connecting"===e.status&&(this._connectionStatus="connecting"),s?.onStatus&&s.onStatus(e))};if(o){this.usesSharedSocket=!0;const e={websocketProvider:o,name:i,document:t,token:s?.token||null,onStatus:d,onConnect:l,onDisconnect:a,onSynced:c,...r};void 0!==s?.forceSyncInterval&&(e.forceSyncInterval=s.forceSyncInterval),s?.onAuthenticationFailed&&(e.onAuthenticationFailed=s.onAuthenticationFailed),this.provider=new m(e),this.provider.attach(),s?.quiet||console.info("Hocuspocus Provider initialized (multiplexed): "+i)}else{this.usesSharedSocket=!1;const e={url:n,name:i,document:t,token:s?.token||null,autoConnect:!1,onStatus:d,onConnect:l,onDisconnect:a,onSynced:c,...r};void 0!==s?.forceSyncInterval&&(e.forceSyncInterval=s.forceSyncInterval),s?.onAuthenticationFailed&&(e.onAuthenticationFailed=s.onAuthenticationFailed),s?.WebSocketPolyfill&&(e.WebSocketPolyfill=s.WebSocketPolyfill),this.provider=new m(e),s?.quiet||console.info(`Hocuspocus Provider initialized: ${n}/${i}`)}this.setupBrowserEventListeners()}setupBrowserEventListeners(){"undefined"!=typeof document&&(this.visibilityHandler=()=>{"visible"!==document.visibilityState||this.isConnected||this.isDestroyed||this.provider.connect()},document.addEventListener("visibilitychange",this.visibilityHandler)),"undefined"!=typeof window&&(this.onlineHandler=()=>{this.isConnected||this.isDestroyed||this.provider.connect()},window.addEventListener("online",this.onlineHandler))}removeBrowserEventListeners(){this.visibilityHandler&&"undefined"!=typeof document&&(document.removeEventListener("visibilitychange",this.visibilityHandler),this.visibilityHandler=null),this.onlineHandler&&"undefined"!=typeof window&&(window.removeEventListener("online",this.onlineHandler),this.onlineHandler=null)}static createSharedWebSocket(e){if(J.sharedWebSocketProvider)return console.warn("Shared WebSocket already exists. Returning existing instance."),J.sharedWebSocketProvider;const t={url:e.url};return e.WebSocketPolyfill&&(t.WebSocketPolyfill=e.WebSocketPolyfill),e.onConnect&&(t.onConnect=e.onConnect),e.onDisconnect&&(t.onDisconnect=e.onDisconnect),e.onStatus&&(t.onStatus=e.onStatus),J.sharedWebSocketProvider=new u(t),console.info("Shared Hocuspocus WebSocket created: "+e.url),J.sharedWebSocketProvider}static destroySharedWebSocket(){J.sharedWebSocketProvider&&(J.sharedWebSocketProvider.destroy(),J.sharedWebSocketProvider=null,console.info("Shared Hocuspocus WebSocket destroyed"))}static getSharedWebSocket(){return J.sharedWebSocketProvider}static with(e){return{create:(t,s,i)=>{const n=i?{...e,...i}:e;return new J(t,s,n)}}}async connect(){if(!this.isSynced&&!this.isDestroyed)return this._connectionStatus="connecting",new Promise(((e,t)=>{this.pendingConnectReject=t,this.connectTimeout=setTimeout((()=>{this.pendingConnectReject=null,this.connectTimeout=null,t(Error("Hocuspocus connection timeout"))}),this.connectionTimeoutMs);const s=()=>{this.connectTimeout&&(clearTimeout(this.connectTimeout),this.connectTimeout=null),this.pendingConnectReject=null,this.provider.off("synced",s),this.isDestroyed||e()};if(this.provider.on("synced",s),this.provider.isSynced)return this.connectTimeout&&(clearTimeout(this.connectTimeout),this.connectTimeout=null),this.pendingConnectReject=null,this.provider.off("synced",s),void e();this.isConnected||this.usesSharedSocket||this.provider.connect()}))}async reconnect(){return this.disconnect(),this.connect()}disconnect(){this.connectTimeout&&(clearTimeout(this.connectTimeout),this.connectTimeout=null),this.pendingConnectReject&&(this.pendingConnectReject=null),this.provider&&(this.usesSharedSocket?this.provider.detach():this.provider.disconnect()),this.isConnected=!1,this.isSynced=!1,this._connectionStatus="disconnected"}destroy(){this.isDestroyed=!0,this.connectTimeout&&(clearTimeout(this.connectTimeout),this.connectTimeout=null),this.pendingConnectReject&&(this.pendingConnectReject=null),this.removeBrowserEventListeners(),this.provider&&this.provider.destroy(),this.isConnected=!1,this.isSynced=!1,this._connectionStatus="disconnected"}}class X{type="remote";name="HttpAssetProvider";_options;constructor(e){this._options=e}static with(e){return{create:()=>new X(e)}}async init(){this._options.quiet||console.info("HttpAssetProvider initialized")}destroy(){}canResolve(e){return!0}async put(e,t){const s=t.id??this.generateUuid(),i={...t,id:s},n=await(this._options.headers?.())??{},o=await this._options.uploadUrl(i),r=this._options.upload??this.defaultUpload;return{id:(await r(o,e,i,n)).id??s,kind:t.kind??"file",mimeType:t.mimeType,size:e.size,createdAt:Date.now(),width:t.width,height:t.height,durationMs:t.durationMs,originalFilename:t.originalFilename}}async resolve(e){return this._options.resolveUrl(e)}async fetch(e){const t=await this._options.resolveUrl(e),s=await(this._options.headers?.())??{},i=await fetch(t,{headers:s});if(!i.ok)throw Error(`[HttpAssetProvider] Failed to fetch asset ${e}: ${i.status} ${i.statusText}`);return i.blob()}async delete(e){if(!this._options.deleteUrl)return;const t=await this._options.deleteUrl(e),s=await(this._options.headers?.())??{},i=await fetch(t,{method:"DELETE",headers:s});if(!i.ok)throw Error(`[HttpAssetProvider] Failed to delete asset ${e}: ${i.status} ${i.statusText}`);this._options.quiet||console.info("HttpAssetProvider: deleted asset "+e)}defaultUpload=async(e,t,s,i)=>{const n=new FormData;n.append("metadata",JSON.stringify(s)),n.append("file",t,s.originalFilename||`${s.id}.${this.extensionFromMime(s.mimeType)}`);const o=await fetch(e,{method:"POST",headers:i,body:n});if(!o.ok)throw Error(`[HttpAssetProvider] Upload failed: ${o.status} ${o.statusText}`);return(o.headers.get("content-type")||"").includes("application/json")?await o.json():{}};extensionFromMime(e){const t=e.indexOf("/");return t>=0?e.slice(t+1):"bin"}generateUuid(){if("undefined"!=typeof crypto&&"function"==typeof crypto.randomUUID)return crypto.randomUUID();const e=crypto.getRandomValues(new Uint8Array(16));e[6]=15&e[6]|64,e[8]=63&e[8]|128;const t=Array.from(e,(e=>e.toString(16).padStart(2,"0"))).join("");return`${t.slice(0,8)}-${t.slice(8,12)}-${t.slice(12,16)}-${t.slice(16,20)}-${t.slice(20)}`}}class q{type="remote";name="PresignedAssetProvider";_options;constructor(e){this._options=e}static with(e){return{create:()=>new q(e)}}async init(){this._options.quiet||console.info("PresignedAssetProvider initialized")}destroy(){}canResolve(e){return!0}async put(e,t){const s=await this._options.getUploadDescriptor(t),i=s.method??"PUT",n={...s.headers??{}};let o;if(n["Content-Type"]||n["content-type"]||(n["Content-Type"]=t.mimeType),"POST"===i&&s.fields){const t=new FormData;for(const[e,i]of Object.entries(s.fields))t.append(e,i);t.append("file",e),o=t,delete n["Content-Type"],delete n["content-type"]}else o=e;const r=await fetch(s.url,{method:i,headers:n,body:o});if(!r.ok)throw Error(`[PresignedAssetProvider] Upload failed: ${r.status} ${r.statusText}`);return{id:s.id,kind:t.kind??"file",mimeType:t.mimeType,size:e.size,createdAt:Date.now(),width:t.width,height:t.height,durationMs:t.durationMs,originalFilename:t.originalFilename}}async resolve(e){return this._options.getDownloadUrl(e)}async fetch(e){const t=await this._options.getDownloadUrl(e),s=await fetch(t);if(!s.ok)throw Error(`[PresignedAssetProvider] Failed to fetch asset ${e}: ${s.status} ${s.statusText}`);return s.blob()}async delete(e){this._options.deleteAsset&&(await this._options.deleteAsset(e),this._options.quiet||console.info("PresignedAssetProvider: deleted asset "+e))}}export{B as BroadcastSyncProvider,J as HocuspocusSyncProvider,X as HttpAssetProvider,N as InMemorySyncProvider,G as IndexedDBSyncProvider,q as PresignedAssetProvider,V as WebSocketSyncProvider}
@@ -1 +1 @@
1
- import{K as o,d as p}from"./p-DEpnJBA3.js";const s=o,r=p;export{s as KritzelActiveUsers,r as defineCustomElement}
1
+ import{K as o,d as s}from"./p-yD_3Z3K1.js";const p=o,r=s;export{p as KritzelActiveUsers,r as defineCustomElement}
@@ -1 +1 @@
1
- import{K as o,d as s}from"./p-W1ZwImdd.js";const d=o,m=s;export{d as KritzelAvatar,m as defineCustomElement}
1
+ import{K as o,d as s}from"./p-DXcjIb_a.js";const a=o,p=s;export{a as KritzelAvatar,p as defineCustomElement}
@@ -1 +1 @@
1
- import{K as o,d as r}from"./p-DeqALrzV.js";const s=o,p=r;export{s as KritzelBackToContent,p as defineCustomElement}
1
+ import{K as s,d as o}from"./p-DMAScsJF.js";const p=s,r=o;export{p as KritzelBackToContent,r as defineCustomElement}
@@ -1 +1 @@
1
- import{K as o,d as s}from"./p-COdwK_mi.js";const m=o,p=s;export{m as KritzelButton,p as defineCustomElement}
1
+ import{K as o,d as s}from"./p-oGAPPwAL.js";const p=o,r=s;export{p as KritzelButton,r as defineCustomElement}
@@ -1 +1 @@
1
- import{K as s,d as o}from"./p-wl9BhN6s.js";const p=s,r=o;export{p as KritzelColorPalette,r as defineCustomElement}
1
+ import{K as o,d as s}from"./p-1nG2hxfJ.js";const p=o,r=s;export{p as KritzelColorPalette,r as defineCustomElement}
@@ -1 +1 @@
1
- import{K as o,d as s}from"./p-BcB97x3U.js";const p=o,r=s;export{p as KritzelColor,r as defineCustomElement}
1
+ import{K as o,d as s}from"./p-zd7zXld8.js";const d=o,p=s;export{d as KritzelColor,p as defineCustomElement}
@@ -1 +1 @@
1
- import{K as o,d as s}from"./p-BeHVCJ7n.js";const p=o,r=s;export{p as KritzelControls,r as defineCustomElement}
1
+ import{K as s,d as o}from"./p-BH4AasB1.js";const a=s,p=o;export{a as KritzelControls,p as defineCustomElement}
@@ -1 +1 @@
1
- import{K as o,d as s}from"./p-XDNjFYRB.js";const p=o,r=s;export{p as KritzelCurrentUserDialog,r as defineCustomElement}
1
+ import{K as o,d as s}from"./p-D52oKO_e.js";const p=o,r=s;export{p as KritzelCurrentUserDialog,r as defineCustomElement}
@@ -1 +1 @@
1
- import{K as o,d as p}from"./p-X_pyPCe8.js";const s=o,r=p;export{s as KritzelCurrentUser,r as defineCustomElement}
1
+ import{K as o,d as p}from"./p-Di5dpXrF.js";const r=o,s=p;export{r as KritzelCurrentUser,s as defineCustomElement}
@@ -1 +1 @@
1
- import{p as t,H as e,c as s,h as i,d as n,t as o}from"./p-B43upypT.js";import{K as r,d as a}from"./p-CdR76C4L.js";import{D as c,h,S as l,f as d,e as u,i as p,j as m,k as g}from"./p-BVu03tNB.js";import{a as f,c as b,b as y,e as k,d as w,k as v,l as z,m as C}from"./p-vLVZEJXX.js";import{D as j,T as A,d as x,l as S}from"./p-BmyTdQGy.js";import{A as E,a as T,d as O}from"./p-CC0J_kEP.js";import{K as I}from"./p-jGOpkGDl.js";import{O as D}from"./p-Dd-pMvlr.js";import"./p-2Swq9rEm.js";import*as M from"yjs";import"y-indexeddb";import"y-websocket";import{d as B}from"./p-DEpnJBA3.js";import{d as U}from"./p-W1ZwImdd.js";import{d as R}from"./p-BoA6RXEA.js";import{d as P}from"./p-DeqALrzV.js";import{d as W}from"./p-COdwK_mi.js";import{d as V}from"./p-BcB97x3U.js";import{d as L}from"./p-wl9BhN6s.js";import{d as N}from"./p-BxpKq94F.js";import{d as F}from"./p-BeHVCJ7n.js";import{d as Y}from"./p-X_pyPCe8.js";import{d as J}from"./p-XDNjFYRB.js";import{d as Z}from"./p-B4b6TDxp.js";import{d as H}from"./p-DX2nriaq.js";import{d as K}from"./p-Df3BwVGy.js";import{d as q}from"./p-DYLBjStF.js";import{d as X}from"./p-BX-nQAyH.js";import{d as $}from"./p-JhOYwUOj.js";import{d as _}from"./p-Cb5YwXbC.js";import{d as Q}from"./p-Bg0xIZiR.js";import{d as G}from"./p-CXpv9Rxe.js";import{d as tt}from"./p-CZQz_mul.js";import{d as et}from"./p-D0v9WP5w.js";import{d as st,a as it}from"./p-BntMEYss.js";import{d as nt}from"./p-meY80XnF.js";import{d as ot}from"./p-pagW8YF7.js";import{d as rt}from"./p-BrAeYciD.js";import{d as at}from"./p-CdkNxxut.js";import{d as ct}from"./p-D09kgc5Q.js";import{d as ht}from"./p-DSd5xTAH.js";import{d as lt}from"./p-DZ8yfhhf.js";import{d as dt}from"./p-BFYtCsZu.js";import{d as ut}from"./p-DJVRW9So.js";import{d as pt}from"./p-D0RYktBV.js";import{d as mt}from"./p-M9m9-OEY.js";import{d as gt}from"./p-7ZnANv7C.js";import{d as ft}from"./p-BUc0GFPj.js";import{d as bt}from"./p-DPlEzPKO.js";import{d as yt}from"./p-8p1DKytO.js";import{d as kt}from"./p-BixEMVtW.js";import{d as wt}from"./p-CfS-5J9k.js";const vt=Math.floor,zt=127,Ct=Number.MAX_SAFE_INTEGER,jt="undefined"!=typeof TextEncoder?new TextEncoder:null,At=jt?t=>jt.encode(t):t=>{const e=unescape(encodeURIComponent(t)),s=e.length,i=new Uint8Array(s);for(let t=0;t<s;t++)i[t]=e.codePointAt(t);return i};let xt="undefined"==typeof TextDecoder?null:new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0});xt&&1===xt.decode(new Uint8Array).length&&(xt=null);const St=(t,e)=>{const s=t.cbuf.length;t.cpos===s&&(t.bufs.push(t.cbuf),t.cbuf=new Uint8Array(2*s),t.cpos=0),t.cbuf[t.cpos++]=e},Et=(t,e)=>{for(;e>zt;)St(t,128|zt&e),e=vt(e/128);St(t,zt&e)},Tt=new Uint8Array(3e4),Ot=Tt.length/3,It=jt&&jt.encodeInto?(t,e)=>{if(e.length<Ot){const s=jt.encodeInto(e,Tt).written||0;Et(t,s);for(let e=0;e<s;e++)St(t,Tt[e])}else Dt(t,At(e))}:(t,e)=>{const s=unescape(encodeURIComponent(e)),i=s.length;Et(t,i);for(let e=0;e<i;e++)St(t,s.codePointAt(e))},Dt=(t,e)=>{Et(t,e.byteLength),((t,e)=>{const s=t.cbuf.length,i=t.cpos,n=((t,e)=>t<e?t:e)(s-i,e.length),o=e.length-n;t.cbuf.set(e.subarray(0,n),i),t.cpos+=n,o>0&&(t.bufs.push(t.cbuf),t.cbuf=new Uint8Array(((t,e)=>t>e?t:e)(2*s,o)),t.cbuf.set(e.subarray(n)),t.cpos=o)})(t,e)},Mt=t=>Error(t),Bt=Mt("Unexpected end of array"),Ut=Mt("Integer out of Range"),Rt=t=>t.arr[t.pos++],Pt=t=>{let e=0,s=1;const i=t.arr.length;for(;t.pos<i;){const i=t.arr[t.pos++];if(e+=(i&zt)*s,s*=128,i<128)return e;if(e>Ct)throw Ut}throw Bt},Wt=xt?t=>xt.decode((t=>((t,e)=>{const s=new Uint8Array(t.arr.buffer,t.pos+t.arr.byteOffset,e);return t.pos+=e,s})(t,Pt(t)))(t)):t=>{let e=Pt(t);if(0===e)return"";{let s=String.fromCodePoint(Rt(t));if(--e<100)for(;e--;)s+=String.fromCodePoint(Rt(t));else for(;e>0;){const i=e<1e4?e:1e4,n=t.arr.subarray(t.pos,t.pos+i);t.pos+=i,s+=String.fromCodePoint.apply(null,n),e-=i}return decodeURIComponent(escape(s))}};var Vt;!function(t){t[t.Token=0]="Token",t[t.PermissionDenied=1]="PermissionDenied",t[t.Authenticated=2]="Authenticated"}(Vt||(Vt={}));const Lt=t=>Array.from(t.entries()).map((([t,e])=>({clientId:t,...e})));var Nt;async function Ft(t){return new Promise((e=>setTimeout(e,t)))}function Yt(t,e){let s=e.delay;if(0===s)return 0;if(e.factor&&(s*=Math.pow(e.factor,t.attemptNum-1),0!==e.maxDelay&&(s=Math.min(s,e.maxDelay))),e.jitter){const t=Math.ceil(e.minDelay),i=Math.floor(s);s=Math.floor(Math.random()*(i-t+1))+t}return Math.round(s)}!function(t){t[t.Connecting=0]="Connecting",t[t.Open=1]="Open",t[t.Closing=2]="Closing",t[t.Closed=3]="Closed"}(Nt||(Nt={}));const Jt=Math.floor,Zt=128,Ht=127,Kt=Number.MAX_SAFE_INTEGER,qt=()=>new Set,Xt=Array.from,$t="undefined"!=typeof TextEncoder?new TextEncoder:null,_t=$t?t=>$t.encode(t):t=>{const e=unescape(encodeURIComponent(t)),s=e.length,i=new Uint8Array(s);for(let t=0;t<s;t++)i[t]=e.codePointAt(t);return i};let Qt="undefined"==typeof TextDecoder?null:new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0});Qt&&1===Qt.decode(new Uint8Array).length&&(Qt=null);class Gt{constructor(){this.cpos=0,this.cbuf=new Uint8Array(100),this.bufs=[]}}const te=()=>new Gt,ee=t=>{let e=t.cpos;for(let s=0;s<t.bufs.length;s++)e+=t.bufs[s].length;return e},se=t=>{const e=new Uint8Array(ee(t));let s=0;for(let i=0;i<t.bufs.length;i++){const n=t.bufs[i];e.set(n,s),s+=n.length}return e.set(new Uint8Array(t.cbuf.buffer,0,t.cpos),s),e},ie=(t,e)=>{const s=t.cbuf.length;t.cpos===s&&(t.bufs.push(t.cbuf),t.cbuf=new Uint8Array(2*s),t.cpos=0),t.cbuf[t.cpos++]=e},ne=(t,e)=>{for(;e>Ht;)ie(t,Zt|Ht&e),e=Jt(e/128);ie(t,Ht&e)},oe=new Uint8Array(3e4),re=oe.length/3,ae=$t&&$t.encodeInto?(t,e)=>{if(e.length<re){const s=$t.encodeInto(e,oe).written||0;ne(t,s);for(let e=0;e<s;e++)ie(t,oe[e])}else ce(t,_t(e))}:(t,e)=>{const s=unescape(encodeURIComponent(e)),i=s.length;ne(t,i);for(let e=0;e<i;e++)ie(t,s.codePointAt(e))},ce=(t,e)=>{ne(t,e.byteLength),((t,e)=>{const s=t.cbuf.length,i=t.cpos,n=((t,e)=>t<e?t:e)(s-i,e.length),o=e.length-n;t.cbuf.set(e.subarray(0,n),i),t.cpos+=n,o>0&&(t.bufs.push(t.cbuf),t.cbuf=new Uint8Array(((t,e)=>t>e?t:e)(2*s,o)),t.cbuf.set(e.subarray(n)),t.cpos=o)})(t,e)},he=t=>Error(t),le=he("Unexpected end of array"),de=he("Integer out of Range");class ue{constructor(t){this.arr=t,this.pos=0}}const pe=t=>new ue(t),me=t=>((t,e)=>{const s=new Uint8Array(t.arr.buffer,t.pos+t.arr.byteOffset,e);return t.pos+=e,s})(t,fe(t)),ge=t=>t.arr[t.pos++],fe=t=>{let e=0,s=1;const i=t.arr.length;for(;t.pos<i;){const i=t.arr[t.pos++];if(e+=(i&Ht)*s,s*=128,i<Zt)return e;if(e>Kt)throw de}throw le},be=Qt?t=>Qt.decode(me(t)):t=>{let e=fe(t);if(0===e)return"";{let s=String.fromCodePoint(ge(t));if(--e<100)for(;e--;)s+=String.fromCodePoint(ge(t));else for(;e>0;){const i=e<1e4?e:1e4,n=t.arr.subarray(t.pos,t.pos+i);t.pos+=i,s+=String.fromCodePoint.apply(null,n),e-=i}return decodeURIComponent(escape(s))}},ye=Date.now,ke=()=>new Map;class we{constructor(){this._observers=ke()}on(t,e){((t,e,s)=>{let i=t.get(e);return void 0===i&&t.set(e,i=s()),i})(this._observers,t,qt).add(e)}once(t,e){const s=(...i)=>{this.off(t,s),e(...i)};this.on(t,s)}off(t,e){const s=this._observers.get(t);void 0!==s&&(s.delete(e),0===s.size&&this._observers.delete(t))}emit(t,e){return Xt((this._observers.get(t)||ke()).values()).forEach((t=>t(...e)))}destroy(){this._observers=ke()}}const ve=Object.keys,ze=t=>ve(t).length,Ce=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),je=(t,e)=>{if(null==t||null==e)return((t,e)=>t===e)(t,e);if(t.constructor!==e.constructor)return!1;if(t===e)return!0;switch(t.constructor){case ArrayBuffer:t=new Uint8Array(t),e=new Uint8Array(e);case Uint8Array:if(t.byteLength!==e.byteLength)return!1;for(let s=0;s<t.length;s++)if(t[s]!==e[s])return!1;break;case Set:if(t.size!==e.size)return!1;for(const s of t)if(!e.has(s))return!1;break;case Map:if(t.size!==e.size)return!1;for(const s of t.keys())if(!e.has(s)||!je(t.get(s),e.get(s)))return!1;break;case Object:if(ze(t)!==ze(e))return!1;for(const s in t)if(!Ce(t,s)||!je(t[s],e[s]))return!1;break;case Array:if(t.length!==e.length)return!1;for(let s=0;s<t.length;s++)if(!je(t[s],e[s]))return!1;break;default:return!1}return!0};class Ae extends we{constructor(t){super(),this.doc=t,this.clientID=t.clientID,this.states=new Map,this.meta=new Map,this._checkInterval=setInterval((()=>{const t=ye();null!==this.getLocalState()&&15e3<=t-this.meta.get(this.clientID).lastUpdated&&this.setLocalState(this.getLocalState());const e=[];this.meta.forEach(((s,i)=>{i!==this.clientID&&3e4<=t-s.lastUpdated&&this.states.has(i)&&e.push(i)})),e.length>0&&xe(this,e,"timeout")}),Jt(3e3)),t.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(t){const e=this.clientID,s=this.meta.get(e),i=void 0===s?0:s.clock+1,n=this.states.get(e);null===t?this.states.delete(e):this.states.set(e,t),this.meta.set(e,{clock:i,lastUpdated:ye()});const o=[],r=[],a=[],c=[];null===t?c.push(e):null==n?null!=t&&o.push(e):(r.push(e),je(n,t)||a.push(e)),(o.length>0||a.length>0||c.length>0)&&this.emit("change",[{added:o,updated:a,removed:c},"local"]),this.emit("update",[{added:o,updated:r,removed:c},"local"])}setLocalStateField(t,e){const s=this.getLocalState();null!==s&&this.setLocalState({...s,[t]:e})}getStates(){return this.states}}const xe=(t,e,s)=>{const i=[];for(let s=0;s<e.length;s++){const n=e[s];if(t.states.has(n)){if(t.states.delete(n),n===t.clientID){const e=t.meta.get(n);t.meta.set(n,{clock:e.clock+1,lastUpdated:ye()})}i.push(n)}}i.length>0&&(t.emit("change",[{added:[],updated:[],removed:i},s]),t.emit("update",[{added:[],updated:[],removed:i},s]))},Se=(t,e,s=t.states)=>{const i=e.length,n=te();ne(n,i);for(let o=0;o<i;o++){const i=e[o],r=s.get(i)||null,a=t.meta.get(i).clock;ne(n,i),ne(n,a),ae(n,JSON.stringify(r))}return se(n)};class Ee{constructor(){this.callbacks={}}on(t,e){return this.callbacks[t]||(this.callbacks[t]=[]),this.callbacks[t].push(e),this}emit(t,...e){const s=this.callbacks[t];return s&&s.forEach((t=>t.apply(this,e))),this}off(t,e){const s=this.callbacks[t];return s&&(e?this.callbacks[t]=s.filter((t=>t!==e)):delete this.callbacks[t]),this}removeAllListeners(){this.callbacks={}}}class Te{constructor(t){this.data=t,this.encoder=te(),this.decoder=pe(new Uint8Array(this.data))}peekVarString(){return(t=>{const e=t.pos,s=be(t);return t.pos=e,s})(this.decoder)}readVarUint(){return fe(this.decoder)}readVarString(){return be(this.decoder)}readVarUint8Array(){return me(this.decoder)}writeVarUint(t){return ne(this.encoder,t)}writeVarString(t){return ae(this.encoder,t)}writeVarUint8Array(t){return ce(this.encoder,t)}length(){return ee(this.encoder)}}var Oe,Ie;!function(t){t[t.Sync=0]="Sync",t[t.Awareness=1]="Awareness",t[t.Auth=2]="Auth",t[t.QueryAwareness=3]="QueryAwareness",t[t.Stateless=5]="Stateless",t[t.CLOSE=7]="CLOSE",t[t.SyncStatus=8]="SyncStatus"}(Oe||(Oe={})),function(t){t.Connecting="connecting",t.Connected="connected",t.Disconnected="disconnected"}(Ie||(Ie={}));class De{constructor(){this.encoder=te()}get(t){return t.encoder}toUint8Array(){return se(this.encoder)}}class Me extends De{constructor(){super(...arguments),this.type=Oe.CLOSE,this.description="Ask the server to close the connection"}get(t){return ae(this.encoder,t.documentName),ne(this.encoder,this.type),this.encoder}}class Be extends Ee{constructor(t){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=Ie.Disconnected,this.lastMessageReceived=0,this.identifier=0,this.intervals={connectionChecker:null},this.connectionAttempt=null,this.receivedOnOpenPayload=void 0,this.closeTries=0,this.setConfiguration(t),this.configuration.WebSocketPolyfill=t.WebSocketPolyfill?t.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(t){this.status=Ie.Connected,this.emit("status",{status:Ie.Connected}),this.cancelWebsocketRetry=void 0,this.receivedOnOpenPayload=t}attach(t){this.configuration.providerMap.set(t.configuration.name,t),this.status===Ie.Disconnected&&this.shouldConnect&&this.connect(),this.receivedOnOpenPayload&&this.status===Ie.Connected&&t.onOpen(this.receivedOnOpenPayload)}detach(t){this.configuration.providerMap.has(t.configuration.name)&&(t.send(Me,{documentName:t.configuration.name}),this.configuration.providerMap.delete(t.configuration.name))}setConfiguration(t={}){this.configuration={...this.configuration,...t},this.configuration.autoConnect||(this.shouldConnect=!1)}async connect(){if(this.status===Ie.Connected)return;this.cancelWebsocketRetry&&(this.cancelWebsocketRetry(),this.cancelWebsocketRetry=void 0),this.receivedOnOpenPayload=void 0,this.shouldConnect=!0;const{retryPromise:t,cancelFunc:e}=(()=>{let t=!1;return{retryPromise:async function(t,e){const s=function(t){return t||(t={}),{delay:void 0===t.delay?200:t.delay,initialDelay:void 0===t.initialDelay?0:t.initialDelay,minDelay:void 0===t.minDelay?0:t.minDelay,maxDelay:void 0===t.maxDelay?0:t.maxDelay,factor:void 0===t.factor?0:t.factor,maxAttempts:void 0===t.maxAttempts?3:t.maxAttempts,timeout:void 0===t.timeout?0:t.timeout,jitter:!0===t.jitter,initialJitter:!0===t.initialJitter,handleError:void 0===t.handleError?null:t.handleError,handleTimeout:void 0===t.handleTimeout?null:t.handleTimeout,beforeAttempt:void 0===t.beforeAttempt?null:t.beforeAttempt,calculateDelay:void 0===t.calculateDelay?null:t.calculateDelay}}(e);for(const t of["delay","initialDelay","minDelay","maxDelay","maxAttempts","timeout"]){const e=s[t];if(!Number.isInteger(e)||e<0)throw Error(`Value for ${t} must be an integer greater than or equal to 0`)}if(s.factor.constructor!==Number||s.factor<0)throw Error("Value for factor must be a number greater than or equal to 0");if(s.delay<s.minDelay)throw Error(`delay cannot be less than minDelay (delay: ${s.delay}, minDelay: ${s.minDelay}`);const i={attemptNum:0,attemptsRemaining:s.maxAttempts?s.maxAttempts:-1,aborted:!1,abort(){i.aborted=!0}},n=s.calculateDelay||Yt,o=s.calculateDelay?s.calculateDelay(i,s):s.initialDelay;if(o&&await Ft(o),i.attemptNum<1&&s.initialJitter){const t=n(i,s);t&&await Ft(t)}return async function e(){if(s.beforeAttempt&&s.beforeAttempt(i,s),i.aborted){const t=Error("Attempt aborted");throw t.code="ATTEMPT_ABORTED",t}const o=async t=>{if(s.handleError&&await s.handleError(t,i,s),i.aborted||0===i.attemptsRemaining)throw t;i.attemptNum++;const o=n(i,s);return o&&await Ft(o),e()};return i.attemptsRemaining>0&&i.attemptsRemaining--,s.timeout?new Promise(((e,n)=>{const r=setTimeout((()=>{if(s.handleTimeout)try{e(s.handleTimeout(i,s))}catch(t){n(t)}else{const t=Error(`Retry timeout (attemptNum: ${i.attemptNum}, timeout: ${s.timeout})`);t.code="ATTEMPT_TIMEOUT",n(t)}}),s.timeout);t(i,s).then((t=>{clearTimeout(r),e(t)})).catch((t=>{clearTimeout(r),o(t).then(e).catch(n)}))})):t(i,s).catch(o)}()}(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:e=>{this.shouldConnect&&!t||e.abort()}}).catch((t=>{if(t&&"ATTEMPT_ABORTED"!==t.code)throw t})),cancelFunc:()=>{t=!0}}})();return this.cancelWebsocketRetry=e,t}attachWebSocketListeners(t,e){const{identifier:s}=t;this.webSocketHandlers[s]={message:t=>this.emit("message",t),close:t=>this.emit("close",{event:t}),open:t=>this.emit("open",t),error:t=>{e(t)}};const i=this.webSocketHandlers[t.identifier];Object.keys(i).forEach((e=>{t.addEventListener(e,i[e])}))}cleanupWebSocket(){if(!this.webSocket)return;const{identifier:t}=this.webSocket,e=this.webSocketHandlers[t];Object.keys(e).forEach((s=>{var i;null===(i=this.webSocket)||void 0===i||i.removeEventListener(s,e[s]),delete this.webSocketHandlers[t]})),this.webSocket.close(),this.webSocket=null}createWebSocketConnection(){return new Promise(((t,e)=>{this.webSocket&&(this.messageQueue=[],this.cleanupWebSocket()),this.lastMessageReceived=0,this.identifier+=1;const s=new this.configuration.WebSocketPolyfill(this.url);s.binaryType="arraybuffer",s.identifier=this.identifier,this.attachWebSocketListeners(s,e),this.webSocket=s,this.status=Ie.Connecting,this.emit("status",{status:Ie.Connecting}),this.connectionAttempt={resolve:t,reject:e}}))}onMessage(t){var e;this.resolveConnectionAttempt(),this.lastMessageReceived=ye();const s=new Te(t.data).peekVarString();null===(e=this.configuration.providerMap.get(s))||void 0===e||e.onMessage(t)}resolveConnectionAttempt(){this.connectionAttempt&&(this.connectionAttempt.resolve(),this.connectionAttempt=null,this.status=Ie.Connected,this.emit("status",{status:Ie.Connected}),this.emit("connect"),this.messageQueue.forEach((t=>this.send(t))),this.messageQueue=[])}stopConnectionAttempt(){this.connectionAttempt=null}rejectConnectionAttempt(){var t;null===(t=this.connectionAttempt)||void 0===t||t.reject(),this.connectionAttempt=null}checkConnection(){var t;this.status===Ie.Connected&&this.lastMessageReceived&&(this.configuration.messageReconnectTimeout>=ye()-this.lastMessageReceived||(this.closeTries+=1,this.closeTries>2?(this.onClose({event:{code:4408,reason:"forced"}}),this.closeTries=0):(null===(t=this.webSocket)||void 0===t||t.close(),this.messageQueue=[])))}get serverUrl(){if(this.configuration.preserveTrailingSlash)return this.configuration.url;let t=this.configuration.url;for(;"/"===t[t.length-1];)t=t.slice(0,t.length-1);return t}get url(){return this.serverUrl}disconnect(){if(this.shouldConnect=!1,null!==this.webSocket)try{this.webSocket.close(),this.messageQueue=[]}catch(t){console.error(t)}}send(t){var e;(null===(e=this.webSocket)||void 0===e?void 0:e.readyState)===Nt.Open?this.webSocket.send(t):this.messageQueue.push(t)}onClose({event:t}){this.closeTries=0,this.cleanupWebSocket(),this.connectionAttempt&&this.rejectConnectionAttempt(),this.status=Ie.Disconnected,this.emit("status",{status:Ie.Disconnected}),this.emit("disconnect",{event:t}),!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()}}const Ue=(t,e,s)=>{try{M.applyUpdate(e,me(t),s)}catch(t){console.error("Caught error while handling a Yjs update",t)}},Re=Ue;class Pe{constructor(t){this.message=t}apply(t,e){const{message:s}=this,i=s.readVarUint(),n=s.length();switch(i){case Oe.Sync:this.applySyncMessage(t,e);break;case Oe.Awareness:this.applyAwarenessMessage(t);break;case Oe.Auth:this.applyAuthMessage(t);break;case Oe.QueryAwareness:this.applyQueryAwarenessMessage(t);break;case Oe.Stateless:t.receiveStateless(be(s.decoder));break;case Oe.SyncStatus:this.applySyncStatusMessage(t,1===(t=>{let e=t.arr[t.pos++],s=63&e,i=64;const n=(64&e)>0?-1:1;if(!(e&Zt))return n*s;const o=t.arr.length;for(;t.pos<o;){if(e=t.arr[t.pos++],s+=(e&Ht)*i,i*=128,e<Zt)return n*s;if(s>Kt)throw de}throw le})(s.decoder));break;case Oe.CLOSE:const n={code:1e3,reason:be(s.decoder),target:t.configuration.websocketProvider.webSocket,type:"close"};t.onClose(),t.configuration.onClose({event:n}),t.forwardClose({event:n});break;default:throw Error("Can’t apply message of unknown type: "+i)}s.length()>n+1&&t.send(De,{encoder:s.encoder})}applySyncMessage(t,e){const{message:s}=this;s.writeVarUint(Oe.Sync);const i=((t,e,s,i)=>{const n=fe(t);switch(n){case 0:((t,e,s)=>{((t,e,s)=>{ne(t,1),ce(t,M.encodeStateAsUpdate(e,s))})(e,s,me(t))})(t,e,s);break;case 1:Ue(t,s,i);break;case 2:Re(t,s,i);break;default:throw Error("Unknown message type")}return n})(s.decoder,s.encoder,t.document,t);e&&1===i&&(t.synced=!0)}applySyncStatusMessage(t,e){e&&t.decrementUnsyncedChanges()}applyAwarenessMessage(t){if(!t.awareness)return;const{message:e}=this;((t,e,s)=>{const i=pe(e),n=ye(),o=[],r=[],a=[],c=[],h=fe(i);for(let e=0;e<h;e++){const e=fe(i);let s=fe(i);const h=JSON.parse(be(i)),l=t.meta.get(e),d=t.states.get(e),u=void 0===l?0:l.clock;(u<s||u===s&&null===h&&t.states.has(e))&&(null===h?e===t.clientID&&null!=t.getLocalState()?s++:t.states.delete(e):t.states.set(e,h),t.meta.set(e,{clock:s,lastUpdated:n}),void 0===l&&null!==h?o.push(e):void 0!==l&&null===h?c.push(e):null!==h&&(je(h,d)||a.push(e),r.push(e)))}(o.length>0||a.length>0||c.length>0)&&t.emit("change",[{added:o,updated:a,removed:c},s]),(o.length>0||r.length>0||c.length>0)&&t.emit("update",[{added:o,updated:r,removed:c},s])})(t.awareness,e.readVarUint8Array(),t)}applyAuthMessage(t){const{message:e}=this;((t,e,s,i)=>{switch(Pt(t)){case Vt.Token:e();break;case Vt.PermissionDenied:s(Wt(t));break;case Vt.Authenticated:i(Wt(t))}})(e.decoder,t.sendToken.bind(t),t.permissionDeniedHandler.bind(t),t.authenticatedHandler.bind(t))}applyQueryAwarenessMessage(t){if(!t.awareness)return;const{message:e}=this;e.writeVarUint(Oe.Awareness),e.writeVarUint8Array(Se(t.awareness,Array.from(t.awareness.getStates().keys())))}}class We{constructor(t,e={}){this.message=new t,this.encoder=this.message.get(e)}create(){return se(this.encoder)}send(t){null==t||t.send(this.create())}}class Ve extends De{constructor(){super(...arguments),this.type=Oe.Auth,this.description="Authentication"}get(t){if(void 0===t.token)throw Error("The authentication message requires `token` as an argument.");return ae(this.encoder,t.documentName),ne(this.encoder,this.type),((t,e)=>{Et(t,Vt.Token),It(t,e)})(this.encoder,t.token),this.encoder}}class Le extends De{constructor(){super(...arguments),this.type=Oe.Awareness,this.description="Awareness states update"}get(t){if(void 0===t.awareness)throw Error("The awareness message requires awareness as an argument");if(void 0===t.clients)throw Error("The awareness message requires clients as an argument");let e;return ae(this.encoder,t.documentName),ne(this.encoder,this.type),e=void 0===t.states?Se(t.awareness,t.clients):Se(t.awareness,t.clients,t.states),ce(this.encoder,e),this.encoder}}class Ne extends De{constructor(){super(...arguments),this.type=Oe.Stateless,this.description="A stateless message"}get(t){var e;return ae(this.encoder,t.documentName),ne(this.encoder,this.type),ae(this.encoder,null!==(e=t.payload)&&void 0!==e?e:""),this.encoder}}class Fe extends De{constructor(){super(...arguments),this.type=Oe.Sync,this.description="First sync step"}get(t){if(void 0===t.document)throw Error("The sync step one message requires document as an argument");return ae(this.encoder,t.documentName),ne(this.encoder,this.type),((t,e)=>{ne(t,0);const s=M.encodeStateVector(e);ce(t,s)})(this.encoder,t.document),this.encoder}}class Ye extends De{constructor(){super(...arguments),this.type=Oe.Sync,this.description="A document update"}get(t){return ae(this.encoder,t.documentName),ne(this.encoder,this.type),((t,e)=>{ne(t,2),ce(t,e)})(this.encoder,t.update),this.encoder}}class Je extends Error{constructor(){super(...arguments),this.code=1001}}class Ze extends Ee{constructor(t){var e,s,i;super(),this.configuration={name:"",document:void 0,awareness:void 0,token:null,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.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=t=>this.emit("status",t),this.forwardClose=t=>this.emit("close",t),this.forwardDisconnect=t=>this.emit("disconnect",t),this.forwardDestroy=()=>this.emit("destroy"),this.setConfiguration(t),this.configuration.document=t.document?t.document:new M.Doc,this.configuration.awareness=void 0!==t.awareness?t.awareness:new Ae(this.document),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),null===(e=this.awareness)||void 0===e||e.on("update",(()=>{this.emit("awarenessUpdate",{states:Lt(this.awareness.getStates())})})),null===(s=this.awareness)||void 0===s||s.on("change",(()=>{this.emit("awarenessChange",{states:Lt(this.awareness.getStates())})})),this.document.on("update",this.boundDocumentUpdateHandler),null===(i=this.awareness)||void 0===i||i.on("update",this.boundAwarenessUpdateHandler),this.registerEventListeners(),this.configuration.forceSyncInterval&&"number"==typeof this.configuration.forceSyncInterval&&(this.intervals.forceSync=setInterval(this.forceSync.bind(this),this.configuration.forceSyncInterval)),this.manageSocket&&this.attach()}setConfiguration(t={}){t.websocketProvider||(this.manageSocket=!0,this.configuration.websocketProvider=new Be(t)),this.configuration={...this.configuration,...t}}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-=1),0===this.unsyncedChanges&&(this.synced=!0),this.emit("unsyncedChanges",{number:this.unsyncedChanges})}forceSync(){this.resetUnsyncedChanges(),this.send(Fe,{document:this.document,documentName:this.configuration.name})}pageHide(){this.awareness&&xe(this.awareness,[this.document.clientID],"page hide")}registerEventListeners(){"undefined"!=typeof window&&"addEventListener"in window&&window.addEventListener("pagehide",this.boundPageHide)}sendStateless(t){this.send(Ne,{documentName:this.configuration.name,payload:t})}async sendToken(){let t;try{t=await this.getToken()}catch(t){return void this.permissionDeniedHandler("Failed to get token during sendToken(): "+t)}this.send(Ve,{token:null!=t?t:"",documentName:this.configuration.name})}documentUpdateHandler(t,e){e!==this&&(this.incrementUnsyncedChanges(),this.send(Ye,{update:t,documentName:this.configuration.name}))}awarenessUpdateHandler({added:t,updated:e,removed:s},i){const n=t.concat(e).concat(s);this.send(Le,{awareness:this.awareness,clients:n,documentName:this.configuration.name})}get synced(){return this.isSynced}set synced(t){this.isSynced!==t&&(this.isSynced=t,t&&this.emit("synced",{state:t}))}receiveStateless(t){this.emit("stateless",{payload:t})}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(t){this.isAuthenticated=!1,this.emit("open",{event:t}),await this.sendToken(),this.startSync()}async getToken(){return"function"==typeof this.configuration.token?await this.configuration.token():this.configuration.token}startSync(){this.resetUnsyncedChanges(),this.send(Fe,{document:this.document,documentName:this.configuration.name}),this.awareness&&null!==this.awareness.getLocalState()&&this.send(Le,{awareness:this.awareness,clients:[this.document.clientID],documentName:this.configuration.name})}send(t,e){if(!this._isAttached)return;const s=new We(t,e);this.emit("outgoingMessage",{message:s.message}),s.send(this.configuration.websocketProvider)}onMessage(t){const e=new Te(t.data),s=e.readVarString();e.writeVarString(s),this.emit("message",{event:t,message:new Te(t.data)}),new Pe(e).apply(this,!0)}onClose(){this.isAuthenticated=!1,this.synced=!1,this.awareness&&xe(this.awareness,Array.from(this.awareness.getStates().keys()).filter((t=>t!==this.document.clientID)),this)}destroy(){this.emit("destroy"),this.intervals.forceSync&&clearInterval(this.intervals.forceSync),this.awareness&&(xe(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(),"undefined"!=typeof window&&"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),this._isAttached=!0)}permissionDeniedHandler(t){this.emit("authenticationFailed",{reason:t}),this.isAuthenticated=!1}authenticatedHandler(t){this.isAuthenticated=!0,this.authorizedScope=t,this.emit("authenticated",{scope:t})}setAwarenessField(t,e){if(!this.awareness)throw new Je(`Cannot set awareness field "${t}" to ${JSON.stringify(e)}. You have disabled Awareness for this provider by explicitly passing awareness: null in the provider configuration.`);this.awareness.setLocalStateField(t,e)}}const He={type:"pen",color:j[0],size:16,opacity:1,palettes:{pen:[...j]},sizes:{pen:[...c]}},Ke={color:j[0],size:8,opacity:1,fontFamily:"Arial",palette:[...j],sizes:[...h]},qe={color:j[0],size:4,opacity:1,palette:[...j],sizes:[...c],arrows:{end:{enabled:!0,style:"triangle"}}},Xe={providers:[]},$e={shapeType:l.Rectangle,fillColor:{light:"transparent",dark:"transparent"},strokeColor:j[0],strokeWidth:4,opacity:1,fontColor:j[0],fontSize:16,fontFamily:"Arial",palette:[...j],sizes:[...c]},_e=t(class extends e{constructor(t){super(),!1!==t&&this.__registerHost(),this.isReady=s(this,"isReady"),this.activeWorkspaceChange=s(this,"activeWorkspaceChange"),this.objectsChange=s(this,"objectsChange"),this.objectsAdded=s(this,"objectsAdded"),this.objectsRemoved=s(this,"objectsRemoved"),this.objectsUpdated=s(this,"objectsUpdated"),this.undoStateChange=s(this,"undoStateChange"),this.themeChange=s(this,"themeChange"),this.localeChange=s(this,"localeChange"),this.viewportChange=s(this,"viewportChange"),this.logout=s(this,"logout"),this.login=s(this,"login"),this.isPublicChange=s(this,"isPublicChange"),this.awarenessChange=s(this,"awarenessChange")}get host(){return this}scaleMax=E;scaleMin=T;lockDrawingScale=!0;viewportBoundaryLeft=-1/0;viewportBoundaryRight=1/0;viewportBoundaryTop=-1/0;viewportBoundaryBottom=1/0;debugInfo={showViewportInfo:!1,showObjectInfo:!1,showSyncProviderInfo:!0,showMigrationInfo:!0,showAssetResolverInfo:!1};user;activeUsers;controls=[{name:"selection",type:"tool",isDefault:!0,tool:d,icon:"cursor"},{name:"brush",type:"tool",tool:f,icon:"pen",config:He},{name:"eraser",type:"tool",tool:b,icon:"eraser"},{name:"line",type:"tool",tool:y,icon:"arrow",config:qe},{name:"shape",type:"tool",tool:k,icon:"shape-rectangle",config:$e,subOptions:[{id:"rectangle",icon:"shape-rectangle",label:"Rectangle",value:l.Rectangle,toolProperty:"shapeType"},{id:"ellipse",icon:"shape-ellipse",label:"Ellipse",value:l.Ellipse,toolProperty:"shapeType"},{id:"triangle",icon:"shape-triangle",label:"Triangle",value:l.Triangle,toolProperty:"shapeType"}]},{name:"text",type:"tool",tool:u,icon:"type",config:Ke},{name:"image",type:"tool",tool:w,icon:"image"},{name:"config",type:"config"}];globalContextMenuItems=[{label:"menu.paste",icon:"paste",action:t=>this.engineRef.paste(t.x,t.y)},{label:"menu.selectAll",icon:"select-all",action:()=>this.selectAllObjectsInViewport()}];objectContextMenuItems=[{label:"menu.copy",icon:"copy",group:"clipboard",action:()=>this.engineRef.copy()},{label:"menu.cut",icon:"cut",group:"clipboard",action:()=>this.engineRef.cut()},{label:"menu.paste",icon:"paste",group:"clipboard",action:t=>this.engineRef.paste(t.x,t.y)},{label:"menu.order",icon:"ordering",group:"other",children:[{label:"menu.bringToFront",icon:"bring-to-front",action:()=>this.engineRef.bringToFront()},{label:"menu.sendToBack",icon:"send-to-back",action:()=>this.engineRef.sendToBack()},{label:"menu.moveUp",icon:"arrow-up-from-dot",action:()=>this.engineRef.bringForward()},{label:"menu.moveDown",icon:"arrow-down-from-dot",action:()=>this.engineRef.sendBackward()}]},{label:"menu.align",icon:"align",group:"other",children:[{label:"menu.alignLeft",icon:"align-start-vertical",action:()=>this.engineRef.alignObjects(v.StartHorizontal)},{label:"menu.alignCenterHorizontal",icon:"align-center-horizontal",action:()=>this.engineRef.alignObjects(v.CenterHorizontal)},{label:"menu.alignRight",icon:"align-end-vertical",action:()=>this.engineRef.alignObjects(v.EndHorizontal)},{label:"menu.alignTop",icon:"align-start-horizontal",action:()=>this.engineRef.alignObjects(v.StartVertical)},{label:"menu.alignCenterVertical",icon:"align-center-vertical",action:()=>this.engineRef.alignObjects(v.CenterVertical)},{label:"menu.alignBottom",icon:"align-end-horizontal",action:()=>this.engineRef.alignObjects(v.EndVertical)}]},{label:"menu.group",icon:"group",group:"other",children:[{label:"menu.group",icon:"group",action:()=>this.engineRef.group()},{label:"menu.ungroup",icon:"ungroup",action:()=>this.engineRef.ungroup()}]},{label:"menu.export",icon:"download",group:"export",children:[{label:"menu.exportAsSvg",icon:"download",action:()=>this.engineRef.exportSelectedObjectsAsSvg()},{label:"menu.exportAsPng",icon:"download",action:()=>this.engineRef.exportSelectedObjectsAsPng()}]},{label:"menu.delete",icon:"delete",group:"edit",action:()=>this.engineRef.delete()}];themes;theme="light";licenseKey;locale="en";locales;fallbackLocale="en";customSvgIcons={};isPanningEnabled=!0;isZoomingEnabled=!0;isControlsVisible=!0;isUtilityPanelVisible=!0;isWorkspaceManagerVisible=!0;isMoreMenuVisible=!0;isZoomPanelVisible=!0;isObjectDistanceFadingActive=!1;syncConfig=z;assetStorageConfig=Xe;cursorTarget;loginConfig;isLoading=!1;editorId;activeWorkspaceId;isReady;activeWorkspaceChange;objectsChange;objectsAdded;objectsRemoved;objectsUpdated;undoStateChange;themeChange;localeChange;viewportChange;logout;login;isPublicChange;awarenessChange;isEngineReady=!1;isControlsReady=!1;isWorkspaceManagerReady=!1;workspaces=[];activeWorkspace;isVirtualKeyboardOpen=!1;undoState=null;isBackToContentButtonVisible=!1;resolvedTerms={};availableLocaleOptions=[];currentZoomPercent=100;shortcuts=[];currentIsPublic=!1;isEditorVisible=!1;activeNotification;isNotificationDismissing=!1;notificationDismissTimeout;notificationDismissAnimationTimeout;notificationDisplayDurationMs=5e3;notificationDismissAnimationDurationMs=180;isNotificationHovered=!1;onIsEngineReady(t){t&&this.isControlsReady&&this.checkIsReady()}onIsControlsReady(t){t&&this.isEngineReady&&this.checkIsReady()}onWorkspacesChange(t){const e=this.activeWorkspace;if(e){const s=t.find((t=>t.id===e.id));s&&s!==e&&(this.activeWorkspace=s)}if(this.activeWorkspaceId){const e=t.find((t=>t.id===this.activeWorkspaceId));e&&e!==this.activeWorkspace&&(this.activeWorkspace=e)}}onActiveWorkspaceChange(){this.updateCurrentIsPublic()}onActiveWorkspaceIdChange(t){if(!t)return;if(0===this.workspaces.length)return;const e=this.workspaces.find((e=>e.id===t));e?e!==this.activeWorkspace&&(this.activeWorkspace=e):console.warn("[KritzelEditor] No workspace found with ID: "+t)}onCurrentThemeChange(){this.applyTheme(),setTimeout((()=>this.setOsSpecificCssVariables()),0),this.engineRef&&this.engineRef.saveSettings(this.currentSettingsConfig)}onThemesChange(){this.applyTheme()}onLocaleChange(t){this.engineRef&&(this.engineRef.setLocale(t),this.engineRef.saveSettings(this.currentSettingsConfig),this.refreshLocalizedTerms())}async refreshLocalizedTerms(){this.engineRef&&(this.resolvedTerms=await this.engineRef.getResolvedTerms(),this.availableLocaleOptions=await this.engineRef.getAvailableLocaleOptions())}onTouchStart(t){t.cancelable&&t.preventDefault()}async getObjectById(t){return this.engineRef.getObjectById(t)}async addObject(t){return this.engineRef.addObject(t)}async addObjects(t){return this.engineRef.addObjects(t)}async updateObject(t,e){return this.engineRef.updateObject(t,e)}async removeObject(t){return this.engineRef.removeObject(t)}async removeObjects(t){return this.engineRef.removeObjects(t)}async getSelectedObjects(){return this.engineRef.getSelectedObjects()}async selectObjects(t){return this.engineRef.selectObjects(t)}async selectAllObjectsInViewport(){return this.engineRef.selectAllObjectsInViewport()}async clearSelection(){this.engineRef.clearSelection()}async centerObjectInViewport(t){return this.engineRef.centerObjectInViewport(t)}async panToObject(t){return this.engineRef.panToObject(t)}async backToContent(){return this.engineRef.backToContent()}async centerAllObjects(t=!0){return this.engineRef.centerAllObjects(t)}async centerObjects(t,e=!0){return this.engineRef.centerObjects(t,e)}async setViewport(t,e,s){return this.engineRef.setViewport(t,e,s)}async panTo(t,e){return this.engineRef.panTo(t,e)}async zoomTo(t,e,s){return this.engineRef.zoomTo(t,e,s)}async zoomIn(t=1.6,e=200){return this.engineRef.zoomIn(t,e)}async zoomOut(t=1.6,e=200){return this.engineRef.zoomOut(t,e)}async getViewport(){return this.engineRef.getViewport()}async screenToWorld(t,e){return this.engineRef.screenToWorld(t,e)}async worldToScreen(t,e){return this.engineRef.worldToScreen(t,e)}async createWorkspace(t){return this.engineRef.createWorkspace(t)}async updateWorkspace(t){return this.engineRef.updateWorkspace(t)}async deleteWorkspace(t){return this.engineRef.deleteWorkspace(t)}async getWorkspaces(){return this.engineRef.getWorkspaces()}async getActiveWorkspace(){return this.engineRef.getActiveWorkspace()}async loadSharedWorkspace(t){return this.engineRef.loadSharedWorkspace(t)}async reinitSync(){return this.engineRef.reinitSync()}async registerTool(t,e,s){return this.engineRef.registerTool(t,e,s)}async changeActiveTool(t){return this.engineRef.changeActiveTool(t)}async changeActiveToolByName(t){return this.engineRef.changeActiveToolByName(t)}async disable(){return this.engineRef.disable()}async enable(){return this.engineRef.enable()}async copy(){return this.engineRef.copy()}async cut(){return this.engineRef.cut()}async paste(t,e){return this.engineRef.paste(t,e)}async delete(){return this.engineRef.delete()}async bringForward(t){return this.engineRef.bringForward(t)}async sendBackward(t){return this.engineRef.sendBackward(t)}async bringToFront(t){return this.engineRef.bringToFront(t)}async sendToBack(t){return this.engineRef.sendToBack(t)}async alignObjects(t){return this.engineRef.alignObjects(t)}async group(){return this.engineRef.group()}async ungroup(){return this.engineRef.ungroup()}async undo(){return this.engineRef.undo()}async redo(){return this.engineRef.redo()}async getScreenshot(t="png",e){return this.engineRef.getScreenshot(t,e)}async exportViewportAsPng(t){return this.engineRef.exportViewportAsPng(t)}async exportViewportAsSvg(t){return this.engineRef.exportViewportAsSvg(t)}async exportSelectedObjectsAsPng(){return this.engineRef.exportSelectedObjectsAsPng()}async exportSelectedObjectsAsSvg(){return this.engineRef.exportSelectedObjectsAsSvg()}async downloadAsJson(t){return this.engineRef.downloadAsJson(t)}async importFromFile(){return this.engineRef.importFromFile()}async loadObjectsFromJson(t){return this.engineRef.loadObjectsFromJson(t)}async getObjectsTotalCount(){return this.engineRef.getObjectsTotalCount()}async getAllObjects(){return this.engineRef.getAllObjects()}async findObjects(t){return this.engineRef.findObjects(t)}async getObjectsInViewport(){return this.engineRef.getObjectsInViewport()}async hideContextMenu(){return this.engineRef.hideContextMenu()}async openContextMenu(t){return this.engineRef.openContextMenu(t)}async triggerSelectionChange(){return this.engineRef.triggerSelectionChange()}async getDisplayableShortcuts(){return this.engineRef.getDisplayableShortcuts()}async triggerNotification(t){const e={...t,id:t.id??D.generateUUID(),timestamp:t.timestamp??new Date};this.clearNotificationDismissAnimationTimer(),this.isNotificationDismissing=!1,this.isNotificationHovered=!1,this.activeNotification=e,this.scheduleNotificationDismiss()}engineRef;controlsRef;settingsRef;exportRef;splitButtonRef;shareDialogRef;loginDialogRef;componentWillLoad(){this.loadSettingsFromStorage(),this.applyTheme()}applyTheme(){const t=this.resolveThemeObject();A.applyThemeToElement(this.host,t)}resolveThemeObject(){return this.themes?.find((t=>t.name===this.theme))??("dark"===this.theme?x:S)}componentDidLoad(){this.registerCustomSvgIcons(),this.listenForMobileKeyboard(),this.setOsSpecificCssVariables()}disconnectedCallback(){this.clearNotificationDismissTimer(),this.clearNotificationDismissAnimationTimer()}async checkIsReady(){if(await customElements.whenDefined("kritzel-editor"),await customElements.whenDefined("kritzel-workspace-manager"),await customElements.whenDefined("kritzel-controls"),await customElements.whenDefined("kritzel-engine"),!(this.isEngineReady&&this.isControlsReady&&this.isWorkspaceManagerReady&&this.activeWorkspace))return;this.isEditorVisible=!0;const{id:t,name:e,isPublic:s,createdAt:i,updatedAt:n}=this.activeWorkspace;this.isReady.emit({host:this.host,activeWorkspace:{id:t,name:e,isPublic:s,createdAt:i,updatedAt:n},syncConfig:this.syncConfig,assetStorageConfig:this.assetStorageConfig,loginConfig:this.loginConfig,theme:this.theme})}async onEngineReady(t){if(this.isEngineReady=!0,!t.detail.activeWorkspace)return;this.activeWorkspace=t.detail.activeWorkspace,this.workspaces=t.detail.workspaces,this.currentIsPublic=await this.engineRef.getIsPublic(),await this.refreshLocalizedTerms();const e=await this.engineRef.getViewport();this.currentZoomPercent=this.getZoomPercentFromScale(e.scale),this.loadShortcuts()}handleWorkspacesChange(t){t.stopPropagation(),this.workspaces=t.detail}handleActiveWorkspaceChange(t){if(t.stopPropagation(),this.activeWorkspace=t.detail,!this.isEngineReady)return;const{id:e,name:s,isPublic:i,createdAt:n,updatedAt:o}=this.activeWorkspace;this.activeWorkspaceChange.emit({id:e,name:s,isPublic:i,createdAt:n,updatedAt:o})}handleObjectsChange(t){t.stopPropagation(),this.objectsChange.emit(t.detail)}handleObjectsAdded(t){t.stopPropagation(),this.objectsAdded.emit(t.detail)}handleObjectsRemoved(t){t.stopPropagation(),this.objectsRemoved.emit(t.detail)}handleObjectsUpdated(t){t.stopPropagation(),this.objectsUpdated.emit(t.detail)}handleUndoStateChange(t){t.stopPropagation(),this.undoStateChange.emit(t.detail),this.undoState=t.detail}async handleObjectsInViewportChange(t){t.stopPropagation();const e=this.getContentObjects(t.detail).length>0,s=this.getContentObjects(await this.engineRef.getAllObjects()).length>0;this.isBackToContentButtonVisible=!e&&s}handleViewportChange(t){t.stopPropagation(),this.currentZoomPercent=this.getZoomPercentFromScale(t.detail.scale),this.viewportChange.emit(t.detail)}getZoomPercentFromScale(t){return!Number.isFinite(t)||t<=0?100:Math.round(100*t)}handleAwarenessChange(t){t.stopPropagation(),this.awarenessChange.emit(t.detail)}handleNotificationsChange(t){t.stopPropagation(),this.clearNotificationDismissAnimationTimer(),this.isNotificationDismissing=!1,this.isNotificationHovered=!1,this.activeNotification=t.detail,this.scheduleNotificationDismiss()}handleNotificationHoverChange(t){t.stopPropagation(),this.isNotificationHovered=t.detail,this.isNotificationHovered?this.clearNotificationDismissTimer():this.activeNotification&&!this.isNotificationDismissing&&this.scheduleNotificationDismiss()}scheduleNotificationDismiss(){this.clearNotificationDismissTimer(),this.notificationDismissTimeout=setTimeout((()=>{this.dismissNotification()}),this.notificationDisplayDurationMs)}clearNotificationDismissTimer(){this.notificationDismissTimeout&&(clearTimeout(this.notificationDismissTimeout),this.notificationDismissTimeout=void 0)}clearNotificationDismissAnimationTimer(){this.notificationDismissAnimationTimeout&&(clearTimeout(this.notificationDismissAnimationTimeout),this.notificationDismissAnimationTimeout=void 0)}dismissNotification=()=>{this.clearNotificationDismissTimer(),this.isNotificationHovered=!1,this.activeNotification&&!this.isNotificationDismissing&&(this.isNotificationDismissing=!0,this.clearNotificationDismissAnimationTimer(),this.notificationDismissAnimationTimeout=setTimeout((()=>{this.activeNotification=void 0,this.isNotificationDismissing=!1,this.notificationDismissAnimationTimeout=void 0}),this.notificationDismissAnimationDurationMs))};handleSettingsChange(t){this.scaleMin=t.detail.scaleMin,this.scaleMax=t.detail.scaleMax,this.lockDrawingScale=t.detail.lockDrawingScale,this.theme=t.detail.theme,"string"==typeof t.detail.locale&&t.detail.locale!==this.locale&&(this.locale=t.detail.locale,this.localeChange.emit(t.detail.locale)),this.viewportBoundaryLeft=t.detail.viewportBoundaryLeft??-1/0,this.viewportBoundaryRight=t.detail.viewportBoundaryRight??1/0,this.viewportBoundaryTop=t.detail.viewportBoundaryTop??-1/0,this.viewportBoundaryBottom=t.detail.viewportBoundaryBottom??1/0,this.debugInfo=t.detail.debugInfo,this.engineRef&&this.engineRef.saveSettings(t.detail),this.themeChange.emit(t.detail.theme)}get moreMenuItems(){return[{id:"share",label:this.resolvedTerms["menu.share"]??"Share",icon:"share",action:()=>{this.isLoggedIn||!this.loginConfig?this.shareDialogRef.open():this.openLoginDialog()}},{id:"export",label:this.resolvedTerms["menu.export"]??"Export",icon:"upload",action:async()=>{const t=await this.engineRef.getScreenshot("png");this.exportRef.open(t??void 0)}},{id:"import",label:this.resolvedTerms["menu.import"]??"Import",icon:"download",action:()=>this.engineRef.importFromFile()},{id:"settings",label:this.resolvedTerms["menu.settings"]??"Settings",icon:"settings",action:()=>this.settingsRef.open()},{id:"logout",label:this.resolvedTerms["menu.logout"]??"Logout",icon:"log-out",color:"#ff3b30",isVisible:this.isLoggedIn,action:()=>this.logout.emit()}]}handleToggleIsPublic=async t=>{const e=t.detail,s=await this.engineRef.getActiveWorkspace();s.isPublic=e,await this.engineRef.updateWorkspace(s),this.activeWorkspace=s.clone(),this.isPublicChange.emit({isPublic:e,workspaceId:s.id})};updateCurrentIsPublic(){const t=this.activeWorkspace?.isPublic??!1,e=this.activeWorkspace?.id;this.currentIsPublic=t,e&&this.isPublicChange.emit({isPublic:t,workspaceId:e})}handleProviderLogin=t=>{this.login.emit(t.detail)};get isLoggedIn(){return!!this.user&&!this.user.isGuest}async openLoginDialog(){this.loginDialogRef?.open()}async setLoginLoading(t){this.loginDialogRef?.setLoading(t)}async setLocale(t){this.locale=t,await(this.engineRef?.setLocale(t))}async getLocale(){return this.engineRef?this.engineRef.getLocale():this.locale}async getAvailableLocales(){return this.engineRef?this.engineRef.getAvailableLocales():[]}async registerLocales(t){await(this.engineRef?.registerLocales(t))}async t(t,e){return this.engineRef?this.engineRef.t(t,e):t}getSettingsStorageKey(){return this.editorId?"kritzel-settings-"+this.editorId:"kritzel-settings"}loadSettingsFromStorage(){const t=localStorage.getItem(this.getSettingsStorageKey());if(t)try{const e=JSON.parse(t);"number"==typeof e.scaleMin&&(this.scaleMin=e.scaleMin),"number"==typeof e.scaleMax&&(this.scaleMax=e.scaleMax),"boolean"==typeof e.lockDrawingScale&&(this.lockDrawingScale=e.lockDrawingScale),"string"==typeof e.theme&&(this.theme=e.theme),"string"==typeof e.locale&&(this.locale=e.locale),"number"==typeof e.viewportBoundaryLeft&&(this.viewportBoundaryLeft=e.viewportBoundaryLeft),"number"==typeof e.viewportBoundaryRight&&(this.viewportBoundaryRight=e.viewportBoundaryRight),"number"==typeof e.viewportBoundaryTop&&(this.viewportBoundaryTop=e.viewportBoundaryTop),"number"==typeof e.viewportBoundaryBottom&&(this.viewportBoundaryBottom=e.viewportBoundaryBottom),e.debugInfo&&(this.debugInfo={...this.debugInfo,...e.debugInfo})}catch{}}async loadShortcuts(){this.shortcuts=await this.engineRef.getDisplayableShortcuts()}get currentSettingsConfig(){return{scaleMin:this.scaleMin,scaleMax:this.scaleMax,lockDrawingScale:this.lockDrawingScale,theme:this.theme,locale:this.locale,viewportBoundaryLeft:this.viewportBoundaryLeft,viewportBoundaryRight:this.viewportBoundaryRight,viewportBoundaryTop:this.viewportBoundaryTop,viewportBoundaryBottom:this.viewportBoundaryBottom,debugInfo:this.debugInfo}}getContentObjects(t){return t.filter((t=>!(t instanceof p||t instanceof m)))}registerCustomSvgIcons(){for(const[t,e]of Object.entries(this.customSvgIcons))r.register(t,e)}listenForMobileKeyboard(){g.onKeyboardVisibleChanged((t=>{this.isVirtualKeyboardOpen=t}))}setOsSpecificCssVariables(){switch(I.detectOS()){case"iOS":this.host.style.setProperty("--kritzel-editor-top-left-buttons-top","14px"),this.host.style.setProperty("--kritzel-editor-top-left-buttons-left","14px"),this.host.style.setProperty("--kritzel-editor-controls-bottom","14px"),this.host.style.setProperty("--kritzel-editor-controls-transition","cubic-bezier(0.25, 0.1, 0.25, 1.0)"),this.host.style.setProperty("--kritzel-editor-controls-transform","translateY(200%)"),this.host.style.setProperty("--kritzel-editor-controls-transition-duration","0.25s");break;case"Android":this.host.style.setProperty("--kritzel-editor-top-left-buttons-top","14px"),this.host.style.setProperty("--kritzel-editor-top-left-buttons-left","14px"),this.host.style.setProperty("--kritzel-editor-controls-bottom","24px"),this.host.style.setProperty("--kritzel-editor-controls-transition","cubic-bezier(0.25, 0.1, 0.25, 1.0)"),this.host.style.setProperty("--kritzel-editor-controls-transform","translateY(200%)"),this.host.style.setProperty("--kritzel-editor-controls-transition-duration","0.25s");break;default:this.host.style.setProperty("--kritzel-editor-top-left-buttons-top","14px"),this.host.style.setProperty("--kritzel-editor-top-left-buttons-left","14px"),this.host.style.setProperty("--kritzel-editor-controls-bottom","14px")}}render(){const t=this.isLoggedIn,e=t,s=this.isReady&&!!this.loginConfig&&!t;return i(n,{key:"56b172459e6d940229dc1d4f409157e403ad5f27",style:{opacity:this.isEditorVisible?"1":"0",visibility:this.isEditorVisible?"visible":"hidden",transition:"opacity 0.2s ease-in-out, visibility 0.2s ease-in-out"}},i("div",{key:"93a2195c14402f38416b2d377c684e2650418edb",class:"top-left-buttons"},i("kritzel-workspace-manager",{key:"1b42b21bc35e1fc56202e19a78053e46d87ca51a",visible:this.isWorkspaceManagerVisible,workspaces:this.workspaces,activeWorkspace:this.activeWorkspace,terms:this.resolvedTerms,onWorkspaceChange:t=>this.activeWorkspace=t.detail,onIsWorkspaceManagerReady:()=>this.isWorkspaceManagerReady=!0}),i("kritzel-back-to-content",{key:"3b90b69a5b83a6e5593d4f752c4094a2a3af8c4d",visible:this.isBackToContentButtonVisible,text:this.resolvedTerms["backToContent.label"]??"Back to content",onBackToContent:()=>this.backToContent()})),this.activeNotification&&i("div",{key:"9c2ee1e10212145bf2f97a1a7f27746aa18cfc98",class:"top-center-notification-layer",role:"presentation"},i("div",{key:"a77b025329da64e1f1223a2f749aa2fc60e5c469",class:{"top-center-notification-container":!0,"is-dismissing":this.isNotificationDismissing},role:"presentation"},i("kritzel-notification-card",{key:"9ced0bc5213ec8c3387915cd71272a1f56161405",notification:this.activeNotification,locale:this.locale,onDismiss:this.dismissNotification,onHoverChange:t=>this.handleNotificationHoverChange(t)}))),i("kritzel-engine",{key:"884b7f088e164a51c49158c409904ca5419f2d55",ref:t=>{t&&(this.engineRef=t)},workspace:this.activeWorkspace,activeWorkspaceId:this.activeWorkspaceId,editorId:this.editorId,syncConfig:this.syncConfig,assetStorageConfig:this.assetStorageConfig,user:this.user,scaleMax:this.scaleMax,lockDrawingScale:this.lockDrawingScale,isObjectDistanceFadingActive:this.isObjectDistanceFadingActive,scaleMin:this.scaleMin,cursorTarget:this.cursorTarget,isLoading:this.isLoading,viewportBoundaryLeft:this.viewportBoundaryLeft,viewportBoundaryRight:this.viewportBoundaryRight,viewportBoundaryTop:this.viewportBoundaryTop,viewportBoundaryBottom:this.viewportBoundaryBottom,isPanningEnabled:this.isPanningEnabled,isZoomingEnabled:this.isZoomingEnabled,theme:this.theme,themes:this.themes,licenseKey:this.licenseKey,locale:this.locale,locales:this.locales,fallbackLocale:this.fallbackLocale,debugInfo:this.debugInfo,globalContextMenuItems:this.globalContextMenuItems,objectContextMenuItems:this.objectContextMenuItems,onIsEngineReady:t=>this.onEngineReady(t),onWorkspacesChange:t=>this.handleWorkspacesChange(t),onActiveWorkspaceChange:t=>this.handleActiveWorkspaceChange(t),onObjectsChange:t=>this.handleObjectsChange(t),onObjectsAdded:t=>this.handleObjectsAdded(t),onObjectsRemoved:t=>this.handleObjectsRemoved(t),onObjectsUpdated:t=>this.handleObjectsUpdated(t),onUndoStateChange:t=>this.handleUndoStateChange(t),onObjectsInViewportChange:t=>this.handleObjectsInViewportChange(t),onViewportChange:t=>this.handleViewportChange(t),onAwarenessChange:t=>this.handleAwarenessChange(t),onNotificationsChange:t=>this.handleNotificationsChange(t)}),i("kritzel-controls",{key:"3a7c22f037d551636c53190eb07b318c2b857162",visible:this.isControlsVisible,class:{"keyboard-open":this.isVirtualKeyboardOpen},ref:t=>{t&&(this.controlsRef=t)},controls:this.controls,isUtilityPanelVisible:this.isUtilityPanelVisible,undoState:this.undoState??void 0,theme:this.theme,terms:this.resolvedTerms,onIsControlsReady:()=>this.isControlsReady=!0}),i("div",{key:"c0dad9086679397c46f5550c38686a9b7d8bae6c",class:"bottom-left-buttons"},i("kritzel-zoom-panel",{key:"1639d6d2092ecd3fbc657dfdcfc3f12c02539329",visible:this.isZoomPanelVisible,disabled:!this.isZoomingEnabled,zoomPercent:this.currentZoomPercent,terms:this.resolvedTerms,onZoomIn:()=>this.zoomIn(),onZoomOut:()=>this.zoomOut()})),i("div",{key:"45313b28a5e4bd75d09980e4765c2241d54fe1df",class:"top-right-buttons"},i("kritzel-settings",{key:"33737a005cd6580505ee741be0dc40bd69873276",ref:t=>{t&&(this.settingsRef=t)},shortcuts:this.shortcuts,availableThemes:this.themes&&this.themes.length>0?this.themes.map((t=>t.name)):["light","dark"],availableLocales:this.availableLocaleOptions,settings:this.currentSettingsConfig,terms:this.resolvedTerms,onSettingsChange:t=>this.handleSettingsChange(t)}),i("kritzel-export",{key:"9e13001850b15b9ce9d8a502466ed9fa05ac1518",ref:t=>{t&&(this.exportRef=t)},workspaceName:this.activeWorkspace?.name||"workspace",terms:this.resolvedTerms,onExportPng:()=>this.engineRef.exportViewportAsPng(),onExportSvg:()=>this.engineRef.exportViewportAsSvg(),onExportJson:t=>this.engineRef.downloadAsJson(t.detail)}),i("kritzel-active-users",{key:"f2494af1241ecc068ace09b23cfd405c76bd1273",users:this.activeUsers}),e&&i("kritzel-current-user",{key:"7f199e3493805977b5e5b8d2c736f31729919f96",user:this.user,terms:this.resolvedTerms}),s&&i("kritzel-button",{key:"c6c192ddb1245acc771ac550c1fe3e4f9bc08eab",onButtonClick:()=>this.loginDialogRef?.open()},this.resolvedTerms["login.dialogTitle"]??"Sign in"),i("kritzel-more-menu",{key:"869194078a4c90d42c5ebd604bc58b4f55fc4cb6",items:this.moreMenuItems,visible:this.isMoreMenuVisible,terms:this.resolvedTerms}),i("kritzel-share-dialog",{key:"8daed8fd7267aca056b6a53626c721e2f23cead4",ref:t=>{t&&(this.shareDialogRef=t)},isPublic:this.currentIsPublic,workspaceId:this.activeWorkspace?.id,terms:this.resolvedTerms,onToggleIsPublic:this.handleToggleIsPublic}),this.loginConfig&&i("kritzel-login-dialog",{key:"b65ea0940cee31b152b60881180fab2445c92b0c",ref:t=>{t&&(this.loginDialogRef=t)},providers:this.loginConfig.providers,dialogTitle:this.loginConfig.title??this.resolvedTerms["login.dialogTitle"]??"Sign in",subtitle:this.loginConfig.subtitle,onProviderLogin:this.handleProviderLogin})))}static get watchers(){return{isEngineReady:[{onIsEngineReady:0}],isControlsReady:[{onIsControlsReady:0}],workspaces:[{onWorkspacesChange:0}],activeWorkspace:[{onActiveWorkspaceChange:0}],activeWorkspaceId:[{onActiveWorkspaceIdChange:0}],theme:[{onCurrentThemeChange:0}],themes:[{onThemesChange:0}],locale:[{onLocaleChange:0}]}}static get style(){return"kritzel-editor{display:flex;margin:0;position:relative;container-type:inline-size;overflow:hidden;width:100%;height:100%;align-items:center;justify-content:center;touch-action:manipulation;user-select:none;-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;text-align:start;line-height:normal}kritzel-controls{position:absolute;left:0;right:0;margin-inline:auto;width:max-content;max-width:calc(100% - 16px);bottom:var(--kritzel-editor-controls-bottom, 14px);transition:transform var(--kritzel-editor-controls-transition-duration, 0.1s) var(--kritzel-editor-controls-transition, ease-in-out)}kritzel-controls.keyboard-open{transform:var(--kritzel-editor-controls-transform, translateY(300%))}.top-left-buttons{position:absolute;top:var(--kritzel-editor-top-left-buttons-top, 14px);left:var(--kritzel-editor-top-left-buttons-left, 14px);display:flex;align-items:flex-start;gap:8px}.top-center-notification-layer{position:absolute;top:var(--kritzel-editor-top-center-notification-top, 14px);left:0;right:0;z-index:var(--kritzel-editor-top-center-notification-z-index, 10001);display:flex;justify-content:center;pointer-events:none}.top-center-notification-container{width:min(90vw, 420px);pointer-events:auto;animation:kritzel-notification-slide-in var(--kritzel-editor-notification-animation-duration, 220ms) var(--kritzel-editor-notification-animation-easing, cubic-bezier(0.22, 1, 0.36, 1))}.top-center-notification-container.is-dismissing{animation:kritzel-notification-fade-out var(--kritzel-editor-notification-dismiss-animation-duration, 180ms) var(--kritzel-editor-notification-dismiss-animation-easing, ease-in) forwards}@keyframes kritzel-notification-slide-in{from{opacity:0;transform:translateY(-10px)}to{opacity:1;transform:translateY(0)}}@keyframes kritzel-notification-fade-out{from{opacity:1;transform:translateY(0)}to{opacity:0;transform:translateY(-6px)}}@media (prefers-reduced-motion: reduce){.top-center-notification-container{animation:none}}.top-right-buttons{position:absolute;top:var(--kritzel-editor-top-right-buttons-top, 14px);right:var(--kritzel-editor-top-right-buttons-right, 14px);display:flex;align-items:center;gap:8px}.bottom-left-buttons{position:absolute;left:var(--kritzel-editor-top-left-buttons-left, 14px);bottom:var(--kritzel-editor-controls-bottom, 14px);display:flex;align-items:flex-end}@container (max-width: 767px){.bottom-left-buttons{display:none}}.top-right-button{display:flex;align-items:center;justify-content:center;width:50px;height:50px;padding:0;border:var(--kritzel-split-button-border, 1px solid #ebebeb);border-radius:var(--kritzel-split-button-border-radius, 12px);background-color:var(--kritzel-split-button-background-color, #ffffff);cursor:var(--kritzel-global-pointer-cursor, pointer);box-shadow:var(--kritzel-split-button-box-shadow, 0 0 3px rgba(0, 0, 0, 0.08));transition:background-color 150ms ease;-webkit-tap-highlight-color:transparent}.top-right-button:hover{background-color:#f5f5f5}.top-right-button:active{background-color:#ebebeb}"}},[512,"kritzel-editor",{scaleMax:[1026,"scale-max"],scaleMin:[1026,"scale-min"],lockDrawingScale:[1028,"lock-drawing-scale"],viewportBoundaryLeft:[1026,"viewport-boundary-left"],viewportBoundaryRight:[1026,"viewport-boundary-right"],viewportBoundaryTop:[1026,"viewport-boundary-top"],viewportBoundaryBottom:[1026,"viewport-boundary-bottom"],debugInfo:[1040],user:[16],activeUsers:[16],controls:[16],globalContextMenuItems:[16],objectContextMenuItems:[16],themes:[16],theme:[1025],licenseKey:[1,"license-key"],locale:[1025],locales:[16],fallbackLocale:[1,"fallback-locale"],customSvgIcons:[16],isPanningEnabled:[1028,"is-panning-enabled"],isZoomingEnabled:[1028,"is-zooming-enabled"],isControlsVisible:[4,"is-controls-visible"],isUtilityPanelVisible:[4,"is-utility-panel-visible"],isWorkspaceManagerVisible:[4,"is-workspace-manager-visible"],isMoreMenuVisible:[4,"is-more-menu-visible"],isZoomPanelVisible:[4,"is-zoom-panel-visible"],isObjectDistanceFadingActive:[4,"is-object-distance-fading-active"],syncConfig:[16],assetStorageConfig:[16],cursorTarget:[16],loginConfig:[16],isLoading:[4,"is-loading"],editorId:[1,"editor-id"],activeWorkspaceId:[1,"active-workspace-id"],isEngineReady:[32],isControlsReady:[32],isWorkspaceManagerReady:[32],workspaces:[32],activeWorkspace:[32],isVirtualKeyboardOpen:[32],undoState:[32],isBackToContentButtonVisible:[32],resolvedTerms:[32],availableLocaleOptions:[32],currentZoomPercent:[32],shortcuts:[32],currentIsPublic:[32],isEditorVisible:[32],activeNotification:[32],isNotificationDismissing:[32],getObjectById:[64],addObject:[64],addObjects:[64],updateObject:[64],removeObject:[64],removeObjects:[64],getSelectedObjects:[64],selectObjects:[64],selectAllObjectsInViewport:[64],clearSelection:[64],centerObjectInViewport:[64],panToObject:[64],backToContent:[64],centerAllObjects:[64],centerObjects:[64],setViewport:[64],panTo:[64],zoomTo:[64],zoomIn:[64],zoomOut:[64],getViewport:[64],screenToWorld:[64],worldToScreen:[64],createWorkspace:[64],updateWorkspace:[64],deleteWorkspace:[64],getWorkspaces:[64],getActiveWorkspace:[64],loadSharedWorkspace:[64],reinitSync:[64],registerTool:[64],changeActiveTool:[64],changeActiveToolByName:[64],disable:[64],enable:[64],copy:[64],cut:[64],paste:[64],delete:[64],bringForward:[64],sendBackward:[64],bringToFront:[64],sendToBack:[64],alignObjects:[64],group:[64],ungroup:[64],undo:[64],redo:[64],getScreenshot:[64],exportViewportAsPng:[64],exportViewportAsSvg:[64],exportSelectedObjectsAsPng:[64],exportSelectedObjectsAsSvg:[64],downloadAsJson:[64],importFromFile:[64],loadObjectsFromJson:[64],getObjectsTotalCount:[64],getAllObjects:[64],findObjects:[64],getObjectsInViewport:[64],hideContextMenu:[64],openContextMenu:[64],triggerSelectionChange:[64],getDisplayableShortcuts:[64],triggerNotification:[64],openLoginDialog:[64],setLoginLoading:[64],setLocale:[64],getLocale:[64],getAvailableLocales:[64],registerLocales:[64],t:[64]},[[0,"dblclick","onTouchStart"]],{isEngineReady:[{onIsEngineReady:0}],isControlsReady:[{onIsControlsReady:0}],workspaces:[{onWorkspacesChange:0}],activeWorkspace:[{onActiveWorkspaceChange:0}],activeWorkspaceId:[{onActiveWorkspaceIdChange:0}],theme:[{onCurrentThemeChange:0}],themes:[{onThemesChange:0}],locale:[{onLocaleChange:0}]}]),Qe=_e,Ge=function(){"undefined"!=typeof customElements&&["kritzel-editor","kritzel-active-users","kritzel-avatar","kritzel-awareness-cursors","kritzel-back-to-content","kritzel-button","kritzel-color","kritzel-color-palette","kritzel-context-menu","kritzel-controls","kritzel-current-user","kritzel-current-user-dialog","kritzel-cursor-trail","kritzel-dialog","kritzel-dropdown","kritzel-engine","kritzel-export","kritzel-font","kritzel-font-family","kritzel-font-size","kritzel-icon","kritzel-input","kritzel-line-endings","kritzel-login-dialog","kritzel-master-detail","kritzel-menu","kritzel-menu-item","kritzel-more-menu","kritzel-notification-card","kritzel-numeric-input","kritzel-opacity-slider","kritzel-pill-tabs","kritzel-portal","kritzel-settings","kritzel-shape-fill","kritzel-share-dialog","kritzel-slide-toggle","kritzel-split-button","kritzel-stroke-size","kritzel-tool-config","kritzel-tooltip","kritzel-utility-panel","kritzel-watermark","kritzel-workspace-manager","kritzel-zoom-panel"].forEach((t=>{switch(t){case"kritzel-editor":customElements.get(o(t))||customElements.define(o(t),_e);break;case"kritzel-active-users":customElements.get(o(t))||B();break;case"kritzel-avatar":customElements.get(o(t))||U();break;case"kritzel-awareness-cursors":customElements.get(o(t))||R();break;case"kritzel-back-to-content":customElements.get(o(t))||P();break;case"kritzel-button":customElements.get(o(t))||W();break;case"kritzel-color":customElements.get(o(t))||V();break;case"kritzel-color-palette":customElements.get(o(t))||L();break;case"kritzel-context-menu":customElements.get(o(t))||N();break;case"kritzel-controls":customElements.get(o(t))||F();break;case"kritzel-current-user":customElements.get(o(t))||Y();break;case"kritzel-current-user-dialog":customElements.get(o(t))||J();break;case"kritzel-cursor-trail":customElements.get(o(t))||Z();break;case"kritzel-dialog":customElements.get(o(t))||H();break;case"kritzel-dropdown":customElements.get(o(t))||K();break;case"kritzel-engine":customElements.get(o(t))||C();break;case"kritzel-export":customElements.get(o(t))||q();break;case"kritzel-font":customElements.get(o(t))||X();break;case"kritzel-font-family":customElements.get(o(t))||$();break;case"kritzel-font-size":customElements.get(o(t))||_();break;case"kritzel-icon":customElements.get(o(t))||a();break;case"kritzel-input":customElements.get(o(t))||Q();break;case"kritzel-line-endings":customElements.get(o(t))||G();break;case"kritzel-login-dialog":customElements.get(o(t))||tt();break;case"kritzel-master-detail":customElements.get(o(t))||et();break;case"kritzel-menu":customElements.get(o(t))||it();break;case"kritzel-menu-item":customElements.get(o(t))||st();break;case"kritzel-more-menu":customElements.get(o(t))||nt();break;case"kritzel-notification-card":customElements.get(o(t))||ot();break;case"kritzel-numeric-input":customElements.get(o(t))||rt();break;case"kritzel-opacity-slider":customElements.get(o(t))||at();break;case"kritzel-pill-tabs":customElements.get(o(t))||ct();break;case"kritzel-portal":customElements.get(o(t))||ht();break;case"kritzel-settings":customElements.get(o(t))||lt();break;case"kritzel-shape-fill":customElements.get(o(t))||dt();break;case"kritzel-share-dialog":customElements.get(o(t))||ut();break;case"kritzel-slide-toggle":customElements.get(o(t))||pt();break;case"kritzel-split-button":customElements.get(o(t))||mt();break;case"kritzel-stroke-size":customElements.get(o(t))||gt();break;case"kritzel-tool-config":customElements.get(o(t))||ft();break;case"kritzel-tooltip":customElements.get(o(t))||bt();break;case"kritzel-utility-panel":customElements.get(o(t))||yt();break;case"kritzel-watermark":customElements.get(o(t))||O();break;case"kritzel-workspace-manager":customElements.get(o(t))||kt();break;case"kritzel-zoom-panel":customElements.get(o(t))||wt()}}))};export{He as D,Ze as H,Qe as KritzelEditor,Be as a,Ke as b,qe as c,Xe as d,Ge as defineCustomElement}
1
+ import{p as t,H as e,c as s,h as i,d as n,t as o}from"./p-B43upypT.js";import{K as r,d as a}from"./p-CdR76C4L.js";import{D as c,h,S as l,f as d,e as u,i as p,j as m,k as g}from"./p-BJlf4iHH.js";import{a as f,c as b,b as y,e as k,d as v,k as w,l as z,m as C}from"./p-D9BugXUi.js";import{D as j,T as A,d as x,l as E}from"./p-BmyTdQGy.js";import{A as T,a as S,d as O}from"./p-CwuGA058.js";import{K as I}from"./p-jGOpkGDl.js";import{O as D}from"./p-Dd-pMvlr.js";import"./p-2Swq9rEm.js";import*as M from"yjs";import"y-indexeddb";import"y-websocket";import{d as B}from"./p-yD_3Z3K1.js";import{d as U}from"./p-DXcjIb_a.js";import{d as P}from"./p-BoA6RXEA.js";import{d as R}from"./p-DMAScsJF.js";import{d as W}from"./p-oGAPPwAL.js";import{d as L}from"./p-zd7zXld8.js";import{d as V}from"./p-1nG2hxfJ.js";import{d as N}from"./p-BxpKq94F.js";import{d as F}from"./p-BH4AasB1.js";import{d as H}from"./p-Di5dpXrF.js";import{d as K}from"./p-D52oKO_e.js";import{d as J}from"./p-B4b6TDxp.js";import{d as Y}from"./p-DX2nriaq.js";import{d as Z}from"./p-Df3BwVGy.js";import{d as q}from"./p-DPpPd5GI.js";import{d as G}from"./p-DgnK50xO.js";import{d as _}from"./p-JhOYwUOj.js";import{d as X}from"./p-8xkoVMfO.js";import{d as $}from"./p-DSOc0eIT.js";import{d as Q}from"./p-CXpv9Rxe.js";import{d as tt}from"./p-B_6RNask.js";import{d as et}from"./p-Ds-P2bYH.js";import{d as st}from"./p-CVhcOiEA.js";import{d as it,a as nt}from"./p-BKOsmXB5.js";import{d as ot}from"./p-jzuGPW5o.js";import{d as rt}from"./p-pagW8YF7.js";import{d as at}from"./p-DIMNEOTW.js";import{d as ct}from"./p-BzrxIesp.js";import{d as ht}from"./p-D09kgc5Q.js";import{d as lt}from"./p-BLOPBDUF.js";import{d as dt}from"./p-sLHApVnR.js";import{d as ut}from"./p-BFYtCsZu.js";import{d as pt}from"./p-DEqpY4K2.js";import{d as mt}from"./p-BzJEwFtn.js";import{d as gt}from"./p-D8TOEhPY.js";import{d as ft}from"./p-Bm_BWQa4.js";import{d as bt}from"./p-BlozPPKi.js";import{d as yt}from"./p-DZcwchEg.js";import{d as kt}from"./p-Bd_yPNfg.js";import{d as vt}from"./p-BulDbBWB.js";import{d as wt}from"./p-CMphprF1.js";const zt=Math.floor,Ct=127,jt=Number.MAX_SAFE_INTEGER,At="undefined"!=typeof TextEncoder?new TextEncoder:null,xt=At?t=>At.encode(t):t=>{const e=unescape(encodeURIComponent(t)),s=e.length,i=new Uint8Array(s);for(let t=0;t<s;t++)i[t]=e.codePointAt(t);return i};let Et="undefined"==typeof TextDecoder?null:new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0});Et&&1===Et.decode(new Uint8Array).length&&(Et=null);const Tt=(t,e)=>{const s=t.cbuf.length;t.cpos===s&&(t.bufs.push(t.cbuf),t.cbuf=new Uint8Array(2*s),t.cpos=0),t.cbuf[t.cpos++]=e},St=(t,e)=>{for(;e>Ct;)Tt(t,128|Ct&e),e=zt(e/128);Tt(t,Ct&e)},Ot=new Uint8Array(3e4),It=Ot.length/3,Dt=At&&At.encodeInto?(t,e)=>{if(e.length<It){const s=At.encodeInto(e,Ot).written||0;St(t,s);for(let e=0;e<s;e++)Tt(t,Ot[e])}else Mt(t,xt(e))}:(t,e)=>{const s=unescape(encodeURIComponent(e)),i=s.length;St(t,i);for(let e=0;e<i;e++)Tt(t,s.codePointAt(e))},Mt=(t,e)=>{St(t,e.byteLength),((t,e)=>{const s=t.cbuf.length,i=t.cpos,n=((t,e)=>t<e?t:e)(s-i,e.length),o=e.length-n;t.cbuf.set(e.subarray(0,n),i),t.cpos+=n,o>0&&(t.bufs.push(t.cbuf),t.cbuf=new Uint8Array(((t,e)=>t>e?t:e)(2*s,o)),t.cbuf.set(e.subarray(n)),t.cpos=o)})(t,e)},Bt=t=>Error(t),Ut=Bt("Unexpected end of array"),Pt=Bt("Integer out of Range"),Rt=t=>t.arr[t.pos++],Wt=t=>{let e=0,s=1;const i=t.arr.length;for(;t.pos<i;){const i=t.arr[t.pos++];if(e+=(i&Ct)*s,s*=128,i<128)return e;if(e>jt)throw Pt}throw Ut},Lt=Et?t=>Et.decode((t=>((t,e)=>{const s=new Uint8Array(t.arr.buffer,t.pos+t.arr.byteOffset,e);return t.pos+=e,s})(t,Wt(t)))(t)):t=>{let e=Wt(t);if(0===e)return"";{let s=String.fromCodePoint(Rt(t));if(--e<100)for(;e--;)s+=String.fromCodePoint(Rt(t));else for(;e>0;){const i=e<1e4?e:1e4,n=t.arr.subarray(t.pos,t.pos+i);t.pos+=i,s+=String.fromCodePoint.apply(null,n),e-=i}return decodeURIComponent(escape(s))}};var Vt;!function(t){t[t.Token=0]="Token",t[t.PermissionDenied=1]="PermissionDenied",t[t.Authenticated=2]="Authenticated"}(Vt||(Vt={}));const Nt=t=>Array.from(t.entries()).map((([t,e])=>({clientId:t,...e})));var Ft;async function Ht(t){return new Promise((e=>setTimeout(e,t)))}function Kt(t,e){let s=e.delay;if(0===s)return 0;if(e.factor&&(s*=Math.pow(e.factor,t.attemptNum-1),0!==e.maxDelay&&(s=Math.min(s,e.maxDelay))),e.jitter){const t=Math.ceil(e.minDelay),i=Math.floor(s);s=Math.floor(Math.random()*(i-t+1))+t}return Math.round(s)}!function(t){t[t.Connecting=0]="Connecting",t[t.Open=1]="Open",t[t.Closing=2]="Closing",t[t.Closed=3]="Closed"}(Ft||(Ft={}));const Jt=Math.floor,Yt=128,Zt=127,qt=Number.MAX_SAFE_INTEGER,Gt=()=>new Set,_t=Array.from,Xt="undefined"!=typeof TextEncoder?new TextEncoder:null,$t=Xt?t=>Xt.encode(t):t=>{const e=unescape(encodeURIComponent(t)),s=e.length,i=new Uint8Array(s);for(let t=0;t<s;t++)i[t]=e.codePointAt(t);return i};let Qt="undefined"==typeof TextDecoder?null:new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0});Qt&&1===Qt.decode(new Uint8Array).length&&(Qt=null);class te{constructor(){this.cpos=0,this.cbuf=new Uint8Array(100),this.bufs=[]}}const ee=()=>new te,se=t=>{let e=t.cpos;for(let s=0;s<t.bufs.length;s++)e+=t.bufs[s].length;return e},ie=t=>{const e=new Uint8Array(se(t));let s=0;for(let i=0;i<t.bufs.length;i++){const n=t.bufs[i];e.set(n,s),s+=n.length}return e.set(new Uint8Array(t.cbuf.buffer,0,t.cpos),s),e},ne=(t,e)=>{const s=t.cbuf.length;t.cpos===s&&(t.bufs.push(t.cbuf),t.cbuf=new Uint8Array(2*s),t.cpos=0),t.cbuf[t.cpos++]=e},oe=(t,e)=>{for(;e>Zt;)ne(t,Yt|Zt&e),e=Jt(e/128);ne(t,Zt&e)},re=new Uint8Array(3e4),ae=re.length/3,ce=Xt&&Xt.encodeInto?(t,e)=>{if(e.length<ae){const s=Xt.encodeInto(e,re).written||0;oe(t,s);for(let e=0;e<s;e++)ne(t,re[e])}else he(t,$t(e))}:(t,e)=>{const s=unescape(encodeURIComponent(e)),i=s.length;oe(t,i);for(let e=0;e<i;e++)ne(t,s.codePointAt(e))},he=(t,e)=>{oe(t,e.byteLength),((t,e)=>{const s=t.cbuf.length,i=t.cpos,n=((t,e)=>t<e?t:e)(s-i,e.length),o=e.length-n;t.cbuf.set(e.subarray(0,n),i),t.cpos+=n,o>0&&(t.bufs.push(t.cbuf),t.cbuf=new Uint8Array(((t,e)=>t>e?t:e)(2*s,o)),t.cbuf.set(e.subarray(n)),t.cpos=o)})(t,e)},le=t=>Error(t),de=le("Unexpected end of array"),ue=le("Integer out of Range");class pe{constructor(t){this.arr=t,this.pos=0}}const me=t=>new pe(t),ge=t=>((t,e)=>{const s=new Uint8Array(t.arr.buffer,t.pos+t.arr.byteOffset,e);return t.pos+=e,s})(t,be(t)),fe=t=>t.arr[t.pos++],be=t=>{let e=0,s=1;const i=t.arr.length;for(;t.pos<i;){const i=t.arr[t.pos++];if(e+=(i&Zt)*s,s*=128,i<Yt)return e;if(e>qt)throw ue}throw de},ye=Qt?t=>Qt.decode(ge(t)):t=>{let e=be(t);if(0===e)return"";{let s=String.fromCodePoint(fe(t));if(--e<100)for(;e--;)s+=String.fromCodePoint(fe(t));else for(;e>0;){const i=e<1e4?e:1e4,n=t.arr.subarray(t.pos,t.pos+i);t.pos+=i,s+=String.fromCodePoint.apply(null,n),e-=i}return decodeURIComponent(escape(s))}},ke=Date.now,ve=()=>new Map;class we{constructor(){this._observers=ve()}on(t,e){((t,e,s)=>{let i=t.get(e);return void 0===i&&t.set(e,i=s()),i})(this._observers,t,Gt).add(e)}once(t,e){const s=(...i)=>{this.off(t,s),e(...i)};this.on(t,s)}off(t,e){const s=this._observers.get(t);void 0!==s&&(s.delete(e),0===s.size&&this._observers.delete(t))}emit(t,e){return _t((this._observers.get(t)||ve()).values()).forEach((t=>t(...e)))}destroy(){this._observers=ve()}}const ze=Object.keys,Ce=t=>ze(t).length,je=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),Ae=(t,e)=>{if(null==t||null==e)return((t,e)=>t===e)(t,e);if(t.constructor!==e.constructor)return!1;if(t===e)return!0;switch(t.constructor){case ArrayBuffer:t=new Uint8Array(t),e=new Uint8Array(e);case Uint8Array:if(t.byteLength!==e.byteLength)return!1;for(let s=0;s<t.length;s++)if(t[s]!==e[s])return!1;break;case Set:if(t.size!==e.size)return!1;for(const s of t)if(!e.has(s))return!1;break;case Map:if(t.size!==e.size)return!1;for(const s of t.keys())if(!e.has(s)||!Ae(t.get(s),e.get(s)))return!1;break;case Object:if(Ce(t)!==Ce(e))return!1;for(const s in t)if(!je(t,s)||!Ae(t[s],e[s]))return!1;break;case Array:if(t.length!==e.length)return!1;for(let s=0;s<t.length;s++)if(!Ae(t[s],e[s]))return!1;break;default:return!1}return!0};class xe extends we{constructor(t){super(),this.doc=t,this.clientID=t.clientID,this.states=new Map,this.meta=new Map,this._checkInterval=setInterval((()=>{const t=ke();null!==this.getLocalState()&&15e3<=t-this.meta.get(this.clientID).lastUpdated&&this.setLocalState(this.getLocalState());const e=[];this.meta.forEach(((s,i)=>{i!==this.clientID&&3e4<=t-s.lastUpdated&&this.states.has(i)&&e.push(i)})),e.length>0&&Ee(this,e,"timeout")}),Jt(3e3)),t.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(t){const e=this.clientID,s=this.meta.get(e),i=void 0===s?0:s.clock+1,n=this.states.get(e);null===t?this.states.delete(e):this.states.set(e,t),this.meta.set(e,{clock:i,lastUpdated:ke()});const o=[],r=[],a=[],c=[];null===t?c.push(e):null==n?null!=t&&o.push(e):(r.push(e),Ae(n,t)||a.push(e)),(o.length>0||a.length>0||c.length>0)&&this.emit("change",[{added:o,updated:a,removed:c},"local"]),this.emit("update",[{added:o,updated:r,removed:c},"local"])}setLocalStateField(t,e){const s=this.getLocalState();null!==s&&this.setLocalState({...s,[t]:e})}getStates(){return this.states}}const Ee=(t,e,s)=>{const i=[];for(let s=0;s<e.length;s++){const n=e[s];if(t.states.has(n)){if(t.states.delete(n),n===t.clientID){const e=t.meta.get(n);t.meta.set(n,{clock:e.clock+1,lastUpdated:ke()})}i.push(n)}}i.length>0&&(t.emit("change",[{added:[],updated:[],removed:i},s]),t.emit("update",[{added:[],updated:[],removed:i},s]))},Te=(t,e,s=t.states)=>{const i=e.length,n=ee();oe(n,i);for(let o=0;o<i;o++){const i=e[o],r=s.get(i)||null,a=t.meta.get(i).clock;oe(n,i),oe(n,a),ce(n,JSON.stringify(r))}return ie(n)};class Se{constructor(){this.callbacks={}}on(t,e){return this.callbacks[t]||(this.callbacks[t]=[]),this.callbacks[t].push(e),this}emit(t,...e){const s=this.callbacks[t];return s&&s.forEach((t=>t.apply(this,e))),this}off(t,e){const s=this.callbacks[t];return s&&(e?this.callbacks[t]=s.filter((t=>t!==e)):delete this.callbacks[t]),this}removeAllListeners(){this.callbacks={}}}class Oe{constructor(t){this.data=t,this.encoder=ee(),this.decoder=me(new Uint8Array(this.data))}peekVarString(){return(t=>{const e=t.pos,s=ye(t);return t.pos=e,s})(this.decoder)}readVarUint(){return be(this.decoder)}readVarString(){return ye(this.decoder)}readVarUint8Array(){return ge(this.decoder)}writeVarUint(t){return oe(this.encoder,t)}writeVarString(t){return ce(this.encoder,t)}writeVarUint8Array(t){return he(this.encoder,t)}length(){return se(this.encoder)}}var Ie,De;!function(t){t[t.Sync=0]="Sync",t[t.Awareness=1]="Awareness",t[t.Auth=2]="Auth",t[t.QueryAwareness=3]="QueryAwareness",t[t.Stateless=5]="Stateless",t[t.CLOSE=7]="CLOSE",t[t.SyncStatus=8]="SyncStatus"}(Ie||(Ie={})),function(t){t.Connecting="connecting",t.Connected="connected",t.Disconnected="disconnected"}(De||(De={}));class Me{constructor(){this.encoder=ee()}get(t){return t.encoder}toUint8Array(){return ie(this.encoder)}}class Be extends Me{constructor(){super(...arguments),this.type=Ie.CLOSE,this.description="Ask the server to close the connection"}get(t){return ce(this.encoder,t.documentName),oe(this.encoder,this.type),this.encoder}}class Ue extends Se{constructor(t){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=De.Disconnected,this.lastMessageReceived=0,this.identifier=0,this.intervals={connectionChecker:null},this.connectionAttempt=null,this.receivedOnOpenPayload=void 0,this.closeTries=0,this.setConfiguration(t),this.configuration.WebSocketPolyfill=t.WebSocketPolyfill?t.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(t){this.status=De.Connected,this.emit("status",{status:De.Connected}),this.cancelWebsocketRetry=void 0,this.receivedOnOpenPayload=t}attach(t){this.configuration.providerMap.set(t.configuration.name,t),this.status===De.Disconnected&&this.shouldConnect&&this.connect(),this.receivedOnOpenPayload&&this.status===De.Connected&&t.onOpen(this.receivedOnOpenPayload)}detach(t){this.configuration.providerMap.has(t.configuration.name)&&(t.send(Be,{documentName:t.configuration.name}),this.configuration.providerMap.delete(t.configuration.name))}setConfiguration(t={}){this.configuration={...this.configuration,...t},this.configuration.autoConnect||(this.shouldConnect=!1)}async connect(){if(this.status===De.Connected)return;this.cancelWebsocketRetry&&(this.cancelWebsocketRetry(),this.cancelWebsocketRetry=void 0),this.receivedOnOpenPayload=void 0,this.shouldConnect=!0;const{retryPromise:t,cancelFunc:e}=(()=>{let t=!1;return{retryPromise:async function(t,e){const s=function(t){return t||(t={}),{delay:void 0===t.delay?200:t.delay,initialDelay:void 0===t.initialDelay?0:t.initialDelay,minDelay:void 0===t.minDelay?0:t.minDelay,maxDelay:void 0===t.maxDelay?0:t.maxDelay,factor:void 0===t.factor?0:t.factor,maxAttempts:void 0===t.maxAttempts?3:t.maxAttempts,timeout:void 0===t.timeout?0:t.timeout,jitter:!0===t.jitter,initialJitter:!0===t.initialJitter,handleError:void 0===t.handleError?null:t.handleError,handleTimeout:void 0===t.handleTimeout?null:t.handleTimeout,beforeAttempt:void 0===t.beforeAttempt?null:t.beforeAttempt,calculateDelay:void 0===t.calculateDelay?null:t.calculateDelay}}(e);for(const t of["delay","initialDelay","minDelay","maxDelay","maxAttempts","timeout"]){const e=s[t];if(!Number.isInteger(e)||e<0)throw Error(`Value for ${t} must be an integer greater than or equal to 0`)}if(s.factor.constructor!==Number||s.factor<0)throw Error("Value for factor must be a number greater than or equal to 0");if(s.delay<s.minDelay)throw Error(`delay cannot be less than minDelay (delay: ${s.delay}, minDelay: ${s.minDelay}`);const i={attemptNum:0,attemptsRemaining:s.maxAttempts?s.maxAttempts:-1,aborted:!1,abort(){i.aborted=!0}},n=s.calculateDelay||Kt,o=s.calculateDelay?s.calculateDelay(i,s):s.initialDelay;if(o&&await Ht(o),i.attemptNum<1&&s.initialJitter){const t=n(i,s);t&&await Ht(t)}return async function e(){if(s.beforeAttempt&&s.beforeAttempt(i,s),i.aborted){const t=Error("Attempt aborted");throw t.code="ATTEMPT_ABORTED",t}const o=async t=>{if(s.handleError&&await s.handleError(t,i,s),i.aborted||0===i.attemptsRemaining)throw t;i.attemptNum++;const o=n(i,s);return o&&await Ht(o),e()};return i.attemptsRemaining>0&&i.attemptsRemaining--,s.timeout?new Promise(((e,n)=>{const r=setTimeout((()=>{if(s.handleTimeout)try{e(s.handleTimeout(i,s))}catch(t){n(t)}else{const t=Error(`Retry timeout (attemptNum: ${i.attemptNum}, timeout: ${s.timeout})`);t.code="ATTEMPT_TIMEOUT",n(t)}}),s.timeout);t(i,s).then((t=>{clearTimeout(r),e(t)})).catch((t=>{clearTimeout(r),o(t).then(e).catch(n)}))})):t(i,s).catch(o)}()}(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:e=>{this.shouldConnect&&!t||e.abort()}}).catch((t=>{if(t&&"ATTEMPT_ABORTED"!==t.code)throw t})),cancelFunc:()=>{t=!0}}})();return this.cancelWebsocketRetry=e,t}attachWebSocketListeners(t,e){const{identifier:s}=t;this.webSocketHandlers[s]={message:t=>this.emit("message",t),close:t=>this.emit("close",{event:t}),open:t=>this.emit("open",t),error:t=>{e(t)}};const i=this.webSocketHandlers[t.identifier];Object.keys(i).forEach((e=>{t.addEventListener(e,i[e])}))}cleanupWebSocket(){if(!this.webSocket)return;const{identifier:t}=this.webSocket,e=this.webSocketHandlers[t];Object.keys(e).forEach((s=>{var i;null===(i=this.webSocket)||void 0===i||i.removeEventListener(s,e[s]),delete this.webSocketHandlers[t]})),this.webSocket.close(),this.webSocket=null}createWebSocketConnection(){return new Promise(((t,e)=>{this.webSocket&&(this.messageQueue=[],this.cleanupWebSocket()),this.lastMessageReceived=0,this.identifier+=1;const s=new this.configuration.WebSocketPolyfill(this.url);s.binaryType="arraybuffer",s.identifier=this.identifier,this.attachWebSocketListeners(s,e),this.webSocket=s,this.status=De.Connecting,this.emit("status",{status:De.Connecting}),this.connectionAttempt={resolve:t,reject:e}}))}onMessage(t){var e;this.resolveConnectionAttempt(),this.lastMessageReceived=ke();const s=new Oe(t.data).peekVarString();null===(e=this.configuration.providerMap.get(s))||void 0===e||e.onMessage(t)}resolveConnectionAttempt(){this.connectionAttempt&&(this.connectionAttempt.resolve(),this.connectionAttempt=null,this.status=De.Connected,this.emit("status",{status:De.Connected}),this.emit("connect"),this.messageQueue.forEach((t=>this.send(t))),this.messageQueue=[])}stopConnectionAttempt(){this.connectionAttempt=null}rejectConnectionAttempt(){var t;null===(t=this.connectionAttempt)||void 0===t||t.reject(),this.connectionAttempt=null}checkConnection(){var t;this.status===De.Connected&&this.lastMessageReceived&&(this.configuration.messageReconnectTimeout>=ke()-this.lastMessageReceived||(this.closeTries+=1,this.closeTries>2?(this.onClose({event:{code:4408,reason:"forced"}}),this.closeTries=0):(null===(t=this.webSocket)||void 0===t||t.close(),this.messageQueue=[])))}get serverUrl(){if(this.configuration.preserveTrailingSlash)return this.configuration.url;let t=this.configuration.url;for(;"/"===t[t.length-1];)t=t.slice(0,t.length-1);return t}get url(){return this.serverUrl}disconnect(){if(this.shouldConnect=!1,null!==this.webSocket)try{this.webSocket.close(),this.messageQueue=[]}catch(t){console.error(t)}}send(t){var e;(null===(e=this.webSocket)||void 0===e?void 0:e.readyState)===Ft.Open?this.webSocket.send(t):this.messageQueue.push(t)}onClose({event:t}){this.closeTries=0,this.cleanupWebSocket(),this.connectionAttempt&&this.rejectConnectionAttempt(),this.status=De.Disconnected,this.emit("status",{status:De.Disconnected}),this.emit("disconnect",{event:t}),!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()}}const Pe=(t,e,s)=>{try{M.applyUpdate(e,ge(t),s)}catch(t){console.error("Caught error while handling a Yjs update",t)}},Re=Pe;class We{constructor(t){this.message=t}apply(t,e){const{message:s}=this,i=s.readVarUint(),n=s.length();switch(i){case Ie.Sync:this.applySyncMessage(t,e);break;case Ie.Awareness:this.applyAwarenessMessage(t);break;case Ie.Auth:this.applyAuthMessage(t);break;case Ie.QueryAwareness:this.applyQueryAwarenessMessage(t);break;case Ie.Stateless:t.receiveStateless(ye(s.decoder));break;case Ie.SyncStatus:this.applySyncStatusMessage(t,1===(t=>{let e=t.arr[t.pos++],s=63&e,i=64;const n=(64&e)>0?-1:1;if(!(e&Yt))return n*s;const o=t.arr.length;for(;t.pos<o;){if(e=t.arr[t.pos++],s+=(e&Zt)*i,i*=128,e<Yt)return n*s;if(s>qt)throw ue}throw de})(s.decoder));break;case Ie.CLOSE:const n={code:1e3,reason:ye(s.decoder),target:t.configuration.websocketProvider.webSocket,type:"close"};t.onClose(),t.configuration.onClose({event:n}),t.forwardClose({event:n});break;default:throw Error("Can’t apply message of unknown type: "+i)}s.length()>n+1&&t.send(Me,{encoder:s.encoder})}applySyncMessage(t,e){const{message:s}=this;s.writeVarUint(Ie.Sync);const i=((t,e,s,i)=>{const n=be(t);switch(n){case 0:((t,e,s)=>{((t,e,s)=>{oe(t,1),he(t,M.encodeStateAsUpdate(e,s))})(e,s,ge(t))})(t,e,s);break;case 1:Pe(t,s,i);break;case 2:Re(t,s,i);break;default:throw Error("Unknown message type")}return n})(s.decoder,s.encoder,t.document,t);e&&1===i&&(t.synced=!0)}applySyncStatusMessage(t,e){e&&t.decrementUnsyncedChanges()}applyAwarenessMessage(t){if(!t.awareness)return;const{message:e}=this;((t,e,s)=>{const i=me(e),n=ke(),o=[],r=[],a=[],c=[],h=be(i);for(let e=0;e<h;e++){const e=be(i);let s=be(i);const h=JSON.parse(ye(i)),l=t.meta.get(e),d=t.states.get(e),u=void 0===l?0:l.clock;(u<s||u===s&&null===h&&t.states.has(e))&&(null===h?e===t.clientID&&null!=t.getLocalState()?s++:t.states.delete(e):t.states.set(e,h),t.meta.set(e,{clock:s,lastUpdated:n}),void 0===l&&null!==h?o.push(e):void 0!==l&&null===h?c.push(e):null!==h&&(Ae(h,d)||a.push(e),r.push(e)))}(o.length>0||a.length>0||c.length>0)&&t.emit("change",[{added:o,updated:a,removed:c},s]),(o.length>0||r.length>0||c.length>0)&&t.emit("update",[{added:o,updated:r,removed:c},s])})(t.awareness,e.readVarUint8Array(),t)}applyAuthMessage(t){const{message:e}=this;((t,e,s,i)=>{switch(Wt(t)){case Vt.Token:e();break;case Vt.PermissionDenied:s(Lt(t));break;case Vt.Authenticated:i(Lt(t))}})(e.decoder,t.sendToken.bind(t),t.permissionDeniedHandler.bind(t),t.authenticatedHandler.bind(t))}applyQueryAwarenessMessage(t){if(!t.awareness)return;const{message:e}=this;e.writeVarUint(Ie.Awareness),e.writeVarUint8Array(Te(t.awareness,Array.from(t.awareness.getStates().keys())))}}class Le{constructor(t,e={}){this.message=new t,this.encoder=this.message.get(e)}create(){return ie(this.encoder)}send(t){null==t||t.send(this.create())}}class Ve extends Me{constructor(){super(...arguments),this.type=Ie.Auth,this.description="Authentication"}get(t){if(void 0===t.token)throw Error("The authentication message requires `token` as an argument.");return ce(this.encoder,t.documentName),oe(this.encoder,this.type),((t,e)=>{St(t,Vt.Token),Dt(t,e)})(this.encoder,t.token),this.encoder}}class Ne extends Me{constructor(){super(...arguments),this.type=Ie.Awareness,this.description="Awareness states update"}get(t){if(void 0===t.awareness)throw Error("The awareness message requires awareness as an argument");if(void 0===t.clients)throw Error("The awareness message requires clients as an argument");let e;return ce(this.encoder,t.documentName),oe(this.encoder,this.type),e=void 0===t.states?Te(t.awareness,t.clients):Te(t.awareness,t.clients,t.states),he(this.encoder,e),this.encoder}}class Fe extends Me{constructor(){super(...arguments),this.type=Ie.Stateless,this.description="A stateless message"}get(t){var e;return ce(this.encoder,t.documentName),oe(this.encoder,this.type),ce(this.encoder,null!==(e=t.payload)&&void 0!==e?e:""),this.encoder}}class He extends Me{constructor(){super(...arguments),this.type=Ie.Sync,this.description="First sync step"}get(t){if(void 0===t.document)throw Error("The sync step one message requires document as an argument");return ce(this.encoder,t.documentName),oe(this.encoder,this.type),((t,e)=>{oe(t,0);const s=M.encodeStateVector(e);he(t,s)})(this.encoder,t.document),this.encoder}}class Ke extends Me{constructor(){super(...arguments),this.type=Ie.Sync,this.description="A document update"}get(t){return ce(this.encoder,t.documentName),oe(this.encoder,this.type),((t,e)=>{oe(t,2),he(t,e)})(this.encoder,t.update),this.encoder}}class Je extends Error{constructor(){super(...arguments),this.code=1001}}class Ye extends Se{constructor(t){var e,s,i;super(),this.configuration={name:"",document:void 0,awareness:void 0,token:null,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.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=t=>this.emit("status",t),this.forwardClose=t=>this.emit("close",t),this.forwardDisconnect=t=>this.emit("disconnect",t),this.forwardDestroy=()=>this.emit("destroy"),this.setConfiguration(t),this.configuration.document=t.document?t.document:new M.Doc,this.configuration.awareness=void 0!==t.awareness?t.awareness:new xe(this.document),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),null===(e=this.awareness)||void 0===e||e.on("update",(()=>{this.emit("awarenessUpdate",{states:Nt(this.awareness.getStates())})})),null===(s=this.awareness)||void 0===s||s.on("change",(()=>{this.emit("awarenessChange",{states:Nt(this.awareness.getStates())})})),this.document.on("update",this.boundDocumentUpdateHandler),null===(i=this.awareness)||void 0===i||i.on("update",this.boundAwarenessUpdateHandler),this.registerEventListeners(),this.configuration.forceSyncInterval&&"number"==typeof this.configuration.forceSyncInterval&&(this.intervals.forceSync=setInterval(this.forceSync.bind(this),this.configuration.forceSyncInterval)),this.manageSocket&&this.attach()}setConfiguration(t={}){t.websocketProvider||(this.manageSocket=!0,this.configuration.websocketProvider=new Ue(t)),this.configuration={...this.configuration,...t}}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-=1),0===this.unsyncedChanges&&(this.synced=!0),this.emit("unsyncedChanges",{number:this.unsyncedChanges})}forceSync(){this.resetUnsyncedChanges(),this.send(He,{document:this.document,documentName:this.configuration.name})}pageHide(){this.awareness&&Ee(this.awareness,[this.document.clientID],"page hide")}registerEventListeners(){"undefined"!=typeof window&&"addEventListener"in window&&window.addEventListener("pagehide",this.boundPageHide)}sendStateless(t){this.send(Fe,{documentName:this.configuration.name,payload:t})}async sendToken(){let t;try{t=await this.getToken()}catch(t){return void this.permissionDeniedHandler("Failed to get token during sendToken(): "+t)}this.send(Ve,{token:null!=t?t:"",documentName:this.configuration.name})}documentUpdateHandler(t,e){e!==this&&(this.incrementUnsyncedChanges(),this.send(Ke,{update:t,documentName:this.configuration.name}))}awarenessUpdateHandler({added:t,updated:e,removed:s},i){const n=t.concat(e).concat(s);this.send(Ne,{awareness:this.awareness,clients:n,documentName:this.configuration.name})}get synced(){return this.isSynced}set synced(t){this.isSynced!==t&&(this.isSynced=t,t&&this.emit("synced",{state:t}))}receiveStateless(t){this.emit("stateless",{payload:t})}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(t){this.isAuthenticated=!1,this.emit("open",{event:t}),await this.sendToken(),this.startSync()}async getToken(){return"function"==typeof this.configuration.token?await this.configuration.token():this.configuration.token}startSync(){this.resetUnsyncedChanges(),this.send(He,{document:this.document,documentName:this.configuration.name}),this.awareness&&null!==this.awareness.getLocalState()&&this.send(Ne,{awareness:this.awareness,clients:[this.document.clientID],documentName:this.configuration.name})}send(t,e){if(!this._isAttached)return;const s=new Le(t,e);this.emit("outgoingMessage",{message:s.message}),s.send(this.configuration.websocketProvider)}onMessage(t){const e=new Oe(t.data),s=e.readVarString();e.writeVarString(s),this.emit("message",{event:t,message:new Oe(t.data)}),new We(e).apply(this,!0)}onClose(){this.isAuthenticated=!1,this.synced=!1,this.awareness&&Ee(this.awareness,Array.from(this.awareness.getStates().keys()).filter((t=>t!==this.document.clientID)),this)}destroy(){this.emit("destroy"),this.intervals.forceSync&&clearInterval(this.intervals.forceSync),this.awareness&&(Ee(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(),"undefined"!=typeof window&&"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),this._isAttached=!0)}permissionDeniedHandler(t){this.emit("authenticationFailed",{reason:t}),this.isAuthenticated=!1}authenticatedHandler(t){this.isAuthenticated=!0,this.authorizedScope=t,this.emit("authenticated",{scope:t})}setAwarenessField(t,e){if(!this.awareness)throw new Je(`Cannot set awareness field "${t}" to ${JSON.stringify(e)}. You have disabled Awareness for this provider by explicitly passing awareness: null in the provider configuration.`);this.awareness.setLocalStateField(t,e)}}const Ze={type:"pen",color:j[0],size:16,opacity:1,palettes:{pen:[...j]},sizes:{pen:[...c]}},qe={color:j[0],size:8,opacity:1,fontFamily:"Arial",palette:[...j],sizes:[...h]},Ge={color:j[0],size:4,opacity:1,palette:[...j],sizes:[...c],arrows:{end:{enabled:!0,style:"triangle"}}},_e={providers:[]},Xe={shapeType:l.Rectangle,fillColor:{light:"transparent",dark:"transparent"},strokeColor:j[0],strokeWidth:4,opacity:1,fontColor:j[0],fontSize:16,fontFamily:"Arial",palette:[...j],sizes:[...c]},$e=t(class extends e{constructor(t){super(),!1!==t&&this.__registerHost(),this.isReady=s(this,"isReady"),this.activeWorkspaceChange=s(this,"activeWorkspaceChange"),this.objectsChange=s(this,"objectsChange"),this.objectsAdded=s(this,"objectsAdded"),this.objectsRemoved=s(this,"objectsRemoved"),this.objectsUpdated=s(this,"objectsUpdated"),this.undoStateChange=s(this,"undoStateChange"),this.themeChange=s(this,"themeChange"),this.localeChange=s(this,"localeChange"),this.viewportChange=s(this,"viewportChange"),this.logout=s(this,"logout"),this.login=s(this,"login"),this.isPublicChange=s(this,"isPublicChange"),this.awarenessChange=s(this,"awarenessChange")}get host(){return this}scaleMax=T;scaleMin=S;lockDrawingScale=!0;viewportBoundaryLeft=-1/0;viewportBoundaryRight=1/0;viewportBoundaryTop=-1/0;viewportBoundaryBottom=1/0;debugInfo={showViewportInfo:!1,showObjectInfo:!1,showSyncProviderInfo:!0,showMigrationInfo:!0,showAssetResolverInfo:!1};user;activeUsers;controls=[{name:"selection",type:"tool",isDefault:!0,tool:d,icon:"cursor"},{name:"brush",type:"tool",tool:f,icon:"pen",config:Ze},{name:"eraser",type:"tool",tool:b,icon:"eraser"},{name:"line",type:"tool",tool:y,icon:"arrow",config:Ge},{name:"shape",type:"tool",tool:k,icon:"shape-rectangle",config:Xe,subOptions:[{id:"rectangle",icon:"shape-rectangle",label:"Rectangle",value:l.Rectangle,toolProperty:"shapeType"},{id:"ellipse",icon:"shape-ellipse",label:"Ellipse",value:l.Ellipse,toolProperty:"shapeType"},{id:"triangle",icon:"shape-triangle",label:"Triangle",value:l.Triangle,toolProperty:"shapeType"}]},{name:"text",type:"tool",tool:u,icon:"type",config:qe},{name:"image",type:"tool",tool:v,icon:"image"},{name:"config",type:"config"}];globalContextMenuItems=[{label:"menu.paste",icon:"paste",action:t=>this.engineRef.paste(t.x,t.y)},{label:"menu.selectAll",icon:"select-all",action:()=>this.selectAllObjectsInViewport()}];objectContextMenuItems=[{label:"menu.copy",icon:"copy",group:"clipboard",action:()=>this.engineRef.copy()},{label:"menu.cut",icon:"cut",group:"clipboard",action:()=>this.engineRef.cut()},{label:"menu.paste",icon:"paste",group:"clipboard",action:t=>this.engineRef.paste(t.x,t.y)},{label:"menu.order",icon:"ordering",group:"other",children:[{label:"menu.bringToFront",icon:"bring-to-front",action:()=>this.engineRef.bringToFront()},{label:"menu.sendToBack",icon:"send-to-back",action:()=>this.engineRef.sendToBack()},{label:"menu.moveUp",icon:"arrow-up-from-dot",action:()=>this.engineRef.bringForward()},{label:"menu.moveDown",icon:"arrow-down-from-dot",action:()=>this.engineRef.sendBackward()}]},{label:"menu.align",icon:"align",group:"other",children:[{label:"menu.alignLeft",icon:"align-start-vertical",action:()=>this.engineRef.alignObjects(w.StartHorizontal)},{label:"menu.alignCenterHorizontal",icon:"align-center-horizontal",action:()=>this.engineRef.alignObjects(w.CenterHorizontal)},{label:"menu.alignRight",icon:"align-end-vertical",action:()=>this.engineRef.alignObjects(w.EndHorizontal)},{label:"menu.alignTop",icon:"align-start-horizontal",action:()=>this.engineRef.alignObjects(w.StartVertical)},{label:"menu.alignCenterVertical",icon:"align-center-vertical",action:()=>this.engineRef.alignObjects(w.CenterVertical)},{label:"menu.alignBottom",icon:"align-end-horizontal",action:()=>this.engineRef.alignObjects(w.EndVertical)}]},{label:"menu.group",icon:"group",group:"other",children:[{label:"menu.group",icon:"group",action:()=>this.engineRef.group()},{label:"menu.ungroup",icon:"ungroup",action:()=>this.engineRef.ungroup()}]},{label:"menu.export",icon:"download",group:"export",children:[{label:"menu.exportAsSvg",icon:"download",action:()=>this.engineRef.exportSelectedObjectsAsSvg()},{label:"menu.exportAsPng",icon:"download",action:()=>this.engineRef.exportSelectedObjectsAsPng()}]},{label:"menu.delete",icon:"delete",group:"edit",action:()=>this.engineRef.delete()}];themes;theme="light";licenseKey;locale="en";locales;fallbackLocale="en";customSvgIcons={};isPanningEnabled=!0;isZoomingEnabled=!0;isControlsVisible=!0;isUtilityPanelVisible=!0;isWorkspaceManagerVisible=!0;isMoreMenuVisible=!0;isZoomPanelVisible=!0;isObjectDistanceFadingActive=!1;syncConfig=z;assetStorageConfig=_e;cursorTarget;loginConfig;isLoading=!1;editorId;activeWorkspaceId;isReady;activeWorkspaceChange;objectsChange;objectsAdded;objectsRemoved;objectsUpdated;undoStateChange;themeChange;localeChange;viewportChange;logout;login;isPublicChange;awarenessChange;isEngineReady=!1;isControlsReady=!1;isWorkspaceManagerReady=!1;workspaces=[];activeWorkspace;isVirtualKeyboardOpen=!1;undoState=null;isBackToContentButtonVisible=!1;resolvedTerms={};availableLocaleOptions=[];currentZoomPercent=100;shortcuts=[];currentIsPublic=!1;isEditorVisible=!1;activeNotification;isNotificationDismissing=!1;isEngineLoading=!0;notificationDismissTimeout;notificationDismissAnimationTimeout;notificationDisplayDurationMs=5e3;notificationDismissAnimationDurationMs=180;isNotificationHovered=!1;onIsEngineReady(t){t&&this.isControlsReady&&this.checkIsReady()}onIsControlsReady(t){t&&this.isEngineReady&&this.checkIsReady()}onWorkspacesChange(t){const e=this.activeWorkspace;if(e){const s=t.find((t=>t.id===e.id));s&&s!==e&&(this.activeWorkspace=s)}if(this.activeWorkspaceId){const e=t.find((t=>t.id===this.activeWorkspaceId));e&&e!==this.activeWorkspace&&(this.activeWorkspace=e)}}onActiveWorkspaceChange(){this.updateCurrentIsPublic()}onActiveWorkspaceIdChange(t){if(!t)return;if(0===this.workspaces.length)return;const e=this.workspaces.find((e=>e.id===t));e?e!==this.activeWorkspace&&(this.activeWorkspace=e):console.warn("[KritzelEditor] No workspace found with ID: "+t)}onCurrentThemeChange(){this.applyTheme(),setTimeout((()=>this.setOsSpecificCssVariables()),0),this.engineRef&&this.engineRef.saveSettings(this.currentSettingsConfig)}onThemesChange(){this.applyTheme()}onLocaleChange(t){this.engineRef&&(this.engineRef.setLocale(t),this.engineRef.saveSettings(this.currentSettingsConfig),this.refreshLocalizedTerms())}async refreshLocalizedTerms(){this.engineRef&&(this.resolvedTerms=await this.engineRef.getResolvedTerms(),this.availableLocaleOptions=await this.engineRef.getAvailableLocaleOptions())}onTouchStart(t){t.cancelable&&t.preventDefault()}async getObjectById(t){return this.engineRef.getObjectById(t)}async addObject(t){return this.engineRef.addObject(t)}async addObjects(t){return this.engineRef.addObjects(t)}async updateObject(t,e){return this.engineRef.updateObject(t,e)}async removeObject(t){return this.engineRef.removeObject(t)}async removeObjects(t){return this.engineRef.removeObjects(t)}async getSelectedObjects(){return this.engineRef.getSelectedObjects()}async selectObjects(t){return this.engineRef.selectObjects(t)}async selectAllObjectsInViewport(){return this.engineRef.selectAllObjectsInViewport()}async clearSelection(){this.engineRef.clearSelection()}async centerObjectInViewport(t){return this.engineRef.centerObjectInViewport(t)}async panToObject(t){return this.engineRef.panToObject(t)}async backToContent(){return this.engineRef.backToContent()}async centerAllObjects(t=!0){return this.engineRef.centerAllObjects(t)}async centerObjects(t,e=!0){return this.engineRef.centerObjects(t,e)}async setViewport(t,e,s){return this.engineRef.setViewport(t,e,s)}async panTo(t,e){return this.engineRef.panTo(t,e)}async zoomTo(t,e,s){return this.engineRef.zoomTo(t,e,s)}async zoomIn(t=1.6,e=200){return this.engineRef.zoomIn(t,e)}async zoomOut(t=1.6,e=200){return this.engineRef.zoomOut(t,e)}async getViewport(){return this.engineRef.getViewport()}async screenToWorld(t,e){return this.engineRef.screenToWorld(t,e)}async worldToScreen(t,e){return this.engineRef.worldToScreen(t,e)}async createWorkspace(t){return this.engineRef.createWorkspace(t)}async updateWorkspace(t){return this.engineRef.updateWorkspace(t)}async deleteWorkspace(t){return this.engineRef.deleteWorkspace(t)}async getWorkspaces(){return this.engineRef.getWorkspaces()}async getActiveWorkspace(){return this.engineRef.getActiveWorkspace()}async loadSharedWorkspace(t){return this.engineRef.loadSharedWorkspace(t)}async reinitSync(){return this.engineRef.reinitSync()}async registerTool(t,e,s){return this.engineRef.registerTool(t,e,s)}async changeActiveTool(t){return this.engineRef.changeActiveTool(t)}async changeActiveToolByName(t){return this.engineRef.changeActiveToolByName(t)}async disable(){return this.engineRef.disable()}async enable(){return this.engineRef.enable()}async copy(){return this.engineRef.copy()}async cut(){return this.engineRef.cut()}async paste(t,e){return this.engineRef.paste(t,e)}async delete(){return this.engineRef.delete()}async bringForward(t){return this.engineRef.bringForward(t)}async sendBackward(t){return this.engineRef.sendBackward(t)}async bringToFront(t){return this.engineRef.bringToFront(t)}async sendToBack(t){return this.engineRef.sendToBack(t)}async alignObjects(t){return this.engineRef.alignObjects(t)}async group(){return this.engineRef.group()}async ungroup(){return this.engineRef.ungroup()}async undo(){return this.engineRef.undo()}async redo(){return this.engineRef.redo()}async getScreenshot(t="png",e){return this.engineRef.getScreenshot(t,e)}async exportViewportAsPng(t){return this.engineRef.exportViewportAsPng(t)}async exportViewportAsSvg(t){return this.engineRef.exportViewportAsSvg(t)}async exportSelectedObjectsAsPng(){return this.engineRef.exportSelectedObjectsAsPng()}async exportSelectedObjectsAsSvg(){return this.engineRef.exportSelectedObjectsAsSvg()}async downloadAsJson(t){return this.engineRef.downloadAsJson(t)}async importFromFile(){return this.engineRef.importFromFile()}async loadObjectsFromJson(t){return this.engineRef.loadObjectsFromJson(t)}async getObjectsTotalCount(){return this.engineRef.getObjectsTotalCount()}async getAllObjects(){return this.engineRef.getAllObjects()}async findObjects(t){return this.engineRef.findObjects(t)}async getObjectsInViewport(){return this.engineRef.getObjectsInViewport()}async hideContextMenu(){return this.engineRef.hideContextMenu()}async openContextMenu(t){return this.engineRef.openContextMenu(t)}async triggerSelectionChange(){return this.engineRef.triggerSelectionChange()}async getDisplayableShortcuts(){return this.engineRef.getDisplayableShortcuts()}async triggerNotification(t){const e={...t,id:t.id??D.generateUUID(),timestamp:t.timestamp??new Date};this.clearNotificationDismissAnimationTimer(),this.isNotificationDismissing=!1,this.isNotificationHovered=!1,this.activeNotification=e,this.scheduleNotificationDismiss()}engineRef;controlsRef;settingsRef;exportRef;splitButtonRef;shareDialogRef;loginDialogRef;currentUserDialogRef;componentWillLoad(){this.loadSettingsFromStorage(),this.applyTheme()}applyTheme(){const t=this.resolveThemeObject();A.applyThemeToElement(this.host,t)}resolveThemeObject(){return this.themes?.find((t=>t.name===this.theme))??("dark"===this.theme?x:E)}componentDidLoad(){this.registerCustomSvgIcons(),this.listenForMobileKeyboard(),this.setOsSpecificCssVariables()}disconnectedCallback(){this.clearNotificationDismissTimer(),this.clearNotificationDismissAnimationTimer()}async checkIsReady(){if(await customElements.whenDefined("kritzel-editor"),await customElements.whenDefined("kritzel-workspace-manager"),await customElements.whenDefined("kritzel-controls"),await customElements.whenDefined("kritzel-engine"),!(this.isEngineReady&&this.isControlsReady&&this.isWorkspaceManagerReady&&this.activeWorkspace))return;this.isEditorVisible=!0;const{id:t,name:e,isPublic:s,createdAt:i,updatedAt:n}=this.activeWorkspace;this.isReady.emit({host:this.host,activeWorkspace:{id:t,name:e,isPublic:s,createdAt:i,updatedAt:n},syncConfig:this.syncConfig,assetStorageConfig:this.assetStorageConfig,loginConfig:this.loginConfig,theme:this.theme})}async onEngineReady(t){if(this.isEngineReady=!0,!t.detail.activeWorkspace)return;this.activeWorkspace=t.detail.activeWorkspace,this.workspaces=t.detail.workspaces,this.currentIsPublic=await this.engineRef.getIsPublic(),await this.refreshLocalizedTerms();const e=await this.engineRef.getViewport();this.currentZoomPercent=this.getZoomPercentFromScale(e.scale),this.loadShortcuts()}handleWorkspacesChange(t){t.stopPropagation(),this.workspaces=t.detail}handleActiveWorkspaceChange(t){if(t.stopPropagation(),this.activeWorkspace=t.detail,!this.isEngineReady)return;const{id:e,name:s,isPublic:i,createdAt:n,updatedAt:o}=this.activeWorkspace;this.activeWorkspaceChange.emit({id:e,name:s,isPublic:i,createdAt:n,updatedAt:o})}handleObjectsChange(t){t.stopPropagation(),this.objectsChange.emit(t.detail)}handleObjectsAdded(t){t.stopPropagation(),this.objectsAdded.emit(t.detail)}handleObjectsRemoved(t){t.stopPropagation(),this.objectsRemoved.emit(t.detail)}handleObjectsUpdated(t){t.stopPropagation(),this.objectsUpdated.emit(t.detail)}handleUndoStateChange(t){t.stopPropagation(),this.undoStateChange.emit(t.detail),this.undoState=t.detail}async handleObjectsInViewportChange(t){t.stopPropagation();const e=this.getContentObjects(t.detail).length>0,s=this.getContentObjects(await this.engineRef.getAllObjects()).length>0;this.isBackToContentButtonVisible=!e&&s}handleViewportChange(t){t.stopPropagation(),this.currentZoomPercent=this.getZoomPercentFromScale(t.detail.scale),this.viewportChange.emit(t.detail)}getZoomPercentFromScale(t){return!Number.isFinite(t)||t<=0?100:Math.round(100*t)}handleAwarenessChange(t){t.stopPropagation(),this.awarenessChange.emit(t.detail)}handleLoadingChange(t){t.stopPropagation(),this.isEngineLoading=t.detail}handleNotificationsChange(t){t.stopPropagation(),this.clearNotificationDismissAnimationTimer(),this.isNotificationDismissing=!1,this.isNotificationHovered=!1,this.activeNotification=t.detail,this.scheduleNotificationDismiss()}handleNotificationHoverChange(t){t.stopPropagation(),this.isNotificationHovered=t.detail,this.isNotificationHovered?this.clearNotificationDismissTimer():this.activeNotification&&!this.isNotificationDismissing&&this.scheduleNotificationDismiss()}scheduleNotificationDismiss(){this.clearNotificationDismissTimer(),this.notificationDismissTimeout=setTimeout((()=>{this.dismissNotification()}),this.notificationDisplayDurationMs)}clearNotificationDismissTimer(){this.notificationDismissTimeout&&(clearTimeout(this.notificationDismissTimeout),this.notificationDismissTimeout=void 0)}clearNotificationDismissAnimationTimer(){this.notificationDismissAnimationTimeout&&(clearTimeout(this.notificationDismissAnimationTimeout),this.notificationDismissAnimationTimeout=void 0)}dismissNotification=()=>{this.clearNotificationDismissTimer(),this.isNotificationHovered=!1,this.activeNotification&&!this.isNotificationDismissing&&(this.isNotificationDismissing=!0,this.clearNotificationDismissAnimationTimer(),this.notificationDismissAnimationTimeout=setTimeout((()=>{this.activeNotification=void 0,this.isNotificationDismissing=!1,this.notificationDismissAnimationTimeout=void 0}),this.notificationDismissAnimationDurationMs))};handleSettingsChange(t){this.scaleMin=t.detail.scaleMin,this.scaleMax=t.detail.scaleMax,this.lockDrawingScale=t.detail.lockDrawingScale,this.theme=t.detail.theme,"string"==typeof t.detail.locale&&t.detail.locale!==this.locale&&(this.locale=t.detail.locale,this.localeChange.emit(t.detail.locale)),this.viewportBoundaryLeft=t.detail.viewportBoundaryLeft??-1/0,this.viewportBoundaryRight=t.detail.viewportBoundaryRight??1/0,this.viewportBoundaryTop=t.detail.viewportBoundaryTop??-1/0,this.viewportBoundaryBottom=t.detail.viewportBoundaryBottom??1/0,this.debugInfo=t.detail.debugInfo,this.engineRef&&this.engineRef.saveSettings(t.detail),this.themeChange.emit(t.detail.theme)}get moreMenuItems(){return[{id:"share",label:this.resolvedTerms["menu.share"]??"Share",icon:"share",action:()=>{this.isLoggedIn||!this.loginConfig?this.shareDialogRef.open():this.openLoginDialog()}},{id:"export",label:this.resolvedTerms["menu.export"]??"Export",icon:"upload",action:async()=>{const t=await this.engineRef.getScreenshot("png");this.exportRef.open(t??void 0)}},{id:"import",label:this.resolvedTerms["menu.import"]??"Import",icon:"download",action:()=>this.engineRef.importFromFile()},{id:"settings",label:this.resolvedTerms["menu.settings"]??"Settings",icon:"settings",action:()=>this.settingsRef.open()}]}handleToggleIsPublic=async t=>{const e=t.detail,s=await this.engineRef.getActiveWorkspace();s.isPublic=e,await this.engineRef.updateWorkspace(s),this.activeWorkspace=s.clone(),this.isPublicChange.emit({isPublic:e,workspaceId:s.id})};updateCurrentIsPublic(){const t=this.activeWorkspace?.isPublic??!1,e=this.activeWorkspace?.id;this.currentIsPublic=t,e&&this.isPublicChange.emit({isPublic:t,workspaceId:e})}handleProviderLogin=t=>{this.login.emit(t.detail)};handleCurrentUserLogout=()=>{this.logout.emit()};get isLoggedIn(){return!!this.user&&!this.user.isGuest}async openLoginDialog(){this.loginDialogRef?.open()}async setLoginLoading(t){this.loginDialogRef?.setLoading(t)}async setLocale(t){this.locale=t,await(this.engineRef?.setLocale(t))}async getLocale(){return this.engineRef?this.engineRef.getLocale():this.locale}async getAvailableLocales(){return this.engineRef?this.engineRef.getAvailableLocales():[]}async registerLocales(t){await(this.engineRef?.registerLocales(t))}async t(t,e){return this.engineRef?this.engineRef.t(t,e):t}getSettingsStorageKey(){return this.editorId?"kritzel-settings-"+this.editorId:"kritzel-settings"}loadSettingsFromStorage(){const t=localStorage.getItem(this.getSettingsStorageKey());if(t)try{const e=JSON.parse(t);"number"==typeof e.scaleMin&&(this.scaleMin=e.scaleMin),"number"==typeof e.scaleMax&&(this.scaleMax=e.scaleMax),"boolean"==typeof e.lockDrawingScale&&(this.lockDrawingScale=e.lockDrawingScale),"string"==typeof e.theme&&(this.theme=e.theme),"string"==typeof e.locale&&(this.locale=e.locale),"number"==typeof e.viewportBoundaryLeft&&(this.viewportBoundaryLeft=e.viewportBoundaryLeft),"number"==typeof e.viewportBoundaryRight&&(this.viewportBoundaryRight=e.viewportBoundaryRight),"number"==typeof e.viewportBoundaryTop&&(this.viewportBoundaryTop=e.viewportBoundaryTop),"number"==typeof e.viewportBoundaryBottom&&(this.viewportBoundaryBottom=e.viewportBoundaryBottom),e.debugInfo&&(this.debugInfo={...this.debugInfo,...e.debugInfo})}catch{}}async loadShortcuts(){this.shortcuts=await this.engineRef.getDisplayableShortcuts()}get currentSettingsConfig(){return{scaleMin:this.scaleMin,scaleMax:this.scaleMax,lockDrawingScale:this.lockDrawingScale,theme:this.theme,locale:this.locale,viewportBoundaryLeft:this.viewportBoundaryLeft,viewportBoundaryRight:this.viewportBoundaryRight,viewportBoundaryTop:this.viewportBoundaryTop,viewportBoundaryBottom:this.viewportBoundaryBottom,debugInfo:this.debugInfo}}getContentObjects(t){return t.filter((t=>!(t instanceof p||t instanceof m)))}registerCustomSvgIcons(){for(const[t,e]of Object.entries(this.customSvgIcons))r.register(t,e)}listenForMobileKeyboard(){g.onKeyboardVisibleChanged((t=>{this.isVirtualKeyboardOpen=t}))}setOsSpecificCssVariables(){switch(I.detectOS()){case"iOS":this.host.style.setProperty("--kritzel-editor-top-left-buttons-top","14px"),this.host.style.setProperty("--kritzel-editor-top-left-buttons-left","14px"),this.host.style.setProperty("--kritzel-editor-controls-bottom","14px"),this.host.style.setProperty("--kritzel-editor-controls-transition","cubic-bezier(0.25, 0.1, 0.25, 1.0)"),this.host.style.setProperty("--kritzel-editor-controls-transform","translateY(200%)"),this.host.style.setProperty("--kritzel-editor-controls-transition-duration","0.25s");break;case"Android":this.host.style.setProperty("--kritzel-editor-top-left-buttons-top","14px"),this.host.style.setProperty("--kritzel-editor-top-left-buttons-left","14px"),this.host.style.setProperty("--kritzel-editor-controls-bottom","24px"),this.host.style.setProperty("--kritzel-editor-controls-transition","cubic-bezier(0.25, 0.1, 0.25, 1.0)"),this.host.style.setProperty("--kritzel-editor-controls-transform","translateY(200%)"),this.host.style.setProperty("--kritzel-editor-controls-transition-duration","0.25s");break;default:this.host.style.setProperty("--kritzel-editor-top-left-buttons-top","14px"),this.host.style.setProperty("--kritzel-editor-top-left-buttons-left","14px"),this.host.style.setProperty("--kritzel-editor-controls-bottom","14px")}}render(){const t=this.isLoggedIn,e=t,s=this.isReady&&!!this.loginConfig&&!t;return i(n,{key:"a397bb3a5ab632193a0d6af07054d9235c8af7ba"},i("kritzel-loading-overlay",{key:"8ac3ec51ec15a7ce3dfac4e1afb7e2d272d6fee2",visible:this.isLoading||!this.isEditorVisible||this.isEngineLoading,text:this.resolvedTerms["engine.loading"]??"Loading..."}),i("div",{key:"0ac709cf7d3e9889f99675f20c1f2ac5bcca55da",class:"editor-content",style:{opacity:this.isEditorVisible?"1":"0",visibility:this.isEditorVisible?"visible":"hidden",transition:"opacity 0.2s ease-in-out, visibility 0.2s ease-in-out"}},i("div",{key:"019cbb191155260c635cb13a4d94eebbb5913045",class:"top-left-buttons"},i("kritzel-workspace-manager",{key:"b9a60281c57f90dedebd2a01ccc27a689a8f2a09",visible:this.isWorkspaceManagerVisible,workspaces:this.workspaces,activeWorkspace:this.activeWorkspace,terms:this.resolvedTerms,onWorkspaceChange:t=>this.activeWorkspace=t.detail,onIsWorkspaceManagerReady:()=>this.isWorkspaceManagerReady=!0}),i("kritzel-back-to-content",{key:"b0b625e1cd07f29d9622b03e49cf75c9324b2d38",visible:this.isBackToContentButtonVisible,text:this.resolvedTerms["backToContent.label"]??"Back to content",onBackToContent:()=>this.backToContent()})),this.activeNotification&&i("div",{key:"80868e85dc8a0810750ff5dd04c59057d81fb823",class:"top-center-notification-layer",role:"presentation"},i("div",{key:"8cfe3895cb8dcd137950daff0e677d397c20817b",class:{"top-center-notification-container":!0,"is-dismissing":this.isNotificationDismissing},role:"presentation"},i("kritzel-notification-card",{key:"f50a8ff5fba9ee8df8bb0fa5c2b3198ad30fd8cd",notification:this.activeNotification,locale:this.locale,onDismiss:this.dismissNotification,onHoverChange:t=>this.handleNotificationHoverChange(t)}))),i("kritzel-engine",{key:"7b31643384b19dfd84b6093a4ccb719dd04b7669",ref:t=>{t&&(this.engineRef=t)},workspace:this.activeWorkspace,activeWorkspaceId:this.activeWorkspaceId,editorId:this.editorId,syncConfig:this.syncConfig,assetStorageConfig:this.assetStorageConfig,user:this.user,scaleMax:this.scaleMax,lockDrawingScale:this.lockDrawingScale,isObjectDistanceFadingActive:this.isObjectDistanceFadingActive,scaleMin:this.scaleMin,cursorTarget:this.cursorTarget,isLoading:this.isLoading,viewportBoundaryLeft:this.viewportBoundaryLeft,viewportBoundaryRight:this.viewportBoundaryRight,viewportBoundaryTop:this.viewportBoundaryTop,viewportBoundaryBottom:this.viewportBoundaryBottom,isPanningEnabled:this.isPanningEnabled,isZoomingEnabled:this.isZoomingEnabled,theme:this.theme,themes:this.themes,licenseKey:this.licenseKey,locale:this.locale,locales:this.locales,fallbackLocale:this.fallbackLocale,debugInfo:this.debugInfo,globalContextMenuItems:this.globalContextMenuItems,objectContextMenuItems:this.objectContextMenuItems,onIsEngineReady:t=>this.onEngineReady(t),onWorkspacesChange:t=>this.handleWorkspacesChange(t),onActiveWorkspaceChange:t=>this.handleActiveWorkspaceChange(t),onObjectsChange:t=>this.handleObjectsChange(t),onObjectsAdded:t=>this.handleObjectsAdded(t),onObjectsRemoved:t=>this.handleObjectsRemoved(t),onObjectsUpdated:t=>this.handleObjectsUpdated(t),onUndoStateChange:t=>this.handleUndoStateChange(t),onObjectsInViewportChange:t=>this.handleObjectsInViewportChange(t),onViewportChange:t=>this.handleViewportChange(t),onAwarenessChange:t=>this.handleAwarenessChange(t),onNotificationsChange:t=>this.handleNotificationsChange(t),onLoadingChange:t=>this.handleLoadingChange(t)}),i("kritzel-controls",{key:"14ee52a07381785c4b8ce1f2e1b7304d44e0e128",visible:this.isControlsVisible,class:{"keyboard-open":this.isVirtualKeyboardOpen},ref:t=>{t&&(this.controlsRef=t)},controls:this.controls,isUtilityPanelVisible:this.isUtilityPanelVisible,undoState:this.undoState??void 0,theme:this.theme,terms:this.resolvedTerms,onIsControlsReady:()=>this.isControlsReady=!0}),i("div",{key:"c9ddf5fe7d74f32aff8182ce9dd70931f35a7274",class:"bottom-left-buttons"},i("kritzel-zoom-panel",{key:"3ede1bacaa3ff6876429347c8edc20939b1ec59e",visible:this.isZoomPanelVisible,disabled:!this.isZoomingEnabled,zoomPercent:this.currentZoomPercent,terms:this.resolvedTerms,onZoomIn:()=>this.zoomIn(),onZoomOut:()=>this.zoomOut()})),i("div",{key:"af1f5f33065d5693e1c363f6e0d49d43cf839f88",class:"top-right-buttons"},i("kritzel-settings",{key:"f281c4b2c47d0fa15e947c2bd9e6e34f6ab064cf",ref:t=>{t&&(this.settingsRef=t)},shortcuts:this.shortcuts,availableThemes:this.themes&&this.themes.length>0?this.themes.map((t=>t.name)):["light","dark"],availableLocales:this.availableLocaleOptions,settings:this.currentSettingsConfig,terms:this.resolvedTerms,onSettingsChange:t=>this.handleSettingsChange(t)}),i("kritzel-export",{key:"aa9f4d755cd429e287bd9dc513f059006e47c037",ref:t=>{t&&(this.exportRef=t)},workspaceName:this.activeWorkspace?.name||"workspace",terms:this.resolvedTerms,onExportPng:()=>this.engineRef.exportViewportAsPng(),onExportSvg:()=>this.engineRef.exportViewportAsSvg(),onExportJson:t=>this.engineRef.downloadAsJson(t.detail)}),i("kritzel-active-users",{key:"e7f019162bf7fa84c591e78c9255ed54d49d624f",users:this.activeUsers}),e&&i("kritzel-current-user",{key:"5b51e312ca1d94717c8eae781435a1c253dfecc3",user:this.user,terms:this.resolvedTerms,onClick:()=>this.currentUserDialogRef?.open()}),e&&i("kritzel-current-user-dialog",{key:"328297225ea30570baa1aeec8dffda3e5fb90f6e",ref:t=>{t&&(this.currentUserDialogRef=t,this.currentUserDialogRef.addEventListener("logoutRequest",this.handleCurrentUserLogout))},user:this.user,terms:this.resolvedTerms}),s&&i("kritzel-button",{key:"719da0f8c343b0e3be80b37318bb27e102ea0f1e",onButtonClick:()=>this.loginDialogRef?.open()},this.resolvedTerms["login.dialogTitle"]??"Sign in"),i("kritzel-more-menu",{key:"c3d0f82f8e21b53b966fcc99c598051b6e294b6a",items:this.moreMenuItems,visible:this.isMoreMenuVisible,terms:this.resolvedTerms}),i("kritzel-share-dialog",{key:"49a929e16684131fe4e0c7cc9d5f5ad769b6785c",ref:t=>{t&&(this.shareDialogRef=t)},isPublic:this.currentIsPublic,workspaceId:this.activeWorkspace?.id,terms:this.resolvedTerms,onToggleIsPublic:this.handleToggleIsPublic}),this.loginConfig&&i("kritzel-login-dialog",{key:"113bd2574096d3e64ff36b2b8d152b28ff4ba8f7",ref:t=>{t&&(this.loginDialogRef=t)},providers:this.loginConfig.providers,dialogTitle:this.loginConfig.title??this.resolvedTerms["login.dialogTitle"]??"Sign in",subtitle:this.loginConfig.subtitle,onProviderLogin:this.handleProviderLogin}))))}static get watchers(){return{isEngineReady:[{onIsEngineReady:0}],isControlsReady:[{onIsControlsReady:0}],workspaces:[{onWorkspacesChange:0}],activeWorkspace:[{onActiveWorkspaceChange:0}],activeWorkspaceId:[{onActiveWorkspaceIdChange:0}],theme:[{onCurrentThemeChange:0}],themes:[{onThemesChange:0}],locale:[{onLocaleChange:0}]}}static get style(){return"kritzel-editor{display:flex;margin:0;position:relative;container-type:inline-size;overflow:hidden;width:100%;height:100%;align-items:center;justify-content:center;touch-action:manipulation;user-select:none;-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;text-align:start;line-height:normal}.editor-content{position:absolute;inset:0}kritzel-controls{position:absolute;left:0;right:0;margin-inline:auto;width:max-content;max-width:calc(100% - 16px);bottom:var(--kritzel-editor-controls-bottom, 14px);transition:transform var(--kritzel-editor-controls-transition-duration, 0.1s) var(--kritzel-editor-controls-transition, ease-in-out)}kritzel-controls.keyboard-open{transform:var(--kritzel-editor-controls-transform, translateY(300%))}.top-left-buttons{position:absolute;top:var(--kritzel-editor-top-left-buttons-top, 14px);left:var(--kritzel-editor-top-left-buttons-left, 14px);display:flex;align-items:flex-start;gap:8px}.top-center-notification-layer{position:absolute;top:var(--kritzel-editor-top-center-notification-top, 14px);left:0;right:0;z-index:var(--kritzel-editor-top-center-notification-z-index, 10001);display:flex;justify-content:center;pointer-events:none}.top-center-notification-container{width:min(90vw, 420px);pointer-events:auto;animation:kritzel-notification-slide-in var(--kritzel-editor-notification-animation-duration, 220ms) var(--kritzel-editor-notification-animation-easing, cubic-bezier(0.22, 1, 0.36, 1))}.top-center-notification-container.is-dismissing{animation:kritzel-notification-fade-out var(--kritzel-editor-notification-dismiss-animation-duration, 180ms) var(--kritzel-editor-notification-dismiss-animation-easing, ease-in) forwards}@keyframes kritzel-notification-slide-in{from{opacity:0;transform:translateY(-10px)}to{opacity:1;transform:translateY(0)}}@keyframes kritzel-notification-fade-out{from{opacity:1;transform:translateY(0)}to{opacity:0;transform:translateY(-6px)}}@media (prefers-reduced-motion: reduce){.top-center-notification-container{animation:none}}.top-right-buttons{position:absolute;top:var(--kritzel-editor-top-right-buttons-top, 14px);right:var(--kritzel-editor-top-right-buttons-right, 14px);display:flex;align-items:center;gap:8px}.bottom-left-buttons{position:absolute;left:var(--kritzel-editor-top-left-buttons-left, 14px);bottom:var(--kritzel-editor-controls-bottom, 14px);display:flex;align-items:flex-end}@container (max-width: 767px){.bottom-left-buttons{display:none}}.top-right-button{display:flex;align-items:center;justify-content:center;width:50px;height:50px;padding:0;border:var(--kritzel-split-button-border, 1px solid #ebebeb);border-radius:var(--kritzel-split-button-border-radius, 12px);background-color:var(--kritzel-split-button-background-color, #ffffff);cursor:var(--kritzel-global-pointer-cursor, pointer);box-shadow:var(--kritzel-split-button-box-shadow, 0 0 3px rgba(0, 0, 0, 0.08));transition:background-color 150ms ease;-webkit-tap-highlight-color:transparent}.top-right-button:hover{background-color:#f5f5f5}.top-right-button:active{background-color:#ebebeb}"}},[512,"kritzel-editor",{scaleMax:[1026,"scale-max"],scaleMin:[1026,"scale-min"],lockDrawingScale:[1028,"lock-drawing-scale"],viewportBoundaryLeft:[1026,"viewport-boundary-left"],viewportBoundaryRight:[1026,"viewport-boundary-right"],viewportBoundaryTop:[1026,"viewport-boundary-top"],viewportBoundaryBottom:[1026,"viewport-boundary-bottom"],debugInfo:[1040],user:[16],activeUsers:[16],controls:[16],globalContextMenuItems:[16],objectContextMenuItems:[16],themes:[16],theme:[1025],licenseKey:[1,"license-key"],locale:[1025],locales:[16],fallbackLocale:[1,"fallback-locale"],customSvgIcons:[16],isPanningEnabled:[1028,"is-panning-enabled"],isZoomingEnabled:[1028,"is-zooming-enabled"],isControlsVisible:[4,"is-controls-visible"],isUtilityPanelVisible:[4,"is-utility-panel-visible"],isWorkspaceManagerVisible:[4,"is-workspace-manager-visible"],isMoreMenuVisible:[4,"is-more-menu-visible"],isZoomPanelVisible:[4,"is-zoom-panel-visible"],isObjectDistanceFadingActive:[4,"is-object-distance-fading-active"],syncConfig:[16],assetStorageConfig:[16],cursorTarget:[16],loginConfig:[16],isLoading:[4,"is-loading"],editorId:[1,"editor-id"],activeWorkspaceId:[1,"active-workspace-id"],isEngineReady:[32],isControlsReady:[32],isWorkspaceManagerReady:[32],workspaces:[32],activeWorkspace:[32],isVirtualKeyboardOpen:[32],undoState:[32],isBackToContentButtonVisible:[32],resolvedTerms:[32],availableLocaleOptions:[32],currentZoomPercent:[32],shortcuts:[32],currentIsPublic:[32],isEditorVisible:[32],activeNotification:[32],isNotificationDismissing:[32],isEngineLoading:[32],getObjectById:[64],addObject:[64],addObjects:[64],updateObject:[64],removeObject:[64],removeObjects:[64],getSelectedObjects:[64],selectObjects:[64],selectAllObjectsInViewport:[64],clearSelection:[64],centerObjectInViewport:[64],panToObject:[64],backToContent:[64],centerAllObjects:[64],centerObjects:[64],setViewport:[64],panTo:[64],zoomTo:[64],zoomIn:[64],zoomOut:[64],getViewport:[64],screenToWorld:[64],worldToScreen:[64],createWorkspace:[64],updateWorkspace:[64],deleteWorkspace:[64],getWorkspaces:[64],getActiveWorkspace:[64],loadSharedWorkspace:[64],reinitSync:[64],registerTool:[64],changeActiveTool:[64],changeActiveToolByName:[64],disable:[64],enable:[64],copy:[64],cut:[64],paste:[64],delete:[64],bringForward:[64],sendBackward:[64],bringToFront:[64],sendToBack:[64],alignObjects:[64],group:[64],ungroup:[64],undo:[64],redo:[64],getScreenshot:[64],exportViewportAsPng:[64],exportViewportAsSvg:[64],exportSelectedObjectsAsPng:[64],exportSelectedObjectsAsSvg:[64],downloadAsJson:[64],importFromFile:[64],loadObjectsFromJson:[64],getObjectsTotalCount:[64],getAllObjects:[64],findObjects:[64],getObjectsInViewport:[64],hideContextMenu:[64],openContextMenu:[64],triggerSelectionChange:[64],getDisplayableShortcuts:[64],triggerNotification:[64],openLoginDialog:[64],setLoginLoading:[64],setLocale:[64],getLocale:[64],getAvailableLocales:[64],registerLocales:[64],t:[64]},[[0,"dblclick","onTouchStart"]],{isEngineReady:[{onIsEngineReady:0}],isControlsReady:[{onIsControlsReady:0}],workspaces:[{onWorkspacesChange:0}],activeWorkspace:[{onActiveWorkspaceChange:0}],activeWorkspaceId:[{onActiveWorkspaceIdChange:0}],theme:[{onCurrentThemeChange:0}],themes:[{onThemesChange:0}],locale:[{onLocaleChange:0}]}]),Qe=$e,ts=function(){"undefined"!=typeof customElements&&["kritzel-editor","kritzel-active-users","kritzel-avatar","kritzel-awareness-cursors","kritzel-back-to-content","kritzel-button","kritzel-color","kritzel-color-palette","kritzel-context-menu","kritzel-controls","kritzel-current-user","kritzel-current-user-dialog","kritzel-cursor-trail","kritzel-dialog","kritzel-dropdown","kritzel-engine","kritzel-export","kritzel-font","kritzel-font-family","kritzel-font-size","kritzel-icon","kritzel-input","kritzel-line-endings","kritzel-loading-overlay","kritzel-login-dialog","kritzel-master-detail","kritzel-menu","kritzel-menu-item","kritzel-more-menu","kritzel-notification-card","kritzel-numeric-input","kritzel-opacity-slider","kritzel-pill-tabs","kritzel-portal","kritzel-settings","kritzel-shape-fill","kritzel-share-dialog","kritzel-slide-toggle","kritzel-split-button","kritzel-stroke-size","kritzel-tool-config","kritzel-tooltip","kritzel-utility-panel","kritzel-watermark","kritzel-workspace-manager","kritzel-zoom-panel"].forEach((t=>{switch(t){case"kritzel-editor":customElements.get(o(t))||customElements.define(o(t),$e);break;case"kritzel-active-users":customElements.get(o(t))||B();break;case"kritzel-avatar":customElements.get(o(t))||U();break;case"kritzel-awareness-cursors":customElements.get(o(t))||P();break;case"kritzel-back-to-content":customElements.get(o(t))||R();break;case"kritzel-button":customElements.get(o(t))||W();break;case"kritzel-color":customElements.get(o(t))||L();break;case"kritzel-color-palette":customElements.get(o(t))||V();break;case"kritzel-context-menu":customElements.get(o(t))||N();break;case"kritzel-controls":customElements.get(o(t))||F();break;case"kritzel-current-user":customElements.get(o(t))||H();break;case"kritzel-current-user-dialog":customElements.get(o(t))||K();break;case"kritzel-cursor-trail":customElements.get(o(t))||J();break;case"kritzel-dialog":customElements.get(o(t))||Y();break;case"kritzel-dropdown":customElements.get(o(t))||Z();break;case"kritzel-engine":customElements.get(o(t))||C();break;case"kritzel-export":customElements.get(o(t))||q();break;case"kritzel-font":customElements.get(o(t))||G();break;case"kritzel-font-family":customElements.get(o(t))||_();break;case"kritzel-font-size":customElements.get(o(t))||X();break;case"kritzel-icon":customElements.get(o(t))||a();break;case"kritzel-input":customElements.get(o(t))||$();break;case"kritzel-line-endings":customElements.get(o(t))||Q();break;case"kritzel-loading-overlay":customElements.get(o(t))||tt();break;case"kritzel-login-dialog":customElements.get(o(t))||et();break;case"kritzel-master-detail":customElements.get(o(t))||st();break;case"kritzel-menu":customElements.get(o(t))||nt();break;case"kritzel-menu-item":customElements.get(o(t))||it();break;case"kritzel-more-menu":customElements.get(o(t))||ot();break;case"kritzel-notification-card":customElements.get(o(t))||rt();break;case"kritzel-numeric-input":customElements.get(o(t))||at();break;case"kritzel-opacity-slider":customElements.get(o(t))||ct();break;case"kritzel-pill-tabs":customElements.get(o(t))||ht();break;case"kritzel-portal":customElements.get(o(t))||lt();break;case"kritzel-settings":customElements.get(o(t))||dt();break;case"kritzel-shape-fill":customElements.get(o(t))||ut();break;case"kritzel-share-dialog":customElements.get(o(t))||pt();break;case"kritzel-slide-toggle":customElements.get(o(t))||mt();break;case"kritzel-split-button":customElements.get(o(t))||gt();break;case"kritzel-stroke-size":customElements.get(o(t))||ft();break;case"kritzel-tool-config":customElements.get(o(t))||bt();break;case"kritzel-tooltip":customElements.get(o(t))||yt();break;case"kritzel-utility-panel":customElements.get(o(t))||kt();break;case"kritzel-watermark":customElements.get(o(t))||O();break;case"kritzel-workspace-manager":customElements.get(o(t))||vt();break;case"kritzel-zoom-panel":customElements.get(o(t))||wt()}}))};export{Ze as D,Ye as H,Qe as KritzelEditor,Ue as a,qe as b,Ge as c,_e as d,ts as defineCustomElement}